@pandacss/shared 0.19.0 → 0.21.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/index.d.mts CHANGED
@@ -2,6 +2,8 @@ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from
2
2
  export { p as WalkObjectOptions, e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, a as isFunction, h as isImportant, b as isObject, i as isString, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, u as uniq, q as walkObject, w as withoutImportant, j as withoutSpace } from './shared-6d968e1d.js';
3
3
  export { astish } from './astish.mjs';
4
4
 
5
+ declare const getArbitraryValue: (value: string) => string;
6
+
5
7
  type Operand = string | number | {
6
8
  ref: string;
7
9
  };
@@ -37,10 +39,13 @@ declare function flatten(values: Record<string, Record<string, any>>, stop?: Wal
37
39
 
38
40
  type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
39
41
  declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
40
- declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
42
+ declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
41
43
 
42
44
  declare const createRegex: (item: Array<string | RegExp>) => RegExp;
43
45
 
46
+ declare const stringifyJson: (config: Record<string, any>) => string;
47
+ declare const parseJson: (config: string) => any;
48
+
44
49
  declare function splitBy(value: string, separator?: string): any[];
45
50
  declare function splitDotPath(path: string): string[];
46
51
  declare function getNegativePath(path: string[]): string[];
@@ -53,4 +58,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
53
58
 
54
59
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
55
60
 
56
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
61
+ export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getArbitraryValue, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, uncapitalize, unionType };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from
2
2
  export { p as WalkObjectOptions, e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, a as isFunction, h as isImportant, b as isObject, i as isString, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, u as uniq, q as walkObject, w as withoutImportant, j as withoutSpace } from './shared-6d968e1d.js';
3
3
  export { astish } from './astish.js';
4
4
 
5
+ declare const getArbitraryValue: (value: string) => string;
6
+
5
7
  type Operand = string | number | {
6
8
  ref: string;
7
9
  };
@@ -37,10 +39,13 @@ declare function flatten(values: Record<string, Record<string, any>>, stop?: Wal
37
39
 
38
40
  type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
39
41
  declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
40
- declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
42
+ declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
41
43
 
42
44
  declare const createRegex: (item: Array<string | RegExp>) => RegExp;
43
45
 
46
+ declare const stringifyJson: (config: Record<string, any>) => string;
47
+ declare const parseJson: (config: string) => any;
48
+
44
49
  declare function splitBy(value: string, separator?: string): any[];
45
50
  declare function splitDotPath(path: string): string[];
46
51
  declare function getNegativePath(path: string[]): string[];
@@ -53,4 +58,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
53
58
 
54
59
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
55
60
 
56
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
61
+ export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getArbitraryValue, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, uncapitalize, unionType };
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ __export(src_exports, {
33
33
  esc: () => esc2,
34
34
  filterBaseConditions: () => filterBaseConditions,
35
35
  flatten: () => flatten,
36
+ getArbitraryValue: () => getArbitraryValue,
36
37
  getDotPath: () => getDotPath,
37
38
  getNegativePath: () => getNegativePath,
38
39
  getSlotCompoundVariant: () => getSlotCompoundVariant,
@@ -50,9 +51,11 @@ __export(src_exports, {
50
51
  mergeProps: () => mergeProps,
51
52
  normalizeShorthand: () => normalizeShorthand,
52
53
  normalizeStyleObject: () => normalizeStyleObject,
54
+ parseJson: () => parseJson,
53
55
  splitBy: () => splitBy,
54
56
  splitDotPath: () => splitDotPath,
55
57
  splitProps: () => splitProps,
58
+ stringifyJson: () => stringifyJson,
56
59
  toEm: () => toEm,
57
60
  toHash: () => toHash,
58
61
  toPx: () => toPx,
@@ -66,6 +69,16 @@ __export(src_exports, {
66
69
  });
67
70
  module.exports = __toCommonJS(src_exports);
68
71
 
72
+ // src/arbitrary-value.ts
73
+ var getArbitraryValue = (value) => {
74
+ if (!value)
75
+ return value;
76
+ if (value[0] === "[" && value[value.length - 1] === "]") {
77
+ return value.slice(1, -1);
78
+ }
79
+ return value;
80
+ };
81
+
69
82
  // src/assert.ts
70
83
  var isString = (v) => typeof v === "string";
71
84
  var isFunction = (v) => typeof v === "function";
@@ -255,7 +268,7 @@ function normalizeShorthand(styles, context) {
255
268
  }
256
269
  });
257
270
  }
258
- function normalizeStyleObject(styles, context) {
271
+ function normalizeStyleObject(styles, context, shorthand = true) {
259
272
  const { utility, conditions } = context;
260
273
  const { hasShorthand, resolveShorthand } = utility;
261
274
  return walkObject(
@@ -265,9 +278,7 @@ function normalizeStyleObject(styles, context) {
265
278
  },
266
279
  {
267
280
  stop: (value) => Array.isArray(value),
268
- getKey: (prop) => {
269
- return hasShorthand ? resolveShorthand(prop) : prop;
270
- }
281
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
271
282
  }
272
283
  );
273
284
  }
@@ -452,6 +463,18 @@ var createRegex = (item) => {
452
463
  return new RegExp(regex2);
453
464
  };
454
465
 
466
+ // src/serialize.ts
467
+ var stringifyJson = (config) => {
468
+ return JSON.stringify(config, (_key, value) => {
469
+ if (typeof value === "function")
470
+ return value.toString();
471
+ return value;
472
+ });
473
+ };
474
+ var parseJson = (config) => {
475
+ return JSON.parse(config);
476
+ };
477
+
455
478
  // src/slot.ts
456
479
  var getSlotRecipes = (recipe = {}) => {
457
480
  const init = (slot) => ({
@@ -580,6 +603,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
580
603
  esc,
581
604
  filterBaseConditions,
582
605
  flatten,
606
+ getArbitraryValue,
583
607
  getDotPath,
584
608
  getNegativePath,
585
609
  getSlotCompoundVariant,
@@ -597,9 +621,11 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
597
621
  mergeProps,
598
622
  normalizeShorthand,
599
623
  normalizeStyleObject,
624
+ parseJson,
600
625
  splitBy,
601
626
  splitDotPath,
602
627
  splitProps,
628
+ stringifyJson,
603
629
  toEm,
604
630
  toHash,
605
631
  toPx,
package/dist/index.mjs CHANGED
@@ -1,3 +1,13 @@
1
+ // src/arbitrary-value.ts
2
+ var getArbitraryValue = (value) => {
3
+ if (!value)
4
+ return value;
5
+ if (value[0] === "[" && value[value.length - 1] === "]") {
6
+ return value.slice(1, -1);
7
+ }
8
+ return value;
9
+ };
10
+
1
11
  // src/assert.ts
2
12
  var isString = (v) => typeof v === "string";
3
13
  var isFunction = (v) => typeof v === "function";
@@ -187,7 +197,7 @@ function normalizeShorthand(styles, context) {
187
197
  }
188
198
  });
189
199
  }
190
- function normalizeStyleObject(styles, context) {
200
+ function normalizeStyleObject(styles, context, shorthand = true) {
191
201
  const { utility, conditions } = context;
192
202
  const { hasShorthand, resolveShorthand } = utility;
193
203
  return walkObject(
@@ -197,9 +207,7 @@ function normalizeStyleObject(styles, context) {
197
207
  },
198
208
  {
199
209
  stop: (value) => Array.isArray(value),
200
- getKey: (prop) => {
201
- return hasShorthand ? resolveShorthand(prop) : prop;
202
- }
210
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
203
211
  }
204
212
  );
205
213
  }
@@ -384,6 +392,18 @@ var createRegex = (item) => {
384
392
  return new RegExp(regex2);
385
393
  };
386
394
 
395
+ // src/serialize.ts
396
+ var stringifyJson = (config) => {
397
+ return JSON.stringify(config, (_key, value) => {
398
+ if (typeof value === "function")
399
+ return value.toString();
400
+ return value;
401
+ });
402
+ };
403
+ var parseJson = (config) => {
404
+ return JSON.parse(config);
405
+ };
406
+
387
407
  // src/slot.ts
388
408
  var getSlotRecipes = (recipe = {}) => {
389
409
  const init = (slot) => ({
@@ -511,6 +531,7 @@ export {
511
531
  esc2 as esc,
512
532
  filterBaseConditions,
513
533
  flatten,
534
+ getArbitraryValue,
514
535
  getDotPath,
515
536
  getNegativePath,
516
537
  getSlotCompoundVariant,
@@ -528,9 +549,11 @@ export {
528
549
  mergeProps,
529
550
  normalizeShorthand,
530
551
  normalizeStyleObject,
552
+ parseJson,
531
553
  splitBy,
532
554
  splitDotPath,
533
555
  splitProps,
556
+ stringifyJson,
534
557
  toEm,
535
558
  toHash,
536
559
  toPx,
package/dist/shared.js CHANGED
@@ -154,7 +154,7 @@ function normalizeShorthand(styles, context) {
154
154
  }
155
155
  });
156
156
  }
157
- function normalizeStyleObject(styles, context) {
157
+ function normalizeStyleObject(styles, context, shorthand = true) {
158
158
  const { utility, conditions } = context;
159
159
  const { hasShorthand, resolveShorthand } = utility;
160
160
  return walkObject(
@@ -164,9 +164,7 @@ function normalizeStyleObject(styles, context) {
164
164
  },
165
165
  {
166
166
  stop: (value) => Array.isArray(value),
167
- getKey: (prop) => {
168
- return hasShorthand ? resolveShorthand(prop) : prop;
169
- }
167
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
170
168
  }
171
169
  );
172
170
  }
package/dist/shared.mjs CHANGED
@@ -112,7 +112,7 @@ function normalizeShorthand(styles, context) {
112
112
  }
113
113
  });
114
114
  }
115
- function normalizeStyleObject(styles, context) {
115
+ function normalizeStyleObject(styles, context, shorthand = true) {
116
116
  const { utility, conditions } = context;
117
117
  const { hasShorthand, resolveShorthand } = utility;
118
118
  return walkObject(
@@ -122,9 +122,7 @@ function normalizeStyleObject(styles, context) {
122
122
  },
123
123
  {
124
124
  stop: (value) => Array.isArray(value),
125
- getKey: (prop) => {
126
- return hasShorthand ? resolveShorthand(prop) : prop;
127
- }
125
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
128
126
  }
129
127
  );
130
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",