1 line
111 KiB
Plaintext
1 line
111 KiB
Plaintext
|
{"version":3,"file":"css-vars-ponyfill.esm.js","sources":["../node_modules/get-css-data/dist/get-css-data.esm.js","../node_modules/balanced-match/index.js","../src/parse-css.js","../src/parse-vars.js","../src/stringify-css.js","../src/walk-css.js","../src/transform-css.js","../src/index.js"],"sourcesContent":["/*!\n * get-css-data\n * v2.1.0\n * https://github.com/jhildenbiddle/get-css-data\n * (c) 2018-2022 John Hildenbiddle <http://hildenbiddle.com>\n * MIT license\n */\nfunction getUrls(urls) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var settings = {\n mimeType: options.mimeType || null,\n onBeforeSend: options.onBeforeSend || Function.prototype,\n onSuccess: options.onSuccess || Function.prototype,\n onError: options.onError || Function.prototype,\n onComplete: options.onComplete || Function.prototype\n };\n var urlArray = Array.isArray(urls) ? urls : [ urls ];\n var urlQueue = Array.apply(null, Array(urlArray.length)).map((function(x) {\n return null;\n }));\n function isValidCss(text) {\n var isString = typeof text === \"string\";\n var isHTML = isString && text.trim().charAt(0) === \"<\";\n return isString && !isHTML;\n }\n function onError(xhr, urlIndex) {\n settings.onError(xhr, urlArray[urlIndex], urlIndex);\n }\n function onSuccess(responseText, urlIndex) {\n var returnVal = settings.onSuccess(responseText, urlArray[urlIndex], urlIndex);\n responseText = returnVal === false ? \"\" : returnVal || responseText;\n urlQueue[urlIndex] = responseText;\n if (urlQueue.indexOf(null) === -1) {\n settings.onComplete(urlQueue);\n }\n }\n var parser = document.createElement(\"a\");\n urlArray.forEach((function(url, i) {\n parser.setAttribute(\"href\", url);\n parser.href = String(parser.href);\n var isIElte9 = Boolean(document.all && !window.atob);\n var isIElte9CORS = isIElte9 && parser.host.split(\":\")[0] !== location.host.split(\":\")[0];\n if (isIElte9CORS) {\n var isSameProtocol = parser.protocol === location.protocol;\n if (isSameProtocol) {\n var xdr = new XDomainRequest;\n xdr.open(\"GET\", url);\n xdr.timeout = 0;\n xdr.onprogress = Function.prototype;\n xdr.ontimeout = Function.prototype;\n xdr.onload = function() {\n var text = xdr.responseText;\n if (isValidCss(text)) {\n onSuccess(text, i);\n } else {\n onError(xdr, i);\n }\n };\n xdr.onerror = function(err) {\n onError(xdr, i);\n };\n setTimeout((function() {\n xdr.send();\n }), 0);\n } else {\n console.warn(\"Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (\".concat(url, \")\"));\n onError(null, i);\n }\n } else {\n var xhr = new XMLHttpRequest;\n xhr.open(\"GET\", url);\n if (settings.mimeType && xhr.overrideMimeType) {\n xhr.overrideMimeType(settings.mimeType);\n }\n settings.onBeforeSend(xhr, url, i);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4) {\n var text = xhr.responseText;\n if (xhr.status < 400 && isValidCss(text)) {\n onSuccess(text, i);\n } else if (xhr.status === 0 && isValidCss(text)) {\n onSuccess(text, i);\n } else {\n onError(xhr, i);\n }\n }\n };\n xhr.send();\n }\n }));\n}\n\n/**\n * Gets CSS data from <style> and <link> nodes (including @imports), t
|