@chakra-ui/styled-system
Advanced tools
Comparing version 0.0.0-dev-20230423230056 to 0.0.0-dev-20230424190033
@@ -42,3 +42,2 @@ "use strict"; | ||
filter: () => filter, | ||
flatten: () => flatten, | ||
flattenTokens: () => flattenTokens, | ||
@@ -1336,9 +1335,11 @@ flexbox: () => flexbox, | ||
var _a, _b; | ||
const maybeReference = lookupToken(conditionValue.toString()); | ||
if (!conditionValue) | ||
return acc; | ||
const tokenReference = lookupToken(`${conditionValue}`); | ||
if (conditionAlias === "default") { | ||
acc[variable] = maybeReference; | ||
acc[variable] = tokenReference; | ||
return acc; | ||
} | ||
const conditionSelector = (_b = (_a = pseudoSelectors) == null ? void 0 : _a[conditionAlias]) != null ? _b : conditionAlias; | ||
acc[conditionSelector] = { [variable]: maybeReference }; | ||
acc[conditionSelector] = { [variable]: tokenReference }; | ||
return acc; | ||
@@ -1422,13 +1423,9 @@ }, | ||
const tokenEntries = Object.entries((_a = flatten(tokens2)) != null ? _a : {}).map( | ||
([token, value]) => { | ||
const enhancedToken = { isSemantic: false, value }; | ||
return [token, enhancedToken]; | ||
} | ||
([token, value]) => [token, { isSemantic: false, value }] | ||
); | ||
const semanticTokenEntries = Object.entries( | ||
(_b = flatten(semanticTokens, 1)) != null ? _b : {} | ||
).map(([token, value]) => { | ||
const enhancedToken = { isSemantic: true, value }; | ||
return [token, enhancedToken]; | ||
}); | ||
(_b = flattenSemanticTokens(semanticTokens)) != null ? _b : {} | ||
).map( | ||
([token, value]) => [token, { isSemantic: true, value }] | ||
); | ||
return Object.fromEntries([ | ||
@@ -1439,9 +1436,24 @@ ...tokenEntries, | ||
} | ||
function flatten(target, maxDepth = Infinity) { | ||
if (!(0, import_shared_utils5.isObject)(target) && !Array.isArray(target) || !maxDepth) { | ||
return target; | ||
function flatten(obj) { | ||
if (!(0, import_shared_utils5.isObject)(obj) && !Array.isArray(obj)) { | ||
return obj; | ||
} | ||
return Object.entries(target).reduce((result, [key, value]) => { | ||
return Object.entries(obj).reduce((result, [key, value]) => { | ||
if ((0, import_shared_utils5.isObject)(value) || Array.isArray(value)) { | ||
Object.entries(flatten(value, maxDepth - 1)).forEach( | ||
Object.entries(flatten(value)).forEach(([childKey, childValue]) => { | ||
result[`${key}.${childKey}`] = childValue; | ||
}); | ||
} else { | ||
result[key] = value; | ||
} | ||
return result; | ||
}, {}); | ||
} | ||
function flattenSemanticTokens(obj) { | ||
if (!(0, import_shared_utils5.isObject)(obj) && !Array.isArray(obj)) { | ||
return obj; | ||
} | ||
return Object.entries(obj).reduce((result, [key, value]) => { | ||
if ((0, import_shared_utils5.isObject)(value) && !("default" in value) || Array.isArray(value)) { | ||
Object.entries(flattenSemanticTokens(value)).forEach( | ||
([childKey, childValue]) => { | ||
@@ -1789,3 +1801,2 @@ result[`${key}.${childKey}`] = childValue; | ||
filter, | ||
flatten, | ||
flattenTokens, | ||
@@ -1792,0 +1803,0 @@ flexbox, |
@@ -204,9 +204,16 @@ // regenerate by running | ||
| "telegram.900" | ||
| "chakra-body-text" | ||
| "chakra-body-bg" | ||
| "chakra-border-color" | ||
| "chakra-inverse-text" | ||
| "chakra-subtle-bg" | ||
| "chakra-subtle-text" | ||
| "chakra-placeholder-color" | ||
| "chakra-body-text._light" | ||
| "chakra-body-text._dark" | ||
| "chakra-body-bg._light" | ||
| "chakra-body-bg._dark" | ||
| "chakra-border-color._light" | ||
| "chakra-border-color._dark" | ||
| "chakra-inverse-text._light" | ||
| "chakra-inverse-text._dark" | ||
| "chakra-subtle-bg._light" | ||
| "chakra-subtle-bg._dark" | ||
| "chakra-subtle-text._light" | ||
| "chakra-subtle-text._dark" | ||
| "chakra-placeholder-color._light" | ||
| "chakra-placeholder-color._dark" | ||
| (string & {}) | ||
@@ -213,0 +220,0 @@ colorSchemes: |
{ | ||
"name": "@chakra-ui/styled-system", | ||
"version": "0.0.0-dev-20230423230056", | ||
"version": "0.0.0-dev-20230424190033", | ||
"description": "Style function for css-in-js building component libraries", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
210686
6368