@dataimago/tokens 0.1.0-alpha.1 → 0.1.0-alpha.12
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 +14 -3
- package/dist/index.cjs +97 -40
- package/dist/index.mjs +97 -40
- package/dist/tokens.css +182 -62
- package/dist/tokens.dtcg.json +706 -0
- package/dist/tokens.scss +182 -62
- package/dist/tokens.studio.json +565 -0
- package/dist/tokens.w3c.dtcg.json +689 -0
- package/package.json +5 -2
- package/src/README.md +40 -156
- package/src/colors.json +43 -17
- package/src/effects.json +16 -5
- package/src/theme-colors-p3.json +358 -0
- package/src/theme-colors.json +55 -29
- package/src/typography.json +26 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataimago/tokens",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
4
|
"description": "dataimago design tokens — canonical JSON sources plus generated TS/CSS artifacts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,10 @@
|
|
|
30
30
|
"./frequent": "./src/frequent.json",
|
|
31
31
|
"./components": "./src/components.json",
|
|
32
32
|
"./css": "./dist/tokens.css",
|
|
33
|
-
"./scss": "./dist/tokens.scss"
|
|
33
|
+
"./scss": "./dist/tokens.scss",
|
|
34
|
+
"./dtcg": "./dist/tokens.dtcg.json",
|
|
35
|
+
"./dtcg-w3c": "./dist/tokens.w3c.dtcg.json",
|
|
36
|
+
"./tokens-studio": "./dist/tokens.studio.json"
|
|
34
37
|
},
|
|
35
38
|
"files": [
|
|
36
39
|
"src",
|
package/src/README.md
CHANGED
|
@@ -1,175 +1,59 @@
|
|
|
1
|
-
# dataimago
|
|
2
|
-
|
|
3
|
-
## 🎯 Source of Truth Architecture
|
|
4
|
-
|
|
5
|
-
This directory contains the **authoritative source** for all design decisions across the dataimago ecosystem. These JSON-based tokens serve as the foundation for:
|
|
6
|
-
|
|
7
|
-
- **CSS Custom Properties**: Generated via idempotent build process
|
|
8
|
-
- **Theme Support**: Automatic light/dark mode generation
|
|
9
|
-
- **Consumer Integration**: Distributed to all consumer repositories via git submodules
|
|
10
|
-
- **Design Consistency**: Single definition → multiple output formats
|
|
11
|
-
|
|
12
|
-
## 🔄 Idempotent Token Processing
|
|
13
|
-
|
|
14
|
-
The token build system follows strict deterministic principles:
|
|
15
|
-
|
|
16
|
-
- **✅ Stable Output**: Same tokens → identical CSS every time
|
|
17
|
-
- **✅ No Timestamps**: Generated CSS excludes dynamic timestamps
|
|
18
|
-
- **✅ Version Controlled**: Only source tokens are committed, generated files are build artifacts
|
|
19
|
-
- **✅ Consumer Ready**: Generated assets integrate seamlessly into consumer repositories
|
|
20
|
-
|
|
21
|
-
## Overview
|
|
22
|
-
These tokens are processed into CSS custom properties that work across light and dark themes via our idempotent build system.
|
|
23
|
-
|
|
24
|
-
## Token Structure
|
|
25
|
-
|
|
26
|
-
### 🎨 **theme-colors.json** - Theme-Aware Colors
|
|
27
|
-
Your carefully tuned light/dark color scheme:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"color": {
|
|
32
|
-
"surface": {
|
|
33
|
-
"page": {
|
|
34
|
-
"light": "rgb(237, 237, 235)", // Your warm light gray
|
|
35
|
-
"dark": "rgb(20, 20, 16)" // Your warm dark background
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"content": {
|
|
39
|
-
"primary": {
|
|
40
|
-
"light": "rgb(20, 20, 16)", // Near Black text on light
|
|
41
|
-
"dark": "rgb(237, 237, 235)" // Near white on dark
|
|
42
|
-
},
|
|
43
|
-
"secondary": {
|
|
44
|
-
"light": "#7c7c7c", // Your tuned light gray
|
|
45
|
-
"dark": "#83838f" // Your tuned dark gray
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 🏃 **frequent.json** - High-Change Values
|
|
53
|
-
Most commonly adjusted in DevTools:
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"spacing": {
|
|
58
|
-
"component": {
|
|
59
|
-
"padding": "1rem", // Card/button internal spacing
|
|
60
|
-
"margin": "1.5rem", // Between-component spacing
|
|
61
|
-
"gap": "0.75rem" // Flex/grid gaps
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"contrast": {
|
|
65
|
-
"readable": "...", // Comfortable reading contrast
|
|
66
|
-
"medium": "...", // Secondary information
|
|
67
|
-
"subtle": "..." // De-emphasized text
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### 🎯 **effects.json** - Theme-Aware Effects
|
|
73
|
-
Shadows and borders that adapt to themes:
|
|
74
|
-
|
|
75
|
-
```json
|
|
76
|
-
{
|
|
77
|
-
"shadow": {
|
|
78
|
-
"subtle": {
|
|
79
|
-
"light": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
80
|
-
"dark": "0 1px 2px 0 rgb(255 255 255 / 0.03)"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"border": {
|
|
84
|
-
"subtle": {
|
|
85
|
-
"light": "rgba(0, 0, 0, 0.1)",
|
|
86
|
-
"dark": "rgba(255, 255, 255, 0.1)"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 🧩 **components.json** - Component References
|
|
93
|
-
Components reference semantic tokens:
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
{
|
|
97
|
-
"card": {
|
|
98
|
-
"background": "surface.elevated",
|
|
99
|
-
"padding": "spacing.component.padding",
|
|
100
|
-
"shadow": "shadow.moderate"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
```
|
|
1
|
+
# dataimago Token Source Guide
|
|
104
2
|
|
|
105
|
-
|
|
3
|
+
This directory is the source tree for `@dataimago/tokens`. The package build turns these JSON files into CSS variables, SCSS maps, typed JS modules, and an additive DTCG-style export.
|
|
106
4
|
|
|
107
|
-
|
|
5
|
+
## Distribution
|
|
108
6
|
|
|
109
|
-
|
|
110
|
-
|---------------------|--------------------|-----------------------------|
|
|
111
|
-
| Card padding too tight | `frequent.json` → `spacing.component.padding` | `--spacing-component-padding` |
|
|
112
|
-
| Text too light in dark | `theme-colors.json` → `content.secondary.dark` | `--color-content-secondary` |
|
|
113
|
-
| Button needs more emphasis | `theme-colors.json` → `interactive.primary` | `--color-interactive-primary` |
|
|
114
|
-
| Borders invisible | `effects.json` → `border.subtle.dark` | `--color-border-subtle` |
|
|
7
|
+
Consumers receive tokens through public npm packages, not a production git submodule:
|
|
115
8
|
|
|
116
|
-
|
|
9
|
+
- House identity: `@dataimago/tokens`, `@dataimago/css`, `@dataimago/ui`, `@dataimago/brand`
|
|
10
|
+
- Neutral identity: `@dataimago/tokens-neutral`, `@dataimago/css-neutral`
|
|
117
11
|
|
|
118
|
-
|
|
119
|
-
# 1. Edit token JSON file
|
|
120
|
-
edit ui/src/tokens/frequent.json
|
|
121
|
-
|
|
122
|
-
# 2. Quick rebuild
|
|
123
|
-
cd ui && npm run watch # Auto-rebuilds on save
|
|
12
|
+
The compatibility contract for this tightening iteration is strict: do not remove existing package names, package exports, token names, CSS custom properties, or required consumer import paths.
|
|
124
13
|
|
|
125
|
-
|
|
126
|
-
```
|
|
14
|
+
## Source Files
|
|
127
15
|
|
|
128
|
-
|
|
16
|
+
| File | Role | Emits CSS variables? | Schema-governed? |
|
|
17
|
+
|---|---|---:|---:|
|
|
18
|
+
| `colors.json` | Primitive color scales and functional colors | Yes | Yes |
|
|
19
|
+
| `theme-colors.json` | Semantic light/dark color roles | Yes | Yes |
|
|
20
|
+
| `typography.json` | Font families, sizes, weights, styles, features, line heights | Yes | Yes |
|
|
21
|
+
| `spacing.json` | Spacing, radius, and layout scale | Yes | Yes |
|
|
22
|
+
| `effects.json` | Theme-aware borders/shadows and motion tokens | Yes | Yes |
|
|
23
|
+
| `frequent.json` | High-change reference values and metadata clusters | No | No |
|
|
24
|
+
| `components.json` | Component-level aliases/reference manifest | No | No |
|
|
129
25
|
|
|
130
|
-
|
|
26
|
+
`frequent.json` and `components.json` are intentionally treated as metadata/reference manifests in the current alpha line. Do not assume they emit CSS or normalize them opportunistically; any migration to canonical token shape needs to preserve existing exports and CSS variables.
|
|
131
27
|
|
|
132
|
-
|
|
133
|
-
/* Theme-agnostic values */
|
|
134
|
-
:root {
|
|
135
|
-
--color-brand-dataimago-primary: #3498DB;
|
|
136
|
-
--spacing-component-padding: 1rem;
|
|
137
|
-
}
|
|
28
|
+
## Build Outputs
|
|
138
29
|
|
|
139
|
-
|
|
140
|
-
:root, [data-bs-theme="light"] {
|
|
141
|
-
--color-surface-page: rgb(237, 237, 235);
|
|
142
|
-
--color-content-primary: #000000;
|
|
143
|
-
}
|
|
30
|
+
Run from the repo root:
|
|
144
31
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
--color-surface-page: rgb(20, 20, 16);
|
|
148
|
-
--color-content-primary: rgb(237, 237, 235);
|
|
149
|
-
}
|
|
32
|
+
```bash
|
|
33
|
+
node packages/tokens/build.mjs
|
|
150
34
|
```
|
|
151
35
|
|
|
152
|
-
|
|
36
|
+
The build emits:
|
|
153
37
|
|
|
154
|
-
|
|
38
|
+
- `packages/tokens/dist/tokens.css`
|
|
39
|
+
- `packages/tokens/dist/tokens.scss`
|
|
40
|
+
- `packages/tokens/dist/index.mjs`
|
|
41
|
+
- `packages/tokens/dist/index.cjs`
|
|
42
|
+
- `packages/tokens/dist/index.d.ts`
|
|
43
|
+
- `packages/tokens/dist/tokens.dtcg.json`
|
|
155
44
|
|
|
156
|
-
|
|
157
|
-
- `--color-content-primary` = Color for content/primary emphasis
|
|
158
|
-
- `--spacing-component-padding` = Spacing for component/padding use
|
|
159
|
-
- `--shadow-moderate` = Shadow for moderate elevation
|
|
45
|
+
Run the compatibility check after token changes:
|
|
160
46
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- **Your colors preserved** = Light/dark values from your tuned SCSS files
|
|
165
|
-
- **DevTools friendly** = Easy to find the token you need to change
|
|
166
|
-
- **Automatic theming** = Components work in both themes without extra code
|
|
47
|
+
```bash
|
|
48
|
+
node tools/check-css-vars.mjs
|
|
49
|
+
```
|
|
167
50
|
|
|
168
|
-
|
|
51
|
+
The check compares generated CSS variable names against `packages/tokens/schema/css-vars.snapshot.json` and fails on removals. Additive variables are allowed.
|
|
169
52
|
|
|
170
|
-
|
|
171
|
-
- **New tokens** complement existing system
|
|
172
|
-
- **Backward compatible** = Old CSS still works during transition
|
|
173
|
-
- **Build system** automatically distributes to all channels
|
|
53
|
+
## Editing Rules
|
|
174
54
|
|
|
175
|
-
|
|
55
|
+
- Use canonical leaf shapes in CSS-emitting files: `{ "value": "..." }` or `{ "light": "...", "dark": "..." }`.
|
|
56
|
+
- Use `_invariant` or another underscore-prefixed metadata key for group-level notes.
|
|
57
|
+
- Never add a group-level `description` beside string-valued children in CSS-emitting files; that is the historical walker-bailout bug pattern.
|
|
58
|
+
- Prefer semantic roles over primitive palette references in consumers.
|
|
59
|
+
- Record threshold or role changes in `wiki/log.md`, and add or amend an ADR when the change alters durable design intent.
|
package/src/colors.json
CHANGED
|
@@ -13,37 +13,63 @@
|
|
|
13
13
|
"800": { "value": "#1c1917", "description": "Ink scale — surfaces in dark mode" },
|
|
14
14
|
"900": { "value": "#0c0a09", "description": "Ink scale — near-black; primary dark surface and text color" }
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
"50": { "value": "#
|
|
18
|
-
"100": { "value": "#
|
|
19
|
-
"200": { "value": "#
|
|
20
|
-
"300": { "value": "#
|
|
21
|
-
"400": { "value": "#
|
|
22
|
-
"500": { "value": "#
|
|
16
|
+
"stone": {
|
|
17
|
+
"50": { "value": "#f7f7f6", "description": "Stone scale — lightest cool-neutral surface; cards/modals one step above page" },
|
|
18
|
+
"100": { "value": "#ededeb", "description": "Stone scale — canonical page background (light mode); matches Paper_1 presentation surface" },
|
|
19
|
+
"200": { "value": "#dcdcda", "description": "Stone scale — borders, dividers; matches presentation-theme.scss --color-border" },
|
|
20
|
+
"300": { "value": "#c1c1bf", "description": "Stone scale — pressed border / disabled chrome" },
|
|
21
|
+
"400": { "value": "#a0a0a0", "description": "Stone scale — disabled text, muted icons" },
|
|
22
|
+
"500": { "value": "#7c7c7c", "description": "Stone scale — secondary text; matches presentation-theme.scss --color-secondary" },
|
|
23
|
+
"600": { "value": "#5e5e5c", "description": "Stone scale — caption / metadata text on light surfaces" },
|
|
24
|
+
"700": { "value": "#424240", "description": "Stone scale — primary text on cream/paper surfaces" },
|
|
25
|
+
"800": { "value": "#292927", "description": "Stone scale — high-contrast headings on light surfaces" },
|
|
26
|
+
"900": { "value": "#14140f", "description": "Stone scale — body text on light surfaces; matches presentation-theme.scss $body-color rgb(20,20,16)" }
|
|
27
|
+
},
|
|
28
|
+
"forest": {
|
|
29
|
+
"50": { "value": "#f0f1ed", "description": "Forest scale — pale wash; subtle backdrop for forest-coded panels" },
|
|
30
|
+
"100": { "value": "#dde0d4", "description": "Forest scale — light hover-background tint for ghost buttons on light surfaces" },
|
|
31
|
+
"200": { "value": "#bdc4ad", "description": "Forest scale — soft accent panels" },
|
|
32
|
+
"300": { "value": "#98a384", "description": "Forest scale — interactive primary (dark mode); lighter for visibility on dark surfaces" },
|
|
33
|
+
"400": { "value": "#7e8a6b", "description": "Forest scale — interactive hover (dark mode); steps toward canonical" },
|
|
34
|
+
"500": { "value": "#5e6749", "description": "Forest scale — mid-step; charts and decorative emphasis" },
|
|
35
|
+
"600": { "value": "#4d5640", "description": "Forest scale — between mid and canonical" },
|
|
36
|
+
"700": { "value": "#434739", "description": "Forest scale — canonical interactive primary (light mode); 7.75:1 on stone-100, white text 9.0:1 — passes WCAG AAA" },
|
|
37
|
+
"800": { "value": "#363a2e", "description": "Forest scale — interactive hover (light mode); slightly darker than canonical" },
|
|
38
|
+
"900": { "value": "#1f2218", "description": "Forest scale — pressed/active state and deep emphasis" }
|
|
39
|
+
},
|
|
40
|
+
"paper": {
|
|
41
|
+
"50": { "value": "#fefdfb", "description": "Paper scale — lightest warm surface; renamed from cream — reserved for elevated cards/modals when warm tint is desired" },
|
|
42
|
+
"100": { "value": "#fdf9f2", "description": "Paper scale — warm page-background option (legacy cream-100); not the primary surface in this iteration" },
|
|
43
|
+
"200": { "value": "#faf2e3", "description": "Paper scale — code-block and pull-quote background; warm tint reads as 'paper'" },
|
|
44
|
+
"300": { "value": "#f5e8cf", "description": "Paper scale — call-out / emphasised panel background" },
|
|
45
|
+
"400": { "value": "#edd9b3", "description": "Paper scale — muted warm accent" },
|
|
46
|
+
"500": { "value": "#e0c088", "description": "Paper scale — strong warm accent; wheat" }
|
|
23
47
|
},
|
|
24
48
|
"copper": {
|
|
25
49
|
"50": { "value": "#fdf4ee", "description": "Copper scale — warm tint wash" },
|
|
26
50
|
"100": { "value": "#fbe5d1", "description": "Copper scale — soft copper backdrop" },
|
|
27
51
|
"200": { "value": "#f6c79c", "description": "Copper scale — muted copper accent" },
|
|
28
|
-
"300": { "value": "#f0a467", "description": "Copper scale — interactive primary on dark mode" },
|
|
29
|
-
"400": { "value": "#ea8441", "description": "Copper scale — hover on dark mode" },
|
|
30
|
-
"500": { "value": "#d46820", "description": "Copper scale —
|
|
31
|
-
"600": { "value": "#b55017", "description": "Copper scale — hover on light mode" },
|
|
52
|
+
"300": { "value": "#f0a467", "description": "Copper scale — historical interactive primary on dark mode (now superseded by forest)" },
|
|
53
|
+
"400": { "value": "#ea8441", "description": "Copper scale — historical hover on dark mode" },
|
|
54
|
+
"500": { "value": "#d46820", "description": "Copper scale — historical interactive primary (light mode); kept for callouts and chart accents" },
|
|
55
|
+
"600": { "value": "#b55017", "description": "Copper scale — historical hover on light mode" },
|
|
32
56
|
"700": { "value": "#913d15", "description": "Copper scale — active/pressed state" },
|
|
33
57
|
"800": { "value": "#753318", "description": "Copper scale — on dark surfaces" },
|
|
34
58
|
"900": { "value": "#612b16", "description": "Copper scale — deep foundation" }
|
|
35
59
|
},
|
|
36
60
|
"accent": {
|
|
37
|
-
"50": { "value": "#
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
61
|
+
"50": { "value": "#f0f8fc", "description": "Accent scale — pale wash for accent-tinted backgrounds (iteration-2; was #fdf2f2 emancipation-coded panels in iteration-1)" },
|
|
62
|
+
"300": { "value": "#3498DB", "description": "Accent scale — dark-mode canonical (5.41:1 on stone-900, AA). Sourced from presentation-blue-500 — Flat-UI peter-river. Iteration-2 introduces this stop to enable mode-aware role mapping; see wiki/decisions/iteration-2-blue-accent.md." },
|
|
63
|
+
"400": { "value": "#2980B9", "description": "Accent scale — dark-mode hover/emphasized variant (sourced from presentation-blue-600 — Flat-UI belize-hole)" },
|
|
64
|
+
"500": { "value": "#1f618d", "description": "Accent scale — light-mode canonical (5.68:1 on stone-100, AA; 6.66:1 white-on-color, AA). Sourced from presentation-blue-700. Iteration-2 sky-blue moral-weight; supersedes iteration-1's #b54a27 emancipation-copper-red. The scale-name is preserved (consumer-side text-accent-500 keeps working with the same mental model); only the value moved." },
|
|
65
|
+
"600": { "value": "#154d6f", "description": "Accent scale — light-mode hover (HSL-interpolated from accent-500: H≈205°, S+4, L−6)" },
|
|
66
|
+
"700": { "value": "#0f3a52", "description": "Accent scale — light-mode pressed/active (HSL-interpolated from accent-500: H≈205°, S+8, L−13)" }
|
|
41
67
|
},
|
|
42
68
|
"presentation-blue": {
|
|
43
69
|
"50": { "value": "#f0f8fc", "description": "Presentation-blue scale — pale wash for reveal.js callout backgrounds" },
|
|
44
|
-
"500": { "value": "#3498DB", "description": "Presentation-blue scale — Flat-UI peter-river; reserved presentation accent (
|
|
70
|
+
"500": { "value": "#3498DB", "description": "Presentation-blue scale — Flat-UI peter-river; reserved presentation accent. NOT for body text or button backgrounds (fails WCAG AA on stone-100). Decorative use only: borders, chart series, slide accents." },
|
|
45
71
|
"600": { "value": "#2980B9", "description": "Presentation-blue scale — Flat-UI belize-hole; hover/emphasized on presentation accent" },
|
|
46
|
-
"700": { "value": "#1f618d", "description": "Presentation-blue scale — pressed/deep emphasis on presentation accent" }
|
|
72
|
+
"700": { "value": "#1f618d", "description": "Presentation-blue scale — pressed/deep emphasis on presentation accent; passes AA on stone-100 for text use" }
|
|
47
73
|
}
|
|
48
74
|
},
|
|
49
75
|
"functional": {
|
package/src/effects.json
CHANGED
|
@@ -34,10 +34,21 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"transition": {
|
|
37
|
-
"quick":
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
37
|
+
"quick": {
|
|
38
|
+
"value": "0.15s ease",
|
|
39
|
+
"description": "Snap-fast micro-interactions — hover lifts, focus rings, immediate-feedback affordances"
|
|
40
|
+
},
|
|
41
|
+
"standard": {
|
|
42
|
+
"value": "0.25s ease-in-out",
|
|
43
|
+
"description": "Default for most state changes — toggles, button states, card hovers"
|
|
44
|
+
},
|
|
45
|
+
"smooth": {
|
|
46
|
+
"value": "0.35s ease",
|
|
47
|
+
"description": "Theme transitions, navbar collapse/expand, layout shifts that should feel deliberate"
|
|
48
|
+
},
|
|
49
|
+
"logo": {
|
|
50
|
+
"value": "0.3s",
|
|
51
|
+
"description": "Reserved for the dataimago wordmark / brand-mark transitions; do not borrow for general UI"
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
}
|