@ant-design/cssinjs
Advanced tools
Comparing version 0.0.0-alpha.18 to 0.0.0-alpha.19
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import * as React from 'react'; | ||
import hash from '@emotion/hash'; | ||
@@ -7,2 +8,3 @@ import { ATTR_TOKEN } from './StyleContext'; | ||
import { flattenToken, token2key } from './util'; | ||
var EMPTY_OVERRIDE = {}; | ||
var tokenKeys = new Map(); | ||
@@ -55,7 +57,13 @@ | ||
_option$override = option.override, | ||
override = _option$override === void 0 ? {} : _option$override; // Basic | ||
override = _option$override === void 0 ? EMPTY_OVERRIDE : _option$override; // Basic - We do basic cache here | ||
var mergedToken = Object.assign.apply(Object, [{}].concat(_toConsumableArray(tokens))); | ||
var tokenStr = flattenToken(mergedToken); | ||
var overrideTokenStr = flattenToken(override); | ||
var mergedToken = React.useMemo(function () { | ||
return Object.assign.apply(Object, [{}].concat(_toConsumableArray(tokens))); | ||
}, [tokens]); | ||
var tokenStr = React.useMemo(function () { | ||
return flattenToken(mergedToken); | ||
}, [mergedToken]); | ||
var overrideTokenStr = React.useMemo(function () { | ||
return flattenToken(override); | ||
}, [override]); | ||
var cachedToken = useGlobalCache('token', [salt, tokenStr, overrideTokenStr], function () { | ||
@@ -62,0 +70,0 @@ var derivativeToken = theme.getDerivativeToken(mergedToken); // Merge with override |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
@@ -14,2 +16,4 @@ | ||
var React = _interopRequireWildcard(require("react")); | ||
var _hash = _interopRequireDefault(require("@emotion/hash")); | ||
@@ -23,2 +27,3 @@ | ||
var EMPTY_OVERRIDE = {}; | ||
var tokenKeys = new Map(); | ||
@@ -71,7 +76,13 @@ | ||
_option$override = option.override, | ||
override = _option$override === void 0 ? {} : _option$override; // Basic | ||
override = _option$override === void 0 ? EMPTY_OVERRIDE : _option$override; // Basic - We do basic cache here | ||
var mergedToken = Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2.default)(tokens))); | ||
var tokenStr = (0, _util.flattenToken)(mergedToken); | ||
var overrideTokenStr = (0, _util.flattenToken)(override); | ||
var mergedToken = React.useMemo(function () { | ||
return Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2.default)(tokens))); | ||
}, [tokens]); | ||
var tokenStr = React.useMemo(function () { | ||
return (0, _util.flattenToken)(mergedToken); | ||
}, [mergedToken]); | ||
var overrideTokenStr = React.useMemo(function () { | ||
return (0, _util.flattenToken)(override); | ||
}, [override]); | ||
var cachedToken = (0, _useGlobalCache.default)('token', [salt, tokenStr, overrideTokenStr], function () { | ||
@@ -78,0 +89,0 @@ var derivativeToken = theme.getDerivativeToken(mergedToken); // Merge with override |
{ | ||
"name": "@ant-design/cssinjs", | ||
"version": "0.0.0-alpha.18", | ||
"version": "0.0.0-alpha.19", | ||
"description": "Component level cssinjs resolution for antd", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62693
1324