Socket
Socket
Sign inDemoInstall

@ant-design/cssinjs

Package Overview
Dependencies
Maintainers
10
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ant-design/cssinjs - npm Package Compare versions

Comparing version 1.18.0-alpha.1 to 1.18.0-alpha.2

2

es/hooks/useCacheToken.d.ts

@@ -39,2 +39,4 @@ import type Theme from '../theme/Theme';

ignore?: Record<string, boolean>;
/** Tokens that preserves origin value */
preserve?: Record<string, boolean>;
/** Key for current theme. Useful for customizing and should be unique */

@@ -41,0 +43,0 @@ key?: string;

7

es/hooks/useCacheToken.js

@@ -91,3 +91,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

var cachedToken = useGlobalCache(TOKEN_PREFIX, [salt, theme.id, tokenStr, overrideTokenStr, cssVarStr], function () {
var _cssVar$key, _cssVar$prefix;
var _cssVar$key;
var mergedDerivativeToken = compute ? compute(mergedToken, override, theme) : getComputedToken(mergedToken, override, theme, formatToken);

@@ -102,3 +102,4 @@

ignore: cssVar.ignore,
unitless: cssVar.unitless
unitless: cssVar.unitless,
preserve: cssVar.preserve
});

@@ -117,3 +118,3 @@ var _transformToken2 = _slicedToArray(_transformToken, 2);

recordCleanToken(themeKey);
var hashId = cssVar ? "".concat(hashPrefix, "-").concat(hash("".concat(salt).concat((_cssVar$prefix = cssVar.prefix) !== null && _cssVar$prefix !== void 0 ? _cssVar$prefix : ''))) : "".concat(hashPrefix, "-").concat(hash(tokenKey));
var hashId = "".concat(hashPrefix, "-").concat(hash(tokenKey));
mergedDerivativeToken._hashId = hashId; // Not used

@@ -120,0 +121,0 @@

import type { TokenWithCSSVar } from '../util/css-variables';
import type { ExtractStyle } from './useGlobalCache';
export declare const CSS_VAR_PREFIX = "cssVar";
type CSSVarCacheValue<T> = [
cssVarToken: TokenWithCSSVar<T>,
type CSSVarCacheValue<V, T extends Record<string, V> = Record<string, V>> = [
cssVarToken: TokenWithCSSVar<V, T>,
cssVarStr: string,

@@ -18,4 +18,4 @@ styleId: string,

token: any;
}, fn: () => T) => CSSVarCacheValue<T>;
}, fn: () => T) => CSSVarCacheValue<V, T>;
export declare const extract: ExtractStyle<CSSVarCacheValue<any>>;
export default useCSSVarRegister;

@@ -5,4 +5,4 @@ export declare const token2CSSVar: (token: string, prefix?: string) => string;

}) => string;
export type TokenWithCSSVar<T> = {
[key in keyof T]?: string;
export type TokenWithCSSVar<V, T extends Record<string, V> = Record<string, V>> = {
[key in keyof T]?: string | V;
};

@@ -13,3 +13,4 @@ export declare const transformToken: <V, T extends Record<string, V> = Record<string, V>>(token: T, themeKey: string, config?: {

unitless?: { [key_1 in keyof T]?: boolean | undefined; } | undefined;
preserve?: { [key_2 in keyof T]?: boolean | undefined; } | undefined;
scope?: string | undefined;
} | undefined) => [TokenWithCSSVar<T>, string];
} | undefined) => [TokenWithCSSVar<V, T>, string];

@@ -21,7 +21,9 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

Object.entries(token).forEach(function (_ref3) {
var _config$ignore;
var _config$preserve, _config$ignore;
var _ref4 = _slicedToArray(_ref3, 2),
key = _ref4[0],
value = _ref4[1];
if ((typeof value === 'string' || typeof value === 'number') && !(config !== null && config !== void 0 && (_config$ignore = config.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
if (config !== null && config !== void 0 && (_config$preserve = config.preserve) !== null && _config$preserve !== void 0 && _config$preserve[key]) {
result[key] = value;
} else if ((typeof value === 'string' || typeof value === 'number') && !(config !== null && config !== void 0 && (_config$ignore = config.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
var _config$unitless;

@@ -28,0 +30,0 @@ var cssVar = token2CSSVar(key, config === null || config === void 0 ? void 0 : config.prefix);

@@ -39,2 +39,4 @@ import type Theme from '../theme/Theme';

ignore?: Record<string, boolean>;
/** Tokens that preserves origin value */
preserve?: Record<string, boolean>;
/** Key for current theme. Useful for customizing and should be unique */

@@ -41,0 +43,0 @@ key?: string;

@@ -103,3 +103,3 @@ "use strict";

var cachedToken = (0, _useGlobalCache.default)(TOKEN_PREFIX, [salt, theme.id, tokenStr, overrideTokenStr, cssVarStr], function () {
var _cssVar$key, _cssVar$prefix;
var _cssVar$key;
var mergedDerivativeToken = compute ? compute(mergedToken, override, theme) : getComputedToken(mergedToken, override, theme, formatToken);

@@ -114,3 +114,4 @@

ignore: cssVar.ignore,
unitless: cssVar.unitless
unitless: cssVar.unitless,
preserve: cssVar.preserve
});

@@ -129,3 +130,3 @@ var _transformToken2 = (0, _slicedToArray2.default)(_transformToken, 2);

recordCleanToken(themeKey);
var hashId = cssVar ? "".concat(hashPrefix, "-").concat((0, _hash.default)("".concat(salt).concat((_cssVar$prefix = cssVar.prefix) !== null && _cssVar$prefix !== void 0 ? _cssVar$prefix : ''))) : "".concat(hashPrefix, "-").concat((0, _hash.default)(tokenKey));
var hashId = "".concat(hashPrefix, "-").concat((0, _hash.default)(tokenKey));
mergedDerivativeToken._hashId = hashId; // Not used

@@ -132,0 +133,0 @@

import type { TokenWithCSSVar } from '../util/css-variables';
import type { ExtractStyle } from './useGlobalCache';
export declare const CSS_VAR_PREFIX = "cssVar";
type CSSVarCacheValue<T> = [
cssVarToken: TokenWithCSSVar<T>,
type CSSVarCacheValue<V, T extends Record<string, V> = Record<string, V>> = [
cssVarToken: TokenWithCSSVar<V, T>,
cssVarStr: string,

@@ -18,4 +18,4 @@ styleId: string,

token: any;
}, fn: () => T) => CSSVarCacheValue<T>;
}, fn: () => T) => CSSVarCacheValue<V, T>;
export declare const extract: ExtractStyle<CSSVarCacheValue<any>>;
export default useCSSVarRegister;

@@ -5,4 +5,4 @@ export declare const token2CSSVar: (token: string, prefix?: string) => string;

}) => string;
export type TokenWithCSSVar<T> = {
[key in keyof T]?: string;
export type TokenWithCSSVar<V, T extends Record<string, V> = Record<string, V>> = {
[key in keyof T]?: string | V;
};

@@ -13,3 +13,4 @@ export declare const transformToken: <V, T extends Record<string, V> = Record<string, V>>(token: T, themeKey: string, config?: {

unitless?: { [key_1 in keyof T]?: boolean | undefined; } | undefined;
preserve?: { [key_2 in keyof T]?: boolean | undefined; } | undefined;
scope?: string | undefined;
} | undefined) => [TokenWithCSSVar<T>, string];
} | undefined) => [TokenWithCSSVar<V, T>, string];

@@ -28,7 +28,9 @@ "use strict";

Object.entries(token).forEach(function (_ref3) {
var _config$ignore;
var _config$preserve, _config$ignore;
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
key = _ref4[0],
value = _ref4[1];
if ((typeof value === 'string' || typeof value === 'number') && !(config !== null && config !== void 0 && (_config$ignore = config.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
if (config !== null && config !== void 0 && (_config$preserve = config.preserve) !== null && _config$preserve !== void 0 && _config$preserve[key]) {
result[key] = value;
} else if ((typeof value === 'string' || typeof value === 'number') && !(config !== null && config !== void 0 && (_config$ignore = config.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
var _config$unitless;

@@ -35,0 +37,0 @@ var cssVar = token2CSSVar(key, config === null || config === void 0 ? void 0 : config.prefix);

{
"name": "@ant-design/cssinjs",
"version": "1.18.0-alpha.1",
"version": "1.18.0-alpha.2",
"description": "Component level cssinjs resolution for antd",

@@ -33,3 +33,3 @@ "keywords": [

"gh-pages": "npm run docs:build && npm run docs:deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish --branch=next --tag=next",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "npm run gh-pages",

@@ -36,0 +36,0 @@ "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc