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