@manjunathhk/design-tokens 1.0.0-rc.2 → 1.0.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/LICENSE +24 -24
- package/README.md +274 -274
- package/dist/LICENSES/IBM-Plex-Mono-OFL-1.1.txt +0 -0
- package/dist/LICENSES/IBM-Plex-Sans-Condensed-OFL-1.1.txt +0 -0
- package/dist/LICENSES/IBM-Plex-Sans-OFL-1.1.txt +0 -0
- package/dist/_tokens.scss +1 -1
- package/dist/base.css +91 -91
- package/dist/fonts.css +1 -1
- package/dist/index.css +91 -91
- package/dist/tokens.css +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.json +1 -1
- package/dist/tokens.mjs +2 -2
- package/package.json +71 -71
package/LICENSE
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Manjunath Krishnasa
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
The IBM Plex font files shipped in dist/fonts are licensed separately under
|
|
24
|
-
the SIL Open Font License 1.1; see dist/LICENSES.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manjunath Krishnasa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
The IBM Plex font files shipped in dist/fonts are licensed separately under
|
|
24
|
+
the SIL Open Font License 1.1; see dist/LICENSES.
|
package/README.md
CHANGED
|
@@ -1,274 +1,274 @@
|
|
|
1
|
-
# @manjunathhk/design-tokens
|
|
2
|
-
|
|
3
|
-
One source of truth for the colour scheme and core visual foundations of
|
|
4
|
-
Manjunath's websites (Angular, WordPress, static HTML, .NET/Razor, on
|
|
5
|
-
different hosts). Change a token once, every site that consumes it picks it
|
|
6
|
-
up.
|
|
7
|
-
|
|
8
|
-
This package is tokens and a small opt-in base stylesheet, nothing else:
|
|
9
|
-
|
|
10
|
-
- design tokens for colour (light and dark), typography, spacing, radius,
|
|
11
|
-
shadow, motion, layout, z-index and a breakpoint reference;
|
|
12
|
-
- `base.css`, a small opt-in base (reset, body, links, selection, focus ring,
|
|
13
|
-
reduced motion) built only on the tokens;
|
|
14
|
-
- self-hosted IBM Plex fonts and `fonts.css`.
|
|
15
|
-
|
|
16
|
-
It is never a place for UI components (buttons, cards, nav — those are
|
|
17
|
-
framework-specific and live in each site), a utility-class framework,
|
|
18
|
-
CSS-in-JS, runtime JavaScript, or a palette switcher. See
|
|
19
|
-
[AGENTS.md](AGENTS.md) for the full contract; contributors and coding agents
|
|
20
|
-
read it first.
|
|
21
|
-
|
|
22
|
-
## Outputs
|
|
23
|
-
|
|
24
|
-
Each file in `dist/` has a subpath export (`@manjunathhk/design-tokens/<file>`).
|
|
25
|
-
|
|
26
|
-
| File | Contents |
|
|
27
|
-
| -------------- | ------------------------------------------------------------------------------------- |
|
|
28
|
-
| `index.css` | Fonts, tokens and base in one file (the package `style` entry) |
|
|
29
|
-
| `tokens.css` | `--mk-*` custom properties, light and dark |
|
|
30
|
-
| `base.css` | Opt-in reset and base styles, zero specificity, plus `.mk-grid-bg` |
|
|
31
|
-
| `fonts.css` | Self-hosted IBM Plex Sans, Sans Condensed and Mono `@font-face` rules |
|
|
32
|
-
| `tokens.json` | `{ version, light, dark, shared, breakpoints }`, flat, keyed by token path |
|
|
33
|
-
| `tokens.mjs` | The same five groups as typed constants (`tokens.d.ts`); also the package root import |
|
|
34
|
-
| `_tokens.scss` | `$mk-*: var(--mk-*)`, raw `$mk-breakpoint-*` values and `@include mk-media(md)` |
|
|
35
|
-
|
|
36
|
-
Breakpoints are never CSS custom properties (they do not work in media
|
|
37
|
-
queries); they live under `breakpoints` in JSON and JS, and as raw values in
|
|
38
|
-
SCSS.
|
|
39
|
-
|
|
40
|
-
Every custom property is prefixed `--mk-` so it never collides with a host
|
|
41
|
-
theme (WordPress themes in particular).
|
|
42
|
-
|
|
43
|
-
## Light and dark
|
|
44
|
-
|
|
45
|
-
Semantic colour tokens are authored in two source files with the same keys,
|
|
46
|
-
`tokens/semantic/color.light.json` and `tokens/semantic/color.dark.json`; the
|
|
47
|
-
build fails, naming the token and the file, if one mode is missing a key a
|
|
48
|
-
token has in the other. The emitted CSS follows the OS by default and can be
|
|
49
|
-
forced:
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<html data-theme="dark">
|
|
53
|
-
<!-- or data-theme="light" -->
|
|
54
|
-
</html>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
With no `data-theme` attribute, the page follows `prefers-color-scheme`.
|
|
58
|
-
`color-scheme` is set to match on `:root` in both cases, so native form
|
|
59
|
-
controls and scrollbars also switch.
|
|
60
|
-
|
|
61
|
-
## Consumption
|
|
62
|
-
|
|
63
|
-
Prefer the CDN alias for sites without a build step; it always serves the
|
|
64
|
-
latest non-breaking release. Pin a version when you want to upgrade on your
|
|
65
|
-
own schedule.
|
|
66
|
-
|
|
67
|
-
### Plain `<link>`
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<!-- Alias: tracks the latest 1.x release -->
|
|
71
|
-
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
72
|
-
|
|
73
|
-
<!-- Pinned: never changes -->
|
|
74
|
-
<link rel="stylesheet" href="https://design.manjunathhk.in/v1.0.0/index.css" />
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Emergency fallback only, if `design.manjunathhk.in` itself is down — jsDelivr
|
|
78
|
-
mirrors the npm package automatically:
|
|
79
|
-
|
|
80
|
-
```html
|
|
81
|
-
<link
|
|
82
|
-
rel="stylesheet"
|
|
83
|
-
href="https://cdn.jsdelivr.net/npm/@manjunathhk/design-tokens@1/dist/index.css"
|
|
84
|
-
/>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Do not use the jsDelivr URL as a site's default; it exists for the outage
|
|
88
|
-
case only.
|
|
89
|
-
|
|
90
|
-
### Angular
|
|
91
|
-
|
|
92
|
-
`angular.json`, in the project's `architect.build.options`:
|
|
93
|
-
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"styles": ["node_modules/@manjunathhk/design-tokens/dist/index.css", "src/styles.scss"]
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
SCSS, via `@use` against the `_tokens.scss` subpath export:
|
|
101
|
-
|
|
102
|
-
```scss
|
|
103
|
-
@use "@manjunathhk/design-tokens/_tokens.scss" as mk;
|
|
104
|
-
|
|
105
|
-
.card {
|
|
106
|
-
border-radius: mk.$mk-radius-md;
|
|
107
|
-
padding: mk.$mk-spacing-6;
|
|
108
|
-
|
|
109
|
-
@include mk.mk-media(md) {
|
|
110
|
-
padding: mk.$mk-spacing-8;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### WordPress
|
|
116
|
-
|
|
117
|
-
`functions.php`:
|
|
118
|
-
|
|
119
|
-
```php
|
|
120
|
-
function mk_design_tokens_enqueue() {
|
|
121
|
-
wp_enqueue_style(
|
|
122
|
-
'mk-design-tokens',
|
|
123
|
-
'https://design.manjunathhk.in/v1/index.css',
|
|
124
|
-
[],
|
|
125
|
-
null
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
add_action( 'wp_enqueue_scripts', 'mk_design_tokens_enqueue' );
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### .NET Razor or Blazor
|
|
132
|
-
|
|
133
|
-
In the shared layout (`_Layout.cshtml` or `App.razor`), inside `<head>`:
|
|
134
|
-
|
|
135
|
-
```html
|
|
136
|
-
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Docker / NGINX static site
|
|
140
|
-
|
|
141
|
-
Nothing special: the same `<link>` tag as above, since NGINX only serves the
|
|
142
|
-
site's own HTML and the stylesheet is fetched from the CDN at the client. If
|
|
143
|
-
the image instead bundles the package from npm, copy `dist/index.css` and
|
|
144
|
-
`dist/fonts/` into the image at build time and link the copied path.
|
|
145
|
-
|
|
146
|
-
## Resilience pattern
|
|
147
|
-
|
|
148
|
-
Bundle a pinned snapshot of `dist/index.css` (and `dist/fonts/`) into the
|
|
149
|
-
site's own static assets, and load the CDN link **after** it:
|
|
150
|
-
|
|
151
|
-
```html
|
|
152
|
-
<link rel="stylesheet" href="/assets/design-tokens/index.css" />
|
|
153
|
-
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Both stylesheets declare the same properties, so during normal operation the
|
|
157
|
-
CDN copy, loaded second, simply overrides the bundled one with whatever is
|
|
158
|
-
current. If the CDN request fails, the second `<link>` contributes nothing,
|
|
159
|
-
and the page keeps the bundled snapshot's styles instead of falling back to
|
|
160
|
-
unstyled content.
|
|
161
|
-
|
|
162
|
-
## Content Security Policy
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
style-src 'self' https://design.manjunathhk.in;
|
|
166
|
-
font-src 'self' https://design.manjunathhk.in;
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Add `https://cdn.jsdelivr.net` to both directives only on a site that is
|
|
170
|
-
actively using the jsDelivr fallback above.
|
|
171
|
-
|
|
172
|
-
## Versioning policy
|
|
173
|
-
|
|
174
|
-
Semantic versioning is what makes "change once, reflect everywhere" safe:
|
|
175
|
-
|
|
176
|
-
- removing or renaming an emitted token is **MAJOR** (the API-diff CI check
|
|
177
|
-
enforces this);
|
|
178
|
-
- adding a token, or changing a value, is **MINOR** — value changes are
|
|
179
|
-
minor on purpose, since that is what lets `@1` / `/v1/` consumers receive a
|
|
180
|
-
palette change without asking for it;
|
|
181
|
-
- a build or doc fix is **PATCH**.
|
|
182
|
-
|
|
183
|
-
## How to change the palette
|
|
184
|
-
|
|
185
|
-
1. Edit `tokens/semantic/color.light.json` and
|
|
186
|
-
`tokens/semantic/color.dark.json` (both files, same keys — see
|
|
187
|
-
[Light and dark](#light-and-dark)). Never invent a colour
|
|
188
|
-
value; it must come from the brief or from an approved PR description.
|
|
189
|
-
2. Run `npm run build` and open `docs/index.html` (generated, not committed)
|
|
190
|
-
to preview swatches, contrast ratios and the type scale in both modes.
|
|
191
|
-
3. `npm test` must keep the contrast contract passing for every pair in both
|
|
192
|
-
modes.
|
|
193
|
-
4. Open a PR; propose any new colour with its contrast ratios in the PR
|
|
194
|
-
description for approval before merging.
|
|
195
|
-
|
|
196
|
-
## Release process
|
|
197
|
-
|
|
198
|
-
GitHub Flow: short-lived branches off `main`, merged by PR. A release is a
|
|
199
|
-
tag on a `main` commit, pushed by a human only — agents never push tags,
|
|
200
|
-
publish to npm, or upload to R2. The version bump and CHANGELOG entry land in
|
|
201
|
-
a "Release X.Y.Z" PR before tagging.
|
|
202
|
-
|
|
203
|
-
1. Push a pre-release tag first, `vX.Y.Z-rc.N`. It is built, tested,
|
|
204
|
-
uploaded to the CDN under the pinned prefix `/vX.Y.Z-rc.N/`, verified over
|
|
205
|
-
HTTPS, and published to npm under the `next` dist-tag
|
|
206
|
-
(`npm install @manjunathhk/design-tokens@next`). It is never promoted to
|
|
207
|
-
the CDN alias.
|
|
208
|
-
2. Once the pipeline is proven, push the final tag, `vX.Y.Z`. It repeats the
|
|
209
|
-
above, then promotes the pinned files to the alias prefix `/vMAJOR/`,
|
|
210
|
-
purges that alias from Cloudflare's cache, verifies it, publishes to npm
|
|
211
|
-
under the default (`latest`) tag, and creates the GitHub Release.
|
|
212
|
-
|
|
213
|
-
Pinned CDN paths (`/vX.Y.Z/`) are immutable; only the alias (`/vMAJOR/`) is
|
|
214
|
-
ever rewritten. Rolling `/v1/` back to an earlier pinned version is one click
|
|
215
|
-
on the `promote` workflow.
|
|
216
|
-
|
|
217
|
-
## Theme control
|
|
218
|
-
|
|
219
|
-
```html
|
|
220
|
-
<html data-theme="light">
|
|
221
|
-
<!-- or data-theme="dark", or omit the attribute to follow the OS -->
|
|
222
|
-
</html>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
## Migration map
|
|
226
|
-
|
|
227
|
-
From the portfolio's previous local variable names:
|
|
228
|
-
|
|
229
|
-
| Old variable | Token |
|
|
230
|
-
| --------------------------------- | ---------------------------------------------- |
|
|
231
|
-
| `--paper` | `--mk-color-bg` |
|
|
232
|
-
| `--paper-2` | `--mk-color-bg-subtle` |
|
|
233
|
-
| `--card` | `--mk-color-surface` |
|
|
234
|
-
| `--ink` | `--mk-color-text` |
|
|
235
|
-
| `--ink-2` | `--mk-color-text-secondary` |
|
|
236
|
-
| `--mut` | `--mk-color-text-muted` |
|
|
237
|
-
| `--rule` | `--mk-color-border` |
|
|
238
|
-
| `--rule-2` | `--mk-color-border-strong` |
|
|
239
|
-
| `--grid` | `--mk-color-grid-line` |
|
|
240
|
-
| `--acc` | `--mk-color-accent` |
|
|
241
|
-
| `--on-acc` | `--mk-color-on-accent` |
|
|
242
|
-
| `--acc-soft` | `--mk-color-accent-subtle` |
|
|
243
|
-
| `--err` | `--mk-color-danger` |
|
|
244
|
-
| `--display` / `--sans` / `--mono` | `--mk-font-family-display` / `-sans` / `-mono` |
|
|
245
|
-
| `--gut` | `--mk-layout-gutter` |
|
|
246
|
-
| `--ease` | `--mk-motion-ease` |
|
|
247
|
-
|
|
248
|
-
`--mk-color-border-strong` keeps the old `--rule-2` role: a decorative
|
|
249
|
-
emphasised rule, not held to the 3:1 non-text contrast ratio. There is no old
|
|
250
|
-
variable for `--mk-color-border-control` — it is new in this package, for
|
|
251
|
-
control outlines (inputs, buttons) where 3:1 against `bg`, `bg-subtle` and
|
|
252
|
-
`surface` is required. Use `border-strong` for decoration, `border-control`
|
|
253
|
-
for anything a user interacts with.
|
|
254
|
-
|
|
255
|
-
## Development
|
|
256
|
-
|
|
257
|
-
Node 24 LTS (`.nvmrc`).
|
|
258
|
-
|
|
259
|
-
```sh
|
|
260
|
-
npm ci
|
|
261
|
-
npm run lint
|
|
262
|
-
npm run typecheck
|
|
263
|
-
npm test
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### Required status checks
|
|
267
|
-
|
|
268
|
-
Branch protection on `main` requires a PR and these checks (squash merges are
|
|
269
|
-
allowed):
|
|
270
|
-
|
|
271
|
-
- `actionlint` — lints the workflow files;
|
|
272
|
-
- `ci` — install, lint, typecheck, build, test, API diff against the
|
|
273
|
-
published package;
|
|
274
|
-
- `playwright` — the cross-origin consumption smoke test.
|
|
1
|
+
# @manjunathhk/design-tokens
|
|
2
|
+
|
|
3
|
+
One source of truth for the colour scheme and core visual foundations of
|
|
4
|
+
Manjunath's websites (Angular, WordPress, static HTML, .NET/Razor, on
|
|
5
|
+
different hosts). Change a token once, every site that consumes it picks it
|
|
6
|
+
up.
|
|
7
|
+
|
|
8
|
+
This package is tokens and a small opt-in base stylesheet, nothing else:
|
|
9
|
+
|
|
10
|
+
- design tokens for colour (light and dark), typography, spacing, radius,
|
|
11
|
+
shadow, motion, layout, z-index and a breakpoint reference;
|
|
12
|
+
- `base.css`, a small opt-in base (reset, body, links, selection, focus ring,
|
|
13
|
+
reduced motion) built only on the tokens;
|
|
14
|
+
- self-hosted IBM Plex fonts and `fonts.css`.
|
|
15
|
+
|
|
16
|
+
It is never a place for UI components (buttons, cards, nav — those are
|
|
17
|
+
framework-specific and live in each site), a utility-class framework,
|
|
18
|
+
CSS-in-JS, runtime JavaScript, or a palette switcher. See
|
|
19
|
+
[AGENTS.md](AGENTS.md) for the full contract; contributors and coding agents
|
|
20
|
+
read it first.
|
|
21
|
+
|
|
22
|
+
## Outputs
|
|
23
|
+
|
|
24
|
+
Each file in `dist/` has a subpath export (`@manjunathhk/design-tokens/<file>`).
|
|
25
|
+
|
|
26
|
+
| File | Contents |
|
|
27
|
+
| -------------- | ------------------------------------------------------------------------------------- |
|
|
28
|
+
| `index.css` | Fonts, tokens and base in one file (the package `style` entry) |
|
|
29
|
+
| `tokens.css` | `--mk-*` custom properties, light and dark |
|
|
30
|
+
| `base.css` | Opt-in reset and base styles, zero specificity, plus `.mk-grid-bg` |
|
|
31
|
+
| `fonts.css` | Self-hosted IBM Plex Sans, Sans Condensed and Mono `@font-face` rules |
|
|
32
|
+
| `tokens.json` | `{ version, light, dark, shared, breakpoints }`, flat, keyed by token path |
|
|
33
|
+
| `tokens.mjs` | The same five groups as typed constants (`tokens.d.ts`); also the package root import |
|
|
34
|
+
| `_tokens.scss` | `$mk-*: var(--mk-*)`, raw `$mk-breakpoint-*` values and `@include mk-media(md)` |
|
|
35
|
+
|
|
36
|
+
Breakpoints are never CSS custom properties (they do not work in media
|
|
37
|
+
queries); they live under `breakpoints` in JSON and JS, and as raw values in
|
|
38
|
+
SCSS.
|
|
39
|
+
|
|
40
|
+
Every custom property is prefixed `--mk-` so it never collides with a host
|
|
41
|
+
theme (WordPress themes in particular).
|
|
42
|
+
|
|
43
|
+
## Light and dark
|
|
44
|
+
|
|
45
|
+
Semantic colour tokens are authored in two source files with the same keys,
|
|
46
|
+
`tokens/semantic/color.light.json` and `tokens/semantic/color.dark.json`; the
|
|
47
|
+
build fails, naming the token and the file, if one mode is missing a key a
|
|
48
|
+
token has in the other. The emitted CSS follows the OS by default and can be
|
|
49
|
+
forced:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<html data-theme="dark">
|
|
53
|
+
<!-- or data-theme="light" -->
|
|
54
|
+
</html>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
With no `data-theme` attribute, the page follows `prefers-color-scheme`.
|
|
58
|
+
`color-scheme` is set to match on `:root` in both cases, so native form
|
|
59
|
+
controls and scrollbars also switch.
|
|
60
|
+
|
|
61
|
+
## Consumption
|
|
62
|
+
|
|
63
|
+
Prefer the CDN alias for sites without a build step; it always serves the
|
|
64
|
+
latest non-breaking release. Pin a version when you want to upgrade on your
|
|
65
|
+
own schedule.
|
|
66
|
+
|
|
67
|
+
### Plain `<link>`
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<!-- Alias: tracks the latest 1.x release -->
|
|
71
|
+
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
72
|
+
|
|
73
|
+
<!-- Pinned: never changes -->
|
|
74
|
+
<link rel="stylesheet" href="https://design.manjunathhk.in/v1.0.0/index.css" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Emergency fallback only, if `design.manjunathhk.in` itself is down — jsDelivr
|
|
78
|
+
mirrors the npm package automatically:
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<link
|
|
82
|
+
rel="stylesheet"
|
|
83
|
+
href="https://cdn.jsdelivr.net/npm/@manjunathhk/design-tokens@1/dist/index.css"
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Do not use the jsDelivr URL as a site's default; it exists for the outage
|
|
88
|
+
case only.
|
|
89
|
+
|
|
90
|
+
### Angular
|
|
91
|
+
|
|
92
|
+
`angular.json`, in the project's `architect.build.options`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"styles": ["node_modules/@manjunathhk/design-tokens/dist/index.css", "src/styles.scss"]
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
SCSS, via `@use` against the `_tokens.scss` subpath export:
|
|
101
|
+
|
|
102
|
+
```scss
|
|
103
|
+
@use "@manjunathhk/design-tokens/_tokens.scss" as mk;
|
|
104
|
+
|
|
105
|
+
.card {
|
|
106
|
+
border-radius: mk.$mk-radius-md;
|
|
107
|
+
padding: mk.$mk-spacing-6;
|
|
108
|
+
|
|
109
|
+
@include mk.mk-media(md) {
|
|
110
|
+
padding: mk.$mk-spacing-8;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### WordPress
|
|
116
|
+
|
|
117
|
+
`functions.php`:
|
|
118
|
+
|
|
119
|
+
```php
|
|
120
|
+
function mk_design_tokens_enqueue() {
|
|
121
|
+
wp_enqueue_style(
|
|
122
|
+
'mk-design-tokens',
|
|
123
|
+
'https://design.manjunathhk.in/v1/index.css',
|
|
124
|
+
[],
|
|
125
|
+
null
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
add_action( 'wp_enqueue_scripts', 'mk_design_tokens_enqueue' );
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### .NET Razor or Blazor
|
|
132
|
+
|
|
133
|
+
In the shared layout (`_Layout.cshtml` or `App.razor`), inside `<head>`:
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Docker / NGINX static site
|
|
140
|
+
|
|
141
|
+
Nothing special: the same `<link>` tag as above, since NGINX only serves the
|
|
142
|
+
site's own HTML and the stylesheet is fetched from the CDN at the client. If
|
|
143
|
+
the image instead bundles the package from npm, copy `dist/index.css` and
|
|
144
|
+
`dist/fonts/` into the image at build time and link the copied path.
|
|
145
|
+
|
|
146
|
+
## Resilience pattern
|
|
147
|
+
|
|
148
|
+
Bundle a pinned snapshot of `dist/index.css` (and `dist/fonts/`) into the
|
|
149
|
+
site's own static assets, and load the CDN link **after** it:
|
|
150
|
+
|
|
151
|
+
```html
|
|
152
|
+
<link rel="stylesheet" href="/assets/design-tokens/index.css" />
|
|
153
|
+
<link rel="stylesheet" href="https://design.manjunathhk.in/v1/index.css" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Both stylesheets declare the same properties, so during normal operation the
|
|
157
|
+
CDN copy, loaded second, simply overrides the bundled one with whatever is
|
|
158
|
+
current. If the CDN request fails, the second `<link>` contributes nothing,
|
|
159
|
+
and the page keeps the bundled snapshot's styles instead of falling back to
|
|
160
|
+
unstyled content.
|
|
161
|
+
|
|
162
|
+
## Content Security Policy
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
style-src 'self' https://design.manjunathhk.in;
|
|
166
|
+
font-src 'self' https://design.manjunathhk.in;
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Add `https://cdn.jsdelivr.net` to both directives only on a site that is
|
|
170
|
+
actively using the jsDelivr fallback above.
|
|
171
|
+
|
|
172
|
+
## Versioning policy
|
|
173
|
+
|
|
174
|
+
Semantic versioning is what makes "change once, reflect everywhere" safe:
|
|
175
|
+
|
|
176
|
+
- removing or renaming an emitted token is **MAJOR** (the API-diff CI check
|
|
177
|
+
enforces this);
|
|
178
|
+
- adding a token, or changing a value, is **MINOR** — value changes are
|
|
179
|
+
minor on purpose, since that is what lets `@1` / `/v1/` consumers receive a
|
|
180
|
+
palette change without asking for it;
|
|
181
|
+
- a build or doc fix is **PATCH**.
|
|
182
|
+
|
|
183
|
+
## How to change the palette
|
|
184
|
+
|
|
185
|
+
1. Edit `tokens/semantic/color.light.json` and
|
|
186
|
+
`tokens/semantic/color.dark.json` (both files, same keys — see
|
|
187
|
+
[Light and dark](#light-and-dark)). Never invent a colour
|
|
188
|
+
value; it must come from the brief or from an approved PR description.
|
|
189
|
+
2. Run `npm run build` and open `docs/index.html` (generated, not committed)
|
|
190
|
+
to preview swatches, contrast ratios and the type scale in both modes.
|
|
191
|
+
3. `npm test` must keep the contrast contract passing for every pair in both
|
|
192
|
+
modes.
|
|
193
|
+
4. Open a PR; propose any new colour with its contrast ratios in the PR
|
|
194
|
+
description for approval before merging.
|
|
195
|
+
|
|
196
|
+
## Release process
|
|
197
|
+
|
|
198
|
+
GitHub Flow: short-lived branches off `main`, merged by PR. A release is a
|
|
199
|
+
tag on a `main` commit, pushed by a human only — agents never push tags,
|
|
200
|
+
publish to npm, or upload to R2. The version bump and CHANGELOG entry land in
|
|
201
|
+
a "Release X.Y.Z" PR before tagging.
|
|
202
|
+
|
|
203
|
+
1. Push a pre-release tag first, `vX.Y.Z-rc.N`. It is built, tested,
|
|
204
|
+
uploaded to the CDN under the pinned prefix `/vX.Y.Z-rc.N/`, verified over
|
|
205
|
+
HTTPS, and published to npm under the `next` dist-tag
|
|
206
|
+
(`npm install @manjunathhk/design-tokens@next`). It is never promoted to
|
|
207
|
+
the CDN alias.
|
|
208
|
+
2. Once the pipeline is proven, push the final tag, `vX.Y.Z`. It repeats the
|
|
209
|
+
above, then promotes the pinned files to the alias prefix `/vMAJOR/`,
|
|
210
|
+
purges that alias from Cloudflare's cache, verifies it, publishes to npm
|
|
211
|
+
under the default (`latest`) tag, and creates the GitHub Release.
|
|
212
|
+
|
|
213
|
+
Pinned CDN paths (`/vX.Y.Z/`) are immutable; only the alias (`/vMAJOR/`) is
|
|
214
|
+
ever rewritten. Rolling `/v1/` back to an earlier pinned version is one click
|
|
215
|
+
on the `promote` workflow.
|
|
216
|
+
|
|
217
|
+
## Theme control
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<html data-theme="light">
|
|
221
|
+
<!-- or data-theme="dark", or omit the attribute to follow the OS -->
|
|
222
|
+
</html>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Migration map
|
|
226
|
+
|
|
227
|
+
From the portfolio's previous local variable names:
|
|
228
|
+
|
|
229
|
+
| Old variable | Token |
|
|
230
|
+
| --------------------------------- | ---------------------------------------------- |
|
|
231
|
+
| `--paper` | `--mk-color-bg` |
|
|
232
|
+
| `--paper-2` | `--mk-color-bg-subtle` |
|
|
233
|
+
| `--card` | `--mk-color-surface` |
|
|
234
|
+
| `--ink` | `--mk-color-text` |
|
|
235
|
+
| `--ink-2` | `--mk-color-text-secondary` |
|
|
236
|
+
| `--mut` | `--mk-color-text-muted` |
|
|
237
|
+
| `--rule` | `--mk-color-border` |
|
|
238
|
+
| `--rule-2` | `--mk-color-border-strong` |
|
|
239
|
+
| `--grid` | `--mk-color-grid-line` |
|
|
240
|
+
| `--acc` | `--mk-color-accent` |
|
|
241
|
+
| `--on-acc` | `--mk-color-on-accent` |
|
|
242
|
+
| `--acc-soft` | `--mk-color-accent-subtle` |
|
|
243
|
+
| `--err` | `--mk-color-danger` |
|
|
244
|
+
| `--display` / `--sans` / `--mono` | `--mk-font-family-display` / `-sans` / `-mono` |
|
|
245
|
+
| `--gut` | `--mk-layout-gutter` |
|
|
246
|
+
| `--ease` | `--mk-motion-ease` |
|
|
247
|
+
|
|
248
|
+
`--mk-color-border-strong` keeps the old `--rule-2` role: a decorative
|
|
249
|
+
emphasised rule, not held to the 3:1 non-text contrast ratio. There is no old
|
|
250
|
+
variable for `--mk-color-border-control` — it is new in this package, for
|
|
251
|
+
control outlines (inputs, buttons) where 3:1 against `bg`, `bg-subtle` and
|
|
252
|
+
`surface` is required. Use `border-strong` for decoration, `border-control`
|
|
253
|
+
for anything a user interacts with.
|
|
254
|
+
|
|
255
|
+
## Development
|
|
256
|
+
|
|
257
|
+
Node 24 LTS (`.nvmrc`).
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
npm ci
|
|
261
|
+
npm run lint
|
|
262
|
+
npm run typecheck
|
|
263
|
+
npm test
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Required status checks
|
|
267
|
+
|
|
268
|
+
Branch protection on `main` requires a PR and these checks (squash merges are
|
|
269
|
+
allowed):
|
|
270
|
+
|
|
271
|
+
- `actionlint` — lints the workflow files;
|
|
272
|
+
- `ci` — install, lint, typecheck, build, test, API diff against the
|
|
273
|
+
published package;
|
|
274
|
+
- `playwright` — the cross-origin consumption smoke test.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/_tokens.scss
CHANGED
package/dist/base.css
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/*! @manjunathhk/design-tokens v1.0.0
|
|
2
|
-
/*
|
|
3
|
-
* Opt-in base built only on the tokens. Selectors sit inside :where() so they
|
|
4
|
-
* carry zero specificity and any site rule overrides them.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/* Reset */
|
|
8
|
-
:where(*, *::before, *::after) {
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:where(body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) {
|
|
13
|
-
margin: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:where(img, picture, video, canvas, svg) {
|
|
17
|
-
display: block;
|
|
18
|
-
max-width: 100%;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:where(input, button, textarea, select) {
|
|
22
|
-
font: inherit;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:where(h1, h2, h3, h4, h5, h6, p) {
|
|
26
|
-
overflow-wrap: break-word;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* Body */
|
|
30
|
-
:where(html) {
|
|
31
|
-
text-size-adjust: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:where(body) {
|
|
35
|
-
min-height: 100vh;
|
|
36
|
-
background-color: var(--mk-color-bg);
|
|
37
|
-
color: var(--mk-color-text);
|
|
38
|
-
font-family: var(--mk-font-family-sans);
|
|
39
|
-
font-size: var(--mk-font-size-base);
|
|
40
|
-
font-weight: var(--mk-font-weight-regular);
|
|
41
|
-
line-height: var(--mk-font-line-height-normal);
|
|
42
|
-
-webkit-font-smoothing: antialiased;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:where(h1, h2, h3, h4, h5, h6) {
|
|
46
|
-
font-family: var(--mk-font-family-display);
|
|
47
|
-
font-weight: var(--mk-font-weight-semibold);
|
|
48
|
-
line-height: var(--mk-font-line-height-snug);
|
|
49
|
-
letter-spacing: var(--mk-font-letter-spacing-heading);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:where(code, kbd, samp, pre) {
|
|
53
|
-
font-family: var(--mk-font-family-mono);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* Links */
|
|
57
|
-
:where(a) {
|
|
58
|
-
color: var(--mk-color-accent);
|
|
59
|
-
text-decoration-thickness: from-font;
|
|
60
|
-
text-underline-offset: 0.15em;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* Selection */
|
|
64
|
-
::selection {
|
|
65
|
-
background-color: var(--mk-color-accent);
|
|
66
|
-
color: var(--mk-color-on-accent);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Focus ring */
|
|
70
|
-
:where(:focus-visible) {
|
|
71
|
-
outline: 2px solid var(--mk-color-focus-ring);
|
|
72
|
-
outline-offset: 2px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* Reduced motion */
|
|
76
|
-
@media (prefers-reduced-motion: reduce) {
|
|
77
|
-
:where(*, *::before, *::after) {
|
|
78
|
-
animation-duration: 0.01ms !important;
|
|
79
|
-
animation-iteration-count: 1 !important;
|
|
80
|
-
scroll-behavior: auto !important;
|
|
81
|
-
transition-duration: 0.01ms !important;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/* Drafting grid: the one helper class. */
|
|
86
|
-
.mk-grid-bg {
|
|
87
|
-
background-image:
|
|
88
|
-
linear-gradient(var(--mk-color-grid-line) 1px, transparent 1px),
|
|
89
|
-
linear-gradient(90deg, var(--mk-color-grid-line) 1px, transparent 1px);
|
|
90
|
-
background-size: var(--mk-layout-grid-size) var(--mk-layout-grid-size);
|
|
91
|
-
}
|
|
1
|
+
/*! @manjunathhk/design-tokens v1.0.0 */
|
|
2
|
+
/*
|
|
3
|
+
* Opt-in base built only on the tokens. Selectors sit inside :where() so they
|
|
4
|
+
* carry zero specificity and any site rule overrides them.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* Reset */
|
|
8
|
+
:where(*, *::before, *::after) {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:where(body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) {
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:where(img, picture, video, canvas, svg) {
|
|
17
|
+
display: block;
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:where(input, button, textarea, select) {
|
|
22
|
+
font: inherit;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:where(h1, h2, h3, h4, h5, h6, p) {
|
|
26
|
+
overflow-wrap: break-word;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Body */
|
|
30
|
+
:where(html) {
|
|
31
|
+
text-size-adjust: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:where(body) {
|
|
35
|
+
min-height: 100vh;
|
|
36
|
+
background-color: var(--mk-color-bg);
|
|
37
|
+
color: var(--mk-color-text);
|
|
38
|
+
font-family: var(--mk-font-family-sans);
|
|
39
|
+
font-size: var(--mk-font-size-base);
|
|
40
|
+
font-weight: var(--mk-font-weight-regular);
|
|
41
|
+
line-height: var(--mk-font-line-height-normal);
|
|
42
|
+
-webkit-font-smoothing: antialiased;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(h1, h2, h3, h4, h5, h6) {
|
|
46
|
+
font-family: var(--mk-font-family-display);
|
|
47
|
+
font-weight: var(--mk-font-weight-semibold);
|
|
48
|
+
line-height: var(--mk-font-line-height-snug);
|
|
49
|
+
letter-spacing: var(--mk-font-letter-spacing-heading);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:where(code, kbd, samp, pre) {
|
|
53
|
+
font-family: var(--mk-font-family-mono);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Links */
|
|
57
|
+
:where(a) {
|
|
58
|
+
color: var(--mk-color-accent);
|
|
59
|
+
text-decoration-thickness: from-font;
|
|
60
|
+
text-underline-offset: 0.15em;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Selection */
|
|
64
|
+
::selection {
|
|
65
|
+
background-color: var(--mk-color-accent);
|
|
66
|
+
color: var(--mk-color-on-accent);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Focus ring */
|
|
70
|
+
:where(:focus-visible) {
|
|
71
|
+
outline: 2px solid var(--mk-color-focus-ring);
|
|
72
|
+
outline-offset: 2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Reduced motion */
|
|
76
|
+
@media (prefers-reduced-motion: reduce) {
|
|
77
|
+
:where(*, *::before, *::after) {
|
|
78
|
+
animation-duration: 0.01ms !important;
|
|
79
|
+
animation-iteration-count: 1 !important;
|
|
80
|
+
scroll-behavior: auto !important;
|
|
81
|
+
transition-duration: 0.01ms !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Drafting grid: the one helper class. */
|
|
86
|
+
.mk-grid-bg {
|
|
87
|
+
background-image:
|
|
88
|
+
linear-gradient(var(--mk-color-grid-line) 1px, transparent 1px),
|
|
89
|
+
linear-gradient(90deg, var(--mk-color-grid-line) 1px, transparent 1px);
|
|
90
|
+
background-size: var(--mk-layout-grid-size) var(--mk-layout-grid-size);
|
|
91
|
+
}
|
package/dist/fonts.css
CHANGED
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @manjunathhk/design-tokens v1.0.0
|
|
1
|
+
/*! @manjunathhk/design-tokens v1.0.0 */
|
|
2
2
|
@font-face {
|
|
3
3
|
font-family: "IBM Plex Sans";
|
|
4
4
|
font-style: normal;
|
|
@@ -198,93 +198,93 @@
|
|
|
198
198
|
color-scheme: dark;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
/*
|
|
202
|
-
* Opt-in base built only on the tokens. Selectors sit inside :where() so they
|
|
203
|
-
* carry zero specificity and any site rule overrides them.
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
|
-
/* Reset */
|
|
207
|
-
:where(*, *::before, *::after) {
|
|
208
|
-
box-sizing: border-box;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
:where(body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) {
|
|
212
|
-
margin: 0;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
:where(img, picture, video, canvas, svg) {
|
|
216
|
-
display: block;
|
|
217
|
-
max-width: 100%;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
:where(input, button, textarea, select) {
|
|
221
|
-
font: inherit;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
:where(h1, h2, h3, h4, h5, h6, p) {
|
|
225
|
-
overflow-wrap: break-word;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/* Body */
|
|
229
|
-
:where(html) {
|
|
230
|
-
text-size-adjust: 100%;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
:where(body) {
|
|
234
|
-
min-height: 100vh;
|
|
235
|
-
background-color: var(--mk-color-bg);
|
|
236
|
-
color: var(--mk-color-text);
|
|
237
|
-
font-family: var(--mk-font-family-sans);
|
|
238
|
-
font-size: var(--mk-font-size-base);
|
|
239
|
-
font-weight: var(--mk-font-weight-regular);
|
|
240
|
-
line-height: var(--mk-font-line-height-normal);
|
|
241
|
-
-webkit-font-smoothing: antialiased;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
:where(h1, h2, h3, h4, h5, h6) {
|
|
245
|
-
font-family: var(--mk-font-family-display);
|
|
246
|
-
font-weight: var(--mk-font-weight-semibold);
|
|
247
|
-
line-height: var(--mk-font-line-height-snug);
|
|
248
|
-
letter-spacing: var(--mk-font-letter-spacing-heading);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
:where(code, kbd, samp, pre) {
|
|
252
|
-
font-family: var(--mk-font-family-mono);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/* Links */
|
|
256
|
-
:where(a) {
|
|
257
|
-
color: var(--mk-color-accent);
|
|
258
|
-
text-decoration-thickness: from-font;
|
|
259
|
-
text-underline-offset: 0.15em;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/* Selection */
|
|
263
|
-
::selection {
|
|
264
|
-
background-color: var(--mk-color-accent);
|
|
265
|
-
color: var(--mk-color-on-accent);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/* Focus ring */
|
|
269
|
-
:where(:focus-visible) {
|
|
270
|
-
outline: 2px solid var(--mk-color-focus-ring);
|
|
271
|
-
outline-offset: 2px;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/* Reduced motion */
|
|
275
|
-
@media (prefers-reduced-motion: reduce) {
|
|
276
|
-
:where(*, *::before, *::after) {
|
|
277
|
-
animation-duration: 0.01ms !important;
|
|
278
|
-
animation-iteration-count: 1 !important;
|
|
279
|
-
scroll-behavior: auto !important;
|
|
280
|
-
transition-duration: 0.01ms !important;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* Drafting grid: the one helper class. */
|
|
285
|
-
.mk-grid-bg {
|
|
286
|
-
background-image:
|
|
287
|
-
linear-gradient(var(--mk-color-grid-line) 1px, transparent 1px),
|
|
288
|
-
linear-gradient(90deg, var(--mk-color-grid-line) 1px, transparent 1px);
|
|
289
|
-
background-size: var(--mk-layout-grid-size) var(--mk-layout-grid-size);
|
|
290
|
-
}
|
|
201
|
+
/*
|
|
202
|
+
* Opt-in base built only on the tokens. Selectors sit inside :where() so they
|
|
203
|
+
* carry zero specificity and any site rule overrides them.
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
/* Reset */
|
|
207
|
+
:where(*, *::before, *::after) {
|
|
208
|
+
box-sizing: border-box;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:where(body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) {
|
|
212
|
+
margin: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:where(img, picture, video, canvas, svg) {
|
|
216
|
+
display: block;
|
|
217
|
+
max-width: 100%;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
:where(input, button, textarea, select) {
|
|
221
|
+
font: inherit;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
:where(h1, h2, h3, h4, h5, h6, p) {
|
|
225
|
+
overflow-wrap: break-word;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Body */
|
|
229
|
+
:where(html) {
|
|
230
|
+
text-size-adjust: 100%;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
:where(body) {
|
|
234
|
+
min-height: 100vh;
|
|
235
|
+
background-color: var(--mk-color-bg);
|
|
236
|
+
color: var(--mk-color-text);
|
|
237
|
+
font-family: var(--mk-font-family-sans);
|
|
238
|
+
font-size: var(--mk-font-size-base);
|
|
239
|
+
font-weight: var(--mk-font-weight-regular);
|
|
240
|
+
line-height: var(--mk-font-line-height-normal);
|
|
241
|
+
-webkit-font-smoothing: antialiased;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
:where(h1, h2, h3, h4, h5, h6) {
|
|
245
|
+
font-family: var(--mk-font-family-display);
|
|
246
|
+
font-weight: var(--mk-font-weight-semibold);
|
|
247
|
+
line-height: var(--mk-font-line-height-snug);
|
|
248
|
+
letter-spacing: var(--mk-font-letter-spacing-heading);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:where(code, kbd, samp, pre) {
|
|
252
|
+
font-family: var(--mk-font-family-mono);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Links */
|
|
256
|
+
:where(a) {
|
|
257
|
+
color: var(--mk-color-accent);
|
|
258
|
+
text-decoration-thickness: from-font;
|
|
259
|
+
text-underline-offset: 0.15em;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Selection */
|
|
263
|
+
::selection {
|
|
264
|
+
background-color: var(--mk-color-accent);
|
|
265
|
+
color: var(--mk-color-on-accent);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* Focus ring */
|
|
269
|
+
:where(:focus-visible) {
|
|
270
|
+
outline: 2px solid var(--mk-color-focus-ring);
|
|
271
|
+
outline-offset: 2px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Reduced motion */
|
|
275
|
+
@media (prefers-reduced-motion: reduce) {
|
|
276
|
+
:where(*, *::before, *::after) {
|
|
277
|
+
animation-duration: 0.01ms !important;
|
|
278
|
+
animation-iteration-count: 1 !important;
|
|
279
|
+
scroll-behavior: auto !important;
|
|
280
|
+
transition-duration: 0.01ms !important;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Drafting grid: the one helper class. */
|
|
285
|
+
.mk-grid-bg {
|
|
286
|
+
background-image:
|
|
287
|
+
linear-gradient(var(--mk-color-grid-line) 1px, transparent 1px),
|
|
288
|
+
linear-gradient(90deg, var(--mk-color-grid-line) 1px, transparent 1px);
|
|
289
|
+
background-size: var(--mk-layout-grid-size) var(--mk-layout-grid-size);
|
|
290
|
+
}
|
package/dist/tokens.css
CHANGED
package/dist/tokens.d.ts
CHANGED
package/dist/tokens.json
CHANGED
package/dist/tokens.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@manjunathhk/design-tokens",
|
|
3
|
-
"version": "1.0.0
|
|
4
|
-
"description": "Design tokens and a small opt-in base stylesheet shared by Manjunath's websites.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Manjunath Krishnasa",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/manjunathhk/design-tokens.git"
|
|
10
|
-
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"files": [
|
|
13
|
-
"dist"
|
|
14
|
-
],
|
|
15
|
-
"style": "dist/index.css",
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"types": "./dist/tokens.d.ts",
|
|
19
|
-
"style": "./dist/index.css",
|
|
20
|
-
"default": "./dist/tokens.mjs"
|
|
21
|
-
},
|
|
22
|
-
"./index.css": "./dist/index.css",
|
|
23
|
-
"./tokens.css": "./dist/tokens.css",
|
|
24
|
-
"./base.css": "./dist/base.css",
|
|
25
|
-
"./fonts.css": "./dist/fonts.css",
|
|
26
|
-
"./tokens.json": "./dist/tokens.json",
|
|
27
|
-
"./tokens.mjs": {
|
|
28
|
-
"types": "./dist/tokens.d.ts",
|
|
29
|
-
"default": "./dist/tokens.mjs"
|
|
30
|
-
},
|
|
31
|
-
"./_tokens.scss": "./dist/_tokens.scss",
|
|
32
|
-
"./package.json": "./package.json"
|
|
33
|
-
},
|
|
34
|
-
"sideEffects": [
|
|
35
|
-
"*.css"
|
|
36
|
-
],
|
|
37
|
-
"publishConfig": {
|
|
38
|
-
"access": "public",
|
|
39
|
-
"provenance": true
|
|
40
|
-
},
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": ">=24"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"lint": "eslint . && stylelint \"src/**/*.css\" --allow-empty-input && prettier --check .",
|
|
46
|
-
"format": "prettier --write .",
|
|
47
|
-
"typecheck": "tsc --noEmit",
|
|
48
|
-
"test": "vitest run",
|
|
49
|
-
"test:e2e": "playwright test",
|
|
50
|
-
"api-diff": "tsx scripts/api-diff.ts",
|
|
51
|
-
"build": "tsx src/build.ts"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@eslint/js": "^10.0.1",
|
|
55
|
-
"@ibm/plex-mono": "2.5.0",
|
|
56
|
-
"@ibm/plex-sans": "1.1.0",
|
|
57
|
-
"@ibm/plex-sans-condensed": "2.0.0",
|
|
58
|
-
"@playwright/test": "^1.63.0",
|
|
59
|
-
"@types/node": "^24.13.6",
|
|
60
|
-
"eslint": "^10.11.0",
|
|
61
|
-
"prettier": "^3.9.9",
|
|
62
|
-
"sass": "^1.105.0",
|
|
63
|
-
"style-dictionary": "^5.5.5",
|
|
64
|
-
"stylelint": "^17.15.0",
|
|
65
|
-
"stylelint-config-standard": "^40.0.0",
|
|
66
|
-
"tsx": "^4.23.15",
|
|
67
|
-
"typescript": "~6.0.3",
|
|
68
|
-
"typescript-eslint": "^8.70.1",
|
|
69
|
-
"vitest": "^5.0.1"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@manjunathhk/design-tokens",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Design tokens and a small opt-in base stylesheet shared by Manjunath's websites.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Manjunath Krishnasa",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/manjunathhk/design-tokens.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"style": "dist/index.css",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/tokens.d.ts",
|
|
19
|
+
"style": "./dist/index.css",
|
|
20
|
+
"default": "./dist/tokens.mjs"
|
|
21
|
+
},
|
|
22
|
+
"./index.css": "./dist/index.css",
|
|
23
|
+
"./tokens.css": "./dist/tokens.css",
|
|
24
|
+
"./base.css": "./dist/base.css",
|
|
25
|
+
"./fonts.css": "./dist/fonts.css",
|
|
26
|
+
"./tokens.json": "./dist/tokens.json",
|
|
27
|
+
"./tokens.mjs": {
|
|
28
|
+
"types": "./dist/tokens.d.ts",
|
|
29
|
+
"default": "./dist/tokens.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./_tokens.scss": "./dist/_tokens.scss",
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": [
|
|
35
|
+
"*.css"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": true
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=24"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"lint": "eslint . && stylelint \"src/**/*.css\" --allow-empty-input && prettier --check .",
|
|
46
|
+
"format": "prettier --write .",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:e2e": "playwright test",
|
|
50
|
+
"api-diff": "tsx scripts/api-diff.ts",
|
|
51
|
+
"build": "tsx src/build.ts"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^10.0.1",
|
|
55
|
+
"@ibm/plex-mono": "2.5.0",
|
|
56
|
+
"@ibm/plex-sans": "1.1.0",
|
|
57
|
+
"@ibm/plex-sans-condensed": "2.0.0",
|
|
58
|
+
"@playwright/test": "^1.63.0",
|
|
59
|
+
"@types/node": "^24.13.6",
|
|
60
|
+
"eslint": "^10.11.0",
|
|
61
|
+
"prettier": "^3.9.9",
|
|
62
|
+
"sass": "^1.105.0",
|
|
63
|
+
"style-dictionary": "^5.5.5",
|
|
64
|
+
"stylelint": "^17.15.0",
|
|
65
|
+
"stylelint-config-standard": "^40.0.0",
|
|
66
|
+
"tsx": "^4.23.15",
|
|
67
|
+
"typescript": "~6.0.3",
|
|
68
|
+
"typescript-eslint": "^8.70.1",
|
|
69
|
+
"vitest": "^5.0.1"
|
|
70
|
+
}
|
|
71
|
+
}
|