tailwindcss 0.0.0-oxide.2 → 0.0.0-oxide.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/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  'use strict';
2
3
 
3
4
  var parse = require('mri');
@@ -92,7 +93,7 @@ function convertNumber(value) {
92
93
  }
93
94
  {
94
95
  let valueAsNumber = Number(value);
95
- if (!isNaN(valueAsNumber)) {
96
+ if (!Number.isNaN(valueAsNumber)) {
96
97
  return valueAsNumber;
97
98
  }
98
99
  }
@@ -102,75 +103,7 @@ function convertString(value) {
102
103
  }
103
104
 
104
105
  // package.json
105
- var version = "0.0.0-oxide.2";
106
- var package_default = {
107
- name: "tailwindcss",
108
- version,
109
- description: "A utility-first CSS framework for rapidly building custom user interfaces.",
110
- license: "MIT",
111
- repository: "https://github.com/tailwindlabs/tailwindcss.git",
112
- bugs: "https://github.com/tailwindlabs/tailwindcss/issues",
113
- homepage: "https://tailwindcss.com",
114
- scripts: {
115
- lint: "tsc --noEmit",
116
- build: "tsup-node --env.NODE_ENV production",
117
- dev: "tsup-node --env.NODE_ENV development --watch",
118
- "test:ui": "playwright test"
119
- },
120
- bin: {
121
- tailwindcss: "./dist/cli.js"
122
- },
123
- exports: {
124
- ".": {
125
- style: "./index.css",
126
- types: "./src/index.ts",
127
- require: "./dist/lib.js",
128
- import: "./src/index.ts"
129
- },
130
- "./package.json": "./package.json",
131
- "./index.css": "./index.css",
132
- "./preflight.css": "./preflight.css",
133
- "./theme.css": "./theme.css",
134
- "./utilities.css": "./utilities.css"
135
- },
136
- publishConfig: {
137
- exports: {
138
- ".": {
139
- types: "./dist/lib.d.mts",
140
- style: "./index.css",
141
- require: "./dist/lib.js",
142
- import: "./dist/lib.mjs"
143
- },
144
- "./package.json": "./package.json",
145
- "./index.css": "./index.css",
146
- "./preflight.css": "./preflight.css",
147
- "./theme.css": "./theme.css",
148
- "./utilities.css": "./utilities.css"
149
- }
150
- },
151
- style: "index.css",
152
- files: [
153
- "dist",
154
- "index.css",
155
- "preflight.css",
156
- "theme.css",
157
- "utilities.css"
158
- ],
159
- dependencies: {
160
- "@parcel/watcher": "^2.4.1",
161
- lightningcss: "^1.24.0",
162
- mri: "^1.2.0",
163
- picocolors: "^1.0.0",
164
- postcss: "8.4.24",
165
- "postcss-import": "^16.0.0"
166
- },
167
- devDependencies: {
168
- "@tailwindcss/oxide": "workspace:^",
169
- "@types/node": "^20.10.8",
170
- "@types/postcss-import": "^14.0.3",
171
- "fast-glob": "^3.3.2"
172
- }
173
- };
106
+ var version = "0.0.0-oxide.3";
174
107
 
175
108
  // src/ast.ts
176
109
  function rule(selector, nodes) {
@@ -210,6 +143,34 @@ function walk(ast, visit) {
210
143
  }
211
144
  }
212
145
  }
146
+ function toCss(ast) {
147
+ let atRoots = [];
148
+ return ast.map(function stringify(node) {
149
+ let css2 = "";
150
+ if (node.kind === "rule") {
151
+ if (node.selector === "@at-root") {
152
+ for (let child of node.nodes) {
153
+ atRoots.push(stringify(child));
154
+ }
155
+ return css2;
156
+ }
157
+ if (node.selector[0] === "@" && node.nodes.length === 0) {
158
+ return `${node.selector};`;
159
+ }
160
+ css2 += `${node.selector}{`;
161
+ for (let child of node.nodes) {
162
+ css2 += stringify(child);
163
+ }
164
+ css2 += "}";
165
+ } else if (node.kind === "comment") {
166
+ css2 += `/*${node.value}*/
167
+ `;
168
+ } else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
169
+ css2 += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
170
+ }
171
+ return css2;
172
+ }).concat(atRoots).join("\n");
173
+ }
213
174
 
214
175
  // src/utils/math-operators.ts
215
176
  var mathFunctions = [
@@ -367,105 +328,6 @@ function segment(input, separator) {
367
328
  }
368
329
 
369
330
  // src/candidate.ts
370
- function findRoot(input, lookup) {
371
- let root = null;
372
- let value = null;
373
- {
374
- if (lookup.has(input)) {
375
- root = input;
376
- value = null;
377
- } else {
378
- let idx = input.lastIndexOf("-");
379
- if (idx === -1)
380
- return [null, null];
381
- do {
382
- let maybeRoot = input.slice(0, idx);
383
- if (lookup.has(maybeRoot)) {
384
- root = maybeRoot;
385
- value = input.slice(idx + 1);
386
- break;
387
- }
388
- idx = input.lastIndexOf("-", idx - 1);
389
- } while (idx > 0);
390
- }
391
- }
392
- return [root, value];
393
- }
394
- function parseVariant(variant, variants, parsedVariants) {
395
- if (variant[0] === "[" && variant[variant.length - 1] === "]") {
396
- if (variant[1] === "@" && variant.includes("&"))
397
- return null;
398
- let selector = decodeArbitraryValue(variant.slice(1, -1));
399
- if (selector[0] !== "@") {
400
- if (!selector.includes("&")) {
401
- selector = `&:is(${selector})`;
402
- }
403
- }
404
- return {
405
- kind: "arbitrary",
406
- selector,
407
- compounds: true
408
- };
409
- }
410
- {
411
- let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
412
- if (additionalModifier)
413
- return null;
414
- let [root, value] = findRoot(variantWithoutModifier, variants);
415
- if (root === null)
416
- return null;
417
- switch (variants.kind(root)) {
418
- case "static": {
419
- if (value !== null)
420
- return null;
421
- return {
422
- kind: "static",
423
- root,
424
- compounds: variants.compounds(root)
425
- };
426
- }
427
- case "functional": {
428
- if (value === null)
429
- return null;
430
- if (value[0] === "[" && value[value.length - 1] === "]") {
431
- return {
432
- kind: "functional",
433
- root,
434
- value: {
435
- kind: "arbitrary",
436
- value: decodeArbitraryValue(value.slice(1, -1))
437
- },
438
- compounds: variants.compounds(root)
439
- };
440
- } else {
441
- return {
442
- kind: "functional",
443
- root,
444
- value: { kind: "named", value },
445
- compounds: variants.compounds(root)
446
- };
447
- }
448
- }
449
- case "compound": {
450
- if (value === null)
451
- return null;
452
- let subVariant = parsedVariants.get(value);
453
- if (subVariant === null)
454
- return null;
455
- if (subVariant.compounds === false)
456
- return null;
457
- return {
458
- kind: "compound",
459
- root,
460
- modifier: modifier === null ? null : { kind: "named", value: modifier },
461
- variant: subVariant,
462
- compounds: variants.compounds(root)
463
- };
464
- }
465
- }
466
- }
467
- return null;
468
- }
469
331
  function parseCandidate(input, utilities, parsedVariants) {
470
332
  let rawVariants = segment(input, ":");
471
333
  let base = rawVariants.pop();
@@ -497,20 +359,24 @@ function parseCandidate(input, utilities, parsedVariants) {
497
359
  state.important = true;
498
360
  base = base.slice(0, -1);
499
361
  }
500
- if (base[0] === "[" && base[base.length - 1] === "]") {
501
- let charCode = base.charCodeAt(1);
362
+ if (base[0] === "[") {
363
+ let [baseWithoutModifier, modifierSegment2 = null] = segment(base, "/");
364
+ if (baseWithoutModifier[baseWithoutModifier.length - 1] !== "]")
365
+ return null;
366
+ let charCode = baseWithoutModifier.charCodeAt(1);
502
367
  if (charCode !== 45 && !(charCode >= 97 && charCode <= 122))
503
368
  return null;
504
- base = base.slice(1, -1);
505
- let idx = base.indexOf(":");
506
- if (idx === -1 || idx === 0 || idx === base.length - 1)
369
+ baseWithoutModifier = baseWithoutModifier.slice(1, -1);
370
+ let idx = baseWithoutModifier.indexOf(":");
371
+ if (idx === -1 || idx === 0 || idx === baseWithoutModifier.length - 1)
507
372
  return null;
508
- let property2 = base.slice(0, idx);
509
- let value2 = decodeArbitraryValue(base.slice(idx + 1));
373
+ let property2 = baseWithoutModifier.slice(0, idx);
374
+ let value2 = decodeArbitraryValue(baseWithoutModifier.slice(idx + 1));
510
375
  return {
511
376
  kind: "arbitrary",
512
377
  property: property2,
513
378
  value: value2,
379
+ modifier: modifierSegment2 === null ? null : parseModifier(modifierSegment2),
514
380
  variants: parsedCandidateVariants,
515
381
  important: state.important
516
382
  };
@@ -520,6 +386,12 @@ function parseCandidate(input, utilities, parsedVariants) {
520
386
  base = base.slice(1);
521
387
  }
522
388
  let [root, value] = findRoot(base, utilities);
389
+ let modifierSegment = null;
390
+ if (root === null && base.includes("/")) {
391
+ let [rootWithoutModifier, rootModifierSegment = null] = segment(base, "/");
392
+ modifierSegment = rootModifierSegment;
393
+ [root, value] = findRoot(rootWithoutModifier, utilities);
394
+ }
523
395
  if (root === null)
524
396
  return null;
525
397
  let kind = utilities.kind(root);
@@ -537,22 +409,36 @@ function parseCandidate(input, utilities, parsedVariants) {
537
409
  let candidate = {
538
410
  kind: "functional",
539
411
  root,
540
- modifier: null,
412
+ modifier: modifierSegment === null ? null : parseModifier(modifierSegment),
541
413
  value: null,
542
414
  variants: parsedCandidateVariants,
543
415
  negative: state.negative,
544
416
  important: state.important
545
417
  };
546
- if (value === null) {
418
+ if (value === null)
547
419
  return candidate;
548
- }
549
- let [valueWithoutModifier, modifierSegment = null] = segment(value, "/");
550
- let startArbitraryIdx = valueWithoutModifier.indexOf("[");
551
- let valueIsArbitrary = startArbitraryIdx !== -1;
552
- let modifierIsArbitrary = modifierSegment && modifierSegment[0] === "[" && modifierSegment[modifierSegment.length - 1] === "]";
553
- if (modifierSegment) {
554
- if (modifierIsArbitrary) {
555
- let arbitraryValue = modifierSegment.slice(1, -1);
420
+ {
421
+ let [valueWithoutModifier, modifierSegment2 = null] = segment(value, "/");
422
+ if (modifierSegment2 !== null) {
423
+ candidate.modifier = parseModifier(modifierSegment2);
424
+ }
425
+ let startArbitraryIdx = valueWithoutModifier.indexOf("[");
426
+ let valueIsArbitrary = startArbitraryIdx !== -1;
427
+ if (valueIsArbitrary) {
428
+ let arbitraryValue = valueWithoutModifier.slice(startArbitraryIdx + 1, -1);
429
+ let typehint = "";
430
+ for (let i = 0; i < arbitraryValue.length; i++) {
431
+ let code = arbitraryValue.charCodeAt(i);
432
+ if (code === 58) {
433
+ typehint = arbitraryValue.slice(0, i);
434
+ arbitraryValue = arbitraryValue.slice(i + 1);
435
+ break;
436
+ }
437
+ if (code === 45 || code >= 97 && code <= 122) {
438
+ continue;
439
+ }
440
+ break;
441
+ }
556
442
  let dashedIdent = null;
557
443
  if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
558
444
  dashedIdent = arbitraryValue;
@@ -560,33 +446,26 @@ function parseCandidate(input, utilities, parsedVariants) {
560
446
  } else {
561
447
  arbitraryValue = decodeArbitraryValue(arbitraryValue);
562
448
  }
563
- candidate.modifier = {
449
+ candidate.value = {
564
450
  kind: "arbitrary",
451
+ dataType: typehint || null,
565
452
  value: arbitraryValue,
566
453
  dashedIdent
567
454
  };
568
455
  } else {
569
- candidate.modifier = {
456
+ let fraction = modifierSegment2 === null || candidate.modifier?.kind === "arbitrary" ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
457
+ candidate.value = {
570
458
  kind: "named",
571
- value: modifierSegment
459
+ value: valueWithoutModifier,
460
+ fraction
572
461
  };
573
462
  }
574
463
  }
575
- if (valueIsArbitrary) {
576
- let arbitraryValue = valueWithoutModifier.slice(startArbitraryIdx + 1, -1);
577
- let typehint = "";
578
- for (let i = 0; i < arbitraryValue.length; i++) {
579
- let code = arbitraryValue.charCodeAt(i);
580
- if (code === 58) {
581
- typehint = arbitraryValue.slice(0, i);
582
- arbitraryValue = arbitraryValue.slice(i + 1);
583
- break;
584
- }
585
- if (code === 45 || code >= 97 && code <= 122) {
586
- continue;
587
- }
588
- break;
589
- }
464
+ return candidate;
465
+ }
466
+ function parseModifier(modifier) {
467
+ if (modifier[0] === "[" && modifier[modifier.length - 1] === "]") {
468
+ let arbitraryValue = modifier.slice(1, -1);
590
469
  let dashedIdent = null;
591
470
  if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
592
471
  dashedIdent = arbitraryValue;
@@ -594,21 +473,218 @@ function parseCandidate(input, utilities, parsedVariants) {
594
473
  } else {
595
474
  arbitraryValue = decodeArbitraryValue(arbitraryValue);
596
475
  }
597
- candidate.value = {
476
+ return {
598
477
  kind: "arbitrary",
599
- dataType: typehint || null,
600
478
  value: arbitraryValue,
601
479
  dashedIdent
602
480
  };
603
- } else {
604
- let fraction = modifierSegment === null || modifierIsArbitrary ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
605
- candidate.value = {
606
- kind: "named",
607
- value: valueWithoutModifier,
608
- fraction
481
+ }
482
+ return {
483
+ kind: "named",
484
+ value: modifier
485
+ };
486
+ }
487
+ function parseVariant(variant, variants, parsedVariants) {
488
+ if (variant[0] === "[" && variant[variant.length - 1] === "]") {
489
+ if (variant[1] === "@" && variant.includes("&"))
490
+ return null;
491
+ let selector = decodeArbitraryValue(variant.slice(1, -1));
492
+ if (selector[0] !== "@") {
493
+ if (!selector.includes("&")) {
494
+ selector = `&:is(${selector})`;
495
+ }
496
+ }
497
+ return {
498
+ kind: "arbitrary",
499
+ selector,
500
+ compounds: true
609
501
  };
610
502
  }
611
- return candidate;
503
+ {
504
+ let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
505
+ if (additionalModifier)
506
+ return null;
507
+ let [root, value] = findRoot(variantWithoutModifier, variants);
508
+ if (root === null)
509
+ return null;
510
+ switch (variants.kind(root)) {
511
+ case "static": {
512
+ if (value !== null)
513
+ return null;
514
+ return {
515
+ kind: "static",
516
+ root,
517
+ compounds: variants.compounds(root)
518
+ };
519
+ }
520
+ case "functional": {
521
+ if (value === null)
522
+ return null;
523
+ if (value[0] === "[" && value[value.length - 1] === "]") {
524
+ return {
525
+ kind: "functional",
526
+ root,
527
+ modifier: modifier === null ? null : parseModifier(modifier),
528
+ value: {
529
+ kind: "arbitrary",
530
+ value: decodeArbitraryValue(value.slice(1, -1))
531
+ },
532
+ compounds: variants.compounds(root)
533
+ };
534
+ }
535
+ return {
536
+ kind: "functional",
537
+ root,
538
+ modifier: modifier === null ? null : parseModifier(modifier),
539
+ value: { kind: "named", value },
540
+ compounds: variants.compounds(root)
541
+ };
542
+ }
543
+ case "compound": {
544
+ if (value === null)
545
+ return null;
546
+ let subVariant = parsedVariants.get(value);
547
+ if (subVariant === null)
548
+ return null;
549
+ if (subVariant.compounds === false)
550
+ return null;
551
+ return {
552
+ kind: "compound",
553
+ root,
554
+ modifier: modifier === null ? null : { kind: "named", value: modifier },
555
+ variant: subVariant,
556
+ compounds: variants.compounds(root)
557
+ };
558
+ }
559
+ }
560
+ }
561
+ return null;
562
+ }
563
+ function findRoot(input, lookup) {
564
+ if (lookup.has(input))
565
+ return [input, null];
566
+ let idx = input.lastIndexOf("-");
567
+ if (idx === -1) {
568
+ if (input[0] === "@" && lookup.has("@")) {
569
+ return ["@", input.slice(1)];
570
+ }
571
+ return [null, null];
572
+ }
573
+ do {
574
+ let maybeRoot = input.slice(0, idx);
575
+ if (lookup.has(maybeRoot)) {
576
+ return [maybeRoot, input.slice(idx + 1)];
577
+ }
578
+ idx = input.lastIndexOf("-", idx - 1);
579
+ } while (idx > 0);
580
+ return [null, null];
581
+ }
582
+
583
+ // src/utils/default-map.ts
584
+ var DefaultMap = class extends Map {
585
+ constructor(factory) {
586
+ super();
587
+ this.factory = factory;
588
+ }
589
+ get(key) {
590
+ let value = super.get(key);
591
+ if (value === void 0) {
592
+ value = this.factory(key, this);
593
+ this.set(key, value);
594
+ }
595
+ return value;
596
+ }
597
+ };
598
+
599
+ // src/intellisense.ts
600
+ function getClassList(design) {
601
+ let list = [];
602
+ for (let [utility, fn] of design.utilities.entries()) {
603
+ if (typeof utility !== "string") {
604
+ continue;
605
+ }
606
+ if (fn.kind === "static") {
607
+ list.push([utility, { modifiers: [] }]);
608
+ continue;
609
+ }
610
+ let completions = design.utilities.getCompletions(utility);
611
+ for (let group of completions) {
612
+ for (let value of group.values) {
613
+ let name = value === null ? utility : `${utility}-${value}`;
614
+ list.push([name, { modifiers: group.modifiers }]);
615
+ if (group.supportsNegative) {
616
+ list.push([`-${name}`, { modifiers: group.modifiers }]);
617
+ }
618
+ }
619
+ }
620
+ }
621
+ list.sort((a, b) => a[0].localeCompare(b[0]));
622
+ return list;
623
+ }
624
+ function getVariants(design) {
625
+ let list = [];
626
+ let parsedVariants = new DefaultMap(
627
+ (variant, map) => parseVariant(variant, design.variants, map)
628
+ );
629
+ for (let [root, variant] of design.variants.entries()) {
630
+ let selectors2 = function({ value, modifier } = {}) {
631
+ let name = root;
632
+ if (value)
633
+ name += `-${value}`;
634
+ if (modifier)
635
+ name += `/${modifier}`;
636
+ let variant2 = parsedVariants.get(name);
637
+ if (!variant2)
638
+ return [];
639
+ let node = rule(".__placeholder__", [decl("color", "red")]);
640
+ if (applyVariant(node, variant2, design.variants) === null) {
641
+ return [];
642
+ }
643
+ let selectors3 = [];
644
+ for (let child of node.nodes) {
645
+ if (child.kind === "rule") {
646
+ selectors3.push(child.selector);
647
+ }
648
+ }
649
+ return selectors3;
650
+ };
651
+ if (variant.kind === "arbitrary")
652
+ continue;
653
+ let values = design.variants.getCompletions(root);
654
+ switch (variant.kind) {
655
+ case "static": {
656
+ list.push({
657
+ name: root,
658
+ values,
659
+ isArbitrary: false,
660
+ hasDash: true,
661
+ selectors: selectors2
662
+ });
663
+ break;
664
+ }
665
+ case "functional": {
666
+ list.push({
667
+ name: root,
668
+ values,
669
+ isArbitrary: true,
670
+ hasDash: true,
671
+ selectors: selectors2
672
+ });
673
+ break;
674
+ }
675
+ case "compound": {
676
+ list.push({
677
+ name: root,
678
+ values,
679
+ isArbitrary: true,
680
+ hasDash: true,
681
+ selectors: selectors2
682
+ });
683
+ break;
684
+ }
685
+ }
686
+ }
687
+ return list;
612
688
  }
613
689
 
614
690
  // src/sort.ts
@@ -1018,14 +1094,19 @@ function replaceShadowColors(input, replacement) {
1018
1094
  }
1019
1095
 
1020
1096
  // src/utilities.ts
1097
+ var ARBITRARY_VARIANT = Symbol("ARBITRARY_VARIANT");
1021
1098
  var Utilities = class {
1022
1099
  utilities = /* @__PURE__ */ new Map();
1100
+ completions = /* @__PURE__ */ new Map();
1023
1101
  static(name, compileFn) {
1024
1102
  this.set(name, { kind: "static", compileFn });
1025
1103
  }
1026
1104
  functional(name, compileFn) {
1027
1105
  this.set(name, { kind: "functional", compileFn });
1028
1106
  }
1107
+ arbitrary(compileFn) {
1108
+ this.set(ARBITRARY_VARIANT, { kind: "arbitrary", compileFn });
1109
+ }
1029
1110
  has(name) {
1030
1111
  return this.utilities.has(name);
1031
1112
  }
@@ -1035,9 +1116,21 @@ var Utilities = class {
1035
1116
  kind(name) {
1036
1117
  return this.utilities.get(name).kind;
1037
1118
  }
1119
+ getCompletions(name) {
1120
+ return this.completions.get(name)?.() ?? [];
1121
+ }
1122
+ suggest(name, groups) {
1123
+ this.completions.set(name, groups);
1124
+ }
1038
1125
  keys() {
1039
1126
  return this.utilities.keys();
1040
1127
  }
1128
+ entries() {
1129
+ return this.utilities.entries();
1130
+ }
1131
+ getArbitrary() {
1132
+ return this.get(ARBITRARY_VARIANT).compileFn;
1133
+ }
1041
1134
  set(name, { kind, compileFn }) {
1042
1135
  this.utilities.set(name, {
1043
1136
  kind,
@@ -1061,19 +1154,17 @@ function property(ident, initialValue, syntax) {
1061
1154
  ]);
1062
1155
  }
1063
1156
  function withAlpha(value, alpha) {
1064
- if (alpha === null) {
1157
+ if (alpha === null)
1065
1158
  return value;
1066
- }
1067
1159
  let alphaAsNumber = Number(alpha);
1068
- if (!isNaN(alphaAsNumber)) {
1160
+ if (!Number.isNaN(alphaAsNumber)) {
1069
1161
  alpha = `${alphaAsNumber * 100}%`;
1070
1162
  }
1071
1163
  return `color-mix(in srgb, ${value} ${alpha}, transparent)`;
1072
1164
  }
1073
1165
  function asColor(value, modifier, theme) {
1074
- if (!modifier) {
1166
+ if (!modifier)
1075
1167
  return value;
1076
- }
1077
1168
  if (modifier.kind === "arbitrary") {
1078
1169
  return withAlpha(value, modifier.value);
1079
1170
  }
@@ -1081,6 +1172,9 @@ function asColor(value, modifier, theme) {
1081
1172
  if (alpha) {
1082
1173
  return withAlpha(value, alpha);
1083
1174
  }
1175
+ if (Number.isNaN(Number(modifier.value))) {
1176
+ return null;
1177
+ }
1084
1178
  return withAlpha(value, `${modifier.value}%`);
1085
1179
  }
1086
1180
  function withNegative(value, candidate) {
@@ -1106,11 +1200,45 @@ function resolveThemeColor(candidate, theme, themeKeys) {
1106
1200
  }
1107
1201
  function createUtilities(theme) {
1108
1202
  let utilities = new Utilities();
1203
+ utilities.arbitrary((candidate) => {
1204
+ let value = candidate.value;
1205
+ if (candidate.modifier) {
1206
+ value = asColor(value, candidate.modifier, theme);
1207
+ }
1208
+ if (value === null)
1209
+ return;
1210
+ return [decl(candidate.property, value)];
1211
+ });
1212
+ function suggest(classRoot, defns) {
1213
+ function* resolve2(themeKeys) {
1214
+ for (let value of theme.keysInNamespaces(themeKeys)) {
1215
+ yield value.replaceAll("_", ".");
1216
+ }
1217
+ }
1218
+ utilities.suggest(classRoot, () => {
1219
+ let groups = [];
1220
+ for (let defn of defns()) {
1221
+ if (typeof defn === "string") {
1222
+ groups.push({ values: [defn], modifiers: [] });
1223
+ continue;
1224
+ }
1225
+ let values = [
1226
+ ...defn.values ?? [],
1227
+ ...resolve2(defn.valueThemeKeys ?? [])
1228
+ ];
1229
+ let modifiers = [...defn.modifiers ?? [], ...resolve2(defn.modifierThemeKeys ?? [])];
1230
+ if (defn.hasDefaultValue) {
1231
+ values.unshift(null);
1232
+ }
1233
+ groups.push({ supportsNegative: defn.supportsNegative, values, modifiers });
1234
+ }
1235
+ return groups;
1236
+ });
1237
+ }
1109
1238
  function staticUtility(className, declarations) {
1110
1239
  utilities.static(className, (candidate) => {
1111
- if (candidate.negative) {
1240
+ if (candidate.negative)
1112
1241
  return;
1113
- }
1114
1242
  return declarations.map((node) => {
1115
1243
  return typeof node === "function" ? node() : decl(node[0], node[1]);
1116
1244
  });
@@ -1127,17 +1255,24 @@ function createUtilities(theme) {
1127
1255
  value = candidate.value.value;
1128
1256
  } else {
1129
1257
  value = theme.resolve(candidate.value.fraction ?? candidate.value.value, desc.themeKeys);
1130
- if (!value && desc.supportsFractions && candidate.value.fraction) {
1258
+ if (value === null && desc.supportsFractions && candidate.value.fraction) {
1131
1259
  value = `calc(${candidate.value.fraction} * 100%)`;
1132
1260
  }
1133
- if (!value && desc.handleBareValue) {
1261
+ if (value === null && desc.handleBareValue) {
1134
1262
  value = desc.handleBareValue(candidate.value);
1135
1263
  }
1136
1264
  }
1137
- if (!value)
1265
+ if (value === null)
1138
1266
  return;
1139
1267
  return desc.handle(withNegative(value, candidate));
1140
1268
  });
1269
+ suggest(classRoot, () => [
1270
+ {
1271
+ supportsNegative: desc.supportsNegative,
1272
+ valueThemeKeys: desc.themeKeys,
1273
+ hasDefaultValue: desc.defaultValue !== void 0 && desc.defaultValue !== null
1274
+ }
1275
+ ]);
1141
1276
  }
1142
1277
  function colorUtility(classRoot, desc) {
1143
1278
  utilities.functional(classRoot, (candidate) => {
@@ -1151,11 +1286,19 @@ function createUtilities(theme) {
1151
1286
  value = asColor(value, candidate.modifier, theme);
1152
1287
  } else {
1153
1288
  value = resolveThemeColor(candidate, theme, desc.themeKeys);
1154
- if (!value)
1155
- return;
1156
1289
  }
1290
+ if (value === null)
1291
+ return;
1157
1292
  return desc.handle(value);
1158
1293
  });
1294
+ suggest(classRoot, () => [
1295
+ {
1296
+ values: ["current", "transparent"],
1297
+ valueThemeKeys: desc.themeKeys,
1298
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
1299
+ modifierThemeKeys: ["--opacity"]
1300
+ }
1301
+ ]);
1159
1302
  }
1160
1303
  staticUtility("sr-only", [
1161
1304
  ["position", "absolute"],
@@ -1312,6 +1455,13 @@ function createUtilities(theme) {
1312
1455
  themeKeys: ["--z-index"],
1313
1456
  handle: (value) => [decl("z-index", value)]
1314
1457
  });
1458
+ suggest("z", () => [
1459
+ {
1460
+ supportsNegative: true,
1461
+ values: ["0", "10", "20", "30", "40", "50"],
1462
+ valueThemeKeys: ["--z-index"]
1463
+ }
1464
+ ]);
1315
1465
  staticUtility("order-first", [["order", "calc(-infinity)"]]);
1316
1466
  staticUtility("order-last", [["order", "calc(infinity)"]]);
1317
1467
  staticUtility("order-none", [["order", "0"]]);
@@ -1321,6 +1471,13 @@ function createUtilities(theme) {
1321
1471
  themeKeys: ["--order"],
1322
1472
  handle: (value) => [decl("order", value)]
1323
1473
  });
1474
+ suggest("order", () => [
1475
+ {
1476
+ supportsNegative: true,
1477
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
1478
+ valueThemeKeys: ["--order"]
1479
+ }
1480
+ ]);
1324
1481
  staticUtility("col-auto", [["grid-column", "auto"]]);
1325
1482
  functionalUtility("col", {
1326
1483
  themeKeys: ["--grid-column"],
@@ -1344,6 +1501,24 @@ function createUtilities(theme) {
1344
1501
  themeKeys: ["--grid-column-end"],
1345
1502
  handle: (value) => [decl("grid-column-end", value)]
1346
1503
  });
1504
+ suggest("col-span", () => [
1505
+ {
1506
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
1507
+ valueThemeKeys: []
1508
+ }
1509
+ ]);
1510
+ suggest("col-start", () => [
1511
+ {
1512
+ values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
1513
+ valueThemeKeys: ["--grid-column-start"]
1514
+ }
1515
+ ]);
1516
+ suggest("col-end", () => [
1517
+ {
1518
+ values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
1519
+ valueThemeKeys: ["--grid-column-end"]
1520
+ }
1521
+ ]);
1347
1522
  staticUtility("row-auto", [["grid-row", "auto"]]);
1348
1523
  functionalUtility("row", {
1349
1524
  themeKeys: ["--grid-row"],
@@ -1367,6 +1542,24 @@ function createUtilities(theme) {
1367
1542
  themeKeys: ["--grid-row-end"],
1368
1543
  handle: (value) => [decl("grid-row-end", value)]
1369
1544
  });
1545
+ suggest("row-span", () => [
1546
+ {
1547
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
1548
+ valueThemeKeys: []
1549
+ }
1550
+ ]);
1551
+ suggest("row-start", () => [
1552
+ {
1553
+ values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
1554
+ valueThemeKeys: ["--grid-row-start"]
1555
+ }
1556
+ ]);
1557
+ suggest("row-end", () => [
1558
+ {
1559
+ values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
1560
+ valueThemeKeys: ["--grid-row-end"]
1561
+ }
1562
+ ]);
1370
1563
  staticUtility("float-start", [["float", "start"]]);
1371
1564
  staticUtility("float-end", [["float", "end"]]);
1372
1565
  staticUtility("float-right", [["float", "right"]]);
@@ -1420,6 +1613,12 @@ function createUtilities(theme) {
1420
1613
  decl("-webkit-line-clamp", value)
1421
1614
  ]
1422
1615
  });
1616
+ suggest("line-clamp", () => [
1617
+ {
1618
+ values: ["1", "2", "3", "4", "5", "6"],
1619
+ valueThemeKeys: ["--line-clamp"]
1620
+ }
1621
+ ]);
1423
1622
  staticUtility("block", [["display", "block"]]);
1424
1623
  staticUtility("inline-block", [["display", "inline-block"]]);
1425
1624
  staticUtility("inline", [["display", "inline"]]);
@@ -1591,6 +1790,20 @@ function createUtilities(theme) {
1591
1790
  handleBareValue: ({ value }) => value,
1592
1791
  handle: (value) => [decl("flex-grow", value)]
1593
1792
  });
1793
+ suggest("shrink", () => [
1794
+ {
1795
+ values: ["0"],
1796
+ valueThemeKeys: [],
1797
+ hasDefaultValue: true
1798
+ }
1799
+ ]);
1800
+ suggest("grow", () => [
1801
+ {
1802
+ values: ["0"],
1803
+ valueThemeKeys: [],
1804
+ hasDefaultValue: true
1805
+ }
1806
+ ]);
1594
1807
  staticUtility("basis-auto", [["flex-basis", "auto"]]);
1595
1808
  staticUtility("basis-full", [["flex-basis", "100%"]]);
1596
1809
  functionalUtility("basis", {
@@ -1667,7 +1880,7 @@ function createUtilities(theme) {
1667
1880
  translateProperties(),
1668
1881
  decl("--tw-translate-x", value),
1669
1882
  decl("--tw-translate-y", value),
1670
- decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1883
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1671
1884
  ]
1672
1885
  });
1673
1886
  utilities.static("translate-x-full", (candidate) => {
@@ -1685,7 +1898,7 @@ function createUtilities(theme) {
1685
1898
  handle: (value) => [
1686
1899
  translateProperties(),
1687
1900
  decl("--tw-translate-x", value),
1688
- decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1901
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1689
1902
  ]
1690
1903
  });
1691
1904
  utilities.static("translate-y-full", (candidate) => {
@@ -1703,7 +1916,7 @@ function createUtilities(theme) {
1703
1916
  handle: (value) => [
1704
1917
  translateProperties(),
1705
1918
  decl("--tw-translate-y", value),
1706
- decl("translate", `var(--tw-translate-x) var(--tw-translate-y)`)
1919
+ decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
1707
1920
  ]
1708
1921
  });
1709
1922
  functionalUtility("rotate", {
@@ -1712,6 +1925,13 @@ function createUtilities(theme) {
1712
1925
  handleBareValue: ({ value }) => `${value}deg`,
1713
1926
  handle: (value) => [decl("rotate", value)]
1714
1927
  });
1928
+ suggest("rotate", () => [
1929
+ {
1930
+ supportsNegative: true,
1931
+ values: ["0", "1", "2", "3", "6", "12", "45", "90", "180"],
1932
+ valueThemeKeys: ["--rotate"]
1933
+ }
1934
+ ]);
1715
1935
  let skewProperties = () => atRoot([property("--tw-skew-x", "0deg", "<angle>"), property("--tw-skew-y", "0deg", "<angle>")]);
1716
1936
  functionalUtility("skew", {
1717
1937
  supportsNegative: true,
@@ -1744,6 +1964,27 @@ function createUtilities(theme) {
1744
1964
  decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
1745
1965
  ]
1746
1966
  });
1967
+ suggest("skew", () => [
1968
+ {
1969
+ supportsNegative: true,
1970
+ values: ["0", "1", "2", "3", "6", "12"],
1971
+ valueThemeKeys: ["--skew"]
1972
+ }
1973
+ ]);
1974
+ suggest("skew-x", () => [
1975
+ {
1976
+ supportsNegative: true,
1977
+ values: ["0", "1", "2", "3", "6", "12"],
1978
+ valueThemeKeys: ["--skew"]
1979
+ }
1980
+ ]);
1981
+ suggest("skew-y", () => [
1982
+ {
1983
+ supportsNegative: true,
1984
+ values: ["0", "1", "2", "3", "6", "12"],
1985
+ valueThemeKeys: ["--skew"]
1986
+ }
1987
+ ]);
1747
1988
  let scaleProperties = () => atRoot([property("--tw-scale-x", "1", "<number>"), property("--tw-scale-y", "1", "<number>")]);
1748
1989
  functionalUtility("scale", {
1749
1990
  supportsNegative: true,
@@ -1776,6 +2017,27 @@ function createUtilities(theme) {
1776
2017
  decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
1777
2018
  ]
1778
2019
  });
2020
+ suggest("scale", () => [
2021
+ {
2022
+ supportsNegative: true,
2023
+ values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
2024
+ valueThemeKeys: ["--scale"]
2025
+ }
2026
+ ]);
2027
+ suggest("scale-x", () => [
2028
+ {
2029
+ supportsNegative: true,
2030
+ values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
2031
+ valueThemeKeys: ["--scale"]
2032
+ }
2033
+ ]);
2034
+ suggest("scale-y", () => [
2035
+ {
2036
+ supportsNegative: true,
2037
+ values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
2038
+ valueThemeKeys: ["--scale"]
2039
+ }
2040
+ ]);
1779
2041
  staticUtility("transform", [
1780
2042
  skewProperties,
1781
2043
  ["transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))"]
@@ -1861,11 +2123,11 @@ function createUtilities(theme) {
1861
2123
  ["user-select", value]
1862
2124
  ]);
1863
2125
  }
1864
- staticUtility(`resize-none`, [["resize", "none"]]);
1865
- staticUtility(`resize-both`, [["resize", "both"]]);
1866
- staticUtility(`resize-x`, [["resize", "horizontal"]]);
1867
- staticUtility(`resize-y`, [["resize", "vertical"]]);
1868
- staticUtility(`snap-none`, [["scroll-snap-type", "none"]]);
2126
+ staticUtility("resize-none", [["resize", "none"]]);
2127
+ staticUtility("resize-both", [["resize", "both"]]);
2128
+ staticUtility("resize-x", [["resize", "horizontal"]]);
2129
+ staticUtility("resize-y", [["resize", "vertical"]]);
2130
+ staticUtility("snap-none", [["scroll-snap-type", "none"]]);
1869
2131
  let snapProperties = () => atRoot([property("--tw-scroll-snap-strictness", "proximity", "*")]);
1870
2132
  for (let value of ["x", "y", "both"]) {
1871
2133
  staticUtility(`snap-${value}`, [
@@ -1873,8 +2135,8 @@ function createUtilities(theme) {
1873
2135
  ["scroll-snap-type", `${value} var(--tw-scroll-snap-strictness)`]
1874
2136
  ]);
1875
2137
  }
1876
- staticUtility(`snap-mandatory`, [snapProperties, ["--tw-scroll-snap-strictness", "mandatory"]]);
1877
- staticUtility(`snap-proximity`, [snapProperties, ["--tw-scroll-snap-strictness", "proximity"]]);
2138
+ staticUtility("snap-mandatory", [snapProperties, ["--tw-scroll-snap-strictness", "mandatory"]]);
2139
+ staticUtility("snap-proximity", [snapProperties, ["--tw-scroll-snap-strictness", "proximity"]]);
1878
2140
  staticUtility("snap-align-none", [["scroll-snap-align", "none"]]);
1879
2141
  staticUtility("snap-start", [["scroll-snap-align", "start"]]);
1880
2142
  staticUtility("snap-end", [["scroll-snap-align", "end"]]);
@@ -1993,6 +2255,12 @@ function createUtilities(theme) {
1993
2255
  handleBareValue: ({ value }) => value,
1994
2256
  handle: (value) => [decl("columns", value)]
1995
2257
  });
2258
+ suggest("columns", () => [
2259
+ {
2260
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
2261
+ valueThemeKeys: ["--columns", "--width"]
2262
+ }
2263
+ ]);
1996
2264
  for (let value of ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"]) {
1997
2265
  staticUtility(`break-before-${value}`, [["break-before", value]]);
1998
2266
  }
@@ -2037,6 +2305,18 @@ function createUtilities(theme) {
2037
2305
  handleBareValue: ({ value }) => `repeat(${value}, minmax(0, 1fr))`,
2038
2306
  handle: (value) => [decl("grid-template-rows", value)]
2039
2307
  });
2308
+ suggest("grid-cols", () => [
2309
+ {
2310
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
2311
+ valueThemeKeys: ["--grid-template-columns"]
2312
+ }
2313
+ ]);
2314
+ suggest("grid-rows", () => [
2315
+ {
2316
+ values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
2317
+ valueThemeKeys: ["--grid-template-rows"]
2318
+ }
2319
+ ]);
2040
2320
  staticUtility("flex-row", [["flex-direction", "row"]]);
2041
2321
  staticUtility("flex-row-reverse", [["flex-direction", "row-reverse"]]);
2042
2322
  staticUtility("flex-col", [["flex-direction", "column"]]);
@@ -2135,48 +2415,6 @@ function createUtilities(theme) {
2135
2415
  decl("--tw-space-y-reverse", "1")
2136
2416
  ])
2137
2417
  ]);
2138
- functionalUtility("divide-x", {
2139
- defaultValue: theme.get(["--default-border-width"]) ?? "1px",
2140
- themeKeys: ["--divide-width", "--border-width"],
2141
- handleBareValue: ({ value }) => `${value}px`,
2142
- handle: (value) => [
2143
- atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
2144
- rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2145
- decl("--tw-sort", "divide-x-width"),
2146
- decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
2147
- decl("border-inline-start-width", `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`)
2148
- ])
2149
- ]
2150
- });
2151
- functionalUtility("divide-y", {
2152
- defaultValue: theme.get(["--default-border-width"]) ?? "1px",
2153
- themeKeys: ["--divide-width", "--border-width"],
2154
- handleBareValue: ({ value }) => `${value}px`,
2155
- handle: (value) => [
2156
- atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
2157
- rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2158
- decl("--tw-sort", "divide-y-width"),
2159
- decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
2160
- decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
2161
- ])
2162
- ]
2163
- });
2164
- staticUtility("divide-x-reverse", [
2165
- () => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
2166
- () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
2167
- ]);
2168
- staticUtility("divide-y-reverse", [
2169
- () => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
2170
- () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
2171
- ]);
2172
- for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
2173
- staticUtility(`divide-${value}`, [
2174
- () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2175
- decl("--tw-sort", "divide-style"),
2176
- decl("border-style", value)
2177
- ])
2178
- ]);
2179
- }
2180
2418
  colorUtility("accent", {
2181
2419
  themeKeys: ["--accent-color", "--color"],
2182
2420
  handle: (value) => [decl("accent-color", value)]
@@ -2220,33 +2458,33 @@ function createUtilities(theme) {
2220
2458
  staticUtility(`overscroll-x-${value}`, [["overscroll-behavior-x", value]]);
2221
2459
  staticUtility(`overscroll-y-${value}`, [["overscroll-behavior-y", value]]);
2222
2460
  }
2223
- staticUtility(`scroll-auto`, [["scroll-behavior", "auto"]]);
2224
- staticUtility(`scroll-smooth`, [["scroll-behavior", "smooth"]]);
2225
- staticUtility(`truncate`, [
2461
+ staticUtility("scroll-auto", [["scroll-behavior", "auto"]]);
2462
+ staticUtility("scroll-smooth", [["scroll-behavior", "smooth"]]);
2463
+ staticUtility("truncate", [
2226
2464
  ["overflow", "hidden"],
2227
2465
  ["text-overflow", "ellipsis"],
2228
2466
  ["white-space", "nowrap"]
2229
2467
  ]);
2230
- staticUtility(`text-ellipsis`, [["text-overflow", "ellipsis"]]);
2231
- staticUtility(`text-clip`, [["text-overflow", "clip"]]);
2232
- staticUtility(`hyphens-none`, [
2468
+ staticUtility("text-ellipsis", [["text-overflow", "ellipsis"]]);
2469
+ staticUtility("text-clip", [["text-overflow", "clip"]]);
2470
+ staticUtility("hyphens-none", [
2233
2471
  ["-webkit-hyphens", "none"],
2234
2472
  ["hyphens", "none"]
2235
2473
  ]);
2236
- staticUtility(`hyphens-manual`, [
2474
+ staticUtility("hyphens-manual", [
2237
2475
  ["-webkit-hyphens", "manual"],
2238
2476
  ["hyphens", "manual"]
2239
2477
  ]);
2240
- staticUtility(`hyphens-auto`, [
2478
+ staticUtility("hyphens-auto", [
2241
2479
  ["-webkit-hyphens", "auto"],
2242
2480
  ["hyphens", "auto"]
2243
2481
  ]);
2244
- staticUtility(`whitespace-normal`, [["white-space", "normal"]]);
2245
- staticUtility(`whitespace-nowrap`, [["white-space", "nowrap"]]);
2246
- staticUtility(`whitespace-pre`, [["white-space", "pre"]]);
2247
- staticUtility(`whitespace-pre-line`, [["white-space", "pre-line"]]);
2248
- staticUtility(`whitespace-pre-wrap`, [["white-space", "pre-wrap"]]);
2249
- staticUtility(`whitespace-break-spaces`, [["white-space", "break-spaces"]]);
2482
+ staticUtility("whitespace-normal", [["white-space", "normal"]]);
2483
+ staticUtility("whitespace-nowrap", [["white-space", "nowrap"]]);
2484
+ staticUtility("whitespace-pre", [["white-space", "pre"]]);
2485
+ staticUtility("whitespace-pre-line", [["white-space", "pre-line"]]);
2486
+ staticUtility("whitespace-pre-wrap", [["white-space", "pre-wrap"]]);
2487
+ staticUtility("whitespace-break-spaces", [["white-space", "break-spaces"]]);
2250
2488
  staticUtility("text-wrap", [["text-wrap", "wrap"]]);
2251
2489
  staticUtility("text-nowrap", [["text-wrap", "nowrap"]]);
2252
2490
  staticUtility("text-balance", [["text-wrap", "balance"]]);
@@ -2336,88 +2574,201 @@ function createUtilities(theme) {
2336
2574
  themeKeys: ["--radius"],
2337
2575
  handle: (value) => [decl("border-bottom-left-radius", value)]
2338
2576
  });
2339
- staticUtility("border-solid", [["border-style", "solid"]]);
2340
- staticUtility("border-dashed", [["border-style", "dashed"]]);
2341
- staticUtility("border-dotted", [["border-style", "dotted"]]);
2342
- staticUtility("border-double", [["border-style", "double"]]);
2343
- staticUtility("border-hidden", [["border-style", "hidden"]]);
2344
- staticUtility("border-none", [["border-style", "none"]]);
2345
- function borderSideUtility(classRoot, desc) {
2346
- utilities.functional(classRoot, (candidate) => {
2347
- if (candidate.negative) {
2348
- return;
2349
- }
2350
- if (!candidate.value) {
2351
- let value = theme.get(["--default-border-width"]) ?? "1px";
2352
- return desc.width(value);
2353
- }
2354
- if (candidate.value.kind === "arbitrary") {
2355
- let value = candidate.value.value;
2356
- let type = candidate.value.dataType ?? inferDataType(value, ["color", "line-width", "length"]);
2357
- switch (type) {
2358
- case "line-width":
2359
- case "length": {
2360
- return desc.width(value);
2577
+ staticUtility("border-solid", [
2578
+ ["--tw-border-style", "solid"],
2579
+ ["border-style", "solid"]
2580
+ ]);
2581
+ staticUtility("border-dashed", [
2582
+ ["--tw-border-style", "dashed"],
2583
+ ["border-style", "dashed"]
2584
+ ]);
2585
+ staticUtility("border-dotted", [
2586
+ ["--tw-border-style", "dotted"],
2587
+ ["border-style", "dotted"]
2588
+ ]);
2589
+ staticUtility("border-double", [
2590
+ ["--tw-border-style", "double"],
2591
+ ["border-style", "double"]
2592
+ ]);
2593
+ staticUtility("border-hidden", [
2594
+ ["--tw-border-style", "hidden"],
2595
+ ["border-style", "hidden"]
2596
+ ]);
2597
+ staticUtility("border-none", [
2598
+ ["--tw-border-style", "none"],
2599
+ ["border-style", "none"]
2600
+ ]);
2601
+ {
2602
+ let borderSideUtility2 = function(classRoot, desc) {
2603
+ utilities.functional(classRoot, (candidate) => {
2604
+ if (candidate.negative)
2605
+ return;
2606
+ if (!candidate.value) {
2607
+ let value = theme.get(["--default-border-width"]) ?? "1px";
2608
+ let decls = desc.width(value);
2609
+ if (!decls)
2610
+ return;
2611
+ return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
2612
+ }
2613
+ if (candidate.value.kind === "arbitrary") {
2614
+ let value = candidate.value.value;
2615
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "line-width", "length"]);
2616
+ switch (type) {
2617
+ case "line-width":
2618
+ case "length": {
2619
+ let decls = desc.width(value);
2620
+ if (!decls)
2621
+ return;
2622
+ return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
2623
+ }
2624
+ default: {
2625
+ value = asColor(value, candidate.modifier, theme);
2626
+ if (value === null)
2627
+ return;
2628
+ return desc.color(value);
2629
+ }
2361
2630
  }
2362
- default: {
2363
- value = asColor(value, candidate.modifier, theme);
2631
+ }
2632
+ {
2633
+ let value = resolveThemeColor(candidate, theme, ["--border-color", "--color"]);
2634
+ if (value) {
2364
2635
  return desc.color(value);
2365
2636
  }
2366
2637
  }
2367
- }
2638
+ {
2639
+ let value = theme.resolve(candidate.value.value, ["--border-width"]);
2640
+ if (value) {
2641
+ let decls = desc.width(value);
2642
+ if (!decls)
2643
+ return;
2644
+ return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
2645
+ }
2646
+ if (!Number.isNaN(Number(candidate.value.value))) {
2647
+ let decls = desc.width(`${candidate.value.value}px`);
2648
+ if (!decls)
2649
+ return;
2650
+ return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
2651
+ }
2652
+ }
2653
+ });
2654
+ suggest(classRoot, () => [
2655
+ {
2656
+ values: ["current", "transparent"],
2657
+ valueThemeKeys: ["--border-color", "--color"],
2658
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
2659
+ modifierThemeKeys: ["--opacity"],
2660
+ hasDefaultValue: true
2661
+ },
2662
+ {
2663
+ values: [],
2664
+ valueThemeKeys: ["--border-width"]
2665
+ }
2666
+ ]);
2667
+ };
2668
+ let borderProperties = () => {
2669
+ return atRoot([property("--tw-border-style", "solid", "<custom-ident>")]);
2670
+ };
2671
+ borderSideUtility2("border", {
2672
+ width: (value) => [decl("border-width", value)],
2673
+ color: (value) => [decl("border-color", value)]
2674
+ });
2675
+ borderSideUtility2("border-x", {
2676
+ width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
2677
+ color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
2678
+ });
2679
+ borderSideUtility2("border-y", {
2680
+ width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
2681
+ color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
2682
+ });
2683
+ borderSideUtility2("border-s", {
2684
+ width: (value) => [decl("border-inline-start-width", value)],
2685
+ color: (value) => [decl("border-inline-start-color", value)]
2686
+ });
2687
+ borderSideUtility2("border-e", {
2688
+ width: (value) => [decl("border-inline-end-width", value)],
2689
+ color: (value) => [decl("border-inline-end-color", value)]
2690
+ });
2691
+ borderSideUtility2("border-t", {
2692
+ width: (value) => [decl("border-top-width", value)],
2693
+ color: (value) => [decl("border-top-color", value)]
2694
+ });
2695
+ borderSideUtility2("border-r", {
2696
+ width: (value) => [decl("border-right-width", value)],
2697
+ color: (value) => [decl("border-right-color", value)]
2698
+ });
2699
+ borderSideUtility2("border-b", {
2700
+ width: (value) => [decl("border-bottom-width", value)],
2701
+ color: (value) => [decl("border-bottom-color", value)]
2702
+ });
2703
+ borderSideUtility2("border-l", {
2704
+ width: (value) => [decl("border-left-width", value)],
2705
+ color: (value) => [decl("border-left-color", value)]
2706
+ });
2707
+ functionalUtility("divide-x", {
2708
+ defaultValue: theme.get(["--default-border-width"]) ?? "1px",
2709
+ themeKeys: ["--divide-width", "--border-width"],
2710
+ handleBareValue: ({ value }) => `${value}px`,
2711
+ handle: (value) => [
2712
+ atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
2713
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2714
+ decl("--tw-sort", "divide-x-width"),
2715
+ borderProperties(),
2716
+ decl("border-style", "var(--tw-border-style)"),
2717
+ decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
2718
+ decl(
2719
+ "border-inline-start-width",
2720
+ `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
2721
+ )
2722
+ ])
2723
+ ]
2724
+ });
2725
+ functionalUtility("divide-y", {
2726
+ defaultValue: theme.get(["--default-border-width"]) ?? "1px",
2727
+ themeKeys: ["--divide-width", "--border-width"],
2728
+ handleBareValue: ({ value }) => `${value}px`,
2729
+ handle: (value) => [
2730
+ atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
2731
+ rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2732
+ decl("--tw-sort", "divide-y-width"),
2733
+ borderProperties(),
2734
+ decl("border-style", "var(--tw-border-style)"),
2735
+ decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
2736
+ decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
2737
+ ])
2738
+ ]
2739
+ });
2740
+ suggest("divide-x", () => [
2368
2741
  {
2369
- let value = resolveThemeColor(candidate, theme, ["--border-color", "--color"]);
2370
- if (value) {
2371
- return desc.color(value);
2372
- }
2742
+ values: ["0", "2", "4", "8"],
2743
+ valueThemeKeys: ["--divide-width", "--border-width"],
2744
+ hasDefaultValue: true
2373
2745
  }
2746
+ ]);
2747
+ suggest("divide-y", () => [
2374
2748
  {
2375
- let value = theme.resolve(candidate.value.value, ["--border-width"]);
2376
- if (value) {
2377
- return desc.width(value);
2378
- }
2379
- if (!isNaN(Number(candidate.value.value))) {
2380
- return desc.width(`${candidate.value.value}px`);
2381
- }
2749
+ values: ["0", "2", "4", "8"],
2750
+ valueThemeKeys: ["--divide-width", "--border-width"],
2751
+ hasDefaultValue: true
2382
2752
  }
2383
- });
2753
+ ]);
2754
+ staticUtility("divide-x-reverse", [
2755
+ () => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
2756
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
2757
+ ]);
2758
+ staticUtility("divide-y-reverse", [
2759
+ () => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
2760
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
2761
+ ]);
2762
+ for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
2763
+ staticUtility(`divide-${value}`, [
2764
+ () => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
2765
+ decl("--tw-sort", "divide-style"),
2766
+ decl("--tw-border-style", value),
2767
+ decl("border-style", value)
2768
+ ])
2769
+ ]);
2770
+ }
2384
2771
  }
2385
- borderSideUtility("border", {
2386
- width: (value) => [decl("border-width", value)],
2387
- color: (value) => [decl("border-color", value)]
2388
- });
2389
- borderSideUtility("border-x", {
2390
- width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
2391
- color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
2392
- });
2393
- borderSideUtility("border-y", {
2394
- width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
2395
- color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
2396
- });
2397
- borderSideUtility("border-s", {
2398
- width: (value) => [decl("border-inline-start-width", value)],
2399
- color: (value) => [decl("border-inline-start-color", value)]
2400
- });
2401
- borderSideUtility("border-e", {
2402
- width: (value) => [decl("border-inline-end-width", value)],
2403
- color: (value) => [decl("border-inline-end-color", value)]
2404
- });
2405
- borderSideUtility("border-t", {
2406
- width: (value) => [decl("border-top-width", value)],
2407
- color: (value) => [decl("border-top-color", value)]
2408
- });
2409
- borderSideUtility("border-r", {
2410
- width: (value) => [decl("border-right-width", value)],
2411
- color: (value) => [decl("border-right-color", value)]
2412
- });
2413
- borderSideUtility("border-b", {
2414
- width: (value) => [decl("border-bottom-width", value)],
2415
- color: (value) => [decl("border-bottom-color", value)]
2416
- });
2417
- borderSideUtility("border-l", {
2418
- width: (value) => [decl("border-left-width", value)],
2419
- color: (value) => [decl("border-left-color", value)]
2420
- });
2421
2772
  staticUtility("bg-inherit", [["background-color", "inherit"]]);
2422
2773
  staticUtility("bg-transparent", [["background-color", "transparent"]]);
2423
2774
  staticUtility("bg-auto", [["background-size", "auto"]]);
@@ -2457,9 +2808,8 @@ function createUtilities(theme) {
2457
2808
  ]);
2458
2809
  }
2459
2810
  utilities.functional("bg", (candidate) => {
2460
- if (candidate.negative || !candidate.value) {
2811
+ if (candidate.negative || !candidate.value)
2461
2812
  return;
2462
- }
2463
2813
  if (candidate.value.kind === "arbitrary") {
2464
2814
  let value = candidate.value.value;
2465
2815
  let type = candidate.value.dataType ?? inferDataType(value, [
@@ -2487,6 +2837,8 @@ function createUtilities(theme) {
2487
2837
  }
2488
2838
  default: {
2489
2839
  value = asColor(value, candidate.modifier, theme);
2840
+ if (value === null)
2841
+ return;
2490
2842
  return [decl("background-color", value)];
2491
2843
  }
2492
2844
  }
@@ -2504,6 +2856,18 @@ function createUtilities(theme) {
2504
2856
  }
2505
2857
  }
2506
2858
  });
2859
+ suggest("bg", () => [
2860
+ {
2861
+ values: ["current", "transparent"],
2862
+ valueThemeKeys: ["--background-color", "--color"],
2863
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
2864
+ modifierThemeKeys: ["--opacity"]
2865
+ },
2866
+ {
2867
+ values: [],
2868
+ valueThemeKeys: ["--background-image"]
2869
+ }
2870
+ ]);
2507
2871
  let gradientStopProperties = () => {
2508
2872
  return atRoot([
2509
2873
  property("--tw-gradient-from", "#0000", "<color>"),
@@ -2520,9 +2884,8 @@ function createUtilities(theme) {
2520
2884
  };
2521
2885
  function gradientStopUtility(classRoot, desc) {
2522
2886
  utilities.functional(classRoot, (candidate) => {
2523
- if (candidate.negative || !candidate.value) {
2887
+ if (candidate.negative || !candidate.value)
2524
2888
  return;
2525
- }
2526
2889
  if (candidate.value.kind === "arbitrary") {
2527
2890
  let value = candidate.value.value;
2528
2891
  let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
@@ -2533,6 +2896,8 @@ function createUtilities(theme) {
2533
2896
  }
2534
2897
  default: {
2535
2898
  value = asColor(value, candidate.modifier, theme);
2899
+ if (value === null)
2900
+ return;
2536
2901
  return desc.color(value);
2537
2902
  }
2538
2903
  }
@@ -2552,6 +2917,18 @@ function createUtilities(theme) {
2552
2917
  }
2553
2918
  }
2554
2919
  });
2920
+ suggest(classRoot, () => [
2921
+ {
2922
+ values: ["current", "transparent"],
2923
+ valueThemeKeys: ["--background-color", "--color"],
2924
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
2925
+ modifierThemeKeys: ["--opacity"]
2926
+ },
2927
+ {
2928
+ values: Array.from({ length: 21 }, (_, index) => `${index * 5}%`),
2929
+ valueThemeKeys: ["--gradient-color-stop-positions"]
2930
+ }
2931
+ ]);
2555
2932
  }
2556
2933
  gradientStopUtility("from", {
2557
2934
  color: (value) => [
@@ -2573,9 +2950,9 @@ function createUtilities(theme) {
2573
2950
  decl("--tw-gradient-via", value),
2574
2951
  decl(
2575
2952
  "--tw-gradient-via-stops",
2576
- `var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)`
2953
+ "var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)"
2577
2954
  ),
2578
- decl("--tw-gradient-stops", `var(--tw-gradient-via-stops)`)
2955
+ decl("--tw-gradient-stops", "var(--tw-gradient-via-stops)")
2579
2956
  ],
2580
2957
  position: (value) => [gradientStopProperties(), decl("--tw-gradient-via-position", value)]
2581
2958
  });
@@ -2635,25 +3012,34 @@ function createUtilities(theme) {
2635
3012
  staticUtility(`bg-blend-${value}`, [["background-blend-mode", value]]);
2636
3013
  staticUtility(`mix-blend-${value}`, [["mix-blend-mode", value]]);
2637
3014
  }
2638
- staticUtility(`mix-blend-plus-darker`, [["mix-blend-mode", "plus-darker"]]);
2639
- staticUtility(`mix-blend-plus-lighter`, [["mix-blend-mode", "plus-lighter"]]);
3015
+ staticUtility("mix-blend-plus-darker", [["mix-blend-mode", "plus-darker"]]);
3016
+ staticUtility("mix-blend-plus-lighter", [["mix-blend-mode", "plus-lighter"]]);
2640
3017
  utilities.functional("fill", (candidate) => {
2641
- if (candidate.negative || !candidate.value) {
3018
+ if (candidate.negative || !candidate.value)
2642
3019
  return;
2643
- }
2644
3020
  if (candidate.value.kind === "arbitrary") {
2645
- return [decl("fill", asColor(candidate.value.value, candidate.modifier, theme))];
3021
+ let value2 = asColor(candidate.value.value, candidate.modifier, theme);
3022
+ if (value2 === null)
3023
+ return;
3024
+ return [decl("fill", value2)];
2646
3025
  }
2647
3026
  let value = resolveThemeColor(candidate, theme, ["--fill", "--color"]);
2648
3027
  if (value) {
2649
3028
  return [decl("fill", value)];
2650
3029
  }
2651
3030
  });
3031
+ suggest("fill", () => [
3032
+ {
3033
+ values: ["current", "transparent"],
3034
+ valueThemeKeys: ["--fill", "--color"],
3035
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
3036
+ modifierThemeKeys: ["--opacity"]
3037
+ }
3038
+ ]);
2652
3039
  staticUtility("stroke-none", [["stroke", "none"]]);
2653
3040
  utilities.functional("stroke", (candidate) => {
2654
- if (candidate.negative || !candidate.value) {
3041
+ if (candidate.negative || !candidate.value)
2655
3042
  return;
2656
- }
2657
3043
  if (candidate.value.kind === "arbitrary") {
2658
3044
  let value = candidate.value.value;
2659
3045
  let type = candidate.value.dataType ?? inferDataType(value, ["color", "number", "length", "percentage"]);
@@ -2665,6 +3051,8 @@ function createUtilities(theme) {
2665
3051
  }
2666
3052
  default: {
2667
3053
  value = asColor(candidate.value.value, candidate.modifier, theme);
3054
+ if (value === null)
3055
+ return;
2668
3056
  return [decl("stroke", value)];
2669
3057
  }
2670
3058
  }
@@ -2679,11 +3067,23 @@ function createUtilities(theme) {
2679
3067
  let value = theme.resolve(candidate.value.value, ["--stroke-width"]);
2680
3068
  if (value) {
2681
3069
  return [decl("stroke-width", value)];
2682
- } else if (!isNaN(Number(candidate.value.value))) {
3070
+ } else if (!Number.isNaN(Number(candidate.value.value))) {
2683
3071
  return [decl("stroke-width", candidate.value.value)];
2684
3072
  }
2685
3073
  }
2686
3074
  });
3075
+ suggest("stroke", () => [
3076
+ {
3077
+ values: ["current", "transparent"],
3078
+ valueThemeKeys: ["--stroke", "--color"],
3079
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
3080
+ modifierThemeKeys: ["--opacity"]
3081
+ },
3082
+ {
3083
+ values: ["0", "1", "2", "3"],
3084
+ valueThemeKeys: ["--stroke-width"]
3085
+ }
3086
+ ]);
2687
3087
  staticUtility("object-contain", [["object-fit", "contain"]]);
2688
3088
  staticUtility("object-cover", [["object-fit", "cover"]]);
2689
3089
  staticUtility("object-fill", [["object-fit", "fill"]]);
@@ -2762,9 +3162,8 @@ function createUtilities(theme) {
2762
3162
  handle: (value) => [decl("vertical-align", value)]
2763
3163
  });
2764
3164
  utilities.functional("font", (candidate) => {
2765
- if (candidate.negative || !candidate.value) {
3165
+ if (candidate.negative || !candidate.value)
2766
3166
  return;
2767
- }
2768
3167
  if (candidate.value.kind === "arbitrary") {
2769
3168
  let value = candidate.value.value;
2770
3169
  let type = candidate.value.dataType ?? inferDataType(value, ["number", "generic-name", "family-name"]);
@@ -2832,6 +3231,26 @@ function createUtilities(theme) {
2832
3231
  }
2833
3232
  }
2834
3233
  });
3234
+ suggest("font", () => [
3235
+ {
3236
+ values: [],
3237
+ valueThemeKeys: ["--font-family"]
3238
+ },
3239
+ {
3240
+ values: [
3241
+ "thin",
3242
+ "extralight",
3243
+ "light",
3244
+ "normal",
3245
+ "medium",
3246
+ "semibold",
3247
+ "bold",
3248
+ "extrabold",
3249
+ "black"
3250
+ ],
3251
+ valueThemeKeys: ["--font-weight"]
3252
+ }
3253
+ ]);
2835
3254
  staticUtility("uppercase", [["text-transform", "uppercase"]]);
2836
3255
  staticUtility("lowercase", [["text-transform", "lowercase"]]);
2837
3256
  staticUtility("capitalize", [["text-transform", "capitalize"]]);
@@ -2856,9 +3275,8 @@ function createUtilities(theme) {
2856
3275
  staticUtility("decoration-auto", [["text-decoration-thickness", "auto"]]);
2857
3276
  staticUtility("decoration-from-font", [["text-decoration-thickness", "from-font"]]);
2858
3277
  utilities.functional("decoration", (candidate) => {
2859
- if (candidate.negative || !candidate.value) {
3278
+ if (candidate.negative || !candidate.value)
2860
3279
  return;
2861
- }
2862
3280
  if (candidate.value.kind === "arbitrary") {
2863
3281
  let value = candidate.value.value;
2864
3282
  let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
@@ -2869,6 +3287,8 @@ function createUtilities(theme) {
2869
3287
  }
2870
3288
  default: {
2871
3289
  value = asColor(value, candidate.modifier, theme);
3290
+ if (value === null)
3291
+ return;
2872
3292
  return [decl("text-decoration-color", value)];
2873
3293
  }
2874
3294
  }
@@ -2878,7 +3298,7 @@ function createUtilities(theme) {
2878
3298
  if (value) {
2879
3299
  return [decl("text-decoration-thickness", value)];
2880
3300
  }
2881
- if (!isNaN(Number(candidate.value.value))) {
3301
+ if (!Number.isNaN(Number(candidate.value.value))) {
2882
3302
  return [decl("text-decoration-thickness", `${candidate.value.value}px`)];
2883
3303
  }
2884
3304
  }
@@ -2889,6 +3309,18 @@ function createUtilities(theme) {
2889
3309
  }
2890
3310
  }
2891
3311
  });
3312
+ suggest("decoration", () => [
3313
+ {
3314
+ values: ["current", "transparent"],
3315
+ valueThemeKeys: ["--text-decoration-color", "--color"],
3316
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
3317
+ modifierThemeKeys: ["--opacity"]
3318
+ },
3319
+ {
3320
+ values: ["0", "1", "2"],
3321
+ valueThemeKeys: ["--text-decoration-thickness"]
3322
+ }
3323
+ ]);
2892
3324
  staticUtility("animate-none", [["animation", "none"]]);
2893
3325
  functionalUtility("animate", {
2894
3326
  themeKeys: ["--animate"],
@@ -2944,14 +3376,13 @@ function createUtilities(theme) {
2944
3376
  ]);
2945
3377
  };
2946
3378
  utilities.functional("filter", (candidate) => {
2947
- if (candidate.negative) {
3379
+ if (candidate.negative)
2948
3380
  return;
2949
- }
2950
3381
  if (candidate.value === null) {
2951
3382
  return [filterProperties(), decl("filter", cssFilterValue)];
2952
3383
  }
2953
3384
  if (candidate.value.kind === "arbitrary") {
2954
- return;
3385
+ return [decl("filter", candidate.value.value)];
2955
3386
  }
2956
3387
  switch (candidate.value.value) {
2957
3388
  case "none":
@@ -2959,9 +3390,8 @@ function createUtilities(theme) {
2959
3390
  }
2960
3391
  });
2961
3392
  utilities.functional("backdrop-filter", (candidate) => {
2962
- if (candidate.negative) {
3393
+ if (candidate.negative)
2963
3394
  return;
2964
- }
2965
3395
  if (candidate.value === null) {
2966
3396
  return [
2967
3397
  backdropFilterProperties(),
@@ -2970,7 +3400,10 @@ function createUtilities(theme) {
2970
3400
  ];
2971
3401
  }
2972
3402
  if (candidate.value.kind === "arbitrary") {
2973
- return;
3403
+ return [
3404
+ decl("-webkit-backdrop-filter", candidate.value.value),
3405
+ decl("backdrop-filter", candidate.value.value)
3406
+ ];
2974
3407
  }
2975
3408
  switch (candidate.value.value) {
2976
3409
  case "none":
@@ -3013,6 +3446,18 @@ function createUtilities(theme) {
3013
3446
  decl("backdrop-filter", cssBackdropFilterValue)
3014
3447
  ]
3015
3448
  });
3449
+ suggest("brightness", () => [
3450
+ {
3451
+ values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
3452
+ valueThemeKeys: ["--brightness"]
3453
+ }
3454
+ ]);
3455
+ suggest("backdrop-brightness", () => [
3456
+ {
3457
+ values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
3458
+ valueThemeKeys: ["--backdrop-brightness", "--brightness"]
3459
+ }
3460
+ ]);
3016
3461
  functionalUtility("contrast", {
3017
3462
  themeKeys: ["--contrast"],
3018
3463
  handleBareValue: ({ value }) => `${value}%`,
@@ -3032,6 +3477,18 @@ function createUtilities(theme) {
3032
3477
  decl("backdrop-filter", cssBackdropFilterValue)
3033
3478
  ]
3034
3479
  });
3480
+ suggest("contrast", () => [
3481
+ {
3482
+ values: ["0", "50", "75", "100", "125", "150", "200"],
3483
+ valueThemeKeys: ["--contrast"]
3484
+ }
3485
+ ]);
3486
+ suggest("backdrop-contrast", () => [
3487
+ {
3488
+ values: ["0", "50", "75", "100", "125", "150", "200"],
3489
+ valueThemeKeys: ["--backdrop-contrast", "--contrast"]
3490
+ }
3491
+ ]);
3035
3492
  functionalUtility("grayscale", {
3036
3493
  themeKeys: ["--grayscale"],
3037
3494
  handleBareValue: ({ value }) => `${value}%`,
@@ -3053,6 +3510,20 @@ function createUtilities(theme) {
3053
3510
  decl("backdrop-filter", cssBackdropFilterValue)
3054
3511
  ]
3055
3512
  });
3513
+ suggest("grayscale", () => [
3514
+ {
3515
+ values: ["0", "25", "50", "75", "100"],
3516
+ valueThemeKeys: ["--grayscale"],
3517
+ hasDefaultValue: true
3518
+ }
3519
+ ]);
3520
+ suggest("backdrop-grayscale", () => [
3521
+ {
3522
+ values: ["0", "25", "50", "75", "100"],
3523
+ valueThemeKeys: ["--backdrop-grayscale", "--grayscale"],
3524
+ hasDefaultValue: true
3525
+ }
3526
+ ]);
3056
3527
  functionalUtility("hue-rotate", {
3057
3528
  themeKeys: ["--hue-rotate"],
3058
3529
  handleBareValue: ({ value }) => `${value}deg`,
@@ -3072,6 +3543,18 @@ function createUtilities(theme) {
3072
3543
  decl("backdrop-filter", cssBackdropFilterValue)
3073
3544
  ]
3074
3545
  });
3546
+ suggest("hue-rotate", () => [
3547
+ {
3548
+ values: ["0", "15", "30", "60", "90", "180"],
3549
+ valueThemeKeys: ["--hue-rotate"]
3550
+ }
3551
+ ]);
3552
+ suggest("backdrop-hue-rotate", () => [
3553
+ {
3554
+ values: ["0", "15", "30", "60", "90", "180"],
3555
+ valueThemeKeys: ["--backdrop-hue-rotate", "--hue-rotate"]
3556
+ }
3557
+ ]);
3075
3558
  functionalUtility("invert", {
3076
3559
  themeKeys: ["--invert"],
3077
3560
  handleBareValue: ({ value }) => `${value}%`,
@@ -3093,6 +3576,20 @@ function createUtilities(theme) {
3093
3576
  decl("backdrop-filter", cssBackdropFilterValue)
3094
3577
  ]
3095
3578
  });
3579
+ suggest("invert", () => [
3580
+ {
3581
+ values: ["0", "25", "50", "75", "100"],
3582
+ valueThemeKeys: ["--invert"],
3583
+ hasDefaultValue: true
3584
+ }
3585
+ ]);
3586
+ suggest("backdrop-invert", () => [
3587
+ {
3588
+ values: ["0", "25", "50", "75", "100"],
3589
+ valueThemeKeys: ["--backdrop-invert", "--invert"],
3590
+ hasDefaultValue: true
3591
+ }
3592
+ ]);
3096
3593
  functionalUtility("saturate", {
3097
3594
  themeKeys: ["--saturate"],
3098
3595
  handleBareValue: ({ value }) => `${value}%`,
@@ -3112,6 +3609,18 @@ function createUtilities(theme) {
3112
3609
  decl("backdrop-filter", cssBackdropFilterValue)
3113
3610
  ]
3114
3611
  });
3612
+ suggest("saturate", () => [
3613
+ {
3614
+ values: ["0", "50", "100", "150", "200"],
3615
+ valueThemeKeys: ["--saturate"]
3616
+ }
3617
+ ]);
3618
+ suggest("backdrop-saturate", () => [
3619
+ {
3620
+ values: ["0", "50", "100", "150", "200"],
3621
+ valueThemeKeys: ["--backdrop-saturate", "--saturate"]
3622
+ }
3623
+ ]);
3115
3624
  functionalUtility("sepia", {
3116
3625
  themeKeys: ["--sepia"],
3117
3626
  handleBareValue: ({ value }) => `${value}%`,
@@ -3133,6 +3642,20 @@ function createUtilities(theme) {
3133
3642
  decl("backdrop-filter", cssBackdropFilterValue)
3134
3643
  ]
3135
3644
  });
3645
+ suggest("sepia", () => [
3646
+ {
3647
+ values: ["0", "50", "100"],
3648
+ valueThemeKeys: ["--sepia"],
3649
+ hasDefaultValue: true
3650
+ }
3651
+ ]);
3652
+ suggest("backdrop-sepia", () => [
3653
+ {
3654
+ values: ["0", "50", "100"],
3655
+ valueThemeKeys: ["--backdrop-sepia", "--sepia"],
3656
+ hasDefaultValue: true
3657
+ }
3658
+ ]);
3136
3659
  functionalUtility("drop-shadow", {
3137
3660
  themeKeys: ["--drop-shadow"],
3138
3661
  handle: (value) => [
@@ -3147,7 +3670,6 @@ function createUtilities(theme) {
3147
3670
  functionalUtility("backdrop-opacity", {
3148
3671
  themeKeys: ["--backdrop-opacity", "--opacity"],
3149
3672
  handleBareValue: ({ value }) => `${value}%`,
3150
- defaultValue: "100%",
3151
3673
  handle: (value) => [
3152
3674
  backdropFilterProperties(),
3153
3675
  decl("--tw-backdrop-opacity", `opacity(${value})`),
@@ -3155,6 +3677,12 @@ function createUtilities(theme) {
3155
3677
  decl("backdrop-filter", cssBackdropFilterValue)
3156
3678
  ]
3157
3679
  });
3680
+ suggest("backdrop-opacity", () => [
3681
+ {
3682
+ values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
3683
+ valueThemeKeys: ["--backdrop-opacity", "--opacity"]
3684
+ }
3685
+ ]);
3158
3686
  }
3159
3687
  {
3160
3688
  let defaultTimingFunction = "var(--default-transition-timing-function)";
@@ -3214,14 +3742,26 @@ function createUtilities(theme) {
3214
3742
  value = theme.resolve(candidate.value.fraction ?? candidate.value.value, [
3215
3743
  "--transition-duration"
3216
3744
  ]);
3217
- if (!value && !isNaN(Number(candidate.value.value))) {
3745
+ if (value === null && !Number.isNaN(Number(candidate.value.value))) {
3218
3746
  value = `${candidate.value.value}ms`;
3219
3747
  }
3220
- if (!value)
3221
- return;
3222
3748
  }
3749
+ if (value === null)
3750
+ return;
3223
3751
  return [decl("transition-duration", value)];
3224
3752
  });
3753
+ suggest("delay", () => [
3754
+ {
3755
+ values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
3756
+ valueThemeKeys: ["--transition-delay"]
3757
+ }
3758
+ ]);
3759
+ suggest("duration", () => [
3760
+ {
3761
+ values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
3762
+ valueThemeKeys: ["--transition-duration"]
3763
+ }
3764
+ ]);
3225
3765
  }
3226
3766
  functionalUtility("ease", {
3227
3767
  themeKeys: ["--transition-timing-function"],
@@ -3359,61 +3899,121 @@ function createUtilities(theme) {
3359
3899
  ["font-variant-numeric", cssFontVariantNumericValue]
3360
3900
  ]);
3361
3901
  }
3362
- staticUtility("outline-none", [
3363
- ["outline", "2px solid transparent"],
3364
- ["outline-offset", "2px"]
3365
- ]);
3366
- staticUtility("outline-dashed", [["outline-style", "dashed"]]);
3367
- staticUtility("outline-dotted", [["outline-style", "dotted"]]);
3368
- staticUtility("outline-double", [["outline-style", "double"]]);
3369
- utilities.functional("outline", (candidate) => {
3370
- if (candidate.negative) {
3371
- return;
3372
- }
3373
- if (candidate.value === null) {
3374
- return [decl("outline-style", "solid")];
3375
- }
3376
- if (candidate.value.kind === "arbitrary") {
3377
- let value = candidate.value.value;
3378
- let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "number", "percentage"]);
3379
- switch (type) {
3380
- case "length":
3381
- case "number":
3382
- case "percentage": {
3383
- return [decl("outline-width", value)];
3902
+ {
3903
+ let outlineProperties = () => {
3904
+ return atRoot([property("--tw-outline-style", "solid", "<custom-ident>")]);
3905
+ };
3906
+ staticUtility("outline-none", [
3907
+ ["outline", "2px solid transparent"],
3908
+ ["outline-offset", "2px"]
3909
+ ]);
3910
+ staticUtility("outline-solid", [
3911
+ ["--tw-outline-style", "solid"],
3912
+ ["outline-style", "solid"]
3913
+ ]);
3914
+ staticUtility("outline-dashed", [
3915
+ ["--tw-outline-style", "dashed"],
3916
+ ["outline-style", "dashed"]
3917
+ ]);
3918
+ staticUtility("outline-dotted", [
3919
+ ["--tw-outline-style", "dotted"],
3920
+ ["outline-style", "dotted"]
3921
+ ]);
3922
+ staticUtility("outline-double", [
3923
+ ["--tw-outline-style", "double"],
3924
+ ["outline-style", "double"]
3925
+ ]);
3926
+ utilities.functional("outline", (candidate) => {
3927
+ if (candidate.negative)
3928
+ return;
3929
+ if (candidate.value === null) {
3930
+ return [
3931
+ outlineProperties(),
3932
+ decl("outline-style", "var(--tw-outline-style)"),
3933
+ decl("outline-width", "1px")
3934
+ ];
3935
+ }
3936
+ if (candidate.value.kind === "arbitrary") {
3937
+ let value = candidate.value.value;
3938
+ let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "number", "percentage"]);
3939
+ switch (type) {
3940
+ case "length":
3941
+ case "number":
3942
+ case "percentage": {
3943
+ return [
3944
+ outlineProperties(),
3945
+ decl("outline-style", "var(--tw-outline-style)"),
3946
+ decl("outline-width", value)
3947
+ ];
3948
+ }
3949
+ default: {
3950
+ value = asColor(value, candidate.modifier, theme);
3951
+ if (value === null)
3952
+ return;
3953
+ return [decl("outline-color", value)];
3954
+ }
3384
3955
  }
3385
- default: {
3386
- value = asColor(value, candidate.modifier, theme);
3956
+ }
3957
+ {
3958
+ let value = resolveThemeColor(candidate, theme, ["--outline-color", "--color"]);
3959
+ if (value) {
3387
3960
  return [decl("outline-color", value)];
3388
3961
  }
3389
3962
  }
3390
- }
3391
- {
3392
- let value = resolveThemeColor(candidate, theme, ["--outline-color", "--color"]);
3393
- if (value) {
3394
- return [decl("outline-color", value)];
3963
+ {
3964
+ let value = theme.resolve(candidate.value.value, ["--outline-width"]);
3965
+ if (value) {
3966
+ return [
3967
+ outlineProperties(),
3968
+ decl("outline-style", "var(--tw-outline-style)"),
3969
+ decl("outline-width", value)
3970
+ ];
3971
+ } else if (!Number.isNaN(Number(candidate.value.value))) {
3972
+ return [
3973
+ outlineProperties(),
3974
+ decl("outline-style", "var(--tw-outline-style)"),
3975
+ decl("outline-width", `${candidate.value.value}px`)
3976
+ ];
3977
+ }
3395
3978
  }
3396
- }
3397
- {
3398
- let value = theme.resolve(candidate.value.value, ["--outline-width"]);
3399
- if (value) {
3400
- return [decl("outline-width", value)];
3401
- } else if (!isNaN(Number(candidate.value.value))) {
3402
- return [decl("outline-width", `${candidate.value.value}px`)];
3979
+ });
3980
+ suggest("outline", () => [
3981
+ {
3982
+ values: ["current", "transparent"],
3983
+ valueThemeKeys: ["--outline-color", "--color"],
3984
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
3985
+ modifierThemeKeys: ["--opacity"],
3986
+ hasDefaultValue: true
3987
+ },
3988
+ {
3989
+ values: ["0", "1", "2", "4", "8"],
3990
+ valueThemeKeys: ["--outline-width"]
3403
3991
  }
3404
- }
3405
- });
3406
- functionalUtility("outline-offset", {
3407
- supportsNegative: true,
3408
- themeKeys: ["--outline-offset"],
3409
- handleBareValue: ({ value }) => `${value}px`,
3410
- handle: (value) => [decl("outline-offset", value)]
3411
- });
3992
+ ]);
3993
+ functionalUtility("outline-offset", {
3994
+ supportsNegative: true,
3995
+ themeKeys: ["--outline-offset"],
3996
+ handleBareValue: ({ value }) => `${value}px`,
3997
+ handle: (value) => [decl("outline-offset", value)]
3998
+ });
3999
+ suggest("outline-offset", () => [
4000
+ {
4001
+ values: ["0", "1", "2", "4", "8"],
4002
+ valueThemeKeys: ["--outline-offset"]
4003
+ }
4004
+ ]);
4005
+ }
3412
4006
  functionalUtility("opacity", {
3413
4007
  themeKeys: ["--opacity"],
3414
4008
  handleBareValue: ({ value }) => `${value}%`,
3415
4009
  handle: (value) => [decl("opacity", value)]
3416
4010
  });
4011
+ suggest("opacity", () => [
4012
+ {
4013
+ values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
4014
+ valueThemeKeys: ["--opacity"]
4015
+ }
4016
+ ]);
3417
4017
  staticUtility("underline-offset-auto", [["text-underline-offset", "auto"]]);
3418
4018
  functionalUtility("underline-offset", {
3419
4019
  supportsNegative: true,
@@ -3421,10 +4021,16 @@ function createUtilities(theme) {
3421
4021
  handleBareValue: ({ value }) => `${value}px`,
3422
4022
  handle: (value) => [decl("text-underline-offset", value)]
3423
4023
  });
4024
+ suggest("underline-offset", () => [
4025
+ {
4026
+ supportsNegative: true,
4027
+ values: ["0", "1", "2", "4", "8"],
4028
+ valueThemeKeys: ["--text-underline-offset"]
4029
+ }
4030
+ ]);
3424
4031
  utilities.functional("text", (candidate) => {
3425
- if (candidate.negative || !candidate.value) {
4032
+ if (candidate.negative || !candidate.value)
3426
4033
  return;
3427
- }
3428
4034
  if (candidate.value.kind === "arbitrary") {
3429
4035
  let value = candidate.value.value;
3430
4036
  let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage", "absolute-size", "relative-size"]);
@@ -3444,6 +4050,8 @@ function createUtilities(theme) {
3444
4050
  }
3445
4051
  default: {
3446
4052
  value = asColor(value, candidate.modifier, theme);
4053
+ if (value === null)
4054
+ return;
3447
4055
  return [decl("color", value)];
3448
4056
  }
3449
4057
  }
@@ -3480,18 +4088,32 @@ function createUtilities(theme) {
3480
4088
  }
3481
4089
  }
3482
4090
  });
4091
+ suggest("text", () => [
4092
+ {
4093
+ values: ["current", "transparent"],
4094
+ valueThemeKeys: ["--text-color", "--color"],
4095
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4096
+ modifierThemeKeys: ["--opacity"]
4097
+ },
4098
+ {
4099
+ values: [],
4100
+ valueThemeKeys: ["--font-size"],
4101
+ modifiers: [],
4102
+ modifierThemeKeys: ["--line-height"]
4103
+ }
4104
+ ]);
3483
4105
  {
3484
4106
  let ringShadowValue2 = function(value) {
3485
- return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color, var(--default-ring-color))`;
4107
+ return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color, ${defaultRingColor})`;
3486
4108
  }, insetRingShadowValue2 = function(value) {
3487
4109
  return `inset 0 0 0 ${value} var(--tw-inset-ring-color, currentColor)`;
3488
4110
  };
3489
4111
  let cssBoxShadowValue = [
3490
- `var(--tw-inset-shadow)`,
3491
- `var(--tw-inset-ring-shadow)`,
3492
- `var(--tw-ring-offset-shadow)`,
3493
- `var(--tw-ring-shadow)`,
3494
- `var(--tw-shadow)`
4112
+ "var(--tw-inset-shadow)",
4113
+ "var(--tw-inset-ring-shadow)",
4114
+ "var(--tw-ring-offset-shadow)",
4115
+ "var(--tw-ring-shadow)",
4116
+ "var(--tw-shadow)"
3495
4117
  ].join(", ");
3496
4118
  let nullShadow = "0 0 #0000";
3497
4119
  let boxShadowProperties = () => {
@@ -3512,12 +4134,11 @@ function createUtilities(theme) {
3512
4134
  ]);
3513
4135
  };
3514
4136
  utilities.functional("shadow", (candidate) => {
3515
- if (candidate.negative) {
4137
+ if (candidate.negative)
3516
4138
  return;
3517
- }
3518
4139
  if (!candidate.value) {
3519
4140
  let value = theme.get(["--shadow"]);
3520
- if (!value)
4141
+ if (value === null)
3521
4142
  return;
3522
4143
  return [
3523
4144
  boxShadowProperties(),
@@ -3532,6 +4153,8 @@ function createUtilities(theme) {
3532
4153
  switch (type) {
3533
4154
  case "color": {
3534
4155
  value = asColor(value, candidate.modifier, theme);
4156
+ if (value === null)
4157
+ return;
3535
4158
  return [
3536
4159
  boxShadowProperties(),
3537
4160
  decl("--tw-shadow-color", value),
@@ -3579,13 +4202,25 @@ function createUtilities(theme) {
3579
4202
  }
3580
4203
  }
3581
4204
  });
4205
+ suggest("shadow", () => [
4206
+ {
4207
+ values: ["current", "transparent"],
4208
+ valueThemeKeys: ["--box-shadow-color", "--color"],
4209
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4210
+ modifierThemeKeys: ["--opacity"]
4211
+ },
4212
+ {
4213
+ values: [],
4214
+ valueThemeKeys: ["--shadow"],
4215
+ hasDefaultValue: true
4216
+ }
4217
+ ]);
3582
4218
  utilities.functional("inset-shadow", (candidate) => {
3583
- if (candidate.negative) {
4219
+ if (candidate.negative)
3584
4220
  return;
3585
- }
3586
4221
  if (!candidate.value) {
3587
4222
  let value = theme.get(["--inset-shadow"]);
3588
- if (!value)
4223
+ if (value === null)
3589
4224
  return;
3590
4225
  return [
3591
4226
  boxShadowProperties(),
@@ -3603,6 +4238,8 @@ function createUtilities(theme) {
3603
4238
  switch (type) {
3604
4239
  case "color": {
3605
4240
  value = asColor(value, candidate.modifier, theme);
4241
+ if (value === null)
4242
+ return;
3606
4243
  return [
3607
4244
  boxShadowProperties(),
3608
4245
  decl("--tw-inset-shadow-color", value),
@@ -3656,14 +4293,29 @@ function createUtilities(theme) {
3656
4293
  }
3657
4294
  }
3658
4295
  });
4296
+ suggest("inset-shadow", () => [
4297
+ {
4298
+ values: ["current", "transparent"],
4299
+ valueThemeKeys: ["--box-shadow-color", "--color"],
4300
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4301
+ modifierThemeKeys: ["--opacity"]
4302
+ },
4303
+ {
4304
+ values: [],
4305
+ valueThemeKeys: ["--shadow"],
4306
+ hasDefaultValue: true
4307
+ }
4308
+ ]);
3659
4309
  staticUtility("ring-inset", [boxShadowProperties, ["--tw-ring-inset", "inset"]]);
4310
+ let defaultRingColor = theme.get(["--default-ring-color"]) ?? "currentColor";
3660
4311
  utilities.functional("ring", (candidate) => {
3661
4312
  if (candidate.negative)
3662
4313
  return;
3663
4314
  if (!candidate.value) {
4315
+ let value = theme.get(["--default-ring-width"]) ?? "1px";
3664
4316
  return [
3665
4317
  boxShadowProperties(),
3666
- decl("--tw-ring-shadow", ringShadowValue2("var(--default-ring-width)")),
4318
+ decl("--tw-ring-shadow", ringShadowValue2(value)),
3667
4319
  decl("box-shadow", cssBoxShadowValue)
3668
4320
  ];
3669
4321
  }
@@ -3680,6 +4332,8 @@ function createUtilities(theme) {
3680
4332
  }
3681
4333
  default: {
3682
4334
  value = asColor(value, candidate.modifier, theme);
4335
+ if (value === null)
4336
+ return;
3683
4337
  return [decl("--tw-ring-color", value)];
3684
4338
  }
3685
4339
  }
@@ -3692,7 +4346,7 @@ function createUtilities(theme) {
3692
4346
  }
3693
4347
  {
3694
4348
  let value = theme.resolve(candidate.value.value, ["--ring-width"]);
3695
- if (!value && !isNaN(Number(candidate.value.value))) {
4349
+ if (value === null && !Number.isNaN(Number(candidate.value.value))) {
3696
4350
  value = `${candidate.value.value}px`;
3697
4351
  }
3698
4352
  if (value) {
@@ -3704,6 +4358,19 @@ function createUtilities(theme) {
3704
4358
  }
3705
4359
  }
3706
4360
  });
4361
+ suggest("ring", () => [
4362
+ {
4363
+ values: ["current", "transparent"],
4364
+ valueThemeKeys: ["--ring-color", "--color"],
4365
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4366
+ modifierThemeKeys: ["--opacity"]
4367
+ },
4368
+ {
4369
+ values: ["0", "1", "2", "4", "8"],
4370
+ valueThemeKeys: ["--ring-width"],
4371
+ hasDefaultValue: true
4372
+ }
4373
+ ]);
3707
4374
  utilities.functional("inset-ring", (candidate) => {
3708
4375
  if (candidate.negative)
3709
4376
  return;
@@ -3727,6 +4394,8 @@ function createUtilities(theme) {
3727
4394
  }
3728
4395
  default: {
3729
4396
  value = asColor(value, candidate.modifier, theme);
4397
+ if (value === null)
4398
+ return;
3730
4399
  return [decl("--tw-inset-ring-color", value)];
3731
4400
  }
3732
4401
  }
@@ -3739,7 +4408,7 @@ function createUtilities(theme) {
3739
4408
  }
3740
4409
  {
3741
4410
  let value = theme.resolve(candidate.value.value, ["--ring-width"]);
3742
- if (!value && !isNaN(Number(candidate.value.value))) {
4411
+ if (value === null && !Number.isNaN(Number(candidate.value.value))) {
3743
4412
  value = `${candidate.value.value}px`;
3744
4413
  }
3745
4414
  if (value) {
@@ -3751,11 +4420,23 @@ function createUtilities(theme) {
3751
4420
  }
3752
4421
  }
3753
4422
  });
4423
+ suggest("inset-ring", () => [
4424
+ {
4425
+ values: ["current", "transparent"],
4426
+ valueThemeKeys: ["--ring-color", "--color"],
4427
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4428
+ modifierThemeKeys: ["--opacity"]
4429
+ },
4430
+ {
4431
+ values: ["0", "1", "2", "4", "8"],
4432
+ valueThemeKeys: ["--ring-width"],
4433
+ hasDefaultValue: true
4434
+ }
4435
+ ]);
3754
4436
  let ringOffsetShadowValue = "var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)";
3755
4437
  utilities.functional("ring-offset", (candidate) => {
3756
- if (candidate.negative || !candidate.value) {
4438
+ if (candidate.negative || !candidate.value)
3757
4439
  return;
3758
- }
3759
4440
  if (candidate.value.kind === "arbitrary") {
3760
4441
  let value = candidate.value.value;
3761
4442
  let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
@@ -3768,6 +4449,8 @@ function createUtilities(theme) {
3768
4449
  }
3769
4450
  default: {
3770
4451
  value = asColor(value, candidate.modifier, theme);
4452
+ if (value === null)
4453
+ return;
3771
4454
  return [decl("--tw-ring-offset-color", value)];
3772
4455
  }
3773
4456
  }
@@ -3779,7 +4462,7 @@ function createUtilities(theme) {
3779
4462
  decl("--tw-ring-offset-width", value),
3780
4463
  decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
3781
4464
  ];
3782
- } else if (!isNaN(Number(candidate.value.value))) {
4465
+ } else if (!Number.isNaN(Number(candidate.value.value))) {
3783
4466
  return [
3784
4467
  decl("--tw-ring-offset-width", `${candidate.value.value}px`),
3785
4468
  decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
@@ -3794,29 +4477,51 @@ function createUtilities(theme) {
3794
4477
  }
3795
4478
  });
3796
4479
  }
4480
+ suggest("ring-offset", () => [
4481
+ {
4482
+ values: ["current", "transparent"],
4483
+ valueThemeKeys: ["--ring-offset-color", "--color"],
4484
+ modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
4485
+ modifierThemeKeys: ["--opacity"]
4486
+ },
4487
+ {
4488
+ values: ["0", "1", "2", "4", "8"],
4489
+ valueThemeKeys: ["--ring-offset-width"]
4490
+ }
4491
+ ]);
4492
+ utilities.functional("@container", (candidate) => {
4493
+ if (candidate.negative)
4494
+ return;
4495
+ let value = null;
4496
+ if (candidate.value === null) {
4497
+ value = "inline-size";
4498
+ } else if (candidate.value.kind === "arbitrary") {
4499
+ value = candidate.value.value;
4500
+ } else if (candidate.value.kind === "named" && candidate.value.value === "normal") {
4501
+ value = "normal";
4502
+ }
4503
+ if (value === null)
4504
+ return;
4505
+ if (candidate.modifier) {
4506
+ return [decl("container-type", value), decl("container-name", candidate.modifier.value)];
4507
+ }
4508
+ return [decl("container-type", value)];
4509
+ });
4510
+ suggest("@container", () => [
4511
+ {
4512
+ values: ["normal"],
4513
+ valueThemeKeys: [],
4514
+ hasDefaultValue: false
4515
+ }
4516
+ ]);
3797
4517
  return utilities;
3798
4518
  }
3799
4519
 
3800
- // src/utils/default-map.ts
3801
- var DefaultMap = class extends Map {
3802
- constructor(factory) {
3803
- super();
3804
- this.factory = factory;
3805
- }
3806
- get(key) {
3807
- let value = super.get(key);
3808
- if (value === void 0) {
3809
- value = this.factory(key, this);
3810
- this.set(key, value);
3811
- }
3812
- return value;
3813
- }
3814
- };
3815
-
3816
4520
  // src/variants.ts
3817
4521
  var Variants = class {
3818
4522
  compareFns = /* @__PURE__ */ new Map();
3819
4523
  variants = /* @__PURE__ */ new Map();
4524
+ completions = /* @__PURE__ */ new Map();
3820
4525
  /**
3821
4526
  * Registering a group of variants should result in the same sort number for
3822
4527
  * all the variants. This is to ensure that the variants are applied in the
@@ -3848,7 +4553,7 @@ var Variants = class {
3848
4553
  return this.variants.has(name);
3849
4554
  }
3850
4555
  get(name) {
3851
- return this.variants.get(name)?.applyFn;
4556
+ return this.variants.get(name);
3852
4557
  }
3853
4558
  kind(name) {
3854
4559
  return this.variants.get(name)?.kind;
@@ -3856,6 +4561,12 @@ var Variants = class {
3856
4561
  compounds(name) {
3857
4562
  return this.variants.get(name)?.compounds;
3858
4563
  }
4564
+ suggest(name, suggestions) {
4565
+ this.completions.set(name, suggestions);
4566
+ }
4567
+ getCompletions(name) {
4568
+ return this.completions.get(name)?.() ?? [];
4569
+ }
3859
4570
  compare(a, z) {
3860
4571
  if (a === z)
3861
4572
  return 0;
@@ -3886,6 +4597,9 @@ var Variants = class {
3886
4597
  keys() {
3887
4598
  return this.variants.keys();
3888
4599
  }
4600
+ entries() {
4601
+ return this.variants.entries();
4602
+ }
3889
4603
  set(name, { kind, applyFn, compounds }) {
3890
4604
  this.lastOrder = this.nextOrder();
3891
4605
  this.variants.set(name, {
@@ -3921,11 +4635,21 @@ function createVariants(theme) {
3921
4635
  ruleNode.selector = ruleNode.selector.replace("&", groupSelector);
3922
4636
  ruleNode.selector = `&:is(${ruleNode.selector} *)`;
3923
4637
  });
4638
+ variants.suggest("group", () => {
4639
+ return Array.from(variants.keys()).filter((name) => {
4640
+ return variants.get(name)?.compounds ?? false;
4641
+ });
4642
+ });
3924
4643
  variants.compound("peer", (ruleNode, variant) => {
3925
4644
  let peerSelector = variant.modifier ? `:where(.peer\\/${variant.modifier.value})` : ":where(.peer)";
3926
4645
  ruleNode.selector = ruleNode.selector.replace("&", peerSelector);
3927
4646
  ruleNode.selector = `&:is(${ruleNode.selector} ~ *)`;
3928
4647
  });
4648
+ variants.suggest("peer", () => {
4649
+ return Array.from(variants.keys()).filter((name) => {
4650
+ return variants.get(name)?.compounds ?? false;
4651
+ });
4652
+ });
3929
4653
  staticVariant("first-letter", ["&::first-letter"], { compounds: false });
3930
4654
  staticVariant("first-line", ["&::first-line"], { compounds: false });
3931
4655
  staticVariant("marker", ["& *::marker", "&::marker"], { compounds: false });
@@ -4022,15 +4746,31 @@ function createVariants(theme) {
4022
4746
  variants.compound("has", (ruleNode) => {
4023
4747
  ruleNode.selector = `&:has(${ruleNode.selector.replace("&", "*")})`;
4024
4748
  });
4749
+ variants.suggest("has", () => {
4750
+ return Array.from(variants.keys()).filter((name) => {
4751
+ return variants.get(name)?.compounds ?? false;
4752
+ });
4753
+ });
4025
4754
  variants.functional("aria", (ruleNode, variant) => {
4026
4755
  if (variant.value === null)
4027
4756
  return null;
4028
- if (variant.value.kind == "arbitrary") {
4757
+ if (variant.value.kind === "arbitrary") {
4029
4758
  ruleNode.nodes = [rule(`&[aria-${variant.value.value}]`, ruleNode.nodes)];
4030
4759
  } else {
4031
4760
  ruleNode.nodes = [rule(`&[aria-${variant.value.value}="true"]`, ruleNode.nodes)];
4032
4761
  }
4033
4762
  });
4763
+ variants.suggest("aria", () => [
4764
+ "busy",
4765
+ "checked",
4766
+ "disabled",
4767
+ "expanded",
4768
+ "hidden",
4769
+ "pressed",
4770
+ "readonly",
4771
+ "required",
4772
+ "selected"
4773
+ ]);
4034
4774
  variants.functional("data", (ruleNode, variant) => {
4035
4775
  if (variant.value === null)
4036
4776
  return null;
@@ -4066,13 +4806,13 @@ function createVariants(theme) {
4066
4806
  staticVariant("contrast-more", ["@media (prefers-contrast: more)"], { compounds: false });
4067
4807
  staticVariant("contrast-less", ["@media (prefers-contrast: less)"], { compounds: false });
4068
4808
  {
4069
- let compareBreakpoints2 = function(a, z, direction) {
4809
+ let compareBreakpoints2 = function(a, z, direction, lookup) {
4070
4810
  if (a === z)
4071
4811
  return 0;
4072
- let aValue = resolvedBreakpoints.get(a);
4812
+ let aValue = lookup.get(a);
4073
4813
  if (aValue === null)
4074
4814
  return direction === "asc" ? -1 : 1;
4075
- let zValue = resolvedBreakpoints.get(z);
4815
+ let zValue = lookup.get(z);
4076
4816
  if (zValue === null)
4077
4817
  return direction === "asc" ? 1 : -1;
4078
4818
  if (aValue === zValue)
@@ -4098,78 +4838,177 @@ function createVariants(theme) {
4098
4838
  aBucket.localeCompare(zBucket) || // If bucket names are the same, compare by value
4099
4839
  (direction === "asc" ? parseInt(aValue) - parseInt(zValue) : parseInt(zValue) - parseInt(aValue))
4100
4840
  );
4101
- if (isNaN(order)) {
4841
+ if (Number.isNaN(order)) {
4102
4842
  return aValue.localeCompare(zValue);
4103
4843
  }
4104
4844
  return order;
4105
4845
  };
4106
- let breakpoints = theme.namespace("--breakpoint");
4107
- let resolvedBreakpoints = new DefaultMap((variant) => {
4108
- switch (variant.kind) {
4109
- case "static": {
4110
- return breakpoints.get(variant.root) ?? null;
4111
- }
4112
- case "functional": {
4113
- let value = null;
4114
- if (variant.value.kind === "arbitrary") {
4115
- value = variant.value.value;
4116
- } else if (variant.value.kind === "named") {
4117
- value = theme.resolve(variant.value.value, ["--breakpoint"]);
4846
+ {
4847
+ let breakpoints = theme.namespace("--breakpoint");
4848
+ let resolvedBreakpoints = new DefaultMap((variant) => {
4849
+ switch (variant.kind) {
4850
+ case "static": {
4851
+ return breakpoints.get(variant.root) ?? null;
4118
4852
  }
4119
- if (!value) {
4120
- return null;
4853
+ case "functional": {
4854
+ if (variant.value === null)
4855
+ return null;
4856
+ let value = null;
4857
+ if (variant.value.kind === "arbitrary") {
4858
+ value = variant.value.value;
4859
+ } else if (variant.value.kind === "named") {
4860
+ value = theme.resolve(variant.value.value, ["--breakpoint"]);
4861
+ }
4862
+ if (!value)
4863
+ return null;
4864
+ if (value.includes("var("))
4865
+ return null;
4866
+ return value;
4121
4867
  }
4122
- if (value.includes("var(")) {
4868
+ case "arbitrary":
4869
+ case "compound":
4123
4870
  return null;
4124
- }
4125
- return value;
4126
4871
  }
4127
- case "arbitrary":
4128
- case "compound":
4129
- return null;
4130
- }
4131
- });
4132
- variants.group(
4133
- () => {
4134
- variants.functional(
4135
- "max",
4136
- (ruleNode, variant) => {
4137
- let value = resolvedBreakpoints.get(variant);
4138
- if (value === null)
4139
- return null;
4140
- ruleNode.nodes = [rule(`@media (width < ${value})`, ruleNode.nodes)];
4141
- },
4142
- { compounds: false }
4143
- );
4144
- },
4145
- (a, z) => compareBreakpoints2(a, z, "desc")
4146
- );
4147
- variants.group(
4148
- () => {
4149
- for (let [key, value] of theme.namespace("--breakpoint")) {
4150
- if (key === null)
4151
- continue;
4152
- variants.static(
4153
- key,
4154
- (ruleNode) => {
4872
+ });
4873
+ variants.group(
4874
+ () => {
4875
+ variants.functional(
4876
+ "max",
4877
+ (ruleNode, variant) => {
4878
+ let value = resolvedBreakpoints.get(variant);
4879
+ if (value === null)
4880
+ return null;
4881
+ ruleNode.nodes = [rule(`@media (width < ${value})`, ruleNode.nodes)];
4882
+ },
4883
+ { compounds: false }
4884
+ );
4885
+ },
4886
+ (a, z) => compareBreakpoints2(a, z, "desc", resolvedBreakpoints)
4887
+ );
4888
+ variants.suggest(
4889
+ "max",
4890
+ () => Array.from(breakpoints.keys()).filter((key) => key !== null)
4891
+ );
4892
+ variants.group(
4893
+ () => {
4894
+ for (let [key, value] of theme.namespace("--breakpoint")) {
4895
+ if (key === null)
4896
+ continue;
4897
+ variants.static(
4898
+ key,
4899
+ (ruleNode) => {
4900
+ ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
4901
+ },
4902
+ { compounds: false }
4903
+ );
4904
+ }
4905
+ variants.functional(
4906
+ "min",
4907
+ (ruleNode, variant) => {
4908
+ let value = resolvedBreakpoints.get(variant);
4909
+ if (value === null)
4910
+ return null;
4155
4911
  ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
4156
4912
  },
4157
4913
  { compounds: false }
4158
4914
  );
4159
- }
4160
- variants.functional(
4161
- "min",
4162
- (ruleNode, variant) => {
4163
- let value = resolvedBreakpoints.get(variant);
4164
- if (value === null)
4915
+ },
4916
+ (a, z) => compareBreakpoints2(a, z, "asc", resolvedBreakpoints)
4917
+ );
4918
+ variants.suggest(
4919
+ "min",
4920
+ () => Array.from(breakpoints.keys()).filter((key) => key !== null)
4921
+ );
4922
+ }
4923
+ {
4924
+ let widths = theme.namespace("--width");
4925
+ let resolvedWidths = new DefaultMap((variant) => {
4926
+ switch (variant.kind) {
4927
+ case "functional": {
4928
+ if (variant.value === null)
4165
4929
  return null;
4166
- ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
4167
- },
4168
- { compounds: false }
4169
- );
4170
- },
4171
- (a, z) => compareBreakpoints2(a, z, "asc")
4172
- );
4930
+ let value = null;
4931
+ if (variant.value.kind === "arbitrary") {
4932
+ value = variant.value.value;
4933
+ } else if (variant.value.kind === "named") {
4934
+ value = theme.resolve(variant.value.value, ["--width"]);
4935
+ }
4936
+ if (!value)
4937
+ return null;
4938
+ if (value.includes("var("))
4939
+ return null;
4940
+ return value;
4941
+ }
4942
+ case "static":
4943
+ case "arbitrary":
4944
+ case "compound":
4945
+ return null;
4946
+ }
4947
+ });
4948
+ variants.group(
4949
+ () => {
4950
+ variants.functional(
4951
+ "@max",
4952
+ (ruleNode, variant) => {
4953
+ let value = resolvedWidths.get(variant);
4954
+ if (value === null)
4955
+ return null;
4956
+ ruleNode.nodes = [
4957
+ rule(
4958
+ variant.modifier ? `@container ${variant.modifier.value} (width < ${value})` : `@container (width < ${value})`,
4959
+ ruleNode.nodes
4960
+ )
4961
+ ];
4962
+ },
4963
+ { compounds: false }
4964
+ );
4965
+ },
4966
+ (a, z) => compareBreakpoints2(a, z, "desc", resolvedWidths)
4967
+ );
4968
+ variants.suggest(
4969
+ "@max",
4970
+ () => Array.from(widths.keys()).filter((key) => key !== null)
4971
+ );
4972
+ variants.group(
4973
+ () => {
4974
+ variants.functional(
4975
+ "@",
4976
+ (ruleNode, variant) => {
4977
+ let value = resolvedWidths.get(variant);
4978
+ if (value === null)
4979
+ return null;
4980
+ ruleNode.nodes = [
4981
+ rule(
4982
+ variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
4983
+ ruleNode.nodes
4984
+ )
4985
+ ];
4986
+ },
4987
+ { compounds: false }
4988
+ );
4989
+ variants.functional(
4990
+ "@min",
4991
+ (ruleNode, variant) => {
4992
+ let value = resolvedWidths.get(variant);
4993
+ if (value === null)
4994
+ return null;
4995
+ ruleNode.nodes = [
4996
+ rule(
4997
+ variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
4998
+ ruleNode.nodes
4999
+ )
5000
+ ];
5001
+ },
5002
+ { compounds: false }
5003
+ );
5004
+ },
5005
+ (a, z) => compareBreakpoints2(a, z, "asc", resolvedWidths)
5006
+ );
5007
+ variants.suggest(
5008
+ "@min",
5009
+ () => Array.from(widths.keys()).filter((key) => key !== null)
5010
+ );
5011
+ }
4173
5012
  }
4174
5013
  staticVariant("portrait", ["@media (orientation: portrait)"], { compounds: false });
4175
5014
  staticVariant("landscape", ["@media (orientation: landscape)"], { compounds: false });
@@ -4187,14 +5026,33 @@ function buildDesignSystem(theme) {
4187
5026
  theme,
4188
5027
  utilities: createUtilities(theme),
4189
5028
  variants: createVariants(theme),
5029
+ candidatesToCss(classes) {
5030
+ let result = [];
5031
+ for (let className of classes) {
5032
+ let { astNodes } = compileCandidates([className], this, { throwOnInvalidCandidate: false });
5033
+ if (astNodes.length === 0) {
5034
+ result.push(null);
5035
+ } else {
5036
+ result.push(toCss(astNodes));
5037
+ }
5038
+ }
5039
+ return result;
5040
+ },
4190
5041
  getClassOrder(classes) {
4191
5042
  return getClassOrder(this, classes);
5043
+ },
5044
+ getClassList() {
5045
+ return getClassList(this);
5046
+ },
5047
+ getVariants() {
5048
+ return getVariants(this);
4192
5049
  }
4193
5050
  };
4194
5051
  }
4195
5052
 
4196
5053
  // src/property-order.ts
4197
5054
  var property_order_default = [
5055
+ "container-type",
4198
5056
  "pointer-events",
4199
5057
  "visibility",
4200
5058
  "position",
@@ -4530,39 +5388,6 @@ function escape(value) {
4530
5388
  }
4531
5389
 
4532
5390
  // src/compile.ts
4533
- function applyImportant(ast) {
4534
- for (let node of ast) {
4535
- if (node.kind === "rule" && node.selector === "@at-root") {
4536
- continue;
4537
- }
4538
- if (node.kind === "declaration") {
4539
- node.important = true;
4540
- } else if (node.kind === "rule") {
4541
- applyImportant(node.nodes);
4542
- }
4543
- }
4544
- }
4545
- function applyVariant(node, variant, variants) {
4546
- if (variant.kind === "arbitrary") {
4547
- node.nodes = [rule(variant.selector, node.nodes)];
4548
- return;
4549
- }
4550
- let applyVariantFn = variants.get(variant.root);
4551
- if (variant.kind === "compound") {
4552
- let result2 = applyVariant(node, variant.variant, variants);
4553
- if (result2 === null)
4554
- return null;
4555
- for (let child of node.nodes) {
4556
- let result3 = applyVariantFn(child, variant);
4557
- if (result3 === null)
4558
- return null;
4559
- }
4560
- return;
4561
- }
4562
- let result = applyVariantFn(node, variant);
4563
- if (result === null)
4564
- return null;
4565
- }
4566
5391
  function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidate = false } = {}) {
4567
5392
  rawCandidates.sort();
4568
5393
  let nodeSorting = /* @__PURE__ */ new Map();
@@ -4571,18 +5396,16 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
4571
5396
  return parseVariant(variant, designSystem.variants, map);
4572
5397
  });
4573
5398
  let candidates = /* @__PURE__ */ new Map();
4574
- next:
4575
- for (let rawCandidate of rawCandidates) {
4576
- let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
4577
- if (candidate === null) {
4578
- if (throwOnInvalidCandidate) {
4579
- throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4580
- } else {
4581
- continue next;
4582
- }
5399
+ for (let rawCandidate of rawCandidates) {
5400
+ let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
5401
+ if (candidate === null) {
5402
+ if (throwOnInvalidCandidate) {
5403
+ throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4583
5404
  }
4584
- candidates.set(candidate, rawCandidate);
5405
+ continue;
4585
5406
  }
5407
+ candidates.set(candidate, rawCandidate);
5408
+ }
4586
5409
  let variants = Array.from(parsedVariants.values()).sort((a, z) => {
4587
5410
  return designSystem.variants.compare(a, z);
4588
5411
  });
@@ -4590,16 +5413,23 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
4590
5413
  for (let [candidate, rawCandidate] of candidates) {
4591
5414
  let nodes = [];
4592
5415
  if (candidate.kind === "arbitrary") {
4593
- nodes = [decl(candidate.property, candidate.value)];
5416
+ let compileFn = designSystem.utilities.getArbitrary();
5417
+ let compiledNodes = compileFn(candidate);
5418
+ if (compiledNodes === void 0) {
5419
+ if (throwOnInvalidCandidate) {
5420
+ throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
5421
+ }
5422
+ continue next;
5423
+ }
5424
+ nodes = compiledNodes;
4594
5425
  } else if (candidate.kind === "static" || candidate.kind === "functional") {
4595
5426
  let { compileFn } = designSystem.utilities.get(candidate.root);
4596
5427
  let compiledNodes = compileFn(candidate);
4597
5428
  if (compiledNodes === void 0) {
4598
5429
  if (throwOnInvalidCandidate) {
4599
5430
  throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4600
- } else {
4601
- continue next;
4602
5431
  }
5432
+ continue next;
4603
5433
  }
4604
5434
  nodes = compiledNodes;
4605
5435
  }
@@ -4618,9 +5448,8 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
4618
5448
  if (result === null) {
4619
5449
  if (throwOnInvalidCandidate) {
4620
5450
  throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
4621
- } else {
4622
- continue next;
4623
5451
  }
5452
+ continue next;
4624
5453
  }
4625
5454
  variantOrder |= 1n << BigInt(variants.indexOf(variant));
4626
5455
  }
@@ -4652,31 +5481,65 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
4652
5481
  nodeSorting
4653
5482
  };
4654
5483
  }
5484
+ function applyVariant(node, variant, variants) {
5485
+ if (variant.kind === "arbitrary") {
5486
+ node.nodes = [rule(variant.selector, node.nodes)];
5487
+ return;
5488
+ }
5489
+ let { applyFn } = variants.get(variant.root);
5490
+ if (variant.kind === "compound") {
5491
+ let result2 = applyVariant(node, variant.variant, variants);
5492
+ if (result2 === null)
5493
+ return null;
5494
+ for (let child of node.nodes) {
5495
+ if (child.kind !== "rule")
5496
+ return null;
5497
+ let result3 = applyFn(child, variant);
5498
+ if (result3 === null)
5499
+ return null;
5500
+ }
5501
+ return;
5502
+ }
5503
+ let result = applyFn(node, variant);
5504
+ if (result === null)
5505
+ return null;
5506
+ }
5507
+ function applyImportant(ast) {
5508
+ for (let node of ast) {
5509
+ if (node.kind === "rule" && node.selector === "@at-root") {
5510
+ continue;
5511
+ }
5512
+ if (node.kind === "declaration") {
5513
+ node.important = true;
5514
+ } else if (node.kind === "rule") {
5515
+ applyImportant(node.nodes);
5516
+ }
5517
+ }
5518
+ }
4655
5519
  function getPropertySort(nodes) {
4656
5520
  let propertySort = /* @__PURE__ */ new Set();
4657
5521
  let q = nodes.slice();
4658
- next:
4659
- while (q.length > 0) {
4660
- let node = q.shift();
4661
- if (node.kind === "declaration") {
4662
- if (node.property === "--tw-sort") {
4663
- let idx2 = property_order_default.indexOf(node.value);
4664
- if (idx2 !== -1) {
4665
- propertySort.add(idx2);
4666
- break next;
4667
- }
4668
- }
4669
- let idx = property_order_default.indexOf(node.property);
4670
- if (idx !== -1)
4671
- propertySort.add(idx);
4672
- } else if (node.kind === "rule") {
4673
- if (node.selector === "@at-root")
4674
- continue;
4675
- for (let child of node.nodes) {
4676
- q.push(child);
5522
+ while (q.length > 0) {
5523
+ let node = q.shift();
5524
+ if (node.kind === "declaration") {
5525
+ if (node.property === "--tw-sort") {
5526
+ let idx2 = property_order_default.indexOf(node.value);
5527
+ if (idx2 !== -1) {
5528
+ propertySort.add(idx2);
5529
+ break;
4677
5530
  }
4678
5531
  }
5532
+ let idx = property_order_default.indexOf(node.property);
5533
+ if (idx !== -1)
5534
+ propertySort.add(idx);
5535
+ } else if (node.kind === "rule") {
5536
+ if (node.selector === "@at-root")
5537
+ continue;
5538
+ for (let child of node.nodes) {
5539
+ q.push(child);
5540
+ }
4679
5541
  }
5542
+ }
4680
5543
  return Array.from(propertySort).sort((a, z) => a - z);
4681
5544
  }
4682
5545
 
@@ -4799,10 +5662,9 @@ function parse2(input) {
4799
5662
  node = null;
4800
5663
  } else if (char === "}") {
4801
5664
  if (closingBracketStack === "") {
4802
- throw new Error(`Missing opening {`);
4803
- } else {
4804
- closingBracketStack = closingBracketStack.slice(0, -1);
5665
+ throw new Error("Missing opening {");
4805
5666
  }
5667
+ closingBracketStack = closingBracketStack.slice(0, -1);
4806
5668
  if (current.length > 0) {
4807
5669
  if (current[0] === "@") {
4808
5670
  node = rule(current.trim(), []);
@@ -4880,6 +5742,21 @@ var Theme = class {
4880
5742
  this.values.set(key, value);
4881
5743
  }
4882
5744
  }
5745
+ keysInNamespaces(themeKeys) {
5746
+ let keys = [];
5747
+ for (let prefix of themeKeys) {
5748
+ let namespace = `${prefix}-`;
5749
+ for (let key of this.values.keys()) {
5750
+ if (key.startsWith(namespace)) {
5751
+ if (key.indexOf("--", 2) !== -1) {
5752
+ continue;
5753
+ }
5754
+ keys.push(key.slice(namespace.length));
5755
+ }
5756
+ }
5757
+ }
5758
+ return keys;
5759
+ }
4883
5760
  get(themeKeys) {
4884
5761
  for (let key of themeKeys) {
4885
5762
  let value = this.values.get(key);
@@ -4942,53 +5819,6 @@ var Theme = class {
4942
5819
  };
4943
5820
 
4944
5821
  // src/index.ts
4945
- function toCss(ast) {
4946
- let atRoots = [];
4947
- return ast.map(function stringify(node) {
4948
- let css2 = "";
4949
- if (node.kind === "rule") {
4950
- if (node.selector === "@at-root") {
4951
- for (let child of node.nodes) {
4952
- atRoots.push(stringify(child));
4953
- }
4954
- return css2;
4955
- }
4956
- if (node.selector[0] === "@" && node.nodes.length === 0) {
4957
- return `${node.selector};`;
4958
- }
4959
- css2 += `${node.selector}{`;
4960
- for (let child of node.nodes) {
4961
- css2 += stringify(child);
4962
- }
4963
- css2 += "}";
4964
- } else if (node.kind === "comment") {
4965
- css2 += `/*${node.value}*/
4966
- `;
4967
- } else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
4968
- css2 += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
4969
- }
4970
- return css2;
4971
- }).concat(atRoots).join("\n");
4972
- }
4973
- function optimizeCss(input, { file = "input.css", minify = false } = {}) {
4974
- return lightningcss.transform({
4975
- filename: file,
4976
- code: Buffer.from(input),
4977
- minify,
4978
- sourceMap: false,
4979
- drafts: {
4980
- customMedia: true
4981
- },
4982
- nonStandard: {
4983
- deepSelectorCombinator: true
4984
- },
4985
- include: lightningcss.Features.Nesting,
4986
- exclude: lightningcss.Features.LogicalProperties,
4987
- targets: {
4988
- safari: 16 << 16 | 4 << 8
4989
- }
4990
- }).code.toString();
4991
- }
4992
5822
  function compile(css2, rawCandidates) {
4993
5823
  let ast = parse2(css2);
4994
5824
  {
@@ -5088,6 +5918,26 @@ function compile(css2, rawCandidates) {
5088
5918
  }
5089
5919
  return toCss(ast);
5090
5920
  }
5921
+ function optimizeCss(input, { file = "input.css", minify = false } = {}) {
5922
+ return lightningcss.transform({
5923
+ filename: file,
5924
+ code: Buffer.from(input),
5925
+ minify,
5926
+ sourceMap: false,
5927
+ drafts: {
5928
+ customMedia: true
5929
+ },
5930
+ nonStandard: {
5931
+ deepSelectorCombinator: true
5932
+ },
5933
+ include: lightningcss.Features.Nesting,
5934
+ exclude: lightningcss.Features.LogicalProperties,
5935
+ targets: {
5936
+ safari: 16 << 16 | 4 << 8
5937
+ },
5938
+ errorRecovery: true
5939
+ }).code.toString();
5940
+ }
5091
5941
 
5092
5942
  // src/cli/utils/format-ns.ts
5093
5943
  function formatNanoseconds(input) {
@@ -5118,7 +5968,7 @@ var UI = {
5118
5968
  indent: 2
5119
5969
  };
5120
5970
  function header() {
5121
- return `${pc__default.default.italic(pc__default.default.bold(pc__default.default.blue("\u2248")))} tailwindcss ${pc__default.default.blue("v" + package_default.version)}`;
5971
+ return `${pc__default.default.italic(pc__default.default.bold(pc__default.default.blue("\u2248")))} tailwindcss ${pc__default.default.blue(`v${version}`)}`;
5122
5972
  }
5123
5973
  function highlight(file) {
5124
5974
  return `${pc__default.default.dim(pc__default.default.blue("`"))}${pc__default.default.blue(file)}${pc__default.default.dim(pc__default.default.blue("`"))}`;
@@ -5429,18 +6279,11 @@ if (command) {
5429
6279
  });
5430
6280
  process.exit(1);
5431
6281
  }
5432
- if (process.stdout.isTTY && !process.argv.slice(2).includes("-o")) {
6282
+ if (process.stdout.isTTY && !process.argv.slice(2).includes("-o") || shared["--help"]) {
5433
6283
  help({
5434
6284
  usage: ["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],
5435
6285
  options: { ...options(), ...sharedOptions }
5436
6286
  });
5437
6287
  process.exit(0);
5438
6288
  }
5439
- if (shared["--help"]) {
5440
- help({
5441
- usage: [`tailwindcss ${command} [options]`],
5442
- options: { ...options(), ...sharedOptions }
5443
- });
5444
- process.exit(0);
5445
- }
5446
6289
  handle(args(options()));