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