@ant-design/cssinjs-utils
Advanced tools
@@ -89,3 +89,2 @@ import React from 'react'; | ||
| * Extra prefixCls to inject CSS variables. | ||
| * 为额外的 prefixCls 注入 CSS 变量(不注入样式)。 | ||
| * | ||
@@ -97,5 +96,12 @@ * @example | ||
| * } | ||
| * // or | ||
| * { | ||
| * extraCssVarPrefixCls: ({ prefixCls, rootCls }) => [`${prefixCls}-container`] | ||
| * } | ||
| * ``` | ||
| */ | ||
| extraCssVarPrefixCls?: string[]; | ||
| extraCssVarPrefixCls?: string[] | ((info: { | ||
| prefixCls: string; | ||
| rootCls: string; | ||
| }) => string[]); | ||
| }) => (prefixCls: string, rootCls?: string) => readonly [string, string]; | ||
@@ -102,0 +108,0 @@ genSubStyleComponent: <C extends TokenMapKey<CompTokenMap>>(componentName: C | [C, string], styleFn: GenStyleFn<CompTokenMap, AliasToken, C>, getDefaultToken?: GetDefaultToken<CompTokenMap, AliasToken, C>, options?: { |
@@ -49,6 +49,12 @@ import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
| return function (prefixCls) { | ||
| var _options$extraCssVarP; | ||
| var rootCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : prefixCls; | ||
| var hashId = useStyle(prefixCls, rootCls); | ||
| var cssVarCls = useCSSVar(options !== null && options !== void 0 && (_options$extraCssVarP = options.extraCssVarPrefixCls) !== null && _options$extraCssVarP !== void 0 && _options$extraCssVarP.length ? [rootCls].concat(_toConsumableArray(options.extraCssVarPrefixCls)) : rootCls); | ||
| // Resolve function type to get dynamic extra prefix | ||
| var extraPrefixCls = options === null || options === void 0 ? void 0 : options.extraCssVarPrefixCls; | ||
| var resolvedExtraPrefixCls = typeof extraPrefixCls === 'function' ? extraPrefixCls({ | ||
| prefixCls: prefixCls, | ||
| rootCls: rootCls | ||
| }) : extraPrefixCls; | ||
| var cssVarCls = useCSSVar(resolvedExtraPrefixCls !== null && resolvedExtraPrefixCls !== void 0 && resolvedExtraPrefixCls.length ? [rootCls].concat(_toConsumableArray(resolvedExtraPrefixCls)) : rootCls); | ||
| return [hashId, cssVarCls]; | ||
@@ -55,0 +61,0 @@ }; |
@@ -89,3 +89,2 @@ import React from 'react'; | ||
| * Extra prefixCls to inject CSS variables. | ||
| * 为额外的 prefixCls 注入 CSS 变量(不注入样式)。 | ||
| * | ||
@@ -97,5 +96,12 @@ * @example | ||
| * } | ||
| * // or | ||
| * { | ||
| * extraCssVarPrefixCls: ({ prefixCls, rootCls }) => [`${prefixCls}-container`] | ||
| * } | ||
| * ``` | ||
| */ | ||
| extraCssVarPrefixCls?: string[]; | ||
| extraCssVarPrefixCls?: string[] | ((info: { | ||
| prefixCls: string; | ||
| rootCls: string; | ||
| }) => string[]); | ||
| }) => (prefixCls: string, rootCls?: string) => readonly [string, string]; | ||
@@ -102,0 +108,0 @@ genSubStyleComponent: <C extends TokenMapKey<CompTokenMap>>(componentName: C | [C, string], styleFn: GenStyleFn<CompTokenMap, AliasToken, C>, getDefaultToken?: GetDefaultToken<CompTokenMap, AliasToken, C>, options?: { |
@@ -57,6 +57,12 @@ "use strict"; | ||
| return function (prefixCls) { | ||
| var _options$extraCssVarP; | ||
| var rootCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : prefixCls; | ||
| var hashId = useStyle(prefixCls, rootCls); | ||
| var cssVarCls = useCSSVar(options !== null && options !== void 0 && (_options$extraCssVarP = options.extraCssVarPrefixCls) !== null && _options$extraCssVarP !== void 0 && _options$extraCssVarP.length ? [rootCls].concat((0, _toConsumableArray2.default)(options.extraCssVarPrefixCls)) : rootCls); | ||
| // Resolve function type to get dynamic extra prefix | ||
| var extraPrefixCls = options === null || options === void 0 ? void 0 : options.extraCssVarPrefixCls; | ||
| var resolvedExtraPrefixCls = typeof extraPrefixCls === 'function' ? extraPrefixCls({ | ||
| prefixCls: prefixCls, | ||
| rootCls: rootCls | ||
| }) : extraPrefixCls; | ||
| var cssVarCls = useCSSVar(resolvedExtraPrefixCls !== null && resolvedExtraPrefixCls !== void 0 && resolvedExtraPrefixCls.length ? [rootCls].concat((0, _toConsumableArray2.default)(resolvedExtraPrefixCls)) : rootCls); | ||
| return [hashId, cssVarCls]; | ||
@@ -63,0 +69,0 @@ }; |
+1
-1
| { | ||
| "name": "@ant-design/cssinjs-utils", | ||
| "version": "2.1.0", | ||
| "version": "2.1.1", | ||
| "description": "A cssinjs util library to support Ant Design (antd) and its ecosystem libraries.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
91958
0.84%2076
1.02%