@pandacss/shared 0.0.0-dev-20230106112845 → 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.
- package/dist/{walk-styles-87886790.d.ts → hash-b98a6846.d.ts} +1 -4
- package/dist/index.d.ts +7 -3
- package/dist/index.js +36 -51
- package/dist/index.mjs +35 -50
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +14 -45
- package/dist/shared.mjs +14 -44
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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 './
|
|
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,
|
|
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;
|
|
@@ -46,6 +46,10 @@ declare function splitDotPath(path: string): string[];
|
|
|
46
46
|
declare function getNegativePath(path: string[]): string[];
|
|
47
47
|
declare function getDotPath(obj: any, path: string, fallback?: any): any;
|
|
48
48
|
|
|
49
|
+
type Dict = Record<string, unknown>;
|
|
50
|
+
type PickFn = (key: string) => boolean;
|
|
51
|
+
declare function splitObject(obj: Dict, pickFn: PickFn): Dict[];
|
|
52
|
+
|
|
49
53
|
type MapToRecord<K extends Map<string, any>> = {
|
|
50
54
|
[P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never;
|
|
51
55
|
};
|
|
@@ -53,4 +57,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
|
|
|
53
57
|
|
|
54
58
|
declare function unionType(values: IterableIterator<string> | string[]): string;
|
|
55
59
|
|
|
56
|
-
export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, isFunction, isObject, isString, mapToJson, memo, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
|
|
60
|
+
export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, isFunction, isObject, isString, mapToJson, memo, normalizeStyleObject, splitBy, splitDotPath, splitObject, toEm, toPx, toRem, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
normalizeStyleObject: () => normalizeStyleObject,
|
|
44
44
|
splitBy: () => splitBy,
|
|
45
45
|
splitDotPath: () => splitDotPath,
|
|
46
|
+
splitObject: () => splitObject,
|
|
46
47
|
toEm: () => toEm,
|
|
47
48
|
toHash: () => toHash,
|
|
48
49
|
toPx: () => toPx,
|
|
@@ -50,7 +51,6 @@ __export(src_exports, {
|
|
|
50
51
|
uncapitalize: () => uncapitalize,
|
|
51
52
|
unionType: () => unionType,
|
|
52
53
|
walkObject: () => walkObject,
|
|
53
|
-
walkStyles: () => walkStyles,
|
|
54
54
|
withoutImportant: () => withoutImportant,
|
|
55
55
|
withoutSpace: () => withoutSpace
|
|
56
56
|
});
|
|
@@ -87,6 +87,12 @@ var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
|
87
87
|
var dashCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
88
88
|
var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
|
|
89
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
|
+
|
|
90
96
|
// src/css-important.ts
|
|
91
97
|
function isImportant(value) {
|
|
92
98
|
return typeof value === "string" ? /!(important)?$/.test(value) : false;
|
|
@@ -98,12 +104,6 @@ function withoutSpace(str) {
|
|
|
98
104
|
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
99
105
|
}
|
|
100
106
|
|
|
101
|
-
// src/condition.ts
|
|
102
|
-
var isBaseCondition = (c) => /^(base|_)$/.test(c);
|
|
103
|
-
function filterBaseConditions(c) {
|
|
104
|
-
return c.slice().filter((v) => !isBaseCondition(v));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
107
|
// src/hash.ts
|
|
108
108
|
function toChar(code) {
|
|
109
109
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
@@ -151,30 +151,6 @@ function mapObject(obj, fn) {
|
|
|
151
151
|
return walkObject(obj, (value) => fn(value));
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// src/walk-styles.ts
|
|
155
|
-
function walkStyles(mixedStyles, fn, scopes = []) {
|
|
156
|
-
const {
|
|
157
|
-
selectors = {},
|
|
158
|
-
"@media": mediaQueries = {},
|
|
159
|
-
"@container": containerQueries = {},
|
|
160
|
-
"@supports": supportQueries = {},
|
|
161
|
-
...baseStyles
|
|
162
|
-
} = mixedStyles;
|
|
163
|
-
fn(baseStyles, scopes);
|
|
164
|
-
for (const [selector, selectorStyles] of Object.entries(selectors)) {
|
|
165
|
-
walkStyles(selectorStyles, fn, [...scopes, selector]);
|
|
166
|
-
}
|
|
167
|
-
for (const [mediaQuery, mediaQueryStyles] of Object.entries(mediaQueries)) {
|
|
168
|
-
walkStyles(mediaQueryStyles, fn, [...scopes, `@media ${mediaQuery}`]);
|
|
169
|
-
}
|
|
170
|
-
for (const [containerQuery, containerQueryStyles] of Object.entries(containerQueries)) {
|
|
171
|
-
walkStyles(containerQueryStyles, fn, [...scopes, `@container ${containerQuery}`]);
|
|
172
|
-
}
|
|
173
|
-
for (const [supportQuery, supportQueryStyles] of Object.entries(supportQueries)) {
|
|
174
|
-
walkStyles(supportQueryStyles, fn, [...scopes, `@supports ${supportQuery}`]);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
154
|
// src/normalize-style-object.ts
|
|
179
155
|
function toResponsiveObject(values, breakpoints) {
|
|
180
156
|
return values.reduce((acc, current, index) => {
|
|
@@ -214,25 +190,20 @@ function createCss(context) {
|
|
|
214
190
|
return (styleObject = {}) => {
|
|
215
191
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
216
192
|
const classNames = /* @__PURE__ */ new Set();
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
baseArray.unshift(`[${withoutSpace(scope.join("__"))}]`);
|
|
232
|
-
}
|
|
233
|
-
const className = hash ? toHash(baseArray.join(":")) : baseArray.join(":");
|
|
234
|
-
classNames.add(className);
|
|
235
|
-
});
|
|
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);
|
|
236
207
|
});
|
|
237
208
|
return Array.from(classNames).join(" ");
|
|
238
209
|
};
|
|
@@ -400,6 +371,20 @@ function getDotPath(obj, path, fallback) {
|
|
|
400
371
|
return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
|
|
401
372
|
}
|
|
402
373
|
|
|
374
|
+
// src/split-object.ts
|
|
375
|
+
function splitObject(obj, pickFn) {
|
|
376
|
+
const omitted = {};
|
|
377
|
+
const picked = {};
|
|
378
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
379
|
+
if (pickFn(key)) {
|
|
380
|
+
picked[key] = value;
|
|
381
|
+
} else {
|
|
382
|
+
omitted[key] = value;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return [picked, omitted];
|
|
386
|
+
}
|
|
387
|
+
|
|
403
388
|
// src/to-json.ts
|
|
404
389
|
function mapToJson(map) {
|
|
405
390
|
const obj = {};
|
|
@@ -442,6 +427,7 @@ function unionType(values) {
|
|
|
442
427
|
normalizeStyleObject,
|
|
443
428
|
splitBy,
|
|
444
429
|
splitDotPath,
|
|
430
|
+
splitObject,
|
|
445
431
|
toEm,
|
|
446
432
|
toHash,
|
|
447
433
|
toPx,
|
|
@@ -449,7 +435,6 @@ function unionType(values) {
|
|
|
449
435
|
uncapitalize,
|
|
450
436
|
unionType,
|
|
451
437
|
walkObject,
|
|
452
|
-
walkStyles,
|
|
453
438
|
withoutImportant,
|
|
454
439
|
withoutSpace
|
|
455
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
};
|
|
@@ -342,6 +313,20 @@ function getDotPath(obj, path, fallback) {
|
|
|
342
313
|
return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
|
|
343
314
|
}
|
|
344
315
|
|
|
316
|
+
// src/split-object.ts
|
|
317
|
+
function splitObject(obj, pickFn) {
|
|
318
|
+
const omitted = {};
|
|
319
|
+
const picked = {};
|
|
320
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
321
|
+
if (pickFn(key)) {
|
|
322
|
+
picked[key] = value;
|
|
323
|
+
} else {
|
|
324
|
+
omitted[key] = value;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return [picked, omitted];
|
|
328
|
+
}
|
|
329
|
+
|
|
345
330
|
// src/to-json.ts
|
|
346
331
|
function mapToJson(map) {
|
|
347
332
|
const obj = {};
|
|
@@ -383,6 +368,7 @@ export {
|
|
|
383
368
|
normalizeStyleObject,
|
|
384
369
|
splitBy,
|
|
385
370
|
splitDotPath,
|
|
371
|
+
splitObject,
|
|
386
372
|
toEm,
|
|
387
373
|
toHash,
|
|
388
374
|
toPx,
|
|
@@ -390,7 +376,6 @@ export {
|
|
|
390
376
|
uncapitalize,
|
|
391
377
|
unionType,
|
|
392
378
|
walkObject,
|
|
393
|
-
walkStyles,
|
|
394
379
|
withoutImportant,
|
|
395
380
|
withoutSpace
|
|
396
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,
|
|
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,7 +27,6 @@ __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);
|
|
@@ -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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
@@ -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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
};
|