@unocss/preset-mini 0.17.3 → 0.20.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/chunks/default2.cjs +75 -17
- package/dist/chunks/default2.mjs +76 -18
- package/dist/chunks/default3.cjs +52 -22
- package/dist/chunks/default3.mjs +52 -22
- package/dist/chunks/pseudo.cjs +53 -32
- package/dist/chunks/pseudo.mjs +53 -33
- package/dist/{colors-d6b5a5b4.d.ts → colors-6d634692.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-c7c67d23.d.ts → default-958434b6.d.ts} +1 -1
- package/dist/index.cjs +21 -10
- package/dist/index.d.ts +14 -6
- package/dist/index.mjs +22 -11
- package/dist/rules.d.ts +1 -1
- package/dist/theme.d.ts +4 -4
- package/dist/{types-7963d0b3.d.ts → types-a2d2b52f.d.ts} +8 -1
- package/dist/utils.d.ts +1 -1
- package/dist/variants.cjs +4 -3
- package/dist/variants.d.ts +7 -5
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -46,6 +46,12 @@ const borders = [
|
|
|
46
46
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
47
47
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
48
48
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
49
|
+
[/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
|
|
50
|
+
const v = utilities.handler.bracket.percent(opacity);
|
|
51
|
+
const d = utilities.directionMap[a];
|
|
52
|
+
if (v !== void 0 && d)
|
|
53
|
+
return d.map((i) => [`--un-border${i}-opacity`, v]);
|
|
54
|
+
}],
|
|
49
55
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
50
56
|
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
51
57
|
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
@@ -55,6 +61,43 @@ const borders = [
|
|
|
55
61
|
["border-double", { "border-style": "double" }],
|
|
56
62
|
["border-none", { "border-style": "none" }]
|
|
57
63
|
];
|
|
64
|
+
const borderHasColor = (color, { theme }) => {
|
|
65
|
+
return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
|
|
66
|
+
};
|
|
67
|
+
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
68
|
+
const data = utilities.parseColor(body, theme);
|
|
69
|
+
if (!data)
|
|
70
|
+
return;
|
|
71
|
+
const { opacity, color, rgba } = data;
|
|
72
|
+
if (!color)
|
|
73
|
+
return;
|
|
74
|
+
const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
75
|
+
if (rgba) {
|
|
76
|
+
if (a != null && !Number.isNaN(a)) {
|
|
77
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
78
|
+
return {
|
|
79
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
80
|
+
};
|
|
81
|
+
} else {
|
|
82
|
+
if (direction === "") {
|
|
83
|
+
return {
|
|
84
|
+
"--un-border-opacity": 1,
|
|
85
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
return {
|
|
89
|
+
"--un-border-opacity": 1,
|
|
90
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return {
|
|
97
|
+
[`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
58
101
|
function handlerBorder(m) {
|
|
59
102
|
const borderSizes = handlerBorderSize(m);
|
|
60
103
|
if (borderSizes) {
|
|
@@ -71,8 +114,8 @@ function handlerBorderSize([, a, b]) {
|
|
|
71
114
|
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
72
115
|
}
|
|
73
116
|
function handlerBorderColor([, a, c], ctx) {
|
|
74
|
-
if (
|
|
75
|
-
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) =>
|
|
117
|
+
if (borderHasColor(c, ctx)) {
|
|
118
|
+
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
76
119
|
}
|
|
77
120
|
}
|
|
78
121
|
function handlerRounded([, a, b], { theme }) {
|
|
@@ -130,7 +173,7 @@ const flex = [
|
|
|
130
173
|
["flex-auto", { flex: "1 1 auto" }],
|
|
131
174
|
["flex-initial", { flex: "0 1 auto" }],
|
|
132
175
|
["flex-none", { flex: "none" }],
|
|
133
|
-
[/^flex
|
|
176
|
+
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
|
|
134
177
|
["flex-shrink", { "flex-shrink": 1 }],
|
|
135
178
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
136
179
|
["flex-grow", { "flex-grow": 1 }],
|
|
@@ -293,12 +336,12 @@ const grids = [
|
|
|
293
336
|
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
|
|
294
337
|
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
|
|
295
338
|
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
|
|
339
|
+
[/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": utilities.handler.bracket(v) })],
|
|
340
|
+
[/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": utilities.handler.bracket(v) })],
|
|
296
341
|
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
297
342
|
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
298
343
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
299
|
-
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
|
|
300
|
-
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
301
|
-
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
|
|
344
|
+
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
|
|
302
345
|
];
|
|
303
346
|
|
|
304
347
|
const overflowValues = [
|
|
@@ -314,11 +357,8 @@ const overflows = [
|
|
|
314
357
|
|
|
315
358
|
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
316
359
|
const positions = [
|
|
317
|
-
[
|
|
318
|
-
[
|
|
319
|
-
["fixed", { position: "fixed" }],
|
|
320
|
-
["sticky", { position: "sticky" }],
|
|
321
|
-
["static", { position: "static" }]
|
|
360
|
+
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
361
|
+
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
322
362
|
];
|
|
323
363
|
const justifies = [
|
|
324
364
|
["justify-start", { "justify-content": "flex-start" }],
|
|
@@ -369,8 +409,8 @@ function handleInsetValue(v) {
|
|
|
369
409
|
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
370
410
|
}
|
|
371
411
|
const insets = [
|
|
372
|
-
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
373
|
-
[/^inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
412
|
+
[/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
413
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
374
414
|
const r = handleInsetValue(v);
|
|
375
415
|
if (r != null && d in utilities.directionMap)
|
|
376
416
|
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
@@ -524,10 +564,8 @@ const boxShadows = [
|
|
|
524
564
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
525
565
|
};
|
|
526
566
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return color;
|
|
530
|
-
}]
|
|
567
|
+
}],
|
|
568
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
531
569
|
];
|
|
532
570
|
|
|
533
571
|
function getPropName(minmax, hw) {
|
|
@@ -600,6 +638,8 @@ const transforms = [
|
|
|
600
638
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
601
639
|
[/^rotate-(.+)$/, handleRotate],
|
|
602
640
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
641
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
642
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
603
643
|
["transform-gpu", transformGpu],
|
|
604
644
|
["transform-cpu", transformCpu],
|
|
605
645
|
["transform-none", { transform: "none" }],
|
|
@@ -653,6 +693,24 @@ function handleRotate([, b]) {
|
|
|
653
693
|
];
|
|
654
694
|
}
|
|
655
695
|
}
|
|
696
|
+
function handleSkewWithUnit([, d, b]) {
|
|
697
|
+
const v = utilities.handler.bracket.number(b);
|
|
698
|
+
if (v != null) {
|
|
699
|
+
return [
|
|
700
|
+
transformBase,
|
|
701
|
+
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
702
|
+
];
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function handleSkew([, d, b]) {
|
|
706
|
+
const v = utilities.handler.bracket(b);
|
|
707
|
+
if (v != null) {
|
|
708
|
+
return [
|
|
709
|
+
transformBase,
|
|
710
|
+
{ [`--un-skew-${d}`]: v }
|
|
711
|
+
];
|
|
712
|
+
}
|
|
713
|
+
}
|
|
656
714
|
|
|
657
715
|
const variablesAbbrMap = {
|
|
658
716
|
"visible": "visibility",
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver$1, d as directionMap,
|
|
1
|
+
import { h as handler, c as colorResolver$1, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
|
|
2
2
|
import { toArray } from '@unocss/core';
|
|
3
3
|
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
4
4
|
|
|
@@ -44,6 +44,12 @@ const borders = [
|
|
|
44
44
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
45
45
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
46
46
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
|
|
47
|
+
[/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
|
|
48
|
+
const v = handler.bracket.percent(opacity);
|
|
49
|
+
const d = directionMap[a];
|
|
50
|
+
if (v !== void 0 && d)
|
|
51
|
+
return d.map((i) => [`--un-border${i}-opacity`, v]);
|
|
52
|
+
}],
|
|
47
53
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
48
54
|
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
49
55
|
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
@@ -53,6 +59,43 @@ const borders = [
|
|
|
53
59
|
["border-double", { "border-style": "double" }],
|
|
54
60
|
["border-none", { "border-style": "none" }]
|
|
55
61
|
];
|
|
62
|
+
const borderHasColor = (color, { theme }) => {
|
|
63
|
+
return color !== void 0 && !!parseColor(color, theme)?.color;
|
|
64
|
+
};
|
|
65
|
+
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
66
|
+
const data = parseColor(body, theme);
|
|
67
|
+
if (!data)
|
|
68
|
+
return;
|
|
69
|
+
const { opacity, color, rgba } = data;
|
|
70
|
+
if (!color)
|
|
71
|
+
return;
|
|
72
|
+
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
73
|
+
if (rgba) {
|
|
74
|
+
if (a != null && !Number.isNaN(a)) {
|
|
75
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
76
|
+
return {
|
|
77
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
if (direction === "") {
|
|
81
|
+
return {
|
|
82
|
+
"--un-border-opacity": 1,
|
|
83
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
84
|
+
};
|
|
85
|
+
} else {
|
|
86
|
+
return {
|
|
87
|
+
"--un-border-opacity": 1,
|
|
88
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
89
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
return {
|
|
95
|
+
[`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
56
99
|
function handlerBorder(m) {
|
|
57
100
|
const borderSizes = handlerBorderSize(m);
|
|
58
101
|
if (borderSizes) {
|
|
@@ -69,8 +112,8 @@ function handlerBorderSize([, a, b]) {
|
|
|
69
112
|
return directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
70
113
|
}
|
|
71
114
|
function handlerBorderColor([, a, c], ctx) {
|
|
72
|
-
if (
|
|
73
|
-
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) =>
|
|
115
|
+
if (borderHasColor(c, ctx)) {
|
|
116
|
+
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
74
117
|
}
|
|
75
118
|
}
|
|
76
119
|
function handlerRounded([, a, b], { theme }) {
|
|
@@ -128,7 +171,7 @@ const flex = [
|
|
|
128
171
|
["flex-auto", { flex: "1 1 auto" }],
|
|
129
172
|
["flex-initial", { flex: "0 1 auto" }],
|
|
130
173
|
["flex-none", { flex: "none" }],
|
|
131
|
-
[/^flex
|
|
174
|
+
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
|
|
132
175
|
["flex-shrink", { "flex-shrink": 1 }],
|
|
133
176
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
134
177
|
["flex-grow", { "flex-grow": 1 }],
|
|
@@ -291,12 +334,12 @@ const grids = [
|
|
|
291
334
|
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
|
|
292
335
|
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
|
|
293
336
|
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
|
|
337
|
+
[/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": handler.bracket(v) })],
|
|
338
|
+
[/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": handler.bracket(v) })],
|
|
294
339
|
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
295
340
|
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
296
341
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
297
|
-
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
|
|
298
|
-
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
299
|
-
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
|
|
342
|
+
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
|
|
300
343
|
];
|
|
301
344
|
|
|
302
345
|
const overflowValues = [
|
|
@@ -312,11 +355,8 @@ const overflows = [
|
|
|
312
355
|
|
|
313
356
|
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
314
357
|
const positions = [
|
|
315
|
-
[
|
|
316
|
-
[
|
|
317
|
-
["fixed", { position: "fixed" }],
|
|
318
|
-
["sticky", { position: "sticky" }],
|
|
319
|
-
["static", { position: "static" }]
|
|
358
|
+
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
359
|
+
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
320
360
|
];
|
|
321
361
|
const justifies = [
|
|
322
362
|
["justify-start", { "justify-content": "flex-start" }],
|
|
@@ -367,8 +407,8 @@ function handleInsetValue(v) {
|
|
|
367
407
|
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
|
|
368
408
|
}
|
|
369
409
|
const insets = [
|
|
370
|
-
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
371
|
-
[/^inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
410
|
+
[/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
411
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
372
412
|
const r = handleInsetValue(v);
|
|
373
413
|
if (r != null && d in directionMap)
|
|
374
414
|
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
@@ -522,10 +562,8 @@ const boxShadows = [
|
|
|
522
562
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
523
563
|
};
|
|
524
564
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return color;
|
|
528
|
-
}]
|
|
565
|
+
}],
|
|
566
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
529
567
|
];
|
|
530
568
|
|
|
531
569
|
function getPropName(minmax, hw) {
|
|
@@ -598,6 +636,8 @@ const transforms = [
|
|
|
598
636
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
599
637
|
[/^rotate-(.+)$/, handleRotate],
|
|
600
638
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
639
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
640
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
601
641
|
["transform-gpu", transformGpu],
|
|
602
642
|
["transform-cpu", transformCpu],
|
|
603
643
|
["transform-none", { transform: "none" }],
|
|
@@ -651,6 +691,24 @@ function handleRotate([, b]) {
|
|
|
651
691
|
];
|
|
652
692
|
}
|
|
653
693
|
}
|
|
694
|
+
function handleSkewWithUnit([, d, b]) {
|
|
695
|
+
const v = handler.bracket.number(b);
|
|
696
|
+
if (v != null) {
|
|
697
|
+
return [
|
|
698
|
+
transformBase,
|
|
699
|
+
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
700
|
+
];
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function handleSkew([, d, b]) {
|
|
704
|
+
const v = handler.bracket(b);
|
|
705
|
+
if (v != null) {
|
|
706
|
+
return [
|
|
707
|
+
transformBase,
|
|
708
|
+
{ [`--un-skew-${d}`]: v }
|
|
709
|
+
];
|
|
710
|
+
}
|
|
711
|
+
}
|
|
654
712
|
|
|
655
713
|
const variablesAbbrMap = {
|
|
656
714
|
"visible": "visibility",
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const variants$1 = require('./variants.cjs');
|
|
|
4
4
|
const pseudo = require('./pseudo.cjs');
|
|
5
5
|
|
|
6
6
|
const regexCache = {};
|
|
7
|
-
const variantBreakpoints = (matcher,
|
|
7
|
+
const variantBreakpoints = (matcher, { theme }) => {
|
|
8
8
|
const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
|
|
9
9
|
for (const [point, size, idx] of variantEntries) {
|
|
10
10
|
if (!regexCache[point])
|
|
@@ -46,25 +46,41 @@ const variantCombinators = [
|
|
|
46
46
|
variants$1.variantMatcher("svg", (input) => `${input} svg *`)
|
|
47
47
|
];
|
|
48
48
|
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const dark = variants$1.variantMatcher("dark")(v);
|
|
56
|
-
if (dark) {
|
|
57
|
-
return {
|
|
58
|
-
...dark,
|
|
59
|
-
parent: "@media (prefers-color-scheme: dark)"
|
|
60
|
-
};
|
|
49
|
+
const variantColorsMediaOrClass = [
|
|
50
|
+
(v, { options: { dark } }) => {
|
|
51
|
+
if (dark === "class") {
|
|
52
|
+
const match = variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
|
|
53
|
+
if (match)
|
|
54
|
+
return match;
|
|
61
55
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
},
|
|
57
|
+
(v, { options: { dark } }) => {
|
|
58
|
+
if (dark === "class") {
|
|
59
|
+
const match = variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
|
|
60
|
+
if (match)
|
|
61
|
+
return match;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
(v, { options: { dark } }) => {
|
|
65
|
+
if (dark === "media") {
|
|
66
|
+
const match = variants$1.variantMatcher("dark")(v);
|
|
67
|
+
if (match) {
|
|
68
|
+
return {
|
|
69
|
+
...match,
|
|
70
|
+
parent: "@media (prefers-color-scheme: dark)"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
(v, { options: { dark } }) => {
|
|
76
|
+
if (dark === "media") {
|
|
77
|
+
const match = variants$1.variantMatcher("light")(v);
|
|
78
|
+
if (match) {
|
|
79
|
+
return {
|
|
80
|
+
...match,
|
|
81
|
+
parent: "@media (prefers-color-scheme: light)"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
}
|
|
70
86
|
];
|
|
@@ -113,22 +129,36 @@ const variantSpace = (matcher) => {
|
|
|
113
129
|
}
|
|
114
130
|
};
|
|
115
131
|
|
|
132
|
+
const variantPrint = (v) => {
|
|
133
|
+
const print = variants$1.variantMatcher("print")(v);
|
|
134
|
+
if (print) {
|
|
135
|
+
return {
|
|
136
|
+
...print,
|
|
137
|
+
parent: "@media print"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
116
142
|
const variants = [
|
|
117
143
|
variantSpace,
|
|
118
144
|
variantNegative,
|
|
119
145
|
variantImportant,
|
|
146
|
+
variantPrint,
|
|
120
147
|
variantBreakpoints,
|
|
121
148
|
...variantCombinators,
|
|
122
149
|
pseudo.variantPseudoClasses,
|
|
150
|
+
pseudo.variantPseudoClassFunctions,
|
|
151
|
+
pseudo.variantTaggedPseudoClasses,
|
|
123
152
|
pseudo.variantPseudoElements,
|
|
124
|
-
pseudo.partClasses
|
|
153
|
+
pseudo.partClasses,
|
|
154
|
+
...variantColorsMediaOrClass
|
|
125
155
|
];
|
|
126
156
|
|
|
127
157
|
exports.variantBreakpoints = variantBreakpoints;
|
|
128
|
-
exports.
|
|
129
|
-
exports.variantColorsMedia = variantColorsMedia;
|
|
158
|
+
exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
|
|
130
159
|
exports.variantCombinators = variantCombinators;
|
|
131
160
|
exports.variantImportant = variantImportant;
|
|
132
161
|
exports.variantNegative = variantNegative;
|
|
162
|
+
exports.variantPrint = variantPrint;
|
|
133
163
|
exports.variantSpace = variantSpace;
|
|
134
164
|
exports.variants = variants;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { v as variantMatcher } from './variants.mjs';
|
|
2
|
-
import { v as variantPseudoClasses, a as variantPseudoElements, p as partClasses } from './pseudo.mjs';
|
|
2
|
+
import { v as variantPseudoClasses, a as variantPseudoClassFunctions, b as variantTaggedPseudoClasses, c as variantPseudoElements, p as partClasses } from './pseudo.mjs';
|
|
3
3
|
|
|
4
4
|
const regexCache = {};
|
|
5
|
-
const variantBreakpoints = (matcher,
|
|
5
|
+
const variantBreakpoints = (matcher, { theme }) => {
|
|
6
6
|
const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
|
|
7
7
|
for (const [point, size, idx] of variantEntries) {
|
|
8
8
|
if (!regexCache[point])
|
|
@@ -44,25 +44,41 @@ const variantCombinators = [
|
|
|
44
44
|
variantMatcher("svg", (input) => `${input} svg *`)
|
|
45
45
|
];
|
|
46
46
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const dark = variantMatcher("dark")(v);
|
|
54
|
-
if (dark) {
|
|
55
|
-
return {
|
|
56
|
-
...dark,
|
|
57
|
-
parent: "@media (prefers-color-scheme: dark)"
|
|
58
|
-
};
|
|
47
|
+
const variantColorsMediaOrClass = [
|
|
48
|
+
(v, { options: { dark } }) => {
|
|
49
|
+
if (dark === "class") {
|
|
50
|
+
const match = variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
|
|
51
|
+
if (match)
|
|
52
|
+
return match;
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
},
|
|
55
|
+
(v, { options: { dark } }) => {
|
|
56
|
+
if (dark === "class") {
|
|
57
|
+
const match = variantMatcher("light", (input) => `.light $$ ${input}`)(v);
|
|
58
|
+
if (match)
|
|
59
|
+
return match;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
(v, { options: { dark } }) => {
|
|
63
|
+
if (dark === "media") {
|
|
64
|
+
const match = variantMatcher("dark")(v);
|
|
65
|
+
if (match) {
|
|
66
|
+
return {
|
|
67
|
+
...match,
|
|
68
|
+
parent: "@media (prefers-color-scheme: dark)"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
(v, { options: { dark } }) => {
|
|
74
|
+
if (dark === "media") {
|
|
75
|
+
const match = variantMatcher("light")(v);
|
|
76
|
+
if (match) {
|
|
77
|
+
return {
|
|
78
|
+
...match,
|
|
79
|
+
parent: "@media (prefers-color-scheme: light)"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
66
82
|
}
|
|
67
83
|
}
|
|
68
84
|
];
|
|
@@ -111,15 +127,29 @@ const variantSpace = (matcher) => {
|
|
|
111
127
|
}
|
|
112
128
|
};
|
|
113
129
|
|
|
130
|
+
const variantPrint = (v) => {
|
|
131
|
+
const print = variantMatcher("print")(v);
|
|
132
|
+
if (print) {
|
|
133
|
+
return {
|
|
134
|
+
...print,
|
|
135
|
+
parent: "@media print"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
114
140
|
const variants = [
|
|
115
141
|
variantSpace,
|
|
116
142
|
variantNegative,
|
|
117
143
|
variantImportant,
|
|
144
|
+
variantPrint,
|
|
118
145
|
variantBreakpoints,
|
|
119
146
|
...variantCombinators,
|
|
120
147
|
variantPseudoClasses,
|
|
148
|
+
variantPseudoClassFunctions,
|
|
149
|
+
variantTaggedPseudoClasses,
|
|
121
150
|
variantPseudoElements,
|
|
122
|
-
partClasses
|
|
151
|
+
partClasses,
|
|
152
|
+
...variantColorsMediaOrClass
|
|
123
153
|
];
|
|
124
154
|
|
|
125
|
-
export {
|
|
155
|
+
export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantImportant as d, variantNegative as e, variantSpace as f, variantPrint as g, variants as v };
|
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -47,13 +47,39 @@ const PseudoElements = [
|
|
|
47
47
|
"first-line",
|
|
48
48
|
"selection"
|
|
49
49
|
];
|
|
50
|
+
const PseudoClassFunctions = [
|
|
51
|
+
"not",
|
|
52
|
+
"is",
|
|
53
|
+
"where",
|
|
54
|
+
"has"
|
|
55
|
+
];
|
|
50
56
|
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
51
57
|
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
52
58
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
59
|
+
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
53
60
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
62
|
+
function shouldAdd(entires) {
|
|
63
|
+
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
64
|
+
}
|
|
65
|
+
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
66
|
+
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
67
|
+
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
68
|
+
return (input) => {
|
|
69
|
+
const match = input.match(re);
|
|
70
|
+
if (match) {
|
|
71
|
+
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
72
|
+
if (match[2])
|
|
73
|
+
pseudo = `${match[2]}(:${pseudo})`;
|
|
74
|
+
return {
|
|
75
|
+
matcher: input.slice(match[1].length + tag.length + 2),
|
|
76
|
+
selector: (s, body) => {
|
|
77
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}:${pseudo}:`) : `${parent}:${pseudo}${combinator}${s}`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
57
83
|
const variantPseudoElements = (input) => {
|
|
58
84
|
const match = input.match(PseudoElementsRE);
|
|
59
85
|
if (match) {
|
|
@@ -63,12 +89,9 @@ const variantPseudoElements = (input) => {
|
|
|
63
89
|
};
|
|
64
90
|
}
|
|
65
91
|
};
|
|
66
|
-
function shouldAdd(entires) {
|
|
67
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
68
|
-
}
|
|
69
92
|
const variantPseudoClasses = {
|
|
70
93
|
match: (input) => {
|
|
71
|
-
|
|
94
|
+
const match = input.match(PseudoClassesRE);
|
|
72
95
|
if (match) {
|
|
73
96
|
const pseudo = PseudoClasses[match[1]] || match[1];
|
|
74
97
|
return {
|
|
@@ -76,37 +99,34 @@ const variantPseudoClasses = {
|
|
|
76
99
|
selector: (s, body) => shouldAdd(body) && `${s}:${pseudo}`
|
|
77
100
|
};
|
|
78
101
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
match = input.match(PseudoClassesGroupRE);
|
|
88
|
-
if (match) {
|
|
89
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
90
|
-
if (match[2])
|
|
91
|
-
pseudo = `not(:${pseudo})`;
|
|
92
|
-
return {
|
|
93
|
-
matcher: input.slice(match[1].length + 7),
|
|
94
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".group:") ? s.replace(/\.group:/, `.group:${pseudo}:`) : `.group:${pseudo} ${s}`
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
match = input.match(PseudoClassesPeerRE);
|
|
102
|
+
},
|
|
103
|
+
multiPass: true
|
|
104
|
+
};
|
|
105
|
+
const variantPseudoClassFunctions = {
|
|
106
|
+
match: (input) => {
|
|
107
|
+
const match = input.match(PseudoClassFunctionsRE);
|
|
98
108
|
if (match) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
pseudo = `not(:${pseudo})`;
|
|
109
|
+
const fn = match[1];
|
|
110
|
+
const pseudo = PseudoClasses[match[2]] || match[2];
|
|
102
111
|
return {
|
|
103
|
-
matcher: input.slice(match[1].length +
|
|
104
|
-
selector: (s, body) => shouldAdd(body) && s
|
|
112
|
+
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
113
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(:${pseudo})`
|
|
105
114
|
};
|
|
106
115
|
}
|
|
107
116
|
},
|
|
108
117
|
multiPass: true
|
|
109
118
|
};
|
|
119
|
+
const variantTaggedPseudoClasses = {
|
|
120
|
+
match: (input, { options: { attributifyPseudo } }) => {
|
|
121
|
+
const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
|
|
122
|
+
if (g)
|
|
123
|
+
return g;
|
|
124
|
+
const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
|
|
125
|
+
if (p)
|
|
126
|
+
return p;
|
|
127
|
+
},
|
|
128
|
+
multiPass: true
|
|
129
|
+
};
|
|
110
130
|
const partClasses = {
|
|
111
131
|
match: (input) => {
|
|
112
132
|
const match = input.match(PartClassesRE);
|
|
@@ -124,7 +144,8 @@ const partClasses = {
|
|
|
124
144
|
};
|
|
125
145
|
|
|
126
146
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
|
|
127
|
-
exports.PseudoClasses = PseudoClasses;
|
|
128
147
|
exports.partClasses = partClasses;
|
|
148
|
+
exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
|
|
129
149
|
exports.variantPseudoClasses = variantPseudoClasses;
|
|
130
150
|
exports.variantPseudoElements = variantPseudoElements;
|
|
151
|
+
exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toArray } from '@unocss/core';
|
|
1
|
+
import { toArray, escapeRegExp } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
4
4
|
const PseudoClasses = Object.fromEntries([
|
|
@@ -45,13 +45,39 @@ const PseudoElements = [
|
|
|
45
45
|
"first-line",
|
|
46
46
|
"selection"
|
|
47
47
|
];
|
|
48
|
+
const PseudoClassFunctions = [
|
|
49
|
+
"not",
|
|
50
|
+
"is",
|
|
51
|
+
"where",
|
|
52
|
+
"has"
|
|
53
|
+
];
|
|
48
54
|
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
49
55
|
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
50
56
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
57
|
+
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
51
58
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
60
|
+
function shouldAdd(entires) {
|
|
61
|
+
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
62
|
+
}
|
|
63
|
+
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
64
|
+
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
65
|
+
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
66
|
+
return (input) => {
|
|
67
|
+
const match = input.match(re);
|
|
68
|
+
if (match) {
|
|
69
|
+
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
70
|
+
if (match[2])
|
|
71
|
+
pseudo = `${match[2]}(:${pseudo})`;
|
|
72
|
+
return {
|
|
73
|
+
matcher: input.slice(match[1].length + tag.length + 2),
|
|
74
|
+
selector: (s, body) => {
|
|
75
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}:${pseudo}:`) : `${parent}:${pseudo}${combinator}${s}`;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
};
|
|
55
81
|
const variantPseudoElements = (input) => {
|
|
56
82
|
const match = input.match(PseudoElementsRE);
|
|
57
83
|
if (match) {
|
|
@@ -61,12 +87,9 @@ const variantPseudoElements = (input) => {
|
|
|
61
87
|
};
|
|
62
88
|
}
|
|
63
89
|
};
|
|
64
|
-
function shouldAdd(entires) {
|
|
65
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
66
|
-
}
|
|
67
90
|
const variantPseudoClasses = {
|
|
68
91
|
match: (input) => {
|
|
69
|
-
|
|
92
|
+
const match = input.match(PseudoClassesRE);
|
|
70
93
|
if (match) {
|
|
71
94
|
const pseudo = PseudoClasses[match[1]] || match[1];
|
|
72
95
|
return {
|
|
@@ -74,37 +97,34 @@ const variantPseudoClasses = {
|
|
|
74
97
|
selector: (s, body) => shouldAdd(body) && `${s}:${pseudo}`
|
|
75
98
|
};
|
|
76
99
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
match = input.match(PseudoClassesGroupRE);
|
|
86
|
-
if (match) {
|
|
87
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
88
|
-
if (match[2])
|
|
89
|
-
pseudo = `not(:${pseudo})`;
|
|
90
|
-
return {
|
|
91
|
-
matcher: input.slice(match[1].length + 7),
|
|
92
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".group:") ? s.replace(/\.group:/, `.group:${pseudo}:`) : `.group:${pseudo} ${s}`
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
match = input.match(PseudoClassesPeerRE);
|
|
100
|
+
},
|
|
101
|
+
multiPass: true
|
|
102
|
+
};
|
|
103
|
+
const variantPseudoClassFunctions = {
|
|
104
|
+
match: (input) => {
|
|
105
|
+
const match = input.match(PseudoClassFunctionsRE);
|
|
96
106
|
if (match) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
pseudo = `not(:${pseudo})`;
|
|
107
|
+
const fn = match[1];
|
|
108
|
+
const pseudo = PseudoClasses[match[2]] || match[2];
|
|
100
109
|
return {
|
|
101
|
-
matcher: input.slice(match[1].length +
|
|
102
|
-
selector: (s, body) => shouldAdd(body) && s
|
|
110
|
+
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
111
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(:${pseudo})`
|
|
103
112
|
};
|
|
104
113
|
}
|
|
105
114
|
},
|
|
106
115
|
multiPass: true
|
|
107
116
|
};
|
|
117
|
+
const variantTaggedPseudoClasses = {
|
|
118
|
+
match: (input, { options: { attributifyPseudo } }) => {
|
|
119
|
+
const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
|
|
120
|
+
if (g)
|
|
121
|
+
return g;
|
|
122
|
+
const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
|
|
123
|
+
if (p)
|
|
124
|
+
return p;
|
|
125
|
+
},
|
|
126
|
+
multiPass: true
|
|
127
|
+
};
|
|
108
128
|
const partClasses = {
|
|
109
129
|
match: (input) => {
|
|
110
130
|
const match = input.match(PartClassesRE);
|
|
@@ -121,4 +141,4 @@ const partClasses = {
|
|
|
121
141
|
multiPass: true
|
|
122
142
|
};
|
|
123
143
|
|
|
124
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS as C,
|
|
144
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantPseudoClassFunctions as a, variantTaggedPseudoClasses as b, variantPseudoElements as c, partClasses as p, variantPseudoClasses as v };
|
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-6d634692';
|
|
2
|
+
import './types-a2d2b52f';
|
package/dist/index.cjs
CHANGED
|
@@ -11,16 +11,27 @@ require('@unocss/core');
|
|
|
11
11
|
require('./chunks/pseudo.cjs');
|
|
12
12
|
require('./chunks/variants.cjs');
|
|
13
13
|
|
|
14
|
-
const presetMini = (options = {}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const presetMini = (options = {}) => {
|
|
15
|
+
options.dark = options.dark ?? "class";
|
|
16
|
+
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
17
|
+
return {
|
|
18
|
+
name: "@unocss/preset-mini",
|
|
19
|
+
theme: _default.theme,
|
|
20
|
+
rules: _default$1.rules,
|
|
21
|
+
variants: _default$2.variants,
|
|
22
|
+
options,
|
|
23
|
+
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
function VarPrefixPostprocessor(prefix) {
|
|
27
|
+
return (obj) => {
|
|
28
|
+
obj.entries.forEach((i) => {
|
|
29
|
+
i[0] = i[0].replace(/^--un-/, `--${prefix}`);
|
|
30
|
+
if (typeof i[1] === "string")
|
|
31
|
+
i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
24
35
|
|
|
25
36
|
exports.theme = _default.theme;
|
|
26
37
|
exports.colors = colors.colors;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { Preset } from '@unocss/core';
|
|
2
|
-
import { T as Theme } from './types-
|
|
3
|
-
export { T as Theme } from './types-
|
|
4
|
-
export { t as theme } from './default-
|
|
5
|
-
export { c as colors } from './colors-
|
|
1
|
+
import { PresetOptions, Preset } from '@unocss/core';
|
|
2
|
+
import { T as Theme } from './types-a2d2b52f';
|
|
3
|
+
export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
|
|
4
|
+
export { t as theme } from './default-958434b6';
|
|
5
|
+
export { c as colors } from './colors-6d634692';
|
|
6
6
|
|
|
7
|
-
interface PresetMiniOptions {
|
|
7
|
+
interface PresetMiniOptions extends PresetOptions {
|
|
8
8
|
/**
|
|
9
9
|
* @default 'class'
|
|
10
10
|
*/
|
|
11
11
|
dark?: 'class' | 'media';
|
|
12
|
+
/**
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
attributifyPseudo?: Boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @default 'un-'
|
|
18
|
+
*/
|
|
19
|
+
variablePrefix?: string;
|
|
12
20
|
}
|
|
13
21
|
declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
|
|
14
22
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { t as theme } from './chunks/default.mjs';
|
|
2
2
|
export { t as theme } from './chunks/default.mjs';
|
|
3
3
|
import { r as rules } from './chunks/default2.mjs';
|
|
4
|
-
import { v as variants
|
|
4
|
+
import { v as variants } from './chunks/default3.mjs';
|
|
5
5
|
export { c as colors } from './chunks/colors.mjs';
|
|
6
6
|
import './chunks/utilities.mjs';
|
|
7
7
|
import '@unocss/core';
|
|
8
8
|
import './chunks/pseudo.mjs';
|
|
9
9
|
import './chunks/variants.mjs';
|
|
10
10
|
|
|
11
|
-
const presetMini = (options = {}) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const presetMini = (options = {}) => {
|
|
12
|
+
options.dark = options.dark ?? "class";
|
|
13
|
+
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
14
|
+
return {
|
|
15
|
+
name: "@unocss/preset-mini",
|
|
16
|
+
theme,
|
|
17
|
+
rules,
|
|
18
|
+
variants,
|
|
19
|
+
options,
|
|
20
|
+
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
function VarPrefixPostprocessor(prefix) {
|
|
24
|
+
return (obj) => {
|
|
25
|
+
obj.entries.forEach((i) => {
|
|
26
|
+
i[0] = i[0].replace(/^--un-/, `--${prefix}`);
|
|
27
|
+
if (typeof i[1] === "string")
|
|
28
|
+
i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
21
32
|
|
|
22
33
|
export { presetMini as default, presetMini };
|
package/dist/rules.d.ts
CHANGED
package/dist/theme.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { c as colors } from './colors-
|
|
2
|
-
export { t as theme } from './default-
|
|
3
|
-
import { T as Theme } from './types-
|
|
4
|
-
export { T as Theme } from './types-
|
|
1
|
+
export { c as colors } from './colors-6d634692';
|
|
2
|
+
export { t as theme } from './default-958434b6';
|
|
3
|
+
import { T as Theme } from './types-a2d2b52f';
|
|
4
|
+
export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
|
|
5
5
|
|
|
6
6
|
declare const blur: {
|
|
7
7
|
DEFAULT: string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
interface ThemeAnimation {
|
|
2
|
+
keyframes?: Record<string, string>;
|
|
3
|
+
durations?: Record<string, string>;
|
|
4
|
+
timingFns?: Record<string, string>;
|
|
5
|
+
properties?: Record<string, object>;
|
|
6
|
+
}
|
|
1
7
|
interface Theme {
|
|
2
8
|
width?: Record<string, string>;
|
|
3
9
|
height?: Record<string, string>;
|
|
@@ -19,6 +25,7 @@ interface Theme {
|
|
|
19
25
|
textStrokeWidth?: Record<string, string>;
|
|
20
26
|
blur?: Record<string, string>;
|
|
21
27
|
dropShadow?: Record<string, string | string[]>;
|
|
28
|
+
animation?: ThemeAnimation;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
|
-
export { Theme as T };
|
|
31
|
+
export { Theme as T, ThemeAnimation as a };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
2
|
import { VariantHandler, DynamicMatcher, ParsedColorValue } from '@unocss/core';
|
|
3
|
-
import { T as Theme } from './types-
|
|
3
|
+
import { T as Theme } from './types-a2d2b52f';
|
|
4
4
|
|
|
5
5
|
declare const directionMap: Record<string, string[]>;
|
|
6
6
|
declare const cornerMap: Record<string, string[]>;
|
package/dist/variants.cjs
CHANGED
|
@@ -10,15 +10,16 @@ require('@unocss/core');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
exports.variantBreakpoints = _default.variantBreakpoints;
|
|
13
|
-
exports.
|
|
14
|
-
exports.variantColorsMedia = _default.variantColorsMedia;
|
|
13
|
+
exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
|
|
15
14
|
exports.variantCombinators = _default.variantCombinators;
|
|
16
15
|
exports.variantImportant = _default.variantImportant;
|
|
17
16
|
exports.variantNegative = _default.variantNegative;
|
|
17
|
+
exports.variantPrint = _default.variantPrint;
|
|
18
18
|
exports.variantSpace = _default.variantSpace;
|
|
19
19
|
exports.variants = _default.variants;
|
|
20
20
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
21
|
-
exports.PseudoClasses = pseudo.PseudoClasses;
|
|
22
21
|
exports.partClasses = pseudo.partClasses;
|
|
22
|
+
exports.variantPseudoClassFunctions = pseudo.variantPseudoClassFunctions;
|
|
23
23
|
exports.variantPseudoClasses = pseudo.variantPseudoClasses;
|
|
24
24
|
exports.variantPseudoElements = pseudo.variantPseudoElements;
|
|
25
|
+
exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
2
|
-
import { T as Theme } from './types-
|
|
2
|
+
import { T as Theme } from './types-a2d2b52f';
|
|
3
3
|
|
|
4
4
|
declare const variantBreakpoints: Variant<Theme>;
|
|
5
5
|
|
|
6
6
|
declare const variantCombinators: Variant[];
|
|
7
7
|
|
|
8
|
-
declare const
|
|
9
|
-
declare const variantColorsMedia: Variant[];
|
|
8
|
+
declare const variantColorsMediaOrClass: Variant[];
|
|
10
9
|
|
|
11
10
|
declare const variants: Variant<Theme>[];
|
|
12
11
|
|
|
@@ -14,10 +13,13 @@ declare const variantImportant: Variant;
|
|
|
14
13
|
declare const variantNegative: Variant;
|
|
15
14
|
declare const variantSpace: Variant;
|
|
16
15
|
|
|
16
|
+
declare const variantPrint: VariantFunction;
|
|
17
|
+
|
|
17
18
|
declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
18
|
-
declare const PseudoClasses: Record<string, string | undefined>;
|
|
19
19
|
declare const variantPseudoElements: VariantFunction;
|
|
20
20
|
declare const variantPseudoClasses: VariantObject;
|
|
21
|
+
declare const variantPseudoClassFunctions: VariantObject;
|
|
22
|
+
declare const variantTaggedPseudoClasses: VariantObject;
|
|
21
23
|
declare const partClasses: VariantObject;
|
|
22
24
|
|
|
23
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS,
|
|
25
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { C as CONTROL_BYPASS_PSEUDO_CLASS,
|
|
1
|
+
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, d as variantImportant, e as variantNegative, g as variantPrint, f as variantSpace, v as variants } from './chunks/default3.mjs';
|
|
2
|
+
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
3
3
|
import './chunks/variants.mjs';
|
|
4
4
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.20.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|