feat(joint-layout-elk): new package - ELK layout with container and port support - #3497
Open
Geliogabalus wants to merge 14 commits into
Open
feat(joint-layout-elk): new package - ELK layout with container and port support#3497Geliogabalus wants to merge 14 commits into
Geliogabalus wants to merge 14 commits into
Conversation
…r-port ELK options - Elements embedded in another element are laid out as a container - the parent is resized (and positioned) by ELK to fit its content, at any nesting depth. Cross-container links are filed under their lowest common ancestor per ELK's hierarchical-edge convention. - Ports route edges to/from the position JointJS itself already computes for them (`elk.portConstraints: FIXED_POS`); the new `positionPorts` option lets ELK reposition/reorder them instead. - Add a `portOptions` callback for per-port ELK layout options, alongside the existing `nodeOptions`/`edgeOptions`. - Default to `elk.hierarchyHandling: INCLUDE_CHILDREN` so edges crossing a container's boundary are accounted for during layout. - Migrate the `layout-elk-ts` example to the package's `layout()` entry point instead of hand-rolled ELK export/import.
A fixed (non-random) system diagram exercising the new @joint/layout-elk capabilities: three containers, eight services connected through ports (three of which opt into `positionPorts` so ELK orders them to minimize crossings), and `elk.aspectRatio`/`elk.layered.wrapping.strategy` tuned to keep the drawing within a soft 1000-unit width budget.
The package itself (README, build config, initial layout()) isn't covered by an earlier changeset - this PR is its first appearance on master, so the changelog should read as an introduction, not a bump.
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
Introduces
@joint/layout-elk, a new package that lays out JointJS graphs using the Eclipse Layout Kernel (ELK) via elkjs, exposed as a single asynclayout(graph, options?)entry point.elk.hierarchyHandling: INCLUDE_CHILDRENby default).elk.portConstraints: FIXED_POS); the newpositionPortsoption lets ELK reposition/reorder them instead, writing the computed position back onto the graph.nodeOptions,portOptionsandedgeOptionscallbacks.layout-elk-tsmigrated to the newlayout()entry point (previously hand-rolled ELK export/import).layout-elk-containers-ports-ts(new) - a fixed, non-random diagram exercising containers, ports, per-nodepositionPorts, and a width-restricted layout (elk.aspectRatio+elk.layered.wrapping.strategy).Test plan
yarn testinpackages/joint-layout-elk- 10/10 passingyarn lintinpackages/joint-layout-elk- cleantsc --noEmitfor both examples - cleanpositionPortsreorders ports on the opted-in nodes only, drawing wraps to stay within the 1000-unit width target)yarn changeset status --since=upstream/master- reports@joint/layout-elk -> 0.2.0(minor) with 4 changesets