@tenphi/tasty 0.0.0-snapshot.1d29633 → 0.0.0-snapshot.1f1c00a
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 +152 -134
- package/dist/{babel-Cg-mJV_t.d.ts → babel-rZcEwPLM.d.ts} +2 -3
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
- package/dist/chunks/build-config-CL4eRu2z.js +42 -0
- package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
- package/dist/{collector-BMT05AmU.js → chunks/collector-D2ARGT2L.js} +21 -117
- package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
- package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
- package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
- package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
- package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/chunks/debug-D8pg9RGI.js +502 -0
- package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
- package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
- package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-BpxlOTbO.js +562 -0
- package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
- package/dist/{merge-styles-CkAcnd0Z.js → chunks/shared-utils-y-HjvPN4.js} +60 -55
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
- package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
- package/dist/{css-writer-b02uBqNF.js → chunks/zero-engine-gJrKBRiw.js} +6 -121
- package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
- package/dist/{collector-BFuqdF2F.d.ts → collector-w4mBj5gd.d.ts} +23 -4
- package/dist/{config-DmFxnBxg.d.ts → config-CZWCzBr6.d.ts} +171 -72
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +9 -6
- package/dist/{index-D1nMkpUe.d.ts → index-G9JuwM9p.d.ts} +263 -247
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -921
- package/dist/{merge-styles-Cx_6ySBv.d.ts → merge-styles-VXwJ0Frr.d.ts} +2 -3
- package/dist/ssr/astro-client.d.ts +1 -1
- package/dist/ssr/astro-client.js +1 -14
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +3 -2
- package/dist/ssr/astro-middleware-static.js +0 -11
- package/dist/ssr/astro-middleware-static.js.map +1 -1
- package/dist/ssr/astro-middleware.d.ts +3 -2
- package/dist/ssr/astro-middleware.js +0 -12
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +40 -6
- package/dist/ssr/astro.js +157 -93
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +10 -11
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +128 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +9 -8
- package/dist/ssr/next.js +29 -43
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +8 -9
- package/dist/static/index.js +4 -22
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.d.ts +1 -2
- package/dist/{index-LC3O3Jj4.d.ts → types-JEY8PVYP.d.ts} +862 -811
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +41 -107
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +6 -7
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +3 -5
- package/dist/zero/next.js +0 -31
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +13 -8
- package/docs/adoption.md +56 -31
- package/docs/ai-agents.md +107 -80
- package/docs/comparison.md +69 -40
- package/docs/configuration.md +179 -114
- package/docs/debug.md +19 -7
- package/docs/design-system.md +41 -22
- package/docs/dsl.md +310 -201
- package/docs/getting-started.md +64 -41
- package/docs/injector.md +63 -26
- package/docs/methodology.md +44 -38
- package/docs/migration-v3.md +49 -49
- package/docs/pipeline.md +32 -8
- package/docs/plugins.md +38 -34
- package/docs/react-api.md +67 -44
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +219 -61
- package/docs/styles.md +95 -18
- package/docs/tasty-static.md +138 -105
- package/package.json +104 -33
- package/dist/async-storage-DKK-wTD4.js +0 -44
- package/dist/async-storage-DKK-wTD4.js.map +0 -1
- package/dist/collector-BMT05AmU.js.map +0 -1
- package/dist/config-DF93rL3u.js +0 -12661
- package/dist/config-DF93rL3u.js.map +0 -1
- package/dist/context-CA8YKeMn.js +0 -24
- package/dist/context-CA8YKeMn.js.map +0 -1
- package/dist/core-B5ybnMP1.js +0 -1529
- package/dist/core-B5ybnMP1.js.map +0 -1
- package/dist/css-writer-b02uBqNF.js.map +0 -1
- package/dist/format-global-rules-DklyaXv-.js +0 -22
- package/dist/format-global-rules-DklyaXv-.js.map +0 -1
- package/dist/format-rules-Cs4e3M9m.js +0 -130
- package/dist/format-rules-Cs4e3M9m.js.map +0 -1
- package/dist/hydrate-aaUSNJZJ.js +0 -37
- package/dist/hydrate-aaUSNJZJ.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyframes-BedEzEXk.js +0 -424
- package/dist/keyframes-BedEzEXk.js.map +0 -1
- package/dist/merge-styles-CkAcnd0Z.js.map +0 -1
- package/dist/resolve-recipes-CiyLtJG9.js +0 -144
- package/dist/resolve-recipes-CiyLtJG9.js.map +0 -1
package/docs/design-system.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Building a Design System
|
|
2
2
|
|
|
3
|
-
This guide
|
|
3
|
+
This guide shows how to build shared React components whose styles stay predictable as states, variants, themes, and responsive rules accumulate. You will define tokens, state aliases, recipes, primitive APIs, and compound components with sub-elements.
|
|
4
4
|
|
|
5
|
-
It assumes you have already decided to adopt Tasty. The goal is not
|
|
5
|
+
It assumes you have already decided to adopt Tasty. The goal is not only to centralize values, but to give your design system one state model and a governed component-facing styling API. For evaluation criteria and incremental rollout, see the [Adoption Guide](adoption.md). For the recommended component architecture, see [Methodology](methodology.md).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -43,8 +43,8 @@ configure({
|
|
|
43
43
|
'#border': '#e0e0e0',
|
|
44
44
|
|
|
45
45
|
// Unit values
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
$gap: '8px',
|
|
47
|
+
$radius: '4px',
|
|
48
48
|
'$border-width': '1px',
|
|
49
49
|
'$outline-width': '2px',
|
|
50
50
|
},
|
|
@@ -91,8 +91,18 @@ import { configure } from '@tenphi/tasty';
|
|
|
91
91
|
|
|
92
92
|
configure({
|
|
93
93
|
presets: {
|
|
94
|
-
h1: {
|
|
95
|
-
|
|
94
|
+
h1: {
|
|
95
|
+
fontSize: '2rem',
|
|
96
|
+
lineHeight: '1.2',
|
|
97
|
+
letterSpacing: '-0.02em',
|
|
98
|
+
fontWeight: 700,
|
|
99
|
+
},
|
|
100
|
+
t2: {
|
|
101
|
+
fontSize: '0.875rem',
|
|
102
|
+
lineHeight: '1.5',
|
|
103
|
+
letterSpacing: 'normal',
|
|
104
|
+
fontWeight: 400,
|
|
105
|
+
},
|
|
96
106
|
},
|
|
97
107
|
});
|
|
98
108
|
```
|
|
@@ -123,8 +133,16 @@ Register your design system's custom fonts via `configure({ fontFaces })` so eve
|
|
|
123
133
|
configure({
|
|
124
134
|
fontFaces: {
|
|
125
135
|
'Brand Sans': [
|
|
126
|
-
{
|
|
127
|
-
|
|
136
|
+
{
|
|
137
|
+
src: 'url("/fonts/brand-regular.woff2") format("woff2")',
|
|
138
|
+
fontWeight: 400,
|
|
139
|
+
fontDisplay: 'swap',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
src: 'url("/fonts/brand-bold.woff2") format("woff2")',
|
|
143
|
+
fontWeight: 700,
|
|
144
|
+
fontDisplay: 'swap',
|
|
145
|
+
},
|
|
128
146
|
],
|
|
129
147
|
},
|
|
130
148
|
});
|
|
@@ -144,7 +162,8 @@ configure({
|
|
|
144
162
|
'@mobile': '@media(w < 768px)',
|
|
145
163
|
'@tablet': '@media(768px <= w < 1024px)',
|
|
146
164
|
'@desktop': '@media(w >= 1024px)',
|
|
147
|
-
'@dark':
|
|
165
|
+
'@dark':
|
|
166
|
+
'@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
|
|
148
167
|
'@reduced-motion': '@media(prefers-reduced-motion: reduce)',
|
|
149
168
|
},
|
|
150
169
|
});
|
|
@@ -185,7 +204,7 @@ configure({
|
|
|
185
204
|
'input-reset': {
|
|
186
205
|
border: 'none',
|
|
187
206
|
outline: 'none',
|
|
188
|
-
fill: '
|
|
207
|
+
fill: '#clear',
|
|
189
208
|
font: true,
|
|
190
209
|
preset: 't3',
|
|
191
210
|
},
|
|
@@ -211,7 +230,7 @@ const ProfileCard = tasty({
|
|
|
211
230
|
});
|
|
212
231
|
```
|
|
213
232
|
|
|
214
|
-
Use the `/` separator when a recipe should be applied
|
|
233
|
+
Use the `/` separator when a recipe should be applied _after_ local styles (post-merge), so recipe states take priority:
|
|
215
234
|
|
|
216
235
|
```tsx
|
|
217
236
|
const Input = tasty({
|
|
@@ -283,12 +302,12 @@ Product engineers use these to compose layouts without writing CSS:
|
|
|
283
302
|
|
|
284
303
|
Match the prop set to the component's role:
|
|
285
304
|
|
|
286
|
-
| Component category
|
|
287
|
-
|
|
288
|
-
| Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill
|
|
289
|
-
| Positioned elements (`Button`, `Badge`)
|
|
290
|
-
| Text elements
|
|
291
|
-
| Compound components
|
|
305
|
+
| Component category | Recommended styleProps |
|
|
306
|
+
| ------------------------------------------ | -------------------------------------------------------------- |
|
|
307
|
+
| Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill |
|
|
308
|
+
| Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
|
|
309
|
+
| Text elements | `['preset', 'color']` or a custom subset |
|
|
310
|
+
| Compound components | Typically none — styling happens via sub-elements and wrapping |
|
|
292
311
|
|
|
293
312
|
Exposing too many props weakens the design system's constraints. See [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api) for the rationale.
|
|
294
313
|
|
|
@@ -335,9 +354,7 @@ Usage:
|
|
|
335
354
|
```tsx
|
|
336
355
|
<Card>
|
|
337
356
|
<Card.Title>Monthly Revenue</Card.Title>
|
|
338
|
-
<Card.Content>
|
|
339
|
-
$1.2M — up 12% from last month.
|
|
340
|
-
</Card.Content>
|
|
357
|
+
<Card.Content>$1.2M — up 12% from last month.</Card.Content>
|
|
341
358
|
<Card.Footer>
|
|
342
359
|
<Button>Details</Button>
|
|
343
360
|
</Card.Footer>
|
|
@@ -365,13 +382,15 @@ A design system works best when the rules for customization are explicit. Tasty
|
|
|
365
382
|
2. **Use modProps** — control component states through typed props instead of `mods`:
|
|
366
383
|
|
|
367
384
|
```tsx
|
|
368
|
-
<Button isLoading size="large">
|
|
385
|
+
<Button isLoading size="large">
|
|
386
|
+
Submit
|
|
387
|
+
</Button>
|
|
369
388
|
```
|
|
370
389
|
|
|
371
390
|
3. **Pass tokens** — inject runtime values through the `tokens` prop for per-instance customization:
|
|
372
391
|
|
|
373
392
|
```tsx
|
|
374
|
-
<ProgressBar tokens={{
|
|
393
|
+
<ProgressBar tokens={{ $progress: `${percent}%` }} />
|
|
375
394
|
```
|
|
376
395
|
|
|
377
396
|
4. **Create styled wrappers** — extend a component's styles with `tasty(Base, { styles })`:
|