@unocss/preset-mini 0.55.1 → 0.55.2

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