@unocss/preset-mini 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/colors.d.ts +1 -0
- package/dist/chunks/colors.cjs +339 -0
- package/dist/chunks/colors.mjs +337 -0
- package/dist/chunks/default.cjs +226 -0
- package/dist/chunks/default.mjs +206 -0
- package/dist/chunks/default2.cjs +1077 -0
- package/dist/chunks/default2.mjs +997 -0
- package/dist/chunks/default3.cjs +128 -0
- package/dist/chunks/default3.mjs +119 -0
- package/dist/chunks/index.cjs +169 -0
- package/dist/chunks/index.mjs +153 -0
- package/dist/chunks/pseudo.cjs +106 -0
- package/dist/chunks/pseudo.mjs +101 -0
- package/dist/chunks/variants.cjs +14 -0
- package/dist/chunks/variants.mjs +12 -0
- package/dist/colors-d6b5a5b4.d.ts +5 -0
- package/dist/colors.cjs +9 -0
- package/dist/colors.d.ts +2 -0
- package/dist/colors.mjs +1 -0
- package/dist/default-c7c67d23.d.ts +5 -0
- package/dist/index.cjs +28 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.mjs +22 -0
- package/dist/rules.cjs +90 -0
- package/dist/rules.d.ts +122 -0
- package/dist/rules.mjs +4 -0
- package/dist/theme.cjs +29 -0
- package/dist/theme.d.ts +157 -0
- package/dist/theme.mjs +2 -0
- package/dist/types-7963d0b3.d.ts +24 -0
- package/dist/utils.cjs +25 -0
- package/dist/utils.d.ts +56 -0
- package/dist/utils.mjs +2 -0
- package/dist/variants.cjs +23 -0
- package/dist/variants.d.ts +22 -0
- package/dist/variants.mjs +4 -0
- package/package.json +70 -0
- package/rules.d.ts +1 -0
- package/theme.d.ts +1 -0
- package/utils.d.ts +1 -0
- package/variants.d.ts +1 -0
|
@@ -0,0 +1,997 @@
|
|
|
1
|
+
import { hex2rgba, toArray } from '@unocss/core';
|
|
2
|
+
import { h as handler, d as directionMap, c as cornerMap, a as capitalize, x as xyzMap } from './index.mjs';
|
|
3
|
+
import { C as CONTROL_BYPASS_PSEUDO } from './pseudo.mjs';
|
|
4
|
+
|
|
5
|
+
const verticalAlignAlias = {
|
|
6
|
+
mid: "middle",
|
|
7
|
+
base: "baseline",
|
|
8
|
+
btm: "bottom"
|
|
9
|
+
};
|
|
10
|
+
const verticalAligns = [
|
|
11
|
+
[/^(?:vertical|align|v)-(baseline|top|bottom|middle|text-top|text-bottom|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
|
|
12
|
+
];
|
|
13
|
+
const textAligns = [
|
|
14
|
+
["text-center", { "text-align": "center" }],
|
|
15
|
+
["text-left", { "text-align": "left" }],
|
|
16
|
+
["text-right", { "text-align": "right" }],
|
|
17
|
+
["text-justify", { "text-align": "justify" }]
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const parseColorUtil = (body, theme) => {
|
|
21
|
+
const [main, opacity2] = body.split(/(?:\/|:)/);
|
|
22
|
+
const [name, no = "DEFAULT"] = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
23
|
+
if (!name)
|
|
24
|
+
return;
|
|
25
|
+
let color;
|
|
26
|
+
const bracket = handler.bracket(main) || main;
|
|
27
|
+
if (bracket.startsWith("#"))
|
|
28
|
+
color = bracket.slice(1);
|
|
29
|
+
if (bracket.startsWith("hex-"))
|
|
30
|
+
color = bracket.slice(4);
|
|
31
|
+
if (!color) {
|
|
32
|
+
const colorData = theme.colors?.[name];
|
|
33
|
+
if (typeof colorData === "string")
|
|
34
|
+
color = colorData;
|
|
35
|
+
else if (no && colorData)
|
|
36
|
+
color = colorData[no];
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
opacity: opacity2,
|
|
40
|
+
name,
|
|
41
|
+
no,
|
|
42
|
+
color,
|
|
43
|
+
rgba: hex2rgba(color)
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const colorResolver$1 = (attribute, varName) => ([, body], { theme }) => {
|
|
47
|
+
const data = parseColorUtil(body, theme);
|
|
48
|
+
if (!data)
|
|
49
|
+
return;
|
|
50
|
+
const { opacity: opacity2, color, rgba } = data;
|
|
51
|
+
if (!color)
|
|
52
|
+
return;
|
|
53
|
+
const a = opacity2 ? opacity2[0] === "[" ? handler.bracket.percent(opacity2) : parseFloat(opacity2) / 100 : rgba?.[3];
|
|
54
|
+
if (rgba) {
|
|
55
|
+
if (a != null && !Number.isNaN(a)) {
|
|
56
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
57
|
+
return {
|
|
58
|
+
[attribute]: `rgba(${rgba.join(",")})`
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
return {
|
|
62
|
+
[`--un-${varName}-opacity`]: 1,
|
|
63
|
+
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
return {
|
|
68
|
+
[attribute]: color.replace("%alpha", `${a || 1}`)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const opacity = [
|
|
73
|
+
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
|
|
74
|
+
];
|
|
75
|
+
const textColors = [
|
|
76
|
+
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
77
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
78
|
+
];
|
|
79
|
+
const textDecorationColors = [
|
|
80
|
+
[/^underline-(.+)$/, (match, ctx) => {
|
|
81
|
+
const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
|
|
82
|
+
if (result) {
|
|
83
|
+
return {
|
|
84
|
+
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
85
|
+
...result
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}],
|
|
89
|
+
[/^underline-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-line-opacity": handler.bracket.percent(opacity2) })]
|
|
90
|
+
];
|
|
91
|
+
const textStrokeColors = [
|
|
92
|
+
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
93
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity2) })]
|
|
94
|
+
];
|
|
95
|
+
const bgColors = [
|
|
96
|
+
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
97
|
+
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
98
|
+
];
|
|
99
|
+
const borderColors = [
|
|
100
|
+
[/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
|
|
101
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-border-opacity": handler.bracket.percent(opacity2) })]
|
|
102
|
+
];
|
|
103
|
+
const ringColors = [
|
|
104
|
+
[/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
|
|
105
|
+
[/^ring-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity2) })]
|
|
106
|
+
];
|
|
107
|
+
const ringOffsetColors = [
|
|
108
|
+
[/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
|
|
109
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity2) })]
|
|
110
|
+
];
|
|
111
|
+
const fillColors = [
|
|
112
|
+
["fill-none", { fill: "none" }],
|
|
113
|
+
[/^fill-(.+)$/, colorResolver$1("fill", "fill")],
|
|
114
|
+
[/^fill-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity2) })]
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
const outlineStyle = ["none", "auto", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset", "inherit", "initial", "revert", "unset"];
|
|
118
|
+
const parseOutlineSize = (s) => {
|
|
119
|
+
const propName = ["width", "offset"].find((item) => s.startsWith(item)) || "width";
|
|
120
|
+
const size = handler.bracket.fraction.rem(s.replace(/^(offset\-|width\-)/, ""));
|
|
121
|
+
if (size) {
|
|
122
|
+
return {
|
|
123
|
+
[`outline-${propName}`]: size
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const outline = [
|
|
128
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
|
|
129
|
+
["outline", { "outline-style": "solid" }],
|
|
130
|
+
[
|
|
131
|
+
/^outline-(.+)$/,
|
|
132
|
+
(match, config) => {
|
|
133
|
+
const [, d] = match;
|
|
134
|
+
if (d === "none") {
|
|
135
|
+
return {
|
|
136
|
+
"outline": "2px solid transparent",
|
|
137
|
+
"outline-offset": "2px"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (outlineStyle.includes(d)) {
|
|
141
|
+
return {
|
|
142
|
+
"outline-style": d
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const sizeSheet = parseOutlineSize(d);
|
|
146
|
+
if (sizeSheet)
|
|
147
|
+
return sizeSheet;
|
|
148
|
+
const colorSheet = colorResolver$1("outline-color", "outline-color")([
|
|
149
|
+
match[0],
|
|
150
|
+
match[1].replace(/^color-/, "")
|
|
151
|
+
], config);
|
|
152
|
+
if (colorSheet)
|
|
153
|
+
return colorSheet;
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
];
|
|
157
|
+
const appearance = [
|
|
158
|
+
["appearance-none", {
|
|
159
|
+
"appearance": "none",
|
|
160
|
+
"-webkit-appearance": "none"
|
|
161
|
+
}]
|
|
162
|
+
];
|
|
163
|
+
const placeholder = [
|
|
164
|
+
[
|
|
165
|
+
/^placeholder-opacity-(\d+)$/,
|
|
166
|
+
([, d]) => ({
|
|
167
|
+
"placeholder-opacity": handler.bracket.percent(d)
|
|
168
|
+
})
|
|
169
|
+
],
|
|
170
|
+
[
|
|
171
|
+
/^placeholder-(?!opacity)(.+)$/,
|
|
172
|
+
(match, config) => {
|
|
173
|
+
match[1] = match[1].replace(/^color-/, "");
|
|
174
|
+
return colorResolver$1("placeholder-color", "placeholder-color")(match, config);
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
const borderSizes = [
|
|
180
|
+
[/^border$/, handlerBorder],
|
|
181
|
+
[/^(?:border|b)(?:-([^-]+))?$/, handlerBorder],
|
|
182
|
+
[/^(?:border|b)(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder]
|
|
183
|
+
];
|
|
184
|
+
const borderRadius = [
|
|
185
|
+
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
186
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
187
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
188
|
+
];
|
|
189
|
+
const borderStyles = [
|
|
190
|
+
["border-solid", { "border-style": "solid" }],
|
|
191
|
+
["border-dashed", { "border-style": "dashed" }],
|
|
192
|
+
["border-dotted", { "border-style": "dotted" }],
|
|
193
|
+
["border-double", { "border-style": "double" }],
|
|
194
|
+
["border-none", { "border-style": "none" }]
|
|
195
|
+
];
|
|
196
|
+
const borders = [
|
|
197
|
+
borderSizes,
|
|
198
|
+
borderColors,
|
|
199
|
+
borderStyles,
|
|
200
|
+
borderRadius
|
|
201
|
+
].flat(1);
|
|
202
|
+
function handlerBorder([, a, b]) {
|
|
203
|
+
const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
|
|
204
|
+
const v = handler.bracket.px(s);
|
|
205
|
+
if (v != null) {
|
|
206
|
+
return [
|
|
207
|
+
...directionMap[d].map((i) => [`border${i}-width`, v]),
|
|
208
|
+
["border-style", "solid"]
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function handlerRounded([, a, b], { theme }) {
|
|
213
|
+
const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
|
|
214
|
+
const v = theme.borderRadius?.[s] || handler.bracket.fraction.rem(s);
|
|
215
|
+
if (v != null)
|
|
216
|
+
return cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const transitionBasicProps = [
|
|
220
|
+
"color",
|
|
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"
|
|
237
|
+
];
|
|
238
|
+
const transitionPositionProps = [
|
|
239
|
+
"backround-position",
|
|
240
|
+
"left",
|
|
241
|
+
"right",
|
|
242
|
+
"top",
|
|
243
|
+
"bottom",
|
|
244
|
+
"object-position"
|
|
245
|
+
];
|
|
246
|
+
const transitionSizeProps = [
|
|
247
|
+
"max-height",
|
|
248
|
+
"min-height",
|
|
249
|
+
"max-width",
|
|
250
|
+
"min-width",
|
|
251
|
+
"height",
|
|
252
|
+
"width",
|
|
253
|
+
"border-width",
|
|
254
|
+
"margin",
|
|
255
|
+
"padding",
|
|
256
|
+
"outline-width",
|
|
257
|
+
"outline-offset",
|
|
258
|
+
"font-size",
|
|
259
|
+
"line-height",
|
|
260
|
+
"text-indent",
|
|
261
|
+
"vertical-align",
|
|
262
|
+
"border-spacing",
|
|
263
|
+
"letter-spacing",
|
|
264
|
+
"word-spacing"
|
|
265
|
+
];
|
|
266
|
+
const transitionSwitchProps = ["all", "none"];
|
|
267
|
+
const transitionEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
268
|
+
const transitionProps = [
|
|
269
|
+
...transitionBasicProps,
|
|
270
|
+
...transitionPositionProps,
|
|
271
|
+
...transitionSizeProps,
|
|
272
|
+
...transitionEnhanceProps
|
|
273
|
+
];
|
|
274
|
+
const transitionPropsStr = transitionProps.join(", ");
|
|
275
|
+
const validateProperty = (prop) => {
|
|
276
|
+
if (prop && ![...transitionProps, ...transitionSwitchProps].includes(prop))
|
|
277
|
+
return;
|
|
278
|
+
return prop || transitionPropsStr;
|
|
279
|
+
};
|
|
280
|
+
const transitions = [
|
|
281
|
+
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
282
|
+
const transitionProperty = validateProperty(prop);
|
|
283
|
+
if (!transitionProperty)
|
|
284
|
+
return;
|
|
285
|
+
return {
|
|
286
|
+
"transition-property": transitionProperty,
|
|
287
|
+
"transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
288
|
+
"transition-duration": `${duration}ms`
|
|
289
|
+
};
|
|
290
|
+
}],
|
|
291
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
292
|
+
return {
|
|
293
|
+
"transition-duration": `${duration}ms`
|
|
294
|
+
};
|
|
295
|
+
}],
|
|
296
|
+
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
297
|
+
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
298
|
+
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
299
|
+
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
300
|
+
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
301
|
+
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
302
|
+
[/^(?:transition-)?property-([a-z-]+)$/, ([, v]) => {
|
|
303
|
+
const transitionProperty = validateProperty(v);
|
|
304
|
+
if (transitionProperty)
|
|
305
|
+
return { "transition-property": transitionProperty };
|
|
306
|
+
}]
|
|
307
|
+
];
|
|
308
|
+
|
|
309
|
+
const flex = [
|
|
310
|
+
["flex-col", { "flex-direction": "column" }],
|
|
311
|
+
["flex-col-reverse", { "flex-direction": "column-reverse" }],
|
|
312
|
+
["flex-row", { "flex-direction": "row" }],
|
|
313
|
+
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
314
|
+
["flex-wrap", { "flex-wrap": "wrap" }],
|
|
315
|
+
["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
|
|
316
|
+
["flex-nowrap", { "flex-wrap": "nowrap" }],
|
|
317
|
+
["flex-1", { flex: "1 1 0%" }],
|
|
318
|
+
["flex-auto", { flex: "1 1 auto" }],
|
|
319
|
+
["flex-initial", { flex: "0 1 auto" }],
|
|
320
|
+
["flex-none", { flex: "none" }],
|
|
321
|
+
[/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
|
|
322
|
+
["flex-grow", { "flex-grow": 1 }],
|
|
323
|
+
["flex-grow-0", { "flex-grow": 0 }],
|
|
324
|
+
["flex-shrink", { "flex-shrink": 1 }],
|
|
325
|
+
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
326
|
+
["flex", { display: "flex" }],
|
|
327
|
+
["inline-flex", { display: "inline-flex" }],
|
|
328
|
+
["flex-inline", { display: "inline-flex" }]
|
|
329
|
+
];
|
|
330
|
+
|
|
331
|
+
const fontsFamilies = [
|
|
332
|
+
[/^font-(\w+)$/, ([, d], { theme }) => {
|
|
333
|
+
const font = theme.fontFamily?.[d];
|
|
334
|
+
if (font) {
|
|
335
|
+
return {
|
|
336
|
+
"font-family": font
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}]
|
|
340
|
+
];
|
|
341
|
+
const weightMap = {
|
|
342
|
+
thin: "100",
|
|
343
|
+
extralight: "200",
|
|
344
|
+
light: "300",
|
|
345
|
+
normal: "400",
|
|
346
|
+
medium: "500",
|
|
347
|
+
semibold: "600",
|
|
348
|
+
bold: "700",
|
|
349
|
+
extrabold: "800",
|
|
350
|
+
black: "900"
|
|
351
|
+
};
|
|
352
|
+
const fontSizes = [
|
|
353
|
+
[/^text-([^-]+)$/, ([, s = "base"], { theme }) => {
|
|
354
|
+
const result = toArray(theme.fontSize?.[s] || handler.bracket.rem(s));
|
|
355
|
+
if (result?.[0]) {
|
|
356
|
+
const [size, height = "1"] = result;
|
|
357
|
+
return {
|
|
358
|
+
"font-size": size,
|
|
359
|
+
"line-height": height
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}]
|
|
363
|
+
];
|
|
364
|
+
const fontWeights = [
|
|
365
|
+
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
366
|
+
const v = weightMap[s] || handler.number(s);
|
|
367
|
+
if (v)
|
|
368
|
+
return { "font-weight": v };
|
|
369
|
+
}]
|
|
370
|
+
];
|
|
371
|
+
const leadings = [
|
|
372
|
+
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
373
|
+
const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
|
|
374
|
+
if (v !== null)
|
|
375
|
+
return { "line-height": v };
|
|
376
|
+
}]
|
|
377
|
+
];
|
|
378
|
+
const trackings = [
|
|
379
|
+
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
380
|
+
const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
|
|
381
|
+
if (v !== null)
|
|
382
|
+
return { "letter-spacing": v };
|
|
383
|
+
}]
|
|
384
|
+
];
|
|
385
|
+
const wordSpacings = [
|
|
386
|
+
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
387
|
+
const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
|
|
388
|
+
if (v !== null)
|
|
389
|
+
return { "word-spacing": v };
|
|
390
|
+
}]
|
|
391
|
+
];
|
|
392
|
+
const tabSizes = [
|
|
393
|
+
[/^tab-?([^-]*)$/, ([, s]) => {
|
|
394
|
+
s = s || "4";
|
|
395
|
+
const v = handler.bracket.global.number(s);
|
|
396
|
+
if (v !== null) {
|
|
397
|
+
return {
|
|
398
|
+
"-moz-tab-size": v,
|
|
399
|
+
"-o-tab-size": v,
|
|
400
|
+
"tab-size": v
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}]
|
|
404
|
+
];
|
|
405
|
+
const textDecorationLengths = [
|
|
406
|
+
[/^underline-([^-]+)$/, ([, s]) => {
|
|
407
|
+
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
408
|
+
if (v != null)
|
|
409
|
+
return { "text-decoration-thickness": v };
|
|
410
|
+
}]
|
|
411
|
+
];
|
|
412
|
+
const textDecorationOffsets = [
|
|
413
|
+
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
414
|
+
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
415
|
+
if (v != null)
|
|
416
|
+
return { "text-underline-offset": v };
|
|
417
|
+
}]
|
|
418
|
+
];
|
|
419
|
+
const textIndents = [
|
|
420
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
421
|
+
const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s);
|
|
422
|
+
if (v != null)
|
|
423
|
+
return { "text-indent": v };
|
|
424
|
+
}]
|
|
425
|
+
];
|
|
426
|
+
const textStrokeWidths = [
|
|
427
|
+
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
428
|
+
const v = theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s);
|
|
429
|
+
if (v != null)
|
|
430
|
+
return { "-webkit-text-stroke-width": v };
|
|
431
|
+
}]
|
|
432
|
+
];
|
|
433
|
+
const textShadows = [
|
|
434
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
435
|
+
const v = theme.textShadow?.[s || "DEFAULT"] || handler.bracket.cssvar(s);
|
|
436
|
+
if (v != null)
|
|
437
|
+
return { "text-shadow": v };
|
|
438
|
+
}]
|
|
439
|
+
];
|
|
440
|
+
const fonts = [
|
|
441
|
+
fontsFamilies,
|
|
442
|
+
fontSizes,
|
|
443
|
+
fontWeights
|
|
444
|
+
].flat(1);
|
|
445
|
+
|
|
446
|
+
const gaps = [
|
|
447
|
+
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
448
|
+
const v = handler.bracket.rem(s);
|
|
449
|
+
if (v != null) {
|
|
450
|
+
return {
|
|
451
|
+
"grid-gap": v,
|
|
452
|
+
"gap": v
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
}],
|
|
456
|
+
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
457
|
+
const v = handler.bracket.rem(s);
|
|
458
|
+
if (v != null) {
|
|
459
|
+
return {
|
|
460
|
+
"grid-column-gap": v,
|
|
461
|
+
"column-gap": v
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}],
|
|
465
|
+
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
466
|
+
const v = handler.bracket.rem(s);
|
|
467
|
+
if (v != null) {
|
|
468
|
+
return {
|
|
469
|
+
"grid-row-gap": v,
|
|
470
|
+
"row-gap": v
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}]
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.rem(s))[0];
|
|
477
|
+
const autoDirection = (selector, theme) => {
|
|
478
|
+
if (selector === "min")
|
|
479
|
+
return "min-content";
|
|
480
|
+
else if (selector === "max")
|
|
481
|
+
return "max-content";
|
|
482
|
+
else if (selector === "fr")
|
|
483
|
+
return "minmax(0,1fr)";
|
|
484
|
+
return calSize(selector, theme);
|
|
485
|
+
};
|
|
486
|
+
const grids = [
|
|
487
|
+
["grid", { display: "grid" }],
|
|
488
|
+
["inline-grid", { display: "inline-grid" }],
|
|
489
|
+
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
|
|
490
|
+
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
|
|
491
|
+
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
492
|
+
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
493
|
+
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
494
|
+
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })],
|
|
495
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
496
|
+
const key = d === "row" ? "grid-row" : "grid-column";
|
|
497
|
+
let raw = handler.bracket(v);
|
|
498
|
+
if (raw)
|
|
499
|
+
return { [key]: raw };
|
|
500
|
+
const parts = v.split("-");
|
|
501
|
+
if (parts.length === 1 && parts[0] === "auto")
|
|
502
|
+
return { [key]: parts[0] };
|
|
503
|
+
if (parts[0] === "span") {
|
|
504
|
+
if (parts[1] === "full")
|
|
505
|
+
return { [key]: "1/-1" };
|
|
506
|
+
raw = handler.number.bracket(parts[1])?.toString().replace(/_/g, " ");
|
|
507
|
+
if (raw)
|
|
508
|
+
return { [key]: `span ${raw}/span ${raw}` };
|
|
509
|
+
}
|
|
510
|
+
}],
|
|
511
|
+
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
|
|
512
|
+
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
|
|
513
|
+
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
|
|
514
|
+
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
|
|
515
|
+
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
|
|
516
|
+
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
|
|
517
|
+
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })]
|
|
518
|
+
];
|
|
519
|
+
|
|
520
|
+
const overflowValues = [
|
|
521
|
+
"auto",
|
|
522
|
+
"hidden",
|
|
523
|
+
"visible",
|
|
524
|
+
"scroll"
|
|
525
|
+
];
|
|
526
|
+
const overflows = [
|
|
527
|
+
[/^(?:overflow|of)-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0],
|
|
528
|
+
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
529
|
+
];
|
|
530
|
+
|
|
531
|
+
const positions = [
|
|
532
|
+
["relative", { position: "relative" }],
|
|
533
|
+
["absolute", { position: "absolute" }],
|
|
534
|
+
["fixed", { position: "fixed" }],
|
|
535
|
+
["sticky", { position: "sticky" }],
|
|
536
|
+
["static", { position: "static" }]
|
|
537
|
+
];
|
|
538
|
+
const justifies = [
|
|
539
|
+
["justify-start", { "justify-content": "flex-start" }],
|
|
540
|
+
["justify-end", { "justify-content": "flex-end" }],
|
|
541
|
+
["justify-center", { "justify-content": "center" }],
|
|
542
|
+
["justify-between", { "justify-content": "space-between" }],
|
|
543
|
+
["justify-around", { "justify-content": "space-around" }],
|
|
544
|
+
["justify-evenly", { "justify-content": "space-evenly" }]
|
|
545
|
+
];
|
|
546
|
+
const orders = [
|
|
547
|
+
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || handler.bracket.number(v) })]
|
|
548
|
+
];
|
|
549
|
+
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
550
|
+
const justifyItems = basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]);
|
|
551
|
+
const justifySelfs = basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }]);
|
|
552
|
+
const alignContents = [
|
|
553
|
+
["content-start", { "align-content": "flex-start" }],
|
|
554
|
+
["content-end", { "align-content": "flex-end" }],
|
|
555
|
+
["content-center", { "align-content": "center" }],
|
|
556
|
+
["content-between", { "align-content": "space-between" }],
|
|
557
|
+
["content-around", { "align-content": "space-around" }],
|
|
558
|
+
["content-evenly", { "align-content": "space-evenly" }]
|
|
559
|
+
];
|
|
560
|
+
const alignItems = [
|
|
561
|
+
["items-start", { "align-items": "flex-start" }],
|
|
562
|
+
["items-end", { "align-items": "flex-end" }],
|
|
563
|
+
["items-center", { "align-items": "center" }],
|
|
564
|
+
["items-baseline", { "align-items": "baseline" }],
|
|
565
|
+
["items-stretch", { "align-items": "stretch" }]
|
|
566
|
+
];
|
|
567
|
+
const alignSelfs = [
|
|
568
|
+
["self-auto", { "align-self": "auto" }],
|
|
569
|
+
["self-start", { "align-self": "flex-start" }],
|
|
570
|
+
["self-end", { "align-self": "flex-end" }],
|
|
571
|
+
["self-center", { "align-self": "center" }],
|
|
572
|
+
["self-stretch", { "align-items": "stretch" }]
|
|
573
|
+
];
|
|
574
|
+
const placeContents = [
|
|
575
|
+
["place-content-start", { "place-content": "start" }],
|
|
576
|
+
["place-content-end", { "place-content": "end" }],
|
|
577
|
+
["place-content-center", { "place-content": "center" }],
|
|
578
|
+
["place-content-between", { "place-content": "space-between" }],
|
|
579
|
+
["place-content-around", { "place-content": "space-around" }],
|
|
580
|
+
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
581
|
+
["place-content-stretch", { "place-content": "stretch" }]
|
|
582
|
+
];
|
|
583
|
+
const placeItems = basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]);
|
|
584
|
+
const placeSelfs = basicSet.map((i) => [`place-self-${i}`, { "place-self": i }]);
|
|
585
|
+
function handleInsetValue(v) {
|
|
586
|
+
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.rem(v);
|
|
587
|
+
}
|
|
588
|
+
const insets = [
|
|
589
|
+
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
|
|
590
|
+
[/^inset-([xy])-(.+)$/, ([, d, v]) => {
|
|
591
|
+
const r = handleInsetValue(v);
|
|
592
|
+
if (r != null && d in directionMap)
|
|
593
|
+
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
594
|
+
}]
|
|
595
|
+
];
|
|
596
|
+
const floats = [
|
|
597
|
+
[/^float-(left|right|none)$/, ([, value]) => ({ float: value })],
|
|
598
|
+
[/^clear-(left|right|both|none)$/, ([, value]) => ({ clear: value })]
|
|
599
|
+
];
|
|
600
|
+
const zIndexes = [
|
|
601
|
+
["z-auto", { "z-index": "auto" }],
|
|
602
|
+
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": handler.number(v) })]
|
|
603
|
+
];
|
|
604
|
+
const boxSizing = [
|
|
605
|
+
[
|
|
606
|
+
/^box-(border|content)$/,
|
|
607
|
+
([, value]) => ({
|
|
608
|
+
"box-sizing": `${value}-box`
|
|
609
|
+
})
|
|
610
|
+
]
|
|
611
|
+
];
|
|
612
|
+
|
|
613
|
+
const rings = [
|
|
614
|
+
[/^ring-?(.*)$/, ([, d]) => {
|
|
615
|
+
const value = handler.px(d || "1");
|
|
616
|
+
if (value) {
|
|
617
|
+
return {
|
|
618
|
+
"--un-ring-inset": "var(--un-empty, )",
|
|
619
|
+
"--un-ring-offset-width": "0px",
|
|
620
|
+
"--un-ring-offset-color": "#fff",
|
|
621
|
+
"--un-ring-color": "rgba(59, 130, 246, .5)",
|
|
622
|
+
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
623
|
+
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
624
|
+
"-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);",
|
|
625
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000);"
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}],
|
|
629
|
+
[/^ring-offset-?(.*)$/, ([, d]) => {
|
|
630
|
+
const value = handler.px(d || "1");
|
|
631
|
+
if (value) {
|
|
632
|
+
return {
|
|
633
|
+
"--un-ring-offset-width": value
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
}],
|
|
637
|
+
["ring-inset", { "--un-ring-inset": "inset" }],
|
|
638
|
+
...ringColors,
|
|
639
|
+
...ringOffsetColors
|
|
640
|
+
];
|
|
641
|
+
|
|
642
|
+
const colorResolver = (body, theme) => {
|
|
643
|
+
const data = parseColorUtil(body, theme);
|
|
644
|
+
if (!data)
|
|
645
|
+
return;
|
|
646
|
+
const { color, rgba } = data;
|
|
647
|
+
if (!color)
|
|
648
|
+
return;
|
|
649
|
+
if (rgba) {
|
|
650
|
+
return {
|
|
651
|
+
"--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
|
|
652
|
+
};
|
|
653
|
+
} else {
|
|
654
|
+
return {
|
|
655
|
+
"--un-shadow-color": color
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const boxShadows = [
|
|
660
|
+
[/^shadow-?(.*)$/, ([, d], { theme }) => {
|
|
661
|
+
const value = theme?.boxShadow?.[d || "DEFAULT"];
|
|
662
|
+
if (value) {
|
|
663
|
+
return {
|
|
664
|
+
"--un-shadow-color": "0,0,0",
|
|
665
|
+
"--un-shadow": value,
|
|
666
|
+
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
const color = colorResolver(d, theme);
|
|
670
|
+
if (color)
|
|
671
|
+
return color;
|
|
672
|
+
}]
|
|
673
|
+
];
|
|
674
|
+
|
|
675
|
+
function getPropName(minmax, hw) {
|
|
676
|
+
return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
|
|
677
|
+
}
|
|
678
|
+
function getThemeValue(minmax, hw, theme, prop) {
|
|
679
|
+
let str = `${hw === "h" ? "height" : "width"}`;
|
|
680
|
+
if (minmax)
|
|
681
|
+
str = `${minmax}${capitalize(str)}`;
|
|
682
|
+
return theme[str]?.[prop];
|
|
683
|
+
}
|
|
684
|
+
const sizes = [
|
|
685
|
+
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
686
|
+
const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.rem(s);
|
|
687
|
+
if (v != null)
|
|
688
|
+
return { [getPropName(m, w)]: v };
|
|
689
|
+
}],
|
|
690
|
+
[/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => {
|
|
691
|
+
const v = theme.breakpoints?.[s];
|
|
692
|
+
if (v != null)
|
|
693
|
+
return { [getPropName(m, w)]: v };
|
|
694
|
+
}]
|
|
695
|
+
];
|
|
696
|
+
const aspectRatio = [
|
|
697
|
+
["aspect-ratio-auto", { "aspect-ratio": "auto" }],
|
|
698
|
+
[/^aspect-ratio-(.+)$/, ([, d]) => {
|
|
699
|
+
const v = (/^\d+\/\d+$/.test(d) ? d : null) || handler.bracket.cssvar.number(d);
|
|
700
|
+
if (v != null)
|
|
701
|
+
return { "aspect-ratio": v };
|
|
702
|
+
}]
|
|
703
|
+
];
|
|
704
|
+
|
|
705
|
+
const directionSize = (prefix) => ([_, direction, size]) => {
|
|
706
|
+
const v = handler.bracket.rem.fraction.cssvar(size);
|
|
707
|
+
if (v)
|
|
708
|
+
return directionMap[direction].map((i) => [prefix + i, v]);
|
|
709
|
+
};
|
|
710
|
+
const paddings = [
|
|
711
|
+
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
712
|
+
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
713
|
+
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
714
|
+
];
|
|
715
|
+
const margins = [
|
|
716
|
+
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
717
|
+
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
718
|
+
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
719
|
+
];
|
|
720
|
+
|
|
721
|
+
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
722
|
+
const displays = [
|
|
723
|
+
["inline", { display: "inline" }],
|
|
724
|
+
["block", { display: "block" }],
|
|
725
|
+
["inline-block", { display: "inline-block" }],
|
|
726
|
+
["contents", { display: "contents" }],
|
|
727
|
+
["flow-root", { display: "flow-root" }],
|
|
728
|
+
["list-item", { display: "list-item" }],
|
|
729
|
+
["hidden", { display: "none" }]
|
|
730
|
+
];
|
|
731
|
+
const appearances = [
|
|
732
|
+
["visible", { visibility: "visible" }],
|
|
733
|
+
["invisible", { visibility: "hidden" }],
|
|
734
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
735
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
736
|
+
];
|
|
737
|
+
const cursors = [
|
|
738
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
739
|
+
];
|
|
740
|
+
const pointerEvents = [
|
|
741
|
+
["pointer-events-none", { "pointer-events": "none" }],
|
|
742
|
+
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
743
|
+
];
|
|
744
|
+
const resizes = [
|
|
745
|
+
["resize-none", { resize: "none" }],
|
|
746
|
+
["resize-x", { resize: "horizontal" }],
|
|
747
|
+
["resize-y", { resize: "vertical" }],
|
|
748
|
+
["resize", { resize: "both" }]
|
|
749
|
+
];
|
|
750
|
+
const userSelects = [
|
|
751
|
+
[/^select-(none|text|all|auto)$/, ([, v]) => ({ "user-select": v })]
|
|
752
|
+
];
|
|
753
|
+
const whitespaces = [
|
|
754
|
+
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
755
|
+
];
|
|
756
|
+
const contents = [
|
|
757
|
+
["content-empty", { content: '""' }]
|
|
758
|
+
];
|
|
759
|
+
const breaks = [
|
|
760
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
761
|
+
["break-word", { "overflow-wrap": "break-word" }],
|
|
762
|
+
["break-all", { "word-break": "break-all" }]
|
|
763
|
+
];
|
|
764
|
+
const textOverflows = [
|
|
765
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
766
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
767
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
768
|
+
];
|
|
769
|
+
const textTransforms = [
|
|
770
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
771
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
772
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
773
|
+
["case-normal", { "text-transform": "none" }]
|
|
774
|
+
];
|
|
775
|
+
const textDecorations = [
|
|
776
|
+
["underline", { "text-decoration": "underline" }],
|
|
777
|
+
["line-through", { "text-decoration": "line-through" }],
|
|
778
|
+
["no-underline", { "text-decoration": "none" }]
|
|
779
|
+
];
|
|
780
|
+
const textDecorationStyles = [
|
|
781
|
+
["underline-solid", { "text-decoration-style": "solid" }],
|
|
782
|
+
["underline-double", { "text-decoration-style": "double" }],
|
|
783
|
+
["underline-dotted", { "text-decoration-style": "dotted" }],
|
|
784
|
+
["underline-dashed", { "text-decoration-style": "dashed" }]
|
|
785
|
+
];
|
|
786
|
+
const fontStyles = [
|
|
787
|
+
["italic", { "font-style": "italic" }],
|
|
788
|
+
["not-italic", { "font-style": "normal" }]
|
|
789
|
+
];
|
|
790
|
+
const fontSmoothings = [
|
|
791
|
+
["antialiased", {
|
|
792
|
+
"-webkit-font-smoothing": "antialiased",
|
|
793
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
794
|
+
"font-smoothing": "grayscale"
|
|
795
|
+
}],
|
|
796
|
+
["subpixel-antialiased", {
|
|
797
|
+
"-webkit-font-smoothing": "auto",
|
|
798
|
+
"-moz-osx-font-smoothing": "auto",
|
|
799
|
+
"font-smoothing": "auto"
|
|
800
|
+
}]
|
|
801
|
+
];
|
|
802
|
+
|
|
803
|
+
const transformBase = {
|
|
804
|
+
"--un-rotate": 0,
|
|
805
|
+
"--un-scale-x": 1,
|
|
806
|
+
"--un-scale-y": 1,
|
|
807
|
+
"--un-scale-z": 1,
|
|
808
|
+
"--un-skew-x": 0,
|
|
809
|
+
"--un-skew-y": 0,
|
|
810
|
+
"--un-translate-x": 0,
|
|
811
|
+
"--un-translate-y": 0,
|
|
812
|
+
"--un-translate-z": 0,
|
|
813
|
+
"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))",
|
|
814
|
+
[CONTROL_BYPASS_PSEUDO]: ""
|
|
815
|
+
};
|
|
816
|
+
const transforms = [
|
|
817
|
+
["transform", transformBase],
|
|
818
|
+
[/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
|
|
819
|
+
[/^translate()-([^-]+)$/, handleTranslate],
|
|
820
|
+
[/^translate-([xyz])-([^-]+)$/, handleTranslate],
|
|
821
|
+
[/^scale()-([^-]+)$/, handleScale],
|
|
822
|
+
[/^scale-([xyz])-([^-]+)$/, handleScale],
|
|
823
|
+
[/^rotate-([^-]+)(?:deg)?$/, handleRotate],
|
|
824
|
+
["origin-center", { "transform-origin": "center" }],
|
|
825
|
+
["origin-top", { "transform-origin": "top" }],
|
|
826
|
+
["origin-top-right", { "transform-origin": "top right" }],
|
|
827
|
+
["origin-right", { "transform-origin": "right" }],
|
|
828
|
+
["origin-bottom-right", { "transform-origin": "bottom right" }],
|
|
829
|
+
["origin-bottom", { "transform-origin": "bottom" }],
|
|
830
|
+
["origin-bottom-left", { "transform-origin": "bottom left" }],
|
|
831
|
+
["origin-left", { "transform-origin": "left" }],
|
|
832
|
+
["origin-top-left", { "transform-origin": "top left" }]
|
|
833
|
+
];
|
|
834
|
+
function handleTranslate([, d, b]) {
|
|
835
|
+
const v = handler.bracket.fraction.rem(b);
|
|
836
|
+
if (v != null) {
|
|
837
|
+
return [
|
|
838
|
+
transformBase,
|
|
839
|
+
[
|
|
840
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
841
|
+
]
|
|
842
|
+
];
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
function handleScale([, d, b]) {
|
|
846
|
+
const v = handler.bracket.fraction.percent(b);
|
|
847
|
+
if (v != null) {
|
|
848
|
+
return [
|
|
849
|
+
transformBase,
|
|
850
|
+
[
|
|
851
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
852
|
+
]
|
|
853
|
+
];
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
function handleRotate([, b]) {
|
|
857
|
+
const v = handler.bracket.number(b);
|
|
858
|
+
if (v != null) {
|
|
859
|
+
return [
|
|
860
|
+
transformBase,
|
|
861
|
+
{ "--un-rotate": `${v}deg` }
|
|
862
|
+
];
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const variablesAbbrMap = {
|
|
867
|
+
"visible": "visibility",
|
|
868
|
+
"select": "user-select",
|
|
869
|
+
"vertical": "vertical-align",
|
|
870
|
+
"backface": "backface-visibility",
|
|
871
|
+
"whitespace": "white-space",
|
|
872
|
+
"break": "word-break",
|
|
873
|
+
"color": "color",
|
|
874
|
+
"case": "text-transform",
|
|
875
|
+
"write": "writing-mode",
|
|
876
|
+
"write-orient": "text-orientation",
|
|
877
|
+
"origin": "transform-origin",
|
|
878
|
+
"bg": "background-color",
|
|
879
|
+
"bg-blend": "background-blend-mode",
|
|
880
|
+
"bg-clip": "-webkit-background-clip",
|
|
881
|
+
"bg-gradient": "linear-gradient",
|
|
882
|
+
"bg-origin-border": "background-origin",
|
|
883
|
+
"bg-position": "background-position",
|
|
884
|
+
"bg-repeat": "background-repeat",
|
|
885
|
+
"bg-size": "background-size",
|
|
886
|
+
"bg-opacity": "background-opacity",
|
|
887
|
+
"tab": "tab-size",
|
|
888
|
+
"underline": "text-decoration-thickness",
|
|
889
|
+
"underline-offset": "text-underline-offset",
|
|
890
|
+
"text": "color",
|
|
891
|
+
"grid-cols": "grid-template-columns",
|
|
892
|
+
"grid-rows": "grid-template-rows",
|
|
893
|
+
"auto-flow": "grid-auto-flow",
|
|
894
|
+
"row-start": "grid-row-start",
|
|
895
|
+
"row-end": "grid-row-end",
|
|
896
|
+
"justify": "justify-content",
|
|
897
|
+
"content": "align-content",
|
|
898
|
+
"items": "align-items",
|
|
899
|
+
"self": "align-self",
|
|
900
|
+
"object": "object-fit",
|
|
901
|
+
"mix-blend": "mix-blend-mode",
|
|
902
|
+
"animate-speed": "animation-speed"
|
|
903
|
+
};
|
|
904
|
+
const cssVariables = [[
|
|
905
|
+
/^(.+)-\$(.+)$/,
|
|
906
|
+
([, name, varname]) => {
|
|
907
|
+
const prop = variablesAbbrMap[name];
|
|
908
|
+
if (prop) {
|
|
909
|
+
return {
|
|
910
|
+
[prop]: `var(--${varname})`
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
]];
|
|
915
|
+
|
|
916
|
+
const questionMark = [
|
|
917
|
+
[
|
|
918
|
+
/^(where|\?)$/,
|
|
919
|
+
(_, { constructCSS, generator }) => {
|
|
920
|
+
if (generator.config.envMode === "dev")
|
|
921
|
+
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}}
|
|
922
|
+
${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
923
|
+
}
|
|
924
|
+
]
|
|
925
|
+
];
|
|
926
|
+
|
|
927
|
+
const rules = [
|
|
928
|
+
cssVariables,
|
|
929
|
+
paddings,
|
|
930
|
+
margins,
|
|
931
|
+
displays,
|
|
932
|
+
opacity,
|
|
933
|
+
bgColors,
|
|
934
|
+
fillColors,
|
|
935
|
+
borders,
|
|
936
|
+
contents,
|
|
937
|
+
fonts,
|
|
938
|
+
tabSizes,
|
|
939
|
+
textIndents,
|
|
940
|
+
textOverflows,
|
|
941
|
+
textDecorations,
|
|
942
|
+
textDecorationStyles,
|
|
943
|
+
textDecorationColors,
|
|
944
|
+
textDecorationLengths,
|
|
945
|
+
textDecorationOffsets,
|
|
946
|
+
textStrokeWidths,
|
|
947
|
+
textStrokeColors,
|
|
948
|
+
textShadows,
|
|
949
|
+
textTransforms,
|
|
950
|
+
textAligns,
|
|
951
|
+
textColors,
|
|
952
|
+
fontStyles,
|
|
953
|
+
fontSmoothings,
|
|
954
|
+
boxShadows,
|
|
955
|
+
rings,
|
|
956
|
+
flex,
|
|
957
|
+
grids,
|
|
958
|
+
gaps,
|
|
959
|
+
positions,
|
|
960
|
+
sizes,
|
|
961
|
+
aspectRatio,
|
|
962
|
+
cursors,
|
|
963
|
+
appearances,
|
|
964
|
+
pointerEvents,
|
|
965
|
+
resizes,
|
|
966
|
+
verticalAligns,
|
|
967
|
+
userSelects,
|
|
968
|
+
whitespaces,
|
|
969
|
+
breaks,
|
|
970
|
+
trackings,
|
|
971
|
+
wordSpacings,
|
|
972
|
+
leadings,
|
|
973
|
+
overflows,
|
|
974
|
+
outline,
|
|
975
|
+
appearance,
|
|
976
|
+
placeholder,
|
|
977
|
+
positions,
|
|
978
|
+
orders,
|
|
979
|
+
justifies,
|
|
980
|
+
justifyItems,
|
|
981
|
+
justifySelfs,
|
|
982
|
+
alignContents,
|
|
983
|
+
alignItems,
|
|
984
|
+
alignSelfs,
|
|
985
|
+
placeContents,
|
|
986
|
+
placeItems,
|
|
987
|
+
placeSelfs,
|
|
988
|
+
insets,
|
|
989
|
+
floats,
|
|
990
|
+
zIndexes,
|
|
991
|
+
boxSizing,
|
|
992
|
+
transitions,
|
|
993
|
+
transforms,
|
|
994
|
+
questionMark
|
|
995
|
+
].flat(1);
|
|
996
|
+
|
|
997
|
+
export { userSelects as $, justifies as A, orders as B, justifyItems as C, justifySelfs as D, alignContents as E, alignItems as F, alignSelfs as G, placeContents as H, placeItems as I, placeSelfs as J, insets as K, floats as L, zIndexes as M, boxSizing as N, questionMark as O, rings as P, boxShadows as Q, sizes as R, aspectRatio as S, paddings as T, margins as U, varEmpty as V, displays as W, appearances as X, cursors as Y, pointerEvents as Z, resizes as _, appearance as a, whitespaces as a0, contents as a1, breaks as a2, textOverflows as a3, textTransforms as a4, textDecorations as a5, textDecorationStyles as a6, fontStyles as a7, fontSmoothings as a8, transforms as a9, transitions as aa, fontsFamilies as ab, fontSizes as ac, fontWeights as ad, leadings as ae, trackings as af, wordSpacings as ag, tabSizes as ah, textDecorationLengths as ai, textDecorationOffsets as aj, textIndents as ak, textStrokeWidths as al, textShadows as am, fonts as an, cssVariables as ao, borderSizes as b, borderRadius as c, borderStyles as d, borders as e, parseColorUtil as f, colorResolver$1 as g, opacity as h, textColors as i, textDecorationColors as j, textStrokeColors as k, bgColors as l, borderColors as m, ringColors as n, outline as o, placeholder as p, ringOffsetColors as q, rules as r, fillColors as s, textAligns as t, flex as u, verticalAligns as v, gaps as w, grids as x, overflows as y, positions as z };
|