@unocss/preset-mini 0.58.0 → 0.58.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/colors.d.cts +1 -1
- package/dist/colors.d.mts +1 -1
- package/dist/colors.d.ts +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +6 -6
- package/dist/rules.cjs +50 -1008
- package/dist/rules.d.cts +1 -1
- package/dist/rules.d.mts +1 -1
- package/dist/rules.d.ts +1 -1
- package/dist/rules.mjs +5 -968
- package/dist/shared/{preset-mini.qLxuqSG-.cjs → preset-mini.-3Qybdh5.cjs} +38 -38
- package/dist/shared/preset-mini.0CcynBZx.mjs +537 -0
- package/dist/shared/{preset-mini.5jRPR_fm.mjs → preset-mini.0UJFjS_1.mjs} +2 -2
- package/dist/shared/{preset-mini.WoiFygE2.d.cts → preset-mini.20fUBpHS.d.cts} +1 -1
- package/dist/shared/{preset-mini.zVYE2D2j.d.ts → preset-mini.8w2rXvMk.d.ts} +1 -1
- package/dist/shared/preset-mini.AVP8I7_j.mjs +747 -0
- package/dist/shared/preset-mini.ORVb5Lu8.mjs +978 -0
- package/dist/shared/preset-mini.UhMMbd34.cjs +560 -0
- package/dist/shared/{preset-mini.4DxDu2I8.d.mts → preset-mini.YxT4AwuI.d.cts} +1 -1
- package/dist/shared/preset-mini.fgwIVvur.cjs +322 -0
- package/dist/shared/preset-mini.g6cWGZM2.cjs +1021 -0
- package/dist/shared/{preset-mini.5daNC9yh.d.ts → preset-mini.gVNz4b9u.d.ts} +1 -1
- package/dist/shared/{preset-mini.7XoWRZIl.d.cts → preset-mini.hpPpX7ws.d.cts} +1 -1
- package/dist/shared/{preset-mini.7XoWRZIl.d.mts → preset-mini.hpPpX7ws.d.mts} +1 -1
- package/dist/shared/{preset-mini.7XoWRZIl.d.ts → preset-mini.hpPpX7ws.d.ts} +1 -1
- package/dist/shared/preset-mini.jXC5Sr98.cjs +772 -0
- package/dist/shared/{preset-mini.WMGBnRDa.d.mts → preset-mini.nzD7Hw_0.d.mts} +1 -1
- package/dist/shared/{preset-mini.5-XKlNyK.d.cts → preset-mini.vMrmsD3H.d.mts} +1 -1
- package/dist/shared/preset-mini.zC_vZg74.mjs +291 -0
- package/dist/theme.cjs +34 -318
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/theme.d.ts +3 -3
- package/dist/theme.mjs +5 -293
- package/dist/utils.cjs +28 -545
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.mjs +2 -524
- package/dist/variants.cjs +31 -770
- package/dist/variants.d.cts +3 -3
- package/dist/variants.d.mts +3 -3
- package/dist/variants.d.ts +3 -3
- package/dist/variants.mjs +4 -747
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const utilities = require('./preset-mini.UhMMbd34.cjs');
|
|
4
4
|
|
|
5
5
|
const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
|
|
6
6
|
const containValues = ["none", "strict", "content", "size", "inline-size", "layout", "style", "paint"];
|
|
@@ -13,24 +13,24 @@ const displays = [
|
|
|
13
13
|
["flow-root", { display: "flow-root" }],
|
|
14
14
|
["list-item", { display: "list-item" }],
|
|
15
15
|
["hidden", { display: "none" }],
|
|
16
|
-
[/^display-(.+)$/, ([, c]) => ({ display:
|
|
16
|
+
[/^display-(.+)$/, ([, c]) => ({ display: utilities.h.bracket.cssvar.global(c) })]
|
|
17
17
|
];
|
|
18
18
|
const appearances = [
|
|
19
19
|
["visible", { visibility: "visible" }],
|
|
20
20
|
["invisible", { visibility: "hidden" }],
|
|
21
21
|
["backface-visible", { "backface-visibility": "visible" }],
|
|
22
22
|
["backface-hidden", { "backface-visibility": "hidden" }],
|
|
23
|
-
...
|
|
23
|
+
...utilities.makeGlobalStaticRules("backface", "backface-visibility")
|
|
24
24
|
];
|
|
25
25
|
const cursors = [
|
|
26
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor:
|
|
26
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: utilities.h.bracket.cssvar.global(c) })],
|
|
27
27
|
...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
|
|
28
28
|
];
|
|
29
29
|
const contains = [
|
|
30
30
|
[/^contain-(.*)$/, ([, d]) => {
|
|
31
|
-
if (
|
|
31
|
+
if (utilities.h.bracket(d) != null) {
|
|
32
32
|
return {
|
|
33
|
-
contain:
|
|
33
|
+
contain: utilities.h.bracket(d).split(" ").map((e) => utilities.h.cssvar.fraction(e) ?? e).join(" ")
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
return containValues.includes(d) ? { contain: d } : void 0;
|
|
@@ -39,38 +39,38 @@ const contains = [
|
|
|
39
39
|
const pointerEvents = [
|
|
40
40
|
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
41
41
|
["pointer-events-none", { "pointer-events": "none" }],
|
|
42
|
-
...
|
|
42
|
+
...utilities.makeGlobalStaticRules("pointer-events")
|
|
43
43
|
];
|
|
44
44
|
const resizes = [
|
|
45
45
|
["resize-x", { resize: "horizontal" }],
|
|
46
46
|
["resize-y", { resize: "vertical" }],
|
|
47
47
|
["resize", { resize: "both" }],
|
|
48
48
|
["resize-none", { resize: "none" }],
|
|
49
|
-
...
|
|
49
|
+
...utilities.makeGlobalStaticRules("resize")
|
|
50
50
|
];
|
|
51
51
|
const userSelects = [
|
|
52
52
|
["select-auto", { "-webkit-user-select": "auto", "user-select": "auto" }],
|
|
53
53
|
["select-all", { "-webkit-user-select": "all", "user-select": "all" }],
|
|
54
54
|
["select-text", { "-webkit-user-select": "text", "user-select": "text" }],
|
|
55
55
|
["select-none", { "-webkit-user-select": "none", "user-select": "none" }],
|
|
56
|
-
...
|
|
56
|
+
...utilities.makeGlobalStaticRules("select", "user-select")
|
|
57
57
|
];
|
|
58
58
|
const whitespaces = [
|
|
59
59
|
[
|
|
60
60
|
/^(?:whitespace-|ws-)([-\w]+)$/,
|
|
61
|
-
([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...
|
|
61
|
+
([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...utilities.globalKeywords].includes(v) ? { "white-space": v } : void 0,
|
|
62
62
|
{ autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
|
|
63
63
|
]
|
|
64
64
|
];
|
|
65
65
|
const contentVisibility = [
|
|
66
|
-
[/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size":
|
|
66
|
+
[/^intrinsic-size-(.+)$/, ([, d]) => ({ "contain-intrinsic-size": utilities.h.bracket.cssvar.global.fraction.rem(d) }), { autocomplete: "intrinsic-size-<num>" }],
|
|
67
67
|
["content-visibility-visible", { "content-visibility": "visible" }],
|
|
68
68
|
["content-visibility-hidden", { "content-visibility": "hidden" }],
|
|
69
69
|
["content-visibility-auto", { "content-visibility": "auto" }],
|
|
70
|
-
...
|
|
70
|
+
...utilities.makeGlobalStaticRules("content-visibility")
|
|
71
71
|
];
|
|
72
72
|
const contents = [
|
|
73
|
-
[/^content-(.+)$/, ([, v]) => ({ content:
|
|
73
|
+
[/^content-(.+)$/, ([, v]) => ({ content: utilities.h.bracket.cssvar(v) })],
|
|
74
74
|
["content-empty", { content: '""' }],
|
|
75
75
|
["content-none", { content: "none" }]
|
|
76
76
|
];
|
|
@@ -98,7 +98,7 @@ const textTransforms = [
|
|
|
98
98
|
["case-lower", { "text-transform": "lowercase" }],
|
|
99
99
|
["case-capital", { "text-transform": "capitalize" }],
|
|
100
100
|
["case-normal", { "text-transform": "none" }],
|
|
101
|
-
...
|
|
101
|
+
...utilities.makeGlobalStaticRules("case", "text-transform")
|
|
102
102
|
];
|
|
103
103
|
const fontStyles = [
|
|
104
104
|
["italic", { "font-style": "italic" }],
|
|
@@ -132,7 +132,7 @@ const ringBase = {
|
|
|
132
132
|
const rings = [
|
|
133
133
|
// ring
|
|
134
134
|
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
135
|
-
const value = theme.ringWidth?.[d || "DEFAULT"] ??
|
|
135
|
+
const value = theme.ringWidth?.[d || "DEFAULT"] ?? utilities.h.px(d || "1");
|
|
136
136
|
if (value) {
|
|
137
137
|
return {
|
|
138
138
|
"--un-ring-width": value,
|
|
@@ -146,23 +146,23 @@ const rings = [
|
|
|
146
146
|
[/^ring-(?:width-|size-)(.+)$/, handleWidth, { autocomplete: "ring-(width|size)-$lineWidth" }],
|
|
147
147
|
// offset size
|
|
148
148
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
149
|
-
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ??
|
|
149
|
+
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utilities.h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
|
|
150
150
|
// colors
|
|
151
151
|
[/^ring-(.+)$/, handleColorOrWidth, { autocomplete: "ring-$colors" }],
|
|
152
|
-
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity":
|
|
152
|
+
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
|
|
153
153
|
// offset color
|
|
154
|
-
[/^ring-offset-(.+)$/,
|
|
155
|
-
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity":
|
|
154
|
+
[/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
|
|
155
|
+
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
|
|
156
156
|
// style
|
|
157
157
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
158
158
|
];
|
|
159
159
|
function handleWidth([, b], { theme }) {
|
|
160
|
-
return { "--un-ring-width": theme.ringWidth?.[b] ??
|
|
160
|
+
return { "--un-ring-width": theme.ringWidth?.[b] ?? utilities.h.bracket.cssvar.px(b) };
|
|
161
161
|
}
|
|
162
162
|
function handleColorOrWidth(match, ctx) {
|
|
163
|
-
if (
|
|
163
|
+
if (utilities.isCSSMathFn(utilities.h.bracket(match[1])))
|
|
164
164
|
return handleWidth(match, ctx);
|
|
165
|
-
return
|
|
165
|
+
return utilities.colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const boxShadowsBase = {
|
|
@@ -177,16 +177,16 @@ const boxShadows = [
|
|
|
177
177
|
const [, d] = match;
|
|
178
178
|
const { theme } = context;
|
|
179
179
|
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
180
|
-
const c = d ?
|
|
181
|
-
if ((v != null || c != null) && !
|
|
180
|
+
const c = d ? utilities.h.bracket.cssvar(d) : void 0;
|
|
181
|
+
if ((v != null || c != null) && !utilities.hasParseableColor(c, theme, "shadowColor")) {
|
|
182
182
|
return {
|
|
183
|
-
"--un-shadow":
|
|
183
|
+
"--un-shadow": utilities.colorableShadows(v || c, "--un-shadow-color").join(","),
|
|
184
184
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return utilities.colorResolver("--un-shadow-color", "shadow", "shadowColor")(match, context);
|
|
188
188
|
}, { autocomplete: ["shadow-$colors", "shadow-$boxShadow"] }],
|
|
189
|
-
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity":
|
|
189
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
|
|
190
190
|
// inset
|
|
191
191
|
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
192
192
|
];
|
|
@@ -239,10 +239,10 @@ const transformBase = {
|
|
|
239
239
|
};
|
|
240
240
|
const transforms = [
|
|
241
241
|
// origins
|
|
242
|
-
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin":
|
|
242
|
+
[/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.h.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utilities.positionMap).join("|")})`, `origin-(${Object.keys(utilities.positionMap).join("|")})`] }],
|
|
243
243
|
// perspectives
|
|
244
244
|
[/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
|
|
245
|
-
const v =
|
|
245
|
+
const v = utilities.h.bracket.cssvar.px.numberWithUnit(s);
|
|
246
246
|
if (v != null) {
|
|
247
247
|
return {
|
|
248
248
|
"-webkit-perspective": v,
|
|
@@ -252,7 +252,7 @@ const transforms = [
|
|
|
252
252
|
}],
|
|
253
253
|
// skip 1 & 2 letters shortcut
|
|
254
254
|
[/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
|
|
255
|
-
const v =
|
|
255
|
+
const v = utilities.h.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
|
|
256
256
|
if (v != null) {
|
|
257
257
|
return {
|
|
258
258
|
"-webkit-perspective-origin": v,
|
|
@@ -277,28 +277,28 @@ const transforms = [
|
|
|
277
277
|
["transform-cpu", { transform: transformCpu }],
|
|
278
278
|
["transform-gpu", { transform: transformGpu }],
|
|
279
279
|
["transform-none", { transform: "none" }],
|
|
280
|
-
...
|
|
280
|
+
...utilities.makeGlobalStaticRules("transform")
|
|
281
281
|
];
|
|
282
282
|
function handleTranslate([, d, b], { theme }) {
|
|
283
|
-
const v = theme.spacing?.[b] ??
|
|
283
|
+
const v = theme.spacing?.[b] ?? utilities.h.bracket.cssvar.fraction.rem(b);
|
|
284
284
|
if (v != null) {
|
|
285
285
|
return [
|
|
286
|
-
...
|
|
286
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
287
287
|
["transform", transformCpu]
|
|
288
288
|
];
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
function handleScale([, d, b]) {
|
|
292
|
-
const v =
|
|
292
|
+
const v = utilities.h.bracket.cssvar.fraction.percent(b);
|
|
293
293
|
if (v != null) {
|
|
294
294
|
return [
|
|
295
|
-
...
|
|
295
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
296
296
|
["transform", transformCpu]
|
|
297
297
|
];
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
function handleRotate([, d = "", b]) {
|
|
301
|
-
const v =
|
|
301
|
+
const v = utilities.h.bracket.cssvar.degree(b);
|
|
302
302
|
if (v != null) {
|
|
303
303
|
if (d) {
|
|
304
304
|
return {
|
|
@@ -318,10 +318,10 @@ function handleRotate([, d = "", b]) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
function handleSkew([, d, b]) {
|
|
321
|
-
const v =
|
|
321
|
+
const v = utilities.h.bracket.cssvar.degree(b);
|
|
322
322
|
if (v != null) {
|
|
323
323
|
return [
|
|
324
|
-
...
|
|
324
|
+
...utilities.xyzMap[d].map((i) => [`--un-skew${i}`, v]),
|
|
325
325
|
["transform", transformCpu]
|
|
326
326
|
];
|
|
327
327
|
}
|