@pandacss/shared 0.17.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-e7d6e947.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-e7d6e947.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-e7d6e947.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-e7d6e947.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
@@ -187,18 +187,19 @@ function toHash(value) {
187
187
 
188
188
  // src/merge-props.ts
189
189
  function mergeProps(...sources) {
190
- const __sources = sources.filter(Boolean);
191
- const result = {};
192
- for (const source of __sources) {
193
- for (const [key, value] of Object.entries(source)) {
194
- if (isObject(value)) {
195
- 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);
196
197
  } else {
197
- result[key] = value;
198
+ prev[key] = value;
198
199
  }
199
- }
200
- }
201
- return result;
200
+ });
201
+ return prev;
202
+ }, {});
202
203
  }
203
204
 
204
205
  // src/walk-object.ts
package/dist/index.mjs CHANGED
@@ -119,18 +119,19 @@ function toHash(value) {
119
119
 
120
120
  // src/merge-props.ts
121
121
  function mergeProps(...sources) {
122
- const __sources = sources.filter(Boolean);
123
- const result = {};
124
- for (const source of __sources) {
125
- for (const [key, value] of Object.entries(source)) {
126
- if (isObject(value)) {
127
- 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);
128
129
  } else {
129
- result[key] = value;
130
+ prev[key] = value;
130
131
  }
131
- }
132
- }
133
- return result;
132
+ });
133
+ return prev;
134
+ }, {});
134
135
  }
135
136
 
136
137
  // src/walk-object.ts
@@ -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
 
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, u as uniq, q as walkObject, j as withoutSpace } from './shared-e7d6e947.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, u as uniq, q as walkObject, j as withoutSpace } from './shared-e7d6e947.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
@@ -91,18 +91,19 @@ function toHash(value) {
91
91
 
92
92
  // src/merge-props.ts
93
93
  function mergeProps(...sources) {
94
- const __sources = sources.filter(Boolean);
95
- const result = {};
96
- for (const source of __sources) {
97
- for (const [key, value] of Object.entries(source)) {
98
- if (isObject(value)) {
99
- 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);
100
101
  } else {
101
- result[key] = value;
102
+ prev[key] = value;
102
103
  }
103
- }
104
- }
105
- return result;
104
+ });
105
+ return prev;
106
+ }, {});
106
107
  }
107
108
 
108
109
  // src/walk-object.ts
package/dist/shared.mjs CHANGED
@@ -49,18 +49,19 @@ function toHash(value) {
49
49
 
50
50
  // src/merge-props.ts
51
51
  function mergeProps(...sources) {
52
- const __sources = sources.filter(Boolean);
53
- const result = {};
54
- for (const source of __sources) {
55
- for (const [key, value] of Object.entries(source)) {
56
- if (isObject(value)) {
57
- 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);
58
59
  } else {
59
- result[key] = value;
60
+ prev[key] = value;
60
61
  }
61
- }
62
- }
63
- return result;
62
+ });
63
+ return prev;
64
+ }, {});
64
65
  }
65
66
 
66
67
  // src/walk-object.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.17.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
  }