@tenphi/tasty 0.0.0-snapshot.9155dd5 → 0.0.0-snapshot.92cfaf9

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 (109) hide show
  1. package/README.md +208 -248
  2. package/dist/chunks/definitions.d.ts +1 -1
  3. package/dist/chunks/definitions.js +1 -1
  4. package/dist/chunks/definitions.js.map +1 -1
  5. package/dist/config.d.ts +45 -2
  6. package/dist/config.js +63 -23
  7. package/dist/config.js.map +1 -1
  8. package/dist/core/index.d.ts +5 -5
  9. package/dist/core/index.js +4 -4
  10. package/dist/counter-style/index.js +51 -0
  11. package/dist/counter-style/index.js.map +1 -0
  12. package/dist/debug.d.ts +26 -141
  13. package/dist/debug.js +356 -635
  14. package/dist/debug.js.map +1 -1
  15. package/dist/font-face/index.js +63 -0
  16. package/dist/font-face/index.js.map +1 -0
  17. package/dist/hooks/resolve-ssr-collector.js +15 -0
  18. package/dist/hooks/resolve-ssr-collector.js.map +1 -0
  19. package/dist/hooks/useCounterStyle.d.ts +50 -0
  20. package/dist/hooks/useCounterStyle.js +47 -0
  21. package/dist/hooks/useCounterStyle.js.map +1 -0
  22. package/dist/hooks/useFontFace.d.ts +43 -0
  23. package/dist/hooks/useFontFace.js +71 -0
  24. package/dist/hooks/useFontFace.js.map +1 -0
  25. package/dist/hooks/useGlobalStyles.js +1 -5
  26. package/dist/hooks/useGlobalStyles.js.map +1 -1
  27. package/dist/hooks/useKeyframes.js +1 -5
  28. package/dist/hooks/useKeyframes.js.map +1 -1
  29. package/dist/hooks/useProperty.js +1 -5
  30. package/dist/hooks/useProperty.js.map +1 -1
  31. package/dist/hooks/useRawCSS.js +1 -5
  32. package/dist/hooks/useRawCSS.js.map +1 -1
  33. package/dist/hooks/useStyles.js +35 -46
  34. package/dist/hooks/useStyles.js.map +1 -1
  35. package/dist/index.d.ts +8 -6
  36. package/dist/index.js +6 -4
  37. package/dist/injector/index.d.ts +20 -2
  38. package/dist/injector/index.js +19 -1
  39. package/dist/injector/index.js.map +1 -1
  40. package/dist/injector/injector.d.ts +19 -1
  41. package/dist/injector/injector.js +35 -0
  42. package/dist/injector/injector.js.map +1 -1
  43. package/dist/injector/sheet-manager.js +7 -2
  44. package/dist/injector/sheet-manager.js.map +1 -1
  45. package/dist/injector/types.d.ts +61 -1
  46. package/dist/parser/classify.js +3 -3
  47. package/dist/parser/classify.js.map +1 -1
  48. package/dist/parser/const.js +17 -1
  49. package/dist/parser/const.js.map +1 -1
  50. package/dist/pipeline/index.d.ts +2 -0
  51. package/dist/pipeline/index.js +56 -17
  52. package/dist/pipeline/index.js.map +1 -1
  53. package/dist/pipeline/materialize.js +0 -1
  54. package/dist/pipeline/materialize.js.map +1 -1
  55. package/dist/properties/index.js.map +1 -1
  56. package/dist/ssr/collector.d.ts +17 -0
  57. package/dist/ssr/collector.js +50 -6
  58. package/dist/ssr/collector.js.map +1 -1
  59. package/dist/ssr/format-rules.js +7 -4
  60. package/dist/ssr/format-rules.js.map +1 -1
  61. package/dist/ssr/index.js +1 -1
  62. package/dist/states/index.js +2 -0
  63. package/dist/states/index.js.map +1 -1
  64. package/dist/styles/border.js +2 -2
  65. package/dist/styles/border.js.map +1 -1
  66. package/dist/styles/predefined.js +1 -1
  67. package/dist/styles/predefined.js.map +1 -1
  68. package/dist/styles/preset.d.ts +5 -0
  69. package/dist/styles/preset.js +48 -47
  70. package/dist/styles/preset.js.map +1 -1
  71. package/dist/styles/types.d.ts +46 -7
  72. package/dist/tasty.d.ts +30 -892
  73. package/dist/tasty.js +20 -7
  74. package/dist/tasty.js.map +1 -1
  75. package/dist/utils/color-math.d.ts +2 -1
  76. package/dist/utils/color-math.js +40 -8
  77. package/dist/utils/color-math.js.map +1 -1
  78. package/dist/utils/color-space.js +78 -35
  79. package/dist/utils/color-space.js.map +1 -1
  80. package/dist/utils/mod-attrs.js +1 -1
  81. package/dist/utils/mod-attrs.js.map +1 -1
  82. package/dist/utils/process-tokens.js +1 -1
  83. package/dist/utils/process-tokens.js.map +1 -1
  84. package/dist/utils/styles.d.ts +1 -3
  85. package/dist/utils/styles.js +4 -6
  86. package/dist/utils/styles.js.map +1 -1
  87. package/dist/utils/typography.js +8 -0
  88. package/dist/utils/typography.js.map +1 -1
  89. package/dist/zero/babel.d.ts +14 -2
  90. package/dist/zero/babel.js +52 -24
  91. package/dist/zero/babel.js.map +1 -1
  92. package/dist/zero/extractor.js +53 -1
  93. package/dist/zero/extractor.js.map +1 -1
  94. package/docs/PIPELINE.md +1 -1
  95. package/docs/README.md +31 -0
  96. package/docs/adoption.md +16 -6
  97. package/docs/comparison.md +16 -9
  98. package/docs/configuration.md +65 -2
  99. package/docs/debug.md +152 -339
  100. package/docs/design-system.md +26 -3
  101. package/docs/dsl.md +136 -3
  102. package/docs/getting-started.md +29 -13
  103. package/docs/injector.md +2 -2
  104. package/docs/methodology.md +71 -5
  105. package/docs/runtime.md +228 -34
  106. package/docs/ssr.md +5 -3
  107. package/docs/styles.md +28 -23
  108. package/docs/tasty-static.md +15 -2
  109. package/package.json +3 -2
package/docs/runtime.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Runtime API
2
2
 
3
- The React-specific `tasty()` component factory, component props, and hooks. For the shared style language (state maps, tokens, units, extending semantics), see [Style DSL](dsl.md). For global configuration, see [Configuration](configuration.md).
3
+ The React-specific `tasty()` component factory, component props, and hooks. 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).
4
4
 
5
5
  ---
6
6
 
@@ -74,6 +74,86 @@ For predefined style prop lists (`FLOW_STYLES`, `POSITION_STYLES`, `DIMENSION_ST
74
74
 
75
75
  ---
76
76
 
77
+ ## Mod Props
78
+
79
+ Use `modProps` to expose modifier keys as direct component props instead of requiring the `mods` object:
80
+
81
+ ```jsx
82
+ // Before: mods object
83
+ <Button mods={{ isLoading: true, size: 'large' }}>Submit</Button>
84
+
85
+ // After: mod props
86
+ <Button isLoading size="large">Submit</Button>
87
+ ```
88
+
89
+ ### Array form
90
+
91
+ List modifier key names. Types default to `ModValue` (`boolean | string | number | undefined | null`):
92
+
93
+ ```jsx
94
+ const Button = tasty({
95
+ modProps: ['isLoading', 'isSelected'] as const,
96
+ styles: {
97
+ fill: { '': '#surface', isLoading: '#surface.5' },
98
+ border: { '': '1bw solid #outline', isSelected: '2bw solid #primary' },
99
+ },
100
+ });
101
+
102
+ <Button isLoading isSelected>Submit</Button>
103
+ // Renders: <button data-is-loading="" data-is-selected="">Submit</button>
104
+ ```
105
+
106
+ ### Object form (typed)
107
+
108
+ Map modifier names to type descriptors for precise TypeScript types:
109
+
110
+ ```tsx
111
+ const Button = tasty({
112
+ modProps: {
113
+ isLoading: Boolean, // isLoading?: boolean
114
+ isSelected: Boolean, // isSelected?: boolean
115
+ size: ['small', 'medium', 'large'] as const, // size?: 'small' | 'medium' | 'large'
116
+ },
117
+ styles: {
118
+ padding: { '': '2x 4x', 'size=small': '1x 2x', 'size=large': '3x 6x' },
119
+ fill: { '': '#surface', isLoading: '#surface.5' },
120
+ },
121
+ });
122
+
123
+ <Button isLoading size="large">Submit</Button>
124
+ // Renders: <button data-is-loading="" data-size="large">Submit</button>
125
+ ```
126
+
127
+ Available type descriptors:
128
+
129
+ | Descriptor | TypeScript type | Example |
130
+ |---|---|---|
131
+ | `Boolean` | `boolean` | `isLoading: Boolean` |
132
+ | `String` | `string` | `label: String` |
133
+ | `Number` | `number` | `count: Number` |
134
+ | `['a', 'b'] as const` | `'a' \| 'b'` | `size: ['sm', 'md', 'lg'] as const` |
135
+
136
+ ### Merge with `mods`
137
+
138
+ Mod props and the `mods` object can be used together. Mod props take precedence:
139
+
140
+ ```jsx
141
+ <Button mods={{ isLoading: false, extra: true }} isLoading>
142
+ // isLoading=true wins (from mod prop), extra=true preserved from mods
143
+ ```
144
+
145
+ ### When to use `modProps` vs `mods`
146
+
147
+ | Use case | Recommendation |
148
+ |---|---|
149
+ | Component has a fixed set of known modifiers | `modProps` — cleaner API, better TypeScript autocomplete |
150
+ | Component needs arbitrary/dynamic modifiers | `mods` — open-ended `Record<string, ModValue>` |
151
+ | Both fixed and dynamic | Combine: `modProps` for known keys, `mods` for ad-hoc |
152
+
153
+ For architecture guidance on when to use modifiers vs `styleProps`, see [Methodology — modProps and mods](methodology.md#modprops-and-mods).
154
+
155
+ ---
156
+
77
157
  ## Variants
78
158
 
79
159
  Define named style variations. Only CSS for variants actually used at runtime is injected:
@@ -178,31 +258,7 @@ const Card = tasty({
178
258
 
179
259
  ### Selector Affix (`$`)
180
260
 
181
- Control how a sub-element selector attaches to the root selector using the `$` property inside the sub-element's styles:
182
-
183
- | Pattern | Result | Description |
184
- |---------|--------|-------------|
185
- | *(none)* | ` [el]` | Descendant (default) |
186
- | `>` | `> [el]` | Direct child |
187
- | `>Body>Row>` | `> [Body] > [Row] > [el]` | Chained elements |
188
- | `::before` | `::before` | Root pseudo (no key) |
189
- | `@::before` | `[el]::before` | Pseudo on the sub-element |
190
- | `>@:hover` | `> [el]:hover` | Pseudo-class on the sub-element |
191
- | `>@.active` | `> [el].active` | Class on the sub-element |
192
-
193
- The `@` placeholder marks exactly where the `[data-element="..."]` selector is injected, allowing you to attach pseudo-classes, pseudo-elements, or class selectors directly to the sub-element instead of the root:
194
-
195
- ```jsx
196
- const List = tasty({
197
- styles: {
198
- Item: {
199
- $: '>@:last-child',
200
- border: 'none',
201
- },
202
- },
203
- });
204
- // → .t0 > [data-element="Item"]:last-child { border: none }
205
- ```
261
+ The `$` property inside a sub-element's styles controls how its selector attaches to the root selector — combinators, HTML tags, pseudo-elements, the `@` placeholder, and more. For the full reference table and injection rules, see [DSL — Selector Affix](dsl.md#selector-affix-).
206
262
 
207
263
  For the mental model behind sub-elements — how they share root state context and how this differs from BEM — see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
208
264
 
@@ -262,23 +318,160 @@ function GlobalReset() {
262
318
  }
263
319
  ```
264
320
 
265
- ### useMergeStyles
321
+ ### useKeyframes
266
322
 
267
- Merge multiple style objects for compound component prop forwarding:
323
+ Inject `@keyframes` rules and return the generated animation name:
268
324
 
269
325
  ```tsx
270
- import { useMergeStyles } from '@tenphi/tasty';
326
+ import { useKeyframes } from '@tenphi/tasty';
271
327
 
272
- function MyTabs({ styles, tabListStyles, prefixStyles }) {
273
- const mergedStyles = useMergeStyles(styles, {
274
- TabList: tabListStyles,
275
- Prefix: prefixStyles,
328
+ function Spinner() {
329
+ const spin = useKeyframes(
330
+ {
331
+ from: { transform: 'rotate(0deg)' },
332
+ to: { transform: 'rotate(360deg)' },
333
+ },
334
+ { name: 'spin' }
335
+ );
336
+
337
+ return <div style={{ animation: `${spin} 1s linear infinite` }} />;
338
+ }
339
+ ```
340
+
341
+ `useKeyframes()` also supports a factory function with dependencies:
342
+
343
+ ```tsx
344
+ function Pulse({ scale }: { scale: number }) {
345
+ const pulse = useKeyframes(
346
+ () => ({
347
+ '0%': { transform: 'scale(1)' },
348
+ '100%': { transform: `scale(${scale})` },
349
+ }),
350
+ [scale]
351
+ );
352
+
353
+ return <div style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }} />;
354
+ }
355
+ ```
356
+
357
+ ### useProperty
358
+
359
+ Register a CSS `@property` rule so a custom property can animate smoothly:
360
+
361
+ ```tsx
362
+ import { useProperty } from '@tenphi/tasty';
363
+
364
+ function Spinner() {
365
+ useProperty('$rotation', {
366
+ syntax: '<angle>',
367
+ inherits: false,
368
+ initialValue: '0deg',
369
+ });
370
+
371
+ return <div style={{ transform: 'rotate(var(--rotation))' }} />;
372
+ }
373
+ ```
374
+
375
+ `useProperty()` accepts Tasty token syntax for the property name:
376
+
377
+ - `$name` defines `--name`
378
+ - `#name` defines `--name-color` and auto-infers `<color>`
379
+ - `--name` is also supported for existing CSS variables
380
+
381
+ ### useFontFace
382
+
383
+ Inject `@font-face` rules for custom fonts. Permanent — no cleanup on unmount. Deduplicates by content.
384
+
385
+ ```tsx
386
+ import { useFontFace } from '@tenphi/tasty';
387
+
388
+ function App() {
389
+ useFontFace('Brand Sans', {
390
+ src: 'url("/fonts/brand-sans.woff2") format("woff2")',
391
+ fontWeight: '400 700',
392
+ fontDisplay: 'swap',
276
393
  });
277
394
 
278
- return <TabsElement styles={mergedStyles} />;
395
+ return <div style={{ fontFamily: '"Brand Sans", sans-serif' }}>Hello</div>;
279
396
  }
280
397
  ```
281
398
 
399
+ For multiple weights/styles, pass an array:
400
+
401
+ ```tsx
402
+ useFontFace('Brand Sans', [
403
+ { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
404
+ { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
405
+ ]);
406
+ ```
407
+
408
+ Signature:
409
+
410
+ ```ts
411
+ function useFontFace(family: string, input: FontFaceInput): void;
412
+ ```
413
+
414
+ ### useCounterStyle
415
+
416
+ Inject a `@counter-style` rule and get back the counter style name. Permanent — no cleanup on unmount. Deduplicates by name.
417
+
418
+ ```tsx
419
+ import { useCounterStyle } from '@tenphi/tasty';
420
+
421
+ function EmojiList() {
422
+ const styleName = useCounterStyle({
423
+ system: 'cyclic',
424
+ symbols: '"👍"',
425
+ suffix: '" "',
426
+ }, { name: 'thumbs' });
427
+
428
+ return (
429
+ <ol style={{ listStyleType: styleName }}>
430
+ <li>First</li>
431
+ <li>Second</li>
432
+ </ol>
433
+ );
434
+ }
435
+ ```
436
+
437
+ Factory form with dependencies:
438
+
439
+ ```tsx
440
+ function DynamicList({ marker }: { marker: string }) {
441
+ const styleName = useCounterStyle(
442
+ () => ({
443
+ system: 'cyclic',
444
+ symbols: `"${marker}"`,
445
+ suffix: '" "',
446
+ }),
447
+ [marker],
448
+ );
449
+
450
+ return <ol style={{ listStyleType: styleName }}>...</ol>;
451
+ }
452
+ ```
453
+
454
+ Signatures:
455
+
456
+ ```ts
457
+ function useCounterStyle(
458
+ descriptors: CounterStyleDescriptors,
459
+ options?: { name?: string; root?: Document | ShadowRoot },
460
+ ): string;
461
+
462
+ function useCounterStyle(
463
+ factory: () => CounterStyleDescriptors,
464
+ deps: readonly unknown[],
465
+ options?: { name?: string; root?: Document | ShadowRoot },
466
+ ): string;
467
+ ```
468
+
469
+ ### Troubleshooting
470
+
471
+ - 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).
472
+ - SSR output looks wrong: check the [SSR guide](ssr.md) because the hooks integrate with SSR collectors differently than the client-only runtime path.
473
+ - Animation/custom property issues: prefer `useKeyframes()` and `useProperty()` over raw CSS when you want Tasty to manage injection and SSR collection for you.
474
+
282
475
  ---
283
476
 
284
477
  ## Learn more
@@ -289,3 +482,4 @@ function MyTabs({ styles, tabListStyles, prefixStyles }) {
289
482
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
290
483
  - **[Zero Runtime (tastyStatic)](tasty-static.md)** — Build-time static styling with Babel plugin
291
484
  - **[Server-Side Rendering](ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks
485
+ - **[Debug Utilities](debug.md)** — Inspect injected CSS, cache state, and active styles at runtime
package/docs/ssr.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Server-Side Rendering (SSR)
2
2
 
3
- Tasty supports server-side rendering with zero-cost client hydration. Your existing `tasty()` components work unchanged -- SSR is opt-in and requires no per-component modifications.
3
+ Tasty supports server-side rendering with zero-cost client hydration. This does **not** introduce a separate styling engine: SSR uses the same runtime `tasty()` pipeline you already use on the client, then adds server-side CSS collection and client-side cache hydration. Your existing `tasty()` components work unchanged, and SSR remains opt-in with no per-component modifications. For the broader docs map, see the [Docs Hub](README.md).
4
4
 
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ Tasty supports server-side rendering with zero-cost client hydration. Your exist
8
8
 
9
9
  | Dependency | Version | Required for |
10
10
  |---|---|---|
11
- | `react` | >= 18 | All SSR entry points (peer dependency of `@tenphi/tasty`) |
11
+ | `react` | >= 18 | All SSR entry points (matches the current peer dependency of `@tenphi/tasty`) |
12
12
  | `next` | >= 13 | Next.js integration (`@tenphi/tasty/ssr/next`) — App Router with `useServerInsertedHTML` |
13
13
  | Node.js | >= 20 | Generic / streaming SSR (`@tenphi/tasty/ssr`) — uses `node:async_hooks` for `AsyncLocalStorage` |
14
14
 
@@ -18,7 +18,7 @@ The Astro integration (`@tenphi/tasty/ssr/astro`) has no additional dependencies
18
18
 
19
19
  ## How It Works
20
20
 
21
- During server rendering, `useStyles()` detects a `ServerStyleCollector` and collects CSS into it instead of trying to access the DOM. The collector accumulates all styles, serializes them as `<style>` tags and a cache state script in the HTML. On the client, `hydrateTastyCache()` pre-populates the injector cache so that `useStyles()` skips the rendering pipeline entirely during hydration.
21
+ When the environment can execute runtime React code during server rendering, the same `tasty()` and `useStyles()` calls can run there too. In Next.js, generic React SSR, and Astro islands, Tasty simply changes where that runtime-generated CSS goes: `useStyles()` detects a `ServerStyleCollector` and collects CSS into it instead of trying to access the DOM. The collector accumulates all styles, serializes them as `<style>` tags and a cache state script in the HTML. On the client, `hydrateTastyCache()` pre-populates the injector cache so that `useStyles()` skips the rendering pipeline entirely during hydration.
22
22
 
23
23
  ```
24
24
  Server Client
@@ -317,6 +317,8 @@ Server-safe style collector. One instance per request.
317
317
  | `collectChunk(cacheKey, className, rules)` | Record CSS rules for a chunk. Deduplicated by `cacheKey`. |
318
318
  | `collectKeyframes(name, css)` | Record a `@keyframes` rule. Deduplicated by name. |
319
319
  | `collectProperty(name, css)` | Record a `@property` rule. Deduplicated by name. |
320
+ | `collectFontFace(key, css)` | Record a `@font-face` rule. Deduplicated by content hash. |
321
+ | `collectCounterStyle(name, css)` | Record a `@counter-style` rule. Deduplicated by name. |
320
322
  | `getCSS()` | Get all collected CSS as a single string. For non-streaming SSR. |
321
323
  | `flushCSS()` | Get only CSS collected since the last flush. For streaming SSR. |
322
324
  | `getCacheState()` | Serialize `{ entries: Record<cacheKey, className>, classCounter }` for client hydration. |
package/docs/styles.md CHANGED
@@ -146,37 +146,39 @@ Individual props `marginTop`, `marginRight`, `marginBottom`, `marginLeft`, `marg
146
146
 
147
147
  ### `width`
148
148
 
149
- Element width with min/max control.
149
+ Element width with min/max control. One, two, or three values set `min-width`, `width`, and `max-width` together.
150
150
 
151
- **Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
151
+ **Positional syntax:**
152
152
 
153
- **Modifiers:** `min`, `max`, `fixed`
153
+ | Value | min-width | width | max-width |
154
+ |-------|-----------|-------|-----------|
155
+ | `"10x"` | initial | `10x` | initial |
156
+ | `"1x 10x"` | `1x` | auto | `10x` |
157
+ | `"1x 5x 10x"` | `1x` | `5x` | `10x` |
158
+ | `"0 100% 800px"` | `0` | `100%` | `800px` |
159
+ | `"initial 100% 1400px"` | initial | `100%` | `1400px` |
160
+
161
+ **Modifier syntax:**
162
+
163
+ | Value | min-width | width | max-width |
164
+ |-------|-----------|-------|-----------|
165
+ | `"min 2x"` | `2x` | auto | initial |
166
+ | `"max 100%"` | initial | auto | `100%` |
167
+ | `"fixed 200px"` | `200px` | `200px` | `200px` |
154
168
 
155
169
  **Keywords:** `stretch`, `max-content`, `min-content`, `fit-content`
156
170
 
157
171
  | Value | Effect |
158
172
  |-------|--------|
159
- | `"10x"` | Width `10x`, min `initial`, max `initial` |
160
- | `"1x 10x"` | Width `auto`, min `1x`, max `10x` |
161
- | `"1x 5x 10x"` | Min `1x`, width `5x`, max `10x` |
162
- | `"min 2x"` | Min-width `2x`, width `auto`, max `initial` |
163
- | `"max 100%"` | Max-width `100%`, width `auto`, min `initial` |
164
- | `"fixed 200px"` | Min, width, and max all set to `200px` |
165
173
  | `"stretch"` | Fill available space (cross-browser) |
166
- | `true` | Width `auto`, min `initial`, max `initial` |
174
+ | `true` | Reset to `auto` / `initial` / `initial` |
167
175
  | Number | Converted to `px` |
168
176
 
169
177
  Separate `minWidth` and `maxWidth` props are supported and override values from the `width` syntax.
170
178
 
171
179
  ### `height`
172
180
 
173
- Element height. Same syntax and modifiers as `width`.
174
-
175
- **Syntax:** `[value]` | `[min max]` | `[min value max]` | `[modifier value]`
176
-
177
- **Modifiers:** `min`, `max`, `fixed`
178
-
179
- **Keywords:** `max-content`, `min-content`, `fit-content`
181
+ Element height. Same syntax, modifiers, and positional patterns as `width`.
180
182
 
181
183
  Separate `minHeight` and `maxHeight` props are supported and override values from the `height` syntax.
182
184
 
@@ -359,24 +361,27 @@ Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
359
361
 
360
362
  Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, and text-transform from named design tokens.
361
363
 
362
- **Syntax:** `[name] [modifiers...]`
364
+ **Syntax:** `name`, `name / modifier`, or `modifier` (shorthand)
363
365
 
364
366
  Preset names are project-specific (e.g. `h1`–`h6`, `t1`–`t4`, `p1`–`p4`). Register them for autocomplete by augmenting `TastyPresetNames`.
365
367
 
368
+ Use `/` to separate the preset name from a modifier. When a modifier is used alone (without a name), the preset name defaults to `inherit`.
369
+
366
370
  **Modifiers:**
367
371
 
368
372
  | Modifier | Effect |
369
373
  |----------|--------|
370
- | `strong` | Sets `font-weight` to bold (from `$bold-font-weight` token) |
374
+ | `strong` (or `bold`) | Sets `font-weight` to bold (from `$bold-font-weight` token) |
371
375
  | `italic` | Sets `font-style: italic` |
372
376
  | `icon` | Sets font-size and line-height to icon size |
373
377
  | `tight` | Sets line-height equal to font-size |
374
378
 
375
379
  ```jsx
376
- preset="h1" // heading 1
377
- preset="h2 strong" // bold heading 2
378
- preset="t3 italic" // italic text 3
379
- preset="t2 tight" // text 2 with tight line-height
380
+ preset="h1" // heading 1
381
+ preset="h2 / strong" // bold heading 2
382
+ preset="t3 / italic" // italic text 3
383
+ preset="t2 / tight" // text 2 with tight line-height
384
+ preset="bold" // inherit preset with bold (shorthand for "inherit / bold")
380
385
  ```
381
386
 
382
387
  Individual typography props (`fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform`) can be used alongside `preset` to override specific values, but using `preset` alone is recommended.
@@ -1,6 +1,6 @@
1
1
  # Zero Runtime Mode (tastyStatic)
2
2
 
3
- `tastyStatic` is a build-time utility for generating CSS with zero runtime overhead. It's designed for static sites, no-JS websites, and performance-critical applications where you want to eliminate all runtime styling code.
3
+ `tastyStatic` is a build-time utility for generating CSS with zero runtime overhead. It's designed for static sites, no-JS websites, and performance-critical applications where you want to eliminate all runtime styling code. For the broader docs map, see the [Docs Hub](README.md).
4
4
 
5
5
  ---
6
6
 
@@ -130,6 +130,8 @@ module.exports = {
130
130
  };
131
131
  ```
132
132
 
133
+ These examples use `data-schema="dark"` as the root-state convention. If your app already uses a different root attribute such as `data-theme`, keep the same alias pattern and swap the attribute name consistently in your zero-runtime config.
134
+
133
135
  ### With Configuration
134
136
 
135
137
  ```javascript
@@ -141,7 +143,7 @@ module.exports = {
141
143
  states: {
142
144
  '@mobile': '@media(w < 768px)',
143
145
  '@tablet': '@media(w < 1024px)',
144
- '@dark': '@root(theme=dark)',
146
+ '@dark': '@root(schema=dark)',
145
147
  },
146
148
  devMode: true,
147
149
  },
@@ -161,6 +163,8 @@ module.exports = {
161
163
  | `config.states` | `Record<string, string>` | `{}` | Predefined state aliases |
162
164
  | `config.devMode` | `boolean` | `false` | Add source comments to CSS |
163
165
  | `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
166
+ | `config.fontFace` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
167
+ | `config.counterStyle` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
164
168
 
165
169
  ---
166
170
 
@@ -413,8 +417,17 @@ const card = tastyStatic({
413
417
 
414
418
  ---
415
419
 
420
+ ## Common Issues
421
+
422
+ - No CSS file is generated: make sure the Babel plugin actually runs for files importing `@tenphi/tasty/static`, and verify the `output` path is writable.
423
+ - Styles stay dynamic by mistake: `tastyStatic()` only supports build-time-known values. Move runtime values to CSS variables or switch that component to runtime `tasty()`.
424
+ - Turbopack config behaves inconsistently: prefer `configFile` over inline functions so the setup stays JSON-serializable.
425
+
426
+ ---
427
+
416
428
  ## Related
417
429
 
430
+ - [Docs Hub](README.md) — Choose the right guide by task or rendering mode
418
431
  - [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
419
432
  - [Runtime API](runtime.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, hooks
420
433
  - [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.9155dd5",
3
+ "version": "0.0.0-snapshot.92cfaf9",
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",
@@ -78,6 +78,7 @@
78
78
  "format": "prettier --write \"src/**/*.{ts,tsx}\"",
79
79
  "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
80
80
  "size": "size-limit",
81
+ "bench": "vitest bench",
81
82
  "prepublishOnly": "pnpm run build",
82
83
  "changeset": "changeset",
83
84
  "version": "changeset version",
@@ -203,7 +204,7 @@
203
204
  "path",
204
205
  "crypto"
205
206
  ],
206
- "limit": "39 kB"
207
+ "limit": "40 kB"
207
208
  }
208
209
  ]
209
210
  }