pediatric-ai-scribe-v3/scripts
Daniel ce31a1e343 refactor(client): migrate ui-state.js → client/ui-state.ts (first real
frontend module conversion)

ui-state was the smallest, most isolated module: 35 lines, zero legacy-
global dependencies, single concern (localStorage helpers under the
'ped_ui/' namespace). Ideal first migration to validate the strangler-
fig pattern end-to-end.

Changes:
- New: client/ui-state.ts — exports get/set/del + UIState bundle.
  Keeps (window as any).UIState = UIState assignment so the 10+ legacy
  consumers (sub-nav.js, peGuide.js, app.js, etc.) keep working without
  modification. As each consumer is migrated, it will replace the
  window.UIState read with an explicit import.
- client/main.ts: import './ui-state' so it gets bundled into main.js.
- scripts/build-client.mjs: explicit ENTRIES list (just 'main.ts' for
  now) — was scanning every top-level .ts as an entry, which produced
  duplicate ui-state.js bundle.
- public/index.html: <script defer src="/js/ui-state.js"> removed; the
  TS bundle (/dist/main.js) now provides window.UIState.
- public/js/ui-state.js: deleted (now lives in client/).

Verification:
- npm run typecheck:client → 0 errors
- npm run build:client → 349-byte main.js bundle (gzipped will be ~200B)
- 46/46 unit tests pass
- The 10 cross-file consumers of UIState.get/set/del still work because
  the window assignment lives in the bundle.

Pattern documented for next migrations: each new client/X.ts is
imported as a side-effect from main.ts. The window-bridge stays until
every consumer also moves to ES imports.
2026-04-28 00:42:44 +02:00
..
build-client.mjs refactor(client): migrate ui-state.js → client/ui-state.ts (first real 2026-04-28 00:42:44 +02:00
download-whisper-models.sh v6: Use transformers.js v2.0.0 (proven worker compatibility) 2026-04-01 00:32:23 +00:00
e2e.sh test(lint): static reference linter — catches dead-code + orphan refs 2026-04-23 18:58:38 +02:00
import-milestones.js Add admin dashboard for developmental milestones management 2026-03-31 20:55:41 +00:00
lint-references.js feat: ED encounters + notes model selector; remove AI corrections; fix notes framing 2026-04-26 19:06:00 +02:00
maintenance.js Maintenance CLI + unpin postgres digest 2026-04-14 04:00:13 +02:00
release.sh release.sh: drop node dependency, use sed for version bump 2026-04-14 23:40:38 +02:00