fix(fonts): semantic typography utilities per handoff (7 roles)

Заменяет blanket override из MR !45 на типизированную type scale per
design_handoff_ordinis_mdm/README.md "Scale" section.

Семь semantic @utility в styles.css:
  text-title-xl  22/600   — modal title, section header
  text-title-lg  17/600   — page title в editor
  text-title-md  15/600   — dictionary card title
  text-body      13/400   — workhorse: body, buttons, tabs, inputs
  text-cell      12.5/500 — table cell text
  text-mono      11/500   — Mono: IDs, dates, FK refs (font-mono baked in)
  text-cap       10.5/600 — Tektur UPPERCASE caption (font/uppercase baked in)

Audit phases:
  P1: добавил 7 утилит, font/uppercase/tracking baked где надо
  P2: 43 deterministic codemods (font-mono+text-2xs/[11px] → text-mono,
      [15/17/22]px+font-semibold → text-title-*, [12.5]px → text-cell,
      [10.5]px+uppercase+tracking → text-cap)
  P3: 64 text-sm → text-body (handoff workhorse), 84 text-2xs context-aware
      (TableCell → text-cell, bare → text-cell, плюс cleanup caps в backticks
      template literals который Phase 2 пропустил), 25 text-xs (6 → text-mono
      когда с font-mono, 19 → text-cell), 8 titles text-base/lg → text-title-*
  P4: убрал --text-2xs override (no users), оставил --text-sm: 13px scoped
      к @nstart/ui passthrough (см. comment в styles.css — убирается в Stage 3.9)

Stats:
  text-body: 69 | text-cell: 99 | text-mono: 50 | text-cap: 42
  text-title-xl: 5 | text-title-lg: 5 | text-title-md: 7
  text-sm/text-2xs/text-xs в src/: 0 (только в styles.css комментариях)

Поведение всех 277 typography usages теперь явно соответствует handoff —
каждое место осознанно выбрано под роль, не плажирующий override.
This commit is contained in:
Zimin A.N.
2026-05-11 14:31:35 +03:00
parent e62633d903
commit b94912789f
46 changed files with 296 additions and 243 deletions
+69 -15
View File
@@ -146,32 +146,86 @@
--font-mono: 'JetBrains Mono', 'SF Mono', monospace;
--font-display: 'Tektur', 'Inter', sans-serif;
/* Font sizes per design_handoff_ordinis_mdm/README.md spec.
* Override Tailwind defaults так чтобы существующие utility classes
* автоматически соответствовали handoff:
* text-sm : 13px (workhorse — body, buttons, tabs)
* text-xs : 12px (default, без изменений — secondary meta)
* text-2xs : 11px (custom — IDs, dates, table mono meta)
* Tektur caps 10.5px → используй .cap или text-cap utility (отдельно).
* Table cells 12.5px / page titles 17px / modal titles 22px — explicit
* через text-[Npx] arbitrary value по месту. */
/* Font scale.
*
* Наши собственные классы — семантические @utility ниже (text-body,
* text-cell, text-mono, text-title-*, text-cap). Каждая роль = место в UI.
*
* --text-sm: 13px — нужно потому что @nstart/ui dist внутри использует
* text-sm для buttons/inputs/forms (см. @source выше). Без этого override
* библиотечные компоненты ушли бы к Tailwind default 14px и разошлись с
* нашим handoff workhorse 13px. После Stage 3.9 (pnpm remove @nstart/ui)
* этот override можно убрать — наш код text-sm не использует.
*
* --text-2xs override НЕ нужен: убрали все usage в audit, text-2xs больше
* нигде не появляется. */
--text-sm: 13px;
--text-sm--line-height: 1.4;
--text-2xs: 11px;
--text-2xs--line-height: 1.35;
--text-sm--line-height: 1.45;
--radius-sm: 4px;
--radius-md: 6px;
--radius-lg: 8px;
}
/* Tektur caps utility — handoff 10.5px uppercase tracking 0.10em.
* Codemod target: replace `text-2xs uppercase tracking-[0.10em]` → `text-cap`. */
/* === Semantic typography utilities per design_handoff_ordinis_mdm/README.md ===
* Type system — 7 ролей, каждая соответствует месту в UI:
*
* text-title-xl — 22/600 modal title, section header (rare)
* text-title-lg — 17/600 page title в editor
* text-title-md — 15/600 dictionary card title
* text-body — 13/400 workhorse: body, buttons, tabs, inputs
* text-cell — 12.5/500 table cell text
* text-mono — 11/500 Mono: IDs, dates, FK refs
* text-cap — 10.5/600 Tektur UPPERCASE caption / section label
*
* Color и weight overrides поверх — добавлять отдельными utility classes
* (e.g. `text-body font-medium text-ink`). НЕ накладывать font-mono/
* font-display/uppercase/tracking — они baked в соответствующие utility. */
@utility text-title-xl {
font-size: 22px;
font-weight: 600;
line-height: 1.2;
letter-spacing: -0.01em;
}
@utility text-title-lg {
font-size: 17px;
font-weight: 600;
line-height: 1.25;
letter-spacing: -0.005em;
}
@utility text-title-md {
font-size: 15px;
font-weight: 600;
line-height: 1.3;
}
@utility text-body {
font-size: 13px;
font-weight: 400;
line-height: 1.45;
}
@utility text-cell {
font-size: 12.5px;
font-weight: 500;
line-height: 1.35;
}
@utility text-mono {
font-family: var(--font-mono);
font-size: 11px;
font-weight: 500;
line-height: 1.4;
}
@utility text-cap {
font-family: var(--font-display);
font-size: 10.5px;
line-height: 1;
font-weight: 600;
line-height: 1;
text-transform: uppercase;
letter-spacing: 0.10em;
}