@tenphi/tasty 0.0.0-snapshot.2705ab9 → 0.0.0-snapshot.275370e

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 (296) hide show
  1. package/README.md +26 -20
  2. package/dist/_virtual/_rolldown/runtime.js +1 -2
  3. package/dist/chunks/cacheKey.d.ts +1 -0
  4. package/dist/chunks/cacheKey.js +1 -2
  5. package/dist/chunks/cacheKey.js.map +1 -1
  6. package/dist/chunks/definitions.js +1 -2
  7. package/dist/chunks/definitions.js.map +1 -1
  8. package/dist/chunks/index.d.ts +1 -0
  9. package/dist/chunks/renderChunk.d.ts +1 -0
  10. package/dist/chunks/renderChunk.js +1 -2
  11. package/dist/chunks/renderChunk.js.map +1 -1
  12. package/dist/compute-styles.d.ts +31 -0
  13. package/dist/compute-styles.js +322 -0
  14. package/dist/compute-styles.js.map +1 -0
  15. package/dist/config.d.ts +61 -20
  16. package/dist/config.js +119 -32
  17. package/dist/config.js.map +1 -1
  18. package/dist/core/index.d.ts +6 -6
  19. package/dist/core/index.js +7 -7
  20. package/dist/counter-style/index.js +1 -1
  21. package/dist/counter-style/index.js.map +1 -1
  22. package/dist/debug.js +5 -6
  23. package/dist/debug.js.map +1 -1
  24. package/dist/font-face/index.js +1 -1
  25. package/dist/font-face/index.js.map +1 -1
  26. package/dist/hooks/index.d.ts +7 -0
  27. package/dist/hooks/useCounterStyle.d.ts +3 -17
  28. package/dist/hooks/useCounterStyle.js +56 -38
  29. package/dist/hooks/useCounterStyle.js.map +1 -1
  30. package/dist/hooks/useFontFace.d.ts +3 -1
  31. package/dist/hooks/useFontFace.js +22 -27
  32. package/dist/hooks/useFontFace.js.map +1 -1
  33. package/dist/hooks/useGlobalStyles.d.ts +18 -2
  34. package/dist/hooks/useGlobalStyles.js +52 -43
  35. package/dist/hooks/useGlobalStyles.js.map +1 -1
  36. package/dist/hooks/useKeyframes.d.ts +4 -2
  37. package/dist/hooks/useKeyframes.js +43 -53
  38. package/dist/hooks/useKeyframes.js.map +1 -1
  39. package/dist/hooks/useProperty.d.ts +4 -2
  40. package/dist/hooks/useProperty.js +30 -44
  41. package/dist/hooks/useProperty.js.map +1 -1
  42. package/dist/hooks/useRawCSS.d.ts +13 -44
  43. package/dist/hooks/useRawCSS.js +91 -24
  44. package/dist/hooks/useRawCSS.js.map +1 -1
  45. package/dist/hooks/useStyles.d.ts +3 -8
  46. package/dist/hooks/useStyles.js +7 -214
  47. package/dist/hooks/useStyles.js.map +1 -1
  48. package/dist/index.d.ts +7 -7
  49. package/dist/index.js +8 -8
  50. package/dist/injector/index.d.ts +18 -19
  51. package/dist/injector/index.js +25 -20
  52. package/dist/injector/index.js.map +1 -1
  53. package/dist/injector/injector.d.ts +35 -3
  54. package/dist/injector/injector.js +200 -14
  55. package/dist/injector/injector.js.map +1 -1
  56. package/dist/injector/sheet-manager.d.ts +9 -13
  57. package/dist/injector/sheet-manager.js +34 -69
  58. package/dist/injector/sheet-manager.js.map +1 -1
  59. package/dist/injector/types.d.ts +52 -21
  60. package/dist/keyframes/index.js +1 -1
  61. package/dist/parser/classify.js +1 -2
  62. package/dist/parser/classify.js.map +1 -1
  63. package/dist/parser/const.js +14 -3
  64. package/dist/parser/const.js.map +1 -1
  65. package/dist/parser/lru.js +1 -1
  66. package/dist/parser/lru.js.map +1 -1
  67. package/dist/parser/parser.js +1 -2
  68. package/dist/parser/parser.js.map +1 -1
  69. package/dist/parser/tokenizer.js +1 -1
  70. package/dist/parser/tokenizer.js.map +1 -1
  71. package/dist/parser/types.js +1 -1
  72. package/dist/parser/types.js.map +1 -1
  73. package/dist/pipeline/conditions.js +1 -1
  74. package/dist/pipeline/conditions.js.map +1 -1
  75. package/dist/pipeline/exclusive.js +58 -4
  76. package/dist/pipeline/exclusive.js.map +1 -1
  77. package/dist/pipeline/index.js +4 -5
  78. package/dist/pipeline/index.js.map +1 -1
  79. package/dist/pipeline/materialize.js +57 -4
  80. package/dist/pipeline/materialize.js.map +1 -1
  81. package/dist/pipeline/parseStateKey.js +5 -6
  82. package/dist/pipeline/parseStateKey.js.map +1 -1
  83. package/dist/pipeline/simplify.js +181 -7
  84. package/dist/pipeline/simplify.js.map +1 -1
  85. package/dist/pipeline/warnings.js +1 -1
  86. package/dist/plugins/index.d.ts +2 -0
  87. package/dist/plugins/okhsl-plugin.js +1 -2
  88. package/dist/plugins/okhsl-plugin.js.map +1 -1
  89. package/dist/plugins/types.d.ts +12 -1
  90. package/dist/properties/index.js +2 -3
  91. package/dist/properties/index.js.map +1 -1
  92. package/dist/properties/property-type-resolver.js +1 -2
  93. package/dist/properties/property-type-resolver.js.map +1 -1
  94. package/dist/rsc-cache.js +79 -0
  95. package/dist/rsc-cache.js.map +1 -0
  96. package/dist/ssr/astro-client.d.ts +1 -0
  97. package/dist/ssr/astro-client.js +19 -0
  98. package/dist/ssr/astro-client.js.map +1 -0
  99. package/dist/ssr/astro-middleware.d.ts +15 -0
  100. package/dist/ssr/astro-middleware.js +19 -0
  101. package/dist/ssr/astro-middleware.js.map +1 -0
  102. package/dist/ssr/astro.d.ts +89 -10
  103. package/dist/ssr/astro.js +113 -29
  104. package/dist/ssr/astro.js.map +1 -1
  105. package/dist/ssr/async-storage.js +15 -6
  106. package/dist/ssr/async-storage.js.map +1 -1
  107. package/dist/ssr/collect-auto-properties.js +29 -11
  108. package/dist/ssr/collect-auto-properties.js.map +1 -1
  109. package/dist/ssr/collector.d.ts +9 -13
  110. package/dist/ssr/collector.js +35 -27
  111. package/dist/ssr/collector.js.map +1 -1
  112. package/dist/ssr/context.js +4 -2
  113. package/dist/ssr/context.js.map +1 -1
  114. package/dist/ssr/format-global-rules.js +1 -1
  115. package/dist/ssr/format-keyframes.js +1 -2
  116. package/dist/ssr/format-keyframes.js.map +1 -1
  117. package/dist/ssr/format-property.js +1 -2
  118. package/dist/ssr/format-property.js.map +1 -1
  119. package/dist/ssr/format-rules.js +1 -1
  120. package/dist/ssr/hydrate.d.ts +20 -13
  121. package/dist/ssr/hydrate.js +25 -30
  122. package/dist/ssr/hydrate.js.map +1 -1
  123. package/dist/ssr/index.d.ts +3 -4
  124. package/dist/ssr/index.js +5 -7
  125. package/dist/ssr/index.js.map +1 -1
  126. package/dist/ssr/next.d.ts +6 -5
  127. package/dist/ssr/next.js +14 -10
  128. package/dist/ssr/next.js.map +1 -1
  129. package/dist/ssr/ssr-collector-ref.js +20 -3
  130. package/dist/ssr/ssr-collector-ref.js.map +1 -1
  131. package/dist/states/index.js +1 -2
  132. package/dist/states/index.js.map +1 -1
  133. package/dist/static/index.js +1 -2
  134. package/dist/static/inject.d.ts +5 -0
  135. package/dist/static/inject.js +17 -0
  136. package/dist/static/inject.js.map +1 -0
  137. package/dist/static/tastyStatic.js +1 -2
  138. package/dist/static/tastyStatic.js.map +1 -1
  139. package/dist/static/types.js +1 -1
  140. package/dist/styles/border.d.ts +1 -1
  141. package/dist/styles/border.js +28 -22
  142. package/dist/styles/border.js.map +1 -1
  143. package/dist/styles/color.d.ts +1 -1
  144. package/dist/styles/color.js +2 -3
  145. package/dist/styles/color.js.map +1 -1
  146. package/dist/styles/const.js +17 -0
  147. package/dist/styles/const.js.map +1 -0
  148. package/dist/styles/createStyle.js +4 -5
  149. package/dist/styles/createStyle.js.map +1 -1
  150. package/dist/styles/dimension.js +15 -3
  151. package/dist/styles/dimension.js.map +1 -1
  152. package/dist/styles/directional.js +133 -0
  153. package/dist/styles/directional.js.map +1 -0
  154. package/dist/styles/display.d.ts +3 -10
  155. package/dist/styles/display.js +45 -39
  156. package/dist/styles/display.js.map +1 -1
  157. package/dist/styles/fade.d.ts +1 -1
  158. package/dist/styles/fade.js +9 -5
  159. package/dist/styles/fade.js.map +1 -1
  160. package/dist/styles/fill.d.ts +2 -2
  161. package/dist/styles/fill.js +3 -4
  162. package/dist/styles/fill.js.map +1 -1
  163. package/dist/styles/flow.js +1 -1
  164. package/dist/styles/gap.d.ts +1 -1
  165. package/dist/styles/gap.js +4 -3
  166. package/dist/styles/gap.js.map +1 -1
  167. package/dist/styles/height.d.ts +1 -1
  168. package/dist/styles/height.js +1 -2
  169. package/dist/styles/height.js.map +1 -1
  170. package/dist/styles/index.d.ts +0 -1
  171. package/dist/styles/index.js +3 -4
  172. package/dist/styles/index.js.map +1 -1
  173. package/dist/styles/inset.d.ts +1 -29
  174. package/dist/styles/inset.js +19 -135
  175. package/dist/styles/inset.js.map +1 -1
  176. package/dist/styles/list.d.ts +5 -5
  177. package/dist/styles/list.js +4 -2
  178. package/dist/styles/list.js.map +1 -1
  179. package/dist/styles/margin.d.ts +1 -1
  180. package/dist/styles/margin.js +17 -89
  181. package/dist/styles/margin.js.map +1 -1
  182. package/dist/styles/outline.d.ts +1 -1
  183. package/dist/styles/outline.js +6 -16
  184. package/dist/styles/outline.js.map +1 -1
  185. package/dist/styles/padding.d.ts +1 -1
  186. package/dist/styles/padding.js +17 -89
  187. package/dist/styles/padding.js.map +1 -1
  188. package/dist/styles/placement.d.ts +37 -0
  189. package/dist/styles/placement.js +74 -0
  190. package/dist/styles/placement.js.map +1 -0
  191. package/dist/styles/predefined.d.ts +4 -4
  192. package/dist/styles/predefined.js +8 -9
  193. package/dist/styles/predefined.js.map +1 -1
  194. package/dist/styles/preset.d.ts +1 -1
  195. package/dist/styles/preset.js +7 -7
  196. package/dist/styles/preset.js.map +1 -1
  197. package/dist/styles/radius.d.ts +1 -3
  198. package/dist/styles/radius.js +38 -6
  199. package/dist/styles/radius.js.map +1 -1
  200. package/dist/styles/scrollMargin.d.ts +24 -0
  201. package/dist/styles/scrollMargin.js +32 -0
  202. package/dist/styles/scrollMargin.js.map +1 -0
  203. package/dist/styles/scrollbar.d.ts +1 -1
  204. package/dist/styles/scrollbar.js +8 -5
  205. package/dist/styles/scrollbar.js.map +1 -1
  206. package/dist/styles/shadow.d.ts +1 -1
  207. package/dist/styles/shadow.js +4 -3
  208. package/dist/styles/shadow.js.map +1 -1
  209. package/dist/styles/shared.js +17 -0
  210. package/dist/styles/shared.js.map +1 -0
  211. package/dist/styles/transition.d.ts +1 -1
  212. package/dist/styles/transition.js +5 -4
  213. package/dist/styles/transition.js.map +1 -1
  214. package/dist/styles/types.d.ts +24 -7
  215. package/dist/styles/width.d.ts +1 -1
  216. package/dist/styles/width.js +1 -2
  217. package/dist/styles/width.js.map +1 -1
  218. package/dist/tasty.d.ts +29 -14
  219. package/dist/tasty.js +78 -62
  220. package/dist/tasty.js.map +1 -1
  221. package/dist/utils/cache-wrapper.js +1 -2
  222. package/dist/utils/cache-wrapper.js.map +1 -1
  223. package/dist/utils/case-converter.js +1 -1
  224. package/dist/utils/color-math.js +1 -1
  225. package/dist/utils/color-math.js.map +1 -1
  226. package/dist/utils/color-space.js +1 -2
  227. package/dist/utils/color-space.js.map +1 -1
  228. package/dist/utils/colors.js +1 -2
  229. package/dist/utils/colors.js.map +1 -1
  230. package/dist/utils/deps-equal.js +15 -0
  231. package/dist/utils/deps-equal.js.map +1 -0
  232. package/dist/utils/dotize.js +1 -1
  233. package/dist/utils/dotize.js.map +1 -1
  234. package/dist/utils/filter-base-props.d.ts +1 -1
  235. package/dist/utils/filter-base-props.js +1 -1
  236. package/dist/utils/filter-base-props.js.map +1 -1
  237. package/dist/utils/get-display-name.js +1 -1
  238. package/dist/utils/has-keys.js +1 -1
  239. package/dist/utils/hash.js +14 -0
  240. package/dist/utils/hash.js.map +1 -0
  241. package/dist/utils/is-dev-env.js +1 -1
  242. package/dist/utils/is-dev-env.js.map +1 -1
  243. package/dist/utils/is-valid-element-type.js +1 -1
  244. package/dist/utils/merge-styles.js +1 -2
  245. package/dist/utils/merge-styles.js.map +1 -1
  246. package/dist/utils/mod-attrs.d.ts +0 -2
  247. package/dist/utils/mod-attrs.js +1 -2
  248. package/dist/utils/mod-attrs.js.map +1 -1
  249. package/dist/utils/process-tokens.d.ts +1 -5
  250. package/dist/utils/process-tokens.js +3 -11
  251. package/dist/utils/process-tokens.js.map +1 -1
  252. package/dist/utils/resolve-recipes.js +1 -2
  253. package/dist/utils/resolve-recipes.js.map +1 -1
  254. package/dist/utils/selector-transform.js +1 -1
  255. package/dist/utils/string.js +1 -1
  256. package/dist/utils/styles.d.ts +1 -1
  257. package/dist/utils/styles.js +2 -3
  258. package/dist/utils/styles.js.map +1 -1
  259. package/dist/utils/typography.d.ts +21 -10
  260. package/dist/utils/typography.js +2 -2
  261. package/dist/utils/typography.js.map +1 -1
  262. package/dist/utils/warnings.js +1 -1
  263. package/dist/zero/babel.d.ts +24 -110
  264. package/dist/zero/babel.js +130 -42
  265. package/dist/zero/babel.js.map +1 -1
  266. package/dist/zero/css-writer.js +1 -2
  267. package/dist/zero/css-writer.js.map +1 -1
  268. package/dist/zero/extractor.js +1 -2
  269. package/dist/zero/extractor.js.map +1 -1
  270. package/dist/zero/index.js +1 -2
  271. package/dist/zero/next.d.ts +12 -0
  272. package/dist/zero/next.js +5 -4
  273. package/dist/zero/next.js.map +1 -1
  274. package/docs/README.md +2 -2
  275. package/docs/adoption.md +5 -3
  276. package/docs/comparison.md +24 -25
  277. package/docs/configuration.md +69 -1
  278. package/docs/design-system.md +22 -10
  279. package/docs/dsl.md +23 -8
  280. package/docs/getting-started.md +10 -10
  281. package/docs/injector.md +41 -25
  282. package/docs/methodology.md +52 -3
  283. package/docs/{runtime.md → react-api.md} +104 -32
  284. package/docs/ssr.md +139 -81
  285. package/docs/styles.md +17 -0
  286. package/docs/tasty-static.md +101 -2
  287. package/package.json +20 -9
  288. package/dist/hooks/resolve-ssr-collector.js +0 -15
  289. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  290. package/dist/ssr/context.d.ts +0 -8
  291. package/dist/styles/align.d.ts +0 -15
  292. package/dist/styles/align.js +0 -14
  293. package/dist/styles/align.js.map +0 -1
  294. package/dist/styles/justify.d.ts +0 -15
  295. package/dist/styles/justify.js +0 -14
  296. package/dist/styles/justify.js.map +0 -1
@@ -157,14 +157,27 @@ module.exports = {
157
157
  | Option | Type | Default | Description |
158
158
  |--------|------|---------|-------------|
159
159
  | `output` | `string` | `'tasty.css'` | Path for generated CSS file |
160
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS (see [Inject Mode](#inject-mode)) |
160
161
  | `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. |
161
162
  | `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
162
163
  | `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
163
- | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases |
164
+ | `injectImport` | `boolean` | `true` | Replace `@tenphi/tasty/static` imports with an import of the generated CSS file. Set to `false` to manage CSS imports manually. |
165
+ | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases (e.g. `{ '@mobile': '@media(w < 768px)' }`) |
164
166
  | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
167
+ | `config.tokens` | `ConfigTokens` | — | Design tokens injected as CSS custom properties on `:root`. Values are parsed through the Tasty DSL. Supports state maps for responsive/themed tokens. |
168
+ | `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
165
169
  | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
170
+ | `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
166
171
  | `config.fontFace` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
167
172
  | `config.counterStyle` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
173
+ | `config.units` | `Record<string, string \| UnitHandler>` | — | Custom units for the style parser (merged with built-ins). E.g. `{ em: 'em', vw: 'vw' }` |
174
+ | `config.funcs` | `Record<string, Function>` | — | Custom functions for the style parser (merged with existing) |
175
+ | `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
176
+ | `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
177
+ | `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
178
+ | `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
179
+ | `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
180
+ | `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
168
181
 
169
182
  ---
170
183
 
@@ -224,6 +237,7 @@ export default withTastyZero({
224
237
  | Option | Type | Default | Description |
225
238
  |--------|------|---------|-------------|
226
239
  | `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
240
+ | `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
227
241
  | `enabled` | `boolean` | `true` | Enable/disable the plugin |
228
242
  | `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
229
243
  | `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
@@ -333,6 +347,91 @@ export const Button = () => <button className={button}>Click</button>;
333
347
 
334
348
  ---
335
349
 
350
+ ## Inject Mode
351
+
352
+ By default the Babel plugin writes CSS to a file (`mode: 'file'`). **Inject mode** (`mode: 'inject'`) embeds CSS inline in your JavaScript and injects it at runtime via a tiny injector. No CSS file is produced.
353
+
354
+ This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
355
+
356
+ ### How It Works
357
+
358
+ 1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
359
+ 2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
360
+ 3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
361
+ 4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
362
+
363
+ ### Configuration
364
+
365
+ ```javascript
366
+ // babel.config.js
367
+ module.exports = {
368
+ plugins: [
369
+ ['@tenphi/tasty/babel-plugin', {
370
+ mode: 'inject',
371
+ config: {
372
+ states: { '@mobile': '@media(w < 768px)' },
373
+ },
374
+ }]
375
+ ]
376
+ };
377
+ ```
378
+
379
+ With Next.js:
380
+
381
+ ```typescript
382
+ // next.config.ts
383
+ import { withTastyZero } from '@tenphi/tasty/next';
384
+
385
+ export default withTastyZero({
386
+ mode: 'inject',
387
+ configFile: './app/tasty-zero.config.ts',
388
+ })({
389
+ reactStrictMode: true,
390
+ });
391
+ ```
392
+
393
+ When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
394
+
395
+ ### Build Transformation (inject mode)
396
+
397
+ **Before:**
398
+
399
+ ```tsx
400
+ import { tastyStatic } from '@tenphi/tasty/static';
401
+
402
+ const button = tastyStatic({
403
+ padding: '2x 4x',
404
+ fill: '#purple',
405
+ });
406
+
407
+ tastyStatic('.heading', { preset: 'h1' });
408
+ ```
409
+
410
+ **After:**
411
+
412
+ ```tsx
413
+ import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
414
+
415
+ const button = (_$i("ts3f2a1b ts8c4d2e", ".ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}"), {
416
+ className: 'ts3f2a1b ts8c4d2e',
417
+ styles: { padding: '2x 4x', fill: '#purple' },
418
+ toString() { return this.className; }
419
+ });
420
+
421
+ _$i(".heading", ".heading{font-size:2.5rem;font-weight:700;line-height:1.2}");
422
+ ```
423
+
424
+ ### Dev Mode / HMR
425
+
426
+ Class names are content-hashed (`ts` + MD5). When styles change, a new hash produces a new `_$i` call that injects fresh CSS. The injector deduplicates by id, so unchanged styles are skipped. Old CSS stays in the DOM but is harmless since no elements reference those class names.
427
+
428
+ ### Limitations (inject mode)
429
+
430
+ - **Client-side only** — Styles are injected via the DOM, so they are not available during SSR. For server-rendered apps, use `mode: 'file'` or the runtime `tasty()`.
431
+ - **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
432
+
433
+ ---
434
+
336
435
  ## Style Extension
337
436
 
338
437
  ```tsx
@@ -429,5 +528,5 @@ const card = tastyStatic({
429
528
 
430
529
  - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
431
530
  - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
432
- - [Runtime API](runtime.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, hooks
531
+ - [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
433
532
  - [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/tasty",
3
- "version": "0.0.0-snapshot.2705ab9",
3
+ "version": "0.0.0-snapshot.275370e",
4
4
  "description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,6 +17,11 @@
17
17
  "import": "./dist/static/index.js",
18
18
  "default": "./dist/static/index.js"
19
19
  },
20
+ "./static/inject": {
21
+ "types": "./dist/static/inject.d.ts",
22
+ "import": "./dist/static/inject.js",
23
+ "default": "./dist/static/inject.js"
24
+ },
20
25
  "./babel-plugin": {
21
26
  "types": "./dist/zero/babel.d.ts",
22
27
  "import": "./dist/zero/babel.js",
@@ -52,6 +57,11 @@
52
57
  "import": "./dist/ssr/astro.js",
53
58
  "default": "./dist/ssr/astro.js"
54
59
  },
60
+ "./ssr/astro-client": {
61
+ "types": "./dist/ssr/astro-client.d.ts",
62
+ "import": "./dist/ssr/astro-client.js",
63
+ "default": "./dist/ssr/astro-client.js"
64
+ },
55
65
  "./tasty.config": "./tasty.config.ts"
56
66
  },
57
67
  "files": [
@@ -62,7 +72,8 @@
62
72
  "sideEffects": [
63
73
  "./dist/ssr/index.js",
64
74
  "./dist/ssr/next.js",
65
- "./dist/ssr/astro.js"
75
+ "./dist/ssr/astro.js",
76
+ "./dist/ssr/astro-client.js"
66
77
  ],
67
78
  "engines": {
68
79
  "node": ">=20"
@@ -136,7 +147,7 @@
136
147
  },
137
148
  "devDependencies": {
138
149
  "@babel/core": "^7.24.0",
139
- "@changesets/changelog-github": "^0.5.2",
150
+ "@changesets/changelog-github": "^0.6.0",
140
151
  "@changesets/cli": "^2.29.8",
141
152
  "@eslint/js": "^10.0.1",
142
153
  "@size-limit/esbuild": "^12.0.0",
@@ -150,11 +161,11 @@
150
161
  "@vitest/runner": "^4.0.18",
151
162
  "eslint": "^10.0.0",
152
163
  "eslint-config-prettier": "^10.1.8",
153
- "jsdom": "^28.1.0",
164
+ "jsdom": "^29.0.1",
154
165
  "prettier": "^3.8.1",
155
166
  "react": "^19.0.0",
156
167
  "size-limit": "^12.0.0",
157
- "tsdown": "^0.20.3",
168
+ "tsdown": "^0.21.7",
158
169
  "typescript": "^5.9.3",
159
170
  "typescript-eslint": "^8.56.0",
160
171
  "vitest": "^4.0.18"
@@ -170,13 +181,13 @@
170
181
  "name": "main (import *)",
171
182
  "path": "dist/index.js",
172
183
  "import": "*",
173
- "limit": "47 kB"
184
+ "limit": "50 kB"
174
185
  },
175
186
  {
176
187
  "name": "core (import *)",
177
188
  "path": "dist/core/index.js",
178
189
  "import": "*",
179
- "limit": "45 kB"
190
+ "limit": "47.5 kB"
180
191
  },
181
192
  {
182
193
  "name": "static",
@@ -193,7 +204,7 @@
193
204
  "path",
194
205
  "crypto"
195
206
  ],
196
- "limit": "28 kB"
207
+ "limit": "29.5 kB"
197
208
  },
198
209
  {
199
210
  "name": "babel-plugin",
@@ -204,7 +215,7 @@
204
215
  "path",
205
216
  "crypto"
206
217
  ],
207
- "limit": "40 kB"
218
+ "limit": "43.5 kB"
208
219
  }
209
220
  ]
210
221
  }
@@ -1,15 +0,0 @@
1
- import { getRegisteredSSRCollector } from "../ssr/ssr-collector-ref.js";
2
-
3
- //#region src/hooks/resolve-ssr-collector.ts
4
- /**
5
- * Resolve the SSR collector from React context or AsyncLocalStorage.
6
- * Returns null on the client (no collector available).
7
- */
8
- function resolveSSRCollector(reactContext) {
9
- if (reactContext) return reactContext;
10
- return getRegisteredSSRCollector();
11
- }
12
-
13
- //#endregion
14
- export { resolveSSRCollector };
15
- //# sourceMappingURL=resolve-ssr-collector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-ssr-collector.js","names":[],"sources":["../../src/hooks/resolve-ssr-collector.ts"],"sourcesContent":["import type { ServerStyleCollector } from '../ssr/collector';\nimport { getRegisteredSSRCollector } from '../ssr/ssr-collector-ref';\n\n/**\n * Resolve the SSR collector from React context or AsyncLocalStorage.\n * Returns null on the client (no collector available).\n */\nexport function resolveSSRCollector(\n reactContext: ServerStyleCollector | null,\n): ServerStyleCollector | null {\n if (reactContext) return reactContext;\n return getRegisteredSSRCollector();\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,oBACd,cAC6B;AAC7B,KAAI,aAAc,QAAO;AACzB,QAAO,2BAA2B"}
@@ -1,8 +0,0 @@
1
- import { ServerStyleCollector } from "./collector.js";
2
- import * as react from "react";
3
-
4
- //#region src/ssr/context.d.ts
5
- declare const TastySSRContext: react.Context<ServerStyleCollector | null>;
6
- //#endregion
7
- export { TastySSRContext };
8
- //# sourceMappingURL=context.d.ts.map
@@ -1,15 +0,0 @@
1
- //#region src/styles/align.d.ts
2
- declare function alignStyle({
3
- align
4
- }: {
5
- align?: string;
6
- }): {
7
- 'align-items': string;
8
- 'align-content': string;
9
- } | undefined;
10
- declare namespace alignStyle {
11
- var __lookupStyles: string[];
12
- }
13
- //#endregion
14
- export { alignStyle };
15
- //# sourceMappingURL=align.d.ts.map
@@ -1,14 +0,0 @@
1
- //#region src/styles/align.ts
2
- function alignStyle({ align }) {
3
- if (typeof align !== "string") return;
4
- if (!align) return;
5
- return {
6
- "align-items": align,
7
- "align-content": align
8
- };
9
- }
10
- alignStyle.__lookupStyles = ["align"];
11
-
12
- //#endregion
13
- export { alignStyle };
14
- //# sourceMappingURL=align.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"align.js","names":[],"sources":["../../src/styles/align.ts"],"sourcesContent":["export function alignStyle({ align }: { align?: string }) {\n if (typeof align !== 'string') return;\n\n if (!align) return;\n\n return {\n 'align-items': align,\n 'align-content': align,\n };\n}\n\nalignStyle.__lookupStyles = ['align'];\n"],"mappings":";AAAA,SAAgB,WAAW,EAAE,SAA6B;AACxD,KAAI,OAAO,UAAU,SAAU;AAE/B,KAAI,CAAC,MAAO;AAEZ,QAAO;EACL,eAAe;EACf,iBAAiB;EAClB;;AAGH,WAAW,iBAAiB,CAAC,QAAQ"}
@@ -1,15 +0,0 @@
1
- //#region src/styles/justify.d.ts
2
- declare function justifyStyle({
3
- justify
4
- }: {
5
- justify?: string;
6
- }): {
7
- 'justify-items': string;
8
- 'justify-content': string;
9
- } | undefined;
10
- declare namespace justifyStyle {
11
- var __lookupStyles: string[];
12
- }
13
- //#endregion
14
- export { justifyStyle };
15
- //# sourceMappingURL=justify.d.ts.map
@@ -1,14 +0,0 @@
1
- //#region src/styles/justify.ts
2
- function justifyStyle({ justify }) {
3
- if (typeof justify !== "string") return;
4
- if (!justify) return;
5
- return {
6
- "justify-items": justify,
7
- "justify-content": justify
8
- };
9
- }
10
- justifyStyle.__lookupStyles = ["justify"];
11
-
12
- //#endregion
13
- export { justifyStyle };
14
- //# sourceMappingURL=justify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"justify.js","names":[],"sources":["../../src/styles/justify.ts"],"sourcesContent":["export function justifyStyle({ justify }: { justify?: string }) {\n if (typeof justify !== 'string') return;\n\n if (!justify) return;\n\n return {\n 'justify-items': justify,\n 'justify-content': justify,\n };\n}\n\njustifyStyle.__lookupStyles = ['justify'];\n"],"mappings":";AAAA,SAAgB,aAAa,EAAE,WAAiC;AAC9D,KAAI,OAAO,YAAY,SAAU;AAEjC,KAAI,CAAC,QAAS;AAEd,QAAO;EACL,iBAAiB;EACjB,mBAAmB;EACpB;;AAGH,aAAa,iBAAiB,CAAC,UAAU"}