@tenphi/tasty 0.0.0-snapshot.e244fdb → 0.0.0-snapshot.e360574

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 (107) hide show
  1. package/README.md +404 -385
  2. package/dist/babel-types-BqWM62mn.d.ts +18 -0
  3. package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
  4. package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
  5. package/dist/chunks/build-config-CGSGH4Sb.js +60 -0
  6. package/dist/chunks/build-config-CGSGH4Sb.js.map +1 -0
  7. package/dist/chunks/{collector-B0LTHw6Z.js → collector-CbphuMNW.js} +8 -6
  8. package/dist/chunks/collector-CbphuMNW.js.map +1 -0
  9. package/dist/chunks/{config-engine-C3pF9EK9.js → config-engine-_hRNSRwz.js} +17 -12
  10. package/dist/chunks/{config-engine-C3pF9EK9.js.map → config-engine-_hRNSRwz.js.map} +1 -1
  11. package/dist/chunks/config-file-DlZXJMj8.js +25 -0
  12. package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
  13. package/dist/chunks/{css-definitions-D_it4XZH.js → css-definitions-DKApeTsI.js} +55 -30
  14. package/dist/chunks/css-definitions-DKApeTsI.js.map +1 -0
  15. package/dist/chunks/{css-resources-BN8apgxt.js → css-resources-P7IBUUZs.js} +2 -2
  16. package/dist/chunks/{css-resources-BN8apgxt.js.map → css-resources-P7IBUUZs.js.map} +1 -1
  17. package/dist/chunks/{debug-C9LeNVoJ.js → debug-Der12dU3.js} +22 -21
  18. package/dist/chunks/{debug-C9LeNVoJ.js.map → debug-Der12dU3.js.map} +1 -1
  19. package/dist/chunks/{dsl-C5yuAn41.js → dsl-Ddc5EUBK.js} +51 -41
  20. package/dist/chunks/dsl-Ddc5EUBK.js.map +1 -0
  21. package/dist/chunks/{react-runtime-O-OUrKLH.js → react-runtime-Kw_SrIv_.js} +214 -82
  22. package/dist/chunks/react-runtime-Kw_SrIv_.js.map +1 -0
  23. package/dist/chunks/{runtime-engine-DvnE2g-E.js → runtime-engine-D04uhJXm.js} +96 -102
  24. package/dist/chunks/runtime-engine-D04uhJXm.js.map +1 -0
  25. package/dist/chunks/{runtime-state-BTDqSYBk.js → runtime-state-BUq5X_CG.js} +17 -3
  26. package/dist/chunks/runtime-state-BUq5X_CG.js.map +1 -0
  27. package/dist/chunks/{shared-utils-DWA4LjIa.js → shared-utils-y-HjvPN4.js} +16 -12
  28. package/dist/chunks/{shared-utils-DWA4LjIa.js.map → shared-utils-y-HjvPN4.js.map} +1 -1
  29. package/dist/chunks/{style-engine-C1ECBZxR.js → style-engine-C2Z26n3a.js} +509 -199
  30. package/dist/chunks/style-engine-C2Z26n3a.js.map +1 -0
  31. package/dist/chunks/{zero-engine-B6EnYcXY.js → zero-engine-DaRIJYuG.js} +65 -28
  32. package/dist/chunks/zero-engine-DaRIJYuG.js.map +1 -0
  33. package/dist/{collector-hl5KNH7k.d.ts → collector-mcfTc7CF.d.ts} +2 -3
  34. package/dist/{config-DWL1ZYue.d.ts → config-mZhgbrmh.d.ts} +36 -26
  35. package/dist/core/index.d.ts +4 -4
  36. package/dist/core/index.js +8 -8
  37. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  38. package/dist/{index-D9N9GV24.d.ts → index-BFfu4ucC.d.ts} +176 -177
  39. package/dist/index.d.ts +4 -4
  40. package/dist/index.js +9 -9
  41. package/dist/{merge-styles-C_oMoJVd.d.ts → merge-styles-CaNZmN4Y.d.ts} +2 -3
  42. package/dist/ssr/astro-client.d.ts +1 -1
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +1 -2
  44. package/dist/ssr/astro-middleware-extract.d.ts +1 -2
  45. package/dist/ssr/astro-middleware-static.d.ts +1 -2
  46. package/dist/ssr/astro-middleware.d.ts +1 -2
  47. package/dist/ssr/astro.d.ts +8 -16
  48. package/dist/ssr/astro.js +7 -6
  49. package/dist/ssr/astro.js.map +1 -1
  50. package/dist/ssr/client.d.ts +2 -0
  51. package/dist/ssr/client.js +2 -0
  52. package/dist/ssr/index.d.ts +5 -25
  53. package/dist/ssr/index.js +4 -4
  54. package/dist/ssr/index.js.map +1 -1
  55. package/dist/ssr/next-config.d.ts +3 -5
  56. package/dist/ssr/next-config.js +20 -21
  57. package/dist/ssr/next-config.js.map +1 -1
  58. package/dist/ssr/next.d.ts +3 -9
  59. package/dist/ssr/next.js +5 -4
  60. package/dist/ssr/next.js.map +1 -1
  61. package/dist/static/index.d.ts +8 -9
  62. package/dist/static/index.js +4 -4
  63. package/dist/static/index.js.map +1 -1
  64. package/dist/static/inject.d.ts +1 -2
  65. package/dist/{types-jKZNpias.d.ts → types-YL3eMjVH.d.ts} +17 -67
  66. package/dist/zero/babel.d.ts +67 -2
  67. package/dist/zero/babel.js +66 -58
  68. package/dist/zero/babel.js.map +1 -1
  69. package/dist/zero/index.d.ts +44 -8
  70. package/dist/zero/index.js +24 -2
  71. package/dist/zero/index.js.map +1 -0
  72. package/dist/zero/next.d.ts +4 -5
  73. package/dist/zero/next.js +3 -7
  74. package/dist/zero/next.js.map +1 -1
  75. package/docs/README.md +4 -1
  76. package/docs/adoption.md +25 -17
  77. package/docs/ai-agents.md +59 -35
  78. package/docs/comparison.md +9 -8
  79. package/docs/configuration.md +191 -60
  80. package/docs/debug.md +3 -2
  81. package/docs/design-system.md +117 -15
  82. package/docs/dsl.md +167 -82
  83. package/docs/getting-started.md +81 -22
  84. package/docs/injector.md +39 -40
  85. package/docs/methodology.md +47 -22
  86. package/docs/migration-v3.md +2 -2
  87. package/docs/pipeline.md +50 -26
  88. package/docs/plugins.md +21 -41
  89. package/docs/react-api.md +30 -8
  90. package/docs/runtime-benchmarks.md +53 -45
  91. package/docs/ssr.md +84 -64
  92. package/docs/styles.md +69 -21
  93. package/docs/tasty-static.md +133 -56
  94. package/package.json +55 -40
  95. package/dist/babel-Zs1Q03qt.d.ts +0 -83
  96. package/dist/chunks/async-storage-CG5HnUT5.js +0 -20
  97. package/dist/chunks/async-storage-CG5HnUT5.js.map +0 -1
  98. package/dist/chunks/build-config-CUQVwdWF.js +0 -42
  99. package/dist/chunks/build-config-CUQVwdWF.js.map +0 -1
  100. package/dist/chunks/collector-B0LTHw6Z.js.map +0 -1
  101. package/dist/chunks/css-definitions-D_it4XZH.js.map +0 -1
  102. package/dist/chunks/dsl-C5yuAn41.js.map +0 -1
  103. package/dist/chunks/react-runtime-O-OUrKLH.js.map +0 -1
  104. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +0 -1
  105. package/dist/chunks/runtime-state-BTDqSYBk.js.map +0 -1
  106. package/dist/chunks/style-engine-C1ECBZxR.js.map +0 -1
  107. package/dist/chunks/zero-engine-B6EnYcXY.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { f as parseStyle, j as normalizeDslName, m as resetGlobalPredefinedTokens, p as resetGlobalParseFunctions, u as normalizeColorTokenValue, w as Lru } from "./dsl-C5yuAn41.js";
2
- import { i as warn, n as isSelector, o as isDevEnv, r as resetStyleWarnings } from "./shared-utils-DWA4LjIa.js";
3
- import { A as validateNamePrefix, B as formatFunctionPrelude, D as makeKeyframeName, F as normalizePropertyDefinition, G as registerLocalFunctionPolyfills, I as parsePropertyToken, K as resetFunctionPolyfills, M as extractLocalProperties, N as getEffectiveDefinition, O as rscClassRegexGlobal, R as extractLocalFunctions, S as PropertyTypeResolver, T as makeClassName, U as parseFunctionName, V as formatFunctionRule, _ as extractLocalFontFace, a as formatPropertyCSS, b as formatFontFaceRule, c as filterUsedKeyframes, d as replaceAnimationNames, f as resolveKeyframesNames, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, k as tastyClassRegex, l as hasLocalKeyframes, m as formatCounterStyleDeclarations, o as extractAnimationNamesFromStyles, p as extractLocalCounterStyle, r as formatRules, s as extractLocalKeyframes, u as mergeKeyframes, v as fontFaceContentHash, y as formatFontFaceDeclarations, z as formatFunctionDeclarations } from "./css-definitions-D_it4XZH.js";
4
- import { C as STYLE_HANDLER_MAP, D as resetHandlers, G as resetGlobalPolyfillsState, H as hasStylesGenerated, K as resetStylesGeneratedState, R as resetStyleChunks, S as camelToKebab, U as isFunctionsPolyfillEnabled, W as markStylesGeneratedState, a as registerBaseStyleProps, b as renderStyles, k as createStyle, n as generateChunkCacheKey, o as resetBaseStyleProps, r as categorizeStyleKeys, t as renderStylesForChunk, y as clearPipelineCache } from "./style-engine-C1ECBZxR.js";
5
- import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-C3pF9EK9.js";
6
- import { _ as resetConfigResources, a as getGlobalConfigTokens, c as getGlobalFunctions, d as mergeGlobalConfigTokens, f as mergeGlobalCounterStyles, g as mergeGlobalStyles, h as mergeGlobalProperties, i as getEffectiveProperties, l as getGlobalStyles, m as mergeGlobalFunctions, o as getGlobalCounterStyles, p as mergeGlobalFontFaces, s as getGlobalFontFaces, t as getRegisteredSSRCollector, v as setRuntimeConfigState } from "./runtime-state-BTDqSYBk.js";
7
- import { cache } from "react";
1
+ import { f as parseStyle, j as normalizeDslName, m as resetGlobalPredefinedTokens, p as resetGlobalParseFunctions, u as normalizeColorTokenValue, w as Lru } from "./dsl-Ddc5EUBK.js";
2
+ import { a as warnOnceDev, i as warn, n as isSelector, o as isDevEnv, r as resetStyleWarnings } from "./shared-utils-y-HjvPN4.js";
3
+ import { A as rscClassRegexGlobal, D as makeClassName, F as getEffectiveDefinition, H as formatFunctionDeclarations, J as registerLocalFunctionPolyfills, K as parseFunctionName, L as normalizePropertyDefinition, M as validateNamePrefix, N as hashString, P as extractLocalProperties, R as parsePropertyToken, S as formatFontFaceRule, U as formatFunctionPrelude, V as extractLocalFunctions, W as formatFunctionRule, Y as resetFunctionPolyfills, _ as formatCounterStyleRule, b as fontFaceContentHash, c as extractLocalKeyframes, d as mergeKeyframes, f as replaceAnimationNames, g as formatCounterStyleDeclarations, h as extractLocalCounterStyle, i as formatKeyframesCSS, j as tastyClassRegex, k as makeKeyframeName, l as filterUsedKeyframes, m as resolveSelectorKeyframes, o as formatPropertyCSS, p as resolveKeyframesNames, r as formatRules, s as extractAnimationNamesFromStyles, u as hasLocalKeyframes, w as PropertyTypeResolver, x as formatFontFaceDeclarations, y as extractLocalFontFace } from "./css-definitions-DKApeTsI.js";
4
+ import { C as camelToKebab, J as markStylesGeneratedState, K as hasStylesGenerated, M as createStyle, T as STYLE_HANDLER_MAP, V as resetStyleChunks, X as resetStylesGeneratedState, Y as resetGlobalPolyfillsState, a as registerBaseStyleProps, b as renderStyles, k as resetHandlers, n as generateChunkCacheKey, o as resetBaseStyleProps, q as isFunctionsPolyfillEnabled, r as categorizeStyleKeys, t as renderStylesForChunk, w as splitSelectorsSafely, y as clearPipelineCache } from "./style-engine-C2Z26n3a.js";
5
+ import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-_hRNSRwz.js";
6
+ import { _ as mergeGlobalProperties, a as getGlobalConfigTokens, b as setRuntimeConfigState, c as getGlobalFunctions, f as mergeGlobalConfigTokens, g as mergeGlobalKeyframes, h as mergeGlobalFunctions, i as getEffectiveProperties, l as getGlobalKeyframes, m as mergeGlobalFontFaces, o as getGlobalCounterStyles, p as mergeGlobalCounterStyles, s as getGlobalFontFaces, t as getRegisteredSSRCollector, u as getGlobalStyles, v as mergeGlobalStyles, y as resetConfigResources } from "./runtime-state-BUq5X_CG.js";
7
+ import React from "react";
8
8
  //#region src/prop-handlers.ts
9
9
  const GTKEY = "__tasty_prop_handlers__";
10
10
  const globalStore = globalThis;
@@ -188,38 +188,6 @@ const supportsConstructableSheets = typeof CSSStyleSheet !== "undefined" && (()
188
188
  function wrapAtRules(css, atRules) {
189
189
  return atRules?.reduce((wrapped, atRule) => `${atRule} { ${wrapped} }`, css) ?? css;
190
190
  }
191
- function splitSelectorsSafely(selectorList) {
192
- const parts = [];
193
- let buffer = "";
194
- let squareDepth = 0;
195
- let parenDepth = 0;
196
- let quote = "";
197
- for (let i = 0; i < selectorList.length; i++) {
198
- const char = selectorList[i];
199
- if (quote) {
200
- if (char === quote && selectorList[i - 1] !== "\\") quote = "";
201
- buffer += char;
202
- continue;
203
- }
204
- if (char === "\"" || char === "'") {
205
- quote = char;
206
- buffer += char;
207
- continue;
208
- }
209
- if (char === "[") squareDepth++;
210
- else if (char === "]") squareDepth = Math.max(0, squareDepth - 1);
211
- else if (char === "(") parenDepth++;
212
- else if (char === ")") parenDepth = Math.max(0, parenDepth - 1);
213
- if (char === "," && squareDepth === 0 && parenDepth === 0) {
214
- const part = buffer.trim();
215
- if (part) parts.push(part);
216
- buffer = "";
217
- } else buffer += char;
218
- }
219
- const tail = buffer.trim();
220
- if (tail) parts.push(tail);
221
- return parts;
222
- }
223
191
  function rulesToCSS(sheet) {
224
192
  return Array.from(sheet.cssRules, (rule) => rule.cssText).join("\n");
225
193
  }
@@ -395,7 +363,7 @@ var SheetManager = class {
395
363
  } catch (e) {
396
364
  const selectors = splitSelectorsSafely(rule.selector);
397
365
  if (selectors.length > 1) for (const sel of selectors) {
398
- const singleRule = wrapAtRules(`${sel} { ${declarations} }`, rule.atRules);
366
+ const singleRule = wrapAtRules(`${sel} { ${innerContent} }`, rule.atRules);
399
367
  try {
400
368
  const maxIdx = styleSheet.cssRules.length;
401
369
  const atomicIdx = this.findAvailableRuleIndex(targetSheet);
@@ -403,10 +371,12 @@ var SheetManager = class {
403
371
  styleSheet.insertRule(singleRule, idx);
404
372
  recordInsertion(idx);
405
373
  } catch (singleErr) {
406
- console.warn("[Tasty] Browser rejected CSS rule:", singleRule, singleErr);
374
+ if (process.env.NODE_ENV !== "production") console.warn("[Tasty] Browser rejected CSS rule:", singleRule, singleErr);
407
375
  }
408
376
  }
409
- else if (!(fullRule.startsWith("@property ") && !this.engineSupportsAtProperty(registry, styleSheet))) console.warn("[Tasty] Browser rejected CSS rule:", fullRule, e);
377
+ else if (process.env.NODE_ENV !== "production") {
378
+ if (!(fullRule.startsWith("@property ") && !this.engineSupportsAtProperty(registry, styleSheet))) console.warn("[Tasty] Browser rejected CSS rule:", fullRule, e);
379
+ }
410
380
  }
411
381
  } else if (styleElement) {
412
382
  const atomicRuleIndex = this.findAvailableRuleIndex(targetSheet);
@@ -968,6 +938,9 @@ function registerHydratedClass(registry, className) {
968
938
  });
969
939
  registry.pinCounts.set(className, 0);
970
940
  }
941
+ function isPreAllocated(ruleInfo) {
942
+ return ruleInfo.ruleIndex === -1 && ruleInfo.sheetIndex === -1;
943
+ }
971
944
  var StyleInjector = class {
972
945
  sheetManager;
973
946
  config;
@@ -976,6 +949,7 @@ var StyleInjector = class {
976
949
  namePrefix;
977
950
  classRegex;
978
951
  rscClassRegex;
952
+ evictions = 0;
979
953
  get _sheetManager() {
980
954
  return this.sheetManager;
981
955
  }
@@ -1070,6 +1044,18 @@ var StyleInjector = class {
1070
1044
  isNewAllocation: true
1071
1045
  };
1072
1046
  }
1047
+ reuseInjected(registry, className, pin) {
1048
+ registry.unusedSince.delete(className);
1049
+ if (pin) {
1050
+ const pins = registry.pinCounts.get(className) || 0;
1051
+ registry.pinCounts.set(className, pins + 1);
1052
+ }
1053
+ if (registry.metrics) registry.metrics.hits++;
1054
+ return {
1055
+ className,
1056
+ dispose: pin ? () => this.unpin(className, registry) : noop
1057
+ };
1058
+ }
1073
1059
  inject(rules, options) {
1074
1060
  const root = options?.root || document;
1075
1061
  const registry = this.sheetManager.getRegistry(root);
@@ -1082,28 +1068,7 @@ var StyleInjector = class {
1082
1068
  let className;
1083
1069
  if (cacheKey && registry.cacheKeyToClassName.has(cacheKey)) {
1084
1070
  className = registry.cacheKeyToClassName.get(cacheKey);
1085
- const existingRuleInfo = registry.rules.get(className);
1086
- if (existingRuleInfo.ruleIndex === -3) {
1087
- registry.unusedSince.delete(className);
1088
- if (pin) registry.pinCounts.set(className, (registry.pinCounts.get(className) || 0) + 1);
1089
- if (registry.metrics) registry.metrics.hits++;
1090
- return {
1091
- className,
1092
- dispose: pin ? () => this.unpin(className, registry) : noop
1093
- };
1094
- }
1095
- if (!(existingRuleInfo.ruleIndex === -1 && existingRuleInfo.sheetIndex === -1)) {
1096
- registry.unusedSince.delete(className);
1097
- if (pin) {
1098
- const pins = registry.pinCounts.get(className) || 0;
1099
- registry.pinCounts.set(className, pins + 1);
1100
- }
1101
- if (registry.metrics) registry.metrics.hits++;
1102
- return {
1103
- className,
1104
- dispose: pin ? () => this.unpin(className, registry) : noop
1105
- };
1106
- }
1071
+ if (!isPreAllocated(registry.rules.get(className))) return this.reuseInjected(registry, className, pin);
1107
1072
  } else if (cacheKey) {
1108
1073
  className = this.generateClassName(cacheKey);
1109
1074
  if (this.tryHydratedHit(registry, cacheKey, className)) {
@@ -1117,6 +1082,8 @@ var StyleInjector = class {
1117
1082
  } else {
1118
1083
  const parts = rules.map((r) => `${r.selector}\0${r.declarations}`);
1119
1084
  className = makeClassName(this.namePrefix, hashString(parts.join("\n")));
1085
+ const existing = registry.rules.get(className);
1086
+ if (existing && !isPreAllocated(existing)) return this.reuseInjected(registry, className, pin);
1120
1087
  }
1121
1088
  const rulesToInsert = rules.map((rule) => {
1122
1089
  let newSelector = rule.selector;
@@ -1339,11 +1306,12 @@ var StyleInjector = class {
1339
1306
  property(name, options) {
1340
1307
  const root = options?.root || document;
1341
1308
  const registry = this.sheetManager.getRegistry(root);
1342
- const effectiveResult = getEffectiveDefinition(name, {
1309
+ const userDefinition = {
1343
1310
  syntax: options?.syntax,
1344
1311
  inherits: options?.inherits,
1345
1312
  initialValue: options?.initialValue
1346
- });
1313
+ };
1314
+ const effectiveResult = getEffectiveDefinition(name, userDefinition);
1347
1315
  if (!effectiveResult.isValid) {
1348
1316
  if (isDevEnv()) console.warn(`[Tasty] property(): ${effectiveResult.error}. Got: "${name}"`);
1349
1317
  return;
@@ -1602,12 +1570,15 @@ var StyleInjector = class {
1602
1570
  else if (unused.length > capacity) doomed = unused.slice(capacity);
1603
1571
  else return 0;
1604
1572
  if (doomed.length === 0) return 0;
1605
- return this.sheetManager.deleteClasses(registry, doomed);
1573
+ const deleted = this.sheetManager.deleteClasses(registry, doomed);
1574
+ if (deleted > 0) this.evictions++;
1575
+ return deleted;
1606
1576
  }
1607
1577
  destroy(root) {
1608
1578
  flushStyles();
1609
1579
  const targetRoot = root || document;
1610
1580
  this.sheetManager.cleanup(targetRoot);
1581
+ this.evictions++;
1611
1582
  if (this.cancelPendingGC && !this.sheetManager.hasActiveRoots()) {
1612
1583
  this.cancelPendingGC();
1613
1584
  this.cancelPendingGC = null;
@@ -1617,18 +1588,18 @@ var StyleInjector = class {
1617
1588
  //#endregion
1618
1589
  //#region src/config.ts
1619
1590
  const emittedWarnings = /* @__PURE__ */ new Set();
1620
- const devMode = isDevEnv();
1591
+ const devMode$1 = isDevEnv();
1621
1592
  function warnOnce(key, message) {
1622
- if (devMode && !emittedWarnings.has(key)) {
1593
+ if (devMode$1 && !emittedWarnings.has(key)) {
1623
1594
  emittedWarnings.add(key);
1624
1595
  console.warn(message);
1625
1596
  }
1626
1597
  }
1627
1598
  let currentConfig = null;
1628
- let globalKeyframes = null;
1629
1599
  let globalRecipes = null;
1630
1600
  const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
1631
1601
  function isTestEnvironment() {
1602
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "test") return true;
1632
1603
  if (typeof global !== "undefined") {
1633
1604
  const g = global;
1634
1605
  if (g.vi || g.jest || g.expect || g.describe || g.it) return true;
@@ -1676,28 +1647,27 @@ function markStylesGenerated() {
1676
1647
  }
1677
1648
  if (configuredGlobalStyles) {
1678
1649
  for (const [selector, styles] of Object.entries(configuredGlobalStyles)) if (Object.keys(styles).length > 0) {
1679
- const rules = renderStyles(styles, selector);
1680
- if (rules.length > 0) injector.injectGlobal(rules);
1650
+ const rendered = renderStyles(styles, selector);
1651
+ if (rendered.length > 0) {
1652
+ const { rules, keyframes } = resolveSelectorKeyframes(styles, rendered, getGlobalKeyframes());
1653
+ for (const [name, steps] of keyframes ?? []) injector.keyframes(steps, {
1654
+ name,
1655
+ distinctByName: true
1656
+ });
1657
+ injector.injectGlobal(rules);
1658
+ }
1681
1659
  }
1682
1660
  }
1683
1661
  }
1684
- let _hasGlobalKeyframes = false;
1685
1662
  function hasGlobalKeyframes() {
1686
- return _hasGlobalKeyframes;
1687
- }
1688
- function getGlobalKeyframes() {
1689
- return globalKeyframes;
1663
+ return getGlobalKeyframes() !== null;
1690
1664
  }
1691
1665
  function setGlobalKeyframes(keyframes) {
1692
1666
  if (hasStylesGenerated()) {
1693
1667
  warnOnce("keyframes-after-styles", "[Tasty] Cannot update keyframes after styles have been generated.\nThe new keyframes will be ignored.");
1694
1668
  return;
1695
1669
  }
1696
- globalKeyframes = {
1697
- ...globalKeyframes ?? {},
1698
- ...keyframes
1699
- };
1700
- _hasGlobalKeyframes = Object.keys(globalKeyframes).length > 0;
1670
+ mergeGlobalKeyframes(keyframes);
1701
1671
  }
1702
1672
  function setGlobalProperties(properties) {
1703
1673
  if (hasStylesGenerated()) {
@@ -1738,7 +1708,7 @@ function setGlobalRecipes(recipes) {
1738
1708
  warnOnce("recipes-after-styles", "[Tasty] Cannot update recipes after styles have been generated.\nThe new recipes will be ignored.");
1739
1709
  return;
1740
1710
  }
1741
- if (devMode) for (const [name, recipeStyles] of Object.entries(recipes)) {
1711
+ if (devMode$1) for (const [name, recipeStyles] of Object.entries(recipes)) {
1742
1712
  if (name === "none") warnOnce("recipe-reserved-none", "[Tasty] Recipe name \"none\" is reserved. It is used as a keyword meaning \"no base recipes\" (e.g. recipe: 'none / post-recipe'). Choose a different name for your recipe.");
1743
1713
  for (const key of Object.keys(recipeStyles)) {
1744
1714
  if (isSelector(key)) warnOnce(`recipe-selector-${name}-${key}`, `[Tasty] Recipe "${name}" contains sub-element key "${key}". Recipes must be flat styles without sub-element keys. Remove the sub-element key from the recipe definition.`);
@@ -1815,8 +1785,6 @@ function getGlobalInjector() {
1815
1785
  function resetConfig() {
1816
1786
  resetStylesGeneratedState();
1817
1787
  currentConfig = null;
1818
- globalKeyframes = null;
1819
- _hasGlobalKeyframes = false;
1820
1788
  resetGlobalPolyfillsState();
1821
1789
  globalRecipes = null;
1822
1790
  resetConfigResources();
@@ -1959,14 +1927,25 @@ function createInjector(config = {}) {
1959
1927
  }
1960
1928
  //#endregion
1961
1929
  //#region src/rsc-cache.ts
1962
- const getRSCCache = cache(() => ({
1930
+ const createRSCCache = () => ({
1963
1931
  cacheKeyToClassName: /* @__PURE__ */ new Map(),
1964
1932
  emittedKeys: /* @__PURE__ */ new Set(),
1965
1933
  internalsEmitted: false,
1966
1934
  pendingCSS: [],
1967
1935
  keyToIndex: /* @__PURE__ */ new Map(),
1968
1936
  generatedNames: /* @__PURE__ */ new Map()
1969
- }));
1937
+ });
1938
+ const getRSCCache = typeof React.cache === "function" ? React.cache(createRSCCache) : createRSCCache;
1939
+ let requestScopeMissing = false;
1940
+ function checkRequestScope() {
1941
+ if (requestScopeMissing) return;
1942
+ const rscCache = getRSCCache();
1943
+ if (rscCache.scopeChecked) return;
1944
+ rscCache.scopeChecked = true;
1945
+ if (getRSCCache() === rscCache) return;
1946
+ requestScopeMissing = true;
1947
+ warnOnceDev("rsc-request-scope", "Server rendering without a style collector, outside React Server Components. Each tasty() element inlines all of its CSS, and configured globals (tokens, @property defaults such as --gap, globalStyles, @font-face) and the CSS of useGlobalStyles(), useRawCSS(), useKeyframes() and the other style functions are not emitted. Use tastyIntegration() in Astro, TastyRegistry in Next.js, or runWithCollector() from @tenphi/tasty/ssr elsewhere.");
1948
+ }
1970
1949
  function rscAllocateClassName(rscCache, cacheKey) {
1971
1950
  const existing = rscCache.cacheKeyToClassName.get(cacheKey);
1972
1951
  if (existing) return {
@@ -2000,16 +1979,22 @@ function pushRSCCSS(rscCache, key, css, replace) {
2000
1979
  rscCache.pendingCSS.push(css);
2001
1980
  return true;
2002
1981
  }
1982
+ function queueRSCCSS(rscCache, css) {
1983
+ rscCache.pendingCSS.push(css);
1984
+ }
2003
1985
  function getStyleTarget() {
2004
1986
  const collector = getRegisteredSSRCollector();
2005
1987
  if (collector) return {
2006
1988
  mode: "ssr",
2007
1989
  collector
2008
1990
  };
2009
- if (typeof document === "undefined") return {
2010
- mode: "rsc",
2011
- cache: getRSCCache()
2012
- };
1991
+ if (typeof document === "undefined") {
1992
+ checkRequestScope();
1993
+ return {
1994
+ mode: "rsc",
1995
+ cache: getRSCCache()
1996
+ };
1997
+ }
2013
1998
  return { mode: "client" };
2014
1999
  }
2015
2000
  //#endregion
@@ -2135,8 +2120,11 @@ function computeStylesRSC(styles, chunkMap, stableStyles) {
2135
2120
  }
2136
2121
  const ancillaryCSS = collectAncillaryRSC(rscCache, styles, rscUsedKf, rscKeyframeNames);
2137
2122
  if (ancillaryCSS) cssParts.push(ancillaryCSS);
2138
- if (classNames.length === 0) return EMPTY_RESULT;
2139
2123
  const css = cssParts.join("\n");
2124
+ if (classNames.length === 0) return css ? {
2125
+ className: "",
2126
+ css
2127
+ } : EMPTY_RESULT;
2140
2128
  return {
2141
2129
  className: classNames.join(" "),
2142
2130
  css: css || void 0
@@ -2148,7 +2136,10 @@ function getUsedKeyframes(styles) {
2148
2136
  if (!hasLocal && !hasGlobal) return null;
2149
2137
  const usedNames = extractAnimationNamesFromStyles(styles);
2150
2138
  if (usedNames.size === 0) return null;
2151
- return filterUsedKeyframes(mergeKeyframes(hasLocal ? extractLocalKeyframes(styles) : null, hasGlobal ? getGlobalKeyframes() : null), usedNames);
2139
+ const local = hasLocal ? extractLocalKeyframes(styles) : null;
2140
+ const global = hasGlobal ? getGlobalKeyframes() : null;
2141
+ const allKeyframes = mergeKeyframes(local, global);
2142
+ return filterUsedKeyframes(allKeyframes, usedNames);
2152
2143
  }
2153
2144
  function processChunkSSR(collector, styles, chunkName, styleKeys, stableStyles, keyframeNames) {
2154
2145
  if (styleKeys.length === 0) return null;
@@ -2311,8 +2302,10 @@ function computeStyles(styles, options) {
2311
2302
  }
2312
2303
  //#endregion
2313
2304
  //#region src/utils/filter-base-props.ts
2314
- const BasePropNames = new Set([
2305
+ const BasePropNames = /* @__PURE__ */ new Set([
2315
2306
  "role",
2307
+ "title",
2308
+ "inert",
2316
2309
  "as",
2317
2310
  "element",
2318
2311
  "css",
@@ -2331,7 +2324,7 @@ const BasePropNames = new Set([
2331
2324
  "tabIndex"
2332
2325
  ]);
2333
2326
  const eventRe = /^on[A-Z].+$/;
2334
- const ignoredEventProps = new Set([
2327
+ const ignoredEventProps = /* @__PURE__ */ new Set([
2335
2328
  "onPress",
2336
2329
  "onHoverStart",
2337
2330
  "onHoverEnd",
@@ -2346,11 +2339,11 @@ function filterBaseProps(props, opts = {}) {
2346
2339
  }
2347
2340
  //#endregion
2348
2341
  //#region src/utils/mod-attrs.ts
2349
- const cache$1 = new Lru();
2342
+ const cache = new Lru();
2350
2343
  function modAttrs(map) {
2351
2344
  if (!map) return null;
2352
2345
  const cacheKey = JSON.stringify(map);
2353
- const cached = cache$1.get(cacheKey);
2346
+ const cached = cache.get(cacheKey);
2354
2347
  if (cached) return cached;
2355
2348
  const attrs = {};
2356
2349
  for (const key of Object.keys(map)) {
@@ -2360,17 +2353,18 @@ function modAttrs(map) {
2360
2353
  if (value === true) attrs[attrName] = "";
2361
2354
  else if (typeof value === "string") attrs[attrName] = value;
2362
2355
  else if (typeof value === "number") attrs[attrName] = String(value);
2363
- else console.warn(`[Tasty] Invalid mod value for "${key}". Expected boolean, string, or number, got ${typeof value}`);
2356
+ else if (process.env.NODE_ENV !== "production") console.warn(`[Tasty] Invalid mod value for "${key}". Expected boolean, string, or number, got ${typeof value}`);
2364
2357
  }
2365
- cache$1.set(cacheKey, attrs);
2358
+ cache.set(cacheKey, attrs);
2366
2359
  return attrs;
2367
2360
  }
2368
2361
  //#endregion
2369
2362
  //#region src/utils/process-tokens.ts
2363
+ const devMode = process.env.NODE_ENV !== "production";
2370
2364
  function isValidTokenValue(value) {
2371
2365
  if (value === void 0 || value === null || value === false) return false;
2372
2366
  if (typeof value === "object") {
2373
- console.warn("[Tasty] Object values are not allowed in tokens prop. Tokens do not support state-based styling. Use a primitive value instead.");
2367
+ if (devMode) console.warn("[Tasty] Object values are not allowed in tokens prop. Tokens do not support state-based styling. Use a primitive value instead.");
2374
2368
  return false;
2375
2369
  }
2376
2370
  return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
@@ -2432,6 +2426,6 @@ function depsEqual(a, b) {
2432
2426
  return true;
2433
2427
  }
2434
2428
  //#endregion
2435
- export { propHandlerRegistry as $, ownKeyframes as A, getNamePrefix as B, holdKeyframes as C, injector as D, injectRawCSS as E, configure as F, resetConfig as G, hasGlobalRecipes as H, getConfig as I, closeBatchWindow as J, StyleInjector as K, getGlobalInjector as L, touch as M, ChunkSheetRegistry as N, isPropertyDefined as O, chunkSheetRegistry as P, resetStyleBatch as Q, getGlobalKeyframes as R, getRawCSSText as S, injectGlobal as T, isConfigLocked as U, hasGlobalKeyframes as V, isTestEnvironment as W, hasPendingStyleWrites as X, flushStyles as Y, openBatchWindow as Z, fontFace as _, filterBaseProps as a, getCSSText as b, hasKeys as c, getStyleTarget as d, pushRSCCSS as f, destroy as g, createInjector as h, modAttrs as i, property as j, keyframes as k, collectAutoInferredProperties as l, counterStyle as m, createClientState as n, computeStyles as o, cleanup as p, SheetManager as q, processTokens as r, resolveRecipes as s, depsEqual as t, collectAutoInferredPropertiesRSC as u, func as v, inject as w, getCSSTextForNode as x, gc as y, getGlobalRecipes as z };
2429
+ export { openBatchWindow as $, injector as A, getGlobalInjector as B, getCSSText as C, inject as D, holdKeyframes as E, touch as F, isConfigLocked as G, getNamePrefix as H, ChunkSheetRegistry as I, StyleInjector as J, isTestEnvironment as K, chunkSheetRegistry as L, keyframes as M, ownKeyframes as N, injectGlobal as O, property as P, hasPendingStyleWrites as Q, configure as R, gc as S, getRawCSSText as T, hasGlobalKeyframes as U, getGlobalRecipes as V, hasGlobalRecipes as W, closeBatchWindow as X, SheetManager as Y, flushStyles as Z, counterStyle as _, filterBaseProps as a, fontFace as b, hasKeys as c, checkRequestScope as d, resetStyleBatch as et, getRSCCache as f, cleanup as g, queueRSCCSS as h, modAttrs as i, isPropertyDefined as j, injectRawCSS as k, collectAutoInferredProperties as l, pushRSCCSS as m, createClientState as n, computeStyles as o, getStyleTarget as p, resetConfig as q, processTokens as r, resolveRecipes as s, depsEqual as t, propHandlerRegistry as tt, collectAutoInferredPropertiesRSC as u, createInjector as v, getCSSTextForNode as w, func as x, destroy as y, getConfig as z };
2436
2430
 
2437
- //# sourceMappingURL=runtime-engine-DvnE2g-E.js.map
2431
+ //# sourceMappingURL=runtime-engine-D04uhJXm.js.map