@mediaradar/design-tokens 2.0.0 → 2.0.1
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 +56 -16
- package/package.json +7 -7
- package/dist/index.html +0 -29
- package/dist/staticwebapp.config.json +0 -33
package/README.md
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mediaradar/design-tokens
|
|
2
2
|
|
|
3
|
-
Style Dictionary build for the MediaRadar Design System.
|
|
3
|
+
Style Dictionary build for the MediaRadar Design System. Reads the token
|
|
4
|
+
source files in `packages/tokens/` (one level up) and transforms them into
|
|
5
|
+
CSS custom properties, Tailwind v4 integration files, and JS/TS token
|
|
6
|
+
values.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Output is distributed two ways, for two different needs:
|
|
9
|
+
|
|
10
|
+
- **CDN** — `tokens.css`/`dark.css` (plain CSS custom properties) are
|
|
11
|
+
deployed to Azure Static Web Apps and consumed directly by URL, live and
|
|
12
|
+
unversioned. No install required.
|
|
13
|
+
- **npm package** (this package) — `tailwind/theme.css`/`typography.css`
|
|
14
|
+
contain Tailwind v4 `@theme`/`@utility` directives, which Tailwind's
|
|
15
|
+
build-time compiler cannot resolve from a remote `@import` URL. Installing
|
|
16
|
+
this package puts a real local file in `node_modules` that Tailwind's
|
|
17
|
+
build *can* see.
|
|
6
18
|
|
|
7
19
|
---
|
|
8
20
|
|
|
21
|
+
## Installing (as a consumer)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @mediaradar/design-tokens
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
/* Tailwind's @theme block — needs the npm package, not a CDN URL */
|
|
29
|
+
@import "@mediaradar/design-tokens/tailwind/theme.css";
|
|
30
|
+
@import "@mediaradar/design-tokens/tailwind/typography.css";
|
|
31
|
+
|
|
32
|
+
/* Plain CSS custom properties — CDN works fine for these */
|
|
33
|
+
@import "https://lemon-cliff-091e8ef0f.7.azurestaticapps.net/css/tokens.css";
|
|
34
|
+
@import "https://lemon-cliff-091e8ef0f.7.azurestaticapps.net/css/dark.css";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This package is version-pinned like any other npm dependency — a token
|
|
38
|
+
change only reaches a consumer once that consumer bumps the version, not
|
|
39
|
+
automatically. See the root `CLAUDE.md`'s "Consuming in a React + Tailwind
|
|
40
|
+
app" section for the full wiring and the CDN asset reference table.
|
|
41
|
+
|
|
9
42
|
## Building locally
|
|
10
43
|
|
|
11
44
|
```bash
|
|
@@ -14,11 +47,18 @@ npm ci
|
|
|
14
47
|
npm run build # runs scripts/build-tokens.js → writes dist/
|
|
15
48
|
```
|
|
16
49
|
|
|
17
|
-
`dist/` is gitignored and never committed
|
|
50
|
+
`dist/` is gitignored and never committed to this repo — it's a build
|
|
51
|
+
artifact, both deployed to the CDN and packed into the npm tarball by
|
|
52
|
+
`.github/workflows/tokens.yml` on push to `main`. Do not edit anything
|
|
53
|
+
under `dist/` by hand; it's regenerated from `packages/tokens/*.json` on
|
|
54
|
+
every build and any local edit is silently overwritten.
|
|
18
55
|
|
|
19
56
|
## Build config
|
|
20
57
|
|
|
21
|
-
Style Dictionary config lives in `sd.config.mjs`. The custom
|
|
58
|
+
Style Dictionary config lives in `sd.config.mjs`. The custom
|
|
59
|
+
`name/prefix-mr-strip-layer` transform strips the leading layer segment
|
|
60
|
+
(`ref`/`sys`/`component`) from each token path and adds an `mr-` prefix —
|
|
61
|
+
see root `CLAUDE.md`'s "Name transform" section for the full mapping rules.
|
|
22
62
|
|
|
23
63
|
## Output
|
|
24
64
|
|
|
@@ -29,22 +69,22 @@ dist/
|
|
|
29
69
|
js/ ← tokens.js, tokens.d.ts
|
|
30
70
|
DESIGN.md ← LLM-optimized design spec, auto-generated
|
|
31
71
|
patterns.json ← NOT built here — published by the ux-design repo; do not create or edit
|
|
32
|
-
index.html, scss/utilities/ ← copied as-is from
|
|
72
|
+
index.html, staticwebapp.config.json, scss/utilities/ ← copied as-is from
|
|
73
|
+
static/; CDN-hosting artifacts (routing/cache config, a landing page,
|
|
74
|
+
unwired legacy SCSS) with no relevance to an npm consumer, so index.html
|
|
75
|
+
and staticwebapp.config.json are excluded from what actually publishes
|
|
76
|
+
(see package.json's "files")
|
|
33
77
|
```
|
|
34
78
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
Downstream projects don't install anything from this package — they `@import` the deployed CSS directly by URL:
|
|
38
|
-
|
|
39
|
-
```css
|
|
40
|
-
@import "https://lemon-cliff-091e8ef0f.7.azurestaticapps.net/css/tokens.css";
|
|
41
|
-
@import "https://lemon-cliff-091e8ef0f.7.azurestaticapps.net/css/dark.css";
|
|
42
|
-
```
|
|
79
|
+
## Publishing
|
|
43
80
|
|
|
44
|
-
|
|
81
|
+
Bump `version` in this file's `package.json` as part of any PR that changes
|
|
82
|
+
published output (tokens, `sd.config.mjs`, or this package's own config),
|
|
83
|
+
then merge to `main` — `.github/workflows/tokens.yml`'s `publish_npm` job
|
|
84
|
+
publishes automatically, and no-ops safely if the version isn't bumped.
|
|
45
85
|
|
|
46
86
|
## Contributing
|
|
47
87
|
|
|
48
88
|
1. Edit token source files under `packages/tokens/*.json` — never `dist/`.
|
|
49
89
|
2. `npm run build` locally to verify output.
|
|
50
|
-
3. Open a PR against `main`. Changes deploy automatically on merge.
|
|
90
|
+
3. Open a PR against `main`. Changes deploy (CDN) and publish (npm) automatically on merge.
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediaradar/design-tokens",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "dist/js/tokens.js",
|
|
5
5
|
"types": "dist/js/tokens.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"!dist/index.html",
|
|
10
|
+
"!dist/staticwebapp.config.json"
|
|
9
11
|
],
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
@@ -27,14 +29,12 @@
|
|
|
27
29
|
"author": "",
|
|
28
30
|
"license": "Apache-2.0",
|
|
29
31
|
"devDependencies": {
|
|
30
|
-
"@types/node": "^25.3.0",
|
|
31
|
-
"eslint": "^10.0.1"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
32
|
"@tokens-studio/sd-transforms": "^2.0.3",
|
|
33
|
+
"@types/node": "^25.3.0",
|
|
34
|
+
"eslint": "^10.0.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
36
36
|
"lodash-es": "^4.17.21",
|
|
37
|
-
"style-dictionary": "^5.0
|
|
37
|
+
"style-dictionary": "^5.5.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"design-tokens",
|
package/dist/index.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>MediaRadar Design Tokens CDN</title>
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: sans-serif; max-width: 640px; margin: 60px auto; padding: 0 24px; color: #111; }
|
|
8
|
-
h1 { font-size: 1.25rem; margin-bottom: 4px; }
|
|
9
|
-
p { color: #555; font-size: 0.9rem; margin-top: 0; }
|
|
10
|
-
ul { padding-left: 1.25rem; line-height: 2; }
|
|
11
|
-
a { color: #5B4FE8; }
|
|
12
|
-
code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }
|
|
13
|
-
</style>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<h1>MediaRadar Design Tokens CDN</h1>
|
|
17
|
-
<p>Static asset CDN for the MediaRadar design system. Import via URL — no install required.</p>
|
|
18
|
-
<ul>
|
|
19
|
-
<li><a href="/css/tokens.css"><code>/css/tokens.css</code></a> — entry point</li>
|
|
20
|
-
<li><a href="/css/dark.css"><code>/css/dark.css</code></a> — dark theme</li>
|
|
21
|
-
<li><a href="/tailwind/theme.css"><code>/tailwind/theme.css</code></a> — Tailwind v4 @theme</li>
|
|
22
|
-
<li><a href="/tailwind/typography.css"><code>/tailwind/typography.css</code></a> — text-style utilities</li>
|
|
23
|
-
<li><a href="/js/tokens.js"><code>/js/tokens.js</code></a> — JS token values</li>
|
|
24
|
-
<li><a href="/js/tokens.d.ts"><code>/js/tokens.d.ts</code></a> — TypeScript types</li>
|
|
25
|
-
<li><a href="/DESIGN.md"><code>/DESIGN.md</code></a> — LLM design spec</li>
|
|
26
|
-
<li><a href="/patterns.json"><code>/patterns.json</code></a> — component catalogue</li>
|
|
27
|
-
</ul>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"routes": [
|
|
3
|
-
{
|
|
4
|
-
"route": "/css/*",
|
|
5
|
-
"headers": { "Cache-Control": "public, max-age=3600, stale-while-revalidate=86400" }
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"route": "/tailwind/*",
|
|
9
|
-
"headers": { "Cache-Control": "public, max-age=3600, stale-while-revalidate=86400" }
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"route": "/js/*",
|
|
13
|
-
"headers": { "Cache-Control": "public, max-age=3600, stale-while-revalidate=86400" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"route": "/*.md",
|
|
17
|
-
"headers": { "Cache-Control": "public, max-age=3600" }
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"route": "/patterns.json",
|
|
21
|
-
"headers": { "Cache-Control": "public, max-age=60, stale-while-revalidate=300" }
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"globalHeaders": {
|
|
25
|
-
"Access-Control-Allow-Origin": "*"
|
|
26
|
-
},
|
|
27
|
-
"mimeTypes": {
|
|
28
|
-
".css": "text/css",
|
|
29
|
-
".js": "application/javascript",
|
|
30
|
-
".d.ts": "text/plain",
|
|
31
|
-
".md": "text/plain"
|
|
32
|
-
}
|
|
33
|
-
}
|