@unocss/preset-wind3 66.0.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 +11 -0
- package/colors.d.ts +1 -0
- package/dist/colors.d.mts +2 -0
- package/dist/colors.d.ts +2 -0
- package/dist/colors.mjs +1 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.mjs +59 -0
- package/dist/rules.d.mts +95 -0
- package/dist/rules.d.ts +95 -0
- package/dist/rules.mjs +7 -0
- package/dist/shared/preset-wind3.BzmnsdqZ.mjs +67 -0
- package/dist/shared/preset-wind3.C-c8jDe5.mjs +634 -0
- package/dist/shared/preset-wind3.DIaVUBWk.mjs +149 -0
- package/dist/shared/preset-wind3.DRADYSMV.d.mts +6 -0
- package/dist/shared/preset-wind3.DRADYSMV.d.ts +6 -0
- package/dist/shared/preset-wind3.DjKJQ_OR.mjs +279 -0
- package/dist/shortcuts.d.mts +6 -0
- package/dist/shortcuts.d.ts +6 -0
- package/dist/shortcuts.mjs +9 -0
- package/dist/theme.d.mts +5 -0
- package/dist/theme.d.ts +5 -0
- package/dist/theme.mjs +315 -0
- package/dist/utils.d.mts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.mjs +1 -0
- package/dist/variants.d.mts +28 -0
- package/dist/variants.d.ts +28 -0
- package/dist/variants.mjs +4 -0
- package/package.json +72 -0
- package/rules.d.ts +1 -0
- package/shortcuts.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,634 @@
|
|
|
1
|
+
import * as _ from '@unocss/preset-mini/rules';
|
|
2
|
+
import { borderStyles } from '@unocss/preset-mini/rules';
|
|
3
|
+
import { h, makeGlobalStaticRules, globalKeywords, positionMap, parseColor, colorResolver, directionMap } from '@unocss/preset-mini/utils';
|
|
4
|
+
import { colorToString, colorOpacityToString } from '@unocss/rule-utils';
|
|
5
|
+
import { c as container } from './preset-wind3.BzmnsdqZ.mjs';
|
|
6
|
+
import { t as tables, g as touchActions, c as scrolls, i as fontVariantNumeric, a as filters } from './preset-wind3.DjKJQ_OR.mjs';
|
|
7
|
+
|
|
8
|
+
const animations = [
|
|
9
|
+
[/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme }) => {
|
|
10
|
+
const kf = theme.animation?.keyframes?.[name];
|
|
11
|
+
if (kf) {
|
|
12
|
+
return [
|
|
13
|
+
`@keyframes ${name}${kf}`,
|
|
14
|
+
{ animation: name }
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
}, { autocomplete: ["animate-keyframes-$animation.keyframes", "keyframes-$animation.keyframes"] }],
|
|
18
|
+
[/^animate-(.+)$/, ([, name], { theme }) => {
|
|
19
|
+
const kf = theme.animation?.keyframes?.[name];
|
|
20
|
+
if (kf) {
|
|
21
|
+
const duration = theme.animation?.durations?.[name] ?? "1s";
|
|
22
|
+
const timing = theme.animation?.timingFns?.[name] ?? "linear";
|
|
23
|
+
const count = theme.animation?.counts?.[name] ?? 1;
|
|
24
|
+
const props = theme.animation?.properties?.[name];
|
|
25
|
+
return [
|
|
26
|
+
`@keyframes ${name}${kf}`,
|
|
27
|
+
{
|
|
28
|
+
animation: `${name} ${duration} ${timing} ${count}`,
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
return { animation: h.bracket.cssvar(name) };
|
|
34
|
+
}, { autocomplete: "animate-$animation.keyframes" }],
|
|
35
|
+
[/^animate-name-(.+)/, ([, d]) => ({ "animation-name": h.bracket.cssvar(d) ?? d })],
|
|
36
|
+
// timings
|
|
37
|
+
[/^animate-duration-(.+)$/, ([, d], { theme }) => ({ "animation-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }), { autocomplete: ["animate-duration", "animate-duration-$duration"] }],
|
|
38
|
+
[/^animate-delay-(.+)$/, ([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }), { autocomplete: ["animate-delay", "animate-delay-$duration"] }],
|
|
39
|
+
[/^animate-ease(?:-(.+))?$/, ([, d], { theme }) => ({ "animation-timing-function": theme.easing?.[d || "DEFAULT"] ?? h.bracket.cssvar(d) }), { autocomplete: ["animate-ease", "animate-ease-$easing"] }],
|
|
40
|
+
// fill mode
|
|
41
|
+
[/^animate-(fill-mode-|fill-|mode-)?(.+)$/, ([, t, d]) => ["none", "forwards", "backwards", "both", ...[t ? globalKeywords : []]].includes(d) ? { "animation-fill-mode": d } : void 0, {
|
|
42
|
+
autocomplete: [
|
|
43
|
+
"animate-(fill|mode|fill-mode)",
|
|
44
|
+
"animate-(fill|mode|fill-mode)-(none|forwards|backwards|both|inherit|initial|revert|revert-layer|unset)",
|
|
45
|
+
"animate-(none|forwards|backwards|both|inherit|initial|revert|revert-layer|unset)"
|
|
46
|
+
]
|
|
47
|
+
}],
|
|
48
|
+
// direction
|
|
49
|
+
[/^animate-(direction-)?(.+)$/, ([, t, d]) => ["normal", "reverse", "alternate", "alternate-reverse", ...[t ? globalKeywords : []]].includes(d) ? { "animation-direction": d } : void 0, {
|
|
50
|
+
autocomplete: [
|
|
51
|
+
"animate-direction",
|
|
52
|
+
"animate-direction-(normal|reverse|alternate|alternate-reverse|inherit|initial|revert|revert-layer|unset)",
|
|
53
|
+
"animate-(normal|reverse|alternate|alternate-reverse|inherit|initial|revert|revert-layer|unset)"
|
|
54
|
+
]
|
|
55
|
+
}],
|
|
56
|
+
// others
|
|
57
|
+
[/^animate-(?:iteration-count-|iteration-|count-)(.+)$/, ([, d]) => ({ "animation-iteration-count": h.bracket.cssvar(d) ?? d.replace(/-/g, ",") }), { autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }],
|
|
58
|
+
[/^animate-(play-state-|play-|state-)?(.+)$/, ([, t, d]) => ["paused", "running", ...[t ? globalKeywords : []]].includes(d) ? { "animation-play-state": d } : void 0, {
|
|
59
|
+
autocomplete: [
|
|
60
|
+
"animate-(play|state|play-state)",
|
|
61
|
+
"animate-(play|state|play-state)-(paused|running|inherit|initial|revert|revert-layer|unset)",
|
|
62
|
+
"animate-(paused|running|inherit|initial|revert|revert-layer|unset)"
|
|
63
|
+
]
|
|
64
|
+
}],
|
|
65
|
+
["animate-none", { animation: "none" }],
|
|
66
|
+
...makeGlobalStaticRules("animate", "animation")
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
function bgGradientToValue(cssColor) {
|
|
70
|
+
if (cssColor)
|
|
71
|
+
return colorToString(cssColor, 0);
|
|
72
|
+
return "rgb(255 255 255 / 0)";
|
|
73
|
+
}
|
|
74
|
+
function bgGradientColorValue(mode, cssColor, color, alpha) {
|
|
75
|
+
if (cssColor) {
|
|
76
|
+
if (alpha != null)
|
|
77
|
+
return colorToString(cssColor, alpha);
|
|
78
|
+
else
|
|
79
|
+
return colorToString(cssColor, `var(--un-${mode}-opacity, ${colorOpacityToString(cssColor)})`);
|
|
80
|
+
}
|
|
81
|
+
return colorToString(color, alpha);
|
|
82
|
+
}
|
|
83
|
+
function bgGradientColorResolver() {
|
|
84
|
+
return ([, mode, body], { theme }) => {
|
|
85
|
+
const data = parseColor(body, theme, "backgroundColor");
|
|
86
|
+
if (!data)
|
|
87
|
+
return;
|
|
88
|
+
const { alpha, color, cssColor } = data;
|
|
89
|
+
if (!color)
|
|
90
|
+
return;
|
|
91
|
+
const colorString = bgGradientColorValue(mode, cssColor, color, alpha);
|
|
92
|
+
switch (mode) {
|
|
93
|
+
case "from":
|
|
94
|
+
return {
|
|
95
|
+
"--un-gradient-from-position": "0%",
|
|
96
|
+
"--un-gradient-from": `${colorString} var(--un-gradient-from-position)`,
|
|
97
|
+
"--un-gradient-to-position": "100%",
|
|
98
|
+
"--un-gradient-to": `${bgGradientToValue(cssColor)} var(--un-gradient-to-position)`,
|
|
99
|
+
"--un-gradient-stops": "var(--un-gradient-from), var(--un-gradient-to)"
|
|
100
|
+
};
|
|
101
|
+
case "via":
|
|
102
|
+
return {
|
|
103
|
+
"--un-gradient-via-position": "50%",
|
|
104
|
+
"--un-gradient-to": bgGradientToValue(cssColor),
|
|
105
|
+
"--un-gradient-stops": `var(--un-gradient-from), ${colorString} var(--un-gradient-via-position), var(--un-gradient-to)`
|
|
106
|
+
};
|
|
107
|
+
case "to":
|
|
108
|
+
return {
|
|
109
|
+
"--un-gradient-to-position": "100%",
|
|
110
|
+
"--un-gradient-to": `${colorString} var(--un-gradient-to-position)`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function bgGradientPositionResolver() {
|
|
116
|
+
return ([, mode, body]) => {
|
|
117
|
+
return {
|
|
118
|
+
[`--un-gradient-${mode}-position`]: `${Number(h.bracket.cssvar.percent(body)) * 100}%`
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const backgroundStyles = [
|
|
123
|
+
// gradients
|
|
124
|
+
[/^bg-gradient-(.+)$/, ([, d]) => ({ "--un-gradient": h.bracket(d) }), {
|
|
125
|
+
autocomplete: ["bg-gradient", "bg-gradient-(from|to|via)", "bg-gradient-(from|to|via)-$colors", "bg-gradient-(from|to|via)-(op|opacity)", "bg-gradient-(from|to|via)-(op|opacity)-<percent>"]
|
|
126
|
+
}],
|
|
127
|
+
[/^(?:bg-gradient-)?stops-(\[.+\])$/, ([, s]) => ({ "--un-gradient-stops": h.bracket(s) })],
|
|
128
|
+
[/^(?:bg-gradient-)?(from)-(.+)$/, bgGradientColorResolver()],
|
|
129
|
+
[/^(?:bg-gradient-)?(via)-(.+)$/, bgGradientColorResolver()],
|
|
130
|
+
[/^(?:bg-gradient-)?(to)-(.+)$/, bgGradientColorResolver()],
|
|
131
|
+
[/^(?:bg-gradient-)?(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity]) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity) })],
|
|
132
|
+
[/^(from|via|to)-([\d.]+)%$/, bgGradientPositionResolver()],
|
|
133
|
+
// images
|
|
134
|
+
[/^bg-gradient-((?:repeating-)?(?:linear|radial|conic))$/, ([, s]) => ({
|
|
135
|
+
"background-image": `${s}-gradient(var(--un-gradient, var(--un-gradient-stops, rgb(255 255 255 / 0))))`
|
|
136
|
+
}), { autocomplete: ["bg-gradient-repeating", "bg-gradient-(linear|radial|conic)", "bg-gradient-repeating-(linear|radial|conic)"] }],
|
|
137
|
+
// ignore any center position
|
|
138
|
+
[/^bg-gradient-to-([rltb]{1,2})$/, ([, d]) => {
|
|
139
|
+
if (d in positionMap) {
|
|
140
|
+
return {
|
|
141
|
+
"--un-gradient-shape": `to ${positionMap[d]} in oklch`,
|
|
142
|
+
"--un-gradient": "var(--un-gradient-shape), var(--un-gradient-stops)",
|
|
143
|
+
"background-image": "linear-gradient(var(--un-gradient))"
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, { autocomplete: `bg-gradient-to-(${Object.keys(positionMap).filter((k) => k.length <= 2 && Array.from(k).every((c) => "rltb".includes(c))).join("|")})` }],
|
|
147
|
+
[/^(?:bg-gradient-)?shape-(.+)$/, ([, d]) => {
|
|
148
|
+
const v = d in positionMap ? `to ${positionMap[d]}` : h.bracket(d);
|
|
149
|
+
if (v != null) {
|
|
150
|
+
return {
|
|
151
|
+
"--un-gradient-shape": `${v} in oklch`,
|
|
152
|
+
"--un-gradient": "var(--un-gradient-shape), var(--un-gradient-stops)"
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}, { autocomplete: ["bg-gradient-shape", `bg-gradient-shape-(${Object.keys(positionMap).join("|")})`, `shape-(${Object.keys(positionMap).join("|")})`] }],
|
|
156
|
+
["bg-none", { "background-image": "none" }],
|
|
157
|
+
["box-decoration-slice", { "box-decoration-break": "slice" }],
|
|
158
|
+
["box-decoration-clone", { "box-decoration-break": "clone" }],
|
|
159
|
+
...makeGlobalStaticRules("box-decoration", "box-decoration-break"),
|
|
160
|
+
// size
|
|
161
|
+
["bg-auto", { "background-size": "auto" }],
|
|
162
|
+
["bg-cover", { "background-size": "cover" }],
|
|
163
|
+
["bg-contain", { "background-size": "contain" }],
|
|
164
|
+
// attachments
|
|
165
|
+
["bg-fixed", { "background-attachment": "fixed" }],
|
|
166
|
+
["bg-local", { "background-attachment": "local" }],
|
|
167
|
+
["bg-scroll", { "background-attachment": "scroll" }],
|
|
168
|
+
// clips
|
|
169
|
+
["bg-clip-border", { "-webkit-background-clip": "border-box", "background-clip": "border-box" }],
|
|
170
|
+
["bg-clip-content", { "-webkit-background-clip": "content-box", "background-clip": "content-box" }],
|
|
171
|
+
["bg-clip-padding", { "-webkit-background-clip": "padding-box", "background-clip": "padding-box" }],
|
|
172
|
+
["bg-clip-text", { "-webkit-background-clip": "text", "background-clip": "text" }],
|
|
173
|
+
...globalKeywords.map((keyword) => [`bg-clip-${keyword}`, {
|
|
174
|
+
"-webkit-background-clip": keyword,
|
|
175
|
+
"background-clip": keyword
|
|
176
|
+
}]),
|
|
177
|
+
// positions
|
|
178
|
+
// skip 1 & 2 letters shortcut
|
|
179
|
+
[/^bg-([-\w]{3,})$/, ([, s]) => ({ "background-position": positionMap[s] })],
|
|
180
|
+
// repeats
|
|
181
|
+
["bg-repeat", { "background-repeat": "repeat" }],
|
|
182
|
+
["bg-no-repeat", { "background-repeat": "no-repeat" }],
|
|
183
|
+
["bg-repeat-x", { "background-repeat": "repeat-x" }],
|
|
184
|
+
["bg-repeat-y", { "background-repeat": "repeat-y" }],
|
|
185
|
+
["bg-repeat-round", { "background-repeat": "round" }],
|
|
186
|
+
["bg-repeat-space", { "background-repeat": "space" }],
|
|
187
|
+
...makeGlobalStaticRules("bg-repeat", "background-repeat"),
|
|
188
|
+
// origins
|
|
189
|
+
["bg-origin-border", { "background-origin": "border-box" }],
|
|
190
|
+
["bg-origin-padding", { "background-origin": "padding-box" }],
|
|
191
|
+
["bg-origin-content", { "background-origin": "content-box" }],
|
|
192
|
+
...makeGlobalStaticRules("bg-origin", "background-origin")
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
const listStyles = {
|
|
196
|
+
"disc": "disc",
|
|
197
|
+
"circle": "circle",
|
|
198
|
+
"square": "square",
|
|
199
|
+
"decimal": "decimal",
|
|
200
|
+
"zero-decimal": "decimal-leading-zero",
|
|
201
|
+
"greek": "lower-greek",
|
|
202
|
+
"roman": "lower-roman",
|
|
203
|
+
"upper-roman": "upper-roman",
|
|
204
|
+
"alpha": "lower-alpha",
|
|
205
|
+
"upper-alpha": "upper-alpha",
|
|
206
|
+
"latin": "lower-latin",
|
|
207
|
+
"upper-latin": "upper-latin"
|
|
208
|
+
};
|
|
209
|
+
const listStyle = [
|
|
210
|
+
// base
|
|
211
|
+
[/^list-(.+?)(?:-(outside|inside))?$/, ([, alias, position]) => {
|
|
212
|
+
const style = listStyles[alias];
|
|
213
|
+
if (style) {
|
|
214
|
+
if (position) {
|
|
215
|
+
return {
|
|
216
|
+
"list-style-position": position,
|
|
217
|
+
"list-style-type": style
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
return { "list-style-type": style };
|
|
221
|
+
}
|
|
222
|
+
}, { autocomplete: [`list-(${Object.keys(listStyles).join("|")})`, `list-(${Object.keys(listStyles).join("|")})-(outside|inside)`] }],
|
|
223
|
+
// styles
|
|
224
|
+
["list-outside", { "list-style-position": "outside" }],
|
|
225
|
+
["list-inside", { "list-style-position": "inside" }],
|
|
226
|
+
["list-none", { "list-style-type": "none" }],
|
|
227
|
+
// image
|
|
228
|
+
[/^list-image-(.+)$/, ([, d]) => {
|
|
229
|
+
if (/^\[url\(.+\)\]$/.test(d))
|
|
230
|
+
return { "list-style-image": h.bracket(d) };
|
|
231
|
+
}],
|
|
232
|
+
["list-image-none", { "list-style-image": "none" }],
|
|
233
|
+
...makeGlobalStaticRules("list", "list-style-type")
|
|
234
|
+
];
|
|
235
|
+
const accents = [
|
|
236
|
+
[/^accent-(.+)$/, colorResolver("accent-color", "accent", "accentColor"), { autocomplete: "accent-$colors" }],
|
|
237
|
+
[/^accent-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-accent-opacity": h.bracket.percent(d) }), { autocomplete: ["accent-(op|opacity)", "accent-(op|opacity)-<percent>"] }]
|
|
238
|
+
];
|
|
239
|
+
const carets = [
|
|
240
|
+
[/^caret-(.+)$/, colorResolver("caret-color", "caret", "textColor"), { autocomplete: "caret-$colors" }],
|
|
241
|
+
[/^caret-op(?:acity)?-?(.+)$/, ([, d]) => ({ "--un-caret-opacity": h.bracket.percent(d) }), { autocomplete: ["caret-(op|opacity)", "caret-(op|opacity)-<percent>"] }]
|
|
242
|
+
];
|
|
243
|
+
const imageRenderings = [
|
|
244
|
+
["image-render-auto", { "image-rendering": "auto" }],
|
|
245
|
+
["image-render-edge", { "image-rendering": "crisp-edges" }],
|
|
246
|
+
["image-render-pixel", [
|
|
247
|
+
["-ms-interpolation-mode", "nearest-neighbor"],
|
|
248
|
+
["image-rendering", "-webkit-optimize-contrast"],
|
|
249
|
+
["image-rendering", "-moz-crisp-edges"],
|
|
250
|
+
["image-rendering", "-o-pixelated"],
|
|
251
|
+
["image-rendering", "pixelated"]
|
|
252
|
+
]]
|
|
253
|
+
];
|
|
254
|
+
const overscrolls = [
|
|
255
|
+
["overscroll-auto", { "overscroll-behavior": "auto" }],
|
|
256
|
+
["overscroll-contain", { "overscroll-behavior": "contain" }],
|
|
257
|
+
["overscroll-none", { "overscroll-behavior": "none" }],
|
|
258
|
+
...makeGlobalStaticRules("overscroll", "overscroll-behavior"),
|
|
259
|
+
["overscroll-x-auto", { "overscroll-behavior-x": "auto" }],
|
|
260
|
+
["overscroll-x-contain", { "overscroll-behavior-x": "contain" }],
|
|
261
|
+
["overscroll-x-none", { "overscroll-behavior-x": "none" }],
|
|
262
|
+
...makeGlobalStaticRules("overscroll-x", "overscroll-behavior-x"),
|
|
263
|
+
["overscroll-y-auto", { "overscroll-behavior-y": "auto" }],
|
|
264
|
+
["overscroll-y-contain", { "overscroll-behavior-y": "contain" }],
|
|
265
|
+
["overscroll-y-none", { "overscroll-behavior-y": "none" }],
|
|
266
|
+
...makeGlobalStaticRules("overscroll-y", "overscroll-behavior-y")
|
|
267
|
+
];
|
|
268
|
+
const scrollBehaviors = [
|
|
269
|
+
["scroll-auto", { "scroll-behavior": "auto" }],
|
|
270
|
+
["scroll-smooth", { "scroll-behavior": "smooth" }],
|
|
271
|
+
...makeGlobalStaticRules("scroll", "scroll-behavior")
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
const columns = [
|
|
275
|
+
[/^columns-(.+)$/, ([, v]) => ({ columns: h.bracket.global.number.auto.numberWithUnit(v) }), { autocomplete: "columns-<num>" }],
|
|
276
|
+
// break before
|
|
277
|
+
["break-before-auto", { "break-before": "auto" }],
|
|
278
|
+
["break-before-avoid", { "break-before": "avoid" }],
|
|
279
|
+
["break-before-all", { "break-before": "all" }],
|
|
280
|
+
["break-before-avoid-page", { "break-before": "avoid-page" }],
|
|
281
|
+
["break-before-page", { "break-before": "page" }],
|
|
282
|
+
["break-before-left", { "break-before": "left" }],
|
|
283
|
+
["break-before-right", { "break-before": "right" }],
|
|
284
|
+
["break-before-column", { "break-before": "column" }],
|
|
285
|
+
...makeGlobalStaticRules("break-before"),
|
|
286
|
+
// break inside
|
|
287
|
+
["break-inside-auto", { "break-inside": "auto" }],
|
|
288
|
+
["break-inside-avoid", { "break-inside": "avoid" }],
|
|
289
|
+
["break-inside-avoid-page", { "break-inside": "avoid-page" }],
|
|
290
|
+
["break-inside-avoid-column", { "break-inside": "avoid-column" }],
|
|
291
|
+
...makeGlobalStaticRules("break-inside"),
|
|
292
|
+
// break after
|
|
293
|
+
["break-after-auto", { "break-after": "auto" }],
|
|
294
|
+
["break-after-avoid", { "break-after": "avoid" }],
|
|
295
|
+
["break-after-all", { "break-after": "all" }],
|
|
296
|
+
["break-after-avoid-page", { "break-after": "avoid-page" }],
|
|
297
|
+
["break-after-page", { "break-after": "page" }],
|
|
298
|
+
["break-after-left", { "break-after": "left" }],
|
|
299
|
+
["break-after-right", { "break-after": "right" }],
|
|
300
|
+
["break-after-column", { "break-after": "column" }],
|
|
301
|
+
...makeGlobalStaticRules("break-after")
|
|
302
|
+
];
|
|
303
|
+
|
|
304
|
+
const divides = [
|
|
305
|
+
// divides
|
|
306
|
+
[/^divide-?([xy])$/, handlerDivide, { autocomplete: ["divide-(x|y|block|inline)", "divide-(x|y|block|inline)-reverse", "divide-(x|y|block|inline)-$lineWidth"] }],
|
|
307
|
+
[/^divide-?([xy])-?(.+)$/, handlerDivide],
|
|
308
|
+
[/^divide-?([xy])-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
|
|
309
|
+
[/^divide-(block|inline)$/, handlerDivide],
|
|
310
|
+
[/^divide-(block|inline)-(.+)$/, handlerDivide],
|
|
311
|
+
[/^divide-(block|inline)-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
|
|
312
|
+
// color & opacity
|
|
313
|
+
[/^divide-(.+)$/, colorResolver("border-color", "divide", "borderColor"), { autocomplete: "divide-$colors" }],
|
|
314
|
+
[/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": h.bracket.percent(opacity) }), { autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }],
|
|
315
|
+
// styles
|
|
316
|
+
...borderStyles.map((style) => [`divide-${style}`, { "border-style": style }])
|
|
317
|
+
];
|
|
318
|
+
function handlerDivide([, d, s], { theme }) {
|
|
319
|
+
let v = theme.lineWidth?.[s || "DEFAULT"] ?? h.bracket.cssvar.px(s || "1");
|
|
320
|
+
if (v != null) {
|
|
321
|
+
if (v === "0")
|
|
322
|
+
v = "0px";
|
|
323
|
+
const results = directionMap[d].map((item) => {
|
|
324
|
+
const key = `border${item}-width`;
|
|
325
|
+
const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-divide-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-divide-${d}-reverse)))`;
|
|
326
|
+
return [key, value];
|
|
327
|
+
});
|
|
328
|
+
if (results) {
|
|
329
|
+
return [
|
|
330
|
+
[`--un-divide-${d}-reverse`, 0],
|
|
331
|
+
...results
|
|
332
|
+
];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const lineClamps = [
|
|
338
|
+
[/^line-clamp-(\d+)$/, ([, v]) => ({
|
|
339
|
+
"overflow": "hidden",
|
|
340
|
+
"display": "-webkit-box",
|
|
341
|
+
"-webkit-box-orient": "vertical",
|
|
342
|
+
"-webkit-line-clamp": v,
|
|
343
|
+
"line-clamp": v
|
|
344
|
+
}), { autocomplete: ["line-clamp", "line-clamp-<num>"] }],
|
|
345
|
+
...["none", ...globalKeywords].map((keyword) => [`line-clamp-${keyword}`, {
|
|
346
|
+
"overflow": "visible",
|
|
347
|
+
"display": "block",
|
|
348
|
+
"-webkit-box-orient": "horizontal",
|
|
349
|
+
"-webkit-line-clamp": keyword,
|
|
350
|
+
"line-clamp": keyword
|
|
351
|
+
}])
|
|
352
|
+
];
|
|
353
|
+
|
|
354
|
+
const placeholders = [
|
|
355
|
+
// The prefix `$ ` is intentional. This rule is not to be matched directly from user-generated token.
|
|
356
|
+
// See variants/placeholder.
|
|
357
|
+
[/^\$ placeholder-(.+)$/, colorResolver("color", "placeholder", "accentColor"), { autocomplete: "placeholder-$colors" }],
|
|
358
|
+
[/^\$ placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity) }), { autocomplete: ["placeholder-(op|opacity)", "placeholder-(op|opacity)-<percent>"] }]
|
|
359
|
+
];
|
|
360
|
+
|
|
361
|
+
const spaces = [
|
|
362
|
+
[/^space-([xy])-(.+)$/, handlerSpace, { autocomplete: ["space-(x|y|block|inline)", "space-(x|y|block|inline)-reverse", "space-(x|y|block|inline)-$spacing"] }],
|
|
363
|
+
[/^space-([xy])-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })],
|
|
364
|
+
[/^space-(block|inline)-(.+)$/, handlerSpace],
|
|
365
|
+
[/^space-(block|inline)-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })]
|
|
366
|
+
];
|
|
367
|
+
function handlerSpace([, d, s], { theme }) {
|
|
368
|
+
let v = theme.spacing?.[s || "DEFAULT"] ?? h.bracket.cssvar.auto.fraction.rem(s || "1");
|
|
369
|
+
if (v != null) {
|
|
370
|
+
if (v === "0")
|
|
371
|
+
v = "0px";
|
|
372
|
+
const results = directionMap[d].map((item) => {
|
|
373
|
+
const key = `margin${item}`;
|
|
374
|
+
const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-space-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-space-${d}-reverse)))`;
|
|
375
|
+
return [key, value];
|
|
376
|
+
});
|
|
377
|
+
if (results) {
|
|
378
|
+
return [
|
|
379
|
+
[`--un-space-${d}-reverse`, 0],
|
|
380
|
+
...results
|
|
381
|
+
];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const textTransforms = [
|
|
387
|
+
// tailwind compat
|
|
388
|
+
["uppercase", { "text-transform": "uppercase" }],
|
|
389
|
+
["lowercase", { "text-transform": "lowercase" }],
|
|
390
|
+
["capitalize", { "text-transform": "capitalize" }],
|
|
391
|
+
["normal-case", { "text-transform": "none" }]
|
|
392
|
+
];
|
|
393
|
+
const hyphens = [
|
|
394
|
+
...["manual", "auto", "none", ...globalKeywords].map((keyword) => [`hyphens-${keyword}`, {
|
|
395
|
+
"-webkit-hyphens": keyword,
|
|
396
|
+
"-ms-hyphens": keyword,
|
|
397
|
+
"hyphens": keyword
|
|
398
|
+
}])
|
|
399
|
+
];
|
|
400
|
+
const writingModes = [
|
|
401
|
+
["write-vertical-right", { "writing-mode": "vertical-rl" }],
|
|
402
|
+
["write-vertical-left", { "writing-mode": "vertical-lr" }],
|
|
403
|
+
["write-normal", { "writing-mode": "horizontal-tb" }],
|
|
404
|
+
...makeGlobalStaticRules("write", "writing-mode")
|
|
405
|
+
];
|
|
406
|
+
const writingOrientations = [
|
|
407
|
+
["write-orient-mixed", { "text-orientation": "mixed" }],
|
|
408
|
+
["write-orient-sideways", { "text-orientation": "sideways" }],
|
|
409
|
+
["write-orient-upright", { "text-orientation": "upright" }],
|
|
410
|
+
...makeGlobalStaticRules("write-orient", "text-orientation")
|
|
411
|
+
];
|
|
412
|
+
const screenReadersAccess = [
|
|
413
|
+
[
|
|
414
|
+
"sr-only",
|
|
415
|
+
{
|
|
416
|
+
"position": "absolute",
|
|
417
|
+
"width": "1px",
|
|
418
|
+
"height": "1px",
|
|
419
|
+
"padding": "0",
|
|
420
|
+
"margin": "-1px",
|
|
421
|
+
"overflow": "hidden",
|
|
422
|
+
"clip": "rect(0,0,0,0)",
|
|
423
|
+
"white-space": "nowrap",
|
|
424
|
+
"border-width": 0
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
"not-sr-only",
|
|
429
|
+
{
|
|
430
|
+
"position": "static",
|
|
431
|
+
"width": "auto",
|
|
432
|
+
"height": "auto",
|
|
433
|
+
"padding": "0",
|
|
434
|
+
"margin": "0",
|
|
435
|
+
"overflow": "visible",
|
|
436
|
+
"clip": "auto",
|
|
437
|
+
"white-space": "normal"
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
];
|
|
441
|
+
const isolations = [
|
|
442
|
+
["isolate", { isolation: "isolate" }],
|
|
443
|
+
["isolate-auto", { isolation: "auto" }],
|
|
444
|
+
["isolation-auto", { isolation: "auto" }]
|
|
445
|
+
];
|
|
446
|
+
const objectPositions = [
|
|
447
|
+
// object fit
|
|
448
|
+
["object-cover", { "object-fit": "cover" }],
|
|
449
|
+
["object-contain", { "object-fit": "contain" }],
|
|
450
|
+
["object-fill", { "object-fit": "fill" }],
|
|
451
|
+
["object-scale-down", { "object-fit": "scale-down" }],
|
|
452
|
+
["object-none", { "object-fit": "none" }],
|
|
453
|
+
// object position
|
|
454
|
+
[/^object-(.+)$/, ([, d]) => {
|
|
455
|
+
if (positionMap[d])
|
|
456
|
+
return { "object-position": positionMap[d] };
|
|
457
|
+
if (h.bracketOfPosition(d) != null)
|
|
458
|
+
return { "object-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
459
|
+
}, { autocomplete: `object-(${Object.keys(positionMap).join("|")})` }]
|
|
460
|
+
];
|
|
461
|
+
const backgroundBlendModes = [
|
|
462
|
+
["bg-blend-multiply", { "background-blend-mode": "multiply" }],
|
|
463
|
+
["bg-blend-screen", { "background-blend-mode": "screen" }],
|
|
464
|
+
["bg-blend-overlay", { "background-blend-mode": "overlay" }],
|
|
465
|
+
["bg-blend-darken", { "background-blend-mode": "darken" }],
|
|
466
|
+
["bg-blend-lighten", { "background-blend-mode": "lighten" }],
|
|
467
|
+
["bg-blend-color-dodge", { "background-blend-mode": "color-dodge" }],
|
|
468
|
+
["bg-blend-color-burn", { "background-blend-mode": "color-burn" }],
|
|
469
|
+
["bg-blend-hard-light", { "background-blend-mode": "hard-light" }],
|
|
470
|
+
["bg-blend-soft-light", { "background-blend-mode": "soft-light" }],
|
|
471
|
+
["bg-blend-difference", { "background-blend-mode": "difference" }],
|
|
472
|
+
["bg-blend-exclusion", { "background-blend-mode": "exclusion" }],
|
|
473
|
+
["bg-blend-hue", { "background-blend-mode": "hue" }],
|
|
474
|
+
["bg-blend-saturation", { "background-blend-mode": "saturation" }],
|
|
475
|
+
["bg-blend-color", { "background-blend-mode": "color" }],
|
|
476
|
+
["bg-blend-luminosity", { "background-blend-mode": "luminosity" }],
|
|
477
|
+
["bg-blend-normal", { "background-blend-mode": "normal" }],
|
|
478
|
+
...makeGlobalStaticRules("bg-blend", "background-blend")
|
|
479
|
+
];
|
|
480
|
+
const mixBlendModes = [
|
|
481
|
+
["mix-blend-multiply", { "mix-blend-mode": "multiply" }],
|
|
482
|
+
["mix-blend-screen", { "mix-blend-mode": "screen" }],
|
|
483
|
+
["mix-blend-overlay", { "mix-blend-mode": "overlay" }],
|
|
484
|
+
["mix-blend-darken", { "mix-blend-mode": "darken" }],
|
|
485
|
+
["mix-blend-lighten", { "mix-blend-mode": "lighten" }],
|
|
486
|
+
["mix-blend-color-dodge", { "mix-blend-mode": "color-dodge" }],
|
|
487
|
+
["mix-blend-color-burn", { "mix-blend-mode": "color-burn" }],
|
|
488
|
+
["mix-blend-hard-light", { "mix-blend-mode": "hard-light" }],
|
|
489
|
+
["mix-blend-soft-light", { "mix-blend-mode": "soft-light" }],
|
|
490
|
+
["mix-blend-difference", { "mix-blend-mode": "difference" }],
|
|
491
|
+
["mix-blend-exclusion", { "mix-blend-mode": "exclusion" }],
|
|
492
|
+
["mix-blend-hue", { "mix-blend-mode": "hue" }],
|
|
493
|
+
["mix-blend-saturation", { "mix-blend-mode": "saturation" }],
|
|
494
|
+
["mix-blend-color", { "mix-blend-mode": "color" }],
|
|
495
|
+
["mix-blend-luminosity", { "mix-blend-mode": "luminosity" }],
|
|
496
|
+
["mix-blend-plus-lighter", { "mix-blend-mode": "plus-lighter" }],
|
|
497
|
+
["mix-blend-normal", { "mix-blend-mode": "normal" }],
|
|
498
|
+
...makeGlobalStaticRules("mix-blend")
|
|
499
|
+
];
|
|
500
|
+
const dynamicViewportHeight = [
|
|
501
|
+
["min-h-dvh", { "min-height": "100dvh" }],
|
|
502
|
+
["min-h-svh", { "min-height": "100svh" }],
|
|
503
|
+
["min-h-lvh", { "min-height": "100lvh" }],
|
|
504
|
+
["h-dvh", { height: "100dvh" }],
|
|
505
|
+
["h-svh", { height: "100svh" }],
|
|
506
|
+
["h-lvh", { height: "100lvh" }],
|
|
507
|
+
["max-h-dvh", { "max-height": "100dvh" }],
|
|
508
|
+
["max-h-svh", { "max-height": "100svh" }],
|
|
509
|
+
["max-h-lvh", { "max-height": "100lvh" }]
|
|
510
|
+
];
|
|
511
|
+
|
|
512
|
+
const variablesAbbrMap = {
|
|
513
|
+
"bg-blend": "background-blend-mode",
|
|
514
|
+
"bg-clip": "-webkit-background-clip",
|
|
515
|
+
"bg-gradient": "linear-gradient",
|
|
516
|
+
"bg-image": "background-image",
|
|
517
|
+
"bg-origin": "background-origin",
|
|
518
|
+
"bg-position": "background-position",
|
|
519
|
+
"bg-repeat": "background-repeat",
|
|
520
|
+
"bg-size": "background-size",
|
|
521
|
+
"mix-blend": "mix-blend-mode",
|
|
522
|
+
"object": "object-fit",
|
|
523
|
+
"object-position": "object-position",
|
|
524
|
+
"write": "writing-mode",
|
|
525
|
+
"write-orient": "text-orientation"
|
|
526
|
+
};
|
|
527
|
+
const cssVariables = [
|
|
528
|
+
[/^(.+?)-(\$.+)$/, ([, name, varname]) => {
|
|
529
|
+
const prop = variablesAbbrMap[name];
|
|
530
|
+
if (prop)
|
|
531
|
+
return { [prop]: h.cssvar(varname) };
|
|
532
|
+
}]
|
|
533
|
+
];
|
|
534
|
+
|
|
535
|
+
const viewTransition = [
|
|
536
|
+
[/^view-transition-([\w-]+)$/, ([, name]) => {
|
|
537
|
+
return { "view-transition-name": name };
|
|
538
|
+
}]
|
|
539
|
+
];
|
|
540
|
+
|
|
541
|
+
const rules = [
|
|
542
|
+
_.cssVariables,
|
|
543
|
+
cssVariables,
|
|
544
|
+
_.cssProperty,
|
|
545
|
+
container,
|
|
546
|
+
_.contains,
|
|
547
|
+
screenReadersAccess,
|
|
548
|
+
_.pointerEvents,
|
|
549
|
+
_.appearances,
|
|
550
|
+
_.positions,
|
|
551
|
+
_.insets,
|
|
552
|
+
lineClamps,
|
|
553
|
+
isolations,
|
|
554
|
+
_.zIndexes,
|
|
555
|
+
_.orders,
|
|
556
|
+
_.grids,
|
|
557
|
+
_.floats,
|
|
558
|
+
_.margins,
|
|
559
|
+
_.boxSizing,
|
|
560
|
+
_.displays,
|
|
561
|
+
_.aspectRatio,
|
|
562
|
+
_.sizes,
|
|
563
|
+
_.flex,
|
|
564
|
+
tables,
|
|
565
|
+
_.transforms,
|
|
566
|
+
animations,
|
|
567
|
+
_.cursors,
|
|
568
|
+
touchActions,
|
|
569
|
+
_.userSelects,
|
|
570
|
+
_.resizes,
|
|
571
|
+
scrolls,
|
|
572
|
+
listStyle,
|
|
573
|
+
_.appearance,
|
|
574
|
+
columns,
|
|
575
|
+
_.placements,
|
|
576
|
+
_.alignments,
|
|
577
|
+
_.justifies,
|
|
578
|
+
_.gaps,
|
|
579
|
+
_.flexGridJustifiesAlignments,
|
|
580
|
+
spaces,
|
|
581
|
+
divides,
|
|
582
|
+
_.overflows,
|
|
583
|
+
overscrolls,
|
|
584
|
+
scrollBehaviors,
|
|
585
|
+
_.textOverflows,
|
|
586
|
+
_.whitespaces,
|
|
587
|
+
_.breaks,
|
|
588
|
+
_.borders,
|
|
589
|
+
_.bgColors,
|
|
590
|
+
backgroundStyles,
|
|
591
|
+
_.colorScheme,
|
|
592
|
+
_.svgUtilities,
|
|
593
|
+
objectPositions,
|
|
594
|
+
_.paddings,
|
|
595
|
+
_.textAligns,
|
|
596
|
+
_.textIndents,
|
|
597
|
+
_.textWraps,
|
|
598
|
+
_.verticalAligns,
|
|
599
|
+
_.fonts,
|
|
600
|
+
_.textTransforms,
|
|
601
|
+
textTransforms,
|
|
602
|
+
_.fontStyles,
|
|
603
|
+
fontVariantNumeric,
|
|
604
|
+
_.textDecorations,
|
|
605
|
+
_.fontSmoothings,
|
|
606
|
+
_.tabSizes,
|
|
607
|
+
_.textStrokes,
|
|
608
|
+
_.textShadows,
|
|
609
|
+
hyphens,
|
|
610
|
+
writingModes,
|
|
611
|
+
writingOrientations,
|
|
612
|
+
carets,
|
|
613
|
+
accents,
|
|
614
|
+
_.opacity,
|
|
615
|
+
backgroundBlendModes,
|
|
616
|
+
mixBlendModes,
|
|
617
|
+
_.boxShadows,
|
|
618
|
+
_.outline,
|
|
619
|
+
_.rings,
|
|
620
|
+
imageRenderings,
|
|
621
|
+
filters,
|
|
622
|
+
_.transitions,
|
|
623
|
+
_.willChange,
|
|
624
|
+
_.contentVisibility,
|
|
625
|
+
_.contents,
|
|
626
|
+
placeholders,
|
|
627
|
+
_.containerParent,
|
|
628
|
+
viewTransition,
|
|
629
|
+
dynamicViewportHeight,
|
|
630
|
+
// should be the last
|
|
631
|
+
_.questionMark
|
|
632
|
+
].flat(1);
|
|
633
|
+
|
|
634
|
+
export { animations as a, backgroundStyles as b, accents as c, carets as d, columns as e, divides as f, lineClamps as g, spaces as h, imageRenderings as i, hyphens as j, writingOrientations as k, listStyle as l, screenReadersAccess as m, isolations as n, overscrolls as o, placeholders as p, objectPositions as q, rules as r, scrollBehaviors as s, textTransforms as t, backgroundBlendModes as u, mixBlendModes as v, writingModes as w, dynamicViewportHeight as x, cssVariables as y, viewTransition as z };
|