@tenphi/tasty 0.10.1 → 0.11.0
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 +79 -5
- package/dist/config.d.ts +32 -9
- package/dist/config.js +51 -10
- package/dist/config.js.map +1 -1
- package/dist/core/index.d.ts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/injector/injector.js +1 -7
- package/dist/injector/injector.js.map +1 -1
- package/dist/parser/classify.js.map +1 -1
- package/dist/plugins/types.d.ts +9 -2
- package/dist/ssr/collector.js +11 -1
- package/dist/ssr/collector.js.map +1 -1
- package/dist/styles/types.d.ts +14 -1
- package/dist/tasty.d.ts +6 -6
- package/dist/utils/typography.d.ts +24 -13
- package/dist/utils/typography.js +6 -16
- package/dist/utils/typography.js.map +1 -1
- package/dist/zero/babel.d.ts +10 -4
- package/dist/zero/babel.js +6 -1
- package/dist/zero/babel.js.map +1 -1
- package/docs/adoption.md +286 -0
- package/docs/comparison.md +413 -0
- package/docs/configuration.md +41 -10
- package/docs/debug.md +1 -1
- package/docs/design-system.md +401 -0
- package/docs/{usage.md → dsl.md} +254 -409
- package/docs/getting-started.md +201 -0
- package/docs/injector.md +2 -2
- package/docs/methodology.md +501 -0
- package/docs/runtime.md +291 -0
- package/docs/ssr.md +11 -1
- package/docs/styles.md +2 -2
- package/docs/tasty-static.md +25 -3
- package/package.json +7 -4
- package/dist/tokens/typography.d.ts +0 -19
- package/dist/tokens/typography.js +0 -237
- package/dist/tokens/typography.js.map +0 -1
package/docs/runtime.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Runtime API
|
|
2
|
+
|
|
3
|
+
The React-specific `tasty()` component factory, component props, and hooks. For the shared style language (state maps, tokens, units, extending semantics), see [Style DSL](dsl.md). For global configuration, see [Configuration](configuration.md).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Component Creation
|
|
8
|
+
|
|
9
|
+
### Create a new component
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { tasty } from '@tenphi/tasty';
|
|
13
|
+
|
|
14
|
+
const Card = tasty({
|
|
15
|
+
as: 'div',
|
|
16
|
+
styles: {
|
|
17
|
+
padding: '4x',
|
|
18
|
+
fill: '#white',
|
|
19
|
+
border: true,
|
|
20
|
+
radius: true,
|
|
21
|
+
},
|
|
22
|
+
styleProps: ['padding', 'fill'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
<Card>Hello World</Card>
|
|
26
|
+
<Card padding="6x" fill="#gray.05">Custom Card</Card>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Extend an existing component
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
const PrimaryButton = tasty(Button, {
|
|
33
|
+
styles: {
|
|
34
|
+
fill: '#purple',
|
|
35
|
+
color: '#white',
|
|
36
|
+
padding: '2x 4x',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Style maps merge intelligently — see [Style DSL — Extending vs. Replacing State Maps](dsl.md#extending-vs-replacing-state-maps) for extend mode, replace mode, `@inherit`, `null`, and `false` tombstones.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Style Props
|
|
46
|
+
|
|
47
|
+
Use `styleProps` to expose style properties as direct component props:
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
const FlexibleBox = tasty({
|
|
51
|
+
as: 'div',
|
|
52
|
+
styles: {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
padding: '2x',
|
|
55
|
+
},
|
|
56
|
+
styleProps: ['gap', 'align', 'placeContent', 'fill'],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
<FlexibleBox gap="2x" align="center" fill="#surface">
|
|
60
|
+
Content
|
|
61
|
+
</FlexibleBox>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Style props accept state maps, so responsive values work through the same API:
|
|
65
|
+
|
|
66
|
+
```jsx
|
|
67
|
+
<FlexibleBox
|
|
68
|
+
gap={{ '': '2x', '@tablet': '4x' }}
|
|
69
|
+
fill={{ '': '#surface', '@dark': '#surface-dark' }}
|
|
70
|
+
>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For predefined style prop lists (`FLOW_STYLES`, `POSITION_STYLES`, `DIMENSION_STYLES`, etc.) and guidance on which props to expose per component category, see [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Variants
|
|
78
|
+
|
|
79
|
+
Define named style variations. Only CSS for variants actually used at runtime is injected:
|
|
80
|
+
|
|
81
|
+
```jsx
|
|
82
|
+
const Button = tasty({
|
|
83
|
+
styles: {
|
|
84
|
+
padding: '2x 4x',
|
|
85
|
+
border: true,
|
|
86
|
+
},
|
|
87
|
+
variants: {
|
|
88
|
+
default: { fill: '#blue', color: '#white' },
|
|
89
|
+
danger: { fill: '#red', color: '#white' },
|
|
90
|
+
outline: { fill: 'transparent', color: '#blue', border: '1bw solid #blue' },
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
<Button variant="danger">Delete</Button>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Extending Variants with Base State Maps
|
|
98
|
+
|
|
99
|
+
When base `styles` contain an extend-mode state map (an object **without** a `''` key), it is applied **after** the variant merge. This lets you add or override states across all variants without repeating yourself:
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
const Badge = tasty({
|
|
103
|
+
styles: {
|
|
104
|
+
padding: '1x 2x',
|
|
105
|
+
border: {
|
|
106
|
+
'type=primary': '#clear',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
variants: {
|
|
110
|
+
primary: {
|
|
111
|
+
border: { '': '#white.2', pressed: '#primary-text', disabled: '#clear' },
|
|
112
|
+
fill: { '': '#white #primary', hovered: '#white #primary-text' },
|
|
113
|
+
},
|
|
114
|
+
secondary: {
|
|
115
|
+
border: { '': '#primary.15', pressed: '#primary.3' },
|
|
116
|
+
fill: '#primary.10',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Both variants get 'type=primary': '#clear' appended to their border map
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Properties that are **not** extend-mode (simple values, state maps with `''`, `null`, `false`, selectors, sub-elements) merge with variants as before — the variant can fully replace them.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Sub-element Styling
|
|
129
|
+
|
|
130
|
+
Sub-elements are inner parts of a compound component, styled via capitalized keys in `styles` and identified by `data-element` attributes in the DOM.
|
|
131
|
+
|
|
132
|
+
> Use the `elements` prop to declare sub-element components. This gives you typed, reusable sub-components (`Card.Title`, `Card.Content`) instead of manually writing `data-element` attributes.
|
|
133
|
+
|
|
134
|
+
```jsx
|
|
135
|
+
const Card = tasty({
|
|
136
|
+
styles: {
|
|
137
|
+
padding: '4x',
|
|
138
|
+
Title: { preset: 'h3', color: '#primary' },
|
|
139
|
+
Content: { color: '#text' },
|
|
140
|
+
},
|
|
141
|
+
elements: {
|
|
142
|
+
Title: 'h3',
|
|
143
|
+
Content: 'div',
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
<Card>
|
|
148
|
+
<Card.Title>Card Title</Card.Title>
|
|
149
|
+
<Card.Content>Card content</Card.Content>
|
|
150
|
+
</Card>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Each entry in `elements` can be a tag name string or a config object:
|
|
154
|
+
|
|
155
|
+
```jsx
|
|
156
|
+
elements: {
|
|
157
|
+
Title: 'h3', // shorthand: tag name only
|
|
158
|
+
Icon: { as: 'span', qa: 'card-icon' }, // full form: tag + QA attribute
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The sub-components produced by `elements` support `mods`, `tokens`, `isDisabled`, `isHidden`, and `isChecked` props — the same modifier interface as the root component.
|
|
163
|
+
|
|
164
|
+
If you don't need sub-components (e.g., the inner elements are already rendered by a third-party library), you can still style them by key alone — just omit `elements` and apply `data-element` manually:
|
|
165
|
+
|
|
166
|
+
```jsx
|
|
167
|
+
const Card = tasty({
|
|
168
|
+
styles: {
|
|
169
|
+
padding: '4x',
|
|
170
|
+
Title: { preset: 'h3', color: '#primary' },
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
<Card>
|
|
175
|
+
<div data-element="Title">Card Title</div>
|
|
176
|
+
</Card>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Selector Affix (`$`)
|
|
180
|
+
|
|
181
|
+
Control how a sub-element selector attaches to the root selector using the `$` property inside the sub-element's styles:
|
|
182
|
+
|
|
183
|
+
| Pattern | Result | Description |
|
|
184
|
+
|---------|--------|-------------|
|
|
185
|
+
| *(none)* | ` [el]` | Descendant (default) |
|
|
186
|
+
| `>` | `> [el]` | Direct child |
|
|
187
|
+
| `>Body>Row>` | `> [Body] > [Row] > [el]` | Chained elements |
|
|
188
|
+
| `::before` | `::before` | Root pseudo (no key) |
|
|
189
|
+
| `@::before` | `[el]::before` | Pseudo on the sub-element |
|
|
190
|
+
| `>@:hover` | `> [el]:hover` | Pseudo-class on the sub-element |
|
|
191
|
+
| `>@.active` | `> [el].active` | Class on the sub-element |
|
|
192
|
+
|
|
193
|
+
The `@` placeholder marks exactly where the `[data-element="..."]` selector is injected, allowing you to attach pseudo-classes, pseudo-elements, or class selectors directly to the sub-element instead of the root:
|
|
194
|
+
|
|
195
|
+
```jsx
|
|
196
|
+
const List = tasty({
|
|
197
|
+
styles: {
|
|
198
|
+
Item: {
|
|
199
|
+
$: '>@:last-child',
|
|
200
|
+
border: 'none',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
// → .t0 > [data-element="Item"]:last-child { border: none }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
For the mental model behind sub-elements — how they share root state context and how this differs from BEM — see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Hooks
|
|
212
|
+
|
|
213
|
+
### useStyles
|
|
214
|
+
|
|
215
|
+
Generate a className from a style object:
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import { useStyles } from '@tenphi/tasty';
|
|
219
|
+
|
|
220
|
+
function MyComponent() {
|
|
221
|
+
const { className } = useStyles({
|
|
222
|
+
padding: '2x',
|
|
223
|
+
fill: '#surface',
|
|
224
|
+
radius: '1r',
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return <div className={className}>Styled content</div>;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### useGlobalStyles
|
|
232
|
+
|
|
233
|
+
Inject global styles for a CSS selector:
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { useGlobalStyles } from '@tenphi/tasty';
|
|
237
|
+
|
|
238
|
+
function ThemeStyles() {
|
|
239
|
+
useGlobalStyles('.card', {
|
|
240
|
+
padding: '4x',
|
|
241
|
+
fill: '#surface',
|
|
242
|
+
radius: '1r',
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### useRawCSS
|
|
250
|
+
|
|
251
|
+
Inject raw CSS strings:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { useRawCSS } from '@tenphi/tasty';
|
|
255
|
+
|
|
256
|
+
function GlobalReset() {
|
|
257
|
+
useRawCSS(`
|
|
258
|
+
body { margin: 0; padding: 0; }
|
|
259
|
+
`);
|
|
260
|
+
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### useMergeStyles
|
|
266
|
+
|
|
267
|
+
Merge multiple style objects for compound component prop forwarding:
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import { useMergeStyles } from '@tenphi/tasty';
|
|
271
|
+
|
|
272
|
+
function MyTabs({ styles, tabListStyles, prefixStyles }) {
|
|
273
|
+
const mergedStyles = useMergeStyles(styles, {
|
|
274
|
+
TabList: tabListStyles,
|
|
275
|
+
Prefix: prefixStyles,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
return <TabsElement styles={mergedStyles} />;
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Learn more
|
|
285
|
+
|
|
286
|
+
- **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
|
|
287
|
+
- **[Methodology](methodology.md)** — Recommended patterns: root + sub-elements, styleProps, tokens, wrapping
|
|
288
|
+
- **[Configuration](configuration.md)** — Tokens, recipes, custom units, style handlers, TypeScript extensions
|
|
289
|
+
- **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
|
|
290
|
+
- **[Zero Runtime (tastyStatic)](tasty-static.md)** — Build-time static styling with Babel plugin
|
|
291
|
+
- **[Server-Side Rendering](ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks
|
package/docs/ssr.md
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Tasty supports server-side rendering with zero-cost client hydration. Your existing `tasty()` components work unchanged -- SSR is opt-in and requires no per-component modifications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
| Dependency | Version | Required for |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `react` | >= 18 | All SSR entry points (peer dependency of `@tenphi/tasty`) |
|
|
12
|
+
| `next` | >= 13 | Next.js integration (`@tenphi/tasty/ssr/next`) — App Router with `useServerInsertedHTML` |
|
|
13
|
+
| Node.js | >= 20 | Generic / streaming SSR (`@tenphi/tasty/ssr`) — uses `node:async_hooks` for `AsyncLocalStorage` |
|
|
14
|
+
|
|
15
|
+
The Astro integration (`@tenphi/tasty/ssr/astro`) has no additional dependencies beyond `react`.
|
|
6
16
|
|
|
7
17
|
---
|
|
8
18
|
|
package/docs/styles.md
CHANGED
|
@@ -344,7 +344,7 @@ Box shadow. Supports multiple shadows comma-separated.
|
|
|
344
344
|
|
|
345
345
|
| Value | Effect |
|
|
346
346
|
|-------|--------|
|
|
347
|
-
| `true` | Default shadow (
|
|
347
|
+
| `true` | Default shadow (uses `var(--shadow)` — define a `$shadow` token in your design system) |
|
|
348
348
|
| `"1x .5x .5x #dark.50"` | Custom shadow with Tasty units/colors |
|
|
349
349
|
| `"0 1x 2x #dark.20"` | Standard shadow |
|
|
350
350
|
| `"inset 0 1x 2x #dark.10"` | Inset shadow |
|
|
@@ -511,7 +511,7 @@ Scrollbar styling using CSS standard properties (`scrollbar-width`, `scrollbar-c
|
|
|
511
511
|
|
|
512
512
|
**Colors:** Up to 2 color values for thumb and track (optional), applied via `scrollbar-color`.
|
|
513
513
|
|
|
514
|
-
**Defaults:** When no colors are specified, the thumb color comes from
|
|
514
|
+
**Defaults:** When no colors are specified, the thumb color comes from `var(--scrollbar-thumb-color)` and the track color from `var(--scrollbar-track-color, transparent)`. These are not built-in — your design system should define `#scrollbar-thumb` and `#scrollbar-track` tokens (e.g. `'#text.5'` and `'#dark-bg'`). If neither token is defined, the track falls back to `transparent` via a CSS fallback, while the thumb has no CSS-level fallback — the browser treats the entire `scrollbar-color` declaration as invalid and reverts to the platform-default scrollbar appearance.
|
|
515
515
|
|
|
516
516
|
**Note:** `none` takes precedence over all other modifiers and colors. Combining `none` with other tokens (e.g., `"none always #red"`) produces a warning, and only `scrollbar-width: none` is applied.
|
|
517
517
|
|
package/docs/tasty-static.md
CHANGED
|
@@ -11,9 +11,30 @@
|
|
|
11
11
|
- **Performance-critical pages** — Zero runtime overhead for styling
|
|
12
12
|
- **Landing pages** — Minimal bundle size with pre-generated CSS
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
The zero-runtime mode is part of the main `@tenphi/tasty` package but requires additional peer dependencies depending on your setup:
|
|
17
|
+
|
|
18
|
+
| Dependency | Version | Required for |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
|
|
21
|
+
| `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
|
|
22
|
+
| `@babel/types` | >= 7.24 | Babel plugin |
|
|
23
|
+
| `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/next`) when using `configFile` option |
|
|
24
|
+
|
|
25
|
+
All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# For any Babel-based setup (Vite, custom Babel config, etc.)
|
|
29
|
+
pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types
|
|
15
30
|
|
|
16
|
-
|
|
31
|
+
# For Next.js with TypeScript config file
|
|
32
|
+
pnpm add -D @babel/core @babel/helper-plugin-utils @babel/types jiti
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
17
38
|
|
|
18
39
|
### Basic Usage
|
|
19
40
|
|
|
@@ -372,5 +393,6 @@ const card = tastyStatic({
|
|
|
372
393
|
|
|
373
394
|
## Related
|
|
374
395
|
|
|
375
|
-
- [
|
|
396
|
+
- [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
|
|
397
|
+
- [Runtime API](runtime.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, hooks
|
|
376
398
|
- [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -92,7 +92,8 @@
|
|
|
92
92
|
"@babel/core": "^7.24.0",
|
|
93
93
|
"@babel/helper-plugin-utils": "^7.24.0",
|
|
94
94
|
"@babel/types": "^7.24.0",
|
|
95
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
95
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
96
|
+
"jiti": "^2.6.1"
|
|
96
97
|
},
|
|
97
98
|
"peerDependenciesMeta": {
|
|
98
99
|
"@babel/core": {
|
|
@@ -106,11 +107,13 @@
|
|
|
106
107
|
},
|
|
107
108
|
"react": {
|
|
108
109
|
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"jiti": {
|
|
112
|
+
"optional": true
|
|
109
113
|
}
|
|
110
114
|
},
|
|
111
115
|
"dependencies": {
|
|
112
|
-
"csstype": "^3.1.0"
|
|
113
|
-
"jiti": "^2.6.1"
|
|
116
|
+
"csstype": "^3.1.0"
|
|
114
117
|
},
|
|
115
118
|
"devDependencies": {
|
|
116
119
|
"@babel/core": "^7.24.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/tokens/typography.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Typography preset configuration.
|
|
4
|
-
* Each preset defines font properties that get expanded into CSS custom properties.
|
|
5
|
-
*/
|
|
6
|
-
interface TypographyPreset {
|
|
7
|
-
fontSize: string;
|
|
8
|
-
lineHeight: string;
|
|
9
|
-
letterSpacing?: string;
|
|
10
|
-
fontWeight: string | number;
|
|
11
|
-
boldFontWeight?: string | number;
|
|
12
|
-
iconSize?: string;
|
|
13
|
-
textTransform?: string;
|
|
14
|
-
fontFamily?: string;
|
|
15
|
-
fontStyle?: string;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { TypographyPreset };
|
|
19
|
-
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
//#region src/tokens/typography.ts
|
|
2
|
-
/**
|
|
3
|
-
* Typography presets for headings, text, and special styles.
|
|
4
|
-
*
|
|
5
|
-
* Naming conventions:
|
|
6
|
-
* - `h1`-`h6`: Headings (bold by default)
|
|
7
|
-
* - `t1`-`t4`: Text styles (regular weight)
|
|
8
|
-
* - `t1m`-`t4m`: Text styles medium weight
|
|
9
|
-
* - `m1`-`m3`: Markdown/prose styles (larger line-height)
|
|
10
|
-
* - `p1`-`p4`: Paragraph styles
|
|
11
|
-
* - `c1`-`c2`: Caption/uppercase styles
|
|
12
|
-
* - `tag`: Tag/badge typography
|
|
13
|
-
* - `strong`, `em`: Inline semantic styles
|
|
14
|
-
* - `default`: Base text style
|
|
15
|
-
*/
|
|
16
|
-
const TYPOGRAPHY_PRESETS = {
|
|
17
|
-
text: {
|
|
18
|
-
fontSize: "14px",
|
|
19
|
-
lineHeight: "20px",
|
|
20
|
-
letterSpacing: "0",
|
|
21
|
-
fontWeight: "400"
|
|
22
|
-
},
|
|
23
|
-
h1: {
|
|
24
|
-
fontSize: "36px",
|
|
25
|
-
lineHeight: "44px",
|
|
26
|
-
letterSpacing: "-0.01em",
|
|
27
|
-
fontWeight: "600",
|
|
28
|
-
boldFontWeight: "700",
|
|
29
|
-
iconSize: "40px"
|
|
30
|
-
},
|
|
31
|
-
h2: {
|
|
32
|
-
fontSize: "24px",
|
|
33
|
-
lineHeight: "32px",
|
|
34
|
-
letterSpacing: "0em",
|
|
35
|
-
fontWeight: "600",
|
|
36
|
-
boldFontWeight: "700",
|
|
37
|
-
iconSize: "28px"
|
|
38
|
-
},
|
|
39
|
-
h3: {
|
|
40
|
-
fontSize: "20px",
|
|
41
|
-
lineHeight: "28px",
|
|
42
|
-
letterSpacing: "0em",
|
|
43
|
-
fontWeight: "600",
|
|
44
|
-
boldFontWeight: "700",
|
|
45
|
-
iconSize: "24px"
|
|
46
|
-
},
|
|
47
|
-
h4: {
|
|
48
|
-
fontSize: "18px",
|
|
49
|
-
lineHeight: "24px",
|
|
50
|
-
letterSpacing: "0",
|
|
51
|
-
fontWeight: "600",
|
|
52
|
-
boldFontWeight: "700",
|
|
53
|
-
iconSize: "22px"
|
|
54
|
-
},
|
|
55
|
-
h5: {
|
|
56
|
-
fontSize: "16px",
|
|
57
|
-
lineHeight: "22px",
|
|
58
|
-
letterSpacing: "0",
|
|
59
|
-
fontWeight: "600",
|
|
60
|
-
boldFontWeight: "700",
|
|
61
|
-
iconSize: "20px"
|
|
62
|
-
},
|
|
63
|
-
h6: {
|
|
64
|
-
fontSize: "14px",
|
|
65
|
-
lineHeight: "20px",
|
|
66
|
-
letterSpacing: "0.01em",
|
|
67
|
-
fontWeight: "600",
|
|
68
|
-
boldFontWeight: "700",
|
|
69
|
-
iconSize: "20px"
|
|
70
|
-
},
|
|
71
|
-
t1: {
|
|
72
|
-
fontSize: "18px",
|
|
73
|
-
lineHeight: "24px",
|
|
74
|
-
letterSpacing: "0",
|
|
75
|
-
fontWeight: "400",
|
|
76
|
-
boldFontWeight: "600",
|
|
77
|
-
iconSize: "20px"
|
|
78
|
-
},
|
|
79
|
-
t2: {
|
|
80
|
-
fontSize: "16px",
|
|
81
|
-
lineHeight: "22px",
|
|
82
|
-
letterSpacing: "0",
|
|
83
|
-
fontWeight: "400",
|
|
84
|
-
boldFontWeight: "600",
|
|
85
|
-
iconSize: "20px"
|
|
86
|
-
},
|
|
87
|
-
t2m: {
|
|
88
|
-
fontSize: "16px",
|
|
89
|
-
lineHeight: "22px",
|
|
90
|
-
letterSpacing: "0",
|
|
91
|
-
fontWeight: "500",
|
|
92
|
-
boldFontWeight: "600",
|
|
93
|
-
iconSize: "20px"
|
|
94
|
-
},
|
|
95
|
-
t3: {
|
|
96
|
-
fontSize: "14px",
|
|
97
|
-
lineHeight: "20px",
|
|
98
|
-
letterSpacing: "0",
|
|
99
|
-
fontWeight: "400",
|
|
100
|
-
boldFontWeight: "600",
|
|
101
|
-
iconSize: "18px"
|
|
102
|
-
},
|
|
103
|
-
t3m: {
|
|
104
|
-
fontSize: "14px",
|
|
105
|
-
lineHeight: "20px",
|
|
106
|
-
letterSpacing: "0",
|
|
107
|
-
fontWeight: "500",
|
|
108
|
-
boldFontWeight: "600",
|
|
109
|
-
iconSize: "18px"
|
|
110
|
-
},
|
|
111
|
-
t4: {
|
|
112
|
-
fontSize: "12px",
|
|
113
|
-
lineHeight: "18px",
|
|
114
|
-
letterSpacing: "0",
|
|
115
|
-
fontWeight: "500",
|
|
116
|
-
boldFontWeight: "600",
|
|
117
|
-
iconSize: "16px"
|
|
118
|
-
},
|
|
119
|
-
t4m: {
|
|
120
|
-
fontSize: "12px",
|
|
121
|
-
lineHeight: "18px",
|
|
122
|
-
letterSpacing: "0",
|
|
123
|
-
fontWeight: "600",
|
|
124
|
-
boldFontWeight: "700",
|
|
125
|
-
iconSize: "16px"
|
|
126
|
-
},
|
|
127
|
-
m1: {
|
|
128
|
-
fontSize: "18px",
|
|
129
|
-
lineHeight: "32px",
|
|
130
|
-
letterSpacing: "0",
|
|
131
|
-
fontWeight: "400",
|
|
132
|
-
boldFontWeight: "600",
|
|
133
|
-
iconSize: "22px"
|
|
134
|
-
},
|
|
135
|
-
m2: {
|
|
136
|
-
fontSize: "16px",
|
|
137
|
-
lineHeight: "28px",
|
|
138
|
-
letterSpacing: "0",
|
|
139
|
-
fontWeight: "400",
|
|
140
|
-
boldFontWeight: "600",
|
|
141
|
-
iconSize: "20px"
|
|
142
|
-
},
|
|
143
|
-
m3: {
|
|
144
|
-
fontSize: "14px",
|
|
145
|
-
lineHeight: "24px",
|
|
146
|
-
letterSpacing: "0",
|
|
147
|
-
fontWeight: "400",
|
|
148
|
-
boldFontWeight: "600",
|
|
149
|
-
iconSize: "20px"
|
|
150
|
-
},
|
|
151
|
-
p1: {
|
|
152
|
-
fontSize: "18px",
|
|
153
|
-
lineHeight: "28px",
|
|
154
|
-
letterSpacing: "0",
|
|
155
|
-
fontWeight: "400",
|
|
156
|
-
boldFontWeight: "600",
|
|
157
|
-
iconSize: "22px"
|
|
158
|
-
},
|
|
159
|
-
p2: {
|
|
160
|
-
fontSize: "16px",
|
|
161
|
-
lineHeight: "24px",
|
|
162
|
-
letterSpacing: "0",
|
|
163
|
-
fontWeight: "400",
|
|
164
|
-
boldFontWeight: "600",
|
|
165
|
-
iconSize: "20px"
|
|
166
|
-
},
|
|
167
|
-
p3: {
|
|
168
|
-
fontSize: "14px",
|
|
169
|
-
lineHeight: "22px",
|
|
170
|
-
letterSpacing: "0",
|
|
171
|
-
fontWeight: "400",
|
|
172
|
-
boldFontWeight: "600",
|
|
173
|
-
iconSize: "18px"
|
|
174
|
-
},
|
|
175
|
-
p4: {
|
|
176
|
-
fontSize: "12px",
|
|
177
|
-
lineHeight: "20px",
|
|
178
|
-
letterSpacing: "0",
|
|
179
|
-
fontWeight: "500",
|
|
180
|
-
boldFontWeight: "600",
|
|
181
|
-
iconSize: "16px"
|
|
182
|
-
},
|
|
183
|
-
c1: {
|
|
184
|
-
fontSize: "14px",
|
|
185
|
-
lineHeight: "20px",
|
|
186
|
-
letterSpacing: "0",
|
|
187
|
-
fontWeight: "600",
|
|
188
|
-
boldFontWeight: "700",
|
|
189
|
-
textTransform: "uppercase",
|
|
190
|
-
iconSize: "18px"
|
|
191
|
-
},
|
|
192
|
-
c2: {
|
|
193
|
-
fontSize: "12px",
|
|
194
|
-
lineHeight: "18px",
|
|
195
|
-
letterSpacing: "0.01em",
|
|
196
|
-
fontWeight: "600",
|
|
197
|
-
boldFontWeight: "700",
|
|
198
|
-
textTransform: "uppercase",
|
|
199
|
-
iconSize: "16px"
|
|
200
|
-
},
|
|
201
|
-
tag: {
|
|
202
|
-
fontSize: "12px",
|
|
203
|
-
lineHeight: "18px",
|
|
204
|
-
letterSpacing: "0.01em",
|
|
205
|
-
fontWeight: "600",
|
|
206
|
-
boldFontWeight: "700",
|
|
207
|
-
iconSize: "16px"
|
|
208
|
-
},
|
|
209
|
-
strong: {
|
|
210
|
-
fontSize: "inherit",
|
|
211
|
-
lineHeight: "inherit",
|
|
212
|
-
letterSpacing: "inherit",
|
|
213
|
-
fontFamily: "inherit",
|
|
214
|
-
fontStyle: "inherit",
|
|
215
|
-
fontWeight: "var(--bold-font-weight, var(--default-bold-font-weight, 600))"
|
|
216
|
-
},
|
|
217
|
-
em: {
|
|
218
|
-
fontSize: "inherit",
|
|
219
|
-
lineHeight: "inherit",
|
|
220
|
-
letterSpacing: "inherit",
|
|
221
|
-
fontFamily: "inherit",
|
|
222
|
-
fontStyle: "italic",
|
|
223
|
-
fontWeight: "inherit"
|
|
224
|
-
},
|
|
225
|
-
default: {
|
|
226
|
-
fontSize: "var(--t3-font-size)",
|
|
227
|
-
lineHeight: "var(--t3-line-height)",
|
|
228
|
-
letterSpacing: "var(--t3-letter-spacing)",
|
|
229
|
-
fontWeight: "var(--t3-font-weight)",
|
|
230
|
-
boldFontWeight: "600",
|
|
231
|
-
iconSize: "inherit"
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
//#endregion
|
|
236
|
-
export { TYPOGRAPHY_PRESETS };
|
|
237
|
-
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typography.js","names":[],"sources":["../../src/tokens/typography.ts"],"sourcesContent":["/**\n * Typography preset configuration.\n * Each preset defines font properties that get expanded into CSS custom properties.\n */\nexport interface TypographyPreset {\n fontSize: string;\n lineHeight: string;\n letterSpacing?: string;\n fontWeight: string | number;\n boldFontWeight?: string | number;\n iconSize?: string;\n textTransform?: string;\n fontFamily?: string;\n fontStyle?: string;\n}\n\n/**\n * Typography presets for headings, text, and special styles.\n *\n * Naming conventions:\n * - `h1`-`h6`: Headings (bold by default)\n * - `t1`-`t4`: Text styles (regular weight)\n * - `t1m`-`t4m`: Text styles medium weight\n * - `m1`-`m3`: Markdown/prose styles (larger line-height)\n * - `p1`-`p4`: Paragraph styles\n * - `c1`-`c2`: Caption/uppercase styles\n * - `tag`: Tag/badge typography\n * - `strong`, `em`: Inline semantic styles\n * - `default`: Base text style\n */\nexport const TYPOGRAPHY_PRESETS: Record<string, TypographyPreset> = {\n // Text (basic)\n text: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '400',\n },\n\n // Headings (h1-h6)\n h1: {\n fontSize: '36px',\n lineHeight: '44px',\n letterSpacing: '-0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '40px',\n },\n h2: {\n fontSize: '24px',\n lineHeight: '32px',\n letterSpacing: '0em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '28px',\n },\n h3: {\n fontSize: '20px',\n lineHeight: '28px',\n letterSpacing: '0em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '24px',\n },\n h4: {\n fontSize: '18px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '22px',\n },\n h5: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '20px',\n },\n h6: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '20px',\n },\n\n // Text styles (t1-t4)\n t1: {\n fontSize: '18px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t2: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t2m: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t3: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n t3m: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n t4: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '16px',\n },\n t4m: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '16px',\n },\n\n // Markdown/prose styles (m1-m3)\n m1: {\n fontSize: '18px',\n lineHeight: '32px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '22px',\n },\n m2: {\n fontSize: '16px',\n lineHeight: '28px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n m3: {\n fontSize: '14px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n\n // Paragraph styles (p1-p4)\n p1: {\n fontSize: '18px',\n lineHeight: '28px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '22px',\n },\n p2: {\n fontSize: '16px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n p3: {\n fontSize: '14px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n p4: {\n fontSize: '12px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '16px',\n },\n\n // Caption/uppercase styles (c1-c2)\n c1: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n textTransform: 'uppercase',\n iconSize: '18px',\n },\n c2: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n textTransform: 'uppercase',\n iconSize: '16px',\n },\n\n // Tag typography\n tag: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '16px',\n },\n\n // Inline semantic styles\n strong: {\n fontSize: 'inherit',\n lineHeight: 'inherit',\n letterSpacing: 'inherit',\n fontFamily: 'inherit',\n fontStyle: 'inherit',\n fontWeight: 'var(--bold-font-weight, var(--default-bold-font-weight, 600))',\n },\n em: {\n fontSize: 'inherit',\n lineHeight: 'inherit',\n letterSpacing: 'inherit',\n fontFamily: 'inherit',\n fontStyle: 'italic',\n fontWeight: 'inherit',\n },\n\n // Default text style (references t3)\n default: {\n fontSize: 'var(--t3-font-size)',\n lineHeight: 'var(--t3-line-height)',\n letterSpacing: 'var(--t3-letter-spacing)',\n fontWeight: 'var(--t3-font-weight)',\n boldFontWeight: '600',\n iconSize: 'inherit',\n },\n};\n"],"mappings":"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"}
|