@pandacss/shared 0.0.0-dev-20230106183338 → 0.0.0-dev-20230106195931

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.
@@ -46,7 +46,4 @@ declare function mapObject(obj: any, fn: (value: any) => any): any;
46
46
 
47
47
  declare function toHash(value: string): string;
48
48
 
49
- type Dict = Record<string, any>;
50
- declare function walkStyles(mixedStyles: Dict, fn: (style: Dict, scope?: string[]) => void, scopes?: string[]): void;
51
-
52
- export { CreateCssContext as C, MappedObject as M, WalkObjectStopFn as W, compact as a, isImportant as b, createCss as c, withoutSpace as d, WalkObjectOptions as e, filterBaseConditions as f, walkObject as g, walkStyles as h, isBaseCondition as i, mapObject as m, toHash as t, withoutImportant as w };
49
+ export { CreateCssContext as C, MappedObject as M, WalkObjectStopFn as W, compact as a, isImportant as b, createCss as c, withoutSpace as d, WalkObjectOptions as e, filterBaseConditions as f, walkObject as g, isBaseCondition as i, mapObject as m, toHash as t, withoutImportant as w };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './walk-styles-87886790.js';
2
- export { C as CreateCssContext, M as MappedObject, e as WalkObjectOptions, W as WalkObjectStopFn, a as compact, c as createCss, f as filterBaseConditions, i as isBaseCondition, b as isImportant, m as mapObject, t as toHash, g as walkObject, h as walkStyles, w as withoutImportant, d as withoutSpace } from './walk-styles-87886790.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './hash-b98a6846.js';
2
+ export { C as CreateCssContext, M as MappedObject, e as WalkObjectOptions, W as WalkObjectStopFn, a as compact, c as createCss, f as filterBaseConditions, i as isBaseCondition, b as isImportant, m as mapObject, t as toHash, g as walkObject, w as withoutImportant, d as withoutSpace } from './hash-b98a6846.js';
3
3
 
4
4
  declare const isString: (v: any) => v is string;
5
5
  type AnyFunction = (...args: any[]) => any;
package/dist/index.js CHANGED
@@ -51,7 +51,6 @@ __export(src_exports, {
51
51
  uncapitalize: () => uncapitalize,
52
52
  unionType: () => unionType,
53
53
  walkObject: () => walkObject,
54
- walkStyles: () => walkStyles,
55
54
  withoutImportant: () => withoutImportant,
56
55
  withoutSpace: () => withoutSpace
57
56
  });
@@ -88,6 +87,12 @@ var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
88
87
  var dashCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
89
88
  var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
90
89
 
90
+ // src/condition.ts
91
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
92
+ function filterBaseConditions(c) {
93
+ return c.slice().filter((v) => !isBaseCondition(v));
94
+ }
95
+
91
96
  // src/css-important.ts
92
97
  function isImportant(value) {
93
98
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -99,12 +104,6 @@ function withoutSpace(str) {
99
104
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
100
105
  }
101
106
 
102
- // src/condition.ts
103
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
104
- function filterBaseConditions(c) {
105
- return c.slice().filter((v) => !isBaseCondition(v));
106
- }
107
-
108
107
  // src/hash.ts
109
108
  function toChar(code) {
110
109
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
@@ -152,30 +151,6 @@ function mapObject(obj, fn) {
152
151
  return walkObject(obj, (value) => fn(value));
153
152
  }
154
153
 
155
- // src/walk-styles.ts
156
- function walkStyles(mixedStyles, fn, scopes = []) {
157
- const {
158
- selectors = {},
159
- "@media": mediaQueries = {},
160
- "@container": containerQueries = {},
161
- "@supports": supportQueries = {},
162
- ...baseStyles
163
- } = mixedStyles;
164
- fn(baseStyles, scopes);
165
- for (const [selector, selectorStyles] of Object.entries(selectors)) {
166
- walkStyles(selectorStyles, fn, [...scopes, selector]);
167
- }
168
- for (const [mediaQuery, mediaQueryStyles] of Object.entries(mediaQueries)) {
169
- walkStyles(mediaQueryStyles, fn, [...scopes, `@media ${mediaQuery}`]);
170
- }
171
- for (const [containerQuery, containerQueryStyles] of Object.entries(containerQueries)) {
172
- walkStyles(containerQueryStyles, fn, [...scopes, `@container ${containerQuery}`]);
173
- }
174
- for (const [supportQuery, supportQueryStyles] of Object.entries(supportQueries)) {
175
- walkStyles(supportQueryStyles, fn, [...scopes, `@supports ${supportQuery}`]);
176
- }
177
- }
178
-
179
154
  // src/normalize-style-object.ts
180
155
  function toResponsiveObject(values, breakpoints) {
181
156
  return values.reduce((acc, current, index) => {
@@ -215,25 +190,20 @@ function createCss(context) {
215
190
  return (styleObject = {}) => {
216
191
  const normalizedObject = normalizeStyleObject(styleObject, context);
217
192
  const classNames = /* @__PURE__ */ new Set();
218
- walkStyles(normalizedObject, (props, scope) => {
219
- walkObject(props, (value, paths) => {
220
- const important = isImportant(value);
221
- if (value == null)
222
- return;
223
- const [prop, ...allConditions] = conds.shift(paths);
224
- const conditions = filterBaseConditions(allConditions);
225
- const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
226
- let transformedClassName = transformed.className;
227
- if (important) {
228
- transformedClassName = `${transformedClassName}!`;
229
- }
230
- const baseArray = [...conds.finalize(conditions), transformedClassName];
231
- if (scope && scope.length > 0) {
232
- baseArray.unshift(`[${withoutSpace(scope.join("__"))}]`);
233
- }
234
- const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
235
- classNames.add(className);
236
- });
193
+ walkObject(normalizedObject, (value, paths) => {
194
+ const important = isImportant(value);
195
+ if (value == null)
196
+ return;
197
+ const [prop, ...allConditions] = conds.shift(paths);
198
+ const conditions = filterBaseConditions(allConditions);
199
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
200
+ let transformedClassName = transformed.className;
201
+ if (important) {
202
+ transformedClassName = `${transformedClassName}!`;
203
+ }
204
+ const baseArray = [...conds.finalize(conditions), transformedClassName];
205
+ const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
206
+ classNames.add(className);
237
207
  });
238
208
  return Array.from(classNames).join(" ");
239
209
  };
@@ -465,7 +435,6 @@ function unionType(values) {
465
435
  uncapitalize,
466
436
  unionType,
467
437
  walkObject,
468
- walkStyles,
469
438
  withoutImportant,
470
439
  withoutSpace
471
440
  });
package/dist/index.mjs CHANGED
@@ -29,6 +29,12 @@ var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
29
29
  var dashCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
30
30
  var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
31
31
 
32
+ // src/condition.ts
33
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
34
+ function filterBaseConditions(c) {
35
+ return c.slice().filter((v) => !isBaseCondition(v));
36
+ }
37
+
32
38
  // src/css-important.ts
33
39
  function isImportant(value) {
34
40
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -40,12 +46,6 @@ function withoutSpace(str) {
40
46
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
41
47
  }
42
48
 
43
- // src/condition.ts
44
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
45
- function filterBaseConditions(c) {
46
- return c.slice().filter((v) => !isBaseCondition(v));
47
- }
48
-
49
49
  // src/hash.ts
50
50
  function toChar(code) {
51
51
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
@@ -93,30 +93,6 @@ function mapObject(obj, fn) {
93
93
  return walkObject(obj, (value) => fn(value));
94
94
  }
95
95
 
96
- // src/walk-styles.ts
97
- function walkStyles(mixedStyles, fn, scopes = []) {
98
- const {
99
- selectors = {},
100
- "@media": mediaQueries = {},
101
- "@container": containerQueries = {},
102
- "@supports": supportQueries = {},
103
- ...baseStyles
104
- } = mixedStyles;
105
- fn(baseStyles, scopes);
106
- for (const [selector, selectorStyles] of Object.entries(selectors)) {
107
- walkStyles(selectorStyles, fn, [...scopes, selector]);
108
- }
109
- for (const [mediaQuery, mediaQueryStyles] of Object.entries(mediaQueries)) {
110
- walkStyles(mediaQueryStyles, fn, [...scopes, `@media ${mediaQuery}`]);
111
- }
112
- for (const [containerQuery, containerQueryStyles] of Object.entries(containerQueries)) {
113
- walkStyles(containerQueryStyles, fn, [...scopes, `@container ${containerQuery}`]);
114
- }
115
- for (const [supportQuery, supportQueryStyles] of Object.entries(supportQueries)) {
116
- walkStyles(supportQueryStyles, fn, [...scopes, `@supports ${supportQuery}`]);
117
- }
118
- }
119
-
120
96
  // src/normalize-style-object.ts
121
97
  function toResponsiveObject(values, breakpoints) {
122
98
  return values.reduce((acc, current, index) => {
@@ -156,25 +132,20 @@ function createCss(context) {
156
132
  return (styleObject = {}) => {
157
133
  const normalizedObject = normalizeStyleObject(styleObject, context);
158
134
  const classNames = /* @__PURE__ */ new Set();
159
- walkStyles(normalizedObject, (props, scope) => {
160
- walkObject(props, (value, paths) => {
161
- const important = isImportant(value);
162
- if (value == null)
163
- return;
164
- const [prop, ...allConditions] = conds.shift(paths);
165
- const conditions = filterBaseConditions(allConditions);
166
- const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
167
- let transformedClassName = transformed.className;
168
- if (important) {
169
- transformedClassName = `${transformedClassName}!`;
170
- }
171
- const baseArray = [...conds.finalize(conditions), transformedClassName];
172
- if (scope && scope.length > 0) {
173
- baseArray.unshift(`[${withoutSpace(scope.join("__"))}]`);
174
- }
175
- const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
176
- classNames.add(className);
177
- });
135
+ walkObject(normalizedObject, (value, paths) => {
136
+ const important = isImportant(value);
137
+ if (value == null)
138
+ return;
139
+ const [prop, ...allConditions] = conds.shift(paths);
140
+ const conditions = filterBaseConditions(allConditions);
141
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
142
+ let transformedClassName = transformed.className;
143
+ if (important) {
144
+ transformedClassName = `${transformedClassName}!`;
145
+ }
146
+ const baseArray = [...conds.finalize(conditions), transformedClassName];
147
+ const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
148
+ classNames.add(className);
178
149
  });
179
150
  return Array.from(classNames).join(" ");
180
151
  };
@@ -405,7 +376,6 @@ export {
405
376
  uncapitalize,
406
377
  unionType,
407
378
  walkObject,
408
- walkStyles,
409
379
  withoutImportant,
410
380
  withoutSpace
411
381
  };
package/dist/shared.d.ts CHANGED
@@ -1 +1 @@
1
- export { C as CreateCssContext, M as MappedObject, e as WalkObjectOptions, W as WalkObjectStopFn, a as compact, c as createCss, f as filterBaseConditions, i as isBaseCondition, m as mapObject, t as toHash, g as walkObject, h as walkStyles, d as withoutSpace } from './walk-styles-87886790.js';
1
+ export { C as CreateCssContext, M as MappedObject, e as WalkObjectOptions, W as WalkObjectStopFn, a as compact, c as createCss, f as filterBaseConditions, i as isBaseCondition, m as mapObject, t as toHash, g as walkObject, d as withoutSpace } from './hash-b98a6846.js';
package/dist/shared.js CHANGED
@@ -27,11 +27,16 @@ __export(shared_exports, {
27
27
  mapObject: () => mapObject,
28
28
  toHash: () => toHash,
29
29
  walkObject: () => walkObject,
30
- walkStyles: () => walkStyles,
31
30
  withoutSpace: () => withoutSpace
32
31
  });
33
32
  module.exports = __toCommonJS(shared_exports);
34
33
 
34
+ // src/condition.ts
35
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
36
+ function filterBaseConditions(c) {
37
+ return c.slice().filter((v) => !isBaseCondition(v));
38
+ }
39
+
35
40
  // src/css-important.ts
36
41
  function isImportant(value) {
37
42
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -43,12 +48,6 @@ function withoutSpace(str) {
43
48
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
44
49
  }
45
50
 
46
- // src/condition.ts
47
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
48
- function filterBaseConditions(c) {
49
- return c.slice().filter((v) => !isBaseCondition(v));
50
- }
51
-
52
51
  // src/hash.ts
53
52
  function toChar(code) {
54
53
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
@@ -101,30 +100,6 @@ function mapObject(obj, fn) {
101
100
  return walkObject(obj, (value) => fn(value));
102
101
  }
103
102
 
104
- // src/walk-styles.ts
105
- function walkStyles(mixedStyles, fn, scopes = []) {
106
- const {
107
- selectors = {},
108
- "@media": mediaQueries = {},
109
- "@container": containerQueries = {},
110
- "@supports": supportQueries = {},
111
- ...baseStyles
112
- } = mixedStyles;
113
- fn(baseStyles, scopes);
114
- for (const [selector, selectorStyles] of Object.entries(selectors)) {
115
- walkStyles(selectorStyles, fn, [...scopes, selector]);
116
- }
117
- for (const [mediaQuery, mediaQueryStyles] of Object.entries(mediaQueries)) {
118
- walkStyles(mediaQueryStyles, fn, [...scopes, `@media ${mediaQuery}`]);
119
- }
120
- for (const [containerQuery, containerQueryStyles] of Object.entries(containerQueries)) {
121
- walkStyles(containerQueryStyles, fn, [...scopes, `@container ${containerQuery}`]);
122
- }
123
- for (const [supportQuery, supportQueryStyles] of Object.entries(supportQueries)) {
124
- walkStyles(supportQueryStyles, fn, [...scopes, `@supports ${supportQuery}`]);
125
- }
126
- }
127
-
128
103
  // src/normalize-style-object.ts
129
104
  function toResponsiveObject(values, breakpoints) {
130
105
  return values.reduce((acc, current, index) => {
@@ -164,25 +139,20 @@ function createCss(context) {
164
139
  return (styleObject = {}) => {
165
140
  const normalizedObject = normalizeStyleObject(styleObject, context);
166
141
  const classNames = /* @__PURE__ */ new Set();
167
- walkStyles(normalizedObject, (props, scope) => {
168
- walkObject(props, (value, paths) => {
169
- const important = isImportant(value);
170
- if (value == null)
171
- return;
172
- const [prop, ...allConditions] = conds.shift(paths);
173
- const conditions = filterBaseConditions(allConditions);
174
- const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
175
- let transformedClassName = transformed.className;
176
- if (important) {
177
- transformedClassName = `${transformedClassName}!`;
178
- }
179
- const baseArray = [...conds.finalize(conditions), transformedClassName];
180
- if (scope && scope.length > 0) {
181
- baseArray.unshift(`[${withoutSpace(scope.join("__"))}]`);
182
- }
183
- const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
184
- classNames.add(className);
185
- });
142
+ walkObject(normalizedObject, (value, paths) => {
143
+ const important = isImportant(value);
144
+ if (value == null)
145
+ return;
146
+ const [prop, ...allConditions] = conds.shift(paths);
147
+ const conditions = filterBaseConditions(allConditions);
148
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
149
+ let transformedClassName = transformed.className;
150
+ if (important) {
151
+ transformedClassName = `${transformedClassName}!`;
152
+ }
153
+ const baseArray = [...conds.finalize(conditions), transformedClassName];
154
+ const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
155
+ classNames.add(className);
186
156
  });
187
157
  return Array.from(classNames).join(" ");
188
158
  };
@@ -201,6 +171,5 @@ function compact(value) {
201
171
  mapObject,
202
172
  toHash,
203
173
  walkObject,
204
- walkStyles,
205
174
  withoutSpace
206
175
  });
package/dist/shared.mjs CHANGED
@@ -1,3 +1,9 @@
1
+ // src/condition.ts
2
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
3
+ function filterBaseConditions(c) {
4
+ return c.slice().filter((v) => !isBaseCondition(v));
5
+ }
6
+
1
7
  // src/css-important.ts
2
8
  function isImportant(value) {
3
9
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -9,12 +15,6 @@ function withoutSpace(str) {
9
15
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
10
16
  }
11
17
 
12
- // src/condition.ts
13
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
14
- function filterBaseConditions(c) {
15
- return c.slice().filter((v) => !isBaseCondition(v));
16
- }
17
-
18
18
  // src/hash.ts
19
19
  function toChar(code) {
20
20
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
@@ -67,30 +67,6 @@ function mapObject(obj, fn) {
67
67
  return walkObject(obj, (value) => fn(value));
68
68
  }
69
69
 
70
- // src/walk-styles.ts
71
- function walkStyles(mixedStyles, fn, scopes = []) {
72
- const {
73
- selectors = {},
74
- "@media": mediaQueries = {},
75
- "@container": containerQueries = {},
76
- "@supports": supportQueries = {},
77
- ...baseStyles
78
- } = mixedStyles;
79
- fn(baseStyles, scopes);
80
- for (const [selector, selectorStyles] of Object.entries(selectors)) {
81
- walkStyles(selectorStyles, fn, [...scopes, selector]);
82
- }
83
- for (const [mediaQuery, mediaQueryStyles] of Object.entries(mediaQueries)) {
84
- walkStyles(mediaQueryStyles, fn, [...scopes, `@media ${mediaQuery}`]);
85
- }
86
- for (const [containerQuery, containerQueryStyles] of Object.entries(containerQueries)) {
87
- walkStyles(containerQueryStyles, fn, [...scopes, `@container ${containerQuery}`]);
88
- }
89
- for (const [supportQuery, supportQueryStyles] of Object.entries(supportQueries)) {
90
- walkStyles(supportQueryStyles, fn, [...scopes, `@supports ${supportQuery}`]);
91
- }
92
- }
93
-
94
70
  // src/normalize-style-object.ts
95
71
  function toResponsiveObject(values, breakpoints) {
96
72
  return values.reduce((acc, current, index) => {
@@ -130,25 +106,20 @@ function createCss(context) {
130
106
  return (styleObject = {}) => {
131
107
  const normalizedObject = normalizeStyleObject(styleObject, context);
132
108
  const classNames = /* @__PURE__ */ new Set();
133
- walkStyles(normalizedObject, (props, scope) => {
134
- walkObject(props, (value, paths) => {
135
- const important = isImportant(value);
136
- if (value == null)
137
- return;
138
- const [prop, ...allConditions] = conds.shift(paths);
139
- const conditions = filterBaseConditions(allConditions);
140
- const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
141
- let transformedClassName = transformed.className;
142
- if (important) {
143
- transformedClassName = `${transformedClassName}!`;
144
- }
145
- const baseArray = [...conds.finalize(conditions), transformedClassName];
146
- if (scope && scope.length > 0) {
147
- baseArray.unshift(`[${withoutSpace(scope.join("__"))}]`);
148
- }
149
- const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
150
- classNames.add(className);
151
- });
109
+ walkObject(normalizedObject, (value, paths) => {
110
+ const important = isImportant(value);
111
+ if (value == null)
112
+ return;
113
+ const [prop, ...allConditions] = conds.shift(paths);
114
+ const conditions = filterBaseConditions(allConditions);
115
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
116
+ let transformedClassName = transformed.className;
117
+ if (important) {
118
+ transformedClassName = `${transformedClassName}!`;
119
+ }
120
+ const baseArray = [...conds.finalize(conditions), transformedClassName];
121
+ const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
122
+ classNames.add(className);
152
123
  });
153
124
  return Array.from(classNames).join(" ");
154
125
  };
@@ -166,6 +137,5 @@ export {
166
137
  mapObject,
167
138
  toHash,
168
139
  walkObject,
169
- walkStyles,
170
140
  withoutSpace
171
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.0.0-dev-20230106183338",
3
+ "version": "0.0.0-dev-20230106195931",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",