Skip to content

feat(#124): radial arc: hub and the first eight neighbours - #130

Merged
Enniwhere merged 4 commits into
mainfrom
124-radial-arc
Nov 29, 2026
Merged

Enniwhere merged 4 commits into
mainfrom
124-radial-arc

Conversation

@Enniwhere

Copy link
Copy Markdown
Contributor

The inspector now opens on a fixed radial arc band: the pinned token's label sits at the hub and its nearest eight stored neighbours are buttons on an open 240° arc, rank 0 at the lower left. An arc chip jumps exactly like a shelf row — one appended row, the future discarded, the dialog re-queried at the new token — while the graph and shelf scroll below. The band shrinks its radius on a short or narrow panel and sheds ranks until neighbouring chips keep a 76 px chord. arc-layout.ts is pure and unit-tested, and e2e/radial-menu.spec.ts walks the chips in rank order, tabs through them and jumps once.

How to try

  1. npm run dev, open http://localhost:5173.
  2. Edit → The quick brown fox → noise, then click quick.
  3. Tab through the eight chips and press Enter on one; the trail grows a row and the arc re-renders at the new token.
  4. Shrink the window height until the arc keeps only six or four chips.

Read first

src/lib/components/arc-layout.ts: the angle, radius and overlap bound live there, and its unit test prints the eight-entry table.

Deviations: the default provider's page 0 always holds more than eight neighbours, so the shed-ranks path is unit-tested rather than reachable in the browser; the height term is (H - 38) / 1.5 from the chip height and margin, not the plan's 46 px estimate.

Noticed: slice 2 measured 184 changed lines against a ~130 estimate, mostly the hand-walk spec — its dialog svg locator stopped being unique once the arc added a second svg, so it now names svg.neighbor-graph. The gap is the estimate missing that fix, not the slice doing two things.

Closes #124

Next: /review <pr>; after merge, /retrospective 124.

The pinned token's dialog now opens on a fixed arc band: the hub carries the
token's label and the first eight stored neighbours sit as buttons on an open
240° arc, rank 0 at the lower left. Clicks call the existing neighbour pick, so
a jump appends one row, discards the future and re-queries at the new token.

The pure `arc-layout.ts` places equal angles over 240°, shrinks the 150 px
radius with the panel, and returns centres and fixed 72x22 boxes; the unit test
prints the eight-entry table and asserts no two boxes overlap. The dialog's
vertical flip now reserves the band instead of a 160 px guess.

Verified with check, lint, prettier, 685 unit tests; the eight-entry table at
380 px has no overlapping boxes.

Plan: 1
Slice: 1/3
Kind: behavioral
The arc now takes the height the dialog can spare, shrinks its radius to
fit, and sheds ranks until neighbouring chips keep a 76 px chord. A new
spec walks the eight buttons in rank order and jumps once from the arc;
the hand-walk spec targets svg.neighbor-graph now that the arc adds a
second svg to the dialog.

Deviation: the default provider's page 0 always holds more than eight
neighbours, so the browser cannot reach the shed-ranks path; fitCount and
arcLayout heights are unit-tested instead.
Deviation: the height term is (H - 38) / 1.5 from ARC_CHIP_HEIGHT and
ARC_MARGIN, not the plan's 46 px estimate.

Verified: check, lint, prettier, 688 unit tests; 13/13 e2e.
Plan: 1
Slice: 2/3
Kind: behavioral
The heap takes the plan's deferred items that were not already there:
rotation and a 12-entry window for #125, dropping the duplicated shelf
rows, a second caption, and WordNet relation labels for #91. The map now
names arc-layout.ts and RadialArc.svelte in the neighbour-shelf entry,
and the version moves to 1.22.0.

Verified with check, lint, prettier and 688 unit tests.
Plan: 1
Slice: 3/3
Kind: mechanical
@Enniwhere

Copy link
Copy Markdown
Contributor Author

Reviewed commit: c09a6d4

Verdict: block

Blockers

  • The arc band is a flex child with the default flex-shrink: 1, so it collapses from the 263 px it lays out to 116 px while the chips keep their 263 px absolute coordinates: four of the eight (quick, ĠQuick, Ġquicker, Ġquir) are drawn 30–119 px below the band, over the graph and shelf, and the 263 px arc-line svg overflows with them. src/lib/components/RadialArc.svelte:53-59, src/lib/components/TokenDialog.svelte:168-171 — repro: node /tmp/opencode/repro-130.mjs gives inline band height 263 px, getBoundingClientRect().height 116.42 px, and four chipsPastBand. Add flex: none to .radial-arc; the min-height: 0 on .dialog-scroll already lets the remainder absorb the space.

Stewardship notes

  • Try step 4 ("Shrink the window height until the arc keeps only six or four chips") cannot happen with the dialog open: box reads window.innerWidth/innerHeight inside a $derived.by with no resize listener (src/lib/components/TokenDialog.svelte:83-85), so 1280×720 → 1280×460 leaves the band at 263 px and eight chips (node /tmp/opencode/repro-130-resize.mjs prints the same numbers before and after). The shed path is reachable only by re-pinning after the resize.
  • The new spec counts eight entries but never checks they stay inside the band (e2e/radial-menu.spec.ts:44), which is why the collapse still passes 13/13 e2e; a bottom-edge assertion would catch it.

What could be deleted or simplified

  • src/lib/components/RadialArc.svelte:31 and the per-chip inline width/height repeat numbers that arcLayout already returns; one .arc-entry CSS rule would drop the two constant imports.
  • The second e2e case (e2e/radial-menu.spec.ts:83) re-counts eight entries on the same fixture; fold its min(8, stored) check into the first test.
  • src/lib/components/TokenDialog.svelte:121 subtracts CHROME from a height that arcRadius already clamps; pass the dialog height once and let the layout module own the band height.

Keep the arc band's 263 px layout height: `flex: none` stops the dialog
column from shrinking it under the absolutely positioned chips. The
dialog now tracks viewport changes, so shrinking the window re-fits the
band instead of leaving stale coordinates; the `state` prop became
`status` because a local `$state` cannot share its name.

The e2e asserts every chip stays inside the band and folds the stored-count
check into the first test; a new test resizes the window and checks the
band still matches its inline height. Chips read width/height from the
layout entry instead of duplicating the constants.

Verified with `node scripts/verify.mjs` (check, lint, format, 688 tests)
and the full Playwright suite (13 passed).

Plan: 1
Slice: review
Kind: behavioral
Fixes: review 1
@Enniwhere
Enniwhere merged commit 9380e28 into main Nov 29, 2026
3 checks passed
@Enniwhere
Enniwhere deleted the 124-radial-arc branch November 29, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radial arc: hub and the first twelve neighbours

1 participant