@unocss/preset-mini 0.35.1 → 0.35.4
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/default2.cjs +8 -6
- package/dist/chunks/default2.mjs +9 -7
- package/dist/chunks/default3.cjs +17 -9
- package/dist/chunks/default3.mjs +18 -10
- package/dist/chunks/utilities.cjs +104 -90
- package/dist/chunks/utilities.mjs +104 -91
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +7 -3
- package/dist/utils.mjs +1 -1
- package/package.json +14 -14
package/dist/chunks/default2.cjs
CHANGED
|
@@ -19,14 +19,14 @@ const verticalAlignAlias = {
|
|
|
19
19
|
const verticalAligns = [
|
|
20
20
|
[/^(?:vertical|align|v)-(.+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
|
|
21
21
|
];
|
|
22
|
-
const textAligns = ["center", "left", "right", "justify", "start", "end",
|
|
22
|
+
const textAligns = ["center", "left", "right", "justify", "start", "end", ...utilities.globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
|
|
23
23
|
|
|
24
24
|
const outline = [
|
|
25
25
|
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
|
|
26
26
|
[/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
|
|
27
27
|
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
28
28
|
["outline", { "outline-style": "solid" }],
|
|
29
|
-
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset",
|
|
29
|
+
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...utilities.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
30
30
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
31
31
|
];
|
|
32
32
|
const appearance = [
|
|
@@ -45,7 +45,7 @@ const willChange = [
|
|
|
45
45
|
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
46
46
|
];
|
|
47
47
|
|
|
48
|
-
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset",
|
|
48
|
+
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...utilities.globalKeywords];
|
|
49
49
|
const borders = [
|
|
50
50
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
|
|
51
51
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
@@ -195,7 +195,7 @@ const transitions = [
|
|
|
195
195
|
[
|
|
196
196
|
/^(?:transition-)?property-(.+)$/,
|
|
197
197
|
([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) }),
|
|
198
|
-
{ autocomplete: [`transition-property-(${[
|
|
198
|
+
{ autocomplete: [`transition-property-(${[...utilities.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
|
|
199
199
|
],
|
|
200
200
|
["transition-none", { transition: "none" }]
|
|
201
201
|
];
|
|
@@ -374,7 +374,7 @@ const grids = [
|
|
|
374
374
|
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: utilities.handler.bracket.cssvar(v) ?? v })],
|
|
375
375
|
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
|
|
376
376
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": utilities.handler.bracket.cssvar(v) })],
|
|
377
|
-
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(
|
|
377
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
378
378
|
[/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
|
|
379
379
|
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? utilities.handler.bracket.cssvar(v)
|
|
380
380
|
})],
|
|
@@ -907,6 +907,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
907
907
|
]
|
|
908
908
|
];
|
|
909
909
|
|
|
910
|
+
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...utilities.globalKeywords];
|
|
910
911
|
const textDecorations = [
|
|
911
912
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
912
913
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
|
|
@@ -922,7 +923,8 @@ const textDecorations = [
|
|
|
922
923
|
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
923
924
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
924
925
|
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utilities.handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
925
|
-
|
|
926
|
+
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
927
|
+
...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
|
|
926
928
|
["no-underline", { "text-decoration": "none" }],
|
|
927
929
|
["decoration-none", { "text-decoration": "none" }]
|
|
928
930
|
];
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints,
|
|
1
|
+
import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints, j as resolveBreakpoints, k as directionSize, C as CONTROL_MINI_NO_NEGATIVE, l as positionMap, x as xyzMap } from './utilities.mjs';
|
|
2
2
|
import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
|
|
3
3
|
|
|
4
4
|
const verticalAlignAlias = {
|
|
@@ -17,14 +17,14 @@ const verticalAlignAlias = {
|
|
|
17
17
|
const verticalAligns = [
|
|
18
18
|
[/^(?:vertical|align|v)-(.+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
|
|
19
19
|
];
|
|
20
|
-
const textAligns = ["center", "left", "right", "justify", "start", "end",
|
|
20
|
+
const textAligns = ["center", "left", "right", "justify", "start", "end", ...globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
|
|
21
21
|
|
|
22
22
|
const outline = [
|
|
23
23
|
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
|
|
24
24
|
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
|
|
25
25
|
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
26
26
|
["outline", { "outline-style": "solid" }],
|
|
27
|
-
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset",
|
|
27
|
+
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
28
28
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
29
29
|
];
|
|
30
30
|
const appearance = [
|
|
@@ -43,7 +43,7 @@ const willChange = [
|
|
|
43
43
|
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
44
44
|
];
|
|
45
45
|
|
|
46
|
-
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset",
|
|
46
|
+
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords];
|
|
47
47
|
const borders = [
|
|
48
48
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
|
|
49
49
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
@@ -193,7 +193,7 @@ const transitions = [
|
|
|
193
193
|
[
|
|
194
194
|
/^(?:transition-)?property-(.+)$/,
|
|
195
195
|
([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) }),
|
|
196
|
-
{ autocomplete: [`transition-property-(${[
|
|
196
|
+
{ autocomplete: [`transition-property-(${[...globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
|
|
197
197
|
],
|
|
198
198
|
["transition-none", { transition: "none" }]
|
|
199
199
|
];
|
|
@@ -372,7 +372,7 @@ const grids = [
|
|
|
372
372
|
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
|
|
373
373
|
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
|
|
374
374
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
|
|
375
|
-
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(
|
|
375
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
376
376
|
[/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
|
|
377
377
|
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? handler.bracket.cssvar(v)
|
|
378
378
|
})],
|
|
@@ -905,6 +905,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
905
905
|
]
|
|
906
906
|
];
|
|
907
907
|
|
|
908
|
+
const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...globalKeywords];
|
|
908
909
|
const textDecorations = [
|
|
909
910
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
910
911
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
|
|
@@ -920,7 +921,8 @@ const textDecorations = [
|
|
|
920
921
|
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
921
922
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
922
923
|
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
923
|
-
|
|
924
|
+
...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
|
|
925
|
+
...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
|
|
924
926
|
["no-underline", { "text-decoration": "none" }],
|
|
925
927
|
["decoration-none", { "text-decoration": "none" }]
|
|
926
928
|
];
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -240,7 +240,10 @@ const PseudoClasses = Object.fromEntries([
|
|
|
240
240
|
["selection", "::selection"],
|
|
241
241
|
["marker", "::marker"],
|
|
242
242
|
["file", "::file-selector-button"]
|
|
243
|
-
].map((key) =>
|
|
243
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
244
|
+
const PseudoClassesColon = Object.fromEntries([
|
|
245
|
+
["backdrop", "::backdrop"]
|
|
246
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
244
247
|
const PseudoClassFunctions = [
|
|
245
248
|
"not",
|
|
246
249
|
"is",
|
|
@@ -248,20 +251,22 @@ const PseudoClassFunctions = [
|
|
|
248
251
|
"has"
|
|
249
252
|
];
|
|
250
253
|
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
254
|
+
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
251
255
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
252
256
|
const sortValue = (pseudo) => {
|
|
253
257
|
if (pseudo === "active")
|
|
254
258
|
return 1;
|
|
255
259
|
};
|
|
256
260
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
257
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
258
261
|
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
262
|
+
const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
263
|
+
const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
|
|
259
264
|
return {
|
|
260
265
|
name: `pseudo:${tag}`,
|
|
261
266
|
match(input) {
|
|
262
|
-
const match = input.match(
|
|
267
|
+
const match = input.match(pseudoRE) || input.match(pseudoColonRE);
|
|
263
268
|
if (match) {
|
|
264
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
269
|
+
let pseudo = PseudoClasses[match[3]] || PseudoClassesColon[match[3]] || `:${match[3]}`;
|
|
265
270
|
if (match[2])
|
|
266
271
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
267
272
|
return {
|
|
@@ -274,13 +279,15 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
274
279
|
};
|
|
275
280
|
};
|
|
276
281
|
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
282
|
+
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).join("|");
|
|
277
283
|
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
284
|
+
const PseudoClassesAndElementsColonRE = new RegExp(`^(${PseudoClassesAndElementsColonStr})[:]`);
|
|
278
285
|
const variantPseudoClassesAndElements = {
|
|
279
286
|
name: "pseudo",
|
|
280
287
|
match: (input) => {
|
|
281
|
-
const match = input.match(PseudoClassesAndElementsRE);
|
|
288
|
+
const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
|
|
282
289
|
if (match) {
|
|
283
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
290
|
+
const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
|
|
284
291
|
return {
|
|
285
292
|
matcher: input.slice(match[0].length),
|
|
286
293
|
selector: (s) => `${s}${pseudo}`,
|
|
@@ -292,12 +299,13 @@ const variantPseudoClassesAndElements = {
|
|
|
292
299
|
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
293
300
|
};
|
|
294
301
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
302
|
+
const PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})[:]`);
|
|
295
303
|
const variantPseudoClassFunctions = {
|
|
296
304
|
match: (input) => {
|
|
297
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
305
|
+
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE);
|
|
298
306
|
if (match) {
|
|
299
307
|
const fn = match[1];
|
|
300
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
308
|
+
const pseudo = PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
301
309
|
return {
|
|
302
310
|
matcher: input.slice(match[0].length),
|
|
303
311
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -305,7 +313,7 @@ const variantPseudoClassFunctions = {
|
|
|
305
313
|
}
|
|
306
314
|
},
|
|
307
315
|
multiPass: true,
|
|
308
|
-
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
|
|
316
|
+
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}|${PseudoClassesColonStr}):`
|
|
309
317
|
};
|
|
310
318
|
const variantTaggedPseudoClasses = (options = {}) => {
|
|
311
319
|
const attributify = !!options?.attributifyPseudo;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE } from './utilities.mjs';
|
|
2
2
|
import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
|
|
3
3
|
import { escapeRegExp } from '@unocss/core';
|
|
4
4
|
|
|
@@ -238,7 +238,10 @@ const PseudoClasses = Object.fromEntries([
|
|
|
238
238
|
["selection", "::selection"],
|
|
239
239
|
["marker", "::marker"],
|
|
240
240
|
["file", "::file-selector-button"]
|
|
241
|
-
].map((key) =>
|
|
241
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
242
|
+
const PseudoClassesColon = Object.fromEntries([
|
|
243
|
+
["backdrop", "::backdrop"]
|
|
244
|
+
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
242
245
|
const PseudoClassFunctions = [
|
|
243
246
|
"not",
|
|
244
247
|
"is",
|
|
@@ -246,20 +249,22 @@ const PseudoClassFunctions = [
|
|
|
246
249
|
"has"
|
|
247
250
|
];
|
|
248
251
|
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
252
|
+
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
249
253
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
250
254
|
const sortValue = (pseudo) => {
|
|
251
255
|
if (pseudo === "active")
|
|
252
256
|
return 1;
|
|
253
257
|
};
|
|
254
258
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
255
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
256
259
|
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
260
|
+
const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
261
|
+
const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
|
|
257
262
|
return {
|
|
258
263
|
name: `pseudo:${tag}`,
|
|
259
264
|
match(input) {
|
|
260
|
-
const match = input.match(
|
|
265
|
+
const match = input.match(pseudoRE) || input.match(pseudoColonRE);
|
|
261
266
|
if (match) {
|
|
262
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
267
|
+
let pseudo = PseudoClasses[match[3]] || PseudoClassesColon[match[3]] || `:${match[3]}`;
|
|
263
268
|
if (match[2])
|
|
264
269
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
265
270
|
return {
|
|
@@ -272,13 +277,15 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
272
277
|
};
|
|
273
278
|
};
|
|
274
279
|
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
280
|
+
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).join("|");
|
|
275
281
|
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
282
|
+
const PseudoClassesAndElementsColonRE = new RegExp(`^(${PseudoClassesAndElementsColonStr})[:]`);
|
|
276
283
|
const variantPseudoClassesAndElements = {
|
|
277
284
|
name: "pseudo",
|
|
278
285
|
match: (input) => {
|
|
279
|
-
const match = input.match(PseudoClassesAndElementsRE);
|
|
286
|
+
const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
|
|
280
287
|
if (match) {
|
|
281
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
288
|
+
const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
|
|
282
289
|
return {
|
|
283
290
|
matcher: input.slice(match[0].length),
|
|
284
291
|
selector: (s) => `${s}${pseudo}`,
|
|
@@ -290,12 +297,13 @@ const variantPseudoClassesAndElements = {
|
|
|
290
297
|
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
291
298
|
};
|
|
292
299
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
300
|
+
const PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})[:]`);
|
|
293
301
|
const variantPseudoClassFunctions = {
|
|
294
302
|
match: (input) => {
|
|
295
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
303
|
+
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE);
|
|
296
304
|
if (match) {
|
|
297
305
|
const fn = match[1];
|
|
298
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
306
|
+
const pseudo = PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
299
307
|
return {
|
|
300
308
|
matcher: input.slice(match[0].length),
|
|
301
309
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -303,7 +311,7 @@ const variantPseudoClassFunctions = {
|
|
|
303
311
|
}
|
|
304
312
|
},
|
|
305
313
|
multiPass: true,
|
|
306
|
-
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}):`
|
|
314
|
+
autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}|${PseudoClassesColonStr}):`
|
|
307
315
|
};
|
|
308
316
|
const variantTaggedPseudoClasses = (options = {}) => {
|
|
309
317
|
const attributify = !!options?.attributifyPseudo;
|
|
@@ -2,6 +2,100 @@
|
|
|
2
2
|
|
|
3
3
|
const core = require('@unocss/core');
|
|
4
4
|
|
|
5
|
+
const directionMap = {
|
|
6
|
+
"l": ["-left"],
|
|
7
|
+
"r": ["-right"],
|
|
8
|
+
"t": ["-top"],
|
|
9
|
+
"b": ["-bottom"],
|
|
10
|
+
"s": ["-inline-start"],
|
|
11
|
+
"e": ["-inline-end"],
|
|
12
|
+
"x": ["-left", "-right"],
|
|
13
|
+
"y": ["-top", "-bottom"],
|
|
14
|
+
"": [""],
|
|
15
|
+
"bs": ["-block-start"],
|
|
16
|
+
"be": ["-block-end"],
|
|
17
|
+
"is": ["-inline-start"],
|
|
18
|
+
"ie": ["-inline-end"],
|
|
19
|
+
"block": ["-block-start", "-block-end"],
|
|
20
|
+
"inline": ["-inline-start", "-inline-end"]
|
|
21
|
+
};
|
|
22
|
+
const insetMap = {
|
|
23
|
+
...directionMap,
|
|
24
|
+
s: ["-inset-inline-start"],
|
|
25
|
+
e: ["-inset-inline-end"],
|
|
26
|
+
bs: ["-inset-block-start"],
|
|
27
|
+
be: ["-inset-block-end"],
|
|
28
|
+
is: ["-inset-inline-start"],
|
|
29
|
+
ie: ["-inset-inline-end"],
|
|
30
|
+
block: ["-inset-block-start", "-inset-block-end"],
|
|
31
|
+
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
32
|
+
};
|
|
33
|
+
const cornerMap = {
|
|
34
|
+
"l": ["-top-left", "-bottom-left"],
|
|
35
|
+
"r": ["-top-right", "-bottom-right"],
|
|
36
|
+
"t": ["-top-left", "-top-right"],
|
|
37
|
+
"b": ["-bottom-left", "-bottom-right"],
|
|
38
|
+
"tl": ["-top-left"],
|
|
39
|
+
"lt": ["-top-left"],
|
|
40
|
+
"tr": ["-top-right"],
|
|
41
|
+
"rt": ["-top-right"],
|
|
42
|
+
"bl": ["-bottom-left"],
|
|
43
|
+
"lb": ["-bottom-left"],
|
|
44
|
+
"br": ["-bottom-right"],
|
|
45
|
+
"rb": ["-bottom-right"],
|
|
46
|
+
"": [""],
|
|
47
|
+
"bs": ["-start-start", "-start-end"],
|
|
48
|
+
"be": ["-end-start", "-end-end"],
|
|
49
|
+
"is": ["-end-start", "-start-start"],
|
|
50
|
+
"ie": ["-start-end", "-end-end"],
|
|
51
|
+
"bs-is": ["-start-start"],
|
|
52
|
+
"is-bs": ["-start-start"],
|
|
53
|
+
"bs-ie": ["-start-end"],
|
|
54
|
+
"ie-bs": ["-start-end"],
|
|
55
|
+
"be-is": ["-end-start"],
|
|
56
|
+
"is-be": ["-end-start"],
|
|
57
|
+
"be-ie": ["-end-end"],
|
|
58
|
+
"ie-be": ["-end-end"]
|
|
59
|
+
};
|
|
60
|
+
const xyzMap = {
|
|
61
|
+
"x": ["-x"],
|
|
62
|
+
"y": ["-y"],
|
|
63
|
+
"z": ["-z"],
|
|
64
|
+
"": ["-x", "-y"]
|
|
65
|
+
};
|
|
66
|
+
const basePositionMap = [
|
|
67
|
+
"top",
|
|
68
|
+
"top center",
|
|
69
|
+
"top left",
|
|
70
|
+
"top right",
|
|
71
|
+
"bottom",
|
|
72
|
+
"bottom center",
|
|
73
|
+
"bottom left",
|
|
74
|
+
"bottom right",
|
|
75
|
+
"left",
|
|
76
|
+
"left center",
|
|
77
|
+
"left top",
|
|
78
|
+
"left bottom",
|
|
79
|
+
"right",
|
|
80
|
+
"right center",
|
|
81
|
+
"right top",
|
|
82
|
+
"right bottom",
|
|
83
|
+
"center",
|
|
84
|
+
"center top",
|
|
85
|
+
"center bottom",
|
|
86
|
+
"center left",
|
|
87
|
+
"center right",
|
|
88
|
+
"center center"
|
|
89
|
+
];
|
|
90
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
91
|
+
const globalKeywords = [
|
|
92
|
+
"inherit",
|
|
93
|
+
"initial",
|
|
94
|
+
"revert",
|
|
95
|
+
"revert-layer",
|
|
96
|
+
"unset"
|
|
97
|
+
];
|
|
98
|
+
|
|
5
99
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
6
100
|
function hex2rgba(hex = "") {
|
|
7
101
|
const color = parseHexColor(hex);
|
|
@@ -221,93 +315,6 @@ function getComponents(str, separator, limit) {
|
|
|
221
315
|
return components;
|
|
222
316
|
}
|
|
223
317
|
|
|
224
|
-
const directionMap = {
|
|
225
|
-
"l": ["-left"],
|
|
226
|
-
"r": ["-right"],
|
|
227
|
-
"t": ["-top"],
|
|
228
|
-
"b": ["-bottom"],
|
|
229
|
-
"s": ["-inline-start"],
|
|
230
|
-
"e": ["-inline-end"],
|
|
231
|
-
"x": ["-left", "-right"],
|
|
232
|
-
"y": ["-top", "-bottom"],
|
|
233
|
-
"": [""],
|
|
234
|
-
"bs": ["-block-start"],
|
|
235
|
-
"be": ["-block-end"],
|
|
236
|
-
"is": ["-inline-start"],
|
|
237
|
-
"ie": ["-inline-end"],
|
|
238
|
-
"block": ["-block-start", "-block-end"],
|
|
239
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
240
|
-
};
|
|
241
|
-
const insetMap = {
|
|
242
|
-
...directionMap,
|
|
243
|
-
s: ["-inset-inline-start"],
|
|
244
|
-
e: ["-inset-inline-end"],
|
|
245
|
-
bs: ["-inset-block-start"],
|
|
246
|
-
be: ["-inset-block-end"],
|
|
247
|
-
is: ["-inset-inline-start"],
|
|
248
|
-
ie: ["-inset-inline-end"],
|
|
249
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
250
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
251
|
-
};
|
|
252
|
-
const cornerMap = {
|
|
253
|
-
"l": ["-top-left", "-bottom-left"],
|
|
254
|
-
"r": ["-top-right", "-bottom-right"],
|
|
255
|
-
"t": ["-top-left", "-top-right"],
|
|
256
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
257
|
-
"tl": ["-top-left"],
|
|
258
|
-
"lt": ["-top-left"],
|
|
259
|
-
"tr": ["-top-right"],
|
|
260
|
-
"rt": ["-top-right"],
|
|
261
|
-
"bl": ["-bottom-left"],
|
|
262
|
-
"lb": ["-bottom-left"],
|
|
263
|
-
"br": ["-bottom-right"],
|
|
264
|
-
"rb": ["-bottom-right"],
|
|
265
|
-
"": [""],
|
|
266
|
-
"bs": ["-start-start", "-start-end"],
|
|
267
|
-
"be": ["-end-start", "-end-end"],
|
|
268
|
-
"is": ["-end-start", "-start-start"],
|
|
269
|
-
"ie": ["-start-end", "-end-end"],
|
|
270
|
-
"bs-is": ["-start-start"],
|
|
271
|
-
"is-bs": ["-start-start"],
|
|
272
|
-
"bs-ie": ["-start-end"],
|
|
273
|
-
"ie-bs": ["-start-end"],
|
|
274
|
-
"be-is": ["-end-start"],
|
|
275
|
-
"is-be": ["-end-start"],
|
|
276
|
-
"be-ie": ["-end-end"],
|
|
277
|
-
"ie-be": ["-end-end"]
|
|
278
|
-
};
|
|
279
|
-
const xyzMap = {
|
|
280
|
-
"x": ["-x"],
|
|
281
|
-
"y": ["-y"],
|
|
282
|
-
"z": ["-z"],
|
|
283
|
-
"": ["-x", "-y"]
|
|
284
|
-
};
|
|
285
|
-
const basePositionMap = [
|
|
286
|
-
"top",
|
|
287
|
-
"top center",
|
|
288
|
-
"top left",
|
|
289
|
-
"top right",
|
|
290
|
-
"bottom",
|
|
291
|
-
"bottom center",
|
|
292
|
-
"bottom left",
|
|
293
|
-
"bottom right",
|
|
294
|
-
"left",
|
|
295
|
-
"left center",
|
|
296
|
-
"left top",
|
|
297
|
-
"left bottom",
|
|
298
|
-
"right",
|
|
299
|
-
"right center",
|
|
300
|
-
"right top",
|
|
301
|
-
"right bottom",
|
|
302
|
-
"center",
|
|
303
|
-
"center top",
|
|
304
|
-
"center bottom",
|
|
305
|
-
"center left",
|
|
306
|
-
"center right",
|
|
307
|
-
"center center"
|
|
308
|
-
];
|
|
309
|
-
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
310
|
-
|
|
311
318
|
const cssProps = [
|
|
312
319
|
"color",
|
|
313
320
|
"border-color",
|
|
@@ -424,10 +431,11 @@ function fraction(str) {
|
|
|
424
431
|
if (!Number.isNaN(num))
|
|
425
432
|
return `${round(num * 100)}%`;
|
|
426
433
|
}
|
|
434
|
+
const bracketTypeRe = /^\[(color|length|position):/i;
|
|
427
435
|
function bracketWithType(str, type) {
|
|
428
436
|
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
429
437
|
let base;
|
|
430
|
-
const match = str.match(
|
|
438
|
+
const match = str.match(bracketTypeRe);
|
|
431
439
|
if (!match)
|
|
432
440
|
base = str.slice(1, -1);
|
|
433
441
|
else if (type && match[1] === type)
|
|
@@ -474,13 +482,17 @@ function degree(str) {
|
|
|
474
482
|
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
475
483
|
}
|
|
476
484
|
function global(str) {
|
|
477
|
-
if (
|
|
485
|
+
if (globalKeywords.includes(str))
|
|
478
486
|
return str;
|
|
479
487
|
}
|
|
480
488
|
function properties(str) {
|
|
481
489
|
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
482
490
|
return str;
|
|
483
491
|
}
|
|
492
|
+
function position(str) {
|
|
493
|
+
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
494
|
+
return str;
|
|
495
|
+
}
|
|
484
496
|
|
|
485
497
|
const valueHandlers = {
|
|
486
498
|
__proto__: null,
|
|
@@ -499,7 +511,8 @@ const valueHandlers = {
|
|
|
499
511
|
time: time,
|
|
500
512
|
degree: degree,
|
|
501
513
|
global: global,
|
|
502
|
-
properties: properties
|
|
514
|
+
properties: properties,
|
|
515
|
+
position: position
|
|
503
516
|
};
|
|
504
517
|
|
|
505
518
|
const handler = core.createValueHandler(valueHandlers);
|
|
@@ -627,6 +640,7 @@ exports.cornerMap = cornerMap;
|
|
|
627
640
|
exports.directionMap = directionMap;
|
|
628
641
|
exports.directionSize = directionSize;
|
|
629
642
|
exports.getComponents = getComponents;
|
|
643
|
+
exports.globalKeywords = globalKeywords;
|
|
630
644
|
exports.h = h;
|
|
631
645
|
exports.handler = handler;
|
|
632
646
|
exports.hasParseableColor = hasParseableColor;
|
|
@@ -1,5 +1,99 @@
|
|
|
1
1
|
import { escapeSelector, createValueHandler, toArray } from '@unocss/core';
|
|
2
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
|
+
|
|
3
97
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
4
98
|
function hex2rgba(hex = "") {
|
|
5
99
|
const color = parseHexColor(hex);
|
|
@@ -219,93 +313,6 @@ function getComponents(str, separator, limit) {
|
|
|
219
313
|
return components;
|
|
220
314
|
}
|
|
221
315
|
|
|
222
|
-
const directionMap = {
|
|
223
|
-
"l": ["-left"],
|
|
224
|
-
"r": ["-right"],
|
|
225
|
-
"t": ["-top"],
|
|
226
|
-
"b": ["-bottom"],
|
|
227
|
-
"s": ["-inline-start"],
|
|
228
|
-
"e": ["-inline-end"],
|
|
229
|
-
"x": ["-left", "-right"],
|
|
230
|
-
"y": ["-top", "-bottom"],
|
|
231
|
-
"": [""],
|
|
232
|
-
"bs": ["-block-start"],
|
|
233
|
-
"be": ["-block-end"],
|
|
234
|
-
"is": ["-inline-start"],
|
|
235
|
-
"ie": ["-inline-end"],
|
|
236
|
-
"block": ["-block-start", "-block-end"],
|
|
237
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
238
|
-
};
|
|
239
|
-
const insetMap = {
|
|
240
|
-
...directionMap,
|
|
241
|
-
s: ["-inset-inline-start"],
|
|
242
|
-
e: ["-inset-inline-end"],
|
|
243
|
-
bs: ["-inset-block-start"],
|
|
244
|
-
be: ["-inset-block-end"],
|
|
245
|
-
is: ["-inset-inline-start"],
|
|
246
|
-
ie: ["-inset-inline-end"],
|
|
247
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
248
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
249
|
-
};
|
|
250
|
-
const cornerMap = {
|
|
251
|
-
"l": ["-top-left", "-bottom-left"],
|
|
252
|
-
"r": ["-top-right", "-bottom-right"],
|
|
253
|
-
"t": ["-top-left", "-top-right"],
|
|
254
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
255
|
-
"tl": ["-top-left"],
|
|
256
|
-
"lt": ["-top-left"],
|
|
257
|
-
"tr": ["-top-right"],
|
|
258
|
-
"rt": ["-top-right"],
|
|
259
|
-
"bl": ["-bottom-left"],
|
|
260
|
-
"lb": ["-bottom-left"],
|
|
261
|
-
"br": ["-bottom-right"],
|
|
262
|
-
"rb": ["-bottom-right"],
|
|
263
|
-
"": [""],
|
|
264
|
-
"bs": ["-start-start", "-start-end"],
|
|
265
|
-
"be": ["-end-start", "-end-end"],
|
|
266
|
-
"is": ["-end-start", "-start-start"],
|
|
267
|
-
"ie": ["-start-end", "-end-end"],
|
|
268
|
-
"bs-is": ["-start-start"],
|
|
269
|
-
"is-bs": ["-start-start"],
|
|
270
|
-
"bs-ie": ["-start-end"],
|
|
271
|
-
"ie-bs": ["-start-end"],
|
|
272
|
-
"be-is": ["-end-start"],
|
|
273
|
-
"is-be": ["-end-start"],
|
|
274
|
-
"be-ie": ["-end-end"],
|
|
275
|
-
"ie-be": ["-end-end"]
|
|
276
|
-
};
|
|
277
|
-
const xyzMap = {
|
|
278
|
-
"x": ["-x"],
|
|
279
|
-
"y": ["-y"],
|
|
280
|
-
"z": ["-z"],
|
|
281
|
-
"": ["-x", "-y"]
|
|
282
|
-
};
|
|
283
|
-
const basePositionMap = [
|
|
284
|
-
"top",
|
|
285
|
-
"top center",
|
|
286
|
-
"top left",
|
|
287
|
-
"top right",
|
|
288
|
-
"bottom",
|
|
289
|
-
"bottom center",
|
|
290
|
-
"bottom left",
|
|
291
|
-
"bottom right",
|
|
292
|
-
"left",
|
|
293
|
-
"left center",
|
|
294
|
-
"left top",
|
|
295
|
-
"left bottom",
|
|
296
|
-
"right",
|
|
297
|
-
"right center",
|
|
298
|
-
"right top",
|
|
299
|
-
"right bottom",
|
|
300
|
-
"center",
|
|
301
|
-
"center top",
|
|
302
|
-
"center bottom",
|
|
303
|
-
"center left",
|
|
304
|
-
"center right",
|
|
305
|
-
"center center"
|
|
306
|
-
];
|
|
307
|
-
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
308
|
-
|
|
309
316
|
const cssProps = [
|
|
310
317
|
"color",
|
|
311
318
|
"border-color",
|
|
@@ -422,10 +429,11 @@ function fraction(str) {
|
|
|
422
429
|
if (!Number.isNaN(num))
|
|
423
430
|
return `${round(num * 100)}%`;
|
|
424
431
|
}
|
|
432
|
+
const bracketTypeRe = /^\[(color|length|position):/i;
|
|
425
433
|
function bracketWithType(str, type) {
|
|
426
434
|
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
427
435
|
let base;
|
|
428
|
-
const match = str.match(
|
|
436
|
+
const match = str.match(bracketTypeRe);
|
|
429
437
|
if (!match)
|
|
430
438
|
base = str.slice(1, -1);
|
|
431
439
|
else if (type && match[1] === type)
|
|
@@ -472,13 +480,17 @@ function degree(str) {
|
|
|
472
480
|
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
473
481
|
}
|
|
474
482
|
function global(str) {
|
|
475
|
-
if (
|
|
483
|
+
if (globalKeywords.includes(str))
|
|
476
484
|
return str;
|
|
477
485
|
}
|
|
478
486
|
function properties(str) {
|
|
479
487
|
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
480
488
|
return str;
|
|
481
489
|
}
|
|
490
|
+
function position(str) {
|
|
491
|
+
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
492
|
+
return str;
|
|
493
|
+
}
|
|
482
494
|
|
|
483
495
|
const valueHandlers = {
|
|
484
496
|
__proto__: null,
|
|
@@ -497,7 +509,8 @@ const valueHandlers = {
|
|
|
497
509
|
time: time,
|
|
498
510
|
degree: degree,
|
|
499
511
|
global: global,
|
|
500
|
-
properties: properties
|
|
512
|
+
properties: properties,
|
|
513
|
+
position: position
|
|
501
514
|
};
|
|
502
515
|
|
|
503
516
|
const handler = createValueHandler(valueHandlers);
|
|
@@ -617,4 +630,4 @@ const resolveVerticalBreakpoints = ({ theme, generator }) => {
|
|
|
617
630
|
return verticalBreakpoints;
|
|
618
631
|
};
|
|
619
632
|
|
|
620
|
-
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f,
|
|
633
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f, globalKeywords as g, handler as h, insetMap as i, resolveBreakpoints as j, directionSize as k, positionMap as l, hex2rgba as m, parseCssColor as n, getComponents as o, parseColor as p, h as q, resolveVerticalBreakpoints as r, valueHandlers as v, xyzMap as x };
|
package/dist/utils.cjs
CHANGED
|
@@ -16,6 +16,7 @@ exports.cornerMap = utilities.cornerMap;
|
|
|
16
16
|
exports.directionMap = utilities.directionMap;
|
|
17
17
|
exports.directionSize = utilities.directionSize;
|
|
18
18
|
exports.getComponents = utilities.getComponents;
|
|
19
|
+
exports.globalKeywords = utilities.globalKeywords;
|
|
19
20
|
exports.h = utilities.h;
|
|
20
21
|
exports.handler = utilities.handler;
|
|
21
22
|
exports.hasParseableColor = utilities.hasParseableColor;
|
package/dist/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare const insetMap: Record<string, string[]>;
|
|
|
13
13
|
declare const cornerMap: Record<string, string[]>;
|
|
14
14
|
declare const xyzMap: Record<string, string[]>;
|
|
15
15
|
declare const positionMap: Record<string, string>;
|
|
16
|
+
declare const globalKeywords: string[];
|
|
16
17
|
|
|
17
18
|
declare function numberWithUnit(str: string): string | undefined;
|
|
18
19
|
declare function auto(str: string): "auto" | undefined;
|
|
@@ -30,6 +31,7 @@ declare function time(str: string): string | undefined;
|
|
|
30
31
|
declare function degree(str: string): string | undefined;
|
|
31
32
|
declare function global(str: string): string | undefined;
|
|
32
33
|
declare function properties(str: string): string | undefined;
|
|
34
|
+
declare function position(str: string): string | undefined;
|
|
33
35
|
|
|
34
36
|
declare const handlers_numberWithUnit: typeof numberWithUnit;
|
|
35
37
|
declare const handlers_auto: typeof auto;
|
|
@@ -47,6 +49,7 @@ declare const handlers_time: typeof time;
|
|
|
47
49
|
declare const handlers_degree: typeof degree;
|
|
48
50
|
declare const handlers_global: typeof global;
|
|
49
51
|
declare const handlers_properties: typeof properties;
|
|
52
|
+
declare const handlers_position: typeof position;
|
|
50
53
|
declare namespace handlers {
|
|
51
54
|
export {
|
|
52
55
|
handlers_numberWithUnit as numberWithUnit,
|
|
@@ -65,13 +68,14 @@ declare namespace handlers {
|
|
|
65
68
|
handlers_degree as degree,
|
|
66
69
|
handlers_global as global,
|
|
67
70
|
handlers_properties as properties,
|
|
71
|
+
handlers_position as position,
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
declare const handler: _unocss_core.ValueHandler<"number" | "global" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
|
|
72
|
-
declare const h: _unocss_core.ValueHandler<"number" | "global" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
|
|
75
|
+
declare const handler: _unocss_core.ValueHandler<"number" | "global" | "auto" | "position" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
|
|
76
|
+
declare const h: _unocss_core.ValueHandler<"number" | "global" | "auto" | "position" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "bracketOfColor" | "bracketOfLength" | "bracketOfPosition" | "cssvar" | "time" | "degree" | "properties">;
|
|
73
77
|
|
|
74
78
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => VariantObject;
|
|
75
79
|
declare const variantParentMatcher: (name: string, parent: string) => VariantObject;
|
|
76
80
|
|
|
77
|
-
export { colorToString, cornerMap, directionMap, getComponents, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
|
81
|
+
export { colorToString, cornerMap, directionMap, getComponents, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap,
|
|
1
|
+
export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, k as directionSize, o as getComponents, g as globalKeywords, q as h, h as handler, a as hasParseableColor, m as hex2rgba, i as insetMap, p as parseColor, n as parseCssColor, l as positionMap, j as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
2
|
export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.4",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,33 +22,33 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"require": "./dist/index.cjs",
|
|
26
|
+
"import": "./dist/index.mjs"
|
|
27
27
|
},
|
|
28
28
|
"./theme": {
|
|
29
29
|
"types": "./dist/theme.d.ts",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"require": "./dist/theme.cjs",
|
|
31
|
+
"import": "./dist/theme.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./variants": {
|
|
34
34
|
"types": "./dist/variants.d.ts",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"require": "./dist/variants.cjs",
|
|
36
|
+
"import": "./dist/variants.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./rules": {
|
|
39
39
|
"types": "./dist/rules.d.ts",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"require": "./dist/rules.cjs",
|
|
41
|
+
"import": "./dist/rules.mjs"
|
|
42
42
|
},
|
|
43
43
|
"./colors": {
|
|
44
44
|
"types": "./dist/colors.d.ts",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"require": "./dist/colors.cjs",
|
|
46
|
+
"import": "./dist/colors.mjs"
|
|
47
47
|
},
|
|
48
48
|
"./utils": {
|
|
49
49
|
"types": "./dist/utils.d.ts",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"require": "./dist/utils.cjs",
|
|
51
|
+
"import": "./dist/utils.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./*": "./*"
|
|
54
54
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.35.
|
|
64
|
+
"@unocss/core": "0.35.4"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|