1 line
8.7 KiB
JSON
1 line
8.7 KiB
JSON
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { ATTR_MARK } from \"../StyleContext\";\nexport var ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';\n\n/**\n * This marks style from the css file.\n * Which means not exist in `<style />` tag.\n */\nexport var CSS_FILE_STYLE = '_FILE_STYLE__';\nexport function serialize(cachePathMap) {\n return Object.keys(cachePathMap).map(function (path) {\n var hash = cachePathMap[path];\n return \"\".concat(path, \":\").concat(hash);\n }).join(';');\n}\nvar cachePathMap;\nvar fromCSSFile = true;\n\n/**\n * @private Test usage only. Can save remove if no need.\n */\nexport function reset(mockCache) {\n var fromFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n cachePathMap = mockCache;\n fromCSSFile = fromFile;\n}\nexport function prepare() {\n if (!cachePathMap) {\n cachePathMap = {};\n if (canUseDom()) {\n var div = document.createElement('div');\n div.className = ATTR_CACHE_MAP;\n div.style.position = 'fixed';\n div.style.visibility = 'hidden';\n div.style.top = '-9999px';\n document.body.appendChild(div);\n var content = getComputedStyle(div).content || '';\n content = content.replace(/^\"/, '').replace(/\"$/, '');\n\n // Fill data\n content.split(';').forEach(function (item) {\n var _item$split = item.split(':'),\n _item$split2 = _slicedToArray(_item$split, 2),\n path = _item$split2[0],\n hash = _item$split2[1];\n cachePathMap[path] = hash;\n });\n\n // Remove inline record style\n var inlineMapStyle = document.querySelector(\"style[\".concat(ATTR_CACHE_MAP, \"]\"));\n if (inlineMapStyle) {\n var _inlineMapStyle$paren;\n fromCSSFile = false;\n (_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);\n }\n document.body.removeChild(div);\n }\n }\n}\nexport function existPath(path) {\n prepare();\n return !!cachePathMap[path];\n}\nexport function getStyleAndHash(path) {\n var hash = cachePathMap[path];\n var styleStr = null;\n if (hash && canUseDom()) {\n if (fromCSSFile) {\n styleStr = CSS_FILE_STYLE;\n } else {\n var _style = document.querySelector(\"style[\".concat(ATTR_MARK, \"=\\\"\").concat(cachePathMap[path], \"\\\"]\"));\n if (_style) {\n styleStr = _style.innerHTML;\n } else {\n // Clean up since not exist anymore\n delete cachePathMap[path];\n }\n }\n }\n return [styleStr, hash];\n}","map":{"version":3,"names":["_slicedToArray","canUseDom","ATTR_MARK","ATTR_CACHE_MAP","CSS_FILE_STYLE","serialize","cachePathMap","Object","keys","map","path","hash","concat","join","fromCSSFile","reset","mockCache","fromFile","arguments","length","undefined","prepare","div","document","createElement","className","style","position","visibility","top","body","appendChild","content","getComputedStyle","replace","split","forEach","item","_item$split","_item$split2","inlineMapStyle","querySelector","_inlineMapStyle$paren","parentNode","removeChild","existPath","getStyleAndHash","styleStr","_style","innerHTML"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@ant-design/cssinjs/es/util/cacheMapUtil.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { ATTR_MARK } from \"../StyleContext\";\nexport var ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';\n\n/**\n * This marks style from the css file.\n * Which means not exist in `<style />` tag.\n */\nexport var CSS_FILE_STYLE = '_FILE_STYLE__';\nexport function serialize(cachePathMap) {\n return Object.keys(cachePathMap).map(function (path) {\n var hash = cachePathMap[path];\n return \"\".concat(path, \":\").concat(hash);\n }).join(';');\n}\nvar cachePathMap;\nvar fromCSSFile = true;\n\n/**\n * @private Test usage only. Can save remove if no need.\n */\nexport function reset(mockCache) {\n var fromFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n cachePathMap = mockCache;\n fromCSSFile = fromFile;\n}\nexport function prepare() {\n if (!cachePathMap) {\n cachePathMap = {};\n if (canUseDom()) {\n var div = document.createElement('div');\n div.className = ATTR_CACHE_MAP;\n div.style.position = 'fixed';\n div.style.visibility = 'hidden';\n div.style.top = '-9999px';\n document.body.appendChild(div);\n var content = getComputedStyle(div).content || '';\n content = content.replace(/^\"/, '').replace(/\"$/, '');\n\n // Fill data\n content.split(';').forEach(function (item) {\n var _item$split = item.split(':'),\n _item$split2 = _slicedToArray(_item$split, 2),\n path = _item$split2[0],\n hash = _item$split2[1];\n cachePathMap[path] = hash;\n });\n\n // Remove inline record style\n var inlineMapStyle = document.querySelector(\"style[\".concat(ATTR_CACHE_MAP, \"]\"));\n if (inlineMapStyle) {\n var _inlineMapStyle$paren;\n fromCSSFile = false;\n (_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);\n }\n document.body.removeChild(div);\n }\n }\n}\nexport function existPath(path) {\n prepare();\n return !!cachePathMap[path];\n}\nexport function getStyleAndHash(path) {\n var hash = cachePathMap[path];\n var styleStr = null;\n if (hash && canUseDom()) {\n if (fromCSSFile) {\n styleStr = CSS_FILE_STYLE;\n } else {\n var _style = document.querySelector(\"style[\".concat(ATTR_MARK, \"=\\\"\").concat(cachePathMap[path], \"\\\"]\"));\n if (_style) {\n styleStr = _style.innerHTML;\n } else {\n // Clean up since not exist anymore\n delete cachePathMap[path];\n }\n }\n }\n return [styleStr, hash];\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,SAAS,MAAM,0BAA0B;AAChD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAO,IAAIC,cAAc,GAAG,6BAA6B;;AAEzD;AACA;AACA;AACA;AACA,OAAO,IAAIC,cAAc,GAAG,eAAe;AAC3C,OAAO,SAASC,SAASA,CAACC,YAAY,EAAE;EACtC,OAAOC,MAAM,CAACC,IAAI,CAACF,YAAY,CAAC,CAACG,GAAG,CAAC,UAAUC,IAAI,EAAE;IACnD,IAAIC,IAAI,GAAGL,YAAY,CAACI,IAAI,CAA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