@marianmeres/design-tokens 1.1.2 → 1.1.3
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/AGENTS.md +20 -6
- package/API.md +25 -4
- package/README.md +14 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
- **Stack**: Deno / TypeScript
|
|
5
5
|
- **Run**: `deno task test` | **Watch**: `deno task test:watch`
|
|
6
6
|
- **Build (npm)**: `deno task npm:build`
|
|
7
|
+
- **Build (CSS)**: `deno task css:build` (generates pre-built CSS files + updates deno.json exports)
|
|
8
|
+
- **Build (preview)**: `deno task preview:build`
|
|
7
9
|
- **Publish**: `deno task publish` (JSR + npm)
|
|
8
10
|
- **Format**: `deno fmt` (tabs, 90 chars, indent 4)
|
|
9
11
|
|
|
@@ -13,10 +15,11 @@ CSS custom property generator for design token systems. Takes a structured
|
|
|
13
15
|
`ThemeSchema` (light + optional dark mode) and produces CSS `--custom-property`
|
|
14
16
|
declarations with automatic hover/active state derivation via `color-mix()`.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Entry points:
|
|
17
19
|
- `.` — core generation functions, types, color palette
|
|
18
20
|
- `./reboot` — Bootstrap Reboot `--bs-*` variable bridge
|
|
19
|
-
- `./themes` —
|
|
21
|
+
- `./themes` — 42 pre-built theme definitions
|
|
22
|
+
- `./css/*.css` — pre-built CSS files with `stuic-` prefix (npm only, not on JSR)
|
|
20
23
|
|
|
21
24
|
## Project Structure
|
|
22
25
|
|
|
@@ -26,13 +29,16 @@ Three entry points:
|
|
|
26
29
|
types.ts — core type definitions (ThemeSchema, TokenSchema, etc.)
|
|
27
30
|
generate.ts — token generation + CSS output (generateCssTokens, toCssString, generateThemeCss)
|
|
28
31
|
utils.ts — hex color parsing (hexToRgb, hexToRgbTriplet)
|
|
29
|
-
colors.ts —
|
|
32
|
+
colors.ts — Tailwind color palette (v3 + v4.2 additions: taupe, mauve, mist, olive)
|
|
30
33
|
reboot-bridge.ts — Bootstrap Reboot --bs-* variable mapping
|
|
31
34
|
/themes
|
|
32
35
|
mod.ts — re-exports all theme definitions
|
|
33
36
|
*.ts — individual theme files (default export: ThemeSchema)
|
|
37
|
+
/css — pre-built CSS files (generated by scripts/build-css.ts)
|
|
34
38
|
/tests — test files (deno test --allow-read)
|
|
35
|
-
/scripts
|
|
39
|
+
/scripts
|
|
40
|
+
build-npm.ts — npm package build (also copies css/ into dist)
|
|
41
|
+
build-css.ts — generates css/*.css from all themes with "stuic-" prefix
|
|
36
42
|
/theme-preview-builder — HTML preview tool
|
|
37
43
|
```
|
|
38
44
|
|
|
@@ -66,7 +72,7 @@ Three entry points:
|
|
|
66
72
|
### Constants
|
|
67
73
|
| Export | Purpose |
|
|
68
74
|
|--------|---------|
|
|
69
|
-
| `colors` |
|
|
75
|
+
| `colors` | Tailwind hex palette including v4.2 additions (`colors.blue[600]`, `colors.mauve[500]`) |
|
|
70
76
|
|
|
71
77
|
## Critical Conventions
|
|
72
78
|
|
|
@@ -77,9 +83,17 @@ Three entry points:
|
|
|
77
83
|
5. Theme files use `export default` with `ThemeSchema` type annotation
|
|
78
84
|
6. Formatting: tabs, 90-char line width, 4-space indent width (`deno fmt`)
|
|
79
85
|
|
|
86
|
+
## Adding a New Theme
|
|
87
|
+
|
|
88
|
+
1. Create `src/themes/{name}.ts` with `export default` of `ThemeSchema`
|
|
89
|
+
2. Add re-export in `src/themes/mod.ts` (alphabetical order)
|
|
90
|
+
3. Run `deno task css:build` to regenerate CSS files
|
|
91
|
+
4. Run `deno task preview:build` to rebuild the preview tool
|
|
92
|
+
5. If the theme uses new color families, update `COLOR_FAMILIES` in `theme-preview-builder/index.html`
|
|
93
|
+
|
|
80
94
|
## Before Making Changes
|
|
81
95
|
|
|
82
96
|
- [ ] Read existing patterns in similar files
|
|
83
|
-
- [ ] Run `deno task test` — all
|
|
97
|
+
- [ ] Run `deno task test` — all tests must pass
|
|
84
98
|
- [ ] Follow `deno fmt` conventions
|
|
85
99
|
- [ ] Ensure new exports have JSDoc + explicit return types
|
package/API.md
CHANGED
|
@@ -251,13 +251,20 @@ type RoleSingleKey = "foreground" | "border" | "input" | "ring";
|
|
|
251
251
|
|
|
252
252
|
### `colors`
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
Tailwind CSS color palette as hex values. Contains `black`, `white`, and 26 color scales each with shades 50–950:
|
|
255
|
+
|
|
256
|
+
- **Neutrals**: slate, gray, zinc, neutral, stone
|
|
257
|
+
- **Earthy/muted (v4.2)**: taupe, mauve, mist, olive
|
|
258
|
+
- **Warm**: red, orange, amber, yellow
|
|
259
|
+
- **Cool**: lime, green, emerald, teal, cyan, sky, blue, indigo
|
|
260
|
+
- **Vibrant**: violet, purple, fuchsia, pink, rose
|
|
255
261
|
|
|
256
262
|
```typescript
|
|
257
263
|
import { colors } from "@marianmeres/design-tokens";
|
|
258
264
|
|
|
259
265
|
colors.blue[600] // → "#2563eb"
|
|
260
|
-
colors.
|
|
266
|
+
colors.mauve[500] // → "#79697b"
|
|
267
|
+
colors.white // → "#ffffff"
|
|
261
268
|
```
|
|
262
269
|
|
|
263
270
|
---
|
|
@@ -266,6 +273,20 @@ colors.white // → "#ffffff"
|
|
|
266
273
|
|
|
267
274
|
*Import from `@marianmeres/design-tokens/themes`*
|
|
268
275
|
|
|
269
|
-
|
|
276
|
+
42 pre-built `ThemeSchema` definitions, each with light + dark mode:
|
|
277
|
+
|
|
278
|
+
`blueOrange`, `cyanRed`, `cyanSlate`, `emeraldAmberForest`, `emeraldPink`, `fuchsiaEmerald`, `gray`, `indigoAmber`, `limeFuchsiaNeon`, `mauve`, `mauveLimeElectric`, `mauveTeal`, `mist`, `mistIndigoFjord`, `mistVioletAurora`, `monokaiCyan`, `monokaiGreen`, `monokaiPink`, `olive`, `oliveAmberSafari`, `orangePinkSunset`, `pinkEmerald`, `pinkTeal`, `purpleYellow`, `rainbow`, `redBlue`, `redCyan`, `redSky`, `redSkySlate`, `roseTeal`, `skyAmber`, `slateCyan`, `slateTealOcean`, `stone`, `taupe`, `taupeOliveClay`, `taupeRoseBlush`, `stoneOrangeEarth`, `tealRose`, `violetLime`, `violetRoseDusk`, `zinc`
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Pre-built CSS
|
|
283
|
+
|
|
284
|
+
*npm only — not available on JSR*
|
|
285
|
+
|
|
286
|
+
All bundled themes are also distributed as pre-built CSS files using the `stuic-` prefix. Import via `@marianmeres/design-tokens/css/{theme-name}.css`.
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import "@marianmeres/design-tokens/css/mauve-teal.css";
|
|
290
|
+
```
|
|
270
291
|
|
|
271
|
-
|
|
292
|
+
Available files: `blue-orange.css`, `cyan-red.css`, `mauve-teal.css`, `mist-indigo-fjord.css`, `taupe-rose-blush.css`, etc. (one per bundled theme)
|
package/README.md
CHANGED
|
@@ -53,9 +53,22 @@ const css = generateThemeCss(theme, "my-");
|
|
|
53
53
|
// → :root { --my-color-primary: #2563eb; ... }
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Pre-built CSS
|
|
57
|
+
|
|
58
|
+
All bundled themes are available as pre-built CSS files with the `stuic-` prefix (npm only):
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<link rel="stylesheet" href="node_modules/@marianmeres/design-tokens/css/mauve-teal.css">
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or via bundler import:
|
|
65
|
+
```ts
|
|
66
|
+
import "@marianmeres/design-tokens/css/mauve-teal.css";
|
|
67
|
+
```
|
|
68
|
+
|
|
56
69
|
## Creating a custom theme
|
|
57
70
|
|
|
58
|
-
Use the bundled `colors` map (
|
|
71
|
+
Use the bundled `colors` map (Tailwind palette including v4.2 additions) to avoid looking up hex values:
|
|
59
72
|
|
|
60
73
|
```ts
|
|
61
74
|
import { colors, generateThemeCss } from "@marianmeres/design-tokens";
|