@podoba/tokens 0.0.9 → 0.0.10
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/package.json +2 -1
- package/src/fonts/README.md +18 -0
- package/src/fonts/nc-fontina-variable.woff2 +0 -0
- package/src/fonts.css +40 -0
- package/src/index.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podoba/tokens",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "podoba design tokens — static DTCG tokens.json + generated CSS custom properties. Framework-agnostic.",
|
|
6
6
|
"repository": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": "./src/index.ts",
|
|
17
17
|
"./variables.css": "./src/variables.css",
|
|
18
|
+
"./fonts.css": "./src/fonts.css",
|
|
18
19
|
"./tokens.json": "./src/tokens.json"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Font binaries
|
|
2
|
+
|
|
3
|
+
`@font-face` in [`../fonts.css`](../fonts.css) references the file below by exact
|
|
4
|
+
name. Drop the woff2 here and it's bundled and served by any consumer that
|
|
5
|
+
imports `@podoba/tokens/fonts.css`.
|
|
6
|
+
|
|
7
|
+
NC Fontina is a **variable font** — a single file covers the whole weight axis:
|
|
8
|
+
|
|
9
|
+
| File | Axis | Covers |
|
|
10
|
+
| ---------------------------- | ------- | ------------------------------------------------- |
|
|
11
|
+
| `nc-fontina-variable.woff2` | `wght` | 400 `font-normal` · 500 `font-medium` · 600 `font-semibold` · 700 `font-bold` |
|
|
12
|
+
|
|
13
|
+
The `@font-face` declares `font-weight: 100 900` (a range). Narrow it in
|
|
14
|
+
`fonts.css` to the font's real `wght` axis if it's smaller (e.g. `400 700`).
|
|
15
|
+
|
|
16
|
+
Italics: this upright file only. If NC Fontina has a separate italic file, add a
|
|
17
|
+
second `@font-face` with `font-style: italic`; otherwise the browser synthesizes
|
|
18
|
+
obliques where `italic` is used (e.g. the rich-text editor).
|
|
Binary file
|
package/src/fonts.css
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @podoba/tokens/fonts.css — bundled web fonts for the design system.
|
|
3
|
+
*
|
|
4
|
+
* HAND-AUTHORED (unlike variables.css, which is generated). This file ships the
|
|
5
|
+
* actual font binaries via @font-face and points the family-name token at them,
|
|
6
|
+
* so any consumer gets the real typeface with a single import:
|
|
7
|
+
*
|
|
8
|
+
* import "@podoba/tokens/variables.css";
|
|
9
|
+
* import "@podoba/tokens/fonts.css"; // ← add this alongside variables.css
|
|
10
|
+
*
|
|
11
|
+
* NC Fontina is our primary UI sans. The @font-face `src` uses relative URLs, so
|
|
12
|
+
* bundlers (Vite/webpack/Next) resolve and fingerprint `./fonts/*.woff2` for you.
|
|
13
|
+
* `font-display: swap` renders fallback text immediately and swaps in NC Fontina
|
|
14
|
+
* when it loads — no invisible-text flash.
|
|
15
|
+
*
|
|
16
|
+
* Drop the binary into ./fonts/ as nc-fontina-variable.woff2 (see
|
|
17
|
+
* ./fonts/README.md). This is a VARIABLE font: one file covers the whole weight
|
|
18
|
+
* axis, so `font-weight` is a RANGE. NC Fontina's wght axis is 200–700 (verified
|
|
19
|
+
* via fontTools); the components use font-normal (400), font-medium (500),
|
|
20
|
+
* font-semibold (600), font-bold (700) — all inside that range.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: 'NC Fontina';
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 200 700;
|
|
27
|
+
font-display: swap;
|
|
28
|
+
src: url('./fonts/nc-fontina-variable.woff2') format('woff2');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* Point the family-name token at NC Fontina. This override lives HERE, not in the
|
|
33
|
+
* auto-generated variables.css (which would clobber it on the next token sync).
|
|
34
|
+
* Because fonts.css is imported after variables.css, this :root rule wins the
|
|
35
|
+
* cascade. The fallback stack mirrors the generated --font-sans so metrics stay
|
|
36
|
+
* close before NC Fontina loads / if it fails.
|
|
37
|
+
*/
|
|
38
|
+
:root {
|
|
39
|
+
--font-sans: 'NC Fontina', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
40
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
// `variables.css` and writes it here. Consumers only ever need:
|
|
7
7
|
//
|
|
8
8
|
// import "@podoba/tokens/variables.css"; // the CSS custom properties
|
|
9
|
+
// import "@podoba/tokens/fonts.css"; // @font-face + --font-sans override (NC Fontina)
|
|
9
10
|
// import tokens from "@podoba/tokens/tokens.json"; // raw DTCG (optional)
|
|
10
11
|
//
|
|
12
|
+
// fonts.css is hand-authored (not generated) — it bundles the web fonts and
|
|
13
|
+
// overrides --font-sans; keep it imported AFTER variables.css so the override wins.
|
|
14
|
+
//
|
|
11
15
|
// See ../../EXTRACTION.md → "Coupling to sever #1".
|
|
12
16
|
|
|
13
17
|
export {};
|