diff --git a/docs/plans/2026-02-17-frontend-modularization-impl.md b/docs/plans/2026-02-17-frontend-modularization-impl.md new file mode 100644 index 0000000..67a92af --- /dev/null +++ b/docs/plans/2026-02-17-frontend-modularization-impl.md @@ -0,0 +1,1890 @@ +# Frontend Modularization Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Split the monolithic 1,436-line `app.js` into 9 ES modules with JSDoc types for better maintainability and agent visibility. + +**Architecture:** ES modules with ` +``` +to: +```html + +``` + +**Step 3: Delete app.js** + +```bash +rm unredact/static/app.js +``` + +--- + +### Task 11: Verify and commit + +**Step 1: Start the application** + +```bash +make run +``` + +**Step 2: Manual smoke test** + +Open http://localhost:8000 in a browser. Verify: +- [ ] Page loads without console errors +- [ ] PDF upload works (drag-drop and click) +- [ ] Page navigation works +- [ ] Redaction list populates +- [ ] Clicking a redaction activates it (pans to it, starts analysis) +- [ ] Popover opens with font/size/pos/gap controls +- [ ] Font/size/position/gap adjustments update the canvas +- [ ] Text editing works (left/right inputs) +- [ ] Solver starts, streams results, can be stopped +- [ ] Clicking a result shows preview on canvas +- [ ] Accept marks redaction as solved +- [ ] Double-click spot detection works +- [ ] Ctrl+drag adjusts offset, Shift+drag adjusts gap width +- [ ] Zoom (wheel, buttons, fit) works +- [ ] Touch pinch-zoom works (if testable) +- [ ] Toast notifications appear + +**Step 3: Commit** + +```bash +git add unredact/static/types.js unredact/static/state.js unredact/static/dom.js \ + unredact/static/canvas.js unredact/static/viewport.js unredact/static/associates.js \ + unredact/static/popover.js unredact/static/solver.js unredact/static/main.js \ + unredact/static/jsconfig.json unredact/static/index.html +git rm unredact/static/app.js +git commit -m "feat: split app.js into ES modules with JSDoc types + +Reorganize the monolithic 1,436-line frontend into 9 focused modules: +types, state, dom, canvas, viewport, associates, popover, solver, main. + +No build step — browsers load ES modules natively. JSDoc @typedef +annotations provide type safety via @ts-check + jsconfig.json." +```