@unocss/preset-mini 0.16.1 → 0.17.2
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 +247 -357
- package/dist/chunks/default2.mjs +215 -324
- package/dist/chunks/default3.cjs +18 -12
- package/dist/chunks/default3.mjs +19 -13
- package/dist/chunks/pseudo.cjs +53 -30
- package/dist/chunks/pseudo.mjs +52 -30
- package/dist/chunks/utilities.cjs +294 -0
- package/dist/chunks/utilities.mjs +283 -0
- package/dist/chunks/variants.cjs +8 -6
- package/dist/chunks/variants.mjs +8 -6
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rules.cjs +3 -4
- package/dist/rules.d.ts +5 -13
- package/dist/rules.mjs +2 -2
- package/dist/utils.cjs +11 -8
- package/dist/utils.d.ts +64 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +3 -2
- package/dist/variants.d.ts +4 -3
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunks/index.cjs +0 -142
- package/dist/chunks/index.mjs +0 -134
package/dist/chunks/default2.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const utilities = require('./utilities.cjs');
|
|
3
4
|
const core = require('@unocss/core');
|
|
4
|
-
const index = require('./index.cjs');
|
|
5
5
|
const pseudo = require('./pseudo.cjs');
|
|
6
6
|
|
|
7
7
|
const verticalAlignAlias = {
|
|
@@ -19,93 +19,10 @@ const textAligns = [
|
|
|
19
19
|
["text-justify", { "text-align": "justify" }]
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
const [main, opacity2] = body.split(/(?:\/|:)/);
|
|
24
|
-
const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
25
|
-
if (!name)
|
|
26
|
-
return;
|
|
27
|
-
let color;
|
|
28
|
-
const bracket = index.handler.bracket(main);
|
|
29
|
-
const bracketOrMain = bracket || main;
|
|
30
|
-
if (bracketOrMain.startsWith("#"))
|
|
31
|
-
color = bracketOrMain.slice(1);
|
|
32
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
33
|
-
color = bracketOrMain.slice(4);
|
|
34
|
-
color = color || bracket;
|
|
35
|
-
if (!color) {
|
|
36
|
-
const colorData = theme.colors?.[name];
|
|
37
|
-
if (typeof colorData === "string")
|
|
38
|
-
color = colorData;
|
|
39
|
-
else if (no && colorData)
|
|
40
|
-
color = colorData[no];
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
opacity: opacity2,
|
|
44
|
-
name,
|
|
45
|
-
no,
|
|
46
|
-
color,
|
|
47
|
-
rgba: core.hex2rgba(color)
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
51
|
-
const data = parseColorUtil(body, theme);
|
|
52
|
-
if (!data)
|
|
53
|
-
return;
|
|
54
|
-
const { opacity: opacity2, color, rgba } = data;
|
|
55
|
-
if (!color)
|
|
56
|
-
return;
|
|
57
|
-
const a = opacity2 ? opacity2[0] === "[" ? index.handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
58
|
-
if (rgba) {
|
|
59
|
-
if (a != null && !Number.isNaN(a)) {
|
|
60
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
61
|
-
return {
|
|
62
|
-
[attribute]: `rgba(${rgba.join(",")})`
|
|
63
|
-
};
|
|
64
|
-
} else {
|
|
65
|
-
return {
|
|
66
|
-
[`--un-${varName}-opacity`]: 1,
|
|
67
|
-
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
return {
|
|
72
|
-
[attribute]: color.replace("%alpha", `${a || 1}`)
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const opacity = [
|
|
77
|
-
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: index.handler.bracket.percent.cssvar(d) })]
|
|
78
|
-
];
|
|
79
|
-
const textColors = [
|
|
80
|
-
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
81
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": index.handler.bracket.percent.cssvar(opacity2) })]
|
|
82
|
-
];
|
|
83
|
-
const bgColors = [
|
|
84
|
-
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
85
|
-
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": index.handler.bracket.percent(opacity2) })]
|
|
86
|
-
];
|
|
87
|
-
const borderColors = [
|
|
88
|
-
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
89
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity2) })]
|
|
90
|
-
];
|
|
91
|
-
const ringColors = [
|
|
92
|
-
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
93
|
-
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": index.handler.bracket.percent(opacity2) })]
|
|
94
|
-
];
|
|
95
|
-
const ringOffsetColors = [
|
|
96
|
-
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
97
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": index.handler.bracket.percent(opacity2) })]
|
|
98
|
-
];
|
|
99
|
-
const fillColors = [
|
|
100
|
-
["fill-none", { fill: "none" }],
|
|
101
|
-
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
102
|
-
[/^fill-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-fill-opacity": index.handler.bracket.percent(opacity2) })]
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
22
|
+
const outlineStyle = ["auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
106
23
|
const parseOutlineSize = (s) => {
|
|
107
24
|
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
108
|
-
const size =
|
|
25
|
+
const size = utilities.handler.bracket.fraction.auto.rem(s.replace(/^(offset\-|width\-|size\-)/, ""));
|
|
109
26
|
if (size) {
|
|
110
27
|
return {
|
|
111
28
|
[`outline-${propName}`]: size
|
|
@@ -113,34 +30,28 @@ const parseOutlineSize = (s) => {
|
|
|
113
30
|
}
|
|
114
31
|
};
|
|
115
32
|
const outline = [
|
|
116
|
-
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
|
|
117
33
|
["outline", { "outline-style": "solid" }],
|
|
118
34
|
[
|
|
119
35
|
/^outline-(.+)$/,
|
|
120
36
|
(match, config) => {
|
|
121
37
|
const [, d] = match;
|
|
122
|
-
if (d === "none") {
|
|
123
|
-
return {
|
|
124
|
-
"outline": "2px solid transparent",
|
|
125
|
-
"outline-offset": "2px"
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
38
|
if (outlineStyle.includes(d)) {
|
|
129
39
|
return {
|
|
130
40
|
"outline-style": d
|
|
131
41
|
};
|
|
132
42
|
}
|
|
133
|
-
const
|
|
134
|
-
if (sizeSheet)
|
|
135
|
-
return sizeSheet;
|
|
136
|
-
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
43
|
+
const colorSheet = utilities.colorResolver("outline-color", "outline-color")([
|
|
137
44
|
match[0],
|
|
138
45
|
match[1].replace(/^color-/, "")
|
|
139
46
|
], config);
|
|
140
47
|
if (colorSheet)
|
|
141
48
|
return colorSheet;
|
|
49
|
+
const sizeSheet = parseOutlineSize(d);
|
|
50
|
+
if (sizeSheet)
|
|
51
|
+
return sizeSheet;
|
|
142
52
|
}
|
|
143
|
-
]
|
|
53
|
+
],
|
|
54
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
144
55
|
];
|
|
145
56
|
const appearance = [
|
|
146
57
|
["appearance-none", {
|
|
@@ -152,35 +63,38 @@ const placeholder = [
|
|
|
152
63
|
[
|
|
153
64
|
/^placeholder-opacity-(\d+)$/,
|
|
154
65
|
([, d]) => ({
|
|
155
|
-
"placeholder-opacity":
|
|
66
|
+
"placeholder-opacity": utilities.handler.bracket.percent(d)
|
|
156
67
|
})
|
|
157
68
|
],
|
|
158
69
|
[
|
|
159
70
|
/^placeholder-(?!opacity)(.+)$/,
|
|
160
71
|
(match, config) => {
|
|
161
72
|
match[1] = match[1].replace(/^color-/, "");
|
|
162
|
-
return colorResolver
|
|
73
|
+
return utilities.colorResolver("placeholder-color", "placeholder-color")(match, config);
|
|
163
74
|
}
|
|
164
75
|
]
|
|
165
76
|
];
|
|
77
|
+
const willChange = [
|
|
78
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
|
|
79
|
+
];
|
|
166
80
|
|
|
167
81
|
const borders = [
|
|
168
82
|
[/^border$/, handlerBorder],
|
|
169
83
|
[/^(?:border|b)()-(.+)$/, handlerBorder],
|
|
170
|
-
[/^(?:border|b)-([^-]+)
|
|
84
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
|
|
171
85
|
[/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
|
|
172
86
|
[/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
|
|
173
87
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
174
|
-
[/^(?:border|b)-([^-]+)
|
|
175
|
-
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity":
|
|
88
|
+
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
89
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
176
90
|
["border-solid", { "border-style": "solid" }],
|
|
177
91
|
["border-dashed", { "border-style": "dashed" }],
|
|
178
92
|
["border-dotted", { "border-style": "dotted" }],
|
|
179
93
|
["border-double", { "border-style": "double" }],
|
|
180
94
|
["border-none", { "border-style": "none" }],
|
|
181
95
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
182
|
-
[/^(?:border-)?(?:rounded|rd)(?:-(
|
|
183
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(
|
|
96
|
+
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
97
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded]
|
|
184
98
|
];
|
|
185
99
|
function handlerBorder(m) {
|
|
186
100
|
const borderSizes = handlerBorderSize(m);
|
|
@@ -192,118 +106,73 @@ function handlerBorder(m) {
|
|
|
192
106
|
}
|
|
193
107
|
}
|
|
194
108
|
function handlerBorderSize([, a, b]) {
|
|
195
|
-
const [d, s = "1"] =
|
|
196
|
-
const v =
|
|
197
|
-
if (v
|
|
198
|
-
return [
|
|
199
|
-
...index.directionMap[d].map((i) => [`border${i}-width`, v])
|
|
200
|
-
];
|
|
201
|
-
}
|
|
109
|
+
const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
|
|
110
|
+
const v = utilities.handler.bracket.px(s);
|
|
111
|
+
if (v !== void 0)
|
|
112
|
+
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
202
113
|
}
|
|
203
114
|
function handlerBorderColor([, a, c], ctx) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const borders2 = index.directionMap[index.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
|
|
207
|
-
const borderObject = {};
|
|
208
|
-
Object.assign(borderObject, ...borders2);
|
|
209
|
-
return borderObject;
|
|
115
|
+
if (c !== void 0 && utilities.colorResolver("border-color", "border")(["", c], ctx)) {
|
|
116
|
+
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => utilities.colorResolver(`border${i}-color`, "border")(["", c], ctx)));
|
|
210
117
|
}
|
|
211
118
|
}
|
|
212
119
|
function handlerRounded([, a, b], { theme }) {
|
|
213
|
-
const [d, s = "DEFAULT"] =
|
|
214
|
-
const v = theme.borderRadius?.[s] ||
|
|
215
|
-
if (v
|
|
216
|
-
return
|
|
120
|
+
const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
|
|
121
|
+
const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
|
|
122
|
+
if (v !== void 0)
|
|
123
|
+
return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
217
124
|
}
|
|
218
125
|
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
"border-color",
|
|
222
|
-
"background-color",
|
|
223
|
-
"flex-grow",
|
|
224
|
-
"flex",
|
|
225
|
-
"flex-shrink",
|
|
226
|
-
"caret-color",
|
|
227
|
-
"font",
|
|
228
|
-
"gap",
|
|
229
|
-
"opacity",
|
|
230
|
-
"visibility",
|
|
231
|
-
"z-index",
|
|
232
|
-
"font-weight",
|
|
233
|
-
"zoom",
|
|
234
|
-
"text-shadow",
|
|
235
|
-
"transform",
|
|
236
|
-
"box-shadow"
|
|
126
|
+
const opacity = [
|
|
127
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
|
|
237
128
|
];
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
"
|
|
241
|
-
"right",
|
|
242
|
-
"top",
|
|
243
|
-
"bottom",
|
|
244
|
-
"object-position"
|
|
129
|
+
const textColors = [
|
|
130
|
+
[/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text")],
|
|
131
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
|
|
245
132
|
];
|
|
246
|
-
const
|
|
247
|
-
"
|
|
248
|
-
"
|
|
249
|
-
"max-width",
|
|
250
|
-
"min-width",
|
|
251
|
-
"height",
|
|
252
|
-
"width",
|
|
253
|
-
"border-width",
|
|
254
|
-
"margin",
|
|
255
|
-
"padding",
|
|
256
|
-
"outline-width",
|
|
257
|
-
"outline-offset",
|
|
258
|
-
"font-size",
|
|
259
|
-
"line-height",
|
|
260
|
-
"text-indent",
|
|
261
|
-
"vertical-align",
|
|
262
|
-
"border-spacing",
|
|
263
|
-
"letter-spacing",
|
|
264
|
-
"word-spacing"
|
|
133
|
+
const bgColors = [
|
|
134
|
+
[/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
|
|
135
|
+
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
265
136
|
];
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
...transitionBasicProps,
|
|
270
|
-
...transitionPositionProps,
|
|
271
|
-
...transitionSizeProps,
|
|
272
|
-
...transitionEnhanceProps
|
|
137
|
+
const borderColors = [
|
|
138
|
+
[/^(?:border|b)-(.+)$/, utilities.colorResolver("border-color", "border")],
|
|
139
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
273
140
|
];
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
141
|
+
const ringColors = [
|
|
142
|
+
[/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
|
|
143
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
144
|
+
];
|
|
145
|
+
const ringOffsetColors = [
|
|
146
|
+
[/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
147
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
const transitionProperty = (prop) => {
|
|
151
|
+
return utilities.handler.properties(prop) || (prop === "all" ? prop : void 0);
|
|
279
152
|
};
|
|
280
153
|
const transitions = [
|
|
281
|
-
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
}],
|
|
291
|
-
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
292
|
-
return {
|
|
293
|
-
"transition-duration": `${duration}ms`
|
|
294
|
-
};
|
|
154
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
|
|
155
|
+
const p = transitionProperty(prop);
|
|
156
|
+
if (p) {
|
|
157
|
+
return {
|
|
158
|
+
"transition-property": p,
|
|
159
|
+
"transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
|
|
160
|
+
"transition-duration": `${duration}ms`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
295
163
|
}],
|
|
164
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
|
|
296
165
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
166
|
+
["ease-linear", { "transition-timing-function": "linear" }],
|
|
297
167
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
298
168
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
299
169
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
300
170
|
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
301
171
|
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
302
|
-
[/^(?:transition-)?property-(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}]
|
|
172
|
+
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
173
|
+
["transition-property-none", { "transition-property": "none" }],
|
|
174
|
+
["property-none", { "transition-property": "none" }],
|
|
175
|
+
["transition-none", { transition: "none" }]
|
|
307
176
|
];
|
|
308
177
|
|
|
309
178
|
const flex = [
|
|
@@ -349,7 +218,7 @@ const fonts = [
|
|
|
349
218
|
}
|
|
350
219
|
}],
|
|
351
220
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
352
|
-
const size =
|
|
221
|
+
const size = utilities.handler.bracket.auto.rem(s);
|
|
353
222
|
if (size)
|
|
354
223
|
return { "font-size": size };
|
|
355
224
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
@@ -362,27 +231,27 @@ const fonts = [
|
|
|
362
231
|
}
|
|
363
232
|
}],
|
|
364
233
|
[/^text-size-(.+)$/, ([, s]) => {
|
|
365
|
-
const raw =
|
|
234
|
+
const raw = utilities.handler.bracket.auto.rem(s);
|
|
366
235
|
if (raw)
|
|
367
236
|
return { "font-size": raw };
|
|
368
237
|
}],
|
|
369
238
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
370
|
-
const v = weightMap[s] ||
|
|
239
|
+
const v = weightMap[s] || utilities.handler.number(s);
|
|
371
240
|
if (v)
|
|
372
241
|
return { "font-weight": v };
|
|
373
242
|
}],
|
|
374
243
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
375
|
-
const v = theme.lineHeight?.[s] ||
|
|
244
|
+
const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
376
245
|
if (v !== null)
|
|
377
246
|
return { "line-height": v };
|
|
378
247
|
}],
|
|
379
248
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
380
|
-
const v = theme.letterSpacing?.[s] ||
|
|
249
|
+
const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
381
250
|
if (v !== null)
|
|
382
251
|
return { "letter-spacing": v };
|
|
383
252
|
}],
|
|
384
253
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
385
|
-
const v = theme.wordSpacing?.[s] ||
|
|
254
|
+
const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
|
|
386
255
|
if (v !== null)
|
|
387
256
|
return { "word-spacing": v };
|
|
388
257
|
}]
|
|
@@ -390,7 +259,7 @@ const fonts = [
|
|
|
390
259
|
const tabSizes = [
|
|
391
260
|
[/^tab-?([^-]*)$/, ([, s]) => {
|
|
392
261
|
s = s || "4";
|
|
393
|
-
const v =
|
|
262
|
+
const v = utilities.handler.bracket.global.number(s);
|
|
394
263
|
if (v !== null) {
|
|
395
264
|
return {
|
|
396
265
|
"-moz-tab-size": v,
|
|
@@ -402,23 +271,23 @@ const tabSizes = [
|
|
|
402
271
|
];
|
|
403
272
|
const textIndents = [
|
|
404
273
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
405
|
-
const v = theme.textIndent?.[s || "DEFAULT"] ||
|
|
274
|
+
const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
|
|
406
275
|
if (v != null)
|
|
407
276
|
return { "text-indent": v };
|
|
408
277
|
}]
|
|
409
278
|
];
|
|
410
279
|
const textStrokes = [
|
|
411
280
|
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
412
|
-
const v = theme.textStrokeWidth?.[s || "DEFAULT"] ||
|
|
281
|
+
const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
|
|
413
282
|
if (v != null)
|
|
414
283
|
return { "-webkit-text-stroke-width": v };
|
|
415
284
|
}],
|
|
416
|
-
[/^text-stroke-(.+)$/, colorResolver
|
|
417
|
-
[/^text-stroke-op(?:acity)?-?(.+)
|
|
285
|
+
[/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
|
|
286
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
418
287
|
];
|
|
419
288
|
const textShadows = [
|
|
420
289
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
421
|
-
const v = theme.textShadow?.[s || "DEFAULT"] ||
|
|
290
|
+
const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
|
|
422
291
|
if (v != null)
|
|
423
292
|
return { "text-shadow": v };
|
|
424
293
|
}]
|
|
@@ -426,7 +295,7 @@ const textShadows = [
|
|
|
426
295
|
|
|
427
296
|
const gaps = [
|
|
428
297
|
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
429
|
-
const v =
|
|
298
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
430
299
|
if (v != null) {
|
|
431
300
|
return {
|
|
432
301
|
"grid-gap": v,
|
|
@@ -435,7 +304,7 @@ const gaps = [
|
|
|
435
304
|
}
|
|
436
305
|
}],
|
|
437
306
|
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
438
|
-
const v =
|
|
307
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
439
308
|
if (v != null) {
|
|
440
309
|
return {
|
|
441
310
|
"grid-column-gap": v,
|
|
@@ -444,7 +313,7 @@ const gaps = [
|
|
|
444
313
|
}
|
|
445
314
|
}],
|
|
446
315
|
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
447
|
-
const v =
|
|
316
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
448
317
|
if (v != null) {
|
|
449
318
|
return {
|
|
450
319
|
"grid-row-gap": v,
|
|
@@ -454,7 +323,7 @@ const gaps = [
|
|
|
454
323
|
}]
|
|
455
324
|
];
|
|
456
325
|
|
|
457
|
-
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] ||
|
|
326
|
+
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
|
|
458
327
|
const autoDirection = (selector, theme) => {
|
|
459
328
|
if (selector === "min")
|
|
460
329
|
return "min-content";
|
|
@@ -467,13 +336,13 @@ const autoDirection = (selector, theme) => {
|
|
|
467
336
|
const grids = [
|
|
468
337
|
["grid", { display: "grid" }],
|
|
469
338
|
["inline-grid", { display: "inline-grid" }],
|
|
470
|
-
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start":
|
|
471
|
-
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end":
|
|
472
|
-
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start":
|
|
473
|
-
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end":
|
|
339
|
+
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
|
|
340
|
+
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
|
|
341
|
+
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
|
|
342
|
+
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
|
|
474
343
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
475
344
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
476
|
-
let raw =
|
|
345
|
+
let raw = utilities.handler.bracket(v);
|
|
477
346
|
if (raw)
|
|
478
347
|
return { [key]: raw };
|
|
479
348
|
const parts = v.split("-");
|
|
@@ -482,16 +351,16 @@ const grids = [
|
|
|
482
351
|
if (parts[0] === "span") {
|
|
483
352
|
if (parts[1] === "full")
|
|
484
353
|
return { [key]: "1/-1" };
|
|
485
|
-
raw =
|
|
354
|
+
raw = utilities.handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
|
|
486
355
|
if (raw)
|
|
487
356
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
488
357
|
}
|
|
489
358
|
}],
|
|
490
|
-
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns":
|
|
491
|
-
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow":
|
|
492
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows":
|
|
493
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,
|
|
494
|
-
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,
|
|
359
|
+
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
|
|
360
|
+
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
|
|
361
|
+
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
|
|
362
|
+
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
363
|
+
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
495
364
|
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
496
365
|
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
497
366
|
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
@@ -528,7 +397,8 @@ const justifies = [
|
|
|
528
397
|
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
529
398
|
];
|
|
530
399
|
const orders = [
|
|
531
|
-
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999"
|
|
400
|
+
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999" }[v] || utilities.handler.bracket.number(v) })],
|
|
401
|
+
["order-none", { order: "0" }]
|
|
532
402
|
];
|
|
533
403
|
const alignments = [
|
|
534
404
|
["content-start", { "align-content": "flex-start" }],
|
|
@@ -546,7 +416,7 @@ const alignments = [
|
|
|
546
416
|
["self-start", { "align-self": "flex-start" }],
|
|
547
417
|
["self-end", { "align-self": "flex-end" }],
|
|
548
418
|
["self-center", { "align-self": "center" }],
|
|
549
|
-
["self-stretch", { "align-
|
|
419
|
+
["self-stretch", { "align-self": "stretch" }]
|
|
550
420
|
];
|
|
551
421
|
const placements = [
|
|
552
422
|
["place-content-start", { "place-content": "start" }],
|
|
@@ -560,23 +430,25 @@ const placements = [
|
|
|
560
430
|
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
561
431
|
];
|
|
562
432
|
function handleInsetValue(v) {
|
|
563
|
-
return { auto: "auto", full: "100%" }[v] ??
|
|
433
|
+
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
564
434
|
}
|
|
565
435
|
const insets = [
|
|
566
436
|
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
567
437
|
[/^inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
568
438
|
const r = handleInsetValue(v);
|
|
569
|
-
if (r != null && d in
|
|
570
|
-
return
|
|
439
|
+
if (r != null && d in utilities.directionMap)
|
|
440
|
+
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
571
441
|
}]
|
|
572
442
|
];
|
|
573
443
|
const floats = [
|
|
574
|
-
[/^float-(left|right
|
|
575
|
-
[
|
|
444
|
+
[/^float-(left|right)$/, ([, value]) => ({ float: value })],
|
|
445
|
+
["float-none", { float: "none" }],
|
|
446
|
+
[/^clear-(left|right|both)$/, ([, value]) => ({ clear: value })],
|
|
447
|
+
["clear-none", { clear: "none" }]
|
|
576
448
|
];
|
|
577
449
|
const zIndexes = [
|
|
578
450
|
["z-auto", { "z-index": "auto" }],
|
|
579
|
-
[/^z-([^-]+)$/, ([, v]) => ({ "z-index":
|
|
451
|
+
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
|
|
580
452
|
];
|
|
581
453
|
const boxSizing = [
|
|
582
454
|
[
|
|
@@ -587,29 +459,99 @@ const boxSizing = [
|
|
|
587
459
|
]
|
|
588
460
|
];
|
|
589
461
|
|
|
462
|
+
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
463
|
+
const displays = [
|
|
464
|
+
["inline", { display: "inline" }],
|
|
465
|
+
["block", { display: "block" }],
|
|
466
|
+
["inline-block", { display: "inline-block" }],
|
|
467
|
+
["contents", { display: "contents" }],
|
|
468
|
+
["flow-root", { display: "flow-root" }],
|
|
469
|
+
["list-item", { display: "list-item" }],
|
|
470
|
+
["hidden", { display: "none" }]
|
|
471
|
+
];
|
|
472
|
+
const appearances = [
|
|
473
|
+
["visible", { visibility: "visible" }],
|
|
474
|
+
["invisible", { visibility: "hidden" }],
|
|
475
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
476
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
477
|
+
];
|
|
478
|
+
const cursors = [
|
|
479
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
480
|
+
];
|
|
481
|
+
const pointerEvents = [
|
|
482
|
+
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
483
|
+
["pointer-events-none", { "pointer-events": "none" }]
|
|
484
|
+
];
|
|
485
|
+
const resizes = [
|
|
486
|
+
["resize-x", { resize: "horizontal" }],
|
|
487
|
+
["resize-y", { resize: "vertical" }],
|
|
488
|
+
["resize", { resize: "both" }],
|
|
489
|
+
["resize-none", { resize: "none" }]
|
|
490
|
+
];
|
|
491
|
+
const userSelects = [
|
|
492
|
+
[/^select-(text|all|auto)$/, ([, v]) => ({ "user-select": v })],
|
|
493
|
+
["select-none", { "user-select": "none" }]
|
|
494
|
+
];
|
|
495
|
+
const whitespaces = [
|
|
496
|
+
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
497
|
+
];
|
|
498
|
+
const contents = [
|
|
499
|
+
["content-empty", { content: '""' }]
|
|
500
|
+
];
|
|
501
|
+
const breaks = [
|
|
502
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
503
|
+
["break-word", { "overflow-wrap": "break-word" }],
|
|
504
|
+
["break-all", { "word-break": "break-all" }]
|
|
505
|
+
];
|
|
506
|
+
const textOverflows = [
|
|
507
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
508
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
509
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
510
|
+
];
|
|
511
|
+
const textTransforms = [
|
|
512
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
513
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
514
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
515
|
+
["case-normal", { "text-transform": "none" }]
|
|
516
|
+
];
|
|
517
|
+
const fontStyles = [
|
|
518
|
+
["italic", { "font-style": "italic" }],
|
|
519
|
+
["not-italic", { "font-style": "normal" }]
|
|
520
|
+
];
|
|
521
|
+
const fontSmoothings = [
|
|
522
|
+
["antialiased", {
|
|
523
|
+
"-webkit-font-smoothing": "antialiased",
|
|
524
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
525
|
+
"font-smoothing": "grayscale"
|
|
526
|
+
}],
|
|
527
|
+
["subpixel-antialiased", {
|
|
528
|
+
"-webkit-font-smoothing": "auto",
|
|
529
|
+
"-moz-osx-font-smoothing": "auto",
|
|
530
|
+
"font-smoothing": "auto"
|
|
531
|
+
}]
|
|
532
|
+
];
|
|
533
|
+
|
|
590
534
|
const rings = [
|
|
591
535
|
[/^ring-?(.*)$/, ([, d]) => {
|
|
592
|
-
const value =
|
|
536
|
+
const value = utilities.handler.px(d || "1");
|
|
593
537
|
if (value) {
|
|
594
538
|
return {
|
|
595
|
-
"--un-ring-inset":
|
|
539
|
+
"--un-ring-inset": varEmpty,
|
|
596
540
|
"--un-ring-offset-width": "0px",
|
|
597
541
|
"--un-ring-offset-color": "#fff",
|
|
598
542
|
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
599
543
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
600
544
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
601
|
-
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
602
|
-
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)
|
|
545
|
+
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
|
|
546
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
603
547
|
};
|
|
604
548
|
}
|
|
605
549
|
}],
|
|
606
|
-
[
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
};
|
|
612
|
-
}
|
|
550
|
+
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
551
|
+
[/^ring-offset-(.+)$/, ([, d]) => {
|
|
552
|
+
const value = utilities.handler.px(d || "1");
|
|
553
|
+
if (value)
|
|
554
|
+
return { "--un-ring-offset-width": value };
|
|
613
555
|
}],
|
|
614
556
|
["ring-inset", { "--un-ring-inset": "inset" }],
|
|
615
557
|
...ringColors,
|
|
@@ -617,7 +559,7 @@ const rings = [
|
|
|
617
559
|
];
|
|
618
560
|
|
|
619
561
|
const colorResolver = (body, theme) => {
|
|
620
|
-
const data =
|
|
562
|
+
const data = utilities.parseColor(body, theme);
|
|
621
563
|
if (!data)
|
|
622
564
|
return;
|
|
623
565
|
const { color, rgba } = data;
|
|
@@ -635,7 +577,7 @@ const colorResolver = (body, theme) => {
|
|
|
635
577
|
};
|
|
636
578
|
const boxShadows = [
|
|
637
579
|
[/^shadow-?(.*)$/, ([, d], { theme }) => {
|
|
638
|
-
const value = theme
|
|
580
|
+
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
639
581
|
if (value) {
|
|
640
582
|
return {
|
|
641
583
|
"--un-shadow-color": "0,0,0",
|
|
@@ -655,12 +597,12 @@ function getPropName(minmax, hw) {
|
|
|
655
597
|
function getThemeValue(minmax, hw, theme, prop) {
|
|
656
598
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
657
599
|
if (minmax)
|
|
658
|
-
str = `${minmax}${
|
|
600
|
+
str = `${minmax}${utilities.capitalize(str)}`;
|
|
659
601
|
return theme[str]?.[prop];
|
|
660
602
|
}
|
|
661
603
|
const sizes = [
|
|
662
604
|
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
663
|
-
const v = getThemeValue(m, w, theme, s) ||
|
|
605
|
+
const v = getThemeValue(m, w, theme, s) || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
|
|
664
606
|
if (v != null)
|
|
665
607
|
return { [getPropName(m, w)]: v };
|
|
666
608
|
}],
|
|
@@ -673,106 +615,30 @@ const sizes = [
|
|
|
673
615
|
const aspectRatio = [
|
|
674
616
|
["aspect-ratio-auto", { "aspect-ratio": "auto" }],
|
|
675
617
|
[/^aspect-ratio-(.+)$/, ([, d]) => {
|
|
676
|
-
const v = (/^\d+\/\d+$/.test(d) ? d : null) ||
|
|
618
|
+
const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
|
|
677
619
|
if (v != null)
|
|
678
620
|
return { "aspect-ratio": v };
|
|
679
621
|
}]
|
|
680
622
|
];
|
|
681
623
|
|
|
682
|
-
const directionSize = (prefix) => ([_, direction, size]) => {
|
|
683
|
-
const v = index.handler.bracket.rem.fraction.cssvar(size);
|
|
684
|
-
if (v)
|
|
685
|
-
return index.directionMap[direction].map((i) => [prefix + i, v]);
|
|
686
|
-
};
|
|
687
624
|
const paddings = [
|
|
688
|
-
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
689
|
-
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
690
|
-
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
625
|
+
[/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
|
|
626
|
+
[/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
|
|
627
|
+
[/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
|
|
691
628
|
];
|
|
692
629
|
const margins = [
|
|
693
|
-
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
694
|
-
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
695
|
-
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
696
|
-
];
|
|
697
|
-
|
|
698
|
-
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
699
|
-
const displays = [
|
|
700
|
-
["inline", { display: "inline" }],
|
|
701
|
-
["block", { display: "block" }],
|
|
702
|
-
["inline-block", { display: "inline-block" }],
|
|
703
|
-
["contents", { display: "contents" }],
|
|
704
|
-
["flow-root", { display: "flow-root" }],
|
|
705
|
-
["list-item", { display: "list-item" }],
|
|
706
|
-
["hidden", { display: "none" }]
|
|
707
|
-
];
|
|
708
|
-
const appearances = [
|
|
709
|
-
["visible", { visibility: "visible" }],
|
|
710
|
-
["invisible", { visibility: "hidden" }],
|
|
711
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
712
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
713
|
-
];
|
|
714
|
-
const cursors = [
|
|
715
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
716
|
-
];
|
|
717
|
-
const pointerEvents = [
|
|
718
|
-
["pointer-events-none", { "pointer-events": "none" }],
|
|
719
|
-
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
720
|
-
];
|
|
721
|
-
const resizes = [
|
|
722
|
-
["resize-none", { resize: "none" }],
|
|
723
|
-
["resize-x", { resize: "horizontal" }],
|
|
724
|
-
["resize-y", { resize: "vertical" }],
|
|
725
|
-
["resize", { resize: "both" }]
|
|
726
|
-
];
|
|
727
|
-
const userSelects = [
|
|
728
|
-
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
729
|
-
];
|
|
730
|
-
const whitespaces = [
|
|
731
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
732
|
-
];
|
|
733
|
-
const contents = [
|
|
734
|
-
["content-empty", { content: '""' }]
|
|
735
|
-
];
|
|
736
|
-
const breaks = [
|
|
737
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
738
|
-
["break-word", { "overflow-wrap": "break-word" }],
|
|
739
|
-
["break-all", { "word-break": "break-all" }]
|
|
740
|
-
];
|
|
741
|
-
const textOverflows = [
|
|
742
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
743
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
744
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
745
|
-
];
|
|
746
|
-
const textTransforms = [
|
|
747
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
748
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
749
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
750
|
-
["case-normal", { "text-transform": "none" }]
|
|
751
|
-
];
|
|
752
|
-
const fontStyles = [
|
|
753
|
-
["italic", { "font-style": "italic" }],
|
|
754
|
-
["not-italic", { "font-style": "normal" }]
|
|
755
|
-
];
|
|
756
|
-
const fontSmoothings = [
|
|
757
|
-
["antialiased", {
|
|
758
|
-
"-webkit-font-smoothing": "antialiased",
|
|
759
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
760
|
-
"font-smoothing": "grayscale"
|
|
761
|
-
}],
|
|
762
|
-
["subpixel-antialiased", {
|
|
763
|
-
"-webkit-font-smoothing": "auto",
|
|
764
|
-
"-moz-osx-font-smoothing": "auto",
|
|
765
|
-
"font-smoothing": "auto"
|
|
766
|
-
}]
|
|
630
|
+
[/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
|
|
631
|
+
[/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
|
|
632
|
+
[/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
|
|
767
633
|
];
|
|
768
634
|
|
|
769
635
|
const transformGpu = {
|
|
770
636
|
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
771
|
-
[pseudo.
|
|
637
|
+
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
772
638
|
};
|
|
773
639
|
const transformCpu = {
|
|
774
640
|
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
|
|
775
|
-
[pseudo.
|
|
641
|
+
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
776
642
|
};
|
|
777
643
|
const transformBase = {
|
|
778
644
|
"--un-rotate": 0,
|
|
@@ -789,11 +655,12 @@ const transformBase = {
|
|
|
789
655
|
const transforms = [
|
|
790
656
|
["transform", transformBase],
|
|
791
657
|
[/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
|
|
792
|
-
[/^translate()-(
|
|
793
|
-
[/^translate-([xyz])-(
|
|
794
|
-
[/^scale()-(
|
|
795
|
-
[/^scale-([xyz])-(
|
|
796
|
-
[/^rotate-(
|
|
658
|
+
[/^translate()-(.+)$/, handleTranslate],
|
|
659
|
+
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
660
|
+
[/^scale()-(.+)$/, handleScale],
|
|
661
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
662
|
+
[/^rotate-(.+)$/, handleRotate],
|
|
663
|
+
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
797
664
|
["transform-gpu", transformGpu],
|
|
798
665
|
["transform-cpu", transformCpu],
|
|
799
666
|
["transform-none", { transform: "none" }],
|
|
@@ -808,29 +675,29 @@ const transforms = [
|
|
|
808
675
|
["origin-top-left", { "transform-origin": "top left" }]
|
|
809
676
|
];
|
|
810
677
|
function handleTranslate([, d, b]) {
|
|
811
|
-
const v =
|
|
678
|
+
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
|
812
679
|
if (v != null) {
|
|
813
680
|
return [
|
|
814
681
|
transformBase,
|
|
815
682
|
[
|
|
816
|
-
...
|
|
683
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
817
684
|
]
|
|
818
685
|
];
|
|
819
686
|
}
|
|
820
687
|
}
|
|
821
688
|
function handleScale([, d, b]) {
|
|
822
|
-
const v =
|
|
689
|
+
const v = utilities.handler.bracket.fraction.percent(b);
|
|
823
690
|
if (v != null) {
|
|
824
691
|
return [
|
|
825
692
|
transformBase,
|
|
826
693
|
[
|
|
827
|
-
...
|
|
694
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
828
695
|
]
|
|
829
696
|
];
|
|
830
697
|
}
|
|
831
698
|
}
|
|
832
|
-
function
|
|
833
|
-
const v =
|
|
699
|
+
function handleRotateWithUnit([, b]) {
|
|
700
|
+
const v = utilities.handler.bracket.number(b);
|
|
834
701
|
if (v != null) {
|
|
835
702
|
return [
|
|
836
703
|
transformBase,
|
|
@@ -838,6 +705,15 @@ function handleRotate([, b]) {
|
|
|
838
705
|
];
|
|
839
706
|
}
|
|
840
707
|
}
|
|
708
|
+
function handleRotate([, b]) {
|
|
709
|
+
const v = utilities.handler.bracket(b);
|
|
710
|
+
if (v != null) {
|
|
711
|
+
return [
|
|
712
|
+
transformBase,
|
|
713
|
+
{ "--un-rotate": v }
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
}
|
|
841
717
|
|
|
842
718
|
const variablesAbbrMap = {
|
|
843
719
|
"visible": "visibility",
|
|
@@ -878,8 +754,8 @@ const cssVariables = [
|
|
|
878
754
|
}
|
|
879
755
|
}],
|
|
880
756
|
[/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
|
|
881
|
-
if (a in
|
|
882
|
-
return
|
|
757
|
+
if (a in utilities.directionMap)
|
|
758
|
+
return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
|
|
883
759
|
}]
|
|
884
760
|
];
|
|
885
761
|
|
|
@@ -887,7 +763,7 @@ const questionMark = [
|
|
|
887
763
|
[
|
|
888
764
|
/^(where|\?)$/,
|
|
889
765
|
(_, { constructCSS, generator }) => {
|
|
890
|
-
if (generator.
|
|
766
|
+
if (generator.userConfig.envMode === "dev")
|
|
891
767
|
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}}
|
|
892
768
|
${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
893
769
|
}
|
|
@@ -897,20 +773,18 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
897
773
|
const textDecorations = [
|
|
898
774
|
["underline", { "text-decoration": "underline" }],
|
|
899
775
|
["line-through", { "text-decoration": "line-through" }],
|
|
900
|
-
["no-underline", { "text-decoration": "none" }],
|
|
901
776
|
["decoration-underline", { "text-decoration": "underline" }],
|
|
902
777
|
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
903
|
-
["decoration-none", { "text-decoration": "none" }],
|
|
904
778
|
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
905
|
-
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s :
|
|
906
|
-
[/^decoration-(
|
|
779
|
+
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : utilities.handler.bracket.px(s) })],
|
|
780
|
+
[/^decoration-(.+)$/, ([, d]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(d) })],
|
|
907
781
|
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
908
|
-
const v = s === "auto" ? s :
|
|
782
|
+
const v = s === "auto" ? s : utilities.handler.bracket.px(s);
|
|
909
783
|
if (v != null)
|
|
910
784
|
return { "text-underline-offset": v };
|
|
911
785
|
}],
|
|
912
786
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
913
|
-
const result = colorResolver
|
|
787
|
+
const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
|
|
914
788
|
if (result) {
|
|
915
789
|
return {
|
|
916
790
|
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
@@ -918,7 +792,23 @@ const textDecorations = [
|
|
|
918
792
|
};
|
|
919
793
|
}
|
|
920
794
|
}],
|
|
921
|
-
[/^(?:underline|decoration)-op(?:acity)?-?(.+)
|
|
795
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
796
|
+
["no-underline", { "text-decoration": "none" }],
|
|
797
|
+
["decoration-none", { "text-decoration": "none" }]
|
|
798
|
+
];
|
|
799
|
+
|
|
800
|
+
const svgUtilities = [
|
|
801
|
+
[/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
|
|
802
|
+
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
803
|
+
["fill-none", { fill: "none" }],
|
|
804
|
+
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
|
|
805
|
+
const v = utilities.handler.bracket.fraction.px.number(s);
|
|
806
|
+
if (v)
|
|
807
|
+
return { "stroke-width": v };
|
|
808
|
+
}],
|
|
809
|
+
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
810
|
+
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
811
|
+
["stroke-none", { stroke: "none" }]
|
|
922
812
|
];
|
|
923
813
|
|
|
924
814
|
const rules = [
|
|
@@ -928,7 +818,7 @@ const rules = [
|
|
|
928
818
|
displays,
|
|
929
819
|
opacity,
|
|
930
820
|
bgColors,
|
|
931
|
-
|
|
821
|
+
svgUtilities,
|
|
932
822
|
borders,
|
|
933
823
|
contents,
|
|
934
824
|
fonts,
|
|
@@ -974,6 +864,7 @@ const rules = [
|
|
|
974
864
|
boxSizing,
|
|
975
865
|
transitions,
|
|
976
866
|
transforms,
|
|
867
|
+
willChange,
|
|
977
868
|
questionMark
|
|
978
869
|
].flat(1);
|
|
979
870
|
|
|
@@ -987,12 +878,10 @@ exports.borders = borders;
|
|
|
987
878
|
exports.boxShadows = boxShadows;
|
|
988
879
|
exports.boxSizing = boxSizing;
|
|
989
880
|
exports.breaks = breaks;
|
|
990
|
-
exports.colorResolver = colorResolver$1;
|
|
991
881
|
exports.contents = contents;
|
|
992
882
|
exports.cssVariables = cssVariables;
|
|
993
883
|
exports.cursors = cursors;
|
|
994
884
|
exports.displays = displays;
|
|
995
|
-
exports.fillColors = fillColors;
|
|
996
885
|
exports.flex = flex;
|
|
997
886
|
exports.floats = floats;
|
|
998
887
|
exports.fontSmoothings = fontSmoothings;
|
|
@@ -1008,7 +897,6 @@ exports.orders = orders;
|
|
|
1008
897
|
exports.outline = outline;
|
|
1009
898
|
exports.overflows = overflows;
|
|
1010
899
|
exports.paddings = paddings;
|
|
1011
|
-
exports.parseColorUtil = parseColorUtil;
|
|
1012
900
|
exports.placeholder = placeholder;
|
|
1013
901
|
exports.placements = placements;
|
|
1014
902
|
exports.pointerEvents = pointerEvents;
|
|
@@ -1020,6 +908,7 @@ exports.ringOffsetColors = ringOffsetColors;
|
|
|
1020
908
|
exports.rings = rings;
|
|
1021
909
|
exports.rules = rules;
|
|
1022
910
|
exports.sizes = sizes;
|
|
911
|
+
exports.svgUtilities = svgUtilities;
|
|
1023
912
|
exports.tabSizes = tabSizes;
|
|
1024
913
|
exports.textAligns = textAligns;
|
|
1025
914
|
exports.textColors = textColors;
|
|
@@ -1035,4 +924,5 @@ exports.userSelects = userSelects;
|
|
|
1035
924
|
exports.varEmpty = varEmpty;
|
|
1036
925
|
exports.verticalAligns = verticalAligns;
|
|
1037
926
|
exports.whitespaces = whitespaces;
|
|
927
|
+
exports.willChange = willChange;
|
|
1038
928
|
exports.zIndexes = zIndexes;
|