@tenphi/tasty 0.0.0-snapshot.a8b0eee → 0.0.0-snapshot.a8da86e

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 (125) hide show
  1. package/README.md +181 -136
  2. package/dist/babel-types-C_7kRP38.d.ts +18 -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-Betc6IB6.js +60 -0
  6. package/dist/chunks/build-config-Betc6IB6.js.map +1 -0
  7. package/dist/{collector-Crs9kGJW.js → chunks/collector-DqqisglQ.js} +68 -101
  8. package/dist/chunks/collector-DqqisglQ.js.map +1 -0
  9. package/dist/chunks/config-engine-BPeROwq2.js +272 -0
  10. package/dist/chunks/config-engine-BPeROwq2.js.map +1 -0
  11. package/dist/chunks/css-definitions-IeuyJTGk.js +899 -0
  12. package/dist/chunks/css-definitions-IeuyJTGk.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-P1E2jkj7.js +502 -0
  16. package/dist/chunks/debug-P1E2jkj7.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.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-XMBbGRes.js +582 -0
  22. package/dist/chunks/react-runtime-XMBbGRes.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CsIMtulO.js +2415 -0
  24. package/dist/chunks/runtime-engine-CsIMtulO.js.map +1 -0
  25. package/dist/chunks/runtime-state-CyKzDioI.js +141 -0
  26. package/dist/chunks/runtime-state-CyKzDioI.js.map +1 -0
  27. package/dist/{merge-styles-BzQutdAK.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-RbokDN6A.js +5427 -0
  30. package/dist/chunks/style-engine-RbokDN6A.js.map +1 -0
  31. package/dist/{css-writer-CPy_cbFJ.js → chunks/zero-engine-DbtjMsfo.js} +81 -137
  32. package/dist/chunks/zero-engine-DbtjMsfo.js.map +1 -0
  33. package/dist/{collector-osfWTeRd.d.ts → collector-w4mBj5gd.d.ts} +64 -8
  34. package/dist/{config-BoZDUHW5.d.ts → config-CrZOfNJ5.d.ts} +489 -85
  35. package/dist/core/index.d.ts +5 -5
  36. package/dist/core/index.js +9 -6
  37. package/dist/{index-B_k47mc_.d.ts → index-CYJtAI9a.d.ts} +664 -399
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +11 -732
  40. package/dist/{merge-styles-BMWcH6MF.d.ts → merge-styles-VXwJ0Frr.d.ts} +2 -3
  41. package/dist/ssr/astro-client.d.ts +1 -1
  42. package/dist/ssr/astro-client.js +1 -14
  43. package/dist/ssr/astro-client.js.map +1 -1
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  51. package/dist/ssr/astro-middleware-static.js +7 -0
  52. package/dist/ssr/astro-middleware-static.js.map +1 -0
  53. package/dist/ssr/astro-middleware.d.ts +11 -8
  54. package/dist/ssr/astro-middleware.js +2 -14
  55. package/dist/ssr/astro-middleware.js.map +1 -1
  56. package/dist/ssr/astro.d.ts +40 -10
  57. package/dist/ssr/astro.js +163 -91
  58. package/dist/ssr/astro.js.map +1 -1
  59. package/dist/ssr/index.d.ts +10 -18
  60. package/dist/ssr/index.js +5 -5
  61. package/dist/ssr/index.js.map +1 -1
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +134 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +9 -9
  66. package/dist/ssr/next.js +29 -44
  67. package/dist/ssr/next.js.map +1 -1
  68. package/dist/static/index.d.ts +8 -9
  69. package/dist/static/index.js +4 -22
  70. package/dist/static/index.js.map +1 -1
  71. package/dist/static/inject.d.ts +1 -2
  72. package/dist/static/inject.js.map +1 -1
  73. package/dist/{index-tcHuMPFt.d.ts → types-JEY8PVYP.d.ts} +874 -593
  74. package/dist/zero/babel.d.ts +5 -19
  75. package/dist/zero/babel.js +74 -144
  76. package/dist/zero/babel.js.map +1 -1
  77. package/dist/zero/index.d.ts +57 -7
  78. package/dist/zero/index.js +24 -2
  79. package/dist/zero/index.js.map +1 -0
  80. package/dist/zero/next.d.ts +4 -5
  81. package/dist/zero/next.js +0 -31
  82. package/dist/zero/next.js.map +1 -1
  83. package/docs/README.md +17 -9
  84. package/docs/adoption.md +56 -31
  85. package/docs/ai-agents.md +250 -0
  86. package/docs/comparison.md +69 -40
  87. package/docs/configuration.md +487 -86
  88. package/docs/debug.md +26 -14
  89. package/docs/design-system.md +43 -24
  90. package/docs/dsl.md +558 -181
  91. package/docs/getting-started.md +64 -41
  92. package/docs/injector.md +120 -30
  93. package/docs/methodology.md +46 -40
  94. package/docs/migration-v3.md +285 -0
  95. package/docs/pipeline.md +87 -21
  96. package/docs/plugins.md +353 -0
  97. package/docs/react-api.md +151 -42
  98. package/docs/runtime-benchmarks.md +388 -0
  99. package/docs/ssr.md +252 -86
  100. package/docs/styles.md +142 -25
  101. package/docs/tasty-static.md +174 -106
  102. package/package.json +127 -35
  103. package/tasty.config.ts +5 -0
  104. package/dist/async-storage-B7_o6FKt.js +0 -44
  105. package/dist/async-storage-B7_o6FKt.js.map +0 -1
  106. package/dist/collector-Crs9kGJW.js.map +0 -1
  107. package/dist/config-BaxtQMS3.js +0 -10464
  108. package/dist/config-BaxtQMS3.js.map +0 -1
  109. package/dist/context-CkSg-kDT.js +0 -24
  110. package/dist/context-CkSg-kDT.js.map +0 -1
  111. package/dist/core-CmxaoZ-N.js +0 -1598
  112. package/dist/core-CmxaoZ-N.js.map +0 -1
  113. package/dist/css-writer-CPy_cbFJ.js.map +0 -1
  114. package/dist/format-global-rules-Dbc_1tc3.js +0 -22
  115. package/dist/format-global-rules-Dbc_1tc3.js.map +0 -1
  116. package/dist/format-rules-CPirO_Mj.js +0 -143
  117. package/dist/format-rules-CPirO_Mj.js.map +0 -1
  118. package/dist/hydrate-CVn-A_3y.js +0 -45
  119. package/dist/hydrate-CVn-A_3y.js.map +0 -1
  120. package/dist/index.js.map +0 -1
  121. package/dist/keyframes-vpzoVdUR.js +0 -588
  122. package/dist/keyframes-vpzoVdUR.js.map +0 -1
  123. package/dist/merge-styles-BzQutdAK.js.map +0 -1
  124. package/dist/resolve-recipes-DgH8A3Nn.js +0 -144
  125. package/dist/resolve-recipes-DgH8A3Nn.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,14 +60,18 @@ 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.
68
72
 
73
+ Props forwarded to the `as` component keep their declared types and requiredness. For example, a component with `position: 'top-right' | 'bottom-left'` accepts those values through `tasty({ as: Component })`; CSS positioning can still be set through `styles.position`. A prop explicitly listed in `styleProps` is consumed as a style value instead. The always-available base style props below are also consumed by Tasty, so keep component-specific prop names separate from those reserved names.
74
+
69
75
  ---
70
76
 
71
77
  ## Style Props
@@ -84,7 +90,7 @@ const FlexibleBox = tasty({
84
90
 
85
91
  <FlexibleBox gap="2x" align="center" fill="#surface">
86
92
  Content
87
- </FlexibleBox>
93
+ </FlexibleBox>;
88
94
  ```
89
95
 
90
96
  Style props accept state maps, so responsive values work through the same API:
@@ -98,6 +104,26 @@ Style props accept state maps, so responsive values work through the same API:
98
104
 
99
105
  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
106
 
107
+ ### Always-available style props
108
+
109
+ 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).
110
+
111
+ ---
112
+
113
+ ## `Element`
114
+
115
+ `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.
116
+
117
+ ```jsx
118
+ import { Element } from '@tenphi/tasty';
119
+
120
+ <Element as="section" padding="4x" fill="#surface">
121
+ Content
122
+ </Element>;
123
+ ```
124
+
125
+ > 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'`.
126
+
101
127
  ---
102
128
 
103
129
  ## Mod Props
@@ -136,9 +162,9 @@ Map modifier names to type descriptors for precise TypeScript types:
136
162
  ```tsx
137
163
  const Button = tasty({
138
164
  modProps: {
139
- isLoading: Boolean, // isLoading?: boolean
140
- isSelected: Boolean, // isSelected?: boolean
141
- size: ['small', 'medium', 'large'] as const, // size?: 'small' | 'medium' | 'large'
165
+ isLoading: Boolean, // isLoading?: boolean
166
+ isSelected: Boolean, // isSelected?: boolean
167
+ size: ['small', 'medium', 'large'] as const, // size?: 'small' | 'medium' | 'large'
142
168
  },
143
169
  styles: {
144
170
  padding: { '': '2x 4x', 'size=small': '1x 2x', 'size=large': '3x 6x' },
@@ -146,18 +172,20 @@ const Button = tasty({
146
172
  },
147
173
  });
148
174
 
149
- <Button isLoading size="large">Submit</Button>
175
+ <Button isLoading size="large">
176
+ Submit
177
+ </Button>;
150
178
  // Renders: <button data-is-loading="" data-size="large">Submit</button>
151
179
  ```
152
180
 
153
181
  Available type descriptors:
154
182
 
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` |
183
+ | Descriptor | TypeScript type | Example |
184
+ | --------------------- | --------------- | ----------------------------------- |
185
+ | `Boolean` | `boolean` | `isLoading: Boolean` |
186
+ | `String` | `string` | `label: String` |
187
+ | `Number` | `number` | `count: Number` |
188
+ | `['a', 'b'] as const` | `'a' \| 'b'` | `size: ['sm', 'md', 'lg'] as const` |
161
189
 
162
190
  ### Merge with `mods`
163
191
 
@@ -170,11 +198,11 @@ Mod props and the `mods` object can be used together. Mod props take precedence:
170
198
 
171
199
  ### When to use `modProps` vs `mods`
172
200
 
173
- | Use case | Recommendation |
174
- |---|---|
201
+ | Use case | Recommendation |
202
+ | -------------------------------------------- | -------------------------------------------------------- |
175
203
  | 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 |
204
+ | Component needs arbitrary/dynamic modifiers | `mods` — open-ended `Record<string, ModValue>` |
205
+ | Both fixed and dynamic | Combine: `modProps` for known keys, `mods` for ad-hoc |
178
206
 
179
207
  For architecture guidance on when to use modifiers vs `styleProps`, see [Methodology — modProps and mods](methodology.md#modprops-and-mods).
180
208
 
@@ -204,7 +232,7 @@ const ProgressBar = tasty({
204
232
 
205
233
  <ProgressBar progress="75%" accentColor="#purple" />
206
234
  // 'progress' → $progress → --progress
207
- // 'accentColor' → #accent → --accent-color + --accent-color-oklch
235
+ // 'accentColor' → #accent → --accent-color
208
236
  ```
209
237
 
210
238
  ### Object form
@@ -220,7 +248,7 @@ const Card = tasty({
220
248
  styles: { padding: '$card-size', fill: '#card-accent' },
221
249
  });
222
250
 
223
- <Card size="4x" color="#purple" />
251
+ <Card size="4x" color="#purple" />;
224
252
  ```
225
253
 
226
254
  ### Merge with `tokens`
@@ -239,11 +267,11 @@ const Bar = tasty({
239
267
 
240
268
  ### When to use `tokenProps` vs `tokens`
241
269
 
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 |
270
+ | Use case | Recommendation |
271
+ | ---------------------------------------------- | ---------------------------------------------------------- |
272
+ | Component has a fixed set of known token keys | `tokenProps` — cleaner API, better TypeScript autocomplete |
273
+ | Component needs arbitrary/dynamic token values | `tokens` — open-ended `Record<string, TokenValue>` |
274
+ | Both fixed and dynamic | Combine: `tokenProps` for known keys, `tokens` for ad-hoc |
247
275
 
248
276
  For architecture guidance, see [Methodology — tokenProps](methodology.md#tokenprops).
249
277
 
@@ -262,11 +290,11 @@ const Button = tasty({
262
290
  variants: {
263
291
  default: { fill: '#blue', color: '#white' },
264
292
  danger: { fill: '#red', color: '#white' },
265
- outline: { fill: 'transparent', color: '#blue', border: '1bw solid #blue' },
293
+ outline: { fill: '#clear', color: '#blue', border: '1bw solid #blue' },
266
294
  },
267
295
  });
268
296
 
269
- <Button variant="danger">Delete</Button>
297
+ <Button variant="danger">Delete</Button>;
270
298
  ```
271
299
 
272
300
  ### Extending Variants with Base State Maps
@@ -322,7 +350,7 @@ const Card = tasty({
322
350
  <Card>
323
351
  <Card.Title>Card Title</Card.Title>
324
352
  <Card.Content>Card content</Card.Content>
325
- </Card>
353
+ </Card>;
326
354
  ```
327
355
 
328
356
  Each entry in `elements` can be a tag name string or a config object:
@@ -348,7 +376,7 @@ const Card = tasty({
348
376
 
349
377
  <Card>
350
378
  <div data-element="Title">Card Title</div>
351
- </Card>
379
+ </Card>;
352
380
  ```
353
381
 
354
382
  ### Selector Affix (`$`)
@@ -381,7 +409,7 @@ On the client, CSS is injected synchronously into the DOM (idempotent via the in
381
409
 
382
410
  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
411
 
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).
412
+ 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
413
 
386
414
  ### useStyles
387
415
 
@@ -419,6 +447,22 @@ function ThemeStyles() {
419
447
  }
420
448
  ```
421
449
 
450
+ The selector can be a list (`'.uni-checkbox, uni-checkbox'`) — every item gets
451
+ the states and sub-elements, with no `:is()` wrapping needed. Root states
452
+ (`@root(...)`) on a selector that is the root itself (`:root`, `html`) apply to
453
+ that element. Local `@keyframes` are injected with the rules, under the same
454
+ resolved names `tasty()` components use, and `@starting` states emit
455
+ `@starting-style`.
456
+
457
+ A slot — the `id`, or the selector when no `id` is given — holds exactly one
458
+ injection **per `root`**. So:
459
+
460
+ - Changing the styles replaces the previous CSS rather than adding to it.
461
+ - Passing styles that produce no CSS (for example `{}`) clears the slot.
462
+ - The same selector used in two shadow roots keeps a separate injection in each.
463
+ - Two independent call sites that share a selector share a slot, and the last
464
+ render wins. Give them distinct `id`s if they should coexist.
465
+
422
466
  ### useRawCSS
423
467
 
424
468
  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 +479,9 @@ function GlobalReset() {
435
479
  }
436
480
  ```
437
481
 
482
+ An `id` slot holds one injection per `root`. Without an `id` the CSS is deduped
483
+ by content and permanent — there is nothing to replace it with later.
484
+
438
485
  ### useKeyframes
439
486
 
440
487
  Inject `@keyframes` rules and return the generated animation name:
@@ -448,14 +495,14 @@ function Spinner() {
448
495
  from: { transform: 'rotate(0deg)' },
449
496
  to: { transform: 'rotate(360deg)' },
450
497
  },
451
- { name: 'spin' }
498
+ { name: 'spin' },
452
499
  );
453
500
 
454
501
  return <div style={{ animation: `${spin} 1s linear infinite` }} />;
455
502
  }
456
503
  ```
457
504
 
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:
505
+ `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
506
 
460
507
  ```tsx
461
508
  function Pulse({ scale }: { scale: number }) {
@@ -464,13 +511,24 @@ function Pulse({ scale }: { scale: number }) {
464
511
  '0%': { transform: 'scale(1)' },
465
512
  '100%': { transform: `scale(${scale})` },
466
513
  }),
467
- [scale]
514
+ [scale],
515
+ { name: 'pulse' },
468
516
  );
469
517
 
470
- return <div style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }} />;
518
+ return (
519
+ <div
520
+ style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }}
521
+ />
522
+ );
471
523
  }
472
524
  ```
473
525
 
526
+ Passing `name` claims a slot owned by that one call site, per `root` — much like
527
+ `id` in `useGlobalStyles()` and `useRawCSS()`. When the steps change the previous
528
+ `@keyframes` rule is disposed and the name is reused, so the rules don't
529
+ accumulate and the returned name stays stable. Anonymous keyframes are permanent
530
+ and shared by content.
531
+
474
532
  ### useProperty
475
533
 
476
534
  Register a CSS `@property` rule so a custom property can animate smoothly:
@@ -517,8 +575,16 @@ For multiple weights/styles, pass an array:
517
575
 
518
576
  ```tsx
519
577
  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' },
578
+ {
579
+ src: 'url("/fonts/brand-regular.woff2") format("woff2")',
580
+ fontWeight: 400,
581
+ fontDisplay: 'swap',
582
+ },
583
+ {
584
+ src: 'url("/fonts/brand-bold.woff2") format("woff2")',
585
+ fontWeight: 700,
586
+ fontDisplay: 'swap',
587
+ },
522
588
  ]);
523
589
  ```
524
590
 
@@ -536,11 +602,14 @@ Inject a `@counter-style` rule and get back the counter style name. Permanent
536
602
  import { useCounterStyle } from '@tenphi/tasty';
537
603
 
538
604
  function EmojiList() {
539
- const styleName = useCounterStyle({
540
- system: 'cyclic',
541
- symbols: '"👍"',
542
- suffix: '" "',
543
- }, { name: 'thumbs' });
605
+ const styleName = useCounterStyle(
606
+ {
607
+ system: 'cyclic',
608
+ symbols: '"👍"',
609
+ suffix: '" "',
610
+ },
611
+ { name: 'thumbs' },
612
+ );
544
613
 
545
614
  return (
546
615
  <ol style={{ listStyleType: styleName }}>
@@ -560,6 +629,46 @@ function useCounterStyle(
560
629
  ): string;
561
630
  ```
562
631
 
632
+ ### useFunction
633
+
634
+ 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`.
635
+
636
+ ```tsx
637
+ import { tasty, useFunction } from '@tenphi/tasty';
638
+
639
+ const Box = tasty({ styles: { margin: '$$negative(10px) top' } });
640
+
641
+ function Layout() {
642
+ useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
643
+ return <Box />;
644
+ }
645
+ ```
646
+
647
+ 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.
648
+
649
+ Inside a `tasty()` component you call functions with the same `$$name(...)` sugar:
650
+
651
+ ```tsx
652
+ const Box = tasty({
653
+ styles: {
654
+ '@function': { $$negative: { args: ['$value'], result: '(-1 * $value)' } },
655
+ margin: '$$negative(10px) top',
656
+ },
657
+ });
658
+ ```
659
+
660
+ Signature:
661
+
662
+ ```ts
663
+ function useFunction(
664
+ name: string,
665
+ definition: FunctionDefinition,
666
+ options?: { root?: Document | ShadowRoot },
667
+ ): void;
668
+ ```
669
+
670
+ 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.
671
+
563
672
  ### Troubleshooting
564
673
 
565
674
  - 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 +685,6 @@ function useCounterStyle(
576
685
  - **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
577
686
  - **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
578
687
  - **[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
688
+ - **[Build-Time Extraction (`tastyStatic`)](tasty-static.md)** — Static styling with the Babel plugin
580
689
  - **[Server-Side Rendering](ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks
581
690
  - **[Debug Utilities](debug.md)** — Inspect injected CSS, cache state, and active styles at runtime