@unocss/preset-mini 0.57.7 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/rules.cjs +128 -92
- package/dist/rules.d.cts +1 -5
- package/dist/rules.d.mts +1 -5
- package/dist/rules.d.ts +1 -5
- package/dist/rules.mjs +130 -93
- package/dist/shared/{preset-mini.dPVVIvNm.mjs → preset-mini.5jRPR_fm.mjs} +15 -5
- package/dist/shared/{preset-mini.XmVozI6N.d.mts → preset-mini.WMGBnRDa.d.mts} +3 -2
- package/dist/shared/{preset-mini.Jpc0QYPj.d.cts → preset-mini.WoiFygE2.d.cts} +3 -2
- package/dist/shared/{preset-mini.MACvs-wn.cjs → preset-mini.qLxuqSG-.cjs} +15 -5
- package/dist/shared/{preset-mini.QW22c5Df.d.ts → preset-mini.zVYE2D2j.d.ts} +3 -2
- package/dist/theme.cjs +2 -2
- package/dist/theme.mjs +2 -2
- package/dist/utils.cjs +545 -28
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.mjs +524 -2
- package/dist/variants.cjs +62 -31
- 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 +62 -31
- package/package.json +4 -4
- package/dist/shared/preset-mini.ImRm63ih.cjs +0 -542
- package/dist/shared/preset-mini.Stl9mkMB.mjs +0 -518
package/dist/rules.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { globalKeywords, h, isCSSMathFn, colorResolver, directionMap, hasParseableColor, cornerMap, parseColor, isSize, makeGlobalStaticRules, colorableShadows, splitShorthand, insetMap, resolveBreakpoints, directionSize } from './utils.mjs';
|
|
2
2
|
import { colorToString, colorOpacityToString, hasThemeFn, transformThemeFn } from '@unocss/rule-utils';
|
|
3
3
|
import { warnOnce, toArray } from '@unocss/core';
|
|
4
|
-
import { d as displays, c as contentVisibility, a as contents, e as textOverflows, f as textTransforms, g as fontStyles, h as fontSmoothings, i as boxShadows, j as rings, k as cursors, l as appearances, p as pointerEvents, m as resizes, u as userSelects, w as whitespaces, n as breaks, o as transforms, q as contains, s as textWraps } from './shared/preset-mini.
|
|
5
|
-
export { b as boxShadowsBase, r as ringBase, t as transformBase, v as varEmpty } from './shared/preset-mini.
|
|
4
|
+
import { d as displays, c as contentVisibility, a as contents, e as textOverflows, f as textTransforms, g as fontStyles, h as fontSmoothings, i as boxShadows, j as rings, k as cursors, l as appearances, p as pointerEvents, m as resizes, u as userSelects, w as whitespaces, n as breaks, o as transforms, q as contains, s as textWraps } from './shared/preset-mini.5jRPR_fm.mjs';
|
|
5
|
+
export { b as boxShadowsBase, r as ringBase, t as transformBase, v as varEmpty } from './shared/preset-mini.5jRPR_fm.mjs';
|
|
6
6
|
|
|
7
7
|
const verticalAlignAlias = {
|
|
8
8
|
"mid": "middle",
|
|
@@ -36,9 +36,9 @@ const textAligns = ["center", "left", "right", "justify", "start", "end"].map((v
|
|
|
36
36
|
|
|
37
37
|
const outline = [
|
|
38
38
|
// size
|
|
39
|
-
[/^outline-(?:width-|size-)?(.+)$/,
|
|
39
|
+
[/^outline-(?:width-|size-)?(.+)$/, handleWidth$2, { autocomplete: "outline-(width|size)-<num>" }],
|
|
40
40
|
// color
|
|
41
|
-
[/^outline-(?:color-)?(.+)$/,
|
|
41
|
+
[/^outline-(?:color-)?(.+)$/, handleColorOrWidth$2, { autocomplete: "outline-$colors" }],
|
|
42
42
|
// offset
|
|
43
43
|
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? h.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
44
44
|
// style
|
|
@@ -46,6 +46,14 @@ const outline = [
|
|
|
46
46
|
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
47
47
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
48
48
|
];
|
|
49
|
+
function handleWidth$2([, b], { theme }) {
|
|
50
|
+
return { "outline-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
|
|
51
|
+
}
|
|
52
|
+
function handleColorOrWidth$2(match, ctx) {
|
|
53
|
+
if (isCSSMathFn(h.bracket(match[1])))
|
|
54
|
+
return handleWidth$2(match, ctx);
|
|
55
|
+
return colorResolver("outline-color", "outline-color", "borderColor")(match, ctx);
|
|
56
|
+
}
|
|
49
57
|
const appearance = [
|
|
50
58
|
["appearance-none", {
|
|
51
59
|
"-webkit-appearance": "none",
|
|
@@ -65,11 +73,11 @@ const willChange = [
|
|
|
65
73
|
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords];
|
|
66
74
|
const borders = [
|
|
67
75
|
// compound
|
|
68
|
-
[/^(?:border|b)()(?:-(.+))?$/,
|
|
69
|
-
[/^(?:border|b)-([xy])(?:-(.+))?$/,
|
|
70
|
-
[/^(?:border|b)-([rltbse])(?:-(.+))?$/,
|
|
71
|
-
[/^(?:border|b)-(block|inline)(?:-(.+))?$/,
|
|
72
|
-
[/^(?:border|b)-([bi][se])(?:-(.+))?$/,
|
|
76
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorderSize, { autocomplete: "(border|b)-<directions>" }],
|
|
77
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorderSize],
|
|
78
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorderSize],
|
|
79
|
+
[/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorderSize],
|
|
80
|
+
[/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorderSize],
|
|
73
81
|
// size
|
|
74
82
|
[/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
|
|
75
83
|
[/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
@@ -77,11 +85,11 @@ const borders = [
|
|
|
77
85
|
[/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
78
86
|
[/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
79
87
|
// colors
|
|
80
|
-
[/^(?:border|b)-()(?:color-)?(.+)$/,
|
|
81
|
-
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/,
|
|
82
|
-
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/,
|
|
83
|
-
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/,
|
|
84
|
-
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/,
|
|
88
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColorOrSize, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
|
|
89
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
90
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
91
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
92
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
85
93
|
// opacity
|
|
86
94
|
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
|
|
87
95
|
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
@@ -127,31 +135,27 @@ function borderColorResolver(direction) {
|
|
|
127
135
|
};
|
|
128
136
|
}
|
|
129
137
|
} else if (color) {
|
|
130
|
-
if (isCSSMathFn(color)) {
|
|
131
|
-
return {
|
|
132
|
-
"border-width": color
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
138
|
return {
|
|
136
139
|
[`border${direction}-color`]: colorToString(color, alpha)
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
142
|
};
|
|
140
143
|
}
|
|
141
|
-
function handlerBorder(m, ctx) {
|
|
142
|
-
return handlerBorderSize(m, ctx);
|
|
143
|
-
}
|
|
144
144
|
function handlerBorderSize([, a = "", b], { theme }) {
|
|
145
145
|
const v = theme.lineWidth?.[b || "DEFAULT"] ?? h.bracket.cssvar.global.px(b || "1");
|
|
146
146
|
if (a in directionMap && v != null)
|
|
147
147
|
return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
if (a in directionMap
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
function handlerBorderColorOrSize([, a = "", b], ctx) {
|
|
150
|
+
if (a in directionMap) {
|
|
151
|
+
if (isCSSMathFn(h.bracket(b)))
|
|
152
|
+
return handlerBorderSize(["", a, b], ctx);
|
|
153
|
+
if (hasParseableColor(b, ctx.theme, "borderColor")) {
|
|
154
|
+
return Object.assign(
|
|
155
|
+
{},
|
|
156
|
+
...directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx.theme))
|
|
157
|
+
);
|
|
158
|
+
}
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
function handlerBorderOpacity([, a = "", opacity]) {
|
|
@@ -172,15 +176,20 @@ function handlerBorderStyle([, a = "", s]) {
|
|
|
172
176
|
const opacity = [
|
|
173
177
|
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: h.bracket.percent.cssvar(d) })]
|
|
174
178
|
];
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
[/^text-(.+)$/, colorResolver("color", "text", "textColor", (css) => !css.color?.toString().match(numberWithUnitRE)), { autocomplete: "text-$colors" }],
|
|
179
|
-
[/^(?:text|color|c)-(.+)$/, ([, v]) => globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${globalKeywords.join("|")})` }],
|
|
180
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
|
|
181
|
-
];
|
|
179
|
+
const bgUrlRE = /^\[url\(.+\)\]$/;
|
|
180
|
+
const bgLengthRE = /^\[length:.+\]$/;
|
|
181
|
+
const bgPositionRE = /^\[position:.+\]$/;
|
|
182
182
|
const bgColors = [
|
|
183
|
-
[/^bg-(.+)$/, (...args) =>
|
|
183
|
+
[/^bg-(.+)$/, (...args) => {
|
|
184
|
+
const d = args[0][1];
|
|
185
|
+
if (bgUrlRE.test(d))
|
|
186
|
+
return { "--un-url": h.bracket(d), "background-image": "var(--un-url)" };
|
|
187
|
+
if (bgLengthRE.test(d) && h.bracketOfLength(d) != null)
|
|
188
|
+
return { "background-size": h.bracketOfLength(d).split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
189
|
+
if ((isSize(d) || bgPositionRE.test(d)) && h.bracketOfPosition(d) != null)
|
|
190
|
+
return { "background-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
191
|
+
return colorResolver("background-color", "bg", "backgroundColor")(...args);
|
|
192
|
+
}],
|
|
184
193
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
|
|
185
194
|
];
|
|
186
195
|
const colorScheme = [
|
|
@@ -201,18 +210,10 @@ const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...glob
|
|
|
201
210
|
const textDecorations = [
|
|
202
211
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
203
212
|
// size
|
|
204
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/,
|
|
213
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, handleWidth$1, { autocomplete: "(underline|decoration)-<num>" }],
|
|
205
214
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
|
|
206
215
|
// colors
|
|
207
|
-
[/^(?:underline|decoration)-(.+)$/,
|
|
208
|
-
const result = colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
|
|
209
|
-
if (result) {
|
|
210
|
-
return {
|
|
211
|
-
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
212
|
-
...result
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
216
|
+
[/^(?:underline|decoration)-(.+)$/, handleColorOrWidth$1, { autocomplete: "(underline|decoration)-$colors" }],
|
|
216
217
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
217
218
|
// offset
|
|
218
219
|
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? h.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
@@ -222,6 +223,20 @@ const textDecorations = [
|
|
|
222
223
|
["no-underline", { "text-decoration": "none" }],
|
|
223
224
|
["decoration-none", { "text-decoration": "none" }]
|
|
224
225
|
];
|
|
226
|
+
function handleWidth$1([, b], { theme }) {
|
|
227
|
+
return { "text-decoration-thickness": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
|
|
228
|
+
}
|
|
229
|
+
function handleColorOrWidth$1(match, ctx) {
|
|
230
|
+
if (isCSSMathFn(h.bracket(match[1])))
|
|
231
|
+
return handleWidth$1(match, ctx);
|
|
232
|
+
const result = colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
|
|
233
|
+
if (result) {
|
|
234
|
+
return {
|
|
235
|
+
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
236
|
+
...result
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
225
240
|
|
|
226
241
|
const transitionPropertyGroup = {
|
|
227
242
|
all: "all",
|
|
@@ -304,48 +319,19 @@ const flex = [
|
|
|
304
319
|
["flex-nowrap", { "flex-wrap": "nowrap" }]
|
|
305
320
|
];
|
|
306
321
|
|
|
307
|
-
function handleThemeByKey(s, theme, key) {
|
|
308
|
-
return theme[key]?.[s] || h.bracket.cssvar.global.rem(s);
|
|
309
|
-
}
|
|
310
322
|
const fonts = [
|
|
311
|
-
//
|
|
312
|
-
[
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
...height
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
return {
|
|
327
|
-
"font-size": fontSize2,
|
|
328
|
-
"line-height": lineHeight ?? height ?? "1",
|
|
329
|
-
"letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
const fontSize = h.bracketOfLength.rem(size);
|
|
333
|
-
if (lineHeight && fontSize) {
|
|
334
|
-
return {
|
|
335
|
-
"font-size": fontSize,
|
|
336
|
-
"line-height": lineHeight
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
return { "font-size": h.bracketOfLength.rem(s) };
|
|
340
|
-
},
|
|
341
|
-
{ autocomplete: "text-$fontSize" }
|
|
342
|
-
],
|
|
343
|
-
[/^(?:text|font)-size-(.+)$/, ([, s], { theme }) => {
|
|
344
|
-
const themed = toArray(theme.fontSize?.[s]);
|
|
345
|
-
const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
|
|
346
|
-
if (size != null)
|
|
347
|
-
return { "font-size": size };
|
|
348
|
-
}, { autocomplete: "text-size-$fontSize" }],
|
|
323
|
+
// text
|
|
324
|
+
[/^text-(.+)$/, handleText, { autocomplete: "text-$fontSize" }],
|
|
325
|
+
// text size
|
|
326
|
+
[/^(?:text|font)-size-(.+)$/, handleSize, { autocomplete: "text-size-$fontSize" }],
|
|
327
|
+
// text colors
|
|
328
|
+
[/^text-(?:color-)?(.+)$/, handlerColorOrSize, { autocomplete: "text-$colors" }],
|
|
329
|
+
// colors
|
|
330
|
+
[/^(?:color|c)-(.+)$/, colorResolver("color", "text", "textColor"), { autocomplete: "(color|c)-$colors" }],
|
|
331
|
+
// style
|
|
332
|
+
[/^(?:text|color|c)-(.+)$/, ([, v]) => globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${globalKeywords.join("|")})` }],
|
|
333
|
+
// opacity
|
|
334
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }],
|
|
349
335
|
// weights
|
|
350
336
|
[
|
|
351
337
|
/^(?:font|fw)-?([^-]+)$/,
|
|
@@ -425,6 +411,50 @@ const textShadows = [
|
|
|
425
411
|
[/^text-shadow-color-(.+)$/, colorResolver("--un-text-shadow-color", "text-shadow", "shadowColor"), { autocomplete: "text-shadow-color-$colors" }],
|
|
426
412
|
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
|
|
427
413
|
];
|
|
414
|
+
function handleThemeByKey(s, theme, key) {
|
|
415
|
+
return theme[key]?.[s] || h.bracket.cssvar.global.rem(s);
|
|
416
|
+
}
|
|
417
|
+
function handleSize([, s], { theme }) {
|
|
418
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
419
|
+
const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
|
|
420
|
+
if (size != null)
|
|
421
|
+
return { "font-size": size };
|
|
422
|
+
}
|
|
423
|
+
function handlerColorOrSize(match, ctx) {
|
|
424
|
+
if (isCSSMathFn(h.bracket(match[1])))
|
|
425
|
+
return handleSize(match, ctx);
|
|
426
|
+
return colorResolver("color", "text", "textColor")(match, ctx);
|
|
427
|
+
}
|
|
428
|
+
function handleText([, s = "base"], { theme }) {
|
|
429
|
+
const split = splitShorthand(s, "length");
|
|
430
|
+
if (!split)
|
|
431
|
+
return;
|
|
432
|
+
const [size, leading] = split;
|
|
433
|
+
const sizePairs = toArray(theme.fontSize?.[size]);
|
|
434
|
+
const lineHeight = leading ? handleThemeByKey(leading, theme, "lineHeight") : void 0;
|
|
435
|
+
if (sizePairs?.[0]) {
|
|
436
|
+
const [fontSize2, height, letterSpacing] = sizePairs;
|
|
437
|
+
if (typeof height === "object") {
|
|
438
|
+
return {
|
|
439
|
+
"font-size": fontSize2,
|
|
440
|
+
...height
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
"font-size": fontSize2,
|
|
445
|
+
"line-height": lineHeight ?? height ?? "1",
|
|
446
|
+
"letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
const fontSize = h.bracketOfLength.rem(size);
|
|
450
|
+
if (lineHeight && fontSize) {
|
|
451
|
+
return {
|
|
452
|
+
"font-size": fontSize,
|
|
453
|
+
"line-height": lineHeight
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
return { "font-size": h.bracketOfLength.rem(s) };
|
|
457
|
+
}
|
|
428
458
|
|
|
429
459
|
const directions = {
|
|
430
460
|
"": "",
|
|
@@ -781,7 +811,7 @@ const cssProperty = [
|
|
|
781
811
|
return;
|
|
782
812
|
const [prop, ...rest] = body.split(":");
|
|
783
813
|
const value = rest.join(":");
|
|
784
|
-
if (!isURI(body) &&
|
|
814
|
+
if (!isURI(body) && /^[a-z-]+$/.test(prop) && isValidCSSBody(value)) {
|
|
785
815
|
let parsed;
|
|
786
816
|
if (hasThemeFn(value))
|
|
787
817
|
parsed = transformThemeFn(value, theme);
|
|
@@ -844,12 +874,12 @@ const svgUtilities = [
|
|
|
844
874
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
|
|
845
875
|
["fill-none", { fill: "none" }],
|
|
846
876
|
// stroke size
|
|
847
|
-
[/^stroke-(?:width-|size-)?(.+)$/,
|
|
877
|
+
[/^stroke-(?:width-|size-)?(.+)$/, handleWidth, { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
|
|
848
878
|
// stroke dash
|
|
849
879
|
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
|
|
850
880
|
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? h.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
|
|
851
881
|
// stroke colors
|
|
852
|
-
[/^stroke-(.+)$/,
|
|
882
|
+
[/^stroke-(.+)$/, handleColorOrWidth, { autocomplete: "stroke-$colors" }],
|
|
853
883
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
|
|
854
884
|
// line cap
|
|
855
885
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -864,6 +894,14 @@ const svgUtilities = [
|
|
|
864
894
|
// none
|
|
865
895
|
["stroke-none", { stroke: "none" }]
|
|
866
896
|
];
|
|
897
|
+
function handleWidth([, b], { theme }) {
|
|
898
|
+
return { "stroke-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.fraction.px.number(b) };
|
|
899
|
+
}
|
|
900
|
+
function handleColorOrWidth(match, ctx) {
|
|
901
|
+
if (isCSSMathFn(h.bracket(match[1])))
|
|
902
|
+
return handleWidth(match, ctx);
|
|
903
|
+
return colorResolver("stroke", "stroke", "borderColor")(match, ctx);
|
|
904
|
+
}
|
|
867
905
|
|
|
868
906
|
const rules = [
|
|
869
907
|
cssVariables,
|
|
@@ -887,7 +925,6 @@ const rules = [
|
|
|
887
925
|
textShadows,
|
|
888
926
|
textTransforms,
|
|
889
927
|
textAligns,
|
|
890
|
-
textColors,
|
|
891
928
|
fontStyles,
|
|
892
929
|
fontSmoothings,
|
|
893
930
|
boxShadows,
|
|
@@ -928,4 +965,4 @@ const rules = [
|
|
|
928
965
|
questionMark
|
|
929
966
|
].flat(1);
|
|
930
967
|
|
|
931
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns,
|
|
968
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, textWraps, transforms, transitions, userSelects, verticalAligns, whitespaces, willChange, zIndexes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h,
|
|
1
|
+
import { h, makeGlobalStaticRules, globalKeywords, colorResolver, isCSSMathFn, hasParseableColor, colorableShadows, positionMap, xyzMap } from '../utils.mjs';
|
|
2
2
|
|
|
3
3
|
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"];
|
|
4
4
|
const containValues = ["none", "strict", "content", "size", "inline-size", "layout", "style", "paint"];
|
|
@@ -82,7 +82,8 @@ const breaks = [
|
|
|
82
82
|
const textWraps = [
|
|
83
83
|
["text-wrap", { "text-wrap": "wrap" }],
|
|
84
84
|
["text-nowrap", { "text-wrap": "nowrap" }],
|
|
85
|
-
["text-balance", { "text-wrap": "balance" }]
|
|
85
|
+
["text-balance", { "text-wrap": "balance" }],
|
|
86
|
+
["text-pretty", { "text-wrap": "pretty" }]
|
|
86
87
|
];
|
|
87
88
|
const textOverflows = [
|
|
88
89
|
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
@@ -127,7 +128,7 @@ const ringBase = {
|
|
|
127
128
|
"--un-shadow": "0 0 rgb(0 0 0 / 0)"
|
|
128
129
|
};
|
|
129
130
|
const rings = [
|
|
130
|
-
//
|
|
131
|
+
// ring
|
|
131
132
|
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
132
133
|
const value = theme.ringWidth?.[d || "DEFAULT"] ?? h.px(d || "1");
|
|
133
134
|
if (value) {
|
|
@@ -139,12 +140,13 @@ const rings = [
|
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
}, { autocomplete: "ring-$ringWidth" }],
|
|
142
|
-
|
|
143
|
+
// size
|
|
144
|
+
[/^ring-(?:width-|size-)(.+)$/, handleWidth, { autocomplete: "ring-(width|size)-$lineWidth" }],
|
|
143
145
|
// offset size
|
|
144
146
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
145
147
|
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
|
|
146
148
|
// colors
|
|
147
|
-
[/^ring-(.+)$/,
|
|
149
|
+
[/^ring-(.+)$/, handleColorOrWidth, { autocomplete: "ring-$colors" }],
|
|
148
150
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
|
|
149
151
|
// offset color
|
|
150
152
|
[/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
|
|
@@ -152,6 +154,14 @@ const rings = [
|
|
|
152
154
|
// style
|
|
153
155
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
154
156
|
];
|
|
157
|
+
function handleWidth([, b], { theme }) {
|
|
158
|
+
return { "--un-ring-width": theme.ringWidth?.[b] ?? h.bracket.cssvar.px(b) };
|
|
159
|
+
}
|
|
160
|
+
function handleColorOrWidth(match, ctx) {
|
|
161
|
+
if (isCSSMathFn(h.bracket(match[1])))
|
|
162
|
+
return handleWidth(match, ctx);
|
|
163
|
+
return colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
|
|
164
|
+
}
|
|
155
165
|
|
|
156
166
|
const boxShadowsBase = {
|
|
157
167
|
"--un-ring-offset-shadow": "0 0 rgb(0 0 0 / 0)",
|
|
@@ -13,7 +13,7 @@ type ThemeColorKeys = 'colors' | 'borderColor' | 'backgroundColor' | 'textColor'
|
|
|
13
13
|
/**
|
|
14
14
|
* Split utility shorthand delimited by / or :
|
|
15
15
|
*/
|
|
16
|
-
declare function splitShorthand(body: string, type: string): string[];
|
|
16
|
+
declare function splitShorthand(body: string, type: string): string[] | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
|
|
19
19
|
* See also color.tests.ts for more examples.
|
|
@@ -52,6 +52,7 @@ declare function parseColor(body: string, theme: Theme, key?: ThemeColorKeys): P
|
|
|
52
52
|
*
|
|
53
53
|
* @param property - Property for the css value to be created.
|
|
54
54
|
* @param varName - Base name for the opacity variable.
|
|
55
|
+
* @param [key] - Theme key to select the color from.
|
|
55
56
|
* @param [shouldPass] - Function to decide whether to pass the css.
|
|
56
57
|
* @return object.
|
|
57
58
|
*/
|
|
@@ -67,7 +68,7 @@ declare function resolveVerticalBreakpoints(context: Readonly<VariantContext<The
|
|
|
67
68
|
size: string;
|
|
68
69
|
}[] | undefined;
|
|
69
70
|
declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
|
|
70
|
-
declare function isCSSMathFn(value: string): boolean;
|
|
71
|
+
declare function isCSSMathFn(value: string | undefined): boolean;
|
|
71
72
|
declare function isSize(str: string): boolean;
|
|
72
73
|
|
|
73
74
|
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, isSize as e, hasParseableColor as h, isCSSMathFn as i, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
|
|
@@ -13,7 +13,7 @@ type ThemeColorKeys = 'colors' | 'borderColor' | 'backgroundColor' | 'textColor'
|
|
|
13
13
|
/**
|
|
14
14
|
* Split utility shorthand delimited by / or :
|
|
15
15
|
*/
|
|
16
|
-
declare function splitShorthand(body: string, type: string): string[];
|
|
16
|
+
declare function splitShorthand(body: string, type: string): string[] | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
|
|
19
19
|
* See also color.tests.ts for more examples.
|
|
@@ -52,6 +52,7 @@ declare function parseColor(body: string, theme: Theme, key?: ThemeColorKeys): P
|
|
|
52
52
|
*
|
|
53
53
|
* @param property - Property for the css value to be created.
|
|
54
54
|
* @param varName - Base name for the opacity variable.
|
|
55
|
+
* @param [key] - Theme key to select the color from.
|
|
55
56
|
* @param [shouldPass] - Function to decide whether to pass the css.
|
|
56
57
|
* @return object.
|
|
57
58
|
*/
|
|
@@ -67,7 +68,7 @@ declare function resolveVerticalBreakpoints(context: Readonly<VariantContext<The
|
|
|
67
68
|
size: string;
|
|
68
69
|
}[] | undefined;
|
|
69
70
|
declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
|
|
70
|
-
declare function isCSSMathFn(value: string): boolean;
|
|
71
|
+
declare function isCSSMathFn(value: string | undefined): boolean;
|
|
71
72
|
declare function isSize(str: string): boolean;
|
|
72
73
|
|
|
73
74
|
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, isSize as e, hasParseableColor as h, isCSSMathFn as i, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const utils = require('
|
|
3
|
+
const utils = require('../utils.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"];
|
|
@@ -84,7 +84,8 @@ const breaks = [
|
|
|
84
84
|
const textWraps = [
|
|
85
85
|
["text-wrap", { "text-wrap": "wrap" }],
|
|
86
86
|
["text-nowrap", { "text-wrap": "nowrap" }],
|
|
87
|
-
["text-balance", { "text-wrap": "balance" }]
|
|
87
|
+
["text-balance", { "text-wrap": "balance" }],
|
|
88
|
+
["text-pretty", { "text-wrap": "pretty" }]
|
|
88
89
|
];
|
|
89
90
|
const textOverflows = [
|
|
90
91
|
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
@@ -129,7 +130,7 @@ const ringBase = {
|
|
|
129
130
|
"--un-shadow": "0 0 rgb(0 0 0 / 0)"
|
|
130
131
|
};
|
|
131
132
|
const rings = [
|
|
132
|
-
//
|
|
133
|
+
// ring
|
|
133
134
|
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
134
135
|
const value = theme.ringWidth?.[d || "DEFAULT"] ?? utils.h.px(d || "1");
|
|
135
136
|
if (value) {
|
|
@@ -141,12 +142,13 @@ const rings = [
|
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
144
|
}, { autocomplete: "ring-$ringWidth" }],
|
|
144
|
-
|
|
145
|
+
// size
|
|
146
|
+
[/^ring-(?:width-|size-)(.+)$/, handleWidth, { autocomplete: "ring-(width|size)-$lineWidth" }],
|
|
145
147
|
// offset size
|
|
146
148
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
147
149
|
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
|
|
148
150
|
// colors
|
|
149
|
-
[/^ring-(.+)$/,
|
|
151
|
+
[/^ring-(.+)$/, handleColorOrWidth, { autocomplete: "ring-$colors" }],
|
|
150
152
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
|
|
151
153
|
// offset color
|
|
152
154
|
[/^ring-offset-(.+)$/, utils.colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"), { autocomplete: "ring-offset-$colors" }],
|
|
@@ -154,6 +156,14 @@ const rings = [
|
|
|
154
156
|
// style
|
|
155
157
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
156
158
|
];
|
|
159
|
+
function handleWidth([, b], { theme }) {
|
|
160
|
+
return { "--un-ring-width": theme.ringWidth?.[b] ?? utils.h.bracket.cssvar.px(b) };
|
|
161
|
+
}
|
|
162
|
+
function handleColorOrWidth(match, ctx) {
|
|
163
|
+
if (utils.isCSSMathFn(utils.h.bracket(match[1])))
|
|
164
|
+
return handleWidth(match, ctx);
|
|
165
|
+
return utils.colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
|
|
166
|
+
}
|
|
157
167
|
|
|
158
168
|
const boxShadowsBase = {
|
|
159
169
|
"--un-ring-offset-shadow": "0 0 rgb(0 0 0 / 0)",
|
|
@@ -13,7 +13,7 @@ type ThemeColorKeys = 'colors' | 'borderColor' | 'backgroundColor' | 'textColor'
|
|
|
13
13
|
/**
|
|
14
14
|
* Split utility shorthand delimited by / or :
|
|
15
15
|
*/
|
|
16
|
-
declare function splitShorthand(body: string, type: string): string[];
|
|
16
|
+
declare function splitShorthand(body: string, type: string): string[] | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
|
|
19
19
|
* See also color.tests.ts for more examples.
|
|
@@ -52,6 +52,7 @@ declare function parseColor(body: string, theme: Theme, key?: ThemeColorKeys): P
|
|
|
52
52
|
*
|
|
53
53
|
* @param property - Property for the css value to be created.
|
|
54
54
|
* @param varName - Base name for the opacity variable.
|
|
55
|
+
* @param [key] - Theme key to select the color from.
|
|
55
56
|
* @param [shouldPass] - Function to decide whether to pass the css.
|
|
56
57
|
* @return object.
|
|
57
58
|
*/
|
|
@@ -67,7 +68,7 @@ declare function resolveVerticalBreakpoints(context: Readonly<VariantContext<The
|
|
|
67
68
|
size: string;
|
|
68
69
|
}[] | undefined;
|
|
69
70
|
declare function makeGlobalStaticRules(prefix: string, property?: string): StaticRule[];
|
|
70
|
-
declare function isCSSMathFn(value: string): boolean;
|
|
71
|
+
declare function isCSSMathFn(value: string | undefined): boolean;
|
|
71
72
|
declare function isSize(str: string): boolean;
|
|
72
73
|
|
|
73
74
|
export { CONTROL_MINI_NO_NEGATIVE as C, colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, isSize as e, hasParseableColor as h, isCSSMathFn as i, makeGlobalStaticRules as m, parseColor as p, resolveBreakpoints as r, splitShorthand as s };
|
package/dist/theme.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const colors = require('./colors.cjs');
|
|
4
|
-
const transform = require('./shared/preset-mini.
|
|
5
|
-
require('./
|
|
4
|
+
const transform = require('./shared/preset-mini.qLxuqSG-.cjs');
|
|
5
|
+
require('./utils.cjs');
|
|
6
6
|
require('@unocss/rule-utils');
|
|
7
7
|
require('@unocss/core');
|
|
8
8
|
|
package/dist/theme.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colors } from './colors.mjs';
|
|
2
|
-
import { t as transformBase, b as boxShadowsBase, r as ringBase } from './shared/preset-mini.
|
|
3
|
-
import './
|
|
2
|
+
import { t as transformBase, b as boxShadowsBase, r as ringBase } from './shared/preset-mini.5jRPR_fm.mjs';
|
|
3
|
+
import './utils.mjs';
|
|
4
4
|
import '@unocss/rule-utils';
|
|
5
5
|
import '@unocss/core';
|
|
6
6
|
|