feat(ui): drop @nstart/ui dependency (Stage 3.9)

Все font cascade bugs из последних MR были вызваны @nstart/ui pollution
(Tektur inheritance от Card parent'ов, Onest font в Button, font-primary
class overrides). Решили обрезать раньше plan'а.

What changed:

New primitives (8 файлов в src/ui/components/):
  - panel.tsx           — container с border/surface
  - field.tsx           — FieldLabel/Hint/Error typography helpers
  - text-input.tsx      — Input + label/hint/error composite
  - table.tsx           — Table/TableHeader/Body/Row/HeaderCell/Cell/Empty
  - date-picker.tsx     — native <input type=date> wrapper с label/hint/error
  - multi-select.tsx    — Radix Popover + inline checkboxes
  - single-select.tsx   — native <select> с label/hint/error chrome
  - language-switch.tsx — segmented control в Tektur uppercase

Compatibility shims (existing components extended):
  - checkbox.tsx        — + label/description/error/onChange (nstart-compat
                          synthetic event), wrap в <label> когда есть chrome
  - modal.tsx           — + panelClassName / bodyClassName props
  - form-actions.tsx    — + align prop (start/end/between)
  - tabs-simple.tsx     — TabItem.count alias for .trailing (nstart-compat)
  - table TableHead     — alias TableHeaderCell с align prop

Barrel rewrite (src/ui/index.ts):
  - Удалён 'export * from @nstart/ui'
  - Explicit exports для всех 45+ нужных символов
  - SelectOption / MultiSelectOption / LanguageOption теперь {id, label}
    с optional 'value' alias — nstart-compat без массового codemod call-sites

styles.css cleanup:
  - Removed @import @nstart/ui/styles/{fonts,theme}.css
  - Removed @source nstart/dist directive (Tailwind v4 scan)
  - Removed --text-sm: 13px override (был костыль для @nstart/ui dist)
  - Legacy color tokens (--color-carbon/ultramarain/orbit/regolith/asteroid)
    sсодержали fallback mappings — оставлены, но callsites больше не используют

Codemod: 9 файлов конвертированы legacy colors → handoff tokens
  carbon → ink, ultramarain → accent, orbit → warn, regolith → line, asteroid → mute

main.tsx:
  - NStartUiProvider → TooltipProvider (Radix)
  - DatePickerProvider убран (наш DatePicker native, no provider needed)

routes/dictionaries.$name.tsx:
  - Removed useRef-based <input>.indeterminate hack
  - Radix Checkbox принимает checked='indeterminate' declaratively

package.json: -@nstart/ui (was 0.1.3)

Bundle impact:
  before: vendor-nstart-ui chunk = 1228 KB
  after:  no nstart chunk, всё в vendor-misc (+~70 KB Radix wrappers)
  net savings: ~1.15 MB minified, ~440 KB gzip

Tests: 116 pass (1 fixed: tab role from 'button' → 'tab', Radix semantically correct).
TS strict: clean.
Browser-verified (preview): 7 utilities computed correctly, nstart bundle absent.
This commit is contained in:
Zimin A.N.
2026-05-11 15:17:37 +03:00
parent f0dbc20f62
commit 5007e0f4eb
27 changed files with 916 additions and 191 deletions
+7 -22
View File
@@ -1,14 +1,9 @@
@import 'tailwindcss';
@import 'tw-animate-css';
@import '@nstart/ui/styles/fonts.css';
@import '@nstart/ui/styles/theme.css';
/* Без @source Tailwind v4 не сгенерирует CSS для классов внутри dist/@nstart/ui */
@source '../node_modules/@nstart/ui/dist';
/* Google Fonts — Inter / JetBrains Mono / Tektur (handoff spec).
* @nstart fonts.css дублируется по части семейств — overlap безвреден,
* на финальной фазе миграции (когда удалим @nstart/ui) останется только это. */
* Stage 3.9: @nstart/ui удалён, fonts/theme imports + @source directive
* убраны. Tailwind v4 теперь scan'ит только наш src/. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Tektur:wght@500;600;700&display=swap');
/* === Dark mode trigger ===
@@ -146,21 +141,11 @@
--font-mono: 'JetBrains Mono', 'SF Mono', monospace;
--font-display: 'Tektur', 'Inter', sans-serif;
/* 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.45;
/* Font scale — НЕ переопределяем Tailwind defaults. Все наши места
* используют семантические @utility ниже (text-body, text-cell, text-mono,
* text-title-*, text-cap). text-sm/text-xs/text-2xs не используются нигде
* после Stage 3.9 — @nstart/ui (который требовал --text-sm override)
* удалён. */
--radius-sm: 4px;
--radius-md: 6px;