@unocss/preset-mini 0.16.0 → 0.16.4
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 +291 -225
- package/dist/chunks/default2.mjs +234 -170
- package/dist/chunks/default3.cjs +16 -11
- package/dist/chunks/default3.mjs +16 -11
- package/dist/chunks/pseudo.cjs +36 -30
- package/dist/chunks/pseudo.mjs +36 -30
- package/dist/chunks/{index.cjs → utilities.cjs} +19 -2
- package/dist/chunks/{index.mjs → utilities.mjs} +19 -3
- package/dist/chunks/variants.cjs +8 -6
- package/dist/chunks/variants.mjs +8 -6
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rules.cjs +4 -2
- package/dist/rules.d.ts +5 -2
- package/dist/rules.mjs +2 -2
- package/dist/utils.cjs +9 -8
- package/dist/utils.d.ts +8 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +2 -2
- package/dist/variants.d.ts +3 -3
- 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
3
|
const core = require('@unocss/core');
|
|
4
|
-
const
|
|
4
|
+
const utilities = require('./utilities.cjs');
|
|
5
5
|
const pseudo = require('./pseudo.cjs');
|
|
6
6
|
|
|
7
7
|
const verticalAlignAlias = {
|
|
@@ -21,19 +21,28 @@ const textAligns = [
|
|
|
21
21
|
|
|
22
22
|
const parseColorUtil = (body, theme) => {
|
|
23
23
|
const [main, opacity2] = body.split(/(?:\/|:)/);
|
|
24
|
-
const
|
|
24
|
+
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
25
|
+
const [name] = colors;
|
|
25
26
|
if (!name)
|
|
26
27
|
return;
|
|
27
28
|
let color;
|
|
28
|
-
const bracket =
|
|
29
|
+
const bracket = utilities.handler.bracket(main);
|
|
29
30
|
const bracketOrMain = bracket || main;
|
|
30
31
|
if (bracketOrMain.startsWith("#"))
|
|
31
32
|
color = bracketOrMain.slice(1);
|
|
32
33
|
if (bracketOrMain.startsWith("hex-"))
|
|
33
34
|
color = bracketOrMain.slice(4);
|
|
34
35
|
color = color || bracket;
|
|
36
|
+
let no = "DEFAULT";
|
|
35
37
|
if (!color) {
|
|
36
|
-
|
|
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
|
+
}
|
|
37
46
|
if (typeof colorData === "string")
|
|
38
47
|
color = colorData;
|
|
39
48
|
else if (no && colorData)
|
|
@@ -54,7 +63,7 @@ const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
|
54
63
|
const { opacity: opacity2, color, rgba } = data;
|
|
55
64
|
if (!color)
|
|
56
65
|
return;
|
|
57
|
-
const a = opacity2 ? opacity2[0] === "[" ?
|
|
66
|
+
const a = opacity2 ? opacity2[0] === "[" ? utilities.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
58
67
|
if (rgba) {
|
|
59
68
|
if (a != null && !Number.isNaN(a)) {
|
|
60
69
|
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
@@ -74,38 +83,158 @@ const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
|
74
83
|
}
|
|
75
84
|
};
|
|
76
85
|
const opacity = [
|
|
77
|
-
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity:
|
|
86
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
|
|
78
87
|
];
|
|
79
88
|
const textColors = [
|
|
80
89
|
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
81
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity":
|
|
90
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
|
|
82
91
|
];
|
|
83
92
|
const bgColors = [
|
|
84
93
|
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
85
|
-
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity":
|
|
94
|
+
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
86
95
|
];
|
|
87
96
|
const borderColors = [
|
|
88
97
|
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
89
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity":
|
|
98
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
90
99
|
];
|
|
91
100
|
const ringColors = [
|
|
92
101
|
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
93
|
-
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity":
|
|
102
|
+
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
94
103
|
];
|
|
95
104
|
const ringOffsetColors = [
|
|
96
105
|
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
97
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity":
|
|
106
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
98
107
|
];
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
}]
|
|
103
232
|
];
|
|
104
233
|
|
|
105
234
|
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
106
235
|
const parseOutlineSize = (s) => {
|
|
107
236
|
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
108
|
-
const size =
|
|
237
|
+
const size = utilities.handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
|
|
109
238
|
if (size) {
|
|
110
239
|
return {
|
|
111
240
|
[`outline-${propName}`]: size
|
|
@@ -130,15 +259,15 @@ const outline = [
|
|
|
130
259
|
"outline-style": d
|
|
131
260
|
};
|
|
132
261
|
}
|
|
133
|
-
const sizeSheet = parseOutlineSize(d);
|
|
134
|
-
if (sizeSheet)
|
|
135
|
-
return sizeSheet;
|
|
136
262
|
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
137
263
|
match[0],
|
|
138
264
|
match[1].replace(/^color-/, "")
|
|
139
265
|
], config);
|
|
140
266
|
if (colorSheet)
|
|
141
267
|
return colorSheet;
|
|
268
|
+
const sizeSheet = parseOutlineSize(d);
|
|
269
|
+
if (sizeSheet)
|
|
270
|
+
return sizeSheet;
|
|
142
271
|
}
|
|
143
272
|
]
|
|
144
273
|
];
|
|
@@ -152,7 +281,7 @@ const placeholder = [
|
|
|
152
281
|
[
|
|
153
282
|
/^placeholder-opacity-(\d+)$/,
|
|
154
283
|
([, d]) => ({
|
|
155
|
-
"placeholder-opacity":
|
|
284
|
+
"placeholder-opacity": utilities.handler.bracket.percent(d)
|
|
156
285
|
})
|
|
157
286
|
],
|
|
158
287
|
[
|
|
@@ -163,11 +292,29 @@ const placeholder = [
|
|
|
163
292
|
}
|
|
164
293
|
]
|
|
165
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
|
+
const willChange = [
|
|
302
|
+
[/^will-change-(.*)/, ([, p]) => {
|
|
303
|
+
const w = validateProperty$1(p) || utilities.handler.global(p);
|
|
304
|
+
if (w)
|
|
305
|
+
return { "will-change": w };
|
|
306
|
+
}]
|
|
307
|
+
];
|
|
166
308
|
|
|
167
309
|
const borders = [
|
|
168
310
|
[/^border$/, handlerBorder],
|
|
169
|
-
[/^(?:border|b)(
|
|
170
|
-
[/^(?:border|b)(
|
|
311
|
+
[/^(?:border|b)()-(.+)$/, handlerBorder],
|
|
312
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
|
|
313
|
+
[/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
|
|
314
|
+
[/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
|
|
315
|
+
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
316
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
317
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
171
318
|
["border-solid", { "border-style": "solid" }],
|
|
172
319
|
["border-dashed", { "border-style": "dashed" }],
|
|
173
320
|
["border-dotted", { "border-style": "dotted" }],
|
|
@@ -175,85 +322,48 @@ const borders = [
|
|
|
175
322
|
["border-none", { "border-style": "none" }],
|
|
176
323
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
177
324
|
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
178
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
179
|
-
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
180
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity) })]
|
|
325
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
181
326
|
];
|
|
182
|
-
function handlerBorder(
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
if (v != null) {
|
|
327
|
+
function handlerBorder(m) {
|
|
328
|
+
const borderSizes = handlerBorderSize(m);
|
|
329
|
+
if (borderSizes) {
|
|
186
330
|
return [
|
|
187
|
-
...
|
|
331
|
+
...borderSizes,
|
|
188
332
|
["border-style", "solid"]
|
|
189
333
|
];
|
|
190
334
|
}
|
|
191
335
|
}
|
|
336
|
+
function handlerBorderSize([, a, b]) {
|
|
337
|
+
const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
|
|
338
|
+
const v = utilities.handler.bracket.px(s);
|
|
339
|
+
if (v != null) {
|
|
340
|
+
return [
|
|
341
|
+
...utilities.directionMap[d].map((i) => [`border${i}-width`, v])
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function handlerBorderColor([, a, c], ctx) {
|
|
346
|
+
if (c !== void 0) {
|
|
347
|
+
const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
|
|
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
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
192
356
|
function handlerRounded([, a, b], { theme }) {
|
|
193
|
-
const [d, s = "DEFAULT"] =
|
|
194
|
-
const v = theme.borderRadius?.[s] ||
|
|
357
|
+
const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
|
|
358
|
+
const v = theme.borderRadius?.[s] || utilities.handler.bracket.fraction.rem(s);
|
|
195
359
|
if (v != null)
|
|
196
|
-
return
|
|
360
|
+
return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
197
361
|
}
|
|
198
362
|
|
|
199
|
-
const transitionBasicProps = [
|
|
200
|
-
"color",
|
|
201
|
-
"border-color",
|
|
202
|
-
"background-color",
|
|
203
|
-
"flex-grow",
|
|
204
|
-
"flex",
|
|
205
|
-
"flex-shrink",
|
|
206
|
-
"caret-color",
|
|
207
|
-
"font",
|
|
208
|
-
"gap",
|
|
209
|
-
"opacity",
|
|
210
|
-
"visibility",
|
|
211
|
-
"z-index",
|
|
212
|
-
"font-weight",
|
|
213
|
-
"zoom",
|
|
214
|
-
"text-shadow",
|
|
215
|
-
"transform",
|
|
216
|
-
"box-shadow"
|
|
217
|
-
];
|
|
218
|
-
const transitionPositionProps = [
|
|
219
|
-
"backround-position",
|
|
220
|
-
"left",
|
|
221
|
-
"right",
|
|
222
|
-
"top",
|
|
223
|
-
"bottom",
|
|
224
|
-
"object-position"
|
|
225
|
-
];
|
|
226
|
-
const transitionSizeProps = [
|
|
227
|
-
"max-height",
|
|
228
|
-
"min-height",
|
|
229
|
-
"max-width",
|
|
230
|
-
"min-width",
|
|
231
|
-
"height",
|
|
232
|
-
"width",
|
|
233
|
-
"border-width",
|
|
234
|
-
"margin",
|
|
235
|
-
"padding",
|
|
236
|
-
"outline-width",
|
|
237
|
-
"outline-offset",
|
|
238
|
-
"font-size",
|
|
239
|
-
"line-height",
|
|
240
|
-
"text-indent",
|
|
241
|
-
"vertical-align",
|
|
242
|
-
"border-spacing",
|
|
243
|
-
"letter-spacing",
|
|
244
|
-
"word-spacing"
|
|
245
|
-
];
|
|
246
363
|
const transitionSwitchProps = ["all", "none"];
|
|
247
|
-
const
|
|
248
|
-
const transitionProps = [
|
|
249
|
-
...transitionBasicProps,
|
|
250
|
-
...transitionPositionProps,
|
|
251
|
-
...transitionSizeProps,
|
|
252
|
-
...transitionEnhanceProps
|
|
253
|
-
];
|
|
254
|
-
const transitionPropsStr = transitionProps.join(", ");
|
|
364
|
+
const transitionPropsStr = cssProps.join(", ");
|
|
255
365
|
const validateProperty = (prop) => {
|
|
256
|
-
if (prop && ![...
|
|
366
|
+
if (prop && ![...cssProps, ...transitionSwitchProps].includes(prop))
|
|
257
367
|
return;
|
|
258
368
|
return prop || transitionPropsStr;
|
|
259
369
|
};
|
|
@@ -329,7 +439,7 @@ const fonts = [
|
|
|
329
439
|
}
|
|
330
440
|
}],
|
|
331
441
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
332
|
-
const size =
|
|
442
|
+
const size = utilities.handler.bracket.rem(s);
|
|
333
443
|
if (size)
|
|
334
444
|
return { "font-size": size };
|
|
335
445
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
@@ -342,27 +452,27 @@ const fonts = [
|
|
|
342
452
|
}
|
|
343
453
|
}],
|
|
344
454
|
[/^text-size-(.+)$/, ([, s]) => {
|
|
345
|
-
const raw =
|
|
455
|
+
const raw = utilities.handler.bracket.rem(s);
|
|
346
456
|
if (raw)
|
|
347
457
|
return { "font-size": raw };
|
|
348
458
|
}],
|
|
349
459
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
350
|
-
const v = weightMap[s] ||
|
|
460
|
+
const v = weightMap[s] || utilities.handler.number(s);
|
|
351
461
|
if (v)
|
|
352
462
|
return { "font-weight": v };
|
|
353
463
|
}],
|
|
354
464
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
355
|
-
const v = theme.lineHeight?.[s] ||
|
|
465
|
+
const v = theme.lineHeight?.[s] || utilities.handler.bracket.rem(s);
|
|
356
466
|
if (v !== null)
|
|
357
467
|
return { "line-height": v };
|
|
358
468
|
}],
|
|
359
469
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
360
|
-
const v = theme.letterSpacing?.[s] ||
|
|
470
|
+
const v = theme.letterSpacing?.[s] || utilities.handler.bracket.rem(s);
|
|
361
471
|
if (v !== null)
|
|
362
472
|
return { "letter-spacing": v };
|
|
363
473
|
}],
|
|
364
474
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
365
|
-
const v = theme.wordSpacing?.[s] ||
|
|
475
|
+
const v = theme.wordSpacing?.[s] || utilities.handler.bracket.rem(s);
|
|
366
476
|
if (v !== null)
|
|
367
477
|
return { "word-spacing": v };
|
|
368
478
|
}]
|
|
@@ -370,7 +480,7 @@ const fonts = [
|
|
|
370
480
|
const tabSizes = [
|
|
371
481
|
[/^tab-?([^-]*)$/, ([, s]) => {
|
|
372
482
|
s = s || "4";
|
|
373
|
-
const v =
|
|
483
|
+
const v = utilities.handler.bracket.global.number(s);
|
|
374
484
|
if (v !== null) {
|
|
375
485
|
return {
|
|
376
486
|
"-moz-tab-size": v,
|
|
@@ -382,23 +492,23 @@ const tabSizes = [
|
|
|
382
492
|
];
|
|
383
493
|
const textIndents = [
|
|
384
494
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
385
|
-
const v = theme.textIndent?.[s || "DEFAULT"] ||
|
|
495
|
+
const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s);
|
|
386
496
|
if (v != null)
|
|
387
497
|
return { "text-indent": v };
|
|
388
498
|
}]
|
|
389
499
|
];
|
|
390
500
|
const textStrokes = [
|
|
391
501
|
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
392
|
-
const v = theme.textStrokeWidth?.[s || "DEFAULT"] ||
|
|
502
|
+
const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
|
|
393
503
|
if (v != null)
|
|
394
504
|
return { "-webkit-text-stroke-width": v };
|
|
395
505
|
}],
|
|
396
506
|
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
397
|
-
[/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity":
|
|
507
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
398
508
|
];
|
|
399
509
|
const textShadows = [
|
|
400
510
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
401
|
-
const v = theme.textShadow?.[s || "DEFAULT"] ||
|
|
511
|
+
const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
|
|
402
512
|
if (v != null)
|
|
403
513
|
return { "text-shadow": v };
|
|
404
514
|
}]
|
|
@@ -406,7 +516,7 @@ const textShadows = [
|
|
|
406
516
|
|
|
407
517
|
const gaps = [
|
|
408
518
|
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
409
|
-
const v =
|
|
519
|
+
const v = utilities.handler.bracket.rem(s);
|
|
410
520
|
if (v != null) {
|
|
411
521
|
return {
|
|
412
522
|
"grid-gap": v,
|
|
@@ -415,7 +525,7 @@ const gaps = [
|
|
|
415
525
|
}
|
|
416
526
|
}],
|
|
417
527
|
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
418
|
-
const v =
|
|
528
|
+
const v = utilities.handler.bracket.rem(s);
|
|
419
529
|
if (v != null) {
|
|
420
530
|
return {
|
|
421
531
|
"grid-column-gap": v,
|
|
@@ -424,7 +534,7 @@ const gaps = [
|
|
|
424
534
|
}
|
|
425
535
|
}],
|
|
426
536
|
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
427
|
-
const v =
|
|
537
|
+
const v = utilities.handler.bracket.rem(s);
|
|
428
538
|
if (v != null) {
|
|
429
539
|
return {
|
|
430
540
|
"grid-row-gap": v,
|
|
@@ -434,7 +544,7 @@ const gaps = [
|
|
|
434
544
|
}]
|
|
435
545
|
];
|
|
436
546
|
|
|
437
|
-
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] ||
|
|
547
|
+
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.rem(s))[0];
|
|
438
548
|
const autoDirection = (selector, theme) => {
|
|
439
549
|
if (selector === "min")
|
|
440
550
|
return "min-content";
|
|
@@ -453,7 +563,7 @@ const grids = [
|
|
|
453
563
|
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
|
|
454
564
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
455
565
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
456
|
-
let raw =
|
|
566
|
+
let raw = utilities.handler.bracket(v);
|
|
457
567
|
if (raw)
|
|
458
568
|
return { [key]: raw };
|
|
459
569
|
const parts = v.split("-");
|
|
@@ -462,7 +572,7 @@ const grids = [
|
|
|
462
572
|
if (parts[0] === "span") {
|
|
463
573
|
if (parts[1] === "full")
|
|
464
574
|
return { [key]: "1/-1" };
|
|
465
|
-
raw =
|
|
575
|
+
raw = utilities.handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
|
|
466
576
|
if (raw)
|
|
467
577
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
468
578
|
}
|
|
@@ -508,7 +618,7 @@ const justifies = [
|
|
|
508
618
|
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
509
619
|
];
|
|
510
620
|
const orders = [
|
|
511
|
-
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] ||
|
|
621
|
+
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || utilities.handler.bracket.number(v) })]
|
|
512
622
|
];
|
|
513
623
|
const alignments = [
|
|
514
624
|
["content-start", { "align-content": "flex-start" }],
|
|
@@ -540,14 +650,14 @@ const placements = [
|
|
|
540
650
|
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
541
651
|
];
|
|
542
652
|
function handleInsetValue(v) {
|
|
543
|
-
return { auto: "auto", full: "100%" }[v] ??
|
|
653
|
+
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.rem(v);
|
|
544
654
|
}
|
|
545
655
|
const insets = [
|
|
546
656
|
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
547
657
|
[/^inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
548
658
|
const r = handleInsetValue(v);
|
|
549
|
-
if (r != null && d in
|
|
550
|
-
return
|
|
659
|
+
if (r != null && d in utilities.directionMap)
|
|
660
|
+
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
551
661
|
}]
|
|
552
662
|
];
|
|
553
663
|
const floats = [
|
|
@@ -556,7 +666,7 @@ const floats = [
|
|
|
556
666
|
];
|
|
557
667
|
const zIndexes = [
|
|
558
668
|
["z-auto", { "z-index": "auto" }],
|
|
559
|
-
[/^z-([^-]+)$/, ([, v]) => ({ "z-index":
|
|
669
|
+
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
|
|
560
670
|
];
|
|
561
671
|
const boxSizing = [
|
|
562
672
|
[
|
|
@@ -569,7 +679,7 @@ const boxSizing = [
|
|
|
569
679
|
|
|
570
680
|
const rings = [
|
|
571
681
|
[/^ring-?(.*)$/, ([, d]) => {
|
|
572
|
-
const value =
|
|
682
|
+
const value = utilities.handler.px(d || "1");
|
|
573
683
|
if (value) {
|
|
574
684
|
return {
|
|
575
685
|
"--un-ring-inset": "var(--un-empty, )",
|
|
@@ -578,13 +688,13 @@ const rings = [
|
|
|
578
688
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
579
689
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
580
690
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
581
|
-
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
582
|
-
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
691
|
+
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
|
|
692
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
583
693
|
};
|
|
584
694
|
}
|
|
585
695
|
}],
|
|
586
696
|
[/^ring-offset-?(.*)$/, ([, d]) => {
|
|
587
|
-
const value =
|
|
697
|
+
const value = utilities.handler.px(d || "1");
|
|
588
698
|
if (value) {
|
|
589
699
|
return {
|
|
590
700
|
"--un-ring-offset-width": value
|
|
@@ -635,12 +745,12 @@ function getPropName(minmax, hw) {
|
|
|
635
745
|
function getThemeValue(minmax, hw, theme, prop) {
|
|
636
746
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
637
747
|
if (minmax)
|
|
638
|
-
str = `${minmax}${
|
|
748
|
+
str = `${minmax}${utilities.capitalize(str)}`;
|
|
639
749
|
return theme[str]?.[prop];
|
|
640
750
|
}
|
|
641
751
|
const sizes = [
|
|
642
752
|
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
643
|
-
const v = getThemeValue(m, w, theme, s) ||
|
|
753
|
+
const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.rem(s);
|
|
644
754
|
if (v != null)
|
|
645
755
|
return { [getPropName(m, w)]: v };
|
|
646
756
|
}],
|
|
@@ -653,106 +763,30 @@ const sizes = [
|
|
|
653
763
|
const aspectRatio = [
|
|
654
764
|
["aspect-ratio-auto", { "aspect-ratio": "auto" }],
|
|
655
765
|
[/^aspect-ratio-(.+)$/, ([, d]) => {
|
|
656
|
-
const v = (/^\d+\/\d+$/.test(d) ? d : null) ||
|
|
766
|
+
const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
|
|
657
767
|
if (v != null)
|
|
658
768
|
return { "aspect-ratio": v };
|
|
659
769
|
}]
|
|
660
770
|
];
|
|
661
771
|
|
|
662
|
-
const directionSize = (prefix) => ([_, direction, size]) => {
|
|
663
|
-
const v = index.handler.bracket.rem.fraction.cssvar(size);
|
|
664
|
-
if (v)
|
|
665
|
-
return index.directionMap[direction].map((i) => [prefix + i, v]);
|
|
666
|
-
};
|
|
667
772
|
const paddings = [
|
|
668
|
-
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
669
|
-
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
670
|
-
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
773
|
+
[/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
|
|
774
|
+
[/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
|
|
775
|
+
[/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
|
|
671
776
|
];
|
|
672
777
|
const margins = [
|
|
673
|
-
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
674
|
-
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
675
|
-
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
676
|
-
];
|
|
677
|
-
|
|
678
|
-
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
679
|
-
const displays = [
|
|
680
|
-
["inline", { display: "inline" }],
|
|
681
|
-
["block", { display: "block" }],
|
|
682
|
-
["inline-block", { display: "inline-block" }],
|
|
683
|
-
["contents", { display: "contents" }],
|
|
684
|
-
["flow-root", { display: "flow-root" }],
|
|
685
|
-
["list-item", { display: "list-item" }],
|
|
686
|
-
["hidden", { display: "none" }]
|
|
687
|
-
];
|
|
688
|
-
const appearances = [
|
|
689
|
-
["visible", { visibility: "visible" }],
|
|
690
|
-
["invisible", { visibility: "hidden" }],
|
|
691
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
692
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
693
|
-
];
|
|
694
|
-
const cursors = [
|
|
695
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
696
|
-
];
|
|
697
|
-
const pointerEvents = [
|
|
698
|
-
["pointer-events-none", { "pointer-events": "none" }],
|
|
699
|
-
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
700
|
-
];
|
|
701
|
-
const resizes = [
|
|
702
|
-
["resize-none", { resize: "none" }],
|
|
703
|
-
["resize-x", { resize: "horizontal" }],
|
|
704
|
-
["resize-y", { resize: "vertical" }],
|
|
705
|
-
["resize", { resize: "both" }]
|
|
706
|
-
];
|
|
707
|
-
const userSelects = [
|
|
708
|
-
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
709
|
-
];
|
|
710
|
-
const whitespaces = [
|
|
711
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
712
|
-
];
|
|
713
|
-
const contents = [
|
|
714
|
-
["content-empty", { content: '""' }]
|
|
715
|
-
];
|
|
716
|
-
const breaks = [
|
|
717
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
718
|
-
["break-word", { "overflow-wrap": "break-word" }],
|
|
719
|
-
["break-all", { "word-break": "break-all" }]
|
|
720
|
-
];
|
|
721
|
-
const textOverflows = [
|
|
722
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
723
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
724
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
725
|
-
];
|
|
726
|
-
const textTransforms = [
|
|
727
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
728
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
729
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
730
|
-
["case-normal", { "text-transform": "none" }]
|
|
731
|
-
];
|
|
732
|
-
const fontStyles = [
|
|
733
|
-
["italic", { "font-style": "italic" }],
|
|
734
|
-
["not-italic", { "font-style": "normal" }]
|
|
735
|
-
];
|
|
736
|
-
const fontSmoothings = [
|
|
737
|
-
["antialiased", {
|
|
738
|
-
"-webkit-font-smoothing": "antialiased",
|
|
739
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
740
|
-
"font-smoothing": "grayscale"
|
|
741
|
-
}],
|
|
742
|
-
["subpixel-antialiased", {
|
|
743
|
-
"-webkit-font-smoothing": "auto",
|
|
744
|
-
"-moz-osx-font-smoothing": "auto",
|
|
745
|
-
"font-smoothing": "auto"
|
|
746
|
-
}]
|
|
778
|
+
[/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
|
|
779
|
+
[/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
|
|
780
|
+
[/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
|
|
747
781
|
];
|
|
748
782
|
|
|
749
783
|
const transformGpu = {
|
|
750
784
|
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))",
|
|
751
|
-
[pseudo.
|
|
785
|
+
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
752
786
|
};
|
|
753
787
|
const transformCpu = {
|
|
754
788
|
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))",
|
|
755
|
-
[pseudo.
|
|
789
|
+
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
756
790
|
};
|
|
757
791
|
const transformBase = {
|
|
758
792
|
"--un-rotate": 0,
|
|
@@ -769,11 +803,12 @@ const transformBase = {
|
|
|
769
803
|
const transforms = [
|
|
770
804
|
["transform", transformBase],
|
|
771
805
|
[/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
|
|
772
|
-
[/^translate()-(
|
|
773
|
-
[/^translate-([xyz])-(
|
|
774
|
-
[/^scale()-(
|
|
775
|
-
[/^scale-([xyz])-(
|
|
776
|
-
[/^rotate-(
|
|
806
|
+
[/^translate()-(.+)$/, handleTranslate],
|
|
807
|
+
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
808
|
+
[/^scale()-(.+)$/, handleScale],
|
|
809
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
810
|
+
[/^rotate-(.+)$/, handleRotate],
|
|
811
|
+
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
777
812
|
["transform-gpu", transformGpu],
|
|
778
813
|
["transform-cpu", transformCpu],
|
|
779
814
|
["transform-none", { transform: "none" }],
|
|
@@ -788,29 +823,29 @@ const transforms = [
|
|
|
788
823
|
["origin-top-left", { "transform-origin": "top left" }]
|
|
789
824
|
];
|
|
790
825
|
function handleTranslate([, d, b]) {
|
|
791
|
-
const v =
|
|
826
|
+
const v = utilities.handler.bracket.fraction.rem(b);
|
|
792
827
|
if (v != null) {
|
|
793
828
|
return [
|
|
794
829
|
transformBase,
|
|
795
830
|
[
|
|
796
|
-
...
|
|
831
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
797
832
|
]
|
|
798
833
|
];
|
|
799
834
|
}
|
|
800
835
|
}
|
|
801
836
|
function handleScale([, d, b]) {
|
|
802
|
-
const v =
|
|
837
|
+
const v = utilities.handler.bracket.fraction.percent(b);
|
|
803
838
|
if (v != null) {
|
|
804
839
|
return [
|
|
805
840
|
transformBase,
|
|
806
841
|
[
|
|
807
|
-
...
|
|
842
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
808
843
|
]
|
|
809
844
|
];
|
|
810
845
|
}
|
|
811
846
|
}
|
|
812
|
-
function
|
|
813
|
-
const v =
|
|
847
|
+
function handleRotateWithUnit([, b]) {
|
|
848
|
+
const v = utilities.handler.bracket.number(b);
|
|
814
849
|
if (v != null) {
|
|
815
850
|
return [
|
|
816
851
|
transformBase,
|
|
@@ -818,6 +853,15 @@ function handleRotate([, b]) {
|
|
|
818
853
|
];
|
|
819
854
|
}
|
|
820
855
|
}
|
|
856
|
+
function handleRotate([, b]) {
|
|
857
|
+
const v = utilities.handler.bracket(b);
|
|
858
|
+
if (v != null) {
|
|
859
|
+
return [
|
|
860
|
+
transformBase,
|
|
861
|
+
{ "--un-rotate": v }
|
|
862
|
+
];
|
|
863
|
+
}
|
|
864
|
+
}
|
|
821
865
|
|
|
822
866
|
const variablesAbbrMap = {
|
|
823
867
|
"visible": "visibility",
|
|
@@ -826,6 +870,8 @@ const variablesAbbrMap = {
|
|
|
826
870
|
"backface": "backface-visibility",
|
|
827
871
|
"whitespace": "white-space",
|
|
828
872
|
"break": "word-break",
|
|
873
|
+
"b": "border-color",
|
|
874
|
+
"border": "border-color",
|
|
829
875
|
"color": "color",
|
|
830
876
|
"case": "text-transform",
|
|
831
877
|
"origin": "transform-origin",
|
|
@@ -846,23 +892,26 @@ const variablesAbbrMap = {
|
|
|
846
892
|
"self": "align-self",
|
|
847
893
|
"object": "object-fit"
|
|
848
894
|
};
|
|
849
|
-
const cssVariables = [
|
|
850
|
-
/^(.+)-\$(.+)$/,
|
|
851
|
-
([, name, varname]) => {
|
|
895
|
+
const cssVariables = [
|
|
896
|
+
[/^(.+)-\$(.+)$/, ([, name, varname]) => {
|
|
852
897
|
const prop = variablesAbbrMap[name];
|
|
853
898
|
if (prop) {
|
|
854
899
|
return {
|
|
855
900
|
[prop]: `var(--${varname})`
|
|
856
901
|
};
|
|
857
902
|
}
|
|
858
|
-
}
|
|
859
|
-
]]
|
|
903
|
+
}],
|
|
904
|
+
[/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
|
|
905
|
+
if (a in utilities.directionMap)
|
|
906
|
+
return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
|
|
907
|
+
}]
|
|
908
|
+
];
|
|
860
909
|
|
|
861
910
|
const questionMark = [
|
|
862
911
|
[
|
|
863
912
|
/^(where|\?)$/,
|
|
864
913
|
(_, { constructCSS, generator }) => {
|
|
865
|
-
if (generator.
|
|
914
|
+
if (generator.userConfig.envMode === "dev")
|
|
866
915
|
return `@keyframes __un_qm{0%{box-shadow:inset 4px 4px #ff1e90, inset -4px -4px #ff1e90}100%{box-shadow:inset 8px 8px #3399ff, inset -8px -8px #3399ff}}
|
|
867
916
|
${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
868
917
|
}
|
|
@@ -877,10 +926,10 @@ const textDecorations = [
|
|
|
877
926
|
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
878
927
|
["decoration-none", { "text-decoration": "none" }],
|
|
879
928
|
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
880
|
-
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s :
|
|
881
|
-
[/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness":
|
|
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) })],
|
|
882
931
|
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
883
|
-
const v = s === "auto" ? s :
|
|
932
|
+
const v = s === "auto" ? s : utilities.handler.bracket.px(s);
|
|
884
933
|
if (v != null)
|
|
885
934
|
return { "text-underline-offset": v };
|
|
886
935
|
}],
|
|
@@ -893,7 +942,21 @@ const textDecorations = [
|
|
|
893
942
|
};
|
|
894
943
|
}
|
|
895
944
|
}],
|
|
896
|
-
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity":
|
|
945
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
946
|
+
];
|
|
947
|
+
|
|
948
|
+
const svgUtilities = [
|
|
949
|
+
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
950
|
+
[/^fill-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
951
|
+
["fill-none", { fill: "none" }],
|
|
952
|
+
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
953
|
+
const v = utilities.handler.bracket.fraction.px.number(s);
|
|
954
|
+
if (v)
|
|
955
|
+
return { "stroke-width": v };
|
|
956
|
+
}],
|
|
957
|
+
[/^stroke-(.+)$/, colorResolver$1("stroke", "stroke")],
|
|
958
|
+
[/^stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
959
|
+
["stroke-none", { stroke: "none" }]
|
|
897
960
|
];
|
|
898
961
|
|
|
899
962
|
const rules = [
|
|
@@ -903,7 +966,7 @@ const rules = [
|
|
|
903
966
|
displays,
|
|
904
967
|
opacity,
|
|
905
968
|
bgColors,
|
|
906
|
-
|
|
969
|
+
svgUtilities,
|
|
907
970
|
borders,
|
|
908
971
|
contents,
|
|
909
972
|
fonts,
|
|
@@ -949,6 +1012,7 @@ const rules = [
|
|
|
949
1012
|
boxSizing,
|
|
950
1013
|
transitions,
|
|
951
1014
|
transforms,
|
|
1015
|
+
willChange,
|
|
952
1016
|
questionMark
|
|
953
1017
|
].flat(1);
|
|
954
1018
|
|
|
@@ -964,10 +1028,10 @@ exports.boxSizing = boxSizing;
|
|
|
964
1028
|
exports.breaks = breaks;
|
|
965
1029
|
exports.colorResolver = colorResolver$1;
|
|
966
1030
|
exports.contents = contents;
|
|
1031
|
+
exports.cssProps = cssProps;
|
|
967
1032
|
exports.cssVariables = cssVariables;
|
|
968
1033
|
exports.cursors = cursors;
|
|
969
1034
|
exports.displays = displays;
|
|
970
|
-
exports.fillColors = fillColors;
|
|
971
1035
|
exports.flex = flex;
|
|
972
1036
|
exports.floats = floats;
|
|
973
1037
|
exports.fontSmoothings = fontSmoothings;
|
|
@@ -995,6 +1059,7 @@ exports.ringOffsetColors = ringOffsetColors;
|
|
|
995
1059
|
exports.rings = rings;
|
|
996
1060
|
exports.rules = rules;
|
|
997
1061
|
exports.sizes = sizes;
|
|
1062
|
+
exports.svgUtilities = svgUtilities;
|
|
998
1063
|
exports.tabSizes = tabSizes;
|
|
999
1064
|
exports.textAligns = textAligns;
|
|
1000
1065
|
exports.textColors = textColors;
|
|
@@ -1010,4 +1075,5 @@ exports.userSelects = userSelects;
|
|
|
1010
1075
|
exports.varEmpty = varEmpty;
|
|
1011
1076
|
exports.verticalAligns = verticalAligns;
|
|
1012
1077
|
exports.whitespaces = whitespaces;
|
|
1078
|
+
exports.willChange = willChange;
|
|
1013
1079
|
exports.zIndexes = zIndexes;
|