@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.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const core = require('@unocss/core');
|
|
4
3
|
const utilities = require('./utilities.cjs');
|
|
4
|
+
const core = require('@unocss/core');
|
|
5
5
|
const pseudo = require('./pseudo.cjs');
|
|
6
6
|
|
|
7
7
|
const verticalAlignAlias = {
|
|
@@ -19,257 +19,13 @@ const textAligns = [
|
|
|
19
19
|
["text-justify", { "text-align": "justify" }]
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
-
const parseColorUtil = (body, theme) => {
|
|
23
|
-
const [main, opacity2] = body.split(/(?:\/|:)/);
|
|
24
|
-
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
25
|
-
const [name] = colors;
|
|
26
|
-
if (!name)
|
|
27
|
-
return;
|
|
28
|
-
let color;
|
|
29
|
-
const bracket = utilities.handler.bracket(main);
|
|
30
|
-
const bracketOrMain = bracket || main;
|
|
31
|
-
if (bracketOrMain.startsWith("#"))
|
|
32
|
-
color = bracketOrMain.slice(1);
|
|
33
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
34
|
-
color = bracketOrMain.slice(4);
|
|
35
|
-
color = color || bracket;
|
|
36
|
-
let no = "DEFAULT";
|
|
37
|
-
if (!color) {
|
|
38
|
-
let colorData = theme.colors?.[name];
|
|
39
|
-
if (colorData) {
|
|
40
|
-
[, no = no] = colors;
|
|
41
|
-
} else {
|
|
42
|
-
if (colors.slice(-1)[0].match(/^\d+$/))
|
|
43
|
-
no = colors.pop();
|
|
44
|
-
colorData = theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
|
|
45
|
-
}
|
|
46
|
-
if (typeof colorData === "string")
|
|
47
|
-
color = colorData;
|
|
48
|
-
else if (no && colorData)
|
|
49
|
-
color = colorData[no];
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
opacity: opacity2,
|
|
53
|
-
name,
|
|
54
|
-
no,
|
|
55
|
-
color,
|
|
56
|
-
rgba: core.hex2rgba(color)
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
60
|
-
const data = parseColorUtil(body, theme);
|
|
61
|
-
if (!data)
|
|
62
|
-
return;
|
|
63
|
-
const { opacity: opacity2, color, rgba } = data;
|
|
64
|
-
if (!color)
|
|
65
|
-
return;
|
|
66
|
-
const a = opacity2 ? opacity2[0] === "[" ? utilities.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
67
|
-
if (rgba) {
|
|
68
|
-
if (a != null && !Number.isNaN(a)) {
|
|
69
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
70
|
-
return {
|
|
71
|
-
[attribute]: `rgba(${rgba.join(",")})`
|
|
72
|
-
};
|
|
73
|
-
} else {
|
|
74
|
-
return {
|
|
75
|
-
[`--un-${varName}-opacity`]: 1,
|
|
76
|
-
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
return {
|
|
81
|
-
[attribute]: color.replace("%alpha", `${a || 1}`)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const opacity = [
|
|
86
|
-
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
|
|
87
|
-
];
|
|
88
|
-
const textColors = [
|
|
89
|
-
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
90
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
|
|
91
|
-
];
|
|
92
|
-
const bgColors = [
|
|
93
|
-
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
94
|
-
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
95
|
-
];
|
|
96
|
-
const borderColors = [
|
|
97
|
-
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
98
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
99
|
-
];
|
|
100
|
-
const ringColors = [
|
|
101
|
-
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
102
|
-
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
103
|
-
];
|
|
104
|
-
const ringOffsetColors = [
|
|
105
|
-
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
106
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
const cssBasicProps = [
|
|
110
|
-
"color",
|
|
111
|
-
"border-color",
|
|
112
|
-
"background-color",
|
|
113
|
-
"flex-grow",
|
|
114
|
-
"flex",
|
|
115
|
-
"flex-shrink",
|
|
116
|
-
"caret-color",
|
|
117
|
-
"font",
|
|
118
|
-
"gap",
|
|
119
|
-
"opacity",
|
|
120
|
-
"visibility",
|
|
121
|
-
"z-index",
|
|
122
|
-
"font-weight",
|
|
123
|
-
"zoom",
|
|
124
|
-
"text-shadow",
|
|
125
|
-
"transform",
|
|
126
|
-
"box-shadow"
|
|
127
|
-
];
|
|
128
|
-
const cssPositionProps = [
|
|
129
|
-
"backround-position",
|
|
130
|
-
"left",
|
|
131
|
-
"right",
|
|
132
|
-
"top",
|
|
133
|
-
"bottom",
|
|
134
|
-
"object-position"
|
|
135
|
-
];
|
|
136
|
-
const cssSizeProps = [
|
|
137
|
-
"max-height",
|
|
138
|
-
"min-height",
|
|
139
|
-
"max-width",
|
|
140
|
-
"min-width",
|
|
141
|
-
"height",
|
|
142
|
-
"width",
|
|
143
|
-
"border-width",
|
|
144
|
-
"margin",
|
|
145
|
-
"padding",
|
|
146
|
-
"outline-width",
|
|
147
|
-
"outline-offset",
|
|
148
|
-
"font-size",
|
|
149
|
-
"line-height",
|
|
150
|
-
"text-indent",
|
|
151
|
-
"vertical-align",
|
|
152
|
-
"border-spacing",
|
|
153
|
-
"letter-spacing",
|
|
154
|
-
"word-spacing"
|
|
155
|
-
];
|
|
156
|
-
const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
157
|
-
const cssProps = [
|
|
158
|
-
...cssBasicProps,
|
|
159
|
-
...cssPositionProps,
|
|
160
|
-
...cssSizeProps,
|
|
161
|
-
...cssEnhanceProps
|
|
162
|
-
];
|
|
163
|
-
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
164
|
-
const displays = [
|
|
165
|
-
["inline", { display: "inline" }],
|
|
166
|
-
["block", { display: "block" }],
|
|
167
|
-
["inline-block", { display: "inline-block" }],
|
|
168
|
-
["contents", { display: "contents" }],
|
|
169
|
-
["flow-root", { display: "flow-root" }],
|
|
170
|
-
["list-item", { display: "list-item" }],
|
|
171
|
-
["hidden", { display: "none" }]
|
|
172
|
-
];
|
|
173
|
-
const appearances = [
|
|
174
|
-
["visible", { visibility: "visible" }],
|
|
175
|
-
["invisible", { visibility: "hidden" }],
|
|
176
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
177
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
178
|
-
];
|
|
179
|
-
const cursors = [
|
|
180
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
181
|
-
];
|
|
182
|
-
const pointerEvents = [
|
|
183
|
-
["pointer-events-none", { "pointer-events": "none" }],
|
|
184
|
-
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
185
|
-
];
|
|
186
|
-
const resizes = [
|
|
187
|
-
["resize-none", { resize: "none" }],
|
|
188
|
-
["resize-x", { resize: "horizontal" }],
|
|
189
|
-
["resize-y", { resize: "vertical" }],
|
|
190
|
-
["resize", { resize: "both" }]
|
|
191
|
-
];
|
|
192
|
-
const userSelects = [
|
|
193
|
-
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
194
|
-
];
|
|
195
|
-
const whitespaces = [
|
|
196
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
197
|
-
];
|
|
198
|
-
const contents = [
|
|
199
|
-
["content-empty", { content: '""' }]
|
|
200
|
-
];
|
|
201
|
-
const breaks = [
|
|
202
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
203
|
-
["break-word", { "overflow-wrap": "break-word" }],
|
|
204
|
-
["break-all", { "word-break": "break-all" }]
|
|
205
|
-
];
|
|
206
|
-
const textOverflows = [
|
|
207
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
208
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
209
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
210
|
-
];
|
|
211
|
-
const textTransforms = [
|
|
212
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
213
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
214
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
215
|
-
["case-normal", { "text-transform": "none" }]
|
|
216
|
-
];
|
|
217
|
-
const fontStyles = [
|
|
218
|
-
["italic", { "font-style": "italic" }],
|
|
219
|
-
["not-italic", { "font-style": "normal" }]
|
|
220
|
-
];
|
|
221
|
-
const fontSmoothings = [
|
|
222
|
-
["antialiased", {
|
|
223
|
-
"-webkit-font-smoothing": "antialiased",
|
|
224
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
225
|
-
"font-smoothing": "grayscale"
|
|
226
|
-
}],
|
|
227
|
-
["subpixel-antialiased", {
|
|
228
|
-
"-webkit-font-smoothing": "auto",
|
|
229
|
-
"-moz-osx-font-smoothing": "auto",
|
|
230
|
-
"font-smoothing": "auto"
|
|
231
|
-
}]
|
|
232
|
-
];
|
|
233
|
-
|
|
234
|
-
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
235
|
-
const parseOutlineSize = (s) => {
|
|
236
|
-
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
237
|
-
const size = utilities.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
|
|
238
|
-
if (size) {
|
|
239
|
-
return {
|
|
240
|
-
[`outline-${propName}`]: size
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
22
|
const outline = [
|
|
245
|
-
[
|
|
23
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
24
|
+
[/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
|
|
25
|
+
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
246
26
|
["outline", { "outline-style": "solid" }],
|
|
247
|
-
[
|
|
248
|
-
|
|
249
|
-
(match, config) => {
|
|
250
|
-
const [, d] = match;
|
|
251
|
-
if (d === "none") {
|
|
252
|
-
return {
|
|
253
|
-
"outline": "2px solid transparent",
|
|
254
|
-
"outline-offset": "2px"
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
if (outlineStyle.includes(d)) {
|
|
258
|
-
return {
|
|
259
|
-
"outline-style": d
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
263
|
-
match[0],
|
|
264
|
-
match[1].replace(/^color-/, "")
|
|
265
|
-
], config);
|
|
266
|
-
if (colorSheet)
|
|
267
|
-
return colorSheet;
|
|
268
|
-
const sizeSheet = parseOutlineSize(d);
|
|
269
|
-
if (sizeSheet)
|
|
270
|
-
return sizeSheet;
|
|
271
|
-
}
|
|
272
|
-
]
|
|
27
|
+
[/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
28
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
273
29
|
];
|
|
274
30
|
const appearance = [
|
|
275
31
|
["appearance-none", {
|
|
@@ -277,33 +33,8 @@ const appearance = [
|
|
|
277
33
|
"-webkit-appearance": "none"
|
|
278
34
|
}]
|
|
279
35
|
];
|
|
280
|
-
const placeholder = [
|
|
281
|
-
[
|
|
282
|
-
/^placeholder-opacity-(\d+)$/,
|
|
283
|
-
([, d]) => ({
|
|
284
|
-
"placeholder-opacity": utilities.handler.bracket.percent(d)
|
|
285
|
-
})
|
|
286
|
-
],
|
|
287
|
-
[
|
|
288
|
-
/^placeholder-(?!opacity)(.+)$/,
|
|
289
|
-
(match, config) => {
|
|
290
|
-
match[1] = match[1].replace(/^color-/, "");
|
|
291
|
-
return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
];
|
|
295
|
-
const cssPropsStr = cssProps.join(", ");
|
|
296
|
-
const validateProperty$1 = (prop) => {
|
|
297
|
-
if (prop && !cssProps.includes(prop))
|
|
298
|
-
return;
|
|
299
|
-
return prop || cssPropsStr;
|
|
300
|
-
};
|
|
301
36
|
const willChange = [
|
|
302
|
-
[/^will-change-(
|
|
303
|
-
const w = validateProperty$1(p) || utilities.handler.global(p);
|
|
304
|
-
if (w)
|
|
305
|
-
return { "will-change": w };
|
|
306
|
-
}]
|
|
37
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
|
|
307
38
|
];
|
|
308
39
|
|
|
309
40
|
const borders = [
|
|
@@ -315,15 +46,58 @@ const borders = [
|
|
|
315
46
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
316
47
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
317
48
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
49
|
+
[/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
|
|
50
|
+
const v = utilities.handler.bracket.percent(opacity);
|
|
51
|
+
const d = utilities.directionMap[a];
|
|
52
|
+
if (v !== void 0 && d)
|
|
53
|
+
return d.map((i) => [`--un-border${i}-opacity`, v]);
|
|
54
|
+
}],
|
|
55
|
+
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
56
|
+
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
57
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
318
58
|
["border-solid", { "border-style": "solid" }],
|
|
319
59
|
["border-dashed", { "border-style": "dashed" }],
|
|
320
60
|
["border-dotted", { "border-style": "dotted" }],
|
|
321
61
|
["border-double", { "border-style": "double" }],
|
|
322
|
-
["border-none", { "border-style": "none" }]
|
|
323
|
-
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
324
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
325
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
62
|
+
["border-none", { "border-style": "none" }]
|
|
326
63
|
];
|
|
64
|
+
const borderHasColor = (color, { theme }) => {
|
|
65
|
+
return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
|
|
66
|
+
};
|
|
67
|
+
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
68
|
+
const data = utilities.parseColor(body, theme);
|
|
69
|
+
if (!data)
|
|
70
|
+
return;
|
|
71
|
+
const { opacity, color, rgba } = data;
|
|
72
|
+
if (!color)
|
|
73
|
+
return;
|
|
74
|
+
const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
75
|
+
if (rgba) {
|
|
76
|
+
if (a != null && !Number.isNaN(a)) {
|
|
77
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
78
|
+
return {
|
|
79
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
80
|
+
};
|
|
81
|
+
} else {
|
|
82
|
+
if (direction === "") {
|
|
83
|
+
return {
|
|
84
|
+
"--un-border-opacity": 1,
|
|
85
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
return {
|
|
89
|
+
"--un-border-opacity": 1,
|
|
90
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return {
|
|
97
|
+
[`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
327
101
|
function handlerBorder(m) {
|
|
328
102
|
const borderSizes = handlerBorderSize(m);
|
|
329
103
|
if (borderSizes) {
|
|
@@ -336,64 +110,59 @@ function handlerBorder(m) {
|
|
|
336
110
|
function handlerBorderSize([, a, b]) {
|
|
337
111
|
const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
|
|
338
112
|
const v = utilities.handler.bracket.px(s);
|
|
339
|
-
if (v
|
|
340
|
-
return [
|
|
341
|
-
...utilities.directionMap[d].map((i) => [`border${i}-width`, v])
|
|
342
|
-
];
|
|
343
|
-
}
|
|
113
|
+
if (v !== void 0)
|
|
114
|
+
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
344
115
|
}
|
|
345
116
|
function handlerBorderColor([, a, c], ctx) {
|
|
346
|
-
if (c
|
|
347
|
-
|
|
348
|
-
if (ofColor) {
|
|
349
|
-
const borders2 = utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
|
|
350
|
-
const borderObject = {};
|
|
351
|
-
Object.assign(borderObject, ...borders2);
|
|
352
|
-
return borderObject;
|
|
353
|
-
}
|
|
117
|
+
if (borderHasColor(c, ctx)) {
|
|
118
|
+
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
354
119
|
}
|
|
355
120
|
}
|
|
356
121
|
function handlerRounded([, a, b], { theme }) {
|
|
357
122
|
const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
|
|
358
|
-
const v = theme.borderRadius?.[s] || utilities.handler.
|
|
359
|
-
if (v
|
|
123
|
+
const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
|
|
124
|
+
if (v !== void 0)
|
|
360
125
|
return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
361
126
|
}
|
|
362
127
|
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
128
|
+
const opacity = [
|
|
129
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
|
|
130
|
+
];
|
|
131
|
+
const textColors = [
|
|
132
|
+
[/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text")],
|
|
133
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
|
|
134
|
+
];
|
|
135
|
+
const bgColors = [
|
|
136
|
+
[/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
|
|
137
|
+
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const transitionProperty = (prop) => {
|
|
141
|
+
return utilities.handler.properties(prop) || (prop === "all" ? prop : void 0);
|
|
369
142
|
};
|
|
370
143
|
const transitions = [
|
|
371
|
-
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
return
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
}],
|
|
381
|
-
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
382
|
-
return {
|
|
383
|
-
"transition-duration": `${duration}ms`
|
|
384
|
-
};
|
|
144
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
|
|
145
|
+
const p = transitionProperty(prop);
|
|
146
|
+
if (p) {
|
|
147
|
+
return {
|
|
148
|
+
"transition-property": p,
|
|
149
|
+
"transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
|
|
150
|
+
"transition-duration": `${duration}ms`
|
|
151
|
+
};
|
|
152
|
+
}
|
|
385
153
|
}],
|
|
154
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
|
|
386
155
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
156
|
+
["ease-linear", { "transition-timing-function": "linear" }],
|
|
387
157
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
388
158
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
389
159
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
390
160
|
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
391
161
|
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
392
|
-
[/^(?:transition-)?property-(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}]
|
|
162
|
+
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
163
|
+
["transition-property-none", { "transition-property": "none" }],
|
|
164
|
+
["property-none", { "transition-property": "none" }],
|
|
165
|
+
["transition-none", { transition: "none" }]
|
|
397
166
|
];
|
|
398
167
|
|
|
399
168
|
const flex = [
|
|
@@ -404,7 +173,7 @@ const flex = [
|
|
|
404
173
|
["flex-auto", { flex: "1 1 auto" }],
|
|
405
174
|
["flex-initial", { flex: "0 1 auto" }],
|
|
406
175
|
["flex-none", { flex: "none" }],
|
|
407
|
-
[/^flex
|
|
176
|
+
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
|
|
408
177
|
["flex-shrink", { "flex-shrink": 1 }],
|
|
409
178
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
410
179
|
["flex-grow", { "flex-grow": 1 }],
|
|
@@ -439,7 +208,7 @@ const fonts = [
|
|
|
439
208
|
}
|
|
440
209
|
}],
|
|
441
210
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
442
|
-
const size = utilities.handler.bracket.rem(s);
|
|
211
|
+
const size = utilities.handler.bracket.auto.rem(s);
|
|
443
212
|
if (size)
|
|
444
213
|
return { "font-size": size };
|
|
445
214
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
@@ -452,7 +221,7 @@ const fonts = [
|
|
|
452
221
|
}
|
|
453
222
|
}],
|
|
454
223
|
[/^text-size-(.+)$/, ([, s]) => {
|
|
455
|
-
const raw = utilities.handler.bracket.rem(s);
|
|
224
|
+
const raw = utilities.handler.bracket.auto.rem(s);
|
|
456
225
|
if (raw)
|
|
457
226
|
return { "font-size": raw };
|
|
458
227
|
}],
|
|
@@ -462,17 +231,17 @@ const fonts = [
|
|
|
462
231
|
return { "font-weight": v };
|
|
463
232
|
}],
|
|
464
233
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
465
|
-
const v = theme.lineHeight?.[s] || utilities.handler.bracket.rem(s);
|
|
234
|
+
const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
466
235
|
if (v !== null)
|
|
467
236
|
return { "line-height": v };
|
|
468
237
|
}],
|
|
469
238
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
470
|
-
const v = theme.letterSpacing?.[s] || utilities.handler.bracket.rem(s);
|
|
239
|
+
const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
471
240
|
if (v !== null)
|
|
472
241
|
return { "letter-spacing": v };
|
|
473
242
|
}],
|
|
474
243
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
475
|
-
const v = theme.wordSpacing?.[s] || utilities.handler.bracket.rem(s);
|
|
244
|
+
const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
476
245
|
if (v !== null)
|
|
477
246
|
return { "word-spacing": v };
|
|
478
247
|
}]
|
|
@@ -492,7 +261,7 @@ const tabSizes = [
|
|
|
492
261
|
];
|
|
493
262
|
const textIndents = [
|
|
494
263
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
495
|
-
const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s);
|
|
264
|
+
const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
|
|
496
265
|
if (v != null)
|
|
497
266
|
return { "text-indent": v };
|
|
498
267
|
}]
|
|
@@ -503,8 +272,8 @@ const textStrokes = [
|
|
|
503
272
|
if (v != null)
|
|
504
273
|
return { "-webkit-text-stroke-width": v };
|
|
505
274
|
}],
|
|
506
|
-
[/^text-stroke-(.+)$/, colorResolver
|
|
507
|
-
[/^text-stroke-op(?:acity)?-?(.+)
|
|
275
|
+
[/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
|
|
276
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
508
277
|
];
|
|
509
278
|
const textShadows = [
|
|
510
279
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
@@ -515,36 +284,23 @@ const textShadows = [
|
|
|
515
284
|
];
|
|
516
285
|
|
|
517
286
|
const gaps = [
|
|
518
|
-
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
519
|
-
const v = utilities.handler.bracket.rem(s);
|
|
287
|
+
[/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
|
|
288
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
520
289
|
if (v != null) {
|
|
290
|
+
const direction = {
|
|
291
|
+
"": "",
|
|
292
|
+
"x-": "column-",
|
|
293
|
+
"y-": "row-"
|
|
294
|
+
}[d];
|
|
521
295
|
return {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
}],
|
|
527
|
-
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
528
|
-
const v = utilities.handler.bracket.rem(s);
|
|
529
|
-
if (v != null) {
|
|
530
|
-
return {
|
|
531
|
-
"grid-column-gap": v,
|
|
532
|
-
"column-gap": v
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
}],
|
|
536
|
-
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
537
|
-
const v = utilities.handler.bracket.rem(s);
|
|
538
|
-
if (v != null) {
|
|
539
|
-
return {
|
|
540
|
-
"grid-row-gap": v,
|
|
541
|
-
"row-gap": v
|
|
296
|
+
[`grid-${direction}gap`]: v,
|
|
297
|
+
[`${direction}gap`]: v
|
|
542
298
|
};
|
|
543
299
|
}
|
|
544
300
|
}]
|
|
545
301
|
];
|
|
546
302
|
|
|
547
|
-
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.rem(s))[0];
|
|
303
|
+
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
|
|
548
304
|
const autoDirection = (selector, theme) => {
|
|
549
305
|
if (selector === "min")
|
|
550
306
|
return "min-content";
|
|
@@ -557,10 +313,10 @@ const autoDirection = (selector, theme) => {
|
|
|
557
313
|
const grids = [
|
|
558
314
|
["grid", { display: "grid" }],
|
|
559
315
|
["inline-grid", { display: "inline-grid" }],
|
|
560
|
-
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start":
|
|
561
|
-
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end":
|
|
562
|
-
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start":
|
|
563
|
-
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end":
|
|
316
|
+
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
|
|
317
|
+
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
|
|
318
|
+
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
|
|
319
|
+
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
|
|
564
320
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
565
321
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
566
322
|
let raw = utilities.handler.bracket(v);
|
|
@@ -572,16 +328,16 @@ const grids = [
|
|
|
572
328
|
if (parts[0] === "span") {
|
|
573
329
|
if (parts[1] === "full")
|
|
574
330
|
return { [key]: "1/-1" };
|
|
575
|
-
raw = utilities.handler.number.bracket(parts[1])
|
|
331
|
+
raw = utilities.handler.number.bracket(parts[1]);
|
|
576
332
|
if (raw)
|
|
577
333
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
578
334
|
}
|
|
579
335
|
}],
|
|
580
|
-
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns":
|
|
581
|
-
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow":
|
|
582
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows":
|
|
583
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,
|
|
584
|
-
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,
|
|
336
|
+
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
|
|
337
|
+
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
|
|
338
|
+
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
|
|
339
|
+
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
340
|
+
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
585
341
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
586
342
|
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
587
343
|
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
@@ -618,7 +374,10 @@ const justifies = [
|
|
|
618
374
|
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
619
375
|
];
|
|
620
376
|
const orders = [
|
|
621
|
-
[/^order-(.+)$/, ([, v]) => ({ order:
|
|
377
|
+
[/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
|
|
378
|
+
["order-first", { order: "-9999" }],
|
|
379
|
+
["order-last", { order: "9999" }],
|
|
380
|
+
["order-none", { order: "0" }]
|
|
622
381
|
];
|
|
623
382
|
const alignments = [
|
|
624
383
|
["content-start", { "align-content": "flex-start" }],
|
|
@@ -636,7 +395,7 @@ const alignments = [
|
|
|
636
395
|
["self-start", { "align-self": "flex-start" }],
|
|
637
396
|
["self-end", { "align-self": "flex-end" }],
|
|
638
397
|
["self-center", { "align-self": "center" }],
|
|
639
|
-
["self-stretch", { "align-
|
|
398
|
+
["self-stretch", { "align-self": "stretch" }]
|
|
640
399
|
];
|
|
641
400
|
const placements = [
|
|
642
401
|
["place-content-start", { "place-content": "start" }],
|
|
@@ -650,7 +409,7 @@ const placements = [
|
|
|
650
409
|
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
651
410
|
];
|
|
652
411
|
function handleInsetValue(v) {
|
|
653
|
-
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.rem(v);
|
|
412
|
+
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
654
413
|
}
|
|
655
414
|
const insets = [
|
|
656
415
|
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
@@ -661,20 +420,95 @@ const insets = [
|
|
|
661
420
|
}]
|
|
662
421
|
];
|
|
663
422
|
const floats = [
|
|
664
|
-
[
|
|
665
|
-
[
|
|
423
|
+
["float-left", { float: "left" }],
|
|
424
|
+
["float-right", { float: "right" }],
|
|
425
|
+
["float-none", { float: "none" }],
|
|
426
|
+
["clear-left", { clear: "left" }],
|
|
427
|
+
["clear-right", { clear: "right" }],
|
|
428
|
+
["clear-both", { clear: "both" }],
|
|
429
|
+
["clear-none", { clear: "none" }]
|
|
666
430
|
];
|
|
667
431
|
const zIndexes = [
|
|
668
432
|
["z-auto", { "z-index": "auto" }],
|
|
669
433
|
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
|
|
670
434
|
];
|
|
671
435
|
const boxSizing = [
|
|
672
|
-
[
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
436
|
+
["box-border", { "box-sizing": "border-box" }],
|
|
437
|
+
["box-content", { "box-sizing": "content-box" }]
|
|
438
|
+
];
|
|
439
|
+
|
|
440
|
+
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
441
|
+
const displays = [
|
|
442
|
+
["inline", { display: "inline" }],
|
|
443
|
+
["block", { display: "block" }],
|
|
444
|
+
["inline-block", { display: "inline-block" }],
|
|
445
|
+
["contents", { display: "contents" }],
|
|
446
|
+
["flow-root", { display: "flow-root" }],
|
|
447
|
+
["list-item", { display: "list-item" }],
|
|
448
|
+
["hidden", { display: "none" }]
|
|
449
|
+
];
|
|
450
|
+
const appearances = [
|
|
451
|
+
["visible", { visibility: "visible" }],
|
|
452
|
+
["invisible", { visibility: "hidden" }],
|
|
453
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
454
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
455
|
+
];
|
|
456
|
+
const cursors = [
|
|
457
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
458
|
+
];
|
|
459
|
+
const pointerEvents = [
|
|
460
|
+
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
461
|
+
["pointer-events-none", { "pointer-events": "none" }]
|
|
462
|
+
];
|
|
463
|
+
const resizes = [
|
|
464
|
+
["resize-x", { resize: "horizontal" }],
|
|
465
|
+
["resize-y", { resize: "vertical" }],
|
|
466
|
+
["resize", { resize: "both" }],
|
|
467
|
+
["resize-none", { resize: "none" }]
|
|
468
|
+
];
|
|
469
|
+
const userSelects = [
|
|
470
|
+
["select-auto", { "user-select": "auto" }],
|
|
471
|
+
["select-all", { "user-select": "all" }],
|
|
472
|
+
["select-text", { "user-select": "text" }],
|
|
473
|
+
["select-none", { "user-select": "none" }]
|
|
474
|
+
];
|
|
475
|
+
const whitespaces = [
|
|
476
|
+
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
477
|
+
];
|
|
478
|
+
const contents = [
|
|
479
|
+
["content-empty", { content: '""' }]
|
|
480
|
+
];
|
|
481
|
+
const breaks = [
|
|
482
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
483
|
+
["break-word", { "overflow-wrap": "break-word" }],
|
|
484
|
+
["break-all", { "word-break": "break-all" }]
|
|
485
|
+
];
|
|
486
|
+
const textOverflows = [
|
|
487
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
488
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
489
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
490
|
+
];
|
|
491
|
+
const textTransforms = [
|
|
492
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
493
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
494
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
495
|
+
["case-normal", { "text-transform": "none" }]
|
|
496
|
+
];
|
|
497
|
+
const fontStyles = [
|
|
498
|
+
["italic", { "font-style": "italic" }],
|
|
499
|
+
["not-italic", { "font-style": "normal" }]
|
|
500
|
+
];
|
|
501
|
+
const fontSmoothings = [
|
|
502
|
+
["antialiased", {
|
|
503
|
+
"-webkit-font-smoothing": "antialiased",
|
|
504
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
505
|
+
"font-smoothing": "grayscale"
|
|
506
|
+
}],
|
|
507
|
+
["subpixel-antialiased", {
|
|
508
|
+
"-webkit-font-smoothing": "auto",
|
|
509
|
+
"-moz-osx-font-smoothing": "auto",
|
|
510
|
+
"font-smoothing": "auto"
|
|
511
|
+
}]
|
|
678
512
|
];
|
|
679
513
|
|
|
680
514
|
const rings = [
|
|
@@ -682,7 +516,7 @@ const rings = [
|
|
|
682
516
|
const value = utilities.handler.px(d || "1");
|
|
683
517
|
if (value) {
|
|
684
518
|
return {
|
|
685
|
-
"--un-ring-inset":
|
|
519
|
+
"--un-ring-inset": varEmpty,
|
|
686
520
|
"--un-ring-offset-width": "0px",
|
|
687
521
|
"--un-ring-offset-color": "#fff",
|
|
688
522
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
@@ -693,21 +527,21 @@ const rings = [
|
|
|
693
527
|
};
|
|
694
528
|
}
|
|
695
529
|
}],
|
|
696
|
-
[
|
|
530
|
+
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
531
|
+
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
697
532
|
const value = utilities.handler.px(d || "1");
|
|
698
|
-
if (value)
|
|
699
|
-
return {
|
|
700
|
-
"--un-ring-offset-width": value
|
|
701
|
-
};
|
|
702
|
-
}
|
|
533
|
+
if (value)
|
|
534
|
+
return { "--un-ring-offset-width": value };
|
|
703
535
|
}],
|
|
704
|
-
[
|
|
705
|
-
|
|
706
|
-
|
|
536
|
+
[/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
|
|
537
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
538
|
+
[/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
539
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
540
|
+
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
707
541
|
];
|
|
708
542
|
|
|
709
543
|
const colorResolver = (body, theme) => {
|
|
710
|
-
const data =
|
|
544
|
+
const data = utilities.parseColor(body, theme);
|
|
711
545
|
if (!data)
|
|
712
546
|
return;
|
|
713
547
|
const { color, rgba } = data;
|
|
@@ -725,7 +559,7 @@ const colorResolver = (body, theme) => {
|
|
|
725
559
|
};
|
|
726
560
|
const boxShadows = [
|
|
727
561
|
[/^shadow-?(.*)$/, ([, d], { theme }) => {
|
|
728
|
-
const value = theme
|
|
562
|
+
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
729
563
|
if (value) {
|
|
730
564
|
return {
|
|
731
565
|
"--un-shadow-color": "0,0,0",
|
|
@@ -733,10 +567,8 @@ const boxShadows = [
|
|
|
733
567
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
734
568
|
};
|
|
735
569
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
return color;
|
|
739
|
-
}]
|
|
570
|
+
}],
|
|
571
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
740
572
|
];
|
|
741
573
|
|
|
742
574
|
function getPropName(minmax, hw) {
|
|
@@ -750,7 +582,7 @@ function getThemeValue(minmax, hw, theme, prop) {
|
|
|
750
582
|
}
|
|
751
583
|
const sizes = [
|
|
752
584
|
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
753
|
-
const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.rem(s);
|
|
585
|
+
const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
|
|
754
586
|
if (v != null)
|
|
755
587
|
return { [getPropName(m, w)]: v };
|
|
756
588
|
}],
|
|
@@ -809,6 +641,8 @@ const transforms = [
|
|
|
809
641
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
810
642
|
[/^rotate-(.+)$/, handleRotate],
|
|
811
643
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
644
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
645
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
812
646
|
["transform-gpu", transformGpu],
|
|
813
647
|
["transform-cpu", transformCpu],
|
|
814
648
|
["transform-none", { transform: "none" }],
|
|
@@ -823,7 +657,7 @@ const transforms = [
|
|
|
823
657
|
["origin-top-left", { "transform-origin": "top left" }]
|
|
824
658
|
];
|
|
825
659
|
function handleTranslate([, d, b]) {
|
|
826
|
-
const v = utilities.handler.bracket.fraction.rem(b);
|
|
660
|
+
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
|
827
661
|
if (v != null) {
|
|
828
662
|
return [
|
|
829
663
|
transformBase,
|
|
@@ -862,6 +696,24 @@ function handleRotate([, b]) {
|
|
|
862
696
|
];
|
|
863
697
|
}
|
|
864
698
|
}
|
|
699
|
+
function handleSkewWithUnit([, d, b]) {
|
|
700
|
+
const v = utilities.handler.bracket.number(b);
|
|
701
|
+
if (v != null) {
|
|
702
|
+
return [
|
|
703
|
+
transformBase,
|
|
704
|
+
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
705
|
+
];
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
function handleSkew([, d, b]) {
|
|
709
|
+
const v = utilities.handler.bracket(b);
|
|
710
|
+
if (v != null) {
|
|
711
|
+
return [
|
|
712
|
+
transformBase,
|
|
713
|
+
{ [`--un-skew-${d}`]: v }
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
}
|
|
865
717
|
|
|
866
718
|
const variablesAbbrMap = {
|
|
867
719
|
"visible": "visibility",
|
|
@@ -921,20 +773,12 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
921
773
|
const textDecorations = [
|
|
922
774
|
["underline", { "text-decoration": "underline" }],
|
|
923
775
|
["line-through", { "text-decoration": "line-through" }],
|
|
924
|
-
["no-underline", { "text-decoration": "none" }],
|
|
925
776
|
["decoration-underline", { "text-decoration": "underline" }],
|
|
926
777
|
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
927
|
-
[
|
|
928
|
-
[/^(?:underline|decoration)-(
|
|
929
|
-
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : utilities.handler.bracket.px(s) })],
|
|
930
|
-
[/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(d) })],
|
|
931
|
-
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
932
|
-
const v = s === "auto" ? s : utilities.handler.bracket.px(s);
|
|
933
|
-
if (v != null)
|
|
934
|
-
return { "text-underline-offset": v };
|
|
935
|
-
}],
|
|
778
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
|
|
779
|
+
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
936
780
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
937
|
-
const result = colorResolver
|
|
781
|
+
const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
|
|
938
782
|
if (result) {
|
|
939
783
|
return {
|
|
940
784
|
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
@@ -942,20 +786,24 @@ const textDecorations = [
|
|
|
942
786
|
};
|
|
943
787
|
}
|
|
944
788
|
}],
|
|
945
|
-
[/^(?:underline|decoration)-op(?:acity)?-?(.+)
|
|
789
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
790
|
+
[/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.px(s) })],
|
|
791
|
+
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
792
|
+
["no-underline", { "text-decoration": "none" }],
|
|
793
|
+
["decoration-none", { "text-decoration": "none" }]
|
|
946
794
|
];
|
|
947
795
|
|
|
948
796
|
const svgUtilities = [
|
|
949
|
-
[/^fill-(.+)$/, colorResolver
|
|
950
|
-
[/^fill-op(?:acity)?-?(.+)
|
|
797
|
+
[/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
|
|
798
|
+
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
951
799
|
["fill-none", { fill: "none" }],
|
|
952
800
|
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
953
801
|
const v = utilities.handler.bracket.fraction.px.number(s);
|
|
954
802
|
if (v)
|
|
955
803
|
return { "stroke-width": v };
|
|
956
804
|
}],
|
|
957
|
-
[/^stroke-(.+)$/, colorResolver
|
|
958
|
-
[/^stroke-op(?:acity)?-?(.+)
|
|
805
|
+
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
806
|
+
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
959
807
|
["stroke-none", { stroke: "none" }]
|
|
960
808
|
];
|
|
961
809
|
|
|
@@ -1000,7 +848,6 @@ const rules = [
|
|
|
1000
848
|
overflows,
|
|
1001
849
|
outline,
|
|
1002
850
|
appearance,
|
|
1003
|
-
placeholder,
|
|
1004
851
|
positions,
|
|
1005
852
|
orders,
|
|
1006
853
|
justifies,
|
|
@@ -1021,14 +868,11 @@ exports.appearance = appearance;
|
|
|
1021
868
|
exports.appearances = appearances;
|
|
1022
869
|
exports.aspectRatio = aspectRatio;
|
|
1023
870
|
exports.bgColors = bgColors;
|
|
1024
|
-
exports.borderColors = borderColors;
|
|
1025
871
|
exports.borders = borders;
|
|
1026
872
|
exports.boxShadows = boxShadows;
|
|
1027
873
|
exports.boxSizing = boxSizing;
|
|
1028
874
|
exports.breaks = breaks;
|
|
1029
|
-
exports.colorResolver = colorResolver$1;
|
|
1030
875
|
exports.contents = contents;
|
|
1031
|
-
exports.cssProps = cssProps;
|
|
1032
876
|
exports.cssVariables = cssVariables;
|
|
1033
877
|
exports.cursors = cursors;
|
|
1034
878
|
exports.displays = displays;
|
|
@@ -1047,15 +891,11 @@ exports.orders = orders;
|
|
|
1047
891
|
exports.outline = outline;
|
|
1048
892
|
exports.overflows = overflows;
|
|
1049
893
|
exports.paddings = paddings;
|
|
1050
|
-
exports.parseColorUtil = parseColorUtil;
|
|
1051
|
-
exports.placeholder = placeholder;
|
|
1052
894
|
exports.placements = placements;
|
|
1053
895
|
exports.pointerEvents = pointerEvents;
|
|
1054
896
|
exports.positions = positions;
|
|
1055
897
|
exports.questionMark = questionMark;
|
|
1056
898
|
exports.resizes = resizes;
|
|
1057
|
-
exports.ringColors = ringColors;
|
|
1058
|
-
exports.ringOffsetColors = ringOffsetColors;
|
|
1059
899
|
exports.rings = rings;
|
|
1060
900
|
exports.rules = rules;
|
|
1061
901
|
exports.sizes = sizes;
|