@clay-design-system/tokens 0.0.0-stage → 0.12.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 +126 -2
- package/dist/TOKEN_REFERENCE.md +1810 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/mq.d.ts +17 -0
- package/dist/mq.js +18 -0
- package/dist/tokens.css +1144 -0
- package/dist/tokens.d.ts +1128 -0
- package/dist/tokens.js +1152 -0
- package/dist/tokens.resolved.css +1144 -0
- package/package.json +37 -3
- package/stylelint-plugin/allowed-breakpoints.js +75 -0
- package/stylelint-plugin/no-foundation-tokens.js +69 -0
- package/stylelint-plugin/no-literal-values.js +178 -0
- package/stylelint-plugin/reduced-motion.js +57 -0
- package/stylelint-plugin/require-layer.js +66 -0
package/README.md
CHANGED
|
@@ -1,3 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @clay-design-system/tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Design tokens for the Clay design system, compiled from DTCG JSON sources using Style Dictionary 4.
|
|
4
|
+
|
|
5
|
+
## Tier system
|
|
6
|
+
|
|
7
|
+
Tokens are organized in a layered hierarchy:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Foundation (base primitives — colors, type, spacing, radius, effects)
|
|
11
|
+
↓ referenced by
|
|
12
|
+
Semantic (purpose-driven tokens — background, text, border, icon, size, motion)
|
|
13
|
+
↓ referenced by
|
|
14
|
+
Web / Platform / Marketing (tier-specific tokens — typography scales, component tokens)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Components consume semantic or tier-specific tokens. The one raw primitive components may use is the brand palette (`--clay-foundation-brand-color-*`); the stylelint rule below blocks the retired colour names. Prefer semantic radius/spacing over raw `--clay-foundation-radius/spacing-*` (guideline, not lint-enforced).
|
|
18
|
+
|
|
19
|
+
## Source structure
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
src/
|
|
23
|
+
├── foundation/ Foundation primitives
|
|
24
|
+
│ ├── colors.json Brand color palette → --clay-foundation-brand-color-* — exact Figma "Mode 1" stops (grey, yellow, lime, stone, harvest, orange, magenta, pink, iris, purple, blue, teal, green)
|
|
25
|
+
│ ├── typography.json Font families, weights, size scale
|
|
26
|
+
│ ├── spacing.json 18-step spacing scale (0-180)
|
|
27
|
+
│ ├── radius.json 10 radius values (none → full)
|
|
28
|
+
│ ├── effects.json Shadow + blur primitives
|
|
29
|
+
│ ├── stroke.json Border width + color
|
|
30
|
+
│ └── customer-logos.json Logo surface colors
|
|
31
|
+
├── semantic/ Purpose-driven tokens
|
|
32
|
+
│ ├── color-primitives.json Neutrals, greys, brand palette aliases
|
|
33
|
+
│ ├── brand.json Product colors (monday, wm, crm, dev, svc)
|
|
34
|
+
│ ├── text.json 7 text color variants
|
|
35
|
+
│ ├── icon.json 7 icon color variants
|
|
36
|
+
│ ├── background.json 8 background variants + utilities
|
|
37
|
+
│ ├── border.json 9 border color variants
|
|
38
|
+
│ ├── size.json Space scale, icon sizes, depth
|
|
39
|
+
│ ├── radius.json Layout/card radius scale + aliases
|
|
40
|
+
│ ├── layout.json Container, grid, section, header, footer
|
|
41
|
+
│ ├── effects.json Shadows, glass, device-frame
|
|
42
|
+
│ ├── motion.json Duration, easing, transitions
|
|
43
|
+
│ └── breakpoints.json Responsive breakpoints
|
|
44
|
+
├── web/ Web tier (marketing surfaces)
|
|
45
|
+
│ ├── typography.json 40 text styles (desktop + mobile)
|
|
46
|
+
│ ├── button.json Button: 4 sizes × 4 styles × 4 colors
|
|
47
|
+
│ ├── card.json Card: container, image, size scale
|
|
48
|
+
│ ├── input.json Input: colors, sizes, states
|
|
49
|
+
│ ├── toggle.json Toggle: track, thumb
|
|
50
|
+
│ ├── checkbox.json Checkbox: control, group, square
|
|
51
|
+
│ ├── tag.json Tag: background + dot variants
|
|
52
|
+
│ ├── tabs.json Tabs: triggers, panels, shells
|
|
53
|
+
│ └── slider.json Slider: dots + arrows
|
|
54
|
+
├── platform/ Platform tier (product UI)
|
|
55
|
+
│ └── typography.json 11 text styles (headlines, labels, captions)
|
|
56
|
+
├── marketing/ Marketing tier (campaigns)
|
|
57
|
+
│ └── customer-logos.json Logo height + surface colors
|
|
58
|
+
└── email/ Email tier (read by @clay-design-system/email at build time)
|
|
59
|
+
└── typography.json Lifecycle email type scale
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Output
|
|
63
|
+
|
|
64
|
+
`pnpm --filter @clay-design-system/tokens build` (`src/build.ts`) writes:
|
|
65
|
+
|
|
66
|
+
- `dist/tokens.css` (`@clay-design-system/tokens/css`) — every tier as CSS custom properties on `:root`; aliases stay `var()` so changes cascade
|
|
67
|
+
- `dist/tokens.resolved.css` (`@clay-design-system/tokens/css-resolved`) — the same with literal values
|
|
68
|
+
- `dist/tokens.js` + `.d.ts` (`@clay-design-system/tokens`) — JS constants (used by `@clay-design-system/email`)
|
|
69
|
+
- `dist/mq.js` (`@clay-design-system/tokens/mq`) — `mq` / `breakpoints` media-query helpers
|
|
70
|
+
- `dist/TOKEN_REFERENCE.md` — a generated listing of every token
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
// In your app entry point:
|
|
76
|
+
import '@clay-design-system/tokens/css'
|
|
77
|
+
|
|
78
|
+
// In component CSS:
|
|
79
|
+
.card {
|
|
80
|
+
border-radius: calc(var(--clay-card-radius-value) * 1px);
|
|
81
|
+
padding: calc(var(--clay-card-padding-value) * 1px);
|
|
82
|
+
background: var(--clay-card-background);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Naming convention
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
--clay-{tier?}-{category}-{variant?}-{property}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- **Foundation**: `--clay-foundation-brand-color-iris-300`, `--clay-foundation-type-weight-medium`
|
|
93
|
+
- **Semantic**: `--clay-color-background-brand-default`, `--clay-size-space-400`, `--clay-motion-duration-fast`
|
|
94
|
+
- **Web**: `--clay-web-type-large-desktop-size`, `--clay-btn-primary-black-bg`
|
|
95
|
+
- **Platform**: `--clay-platform-type-headline-xl-600-size`
|
|
96
|
+
- **Component**: `--clay-card-radius`, `--clay-input-border-color`, `--clay-tabs-trigger-font-size`
|
|
97
|
+
|
|
98
|
+
## Adding or modifying tokens
|
|
99
|
+
|
|
100
|
+
1. Edit or create a `.json` file in `src/{tier}/`
|
|
101
|
+
2. Use DTCG format: `{ "$value": ..., "$type": "..." }`
|
|
102
|
+
3. Reference other tokens with `{clay.path.to.token}` syntax
|
|
103
|
+
4. Run `pnpm build` — verify `dist/tokens.css` updated
|
|
104
|
+
5. Check `dist/TOKEN_REFERENCE.md` for the generated output
|
|
105
|
+
|
|
106
|
+
## Enforcement
|
|
107
|
+
|
|
108
|
+
The stylelint plugin `@clay-design-system/tokens/stylelint-plugin/no-foundation-tokens.js` (run by `pnpm --filter @clay-design-system/react lint`) blocks the retired colour names — `--clay-foundation-color-*`, `--clay-web-color-*`, `--clay-brand-color-*`. It polices the colour layer only.
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"plugins": ["@clay-design-system/tokens/stylelint-plugin/no-foundation-tokens.js"],
|
|
113
|
+
"rules": { "clay-ds/no-foundation-tokens": true }
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Unitless values
|
|
118
|
+
|
|
119
|
+
Most numeric tokens are unitless. In CSS, multiply by `1px`:
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
padding: calc(var(--clay-size-space-400) * 1px); /* → 16px */
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This allows tokens to be used in calculations without unit conflicts.
|
|
126
|
+
|
|
127
|
+
Agent-facing token guide (heading tiers, naming, usage rules): `skills/web-design-brain/reference/TOKENS.md`.
|