@tenphi/tasty 0.0.0-snapshot.ef8cc29 → 0.0.0-snapshot.efb24cc
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.
- package/README.md +65 -215
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +1 -2
- package/dist/chunks/cacheKey.js.map +1 -1
- package/dist/chunks/definitions.d.ts +1 -1
- package/dist/chunks/definitions.js +2 -3
- package/dist/chunks/definitions.js.map +1 -1
- package/dist/chunks/index.d.ts +1 -0
- package/dist/chunks/renderChunk.d.ts +1 -0
- package/dist/chunks/renderChunk.js +1 -2
- package/dist/chunks/renderChunk.js.map +1 -1
- package/dist/compute-styles.d.ts +31 -0
- package/dist/compute-styles.js +322 -0
- package/dist/compute-styles.js.map +1 -0
- package/dist/config.d.ts +105 -21
- package/dist/config.js +175 -49
- package/dist/config.js.map +1 -1
- package/dist/core/index.d.ts +7 -7
- package/dist/core/index.js +8 -8
- package/dist/counter-style/index.js +51 -0
- package/dist/counter-style/index.js.map +1 -0
- package/dist/debug.js +5 -6
- package/dist/debug.js.map +1 -1
- package/dist/font-face/index.js +63 -0
- package/dist/font-face/index.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useCounterStyle.d.ts +36 -0
- package/dist/hooks/useCounterStyle.js +65 -0
- package/dist/hooks/useCounterStyle.js.map +1 -0
- package/dist/hooks/useFontFace.d.ts +45 -0
- package/dist/hooks/useFontFace.js +66 -0
- package/dist/hooks/useFontFace.js.map +1 -0
- package/dist/hooks/useGlobalStyles.d.ts +18 -2
- package/dist/hooks/useGlobalStyles.js +52 -47
- package/dist/hooks/useGlobalStyles.js.map +1 -1
- package/dist/hooks/useKeyframes.d.ts +4 -2
- package/dist/hooks/useKeyframes.js +43 -57
- package/dist/hooks/useKeyframes.js.map +1 -1
- package/dist/hooks/useProperty.d.ts +4 -2
- package/dist/hooks/useProperty.js +30 -48
- package/dist/hooks/useProperty.js.map +1 -1
- package/dist/hooks/useRawCSS.d.ts +13 -44
- package/dist/hooks/useRawCSS.js +91 -28
- package/dist/hooks/useRawCSS.js.map +1 -1
- package/dist/hooks/useStyles.d.ts +3 -8
- package/dist/hooks/useStyles.js +7 -225
- package/dist/hooks/useStyles.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.js +11 -9
- package/dist/injector/index.d.ts +36 -19
- package/dist/injector/index.js +43 -20
- package/dist/injector/index.js.map +1 -1
- package/dist/injector/injector.d.ts +53 -3
- package/dist/injector/injector.js +235 -14
- package/dist/injector/injector.js.map +1 -1
- package/dist/injector/sheet-manager.d.ts +9 -13
- package/dist/injector/sheet-manager.js +41 -71
- package/dist/injector/sheet-manager.js.map +1 -1
- package/dist/injector/types.d.ts +112 -21
- package/dist/keyframes/index.js +1 -1
- package/dist/parser/classify.js +4 -5
- package/dist/parser/classify.js.map +1 -1
- package/dist/parser/const.js +30 -3
- package/dist/parser/const.js.map +1 -1
- package/dist/parser/lru.js +1 -1
- package/dist/parser/lru.js.map +1 -1
- package/dist/parser/parser.js +1 -2
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +1 -1
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/types.js +1 -1
- package/dist/parser/types.js.map +1 -1
- package/dist/pipeline/conditions.js +1 -1
- package/dist/pipeline/conditions.js.map +1 -1
- package/dist/pipeline/exclusive.js +58 -4
- package/dist/pipeline/exclusive.js.map +1 -1
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +39 -12
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/materialize.js +57 -5
- package/dist/pipeline/materialize.js.map +1 -1
- package/dist/pipeline/parseStateKey.js +5 -6
- package/dist/pipeline/parseStateKey.js.map +1 -1
- package/dist/pipeline/simplify.js +181 -7
- package/dist/pipeline/simplify.js.map +1 -1
- package/dist/pipeline/warnings.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/okhsl-plugin.js +1 -2
- package/dist/plugins/okhsl-plugin.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -1
- package/dist/properties/index.js +2 -3
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/property-type-resolver.js +1 -2
- package/dist/properties/property-type-resolver.js.map +1 -1
- package/dist/rsc-cache.js +79 -0
- package/dist/rsc-cache.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +15 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +89 -10
- package/dist/ssr/astro.js +113 -29
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/async-storage.js +15 -6
- package/dist/ssr/async-storage.js.map +1 -1
- package/dist/ssr/collect-auto-properties.js +29 -11
- package/dist/ssr/collect-auto-properties.js.map +1 -1
- package/dist/ssr/collector.d.ts +26 -13
- package/dist/ssr/collector.js +84 -32
- package/dist/ssr/collector.js.map +1 -1
- package/dist/ssr/context.js +4 -2
- package/dist/ssr/context.js.map +1 -1
- package/dist/ssr/format-global-rules.js +1 -1
- package/dist/ssr/format-keyframes.js +1 -2
- package/dist/ssr/format-keyframes.js.map +1 -1
- package/dist/ssr/format-property.js +1 -2
- package/dist/ssr/format-property.js.map +1 -1
- package/dist/ssr/format-rules.js +8 -5
- package/dist/ssr/format-rules.js.map +1 -1
- package/dist/ssr/hydrate.d.ts +20 -13
- package/dist/ssr/hydrate.js +25 -30
- package/dist/ssr/hydrate.js.map +1 -1
- package/dist/ssr/index.d.ts +3 -4
- package/dist/ssr/index.js +5 -7
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +6 -5
- package/dist/ssr/next.js +14 -10
- package/dist/ssr/next.js.map +1 -1
- package/dist/ssr/ssr-collector-ref.js +20 -3
- package/dist/ssr/ssr-collector-ref.js.map +1 -1
- package/dist/states/index.js +3 -2
- package/dist/states/index.js.map +1 -1
- package/dist/static/index.js +1 -2
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/static/tastyStatic.js +1 -2
- package/dist/static/tastyStatic.js.map +1 -1
- package/dist/static/types.js +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/border.js +30 -24
- package/dist/styles/border.js.map +1 -1
- package/dist/styles/color.d.ts +1 -1
- package/dist/styles/color.js +2 -3
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/const.js +17 -0
- package/dist/styles/const.js.map +1 -0
- package/dist/styles/createStyle.js +4 -5
- package/dist/styles/createStyle.js.map +1 -1
- package/dist/styles/dimension.js +15 -3
- package/dist/styles/dimension.js.map +1 -1
- package/dist/styles/directional.js +133 -0
- package/dist/styles/directional.js.map +1 -0
- package/dist/styles/display.d.ts +3 -10
- package/dist/styles/display.js +45 -39
- package/dist/styles/display.js.map +1 -1
- package/dist/styles/fade.d.ts +1 -1
- package/dist/styles/fade.js +9 -5
- package/dist/styles/fade.js.map +1 -1
- package/dist/styles/fill.d.ts +2 -2
- package/dist/styles/fill.js +3 -4
- package/dist/styles/fill.js.map +1 -1
- package/dist/styles/flow.js +1 -1
- package/dist/styles/gap.d.ts +1 -1
- package/dist/styles/gap.js +4 -3
- package/dist/styles/gap.js.map +1 -1
- package/dist/styles/height.d.ts +1 -1
- package/dist/styles/height.js +1 -2
- package/dist/styles/height.js.map +1 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +3 -4
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/inset.d.ts +1 -29
- package/dist/styles/inset.js +19 -135
- package/dist/styles/inset.js.map +1 -1
- package/dist/styles/list.d.ts +5 -5
- package/dist/styles/list.js +4 -2
- package/dist/styles/list.js.map +1 -1
- package/dist/styles/margin.d.ts +1 -1
- package/dist/styles/margin.js +17 -89
- package/dist/styles/margin.js.map +1 -1
- package/dist/styles/outline.d.ts +1 -1
- package/dist/styles/outline.js +6 -16
- package/dist/styles/outline.js.map +1 -1
- package/dist/styles/padding.d.ts +1 -1
- package/dist/styles/padding.js +17 -89
- package/dist/styles/padding.js.map +1 -1
- package/dist/styles/placement.d.ts +37 -0
- package/dist/styles/placement.js +74 -0
- package/dist/styles/placement.js.map +1 -0
- package/dist/styles/predefined.d.ts +4 -4
- package/dist/styles/predefined.js +8 -9
- package/dist/styles/predefined.js.map +1 -1
- package/dist/styles/preset.d.ts +6 -1
- package/dist/styles/preset.js +54 -53
- package/dist/styles/preset.js.map +1 -1
- package/dist/styles/radius.d.ts +1 -3
- package/dist/styles/radius.js +38 -6
- package/dist/styles/radius.js.map +1 -1
- package/dist/styles/scrollMargin.d.ts +24 -0
- package/dist/styles/scrollMargin.js +32 -0
- package/dist/styles/scrollMargin.js.map +1 -0
- package/dist/styles/scrollbar.d.ts +1 -1
- package/dist/styles/scrollbar.js +8 -5
- package/dist/styles/scrollbar.js.map +1 -1
- package/dist/styles/shadow.d.ts +1 -1
- package/dist/styles/shadow.js +4 -3
- package/dist/styles/shadow.js.map +1 -1
- package/dist/styles/shared.js +17 -0
- package/dist/styles/shared.js.map +1 -0
- package/dist/styles/transition.d.ts +1 -1
- package/dist/styles/transition.js +5 -4
- package/dist/styles/transition.js.map +1 -1
- package/dist/styles/types.d.ts +52 -11
- package/dist/styles/width.d.ts +1 -1
- package/dist/styles/width.js +1 -2
- package/dist/styles/width.js.map +1 -1
- package/dist/tasty.d.ts +46 -893
- package/dist/tasty.js +96 -67
- package/dist/tasty.js.map +1 -1
- package/dist/utils/cache-wrapper.js +1 -2
- package/dist/utils/cache-wrapper.js.map +1 -1
- package/dist/utils/case-converter.js +1 -1
- package/dist/utils/color-math.js +1 -1
- package/dist/utils/color-math.js.map +1 -1
- package/dist/utils/color-space.js +1 -2
- package/dist/utils/color-space.js.map +1 -1
- package/dist/utils/colors.js +1 -2
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/deps-equal.js +15 -0
- package/dist/utils/deps-equal.js.map +1 -0
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/dotize.js.map +1 -1
- package/dist/utils/filter-base-props.d.ts +1 -1
- package/dist/utils/filter-base-props.js +1 -1
- package/dist/utils/filter-base-props.js.map +1 -1
- package/dist/utils/get-display-name.js +1 -1
- package/dist/utils/has-keys.js +1 -1
- package/dist/utils/hash.js +14 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/is-dev-env.js.map +1 -1
- package/dist/utils/is-valid-element-type.js +1 -1
- package/dist/utils/merge-styles.js +1 -2
- package/dist/utils/merge-styles.js.map +1 -1
- package/dist/utils/mod-attrs.d.ts +0 -2
- package/dist/utils/mod-attrs.js +1 -2
- package/dist/utils/mod-attrs.js.map +1 -1
- package/dist/utils/process-tokens.d.ts +1 -5
- package/dist/utils/process-tokens.js +3 -11
- package/dist/utils/process-tokens.js.map +1 -1
- package/dist/utils/resolve-recipes.js +1 -2
- package/dist/utils/resolve-recipes.js.map +1 -1
- package/dist/utils/selector-transform.js +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/styles.d.ts +1 -3
- package/dist/utils/styles.js +2 -5
- package/dist/utils/styles.js.map +1 -1
- package/dist/utils/typography.d.ts +21 -10
- package/dist/utils/typography.js +10 -2
- package/dist/utils/typography.js.map +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/zero/babel.d.ts +27 -101
- package/dist/zero/babel.js +164 -48
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/css-writer.js +1 -2
- package/dist/zero/css-writer.js.map +1 -1
- package/dist/zero/extractor.js +54 -3
- package/dist/zero/extractor.js.map +1 -1
- package/dist/zero/index.js +1 -2
- package/dist/zero/next.d.ts +12 -0
- package/dist/zero/next.js +5 -4
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/adoption.md +5 -3
- package/docs/comparison.md +24 -25
- package/docs/configuration.md +130 -1
- package/docs/design-system.md +47 -12
- package/docs/dsl.md +115 -9
- package/docs/getting-started.md +10 -10
- package/docs/injector.md +41 -25
- package/docs/methodology.md +119 -6
- package/docs/react-api.md +557 -0
- package/docs/ssr.md +141 -81
- package/docs/styles.md +45 -23
- package/docs/tasty-static.md +103 -2
- package/package.json +20 -9
- package/dist/ssr/context.d.ts +0 -8
- package/dist/styles/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/docs/runtime.md +0 -317
package/docs/comparison.md
CHANGED
|
@@ -29,14 +29,14 @@ That is why syntax-level comparisons are often shallow. The more meaningful comp
|
|
|
29
29
|
|
|
30
30
|
## High-level positioning
|
|
31
31
|
|
|
32
|
-
| System | Best described as | Main authoring model | Conflict model | Best fit |
|
|
33
|
-
|
|
34
|
-
| **Tasty** | Design-system styling engine | Custom DSL with tokens, state maps, recipes, style props, sub-elements, custom units | **Mutually exclusive selector resolution** for stateful styles | Teams building shared component APIs or a house styling language |
|
|
35
|
-
| **Tailwind CSS** | Utility-first styling framework | Utility classes in markup | Utility composition, variants, and framework-controlled ordering | Product teams optimizing for speed and direct authoring |
|
|
36
|
-
| **Panda CSS** | Typed styling engine with atomic output | Typed style objects, recipes, generated primitives, style props | Atomic CSS with static analysis | Teams wanting a DS-friendly engine with typed primitives |
|
|
37
|
-
| **vanilla-extract** | Zero-runtime TS-native stylesheet system | `.css.ts` files, theme contracts, style composition | Standard CSS semantics | Teams wanting static CSS and low-level control |
|
|
38
|
-
| **StyleX** | Compiler-based atomic styling system | JS authoring with compiler-generated atomic CSS | Compiler-controlled atomic composition | Large app teams wanting optimized, predictable atomic styling |
|
|
39
|
-
| **Stitches** (deprecated) **/ Emotion** | Component-first CSS-in-JS | Styled components, `css()` APIs, object/string styles | Composition within CSS-in-JS rules | Teams optimizing for component DX and flexible styling |
|
|
32
|
+
| System | Best described as | Main authoring model | Conflict model | RSC / zero-JS SSG | Best fit |
|
|
33
|
+
|---|---|---|---|---|---|
|
|
34
|
+
| **Tasty** | Design-system styling engine | Custom DSL with tokens, state maps, recipes, style props, sub-elements, custom units | **Mutually exclusive selector resolution** for stateful styles | Yes — hook-free, server components by default | Teams building shared component APIs or a house styling language |
|
|
35
|
+
| **Tailwind CSS** | Utility-first styling framework | Utility classes in markup | Utility composition, variants, and framework-controlled ordering | Yes — no JS runtime | Product teams optimizing for speed and direct authoring |
|
|
36
|
+
| **Panda CSS** | Typed styling engine with atomic output | Typed style objects, recipes, generated primitives, style props | Atomic CSS with static analysis | Yes — build-time extraction | Teams wanting a DS-friendly engine with typed primitives |
|
|
37
|
+
| **vanilla-extract** | Zero-runtime TS-native stylesheet system | `.css.ts` files, theme contracts, style composition | Standard CSS semantics | Yes — build-time extraction | Teams wanting static CSS and low-level control |
|
|
38
|
+
| **StyleX** | Compiler-based atomic styling system | JS authoring with compiler-generated atomic CSS | Compiler-controlled atomic composition | Yes — compiler-extracted | Large app teams wanting optimized, predictable atomic styling |
|
|
39
|
+
| **Stitches** (deprecated) **/ Emotion** | Component-first CSS-in-JS | Styled components, `css()` APIs, object/string styles | Composition within CSS-in-JS rules | No — requires `'use client'` | Teams optimizing for component DX and flexible styling |
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
@@ -92,7 +92,7 @@ That makes Tasty less of a "better way to write CSS objects" and more of a **sta
|
|
|
92
92
|
Beyond state resolution, Tasty also provides several structural capabilities that reinforce the design-system layer:
|
|
93
93
|
|
|
94
94
|
- **CSS properties as typed React props** — `styleProps` lets a component expose selected style properties as normal props (`<Button placeSelf="end">`), including state maps for responsive values. This keeps layout and composition controls inside a governed component API instead of pushing teams back to ad hoc styling escapes.
|
|
95
|
-
- **Sub-element styling** — Compound components declare inner parts via capitalized keys in `styles` and `data-element` attributes. States, tokens, and recipes apply across the entire element tree from a single definition. See [
|
|
95
|
+
- **Sub-element styling** — Compound components declare inner parts via capitalized keys in `styles` and `data-element` attributes. States, tokens, and recipes apply across the entire element tree from a single definition. See [React API — Sub-element Styling](react-api.md#sub-element-styling).
|
|
96
96
|
- **Auto-inferred `@property`** — When a custom property is assigned a concrete value, Tasty infers the CSS `@property` syntax and registers it automatically, enabling smooth transitions on custom properties without manual declarations.
|
|
97
97
|
- **AI-friendly style definitions** — Style definitions are declarative, self-contained, and structurally consistent. AI tools can read, refactor, and generate Tasty styles as confidently as a human — no hidden cascade logic or implicit ordering to second-guess.
|
|
98
98
|
- **Companion ecosystem** — An [ESLint plugin](https://github.com/tenphi/eslint-plugin-tasty) with 27 lint rules, a [VS Code extension](https://github.com/tenphi/tasty-vscode-extension) for syntax highlighting, and [Glaze](https://github.com/tenphi/glaze) for OKHSL color theme generation with automatic WCAG contrast solving.
|
|
@@ -235,13 +235,12 @@ Tasty is more opinionated.
|
|
|
235
235
|
|
|
236
236
|
It behaves less like "TypeScript that outputs CSS" and more like a **state-aware style compiler**. It is designed to encode higher-level styling semantics rather than only expose CSS primitives in typed form.
|
|
237
237
|
|
|
238
|
-
This also makes Tasty's
|
|
238
|
+
This also makes Tasty's rendering model notable:
|
|
239
239
|
|
|
240
|
-
-
|
|
241
|
-
- `tastyStatic()` with the Babel plugin produces static class name strings with
|
|
242
|
-
- In static mode, the output is plain CSS + class names, so it can be used with any JavaScript framework — not only React
|
|
240
|
+
- `tasty()` components are hook-free and work as React Server Components. In server-only contexts (Next.js RSC, Astro without islands), they produce static HTML + CSS with zero client JavaScript — the full feature set is available without sacrificing server rendering
|
|
241
|
+
- `tastyStatic()` with the Babel plugin produces static class name strings via build-time extraction, with no React dependency at runtime — the output works with any JavaScript framework
|
|
243
242
|
|
|
244
|
-
Runtime features like `styleProps`, sub-element components, and dynamic variants are
|
|
243
|
+
Runtime features like `styleProps`, sub-element components, and dynamic variants are available in the `tasty()` path. The `tastyStatic()` path is framework-agnostic but limited to the DSL, tokens, and state logic.
|
|
245
244
|
|
|
246
245
|
So the tradeoff is roughly:
|
|
247
246
|
|
|
@@ -303,6 +302,8 @@ So while Stitches and Emotion are strong tools for building components, Tasty is
|
|
|
303
302
|
|
|
304
303
|
That makes it narrower in audience, but deeper in architectural ambition.
|
|
305
304
|
|
|
305
|
+
There is also a fundamental architectural difference: Emotion and styled-components rely on React context and hooks internally, which means they require `'use client'` in modern React and cannot run as React Server Components. Tasty's style functions and `tasty()` components are hook-free, so they work as server components by default and produce zero client JavaScript in server-only contexts. This is not a minor compatibility detail — it means Tasty-based components stay as server components until *your* code needs interactivity, while Emotion and styled-components force the client boundary at the styling layer.
|
|
306
|
+
|
|
306
307
|
For teams evaluating runtime styling at scale, Tasty also documents its runtime benchmarks and caching model in the main [README](../README.md#performance). That matters, but it is still secondary to the core question of whether you want Tasty's deterministic selector model.
|
|
307
308
|
|
|
308
309
|
---
|
|
@@ -311,20 +312,18 @@ For teams evaluating runtime styling at scale, Tasty also documents its runtime
|
|
|
311
312
|
|
|
312
313
|
Tasty is not limited to one execution model.
|
|
313
314
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
That distinction matters.
|
|
315
|
+
The term "runtime" in `tasty()` refers to *when* style computation happens — during React rendering — not to where that rendering occurs. In server-only contexts (Next.js RSC without `'use client'`, Astro without `client:*` directives, SSG), `tasty()` components render on the server, produce static HTML + CSS, and ship **zero client JavaScript**. The full feature set — `styleProps`, sub-elements, variants, state maps — is available. The result is the same as what `tastyStatic()` produces, but without giving up any runtime capabilities.
|
|
317
316
|
|
|
318
|
-
|
|
317
|
+
Client JavaScript only enters the picture when a component needs React interactivity (state, effects, event handlers) — and that is the consuming component's decision, never Tasty's. Tasty never forces the `'use client'` boundary.
|
|
319
318
|
|
|
320
|
-
|
|
319
|
+
`tastyStatic()` with the Babel plugin is for a different scenario: when you want build-time CSS extraction **without React at runtime**. The output is framework-agnostic — any JavaScript framework can consume the resulting class names and CSS. This makes Tasty usable as the compiler layer underneath a design-system implementation, even outside the React ecosystem.
|
|
321
320
|
|
|
322
|
-
The tradeoff is that some capabilities — `styleProps`, sub-element components (`<Card.Title>`), dynamic variants — are tied to the
|
|
321
|
+
The tradeoff is that some capabilities — `styleProps`, sub-element components (`<Card.Title>`), dynamic variants — are tied to the `tasty()` path. The `tastyStatic()` path is best understood as extraction and compilation of the DSL, tokens, and state logic without a React dependency.
|
|
323
322
|
|
|
324
323
|
This flexibility is one of Tasty's more unusual strengths:
|
|
325
324
|
|
|
326
|
-
-
|
|
327
|
-
-
|
|
325
|
+
- `tasty()` as the default for all React setups — zero client JS in server-only contexts, full feature set, SSR integration available when client hydration is needed
|
|
326
|
+
- `tastyStatic()` as a static compiler whose output works with any framework, including non-React ones
|
|
328
327
|
|
|
329
328
|
---
|
|
330
329
|
|
|
@@ -337,8 +336,8 @@ These are optimized for styling product code directly.
|
|
|
337
336
|
|
|
338
337
|
Examples:
|
|
339
338
|
- Tailwind CSS
|
|
340
|
-
- Emotion
|
|
341
|
-
- Stitches (deprecated)
|
|
339
|
+
- Emotion (requires `'use client'` — not RSC-compatible)
|
|
340
|
+
- Stitches (deprecated, requires `'use client'`)
|
|
342
341
|
|
|
343
342
|
### Typed styling engines
|
|
344
343
|
These are optimized for generating CSS with stronger structure and tooling.
|
|
@@ -412,7 +411,7 @@ Tasty is most compelling when the problem is not just "how do we write styles,"
|
|
|
412
411
|
|
|
413
412
|
- [README](../README.md) — overview, quick start, and feature highlights
|
|
414
413
|
- [Style DSL](dsl.md) — state maps, tokens, units, extending semantics, keyframes, @property
|
|
415
|
-
- [
|
|
414
|
+
- [React API](react-api.md) — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
416
415
|
- [Style Properties](styles.md) — complete reference for all enhanced style properties
|
|
417
416
|
- [Configuration](configuration.md) — tokens, recipes, custom units, style handlers, and TypeScript extensions
|
|
418
417
|
- [Zero Runtime (tastyStatic)](tasty-static.md) — build-time static styling with Babel plugin
|
package/docs/configuration.md
CHANGED
|
@@ -54,8 +54,12 @@ These docs use `data-schema="dark"` in examples. If your app already standardize
|
|
|
54
54
|
| `replaceTokens` | `Record<string, string \| number>` | - | Parse-time token substitution (inline replacement) |
|
|
55
55
|
| `keyframes` | `Record<string, KeyframesSteps>` | - | Global keyframes for animations |
|
|
56
56
|
| `properties` | `Record<string, PropertyDefinition>` | - | Global CSS @property definitions |
|
|
57
|
+
| `fontFace` | `Record<string, FontFaceInput>` | - | Global @font-face definitions |
|
|
58
|
+
| `counterStyle` | `Record<string, CounterStyleDescriptors>` | - | Global @counter-style definitions |
|
|
57
59
|
| `autoPropertyTypes` | `boolean` | `true` | Auto-infer and register `@property` types from values |
|
|
58
60
|
| `recipes` | `Record<string, RecipeStyles>` | - | Predefined style recipes (named style bundles) |
|
|
61
|
+
| `presets` | `Record<string, TypographyPreset>` | - | Typography presets — shorthand for `generateTypographyTokens()` |
|
|
62
|
+
| `globalStyles` | `Record<string, Styles>` | - | Global Tasty styles keyed by CSS selector |
|
|
59
63
|
| `colorSpace` | `'rgb' \| 'hsl' \| 'oklch'` | `'oklch'` | Color space for decomposed color token companion variables |
|
|
60
64
|
|
|
61
65
|
---
|
|
@@ -133,6 +137,65 @@ See [Replace Tokens](dsl.md#replace-tokens) in the Style DSL reference.
|
|
|
133
137
|
|
|
134
138
|
---
|
|
135
139
|
|
|
140
|
+
## Font Face
|
|
141
|
+
|
|
142
|
+
Register custom fonts globally so every component can reference them by family name. Values are descriptor objects or arrays (for multiple weights/styles). Rules are injected eagerly when styles are first generated.
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
configure({
|
|
146
|
+
fontFace: {
|
|
147
|
+
'Brand Sans': [
|
|
148
|
+
{
|
|
149
|
+
src: 'url("/fonts/brand-regular.woff2") format("woff2")',
|
|
150
|
+
fontWeight: 400,
|
|
151
|
+
fontDisplay: 'swap',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
src: 'url("/fonts/brand-bold.woff2") format("woff2")',
|
|
155
|
+
fontWeight: 700,
|
|
156
|
+
fontDisplay: 'swap',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
Icons: {
|
|
160
|
+
src: 'url("/fonts/icons.woff2") format("woff2")',
|
|
161
|
+
fontDisplay: 'block',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Now any component can use `fontFamily: '"Brand Sans", sans-serif'` and the browser will already have the `@font-face` rules in the stylesheet.
|
|
168
|
+
|
|
169
|
+
See [Font Face (`@fontFace`)](dsl.md#font-face-fontface) for inline usage inside component styles and the full list of supported descriptors.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Counter Style
|
|
174
|
+
|
|
175
|
+
Define custom list-marker algorithms globally. Rules are injected eagerly when styles are first generated.
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
configure({
|
|
179
|
+
counterStyle: {
|
|
180
|
+
thumbs: {
|
|
181
|
+
system: 'cyclic',
|
|
182
|
+
symbols: '"👍"',
|
|
183
|
+
suffix: '" "',
|
|
184
|
+
},
|
|
185
|
+
'lower-roman-parens': {
|
|
186
|
+
system: 'extends lower-roman',
|
|
187
|
+
suffix: '") "',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Components can then reference `listStyleType: 'thumbs'` directly.
|
|
194
|
+
|
|
195
|
+
See [Counter Style (`@counterStyle`)](dsl.md#counter-style-counterstyle) for inline usage inside component styles and the full list of supported descriptors.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
136
199
|
## Recipes
|
|
137
200
|
|
|
138
201
|
Recipes are predefined, named style bundles. Define them globally via `configure()`:
|
|
@@ -159,6 +222,72 @@ For how to apply, compose, and override recipes in components, see [Recipes](dsl
|
|
|
159
222
|
|
|
160
223
|
---
|
|
161
224
|
|
|
225
|
+
## Typography Presets
|
|
226
|
+
|
|
227
|
+
Typography presets are a shorthand for `generateTypographyTokens()`. Instead of calling the function manually and spreading the result into `tokens`, pass the presets directly:
|
|
228
|
+
|
|
229
|
+
```jsx
|
|
230
|
+
configure({
|
|
231
|
+
presets: {
|
|
232
|
+
h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' },
|
|
233
|
+
t2: { fontSize: '16px', lineHeight: '1.5', fontWeight: '400' },
|
|
234
|
+
tag: {
|
|
235
|
+
fontSize: '10px',
|
|
236
|
+
lineHeight: '1.4',
|
|
237
|
+
letterSpacing: '0.04em',
|
|
238
|
+
fontWeight: '600',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Each preset generates `$name-font-size`, `$name-line-height`, `$name-letter-spacing`, `$name-font-weight`, and optional `$name-bold-font-weight`, `$name-icon-size`, `$name-text-transform`, `$name-font-family`, `$name-font-style` tokens.
|
|
245
|
+
|
|
246
|
+
Preset values support state maps for responsive or theme-aware typography:
|
|
247
|
+
|
|
248
|
+
```jsx
|
|
249
|
+
configure({
|
|
250
|
+
presets: {
|
|
251
|
+
t2: {
|
|
252
|
+
fontSize: '16px',
|
|
253
|
+
lineHeight: '1.5',
|
|
254
|
+
fontWeight: { '': '400', '@dark': '300' },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The generated tokens are merged **under** explicit `tokens` — if both `presets` and `tokens` define `$t2-font-weight`, the `tokens` value wins. Plugins can also provide `presets`; plugin presets are merged first, then config presets, then explicit tokens on top.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Global Styles
|
|
265
|
+
|
|
266
|
+
Apply Tasty styles to any selector via configuration, without needing `useGlobalStyles(selector, ...)` at runtime:
|
|
267
|
+
|
|
268
|
+
```jsx
|
|
269
|
+
configure({
|
|
270
|
+
globalStyles: {
|
|
271
|
+
body: {
|
|
272
|
+
fill: '#surface',
|
|
273
|
+
color: '#text',
|
|
274
|
+
preset: 't2',
|
|
275
|
+
margin: 0,
|
|
276
|
+
fontFamily: 'system-ui, sans-serif',
|
|
277
|
+
},
|
|
278
|
+
html: {
|
|
279
|
+
overflow: 'hidden',
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Each key is a CSS selector, and each value is a Tasty `Styles` object supporting the full style syntax including style properties, tokens, state maps, and selector-based sub-styling (e.g. `$: '> .app'` for elements outside React scope). Global styles are injected alongside `:root` tokens when the first style is rendered.
|
|
286
|
+
|
|
287
|
+
Global styles are automatically emitted in all rendering modes: runtime (client), SSR, and zero-runtime (Babel plugin). Plugins can also provide `globalStyles`; they are merged per selector with config global styles (config wins on conflict).
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
162
291
|
## Auto Property Types
|
|
163
292
|
|
|
164
293
|
CSS cannot transition or animate custom properties unless their type is declared via [`@property`](https://developer.mozilla.org/en-US/docs/Web/CSS/@property). Tasty handles this automatically — when a custom property is assigned a concrete value (e.g. `'$scale': 1`, `'$gap': '10px'`, `'#accent': 'purple'`), the type is inferred and a `@property` rule is registered.
|
|
@@ -262,4 +391,4 @@ declare module '@tenphi/tasty' {
|
|
|
262
391
|
}
|
|
263
392
|
```
|
|
264
393
|
|
|
265
|
-
See [Style DSL](dsl.md) for state maps, tokens, units, and extending semantics, and [
|
|
394
|
+
See [Style DSL](dsl.md) for state maps, tokens, units, and extending semantics, and [React API](react-api.md) for `tasty()`, style functions, and component props.
|
package/docs/design-system.md
CHANGED
|
@@ -84,25 +84,54 @@ configure({
|
|
|
84
84
|
|
|
85
85
|
### Typography presets
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Pass typography presets directly to `configure()` — they are converted to tokens automatically:
|
|
88
88
|
|
|
89
89
|
```tsx
|
|
90
|
-
import { configure
|
|
90
|
+
import { configure } from '@tenphi/tasty';
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
configure({
|
|
93
|
+
presets: {
|
|
94
|
+
h1: { fontSize: '2rem', lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: 700 },
|
|
95
|
+
t2: { fontSize: '0.875rem', lineHeight: '1.5', letterSpacing: 'normal', fontWeight: 400 },
|
|
96
|
+
},
|
|
95
97
|
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Preset values support state maps for responsive or theme-aware typography:
|
|
96
101
|
|
|
102
|
+
```tsx
|
|
97
103
|
configure({
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
presets: {
|
|
105
|
+
t2: {
|
|
106
|
+
fontSize: '0.875rem',
|
|
107
|
+
lineHeight: '1.5',
|
|
108
|
+
fontWeight: { '': 400, '@dark': 300 },
|
|
109
|
+
},
|
|
100
110
|
},
|
|
101
111
|
});
|
|
102
112
|
```
|
|
103
113
|
|
|
104
114
|
Then use `preset: 'h1'` or `preset: 't2'` in any component's styles.
|
|
105
115
|
|
|
116
|
+
> You can also call `generateTypographyTokens()` manually and spread the result into `tokens` for more control — `presets` is just a shorthand.
|
|
117
|
+
|
|
118
|
+
### Registering brand fonts
|
|
119
|
+
|
|
120
|
+
Register your design system's custom fonts via `configure({ fontFace })` so every component can reference them:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
configure({
|
|
124
|
+
fontFace: {
|
|
125
|
+
'Brand Sans': [
|
|
126
|
+
{ src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
|
|
127
|
+
{ src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
See [Font Face](configuration.md#font-face) for the full configuration reference.
|
|
134
|
+
|
|
106
135
|
---
|
|
107
136
|
|
|
108
137
|
## Defining state aliases
|
|
@@ -317,7 +346,7 @@ Usage:
|
|
|
317
346
|
|
|
318
347
|
Sub-elements share the root component's state context by default. A `disabled` modifier on `<Card>` affects `Title`, `Content`, and `Footer` styles automatically — no prop drilling. For the full mental model, see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
|
|
319
348
|
|
|
320
|
-
For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [
|
|
349
|
+
For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [React API — Sub-element Styling](react-api.md#sub-element-styling).
|
|
321
350
|
|
|
322
351
|
---
|
|
323
352
|
|
|
@@ -333,13 +362,19 @@ A design system works best when the rules for customization are explicit. Tasty
|
|
|
333
362
|
<Space flow="row" gap="3x" padding="2x">
|
|
334
363
|
```
|
|
335
364
|
|
|
336
|
-
2. **
|
|
365
|
+
2. **Use modProps** — control component states through typed props instead of `mods`:
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
<Button isLoading size="large">Submit</Button>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
3. **Pass tokens** — inject runtime values through the `tokens` prop for per-instance customization:
|
|
337
372
|
|
|
338
373
|
```tsx
|
|
339
374
|
<ProgressBar tokens={{ '$progress': `${percent}%` }} />
|
|
340
375
|
```
|
|
341
376
|
|
|
342
|
-
|
|
377
|
+
4. **Create styled wrappers** — extend a component's styles with `tasty(Base, { styles })`:
|
|
343
378
|
|
|
344
379
|
```tsx
|
|
345
380
|
const DangerButton = tasty(Button, {
|
|
@@ -381,7 +416,7 @@ ds/
|
|
|
381
416
|
index.ts # Recipe definitions (imported by config.ts)
|
|
382
417
|
tokens/
|
|
383
418
|
colors.ts # Color token definitions
|
|
384
|
-
typography.ts # Typography presets
|
|
419
|
+
typography.ts # Typography presets for configure({ presets })
|
|
385
420
|
spacing.ts # Spacing token definitions
|
|
386
421
|
index.ts # Public API: re-exports components + configure
|
|
387
422
|
```
|
|
@@ -395,7 +430,7 @@ The key principle: `config.ts` imports tokens and recipes, calls `configure()`,
|
|
|
395
430
|
- **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components
|
|
396
431
|
- **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
|
|
397
432
|
- **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
|
|
398
|
-
- **[
|
|
433
|
+
- **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
399
434
|
- **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
|
|
400
435
|
- **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers
|
|
401
436
|
- **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
|
package/docs/dsl.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is the Tasty style language reference — the value syntax, state mappings, tokens, units, extending semantics, and special declarations that apply to both runtime `tasty()` and build-time `tastyStatic()`.
|
|
4
4
|
|
|
5
|
-
For the runtime React API (`tasty()`, hooks, component props), see [
|
|
5
|
+
For the runtime React API (`tasty()`, hooks, component props), see [React API](react-api.md). For all enhanced style properties, see [Style Properties](styles.md). For global configuration, see [Configuration](configuration.md).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -25,7 +25,21 @@ fill: { '': '#white', hovered: '#gray.05', 'theme=danger': '#red' }
|
|
|
25
25
|
| Pseudo-class | `:hover` | `:hover` |
|
|
26
26
|
| Class selector | `.active` | `.active` |
|
|
27
27
|
| Attribute selector | `[aria-expanded="true"]` | `[aria-expanded="true"]` |
|
|
28
|
-
| Combined | `hovered & .active` | `[data-hovered].active` |
|
|
28
|
+
| Combined (AND) | `hovered & .active` | `[data-hovered].active` |
|
|
29
|
+
| Combined (OR) | `hovered \| focused` | `[data-hovered], [data-focused]` |
|
|
30
|
+
| Negated (NOT) | `!disabled` | `:not([data-disabled])` |
|
|
31
|
+
| Exclusive (XOR) | `hovered ^ focused` | `[data-hovered]:not([data-focused]), :not([data-hovered])[data-focused]` |
|
|
32
|
+
|
|
33
|
+
Operator precedence (highest to lowest): `!` (NOT) > `^` (XOR) > `|` (OR) > `&` (AND). Use parentheses to override: `hovered & (pressed ^ focused)`.
|
|
34
|
+
|
|
35
|
+
`^` (XOR) means "exactly one of" — `A ^ B` expands to `(A & !B) | (!A & B)`. This is useful for mutually exclusive states where exactly one should be active:
|
|
36
|
+
|
|
37
|
+
```jsx
|
|
38
|
+
fill: {
|
|
39
|
+
'': '#surface',
|
|
40
|
+
'hovered ^ focused': '#accent', // active when hovered OR focused, but not both
|
|
41
|
+
}
|
|
42
|
+
```
|
|
29
43
|
|
|
30
44
|
### Sub-element
|
|
31
45
|
|
|
@@ -93,6 +107,8 @@ mods={{ hovered: true, theme: 'danger' }}
|
|
|
93
107
|
// → data-hovered="" data-theme="danger"
|
|
94
108
|
```
|
|
95
109
|
|
|
110
|
+
Modifiers can also be exposed as top-level component props via `modProps` — see [Runtime — Mod Props](react-api.md#mod-props).
|
|
111
|
+
|
|
96
112
|
---
|
|
97
113
|
|
|
98
114
|
## Color Tokens & Opacity
|
|
@@ -117,8 +133,6 @@ color: '(#primary, #secondary)', // Fallback syntax
|
|
|
117
133
|
| `cr` | Card border radius | `1cr` | `var(--card-radius)` |
|
|
118
134
|
| `bw` | Border width | `2bw` | `calc(var(--border-width) * 2)` |
|
|
119
135
|
| `ow` | Outline width | `1ow` | `var(--outline-width)` |
|
|
120
|
-
| `fs` | Font size | `1fs` | `var(--font-size)` |
|
|
121
|
-
| `lh` | Line height | `1lh` | `var(--line-height)` |
|
|
122
136
|
| `sf` | Stable fraction | `1sf` | `minmax(0, 1fr)` |
|
|
123
137
|
|
|
124
138
|
You can register additional custom units via [`configure()`](configuration.md#options).
|
|
@@ -430,7 +444,7 @@ const FadeIn = tasty({
|
|
|
430
444
|
|
|
431
445
|
### `@parent(...)` — Parent Element States
|
|
432
446
|
|
|
433
|
-
Style based on ancestor element attributes. Uses `:is([selector] *)` / `:not([selector] *)` for symmetric, composable parent checks. Boolean logic (`&`, `|`,
|
|
447
|
+
Style based on ancestor element attributes. Uses `:is([selector] *)` / `:not([selector] *)` for symmetric, composable parent checks. Boolean logic (`&`, `|`, `!`, `^`) is supported inside `@parent()`.
|
|
434
448
|
|
|
435
449
|
```jsx
|
|
436
450
|
const Highlight = tasty({
|
|
@@ -508,12 +522,13 @@ const Card = tasty({
|
|
|
508
522
|
| `!:has(> Icon)` | `:not(:has(> [data-element="Icon"]))` | Negation (use `!`) |
|
|
509
523
|
| `!:is(Panel)` | `:not([data-element="Panel"])` | Negation (use `!:is`) |
|
|
510
524
|
|
|
511
|
-
Combine with other states using boolean logic:
|
|
525
|
+
Combine with other states using boolean logic (`&`, `|`, `!`, `^`):
|
|
512
526
|
|
|
513
527
|
```jsx
|
|
514
|
-
':has(> Icon) & hovered' // structural + data attribute
|
|
515
|
-
'@parent(hovered) & :has(> Icon)' // parent check + structural
|
|
528
|
+
':has(> Icon) & hovered' // AND: structural + data attribute
|
|
529
|
+
'@parent(hovered) & :has(> Icon)' // AND: parent check + structural
|
|
516
530
|
':has(> Icon) | :has(> Button)' // OR: either sub-element present
|
|
531
|
+
':has(> Icon) ^ :has(> Button)' // XOR: exactly one present
|
|
517
532
|
```
|
|
518
533
|
|
|
519
534
|
> **Nesting limit:** The state key parser supports up to 2 levels of nested parentheses inside `:is()`, `:has()`, `:not()`, and `:where()` — e.g. `:has(Input:not(:disabled))` works, but 3+ levels like `:has(:is(:not(:hover)))` will not be tokenized correctly. This covers virtually all practical use cases.
|
|
@@ -567,6 +582,97 @@ Use explicit `@properties` when you need non-default settings like `inherits: fa
|
|
|
567
582
|
|
|
568
583
|
---
|
|
569
584
|
|
|
585
|
+
## Font Face (`@fontFace`)
|
|
586
|
+
|
|
587
|
+
Register custom fonts directly inside a `styles` object. Keys are font-family names, values are descriptor objects (or arrays of them for multiple weights/styles).
|
|
588
|
+
|
|
589
|
+
```ts
|
|
590
|
+
const Heading = tasty({
|
|
591
|
+
styles: {
|
|
592
|
+
'@fontFace': {
|
|
593
|
+
'Brand Sans': {
|
|
594
|
+
src: 'url("/fonts/brand-sans.woff2") format("woff2")',
|
|
595
|
+
fontDisplay: 'swap',
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
fontFamily: '"Brand Sans", sans-serif',
|
|
599
|
+
},
|
|
600
|
+
});
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Multiple weights
|
|
604
|
+
|
|
605
|
+
Supply an array to register several variants of the same family:
|
|
606
|
+
|
|
607
|
+
```ts
|
|
608
|
+
'@fontFace': {
|
|
609
|
+
'Brand Sans': [
|
|
610
|
+
{ src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
|
|
611
|
+
{ src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
|
|
612
|
+
],
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Supported descriptors
|
|
617
|
+
|
|
618
|
+
| Descriptor | CSS property | Type |
|
|
619
|
+
|---|---|---|
|
|
620
|
+
| `src` (required) | `src` | `string` |
|
|
621
|
+
| `fontWeight` | `font-weight` | `string \| number` |
|
|
622
|
+
| `fontStyle` | `font-style` | `string` |
|
|
623
|
+
| `fontStretch` | `font-stretch` | `string` |
|
|
624
|
+
| `fontDisplay` | `font-display` | `'auto' \| 'block' \| 'swap' \| 'fallback' \| 'optional'` |
|
|
625
|
+
| `unicodeRange` | `unicode-range` | `string` |
|
|
626
|
+
| `ascentOverride` | `ascent-override` | `string` |
|
|
627
|
+
| `descentOverride` | `descent-override` | `string` |
|
|
628
|
+
| `lineGapOverride` | `line-gap-override` | `string` |
|
|
629
|
+
| `sizeAdjust` | `size-adjust` | `string` |
|
|
630
|
+
| `fontFeatureSettings` | `font-feature-settings` | `string` |
|
|
631
|
+
| `fontVariationSettings` | `font-variation-settings` | `string` |
|
|
632
|
+
|
|
633
|
+
> Font-face rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@font-face`.
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
## Counter Style (`@counterStyle`)
|
|
638
|
+
|
|
639
|
+
Define custom list markers via the CSS `@counter-style` at-rule. Keys are counter-style names, values are descriptor objects.
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
const EmojiList = tasty({
|
|
643
|
+
tag: 'ol',
|
|
644
|
+
styles: {
|
|
645
|
+
'@counterStyle': {
|
|
646
|
+
thumbs: {
|
|
647
|
+
system: 'cyclic',
|
|
648
|
+
symbols: '"👍"',
|
|
649
|
+
suffix: '" "',
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
listStyleType: 'thumbs',
|
|
653
|
+
},
|
|
654
|
+
});
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Supported descriptors
|
|
658
|
+
|
|
659
|
+
| Descriptor | CSS property | Type |
|
|
660
|
+
|---|---|---|
|
|
661
|
+
| `system` (required) | `system` | `'cyclic' \| 'numeric' \| 'alphabetic' \| 'symbolic' \| 'additive' \| 'fixed' \| string` |
|
|
662
|
+
| `symbols` | `symbols` | `string` |
|
|
663
|
+
| `additiveSymbols` | `additive-symbols` | `string` |
|
|
664
|
+
| `prefix` | `prefix` | `string` |
|
|
665
|
+
| `suffix` | `suffix` | `string` |
|
|
666
|
+
| `negative` | `negative` | `string` |
|
|
667
|
+
| `range` | `range` | `string` |
|
|
668
|
+
| `pad` | `pad` | `string` |
|
|
669
|
+
| `fallback` | `fallback` | `string` |
|
|
670
|
+
| `speakAs` | `speak-as` | `string` |
|
|
671
|
+
|
|
672
|
+
> Counter-style rules are permanent — they are injected once and never cleaned up, matching how browsers handle `@counter-style`.
|
|
673
|
+
|
|
674
|
+
---
|
|
675
|
+
|
|
570
676
|
## Style Properties
|
|
571
677
|
|
|
572
678
|
For a complete reference of all enhanced style properties — syntax, values, modifiers, and recommendations — see **[Style Properties Reference](styles.md)**.
|
|
@@ -575,7 +681,7 @@ For a complete reference of all enhanced style properties — syntax, values, mo
|
|
|
575
681
|
|
|
576
682
|
## Learn more
|
|
577
683
|
|
|
578
|
-
- **[
|
|
684
|
+
- **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
579
685
|
- **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
|
|
580
686
|
- **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
|
|
581
687
|
- **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
|
package/docs/getting-started.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Getting Started
|
|
2
2
|
|
|
3
|
-
This guide walks you from zero to a working Tasty component, then through the optional shared configuration and tooling layers. It is the right starting point when you already want to try Tasty in code. If you are still deciding whether Tasty fits your team, start with [Comparison](comparison.md) and [Adoption Guide](adoption.md) first. For a feature overview, see the [README](../README.md). For the full style language reference, see the [Style DSL](dsl.md). For the React API, see the [
|
|
3
|
+
This guide walks you from zero to a working Tasty component, then through the optional shared configuration and tooling layers. It is the right starting point when you already want to try Tasty in code. If you are still deciding whether Tasty fits your team, start with [Comparison](comparison.md) and [Adoption Guide](adoption.md) first. For a feature overview, see the [README](../README.md). For the full style language reference, see the [Style DSL](dsl.md). For the React API, see the [React API](react-api.md). For the rest of the docs by role or task, see the [Docs Hub](README.md).
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -179,19 +179,19 @@ export default [
|
|
|
179
179
|
|
|
180
180
|
## Choosing a rendering mode
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
`tasty()` is the default for all React apps. All `tasty()` components and style functions are hook-free and work as React Server Components without `'use client'`. In server-only contexts, they produce zero client JavaScript with the full feature set.
|
|
183
183
|
|
|
184
184
|
| Approach | Entry point | Best for | Trade-off |
|
|
185
185
|
|------|-------------|----------|-----------|
|
|
186
|
-
| **Runtime** | `tasty()` from `@tenphi/tasty` |
|
|
187
|
-
| **
|
|
186
|
+
| **Runtime (default)** | `tasty()` from `@tenphi/tasty` | All React apps — server-rendered by default, zero client JS until you need interactivity | Full feature set (styleProps, sub-elements, variants); CSS computed during rendering |
|
|
187
|
+
| **Runtime + SSR integration** | Add `@tenphi/tasty/ssr/*` | Apps with client-side hydration (Next.js client components, Astro islands) | Adds CSS batching, deduplication, FOUC prevention, and client cache hydration |
|
|
188
|
+
| **Zero-runtime** | `tastyStatic()` from `@tenphi/tasty/static` | Non-React frameworks or build-time extraction without React | Requires Babel plugin; no `styleProps` or runtime-only APIs |
|
|
188
189
|
|
|
189
|
-
Both share the same DSL, tokens, units, and state mappings.
|
|
190
|
+
Both `tasty()` and `tastyStatic()` share the same DSL, tokens, units, and state mappings.
|
|
190
191
|
|
|
191
|
-
- Runtime is the default and requires no extra setup beyond `@tenphi/tasty`.
|
|
192
|
-
-
|
|
193
|
-
- Zero-runtime requires the Babel plugin and additional peer dependencies. See [Zero Runtime (tastyStatic)](tasty-static.md).
|
|
194
|
-
- SSR works with existing `tasty()` components — wrap your app with a registry, middleware, or collector. See [Server-Side Rendering](ssr.md).
|
|
192
|
+
- **Runtime** is the default and requires no extra setup beyond `@tenphi/tasty`. In server-only contexts (Next.js RSC, Astro without `client:*` directives, SSG), `tasty()` produces static HTML + CSS with zero client JavaScript — the same end result as `tastyStatic()` but with the full feature set. For example, `tasty()` + `tastyIntegration()` in Astro without islands gives you the complete API with zero JS shipped.
|
|
193
|
+
- **SSR integration** is only needed when your app also has client-side rendering. Add `@tenphi/tasty/ssr/next`, `@tenphi/tasty/ssr/astro`, or the core SSR API to get CSS deduplication and cache hydration. See [Server-Side Rendering](ssr.md).
|
|
194
|
+
- **Zero-runtime** requires the Babel plugin and additional peer dependencies. Use it when you need build-time extraction without a React runtime. See [Zero Runtime (tastyStatic)](tasty-static.md).
|
|
195
195
|
|
|
196
196
|
---
|
|
197
197
|
|
|
@@ -200,7 +200,7 @@ Both share the same DSL, tokens, units, and state mappings.
|
|
|
200
200
|
- **[Docs Hub](README.md)** — Pick the next guide by role, styling approach, or task
|
|
201
201
|
- **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components: sub-elements, styleProps, tokens, extension
|
|
202
202
|
- **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
|
|
203
|
-
- **[
|
|
203
|
+
- **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
204
204
|
- **[Building a Design System](design-system.md)** — Practical guide to building a DS layer with Tasty: tokens, recipes, primitives, compound components
|
|
205
205
|
- **[Adoption Guide](adoption.md)** — Roll out Tasty inside an existing design system or platform team
|
|
206
206
|
- **[Comparison](comparison.md)** — Evaluate Tasty against other styling systems
|