@tenphi/tasty 1.1.0 → 1.3.0

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 (257) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +1 -2
  2. package/dist/chunks/cacheKey.d.ts +1 -0
  3. package/dist/chunks/cacheKey.js +1 -2
  4. package/dist/chunks/cacheKey.js.map +1 -1
  5. package/dist/chunks/definitions.js +1 -2
  6. package/dist/chunks/definitions.js.map +1 -1
  7. package/dist/chunks/index.d.ts +1 -0
  8. package/dist/chunks/renderChunk.d.ts +1 -0
  9. package/dist/chunks/renderChunk.js +1 -2
  10. package/dist/chunks/renderChunk.js.map +1 -1
  11. package/dist/compute-styles.d.ts +31 -0
  12. package/dist/compute-styles.js +356 -0
  13. package/dist/compute-styles.js.map +1 -0
  14. package/dist/config.d.ts +7 -1
  15. package/dist/config.js +25 -22
  16. package/dist/config.js.map +1 -1
  17. package/dist/core/index.d.ts +4 -4
  18. package/dist/core/index.js +6 -6
  19. package/dist/counter-style/index.js +1 -1
  20. package/dist/counter-style/index.js.map +1 -1
  21. package/dist/debug.js +1 -2
  22. package/dist/debug.js.map +1 -1
  23. package/dist/font-face/index.js +1 -1
  24. package/dist/font-face/index.js.map +1 -1
  25. package/dist/hooks/index.d.ts +7 -0
  26. package/dist/hooks/resolve-ssr-collector.js +1 -2
  27. package/dist/hooks/resolve-ssr-collector.js.map +1 -1
  28. package/dist/hooks/useCounterStyle.js +2 -3
  29. package/dist/hooks/useCounterStyle.js.map +1 -1
  30. package/dist/hooks/useFontFace.js +2 -3
  31. package/dist/hooks/useFontFace.js.map +1 -1
  32. package/dist/hooks/useGlobalStyles.js +4 -5
  33. package/dist/hooks/useGlobalStyles.js.map +1 -1
  34. package/dist/hooks/useKeyframes.js +3 -4
  35. package/dist/hooks/useKeyframes.js.map +1 -1
  36. package/dist/hooks/useProperty.js +2 -3
  37. package/dist/hooks/useProperty.js.map +1 -1
  38. package/dist/hooks/useRawCSS.js +2 -3
  39. package/dist/hooks/useRawCSS.js.map +1 -1
  40. package/dist/hooks/useStyles.d.ts +3 -8
  41. package/dist/hooks/useStyles.js +7 -214
  42. package/dist/hooks/useStyles.js.map +1 -1
  43. package/dist/index.d.ts +5 -5
  44. package/dist/index.js +7 -7
  45. package/dist/injector/index.d.ts +1 -18
  46. package/dist/injector/index.js +5 -19
  47. package/dist/injector/index.js.map +1 -1
  48. package/dist/injector/injector.js +1 -2
  49. package/dist/injector/injector.js.map +1 -1
  50. package/dist/injector/sheet-manager.js +1 -2
  51. package/dist/injector/sheet-manager.js.map +1 -1
  52. package/dist/keyframes/index.js +1 -1
  53. package/dist/parser/classify.js +1 -2
  54. package/dist/parser/classify.js.map +1 -1
  55. package/dist/parser/const.js +14 -3
  56. package/dist/parser/const.js.map +1 -1
  57. package/dist/parser/lru.js +1 -1
  58. package/dist/parser/lru.js.map +1 -1
  59. package/dist/parser/parser.js +1 -2
  60. package/dist/parser/parser.js.map +1 -1
  61. package/dist/parser/tokenizer.js +1 -1
  62. package/dist/parser/tokenizer.js.map +1 -1
  63. package/dist/parser/types.js +1 -1
  64. package/dist/parser/types.js.map +1 -1
  65. package/dist/pipeline/conditions.js +1 -1
  66. package/dist/pipeline/conditions.js.map +1 -1
  67. package/dist/pipeline/exclusive.js +1 -2
  68. package/dist/pipeline/exclusive.js.map +1 -1
  69. package/dist/pipeline/index.js +2 -3
  70. package/dist/pipeline/index.js.map +1 -1
  71. package/dist/pipeline/materialize.js +1 -2
  72. package/dist/pipeline/materialize.js.map +1 -1
  73. package/dist/pipeline/parseStateKey.js +1 -2
  74. package/dist/pipeline/parseStateKey.js.map +1 -1
  75. package/dist/pipeline/simplify.js +1 -2
  76. package/dist/pipeline/simplify.js.map +1 -1
  77. package/dist/pipeline/warnings.js +1 -1
  78. package/dist/plugins/index.d.ts +2 -0
  79. package/dist/plugins/okhsl-plugin.js +1 -2
  80. package/dist/plugins/okhsl-plugin.js.map +1 -1
  81. package/dist/properties/index.js +2 -3
  82. package/dist/properties/index.js.map +1 -1
  83. package/dist/properties/property-type-resolver.js +1 -2
  84. package/dist/properties/property-type-resolver.js.map +1 -1
  85. package/dist/ssr/astro.js +1 -2
  86. package/dist/ssr/astro.js.map +1 -1
  87. package/dist/ssr/async-storage.js +1 -2
  88. package/dist/ssr/async-storage.js.map +1 -1
  89. package/dist/ssr/collect-auto-properties.js +1 -2
  90. package/dist/ssr/collect-auto-properties.js.map +1 -1
  91. package/dist/ssr/collector.js +4 -12
  92. package/dist/ssr/collector.js.map +1 -1
  93. package/dist/ssr/context.d.ts +2 -2
  94. package/dist/ssr/context.js +1 -2
  95. package/dist/ssr/context.js.map +1 -1
  96. package/dist/ssr/format-global-rules.js +1 -1
  97. package/dist/ssr/format-keyframes.js +1 -2
  98. package/dist/ssr/format-keyframes.js.map +1 -1
  99. package/dist/ssr/format-property.js +1 -2
  100. package/dist/ssr/format-property.js.map +1 -1
  101. package/dist/ssr/format-rules.js +1 -1
  102. package/dist/ssr/hydrate.js +1 -2
  103. package/dist/ssr/hydrate.js.map +1 -1
  104. package/dist/ssr/index.js +1 -2
  105. package/dist/ssr/index.js.map +1 -1
  106. package/dist/ssr/next.d.ts +2 -2
  107. package/dist/ssr/next.js +9 -5
  108. package/dist/ssr/next.js.map +1 -1
  109. package/dist/ssr/ssr-collector-ref.js +1 -1
  110. package/dist/states/index.js +1 -2
  111. package/dist/states/index.js.map +1 -1
  112. package/dist/static/index.js +1 -2
  113. package/dist/static/inject.d.ts +5 -0
  114. package/dist/static/inject.js +17 -0
  115. package/dist/static/inject.js.map +1 -0
  116. package/dist/static/tastyStatic.js +1 -2
  117. package/dist/static/tastyStatic.js.map +1 -1
  118. package/dist/static/types.js +1 -1
  119. package/dist/styles/border.d.ts +1 -1
  120. package/dist/styles/border.js +28 -22
  121. package/dist/styles/border.js.map +1 -1
  122. package/dist/styles/color.d.ts +1 -1
  123. package/dist/styles/color.js +2 -3
  124. package/dist/styles/color.js.map +1 -1
  125. package/dist/styles/const.js +17 -0
  126. package/dist/styles/const.js.map +1 -0
  127. package/dist/styles/createStyle.js +4 -5
  128. package/dist/styles/createStyle.js.map +1 -1
  129. package/dist/styles/dimension.js +15 -3
  130. package/dist/styles/dimension.js.map +1 -1
  131. package/dist/styles/directional.js +133 -0
  132. package/dist/styles/directional.js.map +1 -0
  133. package/dist/styles/display.d.ts +3 -10
  134. package/dist/styles/display.js +45 -39
  135. package/dist/styles/display.js.map +1 -1
  136. package/dist/styles/fade.d.ts +1 -1
  137. package/dist/styles/fade.js +9 -5
  138. package/dist/styles/fade.js.map +1 -1
  139. package/dist/styles/fill.d.ts +2 -2
  140. package/dist/styles/fill.js +3 -4
  141. package/dist/styles/fill.js.map +1 -1
  142. package/dist/styles/flow.js +1 -1
  143. package/dist/styles/gap.d.ts +1 -1
  144. package/dist/styles/gap.js +4 -3
  145. package/dist/styles/gap.js.map +1 -1
  146. package/dist/styles/height.d.ts +1 -1
  147. package/dist/styles/height.js +1 -2
  148. package/dist/styles/height.js.map +1 -1
  149. package/dist/styles/index.d.ts +0 -1
  150. package/dist/styles/index.js +3 -4
  151. package/dist/styles/index.js.map +1 -1
  152. package/dist/styles/inset.d.ts +1 -29
  153. package/dist/styles/inset.js +19 -135
  154. package/dist/styles/inset.js.map +1 -1
  155. package/dist/styles/list.d.ts +5 -5
  156. package/dist/styles/list.js +4 -2
  157. package/dist/styles/list.js.map +1 -1
  158. package/dist/styles/margin.d.ts +1 -1
  159. package/dist/styles/margin.js +17 -89
  160. package/dist/styles/margin.js.map +1 -1
  161. package/dist/styles/outline.d.ts +1 -1
  162. package/dist/styles/outline.js +6 -16
  163. package/dist/styles/outline.js.map +1 -1
  164. package/dist/styles/padding.d.ts +1 -1
  165. package/dist/styles/padding.js +17 -89
  166. package/dist/styles/padding.js.map +1 -1
  167. package/dist/styles/placement.d.ts +37 -0
  168. package/dist/styles/placement.js +74 -0
  169. package/dist/styles/placement.js.map +1 -0
  170. package/dist/styles/predefined.d.ts +4 -4
  171. package/dist/styles/predefined.js +8 -9
  172. package/dist/styles/predefined.js.map +1 -1
  173. package/dist/styles/preset.d.ts +1 -1
  174. package/dist/styles/preset.js +7 -7
  175. package/dist/styles/preset.js.map +1 -1
  176. package/dist/styles/radius.d.ts +1 -3
  177. package/dist/styles/radius.js +38 -6
  178. package/dist/styles/radius.js.map +1 -1
  179. package/dist/styles/scrollMargin.d.ts +24 -0
  180. package/dist/styles/scrollMargin.js +32 -0
  181. package/dist/styles/scrollMargin.js.map +1 -0
  182. package/dist/styles/scrollbar.d.ts +1 -1
  183. package/dist/styles/scrollbar.js +8 -5
  184. package/dist/styles/scrollbar.js.map +1 -1
  185. package/dist/styles/shadow.d.ts +1 -1
  186. package/dist/styles/shadow.js +4 -3
  187. package/dist/styles/shadow.js.map +1 -1
  188. package/dist/styles/shared.js +17 -0
  189. package/dist/styles/shared.js.map +1 -0
  190. package/dist/styles/transition.d.ts +1 -1
  191. package/dist/styles/transition.js +5 -4
  192. package/dist/styles/transition.js.map +1 -1
  193. package/dist/styles/types.d.ts +24 -7
  194. package/dist/styles/width.d.ts +1 -1
  195. package/dist/styles/width.js +1 -2
  196. package/dist/styles/width.js.map +1 -1
  197. package/dist/tasty.d.ts +29 -14
  198. package/dist/tasty.js +70 -62
  199. package/dist/tasty.js.map +1 -1
  200. package/dist/utils/cache-wrapper.js +1 -2
  201. package/dist/utils/cache-wrapper.js.map +1 -1
  202. package/dist/utils/case-converter.js +1 -1
  203. package/dist/utils/color-math.js +1 -1
  204. package/dist/utils/color-math.js.map +1 -1
  205. package/dist/utils/color-space.js +1 -2
  206. package/dist/utils/color-space.js.map +1 -1
  207. package/dist/utils/colors.js +1 -2
  208. package/dist/utils/colors.js.map +1 -1
  209. package/dist/utils/dotize.js +1 -1
  210. package/dist/utils/dotize.js.map +1 -1
  211. package/dist/utils/filter-base-props.js +1 -1
  212. package/dist/utils/get-display-name.js +1 -1
  213. package/dist/utils/has-keys.js +1 -1
  214. package/dist/utils/is-dev-env.js +1 -1
  215. package/dist/utils/is-dev-env.js.map +1 -1
  216. package/dist/utils/is-valid-element-type.js +1 -1
  217. package/dist/utils/merge-styles.js +1 -2
  218. package/dist/utils/merge-styles.js.map +1 -1
  219. package/dist/utils/mod-attrs.d.ts +0 -2
  220. package/dist/utils/mod-attrs.js +1 -2
  221. package/dist/utils/mod-attrs.js.map +1 -1
  222. package/dist/utils/process-tokens.d.ts +1 -5
  223. package/dist/utils/process-tokens.js +3 -11
  224. package/dist/utils/process-tokens.js.map +1 -1
  225. package/dist/utils/resolve-recipes.js +1 -2
  226. package/dist/utils/resolve-recipes.js.map +1 -1
  227. package/dist/utils/selector-transform.js +1 -1
  228. package/dist/utils/string.js +1 -1
  229. package/dist/utils/styles.d.ts +1 -1
  230. package/dist/utils/styles.js +2 -3
  231. package/dist/utils/styles.js.map +1 -1
  232. package/dist/utils/typography.js +1 -1
  233. package/dist/utils/typography.js.map +1 -1
  234. package/dist/utils/warnings.js +1 -1
  235. package/dist/zero/babel.d.ts +17 -2
  236. package/dist/zero/babel.js +105 -41
  237. package/dist/zero/babel.js.map +1 -1
  238. package/dist/zero/css-writer.js +1 -2
  239. package/dist/zero/css-writer.js.map +1 -1
  240. package/dist/zero/extractor.js +1 -2
  241. package/dist/zero/extractor.js.map +1 -1
  242. package/dist/zero/index.js +1 -2
  243. package/dist/zero/next.d.ts +12 -0
  244. package/dist/zero/next.js +5 -4
  245. package/dist/zero/next.js.map +1 -1
  246. package/docs/methodology.md +50 -1
  247. package/docs/runtime.md +90 -3
  248. package/docs/ssr.md +10 -10
  249. package/docs/styles.md +17 -0
  250. package/docs/tasty-static.md +87 -0
  251. package/package.json +12 -7
  252. package/dist/styles/align.d.ts +0 -15
  253. package/dist/styles/align.js +0 -14
  254. package/dist/styles/align.js.map +0 -1
  255. package/dist/styles/justify.d.ts +0 -15
  256. package/dist/styles/justify.js +0 -14
  257. package/dist/styles/justify.js.map +0 -1
@@ -3,6 +3,5 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
3
3
  if (typeof require !== "undefined") return require.apply(this, arguments);
4
4
  throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
5
  });
6
-
7
6
  //#endregion
8
- export { __require };
7
+ export { __require };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,4 @@
1
1
  import { extractLocalPredefinedStates, extractPredefinedStateRefs } from "../states/index.js";
2
-
3
2
  //#region src/chunks/cacheKey.ts
4
3
  /**
5
4
  * Chunk-specific cache key generation.
@@ -72,7 +71,7 @@ function generateChunkCacheKey(styles, chunkName, styleKeys) {
72
71
  }
73
72
  return parts.join("\0");
74
73
  }
75
-
76
74
  //#endregion
77
75
  export { generateChunkCacheKey };
76
+
78
77
  //# sourceMappingURL=cacheKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cacheKey.js","names":[],"sources":["../../src/chunks/cacheKey.ts"],"sourcesContent":["/**\n * Chunk-specific cache key generation.\n *\n * Generates cache keys that only include styles relevant to a specific chunk,\n * enabling more granular caching and reuse.\n *\n * Enhanced to support predefined states:\n * - Global predefined states don't affect cache keys (constant across app)\n * - Local predefined states only affect cache keys if referenced in the chunk\n */\n\nimport {\n extractLocalPredefinedStates,\n extractPredefinedStateRefs,\n} from '../states';\nimport type { Styles } from '../styles/types';\n\nconst _stableStringifyCache = new WeakMap<object, string>();\n\n/**\n * Recursively serialize a value with sorted keys for stable output.\n * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.\n * Uses a WeakMap cache for object values to avoid re-serializing the same references.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return 'undefined';\n }\n if (typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n const cached = _stableStringifyCache.get(value as object);\n if (cached !== undefined) return cached;\n\n let result: string;\n if (Array.isArray(value)) {\n result = '[' + value.map(stableStringify).join(',') + ']';\n } else {\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort();\n const parts: string[] = [];\n for (const key of sortedKeys) {\n if (obj[key] !== undefined) {\n parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);\n }\n }\n result = '{' + parts.join(',') + '}';\n }\n\n _stableStringifyCache.set(value as object, result);\n return result;\n}\n\n/**\n * Generate a cache key for a specific chunk.\n *\n * Only includes the styles that belong to this chunk, allowing\n * chunks to be cached independently.\n *\n * Also includes relevant local predefined states that are referenced\n * by this chunk's styles.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns A stable cache key string\n */\nexport function generateChunkCacheKey(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): string {\n // Start with chunk name for namespace separation\n const parts: string[] = [chunkName];\n\n // styleKeys are already sorted by categorizeStyleKeys\n let chunkStylesStr = '';\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n // Use stable stringify for consistent serialization regardless of key order\n const serialized = stableStringify(value);\n parts.push(`${key}:${serialized}`);\n chunkStylesStr += serialized;\n }\n }\n\n // Extract local predefined states from the full styles object\n const localStates = extractLocalPredefinedStates(styles);\n\n // Only include local predefined states that are actually referenced in this chunk\n if (Object.keys(localStates).length > 0) {\n const referencedStates = extractPredefinedStateRefs(chunkStylesStr);\n const relevantLocalStates: string[] = [];\n\n for (const stateName of referencedStates) {\n if (localStates[stateName]) {\n relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);\n }\n }\n\n // Add relevant local states to the cache key (sorted for stability)\n if (relevantLocalStates.length > 0) {\n relevantLocalStates.sort();\n parts.unshift(`[states:${relevantLocalStates.join('|')}]`);\n }\n }\n\n // Use null character as separator (safe, not in JSON output)\n return parts.join('\\0');\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,wCAAwB,IAAI,SAAyB;;;;;;AAO3D,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,UAAU,KACZ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AAM,KAAK,KAAK"}
1
+ {"version":3,"file":"cacheKey.js","names":[],"sources":["../../src/chunks/cacheKey.ts"],"sourcesContent":["/**\n * Chunk-specific cache key generation.\n *\n * Generates cache keys that only include styles relevant to a specific chunk,\n * enabling more granular caching and reuse.\n *\n * Enhanced to support predefined states:\n * - Global predefined states don't affect cache keys (constant across app)\n * - Local predefined states only affect cache keys if referenced in the chunk\n */\n\nimport {\n extractLocalPredefinedStates,\n extractPredefinedStateRefs,\n} from '../states';\nimport type { Styles } from '../styles/types';\n\nconst _stableStringifyCache = new WeakMap<object, string>();\n\n/**\n * Recursively serialize a value with sorted keys for stable output.\n * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.\n * Uses a WeakMap cache for object values to avoid re-serializing the same references.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return 'undefined';\n }\n if (typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n const cached = _stableStringifyCache.get(value as object);\n if (cached !== undefined) return cached;\n\n let result: string;\n if (Array.isArray(value)) {\n result = '[' + value.map(stableStringify).join(',') + ']';\n } else {\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort();\n const parts: string[] = [];\n for (const key of sortedKeys) {\n if (obj[key] !== undefined) {\n parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);\n }\n }\n result = '{' + parts.join(',') + '}';\n }\n\n _stableStringifyCache.set(value as object, result);\n return result;\n}\n\n/**\n * Generate a cache key for a specific chunk.\n *\n * Only includes the styles that belong to this chunk, allowing\n * chunks to be cached independently.\n *\n * Also includes relevant local predefined states that are referenced\n * by this chunk's styles.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns A stable cache key string\n */\nexport function generateChunkCacheKey(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): string {\n // Start with chunk name for namespace separation\n const parts: string[] = [chunkName];\n\n // styleKeys are already sorted by categorizeStyleKeys\n let chunkStylesStr = '';\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n // Use stable stringify for consistent serialization regardless of key order\n const serialized = stableStringify(value);\n parts.push(`${key}:${serialized}`);\n chunkStylesStr += serialized;\n }\n }\n\n // Extract local predefined states from the full styles object\n const localStates = extractLocalPredefinedStates(styles);\n\n // Only include local predefined states that are actually referenced in this chunk\n if (Object.keys(localStates).length > 0) {\n const referencedStates = extractPredefinedStateRefs(chunkStylesStr);\n const relevantLocalStates: string[] = [];\n\n for (const stateName of referencedStates) {\n if (localStates[stateName]) {\n relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);\n }\n }\n\n // Add relevant local states to the cache key (sorted for stability)\n if (relevantLocalStates.length > 0) {\n relevantLocalStates.sort();\n parts.unshift(`[states:${relevantLocalStates.join('|')}]`);\n }\n }\n\n // Use null character as separator (safe, not in JSON output)\n return parts.join('\\0');\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wCAAwB,IAAI,SAAyB;;;;;;AAO3D,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,UAAU,KACZ,QAAO;AAET,KAAI,UAAU,KAAA,EACZ,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,UAAU,MAAM;CAG9B,MAAM,SAAS,sBAAsB,IAAI,MAAgB;AACzD,KAAI,WAAW,KAAA,EAAW,QAAO;CAEjC,IAAI;AACJ,KAAI,MAAM,QAAQ,MAAM,CACtB,UAAS,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,IAAI,GAAG;MACjD;EACL,MAAM,MAAM;EACZ,MAAM,aAAa,OAAO,KAAK,IAAI,CAAC,MAAM;EAC1C,MAAM,QAAkB,EAAE;AAC1B,OAAK,MAAM,OAAO,WAChB,KAAI,IAAI,SAAS,KAAA,EACf,OAAM,KAAK,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG,gBAAgB,IAAI,KAAK,GAAG;AAGrE,WAAS,MAAM,MAAM,KAAK,IAAI,GAAG;;AAGnC,uBAAsB,IAAI,OAAiB,OAAO;AAClD,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,sBACd,QACA,WACA,WACQ;CAER,MAAM,QAAkB,CAAC,UAAU;CAGnC,IAAI,iBAAiB;AAErB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,KAAA,GAAW;GAEvB,MAAM,aAAa,gBAAgB,MAAM;AACzC,SAAM,KAAK,GAAG,IAAI,GAAG,aAAa;AAClC,qBAAkB;;;CAKtB,MAAM,cAAc,6BAA6B,OAAO;AAGxD,KAAI,OAAO,KAAK,YAAY,CAAC,SAAS,GAAG;EACvC,MAAM,mBAAmB,2BAA2B,eAAe;EACnE,MAAM,sBAAgC,EAAE;AAExC,OAAK,MAAM,aAAa,iBACtB,KAAI,YAAY,WACd,qBAAoB,KAAK,GAAG,UAAU,GAAG,YAAY,aAAa;AAKtE,MAAI,oBAAoB,SAAS,GAAG;AAClC,uBAAoB,MAAM;AAC1B,SAAM,QAAQ,WAAW,oBAAoB,KAAK,IAAI,CAAC,GAAG;;;AAK9D,QAAO,MAAM,KAAK,KAAK"}
@@ -1,5 +1,4 @@
1
1
  import { isSelector } from "../pipeline/index.js";
2
-
3
2
  //#region src/chunks/definitions.ts
4
3
  /**
5
4
  * Style chunk definitions for CSS chunking optimization.
@@ -253,7 +252,7 @@ function categorizeStyleKeys(styles) {
253
252
  for (const chunkName of Object.keys(chunkData)) if (!orderedChunks.has(chunkName)) orderedChunks.set(chunkName, chunkData[chunkName].sort());
254
253
  return orderedChunks;
255
254
  }
256
-
257
255
  //#endregion
258
256
  export { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys };
257
+
259
258
  //# sourceMappingURL=definitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","names":[],"sources":["../../src/chunks/definitions.ts"],"sourcesContent":["/**\n * Style chunk definitions for CSS chunking optimization.\n *\n * Styles are grouped into chunks based on:\n * 1. Handler dependencies - styles that share a handler MUST be in the same chunk\n * 2. Logical grouping - related styles grouped for better cache reuse\n *\n * See STYLE_CHUNKING_SPEC.md for detailed rationale.\n *\n * ============================================================================\n * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES\n * ============================================================================\n *\n * Style handlers declare their dependencies via `__lookupStyles` array.\n * This creates a dependency graph where handlers read multiple style props.\n *\n * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**\n *\n * Why this matters:\n * 1. Each chunk computes a cache key from ONLY its own style values\n * 2. If a handler reads a style from another chunk, that value isn't in the cache key\n * 3. Changing the cross-chunk style won't invalidate this chunk's cache\n * 4. Result: stale CSS output or incorrect cache hits\n *\n * Example of a violation:\n * ```\n * // flowStyle.__lookupStyles = ['display', 'flow']\n * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:\n * // - User sets { display: 'grid', flow: 'column' }\n * // - LAYOUT chunk caches CSS with flow=column, display=grid\n * // - User changes to { display: 'flex', flow: 'column' }\n * // - LAYOUT chunk cache key unchanged (only has 'flow')\n * // - Returns stale CSS computed with display=grid!\n * ```\n *\n * Before adding/moving styles, verify:\n * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)\n * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n/**\n * Appearance chunk - visual styling with independent handlers\n */\nexport const APPEARANCE_CHUNK_STYLES = [\n 'fill', // fillStyle (independent)\n 'color', // colorStyle (independent)\n 'opacity', // independent\n 'border', // borderStyle (independent)\n 'radius', // radiusStyle (independent)\n 'outline', // outlineStyle: outline ↔ outlineOffset\n 'outlineOffset', // outlineStyle: outline ↔ outlineOffset\n 'shadow', // shadowStyle (independent)\n 'fade', // fadeStyle (independent)\n] as const;\n\n/**\n * Font chunk - typography styles\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,\n * fontWeight, fontStyle, font\n */\nexport const FONT_CHUNK_STYLES = [\n // All from presetStyle handler - MUST stay together\n 'preset',\n 'font',\n 'fontWeight',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textTransform',\n // Independent text styles grouped for cohesion\n 'fontFamily', // independent alias (logical grouping with font styles)\n 'textAlign',\n 'textDecoration',\n 'wordBreak',\n 'wordWrap',\n 'boldFontWeight',\n] as const;\n\n/**\n * Dimension chunk - sizing and spacing\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline\n * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline\n * ⚠️ widthStyle: width, minWidth, maxWidth\n * ⚠️ heightStyle: height, minHeight, maxHeight\n */\nexport const DIMENSION_CHUNK_STYLES = [\n // All from paddingStyle handler - MUST stay together\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n // All from marginStyle handler - MUST stay together\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n // widthStyle handler - MUST stay together\n 'width',\n 'minWidth',\n 'maxWidth',\n // heightStyle handler - MUST stay together\n 'height',\n 'minHeight',\n 'maxHeight',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n] as const;\n\n/**\n * Display chunk - display mode, layout flow, text overflow, and scrollbar\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace\n * ⚠️ flowStyle: display, flow\n * ⚠️ gapStyle: display, flow, gap\n * ⚠️ scrollbarStyle: scrollbar, overflow\n */\nexport const DISPLAY_CHUNK_STYLES = [\n // displayStyle handler\n 'display',\n 'hide',\n 'textOverflow',\n 'overflow', // also used by scrollbarStyle\n 'whiteSpace',\n // flowStyle handler (requires display)\n 'flow',\n // gapStyle handler (requires display, flow)\n 'gap',\n // scrollbarStyle handler (requires overflow)\n 'scrollbar',\n] as const;\n\n/**\n * Layout chunk - flex/grid alignment and grid templates\n *\n * Note: flow and gap are in DISPLAY chunk due to handler dependencies\n * (flowStyle and gapStyle both require 'display' prop).\n */\nexport const LAYOUT_CHUNK_STYLES = [\n // Alignment styles (all independent handlers)\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align', // alignStyle (independent)\n 'justify', // justifyStyle (independent)\n 'place', // placeStyle (independent)\n 'columnGap',\n 'rowGap',\n // Grid template styles\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n] as const;\n\n/**\n * Position chunk - element positioning\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left\n */\nexport const POSITION_CHUNK_STYLES = [\n 'position',\n // All from insetStyle handler - MUST stay together\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'gridArea',\n 'gridColumn',\n 'gridRow',\n 'order',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'transform',\n 'transition',\n 'animation',\n] as const;\n\n// ============================================================================\n// Chunk Names\n// ============================================================================\n\nexport const CHUNK_NAMES = {\n /** Special chunk for styles that cannot be split */\n COMBINED: 'combined',\n SUBCOMPONENTS: 'subcomponents',\n APPEARANCE: 'appearance',\n FONT: 'font',\n DIMENSION: 'dimension',\n DISPLAY: 'display',\n LAYOUT: 'layout',\n POSITION: 'position',\n MISC: 'misc',\n} as const;\n\nexport type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];\n\n// ============================================================================\n// Style-to-Chunk Lookup Map (O(1) categorization)\n// ============================================================================\n\n/**\n * Pre-computed map for O(1) style-to-chunk lookup.\n * Built once at module load time.\n */\nexport const STYLE_TO_CHUNK = new Map<string, ChunkName>();\n\n// Populate the lookup map\nfunction populateStyleToChunkMap() {\n for (const style of APPEARANCE_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);\n }\n for (const style of FONT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);\n }\n for (const style of DIMENSION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);\n }\n for (const style of DISPLAY_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);\n }\n for (const style of LAYOUT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);\n }\n for (const style of POSITION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);\n }\n}\n\n// Initialize at module load\npopulateStyleToChunkMap();\n\n// ============================================================================\n// Chunk Priority Order\n// ============================================================================\n\n/**\n * Chunk processing order. This ensures deterministic className allocation\n * regardless of style key order in the input.\n */\nconst CHUNK_ORDER: readonly string[] = [\n CHUNK_NAMES.APPEARANCE,\n CHUNK_NAMES.FONT,\n CHUNK_NAMES.DIMENSION,\n CHUNK_NAMES.DISPLAY,\n CHUNK_NAMES.LAYOUT,\n CHUNK_NAMES.POSITION,\n CHUNK_NAMES.MISC,\n CHUNK_NAMES.SUBCOMPONENTS,\n] as const;\n\n/**\n * Map from chunk name to its priority index for sorting.\n */\nconst _CHUNK_PRIORITY = new Map<string, number>(\n CHUNK_ORDER.map((name, index) => [name, index]),\n);\n\n// ============================================================================\n// Chunk Info Interface\n// ============================================================================\n\nexport interface ChunkInfo {\n /** Name of the chunk */\n name: ChunkName | string;\n /** Style keys belonging to this chunk */\n styleKeys: string[];\n}\n\n// ============================================================================\n// Style Categorization\n// ============================================================================\n\n/**\n * Categorize style keys into chunks.\n *\n * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless\n * of the order of keys in the input styles object.\n *\n * @param styles - The styles object to categorize\n * @returns Map of chunk name to array of style keys in that chunk (in priority order)\n */\nexport function categorizeStyleKeys(\n styles: Record<string, unknown>,\n): Map<string, string[]> {\n // First pass: collect keys into chunks (unordered)\n const chunkData: Record<string, string[]> = {};\n const keys = Object.keys(styles);\n\n for (const key of keys) {\n // Skip the $ helper key (used for selector combinators)\n // Skip @keyframes and @properties (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@properties' ||\n key === '@fontFace' ||\n key === '@counterStyle' ||\n key === 'recipe'\n ) {\n continue;\n }\n\n if (isSelector(key)) {\n // All selectors go into the subcomponents chunk\n if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) {\n chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];\n }\n chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);\n } else {\n // Look up the chunk for this style, default to misc\n const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;\n if (!chunkData[chunkName]) {\n chunkData[chunkName] = [];\n }\n chunkData[chunkName].push(key);\n }\n }\n\n // Second pass: build ordered Map based on CHUNK_ORDER\n const orderedChunks = new Map<string, string[]>();\n\n // Add chunks in priority order\n for (const chunkName of CHUNK_ORDER) {\n if (chunkData[chunkName] && chunkData[chunkName].length > 0) {\n // Sort keys within chunk for consistent cache key generation\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n // Handle any unknown chunks (shouldn't happen, but be defensive)\n for (const chunkName of Object.keys(chunkData)) {\n if (!orderedChunks.has(chunkName)) {\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n return orderedChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;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gBAAe,IAAI,OAAO,YAAY,SAAS;;AAKnD,yBAAyB;;;;;AAUzB,MAAM,cAAiC;CACrC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACb;AAKuB,IAAI,IAC1B,YAAY,KAAK,MAAM,UAAU,CAAC,MAAM,MAAM,CAAC,CAChD;;;;;;;;;;AA0BD,SAAgB,oBACd,QACuB;CAEvB,MAAM,YAAsC,EAAE;CAC9C,MAAM,OAAO,OAAO,KAAK,OAAO;AAEhC,MAAK,MAAM,OAAO,MAAM;AAItB,MACE,QAAQ,OACR,QAAQ,gBACR,QAAQ,iBACR,QAAQ,eACR,QAAQ,mBACR,QAAQ,SAER;AAGF,MAAI,WAAW,IAAI,EAAE;AAEnB,OAAI,CAAC,UAAU,YAAY,eACzB,WAAU,YAAY,iBAAiB,EAAE;AAE3C,aAAU,YAAY,eAAe,KAAK,IAAI;SACzC;GAEL,MAAM,YAAY,eAAe,IAAI,IAAI,IAAI,YAAY;AACzD,OAAI,CAAC,UAAU,WACb,WAAU,aAAa,EAAE;AAE3B,aAAU,WAAW,KAAK,IAAI;;;CAKlC,MAAM,gCAAgB,IAAI,KAAuB;AAGjD,MAAK,MAAM,aAAa,YACtB,KAAI,UAAU,cAAc,UAAU,WAAW,SAAS,EAExD,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAK7D,MAAK,MAAM,aAAa,OAAO,KAAK,UAAU,CAC5C,KAAI,CAAC,cAAc,IAAI,UAAU,CAC/B,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAI7D,QAAO"}
1
+ {"version":3,"file":"definitions.js","names":[],"sources":["../../src/chunks/definitions.ts"],"sourcesContent":["/**\n * Style chunk definitions for CSS chunking optimization.\n *\n * Styles are grouped into chunks based on:\n * 1. Handler dependencies - styles that share a handler MUST be in the same chunk\n * 2. Logical grouping - related styles grouped for better cache reuse\n *\n * See STYLE_CHUNKING_SPEC.md for detailed rationale.\n *\n * ============================================================================\n * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES\n * ============================================================================\n *\n * Style handlers declare their dependencies via `__lookupStyles` array.\n * This creates a dependency graph where handlers read multiple style props.\n *\n * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**\n *\n * Why this matters:\n * 1. Each chunk computes a cache key from ONLY its own style values\n * 2. If a handler reads a style from another chunk, that value isn't in the cache key\n * 3. Changing the cross-chunk style won't invalidate this chunk's cache\n * 4. Result: stale CSS output or incorrect cache hits\n *\n * Example of a violation:\n * ```\n * // flowStyle.__lookupStyles = ['display', 'flow']\n * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:\n * // - User sets { display: 'grid', flow: 'column' }\n * // - LAYOUT chunk caches CSS with flow=column, display=grid\n * // - User changes to { display: 'flex', flow: 'column' }\n * // - LAYOUT chunk cache key unchanged (only has 'flow')\n * // - Returns stale CSS computed with display=grid!\n * ```\n *\n * Before adding/moving styles, verify:\n * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)\n * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n/**\n * Appearance chunk - visual styling with independent handlers\n */\nexport const APPEARANCE_CHUNK_STYLES = [\n 'fill', // fillStyle (independent)\n 'color', // colorStyle (independent)\n 'opacity', // independent\n 'border', // borderStyle (independent)\n 'radius', // radiusStyle (independent)\n 'outline', // outlineStyle: outline ↔ outlineOffset\n 'outlineOffset', // outlineStyle: outline ↔ outlineOffset\n 'shadow', // shadowStyle (independent)\n 'fade', // fadeStyle (independent)\n] as const;\n\n/**\n * Font chunk - typography styles\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,\n * fontWeight, fontStyle, font\n */\nexport const FONT_CHUNK_STYLES = [\n // All from presetStyle handler - MUST stay together\n 'preset',\n 'font',\n 'fontWeight',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textTransform',\n // Independent text styles grouped for cohesion\n 'fontFamily', // independent alias (logical grouping with font styles)\n 'textAlign',\n 'textDecoration',\n 'wordBreak',\n 'wordWrap',\n 'boldFontWeight',\n] as const;\n\n/**\n * Dimension chunk - sizing and spacing\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline\n * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline\n * ⚠️ widthStyle: width, minWidth, maxWidth\n * ⚠️ heightStyle: height, minHeight, maxHeight\n */\nexport const DIMENSION_CHUNK_STYLES = [\n // All from paddingStyle handler - MUST stay together\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n // All from marginStyle handler - MUST stay together\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n // widthStyle handler - MUST stay together\n 'width',\n 'minWidth',\n 'maxWidth',\n // heightStyle handler - MUST stay together\n 'height',\n 'minHeight',\n 'maxHeight',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n] as const;\n\n/**\n * Display chunk - display mode, layout flow, text overflow, and scrollbar\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace\n * ⚠️ flowStyle: display, flow\n * ⚠️ gapStyle: display, flow, gap\n * ⚠️ scrollbarStyle: scrollbar, overflow\n */\nexport const DISPLAY_CHUNK_STYLES = [\n // displayStyle handler\n 'display',\n 'hide',\n 'textOverflow',\n 'overflow', // also used by scrollbarStyle\n 'whiteSpace',\n // flowStyle handler (requires display)\n 'flow',\n // gapStyle handler (requires display, flow)\n 'gap',\n // scrollbarStyle handler (requires overflow)\n 'scrollbar',\n] as const;\n\n/**\n * Layout chunk - flex/grid alignment and grid templates\n *\n * Note: flow and gap are in DISPLAY chunk due to handler dependencies\n * (flowStyle and gapStyle both require 'display' prop).\n */\nexport const LAYOUT_CHUNK_STYLES = [\n // Alignment styles (all independent handlers)\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align', // placementStyle\n 'justify', // placementStyle\n 'place', // placementStyle\n 'columnGap',\n 'rowGap',\n // Grid template styles\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n] as const;\n\n/**\n * Position chunk - element positioning\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left\n */\nexport const POSITION_CHUNK_STYLES = [\n 'position',\n // All from insetStyle handler - MUST stay together\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'gridArea',\n 'gridColumn',\n 'gridRow',\n 'order',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'transform',\n 'transition',\n 'animation',\n] as const;\n\n// ============================================================================\n// Chunk Names\n// ============================================================================\n\nexport const CHUNK_NAMES = {\n /** Special chunk for styles that cannot be split */\n COMBINED: 'combined',\n SUBCOMPONENTS: 'subcomponents',\n APPEARANCE: 'appearance',\n FONT: 'font',\n DIMENSION: 'dimension',\n DISPLAY: 'display',\n LAYOUT: 'layout',\n POSITION: 'position',\n MISC: 'misc',\n} as const;\n\nexport type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];\n\n// ============================================================================\n// Style-to-Chunk Lookup Map (O(1) categorization)\n// ============================================================================\n\n/**\n * Pre-computed map for O(1) style-to-chunk lookup.\n * Built once at module load time.\n */\nexport const STYLE_TO_CHUNK = new Map<string, ChunkName>();\n\n// Populate the lookup map\nfunction populateStyleToChunkMap() {\n for (const style of APPEARANCE_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);\n }\n for (const style of FONT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);\n }\n for (const style of DIMENSION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);\n }\n for (const style of DISPLAY_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);\n }\n for (const style of LAYOUT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);\n }\n for (const style of POSITION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);\n }\n}\n\n// Initialize at module load\npopulateStyleToChunkMap();\n\n// ============================================================================\n// Chunk Priority Order\n// ============================================================================\n\n/**\n * Chunk processing order. This ensures deterministic className allocation\n * regardless of style key order in the input.\n */\nconst CHUNK_ORDER: readonly string[] = [\n CHUNK_NAMES.APPEARANCE,\n CHUNK_NAMES.FONT,\n CHUNK_NAMES.DIMENSION,\n CHUNK_NAMES.DISPLAY,\n CHUNK_NAMES.LAYOUT,\n CHUNK_NAMES.POSITION,\n CHUNK_NAMES.MISC,\n CHUNK_NAMES.SUBCOMPONENTS,\n] as const;\n\n/**\n * Map from chunk name to its priority index for sorting.\n */\nconst _CHUNK_PRIORITY = new Map<string, number>(\n CHUNK_ORDER.map((name, index) => [name, index]),\n);\n\n// ============================================================================\n// Chunk Info Interface\n// ============================================================================\n\nexport interface ChunkInfo {\n /** Name of the chunk */\n name: ChunkName | string;\n /** Style keys belonging to this chunk */\n styleKeys: string[];\n}\n\n// ============================================================================\n// Style Categorization\n// ============================================================================\n\n/**\n * Categorize style keys into chunks.\n *\n * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless\n * of the order of keys in the input styles object.\n *\n * @param styles - The styles object to categorize\n * @returns Map of chunk name to array of style keys in that chunk (in priority order)\n */\nexport function categorizeStyleKeys(\n styles: Record<string, unknown>,\n): Map<string, string[]> {\n // First pass: collect keys into chunks (unordered)\n const chunkData: Record<string, string[]> = {};\n const keys = Object.keys(styles);\n\n for (const key of keys) {\n // Skip the $ helper key (used for selector combinators)\n // Skip @keyframes and @properties (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@properties' ||\n key === '@fontFace' ||\n key === '@counterStyle' ||\n key === 'recipe'\n ) {\n continue;\n }\n\n if (isSelector(key)) {\n // All selectors go into the subcomponents chunk\n if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) {\n chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];\n }\n chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);\n } else {\n // Look up the chunk for this style, default to misc\n const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;\n if (!chunkData[chunkName]) {\n chunkData[chunkName] = [];\n }\n chunkData[chunkName].push(key);\n }\n }\n\n // Second pass: build ordered Map based on CHUNK_ORDER\n const orderedChunks = new Map<string, string[]>();\n\n // Add chunks in priority order\n for (const chunkName of CHUNK_ORDER) {\n if (chunkData[chunkName] && chunkData[chunkName].length > 0) {\n // Sort keys within chunk for consistent cache key generation\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n // Handle any unknown chunks (shouldn't happen, but be defensive)\n for (const chunkName of Object.keys(chunkData)) {\n if (!orderedChunks.has(chunkName)) {\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n return orderedChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,0BAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,M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CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACb;AAKuB,IAAI,IAC1B,YAAY,KAAK,MAAM,UAAU,CAAC,MAAM,MAAM,CAAC,CAChD;;;;;;;;;;AA0BD,SAAgB,oBACd,QACuB;CAEvB,MAAM,YAAsC,EAAE;CAC9C,MAAM,OAAO,OAAO,KAAK,OAAO;AAEhC,MAAK,MAAM,OAAO,MAAM;AAItB,MACE,QAAQ,OACR,QAAQ,gBACR,QAAQ,iBACR,QAAQ,eACR,QAAQ,mBACR,QAAQ,SAER;AAGF,MAAI,WAAW,IAAI,EAAE;AAEnB,OAAI,CAAC,UAAU,YAAY,eACzB,WAAU,YAAY,iBAAiB,EAAE;AAE3C,aAAU,YAAY,eAAe,KAAK,IAAI;SACzC;GAEL,MAAM,YAAY,eAAe,IAAI,IAAI,IAAI,YAAY;AACzD,OAAI,CAAC,UAAU,WACb,WAAU,aAAa,EAAE;AAE3B,aAAU,WAAW,KAAK,IAAI;;;CAKlC,MAAM,gCAAgB,IAAI,KAAuB;AAGjD,MAAK,MAAM,aAAa,YACtB,KAAI,UAAU,cAAc,UAAU,WAAW,SAAS,EAExD,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAK7D,MAAK,MAAM,aAAa,OAAO,KAAK,UAAU,CAC5C,KAAI,CAAC,cAAc,IAAI,UAAU,CAC/B,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAI7D,QAAO"}
@@ -0,0 +1 @@
1
+ import { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys } from "./definitions.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -1,7 +1,6 @@
1
1
  import { extractLocalPredefinedStates } from "../states/index.js";
2
2
  import { hasPipelineCacheEntry, renderStyles } from "../pipeline/index.js";
3
3
  import { CHUNK_NAMES } from "./definitions.js";
4
-
5
4
  //#region src/chunks/renderChunk.ts
6
5
  /**
7
6
  * Build a filtered styles object for a regular chunk.
@@ -54,7 +53,7 @@ function renderStylesForChunk(styles, chunkName, styleKeys, pipelineCacheKey) {
54
53
  if (pipelineCacheKey && hasPipelineCacheEntry(pipelineCacheKey)) return renderStyles(void 0, void 0, void 0, pipelineCacheKey);
55
54
  return renderStyles(chunkName === CHUNK_NAMES.SUBCOMPONENTS ? buildSubcomponentFilteredStyles(styles, styleKeys) : buildFilteredStyles(styles, styleKeys), void 0, void 0, pipelineCacheKey);
56
55
  }
57
-
58
56
  //#endregion
59
57
  export { renderStylesForChunk };
58
+
60
59
  //# sourceMappingURL=renderChunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderChunk.js","names":[],"sources":["../../src/chunks/renderChunk.ts"],"sourcesContent":["/**\n * Chunk-specific style rendering.\n *\n * Renders styles for a specific chunk by filtering the styles object\n * to only include relevant keys before passing to renderStyles.\n */\n\nimport type { RenderResult } from '../pipeline';\nimport { hasPipelineCacheEntry, renderStyles } from '../pipeline';\nimport { extractLocalPredefinedStates } from '../states';\nimport type { Styles } from '../styles/types';\n\nimport { CHUNK_NAMES } from './definitions';\n\n/**\n * Build a filtered styles object for a regular chunk.\n */\nfunction buildFilteredStyles(styles: Styles, styleKeys: string[]): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n return filteredStyles;\n}\n\n/**\n * Build a filtered styles object for the subcomponents chunk.\n */\nfunction buildSubcomponentFilteredStyles(\n styles: Styles,\n selectorKeys: string[],\n): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of selectorKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n if (styles.$ !== undefined) {\n filteredStyles.$ = styles.$;\n }\n\n return filteredStyles;\n}\n\n/**\n * Render styles for a specific chunk.\n *\n * On pipeline cache hit, avoids building the filtered styles object entirely.\n * Only constructs it on cache miss when the pipeline actually needs the styles.\n *\n * IMPORTANT: Local predefined states (e.g., '@mobile': '@media(w < 600px)')\n * are always included in the filtered styles, regardless of which chunk is\n * being rendered. This ensures that state references like '@mobile' in any\n * chunk can be properly resolved by the pipeline.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk being rendered\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns RenderResult with rules for this chunk\n */\nexport function renderStylesForChunk(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n pipelineCacheKey?: string,\n): RenderResult {\n if (styleKeys.length === 0) {\n return { rules: [], className: '' };\n }\n\n // Fast path: skip building filteredStyles when pipeline has a cached result\n if (pipelineCacheKey && hasPipelineCacheEntry(pipelineCacheKey)) {\n return renderStyles(undefined, undefined, undefined, pipelineCacheKey);\n }\n\n // Cache miss: build filtered styles and run pipeline\n const filteredStyles =\n chunkName === CHUNK_NAMES.SUBCOMPONENTS\n ? buildSubcomponentFilteredStyles(styles, styleKeys)\n : buildFilteredStyles(styles, styleKeys);\n\n return renderStyles(filteredStyles, undefined, undefined, pipelineCacheKey);\n}\n"],"mappings":";;;;;;;;AAiBA,SAAS,oBAAoB,QAAgB,WAA6B;CACxE,MAAM,wBAAwB,6BAA6B,OAAO;CAClE,MAAM,iBAAyB,EAAE;AAEjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAGxB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,OACZ,gBAAe,OAAO;;AAI1B,QAAO;;;;;AAMT,SAAS,gCACP,QACA,cACQ;CACR,MAAM,wBAAwB,6BAA6B,OAAO;CAClE,MAAM,iBAAyB,EAAE;AAEjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAGxB,MAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,OACZ,gBAAe,OAAO;;AAI1B,KAAI,OAAO,MAAM,OACf,gBAAe,IAAI,OAAO;AAG5B,QAAO;;;;;;;;;;;;;;;;;;AAmBT,SAAgB,qBACd,QACA,WACA,WACA,kBACc;AACd,KAAI,UAAU,WAAW,EACvB,QAAO;EAAE,OAAO,EAAE;EAAE,WAAW;EAAI;AAIrC,KAAI,oBAAoB,sBAAsB,iBAAiB,CAC7D,QAAO,aAAa,QAAW,QAAW,QAAW,iBAAiB;AASxE,QAAO,aAJL,cAAc,YAAY,gBACtB,gCAAgC,QAAQ,UAAU,GAClD,oBAAoB,QAAQ,UAAU,EAER,QAAW,QAAW,iBAAiB"}
1
+ {"version":3,"file":"renderChunk.js","names":[],"sources":["../../src/chunks/renderChunk.ts"],"sourcesContent":["/**\n * Chunk-specific style rendering.\n *\n * Renders styles for a specific chunk by filtering the styles object\n * to only include relevant keys before passing to renderStyles.\n */\n\nimport type { RenderResult } from '../pipeline';\nimport { hasPipelineCacheEntry, renderStyles } from '../pipeline';\nimport { extractLocalPredefinedStates } from '../states';\nimport type { Styles } from '../styles/types';\n\nimport { CHUNK_NAMES } from './definitions';\n\n/**\n * Build a filtered styles object for a regular chunk.\n */\nfunction buildFilteredStyles(styles: Styles, styleKeys: string[]): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n return filteredStyles;\n}\n\n/**\n * Build a filtered styles object for the subcomponents chunk.\n */\nfunction buildSubcomponentFilteredStyles(\n styles: Styles,\n selectorKeys: string[],\n): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of selectorKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n if (styles.$ !== undefined) {\n filteredStyles.$ = styles.$;\n }\n\n return filteredStyles;\n}\n\n/**\n * Render styles for a specific chunk.\n *\n * On pipeline cache hit, avoids building the filtered styles object entirely.\n * Only constructs it on cache miss when the pipeline actually needs the styles.\n *\n * IMPORTANT: Local predefined states (e.g., '@mobile': '@media(w < 600px)')\n * are always included in the filtered styles, regardless of which chunk is\n * being rendered. This ensures that state references like '@mobile' in any\n * chunk can be properly resolved by the pipeline.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk being rendered\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns RenderResult with rules for this chunk\n */\nexport function renderStylesForChunk(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n pipelineCacheKey?: string,\n): RenderResult {\n if (styleKeys.length === 0) {\n return { rules: [], className: '' };\n }\n\n // Fast path: skip building filteredStyles when pipeline has a cached result\n if (pipelineCacheKey && hasPipelineCacheEntry(pipelineCacheKey)) {\n return renderStyles(undefined, undefined, undefined, pipelineCacheKey);\n }\n\n // Cache miss: build filtered styles and run pipeline\n const filteredStyles =\n chunkName === CHUNK_NAMES.SUBCOMPONENTS\n ? buildSubcomponentFilteredStyles(styles, styleKeys)\n : buildFilteredStyles(styles, styleKeys);\n\n return renderStyles(filteredStyles, undefined, undefined, pipelineCacheKey);\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,oBAAoB,QAAgB,WAA6B;CACxE,MAAM,wBAAwB,6BAA6B,OAAO;CAClE,MAAM,iBAAyB,EAAE;AAEjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAGxB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,KAAA,EACZ,gBAAe,OAAO;;AAI1B,QAAO;;;;;AAMT,SAAS,gCACP,QACA,cACQ;CACR,MAAM,wBAAwB,6BAA6B,OAAO;CAClE,MAAM,iBAAyB,EAAE;AAEjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAGxB,MAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,KAAA,EACZ,gBAAe,OAAO;;AAI1B,KAAI,OAAO,MAAM,KAAA,EACf,gBAAe,IAAI,OAAO;AAG5B,QAAO;;;;;;;;;;;;;;;;;;AAmBT,SAAgB,qBACd,QACA,WACA,WACA,kBACc;AACd,KAAI,UAAU,WAAW,EACvB,QAAO;EAAE,OAAO,EAAE;EAAE,WAAW;EAAI;AAIrC,KAAI,oBAAoB,sBAAsB,iBAAiB,CAC7D,QAAO,aAAa,KAAA,GAAW,KAAA,GAAW,KAAA,GAAW,iBAAiB;AASxE,QAAO,aAJL,cAAc,YAAY,gBACtB,gCAAgC,QAAQ,UAAU,GAClD,oBAAoB,QAAQ,UAAU,EAER,KAAA,GAAW,KAAA,GAAW,iBAAiB"}
@@ -0,0 +1,31 @@
1
+ import { Styles } from "./styles/types.js";
2
+ import { ServerStyleCollector } from "./ssr/collector.js";
3
+
4
+ //#region src/compute-styles.d.ts
5
+ interface ComputeStylesResult {
6
+ className: string;
7
+ /** CSS text to emit as an inline <style> tag (RSC mode only). */
8
+ css?: string;
9
+ }
10
+ interface ComputeStylesOptions {
11
+ ssrCollector?: ServerStyleCollector | null;
12
+ }
13
+ /**
14
+ * Synchronous, hook-free style computation.
15
+ *
16
+ * Resolves recipes, categorizes style keys into chunks, renders CSS rules,
17
+ * allocates class names, and injects / collects / returns the CSS.
18
+ *
19
+ * Three code paths:
20
+ * 1. SSR collector — discovered via ALS or passed explicitly; CSS collected
21
+ * 2. RSC inline — no collector and no `document`; CSS returned as `result.css`
22
+ * for the caller to emit as an inline `<style>` tag
23
+ * 3. Client inject — CSS injected synchronously into the DOM (idempotent)
24
+ *
25
+ * @param styles - Tasty styles object (or undefined for no styles)
26
+ * @param options - Optional SSR collector override
27
+ */
28
+ declare function computeStyles(styles: Styles | undefined, options?: ComputeStylesOptions): ComputeStylesResult;
29
+ //#endregion
30
+ export { ComputeStylesOptions, ComputeStylesResult, computeStyles };
31
+ //# sourceMappingURL=compute-styles.d.ts.map
@@ -0,0 +1,356 @@
1
+ import { extractLocalProperties, hasLocalProperties } from "./properties/index.js";
2
+ import { extractLocalFontFace, fontFaceContentHash, formatFontFaceRule, hasLocalFontFace } from "./font-face/index.js";
3
+ import { extractLocalCounterStyle, formatCounterStyleRule, hasLocalCounterStyle } from "./counter-style/index.js";
4
+ import { renderStyles } from "./pipeline/index.js";
5
+ import { getConfig, getEffectiveProperties, getGlobalConfigTokens, getGlobalCounterStyle, getGlobalFontFace, getGlobalKeyframes, hasGlobalKeyframes } from "./config.js";
6
+ import { categorizeStyleKeys } from "./chunks/definitions.js";
7
+ import { generateChunkCacheKey } from "./chunks/cacheKey.js";
8
+ import { renderStylesForChunk } from "./chunks/renderChunk.js";
9
+ import { counterStyle, fontFace, inject, keyframes, property } from "./injector/index.js";
10
+ import { extractAnimationNamesFromStyles, extractLocalKeyframes, filterUsedKeyframes, hasLocalKeyframes, mergeKeyframes, replaceAnimationNames } from "./keyframes/index.js";
11
+ import { formatPropertyCSS } from "./ssr/format-property.js";
12
+ import { collectAutoInferredProperties } from "./ssr/collect-auto-properties.js";
13
+ import { formatGlobalRules } from "./ssr/format-global-rules.js";
14
+ import { formatKeyframesCSS } from "./ssr/format-keyframes.js";
15
+ import { formatRules } from "./ssr/format-rules.js";
16
+ import { getRegisteredSSRCollector } from "./ssr/ssr-collector-ref.js";
17
+ import { hasKeys } from "./utils/has-keys.js";
18
+ import { resolveRecipes } from "./utils/resolve-recipes.js";
19
+ import { cache } from "react";
20
+ //#region src/compute-styles.ts
21
+ /**
22
+ * Hook-free, synchronous style computation.
23
+ *
24
+ * Extracts the core logic from useStyles() into a plain function that can
25
+ * be called during React render without any hooks. Three code paths:
26
+ *
27
+ * 1. SSR collector — styles collected via ServerStyleCollector
28
+ * 2. Client inject — styles injected synchronously into the DOM
29
+ * 3. RSC inline — styles returned as CSS strings for inline <style> emission
30
+ *
31
+ * This enables tasty() components to work as React Server Components.
32
+ */
33
+ const EMPTY_RESULT = { className: "" };
34
+ /**
35
+ * Per-request RSC style cache using React.cache.
36
+ * React.cache provides per-request memoization in Server Components,
37
+ * so each request gets its own isolated cache.
38
+ */
39
+ const getRSCCache = cache(() => ({
40
+ cacheKeyToClassName: /* @__PURE__ */ new Map(),
41
+ classCounter: 0,
42
+ emittedKeys: /* @__PURE__ */ new Set(),
43
+ internalsEmitted: false
44
+ }));
45
+ function rscAllocateClassName(rscCache, cacheKey) {
46
+ const existing = rscCache.cacheKeyToClassName.get(cacheKey);
47
+ if (existing) return {
48
+ className: existing,
49
+ isNew: false
50
+ };
51
+ const className = `r${rscCache.classCounter++}`;
52
+ rscCache.cacheKeyToClassName.set(cacheKey, className);
53
+ return {
54
+ className,
55
+ isNew: true
56
+ };
57
+ }
58
+ /**
59
+ * Collect internals CSS for RSC — mirrors ServerStyleCollector.collectInternals().
60
+ * Emitted once per request (tracked via rscCache.internalsEmitted).
61
+ */
62
+ function collectInternalsRSC(rscCache) {
63
+ if (rscCache.internalsEmitted) return "";
64
+ rscCache.internalsEmitted = true;
65
+ const parts = [];
66
+ for (const [token, definition] of Object.entries(getEffectiveProperties())) {
67
+ const css = formatPropertyCSS(token, definition);
68
+ if (css) parts.push(css);
69
+ }
70
+ const tokenStyles = getGlobalConfigTokens();
71
+ if (tokenStyles && Object.keys(tokenStyles).length > 0) {
72
+ const tokenRules = renderStyles(tokenStyles, ":root");
73
+ if (tokenRules.length > 0) {
74
+ const css = formatGlobalRules(tokenRules);
75
+ if (css) parts.push(css);
76
+ }
77
+ }
78
+ const globalFF = getGlobalFontFace();
79
+ if (globalFF) for (const [family, input] of Object.entries(globalFF)) {
80
+ const descriptors = Array.isArray(input) ? input : [input];
81
+ for (const desc of descriptors) parts.push(formatFontFaceRule(family, desc));
82
+ }
83
+ const globalCS = getGlobalCounterStyle();
84
+ if (globalCS) for (const [name, descriptors] of Object.entries(globalCS)) parts.push(formatCounterStyleRule(name, descriptors));
85
+ return parts.join("\n");
86
+ }
87
+ /**
88
+ * Collect per-component ancillary CSS (keyframes, @property, font-face,
89
+ * counter-style) for RSC mode.
90
+ */
91
+ function collectAncillaryRSC(rscCache, styles) {
92
+ const parts = [];
93
+ const usedKf = getUsedKeyframes(styles);
94
+ if (usedKf) for (const [name, steps] of Object.entries(usedKf)) {
95
+ const key = `__kf:${name}`;
96
+ if (!rscCache.emittedKeys.has(key)) {
97
+ rscCache.emittedKeys.add(key);
98
+ parts.push(formatKeyframesCSS(name, steps));
99
+ }
100
+ }
101
+ if (hasLocalProperties(styles)) {
102
+ const localProperties = extractLocalProperties(styles);
103
+ if (localProperties) for (const [token, definition] of Object.entries(localProperties)) {
104
+ const key = `__prop:${token}`;
105
+ if (!rscCache.emittedKeys.has(key)) {
106
+ rscCache.emittedKeys.add(key);
107
+ const css = formatPropertyCSS(token, definition);
108
+ if (css) parts.push(css);
109
+ }
110
+ }
111
+ }
112
+ if (hasLocalFontFace(styles)) {
113
+ const localFontFace = extractLocalFontFace(styles);
114
+ if (localFontFace) for (const [family, input] of Object.entries(localFontFace)) {
115
+ const descriptors = Array.isArray(input) ? input : [input];
116
+ for (const desc of descriptors) {
117
+ const key = `__ff:${fontFaceContentHash(family, desc)}`;
118
+ if (!rscCache.emittedKeys.has(key)) {
119
+ rscCache.emittedKeys.add(key);
120
+ parts.push(formatFontFaceRule(family, desc));
121
+ }
122
+ }
123
+ }
124
+ }
125
+ if (hasLocalCounterStyle(styles)) {
126
+ const localCounterStyle = extractLocalCounterStyle(styles);
127
+ if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) {
128
+ const key = `__cs:${name}`;
129
+ if (!rscCache.emittedKeys.has(key)) {
130
+ rscCache.emittedKeys.add(key);
131
+ parts.push(formatCounterStyleRule(name, descriptors));
132
+ }
133
+ }
134
+ }
135
+ return parts.join("\n");
136
+ }
137
+ /**
138
+ * Process all chunks in RSC mode: render CSS to strings, allocate classNames,
139
+ * and return combined { className, css }.
140
+ */
141
+ function computeStylesRSC(styles, chunkMap) {
142
+ const rscCache = getRSCCache();
143
+ const cssParts = [];
144
+ const classNames = [];
145
+ const internalsCSS = collectInternalsRSC(rscCache);
146
+ if (internalsCSS) cssParts.push(internalsCSS);
147
+ for (const [chunkName, chunkStyleKeys] of chunkMap) {
148
+ if (chunkStyleKeys.length === 0) continue;
149
+ const { className, isNew } = rscAllocateClassName(rscCache, generateChunkCacheKey(styles, chunkName, chunkStyleKeys));
150
+ classNames.push(className);
151
+ if (isNew) {
152
+ const renderResult = renderStylesForChunk(styles, chunkName, chunkStyleKeys);
153
+ if (renderResult.rules.length > 0) {
154
+ const css = formatRules(renderResult.rules, className);
155
+ if (css) cssParts.push(css);
156
+ }
157
+ }
158
+ }
159
+ const ancillaryCSS = collectAncillaryRSC(rscCache, styles);
160
+ if (ancillaryCSS) cssParts.push(ancillaryCSS);
161
+ if (classNames.length === 0) return EMPTY_RESULT;
162
+ const css = cssParts.join("\n");
163
+ return {
164
+ className: classNames.join(" "),
165
+ css: css || void 0
166
+ };
167
+ }
168
+ /**
169
+ * Get keyframes that are actually used in styles.
170
+ * Returns null if no keyframes are used (fast path for zero overhead).
171
+ */
172
+ function getUsedKeyframes(styles) {
173
+ const hasLocal = hasLocalKeyframes(styles);
174
+ const hasGlobal = hasGlobalKeyframes();
175
+ if (!hasLocal && !hasGlobal) return null;
176
+ const usedNames = extractAnimationNamesFromStyles(styles);
177
+ if (usedNames.size === 0) return null;
178
+ return filterUsedKeyframes(mergeKeyframes(hasLocal ? extractLocalKeyframes(styles) : null, hasGlobal ? getGlobalKeyframes() : null), usedNames);
179
+ }
180
+ /**
181
+ * Process a chunk on the SSR path: allocate via collector, render, collect CSS.
182
+ */
183
+ function processChunkSSR(collector, styles, chunkName, styleKeys) {
184
+ if (styleKeys.length === 0) return null;
185
+ const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys);
186
+ const { className, isNewAllocation } = collector.allocateClassName(cacheKey);
187
+ if (isNewAllocation) {
188
+ const renderResult = renderStylesForChunk(styles, chunkName, styleKeys);
189
+ if (renderResult.rules.length > 0) {
190
+ collector.collectChunk(cacheKey, className, renderResult.rules);
191
+ return {
192
+ name: chunkName,
193
+ styleKeys,
194
+ cacheKey,
195
+ renderResult,
196
+ className
197
+ };
198
+ }
199
+ return null;
200
+ }
201
+ return {
202
+ name: chunkName,
203
+ styleKeys,
204
+ cacheKey,
205
+ renderResult: { rules: [] },
206
+ className
207
+ };
208
+ }
209
+ /**
210
+ * Process a chunk on the client: render, allocate className, and inject
211
+ * CSS synchronously. The injector's cache makes this idempotent.
212
+ */
213
+ function processChunkSync(styles, chunkName, styleKeys) {
214
+ if (styleKeys.length === 0) return null;
215
+ const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys);
216
+ const renderResult = renderStylesForChunk(styles, chunkName, styleKeys, cacheKey);
217
+ if (renderResult.rules.length === 0) return null;
218
+ const { className } = inject(renderResult.rules, { cacheKey });
219
+ return {
220
+ name: chunkName,
221
+ styleKeys,
222
+ cacheKey,
223
+ renderResult,
224
+ className
225
+ };
226
+ }
227
+ /**
228
+ * Inject keyframes synchronously and return a name replacement map.
229
+ * On the client, keyframes are injected into the DOM.
230
+ */
231
+ function injectKeyframesSync(usedKeyframes) {
232
+ let nameMap = null;
233
+ for (const [name, steps] of Object.entries(usedKeyframes)) {
234
+ const injectedName = keyframes(steps, { name }).toString();
235
+ if (injectedName !== name) {
236
+ if (!nameMap) nameMap = /* @__PURE__ */ new Map();
237
+ nameMap.set(name, injectedName);
238
+ }
239
+ }
240
+ return nameMap;
241
+ }
242
+ /**
243
+ * Inject chunk rules synchronously, replacing animation names if needed.
244
+ */
245
+ function injectChunkRulesSync(chunks, nameMap) {
246
+ for (const chunk of chunks) if (chunk.renderResult.rules.length > 0) inject(nameMap ? chunk.renderResult.rules.map((rule) => ({
247
+ ...rule,
248
+ declarations: replaceAnimationNames(rule.declarations, nameMap)
249
+ })) : chunk.renderResult.rules, { cacheKey: chunk.cacheKey });
250
+ }
251
+ /**
252
+ * Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.
253
+ */
254
+ function injectAncillarySync(styles) {
255
+ if (hasLocalProperties(styles)) {
256
+ const localProperties = extractLocalProperties(styles);
257
+ if (localProperties) for (const [token, definition] of Object.entries(localProperties)) property(token, definition);
258
+ }
259
+ if (hasLocalFontFace(styles)) {
260
+ const localFontFace = extractLocalFontFace(styles);
261
+ if (localFontFace) for (const [family, input] of Object.entries(localFontFace)) {
262
+ const descriptors = Array.isArray(input) ? input : [input];
263
+ for (const desc of descriptors) fontFace(family, desc);
264
+ }
265
+ }
266
+ if (hasLocalCounterStyle(styles)) {
267
+ const localCounterStyle = extractLocalCounterStyle(styles);
268
+ if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) counterStyle(name, descriptors);
269
+ }
270
+ }
271
+ /**
272
+ * Collect all ancillary rules into the SSR collector.
273
+ */
274
+ function collectAncillarySSR(collector, styles, chunks) {
275
+ const usedKf = getUsedKeyframes(styles);
276
+ if (usedKf) for (const [name, steps] of Object.entries(usedKf)) {
277
+ const css = formatKeyframesCSS(name, steps);
278
+ collector.collectKeyframes(name, css);
279
+ }
280
+ if (hasLocalProperties(styles)) {
281
+ const localProperties = extractLocalProperties(styles);
282
+ if (localProperties) for (const [token, definition] of Object.entries(localProperties)) {
283
+ const css = formatPropertyCSS(token, definition);
284
+ if (css) collector.collectProperty(token, css);
285
+ }
286
+ }
287
+ if (hasLocalFontFace(styles)) {
288
+ const localFontFace = extractLocalFontFace(styles);
289
+ if (localFontFace) for (const [family, input] of Object.entries(localFontFace)) {
290
+ const descriptors = Array.isArray(input) ? input : [input];
291
+ for (const desc of descriptors) {
292
+ const hash = fontFaceContentHash(family, desc);
293
+ const css = formatFontFaceRule(family, desc);
294
+ collector.collectFontFace(hash, css);
295
+ }
296
+ }
297
+ }
298
+ if (hasLocalCounterStyle(styles)) {
299
+ const localCounterStyle = extractLocalCounterStyle(styles);
300
+ if (localCounterStyle) for (const [name, descriptors] of Object.entries(localCounterStyle)) {
301
+ const css = formatCounterStyleRule(name, descriptors);
302
+ collector.collectCounterStyle(name, css);
303
+ }
304
+ }
305
+ if (getConfig().autoPropertyTypes !== false) {
306
+ const allRules = chunks.flatMap((c) => c.renderResult.rules);
307
+ if (allRules.length > 0) collectAutoInferredProperties(allRules, collector, styles);
308
+ }
309
+ }
310
+ /**
311
+ * Synchronous, hook-free style computation.
312
+ *
313
+ * Resolves recipes, categorizes style keys into chunks, renders CSS rules,
314
+ * allocates class names, and injects / collects / returns the CSS.
315
+ *
316
+ * Three code paths:
317
+ * 1. SSR collector — discovered via ALS or passed explicitly; CSS collected
318
+ * 2. RSC inline — no collector and no `document`; CSS returned as `result.css`
319
+ * for the caller to emit as an inline `<style>` tag
320
+ * 3. Client inject — CSS injected synchronously into the DOM (idempotent)
321
+ *
322
+ * @param styles - Tasty styles object (or undefined for no styles)
323
+ * @param options - Optional SSR collector override
324
+ */
325
+ function computeStyles(styles, options) {
326
+ if (!styles || !hasKeys(styles)) return EMPTY_RESULT;
327
+ const resolved = resolveRecipes(styles);
328
+ const chunkMap = categorizeStyleKeys(resolved);
329
+ const collector = options?.ssrCollector !== void 0 ? options.ssrCollector : getRegisteredSSRCollector();
330
+ const chunks = [];
331
+ if (collector) {
332
+ collector.collectInternals();
333
+ for (const [chunkName, chunkStyleKeys] of chunkMap) {
334
+ const chunk = processChunkSSR(collector, resolved, chunkName, chunkStyleKeys);
335
+ if (chunk) chunks.push(chunk);
336
+ }
337
+ collectAncillarySSR(collector, resolved, chunks);
338
+ } else if (typeof document === "undefined") return computeStylesRSC(resolved, chunkMap);
339
+ else {
340
+ injectAncillarySync(resolved);
341
+ const usedKf = getUsedKeyframes(resolved);
342
+ const nameMap = usedKf ? injectKeyframesSync(usedKf) : null;
343
+ for (const [chunkName, chunkStyleKeys] of chunkMap) {
344
+ const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys);
345
+ if (chunk) chunks.push(chunk);
346
+ }
347
+ if (nameMap) injectChunkRulesSync(chunks, nameMap);
348
+ }
349
+ if (chunks.length === 0) return EMPTY_RESULT;
350
+ if (chunks.length === 1) return { className: chunks[0].className };
351
+ return { className: chunks.map((c) => c.className).join(" ") };
352
+ }
353
+ //#endregion
354
+ export { computeStyles };
355
+
356
+ //# sourceMappingURL=compute-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-styles.js","names":[],"sources":["../src/compute-styles.ts"],"sourcesContent":["/**\n * Hook-free, synchronous style computation.\n *\n * Extracts the core logic from useStyles() into a plain function that can\n * be called during React render without any hooks. Three code paths:\n *\n * 1. SSR collector — styles collected via ServerStyleCollector\n * 2. Client inject — styles injected synchronously into the DOM\n * 3. RSC inline — styles returned as CSS strings for inline <style> emission\n *\n * This enables tasty() components to work as React Server Components.\n */\n\nimport { cache } from 'react';\n\nimport {\n categorizeStyleKeys,\n generateChunkCacheKey,\n renderStylesForChunk,\n} from './chunks';\nimport {\n getConfig,\n getGlobalConfigTokens,\n getGlobalCounterStyle,\n getEffectiveProperties,\n getGlobalFontFace,\n getGlobalKeyframes,\n hasGlobalKeyframes,\n} from './config';\nimport {\n counterStyle,\n fontFace,\n inject,\n keyframes,\n property,\n} from './injector';\nimport type { FontFaceDescriptors, KeyframesSteps } from './injector/types';\nimport {\n extractLocalCounterStyle,\n formatCounterStyleRule,\n hasLocalCounterStyle,\n} from './counter-style';\nimport {\n extractLocalFontFace,\n fontFaceContentHash,\n formatFontFaceRule,\n hasLocalFontFace,\n} from './font-face';\nimport {\n extractAnimationNamesFromStyles,\n extractLocalKeyframes,\n filterUsedKeyframes,\n hasLocalKeyframes,\n mergeKeyframes,\n replaceAnimationNames,\n} from './keyframes';\nimport type { RenderResult, StyleResult } from './pipeline';\nimport { renderStyles } from './pipeline';\nimport { extractLocalProperties, hasLocalProperties } from './properties';\nimport { collectAutoInferredProperties } from './ssr/collect-auto-properties';\nimport type { ServerStyleCollector } from './ssr/collector';\nimport { formatGlobalRules } from './ssr/format-global-rules';\nimport { formatKeyframesCSS } from './ssr/format-keyframes';\nimport { formatPropertyCSS } from './ssr/format-property';\nimport { formatRules } from './ssr/format-rules';\nimport { getRegisteredSSRCollector } from './ssr/ssr-collector-ref';\nimport type { Styles } from './styles/types';\nimport { hasKeys } from './utils/has-keys';\nimport { resolveRecipes } from './utils/resolve-recipes';\n\nexport interface ComputeStylesResult {\n className: string;\n /** CSS text to emit as an inline <style> tag (RSC mode only). */\n css?: string;\n}\n\nexport interface ComputeStylesOptions {\n ssrCollector?: ServerStyleCollector | null;\n}\n\ninterface ProcessedChunk {\n name: string;\n styleKeys: string[];\n cacheKey: string;\n renderResult: RenderResult;\n className: string;\n}\n\nconst EMPTY_RESULT: ComputeStylesResult = { className: '' };\n\n// ---------------------------------------------------------------------------\n// RSC (React Server Components) inline style support\n// ---------------------------------------------------------------------------\n\ninterface RSCStyleCache {\n cacheKeyToClassName: Map<string, string>;\n classCounter: number;\n emittedKeys: Set<string>;\n internalsEmitted: boolean;\n}\n\n/**\n * Per-request RSC style cache using React.cache.\n * React.cache provides per-request memoization in Server Components,\n * so each request gets its own isolated cache.\n */\nconst getRSCCache = cache(\n (): RSCStyleCache => ({\n cacheKeyToClassName: new Map(),\n classCounter: 0,\n emittedKeys: new Set(),\n internalsEmitted: false,\n }),\n);\n\nfunction rscAllocateClassName(\n rscCache: RSCStyleCache,\n cacheKey: string,\n): { className: string; isNew: boolean } {\n const existing = rscCache.cacheKeyToClassName.get(cacheKey);\n if (existing) return { className: existing, isNew: false };\n\n // Use 'r' prefix to avoid collisions with SSR collector's 't' prefix\n const className = `r${rscCache.classCounter++}`;\n rscCache.cacheKeyToClassName.set(cacheKey, className);\n return { className, isNew: true };\n}\n\n/**\n * Collect internals CSS for RSC — mirrors ServerStyleCollector.collectInternals().\n * Emitted once per request (tracked via rscCache.internalsEmitted).\n */\nfunction collectInternalsRSC(rscCache: RSCStyleCache): string {\n if (rscCache.internalsEmitted) return '';\n rscCache.internalsEmitted = true;\n\n const parts: string[] = [];\n\n for (const [token, definition] of Object.entries(getEffectiveProperties())) {\n const css = formatPropertyCSS(token, definition);\n if (css) parts.push(css);\n }\n\n const tokenStyles = getGlobalConfigTokens();\n if (tokenStyles && Object.keys(tokenStyles).length > 0) {\n const tokenRules = renderStyles(tokenStyles, ':root') as StyleResult[];\n if (tokenRules.length > 0) {\n const css = formatGlobalRules(tokenRules);\n if (css) parts.push(css);\n }\n }\n\n const globalFF = getGlobalFontFace();\n if (globalFF) {\n for (const [family, input] of Object.entries(globalFF)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n parts.push(formatFontFaceRule(family, desc));\n }\n }\n }\n\n const globalCS = getGlobalCounterStyle();\n if (globalCS) {\n for (const [name, descriptors] of Object.entries(globalCS)) {\n parts.push(formatCounterStyleRule(name, descriptors));\n }\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Collect per-component ancillary CSS (keyframes, @property, font-face,\n * counter-style) for RSC mode.\n */\nfunction collectAncillaryRSC(rscCache: RSCStyleCache, styles: Styles): string {\n const parts: string[] = [];\n\n const usedKf = getUsedKeyframes(styles);\n if (usedKf) {\n for (const [name, steps] of Object.entries(usedKf)) {\n const key = `__kf:${name}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatKeyframesCSS(name, steps));\n }\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const key = `__prop:${token}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n const css = formatPropertyCSS(token, definition);\n if (css) parts.push(css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const key = `__ff:${hash}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatFontFaceRule(family, desc));\n }\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const key = `__cs:${name}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatCounterStyleRule(name, descriptors));\n }\n }\n }\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Process all chunks in RSC mode: render CSS to strings, allocate classNames,\n * and return combined { className, css }.\n */\nfunction computeStylesRSC(\n styles: Styles,\n chunkMap: Map<string, string[]>,\n): ComputeStylesResult {\n const rscCache = getRSCCache();\n const cssParts: string[] = [];\n const classNames: string[] = [];\n\n const internalsCSS = collectInternalsRSC(rscCache);\n if (internalsCSS) cssParts.push(internalsCSS);\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n if (chunkStyleKeys.length === 0) continue;\n\n const cacheKey = generateChunkCacheKey(styles, chunkName, chunkStyleKeys);\n const { className, isNew } = rscAllocateClassName(rscCache, cacheKey);\n classNames.push(className);\n\n if (isNew) {\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n chunkStyleKeys,\n );\n if (renderResult.rules.length > 0) {\n const css = formatRules(renderResult.rules, className);\n if (css) cssParts.push(css);\n }\n }\n }\n\n const ancillaryCSS = collectAncillaryRSC(rscCache, styles);\n if (ancillaryCSS) cssParts.push(ancillaryCSS);\n\n if (classNames.length === 0) return EMPTY_RESULT;\n\n const css = cssParts.join('\\n');\n\n return {\n className: classNames.join(' '),\n css: css || undefined,\n };\n}\n\n/**\n * Get keyframes that are actually used in styles.\n * Returns null if no keyframes are used (fast path for zero overhead).\n */\nfunction getUsedKeyframes(\n styles: Styles,\n): Record<string, KeyframesSteps> | null {\n const hasLocal = hasLocalKeyframes(styles);\n const hasGlobal = hasGlobalKeyframes();\n if (!hasLocal && !hasGlobal) return null;\n\n const usedNames = extractAnimationNamesFromStyles(styles);\n if (usedNames.size === 0) return null;\n\n const local = hasLocal ? extractLocalKeyframes(styles) : null;\n const global = hasGlobal ? getGlobalKeyframes() : null;\n const allKeyframes = mergeKeyframes(local, global);\n\n return filterUsedKeyframes(allKeyframes, usedNames);\n}\n\n/**\n * Process a chunk on the SSR path: allocate via collector, render, collect CSS.\n */\nfunction processChunkSSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys);\n const { className, isNewAllocation } = collector.allocateClassName(cacheKey);\n\n if (isNewAllocation) {\n const renderResult = renderStylesForChunk(styles, chunkName, styleKeys);\n if (renderResult.rules.length > 0) {\n collector.collectChunk(cacheKey, className, renderResult.rules);\n return { name: chunkName, styleKeys, cacheKey, renderResult, className };\n }\n return null;\n }\n\n return {\n name: chunkName,\n styleKeys,\n cacheKey,\n renderResult: { rules: [] },\n className,\n };\n}\n\n/**\n * Process a chunk on the client: render, allocate className, and inject\n * CSS synchronously. The injector's cache makes this idempotent.\n */\nfunction processChunkSync(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const cacheKey = generateChunkCacheKey(styles, chunkName, styleKeys);\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n styleKeys,\n cacheKey,\n );\n if (renderResult.rules.length === 0) return null;\n\n const { className } = inject(renderResult.rules, { cacheKey });\n\n return { name: chunkName, styleKeys, cacheKey, renderResult, className };\n}\n\n/**\n * Inject keyframes synchronously and return a name replacement map.\n * On the client, keyframes are injected into the DOM.\n */\nfunction injectKeyframesSync(\n usedKeyframes: Record<string, KeyframesSteps>,\n): Map<string, string> | null {\n let nameMap: Map<string, string> | null = null;\n\n for (const [name, steps] of Object.entries(usedKeyframes)) {\n const result = keyframes(steps, { name });\n const injectedName = result.toString();\n if (injectedName !== name) {\n if (!nameMap) nameMap = new Map();\n nameMap.set(name, injectedName);\n }\n }\n\n return nameMap;\n}\n\n/**\n * Inject chunk rules synchronously, replacing animation names if needed.\n */\nfunction injectChunkRulesSync(\n chunks: ProcessedChunk[],\n nameMap: Map<string, string> | null,\n): void {\n for (const chunk of chunks) {\n if (chunk.renderResult.rules.length > 0) {\n const rulesToInject: StyleResult[] = nameMap\n ? chunk.renderResult.rules.map((rule) => ({\n ...rule,\n declarations: replaceAnimationNames(rule.declarations, nameMap!),\n }))\n : chunk.renderResult.rules;\n\n inject(rulesToInject, { cacheKey: chunk.cacheKey });\n }\n }\n}\n\n/**\n * Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.\n */\nfunction injectAncillarySync(styles: Styles): void {\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n property(token, definition);\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n fontFace(family, desc);\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n counterStyle(name, descriptors);\n }\n }\n }\n}\n\n/**\n * Collect all ancillary rules into the SSR collector.\n */\nfunction collectAncillarySSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunks: ProcessedChunk[],\n): void {\n const usedKf = getUsedKeyframes(styles);\n if (usedKf) {\n for (const [name, steps] of Object.entries(usedKf)) {\n const css = formatKeyframesCSS(name, steps);\n collector.collectKeyframes(name, css);\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n collector.collectProperty(token, css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n collector.collectFontFace(hash, css);\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const css = formatCounterStyleRule(name, descriptors);\n collector.collectCounterStyle(name, css);\n }\n }\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n const allRules = chunks.flatMap((c) => c.renderResult.rules);\n if (allRules.length > 0) {\n collectAutoInferredProperties(allRules, collector, styles);\n }\n }\n}\n\n/**\n * Synchronous, hook-free style computation.\n *\n * Resolves recipes, categorizes style keys into chunks, renders CSS rules,\n * allocates class names, and injects / collects / returns the CSS.\n *\n * Three code paths:\n * 1. SSR collector — discovered via ALS or passed explicitly; CSS collected\n * 2. RSC inline — no collector and no `document`; CSS returned as `result.css`\n * for the caller to emit as an inline `<style>` tag\n * 3. Client inject — CSS injected synchronously into the DOM (idempotent)\n *\n * @param styles - Tasty styles object (or undefined for no styles)\n * @param options - Optional SSR collector override\n */\nexport function computeStyles(\n styles: Styles | undefined,\n options?: ComputeStylesOptions,\n): ComputeStylesResult {\n if (!styles || !hasKeys(styles as Record<string, unknown>)) {\n return EMPTY_RESULT;\n }\n\n const resolved = resolveRecipes(styles);\n const chunkMap = categorizeStyleKeys(resolved as Record<string, unknown>);\n\n const collector =\n options?.ssrCollector !== undefined\n ? options.ssrCollector\n : getRegisteredSSRCollector();\n\n const chunks: ProcessedChunk[] = [];\n\n if (collector) {\n collector.collectInternals();\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSSR(\n collector,\n resolved,\n chunkName,\n chunkStyleKeys,\n );\n if (chunk) chunks.push(chunk);\n }\n\n collectAncillarySSR(collector, resolved, chunks);\n } else if (typeof document === 'undefined') {\n // RSC path: render CSS to strings for inline <style> emission\n return computeStylesRSC(resolved, chunkMap);\n } else {\n injectAncillarySync(resolved);\n\n const usedKf = getUsedKeyframes(resolved);\n const nameMap = usedKf ? injectKeyframesSync(usedKf) : null;\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSync(resolved, chunkName, chunkStyleKeys);\n if (chunk) chunks.push(chunk);\n }\n\n if (nameMap) {\n injectChunkRulesSync(chunks, nameMap);\n }\n }\n\n if (chunks.length === 0) return EMPTY_RESULT;\n if (chunks.length === 1) return { className: chunks[0].className };\n\n return { className: chunks.map((c) => c.className).join(' ') };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,MAAM,eAAoC,EAAE,WAAW,IAAI;;;;;;AAkB3D,MAAM,cAAc,aACI;CACpB,qCAAqB,IAAI,KAAK;CAC9B,cAAc;CACd,6BAAa,IAAI,KAAK;CACtB,kBAAkB;CACnB,EACF;AAED,SAAS,qBACP,UACA,UACuC;CACvC,MAAM,WAAW,SAAS,oBAAoB,IAAI,SAAS;AAC3D,KAAI,SAAU,QAAO;EAAE,WAAW;EAAU,OAAO;EAAO;CAG1D,MAAM,YAAY,IAAI,SAAS;AAC/B,UA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