FE-874: Expand subnets in place with automatic layout (prototype)#8954
Draft
kube wants to merge 1 commit into
Draft
FE-874: Expand subnets in place with automatic layout (prototype)#8954kube wants to merge 1 commit into
kube wants to merge 1 commit into
Conversation
Double-clicking a component instance expands it in place: the box becomes
a frame containing the subnet's internal places/transitions (laid out with
the existing ELK pipeline), and the surrounding net is displaced at display
time to make room. Double-clicking the frame collapses it again.
Expansion is pure view-layer state — stored x/y positions are never
mutated. Displayed positions are `stored + deterministic shift`, and drag
commits map back through the inverse shift so the model always stores
undisplaced coordinates. Child node/edge ids are namespaced by instance id
so multiple instances of the same subnet expand independently. Arcs into
ports reattach directly to the port places inside the frame while expanded.
Includes a Storybook fixture/story ("Subnets — expand in place") and a
design doc (dev-docs/fe-874-expand-subnets-in-place.md) covering the
approach, alternatives considered, limitations, and next steps.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
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.
🌟 What is the purpose of this PR?
Prototype for expanding a subnet's component instance in place on the canvas (FE-874). Double-clicking an instance box turns it into a frame showing the subnet's internal structure (auto-laid-out with the existing ELK pipeline), and the surrounding net is offset at display time to make room. Double-clicking the frame collapses it again.
Expansion is pure view-layer state — stored x/y positions are never mutated. Displayed positions are
stored + deterministic shift; drag commits map back through the inverse shift, so undo/redo and collaboration stay consistent. A design doc covering the approach, alternatives considered (model flattening, full-net re-layout, force-based displacement, true nested editing), limitations, and proposed next steps is included atlibs/@hashintel/petrinaut/dev-docs/fe-874-expand-subnets-in-place.md.🔗 Related links
🚫 Blocked by
🔍 What does this change?
useExpandedSubnetshook: per-instance expansion state, ELK layout of the subnet content at expand time, and the "insert space" displacement math (computeExpansionShift+ inverse).componentInstanceExpandednode type +ExpandedComponentInstanceNodeframe component (header with name/subnet, dashed border).useSdcpnToReactFlow: emits the frame + namespaced (instanceId::elementId) read-only child nodes via React Flow subflows (parentId), applies display-time displacement to surrounding nodes, rewires componentPort arcs directly to the port places inside expanded frames, and renders the subnet's internal arcs.useApplyNodeChanges: optional displayed→stored position mapping so drags while expanded commit undisplaced coordinates.SDCPNView:onNodeDoubleClickexpand/collapse, guards so expanded children can't be selected/connected/hovered as real items, expansion reset on net switch/drill-down.libs/@hashintel/petrinaut/dev-docs/.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
libs/@hashintel/petrinaut/docs/, read by the in-app AI assistant) must be updated before the interaction ships as final UX🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
zoomOnDoubleClickzooms when the gesture misses a node — both should be addressed for final UX.See the "Known limitations / follow-ups" section of the design doc for the full list.
🐾 Next steps
petrinaut-core, unit-test the shift/inverse round-trip, disablezoomOnDoubleClick, suppress select-on-expand.🛡 What tests cover this?
❓ How to test this?
cd libs/@hashintel/petrinaut && yarn devWarehouseNorth→ it expands into its internal structure; the rest of the net moves to make roomWarehouseSouthtoo → both instances of the same subnet are expanded independently📹 Demo
Expanded frame showing the subnet's internal structure in place (see Storybook story; screenshots in the Linear ticket thread).
🤖 Generated with Claude Code