@motir/design-system 0.10.1 → 0.12.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/theme.css CHANGED
@@ -135,11 +135,20 @@
135
135
  --color-link-pressed: #005bab;
136
136
 
137
137
  /* ── Typography ─────────────────────────────────────────────────── */
138
- /* CSS variables set by next/font in app/layout.tsx. */
138
+ /* The three role tokens, composed from a pairing chain, a script face and a
139
+ generic tail (MOTIR-7845). Declared here so Tailwind registers the
140
+ font-sans / font-serif / font-mono utilities; the same composition is
141
+ re-declared, unlayered, in the FONT SETS section, which is where it is
142
+ explained. The -source variables are set by next/font in app/fonts.ts. */
139
143
  --font-sans:
140
- var(--font-sans-source, -apple-system), BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
141
- --font-serif: var(--font-serif-source, Georgia), serif;
142
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
144
+ var(--font-sans-pairing, 'Segoe UI'),
145
+ var(--font-script-sans, var(--font-sans-tail, sans-serif)), var(--font-sans-tail, sans-serif);
146
+ --font-serif:
147
+ var(--font-serif-pairing, Georgia), var(--font-script-serif, var(--font-serif-tail, serif)),
148
+ var(--font-serif-tail, serif);
149
+ --font-mono:
150
+ var(--font-mono-pairing, 'SF Mono'), var(--font-script-mono, var(--font-mono-tail, monospace)),
151
+ var(--font-mono-tail, monospace);
143
152
 
144
153
  /* Type scale — Notion-ish hierarchy.
145
154
  Headings (xl and up) default to serif; body defaults to sans. */
@@ -262,6 +271,22 @@
262
271
  --focus-ring-color: var(--color-primary);
263
272
  }
264
273
 
274
+ /* The BASE (motir) pairing's chains for the three roles (MOTIR-7845). Kept
275
+ outside @theme so Tailwind does not mint font-sans-pairing utilities, and
276
+ placed before every [data-type] block so each pairing overrides it. The
277
+ pairing chain names faces only; its generic keywords live in the tail, and
278
+ so do -apple-system and BlinkMacSystemFont, which name the platform's UI font
279
+ with its own CJK cascade (PingFang, Hiragino) and would draw the commonest
280
+ Han glyphs ahead of the font set's face (MOTIR-7880). */
281
+ :root {
282
+ --font-sans-pairing: var(--font-sans-source, 'Segoe UI'), 'Segoe UI', Roboto;
283
+ --font-sans-tail: -apple-system, BlinkMacSystemFont, sans-serif;
284
+ --font-serif-pairing: var(--font-serif-source, Georgia);
285
+ --font-serif-tail: serif;
286
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
287
+ --font-mono-tail: monospace;
288
+ }
289
+
265
290
  /* ═══════════════════════════════════════════════════════════════════════
266
291
  TIER 1 — Dark mode color overrides
267
292
  Activated when [data-theme="dark"] is set on <html> (by the init
@@ -4331,12 +4356,14 @@
4331
4356
 
4332
4357
  /* The `motir` BASE type pairing, re-asserted (MOTIR-3933) — same reason as
4333
4358
  the base palette above. The type axis carries no descendant rules, so these
4334
- three role tokens are the whole of it. */
4359
+ three roles' pairing chains and tails are the whole of it. */
4335
4360
  [data-appearance-scope][data-type='motir'] {
4336
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
4337
- --font-sans:
4338
- var(--font-sans-source, -apple-system), BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4339
- --font-serif: var(--font-serif-source, Georgia), serif;
4361
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
4362
+ --font-mono-tail: monospace;
4363
+ --font-sans-pairing: var(--font-sans-source, 'Segoe UI'), 'Segoe UI', Roboto;
4364
+ --font-sans-tail: -apple-system, BlinkMacSystemFont, sans-serif;
4365
+ --font-serif-pairing: var(--font-serif-source, Georgia);
4366
+ --font-serif-tail: serif;
4340
4367
  }
4341
4368
 
4342
4369
  /* ── Palette: Cobalt (data-palette="cobalt") — Subtask 7.3.49 ───────────────
@@ -4968,17 +4995,18 @@
4968
4995
 
4969
4996
  [data-type='motir-sans'] {
4970
4997
  /* Sans headlines — re-point the editorial serif role at the sans stack. */
4971
- --font-serif:
4972
- var(--font-sans-source, -apple-system), BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4998
+ --font-serif-pairing: var(--font-sans-source, 'Segoe UI'), 'Segoe UI', Roboto;
4999
+ --font-serif-tail: -apple-system, BlinkMacSystemFont, sans-serif;
4973
5000
  /* Re-asserted at the BASE value, not omitted (MOTIR-3933). An omitted role
4974
5001
  inherits the ANCESTOR's, which is invisible on `<html>` and wrong in a
4975
5002
  nested scope: this pairing under a mono ancestor rendered mono. Unlike the
4976
5003
  colour axis there is no `[data-appearance-scope]` layer to fall back
4977
5004
  through — `--font-*` are role tokens, not `--el-*` — so every
4978
5005
  `[data-type]` block must be TOTAL over the three roles. */
4979
- --font-sans:
4980
- var(--font-sans-source, -apple-system), BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4981
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
5006
+ --font-sans-pairing: var(--font-sans-source, 'Segoe UI'), 'Segoe UI', Roboto;
5007
+ --font-sans-tail: -apple-system, BlinkMacSystemFont, sans-serif;
5008
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
5009
+ --font-mono-tail: monospace;
4982
5010
  }
4983
5011
 
4984
5012
  [data-type='motir-mono'] {
@@ -4987,15 +5015,18 @@
4987
5015
  content) re-types to a code-native monospace voice, not just headlines (Yue,
4988
5016
  2026-06-19: the type axis must re-type the whole UI, chrome included). Meta
4989
5017
  already is mono. ONLY --font-* tokens (the disjointness guard). */
4990
- --font-serif: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
4991
- --font-sans: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
5018
+ --font-serif-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
5019
+ --font-serif-tail: monospace;
5020
+ --font-sans-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
5021
+ --font-sans-tail: monospace;
4992
5022
  /* Re-asserted at the BASE value, not omitted (MOTIR-3933). An omitted role
4993
5023
  inherits the ANCESTOR's, which is invisible on `<html>` and wrong in a
4994
5024
  nested scope: this pairing under a mono ancestor rendered mono. Unlike the
4995
5025
  colour axis there is no `[data-appearance-scope]` layer to fall back
4996
5026
  through — `--font-*` are role tokens, not `--el-*` — so every
4997
5027
  `[data-type]` block must be TOTAL over the three roles. */
4998
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
5028
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
5029
+ --font-mono-tail: monospace;
4999
5030
  }
5000
5031
 
5001
5032
  /* ── Palette: Spectrum (data-palette="spectrum") — Subtask 7.3.52 ───────────
@@ -6011,15 +6042,18 @@
6011
6042
  (Yue, 2026-06-19: the type axis must re-type the whole UI, chrome included).
6012
6043
  Meta stays JetBrains Mono (--font-mono). ONLY font tokens here (the
6013
6044
  disjointness guard): no colour (--el / --color) or shape token. */
6014
- --font-serif: var(--font-grotesk-source), ui-sans-serif, system-ui, sans-serif;
6015
- --font-sans: var(--font-grotesk-source), ui-sans-serif, system-ui, sans-serif;
6045
+ --font-serif-pairing: var(--font-grotesk-source);
6046
+ --font-serif-tail: ui-sans-serif, system-ui, sans-serif;
6047
+ --font-sans-pairing: var(--font-grotesk-source);
6048
+ --font-sans-tail: ui-sans-serif, system-ui, sans-serif;
6016
6049
  /* Re-asserted at the BASE value, not omitted (MOTIR-3933). An omitted role
6017
6050
  inherits the ANCESTOR's, which is invisible on `<html>` and wrong in a
6018
6051
  nested scope: this pairing under a mono ancestor rendered mono. Unlike the
6019
6052
  colour axis there is no `[data-appearance-scope]` layer to fall back
6020
6053
  through — `--font-*` are role tokens, not `--el-*` — so every
6021
6054
  `[data-type]` block must be TOTAL over the three roles. */
6022
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
6055
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
6056
+ --font-mono-tail: monospace;
6023
6057
  }
6024
6058
 
6025
6059
  [data-type='editorial'] {
@@ -6030,16 +6064,18 @@
6030
6064
  so the change is a real, visible FACE swap — magazine, considered — not a
6031
6065
  size tweak. ONLY --font-* role tokens here (the disjointness guard): no
6032
6066
  colour (--el/--color) or shape (--radius/--spacing/--shadow) token. */
6033
- --font-serif: var(--font-editorial-source), 'Fraunces', Georgia, serif;
6067
+ --font-serif-pairing: var(--font-editorial-source), 'Fraunces', Georgia;
6068
+ --font-serif-tail: serif;
6034
6069
  /* Re-asserted at the BASE value, not omitted (MOTIR-3933). An omitted role
6035
6070
  inherits the ANCESTOR's, which is invisible on `<html>` and wrong in a
6036
6071
  nested scope: this pairing under a mono ancestor rendered mono. Unlike the
6037
6072
  colour axis there is no `[data-appearance-scope]` layer to fall back
6038
6073
  through — `--font-*` are role tokens, not `--el-*` — so every
6039
6074
  `[data-type]` block must be TOTAL over the three roles. */
6040
- --font-sans:
6041
- var(--font-sans-source, -apple-system), BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
6042
- --font-mono: var(--font-mono-source, ui-monospace), 'SF Mono', Menlo, monospace;
6075
+ --font-sans-pairing: var(--font-sans-source, 'Segoe UI'), 'Segoe UI', Roboto;
6076
+ --font-sans-tail: -apple-system, BlinkMacSystemFont, sans-serif;
6077
+ --font-mono-pairing: var(--font-mono-source, 'SF Mono'), 'SF Mono', Menlo;
6078
+ --font-mono-tail: monospace;
6043
6079
  }
6044
6080
 
6045
6081
  [data-type='mono-technical'] {
@@ -6052,7 +6088,132 @@
6052
6088
  JetBrains mono stack). Only --font-* role tokens are touched — colour
6053
6089
  (--el/--color) and shape (--radius/--spacing) are the other two, independent
6054
6090
  axes (the disjointness guard). */
6055
- --font-serif: var(--font-mono-technical-source, ui-monospace), 'SF Mono', Menlo, monospace;
6056
- --font-mono: var(--font-mono-technical-source, ui-monospace), 'SF Mono', Menlo, monospace;
6057
- --font-sans: var(--font-mono-technical-source, ui-monospace), 'SF Mono', Menlo, monospace;
6091
+ --font-serif-pairing: var(--font-mono-technical-source, 'SF Mono'), 'SF Mono', Menlo;
6092
+ --font-serif-tail: monospace;
6093
+ --font-mono-pairing: var(--font-mono-technical-source, 'SF Mono'), 'SF Mono', Menlo;
6094
+ --font-mono-tail: monospace;
6095
+ --font-sans-pairing: var(--font-mono-technical-source, 'SF Mono'), 'SF Mono', Menlo;
6096
+ --font-sans-tail: monospace;
6097
+ }
6098
+
6099
+ /* ═══════════════════════════════════════════════════════════════════════
6100
+ FONT SETS — the script face behind the pairing (Story MOTIR-7733 · MOTIR-7845)
6101
+ A Type pairing (the [data-type] blocks above) decides each role's LATIN
6102
+ faces. A font set decides the SCRIPT face that sits BEHIND them, chosen by
6103
+ the language of the element: on <html lang="ja" data-type="editorial">
6104
+ --font-serif resolves to Fraunces (Latin glyphs), then the ja set's serif
6105
+ face (kana and kanji), then the generic tail.
6106
+
6107
+ The two axes are composed ONCE, in the rule below, from three tokens per
6108
+ role, so neither axis multiplies the other:
6109
+ --font-<role>-pairing the pairing's named faces, with NO generic keyword.
6110
+ A generic (serif, sans-serif, system-ui, ui-*) maps
6111
+ to one system font, which on a CJK system covers
6112
+ CJK and would pre-empt the set's face.
6113
+ --font-script-<role> the set's face for the language (the blocks below).
6114
+ --font-<role>-tail the pairing's generic tail, as it was before.
6115
+
6116
+ Every name in this section comes from packages/design-system/src/theme/
6117
+ fontSets.ts (FONT_SET_REGISTRY, LOCALE_FONT_SET, fontSetMemberVar). The
6118
+ consuming app's next/font loader assigns the --font-set-* variables; this
6119
+ file assigns none of them. motir.co imports this file and loads no CJK
6120
+ face, so every var() here carries a fallback: an undefined variable without
6121
+ one would make the whole font-family invalid at computed time, and the
6122
+ pairing's Latin face would be lost with it.
6123
+
6124
+ Only --font-* custom properties are set here: no @font-face, no
6125
+ unicode-range, no colour or shape token.
6126
+ ═══════════════════════════════════════════════════════════════════════ */
6127
+
6128
+ /* The composition. A custom property's var() is resolved on the element that
6129
+ DECLARES it, so every element that can change one of the inputs (a pairing,
6130
+ a language, a picked member) re-composes the three roles itself. */
6131
+ :root,
6132
+ [data-type],
6133
+ [lang],
6134
+ [data-font-set-sans],
6135
+ [data-font-set-serif],
6136
+ [data-font-set-mono] {
6137
+ --font-sans:
6138
+ var(--font-sans-pairing, 'Segoe UI'),
6139
+ var(--font-script-sans, var(--font-sans-tail, sans-serif)), var(--font-sans-tail, sans-serif);
6140
+ --font-serif:
6141
+ var(--font-serif-pairing, Georgia), var(--font-script-serif, var(--font-serif-tail, serif)),
6142
+ var(--font-serif-tail, serif);
6143
+ --font-mono:
6144
+ var(--font-mono-pairing, 'SF Mono'), var(--font-script-mono, var(--font-mono-tail, monospace)),
6145
+ var(--font-mono-tail, monospace);
6146
+ }
6147
+
6148
+ /* The script token is declared only on an element that carries a lang
6149
+ attribute, and every element below it INHERITS the value. `:lang()` alone
6150
+ would match every descendant and re-declare the set's default on each one,
6151
+ so a nested [data-type] preview inside a page with a picked member would
6152
+ re-compose with the default and lose the pick.
6153
+
6154
+ Latin: no script face. `initial` makes the token the guaranteed-invalid
6155
+ value, so the composition's fallback (the pairing's own tail) takes the slot
6156
+ and the stack equals the pairing's stack exactly. Listed per locale so a
6157
+ Latin-language element nested in a CJK page resets. A page whose language no
6158
+ set lists matches no block and also gets Latin, as resolveFontSet falls
6159
+ back. */
6160
+ [lang]:lang(en),
6161
+ [lang]:lang(de),
6162
+ [lang]:lang(fr),
6163
+ [lang]:lang(es),
6164
+ [lang]:lang(it),
6165
+ [lang]:lang(nl),
6166
+ [lang]:lang(pl),
6167
+ [lang]:lang(pt) {
6168
+ --font-script-sans: initial;
6169
+ --font-script-serif: initial;
6170
+ --font-script-mono: initial;
6171
+ }
6172
+
6173
+ /* Simplified Chinese (zh-Hans): each role's default member. A CJK mono role
6174
+ draws its Han glyphs from the set's sans face (fontSets.ts sameFaceAs), so
6175
+ the block stays total over the three roles while loading no extra face. */
6176
+ [lang]:lang(zh) {
6177
+ --font-script-sans: var(--font-set-zh-Hans-sans-noto-sans-sc, sans-serif);
6178
+ --font-script-serif: var(--font-set-zh-Hans-serif-noto-serif-sc, serif);
6179
+ --font-script-mono: var(--font-set-zh-Hans-sans-noto-sans-sc, monospace);
6180
+ }
6181
+
6182
+ /* A member picked by name. Comes after the set's block, so on an element
6183
+ carrying both a lang and the attribute this one wins the specificity tie.
6184
+ An id the registry does not list matches nothing and keeps the default. */
6185
+ :lang(zh)[data-font-set-serif='lxgw-wenkai-tc'] {
6186
+ --font-script-serif: var(--font-set-zh-Hans-serif-lxgw-wenkai-tc, serif);
6187
+ }
6188
+
6189
+ /* Japanese (ja): each role's default member. A CJK mono role
6190
+ draws its Han glyphs from the set's sans face (fontSets.ts sameFaceAs), so
6191
+ the block stays total over the three roles while loading no extra face. */
6192
+ [lang]:lang(ja) {
6193
+ --font-script-sans: var(--font-set-ja-sans-noto-sans-jp, sans-serif);
6194
+ --font-script-serif: var(--font-set-ja-serif-noto-serif-jp, serif);
6195
+ --font-script-mono: var(--font-set-ja-sans-noto-sans-jp, monospace);
6196
+ }
6197
+
6198
+ /* A member picked by name. Comes after the set's block, so on an element
6199
+ carrying both a lang and the attribute this one wins the specificity tie.
6200
+ An id the registry does not list matches nothing and keeps the default. */
6201
+ :lang(ja)[data-font-set-sans='m-plus-rounded-1c'] {
6202
+ --font-script-sans: var(--font-set-ja-sans-m-plus-rounded-1c, sans-serif);
6203
+ }
6204
+
6205
+ /* Korean (ko): each role's default member. A CJK mono role
6206
+ draws its Han glyphs from the set's sans face (fontSets.ts sameFaceAs), so
6207
+ the block stays total over the three roles while loading no extra face. */
6208
+ [lang]:lang(ko) {
6209
+ --font-script-sans: var(--font-set-ko-sans-noto-sans-kr, sans-serif);
6210
+ --font-script-serif: var(--font-set-ko-serif-noto-serif-kr, serif);
6211
+ --font-script-mono: var(--font-set-ko-sans-noto-sans-kr, monospace);
6212
+ }
6213
+
6214
+ /* A member picked by name. Comes after the set's block, so on an element
6215
+ carrying both a lang and the attribute this one wins the specificity tie.
6216
+ An id the registry does not list matches nothing and keeps the default. */
6217
+ :lang(ko)[data-font-set-sans='nanum-gothic'] {
6218
+ --font-script-sans: var(--font-set-ko-sans-nanum-gothic, sans-serif);
6058
6219
  }