@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.dc62ea3

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 (365) hide show
  1. package/README.md +196 -140
  2. package/dist/astro-CeYENy2x.js +301 -0
  3. package/dist/astro-CeYENy2x.js.map +1 -0
  4. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +16 -6
  5. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  6. package/dist/babel-DWCsafYw.d.ts +83 -0
  7. package/dist/collector-B3OsM252.js +327 -0
  8. package/dist/collector-B3OsM252.js.map +1 -0
  9. package/dist/collector-BTVXj2hS.d.ts +163 -0
  10. package/dist/config-B3gPdCqd.js +12421 -0
  11. package/dist/config-B3gPdCqd.js.map +1 -0
  12. package/dist/config-LfIDmVHx.d.ts +1363 -0
  13. package/dist/context-CA8YKeMn.js +24 -0
  14. package/dist/context-CA8YKeMn.js.map +1 -0
  15. package/dist/core/index.d.ts +5 -33
  16. package/dist/core/index.js +6 -26
  17. package/dist/core-DGm0CFHP.js +1732 -0
  18. package/dist/core-DGm0CFHP.js.map +1 -0
  19. package/dist/css-resources-Cyl_axbI.js +149 -0
  20. package/dist/css-resources-Cyl_axbI.js.map +1 -0
  21. package/dist/{zero/extractor.js → css-writer-Bgowobbx.js} +148 -24
  22. package/dist/css-writer-Bgowobbx.js.map +1 -0
  23. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
  24. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  25. package/dist/{ssr/format-rules.js → format-rules-XRw9u7d4.js} +33 -2
  26. package/dist/format-rules-XRw9u7d4.js.map +1 -0
  27. package/dist/hydrate-CNOmZprz.js +37 -0
  28. package/dist/hydrate-CNOmZprz.js.map +1 -0
  29. package/dist/index-Bm9ltvdH.d.ts +1933 -0
  30. package/dist/index-BmogEzTo.d.ts +1575 -0
  31. package/dist/index.d.ts +5 -50
  32. package/dist/index.js +922 -35
  33. package/dist/index.js.map +1 -0
  34. package/dist/keyframes-DE-OE76F.js +535 -0
  35. package/dist/keyframes-DE-OE76F.js.map +1 -0
  36. package/dist/{utils/merge-styles.d.ts → merge-styles-BcLl1u_d.d.ts} +3 -3
  37. package/dist/{utils/merge-styles.js → merge-styles-DuoZEsm9.js} +3 -4
  38. package/dist/merge-styles-DuoZEsm9.js.map +1 -0
  39. package/dist/{utils/resolve-recipes.js → resolve-recipes-H9NqOQuP.js} +4 -6
  40. package/dist/resolve-recipes-H9NqOQuP.js.map +1 -0
  41. package/dist/ssr/astro-client.js +19 -0
  42. package/dist/ssr/astro-client.js.map +1 -0
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +18 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +19 -0
  53. package/dist/ssr/astro-middleware.js +19 -0
  54. package/dist/ssr/astro-middleware.js.map +1 -0
  55. package/dist/ssr/astro.d.ts +117 -11
  56. package/dist/ssr/astro.js +2 -64
  57. package/dist/ssr/index.d.ts +37 -5
  58. package/dist/ssr/index.js +6 -7
  59. package/dist/ssr/index.js.map +1 -1
  60. package/dist/ssr/next-config.d.ts +66 -0
  61. package/dist/ssr/next-config.js +115 -0
  62. package/dist/ssr/next-config.js.map +1 -0
  63. package/dist/ssr/next.d.ts +14 -7
  64. package/dist/ssr/next.js +38 -16
  65. package/dist/ssr/next.js.map +1 -1
  66. package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
  67. package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
  68. package/dist/static/index.d.ts +91 -5
  69. package/dist/static/index.js +49 -3
  70. package/dist/static/index.js.map +1 -0
  71. package/dist/static/inject.js.map +1 -1
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +80 -40
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +81 -3
  76. package/dist/zero/index.js +2 -3
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +1 -1
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +20 -12
  81. package/docs/adoption.md +59 -32
  82. package/docs/ai-agents.md +224 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +35 -18
  86. package/docs/design-system.md +63 -32
  87. package/docs/dsl.md +527 -179
  88. package/docs/getting-started.md +62 -41
  89. package/docs/injector.md +157 -51
  90. package/docs/methodology.md +116 -35
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +741 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/react-api.md +681 -0
  95. package/docs/runtime-benchmarks.md +351 -0
  96. package/docs/ssr.md +356 -130
  97. package/docs/styles.md +79 -16
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +78 -23
  100. package/tasty.config.ts +6 -0
  101. package/dist/_virtual/_rolldown/runtime.js +0 -7
  102. package/dist/chunks/cacheKey.js +0 -77
  103. package/dist/chunks/cacheKey.js.map +0 -1
  104. package/dist/chunks/definitions.d.ts +0 -37
  105. package/dist/chunks/definitions.js +0 -258
  106. package/dist/chunks/definitions.js.map +0 -1
  107. package/dist/chunks/index.d.ts +0 -1
  108. package/dist/chunks/renderChunk.d.ts +0 -1
  109. package/dist/chunks/renderChunk.js +0 -59
  110. package/dist/chunks/renderChunk.js.map +0 -1
  111. package/dist/config.d.ts +0 -366
  112. package/dist/config.js +0 -503
  113. package/dist/config.js.map +0 -1
  114. package/dist/counter-style/index.js +0 -51
  115. package/dist/counter-style/index.js.map +0 -1
  116. package/dist/debug.d.ts +0 -89
  117. package/dist/debug.js +0 -453
  118. package/dist/debug.js.map +0 -1
  119. package/dist/font-face/index.js +0 -63
  120. package/dist/font-face/index.js.map +0 -1
  121. package/dist/hooks/index.d.ts +0 -7
  122. package/dist/hooks/resolve-ssr-collector.js +0 -14
  123. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  124. package/dist/hooks/useCounterStyle.d.ts +0 -50
  125. package/dist/hooks/useCounterStyle.js +0 -46
  126. package/dist/hooks/useCounterStyle.js.map +0 -1
  127. package/dist/hooks/useFontFace.d.ts +0 -43
  128. package/dist/hooks/useFontFace.js +0 -70
  129. package/dist/hooks/useFontFace.js.map +0 -1
  130. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  131. package/dist/hooks/useGlobalStyles.js +0 -78
  132. package/dist/hooks/useGlobalStyles.js.map +0 -1
  133. package/dist/hooks/useKeyframes.d.ts +0 -56
  134. package/dist/hooks/useKeyframes.js +0 -64
  135. package/dist/hooks/useKeyframes.js.map +0 -1
  136. package/dist/hooks/useProperty.d.ts +0 -79
  137. package/dist/hooks/useProperty.js +0 -109
  138. package/dist/hooks/useProperty.js.map +0 -1
  139. package/dist/hooks/useRawCSS.d.ts +0 -53
  140. package/dist/hooks/useRawCSS.js +0 -35
  141. package/dist/hooks/useRawCSS.js.map +0 -1
  142. package/dist/hooks/useStyles.d.ts +0 -45
  143. package/dist/hooks/useStyles.js +0 -237
  144. package/dist/hooks/useStyles.js.map +0 -1
  145. package/dist/injector/index.d.ts +0 -183
  146. package/dist/injector/index.js +0 -179
  147. package/dist/injector/index.js.map +0 -1
  148. package/dist/injector/injector.d.ts +0 -166
  149. package/dist/injector/injector.js +0 -464
  150. package/dist/injector/injector.js.map +0 -1
  151. package/dist/injector/sheet-manager.d.ts +0 -136
  152. package/dist/injector/sheet-manager.js +0 -733
  153. package/dist/injector/sheet-manager.js.map +0 -1
  154. package/dist/injector/types.d.ts +0 -204
  155. package/dist/keyframes/index.js +0 -206
  156. package/dist/keyframes/index.js.map +0 -1
  157. package/dist/parser/classify.js +0 -319
  158. package/dist/parser/classify.js.map +0 -1
  159. package/dist/parser/const.js +0 -49
  160. package/dist/parser/const.js.map +0 -1
  161. package/dist/parser/lru.js +0 -109
  162. package/dist/parser/lru.js.map +0 -1
  163. package/dist/parser/parser.d.ts +0 -25
  164. package/dist/parser/parser.js +0 -115
  165. package/dist/parser/parser.js.map +0 -1
  166. package/dist/parser/tokenizer.js +0 -69
  167. package/dist/parser/tokenizer.js.map +0 -1
  168. package/dist/parser/types.d.ts +0 -51
  169. package/dist/parser/types.js +0 -46
  170. package/dist/parser/types.js.map +0 -1
  171. package/dist/pipeline/conditions.d.ts +0 -134
  172. package/dist/pipeline/conditions.js +0 -406
  173. package/dist/pipeline/conditions.js.map +0 -1
  174. package/dist/pipeline/exclusive.js +0 -230
  175. package/dist/pipeline/exclusive.js.map +0 -1
  176. package/dist/pipeline/index.d.ts +0 -55
  177. package/dist/pipeline/index.js +0 -708
  178. package/dist/pipeline/index.js.map +0 -1
  179. package/dist/pipeline/materialize.js +0 -1103
  180. package/dist/pipeline/materialize.js.map +0 -1
  181. package/dist/pipeline/parseStateKey.d.ts +0 -15
  182. package/dist/pipeline/parseStateKey.js +0 -446
  183. package/dist/pipeline/parseStateKey.js.map +0 -1
  184. package/dist/pipeline/simplify.js +0 -515
  185. package/dist/pipeline/simplify.js.map +0 -1
  186. package/dist/pipeline/warnings.js +0 -18
  187. package/dist/pipeline/warnings.js.map +0 -1
  188. package/dist/plugins/index.d.ts +0 -2
  189. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  190. package/dist/plugins/okhsl-plugin.js +0 -97
  191. package/dist/plugins/okhsl-plugin.js.map +0 -1
  192. package/dist/plugins/types.d.ts +0 -76
  193. package/dist/properties/index.js +0 -222
  194. package/dist/properties/index.js.map +0 -1
  195. package/dist/properties/property-type-resolver.d.ts +0 -24
  196. package/dist/properties/property-type-resolver.js +0 -90
  197. package/dist/properties/property-type-resolver.js.map +0 -1
  198. package/dist/ssr/astro.js.map +0 -1
  199. package/dist/ssr/async-storage.d.ts +0 -17
  200. package/dist/ssr/async-storage.js.map +0 -1
  201. package/dist/ssr/collect-auto-properties.js +0 -39
  202. package/dist/ssr/collect-auto-properties.js.map +0 -1
  203. package/dist/ssr/collector.d.ts +0 -102
  204. package/dist/ssr/collector.js +0 -226
  205. package/dist/ssr/collector.js.map +0 -1
  206. package/dist/ssr/context.d.ts +0 -8
  207. package/dist/ssr/context.js +0 -13
  208. package/dist/ssr/context.js.map +0 -1
  209. package/dist/ssr/format-global-rules.js.map +0 -1
  210. package/dist/ssr/format-keyframes.js +0 -69
  211. package/dist/ssr/format-keyframes.js.map +0 -1
  212. package/dist/ssr/format-property.js +0 -49
  213. package/dist/ssr/format-property.js.map +0 -1
  214. package/dist/ssr/format-rules.js.map +0 -1
  215. package/dist/ssr/hydrate.d.ts +0 -22
  216. package/dist/ssr/hydrate.js +0 -49
  217. package/dist/ssr/hydrate.js.map +0 -1
  218. package/dist/ssr/ssr-collector-ref.js +0 -12
  219. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  220. package/dist/states/index.d.ts +0 -49
  221. package/dist/states/index.js +0 -170
  222. package/dist/states/index.js.map +0 -1
  223. package/dist/static/tastyStatic.d.ts +0 -46
  224. package/dist/static/tastyStatic.js +0 -30
  225. package/dist/static/tastyStatic.js.map +0 -1
  226. package/dist/static/types.d.ts +0 -49
  227. package/dist/static/types.js +0 -24
  228. package/dist/static/types.js.map +0 -1
  229. package/dist/styles/align.d.ts +0 -15
  230. package/dist/styles/align.js +0 -14
  231. package/dist/styles/align.js.map +0 -1
  232. package/dist/styles/border.d.ts +0 -25
  233. package/dist/styles/border.js +0 -113
  234. package/dist/styles/border.js.map +0 -1
  235. package/dist/styles/color.d.ts +0 -14
  236. package/dist/styles/color.js +0 -26
  237. package/dist/styles/color.js.map +0 -1
  238. package/dist/styles/createStyle.js +0 -79
  239. package/dist/styles/createStyle.js.map +0 -1
  240. package/dist/styles/dimension.js +0 -96
  241. package/dist/styles/dimension.js.map +0 -1
  242. package/dist/styles/display.d.ts +0 -37
  243. package/dist/styles/display.js +0 -66
  244. package/dist/styles/display.js.map +0 -1
  245. package/dist/styles/fade.d.ts +0 -15
  246. package/dist/styles/fade.js +0 -57
  247. package/dist/styles/fade.js.map +0 -1
  248. package/dist/styles/fill.d.ts +0 -42
  249. package/dist/styles/fill.js +0 -51
  250. package/dist/styles/fill.js.map +0 -1
  251. package/dist/styles/flow.d.ts +0 -16
  252. package/dist/styles/flow.js +0 -12
  253. package/dist/styles/flow.js.map +0 -1
  254. package/dist/styles/gap.d.ts +0 -31
  255. package/dist/styles/gap.js +0 -36
  256. package/dist/styles/gap.js.map +0 -1
  257. package/dist/styles/height.d.ts +0 -17
  258. package/dist/styles/height.js +0 -19
  259. package/dist/styles/height.js.map +0 -1
  260. package/dist/styles/index.d.ts +0 -1
  261. package/dist/styles/index.js +0 -8
  262. package/dist/styles/index.js.map +0 -1
  263. package/dist/styles/inset.d.ts +0 -52
  264. package/dist/styles/inset.js +0 -149
  265. package/dist/styles/inset.js.map +0 -1
  266. package/dist/styles/justify.d.ts +0 -15
  267. package/dist/styles/justify.js +0 -14
  268. package/dist/styles/justify.js.map +0 -1
  269. package/dist/styles/list.d.ts +0 -16
  270. package/dist/styles/list.js +0 -98
  271. package/dist/styles/list.js.map +0 -1
  272. package/dist/styles/margin.d.ts +0 -24
  273. package/dist/styles/margin.js +0 -103
  274. package/dist/styles/margin.js.map +0 -1
  275. package/dist/styles/outline.d.ts +0 -29
  276. package/dist/styles/outline.js +0 -64
  277. package/dist/styles/outline.js.map +0 -1
  278. package/dist/styles/padding.d.ts +0 -24
  279. package/dist/styles/padding.js +0 -103
  280. package/dist/styles/padding.js.map +0 -1
  281. package/dist/styles/predefined.d.ts +0 -71
  282. package/dist/styles/predefined.js +0 -237
  283. package/dist/styles/predefined.js.map +0 -1
  284. package/dist/styles/preset.d.ts +0 -52
  285. package/dist/styles/preset.js +0 -126
  286. package/dist/styles/preset.js.map +0 -1
  287. package/dist/styles/radius.d.ts +0 -12
  288. package/dist/styles/radius.js +0 -71
  289. package/dist/styles/radius.js.map +0 -1
  290. package/dist/styles/scrollbar.d.ts +0 -25
  291. package/dist/styles/scrollbar.js +0 -46
  292. package/dist/styles/scrollbar.js.map +0 -1
  293. package/dist/styles/shadow.d.ts +0 -14
  294. package/dist/styles/shadow.js +0 -23
  295. package/dist/styles/shadow.js.map +0 -1
  296. package/dist/styles/transition.d.ts +0 -14
  297. package/dist/styles/transition.js +0 -157
  298. package/dist/styles/transition.js.map +0 -1
  299. package/dist/styles/types.d.ts +0 -549
  300. package/dist/styles/width.d.ts +0 -17
  301. package/dist/styles/width.js +0 -19
  302. package/dist/styles/width.js.map +0 -1
  303. package/dist/tasty.d.ts +0 -119
  304. package/dist/tasty.js +0 -231
  305. package/dist/tasty.js.map +0 -1
  306. package/dist/types.d.ts +0 -184
  307. package/dist/utils/cache-wrapper.js +0 -21
  308. package/dist/utils/cache-wrapper.js.map +0 -1
  309. package/dist/utils/case-converter.js +0 -8
  310. package/dist/utils/case-converter.js.map +0 -1
  311. package/dist/utils/color-math.d.ts +0 -46
  312. package/dist/utils/color-math.js +0 -749
  313. package/dist/utils/color-math.js.map +0 -1
  314. package/dist/utils/color-space.d.ts +0 -5
  315. package/dist/utils/color-space.js +0 -228
  316. package/dist/utils/color-space.js.map +0 -1
  317. package/dist/utils/colors.d.ts +0 -5
  318. package/dist/utils/colors.js +0 -10
  319. package/dist/utils/colors.js.map +0 -1
  320. package/dist/utils/css-types.d.ts +0 -7
  321. package/dist/utils/dotize.d.ts +0 -26
  322. package/dist/utils/dotize.js +0 -122
  323. package/dist/utils/dotize.js.map +0 -1
  324. package/dist/utils/filter-base-props.d.ts +0 -15
  325. package/dist/utils/filter-base-props.js +0 -45
  326. package/dist/utils/filter-base-props.js.map +0 -1
  327. package/dist/utils/get-display-name.d.ts +0 -7
  328. package/dist/utils/get-display-name.js +0 -10
  329. package/dist/utils/get-display-name.js.map +0 -1
  330. package/dist/utils/has-keys.js +0 -13
  331. package/dist/utils/has-keys.js.map +0 -1
  332. package/dist/utils/is-dev-env.js +0 -19
  333. package/dist/utils/is-dev-env.js.map +0 -1
  334. package/dist/utils/is-valid-element-type.js +0 -15
  335. package/dist/utils/is-valid-element-type.js.map +0 -1
  336. package/dist/utils/merge-styles.js.map +0 -1
  337. package/dist/utils/mod-attrs.d.ts +0 -6
  338. package/dist/utils/mod-attrs.js +0 -20
  339. package/dist/utils/mod-attrs.js.map +0 -1
  340. package/dist/utils/process-tokens.d.ts +0 -21
  341. package/dist/utils/process-tokens.js +0 -90
  342. package/dist/utils/process-tokens.js.map +0 -1
  343. package/dist/utils/resolve-recipes.d.ts +0 -17
  344. package/dist/utils/resolve-recipes.js.map +0 -1
  345. package/dist/utils/selector-transform.js +0 -32
  346. package/dist/utils/selector-transform.js.map +0 -1
  347. package/dist/utils/string.js +0 -8
  348. package/dist/utils/string.js.map +0 -1
  349. package/dist/utils/styles.d.ts +0 -99
  350. package/dist/utils/styles.js +0 -220
  351. package/dist/utils/styles.js.map +0 -1
  352. package/dist/utils/typography.d.ts +0 -47
  353. package/dist/utils/typography.js +0 -51
  354. package/dist/utils/typography.js.map +0 -1
  355. package/dist/utils/warnings.d.ts +0 -16
  356. package/dist/utils/warnings.js +0 -16
  357. package/dist/utils/warnings.js.map +0 -1
  358. package/dist/zero/css-writer.d.ts +0 -45
  359. package/dist/zero/css-writer.js +0 -73
  360. package/dist/zero/css-writer.js.map +0 -1
  361. package/dist/zero/extractor.d.ts +0 -24
  362. package/dist/zero/extractor.js.map +0 -1
  363. package/docs/PIPELINE.md +0 -519
  364. package/docs/runtime.md +0 -485
  365. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
@@ -1,59 +0,0 @@
1
- import { extractLocalPredefinedStates } from "../states/index.js";
2
- import { hasPipelineCacheEntry, renderStyles } from "../pipeline/index.js";
3
- import { CHUNK_NAMES } from "./definitions.js";
4
- //#region src/chunks/renderChunk.ts
5
- /**
6
- * Build a filtered styles object for a regular chunk.
7
- */
8
- function buildFilteredStyles(styles, styleKeys) {
9
- const localPredefinedStates = extractLocalPredefinedStates(styles);
10
- const filteredStyles = {};
11
- for (const [key, value] of Object.entries(localPredefinedStates)) filteredStyles[key] = value;
12
- for (const key of styleKeys) {
13
- const value = styles[key];
14
- if (value !== void 0) filteredStyles[key] = value;
15
- }
16
- return filteredStyles;
17
- }
18
- /**
19
- * Build a filtered styles object for the subcomponents chunk.
20
- */
21
- function buildSubcomponentFilteredStyles(styles, selectorKeys) {
22
- const localPredefinedStates = extractLocalPredefinedStates(styles);
23
- const filteredStyles = {};
24
- for (const [key, value] of Object.entries(localPredefinedStates)) filteredStyles[key] = value;
25
- for (const key of selectorKeys) {
26
- const value = styles[key];
27
- if (value !== void 0) filteredStyles[key] = value;
28
- }
29
- if (styles.$ !== void 0) filteredStyles.$ = styles.$;
30
- return filteredStyles;
31
- }
32
- /**
33
- * Render styles for a specific chunk.
34
- *
35
- * On pipeline cache hit, avoids building the filtered styles object entirely.
36
- * Only constructs it on cache miss when the pipeline actually needs the styles.
37
- *
38
- * IMPORTANT: Local predefined states (e.g., '@mobile': '@media(w < 600px)')
39
- * are always included in the filtered styles, regardless of which chunk is
40
- * being rendered. This ensures that state references like '@mobile' in any
41
- * chunk can be properly resolved by the pipeline.
42
- *
43
- * @param styles - The full styles object
44
- * @param chunkName - Name of the chunk being rendered
45
- * @param styleKeys - Keys of styles belonging to this chunk
46
- * @returns RenderResult with rules for this chunk
47
- */
48
- function renderStylesForChunk(styles, chunkName, styleKeys, pipelineCacheKey) {
49
- if (styleKeys.length === 0) return {
50
- rules: [],
51
- className: ""
52
- };
53
- if (pipelineCacheKey && hasPipelineCacheEntry(pipelineCacheKey)) return renderStyles(void 0, void 0, void 0, pipelineCacheKey);
54
- return renderStyles(chunkName === CHUNK_NAMES.SUBCOMPONENTS ? buildSubcomponentFilteredStyles(styles, styleKeys) : buildFilteredStyles(styles, styleKeys), void 0, void 0, pipelineCacheKey);
55
- }
56
- //#endregion
57
- export { renderStylesForChunk };
58
-
59
- //# sourceMappingURL=renderChunk.js.map
@@ -1 +0,0 @@
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"}
package/dist/config.d.ts DELETED
@@ -1,366 +0,0 @@
1
- import { CounterStyleDescriptors, FontFaceInput, KeyframesSteps, PropertyDefinition } from "./injector/types.js";
2
- import { StyleDetails, UnitHandler } from "./parser/types.js";
3
- import { StyleHandlerDefinition } from "./utils/styles.js";
4
- import { ConfigTokens, RecipeStyles } from "./styles/types.js";
5
- import { StyleInjector } from "./injector/injector.js";
6
- import { ColorSpace } from "./utils/color-space.js";
7
- import { TastyPlugin } from "./plugins/types.js";
8
-
9
- //#region src/config.d.ts
10
- /**
11
- * Configuration options for the Tasty style system
12
- */
13
- interface TastyConfig {
14
- /** CSP nonce for style elements */
15
- nonce?: string;
16
- /** Maximum rules per stylesheet (default: 8192) */
17
- maxRulesPerSheet?: number;
18
- /** Threshold for bulk cleanup of unused styles (default: 500) */
19
- unusedStylesThreshold?: number;
20
- /** Delay before bulk cleanup in ms, ignored if idleCleanup is true (default: 5000) */
21
- bulkCleanupDelay?: number;
22
- /** Use requestIdleCallback for cleanup when available (default: true) */
23
- idleCleanup?: boolean;
24
- /** Force text injection mode, auto-detected in test environments (default: auto) */
25
- forceTextInjection?: boolean;
26
- /** Enable development mode features: performance metrics and debug info (default: auto) */
27
- devMode?: boolean;
28
- /**
29
- * Ratio of unused styles to delete per bulk cleanup run (0..1).
30
- * Defaults to 0.5 (oldest half) to reduce risk of removing styles
31
- * that may be restored shortly after being marked unused.
32
- */
33
- bulkCleanupBatchRatio?: number;
34
- /**
35
- * Minimum age (in ms) a style must remain unused before eligible for deletion.
36
- * Helps avoid races during rapid mount/unmount cycles. Default: 10000ms.
37
- */
38
- unusedStylesMinAgeMs?: number;
39
- /**
40
- * Global predefined states for advanced state mapping.
41
- * These are state aliases that can be used in any component.
42
- * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
43
- */
44
- states?: Record<string, string>;
45
- /**
46
- * Parser LRU cache size (default: 1000).
47
- * Larger values improve performance for apps with many unique style values.
48
- */
49
- parserCacheSize?: number;
50
- /**
51
- * Custom units for the style parser (merged with built-in units).
52
- * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
53
- * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
54
- */
55
- units?: Record<string, string | UnitHandler>;
56
- /**
57
- * Custom functions for the style parser (merged with existing).
58
- * Functions process parsed style groups and return CSS values.
59
- * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
60
- */
61
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
62
- /**
63
- * Color space used for decomposed color token companion variables.
64
- * Controls the CSS function and suffix for alpha composition.
65
- *
66
- * - `'rgb'` — suffix `-rgb`, e.g. `rgb(var(--name-color-rgb) / .5)`
67
- * - `'hsl'` — suffix `-hsl`, e.g. `hsl(var(--name-color-hsl) / .5)`
68
- * - `'oklch'` — suffix `-oklch`, e.g. `oklch(var(--name-color-oklch) / .5)`
69
- *
70
- * @default 'oklch'
71
- */
72
- colorSpace?: ColorSpace;
73
- /**
74
- * Automatically infer and register CSS @property declarations
75
- * from custom property values found in styles, keyframes, and global config.
76
- * Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
77
- * When false, only explicitly declared @properties are registered.
78
- * @default true
79
- */
80
- autoPropertyTypes?: boolean;
81
- /**
82
- * Plugins that extend tasty with custom functions, units, or states.
83
- * Plugins are processed in order, with later plugins overriding earlier ones.
84
- * @example
85
- * ```ts
86
- * import { okhslPlugin } from '@tenphi/tasty';
87
- *
88
- * configure({
89
- * plugins: [okhslPlugin()],
90
- * });
91
- * ```
92
- */
93
- plugins?: TastyPlugin[];
94
- /**
95
- * Global keyframes definitions that can be referenced by animation names in styles.
96
- * Keys are animation names, values are keyframes step definitions.
97
- * Keyframes are only injected when actually used in styles.
98
- * @example
99
- * ```ts
100
- * configure({
101
- * keyframes: {
102
- * fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
103
- * pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
104
- * },
105
- * });
106
- * ```
107
- */
108
- keyframes?: Record<string, KeyframesSteps>;
109
- /**
110
- * Global CSS @property definitions for custom properties.
111
- * Keys use tasty token syntax ($name for properties, #name for colors).
112
- * Properties are only injected when the component using them is rendered.
113
- *
114
- * For color tokens (#name), `syntax: '<color>'` is auto-set and
115
- * `initialValue` defaults to `'transparent'` if not specified.
116
- *
117
- * @example
118
- * ```ts
119
- * configure({
120
- * properties: {
121
- * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
122
- * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
123
- * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
124
- * },
125
- * });
126
- *
127
- * // Now use in styles - properties are registered when component renders:
128
- * const Spinner = tasty({
129
- * styles: {
130
- * transform: 'rotate($rotation)',
131
- * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
132
- * },
133
- * });
134
- * ```
135
- */
136
- properties?: Record<string, PropertyDefinition>;
137
- /**
138
- * Global @font-face definitions.
139
- * Keys are font-family names, values are descriptors or arrays of descriptors
140
- * (for multiple weights/styles of the same family).
141
- * Injected eagerly when styles are first generated.
142
- * @example
143
- * ```ts
144
- * configure({
145
- * fontFace: {
146
- * 'Brand Sans': [
147
- * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
148
- * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
149
- * ],
150
- * Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' },
151
- * },
152
- * });
153
- * ```
154
- */
155
- fontFace?: Record<string, FontFaceInput>;
156
- /**
157
- * Global @counter-style definitions.
158
- * Keys are counter-style names, values are descriptor objects.
159
- * Injected eagerly when styles are first generated.
160
- * @example
161
- * ```ts
162
- * configure({
163
- * counterStyle: {
164
- * thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
165
- * },
166
- * });
167
- * ```
168
- */
169
- counterStyle?: Record<string, CounterStyleDescriptors>;
170
- /**
171
- * Custom style handlers that transform style properties into CSS declarations.
172
- * Handlers replace built-in handlers for the same style name.
173
- * @example
174
- * ```ts
175
- * import { styleHandlers } from '@tenphi/tasty';
176
- *
177
- * configure({
178
- * handlers: {
179
- * // Override fill with custom behavior
180
- * fill: ({ fill }) => {
181
- * if (fill?.startsWith('gradient:')) {
182
- * return { background: fill.slice(9) };
183
- * }
184
- * return styleHandlers.fill({ fill });
185
- * },
186
- * // Add new custom style
187
- * elevation: ({ elevation }) => {
188
- * const level = parseInt(elevation) || 1;
189
- * return {
190
- * 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
191
- * 'z-index': String(level * 100),
192
- * };
193
- * },
194
- * },
195
- * });
196
- * ```
197
- */
198
- handlers?: Record<string, StyleHandlerDefinition>;
199
- /**
200
- * Design tokens injected as CSS custom properties on `:root`.
201
- * Values are parsed through the Tasty DSL. Supports state maps
202
- * for responsive/theme-aware tokens.
203
- *
204
- * - `$name` keys become `--name` CSS custom properties
205
- * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
206
- *
207
- * Tokens are injected once when the first style is rendered.
208
- *
209
- * @example
210
- * ```ts
211
- * configure({
212
- * tokens: {
213
- * '$gap': '4px',
214
- * '#primary': {
215
- * '': '#purple',
216
- * '@dark': '#light-purple',
217
- * },
218
- * },
219
- * });
220
- * ```
221
- */
222
- tokens?: ConfigTokens;
223
- /**
224
- * Predefined tokens that are replaced during style parsing (parse-time substitution).
225
- * Use `$name` for custom properties and `#name` for color tokens.
226
- * Values are substituted inline before CSS generation, unlike `tokens` which
227
- * inject CSS custom properties on `:root`.
228
- *
229
- * For color tokens (#name), boolean `true` is converted to `transparent`.
230
- *
231
- * @example
232
- * ```ts
233
- * configure({
234
- * replaceTokens: {
235
- * $spacing: '2x',
236
- * '#accent': '#purple',
237
- * '#overlay': true, // → transparent
238
- * },
239
- * });
240
- *
241
- * // Now use in styles - tokens are replaced at parse time:
242
- * const Card = tasty({
243
- * styles: {
244
- * padding: '$spacing', // → calc(2 * var(--gap))
245
- * fill: '#accent', // → var(--purple-color)
246
- * },
247
- * });
248
- * ```
249
- */
250
- replaceTokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
251
- /**
252
- * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
253
- * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
254
- * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
255
- *
256
- * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
257
- * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
258
- * Use `none` to skip base recipes: `recipe: 'none / post1'`.
259
- * Resolution order: `base_recipes → component styles → post_recipes`.
260
- *
261
- * Recipes cannot reference other recipes.
262
- *
263
- * @example
264
- * ```ts
265
- * configure({
266
- * recipes: {
267
- * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
268
- * elevated: { shadow: '2x 2x 4x #shadow' },
269
- * },
270
- * });
271
- *
272
- * // Usage in styles:
273
- * const Card = tasty({
274
- * styles: {
275
- * recipe: 'card elevated',
276
- * color: '#text', // Overrides recipe values
277
- * },
278
- * });
279
- * ```
280
- */
281
- recipes?: Record<string, RecipeStyles>;
282
- }
283
- declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
284
- declare global {
285
- interface Window {
286
- [GLOBAL_INJECTOR_KEY]?: StyleInjector;
287
- }
288
- var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
289
- }
290
- /**
291
- * Detect if we're running in a test environment
292
- */
293
- declare function isTestEnvironment(): boolean;
294
- /**
295
- * Check if styles have been generated (configuration is locked)
296
- */
297
- declare function hasStylesGenerated(): boolean;
298
- /**
299
- * Check if any global keyframes are configured.
300
- * Uses a pre-computed flag to avoid Object.keys() allocation on every call.
301
- */
302
- declare function hasGlobalKeyframes(): boolean;
303
- /**
304
- * Get global keyframes configuration.
305
- * Returns null if no keyframes configured (fast path for zero-overhead).
306
- */
307
- declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
308
- /**
309
- * Get global font-face configuration.
310
- * Returns null if no font faces configured.
311
- */
312
- declare function getGlobalFontFace(): Record<string, FontFaceInput> | null;
313
- /**
314
- * Get global counter-style configuration.
315
- * Returns null if no counter styles configured.
316
- */
317
- declare function getGlobalCounterStyle(): Record<string, CounterStyleDescriptors> | null;
318
- /**
319
- * Check if any global recipes are configured.
320
- * Fast path: returns false if no recipes were ever set.
321
- */
322
- declare function hasGlobalRecipes(): boolean;
323
- /**
324
- * Get global recipes configuration.
325
- * Returns null if no recipes configured (fast path for zero-overhead).
326
- */
327
- declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
328
- /**
329
- * Check if configuration is locked (styles have been generated)
330
- */
331
- declare function isConfigLocked(): boolean;
332
- /**
333
- * Configure the Tasty style system.
334
- *
335
- * Must be called BEFORE any styles are generated (before first render that uses tasty).
336
- * After styles are generated, configuration is locked and calls to configure() will
337
- * emit a warning and be ignored.
338
- *
339
- * @example
340
- * ```ts
341
- * import { configure } from '@tenphi/tasty';
342
- *
343
- * // Configure before app renders
344
- * configure({
345
- * nonce: 'abc123',
346
- * states: {
347
- * '@mobile': '@media(w < 768px)',
348
- * '@dark': '@root(theme=dark)',
349
- * },
350
- * });
351
- * ```
352
- */
353
- declare function configure(config?: Partial<TastyConfig>): void;
354
- /**
355
- * Get the current configuration.
356
- * If not configured, returns default configuration.
357
- */
358
- declare function getConfig(): TastyConfig;
359
- /**
360
- * Reset configuration (for testing only).
361
- * Clears the global injector and allows reconfiguration.
362
- */
363
- declare function resetConfig(): void;
364
- //#endregion
365
- export { TastyConfig, configure, getConfig, getGlobalCounterStyle, getGlobalFontFace, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig };
366
- //# sourceMappingURL=config.d.ts.map