@unocss/preset-mini 0.57.7 → 0.58.1

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.
Files changed (48) hide show
  1. package/dist/colors.d.cts +1 -1
  2. package/dist/colors.d.mts +1 -1
  3. package/dist/colors.d.ts +1 -1
  4. package/dist/index.cjs +12 -12
  5. package/dist/index.d.cts +6 -6
  6. package/dist/index.d.mts +6 -6
  7. package/dist/index.d.ts +6 -6
  8. package/dist/index.mjs +7 -7
  9. package/dist/rules.cjs +50 -972
  10. package/dist/rules.d.cts +2 -6
  11. package/dist/rules.d.mts +2 -6
  12. package/dist/rules.d.ts +2 -6
  13. package/dist/rules.mjs +5 -931
  14. package/dist/shared/{preset-mini.MACvs-wn.cjs → preset-mini.-3Qybdh5.cjs} +49 -39
  15. package/dist/shared/{preset-mini.Stl9mkMB.mjs → preset-mini.0CcynBZx.mjs} +45 -26
  16. package/dist/shared/{preset-mini.dPVVIvNm.mjs → preset-mini.0UJFjS_1.mjs} +16 -6
  17. package/dist/shared/{preset-mini.XmVozI6N.d.mts → preset-mini.20fUBpHS.d.cts} +4 -3
  18. package/dist/shared/{preset-mini.QW22c5Df.d.ts → preset-mini.8w2rXvMk.d.ts} +4 -3
  19. package/dist/shared/preset-mini.AVP8I7_j.mjs +747 -0
  20. package/dist/shared/preset-mini.ORVb5Lu8.mjs +978 -0
  21. package/dist/shared/{preset-mini.ImRm63ih.cjs → preset-mini.UhMMbd34.cjs} +44 -26
  22. package/dist/shared/{preset-mini.4DxDu2I8.d.mts → preset-mini.YxT4AwuI.d.cts} +1 -1
  23. package/dist/shared/preset-mini.fgwIVvur.cjs +322 -0
  24. package/dist/shared/preset-mini.g6cWGZM2.cjs +1021 -0
  25. package/dist/shared/{preset-mini.5daNC9yh.d.ts → preset-mini.gVNz4b9u.d.ts} +1 -1
  26. package/dist/shared/{preset-mini.7XoWRZIl.d.mts → preset-mini.hpPpX7ws.d.cts} +1 -1
  27. package/dist/shared/{preset-mini.7XoWRZIl.d.ts → preset-mini.hpPpX7ws.d.mts} +1 -1
  28. package/dist/shared/{preset-mini.7XoWRZIl.d.cts → preset-mini.hpPpX7ws.d.ts} +1 -1
  29. package/dist/shared/preset-mini.jXC5Sr98.cjs +772 -0
  30. package/dist/shared/{preset-mini.Jpc0QYPj.d.cts → preset-mini.nzD7Hw_0.d.mts} +4 -3
  31. package/dist/shared/{preset-mini.5-XKlNyK.d.cts → preset-mini.vMrmsD3H.d.mts} +1 -1
  32. package/dist/shared/preset-mini.zC_vZg74.mjs +291 -0
  33. package/dist/theme.cjs +34 -318
  34. package/dist/theme.d.cts +3 -3
  35. package/dist/theme.d.mts +3 -3
  36. package/dist/theme.d.ts +3 -3
  37. package/dist/theme.mjs +5 -293
  38. package/dist/utils.cjs +23 -23
  39. package/dist/utils.d.cts +4 -4
  40. package/dist/utils.d.mts +4 -4
  41. package/dist/utils.d.ts +4 -4
  42. package/dist/utils.mjs +1 -1
  43. package/dist/variants.cjs +31 -739
  44. package/dist/variants.d.cts +5 -5
  45. package/dist/variants.d.mts +5 -5
  46. package/dist/variants.d.ts +5 -5
  47. package/dist/variants.mjs +4 -716
  48. package/package.json +4 -4
package/dist/variants.cjs CHANGED
@@ -1,741 +1,33 @@
1
1
  'use strict';
2
2
 
3
- const ruleUtils = require('@unocss/rule-utils');
4
- const utils = require('./shared/preset-mini.ImRm63ih.cjs');
5
- const core = require('@unocss/core');
6
-
7
- const variantAria = {
8
- name: "aria",
9
- match(matcher, ctx) {
10
- const variant = ruleUtils.variantGetParameter("aria-", matcher, ctx.generator.config.separators);
11
- if (variant) {
12
- const [match, rest] = variant;
13
- const aria = utils.h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
14
- if (aria) {
15
- return {
16
- matcher: rest,
17
- selector: (s) => `${s}[aria-${aria}]`
18
- };
19
- }
20
- }
21
- }
22
- };
23
-
24
- function calcMaxWidthBySize(size) {
25
- const value = size.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
26
- const unit = size.slice(value.length);
27
- if (unit === "px") {
28
- const maxWidth = Number.parseFloat(value) - 0.1;
29
- return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
30
- }
31
- return `calc(${size} - 0.1px)`;
32
- }
33
- function variantBreakpoints() {
34
- const regexCache = {};
35
- return {
36
- name: "breakpoints",
37
- match(matcher, context) {
38
- const variantEntries = (utils.resolveBreakpoints(context) ?? []).map(({ point, size }, idx) => [point, size, idx]);
39
- for (const [point, size, idx] of variantEntries) {
40
- if (!regexCache[point])
41
- regexCache[point] = new RegExp(`^((?:([al]t-|[<~]|max-))?${point}(?:${context.generator.config.separators.join("|")}))`);
42
- const match = matcher.match(regexCache[point]);
43
- if (!match)
44
- continue;
45
- const [, pre] = match;
46
- const m = matcher.slice(pre.length);
47
- if (m === "container")
48
- continue;
49
- const isLtPrefix = pre.startsWith("lt-") || pre.startsWith("<") || pre.startsWith("max-");
50
- const isAtPrefix = pre.startsWith("at-") || pre.startsWith("~");
51
- let order = 1e3;
52
- if (isLtPrefix) {
53
- order -= idx + 1;
54
- return {
55
- matcher: m,
56
- handle: (input, next) => next({
57
- ...input,
58
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (max-width: ${calcMaxWidthBySize(size)})`,
59
- parentOrder: order
60
- })
61
- };
62
- }
63
- order += idx + 1;
64
- if (isAtPrefix && idx < variantEntries.length - 1) {
65
- return {
66
- matcher: m,
67
- handle: (input, next) => next({
68
- ...input,
69
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`,
70
- parentOrder: order
71
- })
72
- };
73
- }
74
- return {
75
- matcher: m,
76
- handle: (input, next) => next({
77
- ...input,
78
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size})`,
79
- parentOrder: order
80
- })
81
- };
82
- }
83
- },
84
- multiPass: true,
85
- autocomplete: "(at-|lt-|max-|)$breakpoints:"
86
- };
87
- }
88
-
89
- function scopeMatcher(name, combinator) {
90
- return {
91
- name: `combinator:${name}`,
92
- match(matcher, ctx) {
93
- if (!matcher.startsWith(name))
94
- return;
95
- const separators = ctx.generator.config.separators;
96
- let body = ruleUtils.variantGetBracket(`${name}-`, matcher, separators);
97
- if (!body) {
98
- for (const separator of separators) {
99
- if (matcher.startsWith(`${name}${separator}`)) {
100
- body = ["", matcher.slice(name.length + separator.length)];
101
- break;
102
- }
103
- }
104
- if (!body)
105
- return;
106
- }
107
- let bracketValue = utils.h.bracket(body[0]) ?? "";
108
- if (bracketValue === "")
109
- bracketValue = "*";
110
- return {
111
- matcher: body[1],
112
- selector: (s) => `${s}${combinator}${bracketValue}`
113
- };
114
- },
115
- multiPass: true
116
- };
117
- }
118
- const variantCombinators = [
119
- scopeMatcher("all", " "),
120
- scopeMatcher("children", ">"),
121
- scopeMatcher("next", "+"),
122
- scopeMatcher("sibling", "+"),
123
- scopeMatcher("siblings", "~")
124
- ];
125
-
126
- const variantContainerQuery = {
127
- name: "@",
128
- match(matcher, ctx) {
129
- if (matcher.startsWith("@container"))
130
- return;
131
- const variant = ruleUtils.variantGetParameter("@", matcher, ctx.generator.config.separators);
132
- if (variant) {
133
- const [match, rest, label] = variant;
134
- const unbracket = utils.h.bracket(match);
135
- let container;
136
- if (unbracket) {
137
- const minWidth = utils.h.numberWithUnit(unbracket);
138
- if (minWidth)
139
- container = `(min-width: ${minWidth})`;
140
- } else {
141
- container = ctx.theme.containers?.[match] ?? "";
142
- }
143
- if (container) {
144
- core.warnOnce("The container query variant is experimental and may not follow semver.");
145
- return {
146
- matcher: rest,
147
- handle: (input, next) => next({
148
- ...input,
149
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@container${label ? ` ${label} ` : " "}${container}`
150
- })
151
- };
152
- }
153
- }
154
- },
155
- multiPass: true
156
- };
157
-
158
- function variantColorsMediaOrClass(options = {}) {
159
- if (options?.dark === "class" || typeof options.dark === "object") {
160
- const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
161
- return [
162
- ruleUtils.variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
163
- ruleUtils.variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
164
- ];
165
- }
166
- return [
167
- ruleUtils.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
168
- ruleUtils.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
169
- ];
170
- }
171
-
172
- const variantDataAttribute = {
173
- name: "data",
174
- match(matcher, ctx) {
175
- const variant = ruleUtils.variantGetParameter("data-", matcher, ctx.generator.config.separators);
176
- if (variant) {
177
- const [match, rest] = variant;
178
- const dataAttribute = utils.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
179
- if (dataAttribute) {
180
- return {
181
- matcher: rest,
182
- selector: (s) => `${s}[data-${dataAttribute}]`
183
- };
184
- }
185
- }
186
- }
187
- };
188
- const variantGroupDataAttribute = {
189
- name: "group-data",
190
- match(matcher, ctx) {
191
- const variant = ruleUtils.variantGetParameter("group-data-", matcher, ctx.generator.config.separators);
192
- if (variant) {
193
- const [match, rest] = variant;
194
- const dataAttribute = utils.h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
195
- if (dataAttribute) {
196
- return {
197
- matcher: `group-[[data-${dataAttribute}]]:${rest}`
198
- };
199
- }
200
- }
201
- }
202
- };
203
-
204
- const variantLanguageDirections = [
205
- ruleUtils.variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
206
- ruleUtils.variantMatcher("ltr", (input) => ({ prefix: `[dir="ltr"] $$ ${input.prefix}` }))
207
- ];
208
-
209
- const variantSelector = {
210
- name: "selector",
211
- match(matcher, ctx) {
212
- const variant = ruleUtils.variantGetBracket("selector-", matcher, ctx.generator.config.separators);
213
- if (variant) {
214
- const [match, rest] = variant;
215
- const selector = utils.h.bracket(match);
216
- if (selector) {
217
- return {
218
- matcher: rest,
219
- selector: () => selector
220
- };
221
- }
222
- }
223
- }
224
- };
225
- const variantCssLayer = {
226
- name: "layer",
227
- match(matcher, ctx) {
228
- const variant = ruleUtils.variantGetParameter("layer-", matcher, ctx.generator.config.separators);
229
- if (variant) {
230
- const [match, rest] = variant;
231
- const layer = utils.h.bracket(match) ?? match;
232
- if (layer) {
233
- return {
234
- matcher: rest,
235
- handle: (input, next) => next({
236
- ...input,
237
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@layer ${layer}`
238
- })
239
- };
240
- }
241
- }
242
- }
243
- };
244
- const variantInternalLayer = {
245
- name: "uno-layer",
246
- match(matcher, ctx) {
247
- const variant = ruleUtils.variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
248
- if (variant) {
249
- const [match, rest] = variant;
250
- const layer = utils.h.bracket(match) ?? match;
251
- if (layer) {
252
- return {
253
- matcher: rest,
254
- layer
255
- };
256
- }
257
- }
258
- }
259
- };
260
- const variantScope = {
261
- name: "scope",
262
- match(matcher, ctx) {
263
- const variant = ruleUtils.variantGetBracket("scope-", matcher, ctx.generator.config.separators);
264
- if (variant) {
265
- const [match, rest] = variant;
266
- const scope = utils.h.bracket(match);
267
- if (scope) {
268
- return {
269
- matcher: rest,
270
- selector: (s) => `${scope} $$ ${s}`
271
- };
272
- }
273
- }
274
- }
275
- };
276
- const variantVariables = {
277
- name: "variables",
278
- match(matcher, ctx) {
279
- if (!matcher.startsWith("["))
280
- return;
281
- const [match, rest] = ruleUtils.getBracket(matcher, "[", "]") ?? [];
282
- if (!(match && rest))
283
- return;
284
- let newMatcher;
285
- for (const separator of ctx.generator.config.separators) {
286
- if (rest.startsWith(separator)) {
287
- newMatcher = rest.slice(separator.length);
288
- break;
289
- }
290
- }
291
- if (newMatcher == null)
292
- return;
293
- const variant = utils.h.bracket(match) ?? "";
294
- const useParent = variant.startsWith("@");
295
- if (!(useParent || variant.includes("&")))
296
- return;
297
- return {
298
- matcher: newMatcher,
299
- handle(input, next) {
300
- const updates = useParent ? {
301
- parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
302
- } : {
303
- selector: variant.replace(/&/g, input.selector)
304
- };
305
- return next({
306
- ...input,
307
- ...updates
308
- });
309
- }
310
- };
311
- },
312
- multiPass: true
313
- };
314
-
315
- const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
316
- const ignoreProps = [
317
- /opacity|color|flex/
318
- ];
319
- function negateFunctions(value) {
320
- const match = value.match(/^(calc|clamp|max|min)\s*(\(.*)/);
321
- if (match) {
322
- const [fnBody, rest] = ruleUtils.getStringComponent(match[2], "(", ")", " ") ?? [];
323
- if (fnBody)
324
- return `calc(${match[1]}${fnBody} * -1)${rest ? ` ${rest}` : ""}`;
325
- }
326
- }
327
- const variantNegative = {
328
- name: "negative",
329
- match(matcher) {
330
- if (!matcher.startsWith("-"))
331
- return;
332
- return {
333
- matcher: matcher.slice(1),
334
- body: (body) => {
335
- if (body.find((v) => v[0] === utils.CONTROL_MINI_NO_NEGATIVE))
336
- return;
337
- let changed = false;
338
- body.forEach((v) => {
339
- const value = v[1]?.toString();
340
- if (!value || value === "0")
341
- return;
342
- if (ignoreProps.some((i) => v[0].match(i)))
343
- return;
344
- const negated = negateFunctions(value);
345
- if (negated) {
346
- v[1] = negated;
347
- changed = true;
348
- } else if (numberRE.test(value)) {
349
- v[1] = value.replace(numberRE, (i) => `-${i}`);
350
- changed = true;
351
- }
352
- });
353
- if (changed)
354
- return body;
355
- return [];
356
- }
357
- };
358
- }
359
- };
360
-
361
- function variantImportant() {
362
- let re;
363
- return {
364
- name: "important",
365
- match(matcher, ctx) {
366
- if (!re)
367
- re = new RegExp(`^(important(?:${ctx.generator.config.separators.join("|")})|!)`);
368
- let base;
369
- const match = matcher.match(re);
370
- if (match)
371
- base = matcher.slice(match[0].length);
372
- else if (matcher.endsWith("!"))
373
- base = matcher.slice(0, -1);
374
- if (base) {
375
- return {
376
- matcher: base,
377
- body: (body) => {
378
- body.forEach((v) => {
379
- if (v[1])
380
- v[1] += " !important";
381
- });
382
- return body;
383
- }
384
- };
385
- }
386
- }
387
- };
388
- }
389
-
390
- const variantPrint = ruleUtils.variantParentMatcher("print", "@media print");
391
- const variantCustomMedia = {
392
- name: "media",
393
- match(matcher, ctx) {
394
- const variant = ruleUtils.variantGetParameter("media-", matcher, ctx.generator.config.separators);
395
- if (variant) {
396
- const [match, rest] = variant;
397
- let media = utils.h.bracket(match) ?? "";
398
- if (media === "")
399
- media = ctx.theme.media?.[match] ?? "";
400
- if (media) {
401
- return {
402
- matcher: rest,
403
- handle: (input, next) => next({
404
- ...input,
405
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@media ${media}`
406
- })
407
- };
408
- }
409
- }
410
- },
411
- multiPass: true
412
- };
413
-
414
- const variantSupports = {
415
- name: "supports",
416
- match(matcher, ctx) {
417
- const variant = ruleUtils.variantGetParameter("supports-", matcher, ctx.generator.config.separators);
418
- if (variant) {
419
- const [match, rest] = variant;
420
- let supports = utils.h.bracket(match) ?? "";
421
- if (supports === "")
422
- supports = ctx.theme.supports?.[match] ?? "";
423
- if (supports) {
424
- return {
425
- matcher: rest,
426
- handle: (input, next) => next({
427
- ...input,
428
- parent: `${input.parent ? `${input.parent} $$ ` : ""}@supports ${supports}`
429
- })
430
- };
431
- }
432
- }
433
- },
434
- multiPass: true
435
- };
436
-
437
- const PseudoClasses = Object.fromEntries([
438
- // pseudo elements part 1
439
- ["first-letter", "::first-letter"],
440
- ["first-line", "::first-line"],
441
- // location
442
- "any-link",
443
- "link",
444
- "visited",
445
- "target",
446
- ["open", "[open]"],
447
- // forms
448
- "default",
449
- "checked",
450
- "indeterminate",
451
- "placeholder-shown",
452
- "autofill",
453
- "optional",
454
- "required",
455
- "valid",
456
- "invalid",
457
- "user-valid",
458
- "user-invalid",
459
- "in-range",
460
- "out-of-range",
461
- "read-only",
462
- "read-write",
463
- // content
464
- "empty",
465
- // interactions
466
- "focus-within",
467
- "hover",
468
- "focus",
469
- "focus-visible",
470
- "active",
471
- "enabled",
472
- "disabled",
473
- // tree-structural
474
- "root",
475
- "empty",
476
- ["even-of-type", ":nth-of-type(even)"],
477
- ["even", ":nth-child(even)"],
478
- ["odd-of-type", ":nth-of-type(odd)"],
479
- ["odd", ":nth-child(odd)"],
480
- "first-of-type",
481
- ["first", ":first-child"],
482
- "last-of-type",
483
- ["last", ":last-child"],
484
- "only-child",
485
- "only-of-type",
486
- // pseudo elements part 2
487
- ["backdrop-element", "::backdrop"],
488
- ["placeholder", "::placeholder"],
489
- ["before", "::before"],
490
- ["after", "::after"],
491
- ["selection", "::selection"],
492
- ["marker", "::marker"],
493
- ["file", "::file-selector-button"]
494
- ].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
495
- const PseudoClassesKeys = Object.keys(PseudoClasses);
496
- const PseudoClassesColon = Object.fromEntries([
497
- ["backdrop", "::backdrop"]
498
- ].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
499
- const PseudoClassesColonKeys = Object.keys(PseudoClassesColon);
500
- const PseudoClassFunctions = [
501
- "not",
502
- "is",
503
- "where",
504
- "has"
505
- ];
506
- const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
507
- const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
508
- const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
509
- function taggedPseudoClassMatcher(tag, parent, combinator) {
510
- const rawRE = new RegExp(`^(${core.escapeRegExp(parent)}:)(\\S+)${core.escapeRegExp(combinator)}\\1`);
511
- let splitRE;
512
- let pseudoRE;
513
- let pseudoColonRE;
514
- let pseudoVarRE;
515
- const matchBracket = (input) => {
516
- const body = ruleUtils.variantGetBracket(`${tag}-`, input, []);
517
- if (!body)
518
- return;
519
- const [match, rest] = body;
520
- const bracketValue = utils.h.bracket(match);
521
- if (bracketValue == null)
522
- return;
523
- const label = rest.split(splitRE, 1)?.[0] ?? "";
524
- const prefix = `${parent}${core.escapeSelector(label)}`;
525
- return [
526
- label,
527
- input.slice(input.length - (rest.length - label.length - 1)),
528
- bracketValue.includes("&") ? bracketValue.replace(/&/g, prefix) : `${prefix}${bracketValue}`
529
- ];
530
- };
531
- const matchPseudo = (input) => {
532
- const match = input.match(pseudoRE) || input.match(pseudoColonRE);
533
- if (!match)
534
- return;
535
- const [original, fn, pseudoKey] = match;
536
- const label = match[3] ?? "";
537
- let pseudo = PseudoClasses[pseudoKey] || PseudoClassesColon[pseudoKey] || `:${pseudoKey}`;
538
- if (fn)
539
- pseudo = `:${fn}(${pseudo})`;
540
- return [
541
- label,
542
- input.slice(original.length),
543
- `${parent}${core.escapeSelector(label)}${pseudo}`,
544
- pseudoKey
545
- ];
546
- };
547
- const matchPseudoVar = (input) => {
548
- const match = input.match(pseudoVarRE);
549
- if (!match)
550
- return;
551
- const [original, fn, pseudoValue] = match;
552
- const label = match[3] ?? "";
553
- const pseudo = `:${fn}(${pseudoValue})`;
554
- return [
555
- label,
556
- input.slice(original.length),
557
- `${parent}${core.escapeSelector(label)}${pseudo}`
558
- ];
559
- };
560
- return {
561
- name: `pseudo:${tag}`,
562
- match(input, ctx) {
563
- if (!(splitRE && pseudoRE && pseudoColonRE)) {
564
- splitRE = new RegExp(`(?:${ctx.generator.config.separators.join("|")})`);
565
- pseudoRE = new RegExp(`^${tag}-(?:(?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))(?:(/\\w+))?(?:${ctx.generator.config.separators.join("|")})`);
566
- pseudoColonRE = new RegExp(`^${tag}-(?:(?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))(?:(/\\w+))?(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
567
- pseudoVarRE = new RegExp(`^${tag}-(?:(${PseudoClassFunctionsStr})-)?\\[(.+)\\](?:(/\\w+))?(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
568
- }
569
- if (!input.startsWith(tag))
570
- return;
571
- const result = matchBracket(input) || matchPseudo(input) || matchPseudoVar(input);
572
- if (!result)
573
- return;
574
- const [label, matcher, prefix, pseudoName = ""] = result;
575
- if (label !== "")
576
- core.warnOnce("The labeled variant is experimental and may not follow semver.");
577
- return {
578
- matcher,
579
- handle: (input2, next) => next({
580
- ...input2,
581
- prefix: `${prefix}${combinator}${input2.prefix}`.replace(rawRE, "$1$2:"),
582
- sort: PseudoClassesKeys.indexOf(pseudoName) ?? PseudoClassesColonKeys.indexOf(pseudoName)
583
- })
584
- };
585
- },
586
- multiPass: true
587
- };
588
- }
589
- const excludedPseudo = [
590
- "::-webkit-resizer",
591
- "::-webkit-scrollbar",
592
- "::-webkit-scrollbar-button",
593
- "::-webkit-scrollbar-corner",
594
- "::-webkit-scrollbar-thumb",
595
- "::-webkit-scrollbar-track",
596
- "::-webkit-scrollbar-track-piece",
597
- "::file-selector-button"
598
- ];
599
- const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
600
- const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
601
- function variantPseudoClassesAndElements() {
602
- let PseudoClassesAndElementsRE;
603
- let PseudoClassesAndElementsColonRE;
604
- return {
605
- name: "pseudo",
606
- match(input, ctx) {
607
- if (!(PseudoClassesAndElementsRE && PseudoClassesAndElementsRE)) {
608
- PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})(?:${ctx.generator.config.separators.join("|")})`);
609
- PseudoClassesAndElementsColonRE = new RegExp(`^(${PseudoClassesAndElementsColonStr})(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
610
- }
611
- const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
612
- if (match) {
613
- const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
614
- let index = PseudoClassesKeys.indexOf(match[1]);
615
- if (index === -1)
616
- index = PseudoClassesColonKeys.indexOf(match[1]);
617
- if (index === -1)
618
- index = void 0;
619
- return {
620
- matcher: input.slice(match[0].length),
621
- handle: (input2, next) => {
622
- const selectors = pseudo.startsWith("::") && !excludedPseudo.includes(pseudo) ? {
623
- pseudo: `${input2.pseudo}${pseudo}`
624
- } : {
625
- selector: `${input2.selector}${pseudo}`
626
- };
627
- return next({
628
- ...input2,
629
- ...selectors,
630
- sort: index,
631
- noMerge: true
632
- });
633
- }
634
- };
635
- }
636
- },
637
- multiPass: true,
638
- autocomplete: `(${PseudoClassesAndElementsStr}|${PseudoClassesAndElementsColonStr}):`
639
- };
640
- }
641
- function variantPseudoClassFunctions() {
642
- let PseudoClassFunctionsRE;
643
- let PseudoClassColonFunctionsRE;
644
- let PseudoClassVarFunctionRE;
645
- return {
646
- match(input, ctx) {
647
- if (!(PseudoClassFunctionsRE && PseudoClassColonFunctionsRE)) {
648
- PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})(?:${ctx.generator.config.separators.join("|")})`);
649
- PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
650
- PseudoClassVarFunctionRE = new RegExp(`^(${PseudoClassFunctionsStr})-(\\[.+\\])(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
651
- }
652
- const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE) || input.match(PseudoClassVarFunctionRE);
653
- if (match) {
654
- const fn = match[1];
655
- const fnVal = ruleUtils.getBracket(match[2], "[", "]");
656
- const pseudo = fnVal ? utils.h.bracket(match[2]) : PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
657
- return {
658
- matcher: input.slice(match[0].length),
659
- selector: (s) => `${s}:${fn}(${pseudo})`
660
- };
661
- }
662
- },
663
- multiPass: true,
664
- autocomplete: `(${PseudoClassFunctionsStr})-(${PseudoClassesStr}|${PseudoClassesColonStr}):`
665
- };
666
- }
667
- function variantTaggedPseudoClasses(options = {}) {
668
- const attributify = !!options?.attributifyPseudo;
669
- return [
670
- taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
671
- taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
672
- taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
673
- taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+")
674
- ];
675
- }
676
- const PartClassesRE = /(part-\[(.+)]:)(.+)/;
677
- const variantPartClasses = {
678
- match(input) {
679
- const match = input.match(PartClassesRE);
680
- if (match) {
681
- const part = `part(${match[2]})`;
682
- return {
683
- matcher: input.slice(match[1].length),
684
- selector: (s) => `${s}::${part}`
685
- };
686
- }
687
- },
688
- multiPass: true
689
- };
690
-
691
- function variants(options) {
692
- return [
693
- variantAria,
694
- variantDataAttribute,
695
- variantCssLayer,
696
- variantSelector,
697
- variantInternalLayer,
698
- variantNegative,
699
- variantImportant(),
700
- variantSupports,
701
- variantPrint,
702
- variantCustomMedia,
703
- variantBreakpoints(),
704
- ...variantCombinators,
705
- variantPseudoClassesAndElements(),
706
- variantPseudoClassFunctions(),
707
- ...variantTaggedPseudoClasses(options),
708
- variantPartClasses,
709
- ...variantColorsMediaOrClass(options),
710
- ...variantLanguageDirections,
711
- variantScope,
712
- variantContainerQuery,
713
- variantVariables,
714
- variantGroupDataAttribute
715
- ];
716
- }
717
-
718
- exports.calcMaxWidthBySize = calcMaxWidthBySize;
719
- exports.variantAria = variantAria;
720
- exports.variantBreakpoints = variantBreakpoints;
721
- exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
722
- exports.variantCombinators = variantCombinators;
723
- exports.variantContainerQuery = variantContainerQuery;
724
- exports.variantCssLayer = variantCssLayer;
725
- exports.variantCustomMedia = variantCustomMedia;
726
- exports.variantDataAttribute = variantDataAttribute;
727
- exports.variantGroupDataAttribute = variantGroupDataAttribute;
728
- exports.variantImportant = variantImportant;
729
- exports.variantInternalLayer = variantInternalLayer;
730
- exports.variantLanguageDirections = variantLanguageDirections;
731
- exports.variantNegative = variantNegative;
732
- exports.variantPartClasses = variantPartClasses;
733
- exports.variantPrint = variantPrint;
734
- exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
735
- exports.variantPseudoClassesAndElements = variantPseudoClassesAndElements;
736
- exports.variantScope = variantScope;
737
- exports.variantSelector = variantSelector;
738
- exports.variantSupports = variantSupports;
739
- exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
740
- exports.variantVariables = variantVariables;
741
- exports.variants = variants;
3
+ const _default = require('./shared/preset-mini.jXC5Sr98.cjs');
4
+ require('./shared/preset-mini.UhMMbd34.cjs');
5
+ require('@unocss/core');
6
+ require('@unocss/rule-utils');
7
+
8
+
9
+
10
+ exports.calcMaxWidthBySize = _default.calcMaxWidthBySize;
11
+ exports.variantAria = _default.variantAria;
12
+ exports.variantBreakpoints = _default.variantBreakpoints;
13
+ exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
14
+ exports.variantCombinators = _default.variantCombinators;
15
+ exports.variantContainerQuery = _default.variantContainerQuery;
16
+ exports.variantCssLayer = _default.variantCssLayer;
17
+ exports.variantCustomMedia = _default.variantCustomMedia;
18
+ exports.variantDataAttribute = _default.variantDataAttribute;
19
+ exports.variantImportant = _default.variantImportant;
20
+ exports.variantInternalLayer = _default.variantInternalLayer;
21
+ exports.variantLanguageDirections = _default.variantLanguageDirections;
22
+ exports.variantNegative = _default.variantNegative;
23
+ exports.variantPartClasses = _default.variantPartClasses;
24
+ exports.variantPrint = _default.variantPrint;
25
+ exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
26
+ exports.variantPseudoClassesAndElements = _default.variantPseudoClassesAndElements;
27
+ exports.variantScope = _default.variantScope;
28
+ exports.variantSelector = _default.variantSelector;
29
+ exports.variantSupports = _default.variantSupports;
30
+ exports.variantTaggedDataAttributes = _default.variantTaggedDataAttributes;
31
+ exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
32
+ exports.variantVariables = _default.variantVariables;
33
+ exports.variants = _default.variants;