@unocss/preset-mini 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/default.cjs +6 -6
- package/dist/chunks/default.mjs +6 -6
- package/dist/chunks/default2.cjs +31 -98
- package/dist/chunks/default2.mjs +41 -108
- package/dist/chunks/default3.cjs +9 -37
- package/dist/chunks/default3.mjs +10 -38
- package/dist/chunks/utilities.cjs +4 -2
- package/dist/chunks/utilities.mjs +4 -2
- package/dist/chunks/variants.cjs +17 -2
- package/dist/chunks/variants.mjs +17 -3
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.mjs +1 -1
- package/dist/variants.d.ts +2 -1
- package/package.json +2 -2
package/dist/chunks/default.cjs
CHANGED
|
@@ -115,12 +115,12 @@ const borderRadius = {
|
|
|
115
115
|
"full": "9999px"
|
|
116
116
|
};
|
|
117
117
|
const boxShadow = {
|
|
118
|
-
"DEFAULT": "0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
119
|
-
"sm": "0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
120
|
-
"md": "0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
|
|
121
|
-
"lg": "0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
|
|
122
|
-
"xl": "0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
|
|
123
|
-
"2xl": "25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
118
|
+
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
119
|
+
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
120
|
+
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
|
|
121
|
+
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
|
|
122
|
+
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
|
|
123
|
+
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
124
124
|
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
125
125
|
"none": "none"
|
|
126
126
|
};
|
package/dist/chunks/default.mjs
CHANGED
|
@@ -113,12 +113,12 @@ const borderRadius = {
|
|
|
113
113
|
"full": "9999px"
|
|
114
114
|
};
|
|
115
115
|
const boxShadow = {
|
|
116
|
-
"DEFAULT": "0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
117
|
-
"sm": "0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
118
|
-
"md": "0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
|
|
119
|
-
"lg": "0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
|
|
120
|
-
"xl": "0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
|
|
121
|
-
"2xl": "25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
116
|
+
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
117
|
+
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
118
|
+
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
|
|
119
|
+
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
|
|
120
|
+
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
|
|
121
|
+
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
122
122
|
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
|
|
123
123
|
"none": "none"
|
|
124
124
|
};
|
package/dist/chunks/default2.cjs
CHANGED
|
@@ -81,12 +81,12 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
81
81
|
} else {
|
|
82
82
|
if (direction === "") {
|
|
83
83
|
return {
|
|
84
|
-
"--un-border-opacity": 1,
|
|
84
|
+
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
85
85
|
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
86
86
|
};
|
|
87
87
|
} else {
|
|
88
88
|
return {
|
|
89
|
-
"--un-border-opacity": 1,
|
|
89
|
+
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
90
90
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
91
|
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
92
92
|
};
|
|
@@ -199,14 +199,7 @@ const weightMap = {
|
|
|
199
199
|
black: "900"
|
|
200
200
|
};
|
|
201
201
|
const fonts = [
|
|
202
|
-
[/^font-(\w+)$/, ([, d], { theme }) => {
|
|
203
|
-
const font = theme.fontFamily?.[d];
|
|
204
|
-
if (font) {
|
|
205
|
-
return {
|
|
206
|
-
"font-family": font
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}],
|
|
202
|
+
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
210
203
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
211
204
|
const size = utilities.handler.bracket.auto.rem(s);
|
|
212
205
|
if (size)
|
|
@@ -220,37 +213,16 @@ const fonts = [
|
|
|
220
213
|
};
|
|
221
214
|
}
|
|
222
215
|
}],
|
|
223
|
-
[/^text-size-(.+)$/, ([, s]) => {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}]
|
|
228
|
-
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
229
|
-
const v = weightMap[s] || utilities.handler.number(s);
|
|
230
|
-
if (v)
|
|
231
|
-
return { "font-weight": v };
|
|
232
|
-
}],
|
|
233
|
-
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
234
|
-
const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
235
|
-
if (v !== null)
|
|
236
|
-
return { "line-height": v };
|
|
237
|
-
}],
|
|
238
|
-
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
239
|
-
const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
240
|
-
if (v !== null)
|
|
241
|
-
return { "letter-spacing": v };
|
|
242
|
-
}],
|
|
243
|
-
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
244
|
-
const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
245
|
-
if (v !== null)
|
|
246
|
-
return { "word-spacing": v };
|
|
247
|
-
}]
|
|
216
|
+
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
|
|
217
|
+
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
|
|
218
|
+
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s) })],
|
|
219
|
+
[/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })],
|
|
220
|
+
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
|
|
248
221
|
];
|
|
249
222
|
const tabSizes = [
|
|
250
223
|
[/^tab-?([^-]*)$/, ([, s]) => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (v !== null) {
|
|
224
|
+
const v = utilities.handler.bracket.global.number(s || "4");
|
|
225
|
+
if (v != null) {
|
|
254
226
|
return {
|
|
255
227
|
"-moz-tab-size": v,
|
|
256
228
|
"-o-tab-size": v,
|
|
@@ -260,41 +232,29 @@ const tabSizes = [
|
|
|
260
232
|
}]
|
|
261
233
|
];
|
|
262
234
|
const textIndents = [
|
|
263
|
-
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
264
|
-
const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
|
|
265
|
-
if (v != null)
|
|
266
|
-
return { "text-indent": v };
|
|
267
|
-
}]
|
|
235
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s) })]
|
|
268
236
|
];
|
|
269
237
|
const textStrokes = [
|
|
270
|
-
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
271
|
-
const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
|
|
272
|
-
if (v != null)
|
|
273
|
-
return { "-webkit-text-stroke-width": v };
|
|
274
|
-
}],
|
|
238
|
+
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s) })],
|
|
275
239
|
[/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
|
|
276
240
|
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
277
241
|
];
|
|
278
242
|
const textShadows = [
|
|
279
|
-
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
280
|
-
const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
|
|
281
|
-
if (v != null)
|
|
282
|
-
return { "text-shadow": v };
|
|
283
|
-
}]
|
|
243
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s) })]
|
|
284
244
|
];
|
|
285
245
|
|
|
246
|
+
const directions = {
|
|
247
|
+
"": "",
|
|
248
|
+
"x-": "column-",
|
|
249
|
+
"y-": "row-"
|
|
250
|
+
};
|
|
286
251
|
const gaps = [
|
|
287
252
|
[/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
|
|
288
253
|
const v = utilities.handler.bracket.auto.rem(s);
|
|
289
254
|
if (v != null) {
|
|
290
|
-
const direction = {
|
|
291
|
-
"": "",
|
|
292
|
-
"x-": "column-",
|
|
293
|
-
"y-": "row-"
|
|
294
|
-
}[d];
|
|
295
255
|
return {
|
|
296
|
-
[`grid-${
|
|
297
|
-
[`${
|
|
256
|
+
[`grid-${directions[d]}gap`]: v,
|
|
257
|
+
[`${directions[d]}gap`]: v
|
|
298
258
|
};
|
|
299
259
|
}
|
|
300
260
|
}]
|
|
@@ -519,17 +479,12 @@ const rings = [
|
|
|
519
479
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
520
480
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
521
481
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
522
|
-
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
|
|
523
482
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
524
483
|
};
|
|
525
484
|
}
|
|
526
485
|
}],
|
|
527
486
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
528
|
-
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
529
|
-
const value = utilities.handler.px(d || "1");
|
|
530
|
-
if (value)
|
|
531
|
-
return { "--un-ring-offset-width": value };
|
|
532
|
-
}],
|
|
487
|
+
[/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.px(d || "1") })],
|
|
533
488
|
[/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
|
|
534
489
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
535
490
|
[/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
@@ -537,7 +492,7 @@ const rings = [
|
|
|
537
492
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
538
493
|
];
|
|
539
494
|
|
|
540
|
-
const
|
|
495
|
+
const shadowColorResolver = (body, theme) => {
|
|
541
496
|
const data = utilities.parseColor(body, theme);
|
|
542
497
|
if (!data)
|
|
543
498
|
return;
|
|
@@ -559,13 +514,15 @@ const boxShadows = [
|
|
|
559
514
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
560
515
|
if (value) {
|
|
561
516
|
return {
|
|
517
|
+
"--un-shadow-inset": varEmpty,
|
|
562
518
|
"--un-shadow-color": "0,0,0",
|
|
563
519
|
"--un-shadow": value,
|
|
564
520
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
565
521
|
};
|
|
566
522
|
}
|
|
567
523
|
}],
|
|
568
|
-
[/^shadow-(.+)$/, ([, d], { theme }) =>
|
|
524
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
|
|
525
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
569
526
|
];
|
|
570
527
|
|
|
571
528
|
function getPropName(minmax, hw) {
|
|
@@ -591,11 +548,7 @@ const sizes = [
|
|
|
591
548
|
];
|
|
592
549
|
const aspectRatio = [
|
|
593
550
|
["aspect-ratio-auto", { "aspect-ratio": "auto" }],
|
|
594
|
-
[/^aspect-ratio-(.+)$/, ([, d]) => {
|
|
595
|
-
const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
|
|
596
|
-
if (v != null)
|
|
597
|
-
return { "aspect-ratio": v };
|
|
598
|
-
}]
|
|
551
|
+
[/^aspect-ratio-(.+)$/, ([, d]) => ({ "aspect-ratio": (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d) })]
|
|
599
552
|
];
|
|
600
553
|
|
|
601
554
|
const paddings = [
|
|
@@ -658,9 +611,7 @@ function handleTranslate([, d, b]) {
|
|
|
658
611
|
if (v != null) {
|
|
659
612
|
return [
|
|
660
613
|
transformBase,
|
|
661
|
-
[
|
|
662
|
-
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
663
|
-
]
|
|
614
|
+
utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
664
615
|
];
|
|
665
616
|
}
|
|
666
617
|
}
|
|
@@ -669,9 +620,7 @@ function handleScale([, d, b]) {
|
|
|
669
620
|
if (v != null) {
|
|
670
621
|
return [
|
|
671
622
|
transformBase,
|
|
672
|
-
[
|
|
673
|
-
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
674
|
-
]
|
|
623
|
+
utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
675
624
|
];
|
|
676
625
|
}
|
|
677
626
|
}
|
|
@@ -719,17 +668,12 @@ const variablesAbbrMap = {
|
|
|
719
668
|
"backface": "backface-visibility",
|
|
720
669
|
"whitespace": "white-space",
|
|
721
670
|
"break": "word-break",
|
|
722
|
-
"b": "border-color",
|
|
723
|
-
"border": "border-color",
|
|
724
|
-
"color": "color",
|
|
725
671
|
"case": "text-transform",
|
|
726
672
|
"origin": "transform-origin",
|
|
727
|
-
"bg": "background-color",
|
|
728
673
|
"bg-opacity": "background-opacity",
|
|
729
674
|
"tab": "tab-size",
|
|
730
675
|
"underline": "text-decoration-thickness",
|
|
731
676
|
"underline-offset": "text-underline-offset",
|
|
732
|
-
"text": "color",
|
|
733
677
|
"grid-cols": "grid-template-columns",
|
|
734
678
|
"grid-rows": "grid-template-rows",
|
|
735
679
|
"auto-flow": "grid-auto-flow",
|
|
@@ -744,15 +688,8 @@ const variablesAbbrMap = {
|
|
|
744
688
|
const cssVariables = [
|
|
745
689
|
[/^(.+)-\$(.+)$/, ([, name, varname]) => {
|
|
746
690
|
const prop = variablesAbbrMap[name];
|
|
747
|
-
if (prop)
|
|
748
|
-
return {
|
|
749
|
-
[prop]: `var(--${varname})`
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
}],
|
|
753
|
-
[/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
|
|
754
|
-
if (a in utilities.directionMap)
|
|
755
|
-
return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
|
|
691
|
+
if (prop)
|
|
692
|
+
return { [prop]: `var(--${varname})` };
|
|
756
693
|
}]
|
|
757
694
|
];
|
|
758
695
|
|
|
@@ -794,11 +731,7 @@ const svgUtilities = [
|
|
|
794
731
|
[/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
|
|
795
732
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
796
733
|
["fill-none", { fill: "none" }],
|
|
797
|
-
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
798
|
-
const v = utilities.handler.bracket.fraction.px.number(s);
|
|
799
|
-
if (v)
|
|
800
|
-
return { "stroke-width": v };
|
|
801
|
-
}],
|
|
734
|
+
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
|
|
802
735
|
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
803
736
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
804
737
|
["stroke-none", { stroke: "none" }]
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver
|
|
1
|
+
import { h as handler, c as colorResolver, 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
|
|
|
@@ -19,7 +19,7 @@ const textAligns = [
|
|
|
19
19
|
|
|
20
20
|
const outline = [
|
|
21
21
|
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.fraction.auto.rem(d) })],
|
|
22
|
-
[/^outline-(?:color-)?(.+)$/, colorResolver
|
|
22
|
+
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
|
|
23
23
|
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
|
|
24
24
|
["outline", { "outline-style": "solid" }],
|
|
25
25
|
[/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
@@ -79,12 +79,12 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
79
79
|
} else {
|
|
80
80
|
if (direction === "") {
|
|
81
81
|
return {
|
|
82
|
-
"--un-border-opacity": 1,
|
|
82
|
+
"--un-border-opacity": (opacity && handler.cssvar(opacity)) ?? 1,
|
|
83
83
|
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
84
84
|
};
|
|
85
85
|
} else {
|
|
86
86
|
return {
|
|
87
|
-
"--un-border-opacity": 1,
|
|
87
|
+
"--un-border-opacity": (opacity && handler.cssvar(opacity)) ?? 1,
|
|
88
88
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
89
89
|
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
90
90
|
};
|
|
@@ -127,11 +127,11 @@ const opacity = [
|
|
|
127
127
|
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
|
|
128
128
|
];
|
|
129
129
|
const textColors = [
|
|
130
|
-
[/^(?:text|color|c)-(.+)$/, colorResolver
|
|
130
|
+
[/^(?:text|color|c)-(.+)$/, colorResolver("color", "text")],
|
|
131
131
|
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
132
132
|
];
|
|
133
133
|
const bgColors = [
|
|
134
|
-
[/^bg-(.+)$/, colorResolver
|
|
134
|
+
[/^bg-(.+)$/, colorResolver("background-color", "bg")],
|
|
135
135
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
136
136
|
];
|
|
137
137
|
|
|
@@ -197,14 +197,7 @@ const weightMap = {
|
|
|
197
197
|
black: "900"
|
|
198
198
|
};
|
|
199
199
|
const fonts = [
|
|
200
|
-
[/^font-(\w+)$/, ([, d], { theme }) => {
|
|
201
|
-
const font = theme.fontFamily?.[d];
|
|
202
|
-
if (font) {
|
|
203
|
-
return {
|
|
204
|
-
"font-family": font
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
}],
|
|
200
|
+
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
208
201
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
209
202
|
const size = handler.bracket.auto.rem(s);
|
|
210
203
|
if (size)
|
|
@@ -218,37 +211,16 @@ const fonts = [
|
|
|
218
211
|
};
|
|
219
212
|
}
|
|
220
213
|
}],
|
|
221
|
-
[/^text-size-(.+)$/, ([, s]) => {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}]
|
|
226
|
-
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
227
|
-
const v = weightMap[s] || handler.number(s);
|
|
228
|
-
if (v)
|
|
229
|
-
return { "font-weight": v };
|
|
230
|
-
}],
|
|
231
|
-
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
232
|
-
const v = theme.lineHeight?.[s] || handler.bracket.auto.rem(s);
|
|
233
|
-
if (v !== null)
|
|
234
|
-
return { "line-height": v };
|
|
235
|
-
}],
|
|
236
|
-
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
237
|
-
const v = theme.letterSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
238
|
-
if (v !== null)
|
|
239
|
-
return { "letter-spacing": v };
|
|
240
|
-
}],
|
|
241
|
-
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
242
|
-
const v = theme.wordSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
243
|
-
if (v !== null)
|
|
244
|
-
return { "word-spacing": v };
|
|
245
|
-
}]
|
|
214
|
+
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
|
|
215
|
+
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
|
|
216
|
+
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.auto.rem(s) })],
|
|
217
|
+
[/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.auto.rem(s) })],
|
|
218
|
+
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
|
|
246
219
|
];
|
|
247
220
|
const tabSizes = [
|
|
248
221
|
[/^tab-?([^-]*)$/, ([, s]) => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (v !== null) {
|
|
222
|
+
const v = handler.bracket.global.number(s || "4");
|
|
223
|
+
if (v != null) {
|
|
252
224
|
return {
|
|
253
225
|
"-moz-tab-size": v,
|
|
254
226
|
"-o-tab-size": v,
|
|
@@ -258,41 +230,29 @@ const tabSizes = [
|
|
|
258
230
|
}]
|
|
259
231
|
];
|
|
260
232
|
const textIndents = [
|
|
261
|
-
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
262
|
-
const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s);
|
|
263
|
-
if (v != null)
|
|
264
|
-
return { "text-indent": v };
|
|
265
|
-
}]
|
|
233
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s) })]
|
|
266
234
|
];
|
|
267
235
|
const textStrokes = [
|
|
268
|
-
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
269
|
-
|
|
270
|
-
if (v != null)
|
|
271
|
-
return { "-webkit-text-stroke-width": v };
|
|
272
|
-
}],
|
|
273
|
-
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
236
|
+
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) })],
|
|
237
|
+
[/^text-stroke-(.+)$/, colorResolver("-webkit-text-stroke-color", "text-stroke")],
|
|
274
238
|
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
275
239
|
];
|
|
276
240
|
const textShadows = [
|
|
277
|
-
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
278
|
-
const v = theme.textShadow?.[s || "DEFAULT"] || handler.bracket.cssvar(s);
|
|
279
|
-
if (v != null)
|
|
280
|
-
return { "text-shadow": v };
|
|
281
|
-
}]
|
|
241
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || handler.bracket.cssvar(s) })]
|
|
282
242
|
];
|
|
283
243
|
|
|
244
|
+
const directions = {
|
|
245
|
+
"": "",
|
|
246
|
+
"x-": "column-",
|
|
247
|
+
"y-": "row-"
|
|
248
|
+
};
|
|
284
249
|
const gaps = [
|
|
285
250
|
[/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
|
|
286
251
|
const v = handler.bracket.auto.rem(s);
|
|
287
252
|
if (v != null) {
|
|
288
|
-
const direction = {
|
|
289
|
-
"": "",
|
|
290
|
-
"x-": "column-",
|
|
291
|
-
"y-": "row-"
|
|
292
|
-
}[d];
|
|
293
253
|
return {
|
|
294
|
-
[`grid-${
|
|
295
|
-
[`${
|
|
254
|
+
[`grid-${directions[d]}gap`]: v,
|
|
255
|
+
[`${directions[d]}gap`]: v
|
|
296
256
|
};
|
|
297
257
|
}
|
|
298
258
|
}]
|
|
@@ -517,25 +477,20 @@ const rings = [
|
|
|
517
477
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
518
478
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
519
479
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
520
|
-
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
|
|
521
480
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
522
481
|
};
|
|
523
482
|
}
|
|
524
483
|
}],
|
|
525
484
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
526
|
-
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
527
|
-
|
|
528
|
-
if (value)
|
|
529
|
-
return { "--un-ring-offset-width": value };
|
|
530
|
-
}],
|
|
531
|
-
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
485
|
+
[/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.px(d || "1") })],
|
|
486
|
+
[/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
|
|
532
487
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
|
|
533
|
-
[/^ring-offset-(.+)$/, colorResolver
|
|
488
|
+
[/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
534
489
|
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) })],
|
|
535
490
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
536
491
|
];
|
|
537
492
|
|
|
538
|
-
const
|
|
493
|
+
const shadowColorResolver = (body, theme) => {
|
|
539
494
|
const data = parseColor(body, theme);
|
|
540
495
|
if (!data)
|
|
541
496
|
return;
|
|
@@ -557,13 +512,15 @@ const boxShadows = [
|
|
|
557
512
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
558
513
|
if (value) {
|
|
559
514
|
return {
|
|
515
|
+
"--un-shadow-inset": varEmpty,
|
|
560
516
|
"--un-shadow-color": "0,0,0",
|
|
561
517
|
"--un-shadow": value,
|
|
562
518
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
563
519
|
};
|
|
564
520
|
}
|
|
565
521
|
}],
|
|
566
|
-
[/^shadow-(.+)$/, ([, d], { theme }) =>
|
|
522
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
|
|
523
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
567
524
|
];
|
|
568
525
|
|
|
569
526
|
function getPropName(minmax, hw) {
|
|
@@ -589,11 +546,7 @@ const sizes = [
|
|
|
589
546
|
];
|
|
590
547
|
const aspectRatio = [
|
|
591
548
|
["aspect-ratio-auto", { "aspect-ratio": "auto" }],
|
|
592
|
-
[/^aspect-ratio-(.+)$/, ([, d]) => {
|
|
593
|
-
const v = (/^\d+\/\d+$/.test(d) ? d : null) || handler.bracket.cssvar.number(d);
|
|
594
|
-
if (v != null)
|
|
595
|
-
return { "aspect-ratio": v };
|
|
596
|
-
}]
|
|
549
|
+
[/^aspect-ratio-(.+)$/, ([, d]) => ({ "aspect-ratio": (/^\d+\/\d+$/.test(d) ? d : null) || handler.bracket.cssvar.number(d) })]
|
|
597
550
|
];
|
|
598
551
|
|
|
599
552
|
const paddings = [
|
|
@@ -656,9 +609,7 @@ function handleTranslate([, d, b]) {
|
|
|
656
609
|
if (v != null) {
|
|
657
610
|
return [
|
|
658
611
|
transformBase,
|
|
659
|
-
[
|
|
660
|
-
...xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
661
|
-
]
|
|
612
|
+
xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
662
613
|
];
|
|
663
614
|
}
|
|
664
615
|
}
|
|
@@ -667,9 +618,7 @@ function handleScale([, d, b]) {
|
|
|
667
618
|
if (v != null) {
|
|
668
619
|
return [
|
|
669
620
|
transformBase,
|
|
670
|
-
[
|
|
671
|
-
...xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
672
|
-
]
|
|
621
|
+
xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
673
622
|
];
|
|
674
623
|
}
|
|
675
624
|
}
|
|
@@ -717,17 +666,12 @@ const variablesAbbrMap = {
|
|
|
717
666
|
"backface": "backface-visibility",
|
|
718
667
|
"whitespace": "white-space",
|
|
719
668
|
"break": "word-break",
|
|
720
|
-
"b": "border-color",
|
|
721
|
-
"border": "border-color",
|
|
722
|
-
"color": "color",
|
|
723
669
|
"case": "text-transform",
|
|
724
670
|
"origin": "transform-origin",
|
|
725
|
-
"bg": "background-color",
|
|
726
671
|
"bg-opacity": "background-opacity",
|
|
727
672
|
"tab": "tab-size",
|
|
728
673
|
"underline": "text-decoration-thickness",
|
|
729
674
|
"underline-offset": "text-underline-offset",
|
|
730
|
-
"text": "color",
|
|
731
675
|
"grid-cols": "grid-template-columns",
|
|
732
676
|
"grid-rows": "grid-template-rows",
|
|
733
677
|
"auto-flow": "grid-auto-flow",
|
|
@@ -742,15 +686,8 @@ const variablesAbbrMap = {
|
|
|
742
686
|
const cssVariables = [
|
|
743
687
|
[/^(.+)-\$(.+)$/, ([, name, varname]) => {
|
|
744
688
|
const prop = variablesAbbrMap[name];
|
|
745
|
-
if (prop)
|
|
746
|
-
return {
|
|
747
|
-
[prop]: `var(--${varname})`
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
}],
|
|
751
|
-
[/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
|
|
752
|
-
if (a in directionMap)
|
|
753
|
-
return directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
|
|
689
|
+
if (prop)
|
|
690
|
+
return { [prop]: `var(--${varname})` };
|
|
754
691
|
}]
|
|
755
692
|
];
|
|
756
693
|
|
|
@@ -773,7 +710,7 @@ const textDecorations = [
|
|
|
773
710
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
774
711
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
775
712
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
776
|
-
const result = colorResolver
|
|
713
|
+
const result = colorResolver("text-decoration-color", "line")(match, ctx);
|
|
777
714
|
if (result) {
|
|
778
715
|
return {
|
|
779
716
|
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
@@ -789,15 +726,11 @@ const textDecorations = [
|
|
|
789
726
|
];
|
|
790
727
|
|
|
791
728
|
const svgUtilities = [
|
|
792
|
-
[/^fill-(.+)$/, colorResolver
|
|
729
|
+
[/^fill-(.+)$/, colorResolver("fill", "fill")],
|
|
793
730
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
794
731
|
["fill-none", { fill: "none" }],
|
|
795
|
-
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
796
|
-
|
|
797
|
-
if (v)
|
|
798
|
-
return { "stroke-width": v };
|
|
799
|
-
}],
|
|
800
|
-
[/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
|
|
732
|
+
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
733
|
+
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
801
734
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
802
735
|
["stroke-none", { stroke: "none" }]
|
|
803
736
|
];
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -48,40 +48,20 @@ const variantCombinators = [
|
|
|
48
48
|
|
|
49
49
|
const variantColorsMediaOrClass = [
|
|
50
50
|
(v, { options: { dark } }) => {
|
|
51
|
-
if (dark === "class")
|
|
52
|
-
|
|
53
|
-
if (match)
|
|
54
|
-
return match;
|
|
55
|
-
}
|
|
51
|
+
if (dark === "class")
|
|
52
|
+
return variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
|
|
56
53
|
},
|
|
57
54
|
(v, { options: { dark } }) => {
|
|
58
|
-
if (dark === "class")
|
|
59
|
-
|
|
60
|
-
if (match)
|
|
61
|
-
return match;
|
|
62
|
-
}
|
|
55
|
+
if (dark === "class")
|
|
56
|
+
return variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
|
|
63
57
|
},
|
|
64
58
|
(v, { options: { dark } }) => {
|
|
65
|
-
if (dark === "media")
|
|
66
|
-
|
|
67
|
-
if (match) {
|
|
68
|
-
return {
|
|
69
|
-
...match,
|
|
70
|
-
parent: "@media (prefers-color-scheme: dark)"
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
59
|
+
if (dark === "media")
|
|
60
|
+
return variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
|
|
74
61
|
},
|
|
75
62
|
(v, { options: { dark } }) => {
|
|
76
|
-
if (dark === "media")
|
|
77
|
-
|
|
78
|
-
if (match) {
|
|
79
|
-
return {
|
|
80
|
-
...match,
|
|
81
|
-
parent: "@media (prefers-color-scheme: light)"
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}
|
|
63
|
+
if (dark === "media")
|
|
64
|
+
return variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
|
|
85
65
|
}
|
|
86
66
|
];
|
|
87
67
|
|
|
@@ -129,15 +109,7 @@ const variantSpace = (matcher) => {
|
|
|
129
109
|
}
|
|
130
110
|
};
|
|
131
111
|
|
|
132
|
-
const variantPrint = (
|
|
133
|
-
const print = variants$1.variantMatcher("print")(v);
|
|
134
|
-
if (print) {
|
|
135
|
-
return {
|
|
136
|
-
...print,
|
|
137
|
-
parent: "@media print"
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
};
|
|
112
|
+
const variantPrint = variants$1.variantParentMatcher("print", "@media print");
|
|
141
113
|
|
|
142
114
|
const variants = [
|
|
143
115
|
variantSpace,
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as variantMatcher } from './variants.mjs';
|
|
1
|
+
import { v as variantMatcher, a as variantParentMatcher } from './variants.mjs';
|
|
2
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 = {};
|
|
@@ -46,40 +46,20 @@ const variantCombinators = [
|
|
|
46
46
|
|
|
47
47
|
const variantColorsMediaOrClass = [
|
|
48
48
|
(v, { options: { dark } }) => {
|
|
49
|
-
if (dark === "class")
|
|
50
|
-
|
|
51
|
-
if (match)
|
|
52
|
-
return match;
|
|
53
|
-
}
|
|
49
|
+
if (dark === "class")
|
|
50
|
+
return variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
|
|
54
51
|
},
|
|
55
52
|
(v, { options: { dark } }) => {
|
|
56
|
-
if (dark === "class")
|
|
57
|
-
|
|
58
|
-
if (match)
|
|
59
|
-
return match;
|
|
60
|
-
}
|
|
53
|
+
if (dark === "class")
|
|
54
|
+
return variantMatcher("light", (input) => `.light $$ ${input}`)(v);
|
|
61
55
|
},
|
|
62
56
|
(v, { options: { dark } }) => {
|
|
63
|
-
if (dark === "media")
|
|
64
|
-
|
|
65
|
-
if (match) {
|
|
66
|
-
return {
|
|
67
|
-
...match,
|
|
68
|
-
parent: "@media (prefers-color-scheme: dark)"
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
57
|
+
if (dark === "media")
|
|
58
|
+
return variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
|
|
72
59
|
},
|
|
73
60
|
(v, { options: { dark } }) => {
|
|
74
|
-
if (dark === "media")
|
|
75
|
-
|
|
76
|
-
if (match) {
|
|
77
|
-
return {
|
|
78
|
-
...match,
|
|
79
|
-
parent: "@media (prefers-color-scheme: light)"
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
61
|
+
if (dark === "media")
|
|
62
|
+
return variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
|
|
83
63
|
}
|
|
84
64
|
];
|
|
85
65
|
|
|
@@ -127,15 +107,7 @@ const variantSpace = (matcher) => {
|
|
|
127
107
|
}
|
|
128
108
|
};
|
|
129
109
|
|
|
130
|
-
const variantPrint = (
|
|
131
|
-
const print = variantMatcher("print")(v);
|
|
132
|
-
if (print) {
|
|
133
|
-
return {
|
|
134
|
-
...print,
|
|
135
|
-
parent: "@media print"
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
};
|
|
110
|
+
const variantPrint = variantParentMatcher("print", "@media print");
|
|
139
111
|
|
|
140
112
|
const variants = [
|
|
141
113
|
variantSpace,
|
|
@@ -225,8 +225,10 @@ const parseColor = (body, theme) => {
|
|
|
225
225
|
const bracketOrMain = bracket || main;
|
|
226
226
|
if (bracketOrMain.startsWith("#"))
|
|
227
227
|
color = bracketOrMain.slice(1);
|
|
228
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
228
|
+
else if (bracketOrMain.startsWith("hex-"))
|
|
229
229
|
color = bracketOrMain.slice(4);
|
|
230
|
+
else if (main.startsWith("$"))
|
|
231
|
+
color = handler.cssvar(main);
|
|
230
232
|
color = color || bracket;
|
|
231
233
|
let no = "DEFAULT";
|
|
232
234
|
if (!color) {
|
|
@@ -271,7 +273,7 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
|
271
273
|
};
|
|
272
274
|
} else {
|
|
273
275
|
return {
|
|
274
|
-
[`--un-${varName}-opacity`]: 1,
|
|
276
|
+
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
275
277
|
[property]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
276
278
|
};
|
|
277
279
|
}
|
|
@@ -223,8 +223,10 @@ const parseColor = (body, theme) => {
|
|
|
223
223
|
const bracketOrMain = bracket || main;
|
|
224
224
|
if (bracketOrMain.startsWith("#"))
|
|
225
225
|
color = bracketOrMain.slice(1);
|
|
226
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
226
|
+
else if (bracketOrMain.startsWith("hex-"))
|
|
227
227
|
color = bracketOrMain.slice(4);
|
|
228
|
+
else if (main.startsWith("$"))
|
|
229
|
+
color = handler.cssvar(main);
|
|
228
230
|
color = color || bracket;
|
|
229
231
|
let no = "DEFAULT";
|
|
230
232
|
if (!color) {
|
|
@@ -269,7 +271,7 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
|
269
271
|
};
|
|
270
272
|
} else {
|
|
271
273
|
return {
|
|
272
|
-
[`--un-${varName}-opacity`]: 1,
|
|
274
|
+
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
273
275
|
[property]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
274
276
|
};
|
|
275
277
|
}
|
package/dist/chunks/variants.cjs
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const core = require('@unocss/core');
|
|
4
|
+
|
|
3
5
|
const variantMatcher = (name, selector) => {
|
|
4
|
-
const re = new RegExp(
|
|
6
|
+
const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
|
|
5
7
|
return (input) => {
|
|
6
8
|
const match = input.match(re);
|
|
7
9
|
if (match) {
|
|
8
10
|
return {
|
|
9
|
-
matcher: input.slice(match[
|
|
11
|
+
matcher: input.slice(match[0].length),
|
|
10
12
|
selector
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
};
|
|
17
|
+
const variantParentMatcher = (name, parent) => {
|
|
18
|
+
const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
|
|
19
|
+
return (input) => {
|
|
20
|
+
const match = input.match(re);
|
|
21
|
+
if (match) {
|
|
22
|
+
return {
|
|
23
|
+
matcher: input.slice(match[0].length),
|
|
24
|
+
parent
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
15
29
|
|
|
16
30
|
exports.variantMatcher = variantMatcher;
|
|
31
|
+
exports.variantParentMatcher = variantParentMatcher;
|
package/dist/chunks/variants.mjs
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
import { escapeRegExp } from '@unocss/core';
|
|
2
|
+
|
|
1
3
|
const variantMatcher = (name, selector) => {
|
|
2
|
-
const re = new RegExp(
|
|
4
|
+
const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
|
|
3
5
|
return (input) => {
|
|
4
6
|
const match = input.match(re);
|
|
5
7
|
if (match) {
|
|
6
8
|
return {
|
|
7
|
-
matcher: input.slice(match[
|
|
9
|
+
matcher: input.slice(match[0].length),
|
|
8
10
|
selector
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
14
|
};
|
|
15
|
+
const variantParentMatcher = (name, parent) => {
|
|
16
|
+
const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
|
|
17
|
+
return (input) => {
|
|
18
|
+
const match = input.match(re);
|
|
19
|
+
if (match) {
|
|
20
|
+
return {
|
|
21
|
+
matcher: input.slice(match[0].length),
|
|
22
|
+
parent
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
13
27
|
|
|
14
|
-
export { variantMatcher as v };
|
|
28
|
+
export { variantParentMatcher as a, variantMatcher as v };
|
package/dist/utils.cjs
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWith
|
|
|
52
52
|
declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
53
53
|
|
|
54
54
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
55
|
+
declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
|
|
55
56
|
|
|
56
57
|
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
57
58
|
/**
|
|
@@ -105,4 +106,4 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
|
|
|
105
106
|
*/
|
|
106
107
|
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
107
108
|
|
|
108
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, xyzMap };
|
|
109
|
+
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, f as h, h as handler, p as parseColor, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
|
-
export { v as variantMatcher } from './chunks/variants.mjs';
|
|
2
|
+
export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _unocss_core from '@unocss/core';
|
|
1
2
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
2
3
|
import { T as Theme } from './types-a2d2b52f';
|
|
3
4
|
|
|
@@ -13,7 +14,7 @@ declare const variantImportant: Variant;
|
|
|
13
14
|
declare const variantNegative: Variant;
|
|
14
15
|
declare const variantSpace: Variant;
|
|
15
16
|
|
|
16
|
-
declare const variantPrint:
|
|
17
|
+
declare const variantPrint: (input: string) => _unocss_core.VariantHandler | undefined;
|
|
17
18
|
|
|
18
19
|
declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
19
20
|
declare const variantPseudoElements: VariantFunction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
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.20.
|
|
64
|
+
"@unocss/core": "0.20.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|