From ecf3d1b3ce42e0000d179050d06a6558178bae2e Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Thu, 18 Jun 2026 00:31:10 -0700 Subject: [PATCH] graph in panel --- README.md | 9 ++- docs/panel-and-edges-plan.md | 81 +++++++++++++++++++++++++++ public/manifest.json | 5 +- scripts/layout-shot.mjs | 7 ++- scripts/panel-shot.mjs | 83 ++++++++++++++++++++++++++++ scripts/redirect-probe.mjs | 94 ++++++++++++++++++++++++++++++++ src/background/index.ts | 66 ++++++++++++++++------ src/storage/sessionMap.ts | 2 + src/viewer/App.tsx | 61 +++++++++++++++++++-- src/viewer/graph/layout.ts | 7 ++- src/viewer/styles.css | 53 +++++++++++++++++- src/viewer/views/GraphCanvas.tsx | 51 +++++++++-------- tests/graph.test.ts | 15 +++++ 13 files changed, 487 insertions(+), 47 deletions(-) create mode 100644 docs/panel-and-edges-plan.md create mode 100644 scripts/panel-shot.mjs create mode 100644 scripts/redirect-probe.mjs diff --git a/README.md b/README.md index 9b52862..f95884d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ Then load it in Chrome: 2. **Load unpacked** → select the `dist/` folder. 3. Browse around. Open the service-worker console (the **service worker** link on the extension card) to watch `[history-graph] visit …` logs. -4. Click the toolbar button to open the graph viewer. +4. Click the toolbar icon to open the **side panel** (it solos the active tab and + updates live). Use the ⤢ button in the panel to pop out the full-tab view. After code changes, `npm run dev` rebuilds automatically — just hit the reload icon on the extension card to pick up the new build. @@ -92,6 +93,7 @@ Each is a layout strategy feeding the shared `GraphCanvas`: - [x] Reversible time direction (newest- or oldest-at-top; newest default). - [x] Forbidden-columns lane allocation (interval-graph coloring) so concurrent branches never share a column — no overlapping lanes/connectors. +- [x] Right-angle (elbow) connectors with rounded junctions. - [ ] Node detail panel, search highlighting, jump-to-now. ### Data model & capture fidelity @@ -104,9 +106,14 @@ Each is a layout strategy feeding the shared `GraphCanvas`: - [ ] Optional **seed from `chrome.history`** on install (reconstruct a partial tree from `referringVisitId`) for a non-empty day one. - [ ] Treat back/forward as an explicit "revisit" edge if we want to show it. +- [x] Collapse client-side redirects/canonicalisation (e.g. /wiki/Juneau → + /wiki/Juneau,_Alaska) into one node via the History-API timing heuristic. ### UX & product +- [x] **Side panel** that follows your browsing: toolbar icon opens it, it solos + the active tab, refreshes live, and uses a compact (container-query) layout. +- [x] Persist view prefs (mode + direction) across sessions. - [ ] Date-range picker (beyond the preset dropdown) and per-domain filtering. - [ ] **Pause capture** + per-site ignore list; define incognito behavior. - [ ] Export / import the graph (JSON). diff --git a/docs/panel-and-edges-plan.md b/docs/panel-and-edges-plan.md new file mode 100644 index 0000000..347089d --- /dev/null +++ b/docs/panel-and-edges-plan.md @@ -0,0 +1,81 @@ +# Plan: right-angle edges, side panel, and quick wins + +Status: **done** (right-angle edges, Juneau/redirect dedupe, side panel + +compact + auto-solo + live refresh, persisted prefs). Kept for reference. + +## 1. Right-angle (elbow) edges — small + +Today connectors are cubic-bezier S-curves (`GraphCanvas.tsx`). Switch to +orthogonal elbows, which read cleaner and suit the transit-map look. + +- Mainline / same-column edges stay a straight vertical line (unchanged). +- Fork edges become an L: keep the **child's column straight** and bend once at + the parent's row. For a parent→child edge: `M parentX parentY H childX V childY` + — horizontal along the parent's row, then vertical up the child's column. +- Add a small corner radius (e.g. 4px) via an arc/quadratic at the bend for + polish; expose a constant so we can compare sharp vs rounded. +- Because forbidden-columns guarantees each branch its own column, the vertical + runs line up — elbows will look like clean metro junctions. + +No layout change; this is purely the edge `d` string in `GraphCanvas`. + +## 2. Side panel that lives alongside browsing — medium + +Run the viewer in Chrome's Side Panel so the graph updates as you browse. + +**Wiring** +- `manifest.json`: add `"permissions": ["sidePanel"]` and + `"side_panel": { "default_path": "viewer.html?panel=1" }`. +- Service worker: `chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true })` + so the toolbar icon opens the panel. (Note: this suppresses + `action.onClicked`, so move "open full tab" to a button inside the panel.) + +**Compact mode** (`?panel=1`, plus width-responsive) +- Use a container query (`container-type: inline-size`) on the app shell so the + layout adapts to the ~360px panel without a separate codebase. +- Hide in compact: brand wordmark (keep the mark), the range ` setRangeDays(Number(e.target.value))}> +