[pull] develop from mermaid-js:develop - #231
Merged
Merged
Conversation
The "Adding a New Diagram/Chart" page documented three steps while the review checklist enforces around fifteen, and three of its instructions had gone stale: styles are no longer wired up by hand in a themes object, detection no longer lives in detectType.ts, and commonDb moved under diagrams/common. Rewrite it as a sequenced build with usecase as the reference implementation, and end with the checklist a reviewer applies, so contributors can self-review against the same bar. Add the Layout Maker's Guide next to it, covering the LayoutData contract, the createCommonLayoutRenderer stages, validateLayout and the 0-1000 score, DDLT fixtures and the sweep, and the cases that actually break layout engines. Both are listed under Contributing.
Layout maker's guide: - Say what "your job is coordinates" means. You never touch the DOM; you are handed measured nodes and hand back a center per node and a polyline per edge, and everything downstream works from those numbers. - Scope the output contract to `runLayoutCore`. The blanket "fill in these fields and nothing else" contradicted the guide's own pipeline, where `prepareLayout` is allowed to rebuild the graph before measurement. - Add a "Layout space" section. Positions are centers, so the left edge is `x - width / 2`; libraries that report a top-left or bottom-left origin need converting in `runLayoutCore`. The plane has no fixed origin and coordinates need not be positive, since the renderer fits the bounding box into the viewBox. - Answer the leaf-versus-group size question directly. Leaf `width` and `height` arrive measured and must not be recalculated; groups are the one place a size is yours to set. - Add "Performance on large diagrams": the flowchart corpus under `e2e/platform/dev-diagrams/performance/`, how to run the dev-explorer profiler over it, how to read the phase table (`↳ ours` against `↳ lib`, and `huge3.mmd` being parse-dominated), why `baseline.json` is a shape to compare against rather than a threshold, and the algorithmic mistakes that actually cost time. - Give the fixture-tree code block a language. New diagram guide: - Document both supported db lifecycles. Fourteen diagrams define `db` as a getter returning a new instance; the rest share one object whose `clear()` resets it. The guide asserted only the first, which is not what the reference implementation does. - "hand-drawn" in prose, `handDrawn` for the config value.
…r-guides docs: rewrite the diagram guide and add a layout maker's guide
ELK reserves a 12px ports-surrounding margin at both ends of a node side before distributing edge anchors along it. On a side shorter than 24px — a start/end state circle is 14px across — the usable span is negative and ELK's clamping parks the anchor off-center, so the only edge in '[*] --> [*]' attached 3px off the dot's center. No node-level option can override this: the spacing is only read per hierarchy level. Drop such anchors when applying routed sections and let the edge aim at the node center instead; the border clip then lands it dead center, the same way the dagre pipeline attaches edges. The check is side-specific so fork/join bars keep their spread anchors along the long side.
Add a state+ELK snapshot fixture for the start/end centering case so the rendered result is guarded by the visual suite, and a unit test pinning the side-specific part of the anchor drop: a wide, thin fork/join bar must keep two spread anchors instead of funnelling edges to its centre (verified to fail when the side check is replaced with min(width,height)). Also derive the portsSurrounding option string from the margin constant so the two cannot drift apart, and document the border tolerance.
…ering fix(elk): center edges attached to small nodes
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )