@pandacss/shared 0.0.0-dev-20240110101351 → 0.0.0-dev-20240112100832

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/index.d.mts CHANGED
@@ -33,6 +33,9 @@ interface CssVarOptions {
33
33
  }
34
34
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
35
35
 
36
+ type Dict = Record<string, any>;
37
+ declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
38
+
36
39
  declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
37
40
  [key in A]: B;
38
41
  };
@@ -87,4 +90,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
87
90
 
88
91
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
89
92
 
90
- export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
93
+ export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,9 @@ interface CssVarOptions {
33
33
  }
34
34
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
35
35
 
36
+ type Dict = Record<string, any>;
37
+ declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
38
+
36
39
  declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
37
40
  [key in A]: B;
38
41
  };
@@ -87,4 +90,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
87
90
 
88
91
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
89
92
 
90
- export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
93
+ export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ __export(src_exports, {
30
30
  createRegex: () => createRegex,
31
31
  cssVar: () => cssVar,
32
32
  dashCase: () => dashCase,
33
+ deepSet: () => deepSet,
33
34
  entries: () => entries,
34
35
  esc: () => esc2,
35
36
  filterBaseConditions: () => filterBaseConditions,
@@ -195,7 +196,7 @@ function filterBaseConditions(c) {
195
196
  }
196
197
 
197
198
  // src/css-important.ts
198
- var importantRegex = /!(important)?/;
199
+ var importantRegex = /\s*!(important)?/i;
199
200
  function isImportant(value) {
200
201
  return typeof value === "string" ? importantRegex.test(value) : false;
201
202
  }
@@ -462,6 +463,31 @@ function cssVar(name, options = {}) {
462
463
  return result;
463
464
  }
464
465
 
466
+ // src/deep-set.ts
467
+ var deepSet = (target, path, value) => {
468
+ const isValueObject = isObject(value);
469
+ if (!path.length && isValueObject) {
470
+ return Object.assign(target, value);
471
+ }
472
+ let current = target;
473
+ for (let i = 0; i < path.length; i++) {
474
+ const key = path[i];
475
+ if (!current[key]) {
476
+ current[key] = {};
477
+ }
478
+ if (i === path.length - 1) {
479
+ if (isValueObject && isObject(current[key])) {
480
+ Object.assign(current[key], value);
481
+ } else {
482
+ current[key] = value;
483
+ }
484
+ } else {
485
+ current = current[key];
486
+ }
487
+ }
488
+ return target;
489
+ };
490
+
465
491
  // src/entries.ts
466
492
  function fromEntries(entries2) {
467
493
  const result = {};
@@ -706,6 +732,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
706
732
  createRegex,
707
733
  cssVar,
708
734
  dashCase,
735
+ deepSet,
709
736
  entries,
710
737
  esc,
711
738
  filterBaseConditions,
package/dist/index.mjs CHANGED
@@ -115,7 +115,7 @@ function filterBaseConditions(c) {
115
115
  }
116
116
 
117
117
  // src/css-important.ts
118
- var importantRegex = /!(important)?/;
118
+ var importantRegex = /\s*!(important)?/i;
119
119
  function isImportant(value) {
120
120
  return typeof value === "string" ? importantRegex.test(value) : false;
121
121
  }
@@ -382,6 +382,31 @@ function cssVar(name, options = {}) {
382
382
  return result;
383
383
  }
384
384
 
385
+ // src/deep-set.ts
386
+ var deepSet = (target, path, value) => {
387
+ const isValueObject = isObject(value);
388
+ if (!path.length && isValueObject) {
389
+ return Object.assign(target, value);
390
+ }
391
+ let current = target;
392
+ for (let i = 0; i < path.length; i++) {
393
+ const key = path[i];
394
+ if (!current[key]) {
395
+ current[key] = {};
396
+ }
397
+ if (i === path.length - 1) {
398
+ if (isValueObject && isObject(current[key])) {
399
+ Object.assign(current[key], value);
400
+ } else {
401
+ current[key] = value;
402
+ }
403
+ } else {
404
+ current = current[key];
405
+ }
406
+ }
407
+ return target;
408
+ };
409
+
385
410
  // src/entries.ts
386
411
  function fromEntries(entries2) {
387
412
  const result = {};
@@ -625,6 +650,7 @@ export {
625
650
  createRegex,
626
651
  cssVar,
627
652
  dashCase,
653
+ deepSet,
628
654
  entries,
629
655
  esc2 as esc,
630
656
  filterBaseConditions,
package/dist/shared.js CHANGED
@@ -57,7 +57,7 @@ function filterBaseConditions(c) {
57
57
  }
58
58
 
59
59
  // src/css-important.ts
60
- var importantRegex = /!(important)?/;
60
+ var importantRegex = /\s*!(important)?/i;
61
61
  function isImportant(value) {
62
62
  return typeof value === "string" ? importantRegex.test(value) : false;
63
63
  }
package/dist/shared.mjs CHANGED
@@ -15,7 +15,7 @@ function filterBaseConditions(c) {
15
15
  }
16
16
 
17
17
  // src/css-important.ts
18
- var importantRegex = /!(important)?/;
18
+ var importantRegex = /\s*!(important)?/i;
19
19
  function isImportant(value) {
20
20
  return typeof value === "string" ? importantRegex.test(value) : false;
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.0.0-dev-20240110101351",
3
+ "version": "0.0.0-dev-20240112100832",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",