@tenphi/tasty 0.0.0-snapshot.c8bdaeb → 0.0.0-snapshot.cae4fee

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 (303) hide show
  1. package/README.md +314 -159
  2. package/dist/async-storage-B7_o6FKt.js +44 -0
  3. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  4. package/dist/collector-C-keQH9m.js +243 -0
  5. package/dist/collector-C-keQH9m.js.map +1 -0
  6. package/dist/collector-osfWTeRd.d.ts +108 -0
  7. package/dist/config-BBiyxMCe.js +10559 -0
  8. package/dist/config-BBiyxMCe.js.map +1 -0
  9. package/dist/config-BoZDUHW5.d.ts +945 -0
  10. package/dist/context-CkSg-kDT.js +24 -0
  11. package/dist/context-CkSg-kDT.js.map +1 -0
  12. package/dist/core/index.d.ts +5 -33
  13. package/dist/core/index.js +6 -26
  14. package/dist/core-BO4319td.js +1598 -0
  15. package/dist/core-BO4319td.js.map +1 -0
  16. package/dist/css-writer-BWvwQzz0.js +351 -0
  17. package/dist/css-writer-BWvwQzz0.js.map +1 -0
  18. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  20. package/dist/format-rules-BSjeH4Z7.js +143 -0
  21. package/dist/format-rules-BSjeH4Z7.js.map +1 -0
  22. package/dist/hydrate-CcvrP4qJ.js +45 -0
  23. package/dist/hydrate-CcvrP4qJ.js.map +1 -0
  24. package/dist/index-B_k47mc_.d.ts +1655 -0
  25. package/dist/index-tcHuMPFt.d.ts +1286 -0
  26. package/dist/index.d.ts +5 -48
  27. package/dist/index.js +731 -32
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-BUQhdOSJ.js +588 -0
  30. package/dist/keyframes-BUQhdOSJ.js.map +1 -0
  31. package/dist/{utils/merge-styles.d.ts → merge-styles-BMWcH6MF.d.ts} +3 -3
  32. package/dist/{utils/merge-styles.js → merge-styles-Cd2vBl9b.js} +4 -6
  33. package/dist/merge-styles-Cd2vBl9b.js.map +1 -0
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-C1nrvnYh.js} +5 -8
  35. package/dist/resolve-recipes-C1nrvnYh.js.map +1 -0
  36. package/dist/ssr/astro-client.d.ts +1 -0
  37. package/dist/ssr/astro-client.js +19 -0
  38. package/dist/ssr/astro-client.js.map +1 -0
  39. package/dist/ssr/astro-middleware.d.ts +15 -0
  40. package/dist/ssr/astro-middleware.js +19 -0
  41. package/dist/ssr/astro-middleware.js.map +1 -0
  42. package/dist/ssr/astro.d.ts +97 -0
  43. package/dist/ssr/astro.js +149 -0
  44. package/dist/ssr/astro.js.map +1 -0
  45. package/dist/ssr/index.d.ts +44 -0
  46. package/dist/ssr/index.js +10 -0
  47. package/dist/ssr/index.js.map +1 -0
  48. package/dist/ssr/next.d.ts +46 -0
  49. package/dist/ssr/next.js +75 -0
  50. package/dist/ssr/next.js.map +1 -0
  51. package/dist/static/index.d.ts +91 -5
  52. package/dist/static/index.js +49 -4
  53. package/dist/static/index.js.map +1 -0
  54. package/dist/static/inject.d.ts +5 -0
  55. package/dist/static/inject.js +17 -0
  56. package/dist/static/inject.js.map +1 -0
  57. package/dist/zero/babel.d.ts +57 -84
  58. package/dist/zero/babel.js +232 -40
  59. package/dist/zero/babel.js.map +1 -1
  60. package/dist/zero/index.d.ts +67 -3
  61. package/dist/zero/index.js +2 -4
  62. package/dist/zero/next.d.ts +56 -30
  63. package/dist/zero/next.js +105 -40
  64. package/dist/zero/next.js.map +1 -1
  65. package/docs/README.md +31 -0
  66. package/docs/adoption.md +298 -0
  67. package/docs/comparison.md +419 -0
  68. package/docs/configuration.md +438 -0
  69. package/docs/debug.md +320 -0
  70. package/docs/design-system.md +436 -0
  71. package/docs/dsl.md +690 -0
  72. package/docs/getting-started.md +217 -0
  73. package/docs/injector.md +544 -0
  74. package/docs/methodology.md +642 -0
  75. package/docs/pipeline.md +699 -0
  76. package/docs/react-api.md +581 -0
  77. package/docs/ssr.md +444 -0
  78. package/docs/styles.md +598 -0
  79. package/docs/tasty-static.md +547 -0
  80. package/package.json +70 -37
  81. package/tasty.config.ts +1 -0
  82. package/dist/_virtual/_rolldown/runtime.js +0 -8
  83. package/dist/chunks/cacheKey.js +0 -70
  84. package/dist/chunks/cacheKey.js.map +0 -1
  85. package/dist/chunks/definitions.d.ts +0 -37
  86. package/dist/chunks/definitions.js +0 -260
  87. package/dist/chunks/definitions.js.map +0 -1
  88. package/dist/chunks/renderChunk.js +0 -61
  89. package/dist/chunks/renderChunk.js.map +0 -1
  90. package/dist/config.d.ts +0 -280
  91. package/dist/config.js +0 -403
  92. package/dist/config.js.map +0 -1
  93. package/dist/debug.d.ts +0 -204
  94. package/dist/debug.js +0 -733
  95. package/dist/debug.js.map +0 -1
  96. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  97. package/dist/hooks/useGlobalStyles.js +0 -56
  98. package/dist/hooks/useGlobalStyles.js.map +0 -1
  99. package/dist/hooks/useKeyframes.d.ts +0 -56
  100. package/dist/hooks/useKeyframes.js +0 -54
  101. package/dist/hooks/useKeyframes.js.map +0 -1
  102. package/dist/hooks/useProperty.d.ts +0 -79
  103. package/dist/hooks/useProperty.js +0 -91
  104. package/dist/hooks/useProperty.js.map +0 -1
  105. package/dist/hooks/useRawCSS.d.ts +0 -53
  106. package/dist/hooks/useRawCSS.js +0 -28
  107. package/dist/hooks/useRawCSS.js.map +0 -1
  108. package/dist/hooks/useStyles.d.ts +0 -40
  109. package/dist/hooks/useStyles.js +0 -169
  110. package/dist/hooks/useStyles.js.map +0 -1
  111. package/dist/injector/index.d.ts +0 -157
  112. package/dist/injector/index.js +0 -154
  113. package/dist/injector/index.js.map +0 -1
  114. package/dist/injector/injector.d.ts +0 -139
  115. package/dist/injector/injector.js +0 -404
  116. package/dist/injector/injector.js.map +0 -1
  117. package/dist/injector/sheet-manager.d.ts +0 -127
  118. package/dist/injector/sheet-manager.js +0 -714
  119. package/dist/injector/sheet-manager.js.map +0 -1
  120. package/dist/injector/types.d.ts +0 -135
  121. package/dist/keyframes/index.js +0 -206
  122. package/dist/keyframes/index.js.map +0 -1
  123. package/dist/parser/classify.js +0 -319
  124. package/dist/parser/classify.js.map +0 -1
  125. package/dist/parser/const.js +0 -33
  126. package/dist/parser/const.js.map +0 -1
  127. package/dist/parser/lru.js +0 -109
  128. package/dist/parser/lru.js.map +0 -1
  129. package/dist/parser/parser.d.ts +0 -25
  130. package/dist/parser/parser.js +0 -116
  131. package/dist/parser/parser.js.map +0 -1
  132. package/dist/parser/tokenizer.js +0 -69
  133. package/dist/parser/tokenizer.js.map +0 -1
  134. package/dist/parser/types.d.ts +0 -51
  135. package/dist/parser/types.js +0 -46
  136. package/dist/parser/types.js.map +0 -1
  137. package/dist/pipeline/conditions.d.ts +0 -134
  138. package/dist/pipeline/conditions.js +0 -406
  139. package/dist/pipeline/conditions.js.map +0 -1
  140. package/dist/pipeline/exclusive.js +0 -231
  141. package/dist/pipeline/exclusive.js.map +0 -1
  142. package/dist/pipeline/index.d.ts +0 -53
  143. package/dist/pipeline/index.js +0 -660
  144. package/dist/pipeline/index.js.map +0 -1
  145. package/dist/pipeline/materialize.js +0 -844
  146. package/dist/pipeline/materialize.js.map +0 -1
  147. package/dist/pipeline/parseStateKey.d.ts +0 -15
  148. package/dist/pipeline/parseStateKey.js +0 -438
  149. package/dist/pipeline/parseStateKey.js.map +0 -1
  150. package/dist/pipeline/simplify.js +0 -516
  151. package/dist/pipeline/simplify.js.map +0 -1
  152. package/dist/pipeline/warnings.js +0 -18
  153. package/dist/pipeline/warnings.js.map +0 -1
  154. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  155. package/dist/plugins/okhsl-plugin.js +0 -371
  156. package/dist/plugins/okhsl-plugin.js.map +0 -1
  157. package/dist/plugins/types.d.ts +0 -69
  158. package/dist/properties/index.js +0 -158
  159. package/dist/properties/index.js.map +0 -1
  160. package/dist/states/index.d.ts +0 -49
  161. package/dist/states/index.js +0 -416
  162. package/dist/states/index.js.map +0 -1
  163. package/dist/static/tastyStatic.d.ts +0 -46
  164. package/dist/static/tastyStatic.js +0 -31
  165. package/dist/static/tastyStatic.js.map +0 -1
  166. package/dist/static/types.d.ts +0 -49
  167. package/dist/static/types.js +0 -24
  168. package/dist/static/types.js.map +0 -1
  169. package/dist/styles/align.d.ts +0 -15
  170. package/dist/styles/align.js +0 -14
  171. package/dist/styles/align.js.map +0 -1
  172. package/dist/styles/border.d.ts +0 -25
  173. package/dist/styles/border.js +0 -114
  174. package/dist/styles/border.js.map +0 -1
  175. package/dist/styles/color.d.ts +0 -14
  176. package/dist/styles/color.js +0 -23
  177. package/dist/styles/color.js.map +0 -1
  178. package/dist/styles/createStyle.js +0 -77
  179. package/dist/styles/createStyle.js.map +0 -1
  180. package/dist/styles/dimension.js +0 -97
  181. package/dist/styles/dimension.js.map +0 -1
  182. package/dist/styles/display.d.ts +0 -37
  183. package/dist/styles/display.js +0 -67
  184. package/dist/styles/display.js.map +0 -1
  185. package/dist/styles/fade.d.ts +0 -15
  186. package/dist/styles/fade.js +0 -58
  187. package/dist/styles/fade.js.map +0 -1
  188. package/dist/styles/fill.d.ts +0 -42
  189. package/dist/styles/fill.js +0 -51
  190. package/dist/styles/fill.js.map +0 -1
  191. package/dist/styles/flow.d.ts +0 -16
  192. package/dist/styles/flow.js +0 -12
  193. package/dist/styles/flow.js.map +0 -1
  194. package/dist/styles/gap.d.ts +0 -31
  195. package/dist/styles/gap.js +0 -37
  196. package/dist/styles/gap.js.map +0 -1
  197. package/dist/styles/height.d.ts +0 -17
  198. package/dist/styles/height.js +0 -20
  199. package/dist/styles/height.js.map +0 -1
  200. package/dist/styles/index.d.ts +0 -2
  201. package/dist/styles/index.js +0 -9
  202. package/dist/styles/index.js.map +0 -1
  203. package/dist/styles/inset.d.ts +0 -52
  204. package/dist/styles/inset.js +0 -150
  205. package/dist/styles/inset.js.map +0 -1
  206. package/dist/styles/justify.d.ts +0 -15
  207. package/dist/styles/justify.js +0 -14
  208. package/dist/styles/justify.js.map +0 -1
  209. package/dist/styles/list.d.ts +0 -16
  210. package/dist/styles/list.js +0 -98
  211. package/dist/styles/list.js.map +0 -1
  212. package/dist/styles/margin.d.ts +0 -24
  213. package/dist/styles/margin.js +0 -104
  214. package/dist/styles/margin.js.map +0 -1
  215. package/dist/styles/outline.d.ts +0 -29
  216. package/dist/styles/outline.js +0 -65
  217. package/dist/styles/outline.js.map +0 -1
  218. package/dist/styles/padding.d.ts +0 -24
  219. package/dist/styles/padding.js +0 -104
  220. package/dist/styles/padding.js.map +0 -1
  221. package/dist/styles/predefined.d.ts +0 -73
  222. package/dist/styles/predefined.js +0 -241
  223. package/dist/styles/predefined.js.map +0 -1
  224. package/dist/styles/preset.d.ts +0 -47
  225. package/dist/styles/preset.js +0 -126
  226. package/dist/styles/preset.js.map +0 -1
  227. package/dist/styles/radius.d.ts +0 -14
  228. package/dist/styles/radius.js +0 -51
  229. package/dist/styles/radius.js.map +0 -1
  230. package/dist/styles/scrollbar.d.ts +0 -21
  231. package/dist/styles/scrollbar.js +0 -112
  232. package/dist/styles/scrollbar.js.map +0 -1
  233. package/dist/styles/shadow.d.ts +0 -14
  234. package/dist/styles/shadow.js +0 -24
  235. package/dist/styles/shadow.js.map +0 -1
  236. package/dist/styles/styledScrollbar.d.ts +0 -47
  237. package/dist/styles/styledScrollbar.js +0 -38
  238. package/dist/styles/styledScrollbar.js.map +0 -1
  239. package/dist/styles/transition.d.ts +0 -14
  240. package/dist/styles/transition.js +0 -158
  241. package/dist/styles/transition.js.map +0 -1
  242. package/dist/styles/types.d.ts +0 -498
  243. package/dist/styles/width.d.ts +0 -17
  244. package/dist/styles/width.js +0 -20
  245. package/dist/styles/width.js.map +0 -1
  246. package/dist/tasty.d.ts +0 -982
  247. package/dist/tasty.js +0 -206
  248. package/dist/tasty.js.map +0 -1
  249. package/dist/tokens/typography.d.ts +0 -19
  250. package/dist/tokens/typography.js +0 -237
  251. package/dist/tokens/typography.js.map +0 -1
  252. package/dist/types.d.ts +0 -184
  253. package/dist/utils/cache-wrapper.js +0 -26
  254. package/dist/utils/cache-wrapper.js.map +0 -1
  255. package/dist/utils/case-converter.js +0 -8
  256. package/dist/utils/case-converter.js.map +0 -1
  257. package/dist/utils/colors.d.ts +0 -5
  258. package/dist/utils/colors.js +0 -9
  259. package/dist/utils/colors.js.map +0 -1
  260. package/dist/utils/css-types.d.ts +0 -7
  261. package/dist/utils/dotize.d.ts +0 -26
  262. package/dist/utils/dotize.js +0 -122
  263. package/dist/utils/dotize.js.map +0 -1
  264. package/dist/utils/filter-base-props.d.ts +0 -15
  265. package/dist/utils/filter-base-props.js +0 -45
  266. package/dist/utils/filter-base-props.js.map +0 -1
  267. package/dist/utils/get-display-name.d.ts +0 -7
  268. package/dist/utils/get-display-name.js +0 -10
  269. package/dist/utils/get-display-name.js.map +0 -1
  270. package/dist/utils/hsl-to-rgb.js +0 -38
  271. package/dist/utils/hsl-to-rgb.js.map +0 -1
  272. package/dist/utils/is-dev-env.js +0 -19
  273. package/dist/utils/is-dev-env.js.map +0 -1
  274. package/dist/utils/is-valid-element-type.js +0 -15
  275. package/dist/utils/is-valid-element-type.js.map +0 -1
  276. package/dist/utils/merge-styles.js.map +0 -1
  277. package/dist/utils/mod-attrs.d.ts +0 -8
  278. package/dist/utils/mod-attrs.js +0 -21
  279. package/dist/utils/mod-attrs.js.map +0 -1
  280. package/dist/utils/okhsl-to-rgb.js +0 -296
  281. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  282. package/dist/utils/process-tokens.d.ts +0 -31
  283. package/dist/utils/process-tokens.js +0 -171
  284. package/dist/utils/process-tokens.js.map +0 -1
  285. package/dist/utils/resolve-recipes.d.ts +0 -17
  286. package/dist/utils/resolve-recipes.js.map +0 -1
  287. package/dist/utils/string.js +0 -8
  288. package/dist/utils/string.js.map +0 -1
  289. package/dist/utils/styles.d.ts +0 -178
  290. package/dist/utils/styles.js +0 -590
  291. package/dist/utils/styles.js.map +0 -1
  292. package/dist/utils/typography.d.ts +0 -36
  293. package/dist/utils/typography.js +0 -53
  294. package/dist/utils/typography.js.map +0 -1
  295. package/dist/utils/warnings.d.ts +0 -16
  296. package/dist/utils/warnings.js +0 -16
  297. package/dist/utils/warnings.js.map +0 -1
  298. package/dist/zero/css-writer.d.ts +0 -45
  299. package/dist/zero/css-writer.js +0 -74
  300. package/dist/zero/css-writer.js.map +0 -1
  301. package/dist/zero/extractor.d.ts +0 -24
  302. package/dist/zero/extractor.js +0 -150
  303. package/dist/zero/extractor.js.map +0 -1
@@ -0,0 +1,44 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ //#region src/ssr/async-storage.ts
3
+ /**
4
+ * AsyncLocalStorage integration for SSR collector discovery.
5
+ *
6
+ * Used by Astro middleware and generic framework integrations where
7
+ * the library cannot wrap the React tree with a context provider.
8
+ * The middleware calls runWithCollector() around the render, and
9
+ * useStyles() calls getSSRCollector() to find it.
10
+ *
11
+ * Uses globalThis to ensure the AsyncLocalStorage instance is shared
12
+ * across module instances — frameworks like Astro may load middleware
13
+ * and page components from separate module graphs.
14
+ *
15
+ * This module imports from 'node:async_hooks' — it must be excluded
16
+ * from client bundles via the build configuration.
17
+ */
18
+ const ALS_KEY = "__tasty_ssr_als__";
19
+ function getSharedStorage() {
20
+ const g = globalThis;
21
+ if (!g[ALS_KEY]) g[ALS_KEY] = new AsyncLocalStorage();
22
+ return g[ALS_KEY];
23
+ }
24
+ /**
25
+ * Run a function with a ServerStyleCollector bound to the current
26
+ * async context. All useStyles() calls within `fn` (and any async
27
+ * continuations) will find this collector via getSSRCollector().
28
+ */
29
+ function runWithCollector(collector, fn) {
30
+ return getSharedStorage().run(collector, fn);
31
+ }
32
+ /**
33
+ * Retrieve the ServerStyleCollector bound to the current async context.
34
+ * Returns null when called outside of runWithCollector() or on the client.
35
+ */
36
+ function getSSRCollector() {
37
+ const storage = getSharedStorage();
38
+ if (typeof storage?.getStore !== "function") return null;
39
+ return storage.getStore() ?? null;
40
+ }
41
+ //#endregion
42
+ export { runWithCollector as n, getSSRCollector as t };
43
+
44
+ //# sourceMappingURL=async-storage-B7_o6FKt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-storage-B7_o6FKt.js","names":[],"sources":["../src/ssr/async-storage.ts"],"sourcesContent":["/**\n * AsyncLocalStorage integration for SSR collector discovery.\n *\n * Used by Astro middleware and generic framework integrations where\n * the library cannot wrap the React tree with a context provider.\n * The middleware calls runWithCollector() around the render, and\n * useStyles() calls getSSRCollector() to find it.\n *\n * Uses globalThis to ensure the AsyncLocalStorage instance is shared\n * across module instances — frameworks like Astro may load middleware\n * and page components from separate module graphs.\n *\n * This module imports from 'node:async_hooks' — it must be excluded\n * from client bundles via the build configuration.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport type { ServerStyleCollector } from './collector';\n\nconst ALS_KEY = '__tasty_ssr_als__';\n\nfunction getSharedStorage(): AsyncLocalStorage<ServerStyleCollector> {\n const g = globalThis as Record<string, unknown>;\n if (!g[ALS_KEY]) {\n g[ALS_KEY] = new AsyncLocalStorage<ServerStyleCollector>();\n }\n return g[ALS_KEY] as AsyncLocalStorage<ServerStyleCollector>;\n}\n\n/**\n * Run a function with a ServerStyleCollector bound to the current\n * async context. All useStyles() calls within `fn` (and any async\n * continuations) will find this collector via getSSRCollector().\n */\nexport function runWithCollector<T>(\n collector: ServerStyleCollector,\n fn: () => T,\n): T {\n return getSharedStorage().run(collector, fn);\n}\n\n/**\n * Retrieve the ServerStyleCollector bound to the current async context.\n * Returns null when called outside of runWithCollector() or on the client.\n */\nexport function getSSRCollector(): ServerStyleCollector | null {\n const storage = getSharedStorage();\n if (typeof storage?.getStore !== 'function') return null;\n return storage.getStore() ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,UAAU;AAEhB,SAAS,mBAA4D;CACnE,MAAM,IAAI;CACV,IAAI,CAAC,EAAE,UACL,EAAE,WAAW,IAAI,mBAAyC;CAE5D,OAAO,EAAE;;;;;;;AAQX,SAAgB,iBACd,WACA,IACG;CACH,OAAO,kBAAkB,CAAC,IAAI,WAAW,GAAG;;;;;;AAO9C,SAAgB,kBAA+C;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,OAAO,SAAS,aAAa,YAAY,OAAO;CACpD,OAAO,QAAQ,UAAU,IAAI"}
@@ -0,0 +1,243 @@
1
+ import { F as fontFaceContentHash, I as formatFontFaceRule, M as formatCounterStyleRule, S as renderStyles, a as getGlobalCounterStyle, d as getNamePrefix, dt as makeCounterStyleName, ft as makeKeyframeName, gt as hashString, i as getGlobalConfigTokens, mt as validateNamePrefix, o as getGlobalFontFace, r as getEffectiveProperties, u as getGlobalStyles, ut as makeClassName } from "./config-BBiyxMCe.js";
2
+ import { n as formatPropertyCSS, t as formatRules } from "./format-rules-BSjeH4Z7.js";
3
+ import { t as formatGlobalRules } from "./format-global-rules-Dbc_1tc3.js";
4
+ //#region src/ssr/collector.ts
5
+ /**
6
+ * ServerStyleCollector — server-safe style collector for SSR.
7
+ *
8
+ * Accumulates CSS rules and cache metadata during server rendering.
9
+ * This is the server-side counterpart to StyleInjector: it allocates
10
+ * hash-based class names using the configured `namePrefix` (defaults
11
+ * to `'t'`), formats CSS rules into text, and tracks rendered class
12
+ * names for lightweight client transfer.
13
+ *
14
+ * One instance is created per HTTP request. Concurrent requests
15
+ * each get their own collector (via AsyncLocalStorage or React context).
16
+ */
17
+ var ServerStyleCollector = class {
18
+ chunks = /* @__PURE__ */ new Map();
19
+ cacheKeyToClassName = /* @__PURE__ */ new Map();
20
+ flushedKeys = /* @__PURE__ */ new Set();
21
+ propertyRules = /* @__PURE__ */ new Map();
22
+ flushedPropertyKeys = /* @__PURE__ */ new Set();
23
+ keyframeRules = /* @__PURE__ */ new Map();
24
+ flushedKeyframeKeys = /* @__PURE__ */ new Set();
25
+ globalStyles = /* @__PURE__ */ new Map();
26
+ flushedGlobalKeys = /* @__PURE__ */ new Set();
27
+ rawCSS = /* @__PURE__ */ new Map();
28
+ flushedRawKeys = /* @__PURE__ */ new Set();
29
+ fontFaceRules = /* @__PURE__ */ new Map();
30
+ flushedFontFaceKeys = /* @__PURE__ */ new Set();
31
+ counterStyleRules = /* @__PURE__ */ new Map();
32
+ flushedCounterStyleKeys = /* @__PURE__ */ new Set();
33
+ keyframesCounter = 0;
34
+ counterStyleCounter = 0;
35
+ internalsCollected = false;
36
+ namePrefix;
37
+ /**
38
+ * @param namePrefix - Optional override for the configured prefix.
39
+ * Defaults to the value from `configure({ namePrefix })` (or `'t'`).
40
+ * Pass an explicit prefix when constructing a collector outside the
41
+ * normal configure() lifecycle (e.g. in tests). Validated eagerly
42
+ * so misconfiguration fails before any CSS is collected.
43
+ */
44
+ constructor(namePrefix) {
45
+ if (namePrefix !== void 0) validateNamePrefix(namePrefix);
46
+ this.namePrefix = namePrefix ?? getNamePrefix();
47
+ }
48
+ generateClassName(cacheKey) {
49
+ return makeClassName(this.namePrefix, hashString(cacheKey));
50
+ }
51
+ /**
52
+ * Collect internal @property rules and :root token defaults.
53
+ * Mirrors markStylesGenerated() from the client-side injector.
54
+ * Called automatically on first chunk collection; idempotent.
55
+ *
56
+ * Internals are always emitted here — the RSC path deliberately
57
+ * defers to SSR so that tokens appear exactly once per page in
58
+ * <style data-tasty-ssr> (avoiding duplication of large token sets).
59
+ */
60
+ collectInternals() {
61
+ if (this.internalsCollected) return;
62
+ this.internalsCollected = true;
63
+ for (const [token, definition] of Object.entries(getEffectiveProperties())) {
64
+ const css = formatPropertyCSS(token, definition);
65
+ if (css) this.collectProperty(`__prop:${token}`, css);
66
+ }
67
+ const tokenStyles = getGlobalConfigTokens();
68
+ if (tokenStyles && Object.keys(tokenStyles).length > 0) {
69
+ const tokenRules = renderStyles(tokenStyles, ":root");
70
+ if (tokenRules.length > 0) {
71
+ const css = formatGlobalRules(tokenRules);
72
+ if (css) this.collectGlobalStyles("__global:tokens", css);
73
+ }
74
+ }
75
+ const globalFF = getGlobalFontFace();
76
+ if (globalFF) for (const [family, input] of Object.entries(globalFF)) {
77
+ const descriptors = Array.isArray(input) ? input : [input];
78
+ for (const desc of descriptors) {
79
+ const hash = fontFaceContentHash(family, desc);
80
+ const css = formatFontFaceRule(family, desc);
81
+ this.collectFontFace(hash, css);
82
+ }
83
+ }
84
+ const globalCS = getGlobalCounterStyle();
85
+ if (globalCS) for (const [name, descriptors] of Object.entries(globalCS)) {
86
+ const css = formatCounterStyleRule(name, descriptors);
87
+ this.collectCounterStyle(name, css);
88
+ }
89
+ const globalStyles = getGlobalStyles();
90
+ if (globalStyles) {
91
+ for (const [selector, styles] of Object.entries(globalStyles)) if (Object.keys(styles).length > 0) {
92
+ const rules = renderStyles(styles, selector);
93
+ if (rules.length > 0) {
94
+ const css = formatGlobalRules(rules);
95
+ if (css) this.collectGlobalStyles(`__global:styles:${selector}`, css);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ /**
101
+ * Allocate a className for a cache key, server-side.
102
+ * Mirrors StyleInjector.allocateClassName but without DOM access.
103
+ */
104
+ allocateClassName(cacheKey) {
105
+ const existing = this.cacheKeyToClassName.get(cacheKey);
106
+ if (existing) return {
107
+ className: existing,
108
+ isNewAllocation: false
109
+ };
110
+ const className = this.generateClassName(cacheKey);
111
+ this.cacheKeyToClassName.set(cacheKey, className);
112
+ return {
113
+ className,
114
+ isNewAllocation: true
115
+ };
116
+ }
117
+ /**
118
+ * Record CSS rules for a chunk.
119
+ * Called by useStyles during server render.
120
+ */
121
+ collectChunk(cacheKey, className, rules) {
122
+ if (this.chunks.has(cacheKey)) return;
123
+ const css = formatRules(rules, className);
124
+ if (css) this.chunks.set(cacheKey, css);
125
+ }
126
+ /**
127
+ * Record a @property rule. Deduplicated by name.
128
+ */
129
+ collectProperty(name, css) {
130
+ if (!this.propertyRules.has(name)) this.propertyRules.set(name, css);
131
+ }
132
+ /**
133
+ * Record a @keyframes rule. Deduplicated by name.
134
+ */
135
+ collectKeyframes(name, css) {
136
+ if (!this.keyframeRules.has(name)) this.keyframeRules.set(name, css);
137
+ }
138
+ /**
139
+ * Allocate a keyframe name for SSR. Uses provided name or generates one.
140
+ */
141
+ allocateKeyframeName(providedName) {
142
+ return providedName ?? makeKeyframeName(this.namePrefix, String(this.keyframesCounter++));
143
+ }
144
+ /**
145
+ * Record a @font-face rule. Deduplicated by key (content hash).
146
+ */
147
+ collectFontFace(key, css) {
148
+ if (!this.fontFaceRules.has(key)) this.fontFaceRules.set(key, css);
149
+ }
150
+ /**
151
+ * Record a @counter-style rule. Deduplicated by name.
152
+ */
153
+ collectCounterStyle(name, css) {
154
+ if (!this.counterStyleRules.has(name)) this.counterStyleRules.set(name, css);
155
+ }
156
+ /**
157
+ * Allocate a counter-style name for SSR. Uses provided name or generates one.
158
+ */
159
+ allocateCounterStyleName(providedName) {
160
+ return providedName ?? makeCounterStyleName(this.namePrefix, String(this.counterStyleCounter++));
161
+ }
162
+ /**
163
+ * Record global styles (from useGlobalStyles). Deduplicated by key.
164
+ */
165
+ collectGlobalStyles(key, css) {
166
+ if (!this.globalStyles.has(key)) this.globalStyles.set(key, css);
167
+ }
168
+ /**
169
+ * Record raw CSS text (from useRawCSS). Deduplicated by key.
170
+ */
171
+ collectRawCSS(key, css) {
172
+ if (!this.rawCSS.has(key)) this.rawCSS.set(key, css);
173
+ }
174
+ /**
175
+ * Extract all CSS collected so far as a single string.
176
+ * Includes @property and @keyframes rules.
177
+ * Used for non-streaming SSR (renderToString).
178
+ */
179
+ getCSS() {
180
+ const parts = [];
181
+ for (const css of this.propertyRules.values()) parts.push(css);
182
+ for (const css of this.fontFaceRules.values()) parts.push(css);
183
+ for (const css of this.counterStyleRules.values()) parts.push(css);
184
+ for (const css of this.rawCSS.values()) parts.push(css);
185
+ for (const css of this.globalStyles.values()) parts.push(css);
186
+ for (const css of this.chunks.values()) parts.push(css);
187
+ for (const css of this.keyframeRules.values()) parts.push(css);
188
+ return parts.join("\n");
189
+ }
190
+ /**
191
+ * Flush only newly collected CSS since the last flush.
192
+ * Used for streaming SSR (renderToPipeableStream + useServerInsertedHTML).
193
+ */
194
+ flushCSS() {
195
+ const parts = [];
196
+ for (const [name, css] of this.propertyRules) if (!this.flushedPropertyKeys.has(name)) {
197
+ parts.push(css);
198
+ this.flushedPropertyKeys.add(name);
199
+ }
200
+ for (const [key, css] of this.fontFaceRules) if (!this.flushedFontFaceKeys.has(key)) {
201
+ parts.push(css);
202
+ this.flushedFontFaceKeys.add(key);
203
+ }
204
+ for (const [key, css] of this.counterStyleRules) if (!this.flushedCounterStyleKeys.has(key)) {
205
+ parts.push(css);
206
+ this.flushedCounterStyleKeys.add(key);
207
+ }
208
+ for (const [key, css] of this.rawCSS) if (!this.flushedRawKeys.has(key)) {
209
+ parts.push(css);
210
+ this.flushedRawKeys.add(key);
211
+ }
212
+ for (const [key, css] of this.globalStyles) if (!this.flushedGlobalKeys.has(key)) {
213
+ parts.push(css);
214
+ this.flushedGlobalKeys.add(key);
215
+ }
216
+ for (const [key, css] of this.chunks) if (!this.flushedKeys.has(key)) {
217
+ parts.push(css);
218
+ this.flushedKeys.add(key);
219
+ }
220
+ for (const [name, css] of this.keyframeRules) if (!this.flushedKeyframeKeys.has(name)) {
221
+ parts.push(css);
222
+ this.flushedKeyframeKeys.add(name);
223
+ }
224
+ return parts.join("\n");
225
+ }
226
+ flushedClassNames = /* @__PURE__ */ new Set();
227
+ /**
228
+ * Return class names rendered since the last call (for streaming).
229
+ * Used to emit lightweight class-list scripts for client hydration.
230
+ */
231
+ getRenderedClassNames() {
232
+ const names = [];
233
+ for (const className of this.cacheKeyToClassName.values()) if (!this.flushedClassNames.has(className)) {
234
+ this.flushedClassNames.add(className);
235
+ names.push(className);
236
+ }
237
+ return names;
238
+ }
239
+ };
240
+ //#endregion
241
+ export { ServerStyleCollector as t };
242
+
243
+ //# sourceMappingURL=collector-C-keQH9m.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector-C-keQH9m.js","names":[],"sources":["../src/ssr/collector.ts"],"sourcesContent":["/**\n * ServerStyleCollector — server-safe style collector for SSR.\n *\n * Accumulates CSS rules and cache metadata during server rendering.\n * This is the server-side counterpart to StyleInjector: it allocates\n * hash-based class names using the configured `namePrefix` (defaults\n * to `'t'`), formats CSS rules into text, and tracks rendered class\n * names for lightweight client transfer.\n *\n * One instance is created per HTTP request. Concurrent requests\n * each get their own collector (via AsyncLocalStorage or React context).\n */\n\nimport {\n getEffectiveProperties,\n getGlobalStyles,\n getGlobalCounterStyle,\n getGlobalFontFace,\n getGlobalConfigTokens,\n getNamePrefix,\n} from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport { renderStyles } from '../pipeline';\nimport type { StyleResult } from '../pipeline';\nimport { hashString } from '../utils/hash';\nimport {\n makeClassName,\n makeCounterStyleName,\n makeKeyframeName,\n validateNamePrefix,\n} from '../utils/name-prefix';\nimport { formatPropertyCSS } from './format-property';\nimport { formatGlobalRules } from './format-global-rules';\nimport { formatRules } from './format-rules';\n\nexport class ServerStyleCollector {\n private chunks = new Map<string, string>();\n private cacheKeyToClassName = new Map<string, string>();\n private flushedKeys = new Set<string>();\n private propertyRules = new Map<string, string>();\n private flushedPropertyKeys = new Set<string>();\n private keyframeRules = new Map<string, string>();\n private flushedKeyframeKeys = new Set<string>();\n private globalStyles = new Map<string, string>();\n private flushedGlobalKeys = new Set<string>();\n private rawCSS = new Map<string, string>();\n private flushedRawKeys = new Set<string>();\n private fontFaceRules = new Map<string, string>();\n private flushedFontFaceKeys = new Set<string>();\n private counterStyleRules = new Map<string, string>();\n private flushedCounterStyleKeys = new Set<string>();\n private keyframesCounter = 0;\n private counterStyleCounter = 0;\n private internalsCollected = false;\n private namePrefix: string;\n\n /**\n * @param namePrefix - Optional override for the configured prefix.\n * Defaults to the value from `configure({ namePrefix })` (or `'t'`).\n * Pass an explicit prefix when constructing a collector outside the\n * normal configure() lifecycle (e.g. in tests). Validated eagerly\n * so misconfiguration fails before any CSS is collected.\n */\n constructor(namePrefix?: string) {\n if (namePrefix !== undefined) {\n validateNamePrefix(namePrefix);\n }\n this.namePrefix = namePrefix ?? getNamePrefix();\n }\n\n private generateClassName(cacheKey: string): string {\n return makeClassName(this.namePrefix, hashString(cacheKey));\n }\n\n /**\n * Collect internal @property rules and :root token defaults.\n * Mirrors markStylesGenerated() from the client-side injector.\n * Called automatically on first chunk collection; idempotent.\n *\n * Internals are always emitted here — the RSC path deliberately\n * defers to SSR so that tokens appear exactly once per page in\n * <style data-tasty-ssr> (avoiding duplication of large token sets).\n */\n collectInternals(): void {\n if (this.internalsCollected) return;\n this.internalsCollected = true;\n\n for (const [token, definition] of Object.entries(\n getEffectiveProperties(),\n )) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n this.collectProperty(`__prop:${token}`, css);\n }\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) {\n this.collectGlobalStyles('__global:tokens', css);\n }\n }\n }\n\n const globalFF = getGlobalFontFace();\n if (globalFF) {\n for (const [family, input] of Object.entries(globalFF)) {\n const descriptors = Array.isArray(input) ? input : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n this.collectFontFace(hash, css);\n }\n }\n }\n\n const globalCS = getGlobalCounterStyle();\n if (globalCS) {\n for (const [name, descriptors] of Object.entries(globalCS)) {\n const css = formatCounterStyleRule(name, descriptors);\n this.collectCounterStyle(name, css);\n }\n }\n\n const globalStyles = getGlobalStyles();\n if (globalStyles) {\n for (const [selector, styles] of Object.entries(globalStyles)) {\n if (Object.keys(styles).length > 0) {\n const rules = renderStyles(styles, selector) as StyleResult[];\n if (rules.length > 0) {\n const css = formatGlobalRules(rules);\n if (css) {\n this.collectGlobalStyles(`__global:styles:${selector}`, css);\n }\n }\n }\n }\n }\n }\n\n /**\n * Allocate a className for a cache key, server-side.\n * Mirrors StyleInjector.allocateClassName but without DOM access.\n */\n allocateClassName(cacheKey: string): {\n className: string;\n isNewAllocation: boolean;\n } {\n const existing = this.cacheKeyToClassName.get(cacheKey);\n if (existing) {\n return { className: existing, isNewAllocation: false };\n }\n\n const className = this.generateClassName(cacheKey);\n this.cacheKeyToClassName.set(cacheKey, className);\n\n return { className, isNewAllocation: true };\n }\n\n /**\n * Record CSS rules for a chunk.\n * Called by useStyles during server render.\n */\n collectChunk(\n cacheKey: string,\n className: string,\n rules: StyleResult[],\n ): void {\n if (this.chunks.has(cacheKey)) return;\n const css = formatRules(rules, className);\n if (css) {\n this.chunks.set(cacheKey, css);\n }\n }\n\n /**\n * Record a @property rule. Deduplicated by name.\n */\n collectProperty(name: string, css: string): void {\n if (!this.propertyRules.has(name)) {\n this.propertyRules.set(name, css);\n }\n }\n\n /**\n * Record a @keyframes rule. Deduplicated by name.\n */\n collectKeyframes(name: string, css: string): void {\n if (!this.keyframeRules.has(name)) {\n this.keyframeRules.set(name, css);\n }\n }\n\n /**\n * Allocate a keyframe name for SSR. Uses provided name or generates one.\n */\n allocateKeyframeName(providedName?: string): string {\n return (\n providedName ??\n makeKeyframeName(this.namePrefix, String(this.keyframesCounter++))\n );\n }\n\n /**\n * Record a @font-face rule. Deduplicated by key (content hash).\n */\n collectFontFace(key: string, css: string): void {\n if (!this.fontFaceRules.has(key)) {\n this.fontFaceRules.set(key, css);\n }\n }\n\n /**\n * Record a @counter-style rule. Deduplicated by name.\n */\n collectCounterStyle(name: string, css: string): void {\n if (!this.counterStyleRules.has(name)) {\n this.counterStyleRules.set(name, css);\n }\n }\n\n /**\n * Allocate a counter-style name for SSR. Uses provided name or generates one.\n */\n allocateCounterStyleName(providedName?: string): string {\n return (\n providedName ??\n makeCounterStyleName(this.namePrefix, String(this.counterStyleCounter++))\n );\n }\n\n /**\n * Record global styles (from useGlobalStyles). Deduplicated by key.\n */\n collectGlobalStyles(key: string, css: string): void {\n if (!this.globalStyles.has(key)) {\n this.globalStyles.set(key, css);\n }\n }\n\n /**\n * Record raw CSS text (from useRawCSS). Deduplicated by key.\n */\n collectRawCSS(key: string, css: string): void {\n if (!this.rawCSS.has(key)) {\n this.rawCSS.set(key, css);\n }\n }\n\n /**\n * Extract all CSS collected so far as a single string.\n * Includes @property and @keyframes rules.\n * Used for non-streaming SSR (renderToString).\n */\n getCSS(): string {\n const parts: string[] = [];\n\n for (const css of this.propertyRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.fontFaceRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.counterStyleRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.rawCSS.values()) {\n parts.push(css);\n }\n\n for (const css of this.globalStyles.values()) {\n parts.push(css);\n }\n\n for (const css of this.chunks.values()) {\n parts.push(css);\n }\n\n for (const css of this.keyframeRules.values()) {\n parts.push(css);\n }\n\n return parts.join('\\n');\n }\n\n /**\n * Flush only newly collected CSS since the last flush.\n * Used for streaming SSR (renderToPipeableStream + useServerInsertedHTML).\n */\n flushCSS(): string {\n const parts: string[] = [];\n\n for (const [name, css] of this.propertyRules) {\n if (!this.flushedPropertyKeys.has(name)) {\n parts.push(css);\n this.flushedPropertyKeys.add(name);\n }\n }\n\n for (const [key, css] of this.fontFaceRules) {\n if (!this.flushedFontFaceKeys.has(key)) {\n parts.push(css);\n this.flushedFontFaceKeys.add(key);\n }\n }\n\n for (const [key, css] of this.counterStyleRules) {\n if (!this.flushedCounterStyleKeys.has(key)) {\n parts.push(css);\n this.flushedCounterStyleKeys.add(key);\n }\n }\n\n for (const [key, css] of this.rawCSS) {\n if (!this.flushedRawKeys.has(key)) {\n parts.push(css);\n this.flushedRawKeys.add(key);\n }\n }\n\n for (const [key, css] of this.globalStyles) {\n if (!this.flushedGlobalKeys.has(key)) {\n parts.push(css);\n this.flushedGlobalKeys.add(key);\n }\n }\n\n for (const [key, css] of this.chunks) {\n if (!this.flushedKeys.has(key)) {\n parts.push(css);\n this.flushedKeys.add(key);\n }\n }\n\n for (const [name, css] of this.keyframeRules) {\n if (!this.flushedKeyframeKeys.has(name)) {\n parts.push(css);\n this.flushedKeyframeKeys.add(name);\n }\n }\n\n return parts.join('\\n');\n }\n\n private flushedClassNames = new Set<string>();\n\n /**\n * Return class names rendered since the last call (for streaming).\n * Used to emit lightweight class-list scripts for client hydration.\n */\n getRenderedClassNames(): string[] {\n const names: string[] = [];\n for (const className of this.cacheKeyToClassName.values()) {\n if (!this.flushedClassNames.has(className)) {\n this.flushedClassNames.add(className);\n names.push(className);\n }\n }\n return names;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;CAChC,yBAAiB,IAAI,KAAqB;CAC1C,sCAA8B,IAAI,KAAqB;CACvD,8BAAsB,IAAI,KAAa;CACvC,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,+BAAuB,IAAI,KAAqB;CAChD,oCAA4B,IAAI,KAAa;CAC7C,yBAAiB,IAAI,KAAqB;CAC1C,iCAAyB,IAAI,KAAa;CAC1C,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,oCAA4B,IAAI,KAAqB;CACrD,0CAAkC,IAAI,KAAa;CACnD,mBAA2B;CAC3B,sBAA8B;CAC9B,qBAA6B;CAC7B;;;;;;;;CASA,YAAY,YAAqB;EAC/B,IAAI,eAAe,KAAA,GACjB,mBAAmB,WAAW;EAEhC,KAAK,aAAa,cAAc,eAAe;;CAGjD,kBAA0B,UAA0B;EAClD,OAAO,cAAc,KAAK,YAAY,WAAW,SAAS,CAAC;;;;;;;;;;;CAY7D,mBAAyB;EACvB,IAAI,KAAK,oBAAoB;EAC7B,KAAK,qBAAqB;EAE1B,KAAK,MAAM,CAAC,OAAO,eAAe,OAAO,QACvC,wBAAwB,CACzB,EAAE;GACD,MAAM,MAAM,kBA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AAK,kBAAkB,IAAI,IAAI;;EAInC,KAAK,MAAM,CAAC,KAAK,QAAQ,KAAK,QAC5B,IAAI,CAAC,KAAK,YAAY,IAAI,IAAI,EAAE;GAC9B,MAAM,KAAK,IAAI;GACf,KAAK,YAAY,IAAI,IAAI;;EAI7B,KAAK,MAAM,CAAC,MAAM,QAAQ,KAAK,eAC7B,IAAI,CAAC,KAAK,oBAAoB,IAAI,KAAK,EAAE;GACvC,MAAM,KAAK,IAAI;GACf,KAAK,oBAAoB,IAAI,KAAK;;EAItC,OAAO,MAAM,KAAK,KAAK;;CAGzB,oCAA4B,IAAI,KAAa;;;;;CAM7C,wBAAkC;EAChC,MAAM,QAAkB,EAAE;EAC1B,KAAK,MAAM,aAAa,KAAK,oBAAoB,QAAQ,EACvD,IAAI,CAAC,KAAK,kBAAkB,IAAI,UAAU,EAAE;GAC1C,KAAK,kBAAkB,IAAI,UAAU;GACrC,MAAM,KAAK,UAAU;;EAGzB,OAAO"}
@@ -0,0 +1,108 @@
1
+ import { n as StyleResult } from "./index-tcHuMPFt.js";
2
+
3
+ //#region src/ssr/collector.d.ts
4
+ declare class ServerStyleCollector {
5
+ private chunks;
6
+ private cacheKeyToClassName;
7
+ private flushedKeys;
8
+ private propertyRules;
9
+ private flushedPropertyKeys;
10
+ private keyframeRules;
11
+ private flushedKeyframeKeys;
12
+ private globalStyles;
13
+ private flushedGlobalKeys;
14
+ private rawCSS;
15
+ private flushedRawKeys;
16
+ private fontFaceRules;
17
+ private flushedFontFaceKeys;
18
+ private counterStyleRules;
19
+ private flushedCounterStyleKeys;
20
+ private keyframesCounter;
21
+ private counterStyleCounter;
22
+ private internalsCollected;
23
+ private namePrefix;
24
+ /**
25
+ * @param namePrefix - Optional override for the configured prefix.
26
+ * Defaults to the value from `configure({ namePrefix })` (or `'t'`).
27
+ * Pass an explicit prefix when constructing a collector outside the
28
+ * normal configure() lifecycle (e.g. in tests). Validated eagerly
29
+ * so misconfiguration fails before any CSS is collected.
30
+ */
31
+ constructor(namePrefix?: string);
32
+ private generateClassName;
33
+ /**
34
+ * Collect internal @property rules and :root token defaults.
35
+ * Mirrors markStylesGenerated() from the client-side injector.
36
+ * Called automatically on first chunk collection; idempotent.
37
+ *
38
+ * Internals are always emitted here — the RSC path deliberately
39
+ * defers to SSR so that tokens appear exactly once per page in
40
+ * <style data-tasty-ssr> (avoiding duplication of large token sets).
41
+ */
42
+ collectInternals(): void;
43
+ /**
44
+ * Allocate a className for a cache key, server-side.
45
+ * Mirrors StyleInjector.allocateClassName but without DOM access.
46
+ */
47
+ allocateClassName(cacheKey: string): {
48
+ className: string;
49
+ isNewAllocation: boolean;
50
+ };
51
+ /**
52
+ * Record CSS rules for a chunk.
53
+ * Called by useStyles during server render.
54
+ */
55
+ collectChunk(cacheKey: string, className: string, rules: StyleResult[]): void;
56
+ /**
57
+ * Record a @property rule. Deduplicated by name.
58
+ */
59
+ collectProperty(name: string, css: string): void;
60
+ /**
61
+ * Record a @keyframes rule. Deduplicated by name.
62
+ */
63
+ collectKeyframes(name: string, css: string): void;
64
+ /**
65
+ * Allocate a keyframe name for SSR. Uses provided name or generates one.
66
+ */
67
+ allocateKeyframeName(providedName?: string): string;
68
+ /**
69
+ * Record a @font-face rule. Deduplicated by key (content hash).
70
+ */
71
+ collectFontFace(key: string, css: string): void;
72
+ /**
73
+ * Record a @counter-style rule. Deduplicated by name.
74
+ */
75
+ collectCounterStyle(name: string, css: string): void;
76
+ /**
77
+ * Allocate a counter-style name for SSR. Uses provided name or generates one.
78
+ */
79
+ allocateCounterStyleName(providedName?: string): string;
80
+ /**
81
+ * Record global styles (from useGlobalStyles). Deduplicated by key.
82
+ */
83
+ collectGlobalStyles(key: string, css: string): void;
84
+ /**
85
+ * Record raw CSS text (from useRawCSS). Deduplicated by key.
86
+ */
87
+ collectRawCSS(key: string, css: string): void;
88
+ /**
89
+ * Extract all CSS collected so far as a single string.
90
+ * Includes @property and @keyframes rules.
91
+ * Used for non-streaming SSR (renderToString).
92
+ */
93
+ getCSS(): string;
94
+ /**
95
+ * Flush only newly collected CSS since the last flush.
96
+ * Used for streaming SSR (renderToPipeableStream + useServerInsertedHTML).
97
+ */
98
+ flushCSS(): string;
99
+ private flushedClassNames;
100
+ /**
101
+ * Return class names rendered since the last call (for streaming).
102
+ * Used to emit lightweight class-list scripts for client hydration.
103
+ */
104
+ getRenderedClassNames(): string[];
105
+ }
106
+ //#endregion
107
+ export { ServerStyleCollector as t };
108
+ //# sourceMappingURL=collector-osfWTeRd.d.ts.map