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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +314 -159
  2. package/dist/async-storage-B7_o6FKt.js +44 -0
  3. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  4. package/dist/collector-C-keQH9m.js +243 -0
  5. package/dist/collector-C-keQH9m.js.map +1 -0
  6. package/dist/collector-osfWTeRd.d.ts +108 -0
  7. package/dist/config-BBiyxMCe.js +10559 -0
  8. package/dist/config-BBiyxMCe.js.map +1 -0
  9. package/dist/config-BoZDUHW5.d.ts +945 -0
  10. package/dist/context-CkSg-kDT.js +24 -0
  11. package/dist/context-CkSg-kDT.js.map +1 -0
  12. package/dist/core/index.d.ts +5 -33
  13. package/dist/core/index.js +6 -26
  14. package/dist/core-BO4319td.js +1598 -0
  15. package/dist/core-BO4319td.js.map +1 -0
  16. package/dist/css-writer-BWvwQzz0.js +351 -0
  17. package/dist/css-writer-BWvwQzz0.js.map +1 -0
  18. package/dist/format-global-rules-Dbc_1tc3.js +22 -0
  19. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  20. package/dist/format-rules-BSjeH4Z7.js +143 -0
  21. package/dist/format-rules-BSjeH4Z7.js.map +1 -0
  22. package/dist/hydrate-CcvrP4qJ.js +45 -0
  23. package/dist/hydrate-CcvrP4qJ.js.map +1 -0
  24. package/dist/index-B_k47mc_.d.ts +1655 -0
  25. package/dist/index-tcHuMPFt.d.ts +1286 -0
  26. package/dist/index.d.ts +5 -48
  27. package/dist/index.js +731 -32
  28. package/dist/index.js.map +1 -0
  29. package/dist/keyframes-BUQhdOSJ.js +588 -0
  30. package/dist/keyframes-BUQhdOSJ.js.map +1 -0
  31. package/dist/{utils/merge-styles.d.ts → merge-styles-BMWcH6MF.d.ts} +3 -3
  32. package/dist/{utils/merge-styles.js → merge-styles-Cd2vBl9b.js} +4 -6
  33. package/dist/merge-styles-Cd2vBl9b.js.map +1 -0
  34. package/dist/{utils/resolve-recipes.js → resolve-recipes-C1nrvnYh.js} +5 -8
  35. package/dist/resolve-recipes-C1nrvnYh.js.map +1 -0
  36. package/dist/ssr/astro-client.d.ts +1 -0
  37. package/dist/ssr/astro-client.js +19 -0
  38. package/dist/ssr/astro-client.js.map +1 -0
  39. package/dist/ssr/astro-middleware.d.ts +15 -0
  40. package/dist/ssr/astro-middleware.js +19 -0
  41. package/dist/ssr/astro-middleware.js.map +1 -0
  42. package/dist/ssr/astro.d.ts +97 -0
  43. package/dist/ssr/astro.js +149 -0
  44. package/dist/ssr/astro.js.map +1 -0
  45. package/dist/ssr/index.d.ts +44 -0
  46. package/dist/ssr/index.js +10 -0
  47. package/dist/ssr/index.js.map +1 -0
  48. package/dist/ssr/next.d.ts +46 -0
  49. package/dist/ssr/next.js +75 -0
  50. package/dist/ssr/next.js.map +1 -0
  51. package/dist/static/index.d.ts +91 -5
  52. package/dist/static/index.js +49 -4
  53. package/dist/static/index.js.map +1 -0
  54. package/dist/static/inject.d.ts +5 -0
  55. package/dist/static/inject.js +17 -0
  56. package/dist/static/inject.js.map +1 -0
  57. package/dist/zero/babel.d.ts +57 -84
  58. package/dist/zero/babel.js +232 -40
  59. package/dist/zero/babel.js.map +1 -1
  60. package/dist/zero/index.d.ts +67 -3
  61. package/dist/zero/index.js +2 -4
  62. package/dist/zero/next.d.ts +56 -30
  63. package/dist/zero/next.js +105 -40
  64. package/dist/zero/next.js.map +1 -1
  65. package/docs/README.md +31 -0
  66. package/docs/adoption.md +298 -0
  67. package/docs/comparison.md +419 -0
  68. package/docs/configuration.md +438 -0
  69. package/docs/debug.md +320 -0
  70. package/docs/design-system.md +436 -0
  71. package/docs/dsl.md +690 -0
  72. package/docs/getting-started.md +217 -0
  73. package/docs/injector.md +544 -0
  74. package/docs/methodology.md +642 -0
  75. package/docs/pipeline.md +699 -0
  76. package/docs/react-api.md +581 -0
  77. package/docs/ssr.md +444 -0
  78. package/docs/styles.md +598 -0
  79. package/docs/tasty-static.md +547 -0
  80. package/package.json +70 -37
  81. package/tasty.config.ts +1 -0
  82. package/dist/_virtual/_rolldown/runtime.js +0 -8
  83. package/dist/chunks/cacheKey.js +0 -70
  84. package/dist/chunks/cacheKey.js.map +0 -1
  85. package/dist/chunks/definitions.d.ts +0 -37
  86. package/dist/chunks/definitions.js +0 -260
  87. package/dist/chunks/definitions.js.map +0 -1
  88. package/dist/chunks/renderChunk.js +0 -61
  89. package/dist/chunks/renderChunk.js.map +0 -1
  90. package/dist/config.d.ts +0 -280
  91. package/dist/config.js +0 -403
  92. package/dist/config.js.map +0 -1
  93. package/dist/debug.d.ts +0 -204
  94. package/dist/debug.js +0 -733
  95. package/dist/debug.js.map +0 -1
  96. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  97. package/dist/hooks/useGlobalStyles.js +0 -56
  98. package/dist/hooks/useGlobalStyles.js.map +0 -1
  99. package/dist/hooks/useKeyframes.d.ts +0 -56
  100. package/dist/hooks/useKeyframes.js +0 -54
  101. package/dist/hooks/useKeyframes.js.map +0 -1
  102. package/dist/hooks/useProperty.d.ts +0 -79
  103. package/dist/hooks/useProperty.js +0 -91
  104. package/dist/hooks/useProperty.js.map +0 -1
  105. package/dist/hooks/useRawCSS.d.ts +0 -53
  106. package/dist/hooks/useRawCSS.js +0 -28
  107. package/dist/hooks/useRawCSS.js.map +0 -1
  108. package/dist/hooks/useStyles.d.ts +0 -40
  109. package/dist/hooks/useStyles.js +0 -169
  110. package/dist/hooks/useStyles.js.map +0 -1
  111. package/dist/injector/index.d.ts +0 -157
  112. package/dist/injector/index.js +0 -154
  113. package/dist/injector/index.js.map +0 -1
  114. package/dist/injector/injector.d.ts +0 -139
  115. package/dist/injector/injector.js +0 -404
  116. package/dist/injector/injector.js.map +0 -1
  117. package/dist/injector/sheet-manager.d.ts +0 -127
  118. package/dist/injector/sheet-manager.js +0 -714
  119. package/dist/injector/sheet-manager.js.map +0 -1
  120. package/dist/injector/types.d.ts +0 -135
  121. package/dist/keyframes/index.js +0 -206
  122. package/dist/keyframes/index.js.map +0 -1
  123. package/dist/parser/classify.js +0 -319
  124. package/dist/parser/classify.js.map +0 -1
  125. package/dist/parser/const.js +0 -33
  126. package/dist/parser/const.js.map +0 -1
  127. package/dist/parser/lru.js +0 -109
  128. package/dist/parser/lru.js.map +0 -1
  129. package/dist/parser/parser.d.ts +0 -25
  130. package/dist/parser/parser.js +0 -116
  131. package/dist/parser/parser.js.map +0 -1
  132. package/dist/parser/tokenizer.js +0 -69
  133. package/dist/parser/tokenizer.js.map +0 -1
  134. package/dist/parser/types.d.ts +0 -51
  135. package/dist/parser/types.js +0 -46
  136. package/dist/parser/types.js.map +0 -1
  137. package/dist/pipeline/conditions.d.ts +0 -134
  138. package/dist/pipeline/conditions.js +0 -406
  139. package/dist/pipeline/conditions.js.map +0 -1
  140. package/dist/pipeline/exclusive.js +0 -231
  141. package/dist/pipeline/exclusive.js.map +0 -1
  142. package/dist/pipeline/index.d.ts +0 -53
  143. package/dist/pipeline/index.js +0 -660
  144. package/dist/pipeline/index.js.map +0 -1
  145. package/dist/pipeline/materialize.js +0 -844
  146. package/dist/pipeline/materialize.js.map +0 -1
  147. package/dist/pipeline/parseStateKey.d.ts +0 -15
  148. package/dist/pipeline/parseStateKey.js +0 -438
  149. package/dist/pipeline/parseStateKey.js.map +0 -1
  150. package/dist/pipeline/simplify.js +0 -516
  151. package/dist/pipeline/simplify.js.map +0 -1
  152. package/dist/pipeline/warnings.js +0 -18
  153. package/dist/pipeline/warnings.js.map +0 -1
  154. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  155. package/dist/plugins/okhsl-plugin.js +0 -371
  156. package/dist/plugins/okhsl-plugin.js.map +0 -1
  157. package/dist/plugins/types.d.ts +0 -69
  158. package/dist/properties/index.js +0 -158
  159. package/dist/properties/index.js.map +0 -1
  160. package/dist/states/index.d.ts +0 -49
  161. package/dist/states/index.js +0 -416
  162. package/dist/states/index.js.map +0 -1
  163. package/dist/static/tastyStatic.d.ts +0 -46
  164. package/dist/static/tastyStatic.js +0 -31
  165. package/dist/static/tastyStatic.js.map +0 -1
  166. package/dist/static/types.d.ts +0 -49
  167. package/dist/static/types.js +0 -24
  168. package/dist/static/types.js.map +0 -1
  169. package/dist/styles/align.d.ts +0 -15
  170. package/dist/styles/align.js +0 -14
  171. package/dist/styles/align.js.map +0 -1
  172. package/dist/styles/border.d.ts +0 -25
  173. package/dist/styles/border.js +0 -114
  174. package/dist/styles/border.js.map +0 -1
  175. package/dist/styles/color.d.ts +0 -14
  176. package/dist/styles/color.js +0 -23
  177. package/dist/styles/color.js.map +0 -1
  178. package/dist/styles/createStyle.js +0 -77
  179. package/dist/styles/createStyle.js.map +0 -1
  180. package/dist/styles/dimension.js +0 -97
  181. package/dist/styles/dimension.js.map +0 -1
  182. package/dist/styles/display.d.ts +0 -37
  183. package/dist/styles/display.js +0 -67
  184. package/dist/styles/display.js.map +0 -1
  185. package/dist/styles/fade.d.ts +0 -15
  186. package/dist/styles/fade.js +0 -58
  187. package/dist/styles/fade.js.map +0 -1
  188. package/dist/styles/fill.d.ts +0 -42
  189. package/dist/styles/fill.js +0 -51
  190. package/dist/styles/fill.js.map +0 -1
  191. package/dist/styles/flow.d.ts +0 -16
  192. package/dist/styles/flow.js +0 -12
  193. package/dist/styles/flow.js.map +0 -1
  194. package/dist/styles/gap.d.ts +0 -31
  195. package/dist/styles/gap.js +0 -37
  196. package/dist/styles/gap.js.map +0 -1
  197. package/dist/styles/height.d.ts +0 -17
  198. package/dist/styles/height.js +0 -20
  199. package/dist/styles/height.js.map +0 -1
  200. package/dist/styles/index.d.ts +0 -2
  201. package/dist/styles/index.js +0 -9
  202. package/dist/styles/index.js.map +0 -1
  203. package/dist/styles/inset.d.ts +0 -52
  204. package/dist/styles/inset.js +0 -150
  205. package/dist/styles/inset.js.map +0 -1
  206. package/dist/styles/justify.d.ts +0 -15
  207. package/dist/styles/justify.js +0 -14
  208. package/dist/styles/justify.js.map +0 -1
  209. package/dist/styles/list.d.ts +0 -16
  210. package/dist/styles/list.js +0 -98
  211. package/dist/styles/list.js.map +0 -1
  212. package/dist/styles/margin.d.ts +0 -24
  213. package/dist/styles/margin.js +0 -104
  214. package/dist/styles/margin.js.map +0 -1
  215. package/dist/styles/outline.d.ts +0 -29
  216. package/dist/styles/outline.js +0 -65
  217. package/dist/styles/outline.js.map +0 -1
  218. package/dist/styles/padding.d.ts +0 -24
  219. package/dist/styles/padding.js +0 -104
  220. package/dist/styles/padding.js.map +0 -1
  221. package/dist/styles/predefined.d.ts +0 -73
  222. package/dist/styles/predefined.js +0 -241
  223. package/dist/styles/predefined.js.map +0 -1
  224. package/dist/styles/preset.d.ts +0 -47
  225. package/dist/styles/preset.js +0 -126
  226. package/dist/styles/preset.js.map +0 -1
  227. package/dist/styles/radius.d.ts +0 -14
  228. package/dist/styles/radius.js +0 -51
  229. package/dist/styles/radius.js.map +0 -1
  230. package/dist/styles/scrollbar.d.ts +0 -21
  231. package/dist/styles/scrollbar.js +0 -112
  232. package/dist/styles/scrollbar.js.map +0 -1
  233. package/dist/styles/shadow.d.ts +0 -14
  234. package/dist/styles/shadow.js +0 -24
  235. package/dist/styles/shadow.js.map +0 -1
  236. package/dist/styles/styledScrollbar.d.ts +0 -47
  237. package/dist/styles/styledScrollbar.js +0 -38
  238. package/dist/styles/styledScrollbar.js.map +0 -1
  239. package/dist/styles/transition.d.ts +0 -14
  240. package/dist/styles/transition.js +0 -158
  241. package/dist/styles/transition.js.map +0 -1
  242. package/dist/styles/types.d.ts +0 -498
  243. package/dist/styles/width.d.ts +0 -17
  244. package/dist/styles/width.js +0 -20
  245. package/dist/styles/width.js.map +0 -1
  246. package/dist/tasty.d.ts +0 -982
  247. package/dist/tasty.js +0 -206
  248. package/dist/tasty.js.map +0 -1
  249. package/dist/tokens/typography.d.ts +0 -19
  250. package/dist/tokens/typography.js +0 -237
  251. package/dist/tokens/typography.js.map +0 -1
  252. package/dist/types.d.ts +0 -184
  253. package/dist/utils/cache-wrapper.js +0 -26
  254. package/dist/utils/cache-wrapper.js.map +0 -1
  255. package/dist/utils/case-converter.js +0 -8
  256. package/dist/utils/case-converter.js.map +0 -1
  257. package/dist/utils/colors.d.ts +0 -5
  258. package/dist/utils/colors.js +0 -9
  259. package/dist/utils/colors.js.map +0 -1
  260. package/dist/utils/css-types.d.ts +0 -7
  261. package/dist/utils/dotize.d.ts +0 -26
  262. package/dist/utils/dotize.js +0 -122
  263. package/dist/utils/dotize.js.map +0 -1
  264. package/dist/utils/filter-base-props.d.ts +0 -15
  265. package/dist/utils/filter-base-props.js +0 -45
  266. package/dist/utils/filter-base-props.js.map +0 -1
  267. package/dist/utils/get-display-name.d.ts +0 -7
  268. package/dist/utils/get-display-name.js +0 -10
  269. package/dist/utils/get-display-name.js.map +0 -1
  270. package/dist/utils/hsl-to-rgb.js +0 -38
  271. package/dist/utils/hsl-to-rgb.js.map +0 -1
  272. package/dist/utils/is-dev-env.js +0 -19
  273. package/dist/utils/is-dev-env.js.map +0 -1
  274. package/dist/utils/is-valid-element-type.js +0 -15
  275. package/dist/utils/is-valid-element-type.js.map +0 -1
  276. package/dist/utils/merge-styles.js.map +0 -1
  277. package/dist/utils/mod-attrs.d.ts +0 -8
  278. package/dist/utils/mod-attrs.js +0 -21
  279. package/dist/utils/mod-attrs.js.map +0 -1
  280. package/dist/utils/okhsl-to-rgb.js +0 -296
  281. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  282. package/dist/utils/process-tokens.d.ts +0 -31
  283. package/dist/utils/process-tokens.js +0 -171
  284. package/dist/utils/process-tokens.js.map +0 -1
  285. package/dist/utils/resolve-recipes.d.ts +0 -17
  286. package/dist/utils/resolve-recipes.js.map +0 -1
  287. package/dist/utils/string.js +0 -8
  288. package/dist/utils/string.js.map +0 -1
  289. package/dist/utils/styles.d.ts +0 -178
  290. package/dist/utils/styles.js +0 -590
  291. package/dist/utils/styles.js.map +0 -1
  292. package/dist/utils/typography.d.ts +0 -36
  293. package/dist/utils/typography.js +0 -53
  294. package/dist/utils/typography.js.map +0 -1
  295. package/dist/utils/warnings.d.ts +0 -16
  296. package/dist/utils/warnings.js +0 -16
  297. package/dist/utils/warnings.js.map +0 -1
  298. package/dist/zero/css-writer.d.ts +0 -45
  299. package/dist/zero/css-writer.js +0 -74
  300. package/dist/zero/css-writer.js.map +0 -1
  301. package/dist/zero/extractor.d.ts +0 -24
  302. package/dist/zero/extractor.js +0 -150
  303. package/dist/zero/extractor.js.map +0 -1
@@ -1,61 +0,0 @@
1
- import { extractLocalPredefinedStates } from "../states/index.js";
2
- import { renderStyles } from "../pipeline/index.js";
3
- import { CHUNK_NAMES } from "./definitions.js";
4
-
5
- //#region src/chunks/renderChunk.ts
6
- /**
7
- * Render styles for a specific chunk.
8
- *
9
- * Creates a filtered styles object containing only the keys for this chunk,
10
- * then delegates to the existing renderStyles function.
11
- *
12
- * IMPORTANT: Local predefined states (e.g., '@mobile': '@media(w < 600px)')
13
- * are always included in the filtered styles, regardless of which chunk is
14
- * being rendered. This ensures that state references like '@mobile' in any
15
- * chunk can be properly resolved by the pipeline.
16
- *
17
- * @param styles - The full styles object
18
- * @param chunkName - Name of the chunk being rendered
19
- * @param styleKeys - Keys of styles belonging to this chunk
20
- * @returns RenderResult with rules for this chunk
21
- */
22
- function renderStylesForChunk(styles, chunkName, styleKeys) {
23
- if (styleKeys.length === 0) return {
24
- rules: [],
25
- className: ""
26
- };
27
- if (chunkName === CHUNK_NAMES.SUBCOMPONENTS) return renderSubcomponentsChunk(styles, styleKeys);
28
- const localPredefinedStates = extractLocalPredefinedStates(styles);
29
- const filteredStyles = {};
30
- for (const [key, value] of Object.entries(localPredefinedStates)) filteredStyles[key] = value;
31
- for (const key of styleKeys) {
32
- const value = styles[key];
33
- if (value !== void 0) filteredStyles[key] = value;
34
- }
35
- return renderStyles(filteredStyles);
36
- }
37
- /**
38
- * Render the subcomponents chunk.
39
- *
40
- * Subcomponents (selectors like Label, &::before, etc.) contain nested
41
- * style objects that need to be preserved in their entirety.
42
- *
43
- * @param styles - The full styles object
44
- * @param selectorKeys - Keys of selectors in this chunk
45
- * @returns RenderResult with rules for all subcomponents
46
- */
47
- function renderSubcomponentsChunk(styles, selectorKeys) {
48
- const localPredefinedStates = extractLocalPredefinedStates(styles);
49
- const filteredStyles = {};
50
- for (const [key, value] of Object.entries(localPredefinedStates)) filteredStyles[key] = value;
51
- for (const key of selectorKeys) {
52
- const value = styles[key];
53
- if (value !== void 0) filteredStyles[key] = value;
54
- }
55
- if (styles.$ !== void 0) filteredStyles.$ = styles.$;
56
- return renderStyles(filteredStyles);
57
- }
58
-
59
- //#endregion
60
- export { renderStylesForChunk };
61
- //# 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 { renderStyles } from '../pipeline';\nimport { extractLocalPredefinedStates } from '../states';\nimport type { Styles } from '../styles/types';\n\nimport { CHUNK_NAMES } from './definitions';\n\n/**\n * Render styles for a specific chunk.\n *\n * Creates a filtered styles object containing only the keys for this chunk,\n * then delegates to the existing renderStyles function.\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): RenderResult {\n // Empty chunk - return empty result\n if (styleKeys.length === 0) {\n return { rules: [], className: '' };\n }\n\n // For subcomponents, we need to preserve the nested structure\n if (chunkName === CHUNK_NAMES.SUBCOMPONENTS) {\n return renderSubcomponentsChunk(styles, styleKeys);\n }\n\n // Extract local predefined states from the full styles object\n // These must be included for state resolution to work across chunks\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n\n // For regular chunks, create a filtered styles object\n // This is memory-efficient: we only create a shallow copy with filtered keys\n const filteredStyles: Styles = {};\n\n // First, add local predefined states so they're available for resolution\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n // Then add the chunk's style keys\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n // Delegate to existing renderStyles\n return renderStyles(filteredStyles);\n}\n\n/**\n * Render the subcomponents chunk.\n *\n * Subcomponents (selectors like Label, &::before, etc.) contain nested\n * style objects that need to be preserved in their entirety.\n *\n * @param styles - The full styles object\n * @param selectorKeys - Keys of selectors in this chunk\n * @returns RenderResult with rules for all subcomponents\n */\nfunction renderSubcomponentsChunk(\n styles: Styles,\n selectorKeys: string[],\n): RenderResult {\n // Extract local predefined states from the full styles object\n // These must be included for state resolution to work in nested styles\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n\n // Create a styles object containing only the selector keys\n const filteredStyles: Styles = {};\n\n // First, add local predefined states so they're available for resolution\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n // Then add the selector keys\n for (const key of selectorKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n // Also copy the $ helper if present (used for selector combinators)\n if (styles.$ !== undefined) {\n filteredStyles.$ = styles.$;\n }\n\n // Delegate to existing renderStyles\n return renderStyles(filteredStyles);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,qBACd,QACA,WACA,WACc;AAEd,KAAI,UAAU,WAAW,EACvB,QAAO;EAAE,OAAO,EAAE;EAAE,WAAW;EAAI;AAIrC,KAAI,cAAc,YAAY,cAC5B,QAAO,yBAAyB,QAAQ,UAAU;CAKpD,MAAM,wBAAwB,6BAA6B,OAAO;CAIlE,MAAM,iBAAyB,EAAE;AAGjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAIxB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,OACZ,gBAAe,OAAO;;AAK1B,QAAO,aAAa,eAAe;;;;;;;;;;;;AAarC,SAAS,yBACP,QACA,cACc;CAGd,MAAM,wBAAwB,6BAA6B,OAAO;CAGlE,MAAM,iBAAyB,EAAE;AAGjC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,sBAAsB,CAC9D,gBAAe,OAAO;AAIxB,MAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,OACZ,gBAAe,OAAO;;AAK1B,KAAI,OAAO,MAAM,OACf,gBAAe,IAAI,OAAO;AAI5B,QAAO,aAAa,eAAe"}
package/dist/config.d.ts DELETED
@@ -1,280 +0,0 @@
1
- import { KeyframesSteps, PropertyDefinition } from "./injector/types.js";
2
- import { StyleDetails, UnitHandler } from "./parser/types.js";
3
- import { StyleHandlerDefinition } from "./utils/styles.js";
4
- import { RecipeStyles } from "./styles/types.js";
5
- import { StyleInjector } from "./injector/injector.js";
6
- import { TastyPlugin } from "./plugins/types.js";
7
-
8
- //#region src/config.d.ts
9
- /**
10
- * Configuration options for the Tasty style system
11
- */
12
- interface TastyConfig {
13
- /** CSP nonce for style elements */
14
- nonce?: string;
15
- /** Maximum rules per stylesheet (default: 8192) */
16
- maxRulesPerSheet?: number;
17
- /** Threshold for bulk cleanup of unused styles (default: 500) */
18
- unusedStylesThreshold?: number;
19
- /** Delay before bulk cleanup in ms, ignored if idleCleanup is true (default: 5000) */
20
- bulkCleanupDelay?: number;
21
- /** Use requestIdleCallback for cleanup when available (default: true) */
22
- idleCleanup?: boolean;
23
- /** Force text injection mode, auto-detected in test environments (default: auto) */
24
- forceTextInjection?: boolean;
25
- /** Enable development mode features: performance metrics and debug info (default: auto) */
26
- devMode?: boolean;
27
- /**
28
- * Ratio of unused styles to delete per bulk cleanup run (0..1).
29
- * Defaults to 0.5 (oldest half) to reduce risk of removing styles
30
- * that may be restored shortly after being marked unused.
31
- */
32
- bulkCleanupBatchRatio?: number;
33
- /**
34
- * Minimum age (in ms) a style must remain unused before eligible for deletion.
35
- * Helps avoid races during rapid mount/unmount cycles. Default: 10000ms.
36
- */
37
- unusedStylesMinAgeMs?: number;
38
- /**
39
- * Global predefined states for advanced state mapping.
40
- * These are state aliases that can be used in any component.
41
- * Example: { '@mobile': '@media(w < 920px)', '@dark': '@root(theme=dark)' }
42
- */
43
- states?: Record<string, string>;
44
- /**
45
- * Parser LRU cache size (default: 1000).
46
- * Larger values improve performance for apps with many unique style values.
47
- */
48
- parserCacheSize?: number;
49
- /**
50
- * Custom units for the style parser (merged with built-in units).
51
- * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
52
- * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
53
- */
54
- units?: Record<string, string | UnitHandler>;
55
- /**
56
- * Custom functions for the style parser (merged with existing).
57
- * Functions process parsed style groups and return CSS values.
58
- * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
59
- */
60
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
61
- /**
62
- * Plugins that extend tasty with custom functions, units, or states.
63
- * Plugins are processed in order, with later plugins overriding earlier ones.
64
- * @example
65
- * ```ts
66
- * import { okhslPlugin } from '@tenphi/tasty';
67
- *
68
- * configure({
69
- * plugins: [okhslPlugin()],
70
- * });
71
- * ```
72
- */
73
- plugins?: TastyPlugin[];
74
- /**
75
- * Global keyframes definitions that can be referenced by animation names in styles.
76
- * Keys are animation names, values are keyframes step definitions.
77
- * Keyframes are only injected when actually used in styles.
78
- * @example
79
- * ```ts
80
- * configure({
81
- * keyframes: {
82
- * fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } },
83
- * pulse: { '0%, 100%': { transform: 'scale(1)' }, '50%': { transform: 'scale(1.05)' } },
84
- * },
85
- * });
86
- * ```
87
- */
88
- keyframes?: Record<string, KeyframesSteps>;
89
- /**
90
- * Global CSS @property definitions for custom properties.
91
- * Keys use tasty token syntax ($name for properties, #name for colors).
92
- * Properties are only injected when the component using them is rendered.
93
- *
94
- * For color tokens (#name), `syntax: '<color>'` is auto-set and
95
- * `initialValue` defaults to `'transparent'` if not specified.
96
- *
97
- * @example
98
- * ```ts
99
- * configure({
100
- * properties: {
101
- * '$rotation': { syntax: '<angle>', initialValue: '0deg' },
102
- * '$scale': { syntax: '<number>', inherits: false, initialValue: 1 },
103
- * '#accent': { initialValue: 'purple' }, // syntax: '<color>' auto-set
104
- * },
105
- * });
106
- *
107
- * // Now use in styles - properties are registered when component renders:
108
- * const Spinner = tasty({
109
- * styles: {
110
- * transform: 'rotate($rotation)',
111
- * transition: '$$rotation 0.3s', // outputs: --rotation 0.3s
112
- * },
113
- * });
114
- * ```
115
- */
116
- properties?: Record<string, PropertyDefinition>;
117
- /**
118
- * Custom style handlers that transform style properties into CSS declarations.
119
- * Handlers replace built-in handlers for the same style name.
120
- * @example
121
- * ```ts
122
- * import { styleHandlers } from '@tenphi/tasty';
123
- *
124
- * configure({
125
- * handlers: {
126
- * // Override fill with custom behavior
127
- * fill: ({ fill }) => {
128
- * if (fill?.startsWith('gradient:')) {
129
- * return { background: fill.slice(9) };
130
- * }
131
- * return styleHandlers.fill({ fill });
132
- * },
133
- * // Add new custom style
134
- * elevation: ({ elevation }) => {
135
- * const level = parseInt(elevation) || 1;
136
- * return {
137
- * 'box-shadow': `0 ${level * 2}px ${level * 4}px rgba(0,0,0,0.1)`,
138
- * 'z-index': String(level * 100),
139
- * };
140
- * },
141
- * },
142
- * });
143
- * ```
144
- */
145
- handlers?: Record<string, StyleHandlerDefinition>;
146
- /**
147
- * Predefined tokens that are replaced during style parsing.
148
- * Token values are processed through the parser (like component tokens).
149
- * Use `$name` for custom properties and `#name` for color tokens.
150
- *
151
- * For color tokens (#name), boolean `true` is converted to `transparent`.
152
- *
153
- * @example
154
- * ```ts
155
- * configure({
156
- * tokens: {
157
- * $spacing: '2x',
158
- * '$card-padding': '4x',
159
- * '#accent': '#purple',
160
- * '#surface': '#white',
161
- * '#overlay': true, // → transparent
162
- * },
163
- * });
164
- *
165
- * // Now use in styles - tokens are replaced at parse time:
166
- * const Card = tasty({
167
- * styles: {
168
- * padding: '$card-padding', // → calc(4 * var(--gap))
169
- * fill: '#surface', // → var(--white-color)
170
- * },
171
- * });
172
- * ```
173
- */
174
- tokens?: Record<`$${string}`, string | number | boolean> & Record<`#${string}`, string | number | boolean>;
175
- /**
176
- * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
177
- * Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
178
- * tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@properties`.
179
- *
180
- * Components reference recipes via: `recipe: 'name1 name2'` in their styles.
181
- * Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
182
- * Use `none` to skip base recipes: `recipe: 'none / post1'`.
183
- * Resolution order: `base_recipes → component styles → post_recipes`.
184
- *
185
- * Recipes cannot reference other recipes.
186
- *
187
- * @example
188
- * ```ts
189
- * configure({
190
- * recipes: {
191
- * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
192
- * elevated: { shadow: '2x 2x 4x #shadow' },
193
- * },
194
- * });
195
- *
196
- * // Usage in styles:
197
- * const Card = tasty({
198
- * styles: {
199
- * recipe: 'card elevated',
200
- * color: '#text', // Overrides recipe values
201
- * },
202
- * });
203
- * ```
204
- */
205
- recipes?: Record<string, RecipeStyles>;
206
- }
207
- declare const GLOBAL_INJECTOR_KEY = "__TASTY_GLOBAL_INJECTOR__";
208
- declare global {
209
- interface Window {
210
- [GLOBAL_INJECTOR_KEY]?: StyleInjector;
211
- }
212
- var __TASTY_GLOBAL_INJECTOR__: StyleInjector | undefined;
213
- }
214
- /**
215
- * Detect if we're running in a test environment
216
- */
217
- declare function isTestEnvironment(): boolean;
218
- /**
219
- * Check if styles have been generated (configuration is locked)
220
- */
221
- declare function hasStylesGenerated(): boolean;
222
- /**
223
- * Check if any global keyframes are configured.
224
- * Fast path: returns false if no keyframes were ever set.
225
- */
226
- declare function hasGlobalKeyframes(): boolean;
227
- /**
228
- * Get global keyframes configuration.
229
- * Returns null if no keyframes configured (fast path for zero-overhead).
230
- */
231
- declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
232
- /**
233
- * Check if any global recipes are configured.
234
- * Fast path: returns false if no recipes were ever set.
235
- */
236
- declare function hasGlobalRecipes(): boolean;
237
- /**
238
- * Get global recipes configuration.
239
- * Returns null if no recipes configured (fast path for zero-overhead).
240
- */
241
- declare function getGlobalRecipes(): Record<string, RecipeStyles> | null;
242
- /**
243
- * Check if configuration is locked (styles have been generated)
244
- */
245
- declare function isConfigLocked(): boolean;
246
- /**
247
- * Configure the Tasty style system.
248
- *
249
- * Must be called BEFORE any styles are generated (before first render that uses tasty).
250
- * After styles are generated, configuration is locked and calls to configure() will
251
- * emit a warning and be ignored.
252
- *
253
- * @example
254
- * ```ts
255
- * import { configure } from '@tenphi/tasty';
256
- *
257
- * // Configure before app renders
258
- * configure({
259
- * nonce: 'abc123',
260
- * states: {
261
- * '@mobile': '@media(w < 768px)',
262
- * '@dark': '@root(theme=dark)',
263
- * },
264
- * });
265
- * ```
266
- */
267
- declare function configure(config?: Partial<TastyConfig>): void;
268
- /**
269
- * Get the current configuration.
270
- * If not configured, returns default configuration.
271
- */
272
- declare function getConfig(): TastyConfig;
273
- /**
274
- * Reset configuration (for testing only).
275
- * Clears the global injector and allows reconfiguration.
276
- */
277
- declare function resetConfig(): void;
278
- //#endregion
279
- export { TastyConfig, configure, getConfig, getGlobalKeyframes, getGlobalRecipes, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, isConfigLocked, isTestEnvironment, resetConfig };
280
- //# sourceMappingURL=config.d.ts.map