@unocss/preset-mini 0.55.7 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -7
- package/dist/rules.cjs +129 -128
- package/dist/rules.mjs +4 -3
- package/dist/shared/{preset-mini.b4ad509c.cjs → preset-mini.3a376028.cjs} +14 -284
- package/dist/shared/{preset-mini.0fac4963.mjs → preset-mini.4fe01d46.mjs} +3 -5
- package/dist/shared/{preset-mini.c0e4a0cc.d.ts → preset-mini.79297e15.d.ts} +3 -6
- package/dist/shared/{preset-mini.f1fe435e.mjs → preset-mini.8929b018.mjs} +7 -270
- package/dist/shared/{preset-mini.8ff442ab.d.mts → preset-mini.97d1ec1e.d.mts} +3 -6
- package/dist/shared/{preset-mini.f9bfbfc9.d.cts → preset-mini.d62ae954.d.cts} +3 -6
- package/dist/shared/{preset-mini.5bfee53b.cjs → preset-mini.f22c1fe0.cjs} +39 -41
- package/dist/theme.cjs +3 -2
- package/dist/theme.mjs +3 -2
- package/dist/utils.cjs +26 -107
- package/dist/utils.d.cts +7 -16
- package/dist/utils.d.mts +7 -16
- package/dist/utils.d.ts +7 -16
- package/dist/utils.mjs +3 -81
- package/dist/variants.cjs +41 -41
- package/dist/variants.d.cts +1 -1
- package/dist/variants.d.mts +1 -1
- package/dist/variants.d.ts +1 -1
- package/dist/variants.mjs +3 -3
- package/package.json +4 -3
package/dist/rules.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const utils = require('./shared/preset-mini.3a376028.cjs');
|
|
4
|
+
const ruleUtils = require('@unocss/rule-utils');
|
|
4
5
|
const core = require('@unocss/core');
|
|
5
|
-
const transform = require('./shared/preset-mini.
|
|
6
|
+
const transform = require('./shared/preset-mini.f22c1fe0.cjs');
|
|
6
7
|
|
|
7
8
|
const verticalAlignAlias = {
|
|
8
9
|
"mid": "middle",
|
|
@@ -18,12 +19,12 @@ const verticalAlignAlias = {
|
|
|
18
19
|
"text-bottom": "text-bottom",
|
|
19
20
|
"sub": "sub",
|
|
20
21
|
"super": "super",
|
|
21
|
-
...Object.fromEntries(
|
|
22
|
+
...Object.fromEntries(utils.globalKeywords.map((x) => [x, x]))
|
|
22
23
|
};
|
|
23
24
|
const verticalAligns = [
|
|
24
25
|
[
|
|
25
26
|
/^(?:vertical|align|v)-([-\w]+%?)$/,
|
|
26
|
-
([, v]) => ({ "vertical-align": verticalAlignAlias[v] ??
|
|
27
|
+
([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? utils.h.numberWithUnit(v) }),
|
|
27
28
|
{
|
|
28
29
|
autocomplete: [
|
|
29
30
|
`(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`,
|
|
@@ -36,14 +37,14 @@ const textAligns = ["center", "left", "right", "justify", "start", "end"].map((v
|
|
|
36
37
|
|
|
37
38
|
const outline = [
|
|
38
39
|
// size
|
|
39
|
-
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ??
|
|
40
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
|
|
40
41
|
// color
|
|
41
|
-
[/^outline-(?:color-)?(.+)$/,
|
|
42
|
+
[/^outline-(?:color-)?(.+)$/, utils.colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
|
|
42
43
|
// offset
|
|
43
|
-
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ??
|
|
44
|
+
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
44
45
|
// style
|
|
45
46
|
["outline", { "outline-style": "solid" }],
|
|
46
|
-
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...
|
|
47
|
+
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...utils.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
47
48
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
48
49
|
];
|
|
49
50
|
const appearance = [
|
|
@@ -53,7 +54,7 @@ const appearance = [
|
|
|
53
54
|
}]
|
|
54
55
|
];
|
|
55
56
|
function willChangeProperty(prop) {
|
|
56
|
-
return
|
|
57
|
+
return utils.h.properties.auto.global(prop) ?? {
|
|
57
58
|
contents: "contents",
|
|
58
59
|
scroll: "scroll-position"
|
|
59
60
|
}[prop];
|
|
@@ -62,7 +63,7 @@ const willChange = [
|
|
|
62
63
|
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
63
64
|
];
|
|
64
65
|
|
|
65
|
-
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...
|
|
66
|
+
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...utils.globalKeywords];
|
|
66
67
|
const borders = [
|
|
67
68
|
// compound
|
|
68
69
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
|
|
@@ -103,32 +104,32 @@ const borders = [
|
|
|
103
104
|
];
|
|
104
105
|
function borderColorResolver(direction) {
|
|
105
106
|
return ([, body], theme) => {
|
|
106
|
-
const data =
|
|
107
|
+
const data = utils.parseColor(body, theme);
|
|
107
108
|
if (!data)
|
|
108
109
|
return;
|
|
109
110
|
const { alpha, color, cssColor } = data;
|
|
110
111
|
if (cssColor) {
|
|
111
112
|
if (alpha != null) {
|
|
112
113
|
return {
|
|
113
|
-
[`border${direction}-color`]:
|
|
114
|
+
[`border${direction}-color`]: ruleUtils.colorToString(cssColor, alpha)
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
117
|
if (direction === "") {
|
|
117
118
|
return {
|
|
118
|
-
"--un-border-opacity":
|
|
119
|
-
"border-color":
|
|
119
|
+
"--un-border-opacity": ruleUtils.colorOpacityToString(cssColor),
|
|
120
|
+
"border-color": ruleUtils.colorToString(cssColor, "var(--un-border-opacity)")
|
|
120
121
|
};
|
|
121
122
|
} else {
|
|
122
123
|
return {
|
|
123
124
|
// Separate this return since if `direction` is an empty string, the first key will be overwritten by the second.
|
|
124
|
-
"--un-border-opacity":
|
|
125
|
+
"--un-border-opacity": ruleUtils.colorOpacityToString(cssColor),
|
|
125
126
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
126
|
-
[`border${direction}-color`]:
|
|
127
|
+
[`border${direction}-color`]: ruleUtils.colorToString(cssColor, `var(--un-border${direction}-opacity)`)
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
} else if (color) {
|
|
130
131
|
return {
|
|
131
|
-
[`border${direction}-color`]:
|
|
132
|
+
[`border${direction}-color`]: ruleUtils.colorToString(color, alpha)
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
};
|
|
@@ -137,46 +138,46 @@ function handlerBorder(m, ctx) {
|
|
|
137
138
|
return handlerBorderSize(m, ctx);
|
|
138
139
|
}
|
|
139
140
|
function handlerBorderSize([, a = "", b], { theme }) {
|
|
140
|
-
const v = theme.lineWidth?.[b || "DEFAULT"] ??
|
|
141
|
-
if (a in
|
|
142
|
-
return
|
|
141
|
+
const v = theme.lineWidth?.[b || "DEFAULT"] ?? utils.h.bracket.cssvar.global.px(b || "1");
|
|
142
|
+
if (a in utils.directionMap && v != null)
|
|
143
|
+
return utils.directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
143
144
|
}
|
|
144
145
|
function handlerBorderColor([, a = "", c], { theme }) {
|
|
145
|
-
if (a in
|
|
146
|
+
if (a in utils.directionMap && utils.hasParseableColor(c, theme)) {
|
|
146
147
|
return Object.assign(
|
|
147
148
|
{},
|
|
148
|
-
...
|
|
149
|
+
...utils.directionMap[a].map((i) => borderColorResolver(i)(["", c], theme))
|
|
149
150
|
);
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
function handlerBorderOpacity([, a = "", opacity]) {
|
|
153
|
-
const v =
|
|
154
|
-
if (a in
|
|
155
|
-
return
|
|
154
|
+
const v = utils.h.bracket.percent.cssvar(opacity);
|
|
155
|
+
if (a in utils.directionMap && v != null)
|
|
156
|
+
return utils.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
156
157
|
}
|
|
157
158
|
function handlerRounded([, a = "", s], { theme }) {
|
|
158
|
-
const v = theme.borderRadius?.[s || "DEFAULT"] ||
|
|
159
|
-
if (a in
|
|
160
|
-
return
|
|
159
|
+
const v = theme.borderRadius?.[s || "DEFAULT"] || utils.h.bracket.cssvar.global.fraction.rem(s || "1");
|
|
160
|
+
if (a in utils.cornerMap && v != null)
|
|
161
|
+
return utils.cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
161
162
|
}
|
|
162
163
|
function handlerBorderStyle([, a = "", s]) {
|
|
163
|
-
if (borderStyles.includes(s) && a in
|
|
164
|
-
return
|
|
164
|
+
if (borderStyles.includes(s) && a in utils.directionMap)
|
|
165
|
+
return utils.directionMap[a].map((i) => [`border${i}-style`, s]);
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
const opacity = [
|
|
168
|
-
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity:
|
|
169
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utils.h.bracket.percent.cssvar(d) })]
|
|
169
170
|
];
|
|
170
171
|
const textColors = [
|
|
171
|
-
[/^(?:color|c)-(.+)$/,
|
|
172
|
+
[/^(?:color|c)-(.+)$/, utils.colorResolver("color", "text"), { autocomplete: "(color|c)-$colors" }],
|
|
172
173
|
// auto detection and fallback to font-size if the content looks like a size
|
|
173
|
-
[/^text-(.+)$/,
|
|
174
|
-
[/^(?:text|color|c)-(.+)$/, ([, v]) =>
|
|
175
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity":
|
|
174
|
+
[/^text-(.+)$/, utils.colorResolver("color", "text", (css) => !css.color?.toString().match(utils.numberWithUnitRE)), { autocomplete: "text-$colors" }],
|
|
175
|
+
[/^(?:text|color|c)-(.+)$/, ([, v]) => utils.globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${utils.globalKeywords.join("|")})` }],
|
|
176
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utils.h.bracket.percent.cssvar(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
|
|
176
177
|
];
|
|
177
178
|
const bgColors = [
|
|
178
|
-
[/^bg-(.+)$/,
|
|
179
|
-
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity":
|
|
179
|
+
[/^bg-(.+)$/, utils.colorResolver("background-color", "bg"), { autocomplete: "bg-$colors" }],
|
|
180
|
+
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utils.h.bracket.percent.cssvar(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
|
|
180
181
|
];
|
|
181
182
|
const colorScheme = [
|
|
182
183
|
[/^color-scheme-(\w+)$/, ([, v]) => ({ "color-scheme": v })]
|
|
@@ -192,15 +193,15 @@ const containerParent = [
|
|
|
192
193
|
}]
|
|
193
194
|
];
|
|
194
195
|
|
|
195
|
-
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...
|
|
196
|
+
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...utils.globalKeywords];
|
|
196
197
|
const textDecorations = [
|
|
197
198
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
198
199
|
// size
|
|
199
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ??
|
|
200
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utils.h.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
|
|
200
201
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
|
|
201
202
|
// colors
|
|
202
203
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
203
|
-
const result =
|
|
204
|
+
const result = utils.colorResolver("text-decoration-color", "line")(match, ctx);
|
|
204
205
|
if (result) {
|
|
205
206
|
return {
|
|
206
207
|
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
@@ -208,9 +209,9 @@ const textDecorations = [
|
|
|
208
209
|
};
|
|
209
210
|
}
|
|
210
211
|
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
211
|
-
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity":
|
|
212
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
212
213
|
// offset
|
|
213
|
-
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ??
|
|
214
|
+
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utils.h.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
214
215
|
// style
|
|
215
216
|
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
216
217
|
...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
|
|
@@ -227,14 +228,14 @@ const transitionPropertyGroup = {
|
|
|
227
228
|
transform: "transform"
|
|
228
229
|
};
|
|
229
230
|
function transitionProperty(prop) {
|
|
230
|
-
return
|
|
231
|
+
return utils.h.properties(prop) ?? transitionPropertyGroup[prop];
|
|
231
232
|
}
|
|
232
233
|
const transitions = [
|
|
233
234
|
// transition
|
|
234
235
|
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, d], { theme }) => {
|
|
235
236
|
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
236
237
|
if (p) {
|
|
237
|
-
const duration = theme.duration?.[d || "DEFAULT"] ??
|
|
238
|
+
const duration = theme.duration?.[d || "DEFAULT"] ?? utils.h.time(d || "150");
|
|
238
239
|
return {
|
|
239
240
|
"transition-property": p,
|
|
240
241
|
"transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
@@ -245,28 +246,28 @@ const transitions = [
|
|
|
245
246
|
// timings
|
|
246
247
|
[
|
|
247
248
|
/^(?:transition-)?duration-(.+)$/,
|
|
248
|
-
([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ??
|
|
249
|
+
([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? utils.h.bracket.cssvar.time(d) }),
|
|
249
250
|
{ autocomplete: ["transition-duration-$duration", "duration-$duration"] }
|
|
250
251
|
],
|
|
251
252
|
[
|
|
252
253
|
/^(?:transition-)?delay-(.+)$/,
|
|
253
|
-
([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ??
|
|
254
|
+
([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? utils.h.bracket.cssvar.time(d) }),
|
|
254
255
|
{ autocomplete: ["transition-delay-$duration", "delay-$duration"] }
|
|
255
256
|
],
|
|
256
257
|
[
|
|
257
258
|
/^(?:transition-)?ease(?:-(.+))?$/,
|
|
258
|
-
([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ??
|
|
259
|
+
([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utils.h.bracket.cssvar(d) }),
|
|
259
260
|
{ autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
|
|
260
261
|
],
|
|
261
262
|
// props
|
|
262
263
|
[
|
|
263
264
|
/^(?:transition-)?property-(.+)$/,
|
|
264
|
-
([, v]) => ({ "transition-property":
|
|
265
|
-
{ autocomplete: [`transition-property-(${[...
|
|
265
|
+
([, v]) => ({ "transition-property": utils.h.bracket.global(v) || transitionProperty(v) }),
|
|
266
|
+
{ autocomplete: [`transition-property-(${[...utils.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
|
|
266
267
|
],
|
|
267
268
|
// none
|
|
268
269
|
["transition-none", { transition: "none" }],
|
|
269
|
-
...
|
|
270
|
+
...utils.makeGlobalStaticRules("transition")
|
|
270
271
|
];
|
|
271
272
|
|
|
272
273
|
const flex = [
|
|
@@ -275,15 +276,15 @@ const flex = [
|
|
|
275
276
|
["inline-flex", { display: "inline-flex" }],
|
|
276
277
|
["flex-inline", { display: "inline-flex" }],
|
|
277
278
|
// flex
|
|
278
|
-
[/^flex-(.*)$/, ([, d]) => ({ flex:
|
|
279
|
+
[/^flex-(.*)$/, ([, d]) => ({ flex: utils.h.bracket(d) != null ? utils.h.bracket(d).split(" ").map((e) => utils.h.cssvar.fraction(e) ?? e).join(" ") : utils.h.cssvar.fraction(d) })],
|
|
279
280
|
["flex-1", { flex: "1 1 0%" }],
|
|
280
281
|
["flex-auto", { flex: "1 1 auto" }],
|
|
281
282
|
["flex-initial", { flex: "0 1 auto" }],
|
|
282
283
|
["flex-none", { flex: "none" }],
|
|
283
284
|
// shrink/grow/basis
|
|
284
|
-
[/^(?:flex-)?shrink(?:-(.*))?$/, ([, d = ""]) => ({ "flex-shrink":
|
|
285
|
-
[/^(?:flex-)?grow(?:-(.*))?$/, ([, d = ""]) => ({ "flex-grow":
|
|
286
|
-
[/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ??
|
|
285
|
+
[/^(?:flex-)?shrink(?:-(.*))?$/, ([, d = ""]) => ({ "flex-shrink": utils.h.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }],
|
|
286
|
+
[/^(?:flex-)?grow(?:-(.*))?$/, ([, d = ""]) => ({ "flex-grow": utils.h.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-grow-<num>", "grow-<num>"] }],
|
|
287
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? utils.h.bracket.cssvar.auto.fraction.rem(d) }), { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }],
|
|
287
288
|
// directions
|
|
288
289
|
["flex-row", { "flex-direction": "row" }],
|
|
289
290
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
@@ -296,14 +297,14 @@ const flex = [
|
|
|
296
297
|
];
|
|
297
298
|
|
|
298
299
|
function handleLineHeight(s, theme) {
|
|
299
|
-
return theme.lineHeight?.[s] ||
|
|
300
|
+
return theme.lineHeight?.[s] || utils.h.bracket.cssvar.global.rem(s);
|
|
300
301
|
}
|
|
301
302
|
const fonts = [
|
|
302
303
|
// size
|
|
303
304
|
[
|
|
304
305
|
/^text-(.+)$/,
|
|
305
306
|
([, s = "base"], { theme }) => {
|
|
306
|
-
const [size, leading] =
|
|
307
|
+
const [size, leading] = utils.splitShorthand(s, "length");
|
|
307
308
|
const sizePairs = core.toArray(theme.fontSize?.[size]);
|
|
308
309
|
const lineHeight = leading ? handleLineHeight(leading, theme) : void 0;
|
|
309
310
|
if (sizePairs?.[0]) {
|
|
@@ -313,27 +314,27 @@ const fonts = [
|
|
|
313
314
|
"line-height": lineHeight ?? height ?? "1"
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
|
-
const fontSize =
|
|
317
|
+
const fontSize = utils.h.bracketOfLength.rem(size);
|
|
317
318
|
if (lineHeight && fontSize) {
|
|
318
319
|
return {
|
|
319
320
|
"font-size": fontSize,
|
|
320
321
|
"line-height": lineHeight
|
|
321
322
|
};
|
|
322
323
|
}
|
|
323
|
-
return { "font-size":
|
|
324
|
+
return { "font-size": utils.h.bracketOfLength.rem(s) };
|
|
324
325
|
},
|
|
325
326
|
{ autocomplete: "text-$fontSize" }
|
|
326
327
|
],
|
|
327
328
|
[/^(?:text|font)-size-(.+)$/, ([, s], { theme }) => {
|
|
328
329
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
329
|
-
const size = themed?.[0] ??
|
|
330
|
+
const size = themed?.[0] ?? utils.h.bracket.cssvar.global.rem(s);
|
|
330
331
|
if (size != null)
|
|
331
332
|
return { "font-size": size };
|
|
332
333
|
}, { autocomplete: "text-size-$fontSize" }],
|
|
333
334
|
// weights
|
|
334
335
|
[
|
|
335
336
|
/^(?:font|fw)-?([^-]+)$/,
|
|
336
|
-
([, s], { theme }) => ({ "font-weight": theme.fontWeight?.[s] ||
|
|
337
|
+
([, s], { theme }) => ({ "font-weight": theme.fontWeight?.[s] || utils.h.bracket.global.number(s) }),
|
|
337
338
|
{
|
|
338
339
|
autocomplete: [
|
|
339
340
|
"(font|fw)-(100|200|300|400|500|600|700|800|900)",
|
|
@@ -352,29 +353,29 @@ const fonts = [
|
|
|
352
353
|
["font-synthesis-style", { "font-synthesis": "style" }],
|
|
353
354
|
["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
|
|
354
355
|
["font-synthesis-none", { "font-synthesis": "none" }],
|
|
355
|
-
[/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis":
|
|
356
|
+
[/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": utils.h.bracket.cssvar.global(s) })],
|
|
356
357
|
// tracking
|
|
357
358
|
[
|
|
358
359
|
/^(?:font-)?tracking-(.+)$/,
|
|
359
|
-
([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] ||
|
|
360
|
+
([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utils.h.bracket.cssvar.global.rem(s) }),
|
|
360
361
|
{ autocomplete: "tracking-$letterSpacing" }
|
|
361
362
|
],
|
|
362
363
|
// word-spacing
|
|
363
364
|
[
|
|
364
365
|
/^(?:font-)?word-spacing-(.+)$/,
|
|
365
|
-
([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] ||
|
|
366
|
+
([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utils.h.bracket.cssvar.global.rem(s) }),
|
|
366
367
|
{ autocomplete: "word-spacing-$wordSpacing" }
|
|
367
368
|
],
|
|
368
369
|
// family
|
|
369
370
|
[
|
|
370
371
|
/^font-(.+)$/,
|
|
371
|
-
([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] ||
|
|
372
|
+
([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || utils.h.bracket.cssvar.global(d) }),
|
|
372
373
|
{ autocomplete: "font-$fontFamily" }
|
|
373
374
|
]
|
|
374
375
|
];
|
|
375
376
|
const tabSizes = [
|
|
376
377
|
[/^tab(?:-(.+))?$/, ([, s]) => {
|
|
377
|
-
const v =
|
|
378
|
+
const v = utils.h.bracket.cssvar.global.number(s || "4");
|
|
378
379
|
if (v != null) {
|
|
379
380
|
return {
|
|
380
381
|
"-moz-tab-size": v,
|
|
@@ -385,29 +386,29 @@ const tabSizes = [
|
|
|
385
386
|
}]
|
|
386
387
|
];
|
|
387
388
|
const textIndents = [
|
|
388
|
-
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] ||
|
|
389
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utils.h.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
|
|
389
390
|
];
|
|
390
391
|
const textStrokes = [
|
|
391
392
|
// widths
|
|
392
|
-
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] ||
|
|
393
|
+
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utils.h.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
|
|
393
394
|
// colors
|
|
394
|
-
[/^text-stroke-(.+)$/,
|
|
395
|
-
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity":
|
|
395
|
+
[/^text-stroke-(.+)$/, utils.colorResolver("-webkit-text-stroke-color", "text-stroke"), { autocomplete: "text-stroke-$colors" }],
|
|
396
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
|
|
396
397
|
];
|
|
397
398
|
const textShadows = [
|
|
398
399
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
399
400
|
const v = theme.textShadow?.[s || "DEFAULT"];
|
|
400
401
|
if (v != null) {
|
|
401
402
|
return {
|
|
402
|
-
"--un-text-shadow":
|
|
403
|
+
"--un-text-shadow": utils.colorableShadows(v, "--un-text-shadow-color").join(","),
|
|
403
404
|
"text-shadow": "var(--un-text-shadow)"
|
|
404
405
|
};
|
|
405
406
|
}
|
|
406
|
-
return { "text-shadow":
|
|
407
|
+
return { "text-shadow": utils.h.bracket.cssvar.global(s) };
|
|
407
408
|
}, { autocomplete: "text-shadow-$textShadow" }],
|
|
408
409
|
// colors
|
|
409
|
-
[/^text-shadow-color-(.+)$/,
|
|
410
|
-
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity":
|
|
410
|
+
[/^text-shadow-color-(.+)$/, utils.colorResolver("--un-text-shadow-color", "text-shadow"), { autocomplete: "text-shadow-color-$colors" }],
|
|
411
|
+
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
|
|
411
412
|
];
|
|
412
413
|
|
|
413
414
|
const directions = {
|
|
@@ -416,7 +417,7 @@ const directions = {
|
|
|
416
417
|
"y": "row-"
|
|
417
418
|
};
|
|
418
419
|
function handleGap([, d = "", s], { theme }) {
|
|
419
|
-
const v = theme.spacing?.[s] ??
|
|
420
|
+
const v = theme.spacing?.[s] ?? utils.h.bracket.cssvar.global.rem(s);
|
|
420
421
|
if (v != null) {
|
|
421
422
|
return {
|
|
422
423
|
[`${directions[d]}gap`]: v
|
|
@@ -446,7 +447,7 @@ function autoDirection(c, theme, prop) {
|
|
|
446
447
|
case "fr":
|
|
447
448
|
return "minmax(0,1fr)";
|
|
448
449
|
}
|
|
449
|
-
return
|
|
450
|
+
return utils.h.bracket.cssvar.auto.rem(prop);
|
|
450
451
|
}
|
|
451
452
|
const grids = [
|
|
452
453
|
// displays
|
|
@@ -454,36 +455,36 @@ const grids = [
|
|
|
454
455
|
["inline-grid", { display: "inline-grid" }],
|
|
455
456
|
// global
|
|
456
457
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({
|
|
457
|
-
[`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ??
|
|
458
|
+
[`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? utils.h.bracket.cssvar.auto(v)
|
|
458
459
|
})],
|
|
459
460
|
// span
|
|
460
461
|
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
461
462
|
if (s === "full")
|
|
462
463
|
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
463
|
-
const v =
|
|
464
|
+
const v = utils.h.bracket.number(s);
|
|
464
465
|
if (v != null)
|
|
465
466
|
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
466
467
|
}, { autocomplete: ["grid-(row|col)-span-<num>", "(row|col)-span-<num>"] }],
|
|
467
468
|
// starts & ends
|
|
468
|
-
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]:
|
|
469
|
-
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]:
|
|
469
|
+
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: utils.h.bracket.cssvar(v) ?? v })],
|
|
470
|
+
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: utils.h.bracket.cssvar(v) ?? v }), { autocomplete: ["grid-(row|col)-(start|end)-<num>"] }],
|
|
470
471
|
// auto flows
|
|
471
472
|
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) }), { autocomplete: ["grid-auto-(rows|cols)-<num>"] }],
|
|
472
473
|
// grid-auto-flow, auto-flow: uno
|
|
473
474
|
// grid-flow: wind
|
|
474
|
-
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow":
|
|
475
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": utils.h.bracket.cssvar(v) })],
|
|
475
476
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }), { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }],
|
|
476
477
|
// templates
|
|
477
478
|
[/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
|
|
478
|
-
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ??
|
|
479
|
+
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? utils.h.bracket.cssvar(v)
|
|
479
480
|
})],
|
|
480
481
|
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
481
482
|
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }), { autocomplete: ["grid-(rows|cols)-<num>", "grid-(rows|cols)-none"] }],
|
|
482
483
|
// areas
|
|
483
484
|
[/^grid-area(s)?-(.+)$/, ([, s, v]) => {
|
|
484
485
|
if (s != null)
|
|
485
|
-
return { "grid-template-areas":
|
|
486
|
-
return { "grid-area":
|
|
486
|
+
return { "grid-template-areas": utils.h.cssvar(v) ?? v.split("-").map((s2) => `"${utils.h.bracket(s2)}"`).join(" ") };
|
|
487
|
+
return { "grid-area": utils.h.bracket.cssvar(v) };
|
|
487
488
|
}],
|
|
488
489
|
// template none
|
|
489
490
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
@@ -497,7 +498,7 @@ const overflowValues = [
|
|
|
497
498
|
"visible",
|
|
498
499
|
"scroll",
|
|
499
500
|
"overlay",
|
|
500
|
-
...
|
|
501
|
+
...utils.globalKeywords
|
|
501
502
|
];
|
|
502
503
|
const overflows = [
|
|
503
504
|
[/^(?:overflow|of)-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0, { autocomplete: [`(overflow|of)-(${overflowValues.join("|")})`, `(overflow|of)-(x|y)-(${overflowValues.join("|")})`] }],
|
|
@@ -512,7 +513,7 @@ const positions = [
|
|
|
512
513
|
"<position>"
|
|
513
514
|
]
|
|
514
515
|
}],
|
|
515
|
-
[/^(?:position-|pos-)([-\w]+)$/, ([, v]) =>
|
|
516
|
+
[/^(?:position-|pos-)([-\w]+)$/, ([, v]) => utils.globalKeywords.includes(v) ? { position: v } : void 0],
|
|
516
517
|
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
517
518
|
];
|
|
518
519
|
const justifies = [
|
|
@@ -524,23 +525,23 @@ const justifies = [
|
|
|
524
525
|
["justify-around", { "justify-content": "space-around" }],
|
|
525
526
|
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
526
527
|
["justify-stretch", { "justify-content": "stretch" }],
|
|
527
|
-
...
|
|
528
|
+
...utils.makeGlobalStaticRules("justify", "justify-content"),
|
|
528
529
|
// items
|
|
529
530
|
["justify-items-start", { "justify-items": "start" }],
|
|
530
531
|
["justify-items-end", { "justify-items": "end" }],
|
|
531
532
|
["justify-items-center", { "justify-items": "center" }],
|
|
532
533
|
["justify-items-stretch", { "justify-items": "stretch" }],
|
|
533
|
-
...
|
|
534
|
+
...utils.makeGlobalStaticRules("justify-items"),
|
|
534
535
|
// selfs
|
|
535
536
|
["justify-self-auto", { "justify-self": "auto" }],
|
|
536
537
|
["justify-self-start", { "justify-self": "start" }],
|
|
537
538
|
["justify-self-end", { "justify-self": "end" }],
|
|
538
539
|
["justify-self-center", { "justify-self": "center" }],
|
|
539
540
|
["justify-self-stretch", { "justify-self": "stretch" }],
|
|
540
|
-
...
|
|
541
|
+
...utils.makeGlobalStaticRules("justify-self")
|
|
541
542
|
];
|
|
542
543
|
const orders = [
|
|
543
|
-
[/^order-(.+)$/, ([, v]) => ({ order:
|
|
544
|
+
[/^order-(.+)$/, ([, v]) => ({ order: utils.h.bracket.cssvar.number(v) })],
|
|
544
545
|
["order-first", { order: "-9999" }],
|
|
545
546
|
["order-last", { order: "9999" }],
|
|
546
547
|
["order-none", { order: "0" }]
|
|
@@ -553,14 +554,14 @@ const alignments = [
|
|
|
553
554
|
["content-between", { "align-content": "space-between" }],
|
|
554
555
|
["content-around", { "align-content": "space-around" }],
|
|
555
556
|
["content-evenly", { "align-content": "space-evenly" }],
|
|
556
|
-
...
|
|
557
|
+
...utils.makeGlobalStaticRules("content", "align-content"),
|
|
557
558
|
// items
|
|
558
559
|
["items-start", { "align-items": "flex-start" }],
|
|
559
560
|
["items-end", { "align-items": "flex-end" }],
|
|
560
561
|
["items-center", { "align-items": "center" }],
|
|
561
562
|
["items-baseline", { "align-items": "baseline" }],
|
|
562
563
|
["items-stretch", { "align-items": "stretch" }],
|
|
563
|
-
...
|
|
564
|
+
...utils.makeGlobalStaticRules("items", "align-items"),
|
|
564
565
|
// selfs
|
|
565
566
|
["self-auto", { "align-self": "auto" }],
|
|
566
567
|
["self-start", { "align-self": "flex-start" }],
|
|
@@ -568,7 +569,7 @@ const alignments = [
|
|
|
568
569
|
["self-center", { "align-self": "center" }],
|
|
569
570
|
["self-stretch", { "align-self": "stretch" }],
|
|
570
571
|
["self-baseline", { "align-self": "baseline" }],
|
|
571
|
-
...
|
|
572
|
+
...utils.makeGlobalStaticRules("self", "align-self")
|
|
572
573
|
];
|
|
573
574
|
const placements = [
|
|
574
575
|
// contents
|
|
@@ -579,32 +580,32 @@ const placements = [
|
|
|
579
580
|
["place-content-around", { "place-content": "space-around" }],
|
|
580
581
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
581
582
|
["place-content-stretch", { "place-content": "stretch" }],
|
|
582
|
-
...
|
|
583
|
+
...utils.makeGlobalStaticRules("place-content"),
|
|
583
584
|
// items
|
|
584
585
|
["place-items-start", { "place-items": "start" }],
|
|
585
586
|
["place-items-end", { "place-items": "end" }],
|
|
586
587
|
["place-items-center", { "place-items": "center" }],
|
|
587
588
|
["place-items-stretch", { "place-items": "stretch" }],
|
|
588
|
-
...
|
|
589
|
+
...utils.makeGlobalStaticRules("place-items"),
|
|
589
590
|
// selfs
|
|
590
591
|
["place-self-auto", { "place-self": "auto" }],
|
|
591
592
|
["place-self-start", { "place-self": "start" }],
|
|
592
593
|
["place-self-end", { "place-self": "end" }],
|
|
593
594
|
["place-self-center", { "place-self": "center" }],
|
|
594
595
|
["place-self-stretch", { "place-self": "stretch" }],
|
|
595
|
-
...
|
|
596
|
+
...utils.makeGlobalStaticRules("place-self")
|
|
596
597
|
];
|
|
597
598
|
const flexGridJustifiesAlignments = [...justifies, ...alignments].flatMap(([k, v]) => [
|
|
598
599
|
[`flex-${k}`, v],
|
|
599
600
|
[`grid-${k}`, v]
|
|
600
601
|
]);
|
|
601
602
|
function handleInsetValue(v, { theme }) {
|
|
602
|
-
return theme.spacing?.[v] ??
|
|
603
|
+
return theme.spacing?.[v] ?? utils.h.bracket.cssvar.global.auto.fraction.rem(v);
|
|
603
604
|
}
|
|
604
605
|
function handleInsetValues([, d, v], ctx) {
|
|
605
606
|
const r = handleInsetValue(v, ctx);
|
|
606
|
-
if (r != null && d in
|
|
607
|
-
return
|
|
607
|
+
if (r != null && d in utils.insetMap)
|
|
608
|
+
return utils.insetMap[d].map((i) => [i.slice(1), r]);
|
|
608
609
|
}
|
|
609
610
|
const insets = [
|
|
610
611
|
[
|
|
@@ -631,22 +632,22 @@ const floats = [
|
|
|
631
632
|
["float-left", { float: "left" }],
|
|
632
633
|
["float-right", { float: "right" }],
|
|
633
634
|
["float-none", { float: "none" }],
|
|
634
|
-
...
|
|
635
|
+
...utils.makeGlobalStaticRules("float"),
|
|
635
636
|
// clears
|
|
636
637
|
["clear-left", { clear: "left" }],
|
|
637
638
|
["clear-right", { clear: "right" }],
|
|
638
639
|
["clear-both", { clear: "both" }],
|
|
639
640
|
["clear-none", { clear: "none" }],
|
|
640
|
-
...
|
|
641
|
+
...utils.makeGlobalStaticRules("clear")
|
|
641
642
|
];
|
|
642
643
|
const zIndexes = [
|
|
643
|
-
[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index":
|
|
644
|
-
[/^(?:position-|pos-)?z-(.+)$/, ([, v], { theme }) => ({ "z-index": theme.zIndex?.[v] ??
|
|
644
|
+
[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": utils.h.number(v) })],
|
|
645
|
+
[/^(?:position-|pos-)?z-(.+)$/, ([, v], { theme }) => ({ "z-index": theme.zIndex?.[v] ?? utils.h.bracket.cssvar.global.auto.number(v) }), { autocomplete: "z-<num>" }]
|
|
645
646
|
];
|
|
646
647
|
const boxSizing = [
|
|
647
648
|
["box-border", { "box-sizing": "border-box" }],
|
|
648
649
|
["box-content", { "box-sizing": "content-box" }],
|
|
649
|
-
...
|
|
650
|
+
...utils.makeGlobalStaticRules("box", "box-sizing")
|
|
650
651
|
];
|
|
651
652
|
|
|
652
653
|
const sizeMapping = {
|
|
@@ -669,7 +670,7 @@ function getSizeValue(minmax, hw, theme, prop) {
|
|
|
669
670
|
case "min":
|
|
670
671
|
return `${prop}-content`;
|
|
671
672
|
}
|
|
672
|
-
return
|
|
673
|
+
return utils.h.bracket.cssvar.global.auto.fraction.rem(prop);
|
|
673
674
|
}
|
|
674
675
|
const sizes = [
|
|
675
676
|
[/^(?:size-)?(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
@@ -683,8 +684,8 @@ const sizes = [
|
|
|
683
684
|
"(max|min)-(w|h)-full"
|
|
684
685
|
]
|
|
685
686
|
}],
|
|
686
|
-
[/^(?:size-)?(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]:
|
|
687
|
-
[/^(?:size-)?(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]:
|
|
687
|
+
[/^(?:size-)?(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: utils.resolveVerticalBreakpoints(context)?.[s] })],
|
|
688
|
+
[/^(?:size-)?(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: utils.resolveBreakpoints(context)?.[s] }), {
|
|
688
689
|
autocomplete: [
|
|
689
690
|
"(w|h)-screen",
|
|
690
691
|
"(min|max)-(w|h)-screen",
|
|
@@ -704,27 +705,27 @@ function getAspectRatio(prop) {
|
|
|
704
705
|
case "video":
|
|
705
706
|
return "16/9";
|
|
706
707
|
}
|
|
707
|
-
return
|
|
708
|
+
return utils.h.bracket.cssvar.global.auto.number(prop);
|
|
708
709
|
}
|
|
709
710
|
const aspectRatio = [
|
|
710
711
|
[/^(?:size-)?aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }), { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }]
|
|
711
712
|
];
|
|
712
713
|
|
|
713
714
|
const paddings = [
|
|
714
|
-
[/^pa?()-?(-?.+)$/,
|
|
715
|
-
[/^p-?xy()()$/,
|
|
716
|
-
[/^p-?([xy])(?:-?(-?.+))?$/,
|
|
717
|
-
[/^p-?([rltbse])(?:-?(-?.+))?$/,
|
|
718
|
-
[/^p-(block|inline)(?:-(-?.+))?$/,
|
|
719
|
-
[/^p-?([bi][se])(?:-?(-?.+))?$/,
|
|
715
|
+
[/^pa?()-?(-?.+)$/, utils.directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
|
|
716
|
+
[/^p-?xy()()$/, utils.directionSize("padding"), { autocomplete: "(m|p)-(xy)" }],
|
|
717
|
+
[/^p-?([xy])(?:-?(-?.+))?$/, utils.directionSize("padding")],
|
|
718
|
+
[/^p-?([rltbse])(?:-?(-?.+))?$/, utils.directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
|
|
719
|
+
[/^p-(block|inline)(?:-(-?.+))?$/, utils.directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
|
|
720
|
+
[/^p-?([bi][se])(?:-?(-?.+))?$/, utils.directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
|
|
720
721
|
];
|
|
721
722
|
const margins = [
|
|
722
|
-
[/^ma?()-?(-?.+)$/,
|
|
723
|
-
[/^m-?xy()()$/,
|
|
724
|
-
[/^m-?([xy])(?:-?(-?.+))?$/,
|
|
725
|
-
[/^m-?([rltbse])(?:-?(-?.+))?$/,
|
|
726
|
-
[/^m-(block|inline)(?:-(-?.+))?$/,
|
|
727
|
-
[/^m-?([bi][se])(?:-?(-?.+))?$/,
|
|
723
|
+
[/^ma?()-?(-?.+)$/, utils.directionSize("margin")],
|
|
724
|
+
[/^m-?xy()()$/, utils.directionSize("margin")],
|
|
725
|
+
[/^m-?([xy])(?:-?(-?.+))?$/, utils.directionSize("margin")],
|
|
726
|
+
[/^m-?([rltbse])(?:-?(-?.+))?$/, utils.directionSize("margin")],
|
|
727
|
+
[/^m-(block|inline)(?:-(-?.+))?$/, utils.directionSize("margin")],
|
|
728
|
+
[/^m-?([bi][se])(?:-?(-?.+))?$/, utils.directionSize("margin")]
|
|
728
729
|
];
|
|
729
730
|
|
|
730
731
|
const variablesAbbrMap = {
|
|
@@ -746,7 +747,7 @@ const cssVariables = [
|
|
|
746
747
|
[/^(.+?)-(\$.+)$/, ([, name, varname]) => {
|
|
747
748
|
const prop = variablesAbbrMap[name];
|
|
748
749
|
if (prop)
|
|
749
|
-
return { [prop]:
|
|
750
|
+
return { [prop]: utils.h.cssvar(varname) };
|
|
750
751
|
}]
|
|
751
752
|
];
|
|
752
753
|
const cssProperty = [
|
|
@@ -756,7 +757,7 @@ const cssProperty = [
|
|
|
756
757
|
const [prop, ...rest] = body.split(":");
|
|
757
758
|
const value = rest.join(":");
|
|
758
759
|
if (!isURI(body) && prop.match(/^[a-z-]+$/) && isValidCSSBody(value)) {
|
|
759
|
-
const parsed =
|
|
760
|
+
const parsed = utils.h.bracket(`[${value}]`);
|
|
760
761
|
if (parsed)
|
|
761
762
|
return { [prop]: parsed };
|
|
762
763
|
}
|
|
@@ -810,17 +811,17 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
810
811
|
|
|
811
812
|
const svgUtilities = [
|
|
812
813
|
// fills
|
|
813
|
-
[/^fill-(.+)$/,
|
|
814
|
-
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity":
|
|
814
|
+
[/^fill-(.+)$/, utils.colorResolver("fill", "fill"), { autocomplete: "fill-$colors" }],
|
|
815
|
+
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
|
|
815
816
|
["fill-none", { fill: "none" }],
|
|
816
817
|
// stroke size
|
|
817
|
-
[/^stroke-(?:width-|size-)?(.+)$/, ([, s], { theme }) => ({ "stroke-width": theme.lineWidth?.[s] ??
|
|
818
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s], { theme }) => ({ "stroke-width": theme.lineWidth?.[s] ?? utils.h.bracket.cssvar.fraction.px.number(s) }), { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
|
|
818
819
|
// stroke dash
|
|
819
|
-
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray":
|
|
820
|
-
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ??
|
|
820
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utils.h.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
|
|
821
|
+
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? utils.h.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
|
|
821
822
|
// stroke colors
|
|
822
|
-
[/^stroke-(.+)$/,
|
|
823
|
-
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity":
|
|
823
|
+
[/^stroke-(.+)$/, utils.colorResolver("stroke", "stroke"), { autocomplete: "stroke-$colors" }],
|
|
824
|
+
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
|
|
824
825
|
// line cap
|
|
825
826
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
826
827
|
["stroke-cap-round", { "stroke-linecap": "round" }],
|