Repository navigation
feat(viz): shared stack-and-heap views that draw any snapshot - #203
Merged
Merged
Conversation
PR 4 of the ADR 0004 plan. The Stack <-> Heap story now renders through shared 2D and 3D views; a Playground trace will use the same ones. - StackHeapView2D (src/shared/components/viz/stackheap) and StackHeapView3D (src/shared/viz3d/stackheap) take a placed snapshot, a focus list and a palette variant. StackHeap2D/3D are thin wrappers. - Both views handle any heap grid and stack depth, the function and scope kinds, references that target a frame, dangling references, and an option to mark unreachable objects. A `grid` prop pins the layout for a whole trace so no cell shifts between steps. - placeSnapshot / placeTrace give trace objects fixed cells; with two columns they reproduce the story's authored cells. - Label and text colours come from the palette. Dark text and two dark fills are adjusted so every kind of text reaches 4.5:1 on every fill. - src/shared/viz3d/primitives: damp, UP, labelStyle, Label, RegionLabel. The story is unchanged: its 2D geometry is identical on all 10 beats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 4 of the ADR 0004 build plan. The Stack ↔ Heap story now renders through shared 2D and 3D views, and a Playground trace will use the same ones. The story itself is unchanged.
StackHeapView2D(src/shared/components/viz/stackheap/) andStackHeapView3D(src/shared/viz3d/stackheap/) take a placed snapshot, a focus list and a palette variant.StackHeap2DandStackHeap3Dare now thin wrappers, and the story shell did not change.functionandscopekinds, references that point back at a frame, dangling references, and amarkUnreachableoption. Agridprop pins the layout for a whole trace, so no cell shifts when a later step adds objects.placeSnapshot/placeTrace(src/shared/snapshot/placement.ts) give trace objects fixed cells: an id keeps its cell, and a freed cell is never reused. With the default of two columns they reproduce the cells the story's author chose.damp,UP,MONO,labelStyle,withAlpha,LabelandRegionLabellive insrc/shared/viz3d/primitives.Checks
npx tsc -b,npm run lint,npm run test:run(38 files, 398 tests) andnpm run buildpass.mainand after this change; the two recordings are identical.label-overlap.json all 10 beats (ok at two viewer sizes) and an A/B of label positions against the previous renderer (within 1px). Beats 7 and 9 were viewed again after the final colour fixes and match the previous look.check-lazy-chunk.mjs: three.js is not in the entry graph.Known gaps
frameActiveis still unused in 2D, as before.🤖 Generated with Claude Code