@pandacss/shared 0.16.0 → 0.17.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
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-b874b673.js';
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, q as walkObject, w as withoutImportant, j as withoutSpace } from './shared-b874b673.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-6d968e1d.js';
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
5
  type Operand = string | number | {
@@ -20,15 +20,15 @@ declare function toPx(value?: string | number): string | undefined;
20
20
  declare function toEm(value?: string, fontSize?: number): string | undefined;
21
21
  declare function toRem(value?: string): string | undefined;
22
22
 
23
- type CssVar = {
23
+ interface CssVar {
24
24
  var: `--${string}`;
25
25
  ref: string;
26
- };
27
- type CssVarOptions = {
26
+ }
27
+ interface CssVarOptions {
28
28
  fallback?: string;
29
29
  prefix?: string;
30
30
  hash?: boolean;
31
- };
31
+ }
32
32
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
33
33
 
34
34
  declare const esc: (sel: string) => string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-b874b673.js';
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, q as walkObject, w as withoutImportant, j as withoutSpace } from './shared-b874b673.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-6d968e1d.js';
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
5
  type Operand = string | number | {
@@ -20,15 +20,15 @@ declare function toPx(value?: string | number): string | undefined;
20
20
  declare function toEm(value?: string, fontSize?: number): string | undefined;
21
21
  declare function toRem(value?: string): string | undefined;
22
22
 
23
- type CssVar = {
23
+ interface CssVar {
24
24
  var: `--${string}`;
25
25
  ref: string;
26
- };
27
- type CssVarOptions = {
26
+ }
27
+ interface CssVarOptions {
28
28
  fallback?: string;
29
29
  prefix?: string;
30
30
  hash?: boolean;
31
- };
31
+ }
32
32
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
33
33
 
34
34
  declare const esc: (sel: string) => string;
package/dist/index.js CHANGED
@@ -59,6 +59,7 @@ __export(src_exports, {
59
59
  toRem: () => toRem,
60
60
  uncapitalize: () => uncapitalize,
61
61
  unionType: () => unionType,
62
+ uniq: () => uniq,
62
63
  walkObject: () => walkObject,
63
64
  withoutImportant: () => withoutImportant,
64
65
  withoutSpace: () => withoutSpace
@@ -186,17 +187,19 @@ function toHash(value) {
186
187
 
187
188
  // src/merge-props.ts
188
189
  function mergeProps(...sources) {
189
- const result = {};
190
- for (const source of sources) {
191
- for (const [key, value] of Object.entries(source)) {
192
- if (isObject(value)) {
193
- result[key] = mergeProps(result[key] || {}, value);
190
+ const objects = sources.filter(Boolean);
191
+ return objects.reduce((prev, obj) => {
192
+ Object.keys(obj).forEach((key) => {
193
+ const prevValue = prev[key];
194
+ const value = obj[key];
195
+ if (isObject(prevValue) && isObject(value)) {
196
+ prev[key] = mergeProps(prevValue, value);
194
197
  } else {
195
- result[key] = value;
198
+ prev[key] = value;
196
199
  }
197
- }
198
- }
199
- return result;
200
+ });
201
+ return prev;
202
+ }, {});
200
203
  }
201
204
 
202
205
  // src/walk-object.ts
@@ -554,6 +557,9 @@ function mapToJson(map) {
554
557
  function unionType(values) {
555
558
  return Array.from(values).map((value) => JSON.stringify(value)).join(" | ");
556
559
  }
560
+
561
+ // src/uniq.ts
562
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
557
563
  // Annotate the CommonJS export names for ESM import in node:
558
564
  0 && (module.exports = {
559
565
  astish,
@@ -595,6 +601,7 @@ function unionType(values) {
595
601
  toRem,
596
602
  uncapitalize,
597
603
  unionType,
604
+ uniq,
598
605
  walkObject,
599
606
  withoutImportant,
600
607
  withoutSpace
package/dist/index.mjs CHANGED
@@ -119,17 +119,19 @@ function toHash(value) {
119
119
 
120
120
  // src/merge-props.ts
121
121
  function mergeProps(...sources) {
122
- const result = {};
123
- for (const source of sources) {
124
- for (const [key, value] of Object.entries(source)) {
125
- if (isObject(value)) {
126
- result[key] = mergeProps(result[key] || {}, value);
122
+ const objects = sources.filter(Boolean);
123
+ return objects.reduce((prev, obj) => {
124
+ Object.keys(obj).forEach((key) => {
125
+ const prevValue = prev[key];
126
+ const value = obj[key];
127
+ if (isObject(prevValue) && isObject(value)) {
128
+ prev[key] = mergeProps(prevValue, value);
127
129
  } else {
128
- result[key] = value;
130
+ prev[key] = value;
129
131
  }
130
- }
131
- }
132
- return result;
132
+ });
133
+ return prev;
134
+ }, {});
133
135
  }
134
136
 
135
137
  // src/walk-object.ts
@@ -487,6 +489,9 @@ function mapToJson(map) {
487
489
  function unionType(values) {
488
490
  return Array.from(values).map((value) => JSON.stringify(value)).join(" | ");
489
491
  }
492
+
493
+ // src/uniq.ts
494
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
490
495
  export {
491
496
  astish,
492
497
  calc,
@@ -527,6 +532,7 @@ export {
527
532
  toRem,
528
533
  uncapitalize,
529
534
  unionType,
535
+ uniq,
530
536
  walkObject,
531
537
  withoutImportant,
532
538
  withoutSpace
@@ -3,7 +3,7 @@ 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
- type CreateCssContext = {
6
+ interface CreateCssContext {
7
7
  hash?: boolean;
8
8
  /**
9
9
  * Partial properties from the Utility class
@@ -26,9 +26,11 @@ type CreateCssContext = {
26
26
  shift: (paths: string[]) => string[];
27
27
  finalize: (paths: string[]) => string[];
28
28
  };
29
- };
29
+ }
30
30
  declare function createCss(context: CreateCssContext): (styleObject?: Record<string, any>) => string;
31
- type StyleObject = Record<string, any>;
31
+ interface StyleObject {
32
+ [key: string]: any;
33
+ }
32
34
  declare function createMergeCss(context: CreateCssContext): {
33
35
  mergeCss: (...styles: StyleObject[]) => StyleObject;
34
36
  assignCss: (...styles: StyleObject[]) => any;
@@ -48,10 +50,10 @@ type MappedObject<T, K> = {
48
50
  [Prop in keyof T]: T[Prop] extends Array<any> ? MappedObject<T[Prop][number], K>[] : T[Prop] extends Record<string, unknown> ? MappedObject<T[Prop], K> : K;
49
51
  };
50
52
  type WalkObjectStopFn = (value: any, path: string[]) => boolean;
51
- type WalkObjectOptions = {
53
+ interface WalkObjectOptions {
52
54
  stop?: WalkObjectStopFn;
53
55
  getKey?(prop: string): string;
54
- };
56
+ }
55
57
  declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
56
58
  declare function mapObject(obj: any, fn: (value: any) => any): any;
57
59
 
@@ -75,4 +77,6 @@ type PredicateFn = (key: string) => boolean;
75
77
  type Key = PredicateFn | string[];
76
78
  declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
77
79
 
78
- 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, mergeProps as l, memo as m, getSlotRecipes as n, getSlotCompoundVariant as o, WalkObjectOptions as p, walkObject as q, mapObject as r, splitProps as s, toHash as t, withoutImportant as w };
80
+ declare const uniq: <T>(...items: T[][]) => T[];
81
+
82
+ 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, mergeProps as l, memo as m, getSlotRecipes as n, getSlotCompoundVariant as o, WalkObjectOptions as p, walkObject as q, mapObject as r, splitProps as s, toHash as t, uniq as u, withoutImportant as w };
package/dist/shared.d.mts CHANGED
@@ -1 +1 @@
1
- export { e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, b as isObject, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, q as walkObject, j as withoutSpace } from './shared-b874b673.js';
1
+ export { e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, b as isObject, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, u as uniq, q as walkObject, j as withoutSpace } from './shared-6d968e1d.js';
package/dist/shared.d.ts CHANGED
@@ -1 +1 @@
1
- export { e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, b as isObject, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, q as walkObject, j as withoutSpace } from './shared-b874b673.js';
1
+ export { e as compact, c as createCss, d as createMergeCss, g as filterBaseConditions, o as getSlotCompoundVariant, n as getSlotRecipes, k as hypenateProperty, f as isBaseCondition, b as isObject, r as mapObject, m as memo, l as mergeProps, s as splitProps, t as toHash, u as uniq, q as walkObject, j as withoutSpace } from './shared-6d968e1d.js';
package/dist/shared.js CHANGED
@@ -34,6 +34,7 @@ __export(shared_exports, {
34
34
  mergeProps: () => mergeProps,
35
35
  splitProps: () => splitProps,
36
36
  toHash: () => toHash,
37
+ uniq: () => uniq,
37
38
  walkObject: () => walkObject,
38
39
  withoutSpace: () => withoutSpace
39
40
  });
@@ -90,17 +91,19 @@ function toHash(value) {
90
91
 
91
92
  // src/merge-props.ts
92
93
  function mergeProps(...sources) {
93
- const result = {};
94
- for (const source of sources) {
95
- for (const [key, value] of Object.entries(source)) {
96
- if (isObject(value)) {
97
- result[key] = mergeProps(result[key] || {}, value);
94
+ const objects = sources.filter(Boolean);
95
+ return objects.reduce((prev, obj) => {
96
+ Object.keys(obj).forEach((key) => {
97
+ const prevValue = prev[key];
98
+ const value = obj[key];
99
+ if (isObject(prevValue) && isObject(value)) {
100
+ prev[key] = mergeProps(prevValue, value);
98
101
  } else {
99
- result[key] = value;
102
+ prev[key] = value;
100
103
  }
101
- }
102
- }
103
- return result;
104
+ });
105
+ return prev;
106
+ }, {});
104
107
  }
105
108
 
106
109
  // src/walk-object.ts
@@ -291,6 +294,9 @@ function splitProps(props, ...keys) {
291
294
  const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
292
295
  return keys.map(fn).concat(split(dKeys));
293
296
  }
297
+
298
+ // src/uniq.ts
299
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
294
300
  // Annotate the CommonJS export names for ESM import in node:
295
301
  0 && (module.exports = {
296
302
  compact,
@@ -307,6 +313,7 @@ function splitProps(props, ...keys) {
307
313
  mergeProps,
308
314
  splitProps,
309
315
  toHash,
316
+ uniq,
310
317
  walkObject,
311
318
  withoutSpace
312
319
  });
package/dist/shared.mjs CHANGED
@@ -49,17 +49,19 @@ function toHash(value) {
49
49
 
50
50
  // src/merge-props.ts
51
51
  function mergeProps(...sources) {
52
- const result = {};
53
- for (const source of sources) {
54
- for (const [key, value] of Object.entries(source)) {
55
- if (isObject(value)) {
56
- result[key] = mergeProps(result[key] || {}, value);
52
+ const objects = sources.filter(Boolean);
53
+ return objects.reduce((prev, obj) => {
54
+ Object.keys(obj).forEach((key) => {
55
+ const prevValue = prev[key];
56
+ const value = obj[key];
57
+ if (isObject(prevValue) && isObject(value)) {
58
+ prev[key] = mergeProps(prevValue, value);
57
59
  } else {
58
- result[key] = value;
60
+ prev[key] = value;
59
61
  }
60
- }
61
- }
62
- return result;
62
+ });
63
+ return prev;
64
+ }, {});
63
65
  }
64
66
 
65
67
  // src/walk-object.ts
@@ -250,6 +252,9 @@ function splitProps(props, ...keys) {
250
252
  const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
251
253
  return keys.map(fn).concat(split(dKeys));
252
254
  }
255
+
256
+ // src/uniq.ts
257
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
253
258
  export {
254
259
  compact,
255
260
  createCss,
@@ -265,6 +270,7 @@ export {
265
270
  mergeProps,
266
271
  splitProps,
267
272
  toHash,
273
+ uniq,
268
274
  walkObject,
269
275
  withoutSpace
270
276
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -10,12 +10,24 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
+ "exports": {
14
+ ".": {
15
+ "source": "./src/index.ts",
16
+ "types": "./dist/index.d.ts",
17
+ "require": "./dist/index.js",
18
+ "import": {
19
+ "types": "./dist/index.d.mts",
20
+ "default": "./dist/index.mjs"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
13
25
  "files": [
14
26
  "dist"
15
27
  ],
16
28
  "scripts": {
17
- "build": "tsup --dts",
29
+ "build": "tsup --dts && tsx scripts/postbuild.ts",
18
30
  "build-fast": "tsup --no-dts",
19
- "dev": "pnpm build-fast --watch"
31
+ "dev": "tsup --no-dts --watch --onSuccess=\"tsx scripts/postbuild.ts\""
20
32
  }
21
33
  }