@cosxai/ui 0.3.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/styles/fonts.css +34 -20
- package/src/styles/tokens.css +31 -4
package/package.json
CHANGED
package/src/styles/fonts.css
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/* Web-font loading for the kit's typographic vocabulary.
|
|
2
|
+
Loaded from Google Fonts CDN — Geist + Geist Mono cover the
|
|
3
|
+
default sans/mono slots; Playfair Display drives the editorial
|
|
4
|
+
chrome's display heading; Caveat covers the sketch chrome's
|
|
5
|
+
handwritten display; Noto Serif SC is the matching CJK serif for
|
|
6
|
+
the editorial heading so a name like "本杰明 Zoë" renders Latin in
|
|
7
|
+
Playfair Display and Chinese in Noto Serif SC without leaking to
|
|
8
|
+
PingFang SC / SimSun (sans-serif system fallbacks that mis-pair
|
|
9
|
+
with the editorial high-contrast serif). All five are SIL OFL.
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Why Google Fonts CDN over self-hosting:
|
|
12
|
+
1. Self-hosted /fonts/*.otf had to be shipped per-consumer
|
|
13
|
+
(the previous setup), and consumers that forgot returned
|
|
14
|
+
SPA index.html for the font URL, surfacing a noisy
|
|
15
|
+
"Failed to decode downloaded font" warning in every
|
|
16
|
+
production console.
|
|
17
|
+
2. The CDN handles font-display, variable-font subsetting,
|
|
18
|
+
and per-browser format selection automatically; we just
|
|
19
|
+
consume the @import.
|
|
20
|
+
3. font-display=swap means the system fallback paints first,
|
|
21
|
+
the web font upgrades on arrival — no FOIT.
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
Bandwidth shape — Noto Serif SC is the only large family in the
|
|
24
|
+
set (CJK fonts dwarf Latin by character count). Google Fonts ships
|
|
25
|
+
it as ~100 unicode-range subsets; the browser only fetches a
|
|
26
|
+
subset when a character in its range is rendered. Pure-Latin
|
|
27
|
+
pages pay the CSS file (~5-10KB gzip) but no .woff2 — pages with
|
|
28
|
+
Chinese names pay an additional ~200-400KB of subset binaries
|
|
29
|
+
spread across the few CJK ranges they actually use.
|
|
30
|
+
|
|
31
|
+
For offline / enterprise deploys that block Google Fonts, a
|
|
32
|
+
consumer can override --ck-font-sans/serif/mono in tokens.css
|
|
33
|
+
to fall back entirely to the system-font slot at the tail of
|
|
34
|
+
each stack. */
|
|
35
|
+
|
|
36
|
+
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300..700&family=Geist+Mono:wght@400..700&family=Playfair+Display:wght@400..900&family=Caveat:wght@400..700&family=Noto+Serif+SC:wght@400..900&display=swap");
|
package/src/styles/tokens.css
CHANGED
|
@@ -13,10 +13,37 @@
|
|
|
13
13
|
serif (editorial body), and display (headlines). By default
|
|
14
14
|
display = sans so headings inherit the same neutral grotesk;
|
|
15
15
|
editorial chrome overrides display → serif to flip headlines
|
|
16
|
-
to a high-contrast serif without touching component code.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
to a high-contrast serif without touching component code.
|
|
17
|
+
|
|
18
|
+
Each stack ends with CJK system-font fallbacks before the
|
|
19
|
+
generic family so 中文 / 日本語 / 한국어 don't drop to the
|
|
20
|
+
browser's last-resort glyph (renders as tofu on locked-down
|
|
21
|
+
hosts). Browsers do per-character fallback — Latin hits
|
|
22
|
+
Geist/Playfair, CJK hits the next matching family in the stack.
|
|
23
|
+
|
|
24
|
+
Serif slot ALSO carries Noto Serif SC as a web-font fallback
|
|
25
|
+
(loaded via fonts.css). Reason: the editorial chrome's display
|
|
26
|
+
heading uses Playfair Display, a high-contrast modern serif —
|
|
27
|
+
pairing it with PingFang SC / SimSun (the system *sans-serif*
|
|
28
|
+
CJK fallbacks) reads as a style break. Adobe/Google's Noto Serif
|
|
29
|
+
SC matches Playfair's serif vocabulary cross-platform without
|
|
30
|
+
depending on the user having Songti SC / STSong / Source Han
|
|
31
|
+
Serif SC installed locally. Cost is lazy: subset .woff2 only
|
|
32
|
+
downloads when a CJK character is actually rendered (per
|
|
33
|
+
fonts.css's unicode-range mechanism); pure-Latin pages pay only
|
|
34
|
+
the small CSS file.
|
|
35
|
+
|
|
36
|
+
Sans + mono slots stay system-only — system sans CJK
|
|
37
|
+
(PingFang SC / Microsoft YaHei) is what users expect for UI
|
|
38
|
+
copy, and the visual mismatch concern doesn't apply when the
|
|
39
|
+
Latin half is also a clean grotesk. */
|
|
40
|
+
--ck-font-sans: "Geist", "Inter", system-ui, -apple-system,
|
|
41
|
+
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
|
|
42
|
+
"Source Han Sans SC", sans-serif;
|
|
43
|
+
--ck-font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo,
|
|
44
|
+
"Sarasa Mono SC", monospace;
|
|
45
|
+
--ck-font-serif: "Playfair Display", "Noto Serif SC", "GT Sectra", "Canela",
|
|
46
|
+
Georgia, "Songti SC", "STSong", "Source Han Serif SC", serif;
|
|
20
47
|
--ck-font-display: var(--ck-font-sans);
|
|
21
48
|
|
|
22
49
|
/* ---------- Radii / motion ---------- */
|