@tenphi/tasty 0.0.0-snapshot.047dfbb → 0.0.0-snapshot.05197cf

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 (121) hide show
  1. package/README.md +181 -136
  2. package/dist/babel-C5mN2_fA.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-Tkr_Z48w.js +42 -0
  6. package/dist/chunks/build-config-Tkr_Z48w.js.map +1 -0
  7. package/dist/{collector-J6LwZR0N.js → chunks/collector-BG-HTHSz.js} +64 -99
  8. package/dist/chunks/collector-BG-HTHSz.js.map +1 -0
  9. package/dist/chunks/config-engine-B9pEqzzU.js +267 -0
  10. package/dist/chunks/config-engine-B9pEqzzU.js.map +1 -0
  11. package/dist/chunks/css-definitions-BAtJQ_tP.js +875 -0
  12. package/dist/chunks/css-definitions-BAtJQ_tP.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/chunks/debug-B7TmqIlz.js +501 -0
  16. package/dist/chunks/debug-B7TmqIlz.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-5owaaB5Y.js +557 -0
  22. package/dist/chunks/react-runtime-5owaaB5Y.js.map +1 -0
  23. package/dist/chunks/runtime-engine-B3JcRKeS.js +2438 -0
  24. package/dist/chunks/runtime-engine-B3JcRKeS.js.map +1 -0
  25. package/dist/chunks/runtime-state-DDnx6lOJ.js +127 -0
  26. package/dist/chunks/runtime-state-DDnx6lOJ.js.map +1 -0
  27. package/dist/{merge-styles-CAdKaHxh.js → chunks/shared-utils-DWA4LjIa.js} +55 -54
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-CnQoWtc_.js +5202 -0
  30. package/dist/chunks/style-engine-CnQoWtc_.js.map +1 -0
  31. package/dist/{css-writer-IC7tdnIf.js → chunks/zero-engine-B36DCc0X.js} +34 -112
  32. package/dist/chunks/zero-engine-B36DCc0X.js.map +1 -0
  33. package/dist/{collector-CddJZDOr.d.ts → collector-CViSMO84.d.ts} +64 -7
  34. package/dist/{config-C3SKYuxY.d.ts → config-CbDtZzZy.d.ts} +491 -78
  35. package/dist/core/index.d.ts +5 -5
  36. package/dist/core/index.js +9 -6
  37. package/dist/{index-ByBYTH9l.d.ts → index-CmrdZ8ay.d.ts} +421 -252
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +11 -732
  40. package/dist/{merge-styles-CvUi7SOD.d.ts → merge-styles-Dp3eKkK9.d.ts} +2 -2
  41. package/dist/ssr/astro-client.js +1 -14
  42. package/dist/ssr/astro-client.js.map +1 -1
  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 +11 -7
  53. package/dist/ssr/astro-middleware.js +2 -14
  54. package/dist/ssr/astro-middleware.js.map +1 -1
  55. package/dist/ssr/astro.d.ts +45 -7
  56. package/dist/ssr/astro.js +159 -86
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +7 -14
  59. package/dist/ssr/index.js +5 -5
  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 +9 -2
  65. package/dist/ssr/next.js +27 -43
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +2 -2
  68. package/dist/static/index.js +4 -22
  69. package/dist/static/index.js.map +1 -1
  70. package/dist/{index-C5owZ15q.d.ts → types-Ji9PGExW.d.ts} +873 -546
  71. package/dist/zero/babel.d.ts +2 -80
  72. package/dist/zero/babel.js +42 -109
  73. package/dist/zero/babel.js.map +1 -1
  74. package/dist/zero/index.d.ts +16 -2
  75. package/dist/zero/index.js +2 -2
  76. package/dist/zero/next.d.ts +1 -1
  77. package/dist/zero/next.js +0 -31
  78. package/dist/zero/next.js.map +1 -1
  79. package/docs/README.md +17 -9
  80. package/docs/adoption.md +56 -31
  81. package/docs/ai-agents.md +250 -0
  82. package/docs/comparison.md +69 -40
  83. package/docs/configuration.md +486 -85
  84. package/docs/debug.md +26 -14
  85. package/docs/design-system.md +43 -24
  86. package/docs/dsl.md +455 -189
  87. package/docs/getting-started.md +64 -41
  88. package/docs/injector.md +120 -30
  89. package/docs/methodology.md +46 -40
  90. package/docs/migration-v3.md +285 -0
  91. package/docs/pipeline.md +36 -15
  92. package/docs/plugins.md +353 -0
  93. package/docs/react-api.md +142 -42
  94. package/docs/runtime-benchmarks.md +388 -0
  95. package/docs/ssr.md +252 -86
  96. package/docs/styles.md +126 -24
  97. package/docs/tasty-static.md +141 -106
  98. package/package.json +103 -20
  99. package/tasty.config.ts +4 -0
  100. package/dist/async-storage-DKK-wTD4.js +0 -44
  101. package/dist/async-storage-DKK-wTD4.js.map +0 -1
  102. package/dist/collector-J6LwZR0N.js.map +0 -1
  103. package/dist/config-C3F4Ogo1.js +0 -10993
  104. package/dist/config-C3F4Ogo1.js.map +0 -1
  105. package/dist/context-CA8YKeMn.js +0 -24
  106. package/dist/context-CA8YKeMn.js.map +0 -1
  107. package/dist/core-DxHmF6S9.js +0 -1598
  108. package/dist/core-DxHmF6S9.js.map +0 -1
  109. package/dist/css-writer-IC7tdnIf.js.map +0 -1
  110. package/dist/format-global-rules-DklyaXv-.js +0 -22
  111. package/dist/format-global-rules-DklyaXv-.js.map +0 -1
  112. package/dist/format-rules-DTLY39Hm.js +0 -143
  113. package/dist/format-rules-DTLY39Hm.js.map +0 -1
  114. package/dist/hydrate-8Zglgy_C.js +0 -45
  115. package/dist/hydrate-8Zglgy_C.js.map +0 -1
  116. package/dist/index.js.map +0 -1
  117. package/dist/keyframes-DgGkipNK.js +0 -595
  118. package/dist/keyframes-DgGkipNK.js.map +0 -1
  119. package/dist/merge-styles-CAdKaHxh.js.map +0 -1
  120. package/dist/resolve-recipes-BQNdunBd.js +0 -144
  121. package/dist/resolve-recipes-BQNdunBd.js.map +0 -1
package/docs/react-api.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # React API
2
2
 
3
- The React-specific `tasty()` component factory, component props, and style functions. All Tasty style functions — `tasty()` components, `useStyles()`, `useGlobalStyles()`, `useRawCSS()`, `useKeyframes()`, `useProperty()`, `useFontFace()`, and `useCounterStyle()` — are hook-free and compatible with React Server Components. No `'use client'` directive needed. For the shared style language (state maps, tokens, units, extending semantics), see [Style DSL](dsl.md). For global configuration, see [Configuration](configuration.md). For the broader docs map, see the [Docs Hub](README.md).
3
+ Use `tasty()` to turn state-aware style definitions into normal React components, extend existing Tasty components, and expose typed styling APIs to consumers.
4
+
5
+ All Tasty style functions — `tasty()` components, `useStyles()`, `useGlobalStyles()`, `useRawCSS()`, `useKeyframes()`, `useProperty()`, `useFontFace()`, `useCounterStyle()`, and `useFunction()` — are hook-free and compatible with React Server Components. No `'use client'` directive is needed. For state maps, tokens, units, and extension semantics, see [Style DSL](dsl.md). For global configuration, see [Configuration](configuration.md). For the broader docs map, see the [Docs Hub](README.md).
4
6
 
5
7
  > **Note:** This file was previously named `runtime.md`. All functionality documented here works in both server and client contexts — "runtime" referred to style computation during React rendering, not to client-side JavaScript.
6
8
 
@@ -58,10 +60,12 @@ const Link = tasty({
58
60
 
59
61
  const Span = tasty({
60
62
  as: 'span',
61
- styles: { fontWeight: 'bold' },
63
+ styles: { preset: 'strong' },
62
64
  });
63
65
 
64
- <Link href="/blog" padding="1x">Blog</Link>;
66
+ <Link href="/blog" padding="1x">
67
+ Blog
68
+ </Link>;
65
69
  ```
66
70
 
67
71
  The wrapped component only needs to forward `className` (and ideally `style`/`ref`). Tasty-specific props (`qa`, `qaVal`, `mods`, `tokens`, `styleProps`, `modProps`, `tokenProps`) are consumed by Tasty and never leak to the DOM.
@@ -84,7 +88,7 @@ const FlexibleBox = tasty({
84
88
 
85
89
  <FlexibleBox gap="2x" align="center" fill="#surface">
86
90
  Content
87
- </FlexibleBox>
91
+ </FlexibleBox>;
88
92
  ```
89
93
 
90
94
  Style props accept state maps, so responsive values work through the same API:
@@ -98,6 +102,26 @@ Style props accept state maps, so responsive values work through the same API:
98
102
 
99
103
  For predefined style prop lists (`FLOW_STYLES`, `POSITION_STYLES`, `DIMENSION_STYLES`, etc.) and guidance on which props to expose per component category, see [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api).
100
104
 
105
+ ### Always-available style props
106
+
107
+ A small set of style properties — `display`, `font`, `preset`, `hide`, `whiteSpace`, `opacity`, and `transition` — are always harvested as style props on every `tasty()` component, even when `styleProps` is omitted. This means you can pass `<Card display="grid" />` or `<Text preset="h1" />` without declaring them. When you do declare `styleProps`, these base props are unioned with your list (not replaced).
108
+
109
+ ---
110
+
111
+ ## `Element`
112
+
113
+ `Element` is the unstyled base component exported from the main entry — equivalent to `tasty({})` (a `div` with no default styles). It accepts all Tasty props (`styles`, `styleProps`, `mods`, `tokens`, `as`, `qa`, `theme`, the `is*` props, etc.) and is useful as a generic styled box or as a building block for layout primitives.
114
+
115
+ ```jsx
116
+ import { Element } from '@tenphi/tasty';
117
+
118
+ <Element as="section" padding="4x" fill="#surface">
119
+ Content
120
+ </Element>;
121
+ ```
122
+
123
+ > Note: `Element` shadows the global DOM `Element` type when imported from `@tenphi/tasty`. In files that need the DOM type, alias the import: `import { Element as TastyElement } from '@tenphi/tasty'`.
124
+
101
125
  ---
102
126
 
103
127
  ## Mod Props
@@ -136,9 +160,9 @@ Map modifier names to type descriptors for precise TypeScript types:
136
160
  ```tsx
137
161
  const Button = tasty({
138
162
  modProps: {
139
- isLoading: Boolean, // isLoading?: boolean
140
- isSelected: Boolean, // isSelected?: boolean
141
- size: ['small', 'medium', 'large'] as const, // size?: 'small' | 'medium' | 'large'
163
+ isLoading: Boolean, // isLoading?: boolean
164
+ isSelected: Boolean, // isSelected?: boolean
165
+ size: ['small', 'medium', 'large'] as const, // size?: 'small' | 'medium' | 'large'
142
166
  },
143
167
  styles: {
144
168
  padding: { '': '2x 4x', 'size=small': '1x 2x', 'size=large': '3x 6x' },
@@ -146,18 +170,20 @@ const Button = tasty({
146
170
  },
147
171
  });
148
172
 
149
- <Button isLoading size="large">Submit</Button>
173
+ <Button isLoading size="large">
174
+ Submit
175
+ </Button>;
150
176
  // Renders: <button data-is-loading="" data-size="large">Submit</button>
151
177
  ```
152
178
 
153
179
  Available type descriptors:
154
180
 
155
- | Descriptor | TypeScript type | Example |
156
- |---|---|---|
157
- | `Boolean` | `boolean` | `isLoading: Boolean` |
158
- | `String` | `string` | `label: String` |
159
- | `Number` | `number` | `count: Number` |
160
- | `['a', 'b'] as const` | `'a' \| 'b'` | `size: ['sm', 'md', 'lg'] as const` |
181
+ | Descriptor | TypeScript type | Example |
182
+ | --------------------- | --------------- | ----------------------------------- |
183
+ | `Boolean` | `boolean` | `isLoading: Boolean` |
184
+ | `String` | `string` | `label: String` |
185
+ | `Number` | `number` | `count: Number` |
186
+ | `['a', 'b'] as const` | `'a' \| 'b'` | `size: ['sm', 'md', 'lg'] as const` |
161
187
 
162
188
  ### Merge with `mods`
163
189
 
@@ -170,11 +196,11 @@ Mod props and the `mods` object can be used together. Mod props take precedence:
170
196
 
171
197
  ### When to use `modProps` vs `mods`
172
198
 
173
- | Use case | Recommendation |
174
- |---|---|
199
+ | Use case | Recommendation |
200
+ | -------------------------------------------- | -------------------------------------------------------- |
175
201
  | Component has a fixed set of known modifiers | `modProps` — cleaner API, better TypeScript autocomplete |
176
- | Component needs arbitrary/dynamic modifiers | `mods` — open-ended `Record<string, ModValue>` |
177
- | Both fixed and dynamic | Combine: `modProps` for known keys, `mods` for ad-hoc |
202
+ | Component needs arbitrary/dynamic modifiers | `mods` — open-ended `Record<string, ModValue>` |
203
+ | Both fixed and dynamic | Combine: `modProps` for known keys, `mods` for ad-hoc |
178
204
 
179
205
  For architecture guidance on when to use modifiers vs `styleProps`, see [Methodology — modProps and mods](methodology.md#modprops-and-mods).
180
206
 
@@ -204,7 +230,7 @@ const ProgressBar = tasty({
204
230
 
205
231
  <ProgressBar progress="75%" accentColor="#purple" />
206
232
  // 'progress' → $progress → --progress
207
- // 'accentColor' → #accent → --accent-color + --accent-color-oklch
233
+ // 'accentColor' → #accent → --accent-color
208
234
  ```
209
235
 
210
236
  ### Object form
@@ -220,7 +246,7 @@ const Card = tasty({
220
246
  styles: { padding: '$card-size', fill: '#card-accent' },
221
247
  });
222
248
 
223
- <Card size="4x" color="#purple" />
249
+ <Card size="4x" color="#purple" />;
224
250
  ```
225
251
 
226
252
  ### Merge with `tokens`
@@ -239,11 +265,11 @@ const Bar = tasty({
239
265
 
240
266
  ### When to use `tokenProps` vs `tokens`
241
267
 
242
- | Use case | Recommendation |
243
- |---|---|
244
- | Component has a fixed set of known token keys | `tokenProps` — cleaner API, better TypeScript autocomplete |
245
- | Component needs arbitrary/dynamic token values | `tokens` — open-ended `Record<string, TokenValue>` |
246
- | Both fixed and dynamic | Combine: `tokenProps` for known keys, `tokens` for ad-hoc |
268
+ | Use case | Recommendation |
269
+ | ---------------------------------------------- | ---------------------------------------------------------- |
270
+ | Component has a fixed set of known token keys | `tokenProps` — cleaner API, better TypeScript autocomplete |
271
+ | Component needs arbitrary/dynamic token values | `tokens` — open-ended `Record<string, TokenValue>` |
272
+ | Both fixed and dynamic | Combine: `tokenProps` for known keys, `tokens` for ad-hoc |
247
273
 
248
274
  For architecture guidance, see [Methodology — tokenProps](methodology.md#tokenprops).
249
275
 
@@ -262,11 +288,11 @@ const Button = tasty({
262
288
  variants: {
263
289
  default: { fill: '#blue', color: '#white' },
264
290
  danger: { fill: '#red', color: '#white' },
265
- outline: { fill: 'transparent', color: '#blue', border: '1bw solid #blue' },
291
+ outline: { fill: '#clear', color: '#blue', border: '1bw solid #blue' },
266
292
  },
267
293
  });
268
294
 
269
- <Button variant="danger">Delete</Button>
295
+ <Button variant="danger">Delete</Button>;
270
296
  ```
271
297
 
272
298
  ### Extending Variants with Base State Maps
@@ -322,7 +348,7 @@ const Card = tasty({
322
348
  <Card>
323
349
  <Card.Title>Card Title</Card.Title>
324
350
  <Card.Content>Card content</Card.Content>
325
- </Card>
351
+ </Card>;
326
352
  ```
327
353
 
328
354
  Each entry in `elements` can be a tag name string or a config object:
@@ -348,7 +374,7 @@ const Card = tasty({
348
374
 
349
375
  <Card>
350
376
  <div data-element="Title">Card Title</div>
351
- </Card>
377
+ </Card>;
352
378
  ```
353
379
 
354
380
  ### Selector Affix (`$`)
@@ -381,7 +407,7 @@ On the client, CSS is injected synchronously into the DOM (idempotent via the in
381
407
 
382
408
  All style functions below are plain functions (not React hooks) and can be used in any environment: client components, SSR with a `ServerStyleCollector`, and React Server Components. They retain their `use` prefix for backward compatibility, but do not use any React hooks internally.
383
409
 
384
- In server-only contexts (Next.js RSC without `'use client'`, Astro without `client:*` directives, SSG), components that use only Tasty style functions produce zero client JavaScript. Tasty never forces the `'use client'` boundary — that decision belongs to your component when it needs React interactivity (state, effects, event handlers).
410
+ In server-only contexts, components that use only Tasty style functions ship no Tasty styling runtime. Astro without `client:*` directives produces no client JavaScript; server-only Next.js RSC follows the same Tasty architecture, while final output depends on the application deployment. Tasty never forces the `'use client'` boundary — that decision belongs to your component when it needs React interactivity (state, effects, event handlers).
385
411
 
386
412
  ### useStyles
387
413
 
@@ -419,6 +445,15 @@ function ThemeStyles() {
419
445
  }
420
446
  ```
421
447
 
448
+ A slot — the `id`, or the selector when no `id` is given — holds exactly one
449
+ injection **per `root`**. So:
450
+
451
+ - Changing the styles replaces the previous CSS rather than adding to it.
452
+ - Passing styles that produce no CSS (for example `{}`) clears the slot.
453
+ - The same selector used in two shadow roots keeps a separate injection in each.
454
+ - Two independent call sites that share a selector share a slot, and the last
455
+ render wins. Give them distinct `id`s if they should coexist.
456
+
422
457
  ### useRawCSS
423
458
 
424
459
  Inject raw CSS strings. Accepts an optional `id` in the options for update tracking — when the CSS changes for the same id, the previous injection is replaced:
@@ -435,6 +470,9 @@ function GlobalReset() {
435
470
  }
436
471
  ```
437
472
 
473
+ An `id` slot holds one injection per `root`. Without an `id` the CSS is deduped
474
+ by content and permanent — there is nothing to replace it with later.
475
+
438
476
  ### useKeyframes
439
477
 
440
478
  Inject `@keyframes` rules and return the generated animation name:
@@ -448,14 +486,14 @@ function Spinner() {
448
486
  from: { transform: 'rotate(0deg)' },
449
487
  to: { transform: 'rotate(360deg)' },
450
488
  },
451
- { name: 'spin' }
489
+ { name: 'spin' },
452
490
  );
453
491
 
454
492
  return <div style={{ animation: `${spin} 1s linear infinite` }} />;
455
493
  }
456
494
  ```
457
495
 
458
- `useKeyframes()` also supports a factory function. The deps array is accepted for backward compatibility but the factory is called on every invocation — deduplication is handled internally by content hash:
496
+ `useKeyframes()` also supports a factory function. Without a `name` the factory runs on every invocation and deduplication is handled internally by content hash; with a `name`, matching deps skip the factory entirely:
459
497
 
460
498
  ```tsx
461
499
  function Pulse({ scale }: { scale: number }) {
@@ -464,13 +502,24 @@ function Pulse({ scale }: { scale: number }) {
464
502
  '0%': { transform: 'scale(1)' },
465
503
  '100%': { transform: `scale(${scale})` },
466
504
  }),
467
- [scale]
505
+ [scale],
506
+ { name: 'pulse' },
468
507
  );
469
508
 
470
- return <div style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }} />;
509
+ return (
510
+ <div
511
+ style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }}
512
+ />
513
+ );
471
514
  }
472
515
  ```
473
516
 
517
+ Passing `name` claims a slot owned by that one call site, per `root` — much like
518
+ `id` in `useGlobalStyles()` and `useRawCSS()`. When the steps change the previous
519
+ `@keyframes` rule is disposed and the name is reused, so the rules don't
520
+ accumulate and the returned name stays stable. Anonymous keyframes are permanent
521
+ and shared by content.
522
+
474
523
  ### useProperty
475
524
 
476
525
  Register a CSS `@property` rule so a custom property can animate smoothly:
@@ -517,8 +566,16 @@ For multiple weights/styles, pass an array:
517
566
 
518
567
  ```tsx
519
568
  useFontFace('Brand Sans', [
520
- { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
521
- { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
569
+ {
570
+ src: 'url("/fonts/brand-regular.woff2") format("woff2")',
571
+ fontWeight: 400,
572
+ fontDisplay: 'swap',
573
+ },
574
+ {
575
+ src: 'url("/fonts/brand-bold.woff2") format("woff2")',
576
+ fontWeight: 700,
577
+ fontDisplay: 'swap',
578
+ },
522
579
  ]);
523
580
  ```
524
581
 
@@ -536,11 +593,14 @@ Inject a `@counter-style` rule and get back the counter style name. Permanent
536
593
  import { useCounterStyle } from '@tenphi/tasty';
537
594
 
538
595
  function EmojiList() {
539
- const styleName = useCounterStyle({
540
- system: 'cyclic',
541
- symbols: '"👍"',
542
- suffix: '" "',
543
- }, { name: 'thumbs' });
596
+ const styleName = useCounterStyle(
597
+ {
598
+ system: 'cyclic',
599
+ symbols: '"👍"',
600
+ suffix: '" "',
601
+ },
602
+ { name: 'thumbs' },
603
+ );
544
604
 
545
605
  return (
546
606
  <ol style={{ listStyleType: styleName }}>
@@ -560,6 +620,46 @@ function useCounterStyle(
560
620
  ): string;
561
621
  ```
562
622
 
623
+ ### useFunction
624
+
625
+ Register a CSS `@function` (custom function). Permanent — no cleanup on unmount. Deduplicates by function name. The function name accepts `$$name` (matching the call site `$$name(...)`), `$name`, or `--name`.
626
+
627
+ ```tsx
628
+ import { tasty, useFunction } from '@tenphi/tasty';
629
+
630
+ const Box = tasty({ styles: { margin: '$$negative(10px) top' } });
631
+
632
+ function Layout() {
633
+ useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
634
+ return <Box />;
635
+ }
636
+ ```
637
+
638
+ Call the function through the Tasty DSL rather than a raw `style` prop. An inline `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never expanded — and under `configure({ polyfills: { functions: true } })` it silently does nothing, because the polyfill rewrites calls at parse time.
639
+
640
+ Inside a `tasty()` component you call functions with the same `$$name(...)` sugar:
641
+
642
+ ```tsx
643
+ const Box = tasty({
644
+ styles: {
645
+ '@function': { $$negative: { args: ['$value'], result: '(-1 * $value)' } },
646
+ margin: '$$negative(10px) top',
647
+ },
648
+ });
649
+ ```
650
+
651
+ Signature:
652
+
653
+ ```ts
654
+ function useFunction(
655
+ name: string,
656
+ definition: FunctionDefinition,
657
+ options?: { root?: Document | ShadowRoot },
658
+ ): void;
659
+ ```
660
+
661
+ See the [Functions section of the DSL reference](dsl.md#functions-function) for the full descriptor shape, token conventions, and value-sugar support. `@function` is an experimental CSS feature — unsupported browsers safely ignore the native rule, or enable the [`polyfills.functions`](configuration.md#polyfills) inline polyfill for full cross-browser support.
662
+
563
663
  ### Troubleshooting
564
664
 
565
665
  - Styles are not updating: make sure `configure()` runs before first render, and verify the generated class name or global rule with [Debug Utilities](debug.md).
@@ -576,6 +676,6 @@ function useCounterStyle(
576
676
  - **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
577
677
  - **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
578
678
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
579
- - **[Zero Runtime (tastyStatic)](tasty-static.md)** — Build-time static styling with Babel plugin
679
+ - **[Build-Time Extraction (`tastyStatic`)](tasty-static.md)** — Static styling with the Babel plugin
580
680
  - **[Server-Side Rendering](ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks
581
681
  - **[Debug Utilities](debug.md)** — Inspect injected CSS, cache state, and active styles at runtime