@unocss/preset-mini 0.44.5 → 0.45.3
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/colors.cjs +704 -333
- package/dist/chunks/colors.mjs +680 -333
- package/dist/chunks/colors2.cjs +333 -700
- package/dist/chunks/colors2.mjs +333 -676
- package/dist/chunks/decoration.cjs +770 -0
- package/dist/chunks/decoration.mjs +724 -0
- package/dist/chunks/default.cjs +291 -280
- package/dist/chunks/default.mjs +278 -256
- package/dist/chunks/default2.cjs +276 -753
- package/dist/chunks/default2.mjs +252 -715
- package/dist/chunks/default3.cjs +2 -2
- package/dist/chunks/default3.mjs +2 -2
- package/dist/colors.cjs +1 -1
- package/dist/colors.mjs +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/rules.cjs +48 -48
- package/dist/rules.mjs +3 -3
- package/dist/theme.cjs +4 -4
- package/dist/theme.mjs +4 -4
- package/dist/utils.cjs +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +1 -1
- package/dist/variants.d.ts +1 -1
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunks/transform.cjs +0 -298
- package/dist/chunks/transform.mjs +0 -277
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, b as cornerMap, p as parseColor, e as colorToString, f as colorOpacityToString, m as makeGlobalStaticRules, i as colorableShadows, j as insetMap, k as positionMap, x as xyzMap } from './colors.mjs';
|
|
2
|
+
import { toArray } from '@unocss/core';
|
|
3
|
+
|
|
4
|
+
const verticalAlignAlias = {
|
|
5
|
+
"mid": "middle",
|
|
6
|
+
"base": "baseline",
|
|
7
|
+
"btm": "bottom",
|
|
8
|
+
"baseline": "baseline",
|
|
9
|
+
"top": "top",
|
|
10
|
+
"middle": "middle",
|
|
11
|
+
"bottom": "bottom",
|
|
12
|
+
"text-top": "text-top",
|
|
13
|
+
"text-bottom": "text-bottom",
|
|
14
|
+
"sub": "sub",
|
|
15
|
+
"super": "super",
|
|
16
|
+
...Object.fromEntries(globalKeywords.map((x) => [x, x]))
|
|
17
|
+
};
|
|
18
|
+
const verticalAligns = [
|
|
19
|
+
[/^(?:vertical|align|v)-([-\w]+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
|
|
20
|
+
];
|
|
21
|
+
const textAligns = ["center", "left", "right", "justify", "start", "end", ...globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
|
|
22
|
+
|
|
23
|
+
const outline = [
|
|
24
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
|
|
25
|
+
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
|
|
26
|
+
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? handler.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
27
|
+
["outline", { "outline-style": "solid" }],
|
|
28
|
+
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
29
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
30
|
+
];
|
|
31
|
+
const appearance = [
|
|
32
|
+
["appearance-none", {
|
|
33
|
+
"appearance": "none",
|
|
34
|
+
"-webkit-appearance": "none"
|
|
35
|
+
}]
|
|
36
|
+
];
|
|
37
|
+
const willChangeProperty = (prop) => {
|
|
38
|
+
return handler.properties.auto.global(prop) ?? {
|
|
39
|
+
contents: "contents",
|
|
40
|
+
scroll: "scroll-position"
|
|
41
|
+
}[prop];
|
|
42
|
+
};
|
|
43
|
+
const willChange = [
|
|
44
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords];
|
|
48
|
+
const borders = [
|
|
49
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
|
|
50
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
51
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
52
|
+
[/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
|
|
53
|
+
[/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
|
|
54
|
+
[/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
|
|
55
|
+
[/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
56
|
+
[/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
57
|
+
[/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
58
|
+
[/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
59
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
|
|
60
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
61
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
62
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
|
|
63
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
64
|
+
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
|
|
65
|
+
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
66
|
+
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
67
|
+
[/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
68
|
+
[/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
69
|
+
[/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded|rd)", "(border|b)-(rounded|rd)-<num>", "(rounded|rd)", "(rounded|rd)-<num>"] }],
|
|
70
|
+
[/^(?:border-|b-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
71
|
+
[/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
72
|
+
[/^(?:border-|b-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
|
|
73
|
+
[/^(?:border-|b-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
|
|
74
|
+
[/^(?:border|b)-(?:style-)?()(.+)$/, handlerBorderStyle, { autocomplete: ["(border|b)-style", `(border|b)-(${borderStyles.join("|")})`, "(border|b)-<directions>-style", `(border|b)-<directions>-(${borderStyles.join("|")})`, `(border|b)-<directions>-style-(${borderStyles.join("|")})`, `(border|b)-style-(${borderStyles.join("|")})`] }],
|
|
75
|
+
[/^(?:border|b)-([xy])-(?:style-)?(.+)$/, handlerBorderStyle],
|
|
76
|
+
[/^(?:border|b)-([rltbse])-(?:style-)?(.+)$/, handlerBorderStyle],
|
|
77
|
+
[/^(?:border|b)-(block|inline)-(?:style-)?(.+)$/, handlerBorderStyle],
|
|
78
|
+
[/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
|
|
79
|
+
];
|
|
80
|
+
const borderColorResolver = (direction) => ([, body], theme) => {
|
|
81
|
+
const data = parseColor(body, theme);
|
|
82
|
+
if (!data)
|
|
83
|
+
return;
|
|
84
|
+
const { alpha, color, cssColor } = data;
|
|
85
|
+
if (cssColor) {
|
|
86
|
+
if (alpha != null) {
|
|
87
|
+
return {
|
|
88
|
+
[`border${direction}-color`]: colorToString(cssColor, alpha)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (direction === "") {
|
|
92
|
+
return {
|
|
93
|
+
"--un-border-opacity": colorOpacityToString(cssColor),
|
|
94
|
+
"border-color": colorToString(cssColor, "var(--un-border-opacity)")
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
return {
|
|
98
|
+
"--un-border-opacity": colorOpacityToString(cssColor),
|
|
99
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
100
|
+
[`border${direction}-color`]: colorToString(cssColor, `var(--un-border${direction}-opacity)`)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
} else if (color) {
|
|
104
|
+
return {
|
|
105
|
+
[`border${direction}-color`]: colorToString(color, alpha)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function handlerBorder(m, ctx) {
|
|
110
|
+
const borderSizes = handlerBorderSize(m, ctx);
|
|
111
|
+
const borderStyle = handlerBorderStyle(["", m[1], "solid"]);
|
|
112
|
+
if (borderSizes && borderStyle) {
|
|
113
|
+
return [
|
|
114
|
+
...borderSizes,
|
|
115
|
+
...borderStyle
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function handlerBorderSize([, a = "", b], { theme }) {
|
|
120
|
+
const v = theme.lineWidth?.[b || "DEFAULT"] ?? handler.bracket.cssvar.global.px(b || "1");
|
|
121
|
+
if (a in directionMap && v != null)
|
|
122
|
+
return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
123
|
+
}
|
|
124
|
+
function handlerBorderColor([, a = "", c], { theme }) {
|
|
125
|
+
if (a in directionMap && hasParseableColor(c, theme)) {
|
|
126
|
+
return Object.assign(
|
|
127
|
+
{},
|
|
128
|
+
...directionMap[a].map((i) => borderColorResolver(i)(["", c], theme))
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function handlerBorderOpacity([, a = "", opacity]) {
|
|
133
|
+
const v = handler.bracket.percent(opacity);
|
|
134
|
+
if (a in directionMap && v != null)
|
|
135
|
+
return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
136
|
+
}
|
|
137
|
+
function handlerRounded([, a = "", s], { theme }) {
|
|
138
|
+
const v = theme.borderRadius?.[s || "DEFAULT"] || handler.bracket.cssvar.global.fraction.rem(s || "1");
|
|
139
|
+
if (a in cornerMap && v != null)
|
|
140
|
+
return cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
141
|
+
}
|
|
142
|
+
function handlerBorderStyle([, a = "", s]) {
|
|
143
|
+
if (borderStyles.includes(s) && a in directionMap)
|
|
144
|
+
return directionMap[a].map((i) => [`border${i}-style`, s]);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const transitionPropertyGroup = {
|
|
148
|
+
all: "all",
|
|
149
|
+
colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
|
|
150
|
+
none: "none",
|
|
151
|
+
opacity: "opacity",
|
|
152
|
+
shadow: "box-shadow",
|
|
153
|
+
transform: "transform"
|
|
154
|
+
};
|
|
155
|
+
const transitionProperty = (prop) => {
|
|
156
|
+
return handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
157
|
+
};
|
|
158
|
+
const transitions = [
|
|
159
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, d], { theme }) => {
|
|
160
|
+
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
161
|
+
if (p) {
|
|
162
|
+
const duration = theme.duration?.[d || "DEFAULT"] ?? handler.time(d || "150");
|
|
163
|
+
return {
|
|
164
|
+
"transition-property": p,
|
|
165
|
+
"transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
166
|
+
"transition-duration": duration
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}, { autocomplete: `transition-(${Object.keys(transitionPropertyGroup).join("|")})` }],
|
|
170
|
+
[
|
|
171
|
+
/^(?:transition-)?duration-(.+)$/,
|
|
172
|
+
([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? handler.bracket.cssvar.time(d) }),
|
|
173
|
+
{ autocomplete: ["transition-duration-$duration", "duration-$duration"] }
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
/^(?:transition-)?delay-(.+)$/,
|
|
177
|
+
([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? handler.bracket.cssvar.time(d) }),
|
|
178
|
+
{ autocomplete: ["transition-delay-$duration", "delay-$duration"] }
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
/^(?:transition-)?ease(?:-(.+))?$/,
|
|
182
|
+
([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) }),
|
|
183
|
+
{ autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
|
|
184
|
+
],
|
|
185
|
+
[
|
|
186
|
+
/^(?:transition-)?property-(.+)$/,
|
|
187
|
+
([, v]) => ({ "transition-property": handler.bracket.global(v) || transitionProperty(v) }),
|
|
188
|
+
{ autocomplete: [`transition-property-(${[...globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
|
|
189
|
+
],
|
|
190
|
+
["transition-none", { transition: "none" }],
|
|
191
|
+
...makeGlobalStaticRules("transition")
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const weightMap = {
|
|
195
|
+
thin: "100",
|
|
196
|
+
extralight: "200",
|
|
197
|
+
light: "300",
|
|
198
|
+
normal: "400",
|
|
199
|
+
medium: "500",
|
|
200
|
+
semibold: "600",
|
|
201
|
+
bold: "700",
|
|
202
|
+
extrabold: "800",
|
|
203
|
+
black: "900"
|
|
204
|
+
};
|
|
205
|
+
const fonts = [
|
|
206
|
+
[
|
|
207
|
+
/^font-(.+)$/,
|
|
208
|
+
([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || handler.bracket.cssvar.global(d) }),
|
|
209
|
+
{ autocomplete: "font-$fontFamily" }
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
/^text-(.+)$/,
|
|
213
|
+
([, s = "base"], { theme }) => {
|
|
214
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
215
|
+
if (themed?.[0]) {
|
|
216
|
+
const [size, height = "1"] = themed;
|
|
217
|
+
return {
|
|
218
|
+
"font-size": size,
|
|
219
|
+
"line-height": height
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return { "font-size": handler.bracketOfLength.rem(s) };
|
|
223
|
+
},
|
|
224
|
+
{ autocomplete: "text-$fontSize" }
|
|
225
|
+
],
|
|
226
|
+
[/^text-size-(.+)$/, ([, s], { theme }) => {
|
|
227
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
228
|
+
const size = themed?.[0] ?? handler.bracket.cssvar.global.rem(s);
|
|
229
|
+
if (size != null)
|
|
230
|
+
return { "font-size": size };
|
|
231
|
+
}, { autocomplete: "text-size-$fontSize" }],
|
|
232
|
+
[
|
|
233
|
+
/^(?:font|fw)-?([^-]+)$/,
|
|
234
|
+
([, s]) => ({ "font-weight": weightMap[s] || handler.global.number(s) }),
|
|
235
|
+
{ autocomplete: `(font|fw)-(100|200|300|400|500|600|700|800|900|${Object.keys(weightMap).join("|")})` }
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
/^(?:font-)?(?:leading|lh)-(.+)$/,
|
|
239
|
+
([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.cssvar.global.rem(s) }),
|
|
240
|
+
{ autocomplete: "(leading|lh)-$lineHeight" }
|
|
241
|
+
],
|
|
242
|
+
["font-synthesis-weight", { "font-synthesis": "weight" }],
|
|
243
|
+
["font-synthesis-style", { "font-synthesis": "style" }],
|
|
244
|
+
["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
|
|
245
|
+
["font-synthesis-none", { "font-synthesis": "none" }],
|
|
246
|
+
[/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": handler.bracket.cssvar.global(s) })],
|
|
247
|
+
[
|
|
248
|
+
/^(?:font-)?tracking-(.+)$/,
|
|
249
|
+
([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.cssvar.global.rem(s) }),
|
|
250
|
+
{ autocomplete: "tracking-$letterSpacing" }
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
/^(?:font-)?word-spacing-(.+)$/,
|
|
254
|
+
([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.cssvar.global.rem(s) }),
|
|
255
|
+
{ autocomplete: "word-spacing-$wordSpacing" }
|
|
256
|
+
]
|
|
257
|
+
];
|
|
258
|
+
const tabSizes = [
|
|
259
|
+
[/^tab(?:-(.+))?$/, ([, s]) => {
|
|
260
|
+
const v = handler.bracket.cssvar.global.number(s || "4");
|
|
261
|
+
if (v != null) {
|
|
262
|
+
return {
|
|
263
|
+
"-moz-tab-size": v,
|
|
264
|
+
"-o-tab-size": v,
|
|
265
|
+
"tab-size": v
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}]
|
|
269
|
+
];
|
|
270
|
+
const textIndents = [
|
|
271
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
|
|
272
|
+
];
|
|
273
|
+
const textStrokes = [
|
|
274
|
+
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
|
|
275
|
+
[/^text-stroke-(.+)$/, colorResolver("-webkit-text-stroke-color", "text-stroke"), { autocomplete: "text-stroke-$colors" }],
|
|
276
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
|
|
277
|
+
];
|
|
278
|
+
const textShadows = [
|
|
279
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
280
|
+
const v = theme.textShadow?.[s || "DEFAULT"];
|
|
281
|
+
if (v != null) {
|
|
282
|
+
return {
|
|
283
|
+
"--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
|
|
284
|
+
"text-shadow": "var(--un-text-shadow)"
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return { "text-shadow": handler.bracket.cssvar.global(s) };
|
|
288
|
+
}, { autocomplete: "text-shadow-$textShadow" }],
|
|
289
|
+
[/^text-shadow-color-(.+)$/, colorResolver("--un-text-shadow-color", "text-shadow"), { autocomplete: "text-shadow-color-$colors" }],
|
|
290
|
+
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": handler.bracket.percent(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
|
|
291
|
+
];
|
|
292
|
+
|
|
293
|
+
const overflowValues = [
|
|
294
|
+
"auto",
|
|
295
|
+
"hidden",
|
|
296
|
+
"clip",
|
|
297
|
+
"visible",
|
|
298
|
+
"scroll",
|
|
299
|
+
...globalKeywords
|
|
300
|
+
];
|
|
301
|
+
const overflows = [
|
|
302
|
+
[/^(?:overflow|of)-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0, { autocomplete: [`(overflow|of)-(${overflowValues.join("|")})`, `(overflow|of)-(x|y)-(${overflowValues.join("|")})`] }],
|
|
303
|
+
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
const positions = [
|
|
307
|
+
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
308
|
+
[/^(?:position-|pos-)([-\w]+)$/, ([, v]) => globalKeywords.includes(v) ? { position: v } : void 0],
|
|
309
|
+
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
310
|
+
];
|
|
311
|
+
const justifies = [
|
|
312
|
+
["justify-start", { "justify-content": "flex-start" }],
|
|
313
|
+
["justify-end", { "justify-content": "flex-end" }],
|
|
314
|
+
["justify-center", { "justify-content": "center" }],
|
|
315
|
+
["justify-between", { "justify-content": "space-between" }],
|
|
316
|
+
["justify-around", { "justify-content": "space-around" }],
|
|
317
|
+
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
318
|
+
...makeGlobalStaticRules("justify", "justify-content"),
|
|
319
|
+
["justify-items-start", { "justify-items": "start" }],
|
|
320
|
+
["justify-items-end", { "justify-items": "end" }],
|
|
321
|
+
["justify-items-center", { "justify-items": "center" }],
|
|
322
|
+
["justify-items-stretch", { "justify-items": "stretch" }],
|
|
323
|
+
...makeGlobalStaticRules("justify-items"),
|
|
324
|
+
["justify-self-auto", { "justify-self": "auto" }],
|
|
325
|
+
["justify-self-start", { "justify-self": "start" }],
|
|
326
|
+
["justify-self-end", { "justify-self": "end" }],
|
|
327
|
+
["justify-self-center", { "justify-self": "center" }],
|
|
328
|
+
["justify-self-stretch", { "justify-self": "stretch" }],
|
|
329
|
+
...makeGlobalStaticRules("justify-self")
|
|
330
|
+
];
|
|
331
|
+
const orders = [
|
|
332
|
+
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.cssvar.number(v) })],
|
|
333
|
+
["order-first", { order: "-9999" }],
|
|
334
|
+
["order-last", { order: "9999" }],
|
|
335
|
+
["order-none", { order: "0" }]
|
|
336
|
+
];
|
|
337
|
+
const alignments = [
|
|
338
|
+
["content-center", { "align-content": "center" }],
|
|
339
|
+
["content-start", { "align-content": "flex-start" }],
|
|
340
|
+
["content-end", { "align-content": "flex-end" }],
|
|
341
|
+
["content-between", { "align-content": "space-between" }],
|
|
342
|
+
["content-around", { "align-content": "space-around" }],
|
|
343
|
+
["content-evenly", { "align-content": "space-evenly" }],
|
|
344
|
+
...makeGlobalStaticRules("content", "align-content"),
|
|
345
|
+
["items-start", { "align-items": "flex-start" }],
|
|
346
|
+
["items-end", { "align-items": "flex-end" }],
|
|
347
|
+
["items-center", { "align-items": "center" }],
|
|
348
|
+
["items-baseline", { "align-items": "baseline" }],
|
|
349
|
+
["items-stretch", { "align-items": "stretch" }],
|
|
350
|
+
...makeGlobalStaticRules("items", "align-items"),
|
|
351
|
+
["self-auto", { "align-self": "auto" }],
|
|
352
|
+
["self-start", { "align-self": "flex-start" }],
|
|
353
|
+
["self-end", { "align-self": "flex-end" }],
|
|
354
|
+
["self-center", { "align-self": "center" }],
|
|
355
|
+
["self-stretch", { "align-self": "stretch" }],
|
|
356
|
+
["self-baseline", { "align-self": "baseline" }],
|
|
357
|
+
...makeGlobalStaticRules("self", "align-self")
|
|
358
|
+
];
|
|
359
|
+
const placements = [
|
|
360
|
+
["place-content-center", { "place-content": "center" }],
|
|
361
|
+
["place-content-start", { "place-content": "start" }],
|
|
362
|
+
["place-content-end", { "place-content": "end" }],
|
|
363
|
+
["place-content-between", { "place-content": "space-between" }],
|
|
364
|
+
["place-content-around", { "place-content": "space-around" }],
|
|
365
|
+
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
366
|
+
["place-content-stretch", { "place-content": "stretch" }],
|
|
367
|
+
...makeGlobalStaticRules("place-content"),
|
|
368
|
+
["place-items-start", { "place-items": "start" }],
|
|
369
|
+
["place-items-end", { "place-items": "end" }],
|
|
370
|
+
["place-items-center", { "place-items": "center" }],
|
|
371
|
+
["place-items-stretch", { "place-items": "stretch" }],
|
|
372
|
+
...makeGlobalStaticRules("place-items"),
|
|
373
|
+
["place-self-auto", { "place-self": "auto" }],
|
|
374
|
+
["place-self-start", { "place-self": "start" }],
|
|
375
|
+
["place-self-end", { "place-self": "end" }],
|
|
376
|
+
["place-self-center", { "place-self": "center" }],
|
|
377
|
+
["place-self-stretch", { "place-self": "stretch" }],
|
|
378
|
+
...makeGlobalStaticRules("place-self")
|
|
379
|
+
];
|
|
380
|
+
function handleInsetValue(v, { theme }) {
|
|
381
|
+
return theme.spacing?.[v] ?? handler.bracket.cssvar.global.auto.fraction.rem(v);
|
|
382
|
+
}
|
|
383
|
+
function handleInsetValues([, d, v], ctx) {
|
|
384
|
+
const r = handleInsetValue(v, ctx);
|
|
385
|
+
if (r != null && d in insetMap)
|
|
386
|
+
return insetMap[d].map((i) => [i.slice(1), r]);
|
|
387
|
+
}
|
|
388
|
+
const insets = [
|
|
389
|
+
[
|
|
390
|
+
/^(?:position-|pos-)?inset-(.+)$/,
|
|
391
|
+
([, v], ctx) => ({ inset: handleInsetValue(v, ctx) }),
|
|
392
|
+
{
|
|
393
|
+
autocomplete: [
|
|
394
|
+
"(position|pos)-inset-<directions>-$spacing",
|
|
395
|
+
"(position|pos)-inset-(block|inline)-$spacing",
|
|
396
|
+
"(position|pos)-inset-(bs|be|is|ie)-$spacing",
|
|
397
|
+
"(position|pos)-(top|left|right|bottom)-$spacing"
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
],
|
|
401
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
402
|
+
[/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
|
|
403
|
+
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
404
|
+
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
405
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], ctx) => ({ [d]: handleInsetValue(v, ctx) })]
|
|
406
|
+
];
|
|
407
|
+
const floats = [
|
|
408
|
+
["float-left", { float: "left" }],
|
|
409
|
+
["float-right", { float: "right" }],
|
|
410
|
+
["float-none", { float: "none" }],
|
|
411
|
+
...makeGlobalStaticRules("float"),
|
|
412
|
+
["clear-left", { clear: "left" }],
|
|
413
|
+
["clear-right", { clear: "right" }],
|
|
414
|
+
["clear-both", { clear: "both" }],
|
|
415
|
+
["clear-none", { clear: "none" }],
|
|
416
|
+
...makeGlobalStaticRules("clear")
|
|
417
|
+
];
|
|
418
|
+
const zIndexes = [
|
|
419
|
+
[/^z([\d.]+)$/, ([, v]) => ({ "z-index": handler.number(v) })],
|
|
420
|
+
[/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.global.auto.number(v) }), { autocomplete: "z-<num>" }]
|
|
421
|
+
];
|
|
422
|
+
const boxSizing = [
|
|
423
|
+
["box-border", { "box-sizing": "border-box" }],
|
|
424
|
+
["box-content", { "box-sizing": "content-box" }],
|
|
425
|
+
...makeGlobalStaticRules("box", "box-sizing")
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
|
|
429
|
+
const varEmpty = " ";
|
|
430
|
+
const displays = [
|
|
431
|
+
["inline", { display: "inline" }],
|
|
432
|
+
["block", { display: "block" }],
|
|
433
|
+
["inline-block", { display: "inline-block" }],
|
|
434
|
+
["contents", { display: "contents" }],
|
|
435
|
+
["flow-root", { display: "flow-root" }],
|
|
436
|
+
["list-item", { display: "list-item" }],
|
|
437
|
+
["hidden", { display: "none" }],
|
|
438
|
+
[/^display-(.+)$/, ([, c]) => ({ display: handler.bracket.cssvar.global(c) || c })]
|
|
439
|
+
];
|
|
440
|
+
const appearances = [
|
|
441
|
+
["visible", { visibility: "visible" }],
|
|
442
|
+
["invisible", { visibility: "hidden" }],
|
|
443
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
444
|
+
["backface-hidden", { "backface-visibility": "hidden" }],
|
|
445
|
+
...makeGlobalStaticRules("backface", "backface-visibility")
|
|
446
|
+
];
|
|
447
|
+
const cursors = [
|
|
448
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: handler.bracket.cssvar.global(c) })],
|
|
449
|
+
...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
|
|
450
|
+
];
|
|
451
|
+
const pointerEvents = [
|
|
452
|
+
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
453
|
+
["pointer-events-none", { "pointer-events": "none" }],
|
|
454
|
+
...makeGlobalStaticRules("pointer-events")
|
|
455
|
+
];
|
|
456
|
+
const resizes = [
|
|
457
|
+
["resize-x", { resize: "horizontal" }],
|
|
458
|
+
["resize-y", { resize: "vertical" }],
|
|
459
|
+
["resize", { resize: "both" }],
|
|
460
|
+
["resize-none", { resize: "none" }],
|
|
461
|
+
...makeGlobalStaticRules("resize")
|
|
462
|
+
];
|
|
463
|
+
const userSelects = [
|
|
464
|
+
["select-auto", { "user-select": "auto" }],
|
|
465
|
+
["select-all", { "user-select": "all" }],
|
|
466
|
+
["select-text", { "user-select": "text" }],
|
|
467
|
+
["select-none", { "user-select": "none" }],
|
|
468
|
+
...makeGlobalStaticRules("select", "user-select")
|
|
469
|
+
];
|
|
470
|
+
const whitespaces = [
|
|
471
|
+
[
|
|
472
|
+
/^(?:whitespace-|ws-)([-\w]+)$/,
|
|
473
|
+
([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...globalKeywords].includes(v) ? { "white-space": v } : void 0,
|
|
474
|
+
{ autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
|
|
475
|
+
]
|
|
476
|
+
];
|
|
477
|
+
const contents = [
|
|
478
|
+
[/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
|
|
479
|
+
[/^content-(\$.+)]$/, ([, v]) => ({ content: handler.cssvar(v) })],
|
|
480
|
+
["content-empty", { content: '""' }],
|
|
481
|
+
["content-none", { content: '""' }]
|
|
482
|
+
];
|
|
483
|
+
const breaks = [
|
|
484
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
485
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
486
|
+
["break-all", { "word-break": "break-all" }]
|
|
487
|
+
];
|
|
488
|
+
const textOverflows = [
|
|
489
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
490
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
491
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
492
|
+
];
|
|
493
|
+
const textTransforms = [
|
|
494
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
495
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
496
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
497
|
+
["case-normal", { "text-transform": "none" }],
|
|
498
|
+
...makeGlobalStaticRules("case", "text-transform")
|
|
499
|
+
];
|
|
500
|
+
const fontStyles = [
|
|
501
|
+
["italic", { "font-style": "italic" }],
|
|
502
|
+
["not-italic", { "font-style": "normal" }],
|
|
503
|
+
["font-italic", { "font-style": "italic" }],
|
|
504
|
+
["font-not-italic", { "font-style": "normal" }],
|
|
505
|
+
["oblique", { "font-style": "oblique" }],
|
|
506
|
+
["not-oblique", { "font-style": "normal" }],
|
|
507
|
+
["font-oblique", { "font-style": "oblique" }],
|
|
508
|
+
["font-not-oblique", { "font-style": "normal" }]
|
|
509
|
+
];
|
|
510
|
+
const fontSmoothings = [
|
|
511
|
+
["antialiased", {
|
|
512
|
+
"-webkit-font-smoothing": "antialiased",
|
|
513
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
514
|
+
"font-smoothing": "grayscale"
|
|
515
|
+
}],
|
|
516
|
+
["subpixel-antialiased", {
|
|
517
|
+
"-webkit-font-smoothing": "auto",
|
|
518
|
+
"-moz-osx-font-smoothing": "auto",
|
|
519
|
+
"font-smoothing": "auto"
|
|
520
|
+
}]
|
|
521
|
+
];
|
|
522
|
+
|
|
523
|
+
const ringBase = {
|
|
524
|
+
"--un-ring-inset": varEmpty,
|
|
525
|
+
"--un-ring-offset-width": "0px",
|
|
526
|
+
"--un-ring-offset-color": "#fff",
|
|
527
|
+
"--un-ring-width": "0px",
|
|
528
|
+
"--un-ring-color": "rgba(147,197,253,0.5)",
|
|
529
|
+
"--un-shadow": "0 0 rgba(0,0,0,0)"
|
|
530
|
+
};
|
|
531
|
+
const rings = [
|
|
532
|
+
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
533
|
+
const value = theme.ringWidth?.[d || "DEFAULT"] ?? handler.px(d || "1");
|
|
534
|
+
if (value) {
|
|
535
|
+
return {
|
|
536
|
+
"--un-ring-width": value,
|
|
537
|
+
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
538
|
+
"--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
|
|
539
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
}, { autocomplete: "ring-$ringWidth" }],
|
|
543
|
+
[/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
|
|
544
|
+
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
545
|
+
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
|
|
546
|
+
[/^ring-(.+)$/, colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
|
|
547
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
|
|
548
|
+
[/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
|
|
549
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
|
|
550
|
+
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
551
|
+
];
|
|
552
|
+
|
|
553
|
+
const boxShadowsBase = {
|
|
554
|
+
"--un-ring-offset-shadow": "0 0 rgba(0,0,0,0)",
|
|
555
|
+
"--un-ring-shadow": "0 0 rgba(0,0,0,0)",
|
|
556
|
+
"--un-shadow-inset": varEmpty,
|
|
557
|
+
"--un-shadow": "0 0 rgba(0,0,0,0)"
|
|
558
|
+
};
|
|
559
|
+
const boxShadows = [
|
|
560
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
561
|
+
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
562
|
+
if (v) {
|
|
563
|
+
return {
|
|
564
|
+
"--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
|
|
565
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
}, { autocomplete: "shadow-$boxShadow" }],
|
|
569
|
+
[/^shadow-(.+)$/, colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
|
|
570
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
|
|
571
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
572
|
+
];
|
|
573
|
+
|
|
574
|
+
const transformValues = [
|
|
575
|
+
"translate",
|
|
576
|
+
"rotate",
|
|
577
|
+
"scale"
|
|
578
|
+
];
|
|
579
|
+
const transformCpu = [
|
|
580
|
+
"translateX(var(--un-translate-x))",
|
|
581
|
+
"translateY(var(--un-translate-y))",
|
|
582
|
+
"translateZ(var(--un-translate-z))",
|
|
583
|
+
"rotate(var(--un-rotate))",
|
|
584
|
+
"rotateX(var(--un-rotate-x))",
|
|
585
|
+
"rotateY(var(--un-rotate-y))",
|
|
586
|
+
"rotateZ(var(--un-rotate-z))",
|
|
587
|
+
"skewX(var(--un-skew-x))",
|
|
588
|
+
"skewY(var(--un-skew-y))",
|
|
589
|
+
"scaleX(var(--un-scale-x))",
|
|
590
|
+
"scaleY(var(--un-scale-y))",
|
|
591
|
+
"scaleZ(var(--un-scale-z))"
|
|
592
|
+
].join(" ");
|
|
593
|
+
const transformGpu = [
|
|
594
|
+
"translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
595
|
+
"rotate(var(--un-rotate))",
|
|
596
|
+
"rotateX(var(--un-rotate-x))",
|
|
597
|
+
"rotateY(var(--un-rotate-y))",
|
|
598
|
+
"rotateZ(var(--un-rotate-z))",
|
|
599
|
+
"skewX(var(--un-skew-x))",
|
|
600
|
+
"skewY(var(--un-skew-y))",
|
|
601
|
+
"scaleX(var(--un-scale-x))",
|
|
602
|
+
"scaleY(var(--un-scale-y))",
|
|
603
|
+
"scaleZ(var(--un-scale-z))"
|
|
604
|
+
].join(" ");
|
|
605
|
+
const transformBase = {
|
|
606
|
+
"--un-rotate": 0,
|
|
607
|
+
"--un-rotate-x": 0,
|
|
608
|
+
"--un-rotate-y": 0,
|
|
609
|
+
"--un-rotate-z": 0,
|
|
610
|
+
"--un-scale-x": 1,
|
|
611
|
+
"--un-scale-y": 1,
|
|
612
|
+
"--un-scale-z": 1,
|
|
613
|
+
"--un-skew-x": 0,
|
|
614
|
+
"--un-skew-y": 0,
|
|
615
|
+
"--un-translate-x": 0,
|
|
616
|
+
"--un-translate-y": 0,
|
|
617
|
+
"--un-translate-z": 0
|
|
618
|
+
};
|
|
619
|
+
const transforms = [
|
|
620
|
+
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }],
|
|
621
|
+
[/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
|
|
622
|
+
const v = handler.bracket.cssvar.px.numberWithUnit(s);
|
|
623
|
+
if (v != null) {
|
|
624
|
+
return {
|
|
625
|
+
"-webkit-perspective": v,
|
|
626
|
+
"perspective": v
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
}],
|
|
630
|
+
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
|
|
631
|
+
const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
632
|
+
if (v != null) {
|
|
633
|
+
return {
|
|
634
|
+
"-webkit-perspective-origin": v,
|
|
635
|
+
"perspective-origin": v
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
}],
|
|
639
|
+
[/^(?:transform-)?translate-()(.+)$/, handleTranslate],
|
|
640
|
+
[/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
|
|
641
|
+
[/^(?:transform-)?rotate-()(.+)$/, handleRotate],
|
|
642
|
+
[/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
|
|
643
|
+
[/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew, { autocomplete: ["transform-skew-(x|y)-<percent>"] }],
|
|
644
|
+
[/^(?:transform-)?scale-()(.+)$/, handleScale],
|
|
645
|
+
[/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale, { autocomplete: [`transform-(${transformValues.join("|")})-<percent>`, `transform-(${transformValues.join("|")})-(x|y|z)-<percent>`] }],
|
|
646
|
+
[/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
|
|
647
|
+
[/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
|
|
648
|
+
["transform", { transform: transformCpu }],
|
|
649
|
+
["transform-cpu", { transform: transformCpu }],
|
|
650
|
+
["transform-gpu", { transform: transformGpu }],
|
|
651
|
+
["transform-none", { transform: "none" }],
|
|
652
|
+
...makeGlobalStaticRules("transform")
|
|
653
|
+
];
|
|
654
|
+
function handleTranslate([, d, b], { theme }) {
|
|
655
|
+
const v = theme.spacing?.[b] ?? handler.bracket.cssvar.fraction.rem(b);
|
|
656
|
+
if (v != null) {
|
|
657
|
+
return [
|
|
658
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
659
|
+
["transform", transformCpu]
|
|
660
|
+
];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function handleScale([, d, b]) {
|
|
664
|
+
const v = handler.bracket.cssvar.fraction.percent(b);
|
|
665
|
+
if (v != null) {
|
|
666
|
+
return [
|
|
667
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
668
|
+
["transform", transformCpu]
|
|
669
|
+
];
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function handleRotate([, d = "", b]) {
|
|
673
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
674
|
+
if (v != null) {
|
|
675
|
+
if (d) {
|
|
676
|
+
return {
|
|
677
|
+
"--un-rotate": 0,
|
|
678
|
+
[`--un-rotate-${d}`]: v,
|
|
679
|
+
"transform": transformCpu
|
|
680
|
+
};
|
|
681
|
+
} else {
|
|
682
|
+
return {
|
|
683
|
+
"--un-rotate-x": 0,
|
|
684
|
+
"--un-rotate-y": 0,
|
|
685
|
+
"--un-rotate-z": 0,
|
|
686
|
+
"--un-rotate": v,
|
|
687
|
+
"transform": transformCpu
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
function handleSkew([, d, b]) {
|
|
693
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
694
|
+
if (v != null) {
|
|
695
|
+
return {
|
|
696
|
+
[`--un-skew-${d}`]: v,
|
|
697
|
+
transform: transformCpu
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...globalKeywords];
|
|
703
|
+
const textDecorations = [
|
|
704
|
+
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
705
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? handler.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
|
|
706
|
+
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
|
|
707
|
+
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
708
|
+
const result = colorResolver("text-decoration-color", "line")(match, ctx);
|
|
709
|
+
if (result) {
|
|
710
|
+
return {
|
|
711
|
+
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
712
|
+
...result
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
716
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
717
|
+
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? handler.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
718
|
+
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
719
|
+
...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
|
|
720
|
+
["no-underline", { "text-decoration": "none" }],
|
|
721
|
+
["decoration-none", { "text-decoration": "none" }]
|
|
722
|
+
];
|
|
723
|
+
|
|
724
|
+
export { outline as A, appearance as B, orders as C, justifies as D, alignments as E, placements as F, insets as G, floats as H, zIndexes as I, boxSizing as J, transitions as K, transforms as L, willChange as M, transformBase as N, boxShadowsBase as O, ringBase as P, borderStyles as Q, handlerBorderStyle as R, varEmpty as S, textIndents as a, borders as b, contents as c, displays as d, textOverflows as e, fonts as f, textDecorations as g, textStrokes as h, textShadows as i, textTransforms as j, textAligns as k, fontStyles as l, fontSmoothings as m, boxShadows as n, cursors as o, positions as p, appearances as q, rings as r, pointerEvents as s, tabSizes as t, resizes as u, verticalAligns as v, userSelects as w, whitespaces as x, breaks as y, overflows as z };
|