@pandacss/shared 0.54.0 → 1.0.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/astish.js +4 -8
- package/dist/astish.mjs +4 -8
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -69
- package/dist/index.mjs +34 -66
- package/dist/shared.js +11 -22
- package/dist/shared.mjs +11 -22
- package/package.json +1 -1
package/dist/astish.js
CHANGED
|
@@ -28,19 +28,15 @@ var ruleClean = /\/\*[^]*?\*\/| +/g;
|
|
|
28
28
|
var ruleNewline = /\n+/g;
|
|
29
29
|
var empty = " ";
|
|
30
30
|
var astish = (val, tree = [{}]) => {
|
|
31
|
-
if (!val)
|
|
32
|
-
return tree[0];
|
|
31
|
+
if (!val) return tree[0];
|
|
33
32
|
let block, left;
|
|
34
33
|
while (block = newRule.exec(val.replace(ruleClean, ""))) {
|
|
35
|
-
if (block[4])
|
|
36
|
-
tree.shift();
|
|
34
|
+
if (block[4]) tree.shift();
|
|
37
35
|
else if (block[3]) {
|
|
38
36
|
left = block[3].replace(ruleNewline, empty).trim();
|
|
39
|
-
if (!left.includes("&") && !left.startsWith("@"))
|
|
40
|
-
left = "& " + left;
|
|
37
|
+
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left;
|
|
41
38
|
tree.unshift(tree[0][left] = tree[0][left] || {});
|
|
42
|
-
} else
|
|
43
|
-
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
39
|
+
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
44
40
|
}
|
|
45
41
|
return tree[0];
|
|
46
42
|
};
|
package/dist/astish.mjs
CHANGED
|
@@ -4,19 +4,15 @@ var ruleClean = /\/\*[^]*?\*\/| +/g;
|
|
|
4
4
|
var ruleNewline = /\n+/g;
|
|
5
5
|
var empty = " ";
|
|
6
6
|
var astish = (val, tree = [{}]) => {
|
|
7
|
-
if (!val)
|
|
8
|
-
return tree[0];
|
|
7
|
+
if (!val) return tree[0];
|
|
9
8
|
let block, left;
|
|
10
9
|
while (block = newRule.exec(val.replace(ruleClean, ""))) {
|
|
11
|
-
if (block[4])
|
|
12
|
-
tree.shift();
|
|
10
|
+
if (block[4]) tree.shift();
|
|
13
11
|
else if (block[3]) {
|
|
14
12
|
left = block[3].replace(ruleNewline, empty).trim();
|
|
15
|
-
if (!left.includes("&") && !left.startsWith("@"))
|
|
16
|
-
left = "& " + left;
|
|
13
|
+
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left;
|
|
17
14
|
tree.unshift(tree[0][left] = tree[0][left] || {});
|
|
18
|
-
} else
|
|
19
|
-
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
15
|
+
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
20
16
|
}
|
|
21
17
|
return tree[0];
|
|
22
18
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn,
|
|
1
|
+
import { W as WalkObjectStopFn, C as CreateCssContext, M as MappedObject } from './shared-DTGzt6ot.mjs';
|
|
2
2
|
export { y as WalkObjectOptions, g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, a as isBoolean, b as isFunction, l as isImportant, c as isObject, d as isObjectOrArray, i as isString, A as mapObject, n as markImportant, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, w as withoutImportant, m as withoutSpace } from './shared-DTGzt6ot.mjs';
|
|
3
3
|
export { astish } from './astish.mjs';
|
|
4
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn,
|
|
1
|
+
import { W as WalkObjectStopFn, C as CreateCssContext, M as MappedObject } from './shared-DTGzt6ot.js';
|
|
2
2
|
export { y as WalkObjectOptions, g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, a as isBoolean, b as isFunction, l as isImportant, c as isObject, d as isObjectOrArray, i as isString, A as mapObject, n as markImportant, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, w as withoutImportant, m as withoutSpace } from './shared-DTGzt6ot.js';
|
|
3
3
|
export { astish } from './astish.js';
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
CacheMap: () => CacheMap,
|
|
24
24
|
PANDA_CONFIG_NAME: () => PANDA_CONFIG_NAME,
|
|
25
25
|
PandaError: () => PandaError,
|
|
@@ -88,12 +88,11 @@ __export(src_exports, {
|
|
|
88
88
|
withoutImportant: () => withoutImportant,
|
|
89
89
|
withoutSpace: () => withoutSpace
|
|
90
90
|
});
|
|
91
|
-
module.exports = __toCommonJS(
|
|
91
|
+
module.exports = __toCommonJS(index_exports);
|
|
92
92
|
|
|
93
93
|
// src/arbitrary-value.ts
|
|
94
94
|
var getArbitraryValue = (_value) => {
|
|
95
|
-
if (!_value || typeof _value !== "string")
|
|
96
|
-
return _value;
|
|
95
|
+
if (!_value || typeof _value !== "string") return _value;
|
|
97
96
|
const value = _value.trim();
|
|
98
97
|
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
99
98
|
const innerValue = value.slice(1, -1);
|
|
@@ -142,19 +141,15 @@ var ruleClean = /\/\*[^]*?\*\/| +/g;
|
|
|
142
141
|
var ruleNewline = /\n+/g;
|
|
143
142
|
var empty = " ";
|
|
144
143
|
var astish = (val, tree = [{}]) => {
|
|
145
|
-
if (!val)
|
|
146
|
-
return tree[0];
|
|
144
|
+
if (!val) return tree[0];
|
|
147
145
|
let block, left;
|
|
148
146
|
while (block = newRule.exec(val.replace(ruleClean, ""))) {
|
|
149
|
-
if (block[4])
|
|
150
|
-
tree.shift();
|
|
147
|
+
if (block[4]) tree.shift();
|
|
151
148
|
else if (block[3]) {
|
|
152
149
|
left = block[3].replace(ruleNewline, empty).trim();
|
|
153
|
-
if (!left.includes("&") && !left.startsWith("@"))
|
|
154
|
-
left = "& " + left;
|
|
150
|
+
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left;
|
|
155
151
|
tree.unshift(tree[0][left] = tree[0][left] || {});
|
|
156
|
-
} else
|
|
157
|
-
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
152
|
+
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
158
153
|
}
|
|
159
154
|
return tree[0];
|
|
160
155
|
};
|
|
@@ -277,8 +272,7 @@ var memo = (fn) => {
|
|
|
277
272
|
var regex = /-(\w|$)/g;
|
|
278
273
|
var callback = (_dashChar, char) => char.toUpperCase();
|
|
279
274
|
var camelCaseProperty = memo((property) => {
|
|
280
|
-
if (property.startsWith("--"))
|
|
281
|
-
return property;
|
|
275
|
+
if (property.startsWith("--")) return property;
|
|
282
276
|
let str = property.toLowerCase();
|
|
283
277
|
str = str.startsWith("-ms-") ? str.substring(1) : str;
|
|
284
278
|
return str.replace(regex, callback);
|
|
@@ -308,14 +302,12 @@ function toChar(code) {
|
|
|
308
302
|
function toName(code) {
|
|
309
303
|
let name = "";
|
|
310
304
|
let x;
|
|
311
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
312
|
-
name = toChar(x % 52) + name;
|
|
305
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
313
306
|
return toChar(x % 52) + name;
|
|
314
307
|
}
|
|
315
308
|
function toPhash(h, x) {
|
|
316
309
|
let i = x.length;
|
|
317
|
-
while (i)
|
|
318
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
310
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
319
311
|
return h;
|
|
320
312
|
}
|
|
321
313
|
function toHash(value) {
|
|
@@ -360,11 +352,9 @@ function markImportant(obj) {
|
|
|
360
352
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
361
353
|
function mergeProps(...sources) {
|
|
362
354
|
return sources.reduce((prev, obj) => {
|
|
363
|
-
if (!obj)
|
|
364
|
-
return prev;
|
|
355
|
+
if (!obj) return prev;
|
|
365
356
|
Object.keys(obj).forEach((key) => {
|
|
366
|
-
if (MERGE_OMIT.has(key))
|
|
367
|
-
return;
|
|
357
|
+
if (MERGE_OMIT.has(key)) return;
|
|
368
358
|
const prevValue = prev[key];
|
|
369
359
|
const value = obj[key];
|
|
370
360
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -402,10 +392,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
402
392
|
return inner(target);
|
|
403
393
|
}
|
|
404
394
|
function mapObject(obj, fn) {
|
|
405
|
-
if (Array.isArray(obj))
|
|
406
|
-
|
|
407
|
-
if (!isObject(obj))
|
|
408
|
-
return fn(obj);
|
|
395
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
396
|
+
if (!isObject(obj)) return fn(obj);
|
|
409
397
|
return walkObject(obj, (value) => fn(value));
|
|
410
398
|
}
|
|
411
399
|
|
|
@@ -463,15 +451,13 @@ function createCss(context) {
|
|
|
463
451
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
464
452
|
const classNames = /* @__PURE__ */ new Set();
|
|
465
453
|
walkObject(normalizedObject, (value, paths) => {
|
|
466
|
-
if (value == null)
|
|
467
|
-
return;
|
|
454
|
+
if (value == null) return;
|
|
468
455
|
const important = isImportant(value);
|
|
469
456
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
470
457
|
const conditions = filterBaseConditions(allConditions);
|
|
471
458
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
472
459
|
let className = hashFn(conditions, transformed.className);
|
|
473
|
-
if (important)
|
|
474
|
-
className = `${className}!`;
|
|
460
|
+
if (important) className = `${className}!`;
|
|
475
461
|
classNames.add(className);
|
|
476
462
|
});
|
|
477
463
|
return Array.from(classNames).join(" ");
|
|
@@ -483,8 +469,7 @@ function compactStyles(...styles) {
|
|
|
483
469
|
function createMergeCss(context) {
|
|
484
470
|
function resolve(styles) {
|
|
485
471
|
const allStyles = compactStyles(...styles);
|
|
486
|
-
if (allStyles.length === 1)
|
|
487
|
-
return allStyles;
|
|
472
|
+
if (allStyles.length === 1) return allStyles;
|
|
488
473
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
489
474
|
}
|
|
490
475
|
function mergeCss(...styles) {
|
|
@@ -576,12 +561,9 @@ var PandaError = class extends Error {
|
|
|
576
561
|
// src/esc.ts
|
|
577
562
|
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
|
|
578
563
|
var fcssescape = function(ch, asCodePoint) {
|
|
579
|
-
if (!asCodePoint)
|
|
580
|
-
|
|
581
|
-
if (ch === "
|
|
582
|
-
return "\uFFFD";
|
|
583
|
-
if (ch === "-" && ch.length === 1)
|
|
584
|
-
return "\\-";
|
|
564
|
+
if (!asCodePoint) return "\\" + ch;
|
|
565
|
+
if (ch === "\0") return "\uFFFD";
|
|
566
|
+
if (ch === "-" && ch.length === 1) return "\\-";
|
|
585
567
|
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16);
|
|
586
568
|
};
|
|
587
569
|
var esc2 = (sel) => {
|
|
@@ -590,8 +572,7 @@ var esc2 = (sel) => {
|
|
|
590
572
|
|
|
591
573
|
// src/flatten.ts
|
|
592
574
|
function filterDefault(path) {
|
|
593
|
-
if (path[0] === "DEFAULT")
|
|
594
|
-
return path;
|
|
575
|
+
if (path[0] === "DEFAULT") return path;
|
|
595
576
|
return path.filter((item) => item !== "DEFAULT");
|
|
596
577
|
}
|
|
597
578
|
function flatten(values, stop) {
|
|
@@ -627,8 +608,7 @@ function getOrCreateSet(map, key) {
|
|
|
627
608
|
var wordRegex = /([A-Z])/g;
|
|
628
609
|
var msRegex = /^ms-/;
|
|
629
610
|
var hypenateProperty = memo((property) => {
|
|
630
|
-
if (property.startsWith("--"))
|
|
631
|
-
return property;
|
|
611
|
+
if (property.startsWith("--")) return property;
|
|
632
612
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
633
613
|
});
|
|
634
614
|
|
|
@@ -725,8 +705,7 @@ var patternFns = {
|
|
|
725
705
|
isCssUnit
|
|
726
706
|
};
|
|
727
707
|
var getPatternStyles = (pattern, styles) => {
|
|
728
|
-
if (!pattern?.defaultValues)
|
|
729
|
-
return styles;
|
|
708
|
+
if (!pattern?.defaultValues) return styles;
|
|
730
709
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
731
710
|
return Object.assign({}, defaults, compact(styles));
|
|
732
711
|
};
|
|
@@ -866,6 +845,7 @@ shorthandsOfLonghands.add("placeSelf");
|
|
|
866
845
|
longHandLogical.add("alignSelf");
|
|
867
846
|
longHandLogical.add("justifySelf");
|
|
868
847
|
longHandLogical.add("boxSizing");
|
|
848
|
+
longHandLogical.add("fieldSizing");
|
|
869
849
|
longHandLogical.add("blockSize");
|
|
870
850
|
longHandPhysical.add("height");
|
|
871
851
|
longHandLogical.add("inlineSize");
|
|
@@ -1183,18 +1163,12 @@ longHandLogical.add("mathShift");
|
|
|
1183
1163
|
longHandLogical.add("mathStyle");
|
|
1184
1164
|
longHandLogical.add("touchAction");
|
|
1185
1165
|
function getPropertyPriority(key) {
|
|
1186
|
-
if (key === "all")
|
|
1187
|
-
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1192
|
-
if (longHandLogical.has(key))
|
|
1193
|
-
return 3e3;
|
|
1194
|
-
if (shorthandsOfLonghands.has(key))
|
|
1195
|
-
return 2e3;
|
|
1196
|
-
if (shorthandsOfShorthands.has(key))
|
|
1197
|
-
return 1e3;
|
|
1166
|
+
if (key === "all") return 0;
|
|
1167
|
+
if (key.startsWith("--")) return 1;
|
|
1168
|
+
if (longHandPhysical.has(key)) return 4e3;
|
|
1169
|
+
if (longHandLogical.has(key)) return 3e3;
|
|
1170
|
+
if (shorthandsOfLonghands.has(key)) return 2e3;
|
|
1171
|
+
if (shorthandsOfShorthands.has(key)) return 1e3;
|
|
1198
1172
|
return 3e3;
|
|
1199
1173
|
}
|
|
1200
1174
|
|
|
@@ -1207,8 +1181,7 @@ var createRegex = (item) => {
|
|
|
1207
1181
|
// src/serialize.ts
|
|
1208
1182
|
var stringifyJson = (config) => {
|
|
1209
1183
|
return JSON.stringify(config, (_key, value) => {
|
|
1210
|
-
if (typeof value === "function")
|
|
1211
|
-
return value.toString();
|
|
1184
|
+
if (typeof value === "function") return value.toString();
|
|
1212
1185
|
return value;
|
|
1213
1186
|
});
|
|
1214
1187
|
};
|
|
@@ -1275,8 +1248,7 @@ function getNegativePath(path) {
|
|
|
1275
1248
|
return path.slice(0, -1).concat(`-${path.at(-1)}`);
|
|
1276
1249
|
}
|
|
1277
1250
|
function getDotPath(obj, path, fallback) {
|
|
1278
|
-
if (typeof path !== "string")
|
|
1279
|
-
return fallback;
|
|
1251
|
+
if (typeof path !== "string") return fallback;
|
|
1280
1252
|
const idx = path.indexOf(".");
|
|
1281
1253
|
if (idx === -1) {
|
|
1282
1254
|
return obj?.[path] ?? fallback;
|
|
@@ -1326,8 +1298,7 @@ function mapToJson(map) {
|
|
|
1326
1298
|
function unionType(values, opts = {}) {
|
|
1327
1299
|
const { fallback, stringify = JSON.stringify } = opts;
|
|
1328
1300
|
const arr = Array.from(values);
|
|
1329
|
-
if (fallback != null && !arr.length)
|
|
1330
|
-
return fallback;
|
|
1301
|
+
if (fallback != null && !arr.length) return fallback;
|
|
1331
1302
|
return arr.map((v) => stringify(v)).join(" | ");
|
|
1332
1303
|
}
|
|
1333
1304
|
|
|
@@ -1359,8 +1330,7 @@ function toPx(value = "") {
|
|
|
1359
1330
|
return `${value}px`;
|
|
1360
1331
|
}
|
|
1361
1332
|
const unit = getUnit(value);
|
|
1362
|
-
if (!unit)
|
|
1363
|
-
return value;
|
|
1333
|
+
if (!unit) return value;
|
|
1364
1334
|
if (unit === UNIT_PX) {
|
|
1365
1335
|
return value;
|
|
1366
1336
|
}
|
|
@@ -1370,8 +1340,7 @@ function toPx(value = "") {
|
|
|
1370
1340
|
}
|
|
1371
1341
|
function toEm(value = "", fontSize = BASE_FONT_SIZE) {
|
|
1372
1342
|
const unit = getUnit(value);
|
|
1373
|
-
if (!unit)
|
|
1374
|
-
return value;
|
|
1343
|
+
if (!unit) return value;
|
|
1375
1344
|
if (unit === UNIT_EM) {
|
|
1376
1345
|
return value;
|
|
1377
1346
|
}
|
|
@@ -1384,8 +1353,7 @@ function toEm(value = "", fontSize = BASE_FONT_SIZE) {
|
|
|
1384
1353
|
}
|
|
1385
1354
|
function toRem(value = "") {
|
|
1386
1355
|
const unit = getUnit(value);
|
|
1387
|
-
if (!unit)
|
|
1388
|
-
return value;
|
|
1356
|
+
if (!unit) return value;
|
|
1389
1357
|
if (unit === UNIT_REM) {
|
|
1390
1358
|
return value;
|
|
1391
1359
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/arbitrary-value.ts
|
|
2
2
|
var getArbitraryValue = (_value) => {
|
|
3
|
-
if (!_value || typeof _value !== "string")
|
|
4
|
-
return _value;
|
|
3
|
+
if (!_value || typeof _value !== "string") return _value;
|
|
5
4
|
const value = _value.trim();
|
|
6
5
|
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
7
6
|
const innerValue = value.slice(1, -1);
|
|
@@ -50,19 +49,15 @@ var ruleClean = /\/\*[^]*?\*\/| +/g;
|
|
|
50
49
|
var ruleNewline = /\n+/g;
|
|
51
50
|
var empty = " ";
|
|
52
51
|
var astish = (val, tree = [{}]) => {
|
|
53
|
-
if (!val)
|
|
54
|
-
return tree[0];
|
|
52
|
+
if (!val) return tree[0];
|
|
55
53
|
let block, left;
|
|
56
54
|
while (block = newRule.exec(val.replace(ruleClean, ""))) {
|
|
57
|
-
if (block[4])
|
|
58
|
-
tree.shift();
|
|
55
|
+
if (block[4]) tree.shift();
|
|
59
56
|
else if (block[3]) {
|
|
60
57
|
left = block[3].replace(ruleNewline, empty).trim();
|
|
61
|
-
if (!left.includes("&") && !left.startsWith("@"))
|
|
62
|
-
left = "& " + left;
|
|
58
|
+
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left;
|
|
63
59
|
tree.unshift(tree[0][left] = tree[0][left] || {});
|
|
64
|
-
} else
|
|
65
|
-
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
60
|
+
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
|
|
66
61
|
}
|
|
67
62
|
return tree[0];
|
|
68
63
|
};
|
|
@@ -185,8 +180,7 @@ var memo = (fn) => {
|
|
|
185
180
|
var regex = /-(\w|$)/g;
|
|
186
181
|
var callback = (_dashChar, char) => char.toUpperCase();
|
|
187
182
|
var camelCaseProperty = memo((property) => {
|
|
188
|
-
if (property.startsWith("--"))
|
|
189
|
-
return property;
|
|
183
|
+
if (property.startsWith("--")) return property;
|
|
190
184
|
let str = property.toLowerCase();
|
|
191
185
|
str = str.startsWith("-ms-") ? str.substring(1) : str;
|
|
192
186
|
return str.replace(regex, callback);
|
|
@@ -216,14 +210,12 @@ function toChar(code) {
|
|
|
216
210
|
function toName(code) {
|
|
217
211
|
let name = "";
|
|
218
212
|
let x;
|
|
219
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
220
|
-
name = toChar(x % 52) + name;
|
|
213
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
221
214
|
return toChar(x % 52) + name;
|
|
222
215
|
}
|
|
223
216
|
function toPhash(h, x) {
|
|
224
217
|
let i = x.length;
|
|
225
|
-
while (i)
|
|
226
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
218
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
227
219
|
return h;
|
|
228
220
|
}
|
|
229
221
|
function toHash(value) {
|
|
@@ -268,11 +260,9 @@ function markImportant(obj) {
|
|
|
268
260
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
269
261
|
function mergeProps(...sources) {
|
|
270
262
|
return sources.reduce((prev, obj) => {
|
|
271
|
-
if (!obj)
|
|
272
|
-
return prev;
|
|
263
|
+
if (!obj) return prev;
|
|
273
264
|
Object.keys(obj).forEach((key) => {
|
|
274
|
-
if (MERGE_OMIT.has(key))
|
|
275
|
-
return;
|
|
265
|
+
if (MERGE_OMIT.has(key)) return;
|
|
276
266
|
const prevValue = prev[key];
|
|
277
267
|
const value = obj[key];
|
|
278
268
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -310,10 +300,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
310
300
|
return inner(target);
|
|
311
301
|
}
|
|
312
302
|
function mapObject(obj, fn) {
|
|
313
|
-
if (Array.isArray(obj))
|
|
314
|
-
|
|
315
|
-
if (!isObject(obj))
|
|
316
|
-
return fn(obj);
|
|
303
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
304
|
+
if (!isObject(obj)) return fn(obj);
|
|
317
305
|
return walkObject(obj, (value) => fn(value));
|
|
318
306
|
}
|
|
319
307
|
|
|
@@ -371,15 +359,13 @@ function createCss(context) {
|
|
|
371
359
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
372
360
|
const classNames = /* @__PURE__ */ new Set();
|
|
373
361
|
walkObject(normalizedObject, (value, paths) => {
|
|
374
|
-
if (value == null)
|
|
375
|
-
return;
|
|
362
|
+
if (value == null) return;
|
|
376
363
|
const important = isImportant(value);
|
|
377
364
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
378
365
|
const conditions = filterBaseConditions(allConditions);
|
|
379
366
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
380
367
|
let className = hashFn(conditions, transformed.className);
|
|
381
|
-
if (important)
|
|
382
|
-
className = `${className}!`;
|
|
368
|
+
if (important) className = `${className}!`;
|
|
383
369
|
classNames.add(className);
|
|
384
370
|
});
|
|
385
371
|
return Array.from(classNames).join(" ");
|
|
@@ -391,8 +377,7 @@ function compactStyles(...styles) {
|
|
|
391
377
|
function createMergeCss(context) {
|
|
392
378
|
function resolve(styles) {
|
|
393
379
|
const allStyles = compactStyles(...styles);
|
|
394
|
-
if (allStyles.length === 1)
|
|
395
|
-
return allStyles;
|
|
380
|
+
if (allStyles.length === 1) return allStyles;
|
|
396
381
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
397
382
|
}
|
|
398
383
|
function mergeCss(...styles) {
|
|
@@ -484,12 +469,9 @@ var PandaError = class extends Error {
|
|
|
484
469
|
// src/esc.ts
|
|
485
470
|
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
|
|
486
471
|
var fcssescape = function(ch, asCodePoint) {
|
|
487
|
-
if (!asCodePoint)
|
|
488
|
-
|
|
489
|
-
if (ch === "
|
|
490
|
-
return "\uFFFD";
|
|
491
|
-
if (ch === "-" && ch.length === 1)
|
|
492
|
-
return "\\-";
|
|
472
|
+
if (!asCodePoint) return "\\" + ch;
|
|
473
|
+
if (ch === "\0") return "\uFFFD";
|
|
474
|
+
if (ch === "-" && ch.length === 1) return "\\-";
|
|
493
475
|
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16);
|
|
494
476
|
};
|
|
495
477
|
var esc2 = (sel) => {
|
|
@@ -498,8 +480,7 @@ var esc2 = (sel) => {
|
|
|
498
480
|
|
|
499
481
|
// src/flatten.ts
|
|
500
482
|
function filterDefault(path) {
|
|
501
|
-
if (path[0] === "DEFAULT")
|
|
502
|
-
return path;
|
|
483
|
+
if (path[0] === "DEFAULT") return path;
|
|
503
484
|
return path.filter((item) => item !== "DEFAULT");
|
|
504
485
|
}
|
|
505
486
|
function flatten(values, stop) {
|
|
@@ -535,8 +516,7 @@ function getOrCreateSet(map, key) {
|
|
|
535
516
|
var wordRegex = /([A-Z])/g;
|
|
536
517
|
var msRegex = /^ms-/;
|
|
537
518
|
var hypenateProperty = memo((property) => {
|
|
538
|
-
if (property.startsWith("--"))
|
|
539
|
-
return property;
|
|
519
|
+
if (property.startsWith("--")) return property;
|
|
540
520
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
541
521
|
});
|
|
542
522
|
|
|
@@ -633,8 +613,7 @@ var patternFns = {
|
|
|
633
613
|
isCssUnit
|
|
634
614
|
};
|
|
635
615
|
var getPatternStyles = (pattern, styles) => {
|
|
636
|
-
if (!pattern?.defaultValues)
|
|
637
|
-
return styles;
|
|
616
|
+
if (!pattern?.defaultValues) return styles;
|
|
638
617
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
639
618
|
return Object.assign({}, defaults, compact(styles));
|
|
640
619
|
};
|
|
@@ -774,6 +753,7 @@ shorthandsOfLonghands.add("placeSelf");
|
|
|
774
753
|
longHandLogical.add("alignSelf");
|
|
775
754
|
longHandLogical.add("justifySelf");
|
|
776
755
|
longHandLogical.add("boxSizing");
|
|
756
|
+
longHandLogical.add("fieldSizing");
|
|
777
757
|
longHandLogical.add("blockSize");
|
|
778
758
|
longHandPhysical.add("height");
|
|
779
759
|
longHandLogical.add("inlineSize");
|
|
@@ -1091,18 +1071,12 @@ longHandLogical.add("mathShift");
|
|
|
1091
1071
|
longHandLogical.add("mathStyle");
|
|
1092
1072
|
longHandLogical.add("touchAction");
|
|
1093
1073
|
function getPropertyPriority(key) {
|
|
1094
|
-
if (key === "all")
|
|
1095
|
-
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
1098
|
-
if (
|
|
1099
|
-
|
|
1100
|
-
if (longHandLogical.has(key))
|
|
1101
|
-
return 3e3;
|
|
1102
|
-
if (shorthandsOfLonghands.has(key))
|
|
1103
|
-
return 2e3;
|
|
1104
|
-
if (shorthandsOfShorthands.has(key))
|
|
1105
|
-
return 1e3;
|
|
1074
|
+
if (key === "all") return 0;
|
|
1075
|
+
if (key.startsWith("--")) return 1;
|
|
1076
|
+
if (longHandPhysical.has(key)) return 4e3;
|
|
1077
|
+
if (longHandLogical.has(key)) return 3e3;
|
|
1078
|
+
if (shorthandsOfLonghands.has(key)) return 2e3;
|
|
1079
|
+
if (shorthandsOfShorthands.has(key)) return 1e3;
|
|
1106
1080
|
return 3e3;
|
|
1107
1081
|
}
|
|
1108
1082
|
|
|
@@ -1115,8 +1089,7 @@ var createRegex = (item) => {
|
|
|
1115
1089
|
// src/serialize.ts
|
|
1116
1090
|
var stringifyJson = (config) => {
|
|
1117
1091
|
return JSON.stringify(config, (_key, value) => {
|
|
1118
|
-
if (typeof value === "function")
|
|
1119
|
-
return value.toString();
|
|
1092
|
+
if (typeof value === "function") return value.toString();
|
|
1120
1093
|
return value;
|
|
1121
1094
|
});
|
|
1122
1095
|
};
|
|
@@ -1183,8 +1156,7 @@ function getNegativePath(path) {
|
|
|
1183
1156
|
return path.slice(0, -1).concat(`-${path.at(-1)}`);
|
|
1184
1157
|
}
|
|
1185
1158
|
function getDotPath(obj, path, fallback) {
|
|
1186
|
-
if (typeof path !== "string")
|
|
1187
|
-
return fallback;
|
|
1159
|
+
if (typeof path !== "string") return fallback;
|
|
1188
1160
|
const idx = path.indexOf(".");
|
|
1189
1161
|
if (idx === -1) {
|
|
1190
1162
|
return obj?.[path] ?? fallback;
|
|
@@ -1234,8 +1206,7 @@ function mapToJson(map) {
|
|
|
1234
1206
|
function unionType(values, opts = {}) {
|
|
1235
1207
|
const { fallback, stringify = JSON.stringify } = opts;
|
|
1236
1208
|
const arr = Array.from(values);
|
|
1237
|
-
if (fallback != null && !arr.length)
|
|
1238
|
-
return fallback;
|
|
1209
|
+
if (fallback != null && !arr.length) return fallback;
|
|
1239
1210
|
return arr.map((v) => stringify(v)).join(" | ");
|
|
1240
1211
|
}
|
|
1241
1212
|
|
|
@@ -1267,8 +1238,7 @@ function toPx(value = "") {
|
|
|
1267
1238
|
return `${value}px`;
|
|
1268
1239
|
}
|
|
1269
1240
|
const unit = getUnit(value);
|
|
1270
|
-
if (!unit)
|
|
1271
|
-
return value;
|
|
1241
|
+
if (!unit) return value;
|
|
1272
1242
|
if (unit === UNIT_PX) {
|
|
1273
1243
|
return value;
|
|
1274
1244
|
}
|
|
@@ -1278,8 +1248,7 @@ function toPx(value = "") {
|
|
|
1278
1248
|
}
|
|
1279
1249
|
function toEm(value = "", fontSize = BASE_FONT_SIZE) {
|
|
1280
1250
|
const unit = getUnit(value);
|
|
1281
|
-
if (!unit)
|
|
1282
|
-
return value;
|
|
1251
|
+
if (!unit) return value;
|
|
1283
1252
|
if (unit === UNIT_EM) {
|
|
1284
1253
|
return value;
|
|
1285
1254
|
}
|
|
@@ -1292,8 +1261,7 @@ function toEm(value = "", fontSize = BASE_FONT_SIZE) {
|
|
|
1292
1261
|
}
|
|
1293
1262
|
function toRem(value = "") {
|
|
1294
1263
|
const unit = getUnit(value);
|
|
1295
|
-
if (!unit)
|
|
1296
|
-
return value;
|
|
1264
|
+
if (!unit) return value;
|
|
1297
1265
|
if (unit === UNIT_REM) {
|
|
1298
1266
|
return value;
|
|
1299
1267
|
}
|
package/dist/shared.js
CHANGED
|
@@ -66,14 +66,12 @@ function toChar(code) {
|
|
|
66
66
|
function toName(code) {
|
|
67
67
|
let name = "";
|
|
68
68
|
let x;
|
|
69
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
70
|
-
name = toChar(x % 52) + name;
|
|
69
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
71
70
|
return toChar(x % 52) + name;
|
|
72
71
|
}
|
|
73
72
|
function toPhash(h, x) {
|
|
74
73
|
let i = x.length;
|
|
75
|
-
while (i)
|
|
76
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
74
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
77
75
|
return h;
|
|
78
76
|
}
|
|
79
77
|
function toHash(value) {
|
|
@@ -111,11 +109,9 @@ var memo = (fn) => {
|
|
|
111
109
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
112
110
|
function mergeProps(...sources) {
|
|
113
111
|
return sources.reduce((prev, obj) => {
|
|
114
|
-
if (!obj)
|
|
115
|
-
return prev;
|
|
112
|
+
if (!obj) return prev;
|
|
116
113
|
Object.keys(obj).forEach((key) => {
|
|
117
|
-
if (MERGE_OMIT.has(key))
|
|
118
|
-
return;
|
|
114
|
+
if (MERGE_OMIT.has(key)) return;
|
|
119
115
|
const prevValue = prev[key];
|
|
120
116
|
const value = obj[key];
|
|
121
117
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -153,10 +149,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
153
149
|
return inner(target);
|
|
154
150
|
}
|
|
155
151
|
function mapObject(obj, fn) {
|
|
156
|
-
if (Array.isArray(obj))
|
|
157
|
-
|
|
158
|
-
if (!isObject(obj))
|
|
159
|
-
return fn(obj);
|
|
152
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
153
|
+
if (!isObject(obj)) return fn(obj);
|
|
160
154
|
return walkObject(obj, (value) => fn(value));
|
|
161
155
|
}
|
|
162
156
|
|
|
@@ -214,15 +208,13 @@ function createCss(context) {
|
|
|
214
208
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
215
209
|
const classNames = /* @__PURE__ */ new Set();
|
|
216
210
|
walkObject(normalizedObject, (value, paths) => {
|
|
217
|
-
if (value == null)
|
|
218
|
-
return;
|
|
211
|
+
if (value == null) return;
|
|
219
212
|
const important = isImportant(value);
|
|
220
213
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
221
214
|
const conditions = filterBaseConditions(allConditions);
|
|
222
215
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
223
216
|
let className = hashFn(conditions, transformed.className);
|
|
224
|
-
if (important)
|
|
225
|
-
className = `${className}!`;
|
|
217
|
+
if (important) className = `${className}!`;
|
|
226
218
|
classNames.add(className);
|
|
227
219
|
});
|
|
228
220
|
return Array.from(classNames).join(" ");
|
|
@@ -234,8 +226,7 @@ function compactStyles(...styles) {
|
|
|
234
226
|
function createMergeCss(context) {
|
|
235
227
|
function resolve(styles) {
|
|
236
228
|
const allStyles = compactStyles(...styles);
|
|
237
|
-
if (allStyles.length === 1)
|
|
238
|
-
return allStyles;
|
|
229
|
+
if (allStyles.length === 1) return allStyles;
|
|
239
230
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
240
231
|
}
|
|
241
232
|
function mergeCss(...styles) {
|
|
@@ -251,8 +242,7 @@ function createMergeCss(context) {
|
|
|
251
242
|
var wordRegex = /([A-Z])/g;
|
|
252
243
|
var msRegex = /^ms-/;
|
|
253
244
|
var hypenateProperty = memo((property) => {
|
|
254
|
-
if (property.startsWith("--"))
|
|
255
|
-
return property;
|
|
245
|
+
if (property.startsWith("--")) return property;
|
|
256
246
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
257
247
|
});
|
|
258
248
|
|
|
@@ -278,8 +268,7 @@ var patternFns = {
|
|
|
278
268
|
isCssUnit
|
|
279
269
|
};
|
|
280
270
|
var getPatternStyles = (pattern, styles) => {
|
|
281
|
-
if (!pattern?.defaultValues)
|
|
282
|
-
return styles;
|
|
271
|
+
if (!pattern?.defaultValues) return styles;
|
|
283
272
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
284
273
|
return Object.assign({}, defaults, compact(styles));
|
|
285
274
|
};
|
package/dist/shared.mjs
CHANGED
|
@@ -22,14 +22,12 @@ function toChar(code) {
|
|
|
22
22
|
function toName(code) {
|
|
23
23
|
let name = "";
|
|
24
24
|
let x;
|
|
25
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
26
|
-
name = toChar(x % 52) + name;
|
|
25
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
27
26
|
return toChar(x % 52) + name;
|
|
28
27
|
}
|
|
29
28
|
function toPhash(h, x) {
|
|
30
29
|
let i = x.length;
|
|
31
|
-
while (i)
|
|
32
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
30
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
33
31
|
return h;
|
|
34
32
|
}
|
|
35
33
|
function toHash(value) {
|
|
@@ -67,11 +65,9 @@ var memo = (fn) => {
|
|
|
67
65
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
68
66
|
function mergeProps(...sources) {
|
|
69
67
|
return sources.reduce((prev, obj) => {
|
|
70
|
-
if (!obj)
|
|
71
|
-
return prev;
|
|
68
|
+
if (!obj) return prev;
|
|
72
69
|
Object.keys(obj).forEach((key) => {
|
|
73
|
-
if (MERGE_OMIT.has(key))
|
|
74
|
-
return;
|
|
70
|
+
if (MERGE_OMIT.has(key)) return;
|
|
75
71
|
const prevValue = prev[key];
|
|
76
72
|
const value = obj[key];
|
|
77
73
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -109,10 +105,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
109
105
|
return inner(target);
|
|
110
106
|
}
|
|
111
107
|
function mapObject(obj, fn) {
|
|
112
|
-
if (Array.isArray(obj))
|
|
113
|
-
|
|
114
|
-
if (!isObject(obj))
|
|
115
|
-
return fn(obj);
|
|
108
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
109
|
+
if (!isObject(obj)) return fn(obj);
|
|
116
110
|
return walkObject(obj, (value) => fn(value));
|
|
117
111
|
}
|
|
118
112
|
|
|
@@ -170,15 +164,13 @@ function createCss(context) {
|
|
|
170
164
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
171
165
|
const classNames = /* @__PURE__ */ new Set();
|
|
172
166
|
walkObject(normalizedObject, (value, paths) => {
|
|
173
|
-
if (value == null)
|
|
174
|
-
return;
|
|
167
|
+
if (value == null) return;
|
|
175
168
|
const important = isImportant(value);
|
|
176
169
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
177
170
|
const conditions = filterBaseConditions(allConditions);
|
|
178
171
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
179
172
|
let className = hashFn(conditions, transformed.className);
|
|
180
|
-
if (important)
|
|
181
|
-
className = `${className}!`;
|
|
173
|
+
if (important) className = `${className}!`;
|
|
182
174
|
classNames.add(className);
|
|
183
175
|
});
|
|
184
176
|
return Array.from(classNames).join(" ");
|
|
@@ -190,8 +182,7 @@ function compactStyles(...styles) {
|
|
|
190
182
|
function createMergeCss(context) {
|
|
191
183
|
function resolve(styles) {
|
|
192
184
|
const allStyles = compactStyles(...styles);
|
|
193
|
-
if (allStyles.length === 1)
|
|
194
|
-
return allStyles;
|
|
185
|
+
if (allStyles.length === 1) return allStyles;
|
|
195
186
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
196
187
|
}
|
|
197
188
|
function mergeCss(...styles) {
|
|
@@ -207,8 +198,7 @@ function createMergeCss(context) {
|
|
|
207
198
|
var wordRegex = /([A-Z])/g;
|
|
208
199
|
var msRegex = /^ms-/;
|
|
209
200
|
var hypenateProperty = memo((property) => {
|
|
210
|
-
if (property.startsWith("--"))
|
|
211
|
-
return property;
|
|
201
|
+
if (property.startsWith("--")) return property;
|
|
212
202
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
213
203
|
});
|
|
214
204
|
|
|
@@ -234,8 +224,7 @@ var patternFns = {
|
|
|
234
224
|
isCssUnit
|
|
235
225
|
};
|
|
236
226
|
var getPatternStyles = (pattern, styles) => {
|
|
237
|
-
if (!pattern?.defaultValues)
|
|
238
|
-
return styles;
|
|
227
|
+
if (!pattern?.defaultValues) return styles;
|
|
239
228
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
240
229
|
return Object.assign({}, defaults, compact(styles));
|
|
241
230
|
};
|