@pandacss/shared 0.0.0-dev-20230623141647 → 0.0.0-dev-20230625171447

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.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './split-props-6820d5c1.js';
2
- export { l as WalkObjectOptions, e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, k as hypenateProperty, f as isBaseCondition, a as isFunction, h as isImportant, b as isObject, i as isString, o as mapObject, m as mergeProps, s as splitProps, t as toHash, n as walkObject, w as withoutImportant, j as withoutSpace } from './split-props-6820d5c1.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './split-props-3d8b55c4.js';
2
+ export { n as WalkObjectOptions, c as astish, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, l as hypenateProperty, g as isBaseCondition, a as isFunction, j as isImportant, b as isObject, i as isString, p as mapObject, m as mergeProps, s as splitProps, t as toHash, o as walkObject, w as withoutImportant, k as withoutSpace } from './split-props-3d8b55c4.js';
3
3
 
4
4
  type Operand = string | number | {
5
5
  ref: string;
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ astish: () => astish,
23
24
  calc: () => calc,
24
25
  capitalize: () => capitalize,
25
26
  compact: () => compact,
@@ -67,6 +68,22 @@ function isObject(value) {
67
68
  return typeof value === "object" && value != null && !Array.isArray(value);
68
69
  }
69
70
 
71
+ // src/astish.ts
72
+ var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
73
+ var ruleClean = /\/\*[^]*?\*\/|\s\s+|\n/g;
74
+ var astish = (val, tree = [{}]) => {
75
+ const block = newRule.exec(val.replace(ruleClean, ""));
76
+ if (!block)
77
+ return tree[0];
78
+ if (block[4])
79
+ tree.shift();
80
+ else if (block[3])
81
+ tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});
82
+ else
83
+ tree[0][block[1]] = block[2];
84
+ return astish(val, tree);
85
+ };
86
+
70
87
  // src/calc.ts
71
88
  function isCssVar(value) {
72
89
  return isObject(value) && "ref" in value;
@@ -481,6 +498,7 @@ function unionType(values) {
481
498
  }
482
499
  // Annotate the CommonJS export names for ESM import in node:
483
500
  0 && (module.exports = {
501
+ astish,
484
502
  calc,
485
503
  capitalize,
486
504
  compact,
package/dist/index.mjs CHANGED
@@ -5,6 +5,22 @@ function isObject(value) {
5
5
  return typeof value === "object" && value != null && !Array.isArray(value);
6
6
  }
7
7
 
8
+ // src/astish.ts
9
+ var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
10
+ var ruleClean = /\/\*[^]*?\*\/|\s\s+|\n/g;
11
+ var astish = (val, tree = [{}]) => {
12
+ const block = newRule.exec(val.replace(ruleClean, ""));
13
+ if (!block)
14
+ return tree[0];
15
+ if (block[4])
16
+ tree.shift();
17
+ else if (block[3])
18
+ tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});
19
+ else
20
+ tree[0][block[1]] = block[2];
21
+ return astish(val, tree);
22
+ };
23
+
8
24
  // src/calc.ts
9
25
  function isCssVar(value) {
10
26
  return isObject(value) && "ref" in value;
@@ -418,6 +434,7 @@ function unionType(values) {
418
434
  return Array.from(values).map((value) => JSON.stringify(value)).join(" | ");
419
435
  }
420
436
  export {
437
+ astish,
421
438
  calc,
422
439
  capitalize,
423
440
  compact,
package/dist/shared.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, k as hypenateProperty, f as isBaseCondition, b as isObject, o as mapObject, m as mergeProps, s as splitProps, t as toHash, n as walkObject, j as withoutSpace } from './split-props-6820d5c1.js';
1
+ export { c as astish, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, l as hypenateProperty, g as isBaseCondition, b as isObject, p as mapObject, m as mergeProps, s as splitProps, t as toHash, o as walkObject, k as withoutSpace } from './split-props-3d8b55c4.js';
2
2
 
3
3
  declare function normalizeHTMLProps(props: Record<string, any>): {
4
4
  [k: string]: any;
package/dist/shared.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/shared.ts
21
21
  var shared_exports = {};
22
22
  __export(shared_exports, {
23
+ astish: () => astish,
23
24
  compact: () => compact,
24
25
  createCss: () => createCss,
25
26
  createMergeCss: () => createMergeCss,
@@ -42,6 +43,22 @@ function isObject(value) {
42
43
  return typeof value === "object" && value != null && !Array.isArray(value);
43
44
  }
44
45
 
46
+ // src/astish.ts
47
+ var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
48
+ var ruleClean = /\/\*[^]*?\*\/|\s\s+|\n/g;
49
+ var astish = (val, tree = [{}]) => {
50
+ const block = newRule.exec(val.replace(ruleClean, ""));
51
+ if (!block)
52
+ return tree[0];
53
+ if (block[4])
54
+ tree.shift();
55
+ else if (block[3])
56
+ tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});
57
+ else
58
+ tree[0][block[1]] = block[2];
59
+ return astish(val, tree);
60
+ };
61
+
45
62
  // src/compact.ts
46
63
  function compact(value) {
47
64
  return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
@@ -220,6 +237,29 @@ function createMergeCss(context) {
220
237
  return { mergeCss, assignCss };
221
238
  }
222
239
 
240
+ // src/memo.ts
241
+ var memo = (fn) => {
242
+ const cache = /* @__PURE__ */ new Map();
243
+ const get = (...args) => {
244
+ const key = JSON.stringify(args);
245
+ if (cache.has(key)) {
246
+ return cache.get(key);
247
+ }
248
+ const result = fn(...args);
249
+ cache.set(key, result);
250
+ return result;
251
+ };
252
+ return get;
253
+ };
254
+
255
+ // src/hypenate.ts
256
+ var dashCaseRegex = /[A-Z]/g;
257
+ var hypenateProperty = memo((property) => {
258
+ if (property.startsWith("--"))
259
+ return property;
260
+ return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
261
+ });
262
+
223
263
  // src/normalize-html.ts
224
264
  var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
225
265
  function convert(key) {
@@ -248,31 +288,9 @@ function splitProps(props, ...keys) {
248
288
  const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
249
289
  return keys.map(fn).concat(split(dKeys));
250
290
  }
251
-
252
- // src/memo.ts
253
- var memo = (fn) => {
254
- const cache = /* @__PURE__ */ new Map();
255
- const get = (...args) => {
256
- const key = JSON.stringify(args);
257
- if (cache.has(key)) {
258
- return cache.get(key);
259
- }
260
- const result = fn(...args);
261
- cache.set(key, result);
262
- return result;
263
- };
264
- return get;
265
- };
266
-
267
- // src/hypenate.ts
268
- var dashCaseRegex = /[A-Z]/g;
269
- var hypenateProperty = memo((property) => {
270
- if (property.startsWith("--"))
271
- return property;
272
- return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
273
- });
274
291
  // Annotate the CommonJS export names for ESM import in node:
275
292
  0 && (module.exports = {
293
+ astish,
276
294
  compact,
277
295
  createCss,
278
296
  createMergeCss,
package/dist/shared.mjs CHANGED
@@ -3,6 +3,22 @@ function isObject(value) {
3
3
  return typeof value === "object" && value != null && !Array.isArray(value);
4
4
  }
5
5
 
6
+ // src/astish.ts
7
+ var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
8
+ var ruleClean = /\/\*[^]*?\*\/|\s\s+|\n/g;
9
+ var astish = (val, tree = [{}]) => {
10
+ const block = newRule.exec(val.replace(ruleClean, ""));
11
+ if (!block)
12
+ return tree[0];
13
+ if (block[4])
14
+ tree.shift();
15
+ else if (block[3])
16
+ tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});
17
+ else
18
+ tree[0][block[1]] = block[2];
19
+ return astish(val, tree);
20
+ };
21
+
6
22
  // src/compact.ts
7
23
  function compact(value) {
8
24
  return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
@@ -181,6 +197,29 @@ function createMergeCss(context) {
181
197
  return { mergeCss, assignCss };
182
198
  }
183
199
 
200
+ // src/memo.ts
201
+ var memo = (fn) => {
202
+ const cache = /* @__PURE__ */ new Map();
203
+ const get = (...args) => {
204
+ const key = JSON.stringify(args);
205
+ if (cache.has(key)) {
206
+ return cache.get(key);
207
+ }
208
+ const result = fn(...args);
209
+ cache.set(key, result);
210
+ return result;
211
+ };
212
+ return get;
213
+ };
214
+
215
+ // src/hypenate.ts
216
+ var dashCaseRegex = /[A-Z]/g;
217
+ var hypenateProperty = memo((property) => {
218
+ if (property.startsWith("--"))
219
+ return property;
220
+ return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
221
+ });
222
+
184
223
  // src/normalize-html.ts
185
224
  var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
186
225
  function convert(key) {
@@ -209,30 +248,8 @@ function splitProps(props, ...keys) {
209
248
  const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
210
249
  return keys.map(fn).concat(split(dKeys));
211
250
  }
212
-
213
- // src/memo.ts
214
- var memo = (fn) => {
215
- const cache = /* @__PURE__ */ new Map();
216
- const get = (...args) => {
217
- const key = JSON.stringify(args);
218
- if (cache.has(key)) {
219
- return cache.get(key);
220
- }
221
- const result = fn(...args);
222
- cache.set(key, result);
223
- return result;
224
- };
225
- return get;
226
- };
227
-
228
- // src/hypenate.ts
229
- var dashCaseRegex = /[A-Z]/g;
230
- var hypenateProperty = memo((property) => {
231
- if (property.startsWith("--"))
232
- return property;
233
- return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
234
- });
235
251
  export {
252
+ astish,
236
253
  compact,
237
254
  createCss,
238
255
  createMergeCss,
@@ -3,6 +3,8 @@ type AnyFunction = (...args: any[]) => any;
3
3
  declare const isFunction: (v: any) => v is AnyFunction;
4
4
  declare function isObject(value: any): value is Record<string, any>;
5
5
 
6
+ declare const astish: (val: string, tree?: any[]) => Record<string, any>;
7
+
6
8
  type CreateCssContext = {
7
9
  hash?: boolean;
8
10
  /**
@@ -66,4 +68,4 @@ type PredicateFn = (key: string) => boolean;
66
68
  type Key = PredicateFn | string[];
67
69
  declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
68
70
 
69
- export { CreateCssContext as C, MappedObject as M, WalkObjectStopFn as W, isFunction as a, isObject as b, createCss as c, createMergeCss as d, compact as e, isBaseCondition as f, filterBaseConditions as g, isImportant as h, isString as i, withoutSpace as j, hypenateProperty as k, WalkObjectOptions as l, mergeProps as m, walkObject as n, mapObject as o, splitProps as s, toHash as t, withoutImportant as w };
71
+ export { CreateCssContext as C, MappedObject as M, WalkObjectStopFn as W, isFunction as a, isObject as b, astish as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, isImportant as j, withoutSpace as k, hypenateProperty as l, mergeProps as m, WalkObjectOptions as n, walkObject as o, mapObject as p, splitProps as s, toHash as t, withoutImportant as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.0.0-dev-20230623141647",
3
+ "version": "0.0.0-dev-20230625171447",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",