@tenphi/tasty 0.0.0-snapshot.b7bfdb1 → 0.0.0-snapshot.b9638e2

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 (86) hide show
  1. package/dist/astro-B-GRlMsD.js +301 -0
  2. package/dist/astro-B-GRlMsD.js.map +1 -0
  3. package/dist/{babel-Brsw7Ax_.d.ts → babel-Co7AQYZi.d.ts} +2 -2
  4. package/dist/{collector-0YO-P1vW.d.ts → collector-DcFus-on.d.ts} +77 -11
  5. package/dist/collector-lSNHiyV4.js +507 -0
  6. package/dist/collector-lSNHiyV4.js.map +1 -0
  7. package/dist/{config-DsqqkmUs.js → config-0BOip6sG.js} +279 -42
  8. package/dist/config-0BOip6sG.js.map +1 -0
  9. package/dist/{config-CscQCTAM.d.ts → config-CX1uhP_J.d.ts} +64 -14
  10. package/dist/core/index.d.ts +4 -4
  11. package/dist/core/index.js +5 -5
  12. package/dist/{core-KVEKOhEi.js → core-9-MlDDty.js} +323 -80
  13. package/dist/core-9-MlDDty.js.map +1 -0
  14. package/dist/css-resources-Cyl_axbI.js +149 -0
  15. package/dist/css-resources-Cyl_axbI.js.map +1 -0
  16. package/dist/{css-writer-Cdrh5gHj.js → css-writer-Cqwf5R9j.js} +3 -3
  17. package/dist/{css-writer-Cdrh5gHj.js.map → css-writer-Cqwf5R9j.js.map} +1 -1
  18. package/dist/{format-rules-CHNmNGhw.js → format-rules-BDyJWLM4.js} +22 -32
  19. package/dist/format-rules-BDyJWLM4.js.map +1 -0
  20. package/dist/{hydrate-DJhwbWq4.js → hydrate-BO7AdF5u.js} +2 -2
  21. package/dist/{hydrate-DJhwbWq4.js.map → hydrate-BO7AdF5u.js.map} +1 -1
  22. package/dist/{index-BR9as3qn.d.ts → index-DTR1j9lI.d.ts} +14 -12
  23. package/dist/{index-BmogEzTo.d.ts → index-DilKPhLV.d.ts} +9 -1
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +42 -26
  26. package/dist/index.js.map +1 -1
  27. package/dist/{keyframes-CQY-i8dO.js → keyframes-WdECyw4q.js} +25 -3
  28. package/dist/keyframes-WdECyw4q.js.map +1 -0
  29. package/dist/{merge-styles-BcLl1u_d.d.ts → merge-styles-DYO-_fVF.d.ts} +2 -2
  30. package/dist/{merge-styles-voA8J__3.js → merge-styles-a4-oNeJL.js} +2 -2
  31. package/dist/{merge-styles-voA8J__3.js.map → merge-styles-a4-oNeJL.js.map} +1 -1
  32. package/dist/precompile/index.d.ts +11 -0
  33. package/dist/precompile/index.js +67 -0
  34. package/dist/precompile/index.js.map +1 -0
  35. package/dist/precompile/register.d.ts +13 -0
  36. package/dist/precompile/register.js +2 -0
  37. package/dist/register-B_l2owXe.js +164 -0
  38. package/dist/register-B_l2owXe.js.map +1 -0
  39. package/dist/{resolve-recipes-BP2NqOtQ.js → resolve-recipes-C7bE_z63.js} +3 -3
  40. package/dist/{resolve-recipes-BP2NqOtQ.js.map → resolve-recipes-C7bE_z63.js.map} +1 -1
  41. package/dist/ssr/astro-client.js +1 -1
  42. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  43. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  44. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  45. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  46. package/dist/ssr/astro-middleware-extract.js +9 -0
  47. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  48. package/dist/ssr/astro-middleware-static.d.ts +3 -1
  49. package/dist/ssr/astro-middleware-static.js +1 -1
  50. package/dist/ssr/astro-middleware.d.ts +3 -1
  51. package/dist/ssr/astro-middleware.js +1 -1
  52. package/dist/ssr/astro.d.ts +45 -3
  53. package/dist/ssr/astro.js +1 -156
  54. package/dist/ssr/index.d.ts +2 -2
  55. package/dist/ssr/index.js +3 -3
  56. package/dist/ssr/index.js.map +1 -1
  57. package/dist/ssr/next-config.d.ts +66 -0
  58. package/dist/ssr/next-config.js +115 -0
  59. package/dist/ssr/next-config.js.map +1 -0
  60. package/dist/ssr/next.d.ts +9 -2
  61. package/dist/ssr/next.js +26 -9
  62. package/dist/ssr/next.js.map +1 -1
  63. package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
  64. package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
  65. package/dist/static/index.d.ts +2 -2
  66. package/dist/static/index.js +1 -1
  67. package/dist/types-DoTCVFsG.d.ts +65 -0
  68. package/dist/zero/babel.d.ts +1 -1
  69. package/dist/zero/babel.js +4 -4
  70. package/dist/zero/babel.js.map +1 -1
  71. package/dist/zero/index.d.ts +1 -1
  72. package/dist/zero/index.js +1 -1
  73. package/dist/zero/next.d.ts +1 -1
  74. package/docs/README.md +3 -1
  75. package/docs/debug.md +11 -4
  76. package/docs/precompile.md +172 -0
  77. package/docs/runtime-benchmarks.md +10 -1
  78. package/docs/ssr.md +179 -20
  79. package/package.json +37 -8
  80. package/dist/collector-DJqx7XO0.js +0 -304
  81. package/dist/collector-DJqx7XO0.js.map +0 -1
  82. package/dist/config-DsqqkmUs.js.map +0 -1
  83. package/dist/core-KVEKOhEi.js.map +0 -1
  84. package/dist/format-rules-CHNmNGhw.js.map +0 -1
  85. package/dist/keyframes-CQY-i8dO.js.map +0 -1
  86. package/dist/ssr/astro.js.map +0 -1
@@ -2561,8 +2561,8 @@ function resetStyleChunks() {
2561
2561
  * unused is one property load and one branch.
2562
2562
  */
2563
2563
  const GTKEY$1 = "__tasty_prop_handlers__";
2564
- const globalStore$1 = globalThis;
2565
- const propHandlerRegistry = globalStore$1[GTKEY$1] ?? (globalStore$1[GTKEY$1] = {
2564
+ const globalStore$2 = globalThis;
2565
+ const propHandlerRegistry = globalStore$2[GTKEY$1] ?? (globalStore$2[GTKEY$1] = {
2566
2566
  apply: null,
2567
2567
  list: []
2568
2568
  });
@@ -3186,7 +3186,14 @@ function resetStyleBatch() {
3186
3186
  * Automatically infers CSS @property types from custom property values.
3187
3187
  * Supports deferred resolution for var() reference chains of arbitrary depth.
3188
3188
  */
3189
- const CUSTOM_PROP_DECL = /^\s*(--[a-z0-9_-]+)\s*:\s*(.+?)\s*$/i;
3189
+ /**
3190
+ * One `--name: value` declaration, with the surrounding whitespace dropped.
3191
+ *
3192
+ * The value is anchored on `\S` at both ends so no two quantifiers can claim
3193
+ * the same character. A lazy `(.+?)\s*$` is quadratic on a value of nothing
3194
+ * but spaces — every split point gets tried (CodeQL `js/polynomial-redos`).
3195
+ */
3196
+ const CUSTOM_PROP_DECL = /^\s*(--[a-z0-9_-]+)\s*:\s*(\S|\S.*\S)\s*$/i;
3190
3197
  const SINGLE_VAR_REF = /^var\((--[a-z0-9_-]+)\)$/i;
3191
3198
  var PropertyTypeResolver = class {
3192
3199
  /** propName → the prop it depends on */
@@ -5030,6 +5037,7 @@ var SheetManager = class {
5030
5037
  if (!registry) {
5031
5038
  const metrics = this.config.devMode ? {
5032
5039
  hits: 0,
5040
+ precompiledHits: 0,
5033
5041
  misses: 0,
5034
5042
  bulkCleanups: 0,
5035
5043
  totalInsertions: 0,
@@ -5525,25 +5533,31 @@ var SheetManager = class {
5525
5533
  return registry.sheets.reduce((total, sheet) => total + sheet.ruleCount - sheet.holes.length, 0);
5526
5534
  }
5527
5535
  /**
5528
- * Get CSS text from all sheets (for SSR)
5536
+ * The CSS of one managed sheet, or `null` when it holds none this can read —
5537
+ * an empty style element, or a sheet the engine refuses to hand over.
5529
5538
  */
5530
- getCSSText(registry) {
5531
- const cssChunks = [];
5532
- for (const sheetInfo of registry.sheets) try {
5533
- if (sheetInfo.constructableSheet) {
5534
- const rules = Array.from(sheetInfo.constructableSheet.cssRules);
5535
- cssChunks.push(rules.map((rule) => rule.cssText).join("\n"));
5536
- } else if (sheetInfo.sheet) {
5539
+ readSheetCSS(sheetInfo) {
5540
+ try {
5541
+ if (sheetInfo.constructableSheet) return Array.from(sheetInfo.constructableSheet.cssRules).map((rule) => rule.cssText).join("\n");
5542
+ if (sheetInfo.sheet) {
5537
5543
  const styleElement = sheetInfo.sheet;
5538
- if (styleElement.textContent) cssChunks.push(styleElement.textContent);
5539
- else if (styleElement.sheet) {
5540
- const rules = Array.from(styleElement.sheet.cssRules);
5541
- cssChunks.push(rules.map((rule) => rule.cssText).join("\n"));
5542
- }
5544
+ if (styleElement.textContent) return styleElement.textContent;
5545
+ if (styleElement.sheet) return Array.from(styleElement.sheet.cssRules).map((rule) => rule.cssText).join("\n");
5543
5546
  }
5544
5547
  } catch (error) {
5545
5548
  console.warn("[Tasty] Failed to read CSS from sheet:", error);
5546
5549
  }
5550
+ return null;
5551
+ }
5552
+ /**
5553
+ * Get CSS text from all sheets (for SSR)
5554
+ */
5555
+ getCSSText(registry) {
5556
+ const cssChunks = [];
5557
+ for (const sheetInfo of registry.sheets) {
5558
+ const css = this.readSheetCSS(sheetInfo);
5559
+ if (css !== null) cssChunks.push(css);
5560
+ }
5547
5561
  return cssChunks.join("\n");
5548
5562
  }
5549
5563
  /**
@@ -5562,6 +5576,7 @@ var SheetManager = class {
5562
5576
  resetMetrics(registry) {
5563
5577
  if (registry.metrics) registry.metrics = {
5564
5578
  hits: 0,
5579
+ precompiledHits: 0,
5565
5580
  misses: 0,
5566
5581
  bulkCleanups: 0,
5567
5582
  totalInsertions: 0,
@@ -5855,6 +5870,49 @@ var SheetManager = class {
5855
5870
  /**
5856
5871
  * Get the raw CSS content
5857
5872
  */
5873
+ /**
5874
+ * The CSS this injector owns in `root`, one entry per sheet, in the order the
5875
+ * engine applies them.
5876
+ *
5877
+ * `getCSSText()` walks the managed sheets only, and raw CSS has its own —
5878
+ * which sits before, after, or *between* them depending on how it got there:
5879
+ * prepended to `adoptedStyleSheets`, or wherever in `<head>` the first raw
5880
+ * injection happened to land, with every managed sheet opened afterwards
5881
+ * following it. Reporting a fixed order would describe the opposite winner
5882
+ * from the live page whenever two rules of equal specificity meet, so the raw
5883
+ * sheet is spliced in at the position the DOM actually gives it.
5884
+ */
5885
+ getOwnedCSSInOrder(registry, root) {
5886
+ const raw = this.getRawCSSText(root);
5887
+ const rawElement = this.isAdoptedMode(root) ? null : this.rawStyleElements.get(root);
5888
+ let rawIndex = raw && !rawElement ? 0 : -1;
5889
+ const chunks = [];
5890
+ for (const sheetInfo of registry.sheets) {
5891
+ const css = this.readSheetCSS(sheetInfo);
5892
+ if (css === null) continue;
5893
+ if (rawIndex < 0 && rawElement && sheetInfo.sheet && rawElement.compareDocumentPosition(sheetInfo.sheet) & Node.DOCUMENT_POSITION_FOLLOWING) rawIndex = chunks.length;
5894
+ chunks.push(css);
5895
+ }
5896
+ if (!raw) return chunks;
5897
+ chunks.splice(rawIndex < 0 ? chunks.length : rawIndex, 0, raw);
5898
+ return chunks;
5899
+ }
5900
+ /**
5901
+ * Top-level rules in the raw sheet.
5902
+ *
5903
+ * Read from the sheet the engine parsed, not from the text: a raw block is
5904
+ * one string but any number of rules, and one rule — `@keyframes`, `@media` —
5905
+ * can contain any number of blocks, so counting braces answers neither
5906
+ * question.
5907
+ */
5908
+ getRawRuleCount(root) {
5909
+ const sheet = this.isAdoptedMode(root) ? this.rawConstructableSheets.get(root) : this.rawStyleElements.get(root)?.sheet;
5910
+ try {
5911
+ return sheet?.cssRules.length ?? 0;
5912
+ } catch {
5913
+ return 0;
5914
+ }
5915
+ }
5858
5916
  getRawCSSText(root) {
5859
5917
  if (this.isAdoptedMode(root)) {
5860
5918
  const blocksMap = this.rawCSSBlocks.get(root);
@@ -6051,11 +6109,43 @@ var StyleInjector = class {
6051
6109
  namePrefix;
6052
6110
  classRegex;
6053
6111
  rscClassRegex;
6112
+ precompiledRevision = -1;
6054
6113
  /** @internal — exposed for debug utilities only */
6055
6114
  get _sheetManager() {
6056
6115
  return this.sheetManager;
6057
6116
  }
6058
6117
  /**
6118
+ * Seed deduplication metadata for rules supplied by an immutable external
6119
+ * stylesheet. This records no owned sheet entries and performs no CSS work.
6120
+ * @internal
6121
+ */
6122
+ registerPrecompiledDependencies(dependencies, revision) {
6123
+ if (typeof document === "undefined" || this.precompiledRevision === revision) return;
6124
+ const registry = this.sheetManager.getRegistry(document);
6125
+ for (const item of dependencies.properties) if (!registry.injectedProperties.has(item.name)) registry.injectedProperties.set(item.name, item.definition);
6126
+ for (const hash of dependencies.fontFaces) registry.injectedFontFaces.add(hash);
6127
+ for (const item of dependencies.counterStyles) if (!registry.injectedCounterStyles.has(item.name)) registry.injectedCounterStyles.set(item.name, true);
6128
+ for (const name of dependencies.functions) if (!registry.injectedFunctions.has(name)) registry.injectedFunctions.set(name, true);
6129
+ for (const item of dependencies.keyframes) {
6130
+ if (!registry.keyframesCache.has(item.contentKey)) registry.keyframesCache.set(item.contentKey, {
6131
+ name: item.name,
6132
+ refCount: Number.POSITIVE_INFINITY,
6133
+ info: {
6134
+ name: item.name,
6135
+ ruleIndex: -2,
6136
+ sheetIndex: -2
6137
+ }
6138
+ });
6139
+ if (!registry.keyframesNameToContent.has(item.name)) registry.keyframesNameToContent.set(item.name, item.contentKey);
6140
+ if (!registry.localKeyframes.has(item.name)) registry.localKeyframes.set(item.name, {
6141
+ name: item.name,
6142
+ dispose: () => {},
6143
+ owners: /* @__PURE__ */ new Set()
6144
+ });
6145
+ }
6146
+ this.precompiledRevision = revision;
6147
+ }
6148
+ /**
6059
6149
  * Whether sheet writes should be queued instead of applied immediately.
6060
6150
  *
6061
6151
  * Only ever true on the client: SSR collects CSS as text and the RSC path
@@ -6135,6 +6225,28 @@ var StyleInjector = class {
6135
6225
  return false;
6136
6226
  }
6137
6227
  /**
6228
+ * Resolve an already-owned or server-hydrated class before its declarations
6229
+ * are rendered. A miss does not reserve a class or mutate the rule cache.
6230
+ * @internal
6231
+ */
6232
+ prepareClassName(cacheKey, options) {
6233
+ const root = options?.root || document;
6234
+ const registry = this.sheetManager.getRegistry(root);
6235
+ const mapped = registry.cacheKeyToClassName.get(cacheKey);
6236
+ if (mapped) {
6237
+ const info = registry.rules.get(mapped);
6238
+ if (info && !(info.ruleIndex === -1 && info.sheetIndex === -1)) return {
6239
+ className: mapped,
6240
+ isExisting: true
6241
+ };
6242
+ }
6243
+ const className = this.generateClassName(cacheKey);
6244
+ return {
6245
+ className,
6246
+ isExisting: this.tryHydratedHit(registry, cacheKey, className)
6247
+ };
6248
+ }
6249
+ /**
6138
6250
  * Allocate a className for a cacheKey without injecting styles yet.
6139
6251
  * This allows separating className allocation (render phase) from style injection (insertion phase).
6140
6252
  */
@@ -6182,8 +6294,10 @@ var StyleInjector = class {
6182
6294
  dispose: () => {}
6183
6295
  };
6184
6296
  const cacheKey = options?.cacheKey;
6297
+ const preparedClassName = options?.preparedClassName;
6185
6298
  let className;
6186
- if (cacheKey && registry.cacheKeyToClassName.has(cacheKey)) {
6299
+ if (preparedClassName) className = preparedClassName;
6300
+ else if (cacheKey && registry.cacheKeyToClassName.has(cacheKey)) {
6187
6301
  className = registry.cacheKeyToClassName.get(cacheKey);
6188
6302
  const existingRuleInfo = registry.rules.get(className);
6189
6303
  if (existingRuleInfo.ruleIndex === -3) {
@@ -6387,45 +6501,36 @@ var StyleInjector = class {
6387
6501
  return this.sheetManager.getRawCSSText(root);
6388
6502
  }
6389
6503
  /**
6390
- * Take a reference on local `@keyframes` and report what they ended up being
6391
- * called, without deciding yet which classes own them.
6392
- *
6393
- * Names have to be resolved before the rules that animate them are written:
6394
- * an injected name can differ from the authored one, and a rule written
6395
- * first cannot be rewritten afterwards — its cache key is already claimed,
6396
- * so the second write is a hit and the corrected declarations are dropped.
6504
+ * Take a reference on local `@keyframes`, under the deterministic names the
6505
+ * caller resolved.
6397
6506
  *
6398
6507
  * One reference per distinct set of steps, shared by every class that ends up
6399
6508
  * animating it, so a repeat render takes nothing further. Ownership is
6400
6509
  * assigned by `ownKeyframes()` once the rules exist to be inspected.
6401
6510
  */
6402
- holdKeyframes(steps, options) {
6511
+ holdKeyframes(steps, names, options) {
6403
6512
  const root = options?.root || document;
6404
6513
  const registry = this.sheetManager.getRegistry(root);
6405
- const names = /* @__PURE__ */ new Map();
6406
6514
  const keys = /* @__PURE__ */ new Map();
6407
6515
  for (const [authored, definition] of Object.entries(steps)) {
6408
- const key = `${authored}\u0000${JSON.stringify(definition)}`;
6409
- let entry = registry.localKeyframes.get(key);
6516
+ const resolved = names.get(authored) ?? authored;
6517
+ let entry = registry.localKeyframes.get(resolved);
6410
6518
  if (!entry) {
6411
6519
  const injected = this.keyframes(definition, {
6412
- name: authored,
6413
- root
6520
+ name: resolved,
6521
+ root,
6522
+ distinctByName: true
6414
6523
  });
6415
6524
  entry = {
6416
6525
  name: injected.toString(),
6417
6526
  dispose: injected.dispose,
6418
6527
  owners: /* @__PURE__ */ new Set()
6419
6528
  };
6420
- registry.localKeyframes.set(key, entry);
6529
+ registry.localKeyframes.set(resolved, entry);
6421
6530
  }
6422
- keys.set(authored, key);
6423
- names.set(authored, entry.name);
6531
+ keys.set(authored, resolved);
6424
6532
  }
6425
- return {
6426
- names,
6427
- keys
6428
- };
6533
+ return keys;
6429
6534
  }
6430
6535
  /**
6431
6536
  * Record that `className` animates these keyframes, so the reference is
@@ -6438,6 +6543,15 @@ var StyleInjector = class {
6438
6543
  ownKeyframes(key, className, options) {
6439
6544
  this.sheetManager.getRegistry(options?.root || document).localKeyframes.get(key)?.owners.add(className);
6440
6545
  }
6546
+ /** Record a chunk lookup served by an immutable external stylesheet. */
6547
+ recordPrecompiledHit(options) {
6548
+ if (!this.config.devMode) return;
6549
+ const registry = this.sheetManager.getRegistry(options?.root || document);
6550
+ if (registry.metrics) {
6551
+ registry.metrics.hits++;
6552
+ registry.metrics.precompiledHits++;
6553
+ }
6554
+ }
6441
6555
  /**
6442
6556
  * Pin an already-injected cacheKey and return the handle that releases it.
6443
6557
  * For callers that skipped the pipeline on a cache hit but still need the
@@ -6694,13 +6808,14 @@ var StyleInjector = class {
6694
6808
  keyframes(steps, nameOrOptions) {
6695
6809
  const isStringName = typeof nameOrOptions === "string";
6696
6810
  const providedName = isStringName ? nameOrOptions : nameOrOptions?.name;
6811
+ const distinctByName = isStringName ? false : nameOrOptions?.distinctByName ?? false;
6697
6812
  const root = isStringName ? document : nameOrOptions?.root || document;
6698
6813
  const registry = this.sheetManager.getRegistry(root);
6699
6814
  if (Object.keys(steps).length === 0) return {
6700
6815
  toString: () => "",
6701
6816
  dispose: () => {}
6702
6817
  };
6703
- const contentHash = JSON.stringify(steps);
6818
+ const contentHash = distinctByName && providedName ? `${providedName}\u0000${JSON.stringify(steps)}` : JSON.stringify(steps);
6704
6819
  const existing = registry.keyframesCache.get(contentHash);
6705
6820
  if (existing) {
6706
6821
  existing.refCount++;
@@ -6717,7 +6832,7 @@ var StyleInjector = class {
6717
6832
  actualName = providedName;
6718
6833
  registry.keyframesNameToContent.set(providedName, contentHash);
6719
6834
  }
6720
- } else actualName = makeKeyframeName(this.namePrefix, String(registry.keyframesCounter++));
6835
+ } else actualName = makeKeyframeName(this.namePrefix, hashString(contentHash));
6721
6836
  const applyWrite = () => {
6722
6837
  const result = this.sheetManager.insertKeyframes(registry, steps, actualName, root);
6723
6838
  if (!result) return false;
@@ -6933,6 +7048,127 @@ var StyleInjector = class {
6933
7048
  }
6934
7049
  };
6935
7050
  //#endregion
7051
+ //#region src/precompile/runtime.ts
7052
+ const STORE_KEY = Symbol.for("@tenphi/tasty/precompiled/v1");
7053
+ const globalStore$1 = globalThis;
7054
+ const store = globalStore$1[STORE_KEY] ??= {
7055
+ manifests: null,
7056
+ chunks: null,
7057
+ dependencies: null,
7058
+ buildCount: 0,
7059
+ active: false,
7060
+ revision: 0,
7061
+ warnings: null
7062
+ };
7063
+ const EMPTY_DEPENDENCIES = Object.freeze({
7064
+ properties: Object.freeze([]),
7065
+ keyframes: Object.freeze([]),
7066
+ fontFaces: Object.freeze([]),
7067
+ counterStyles: Object.freeze([]),
7068
+ functions: Object.freeze([]),
7069
+ rscKeys: Object.freeze([])
7070
+ });
7071
+ function getPrecompileStore() {
7072
+ return store;
7073
+ }
7074
+ function warnPrecompileOnce(key, message) {
7075
+ if (!isDevEnv()) return;
7076
+ const warnings = store.warnings ??= /* @__PURE__ */ new Set();
7077
+ if (warnings.has(key)) return;
7078
+ warnings.add(key);
7079
+ console.warn(message);
7080
+ }
7081
+ /** Shared single-read gate for the unregistered render hot path. */
7082
+ const precompileRuntimeState = store;
7083
+ /** @internal Keep catalog recording on the isolated compiler path. */
7084
+ function beginPrecompileBuild() {
7085
+ store.buildCount = (store.buildCount ?? 0) + 1;
7086
+ store.active = true;
7087
+ }
7088
+ /** @internal Balance beginPrecompileBuild(), including failed catalog cases. */
7089
+ function endPrecompileBuild() {
7090
+ store.buildCount--;
7091
+ if (store.buildCount === 0 && store.chunks === null) store.active = false;
7092
+ }
7093
+ function findPrecompiledChunk(lookupKey, namePrefix) {
7094
+ const chunk = store.chunks?.get(lookupKey);
7095
+ if (!chunk) return null;
7096
+ if (chunk.namePrefix !== namePrefix) {
7097
+ warnPrecompileOnce(`prefix:${chunk.manifestId}:${namePrefix}`, `[Tasty] Ignoring precompiled styles "${chunk.manifestId}": generated with namePrefix "${chunk.namePrefix}", but the runtime uses "${namePrefix}".`);
7098
+ return null;
7099
+ }
7100
+ return chunk;
7101
+ }
7102
+ function getPrecompiledRevision() {
7103
+ return store.revision;
7104
+ }
7105
+ function getRegisteredPrecompiledDependencies(namePrefix) {
7106
+ return store.dependencies?.get(namePrefix) ?? EMPTY_DEPENDENCIES;
7107
+ }
7108
+ /** @internal Metadata used by tastyDebug without reading or parsing CSSOM. */
7109
+ function getRegisteredPrecompiledStats(namePrefix) {
7110
+ const classNames = /* @__PURE__ */ new Set();
7111
+ let manifestCount = 0;
7112
+ let cssSize = 0;
7113
+ let ruleCount = 0;
7114
+ for (const manifest of store.manifests?.values() ?? []) {
7115
+ if (manifest.namePrefix !== namePrefix) continue;
7116
+ manifestCount++;
7117
+ cssSize += manifest.stats.cssSize;
7118
+ ruleCount += manifest.stats.ruleCount;
7119
+ for (const chunk of manifest.chunks) classNames.add(chunk.className);
7120
+ }
7121
+ return {
7122
+ manifestCount,
7123
+ classNames: [...classNames],
7124
+ cssSize,
7125
+ ruleCount
7126
+ };
7127
+ }
7128
+ function applyRegisteredDependenciesToInjector(injector, namePrefix) {
7129
+ if (!store.manifests) return;
7130
+ injector.registerPrecompiledDependencies(getRegisteredPrecompiledDependencies(namePrefix), store.revision);
7131
+ }
7132
+ function applyRegisteredDependenciesToRSC(cache, namePrefix) {
7133
+ if (cache.precompiledRevision === store.revision) return;
7134
+ for (const key of cache.precompiledEmittedKeys) cache.emittedKeys.delete(key);
7135
+ for (const [key, name] of cache.precompiledGeneratedNames) if (cache.generatedNames.get(key) === name) cache.generatedNames.delete(key);
7136
+ cache.precompiledEmittedKeys.clear();
7137
+ cache.precompiledGeneratedNames.clear();
7138
+ if (!store.manifests) {
7139
+ cache.precompiledRevision = store.revision;
7140
+ return;
7141
+ }
7142
+ const dependencies = getRegisteredPrecompiledDependencies(namePrefix);
7143
+ for (const key of dependencies.rscKeys) {
7144
+ cache.emittedKeys.add(key);
7145
+ cache.precompiledEmittedKeys.add(key);
7146
+ }
7147
+ for (const item of dependencies.keyframes) for (const key of item.rscKeys) {
7148
+ cache.emittedKeys.add(key);
7149
+ cache.generatedNames.set(key, item.name);
7150
+ cache.precompiledEmittedKeys.add(key);
7151
+ cache.precompiledGeneratedNames.set(key, item.name);
7152
+ }
7153
+ for (const item of dependencies.counterStyles) for (const key of item.rscKeys) {
7154
+ cache.emittedKeys.add(key);
7155
+ cache.generatedNames.set(key, item.name);
7156
+ cache.precompiledEmittedKeys.add(key);
7157
+ cache.precompiledGeneratedNames.set(key, item.name);
7158
+ }
7159
+ cache.precompiledRevision = store.revision;
7160
+ }
7161
+ /** @internal Test-only reset; resetConfig() calls this to isolate suites. */
7162
+ function resetPrecompiledStyles() {
7163
+ store.manifests = null;
7164
+ store.chunks = null;
7165
+ store.dependencies = null;
7166
+ store.buildCount = 0;
7167
+ store.active = false;
7168
+ store.revision++;
7169
+ store.warnings?.clear();
7170
+ }
7171
+ //#endregion
6936
7172
  //#region src/states/index.ts
6937
7173
  /**
6938
7174
  * Advanced State Mapping - Predefined States Management
@@ -11801,7 +12037,7 @@ function createDefaultConfig(isTest) {
11801
12037
  function markStylesGenerated() {
11802
12038
  if (stylesGenerated) return;
11803
12039
  stylesGenerated = true;
11804
- if (typeof document !== "undefined" && document.querySelector("style[data-tasty-ssr]")) {
12040
+ if (typeof document !== "undefined" && document.querySelector("[data-tasty-ssr]")) {
11805
12041
  warnOnce("ssr-globals-skip", "[Tasty] SSR styles detected — skipping client-side global CSS injection to avoid duplicates.");
11806
12042
  return;
11807
12043
  }
@@ -12362,12 +12598,13 @@ function resetConfig() {
12362
12598
  resetPropHandlers();
12363
12599
  resetBaseStyleProps();
12364
12600
  clearPipelineCache();
12601
+ resetPrecompiledStyles();
12365
12602
  emittedWarnings.clear();
12366
12603
  resetStyleWarnings();
12367
12604
  const storage = typeof window !== "undefined" ? window : globalThis;
12368
12605
  delete storage[GLOBAL_INJECTOR_KEY];
12369
12606
  }
12370
12607
  //#endregion
12371
- export { SheetManager as $, StyleParser as $t, FLOW_STYLES as A, STYLE_TO_CHUNK as At, createStateParserContext as B, getGlobalParseFunctions as Bt, BASE_STYLES as C, APPEARANCE_CHUNK_STYLES as Ct, COLOR_STYLES as D, FONT_CHUNK_STYLES as Dt, BLOCK_STYLES as E, DISPLAY_CHUNK_STYLES as Et, hasPipelineCacheEntry as F, registerFunctionPolyfill as Ft, StyleInjector as G, parseStyle as Gt, extractPredefinedStateRefs as H, getGlobalPredefinedTokens as Ht, isSelector as I, registerLocalFunctionPolyfills as It, hasLocalCounterStyle as J, okhstPlugin as Jt, extractLocalCounterStyle as K, stringifyStyles as Kt, renderStyles as L, CUSTOM_UNITS as Lt, OUTER_STYLES as M, formatFunctionRule as Mt, POSITION_STYLES as N, hasLocalFunctions as Nt, CONTAINER_STYLES as O, LAYOUT_CHUNK_STYLES as Ot, TEXT_STYLES as P, parseFunctionName as Pt, hasLocalFontFace as Q, isDevEnv as Qt, parseStateKey as R, DIRECTIONS as Rt, baseStylePropsRegistry as S, propHandlerRegistry as St, BLOCK_OUTER_STYLES as T, DIMENSION_CHUNK_STYLES as Tt, getGlobalPredefinedStates as U, normalizeColorTokenValue as Ut, extractLocalPredefinedStates as V, getGlobalParser as Vt, setGlobalPredefinedStates as W, parseColor as Wt, fontFaceContentHash as X, okhslPlugin as Xt, extractLocalFontFace as Y, okhslFunction as Yt, formatFontFaceRule as Z, createColorFunc as Zt, isFunctionsPolyfillEnabled as _, hashString as _t, getGlobalCounterStyles as a, hslToRgbValues as an, closeBatchWindow as at, resetConfig as b, hasLocalProperties as bt, getGlobalInjector as c, openBatchWindow as ct, getGlobalStyles as d, DEFAULT_ZERO_NAME_PREFIX as dt, Lru as en, STYLE_HANDLER_MAP as et, getNamePrefix as f, makeClassName as ft, isConfigLocked as g, validateNamePrefix as gt, hasStylesGenerated as h, tastyClassRegex as ht, getGlobalConfigTokens as i, hexToRgb as in, PropertyTypeResolver as it, INNER_STYLES as j, extractLocalFunctions as jt, DIMENSION_STYLES as k, POSITION_CHUNK_STYLES as kt, getGlobalKeyframes as l, resetStyleBatch as lt, hasGlobalRecipes as m, makeKeyframeName as mt, getConfig as n, getNamedColorHex as nn, styleHandlers as nt, getGlobalFontFaces as o, strToRgb as on, flushStyles as ot, hasGlobalKeyframes as p, makeCounterStyleName as pt, formatCounterStyleRule as q, okhstFunction as qt, getEffectiveProperties as r, getRgbValuesFromRgbaString as rn, createStyle as rt, getGlobalFunctions as s, normalizeDslName as sn, hasPendingStyleWrites as st, configure as t, overrideColorAlpha as tn, defineHandler as tt, getGlobalRecipes as u, DEFAULT_NAME_PREFIX as ut, isTestEnvironment as v, extractLocalProperties as vt, BLOCK_INNER_STYLES as w, CHUNK_NAMES as wt, generateTypographyTokens as x, parsePropertyToken as xt, markStylesGenerated as y, getEffectiveDefinition as yt, camelToKebab as z, filterMods as zt };
12608
+ export { getRegisteredPrecompiledStats as $, getGlobalParser as $t, FLOW_STYLES as A, getEffectiveDefinition as At, createStateParserContext as B, LAYOUT_CHUNK_STYLES as Bt, BASE_STYLES as C, makeClassName as Ct, COLOR_STYLES as D, validateNamePrefix as Dt, BLOCK_STYLES as E, tastyClassRegex as Et, hasPipelineCacheEntry as F, APPEARANCE_CHUNK_STYLES as Ft, applyRegisteredDependenciesToInjector as G, hasLocalFunctions as Gt, extractPredefinedStateRefs as H, STYLE_TO_CHUNK as Ht, isSelector as I, CHUNK_NAMES as It, endPrecompileBuild as J, registerLocalFunctionPolyfills as Jt, applyRegisteredDependenciesToRSC as K, parseFunctionName as Kt, renderStyles as L, DIMENSION_CHUNK_STYLES as Lt, OUTER_STYLES as M, normalizePropertyDefinition as Mt, POSITION_STYLES as N, parsePropertyToken as Nt, CONTAINER_STYLES as O, hashString as Ot, TEXT_STYLES as P, propHandlerRegistry as Pt, getRegisteredPrecompiledDependencies as Q, getGlobalParseFunctions as Qt, parseStateKey as R, DISPLAY_CHUNK_STYLES as Rt, baseStylePropsRegistry as S, DEFAULT_ZERO_NAME_PREFIX as St, BLOCK_OUTER_STYLES as T, makeKeyframeName as Tt, getGlobalPredefinedStates as U, extractLocalFunctions as Ut, extractLocalPredefinedStates as V, POSITION_CHUNK_STYLES as Vt, setGlobalPredefinedStates as W, formatFunctionRule as Wt, getPrecompileStore as X, DIRECTIONS as Xt, findPrecompiledChunk as Y, CUSTOM_UNITS as Yt, getPrecompiledRevision as Z, filterMods as Zt, isFunctionsPolyfillEnabled as _, hslToRgbValues as _n, flushStyles as _t, getGlobalCounterStyles as a, okhstFunction as an, hasLocalCounterStyle as at, resetConfig as b, resetStyleBatch as bt, getGlobalInjector as c, okhslPlugin as cn, formatFontFaceRule as ct, getGlobalStyles as d, StyleParser as dn, STYLE_HANDLER_MAP as dt, getGlobalPredefinedTokens as en, precompileRuntimeState as et, getNamePrefix as f, Lru as fn, defineHandler as ft, isConfigLocked as g, hexToRgb as gn, closeBatchWindow as gt, hasStylesGenerated as h, getRgbValuesFromRgbaString as hn, PropertyTypeResolver as ht, getGlobalConfigTokens as i, stringifyStyles as in, formatCounterStyleRule as it, INNER_STYLES as j, hasLocalProperties as jt, DIMENSION_STYLES as k, extractLocalProperties as kt, getGlobalKeyframes as l, createColorFunc as ln, hasLocalFontFace as lt, hasGlobalRecipes as m, getNamedColorHex as mn, createStyle as mt, getConfig as n, parseColor as nn, StyleInjector as nt, getGlobalFontFaces as o, okhstPlugin as on, extractLocalFontFace as ot, hasGlobalKeyframes as p, overrideColorAlpha as pn, styleHandlers as pt, beginPrecompileBuild as q, registerFunctionPolyfill as qt, getEffectiveProperties as r, parseStyle as rn, extractLocalCounterStyle as rt, getGlobalFunctions as s, okhslFunction as sn, fontFaceContentHash as st, configure as t, normalizeColorTokenValue as tn, warnPrecompileOnce as tt, getGlobalRecipes as u, isDevEnv as un, SheetManager as ut, isTestEnvironment as v, strToRgb as vn, hasPendingStyleWrites as vt, BLOCK_INNER_STYLES as w, makeCounterStyleName as wt, generateTypographyTokens as x, DEFAULT_NAME_PREFIX as xt, markStylesGenerated as y, normalizeDslName as yn, openBatchWindow as yt, camelToKebab as z, FONT_CHUNK_STYLES as zt };
12372
12609
 
12373
- //# sourceMappingURL=config-DsqqkmUs.js.map
12610
+ //# sourceMappingURL=config-0BOip6sG.js.map