@tenphi/tasty 0.0.0-snapshot.27699f6 → 0.0.0-snapshot.27b6708
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 +171 -107
- package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
- package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{collector-QwpPODsy.js → collector-DTahQUiV.js} +97 -23
- package/dist/collector-DTahQUiV.js.map +1 -0
- package/dist/{collector-LuU1vZ68.d.ts → collector-DUaHCcTS.d.ts} +54 -7
- package/dist/{config-rrijM-U2.js → config-B5kHzuNz.js} +5144 -3012
- package/dist/config-B5kHzuNz.js.map +1 -0
- package/dist/{config-vuCRkBWX.d.ts → config-YsxGv4tq.d.ts} +412 -33
- package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
- package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-BvTG0J_M.js → core-Dr4u1NVD.js} +162 -188
- package/dist/core-Dr4u1NVD.js.map +1 -0
- package/dist/{css-writer-C7HJGEmN.js → css-writer-B-J87ncv.js} +78 -17
- package/dist/css-writer-B-J87ncv.js.map +1 -0
- package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
- package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
- package/dist/{format-rules-BvokPr1L.js → format-rules-DKOA-6qu.js} +4 -17
- package/dist/format-rules-DKOA-6qu.js.map +1 -0
- package/dist/{hydrate-Dsv7Pwon.js → hydrate-OeMX99We.js} +3 -11
- package/dist/{hydrate-Dsv7Pwon.js.map → hydrate-OeMX99We.js.map} +1 -1
- package/dist/{index-dUtwpOux.d.ts → index-Cd45t5NM.d.ts} +319 -64
- package/dist/{index-ZRxZWzlj.d.ts → index-PqN-DIpn.d.ts} +498 -189
- package/dist/index.d.ts +5 -5
- package/dist/index.js +253 -63
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-DDqRjwa9.js → keyframes-CV8azJf3.js} +97 -191
- package/dist/keyframes-CV8azJf3.js.map +1 -0
- package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js → merge-styles-oklji0KB.js} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js.map → merge-styles-oklji0KB.js.map} +1 -1
- package/dist/{resolve-recipes-BnTZz2I_.js → resolve-recipes-DTG81rzl.js} +3 -3
- package/dist/{resolve-recipes-BnTZz2I_.js.map → resolve-recipes-DTG81rzl.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.d.ts +16 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +8 -6
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +2 -17
- package/dist/ssr/astro.js +29 -21
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +6 -7
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +39 -27
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +12 -6
- package/docs/adoption.md +53 -28
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +59 -30
- package/docs/configuration.md +498 -69
- package/docs/debug.md +7 -7
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +510 -178
- package/docs/getting-started.md +55 -34
- package/docs/injector.md +58 -5
- package/docs/methodology.md +68 -36
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +93 -25
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +162 -38
- package/docs/ssr.md +45 -35
- package/docs/styles.md +65 -16
- package/docs/tasty-static.md +25 -8
- package/package.json +43 -21
- package/tasty.config.ts +6 -0
- package/dist/collector-QwpPODsy.js.map +0 -1
- package/dist/config-rrijM-U2.js.map +0 -1
- package/dist/core-BvTG0J_M.js.map +0 -1
- package/dist/css-writer-C7HJGEmN.js.map +0 -1
- package/dist/format-rules-BvokPr1L.js.map +0 -1
- package/dist/keyframes-DDqRjwa9.js.map +0 -1
package/docs/adoption.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Adoption Guide
|
|
2
2
|
|
|
3
|
-
Tasty is
|
|
3
|
+
Tasty is most useful where reusable component styling has become a state-resolution problem: hover intersects with disabled, variants intersect with themes, and every extension makes selector behavior harder to predict.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It normally sits underneath a design system’s existing components. You can preserve their public React APIs while moving their style logic into state maps that produce one declared winner. Adoption should start with a small, state-heavy component—not an all-at-once rewrite.
|
|
6
|
+
|
|
7
|
+
This guide is for design-system maintainers and platform engineers evaluating Tasty or introducing it into an existing codebase. Use it for rollout strategy and adoption sequencing; use the [Comparison guide](comparison.md) when the open question is whether Tasty is the right tool.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -18,12 +20,14 @@ Product code
|
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
**What Tasty owns:**
|
|
23
|
+
|
|
21
24
|
- The DSL and value parser (tokens, custom units, auto-calc, color opacity)
|
|
22
25
|
- State compilation (mutually exclusive selectors from state maps)
|
|
23
26
|
- Style injection and deduplication (runtime or build-time)
|
|
24
27
|
- The `tasty()` component factory and hooks API
|
|
25
28
|
|
|
26
29
|
**What the DS team owns:**
|
|
30
|
+
|
|
27
31
|
- Token names and values (colors, spacing, typography)
|
|
28
32
|
- Custom units and their semantics
|
|
29
33
|
- State aliases (`@mobile`, `@dark`, `@compact`)
|
|
@@ -39,12 +43,14 @@ Two teams using Tasty can end up with very different authoring models. That is b
|
|
|
39
43
|
## Who should adopt Tasty
|
|
40
44
|
|
|
41
45
|
**Strong fit:**
|
|
42
|
-
|
|
46
|
+
|
|
47
|
+
- A design-system or platform team that owns shared component APIs
|
|
43
48
|
- Components with complex, intersecting states (hover + disabled + theme + breakpoint)
|
|
44
49
|
- Teams that need deterministic style resolution without cascade/specificity bugs
|
|
45
|
-
- Organizations
|
|
50
|
+
- Organizations that want tokens, states, and extension rules to stay consistent across products
|
|
46
51
|
|
|
47
52
|
**Not the right fit:**
|
|
53
|
+
|
|
48
54
|
- Solo developers building a one-off app with minimal UI structure
|
|
49
55
|
- Teams that want a shared utility vocabulary and direct markup authoring (Tailwind is better here)
|
|
50
56
|
- Projects where low ceremony matters more than central governance
|
|
@@ -58,16 +64,16 @@ For a detailed comparison with Tailwind, Panda CSS, vanilla-extract, StyleX, Sti
|
|
|
58
64
|
|
|
59
65
|
Tasty provides the engine. The DS team defines the language that runs on it. Here is what that typically involves:
|
|
60
66
|
|
|
61
|
-
| Layer
|
|
62
|
-
|
|
63
|
-
| **Tokens**
|
|
64
|
-
| **Units**
|
|
65
|
-
| **State aliases**
|
|
66
|
-
| **Recipes**
|
|
67
|
-
| **Typography**
|
|
68
|
-
| **Style props**
|
|
69
|
-
| **Sub-elements**
|
|
70
|
-
| **Override rules** | How product engineers extend or constrain components
|
|
67
|
+
| Layer | What you define | Where |
|
|
68
|
+
| ------------------ | ---------------------------------------------------------- | ------------------------------------------ |
|
|
69
|
+
| **Tokens** | Color names, spacing scale, border widths, radii | `configure({ tokens })` |
|
|
70
|
+
| **Units** | Custom multiplier units (`x`, `r`, `bw`, or your own) | `configure({ units })` |
|
|
71
|
+
| **State aliases** | Responsive breakpoints, theme modes, feature flags | `configure({ states })` |
|
|
72
|
+
| **Recipes** | Reusable style bundles (card, elevated, input-reset) | `configure({ recipes })` |
|
|
73
|
+
| **Typography** | Preset definitions (h1-h6, t1-t4, etc.) | `configure({ presets: { ... } })` |
|
|
74
|
+
| **Style props** | Which CSS properties each component exposes as React props | `styleProps` in each component |
|
|
75
|
+
| **Sub-elements** | Inner parts of compound components (Title, Icon, Content) | `elements` + capitalized keys in `styles` |
|
|
76
|
+
| **Override rules** | How product engineers extend or constrain components | Styled wrappers via `tasty(Base, { ... })` |
|
|
71
77
|
|
|
72
78
|
The same engine can power a minimal design system with a handful of tokens:
|
|
73
79
|
|
|
@@ -85,9 +91,15 @@ Here is how the layers connect end-to-end. The DS team configures the engine, de
|
|
|
85
91
|
```tsx
|
|
86
92
|
// ds/config.ts — DS team defines the language
|
|
87
93
|
configure({
|
|
88
|
-
tokens: {
|
|
94
|
+
tokens: {
|
|
95
|
+
'#primary': 'oklch(55% 0.25 265)',
|
|
96
|
+
'#surface': '#fff',
|
|
97
|
+
'#text': '#111',
|
|
98
|
+
},
|
|
89
99
|
states: { '@mobile': '@media(w < 768px)', '@dark': '@root(schema=dark)' },
|
|
90
|
-
recipes: {
|
|
100
|
+
recipes: {
|
|
101
|
+
card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
|
|
102
|
+
},
|
|
91
103
|
});
|
|
92
104
|
|
|
93
105
|
// ds/components/Card.tsx — DS team builds components on top
|
|
@@ -105,7 +117,7 @@ const Card = tasty({
|
|
|
105
117
|
<Card padding={{ '': '4x', '@mobile': '2x' }}>
|
|
106
118
|
<Card.Title>Monthly Revenue</Card.Title>
|
|
107
119
|
<Card.Body>$1.2M — up 12% from last month</Card.Body>
|
|
108
|
-
</Card
|
|
120
|
+
</Card>;
|
|
109
121
|
```
|
|
110
122
|
|
|
111
123
|
See [Configuration](configuration.md) for the full `configure()` API.
|
|
@@ -116,9 +128,21 @@ See [Configuration](configuration.md) for the full `configure()` API.
|
|
|
116
128
|
|
|
117
129
|
You do not need to adopt everything at once. Tasty is designed to be introduced layer by layer.
|
|
118
130
|
|
|
119
|
-
A practical
|
|
131
|
+
A practical first slice is one component that already suffers from intersecting state and variant logic: a button, input, menu item, disclosure, or interactive card. Keep its public API unchanged, move one or two properties into Tasty state maps, and verify that the declared priority matches the behavior your team expects.
|
|
132
|
+
|
|
133
|
+
This proves the differentiator before you invest in a complete token vocabulary or migrate an entire component library.
|
|
134
|
+
|
|
135
|
+
### Phase 1 -- Pilot one state-heavy component
|
|
136
|
+
|
|
137
|
+
Choose a component with a known hover/disabled, focus/error, or variant/theme interaction. Preserve its external props and visual behavior. The pilot should answer three questions:
|
|
138
|
+
|
|
139
|
+
1. Is the state map easier to review than the existing selectors or conditional class logic?
|
|
140
|
+
2. Does extending the component keep the intended state priority?
|
|
141
|
+
3. Can your current tokens and component API move over without product-code churn?
|
|
142
|
+
|
|
143
|
+
If the answer is yes, establish the shared design-system vocabulary around the successful slice.
|
|
120
144
|
|
|
121
|
-
### Phase
|
|
145
|
+
### Phase 2 -- Tokens and units
|
|
122
146
|
|
|
123
147
|
Start by defining your design tokens and custom units. This is the lowest-risk step: it only configures the parser and does not require rewriting any components.
|
|
124
148
|
|
|
@@ -136,14 +160,14 @@ configure({
|
|
|
136
160
|
// A DS typically redefines them to use CSS custom properties
|
|
137
161
|
// so that the actual scale is controlled via CSS, not JS:
|
|
138
162
|
units: {
|
|
139
|
-
x: 'var(--gap)',
|
|
163
|
+
x: 'var(--gap)', // 2x → calc(var(--gap) * 2)
|
|
140
164
|
r: 'var(--radius)',
|
|
141
165
|
bw: 'var(--border-width)',
|
|
142
166
|
},
|
|
143
167
|
});
|
|
144
168
|
```
|
|
145
169
|
|
|
146
|
-
### Phase
|
|
170
|
+
### Phase 3 -- State aliases and recipes
|
|
147
171
|
|
|
148
172
|
Define the state vocabulary your components will share. This is where you start encoding your team's conventions.
|
|
149
173
|
|
|
@@ -152,7 +176,8 @@ configure({
|
|
|
152
176
|
states: {
|
|
153
177
|
'@mobile': '@media(w < 768px)',
|
|
154
178
|
'@tablet': '@media(w < 1024px)',
|
|
155
|
-
'@dark':
|
|
179
|
+
'@dark':
|
|
180
|
+
'@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
|
|
156
181
|
},
|
|
157
182
|
recipes: {
|
|
158
183
|
card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
|
|
@@ -161,7 +186,7 @@ configure({
|
|
|
161
186
|
});
|
|
162
187
|
```
|
|
163
188
|
|
|
164
|
-
### Phase
|
|
189
|
+
### Phase 4 -- Migrate a few primitives
|
|
165
190
|
|
|
166
191
|
Pick 2-3 widely used primitives (Box, Text, Button) and rewrite them with `tasty()`. Keep the public API identical so product code does not need to change.
|
|
167
192
|
|
|
@@ -179,7 +204,7 @@ const Box = tasty({
|
|
|
179
204
|
|
|
180
205
|
At this point you can validate the DSL, token workflow, and component authoring experience before expanding the rollout.
|
|
181
206
|
|
|
182
|
-
### Phase
|
|
207
|
+
### Phase 5 -- Expand state resolution
|
|
183
208
|
|
|
184
209
|
Move the components with the most painful intersecting states (buttons with hover + disabled + theme variants, inputs with focus + error + readonly) to Tasty's state map syntax. This is where mutually exclusive selectors start paying off.
|
|
185
210
|
|
|
@@ -209,7 +234,7 @@ const Button = tasty({
|
|
|
209
234
|
});
|
|
210
235
|
```
|
|
211
236
|
|
|
212
|
-
### Phase
|
|
237
|
+
### Phase 6 -- Standardize style props and sub-elements
|
|
213
238
|
|
|
214
239
|
Define which style props each component category exposes. Layout components get flow/gap/padding. Interactive components get positioning. Compound components declare sub-elements.
|
|
215
240
|
|
|
@@ -225,7 +250,7 @@ const Card = tasty({
|
|
|
225
250
|
});
|
|
226
251
|
```
|
|
227
252
|
|
|
228
|
-
### Phase
|
|
253
|
+
### Phase 7 -- Expand to full DS coverage
|
|
229
254
|
|
|
230
255
|
Migrate the remaining components, add the [ESLint plugin](https://github.com/tenphi/eslint-plugin-tasty) to enforce style conventions at lint time, and consider [zero-runtime mode](tasty-static.md) for static or performance-critical pages.
|
|
231
256
|
|
|
@@ -254,8 +279,8 @@ const DangerButton = tasty(Button, {
|
|
|
254
279
|
const LoadingButton = tasty(Button, {
|
|
255
280
|
styles: {
|
|
256
281
|
fill: {
|
|
257
|
-
loading: '#yellow',
|
|
258
|
-
disabled: '#gray.20',
|
|
282
|
+
loading: '#yellow', // new state appended
|
|
283
|
+
disabled: '#gray.20', // existing state overridden in place
|
|
259
284
|
},
|
|
260
285
|
},
|
|
261
286
|
});
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Tasty Style Rules for AI Agents
|
|
2
|
+
|
|
3
|
+
A compact ruleset for **writing correct `@tenphi/tasty` styles**. It is not an API tour — most rules here are machine-checked by [`@tenphi/eslint-plugin-tasty`](https://www.npmjs.com/package/@tenphi/eslint-plugin-tasty), so following it generally means clean lint output. The plugin ships separately and can lag a new DSL rule, so treat this page as the source of truth and the plugin as the enforcement that catches most of it. For explanations and the complete API, see [Style DSL](dsl.md), [Style Properties](styles.md), [React API](react-api.md).
|
|
4
|
+
|
|
5
|
+
Notation: ❌ wrong → ✅ correct.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 0. Read the project config first
|
|
10
|
+
|
|
11
|
+
Color tokens (`#name`), custom properties (`$name`), `preset` names, `recipe` names, state aliases (`@mobile`) and extra units are **project-defined** in `tasty.config.ts` or a `configure({ … })` call. Look them up before writing styles. Never invent a name — reuse an existing one, or add it to the config.
|
|
12
|
+
|
|
13
|
+
## 1. Where styles go
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
const Card = tasty({ as: 'div', styles: { … }, styleProps: ['padding'] }); // new component
|
|
17
|
+
const Hero = tasty(Card, { styles: { … } }); // extend a component
|
|
18
|
+
const cls = useStyles({ … }); // ad-hoc class name
|
|
19
|
+
tastyStatic('.card', { … }); // build-time, zero runtime
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Wrap, don't pass styles per instance: ❌ `<Box styles={{ padding: '2x' }} />` → ✅ `const Box = tasty({ styles: { padding: '2x' } })`.
|
|
23
|
+
- Style values are **static**. Route anything conditional through a state map plus `mods` (or `tokens` / `styleProps`):
|
|
24
|
+
❌ `fill: isOpen ? '#primary' : '#surface'` → ✅ `fill: { '': '#surface', open: '#primary' }` with `mods={{ open: isOpen }}`.
|
|
25
|
+
|
|
26
|
+
## 2. Property names
|
|
27
|
+
|
|
28
|
+
Keys are camelCase — a Tasty property or a real CSS property. No kebab-case, no invented names.
|
|
29
|
+
|
|
30
|
+
Prefer the Tasty shorthand over its CSS equivalents:
|
|
31
|
+
|
|
32
|
+
| Use | Instead of |
|
|
33
|
+
|-----|------------|
|
|
34
|
+
| `fill` | `backgroundColor`, `background` |
|
|
35
|
+
| `image` | `backgroundImage` |
|
|
36
|
+
| `border` | `borderColor`, `borderWidth`, `borderStyle`, `borderTop`/`Right`/`Bottom`/`Left` |
|
|
37
|
+
| `radius` | `borderRadius` |
|
|
38
|
+
| `outline` | `outlineColor`, `outlineWidth`, `outlineStyle`, `outlineOffset` |
|
|
39
|
+
| `shadow` | `boxShadow` |
|
|
40
|
+
| `padding` | `paddingTop`/`Right`/`Bottom`/`Left` |
|
|
41
|
+
| `margin` | `marginTop`/`Right`/`Bottom`/`Left` |
|
|
42
|
+
| `inset` | `top`, `right`, `bottom`, `left` |
|
|
43
|
+
| `width` / `height` | `minWidth`/`maxWidth`, `minHeight`/`maxHeight` |
|
|
44
|
+
| `flow` | `flexDirection`, `flexWrap`, `flexFlow`, `gridAutoFlow` |
|
|
45
|
+
| `preset` | `fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform` |
|
|
46
|
+
| `font` | `fontFamily` |
|
|
47
|
+
| `scrollbar` | `scrollbarWidth`, `scrollbarColor`, `scrollbarGutter` |
|
|
48
|
+
| `gridColumns` / `gridRows` / `gridAreas` | `gridTemplateColumns` / `Rows` / `Areas` |
|
|
49
|
+
| `textOverflow: 'ellipsis / 3'` | `lineClamp` |
|
|
50
|
+
| `hide: true` | `display: 'none'` |
|
|
51
|
+
| `flexGrow` / `flexShrink` / `flexBasis` | `flex` |
|
|
52
|
+
|
|
53
|
+
The last row goes the other way — longhands over the shorthand — because `flex` is lossy: it resets the components you omit to non-initial values (`flex: '0'` silently sets `flex-basis: 0%`) and cannot express `flexShrink: 0` at all. The longhands also carry separate state maps.
|
|
54
|
+
|
|
55
|
+
## 3. Values
|
|
56
|
+
|
|
57
|
+
### Tokens
|
|
58
|
+
|
|
59
|
+
| Syntax | Meaning |
|
|
60
|
+
|--------|---------|
|
|
61
|
+
| `#name` | color token → `var(--name-color)` |
|
|
62
|
+
| `#name.50` | token at 50% opacity (`0`–`100`) |
|
|
63
|
+
| `#name.$opacity` | opacity from a custom property |
|
|
64
|
+
| `#clear` / `#current` | `transparent` / `currentcolor` |
|
|
65
|
+
| `$name` | custom property → `var(--name)` |
|
|
66
|
+
| `(#a, #b)` | fallback chain |
|
|
67
|
+
| `$$name` / `##name` | the custom property *name* (not its value) — inside `transition` |
|
|
68
|
+
| `$$name(…)` | call a CSS `@function` declared via `@function`, `useFunction`, or config |
|
|
69
|
+
|
|
70
|
+
- ❌ `#f5f5f5`, `rgb(0 0 0)`, `oklch(…)`, `okhsl(…)`, `red` → ✅ `#surface` (add the token to the config if it doesn't exist).
|
|
71
|
+
- ❌ `var(--gap)` → ✅ `$gap` · ❌ `$accent-color` → ✅ `#accent` · ❌ `transparent` → ✅ `#clear` · ❌ `currentColor` → ✅ `#current`.
|
|
72
|
+
- A `$name` must be declared as a `'$name': value` key in the same styles object, or in the config.
|
|
73
|
+
- Names are case-sensitive and start lowercase — `$myVar` → `--myVar`; a leading capital folds (`$Foo` → `--foo`). Prefer kebab-case.
|
|
74
|
+
- A `$name` reference is untyped: it fills the first free slot in a shorthand (`border: '1bw $my-style'` → the line style). Write colors as `#name`; `$name-color` is a fallback for pointing at a raw CSS custom property that holds a color.
|
|
75
|
+
- `preset` and `transition` take token *names*, not values, so a `$name` cannot stand in for one (it warns in dev and is ignored).
|
|
76
|
+
|
|
77
|
+
### Units
|
|
78
|
+
|
|
79
|
+
Tasty units: `x` (gap multiple), `r` (radius), `cr` (card radius), `bw` (border width), `ow` (outline width), `sf` (`minmax(0, Nfr)`). All CSS units work too, plus anything in `units` in the config. Any other unit is an error.
|
|
80
|
+
|
|
81
|
+
Prefer units over raw pixels: `8px` → `1x` … `64px` → `8x`; `radius: '6px'` → `'1r'`; `border: '1px …'` → `'1bw …'`.
|
|
82
|
+
|
|
83
|
+
### Math
|
|
84
|
+
|
|
85
|
+
❌ `calc(100% - 2x)` → ✅ `(100% - 2x)`. Parentheses are wrapped in `calc()` automatically — and must be balanced.
|
|
86
|
+
|
|
87
|
+
### `true`
|
|
88
|
+
|
|
89
|
+
`true` means "the design-system default" and is accepted **only** by: `border`, `radius`, `outline`, `shadow`, `padding`, `margin`, `gap`, `inset`, `width`, `height`, `fill`, `color`, `fade`, `preset`, `font`, `scrollbar`, `hide`. Anywhere else it is an error.
|
|
90
|
+
|
|
91
|
+
### `!important`
|
|
92
|
+
|
|
93
|
+
Never use it. Tasty owns specificity through doubled selectors and state ordering; `!important` breaks that. Express the exception as a state instead.
|
|
94
|
+
|
|
95
|
+
### Modifiers
|
|
96
|
+
|
|
97
|
+
A value is `[values…] [modifiers…]`, and several groups can be comma-separated (later groups override earlier ones). A group that names **direction** modifiers takes a **single** value, applied to every direction it names — per-side values come from comma groups. A group naming no direction keeps plain CSS shorthand order (1–4 values). (`inset` + `dock` is the one exception: a second value insets the spanned sides.) Only the modifiers a property knows are valid:
|
|
98
|
+
|
|
99
|
+
| Property | Modifiers |
|
|
100
|
+
|----------|-----------|
|
|
101
|
+
| `padding`, `margin`, `inset`, `fade` | `top` `right` `bottom` `left` |
|
|
102
|
+
| `border` | the four directions + `solid` `dashed` `dotted` `double` `groove` `ridge` `inset` `outset` `none` `hidden` |
|
|
103
|
+
| `outline` | the style keywords above |
|
|
104
|
+
| `radius` | `top` `right` `bottom` `left` + shapes `round` `ellipse` `leaf` `backleaf` |
|
|
105
|
+
| `width`, `height` | `min` `max` `fixed` |
|
|
106
|
+
| `flow` | `row` `column` `row-reverse` `column-reverse` `wrap` `nowrap` `dense` |
|
|
107
|
+
| `overflow` | `visible` `hidden` `scroll` `clip` `auto` `overlay` |
|
|
108
|
+
| `position` | `static` `relative` `absolute` `fixed` `sticky` |
|
|
109
|
+
| `shadow` | `inset` |
|
|
110
|
+
| `preset` | `name / strong` (or `bold`) `italic` `icon` `tight` |
|
|
111
|
+
| box properties | `longhand` — emit CSS longhands instead of the shorthand |
|
|
112
|
+
|
|
113
|
+
Directional modifiers beat placeholder zeros:
|
|
114
|
+
|
|
115
|
+
- ❌ `padding: '0 0 2x 0'` → ✅ `padding: '2x bottom'`
|
|
116
|
+
- ❌ `padding: '1x 1x 2x 1x'` → ✅ `padding: '1x, 2x bottom'`
|
|
117
|
+
- ❌ `border: '0 0 1bw 0'` — four tokens parse as *one* border value, so this renders no border at all → ✅ `border: '1bw bottom'`
|
|
118
|
+
- ❌ `padding: '2x 4x top right'` — a directional group takes one value, so `4x` is dropped → ✅ `padding: '2x top, 4x right'`
|
|
119
|
+
- ❌ `fade: '3x 1x top bottom'` → ✅ `fade: '3x top, 1x bottom'`
|
|
120
|
+
|
|
121
|
+
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, `tabSize`, `paddingInline`, `paddingBlock`. `fill` and `color` take a color (plus `none` / `transparent`); `caretColor` and `accentColor` take a color only.
|
|
122
|
+
|
|
123
|
+
### `transition`
|
|
124
|
+
|
|
125
|
+
Use semantic names, not CSS property names: `fade` `fill` `color` `theme` `border` `radius` `shadow` `outline` `preset` `text` `gap` `opacity` `translate` `rotate` `scale` `filter` `image` `background` `width` `height` `zIndex` `inset` `flow` `dimension`.
|
|
126
|
+
|
|
127
|
+
❌ `transition: 'background-color 0.2s'` → ✅ `transition: 'fill 0.2s'`
|
|
128
|
+
|
|
129
|
+
## 4. State maps
|
|
130
|
+
|
|
131
|
+
A property value can be an object of `state: value`. Key order is priority — later keys win.
|
|
132
|
+
|
|
133
|
+
| Key | Generated selector |
|
|
134
|
+
|-----|--------------------|
|
|
135
|
+
| `hovered` | `[data-hovered]` (boolean modifier from `mods`) |
|
|
136
|
+
| `theme=danger` | `[data-theme="danger"]` (value modifier) |
|
|
137
|
+
| `:hover` | pseudo-class |
|
|
138
|
+
| `.active` | class selector |
|
|
139
|
+
| `[aria-expanded="true"]` | attribute selector |
|
|
140
|
+
| `hovered & .active` | AND |
|
|
141
|
+
| `hovered \| focused` | OR (`,` also means OR) |
|
|
142
|
+
| `!disabled` | NOT |
|
|
143
|
+
| `hovered ^ focused` | XOR — exactly one (keep chains ≤ 4 operands) |
|
|
144
|
+
|
|
145
|
+
Precedence `!` > `^` > `|` > `&`; use parentheses to override.
|
|
146
|
+
|
|
147
|
+
Rules:
|
|
148
|
+
|
|
149
|
+
1. **`''` comes first.** The bare default is the lowest-priority state; placing it later would override everything above it.
|
|
150
|
+
2. **Every state map needs `''` or `_`** — except when extending (`tasty(Parent, …)`), where omitting `''` merges into the parent's states and including `''` replaces them wholesale.
|
|
151
|
+
3. **`_` is standalone-only** and always first (with `''` right after it, if present). `_` is a never-negated fallback floor for cases where a higher-priority branch may be *unknown* (`@supports`, container queries). If a map contains only `_` and `''`, drop the `''`.
|
|
152
|
+
4. **No nested maps:** ❌ `{ hovered: { pressed: 'x' } }` → ✅ `{ 'hovered & pressed': 'x' }`
|
|
153
|
+
5. **State keys never sit at the top level** of a styles object — `:hover`, `.active`, `[open]` belong inside a property value.
|
|
154
|
+
6. **Prefer automatic native states:** use `disabled` and `checked` in Tasty component styles instead of `[disabled]` and `[checked]`. The concise states track the corresponding native prop or attribute automatically.
|
|
155
|
+
|
|
156
|
+
```jsx
|
|
157
|
+
color: { '': '#text', hovered: '#accent', disabled: '#text.40' }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Advanced states:
|
|
161
|
+
|
|
162
|
+
| Prefix | Use | Example |
|
|
163
|
+
|--------|-----|---------|
|
|
164
|
+
| `@media(…)` | media query; dimensions `w` `h`; types `@media:print` `:screen` `:all` `:speech` | `@media(w < 768px)`, `@media(600px <= w < 1200px)` |
|
|
165
|
+
| `@(…)` | container query; dimensions `w` `h` `is` `bs` | `@(layout, w >= 600px)`, `@($variant=primary)` |
|
|
166
|
+
| `@supports(…)` | feature query; `$` first argument tests a selector | `@supports(display: grid)`, `@supports($, :has(*))` |
|
|
167
|
+
| `@root(…)` | condition on `:root` | `@root(schema=dark)` |
|
|
168
|
+
| `@parent(…)` | condition on an ancestor; `, >` for the direct parent | `@parent(hovered, >)` |
|
|
169
|
+
| `@own(…)` | a sub-element's own state — **only inside sub-element styles** | `@own(:hover)` |
|
|
170
|
+
| `@starting` | `@starting-style` entry animation | `@starting` |
|
|
171
|
+
| `@name` | project state alias | `@mobile` |
|
|
172
|
+
|
|
173
|
+
- At root level write the selector directly: ❌ `'@own(:hover)'` → ✅ `':hover'`.
|
|
174
|
+
- `@name` aliases must exist in `states` in the config or be declared locally as an `'@name': '<state expression>'` key; alias keys start with `@` and their value must be a valid state expression.
|
|
175
|
+
- `:is()` / `:has()` / `:not()` / `:where()` work in state keys but support at most 2 levels of nested parentheses, and `:has()` is expensive — prefer `@parent()`, `@own()` and modifiers.
|
|
176
|
+
|
|
177
|
+
When extending a parent's state map: `'@inherit'` reuses the parent's value for that state, `null` removes a state (or resets a property, letting recipes fill in), `false` is a tombstone that blocks it entirely.
|
|
178
|
+
|
|
179
|
+
## 5. Sub-elements
|
|
180
|
+
|
|
181
|
+
A **capitalized** key targets `[data-element="Name"]`, and its value must be a style object.
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
styles: { Title: { preset: 'h3' }, Icon: { $: '>@:last-child', color: '#accent' } }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
❌ nested-selector keys (`'& .title'`, `'&:hover'`) → ✅ sub-elements and state maps. Use the `$` affix property inside a sub-element to control how its selector attaches (`>` direct child, `@` placeholder for the element itself, `&::before` for a root pseudo-element).
|
|
188
|
+
|
|
189
|
+
## 6. Special top-level keys
|
|
190
|
+
|
|
191
|
+
| Key | Shape |
|
|
192
|
+
|-----|-------|
|
|
193
|
+
| `@keyframes` | `{ name: { '0%': styles, … } }` |
|
|
194
|
+
| `@property` | `{ '$name': { syntax, inherits, initialValue } }` |
|
|
195
|
+
| `@font-face` | `{ 'Family Name': descriptors \| descriptors[] }` |
|
|
196
|
+
| `@counter-style` | `{ name: descriptors }` |
|
|
197
|
+
| `@function` | `{ '$$name': { args, returns?, result, '$local'? } }` |
|
|
198
|
+
| `recipe` | a **string** of configured recipe names: `'card elevated'`, `'reset input / autofill'`, `'none / disabled'` |
|
|
199
|
+
|
|
200
|
+
At-rule keys match the real CSS at-rule names, so they are kebab-case, not camelCase. Inside `@function`, the callable is `$$name` but its parameters and local variables are `$name`:
|
|
201
|
+
|
|
202
|
+
```jsx
|
|
203
|
+
styles: {
|
|
204
|
+
'@function': { $$negative: { args: ['$value'], result: '(-1 * $value)' } },
|
|
205
|
+
margin: '$$negative(2x) top',
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 7. `tastyStatic()`
|
|
210
|
+
|
|
211
|
+
The selector must be a string literal and valid CSS. Values must be static — strings, numbers, booleans, `null`, or objects/arrays of those. No variables, template literals, function calls, or spreads.
|
|
212
|
+
|
|
213
|
+
## 8. Checklist
|
|
214
|
+
|
|
215
|
+
- Token, preset, recipe, unit and `@alias` names exist in the project config.
|
|
216
|
+
- Tasty shorthand chosen over CSS longhands; `flexGrow`/`flexShrink`/`flexBasis` over `flex`; `hide: true` over `display: 'none'`.
|
|
217
|
+
- Colors are `#tokens`, not hex/rgb/oklch/named; `$prop` not `var(--prop)`.
|
|
218
|
+
- Spacing uses `x`/`r`/`bw`/`ow` units; math uses `(…)`, not `calc(…)`.
|
|
219
|
+
- `true` only on the properties that accept it; no `!important`.
|
|
220
|
+
- Modifiers valid for the property; directional shorthand instead of placeholder zeros.
|
|
221
|
+
- Every state map starts with `''` (or `_`), is flat, and lives inside a property value.
|
|
222
|
+
- `@own()` only inside sub-elements; sub-element keys are capitalized and hold objects.
|
|
223
|
+
- At-rule keys are kebab-case (`@property`, `@font-face`, `@counter-style`, `@function`); `@function` names use `$$`, their args and locals use `$`.
|
|
224
|
+
- Values are static; dynamic behavior comes from `mods` / `tokens` / `styleProps`.
|
package/docs/comparison.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Use this guide when you are deciding whether Tasty is the right tool. If you have already decided to adopt it and need rollout guidance, use the [Adoption Guide](adoption.md) instead.
|
|
4
4
|
|
|
5
|
-
Tasty is
|
|
5
|
+
Tasty is CSS-in-JS for React design systems. It is built for the point where reusable components have enough intersecting states, variants, themes, and extension rules that ordinary selector competition becomes hard to reason about.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Its distinctive guarantee is narrow and concrete: each property’s state map compiles into selectors that cannot compete, so one declared branch wins regardless of CSS source order.
|
|
8
8
|
|
|
9
9
|
That does not require a big upfront configuration step. Tasty's built-in units and normal CSS color values work out of the box, and `okhsl(...)` is available immediately as the recommended path for color authoring. The extra setup comes later if a team wants shared tokens, aliases, recipes, or stricter conventions.
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ Most styling tools focus on one of these layers:
|
|
|
16
16
|
- utility composition
|
|
17
17
|
- atomic CSS generation
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
For design-system teams, that state model can sit alongside tokens, typed style props, recipes, custom units, and sub-element rules. Tasty can therefore define the styling language exposed by shared components, not just another syntax for writing CSS.
|
|
20
20
|
|
|
21
21
|
That is why syntax-level comparisons are often shallow. The more meaningful comparison is about:
|
|
22
22
|
|
|
@@ -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
|
|
33
|
-
|
|
34
|
-
| **Tasty**
|
|
35
|
-
| **Tailwind CSS**
|
|
36
|
-
| **Panda CSS**
|
|
37
|
-
| **vanilla-extract**
|
|
38
|
-
| **StyleX**
|
|
39
|
-
| **Stitches** (deprecated) **/ Emotion** | Component-first CSS-in-JS
|
|
32
|
+
| System | Best described as | Main authoring model | Conflict model | RSC / zero-JS SSG | Best fit |
|
|
33
|
+
| --------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
|
|
34
|
+
| **Tasty** | CSS-in-JS for React design systems | CSS-like objects with state maps, tokens, recipes, style props, and sub-elements | **Mutually exclusive selector resolution** for stateful styles | Yes — hook-free, server components by default | Teams building long-lived shared component APIs |
|
|
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
|
|
|
@@ -69,8 +69,12 @@ This is especially relevant for components with intersecting states such as:
|
|
|
69
69
|
Here is a minimal example. Two CSS rules for a button's background — one for `:hover`, one for `[disabled]`:
|
|
70
70
|
|
|
71
71
|
```css
|
|
72
|
-
.btn:hover
|
|
73
|
-
|
|
72
|
+
.btn:hover {
|
|
73
|
+
background: dodgerblue;
|
|
74
|
+
}
|
|
75
|
+
.btn[disabled] {
|
|
76
|
+
background: gray;
|
|
77
|
+
}
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
When the button is both hovered **and** disabled, both selectors match with equal specificity. The last rule in source order wins. Swap the two lines and the visual behavior silently reverses — a hovered disabled button turns blue instead of gray.
|
|
@@ -81,11 +85,11 @@ In Tasty, the same intent is declared as a state map:
|
|
|
81
85
|
fill: {
|
|
82
86
|
'': '#primary',
|
|
83
87
|
':hover': '#primary-hover',
|
|
84
|
-
'disabled': '#surface',
|
|
88
|
+
'[disabled]': '#surface',
|
|
85
89
|
}
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
Because `[disabled]` is declared later, it has higher priority. Tasty excludes disabled buttons from the hover selector, so exactly one background rule matches. The outcome is defined by the state map, not by which CSS rule comes last.
|
|
89
93
|
|
|
90
94
|
That makes Tasty less of a "better way to write CSS objects" and more of a **state-aware style compiler for design systems**.
|
|
91
95
|
|
|
@@ -131,16 +135,36 @@ To make this concrete, consider a button with `hover`, `disabled`, and `theme=da
|
|
|
131
135
|
**Plain CSS** — you need a selector for every intersection, and equal-specificity rules depend on source order:
|
|
132
136
|
|
|
133
137
|
```css
|
|
134
|
-
.btn {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
.btn {
|
|
139
|
+
background: var(--primary);
|
|
140
|
+
color: white;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
}
|
|
143
|
+
.btn:hover {
|
|
144
|
+
background: var(--primary-hover);
|
|
145
|
+
}
|
|
146
|
+
.btn:active {
|
|
147
|
+
background: var(--primary-pressed);
|
|
148
|
+
}
|
|
149
|
+
.btn[disabled] {
|
|
150
|
+
background: var(--surface);
|
|
151
|
+
color: var(--text-40);
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
138
154
|
|
|
139
155
|
/* theme=danger overrides — must repeat disabled/hover/active */
|
|
140
|
-
.btn[data-theme=
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.btn[data-theme=
|
|
156
|
+
.btn[data-theme='danger'] {
|
|
157
|
+
background: var(--danger);
|
|
158
|
+
}
|
|
159
|
+
.btn[data-theme='danger']:hover {
|
|
160
|
+
background: var(--danger-hover);
|
|
161
|
+
}
|
|
162
|
+
.btn[data-theme='danger']:active {
|
|
163
|
+
background: var(--danger-pressed);
|
|
164
|
+
}
|
|
165
|
+
.btn[data-theme='danger'][disabled] {
|
|
166
|
+
background: var(--surface);
|
|
167
|
+
}
|
|
144
168
|
|
|
145
169
|
/* Bug: .btn:hover and .btn[disabled] have the same specificity.
|
|
146
170
|
A hovered disabled button gets :hover styles — unless source order saves you. */
|
|
@@ -172,18 +196,18 @@ const Button = tasty({
|
|
|
172
196
|
'': '#primary',
|
|
173
197
|
':hover': '#primary-hover',
|
|
174
198
|
':active': '#primary-pressed',
|
|
175
|
-
|
|
199
|
+
disabled: '#surface',
|
|
176
200
|
'theme=danger': '#danger',
|
|
177
201
|
'theme=danger & :hover': '#danger-hover',
|
|
178
202
|
'theme=danger & :active': '#danger-pressed',
|
|
179
203
|
},
|
|
180
204
|
color: {
|
|
181
205
|
'': '#on-primary',
|
|
182
|
-
|
|
206
|
+
disabled: '#text.40',
|
|
183
207
|
},
|
|
184
208
|
cursor: {
|
|
185
209
|
'': 'pointer',
|
|
186
|
-
|
|
210
|
+
disabled: 'not-allowed',
|
|
187
211
|
},
|
|
188
212
|
},
|
|
189
213
|
});
|
|
@@ -298,11 +322,11 @@ It is less focused on "how do I style this component ergonomically right now?" a
|
|
|
298
322
|
- what should be allowed or constrained?
|
|
299
323
|
- how do we keep style behavior deterministic as the system grows?
|
|
300
324
|
|
|
301
|
-
So while Stitches and Emotion are strong tools for building components, Tasty is more naturally positioned as
|
|
325
|
+
So while Stitches and Emotion are strong tools for building components, Tasty is more naturally positioned as the **styling engine underneath a design system’s component API**.
|
|
302
326
|
|
|
303
327
|
That makes it narrower in audience, but deeper in architectural ambition.
|
|
304
328
|
|
|
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
|
|
329
|
+
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
330
|
|
|
307
331
|
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.
|
|
308
332
|
|
|
@@ -312,7 +336,7 @@ For teams evaluating runtime styling at scale, Tasty also documents its runtime
|
|
|
312
336
|
|
|
313
337
|
Tasty is not limited to one execution model.
|
|
314
338
|
|
|
315
|
-
The term "runtime" in `tasty()` refers to
|
|
339
|
+
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.
|
|
316
340
|
|
|
317
341
|
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.
|
|
318
342
|
|
|
@@ -332,22 +356,27 @@ This flexibility is one of Tasty's more unusual strengths:
|
|
|
332
356
|
Another useful way to think about the ecosystem is by abstraction level.
|
|
333
357
|
|
|
334
358
|
### Direct styling tools
|
|
359
|
+
|
|
335
360
|
These are optimized for styling product code directly.
|
|
336
361
|
|
|
337
362
|
Examples:
|
|
363
|
+
|
|
338
364
|
- Tailwind CSS
|
|
339
365
|
- Emotion (requires `'use client'` — not RSC-compatible)
|
|
340
366
|
- Stitches (deprecated, requires `'use client'`)
|
|
341
367
|
|
|
342
368
|
### Typed styling engines
|
|
369
|
+
|
|
343
370
|
These are optimized for generating CSS with stronger structure and tooling.
|
|
344
371
|
|
|
345
372
|
Examples:
|
|
373
|
+
|
|
346
374
|
- Panda CSS
|
|
347
375
|
- vanilla-extract
|
|
348
376
|
- StyleX
|
|
349
377
|
|
|
350
378
|
### Design-system language engines
|
|
379
|
+
|
|
351
380
|
These are optimized for helping a team define its own styling grammar and semantics.
|
|
352
381
|
|
|
353
382
|
Tasty belongs most naturally here.
|
|
@@ -364,7 +393,7 @@ Tasty makes the most sense when:
|
|
|
364
393
|
- a shared component API is emerging even if the design system is still lightweight
|
|
365
394
|
- styling should be governed through a central platform team
|
|
366
395
|
- component state logic is complex
|
|
367
|
-
- the team wants a
|
|
396
|
+
- the team wants a design-system-owned styling language instead of raw CSS-shaped authoring
|
|
368
397
|
- tokens, recipes, and sub-elements should be first-class
|
|
369
398
|
- deterministic state resolution matters more than minimum abstraction overhead
|
|
370
399
|
- the styling engine may need to work as either a runtime tool or a build-time compiler
|