@pandacss/shared 0.45.2 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/astish.js CHANGED
@@ -36,6 +36,8 @@ var astish = (val, tree = [{}]) => {
36
36
  tree.shift();
37
37
  else if (block[3]) {
38
38
  left = block[3].replace(ruleNewline, empty).trim();
39
+ if (!left.includes("&") && !left.startsWith("@"))
40
+ left = "& " + left;
39
41
  tree.unshift(tree[0][left] = tree[0][left] || {});
40
42
  } else
41
43
  tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
package/dist/astish.mjs CHANGED
@@ -12,6 +12,8 @@ var astish = (val, tree = [{}]) => {
12
12
  tree.shift();
13
13
  else if (block[3]) {
14
14
  left = block[3].replace(ruleNewline, empty).trim();
15
+ if (!left.includes("&") && !left.startsWith("@"))
16
+ left = "& " + left;
15
17
  tree.unshift(tree[0][left] = tree[0][left] || {});
16
18
  } else
17
19
  tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-eaCmCttJ.mjs';
2
- export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, l as withoutSpace } from './shared-eaCmCttJ.mjs';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-BKiOijOQ.mjs';
2
+ export { y as WalkObjectOptions, g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, a as isBoolean, b as isFunction, l as isImportant, c as isObject, d as isObjectOrArray, i as isString, A as mapObject, n as markImportant, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, w as withoutImportant, m as withoutSpace } from './shared-BKiOijOQ.mjs';
3
3
  export { astish } from './astish.mjs';
4
4
 
5
5
  declare const getArbitraryValue: (_value: string) => string;
@@ -143,7 +143,6 @@ interface CallbackItem {
143
143
  parent: any[] | Record<string, unknown>;
144
144
  key: string;
145
145
  }
146
- declare const isObjectOrArray: (obj: unknown) => boolean;
147
146
  interface TraverseOptions {
148
147
  separator?: string;
149
148
  maxDepth?: number;
@@ -158,4 +157,4 @@ declare function toPx(value?: string | number): string | undefined;
158
157
  declare function toEm(value?: string, fontSize?: number): string | undefined;
159
158
  declare function toRem(value?: string): string | undefined;
160
159
 
161
- export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PANDA_CONFIG_NAME, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
160
+ export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PANDA_CONFIG_NAME, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-eaCmCttJ.js';
2
- export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, l as withoutSpace } from './shared-eaCmCttJ.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-BKiOijOQ.js';
2
+ export { y as WalkObjectOptions, g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, a as isBoolean, b as isFunction, l as isImportant, c as isObject, d as isObjectOrArray, i as isString, A as mapObject, n as markImportant, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, w as withoutImportant, m as withoutSpace } from './shared-BKiOijOQ.js';
3
3
  export { astish } from './astish.js';
4
4
 
5
5
  declare const getArbitraryValue: (_value: string) => string;
@@ -143,7 +143,6 @@ interface CallbackItem {
143
143
  parent: any[] | Record<string, unknown>;
144
144
  key: string;
145
145
  }
146
- declare const isObjectOrArray: (obj: unknown) => boolean;
147
146
  interface TraverseOptions {
148
147
  separator?: string;
149
148
  maxDepth?: number;
@@ -158,4 +157,4 @@ declare function toPx(value?: string | number): string | undefined;
158
157
  declare function toEm(value?: string, fontSize?: number): string | undefined;
159
158
  declare function toRem(value?: string): string | undefined;
160
159
 
161
- export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PANDA_CONFIG_NAME, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
160
+ export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PANDA_CONFIG_NAME, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
package/dist/index.js CHANGED
@@ -122,6 +122,7 @@ var isFunction = (v) => typeof v === "function";
122
122
  function isObject(value) {
123
123
  return typeof value === "object" && value != null && !Array.isArray(value);
124
124
  }
125
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
125
126
 
126
127
  // src/assign.ts
127
128
  function assign(target, ...sources) {
@@ -149,6 +150,8 @@ var astish = (val, tree = [{}]) => {
149
150
  tree.shift();
150
151
  else if (block[3]) {
151
152
  left = block[3].replace(ruleNewline, empty).trim();
153
+ if (!left.includes("&") && !left.startsWith("@"))
154
+ left = "& " + left;
152
155
  tree.unshift(tree[0][left] = tree[0][left] || {});
153
156
  } else
154
157
  tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
@@ -355,8 +358,9 @@ function markImportant(obj) {
355
358
 
356
359
  // src/merge-props.ts
357
360
  function mergeProps(...sources) {
358
- const objects = sources.filter(Boolean);
359
- return objects.reduce((prev, obj) => {
361
+ return sources.reduce((prev, obj) => {
362
+ if (!obj)
363
+ return prev;
360
364
  Object.keys(obj).forEach((key) => {
361
365
  const prevValue = prev[key];
362
366
  const value = obj[key];
@@ -375,7 +379,7 @@ var isNotNullish = (element) => element != null;
375
379
  function walkObject(target, predicate, options = {}) {
376
380
  const { stop, getKey } = options;
377
381
  function inner(value, path = []) {
378
- if (isObject(value) || Array.isArray(value)) {
382
+ if (isObjectOrArray(value)) {
379
383
  const result = {};
380
384
  for (const [prop, child] of Object.entries(value)) {
381
385
  const key = getKey?.(prop, child) ?? prop;
@@ -456,9 +460,9 @@ function createCss(context) {
456
460
  const normalizedObject = normalizeStyleObject(styleObject, context);
457
461
  const classNames = /* @__PURE__ */ new Set();
458
462
  walkObject(normalizedObject, (value, paths) => {
459
- const important = isImportant(value);
460
463
  if (value == null)
461
464
  return;
465
+ const important = isImportant(value);
462
466
  const [prop, ...allConditions] = conds.shift(paths);
463
467
  const conditions = filterBaseConditions(allConditions);
464
468
  const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
@@ -660,7 +664,6 @@ function mergeWith(target, ...sources) {
660
664
  }
661
665
 
662
666
  // src/traverse.ts
663
- var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
664
667
  var defaultOptions = {
665
668
  separator: ".",
666
669
  maxDepth: Infinity
@@ -855,11 +858,14 @@ var shorthandProperties = {
855
858
  textEmphasis: ["textEmphasisStyle", "textEmphasisColor"],
856
859
  transition: ["transitionProperty", "transitionDuration", "transitionTimingFunction", "transitionDelay"]
857
860
  };
858
- var longhands = Object.values(shorthandProperties).reduce((a, b) => [...a, ...b], []);
861
+ var longhands = Object.values(shorthandProperties).reduce((a, b) => {
862
+ b.forEach((val) => a.add(val));
863
+ return a;
864
+ }, /* @__PURE__ */ new Set([]));
859
865
  function getPropertyPriority(property) {
860
866
  if (property === "all")
861
867
  return 0;
862
- return longhands.includes(property) ? 2 : 1;
868
+ return longhands.has(property) ? 2 : 1;
863
869
  }
864
870
 
865
871
  // src/slot.ts
@@ -974,17 +980,26 @@ function unionType(values) {
974
980
  }
975
981
 
976
982
  // src/uniq.ts
977
- var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
983
+ var uniq = (...items) => {
984
+ const set = items.reduce((acc, currItems) => {
985
+ if (currItems) {
986
+ currItems.forEach((item) => acc.add(item));
987
+ }
988
+ return acc;
989
+ }, /* @__PURE__ */ new Set([]));
990
+ return Array.from(set);
991
+ };
978
992
 
979
993
  // src/unit-conversion.ts
980
994
  var BASE_FONT_SIZE = 16;
981
995
  var UNIT_PX = "px";
982
996
  var UNIT_EM = "em";
983
997
  var UNIT_REM = "rem";
998
+ var DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
999
+ var UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
1000
+ var VALUE_REGEX = new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`);
984
1001
  function getUnit(value = "") {
985
- const DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
986
- const UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
987
- const unit = value.match(new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`));
1002
+ const unit = value.match(VALUE_REGEX);
988
1003
  return unit?.[1];
989
1004
  }
990
1005
  function toPx(value = "") {
package/dist/index.mjs CHANGED
@@ -30,6 +30,7 @@ var isFunction = (v) => typeof v === "function";
30
30
  function isObject(value) {
31
31
  return typeof value === "object" && value != null && !Array.isArray(value);
32
32
  }
33
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
33
34
 
34
35
  // src/assign.ts
35
36
  function assign(target, ...sources) {
@@ -57,6 +58,8 @@ var astish = (val, tree = [{}]) => {
57
58
  tree.shift();
58
59
  else if (block[3]) {
59
60
  left = block[3].replace(ruleNewline, empty).trim();
61
+ if (!left.includes("&") && !left.startsWith("@"))
62
+ left = "& " + left;
60
63
  tree.unshift(tree[0][left] = tree[0][left] || {});
61
64
  } else
62
65
  tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
@@ -263,8 +266,9 @@ function markImportant(obj) {
263
266
 
264
267
  // src/merge-props.ts
265
268
  function mergeProps(...sources) {
266
- const objects = sources.filter(Boolean);
267
- return objects.reduce((prev, obj) => {
269
+ return sources.reduce((prev, obj) => {
270
+ if (!obj)
271
+ return prev;
268
272
  Object.keys(obj).forEach((key) => {
269
273
  const prevValue = prev[key];
270
274
  const value = obj[key];
@@ -283,7 +287,7 @@ var isNotNullish = (element) => element != null;
283
287
  function walkObject(target, predicate, options = {}) {
284
288
  const { stop, getKey } = options;
285
289
  function inner(value, path = []) {
286
- if (isObject(value) || Array.isArray(value)) {
290
+ if (isObjectOrArray(value)) {
287
291
  const result = {};
288
292
  for (const [prop, child] of Object.entries(value)) {
289
293
  const key = getKey?.(prop, child) ?? prop;
@@ -364,9 +368,9 @@ function createCss(context) {
364
368
  const normalizedObject = normalizeStyleObject(styleObject, context);
365
369
  const classNames = /* @__PURE__ */ new Set();
366
370
  walkObject(normalizedObject, (value, paths) => {
367
- const important = isImportant(value);
368
371
  if (value == null)
369
372
  return;
373
+ const important = isImportant(value);
370
374
  const [prop, ...allConditions] = conds.shift(paths);
371
375
  const conditions = filterBaseConditions(allConditions);
372
376
  const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
@@ -568,7 +572,6 @@ function mergeWith(target, ...sources) {
568
572
  }
569
573
 
570
574
  // src/traverse.ts
571
- var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
572
575
  var defaultOptions = {
573
576
  separator: ".",
574
577
  maxDepth: Infinity
@@ -763,11 +766,14 @@ var shorthandProperties = {
763
766
  textEmphasis: ["textEmphasisStyle", "textEmphasisColor"],
764
767
  transition: ["transitionProperty", "transitionDuration", "transitionTimingFunction", "transitionDelay"]
765
768
  };
766
- var longhands = Object.values(shorthandProperties).reduce((a, b) => [...a, ...b], []);
769
+ var longhands = Object.values(shorthandProperties).reduce((a, b) => {
770
+ b.forEach((val) => a.add(val));
771
+ return a;
772
+ }, /* @__PURE__ */ new Set([]));
767
773
  function getPropertyPriority(property) {
768
774
  if (property === "all")
769
775
  return 0;
770
- return longhands.includes(property) ? 2 : 1;
776
+ return longhands.has(property) ? 2 : 1;
771
777
  }
772
778
 
773
779
  // src/slot.ts
@@ -882,17 +888,26 @@ function unionType(values) {
882
888
  }
883
889
 
884
890
  // src/uniq.ts
885
- var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
891
+ var uniq = (...items) => {
892
+ const set = items.reduce((acc, currItems) => {
893
+ if (currItems) {
894
+ currItems.forEach((item) => acc.add(item));
895
+ }
896
+ return acc;
897
+ }, /* @__PURE__ */ new Set([]));
898
+ return Array.from(set);
899
+ };
886
900
 
887
901
  // src/unit-conversion.ts
888
902
  var BASE_FONT_SIZE = 16;
889
903
  var UNIT_PX = "px";
890
904
  var UNIT_EM = "em";
891
905
  var UNIT_REM = "rem";
906
+ var DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
907
+ var UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
908
+ var VALUE_REGEX = new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`);
892
909
  function getUnit(value = "") {
893
- const DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
894
- const UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
895
- const unit = value.match(new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`));
910
+ const unit = value.match(VALUE_REGEX);
896
911
  return unit?.[1];
897
912
  }
898
913
  function toPx(value = "") {
@@ -3,6 +3,7 @@ declare const isBoolean: (v: any) => v is boolean;
3
3
  type AnyFunction = (...args: any[]) => any;
4
4
  declare const isFunction: (v: any) => v is AnyFunction;
5
5
  declare function isObject(value: any): value is Record<string, any>;
6
+ declare const isObjectOrArray: (obj: unknown) => boolean;
6
7
 
7
8
  interface CreateCssContext {
8
9
  hash?: boolean;
@@ -91,4 +92,4 @@ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
91
92
 
92
93
  declare const uniq: <T>(...items: T[][]) => T[];
93
94
 
94
- export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, hypenateProperty as j, isImportant as k, withoutSpace as l, markImportant as m, memo as n, mergeProps as o, patternFns as p, getPatternStyles as q, getSlotRecipes as r, getSlotCompoundVariant as s, toHash as t, splitProps as u, uniq as v, withoutImportant as w, type WalkObjectOptions as x, walkObject as y, mapObject as z };
95
+ export { mapObject as A, type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, isObjectOrArray as d, createCss as e, createMergeCss as f, compact as g, isBaseCondition as h, isString as i, filterBaseConditions as j, hypenateProperty as k, isImportant as l, withoutSpace as m, markImportant as n, memo as o, mergeProps as p, patternFns as q, getPatternStyles as r, getSlotRecipes as s, toHash as t, getSlotCompoundVariant as u, splitProps as v, withoutImportant as w, uniq as x, type WalkObjectOptions as y, walkObject as z };
@@ -3,6 +3,7 @@ declare const isBoolean: (v: any) => v is boolean;
3
3
  type AnyFunction = (...args: any[]) => any;
4
4
  declare const isFunction: (v: any) => v is AnyFunction;
5
5
  declare function isObject(value: any): value is Record<string, any>;
6
+ declare const isObjectOrArray: (obj: unknown) => boolean;
6
7
 
7
8
  interface CreateCssContext {
8
9
  hash?: boolean;
@@ -91,4 +92,4 @@ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
91
92
 
92
93
  declare const uniq: <T>(...items: T[][]) => T[];
93
94
 
94
- export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, hypenateProperty as j, isImportant as k, withoutSpace as l, markImportant as m, memo as n, mergeProps as o, patternFns as p, getPatternStyles as q, getSlotRecipes as r, getSlotCompoundVariant as s, toHash as t, splitProps as u, uniq as v, withoutImportant as w, type WalkObjectOptions as x, walkObject as y, mapObject as z };
95
+ export { mapObject as A, type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, isObjectOrArray as d, createCss as e, createMergeCss as f, compact as g, isBaseCondition as h, isString as i, filterBaseConditions as j, hypenateProperty as k, isImportant as l, withoutSpace as m, markImportant as n, memo as o, mergeProps as p, patternFns as q, getPatternStyles as r, getSlotRecipes as s, toHash as t, getSlotCompoundVariant as u, splitProps as v, withoutImportant as w, uniq as x, type WalkObjectOptions as y, walkObject as z };
package/dist/shared.d.mts CHANGED
@@ -1 +1 @@
1
- export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, l as withoutSpace } from './shared-eaCmCttJ.mjs';
1
+ export { g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, c as isObject, A as mapObject, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, m as withoutSpace } from './shared-BKiOijOQ.mjs';
package/dist/shared.d.ts CHANGED
@@ -1 +1 @@
1
- export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, l as withoutSpace } from './shared-eaCmCttJ.js';
1
+ export { g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, c as isObject, A as mapObject, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, m as withoutSpace } from './shared-BKiOijOQ.js';
package/dist/shared.js CHANGED
@@ -46,6 +46,7 @@ module.exports = __toCommonJS(shared_exports);
46
46
  function isObject(value) {
47
47
  return typeof value === "object" && value != null && !Array.isArray(value);
48
48
  }
49
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
49
50
 
50
51
  // src/compact.ts
51
52
  function compact(value) {
@@ -108,8 +109,9 @@ var memo = (fn) => {
108
109
 
109
110
  // src/merge-props.ts
110
111
  function mergeProps(...sources) {
111
- const objects = sources.filter(Boolean);
112
- return objects.reduce((prev, obj) => {
112
+ return sources.reduce((prev, obj) => {
113
+ if (!obj)
114
+ return prev;
113
115
  Object.keys(obj).forEach((key) => {
114
116
  const prevValue = prev[key];
115
117
  const value = obj[key];
@@ -128,7 +130,7 @@ var isNotNullish = (element) => element != null;
128
130
  function walkObject(target, predicate, options = {}) {
129
131
  const { stop, getKey } = options;
130
132
  function inner(value, path = []) {
131
- if (isObject(value) || Array.isArray(value)) {
133
+ if (isObjectOrArray(value)) {
132
134
  const result = {};
133
135
  for (const [prop, child] of Object.entries(value)) {
134
136
  const key = getKey?.(prop, child) ?? prop;
@@ -209,9 +211,9 @@ function createCss(context) {
209
211
  const normalizedObject = normalizeStyleObject(styleObject, context);
210
212
  const classNames = /* @__PURE__ */ new Set();
211
213
  walkObject(normalizedObject, (value, paths) => {
212
- const important = isImportant(value);
213
214
  if (value == null)
214
215
  return;
216
+ const important = isImportant(value);
215
217
  const [prop, ...allConditions] = conds.shift(paths);
216
218
  const conditions = filterBaseConditions(allConditions);
217
219
  const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
@@ -322,7 +324,15 @@ function splitProps(props, ...keys) {
322
324
  }
323
325
 
324
326
  // src/uniq.ts
325
- var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
327
+ var uniq = (...items) => {
328
+ const set = items.reduce((acc, currItems) => {
329
+ if (currItems) {
330
+ currItems.forEach((item) => acc.add(item));
331
+ }
332
+ return acc;
333
+ }, /* @__PURE__ */ new Set([]));
334
+ return Array.from(set);
335
+ };
326
336
  // Annotate the CommonJS export names for ESM import in node:
327
337
  0 && (module.exports = {
328
338
  compact,
package/dist/shared.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  function isObject(value) {
3
3
  return typeof value === "object" && value != null && !Array.isArray(value);
4
4
  }
5
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
5
6
 
6
7
  // src/compact.ts
7
8
  function compact(value) {
@@ -64,8 +65,9 @@ var memo = (fn) => {
64
65
 
65
66
  // src/merge-props.ts
66
67
  function mergeProps(...sources) {
67
- const objects = sources.filter(Boolean);
68
- return objects.reduce((prev, obj) => {
68
+ return sources.reduce((prev, obj) => {
69
+ if (!obj)
70
+ return prev;
69
71
  Object.keys(obj).forEach((key) => {
70
72
  const prevValue = prev[key];
71
73
  const value = obj[key];
@@ -84,7 +86,7 @@ var isNotNullish = (element) => element != null;
84
86
  function walkObject(target, predicate, options = {}) {
85
87
  const { stop, getKey } = options;
86
88
  function inner(value, path = []) {
87
- if (isObject(value) || Array.isArray(value)) {
89
+ if (isObjectOrArray(value)) {
88
90
  const result = {};
89
91
  for (const [prop, child] of Object.entries(value)) {
90
92
  const key = getKey?.(prop, child) ?? prop;
@@ -165,9 +167,9 @@ function createCss(context) {
165
167
  const normalizedObject = normalizeStyleObject(styleObject, context);
166
168
  const classNames = /* @__PURE__ */ new Set();
167
169
  walkObject(normalizedObject, (value, paths) => {
168
- const important = isImportant(value);
169
170
  if (value == null)
170
171
  return;
172
+ const important = isImportant(value);
171
173
  const [prop, ...allConditions] = conds.shift(paths);
172
174
  const conditions = filterBaseConditions(allConditions);
173
175
  const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
@@ -278,7 +280,15 @@ function splitProps(props, ...keys) {
278
280
  }
279
281
 
280
282
  // src/uniq.ts
281
- var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
283
+ var uniq = (...items) => {
284
+ const set = items.reduce((acc, currItems) => {
285
+ if (currItems) {
286
+ currItems.forEach((item) => acc.add(item));
287
+ }
288
+ return acc;
289
+ }, /* @__PURE__ */ new Set([]));
290
+ return Array.from(set);
291
+ };
282
292
  export {
283
293
  compact,
284
294
  createCss,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.45.2",
3
+ "version": "0.46.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",