@unocss/preset-mini 0.55.6 → 0.56.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.cjs +8 -8
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -7
- package/dist/rules.cjs +129 -128
- package/dist/rules.mjs +4 -3
- package/dist/shared/{preset-mini.b4ad509c.cjs → preset-mini.3a376028.cjs} +14 -284
- package/dist/shared/{preset-mini.0fac4963.mjs → preset-mini.4fe01d46.mjs} +3 -5
- package/dist/shared/{preset-mini.c0e4a0cc.d.ts → preset-mini.79297e15.d.ts} +3 -6
- package/dist/shared/{preset-mini.f1fe435e.mjs → preset-mini.8929b018.mjs} +7 -270
- package/dist/shared/{preset-mini.8ff442ab.d.mts → preset-mini.97d1ec1e.d.mts} +3 -6
- package/dist/shared/{preset-mini.f9bfbfc9.d.cts → preset-mini.d62ae954.d.cts} +3 -6
- package/dist/shared/{preset-mini.5bfee53b.cjs → preset-mini.f22c1fe0.cjs} +39 -41
- package/dist/theme.cjs +3 -2
- package/dist/theme.mjs +3 -2
- package/dist/utils.cjs +26 -107
- package/dist/utils.d.cts +7 -16
- package/dist/utils.d.mts +7 -16
- package/dist/utils.d.ts +7 -16
- package/dist/utils.mjs +3 -81
- package/dist/variants.cjs +41 -41
- package/dist/variants.d.cts +1 -1
- package/dist/variants.d.mts +1 -1
- package/dist/variants.d.ts +1 -1
- package/dist/variants.mjs +3 -3
- package/package.json +4 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createValueHandler, parseCssColor, colorToString, colorOpacityToString, getStringComponents } from '@unocss/rule-utils';
|
|
2
|
+
import { escapeSelector, toArray } from '@unocss/core';
|
|
2
3
|
|
|
3
4
|
const directionMap = {
|
|
4
5
|
"l": ["-left"],
|
|
@@ -397,7 +398,7 @@ function splitShorthand(body, type) {
|
|
|
397
398
|
}
|
|
398
399
|
return split;
|
|
399
400
|
}
|
|
400
|
-
function parseColor
|
|
401
|
+
function parseColor(body, theme) {
|
|
401
402
|
const [main, opacity] = splitShorthand(body, "color");
|
|
402
403
|
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
403
404
|
const [name] = colors;
|
|
@@ -454,7 +455,7 @@ function parseColor$1(body, theme) {
|
|
|
454
455
|
}
|
|
455
456
|
function colorResolver(property, varName, shouldPass) {
|
|
456
457
|
return ([, body], { theme }) => {
|
|
457
|
-
const data = parseColor
|
|
458
|
+
const data = parseColor(body, theme);
|
|
458
459
|
if (!data)
|
|
459
460
|
return;
|
|
460
461
|
const { alpha, color, cssColor } = data;
|
|
@@ -477,7 +478,7 @@ function colorableShadows(shadows, colorVar) {
|
|
|
477
478
|
const colored = [];
|
|
478
479
|
shadows = toArray(shadows);
|
|
479
480
|
for (let i = 0; i < shadows.length; i++) {
|
|
480
|
-
const components =
|
|
481
|
+
const components = getStringComponents(shadows[i], " ", 6);
|
|
481
482
|
if (!components || components.length < 3)
|
|
482
483
|
return shadows;
|
|
483
484
|
const color = parseCssColor(components.pop());
|
|
@@ -488,7 +489,7 @@ function colorableShadows(shadows, colorVar) {
|
|
|
488
489
|
return colored;
|
|
489
490
|
}
|
|
490
491
|
function hasParseableColor(color, theme) {
|
|
491
|
-
return color != null && !!parseColor
|
|
492
|
+
return color != null && !!parseColor(color, theme)?.color;
|
|
492
493
|
}
|
|
493
494
|
function resolveBreakpoints({ theme, generator }) {
|
|
494
495
|
let breakpoints;
|
|
@@ -509,269 +510,5 @@ function resolveVerticalBreakpoints({ theme, generator }) {
|
|
|
509
510
|
function makeGlobalStaticRules(prefix, property) {
|
|
510
511
|
return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
|
|
511
512
|
}
|
|
512
|
-
function getBracket(str, open, close) {
|
|
513
|
-
if (str === "")
|
|
514
|
-
return;
|
|
515
|
-
const l = str.length;
|
|
516
|
-
let parenthesis = 0;
|
|
517
|
-
let opened = false;
|
|
518
|
-
let openAt = 0;
|
|
519
|
-
for (let i = 0; i < l; i++) {
|
|
520
|
-
switch (str[i]) {
|
|
521
|
-
case open:
|
|
522
|
-
if (!opened) {
|
|
523
|
-
opened = true;
|
|
524
|
-
openAt = i;
|
|
525
|
-
}
|
|
526
|
-
parenthesis++;
|
|
527
|
-
break;
|
|
528
|
-
case close:
|
|
529
|
-
--parenthesis;
|
|
530
|
-
if (parenthesis < 0)
|
|
531
|
-
return;
|
|
532
|
-
if (parenthesis === 0) {
|
|
533
|
-
return [
|
|
534
|
-
str.slice(openAt, i + 1),
|
|
535
|
-
str.slice(i + 1),
|
|
536
|
-
str.slice(0, openAt)
|
|
537
|
-
];
|
|
538
|
-
}
|
|
539
|
-
break;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
function getComponent(str, open, close, separators) {
|
|
544
|
-
if (str === "")
|
|
545
|
-
return;
|
|
546
|
-
if (isString(separators))
|
|
547
|
-
separators = [separators];
|
|
548
|
-
if (separators.length === 0)
|
|
549
|
-
return;
|
|
550
|
-
const l = str.length;
|
|
551
|
-
let parenthesis = 0;
|
|
552
|
-
for (let i = 0; i < l; i++) {
|
|
553
|
-
switch (str[i]) {
|
|
554
|
-
case open:
|
|
555
|
-
parenthesis++;
|
|
556
|
-
break;
|
|
557
|
-
case close:
|
|
558
|
-
if (--parenthesis < 0)
|
|
559
|
-
return;
|
|
560
|
-
break;
|
|
561
|
-
default:
|
|
562
|
-
for (const separator of separators) {
|
|
563
|
-
const separatorLength = separator.length;
|
|
564
|
-
if (separatorLength && separator === str.slice(i, i + separatorLength) && parenthesis === 0) {
|
|
565
|
-
if (i === 0 || i === l - separatorLength)
|
|
566
|
-
return;
|
|
567
|
-
return [
|
|
568
|
-
str.slice(0, i),
|
|
569
|
-
str.slice(i + separatorLength)
|
|
570
|
-
];
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return [
|
|
576
|
-
str,
|
|
577
|
-
""
|
|
578
|
-
];
|
|
579
|
-
}
|
|
580
|
-
function getComponents(str, separators, limit) {
|
|
581
|
-
limit = limit ?? 10;
|
|
582
|
-
const components = [];
|
|
583
|
-
let i = 0;
|
|
584
|
-
while (str !== "") {
|
|
585
|
-
if (++i > limit)
|
|
586
|
-
return;
|
|
587
|
-
const componentPair = getComponent(str, "(", ")", separators);
|
|
588
|
-
if (!componentPair)
|
|
589
|
-
return;
|
|
590
|
-
const [component, rest] = componentPair;
|
|
591
|
-
components.push(component);
|
|
592
|
-
str = rest;
|
|
593
|
-
}
|
|
594
|
-
if (components.length > 0)
|
|
595
|
-
return components;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
599
|
-
const alphaPlaceholders = ["%alpha", "<alpha-value>"];
|
|
600
|
-
const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|"));
|
|
601
|
-
function hex2rgba(hex = "") {
|
|
602
|
-
const color = parseHexColor(hex);
|
|
603
|
-
if (color != null) {
|
|
604
|
-
const { components, alpha } = color;
|
|
605
|
-
if (alpha == null)
|
|
606
|
-
return components;
|
|
607
|
-
return [...components, alpha];
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function parseCssColor(str = "") {
|
|
611
|
-
const color = parseColor(str);
|
|
612
|
-
if (color == null || color === false)
|
|
613
|
-
return;
|
|
614
|
-
const { type: casedType, components, alpha } = color;
|
|
615
|
-
const type = casedType.toLowerCase();
|
|
616
|
-
if (components.length === 0)
|
|
617
|
-
return;
|
|
618
|
-
if (["rgba", "hsla"].includes(type) && alpha == null)
|
|
619
|
-
return;
|
|
620
|
-
if (cssColorFunctions.includes(type) && ![1, 3].includes(components.length))
|
|
621
|
-
return;
|
|
622
|
-
return {
|
|
623
|
-
type,
|
|
624
|
-
components: components.map((c) => typeof c === "string" ? c.trim() : c),
|
|
625
|
-
alpha: typeof alpha === "string" ? alpha.trim() : alpha
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
function colorOpacityToString(color) {
|
|
629
|
-
const alpha = color.alpha ?? 1;
|
|
630
|
-
return typeof alpha === "string" && alphaPlaceholders.includes(alpha) ? 1 : alpha;
|
|
631
|
-
}
|
|
632
|
-
function colorToString(color, alphaOverride) {
|
|
633
|
-
if (typeof color === "string")
|
|
634
|
-
return color.replace(alphaPlaceholdersRE, `${alphaOverride ?? 1}`);
|
|
635
|
-
const { components } = color;
|
|
636
|
-
let { alpha, type } = color;
|
|
637
|
-
alpha = alphaOverride ?? alpha;
|
|
638
|
-
type = type.toLowerCase();
|
|
639
|
-
if (["hsla", "hsl", "rgba", "rgb"].includes(type))
|
|
640
|
-
return `${type.replace("a", "")}a(${components.join(",")}${alpha == null ? "" : `,${alpha}`})`;
|
|
641
|
-
alpha = alpha == null ? "" : ` / ${alpha}`;
|
|
642
|
-
if (cssColorFunctions.includes(type))
|
|
643
|
-
return `${type}(${components.join(" ")}${alpha})`;
|
|
644
|
-
return `color(${type} ${components.join(" ")}${alpha})`;
|
|
645
|
-
}
|
|
646
|
-
function parseColor(str) {
|
|
647
|
-
if (!str)
|
|
648
|
-
return;
|
|
649
|
-
let color = parseHexColor(str);
|
|
650
|
-
if (color != null)
|
|
651
|
-
return color;
|
|
652
|
-
color = cssColorKeyword(str);
|
|
653
|
-
if (color != null)
|
|
654
|
-
return color;
|
|
655
|
-
color = parseCssCommaColorFunction(str);
|
|
656
|
-
if (color != null)
|
|
657
|
-
return color;
|
|
658
|
-
color = parseCssSpaceColorFunction(str);
|
|
659
|
-
if (color != null)
|
|
660
|
-
return color;
|
|
661
|
-
color = parseCssColorFunction(str);
|
|
662
|
-
if (color != null)
|
|
663
|
-
return color;
|
|
664
|
-
}
|
|
665
|
-
function parseHexColor(str) {
|
|
666
|
-
const [, body] = str.match(/^#([\da-f]+)$/i) || [];
|
|
667
|
-
if (!body)
|
|
668
|
-
return;
|
|
669
|
-
switch (body.length) {
|
|
670
|
-
case 3:
|
|
671
|
-
case 4:
|
|
672
|
-
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
|
|
673
|
-
return {
|
|
674
|
-
type: "rgb",
|
|
675
|
-
components: digits.slice(0, 3),
|
|
676
|
-
alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
|
|
677
|
-
};
|
|
678
|
-
case 6:
|
|
679
|
-
case 8:
|
|
680
|
-
const value = Number.parseInt(body, 16);
|
|
681
|
-
return {
|
|
682
|
-
type: "rgb",
|
|
683
|
-
components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
|
|
684
|
-
alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
function cssColorKeyword(str) {
|
|
689
|
-
const color = {
|
|
690
|
-
rebeccapurple: [102, 51, 153, 1]
|
|
691
|
-
}[str];
|
|
692
|
-
if (color != null) {
|
|
693
|
-
return {
|
|
694
|
-
type: "rgb",
|
|
695
|
-
components: color.slice(0, 3),
|
|
696
|
-
alpha: color[3]
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
function parseCssCommaColorFunction(color) {
|
|
701
|
-
const match = color.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i);
|
|
702
|
-
if (!match)
|
|
703
|
-
return;
|
|
704
|
-
const [, type, componentString] = match;
|
|
705
|
-
const components = getComponents(componentString, ",", 5);
|
|
706
|
-
if (components) {
|
|
707
|
-
if ([3, 4].includes(components.length)) {
|
|
708
|
-
return {
|
|
709
|
-
type,
|
|
710
|
-
components: components.slice(0, 3),
|
|
711
|
-
alpha: components[3]
|
|
712
|
-
};
|
|
713
|
-
} else if (components.length !== 1) {
|
|
714
|
-
return false;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
|
|
719
|
-
function parseCssSpaceColorFunction(color) {
|
|
720
|
-
const match = color.match(cssColorFunctionsRe);
|
|
721
|
-
if (!match)
|
|
722
|
-
return;
|
|
723
|
-
const [, fn, componentString] = match;
|
|
724
|
-
const parsed = parseCssSpaceColorValues(`${fn} ${componentString}`);
|
|
725
|
-
if (parsed) {
|
|
726
|
-
const { alpha, components: [type, ...components] } = parsed;
|
|
727
|
-
return {
|
|
728
|
-
type,
|
|
729
|
-
components,
|
|
730
|
-
alpha
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
function parseCssColorFunction(color) {
|
|
735
|
-
const match = color.match(/^color\((.+)\)$/);
|
|
736
|
-
if (!match)
|
|
737
|
-
return;
|
|
738
|
-
const parsed = parseCssSpaceColorValues(match[1]);
|
|
739
|
-
if (parsed) {
|
|
740
|
-
const { alpha, components: [type, ...components] } = parsed;
|
|
741
|
-
return {
|
|
742
|
-
type,
|
|
743
|
-
components,
|
|
744
|
-
alpha
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
function parseCssSpaceColorValues(componentString) {
|
|
749
|
-
const components = getComponents(componentString, " ");
|
|
750
|
-
if (!components)
|
|
751
|
-
return;
|
|
752
|
-
let totalComponents = components.length;
|
|
753
|
-
if (components[totalComponents - 2] === "/") {
|
|
754
|
-
return {
|
|
755
|
-
components: components.slice(0, totalComponents - 2),
|
|
756
|
-
alpha: components[totalComponents - 1]
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
if (components[totalComponents - 2] != null && (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/"))) {
|
|
760
|
-
const removed = components.splice(totalComponents - 2);
|
|
761
|
-
components.push(removed.join(" "));
|
|
762
|
-
--totalComponents;
|
|
763
|
-
}
|
|
764
|
-
const withAlpha = getComponents(components[totalComponents - 1], "/", 2);
|
|
765
|
-
if (!withAlpha)
|
|
766
|
-
return;
|
|
767
|
-
if (withAlpha.length === 1 || withAlpha[withAlpha.length - 1] === "")
|
|
768
|
-
return { components };
|
|
769
|
-
const alpha = withAlpha.pop();
|
|
770
|
-
components[totalComponents - 1] = withAlpha.join("/");
|
|
771
|
-
return {
|
|
772
|
-
components,
|
|
773
|
-
alpha
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
513
|
|
|
777
|
-
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorableShadows as b, colorResolver as c, positionMap as d,
|
|
514
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorableShadows as b, colorResolver as c, positionMap as d, directionMap as e, cornerMap as f, globalKeywords as g, h, insetMap as i, resolveBreakpoints as j, directionSize as k, handler as l, makeGlobalStaticRules as m, numberWithUnitRE as n, parseColor as p, resolveVerticalBreakpoints as r, splitShorthand as s, valueHandlers as v, xyzMap as x };
|
|
@@ -51,8 +51,8 @@ declare function parseColor(body: string, theme: Theme): ParsedColorValue | unde
|
|
|
51
51
|
*
|
|
52
52
|
* @param {string} property - Property for the css value to be created.
|
|
53
53
|
* @param {string} varName - Base name for the opacity variable.
|
|
54
|
-
* @param {
|
|
55
|
-
* @return {
|
|
54
|
+
* @param {Function} [shouldPass] - Function to decide whether to pass the css.
|
|
55
|
+
* @return {DynamicMatcher} object.
|
|
56
56
|
*/
|
|
57
57
|
declare function colorResolver(property: string, varName: string, shouldPass?: (css: CSSObject) => boolean): DynamicMatcher;
|
|
58
58
|
declare function colorableShadows(shadows: string | string[], colorVar: string): string[];
|
|
@@ -60,8 +60,5 @@ declare function hasParseableColor(color: string | undefined, theme: Theme): boo
|
|
|
60
60
|
declare function resolveBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
|
|
61
61
|
declare function resolveVerticalBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
|
|
62
62
|
declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
|
|
63
|
-
declare function getBracket(str: string, open: string, close: string): string[] | undefined;
|
|
64
|
-
declare function getComponent(str: string, open: string, close: string, separators: string | string[]): string[] | undefined;
|
|
65
|
-
declare function getComponents(str: string, separators: string | string[], limit?: number): string[] | undefined;
|
|
66
63
|
|
|
67
|
-
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d,
|
|
64
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, hasParseableColor as h, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
|
|
@@ -51,8 +51,8 @@ declare function parseColor(body: string, theme: Theme): ParsedColorValue | unde
|
|
|
51
51
|
*
|
|
52
52
|
* @param {string} property - Property for the css value to be created.
|
|
53
53
|
* @param {string} varName - Base name for the opacity variable.
|
|
54
|
-
* @param {
|
|
55
|
-
* @return {
|
|
54
|
+
* @param {Function} [shouldPass] - Function to decide whether to pass the css.
|
|
55
|
+
* @return {DynamicMatcher} object.
|
|
56
56
|
*/
|
|
57
57
|
declare function colorResolver(property: string, varName: string, shouldPass?: (css: CSSObject) => boolean): DynamicMatcher;
|
|
58
58
|
declare function colorableShadows(shadows: string | string[], colorVar: string): string[];
|
|
@@ -60,8 +60,5 @@ declare function hasParseableColor(color: string | undefined, theme: Theme): boo
|
|
|
60
60
|
declare function resolveBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
|
|
61
61
|
declare function resolveVerticalBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
|
|
62
62
|
declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
|
|
63
|
-
declare function getBracket(str: string, open: string, close: string): string[] | undefined;
|
|
64
|
-
declare function getComponent(str: string, open: string, close: string, separators: string | string[]): string[] | undefined;
|
|
65
|
-
declare function getComponents(str: string, separators: string | string[], limit?: number): string[] | undefined;
|
|
66
63
|
|
|
67
|
-
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d,
|
|
64
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, hasParseableColor as h, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const utils = require('./preset-mini.3a376028.cjs');
|
|
4
4
|
|
|
5
5
|
const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
|
|
6
6
|
const containValues = ["none", "strict", "content", "size", "inline-size", "layout", "style", "paint"];
|
|
@@ -13,24 +13,24 @@ const displays = [
|
|
|
13
13
|
["flow-root", { display: "flow-root" }],
|
|
14
14
|
["list-item", { display: "list-item" }],
|
|
15
15
|
["hidden", { display: "none" }],
|
|
16
|
-
[/^display-(.+)$/, ([, c]) => ({ display:
|
|
16
|
+
[/^display-(.+)$/, ([, c]) => ({ display: utils.h.bracket.cssvar.global(c) || c })]
|
|
17
17
|
];
|
|
18
18
|
const appearances = [
|
|
19
19
|
["visible", { visibility: "visible" }],
|
|
20
20
|
["invisible", { visibility: "hidden" }],
|
|
21
21
|
["backface-visible", { "backface-visibility": "visible" }],
|
|
22
22
|
["backface-hidden", { "backface-visibility": "hidden" }],
|
|
23
|
-
...
|
|
23
|
+
...utils.makeGlobalStaticRules("backface", "backface-visibility")
|
|
24
24
|
];
|
|
25
25
|
const cursors = [
|
|
26
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor:
|
|
26
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: utils.h.bracket.cssvar.global(c) })],
|
|
27
27
|
...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
|
|
28
28
|
];
|
|
29
29
|
const contains = [
|
|
30
30
|
[/^contain-(.*)$/, ([, d]) => {
|
|
31
|
-
if (
|
|
31
|
+
if (utils.h.bracket(d) != null) {
|
|
32
32
|
return {
|
|
33
|
-
contain:
|
|
33
|
+
contain: utils.h.bracket(d).split(" ").map((e) => utils.h.cssvar.fraction(e) ?? e).join(" ")
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
return containValues.includes(d) ? { contain: d } : void 0;
|
|
@@ -39,38 +39,38 @@ const contains = [
|
|
|
39
39
|
const pointerEvents = [
|
|
40
40
|
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
41
41
|
["pointer-events-none", { "pointer-events": "none" }],
|
|
42
|
-
...
|
|
42
|
+
...utils.makeGlobalStaticRules("pointer-events")
|
|
43
43
|
];
|
|
44
44
|
const resizes = [
|
|
45
45
|
["resize-x", { resize: "horizontal" }],
|
|
46
46
|
["resize-y", { resize: "vertical" }],
|
|
47
47
|
["resize", { resize: "both" }],
|
|
48
48
|
["resize-none", { resize: "none" }],
|
|
49
|
-
...
|
|
49
|
+
...utils.makeGlobalStaticRules("resize")
|
|
50
50
|
];
|
|
51
51
|
const userSelects = [
|
|
52
52
|
["select-auto", { "-webkit-user-select": "auto", "user-select": "auto" }],
|
|
53
53
|
["select-all", { "-webkit-user-select": "all", "user-select": "all" }],
|
|
54
54
|
["select-text", { "-webkit-user-select": "text", "user-select": "text" }],
|
|
55
55
|
["select-none", { "-webkit-user-select": "none", "user-select": "none" }],
|
|
56
|
-
...
|
|
56
|
+
...utils.makeGlobalStaticRules("select", "user-select")
|
|
57
57
|
];
|
|
58
58
|
const whitespaces = [
|
|
59
59
|
[
|
|
60
60
|
/^(?:whitespace-|ws-)([-\w]+)$/,
|
|
61
|
-
([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...
|
|
61
|
+
([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...utils.globalKeywords].includes(v) ? { "white-space": v } : void 0,
|
|
62
62
|
{ autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
|
|
63
63
|
]
|
|
64
64
|
];
|
|
65
65
|
const contentVisibility = [
|
|
66
|
-
[/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size":
|
|
66
|
+
[/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size": utils.h.bracket.cssvar.global.fraction.rem(d) }), { autocomplete: "intrinsic-size-<num>" }],
|
|
67
67
|
["content-visibility-visible", { "content-visibility": "visible" }],
|
|
68
68
|
["content-visibility-hidden", { "content-visibility": "hidden" }],
|
|
69
69
|
["content-visibility-auto", { "content-visibility": "auto" }],
|
|
70
|
-
...
|
|
70
|
+
...utils.makeGlobalStaticRules("content-visibility")
|
|
71
71
|
];
|
|
72
72
|
const contents = [
|
|
73
|
-
[/^content-(.+)$/, ([, v]) => ({ content:
|
|
73
|
+
[/^content-(.+)$/, ([, v]) => ({ content: utils.h.bracket.cssvar(v) })],
|
|
74
74
|
["content-empty", { content: '""' }],
|
|
75
75
|
["content-none", { content: "none" }]
|
|
76
76
|
];
|
|
@@ -97,7 +97,7 @@ const textTransforms = [
|
|
|
97
97
|
["case-lower", { "text-transform": "lowercase" }],
|
|
98
98
|
["case-capital", { "text-transform": "capitalize" }],
|
|
99
99
|
["case-normal", { "text-transform": "none" }],
|
|
100
|
-
...
|
|
100
|
+
...utils.makeGlobalStaticRules("case", "text-transform")
|
|
101
101
|
];
|
|
102
102
|
const fontStyles = [
|
|
103
103
|
["italic", { "font-style": "italic" }],
|
|
@@ -112,13 +112,11 @@ const fontStyles = [
|
|
|
112
112
|
const fontSmoothings = [
|
|
113
113
|
["antialiased", {
|
|
114
114
|
"-webkit-font-smoothing": "antialiased",
|
|
115
|
-
"-moz-osx-font-smoothing": "grayscale"
|
|
116
|
-
"font-smoothing": "grayscale"
|
|
115
|
+
"-moz-osx-font-smoothing": "grayscale"
|
|
117
116
|
}],
|
|
118
117
|
["subpixel-antialiased", {
|
|
119
118
|
"-webkit-font-smoothing": "auto",
|
|
120
|
-
"-moz-osx-font-smoothing": "auto"
|
|
121
|
-
"font-smoothing": "auto"
|
|
119
|
+
"-moz-osx-font-smoothing": "auto"
|
|
122
120
|
}]
|
|
123
121
|
];
|
|
124
122
|
|
|
@@ -133,7 +131,7 @@ const ringBase = {
|
|
|
133
131
|
const rings = [
|
|
134
132
|
// size
|
|
135
133
|
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
136
|
-
const value = theme.ringWidth?.[d || "DEFAULT"] ??
|
|
134
|
+
const value = theme.ringWidth?.[d || "DEFAULT"] ?? utils.h.px(d || "1");
|
|
137
135
|
if (value) {
|
|
138
136
|
return {
|
|
139
137
|
"--un-ring-width": value,
|
|
@@ -143,16 +141,16 @@ const rings = [
|
|
|
143
141
|
};
|
|
144
142
|
}
|
|
145
143
|
}, { autocomplete: "ring-$ringWidth" }],
|
|
146
|
-
[/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ??
|
|
144
|
+
[/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
|
|
147
145
|
// offset size
|
|
148
146
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
149
|
-
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ??
|
|
147
|
+
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
|
|
150
148
|
// colors
|
|
151
|
-
[/^ring-(.+)$/,
|
|
152
|
-
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity":
|
|
149
|
+
[/^ring-(.+)$/, utils.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
|
|
150
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
|
|
153
151
|
// offset color
|
|
154
|
-
[/^ring-offset-(.+)$/,
|
|
155
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity":
|
|
152
|
+
[/^ring-offset-(.+)$/, utils.colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
|
|
153
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
|
|
156
154
|
// style
|
|
157
155
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
158
156
|
];
|
|
@@ -169,16 +167,16 @@ const boxShadows = [
|
|
|
169
167
|
const [, d] = match;
|
|
170
168
|
const { theme } = context;
|
|
171
169
|
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
172
|
-
const c = d ?
|
|
173
|
-
if ((v != null || c != null) && !
|
|
170
|
+
const c = d ? utils.h.bracket.cssvar(d) : void 0;
|
|
171
|
+
if ((v != null || c != null) && !utils.hasParseableColor(c, theme)) {
|
|
174
172
|
return {
|
|
175
|
-
"--un-shadow":
|
|
173
|
+
"--un-shadow": utils.colorableShadows(v || c, "--un-shadow-color").join(","),
|
|
176
174
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
177
175
|
};
|
|
178
176
|
}
|
|
179
|
-
return
|
|
177
|
+
return utils.colorResolver("--un-shadow-color", "shadow")(match, context);
|
|
180
178
|
}, { autocomplete: ["shadow-$colors", "shadow-$boxShadow"] }],
|
|
181
|
-
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity":
|
|
179
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
|
|
182
180
|
// inset
|
|
183
181
|
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
184
182
|
];
|
|
@@ -231,10 +229,10 @@ const transformBase = {
|
|
|
231
229
|
};
|
|
232
230
|
const transforms = [
|
|
233
231
|
// origins
|
|
234
|
-
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin":
|
|
232
|
+
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utils.positionMap[s] ?? utils.h.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utils.positionMap).join("|")})`, `origin-(${Object.keys(utils.positionMap).join("|")})`] }],
|
|
235
233
|
// perspectives
|
|
236
234
|
[/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
|
|
237
|
-
const v =
|
|
235
|
+
const v = utils.h.bracket.cssvar.px.numberWithUnit(s);
|
|
238
236
|
if (v != null) {
|
|
239
237
|
return {
|
|
240
238
|
"-webkit-perspective": v,
|
|
@@ -244,7 +242,7 @@ const transforms = [
|
|
|
244
242
|
}],
|
|
245
243
|
// skip 1 & 2 letters shortcut
|
|
246
244
|
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
|
|
247
|
-
const v =
|
|
245
|
+
const v = utils.h.bracket.cssvar(s) ?? (s.length >= 3 ? utils.positionMap[s] : void 0);
|
|
248
246
|
if (v != null) {
|
|
249
247
|
return {
|
|
250
248
|
"-webkit-perspective-origin": v,
|
|
@@ -269,28 +267,28 @@ const transforms = [
|
|
|
269
267
|
["transform-cpu", { transform: transformCpu }],
|
|
270
268
|
["transform-gpu", { transform: transformGpu }],
|
|
271
269
|
["transform-none", { transform: "none" }],
|
|
272
|
-
...
|
|
270
|
+
...utils.makeGlobalStaticRules("transform")
|
|
273
271
|
];
|
|
274
272
|
function handleTranslate([, d, b], { theme }) {
|
|
275
|
-
const v = theme.spacing?.[b] ??
|
|
273
|
+
const v = theme.spacing?.[b] ?? utils.h.bracket.cssvar.fraction.rem(b);
|
|
276
274
|
if (v != null) {
|
|
277
275
|
return [
|
|
278
|
-
...
|
|
276
|
+
...utils.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
279
277
|
["transform", transformCpu]
|
|
280
278
|
];
|
|
281
279
|
}
|
|
282
280
|
}
|
|
283
281
|
function handleScale([, d, b]) {
|
|
284
|
-
const v =
|
|
282
|
+
const v = utils.h.bracket.cssvar.fraction.percent(b);
|
|
285
283
|
if (v != null) {
|
|
286
284
|
return [
|
|
287
|
-
...
|
|
285
|
+
...utils.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
288
286
|
["transform", transformCpu]
|
|
289
287
|
];
|
|
290
288
|
}
|
|
291
289
|
}
|
|
292
290
|
function handleRotate([, d = "", b]) {
|
|
293
|
-
const v =
|
|
291
|
+
const v = utils.h.bracket.cssvar.degree(b);
|
|
294
292
|
if (v != null) {
|
|
295
293
|
if (d) {
|
|
296
294
|
return {
|
|
@@ -310,10 +308,10 @@ function handleRotate([, d = "", b]) {
|
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
310
|
function handleSkew([, d, b]) {
|
|
313
|
-
const v =
|
|
311
|
+
const v = utils.h.bracket.cssvar.degree(b);
|
|
314
312
|
if (v != null) {
|
|
315
313
|
return [
|
|
316
|
-
...
|
|
314
|
+
...utils.xyzMap[d].map((i) => [`--un-skew${i}`, v]),
|
|
317
315
|
["transform", transformCpu]
|
|
318
316
|
];
|
|
319
317
|
}
|
package/dist/theme.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const colors = require('./colors.cjs');
|
|
4
|
-
const transform = require('./shared/preset-mini.
|
|
5
|
-
require('./shared/preset-mini.
|
|
4
|
+
const transform = require('./shared/preset-mini.f22c1fe0.cjs');
|
|
5
|
+
require('./shared/preset-mini.3a376028.cjs');
|
|
6
|
+
require('@unocss/rule-utils');
|
|
6
7
|
require('@unocss/core');
|
|
7
8
|
|
|
8
9
|
const fontFamily = {
|
package/dist/theme.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { colors } from './colors.mjs';
|
|
2
|
-
import { t as transformBase, b as boxShadowsBase, r as ringBase } from './shared/preset-mini.
|
|
3
|
-
import './shared/preset-mini.
|
|
2
|
+
import { t as transformBase, b as boxShadowsBase, r as ringBase } from './shared/preset-mini.4fe01d46.mjs';
|
|
3
|
+
import './shared/preset-mini.8929b018.mjs';
|
|
4
|
+
import '@unocss/rule-utils';
|
|
4
5
|
import '@unocss/core';
|
|
5
6
|
|
|
6
7
|
const fontFamily = {
|