@unocss/preset-mini 0.35.2 → 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 +86 -230
- package/dist/chunks/default2.mjs +12 -155
- package/dist/chunks/default3.cjs +34 -12
- package/dist/chunks/default3.mjs +34 -13
- 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 -297
- package/dist/chunks/utilities.mjs +3 -286
- 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 -8
- package/dist/utils.d.ts +9 -5
- 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
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as globalKeywords, h as handler, d as directionMap, c as cornerMap, i as insetMap } from './index.mjs';
|
|
2
|
+
import { c as colorResolver, h as hasParseableColor, p as parseColor, a as colorToString, b as colorableShadows, r as resolveVerticalBreakpoints, d as resolveBreakpoints, e as directionSize } from './utilities.mjs';
|
|
2
3
|
import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
|
|
4
|
+
import { a as transforms } from './transform.mjs';
|
|
3
5
|
|
|
4
6
|
const verticalAlignAlias = {
|
|
5
7
|
"mid": "middle",
|
|
@@ -17,14 +19,14 @@ const verticalAlignAlias = {
|
|
|
17
19
|
const verticalAligns = [
|
|
18
20
|
[/^(?:vertical|align|v)-(.+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
|
|
19
21
|
];
|
|
20
|
-
const textAligns = ["center", "left", "right", "justify", "start", "end",
|
|
22
|
+
const textAligns = ["center", "left", "right", "justify", "start", "end", ...globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
|
|
21
23
|
|
|
22
24
|
const outline = [
|
|
23
25
|
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
|
|
24
26
|
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
|
|
25
27
|
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
26
28
|
["outline", { "outline-style": "solid" }],
|
|
27
|
-
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset",
|
|
29
|
+
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
28
30
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
29
31
|
];
|
|
30
32
|
const appearance = [
|
|
@@ -43,7 +45,7 @@ const willChange = [
|
|
|
43
45
|
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
44
46
|
];
|
|
45
47
|
|
|
46
|
-
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset",
|
|
48
|
+
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords];
|
|
47
49
|
const borders = [
|
|
48
50
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
|
|
49
51
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
@@ -193,7 +195,7 @@ const transitions = [
|
|
|
193
195
|
[
|
|
194
196
|
/^(?:transition-)?property-(.+)$/,
|
|
195
197
|
([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) }),
|
|
196
|
-
{ autocomplete: [`transition-property-(${[
|
|
198
|
+
{ autocomplete: [`transition-property-(${[...globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
|
|
197
199
|
],
|
|
198
200
|
["transition-none", { transition: "none" }]
|
|
199
201
|
];
|
|
@@ -372,7 +374,7 @@ const grids = [
|
|
|
372
374
|
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
|
|
373
375
|
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
|
|
374
376
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
|
|
375
|
-
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(
|
|
377
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
376
378
|
[/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
|
|
377
379
|
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? handler.bracket.cssvar(v)
|
|
378
380
|
})],
|
|
@@ -721,153 +723,6 @@ const margins = [
|
|
|
721
723
|
[/^m-?([bi][se])(?:-?(-?.+))?$/, directionSize("margin")]
|
|
722
724
|
];
|
|
723
725
|
|
|
724
|
-
const transformGpu = {
|
|
725
|
-
"--un-transform": [
|
|
726
|
-
"translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
727
|
-
"rotate(var(--un-rotate))",
|
|
728
|
-
"rotateX(var(--un-rotate-x))",
|
|
729
|
-
"rotateY(var(--un-rotate-y))",
|
|
730
|
-
"rotateZ(var(--un-rotate-z))",
|
|
731
|
-
"skewX(var(--un-skew-x))",
|
|
732
|
-
"skewY(var(--un-skew-y))",
|
|
733
|
-
"scaleX(var(--un-scale-x))",
|
|
734
|
-
"scaleY(var(--un-scale-y))",
|
|
735
|
-
"scaleZ(var(--un-scale-z))"
|
|
736
|
-
].join(" ")
|
|
737
|
-
};
|
|
738
|
-
const transformCpu = {
|
|
739
|
-
"--un-transform": [
|
|
740
|
-
"translateX(var(--un-translate-x))",
|
|
741
|
-
"translateY(var(--un-translate-y))",
|
|
742
|
-
"translateZ(var(--un-translate-z))",
|
|
743
|
-
"rotate(var(--un-rotate))",
|
|
744
|
-
"rotateX(var(--un-rotate-x))",
|
|
745
|
-
"rotateY(var(--un-rotate-y))",
|
|
746
|
-
"rotateZ(var(--un-rotate-z))",
|
|
747
|
-
"skewX(var(--un-skew-x))",
|
|
748
|
-
"skewY(var(--un-skew-y))",
|
|
749
|
-
"scaleX(var(--un-scale-x))",
|
|
750
|
-
"scaleY(var(--un-scale-y))",
|
|
751
|
-
"scaleZ(var(--un-scale-z))"
|
|
752
|
-
].join(" ")
|
|
753
|
-
};
|
|
754
|
-
const transformBase = {
|
|
755
|
-
"--un-rotate": 0,
|
|
756
|
-
"--un-rotate-x": 0,
|
|
757
|
-
"--un-rotate-y": 0,
|
|
758
|
-
"--un-rotate-z": 0,
|
|
759
|
-
"--un-scale-x": 1,
|
|
760
|
-
"--un-scale-y": 1,
|
|
761
|
-
"--un-scale-z": 1,
|
|
762
|
-
"--un-skew-x": 0,
|
|
763
|
-
"--un-skew-y": 0,
|
|
764
|
-
"--un-translate-x": 0,
|
|
765
|
-
"--un-translate-y": 0,
|
|
766
|
-
"--un-translate-z": 0,
|
|
767
|
-
...transformCpu,
|
|
768
|
-
[CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
769
|
-
[CONTROL_MINI_NO_NEGATIVE]: ""
|
|
770
|
-
};
|
|
771
|
-
const transforms = [
|
|
772
|
-
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }],
|
|
773
|
-
[/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
|
|
774
|
-
const v = handler.bracket.cssvar.px.numberWithUnit(s);
|
|
775
|
-
if (v != null) {
|
|
776
|
-
return {
|
|
777
|
-
"-webkit-perspective": v,
|
|
778
|
-
"perspective": v
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
}],
|
|
782
|
-
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
|
|
783
|
-
const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
784
|
-
if (v != null) {
|
|
785
|
-
return {
|
|
786
|
-
"-webkit-perspective-origin": v,
|
|
787
|
-
"perspective-origin": v
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
}],
|
|
791
|
-
[/^(?:transform-)?translate-()(.+)$/, handleTranslate],
|
|
792
|
-
[/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
|
|
793
|
-
[/^(?:transform-)?rotate-()(.+)$/, handleRotate],
|
|
794
|
-
[/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
|
|
795
|
-
[/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
|
|
796
|
-
[/^(?:transform-)?scale-()(.+)$/, handleScale],
|
|
797
|
-
[/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
|
|
798
|
-
[/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
|
|
799
|
-
[/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
|
|
800
|
-
[/^transform$/, () => [
|
|
801
|
-
transformBase,
|
|
802
|
-
{ transform: "var(--un-transform)" }
|
|
803
|
-
]],
|
|
804
|
-
["transform-gpu", transformGpu],
|
|
805
|
-
["transform-cpu", transformCpu],
|
|
806
|
-
["transform-none", { transform: "none" }]
|
|
807
|
-
];
|
|
808
|
-
function handleTranslate([, d, b], { theme }) {
|
|
809
|
-
const v = theme.spacing?.[b] ?? handler.bracket.cssvar.fraction.rem(b);
|
|
810
|
-
if (v != null) {
|
|
811
|
-
return [
|
|
812
|
-
transformBase,
|
|
813
|
-
[
|
|
814
|
-
...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
815
|
-
["transform", "var(--un-transform)"]
|
|
816
|
-
]
|
|
817
|
-
];
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
function handleScale([, d, b]) {
|
|
821
|
-
const v = handler.bracket.cssvar.fraction.percent(b);
|
|
822
|
-
if (v != null) {
|
|
823
|
-
return [
|
|
824
|
-
transformBase,
|
|
825
|
-
[
|
|
826
|
-
...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
827
|
-
["transform", "var(--un-transform)"]
|
|
828
|
-
]
|
|
829
|
-
];
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
function handleRotate([, d = "", b]) {
|
|
833
|
-
const v = handler.bracket.cssvar.degree(b);
|
|
834
|
-
if (v != null) {
|
|
835
|
-
if (d) {
|
|
836
|
-
return [
|
|
837
|
-
transformBase,
|
|
838
|
-
{
|
|
839
|
-
"--un-rotate": 0,
|
|
840
|
-
[`--un-rotate-${d}`]: v,
|
|
841
|
-
"transform": "var(--un-transform)"
|
|
842
|
-
}
|
|
843
|
-
];
|
|
844
|
-
} else {
|
|
845
|
-
return [
|
|
846
|
-
transformBase,
|
|
847
|
-
{
|
|
848
|
-
"--un-rotate-x": 0,
|
|
849
|
-
"--un-rotate-y": 0,
|
|
850
|
-
"--un-rotate-z": 0,
|
|
851
|
-
"--un-rotate": v,
|
|
852
|
-
"transform": "var(--un-transform)"
|
|
853
|
-
}
|
|
854
|
-
];
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
function handleSkew([, d, b]) {
|
|
859
|
-
const v = handler.bracket.cssvar.degree(b);
|
|
860
|
-
if (v != null) {
|
|
861
|
-
return [
|
|
862
|
-
transformBase,
|
|
863
|
-
{
|
|
864
|
-
[`--un-skew-${d}`]: v,
|
|
865
|
-
transform: "var(--un-transform)"
|
|
866
|
-
}
|
|
867
|
-
];
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
|
|
871
726
|
const variablesAbbrMap = {
|
|
872
727
|
backface: "backface-visibility",
|
|
873
728
|
break: "word-break",
|
|
@@ -905,6 +760,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
905
760
|
]
|
|
906
761
|
];
|
|
907
762
|
|
|
763
|
+
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...globalKeywords];
|
|
908
764
|
const textDecorations = [
|
|
909
765
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
910
766
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
|
|
@@ -920,7 +776,8 @@ const textDecorations = [
|
|
|
920
776
|
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
921
777
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
922
778
|
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
923
|
-
|
|
779
|
+
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
780
|
+
...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
|
|
924
781
|
["no-underline", { "text-decoration": "none" }],
|
|
925
782
|
["decoration-none", { "text-decoration": "none" }]
|
|
926
783
|
];
|
|
@@ -1001,4 +858,4 @@ const rules = [
|
|
|
1001
858
|
questionMark
|
|
1002
859
|
].flat(1);
|
|
1003
860
|
|
|
1004
|
-
export {
|
|
861
|
+
export { textDecorations as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmpty as E, displays as F, appearances as G, cursors as H, pointerEvents as I, resizes as J, userSelects as K, whitespaces as L, contents as M, breaks as N, textOverflows as O, textTransforms as P, fontStyles as Q, fontSmoothings as R, svgUtilities as S, transitions as T, fonts as U, tabSizes as V, textIndents as W, textStrokes as X, textShadows as Y, cssVariables as Z, cssProperty as _, appearance as a, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, boxShadows as y, zIndexes as z };
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -123,10 +123,22 @@ const variantSelector = {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
const
|
|
126
|
+
const variantCssLayer = {
|
|
127
127
|
name: "layer",
|
|
128
128
|
match(matcher) {
|
|
129
129
|
const match = matcher.match(/^layer-([_\d\w]+)[:-]/);
|
|
130
|
+
if (match) {
|
|
131
|
+
return {
|
|
132
|
+
matcher: matcher.slice(match[0].length),
|
|
133
|
+
parent: `@layer ${match[1]}`
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const variantInternalLayer = {
|
|
139
|
+
name: "uno-layer",
|
|
140
|
+
match(matcher) {
|
|
141
|
+
const match = matcher.match(/^uno-layer-([_\d\w]+)[:-]/);
|
|
130
142
|
if (match) {
|
|
131
143
|
return {
|
|
132
144
|
matcher: matcher.slice(match[0].length),
|
|
@@ -240,7 +252,10 @@ const PseudoClasses = Object.fromEntries([
|
|
|
240
252
|
["selection", "::selection"],
|
|
241
253
|
["marker", "::marker"],
|
|
242
254
|
["file", "::file-selector-button"]
|
|
243
|
-
].map((key) =>
|
|
255
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
256
|
+
const PseudoClassesColon = Object.fromEntries([
|
|
257
|
+
["backdrop", "::backdrop"]
|
|
258
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
244
259
|
const PseudoClassFunctions = [
|
|
245
260
|
"not",
|
|
246
261
|
"is",
|
|
@@ -248,20 +263,22 @@ const PseudoClassFunctions = [
|
|
|
248
263
|
"has"
|
|
249
264
|
];
|
|
250
265
|
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
266
|
+
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
251
267
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
252
268
|
const sortValue = (pseudo) => {
|
|
253
269
|
if (pseudo === "active")
|
|
254
270
|
return 1;
|
|
255
271
|
};
|
|
256
272
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
257
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
258
273
|
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
274
|
+
const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
275
|
+
const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
|
|
259
276
|
return {
|
|
260
277
|
name: `pseudo:${tag}`,
|
|
261
278
|
match(input) {
|
|
262
|
-
const match = input.match(
|
|
279
|
+
const match = input.match(pseudoRE) || input.match(pseudoColonRE);
|
|
263
280
|
if (match) {
|
|
264
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
281
|
+
let pseudo = PseudoClasses[match[3]] || PseudoClassesColon[match[3]] || `:${match[3]}`;
|
|
265
282
|
if (match[2])
|
|
266
283
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
267
284
|
return {
|
|
@@ -274,13 +291,15 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
274
291
|
};
|
|
275
292
|
};
|
|
276
293
|
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
294
|
+
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).join("|");
|
|
277
295
|
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
296
|
+
const PseudoClassesAndElementsColonRE = new RegExp(`^(${PseudoClassesAndElementsColonStr})[:]`);
|
|
278
297
|
const variantPseudoClassesAndElements = {
|
|
279
298
|
name: "pseudo",
|
|
280
299
|
match: (input) => {
|
|
281
|
-
const match = input.match(PseudoClassesAndElementsRE);
|
|
300
|
+
const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
|
|
282
301
|
if (match) {
|
|
283
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
302
|
+
const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
|
|
284
303
|
return {
|
|
285
304
|
matcher: input.slice(match[0].length),
|
|
286
305
|
selector: (s) => `${s}${pseudo}`,
|
|
@@ -292,12 +311,13 @@ const variantPseudoClassesAndElements = {
|
|
|
292
311
|
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
293
312
|
};
|
|
294
313
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
314
|
+
const PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})[:]`);
|
|
295
315
|
const variantPseudoClassFunctions = {
|
|
296
316
|
match: (input) => {
|
|
297
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
317
|
+
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE);
|
|
298
318
|
if (match) {
|
|
299
319
|
const fn = match[1];
|
|
300
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
320
|
+
const pseudo = PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
301
321
|
return {
|
|
302
322
|
matcher: input.slice(match[0].length),
|
|
303
323
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -305,7 +325,7 @@ const variantPseudoClassFunctions = {
|
|
|
305
325
|
}
|
|
306
326
|
},
|
|
307
327
|
multiPass: true,
|
|
308
|
-
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
|
|
328
|
+
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}|${PseudoClassesColonStr}):`
|
|
309
329
|
};
|
|
310
330
|
const variantTaggedPseudoClasses = (options = {}) => {
|
|
311
331
|
const attributify = !!options?.attributifyPseudo;
|
|
@@ -344,8 +364,9 @@ const partClasses = {
|
|
|
344
364
|
};
|
|
345
365
|
|
|
346
366
|
const variants = (options) => [
|
|
367
|
+
variantCssLayer,
|
|
347
368
|
variantSelector,
|
|
348
|
-
|
|
369
|
+
variantInternalLayer,
|
|
349
370
|
variantNegative,
|
|
350
371
|
variantImportant,
|
|
351
372
|
variantPrint,
|
|
@@ -365,10 +386,11 @@ exports.partClasses = partClasses;
|
|
|
365
386
|
exports.variantBreakpoints = variantBreakpoints;
|
|
366
387
|
exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
|
|
367
388
|
exports.variantCombinators = variantCombinators;
|
|
389
|
+
exports.variantCssLayer = variantCssLayer;
|
|
368
390
|
exports.variantCustomMedia = variantCustomMedia;
|
|
369
391
|
exports.variantImportant = variantImportant;
|
|
392
|
+
exports.variantInternalLayer = variantInternalLayer;
|
|
370
393
|
exports.variantLanguageDirections = variantLanguageDirections;
|
|
371
|
-
exports.variantLayer = variantLayer;
|
|
372
394
|
exports.variantNegative = variantNegative;
|
|
373
395
|
exports.variantPrint = variantPrint;
|
|
374
396
|
exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE } from './utilities.mjs';
|
|
2
2
|
import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
|
|
3
3
|
import { escapeRegExp } from '@unocss/core';
|
|
4
4
|
|
|
@@ -121,10 +121,22 @@ const variantSelector = {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
const
|
|
124
|
+
const variantCssLayer = {
|
|
125
125
|
name: "layer",
|
|
126
126
|
match(matcher) {
|
|
127
127
|
const match = matcher.match(/^layer-([_\d\w]+)[:-]/);
|
|
128
|
+
if (match) {
|
|
129
|
+
return {
|
|
130
|
+
matcher: matcher.slice(match[0].length),
|
|
131
|
+
parent: `@layer ${match[1]}`
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const variantInternalLayer = {
|
|
137
|
+
name: "uno-layer",
|
|
138
|
+
match(matcher) {
|
|
139
|
+
const match = matcher.match(/^uno-layer-([_\d\w]+)[:-]/);
|
|
128
140
|
if (match) {
|
|
129
141
|
return {
|
|
130
142
|
matcher: matcher.slice(match[0].length),
|
|
@@ -238,7 +250,10 @@ const PseudoClasses = Object.fromEntries([
|
|
|
238
250
|
["selection", "::selection"],
|
|
239
251
|
["marker", "::marker"],
|
|
240
252
|
["file", "::file-selector-button"]
|
|
241
|
-
].map((key) =>
|
|
253
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
254
|
+
const PseudoClassesColon = Object.fromEntries([
|
|
255
|
+
["backdrop", "::backdrop"]
|
|
256
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
242
257
|
const PseudoClassFunctions = [
|
|
243
258
|
"not",
|
|
244
259
|
"is",
|
|
@@ -246,20 +261,22 @@ const PseudoClassFunctions = [
|
|
|
246
261
|
"has"
|
|
247
262
|
];
|
|
248
263
|
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
264
|
+
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
249
265
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
250
266
|
const sortValue = (pseudo) => {
|
|
251
267
|
if (pseudo === "active")
|
|
252
268
|
return 1;
|
|
253
269
|
};
|
|
254
270
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
255
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
256
271
|
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
272
|
+
const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
273
|
+
const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
|
|
257
274
|
return {
|
|
258
275
|
name: `pseudo:${tag}`,
|
|
259
276
|
match(input) {
|
|
260
|
-
const match = input.match(
|
|
277
|
+
const match = input.match(pseudoRE) || input.match(pseudoColonRE);
|
|
261
278
|
if (match) {
|
|
262
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
279
|
+
let pseudo = PseudoClasses[match[3]] || PseudoClassesColon[match[3]] || `:${match[3]}`;
|
|
263
280
|
if (match[2])
|
|
264
281
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
265
282
|
return {
|
|
@@ -272,13 +289,15 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
272
289
|
};
|
|
273
290
|
};
|
|
274
291
|
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
292
|
+
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).join("|");
|
|
275
293
|
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
294
|
+
const PseudoClassesAndElementsColonRE = new RegExp(`^(${PseudoClassesAndElementsColonStr})[:]`);
|
|
276
295
|
const variantPseudoClassesAndElements = {
|
|
277
296
|
name: "pseudo",
|
|
278
297
|
match: (input) => {
|
|
279
|
-
const match = input.match(PseudoClassesAndElementsRE);
|
|
298
|
+
const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
|
|
280
299
|
if (match) {
|
|
281
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
300
|
+
const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
|
|
282
301
|
return {
|
|
283
302
|
matcher: input.slice(match[0].length),
|
|
284
303
|
selector: (s) => `${s}${pseudo}`,
|
|
@@ -290,12 +309,13 @@ const variantPseudoClassesAndElements = {
|
|
|
290
309
|
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
291
310
|
};
|
|
292
311
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
312
|
+
const PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})[:]`);
|
|
293
313
|
const variantPseudoClassFunctions = {
|
|
294
314
|
match: (input) => {
|
|
295
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
315
|
+
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE);
|
|
296
316
|
if (match) {
|
|
297
317
|
const fn = match[1];
|
|
298
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
318
|
+
const pseudo = PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
299
319
|
return {
|
|
300
320
|
matcher: input.slice(match[0].length),
|
|
301
321
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -303,7 +323,7 @@ const variantPseudoClassFunctions = {
|
|
|
303
323
|
}
|
|
304
324
|
},
|
|
305
325
|
multiPass: true,
|
|
306
|
-
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
|
|
326
|
+
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}|${PseudoClassesColonStr}):`
|
|
307
327
|
};
|
|
308
328
|
const variantTaggedPseudoClasses = (options = {}) => {
|
|
309
329
|
const attributify = !!options?.attributifyPseudo;
|
|
@@ -342,8 +362,9 @@ const partClasses = {
|
|
|
342
362
|
};
|
|
343
363
|
|
|
344
364
|
const variants = (options) => [
|
|
365
|
+
variantCssLayer,
|
|
345
366
|
variantSelector,
|
|
346
|
-
|
|
367
|
+
variantInternalLayer,
|
|
347
368
|
variantNegative,
|
|
348
369
|
variantImportant,
|
|
349
370
|
variantPrint,
|
|
@@ -359,4 +380,4 @@ const variants = (options) => [
|
|
|
359
380
|
variantScope
|
|
360
381
|
];
|
|
361
382
|
|
|
362
|
-
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g,
|
|
383
|
+
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantCssLayer as h, variantInternalLayer as i, variantScope as j, variantImportant as k, variantNegative as l, variantPseudoClassesAndElements as m, variantPseudoClassFunctions as n, variantTaggedPseudoClasses as o, partClasses as p, variants as v };
|