Socket
Socket
Sign inDemoInstall

@chakra-ui/styled-system

Package Overview
Dependencies
3
Maintainers
3
Versions
474
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-dev-20230424194913 to 0.0.0-dev-20230424201223

118

dist/index.js

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

// ../../utilities/object-utils/src/index.ts
// ../../utilities/object-utils/src/omit.ts
function omit(object, keysToOmit = []) {

@@ -1371,2 +1371,4 @@ const clone = Object.assign({}, object);

}
// ../../utilities/object-utils/src/pick.ts
function pick(object, keysToPick) {

@@ -1382,2 +1384,27 @@ const result = {};

// ../../utilities/object-utils/src/walk-object.ts
function isObject5(value) {
return typeof value === "object" && value != null && !Array.isArray(value);
}
function walkObject(target, predicate, options = {}) {
const { stop, getKey } = options;
function inner(value, path = []) {
var _a;
if (isObject5(value) || Array.isArray(value)) {
const result = {};
for (const [prop, child] of Object.entries(value)) {
const key = (_a = getKey == null ? void 0 : getKey(prop)) != null ? _a : prop;
const childPath = [...path, key];
if (stop == null ? void 0 : stop(value, childPath)) {
return predicate(value, path);
}
result[key] = inner(child, childPath);
}
return result;
}
return predicate(value, path);
}
return inner(target);
}
// src/create-theme-vars/theme-tokens.ts

@@ -1417,3 +1444,3 @@ var tokens = [

// src/create-theme-vars/flatten-tokens.ts
var import_shared_utils5 = require("@chakra-ui/shared-utils");
var isSemanticCondition = (key) => pseudoPropNames.includes(key) || "default" === key;
function flattenTokens({

@@ -1423,48 +1450,17 @@ tokens: tokens2,

}) {
var _a, _b;
const tokenEntries = Object.entries((_a = flatten(tokens2)) != null ? _a : {}).map(
([token, value]) => [token, { isSemantic: false, value }]
const result = {};
walkObject(tokens2, (value, path) => {
result[path.join(".")] = { isSemantic: false, value };
});
walkObject(
semanticTokens,
(value, path) => {
result[path.join(".")] = { isSemantic: true, value };
},
{
stop: (value) => Object.keys(value).every(isSemanticCondition)
}
);
const semanticTokenEntries = Object.entries(
(_b = flattenSemanticTokens(semanticTokens)) != null ? _b : {}
).map(
([token, value]) => [token, { isSemantic: true, value }]
);
return Object.fromEntries([
...tokenEntries,
...semanticTokenEntries
]);
return result;
}
function flatten(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) || Array.isArray(value)) {
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]) => {
result[`${key}.${childKey}`] = childValue;
}
);
} else {
result[key] = value;
}
return result;
}, {});
}

@@ -1502,3 +1498,3 @@ // src/create-theme-vars/to-css-var.ts

// src/css.ts
var import_shared_utils7 = require("@chakra-ui/shared-utils");
var import_shared_utils6 = require("@chakra-ui/shared-utils");
var import_lodash3 = __toESM(require("lodash.mergewith"));

@@ -1539,3 +1535,3 @@

// src/utils/expand-responsive.ts
var import_shared_utils6 = require("@chakra-ui/shared-utils");
var import_shared_utils5 = require("@chakra-ui/shared-utils");
var expandResponsive = (styles) => (theme) => {

@@ -1547,6 +1543,6 @@ if (!theme.__breakpoints)

for (const key in styles) {
let value = (0, import_shared_utils6.runIfFn)(styles[key], theme);
let value = (0, import_shared_utils5.runIfFn)(styles[key], theme);
if (value == null)
continue;
value = (0, import_shared_utils6.isObject)(value) && isResponsive(value) ? toArrayValue(value) : value;
value = (0, import_shared_utils5.isObject)(value) && isResponsive(value) ? toArrayValue(value) : value;
if (!Array.isArray(value)) {

@@ -1625,3 +1621,3 @@ computedStyles[key] = value;

var _a, _b, _c;
const _styles = (0, import_shared_utils7.runIfFn)(stylesOrFn, theme);
const _styles = (0, import_shared_utils6.runIfFn)(stylesOrFn, theme);
const styles = expandResponsive(_styles)(theme);

@@ -1631,3 +1627,3 @@ let computedStyles = {};

const valueOrFn = styles[key];
let value = (0, import_shared_utils7.runIfFn)(valueOrFn, theme);
let value = (0, import_shared_utils6.runIfFn)(valueOrFn, theme);
if (key in pseudos) {

@@ -1643,3 +1639,3 @@ key = pseudos[key];

}
if ((0, import_shared_utils7.isObject)(value)) {
if ((0, import_shared_utils6.isObject)(value)) {
computedStyles[key] = (_a = computedStyles[key]) != null ? _a : {};

@@ -1655,5 +1651,5 @@ computedStyles[key] = (0, import_lodash3.default)(

rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
const configProperty = (0, import_shared_utils7.runIfFn)(config == null ? void 0 : config.property, theme);
const configProperty = (0, import_shared_utils6.runIfFn)(config == null ? void 0 : config.property, theme);
if (!nested && (config == null ? void 0 : config.static)) {
const staticStyles = (0, import_shared_utils7.runIfFn)(config.static, theme);
const staticStyles = (0, import_shared_utils6.runIfFn)(config.static, theme);
computedStyles = (0, import_lodash3.default)({}, computedStyles, staticStyles);

@@ -1668,3 +1664,3 @@ }

if (configProperty) {
if (configProperty === "&" && (0, import_shared_utils7.isObject)(rawValue)) {
if (configProperty === "&" && (0, import_shared_utils6.isObject)(rawValue)) {
computedStyles = (0, import_lodash3.default)({}, computedStyles, rawValue);

@@ -1676,3 +1672,3 @@ } else {

}
if ((0, import_shared_utils7.isObject)(rawValue)) {
if ((0, import_shared_utils6.isObject)(rawValue)) {
computedStyles = (0, import_lodash3.default)({}, computedStyles, rawValue);

@@ -1715,3 +1711,3 @@ continue;

// src/style-config.ts
var import_shared_utils8 = require("@chakra-ui/shared-utils");
var import_shared_utils7 = require("@chakra-ui/shared-utils");
var import_lodash4 = __toESM(require("lodash.mergewith"));

@@ -1721,3 +1717,3 @@ function normalize2(value, toArray) {

return value;
if ((0, import_shared_utils8.isObject)(value))
if ((0, import_shared_utils7.isObject)(value))
return toArray(value);

@@ -1751,3 +1747,3 @@ if (value != null)

const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
const styles = (0, import_shared_utils8.runIfFn)((_a = config[prop]) == null ? void 0 : _a[normalized[i]], props);
const styles = (0, import_shared_utils7.runIfFn)((_a = config[prop]) == null ? void 0 : _a[normalized[i]], props);
if (!styles)

@@ -1782,3 +1778,3 @@ continue;

{},
(0, import_shared_utils8.runIfFn)((_a = config.baseStyle) != null ? _a : {}, props),
(0, import_shared_utils7.runIfFn)((_a = config.baseStyle) != null ? _a : {}, props),
recipe(config, "sizes", size, props),

@@ -1785,0 +1781,0 @@ recipe(config, "variants", variant, props)

{
"name": "@chakra-ui/styled-system",
"version": "0.0.0-dev-20230424194913",
"version": "0.0.0-dev-20230424201223",
"description": "Style function for css-in-js building component libraries",

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

"@chakra-ui/merge-utils": "2.0.7",
"@chakra-ui/object-utils": "2.0.8"
"@chakra-ui/object-utils": "0.0.0-dev-20230424201223"
},

@@ -50,0 +50,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc