@unocss/preset-wind4 66.6.7 → 66.7.0-beta.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/{container-_7pdPWQl.mjs → container-BwY4Hhe2.mjs} +1 -1
- package/dist/{index-Br5yJM3P.d.mts → index-DRmQ2SKQ.d.mts} +3 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/postprocess.d.mts +1 -1
- package/dist/rules.mjs +203 -195
- package/dist/shortcuts.d.mts +1 -1
- package/dist/shortcuts.mjs +1 -1
- package/dist/{utils-BamiTVVE.mjs → utils-CqAvZsCu.mjs} +42 -27
- package/dist/utils.d.mts +3 -4
- package/dist/utils.mjs +1 -1
- package/dist/{variants-BQhcPCjX.mjs → variants-pAIxzNbQ.mjs} +19 -19
- package/dist/variants.d.mts +1 -1
- package/dist/variants.mjs +1 -1
- package/package.json +4 -4
package/dist/rules.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as bracketTypeRe, B as xyzMap, D as h, F as directionMap, I as globalKeywords, L as insetMap, M as cornerMap, R as positionMap, S as parseColor, U as SpecialColorKey, V as CONTROL_NO_NEGATIVE, _ as hyphenate, a as themeTracking, b as makeGlobalStaticRules, d as colorableShadows, g as hasParseableColor, j as splitComma, l as colorCSSGenerator, m as directionSize, n as detectThemeValue, p as defineProperty, r as generateThemeVariable, u as colorResolver, v as isCSSMathFn, w as resolveBreakpoints, x as numberResolver, y as isSize, z as xyzArray } from "./utils-
|
|
2
|
-
import { n as containerParent, r as containerShortcuts, t as container } from "./container-
|
|
1
|
+
import { A as bracketTypeRe, B as xyzMap, D as h, F as directionMap, I as globalKeywords, L as insetMap, M as cornerMap, R as positionMap, S as parseColor, U as SpecialColorKey, V as CONTROL_NO_NEGATIVE, _ as hyphenate, a as themeTracking, b as makeGlobalStaticRules, d as colorableShadows, g as hasParseableColor, j as splitComma, l as colorCSSGenerator, m as directionSize, n as detectThemeValue, p as defineProperty, r as generateThemeVariable, u as colorResolver, v as isCSSMathFn, w as resolveBreakpoints, x as numberResolver, y as isSize, z as xyzArray } from "./utils-CqAvZsCu.mjs";
|
|
2
|
+
import { n as containerParent, r as containerShortcuts, t as container } from "./container-BwY4Hhe2.mjs";
|
|
3
3
|
import { notNull, symbols } from "@unocss/core";
|
|
4
4
|
import { getStringComponent, getStringComponents } from "@unocss/rule-utils";
|
|
5
5
|
//#region src/rules/align.ts
|
|
@@ -21,7 +21,7 @@ const verticalAlignAlias = {
|
|
|
21
21
|
};
|
|
22
22
|
const verticalAligns = [[
|
|
23
23
|
/^(?:vertical|align|v)-(.+)$/,
|
|
24
|
-
([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v) }),
|
|
24
|
+
([, v], { theme }) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v, theme) }),
|
|
25
25
|
{ autocomplete: [`(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`, "(vertical|align|v)-<percentage>"] }
|
|
26
26
|
]];
|
|
27
27
|
const textAlignValues = [
|
|
@@ -58,24 +58,24 @@ const animations = [
|
|
|
58
58
|
...props
|
|
59
59
|
}];
|
|
60
60
|
}
|
|
61
|
-
return { animation: h.bracket.cssvar(name) };
|
|
61
|
+
return { animation: h.bracket.cssvar(name, theme) };
|
|
62
62
|
},
|
|
63
63
|
{ autocomplete: "animate-$animation.keyframes" }
|
|
64
64
|
],
|
|
65
|
-
[/^animate-name-(.+)/, ([, d]) => ({ "animation-name": h.bracket.cssvar(d) ?? d })],
|
|
65
|
+
[/^animate-name-(.+)/, ([, d], { theme }) => ({ "animation-name": h.bracket.cssvar(d, theme) ?? d })],
|
|
66
66
|
[
|
|
67
67
|
/^animate-duration-(.+)$/,
|
|
68
|
-
([, d], { theme }) => ({ "animation-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
|
|
68
|
+
([, d], { theme }) => ({ "animation-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d, theme) }),
|
|
69
69
|
{ autocomplete: ["animate-duration"] }
|
|
70
70
|
],
|
|
71
71
|
[
|
|
72
72
|
/^animate-delay-(.+)$/,
|
|
73
|
-
([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
|
|
73
|
+
([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d, theme) }),
|
|
74
74
|
{ autocomplete: ["animate-delay"] }
|
|
75
75
|
],
|
|
76
76
|
[
|
|
77
77
|
/^animate-ease(?:-(.+))?$/,
|
|
78
|
-
([, d], { theme }) => ({ "animation-timing-function": theme.ease?.[d || "DEFAULT"] ?? h.bracket.cssvar(d) }),
|
|
78
|
+
([, d], { theme }) => ({ "animation-timing-function": theme.ease?.[d || "DEFAULT"] ?? h.bracket.cssvar(d, theme) }),
|
|
79
79
|
{ autocomplete: ["animate-ease", "animate-ease-$ease"] }
|
|
80
80
|
],
|
|
81
81
|
[
|
|
@@ -110,7 +110,7 @@ const animations = [
|
|
|
110
110
|
],
|
|
111
111
|
[
|
|
112
112
|
/^animate-(?:iteration-count-|iteration-|count-)(.+)$/,
|
|
113
|
-
([, d]) => ({ "animation-iteration-count": h.bracket.cssvar(d) ?? d.replace(/-/g, ",") }),
|
|
113
|
+
([, d], { theme }) => ({ "animation-iteration-count": h.bracket.cssvar(d, theme) ?? d.replace(/-/g, ",") }),
|
|
114
114
|
{ autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }
|
|
115
115
|
],
|
|
116
116
|
[
|
|
@@ -194,7 +194,7 @@ function bgGradientColorResolver() {
|
|
|
194
194
|
if (keys) themeTracking(`colors`, keys);
|
|
195
195
|
if (theme) detectThemeValue(color, theme);
|
|
196
196
|
}
|
|
197
|
-
} else css[`--un-gradient-${position}`] = h.bracket.cssvar(body);
|
|
197
|
+
} else css[`--un-gradient-${position}`] = h.bracket.cssvar(body, theme);
|
|
198
198
|
if (css[`--un-gradient-${position}`]) {
|
|
199
199
|
switch (position) {
|
|
200
200
|
case "from":
|
|
@@ -225,18 +225,18 @@ function bgGradientColorResolver() {
|
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
function bgGradientPositionResolver() {
|
|
228
|
-
return function* ([, mode, body]) {
|
|
229
|
-
yield { [`--un-gradient-${mode}-position`]: `${h.bracket.cssvar.percent(body)}` };
|
|
228
|
+
return function* ([, mode, body], { theme }) {
|
|
229
|
+
yield { [`--un-gradient-${mode}-position`]: `${h.bracket.cssvar.percent(body, theme)}` };
|
|
230
230
|
for (const p of Object.values(properties)) yield p;
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
const backgroundStyles = [
|
|
234
234
|
[
|
|
235
235
|
/^bg-(linear|radial|conic)-([^/]+)(?:\/(.+))?$/,
|
|
236
|
-
([, m, d, s]) => {
|
|
236
|
+
([, m, d, s], { theme }) => {
|
|
237
237
|
let v;
|
|
238
238
|
if (h.number(d) != null) v = `from ${h.number(d)}deg ${resolveModifier(s)};`;
|
|
239
|
-
else v = h.bracket(d);
|
|
239
|
+
else v = h.bracket(d, theme);
|
|
240
240
|
if (v) return {
|
|
241
241
|
"--un-gradient-position": v,
|
|
242
242
|
"background-image": `${m}-gradient(var(--un-gradient-stops))`
|
|
@@ -250,7 +250,7 @@ const backgroundStyles = [
|
|
|
250
250
|
] }
|
|
251
251
|
],
|
|
252
252
|
[/^(from|via|to|stops)-(.+)$/, bgGradientColorResolver()],
|
|
253
|
-
[/^(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity]) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity) })],
|
|
253
|
+
[/^(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity], { theme }) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity, theme) })],
|
|
254
254
|
[/^(from|via|to)-([\d.]+%)$/, bgGradientPositionResolver()],
|
|
255
255
|
[
|
|
256
256
|
/^bg-((?:repeating-)?(?:linear|radial|conic))$/,
|
|
@@ -285,7 +285,7 @@ const backgroundStyles = [
|
|
|
285
285
|
["bg-auto", { "background-size": "auto" }],
|
|
286
286
|
["bg-cover", { "background-size": "cover" }],
|
|
287
287
|
["bg-contain", { "background-size": "contain" }],
|
|
288
|
-
[/^bg-size-(.+)$/, ([, v]) => ({ "background-size": h.bracket.cssvar(v) })],
|
|
288
|
+
[/^bg-size-(.+)$/, ([, v], { theme }) => ({ "background-size": h.bracket.cssvar(v, theme) })],
|
|
289
289
|
["bg-fixed", { "background-attachment": "fixed" }],
|
|
290
290
|
["bg-local", { "background-attachment": "local" }],
|
|
291
291
|
["bg-scroll", { "background-attachment": "scroll" }],
|
|
@@ -337,12 +337,12 @@ const outline = [
|
|
|
337
337
|
],
|
|
338
338
|
[
|
|
339
339
|
/^outline-op(?:acity)?-?(.+)$/,
|
|
340
|
-
([, opacity]) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
340
|
+
([, opacity], { theme }) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
341
341
|
{ autocomplete: "outline-(op|opacity)-<percent>" }
|
|
342
342
|
],
|
|
343
343
|
[
|
|
344
344
|
/^outline-offset-(.+)$/,
|
|
345
|
-
([, d]) => ({ "outline-offset": h.bracket.cssvar.global.px(d) }),
|
|
345
|
+
([, d], { theme }) => ({ "outline-offset": h.bracket.cssvar.global.px(d, theme) }),
|
|
346
346
|
{ autocomplete: "outline-(offset)-<num>" }
|
|
347
347
|
],
|
|
348
348
|
["outline-offset-none", { "outline-offset": "0" }],
|
|
@@ -375,8 +375,8 @@ const outline = [
|
|
|
375
375
|
"outline-style": v
|
|
376
376
|
}])
|
|
377
377
|
];
|
|
378
|
-
function* handleWidth$2([, b]) {
|
|
379
|
-
const v = h.bracket.cssvar.global.px(b);
|
|
378
|
+
function* handleWidth$2([, b], { theme }) {
|
|
379
|
+
const v = h.bracket.cssvar.global.px(b, theme);
|
|
380
380
|
if (v != null) {
|
|
381
381
|
yield {
|
|
382
382
|
"outline-style": "var(--un-outline-style)",
|
|
@@ -386,7 +386,7 @@ function* handleWidth$2([, b]) {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
function* handleColorOrWidth$2(match, ctx) {
|
|
389
|
-
if (isCSSMathFn(h.bracket(match[1]))) yield* handleWidth$2(match);
|
|
389
|
+
if (isCSSMathFn(h.bracket(match[1], ctx.theme))) yield* handleWidth$2(match, ctx);
|
|
390
390
|
else {
|
|
391
391
|
const result = colorResolver("outline-color", "outline")(match, ctx);
|
|
392
392
|
if (result) for (const i of result) yield i;
|
|
@@ -399,15 +399,15 @@ const appearance = [["appearance-auto", {
|
|
|
399
399
|
"-webkit-appearance": "none",
|
|
400
400
|
"appearance": "none"
|
|
401
401
|
}]];
|
|
402
|
-
function willChangeProperty(prop) {
|
|
403
|
-
const v = h.bracket(prop);
|
|
402
|
+
function willChangeProperty(prop, theme) {
|
|
403
|
+
const v = h.bracket(prop, theme);
|
|
404
404
|
if (v && h.properties(v)) return v;
|
|
405
405
|
return h.properties.auto.cssvar.global(prop) ?? {
|
|
406
406
|
contents: "contents",
|
|
407
407
|
scroll: "scroll-position"
|
|
408
408
|
}[prop];
|
|
409
409
|
}
|
|
410
|
-
const willChange = [[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]];
|
|
410
|
+
const willChange = [[/^will-change-(.+)/, ([, p], { theme }) => ({ "will-change": willChangeProperty(p, theme) })]];
|
|
411
411
|
const listStyles = {
|
|
412
412
|
"disc": "disc",
|
|
413
413
|
"circle": "circle",
|
|
@@ -440,8 +440,8 @@ const listStyle = [
|
|
|
440
440
|
["list-outside", { "list-style-position": "outside" }],
|
|
441
441
|
["list-inside", { "list-style-position": "inside" }],
|
|
442
442
|
["list-none", { "list-style-type": "none" }],
|
|
443
|
-
[/^list-image-(.+)$/, ([, d]) => {
|
|
444
|
-
if (/^\[url\(.+\)\]$/.test(d)) return { "list-style-image": h.bracket(d) };
|
|
443
|
+
[/^list-image-(.+)$/, ([, d], { theme }) => {
|
|
444
|
+
if (/^\[url\(.+\)\]$/.test(d)) return { "list-style-image": h.bracket(d, theme) };
|
|
445
445
|
}],
|
|
446
446
|
["list-image-none", { "list-style-image": "none" }],
|
|
447
447
|
...makeGlobalStaticRules("list", "list-style-type")
|
|
@@ -452,7 +452,7 @@ const accents = [[
|
|
|
452
452
|
{ autocomplete: "accent-$colors" }
|
|
453
453
|
], [
|
|
454
454
|
/^accent-op(?:acity)?-?(.+)$/,
|
|
455
|
-
([, d]) => ({ "--un-accent-opacity": h.bracket.percent(d) }),
|
|
455
|
+
([, d], { theme }) => ({ "--un-accent-opacity": h.bracket.percent(d, theme) }),
|
|
456
456
|
{ autocomplete: ["accent-(op|opacity)", "accent-(op|opacity)-<percent>"] }
|
|
457
457
|
]];
|
|
458
458
|
const carets = [[
|
|
@@ -461,7 +461,7 @@ const carets = [[
|
|
|
461
461
|
{ autocomplete: "caret-$colors" }
|
|
462
462
|
], [
|
|
463
463
|
/^caret-op(?:acity)?-?(.+)$/,
|
|
464
|
-
([, d]) => ({ "--un-caret-opacity": h.bracket.percent(d) }),
|
|
464
|
+
([, d], { theme }) => ({ "--un-caret-opacity": h.bracket.percent(d, theme) }),
|
|
465
465
|
{ autocomplete: ["caret-(op|opacity)", "caret-(op|opacity)-<percent>"] }
|
|
466
466
|
]];
|
|
467
467
|
const imageRenderings = [
|
|
@@ -588,19 +588,24 @@ function borderColorResolver(direction) {
|
|
|
588
588
|
}
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
function handlerBorderSize([, a = "", b = "1"]) {
|
|
592
|
-
const v = h.bracket.cssvar.global.px(b);
|
|
591
|
+
function handlerBorderSize([, a = "", b = "1"], { theme }) {
|
|
592
|
+
const v = h.bracket.bracketOfLength.cssvar.global.px(b, theme);
|
|
593
593
|
if (a in directionMap && v != null) return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
594
594
|
}
|
|
595
595
|
function handlerBorderColorOrSize([, a = "", b], ctx) {
|
|
596
596
|
if (a in directionMap) {
|
|
597
|
-
if (isCSSMathFn(h.bracket(b))) return handlerBorderSize([
|
|
597
|
+
if (isCSSMathFn(h.bracket(b, ctx.theme))) return handlerBorderSize([
|
|
598
598
|
"",
|
|
599
599
|
a,
|
|
600
600
|
b
|
|
601
|
-
]);
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
], ctx);
|
|
602
|
+
const bracketColor = h.bracketOfColor(b, ctx.theme);
|
|
603
|
+
b = bracketColor ?? b;
|
|
604
|
+
if (bracketColor != null || hasParseableColor(b, ctx.theme)) {
|
|
605
|
+
const directions = directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx) ?? colorCSSGenerator({
|
|
606
|
+
color: b,
|
|
607
|
+
name: "_"
|
|
608
|
+
}, `border${i}-color`, `border${i}`, ctx)).filter(notNull);
|
|
604
609
|
return [directions.map((d) => d[0]).reduce((acc, item) => {
|
|
605
610
|
Object.assign(acc, item);
|
|
606
611
|
return acc;
|
|
@@ -608,14 +613,14 @@ function handlerBorderColorOrSize([, a = "", b], ctx) {
|
|
|
608
613
|
}
|
|
609
614
|
}
|
|
610
615
|
}
|
|
611
|
-
function handlerBorderOpacity([, a = "", opacity]) {
|
|
612
|
-
const v = h.bracket.percent.cssvar(opacity);
|
|
616
|
+
function handlerBorderOpacity([, a = "", opacity], { theme }) {
|
|
617
|
+
const v = h.bracket.percent.cssvar(opacity, theme);
|
|
613
618
|
if (a in directionMap && v != null) return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
614
619
|
}
|
|
615
620
|
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
616
621
|
if (a in cornerMap) {
|
|
617
622
|
if (s === "full") return cornerMap[a].map((i) => [`border${i}-radius`, "calc(infinity * 1px)"]);
|
|
618
|
-
const _v = theme.radius?.[s] ?? h.bracket.cssvar.global.fraction.rem(s);
|
|
623
|
+
const _v = theme.radius?.[s] ?? h.bracket.cssvar.global.fraction.rem(s, theme);
|
|
619
624
|
if (_v != null) {
|
|
620
625
|
const isVar = theme.radius && s in theme.radius;
|
|
621
626
|
if (isVar) themeTracking(`radius`, s);
|
|
@@ -631,7 +636,7 @@ function handlerBorderStyle([, a = "", s]) {
|
|
|
631
636
|
/**
|
|
632
637
|
* @example op10 op-30 opacity-100
|
|
633
638
|
*/
|
|
634
|
-
const opacity = [[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: h.bracket.percent.cssvar(d) })]];
|
|
639
|
+
const opacity = [[/^op(?:acity)?-?(.+)$/, ([, d], { theme }) => ({ opacity: h.bracket.percent.cssvar(d, theme) })]];
|
|
635
640
|
const bgUrlRE = /^\[url\(.+\)\]$/;
|
|
636
641
|
const bgLengthRE = /^\[(?:length|size):.+\]$/;
|
|
637
642
|
const bgPositionRE = /^\[position:.+\]$/;
|
|
@@ -639,27 +644,27 @@ const bgGradientRE = /^\[(?:linear|conic|radial)-gradient\(.+\)\]$/;
|
|
|
639
644
|
const bgImageRE = /^\[image:.+\]$/;
|
|
640
645
|
const bgColors = [[
|
|
641
646
|
/^bg-(.+)$/,
|
|
642
|
-
(
|
|
643
|
-
const d =
|
|
647
|
+
(match, ctx) => {
|
|
648
|
+
const d = match[1];
|
|
649
|
+
const { theme } = ctx;
|
|
644
650
|
if (bgUrlRE.test(d)) return {
|
|
645
|
-
"--un-url": h.bracket(d),
|
|
651
|
+
"--un-url": h.bracket(d, theme),
|
|
646
652
|
"background-image": "var(--un-url)"
|
|
647
653
|
};
|
|
648
|
-
|
|
649
|
-
if (
|
|
654
|
+
const bracketLength = h.bracketOfLength(d, theme);
|
|
655
|
+
if (bgLengthRE.test(d) && bracketLength != null) return { "background-size": bracketLength.split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
656
|
+
const bracketPosition = h.bracketOfPosition(d, theme);
|
|
657
|
+
if ((isSize(d) || bgPositionRE.test(d)) && bracketPosition != null) return { "background-position": bracketPosition.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
650
658
|
if (bgGradientRE.test(d) || bgImageRE.test(d)) {
|
|
651
|
-
const s = h.bracket(d);
|
|
652
|
-
if (s) {
|
|
653
|
-
const url = s.startsWith("http") ? `url(${s})` : h.cssvar(s);
|
|
654
|
-
return { "background-image": url ?? s };
|
|
655
|
-
}
|
|
659
|
+
const s = h.bracket(d, theme);
|
|
660
|
+
if (s) return { "background-image": (s.startsWith("http") ? `url(${s})` : h.cssvar(s)) ?? s };
|
|
656
661
|
}
|
|
657
|
-
return colorResolver("background-color", "bg")(
|
|
662
|
+
return colorResolver("background-color", "bg")(match, ctx);
|
|
658
663
|
},
|
|
659
664
|
{ autocomplete: "bg-$colors" }
|
|
660
665
|
], [
|
|
661
666
|
/^bg-op(?:acity)?-?(.+)$/,
|
|
662
|
-
([, opacity]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
667
|
+
([, opacity], { theme }) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
663
668
|
{ autocomplete: "bg-(op|opacity)-<percent>" }
|
|
664
669
|
]];
|
|
665
670
|
const colorScheme = [[/^(?:color-)?scheme-(.+)$/, ([, v]) => ({ "color-scheme": v.split("-").join(" ") })]];
|
|
@@ -673,7 +678,7 @@ const columns = [
|
|
|
673
678
|
themeTracking("container", v);
|
|
674
679
|
return { columns: generateThemeVariable("container", v) };
|
|
675
680
|
}
|
|
676
|
-
return { columns: h.bracket.numberWithUnit.number.cssvar(v) };
|
|
681
|
+
return { columns: h.bracket.numberWithUnit.number.cssvar(v, theme) };
|
|
677
682
|
},
|
|
678
683
|
{ autocomplete: ["columns-<num>", "columns-$container"] }
|
|
679
684
|
],
|
|
@@ -735,12 +740,12 @@ const textDecorations = [
|
|
|
735
740
|
],
|
|
736
741
|
[
|
|
737
742
|
/^(?:underline|decoration)-op(?:acity)?-?(.+)$/,
|
|
738
|
-
([, opacity]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
743
|
+
([, opacity], { theme }) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
739
744
|
{ autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }
|
|
740
745
|
],
|
|
741
746
|
[
|
|
742
747
|
/^(?:underline|decoration)-offset-(.+)$/,
|
|
743
|
-
([, s]) => ({ "text-underline-offset": h.auto.bracket.cssvar.global.px(s) }),
|
|
748
|
+
([, s], { theme }) => ({ "text-underline-offset": h.auto.bracket.cssvar.global.px(s, theme) }),
|
|
744
749
|
{ autocomplete: "(underline|decoration)-(offset)-<num>" }
|
|
745
750
|
],
|
|
746
751
|
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
@@ -748,11 +753,11 @@ const textDecorations = [
|
|
|
748
753
|
["no-underline", { "text-decoration": "none" }],
|
|
749
754
|
["decoration-none", { "text-decoration": "none" }]
|
|
750
755
|
];
|
|
751
|
-
function handleWidth$1([, b]) {
|
|
752
|
-
return { "text-decoration-thickness": h.bracket.cssvar.global.px(b) };
|
|
756
|
+
function handleWidth$1([, b], { theme }) {
|
|
757
|
+
return { "text-decoration-thickness": h.bracket.cssvar.global.px(b, theme) };
|
|
753
758
|
}
|
|
754
759
|
function handleColorOrWidth$1(match, ctx) {
|
|
755
|
-
if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$1(match);
|
|
760
|
+
if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth$1(match, ctx);
|
|
756
761
|
const result = colorResolver("text-decoration-color", "line")(match, ctx);
|
|
757
762
|
if (result) {
|
|
758
763
|
const css = result[0];
|
|
@@ -816,6 +821,7 @@ const spaces = [[
|
|
|
816
821
|
function notLastChildSelectorVariant(s) {
|
|
817
822
|
return {
|
|
818
823
|
matcher: s,
|
|
824
|
+
order: 1,
|
|
819
825
|
handle: (input, next) => next({
|
|
820
826
|
...input,
|
|
821
827
|
parent: `${input.parent ? `${input.parent} $$ ` : ""}${input.selector}`,
|
|
@@ -829,7 +835,7 @@ function* handlerSpace([m, d, s], { theme, symbols }) {
|
|
|
829
835
|
if (num != null) {
|
|
830
836
|
themeTracking(`spacing`);
|
|
831
837
|
v = `calc(var(--spacing) * ${num})`;
|
|
832
|
-
} else v = theme.spacing?.[s] ?? h.bracket.cssvar.auto.fraction.rem(s || "1");
|
|
838
|
+
} else v = theme.spacing?.[s] ?? h.bracket.cssvar.auto.fraction.rem(s || "1", theme);
|
|
833
839
|
if (v != null) {
|
|
834
840
|
const results = directionMap[d === "x" ? "inline" : "block"].map((item, index) => {
|
|
835
841
|
return [`margin${item}`, `calc(${v} * ${index === 0 ? `var(--un-space-${d}-reverse)` : `calc(1 - var(--un-space-${d}-reverse))`})`];
|
|
@@ -863,10 +869,10 @@ const divides = [
|
|
|
863
869
|
],
|
|
864
870
|
[
|
|
865
871
|
/^divide-op(?:acity)?-?(.+)$/,
|
|
866
|
-
function* ([match, opacity], { symbols }) {
|
|
872
|
+
function* ([match, opacity], { symbols, theme }) {
|
|
867
873
|
yield {
|
|
868
874
|
[symbols.variants]: [notLastChildSelectorVariant(match)],
|
|
869
|
-
"--un-divide-opacity": h.bracket.percent(opacity)
|
|
875
|
+
"--un-divide-opacity": h.bracket.percent(opacity, theme)
|
|
870
876
|
};
|
|
871
877
|
},
|
|
872
878
|
{ autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }
|
|
@@ -895,8 +901,8 @@ const divides = [
|
|
|
895
901
|
{ autocomplete: borderStyles.map((i) => `divide-${i}`) }
|
|
896
902
|
]
|
|
897
903
|
];
|
|
898
|
-
function* handlerDivide([m, d, s], { symbols }) {
|
|
899
|
-
let v = h.bracket.cssvar.px(s || "1");
|
|
904
|
+
function* handlerDivide([m, d, s], { symbols, theme }) {
|
|
905
|
+
let v = h.bracket.cssvar.px(s || "1", theme);
|
|
900
906
|
if (v != null) {
|
|
901
907
|
if (v === "0") v = "0px";
|
|
902
908
|
const results = {
|
|
@@ -945,8 +951,8 @@ const backdropBaseKeys = [
|
|
|
945
951
|
];
|
|
946
952
|
const backdropProperties = backdropBaseKeys.map((i) => defineProperty(`--un-${i}`));
|
|
947
953
|
const backdropCSS = backdropBaseKeys.map((i) => `var(--un-${i},)`).join(" ");
|
|
948
|
-
function percentWithDefault(str) {
|
|
949
|
-
let v = h.bracket.cssvar(str || "");
|
|
954
|
+
function percentWithDefault(str, theme) {
|
|
955
|
+
let v = h.bracket.cssvar(str || "", theme);
|
|
950
956
|
if (v != null) return v;
|
|
951
957
|
v = str ? h.percent(str) : "100%";
|
|
952
958
|
if (v != null && Number.parseFloat(v.slice(0, -1)) <= 100) return v;
|
|
@@ -974,9 +980,9 @@ function dropShadowResolver(match, ctx) {
|
|
|
974
980
|
if (s.startsWith("/")) res = ["", s.slice(1)];
|
|
975
981
|
}
|
|
976
982
|
let v = theme.dropShadow?.[res[0] || "DEFAULT"];
|
|
977
|
-
const c = s ? h.bracket.cssvar(s) : void 0;
|
|
983
|
+
const c = s ? h.bracket.cssvar(s, theme) : void 0;
|
|
978
984
|
if ((v != null || c != null) && !hasParseableColor(c, theme)) {
|
|
979
|
-
const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
|
|
985
|
+
const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
|
|
980
986
|
return [{
|
|
981
987
|
"--un-drop-shadow-opacity": alpha,
|
|
982
988
|
"--un-drop-shadow": `drop-shadow(${colorableShadows(v || c, "--un-drop-shadow-color", alpha).join(") drop-shadow(")})`,
|
|
@@ -984,7 +990,7 @@ function dropShadowResolver(match, ctx) {
|
|
|
984
990
|
}, ...filterProperties];
|
|
985
991
|
}
|
|
986
992
|
if (hasParseableColor(s, theme)) return colorResolver("--un-drop-shadow-color", "drop-shadow")(match, ctx);
|
|
987
|
-
v = h.bracket.cssvar(s) ?? (s === "none" ? "" : void 0);
|
|
993
|
+
v = h.bracket.cssvar(s, theme) ?? (s === "none" ? "" : void 0);
|
|
988
994
|
if (v != null) return [{
|
|
989
995
|
"--un-drop-shadow": v ? `drop-shadow(${v})` : v,
|
|
990
996
|
"filter": filterCSS
|
|
@@ -993,7 +999,7 @@ function dropShadowResolver(match, ctx) {
|
|
|
993
999
|
const filters = [
|
|
994
1000
|
[
|
|
995
1001
|
/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/,
|
|
996
|
-
toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || h.bracket.cssvar.px(s)),
|
|
1002
|
+
toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || h.bracket.cssvar.px(s, theme)),
|
|
997
1003
|
{ autocomplete: [
|
|
998
1004
|
"(backdrop|filter)-blur-$blur",
|
|
999
1005
|
"blur-$blur",
|
|
@@ -1002,12 +1008,12 @@ const filters = [
|
|
|
1002
1008
|
],
|
|
1003
1009
|
[
|
|
1004
1010
|
/^(?:(backdrop-)|filter-)?brightness-(.+)$/,
|
|
1005
|
-
toFilter("brightness", (s) => h.bracket.cssvar.percent(s)),
|
|
1011
|
+
toFilter("brightness", (s, theme) => h.bracket.cssvar.percent(s, theme)),
|
|
1006
1012
|
{ autocomplete: ["(backdrop|filter)-brightness-<percent>", "brightness-<percent>"] }
|
|
1007
1013
|
],
|
|
1008
1014
|
[
|
|
1009
1015
|
/^(?:(backdrop-)|filter-)?contrast-(.+)$/,
|
|
1010
|
-
toFilter("contrast", (s) => h.bracket.cssvar.percent(s)),
|
|
1016
|
+
toFilter("contrast", (s, theme) => h.bracket.cssvar.percent(s, theme)),
|
|
1011
1017
|
{ autocomplete: ["(backdrop|filter)-contrast-<percent>", "contrast-<percent>"] }
|
|
1012
1018
|
],
|
|
1013
1019
|
[
|
|
@@ -1032,7 +1038,7 @@ const filters = [
|
|
|
1032
1038
|
] }
|
|
1033
1039
|
],
|
|
1034
1040
|
[/^(?:filter-)?drop-shadow-color-(.+)$/, colorResolver("--un-drop-shadow-color", "drop-shadow")],
|
|
1035
|
-
[/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": h.bracket.percent(opacity) })],
|
|
1041
|
+
[/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([, opacity], { theme }) => ({ "--un-drop-shadow-opacity": h.bracket.percent(opacity, theme) })],
|
|
1036
1042
|
[
|
|
1037
1043
|
/^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/,
|
|
1038
1044
|
toFilter("grayscale", percentWithDefault),
|
|
@@ -1042,7 +1048,7 @@ const filters = [
|
|
|
1042
1048
|
"grayscale-<percent>"
|
|
1043
1049
|
] }
|
|
1044
1050
|
],
|
|
1045
|
-
[/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => h.bracket.cssvar.degree(s))],
|
|
1051
|
+
[/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s, theme) => h.bracket.cssvar.degree(s, theme))],
|
|
1046
1052
|
[
|
|
1047
1053
|
/^(?:(backdrop-)|filter-)?invert(?:-(.+))?$/,
|
|
1048
1054
|
toFilter("invert", percentWithDefault),
|
|
@@ -1054,12 +1060,12 @@ const filters = [
|
|
|
1054
1060
|
],
|
|
1055
1061
|
[
|
|
1056
1062
|
/^(backdrop-)op(?:acity)?-(.+)$/,
|
|
1057
|
-
toFilter("opacity", (s) => h.bracket.cssvar.percent(s)),
|
|
1063
|
+
toFilter("opacity", (s, theme) => h.bracket.cssvar.percent(s, theme)),
|
|
1058
1064
|
{ autocomplete: ["backdrop-(op|opacity)", "backdrop-(op|opacity)-<percent>"] }
|
|
1059
1065
|
],
|
|
1060
1066
|
[
|
|
1061
1067
|
/^(?:(backdrop-)|filter-)?saturate-(.+)$/,
|
|
1062
|
-
toFilter("saturate", (s) => h.bracket.cssvar.percent(s)),
|
|
1068
|
+
toFilter("saturate", (s, theme) => h.bracket.cssvar.percent(s, theme)),
|
|
1063
1069
|
{ autocomplete: [
|
|
1064
1070
|
"(backdrop|filter)-saturate",
|
|
1065
1071
|
"(backdrop|filter)-saturate-<percent>",
|
|
@@ -1097,30 +1103,33 @@ const flex = [
|
|
|
1097
1103
|
["flex", { display: "flex" }],
|
|
1098
1104
|
["inline-flex", { display: "inline-flex" }],
|
|
1099
1105
|
["flex-inline", { display: "inline-flex" }],
|
|
1100
|
-
[/^flex-(.*)$/, ([, d]
|
|
1106
|
+
[/^flex-(.*)$/, ([, d], { theme }) => {
|
|
1107
|
+
const value = h.bracket(d, theme);
|
|
1108
|
+
return { flex: value != null ? value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) };
|
|
1109
|
+
}],
|
|
1101
1110
|
["flex-1", { flex: "1 1 0%" }],
|
|
1102
1111
|
["flex-auto", { flex: "1 1 auto" }],
|
|
1103
1112
|
["flex-initial", { flex: "0 1 auto" }],
|
|
1104
1113
|
["flex-none", { flex: "none" }],
|
|
1105
1114
|
[
|
|
1106
1115
|
/^(?:flex-)?shrink(?:-(.*))?$/,
|
|
1107
|
-
([, d = ""]) => ({ "flex-shrink": h.bracket.cssvar.number(d) ?? 1 }),
|
|
1116
|
+
([, d = ""], { theme }) => ({ "flex-shrink": h.bracket.cssvar.number(d, theme) ?? 1 }),
|
|
1108
1117
|
{ autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }
|
|
1109
1118
|
],
|
|
1110
1119
|
[
|
|
1111
1120
|
/^(?:flex-)?grow(?:-(.*))?$/,
|
|
1112
|
-
([, d = ""]) => ({ "flex-grow": h.bracket.cssvar.number(d) ?? 1 }),
|
|
1121
|
+
([, d = ""], { theme }) => ({ "flex-grow": h.bracket.cssvar.number(d, theme) ?? 1 }),
|
|
1113
1122
|
{ autocomplete: ["flex-grow-<num>", "grow-<num>"] }
|
|
1114
1123
|
],
|
|
1115
1124
|
[
|
|
1116
1125
|
/^(?:flex-)?basis-(.+)$/,
|
|
1117
|
-
([, d]) => {
|
|
1126
|
+
([, d], { theme }) => {
|
|
1118
1127
|
const v = numberResolver(d);
|
|
1119
1128
|
if (v != null) {
|
|
1120
1129
|
themeTracking(`spacing`);
|
|
1121
1130
|
return { "flex-basis": `calc(var(--spacing) * ${v})` };
|
|
1122
1131
|
}
|
|
1123
|
-
return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d) };
|
|
1132
|
+
return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d, theme) };
|
|
1124
1133
|
},
|
|
1125
1134
|
{ autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }
|
|
1126
1135
|
],
|
|
@@ -1163,54 +1172,54 @@ const gaps = [
|
|
|
1163
1172
|
function rowCol(s) {
|
|
1164
1173
|
return s.replace("col", "column");
|
|
1165
1174
|
}
|
|
1166
|
-
function autoDirection(prop) {
|
|
1175
|
+
function autoDirection(prop, theme) {
|
|
1167
1176
|
switch (prop) {
|
|
1168
1177
|
case "min": return "min-content";
|
|
1169
1178
|
case "max": return "max-content";
|
|
1170
1179
|
case "fr": return "minmax(0,1fr)";
|
|
1171
1180
|
}
|
|
1172
|
-
return h.bracket.cssvar.auto.rem(prop);
|
|
1181
|
+
return h.bracket.cssvar.auto.rem(prop, theme);
|
|
1173
1182
|
}
|
|
1174
1183
|
const grids = [
|
|
1175
1184
|
["grid", { display: "grid" }],
|
|
1176
1185
|
["inline-grid", { display: "inline-grid" }],
|
|
1177
|
-
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: h.bracket.number.cssvar.auto(v) })],
|
|
1186
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}`]: h.bracket.number.cssvar.auto(v, theme) })],
|
|
1178
1187
|
[
|
|
1179
1188
|
/^(?:grid-)?(row|col)-span-(.+)$/,
|
|
1180
|
-
([, c, s]) => {
|
|
1189
|
+
([, c, s], { theme }) => {
|
|
1181
1190
|
if (s === "full") return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
1182
|
-
const v = h.bracket.number.cssvar(s);
|
|
1191
|
+
const v = h.bracket.number.cssvar(s, theme);
|
|
1183
1192
|
if (v != null) return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
1184
1193
|
},
|
|
1185
1194
|
{ autocomplete: "(grid-row|grid-col|row|col)-span-<num>" }
|
|
1186
1195
|
],
|
|
1187
|
-
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v) ?? v })],
|
|
1196
|
+
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v, theme) ?? v })],
|
|
1188
1197
|
[
|
|
1189
1198
|
/^(?:grid-)?(row|col)-end-(.+)$/,
|
|
1190
|
-
([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v) ?? v }),
|
|
1199
|
+
([, c, v], { theme }) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v, theme) ?? v }),
|
|
1191
1200
|
{ autocomplete: "(grid-row|grid-col|row|col)-(start|end)-<num>" }
|
|
1192
1201
|
],
|
|
1193
1202
|
[
|
|
1194
1203
|
/^(?:grid-)?auto-(rows|cols)-(.+)$/,
|
|
1195
|
-
([, c, v]) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v) }),
|
|
1204
|
+
([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) }),
|
|
1196
1205
|
{ autocomplete: "(grid-auto|auto)-(rows|cols)-<num>" }
|
|
1197
1206
|
],
|
|
1198
|
-
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": h.bracket.cssvar(v) })],
|
|
1207
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v], { theme }) => ({ "grid-auto-flow": h.bracket.cssvar(v, theme) })],
|
|
1199
1208
|
[
|
|
1200
1209
|
/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/,
|
|
1201
1210
|
([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }),
|
|
1202
1211
|
{ autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }
|
|
1203
1212
|
],
|
|
1204
|
-
[/^(?:grid-)?(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: h.bracket.cssvar(v) })],
|
|
1213
|
+
[/^(?:grid-)?(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-template-${rowCol(c)}`]: h.bracket.cssvar(v, theme) })],
|
|
1205
1214
|
[/^(?:grid-)?(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
1206
1215
|
[
|
|
1207
1216
|
/^(?:grid-)?(rows|cols)-(\d+)$/,
|
|
1208
1217
|
([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }),
|
|
1209
1218
|
{ autocomplete: "(grid-rows|grid-cols|rows|cols)-<num>" }
|
|
1210
1219
|
],
|
|
1211
|
-
[/^grid-area(s)?-(.+)$/, ([, s, v]) => {
|
|
1212
|
-
if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s)}"`).join(" ") };
|
|
1213
|
-
return { "grid-area": h.bracket.cssvar(v) };
|
|
1220
|
+
[/^grid-area(s)?-(.+)$/, ([, s, v], { theme }) => {
|
|
1221
|
+
if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s, theme)}"`).join(" ") };
|
|
1222
|
+
return { "grid-area": h.bracket.cssvar(v, theme) };
|
|
1214
1223
|
}],
|
|
1215
1224
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
1216
1225
|
["grid-cols-none", { "grid-template-columns": "none" }],
|
|
@@ -1265,12 +1274,9 @@ const baseMaskImage = {
|
|
|
1265
1274
|
"mask-image": "var(--un-mask-linear), var(--un-mask-radial), var(--un-mask-conic)",
|
|
1266
1275
|
"mask-composite": "intersect"
|
|
1267
1276
|
};
|
|
1268
|
-
function handlePosition([, v = ""]) {
|
|
1269
|
-
if (v in cornerMap) {
|
|
1270
|
-
|
|
1271
|
-
return { "mask-position": positions };
|
|
1272
|
-
}
|
|
1273
|
-
const _v = h.bracket.cssvar.global.position(v);
|
|
1277
|
+
function handlePosition([, v = ""], ctx) {
|
|
1278
|
+
if (v in cornerMap) return { "mask-position": v.split("").flatMap((c) => linearMap[c]).join(" ") };
|
|
1279
|
+
const _v = h.bracket.cssvar.global.position(v, ctx?.theme);
|
|
1274
1280
|
if (_v !== null) return { "mask-position": _v };
|
|
1275
1281
|
}
|
|
1276
1282
|
function handleImage([_, gradient = "", direction, val], ctx) {
|
|
@@ -1287,8 +1293,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
|
|
|
1287
1293
|
css[`--un-mask-${dir}`] = `linear-gradient(to ${dir}, var(--un-mask-${dir}-from-color) var(--un-mask-${dir}-from-position), var(--un-mask-${dir}-to-color) var(--un-mask-${dir}-to-position))`;
|
|
1288
1294
|
if (numberResolver(val) != null) {
|
|
1289
1295
|
themeTracking("spacing");
|
|
1290
|
-
css[`--un-mask-${dir}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
|
|
1291
|
-
} else css[`--un-mask-${dir}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val);
|
|
1296
|
+
css[`--un-mask-${dir}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val, ctx.theme)})`;
|
|
1297
|
+
} else css[`--un-mask-${dir}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val, ctx.theme);
|
|
1292
1298
|
if (hasParseableColor(val, ctx.theme)) {
|
|
1293
1299
|
const result = colorResolver(`--un-mask-${dir}-${direction}-color`, hyphenate("colors"))([_, val], ctx);
|
|
1294
1300
|
if (result) {
|
|
@@ -1314,10 +1320,10 @@ function handleImage([_, gradient = "", direction, val], ctx) {
|
|
|
1314
1320
|
} else {
|
|
1315
1321
|
if (direction == null) if (gradient === "radial") {
|
|
1316
1322
|
css["--un-mask-radial"] = "radial-gradient(var(--un-mask-radial-stops, var(--un-mask-radial-size)))";
|
|
1317
|
-
css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val);
|
|
1323
|
+
css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val, ctx.theme);
|
|
1318
1324
|
} else {
|
|
1319
1325
|
css[`--un-mask-${gradient}`] = `${gradient}-gradient(var(--un-mask-${gradient}-stops, var(--un-mask-${gradient}-position)))`;
|
|
1320
|
-
css[`--un-mask-${gradient}-position`] = numberResolver(val) ? `calc(1deg * ${h.bracket.cssvar.number(val)})` : h.bracket.cssvar.fraction(val);
|
|
1326
|
+
css[`--un-mask-${gradient}-position`] = numberResolver(val) ? `calc(1deg * ${h.bracket.cssvar.number(val, ctx.theme)})` : h.bracket.cssvar.fraction(val, ctx.theme);
|
|
1321
1327
|
}
|
|
1322
1328
|
else {
|
|
1323
1329
|
const gradientStopsPrefixMap = {
|
|
@@ -1336,8 +1342,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
|
|
|
1336
1342
|
}
|
|
1337
1343
|
} else if (numberResolver(val) != null) {
|
|
1338
1344
|
themeTracking("spacing");
|
|
1339
|
-
css[`--un-mask-${gradient}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
|
|
1340
|
-
} else css[`--un-mask-${gradient}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val);
|
|
1345
|
+
css[`--un-mask-${gradient}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val, ctx.theme)})`;
|
|
1346
|
+
} else css[`--un-mask-${gradient}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val, ctx.theme);
|
|
1341
1347
|
}
|
|
1342
1348
|
if (gradient === "radial") props.push(...[defineProperty("--un-mask-radial-shape", { initialValue: "ellipse" }), defineProperty("--un-mask-radial-size", { initialValue: "farthest-corner" })]);
|
|
1343
1349
|
props.push(...["from", "to"].flatMap((p) => [
|
|
@@ -1354,8 +1360,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
|
|
|
1354
1360
|
}
|
|
1355
1361
|
return [css, ...props];
|
|
1356
1362
|
}
|
|
1357
|
-
function handleSize$1([, v = ""]) {
|
|
1358
|
-
const _v = h.bracket.cssvar.global.fraction.rem(v);
|
|
1363
|
+
function handleSize$1([, v = ""], ctx) {
|
|
1364
|
+
const _v = h.bracket.cssvar.global.fraction.rem(v, ctx?.theme);
|
|
1359
1365
|
if (_v !== null) return { "mask-size": _v };
|
|
1360
1366
|
}
|
|
1361
1367
|
const masks = [
|
|
@@ -1370,7 +1376,7 @@ const masks = [
|
|
|
1370
1376
|
["mask-subtract", { "mask-composite": "subtract" }],
|
|
1371
1377
|
["mask-intersect", { "mask-composite": "intersect" }],
|
|
1372
1378
|
["mask-exclude", { "mask-composite": "exclude" }],
|
|
1373
|
-
[/^mask-(.+)$/, ([, v]) => ({ "mask-image": h.bracket.cssvar(v) })],
|
|
1379
|
+
[/^mask-(.+)$/, ([, v], { theme }) => ({ "mask-image": h.bracket.cssvar(v, theme) })],
|
|
1374
1380
|
[
|
|
1375
1381
|
/^mask-(linear|radial|conic|[xytblr])-(from|to)()(?:-(.+))?$/,
|
|
1376
1382
|
handleImage,
|
|
@@ -1432,7 +1438,7 @@ const placeholders = [[
|
|
|
1432
1438
|
{ autocomplete: "placeholder-$colors" }
|
|
1433
1439
|
], [
|
|
1434
1440
|
/^\$ placeholder-op(?:acity)?-?(.+)$/,
|
|
1435
|
-
([, opacity]) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity) }),
|
|
1441
|
+
([, opacity], { theme }) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity, theme) }),
|
|
1436
1442
|
{ autocomplete: ["placeholder-(op|opacity)", "placeholder-(op|opacity)-<percent>"] }
|
|
1437
1443
|
]];
|
|
1438
1444
|
//#endregion
|
|
@@ -1482,7 +1488,7 @@ const justifies = [
|
|
|
1482
1488
|
...makeGlobalStaticRules("justify-self")
|
|
1483
1489
|
];
|
|
1484
1490
|
const orders = [
|
|
1485
|
-
[/^order-(.+)$/, ([, v]) => ({ order: h.bracket.cssvar.number(v) })],
|
|
1491
|
+
[/^order-(.+)$/, ([, v], { theme }) => ({ order: h.bracket.cssvar.number(v, theme) })],
|
|
1486
1492
|
["order-first", { order: "calc(-infinity)" }],
|
|
1487
1493
|
["order-last", { order: "calc(infinity)" }],
|
|
1488
1494
|
["order-none", { order: "0" }]
|
|
@@ -1558,21 +1564,21 @@ const flexGridJustifiesAlignments = [
|
|
|
1558
1564
|
...alignments,
|
|
1559
1565
|
...placements
|
|
1560
1566
|
].flatMap(([k, v]) => [[`flex-${k}`, v], [`grid-${k}`, v]]);
|
|
1561
|
-
function handleInsetValue(v) {
|
|
1567
|
+
function handleInsetValue(v, theme) {
|
|
1562
1568
|
const _v = numberResolver(v);
|
|
1563
1569
|
if (_v != null) {
|
|
1564
1570
|
themeTracking(`spacing`);
|
|
1565
1571
|
return `calc(var(--spacing) * ${_v})`;
|
|
1566
|
-
} else return h.bracket.cssvar.global.auto.fraction.rem(v);
|
|
1572
|
+
} else return h.bracket.cssvar.global.auto.fraction.rem(v, theme);
|
|
1567
1573
|
}
|
|
1568
|
-
function handleInsetValues([, d, v]) {
|
|
1569
|
-
const r = handleInsetValue(v);
|
|
1574
|
+
function handleInsetValues([, d, v], { theme }) {
|
|
1575
|
+
const r = handleInsetValue(v, theme);
|
|
1570
1576
|
if (r != null && d in insetMap) return insetMap[d].map((i) => [i.slice(1), r]);
|
|
1571
1577
|
}
|
|
1572
1578
|
const insets = [
|
|
1573
1579
|
[
|
|
1574
1580
|
/^(?:position-|pos-)?inset-(.+)$/,
|
|
1575
|
-
([, v]) => ({ inset: handleInsetValue(v) }),
|
|
1581
|
+
([, v], { theme }) => ({ inset: handleInsetValue(v, theme) }),
|
|
1576
1582
|
{ autocomplete: [
|
|
1577
1583
|
"(position|pos)-inset-<directions>-$spacing",
|
|
1578
1584
|
"(position|pos)-inset-(block|inline)-$spacing",
|
|
@@ -1585,7 +1591,7 @@ const insets = [
|
|
|
1585
1591
|
[/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
|
|
1586
1592
|
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
1587
1593
|
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
1588
|
-
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
1594
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], { theme }) => ({ [d]: handleInsetValue(v, theme) })]
|
|
1589
1595
|
];
|
|
1590
1596
|
const floats = [
|
|
1591
1597
|
["float-left", { float: "left" }],
|
|
@@ -1604,7 +1610,7 @@ const floats = [
|
|
|
1604
1610
|
];
|
|
1605
1611
|
const zIndexes = [[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": h.number(v) })], [
|
|
1606
1612
|
/^(?:position-|pos-)?z-(.+)$/,
|
|
1607
|
-
([, v]) => ({ "z-index": h.bracket.cssvar.global.auto.number(v) }),
|
|
1613
|
+
([, v], { theme }) => ({ "z-index": h.bracket.cssvar.global.auto.number(v, theme) }),
|
|
1608
1614
|
{ autocomplete: "z-<num>" }
|
|
1609
1615
|
]];
|
|
1610
1616
|
const boxSizing = [
|
|
@@ -1649,7 +1655,7 @@ const boxShadows = [
|
|
|
1649
1655
|
],
|
|
1650
1656
|
[
|
|
1651
1657
|
/^shadow-op(?:acity)?-?(.+)$/,
|
|
1652
|
-
([, opacity]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
1658
|
+
([, opacity], { theme }) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
1653
1659
|
{ autocomplete: "shadow-(op|opacity)-<percent>" }
|
|
1654
1660
|
],
|
|
1655
1661
|
[
|
|
@@ -1659,7 +1665,7 @@ const boxShadows = [
|
|
|
1659
1665
|
],
|
|
1660
1666
|
[
|
|
1661
1667
|
/^inset-shadow-op(?:acity)?-?(.+)$/,
|
|
1662
|
-
([, opacity]) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
1668
|
+
([, opacity], { theme }) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
1663
1669
|
{ autocomplete: "shadow-(op|opacity)-<percent>" }
|
|
1664
1670
|
]
|
|
1665
1671
|
];
|
|
@@ -1673,10 +1679,10 @@ function handleShadow(themeKey) {
|
|
|
1673
1679
|
if (d.startsWith("/")) res = ["", d.slice(1)];
|
|
1674
1680
|
}
|
|
1675
1681
|
const v = theme[themeKey]?.[res[0] || "DEFAULT"];
|
|
1676
|
-
const c = d ? h.bracket.cssvar(d) : void 0;
|
|
1682
|
+
const c = d ? h.bracket.cssvar(d, theme) : void 0;
|
|
1677
1683
|
const shadowVar = hyphenate(themeKey);
|
|
1678
1684
|
if ((v != null || c != null) && !hasParseableColor(c, theme)) {
|
|
1679
|
-
const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
|
|
1685
|
+
const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
|
|
1680
1686
|
return [{
|
|
1681
1687
|
[`--un-${shadowVar}-opacity`]: alpha,
|
|
1682
1688
|
[`--un-${shadowVar}`]: colorableShadows(v || c, `--un-${shadowVar}-color`, alpha).join(","),
|
|
@@ -1689,8 +1695,8 @@ function handleShadow(themeKey) {
|
|
|
1689
1695
|
//#endregion
|
|
1690
1696
|
//#region src/rules/ring.ts
|
|
1691
1697
|
const rings = [
|
|
1692
|
-
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
1693
|
-
const v = h.bracket.px(d || "1");
|
|
1698
|
+
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
1699
|
+
const v = h.bracket.px(d || "1", theme);
|
|
1694
1700
|
if (v != null) return [{
|
|
1695
1701
|
"--un-ring-shadow": `var(--un-ring-inset,) 0 0 0 calc(${v} + var(--un-ring-offset-width)) var(--un-ring-color, currentColor)`,
|
|
1696
1702
|
"box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
@@ -1703,11 +1709,11 @@ const rings = [
|
|
|
1703
1709
|
],
|
|
1704
1710
|
[
|
|
1705
1711
|
/^ring-op(?:acity)?-?(.+)$/,
|
|
1706
|
-
([, opacity]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
1712
|
+
([, opacity], { theme }) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
1707
1713
|
{ autocomplete: "ring-(op|opacity)-<percent>" }
|
|
1708
1714
|
],
|
|
1709
|
-
[/^inset-ring(?:-(.+))?$/, ([, d]) => {
|
|
1710
|
-
const v = h.bracket.px(d || "1");
|
|
1715
|
+
[/^inset-ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
1716
|
+
const v = h.bracket.px(d || "1", theme);
|
|
1711
1717
|
if (v != null) return [{
|
|
1712
1718
|
"--un-inset-ring-shadow": `inset 0 0 0 ${v} var(--un-inset-ring-color, currentColor)`,
|
|
1713
1719
|
"box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
@@ -1720,13 +1726,13 @@ const rings = [
|
|
|
1720
1726
|
],
|
|
1721
1727
|
[
|
|
1722
1728
|
/^inset-ring-op(?:acity)?-?(.+)$/,
|
|
1723
|
-
([, opacity]) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
1729
|
+
([, opacity], { theme }) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
1724
1730
|
{ autocomplete: "inset-ring-(op|opacity)-<percent>" }
|
|
1725
1731
|
],
|
|
1726
1732
|
[
|
|
1727
1733
|
/^ring-offset(?:-(?:width-|size-)?(.+))?$/,
|
|
1728
|
-
([, d]) => {
|
|
1729
|
-
const v = h.bracket.cssvar.px(d || "1");
|
|
1734
|
+
([, d], { theme }) => {
|
|
1735
|
+
const v = h.bracket.cssvar.px(d || "1", theme);
|
|
1730
1736
|
if (v != null) return {
|
|
1731
1737
|
"--un-ring-offset-width": v,
|
|
1732
1738
|
"--un-ring-offset-shadow": "var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)"
|
|
@@ -1741,7 +1747,7 @@ const rings = [
|
|
|
1741
1747
|
],
|
|
1742
1748
|
[
|
|
1743
1749
|
/^ring-offset-op(?:acity)?-?(.+)$/,
|
|
1744
|
-
([, opacity]) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
1750
|
+
([, opacity], { theme }) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
1745
1751
|
{ autocomplete: "ring-offset-(op|opacity)-<percent>" }
|
|
1746
1752
|
],
|
|
1747
1753
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
@@ -1817,7 +1823,7 @@ function getSizeValue(theme, hw, prop) {
|
|
|
1817
1823
|
themeTracking(`spacing`);
|
|
1818
1824
|
v = `calc(var(--spacing) * ${h.number(prop)})`;
|
|
1819
1825
|
}
|
|
1820
|
-
return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop);
|
|
1826
|
+
return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop, theme);
|
|
1821
1827
|
}
|
|
1822
1828
|
const sizes = [
|
|
1823
1829
|
[/^size-(min-|max-)?(.+)$/, ([, m, s], { theme }) => ({
|
|
@@ -1858,17 +1864,17 @@ function handleBreakpoint(context, point, key = "breakpoint") {
|
|
|
1858
1864
|
const bp = resolveBreakpoints(context, key);
|
|
1859
1865
|
if (bp) return bp.find((i) => i.point === point)?.size;
|
|
1860
1866
|
}
|
|
1861
|
-
function getAspectRatio(prop) {
|
|
1867
|
+
function getAspectRatio(prop, theme) {
|
|
1862
1868
|
if (/^\d+\/\d+$/.test(prop)) return prop;
|
|
1863
1869
|
switch (prop) {
|
|
1864
1870
|
case "square": return "1/1";
|
|
1865
1871
|
case "video": return "16/9";
|
|
1866
1872
|
}
|
|
1867
|
-
return h.bracket.cssvar.global.auto.number(prop);
|
|
1873
|
+
return h.bracket.cssvar.global.auto.number(prop, theme);
|
|
1868
1874
|
}
|
|
1869
1875
|
const aspectRatio = [[
|
|
1870
1876
|
/^(?:size-)?aspect-(?:ratio-)?(.+)$/,
|
|
1871
|
-
([, d]) => ({ "aspect-ratio": getAspectRatio(d) }),
|
|
1877
|
+
([, d], { theme }) => ({ "aspect-ratio": getAspectRatio(d, theme) }),
|
|
1872
1878
|
{ autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }
|
|
1873
1879
|
]];
|
|
1874
1880
|
//#endregion
|
|
@@ -1925,7 +1931,7 @@ const displays = [
|
|
|
1925
1931
|
["flow-root", { display: "flow-root" }],
|
|
1926
1932
|
["list-item", { display: "list-item" }],
|
|
1927
1933
|
["hidden", { display: "none" }],
|
|
1928
|
-
[/^display-(.+)$/, ([, c]) => ({ display: h.bracket.cssvar.global(c) })]
|
|
1934
|
+
[/^display-(.+)$/, ([, c], { theme }) => ({ display: h.bracket.cssvar.global(c, theme) })]
|
|
1929
1935
|
];
|
|
1930
1936
|
const appearances = [
|
|
1931
1937
|
["visible", { visibility: "visible" }],
|
|
@@ -1935,10 +1941,11 @@ const appearances = [
|
|
|
1935
1941
|
["backface-hidden", { "backface-visibility": "hidden" }],
|
|
1936
1942
|
...makeGlobalStaticRules("backface", "backface-visibility")
|
|
1937
1943
|
];
|
|
1938
|
-
const cursors = [[/^cursor-(.+)$/, ([, c]) => ({ cursor: h.bracket.cssvar.global(c) })], ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])];
|
|
1944
|
+
const cursors = [[/^cursor-(.+)$/, ([, c], { theme }) => ({ cursor: h.bracket.cssvar.global(c, theme) })], ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])];
|
|
1939
1945
|
const contains = [
|
|
1940
|
-
[/^contain-(.*)$/, ([, d]) => {
|
|
1941
|
-
|
|
1946
|
+
[/^contain-(.*)$/, ([, d], { theme }) => {
|
|
1947
|
+
const value = h.bracket(d, theme);
|
|
1948
|
+
if (value != null) return { contain: value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") };
|
|
1942
1949
|
return containValues.includes(d) ? [{
|
|
1943
1950
|
"--un-contain-size": d,
|
|
1944
1951
|
"contain": containValues.map((i) => `var(--un-contain-${i})`).join(" ")
|
|
@@ -1995,13 +2002,13 @@ const whitespaces = [[
|
|
|
1995
2002
|
const contentVisibility = [
|
|
1996
2003
|
[
|
|
1997
2004
|
/^intrinsic(?:-(block|inline|w|h))?(?:-size)?-(.+)$/,
|
|
1998
|
-
([, d, s]) => {
|
|
2005
|
+
([, d, s], { theme }) => {
|
|
1999
2006
|
return { [`contain-intrinsic-${{
|
|
2000
2007
|
block: "block-size",
|
|
2001
2008
|
inline: "inline-size",
|
|
2002
2009
|
w: "width",
|
|
2003
2010
|
h: "height"
|
|
2004
|
-
}[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s) };
|
|
2011
|
+
}[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s, theme) };
|
|
2005
2012
|
},
|
|
2006
2013
|
{ autocomplete: [
|
|
2007
2014
|
"intrinsic-size-<num>",
|
|
@@ -2015,9 +2022,9 @@ const contentVisibility = [
|
|
|
2015
2022
|
...makeGlobalStaticRules("content-visibility")
|
|
2016
2023
|
];
|
|
2017
2024
|
const contents = [
|
|
2018
|
-
[/^content-(.+)$/, ([, v]) => {
|
|
2019
|
-
if (h.bracket.cssvar(v) != null) return [{
|
|
2020
|
-
"--un-content": h.bracket.cssvar(v),
|
|
2025
|
+
[/^content-(.+)$/, ([, v], { theme }) => {
|
|
2026
|
+
if (h.bracket.cssvar(v, theme) != null) return [{
|
|
2027
|
+
"--un-content": h.bracket.cssvar(v, theme),
|
|
2021
2028
|
"content": "var(--un-content)"
|
|
2022
2029
|
}, defineProperty("--un-content", { initialValue: "\"\"" })];
|
|
2023
2030
|
}],
|
|
@@ -2140,9 +2147,10 @@ const objectPositions = [
|
|
|
2140
2147
|
["object-none", { "object-fit": "none" }],
|
|
2141
2148
|
[
|
|
2142
2149
|
/^object-(.+)$/,
|
|
2143
|
-
([, d]) => {
|
|
2150
|
+
([, d], { theme }) => {
|
|
2144
2151
|
if (positionMap[d]) return { "object-position": positionMap[d] };
|
|
2145
|
-
|
|
2152
|
+
const position = h.bracketOfPosition(d, theme);
|
|
2153
|
+
if (position != null) return { "object-position": position.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
2146
2154
|
},
|
|
2147
2155
|
{ autocomplete: `object-(${Object.keys(positionMap).join("|")})` }
|
|
2148
2156
|
]
|
|
@@ -2209,17 +2217,17 @@ const svgUtilities = [
|
|
|
2209
2217
|
],
|
|
2210
2218
|
[
|
|
2211
2219
|
/^fill-op(?:acity)?-?(.+)$/,
|
|
2212
|
-
([, opacity]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
2220
|
+
([, opacity], { theme }) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
2213
2221
|
{ autocomplete: "fill-(op|opacity)-<percent>" }
|
|
2214
2222
|
],
|
|
2215
2223
|
["fill-none", { fill: "none" }],
|
|
2216
2224
|
[/^stroke-(?:width-|size-)?(.+)$/, handleWidth],
|
|
2217
2225
|
[
|
|
2218
2226
|
/^stroke-dash-(.+)$/,
|
|
2219
|
-
([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }),
|
|
2227
|
+
([, s], { theme }) => ({ "stroke-dasharray": h.bracket.cssvar.number(s, theme) }),
|
|
2220
2228
|
{ autocomplete: "stroke-dash-<num>" }
|
|
2221
2229
|
],
|
|
2222
|
-
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": h.bracket.cssvar.px.numberWithUnit(s) })],
|
|
2230
|
+
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": h.bracket.cssvar.px.numberWithUnit(s, theme) })],
|
|
2223
2231
|
[
|
|
2224
2232
|
/^stroke-(.+)$/,
|
|
2225
2233
|
handleColorOrWidth,
|
|
@@ -2227,7 +2235,7 @@ const svgUtilities = [
|
|
|
2227
2235
|
],
|
|
2228
2236
|
[
|
|
2229
2237
|
/^stroke-op(?:acity)?-?(.+)$/,
|
|
2230
|
-
([, opacity]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
2238
|
+
([, opacity], { theme }) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
2231
2239
|
{ autocomplete: "stroke-(op|opacity)-<percent>" }
|
|
2232
2240
|
],
|
|
2233
2241
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -2240,11 +2248,11 @@ const svgUtilities = [
|
|
|
2240
2248
|
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
2241
2249
|
["stroke-none", { stroke: "none" }]
|
|
2242
2250
|
];
|
|
2243
|
-
function handleWidth([, b]) {
|
|
2244
|
-
return { "stroke-width": h.bracket.cssvar.fraction.px.number(b) };
|
|
2251
|
+
function handleWidth([, b], { theme }) {
|
|
2252
|
+
return { "stroke-width": h.bracket.cssvar.fraction.px.number(b, theme) };
|
|
2245
2253
|
}
|
|
2246
2254
|
function handleColorOrWidth(match, ctx) {
|
|
2247
|
-
if (isCSSMathFn(h.bracket(match[1]))) return handleWidth(match);
|
|
2255
|
+
if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth(match, ctx);
|
|
2248
2256
|
return colorResolver("stroke", "stroke")(match, ctx);
|
|
2249
2257
|
}
|
|
2250
2258
|
//#endregion
|
|
@@ -2311,7 +2319,7 @@ function resolveValue(s, theme) {
|
|
|
2311
2319
|
if (num != null) {
|
|
2312
2320
|
themeTracking(`spacing`);
|
|
2313
2321
|
v = `calc(var(--spacing) * ${num})`;
|
|
2314
|
-
} else v = h.bracket.cssvar.global.auto.fraction.rem(s);
|
|
2322
|
+
} else v = h.bracket.cssvar.global.auto.fraction.rem(s, theme);
|
|
2315
2323
|
}
|
|
2316
2324
|
return v;
|
|
2317
2325
|
}
|
|
@@ -2383,7 +2391,7 @@ const transformBase = {
|
|
|
2383
2391
|
const transforms = [
|
|
2384
2392
|
[
|
|
2385
2393
|
/^(?:transform-)?origin-(.+)$/,
|
|
2386
|
-
([, s]) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s) }),
|
|
2394
|
+
([, s], { theme }) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s, theme) }),
|
|
2387
2395
|
{ autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }
|
|
2388
2396
|
],
|
|
2389
2397
|
[
|
|
@@ -2393,7 +2401,7 @@ const transforms = [
|
|
|
2393
2401
|
if (theme.perspective?.[s]) {
|
|
2394
2402
|
themeTracking(`perspective`, s);
|
|
2395
2403
|
v = generateThemeVariable("perspective", s);
|
|
2396
|
-
} else v = h.bracket.cssvar.px.numberWithUnit(s);
|
|
2404
|
+
} else v = h.bracket.cssvar.px.numberWithUnit(s, theme);
|
|
2397
2405
|
if (v != null) {
|
|
2398
2406
|
if (t) return {
|
|
2399
2407
|
"--un-perspective": `perspective(${v})`,
|
|
@@ -2404,8 +2412,8 @@ const transforms = [
|
|
|
2404
2412
|
},
|
|
2405
2413
|
{ autocomplete: [`perspective-<num>`, `perspective-$perspective`] }
|
|
2406
2414
|
],
|
|
2407
|
-
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
|
|
2408
|
-
const v = h.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
2415
|
+
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s], { theme }) => {
|
|
2416
|
+
const v = h.bracket.cssvar(s, theme) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
2409
2417
|
if (v != null) return { "perspective-origin": v };
|
|
2410
2418
|
}],
|
|
2411
2419
|
[/^(?:transform-)?translate-()(.+)$/, handleTranslate],
|
|
@@ -2438,8 +2446,8 @@ const transforms = [
|
|
|
2438
2446
|
["transform-none", { transform: "none" }],
|
|
2439
2447
|
...makeGlobalStaticRules("transform")
|
|
2440
2448
|
];
|
|
2441
|
-
function handleTranslate([, d, b]) {
|
|
2442
|
-
const v = numberResolver(b) ?? h.bracket.cssvar.none.fraction.rem(b);
|
|
2449
|
+
function handleTranslate([, d, b], { theme }) {
|
|
2450
|
+
const v = numberResolver(b) ?? h.bracket.cssvar.none.fraction.rem(b, theme);
|
|
2443
2451
|
if (v != null) {
|
|
2444
2452
|
if (v === "none") return { translate: "none" };
|
|
2445
2453
|
themeTracking(`spacing`);
|
|
@@ -2454,8 +2462,8 @@ function handleTranslate([, d, b]) {
|
|
|
2454
2462
|
].map((d) => defineProperty(`--un-translate-${d}`, { initialValue: 0 }))];
|
|
2455
2463
|
}
|
|
2456
2464
|
}
|
|
2457
|
-
function handleScale([, d, b]) {
|
|
2458
|
-
const v = h.bracket.cssvar.none.fraction.percent(b);
|
|
2465
|
+
function handleScale([, d, b], { theme }) {
|
|
2466
|
+
const v = h.bracket.cssvar.none.fraction.percent(b, theme);
|
|
2459
2467
|
if (v != null) {
|
|
2460
2468
|
if (v === "none") return { scale: "none" };
|
|
2461
2469
|
return [[...transformXYZ(d, v, "scale"), ["scale", `var(--un-scale-x) var(--un-scale-y)${d === "z" ? " var(--un-scale-z)" : ""}`]], ...[
|
|
@@ -2465,8 +2473,8 @@ function handleScale([, d, b]) {
|
|
|
2465
2473
|
].map((d) => defineProperty(`--un-scale-${d}`, { initialValue: 1 }))];
|
|
2466
2474
|
}
|
|
2467
2475
|
}
|
|
2468
|
-
function handleRotate([, d = "", b]) {
|
|
2469
|
-
const v = h.bracket.cssvar.none.degree(b);
|
|
2476
|
+
function handleRotate([, d = "", b], { theme }) {
|
|
2477
|
+
const v = h.bracket.cssvar.none.degree(b, theme);
|
|
2470
2478
|
if (v != null) {
|
|
2471
2479
|
if (v === "none") return { rotate: "none" };
|
|
2472
2480
|
if (d) return [
|
|
@@ -2478,11 +2486,11 @@ function handleRotate([, d = "", b]) {
|
|
|
2478
2486
|
].map((d) => defineProperty(`--un-rotate-${d}`, { initialValue: `rotate${d.toUpperCase()}(0)` })),
|
|
2479
2487
|
...["x", "y"].map((d) => defineProperty(`--un-skew-${d}`, { initialValue: `skew${d.toUpperCase()}(0)` }))
|
|
2480
2488
|
];
|
|
2481
|
-
else return { rotate: h.bracket.cssvar.degree(b) };
|
|
2489
|
+
else return { rotate: h.bracket.cssvar.degree(b, theme) };
|
|
2482
2490
|
}
|
|
2483
2491
|
}
|
|
2484
|
-
function handleSkew([, d, b]) {
|
|
2485
|
-
const v = h.bracket.cssvar.degree(b);
|
|
2492
|
+
function handleSkew([, d, b], { theme }) {
|
|
2493
|
+
const v = h.bracket.cssvar.degree(b, theme);
|
|
2486
2494
|
const ds = xyzMap[d];
|
|
2487
2495
|
if (v != null && ds) return [
|
|
2488
2496
|
[...ds.map((_d) => [`--un-skew${_d}`, v.endsWith("deg") ? `skew${_d.slice(1).toUpperCase()}(${v})` : v]), ["transform", transform]],
|
|
@@ -2533,11 +2541,11 @@ const transitions = [
|
|
|
2533
2541
|
...defaultTransition
|
|
2534
2542
|
};
|
|
2535
2543
|
}],
|
|
2536
|
-
[/^(?:transition-)?duration-(.+)$/, ([, d]) => ({
|
|
2537
|
-
"--un-duration": h.bracket.cssvar.time(d),
|
|
2538
|
-
"transition-duration": h.bracket.cssvar.time(d)
|
|
2544
|
+
[/^(?:transition-)?duration-(.+)$/, ([, d], { theme }) => ({
|
|
2545
|
+
"--un-duration": h.bracket.cssvar.time(d, theme),
|
|
2546
|
+
"transition-duration": h.bracket.cssvar.time(d, theme)
|
|
2539
2547
|
})],
|
|
2540
|
-
[/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": h.bracket.cssvar.time(d) })],
|
|
2548
|
+
[/^(?:transition-)?delay-(.+)$/, ([, d], { theme }) => ({ "transition-delay": h.bracket.cssvar.time(d, theme) })],
|
|
2541
2549
|
[
|
|
2542
2550
|
/^(?:transition-)?ease(?:-(.+))?$/,
|
|
2543
2551
|
([, d = "DEFAULT"], { theme }) => {
|
|
@@ -2545,7 +2553,7 @@ const transitions = [
|
|
|
2545
2553
|
if (theme.ease?.[d]) {
|
|
2546
2554
|
themeTracking("ease", d);
|
|
2547
2555
|
v = generateThemeVariable("ease", d);
|
|
2548
|
-
} else v = h.bracket.cssvar(d);
|
|
2556
|
+
} else v = h.bracket.cssvar(d, theme);
|
|
2549
2557
|
return [{
|
|
2550
2558
|
"--un-ease": v,
|
|
2551
2559
|
"transition-timing-function": v
|
|
@@ -2592,7 +2600,7 @@ const fonts = [
|
|
|
2592
2600
|
],
|
|
2593
2601
|
[
|
|
2594
2602
|
/^(?:text|color|c)-op(?:acity)?-?(.+)$/,
|
|
2595
|
-
([, opacity]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
2603
|
+
([, opacity], { theme }) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
2596
2604
|
{ autocomplete: "(text|color|c)-(op|opacity)-<percent>" }
|
|
2597
2605
|
],
|
|
2598
2606
|
[
|
|
@@ -2602,7 +2610,7 @@ const fonts = [
|
|
|
2602
2610
|
if (theme.fontWeight?.[s]) {
|
|
2603
2611
|
themeTracking(`fontWeight`, s);
|
|
2604
2612
|
v = generateThemeVariable("fontWeight", s);
|
|
2605
|
-
} else v = h.bracket.cssvar.global.number(s);
|
|
2613
|
+
} else v = h.bracket.cssvar.global.number(s, theme);
|
|
2606
2614
|
return {
|
|
2607
2615
|
"--un-font-weight": v,
|
|
2608
2616
|
"font-weight": v
|
|
@@ -2620,7 +2628,7 @@ const fonts = [
|
|
|
2620
2628
|
} else if (numberResolver(s)) {
|
|
2621
2629
|
themeTracking("spacing");
|
|
2622
2630
|
v = `calc(var(--spacing) * ${numberResolver(s)})`;
|
|
2623
|
-
} else v = h.bracket.cssvar.global.rem(s);
|
|
2631
|
+
} else v = h.bracket.cssvar.global.rem(s, theme);
|
|
2624
2632
|
if (v != null) return [{
|
|
2625
2633
|
"--un-leading": v,
|
|
2626
2634
|
"line-height": v
|
|
@@ -2632,7 +2640,7 @@ const fonts = [
|
|
|
2632
2640
|
["font-synthesis-style", { "font-synthesis": "style" }],
|
|
2633
2641
|
["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
|
|
2634
2642
|
["font-synthesis-none", { "font-synthesis": "none" }],
|
|
2635
|
-
[/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": h.bracket.cssvar.global(s) })],
|
|
2643
|
+
[/^font-synthesis-(.+)$/, ([, s], { theme }) => ({ "font-synthesis": h.bracket.cssvar.global(s, theme) })],
|
|
2636
2644
|
[
|
|
2637
2645
|
/^(?:font-)?tracking-(.+)$/,
|
|
2638
2646
|
([, s], { theme }) => {
|
|
@@ -2640,7 +2648,7 @@ const fonts = [
|
|
|
2640
2648
|
if (theme.tracking?.[s]) {
|
|
2641
2649
|
themeTracking(`tracking`, s);
|
|
2642
2650
|
v = generateThemeVariable("tracking", s);
|
|
2643
|
-
} else v = h.bracket.cssvar.global.rem(s);
|
|
2651
|
+
} else v = h.bracket.cssvar.global.rem(s, theme);
|
|
2644
2652
|
return {
|
|
2645
2653
|
"--un-tracking": v,
|
|
2646
2654
|
"letter-spacing": v
|
|
@@ -2651,7 +2659,7 @@ const fonts = [
|
|
|
2651
2659
|
[
|
|
2652
2660
|
/^(?:font-)?word-spacing-(.+)$/,
|
|
2653
2661
|
([, s], { theme }) => {
|
|
2654
|
-
const v = theme.tracking?.[s] ? generateThemeVariable("tracking", s) : h.bracket.cssvar.global.rem(s);
|
|
2662
|
+
const v = theme.tracking?.[s] ? generateThemeVariable("tracking", s) : h.bracket.cssvar.global.rem(s, theme);
|
|
2655
2663
|
return {
|
|
2656
2664
|
"--un-word-spacing": v,
|
|
2657
2665
|
"word-spacing": v
|
|
@@ -2670,7 +2678,7 @@ const fonts = [
|
|
|
2670
2678
|
["font-stretch-ultra-expanded", { "font-stretch": "ultra-expanded" }],
|
|
2671
2679
|
[
|
|
2672
2680
|
/^font-stretch-(.+)$/,
|
|
2673
|
-
([, s]) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s) }),
|
|
2681
|
+
([, s], { theme }) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s, theme) }),
|
|
2674
2682
|
{ autocomplete: "font-stretch-<percentage>" }
|
|
2675
2683
|
],
|
|
2676
2684
|
[
|
|
@@ -2695,12 +2703,12 @@ const fonts = [
|
|
|
2695
2703
|
"--un-font-weight": v,
|
|
2696
2704
|
"font-weight": v
|
|
2697
2705
|
};
|
|
2698
|
-
v = h.bracketOfFamily(d);
|
|
2706
|
+
v = h.bracketOfFamily(d, theme);
|
|
2699
2707
|
if (v != null && h.number(v) == null) {
|
|
2700
2708
|
v = h.cssvar(v) ?? v;
|
|
2701
2709
|
return { "font-family": v };
|
|
2702
2710
|
}
|
|
2703
|
-
v = h.bracketOfNumber(d);
|
|
2711
|
+
v = h.bracketOfNumber(d, theme);
|
|
2704
2712
|
if (v != null) {
|
|
2705
2713
|
v = h.cssvar.number(v);
|
|
2706
2714
|
return {
|
|
@@ -2708,7 +2716,7 @@ const fonts = [
|
|
|
2708
2716
|
"font-weight": v
|
|
2709
2717
|
};
|
|
2710
2718
|
}
|
|
2711
|
-
v = h.bracket(d);
|
|
2719
|
+
v = h.bracket(d, theme);
|
|
2712
2720
|
if (v != null && h.number(v) != null) {
|
|
2713
2721
|
const num = h.number(v);
|
|
2714
2722
|
return {
|
|
@@ -2716,27 +2724,27 @@ const fonts = [
|
|
|
2716
2724
|
"font-weight": num
|
|
2717
2725
|
};
|
|
2718
2726
|
}
|
|
2719
|
-
v = h.bracket.cssvar.global(d);
|
|
2727
|
+
v = h.bracket.cssvar.global(d, theme);
|
|
2720
2728
|
if (v != null) return { "font-family": v };
|
|
2721
2729
|
},
|
|
2722
2730
|
{ autocomplete: ["font-$font", "font-$fontWeight"] }
|
|
2723
2731
|
]
|
|
2724
2732
|
];
|
|
2725
|
-
const tabSizes = [[/^tab(?:-(.+))?$/, ([, s]) => {
|
|
2726
|
-
const v = h.bracket.cssvar.global.number(s || "4");
|
|
2733
|
+
const tabSizes = [[/^tab(?:-(.+))?$/, ([, s], { theme }) => {
|
|
2734
|
+
const v = h.bracket.cssvar.global.number(s || "4", theme);
|
|
2727
2735
|
if (v != null) return {
|
|
2728
2736
|
"-moz-tab-size": v,
|
|
2729
2737
|
"-o-tab-size": v,
|
|
2730
2738
|
"tab-size": v
|
|
2731
2739
|
};
|
|
2732
2740
|
}]];
|
|
2733
|
-
const textIndents = [[/^indent-(.+)$/, ([, s]) => {
|
|
2741
|
+
const textIndents = [[/^indent-(.+)$/, ([, s], { theme }) => {
|
|
2734
2742
|
let v = numberResolver(s);
|
|
2735
2743
|
if (v != null) {
|
|
2736
2744
|
themeTracking(`spacing`);
|
|
2737
2745
|
return { "text-indent": `calc(var(--spacing) * ${v})` };
|
|
2738
2746
|
}
|
|
2739
|
-
v = h.bracket.cssvar.auto.global.rem(s);
|
|
2747
|
+
v = h.bracket.cssvar.auto.global.rem(s, theme);
|
|
2740
2748
|
if (v != null) return { "text-indent": v };
|
|
2741
2749
|
}]];
|
|
2742
2750
|
const textStrokes = [
|
|
@@ -2744,7 +2752,7 @@ const textStrokes = [
|
|
|
2744
2752
|
/^text-stroke(?:-(.+))?$/,
|
|
2745
2753
|
([, s = "DEFAULT"], { theme }) => {
|
|
2746
2754
|
if (theme.textStrokeWidth?.[s]) themeTracking(`textStrokeWidth`, s);
|
|
2747
|
-
return { "-webkit-text-stroke-width": theme.textStrokeWidth?.[s] ? generateThemeVariable("textStrokeWidth", s) : h.bracket.cssvar.px(s) };
|
|
2755
|
+
return { "-webkit-text-stroke-width": theme.textStrokeWidth?.[s] ? generateThemeVariable("textStrokeWidth", s) : h.bracket.cssvar.px(s, theme) };
|
|
2748
2756
|
},
|
|
2749
2757
|
{ autocomplete: "text-stroke-$textStrokeWidth" }
|
|
2750
2758
|
],
|
|
@@ -2755,7 +2763,7 @@ const textStrokes = [
|
|
|
2755
2763
|
],
|
|
2756
2764
|
[
|
|
2757
2765
|
/^text-stroke-op(?:acity)?-?(.+)$/,
|
|
2758
|
-
([, opacity]) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
2766
|
+
([, opacity], { theme }) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
2759
2767
|
{ autocomplete: "text-stroke-(op|opacity)-<percent>" }
|
|
2760
2768
|
]
|
|
2761
2769
|
];
|
|
@@ -2765,16 +2773,16 @@ function handleTextShadow(match, ctx) {
|
|
|
2765
2773
|
let res = [];
|
|
2766
2774
|
if (s) res = getStringComponents(s, "/", 2) ?? [];
|
|
2767
2775
|
const v = theme.textShadow?.[res[0]];
|
|
2768
|
-
const c = s ? h.bracket.cssvar(s) : void 0;
|
|
2776
|
+
const c = s ? h.bracket.cssvar(s, theme) : void 0;
|
|
2769
2777
|
if ((v != null || c != null) && !hasParseableColor(c, theme)) {
|
|
2770
|
-
const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
|
|
2778
|
+
const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
|
|
2771
2779
|
return {
|
|
2772
2780
|
"--un-text-shadow-opacity": alpha,
|
|
2773
2781
|
"--un-text-shadow": colorableShadows(v || c, "--un-text-shadow-color", alpha).join(","),
|
|
2774
2782
|
"text-shadow": "var(--un-text-shadow)"
|
|
2775
2783
|
};
|
|
2776
2784
|
}
|
|
2777
|
-
return colorResolver("--un-text-shadow-color", "text-shadow")(match, ctx) ?? { "text-shadow": h.bracket.cssvar.global(s) };
|
|
2785
|
+
return colorResolver("--un-text-shadow-color", "text-shadow")(match, ctx) ?? { "text-shadow": h.bracket.cssvar.global(s, theme) };
|
|
2778
2786
|
}
|
|
2779
2787
|
const textShadows = [
|
|
2780
2788
|
[
|
|
@@ -2793,7 +2801,7 @@ const textShadows = [
|
|
|
2793
2801
|
],
|
|
2794
2802
|
[
|
|
2795
2803
|
/^text-shadow(?:-color)?-op(?:acity)?-?(.+)$/,
|
|
2796
|
-
([, opacity]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
|
|
2804
|
+
([, opacity], { theme }) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
|
|
2797
2805
|
{ autocomplete: "text-shadow(-color)?-(op|opacity)-<percent>" }
|
|
2798
2806
|
]
|
|
2799
2807
|
];
|
|
@@ -2849,7 +2857,7 @@ function handleText([, s = "base"], { theme }) {
|
|
|
2849
2857
|
if (leading) if (theme.leading?.[leading]) {
|
|
2850
2858
|
themeTracking(`leading`, leading);
|
|
2851
2859
|
lineHeight = generateThemeVariable("leading", leading);
|
|
2852
|
-
} else lineHeight = h.bracket.cssvar.global.rem(leading);
|
|
2860
|
+
} else lineHeight = h.bracket.cssvar.global.rem(leading, theme);
|
|
2853
2861
|
if (sizePairs) {
|
|
2854
2862
|
themeTracking(`text`, [size, "fontSize"]);
|
|
2855
2863
|
themeTracking(`text`, [size, "lineHeight"]);
|
|
@@ -2860,12 +2868,12 @@ function handleText([, s = "base"], { theme }) {
|
|
|
2860
2868
|
"letter-spacing": sizePairs.letterSpacing ? generateThemeVariable("text", [size, "letterSpacing"]) : void 0
|
|
2861
2869
|
};
|
|
2862
2870
|
}
|
|
2863
|
-
const fontSize = h.bracketOfLength.rem(size);
|
|
2871
|
+
const fontSize = h.bracketOfLength.rem(size, theme);
|
|
2864
2872
|
if (lineHeight && fontSize) return {
|
|
2865
2873
|
"font-size": fontSize,
|
|
2866
2874
|
"line-height": lineHeight
|
|
2867
2875
|
};
|
|
2868
|
-
return { "font-size": h.bracketOfLength.rem(s) };
|
|
2876
|
+
return { "font-size": h.bracketOfLength.rem(s, theme) };
|
|
2869
2877
|
}
|
|
2870
2878
|
function handleSize([, s], { theme }) {
|
|
2871
2879
|
if (theme.text?.[s] != null) {
|
|
@@ -2876,12 +2884,12 @@ function handleSize([, s], { theme }) {
|
|
|
2876
2884
|
"line-height": `var(--un-leading, ${generateThemeVariable("text", [s, "lineHeight"])})`
|
|
2877
2885
|
};
|
|
2878
2886
|
} else {
|
|
2879
|
-
const d = h.bracket.cssvar.global.rem(s);
|
|
2887
|
+
const d = h.bracket.cssvar.global.rem(s, theme);
|
|
2880
2888
|
if (d) return { "font-size": d };
|
|
2881
2889
|
}
|
|
2882
2890
|
}
|
|
2883
2891
|
function handlerColorOrSize(match, ctx) {
|
|
2884
|
-
if (isCSSMathFn(h.bracket(match[1]))) return handleSize(match, ctx);
|
|
2892
|
+
if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleSize(match, ctx);
|
|
2885
2893
|
return colorResolver("color", "text")(match, ctx);
|
|
2886
2894
|
}
|
|
2887
2895
|
function splitShorthand(body, type) {
|