@unocss/preset-mini 0.16.2 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/default2.cjs +252 -432
- package/dist/chunks/default2.mjs +225 -400
- package/dist/chunks/default3.cjs +10 -6
- package/dist/chunks/default3.mjs +11 -7
- package/dist/chunks/pseudo.cjs +54 -30
- package/dist/chunks/pseudo.mjs +53 -30
- package/dist/chunks/utilities.cjs +294 -0
- package/dist/chunks/utilities.mjs +283 -0
- package/dist/chunks/variants.cjs +8 -6
- package/dist/chunks/variants.mjs +8 -6
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rules.cjs +3 -8
- package/dist/rules.d.ts +5 -17
- package/dist/rules.mjs +2 -2
- package/dist/utils.cjs +11 -8
- package/dist/utils.d.ts +64 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +3 -2
- package/dist/variants.d.ts +4 -3
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunks/index.cjs +0 -142
- package/dist/chunks/index.mjs +0 -134
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as
|
|
1
|
+
import { h as handler, c as colorResolver$1, d as directionMap, a as cornerMap, p as parseColor, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
|
|
2
|
+
import { toArray } from '@unocss/core';
|
|
3
|
+
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
4
4
|
|
|
5
5
|
const verticalAlignAlias = {
|
|
6
6
|
mid: "middle",
|
|
@@ -17,128 +17,13 @@ const textAligns = [
|
|
|
17
17
|
["text-justify", { "text-align": "justify" }]
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
-
const parseColorUtil = (body, theme) => {
|
|
21
|
-
const [main, opacity2] = body.split(/(?:\/|:)/);
|
|
22
|
-
const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
23
|
-
if (!name)
|
|
24
|
-
return;
|
|
25
|
-
let color;
|
|
26
|
-
const bracket = handler.bracket(main);
|
|
27
|
-
const bracketOrMain = bracket || main;
|
|
28
|
-
if (bracketOrMain.startsWith("#"))
|
|
29
|
-
color = bracketOrMain.slice(1);
|
|
30
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
31
|
-
color = bracketOrMain.slice(4);
|
|
32
|
-
color = color || bracket;
|
|
33
|
-
if (!color) {
|
|
34
|
-
const colorData = theme.colors?.[name];
|
|
35
|
-
if (typeof colorData === "string")
|
|
36
|
-
color = colorData;
|
|
37
|
-
else if (no && colorData)
|
|
38
|
-
color = colorData[no];
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
opacity: opacity2,
|
|
42
|
-
name,
|
|
43
|
-
no,
|
|
44
|
-
color,
|
|
45
|
-
rgba: hex2rgba(color)
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
49
|
-
const data = parseColorUtil(body, theme);
|
|
50
|
-
if (!data)
|
|
51
|
-
return;
|
|
52
|
-
const { opacity: opacity2, color, rgba } = data;
|
|
53
|
-
if (!color)
|
|
54
|
-
return;
|
|
55
|
-
const a = opacity2 ? opacity2[0] === "[" ? handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
56
|
-
if (rgba) {
|
|
57
|
-
if (a != null && !Number.isNaN(a)) {
|
|
58
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
59
|
-
return {
|
|
60
|
-
[attribute]: `rgba(${rgba.join(",")})`
|
|
61
|
-
};
|
|
62
|
-
} else {
|
|
63
|
-
return {
|
|
64
|
-
[`--un-${varName}-opacity`]: 1,
|
|
65
|
-
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
return {
|
|
70
|
-
[attribute]: color.replace("%alpha", `${a || 1}`)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const opacity = [
|
|
75
|
-
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
|
|
76
|
-
];
|
|
77
|
-
const textColors = [
|
|
78
|
-
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
79
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
80
|
-
];
|
|
81
|
-
const bgColors = [
|
|
82
|
-
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
83
|
-
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
84
|
-
];
|
|
85
|
-
const borderColors = [
|
|
86
|
-
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
87
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": handler.bracket.percent(opacity2) })]
|
|
88
|
-
];
|
|
89
|
-
const ringColors = [
|
|
90
|
-
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
91
|
-
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity2) })]
|
|
92
|
-
];
|
|
93
|
-
const ringOffsetColors = [
|
|
94
|
-
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
95
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity2) })]
|
|
96
|
-
];
|
|
97
|
-
const fillColors = [
|
|
98
|
-
["fill-none", { fill: "none" }],
|
|
99
|
-
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
100
|
-
[/^fill-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity2) })]
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
104
|
-
const parseOutlineSize = (s) => {
|
|
105
|
-
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
106
|
-
const size = handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-)/, ""));
|
|
107
|
-
if (size) {
|
|
108
|
-
return {
|
|
109
|
-
[`outline-${propName}`]: size
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
20
|
const outline = [
|
|
114
|
-
[
|
|
21
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.fraction.auto.rem(d) })],
|
|
22
|
+
[/^outline-(?:color-)?(.+)$/, colorResolver$1("outline-color", "outline-color")],
|
|
23
|
+
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
|
|
115
24
|
["outline", { "outline-style": "solid" }],
|
|
116
|
-
[
|
|
117
|
-
|
|
118
|
-
(match, config) => {
|
|
119
|
-
const [, d] = match;
|
|
120
|
-
if (d === "none") {
|
|
121
|
-
return {
|
|
122
|
-
"outline": "2px solid transparent",
|
|
123
|
-
"outline-offset": "2px"
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
if (outlineStyle.includes(d)) {
|
|
127
|
-
return {
|
|
128
|
-
"outline-style": d
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
const sizeSheet = parseOutlineSize(d);
|
|
132
|
-
if (sizeSheet)
|
|
133
|
-
return sizeSheet;
|
|
134
|
-
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
135
|
-
match[0],
|
|
136
|
-
match[1].replace(/^color-/, "")
|
|
137
|
-
], config);
|
|
138
|
-
if (colorSheet)
|
|
139
|
-
return colorSheet;
|
|
140
|
-
}
|
|
141
|
-
]
|
|
25
|
+
[/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
26
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
142
27
|
];
|
|
143
28
|
const appearance = [
|
|
144
29
|
["appearance-none", {
|
|
@@ -146,39 +31,27 @@ const appearance = [
|
|
|
146
31
|
"-webkit-appearance": "none"
|
|
147
32
|
}]
|
|
148
33
|
];
|
|
149
|
-
const
|
|
150
|
-
[
|
|
151
|
-
/^placeholder-opacity-(\d+)$/,
|
|
152
|
-
([, d]) => ({
|
|
153
|
-
"placeholder-opacity": handler.bracket.percent(d)
|
|
154
|
-
})
|
|
155
|
-
],
|
|
156
|
-
[
|
|
157
|
-
/^placeholder-(?!opacity)(.+)$/,
|
|
158
|
-
(match, config) => {
|
|
159
|
-
match[1] = match[1].replace(/^color-/, "");
|
|
160
|
-
return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
|
|
161
|
-
}
|
|
162
|
-
]
|
|
34
|
+
const willChange = [
|
|
35
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.global(p) })]
|
|
163
36
|
];
|
|
164
37
|
|
|
165
38
|
const borders = [
|
|
166
39
|
[/^border$/, handlerBorder],
|
|
167
40
|
[/^(?:border|b)()-(.+)$/, handlerBorder],
|
|
168
|
-
[/^(?:border|b)-([^-]+)
|
|
41
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
|
|
169
42
|
[/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
|
|
170
43
|
[/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
|
|
171
44
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
172
|
-
[/^(?:border|b)-([^-]+)
|
|
45
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
173
46
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
|
|
47
|
+
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
48
|
+
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
49
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
174
50
|
["border-solid", { "border-style": "solid" }],
|
|
175
51
|
["border-dashed", { "border-style": "dashed" }],
|
|
176
52
|
["border-dotted", { "border-style": "dotted" }],
|
|
177
53
|
["border-double", { "border-style": "double" }],
|
|
178
|
-
["border-none", { "border-style": "none" }]
|
|
179
|
-
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
180
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
181
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
54
|
+
["border-none", { "border-style": "none" }]
|
|
182
55
|
];
|
|
183
56
|
function handlerBorder(m) {
|
|
184
57
|
const borderSizes = handlerBorderSize(m);
|
|
@@ -192,116 +65,59 @@ function handlerBorder(m) {
|
|
|
192
65
|
function handlerBorderSize([, a, b]) {
|
|
193
66
|
const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
|
|
194
67
|
const v = handler.bracket.px(s);
|
|
195
|
-
if (v
|
|
196
|
-
return [
|
|
197
|
-
...directionMap[d].map((i) => [`border${i}-width`, v])
|
|
198
|
-
];
|
|
199
|
-
}
|
|
68
|
+
if (v !== void 0)
|
|
69
|
+
return directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
200
70
|
}
|
|
201
71
|
function handlerBorderColor([, a, c], ctx) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const borders2 = directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
|
|
205
|
-
const borderObject = {};
|
|
206
|
-
Object.assign(borderObject, ...borders2);
|
|
207
|
-
return borderObject;
|
|
72
|
+
if (c !== void 0 && colorResolver$1("border-color", "border")(["", c], ctx)) {
|
|
73
|
+
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx)));
|
|
208
74
|
}
|
|
209
75
|
}
|
|
210
76
|
function handlerRounded([, a, b], { theme }) {
|
|
211
77
|
const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
|
|
212
|
-
const v = theme.borderRadius?.[s] || handler.
|
|
213
|
-
if (v
|
|
78
|
+
const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
|
|
79
|
+
if (v !== void 0)
|
|
214
80
|
return cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
215
81
|
}
|
|
216
82
|
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
"
|
|
231
|
-
"zoom",
|
|
232
|
-
"text-shadow",
|
|
233
|
-
"transform",
|
|
234
|
-
"box-shadow"
|
|
235
|
-
];
|
|
236
|
-
const transitionPositionProps = [
|
|
237
|
-
"backround-position",
|
|
238
|
-
"left",
|
|
239
|
-
"right",
|
|
240
|
-
"top",
|
|
241
|
-
"bottom",
|
|
242
|
-
"object-position"
|
|
243
|
-
];
|
|
244
|
-
const transitionSizeProps = [
|
|
245
|
-
"max-height",
|
|
246
|
-
"min-height",
|
|
247
|
-
"max-width",
|
|
248
|
-
"min-width",
|
|
249
|
-
"height",
|
|
250
|
-
"width",
|
|
251
|
-
"border-width",
|
|
252
|
-
"margin",
|
|
253
|
-
"padding",
|
|
254
|
-
"outline-width",
|
|
255
|
-
"outline-offset",
|
|
256
|
-
"font-size",
|
|
257
|
-
"line-height",
|
|
258
|
-
"text-indent",
|
|
259
|
-
"vertical-align",
|
|
260
|
-
"border-spacing",
|
|
261
|
-
"letter-spacing",
|
|
262
|
-
"word-spacing"
|
|
263
|
-
];
|
|
264
|
-
const transitionSwitchProps = ["all", "none"];
|
|
265
|
-
const transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
266
|
-
const transitionProps = [
|
|
267
|
-
...transitionBasicProps,
|
|
268
|
-
...transitionPositionProps,
|
|
269
|
-
...transitionSizeProps,
|
|
270
|
-
...transitionEnhanceProps
|
|
271
|
-
];
|
|
272
|
-
const transitionPropsStr = transitionProps.join(", ");
|
|
273
|
-
const validateProperty = (prop) => {
|
|
274
|
-
if (prop && ![...transitionProps, ...transitionSwitchProps].includes(prop))
|
|
275
|
-
return;
|
|
276
|
-
return prop || transitionPropsStr;
|
|
83
|
+
const opacity = [
|
|
84
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
|
|
85
|
+
];
|
|
86
|
+
const textColors = [
|
|
87
|
+
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
88
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
89
|
+
];
|
|
90
|
+
const bgColors = [
|
|
91
|
+
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
92
|
+
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const transitionProperty = (prop) => {
|
|
96
|
+
return handler.properties(prop) || (prop === "all" ? prop : void 0);
|
|
277
97
|
};
|
|
278
98
|
const transitions = [
|
|
279
|
-
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
return
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
}],
|
|
289
|
-
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
290
|
-
return {
|
|
291
|
-
"transition-duration": `${duration}ms`
|
|
292
|
-
};
|
|
99
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
|
|
100
|
+
const p = transitionProperty(prop);
|
|
101
|
+
if (p) {
|
|
102
|
+
return {
|
|
103
|
+
"transition-property": p,
|
|
104
|
+
"transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
|
|
105
|
+
"transition-duration": `${duration}ms`
|
|
106
|
+
};
|
|
107
|
+
}
|
|
293
108
|
}],
|
|
109
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
|
|
294
110
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
111
|
+
["ease-linear", { "transition-timing-function": "linear" }],
|
|
295
112
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
296
113
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
297
114
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
298
115
|
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
299
116
|
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
300
|
-
[/^(?:transition-)?property-(
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}]
|
|
117
|
+
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
|
|
118
|
+
["transition-property-none", { "transition-property": "none" }],
|
|
119
|
+
["property-none", { "transition-property": "none" }],
|
|
120
|
+
["transition-none", { transition: "none" }]
|
|
305
121
|
];
|
|
306
122
|
|
|
307
123
|
const flex = [
|
|
@@ -347,7 +163,7 @@ const fonts = [
|
|
|
347
163
|
}
|
|
348
164
|
}],
|
|
349
165
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
350
|
-
const size = handler.bracket.rem(s);
|
|
166
|
+
const size = handler.bracket.auto.rem(s);
|
|
351
167
|
if (size)
|
|
352
168
|
return { "font-size": size };
|
|
353
169
|
const themed = toArray(theme.fontSize?.[s]);
|
|
@@ -360,7 +176,7 @@ const fonts = [
|
|
|
360
176
|
}
|
|
361
177
|
}],
|
|
362
178
|
[/^text-size-(.+)$/, ([, s]) => {
|
|
363
|
-
const raw = handler.bracket.rem(s);
|
|
179
|
+
const raw = handler.bracket.auto.rem(s);
|
|
364
180
|
if (raw)
|
|
365
181
|
return { "font-size": raw };
|
|
366
182
|
}],
|
|
@@ -370,17 +186,17 @@ const fonts = [
|
|
|
370
186
|
return { "font-weight": v };
|
|
371
187
|
}],
|
|
372
188
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
373
|
-
const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
|
|
189
|
+
const v = theme.lineHeight?.[s] || handler.bracket.auto.rem(s);
|
|
374
190
|
if (v !== null)
|
|
375
191
|
return { "line-height": v };
|
|
376
192
|
}],
|
|
377
193
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
378
|
-
const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
|
|
194
|
+
const v = theme.letterSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
379
195
|
if (v !== null)
|
|
380
196
|
return { "letter-spacing": v };
|
|
381
197
|
}],
|
|
382
198
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
383
|
-
const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
|
|
199
|
+
const v = theme.wordSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
384
200
|
if (v !== null)
|
|
385
201
|
return { "word-spacing": v };
|
|
386
202
|
}]
|
|
@@ -400,7 +216,7 @@ const tabSizes = [
|
|
|
400
216
|
];
|
|
401
217
|
const textIndents = [
|
|
402
218
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
403
|
-
const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s);
|
|
219
|
+
const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s);
|
|
404
220
|
if (v != null)
|
|
405
221
|
return { "text-indent": v };
|
|
406
222
|
}]
|
|
@@ -412,7 +228,7 @@ const textStrokes = [
|
|
|
412
228
|
return { "-webkit-text-stroke-width": v };
|
|
413
229
|
}],
|
|
414
230
|
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
415
|
-
[/^text-stroke-op(?:acity)?-?(.+)
|
|
231
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
416
232
|
];
|
|
417
233
|
const textShadows = [
|
|
418
234
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
@@ -423,36 +239,23 @@ const textShadows = [
|
|
|
423
239
|
];
|
|
424
240
|
|
|
425
241
|
const gaps = [
|
|
426
|
-
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
427
|
-
const v = handler.bracket.rem(s);
|
|
428
|
-
if (v != null) {
|
|
429
|
-
return {
|
|
430
|
-
"grid-gap": v,
|
|
431
|
-
"gap": v
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
}],
|
|
435
|
-
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
436
|
-
const v = handler.bracket.rem(s);
|
|
437
|
-
if (v != null) {
|
|
438
|
-
return {
|
|
439
|
-
"grid-column-gap": v,
|
|
440
|
-
"column-gap": v
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
}],
|
|
444
|
-
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
445
|
-
const v = handler.bracket.rem(s);
|
|
242
|
+
[/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
|
|
243
|
+
const v = handler.bracket.auto.rem(s);
|
|
446
244
|
if (v != null) {
|
|
245
|
+
const direction = {
|
|
246
|
+
"": "",
|
|
247
|
+
"x-": "column-",
|
|
248
|
+
"y-": "row-"
|
|
249
|
+
}[d];
|
|
447
250
|
return {
|
|
448
|
-
|
|
449
|
-
|
|
251
|
+
[`grid-${direction}gap`]: v,
|
|
252
|
+
[`${direction}gap`]: v
|
|
450
253
|
};
|
|
451
254
|
}
|
|
452
255
|
}]
|
|
453
256
|
];
|
|
454
257
|
|
|
455
|
-
const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.rem(s))[0];
|
|
258
|
+
const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.auto.rem(s))[0];
|
|
456
259
|
const autoDirection = (selector, theme) => {
|
|
457
260
|
if (selector === "min")
|
|
458
261
|
return "min-content";
|
|
@@ -465,10 +268,10 @@ const autoDirection = (selector, theme) => {
|
|
|
465
268
|
const grids = [
|
|
466
269
|
["grid", { display: "grid" }],
|
|
467
270
|
["inline-grid", { display: "inline-grid" }],
|
|
468
|
-
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start":
|
|
469
|
-
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end":
|
|
470
|
-
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start":
|
|
471
|
-
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end":
|
|
271
|
+
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
|
|
272
|
+
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
|
|
273
|
+
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
|
|
274
|
+
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
|
|
472
275
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
473
276
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
474
277
|
let raw = handler.bracket(v);
|
|
@@ -480,16 +283,16 @@ const grids = [
|
|
|
480
283
|
if (parts[0] === "span") {
|
|
481
284
|
if (parts[1] === "full")
|
|
482
285
|
return { [key]: "1/-1" };
|
|
483
|
-
raw = handler.number.bracket(parts[1])
|
|
286
|
+
raw = handler.number.bracket(parts[1]);
|
|
484
287
|
if (raw)
|
|
485
288
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
486
289
|
}
|
|
487
290
|
}],
|
|
488
|
-
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns":
|
|
489
|
-
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow":
|
|
490
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows":
|
|
491
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,
|
|
492
|
-
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,
|
|
291
|
+
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
|
|
292
|
+
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
|
|
293
|
+
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
|
|
294
|
+
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
295
|
+
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
493
296
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
494
297
|
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
495
298
|
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
@@ -526,7 +329,10 @@ const justifies = [
|
|
|
526
329
|
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
527
330
|
];
|
|
528
331
|
const orders = [
|
|
529
|
-
[/^order-(.+)$/, ([, v]) => ({ order:
|
|
332
|
+
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
|
|
333
|
+
["order-first", { order: "-9999" }],
|
|
334
|
+
["order-last", { order: "9999" }],
|
|
335
|
+
["order-none", { order: "0" }]
|
|
530
336
|
];
|
|
531
337
|
const alignments = [
|
|
532
338
|
["content-start", { "align-content": "flex-start" }],
|
|
@@ -544,7 +350,7 @@ const alignments = [
|
|
|
544
350
|
["self-start", { "align-self": "flex-start" }],
|
|
545
351
|
["self-end", { "align-self": "flex-end" }],
|
|
546
352
|
["self-center", { "align-self": "center" }],
|
|
547
|
-
["self-stretch", { "align-
|
|
353
|
+
["self-stretch", { "align-self": "stretch" }]
|
|
548
354
|
];
|
|
549
355
|
const placements = [
|
|
550
356
|
["place-content-start", { "place-content": "start" }],
|
|
@@ -558,7 +364,7 @@ const placements = [
|
|
|
558
364
|
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
559
365
|
];
|
|
560
366
|
function handleInsetValue(v) {
|
|
561
|
-
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.rem(v);
|
|
367
|
+
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
|
|
562
368
|
}
|
|
563
369
|
const insets = [
|
|
564
370
|
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
@@ -569,20 +375,95 @@ const insets = [
|
|
|
569
375
|
}]
|
|
570
376
|
];
|
|
571
377
|
const floats = [
|
|
572
|
-
[
|
|
573
|
-
[
|
|
378
|
+
["float-left", { float: "left" }],
|
|
379
|
+
["float-right", { float: "right" }],
|
|
380
|
+
["float-none", { float: "none" }],
|
|
381
|
+
["clear-left", { clear: "left" }],
|
|
382
|
+
["clear-right", { clear: "right" }],
|
|
383
|
+
["clear-both", { clear: "both" }],
|
|
384
|
+
["clear-none", { clear: "none" }]
|
|
574
385
|
];
|
|
575
386
|
const zIndexes = [
|
|
576
387
|
["z-auto", { "z-index": "auto" }],
|
|
577
388
|
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": handler.number(v) })]
|
|
578
389
|
];
|
|
579
390
|
const boxSizing = [
|
|
580
|
-
[
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
391
|
+
["box-border", { "box-sizing": "border-box" }],
|
|
392
|
+
["box-content", { "box-sizing": "content-box" }]
|
|
393
|
+
];
|
|
394
|
+
|
|
395
|
+
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
396
|
+
const displays = [
|
|
397
|
+
["inline", { display: "inline" }],
|
|
398
|
+
["block", { display: "block" }],
|
|
399
|
+
["inline-block", { display: "inline-block" }],
|
|
400
|
+
["contents", { display: "contents" }],
|
|
401
|
+
["flow-root", { display: "flow-root" }],
|
|
402
|
+
["list-item", { display: "list-item" }],
|
|
403
|
+
["hidden", { display: "none" }]
|
|
404
|
+
];
|
|
405
|
+
const appearances = [
|
|
406
|
+
["visible", { visibility: "visible" }],
|
|
407
|
+
["invisible", { visibility: "hidden" }],
|
|
408
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
409
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
410
|
+
];
|
|
411
|
+
const cursors = [
|
|
412
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
413
|
+
];
|
|
414
|
+
const pointerEvents = [
|
|
415
|
+
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
416
|
+
["pointer-events-none", { "pointer-events": "none" }]
|
|
417
|
+
];
|
|
418
|
+
const resizes = [
|
|
419
|
+
["resize-x", { resize: "horizontal" }],
|
|
420
|
+
["resize-y", { resize: "vertical" }],
|
|
421
|
+
["resize", { resize: "both" }],
|
|
422
|
+
["resize-none", { resize: "none" }]
|
|
423
|
+
];
|
|
424
|
+
const userSelects = [
|
|
425
|
+
["select-auto", { "user-select": "auto" }],
|
|
426
|
+
["select-all", { "user-select": "all" }],
|
|
427
|
+
["select-text", { "user-select": "text" }],
|
|
428
|
+
["select-none", { "user-select": "none" }]
|
|
429
|
+
];
|
|
430
|
+
const whitespaces = [
|
|
431
|
+
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
432
|
+
];
|
|
433
|
+
const contents = [
|
|
434
|
+
["content-empty", { content: '""' }]
|
|
435
|
+
];
|
|
436
|
+
const breaks = [
|
|
437
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
438
|
+
["break-word", { "overflow-wrap": "break-word" }],
|
|
439
|
+
["break-all", { "word-break": "break-all" }]
|
|
440
|
+
];
|
|
441
|
+
const textOverflows = [
|
|
442
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
443
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
444
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
445
|
+
];
|
|
446
|
+
const textTransforms = [
|
|
447
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
448
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
449
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
450
|
+
["case-normal", { "text-transform": "none" }]
|
|
451
|
+
];
|
|
452
|
+
const fontStyles = [
|
|
453
|
+
["italic", { "font-style": "italic" }],
|
|
454
|
+
["not-italic", { "font-style": "normal" }]
|
|
455
|
+
];
|
|
456
|
+
const fontSmoothings = [
|
|
457
|
+
["antialiased", {
|
|
458
|
+
"-webkit-font-smoothing": "antialiased",
|
|
459
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
460
|
+
"font-smoothing": "grayscale"
|
|
461
|
+
}],
|
|
462
|
+
["subpixel-antialiased", {
|
|
463
|
+
"-webkit-font-smoothing": "auto",
|
|
464
|
+
"-moz-osx-font-smoothing": "auto",
|
|
465
|
+
"font-smoothing": "auto"
|
|
466
|
+
}]
|
|
586
467
|
];
|
|
587
468
|
|
|
588
469
|
const rings = [
|
|
@@ -590,32 +471,32 @@ const rings = [
|
|
|
590
471
|
const value = handler.px(d || "1");
|
|
591
472
|
if (value) {
|
|
592
473
|
return {
|
|
593
|
-
"--un-ring-inset":
|
|
474
|
+
"--un-ring-inset": varEmpty,
|
|
594
475
|
"--un-ring-offset-width": "0px",
|
|
595
476
|
"--un-ring-offset-color": "#fff",
|
|
596
477
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
597
478
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
598
479
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
599
|
-
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
600
|
-
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
480
|
+
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
|
|
481
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
601
482
|
};
|
|
602
483
|
}
|
|
603
484
|
}],
|
|
604
|
-
[
|
|
485
|
+
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
486
|
+
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
605
487
|
const value = handler.px(d || "1");
|
|
606
|
-
if (value)
|
|
607
|
-
return {
|
|
608
|
-
"--un-ring-offset-width": value
|
|
609
|
-
};
|
|
610
|
-
}
|
|
488
|
+
if (value)
|
|
489
|
+
return { "--un-ring-offset-width": value };
|
|
611
490
|
}],
|
|
612
|
-
[
|
|
613
|
-
|
|
614
|
-
|
|
491
|
+
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
492
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
|
|
493
|
+
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
494
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) })],
|
|
495
|
+
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
615
496
|
];
|
|
616
497
|
|
|
617
498
|
const colorResolver = (body, theme) => {
|
|
618
|
-
const data =
|
|
499
|
+
const data = parseColor(body, theme);
|
|
619
500
|
if (!data)
|
|
620
501
|
return;
|
|
621
502
|
const { color, rgba } = data;
|
|
@@ -633,7 +514,7 @@ const colorResolver = (body, theme) => {
|
|
|
633
514
|
};
|
|
634
515
|
const boxShadows = [
|
|
635
516
|
[/^shadow-?(.*)$/, ([, d], { theme }) => {
|
|
636
|
-
const value = theme
|
|
517
|
+
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
637
518
|
if (value) {
|
|
638
519
|
return {
|
|
639
520
|
"--un-shadow-color": "0,0,0",
|
|
@@ -658,7 +539,7 @@ function getThemeValue(minmax, hw, theme, prop) {
|
|
|
658
539
|
}
|
|
659
540
|
const sizes = [
|
|
660
541
|
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
661
|
-
const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.rem(s);
|
|
542
|
+
const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.auto.rem(s);
|
|
662
543
|
if (v != null)
|
|
663
544
|
return { [getPropName(m, w)]: v };
|
|
664
545
|
}],
|
|
@@ -677,11 +558,6 @@ const aspectRatio = [
|
|
|
677
558
|
}]
|
|
678
559
|
];
|
|
679
560
|
|
|
680
|
-
const directionSize = (prefix) => ([_, direction, size]) => {
|
|
681
|
-
const v = handler.bracket.rem.fraction.cssvar(size);
|
|
682
|
-
if (v)
|
|
683
|
-
return directionMap[direction].map((i) => [prefix + i, v]);
|
|
684
|
-
};
|
|
685
561
|
const paddings = [
|
|
686
562
|
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
687
563
|
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
@@ -693,84 +569,13 @@ const margins = [
|
|
|
693
569
|
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
694
570
|
];
|
|
695
571
|
|
|
696
|
-
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
697
|
-
const displays = [
|
|
698
|
-
["inline", { display: "inline" }],
|
|
699
|
-
["block", { display: "block" }],
|
|
700
|
-
["inline-block", { display: "inline-block" }],
|
|
701
|
-
["contents", { display: "contents" }],
|
|
702
|
-
["flow-root", { display: "flow-root" }],
|
|
703
|
-
["list-item", { display: "list-item" }],
|
|
704
|
-
["hidden", { display: "none" }]
|
|
705
|
-
];
|
|
706
|
-
const appearances = [
|
|
707
|
-
["visible", { visibility: "visible" }],
|
|
708
|
-
["invisible", { visibility: "hidden" }],
|
|
709
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
710
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
711
|
-
];
|
|
712
|
-
const cursors = [
|
|
713
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
714
|
-
];
|
|
715
|
-
const pointerEvents = [
|
|
716
|
-
["pointer-events-none", { "pointer-events": "none" }],
|
|
717
|
-
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
718
|
-
];
|
|
719
|
-
const resizes = [
|
|
720
|
-
["resize-none", { resize: "none" }],
|
|
721
|
-
["resize-x", { resize: "horizontal" }],
|
|
722
|
-
["resize-y", { resize: "vertical" }],
|
|
723
|
-
["resize", { resize: "both" }]
|
|
724
|
-
];
|
|
725
|
-
const userSelects = [
|
|
726
|
-
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
727
|
-
];
|
|
728
|
-
const whitespaces = [
|
|
729
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
730
|
-
];
|
|
731
|
-
const contents = [
|
|
732
|
-
["content-empty", { content: '""' }]
|
|
733
|
-
];
|
|
734
|
-
const breaks = [
|
|
735
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
736
|
-
["break-word", { "overflow-wrap": "break-word" }],
|
|
737
|
-
["break-all", { "word-break": "break-all" }]
|
|
738
|
-
];
|
|
739
|
-
const textOverflows = [
|
|
740
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
741
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
742
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
743
|
-
];
|
|
744
|
-
const textTransforms = [
|
|
745
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
746
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
747
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
748
|
-
["case-normal", { "text-transform": "none" }]
|
|
749
|
-
];
|
|
750
|
-
const fontStyles = [
|
|
751
|
-
["italic", { "font-style": "italic" }],
|
|
752
|
-
["not-italic", { "font-style": "normal" }]
|
|
753
|
-
];
|
|
754
|
-
const fontSmoothings = [
|
|
755
|
-
["antialiased", {
|
|
756
|
-
"-webkit-font-smoothing": "antialiased",
|
|
757
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
758
|
-
"font-smoothing": "grayscale"
|
|
759
|
-
}],
|
|
760
|
-
["subpixel-antialiased", {
|
|
761
|
-
"-webkit-font-smoothing": "auto",
|
|
762
|
-
"-moz-osx-font-smoothing": "auto",
|
|
763
|
-
"font-smoothing": "auto"
|
|
764
|
-
}]
|
|
765
|
-
];
|
|
766
|
-
|
|
767
572
|
const transformGpu = {
|
|
768
573
|
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
769
|
-
[
|
|
574
|
+
[CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
770
575
|
};
|
|
771
576
|
const transformCpu = {
|
|
772
577
|
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
|
|
773
|
-
[
|
|
578
|
+
[CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
774
579
|
};
|
|
775
580
|
const transformBase = {
|
|
776
581
|
"--un-rotate": 0,
|
|
@@ -787,11 +592,12 @@ const transformBase = {
|
|
|
787
592
|
const transforms = [
|
|
788
593
|
["transform", transformBase],
|
|
789
594
|
[/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
|
|
790
|
-
[/^translate()-(
|
|
791
|
-
[/^translate-([xyz])-(
|
|
792
|
-
[/^scale()-(
|
|
793
|
-
[/^scale-([xyz])-(
|
|
794
|
-
[/^rotate-(
|
|
595
|
+
[/^translate()-(.+)$/, handleTranslate],
|
|
596
|
+
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
597
|
+
[/^scale()-(.+)$/, handleScale],
|
|
598
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
599
|
+
[/^rotate-(.+)$/, handleRotate],
|
|
600
|
+
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
795
601
|
["transform-gpu", transformGpu],
|
|
796
602
|
["transform-cpu", transformCpu],
|
|
797
603
|
["transform-none", { transform: "none" }],
|
|
@@ -806,7 +612,7 @@ const transforms = [
|
|
|
806
612
|
["origin-top-left", { "transform-origin": "top left" }]
|
|
807
613
|
];
|
|
808
614
|
function handleTranslate([, d, b]) {
|
|
809
|
-
const v = handler.bracket.fraction.rem(b);
|
|
615
|
+
const v = handler.bracket.fraction.auto.rem(b);
|
|
810
616
|
if (v != null) {
|
|
811
617
|
return [
|
|
812
618
|
transformBase,
|
|
@@ -827,7 +633,7 @@ function handleScale([, d, b]) {
|
|
|
827
633
|
];
|
|
828
634
|
}
|
|
829
635
|
}
|
|
830
|
-
function
|
|
636
|
+
function handleRotateWithUnit([, b]) {
|
|
831
637
|
const v = handler.bracket.number(b);
|
|
832
638
|
if (v != null) {
|
|
833
639
|
return [
|
|
@@ -836,6 +642,15 @@ function handleRotate([, b]) {
|
|
|
836
642
|
];
|
|
837
643
|
}
|
|
838
644
|
}
|
|
645
|
+
function handleRotate([, b]) {
|
|
646
|
+
const v = handler.bracket(b);
|
|
647
|
+
if (v != null) {
|
|
648
|
+
return [
|
|
649
|
+
transformBase,
|
|
650
|
+
{ "--un-rotate": v }
|
|
651
|
+
];
|
|
652
|
+
}
|
|
653
|
+
}
|
|
839
654
|
|
|
840
655
|
const variablesAbbrMap = {
|
|
841
656
|
"visible": "visibility",
|
|
@@ -895,18 +710,10 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
895
710
|
const textDecorations = [
|
|
896
711
|
["underline", { "text-decoration": "underline" }],
|
|
897
712
|
["line-through", { "text-decoration": "line-through" }],
|
|
898
|
-
["no-underline", { "text-decoration": "none" }],
|
|
899
713
|
["decoration-underline", { "text-decoration": "underline" }],
|
|
900
714
|
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
901
|
-
[
|
|
902
|
-
[/^(?:underline|decoration)-(
|
|
903
|
-
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : handler.bracket.px(s) })],
|
|
904
|
-
[/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
|
|
905
|
-
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
906
|
-
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
907
|
-
if (v != null)
|
|
908
|
-
return { "text-underline-offset": v };
|
|
909
|
-
}],
|
|
715
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
716
|
+
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
910
717
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
911
718
|
const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
|
|
912
719
|
if (result) {
|
|
@@ -916,7 +723,25 @@ const textDecorations = [
|
|
|
916
723
|
};
|
|
917
724
|
}
|
|
918
725
|
}],
|
|
919
|
-
[/^(?:underline|decoration)-op(?:acity)?-?(.+)
|
|
726
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
|
|
727
|
+
[/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.px(s) })],
|
|
728
|
+
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
729
|
+
["no-underline", { "text-decoration": "none" }],
|
|
730
|
+
["decoration-none", { "text-decoration": "none" }]
|
|
731
|
+
];
|
|
732
|
+
|
|
733
|
+
const svgUtilities = [
|
|
734
|
+
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
735
|
+
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
736
|
+
["fill-none", { fill: "none" }],
|
|
737
|
+
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
738
|
+
const v = handler.bracket.fraction.px.number(s);
|
|
739
|
+
if (v)
|
|
740
|
+
return { "stroke-width": v };
|
|
741
|
+
}],
|
|
742
|
+
[/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
|
|
743
|
+
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
744
|
+
["stroke-none", { stroke: "none" }]
|
|
920
745
|
];
|
|
921
746
|
|
|
922
747
|
const rules = [
|
|
@@ -926,7 +751,7 @@ const rules = [
|
|
|
926
751
|
displays,
|
|
927
752
|
opacity,
|
|
928
753
|
bgColors,
|
|
929
|
-
|
|
754
|
+
svgUtilities,
|
|
930
755
|
borders,
|
|
931
756
|
contents,
|
|
932
757
|
fonts,
|
|
@@ -960,7 +785,6 @@ const rules = [
|
|
|
960
785
|
overflows,
|
|
961
786
|
outline,
|
|
962
787
|
appearance,
|
|
963
|
-
placeholder,
|
|
964
788
|
positions,
|
|
965
789
|
orders,
|
|
966
790
|
justifies,
|
|
@@ -972,7 +796,8 @@ const rules = [
|
|
|
972
796
|
boxSizing,
|
|
973
797
|
transitions,
|
|
974
798
|
transforms,
|
|
799
|
+
willChange,
|
|
975
800
|
questionMark
|
|
976
801
|
].flat(1);
|
|
977
802
|
|
|
978
|
-
export {
|
|
803
|
+
export { textDecorations as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmpty as E, displays as F, appearances as G, cursors as H, pointerEvents as I, resizes as J, userSelects as K, whitespaces as L, contents as M, breaks as N, textOverflows as O, textTransforms as P, fontStyles as Q, fontSmoothings as R, svgUtilities as S, transforms as T, transitions as U, fonts as V, tabSizes as W, textIndents as X, textStrokes as Y, textShadows as Z, cssVariables as _, appearance as a, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, boxShadows as y, zIndexes as z };
|