@unocss/preset-mini 0.16.4 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/default2.cjs +255 -415
- package/dist/chunks/default2.mjs +253 -406
- package/dist/chunks/default3.cjs +6 -2
- package/dist/chunks/default3.mjs +8 -4
- package/dist/chunks/pseudo.cjs +68 -28
- package/dist/chunks/pseudo.mjs +67 -29
- package/dist/chunks/utilities.cjs +143 -8
- package/dist/chunks/utilities.mjs +143 -10
- package/dist/{colors-d6b5a5b4.d.ts → colors-6d634692.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-c7c67d23.d.ts → default-958434b6.d.ts} +1 -1
- package/dist/index.cjs +2 -5
- package/dist/index.d.ts +8 -4
- package/dist/index.mjs +3 -6
- package/dist/rules.cjs +1 -8
- package/dist/rules.d.ts +3 -18
- package/dist/rules.mjs +2 -2
- package/dist/theme.d.ts +4 -4
- package/dist/{types-7963d0b3.d.ts → types-a2d2b52f.d.ts} +8 -1
- package/dist/utils.cjs +2 -0
- package/dist/utils.d.ts +61 -5
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +3 -1
- package/dist/variants.d.ts +9 -4
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
3
|
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
4
4
|
|
|
5
5
|
const verticalAlignAlias = {
|
|
@@ -17,257 +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 colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
23
|
-
const [name] = colors;
|
|
24
|
-
if (!name)
|
|
25
|
-
return;
|
|
26
|
-
let color;
|
|
27
|
-
const bracket = handler.bracket(main);
|
|
28
|
-
const bracketOrMain = bracket || main;
|
|
29
|
-
if (bracketOrMain.startsWith("#"))
|
|
30
|
-
color = bracketOrMain.slice(1);
|
|
31
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
32
|
-
color = bracketOrMain.slice(4);
|
|
33
|
-
color = color || bracket;
|
|
34
|
-
let no = "DEFAULT";
|
|
35
|
-
if (!color) {
|
|
36
|
-
let colorData = theme.colors?.[name];
|
|
37
|
-
if (colorData) {
|
|
38
|
-
[, no = no] = colors;
|
|
39
|
-
} else {
|
|
40
|
-
if (colors.slice(-1)[0].match(/^\d+$/))
|
|
41
|
-
no = colors.pop();
|
|
42
|
-
colorData = theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
|
|
43
|
-
}
|
|
44
|
-
if (typeof colorData === "string")
|
|
45
|
-
color = colorData;
|
|
46
|
-
else if (no && colorData)
|
|
47
|
-
color = colorData[no];
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
opacity: opacity2,
|
|
51
|
-
name,
|
|
52
|
-
no,
|
|
53
|
-
color,
|
|
54
|
-
rgba: hex2rgba(color)
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
58
|
-
const data = parseColorUtil(body, theme);
|
|
59
|
-
if (!data)
|
|
60
|
-
return;
|
|
61
|
-
const { opacity: opacity2, color, rgba } = data;
|
|
62
|
-
if (!color)
|
|
63
|
-
return;
|
|
64
|
-
const a = opacity2 ? opacity2[0] === "[" ? handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
65
|
-
if (rgba) {
|
|
66
|
-
if (a != null && !Number.isNaN(a)) {
|
|
67
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
68
|
-
return {
|
|
69
|
-
[attribute]: `rgba(${rgba.join(",")})`
|
|
70
|
-
};
|
|
71
|
-
} else {
|
|
72
|
-
return {
|
|
73
|
-
[`--un-${varName}-opacity`]: 1,
|
|
74
|
-
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
return {
|
|
79
|
-
[attribute]: color.replace("%alpha", `${a || 1}`)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
};
|
|
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)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
89
|
-
];
|
|
90
|
-
const bgColors = [
|
|
91
|
-
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
92
|
-
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
93
|
-
];
|
|
94
|
-
const borderColors = [
|
|
95
|
-
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
96
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": handler.bracket.percent(opacity2) })]
|
|
97
|
-
];
|
|
98
|
-
const ringColors = [
|
|
99
|
-
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
100
|
-
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity2) })]
|
|
101
|
-
];
|
|
102
|
-
const ringOffsetColors = [
|
|
103
|
-
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
104
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity2) })]
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
const cssBasicProps = [
|
|
108
|
-
"color",
|
|
109
|
-
"border-color",
|
|
110
|
-
"background-color",
|
|
111
|
-
"flex-grow",
|
|
112
|
-
"flex",
|
|
113
|
-
"flex-shrink",
|
|
114
|
-
"caret-color",
|
|
115
|
-
"font",
|
|
116
|
-
"gap",
|
|
117
|
-
"opacity",
|
|
118
|
-
"visibility",
|
|
119
|
-
"z-index",
|
|
120
|
-
"font-weight",
|
|
121
|
-
"zoom",
|
|
122
|
-
"text-shadow",
|
|
123
|
-
"transform",
|
|
124
|
-
"box-shadow"
|
|
125
|
-
];
|
|
126
|
-
const cssPositionProps = [
|
|
127
|
-
"backround-position",
|
|
128
|
-
"left",
|
|
129
|
-
"right",
|
|
130
|
-
"top",
|
|
131
|
-
"bottom",
|
|
132
|
-
"object-position"
|
|
133
|
-
];
|
|
134
|
-
const cssSizeProps = [
|
|
135
|
-
"max-height",
|
|
136
|
-
"min-height",
|
|
137
|
-
"max-width",
|
|
138
|
-
"min-width",
|
|
139
|
-
"height",
|
|
140
|
-
"width",
|
|
141
|
-
"border-width",
|
|
142
|
-
"margin",
|
|
143
|
-
"padding",
|
|
144
|
-
"outline-width",
|
|
145
|
-
"outline-offset",
|
|
146
|
-
"font-size",
|
|
147
|
-
"line-height",
|
|
148
|
-
"text-indent",
|
|
149
|
-
"vertical-align",
|
|
150
|
-
"border-spacing",
|
|
151
|
-
"letter-spacing",
|
|
152
|
-
"word-spacing"
|
|
153
|
-
];
|
|
154
|
-
const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
155
|
-
const cssProps = [
|
|
156
|
-
...cssBasicProps,
|
|
157
|
-
...cssPositionProps,
|
|
158
|
-
...cssSizeProps,
|
|
159
|
-
...cssEnhanceProps
|
|
160
|
-
];
|
|
161
|
-
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
162
|
-
const displays = [
|
|
163
|
-
["inline", { display: "inline" }],
|
|
164
|
-
["block", { display: "block" }],
|
|
165
|
-
["inline-block", { display: "inline-block" }],
|
|
166
|
-
["contents", { display: "contents" }],
|
|
167
|
-
["flow-root", { display: "flow-root" }],
|
|
168
|
-
["list-item", { display: "list-item" }],
|
|
169
|
-
["hidden", { display: "none" }]
|
|
170
|
-
];
|
|
171
|
-
const appearances = [
|
|
172
|
-
["visible", { visibility: "visible" }],
|
|
173
|
-
["invisible", { visibility: "hidden" }],
|
|
174
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
175
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
176
|
-
];
|
|
177
|
-
const cursors = [
|
|
178
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
179
|
-
];
|
|
180
|
-
const pointerEvents = [
|
|
181
|
-
["pointer-events-none", { "pointer-events": "none" }],
|
|
182
|
-
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
183
|
-
];
|
|
184
|
-
const resizes = [
|
|
185
|
-
["resize-none", { resize: "none" }],
|
|
186
|
-
["resize-x", { resize: "horizontal" }],
|
|
187
|
-
["resize-y", { resize: "vertical" }],
|
|
188
|
-
["resize", { resize: "both" }]
|
|
189
|
-
];
|
|
190
|
-
const userSelects = [
|
|
191
|
-
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
192
|
-
];
|
|
193
|
-
const whitespaces = [
|
|
194
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
195
|
-
];
|
|
196
|
-
const contents = [
|
|
197
|
-
["content-empty", { content: '""' }]
|
|
198
|
-
];
|
|
199
|
-
const breaks = [
|
|
200
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
201
|
-
["break-word", { "overflow-wrap": "break-word" }],
|
|
202
|
-
["break-all", { "word-break": "break-all" }]
|
|
203
|
-
];
|
|
204
|
-
const textOverflows = [
|
|
205
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
206
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
207
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
208
|
-
];
|
|
209
|
-
const textTransforms = [
|
|
210
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
211
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
212
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
213
|
-
["case-normal", { "text-transform": "none" }]
|
|
214
|
-
];
|
|
215
|
-
const fontStyles = [
|
|
216
|
-
["italic", { "font-style": "italic" }],
|
|
217
|
-
["not-italic", { "font-style": "normal" }]
|
|
218
|
-
];
|
|
219
|
-
const fontSmoothings = [
|
|
220
|
-
["antialiased", {
|
|
221
|
-
"-webkit-font-smoothing": "antialiased",
|
|
222
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
223
|
-
"font-smoothing": "grayscale"
|
|
224
|
-
}],
|
|
225
|
-
["subpixel-antialiased", {
|
|
226
|
-
"-webkit-font-smoothing": "auto",
|
|
227
|
-
"-moz-osx-font-smoothing": "auto",
|
|
228
|
-
"font-smoothing": "auto"
|
|
229
|
-
}]
|
|
230
|
-
];
|
|
231
|
-
|
|
232
|
-
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
233
|
-
const parseOutlineSize = (s) => {
|
|
234
|
-
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
235
|
-
const size = handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
|
|
236
|
-
if (size) {
|
|
237
|
-
return {
|
|
238
|
-
[`outline-${propName}`]: size
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
20
|
const outline = [
|
|
243
|
-
[
|
|
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) })],
|
|
244
24
|
["outline", { "outline-style": "solid" }],
|
|
245
|
-
[
|
|
246
|
-
|
|
247
|
-
(match, config) => {
|
|
248
|
-
const [, d] = match;
|
|
249
|
-
if (d === "none") {
|
|
250
|
-
return {
|
|
251
|
-
"outline": "2px solid transparent",
|
|
252
|
-
"outline-offset": "2px"
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
if (outlineStyle.includes(d)) {
|
|
256
|
-
return {
|
|
257
|
-
"outline-style": d
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
261
|
-
match[0],
|
|
262
|
-
match[1].replace(/^color-/, "")
|
|
263
|
-
], config);
|
|
264
|
-
if (colorSheet)
|
|
265
|
-
return colorSheet;
|
|
266
|
-
const sizeSheet = parseOutlineSize(d);
|
|
267
|
-
if (sizeSheet)
|
|
268
|
-
return sizeSheet;
|
|
269
|
-
}
|
|
270
|
-
]
|
|
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" }]
|
|
271
27
|
];
|
|
272
28
|
const appearance = [
|
|
273
29
|
["appearance-none", {
|
|
@@ -275,33 +31,8 @@ const appearance = [
|
|
|
275
31
|
"-webkit-appearance": "none"
|
|
276
32
|
}]
|
|
277
33
|
];
|
|
278
|
-
const placeholder = [
|
|
279
|
-
[
|
|
280
|
-
/^placeholder-opacity-(\d+)$/,
|
|
281
|
-
([, d]) => ({
|
|
282
|
-
"placeholder-opacity": handler.bracket.percent(d)
|
|
283
|
-
})
|
|
284
|
-
],
|
|
285
|
-
[
|
|
286
|
-
/^placeholder-(?!opacity)(.+)$/,
|
|
287
|
-
(match, config) => {
|
|
288
|
-
match[1] = match[1].replace(/^color-/, "");
|
|
289
|
-
return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
|
|
290
|
-
}
|
|
291
|
-
]
|
|
292
|
-
];
|
|
293
|
-
const cssPropsStr = cssProps.join(", ");
|
|
294
|
-
const validateProperty$1 = (prop) => {
|
|
295
|
-
if (prop && !cssProps.includes(prop))
|
|
296
|
-
return;
|
|
297
|
-
return prop || cssPropsStr;
|
|
298
|
-
};
|
|
299
34
|
const willChange = [
|
|
300
|
-
[/^will-change-(
|
|
301
|
-
const w = validateProperty$1(p) || handler.global(p);
|
|
302
|
-
if (w)
|
|
303
|
-
return { "will-change": w };
|
|
304
|
-
}]
|
|
35
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.global(p) })]
|
|
305
36
|
];
|
|
306
37
|
|
|
307
38
|
const borders = [
|
|
@@ -313,15 +44,58 @@ const borders = [
|
|
|
313
44
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
314
45
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
315
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],
|
|
316
56
|
["border-solid", { "border-style": "solid" }],
|
|
317
57
|
["border-dashed", { "border-style": "dashed" }],
|
|
318
58
|
["border-dotted", { "border-style": "dotted" }],
|
|
319
59
|
["border-double", { "border-style": "double" }],
|
|
320
|
-
["border-none", { "border-style": "none" }]
|
|
321
|
-
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
322
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
323
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
60
|
+
["border-none", { "border-style": "none" }]
|
|
324
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
|
+
};
|
|
325
99
|
function handlerBorder(m) {
|
|
326
100
|
const borderSizes = handlerBorderSize(m);
|
|
327
101
|
if (borderSizes) {
|
|
@@ -334,64 +108,59 @@ function handlerBorder(m) {
|
|
|
334
108
|
function handlerBorderSize([, a, b]) {
|
|
335
109
|
const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
|
|
336
110
|
const v = handler.bracket.px(s);
|
|
337
|
-
if (v
|
|
338
|
-
return [
|
|
339
|
-
...directionMap[d].map((i) => [`border${i}-width`, v])
|
|
340
|
-
];
|
|
341
|
-
}
|
|
111
|
+
if (v !== void 0)
|
|
112
|
+
return directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
342
113
|
}
|
|
343
114
|
function handlerBorderColor([, a, c], ctx) {
|
|
344
|
-
if (c
|
|
345
|
-
|
|
346
|
-
if (ofColor) {
|
|
347
|
-
const borders2 = directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
|
|
348
|
-
const borderObject = {};
|
|
349
|
-
Object.assign(borderObject, ...borders2);
|
|
350
|
-
return borderObject;
|
|
351
|
-
}
|
|
115
|
+
if (borderHasColor(c, ctx)) {
|
|
116
|
+
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
352
117
|
}
|
|
353
118
|
}
|
|
354
119
|
function handlerRounded([, a, b], { theme }) {
|
|
355
120
|
const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
|
|
356
|
-
const v = theme.borderRadius?.[s] || handler.
|
|
357
|
-
if (v
|
|
121
|
+
const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
|
|
122
|
+
if (v !== void 0)
|
|
358
123
|
return cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
359
124
|
}
|
|
360
125
|
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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);
|
|
367
140
|
};
|
|
368
141
|
const transitions = [
|
|
369
|
-
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
372
|
-
return
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
}],
|
|
379
|
-
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
380
|
-
return {
|
|
381
|
-
"transition-duration": `${duration}ms`
|
|
382
|
-
};
|
|
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
|
+
}
|
|
383
151
|
}],
|
|
152
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
|
|
384
153
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
154
|
+
["ease-linear", { "transition-timing-function": "linear" }],
|
|
385
155
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
386
156
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
387
157
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
388
158
|
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
389
159
|
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
390
|
-
[/^(?:transition-)?property-(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}]
|
|
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" }]
|
|
395
164
|
];
|
|
396
165
|
|
|
397
166
|
const flex = [
|
|
@@ -402,7 +171,7 @@ const flex = [
|
|
|
402
171
|
["flex-auto", { flex: "1 1 auto" }],
|
|
403
172
|
["flex-initial", { flex: "0 1 auto" }],
|
|
404
173
|
["flex-none", { flex: "none" }],
|
|
405
|
-
[/^flex
|
|
174
|
+
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
|
|
406
175
|
["flex-shrink", { "flex-shrink": 1 }],
|
|
407
176
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
408
177
|
["flex-grow", { "flex-grow": 1 }],
|
|
@@ -437,7 +206,7 @@ const fonts = [
|
|
|
437
206
|
}
|
|
438
207
|
}],
|
|
439
208
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
440
|
-
const size = handler.bracket.rem(s);
|
|
209
|
+
const size = handler.bracket.auto.rem(s);
|
|
441
210
|
if (size)
|
|
442
211
|
return { "font-size": size };
|
|
443
212
|
const themed = toArray(theme.fontSize?.[s]);
|
|
@@ -450,7 +219,7 @@ const fonts = [
|
|
|
450
219
|
}
|
|
451
220
|
}],
|
|
452
221
|
[/^text-size-(.+)$/, ([, s]) => {
|
|
453
|
-
const raw = handler.bracket.rem(s);
|
|
222
|
+
const raw = handler.bracket.auto.rem(s);
|
|
454
223
|
if (raw)
|
|
455
224
|
return { "font-size": raw };
|
|
456
225
|
}],
|
|
@@ -460,17 +229,17 @@ const fonts = [
|
|
|
460
229
|
return { "font-weight": v };
|
|
461
230
|
}],
|
|
462
231
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
463
|
-
const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
|
|
232
|
+
const v = theme.lineHeight?.[s] || handler.bracket.auto.rem(s);
|
|
464
233
|
if (v !== null)
|
|
465
234
|
return { "line-height": v };
|
|
466
235
|
}],
|
|
467
236
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
468
|
-
const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
|
|
237
|
+
const v = theme.letterSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
469
238
|
if (v !== null)
|
|
470
239
|
return { "letter-spacing": v };
|
|
471
240
|
}],
|
|
472
241
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
473
|
-
const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
|
|
242
|
+
const v = theme.wordSpacing?.[s] || handler.bracket.auto.rem(s);
|
|
474
243
|
if (v !== null)
|
|
475
244
|
return { "word-spacing": v };
|
|
476
245
|
}]
|
|
@@ -490,7 +259,7 @@ const tabSizes = [
|
|
|
490
259
|
];
|
|
491
260
|
const textIndents = [
|
|
492
261
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
493
|
-
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);
|
|
494
263
|
if (v != null)
|
|
495
264
|
return { "text-indent": v };
|
|
496
265
|
}]
|
|
@@ -502,7 +271,7 @@ const textStrokes = [
|
|
|
502
271
|
return { "-webkit-text-stroke-width": v };
|
|
503
272
|
}],
|
|
504
273
|
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
505
|
-
[/^text-stroke-op(?:acity)?-?(.+)
|
|
274
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
506
275
|
];
|
|
507
276
|
const textShadows = [
|
|
508
277
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
@@ -513,36 +282,23 @@ const textShadows = [
|
|
|
513
282
|
];
|
|
514
283
|
|
|
515
284
|
const gaps = [
|
|
516
|
-
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
517
|
-
const v = handler.bracket.rem(s);
|
|
518
|
-
if (v != null) {
|
|
519
|
-
return {
|
|
520
|
-
"grid-gap": v,
|
|
521
|
-
"gap": v
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
}],
|
|
525
|
-
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
526
|
-
const v = handler.bracket.rem(s);
|
|
527
|
-
if (v != null) {
|
|
528
|
-
return {
|
|
529
|
-
"grid-column-gap": v,
|
|
530
|
-
"column-gap": v
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
}],
|
|
534
|
-
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
535
|
-
const v = handler.bracket.rem(s);
|
|
285
|
+
[/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
|
|
286
|
+
const v = handler.bracket.auto.rem(s);
|
|
536
287
|
if (v != null) {
|
|
288
|
+
const direction = {
|
|
289
|
+
"": "",
|
|
290
|
+
"x-": "column-",
|
|
291
|
+
"y-": "row-"
|
|
292
|
+
}[d];
|
|
537
293
|
return {
|
|
538
|
-
|
|
539
|
-
|
|
294
|
+
[`grid-${direction}gap`]: v,
|
|
295
|
+
[`${direction}gap`]: v
|
|
540
296
|
};
|
|
541
297
|
}
|
|
542
298
|
}]
|
|
543
299
|
];
|
|
544
300
|
|
|
545
|
-
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];
|
|
546
302
|
const autoDirection = (selector, theme) => {
|
|
547
303
|
if (selector === "min")
|
|
548
304
|
return "min-content";
|
|
@@ -555,10 +311,10 @@ const autoDirection = (selector, theme) => {
|
|
|
555
311
|
const grids = [
|
|
556
312
|
["grid", { display: "grid" }],
|
|
557
313
|
["inline-grid", { display: "inline-grid" }],
|
|
558
|
-
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start":
|
|
559
|
-
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end":
|
|
560
|
-
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start":
|
|
561
|
-
[/^(?: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 })],
|
|
562
318
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
563
319
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
564
320
|
let raw = handler.bracket(v);
|
|
@@ -570,16 +326,16 @@ const grids = [
|
|
|
570
326
|
if (parts[0] === "span") {
|
|
571
327
|
if (parts[1] === "full")
|
|
572
328
|
return { [key]: "1/-1" };
|
|
573
|
-
raw = handler.number.bracket(parts[1])
|
|
329
|
+
raw = handler.number.bracket(parts[1]);
|
|
574
330
|
if (raw)
|
|
575
331
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
576
332
|
}
|
|
577
333
|
}],
|
|
578
|
-
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns":
|
|
579
|
-
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow":
|
|
580
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows":
|
|
581
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,
|
|
582
|
-
[/^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))` })],
|
|
583
339
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
584
340
|
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
585
341
|
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
@@ -616,7 +372,10 @@ const justifies = [
|
|
|
616
372
|
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
617
373
|
];
|
|
618
374
|
const orders = [
|
|
619
|
-
[/^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" }]
|
|
620
379
|
];
|
|
621
380
|
const alignments = [
|
|
622
381
|
["content-start", { "align-content": "flex-start" }],
|
|
@@ -634,7 +393,7 @@ const alignments = [
|
|
|
634
393
|
["self-start", { "align-self": "flex-start" }],
|
|
635
394
|
["self-end", { "align-self": "flex-end" }],
|
|
636
395
|
["self-center", { "align-self": "center" }],
|
|
637
|
-
["self-stretch", { "align-
|
|
396
|
+
["self-stretch", { "align-self": "stretch" }]
|
|
638
397
|
];
|
|
639
398
|
const placements = [
|
|
640
399
|
["place-content-start", { "place-content": "start" }],
|
|
@@ -648,7 +407,7 @@ const placements = [
|
|
|
648
407
|
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
649
408
|
];
|
|
650
409
|
function handleInsetValue(v) {
|
|
651
|
-
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);
|
|
652
411
|
}
|
|
653
412
|
const insets = [
|
|
654
413
|
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
@@ -659,20 +418,95 @@ const insets = [
|
|
|
659
418
|
}]
|
|
660
419
|
];
|
|
661
420
|
const floats = [
|
|
662
|
-
[
|
|
663
|
-
[
|
|
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" }]
|
|
664
428
|
];
|
|
665
429
|
const zIndexes = [
|
|
666
430
|
["z-auto", { "z-index": "auto" }],
|
|
667
431
|
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": handler.number(v) })]
|
|
668
432
|
];
|
|
669
433
|
const boxSizing = [
|
|
670
|
-
[
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
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
|
+
}]
|
|
676
510
|
];
|
|
677
511
|
|
|
678
512
|
const rings = [
|
|
@@ -680,7 +514,7 @@ const rings = [
|
|
|
680
514
|
const value = handler.px(d || "1");
|
|
681
515
|
if (value) {
|
|
682
516
|
return {
|
|
683
|
-
"--un-ring-inset":
|
|
517
|
+
"--un-ring-inset": varEmpty,
|
|
684
518
|
"--un-ring-offset-width": "0px",
|
|
685
519
|
"--un-ring-offset-color": "#fff",
|
|
686
520
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
@@ -691,21 +525,21 @@ const rings = [
|
|
|
691
525
|
};
|
|
692
526
|
}
|
|
693
527
|
}],
|
|
694
|
-
[
|
|
528
|
+
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
529
|
+
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
695
530
|
const value = handler.px(d || "1");
|
|
696
|
-
if (value)
|
|
697
|
-
return {
|
|
698
|
-
"--un-ring-offset-width": value
|
|
699
|
-
};
|
|
700
|
-
}
|
|
531
|
+
if (value)
|
|
532
|
+
return { "--un-ring-offset-width": value };
|
|
701
533
|
}],
|
|
702
|
-
[
|
|
703
|
-
|
|
704
|
-
|
|
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" }]
|
|
705
539
|
];
|
|
706
540
|
|
|
707
541
|
const colorResolver = (body, theme) => {
|
|
708
|
-
const data =
|
|
542
|
+
const data = parseColor(body, theme);
|
|
709
543
|
if (!data)
|
|
710
544
|
return;
|
|
711
545
|
const { color, rgba } = data;
|
|
@@ -723,7 +557,7 @@ const colorResolver = (body, theme) => {
|
|
|
723
557
|
};
|
|
724
558
|
const boxShadows = [
|
|
725
559
|
[/^shadow-?(.*)$/, ([, d], { theme }) => {
|
|
726
|
-
const value = theme
|
|
560
|
+
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
727
561
|
if (value) {
|
|
728
562
|
return {
|
|
729
563
|
"--un-shadow-color": "0,0,0",
|
|
@@ -731,10 +565,8 @@ const boxShadows = [
|
|
|
731
565
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
732
566
|
};
|
|
733
567
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
return color;
|
|
737
|
-
}]
|
|
568
|
+
}],
|
|
569
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
738
570
|
];
|
|
739
571
|
|
|
740
572
|
function getPropName(minmax, hw) {
|
|
@@ -748,7 +580,7 @@ function getThemeValue(minmax, hw, theme, prop) {
|
|
|
748
580
|
}
|
|
749
581
|
const sizes = [
|
|
750
582
|
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
751
|
-
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);
|
|
752
584
|
if (v != null)
|
|
753
585
|
return { [getPropName(m, w)]: v };
|
|
754
586
|
}],
|
|
@@ -807,6 +639,8 @@ const transforms = [
|
|
|
807
639
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
808
640
|
[/^rotate-(.+)$/, handleRotate],
|
|
809
641
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
642
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
643
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
810
644
|
["transform-gpu", transformGpu],
|
|
811
645
|
["transform-cpu", transformCpu],
|
|
812
646
|
["transform-none", { transform: "none" }],
|
|
@@ -821,7 +655,7 @@ const transforms = [
|
|
|
821
655
|
["origin-top-left", { "transform-origin": "top left" }]
|
|
822
656
|
];
|
|
823
657
|
function handleTranslate([, d, b]) {
|
|
824
|
-
const v = handler.bracket.fraction.rem(b);
|
|
658
|
+
const v = handler.bracket.fraction.auto.rem(b);
|
|
825
659
|
if (v != null) {
|
|
826
660
|
return [
|
|
827
661
|
transformBase,
|
|
@@ -860,6 +694,24 @@ function handleRotate([, b]) {
|
|
|
860
694
|
];
|
|
861
695
|
}
|
|
862
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
|
+
}
|
|
863
715
|
|
|
864
716
|
const variablesAbbrMap = {
|
|
865
717
|
"visible": "visibility",
|
|
@@ -919,18 +771,10 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
919
771
|
const textDecorations = [
|
|
920
772
|
["underline", { "text-decoration": "underline" }],
|
|
921
773
|
["line-through", { "text-decoration": "line-through" }],
|
|
922
|
-
["no-underline", { "text-decoration": "none" }],
|
|
923
774
|
["decoration-underline", { "text-decoration": "underline" }],
|
|
924
775
|
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
925
|
-
[
|
|
926
|
-
[/^(?:underline|decoration)-(
|
|
927
|
-
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : handler.bracket.px(s) })],
|
|
928
|
-
[/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
|
|
929
|
-
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
930
|
-
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
931
|
-
if (v != null)
|
|
932
|
-
return { "text-underline-offset": v };
|
|
933
|
-
}],
|
|
776
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
777
|
+
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
934
778
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
935
779
|
const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
|
|
936
780
|
if (result) {
|
|
@@ -940,12 +784,16 @@ const textDecorations = [
|
|
|
940
784
|
};
|
|
941
785
|
}
|
|
942
786
|
}],
|
|
943
|
-
[/^(?: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" }]
|
|
944
792
|
];
|
|
945
793
|
|
|
946
794
|
const svgUtilities = [
|
|
947
795
|
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
948
|
-
[/^fill-op(?:acity)?-?(.+)
|
|
796
|
+
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
949
797
|
["fill-none", { fill: "none" }],
|
|
950
798
|
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
951
799
|
const v = handler.bracket.fraction.px.number(s);
|
|
@@ -953,7 +801,7 @@ const svgUtilities = [
|
|
|
953
801
|
return { "stroke-width": v };
|
|
954
802
|
}],
|
|
955
803
|
[/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
|
|
956
|
-
[/^stroke-op(?:acity)?-?(.+)
|
|
804
|
+
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
957
805
|
["stroke-none", { stroke: "none" }]
|
|
958
806
|
];
|
|
959
807
|
|
|
@@ -998,7 +846,6 @@ const rules = [
|
|
|
998
846
|
overflows,
|
|
999
847
|
outline,
|
|
1000
848
|
appearance,
|
|
1001
|
-
placeholder,
|
|
1002
849
|
positions,
|
|
1003
850
|
orders,
|
|
1004
851
|
justifies,
|
|
@@ -1014,4 +861,4 @@ const rules = [
|
|
|
1014
861
|
questionMark
|
|
1015
862
|
].flat(1);
|
|
1016
863
|
|
|
1017
|
-
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 };
|