@unocss/inspector 66.5.10 → 66.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{_id_-B5f0FCLw.js → _id_-CsSushaL.js} +1 -1
- package/dist/client/assets/{index-9qCnFKTO.css → index-BkmnCE1Z.css} +1 -1
- package/dist/client/assets/{index-Baiadteo.js → index-DinBrh4X.js} +138 -138
- package/dist/client/assets/{repl-DDUkikcP.js → repl-BIt4bgB9.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +1149 -857
- package/package.json +7 -9
- package/dist/index.d.ts +0 -6
package/dist/index.mjs
CHANGED
|
@@ -1,946 +1,1238 @@
|
|
|
1
|
-
import { dirname, resolve } from
|
|
2
|
-
import { fileURLToPath } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import gzipSize from
|
|
6
|
-
import sirv from
|
|
7
|
-
import {
|
|
1
|
+
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { BetterMap, CountableSet, escapeSelector, toArray } from "@unocss/core";
|
|
4
|
+
import { bold, cyan, green } from "colorette";
|
|
5
|
+
import gzipSize from "gzip-size";
|
|
6
|
+
import sirv from "sirv";
|
|
7
|
+
import { colorOpacityToString, colorToString, createValueHandler, getStringComponent, getStringComponents, parseCssColor } from "@unocss/rule-utils";
|
|
8
8
|
|
|
9
|
+
//#region rolldown:runtime
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __exportAll = (all, symbols) => {
|
|
15
|
+
let target = {};
|
|
16
|
+
for (var name in all) {
|
|
17
|
+
__defProp(target, name, {
|
|
18
|
+
get: all[name],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (symbols) {
|
|
23
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
30
|
+
key = keys[i];
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
32
|
+
__defProp(to, key, {
|
|
33
|
+
get: ((k) => from[k]).bind(null, key),
|
|
34
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return to;
|
|
40
|
+
};
|
|
41
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ../../virtual-shared/integration/src/constants.ts
|
|
9
45
|
const SKIP_START_COMMENT = "@unocss-skip-start";
|
|
10
46
|
const SKIP_END_COMMENT = "@unocss-skip-end";
|
|
11
|
-
const SKIP_COMMENT_RE = new RegExp(`(
|
|
47
|
+
const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
|
|
12
48
|
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ../../packages-presets/preset-mini/src/_utils/mappings.ts
|
|
51
|
+
const directionMap = {
|
|
52
|
+
"l": ["-left"],
|
|
53
|
+
"r": ["-right"],
|
|
54
|
+
"t": ["-top"],
|
|
55
|
+
"b": ["-bottom"],
|
|
56
|
+
"s": ["-inline-start"],
|
|
57
|
+
"e": ["-inline-end"],
|
|
58
|
+
"x": ["-left", "-right"],
|
|
59
|
+
"y": ["-top", "-bottom"],
|
|
60
|
+
"": [""],
|
|
61
|
+
"bs": ["-block-start"],
|
|
62
|
+
"be": ["-block-end"],
|
|
63
|
+
"is": ["-inline-start"],
|
|
64
|
+
"ie": ["-inline-end"],
|
|
65
|
+
"block": ["-block-start", "-block-end"],
|
|
66
|
+
"inline": ["-inline-start", "-inline-end"]
|
|
67
|
+
};
|
|
68
|
+
const insetMap = {
|
|
69
|
+
...directionMap,
|
|
70
|
+
s: ["-inset-inline-start"],
|
|
71
|
+
start: ["-inset-inline-start"],
|
|
72
|
+
e: ["-inset-inline-end"],
|
|
73
|
+
end: ["-inset-inline-end"],
|
|
74
|
+
bs: ["-inset-block-start"],
|
|
75
|
+
be: ["-inset-block-end"],
|
|
76
|
+
is: ["-inset-inline-start"],
|
|
77
|
+
ie: ["-inset-inline-end"],
|
|
78
|
+
block: ["-inset-block-start", "-inset-block-end"],
|
|
79
|
+
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
80
|
+
};
|
|
81
|
+
const cornerMap = {
|
|
82
|
+
"l": ["-top-left", "-bottom-left"],
|
|
83
|
+
"r": ["-top-right", "-bottom-right"],
|
|
84
|
+
"t": ["-top-left", "-top-right"],
|
|
85
|
+
"b": ["-bottom-left", "-bottom-right"],
|
|
86
|
+
"tl": ["-top-left"],
|
|
87
|
+
"lt": ["-top-left"],
|
|
88
|
+
"tr": ["-top-right"],
|
|
89
|
+
"rt": ["-top-right"],
|
|
90
|
+
"bl": ["-bottom-left"],
|
|
91
|
+
"lb": ["-bottom-left"],
|
|
92
|
+
"br": ["-bottom-right"],
|
|
93
|
+
"rb": ["-bottom-right"],
|
|
94
|
+
"": [""],
|
|
95
|
+
"bs": ["-start-start", "-start-end"],
|
|
96
|
+
"be": ["-end-start", "-end-end"],
|
|
97
|
+
"s": ["-end-start", "-start-start"],
|
|
98
|
+
"is": ["-end-start", "-start-start"],
|
|
99
|
+
"e": ["-start-end", "-end-end"],
|
|
100
|
+
"ie": ["-start-end", "-end-end"],
|
|
101
|
+
"ss": ["-start-start"],
|
|
102
|
+
"bs-is": ["-start-start"],
|
|
103
|
+
"is-bs": ["-start-start"],
|
|
104
|
+
"se": ["-start-end"],
|
|
105
|
+
"bs-ie": ["-start-end"],
|
|
106
|
+
"ie-bs": ["-start-end"],
|
|
107
|
+
"es": ["-end-start"],
|
|
108
|
+
"be-is": ["-end-start"],
|
|
109
|
+
"is-be": ["-end-start"],
|
|
110
|
+
"ee": ["-end-end"],
|
|
111
|
+
"be-ie": ["-end-end"],
|
|
112
|
+
"ie-be": ["-end-end"]
|
|
113
|
+
};
|
|
114
|
+
const xyzMap = {
|
|
115
|
+
"x": ["-x"],
|
|
116
|
+
"y": ["-y"],
|
|
117
|
+
"z": ["-z"],
|
|
118
|
+
"": ["-x", "-y"]
|
|
119
|
+
};
|
|
120
|
+
const xyzArray = [
|
|
121
|
+
"x",
|
|
122
|
+
"y",
|
|
123
|
+
"z"
|
|
124
|
+
];
|
|
13
125
|
const basePositionMap = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
126
|
+
"top",
|
|
127
|
+
"top center",
|
|
128
|
+
"top left",
|
|
129
|
+
"top right",
|
|
130
|
+
"bottom",
|
|
131
|
+
"bottom center",
|
|
132
|
+
"bottom left",
|
|
133
|
+
"bottom right",
|
|
134
|
+
"left",
|
|
135
|
+
"left center",
|
|
136
|
+
"left top",
|
|
137
|
+
"left bottom",
|
|
138
|
+
"right",
|
|
139
|
+
"right center",
|
|
140
|
+
"right top",
|
|
141
|
+
"right bottom",
|
|
142
|
+
"center",
|
|
143
|
+
"center top",
|
|
144
|
+
"center bottom",
|
|
145
|
+
"center left",
|
|
146
|
+
"center right",
|
|
147
|
+
"center center"
|
|
36
148
|
];
|
|
37
|
-
Object.assign(
|
|
38
|
-
{},
|
|
39
|
-
...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })),
|
|
40
|
-
...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p }))
|
|
41
|
-
);
|
|
149
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
42
150
|
const globalKeywords = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
151
|
+
"inherit",
|
|
152
|
+
"initial",
|
|
153
|
+
"revert",
|
|
154
|
+
"revert-layer",
|
|
155
|
+
"unset"
|
|
48
156
|
];
|
|
157
|
+
const cssMathFnRE = /^(calc|clamp|min|max)\s*\((.+)\)(.*)/;
|
|
158
|
+
const cssVarFnRE = /^(var)\s*\((.+)\)(.*)/;
|
|
49
159
|
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region ../../packages-presets/preset-mini/src/_utils/handlers/regex.ts
|
|
50
162
|
const numberWithUnitRE = /^(-?\d*(?:\.\d+)?)(px|pt|pc|%|r?(?:em|ex|lh|cap|ch|ic)|(?:[sld]?v|cq)(?:[whib]|min|max)|in|cm|mm|rpx)?$/i;
|
|
51
163
|
const numberRE = /^(-?\d*(?:\.\d+)?)$/;
|
|
52
164
|
const unitOnlyRE = /^(px|[sld]?v[wh])$/i;
|
|
53
165
|
const unitOnlyMap = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
166
|
+
px: 1,
|
|
167
|
+
vw: 100,
|
|
168
|
+
vh: 100,
|
|
169
|
+
svw: 100,
|
|
170
|
+
svh: 100,
|
|
171
|
+
dvw: 100,
|
|
172
|
+
dvh: 100,
|
|
173
|
+
lvh: 100,
|
|
174
|
+
lvw: 100
|
|
63
175
|
};
|
|
64
176
|
const bracketTypeRe = /^\[(color|image|length|size|position|quoted|string):/i;
|
|
177
|
+
const splitComma = /,(?![^()]*\))/g;
|
|
65
178
|
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region ../../packages-presets/preset-mini/src/_utils/handlers/handlers.ts
|
|
181
|
+
var handlers_exports = /* @__PURE__ */ __exportAll({
|
|
182
|
+
auto: () => auto,
|
|
183
|
+
bracket: () => bracket,
|
|
184
|
+
bracketOfColor: () => bracketOfColor,
|
|
185
|
+
bracketOfLength: () => bracketOfLength,
|
|
186
|
+
bracketOfPosition: () => bracketOfPosition,
|
|
187
|
+
cssvar: () => cssvar,
|
|
188
|
+
degree: () => degree,
|
|
189
|
+
fraction: () => fraction,
|
|
190
|
+
global: () => global,
|
|
191
|
+
number: () => number,
|
|
192
|
+
numberWithUnit: () => numberWithUnit,
|
|
193
|
+
percent: () => percent,
|
|
194
|
+
position: () => position,
|
|
195
|
+
properties: () => properties,
|
|
196
|
+
px: () => px,
|
|
197
|
+
rem: () => rem,
|
|
198
|
+
time: () => time
|
|
199
|
+
});
|
|
66
200
|
const cssProps = [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"mask-border",
|
|
122
|
-
"clip-path",
|
|
123
|
-
"clip",
|
|
124
|
-
"border-radius"
|
|
201
|
+
"color",
|
|
202
|
+
"border-color",
|
|
203
|
+
"background-color",
|
|
204
|
+
"outline-color",
|
|
205
|
+
"text-decoration-color",
|
|
206
|
+
"flex-grow",
|
|
207
|
+
"flex",
|
|
208
|
+
"flex-shrink",
|
|
209
|
+
"caret-color",
|
|
210
|
+
"font",
|
|
211
|
+
"gap",
|
|
212
|
+
"opacity",
|
|
213
|
+
"visibility",
|
|
214
|
+
"z-index",
|
|
215
|
+
"font-weight",
|
|
216
|
+
"zoom",
|
|
217
|
+
"text-shadow",
|
|
218
|
+
"transform",
|
|
219
|
+
"box-shadow",
|
|
220
|
+
"border",
|
|
221
|
+
"background-position",
|
|
222
|
+
"left",
|
|
223
|
+
"right",
|
|
224
|
+
"top",
|
|
225
|
+
"bottom",
|
|
226
|
+
"object-position",
|
|
227
|
+
"max-height",
|
|
228
|
+
"min-height",
|
|
229
|
+
"max-width",
|
|
230
|
+
"min-width",
|
|
231
|
+
"height",
|
|
232
|
+
"width",
|
|
233
|
+
"border-width",
|
|
234
|
+
"margin",
|
|
235
|
+
"padding",
|
|
236
|
+
"outline-width",
|
|
237
|
+
"outline-offset",
|
|
238
|
+
"font-size",
|
|
239
|
+
"line-height",
|
|
240
|
+
"text-indent",
|
|
241
|
+
"vertical-align",
|
|
242
|
+
"border-spacing",
|
|
243
|
+
"letter-spacing",
|
|
244
|
+
"word-spacing",
|
|
245
|
+
"stroke",
|
|
246
|
+
"filter",
|
|
247
|
+
"backdrop-filter",
|
|
248
|
+
"fill",
|
|
249
|
+
"mask",
|
|
250
|
+
"mask-size",
|
|
251
|
+
"mask-border",
|
|
252
|
+
"clip-path",
|
|
253
|
+
"clip",
|
|
254
|
+
"border-radius"
|
|
125
255
|
];
|
|
126
256
|
function round(n) {
|
|
127
|
-
|
|
257
|
+
return +n.toFixed(10);
|
|
128
258
|
}
|
|
129
259
|
function numberWithUnit(str) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (unit && !Number.isNaN(num))
|
|
136
|
-
return `${round(num)}${unit}`;
|
|
260
|
+
const match = str.match(numberWithUnitRE);
|
|
261
|
+
if (!match) return;
|
|
262
|
+
const [, n, unit] = match;
|
|
263
|
+
const num = Number.parseFloat(n);
|
|
264
|
+
if (unit && !Number.isNaN(num)) return `${round(num)}${unit}`;
|
|
137
265
|
}
|
|
138
266
|
function auto(str) {
|
|
139
|
-
|
|
140
|
-
return "auto";
|
|
267
|
+
if (str === "auto" || str === "a") return "auto";
|
|
141
268
|
}
|
|
142
269
|
function rem(str) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (num === 0)
|
|
154
|
-
return "0";
|
|
155
|
-
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
156
|
-
}
|
|
270
|
+
if (!str) return;
|
|
271
|
+
if (unitOnlyRE.test(str)) return `${unitOnlyMap[str]}${str}`;
|
|
272
|
+
const match = str.match(numberWithUnitRE);
|
|
273
|
+
if (!match) return;
|
|
274
|
+
const [, n, unit] = match;
|
|
275
|
+
const num = Number.parseFloat(n);
|
|
276
|
+
if (!Number.isNaN(num)) {
|
|
277
|
+
if (num === 0) return "0";
|
|
278
|
+
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
279
|
+
}
|
|
157
280
|
}
|
|
158
281
|
function px(str) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const num = Number.parseFloat(n);
|
|
166
|
-
if (!Number.isNaN(num))
|
|
167
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
282
|
+
if (unitOnlyRE.test(str)) return `${unitOnlyMap[str]}${str}`;
|
|
283
|
+
const match = str.match(numberWithUnitRE);
|
|
284
|
+
if (!match) return;
|
|
285
|
+
const [, n, unit] = match;
|
|
286
|
+
const num = Number.parseFloat(n);
|
|
287
|
+
if (!Number.isNaN(num)) return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
168
288
|
}
|
|
169
289
|
function number(str) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!Number.isNaN(num))
|
|
174
|
-
return round(num);
|
|
290
|
+
if (!numberRE.test(str)) return;
|
|
291
|
+
const num = Number.parseFloat(str);
|
|
292
|
+
if (!Number.isNaN(num)) return round(num);
|
|
175
293
|
}
|
|
176
294
|
function percent(str) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const num = Number.parseFloat(str);
|
|
182
|
-
if (!Number.isNaN(num))
|
|
183
|
-
return `${round(num / 100)}`;
|
|
295
|
+
if (str.endsWith("%")) str = str.slice(0, -1);
|
|
296
|
+
if (!numberRE.test(str)) return;
|
|
297
|
+
const num = Number.parseFloat(str);
|
|
298
|
+
if (!Number.isNaN(num)) return `${round(num / 100)}`;
|
|
184
299
|
}
|
|
185
300
|
function fraction(str) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return "0";
|
|
195
|
-
return `${round(num * 100)}%`;
|
|
196
|
-
}
|
|
301
|
+
if (!str) return;
|
|
302
|
+
if (str === "full") return "100%";
|
|
303
|
+
const [left, right] = str.split("/");
|
|
304
|
+
const num = Number.parseFloat(left) / Number.parseFloat(right);
|
|
305
|
+
if (!Number.isNaN(num)) {
|
|
306
|
+
if (num === 0) return "0";
|
|
307
|
+
return `${round(num * 100)}%`;
|
|
308
|
+
}
|
|
197
309
|
}
|
|
198
310
|
function bracketWithType(str, requiredType) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_");
|
|
231
|
-
case "quoted":
|
|
232
|
-
return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(["\\])/g, "\\$1").replace(/^(.+)$/, '"$1"');
|
|
233
|
-
}
|
|
234
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(?:calc|clamp|max|min)\((.*)/g, (match2) => {
|
|
235
|
-
const vars = [];
|
|
236
|
-
return match2.replace(/var\((--.+?)[,)]/g, (match3, g1) => {
|
|
237
|
-
vars.push(g1);
|
|
238
|
-
return match3.replace(g1, "--un-calc");
|
|
239
|
-
}).replace(/(-?\d*\.?\d(?!-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(/--un-calc/g, () => vars.shift());
|
|
240
|
-
});
|
|
241
|
-
}
|
|
311
|
+
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
312
|
+
let base;
|
|
313
|
+
let hintedType;
|
|
314
|
+
const match = str.match(bracketTypeRe);
|
|
315
|
+
if (!match) base = str.slice(1, -1);
|
|
316
|
+
else {
|
|
317
|
+
if (!requiredType) hintedType = match[1];
|
|
318
|
+
base = str.slice(match[0].length, -1);
|
|
319
|
+
}
|
|
320
|
+
if (!base) return;
|
|
321
|
+
if (base === "=\"\"") return;
|
|
322
|
+
if (base.startsWith("--")) base = `var(${base})`;
|
|
323
|
+
let curly = 0;
|
|
324
|
+
for (const i of base) if (i === "[") curly += 1;
|
|
325
|
+
else if (i === "]") {
|
|
326
|
+
curly -= 1;
|
|
327
|
+
if (curly < 0) return;
|
|
328
|
+
}
|
|
329
|
+
if (curly) return;
|
|
330
|
+
switch (hintedType) {
|
|
331
|
+
case "string": return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_");
|
|
332
|
+
case "quoted": return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(["\\])/g, "\\$1").replace(/^(.+)$/, "\"$1\"");
|
|
333
|
+
}
|
|
334
|
+
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(?:calc|clamp|max|min)\((.*)/g, (match$1) => {
|
|
335
|
+
const vars = [];
|
|
336
|
+
return match$1.replace(/var\((--.+?)[,)]/g, (match$2, g1) => {
|
|
337
|
+
vars.push(g1);
|
|
338
|
+
return match$2.replace(g1, "--un-calc");
|
|
339
|
+
}).replace(/(-?\d*\.?\d(?!-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(/--un-calc/g, () => vars.shift());
|
|
340
|
+
});
|
|
341
|
+
}
|
|
242
342
|
}
|
|
243
343
|
function bracket(str) {
|
|
244
|
-
|
|
344
|
+
return bracketWithType(str);
|
|
245
345
|
}
|
|
246
346
|
function bracketOfColor(str) {
|
|
247
|
-
|
|
347
|
+
return bracketWithType(str, "color");
|
|
248
348
|
}
|
|
249
349
|
function bracketOfLength(str) {
|
|
250
|
-
|
|
350
|
+
return bracketWithType(str, "length");
|
|
251
351
|
}
|
|
252
352
|
function bracketOfPosition(str) {
|
|
253
|
-
|
|
353
|
+
return bracketWithType(str, "position");
|
|
254
354
|
}
|
|
255
355
|
function cssvar(str) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
356
|
+
if (/^\$[^\s'"`;{}]/.test(str)) {
|
|
357
|
+
const [name, defaultValue] = str.slice(1).split(",");
|
|
358
|
+
return `var(--${escapeSelector(name)}${defaultValue ? `, ${defaultValue}` : ""})`;
|
|
359
|
+
}
|
|
260
360
|
}
|
|
261
361
|
function time(str) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
271
|
-
}
|
|
362
|
+
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
363
|
+
if (!match) return;
|
|
364
|
+
const [, n, unit] = match;
|
|
365
|
+
const num = Number.parseFloat(n);
|
|
366
|
+
if (!Number.isNaN(num)) {
|
|
367
|
+
if (num === 0 && !unit) return "0s";
|
|
368
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
369
|
+
}
|
|
272
370
|
}
|
|
273
371
|
function degree(str) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
283
|
-
}
|
|
372
|
+
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
373
|
+
if (!match) return;
|
|
374
|
+
const [, n, unit] = match;
|
|
375
|
+
const num = Number.parseFloat(n);
|
|
376
|
+
if (!Number.isNaN(num)) {
|
|
377
|
+
if (num === 0) return "0deg";
|
|
378
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
379
|
+
}
|
|
284
380
|
}
|
|
285
381
|
function global(str) {
|
|
286
|
-
|
|
287
|
-
return str;
|
|
382
|
+
if (globalKeywords.includes(str)) return str;
|
|
288
383
|
}
|
|
289
384
|
function properties(str) {
|
|
290
|
-
|
|
291
|
-
return str;
|
|
385
|
+
if (str.split(",").every((prop) => cssProps.includes(prop))) return str;
|
|
292
386
|
}
|
|
293
387
|
function position(str) {
|
|
294
|
-
|
|
295
|
-
|
|
388
|
+
if ([
|
|
389
|
+
"top",
|
|
390
|
+
"left",
|
|
391
|
+
"right",
|
|
392
|
+
"bottom",
|
|
393
|
+
"center"
|
|
394
|
+
].includes(str)) return str;
|
|
296
395
|
}
|
|
297
396
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
bracket: bracket,
|
|
302
|
-
bracketOfColor: bracketOfColor,
|
|
303
|
-
bracketOfLength: bracketOfLength,
|
|
304
|
-
bracketOfPosition: bracketOfPosition,
|
|
305
|
-
cssvar: cssvar,
|
|
306
|
-
degree: degree,
|
|
307
|
-
fraction: fraction,
|
|
308
|
-
global: global,
|
|
309
|
-
number: number,
|
|
310
|
-
numberWithUnit: numberWithUnit,
|
|
311
|
-
percent: percent,
|
|
312
|
-
position: position,
|
|
313
|
-
properties: properties,
|
|
314
|
-
px: px,
|
|
315
|
-
rem: rem,
|
|
316
|
-
time: time
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const handler = createValueHandler(valueHandlers);
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region ../../packages-presets/preset-mini/src/_utils/handlers/index.ts
|
|
399
|
+
const handler = createValueHandler(handlers_exports);
|
|
320
400
|
const h = handler;
|
|
321
401
|
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region ../../packages-presets/preset-mini/src/_utils/utilities.ts
|
|
404
|
+
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
405
|
+
/**
|
|
406
|
+
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
407
|
+
*
|
|
408
|
+
* @param propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
409
|
+
* @see {@link directionMap}
|
|
410
|
+
*/
|
|
411
|
+
function directionSize(propertyPrefix) {
|
|
412
|
+
return ([_, direction, size], { theme }) => {
|
|
413
|
+
const v = theme.spacing?.[size || "DEFAULT"] ?? h.bracket.cssvar.global.auto.fraction.rem(size);
|
|
414
|
+
if (v != null) return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
415
|
+
else if (size?.startsWith("-")) {
|
|
416
|
+
const v$1 = theme.spacing?.[size.slice(1)];
|
|
417
|
+
if (v$1 != null) return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, `calc(${v$1} * -1)`]);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
}
|
|
322
421
|
function getThemeColorForKey(theme, colors, key = "colors") {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
return obj;
|
|
422
|
+
const obj = theme[key];
|
|
423
|
+
function deepGet(current, path) {
|
|
424
|
+
if (path.length === 0) return current;
|
|
425
|
+
if (!current || typeof current !== "object") return void 0;
|
|
426
|
+
for (let i = path.length; i > 0; i--) {
|
|
427
|
+
const flatKey = path.slice(0, i).join("-");
|
|
428
|
+
const value = current[flatKey.replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())] ?? current[flatKey];
|
|
429
|
+
if (value != null) {
|
|
430
|
+
if (i === path.length) return value;
|
|
431
|
+
return deepGet(value, path.slice(i));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return deepGet(obj, colors);
|
|
339
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Obtain color from theme by camel-casing colors.
|
|
439
|
+
*/
|
|
340
440
|
function getThemeColor(theme, colors, key) {
|
|
341
|
-
|
|
441
|
+
return getThemeColorForKey(theme, colors, key) || getThemeColorForKey(theme, colors, "colors");
|
|
342
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* Split utility shorthand delimited by / or :
|
|
445
|
+
*/
|
|
343
446
|
function splitShorthand(body, type) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
447
|
+
const [front, rest] = getStringComponent(body, "[", "]", ["/", ":"]) ?? [];
|
|
448
|
+
if (front != null) {
|
|
449
|
+
const match = (front.match(bracketTypeRe) ?? [])[1];
|
|
450
|
+
if (match == null || match === type) return [front, rest];
|
|
451
|
+
}
|
|
350
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
|
|
455
|
+
* See also color.tests.ts for more examples.
|
|
456
|
+
*
|
|
457
|
+
* @example Parseable strings:
|
|
458
|
+
* 'red' // From theme, if 'red' is available
|
|
459
|
+
* 'red-100' // From theme, plus scale
|
|
460
|
+
* 'red-100/20' // From theme, plus scale/opacity
|
|
461
|
+
* '[rgb(100 2 3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
462
|
+
*
|
|
463
|
+
* @param body - Color string to be parsed.
|
|
464
|
+
* @param theme - {@link Theme} object.
|
|
465
|
+
* @return object if string is parseable.
|
|
466
|
+
*/
|
|
351
467
|
function parseColor(body, theme, key) {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return {
|
|
394
|
-
opacity,
|
|
395
|
-
name,
|
|
396
|
-
no,
|
|
397
|
-
color,
|
|
398
|
-
cssColor: parseCssColor(color),
|
|
399
|
-
alpha: h.bracket.cssvar.percent(opacity ?? "")
|
|
400
|
-
};
|
|
468
|
+
const split = splitShorthand(body, "color");
|
|
469
|
+
if (!split) return;
|
|
470
|
+
const [main, opacity] = split;
|
|
471
|
+
const colors = main.replace(/([a-z])(\d)/g, "$1-$2").split(/-/g);
|
|
472
|
+
const [name] = colors;
|
|
473
|
+
if (!name) return;
|
|
474
|
+
let color;
|
|
475
|
+
const bracket$1 = h.bracketOfColor(main);
|
|
476
|
+
const bracketOrMain = bracket$1 || main;
|
|
477
|
+
if (h.numberWithUnit(bracketOrMain)) return;
|
|
478
|
+
if (/^#[\da-f]+$/i.test(bracketOrMain)) color = bracketOrMain;
|
|
479
|
+
else if (/^hex-[\da-fA-F]+$/.test(bracketOrMain)) color = `#${bracketOrMain.slice(4)}`;
|
|
480
|
+
else if (main.startsWith("$")) color = h.cssvar(main);
|
|
481
|
+
color = color || bracket$1;
|
|
482
|
+
if (!color) {
|
|
483
|
+
const colorData = getThemeColor(theme, [main], key);
|
|
484
|
+
if (typeof colorData === "string") color = colorData;
|
|
485
|
+
}
|
|
486
|
+
let no = "DEFAULT";
|
|
487
|
+
if (!color) {
|
|
488
|
+
let keys = colors;
|
|
489
|
+
let _no;
|
|
490
|
+
const [scale] = colors.slice(-1);
|
|
491
|
+
if (/^\d+$/.test(scale)) {
|
|
492
|
+
no = _no = scale;
|
|
493
|
+
keys = colors.slice(0, -1);
|
|
494
|
+
}
|
|
495
|
+
const colorData = getThemeColor(theme, keys, key);
|
|
496
|
+
if (typeof colorData === "object") color = colorData[_no ?? no];
|
|
497
|
+
else if (typeof colorData === "string" && !_no) color = colorData;
|
|
498
|
+
}
|
|
499
|
+
return {
|
|
500
|
+
opacity,
|
|
501
|
+
name,
|
|
502
|
+
no,
|
|
503
|
+
color,
|
|
504
|
+
cssColor: parseCssColor(color),
|
|
505
|
+
alpha: h.bracket.cssvar.percent(opacity ?? "")
|
|
506
|
+
};
|
|
401
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
510
|
+
*
|
|
511
|
+
* @see {@link parseColor}
|
|
512
|
+
*
|
|
513
|
+
* @example Resolving 'red' from theme:
|
|
514
|
+
* colorResolver('background-color', 'background')('', 'red')
|
|
515
|
+
* return { 'background-color': '#f12' }
|
|
516
|
+
*
|
|
517
|
+
* @example Resolving 'red-100' from theme:
|
|
518
|
+
* colorResolver('background-color', 'background')('', 'red-100')
|
|
519
|
+
* return { '--un-background-opacity': '1', 'background-color': 'rgb(254 226 226 / var(--un-background-opacity))' }
|
|
520
|
+
*
|
|
521
|
+
* @example Resolving 'red-100/20' from theme:
|
|
522
|
+
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
523
|
+
* return { 'background-color': 'rgb(204 251 241 / 0.22)' }
|
|
524
|
+
*
|
|
525
|
+
* @example Resolving 'hex-124':
|
|
526
|
+
* colorResolver('color', 'text')('', 'hex-124')
|
|
527
|
+
* return { '--un-text-opacity': '1', 'color': 'rgb(17 34 68 / var(--un-text-opacity))' }
|
|
528
|
+
*
|
|
529
|
+
* @param property - Property for the css value to be created.
|
|
530
|
+
* @param varName - Base name for the opacity variable.
|
|
531
|
+
* @param [key] - Theme key to select the color from.
|
|
532
|
+
* @param [shouldPass] - Function to decide whether to pass the css.
|
|
533
|
+
* @return object.
|
|
534
|
+
*/
|
|
535
|
+
function colorResolver(property, varName, key, shouldPass) {
|
|
536
|
+
return ([, body], { theme, generator }) => {
|
|
537
|
+
const data = parseColor(body ?? "", theme, key);
|
|
538
|
+
if (!data) return;
|
|
539
|
+
const { alpha, color, cssColor } = data;
|
|
540
|
+
const rawColorComment = generator.config.envMode === "dev" && color ? ` /* ${color} */` : "";
|
|
541
|
+
const css = {};
|
|
542
|
+
if (cssColor) if (alpha != null) css[property] = colorToString(cssColor, alpha) + rawColorComment;
|
|
543
|
+
else {
|
|
544
|
+
const opacityVar = `--un-${varName}-opacity`;
|
|
545
|
+
const result = colorToString(cssColor, `var(${opacityVar})`);
|
|
546
|
+
if (result.includes(opacityVar)) css[opacityVar] = colorOpacityToString(cssColor);
|
|
547
|
+
css[property] = result + rawColorComment;
|
|
548
|
+
}
|
|
549
|
+
else if (color) if (alpha != null) css[property] = colorToString(color, alpha) + rawColorComment;
|
|
550
|
+
else {
|
|
551
|
+
const opacityVar = `--un-${varName}-opacity`;
|
|
552
|
+
const result = colorToString(color, `var(${opacityVar})`);
|
|
553
|
+
if (result.includes(opacityVar)) css[opacityVar] = 1;
|
|
554
|
+
css[property] = result + rawColorComment;
|
|
555
|
+
}
|
|
556
|
+
if (shouldPass?.(css) !== false) return css;
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function colorableShadows(shadows, colorVar) {
|
|
560
|
+
const colored = [];
|
|
561
|
+
shadows = toArray(shadows);
|
|
562
|
+
for (let i = 0; i < shadows.length; i++) {
|
|
563
|
+
const components = getStringComponents(shadows[i], " ", 6);
|
|
564
|
+
if (!components || components.length < 3) return shadows;
|
|
565
|
+
let isInset = false;
|
|
566
|
+
const pos = components.indexOf("inset");
|
|
567
|
+
if (pos !== -1) {
|
|
568
|
+
components.splice(pos, 1);
|
|
569
|
+
isInset = true;
|
|
570
|
+
}
|
|
571
|
+
let colorVarValue = "";
|
|
572
|
+
const lastComp = components.at(-1);
|
|
573
|
+
if (parseCssColor(components.at(0))) {
|
|
574
|
+
const color = parseCssColor(components.shift());
|
|
575
|
+
if (color) colorVarValue = `, ${colorToString(color)}`;
|
|
576
|
+
} else if (parseCssColor(lastComp)) {
|
|
577
|
+
const color = parseCssColor(components.pop());
|
|
578
|
+
if (color) colorVarValue = `, ${colorToString(color)}`;
|
|
579
|
+
} else if (lastComp && lastComp.startsWith("var(")) colorVarValue = `, ${components.pop()}`;
|
|
580
|
+
colored.push(`${isInset ? "inset " : ""}${components.join(" ")} var(${colorVar}${colorVarValue})`);
|
|
581
|
+
}
|
|
582
|
+
return colored;
|
|
583
|
+
}
|
|
584
|
+
function hasParseableColor(color, theme, key) {
|
|
585
|
+
return color != null && !!parseColor(color, theme, key)?.color;
|
|
586
|
+
}
|
|
587
|
+
const reLetters = /[a-z]+/gi;
|
|
588
|
+
const resolvedBreakpoints = /* @__PURE__ */ new WeakMap();
|
|
589
|
+
function resolveBreakpoints({ theme, generator }, key = "breakpoints") {
|
|
590
|
+
const breakpoints = (generator?.userConfig?.theme)?.[key] || theme[key];
|
|
591
|
+
if (!breakpoints) return void 0;
|
|
592
|
+
if (resolvedBreakpoints.has(theme)) return resolvedBreakpoints.get(theme);
|
|
593
|
+
const resolved = Object.entries(breakpoints).sort((a, b) => Number.parseInt(a[1].replace(reLetters, "")) - Number.parseInt(b[1].replace(reLetters, ""))).map(([point, size]) => ({
|
|
594
|
+
point,
|
|
595
|
+
size
|
|
596
|
+
}));
|
|
597
|
+
resolvedBreakpoints.set(theme, resolved);
|
|
598
|
+
return resolved;
|
|
599
|
+
}
|
|
600
|
+
function resolveVerticalBreakpoints(context) {
|
|
601
|
+
return resolveBreakpoints(context, "verticalBreakpoints");
|
|
602
|
+
}
|
|
603
|
+
function makeGlobalStaticRules(prefix, property) {
|
|
604
|
+
return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
|
|
605
|
+
}
|
|
606
|
+
function isCSSMathFn(value) {
|
|
607
|
+
return value != null && cssMathFnRE.test(value);
|
|
608
|
+
}
|
|
609
|
+
function isSize(str) {
|
|
610
|
+
if (str[0] === "[" && str.slice(-1) === "]") str = str.slice(1, -1);
|
|
611
|
+
return cssMathFnRE.test(str) || numberWithUnitRE.test(str);
|
|
612
|
+
}
|
|
613
|
+
function transformXYZ(d, v, name) {
|
|
614
|
+
const values = v.split(splitComma);
|
|
615
|
+
if (d || !d && values.length === 1) return xyzMap[d].map((i) => [`--un-${name}${i}`, v]);
|
|
616
|
+
return values.map((v$1, i) => [`--un-${name}-${xyzArray[i]}`, v$1]);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region ../../packages-presets/preset-mini/src/_utils/index.ts
|
|
621
|
+
var _utils_exports = /* @__PURE__ */ __exportAll({
|
|
622
|
+
CONTROL_MINI_NO_NEGATIVE: () => CONTROL_MINI_NO_NEGATIVE,
|
|
623
|
+
colorResolver: () => colorResolver,
|
|
624
|
+
colorableShadows: () => colorableShadows,
|
|
625
|
+
cornerMap: () => cornerMap,
|
|
626
|
+
cssMathFnRE: () => cssMathFnRE,
|
|
627
|
+
cssVarFnRE: () => cssVarFnRE,
|
|
628
|
+
directionMap: () => directionMap,
|
|
629
|
+
directionSize: () => directionSize,
|
|
630
|
+
globalKeywords: () => globalKeywords,
|
|
631
|
+
h: () => h,
|
|
632
|
+
handler: () => handler,
|
|
633
|
+
hasParseableColor: () => hasParseableColor,
|
|
634
|
+
insetMap: () => insetMap,
|
|
635
|
+
isCSSMathFn: () => isCSSMathFn,
|
|
636
|
+
isSize: () => isSize,
|
|
637
|
+
makeGlobalStaticRules: () => makeGlobalStaticRules,
|
|
638
|
+
parseColor: () => parseColor,
|
|
639
|
+
positionMap: () => positionMap,
|
|
640
|
+
resolveBreakpoints: () => resolveBreakpoints,
|
|
641
|
+
resolveVerticalBreakpoints: () => resolveVerticalBreakpoints,
|
|
642
|
+
splitShorthand: () => splitShorthand,
|
|
643
|
+
transformXYZ: () => transformXYZ,
|
|
644
|
+
valueHandlers: () => handlers_exports,
|
|
645
|
+
xyzArray: () => xyzArray,
|
|
646
|
+
xyzMap: () => xyzMap
|
|
647
|
+
});
|
|
648
|
+
import * as import__unocss_rule_utils from "@unocss/rule-utils";
|
|
649
|
+
__reExport(_utils_exports, import__unocss_rule_utils);
|
|
650
|
+
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region ../../packages-presets/preset-mini/src/utils.ts
|
|
653
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
654
|
+
CONTROL_MINI_NO_NEGATIVE: () => CONTROL_MINI_NO_NEGATIVE,
|
|
655
|
+
colorResolver: () => colorResolver,
|
|
656
|
+
colorableShadows: () => colorableShadows,
|
|
657
|
+
cornerMap: () => cornerMap,
|
|
658
|
+
cssMathFnRE: () => cssMathFnRE,
|
|
659
|
+
cssVarFnRE: () => cssVarFnRE,
|
|
660
|
+
directionMap: () => directionMap,
|
|
661
|
+
directionSize: () => directionSize,
|
|
662
|
+
globalKeywords: () => globalKeywords,
|
|
663
|
+
h: () => h,
|
|
664
|
+
handler: () => handler,
|
|
665
|
+
hasParseableColor: () => hasParseableColor,
|
|
666
|
+
insetMap: () => insetMap,
|
|
667
|
+
isCSSMathFn: () => isCSSMathFn,
|
|
668
|
+
isSize: () => isSize,
|
|
669
|
+
makeGlobalStaticRules: () => makeGlobalStaticRules,
|
|
670
|
+
parseColor: () => parseColor,
|
|
671
|
+
positionMap: () => positionMap,
|
|
672
|
+
resolveBreakpoints: () => resolveBreakpoints,
|
|
673
|
+
resolveVerticalBreakpoints: () => resolveVerticalBreakpoints,
|
|
674
|
+
splitShorthand: () => splitShorthand,
|
|
675
|
+
transformXYZ: () => transformXYZ,
|
|
676
|
+
valueHandlers: () => handlers_exports,
|
|
677
|
+
xyzArray: () => xyzArray,
|
|
678
|
+
xyzMap: () => xyzMap
|
|
679
|
+
});
|
|
680
|
+
__reExport(utils_exports, _utils_exports);
|
|
402
681
|
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/categories.ts
|
|
403
684
|
const staticUtilities = {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
685
|
+
"box-border": "boxSizing",
|
|
686
|
+
"box-content": "boxSizing",
|
|
687
|
+
"b": "border",
|
|
688
|
+
"border": "border",
|
|
689
|
+
"rounded": "border",
|
|
690
|
+
"block": "display",
|
|
691
|
+
"inline-block": "display",
|
|
692
|
+
"inline": "display",
|
|
693
|
+
"flex": "display",
|
|
694
|
+
"inline-flex": "display",
|
|
695
|
+
"table": "display",
|
|
696
|
+
"table-caption": "display",
|
|
697
|
+
"table-cell": "display",
|
|
698
|
+
"table-column": "display",
|
|
699
|
+
"table-column-group": "display",
|
|
700
|
+
"table-footer-group": "display",
|
|
701
|
+
"table-header-group": "display",
|
|
702
|
+
"table-row-group": "display",
|
|
703
|
+
"table-row": "display",
|
|
704
|
+
"flow-root": "display",
|
|
705
|
+
"grid": "display",
|
|
706
|
+
"inline-grid": "display",
|
|
707
|
+
"contents": "display",
|
|
708
|
+
"hidden": "display",
|
|
709
|
+
"float-right": "float",
|
|
710
|
+
"float-left": "float",
|
|
711
|
+
"float-none": "float",
|
|
712
|
+
"clear-left": "clear",
|
|
713
|
+
"clear-right": "clear",
|
|
714
|
+
"clear-both": "clear",
|
|
715
|
+
"clear-none": "clear",
|
|
716
|
+
"object-contain": "objectFit",
|
|
717
|
+
"object-cover": "objectFit",
|
|
718
|
+
"object-fill": "objectFit",
|
|
719
|
+
"object-none": "objectFit",
|
|
720
|
+
"object-scale-down": "objectFit",
|
|
721
|
+
"overflow-auto": "overflow",
|
|
722
|
+
"overflow-hidden": "overflow",
|
|
723
|
+
"overflow-visible": "overflow",
|
|
724
|
+
"overflow-scroll": "overflow",
|
|
725
|
+
"overflow-x-auto": "overflow",
|
|
726
|
+
"overflow-y-auto": "overflow",
|
|
727
|
+
"overflow-x-hidden": "overflow",
|
|
728
|
+
"overflow-y-hidden": "overflow",
|
|
729
|
+
"overflow-x-visible": "overflow",
|
|
730
|
+
"overflow-y-visible": "overflow",
|
|
731
|
+
"overflow-x-scroll": "overflow",
|
|
732
|
+
"overflow-y-scroll": "overflow",
|
|
733
|
+
"of-auto": "overflow",
|
|
734
|
+
"of-hidden": "overflow",
|
|
735
|
+
"of-visible": "overflow",
|
|
736
|
+
"of-scroll": "overflow",
|
|
737
|
+
"of-x-auto": "overflow",
|
|
738
|
+
"of-y-auto": "overflow",
|
|
739
|
+
"of-x-hidden": "overflow",
|
|
740
|
+
"of-y-hidden": "overflow",
|
|
741
|
+
"of-x-visible": "overflow",
|
|
742
|
+
"of-y-visible": "overflow",
|
|
743
|
+
"of-x-scroll": "overflow",
|
|
744
|
+
"of-y-scroll": "overflow",
|
|
745
|
+
"overscroll-auto": "overscrollBehavior",
|
|
746
|
+
"overscroll-contain": "overscrollBehavior",
|
|
747
|
+
"overscroll-none": "overscrollBehavior",
|
|
748
|
+
"overscroll-y-auto": "overscrollBehavior",
|
|
749
|
+
"overscroll-y-contain": "overscrollBehavior",
|
|
750
|
+
"overscroll-y-none": "overscrollBehavior",
|
|
751
|
+
"overscroll-x-auto": "overscrollBehavior",
|
|
752
|
+
"overscroll-x-contain": "overscrollBehavior",
|
|
753
|
+
"overscroll-x-none": "overscrollBehavior",
|
|
754
|
+
"static": "position",
|
|
755
|
+
"fixed": "position",
|
|
756
|
+
"absolute": "position",
|
|
757
|
+
"relative": "position",
|
|
758
|
+
"sticky": "position",
|
|
759
|
+
"visible": "visibility",
|
|
760
|
+
"invisible": "visibility",
|
|
761
|
+
"flex-row": "flex",
|
|
762
|
+
"flex-row-reverse": "flex",
|
|
763
|
+
"flex-col": "flex",
|
|
764
|
+
"flex-col-reverse": "flex",
|
|
765
|
+
"flex-wrap": "flex",
|
|
766
|
+
"flex-wrap-reverse": "flex",
|
|
767
|
+
"flex-nowrap": "flex",
|
|
768
|
+
"col-auto": "grid",
|
|
769
|
+
"row-auto": "grid",
|
|
770
|
+
"grid-flow-row": "grid",
|
|
771
|
+
"grid-flow-col": "grid",
|
|
772
|
+
"grid-flow-row-dense": "grid",
|
|
773
|
+
"grid-flow-col-dense": "grid",
|
|
774
|
+
"justify-start": "justifyContent",
|
|
775
|
+
"justify-end": "justifyContent",
|
|
776
|
+
"justify-center": "justifyContent",
|
|
777
|
+
"justify-between": "justifyContent",
|
|
778
|
+
"justify-around": "justifyContent",
|
|
779
|
+
"justify-evenly": "justifyContent",
|
|
780
|
+
"justify-left": "justifyContent",
|
|
781
|
+
"justify-right": "justifyContent",
|
|
782
|
+
"justify-items-auto": "justifyItems",
|
|
783
|
+
"justify-items-start": "justifyItems",
|
|
784
|
+
"justify-items-end": "justifyItems",
|
|
785
|
+
"justify-items-center": "justifyItems",
|
|
786
|
+
"justify-items-stretch": "justifyItems",
|
|
787
|
+
"justify-self-auto": "justifySelf",
|
|
788
|
+
"justify-self-start": "justifySelf",
|
|
789
|
+
"justify-self-end": "justifySelf",
|
|
790
|
+
"justify-self-center": "justifySelf",
|
|
791
|
+
"justify-self-stretch": "justifySelf",
|
|
792
|
+
"content-center": "alignContent",
|
|
793
|
+
"content-start": "alignContent",
|
|
794
|
+
"content-end": "alignContent",
|
|
795
|
+
"content-between": "alignContent",
|
|
796
|
+
"content-around": "alignContent",
|
|
797
|
+
"content-evenly": "alignContent",
|
|
798
|
+
"items-start": "alignItems",
|
|
799
|
+
"items-end": "alignItems",
|
|
800
|
+
"items-center": "alignItems",
|
|
801
|
+
"items-baseline": "alignItems",
|
|
802
|
+
"items-stretch": "alignItems",
|
|
803
|
+
"self-auto": "alignSelf",
|
|
804
|
+
"self-start": "alignSelf",
|
|
805
|
+
"self-end": "alignSelf",
|
|
806
|
+
"self-center": "alignSelf",
|
|
807
|
+
"self-stretch": "alignSelf",
|
|
808
|
+
"place-content-center": "placeContent",
|
|
809
|
+
"place-content-start": "placeContent",
|
|
810
|
+
"place-content-end": "placeContent",
|
|
811
|
+
"place-content-between": "placeContent",
|
|
812
|
+
"place-content-around": "placeContent",
|
|
813
|
+
"place-content-evenly": "placeContent",
|
|
814
|
+
"place-content-stretch": "placeContent",
|
|
815
|
+
"place-items-auto": "placeItems",
|
|
816
|
+
"place-items-start": "placeItems",
|
|
817
|
+
"place-items-end": "placeItems",
|
|
818
|
+
"place-items-center": "placeItems",
|
|
819
|
+
"place-items-stretch": "placeItems",
|
|
820
|
+
"place-self-auto": "placeSelf",
|
|
821
|
+
"place-self-start": "placeSelf",
|
|
822
|
+
"place-self-end": "placeSelf",
|
|
823
|
+
"place-self-center": "placeSelf",
|
|
824
|
+
"place-self-stretch": "placeSelf",
|
|
825
|
+
"antialiased": "fontSmoothing",
|
|
826
|
+
"subpixel-antialiased": "font",
|
|
827
|
+
"italic": "font",
|
|
828
|
+
"not-italic": "font",
|
|
829
|
+
"normal-nums": "font",
|
|
830
|
+
"ordinal": "font",
|
|
831
|
+
"slashed-zero": "font",
|
|
832
|
+
"lining-nums": "font",
|
|
833
|
+
"oldstyle-nums": "font",
|
|
834
|
+
"proportional-nums": "font",
|
|
835
|
+
"tabular-nums": "font",
|
|
836
|
+
"diagonal-fractions": "font",
|
|
837
|
+
"stacked-fractions": "font",
|
|
838
|
+
"list-inside": "listStylePosition",
|
|
839
|
+
"list-outside": "listStylePosition",
|
|
840
|
+
"text-left": "textAlign",
|
|
841
|
+
"text-center": "textAlign",
|
|
842
|
+
"text-right": "textAlign",
|
|
843
|
+
"text-justify": "textAlign",
|
|
844
|
+
"underline": "textDecoration",
|
|
845
|
+
"line-through": "textDecoration",
|
|
846
|
+
"no-underline": "textDecoration",
|
|
847
|
+
"uppercase": "textTransform",
|
|
848
|
+
"lowercase": "textTransform",
|
|
849
|
+
"capitalize": "textTransform",
|
|
850
|
+
"normal-case": "textTransform",
|
|
851
|
+
"truncate": "textOverflow",
|
|
852
|
+
"overflow-ellipsis": "textOverflow",
|
|
853
|
+
"overflow-clip": "textOverflow",
|
|
854
|
+
"align-baseline": "verticalAlign",
|
|
855
|
+
"align-top": "verticalAlign",
|
|
856
|
+
"align-middle": "verticalAlign",
|
|
857
|
+
"align-bottom": "verticalAlign",
|
|
858
|
+
"align-text-top": "verticalAlign",
|
|
859
|
+
"align-text-bottom": "verticalAlign",
|
|
860
|
+
"whitespace-normal": "whitespace",
|
|
861
|
+
"whitespace-nowrap": "whitespace",
|
|
862
|
+
"whitespace-pre": "whitespace",
|
|
863
|
+
"whitespace-pre-line": "whitespace",
|
|
864
|
+
"whitespace-pre-wrap": "whitespace",
|
|
865
|
+
"ws-normal": "whitespace",
|
|
866
|
+
"ws-nowrap": "whitespace",
|
|
867
|
+
"ws-pre": "whitespace",
|
|
868
|
+
"ws-pre-line": "whitespace",
|
|
869
|
+
"ws-pre-wrap": "whitespace",
|
|
870
|
+
"break-normal": "wordBreak",
|
|
871
|
+
"break-words": "wordBreak",
|
|
872
|
+
"break-all": "wordBreak",
|
|
873
|
+
"bg-fixed": "background",
|
|
874
|
+
"bg-local": "background",
|
|
875
|
+
"bg-scroll": "background",
|
|
876
|
+
"bg-clip-border": "background",
|
|
877
|
+
"bg-clip-padding": "background",
|
|
878
|
+
"bg-clip-content": "background",
|
|
879
|
+
"bg-clip-text": "background",
|
|
880
|
+
"bg-repeat": "background",
|
|
881
|
+
"bg-no-repeat": "background",
|
|
882
|
+
"bg-repeat-x": "background",
|
|
883
|
+
"bg-repeat-y": "background",
|
|
884
|
+
"bg-repeat-round": "background",
|
|
885
|
+
"bg-repeat-space": "background",
|
|
886
|
+
"border-solid": "border",
|
|
887
|
+
"border-dashed": "border",
|
|
888
|
+
"border-dotted": "border",
|
|
889
|
+
"border-double": "border",
|
|
890
|
+
"border-none": "border",
|
|
891
|
+
"border-collapse": "border",
|
|
892
|
+
"border-separate": "border",
|
|
893
|
+
"table-auto": "table",
|
|
894
|
+
"table-fixed": "table",
|
|
895
|
+
"transform": "transform",
|
|
896
|
+
"transform-gpu": "transform",
|
|
897
|
+
"transform-none": "transform",
|
|
898
|
+
"appearance-none": "appearance",
|
|
899
|
+
"pointer-events-none": "pointerEvents",
|
|
900
|
+
"pointer-events-auto": "pointerEvents",
|
|
901
|
+
"resize-none": "resize",
|
|
902
|
+
"resize-y": "resize",
|
|
903
|
+
"resize-x": "resize",
|
|
904
|
+
"resize": "resize",
|
|
905
|
+
"select-none": "userSelect",
|
|
906
|
+
"select-text": "userSelect",
|
|
907
|
+
"select-all": "userSelect",
|
|
908
|
+
"select-auto": "userSelect",
|
|
909
|
+
"fill-current": "fill",
|
|
910
|
+
"stroke-current": "stroke",
|
|
911
|
+
"sr-only": "accessibility",
|
|
912
|
+
"not-sr-only": "accessibility",
|
|
913
|
+
"filter": "filter",
|
|
914
|
+
"invert": "filter"
|
|
634
915
|
};
|
|
635
916
|
const dynamicUtilities = {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
917
|
+
container: "container",
|
|
918
|
+
space: "space",
|
|
919
|
+
divide: "divide",
|
|
920
|
+
bg: "background",
|
|
921
|
+
from: "gradientColor",
|
|
922
|
+
via: "gradientColor",
|
|
923
|
+
to: "gradientColor",
|
|
924
|
+
border: "border",
|
|
925
|
+
b: "border",
|
|
926
|
+
rounded: "borderRadius",
|
|
927
|
+
cursor: "cursor",
|
|
928
|
+
flex: "flex",
|
|
929
|
+
shrink: "flex",
|
|
930
|
+
order: "order",
|
|
931
|
+
font: "font",
|
|
932
|
+
h: "size",
|
|
933
|
+
leading: "lineHeight",
|
|
934
|
+
list: "listStyleType",
|
|
935
|
+
m: "margin",
|
|
936
|
+
my: "margin",
|
|
937
|
+
mx: "margin",
|
|
938
|
+
mt: "margin",
|
|
939
|
+
mr: "margin",
|
|
940
|
+
mb: "margin",
|
|
941
|
+
ml: "margin",
|
|
942
|
+
min: "size",
|
|
943
|
+
max: "size",
|
|
944
|
+
object: "objectPosition",
|
|
945
|
+
op: "opacity",
|
|
946
|
+
opacity: "opacity",
|
|
947
|
+
outline: "outline",
|
|
948
|
+
p: "padding",
|
|
949
|
+
py: "padding",
|
|
950
|
+
px: "padding",
|
|
951
|
+
pt: "padding",
|
|
952
|
+
pr: "padding",
|
|
953
|
+
pb: "padding",
|
|
954
|
+
pl: "padding",
|
|
955
|
+
placeholder: "placeholder",
|
|
956
|
+
inset: "inset",
|
|
957
|
+
top: "position",
|
|
958
|
+
right: "position",
|
|
959
|
+
bottom: "position",
|
|
960
|
+
left: "position",
|
|
961
|
+
shadow: "boxShadow",
|
|
962
|
+
ring: "ring",
|
|
963
|
+
fill: "fill",
|
|
964
|
+
stroke: "stroke",
|
|
965
|
+
text: "text",
|
|
966
|
+
tracking: "letterSpacing",
|
|
967
|
+
w: "size",
|
|
968
|
+
z: "zIndex",
|
|
969
|
+
gap: "gap",
|
|
970
|
+
auto: "grid",
|
|
971
|
+
grid: "grid",
|
|
972
|
+
col: "grid",
|
|
973
|
+
row: "grid",
|
|
974
|
+
origin: "transform",
|
|
975
|
+
scale: "transform",
|
|
976
|
+
rotate: "transform",
|
|
977
|
+
translate: "transform",
|
|
978
|
+
skew: "transform",
|
|
979
|
+
transition: "animation",
|
|
980
|
+
ease: "animation",
|
|
981
|
+
duration: "animation",
|
|
982
|
+
delay: "animation",
|
|
983
|
+
animate: "animation",
|
|
984
|
+
filter: "filter",
|
|
985
|
+
backdrop: "filter",
|
|
986
|
+
invert: "filter"
|
|
706
987
|
};
|
|
707
988
|
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region src/utils.ts
|
|
708
991
|
function getSelectorCategory(selector) {
|
|
709
|
-
|
|
992
|
+
return staticUtilities[selector] || Object.entries(dynamicUtilities).find(([name]) => (/* @__PURE__ */ new RegExp(`^${name}+(-.+|[0-9]+)$`)).test(selector))?.[1];
|
|
710
993
|
}
|
|
711
994
|
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/analyzer.ts
|
|
712
997
|
const ignoredColors = [
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
998
|
+
"transparent",
|
|
999
|
+
"current",
|
|
1000
|
+
"currentColor",
|
|
1001
|
+
"inherit",
|
|
1002
|
+
"initial",
|
|
1003
|
+
"unset",
|
|
1004
|
+
"none"
|
|
720
1005
|
];
|
|
721
1006
|
function uniq(array) {
|
|
722
|
-
|
|
1007
|
+
return [...new Set(array)];
|
|
723
1008
|
}
|
|
724
1009
|
async function analyzer(modules, ctx) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1010
|
+
const matched = [];
|
|
1011
|
+
const icons = [];
|
|
1012
|
+
const colors = [];
|
|
1013
|
+
const tokensInfo = /* @__PURE__ */ new Map();
|
|
1014
|
+
await Promise.all(modules.map(async (code, id) => {
|
|
1015
|
+
const result = await ctx.uno.generate(code, {
|
|
1016
|
+
id,
|
|
1017
|
+
extendedInfo: true,
|
|
1018
|
+
preflights: false
|
|
1019
|
+
});
|
|
1020
|
+
for (const [key, value] of result.matched.entries()) {
|
|
1021
|
+
const prev = tokensInfo.get(key);
|
|
1022
|
+
tokensInfo.set(key, {
|
|
1023
|
+
data: value.data,
|
|
1024
|
+
count: prev?.modules?.length ? value.count + prev.count : value.count,
|
|
1025
|
+
modules: uniq([...prev?.modules || [], id])
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
}));
|
|
1029
|
+
for (const [rawSelector, { data, count, modules: _modules }] of tokensInfo.entries()) {
|
|
1030
|
+
const ruleContext = data[data.length - 1][5];
|
|
1031
|
+
const ruleMeta = data[data.length - 1][4];
|
|
1032
|
+
const body = data.map((d) => d[2]).join("\n---\n");
|
|
1033
|
+
const baseSelector = ruleContext?.currentSelector;
|
|
1034
|
+
const variants = ruleContext?.variants?.map((v) => v.name).filter(Boolean);
|
|
1035
|
+
const layer = ruleMeta?.layer || "default";
|
|
1036
|
+
if (baseSelector) {
|
|
1037
|
+
const category = layer !== "default" ? layer : getSelectorCategory(baseSelector);
|
|
1038
|
+
const body$1 = baseSelector.replace(/^ring-offset|outline-solid|outline-dotted/, "head").replace(/^\w+-/, "");
|
|
1039
|
+
if (category === "icons") {
|
|
1040
|
+
const existing = icons.find((i) => i.baseSelector === baseSelector);
|
|
1041
|
+
if (existing) {
|
|
1042
|
+
existing.count += count;
|
|
1043
|
+
existing.modules = uniq([...existing.modules, ..._modules]);
|
|
1044
|
+
} else icons.push({
|
|
1045
|
+
name: rawSelector,
|
|
1046
|
+
rawSelector,
|
|
1047
|
+
baseSelector,
|
|
1048
|
+
category,
|
|
1049
|
+
variants,
|
|
1050
|
+
count,
|
|
1051
|
+
ruleMeta,
|
|
1052
|
+
modules: _modules,
|
|
1053
|
+
body: body$1
|
|
1054
|
+
});
|
|
1055
|
+
continue;
|
|
1056
|
+
}
|
|
1057
|
+
const parsedColor = parseColor(body$1, ctx.uno.config.theme, "colors");
|
|
1058
|
+
if (parsedColor?.color && !ignoredColors.includes(parsedColor?.color)) {
|
|
1059
|
+
const existing = colors.find((c) => c.name === parsedColor.name && c.no === parsedColor.no);
|
|
1060
|
+
if (existing) {
|
|
1061
|
+
existing.count += count;
|
|
1062
|
+
existing.modules = uniq([...existing.modules, ..._modules]);
|
|
1063
|
+
} else colors.push({
|
|
1064
|
+
name: parsedColor.name,
|
|
1065
|
+
no: parsedColor.no,
|
|
1066
|
+
color: parsedColor.color,
|
|
1067
|
+
count,
|
|
1068
|
+
modules: _modules,
|
|
1069
|
+
rawSelector,
|
|
1070
|
+
category: category || "",
|
|
1071
|
+
variants,
|
|
1072
|
+
body: body$1
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
if (category) {
|
|
1076
|
+
matched.push({
|
|
1077
|
+
name: rawSelector,
|
|
1078
|
+
rawSelector,
|
|
1079
|
+
baseSelector,
|
|
1080
|
+
category,
|
|
1081
|
+
variants,
|
|
1082
|
+
count,
|
|
1083
|
+
ruleMeta,
|
|
1084
|
+
modules: _modules,
|
|
1085
|
+
body: body$1
|
|
1086
|
+
});
|
|
1087
|
+
continue;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
matched.push({
|
|
1091
|
+
name: rawSelector,
|
|
1092
|
+
rawSelector,
|
|
1093
|
+
category: "other",
|
|
1094
|
+
count,
|
|
1095
|
+
modules: _modules,
|
|
1096
|
+
body
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
return {
|
|
1100
|
+
matched,
|
|
1101
|
+
colors,
|
|
1102
|
+
icons
|
|
1103
|
+
};
|
|
819
1104
|
}
|
|
820
1105
|
|
|
1106
|
+
//#endregion
|
|
1107
|
+
//#region src/index.ts
|
|
821
1108
|
const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
822
1109
|
function UnocssInspector(ctx) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1110
|
+
const baseUrl = "__unocss";
|
|
1111
|
+
async function configureServer(server) {
|
|
1112
|
+
await ctx.ready;
|
|
1113
|
+
server.middlewares.use(`/${baseUrl}`, sirv(resolve(_dirname, "../dist/client"), {
|
|
1114
|
+
single: true,
|
|
1115
|
+
dev: true
|
|
1116
|
+
}));
|
|
1117
|
+
server.middlewares.use(`/${baseUrl}_api`, async (req, res, next) => {
|
|
1118
|
+
if (!req.url) return next();
|
|
1119
|
+
if (req.url === "/") {
|
|
1120
|
+
const info = {
|
|
1121
|
+
version: ctx.uno.version,
|
|
1122
|
+
root: server.config.root,
|
|
1123
|
+
modules: Array.from(ctx.modules.keys()),
|
|
1124
|
+
config: ctx.uno.config,
|
|
1125
|
+
configSources: (await ctx.ready).sources
|
|
1126
|
+
};
|
|
1127
|
+
res.setHeader("Content-Type", "application/json");
|
|
1128
|
+
res.write(JSON.stringify(info, getCircularReplacer(), 2));
|
|
1129
|
+
res.end();
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
if (req.url.startsWith("/module")) {
|
|
1133
|
+
const id = new URLSearchParams(req.url.slice(8)).get("id") || "";
|
|
1134
|
+
const code = ctx.modules.get(id);
|
|
1135
|
+
if (code == null) {
|
|
1136
|
+
res.statusCode = 404;
|
|
1137
|
+
res.end();
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
const tokens = new CountableSet();
|
|
1141
|
+
await ctx.uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens);
|
|
1142
|
+
const result = await ctx.uno.generate(tokens, {
|
|
1143
|
+
id,
|
|
1144
|
+
extendedInfo: true,
|
|
1145
|
+
preflights: false
|
|
1146
|
+
});
|
|
1147
|
+
const analyzed = await analyzer(new BetterMap([[id, code]]), ctx);
|
|
1148
|
+
const mod = {
|
|
1149
|
+
...result,
|
|
1150
|
+
...analyzed,
|
|
1151
|
+
layers: result.layers.map((name) => ({
|
|
1152
|
+
name,
|
|
1153
|
+
css: result.getLayer(name)
|
|
1154
|
+
})),
|
|
1155
|
+
gzipSize: await gzipSize(result.css),
|
|
1156
|
+
code,
|
|
1157
|
+
id
|
|
1158
|
+
};
|
|
1159
|
+
res.setHeader("Content-Type", "application/json");
|
|
1160
|
+
res.write(JSON.stringify(mod, null, 2));
|
|
1161
|
+
res.end();
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
if (req.url.startsWith("/repl")) {
|
|
1165
|
+
const query = new URLSearchParams(req.url.slice(5));
|
|
1166
|
+
const token = query.get("token") || "";
|
|
1167
|
+
const includeSafelist = JSON.parse(query.get("safelist") ?? "false");
|
|
1168
|
+
const result = await ctx.uno.generate(token, {
|
|
1169
|
+
preflights: false,
|
|
1170
|
+
safelist: includeSafelist
|
|
1171
|
+
});
|
|
1172
|
+
const mod = {
|
|
1173
|
+
...result,
|
|
1174
|
+
matched: Array.from(result.matched)
|
|
1175
|
+
};
|
|
1176
|
+
res.setHeader("Content-Type", "application/json");
|
|
1177
|
+
res.write(JSON.stringify(mod, null, 2));
|
|
1178
|
+
res.end();
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
if (req.url.startsWith("/overview")) {
|
|
1182
|
+
const result = await ctx.uno.generate(ctx.tokens, { preflights: false });
|
|
1183
|
+
const analyzed = await analyzer(ctx.modules, ctx);
|
|
1184
|
+
const mod = {
|
|
1185
|
+
...result,
|
|
1186
|
+
...analyzed,
|
|
1187
|
+
gzipSize: await gzipSize(result.css),
|
|
1188
|
+
layers: result.layers.map((name) => ({
|
|
1189
|
+
name,
|
|
1190
|
+
css: result.getLayer(name)
|
|
1191
|
+
}))
|
|
1192
|
+
};
|
|
1193
|
+
res.setHeader("Content-Type", "application/json");
|
|
1194
|
+
res.write(JSON.stringify(mod, null, 2));
|
|
1195
|
+
res.end();
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
next();
|
|
1199
|
+
});
|
|
1200
|
+
const _printUrls = server.printUrls;
|
|
1201
|
+
const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
|
|
1202
|
+
server.printUrls = () => {
|
|
1203
|
+
_printUrls();
|
|
1204
|
+
for (const localUrl of server.resolvedUrls?.local ?? []) {
|
|
1205
|
+
const appUrl = localUrl.endsWith("/") ? localUrl : `${localUrl}/`;
|
|
1206
|
+
const inspectorUrl = `${server.config.base && appUrl.endsWith(server.config.base) ? appUrl.slice(0, -server.config.base.length) : appUrl.slice(0, -1)}/${baseUrl}/`;
|
|
1207
|
+
console.log(` ${green("➜")} ${bold("UnoCSS Inspector")}: ${colorUrl(`${inspectorUrl}`)}`);
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
return {
|
|
1212
|
+
name: "unocss:inspector",
|
|
1213
|
+
apply: "serve",
|
|
1214
|
+
configureServer,
|
|
1215
|
+
devtools: { setup(ctx$1) {
|
|
1216
|
+
ctx$1.docks.register({
|
|
1217
|
+
id: "unocss",
|
|
1218
|
+
title: "UnoCSS",
|
|
1219
|
+
icon: "https://unocss.dev/logo.svg",
|
|
1220
|
+
type: "iframe",
|
|
1221
|
+
url: `/${baseUrl}`
|
|
1222
|
+
});
|
|
1223
|
+
} }
|
|
1224
|
+
};
|
|
931
1225
|
}
|
|
932
1226
|
function getCircularReplacer() {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
ancestors.push(value);
|
|
942
|
-
return value;
|
|
943
|
-
};
|
|
1227
|
+
const ancestors = [];
|
|
1228
|
+
return function(key, value) {
|
|
1229
|
+
if (typeof value !== "object" || value === null) return value;
|
|
1230
|
+
while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();
|
|
1231
|
+
if (ancestors.includes(value)) return "[Circular]";
|
|
1232
|
+
ancestors.push(value);
|
|
1233
|
+
return value;
|
|
1234
|
+
};
|
|
944
1235
|
}
|
|
945
1236
|
|
|
946
|
-
|
|
1237
|
+
//#endregion
|
|
1238
|
+
export { UnocssInspector as default };
|