@unocss/preset-mini 66.3.1 → 66.3.3
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.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { entriesToCss, toArray, definePreset } from '@unocss/core';
|
|
|
2
2
|
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
|
|
3
3
|
import { g as globalKeywords } from './shared/preset-mini.DrfPDgwn.mjs';
|
|
4
4
|
export { k as parseColor } from './shared/preset-mini.DrfPDgwn.mjs';
|
|
5
|
-
import { i as variants } from './shared/preset-mini.
|
|
5
|
+
import { i as variants } from './shared/preset-mini.DbGR1fYK.mjs';
|
|
6
6
|
import { r as rules } from './shared/preset-mini.BbFVnwVO.mjs';
|
|
7
7
|
import { t as theme } from './shared/preset-mini.BsxsSmTL.mjs';
|
|
8
8
|
export { colors } from './colors.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { escapeSelector, escapeRegExp, toArray } from '@unocss/core';
|
|
1
2
|
import { variantGetParameter, calcMaxWidthBySize, variantMatcher, variantGetBracket, variantParentMatcher, getBracket, hasThemeFn, transformThemeFn, getStringComponent, createPartClasses, createPseudoClassesAndElements, createPseudoClassFunctions, createTaggedPseudoClasses } from '@unocss/rule-utils';
|
|
2
3
|
import { a as h, r as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE, e as cssMathFnRE, f as cssVarFnRE } from './preset-mini.DrfPDgwn.mjs';
|
|
3
|
-
import { toArray } from '@unocss/core';
|
|
4
4
|
|
|
5
5
|
const variantAria = {
|
|
6
6
|
name: "aria",
|
|
@@ -19,30 +19,87 @@ const variantAria = {
|
|
|
19
19
|
},
|
|
20
20
|
multiPass: true
|
|
21
21
|
};
|
|
22
|
-
function taggedAria(tagName) {
|
|
22
|
+
function taggedAria(tagName, combinator, options = {}) {
|
|
23
23
|
return {
|
|
24
24
|
name: `${tagName}-aria`,
|
|
25
25
|
match(matcher, ctx) {
|
|
26
26
|
const variant = variantGetParameter(`${tagName}-aria-`, matcher, ctx.generator.config.separators);
|
|
27
|
+
if (variant) {
|
|
28
|
+
const [match, rest, label] = variant;
|
|
29
|
+
const ariaAttribute = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
|
|
30
|
+
if (ariaAttribute) {
|
|
31
|
+
const attributify = !!options?.attributifyPseudo;
|
|
32
|
+
let firstPrefix = options?.prefix ?? "";
|
|
33
|
+
firstPrefix = (Array.isArray(firstPrefix) ? firstPrefix : [firstPrefix]).filter(Boolean)[0] ?? "";
|
|
34
|
+
const parent = `${attributify ? `[${firstPrefix}${tagName}=""]` : `.${firstPrefix}${tagName}`}`;
|
|
35
|
+
const escapedLabel = escapeSelector(label ? `/${label}` : "");
|
|
36
|
+
return {
|
|
37
|
+
matcher: rest,
|
|
38
|
+
handle: (input, next) => {
|
|
39
|
+
const regexp = new RegExp(`${escapeRegExp(parent)}${escapeRegExp(escapedLabel)}(?:\\[.+?\\])+`);
|
|
40
|
+
const match2 = input.prefix.match(regexp);
|
|
41
|
+
let nextPrefix;
|
|
42
|
+
if (match2) {
|
|
43
|
+
const insertIndex = (match2.index ?? 0) + parent.length + escapedLabel.length;
|
|
44
|
+
nextPrefix = [
|
|
45
|
+
input.prefix.slice(0, insertIndex),
|
|
46
|
+
`[aria-${ariaAttribute}]`,
|
|
47
|
+
input.prefix.slice(insertIndex)
|
|
48
|
+
].join("");
|
|
49
|
+
} else {
|
|
50
|
+
const prefixGroupIndex = Math.max(input.prefix.indexOf(parent), 0);
|
|
51
|
+
nextPrefix = [
|
|
52
|
+
input.prefix.slice(0, prefixGroupIndex),
|
|
53
|
+
parent,
|
|
54
|
+
escapedLabel,
|
|
55
|
+
`[aria-${ariaAttribute}]`,
|
|
56
|
+
combinator,
|
|
57
|
+
input.prefix.slice(prefixGroupIndex)
|
|
58
|
+
].join("");
|
|
59
|
+
}
|
|
60
|
+
return next({
|
|
61
|
+
...input,
|
|
62
|
+
prefix: nextPrefix
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
multiPass: true
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function taggedHasAria() {
|
|
73
|
+
return {
|
|
74
|
+
name: "has-aria",
|
|
75
|
+
match(matcher, ctx) {
|
|
76
|
+
const variant = variantGetParameter("has-aria-", matcher, ctx.generator.config.separators);
|
|
27
77
|
if (variant) {
|
|
28
78
|
const [match, rest] = variant;
|
|
29
79
|
const ariaAttribute = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
|
|
30
80
|
if (ariaAttribute) {
|
|
31
81
|
return {
|
|
32
|
-
matcher:
|
|
82
|
+
matcher: rest,
|
|
83
|
+
handle: (input, next) => next({
|
|
84
|
+
...input,
|
|
85
|
+
pseudo: `${input.pseudo}:has([aria-${ariaAttribute}])`
|
|
86
|
+
})
|
|
33
87
|
};
|
|
34
88
|
}
|
|
35
89
|
}
|
|
36
|
-
}
|
|
90
|
+
},
|
|
91
|
+
multiPass: true
|
|
37
92
|
};
|
|
38
93
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
94
|
+
function variantTaggedAriaAttributes(options = {}) {
|
|
95
|
+
return [
|
|
96
|
+
taggedAria("group", " ", options),
|
|
97
|
+
taggedAria("peer", "~", options),
|
|
98
|
+
taggedAria("parent", ">", options),
|
|
99
|
+
taggedAria("previous", "+", options),
|
|
100
|
+
taggedHasAria()
|
|
101
|
+
];
|
|
102
|
+
}
|
|
46
103
|
|
|
47
104
|
const sizePseudo = /(max|min)-\[([^\]]*)\]:/;
|
|
48
105
|
function variantBreakpoints() {
|
|
@@ -218,7 +275,7 @@ const variantDataAttribute = {
|
|
|
218
275
|
},
|
|
219
276
|
multiPass: true
|
|
220
277
|
};
|
|
221
|
-
function taggedData(tagName) {
|
|
278
|
+
function taggedData(tagName, combinator, options = {}) {
|
|
222
279
|
return {
|
|
223
280
|
name: `${tagName}-data`,
|
|
224
281
|
match(matcher, ctx) {
|
|
@@ -227,21 +284,78 @@ function taggedData(tagName) {
|
|
|
227
284
|
const [match, rest, label] = variant;
|
|
228
285
|
const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
|
|
229
286
|
if (dataAttribute) {
|
|
287
|
+
const attributify = !!options?.attributifyPseudo;
|
|
288
|
+
let firstPrefix = options?.prefix ?? "";
|
|
289
|
+
firstPrefix = (Array.isArray(firstPrefix) ? firstPrefix : [firstPrefix]).filter(Boolean)[0] ?? "";
|
|
290
|
+
const parent = `${attributify ? `[${firstPrefix}${tagName}=""]` : `.${firstPrefix}${tagName}`}`;
|
|
291
|
+
const escapedLabel = escapeSelector(label ? `/${label}` : "");
|
|
230
292
|
return {
|
|
231
|
-
matcher:
|
|
293
|
+
matcher: rest,
|
|
294
|
+
handle: (input, next) => {
|
|
295
|
+
const regexp = new RegExp(`${escapeRegExp(parent)}${escapeRegExp(escapedLabel)}(?:\\[.+?\\])+`);
|
|
296
|
+
const match2 = input.prefix.match(regexp);
|
|
297
|
+
let nextPrefix;
|
|
298
|
+
if (match2) {
|
|
299
|
+
const insertIndex = (match2.index ?? 0) + parent.length + escapedLabel.length;
|
|
300
|
+
nextPrefix = [
|
|
301
|
+
input.prefix.slice(0, insertIndex),
|
|
302
|
+
`[data-${dataAttribute}]`,
|
|
303
|
+
input.prefix.slice(insertIndex)
|
|
304
|
+
].join("");
|
|
305
|
+
} else {
|
|
306
|
+
const prefixGroupIndex = Math.max(input.prefix.indexOf(parent), 0);
|
|
307
|
+
nextPrefix = [
|
|
308
|
+
input.prefix.slice(0, prefixGroupIndex),
|
|
309
|
+
parent,
|
|
310
|
+
escapedLabel,
|
|
311
|
+
`[data-${dataAttribute}]`,
|
|
312
|
+
combinator,
|
|
313
|
+
input.prefix.slice(prefixGroupIndex)
|
|
314
|
+
].join("");
|
|
315
|
+
}
|
|
316
|
+
return next({
|
|
317
|
+
...input,
|
|
318
|
+
prefix: nextPrefix
|
|
319
|
+
});
|
|
320
|
+
}
|
|
232
321
|
};
|
|
233
322
|
}
|
|
234
323
|
}
|
|
235
|
-
}
|
|
324
|
+
},
|
|
325
|
+
multiPass: true
|
|
236
326
|
};
|
|
237
327
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
];
|
|
328
|
+
function taggedHasData() {
|
|
329
|
+
return {
|
|
330
|
+
name: "has-data",
|
|
331
|
+
match(matcher, ctx) {
|
|
332
|
+
const variant = variantGetParameter("has-data-", matcher, ctx.generator.config.separators);
|
|
333
|
+
if (variant) {
|
|
334
|
+
const [match, rest] = variant;
|
|
335
|
+
const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
|
|
336
|
+
if (dataAttribute) {
|
|
337
|
+
return {
|
|
338
|
+
matcher: rest,
|
|
339
|
+
handle: (input, next) => next({
|
|
340
|
+
...input,
|
|
341
|
+
pseudo: `${input.pseudo}:has([data-${dataAttribute}])`
|
|
342
|
+
})
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
multiPass: true
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function variantTaggedDataAttributes(options = {}) {
|
|
351
|
+
return [
|
|
352
|
+
taggedData("group", " ", options),
|
|
353
|
+
taggedData("peer", "~", options),
|
|
354
|
+
taggedData("parent", ">", options),
|
|
355
|
+
taggedData("previous", "+", options),
|
|
356
|
+
taggedHasData()
|
|
357
|
+
];
|
|
358
|
+
}
|
|
245
359
|
|
|
246
360
|
const variantLanguageDirections = [
|
|
247
361
|
variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
|
|
@@ -570,8 +684,8 @@ function variants(options) {
|
|
|
570
684
|
...variantChildren,
|
|
571
685
|
variantContainerQuery,
|
|
572
686
|
variantVariables,
|
|
573
|
-
...variantTaggedDataAttributes,
|
|
574
|
-
...variantTaggedAriaAttributes,
|
|
687
|
+
...variantTaggedDataAttributes(options),
|
|
688
|
+
...variantTaggedAriaAttributes(options),
|
|
575
689
|
variantTheme
|
|
576
690
|
];
|
|
577
691
|
}
|
package/dist/variants.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import './shared/preset-mini.oF7XTPi1.mjs';
|
|
|
7
7
|
import '@unocss/rule-utils';
|
|
8
8
|
|
|
9
9
|
declare const variantAria: VariantObject;
|
|
10
|
-
declare
|
|
10
|
+
declare function variantTaggedAriaAttributes(options?: PresetMiniOptions): Variant[];
|
|
11
11
|
|
|
12
12
|
declare function variantBreakpoints(): VariantObject;
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ declare const variantContainerQuery: VariantObject;
|
|
|
20
20
|
declare function variantColorsMediaOrClass(options?: PresetMiniOptions): Variant[];
|
|
21
21
|
|
|
22
22
|
declare const variantDataAttribute: VariantObject;
|
|
23
|
-
declare
|
|
23
|
+
declare function variantTaggedDataAttributes(options?: PresetMiniOptions): Variant[];
|
|
24
24
|
|
|
25
25
|
declare function variants(options: PresetMiniOptions): Variant<Theme>[];
|
|
26
26
|
|
package/dist/variants.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import './shared/preset-mini.CRliz1QB.js';
|
|
|
7
7
|
import '@unocss/rule-utils';
|
|
8
8
|
|
|
9
9
|
declare const variantAria: VariantObject;
|
|
10
|
-
declare
|
|
10
|
+
declare function variantTaggedAriaAttributes(options?: PresetMiniOptions): Variant[];
|
|
11
11
|
|
|
12
12
|
declare function variantBreakpoints(): VariantObject;
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ declare const variantContainerQuery: VariantObject;
|
|
|
20
20
|
declare function variantColorsMediaOrClass(options?: PresetMiniOptions): Variant[];
|
|
21
21
|
|
|
22
22
|
declare const variantDataAttribute: VariantObject;
|
|
23
|
-
declare
|
|
23
|
+
declare function variantTaggedDataAttributes(options?: PresetMiniOptions): Variant[];
|
|
24
24
|
|
|
25
25
|
declare function variants(options: PresetMiniOptions): Variant<Theme>[];
|
|
26
26
|
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { v as variantAria, b as variantBreakpoints, c as variantChildren, f as variantColorsMediaOrClass, d as variantCombinators, e as variantContainerQuery, o as variantCssLayer, m as variantCustomMedia, g as variantDataAttribute, k as variantImportant, p as variantInternalLayer, j as variantLanguageDirections, t as variantNegative, y as variantPartClasses, l as variantPrint, w as variantPseudoClassFunctions, u as variantPseudoClassesAndElements, q as variantScope, n as variantSelector, z as variantStartingStyle, A as variantSupports, a as variantTaggedAriaAttributes, h as variantTaggedDataAttributes, x as variantTaggedPseudoClasses, s as variantTheme, r as variantVariables, i as variants } from './shared/preset-mini.
|
|
1
|
+
export { v as variantAria, b as variantBreakpoints, c as variantChildren, f as variantColorsMediaOrClass, d as variantCombinators, e as variantContainerQuery, o as variantCssLayer, m as variantCustomMedia, g as variantDataAttribute, k as variantImportant, p as variantInternalLayer, j as variantLanguageDirections, t as variantNegative, y as variantPartClasses, l as variantPrint, w as variantPseudoClassFunctions, u as variantPseudoClassesAndElements, q as variantScope, n as variantSelector, z as variantStartingStyle, A as variantSupports, a as variantTaggedAriaAttributes, h as variantTaggedDataAttributes, x as variantTaggedPseudoClasses, s as variantTheme, r as variantVariables, i as variants } from './shared/preset-mini.DbGR1fYK.mjs';
|
|
2
|
+
import '@unocss/core';
|
|
2
3
|
import '@unocss/rule-utils';
|
|
3
4
|
import './shared/preset-mini.DrfPDgwn.mjs';
|
|
4
|
-
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.3.
|
|
4
|
+
"version": "66.3.3",
|
|
5
5
|
"description": "The minimal preset for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"homepage": "https://unocss.dev",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/unocss/unocss",
|
|
12
|
+
"url": "git+https://github.com/unocss/unocss.git",
|
|
13
13
|
"directory": "packages-presets/preset-mini"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"dist"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@unocss/
|
|
60
|
-
"@unocss/
|
|
61
|
-
"@unocss/
|
|
59
|
+
"@unocss/extractor-arbitrary-variants": "66.3.3",
|
|
60
|
+
"@unocss/rule-utils": "66.3.3",
|
|
61
|
+
"@unocss/core": "66.3.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "unbuild",
|