@nebutra/fonts 2.0.0 → 4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
1
  # @nebutra/fonts
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @nebutra/brand@4.0.0
9
+
10
+ ## 3.0.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies []:
15
+ - @nebutra/brand@3.0.0
16
+
3
17
  ## 2.0.0
package/NOTICE-FONTS.md CHANGED
@@ -2,18 +2,38 @@
2
2
 
3
3
  This package's MIT licence covers **first-party code only**.
4
4
 
5
- ## Noto Sans SC
5
+ ## MiSans
6
6
 
7
- 本软件使用了 **Noto Sans SC** 字体。
8
- This software uses the **Noto Sans SC** typeface.
7
+ 本软件使用了 **MiSans** 字体(小米科技有限责任公司)。
8
+ This software uses the **MiSans** typeface by Xiaomi.
9
9
 
10
- Noto Sans SC is licensed under the SIL Open Font License 1.1. The licence
11
- text is `vendor/noto-sans-sc/OFL.txt`.
10
+ MiSans is free for commercial use and may be embedded in software on the
11
+ condition that the software states it uses MiSans (this notice, and the
12
+ landing site's /credits page, which every public footer links to). The font may not be distributed on its own or
13
+ have its appearance altered. Licence text: `vendor/misans/LICENSE.txt`.
12
14
 
13
- Generated `.woff2` subsets stay in this workspace for first-party apps so
14
- `next/font/local` can load them offline. They are **not** included in the npm
15
- `files` list and must not be published. Downstream npm consumers do not receive
16
- font binaries from this package.
15
+ ## DM Sans
17
16
 
18
- Do not add `generated/*.woff2` or other font binaries to a publishable `files`
19
- glob.
17
+ This software uses the **DM Sans** typeface, licensed under the SIL Open Font
18
+ License 1.1. Licence text: `vendor/dm-sans/OFL.txt`.
19
+
20
+ ## Theme / DESIGN.md registry faces
21
+
22
+ `src/next.ts` loads 19 faces from `@fontsource-variable/*` npm packages
23
+ (Fontsource, version 5.3.0), each licensed under the **SIL Open Font License
24
+ 1.1**, which permits use, embedding and redistribution, including bundling with
25
+ software: Inter, Inter Tight, Space Grotesk, Playfair Display, Source Serif 4,
26
+ Fraunces, JetBrains Mono, Manrope, Sora, Work Sans, DM Sans, Plus Jakarta Sans,
27
+ Outfit, Figtree, Montserrat, Lexend, Fira Code, Roboto Mono, Source Code Pro.
28
+ Each package carries its licence text (`LICENSE`) and copyright notice; the
29
+ font binaries are not copied into this package — they are installed as
30
+ dependencies and emitted into the app's build by `next/font/local`.
31
+
32
+ ## Distribution
33
+
34
+ The DM Sans subset (`generated/dm-sans.woff2`) is committed so
35
+ `next/font/local` can load it offline; it is **not** in the npm `files` list.
36
+ MiSans subsets are never committed at all: the licence forbids distributing
37
+ the font on its own, so they are uploaded to the deployment's asset CDN and
38
+ `<CjkFontFace />` points at them. Do not add `generated/*.woff2` or other font
39
+ binaries to a publishable `files` glob.
package/README.md CHANGED
@@ -4,8 +4,8 @@ Status: **WIP** — not yet published to npm.
4
4
 
5
5
  The Simplified-Chinese face is wired into every Next app that loads Geist (web,
6
6
  landing, design-docs, sailor-docs, admin, forge, router, sleptons, typelens,
7
- mail-preview). The theme / DESIGN.md registry (the ~16 Google faces) is still used
8
- only by `apps/web`.
7
+ mail-preview). The theme / DESIGN.md registry (19 OSS faces) is applied by
8
+ `apps/web`, `apps/landing` and `apps/design`.
9
9
 
10
10
  Self-hosted fonts for Nebutra: the CJK body face, plus an OSS font registry for
11
11
  themes and imported DESIGN.md font families.
@@ -19,9 +19,10 @@ The package has three entries:
19
19
  also keeps it working in a network-sandboxed dev server. **This is the one every
20
20
  app needs.**
21
21
  - `@nebutra/fonts/next` is server-only and declares the build-time
22
- `next/font/google` registry faces plus the combined registry class name. It
23
- re-exports the CJK face, but importing it just for that would drag ~16 Google
24
- font downloads into the app — use `./next/cjk`.
22
+ registry faces (`next/font/local` over `@fontsource-variable/*` packages — no
23
+ network at build or dev time) plus the combined registry class name. It
24
+ re-exports the CJK face, but importing it just for that would pull 19 faces
25
+ into the app's CSS — use `./next/cjk`.
25
26
 
26
27
  ## Installation
27
28
 
@@ -54,18 +55,14 @@ const stack = withRegistryFont("Space Grotesk, sans-serif");
54
55
  // "var(--font-space-grotesk), Space Grotesk, sans-serif"
55
56
  ```
56
57
 
57
- ## Simplified Chinese — self-hosted Noto Sans SC
58
+ ## Brand faces — DM Sans (headings) and MiSans (Chinese)
58
59
 
59
- Geist has no CJK coverage at all, so without a CJK face every Chinese character
60
- falls back to whatever the OS supplies: PingFang on macOS, Microsoft YaHei on
61
- Windows, something else again on Android. Chinese copy is a first-class surface
62
- in this product (see `docs/microcopy/`), so the CJK face is self-hosted and
63
- subset here.
60
+ Chosen 2026-09-25 by measuring what competitors ship: MiniMax and Moonshot set
61
+ Chinese in MiSans, DeepSeek and Databricks set Latin in DM Sans. Geist stays the
62
+ body/UI face for its tabular figures.
64
63
 
65
64
  ### Wiring an app
66
65
 
67
- Two lines in the root layout, beside the Geist loaders:
68
-
69
66
  ```tsx
70
67
  import { cjkFontClassName } from "@nebutra/fonts/next/cjk";
71
68
  import { GeistMono } from "geist/font/mono";
@@ -74,28 +71,38 @@ import { GeistSans } from "geist/font/sans";
74
71
  <html className={`${GeistSans.variable} ${GeistMono.variable} ${cjkFontClassName}`}>
75
72
  ```
76
73
 
77
- That defines `--font-noto-sans-sc`. Nothing else is needed: the token stacks in
78
- `@nebutra/tokens` (`--font-sans`, `--font-cn`, `--font-display`, `--font-heading`)
79
- already reference the variable in the right position. The app also needs
80
- `"@nebutra/fonts"` in `dependencies` and in `transpilePackages` (the package ships
81
- TypeScript source).
82
-
83
- Do **not** re-declare `--font-sans` and friends downstream. `@nebutra/ui`'s
84
- `typography/fonts.css` used to, and being the later import its Geist-only copies
85
- won, so the CJK half of the token stack never reached `--font-sans` at all. That
86
- duplication is gone; the file now only carries derived aliases.
74
+ `cjkFontClassName` defines `--font-dm-sans` (self-hosted variable subset, SIL
75
+ OFL). MiSans arrives through `<CjkFontFace />` from the same entry — render it
76
+ once in the root layout. It builds the `@font-face` rules at render time from
77
+ the committed keys and `publicAssetUrl()` (`NEXT_PUBLIC_R2_PUBLIC_URL`, then
78
+ `R2_PUBLIC_URL`, then the brand's `cdn` origin), so no host is hardcoded and a
79
+ scaffold resolves to its own CDN. The token stacks in `@nebutra/tokens` already
80
+ reference both. Non-Next hosts (Storybook) import `@nebutra/fonts/font-face` and
81
+ pass `origin` explicitly.
82
+
83
+ ### Why MiSans is on the CDN, not in this package
84
+
85
+ The MiSans licence allows free commercial use and embedding **with attribution**,
86
+ but forbids distributing the font software on its own. This repository is public
87
+ and mirrored as a template, so committing the subsets would distribute them —
88
+ the reason vivo Sans was removed (b5e73db35). `pnpm subset:cjk --upload` writes
89
+ content-hashed subsets to the bucket behind your public asset origin
90
+ (`MISANS_R2_BUCKET`, under `fonts/misans/`) and commits only their keys. Until
91
+ they are uploaded, or offline, the requests fail and the stack falls back to
92
+ PingFang / YaHei. The product states it uses MiSans on the landing site's
93
+ `/credits` page, linked from every public footer — the licence asks for the
94
+ statement, not a footer line (see NOTICE-FONTS.md; guarded by
95
+ `tests/architecture/font-license.test.ts`).
87
96
 
88
97
  ### Stack order is the design decision
89
98
 
90
99
  ```css
91
- font-family: var(--font-geist-sans), "Geist", var(--font-noto-sans-sc), "Noto Sans SC", …;
100
+ font-family: var(--font-geist-sans), "Geist", var(--font-misans, "MiSans"), …;
92
101
  ```
93
102
 
94
- Geist comes **first** and keeps Latin and the numerals — its tabular figures and
95
- tighter x-height are what dense dashboard tables need, and it is the locked UI
96
- face. Noto Sans SC takes CJK. Both faces cover Latin, so the *order* is what
97
- decides: reversed, Noto would take the Latin too, and its Latin is not as
98
- good as Geist's for UI.
103
+ The Latin face comes **first** and keeps Latin and the numerals; MiSans takes
104
+ CJK. Both cover Latin, so the order decides: reversed, MiSans would take the
105
+ Latin too.
99
106
 
100
107
  Belt and braces: the generated `@font-face` rules carry a `unicode-range` with
101
108
  no Latin, no ASCII and no general-punctuation codepoints in it, so a Latin-only
@@ -105,40 +112,37 @@ wrong way round. Geist Mono remains the code face.
105
112
  ### Building the subsets
106
113
 
107
114
  ```bash
108
- FONTTOOLS_PYTHON=/path/to/python \
109
- pnpm --filter @nebutra/fonts subset:cjk -- --force
115
+ FONTTOOLS_PYTHON=/path/to/python MISANS_ZIP=/path/to/MiSans.zip \
116
+ pnpm --filter @nebutra/fonts subset:cjk -- --force --upload
110
117
  ```
111
118
 
112
- Requires Python with `fontTools` and `brotli` (for `--flavor=woff2`).
113
- The script downloads the OFL Noto Sans SC variable face, instances 400 / 500 /
114
- 600 / 700, then subsets. Outputs land in `generated/`. The committed woff2
115
- files are the SIL OFL Noto Sans SC chinese-simplified faces used by
116
- `next/font/local` so a clean clone does not need fontTools to render text.
117
-
118
- ### Why three weights
119
-
120
- The design system's numeric slots are `--font-weight-medium: 500` and
121
- `--font-weight-heading: 600` (`packages/design/tokens/recipe.css`), and the token
122
- CSS writes literal `font-weight` in only four values: 500 (43×), 600 (35×),
123
- 400 (27×), 700 (10×). So 400 / 500 / 600 ship. 700 resolves to the 600 face by
124
- normal CSS font matching, and because that matched face is itself ≥ 600 no
125
- browser applies synthetic bold — which is precisely why the third face is
126
- DemiBold 600 rather than Bold 700. Choosing 700 instead would leave the *default*
127
- heading weight, the most common heading value in the system, a step out of place.
128
- Skin-declared fractional weights (300 / 450 / 510) resolve into the same set.
129
- Each weight costs ~490 KB, so shipping all nine static faces would be ~4.4 MB.
119
+ Requires Python with `fontTools` and `brotli` (for `--flavor=woff2`) and a
120
+ logged-in `wrangler`. Without `MISANS_ZIP` the script downloads Xiaomi's official
121
+ package (`MISANS_ZIP_URL`). It subsets the static Regular / Medium / Semibold /
122
+ Bold faces, names each output by content hash, and with `--upload` puts them in
123
+ R2 (`MISANS_R2_BUCKET`) with an immutable cache header. Only `index.ts` (the
124
+ keys) and the manifest are committed; the woff2 files are gitignored. A hash change means a new URL, so
125
+ the CDN never serves a stale face. The bucket's CORS allowlist lives in
126
+ `infra/iac/cloudflare/r2/cors.json`: an app on a new origin gets no MiSans (the
127
+ stack silently falls back to PingFang) until its origin is added there.
128
+
129
+ ### Why four weights
130
+
131
+ `--font-weight-heading` is 500 (`packages/design/tokens/recipe.css`), body is
132
+ 400, and the token CSS writes literal 600 and 700 as well. Each static face
133
+ costs ~525 KB, and `unicode-range` plus per-weight `@font-face` means a page
134
+ only downloads the weights it renders.
130
135
 
131
136
  ### Why the static faces, not the variable one
132
137
 
133
138
  A variable CJK font carries per-weight deltas for every glyph it keeps, so one
134
- variable file costs more than the static weights a page actually uses. The
135
- pipeline instances 400 / 500 / 600 / 700 and subsets each one.
139
+ variable file costs more than the static weights a page actually uses.
136
140
 
137
141
  ### Character set
138
142
 
139
- Three inputs, unioned — 4,282 characters in the current build:
143
+ Three inputs, unioned — 4,330 characters in the current build:
140
144
 
141
- 1. **The zh catalogs, by glob** (1,586 chars) — every `zh*.json` under any
145
+ 1. **The zh catalogs, by glob** (1,662 chars) — every `zh*.json` under any
142
146
  `messages/` or `locales/` directory, walked at build time, so new Chinese copy
143
147
  is covered on the next run instead of drifting away from a hardcoded list.
144
148
  2. **CJK punctuation and fullwidth forms, wholesale** (197 chars) — U+3000–303F,
@@ -158,46 +162,53 @@ Three inputs, unioned — 4,282 characters in the current build:
158
162
  characters that appear in a fraction of a percent of text, which is exactly
159
163
  what OS fallback is for.
160
164
 
161
- The floor is what costs the bytes: the catalog set alone subsets to 191,108 B per
162
- weight, the full set to ~498,000 B.
163
-
164
- > Possible follow-up, measured but **not** implemented here: splitting each
165
- > weight into a hot tier (catalogs + punctuation, 1,777 chars, 197,028 B) and an
166
- > extended tier (the GB2312 remainder, 2,509 chars, 312,644 B) with complementary
167
- > `unicode-range`s would drop the common path from ~1.47 MB to ~591 KB across
168
- > three weights, and only fetch the extended tier when user data actually renders
169
- > a character outside our own copy. It costs two files per weight and (on the
170
- > `next/font/local` path) a per-tier `declarations` entry to carry the range.
171
-
172
165
  ### Vendored sources
173
166
 
174
- `vendor/noto-sans-sc/OFL.txt` is committed. Full source TTFs are downloaded by
175
- `subset:cjk` and gitignored. Do not commit unmodified CJK source faces.
167
+ `vendor/misans/LICENSE.txt` (licence text and the FAQ answers on embedding) and
168
+ `vendor/dm-sans/OFL.txt` are committed. The MiSans zip and TTFs are gitignored.
169
+ Never commit a MiSans binary: the licence forbids distributing it on its own.
176
170
 
177
171
  ## Third-party font attribution
178
172
 
179
- 本软件使用了 **Noto Sans SC** 字体。
180
- This software uses the **Noto Sans SC** typeface.
173
+ 本产品使用了小米 **MiSans** 字体。
174
+ This product uses the **MiSans** typeface by Xiaomi.
181
175
 
182
- Noto Sans SC is licensed under the SIL Open Font License 1.1
183
- (`vendor/noto-sans-sc/OFL.txt`). That licence is separate from this package's
184
- MIT licence, which applies to first-party code only. Generated `.woff2` files
185
- stay in the workspace for first-party apps and are excluded from the npm
186
- tarball. See `NOTICE-FONTS.md`.
176
+ MiSans is free for commercial use under the MiSans Font Intellectual Property
177
+ License Agreement, which requires this attribution
178
+ (`vendor/misans/LICENSE.txt`). DM Sans is SIL OFL 1.1 (`vendor/dm-sans/OFL.txt`).
179
+ Both licences are separate from this package's MIT licence. See
180
+ `NOTICE-FONTS.md`.
187
181
 
188
182
  ## Registered Families
189
183
 
190
- The registry includes Geist, Inter, Space Grotesk, Playfair Display, JetBrains
191
- Mono, Manrope, Sora, Work Sans, DM Sans, Plus Jakarta Sans, Outfit, Figtree,
192
- Montserrat, Lexend, Fira Code, Roboto Mono, and Source Code Pro.
184
+ The registry includes Geist, Inter, Inter Tight, Space Grotesk, Playfair
185
+ Display, Source Serif 4, Fraunces, JetBrains Mono, Manrope, Sora, Work Sans, DM
186
+ Sans, Plus Jakarta Sans, Outfit, Figtree, Montserrat, Lexend, Fira Code, Roboto
187
+ Mono, and Source Code Pro.
193
188
 
194
189
  ## Runtime Model
195
190
 
196
- `next/font` downloads and self-hosts Google fonts at build time. At runtime,
197
- the browser requests fonts from the application origin only when an element
198
- uses the corresponding CSS variable.
191
+ Every face is a file that arrives with `pnpm install`: the registry loads the
192
+ Latin, upright, `wght`-axis variable build from its `@fontsource-variable/*`
193
+ package through `next/font/local`, so `next build` and `next dev` never contact
194
+ fonts.googleapis.com / fonts.gstatic.com. That matters wherever Google is
195
+ unreachable — mainland China, corporate proxies, offline machines — where
196
+ `next/font/google` failed the build and made the Turbopack dev server answer
197
+ 500. npm packages come through any registry mirror (npmmirror in China).
198
+
199
+ The files are Google Fonts' own builds as republished by Fontsource (same font
200
+ version, same axis; shaping checked glyph by glyph against what
201
+ `next/font/google` downloaded) and the `@font-face` family names are Google's,
202
+ so pages render pixel-identically. Only the Latin subset is shipped — the one
203
+ the registry declared and preloaded; characters outside it fall back to the
204
+ metric-matched system font. `scripts/lint-no-google-fonts.mjs` (in `pnpm lint`)
205
+ keeps `next/font/google` out of every file the template ships.
206
+
207
+ At runtime the browser requests fonts from the application origin only when an
208
+ element uses the corresponding CSS variable.
199
209
 
200
210
  ## License
201
211
 
202
- MIT for first-party code. Noto Sans SC binaries are SIL OFL 1.1 and are not
203
- published to npm.
212
+ MIT for first-party code. DM Sans and every registry face are SIL OFL 1.1
213
+ (see `NOTICE-FONTS.md`). MiSans binaries are never
214
+ committed or published to npm; they are served from the deployment's asset CDN.
@@ -0,0 +1,38 @@
1
+ import {
2
+ MISANS_FAMILY,
3
+ MISANS_FILES,
4
+ MISANS_UNICODE_RANGE
5
+ } from "./chunk-FUPJK5RT.js";
6
+
7
+ // src/next-cjk.ts
8
+ import localFont from "next/font/local";
9
+
10
+ // src/cjk-font-face.tsx
11
+ import { publicAssetUrl } from "@nebutra/brand/metadata-helpers";
12
+ import { jsx } from "react/jsx-runtime";
13
+ function misansFontFaceCss(origin) {
14
+ return MISANS_FILES.map(
15
+ (face) => `@font-face{font-family:"${MISANS_FAMILY}";font-style:normal;font-weight:${face.weight};font-display:swap;src:url("${publicAssetUrl(face.key, origin)}") format("woff2");unicode-range:${MISANS_UNICODE_RANGE}}`
16
+ ).join("\n");
17
+ }
18
+ function CjkFontFace({ origin, nonce }) {
19
+ return /* @__PURE__ */ jsx("style", { href: "nebutra-misans", precedence: "default", nonce: nonce || void 0, children: misansFontFaceCss(origin) });
20
+ }
21
+
22
+ // src/next-cjk.ts
23
+ var dmSans = localFont({
24
+ src: [{ path: "../generated/dm-sans.woff2", weight: "100 1000", style: "normal" }],
25
+ display: "swap",
26
+ variable: "--font-dm-sans"
27
+ });
28
+ var brandFontClassName = dmSans.variable;
29
+ var cjkFontClassName = brandFontClassName;
30
+
31
+ export {
32
+ misansFontFaceCss,
33
+ CjkFontFace,
34
+ dmSans,
35
+ brandFontClassName,
36
+ cjkFontClassName
37
+ };
38
+ //# sourceMappingURL=chunk-A4PPXTH5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next-cjk.ts","../src/cjk-font-face.tsx"],"sourcesContent":["/**\n * @nebutra/fonts/next/cjk — the self-hosted brand faces (server-only).\n *\n * The Latin brand face lives here through `next/font/local` so first-party apps work\n * offline, in CI and in the network sandbox (the registry in `./next` is local too):\n *\n * - MiSans — the Simplified-Chinese face — is CDN-hosted; see <CjkFontFace /> below.\n * - DM Sans — the Latin display/heading face (SIL OFL). Chosen the same day\n * from the same measurement (DeepSeek, Databricks). Body/UI Latin stays\n * Geist: its tabular figures are what dense dashboard tables need.\n *\n * WHY A SEPARATE ENTRY FROM `./next`: that module declares 19\n * faces for the theme / DESIGN.md registry; importing it for the brand faces\n * would put all of them into every app's CSS. `./next`\n * re-exports this file, so an app already applying `fontRegistryClassName`\n * still needs one import.\n *\n * next/font is a compile-time transform: SWC statically analyses the call, so\n * the options object is spelled out as a literal.\n */\n\nimport localFont from \"next/font/local\";\n\n/**\n * MiSans is NOT loaded here: its licence forbids distributing the font on its\n * own and this repository is public (vivo Sans was removed for the same reason,\n * b5e73db35). The subsets are served from the deployment's asset CDN and\n * declared by <CjkFontFace />, re-exported below — render it in the root\n * layout next to this class name. The token stacks reference\n * var(--font-misans, \"MiSans\"): with no variable set, the literal family name\n * resolves to that @font-face.\n */\nexport { CjkFontFace, misansFontFaceCss } from \"./cjk-font-face\";\n\n/**\n * DM Sans — one variable file (opsz 9–40, wght 100–1000), Latin subset, 67KB.\n * Preloaded: headings render above the fold on most pages.\n */\nexport const dmSans = localFont({\n src: [{ path: \"../generated/dm-sans.woff2\", weight: \"100 1000\", style: \"normal\" }],\n display: \"swap\",\n variable: \"--font-dm-sans\",\n});\n\n/**\n * Apply to <html> next to the Geist loaders so `--font-dm-sans` exists:\n *\n * className={`${GeistSans.variable} ${GeistMono.variable} ${cjkFontClassName}`}\n *\n * The name predates DM Sans; it now carries both brand faces so every app that\n * already applies it picks them up without a layout change.\n */\nexport const brandFontClassName = dmSans.variable;\nexport const cjkFontClassName = brandFontClassName;\n","/**\n * MiSans @font-face, rendered at request time rather than shipped as CSS.\n *\n * The MiSans licence forbids distributing the font on its own and this\n * repository is public, so the subsets live in the deployment's public asset\n * bucket and only their keys are committed (../generated/index.ts). A static\n * stylesheet would have to spell out a host, and the host differs per\n * deployment: Nebutra's CDN for Nebutra, the scaffold's own for a template\n * user. publicAssetUrl() resolves it the way it resolves every other public\n * asset — NEXT_PUBLIC_R2_PUBLIC_URL, then R2_PUBLIC_URL, then the brand's cdn\n * origin.\n *\n * Before the subsets have been uploaded (a fresh scaffold, `pnpm subset:cjk\n * --upload` not yet run) the requests 404 and the token stacks fall through to\n * PingFang / YaHei. That is the intended degraded state, not an error.\n */\n\nimport { publicAssetUrl } from \"@nebutra/brand/metadata-helpers\";\nimport { MISANS_FAMILY, MISANS_FILES, MISANS_UNICODE_RANGE } from \"../generated/index\";\n\n/** One @font-face per weight, CJK-only unicode-range, `swap` so text is never invisible. */\nexport function misansFontFaceCss(origin?: string): string {\n return MISANS_FILES.map(\n (face) =>\n `@font-face{font-family:\"${MISANS_FAMILY}\";font-style:normal;font-weight:${face.weight};` +\n `font-display:swap;src:url(\"${publicAssetUrl(face.key, origin)}\") format(\"woff2\");` +\n `unicode-range:${MISANS_UNICODE_RANGE}}`,\n ).join(\"\\n\");\n}\n\nexport interface CjkFontFaceProps {\n /** Asset origin override; defaults to the publicAssetUrl() resolution. */\n origin?: string;\n /**\n * CSP nonce, for apps whose style-src allows inline styles only by nonce\n * (apps/web). Without it the whole @font-face block is refused. The page's\n * font-src must also allow publicAssetOrigin().\n */\n nonce?: string;\n}\n\n/**\n * Render once in each root layout, next to `cjkFontClassName` on <html>.\n * React 19 hoists a `<style>` carrying `href` + `precedence` into <head> and\n * dedupes it by `href`, so rendering it twice costs nothing.\n */\nexport function CjkFontFace({ origin, nonce }: CjkFontFaceProps) {\n return (\n <style href=\"nebutra-misans\" precedence=\"default\" nonce={nonce || undefined}>\n {misansFontFaceCss(origin)}\n </style>\n );\n}\n"],"mappings":";;;;;;;AAqBA,OAAO,eAAe;;;ACJtB,SAAS,sBAAsB;AA+B3B;AA3BG,SAAS,kBAAkB,QAAyB;AACzD,SAAO,aAAa;AAAA,IAClB,CAAC,SACC,2BAA2B,aAAa,mCAAmC,KAAK,MAAM,+BACxD,eAAe,KAAK,KAAK,MAAM,CAAC,oCAC7C,oBAAoB;AAAA,EACzC,EAAE,KAAK,IAAI;AACb;AAkBO,SAAS,YAAY,EAAE,QAAQ,MAAM,GAAqB;AAC/D,SACE,oBAAC,WAAM,MAAK,kBAAiB,YAAW,WAAU,OAAO,SAAS,QAC/D,4BAAkB,MAAM,GAC3B;AAEJ;;;ADdO,IAAM,SAAS,UAAU;AAAA,EAC9B,KAAK,CAAC,EAAE,MAAM,8BAA8B,QAAQ,YAAY,OAAO,SAAS,CAAC;AAAA,EACjF,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAUM,IAAM,qBAAqB,OAAO;AAClC,IAAM,mBAAmB;","names":[]}
@@ -0,0 +1,20 @@
1
+ // generated/index.ts
2
+ var MISANS_VARIABLE = "--font-misans";
3
+ var MISANS_FAMILY = "MiSans";
4
+ var MISANS_CHAR_COUNT = 4330;
5
+ var MISANS_UNICODE_RANGE = "U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF";
6
+ var MISANS_FILES = [
7
+ { key: "fonts/misans/misans-400.6bf25dfdf3.woff2", weight: "400", bytes: 535408 },
8
+ { key: "fonts/misans/misans-500.442041bb9d.woff2", weight: "500", bytes: 537060 },
9
+ { key: "fonts/misans/misans-600.2590c17c53.woff2", weight: "600", bytes: 540540 },
10
+ { key: "fonts/misans/misans-700.ddd8bf8017.woff2", weight: "700", bytes: 545728 }
11
+ ];
12
+
13
+ export {
14
+ MISANS_VARIABLE,
15
+ MISANS_FAMILY,
16
+ MISANS_CHAR_COUNT,
17
+ MISANS_UNICODE_RANGE,
18
+ MISANS_FILES
19
+ };
20
+ //# sourceMappingURL=chunk-FUPJK5RT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../generated/index.ts"],"sourcesContent":["/**\n * GENERATED FILE, DO NOT EDIT.\n * Written by packages/design/fonts/scripts/subset-cjk.mjs.\n *\n * Metadata for the CDN-hosted MiSans subsets. <CjkFontFace /> in\n * ../src/cjk-font-face.tsx turns it into @font-face rules at render time.\n *\n * The registry key is \"misans\" (see FONT_REGISTRY in ../src/index.ts);\n * the CSS variable is \"--font-misans\".\n */\n\nexport const MISANS_VARIABLE = \"--font-misans\" as const;\n\nexport const MISANS_FAMILY = \"MiSans\" as const;\n\n/** Characters covered per face (catalogs ∪ CJK punctuation ∪ GB2312 level-1). */\nexport const MISANS_CHAR_COUNT = 4330 as const;\n\n/** `unicode-range` of every generated @font-face — CJK only, no Latin. */\nexport const MISANS_UNICODE_RANGE = \"U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF\" as const;\n\n/** Public-asset keys, one per weight (content-hashed names). No host: see publicAssetUrl(). */\nexport const MISANS_FILES = [\n { key: \"fonts/misans/misans-400.6bf25dfdf3.woff2\", weight: \"400\", bytes: 535408 },\n { key: \"fonts/misans/misans-500.442041bb9d.woff2\", weight: \"500\", bytes: 537060 },\n { key: \"fonts/misans/misans-600.2590c17c53.woff2\", weight: \"600\", bytes: 540540 },\n { key: \"fonts/misans/misans-700.ddd8bf8017.woff2\", weight: \"700\", bytes: 545728 },\n] as const;\n"],"mappings":";AAWO,IAAM,kBAAkB;AAExB,IAAM,gBAAgB;AAGtB,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB;AAG7B,IAAM,eAAe;AAAA,EAC1B,EAAE,KAAK,4CAA4C,QAAQ,OAAO,OAAO,OAAO;AAAA,EAChF,EAAE,KAAK,4CAA4C,QAAQ,OAAO,OAAO,OAAO;AAAA,EAChF,EAAE,KAAK,4CAA4C,QAAQ,OAAO,OAAO,OAAO;AAAA,EAChF,EAAE,KAAK,4CAA4C,QAAQ,OAAO,OAAO,OAAO;AAClF;","names":[]}
@@ -1,36 +1,36 @@
1
1
  /**
2
- * GENERATED FILE — face metadata for `@nebutra/fonts/next/cjk`.
3
- * Current binaries are SIL OFL Noto Sans SC (chinese-simplified) woff2 files.
4
- * Rebuild with `pnpm --filter @nebutra/fonts subset:cjk` when FONTTOOLS_PYTHON
5
- * is available, or replace the woff2 files from an OFL source.
2
+ * GENERATED FILE, DO NOT EDIT.
3
+ * Written by packages/design/fonts/scripts/subset-cjk.mjs.
4
+ *
5
+ * Metadata for the CDN-hosted MiSans subsets. <CjkFontFace /> in
6
+ * ../src/cjk-font-face.tsx turns it into @font-face rules at render time.
7
+ *
8
+ * The registry key is "misans" (see FONT_REGISTRY in ../src/index.ts);
9
+ * the CSS variable is "--font-misans".
6
10
  */
7
- declare const NOTO_SANS_SC_VARIABLE: "--font-noto-sans-sc";
8
- declare const NOTO_SANS_SC_FAMILY: "Noto Sans SC";
11
+ declare const MISANS_VARIABLE: "--font-misans";
12
+ declare const MISANS_FAMILY: "MiSans";
9
13
  /** Characters covered per face (catalogs ∪ CJK punctuation ∪ GB2312 level-1). */
10
- declare const NOTO_SANS_SC_CHAR_COUNT: 4282;
14
+ declare const MISANS_CHAR_COUNT: 4330;
11
15
  /** `unicode-range` of every generated @font-face — CJK only, no Latin. */
12
- declare const NOTO_SANS_SC_UNICODE_RANGE: "U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF";
13
- /** Sources for `next/font/local({ src: [...] })`, paths relative to this file. */
14
- declare const NOTO_SANS_SC_SOURCES: readonly [{
15
- readonly path: "./noto-sans-sc-400.woff2";
16
+ declare const MISANS_UNICODE_RANGE: "U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF";
17
+ /** Public-asset keys, one per weight (content-hashed names). No host: see publicAssetUrl(). */
18
+ declare const MISANS_FILES: readonly [{
19
+ readonly key: "fonts/misans/misans-400.6bf25dfdf3.woff2";
16
20
  readonly weight: "400";
17
- readonly style: "normal";
18
- readonly bytes: 1142552;
21
+ readonly bytes: 535408;
19
22
  }, {
20
- readonly path: "./noto-sans-sc-500.woff2";
23
+ readonly key: "fonts/misans/misans-500.442041bb9d.woff2";
21
24
  readonly weight: "500";
22
- readonly style: "normal";
23
- readonly bytes: 1159128;
25
+ readonly bytes: 537060;
24
26
  }, {
25
- readonly path: "./noto-sans-sc-600.woff2";
27
+ readonly key: "fonts/misans/misans-600.2590c17c53.woff2";
26
28
  readonly weight: "600";
27
- readonly style: "normal";
28
- readonly bytes: 1162352;
29
+ readonly bytes: 540540;
29
30
  }, {
30
- readonly path: "./noto-sans-sc-700.woff2";
31
+ readonly key: "fonts/misans/misans-700.ddd8bf8017.woff2";
31
32
  readonly weight: "700";
32
- readonly style: "normal";
33
- readonly bytes: 1172244;
33
+ readonly bytes: 545728;
34
34
  }];
35
35
 
36
- export { NOTO_SANS_SC_CHAR_COUNT, NOTO_SANS_SC_FAMILY, NOTO_SANS_SC_SOURCES, NOTO_SANS_SC_UNICODE_RANGE, NOTO_SANS_SC_VARIABLE };
36
+ export { MISANS_CHAR_COUNT, MISANS_FAMILY, MISANS_FILES, MISANS_UNICODE_RANGE, MISANS_VARIABLE };
@@ -1,19 +1,15 @@
1
- // generated/index.ts
2
- var NOTO_SANS_SC_VARIABLE = "--font-noto-sans-sc";
3
- var NOTO_SANS_SC_FAMILY = "Noto Sans SC";
4
- var NOTO_SANS_SC_CHAR_COUNT = 4282;
5
- var NOTO_SANS_SC_UNICODE_RANGE = "U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF";
6
- var NOTO_SANS_SC_SOURCES = [
7
- { path: "./noto-sans-sc-400.woff2", weight: "400", style: "normal", bytes: 1142552 },
8
- { path: "./noto-sans-sc-500.woff2", weight: "500", style: "normal", bytes: 1159128 },
9
- { path: "./noto-sans-sc-600.woff2", weight: "600", style: "normal", bytes: 1162352 },
10
- { path: "./noto-sans-sc-700.woff2", weight: "700", style: "normal", bytes: 1172244 }
11
- ];
1
+ import {
2
+ MISANS_CHAR_COUNT,
3
+ MISANS_FAMILY,
4
+ MISANS_FILES,
5
+ MISANS_UNICODE_RANGE,
6
+ MISANS_VARIABLE
7
+ } from "../chunk-FUPJK5RT.js";
12
8
  export {
13
- NOTO_SANS_SC_CHAR_COUNT,
14
- NOTO_SANS_SC_FAMILY,
15
- NOTO_SANS_SC_SOURCES,
16
- NOTO_SANS_SC_UNICODE_RANGE,
17
- NOTO_SANS_SC_VARIABLE
9
+ MISANS_CHAR_COUNT,
10
+ MISANS_FAMILY,
11
+ MISANS_FILES,
12
+ MISANS_UNICODE_RANGE,
13
+ MISANS_VARIABLE
18
14
  };
19
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../generated/index.ts"],"sourcesContent":["/**\n * GENERATED FILE — face metadata for `@nebutra/fonts/next/cjk`.\n * Current binaries are SIL OFL Noto Sans SC (chinese-simplified) woff2 files.\n * Rebuild with `pnpm --filter @nebutra/fonts subset:cjk` when FONTTOOLS_PYTHON\n * is available, or replace the woff2 files from an OFL source.\n */\n\nexport const NOTO_SANS_SC_VARIABLE = \"--font-noto-sans-sc\" as const;\n\nexport const NOTO_SANS_SC_FAMILY = \"Noto Sans SC\" as const;\n\n/** Characters covered per face (catalogs ∪ CJK punctuation ∪ GB2312 level-1). */\nexport const NOTO_SANS_SC_CHAR_COUNT = 4282 as const;\n\n/** `unicode-range` of every generated @font-face — CJK only, no Latin. */\nexport const NOTO_SANS_SC_UNICODE_RANGE =\n \"U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF\" as const;\n\n/** Sources for `next/font/local({ src: [...] })`, paths relative to this file. */\nexport const NOTO_SANS_SC_SOURCES = [\n { path: \"./noto-sans-sc-400.woff2\", weight: \"400\", style: \"normal\", bytes: 1142552 },\n { path: \"./noto-sans-sc-500.woff2\", weight: \"500\", style: \"normal\", bytes: 1159128 },\n { path: \"./noto-sans-sc-600.woff2\", weight: \"600\", style: \"normal\", bytes: 1162352 },\n { path: \"./noto-sans-sc-700.woff2\", weight: \"700\", style: \"normal\", bytes: 1172244 },\n] as const;\n"],"mappings":";AAOO,IAAM,wBAAwB;AAE9B,IAAM,sBAAsB;AAG5B,IAAM,0BAA0B;AAGhC,IAAM,6BACX;AAGK,IAAM,uBAAuB;AAAA,EAClC,EAAE,MAAM,4BAA4B,QAAQ,OAAO,OAAO,UAAU,OAAO,QAAQ;AAAA,EACnF,EAAE,MAAM,4BAA4B,QAAQ,OAAO,OAAO,UAAU,OAAO,QAAQ;AAAA,EACnF,EAAE,MAAM,4BAA4B,QAAQ,OAAO,OAAO,UAAU,OAAO,QAAQ;AAAA,EACnF,EAAE,MAAM,4BAA4B,QAAQ,OAAO,OAAO,UAAU,OAAO,QAAQ;AACrF;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.js CHANGED
@@ -4,11 +4,12 @@ var FONT_REGISTRY = {
4
4
  geist: "--font-geist-sans",
5
5
  "geist sans": "--font-geist-sans",
6
6
  "geist mono": "--font-geist-mono",
7
- // Self-hosted via next/font/local from the subset built in ./generated (see
8
- // ./next-cjk). The Simplified-Chinese face — CJK only via unicode-range, so it
9
- // cannot take Latin away from Geist.
10
- "noto sans sc": "--font-noto-sans-sc",
11
- // Self-hosted via next/font/google (see ./next)
7
+ // Self-hosted via next/font/local (see ./next-cjk). MiSans is the
8
+ // Simplified-Chinese face — CJK only via unicode-range, so it cannot take
9
+ // Latin away from Geist. DM Sans is the Latin display/heading face.
10
+ misans: "--font-misans",
11
+ "dm sans display": "--font-dm-sans",
12
+ // Self-hosted via next/font/local over @fontsource-variable/* (see ./next)
12
13
  inter: "--font-inter",
13
14
  "inter tight": "--font-reg-inter-tight",
14
15
  "space grotesk": "--font-space-grotesk",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @nebutra/fonts — self-hosted OSS font registry (client-safe entry).\n *\n * Maps a normalized theme / DESIGN.md font-family name to the CSS variable that\n * the build-time self-hosted face defines (declared with next/font in\n * `@nebutra/fonts/next`, applied to <html> via `fontRegistryClassName`).\n *\n * WHY: next/font registers each face under a HASHED family name reachable ONLY\n * via its CSS variable — `font-family: 'Inter'` does NOT use the self-hosted\n * Inter. So when a theme / imported DESIGN.md font's primary family matches an\n * entry here, callers prepend `var(--font-…)` to the stack, making the\n * self-hosted font actually render — with ZERO runtime external requests\n * (next/font self-hosts at build time) and next/font's automatic metric-matched\n * fallback (no layout shift). Unmatched families keep their declared stack.\n *\n * This entry is FREE of `next/font` imports so client modules can use it.\n * The `./next` subpath holds the (server-only) next/font declarations and MUST\n * keep its CSS-variable names in sync with FONT_REGISTRY below.\n */\n\nexport const FONT_REGISTRY: Record<string, string> = {\n // Self-hosted via geist/font (default brand faces, loaded by the app shell)\n geist: \"--font-geist-sans\",\n \"geist sans\": \"--font-geist-sans\",\n \"geist mono\": \"--font-geist-mono\",\n // Self-hosted via next/font/local from the subset built in ./generated (see\n // ./next-cjk). The Simplified-Chinese face — CJK only via unicode-range, so it\n // cannot take Latin away from Geist.\n \"noto sans sc\": \"--font-noto-sans-sc\",\n // Self-hosted via next/font/google (see ./next)\n inter: \"--font-inter\",\n \"inter tight\": \"--font-reg-inter-tight\",\n \"space grotesk\": \"--font-space-grotesk\",\n \"playfair display\": \"--font-playfair-display\",\n fraunces: \"--font-reg-fraunces\",\n \"source serif 4\": \"--font-reg-source-serif-4\",\n \"jetbrains mono\": \"--font-jetbrains-mono\",\n manrope: \"--font-reg-manrope\",\n sora: \"--font-reg-sora\",\n \"work sans\": \"--font-reg-work-sans\",\n \"dm sans\": \"--font-reg-dm-sans\",\n \"plus jakarta sans\": \"--font-reg-plus-jakarta-sans\",\n outfit: \"--font-reg-outfit\",\n figtree: \"--font-reg-figtree\",\n montserrat: \"--font-reg-montserrat\",\n lexend: \"--font-reg-lexend\",\n \"fira code\": \"--font-reg-fira-code\",\n \"roboto mono\": \"--font-reg-roboto-mono\",\n \"source code pro\": \"--font-reg-source-code-pro\",\n};\n\n/** Normalize a single font-family token: strip quotes/whitespace, lowercase. */\nfunction normalizeFamily(name: string): string {\n // Strip ALL quotes with a quantifier-free global replace (quotes only appear\n // at token boundaries in a font-family value). Avoids the end-anchored /['\"]+$/\n // form, which CodeQL flags as polynomial ReDoS (scanned from every position).\n return name.replace(/['\"]/g, \"\").trim().toLowerCase();\n}\n\n/** The first (primary) family in a CSS font-family list, normalized. */\nexport function primaryFamily(stack: string): string {\n return normalizeFamily(stack.split(\",\")[0] ?? \"\");\n}\n\n/** Registry CSS variable for a stack's primary family, or undefined. */\nexport function resolveRegistryVar(stack: string): string | undefined {\n return FONT_REGISTRY[primaryFamily(stack)];\n}\n\n/**\n * Return `stack` with the self-hosted registry font prepended when its primary\n * family is registered; otherwise return it unchanged.\n * e.g. \"Space Grotesk, sans-serif\" → \"var(--font-space-grotesk), Space Grotesk, sans-serif\"\n */\nexport function withRegistryFont(stack: string | undefined): string | undefined {\n if (!stack) return stack;\n const variable = resolveRegistryVar(stack);\n return variable ? `var(${variable}), ${stack}` : stack;\n}\n\n/**\n * Like `withRegistryFont`, but matches the first registered family ANYWHERE in\n * the stack rather than only in first position.\n *\n * A brand package names the typeface the design language actually uses, and\n * those are frequently licensed faces we have no right to serve — Söhne, Mori,\n * Lyon Text, Reckless. The declared stack already says what to do when they are\n * absent: fall to the next family. But \"the next family\" is usually a bare name\n * like `Inter`, which does NOT reach next/font's hashed face, so the stack\n * skidded past every self-hosted option and landed on `ui-sans-serif`. All\n * seven built-in design languages rendered in the system font until 2026-08-18.\n *\n * Prepending the nearest registered family produces exactly the outcome the\n * declared chain intended, and leaves the licensed names in place so a customer\n * who does own the font still gets it by shipping the face themselves.\n */\nexport function withNearestRegistryFont(stack: string | undefined): string | undefined {\n if (!stack) return stack;\n for (const token of stack.split(\",\")) {\n const variable = FONT_REGISTRY[normalizeFamily(token)];\n if (variable) return `var(${variable}), ${stack}`;\n }\n return stack;\n}\n"],"mappings":";AAoBO,IAAM,gBAAwC;AAAA;AAAA,EAEnD,OAAO;AAAA,EACP,cAAc;AAAA,EACd,cAAc;AAAA;AAAA;AAAA;AAAA,EAId,gBAAgB;AAAA;AAAA,EAEhB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,mBAAmB;AACrB;AAGA,SAAS,gBAAgB,MAAsB;AAI7C,SAAO,KAAK,QAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY;AACtD;AAGO,SAAS,cAAc,OAAuB;AACnD,SAAO,gBAAgB,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE;AAClD;AAGO,SAAS,mBAAmB,OAAmC;AACpE,SAAO,cAAc,cAAc,KAAK,CAAC;AAC3C;AAOO,SAAS,iBAAiB,OAA+C;AAC9E,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,WAAW,mBAAmB,KAAK;AACzC,SAAO,WAAW,OAAO,QAAQ,MAAM,KAAK,KAAK;AACnD;AAkBO,SAAS,wBAAwB,OAA+C;AACrF,MAAI,CAAC,MAAO,QAAO;AACnB,aAAW,SAAS,MAAM,MAAM,GAAG,GAAG;AACpC,UAAM,WAAW,cAAc,gBAAgB,KAAK,CAAC;AACrD,QAAI,SAAU,QAAO,OAAO,QAAQ,MAAM,KAAK;AAAA,EACjD;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @nebutra/fonts — self-hosted OSS font registry (client-safe entry).\n *\n * Maps a normalized theme / DESIGN.md font-family name to the CSS variable that\n * the build-time self-hosted face defines (declared with next/font in\n * `@nebutra/fonts/next`, applied to <html> via `fontRegistryClassName`).\n *\n * WHY: next/font registers each face under a HASHED family name reachable ONLY\n * via its CSS variable — `font-family: 'Inter'` does NOT use the self-hosted\n * Inter. So when a theme / imported DESIGN.md font's primary family matches an\n * entry here, callers prepend `var(--font-…)` to the stack, making the\n * self-hosted font actually render — with ZERO runtime external requests\n * (next/font self-hosts at build time) and next/font's automatic metric-matched\n * fallback (no layout shift). Unmatched families keep their declared stack.\n *\n * This entry is FREE of `next/font` imports so client modules can use it.\n * The `./next` subpath holds the (server-only) next/font declarations and MUST\n * keep its CSS-variable names in sync with FONT_REGISTRY below.\n */\n\nexport const FONT_REGISTRY: Record<string, string> = {\n // Self-hosted via geist/font (default brand faces, loaded by the app shell)\n geist: \"--font-geist-sans\",\n \"geist sans\": \"--font-geist-sans\",\n \"geist mono\": \"--font-geist-mono\",\n // Self-hosted via next/font/local (see ./next-cjk). MiSans is the\n // Simplified-Chinese face — CJK only via unicode-range, so it cannot take\n // Latin away from Geist. DM Sans is the Latin display/heading face.\n misans: \"--font-misans\",\n \"dm sans display\": \"--font-dm-sans\",\n // Self-hosted via next/font/local over @fontsource-variable/* (see ./next)\n inter: \"--font-inter\",\n \"inter tight\": \"--font-reg-inter-tight\",\n \"space grotesk\": \"--font-space-grotesk\",\n \"playfair display\": \"--font-playfair-display\",\n fraunces: \"--font-reg-fraunces\",\n \"source serif 4\": \"--font-reg-source-serif-4\",\n \"jetbrains mono\": \"--font-jetbrains-mono\",\n manrope: \"--font-reg-manrope\",\n sora: \"--font-reg-sora\",\n \"work sans\": \"--font-reg-work-sans\",\n \"dm sans\": \"--font-reg-dm-sans\",\n \"plus jakarta sans\": \"--font-reg-plus-jakarta-sans\",\n outfit: \"--font-reg-outfit\",\n figtree: \"--font-reg-figtree\",\n montserrat: \"--font-reg-montserrat\",\n lexend: \"--font-reg-lexend\",\n \"fira code\": \"--font-reg-fira-code\",\n \"roboto mono\": \"--font-reg-roboto-mono\",\n \"source code pro\": \"--font-reg-source-code-pro\",\n};\n\n/** Normalize a single font-family token: strip quotes/whitespace, lowercase. */\nfunction normalizeFamily(name: string): string {\n // Strip ALL quotes with a quantifier-free global replace (quotes only appear\n // at token boundaries in a font-family value). Avoids the end-anchored /['\"]+$/\n // form, which CodeQL flags as polynomial ReDoS (scanned from every position).\n return name.replace(/['\"]/g, \"\").trim().toLowerCase();\n}\n\n/** The first (primary) family in a CSS font-family list, normalized. */\nexport function primaryFamily(stack: string): string {\n return normalizeFamily(stack.split(\",\")[0] ?? \"\");\n}\n\n/** Registry CSS variable for a stack's primary family, or undefined. */\nexport function resolveRegistryVar(stack: string): string | undefined {\n return FONT_REGISTRY[primaryFamily(stack)];\n}\n\n/**\n * Return `stack` with the self-hosted registry font prepended when its primary\n * family is registered; otherwise return it unchanged.\n * e.g. \"Space Grotesk, sans-serif\" → \"var(--font-space-grotesk), Space Grotesk, sans-serif\"\n */\nexport function withRegistryFont(stack: string | undefined): string | undefined {\n if (!stack) return stack;\n const variable = resolveRegistryVar(stack);\n return variable ? `var(${variable}), ${stack}` : stack;\n}\n\n/**\n * Like `withRegistryFont`, but matches the first registered family ANYWHERE in\n * the stack rather than only in first position.\n *\n * A brand package names the typeface the design language actually uses, and\n * those are frequently licensed faces we have no right to serve — Söhne, Mori,\n * Lyon Text, Reckless. The declared stack already says what to do when they are\n * absent: fall to the next family. But \"the next family\" is usually a bare name\n * like `Inter`, which does NOT reach next/font's hashed face, so the stack\n * skidded past every self-hosted option and landed on `ui-sans-serif`. All\n * seven built-in design languages rendered in the system font until 2026-08-18.\n *\n * Prepending the nearest registered family produces exactly the outcome the\n * declared chain intended, and leaves the licensed names in place so a customer\n * who does own the font still gets it by shipping the face themselves.\n */\nexport function withNearestRegistryFont(stack: string | undefined): string | undefined {\n if (!stack) return stack;\n for (const token of stack.split(\",\")) {\n const variable = FONT_REGISTRY[normalizeFamily(token)];\n if (variable) return `var(${variable}), ${stack}`;\n }\n return stack;\n}\n"],"mappings":";AAoBO,IAAM,gBAAwC;AAAA;AAAA,EAEnD,OAAO;AAAA,EACP,cAAc;AAAA,EACd,cAAc;AAAA;AAAA;AAAA;AAAA,EAId,QAAQ;AAAA,EACR,mBAAmB;AAAA;AAAA,EAEnB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,mBAAmB;AACrB;AAGA,SAAS,gBAAgB,MAAsB;AAI7C,SAAO,KAAK,QAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY;AACtD;AAGO,SAAS,cAAc,OAAuB;AACnD,SAAO,gBAAgB,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE;AAClD;AAGO,SAAS,mBAAmB,OAAmC;AACpE,SAAO,cAAc,cAAc,KAAK,CAAC;AAC3C;AAOO,SAAS,iBAAiB,OAA+C;AAC9E,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,WAAW,mBAAmB,KAAK;AACzC,SAAO,WAAW,OAAO,QAAQ,MAAM,KAAK,KAAK;AACnD;AAkBO,SAAS,wBAAwB,OAA+C;AACrF,MAAI,CAAC,MAAO,QAAO;AACnB,aAAW,SAAS,MAAM,MAAM,GAAG,GAAG;AACpC,UAAM,WAAW,cAAc,gBAAgB,KAAK,CAAC;AACrD,QAAI,SAAU,QAAO,OAAO,QAAQ,MAAM,KAAK;AAAA,EACjD;AACA,SAAO;AACT;","names":[]}