@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbfcd75

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 (370) hide show
  1. package/README.md +196 -140
  2. package/dist/babel-Zs1Q03qt.d.ts +83 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/chunks/collector-B0LTHw6Z.js +208 -0
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/css-resources-BN8apgxt.js +142 -0
  14. package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
  15. package/dist/{debug.js → chunks/debug-C9LeNVoJ.js} +187 -139
  16. package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
  17. package/dist/chunks/dsl-C5yuAn41.js +1373 -0
  18. package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
  22. package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
  23. package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
  24. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-DWA4LjIa.js} +55 -55
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-B6EnYcXY.js} +89 -82
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/collector-hl5KNH7k.d.ts +165 -0
  34. package/dist/config-DWL1ZYue.d.ts +1358 -0
  35. package/dist/core/index.d.ts +5 -34
  36. package/dist/core/index.js +9 -27
  37. package/dist/index-D9N9GV24.d.ts +1947 -0
  38. package/dist/index.d.ts +5 -51
  39. package/dist/index.js +11 -36
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-C_oMoJVd.d.ts} +3 -3
  41. package/dist/ssr/astro-client.js +6 -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 +7 -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 +7 -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 +204 -48
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +37 -4
  59. package/dist/ssr/index.js +6 -6
  60. package/dist/ssr/index.js.map +1 -1
  61. package/dist/ssr/next-config.d.ts +66 -0
  62. package/dist/ssr/next-config.js +124 -0
  63. package/dist/ssr/next-config.js.map +1 -0
  64. package/dist/ssr/next.d.ts +14 -5
  65. package/dist/ssr/next.js +31 -46
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +91 -5
  68. package/dist/static/index.js +31 -3
  69. package/dist/static/index.js.map +1 -0
  70. package/dist/static/inject.js.map +1 -1
  71. package/dist/types-jKZNpias.d.ts +1616 -0
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +82 -113
  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 +0 -31
  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 +229 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +37 -23
  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 +69 -37
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +744 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/{runtime.md → react-api.md} +176 -67
  95. package/docs/runtime-benchmarks.md +377 -0
  96. package/docs/ssr.md +350 -94
  97. package/docs/styles.md +108 -27
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +121 -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/compute-styles.d.ts +0 -31
  112. package/dist/compute-styles.js +0 -356
  113. package/dist/compute-styles.js.map +0 -1
  114. package/dist/config.d.ts +0 -372
  115. package/dist/config.js +0 -507
  116. package/dist/config.js.map +0 -1
  117. package/dist/counter-style/index.js +0 -51
  118. package/dist/counter-style/index.js.map +0 -1
  119. package/dist/debug.d.ts +0 -89
  120. package/dist/debug.js.map +0 -1
  121. package/dist/font-face/index.js +0 -63
  122. package/dist/font-face/index.js.map +0 -1
  123. package/dist/hooks/index.d.ts +0 -7
  124. package/dist/hooks/useCounterStyle.d.ts +0 -50
  125. package/dist/hooks/useCounterStyle.js +0 -45
  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 -69
  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 -77
  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 -63
  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 -108
  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 -34
  141. package/dist/hooks/useRawCSS.js.map +0 -1
  142. package/dist/hooks/useStyles.d.ts +0 -40
  143. package/dist/hooks/useStyles.js +0 -29
  144. package/dist/hooks/useStyles.js.map +0 -1
  145. package/dist/injector/index.d.ts +0 -166
  146. package/dist/injector/index.js +0 -166
  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 -60
  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/async-storage.d.ts +0 -17
  199. package/dist/ssr/async-storage.js +0 -34
  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 -219
  205. package/dist/ssr/collector.js.map +0 -1
  206. package/dist/ssr/format-global-rules.js +0 -22
  207. package/dist/ssr/format-global-rules.js.map +0 -1
  208. package/dist/ssr/format-keyframes.js +0 -69
  209. package/dist/ssr/format-keyframes.js.map +0 -1
  210. package/dist/ssr/format-property.js +0 -49
  211. package/dist/ssr/format-property.js.map +0 -1
  212. package/dist/ssr/format-rules.js +0 -73
  213. package/dist/ssr/format-rules.js.map +0 -1
  214. package/dist/ssr/hydrate.d.ts +0 -22
  215. package/dist/ssr/hydrate.js +0 -49
  216. package/dist/ssr/hydrate.js.map +0 -1
  217. package/dist/ssr/ssr-collector-ref.js +0 -12
  218. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  219. package/dist/states/index.d.ts +0 -49
  220. package/dist/states/index.js +0 -170
  221. package/dist/states/index.js.map +0 -1
  222. package/dist/static/tastyStatic.d.ts +0 -46
  223. package/dist/static/tastyStatic.js +0 -30
  224. package/dist/static/tastyStatic.js.map +0 -1
  225. package/dist/static/types.d.ts +0 -49
  226. package/dist/static/types.js +0 -24
  227. package/dist/static/types.js.map +0 -1
  228. package/dist/styles/border.d.ts +0 -25
  229. package/dist/styles/border.js +0 -120
  230. package/dist/styles/border.js.map +0 -1
  231. package/dist/styles/color.d.ts +0 -14
  232. package/dist/styles/color.js +0 -26
  233. package/dist/styles/color.js.map +0 -1
  234. package/dist/styles/const.js +0 -17
  235. package/dist/styles/const.js.map +0 -1
  236. package/dist/styles/createStyle.js +0 -79
  237. package/dist/styles/createStyle.js.map +0 -1
  238. package/dist/styles/dimension.js +0 -109
  239. package/dist/styles/dimension.js.map +0 -1
  240. package/dist/styles/directional.js +0 -133
  241. package/dist/styles/directional.js.map +0 -1
  242. package/dist/styles/display.d.ts +0 -30
  243. package/dist/styles/display.js +0 -73
  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 -62
  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 -38
  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 -24
  264. package/dist/styles/inset.js +0 -34
  265. package/dist/styles/inset.js.map +0 -1
  266. package/dist/styles/list.d.ts +0 -16
  267. package/dist/styles/list.js +0 -100
  268. package/dist/styles/list.js.map +0 -1
  269. package/dist/styles/margin.d.ts +0 -24
  270. package/dist/styles/margin.js +0 -32
  271. package/dist/styles/margin.js.map +0 -1
  272. package/dist/styles/outline.d.ts +0 -29
  273. package/dist/styles/outline.js +0 -55
  274. package/dist/styles/outline.js.map +0 -1
  275. package/dist/styles/padding.d.ts +0 -24
  276. package/dist/styles/padding.js +0 -32
  277. package/dist/styles/padding.js.map +0 -1
  278. package/dist/styles/placement.d.ts +0 -37
  279. package/dist/styles/placement.js +0 -74
  280. package/dist/styles/placement.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 -127
  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 -83
  289. package/dist/styles/radius.js.map +0 -1
  290. package/dist/styles/scrollMargin.d.ts +0 -24
  291. package/dist/styles/scrollMargin.js +0 -32
  292. package/dist/styles/scrollMargin.js.map +0 -1
  293. package/dist/styles/scrollbar.d.ts +0 -25
  294. package/dist/styles/scrollbar.js +0 -51
  295. package/dist/styles/scrollbar.js.map +0 -1
  296. package/dist/styles/shadow.d.ts +0 -14
  297. package/dist/styles/shadow.js +0 -25
  298. package/dist/styles/shadow.js.map +0 -1
  299. package/dist/styles/shared.js +0 -17
  300. package/dist/styles/shared.js.map +0 -1
  301. package/dist/styles/transition.d.ts +0 -14
  302. package/dist/styles/transition.js +0 -159
  303. package/dist/styles/transition.js.map +0 -1
  304. package/dist/styles/types.d.ts +0 -564
  305. package/dist/styles/width.d.ts +0 -17
  306. package/dist/styles/width.js +0 -19
  307. package/dist/styles/width.js.map +0 -1
  308. package/dist/tasty.d.ts +0 -134
  309. package/dist/tasty.js +0 -240
  310. package/dist/tasty.js.map +0 -1
  311. package/dist/types.d.ts +0 -184
  312. package/dist/utils/cache-wrapper.js +0 -21
  313. package/dist/utils/cache-wrapper.js.map +0 -1
  314. package/dist/utils/case-converter.js +0 -8
  315. package/dist/utils/case-converter.js.map +0 -1
  316. package/dist/utils/color-math.d.ts +0 -46
  317. package/dist/utils/color-math.js +0 -749
  318. package/dist/utils/color-math.js.map +0 -1
  319. package/dist/utils/color-space.d.ts +0 -5
  320. package/dist/utils/color-space.js +0 -228
  321. package/dist/utils/color-space.js.map +0 -1
  322. package/dist/utils/colors.d.ts +0 -5
  323. package/dist/utils/colors.js +0 -10
  324. package/dist/utils/colors.js.map +0 -1
  325. package/dist/utils/css-types.d.ts +0 -7
  326. package/dist/utils/dotize.d.ts +0 -26
  327. package/dist/utils/dotize.js +0 -122
  328. package/dist/utils/dotize.js.map +0 -1
  329. package/dist/utils/filter-base-props.d.ts +0 -15
  330. package/dist/utils/filter-base-props.js +0 -45
  331. package/dist/utils/filter-base-props.js.map +0 -1
  332. package/dist/utils/get-display-name.d.ts +0 -7
  333. package/dist/utils/get-display-name.js +0 -10
  334. package/dist/utils/get-display-name.js.map +0 -1
  335. package/dist/utils/has-keys.js +0 -13
  336. package/dist/utils/has-keys.js.map +0 -1
  337. package/dist/utils/is-dev-env.js +0 -19
  338. package/dist/utils/is-dev-env.js.map +0 -1
  339. package/dist/utils/is-valid-element-type.js +0 -15
  340. package/dist/utils/is-valid-element-type.js.map +0 -1
  341. package/dist/utils/merge-styles.js.map +0 -1
  342. package/dist/utils/mod-attrs.d.ts +0 -6
  343. package/dist/utils/mod-attrs.js +0 -20
  344. package/dist/utils/mod-attrs.js.map +0 -1
  345. package/dist/utils/process-tokens.d.ts +0 -17
  346. package/dist/utils/process-tokens.js +0 -83
  347. package/dist/utils/process-tokens.js.map +0 -1
  348. package/dist/utils/resolve-recipes.d.ts +0 -17
  349. package/dist/utils/resolve-recipes.js +0 -146
  350. package/dist/utils/resolve-recipes.js.map +0 -1
  351. package/dist/utils/selector-transform.js +0 -32
  352. package/dist/utils/selector-transform.js.map +0 -1
  353. package/dist/utils/string.js +0 -8
  354. package/dist/utils/string.js.map +0 -1
  355. package/dist/utils/styles.d.ts +0 -99
  356. package/dist/utils/styles.js +0 -220
  357. package/dist/utils/styles.js.map +0 -1
  358. package/dist/utils/typography.d.ts +0 -47
  359. package/dist/utils/typography.js +0 -51
  360. package/dist/utils/typography.js.map +0 -1
  361. package/dist/utils/warnings.d.ts +0 -16
  362. package/dist/utils/warnings.js +0 -16
  363. package/dist/utils/warnings.js.map +0 -1
  364. package/dist/zero/css-writer.d.ts +0 -45
  365. package/dist/zero/css-writer.js +0 -73
  366. package/dist/zero/css-writer.js.map +0 -1
  367. package/dist/zero/extractor.d.ts +0 -24
  368. package/dist/zero/extractor.js.map +0 -1
  369. package/docs/PIPELINE.md +0 -519
  370. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
package/dist/config.d.ts DELETED
@@ -1,372 +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
- *
113
- * Tasty ships with `DEFAULT_PROPERTIES` (e.g. `$gap`, `$radius`, `#white`,
114
- * `#black`, `#clear`, `#border`, etc.) that are always included.
115
- * Properties you specify here are merged on top, so you can override any
116
- * default by using the same key.
117
- *
118
- * For color tokens (#name), `syntax: '<color>'` is auto-set and
119
- * `initialValue` defaults to `'transparent'` if not specified.
120
- *
121
- * @example
122
- * ```ts
123
- * configure({
124
- * properties: {
125
- * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
126
- * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
127
- * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
128
- * // Override a default property:
129
- * '$gap': { syntax: '<length>', inherits: true, initialValue: '8px' },
130
- * },
131
- * });
132
- *
133
- * // Now use in styles - properties are registered when component renders:
134
- * const Spinner = tasty({
135
- * styles: {
136
- * transform: 'rotate($rotation)',
137
- * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
138
- * },
139
- * });
140
- * ```
141
- */
142
- properties?: Record<string, PropertyDefinition>;
143
- /**
144
- * Global @font-face definitions.
145
- * Keys are font-family names, values are descriptors or arrays of descriptors
146
- * (for multiple weights/styles of the same family).
147
- * Injected eagerly when styles are first generated.
148
- * @example
149
- * ```ts
150
- * configure({
151
- * fontFace: {
152
- * 'Brand Sans': [
153
- * { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
154
- * { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
155
- * ],
156
- * Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' },
157
- * },
158
- * });
159
- * ```
160
- */
161
- fontFace?: Record<string, FontFaceInput>;
162
- /**
163
- * Global @counter-style definitions.
164
- * Keys are counter-style names, values are descriptor objects.
165
- * Injected eagerly when styles are first generated.
166
- * @example
167
- * ```ts
168
- * configure({
169
- * counterStyle: {
170
- * thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
171
- * },
172
- * });
173
- * ```
174
- */
175
- counterStyle?: Record<string, CounterStyleDescriptors>;
176
- /**
177
- * Custom style handlers that transform style properties into CSS declarations.
178
- * Handlers replace built-in handlers for the same style name.
179
- * @example
180
- * ```ts
181
- * import { styleHandlers } from '@tenphi/tasty';
182
- *
183
- * configure({
184
- * handlers: {
185
- * // Override fill with custom behavior
186
- * fill: ({ fill }) => {
187
- * if (fill?.startsWith('gradient:')) {
188
- * return { background: fill.slice(9) };
189
- * }
190
- * return styleHandlers.fill({ fill });
191
- * },
192
- * // Add new custom style
193
- * elevation: ({ elevation }) => {
194
- * const level = parseInt(elevation) || 1;
195
- * return {
196
- * 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
197
- * 'z-index': String(level * 100),
198
- * };
199
- * },
200
- * },
201
- * });
202
- * ```
203
- */
204
- handlers?: Record<string, StyleHandlerDefinition>;
205
- /**
206
- * Design tokens injected as CSS custom properties on `:root`.
207
- * Values are parsed through the Tasty DSL. Supports state maps
208
- * for responsive/theme-aware tokens.
209
- *
210
- * - `$name` keys become `--name` CSS custom properties
211
- * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
212
- *
213
- * Tokens are injected once when the first style is rendered.
214
- *
215
- * @example
216
- * ```ts
217
- * configure({
218
- * tokens: {
219
- * '$gap': '4px',
220
- * '#primary': {
221
- * '': '#purple',
222
- * '@dark': '#light-purple',
223
- * },
224
- * },
225
- * });
226
- * ```
227
- */
228
- tokens?: ConfigTokens;
229
- /**
230
- * Predefined tokens that are replaced during style parsing (parse-time substitution).
231
- * Use `$name` for custom properties and `#name` for color tokens.
232
- * Values are substituted inline before CSS generation, unlike `tokens` which
233
- * inject CSS custom properties on `:root`.
234
- *
235
- * For color tokens (#name), boolean `true` is converted to `transparent`.
236
- *
237
- * @example
238
- * ```ts
239
- * configure({
240
- * replaceTokens: {
241
- * $spacing: '2x',
242
- * '#accent': '#purple',
243
- * '#overlay': true, // → transparent
244
- * },
245
- * });
246
- *
247
- * // Now use in styles - tokens are replaced at parse time:
248
- * const Card = tasty({
249
- * styles: {
250
- * padding: '$spacing', // → calc(2 * var(--gap))
251
- * fill: '#accent', // → var(--purple-color)
252
- * },
253
- * });
254
- * ```
255
- */
256
- replaceTokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
257
- /**
258
- * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
259
- * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
260
- * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
261
- *
262
- * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
263
- * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
264
- * Use `none` to skip base recipes: `recipe: 'none / post1'`.
265
- * Resolution order: `base_recipes → component styles → post_recipes`.
266
- *
267
- * Recipes cannot reference other recipes.
268
- *
269
- * @example
270
- * ```ts
271
- * configure({
272
- * recipes: {
273
- * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
274
- * elevated: { shadow: '2x 2x 4x #shadow' },
275
- * },
276
- * });
277
- *
278
- * // Usage in styles:
279
- * const Card = tasty({
280
- * styles: {
281
- * recipe: 'card elevated',
282
- * color: '#text', // Overrides recipe values
283
- * },
284
- * });
285
- * ```
286
- */
287
- recipes?: Record<string, RecipeStyles>;
288
- }
289
- declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
290
- declare global {
291
- interface Window {
292
- [GLOBAL_INJECTOR_KEY]?: StyleInjector;
293
- }
294
- var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
295
- }
296
- /**
297
- * Detect if we're running in a test environment
298
- */
299
- declare function isTestEnvironment(): boolean;
300
- /**
301
- * Check if styles have been generated (configuration is locked)
302
- */
303
- declare function hasStylesGenerated(): boolean;
304
- /**
305
- * Check if any global keyframes are configured.
306
- * Uses a pre-computed flag to avoid Object.keys() allocation on every call.
307
- */
308
- declare function hasGlobalKeyframes(): boolean;
309
- /**
310
- * Get global keyframes configuration.
311
- * Returns null if no keyframes configured (fast path for zero-overhead).
312
- */
313
- declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
314
- /**
315
- * Get global font-face configuration.
316
- * Returns null if no font faces configured.
317
- */
318
- declare function getGlobalFontFace(): Record<string, FontFaceInput> | null;
319
- /**
320
- * Get global counter-style configuration.
321
- * Returns null if no counter styles configured.
322
- */
323
- declare function getGlobalCounterStyle(): Record<string, CounterStyleDescriptors> | null;
324
- /**
325
- * Check if any global recipes are configured.
326
- * Fast path: returns false if no recipes were ever set.
327
- */
328
- declare function hasGlobalRecipes(): boolean;
329
- /**
330
- * Get global recipes configuration.
331
- * Returns null if no recipes configured (fast path for zero-overhead).
332
- */
333
- declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
334
- /**
335
- * Check if configuration is locked (styles have been generated)
336
- */
337
- declare function isConfigLocked(): boolean;
338
- /**
339
- * Configure the Tasty style system.
340
- *
341
- * Must be called BEFORE any styles are generated (before first render that uses tasty).
342
- * After styles are generated, configuration is locked and calls to configure() will
343
- * emit a warning and be ignored.
344
- *
345
- * @example
346
- * ```ts
347
- * import { configure } from '@tenphi/tasty';
348
- *
349
- * // Configure before app renders
350
- * configure({
351
- * nonce: 'abc123',
352
- * states: {
353
- * '@mobile': '@media(w < 768px)',
354
- * '@dark': '@root(theme=dark)',
355
- * },
356
- * });
357
- * ```
358
- */
359
- declare function configure(config?: Partial<TastyConfig>): void;
360
- /**
361
- * Get the current configuration.
362
- * If not configured, returns default configuration.
363
- */
364
- declare function getConfig(): TastyConfig;
365
- /**
366
- * Reset configuration (for testing only).
367
- * Clears the global injector and allows reconfiguration.
368
- */
369
- declare function resetConfig(): void;
370
- //#endregion
371
- export { TastyConfig, configure, getConfig, getGlobalCounterStyle, getGlobalFontFace, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig };
372
- //# sourceMappingURL=config.d.ts.map