PromoCursed/node_modules/.cache/babel-loader/c361bc684ece7f57d16449eef4a9e6d4bf7d476c030df721ba90137a2aab3778.json

1 line
31 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport React from 'react';\nimport { token2CSSVar, useCSSVarRegister, useStyleRegister } from '@ant-design/cssinjs';\nimport genCalc from \"./calc\";\nimport getCompVarPrefix from \"./getCompVarPrefix\";\nimport getComponentToken from \"./getComponentToken\";\nimport getDefaultComponentToken from \"./getDefaultComponentToken\";\nimport genMaxMin from \"./maxmin\";\nimport statisticToken, { merge as mergeToken } from \"./statistic\";\nimport useUniqueMemo from \"../_util/hooks/useUniqueMemo\";\nimport useDefaultCSP from \"../hooks/useCSP\";\nexport default function genStyleUtils(config) {\n // Dependency inversion for preparing basic config.\n var _config$useCSP = config.useCSP,\n useCSP = _config$useCSP === void 0 ? useDefaultCSP : _config$useCSP,\n useToken = config.useToken,\n usePrefix = config.usePrefix,\n getResetStyles = config.getResetStyles,\n getCommonStyle = config.getCommonStyle,\n getCompUnitless = config.getCompUnitless;\n function genStyleHooks(component, styleFn, getDefaultToken, options) {\n var componentName = Array.isArray(component) ? component[0] : component;\n function prefixToken(key) {\n return \"\".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1));\n }\n\n // Fill unitless\n var originUnitless = (options === null || options === void 0 ? void 0 : options.unitless) || {};\n var originCompUnitless = typeof getCompUnitless === 'function' ? getCompUnitless(component) : {};\n var compUnitless = _objectSpread(_objectSpread({}, originCompUnitless), {}, _defineProperty({}, prefixToken('zIndexPopup'), true));\n Object.keys(originUnitless).forEach(function (key) {\n compUnitless[prefixToken(key)] = originUnitless[key];\n });\n\n // Options\n var mergedOptions = _objectSpread(_objectSpread({}, options), {}, {\n unitless: compUnitless,\n prefixToken: prefixToken\n });\n\n // Hooks\n var useStyle = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions);\n var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions);\n return function (prefixCls) {\n var rootCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : prefixCls;\n var _useStyle = useStyle(prefixCls, rootCls),\n _useStyle2 = _slicedToArray(_useStyle, 2),\n hashId = _useStyle2[1];\n var _useCSSVar = useCSSVar(rootCls),\n _useCSSVar2 = _slicedToArray(_useCSSVar, 2),\n wrapCSSVar = _useCSSVar2[0],\n cssVarCls = _useCSSVar2[1];\n return [wrapCSSVar, hashId, cssVarCls];\n };\n }\n function genCSSVarRegister(component, getDefaultToken, options) {\n var compUnitless = options.unitless,\n _options$injectStyle = options.injectStyle,\n injectStyle = _options$injectStyle === void 0 ? true : _options$injectStyle,\n prefixToken = options.prefixToken,\n ignore = options.ignore;\n var CSSVarRegister = function CSSVarRegister(_ref) {\n var rootCls = _ref.rootCls,\n _ref$cssVar = _ref.cssVar,\n cssVar = _ref$cssVar === void 0 ? {} : _ref$cssVar;\n var _useToken = useToken(),\n realToken = _useToken.realToken;\n useCSSVarRegister({\n path: [component],\n prefix: cssVar.prefix,\n key: cssVar.key,\n unitless: compUnitless,\n ignore: ignore,\n token: realToken,\n scope: rootCls\n }, function () {\n var defaultToken = getDefaultComponentToken(component, realToken, getDefaultToken);\n var componentToken = getComponentToken(component, realToken, defaultToken, {\n deprecatedTokens: options === null || options === void 0 ? void 0 : options.deprecatedTokens\n });\n Object.keys(defaultToken