@tenphi/tasty 0.0.0-snapshot.b49ed29 → 0.0.0-snapshot.b4e384c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +403 -380
  2. package/dist/{babel-types-DpUCD2L_.d.ts → babel-types-Dc5zghyE.d.ts} +2 -2
  3. package/dist/chunks/{build-config-DQHNt7oV.js → build-config-D9Iq8QQm.js} +5 -5
  4. package/dist/chunks/{build-config-DQHNt7oV.js.map → build-config-D9Iq8QQm.js.map} +1 -1
  5. package/dist/chunks/{collector-CLJMa9_d.js → collector-Cb8ah2JF.js} +4 -4
  6. package/dist/chunks/{collector-CLJMa9_d.js.map → collector-Cb8ah2JF.js.map} +1 -1
  7. package/dist/chunks/{config-engine-DQTnjS4S.js → config-engine-CMYFZYQh.js} +5 -5
  8. package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
  9. package/dist/chunks/{css-definitions-gzJPklRN.js → css-definitions-B4aWBkH3.js} +88 -78
  10. package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
  11. package/dist/chunks/{debug-XlLKYbjU.js → debug-D2Pu7Xhy.js} +4 -4
  12. package/dist/chunks/{debug-XlLKYbjU.js.map → debug-D2Pu7Xhy.js.map} +1 -1
  13. package/dist/chunks/{dsl-DRhFWQzo.js → dsl-CsFl9LGn.js} +132 -52
  14. package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
  15. package/dist/chunks/{react-runtime-CxMPs43X.js → react-runtime-DHiopXCu.js} +8 -6
  16. package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
  17. package/dist/chunks/{runtime-engine-8qIHnb-B.js → runtime-engine-NGCofNXy.js} +11 -7
  18. package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
  19. package/dist/chunks/{runtime-state-BaSL1KZU.js → runtime-state-lZjMbvwV.js} +14 -3
  20. package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
  21. package/dist/chunks/{style-engine-DgP6pNeS.js → style-engine-DnkV_4Jg.js} +256 -95
  22. package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
  23. package/dist/chunks/{zero-engine-DvCd7ZUf.js → zero-engine-DcwaCvFs.js} +6 -6
  24. package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
  25. package/dist/{collector-D4POJ53X.d.ts → collector-D2OT6I2G.d.ts} +2 -2
  26. package/dist/{config-DvPUj4cw.d.ts → config-C4ftFxgI.d.ts} +13 -10
  27. package/dist/core/index.d.ts +4 -4
  28. package/dist/core/index.js +7 -7
  29. package/dist/{index-DC4q-xDq.d.ts → index-DxQNRj50.d.ts} +34 -16
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +8 -8
  32. package/dist/{merge-styles-Jb5iZ-Jf.d.ts → merge-styles-D39qBtox.d.ts} +2 -2
  33. package/dist/ssr/astro.js +2 -2
  34. package/dist/ssr/index.d.ts +1 -1
  35. package/dist/ssr/index.js +2 -2
  36. package/dist/ssr/next-config.d.ts +1 -1
  37. package/dist/ssr/next-config.js +3 -3
  38. package/dist/ssr/next.d.ts +1 -1
  39. package/dist/ssr/next.js +3 -3
  40. package/dist/static/index.d.ts +2 -2
  41. package/dist/{types-ZbF2_6LV.d.ts → types-CYQIhUg1.d.ts} +9 -7
  42. package/dist/zero/babel.d.ts +9 -3
  43. package/dist/zero/babel.js +8 -8
  44. package/dist/zero/babel.js.map +1 -1
  45. package/dist/zero/index.d.ts +25 -6
  46. package/dist/zero/index.js +5 -4
  47. package/dist/zero/index.js.map +1 -1
  48. package/dist/zero/next.d.ts +1 -1
  49. package/docs/README.md +4 -1
  50. package/docs/adoption.md +25 -17
  51. package/docs/ai-agents.md +43 -34
  52. package/docs/comparison.md +9 -8
  53. package/docs/configuration.md +186 -68
  54. package/docs/debug.md +3 -2
  55. package/docs/design-system.md +117 -15
  56. package/docs/dsl.md +258 -116
  57. package/docs/getting-started.md +81 -24
  58. package/docs/injector.md +41 -40
  59. package/docs/methodology.md +46 -21
  60. package/docs/migration-v3.md +3 -3
  61. package/docs/pipeline.md +19 -16
  62. package/docs/plugins.md +21 -41
  63. package/docs/react-api.md +70 -14
  64. package/docs/runtime-benchmarks.md +4 -4
  65. package/docs/ssr.md +92 -66
  66. package/docs/styles.md +82 -16
  67. package/docs/tasty-static.md +143 -58
  68. package/package.json +32 -33
  69. package/dist/chunks/config-engine-DQTnjS4S.js.map +0 -1
  70. package/dist/chunks/css-definitions-gzJPklRN.js.map +0 -1
  71. package/dist/chunks/dsl-DRhFWQzo.js.map +0 -1
  72. package/dist/chunks/react-runtime-CxMPs43X.js.map +0 -1
  73. package/dist/chunks/runtime-engine-8qIHnb-B.js.map +0 -1
  74. package/dist/chunks/runtime-state-BaSL1KZU.js.map +0 -1
  75. package/dist/chunks/style-engine-DgP6pNeS.js.map +0 -1
  76. package/dist/chunks/zero-engine-DvCd7ZUf.js.map +0 -1
@@ -73,10 +73,10 @@ function normalizeDslName(name) {
73
73
  const lower = first.toLowerCase();
74
74
  return lower === first ? name : lower + name.slice(1);
75
75
  }
76
- const RE_DSL_IDENTIFIER = /(\$\$?|##?)([a-zA-Z_][a-zA-Z0-9_-]*)/g;
76
+ const RE_DSL_IDENTIFIER = /(\$\$?|##?|--)([a-zA-Z_][a-zA-Z0-9_-]*)/g;
77
77
  function foldDslCase(src) {
78
78
  const folded = src.toLowerCase();
79
- if (folded === src || !src.includes("$") && !src.includes("#")) return folded;
79
+ if (folded === src || !src.includes("$") && !src.includes("#") && !src.includes("--")) return folded;
80
80
  RE_DSL_IDENTIFIER.lastIndex = 0;
81
81
  let out = "";
82
82
  let last = 0;
@@ -84,7 +84,7 @@ function foldDslCase(src) {
84
84
  while (match = RE_DSL_IDENTIFIER.exec(src)) {
85
85
  const [whole, prefix, body] = match;
86
86
  out += src.slice(last, match.index).toLowerCase();
87
- out += prefix + (prefix[0] === "#" && RE_HEX.test(body.toLowerCase()) ? body.toLowerCase() : normalizeDslName(body));
87
+ out += prefix + (prefix === "--" ? body : prefix[0] === "#" && RE_HEX.test(body.toLowerCase()) ? body.toLowerCase() : normalizeDslName(body));
88
88
  last = match.index + whole.length;
89
89
  }
90
90
  return out + src.slice(last).toLowerCase();
@@ -379,6 +379,11 @@ function getNamedColorHex() {
379
379
  for (let i = 0; i < names.length; i++) colors.set(names[i], `#${hex.slice(i * 6, i * 6 + 6)}`);
380
380
  return _namedColorHex = colors;
381
381
  }
382
+ const SYSTEM_COLORS = new Set("accentcolor accentcolortext activetext buttonborder buttonface buttontext canvas canvastext field fieldtext graytext highlight highlighttext linktext mark marktext selecteditem selecteditemtext visitedtext".split(" "));
383
+ function isColorKeyword(name) {
384
+ const lower = name.toLowerCase();
385
+ return getNamedColorHex().has(lower) || SYSTEM_COLORS.has(lower);
386
+ }
382
387
  function hexToRgb(hex) {
383
388
  const matched = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (_m, r, g, b) => "#" + r + r + g + g + b + b).substring(1).match(/.{2}/g);
384
389
  if (!matched) return null;
@@ -458,20 +463,26 @@ function oklchStringToRgb(oklchStr) {
458
463
  }
459
464
  //#endregion
460
465
  //#region src/utils/color-space.ts
461
- function overrideColorAlpha(color, alpha) {
462
- return `oklch(from ${color} l c h / ${alpha})`;
463
- }
464
466
  function mixColorAlpha(color, percentage) {
465
467
  return `color-mix(in oklab, ${color} ${percentage}, transparent)`;
466
468
  }
467
- const RE_ALPHA_OVERRIDE = /^oklch\(from (.+) l c h \/ (.+)\)$/;
468
- function parseAlphaOverride(value) {
469
- const match = value.match(RE_ALPHA_OVERRIDE);
469
+ const RE_ALPHA_MIX = /^color-mix\(in oklab,\s*(.+) (\S+%|calc\(.+ \* 100%\)),\s*transparent\)$/;
470
+ function parseAlphaMix(value) {
471
+ const match = value.match(RE_ALPHA_MIX);
470
472
  return match ? {
471
473
  color: match[1],
472
- alpha: match[2]
474
+ percentage: match[2]
473
475
  } : null;
474
476
  }
477
+ const ZERO_ALPHA = String.raw`(?:0+(?:\.0*)?|\.0+)%?|none`;
478
+ const RE_SLASH_ZERO_ALPHA = new RegExp(String.raw`\/\s*(?:${ZERO_ALPHA})\s*\)$`, "i");
479
+ const RE_LEGACY_ZERO_ALPHA = new RegExp(String.raw`^(?:rgba|hsla)\([^(),]*,[^(),]*,[^(),]*,\s*(?:${ZERO_ALPHA})\s*\)$`, "i");
480
+ function isTransparent(color) {
481
+ return color === "transparent" || parseAlphaMix(color)?.percentage === "0%" || RE_SLASH_ZERO_ALPHA.test(color) || RE_LEGACY_ZERO_ALPHA.test(color);
482
+ }
483
+ function alphaToPercentage(alpha) {
484
+ return `${Number(((Number.isNaN(alpha) ? 1 : Math.min(1, Math.max(0, alpha))) * 100).toFixed(6))}%`;
485
+ }
475
486
  //#endregion
476
487
  //#region src/parser/types.ts
477
488
  const makeEmptyPart = () => ({
@@ -492,28 +503,51 @@ const makeEmptyDetails = () => ({
492
503
  });
493
504
  //#endregion
494
505
  //#region src/parser/classify.ts
495
- function alphaSuffixToAlpha(rawAlpha) {
496
- if (rawAlpha.startsWith("$")) return `var(--${rawAlpha.slice(1)})`;
497
- if (rawAlpha === "0") return "0";
498
- return `.${rawAlpha}`;
499
- }
500
- function fadeColor(color, rawAlpha) {
501
- return overrideColorAlpha(color, alphaSuffixToAlpha(rawAlpha));
502
- }
503
506
  function alphaSuffixToPercentage(rawAlpha) {
504
507
  if (rawAlpha.startsWith("$")) return `calc(var(--${rawAlpha.slice(1)}) * 100%)`;
505
508
  if (rawAlpha === "0") return "0%";
506
509
  const digits = rawAlpha.length === 1 ? `${rawAlpha}0` : rawAlpha;
507
510
  const whole = String(Number(digits.slice(0, 2)));
508
- const fraction = digits.slice(2);
511
+ const fraction = digits.slice(2).replace(/0+$/, "");
509
512
  return `${fraction ? `${whole}.${fraction}` : whole}%`;
510
513
  }
511
- function fadeCurrentColor(rawAlpha) {
512
- return mixColorAlpha("currentcolor", alphaSuffixToPercentage(rawAlpha));
514
+ function fadeColor(color, rawAlpha) {
515
+ return mixColorAlpha(color, alphaSuffixToPercentage(rawAlpha));
516
+ }
517
+ const ALPHA_SUFFIX = String.raw`(\$[a-z_][a-z0-9-_]*|[0-9]+)`;
518
+ const RE_CURRENT_ALPHA = new RegExp(`^#current\\.${ALPHA_SUFFIX}$`, "i");
519
+ const RE_TOKEN_ALPHA = new RegExp(`^(#[a-z0-9-]+)\\.${ALPHA_SUFFIX}$`, "i");
520
+ const RE_COLOR_LAYER = new RegExp(`^(#[a-z0-9-]+)(?:\\.${ALPHA_SUFFIX})?$`, "i");
521
+ function layerColors(token, opts, recurse) {
522
+ const operands = token.split("+").map((part) => part.match(RE_COLOR_LAYER));
523
+ if (operands.some((match) => !match)) return null;
524
+ const colorOf = (input) => {
525
+ const { bucket, processed } = classify(input, opts, recurse);
526
+ return bucket === 0 || bucket === 3 ? processed : null;
527
+ };
528
+ const [base, ...layers] = operands;
529
+ let result = colorOf(base[0]);
530
+ if (result === null) return null;
531
+ for (const [layerInput, name, rawAlpha] of layers) {
532
+ const color = colorOf(name);
533
+ if (color === null) return null;
534
+ if (isTransparent(color)) continue;
535
+ if (rawAlpha === void 0) {
536
+ warnOnceDev(`compound-color-opaque:${token}`, `"${token}": "${layerInput}" has no opacity, so it covers everything before it and the color is just "${layerInput}". Give the layer an opacity, such as "${layerInput}.04".`);
537
+ result = color;
538
+ continue;
539
+ }
540
+ const opacity = alphaSuffixToPercentage(rawAlpha);
541
+ if (opacity === "0%") continue;
542
+ result = isTransparent(result) ? mixColorAlpha(color, opacity) : `color-mix(in srgb, ${color} ${opacity}, ${result})`;
543
+ }
544
+ return result;
513
545
  }
514
546
  function hasColorArgs(parsed) {
515
- const namedColors = getNamedColorHex();
516
- return parsed.groups.some((group) => group.colors.length > 0 || group.mods.some((mod) => namedColors.has(mod)));
547
+ return parsed.groups.some((group) => group.colors.length > 0);
548
+ }
549
+ function isSingleColor(group) {
550
+ return !!group && group.all.length === 1 && group.colors.length === 1;
517
551
  }
518
552
  function resolveUntilStable(value, opts, recurse, maxIterations = 10) {
519
553
  let current = value;
@@ -607,14 +641,26 @@ function classify(raw, opts, recurse) {
607
641
  processed: `--${rest}-color`
608
642
  };
609
643
  }
644
+ if (token[0] === "#" && token.includes("+")) {
645
+ const layered = layerColors(token, opts, recurse);
646
+ if (layered !== null) return {
647
+ bucket: 0,
648
+ processed: layered
649
+ };
650
+ warnOnceDev(`compound-color-invalid:${token}`, `"${token}" is not a compound color and is ignored: every part joined by "+" must be a color token with an optional opacity, such as "#surface+#dark.04".`);
651
+ return {
652
+ bucket: 2,
653
+ processed: ""
654
+ };
655
+ }
610
656
  if (token === "#current") return {
611
657
  bucket: 0,
612
658
  processed: "currentcolor"
613
659
  };
614
- const currentAlphaMatch = token.match(/^#current\.(\$[a-z_][a-z0-9-_]*|[0-9]+)$/i);
660
+ const currentAlphaMatch = token.match(RE_CURRENT_ALPHA);
615
661
  if (currentAlphaMatch) return {
616
662
  bucket: 0,
617
- processed: fadeCurrentColor(currentAlphaMatch[1])
663
+ processed: fadeColor("currentcolor", currentAlphaMatch[1])
618
664
  };
619
665
  if (token[0] === "$" || token[0] === "#") {
620
666
  const predefinedTokens = getGlobalPredefinedTokens();
@@ -625,21 +671,33 @@ function classify(raw, opts, recurse) {
625
671
  return classify(foldDslCase(tokenValue), opts, recurse);
626
672
  }
627
673
  if (token[0] === "#") {
628
- const alphaMatch = token.match(/^(#[a-z0-9-]+)\.(\$[a-z_][a-z0-9-_]*|[0-9]+)$/i);
674
+ const alphaMatch = token.match(RE_TOKEN_ALPHA);
629
675
  if (alphaMatch) {
630
676
  const [, baseToken, rawAlpha] = alphaMatch;
631
677
  const baseKey = baseToken.toLowerCase();
632
678
  if (baseKey in predefinedTokens) {
633
679
  const resolvedValue = predefinedTokens[baseKey];
680
+ if (resolvedValue.trim().toLowerCase() === "transparent") return {
681
+ bucket: 0,
682
+ processed: "transparent"
683
+ };
684
+ const fadeWhole = () => {
685
+ const { bucket, processed } = classify(foldDslCase(resolvedValue), opts, recurse);
686
+ return bucket === 0 || bucket === 3 ? {
687
+ bucket: 0,
688
+ processed: fadeColor(processed, rawAlpha)
689
+ } : {
690
+ bucket: 2,
691
+ processed: ""
692
+ };
693
+ };
694
+ if (resolvedValue.startsWith("#") && resolvedValue.includes("+")) return fadeWhole();
634
695
  if (resolvedValue.startsWith("#")) return classify(`${foldDslCase(resolvedValue)}.${rawAlpha}`, opts, recurse);
635
696
  const funcMatch = resolvedValue.match(RE_FUNC_CALL);
636
697
  if (funcMatch) {
637
698
  const [, funcName, args] = funcMatch;
638
699
  const lowerFunc = funcName.toLowerCase();
639
- if (DERIVED_COLOR_FUNCS.has(lowerFunc)) return {
640
- bucket: 0,
641
- processed: fadeColor(classify(foldDslCase(resolvedValue), opts, recurse).processed, rawAlpha)
642
- };
700
+ if (DERIVED_COLOR_FUNCS.has(lowerFunc)) return fadeWhole();
643
701
  const isCustomFunc = !!(opts.functions && lowerFunc in opts.functions && !COLOR_FUNCS.has(lowerFunc) && !COLOR_FUNCS.has(funcName.replace(/a$/i, "").toLowerCase()));
644
702
  const normalizedFunc = isCustomFunc ? lowerFunc : funcName.replace(/a$/i, "").toLowerCase();
645
703
  if (!(COLOR_FUNCS.has(normalizedFunc) || COLOR_FUNCS.has(lowerFunc) || isCustomFunc)) return classify(`${resolvedValue}.${rawAlpha}`, opts, recurse);
@@ -698,6 +756,11 @@ function classify(raw, opts, recurse) {
698
756
  processed: constructed
699
757
  };
700
758
  }
759
+ const keyword = resolvedValue.trim().toLowerCase();
760
+ if (keyword === "currentcolor" || isColorKeyword(keyword)) return {
761
+ bucket: 0,
762
+ processed: fadeColor(keyword, rawAlpha)
763
+ };
701
764
  return classify(`${resolvedValue}.${rawAlpha}`, opts, recurse);
702
765
  }
703
766
  }
@@ -724,12 +787,13 @@ function classify(raw, opts, recurse) {
724
787
  }
725
788
  }
726
789
  if (token[0] === "#" && token.length > 1) {
727
- const alphaMatch = token.match(/^#([a-z0-9-]+)\.(\$[a-z_][a-z0-9-_]*|[0-9]+)$/i);
790
+ const alphaMatch = token.match(RE_TOKEN_ALPHA);
728
791
  if (alphaMatch) {
729
- const [, base, rawAlpha] = alphaMatch;
792
+ const [, baseToken, rawAlpha] = alphaMatch;
793
+ const base = baseToken.slice(1);
730
794
  return {
731
795
  bucket: 0,
732
- processed: fadeColor(`var(--${base}-color)`, rawAlpha)
796
+ processed: fadeColor(RE_HEX.test(base) ? `var(--${base}-color, #${base})` : `var(--${base}-color)`, rawAlpha)
733
797
  };
734
798
  }
735
799
  const name = token.slice(1);
@@ -762,10 +826,10 @@ function classify(raw, opts, recurse) {
762
826
  functions: void 0
763
827
  }, recurse);
764
828
  }
765
- const argProcessed = recurse(inner).output;
829
+ const parsedInner = recurse(inner);
766
830
  return {
767
- bucket: 1,
768
- processed: `${canonicalFuncName(fname)}(${argProcessed})`
831
+ bucket: fname === "var" && parsedInner.groups.length === 2 && isSingleColor(parsedInner.groups[1]) ? 0 : 1,
832
+ processed: `${canonicalFuncName(fname)}(${parsedInner.output})`
769
833
  };
770
834
  }
771
835
  if (token.startsWith("(") && token.endsWith(")")) {
@@ -782,10 +846,10 @@ function classify(raw, opts, recurse) {
782
846
  const match = token.slice(1, -1).match(/^\$([a-z_][a-zA-Z0-9-_]*)\s*,\s*(.*)$/);
783
847
  if (match) {
784
848
  const [, name, fallback] = match;
785
- const processedFallback = recurse(fallback).output;
849
+ const parsedFallback = recurse(fallback);
786
850
  return {
787
- bucket: name.endsWith("-color") ? 3 : 1,
788
- processed: `var(--${name}, ${processedFallback})`
851
+ bucket: name.endsWith("-color") ? 3 : parsedFallback.groups.length === 1 && isSingleColor(parsedFallback.groups[0]) ? 0 : 1,
852
+ processed: `var(--${name}, ${parsedFallback.output})`
789
853
  };
790
854
  }
791
855
  }
@@ -835,7 +899,7 @@ function classify(raw, opts, recurse) {
835
899
  bucket: 1,
836
900
  processed: token
837
901
  };
838
- if (token === "transparent" || token === "currentcolor") return {
902
+ if (token === "transparent" || token === "currentcolor" || isColorKeyword(token)) return {
839
903
  bucket: 0,
840
904
  processed: token
841
905
  };
@@ -985,6 +1049,16 @@ function scan(src, cb) {
985
1049
  }
986
1050
  //#endregion
987
1051
  //#region src/parser/parser.ts
1052
+ function warnSpacedCompound(src, tokens) {
1053
+ for (let i = 1; i < tokens.length; i++) {
1054
+ const prev = tokens[i - 1];
1055
+ const tok = tokens[i];
1056
+ if (prev[0] === "#" && (tok.startsWith("+#") || tok === "+" && tokens[i + 1]?.[0] === "#" || prev.endsWith("+") && tok[0] === "#")) {
1057
+ warnOnceDev(`compound-color-spaced:${src}`, `"${src}": a "+" joins colors only without spaces around it. Write "${src.replace(/(#[^\s,()+#]+)\s*\+\s*(?=#)/g, "$1+")}".`);
1058
+ return;
1059
+ }
1060
+ }
1061
+ }
988
1062
  var StyleParser = class {
989
1063
  opts;
990
1064
  cache;
@@ -1048,8 +1122,10 @@ var StyleParser = class {
1048
1122
  parts = [];
1049
1123
  }
1050
1124
  };
1125
+ const tokens = [];
1051
1126
  scan(stripped, (tok, isComma, isSlash) => {
1052
1127
  if (tok) {
1128
+ tokens.push(tok);
1053
1129
  if (currentGroup.input) currentGroup.input += ` ${tok}`;
1054
1130
  else currentGroup.input = tok;
1055
1131
  const { bucket, processed } = classify(tok, this.opts, (sub) => this.process(sub));
@@ -1059,6 +1135,7 @@ var StyleParser = class {
1059
1135
  if (isComma) endGroup();
1060
1136
  });
1061
1137
  if (currentPart.all.length || parts.length || !groups.length) endGroup(false);
1138
+ warnSpacedCompound(src, tokens);
1062
1139
  const result = {
1063
1140
  output: groups.length === 1 ? groups[0].output : groups.map((group) => group.output).join(", "),
1064
1141
  groups
@@ -1190,7 +1267,7 @@ function isSimpleColorFast(val) {
1190
1267
  break;
1191
1268
  case 116: if (val === "transparent") return true;
1192
1269
  }
1193
- return getNamedColorHex().has(val.toLowerCase());
1270
+ return isColorKeyword(val);
1194
1271
  }
1195
1272
  let colorWarningCount = 0;
1196
1273
  const MAX_COLOR_WARNINGS = 10;
@@ -1235,7 +1312,8 @@ function getGlobalParser() {
1235
1312
  function getGlobalParseFunctions() {
1236
1313
  return __tastyParseFunctions;
1237
1314
  }
1238
- let __globalPredefinedTokens = null;
1315
+ const DEFAULT_PREDEFINED_TOKENS = { "#clear": "transparent" };
1316
+ let __globalPredefinedTokens = { ...DEFAULT_PREDEFINED_TOKENS };
1239
1317
  function setGlobalPredefinedTokens(tokens) {
1240
1318
  const normalizedTokens = {};
1241
1319
  for (const [key, value] of Object.entries(tokens)) {
@@ -1247,17 +1325,17 @@ function setGlobalPredefinedTokens(tokens) {
1247
1325
  }
1248
1326
  normalizedTokens[lowerKey] = value;
1249
1327
  }
1250
- __globalPredefinedTokens = __globalPredefinedTokens ? {
1328
+ __globalPredefinedTokens = {
1251
1329
  ...__globalPredefinedTokens,
1252
1330
  ...normalizedTokens
1253
- } : normalizedTokens;
1331
+ };
1254
1332
  getOrCreateParser().clearCache();
1255
1333
  }
1256
1334
  function getGlobalPredefinedTokens() {
1257
1335
  return __globalPredefinedTokens;
1258
1336
  }
1259
1337
  function resetGlobalPredefinedTokens() {
1260
- __globalPredefinedTokens = null;
1338
+ __globalPredefinedTokens = { ...DEFAULT_PREDEFINED_TOKENS };
1261
1339
  getOrCreateParser().clearCache();
1262
1340
  }
1263
1341
  function parseStyle(value) {
@@ -1272,6 +1350,9 @@ function resolveCustomProperties(value) {
1272
1350
  if (!RE_CUSTOM_PROPERTY_REF.test(value)) return value;
1273
1351
  return parseStyle(value).output || value;
1274
1352
  }
1353
+ function isDroppedValue(value) {
1354
+ return parseStyle(value).groups.every((group) => group.all.length === 0);
1355
+ }
1275
1356
  function parseColor(val, ignoreError = false) {
1276
1357
  if (typeof val !== "string") val = String(val ?? "");
1277
1358
  val = val.trim();
@@ -1291,14 +1372,13 @@ function parseColor(val, ignoreError = false) {
1291
1372
  }
1292
1373
  firstColor = extractedColor;
1293
1374
  }
1294
- const faded = parseAlphaOverride(firstColor);
1375
+ const faded = parseAlphaMix(firstColor);
1295
1376
  const baseColor = faded ? faded.color : firstColor;
1296
1377
  const nameMatch = baseColor.match(COLOR_VAR_PATTERN);
1297
1378
  let opacity;
1298
1379
  if (faded) {
1299
- const { alpha } = faded;
1300
- const v = parseFloat(alpha);
1301
- if (!isNaN(v)) opacity = alpha.endsWith("%") ? v : v * 100;
1380
+ const v = parseFloat(faded.percentage);
1381
+ if (!isNaN(v)) opacity = v;
1302
1382
  } else if (baseColor.startsWith("rgb") || baseColor.startsWith("hsl") || baseColor.startsWith("lch") || baseColor.startsWith("oklch")) {
1303
1383
  const alphaMatch = baseColor.match(RGB_ALPHA_PATTERN);
1304
1384
  if (alphaMatch) {
@@ -1369,10 +1449,10 @@ function resolveFunctionColor(str) {
1369
1449
  //#endregion
1370
1450
  //#region src/utils/colors.ts
1371
1451
  function color(name, opacity = 1) {
1372
- if (opacity !== 1) return overrideColorAlpha(`var(--${name}-color)`, String(opacity));
1452
+ if (opacity !== 1) return mixColorAlpha(`var(--${name}-color)`, alphaToPercentage(opacity));
1373
1453
  return `var(--${name}-color)`;
1374
1454
  }
1375
1455
  //#endregion
1376
- export { strToRgb as A, StyleParser as C, getRgbValuesFromRgbaString as D, getNamedColorHex as E, RE_RAW_UNIT as F, toSnakeCase as M, CSS_WIDE_KEYWORDS as N, hexToRgb as O, RE_NUMBER as P, createColorFunc as S, makeEmptyDetails as T, stringifyStyles as _, customFunction as a, okhslFunction as b, getGlobalParser as c, parseColor as d, parseStyle as f, setGlobalPredefinedTokens as g, resolveCustomProperties as h, DIRECTIONS as i, normalizeDslName as j, hslToRgbValues as k, getGlobalPredefinedTokens as l, resetGlobalPredefinedTokens as m, resolveFunctionColor as n, filterMods as o, resetGlobalParseFunctions as p, CUSTOM_UNITS as r, getGlobalParseFunctions as s, color as t, normalizeColorTokenValue as u, okhstFunction as v, Lru as w, okhslPlugin as x, okhstPlugin as y };
1456
+ export { getRgbValuesFromRgbaString as A, createColorFunc as C, isTransparent as D, makeEmptyDetails as E, normalizeDslName as F, toSnakeCase as I, CSS_WIDE_KEYWORDS as L, hslToRgbValues as M, isColorKeyword as N, parseAlphaMix as O, strToRgb as P, RE_NUMBER as R, okhslPlugin as S, Lru as T, setGlobalPredefinedTokens as _, customFunction as a, okhstPlugin as b, getGlobalParser as c, normalizeColorTokenValue as d, parseColor as f, resolveCustomProperties as g, resetGlobalPredefinedTokens as h, DIRECTIONS as i, hexToRgb as j, getNamedColorHex as k, getGlobalPredefinedTokens as l, resetGlobalParseFunctions as m, resolveFunctionColor as n, filterMods as o, parseStyle as p, CUSTOM_UNITS as r, getGlobalParseFunctions as s, color as t, isDroppedValue as u, stringifyStyles as v, StyleParser as w, okhslFunction as x, okhstFunction as y, RE_RAW_UNIT as z };
1377
1457
 
1378
- //# sourceMappingURL=dsl-DRhFWQzo.js.map
1458
+ //# sourceMappingURL=dsl-CsFl9LGn.js.map