@unocss/preset-mini 0.35.4 → 0.36.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/README.md +64 -0
- package/dist/chunks/default.cjs +8 -1
- package/dist/chunks/default.mjs +8 -2
- package/dist/chunks/default2.cjs +83 -229
- package/dist/chunks/default2.mjs +4 -149
- package/dist/chunks/default3.cjs +17 -3
- package/dist/chunks/default3.mjs +17 -4
- package/dist/chunks/index.cjs +310 -0
- package/dist/chunks/index.mjs +300 -0
- package/dist/chunks/transform.cjs +129 -0
- package/dist/chunks/transform.mjs +126 -0
- package/dist/chunks/utilities.cjs +6 -311
- package/dist/chunks/utilities.mjs +3 -299
- package/dist/{colors-ce2fecb8.d.ts → colors-5590b862.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-e6d1b2e8.d.ts → default-ee82f36d.d.ts} +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.d.ts +9 -7
- package/dist/index.mjs +16 -3
- package/dist/rules.cjs +5 -2
- package/dist/rules.d.ts +17 -2
- package/dist/rules.mjs +4 -2
- package/dist/theme.cjs +4 -0
- package/dist/theme.d.ts +21 -5
- package/dist/theme.mjs +4 -1
- package/dist/{types-f7b2c653.d.ts → types-0f7ef446.d.ts} +2 -0
- package/dist/{utilities-e7a7f845.d.ts → utilities-a77178bb.d.ts} +1 -1
- package/dist/utils.cjs +10 -9
- package/dist/utils.d.ts +4 -4
- package/dist/utils.mjs +2 -1
- package/dist/variants.cjs +3 -1
- package/dist/variants.d.ts +7 -6
- package/dist/variants.mjs +2 -1
- package/package.json +2 -2
|
@@ -1,100 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const core = require('@unocss/core');
|
|
4
|
-
|
|
5
|
-
const directionMap = {
|
|
6
|
-
"l": ["-left"],
|
|
7
|
-
"r": ["-right"],
|
|
8
|
-
"t": ["-top"],
|
|
9
|
-
"b": ["-bottom"],
|
|
10
|
-
"s": ["-inline-start"],
|
|
11
|
-
"e": ["-inline-end"],
|
|
12
|
-
"x": ["-left", "-right"],
|
|
13
|
-
"y": ["-top", "-bottom"],
|
|
14
|
-
"": [""],
|
|
15
|
-
"bs": ["-block-start"],
|
|
16
|
-
"be": ["-block-end"],
|
|
17
|
-
"is": ["-inline-start"],
|
|
18
|
-
"ie": ["-inline-end"],
|
|
19
|
-
"block": ["-block-start", "-block-end"],
|
|
20
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
21
|
-
};
|
|
22
|
-
const insetMap = {
|
|
23
|
-
...directionMap,
|
|
24
|
-
s: ["-inset-inline-start"],
|
|
25
|
-
e: ["-inset-inline-end"],
|
|
26
|
-
bs: ["-inset-block-start"],
|
|
27
|
-
be: ["-inset-block-end"],
|
|
28
|
-
is: ["-inset-inline-start"],
|
|
29
|
-
ie: ["-inset-inline-end"],
|
|
30
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
31
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
32
|
-
};
|
|
33
|
-
const cornerMap = {
|
|
34
|
-
"l": ["-top-left", "-bottom-left"],
|
|
35
|
-
"r": ["-top-right", "-bottom-right"],
|
|
36
|
-
"t": ["-top-left", "-top-right"],
|
|
37
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
38
|
-
"tl": ["-top-left"],
|
|
39
|
-
"lt": ["-top-left"],
|
|
40
|
-
"tr": ["-top-right"],
|
|
41
|
-
"rt": ["-top-right"],
|
|
42
|
-
"bl": ["-bottom-left"],
|
|
43
|
-
"lb": ["-bottom-left"],
|
|
44
|
-
"br": ["-bottom-right"],
|
|
45
|
-
"rb": ["-bottom-right"],
|
|
46
|
-
"": [""],
|
|
47
|
-
"bs": ["-start-start", "-start-end"],
|
|
48
|
-
"be": ["-end-start", "-end-end"],
|
|
49
|
-
"is": ["-end-start", "-start-start"],
|
|
50
|
-
"ie": ["-start-end", "-end-end"],
|
|
51
|
-
"bs-is": ["-start-start"],
|
|
52
|
-
"is-bs": ["-start-start"],
|
|
53
|
-
"bs-ie": ["-start-end"],
|
|
54
|
-
"ie-bs": ["-start-end"],
|
|
55
|
-
"be-is": ["-end-start"],
|
|
56
|
-
"is-be": ["-end-start"],
|
|
57
|
-
"be-ie": ["-end-end"],
|
|
58
|
-
"ie-be": ["-end-end"]
|
|
59
|
-
};
|
|
60
|
-
const xyzMap = {
|
|
61
|
-
"x": ["-x"],
|
|
62
|
-
"y": ["-y"],
|
|
63
|
-
"z": ["-z"],
|
|
64
|
-
"": ["-x", "-y"]
|
|
65
|
-
};
|
|
66
|
-
const basePositionMap = [
|
|
67
|
-
"top",
|
|
68
|
-
"top center",
|
|
69
|
-
"top left",
|
|
70
|
-
"top right",
|
|
71
|
-
"bottom",
|
|
72
|
-
"bottom center",
|
|
73
|
-
"bottom left",
|
|
74
|
-
"bottom right",
|
|
75
|
-
"left",
|
|
76
|
-
"left center",
|
|
77
|
-
"left top",
|
|
78
|
-
"left bottom",
|
|
79
|
-
"right",
|
|
80
|
-
"right center",
|
|
81
|
-
"right top",
|
|
82
|
-
"right bottom",
|
|
83
|
-
"center",
|
|
84
|
-
"center top",
|
|
85
|
-
"center bottom",
|
|
86
|
-
"center left",
|
|
87
|
-
"center right",
|
|
88
|
-
"center center"
|
|
89
|
-
];
|
|
90
|
-
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
91
|
-
const globalKeywords = [
|
|
92
|
-
"inherit",
|
|
93
|
-
"initial",
|
|
94
|
-
"revert",
|
|
95
|
-
"revert-layer",
|
|
96
|
-
"unset"
|
|
97
|
-
];
|
|
4
|
+
const index = require('./index.cjs');
|
|
98
5
|
|
|
99
6
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
100
7
|
function hex2rgba(hex = "") {
|
|
@@ -315,214 +222,11 @@ function getComponents(str, separator, limit) {
|
|
|
315
222
|
return components;
|
|
316
223
|
}
|
|
317
224
|
|
|
318
|
-
const cssProps = [
|
|
319
|
-
"color",
|
|
320
|
-
"border-color",
|
|
321
|
-
"background-color",
|
|
322
|
-
"flex-grow",
|
|
323
|
-
"flex",
|
|
324
|
-
"flex-shrink",
|
|
325
|
-
"caret-color",
|
|
326
|
-
"font",
|
|
327
|
-
"gap",
|
|
328
|
-
"opacity",
|
|
329
|
-
"visibility",
|
|
330
|
-
"z-index",
|
|
331
|
-
"font-weight",
|
|
332
|
-
"zoom",
|
|
333
|
-
"text-shadow",
|
|
334
|
-
"transform",
|
|
335
|
-
"box-shadow",
|
|
336
|
-
"backround-position",
|
|
337
|
-
"left",
|
|
338
|
-
"right",
|
|
339
|
-
"top",
|
|
340
|
-
"bottom",
|
|
341
|
-
"object-position",
|
|
342
|
-
"max-height",
|
|
343
|
-
"min-height",
|
|
344
|
-
"max-width",
|
|
345
|
-
"min-width",
|
|
346
|
-
"height",
|
|
347
|
-
"width",
|
|
348
|
-
"border-width",
|
|
349
|
-
"margin",
|
|
350
|
-
"padding",
|
|
351
|
-
"outline-width",
|
|
352
|
-
"outline-offset",
|
|
353
|
-
"font-size",
|
|
354
|
-
"line-height",
|
|
355
|
-
"text-indent",
|
|
356
|
-
"vertical-align",
|
|
357
|
-
"border-spacing",
|
|
358
|
-
"letter-spacing",
|
|
359
|
-
"word-spacing",
|
|
360
|
-
"stroke",
|
|
361
|
-
"filter",
|
|
362
|
-
"backdrop-filter",
|
|
363
|
-
"fill",
|
|
364
|
-
"mask",
|
|
365
|
-
"mask-size",
|
|
366
|
-
"mask-border",
|
|
367
|
-
"clip-path",
|
|
368
|
-
"clip",
|
|
369
|
-
"border-radius"
|
|
370
|
-
];
|
|
371
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
|
|
372
|
-
const numberRE = /^(-?[0-9.]+)$/i;
|
|
373
|
-
const unitOnlyRE = /^(px)$/i;
|
|
374
|
-
function round(n) {
|
|
375
|
-
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
376
|
-
}
|
|
377
|
-
function numberWithUnit(str) {
|
|
378
|
-
const match = str.match(numberWithUnitRE);
|
|
379
|
-
if (!match)
|
|
380
|
-
return;
|
|
381
|
-
const [, n, unit] = match;
|
|
382
|
-
const num = parseFloat(n);
|
|
383
|
-
if (unit && !Number.isNaN(num))
|
|
384
|
-
return `${round(num)}${unit}`;
|
|
385
|
-
}
|
|
386
|
-
function auto(str) {
|
|
387
|
-
if (str === "auto" || str === "a")
|
|
388
|
-
return "auto";
|
|
389
|
-
}
|
|
390
|
-
function rem(str) {
|
|
391
|
-
if (str.match(unitOnlyRE))
|
|
392
|
-
return `1${str}`;
|
|
393
|
-
const match = str.match(numberWithUnitRE);
|
|
394
|
-
if (!match)
|
|
395
|
-
return;
|
|
396
|
-
const [, n, unit] = match;
|
|
397
|
-
const num = parseFloat(n);
|
|
398
|
-
if (!Number.isNaN(num))
|
|
399
|
-
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
400
|
-
}
|
|
401
|
-
function px(str) {
|
|
402
|
-
if (str.match(unitOnlyRE))
|
|
403
|
-
return `1${str}`;
|
|
404
|
-
const match = str.match(numberWithUnitRE);
|
|
405
|
-
if (!match)
|
|
406
|
-
return;
|
|
407
|
-
const [, n, unit] = match;
|
|
408
|
-
const num = parseFloat(n);
|
|
409
|
-
if (!Number.isNaN(num))
|
|
410
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
411
|
-
}
|
|
412
|
-
function number(str) {
|
|
413
|
-
if (!numberRE.test(str))
|
|
414
|
-
return;
|
|
415
|
-
const num = parseFloat(str);
|
|
416
|
-
if (!Number.isNaN(num))
|
|
417
|
-
return round(num);
|
|
418
|
-
}
|
|
419
|
-
function percent(str) {
|
|
420
|
-
if (str.endsWith("%"))
|
|
421
|
-
str = str.slice(0, -1);
|
|
422
|
-
const num = parseFloat(str);
|
|
423
|
-
if (!Number.isNaN(num))
|
|
424
|
-
return `${round(num / 100)}`;
|
|
425
|
-
}
|
|
426
|
-
function fraction(str) {
|
|
427
|
-
if (str === "full")
|
|
428
|
-
return "100%";
|
|
429
|
-
const [left, right] = str.split("/");
|
|
430
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
431
|
-
if (!Number.isNaN(num))
|
|
432
|
-
return `${round(num * 100)}%`;
|
|
433
|
-
}
|
|
434
|
-
const bracketTypeRe = /^\[(color|length|position):/i;
|
|
435
|
-
function bracketWithType(str, type) {
|
|
436
|
-
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
437
|
-
let base;
|
|
438
|
-
const match = str.match(bracketTypeRe);
|
|
439
|
-
if (!match)
|
|
440
|
-
base = str.slice(1, -1);
|
|
441
|
-
else if (type && match[1] === type)
|
|
442
|
-
base = str.slice(match[0].length, -1);
|
|
443
|
-
if (base !== void 0) {
|
|
444
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
|
|
445
|
-
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
function bracket(str) {
|
|
451
|
-
return bracketWithType(str);
|
|
452
|
-
}
|
|
453
|
-
function bracketOfColor(str) {
|
|
454
|
-
return bracketWithType(str, "color");
|
|
455
|
-
}
|
|
456
|
-
function bracketOfLength(str) {
|
|
457
|
-
return bracketWithType(str, "length");
|
|
458
|
-
}
|
|
459
|
-
function bracketOfPosition(str) {
|
|
460
|
-
return bracketWithType(str, "position");
|
|
461
|
-
}
|
|
462
|
-
function cssvar(str) {
|
|
463
|
-
if (str.match(/^\$\S/))
|
|
464
|
-
return `var(--${core.escapeSelector(str.slice(1))})`;
|
|
465
|
-
}
|
|
466
|
-
function time(str) {
|
|
467
|
-
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
468
|
-
if (!match)
|
|
469
|
-
return;
|
|
470
|
-
const [, n, unit] = match;
|
|
471
|
-
const num = parseFloat(n);
|
|
472
|
-
if (!Number.isNaN(num))
|
|
473
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
474
|
-
}
|
|
475
|
-
function degree(str) {
|
|
476
|
-
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
477
|
-
if (!match)
|
|
478
|
-
return;
|
|
479
|
-
const [, n, unit] = match;
|
|
480
|
-
const num = parseFloat(n);
|
|
481
|
-
if (!Number.isNaN(num))
|
|
482
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
483
|
-
}
|
|
484
|
-
function global(str) {
|
|
485
|
-
if (globalKeywords.includes(str))
|
|
486
|
-
return str;
|
|
487
|
-
}
|
|
488
|
-
function properties(str) {
|
|
489
|
-
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
490
|
-
return str;
|
|
491
|
-
}
|
|
492
|
-
function position(str) {
|
|
493
|
-
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
494
|
-
return str;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
const valueHandlers = {
|
|
498
|
-
__proto__: null,
|
|
499
|
-
numberWithUnit: numberWithUnit,
|
|
500
|
-
auto: auto,
|
|
501
|
-
rem: rem,
|
|
502
|
-
px: px,
|
|
503
|
-
number: number,
|
|
504
|
-
percent: percent,
|
|
505
|
-
fraction: fraction,
|
|
506
|
-
bracket: bracket,
|
|
507
|
-
bracketOfColor: bracketOfColor,
|
|
508
|
-
bracketOfLength: bracketOfLength,
|
|
509
|
-
bracketOfPosition: bracketOfPosition,
|
|
510
|
-
cssvar: cssvar,
|
|
511
|
-
time: time,
|
|
512
|
-
degree: degree,
|
|
513
|
-
global: global,
|
|
514
|
-
properties: properties,
|
|
515
|
-
position: position
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
const handler = core.createValueHandler(valueHandlers);
|
|
519
|
-
const h = handler;
|
|
520
|
-
|
|
521
225
|
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
522
226
|
const directionSize = (propertyPrefix) => ([_, direction, size], { theme }) => {
|
|
523
|
-
const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.auto.fraction.rem(size);
|
|
227
|
+
const v = theme.spacing?.[size || "DEFAULT"] ?? index.handler.bracket.cssvar.auto.fraction.rem(size);
|
|
524
228
|
if (v != null)
|
|
525
|
-
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
229
|
+
return index.directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
526
230
|
};
|
|
527
231
|
const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
|
|
528
232
|
const parseColor = (body, theme) => {
|
|
@@ -539,14 +243,14 @@ const parseColor = (body, theme) => {
|
|
|
539
243
|
if (!name)
|
|
540
244
|
return;
|
|
541
245
|
let color;
|
|
542
|
-
const bracket = handler.bracketOfColor(main);
|
|
246
|
+
const bracket = index.handler.bracketOfColor(main);
|
|
543
247
|
const bracketOrMain = bracket || main;
|
|
544
248
|
if (bracketOrMain.startsWith("#"))
|
|
545
249
|
color = bracketOrMain;
|
|
546
250
|
else if (bracketOrMain.startsWith("hex-"))
|
|
547
251
|
color = `#${bracketOrMain.slice(4)}`;
|
|
548
252
|
else if (main.startsWith("$"))
|
|
549
|
-
color = handler.cssvar(main);
|
|
253
|
+
color = index.handler.cssvar(main);
|
|
550
254
|
color = color || bracket;
|
|
551
255
|
let no = "DEFAULT";
|
|
552
256
|
if (!color) {
|
|
@@ -573,7 +277,7 @@ const parseColor = (body, theme) => {
|
|
|
573
277
|
no,
|
|
574
278
|
color,
|
|
575
279
|
cssColor: parseCssColor(color),
|
|
576
|
-
alpha: handler.bracket.cssvar.percent(opacity ?? "")
|
|
280
|
+
alpha: index.handler.bracket.cssvar.percent(opacity ?? "")
|
|
577
281
|
};
|
|
578
282
|
};
|
|
579
283
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
@@ -636,20 +340,11 @@ exports.CONTROL_MINI_NO_NEGATIVE = CONTROL_MINI_NO_NEGATIVE;
|
|
|
636
340
|
exports.colorResolver = colorResolver;
|
|
637
341
|
exports.colorToString = colorToString;
|
|
638
342
|
exports.colorableShadows = colorableShadows;
|
|
639
|
-
exports.cornerMap = cornerMap;
|
|
640
|
-
exports.directionMap = directionMap;
|
|
641
343
|
exports.directionSize = directionSize;
|
|
642
344
|
exports.getComponents = getComponents;
|
|
643
|
-
exports.globalKeywords = globalKeywords;
|
|
644
|
-
exports.h = h;
|
|
645
|
-
exports.handler = handler;
|
|
646
345
|
exports.hasParseableColor = hasParseableColor;
|
|
647
346
|
exports.hex2rgba = hex2rgba;
|
|
648
|
-
exports.insetMap = insetMap;
|
|
649
347
|
exports.parseColor = parseColor;
|
|
650
348
|
exports.parseCssColor = parseCssColor;
|
|
651
|
-
exports.positionMap = positionMap;
|
|
652
349
|
exports.resolveBreakpoints = resolveBreakpoints;
|
|
653
350
|
exports.resolveVerticalBreakpoints = resolveVerticalBreakpoints;
|
|
654
|
-
exports.valueHandlers = valueHandlers;
|
|
655
|
-
exports.xyzMap = xyzMap;
|
|
@@ -1,98 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const directionMap = {
|
|
4
|
-
"l": ["-left"],
|
|
5
|
-
"r": ["-right"],
|
|
6
|
-
"t": ["-top"],
|
|
7
|
-
"b": ["-bottom"],
|
|
8
|
-
"s": ["-inline-start"],
|
|
9
|
-
"e": ["-inline-end"],
|
|
10
|
-
"x": ["-left", "-right"],
|
|
11
|
-
"y": ["-top", "-bottom"],
|
|
12
|
-
"": [""],
|
|
13
|
-
"bs": ["-block-start"],
|
|
14
|
-
"be": ["-block-end"],
|
|
15
|
-
"is": ["-inline-start"],
|
|
16
|
-
"ie": ["-inline-end"],
|
|
17
|
-
"block": ["-block-start", "-block-end"],
|
|
18
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
19
|
-
};
|
|
20
|
-
const insetMap = {
|
|
21
|
-
...directionMap,
|
|
22
|
-
s: ["-inset-inline-start"],
|
|
23
|
-
e: ["-inset-inline-end"],
|
|
24
|
-
bs: ["-inset-block-start"],
|
|
25
|
-
be: ["-inset-block-end"],
|
|
26
|
-
is: ["-inset-inline-start"],
|
|
27
|
-
ie: ["-inset-inline-end"],
|
|
28
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
29
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
30
|
-
};
|
|
31
|
-
const cornerMap = {
|
|
32
|
-
"l": ["-top-left", "-bottom-left"],
|
|
33
|
-
"r": ["-top-right", "-bottom-right"],
|
|
34
|
-
"t": ["-top-left", "-top-right"],
|
|
35
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
36
|
-
"tl": ["-top-left"],
|
|
37
|
-
"lt": ["-top-left"],
|
|
38
|
-
"tr": ["-top-right"],
|
|
39
|
-
"rt": ["-top-right"],
|
|
40
|
-
"bl": ["-bottom-left"],
|
|
41
|
-
"lb": ["-bottom-left"],
|
|
42
|
-
"br": ["-bottom-right"],
|
|
43
|
-
"rb": ["-bottom-right"],
|
|
44
|
-
"": [""],
|
|
45
|
-
"bs": ["-start-start", "-start-end"],
|
|
46
|
-
"be": ["-end-start", "-end-end"],
|
|
47
|
-
"is": ["-end-start", "-start-start"],
|
|
48
|
-
"ie": ["-start-end", "-end-end"],
|
|
49
|
-
"bs-is": ["-start-start"],
|
|
50
|
-
"is-bs": ["-start-start"],
|
|
51
|
-
"bs-ie": ["-start-end"],
|
|
52
|
-
"ie-bs": ["-start-end"],
|
|
53
|
-
"be-is": ["-end-start"],
|
|
54
|
-
"is-be": ["-end-start"],
|
|
55
|
-
"be-ie": ["-end-end"],
|
|
56
|
-
"ie-be": ["-end-end"]
|
|
57
|
-
};
|
|
58
|
-
const xyzMap = {
|
|
59
|
-
"x": ["-x"],
|
|
60
|
-
"y": ["-y"],
|
|
61
|
-
"z": ["-z"],
|
|
62
|
-
"": ["-x", "-y"]
|
|
63
|
-
};
|
|
64
|
-
const basePositionMap = [
|
|
65
|
-
"top",
|
|
66
|
-
"top center",
|
|
67
|
-
"top left",
|
|
68
|
-
"top right",
|
|
69
|
-
"bottom",
|
|
70
|
-
"bottom center",
|
|
71
|
-
"bottom left",
|
|
72
|
-
"bottom right",
|
|
73
|
-
"left",
|
|
74
|
-
"left center",
|
|
75
|
-
"left top",
|
|
76
|
-
"left bottom",
|
|
77
|
-
"right",
|
|
78
|
-
"right center",
|
|
79
|
-
"right top",
|
|
80
|
-
"right bottom",
|
|
81
|
-
"center",
|
|
82
|
-
"center top",
|
|
83
|
-
"center bottom",
|
|
84
|
-
"center left",
|
|
85
|
-
"center right",
|
|
86
|
-
"center center"
|
|
87
|
-
];
|
|
88
|
-
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
89
|
-
const globalKeywords = [
|
|
90
|
-
"inherit",
|
|
91
|
-
"initial",
|
|
92
|
-
"revert",
|
|
93
|
-
"revert-layer",
|
|
94
|
-
"unset"
|
|
95
|
-
];
|
|
1
|
+
import { toArray } from '@unocss/core';
|
|
2
|
+
import { h as handler, d as directionMap } from './index.mjs';
|
|
96
3
|
|
|
97
4
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
98
5
|
function hex2rgba(hex = "") {
|
|
@@ -313,209 +220,6 @@ function getComponents(str, separator, limit) {
|
|
|
313
220
|
return components;
|
|
314
221
|
}
|
|
315
222
|
|
|
316
|
-
const cssProps = [
|
|
317
|
-
"color",
|
|
318
|
-
"border-color",
|
|
319
|
-
"background-color",
|
|
320
|
-
"flex-grow",
|
|
321
|
-
"flex",
|
|
322
|
-
"flex-shrink",
|
|
323
|
-
"caret-color",
|
|
324
|
-
"font",
|
|
325
|
-
"gap",
|
|
326
|
-
"opacity",
|
|
327
|
-
"visibility",
|
|
328
|
-
"z-index",
|
|
329
|
-
"font-weight",
|
|
330
|
-
"zoom",
|
|
331
|
-
"text-shadow",
|
|
332
|
-
"transform",
|
|
333
|
-
"box-shadow",
|
|
334
|
-
"backround-position",
|
|
335
|
-
"left",
|
|
336
|
-
"right",
|
|
337
|
-
"top",
|
|
338
|
-
"bottom",
|
|
339
|
-
"object-position",
|
|
340
|
-
"max-height",
|
|
341
|
-
"min-height",
|
|
342
|
-
"max-width",
|
|
343
|
-
"min-width",
|
|
344
|
-
"height",
|
|
345
|
-
"width",
|
|
346
|
-
"border-width",
|
|
347
|
-
"margin",
|
|
348
|
-
"padding",
|
|
349
|
-
"outline-width",
|
|
350
|
-
"outline-offset",
|
|
351
|
-
"font-size",
|
|
352
|
-
"line-height",
|
|
353
|
-
"text-indent",
|
|
354
|
-
"vertical-align",
|
|
355
|
-
"border-spacing",
|
|
356
|
-
"letter-spacing",
|
|
357
|
-
"word-spacing",
|
|
358
|
-
"stroke",
|
|
359
|
-
"filter",
|
|
360
|
-
"backdrop-filter",
|
|
361
|
-
"fill",
|
|
362
|
-
"mask",
|
|
363
|
-
"mask-size",
|
|
364
|
-
"mask-border",
|
|
365
|
-
"clip-path",
|
|
366
|
-
"clip",
|
|
367
|
-
"border-radius"
|
|
368
|
-
];
|
|
369
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
|
|
370
|
-
const numberRE = /^(-?[0-9.]+)$/i;
|
|
371
|
-
const unitOnlyRE = /^(px)$/i;
|
|
372
|
-
function round(n) {
|
|
373
|
-
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
374
|
-
}
|
|
375
|
-
function numberWithUnit(str) {
|
|
376
|
-
const match = str.match(numberWithUnitRE);
|
|
377
|
-
if (!match)
|
|
378
|
-
return;
|
|
379
|
-
const [, n, unit] = match;
|
|
380
|
-
const num = parseFloat(n);
|
|
381
|
-
if (unit && !Number.isNaN(num))
|
|
382
|
-
return `${round(num)}${unit}`;
|
|
383
|
-
}
|
|
384
|
-
function auto(str) {
|
|
385
|
-
if (str === "auto" || str === "a")
|
|
386
|
-
return "auto";
|
|
387
|
-
}
|
|
388
|
-
function rem(str) {
|
|
389
|
-
if (str.match(unitOnlyRE))
|
|
390
|
-
return `1${str}`;
|
|
391
|
-
const match = str.match(numberWithUnitRE);
|
|
392
|
-
if (!match)
|
|
393
|
-
return;
|
|
394
|
-
const [, n, unit] = match;
|
|
395
|
-
const num = parseFloat(n);
|
|
396
|
-
if (!Number.isNaN(num))
|
|
397
|
-
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
398
|
-
}
|
|
399
|
-
function px(str) {
|
|
400
|
-
if (str.match(unitOnlyRE))
|
|
401
|
-
return `1${str}`;
|
|
402
|
-
const match = str.match(numberWithUnitRE);
|
|
403
|
-
if (!match)
|
|
404
|
-
return;
|
|
405
|
-
const [, n, unit] = match;
|
|
406
|
-
const num = parseFloat(n);
|
|
407
|
-
if (!Number.isNaN(num))
|
|
408
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
409
|
-
}
|
|
410
|
-
function number(str) {
|
|
411
|
-
if (!numberRE.test(str))
|
|
412
|
-
return;
|
|
413
|
-
const num = parseFloat(str);
|
|
414
|
-
if (!Number.isNaN(num))
|
|
415
|
-
return round(num);
|
|
416
|
-
}
|
|
417
|
-
function percent(str) {
|
|
418
|
-
if (str.endsWith("%"))
|
|
419
|
-
str = str.slice(0, -1);
|
|
420
|
-
const num = parseFloat(str);
|
|
421
|
-
if (!Number.isNaN(num))
|
|
422
|
-
return `${round(num / 100)}`;
|
|
423
|
-
}
|
|
424
|
-
function fraction(str) {
|
|
425
|
-
if (str === "full")
|
|
426
|
-
return "100%";
|
|
427
|
-
const [left, right] = str.split("/");
|
|
428
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
429
|
-
if (!Number.isNaN(num))
|
|
430
|
-
return `${round(num * 100)}%`;
|
|
431
|
-
}
|
|
432
|
-
const bracketTypeRe = /^\[(color|length|position):/i;
|
|
433
|
-
function bracketWithType(str, type) {
|
|
434
|
-
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
435
|
-
let base;
|
|
436
|
-
const match = str.match(bracketTypeRe);
|
|
437
|
-
if (!match)
|
|
438
|
-
base = str.slice(1, -1);
|
|
439
|
-
else if (type && match[1] === type)
|
|
440
|
-
base = str.slice(match[0].length, -1);
|
|
441
|
-
if (base !== void 0) {
|
|
442
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
|
|
443
|
-
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
function bracket(str) {
|
|
449
|
-
return bracketWithType(str);
|
|
450
|
-
}
|
|
451
|
-
function bracketOfColor(str) {
|
|
452
|
-
return bracketWithType(str, "color");
|
|
453
|
-
}
|
|
454
|
-
function bracketOfLength(str) {
|
|
455
|
-
return bracketWithType(str, "length");
|
|
456
|
-
}
|
|
457
|
-
function bracketOfPosition(str) {
|
|
458
|
-
return bracketWithType(str, "position");
|
|
459
|
-
}
|
|
460
|
-
function cssvar(str) {
|
|
461
|
-
if (str.match(/^\$\S/))
|
|
462
|
-
return `var(--${escapeSelector(str.slice(1))})`;
|
|
463
|
-
}
|
|
464
|
-
function time(str) {
|
|
465
|
-
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
466
|
-
if (!match)
|
|
467
|
-
return;
|
|
468
|
-
const [, n, unit] = match;
|
|
469
|
-
const num = parseFloat(n);
|
|
470
|
-
if (!Number.isNaN(num))
|
|
471
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
472
|
-
}
|
|
473
|
-
function degree(str) {
|
|
474
|
-
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
475
|
-
if (!match)
|
|
476
|
-
return;
|
|
477
|
-
const [, n, unit] = match;
|
|
478
|
-
const num = parseFloat(n);
|
|
479
|
-
if (!Number.isNaN(num))
|
|
480
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
481
|
-
}
|
|
482
|
-
function global(str) {
|
|
483
|
-
if (globalKeywords.includes(str))
|
|
484
|
-
return str;
|
|
485
|
-
}
|
|
486
|
-
function properties(str) {
|
|
487
|
-
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
488
|
-
return str;
|
|
489
|
-
}
|
|
490
|
-
function position(str) {
|
|
491
|
-
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
492
|
-
return str;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
const valueHandlers = {
|
|
496
|
-
__proto__: null,
|
|
497
|
-
numberWithUnit: numberWithUnit,
|
|
498
|
-
auto: auto,
|
|
499
|
-
rem: rem,
|
|
500
|
-
px: px,
|
|
501
|
-
number: number,
|
|
502
|
-
percent: percent,
|
|
503
|
-
fraction: fraction,
|
|
504
|
-
bracket: bracket,
|
|
505
|
-
bracketOfColor: bracketOfColor,
|
|
506
|
-
bracketOfLength: bracketOfLength,
|
|
507
|
-
bracketOfPosition: bracketOfPosition,
|
|
508
|
-
cssvar: cssvar,
|
|
509
|
-
time: time,
|
|
510
|
-
degree: degree,
|
|
511
|
-
global: global,
|
|
512
|
-
properties: properties,
|
|
513
|
-
position: position
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
const handler = createValueHandler(valueHandlers);
|
|
517
|
-
const h = handler;
|
|
518
|
-
|
|
519
223
|
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
520
224
|
const directionSize = (propertyPrefix) => ([_, direction, size], { theme }) => {
|
|
521
225
|
const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.auto.fraction.rem(size);
|
|
@@ -630,4 +334,4 @@ const resolveVerticalBreakpoints = ({ theme, generator }) => {
|
|
|
630
334
|
return verticalBreakpoints;
|
|
631
335
|
};
|
|
632
336
|
|
|
633
|
-
export { CONTROL_MINI_NO_NEGATIVE as C,
|
|
337
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, colorToString as a, colorableShadows as b, colorResolver as c, resolveBreakpoints as d, directionSize as e, hex2rgba as f, parseCssColor as g, hasParseableColor as h, getComponents as i, parseColor as p, resolveVerticalBreakpoints as r };
|
package/dist/colors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { c as colors } from './colors-
|
|
2
|
-
import './types-
|
|
1
|
+
export { c as colors } from './colors-5590b862.js';
|
|
2
|
+
import './types-0f7ef446.js';
|