@unocss/vite 0.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +1723 -0
- package/dist/index.mjs +1710 -0
- package/package.json +44 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1710 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
__markAsModule(target);
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __reExport = (target, module, desc) => {
|
|
12
|
+
if (module && typeof module === "object" || typeof module === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(module))
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
15
|
+
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../unocss/src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
presetAttributify: () => src_default2,
|
|
24
|
+
presetUno: () => src_default
|
|
25
|
+
});
|
|
26
|
+
__reExport(src_exports, core_star);
|
|
27
|
+
import * as core_star from "@unocss/core";
|
|
28
|
+
|
|
29
|
+
// ../preset-uno/src/rules/animations.ts
|
|
30
|
+
var transitionProps = ["background-color", "border-color", "color", "fill", "stroke", "opacity", "box-shadow", "transform", "filter", "backdrop-filter"];
|
|
31
|
+
var transitionPropsStr = transitionProps.join(", ");
|
|
32
|
+
var transitions = [
|
|
33
|
+
[/^transition(?:-([a-z-]+))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
34
|
+
if (prop && !transitionProps.includes(prop))
|
|
35
|
+
return;
|
|
36
|
+
return {
|
|
37
|
+
"transition-property": prop || transitionPropsStr,
|
|
38
|
+
"transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
39
|
+
"transition-duration": `${duration}ms`
|
|
40
|
+
};
|
|
41
|
+
}],
|
|
42
|
+
[/^duration-(\d+)$/, ([, duration = "150"]) => {
|
|
43
|
+
return {
|
|
44
|
+
"transition-duration": `${duration}ms`
|
|
45
|
+
};
|
|
46
|
+
}],
|
|
47
|
+
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
48
|
+
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
49
|
+
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
50
|
+
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }]
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
// ../preset-uno/src/rules/border.ts
|
|
54
|
+
import { handler as h } from "@unocss/core";
|
|
55
|
+
|
|
56
|
+
// ../preset-uno/src/utils/mappings.ts
|
|
57
|
+
var directionMap = {
|
|
58
|
+
"l": ["-left"],
|
|
59
|
+
"r": ["-right"],
|
|
60
|
+
"t": ["-top"],
|
|
61
|
+
"b": ["-bottom"],
|
|
62
|
+
"s": ["-inline-start"],
|
|
63
|
+
"e": ["-inline-end"],
|
|
64
|
+
"x": ["-left", "-right"],
|
|
65
|
+
"y": ["-top", "-bottom"],
|
|
66
|
+
"": [""],
|
|
67
|
+
"a": [""]
|
|
68
|
+
};
|
|
69
|
+
var cornerMap = {
|
|
70
|
+
"t": ["-top-left", "-top-right"],
|
|
71
|
+
"r": ["-top-right", "-bottom-right"],
|
|
72
|
+
"b": ["-bottom-left", "-bottom-right"],
|
|
73
|
+
"l": ["-bottom-left", "-top-left"],
|
|
74
|
+
"tl": ["-top-left"],
|
|
75
|
+
"lt": ["-top-left"],
|
|
76
|
+
"tr": ["-top-right"],
|
|
77
|
+
"rt": ["-top-right"],
|
|
78
|
+
"bl": ["-bottom-left"],
|
|
79
|
+
"lb": ["-bottom-left"],
|
|
80
|
+
"br": ["-bottom-right"],
|
|
81
|
+
"rb": ["-bottom-right"],
|
|
82
|
+
"": [""]
|
|
83
|
+
};
|
|
84
|
+
var xyzMap = {
|
|
85
|
+
"x": ["-x"],
|
|
86
|
+
"y": ["-y"],
|
|
87
|
+
"z": ["-z"],
|
|
88
|
+
"": ["-x", "-y"]
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// ../preset-uno/src/rules/border.ts
|
|
92
|
+
var borders = [
|
|
93
|
+
[/^border$/, handlerBorder],
|
|
94
|
+
[/^border(?:-([^-]+))?$/, handlerBorder],
|
|
95
|
+
[/^border(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder]
|
|
96
|
+
];
|
|
97
|
+
var borderRadius = [
|
|
98
|
+
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
99
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
100
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
101
|
+
];
|
|
102
|
+
var borderStyles = [
|
|
103
|
+
["border-solid", { "border-style": "solid" }],
|
|
104
|
+
["border-dashed", { "border-style": "dashed" }],
|
|
105
|
+
["border-dotted", { "border-style": "dotted" }],
|
|
106
|
+
["border-double", { "border-style": "double" }],
|
|
107
|
+
["border-none", { "border-style": "none" }]
|
|
108
|
+
];
|
|
109
|
+
function handlerBorder([, a, b]) {
|
|
110
|
+
const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
|
|
111
|
+
const v = h.bracket.border(s);
|
|
112
|
+
if (v != null) {
|
|
113
|
+
return [
|
|
114
|
+
...directionMap[d].map((i) => [`border${i}-width`, v]),
|
|
115
|
+
["border-style", "solid"]
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function handlerRounded([, a, b], theme2) {
|
|
120
|
+
var _a;
|
|
121
|
+
const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
|
|
122
|
+
const v = ((_a = theme2.borderRadius) == null ? void 0 : _a[s]) || h.bracket.fraction.size(s);
|
|
123
|
+
if (v != null)
|
|
124
|
+
return cornerMap[d].map((i) => [`border${i}-radius`, v]);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ../preset-uno/src/rules/colors.ts
|
|
128
|
+
import { handler as h2, hex2rgba } from "@unocss/core";
|
|
129
|
+
var colorResolver = (attribute, varName) => ([, body], theme2) => {
|
|
130
|
+
var _a;
|
|
131
|
+
const [main, opacity2] = body.split("/");
|
|
132
|
+
const [name, no = "DEFAULT"] = main.split(/(?<=[a-z])-?(?=[0-9])/g);
|
|
133
|
+
if (!name)
|
|
134
|
+
return;
|
|
135
|
+
let color;
|
|
136
|
+
const bracket = h2.bracket(main) || main;
|
|
137
|
+
if (bracket.startsWith("#"))
|
|
138
|
+
color = bracket.slice(1);
|
|
139
|
+
if (bracket.startsWith("hex-"))
|
|
140
|
+
color = bracket.slice(4);
|
|
141
|
+
if (!color) {
|
|
142
|
+
if (name === "transparent") {
|
|
143
|
+
return {
|
|
144
|
+
[attribute]: "transparent"
|
|
145
|
+
};
|
|
146
|
+
} else if (name === "inherit") {
|
|
147
|
+
return {
|
|
148
|
+
[attribute]: "inherit"
|
|
149
|
+
};
|
|
150
|
+
} else if (name === "current") {
|
|
151
|
+
return {
|
|
152
|
+
[attribute]: "currentColor"
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
color = (_a = theme2.colors) == null ? void 0 : _a[name];
|
|
156
|
+
if (no && color && typeof color !== "string")
|
|
157
|
+
color = color[no];
|
|
158
|
+
}
|
|
159
|
+
if (typeof color !== "string")
|
|
160
|
+
return;
|
|
161
|
+
const rgba = hex2rgba(color);
|
|
162
|
+
if (rgba) {
|
|
163
|
+
const a = opacity2 ? parseFloat(opacity2) / 100 : rgba[3];
|
|
164
|
+
if (a != null && !Number.isNaN(a)) {
|
|
165
|
+
rgba[3] = a;
|
|
166
|
+
return {
|
|
167
|
+
[attribute]: `rgba(${rgba.join(",")})`
|
|
168
|
+
};
|
|
169
|
+
} else {
|
|
170
|
+
return {
|
|
171
|
+
[`--un-${varName}-opacity`]: 1,
|
|
172
|
+
[attribute]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
var opacity = [
|
|
178
|
+
[/^op(?:acity)?-?(\d+)$/, ([, d]) => ({ opacity: h2.percent(d) })]
|
|
179
|
+
];
|
|
180
|
+
var textColors = [
|
|
181
|
+
[/^(?:text|color|c)-(.+)$/, colorResolver("color", "text")],
|
|
182
|
+
[/^(?:text|color|c)-op(?:acity)?-?(\d+)$/m, ([, opacity2]) => ({ "--un-text-opacity": h2.percent(opacity2) })]
|
|
183
|
+
];
|
|
184
|
+
var bgColors = [
|
|
185
|
+
[/^bg-(.+)$/, colorResolver("background-color", "bg")],
|
|
186
|
+
[/^bg-op(?:acity)?-?(\d+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": h2.percent(opacity2) })]
|
|
187
|
+
];
|
|
188
|
+
var borderColors = [
|
|
189
|
+
[/^border-(.+)$/, colorResolver("border-color", "border")],
|
|
190
|
+
[/^border-op(?:acity)?-?(\d+)$/m, ([, opacity2]) => ({ "--un-border-opacity": h2.percent(opacity2) })]
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
// ../preset-uno/src/rules/filters.ts
|
|
194
|
+
var filterContnet = "var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia) var(--un-drop-shadow)";
|
|
195
|
+
var init = {
|
|
196
|
+
"--un-blur": "var(--un-empty,/*!*/ /*!*/)",
|
|
197
|
+
"--un-brightness": "var(--un-empty,/*!*/ /*!*/)",
|
|
198
|
+
"--un-contrast": "var(--un-empty,/*!*/ /*!*/)",
|
|
199
|
+
"--un-grayscale": "var(--un-empty,/*!*/ /*!*/)",
|
|
200
|
+
"--un-hue-rotate": "var(--un-empty,/*!*/ /*!*/)",
|
|
201
|
+
"--un-invert": "var(--un-empty,/*!*/ /*!*/)",
|
|
202
|
+
"--un-saturate": "var(--un-empty,/*!*/ /*!*/)",
|
|
203
|
+
"--un-sepia": "var(--un-empty,/*!*/ /*!*/)",
|
|
204
|
+
"--un-drop-shadow": "var(--un-empty,/*!*/ /*!*/)",
|
|
205
|
+
"filter": filterContnet
|
|
206
|
+
};
|
|
207
|
+
var filters = [
|
|
208
|
+
["filter", init],
|
|
209
|
+
["filter-none", { filter: "none" }],
|
|
210
|
+
[/^blur(?:-(\d+))?$/, ([, d]) => ({ "--un-blur": `blur(${d}px)`, "filter": filterContnet })],
|
|
211
|
+
["invert", { "--un-invert": "invert(100%)" }]
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
// ../preset-uno/src/rules/flex.ts
|
|
215
|
+
var flex = [
|
|
216
|
+
["flex-col", { "flex-direction": "column" }],
|
|
217
|
+
["flex-col-reverse", { "flex-direction": "column-reverse" }],
|
|
218
|
+
["flex-row", { "flex-direction": "row" }],
|
|
219
|
+
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
220
|
+
["flex-wrap", { "flex-wrap": "wrap" }],
|
|
221
|
+
["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
|
|
222
|
+
["flex-nowrap", { "flex-wrap": "nowrap" }],
|
|
223
|
+
["flex-1", { flex: "1 1 0%" }],
|
|
224
|
+
["flex-auto", { flex: "1 1 auto" }],
|
|
225
|
+
["flex-initial", { flex: "0 1 auto" }],
|
|
226
|
+
["flex-none", { flex: "none" }],
|
|
227
|
+
[/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
|
|
228
|
+
["flex-grow", { "flex-grow": 1 }],
|
|
229
|
+
["flex-grow-0", { "flex-grow": 0 }],
|
|
230
|
+
["flex-shrink", { "flex-shrink": 1 }],
|
|
231
|
+
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
232
|
+
["flex", { display: "flex" }],
|
|
233
|
+
["inline-flex", { display: "inline-flex" }]
|
|
234
|
+
];
|
|
235
|
+
|
|
236
|
+
// ../preset-uno/src/rules/font.ts
|
|
237
|
+
import { handler as h3, toArray } from "@unocss/core";
|
|
238
|
+
var fonts = [
|
|
239
|
+
[/^font-(\w+)$/, ([, d], theme2) => {
|
|
240
|
+
var _a;
|
|
241
|
+
const font = (_a = theme2.fontFamily) == null ? void 0 : _a[d];
|
|
242
|
+
if (font) {
|
|
243
|
+
return {
|
|
244
|
+
"font-family": font
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}]
|
|
248
|
+
];
|
|
249
|
+
var weightMap = {
|
|
250
|
+
thin: "100",
|
|
251
|
+
extralight: "200",
|
|
252
|
+
light: "300",
|
|
253
|
+
normal: "400",
|
|
254
|
+
medium: "500",
|
|
255
|
+
semibold: "600",
|
|
256
|
+
bold: "700",
|
|
257
|
+
extrabold: "800",
|
|
258
|
+
black: "900"
|
|
259
|
+
};
|
|
260
|
+
var fontSizes = [
|
|
261
|
+
[/^text-([^-]+)$/, ([, s = "base"], theme2) => {
|
|
262
|
+
var _a;
|
|
263
|
+
const result = toArray(((_a = theme2.fontSize) == null ? void 0 : _a[s]) || h3.bracket.size(s));
|
|
264
|
+
if (result == null ? void 0 : result[0]) {
|
|
265
|
+
const [size, height = "1"] = result;
|
|
266
|
+
return {
|
|
267
|
+
"font-size": size,
|
|
268
|
+
"line-height": height
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}]
|
|
272
|
+
];
|
|
273
|
+
var fontWeights = [
|
|
274
|
+
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
275
|
+
const v = weightMap[s] || h3.number(s);
|
|
276
|
+
if (v)
|
|
277
|
+
return { "font-weight": v };
|
|
278
|
+
}]
|
|
279
|
+
];
|
|
280
|
+
var leadings = [
|
|
281
|
+
[/^(?:leading|lh)-([^-]+)$/, ([, s], theme2) => {
|
|
282
|
+
var _a;
|
|
283
|
+
const v = ((_a = theme2.lineHeight) == null ? void 0 : _a[s]) || h3.bracket.size(s);
|
|
284
|
+
if (v !== null)
|
|
285
|
+
return { "line-height": v };
|
|
286
|
+
}]
|
|
287
|
+
];
|
|
288
|
+
var trackings = [
|
|
289
|
+
[/^tracking-([^-]+)$/, ([, s], theme2) => {
|
|
290
|
+
var _a;
|
|
291
|
+
const v = ((_a = theme2.letterSpacing) == null ? void 0 : _a[s]) || h3.bracket.size(s);
|
|
292
|
+
if (v !== null)
|
|
293
|
+
return { "letter-spacing": v };
|
|
294
|
+
}]
|
|
295
|
+
];
|
|
296
|
+
|
|
297
|
+
// ../preset-uno/src/rules/gap.ts
|
|
298
|
+
import { handler as h4 } from "@unocss/core";
|
|
299
|
+
var gaps = [
|
|
300
|
+
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
301
|
+
const v = h4.bracket.size(s);
|
|
302
|
+
if (v != null) {
|
|
303
|
+
return {
|
|
304
|
+
"grid-gap": v,
|
|
305
|
+
"gap": v
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}],
|
|
309
|
+
[/^(?:flex-|grid-)?gap-x-([^-]+)$/, ([, s]) => {
|
|
310
|
+
const v = h4.bracket.size(s);
|
|
311
|
+
if (v != null) {
|
|
312
|
+
return {
|
|
313
|
+
"grid-column-gap": v,
|
|
314
|
+
"column-gap": v
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}],
|
|
318
|
+
[/^(?:flex-|grid-)?gap-y-([^-]+)$/, ([, s]) => {
|
|
319
|
+
const v = h4.bracket.size(s);
|
|
320
|
+
if (v != null) {
|
|
321
|
+
return {
|
|
322
|
+
"grid-row-gap": v,
|
|
323
|
+
"row-gap": v
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}]
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
// ../preset-uno/src/rules/grid.ts
|
|
330
|
+
var grids = [
|
|
331
|
+
["grid", { display: "grid" }],
|
|
332
|
+
["inline-grid", { display: "inline-grid" }],
|
|
333
|
+
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d}, minmax(0, 1fr))` })],
|
|
334
|
+
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d}, minmax(0, 1fr))` })],
|
|
335
|
+
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
336
|
+
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
|
|
337
|
+
];
|
|
338
|
+
|
|
339
|
+
// ../preset-uno/src/rules/layouts.ts
|
|
340
|
+
var overflowValues = [
|
|
341
|
+
"auto",
|
|
342
|
+
"hidden",
|
|
343
|
+
"visible",
|
|
344
|
+
"scroll"
|
|
345
|
+
];
|
|
346
|
+
var overflows = [
|
|
347
|
+
[/^overflow-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0],
|
|
348
|
+
[/^overflow-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
// ../preset-uno/src/rules/positions.ts
|
|
352
|
+
import { handler as h5 } from "@unocss/core";
|
|
353
|
+
var positions = [
|
|
354
|
+
["relative", { position: "relative" }],
|
|
355
|
+
["absolute", { position: "absolute" }],
|
|
356
|
+
["fixed", { position: "fixed" }]
|
|
357
|
+
];
|
|
358
|
+
var justifies = [
|
|
359
|
+
["justify-start", { "justify-content": "flex-start" }],
|
|
360
|
+
["justify-end", { "justify-content": "flex-end" }],
|
|
361
|
+
["justify-center", { "justify-content": "center" }],
|
|
362
|
+
["justify-between", { "justify-content": "space-between" }],
|
|
363
|
+
["justify-around", { "justify-content": "space-around" }],
|
|
364
|
+
["justify-evenly", { "justify-content": "space-evenly" }]
|
|
365
|
+
];
|
|
366
|
+
var orders = [
|
|
367
|
+
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || h5.bracket.number(v) })]
|
|
368
|
+
];
|
|
369
|
+
var basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
370
|
+
var justifyItems = basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]);
|
|
371
|
+
var justifySelfs = basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }]);
|
|
372
|
+
var alignContents = [
|
|
373
|
+
["content-start", { "align-content": "flex-start" }],
|
|
374
|
+
["content-end", { "align-content": "flex-end" }],
|
|
375
|
+
["content-center", { "align-content": "center" }],
|
|
376
|
+
["content-between", { "align-content": "space-between" }],
|
|
377
|
+
["content-around", { "align-content": "space-around" }],
|
|
378
|
+
["content-evenly", { "align-content": "space-evenly" }]
|
|
379
|
+
];
|
|
380
|
+
var alignItems = [
|
|
381
|
+
["items-start", { "align-items": "flex-start" }],
|
|
382
|
+
["items-end", { "align-items": "flex-end" }],
|
|
383
|
+
["items-center", { "align-items": "center" }],
|
|
384
|
+
["items-baseline", { "align-items": "baseline" }],
|
|
385
|
+
["items-stretch", { "align-items": "stretch" }]
|
|
386
|
+
];
|
|
387
|
+
var alignSelfs = [
|
|
388
|
+
["self-auto", { "align-self": "auto" }],
|
|
389
|
+
["self-start", { "align-self": "flex-start" }],
|
|
390
|
+
["self-end", { "align-self": "flex-end" }],
|
|
391
|
+
["self-center", { "align-self": "center" }],
|
|
392
|
+
["self-stretch", { "align-items": "stretch" }]
|
|
393
|
+
];
|
|
394
|
+
var placeContents = [
|
|
395
|
+
["place-content-start", { "place-content": "start" }],
|
|
396
|
+
["place-content-end", { "place-content": "end" }],
|
|
397
|
+
["place-content-center", { "place-content": "center" }],
|
|
398
|
+
["place-content-between", { "place-content": "space-between" }],
|
|
399
|
+
["place-content-around", { "place-content": "space-around" }],
|
|
400
|
+
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
401
|
+
["place-content-stretch", { "place-content": "stretch" }]
|
|
402
|
+
];
|
|
403
|
+
var placeItems = basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]);
|
|
404
|
+
var placeSelfs = basicSet.map((i) => [`place-self-${i}`, { "place-self": i }]);
|
|
405
|
+
function handleInsetValue(v) {
|
|
406
|
+
var _a;
|
|
407
|
+
return (_a = { auto: "auto", full: "100%" }[v]) != null ? _a : h5.bracket.fraction.size(v);
|
|
408
|
+
}
|
|
409
|
+
var insets = [
|
|
410
|
+
[/^inset-(x|y)-(.+)$/, ([, d, v]) => {
|
|
411
|
+
const r = handleInsetValue(v);
|
|
412
|
+
if (r != null)
|
|
413
|
+
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
414
|
+
}],
|
|
415
|
+
[/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
416
|
+
];
|
|
417
|
+
var floats = [
|
|
418
|
+
[/^float-(left|right|none)$/, ([, value]) => ({ float: value })],
|
|
419
|
+
[/^clear-(left|right|both|none)$/, ([, value]) => ({ clear: value })]
|
|
420
|
+
];
|
|
421
|
+
var zIndexes = [
|
|
422
|
+
["z-auto", { "z-index": "auto" }],
|
|
423
|
+
[/^z-([^-]+)$/, ([, v]) => ({ "z-index": h5.number(v) })]
|
|
424
|
+
];
|
|
425
|
+
var objectPositions = [
|
|
426
|
+
["object-cover", { "object-fit": "cover" }],
|
|
427
|
+
["object-contain", { "object-fit": "contain" }],
|
|
428
|
+
["object-fill", { "object-fit": "fill" }],
|
|
429
|
+
["object-scale-down", { "object-fit": "scale-down" }],
|
|
430
|
+
["object-none", { "object-fit": "none" }],
|
|
431
|
+
["object-bottom", { "object-position": "bottom" }],
|
|
432
|
+
["object-top", { "object-position": "top" }],
|
|
433
|
+
["object-right", { "object-position": "right" }],
|
|
434
|
+
["object-left", { "object-position": "left" }],
|
|
435
|
+
["object-lb", { "object-position": "left bottom" }],
|
|
436
|
+
["object-lt", { "object-position": "left top" }],
|
|
437
|
+
["object-rb", { "object-position": "right bottom" }],
|
|
438
|
+
["object-rt", { "object-position": "right top" }]
|
|
439
|
+
];
|
|
440
|
+
|
|
441
|
+
// ../preset-uno/src/rules/size.ts
|
|
442
|
+
import { handler as h6 } from "@unocss/core";
|
|
443
|
+
var sizes = [
|
|
444
|
+
["w-full", { width: "100%" }],
|
|
445
|
+
["h-full", { height: "100%" }],
|
|
446
|
+
["w-screen", { width: "100vw" }],
|
|
447
|
+
["h-screen", { height: "100vh" }],
|
|
448
|
+
[/^w-([^-]+)$/, ([, s]) => ({ width: h6.bracket.fraction.size(s) })],
|
|
449
|
+
[/^h-([^-]+)$/, ([, s]) => ({ height: h6.bracket.fraction.size(s) })],
|
|
450
|
+
[/^max-w-([^-]+)$/, ([, s]) => ({ "max-width": h6.bracket.fraction.size(s) })],
|
|
451
|
+
[/^max-h-([^-]+)$/, ([, s]) => ({ "max-height": h6.bracket.fraction.size(s) })]
|
|
452
|
+
];
|
|
453
|
+
|
|
454
|
+
// ../preset-uno/src/rules/spacing.ts
|
|
455
|
+
import { handler as h7 } from "@unocss/core";
|
|
456
|
+
var directionSize = (prefix) => ([_, direction, size]) => {
|
|
457
|
+
const v = h7.bracket.size.fraction(size);
|
|
458
|
+
if (v)
|
|
459
|
+
return directionMap[direction].map((i) => [prefix + i, v]);
|
|
460
|
+
};
|
|
461
|
+
var paddings = [
|
|
462
|
+
[/^pa?()-?(-?[^-]+)$/, directionSize("padding")],
|
|
463
|
+
[/^p-?([xy])-?(-?[^-]+)$/, directionSize("padding")],
|
|
464
|
+
[/^p-?([rltbse])-?(-?[^-]+)$/, directionSize("padding")]
|
|
465
|
+
];
|
|
466
|
+
var margins = [
|
|
467
|
+
[/^ma?()-?(-?[^-]+)$/, directionSize("margin")],
|
|
468
|
+
[/^m-?([xy])-?(-?[^-]+)$/, directionSize("margin")],
|
|
469
|
+
[/^m-?([rltbse])-?(-?[^-]+)$/, directionSize("margin")]
|
|
470
|
+
];
|
|
471
|
+
|
|
472
|
+
// ../preset-uno/src/rules/static.ts
|
|
473
|
+
var displays = [
|
|
474
|
+
["inline", { display: "inline" }],
|
|
475
|
+
["block", { display: "block" }],
|
|
476
|
+
["inline-block", { display: "inline-block" }],
|
|
477
|
+
["table", { display: "table" }],
|
|
478
|
+
["contents", { display: "contents" }],
|
|
479
|
+
["flow-root", { display: "flow-root" }],
|
|
480
|
+
["list-item", { display: "list-item" }],
|
|
481
|
+
["hidden", { display: "none" }]
|
|
482
|
+
];
|
|
483
|
+
var appearances = [
|
|
484
|
+
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }],
|
|
485
|
+
["appearance-none", { appearance: "none" }],
|
|
486
|
+
["visible", { visibility: "visible" }],
|
|
487
|
+
["invisible", { visibility: "hidden" }],
|
|
488
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
489
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
490
|
+
];
|
|
491
|
+
var cursors = [
|
|
492
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
493
|
+
];
|
|
494
|
+
var pointerEvents = [
|
|
495
|
+
["pointer-events-none", { "pointer-events": "none" }],
|
|
496
|
+
["pointer-events-auto", { "pointer-events": "auto" }]
|
|
497
|
+
];
|
|
498
|
+
var resizes = [
|
|
499
|
+
["resize-none", { resize: "none" }],
|
|
500
|
+
["resize-x", { resize: "horizontal" }],
|
|
501
|
+
["resize-y", { resize: "vertical" }],
|
|
502
|
+
["resize", { resize: "both" }]
|
|
503
|
+
];
|
|
504
|
+
var userSelects = [
|
|
505
|
+
["select-none", { "user-select": "none" }],
|
|
506
|
+
["select-text", { "user-select": "text" }],
|
|
507
|
+
["select-all", { "user-select": "all" }],
|
|
508
|
+
["select-auto", { "user-select": "auto" }]
|
|
509
|
+
];
|
|
510
|
+
var verticalAligns = [
|
|
511
|
+
["vertical-baseline", { "vertical-align": "baseline" }],
|
|
512
|
+
["vertical-top", { "vertical-align": "top" }],
|
|
513
|
+
["vertical-middle", { "vertical-align": "middle" }],
|
|
514
|
+
["vertical-text-top", { "vertical-align": "text-top" }],
|
|
515
|
+
["vertical-text-bottom", { "vertical-align": "text-bottom" }]
|
|
516
|
+
];
|
|
517
|
+
var whitespaces = [
|
|
518
|
+
["whitespace-normal", { "white-space": "normal" }],
|
|
519
|
+
["whitespace-nowrap", { "white-space": "nowrap" }],
|
|
520
|
+
["whitespace-pre", { "white-space": "pre" }],
|
|
521
|
+
["whitespace-pre-line", { "white-space": "pre-line" }],
|
|
522
|
+
["whitespace-pre-wrap", { "white-space": "pre-wrap" }]
|
|
523
|
+
];
|
|
524
|
+
var breaks = [
|
|
525
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
526
|
+
["break-works", { "overflow-wrap": "break-word" }],
|
|
527
|
+
["break-all", { "word-break": "break-all" }]
|
|
528
|
+
];
|
|
529
|
+
var textOverflows = [
|
|
530
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
531
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
532
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
533
|
+
];
|
|
534
|
+
var textTransforms = [
|
|
535
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
536
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
537
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
538
|
+
["case-normal", { "text-transform": "none" }]
|
|
539
|
+
];
|
|
540
|
+
var textDecorations = [
|
|
541
|
+
["underline", { "text-decoration": "underline" }],
|
|
542
|
+
["line-through", { "text-decoration": "line-through" }],
|
|
543
|
+
["no-underline", { "text-decoration": "none" }]
|
|
544
|
+
];
|
|
545
|
+
var textAligns = [
|
|
546
|
+
["text-center", { "text-align": "center" }],
|
|
547
|
+
["text-left", { "text-align": "left" }],
|
|
548
|
+
["text-right", { "text-align": "right" }],
|
|
549
|
+
["text-justify", { "text-align": "justify" }]
|
|
550
|
+
];
|
|
551
|
+
|
|
552
|
+
// ../preset-uno/src/rules/transform.ts
|
|
553
|
+
var transforms = [
|
|
554
|
+
[
|
|
555
|
+
"transform",
|
|
556
|
+
{
|
|
557
|
+
"--un-rotate": 0,
|
|
558
|
+
"--un-scale-x": 1,
|
|
559
|
+
"--un-scale-y": 1,
|
|
560
|
+
"--un-scale-z": 1,
|
|
561
|
+
"--un-skew-x": 0,
|
|
562
|
+
"--un-skew-y": 0,
|
|
563
|
+
"--un-translate-x": 0,
|
|
564
|
+
"--un-translate-y": 0,
|
|
565
|
+
"--un-translate-z": 0,
|
|
566
|
+
"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))"
|
|
567
|
+
}
|
|
568
|
+
],
|
|
569
|
+
[/^translate()-([^-]+)$/, handleTranslate],
|
|
570
|
+
[/^translate-([xyz])-([^-]+)$/, handleTranslate],
|
|
571
|
+
[/^scale()-([^-]+)$/, handleScale],
|
|
572
|
+
[/^scale-([xyz])-([^-]+)$/, handleScale],
|
|
573
|
+
[/^rotate-([^-]+)(?:deg)?$/, handleRotate],
|
|
574
|
+
["origin-center", { "transform-origin": "center" }],
|
|
575
|
+
["origin-top", { "transform-origin": "top" }],
|
|
576
|
+
["origin-top-right", { "transform-origin": "top right" }],
|
|
577
|
+
["origin-right", { "transform-origin": "right" }],
|
|
578
|
+
["origin-bottom-right", { "transform-origin": "bottom right" }],
|
|
579
|
+
["origin-bottom", { "transform-origin": "bottom" }],
|
|
580
|
+
["origin-bottom-left", { "transform-origin": "bottom left" }],
|
|
581
|
+
["origin-left", { "transform-origin": "left" }],
|
|
582
|
+
["origin-top-left", { "transform-origin": "top left" }]
|
|
583
|
+
];
|
|
584
|
+
function handleTranslate([, d, b]) {
|
|
585
|
+
const v = src_exports.handler.bracket.size(b);
|
|
586
|
+
if (v != null) {
|
|
587
|
+
return [
|
|
588
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v])
|
|
589
|
+
];
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function handleScale([, d, b]) {
|
|
593
|
+
const v = src_exports.handler.bracket.fraction.percent(b);
|
|
594
|
+
if (v != null) {
|
|
595
|
+
return [
|
|
596
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v])
|
|
597
|
+
];
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function handleRotate([, b]) {
|
|
601
|
+
const v = src_exports.handler.bracket.number(b);
|
|
602
|
+
if (v != null)
|
|
603
|
+
return { "--un-rotate": `${v}deg` };
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// ../preset-uno/src/rules/index.ts
|
|
607
|
+
var rules = [
|
|
608
|
+
paddings,
|
|
609
|
+
margins,
|
|
610
|
+
displays,
|
|
611
|
+
opacity,
|
|
612
|
+
bgColors,
|
|
613
|
+
borders,
|
|
614
|
+
borderColors,
|
|
615
|
+
borderStyles,
|
|
616
|
+
borderRadius,
|
|
617
|
+
fonts,
|
|
618
|
+
fontSizes,
|
|
619
|
+
fontWeights,
|
|
620
|
+
textOverflows,
|
|
621
|
+
textDecorations,
|
|
622
|
+
textTransforms,
|
|
623
|
+
textAligns,
|
|
624
|
+
textColors,
|
|
625
|
+
flex,
|
|
626
|
+
grids,
|
|
627
|
+
gaps,
|
|
628
|
+
positions,
|
|
629
|
+
sizes,
|
|
630
|
+
cursors,
|
|
631
|
+
appearances,
|
|
632
|
+
pointerEvents,
|
|
633
|
+
resizes,
|
|
634
|
+
verticalAligns,
|
|
635
|
+
userSelects,
|
|
636
|
+
whitespaces,
|
|
637
|
+
breaks,
|
|
638
|
+
trackings,
|
|
639
|
+
leadings,
|
|
640
|
+
overflows,
|
|
641
|
+
positions,
|
|
642
|
+
orders,
|
|
643
|
+
justifies,
|
|
644
|
+
justifyItems,
|
|
645
|
+
justifySelfs,
|
|
646
|
+
alignContents,
|
|
647
|
+
alignItems,
|
|
648
|
+
alignSelfs,
|
|
649
|
+
placeContents,
|
|
650
|
+
placeItems,
|
|
651
|
+
placeSelfs,
|
|
652
|
+
insets,
|
|
653
|
+
floats,
|
|
654
|
+
zIndexes,
|
|
655
|
+
objectPositions,
|
|
656
|
+
transitions,
|
|
657
|
+
filters,
|
|
658
|
+
transforms
|
|
659
|
+
].flat(1);
|
|
660
|
+
|
|
661
|
+
// ../preset-uno/src/theme/colors.ts
|
|
662
|
+
var colors = {
|
|
663
|
+
black: "#000",
|
|
664
|
+
white: "#fff",
|
|
665
|
+
rose: {
|
|
666
|
+
50: "#fff1f2",
|
|
667
|
+
100: "#ffe4e6",
|
|
668
|
+
200: "#fecdd3",
|
|
669
|
+
300: "#fda4af",
|
|
670
|
+
400: "#fb7185",
|
|
671
|
+
500: "#f43f5e",
|
|
672
|
+
600: "#e11d48",
|
|
673
|
+
700: "#be123c",
|
|
674
|
+
800: "#9f1239",
|
|
675
|
+
900: "#881337"
|
|
676
|
+
},
|
|
677
|
+
pink: {
|
|
678
|
+
50: "#fdf2f8",
|
|
679
|
+
100: "#fce7f3",
|
|
680
|
+
200: "#fbcfe8",
|
|
681
|
+
300: "#f9a8d4",
|
|
682
|
+
400: "#f472b6",
|
|
683
|
+
500: "#ec4899",
|
|
684
|
+
600: "#db2777",
|
|
685
|
+
700: "#be185d",
|
|
686
|
+
800: "#9d174d",
|
|
687
|
+
900: "#831843"
|
|
688
|
+
},
|
|
689
|
+
fuchsia: {
|
|
690
|
+
50: "#fdf4ff",
|
|
691
|
+
100: "#fae8ff",
|
|
692
|
+
200: "#f5d0fe",
|
|
693
|
+
300: "#f0abfc",
|
|
694
|
+
400: "#e879f9",
|
|
695
|
+
500: "#d946ef",
|
|
696
|
+
600: "#c026d3",
|
|
697
|
+
700: "#a21caf",
|
|
698
|
+
800: "#86198f",
|
|
699
|
+
900: "#701a75"
|
|
700
|
+
},
|
|
701
|
+
purple: {
|
|
702
|
+
50: "#faf5ff",
|
|
703
|
+
100: "#f3e8ff",
|
|
704
|
+
200: "#e9d5ff",
|
|
705
|
+
300: "#d8b4fe",
|
|
706
|
+
400: "#c084fc",
|
|
707
|
+
500: "#a855f7",
|
|
708
|
+
600: "#9333ea",
|
|
709
|
+
700: "#7e22ce",
|
|
710
|
+
800: "#6b21a8",
|
|
711
|
+
900: "#581c87"
|
|
712
|
+
},
|
|
713
|
+
violet: {
|
|
714
|
+
50: "#f5f3ff",
|
|
715
|
+
100: "#ede9fe",
|
|
716
|
+
200: "#ddd6fe",
|
|
717
|
+
300: "#c4b5fd",
|
|
718
|
+
400: "#a78bfa",
|
|
719
|
+
500: "#8b5cf6",
|
|
720
|
+
600: "#7c3aed",
|
|
721
|
+
700: "#6d28d9",
|
|
722
|
+
800: "#5b21b6",
|
|
723
|
+
900: "#4c1d95"
|
|
724
|
+
},
|
|
725
|
+
indigo: {
|
|
726
|
+
50: "#eef2ff",
|
|
727
|
+
100: "#e0e7ff",
|
|
728
|
+
200: "#c7d2fe",
|
|
729
|
+
300: "#a5b4fc",
|
|
730
|
+
400: "#818cf8",
|
|
731
|
+
500: "#6366f1",
|
|
732
|
+
600: "#4f46e5",
|
|
733
|
+
700: "#4338ca",
|
|
734
|
+
800: "#3730a3",
|
|
735
|
+
900: "#312e81"
|
|
736
|
+
},
|
|
737
|
+
blue: {
|
|
738
|
+
50: "#eff6ff",
|
|
739
|
+
100: "#dbeafe",
|
|
740
|
+
200: "#bfdbfe",
|
|
741
|
+
300: "#93c5fd",
|
|
742
|
+
400: "#60a5fa",
|
|
743
|
+
500: "#3b82f6",
|
|
744
|
+
600: "#2563eb",
|
|
745
|
+
700: "#1d4ed8",
|
|
746
|
+
800: "#1e40af",
|
|
747
|
+
900: "#1e3a8a"
|
|
748
|
+
},
|
|
749
|
+
sky: {
|
|
750
|
+
50: "#f0f9ff",
|
|
751
|
+
100: "#e0f2fe",
|
|
752
|
+
200: "#bae6fd",
|
|
753
|
+
300: "#7dd3fc",
|
|
754
|
+
400: "#38bdf8",
|
|
755
|
+
500: "#0ea5e9",
|
|
756
|
+
600: "#0284c7",
|
|
757
|
+
700: "#0369a1",
|
|
758
|
+
800: "#075985",
|
|
759
|
+
900: "#0c4a6e"
|
|
760
|
+
},
|
|
761
|
+
cyan: {
|
|
762
|
+
50: "#ecfeff",
|
|
763
|
+
100: "#cffafe",
|
|
764
|
+
200: "#a5f3fc",
|
|
765
|
+
300: "#67e8f9",
|
|
766
|
+
400: "#22d3ee",
|
|
767
|
+
500: "#06b6d4",
|
|
768
|
+
600: "#0891b2",
|
|
769
|
+
700: "#0e7490",
|
|
770
|
+
800: "#155e75",
|
|
771
|
+
900: "#164e63"
|
|
772
|
+
},
|
|
773
|
+
teal: {
|
|
774
|
+
50: "#f0fdfa",
|
|
775
|
+
100: "#ccfbf1",
|
|
776
|
+
200: "#99f6e4",
|
|
777
|
+
300: "#5eead4",
|
|
778
|
+
400: "#2dd4bf",
|
|
779
|
+
500: "#14b8a6",
|
|
780
|
+
600: "#0d9488",
|
|
781
|
+
700: "#0f766e",
|
|
782
|
+
800: "#115e59",
|
|
783
|
+
900: "#134e4a"
|
|
784
|
+
},
|
|
785
|
+
emerald: {
|
|
786
|
+
50: "#ecfdf5",
|
|
787
|
+
100: "#d1fae5",
|
|
788
|
+
200: "#a7f3d0",
|
|
789
|
+
300: "#6ee7b7",
|
|
790
|
+
400: "#34d399",
|
|
791
|
+
500: "#10b981",
|
|
792
|
+
600: "#059669",
|
|
793
|
+
700: "#047857",
|
|
794
|
+
800: "#065f46",
|
|
795
|
+
900: "#064e3b"
|
|
796
|
+
},
|
|
797
|
+
green: {
|
|
798
|
+
50: "#f0fdf4",
|
|
799
|
+
100: "#dcfce7",
|
|
800
|
+
200: "#bbf7d0",
|
|
801
|
+
300: "#86efac",
|
|
802
|
+
400: "#4ade80",
|
|
803
|
+
500: "#22c55e",
|
|
804
|
+
600: "#16a34a",
|
|
805
|
+
700: "#15803d",
|
|
806
|
+
800: "#166534",
|
|
807
|
+
900: "#14532d"
|
|
808
|
+
},
|
|
809
|
+
lime: {
|
|
810
|
+
50: "#f7fee7",
|
|
811
|
+
100: "#ecfccb",
|
|
812
|
+
200: "#d9f99d",
|
|
813
|
+
300: "#bef264",
|
|
814
|
+
400: "#a3e635",
|
|
815
|
+
500: "#84cc16",
|
|
816
|
+
600: "#65a30d",
|
|
817
|
+
700: "#4d7c0f",
|
|
818
|
+
800: "#3f6212",
|
|
819
|
+
900: "#365314"
|
|
820
|
+
},
|
|
821
|
+
yellow: {
|
|
822
|
+
50: "#fefce8",
|
|
823
|
+
100: "#fef9c3",
|
|
824
|
+
200: "#fef08a",
|
|
825
|
+
300: "#fde047",
|
|
826
|
+
400: "#facc15",
|
|
827
|
+
500: "#eab308",
|
|
828
|
+
600: "#ca8a04",
|
|
829
|
+
700: "#a16207",
|
|
830
|
+
800: "#854d0e",
|
|
831
|
+
900: "#713f12"
|
|
832
|
+
},
|
|
833
|
+
amber: {
|
|
834
|
+
50: "#fffbeb",
|
|
835
|
+
100: "#fef3c7",
|
|
836
|
+
200: "#fde68a",
|
|
837
|
+
300: "#fcd34d",
|
|
838
|
+
400: "#fbbf24",
|
|
839
|
+
500: "#f59e0b",
|
|
840
|
+
600: "#d97706",
|
|
841
|
+
700: "#b45309",
|
|
842
|
+
800: "#92400e",
|
|
843
|
+
900: "#78350f"
|
|
844
|
+
},
|
|
845
|
+
orange: {
|
|
846
|
+
50: "#fff7ed",
|
|
847
|
+
100: "#ffedd5",
|
|
848
|
+
200: "#fed7aa",
|
|
849
|
+
300: "#fdba74",
|
|
850
|
+
400: "#fb923c",
|
|
851
|
+
500: "#f97316",
|
|
852
|
+
600: "#ea580c",
|
|
853
|
+
700: "#c2410c",
|
|
854
|
+
800: "#9a3412",
|
|
855
|
+
900: "#7c2d12"
|
|
856
|
+
},
|
|
857
|
+
red: {
|
|
858
|
+
50: "#fef2f2",
|
|
859
|
+
100: "#fee2e2",
|
|
860
|
+
200: "#fecaca",
|
|
861
|
+
300: "#fca5a5",
|
|
862
|
+
400: "#f87171",
|
|
863
|
+
500: "#ef4444",
|
|
864
|
+
600: "#dc2626",
|
|
865
|
+
700: "#b91c1c",
|
|
866
|
+
800: "#991b1b",
|
|
867
|
+
900: "#7f1d1d"
|
|
868
|
+
},
|
|
869
|
+
warmgray: {
|
|
870
|
+
50: "#fafaf9",
|
|
871
|
+
100: "#f5f5f4",
|
|
872
|
+
200: "#e7e5e4",
|
|
873
|
+
300: "#d6d3d1",
|
|
874
|
+
400: "#a8a29e",
|
|
875
|
+
500: "#78716c",
|
|
876
|
+
600: "#57534e",
|
|
877
|
+
700: "#44403c",
|
|
878
|
+
800: "#292524",
|
|
879
|
+
900: "#1c1917"
|
|
880
|
+
},
|
|
881
|
+
truegray: {
|
|
882
|
+
50: "#fafafa",
|
|
883
|
+
100: "#f5f5f5",
|
|
884
|
+
200: "#e5e5e5",
|
|
885
|
+
300: "#d4d4d4",
|
|
886
|
+
400: "#a3a3a3",
|
|
887
|
+
500: "#737373",
|
|
888
|
+
600: "#525252",
|
|
889
|
+
700: "#404040",
|
|
890
|
+
800: "#262626",
|
|
891
|
+
900: "#171717"
|
|
892
|
+
},
|
|
893
|
+
gray: {
|
|
894
|
+
50: "#fafafa",
|
|
895
|
+
100: "#f4f4f5",
|
|
896
|
+
200: "#e4e4e7",
|
|
897
|
+
300: "#d4d4d8",
|
|
898
|
+
400: "#a1a1aa",
|
|
899
|
+
500: "#71717a",
|
|
900
|
+
600: "#52525b",
|
|
901
|
+
700: "#3f3f46",
|
|
902
|
+
800: "#27272a",
|
|
903
|
+
900: "#18181b"
|
|
904
|
+
},
|
|
905
|
+
coolgray: {
|
|
906
|
+
50: "#f9fafb",
|
|
907
|
+
100: "#f3f4f6",
|
|
908
|
+
200: "#e5e7eb",
|
|
909
|
+
300: "#d1d5db",
|
|
910
|
+
400: "#9ca3af",
|
|
911
|
+
500: "#6b7280",
|
|
912
|
+
600: "#4b5563",
|
|
913
|
+
700: "#374151",
|
|
914
|
+
800: "#1f2937",
|
|
915
|
+
900: "#111827"
|
|
916
|
+
},
|
|
917
|
+
bluegray: {
|
|
918
|
+
50: "#f8fafc",
|
|
919
|
+
100: "#f1f5f9",
|
|
920
|
+
200: "#e2e8f0",
|
|
921
|
+
300: "#cbd5e1",
|
|
922
|
+
400: "#94a3b8",
|
|
923
|
+
500: "#64748b",
|
|
924
|
+
600: "#475569",
|
|
925
|
+
700: "#334155",
|
|
926
|
+
800: "#1e293b",
|
|
927
|
+
900: "#0f172a"
|
|
928
|
+
},
|
|
929
|
+
light: {
|
|
930
|
+
50: "#fdfdfd",
|
|
931
|
+
100: "#fcfcfc",
|
|
932
|
+
200: "#fafafa",
|
|
933
|
+
300: "#f8f9fa",
|
|
934
|
+
400: "#f6f6f6",
|
|
935
|
+
500: "#f2f2f2",
|
|
936
|
+
600: "#f1f3f5",
|
|
937
|
+
700: "#e9ecef",
|
|
938
|
+
800: "#dee2e6",
|
|
939
|
+
900: "#dde1e3"
|
|
940
|
+
},
|
|
941
|
+
dark: {
|
|
942
|
+
50: "#4a4a4a",
|
|
943
|
+
100: "#3c3c3c",
|
|
944
|
+
200: "#323232",
|
|
945
|
+
300: "#2d2d2d",
|
|
946
|
+
400: "#222222",
|
|
947
|
+
500: "#1f1f1f",
|
|
948
|
+
600: "#1c1c1e",
|
|
949
|
+
700: "#1b1b1b",
|
|
950
|
+
800: "#181818",
|
|
951
|
+
900: "#0f0f0f"
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
Object.values(colors).forEach((color) => {
|
|
955
|
+
if (typeof color !== "string") {
|
|
956
|
+
color.DEFAULT = color.DEFAULT || color[400];
|
|
957
|
+
Object.keys(color).forEach((key) => {
|
|
958
|
+
const short = +key / 100;
|
|
959
|
+
if (short === Math.round(short))
|
|
960
|
+
color[short] = color[key];
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
// ../preset-uno/src/theme/font.ts
|
|
966
|
+
var fontFamily = {
|
|
967
|
+
sans: [
|
|
968
|
+
"ui-sans-serif",
|
|
969
|
+
"system-ui",
|
|
970
|
+
"-apple-system",
|
|
971
|
+
"BlinkMacSystemFont",
|
|
972
|
+
'"Segoe UI"',
|
|
973
|
+
"Roboto",
|
|
974
|
+
'"Helvetica Neue"',
|
|
975
|
+
"Arial",
|
|
976
|
+
'"Noto Sans"',
|
|
977
|
+
"sans-serif",
|
|
978
|
+
'"Apple Color Emoji"',
|
|
979
|
+
'"Segoe UI Emoji"',
|
|
980
|
+
'"Segoe UI Symbol"',
|
|
981
|
+
'"Noto Color Emoji"'
|
|
982
|
+
].join(","),
|
|
983
|
+
serif: [
|
|
984
|
+
"ui-serif",
|
|
985
|
+
"Georgia",
|
|
986
|
+
"Cambria",
|
|
987
|
+
'"Times New Roman"',
|
|
988
|
+
"Times",
|
|
989
|
+
"serif"
|
|
990
|
+
].join(","),
|
|
991
|
+
mono: [
|
|
992
|
+
"ui-monospace",
|
|
993
|
+
"SFMono-Regular",
|
|
994
|
+
"Menlo",
|
|
995
|
+
"Monaco",
|
|
996
|
+
"Consolas",
|
|
997
|
+
'"Liberation Mono"',
|
|
998
|
+
'"Courier New"',
|
|
999
|
+
"monospace"
|
|
1000
|
+
].join(",")
|
|
1001
|
+
};
|
|
1002
|
+
var fontSize = {
|
|
1003
|
+
"xs": ["0.75rem", "1rem"],
|
|
1004
|
+
"sm": ["0.875rem", "1.25rem"],
|
|
1005
|
+
"base": ["1rem", "1.5rem"],
|
|
1006
|
+
"lg": ["1.125rem", "1.75rem"],
|
|
1007
|
+
"xl": ["1.25rem", "1.75rem"],
|
|
1008
|
+
"2xl": ["1.5rem", "2rem"],
|
|
1009
|
+
"3xl": ["1.875rem", "2.25rem"],
|
|
1010
|
+
"4xl": ["2.25rem", "2.5rem"],
|
|
1011
|
+
"5xl": ["3rem", "1"],
|
|
1012
|
+
"6xl": ["3.75rem", "1"],
|
|
1013
|
+
"7xl": ["4.5rem", "1"],
|
|
1014
|
+
"8xl": ["6rem", "1"],
|
|
1015
|
+
"9xl": ["8rem", "1"]
|
|
1016
|
+
};
|
|
1017
|
+
var lineHeight = {
|
|
1018
|
+
none: "1",
|
|
1019
|
+
tight: "1.25",
|
|
1020
|
+
snug: "1.375",
|
|
1021
|
+
normal: "1.5",
|
|
1022
|
+
relaxed: "1.625",
|
|
1023
|
+
loose: "2"
|
|
1024
|
+
};
|
|
1025
|
+
var letterSpacing = {
|
|
1026
|
+
tighter: "-0.05em",
|
|
1027
|
+
tight: "-0.025em",
|
|
1028
|
+
normal: "0em",
|
|
1029
|
+
wide: "0.025em",
|
|
1030
|
+
wider: "0.05em",
|
|
1031
|
+
widest: "0.1em"
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// ../preset-uno/src/theme/index.ts
|
|
1035
|
+
var breakpoints = {
|
|
1036
|
+
"sm": "640px",
|
|
1037
|
+
"md": "768px",
|
|
1038
|
+
"lg": "1024px",
|
|
1039
|
+
"xl": "1280px",
|
|
1040
|
+
"2xl": "1536px"
|
|
1041
|
+
};
|
|
1042
|
+
var borderRadius2 = {
|
|
1043
|
+
"DEFAULT": "0.25rem",
|
|
1044
|
+
"none": "0px",
|
|
1045
|
+
"sm": "0.125rem",
|
|
1046
|
+
"md": "0.375rem",
|
|
1047
|
+
"lg": "0.5rem",
|
|
1048
|
+
"xl": "0.75rem",
|
|
1049
|
+
"2xl": "1rem",
|
|
1050
|
+
"3xl": "1.5rem",
|
|
1051
|
+
"full": "9999px"
|
|
1052
|
+
};
|
|
1053
|
+
var theme = {
|
|
1054
|
+
colors,
|
|
1055
|
+
fontFamily,
|
|
1056
|
+
fontSize,
|
|
1057
|
+
breakpoints,
|
|
1058
|
+
borderRadius: borderRadius2,
|
|
1059
|
+
lineHeight,
|
|
1060
|
+
letterSpacing
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
// ../preset-uno/src/variants/breakpoints.ts
|
|
1064
|
+
var regexCache = {};
|
|
1065
|
+
var variantBreakpoints = {
|
|
1066
|
+
match(input, theme2) {
|
|
1067
|
+
for (const point of Object.keys(theme2.breakpoints || {})) {
|
|
1068
|
+
if (!regexCache[point])
|
|
1069
|
+
regexCache[point] = new RegExp(`^((?:lt-)?${point}[:-])`);
|
|
1070
|
+
const match = input.match(regexCache[point]);
|
|
1071
|
+
if (match)
|
|
1072
|
+
return input.slice(match[1].length);
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
mediaQuery(input, theme2) {
|
|
1076
|
+
var _a;
|
|
1077
|
+
const [, d, s] = input.match(/^(lt-)?(\w+)[:-]/) || [];
|
|
1078
|
+
if (!s)
|
|
1079
|
+
return;
|
|
1080
|
+
let direction = "min";
|
|
1081
|
+
if (d === "lt-")
|
|
1082
|
+
direction = "max";
|
|
1083
|
+
const point = (_a = theme2.breakpoints) == null ? void 0 : _a[s];
|
|
1084
|
+
if (point)
|
|
1085
|
+
return `@media (${direction}-width: ${point})`;
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
// ../core/src/utils/basic.ts
|
|
1090
|
+
function toArray2(value = []) {
|
|
1091
|
+
return Array.isArray(value) ? value : [value];
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// ../core/src/utils/variant.ts
|
|
1095
|
+
var variantMatcher = (name) => {
|
|
1096
|
+
const length = name.length + 1;
|
|
1097
|
+
const re = new RegExp(`^${name}[:-]`);
|
|
1098
|
+
return (input) => input.match(re) ? input.slice(length) : void 0;
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
// ../preset-uno/src/variants/children.ts
|
|
1102
|
+
var variantChildren = [
|
|
1103
|
+
{
|
|
1104
|
+
match: variantMatcher("children"),
|
|
1105
|
+
selector: (input) => `${input} > *`
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
match: variantMatcher("all"),
|
|
1109
|
+
selector: (input) => `${input} *`
|
|
1110
|
+
}
|
|
1111
|
+
];
|
|
1112
|
+
|
|
1113
|
+
// ../preset-uno/src/variants/dark.ts
|
|
1114
|
+
var variantColorsClass = [
|
|
1115
|
+
{
|
|
1116
|
+
match: variantMatcher("dark"),
|
|
1117
|
+
selector: (input) => `.dark $$ ${input}`
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
match: variantMatcher("light"),
|
|
1121
|
+
selector: (input) => `.light $$ ${input}`
|
|
1122
|
+
}
|
|
1123
|
+
];
|
|
1124
|
+
var variantColorsMedia = [
|
|
1125
|
+
{
|
|
1126
|
+
match: variantMatcher("dark"),
|
|
1127
|
+
mediaQuery: () => "@media (prefers-color-scheme: dark)"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
match: variantMatcher("light"),
|
|
1131
|
+
mediaQuery: () => "@media (prefers-color-scheme: light)"
|
|
1132
|
+
}
|
|
1133
|
+
];
|
|
1134
|
+
|
|
1135
|
+
// ../preset-uno/src/variants/pseudo.ts
|
|
1136
|
+
function createPseudoClassVariant(name, pseudo = name) {
|
|
1137
|
+
return [
|
|
1138
|
+
{
|
|
1139
|
+
match: variantMatcher(name),
|
|
1140
|
+
selector: (input) => `${input}:${pseudo}`
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
match: variantMatcher(`not-${name}`),
|
|
1144
|
+
selector: (input) => `${input}:not(:${pseudo})`
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
match: variantMatcher(`group-${name}`),
|
|
1148
|
+
selector: (input) => `.group:${pseudo} ${input}`
|
|
1149
|
+
}
|
|
1150
|
+
];
|
|
1151
|
+
}
|
|
1152
|
+
function createPseudoElementVariant(name) {
|
|
1153
|
+
return {
|
|
1154
|
+
match: variantMatcher(name),
|
|
1155
|
+
selector: (input) => `${input}::${name}`
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
var variantPseudoClasses = [
|
|
1159
|
+
"active",
|
|
1160
|
+
"checked",
|
|
1161
|
+
"default",
|
|
1162
|
+
"empty",
|
|
1163
|
+
"enabled",
|
|
1164
|
+
"first-of-type",
|
|
1165
|
+
"first",
|
|
1166
|
+
"focus-visible",
|
|
1167
|
+
"focus-within",
|
|
1168
|
+
"focus",
|
|
1169
|
+
"hover",
|
|
1170
|
+
"indeterminate",
|
|
1171
|
+
"invalid",
|
|
1172
|
+
"last-of-type",
|
|
1173
|
+
"last",
|
|
1174
|
+
"link",
|
|
1175
|
+
"only-child",
|
|
1176
|
+
"only-of-type",
|
|
1177
|
+
"optional",
|
|
1178
|
+
"placeholder-shown",
|
|
1179
|
+
"read-only",
|
|
1180
|
+
"read-write",
|
|
1181
|
+
"required",
|
|
1182
|
+
"root",
|
|
1183
|
+
"target",
|
|
1184
|
+
"valid",
|
|
1185
|
+
"visited",
|
|
1186
|
+
["even-of-type", "nth-of-type(even)"],
|
|
1187
|
+
["even", "nth-child(even)"],
|
|
1188
|
+
["odd-of-type", "nth-of-type(odd)"],
|
|
1189
|
+
["odd", "nth-child(odd)"]
|
|
1190
|
+
].flatMap((i) => createPseudoClassVariant(...toArray2(i)));
|
|
1191
|
+
var variantPseudoElements = [
|
|
1192
|
+
"before",
|
|
1193
|
+
"after",
|
|
1194
|
+
"first-letter",
|
|
1195
|
+
"first-line",
|
|
1196
|
+
"selection"
|
|
1197
|
+
].map(createPseudoElementVariant);
|
|
1198
|
+
|
|
1199
|
+
// ../preset-uno/src/variants/index.ts
|
|
1200
|
+
var variantImportant = {
|
|
1201
|
+
match: (input) => input.startsWith("!") ? input.slice(1) : void 0,
|
|
1202
|
+
rewrite: (input) => {
|
|
1203
|
+
input.forEach((v) => {
|
|
1204
|
+
if (v[1])
|
|
1205
|
+
v[1] += " !important";
|
|
1206
|
+
});
|
|
1207
|
+
return input;
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
var variantNegative = {
|
|
1211
|
+
match: (input) => input.startsWith("-") ? input.slice(1) : void 0,
|
|
1212
|
+
rewrite: (input) => {
|
|
1213
|
+
input.forEach((v) => {
|
|
1214
|
+
var _a;
|
|
1215
|
+
if ((_a = v[1]) == null ? void 0 : _a.toString().match(/^\d/))
|
|
1216
|
+
v[1] = `-${v[1]}`;
|
|
1217
|
+
});
|
|
1218
|
+
return input;
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
var variants = [
|
|
1222
|
+
variantNegative,
|
|
1223
|
+
variantImportant,
|
|
1224
|
+
variantBreakpoints,
|
|
1225
|
+
...variantChildren,
|
|
1226
|
+
...variantColorsClass,
|
|
1227
|
+
...variantPseudoClasses,
|
|
1228
|
+
...variantPseudoElements
|
|
1229
|
+
];
|
|
1230
|
+
|
|
1231
|
+
// ../preset-uno/src/index.ts
|
|
1232
|
+
var preset = () => ({
|
|
1233
|
+
theme,
|
|
1234
|
+
rules,
|
|
1235
|
+
variants
|
|
1236
|
+
});
|
|
1237
|
+
var src_default = preset;
|
|
1238
|
+
|
|
1239
|
+
// ../preset-attributify/src/index.ts
|
|
1240
|
+
import { extractorSplit } from "@unocss/core";
|
|
1241
|
+
|
|
1242
|
+
// ../preset-attributify/src/extractor.ts
|
|
1243
|
+
import { isValidSelector } from "@unocss/core";
|
|
1244
|
+
var strippedPrefixes = [
|
|
1245
|
+
"v-bind:",
|
|
1246
|
+
":"
|
|
1247
|
+
];
|
|
1248
|
+
var splitterRE = /[\s'"`;]/g;
|
|
1249
|
+
var valuedAttributeRE = /([\w:-]+)(?:=(["'])([^\2]+?)\2)?/g;
|
|
1250
|
+
var extractorAttributify = (options) => (code) => {
|
|
1251
|
+
const result = Array.from(code.matchAll(valuedAttributeRE)).flatMap(([, name, _, content]) => {
|
|
1252
|
+
for (const prefix of strippedPrefixes) {
|
|
1253
|
+
if (name.startsWith(prefix)) {
|
|
1254
|
+
name = name.slice(prefix.length);
|
|
1255
|
+
break;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
if (!content) {
|
|
1259
|
+
if (isValidSelector(name) && (options == null ? void 0 : options.nonValuedAttribute) !== false)
|
|
1260
|
+
return [`[${name}=""]`];
|
|
1261
|
+
return [];
|
|
1262
|
+
}
|
|
1263
|
+
if (["class", "className"].includes(name)) {
|
|
1264
|
+
return content.split(splitterRE).filter(isValidSelector);
|
|
1265
|
+
} else {
|
|
1266
|
+
return content.split(splitterRE).filter(Boolean).map((v) => `[${name}~="${v}"]`);
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1269
|
+
return new Set(result);
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
// ../preset-attributify/src/variant.ts
|
|
1273
|
+
import { isAttributifySelector } from "@unocss/core";
|
|
1274
|
+
var variantsRE = /^(.+\:\!?)?(.*?)$/;
|
|
1275
|
+
var variantAttributify = (options = {}) => {
|
|
1276
|
+
var _a;
|
|
1277
|
+
const prefix = (_a = options.prefix) != null ? _a : "un-";
|
|
1278
|
+
return {
|
|
1279
|
+
match(input) {
|
|
1280
|
+
const match = isAttributifySelector(input);
|
|
1281
|
+
if (!match)
|
|
1282
|
+
return;
|
|
1283
|
+
let name = match[1];
|
|
1284
|
+
if (name.startsWith(prefix))
|
|
1285
|
+
name = name.slice(prefix.length);
|
|
1286
|
+
else if (options.prefixedOnly)
|
|
1287
|
+
return;
|
|
1288
|
+
const content = match[2];
|
|
1289
|
+
const [, variants2 = "", body = content] = content.match(variantsRE) || [];
|
|
1290
|
+
if (body === "~" || !body)
|
|
1291
|
+
return `${variants2}${name}`;
|
|
1292
|
+
else
|
|
1293
|
+
return `${variants2}${name}-${body}`;
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
// ../preset-attributify/src/index.ts
|
|
1299
|
+
var preset2 = (options) => {
|
|
1300
|
+
const variants2 = [
|
|
1301
|
+
variantAttributify(options)
|
|
1302
|
+
];
|
|
1303
|
+
const extractors = [
|
|
1304
|
+
extractorAttributify(options)
|
|
1305
|
+
];
|
|
1306
|
+
if (!(options == null ? void 0 : options.strict))
|
|
1307
|
+
extractors.unshift(extractorSplit);
|
|
1308
|
+
return {
|
|
1309
|
+
variants: variants2,
|
|
1310
|
+
extractors
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1313
|
+
var src_default2 = preset2;
|
|
1314
|
+
|
|
1315
|
+
// src/index.ts
|
|
1316
|
+
import { loadConfig as loadConfig2 } from "@unocss/config";
|
|
1317
|
+
|
|
1318
|
+
// src/context.ts
|
|
1319
|
+
function createContext(uno, config, configFilepath) {
|
|
1320
|
+
const invalidations = [];
|
|
1321
|
+
const modules = new src_exports.BetterMap();
|
|
1322
|
+
const tokens = new Set();
|
|
1323
|
+
function invalidate() {
|
|
1324
|
+
invalidations.forEach((cb) => cb());
|
|
1325
|
+
}
|
|
1326
|
+
async function scan(code, id) {
|
|
1327
|
+
if (id)
|
|
1328
|
+
modules.set(id, code);
|
|
1329
|
+
await uno.applyExtractors(code, id, tokens);
|
|
1330
|
+
invalidate();
|
|
1331
|
+
}
|
|
1332
|
+
return {
|
|
1333
|
+
tokens,
|
|
1334
|
+
modules,
|
|
1335
|
+
invalidate,
|
|
1336
|
+
onInvalidate(fn) {
|
|
1337
|
+
invalidations.push(fn);
|
|
1338
|
+
},
|
|
1339
|
+
uno,
|
|
1340
|
+
scan,
|
|
1341
|
+
config,
|
|
1342
|
+
configFilepath
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// src/chunk-build.ts
|
|
1347
|
+
import { createFilter } from "@rollup/pluginutils";
|
|
1348
|
+
|
|
1349
|
+
// src/utils.ts
|
|
1350
|
+
import { createHash } from "crypto";
|
|
1351
|
+
var defaultExclude = [/[\/\\]node_modules[\/\\]/, /[\/\\]dist[\/\\]/, /\.(css|postcss|sass|scss|less|stylus|styl)$/];
|
|
1352
|
+
var defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/];
|
|
1353
|
+
function getHash(input, length = 8) {
|
|
1354
|
+
return createHash("sha256").update(input).digest("hex").substr(0, length);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
// src/chunk-build.ts
|
|
1358
|
+
function ChunkModeBuildPlugin({ uno, config }) {
|
|
1359
|
+
let cssPlugin;
|
|
1360
|
+
const filter = createFilter(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
1361
|
+
const files = {};
|
|
1362
|
+
return {
|
|
1363
|
+
name: "unocss:chunk",
|
|
1364
|
+
apply: "build",
|
|
1365
|
+
enforce: "pre",
|
|
1366
|
+
configResolved(config2) {
|
|
1367
|
+
cssPlugin = config2.plugins.find((i) => i.name === "vite:css-post");
|
|
1368
|
+
},
|
|
1369
|
+
transform(code, id) {
|
|
1370
|
+
if (!filter(id))
|
|
1371
|
+
return;
|
|
1372
|
+
files[id] = code;
|
|
1373
|
+
return null;
|
|
1374
|
+
},
|
|
1375
|
+
async renderChunk(_, chunk) {
|
|
1376
|
+
const chunks = Object.keys(chunk.modules).map((i) => files[i]).filter(Boolean);
|
|
1377
|
+
if (!chunks.length)
|
|
1378
|
+
return null;
|
|
1379
|
+
const tokens = new Set();
|
|
1380
|
+
await Promise.all(chunks.map((c) => uno.applyExtractors(c, void 0, tokens)));
|
|
1381
|
+
const { css } = await uno.generate(tokens);
|
|
1382
|
+
const fakeCssId = `${chunk.fileName}.css`;
|
|
1383
|
+
await cssPlugin.transform(css, fakeCssId);
|
|
1384
|
+
chunk.modules[fakeCssId] = {
|
|
1385
|
+
code: null,
|
|
1386
|
+
originalLength: 0,
|
|
1387
|
+
removedExports: [],
|
|
1388
|
+
renderedExports: [],
|
|
1389
|
+
renderedLength: 0
|
|
1390
|
+
};
|
|
1391
|
+
return null;
|
|
1392
|
+
},
|
|
1393
|
+
async transformIndexHtml(code) {
|
|
1394
|
+
const { css } = await uno.generate(code);
|
|
1395
|
+
if (css)
|
|
1396
|
+
return `${code}<style>${css}</style>`;
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// src/global-dev.ts
|
|
1402
|
+
import { createFilter as createFilter2 } from "@rollup/pluginutils";
|
|
1403
|
+
var VIRTUAL_ENTRY = "/@unocss-entry";
|
|
1404
|
+
var READY_CALLBACK = "/__unocss_ready";
|
|
1405
|
+
function GlobalModeDevPlugin({ config, uno, tokens, onInvalidate, scan }) {
|
|
1406
|
+
let server;
|
|
1407
|
+
const filter = createFilter2(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
1408
|
+
const tasks = [];
|
|
1409
|
+
let timer;
|
|
1410
|
+
let lastUpdate = +new Date();
|
|
1411
|
+
function invalidate() {
|
|
1412
|
+
if (!server)
|
|
1413
|
+
return;
|
|
1414
|
+
const mod = server.moduleGraph.getModuleById(VIRTUAL_ENTRY);
|
|
1415
|
+
if (!mod)
|
|
1416
|
+
return;
|
|
1417
|
+
lastUpdate = +new Date();
|
|
1418
|
+
server.moduleGraph.invalidateModule(mod);
|
|
1419
|
+
clearTimeout(timer);
|
|
1420
|
+
timer = setTimeout(sendUpdate, 10);
|
|
1421
|
+
}
|
|
1422
|
+
function sendUpdate() {
|
|
1423
|
+
server.ws.send({
|
|
1424
|
+
type: "update",
|
|
1425
|
+
updates: [{
|
|
1426
|
+
acceptedPath: VIRTUAL_ENTRY,
|
|
1427
|
+
path: VIRTUAL_ENTRY,
|
|
1428
|
+
timestamp: lastUpdate,
|
|
1429
|
+
type: "js-update"
|
|
1430
|
+
}]
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
onInvalidate(invalidate);
|
|
1434
|
+
return {
|
|
1435
|
+
name: "unocss:global",
|
|
1436
|
+
apply: "serve",
|
|
1437
|
+
enforce: "pre",
|
|
1438
|
+
configureServer(_server) {
|
|
1439
|
+
server = _server;
|
|
1440
|
+
server.middlewares.use(async (req, res, next) => {
|
|
1441
|
+
if (req.url === READY_CALLBACK) {
|
|
1442
|
+
let body = "";
|
|
1443
|
+
await new Promise((resolve) => {
|
|
1444
|
+
req.on("data", (chunk) => {
|
|
1445
|
+
body += chunk;
|
|
1446
|
+
});
|
|
1447
|
+
req.on("end", resolve);
|
|
1448
|
+
});
|
|
1449
|
+
if (+body !== lastUpdate)
|
|
1450
|
+
sendUpdate();
|
|
1451
|
+
res.statusCode = 200;
|
|
1452
|
+
res.end();
|
|
1453
|
+
} else {
|
|
1454
|
+
return next();
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
},
|
|
1458
|
+
transform(code, id) {
|
|
1459
|
+
if (!filter(id))
|
|
1460
|
+
return;
|
|
1461
|
+
scan(code, id);
|
|
1462
|
+
return null;
|
|
1463
|
+
},
|
|
1464
|
+
resolveId(id) {
|
|
1465
|
+
return id === VIRTUAL_ENTRY ? id : null;
|
|
1466
|
+
},
|
|
1467
|
+
async load(id) {
|
|
1468
|
+
if (id !== VIRTUAL_ENTRY)
|
|
1469
|
+
return null;
|
|
1470
|
+
await Promise.all(tasks);
|
|
1471
|
+
const { css } = await uno.generate(tokens);
|
|
1472
|
+
return `
|
|
1473
|
+
import { updateStyle, removeStyle } from "/@vite/client";
|
|
1474
|
+
const id = "${VIRTUAL_ENTRY}"
|
|
1475
|
+
import.meta.hot.accept()
|
|
1476
|
+
import.meta.hot.prune(() => removeStyle(id))
|
|
1477
|
+
const css = ${JSON.stringify(`/* unocss */
|
|
1478
|
+
${css}`)}
|
|
1479
|
+
updateStyle(id, css)
|
|
1480
|
+
export default css
|
|
1481
|
+
fetch('${READY_CALLBACK}', { method: 'POST', body: '${lastUpdate}' })
|
|
1482
|
+
`;
|
|
1483
|
+
},
|
|
1484
|
+
transformIndexHtml: {
|
|
1485
|
+
enforce: "pre",
|
|
1486
|
+
async transform(code, { path }) {
|
|
1487
|
+
tasks.push(scan(code, path));
|
|
1488
|
+
return `${code}<script src="${VIRTUAL_ENTRY}" type="module"><\/script>`;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// src/per-module.ts
|
|
1495
|
+
import { createFilter as createFilter3 } from "@rollup/pluginutils";
|
|
1496
|
+
var VIRTUAL_PREFIX = "/@unocss/";
|
|
1497
|
+
var SCOPE_IMPORT_RE = / from (['"])(@unocss\/scope)\1/;
|
|
1498
|
+
function PerModuleModePlugin({ uno, config }) {
|
|
1499
|
+
const moduleMap = new Map();
|
|
1500
|
+
let server;
|
|
1501
|
+
const filter = createFilter3(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
1502
|
+
const invalidate = (hash) => {
|
|
1503
|
+
if (!server)
|
|
1504
|
+
return;
|
|
1505
|
+
const id = `${VIRTUAL_PREFIX}${hash}.css`;
|
|
1506
|
+
const mod = server.moduleGraph.getModuleById(id);
|
|
1507
|
+
if (!mod)
|
|
1508
|
+
return;
|
|
1509
|
+
server.moduleGraph.invalidateModule(mod);
|
|
1510
|
+
server.ws.send({
|
|
1511
|
+
type: "update",
|
|
1512
|
+
updates: [{
|
|
1513
|
+
acceptedPath: id,
|
|
1514
|
+
path: id,
|
|
1515
|
+
timestamp: +Date.now(),
|
|
1516
|
+
type: "js-update"
|
|
1517
|
+
}]
|
|
1518
|
+
});
|
|
1519
|
+
};
|
|
1520
|
+
return {
|
|
1521
|
+
name: "unocss:module-scope",
|
|
1522
|
+
enforce: "post",
|
|
1523
|
+
configureServer(_server) {
|
|
1524
|
+
server = _server;
|
|
1525
|
+
},
|
|
1526
|
+
async transform(code, id) {
|
|
1527
|
+
if (!filter(id))
|
|
1528
|
+
return;
|
|
1529
|
+
const hash = getHash(id);
|
|
1530
|
+
const hasScope = code.match(SCOPE_IMPORT_RE);
|
|
1531
|
+
const { css } = await uno.generate(code, id, hasScope ? `.${hash}` : void 0);
|
|
1532
|
+
if (!css && !hasScope)
|
|
1533
|
+
return null;
|
|
1534
|
+
if (hasScope)
|
|
1535
|
+
code = code.replace(SCOPE_IMPORT_RE, ` from 'data:text/javascript;base64,${Buffer.from(`export default () => "${hash}"`).toString("base64")}'`);
|
|
1536
|
+
moduleMap.set(hash, [id, css]);
|
|
1537
|
+
invalidate(hash);
|
|
1538
|
+
return {
|
|
1539
|
+
code: `import "${VIRTUAL_PREFIX}${hash}.css";${code}`,
|
|
1540
|
+
map: null
|
|
1541
|
+
};
|
|
1542
|
+
},
|
|
1543
|
+
resolveId(id) {
|
|
1544
|
+
return id.startsWith(VIRTUAL_PREFIX) ? id : null;
|
|
1545
|
+
},
|
|
1546
|
+
load(id) {
|
|
1547
|
+
if (!id.startsWith(VIRTUAL_PREFIX))
|
|
1548
|
+
return null;
|
|
1549
|
+
const hash = id.slice(VIRTUAL_PREFIX.length, -".css".length);
|
|
1550
|
+
const [source, css] = moduleMap.get(hash) || [];
|
|
1551
|
+
if (source)
|
|
1552
|
+
this.addWatchFile(source);
|
|
1553
|
+
return `
|
|
1554
|
+
/* unocss ${source} */
|
|
1555
|
+
${css}`;
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
// src/vue-scoped.ts
|
|
1561
|
+
import { createFilter as createFilter4 } from "@rollup/pluginutils";
|
|
1562
|
+
function VueScopedPlugin({ uno, config }) {
|
|
1563
|
+
const filter = createFilter4(config.include || [/\.vue$/], config.exclude || defaultExclude);
|
|
1564
|
+
async function transformSFC(code) {
|
|
1565
|
+
const { css } = await uno.generate(code);
|
|
1566
|
+
if (!css)
|
|
1567
|
+
return null;
|
|
1568
|
+
return `${code}
|
|
1569
|
+
<style scoped>${css}</style>`;
|
|
1570
|
+
}
|
|
1571
|
+
return {
|
|
1572
|
+
name: "unocss:vue-scoped",
|
|
1573
|
+
enforce: "pre",
|
|
1574
|
+
transform(code, id) {
|
|
1575
|
+
if (!filter(id))
|
|
1576
|
+
return;
|
|
1577
|
+
return transformSFC(code);
|
|
1578
|
+
},
|
|
1579
|
+
handleHotUpdate(ctx) {
|
|
1580
|
+
const read = ctx.read;
|
|
1581
|
+
if (filter(ctx.file)) {
|
|
1582
|
+
ctx.read = async () => {
|
|
1583
|
+
const code = await read();
|
|
1584
|
+
return await transformSFC(code) || code;
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
// src/global-build.ts
|
|
1592
|
+
import { createFilter as createFilter5 } from "@rollup/pluginutils";
|
|
1593
|
+
var VIRTUAL_ENTRY2 = "/@unocss/entry.css";
|
|
1594
|
+
var PLACEHOLDER = "#--unocss--{--unocss:true}";
|
|
1595
|
+
var PLACEHOLDER_RE = /#--unocss--\s*{\s*--unocss:\s*true;?\s*}/;
|
|
1596
|
+
function GlobalModeBuildPlugin({ uno, config, scan, tokens }) {
|
|
1597
|
+
const filter = createFilter5(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
1598
|
+
const tasks = [];
|
|
1599
|
+
return [
|
|
1600
|
+
{
|
|
1601
|
+
name: "unocss:global:build:scan",
|
|
1602
|
+
apply: "build",
|
|
1603
|
+
enforce: "pre",
|
|
1604
|
+
transform(code, id) {
|
|
1605
|
+
if (!filter(id))
|
|
1606
|
+
return;
|
|
1607
|
+
tasks.push(scan(code, id));
|
|
1608
|
+
return null;
|
|
1609
|
+
},
|
|
1610
|
+
resolveId(id) {
|
|
1611
|
+
return id === VIRTUAL_ENTRY2 ? id : null;
|
|
1612
|
+
},
|
|
1613
|
+
async load(id) {
|
|
1614
|
+
if (id !== VIRTUAL_ENTRY2)
|
|
1615
|
+
return null;
|
|
1616
|
+
return PLACEHOLDER;
|
|
1617
|
+
},
|
|
1618
|
+
transformIndexHtml: {
|
|
1619
|
+
enforce: "pre",
|
|
1620
|
+
transform(code, { path }) {
|
|
1621
|
+
tasks.push(scan(code, path));
|
|
1622
|
+
return `${code}<script src="${VIRTUAL_ENTRY2}" type="module"><\/script>`;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
},
|
|
1626
|
+
{
|
|
1627
|
+
name: "unocss:global:build:generate",
|
|
1628
|
+
apply(options, { command }) {
|
|
1629
|
+
var _a;
|
|
1630
|
+
return command === "build" && !((_a = options.build) == null ? void 0 : _a.ssr);
|
|
1631
|
+
},
|
|
1632
|
+
enforce: "post",
|
|
1633
|
+
async generateBundle(options, bundle) {
|
|
1634
|
+
const keys = Object.keys(bundle).filter((i) => i.endsWith(".css"));
|
|
1635
|
+
await Promise.all(tasks);
|
|
1636
|
+
const { css } = await uno.generate(tokens);
|
|
1637
|
+
let replaced = false;
|
|
1638
|
+
if (!css)
|
|
1639
|
+
return;
|
|
1640
|
+
for (const key of keys) {
|
|
1641
|
+
const chunk = bundle[key];
|
|
1642
|
+
if (chunk.type === "asset" && typeof chunk.source === "string") {
|
|
1643
|
+
if (PLACEHOLDER_RE.test(chunk.source)) {
|
|
1644
|
+
chunk.source = chunk.source.replace(PLACEHOLDER_RE, css);
|
|
1645
|
+
replaced = true;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
if (!replaced)
|
|
1650
|
+
this.error(new Error("[unocss] does not found CSS placeholder in the generated chunks,\nthis is likely an internal bug of unocss vite plugin"));
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
];
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// src/config-hmr.ts
|
|
1657
|
+
import { loadConfig } from "@unocss/config";
|
|
1658
|
+
function ConfigHMRPlugin({ uno, configFilepath: filepath, invalidate, tokens, modules }) {
|
|
1659
|
+
if (!filepath)
|
|
1660
|
+
return;
|
|
1661
|
+
return {
|
|
1662
|
+
name: "unocss:config",
|
|
1663
|
+
configureServer(server) {
|
|
1664
|
+
server.watcher.add(filepath);
|
|
1665
|
+
server.watcher.on("change", async (p) => {
|
|
1666
|
+
if (p !== filepath)
|
|
1667
|
+
return;
|
|
1668
|
+
uno.setConfig(loadConfig(filepath).config);
|
|
1669
|
+
tokens.clear();
|
|
1670
|
+
await Promise.all(modules.map((code, id) => uno.applyExtractors(code, id, tokens)));
|
|
1671
|
+
invalidate();
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// src/index.ts
|
|
1678
|
+
function UnocssPlugin(configOrPath, defaults = {
|
|
1679
|
+
presets: [
|
|
1680
|
+
src_default()
|
|
1681
|
+
]
|
|
1682
|
+
}) {
|
|
1683
|
+
var _a;
|
|
1684
|
+
const { config = {}, filepath } = loadConfig2(configOrPath);
|
|
1685
|
+
const mode = (_a = config.mode) != null ? _a : "global";
|
|
1686
|
+
const uno = (0, src_exports.createGenerator)(config, defaults);
|
|
1687
|
+
const ctx = createContext(uno, config, filepath);
|
|
1688
|
+
const plugins = [
|
|
1689
|
+
ConfigHMRPlugin(ctx)
|
|
1690
|
+
];
|
|
1691
|
+
if (mode === "per-module") {
|
|
1692
|
+
plugins.push(PerModuleModePlugin(ctx));
|
|
1693
|
+
} else if (mode === "vue-scoped") {
|
|
1694
|
+
plugins.push(VueScopedPlugin(ctx));
|
|
1695
|
+
} else if (mode === "global") {
|
|
1696
|
+
plugins.push(...GlobalModeBuildPlugin(ctx), GlobalModeDevPlugin(ctx));
|
|
1697
|
+
} else if (mode === "dist-chunk") {
|
|
1698
|
+
plugins.push(ChunkModeBuildPlugin(ctx), GlobalModeDevPlugin(ctx));
|
|
1699
|
+
} else {
|
|
1700
|
+
throw new Error(`[unocss] unknown mode "${mode}"`);
|
|
1701
|
+
}
|
|
1702
|
+
return plugins.filter(Boolean);
|
|
1703
|
+
}
|
|
1704
|
+
export {
|
|
1705
|
+
ChunkModeBuildPlugin,
|
|
1706
|
+
GlobalModeDevPlugin,
|
|
1707
|
+
PerModuleModePlugin,
|
|
1708
|
+
VueScopedPlugin,
|
|
1709
|
+
UnocssPlugin as default
|
|
1710
|
+
};
|