1 line
9.7 KiB
JSON
1 line
9.7 KiB
JSON
|
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { extract as tokenExtractStyle, TOKEN_PREFIX } from \"./hooks/useCacheToken\";\nimport { CSS_VAR_PREFIX, extract as cssVarExtractStyle } from \"./hooks/useCSSVarRegister\";\nimport { extract as styleExtractStyle, STYLE_PREFIX } from \"./hooks/useStyleRegister\";\nimport { toStyleStr } from \"./util\";\nimport { ATTR_CACHE_MAP, serialize as serializeCacheMap } from \"./util/cacheMapUtil\";\nvar ExtractStyleFns = _defineProperty(_defineProperty(_defineProperty({}, STYLE_PREFIX, styleExtractStyle), TOKEN_PREFIX, tokenExtractStyle), CSS_VAR_PREFIX, cssVarExtractStyle);\nfunction isNotNull(value) {\n return value !== null;\n}\nexport default function extractStyle(cache, options) {\n var _ref = typeof options === 'boolean' ? {\n plain: options\n } : options || {},\n _ref$plain = _ref.plain,\n plain = _ref$plain === void 0 ? false : _ref$plain,\n _ref$types = _ref.types,\n types = _ref$types === void 0 ? ['style', 'token', 'cssVar'] : _ref$types;\n var matchPrefixRegexp = new RegExp(\"^(\".concat((typeof types === 'string' ? [types] : types).join('|'), \")%\"));\n\n // prefix with `style` is used for `useStyleRegister` to cache style context\n var styleKeys = Array.from(cache.cache.keys()).filter(function (key) {\n return matchPrefixRegexp.test(key);\n });\n\n // Common effect styles like animation\n var effectStyles = {};\n\n // Mapping of cachePath to style hash\n var cachePathMap = {};\n var styleText = '';\n styleKeys.map(function (key) {\n var cachePath = key.replace(matchPrefixRegexp, '').replace(/%/g, '|');\n var _key$split = key.split('%'),\n _key$split2 = _slicedToArray(_key$split, 1),\n prefix = _key$split2[0];\n var extractFn = ExtractStyleFns[prefix];\n var extractedStyle = extractFn(cache.cache.get(key)[1], effectStyles, {\n plain: plain\n });\n if (!extractedStyle) {\n return null;\n }\n var _extractedStyle = _slicedToArray(extractedStyle, 3),\n order = _extractedStyle[0],\n styleId = _extractedStyle[1],\n styleStr = _extractedStyle[2];\n if (key.startsWith('style')) {\n cachePathMap[cachePath] = styleId;\n }\n return [order, styleStr];\n }).filter(isNotNull).sort(function (_ref2, _ref3) {\n var _ref4 = _slicedToArray(_ref2, 1),\n o1 = _ref4[0];\n var _ref5 = _slicedToArray(_ref3, 1),\n o2 = _ref5[0];\n return o1 - o2;\n }).forEach(function (_ref6) {\n var _ref7 = _slicedToArray(_ref6, 2),\n style = _ref7[1];\n styleText += style;\n });\n\n // ==================== Fill Cache Path ====================\n styleText += toStyleStr(\".\".concat(ATTR_CACHE_MAP, \"{content:\\\"\").concat(serializeCacheMap(cachePathMap), \"\\\";}\"), undefined, undefined, _defineProperty({}, ATTR_CACHE_MAP, ATTR_CACHE_MAP), plain);\n return styleText;\n}","map":{"version":3,"names":["_slicedToArray","_defineProperty","extract","tokenExtractStyle","TOKEN_PREFIX","CSS_VAR_PREFIX","cssVarExtractStyle","styleExtractStyle","STYLE_PREFIX","toStyleStr","ATTR_CACHE_MAP","serialize","serializeCacheMap","ExtractStyleFns","isNotNull","value","extractStyle","cache","options","_ref","plain","_ref$plain","_ref$types","types","matchPrefixRegexp","RegExp","concat","join","styleKeys","Array","from","keys","filter","key","test","effectStyles","cachePathMap","styleText","map","cachePath","replace","_key$split","split","_key$split2","prefix","extractFn","extractedStyle","get","_extractedStyle","order","styleId","styleStr","startsWith","sort","_ref2","_ref3","_ref4","o1","_ref5","o2","forEach","_ref6","_ref7","style","undefined"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@ant-design/cssinjs/es/extractStyle.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { extract as tokenExtractStyle, TOKEN_P
|