@tenphi/tasty 0.0.0-snapshot.a7fb1f5 → 0.0.0-snapshot.a8a2a5d

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 (387) hide show
  1. package/README.md +453 -360
  2. package/dist/babel-types-BOABQvEI.d.ts +16 -0
  3. package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
  4. package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
  5. package/dist/chunks/build-config-DQkT3Wru.js +59 -0
  6. package/dist/chunks/build-config-DQkT3Wru.js.map +1 -0
  7. package/dist/chunks/collector-Df9zcabl.js +209 -0
  8. package/dist/chunks/collector-Df9zcabl.js.map +1 -0
  9. package/dist/chunks/config-engine-C7OUmM1J.js +269 -0
  10. package/dist/chunks/config-engine-C7OUmM1J.js.map +1 -0
  11. package/dist/chunks/config-file-BX3F_61U.js +24 -0
  12. package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
  13. package/dist/chunks/css-definitions-BkdTqT7G.js +896 -0
  14. package/dist/chunks/css-definitions-BkdTqT7G.js.map +1 -0
  15. package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
  16. package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-CwGMB2RI.js} +197 -149
  18. package/dist/chunks/debug-CwGMB2RI.js.map +1 -0
  19. package/dist/chunks/dsl-BAwiOznp.js +1442 -0
  20. package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
  21. package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
  22. package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
  23. package/dist/chunks/react-runtime-B8YqpFx7.js +678 -0
  24. package/dist/chunks/react-runtime-B8YqpFx7.js.map +1 -0
  25. package/dist/chunks/runtime-engine-CHNH2nGy.js +2418 -0
  26. package/dist/chunks/runtime-engine-CHNH2nGy.js.map +1 -0
  27. package/dist/chunks/runtime-state-BxLKsQzs.js +150 -0
  28. package/dist/chunks/runtime-state-BxLKsQzs.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-CYgOs2mp.js} +58 -58
  30. package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
  31. package/dist/chunks/style-engine-DkKH-TqL.js +5573 -0
  32. package/dist/chunks/style-engine-DkKH-TqL.js.map +1 -0
  33. package/dist/chunks/zero-engine-C-0ar_PT.js +308 -0
  34. package/dist/chunks/zero-engine-C-0ar_PT.js.map +1 -0
  35. package/dist/collector-BN6hCWIx.d.ts +160 -0
  36. package/dist/config-Chmu-PnP.d.ts +1349 -0
  37. package/dist/core/index.d.ts +5 -34
  38. package/dist/core/index.js +9 -27
  39. package/dist/hydrate-CTh8SGd9.d.ts +20 -0
  40. package/dist/index-szujmf6W.d.ts +1848 -0
  41. package/dist/index.d.ts +5 -51
  42. package/dist/index.js +11 -36
  43. package/dist/merge-styles-Cx25bpax.d.ts +4 -0
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +5 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +8 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +8 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +8 -0
  51. package/dist/ssr/astro-middleware-extract.js +8 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +15 -0
  54. package/dist/ssr/astro-middleware-static.js +6 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +16 -0
  57. package/dist/ssr/astro-middleware.js +6 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -14
  60. package/dist/ssr/astro.js +205 -50
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +1 -0
  64. package/dist/ssr/index.d.ts +15 -4
  65. package/dist/ssr/index.js +7 -8
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +63 -0
  68. package/dist/ssr/next-config.js +122 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +33 -48
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +86 -5
  74. package/dist/static/index.js +29 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -4
  77. package/dist/static/inject.js +1 -2
  78. package/dist/static/inject.js.map +1 -1
  79. package/dist/types-DbMN-Yyn.d.ts +1545 -0
  80. package/dist/zero/babel.d.ts +12 -123
  81. package/dist/zero/babel.js +125 -151
  82. package/dist/zero/babel.js.map +1 -1
  83. package/dist/zero/index.d.ts +130 -3
  84. package/dist/zero/index.js +24 -3
  85. package/dist/zero/index.js.map +1 -0
  86. package/dist/zero/next.d.ts +5 -7
  87. package/dist/zero/next.js +4 -40
  88. package/dist/zero/next.js.map +1 -1
  89. package/docs/README.md +23 -12
  90. package/docs/adoption.md +72 -37
  91. package/docs/ai-agents.md +259 -0
  92. package/docs/comparison.md +83 -54
  93. package/docs/configuration.md +712 -81
  94. package/docs/debug.md +39 -24
  95. package/docs/design-system.md +186 -41
  96. package/docs/dsl.md +740 -197
  97. package/docs/getting-started.md +132 -52
  98. package/docs/injector.md +184 -92
  99. package/docs/llms.txt +31 -0
  100. package/docs/methodology.md +107 -50
  101. package/docs/migration-v3.md +285 -0
  102. package/docs/pipeline.md +768 -0
  103. package/docs/plugins.md +333 -0
  104. package/docs/react-api.md +746 -0
  105. package/docs/runtime-benchmarks.md +388 -0
  106. package/docs/ssr.md +399 -117
  107. package/docs/styles.md +234 -49
  108. package/docs/tasty-static.md +298 -118
  109. package/harness/dev.harnesspm/rules/usage.md +12 -0
  110. package/harness/dev.harnesspm/scripts/render.mjs +320 -0
  111. package/harness/dev.harnesspm/scripts/styles.mjs +299 -0
  112. package/harness/plugin.json +20 -0
  113. package/package.json +159 -44
  114. package/tasty.config.ts +7 -0
  115. package/dist/_virtual/_rolldown/runtime.js +0 -7
  116. package/dist/chunks/cacheKey.d.ts +0 -1
  117. package/dist/chunks/cacheKey.js +0 -77
  118. package/dist/chunks/cacheKey.js.map +0 -1
  119. package/dist/chunks/definitions.d.ts +0 -37
  120. package/dist/chunks/definitions.js +0 -258
  121. package/dist/chunks/definitions.js.map +0 -1
  122. package/dist/chunks/index.d.ts +0 -1
  123. package/dist/chunks/renderChunk.d.ts +0 -1
  124. package/dist/chunks/renderChunk.js +0 -59
  125. package/dist/chunks/renderChunk.js.map +0 -1
  126. package/dist/compute-styles.d.ts +0 -31
  127. package/dist/compute-styles.js +0 -357
  128. package/dist/compute-styles.js.map +0 -1
  129. package/dist/config.d.ts +0 -366
  130. package/dist/config.js +0 -502
  131. package/dist/config.js.map +0 -1
  132. package/dist/counter-style/index.js +0 -51
  133. package/dist/counter-style/index.js.map +0 -1
  134. package/dist/debug.d.ts +0 -89
  135. package/dist/debug.js.map +0 -1
  136. package/dist/font-face/index.js +0 -63
  137. package/dist/font-face/index.js.map +0 -1
  138. package/dist/hooks/index.d.ts +0 -7
  139. package/dist/hooks/useCounterStyle.d.ts +0 -50
  140. package/dist/hooks/useCounterStyle.js +0 -45
  141. package/dist/hooks/useCounterStyle.js.map +0 -1
  142. package/dist/hooks/useFontFace.d.ts +0 -43
  143. package/dist/hooks/useFontFace.js +0 -69
  144. package/dist/hooks/useFontFace.js.map +0 -1
  145. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  146. package/dist/hooks/useGlobalStyles.js +0 -77
  147. package/dist/hooks/useGlobalStyles.js.map +0 -1
  148. package/dist/hooks/useKeyframes.d.ts +0 -56
  149. package/dist/hooks/useKeyframes.js +0 -63
  150. package/dist/hooks/useKeyframes.js.map +0 -1
  151. package/dist/hooks/useProperty.d.ts +0 -79
  152. package/dist/hooks/useProperty.js +0 -108
  153. package/dist/hooks/useProperty.js.map +0 -1
  154. package/dist/hooks/useRawCSS.d.ts +0 -53
  155. package/dist/hooks/useRawCSS.js +0 -34
  156. package/dist/hooks/useRawCSS.js.map +0 -1
  157. package/dist/hooks/useStyles.d.ts +0 -40
  158. package/dist/hooks/useStyles.js +0 -29
  159. package/dist/hooks/useStyles.js.map +0 -1
  160. package/dist/injector/index.d.ts +0 -187
  161. package/dist/injector/index.js +0 -192
  162. package/dist/injector/index.js.map +0 -1
  163. package/dist/injector/injector.d.ts +0 -195
  164. package/dist/injector/injector.js +0 -587
  165. package/dist/injector/injector.js.map +0 -1
  166. package/dist/injector/sheet-manager.d.ts +0 -132
  167. package/dist/injector/sheet-manager.js +0 -697
  168. package/dist/injector/sheet-manager.js.map +0 -1
  169. package/dist/injector/types.d.ts +0 -235
  170. package/dist/keyframes/index.js +0 -206
  171. package/dist/keyframes/index.js.map +0 -1
  172. package/dist/parser/classify.js +0 -319
  173. package/dist/parser/classify.js.map +0 -1
  174. package/dist/parser/const.js +0 -60
  175. package/dist/parser/const.js.map +0 -1
  176. package/dist/parser/lru.js +0 -109
  177. package/dist/parser/lru.js.map +0 -1
  178. package/dist/parser/parser.d.ts +0 -25
  179. package/dist/parser/parser.js +0 -115
  180. package/dist/parser/parser.js.map +0 -1
  181. package/dist/parser/tokenizer.js +0 -69
  182. package/dist/parser/tokenizer.js.map +0 -1
  183. package/dist/parser/types.d.ts +0 -51
  184. package/dist/parser/types.js +0 -46
  185. package/dist/parser/types.js.map +0 -1
  186. package/dist/pipeline/conditions.d.ts +0 -134
  187. package/dist/pipeline/conditions.js +0 -406
  188. package/dist/pipeline/conditions.js.map +0 -1
  189. package/dist/pipeline/exclusive.js +0 -230
  190. package/dist/pipeline/exclusive.js.map +0 -1
  191. package/dist/pipeline/index.d.ts +0 -55
  192. package/dist/pipeline/index.js +0 -708
  193. package/dist/pipeline/index.js.map +0 -1
  194. package/dist/pipeline/materialize.js +0 -1103
  195. package/dist/pipeline/materialize.js.map +0 -1
  196. package/dist/pipeline/parseStateKey.d.ts +0 -15
  197. package/dist/pipeline/parseStateKey.js +0 -446
  198. package/dist/pipeline/parseStateKey.js.map +0 -1
  199. package/dist/pipeline/simplify.js +0 -515
  200. package/dist/pipeline/simplify.js.map +0 -1
  201. package/dist/pipeline/warnings.js +0 -18
  202. package/dist/pipeline/warnings.js.map +0 -1
  203. package/dist/plugins/index.d.ts +0 -2
  204. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  205. package/dist/plugins/okhsl-plugin.js +0 -97
  206. package/dist/plugins/okhsl-plugin.js.map +0 -1
  207. package/dist/plugins/types.d.ts +0 -76
  208. package/dist/properties/index.js +0 -222
  209. package/dist/properties/index.js.map +0 -1
  210. package/dist/properties/property-type-resolver.d.ts +0 -24
  211. package/dist/properties/property-type-resolver.js +0 -90
  212. package/dist/properties/property-type-resolver.js.map +0 -1
  213. package/dist/ssr/async-storage.d.ts +0 -17
  214. package/dist/ssr/async-storage.js +0 -34
  215. package/dist/ssr/async-storage.js.map +0 -1
  216. package/dist/ssr/collect-auto-properties.js +0 -39
  217. package/dist/ssr/collect-auto-properties.js.map +0 -1
  218. package/dist/ssr/collector.d.ts +0 -102
  219. package/dist/ssr/collector.js +0 -219
  220. package/dist/ssr/collector.js.map +0 -1
  221. package/dist/ssr/format-global-rules.js +0 -22
  222. package/dist/ssr/format-global-rules.js.map +0 -1
  223. package/dist/ssr/format-keyframes.js +0 -69
  224. package/dist/ssr/format-keyframes.js.map +0 -1
  225. package/dist/ssr/format-property.js +0 -49
  226. package/dist/ssr/format-property.js.map +0 -1
  227. package/dist/ssr/format-rules.js +0 -73
  228. package/dist/ssr/format-rules.js.map +0 -1
  229. package/dist/ssr/hydrate.d.ts +0 -22
  230. package/dist/ssr/hydrate.js +0 -49
  231. package/dist/ssr/hydrate.js.map +0 -1
  232. package/dist/ssr/ssr-collector-ref.js +0 -12
  233. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  234. package/dist/states/index.d.ts +0 -49
  235. package/dist/states/index.js +0 -170
  236. package/dist/states/index.js.map +0 -1
  237. package/dist/static/tastyStatic.d.ts +0 -46
  238. package/dist/static/tastyStatic.js +0 -30
  239. package/dist/static/tastyStatic.js.map +0 -1
  240. package/dist/static/types.d.ts +0 -49
  241. package/dist/static/types.js +0 -24
  242. package/dist/static/types.js.map +0 -1
  243. package/dist/styles/border.d.ts +0 -25
  244. package/dist/styles/border.js +0 -120
  245. package/dist/styles/border.js.map +0 -1
  246. package/dist/styles/color.d.ts +0 -14
  247. package/dist/styles/color.js +0 -26
  248. package/dist/styles/color.js.map +0 -1
  249. package/dist/styles/const.js +0 -17
  250. package/dist/styles/const.js.map +0 -1
  251. package/dist/styles/createStyle.js +0 -79
  252. package/dist/styles/createStyle.js.map +0 -1
  253. package/dist/styles/dimension.js +0 -109
  254. package/dist/styles/dimension.js.map +0 -1
  255. package/dist/styles/directional.js +0 -133
  256. package/dist/styles/directional.js.map +0 -1
  257. package/dist/styles/display.d.ts +0 -30
  258. package/dist/styles/display.js +0 -73
  259. package/dist/styles/display.js.map +0 -1
  260. package/dist/styles/fade.d.ts +0 -15
  261. package/dist/styles/fade.js +0 -62
  262. package/dist/styles/fade.js.map +0 -1
  263. package/dist/styles/fill.d.ts +0 -42
  264. package/dist/styles/fill.js +0 -51
  265. package/dist/styles/fill.js.map +0 -1
  266. package/dist/styles/flow.d.ts +0 -16
  267. package/dist/styles/flow.js +0 -12
  268. package/dist/styles/flow.js.map +0 -1
  269. package/dist/styles/gap.d.ts +0 -31
  270. package/dist/styles/gap.js +0 -38
  271. package/dist/styles/gap.js.map +0 -1
  272. package/dist/styles/height.d.ts +0 -17
  273. package/dist/styles/height.js +0 -19
  274. package/dist/styles/height.js.map +0 -1
  275. package/dist/styles/index.d.ts +0 -1
  276. package/dist/styles/index.js +0 -8
  277. package/dist/styles/index.js.map +0 -1
  278. package/dist/styles/inset.d.ts +0 -24
  279. package/dist/styles/inset.js +0 -34
  280. package/dist/styles/inset.js.map +0 -1
  281. package/dist/styles/list.d.ts +0 -16
  282. package/dist/styles/list.js +0 -100
  283. package/dist/styles/list.js.map +0 -1
  284. package/dist/styles/margin.d.ts +0 -24
  285. package/dist/styles/margin.js +0 -32
  286. package/dist/styles/margin.js.map +0 -1
  287. package/dist/styles/outline.d.ts +0 -29
  288. package/dist/styles/outline.js +0 -55
  289. package/dist/styles/outline.js.map +0 -1
  290. package/dist/styles/padding.d.ts +0 -24
  291. package/dist/styles/padding.js +0 -32
  292. package/dist/styles/padding.js.map +0 -1
  293. package/dist/styles/placement.d.ts +0 -37
  294. package/dist/styles/placement.js +0 -74
  295. package/dist/styles/placement.js.map +0 -1
  296. package/dist/styles/predefined.d.ts +0 -71
  297. package/dist/styles/predefined.js +0 -237
  298. package/dist/styles/predefined.js.map +0 -1
  299. package/dist/styles/preset.d.ts +0 -52
  300. package/dist/styles/preset.js +0 -127
  301. package/dist/styles/preset.js.map +0 -1
  302. package/dist/styles/radius.d.ts +0 -12
  303. package/dist/styles/radius.js +0 -83
  304. package/dist/styles/radius.js.map +0 -1
  305. package/dist/styles/scrollMargin.d.ts +0 -24
  306. package/dist/styles/scrollMargin.js +0 -32
  307. package/dist/styles/scrollMargin.js.map +0 -1
  308. package/dist/styles/scrollbar.d.ts +0 -25
  309. package/dist/styles/scrollbar.js +0 -51
  310. package/dist/styles/scrollbar.js.map +0 -1
  311. package/dist/styles/shadow.d.ts +0 -14
  312. package/dist/styles/shadow.js +0 -25
  313. package/dist/styles/shadow.js.map +0 -1
  314. package/dist/styles/shared.js +0 -17
  315. package/dist/styles/shared.js.map +0 -1
  316. package/dist/styles/transition.d.ts +0 -14
  317. package/dist/styles/transition.js +0 -159
  318. package/dist/styles/transition.js.map +0 -1
  319. package/dist/styles/types.d.ts +0 -564
  320. package/dist/styles/width.d.ts +0 -17
  321. package/dist/styles/width.js +0 -19
  322. package/dist/styles/width.js.map +0 -1
  323. package/dist/tasty.d.ts +0 -134
  324. package/dist/tasty.js +0 -243
  325. package/dist/tasty.js.map +0 -1
  326. package/dist/types.d.ts +0 -184
  327. package/dist/utils/cache-wrapper.js +0 -21
  328. package/dist/utils/cache-wrapper.js.map +0 -1
  329. package/dist/utils/case-converter.js +0 -8
  330. package/dist/utils/case-converter.js.map +0 -1
  331. package/dist/utils/color-math.d.ts +0 -46
  332. package/dist/utils/color-math.js +0 -749
  333. package/dist/utils/color-math.js.map +0 -1
  334. package/dist/utils/color-space.d.ts +0 -5
  335. package/dist/utils/color-space.js +0 -228
  336. package/dist/utils/color-space.js.map +0 -1
  337. package/dist/utils/colors.d.ts +0 -5
  338. package/dist/utils/colors.js +0 -10
  339. package/dist/utils/colors.js.map +0 -1
  340. package/dist/utils/css-types.d.ts +0 -7
  341. package/dist/utils/dotize.d.ts +0 -26
  342. package/dist/utils/dotize.js +0 -122
  343. package/dist/utils/dotize.js.map +0 -1
  344. package/dist/utils/filter-base-props.d.ts +0 -15
  345. package/dist/utils/filter-base-props.js +0 -45
  346. package/dist/utils/filter-base-props.js.map +0 -1
  347. package/dist/utils/get-display-name.d.ts +0 -7
  348. package/dist/utils/get-display-name.js +0 -10
  349. package/dist/utils/get-display-name.js.map +0 -1
  350. package/dist/utils/has-keys.js +0 -13
  351. package/dist/utils/has-keys.js.map +0 -1
  352. package/dist/utils/is-dev-env.js +0 -19
  353. package/dist/utils/is-dev-env.js.map +0 -1
  354. package/dist/utils/is-valid-element-type.js +0 -15
  355. package/dist/utils/is-valid-element-type.js.map +0 -1
  356. package/dist/utils/merge-styles.d.ts +0 -7
  357. package/dist/utils/merge-styles.js.map +0 -1
  358. package/dist/utils/mod-attrs.d.ts +0 -6
  359. package/dist/utils/mod-attrs.js +0 -20
  360. package/dist/utils/mod-attrs.js.map +0 -1
  361. package/dist/utils/process-tokens.d.ts +0 -17
  362. package/dist/utils/process-tokens.js +0 -83
  363. package/dist/utils/process-tokens.js.map +0 -1
  364. package/dist/utils/resolve-recipes.d.ts +0 -17
  365. package/dist/utils/resolve-recipes.js +0 -146
  366. package/dist/utils/resolve-recipes.js.map +0 -1
  367. package/dist/utils/selector-transform.js +0 -32
  368. package/dist/utils/selector-transform.js.map +0 -1
  369. package/dist/utils/string.js +0 -8
  370. package/dist/utils/string.js.map +0 -1
  371. package/dist/utils/styles.d.ts +0 -99
  372. package/dist/utils/styles.js +0 -220
  373. package/dist/utils/styles.js.map +0 -1
  374. package/dist/utils/typography.d.ts +0 -47
  375. package/dist/utils/typography.js +0 -51
  376. package/dist/utils/typography.js.map +0 -1
  377. package/dist/utils/warnings.d.ts +0 -16
  378. package/dist/utils/warnings.js +0 -16
  379. package/dist/utils/warnings.js.map +0 -1
  380. package/dist/zero/css-writer.d.ts +0 -45
  381. package/dist/zero/css-writer.js +0 -73
  382. package/dist/zero/css-writer.js.map +0 -1
  383. package/dist/zero/extractor.d.ts +0 -24
  384. package/dist/zero/extractor.js +0 -266
  385. package/dist/zero/extractor.js.map +0 -1
  386. package/docs/PIPELINE.md +0 -519
  387. package/docs/runtime.md +0 -572
package/dist/config.d.ts DELETED
@@ -1,366 +0,0 @@
1
- import { CounterStyleDescriptors, FontFaceInput, GCConfig, 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
- /** Force text injection mode, auto-detected in test environments (default: auto) */
19
- forceTextInjection?: boolean;
20
- /** Enable development mode features: performance metrics and debug info (default: auto) */
21
- devMode?: boolean;
22
- /**
23
- * Global predefined states for advanced state mapping.
24
- * These are state aliases that can be used in any component.
25
- * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
26
- */
27
- states?: Record<string, string>;
28
- /**
29
- * Parser LRU cache size (default: 1000).
30
- * Larger values improve performance for apps with many unique style values.
31
- */
32
- parserCacheSize?: number;
33
- /**
34
- * Custom units for the style parser (merged with built-in units).
35
- * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
36
- * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
37
- */
38
- units?: Record<string, string | UnitHandler>;
39
- /**
40
- * Custom functions for the style parser (merged with existing).
41
- * Functions process parsed style groups and return CSS values.
42
- * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
43
- */
44
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
45
- /**
46
- * Color space used for decomposed color token companion variables.
47
- * Controls the CSS function and suffix for alpha composition.
48
- *
49
- * - `'rgb'` — suffix `-rgb`, e.g. `rgb(var(--name-color-rgb) / .5)`
50
- * - `'hsl'` — suffix `-hsl`, e.g. `hsl(var(--name-color-hsl) / .5)`
51
- * - `'oklch'` — suffix `-oklch`, e.g. `oklch(var(--name-color-oklch) / .5)`
52
- *
53
- * @default 'oklch'
54
- */
55
- colorSpace?: ColorSpace;
56
- /**
57
- * Automatically infer and register CSS @property declarations
58
- * from custom property values found in styles, keyframes, and global config.
59
- * Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
60
- * When false, only explicitly declared @properties are registered.
61
- * @default true
62
- */
63
- autoPropertyTypes?: boolean;
64
- /**
65
- * Garbage collection configuration for unused styles.
66
- * Controls popularity-aware style eviction with DOM safety guard.
67
- * @example
68
- * ```ts
69
- * configure({
70
- * gc: { auto: true, baseMaxAge: 60000, cooldown: 30000 },
71
- * });
72
- * ```
73
- */
74
- gc?: GCConfig;
75
- /**
76
- * Plugins that extend tasty with custom functions, units, or states.
77
- * Plugins are processed in order, with later plugins overriding earlier ones.
78
- * @example
79
- * ```ts
80
- * import { okhslPlugin } from '@tenphi/tasty';
81
- *
82
- * configure({
83
- * plugins: [okhslPlugin()],
84
- * });
85
- * ```
86
- */
87
- plugins?: TastyPlugin[];
88
- /**
89
- * Global keyframes definitions that can be referenced by animation names in styles.
90
- * Keys are animation names, values are keyframes step definitions.
91
- * Keyframes are only injected when actually used in styles.
92
- * @example
93
- * ```ts
94
- * configure({
95
- * keyframes: {
96
- * fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
97
- * pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
98
- * },
99
- * });
100
- * ```
101
- */
102
- keyframes?: Record<string, KeyframesSteps>;
103
- /**
104
- * Global CSS @property definitions for custom properties.
105
- * Keys use tasty token syntax ($name for properties, #name for colors).
106
- *
107
- * Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
108
- * `#black`, `#clear`, `#border`, etc.) that are always included.
109
- * Properties you specify here are merged on top, so you can override any
110
- * default by using the same key.
111
- *
112
- * For color tokens (#name), `syntax: '<color>'` is auto-set and
113
- * `initialValue` defaults to `'transparent'` if not specified.
114
- *
115
- * @example
116
- * ```ts
117
- * configure({
118
- * properties: {
119
- * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
120
- * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
121
- * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
122
- * // Override a default property:
123
- * '$gap': { syntax: '<length>', inherits: true, initialValue: '8px' },
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