@pandacss/shared 0.26.1 → 0.27.0
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +31 -4
- package/dist/index.mjs +30 -4
- package/dist/shared.js +19 -19
- package/dist/shared.mjs +19 -19
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -33,6 +33,9 @@ interface CssVarOptions {
|
|
|
33
33
|
}
|
|
34
34
|
declare function cssVar(name: string, options?: CssVarOptions): CssVar;
|
|
35
35
|
|
|
36
|
+
type Dict = Record<string, any>;
|
|
37
|
+
declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
|
|
38
|
+
|
|
36
39
|
declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
|
|
37
40
|
[key in A]: B;
|
|
38
41
|
};
|
|
@@ -87,4 +90,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
87
90
|
|
|
88
91
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
89
92
|
|
|
90
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
93
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,9 @@ interface CssVarOptions {
|
|
|
33
33
|
}
|
|
34
34
|
declare function cssVar(name: string, options?: CssVarOptions): CssVar;
|
|
35
35
|
|
|
36
|
+
type Dict = Record<string, any>;
|
|
37
|
+
declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
|
|
38
|
+
|
|
36
39
|
declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): {
|
|
37
40
|
[key in A]: B;
|
|
38
41
|
};
|
|
@@ -87,4 +90,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
87
90
|
|
|
88
91
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
89
92
|
|
|
90
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
93
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(src_exports, {
|
|
|
30
30
|
createRegex: () => createRegex,
|
|
31
31
|
cssVar: () => cssVar,
|
|
32
32
|
dashCase: () => dashCase,
|
|
33
|
+
deepSet: () => deepSet,
|
|
33
34
|
entries: () => entries,
|
|
34
35
|
esc: () => esc2,
|
|
35
36
|
filterBaseConditions: () => filterBaseConditions,
|
|
@@ -195,7 +196,7 @@ function filterBaseConditions(c) {
|
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
// src/css-important.ts
|
|
198
|
-
var importantRegex =
|
|
199
|
+
var importantRegex = /\s*!(important)?/i;
|
|
199
200
|
function isImportant(value) {
|
|
200
201
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
201
202
|
}
|
|
@@ -352,7 +353,7 @@ function createCss(context) {
|
|
|
352
353
|
}
|
|
353
354
|
return result;
|
|
354
355
|
};
|
|
355
|
-
return (styleObject = {}) => {
|
|
356
|
+
return memo((styleObject = {}) => {
|
|
356
357
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
357
358
|
const classNames = /* @__PURE__ */ new Set();
|
|
358
359
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -368,7 +369,7 @@ function createCss(context) {
|
|
|
368
369
|
classNames.add(className);
|
|
369
370
|
});
|
|
370
371
|
return Array.from(classNames).join(" ");
|
|
371
|
-
};
|
|
372
|
+
});
|
|
372
373
|
}
|
|
373
374
|
function compactStyles(...styles) {
|
|
374
375
|
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
@@ -386,7 +387,7 @@ function createMergeCss(context) {
|
|
|
386
387
|
function assignCss(...styles) {
|
|
387
388
|
return Object.assign({}, ...resolve(styles));
|
|
388
389
|
}
|
|
389
|
-
return { mergeCss, assignCss };
|
|
390
|
+
return { mergeCss: memo(mergeCss), assignCss };
|
|
390
391
|
}
|
|
391
392
|
|
|
392
393
|
// src/css-unit.ts
|
|
@@ -462,6 +463,31 @@ function cssVar(name, options = {}) {
|
|
|
462
463
|
return result;
|
|
463
464
|
}
|
|
464
465
|
|
|
466
|
+
// src/deep-set.ts
|
|
467
|
+
var deepSet = (target, path, value) => {
|
|
468
|
+
const isValueObject = isObject(value);
|
|
469
|
+
if (!path.length && isValueObject) {
|
|
470
|
+
return Object.assign(target, value);
|
|
471
|
+
}
|
|
472
|
+
let current = target;
|
|
473
|
+
for (let i = 0; i < path.length; i++) {
|
|
474
|
+
const key = path[i];
|
|
475
|
+
if (!current[key]) {
|
|
476
|
+
current[key] = {};
|
|
477
|
+
}
|
|
478
|
+
if (i === path.length - 1) {
|
|
479
|
+
if (isValueObject && isObject(current[key])) {
|
|
480
|
+
Object.assign(current[key], value);
|
|
481
|
+
} else {
|
|
482
|
+
current[key] = value;
|
|
483
|
+
}
|
|
484
|
+
} else {
|
|
485
|
+
current = current[key];
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return target;
|
|
489
|
+
};
|
|
490
|
+
|
|
465
491
|
// src/entries.ts
|
|
466
492
|
function fromEntries(entries2) {
|
|
467
493
|
const result = {};
|
|
@@ -706,6 +732,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
706
732
|
createRegex,
|
|
707
733
|
cssVar,
|
|
708
734
|
dashCase,
|
|
735
|
+
deepSet,
|
|
709
736
|
entries,
|
|
710
737
|
esc,
|
|
711
738
|
filterBaseConditions,
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function filterBaseConditions(c) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/css-important.ts
|
|
118
|
-
var importantRegex =
|
|
118
|
+
var importantRegex = /\s*!(important)?/i;
|
|
119
119
|
function isImportant(value) {
|
|
120
120
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
121
121
|
}
|
|
@@ -272,7 +272,7 @@ function createCss(context) {
|
|
|
272
272
|
}
|
|
273
273
|
return result;
|
|
274
274
|
};
|
|
275
|
-
return (styleObject = {}) => {
|
|
275
|
+
return memo((styleObject = {}) => {
|
|
276
276
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
277
277
|
const classNames = /* @__PURE__ */ new Set();
|
|
278
278
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -288,7 +288,7 @@ function createCss(context) {
|
|
|
288
288
|
classNames.add(className);
|
|
289
289
|
});
|
|
290
290
|
return Array.from(classNames).join(" ");
|
|
291
|
-
};
|
|
291
|
+
});
|
|
292
292
|
}
|
|
293
293
|
function compactStyles(...styles) {
|
|
294
294
|
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
@@ -306,7 +306,7 @@ function createMergeCss(context) {
|
|
|
306
306
|
function assignCss(...styles) {
|
|
307
307
|
return Object.assign({}, ...resolve(styles));
|
|
308
308
|
}
|
|
309
|
-
return { mergeCss, assignCss };
|
|
309
|
+
return { mergeCss: memo(mergeCss), assignCss };
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/css-unit.ts
|
|
@@ -382,6 +382,31 @@ function cssVar(name, options = {}) {
|
|
|
382
382
|
return result;
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
// src/deep-set.ts
|
|
386
|
+
var deepSet = (target, path, value) => {
|
|
387
|
+
const isValueObject = isObject(value);
|
|
388
|
+
if (!path.length && isValueObject) {
|
|
389
|
+
return Object.assign(target, value);
|
|
390
|
+
}
|
|
391
|
+
let current = target;
|
|
392
|
+
for (let i = 0; i < path.length; i++) {
|
|
393
|
+
const key = path[i];
|
|
394
|
+
if (!current[key]) {
|
|
395
|
+
current[key] = {};
|
|
396
|
+
}
|
|
397
|
+
if (i === path.length - 1) {
|
|
398
|
+
if (isValueObject && isObject(current[key])) {
|
|
399
|
+
Object.assign(current[key], value);
|
|
400
|
+
} else {
|
|
401
|
+
current[key] = value;
|
|
402
|
+
}
|
|
403
|
+
} else {
|
|
404
|
+
current = current[key];
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return target;
|
|
408
|
+
};
|
|
409
|
+
|
|
385
410
|
// src/entries.ts
|
|
386
411
|
function fromEntries(entries2) {
|
|
387
412
|
const result = {};
|
|
@@ -625,6 +650,7 @@ export {
|
|
|
625
650
|
createRegex,
|
|
626
651
|
cssVar,
|
|
627
652
|
dashCase,
|
|
653
|
+
deepSet,
|
|
628
654
|
entries,
|
|
629
655
|
esc2 as esc,
|
|
630
656
|
filterBaseConditions,
|
package/dist/shared.js
CHANGED
|
@@ -57,7 +57,7 @@ function filterBaseConditions(c) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// src/css-important.ts
|
|
60
|
-
var importantRegex =
|
|
60
|
+
var importantRegex = /\s*!(important)?/i;
|
|
61
61
|
function isImportant(value) {
|
|
62
62
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
63
63
|
}
|
|
@@ -106,6 +106,21 @@ function mergeProps(...sources) {
|
|
|
106
106
|
}, {});
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// src/memo.ts
|
|
110
|
+
var memo = (fn) => {
|
|
111
|
+
const cache = /* @__PURE__ */ new Map();
|
|
112
|
+
const get = (...args) => {
|
|
113
|
+
const key = JSON.stringify(args);
|
|
114
|
+
if (cache.has(key)) {
|
|
115
|
+
return cache.get(key);
|
|
116
|
+
}
|
|
117
|
+
const result = fn(...args);
|
|
118
|
+
cache.set(key, result);
|
|
119
|
+
return result;
|
|
120
|
+
};
|
|
121
|
+
return get;
|
|
122
|
+
};
|
|
123
|
+
|
|
109
124
|
// src/walk-object.ts
|
|
110
125
|
var isNotNullish = (element) => element != null;
|
|
111
126
|
function walkObject(target, predicate, options = {}) {
|
|
@@ -192,7 +207,7 @@ function createCss(context) {
|
|
|
192
207
|
}
|
|
193
208
|
return result;
|
|
194
209
|
};
|
|
195
|
-
return (styleObject = {}) => {
|
|
210
|
+
return memo((styleObject = {}) => {
|
|
196
211
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
197
212
|
const classNames = /* @__PURE__ */ new Set();
|
|
198
213
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -208,7 +223,7 @@ function createCss(context) {
|
|
|
208
223
|
classNames.add(className);
|
|
209
224
|
});
|
|
210
225
|
return Array.from(classNames).join(" ");
|
|
211
|
-
};
|
|
226
|
+
});
|
|
212
227
|
}
|
|
213
228
|
function compactStyles(...styles) {
|
|
214
229
|
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
@@ -226,24 +241,9 @@ function createMergeCss(context) {
|
|
|
226
241
|
function assignCss(...styles) {
|
|
227
242
|
return Object.assign({}, ...resolve(styles));
|
|
228
243
|
}
|
|
229
|
-
return { mergeCss, assignCss };
|
|
244
|
+
return { mergeCss: memo(mergeCss), assignCss };
|
|
230
245
|
}
|
|
231
246
|
|
|
232
|
-
// src/memo.ts
|
|
233
|
-
var memo = (fn) => {
|
|
234
|
-
const cache = /* @__PURE__ */ new Map();
|
|
235
|
-
const get = (...args) => {
|
|
236
|
-
const key = JSON.stringify(args);
|
|
237
|
-
if (cache.has(key)) {
|
|
238
|
-
return cache.get(key);
|
|
239
|
-
}
|
|
240
|
-
const result = fn(...args);
|
|
241
|
-
cache.set(key, result);
|
|
242
|
-
return result;
|
|
243
|
-
};
|
|
244
|
-
return get;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
247
|
// src/hypenate-property.ts
|
|
248
248
|
var wordRegex = /([A-Z])/g;
|
|
249
249
|
var msRegex = /^ms-/;
|
package/dist/shared.mjs
CHANGED
|
@@ -15,7 +15,7 @@ function filterBaseConditions(c) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// src/css-important.ts
|
|
18
|
-
var importantRegex =
|
|
18
|
+
var importantRegex = /\s*!(important)?/i;
|
|
19
19
|
function isImportant(value) {
|
|
20
20
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
21
21
|
}
|
|
@@ -64,6 +64,21 @@ function mergeProps(...sources) {
|
|
|
64
64
|
}, {});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// src/memo.ts
|
|
68
|
+
var memo = (fn) => {
|
|
69
|
+
const cache = /* @__PURE__ */ new Map();
|
|
70
|
+
const get = (...args) => {
|
|
71
|
+
const key = JSON.stringify(args);
|
|
72
|
+
if (cache.has(key)) {
|
|
73
|
+
return cache.get(key);
|
|
74
|
+
}
|
|
75
|
+
const result = fn(...args);
|
|
76
|
+
cache.set(key, result);
|
|
77
|
+
return result;
|
|
78
|
+
};
|
|
79
|
+
return get;
|
|
80
|
+
};
|
|
81
|
+
|
|
67
82
|
// src/walk-object.ts
|
|
68
83
|
var isNotNullish = (element) => element != null;
|
|
69
84
|
function walkObject(target, predicate, options = {}) {
|
|
@@ -150,7 +165,7 @@ function createCss(context) {
|
|
|
150
165
|
}
|
|
151
166
|
return result;
|
|
152
167
|
};
|
|
153
|
-
return (styleObject = {}) => {
|
|
168
|
+
return memo((styleObject = {}) => {
|
|
154
169
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
155
170
|
const classNames = /* @__PURE__ */ new Set();
|
|
156
171
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -166,7 +181,7 @@ function createCss(context) {
|
|
|
166
181
|
classNames.add(className);
|
|
167
182
|
});
|
|
168
183
|
return Array.from(classNames).join(" ");
|
|
169
|
-
};
|
|
184
|
+
});
|
|
170
185
|
}
|
|
171
186
|
function compactStyles(...styles) {
|
|
172
187
|
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
@@ -184,24 +199,9 @@ function createMergeCss(context) {
|
|
|
184
199
|
function assignCss(...styles) {
|
|
185
200
|
return Object.assign({}, ...resolve(styles));
|
|
186
201
|
}
|
|
187
|
-
return { mergeCss, assignCss };
|
|
202
|
+
return { mergeCss: memo(mergeCss), assignCss };
|
|
188
203
|
}
|
|
189
204
|
|
|
190
|
-
// src/memo.ts
|
|
191
|
-
var memo = (fn) => {
|
|
192
|
-
const cache = /* @__PURE__ */ new Map();
|
|
193
|
-
const get = (...args) => {
|
|
194
|
-
const key = JSON.stringify(args);
|
|
195
|
-
if (cache.has(key)) {
|
|
196
|
-
return cache.get(key);
|
|
197
|
-
}
|
|
198
|
-
const result = fn(...args);
|
|
199
|
-
cache.set(key, result);
|
|
200
|
-
return result;
|
|
201
|
-
};
|
|
202
|
-
return get;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
205
|
// src/hypenate-property.ts
|
|
206
206
|
var wordRegex = /([A-Z])/g;
|
|
207
207
|
var msRegex = /^ms-/;
|