@pandacss/shared 0.20.1 → 0.22.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,7 +39,7 @@ 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
 
@@ -56,4 +58,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
56
58
 
57
59
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
58
60
 
59
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, 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,7 +39,7 @@ 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
 
@@ -56,4 +58,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
56
58
 
57
59
  declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
58
60
 
59
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, 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,
@@ -68,6 +69,16 @@ __export(src_exports, {
68
69
  });
69
70
  module.exports = __toCommonJS(src_exports);
70
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
+
71
82
  // src/assert.ts
72
83
  var isString = (v) => typeof v === "string";
73
84
  var isFunction = (v) => typeof v === "function";
@@ -234,6 +245,8 @@ function walkObject(target, predicate, options = {}) {
234
245
  return inner(target);
235
246
  }
236
247
  function mapObject(obj, fn) {
248
+ if (Array.isArray(obj))
249
+ return obj.map((value) => fn(value));
237
250
  if (!isObject(obj))
238
251
  return fn(obj);
239
252
  return walkObject(obj, (value) => fn(value));
@@ -257,7 +270,7 @@ function normalizeShorthand(styles, context) {
257
270
  }
258
271
  });
259
272
  }
260
- function normalizeStyleObject(styles, context) {
273
+ function normalizeStyleObject(styles, context, shorthand = true) {
261
274
  const { utility, conditions } = context;
262
275
  const { hasShorthand, resolveShorthand } = utility;
263
276
  return walkObject(
@@ -267,9 +280,7 @@ function normalizeStyleObject(styles, context) {
267
280
  },
268
281
  {
269
282
  stop: (value) => Array.isArray(value),
270
- getKey: (prop) => {
271
- return hasShorthand ? resolveShorthand(prop) : prop;
272
- }
283
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
273
284
  }
274
285
  );
275
286
  }
@@ -594,6 +605,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
594
605
  esc,
595
606
  filterBaseConditions,
596
607
  flatten,
608
+ getArbitraryValue,
597
609
  getDotPath,
598
610
  getNegativePath,
599
611
  getSlotCompoundVariant,
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";
@@ -164,6 +174,8 @@ function walkObject(target, predicate, options = {}) {
164
174
  return inner(target);
165
175
  }
166
176
  function mapObject(obj, fn) {
177
+ if (Array.isArray(obj))
178
+ return obj.map((value) => fn(value));
167
179
  if (!isObject(obj))
168
180
  return fn(obj);
169
181
  return walkObject(obj, (value) => fn(value));
@@ -187,7 +199,7 @@ function normalizeShorthand(styles, context) {
187
199
  }
188
200
  });
189
201
  }
190
- function normalizeStyleObject(styles, context) {
202
+ function normalizeStyleObject(styles, context, shorthand = true) {
191
203
  const { utility, conditions } = context;
192
204
  const { hasShorthand, resolveShorthand } = utility;
193
205
  return walkObject(
@@ -197,9 +209,7 @@ function normalizeStyleObject(styles, context) {
197
209
  },
198
210
  {
199
211
  stop: (value) => Array.isArray(value),
200
- getKey: (prop) => {
201
- return hasShorthand ? resolveShorthand(prop) : prop;
202
- }
212
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
203
213
  }
204
214
  );
205
215
  }
@@ -523,6 +533,7 @@ export {
523
533
  esc2 as esc,
524
534
  filterBaseConditions,
525
535
  flatten,
536
+ getArbitraryValue,
526
537
  getDotPath,
527
538
  getNegativePath,
528
539
  getSlotCompoundVariant,
package/dist/shared.js CHANGED
@@ -131,6 +131,8 @@ function walkObject(target, predicate, options = {}) {
131
131
  return inner(target);
132
132
  }
133
133
  function mapObject(obj, fn) {
134
+ if (Array.isArray(obj))
135
+ return obj.map((value) => fn(value));
134
136
  if (!isObject(obj))
135
137
  return fn(obj);
136
138
  return walkObject(obj, (value) => fn(value));
@@ -154,7 +156,7 @@ function normalizeShorthand(styles, context) {
154
156
  }
155
157
  });
156
158
  }
157
- function normalizeStyleObject(styles, context) {
159
+ function normalizeStyleObject(styles, context, shorthand = true) {
158
160
  const { utility, conditions } = context;
159
161
  const { hasShorthand, resolveShorthand } = utility;
160
162
  return walkObject(
@@ -164,9 +166,7 @@ function normalizeStyleObject(styles, context) {
164
166
  },
165
167
  {
166
168
  stop: (value) => Array.isArray(value),
167
- getKey: (prop) => {
168
- return hasShorthand ? resolveShorthand(prop) : prop;
169
- }
169
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
170
170
  }
171
171
  );
172
172
  }
package/dist/shared.mjs CHANGED
@@ -89,6 +89,8 @@ function walkObject(target, predicate, options = {}) {
89
89
  return inner(target);
90
90
  }
91
91
  function mapObject(obj, fn) {
92
+ if (Array.isArray(obj))
93
+ return obj.map((value) => fn(value));
92
94
  if (!isObject(obj))
93
95
  return fn(obj);
94
96
  return walkObject(obj, (value) => fn(value));
@@ -112,7 +114,7 @@ function normalizeShorthand(styles, context) {
112
114
  }
113
115
  });
114
116
  }
115
- function normalizeStyleObject(styles, context) {
117
+ function normalizeStyleObject(styles, context, shorthand = true) {
116
118
  const { utility, conditions } = context;
117
119
  const { hasShorthand, resolveShorthand } = utility;
118
120
  return walkObject(
@@ -122,9 +124,7 @@ function normalizeStyleObject(styles, context) {
122
124
  },
123
125
  {
124
126
  stop: (value) => Array.isArray(value),
125
- getKey: (prop) => {
126
- return hasShorthand ? resolveShorthand(prop) : prop;
127
- }
127
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
128
128
  }
129
129
  );
130
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.20.1",
3
+ "version": "0.22.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",