@unocss/preset-mini 0.36.0 → 0.37.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/dist/chunks/default.cjs +3 -1
- package/dist/chunks/default.mjs +4 -2
- package/dist/chunks/default2.cjs +86 -243
- package/dist/chunks/default2.mjs +4 -145
- package/dist/chunks/default3.mjs +1 -1
- package/dist/chunks/transform.cjs +165 -10
- package/dist/chunks/transform.mjs +139 -2
- package/dist/chunks/utilities.cjs +311 -6
- package/dist/chunks/utilities.mjs +299 -3
- package/dist/index.cjs +0 -1
- package/dist/index.mjs +0 -1
- package/dist/rules.cjs +19 -18
- package/dist/rules.d.ts +15 -1
- package/dist/rules.mjs +3 -4
- package/dist/theme.cjs +1 -1
- package/dist/theme.d.ts +9 -0
- package/dist/theme.mjs +1 -1
- package/dist/utils.cjs +9 -10
- package/dist/utils.mjs +1 -2
- package/dist/variants.cjs +0 -1
- package/dist/variants.mjs +0 -1
- package/package.json +2 -2
- package/dist/chunks/index.cjs +0 -310
- package/dist/chunks/index.mjs +0 -300
package/dist/chunks/index.mjs
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { escapeSelector, createValueHandler } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
const directionMap = {
|
|
4
|
-
"l": ["-left"],
|
|
5
|
-
"r": ["-right"],
|
|
6
|
-
"t": ["-top"],
|
|
7
|
-
"b": ["-bottom"],
|
|
8
|
-
"s": ["-inline-start"],
|
|
9
|
-
"e": ["-inline-end"],
|
|
10
|
-
"x": ["-left", "-right"],
|
|
11
|
-
"y": ["-top", "-bottom"],
|
|
12
|
-
"": [""],
|
|
13
|
-
"bs": ["-block-start"],
|
|
14
|
-
"be": ["-block-end"],
|
|
15
|
-
"is": ["-inline-start"],
|
|
16
|
-
"ie": ["-inline-end"],
|
|
17
|
-
"block": ["-block-start", "-block-end"],
|
|
18
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
19
|
-
};
|
|
20
|
-
const insetMap = {
|
|
21
|
-
...directionMap,
|
|
22
|
-
s: ["-inset-inline-start"],
|
|
23
|
-
e: ["-inset-inline-end"],
|
|
24
|
-
bs: ["-inset-block-start"],
|
|
25
|
-
be: ["-inset-block-end"],
|
|
26
|
-
is: ["-inset-inline-start"],
|
|
27
|
-
ie: ["-inset-inline-end"],
|
|
28
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
29
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
30
|
-
};
|
|
31
|
-
const cornerMap = {
|
|
32
|
-
"l": ["-top-left", "-bottom-left"],
|
|
33
|
-
"r": ["-top-right", "-bottom-right"],
|
|
34
|
-
"t": ["-top-left", "-top-right"],
|
|
35
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
36
|
-
"tl": ["-top-left"],
|
|
37
|
-
"lt": ["-top-left"],
|
|
38
|
-
"tr": ["-top-right"],
|
|
39
|
-
"rt": ["-top-right"],
|
|
40
|
-
"bl": ["-bottom-left"],
|
|
41
|
-
"lb": ["-bottom-left"],
|
|
42
|
-
"br": ["-bottom-right"],
|
|
43
|
-
"rb": ["-bottom-right"],
|
|
44
|
-
"": [""],
|
|
45
|
-
"bs": ["-start-start", "-start-end"],
|
|
46
|
-
"be": ["-end-start", "-end-end"],
|
|
47
|
-
"is": ["-end-start", "-start-start"],
|
|
48
|
-
"ie": ["-start-end", "-end-end"],
|
|
49
|
-
"bs-is": ["-start-start"],
|
|
50
|
-
"is-bs": ["-start-start"],
|
|
51
|
-
"bs-ie": ["-start-end"],
|
|
52
|
-
"ie-bs": ["-start-end"],
|
|
53
|
-
"be-is": ["-end-start"],
|
|
54
|
-
"is-be": ["-end-start"],
|
|
55
|
-
"be-ie": ["-end-end"],
|
|
56
|
-
"ie-be": ["-end-end"]
|
|
57
|
-
};
|
|
58
|
-
const xyzMap = {
|
|
59
|
-
"x": ["-x"],
|
|
60
|
-
"y": ["-y"],
|
|
61
|
-
"z": ["-z"],
|
|
62
|
-
"": ["-x", "-y"]
|
|
63
|
-
};
|
|
64
|
-
const basePositionMap = [
|
|
65
|
-
"top",
|
|
66
|
-
"top center",
|
|
67
|
-
"top left",
|
|
68
|
-
"top right",
|
|
69
|
-
"bottom",
|
|
70
|
-
"bottom center",
|
|
71
|
-
"bottom left",
|
|
72
|
-
"bottom right",
|
|
73
|
-
"left",
|
|
74
|
-
"left center",
|
|
75
|
-
"left top",
|
|
76
|
-
"left bottom",
|
|
77
|
-
"right",
|
|
78
|
-
"right center",
|
|
79
|
-
"right top",
|
|
80
|
-
"right bottom",
|
|
81
|
-
"center",
|
|
82
|
-
"center top",
|
|
83
|
-
"center bottom",
|
|
84
|
-
"center left",
|
|
85
|
-
"center right",
|
|
86
|
-
"center center"
|
|
87
|
-
];
|
|
88
|
-
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
89
|
-
const globalKeywords = [
|
|
90
|
-
"inherit",
|
|
91
|
-
"initial",
|
|
92
|
-
"revert",
|
|
93
|
-
"revert-layer",
|
|
94
|
-
"unset"
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
const cssProps = [
|
|
98
|
-
"color",
|
|
99
|
-
"border-color",
|
|
100
|
-
"background-color",
|
|
101
|
-
"flex-grow",
|
|
102
|
-
"flex",
|
|
103
|
-
"flex-shrink",
|
|
104
|
-
"caret-color",
|
|
105
|
-
"font",
|
|
106
|
-
"gap",
|
|
107
|
-
"opacity",
|
|
108
|
-
"visibility",
|
|
109
|
-
"z-index",
|
|
110
|
-
"font-weight",
|
|
111
|
-
"zoom",
|
|
112
|
-
"text-shadow",
|
|
113
|
-
"transform",
|
|
114
|
-
"box-shadow",
|
|
115
|
-
"backround-position",
|
|
116
|
-
"left",
|
|
117
|
-
"right",
|
|
118
|
-
"top",
|
|
119
|
-
"bottom",
|
|
120
|
-
"object-position",
|
|
121
|
-
"max-height",
|
|
122
|
-
"min-height",
|
|
123
|
-
"max-width",
|
|
124
|
-
"min-width",
|
|
125
|
-
"height",
|
|
126
|
-
"width",
|
|
127
|
-
"border-width",
|
|
128
|
-
"margin",
|
|
129
|
-
"padding",
|
|
130
|
-
"outline-width",
|
|
131
|
-
"outline-offset",
|
|
132
|
-
"font-size",
|
|
133
|
-
"line-height",
|
|
134
|
-
"text-indent",
|
|
135
|
-
"vertical-align",
|
|
136
|
-
"border-spacing",
|
|
137
|
-
"letter-spacing",
|
|
138
|
-
"word-spacing",
|
|
139
|
-
"stroke",
|
|
140
|
-
"filter",
|
|
141
|
-
"backdrop-filter",
|
|
142
|
-
"fill",
|
|
143
|
-
"mask",
|
|
144
|
-
"mask-size",
|
|
145
|
-
"mask-border",
|
|
146
|
-
"clip-path",
|
|
147
|
-
"clip",
|
|
148
|
-
"border-radius"
|
|
149
|
-
];
|
|
150
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
|
|
151
|
-
const numberRE = /^(-?[0-9.]+)$/i;
|
|
152
|
-
const unitOnlyRE = /^(px)$/i;
|
|
153
|
-
function round(n) {
|
|
154
|
-
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
155
|
-
}
|
|
156
|
-
function numberWithUnit(str) {
|
|
157
|
-
const match = str.match(numberWithUnitRE);
|
|
158
|
-
if (!match)
|
|
159
|
-
return;
|
|
160
|
-
const [, n, unit] = match;
|
|
161
|
-
const num = parseFloat(n);
|
|
162
|
-
if (unit && !Number.isNaN(num))
|
|
163
|
-
return `${round(num)}${unit}`;
|
|
164
|
-
}
|
|
165
|
-
function auto(str) {
|
|
166
|
-
if (str === "auto" || str === "a")
|
|
167
|
-
return "auto";
|
|
168
|
-
}
|
|
169
|
-
function rem(str) {
|
|
170
|
-
if (str.match(unitOnlyRE))
|
|
171
|
-
return `1${str}`;
|
|
172
|
-
const match = str.match(numberWithUnitRE);
|
|
173
|
-
if (!match)
|
|
174
|
-
return;
|
|
175
|
-
const [, n, unit] = match;
|
|
176
|
-
const num = parseFloat(n);
|
|
177
|
-
if (!Number.isNaN(num))
|
|
178
|
-
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
179
|
-
}
|
|
180
|
-
function px(str) {
|
|
181
|
-
if (str.match(unitOnlyRE))
|
|
182
|
-
return `1${str}`;
|
|
183
|
-
const match = str.match(numberWithUnitRE);
|
|
184
|
-
if (!match)
|
|
185
|
-
return;
|
|
186
|
-
const [, n, unit] = match;
|
|
187
|
-
const num = parseFloat(n);
|
|
188
|
-
if (!Number.isNaN(num))
|
|
189
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
190
|
-
}
|
|
191
|
-
function number(str) {
|
|
192
|
-
if (!numberRE.test(str))
|
|
193
|
-
return;
|
|
194
|
-
const num = parseFloat(str);
|
|
195
|
-
if (!Number.isNaN(num))
|
|
196
|
-
return round(num);
|
|
197
|
-
}
|
|
198
|
-
function percent(str) {
|
|
199
|
-
if (str.endsWith("%"))
|
|
200
|
-
str = str.slice(0, -1);
|
|
201
|
-
const num = parseFloat(str);
|
|
202
|
-
if (!Number.isNaN(num))
|
|
203
|
-
return `${round(num / 100)}`;
|
|
204
|
-
}
|
|
205
|
-
function fraction(str) {
|
|
206
|
-
if (str === "full")
|
|
207
|
-
return "100%";
|
|
208
|
-
const [left, right] = str.split("/");
|
|
209
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
210
|
-
if (!Number.isNaN(num))
|
|
211
|
-
return `${round(num * 100)}%`;
|
|
212
|
-
}
|
|
213
|
-
const bracketTypeRe = /^\[(color|length|position):/i;
|
|
214
|
-
function bracketWithType(str, type) {
|
|
215
|
-
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
216
|
-
let base;
|
|
217
|
-
const match = str.match(bracketTypeRe);
|
|
218
|
-
if (!match)
|
|
219
|
-
base = str.slice(1, -1);
|
|
220
|
-
else if (type && match[1] === type)
|
|
221
|
-
base = str.slice(match[0].length, -1);
|
|
222
|
-
if (base !== void 0) {
|
|
223
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
|
|
224
|
-
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function bracket(str) {
|
|
230
|
-
return bracketWithType(str);
|
|
231
|
-
}
|
|
232
|
-
function bracketOfColor(str) {
|
|
233
|
-
return bracketWithType(str, "color");
|
|
234
|
-
}
|
|
235
|
-
function bracketOfLength(str) {
|
|
236
|
-
return bracketWithType(str, "length");
|
|
237
|
-
}
|
|
238
|
-
function bracketOfPosition(str) {
|
|
239
|
-
return bracketWithType(str, "position");
|
|
240
|
-
}
|
|
241
|
-
function cssvar(str) {
|
|
242
|
-
if (str.match(/^\$\S/))
|
|
243
|
-
return `var(--${escapeSelector(str.slice(1))})`;
|
|
244
|
-
}
|
|
245
|
-
function time(str) {
|
|
246
|
-
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
247
|
-
if (!match)
|
|
248
|
-
return;
|
|
249
|
-
const [, n, unit] = match;
|
|
250
|
-
const num = parseFloat(n);
|
|
251
|
-
if (!Number.isNaN(num))
|
|
252
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
253
|
-
}
|
|
254
|
-
function degree(str) {
|
|
255
|
-
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
256
|
-
if (!match)
|
|
257
|
-
return;
|
|
258
|
-
const [, n, unit] = match;
|
|
259
|
-
const num = parseFloat(n);
|
|
260
|
-
if (!Number.isNaN(num))
|
|
261
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
262
|
-
}
|
|
263
|
-
function global(str) {
|
|
264
|
-
if (globalKeywords.includes(str))
|
|
265
|
-
return str;
|
|
266
|
-
}
|
|
267
|
-
function properties(str) {
|
|
268
|
-
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
269
|
-
return str;
|
|
270
|
-
}
|
|
271
|
-
function position(str) {
|
|
272
|
-
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
273
|
-
return str;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const valueHandlers = {
|
|
277
|
-
__proto__: null,
|
|
278
|
-
numberWithUnit: numberWithUnit,
|
|
279
|
-
auto: auto,
|
|
280
|
-
rem: rem,
|
|
281
|
-
px: px,
|
|
282
|
-
number: number,
|
|
283
|
-
percent: percent,
|
|
284
|
-
fraction: fraction,
|
|
285
|
-
bracket: bracket,
|
|
286
|
-
bracketOfColor: bracketOfColor,
|
|
287
|
-
bracketOfLength: bracketOfLength,
|
|
288
|
-
bracketOfPosition: bracketOfPosition,
|
|
289
|
-
cssvar: cssvar,
|
|
290
|
-
time: time,
|
|
291
|
-
degree: degree,
|
|
292
|
-
global: global,
|
|
293
|
-
properties: properties,
|
|
294
|
-
position: position
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const handler = createValueHandler(valueHandlers);
|
|
298
|
-
const h = handler;
|
|
299
|
-
|
|
300
|
-
export { h as a, cornerMap as c, directionMap as d, globalKeywords as g, handler as h, insetMap as i, positionMap as p, valueHandlers as v, xyzMap as x };
|