@pandacss/shared 0.25.0 → 0.26.1

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,18 @@ interface CssVarOptions {
33
33
  }
34
34
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
35
35
 
36
+ declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
37
+ [key in A]: B;
38
+ };
39
+ declare function entries<A extends symbol | string | number, B>(obj: {
40
+ [key in A]: B;
41
+ }): [A, B][];
42
+ declare function mapEntries<A, B, K extends string | number | symbol>(obj: {
43
+ [key in K]: A;
44
+ }, f: (key: K, val: A) => [K, B]): {
45
+ [key in K]: B;
46
+ };
47
+
36
48
  declare const esc: (sel: string) => string;
37
49
 
38
50
  declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
@@ -75,4 +87,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
75
87
 
76
88
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
77
89
 
78
- export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
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 };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,18 @@ interface CssVarOptions {
33
33
  }
34
34
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
35
35
 
36
+ declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
37
+ [key in A]: B;
38
+ };
39
+ declare function entries<A extends symbol | string | number, B>(obj: {
40
+ [key in A]: B;
41
+ }): [A, B][];
42
+ declare function mapEntries<A, B, K extends string | number | symbol>(obj: {
43
+ [key in K]: A;
44
+ }, f: (key: K, val: A) => [K, B]): {
45
+ [key in K]: B;
46
+ };
47
+
36
48
  declare const esc: (sel: string) => string;
37
49
 
38
50
  declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
@@ -75,4 +87,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
75
87
 
76
88
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
77
89
 
78
- export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
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 };
package/dist/index.js CHANGED
@@ -30,9 +30,11 @@ __export(src_exports, {
30
30
  createRegex: () => createRegex,
31
31
  cssVar: () => cssVar,
32
32
  dashCase: () => dashCase,
33
+ entries: () => entries,
33
34
  esc: () => esc2,
34
35
  filterBaseConditions: () => filterBaseConditions,
35
36
  flatten: () => flatten,
37
+ fromEntries: () => fromEntries,
36
38
  getArbitraryValue: () => getArbitraryValue,
37
39
  getDotPath: () => getDotPath,
38
40
  getNegativePath: () => getNegativePath,
@@ -48,6 +50,7 @@ __export(src_exports, {
48
50
  isObject: () => isObject,
49
51
  isObjectOrArray: () => isObjectOrArray,
50
52
  isString: () => isString,
53
+ mapEntries: () => mapEntries,
51
54
  mapObject: () => mapObject,
52
55
  mapToJson: () => mapToJson,
53
56
  markImportant: () => markImportant,
@@ -80,7 +83,21 @@ var getArbitraryValue = (value) => {
80
83
  if (!value)
81
84
  return value;
82
85
  if (value[0] === "[" && value[value.length - 1] === "]") {
83
- return value.slice(1, -1);
86
+ const innerValue = value.slice(1, -1);
87
+ let bracketCount = 0;
88
+ for (let i = 0; i < innerValue.length; i++) {
89
+ if (innerValue[i] === "[") {
90
+ bracketCount++;
91
+ } else if (innerValue[i] === "]") {
92
+ if (bracketCount === 0) {
93
+ return value;
94
+ }
95
+ bracketCount--;
96
+ }
97
+ }
98
+ if (bracketCount === 0) {
99
+ return innerValue;
100
+ }
84
101
  }
85
102
  return value;
86
103
  };
@@ -445,6 +462,30 @@ function cssVar(name, options = {}) {
445
462
  return result;
446
463
  }
447
464
 
465
+ // src/entries.ts
466
+ function fromEntries(entries2) {
467
+ const result = {};
468
+ entries2.forEach((kv) => {
469
+ result[kv[0]] = kv[1];
470
+ });
471
+ return result;
472
+ }
473
+ function entries(obj) {
474
+ const result = [];
475
+ for (const key in obj) {
476
+ result.push([key, obj[key]]);
477
+ }
478
+ return result;
479
+ }
480
+ function mapEntries(obj, f) {
481
+ const result = {};
482
+ for (const key in obj) {
483
+ const kv = f(key, obj[key]);
484
+ result[kv[0]] = kv[1];
485
+ }
486
+ return result;
487
+ }
488
+
448
489
  // src/esc.ts
449
490
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
450
491
  var fcssescape = function(ch, asCodePoint) {
@@ -665,9 +706,11 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
665
706
  createRegex,
666
707
  cssVar,
667
708
  dashCase,
709
+ entries,
668
710
  esc,
669
711
  filterBaseConditions,
670
712
  flatten,
713
+ fromEntries,
671
714
  getArbitraryValue,
672
715
  getDotPath,
673
716
  getNegativePath,
@@ -683,6 +726,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
683
726
  isObject,
684
727
  isObjectOrArray,
685
728
  isString,
729
+ mapEntries,
686
730
  mapObject,
687
731
  mapToJson,
688
732
  markImportant,
package/dist/index.mjs CHANGED
@@ -3,7 +3,21 @@ var getArbitraryValue = (value) => {
3
3
  if (!value)
4
4
  return value;
5
5
  if (value[0] === "[" && value[value.length - 1] === "]") {
6
- return value.slice(1, -1);
6
+ const innerValue = value.slice(1, -1);
7
+ let bracketCount = 0;
8
+ for (let i = 0; i < innerValue.length; i++) {
9
+ if (innerValue[i] === "[") {
10
+ bracketCount++;
11
+ } else if (innerValue[i] === "]") {
12
+ if (bracketCount === 0) {
13
+ return value;
14
+ }
15
+ bracketCount--;
16
+ }
17
+ }
18
+ if (bracketCount === 0) {
19
+ return innerValue;
20
+ }
7
21
  }
8
22
  return value;
9
23
  };
@@ -368,6 +382,30 @@ function cssVar(name, options = {}) {
368
382
  return result;
369
383
  }
370
384
 
385
+ // src/entries.ts
386
+ function fromEntries(entries2) {
387
+ const result = {};
388
+ entries2.forEach((kv) => {
389
+ result[kv[0]] = kv[1];
390
+ });
391
+ return result;
392
+ }
393
+ function entries(obj) {
394
+ const result = [];
395
+ for (const key in obj) {
396
+ result.push([key, obj[key]]);
397
+ }
398
+ return result;
399
+ }
400
+ function mapEntries(obj, f) {
401
+ const result = {};
402
+ for (const key in obj) {
403
+ const kv = f(key, obj[key]);
404
+ result[kv[0]] = kv[1];
405
+ }
406
+ return result;
407
+ }
408
+
371
409
  // src/esc.ts
372
410
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
373
411
  var fcssescape = function(ch, asCodePoint) {
@@ -587,9 +625,11 @@ export {
587
625
  createRegex,
588
626
  cssVar,
589
627
  dashCase,
628
+ entries,
590
629
  esc2 as esc,
591
630
  filterBaseConditions,
592
631
  flatten,
632
+ fromEntries,
593
633
  getArbitraryValue,
594
634
  getDotPath,
595
635
  getNegativePath,
@@ -605,6 +645,7 @@ export {
605
645
  isObject,
606
646
  isObjectOrArray,
607
647
  isString,
648
+ mapEntries,
608
649
  mapObject,
609
650
  mapToJson,
610
651
  markImportant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",