structure: split src into data/ + ui/; nest lexicons by NSID
src/ was a flat splat of 17 files. give it the boundary that was already there:
- src/data/ — atproto + microcosm services, no DOM (net, oauth, pds, clients,
source, lineage, prefs, moderation, explore). a closed set: never imports ui/.
- src/ui/ — draw, dom, theme, login.
- root keeps the entry + the two views: boot.ts, main.ts, display.ts, style.css.
lexicons mirror the NSID like the official repos: lexicons/tech/waow/doodl/*.json
(nothing imports them; the collection strings are hardcoded, so zero code impact).
pure reorg — no behavior change, build + check green. main.ts (1289 lines) is
still the elephant; a remix/gallery/settings split is the next, separate pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
refactor: split the main.ts god module into features over a shared app context
main.ts: 1289 → 88 lines — now a composition root that reads as a boot tour.
- src/app.ts: the shell — shared state (session/handle/defaults), the canvas +
chrome refs, the router, and a tiny event bus ("view"/"refresh") so features
react without importing each other.
- src/auth.ts: oauth init, signIn, logout.
- src/ui/: slots (the icon registry), sheets (the shared bottom-sheet).
- src/features/: tools, chrome, gallery, settings, preferences, remix,
icon-mode, save. each exposes init(); save reads remix/icon/prefs via their
getters (the integration seam stays explicit, no behavior change).
behaviour preserved; tsc + build green. plan in docs/refactor-main.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
structure: split src into data/ + ui/; nest lexicons by NSID
src/ was a flat splat of 17 files. give it the boundary that was already there:
- src/data/ — atproto + microcosm services, no DOM (net, oauth, pds, clients,
source, lineage, prefs, moderation, explore). a closed set: never imports ui/.
- src/ui/ — draw, dom, theme, login.
- root keeps the entry + the two views: boot.ts, main.ts, display.ts, style.css.
lexicons mirror the NSID like the official repos: lexicons/tech/waow/doodl/*.json
(nothing imports them; the collection strings are hardcoded, so zero code impact).
pure reorg — no behavior change, build + check green. main.ts (1289 lines) is
still the elephant; a remix/gallery/settings split is the next, separate pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>