@knowvah/dot-engine 2.10.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gvc/context.d.ts +7 -1
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/device.d.ts +2 -3
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts +11 -0
- package/dist/gvc/emit-xdot.d.ts.map +1 -0
- package/dist/gvc/init-xdot.d.ts +7 -0
- package/dist/gvc/init-xdot.d.ts.map +1 -0
- package/dist/gvc/landscape.d.ts +11 -0
- package/dist/gvc/landscape.d.ts.map +1 -0
- package/dist/gvc/layout-bb.d.ts +17 -0
- package/dist/gvc/layout-bb.d.ts.map +1 -0
- package/dist/gvc/layout-reset.d.ts +26 -0
- package/dist/gvc/layout-reset.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +0 -2
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/gvc/viewport.d.ts +1 -10
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +1514 -768
- package/dist/index.js.map +4 -4
- package/dist/layout/circo/blocks.d.ts +2 -0
- package/dist/layout/circo/blocks.d.ts.map +1 -1
- package/dist/layout/circo/blocktree.d.ts +6 -0
- package/dist/layout/circo/blocktree.d.ts.map +1 -1
- package/dist/layout/circo/circular.d.ts +6 -0
- package/dist/layout/circo/circular.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-rank.d.ts +34 -0
- package/dist/layout/dot/edge-route-rank.d.ts.map +1 -1
- package/dist/layout/dot/index.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat.d.ts +1 -2
- package/dist/layout/dot/splines-flat.d.ts.map +1 -1
- package/dist/layout/dot/splines.d.ts +2 -2
- package/dist/layout/dot/splines.d.ts.map +1 -1
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts +12 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts.map +1 -0
- package/dist/layout/neato/dijkstra.d.ts +7 -0
- package/dist/layout/neato/dijkstra.d.ts.map +1 -1
- package/dist/layout/neato/splines.d.ts +7 -3
- package/dist/layout/neato/splines.d.ts.map +1 -1
- package/dist/layout/pack/ccomps.d.ts +32 -0
- package/dist/layout/pack/ccomps.d.ts.map +1 -0
- package/dist/layout/pack/index.d.ts +1 -24
- package/dist/layout/pack/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +37 -0
- package/dist/render/dot/write-back.d.ts.map +1 -0
- package/dist/render/dot.d.ts +5 -7
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json.d.ts +16 -21
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render.js +1757 -1011
- package/dist/render.js.map +4 -4
- package/dist/util/libcxx-sort.d.ts +7 -0
- package/dist/util/libcxx-sort.d.ts.map +1 -0
- package/dist/vpsc/SweepLine.d.ts +2 -2
- package/dist/vpsc/SweepLine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/gvc/__fixtures__/replay-native.json +422 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.1 +25 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.2 +37 -0
- package/src/gvc/__fixtures__/rerender/background.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.1 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.2 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.2 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.2 +46 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.2 +47 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-circo.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-fdp.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-neato.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.1 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.2 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.1 +148 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.2 +162 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.2 +30 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.2 +104 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.1 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.2 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.2 +127 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.2 +128 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.gv +8 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.2 +118 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.2 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.1 +78 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.2 +79 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.2 +103 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.gv +16 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.gv +1 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.1 +34 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.1 +471 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.1 +121 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.1 +60 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/regen.sh +81 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.gv +18 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.1 +86 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.2 +86 -0
- package/src/gvc/context.ts +13 -1
- package/src/gvc/device.ts +6 -6
- package/src/gvc/emit-xdot.ts +208 -0
- package/src/gvc/init-xdot.ts +36 -0
- package/src/gvc/landscape.ts +36 -0
- package/src/gvc/layout-bb.ts +43 -0
- package/src/gvc/layout-reset.ts +62 -0
- package/src/gvc/usershape.ts +0 -5
- package/src/gvc/viewport.ts +1 -32
- package/src/layout/circo/__fixtures__/root/both-connected.gv +11 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.gv +18 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot +97 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.gv +11 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.gv +7 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot +46 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.gv +9 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot +51 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root.gv +16 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot +95 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.gv +11 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/regen.sh +16 -0
- package/src/layout/circo/blocks.ts +3 -0
- package/src/layout/circo/blocktree.ts +17 -3
- package/src/layout/circo/circular.ts +13 -1
- package/src/layout/dot/edge-route-rank.ts +72 -0
- package/src/layout/dot/edge-route.ts +6 -6
- package/src/layout/dot/index.ts +2 -0
- package/src/layout/dot/init.ts +17 -5
- package/src/layout/dot/splines-flat-labeled.ts +2 -1
- package/src/layout/dot/splines-flat-multi.ts +2 -1
- package/src/layout/dot/splines-flat.ts +3 -3
- package/src/layout/dot/splines.ts +9 -9
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot +115 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot.stderr +3 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.gv +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot +100 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot +106 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/regen.sh +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.ts +14 -0
- package/src/layout/neato/dijkstra.ts +12 -3
- package/src/layout/neato/splines.ts +18 -18
- package/src/layout/pack/ccomps.ts +131 -0
- package/src/layout/pack/index.ts +1 -95
- package/src/layout/sfdp/__fixtures__/start-warning/regen.sh +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.gv +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot +78 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot.stderr +2 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.gv +14 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot +76 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot.stderr +0 -0
- package/src/layout/sfdp/index.ts +1 -1
- package/src/layout/sfdp/init.ts +9 -1
- package/src/layout/twopi/index.ts +1 -1
- package/src/render/dot/agwrite.ts +1 -1
- package/src/render/dot/write-back.ts +137 -0
- package/src/render/dot.ts +12 -12
- package/src/render/json.ts +34 -34
- package/src/util/libcxx-sort.ts +461 -0
- package/src/vpsc/SweepLine.ts +11 -12
package/dist/index.js
CHANGED
|
@@ -3729,6 +3729,10 @@ var SharedEmptyAttrs = class extends Map {
|
|
|
3729
3729
|
}
|
|
3730
3730
|
};
|
|
3731
3731
|
var EMPTY_ATTRS = new SharedEmptyAttrs();
|
|
3732
|
+
function ownAttrs(o) {
|
|
3733
|
+
if (o.attrs === EMPTY_ATTRS) o.attrs = /* @__PURE__ */ new Map();
|
|
3734
|
+
return o.attrs;
|
|
3735
|
+
}
|
|
3732
3736
|
|
|
3733
3737
|
// src/model/algData.ts
|
|
3734
3738
|
var THETA_UNSET = 10;
|
|
@@ -5571,6 +5575,552 @@ var P_LPROMOTER = {
|
|
|
5571
5575
|
vertices: null
|
|
5572
5576
|
};
|
|
5573
5577
|
|
|
5578
|
+
// src/gvc/layout-reset.ts
|
|
5579
|
+
function layoutWasFreed(g) {
|
|
5580
|
+
return g.info?.laidOut === true && g.info.cleanup === void 0;
|
|
5581
|
+
}
|
|
5582
|
+
function resetGraphRecords(g) {
|
|
5583
|
+
g.info = makeGraphInfo();
|
|
5584
|
+
for (const subg of g.subgraphs.values()) resetGraphRecords(subg);
|
|
5585
|
+
}
|
|
5586
|
+
function resetLayoutRecords(g) {
|
|
5587
|
+
for (const n of g.nodes.values()) n.info = makeNodeInfo();
|
|
5588
|
+
for (const e of g.edges) e.info = makeEdgeInfo(makePort(), makePort());
|
|
5589
|
+
resetGraphRecords(g);
|
|
5590
|
+
}
|
|
5591
|
+
|
|
5592
|
+
// src/xdot/types.ts
|
|
5593
|
+
var XDOT_PARSE_ERROR = 1;
|
|
5594
|
+
|
|
5595
|
+
// src/xdot/parse.ts
|
|
5596
|
+
var ULONG_MAX = 0xffffffffffffffffn;
|
|
5597
|
+
var XdotParser = class _XdotParser {
|
|
5598
|
+
static isWs(c) {
|
|
5599
|
+
return c === " " || c === " " || c === "\n" || c === "\r";
|
|
5600
|
+
}
|
|
5601
|
+
static skipWs(s, pos) {
|
|
5602
|
+
while (pos < s.length && _XdotParser.isWs(s[pos])) pos++;
|
|
5603
|
+
return pos;
|
|
5604
|
+
}
|
|
5605
|
+
static consumeDigits(s, i) {
|
|
5606
|
+
while (i < s.length && s[i] >= "0" && s[i] <= "9") i++;
|
|
5607
|
+
return i;
|
|
5608
|
+
}
|
|
5609
|
+
static consumeExponent(s, i) {
|
|
5610
|
+
if (i < s.length && (s[i] === "e" || s[i] === "E")) {
|
|
5611
|
+
i++;
|
|
5612
|
+
if (i < s.length && (s[i] === "+" || s[i] === "-")) i++;
|
|
5613
|
+
i = _XdotParser.consumeDigits(s, i);
|
|
5614
|
+
}
|
|
5615
|
+
return i;
|
|
5616
|
+
}
|
|
5617
|
+
static parseReal(s, pos) {
|
|
5618
|
+
let i = _XdotParser.skipWs(s, pos);
|
|
5619
|
+
const start = i;
|
|
5620
|
+
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
5621
|
+
const digStart = i;
|
|
5622
|
+
i = _XdotParser.consumeDigits(s, i);
|
|
5623
|
+
if (i < s.length && s[i] === ".") {
|
|
5624
|
+
i++;
|
|
5625
|
+
i = _XdotParser.consumeDigits(s, i);
|
|
5626
|
+
}
|
|
5627
|
+
i = _XdotParser.consumeExponent(s, i);
|
|
5628
|
+
if (i === start || i === digStart) return null;
|
|
5629
|
+
return { val: parseFloat(s.slice(start, i)), pos: i };
|
|
5630
|
+
}
|
|
5631
|
+
static parseInt_(s, pos) {
|
|
5632
|
+
let i = _XdotParser.skipWs(s, pos);
|
|
5633
|
+
const start = i;
|
|
5634
|
+
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
5635
|
+
const digStart = i;
|
|
5636
|
+
i = _XdotParser.consumeDigits(s, i);
|
|
5637
|
+
if (i === digStart) return null;
|
|
5638
|
+
return { val: parseInt(s.slice(start, i), 10), pos: i };
|
|
5639
|
+
}
|
|
5640
|
+
/**
|
|
5641
|
+
* strtoul(s, &endp, 10) cast to unsigned int: optional sign, a leading "-"
|
|
5642
|
+
* negates modulo 2^64, magnitude overflow saturates to ULONG_MAX, and the
|
|
5643
|
+
* result keeps the low 32 bits.
|
|
5644
|
+
* @see lib/xdot/xdot.c:parseUInt
|
|
5645
|
+
*/
|
|
5646
|
+
static parseUInt_(s, pos) {
|
|
5647
|
+
const i = _XdotParser.skipWs(s, pos);
|
|
5648
|
+
let start = i;
|
|
5649
|
+
const negative = i < s.length && s[i] === "-";
|
|
5650
|
+
if (i < s.length && (s[i] === "-" || s[i] === "+")) start++;
|
|
5651
|
+
const end = _XdotParser.consumeDigits(s, start);
|
|
5652
|
+
if (end === start) return null;
|
|
5653
|
+
const mag = BigInt(s.slice(start, end));
|
|
5654
|
+
const clamped = mag > ULONG_MAX ? ULONG_MAX : mag;
|
|
5655
|
+
const wrapped = negative && mag <= ULONG_MAX ? BigInt.asUintN(64, -clamped) : clamped;
|
|
5656
|
+
return { val: Number(BigInt.asUintN(32, wrapped)), pos: end };
|
|
5657
|
+
}
|
|
5658
|
+
static parseRect(s, pos) {
|
|
5659
|
+
const rx = _XdotParser.parseReal(s, pos);
|
|
5660
|
+
if (!rx) return null;
|
|
5661
|
+
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
5662
|
+
if (!ry) return null;
|
|
5663
|
+
const rw = _XdotParser.parseReal(s, ry.pos);
|
|
5664
|
+
if (!rw) return null;
|
|
5665
|
+
const rh = _XdotParser.parseReal(s, rw.pos);
|
|
5666
|
+
if (!rh) return null;
|
|
5667
|
+
return { val: { x: rx.val, y: ry.val, w: rw.val, h: rh.val }, pos: rh.pos };
|
|
5668
|
+
}
|
|
5669
|
+
static parsePoint(s, pos) {
|
|
5670
|
+
const rx = _XdotParser.parseReal(s, pos);
|
|
5671
|
+
if (!rx) return null;
|
|
5672
|
+
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
5673
|
+
if (!ry) return null;
|
|
5674
|
+
return { val: { x: rx.val, y: ry.val, z: 0 }, pos: ry.pos };
|
|
5675
|
+
}
|
|
5676
|
+
static parsePolyline(s, pos) {
|
|
5677
|
+
const ri = _XdotParser.parseUInt_(s, pos);
|
|
5678
|
+
if (!ri) return null;
|
|
5679
|
+
let cur = ri.pos;
|
|
5680
|
+
const pts = [];
|
|
5681
|
+
for (let i = 0; i < ri.val; i++) {
|
|
5682
|
+
const rp = _XdotParser.parsePoint(s, cur);
|
|
5683
|
+
if (!rp) return null;
|
|
5684
|
+
pts.push(rp.val);
|
|
5685
|
+
cur = rp.pos;
|
|
5686
|
+
}
|
|
5687
|
+
return { val: { pts }, pos: cur };
|
|
5688
|
+
}
|
|
5689
|
+
/** UTF-8 byte length of one code point (mirrors dot.ts utf8Len per char). */
|
|
5690
|
+
static cpByteLen(cp) {
|
|
5691
|
+
if (cp < 128) return 1;
|
|
5692
|
+
if (cp < 2048) return 2;
|
|
5693
|
+
if (cp < 65536) return 3;
|
|
5694
|
+
return 4;
|
|
5695
|
+
}
|
|
5696
|
+
static parseString(s, pos) {
|
|
5697
|
+
const ri = _XdotParser.parseInt_(s, pos);
|
|
5698
|
+
if (!ri || ri.val <= 0) return null;
|
|
5699
|
+
const len = ri.val;
|
|
5700
|
+
let cur = _XdotParser.skipWs(s, ri.pos);
|
|
5701
|
+
if (s[cur] !== "-") return null;
|
|
5702
|
+
cur++;
|
|
5703
|
+
let out = "";
|
|
5704
|
+
let accounted = 0;
|
|
5705
|
+
let j = 0;
|
|
5706
|
+
while (accounted < len) {
|
|
5707
|
+
if (cur + j >= s.length) return null;
|
|
5708
|
+
const ch = s[cur + j];
|
|
5709
|
+
const prev = j > 0 ? s[cur + j - 1] : "";
|
|
5710
|
+
out += ch;
|
|
5711
|
+
if (ch === "\\" && prev !== "\\") {
|
|
5712
|
+
j++;
|
|
5713
|
+
continue;
|
|
5714
|
+
}
|
|
5715
|
+
const cp = s.codePointAt(cur + j);
|
|
5716
|
+
accounted += _XdotParser.cpByteLen(cp);
|
|
5717
|
+
if (cp > 65535) {
|
|
5718
|
+
out += s[cur + j + 1];
|
|
5719
|
+
j++;
|
|
5720
|
+
}
|
|
5721
|
+
j++;
|
|
5722
|
+
}
|
|
5723
|
+
return { val: out, pos: cur + j };
|
|
5724
|
+
}
|
|
5725
|
+
static parseAlign(s, pos) {
|
|
5726
|
+
const ri = _XdotParser.parseInt_(s, pos);
|
|
5727
|
+
if (!ri) return null;
|
|
5728
|
+
const align = ri.val < 0 ? "left" : ri.val > 0 ? "right" : "center";
|
|
5729
|
+
return { val: align, pos: ri.pos };
|
|
5730
|
+
}
|
|
5731
|
+
static parseStops(s, pos, n) {
|
|
5732
|
+
let cur = pos;
|
|
5733
|
+
const stops = [];
|
|
5734
|
+
for (let i = 0; i < n; i++) {
|
|
5735
|
+
const rf = _XdotParser.parseReal(s, cur);
|
|
5736
|
+
if (!rf) return null;
|
|
5737
|
+
const rc = _XdotParser.parseString(s, rf.pos);
|
|
5738
|
+
if (!rc) return null;
|
|
5739
|
+
stops.push({ frac: rf.val, color: rc.val });
|
|
5740
|
+
cur = rc.pos;
|
|
5741
|
+
}
|
|
5742
|
+
return { stops, pos: cur };
|
|
5743
|
+
}
|
|
5744
|
+
static linGradient(s, pos) {
|
|
5745
|
+
const rx0 = _XdotParser.parseReal(s, pos);
|
|
5746
|
+
if (!rx0) return null;
|
|
5747
|
+
const ry0 = _XdotParser.parseReal(s, rx0.pos);
|
|
5748
|
+
if (!ry0) return null;
|
|
5749
|
+
const rx1 = _XdotParser.parseReal(s, ry0.pos);
|
|
5750
|
+
if (!rx1) return null;
|
|
5751
|
+
const ry1 = _XdotParser.parseReal(s, rx1.pos);
|
|
5752
|
+
if (!ry1) return null;
|
|
5753
|
+
const rn = _XdotParser.parseUInt_(s, ry1.pos);
|
|
5754
|
+
if (!rn) return null;
|
|
5755
|
+
const rs = _XdotParser.parseStops(s, rn.pos, rn.val);
|
|
5756
|
+
if (!rs) return null;
|
|
5757
|
+
return { x0: rx0.val, y0: ry0.val, x1: rx1.val, y1: ry1.val, stops: rs.stops };
|
|
5758
|
+
}
|
|
5759
|
+
static radGradient(s, pos) {
|
|
5760
|
+
const rx0 = _XdotParser.parseReal(s, pos);
|
|
5761
|
+
if (!rx0) return null;
|
|
5762
|
+
const ry0 = _XdotParser.parseReal(s, rx0.pos);
|
|
5763
|
+
if (!ry0) return null;
|
|
5764
|
+
const rr0 = _XdotParser.parseReal(s, ry0.pos);
|
|
5765
|
+
if (!rr0) return null;
|
|
5766
|
+
const rx1 = _XdotParser.parseReal(s, rr0.pos);
|
|
5767
|
+
if (!rx1) return null;
|
|
5768
|
+
const ry1 = _XdotParser.parseReal(s, rx1.pos);
|
|
5769
|
+
if (!ry1) return null;
|
|
5770
|
+
const rr1 = _XdotParser.parseReal(s, ry1.pos);
|
|
5771
|
+
if (!rr1) return null;
|
|
5772
|
+
const rn = _XdotParser.parseUInt_(s, rr1.pos);
|
|
5773
|
+
if (!rn) return null;
|
|
5774
|
+
const rs = _XdotParser.parseStops(s, rn.pos, rn.val);
|
|
5775
|
+
if (!rs) return null;
|
|
5776
|
+
return { x0: rx0.val, y0: ry0.val, r0: rr0.val, x1: rx1.val, y1: ry1.val, r1: rr1.val, stops: rs.stops };
|
|
5777
|
+
}
|
|
5778
|
+
static isAlnum(c) {
|
|
5779
|
+
return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9";
|
|
5780
|
+
}
|
|
5781
|
+
static parseXDotColorAt(s, pos) {
|
|
5782
|
+
const c = pos < s.length ? s[pos] : "";
|
|
5783
|
+
if (c === "[") {
|
|
5784
|
+
const g = _XdotParser.linGradient(s, pos + 1);
|
|
5785
|
+
if (!g) return null;
|
|
5786
|
+
return { val: { type: "linear", ling: g }, pos };
|
|
5787
|
+
}
|
|
5788
|
+
if (c === "(") {
|
|
5789
|
+
const g = _XdotParser.radGradient(s, pos + 1);
|
|
5790
|
+
if (!g) return null;
|
|
5791
|
+
return { val: { type: "radial", ring: g }, pos };
|
|
5792
|
+
}
|
|
5793
|
+
if (c === "#" || c === "/" || _XdotParser.isAlnum(c))
|
|
5794
|
+
return { val: { type: "none", clr: s.slice(pos) }, pos };
|
|
5795
|
+
return null;
|
|
5796
|
+
}
|
|
5797
|
+
static parseEllipseOp(ch, s, pos, fns) {
|
|
5798
|
+
const r = _XdotParser.parseRect(s, pos);
|
|
5799
|
+
if (!r) return "error";
|
|
5800
|
+
const op = { kind: ch === "E" ? "filled_ellipse" : "unfilled_ellipse", ellipse: r.val };
|
|
5801
|
+
fns.ellipse?.(op, 0);
|
|
5802
|
+
return { op, pos: r.pos };
|
|
5803
|
+
}
|
|
5804
|
+
static parsePolygonOp(ch, s, pos, fns) {
|
|
5805
|
+
const r = _XdotParser.parsePolyline(s, pos);
|
|
5806
|
+
if (!r) return "error";
|
|
5807
|
+
const op = { kind: ch === "P" ? "filled_polygon" : "unfilled_polygon", polygon: r.val };
|
|
5808
|
+
fns.polygon?.(op, 0);
|
|
5809
|
+
return { op, pos: r.pos };
|
|
5810
|
+
}
|
|
5811
|
+
static parseBezierOp(ch, s, pos, fns) {
|
|
5812
|
+
const r = _XdotParser.parsePolyline(s, pos);
|
|
5813
|
+
if (!r) return "error";
|
|
5814
|
+
const op = { kind: ch === "b" ? "filled_bezier" : "unfilled_bezier", bezier: r.val };
|
|
5815
|
+
fns.bezier?.(op, 0);
|
|
5816
|
+
return { op, pos: r.pos };
|
|
5817
|
+
}
|
|
5818
|
+
static parsePolylineOp(s, pos, fns) {
|
|
5819
|
+
const r = _XdotParser.parsePolyline(s, pos);
|
|
5820
|
+
if (!r) return "error";
|
|
5821
|
+
const op = { kind: "polyline", polyline: r.val };
|
|
5822
|
+
fns.polyline?.(op, 0);
|
|
5823
|
+
return { op, pos: r.pos };
|
|
5824
|
+
}
|
|
5825
|
+
static parseTextOp(s, pos, fns) {
|
|
5826
|
+
const rx = _XdotParser.parseReal(s, pos);
|
|
5827
|
+
if (!rx) return "error";
|
|
5828
|
+
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
5829
|
+
if (!ry) return "error";
|
|
5830
|
+
const ra = _XdotParser.parseAlign(s, ry.pos);
|
|
5831
|
+
if (!ra) return "error";
|
|
5832
|
+
const rw = _XdotParser.parseReal(s, ra.pos);
|
|
5833
|
+
if (!rw) return "error";
|
|
5834
|
+
const rt = _XdotParser.parseString(s, rw.pos);
|
|
5835
|
+
if (!rt) return "error";
|
|
5836
|
+
const text = { x: rx.val, y: ry.val, align: ra.val, width: rw.val, text: rt.val };
|
|
5837
|
+
const op = { kind: "text", text };
|
|
5838
|
+
fns.text?.(op, 0);
|
|
5839
|
+
return { op, pos: rt.pos };
|
|
5840
|
+
}
|
|
5841
|
+
static parseColorOp(ch, s, pos, fns) {
|
|
5842
|
+
const rs = _XdotParser.parseString(s, pos);
|
|
5843
|
+
if (!rs) return "error";
|
|
5844
|
+
const rc = _XdotParser.parseXDotColorAt(rs.val, 0);
|
|
5845
|
+
if (!rc) return "error";
|
|
5846
|
+
const clr = rc.val;
|
|
5847
|
+
if (clr.type === "none") {
|
|
5848
|
+
const op2 = { kind: ch === "C" ? "fill_color" : "pen_color", color: clr.clr };
|
|
5849
|
+
(ch === "C" ? fns.fill_color : fns.pen_color)?.(op2, 0);
|
|
5850
|
+
return { op: op2, pos: rs.pos };
|
|
5851
|
+
}
|
|
5852
|
+
const op = { kind: ch === "C" ? "grad_fill_color" : "grad_pen_color", gradColor: clr };
|
|
5853
|
+
fns.grad_color?.(op, 0);
|
|
5854
|
+
return { op, pos: rs.pos };
|
|
5855
|
+
}
|
|
5856
|
+
static parseFontOp(s, pos, fns) {
|
|
5857
|
+
const rs = _XdotParser.parseReal(s, pos);
|
|
5858
|
+
if (!rs) return "error";
|
|
5859
|
+
const rn = _XdotParser.parseString(s, rs.pos);
|
|
5860
|
+
if (!rn) return "error";
|
|
5861
|
+
const op = { kind: "font", font: { size: rs.val, name: rn.val } };
|
|
5862
|
+
fns.font?.(op, 0);
|
|
5863
|
+
return { op, pos: rn.pos };
|
|
5864
|
+
}
|
|
5865
|
+
static parseStyleOp(s, pos, fns) {
|
|
5866
|
+
const r = _XdotParser.parseString(s, pos);
|
|
5867
|
+
if (!r) return "error";
|
|
5868
|
+
const op = { kind: "style", style: r.val };
|
|
5869
|
+
fns.style?.(op, 0);
|
|
5870
|
+
return { op, pos: r.pos };
|
|
5871
|
+
}
|
|
5872
|
+
static parseImageOp(s, pos, fns) {
|
|
5873
|
+
const rr = _XdotParser.parseRect(s, pos);
|
|
5874
|
+
if (!rr) return "error";
|
|
5875
|
+
const rn = _XdotParser.parseString(s, rr.pos);
|
|
5876
|
+
if (!rn) return "error";
|
|
5877
|
+
const op = { kind: "image", image: { pos: rr.val, name: rn.val } };
|
|
5878
|
+
fns.image?.(op, 0);
|
|
5879
|
+
return { op, pos: rn.pos };
|
|
5880
|
+
}
|
|
5881
|
+
static parseFontcharOp(s, pos, fns) {
|
|
5882
|
+
const r = _XdotParser.parseUInt_(s, pos);
|
|
5883
|
+
if (!r) return "error";
|
|
5884
|
+
const op = { kind: "fontchar", fontchar: r.val };
|
|
5885
|
+
fns.fontchar?.(op, 0);
|
|
5886
|
+
return { op, pos: r.pos };
|
|
5887
|
+
}
|
|
5888
|
+
static parseShapeOp(ch, s, pos, fns) {
|
|
5889
|
+
if (ch === "E" || ch === "e") return _XdotParser.parseEllipseOp(ch, s, pos, fns);
|
|
5890
|
+
if (ch === "P" || ch === "p") return _XdotParser.parsePolygonOp(ch, s, pos, fns);
|
|
5891
|
+
if (ch === "b" || ch === "B") return _XdotParser.parseBezierOp(ch, s, pos, fns);
|
|
5892
|
+
if (ch === "L") return _XdotParser.parsePolylineOp(s, pos, fns);
|
|
5893
|
+
return null;
|
|
5894
|
+
}
|
|
5895
|
+
static parseMetaOp(ch, s, pos, fns) {
|
|
5896
|
+
if (ch === "T") return _XdotParser.parseTextOp(s, pos, fns);
|
|
5897
|
+
if (ch === "C" || ch === "c") return _XdotParser.parseColorOp(ch, s, pos, fns);
|
|
5898
|
+
if (ch === "F") return _XdotParser.parseFontOp(s, pos, fns);
|
|
5899
|
+
if (ch === "S") return _XdotParser.parseStyleOp(s, pos, fns);
|
|
5900
|
+
if (ch === "I") return _XdotParser.parseImageOp(s, pos, fns);
|
|
5901
|
+
if (ch === "t") return _XdotParser.parseFontcharOp(s, pos, fns);
|
|
5902
|
+
if (ch === "\0") return null;
|
|
5903
|
+
return "error";
|
|
5904
|
+
}
|
|
5905
|
+
static parseOp(s, pos, fns) {
|
|
5906
|
+
pos = _XdotParser.skipWs(s, pos);
|
|
5907
|
+
if (pos >= s.length) return null;
|
|
5908
|
+
const ch = s[pos++];
|
|
5909
|
+
const shape = _XdotParser.parseShapeOp(ch, s, pos, fns);
|
|
5910
|
+
if (shape !== null) return shape;
|
|
5911
|
+
return _XdotParser.parseMetaOp(ch, s, pos, fns);
|
|
5912
|
+
}
|
|
5913
|
+
static parseXDotFOn(s, opFns, _sz, x) {
|
|
5914
|
+
if (!s) return x;
|
|
5915
|
+
const result = x ?? { ops: [], flags: 0 };
|
|
5916
|
+
let pos = 0;
|
|
5917
|
+
while (pos < s.length) {
|
|
5918
|
+
const r = _XdotParser.parseOp(s, pos, opFns);
|
|
5919
|
+
if (r === null) break;
|
|
5920
|
+
if (r === "error") {
|
|
5921
|
+
result.flags |= XDOT_PARSE_ERROR;
|
|
5922
|
+
break;
|
|
5923
|
+
}
|
|
5924
|
+
result.ops.push(r.op);
|
|
5925
|
+
pos = r.pos;
|
|
5926
|
+
}
|
|
5927
|
+
return result.ops.length === 0 ? null : result;
|
|
5928
|
+
}
|
|
5929
|
+
static parseXDotF(s, opFns, sz) {
|
|
5930
|
+
return _XdotParser.parseXDotFOn(s, opFns, sz, null);
|
|
5931
|
+
}
|
|
5932
|
+
static parseXDot(s) {
|
|
5933
|
+
return _XdotParser.parseXDotF(s, {}, 0);
|
|
5934
|
+
}
|
|
5935
|
+
static parseXDotColor(s) {
|
|
5936
|
+
const r = _XdotParser.parseXDotColorAt(s, 0);
|
|
5937
|
+
return r ? r.val : null;
|
|
5938
|
+
}
|
|
5939
|
+
};
|
|
5940
|
+
function parseXDot(s) {
|
|
5941
|
+
return XdotParser.parseXDot(s);
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5944
|
+
// src/xdot/misc.ts
|
|
5945
|
+
var SHAPE_LETTER = {
|
|
5946
|
+
filled_ellipse: "E",
|
|
5947
|
+
unfilled_ellipse: "e",
|
|
5948
|
+
filled_polygon: "P",
|
|
5949
|
+
unfilled_polygon: "p",
|
|
5950
|
+
filled_bezier: "b",
|
|
5951
|
+
unfilled_bezier: "B",
|
|
5952
|
+
polyline: "L"
|
|
5953
|
+
};
|
|
5954
|
+
var SHAPE_KINDS = new Set(Object.keys(SHAPE_LETTER));
|
|
5955
|
+
|
|
5956
|
+
// src/gvc/init-xdot.ts
|
|
5957
|
+
var xdotsByGraph = /* @__PURE__ */ new WeakMap();
|
|
5958
|
+
function initXdot(g) {
|
|
5959
|
+
xdotsByGraph.delete(g);
|
|
5960
|
+
const p = g.attrs?.get("_background") || g.attrs?.get("_draw_");
|
|
5961
|
+
if (!p) return;
|
|
5962
|
+
const xd = parseXDot(p);
|
|
5963
|
+
if (xd === null) {
|
|
5964
|
+
agwarningf(`Could not parse "_background" attribute in graph ${g.name}`);
|
|
5965
|
+
agerr("prev", ` "${p}"`);
|
|
5966
|
+
return;
|
|
5967
|
+
}
|
|
5968
|
+
xdotsByGraph.set(g, xd);
|
|
5969
|
+
}
|
|
5970
|
+
function graphXdots(g) {
|
|
5971
|
+
return xdotsByGraph.get(g);
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5974
|
+
// src/common/arith.ts
|
|
5975
|
+
function cround(v) {
|
|
5976
|
+
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
5977
|
+
}
|
|
5978
|
+
var INT64_MAX = 2n ** 63n - 1n;
|
|
5979
|
+
var INT64_MIN = -(2n ** 63n);
|
|
5980
|
+
var TWO_POW_63 = 2 ** 63;
|
|
5981
|
+
function croundNarrow32(v) {
|
|
5982
|
+
const r = cround(v);
|
|
5983
|
+
let i64;
|
|
5984
|
+
if (Number.isNaN(r)) i64 = 0n;
|
|
5985
|
+
else if (r >= TWO_POW_63) i64 = INT64_MAX;
|
|
5986
|
+
else if (r < -TWO_POW_63) i64 = INT64_MIN;
|
|
5987
|
+
else i64 = BigInt(r);
|
|
5988
|
+
return Number(BigInt.asIntN(32, i64));
|
|
5989
|
+
}
|
|
5990
|
+
function RADIANS(deg) {
|
|
5991
|
+
return deg / 180 * Math.PI;
|
|
5992
|
+
}
|
|
5993
|
+
|
|
5994
|
+
// src/util/printf-round.ts
|
|
5995
|
+
function decomposeFloat64(v) {
|
|
5996
|
+
const buf = new DataView(new ArrayBuffer(8));
|
|
5997
|
+
buf.setFloat64(0, v, false);
|
|
5998
|
+
const hi = buf.getUint32(0, false);
|
|
5999
|
+
const lo = buf.getUint32(4, false);
|
|
6000
|
+
const expBits = hi >>> 20 & 2047;
|
|
6001
|
+
const mantHi = BigInt(hi & 1048575);
|
|
6002
|
+
const mantLo = BigInt(lo >>> 0);
|
|
6003
|
+
let mantissa = mantHi << 32n | mantLo;
|
|
6004
|
+
let binExp;
|
|
6005
|
+
if (expBits === 0) {
|
|
6006
|
+
binExp = -1074;
|
|
6007
|
+
} else {
|
|
6008
|
+
mantissa |= 1n << 52n;
|
|
6009
|
+
binExp = expBits - 1075;
|
|
6010
|
+
}
|
|
6011
|
+
return { mantissa, binExp };
|
|
6012
|
+
}
|
|
6013
|
+
function exactDecimalDigits(v) {
|
|
6014
|
+
const { mantissa, binExp } = decomposeFloat64(v);
|
|
6015
|
+
let digits;
|
|
6016
|
+
let exponent10;
|
|
6017
|
+
if (binExp >= 0) {
|
|
6018
|
+
digits = mantissa << BigInt(binExp);
|
|
6019
|
+
exponent10 = 0;
|
|
6020
|
+
} else {
|
|
6021
|
+
digits = mantissa * 5n ** BigInt(-binExp);
|
|
6022
|
+
exponent10 = binExp;
|
|
6023
|
+
}
|
|
6024
|
+
while (digits !== 0n && digits % 10n === 0n) {
|
|
6025
|
+
digits /= 10n;
|
|
6026
|
+
exponent10 += 1;
|
|
6027
|
+
}
|
|
6028
|
+
return { digits, exponent10 };
|
|
6029
|
+
}
|
|
6030
|
+
function roundHalfEvenDrop(value, dropCount) {
|
|
6031
|
+
const divisor = 10n ** BigInt(dropCount);
|
|
6032
|
+
const q = value / divisor;
|
|
6033
|
+
const r = value % divisor;
|
|
6034
|
+
const half = divisor / 2n;
|
|
6035
|
+
if (r > half || r === half && q % 2n === 1n) return q + 1n;
|
|
6036
|
+
return q;
|
|
6037
|
+
}
|
|
6038
|
+
function printfFixed(v, decimals) {
|
|
6039
|
+
if (!Number.isFinite(v)) return v.toFixed(decimals);
|
|
6040
|
+
if (v === 0) return decimals > 0 ? "0." + "0".repeat(decimals) : "0";
|
|
6041
|
+
const sign2 = v < 0 ? "-" : "";
|
|
6042
|
+
const { digits, exponent10 } = exactDecimalDigits(Math.abs(v));
|
|
6043
|
+
const shift = exponent10 + decimals;
|
|
6044
|
+
const scaled = shift >= 0 ? digits * 10n ** BigInt(shift) : roundHalfEvenDrop(digits, -shift);
|
|
6045
|
+
if (decimals === 0) return sign2 + scaled.toString();
|
|
6046
|
+
let s = scaled.toString();
|
|
6047
|
+
if (s.length <= decimals) s = "0".repeat(decimals - s.length + 1) + s;
|
|
6048
|
+
const intPart = s.slice(0, s.length - decimals);
|
|
6049
|
+
const fracPart = s.slice(s.length - decimals);
|
|
6050
|
+
return sign2 + intPart + "." + fracPart;
|
|
6051
|
+
}
|
|
6052
|
+
function printfSig(v, sig) {
|
|
6053
|
+
if (!Number.isFinite(v)) return v.toPrecision(sig);
|
|
6054
|
+
if (v === 0) return sig > 1 ? "0." + "0".repeat(sig - 1) : "0";
|
|
6055
|
+
const sign2 = v < 0 ? "-" : "";
|
|
6056
|
+
const { digits, exponent10 } = exactDecimalDigits(Math.abs(v));
|
|
6057
|
+
const digitsStr0 = digits.toString();
|
|
6058
|
+
const len = digitsStr0.length;
|
|
6059
|
+
const decExp0 = len + exponent10;
|
|
6060
|
+
let digitsStr;
|
|
6061
|
+
let decExp = decExp0;
|
|
6062
|
+
if (len <= sig) {
|
|
6063
|
+
digitsStr = digitsStr0 + "0".repeat(sig - len);
|
|
6064
|
+
} else {
|
|
6065
|
+
const q = roundHalfEvenDrop(digits, len - sig);
|
|
6066
|
+
let qStr = q.toString();
|
|
6067
|
+
if (qStr.length > sig) {
|
|
6068
|
+
qStr = qStr.slice(0, sig);
|
|
6069
|
+
decExp += 1;
|
|
6070
|
+
}
|
|
6071
|
+
digitsStr = qStr;
|
|
6072
|
+
}
|
|
6073
|
+
const e = decExp - 1;
|
|
6074
|
+
if (e < -6 || e >= sig) {
|
|
6075
|
+
const mantissa = sig > 1 ? digitsStr[0] + "." + digitsStr.slice(1) : digitsStr[0];
|
|
6076
|
+
return sign2 + mantissa + "e" + (e >= 0 ? "+" : "-") + String(Math.abs(e));
|
|
6077
|
+
}
|
|
6078
|
+
if (e >= 0) {
|
|
6079
|
+
const intPart = digitsStr.slice(0, e + 1);
|
|
6080
|
+
const fracPart = digitsStr.slice(e + 1);
|
|
6081
|
+
return sign2 + intPart + (fracPart.length > 0 ? "." + fracPart : "");
|
|
6082
|
+
}
|
|
6083
|
+
return sign2 + "0." + "0".repeat(-(e + 1)) + digitsStr;
|
|
6084
|
+
}
|
|
6085
|
+
|
|
6086
|
+
// src/gvc/landscape.ts
|
|
6087
|
+
function landscapeMapbool(s) {
|
|
6088
|
+
const v = s.toLowerCase();
|
|
6089
|
+
if (v === "" || v === "false" || v === "no") return false;
|
|
6090
|
+
if (v === "true" || v === "yes") return true;
|
|
6091
|
+
return Number.parseInt(s, 10) !== 0;
|
|
6092
|
+
}
|
|
6093
|
+
function parseLandscape(g) {
|
|
6094
|
+
const rotate = g.attrs.get("rotate");
|
|
6095
|
+
if (rotate !== void 0) return Number.parseInt(rotate, 10) === 90;
|
|
6096
|
+
const orientation = g.attrs.get("orientation");
|
|
6097
|
+
if (orientation !== void 0) {
|
|
6098
|
+
return orientation[0] === "l" || orientation[0] === "L";
|
|
6099
|
+
}
|
|
6100
|
+
const landscape = g.attrs.get("landscape");
|
|
6101
|
+
if (landscape !== void 0) return landscapeMapbool(landscape);
|
|
6102
|
+
return false;
|
|
6103
|
+
}
|
|
6104
|
+
|
|
6105
|
+
// src/gvc/layout-bb.ts
|
|
6106
|
+
var layoutBbByGraph = /* @__PURE__ */ new WeakMap();
|
|
6107
|
+
function writeLayoutBb(g) {
|
|
6108
|
+
const bb = g.info?.bb;
|
|
6109
|
+
if (bb === void 0 || !g.attrs) return;
|
|
6110
|
+
const parts = parseLandscape(g) ? [bb.ll.y, bb.ll.x, bb.ur.y, bb.ur.x] : [bb.ll.x, bb.ll.y, bb.ur.x, bb.ur.y];
|
|
6111
|
+
const written = parts.map((v) => printfFixed(cround(v), 0)).join(" ");
|
|
6112
|
+
layoutBbByGraph.set(g, { written, replaced: g.attrs.get("bb") });
|
|
6113
|
+
g.attrs.set("bb", written);
|
|
6114
|
+
}
|
|
6115
|
+
function attrsWithoutLayoutBb(g) {
|
|
6116
|
+
const own = layoutBbByGraph.get(g);
|
|
6117
|
+
if (own === void 0 || g.attrs.get("bb") !== own.written) return g.attrs;
|
|
6118
|
+
const attrs = new Map(g.attrs);
|
|
6119
|
+
if (own.replaced === void 0) attrs.delete("bb");
|
|
6120
|
+
else attrs.set("bb", own.replaced);
|
|
6121
|
+
return attrs;
|
|
6122
|
+
}
|
|
6123
|
+
|
|
5574
6124
|
// src/gvc/context.ts
|
|
5575
6125
|
var PluginRegistry = class {
|
|
5576
6126
|
/** @see lib/gvc/gvplugin.c:gvplugin_install — ordering rules */
|
|
@@ -5679,6 +6229,10 @@ var GvcContext = class {
|
|
|
5679
6229
|
* (setTextMeasurer, setImageSizer, setImageResolver, the per-context
|
|
5680
6230
|
* measurer/sizer/resolver) are configuration and are not reset.
|
|
5681
6231
|
*
|
|
6232
|
+
* After a freeLayout, the engine sees new records, as it does in C (part-9
|
|
6233
|
+
* AD-11, see layout-reset.ts). Without one it sees the stale records, as it
|
|
6234
|
+
* does in C.
|
|
6235
|
+
*
|
|
5682
6236
|
* @throws TypeError (ERR_INVALID_ARG_TYPE / ERR_INVALID_ARG_VALUE) for a
|
|
5683
6237
|
* bad `g`, or an engine argument that is not registered
|
|
5684
6238
|
* @throws RenderError (UNKNOWN_LAYOUT) if the `layout` attribute names no
|
|
@@ -5703,13 +6257,18 @@ var GvcContext = class {
|
|
|
5703
6257
|
}
|
|
5704
6258
|
engine = override2;
|
|
5705
6259
|
}
|
|
6260
|
+
if (layoutWasFreed(g)) resetLayoutRecords(g);
|
|
5706
6261
|
if (g.info) g.info.gvc = this;
|
|
6262
|
+
initXdot(g);
|
|
5707
6263
|
engine.layout(g);
|
|
6264
|
+
writeLayoutBb(g);
|
|
5708
6265
|
if (g.info) g.info.cleanup = (x) => engine.cleanup(x);
|
|
5709
6266
|
if (g.info) g.info.laidOut = true;
|
|
5710
6267
|
}
|
|
5711
6268
|
/**
|
|
5712
|
-
* Release engine layout state after rendering.
|
|
6269
|
+
* Release engine layout state after rendering. The records themselves stay,
|
|
6270
|
+
* for getLayout, until the next layout replaces them (part-9 AD-11, see
|
|
6271
|
+
* layout-reset.ts).
|
|
5713
6272
|
*
|
|
5714
6273
|
* @throws TypeError (ERR_INVALID_ARG_TYPE / ERR_INVALID_ARG_VALUE) for a
|
|
5715
6274
|
* bad `g`, or an engine argument that is not registered
|
|
@@ -5725,98 +6284,6 @@ var GvcContext = class {
|
|
|
5725
6284
|
}
|
|
5726
6285
|
};
|
|
5727
6286
|
|
|
5728
|
-
// src/util/printf-round.ts
|
|
5729
|
-
function decomposeFloat64(v) {
|
|
5730
|
-
const buf = new DataView(new ArrayBuffer(8));
|
|
5731
|
-
buf.setFloat64(0, v, false);
|
|
5732
|
-
const hi = buf.getUint32(0, false);
|
|
5733
|
-
const lo = buf.getUint32(4, false);
|
|
5734
|
-
const expBits = hi >>> 20 & 2047;
|
|
5735
|
-
const mantHi = BigInt(hi & 1048575);
|
|
5736
|
-
const mantLo = BigInt(lo >>> 0);
|
|
5737
|
-
let mantissa = mantHi << 32n | mantLo;
|
|
5738
|
-
let binExp;
|
|
5739
|
-
if (expBits === 0) {
|
|
5740
|
-
binExp = -1074;
|
|
5741
|
-
} else {
|
|
5742
|
-
mantissa |= 1n << 52n;
|
|
5743
|
-
binExp = expBits - 1075;
|
|
5744
|
-
}
|
|
5745
|
-
return { mantissa, binExp };
|
|
5746
|
-
}
|
|
5747
|
-
function exactDecimalDigits(v) {
|
|
5748
|
-
const { mantissa, binExp } = decomposeFloat64(v);
|
|
5749
|
-
let digits;
|
|
5750
|
-
let exponent10;
|
|
5751
|
-
if (binExp >= 0) {
|
|
5752
|
-
digits = mantissa << BigInt(binExp);
|
|
5753
|
-
exponent10 = 0;
|
|
5754
|
-
} else {
|
|
5755
|
-
digits = mantissa * 5n ** BigInt(-binExp);
|
|
5756
|
-
exponent10 = binExp;
|
|
5757
|
-
}
|
|
5758
|
-
while (digits !== 0n && digits % 10n === 0n) {
|
|
5759
|
-
digits /= 10n;
|
|
5760
|
-
exponent10 += 1;
|
|
5761
|
-
}
|
|
5762
|
-
return { digits, exponent10 };
|
|
5763
|
-
}
|
|
5764
|
-
function roundHalfEvenDrop(value, dropCount) {
|
|
5765
|
-
const divisor = 10n ** BigInt(dropCount);
|
|
5766
|
-
const q = value / divisor;
|
|
5767
|
-
const r = value % divisor;
|
|
5768
|
-
const half = divisor / 2n;
|
|
5769
|
-
if (r > half || r === half && q % 2n === 1n) return q + 1n;
|
|
5770
|
-
return q;
|
|
5771
|
-
}
|
|
5772
|
-
function printfFixed(v, decimals) {
|
|
5773
|
-
if (!Number.isFinite(v)) return v.toFixed(decimals);
|
|
5774
|
-
if (v === 0) return decimals > 0 ? "0." + "0".repeat(decimals) : "0";
|
|
5775
|
-
const sign2 = v < 0 ? "-" : "";
|
|
5776
|
-
const { digits, exponent10 } = exactDecimalDigits(Math.abs(v));
|
|
5777
|
-
const shift = exponent10 + decimals;
|
|
5778
|
-
const scaled = shift >= 0 ? digits * 10n ** BigInt(shift) : roundHalfEvenDrop(digits, -shift);
|
|
5779
|
-
if (decimals === 0) return sign2 + scaled.toString();
|
|
5780
|
-
let s = scaled.toString();
|
|
5781
|
-
if (s.length <= decimals) s = "0".repeat(decimals - s.length + 1) + s;
|
|
5782
|
-
const intPart = s.slice(0, s.length - decimals);
|
|
5783
|
-
const fracPart = s.slice(s.length - decimals);
|
|
5784
|
-
return sign2 + intPart + "." + fracPart;
|
|
5785
|
-
}
|
|
5786
|
-
function printfSig(v, sig) {
|
|
5787
|
-
if (!Number.isFinite(v)) return v.toPrecision(sig);
|
|
5788
|
-
if (v === 0) return sig > 1 ? "0." + "0".repeat(sig - 1) : "0";
|
|
5789
|
-
const sign2 = v < 0 ? "-" : "";
|
|
5790
|
-
const { digits, exponent10 } = exactDecimalDigits(Math.abs(v));
|
|
5791
|
-
const digitsStr0 = digits.toString();
|
|
5792
|
-
const len = digitsStr0.length;
|
|
5793
|
-
const decExp0 = len + exponent10;
|
|
5794
|
-
let digitsStr;
|
|
5795
|
-
let decExp = decExp0;
|
|
5796
|
-
if (len <= sig) {
|
|
5797
|
-
digitsStr = digitsStr0 + "0".repeat(sig - len);
|
|
5798
|
-
} else {
|
|
5799
|
-
const q = roundHalfEvenDrop(digits, len - sig);
|
|
5800
|
-
let qStr = q.toString();
|
|
5801
|
-
if (qStr.length > sig) {
|
|
5802
|
-
qStr = qStr.slice(0, sig);
|
|
5803
|
-
decExp += 1;
|
|
5804
|
-
}
|
|
5805
|
-
digitsStr = qStr;
|
|
5806
|
-
}
|
|
5807
|
-
const e = decExp - 1;
|
|
5808
|
-
if (e < -6 || e >= sig) {
|
|
5809
|
-
const mantissa = sig > 1 ? digitsStr[0] + "." + digitsStr.slice(1) : digitsStr[0];
|
|
5810
|
-
return sign2 + mantissa + "e" + (e >= 0 ? "+" : "-") + String(Math.abs(e));
|
|
5811
|
-
}
|
|
5812
|
-
if (e >= 0) {
|
|
5813
|
-
const intPart = digitsStr.slice(0, e + 1);
|
|
5814
|
-
const fracPart = digitsStr.slice(e + 1);
|
|
5815
|
-
return sign2 + intPart + (fracPart.length > 0 ? "." + fracPart : "");
|
|
5816
|
-
}
|
|
5817
|
-
return sign2 + "0." + "0".repeat(-(e + 1)) + digitsStr;
|
|
5818
|
-
}
|
|
5819
|
-
|
|
5820
6287
|
// src/gvc/job.ts
|
|
5821
6288
|
var EMIT_SORTED = 1 << 0;
|
|
5822
6289
|
var EMIT_COLORS = 1 << 1;
|
|
@@ -20359,26 +20826,6 @@ function makeSelfEdge(edges, cnt, sizex, sizey, sinfo) {
|
|
|
20359
20826
|
}
|
|
20360
20827
|
}
|
|
20361
20828
|
|
|
20362
|
-
// src/common/arith.ts
|
|
20363
|
-
function cround(v) {
|
|
20364
|
-
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
20365
|
-
}
|
|
20366
|
-
var INT64_MAX = 2n ** 63n - 1n;
|
|
20367
|
-
var INT64_MIN = -(2n ** 63n);
|
|
20368
|
-
var TWO_POW_63 = 2 ** 63;
|
|
20369
|
-
function croundNarrow32(v) {
|
|
20370
|
-
const r = cround(v);
|
|
20371
|
-
let i64;
|
|
20372
|
-
if (Number.isNaN(r)) i64 = 0n;
|
|
20373
|
-
else if (r >= TWO_POW_63) i64 = INT64_MAX;
|
|
20374
|
-
else if (r < -TWO_POW_63) i64 = INT64_MIN;
|
|
20375
|
-
else i64 = BigInt(r);
|
|
20376
|
-
return Number(BigInt.asIntN(32, i64));
|
|
20377
|
-
}
|
|
20378
|
-
function RADIANS(deg) {
|
|
20379
|
-
return deg / 180 * Math.PI;
|
|
20380
|
-
}
|
|
20381
|
-
|
|
20382
20829
|
// src/layout/dot/position-aux.ts
|
|
20383
20830
|
var CL_OFFSET = 8;
|
|
20384
20831
|
function clusterMarginOf(g) {
|
|
@@ -26762,9 +27209,17 @@ function dotInitSubg(g) {
|
|
|
26762
27209
|
if (clust && clust[c - 1]) dotInitSubg(clust[c - 1]);
|
|
26763
27210
|
}
|
|
26764
27211
|
}
|
|
27212
|
+
function clearFastGraphLists(n) {
|
|
27213
|
+
n.info.in = void 0;
|
|
27214
|
+
n.info.out = void 0;
|
|
27215
|
+
n.info.flat_in = void 0;
|
|
27216
|
+
n.info.flat_out = void 0;
|
|
27217
|
+
n.info.other = void 0;
|
|
27218
|
+
}
|
|
26765
27219
|
function dotInitNodeEdge(g) {
|
|
26766
27220
|
for (const n of nodesInSeq(g)) {
|
|
26767
27221
|
commonInitNode(n, g);
|
|
27222
|
+
clearFastGraphLists(n);
|
|
26768
27223
|
dotInitNode(n);
|
|
26769
27224
|
}
|
|
26770
27225
|
const measurer = g.root.info.gvc?.textMeasurer;
|
|
@@ -26805,11 +27260,7 @@ function dotCleanup(g) {
|
|
|
26805
27260
|
let n = g.info.nlist;
|
|
26806
27261
|
while (n !== void 0) {
|
|
26807
27262
|
const next = n.info.next;
|
|
26808
|
-
n
|
|
26809
|
-
n.info.out = void 0;
|
|
26810
|
-
n.info.flat_in = void 0;
|
|
26811
|
-
n.info.flat_out = void 0;
|
|
26812
|
-
n.info.other = void 0;
|
|
27263
|
+
clearFastGraphLists(n);
|
|
26813
27264
|
n.info.next = void 0;
|
|
26814
27265
|
n.info.prev = void 0;
|
|
26815
27266
|
n = next;
|
|
@@ -28686,23 +29137,6 @@ function parseGraphMargin(raw) {
|
|
|
28686
29137
|
}
|
|
28687
29138
|
return { x: SVG_MARGIN, y: SVG_MARGIN };
|
|
28688
29139
|
}
|
|
28689
|
-
function landscapeMapbool(s) {
|
|
28690
|
-
const v = s.toLowerCase();
|
|
28691
|
-
if (v === "" || v === "false" || v === "no") return false;
|
|
28692
|
-
if (v === "true" || v === "yes") return true;
|
|
28693
|
-
return Number.parseInt(s, 10) !== 0;
|
|
28694
|
-
}
|
|
28695
|
-
function parseLandscape(g) {
|
|
28696
|
-
const rotate = g.attrs.get("rotate");
|
|
28697
|
-
if (rotate !== void 0) return Number.parseInt(rotate, 10) === 90;
|
|
28698
|
-
const orientation = g.attrs.get("orientation");
|
|
28699
|
-
if (orientation !== void 0) {
|
|
28700
|
-
return orientation[0] === "l" || orientation[0] === "L";
|
|
28701
|
-
}
|
|
28702
|
-
const landscape = g.attrs.get("landscape");
|
|
28703
|
-
if (landscape !== void 0) return landscapeMapbool(landscape);
|
|
28704
|
-
return false;
|
|
28705
|
-
}
|
|
28706
29140
|
function drawingNeedsFit(size, szx, szy) {
|
|
28707
29141
|
const tooBig = size.x < szx || size.y < szy;
|
|
28708
29142
|
const fillsUp = size.filled && size.x > szx && size.y > szy;
|
|
@@ -29219,6 +29653,138 @@ function nextLayer(job, cur) {
|
|
|
29219
29653
|
}
|
|
29220
29654
|
}
|
|
29221
29655
|
|
|
29656
|
+
// src/gvc/emit-xdot.ts
|
|
29657
|
+
var DEFAULT_COLOR5 = "black";
|
|
29658
|
+
var DEFAULT_FILL2 = "lightgrey";
|
|
29659
|
+
var DEFAULT_LINE_STYLE2 = ["solid", "setlinewidth(1)"];
|
|
29660
|
+
function deviceClip(g, renderer, job) {
|
|
29661
|
+
if (renderer.type === "svg") return job.clip;
|
|
29662
|
+
const attr2 = g.attrs.get("pad");
|
|
29663
|
+
const pad = attr2 ? parseGraphPad(attr2) : { x: 0, y: 0 };
|
|
29664
|
+
const size = parseDrawingSize(g.attrs.get("size"));
|
|
29665
|
+
return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
|
|
29666
|
+
}
|
|
29667
|
+
function zeroBoxInClip(clip) {
|
|
29668
|
+
return clip.ll.x <= 0 && clip.ll.y <= 0 && clip.ur.x >= 0 && clip.ur.y >= 0;
|
|
29669
|
+
}
|
|
29670
|
+
function applyBackgroundState(g, renderer, obj) {
|
|
29671
|
+
const attr2 = g.attrs.get("bgcolor");
|
|
29672
|
+
const color = attr2 !== void 0 && attr2 !== "" ? attr2 : "white";
|
|
29673
|
+
const trueColor = renderer.type === "svg";
|
|
29674
|
+
if (trueColor && color === "transparent") {
|
|
29675
|
+
obj.penColor = resolveRenderColor(DEFAULT_COLOR5);
|
|
29676
|
+
obj.fillColor = resolveFillColorName(DEFAULT_FILL2);
|
|
29677
|
+
return;
|
|
29678
|
+
}
|
|
29679
|
+
const str = color === "transparent" ? "white" : color;
|
|
29680
|
+
obj.penColor = resolveRenderColor("transparent");
|
|
29681
|
+
const stop = str.includes(":") ? findStopColor(str) : null;
|
|
29682
|
+
if (stop === null) {
|
|
29683
|
+
obj.fillColor = resolveFillColorName(str);
|
|
29684
|
+
return;
|
|
29685
|
+
}
|
|
29686
|
+
obj.fillColor = resolveFillColorName(stop.fillColor);
|
|
29687
|
+
obj.stopColor = resolveFillColorName(stop.stopColor);
|
|
29688
|
+
obj.gradientAngle = lateInt(g.attrs.get("gradientangle"), 0, 0);
|
|
29689
|
+
obj.gradientFrac = stop.frac;
|
|
29690
|
+
}
|
|
29691
|
+
function setGradientFill(obj, color) {
|
|
29692
|
+
if (color.type === "none") return;
|
|
29693
|
+
const ramp = color.type === "radial" ? color.ring : color.ling;
|
|
29694
|
+
obj.fillColor = resolveFillColorName(ramp.stops[0].color);
|
|
29695
|
+
obj.stopColor = resolveFillColorName(ramp.stops[1].color);
|
|
29696
|
+
obj.gradientFrac = ramp.stops[1].frac;
|
|
29697
|
+
if (color.type === "radial") {
|
|
29698
|
+
const r = color.ring;
|
|
29699
|
+
obj.gradientAngle = r.x1 === r.x0 && r.y1 === r.y0 ? 0 : Math.trunc(180 * Math.acos((r.x0 - r.x1) / r.r0) / Math.PI) || 0;
|
|
29700
|
+
obj.fill = 3 /* Radial */;
|
|
29701
|
+
} else {
|
|
29702
|
+
const l = color.ling;
|
|
29703
|
+
obj.gradientAngle = Math.trunc(180 * Math.atan2(l.y1 - l.y0, l.x1 - l.x0) / Math.PI);
|
|
29704
|
+
obj.fill = 2 /* Linear */;
|
|
29705
|
+
}
|
|
29706
|
+
}
|
|
29707
|
+
function setStyle(obj, tokens) {
|
|
29708
|
+
gvrenderSetStyle(tokens);
|
|
29709
|
+
obj.rawStyle = [...tokens];
|
|
29710
|
+
const flags = parseStyleFlags(tokens.join(","));
|
|
29711
|
+
obj.pen = resolvePenType(flags);
|
|
29712
|
+
obj.penWidth = resolvePenWidth(flags, void 0);
|
|
29713
|
+
}
|
|
29714
|
+
function devicePoints(pts, job) {
|
|
29715
|
+
return pts.map((p) => transformPoint({ x: p.x, y: p.y }, job));
|
|
29716
|
+
}
|
|
29717
|
+
function drawOp(op, renderer, job) {
|
|
29718
|
+
switch (op.kind) {
|
|
29719
|
+
case "filled_ellipse":
|
|
29720
|
+
case "unfilled_ellipse": {
|
|
29721
|
+
const { x, y, w, h } = op.ellipse;
|
|
29722
|
+
const c = transformPoint({ x, y }, job);
|
|
29723
|
+
renderer.ellipse(c, w, h, op.kind === "filled_ellipse", job);
|
|
29724
|
+
return true;
|
|
29725
|
+
}
|
|
29726
|
+
case "filled_polygon":
|
|
29727
|
+
case "unfilled_polygon":
|
|
29728
|
+
renderer.polygon(devicePoints(op.polygon.pts, job), op.kind === "filled_polygon", job);
|
|
29729
|
+
return true;
|
|
29730
|
+
case "filled_bezier":
|
|
29731
|
+
case "unfilled_bezier":
|
|
29732
|
+
renderer.bezier(devicePoints(op.bezier.pts, job), op.kind === "filled_bezier", job);
|
|
29733
|
+
return true;
|
|
29734
|
+
case "polyline":
|
|
29735
|
+
renderer.polyline(devicePoints(op.polyline.pts, job), job);
|
|
29736
|
+
return true;
|
|
29737
|
+
default:
|
|
29738
|
+
return false;
|
|
29739
|
+
}
|
|
29740
|
+
}
|
|
29741
|
+
function stateOp(op, obj, warned2) {
|
|
29742
|
+
switch (op.kind) {
|
|
29743
|
+
case "fill_color":
|
|
29744
|
+
obj.fillColor = resolveFillColorName(op.color);
|
|
29745
|
+
obj.fill = 1 /* Solid */;
|
|
29746
|
+
break;
|
|
29747
|
+
case "pen_color":
|
|
29748
|
+
obj.penColor = resolveRenderColor(op.color);
|
|
29749
|
+
obj.fill = 1 /* Solid */;
|
|
29750
|
+
break;
|
|
29751
|
+
case "grad_fill_color":
|
|
29752
|
+
setGradientFill(obj, op.gradColor);
|
|
29753
|
+
break;
|
|
29754
|
+
case "grad_pen_color":
|
|
29755
|
+
agwarningf("gradient pen colors not yet supported.");
|
|
29756
|
+
break;
|
|
29757
|
+
case "style":
|
|
29758
|
+
setStyle(obj, styleTokens2(op.style));
|
|
29759
|
+
break;
|
|
29760
|
+
case "image":
|
|
29761
|
+
if (!warned2.image) agwarningf('Images unsupported in "background" attribute');
|
|
29762
|
+
warned2.image = true;
|
|
29763
|
+
break;
|
|
29764
|
+
default:
|
|
29765
|
+
break;
|
|
29766
|
+
}
|
|
29767
|
+
}
|
|
29768
|
+
function emitXdot(g, renderer, job) {
|
|
29769
|
+
const xd = graphXdots(g);
|
|
29770
|
+
const obj = job.obj;
|
|
29771
|
+
if (xd === void 0 || obj === null) return;
|
|
29772
|
+
applyBackgroundState(g, renderer, obj);
|
|
29773
|
+
const inClip = zeroBoxInClip(deviceClip(g, renderer, job));
|
|
29774
|
+
const warned2 = { image: false };
|
|
29775
|
+
let styled = false;
|
|
29776
|
+
for (const op of xd.ops) {
|
|
29777
|
+
styled ||= op.kind === "style";
|
|
29778
|
+
if (op.kind === "text") continue;
|
|
29779
|
+
if (!inClip && isDrawing(op)) continue;
|
|
29780
|
+
if (!drawOp(op, renderer, job)) stateOp(op, obj, warned2);
|
|
29781
|
+
}
|
|
29782
|
+
if (styled) setStyle(obj, DEFAULT_LINE_STYLE2);
|
|
29783
|
+
}
|
|
29784
|
+
function isDrawing(op) {
|
|
29785
|
+
return op.kind.endsWith("ellipse") || op.kind.endsWith("polygon") || op.kind.endsWith("bezier") || op.kind === "polyline";
|
|
29786
|
+
}
|
|
29787
|
+
|
|
29222
29788
|
// src/gvc/device-labels.ts
|
|
29223
29789
|
var VALIGN_TOP = "t".charCodeAt(0);
|
|
29224
29790
|
var VALIGN_BOTTOM = "b".charCodeAt(0);
|
|
@@ -29481,6 +30047,7 @@ function renderPage(g, renderer, job, info) {
|
|
|
29481
30047
|
withColorScheme(g.attrs.get("colorscheme"), () => {
|
|
29482
30048
|
reportColorNames(backgroundColors(g.attrs.get("bgcolor"), renderer.type === "svg"));
|
|
29483
30049
|
renderer.pageBackground?.(g, job);
|
|
30050
|
+
emitXdot(g, renderer, job);
|
|
29484
30051
|
renderGraphLabel(g, renderer, job);
|
|
29485
30052
|
});
|
|
29486
30053
|
if (anchored) renderer.endAnchor?.(job);
|
|
@@ -32688,6 +33255,37 @@ function getSplineBounds(g) {
|
|
|
32688
33255
|
function resetSplineBounds(g) {
|
|
32689
33256
|
boundsSnapshotByGraph.delete(g);
|
|
32690
33257
|
}
|
|
33258
|
+
var staleBeziersByEdge = /* @__PURE__ */ new WeakMap();
|
|
33259
|
+
function beginRoutingPass(g) {
|
|
33260
|
+
resetSplineBounds(g);
|
|
33261
|
+
for (const e of g.edges) {
|
|
33262
|
+
e.info.lost = void 0;
|
|
33263
|
+
if (e.info.spl === void 0) staleBeziersByEdge.delete(e);
|
|
33264
|
+
else staleBeziersByEdge.set(e, e.info.spl.size);
|
|
33265
|
+
}
|
|
33266
|
+
}
|
|
33267
|
+
function routedThisPass(e) {
|
|
33268
|
+
const spl = e.info.spl;
|
|
33269
|
+
if (spl === void 0) return false;
|
|
33270
|
+
const stale = staleBeziersByEdge.get(e);
|
|
33271
|
+
return stale === void 0 || spl.size > stale;
|
|
33272
|
+
}
|
|
33273
|
+
function staleBezierCount(e) {
|
|
33274
|
+
return staleBeziersByEdge.get(e) ?? 0;
|
|
33275
|
+
}
|
|
33276
|
+
function staleAdjacent(e) {
|
|
33277
|
+
return staleBezierCount(e) > 0 && (e.info.adjacent ?? 0) !== 0;
|
|
33278
|
+
}
|
|
33279
|
+
function swapStaleBeziers(g) {
|
|
33280
|
+
for (const e of g.edges) {
|
|
33281
|
+
const stale = staleBezierCount(e);
|
|
33282
|
+
const spl = e.info.spl;
|
|
33283
|
+
if (stale === 0 || spl === void 0 || !swapEndsP(e)) continue;
|
|
33284
|
+
const old = spl.list.splice(0, stale).reverse();
|
|
33285
|
+
for (const bz of old) swapBezier(bz);
|
|
33286
|
+
spl.list.push(...old);
|
|
33287
|
+
}
|
|
33288
|
+
}
|
|
32691
33289
|
function rankEdgeInfoOf(g, tailNode, headNode) {
|
|
32692
33290
|
const rankTable = g.info.rank;
|
|
32693
33291
|
if (rankTable === void 0) return void 0;
|
|
@@ -36313,6 +36911,7 @@ function makeFlatAdjEdges(g, edges, cnt, et) {
|
|
|
36313
36911
|
function isFlatAdjacent(g, e) {
|
|
36314
36912
|
const r = e.tail.info.rank;
|
|
36315
36913
|
if (r === void 0 || e.head.info.rank !== r) return false;
|
|
36914
|
+
if (staleAdjacent(e)) return true;
|
|
36316
36915
|
const rank3 = g.info.rank?.[r];
|
|
36317
36916
|
if (rank3 === void 0) return false;
|
|
36318
36917
|
const to = e.tail.info.order ?? 0;
|
|
@@ -36656,7 +37255,7 @@ function makeSimpleFlat(group, et) {
|
|
|
36656
37255
|
}
|
|
36657
37256
|
function makeAdjFlatNoPortEdge(g, e) {
|
|
36658
37257
|
if (!isAdjFlatCandidate(e)) return false;
|
|
36659
|
-
if (e
|
|
37258
|
+
if (routedThisPass(e)) return true;
|
|
36660
37259
|
const group = collectAdjFlatGroup(g, e);
|
|
36661
37260
|
const et = edgeType(g);
|
|
36662
37261
|
if (group.some((x) => x.info.label !== void 0)) makeSimpleFlatLabels(group, et);
|
|
@@ -36674,7 +37273,7 @@ function flatPortKey(e, lo) {
|
|
|
36674
37273
|
return e.tail === lo ? { loP: e.info.tail_port, hiP: e.info.head_port } : { loP: e.info.head_port, hiP: e.info.tail_port };
|
|
36675
37274
|
}
|
|
36676
37275
|
function isNonAdjGroupable(x, g) {
|
|
36677
|
-
return x
|
|
37276
|
+
return !routedThisPass(x) && x.tail.info.rank !== void 0 && x.tail.info.rank === x.head.info.rank && !isFlatAdjacent(g, x);
|
|
36678
37277
|
}
|
|
36679
37278
|
function samePortsAs(x, lo, key) {
|
|
36680
37279
|
const k = flatPortKey(x, lo);
|
|
@@ -37059,7 +37658,7 @@ function isAdjacentPortFlat(e, g) {
|
|
|
37059
37658
|
return e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && isFlatAdjacent(g, e) && hasDefinedPort(e);
|
|
37060
37659
|
}
|
|
37061
37660
|
function isGroupableFlat(x, g) {
|
|
37062
|
-
return x
|
|
37661
|
+
return !routedThisPass(x) && x.tail.info.rank !== void 0 && x.tail.info.rank === x.head.info.rank && isFlatAdjacent(g, x);
|
|
37063
37662
|
}
|
|
37064
37663
|
function joinsPortedFlatGroup(e, g) {
|
|
37065
37664
|
return isAdjFlatCandidate(e) && isGroupableFlat(e, g) && collectAdjacentFlatGroup(e, g).some(hasDefinedPort);
|
|
@@ -37077,11 +37676,11 @@ function routeFaithfulSidePort(e, g) {
|
|
|
37077
37676
|
const sameRank = e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank;
|
|
37078
37677
|
if (sameRank && isFlatAdjacent(g, e)) {
|
|
37079
37678
|
const group = collectAdjacentFlatGroup(e, g);
|
|
37080
|
-
return makeFlatAdjEdges(g, group, group.length, edgeType(g)) === 0 && e
|
|
37679
|
+
return makeFlatAdjEdges(g, group, group.length, edgeType(g)) === 0 && routedThisPass(e);
|
|
37081
37680
|
}
|
|
37082
37681
|
if (sameRank) {
|
|
37083
37682
|
const group = collectNonAdjacentFlatGroup(e, g);
|
|
37084
|
-
return routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && e
|
|
37683
|
+
return routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && routedThisPass(e);
|
|
37085
37684
|
}
|
|
37086
37685
|
const pts = routeRegularEdgeFaithful(g, e);
|
|
37087
37686
|
if (pts === null) return false;
|
|
@@ -37107,7 +37706,7 @@ function routeFlatEdge(e, g) {
|
|
|
37107
37706
|
if ((hasSidePort(e) || isAdjacentPortFlat(e, g)) && routeFaithfulSidePort(e, g)) return true;
|
|
37108
37707
|
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && e.info.label === void 0 && !isFlatAdjacent(g, e)) {
|
|
37109
37708
|
const group = collectNonAdjacentFlatGroup(e, g);
|
|
37110
|
-
if (group.length > 0 && routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && e
|
|
37709
|
+
if (group.length > 0 && routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && routedThisPass(e)) return true;
|
|
37111
37710
|
}
|
|
37112
37711
|
return false;
|
|
37113
37712
|
}
|
|
@@ -37135,7 +37734,7 @@ function orderedDotEdges(g) {
|
|
|
37135
37734
|
return edges;
|
|
37136
37735
|
}
|
|
37137
37736
|
function routeLoneEdge(e, g) {
|
|
37138
|
-
if (e
|
|
37737
|
+
if (routedThisPass(e) || e.info.lost === true) return;
|
|
37139
37738
|
const et = e.info.edge_type ?? 0;
|
|
37140
37739
|
if (et === FLATORDER || et === IGNORED) return;
|
|
37141
37740
|
if (e.tail === e.head) return;
|
|
@@ -39946,13 +40545,13 @@ function swapBezier(b) {
|
|
|
39946
40545
|
b.eArrowOps = so;
|
|
39947
40546
|
}
|
|
39948
40547
|
}
|
|
39949
|
-
function swapSpline(s) {
|
|
39950
|
-
s.list.reverse();
|
|
39951
|
-
for (
|
|
40548
|
+
function swapSpline(s, stale = 0) {
|
|
40549
|
+
s.list.push(...s.list.splice(stale).reverse());
|
|
40550
|
+
for (let i = stale; i < s.list.length; i++) swapBezier(s.list[i]);
|
|
39952
40551
|
}
|
|
39953
40552
|
function swapEdgeSpline(e) {
|
|
39954
40553
|
if (e.info.spl === void 0) return;
|
|
39955
|
-
swapSpline(e.info.spl);
|
|
40554
|
+
swapSpline(e.info.spl, staleBezierCount(e));
|
|
39956
40555
|
const t = e.info.tailArrowOps;
|
|
39957
40556
|
e.info.tailArrowOps = e.info.headArrowOps;
|
|
39958
40557
|
e.info.headArrowOps = t;
|
|
@@ -40043,6 +40642,7 @@ function finalizeSplines(g, et, normalize) {
|
|
|
40043
40642
|
placeRegularEdgeLabels(g);
|
|
40044
40643
|
if (normalize) edgeNormalize(g);
|
|
40045
40644
|
if (et !== EDGETYPE_CURVED) routeDotEdges(g);
|
|
40645
|
+
if (normalize) swapStaleBeziers(g);
|
|
40046
40646
|
placePortLabels(g);
|
|
40047
40647
|
setState(GVSPLINES);
|
|
40048
40648
|
g.info.edgeLabelsDone = true;
|
|
@@ -40053,7 +40653,7 @@ function dotSplines_(g, normalize) {
|
|
|
40053
40653
|
if (et === EDGETYPE_ORTHO) return orthoDispatch(g);
|
|
40054
40654
|
if (et === EDGETYPE_CURVED) curvedTop(g);
|
|
40055
40655
|
markLowclusters(g);
|
|
40056
|
-
|
|
40656
|
+
beginRoutingPass(g);
|
|
40057
40657
|
const edges = [];
|
|
40058
40658
|
collectRankEdges(g, edges);
|
|
40059
40659
|
gvQsort(edges, edgecmp);
|
|
@@ -40886,182 +41486,7 @@ function polyGraphs(gs, root, pinfo, bbs) {
|
|
|
40886
41486
|
return ctx.places;
|
|
40887
41487
|
}
|
|
40888
41488
|
|
|
40889
|
-
// src/layout/pack/
|
|
40890
|
-
function putRects(ng, bbs, pinfo) {
|
|
40891
|
-
if (ng <= 0) return [];
|
|
40892
|
-
if (pinfo.mode === 5 /* Aspect */) return null;
|
|
40893
|
-
if (pinfo.mode === 2 /* Node */ || pinfo.mode === 1 /* Cluster */) return null;
|
|
40894
|
-
if (pinfo.mode === 4 /* Array */) return arrayRects(ng, bbs, pinfo);
|
|
40895
|
-
return polyRects(ng, bbs, pinfo);
|
|
40896
|
-
}
|
|
40897
|
-
function nodeCoordX2(n) {
|
|
40898
|
-
return n.info.coord !== void 0 ? n.info.coord.x : 0;
|
|
40899
|
-
}
|
|
40900
|
-
function nodeCoordY(n) {
|
|
40901
|
-
return n.info.coord !== void 0 ? n.info.coord.y : 0;
|
|
40902
|
-
}
|
|
40903
|
-
function expandBounds(b, n, margin) {
|
|
40904
|
-
const x = nodeCoordX2(n);
|
|
40905
|
-
const y = nodeCoordY(n);
|
|
40906
|
-
const lw = n.info.lw !== void 0 ? n.info.lw : 18;
|
|
40907
|
-
const rw = n.info.rw !== void 0 ? n.info.rw : 18;
|
|
40908
|
-
const ht = n.info.ht !== void 0 ? n.info.ht : 18;
|
|
40909
|
-
b.llx = Math.min(b.llx, x - lw - margin);
|
|
40910
|
-
b.lly = Math.min(b.lly, y - ht / 2 - margin);
|
|
40911
|
-
b.urx = Math.max(b.urx, x + rw + margin);
|
|
40912
|
-
b.ury = Math.max(b.ury, y + ht / 2 + margin);
|
|
40913
|
-
}
|
|
40914
|
-
function expandBoundsByEdge(b, e, flip, refineSplines) {
|
|
40915
|
-
const spl = e.info.spl;
|
|
40916
|
-
if (spl !== void 0 && refineSplines) {
|
|
40917
|
-
const box = { ll: { x: b.llx, y: b.lly }, ur: { x: b.urx, y: b.ury } };
|
|
40918
|
-
for (let i = 0; i < spl.size; i++) {
|
|
40919
|
-
const bz = spl.list[i];
|
|
40920
|
-
if (bz === void 0) continue;
|
|
40921
|
-
for (let j = 0; j + 3 < bz.size; j += 3) {
|
|
40922
|
-
const p0 = bz.list[j];
|
|
40923
|
-
const p1 = bz.list[j + 1];
|
|
40924
|
-
const p2 = bz.list[j + 2];
|
|
40925
|
-
const p3 = bz.list[j + 3];
|
|
40926
|
-
if (p0 && p1 && p2 && p3) updateBbBz(box, [p0, p1, p2, p3]);
|
|
40927
|
-
}
|
|
40928
|
-
}
|
|
40929
|
-
b.llx = box.ll.x;
|
|
40930
|
-
b.lly = box.ll.y;
|
|
40931
|
-
b.urx = box.ur.x;
|
|
40932
|
-
b.ury = box.ur.y;
|
|
40933
|
-
} else if (spl !== void 0) {
|
|
40934
|
-
for (let i = 0; i < spl.size; i++) {
|
|
40935
|
-
const bz = spl.list[i];
|
|
40936
|
-
if (bz === void 0) continue;
|
|
40937
|
-
for (let j = 0; j < bz.size; j++) {
|
|
40938
|
-
const p = bz.list[j];
|
|
40939
|
-
if (p === void 0) continue;
|
|
40940
|
-
b.llx = Math.min(b.llx, p.x);
|
|
40941
|
-
b.lly = Math.min(b.lly, p.y);
|
|
40942
|
-
b.urx = Math.max(b.urx, p.x);
|
|
40943
|
-
b.ury = Math.max(b.ury, p.y);
|
|
40944
|
-
}
|
|
40945
|
-
}
|
|
40946
|
-
}
|
|
40947
|
-
for (const l of [e.info.label, e.info.head_label, e.info.tail_label, e.info.xlabel]) {
|
|
40948
|
-
if (l === void 0 || l.set !== true) continue;
|
|
40949
|
-
const hw = (flip ? l.dimen.y : l.dimen.x) / 2;
|
|
40950
|
-
const hh = (flip ? l.dimen.x : l.dimen.y) / 2;
|
|
40951
|
-
b.llx = Math.min(b.llx, l.pos.x - hw);
|
|
40952
|
-
b.lly = Math.min(b.lly, l.pos.y - hh);
|
|
40953
|
-
b.urx = Math.max(b.urx, l.pos.x + hw);
|
|
40954
|
-
b.ury = Math.max(b.ury, l.pos.y + hh);
|
|
40955
|
-
}
|
|
40956
|
-
}
|
|
40957
|
-
function computeSubgraphBB(g, margin, refineSplines = false) {
|
|
40958
|
-
const b = { llx: Infinity, lly: Infinity, urx: -Infinity, ury: -Infinity };
|
|
40959
|
-
for (const n of g.nodes.values()) expandBounds(b, n, margin);
|
|
40960
|
-
const flip = g.info.flip === true;
|
|
40961
|
-
for (const e of g.edges) expandBoundsByEdge(b, e, flip, refineSplines);
|
|
40962
|
-
if (!isFinite(b.llx)) return { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
40963
|
-
return { ll: { x: b.llx, y: b.lly }, ur: { x: b.urx, y: b.ury } };
|
|
40964
|
-
}
|
|
40965
|
-
function putGraphs(ng, gs, root, pinfo) {
|
|
40966
|
-
if (ng <= 0) return null;
|
|
40967
|
-
const bbs = gs.map((g) => {
|
|
40968
|
-
const bb = computeSubgraphBB(g, 0);
|
|
40969
|
-
g.info.bb = bb;
|
|
40970
|
-
return bb;
|
|
40971
|
-
});
|
|
40972
|
-
if (pinfo.mode <= 3 /* Graph */) return polyGraphs(gs, root, pinfo, bbs);
|
|
40973
|
-
if (pinfo.mode === 4 /* Array */) {
|
|
40974
|
-
if (pinfo.flags & PK_USER_VALS) {
|
|
40975
|
-
pinfo.vals = gs.map((g) => {
|
|
40976
|
-
const v = parseInt(g.attrs.get("sortv") ?? "", 10);
|
|
40977
|
-
return !Number.isNaN(v) && v >= 0 ? v : 0;
|
|
40978
|
-
});
|
|
40979
|
-
}
|
|
40980
|
-
return arrayRects(ng, bbs, pinfo);
|
|
40981
|
-
}
|
|
40982
|
-
return null;
|
|
40983
|
-
}
|
|
40984
|
-
function packGraphs(ng, gs, root, pinfo) {
|
|
40985
|
-
const pts = putGraphs(ng, gs, root, pinfo);
|
|
40986
|
-
if (!pts) return -1;
|
|
40987
|
-
return shiftGraphs(ng, gs, pts, root, pinfo.doSplines);
|
|
40988
|
-
}
|
|
40989
|
-
function packSubgraphs(ng, gs, root, pinfo) {
|
|
40990
|
-
const rc = packGraphs(ng, gs, root, pinfo);
|
|
40991
|
-
if (rc === 0) root.info.bb = computeSubgraphBB(root, 0);
|
|
40992
|
-
return rc;
|
|
40993
|
-
}
|
|
40994
|
-
function shiftGraphBBs(g, dx, dy) {
|
|
40995
|
-
const bb = g.info.bb;
|
|
40996
|
-
if (bb !== void 0) {
|
|
40997
|
-
g.info.bb = {
|
|
40998
|
-
ll: { x: bb.ll.x + dx, y: bb.ll.y + dy },
|
|
40999
|
-
ur: { x: bb.ur.x + dx, y: bb.ur.y + dy }
|
|
41000
|
-
};
|
|
41001
|
-
}
|
|
41002
|
-
const lab = g.info.label;
|
|
41003
|
-
if (lab?.set && lab.pos) {
|
|
41004
|
-
lab.pos = { x: lab.pos.x + dx, y: lab.pos.y + dy };
|
|
41005
|
-
}
|
|
41006
|
-
const nClust = g.info.n_cluster ?? 0;
|
|
41007
|
-
for (let c = 1; c <= nClust; c++) {
|
|
41008
|
-
const sub = g.info.clust?.[c - 1];
|
|
41009
|
-
if (sub) shiftGraphBBs(sub, dx, dy);
|
|
41010
|
-
}
|
|
41011
|
-
}
|
|
41012
|
-
function shiftEdgePoints(e, dx, dy) {
|
|
41013
|
-
const moveLabel = (raw) => {
|
|
41014
|
-
const lab = raw;
|
|
41015
|
-
if (lab?.pos) lab.pos = { x: lab.pos.x + dx, y: lab.pos.y + dy };
|
|
41016
|
-
};
|
|
41017
|
-
moveLabel(e.info.label);
|
|
41018
|
-
moveLabel(e.info.xlabel);
|
|
41019
|
-
moveLabel(e.info.head_label);
|
|
41020
|
-
moveLabel(e.info.tail_label);
|
|
41021
|
-
const spl = e.info.spl;
|
|
41022
|
-
if (!spl) return;
|
|
41023
|
-
for (const bz of spl.list) {
|
|
41024
|
-
for (let k = 0; k < bz.size; k++) {
|
|
41025
|
-
const p = bz.list[k];
|
|
41026
|
-
bz.list[k] = { x: p.x + dx, y: p.y + dy };
|
|
41027
|
-
}
|
|
41028
|
-
if (bz.sflag) bz.sp = { x: bz.sp.x + dx, y: bz.sp.y + dy };
|
|
41029
|
-
if (bz.eflag) bz.ep = { x: bz.ep.x + dx, y: bz.ep.y + dy };
|
|
41030
|
-
}
|
|
41031
|
-
const shiftOps = (ops) => ops?.map((op) => mapArrowOpPoints(op, (p) => ({ x: p.x + dx, y: p.y + dy })));
|
|
41032
|
-
e.info.headArrowOps = shiftOps(e.info.headArrowOps);
|
|
41033
|
-
e.info.tailArrowOps = shiftOps(e.info.tailArrowOps);
|
|
41034
|
-
for (const bz of spl.list) {
|
|
41035
|
-
if (bz.sArrowOps) bz.sArrowOps = shiftOps(bz.sArrowOps);
|
|
41036
|
-
if (bz.eArrowOps) bz.eArrowOps = shiftOps(bz.eArrowOps);
|
|
41037
|
-
}
|
|
41038
|
-
}
|
|
41039
|
-
function shiftOneGraph(g, dx, dy) {
|
|
41040
|
-
for (const n of g.nodes.values()) {
|
|
41041
|
-
const c = n.info.coord ?? { x: 0, y: 0 };
|
|
41042
|
-
n.info.coord = { x: c.x + dx, y: c.y + dy };
|
|
41043
|
-
if (n.info.pos) {
|
|
41044
|
-
n.info.pos[0] = (n.info.pos[0] ?? 0) + dx * PS2INCH2;
|
|
41045
|
-
n.info.pos[1] = (n.info.pos[1] ?? 0) + dy * PS2INCH2;
|
|
41046
|
-
}
|
|
41047
|
-
}
|
|
41048
|
-
for (const e of g.edges) shiftEdgePoints(e, dx, dy);
|
|
41049
|
-
shiftGraphBBs(g, dx, dy);
|
|
41050
|
-
}
|
|
41051
|
-
function normalizeGraphBB(g) {
|
|
41052
|
-
const ll = g.info.bb.ll;
|
|
41053
|
-
if (ll.x !== 0 || ll.y !== 0) {
|
|
41054
|
-
shiftOneGraph(g, -ll.x, -ll.y);
|
|
41055
|
-
}
|
|
41056
|
-
}
|
|
41057
|
-
function shiftGraphs(ng, gs, pp, _root, _doSplines) {
|
|
41058
|
-
for (let i = 0; i < ng; i++) {
|
|
41059
|
-
const dx = pp[i].x;
|
|
41060
|
-
const dy = pp[i].y;
|
|
41061
|
-
if (dx !== 0 || dy !== 0) shiftOneGraph(gs[i], dx, dy);
|
|
41062
|
-
}
|
|
41063
|
-
return 0;
|
|
41064
|
-
}
|
|
41489
|
+
// src/layout/pack/ccomps.ts
|
|
41065
41490
|
function dfsCollect(g, start, visited) {
|
|
41066
41491
|
const stack = [start];
|
|
41067
41492
|
const comp = [];
|
|
@@ -41087,6 +41512,16 @@ function buildSubgraph(root, nodes, name) {
|
|
|
41087
41512
|
sg.edges = root.edges.filter((e) => ns.has(e.tail) && ns.has(e.head));
|
|
41088
41513
|
return sg;
|
|
41089
41514
|
}
|
|
41515
|
+
function copyParentAttrs(parent2, sg) {
|
|
41516
|
+
for (const [k, v] of parent2.attrs) sg.attrs.set(k, v);
|
|
41517
|
+
return sg;
|
|
41518
|
+
}
|
|
41519
|
+
function isLegal(p) {
|
|
41520
|
+
return /^[A-Za-z0-9_]*$/.test(p);
|
|
41521
|
+
}
|
|
41522
|
+
function setPrefix(pfx) {
|
|
41523
|
+
return pfx == null || !isLegal(pfx) ? "_cc_" : pfx;
|
|
41524
|
+
}
|
|
41090
41525
|
function ccomps(g, pfx) {
|
|
41091
41526
|
const visited = /* @__PURE__ */ new Set();
|
|
41092
41527
|
const result = [];
|
|
@@ -41094,7 +41529,7 @@ function ccomps(g, pfx) {
|
|
|
41094
41529
|
for (const n of g.nodes.values()) {
|
|
41095
41530
|
if (visited.has(n.name)) continue;
|
|
41096
41531
|
const comp = dfsCollect(g, n, visited);
|
|
41097
|
-
result.push(buildSubgraph(g, comp, `${pfx}
|
|
41532
|
+
result.push(copyParentAttrs(g, buildSubgraph(g, comp, `${setPrefix(pfx)}${idx++}`)));
|
|
41098
41533
|
}
|
|
41099
41534
|
return result;
|
|
41100
41535
|
}
|
|
@@ -41110,15 +41545,192 @@ function pccomps(g, pfx) {
|
|
|
41110
41545
|
pinned = true;
|
|
41111
41546
|
}
|
|
41112
41547
|
if (pinnedNodes.length > 0) {
|
|
41113
|
-
result.push(buildSubgraph(g, pinnedNodes, `${pfx}${idx++}`));
|
|
41548
|
+
result.push(copyParentAttrs(g, buildSubgraph(g, pinnedNodes, `${setPrefix(pfx)}${idx++}`)));
|
|
41114
41549
|
}
|
|
41115
41550
|
for (const n of g.nodes.values()) {
|
|
41116
41551
|
if (visited.has(n.name)) continue;
|
|
41117
41552
|
const comp = dfsCollect(g, n, visited);
|
|
41118
|
-
result.push(buildSubgraph(g, comp, `${pfx}${idx++}`));
|
|
41553
|
+
result.push(copyParentAttrs(g, buildSubgraph(g, comp, `${setPrefix(pfx)}${idx++}`)));
|
|
41119
41554
|
}
|
|
41120
41555
|
return { graphs: result, pinned };
|
|
41121
41556
|
}
|
|
41557
|
+
|
|
41558
|
+
// src/layout/pack/index.ts
|
|
41559
|
+
function putRects(ng, bbs, pinfo) {
|
|
41560
|
+
if (ng <= 0) return [];
|
|
41561
|
+
if (pinfo.mode === 5 /* Aspect */) return null;
|
|
41562
|
+
if (pinfo.mode === 2 /* Node */ || pinfo.mode === 1 /* Cluster */) return null;
|
|
41563
|
+
if (pinfo.mode === 4 /* Array */) return arrayRects(ng, bbs, pinfo);
|
|
41564
|
+
return polyRects(ng, bbs, pinfo);
|
|
41565
|
+
}
|
|
41566
|
+
function nodeCoordX2(n) {
|
|
41567
|
+
return n.info.coord !== void 0 ? n.info.coord.x : 0;
|
|
41568
|
+
}
|
|
41569
|
+
function nodeCoordY(n) {
|
|
41570
|
+
return n.info.coord !== void 0 ? n.info.coord.y : 0;
|
|
41571
|
+
}
|
|
41572
|
+
function expandBounds(b, n, margin) {
|
|
41573
|
+
const x = nodeCoordX2(n);
|
|
41574
|
+
const y = nodeCoordY(n);
|
|
41575
|
+
const lw = n.info.lw !== void 0 ? n.info.lw : 18;
|
|
41576
|
+
const rw = n.info.rw !== void 0 ? n.info.rw : 18;
|
|
41577
|
+
const ht = n.info.ht !== void 0 ? n.info.ht : 18;
|
|
41578
|
+
b.llx = Math.min(b.llx, x - lw - margin);
|
|
41579
|
+
b.lly = Math.min(b.lly, y - ht / 2 - margin);
|
|
41580
|
+
b.urx = Math.max(b.urx, x + rw + margin);
|
|
41581
|
+
b.ury = Math.max(b.ury, y + ht / 2 + margin);
|
|
41582
|
+
}
|
|
41583
|
+
function expandBoundsByEdge(b, e, flip, refineSplines) {
|
|
41584
|
+
const spl = e.info.spl;
|
|
41585
|
+
if (spl !== void 0 && refineSplines) {
|
|
41586
|
+
const box = { ll: { x: b.llx, y: b.lly }, ur: { x: b.urx, y: b.ury } };
|
|
41587
|
+
for (let i = 0; i < spl.size; i++) {
|
|
41588
|
+
const bz = spl.list[i];
|
|
41589
|
+
if (bz === void 0) continue;
|
|
41590
|
+
for (let j = 0; j + 3 < bz.size; j += 3) {
|
|
41591
|
+
const p0 = bz.list[j];
|
|
41592
|
+
const p1 = bz.list[j + 1];
|
|
41593
|
+
const p2 = bz.list[j + 2];
|
|
41594
|
+
const p3 = bz.list[j + 3];
|
|
41595
|
+
if (p0 && p1 && p2 && p3) updateBbBz(box, [p0, p1, p2, p3]);
|
|
41596
|
+
}
|
|
41597
|
+
}
|
|
41598
|
+
b.llx = box.ll.x;
|
|
41599
|
+
b.lly = box.ll.y;
|
|
41600
|
+
b.urx = box.ur.x;
|
|
41601
|
+
b.ury = box.ur.y;
|
|
41602
|
+
} else if (spl !== void 0) {
|
|
41603
|
+
for (let i = 0; i < spl.size; i++) {
|
|
41604
|
+
const bz = spl.list[i];
|
|
41605
|
+
if (bz === void 0) continue;
|
|
41606
|
+
for (let j = 0; j < bz.size; j++) {
|
|
41607
|
+
const p = bz.list[j];
|
|
41608
|
+
if (p === void 0) continue;
|
|
41609
|
+
b.llx = Math.min(b.llx, p.x);
|
|
41610
|
+
b.lly = Math.min(b.lly, p.y);
|
|
41611
|
+
b.urx = Math.max(b.urx, p.x);
|
|
41612
|
+
b.ury = Math.max(b.ury, p.y);
|
|
41613
|
+
}
|
|
41614
|
+
}
|
|
41615
|
+
}
|
|
41616
|
+
for (const l of [e.info.label, e.info.head_label, e.info.tail_label, e.info.xlabel]) {
|
|
41617
|
+
if (l === void 0 || l.set !== true) continue;
|
|
41618
|
+
const hw = (flip ? l.dimen.y : l.dimen.x) / 2;
|
|
41619
|
+
const hh = (flip ? l.dimen.x : l.dimen.y) / 2;
|
|
41620
|
+
b.llx = Math.min(b.llx, l.pos.x - hw);
|
|
41621
|
+
b.lly = Math.min(b.lly, l.pos.y - hh);
|
|
41622
|
+
b.urx = Math.max(b.urx, l.pos.x + hw);
|
|
41623
|
+
b.ury = Math.max(b.ury, l.pos.y + hh);
|
|
41624
|
+
}
|
|
41625
|
+
}
|
|
41626
|
+
function computeSubgraphBB(g, margin, refineSplines = false) {
|
|
41627
|
+
const b = { llx: Infinity, lly: Infinity, urx: -Infinity, ury: -Infinity };
|
|
41628
|
+
for (const n of g.nodes.values()) expandBounds(b, n, margin);
|
|
41629
|
+
const flip = g.info.flip === true;
|
|
41630
|
+
for (const e of g.edges) expandBoundsByEdge(b, e, flip, refineSplines);
|
|
41631
|
+
if (!isFinite(b.llx)) return { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
41632
|
+
return { ll: { x: b.llx, y: b.lly }, ur: { x: b.urx, y: b.ury } };
|
|
41633
|
+
}
|
|
41634
|
+
function putGraphs(ng, gs, root, pinfo) {
|
|
41635
|
+
if (ng <= 0) return null;
|
|
41636
|
+
const bbs = gs.map((g) => {
|
|
41637
|
+
const bb = computeSubgraphBB(g, 0);
|
|
41638
|
+
g.info.bb = bb;
|
|
41639
|
+
return bb;
|
|
41640
|
+
});
|
|
41641
|
+
if (pinfo.mode <= 3 /* Graph */) return polyGraphs(gs, root, pinfo, bbs);
|
|
41642
|
+
if (pinfo.mode === 4 /* Array */) {
|
|
41643
|
+
if (pinfo.flags & PK_USER_VALS) {
|
|
41644
|
+
pinfo.vals = gs.map((g) => {
|
|
41645
|
+
const v = parseInt(g.attrs.get("sortv") ?? "", 10);
|
|
41646
|
+
return !Number.isNaN(v) && v >= 0 ? v : 0;
|
|
41647
|
+
});
|
|
41648
|
+
}
|
|
41649
|
+
return arrayRects(ng, bbs, pinfo);
|
|
41650
|
+
}
|
|
41651
|
+
return null;
|
|
41652
|
+
}
|
|
41653
|
+
function packGraphs(ng, gs, root, pinfo) {
|
|
41654
|
+
const pts = putGraphs(ng, gs, root, pinfo);
|
|
41655
|
+
if (!pts) return -1;
|
|
41656
|
+
return shiftGraphs(ng, gs, pts, root, pinfo.doSplines);
|
|
41657
|
+
}
|
|
41658
|
+
function packSubgraphs(ng, gs, root, pinfo) {
|
|
41659
|
+
const rc = packGraphs(ng, gs, root, pinfo);
|
|
41660
|
+
if (rc === 0) root.info.bb = computeSubgraphBB(root, 0);
|
|
41661
|
+
return rc;
|
|
41662
|
+
}
|
|
41663
|
+
function shiftGraphBBs(g, dx, dy) {
|
|
41664
|
+
const bb = g.info.bb;
|
|
41665
|
+
if (bb !== void 0) {
|
|
41666
|
+
g.info.bb = {
|
|
41667
|
+
ll: { x: bb.ll.x + dx, y: bb.ll.y + dy },
|
|
41668
|
+
ur: { x: bb.ur.x + dx, y: bb.ur.y + dy }
|
|
41669
|
+
};
|
|
41670
|
+
}
|
|
41671
|
+
const lab = g.info.label;
|
|
41672
|
+
if (lab?.set && lab.pos) {
|
|
41673
|
+
lab.pos = { x: lab.pos.x + dx, y: lab.pos.y + dy };
|
|
41674
|
+
}
|
|
41675
|
+
const nClust = g.info.n_cluster ?? 0;
|
|
41676
|
+
for (let c = 1; c <= nClust; c++) {
|
|
41677
|
+
const sub = g.info.clust?.[c - 1];
|
|
41678
|
+
if (sub) shiftGraphBBs(sub, dx, dy);
|
|
41679
|
+
}
|
|
41680
|
+
}
|
|
41681
|
+
function shiftEdgePoints(e, dx, dy) {
|
|
41682
|
+
const moveLabel = (raw) => {
|
|
41683
|
+
const lab = raw;
|
|
41684
|
+
if (lab?.pos) lab.pos = { x: lab.pos.x + dx, y: lab.pos.y + dy };
|
|
41685
|
+
};
|
|
41686
|
+
moveLabel(e.info.label);
|
|
41687
|
+
moveLabel(e.info.xlabel);
|
|
41688
|
+
moveLabel(e.info.head_label);
|
|
41689
|
+
moveLabel(e.info.tail_label);
|
|
41690
|
+
const spl = e.info.spl;
|
|
41691
|
+
if (!spl) return;
|
|
41692
|
+
for (const bz of spl.list) {
|
|
41693
|
+
for (let k = 0; k < bz.size; k++) {
|
|
41694
|
+
const p = bz.list[k];
|
|
41695
|
+
bz.list[k] = { x: p.x + dx, y: p.y + dy };
|
|
41696
|
+
}
|
|
41697
|
+
if (bz.sflag) bz.sp = { x: bz.sp.x + dx, y: bz.sp.y + dy };
|
|
41698
|
+
if (bz.eflag) bz.ep = { x: bz.ep.x + dx, y: bz.ep.y + dy };
|
|
41699
|
+
}
|
|
41700
|
+
const shiftOps = (ops) => ops?.map((op) => mapArrowOpPoints(op, (p) => ({ x: p.x + dx, y: p.y + dy })));
|
|
41701
|
+
e.info.headArrowOps = shiftOps(e.info.headArrowOps);
|
|
41702
|
+
e.info.tailArrowOps = shiftOps(e.info.tailArrowOps);
|
|
41703
|
+
for (const bz of spl.list) {
|
|
41704
|
+
if (bz.sArrowOps) bz.sArrowOps = shiftOps(bz.sArrowOps);
|
|
41705
|
+
if (bz.eArrowOps) bz.eArrowOps = shiftOps(bz.eArrowOps);
|
|
41706
|
+
}
|
|
41707
|
+
}
|
|
41708
|
+
function shiftOneGraph(g, dx, dy) {
|
|
41709
|
+
for (const n of g.nodes.values()) {
|
|
41710
|
+
const c = n.info.coord ?? { x: 0, y: 0 };
|
|
41711
|
+
n.info.coord = { x: c.x + dx, y: c.y + dy };
|
|
41712
|
+
if (n.info.pos) {
|
|
41713
|
+
n.info.pos[0] = (n.info.pos[0] ?? 0) + dx * PS2INCH2;
|
|
41714
|
+
n.info.pos[1] = (n.info.pos[1] ?? 0) + dy * PS2INCH2;
|
|
41715
|
+
}
|
|
41716
|
+
}
|
|
41717
|
+
for (const e of g.edges) shiftEdgePoints(e, dx, dy);
|
|
41718
|
+
shiftGraphBBs(g, dx, dy);
|
|
41719
|
+
}
|
|
41720
|
+
function normalizeGraphBB(g) {
|
|
41721
|
+
const ll = g.info.bb.ll;
|
|
41722
|
+
if (ll.x !== 0 || ll.y !== 0) {
|
|
41723
|
+
shiftOneGraph(g, -ll.x, -ll.y);
|
|
41724
|
+
}
|
|
41725
|
+
}
|
|
41726
|
+
function shiftGraphs(ng, gs, pp, _root, _doSplines) {
|
|
41727
|
+
for (let i = 0; i < ng; i++) {
|
|
41728
|
+
const dx = pp[i].x;
|
|
41729
|
+
const dy = pp[i].y;
|
|
41730
|
+
if (dx !== 0 || dy !== 0) shiftOneGraph(gs[i], dx, dy);
|
|
41731
|
+
}
|
|
41732
|
+
return 0;
|
|
41733
|
+
}
|
|
41122
41734
|
var PACK_FLAG_CHARS = {
|
|
41123
41735
|
c: PK_COL_MAJOR,
|
|
41124
41736
|
i: PK_INPUT_ORDER,
|
|
@@ -41392,6 +42004,7 @@ function setEdgeTypeFromAttr(g, defaultValue) {
|
|
|
41392
42004
|
setEdgeType(g, et);
|
|
41393
42005
|
}
|
|
41394
42006
|
function dotPhaseInit(g) {
|
|
42007
|
+
for (const e of g.edges) e.info.weight = void 0;
|
|
41395
42008
|
dotGraphInit(g);
|
|
41396
42009
|
setEdgeTypeFromAttr(g, EDGETYPE_SPLINE);
|
|
41397
42010
|
setAspect(g);
|
|
@@ -41632,7 +42245,11 @@ function ngIncreaseKey(h, increasedVertex, newDist, dist5) {
|
|
|
41632
42245
|
h.index[increasedVertex] = i;
|
|
41633
42246
|
}
|
|
41634
42247
|
function toDistType(w) {
|
|
41635
|
-
|
|
42248
|
+
const f = Math.fround(w);
|
|
42249
|
+
if (Number.isNaN(f)) return 0;
|
|
42250
|
+
if (f >= 2147483648) return MAX_DIST;
|
|
42251
|
+
if (f < -2147483648) return -2147483648;
|
|
42252
|
+
return Math.trunc(f);
|
|
41636
42253
|
}
|
|
41637
42254
|
function ngdijkstra(vertex, graph, n, dist5) {
|
|
41638
42255
|
let prevClosestDist = MAX_DIST;
|
|
@@ -45347,6 +45964,402 @@ var IncVPSC = class extends VPSC {
|
|
|
45347
45964
|
// src/vpsc/sweepTypes.ts
|
|
45348
45965
|
var EvType = { Open: 0, Close: 1 };
|
|
45349
45966
|
|
|
45967
|
+
// src/util/libcxx-sort.ts
|
|
45968
|
+
var LIMIT = 24;
|
|
45969
|
+
var NINTHER_THRESHOLD = 128;
|
|
45970
|
+
var INCOMPLETE_LIMIT = 8;
|
|
45971
|
+
function bitLog2(n) {
|
|
45972
|
+
return 31 - Math.clz32(n);
|
|
45973
|
+
}
|
|
45974
|
+
var Introsort = class {
|
|
45975
|
+
a;
|
|
45976
|
+
lt;
|
|
45977
|
+
constructor(a, lt) {
|
|
45978
|
+
this.a = a;
|
|
45979
|
+
this.lt = lt;
|
|
45980
|
+
}
|
|
45981
|
+
/** @see __algorithm/iter_swap.h:iter_swap */
|
|
45982
|
+
swap(i, j) {
|
|
45983
|
+
const a = this.a;
|
|
45984
|
+
const t = a[i];
|
|
45985
|
+
a[i] = a[j];
|
|
45986
|
+
a[j] = t;
|
|
45987
|
+
}
|
|
45988
|
+
/** @see __algorithm/sort.h:__sort3 */
|
|
45989
|
+
sort3(x, y, z) {
|
|
45990
|
+
const { a, lt } = this;
|
|
45991
|
+
if (!lt(a[y], a[x])) {
|
|
45992
|
+
if (!lt(a[z], a[y])) return;
|
|
45993
|
+
this.swap(y, z);
|
|
45994
|
+
if (lt(a[y], a[x])) this.swap(x, y);
|
|
45995
|
+
return;
|
|
45996
|
+
}
|
|
45997
|
+
if (lt(a[z], a[y])) {
|
|
45998
|
+
this.swap(x, z);
|
|
45999
|
+
return;
|
|
46000
|
+
}
|
|
46001
|
+
this.swap(x, y);
|
|
46002
|
+
if (lt(a[z], a[y])) this.swap(y, z);
|
|
46003
|
+
}
|
|
46004
|
+
/** @see __algorithm/sort.h:__sort4 */
|
|
46005
|
+
sort4(x1, x2, x3, x4) {
|
|
46006
|
+
const { a, lt } = this;
|
|
46007
|
+
this.sort3(x1, x2, x3);
|
|
46008
|
+
if (lt(a[x4], a[x3])) {
|
|
46009
|
+
this.swap(x3, x4);
|
|
46010
|
+
if (lt(a[x3], a[x2])) {
|
|
46011
|
+
this.swap(x2, x3);
|
|
46012
|
+
if (lt(a[x2], a[x1])) this.swap(x1, x2);
|
|
46013
|
+
}
|
|
46014
|
+
}
|
|
46015
|
+
}
|
|
46016
|
+
/** @see __algorithm/sort.h:__sort5 */
|
|
46017
|
+
sort5(x1, x2, x3, x4, x5) {
|
|
46018
|
+
const { a, lt } = this;
|
|
46019
|
+
this.sort4(x1, x2, x3, x4);
|
|
46020
|
+
if (lt(a[x5], a[x4])) {
|
|
46021
|
+
this.swap(x4, x5);
|
|
46022
|
+
if (lt(a[x4], a[x3])) {
|
|
46023
|
+
this.swap(x3, x4);
|
|
46024
|
+
if (lt(a[x3], a[x2])) {
|
|
46025
|
+
this.swap(x2, x3);
|
|
46026
|
+
if (lt(a[x2], a[x1])) this.swap(x1, x2);
|
|
46027
|
+
}
|
|
46028
|
+
}
|
|
46029
|
+
}
|
|
46030
|
+
}
|
|
46031
|
+
/**
|
|
46032
|
+
* The `switch (__last - __first)` that `__introsort` and `__insertion_sort_incomplete` share
|
|
46033
|
+
* word for word, as one function because of the project's complexity limit.
|
|
46034
|
+
* @returns true when the length was one of the cases, so the range is sorted
|
|
46035
|
+
* @see __algorithm/sort.h:__introsort
|
|
46036
|
+
*/
|
|
46037
|
+
sortSmall(first, last) {
|
|
46038
|
+
const { a, lt } = this;
|
|
46039
|
+
switch (last - first) {
|
|
46040
|
+
case 0:
|
|
46041
|
+
case 1:
|
|
46042
|
+
return true;
|
|
46043
|
+
case 2:
|
|
46044
|
+
if (lt(a[last - 1], a[first])) this.swap(first, last - 1);
|
|
46045
|
+
return true;
|
|
46046
|
+
case 3:
|
|
46047
|
+
this.sort3(first, first + 1, last - 1);
|
|
46048
|
+
return true;
|
|
46049
|
+
case 4:
|
|
46050
|
+
this.sort4(first, first + 1, first + 2, last - 1);
|
|
46051
|
+
return true;
|
|
46052
|
+
case 5:
|
|
46053
|
+
this.sort5(first, first + 1, first + 2, first + 3, last - 1);
|
|
46054
|
+
return true;
|
|
46055
|
+
default:
|
|
46056
|
+
return false;
|
|
46057
|
+
}
|
|
46058
|
+
}
|
|
46059
|
+
/** @see __algorithm/sort.h:__insertion_sort */
|
|
46060
|
+
insertionSort(first, last) {
|
|
46061
|
+
const { a, lt } = this;
|
|
46062
|
+
if (first === last) return;
|
|
46063
|
+
for (let i = first + 1; i !== last; ++i) {
|
|
46064
|
+
let j = i - 1;
|
|
46065
|
+
if (lt(a[i], a[j])) {
|
|
46066
|
+
const t = a[i];
|
|
46067
|
+
let k = j;
|
|
46068
|
+
j = i;
|
|
46069
|
+
do {
|
|
46070
|
+
a[j] = a[k];
|
|
46071
|
+
j = k;
|
|
46072
|
+
} while (j !== first && lt(t, a[--k]));
|
|
46073
|
+
a[j] = t;
|
|
46074
|
+
}
|
|
46075
|
+
}
|
|
46076
|
+
}
|
|
46077
|
+
/**
|
|
46078
|
+
* Assumes that `first - 1` holds an element no element of the range sorts before.
|
|
46079
|
+
* @see __algorithm/sort.h:__insertion_sort_unguarded
|
|
46080
|
+
*/
|
|
46081
|
+
insertionSortUnguarded(first, last) {
|
|
46082
|
+
const { a, lt } = this;
|
|
46083
|
+
if (first === last) return;
|
|
46084
|
+
for (let i = first + 1; i !== last; ++i) {
|
|
46085
|
+
let j = i - 1;
|
|
46086
|
+
if (lt(a[i], a[j])) {
|
|
46087
|
+
const t = a[i];
|
|
46088
|
+
let k = j;
|
|
46089
|
+
j = i;
|
|
46090
|
+
do {
|
|
46091
|
+
a[j] = a[k];
|
|
46092
|
+
j = k;
|
|
46093
|
+
} while (lt(t, a[--k]));
|
|
46094
|
+
a[j] = t;
|
|
46095
|
+
}
|
|
46096
|
+
}
|
|
46097
|
+
}
|
|
46098
|
+
/** @see __algorithm/sort.h:__insertion_sort_incomplete */
|
|
46099
|
+
insertionSortIncomplete(first, last) {
|
|
46100
|
+
const { a, lt } = this;
|
|
46101
|
+
if (this.sortSmall(first, last)) return true;
|
|
46102
|
+
let j = first + 2;
|
|
46103
|
+
this.sort3(first, first + 1, j);
|
|
46104
|
+
let count = 0;
|
|
46105
|
+
for (let i = j + 1; i !== last; ++i) {
|
|
46106
|
+
if (lt(a[i], a[j])) {
|
|
46107
|
+
const t = a[i];
|
|
46108
|
+
let k = j;
|
|
46109
|
+
j = i;
|
|
46110
|
+
do {
|
|
46111
|
+
a[j] = a[k];
|
|
46112
|
+
j = k;
|
|
46113
|
+
} while (j !== first && lt(t, a[--k]));
|
|
46114
|
+
a[j] = t;
|
|
46115
|
+
if (++count === INCOMPLETE_LIMIT) return ++i === last;
|
|
46116
|
+
}
|
|
46117
|
+
j = i;
|
|
46118
|
+
}
|
|
46119
|
+
return true;
|
|
46120
|
+
}
|
|
46121
|
+
/**
|
|
46122
|
+
* `*first` holds the pivot. Elements equivalent to it end up on its right.
|
|
46123
|
+
* @returns the pivot's index, and whether the range was already partitioned
|
|
46124
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_right
|
|
46125
|
+
*/
|
|
46126
|
+
partitionWithEqualsOnRight(first, last) {
|
|
46127
|
+
const { a, lt } = this;
|
|
46128
|
+
const begin = first;
|
|
46129
|
+
const pivot = a[first];
|
|
46130
|
+
do {
|
|
46131
|
+
++first;
|
|
46132
|
+
} while (lt(a[first], pivot));
|
|
46133
|
+
if (begin === first - 1) {
|
|
46134
|
+
while (first < last && !lt(a[--last], pivot)) ;
|
|
46135
|
+
} else {
|
|
46136
|
+
do {
|
|
46137
|
+
--last;
|
|
46138
|
+
} while (!lt(a[last], pivot));
|
|
46139
|
+
}
|
|
46140
|
+
const alreadyPartitioned = first >= last;
|
|
46141
|
+
while (first < last) {
|
|
46142
|
+
this.swap(first, last);
|
|
46143
|
+
do {
|
|
46144
|
+
++first;
|
|
46145
|
+
} while (lt(a[first], pivot));
|
|
46146
|
+
do {
|
|
46147
|
+
--last;
|
|
46148
|
+
} while (!lt(a[last], pivot));
|
|
46149
|
+
}
|
|
46150
|
+
const pivotPos = first - 1;
|
|
46151
|
+
if (begin !== pivotPos) a[begin] = a[pivotPos];
|
|
46152
|
+
a[pivotPos] = pivot;
|
|
46153
|
+
return [pivotPos, alreadyPartitioned];
|
|
46154
|
+
}
|
|
46155
|
+
/**
|
|
46156
|
+
* The opening scan of `__partition_with_equals_on_left`, apart because of the project's
|
|
46157
|
+
* complexity limit.
|
|
46158
|
+
* @returns the first index after `first` that sorts after the pivot, or `last`
|
|
46159
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_left
|
|
46160
|
+
*/
|
|
46161
|
+
firstAfterPivot(first, last, pivot) {
|
|
46162
|
+
const { a, lt } = this;
|
|
46163
|
+
if (lt(pivot, a[last - 1])) {
|
|
46164
|
+
do {
|
|
46165
|
+
++first;
|
|
46166
|
+
} while (!lt(pivot, a[first]));
|
|
46167
|
+
} else {
|
|
46168
|
+
while (++first < last && !lt(pivot, a[first])) ;
|
|
46169
|
+
}
|
|
46170
|
+
return first;
|
|
46171
|
+
}
|
|
46172
|
+
/**
|
|
46173
|
+
* `*first` holds the pivot. Elements equivalent to it end up on its left.
|
|
46174
|
+
* @returns the index after the pivot
|
|
46175
|
+
* @see __algorithm/sort.h:__partition_with_equals_on_left
|
|
46176
|
+
*/
|
|
46177
|
+
partitionWithEqualsOnLeft(first, last) {
|
|
46178
|
+
const { a, lt } = this;
|
|
46179
|
+
const begin = first;
|
|
46180
|
+
const pivot = a[first];
|
|
46181
|
+
first = this.firstAfterPivot(first, last, pivot);
|
|
46182
|
+
if (first < last) {
|
|
46183
|
+
do {
|
|
46184
|
+
--last;
|
|
46185
|
+
} while (lt(pivot, a[last]));
|
|
46186
|
+
}
|
|
46187
|
+
while (first < last) {
|
|
46188
|
+
this.swap(first, last);
|
|
46189
|
+
do {
|
|
46190
|
+
++first;
|
|
46191
|
+
} while (!lt(pivot, a[first]));
|
|
46192
|
+
do {
|
|
46193
|
+
--last;
|
|
46194
|
+
} while (lt(pivot, a[last]));
|
|
46195
|
+
}
|
|
46196
|
+
const pivotPos = first - 1;
|
|
46197
|
+
if (begin !== pivotPos) a[begin] = a[pivotPos];
|
|
46198
|
+
a[pivotPos] = pivot;
|
|
46199
|
+
return first;
|
|
46200
|
+
}
|
|
46201
|
+
/** @see __algorithm/sift_down.h:__sift_down */
|
|
46202
|
+
siftDown(first, len, start) {
|
|
46203
|
+
const { a, lt } = this;
|
|
46204
|
+
let child = start;
|
|
46205
|
+
if (len < 2 || Math.trunc((len - 2) / 2) < child) return;
|
|
46206
|
+
child = 2 * child + 1;
|
|
46207
|
+
if (child + 1 < len && lt(a[first + child], a[first + child + 1])) ++child;
|
|
46208
|
+
if (lt(a[first + child], a[first + start])) return;
|
|
46209
|
+
const top = a[first + start];
|
|
46210
|
+
do {
|
|
46211
|
+
a[first + start] = a[first + child];
|
|
46212
|
+
start = child;
|
|
46213
|
+
if (Math.trunc((len - 2) / 2) < child) break;
|
|
46214
|
+
child = 2 * child + 1;
|
|
46215
|
+
if (child + 1 < len && lt(a[first + child], a[first + child + 1])) ++child;
|
|
46216
|
+
} while (!lt(a[first + child], top));
|
|
46217
|
+
a[first + start] = top;
|
|
46218
|
+
}
|
|
46219
|
+
/** @see __algorithm/sift_down.h:__floyd_sift_down */
|
|
46220
|
+
floydSiftDown(first, len) {
|
|
46221
|
+
const { a, lt } = this;
|
|
46222
|
+
let hole = first;
|
|
46223
|
+
let childI = first;
|
|
46224
|
+
let child = 0;
|
|
46225
|
+
while (true) {
|
|
46226
|
+
childI += child + 1;
|
|
46227
|
+
child = 2 * child + 1;
|
|
46228
|
+
if (child + 1 < len && lt(a[childI], a[childI + 1])) {
|
|
46229
|
+
++childI;
|
|
46230
|
+
++child;
|
|
46231
|
+
}
|
|
46232
|
+
a[hole] = a[childI];
|
|
46233
|
+
hole = childI;
|
|
46234
|
+
if (child > Math.trunc((len - 2) / 2)) return hole;
|
|
46235
|
+
}
|
|
46236
|
+
}
|
|
46237
|
+
/** @see __algorithm/push_heap.h:__sift_up */
|
|
46238
|
+
siftUp(first, last, len) {
|
|
46239
|
+
const { a, lt } = this;
|
|
46240
|
+
if (len > 1) {
|
|
46241
|
+
len = Math.trunc((len - 2) / 2);
|
|
46242
|
+
let ptr = first + len;
|
|
46243
|
+
if (lt(a[ptr], a[--last])) {
|
|
46244
|
+
const t = a[last];
|
|
46245
|
+
do {
|
|
46246
|
+
a[last] = a[ptr];
|
|
46247
|
+
last = ptr;
|
|
46248
|
+
if (len === 0) break;
|
|
46249
|
+
len = Math.trunc((len - 1) / 2);
|
|
46250
|
+
ptr = first + len;
|
|
46251
|
+
} while (lt(a[ptr], t));
|
|
46252
|
+
a[last] = t;
|
|
46253
|
+
}
|
|
46254
|
+
}
|
|
46255
|
+
}
|
|
46256
|
+
/** @see __algorithm/pop_heap.h:__pop_heap */
|
|
46257
|
+
popHeap(first, last, len) {
|
|
46258
|
+
const a = this.a;
|
|
46259
|
+
if (len > 1) {
|
|
46260
|
+
const top = a[first];
|
|
46261
|
+
let hole = this.floydSiftDown(first, len);
|
|
46262
|
+
--last;
|
|
46263
|
+
if (hole === last) {
|
|
46264
|
+
a[hole] = top;
|
|
46265
|
+
} else {
|
|
46266
|
+
a[hole] = a[last];
|
|
46267
|
+
++hole;
|
|
46268
|
+
a[last] = top;
|
|
46269
|
+
this.siftUp(first, hole, hole - first);
|
|
46270
|
+
}
|
|
46271
|
+
}
|
|
46272
|
+
}
|
|
46273
|
+
/** @see __algorithm/make_heap.h:__make_heap */
|
|
46274
|
+
makeHeap(first, last) {
|
|
46275
|
+
const n = last - first;
|
|
46276
|
+
if (n > 1) {
|
|
46277
|
+
for (let start = Math.trunc((n - 2) / 2); start >= 0; --start) {
|
|
46278
|
+
this.siftDown(first, n, start);
|
|
46279
|
+
}
|
|
46280
|
+
}
|
|
46281
|
+
}
|
|
46282
|
+
/** @see __algorithm/sort_heap.h:__sort_heap */
|
|
46283
|
+
sortHeap(first, last) {
|
|
46284
|
+
for (let n = last - first; n > 1; --last, --n) this.popHeap(first, last, n);
|
|
46285
|
+
}
|
|
46286
|
+
/**
|
|
46287
|
+
* `__partial_sort_impl(first, last, last, comp)`, as the depth fallback calls it.
|
|
46288
|
+
* @see __algorithm/partial_sort.h:__partial_sort_impl
|
|
46289
|
+
*/
|
|
46290
|
+
partialSort(first, last) {
|
|
46291
|
+
this.makeHeap(first, last);
|
|
46292
|
+
this.sortHeap(first, last);
|
|
46293
|
+
}
|
|
46294
|
+
/**
|
|
46295
|
+
* Tukey's ninther or the median of 3, leaving the pivot at `first`. Apart from `__introsort`
|
|
46296
|
+
* because of the project's complexity limit.
|
|
46297
|
+
* @see __algorithm/sort.h:__introsort
|
|
46298
|
+
*/
|
|
46299
|
+
selectPivot(first, last, len) {
|
|
46300
|
+
const halfLen = Math.trunc(len / 2);
|
|
46301
|
+
if (len > NINTHER_THRESHOLD) {
|
|
46302
|
+
this.sort3(first, first + halfLen, last - 1);
|
|
46303
|
+
this.sort3(first + 1, first + (halfLen - 1), last - 2);
|
|
46304
|
+
this.sort3(first + 2, first + (halfLen + 1), last - 3);
|
|
46305
|
+
this.sort3(first + (halfLen - 1), first + halfLen, first + (halfLen + 1));
|
|
46306
|
+
this.swap(first, first + halfLen);
|
|
46307
|
+
} else {
|
|
46308
|
+
this.sort3(first + halfLen, first, last - 1);
|
|
46309
|
+
}
|
|
46310
|
+
}
|
|
46311
|
+
/**
|
|
46312
|
+
* `__introsort`'s test for a pivot equal to the highest element on its left. Apart because of
|
|
46313
|
+
* the project's complexity limit.
|
|
46314
|
+
* @see __algorithm/sort.h:__introsort
|
|
46315
|
+
*/
|
|
46316
|
+
pivotEqualsLeftNeighbour(first, leftmost) {
|
|
46317
|
+
return !leftmost && !this.lt(this.a[first - 1], this.a[first]);
|
|
46318
|
+
}
|
|
46319
|
+
/** @see __algorithm/sort.h:__introsort */
|
|
46320
|
+
introsort(first, last, depth, leftmost) {
|
|
46321
|
+
while (true) {
|
|
46322
|
+
const len = last - first;
|
|
46323
|
+
if (this.sortSmall(first, last)) return;
|
|
46324
|
+
if (len < LIMIT) {
|
|
46325
|
+
if (leftmost) this.insertionSort(first, last);
|
|
46326
|
+
else this.insertionSortUnguarded(first, last);
|
|
46327
|
+
return;
|
|
46328
|
+
}
|
|
46329
|
+
if (depth === 0) {
|
|
46330
|
+
this.partialSort(first, last);
|
|
46331
|
+
return;
|
|
46332
|
+
}
|
|
46333
|
+
--depth;
|
|
46334
|
+
this.selectPivot(first, last, len);
|
|
46335
|
+
if (this.pivotEqualsLeftNeighbour(first, leftmost)) {
|
|
46336
|
+
first = this.partitionWithEqualsOnLeft(first, last);
|
|
46337
|
+
continue;
|
|
46338
|
+
}
|
|
46339
|
+
const [i, alreadyPartitioned] = this.partitionWithEqualsOnRight(first, last);
|
|
46340
|
+
if (alreadyPartitioned) {
|
|
46341
|
+
const fs = this.insertionSortIncomplete(first, i);
|
|
46342
|
+
if (this.insertionSortIncomplete(i + 1, last)) {
|
|
46343
|
+
if (fs) return;
|
|
46344
|
+
last = i;
|
|
46345
|
+
continue;
|
|
46346
|
+
}
|
|
46347
|
+
if (fs) {
|
|
46348
|
+
first = i + 1;
|
|
46349
|
+
continue;
|
|
46350
|
+
}
|
|
46351
|
+
}
|
|
46352
|
+
this.introsort(first, i, depth, leftmost);
|
|
46353
|
+
leftmost = false;
|
|
46354
|
+
first = i + 1;
|
|
46355
|
+
}
|
|
46356
|
+
}
|
|
46357
|
+
};
|
|
46358
|
+
function libcxxSort(a, lt) {
|
|
46359
|
+
if (a.length === 0) return;
|
|
46360
|
+
new Introsort(a, lt).introsort(0, a.length, 2 * bitLog2(a.length), true);
|
|
46361
|
+
}
|
|
46362
|
+
|
|
45350
46363
|
// src/vpsc/SweepLine.ts
|
|
45351
46364
|
function makeNode(v, r, pos, seq2) {
|
|
45352
46365
|
return {
|
|
@@ -45360,15 +46373,13 @@ function makeNode(v, r, pos, seq2) {
|
|
|
45360
46373
|
rightNeighbours: []
|
|
45361
46374
|
};
|
|
45362
46375
|
}
|
|
45363
|
-
function compareEventsSameRect(ea, eb) {
|
|
45364
|
-
if (ea.type === EvType.Open && eb.type !== EvType.Open) return -1;
|
|
45365
|
-
return 1;
|
|
45366
|
-
}
|
|
45367
46376
|
function compareEvents(ea, eb) {
|
|
45368
|
-
if (ea.node.r === eb.node.r)
|
|
45369
|
-
|
|
45370
|
-
|
|
45371
|
-
return
|
|
46377
|
+
if (ea.node.r === eb.node.r) {
|
|
46378
|
+
return ea.type === EvType.Open && eb.type !== EvType.Open;
|
|
46379
|
+
}
|
|
46380
|
+
if (ea.pos > eb.pos) return false;
|
|
46381
|
+
if (ea.pos < eb.pos) return true;
|
|
46382
|
+
return false;
|
|
45372
46383
|
}
|
|
45373
46384
|
function nodePosLt(a, b) {
|
|
45374
46385
|
if (a.pos < b.pos) return true;
|
|
@@ -45500,7 +46511,7 @@ function buildYEvents(rects, vs) {
|
|
|
45500
46511
|
}
|
|
45501
46512
|
function generateXConstraints(rects, vs, useNeighbourLists) {
|
|
45502
46513
|
const events = buildXEvents(rects, vs);
|
|
45503
|
-
events
|
|
46514
|
+
libcxxSort(events, compareEvents);
|
|
45504
46515
|
const sl = [];
|
|
45505
46516
|
const cs = [];
|
|
45506
46517
|
for (const e of events) {
|
|
@@ -45519,7 +46530,7 @@ function generateXConstraints(rects, vs, useNeighbourLists) {
|
|
|
45519
46530
|
}
|
|
45520
46531
|
function generateYConstraints(rects, vs) {
|
|
45521
46532
|
const events = buildYEvents(rects, vs);
|
|
45522
|
-
events
|
|
46533
|
+
libcxxSort(events, compareEvents);
|
|
45523
46534
|
const sl = [];
|
|
45524
46535
|
const cs = [];
|
|
45525
46536
|
for (const e of events) {
|
|
@@ -48499,19 +49510,23 @@ function splineEdges(g) {
|
|
|
48499
49510
|
setState(GVSPLINES);
|
|
48500
49511
|
}
|
|
48501
49512
|
function computeBBFromPos(g) {
|
|
48502
|
-
const bb = {
|
|
48503
|
-
|
|
48504
|
-
|
|
49513
|
+
const bb = { ll: { x: Infinity, y: Infinity }, ur: { x: -Infinity, y: -Infinity } };
|
|
49514
|
+
const expandbp = (x, y) => {
|
|
49515
|
+
bb.ll = { x: Math.min(bb.ll.x, x), y: Math.min(bb.ll.y, y) };
|
|
49516
|
+
bb.ur = { x: Math.max(bb.ur.x, x), y: Math.max(bb.ur.y, y) };
|
|
48505
49517
|
};
|
|
48506
49518
|
for (const n of g.nodes.values()) {
|
|
48507
49519
|
const px = (n.info.pos?.[0] ?? 0) * 72;
|
|
48508
49520
|
const py = (n.info.pos?.[1] ?? 0) * 72;
|
|
48509
49521
|
const sx = (n.info.lw + n.info.rw) / 2;
|
|
48510
49522
|
const sy = n.info.ht / 2;
|
|
48511
|
-
|
|
48512
|
-
|
|
48513
|
-
|
|
48514
|
-
|
|
49523
|
+
expandbp(px - sx, py - sy);
|
|
49524
|
+
expandbp(px + sx, py + sy);
|
|
49525
|
+
}
|
|
49526
|
+
for (const e of g.edges) {
|
|
49527
|
+
for (const bz of e.info.spl?.list ?? []) {
|
|
49528
|
+
for (let j = 0; j < bz.size; j++) expandbp(bz.list[j].x, bz.list[j].y);
|
|
49529
|
+
}
|
|
48515
49530
|
}
|
|
48516
49531
|
if (!Number.isFinite(bb.ll.x)) {
|
|
48517
49532
|
return { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
@@ -50816,6 +51831,9 @@ function resolveSeed(g, dflt) {
|
|
|
50816
51831
|
}
|
|
50817
51832
|
function tuneControl(g, ctrl) {
|
|
50818
51833
|
ctrl.randomSeed = resolveSeed(g, ctrl.randomSeed);
|
|
51834
|
+
if (parseStart(aggetGraph(g, "start"), INIT_RANDOM).init !== INIT_RANDOM) {
|
|
51835
|
+
agwarningf("sfdp only supports start=random");
|
|
51836
|
+
}
|
|
50819
51837
|
ctrl.K = lateDouble(aggetGraph(g, "K"), -1, 0);
|
|
50820
51838
|
ctrl.p = -1 * lateDouble(aggetGraph(g, "repulsiveforce"), -AUTOP, 0);
|
|
50821
51839
|
ctrl.multilevels = lateInt(aggetGraph(g, "levels"), INT_MAX2, 0);
|
|
@@ -50838,7 +51856,10 @@ function tuneControl(g, ctrl) {
|
|
|
50838
51856
|
);
|
|
50839
51857
|
}
|
|
50840
51858
|
ctrl.edgeLabelingScheme = lateInt(aggetGraph(g, "label_scheme"), 0, 0);
|
|
50841
|
-
if (ctrl.edgeLabelingScheme > 4)
|
|
51859
|
+
if (ctrl.edgeLabelingScheme > 4) {
|
|
51860
|
+
agwarningf(`label_scheme = ${ctrl.edgeLabelingScheme} > 4 : ignoring`);
|
|
51861
|
+
ctrl.edgeLabelingScheme = 0;
|
|
51862
|
+
}
|
|
50842
51863
|
assertEdgeLabelSchemeSupported(g, ctrl.edgeLabelingScheme);
|
|
50843
51864
|
}
|
|
50844
51865
|
function assertEdgeLabelSchemeSupported(g, scheme) {
|
|
@@ -55716,7 +56737,7 @@ function sfdpLayout(g) {
|
|
|
55716
56737
|
let singleComponent = true;
|
|
55717
56738
|
if (g.nodes.size > 0) {
|
|
55718
56739
|
const { ctrl, pad, doAdjust } = resolveControl(g);
|
|
55719
|
-
const comps = ccomps(g
|
|
56740
|
+
const comps = ccomps(g);
|
|
55720
56741
|
singleComponent = comps.length === 1;
|
|
55721
56742
|
if (singleComponent) {
|
|
55722
56743
|
sfdpLayoutComponent(g, ctrl, pad);
|
|
@@ -55798,7 +56819,8 @@ function makeCircState(blockCount) {
|
|
|
55798
56819
|
graphCopyCount: 0,
|
|
55799
56820
|
spanningTreeCount: 0,
|
|
55800
56821
|
minDist: MINDIST2,
|
|
55801
|
-
rootname: ""
|
|
56822
|
+
rootname: "",
|
|
56823
|
+
nRoot: null
|
|
55802
56824
|
};
|
|
55803
56825
|
}
|
|
55804
56826
|
function makeCData(dn) {
|
|
@@ -56316,10 +57338,17 @@ function dfsVisit2(ctx, u, isRoot) {
|
|
|
56316
57338
|
insertBlock(ctx.state.bl, block);
|
|
56317
57339
|
}
|
|
56318
57340
|
}
|
|
56319
|
-
function
|
|
57341
|
+
function findRoot(g, state3) {
|
|
56320
57342
|
let root = null;
|
|
56321
|
-
if (state3.rootname) root = g.
|
|
57343
|
+
if (state3.rootname) root = g.nodes.find((dn) => dn.name === state3.rootname) ?? null;
|
|
57344
|
+
if (!root && state3.nRoot !== null) {
|
|
57345
|
+
root = g.nodes.find((dn) => mapbool(dn.orig.attrs.get("root") ?? state3.nRoot ?? void 0)) ?? null;
|
|
57346
|
+
}
|
|
56322
57347
|
if (!root && g.nodes.length > 0) root = g.nodes[0];
|
|
57348
|
+
return root;
|
|
57349
|
+
}
|
|
57350
|
+
function findBlocks(g, state3, allEdges3) {
|
|
57351
|
+
const root = findRoot(g, state3);
|
|
56323
57352
|
if (!root) return;
|
|
56324
57353
|
const ord = /* @__PURE__ */ new Map();
|
|
56325
57354
|
g.nodes.forEach((dn, i) => ord.set(dn, i));
|
|
@@ -56630,7 +57659,7 @@ function buildDerivedEdges(g, dg) {
|
|
|
56630
57659
|
return edges;
|
|
56631
57660
|
}
|
|
56632
57661
|
function derivedComponents(g, dg, allEdges3) {
|
|
56633
|
-
const comps = ccomps(g
|
|
57662
|
+
const comps = ccomps(g);
|
|
56634
57663
|
return comps.map((sg, i) => {
|
|
56635
57664
|
const nodes = [];
|
|
56636
57665
|
for (const n of sg.nodes.values()) {
|
|
@@ -56656,6 +57685,11 @@ function readMinDist(realg) {
|
|
|
56656
57685
|
const v = parseFloat(realg.attrs.get("mindist") ?? "");
|
|
56657
57686
|
return isNaN(v) || v < 0 ? 1 : v;
|
|
56658
57687
|
}
|
|
57688
|
+
function nodeRootDefault(realg) {
|
|
57689
|
+
const declared = realg.nodeDefaults.get("root");
|
|
57690
|
+
if (declared !== void 0) return declared;
|
|
57691
|
+
return Array.from(realg.nodes.values()).some((n) => n.attrs.has("root")) ? "" : null;
|
|
57692
|
+
}
|
|
56659
57693
|
function circularLayout(sg, realg, blockCount, allEdges3) {
|
|
56660
57694
|
if (sg.nodes.length === 1) {
|
|
56661
57695
|
layoutSingleNode(sg);
|
|
@@ -56664,6 +57698,7 @@ function circularLayout(sg, realg, blockCount, allEdges3) {
|
|
|
56664
57698
|
const state3 = makeCircState(blockCount);
|
|
56665
57699
|
state3.minDist = readMinDist(realg);
|
|
56666
57700
|
state3.rootname = realg.attrs.get("root") ?? "";
|
|
57701
|
+
state3.nRoot = nodeRootDefault(realg);
|
|
56667
57702
|
let root;
|
|
56668
57703
|
if (isOneblock(realg)) root = createOneBlock(sg, state3);
|
|
56669
57704
|
else root = createBlocktree(sg, state3, allEdges3);
|
|
@@ -56754,7 +57789,7 @@ function twopiLayout(g) {
|
|
|
56754
57789
|
const rootAttr = g.attrs.get("root");
|
|
56755
57790
|
const setRoot = rootAttr !== void 0;
|
|
56756
57791
|
const globalRoot = setRoot && rootAttr !== "" ? g.nodes.get(rootAttr) ?? null : null;
|
|
56757
|
-
const comps = ccomps(g
|
|
57792
|
+
const comps = ccomps(g);
|
|
56758
57793
|
if (comps.length === 1) {
|
|
56759
57794
|
layoutSingle(g, comps, globalRoot, setRoot);
|
|
56760
57795
|
} else {
|
|
@@ -57479,7 +58514,7 @@ function svgEndCluster(job) {
|
|
|
57479
58514
|
}
|
|
57480
58515
|
|
|
57481
58516
|
// src/render/svg-edge-split.ts
|
|
57482
|
-
var
|
|
58517
|
+
var DEFAULT_COLOR6 = "black";
|
|
57483
58518
|
var PENWIDTH_NORMAL4 = 1;
|
|
57484
58519
|
var PENWIDTH_THRESHOLD4 = 5e-3;
|
|
57485
58520
|
var EPS3 = 1e-5;
|
|
@@ -57533,7 +58568,7 @@ function emitCurve(list, color, job) {
|
|
|
57533
58568
|
}
|
|
57534
58569
|
function stepSegment(list, s, st, out) {
|
|
57535
58570
|
if (Math.abs(s.t) < EPS3) return;
|
|
57536
|
-
const color = s.color ??
|
|
58571
|
+
const color = s.color ?? DEFAULT_COLOR6;
|
|
57537
58572
|
st.left -= s.t;
|
|
57538
58573
|
st.endColor = color;
|
|
57539
58574
|
if (st.first) {
|
|
@@ -57552,7 +58587,7 @@ function stepSegment(list, s, st, out) {
|
|
|
57552
58587
|
}
|
|
57553
58588
|
}
|
|
57554
58589
|
function splitSplineByColor(list, segs) {
|
|
57555
|
-
const st = { left: 1, first: true, bzR: list, done: false, endColor:
|
|
58590
|
+
const st = { left: 1, first: true, bzR: list, done: false, endColor: DEFAULT_COLOR6 };
|
|
57556
58591
|
const curves = [];
|
|
57557
58592
|
for (const s of segs) {
|
|
57558
58593
|
stepSegment(list, s, st, curves);
|
|
@@ -57567,7 +58602,7 @@ function drawSplitSpline(list, segs, job) {
|
|
|
57567
58602
|
}
|
|
57568
58603
|
function emitSplitEdgePaths(e, job, colorList) {
|
|
57569
58604
|
const segs = parseSegs(colorList, edgeSegsContext(e)).segs;
|
|
57570
|
-
const firstColor2 = segs[0]?.color ??
|
|
58605
|
+
const firstColor2 = segs[0]?.color ?? DEFAULT_COLOR6;
|
|
57571
58606
|
const spl = e.info.spl;
|
|
57572
58607
|
let endColor = firstColor2;
|
|
57573
58608
|
if (spl === void 0) return { firstColor: firstColor2, endColor };
|
|
@@ -58908,7 +59943,7 @@ var DotWriterBase = class {
|
|
|
58908
59943
|
* @see plugin/core/gvrender_core_dot.c:284 xdot_end_cluster */
|
|
58909
59944
|
clusterAttrs(sg) {
|
|
58910
59945
|
const d = this.drawsOf(sg);
|
|
58911
|
-
const parts = this.emitDraws ? [this.drawAttr("_draw_", d?.draw ?? "")] : [];
|
|
59946
|
+
const parts = this.emitDraws || d?.draw ? [this.drawAttr("_draw_", d?.draw ?? "")] : [];
|
|
58912
59947
|
if (d?.ldraw) parts.push(this.drawAttr("_ldraw_", d.ldraw));
|
|
58913
59948
|
if (sg.info.bb) parts.push('bb="' + this.bbStr(sg) + '"');
|
|
58914
59949
|
parts.push(...graphLabelAttrs(sg));
|
|
@@ -59021,8 +60056,8 @@ var DotWriterBase = class {
|
|
|
59021
60056
|
};
|
|
59022
60057
|
|
|
59023
60058
|
// src/render/dot/edge-draw.ts
|
|
59024
|
-
var
|
|
59025
|
-
var
|
|
60059
|
+
var DEFAULT_COLOR7 = "black";
|
|
60060
|
+
var DEFAULT_LINE_STYLE3 = ["solid", "setlinewidth(1)"];
|
|
59026
60061
|
function emitArrowOp(buf, op, fill) {
|
|
59027
60062
|
switch (op.kind) {
|
|
59028
60063
|
case "polygon":
|
|
@@ -59057,9 +60092,9 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
59057
60092
|
*/
|
|
59058
60093
|
attachmentPolyline(pts, pencolor, job) {
|
|
59059
60094
|
const obj = job.obj;
|
|
59060
|
-
gvrenderSetStyle(
|
|
60095
|
+
gvrenderSetStyle(DEFAULT_LINE_STYLE3);
|
|
59061
60096
|
if (obj !== null) {
|
|
59062
|
-
obj.rawStyle = [...
|
|
60097
|
+
obj.rawStyle = [...DEFAULT_LINE_STYLE3];
|
|
59063
60098
|
obj.pen = 3 /* Solid */;
|
|
59064
60099
|
obj.penWidth = 1;
|
|
59065
60100
|
obj.penColor = resolveRenderColor(pencolor.split(":")[0]);
|
|
@@ -59115,7 +60150,7 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
59115
60150
|
*/
|
|
59116
60151
|
emitSplitSpline(bzList, e, colorAttr, edraw, job) {
|
|
59117
60152
|
const segs = parseSegs(colorAttr, edgeSegsContext(e)).segs;
|
|
59118
|
-
const firstColor2 = segs[0]?.color ??
|
|
60153
|
+
const firstColor2 = segs[0]?.color ?? DEFAULT_COLOR7;
|
|
59119
60154
|
let endColor = firstColor2;
|
|
59120
60155
|
for (const bz of bzList) {
|
|
59121
60156
|
if (bz === void 0 || bz.size < 4) continue;
|
|
@@ -59137,7 +60172,7 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
59137
60172
|
const segData = bzList.map(
|
|
59138
60173
|
(bz) => bz !== void 0 && bz.size >= 4 ? buildOffsetLists(bz.list, (2 + numc) / 2) : { offlist: [], tmplist: [] }
|
|
59139
60174
|
);
|
|
59140
|
-
const colors = parseSegsSilent(colorAttr).segs.map((s) => s.color ??
|
|
60175
|
+
const colors = parseSegsSilent(colorAttr).segs.map((s) => s.color ?? DEFAULT_COLOR7);
|
|
59141
60176
|
for (const color of colors) {
|
|
59142
60177
|
const pen = xdotPenColor(resolveRenderColor(color));
|
|
59143
60178
|
for (const sd of segData) {
|
|
@@ -59147,8 +60182,8 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
59147
60182
|
}
|
|
59148
60183
|
}
|
|
59149
60184
|
return {
|
|
59150
|
-
headColor: colors[0] ??
|
|
59151
|
-
tailColor: colors[1] ?? colors[0] ??
|
|
60185
|
+
headColor: colors[0] ?? DEFAULT_COLOR7,
|
|
60186
|
+
tailColor: colors[1] ?? colors[0] ?? DEFAULT_COLOR7
|
|
59152
60187
|
};
|
|
59153
60188
|
}
|
|
59154
60189
|
/** Emit one arrow's primitive ops into `buf` (pen/fill from the edge color).
|
|
@@ -59172,6 +60207,89 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
59172
60207
|
}
|
|
59173
60208
|
};
|
|
59174
60209
|
|
|
60210
|
+
// src/render/dot/write-back.ts
|
|
60211
|
+
var POINTS_PER_INCH14 = 72;
|
|
60212
|
+
function attachNode(n) {
|
|
60213
|
+
const attrs = ownAttrs(n);
|
|
60214
|
+
const info = n.info;
|
|
60215
|
+
attrs.set("pos", gfmt5(info.coord.x) + "," + gfmt5(info.coord.y));
|
|
60216
|
+
attrs.set("height", gfmt5(info.ht / POINTS_PER_INCH14));
|
|
60217
|
+
attrs.set("width", gfmt5((info.lw + info.rw) / POINTS_PER_INCH14));
|
|
60218
|
+
const xlabel = info.xlabel;
|
|
60219
|
+
if (xlabel?.set) attrs.set("xlp", lpStr(xlabel.pos));
|
|
60220
|
+
if (info.shape?.name === "record") {
|
|
60221
|
+
const rects = [];
|
|
60222
|
+
appendRecordRects(n, info.shape_info, rects);
|
|
60223
|
+
attrs.set("rects", rects.join(" "));
|
|
60224
|
+
}
|
|
60225
|
+
}
|
|
60226
|
+
function attachEdge(e) {
|
|
60227
|
+
if (!edgeAttrsAttached(e)) return;
|
|
60228
|
+
const pos = edgePosRaw(e);
|
|
60229
|
+
if (pos === null) return;
|
|
60230
|
+
const attrs = ownAttrs(e);
|
|
60231
|
+
const { label, xlabel, head_label: head, tail_label: tail } = e.info;
|
|
60232
|
+
attrs.set("pos", pos);
|
|
60233
|
+
if (label) attrs.set("lp", lpStr(label.pos));
|
|
60234
|
+
if (xlabel?.set) attrs.set("xlp", lpStr(xlabel.pos));
|
|
60235
|
+
if (head) attrs.set("head_lp", lpStr(head.pos));
|
|
60236
|
+
if (tail) attrs.set("tail_lp", lpStr(tail.pos));
|
|
60237
|
+
}
|
|
60238
|
+
function clustersOf(g) {
|
|
60239
|
+
return (g.info.clust ?? []).slice(0, g.info.n_cluster ?? 0).filter(Boolean);
|
|
60240
|
+
}
|
|
60241
|
+
function recAttachBb(g) {
|
|
60242
|
+
const { ll, ur } = g.info.bb;
|
|
60243
|
+
g.attrs.set("bb", gfmt5(ll.x) + "," + gfmt5(ll.y) + "," + gfmt5(ur.x) + "," + gfmt5(ur.y));
|
|
60244
|
+
const label = g.info.label;
|
|
60245
|
+
if (label && label.text.length > 0) {
|
|
60246
|
+
g.attrs.set("lp", lpStr(label.pos));
|
|
60247
|
+
g.attrs.set("lwidth", gfmt2(label.dimen.x / POINTS_PER_INCH14));
|
|
60248
|
+
g.attrs.set("lheight", gfmt2(label.dimen.y / POINTS_PER_INCH14));
|
|
60249
|
+
}
|
|
60250
|
+
for (const sg of clustersOf(g)) recAttachBb(sg);
|
|
60251
|
+
}
|
|
60252
|
+
function attachAttrs(g) {
|
|
60253
|
+
for (const n of g.nodes.values()) attachNode(n);
|
|
60254
|
+
for (const e of g.edges) attachEdge(e);
|
|
60255
|
+
recAttachBb(g);
|
|
60256
|
+
}
|
|
60257
|
+
function storedDraws(attrs) {
|
|
60258
|
+
return {
|
|
60259
|
+
draw: attrs.get("_draw_"),
|
|
60260
|
+
ldraw: attrs.get("_ldraw_"),
|
|
60261
|
+
hdraw: attrs.get("_hdraw_"),
|
|
60262
|
+
tdraw: attrs.get("_tdraw_"),
|
|
60263
|
+
hldraw: attrs.get("_hldraw_"),
|
|
60264
|
+
tldraw: attrs.get("_tldraw_")
|
|
60265
|
+
};
|
|
60266
|
+
}
|
|
60267
|
+
function attachDraws(attrs, d) {
|
|
60268
|
+
if (d?.draw) attrs.set("_draw_", d.draw);
|
|
60269
|
+
if (d?.ldraw) attrs.set("_ldraw_", d.ldraw);
|
|
60270
|
+
if (d?.hdraw) attrs.set("_hdraw_", d.hdraw);
|
|
60271
|
+
if (d?.tdraw) attrs.set("_tdraw_", d.tdraw);
|
|
60272
|
+
if (d?.hldraw) attrs.set("_hldraw_", d.hldraw);
|
|
60273
|
+
if (d?.tldraw) attrs.set("_tldraw_", d.tldraw);
|
|
60274
|
+
}
|
|
60275
|
+
function attachClusterDraws(g, drawsOf) {
|
|
60276
|
+
for (const sg of clustersOf(g)) {
|
|
60277
|
+
const d = drawsOf(sg);
|
|
60278
|
+
sg.attrs.set("_draw_", d?.draw ?? "");
|
|
60279
|
+
if (d?.ldraw) sg.attrs.set("_ldraw_", d.ldraw);
|
|
60280
|
+
attachClusterDraws(sg, drawsOf);
|
|
60281
|
+
}
|
|
60282
|
+
}
|
|
60283
|
+
function attachXdotAttrs(g, drawsOf) {
|
|
60284
|
+
attachAttrs(g);
|
|
60285
|
+
if (drawsOf === void 0) return;
|
|
60286
|
+
for (const n of g.nodes.values()) attachDraws(ownAttrs(n), drawsOf(n));
|
|
60287
|
+
for (const e of g.edges) attachDraws(ownAttrs(e), drawsOf(e));
|
|
60288
|
+
attachDraws(g.attrs, drawsOf(g));
|
|
60289
|
+
attachClusterDraws(g, drawsOf);
|
|
60290
|
+
g.attrs.set("xdotversion", XDOT_VERSION);
|
|
60291
|
+
}
|
|
60292
|
+
|
|
59175
60293
|
// src/render/dot.ts
|
|
59176
60294
|
var XdotRenderer = class extends EdgeDrawBase {
|
|
59177
60295
|
type = "xdot";
|
|
@@ -59186,10 +60304,10 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
59186
60304
|
* @see plugin/core/gvrender_core_dot.c:404,418,475,482
|
|
59187
60305
|
*/
|
|
59188
60306
|
emitDraws = true;
|
|
59189
|
-
/** Draw strings for `obj
|
|
59190
|
-
* Single gate so the
|
|
60307
|
+
/** Draw strings for `obj`. `-Tdot` computes none, and agwrite prints the ones the
|
|
60308
|
+
* attribute slots already hold. Single gate so the two paths cannot drift. */
|
|
59191
60309
|
drawsOf(obj) {
|
|
59192
|
-
return this.emitDraws ? this.draws.get(obj) :
|
|
60310
|
+
return this.emitDraws ? this.draws.get(obj) : storedDraws(obj.attrs);
|
|
59193
60311
|
}
|
|
59194
60312
|
/** Per-render draw buffers. Indices 8/9 alias 1; 10/11 alias 5. */
|
|
59195
60313
|
bufs = makeXbufs();
|
|
@@ -59208,11 +60326,8 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
59208
60326
|
this.draws = /* @__PURE__ */ new Map();
|
|
59209
60327
|
this.clusters = [];
|
|
59210
60328
|
}
|
|
59211
|
-
/** The
|
|
59212
|
-
*
|
|
59213
|
-
* `-Tjson` reads directly (via agxget) — feeding them to parseXDot avoids the
|
|
59214
|
-
* DOT-text round-trip, which cannot represent draw text containing `"` and so
|
|
59215
|
-
* drops a preceding backslash (a cluster label's `\"` → `"`, id 2239). */
|
|
60329
|
+
/** The last render's draw strings by ORIGINAL object: what `-Tjson` reads via agxget.
|
|
60330
|
+
* The DOT-text round-trip cannot represent draw text containing `"` (id 2239). */
|
|
59216
60331
|
drawStringsByObject() {
|
|
59217
60332
|
return this.draws;
|
|
59218
60333
|
}
|
|
@@ -59225,6 +60340,10 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
59225
60340
|
if (gl) set.ldraw = escBackslash(gl);
|
|
59226
60341
|
}
|
|
59227
60342
|
job.write(this.serialize(g));
|
|
60343
|
+
this.writeBack(g);
|
|
60344
|
+
}
|
|
60345
|
+
writeBack(g) {
|
|
60346
|
+
attachXdotAttrs(g, this.emitDraws ? (o) => this.drawsOf(o) : void 0);
|
|
59228
60347
|
}
|
|
59229
60348
|
/** Emit the canvas background polygon into the GDRAW buffer.
|
|
59230
60349
|
* @see lib/common/emit.c:1476 emit_background */
|
|
@@ -59496,7 +60615,6 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
59496
60615
|
}
|
|
59497
60616
|
return d;
|
|
59498
60617
|
}
|
|
59499
|
-
// --- serialization (agwrite-at-end) ------------------------------------
|
|
59500
60618
|
};
|
|
59501
60619
|
var DotRenderer = class extends XdotRenderer {
|
|
59502
60620
|
type = "dot";
|
|
@@ -59717,370 +60835,6 @@ function createSvgRenderer() {
|
|
|
59717
60835
|
return new SvgRenderer();
|
|
59718
60836
|
}
|
|
59719
60837
|
|
|
59720
|
-
// src/xdot/types.ts
|
|
59721
|
-
var XDOT_PARSE_ERROR = 1;
|
|
59722
|
-
|
|
59723
|
-
// src/xdot/parse.ts
|
|
59724
|
-
var ULONG_MAX = 0xffffffffffffffffn;
|
|
59725
|
-
var XdotParser = class _XdotParser {
|
|
59726
|
-
static isWs(c) {
|
|
59727
|
-
return c === " " || c === " " || c === "\n" || c === "\r";
|
|
59728
|
-
}
|
|
59729
|
-
static skipWs(s, pos) {
|
|
59730
|
-
while (pos < s.length && _XdotParser.isWs(s[pos])) pos++;
|
|
59731
|
-
return pos;
|
|
59732
|
-
}
|
|
59733
|
-
static consumeDigits(s, i) {
|
|
59734
|
-
while (i < s.length && s[i] >= "0" && s[i] <= "9") i++;
|
|
59735
|
-
return i;
|
|
59736
|
-
}
|
|
59737
|
-
static consumeExponent(s, i) {
|
|
59738
|
-
if (i < s.length && (s[i] === "e" || s[i] === "E")) {
|
|
59739
|
-
i++;
|
|
59740
|
-
if (i < s.length && (s[i] === "+" || s[i] === "-")) i++;
|
|
59741
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
59742
|
-
}
|
|
59743
|
-
return i;
|
|
59744
|
-
}
|
|
59745
|
-
static parseReal(s, pos) {
|
|
59746
|
-
let i = _XdotParser.skipWs(s, pos);
|
|
59747
|
-
const start = i;
|
|
59748
|
-
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
59749
|
-
const digStart = i;
|
|
59750
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
59751
|
-
if (i < s.length && s[i] === ".") {
|
|
59752
|
-
i++;
|
|
59753
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
59754
|
-
}
|
|
59755
|
-
i = _XdotParser.consumeExponent(s, i);
|
|
59756
|
-
if (i === start || i === digStart) return null;
|
|
59757
|
-
return { val: parseFloat(s.slice(start, i)), pos: i };
|
|
59758
|
-
}
|
|
59759
|
-
static parseInt_(s, pos) {
|
|
59760
|
-
let i = _XdotParser.skipWs(s, pos);
|
|
59761
|
-
const start = i;
|
|
59762
|
-
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
59763
|
-
const digStart = i;
|
|
59764
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
59765
|
-
if (i === digStart) return null;
|
|
59766
|
-
return { val: parseInt(s.slice(start, i), 10), pos: i };
|
|
59767
|
-
}
|
|
59768
|
-
/**
|
|
59769
|
-
* strtoul(s, &endp, 10) cast to unsigned int: optional sign, a leading "-"
|
|
59770
|
-
* negates modulo 2^64, magnitude overflow saturates to ULONG_MAX, and the
|
|
59771
|
-
* result keeps the low 32 bits.
|
|
59772
|
-
* @see lib/xdot/xdot.c:parseUInt
|
|
59773
|
-
*/
|
|
59774
|
-
static parseUInt_(s, pos) {
|
|
59775
|
-
const i = _XdotParser.skipWs(s, pos);
|
|
59776
|
-
let start = i;
|
|
59777
|
-
const negative = i < s.length && s[i] === "-";
|
|
59778
|
-
if (i < s.length && (s[i] === "-" || s[i] === "+")) start++;
|
|
59779
|
-
const end = _XdotParser.consumeDigits(s, start);
|
|
59780
|
-
if (end === start) return null;
|
|
59781
|
-
const mag = BigInt(s.slice(start, end));
|
|
59782
|
-
const clamped = mag > ULONG_MAX ? ULONG_MAX : mag;
|
|
59783
|
-
const wrapped = negative && mag <= ULONG_MAX ? BigInt.asUintN(64, -clamped) : clamped;
|
|
59784
|
-
return { val: Number(BigInt.asUintN(32, wrapped)), pos: end };
|
|
59785
|
-
}
|
|
59786
|
-
static parseRect(s, pos) {
|
|
59787
|
-
const rx = _XdotParser.parseReal(s, pos);
|
|
59788
|
-
if (!rx) return null;
|
|
59789
|
-
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
59790
|
-
if (!ry) return null;
|
|
59791
|
-
const rw = _XdotParser.parseReal(s, ry.pos);
|
|
59792
|
-
if (!rw) return null;
|
|
59793
|
-
const rh = _XdotParser.parseReal(s, rw.pos);
|
|
59794
|
-
if (!rh) return null;
|
|
59795
|
-
return { val: { x: rx.val, y: ry.val, w: rw.val, h: rh.val }, pos: rh.pos };
|
|
59796
|
-
}
|
|
59797
|
-
static parsePoint(s, pos) {
|
|
59798
|
-
const rx = _XdotParser.parseReal(s, pos);
|
|
59799
|
-
if (!rx) return null;
|
|
59800
|
-
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
59801
|
-
if (!ry) return null;
|
|
59802
|
-
return { val: { x: rx.val, y: ry.val, z: 0 }, pos: ry.pos };
|
|
59803
|
-
}
|
|
59804
|
-
static parsePolyline(s, pos) {
|
|
59805
|
-
const ri = _XdotParser.parseUInt_(s, pos);
|
|
59806
|
-
if (!ri) return null;
|
|
59807
|
-
let cur = ri.pos;
|
|
59808
|
-
const pts = [];
|
|
59809
|
-
for (let i = 0; i < ri.val; i++) {
|
|
59810
|
-
const rp = _XdotParser.parsePoint(s, cur);
|
|
59811
|
-
if (!rp) return null;
|
|
59812
|
-
pts.push(rp.val);
|
|
59813
|
-
cur = rp.pos;
|
|
59814
|
-
}
|
|
59815
|
-
return { val: { pts }, pos: cur };
|
|
59816
|
-
}
|
|
59817
|
-
/** UTF-8 byte length of one code point (mirrors dot.ts utf8Len per char). */
|
|
59818
|
-
static cpByteLen(cp) {
|
|
59819
|
-
if (cp < 128) return 1;
|
|
59820
|
-
if (cp < 2048) return 2;
|
|
59821
|
-
if (cp < 65536) return 3;
|
|
59822
|
-
return 4;
|
|
59823
|
-
}
|
|
59824
|
-
static parseString(s, pos) {
|
|
59825
|
-
const ri = _XdotParser.parseInt_(s, pos);
|
|
59826
|
-
if (!ri || ri.val <= 0) return null;
|
|
59827
|
-
const len = ri.val;
|
|
59828
|
-
let cur = _XdotParser.skipWs(s, ri.pos);
|
|
59829
|
-
if (s[cur] !== "-") return null;
|
|
59830
|
-
cur++;
|
|
59831
|
-
let out = "";
|
|
59832
|
-
let accounted = 0;
|
|
59833
|
-
let j = 0;
|
|
59834
|
-
while (accounted < len) {
|
|
59835
|
-
if (cur + j >= s.length) return null;
|
|
59836
|
-
const ch = s[cur + j];
|
|
59837
|
-
const prev = j > 0 ? s[cur + j - 1] : "";
|
|
59838
|
-
out += ch;
|
|
59839
|
-
if (ch === "\\" && prev !== "\\") {
|
|
59840
|
-
j++;
|
|
59841
|
-
continue;
|
|
59842
|
-
}
|
|
59843
|
-
const cp = s.codePointAt(cur + j);
|
|
59844
|
-
accounted += _XdotParser.cpByteLen(cp);
|
|
59845
|
-
if (cp > 65535) {
|
|
59846
|
-
out += s[cur + j + 1];
|
|
59847
|
-
j++;
|
|
59848
|
-
}
|
|
59849
|
-
j++;
|
|
59850
|
-
}
|
|
59851
|
-
return { val: out, pos: cur + j };
|
|
59852
|
-
}
|
|
59853
|
-
static parseAlign(s, pos) {
|
|
59854
|
-
const ri = _XdotParser.parseInt_(s, pos);
|
|
59855
|
-
if (!ri) return null;
|
|
59856
|
-
const align = ri.val < 0 ? "left" : ri.val > 0 ? "right" : "center";
|
|
59857
|
-
return { val: align, pos: ri.pos };
|
|
59858
|
-
}
|
|
59859
|
-
static parseStops(s, pos, n) {
|
|
59860
|
-
let cur = pos;
|
|
59861
|
-
const stops = [];
|
|
59862
|
-
for (let i = 0; i < n; i++) {
|
|
59863
|
-
const rf = _XdotParser.parseReal(s, cur);
|
|
59864
|
-
if (!rf) return null;
|
|
59865
|
-
const rc = _XdotParser.parseString(s, rf.pos);
|
|
59866
|
-
if (!rc) return null;
|
|
59867
|
-
stops.push({ frac: rf.val, color: rc.val });
|
|
59868
|
-
cur = rc.pos;
|
|
59869
|
-
}
|
|
59870
|
-
return { stops, pos: cur };
|
|
59871
|
-
}
|
|
59872
|
-
static linGradient(s, pos) {
|
|
59873
|
-
const rx0 = _XdotParser.parseReal(s, pos);
|
|
59874
|
-
if (!rx0) return null;
|
|
59875
|
-
const ry0 = _XdotParser.parseReal(s, rx0.pos);
|
|
59876
|
-
if (!ry0) return null;
|
|
59877
|
-
const rx1 = _XdotParser.parseReal(s, ry0.pos);
|
|
59878
|
-
if (!rx1) return null;
|
|
59879
|
-
const ry1 = _XdotParser.parseReal(s, rx1.pos);
|
|
59880
|
-
if (!ry1) return null;
|
|
59881
|
-
const rn = _XdotParser.parseUInt_(s, ry1.pos);
|
|
59882
|
-
if (!rn) return null;
|
|
59883
|
-
const rs = _XdotParser.parseStops(s, rn.pos, rn.val);
|
|
59884
|
-
if (!rs) return null;
|
|
59885
|
-
return { x0: rx0.val, y0: ry0.val, x1: rx1.val, y1: ry1.val, stops: rs.stops };
|
|
59886
|
-
}
|
|
59887
|
-
static radGradient(s, pos) {
|
|
59888
|
-
const rx0 = _XdotParser.parseReal(s, pos);
|
|
59889
|
-
if (!rx0) return null;
|
|
59890
|
-
const ry0 = _XdotParser.parseReal(s, rx0.pos);
|
|
59891
|
-
if (!ry0) return null;
|
|
59892
|
-
const rr0 = _XdotParser.parseReal(s, ry0.pos);
|
|
59893
|
-
if (!rr0) return null;
|
|
59894
|
-
const rx1 = _XdotParser.parseReal(s, rr0.pos);
|
|
59895
|
-
if (!rx1) return null;
|
|
59896
|
-
const ry1 = _XdotParser.parseReal(s, rx1.pos);
|
|
59897
|
-
if (!ry1) return null;
|
|
59898
|
-
const rr1 = _XdotParser.parseReal(s, ry1.pos);
|
|
59899
|
-
if (!rr1) return null;
|
|
59900
|
-
const rn = _XdotParser.parseUInt_(s, rr1.pos);
|
|
59901
|
-
if (!rn) return null;
|
|
59902
|
-
const rs = _XdotParser.parseStops(s, rn.pos, rn.val);
|
|
59903
|
-
if (!rs) return null;
|
|
59904
|
-
return { x0: rx0.val, y0: ry0.val, r0: rr0.val, x1: rx1.val, y1: ry1.val, r1: rr1.val, stops: rs.stops };
|
|
59905
|
-
}
|
|
59906
|
-
static isAlnum(c) {
|
|
59907
|
-
return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9";
|
|
59908
|
-
}
|
|
59909
|
-
static parseXDotColorAt(s, pos) {
|
|
59910
|
-
const c = pos < s.length ? s[pos] : "";
|
|
59911
|
-
if (c === "[") {
|
|
59912
|
-
const g = _XdotParser.linGradient(s, pos + 1);
|
|
59913
|
-
if (!g) return null;
|
|
59914
|
-
return { val: { type: "linear", ling: g }, pos };
|
|
59915
|
-
}
|
|
59916
|
-
if (c === "(") {
|
|
59917
|
-
const g = _XdotParser.radGradient(s, pos + 1);
|
|
59918
|
-
if (!g) return null;
|
|
59919
|
-
return { val: { type: "radial", ring: g }, pos };
|
|
59920
|
-
}
|
|
59921
|
-
if (c === "#" || c === "/" || _XdotParser.isAlnum(c))
|
|
59922
|
-
return { val: { type: "none", clr: s.slice(pos) }, pos };
|
|
59923
|
-
return null;
|
|
59924
|
-
}
|
|
59925
|
-
static parseEllipseOp(ch, s, pos, fns) {
|
|
59926
|
-
const r = _XdotParser.parseRect(s, pos);
|
|
59927
|
-
if (!r) return "error";
|
|
59928
|
-
const op = { kind: ch === "E" ? "filled_ellipse" : "unfilled_ellipse", ellipse: r.val };
|
|
59929
|
-
fns.ellipse?.(op, 0);
|
|
59930
|
-
return { op, pos: r.pos };
|
|
59931
|
-
}
|
|
59932
|
-
static parsePolygonOp(ch, s, pos, fns) {
|
|
59933
|
-
const r = _XdotParser.parsePolyline(s, pos);
|
|
59934
|
-
if (!r) return "error";
|
|
59935
|
-
const op = { kind: ch === "P" ? "filled_polygon" : "unfilled_polygon", polygon: r.val };
|
|
59936
|
-
fns.polygon?.(op, 0);
|
|
59937
|
-
return { op, pos: r.pos };
|
|
59938
|
-
}
|
|
59939
|
-
static parseBezierOp(ch, s, pos, fns) {
|
|
59940
|
-
const r = _XdotParser.parsePolyline(s, pos);
|
|
59941
|
-
if (!r) return "error";
|
|
59942
|
-
const op = { kind: ch === "b" ? "filled_bezier" : "unfilled_bezier", bezier: r.val };
|
|
59943
|
-
fns.bezier?.(op, 0);
|
|
59944
|
-
return { op, pos: r.pos };
|
|
59945
|
-
}
|
|
59946
|
-
static parsePolylineOp(s, pos, fns) {
|
|
59947
|
-
const r = _XdotParser.parsePolyline(s, pos);
|
|
59948
|
-
if (!r) return "error";
|
|
59949
|
-
const op = { kind: "polyline", polyline: r.val };
|
|
59950
|
-
fns.polyline?.(op, 0);
|
|
59951
|
-
return { op, pos: r.pos };
|
|
59952
|
-
}
|
|
59953
|
-
static parseTextOp(s, pos, fns) {
|
|
59954
|
-
const rx = _XdotParser.parseReal(s, pos);
|
|
59955
|
-
if (!rx) return "error";
|
|
59956
|
-
const ry = _XdotParser.parseReal(s, rx.pos);
|
|
59957
|
-
if (!ry) return "error";
|
|
59958
|
-
const ra = _XdotParser.parseAlign(s, ry.pos);
|
|
59959
|
-
if (!ra) return "error";
|
|
59960
|
-
const rw = _XdotParser.parseReal(s, ra.pos);
|
|
59961
|
-
if (!rw) return "error";
|
|
59962
|
-
const rt = _XdotParser.parseString(s, rw.pos);
|
|
59963
|
-
if (!rt) return "error";
|
|
59964
|
-
const text = { x: rx.val, y: ry.val, align: ra.val, width: rw.val, text: rt.val };
|
|
59965
|
-
const op = { kind: "text", text };
|
|
59966
|
-
fns.text?.(op, 0);
|
|
59967
|
-
return { op, pos: rt.pos };
|
|
59968
|
-
}
|
|
59969
|
-
static parseColorOp(ch, s, pos, fns) {
|
|
59970
|
-
const rs = _XdotParser.parseString(s, pos);
|
|
59971
|
-
if (!rs) return "error";
|
|
59972
|
-
const rc = _XdotParser.parseXDotColorAt(rs.val, 0);
|
|
59973
|
-
if (!rc) return "error";
|
|
59974
|
-
const clr = rc.val;
|
|
59975
|
-
if (clr.type === "none") {
|
|
59976
|
-
const op2 = { kind: ch === "C" ? "fill_color" : "pen_color", color: clr.clr };
|
|
59977
|
-
(ch === "C" ? fns.fill_color : fns.pen_color)?.(op2, 0);
|
|
59978
|
-
return { op: op2, pos: rs.pos };
|
|
59979
|
-
}
|
|
59980
|
-
const op = { kind: ch === "C" ? "grad_fill_color" : "grad_pen_color", gradColor: clr };
|
|
59981
|
-
fns.grad_color?.(op, 0);
|
|
59982
|
-
return { op, pos: rs.pos };
|
|
59983
|
-
}
|
|
59984
|
-
static parseFontOp(s, pos, fns) {
|
|
59985
|
-
const rs = _XdotParser.parseReal(s, pos);
|
|
59986
|
-
if (!rs) return "error";
|
|
59987
|
-
const rn = _XdotParser.parseString(s, rs.pos);
|
|
59988
|
-
if (!rn) return "error";
|
|
59989
|
-
const op = { kind: "font", font: { size: rs.val, name: rn.val } };
|
|
59990
|
-
fns.font?.(op, 0);
|
|
59991
|
-
return { op, pos: rn.pos };
|
|
59992
|
-
}
|
|
59993
|
-
static parseStyleOp(s, pos, fns) {
|
|
59994
|
-
const r = _XdotParser.parseString(s, pos);
|
|
59995
|
-
if (!r) return "error";
|
|
59996
|
-
const op = { kind: "style", style: r.val };
|
|
59997
|
-
fns.style?.(op, 0);
|
|
59998
|
-
return { op, pos: r.pos };
|
|
59999
|
-
}
|
|
60000
|
-
static parseImageOp(s, pos, fns) {
|
|
60001
|
-
const rr = _XdotParser.parseRect(s, pos);
|
|
60002
|
-
if (!rr) return "error";
|
|
60003
|
-
const rn = _XdotParser.parseString(s, rr.pos);
|
|
60004
|
-
if (!rn) return "error";
|
|
60005
|
-
const op = { kind: "image", image: { pos: rr.val, name: rn.val } };
|
|
60006
|
-
fns.image?.(op, 0);
|
|
60007
|
-
return { op, pos: rn.pos };
|
|
60008
|
-
}
|
|
60009
|
-
static parseFontcharOp(s, pos, fns) {
|
|
60010
|
-
const r = _XdotParser.parseUInt_(s, pos);
|
|
60011
|
-
if (!r) return "error";
|
|
60012
|
-
const op = { kind: "fontchar", fontchar: r.val };
|
|
60013
|
-
fns.fontchar?.(op, 0);
|
|
60014
|
-
return { op, pos: r.pos };
|
|
60015
|
-
}
|
|
60016
|
-
static parseShapeOp(ch, s, pos, fns) {
|
|
60017
|
-
if (ch === "E" || ch === "e") return _XdotParser.parseEllipseOp(ch, s, pos, fns);
|
|
60018
|
-
if (ch === "P" || ch === "p") return _XdotParser.parsePolygonOp(ch, s, pos, fns);
|
|
60019
|
-
if (ch === "b" || ch === "B") return _XdotParser.parseBezierOp(ch, s, pos, fns);
|
|
60020
|
-
if (ch === "L") return _XdotParser.parsePolylineOp(s, pos, fns);
|
|
60021
|
-
return null;
|
|
60022
|
-
}
|
|
60023
|
-
static parseMetaOp(ch, s, pos, fns) {
|
|
60024
|
-
if (ch === "T") return _XdotParser.parseTextOp(s, pos, fns);
|
|
60025
|
-
if (ch === "C" || ch === "c") return _XdotParser.parseColorOp(ch, s, pos, fns);
|
|
60026
|
-
if (ch === "F") return _XdotParser.parseFontOp(s, pos, fns);
|
|
60027
|
-
if (ch === "S") return _XdotParser.parseStyleOp(s, pos, fns);
|
|
60028
|
-
if (ch === "I") return _XdotParser.parseImageOp(s, pos, fns);
|
|
60029
|
-
if (ch === "t") return _XdotParser.parseFontcharOp(s, pos, fns);
|
|
60030
|
-
if (ch === "\0") return null;
|
|
60031
|
-
return "error";
|
|
60032
|
-
}
|
|
60033
|
-
static parseOp(s, pos, fns) {
|
|
60034
|
-
pos = _XdotParser.skipWs(s, pos);
|
|
60035
|
-
if (pos >= s.length) return null;
|
|
60036
|
-
const ch = s[pos++];
|
|
60037
|
-
const shape = _XdotParser.parseShapeOp(ch, s, pos, fns);
|
|
60038
|
-
if (shape !== null) return shape;
|
|
60039
|
-
return _XdotParser.parseMetaOp(ch, s, pos, fns);
|
|
60040
|
-
}
|
|
60041
|
-
static parseXDotFOn(s, opFns, _sz, x) {
|
|
60042
|
-
if (!s) return x;
|
|
60043
|
-
const result = x ?? { ops: [], flags: 0 };
|
|
60044
|
-
let pos = 0;
|
|
60045
|
-
while (pos < s.length) {
|
|
60046
|
-
const r = _XdotParser.parseOp(s, pos, opFns);
|
|
60047
|
-
if (r === null) break;
|
|
60048
|
-
if (r === "error") {
|
|
60049
|
-
result.flags |= XDOT_PARSE_ERROR;
|
|
60050
|
-
break;
|
|
60051
|
-
}
|
|
60052
|
-
result.ops.push(r.op);
|
|
60053
|
-
pos = r.pos;
|
|
60054
|
-
}
|
|
60055
|
-
return result.ops.length === 0 ? null : result;
|
|
60056
|
-
}
|
|
60057
|
-
static parseXDotF(s, opFns, sz) {
|
|
60058
|
-
return _XdotParser.parseXDotFOn(s, opFns, sz, null);
|
|
60059
|
-
}
|
|
60060
|
-
static parseXDot(s) {
|
|
60061
|
-
return _XdotParser.parseXDotF(s, {}, 0);
|
|
60062
|
-
}
|
|
60063
|
-
static parseXDotColor(s) {
|
|
60064
|
-
const r = _XdotParser.parseXDotColorAt(s, 0);
|
|
60065
|
-
return r ? r.val : null;
|
|
60066
|
-
}
|
|
60067
|
-
};
|
|
60068
|
-
function parseXDot(s) {
|
|
60069
|
-
return XdotParser.parseXDot(s);
|
|
60070
|
-
}
|
|
60071
|
-
|
|
60072
|
-
// src/xdot/misc.ts
|
|
60073
|
-
var SHAPE_LETTER = {
|
|
60074
|
-
filled_ellipse: "E",
|
|
60075
|
-
unfilled_ellipse: "e",
|
|
60076
|
-
filled_polygon: "P",
|
|
60077
|
-
unfilled_polygon: "p",
|
|
60078
|
-
filled_bezier: "b",
|
|
60079
|
-
unfilled_bezier: "B",
|
|
60080
|
-
polyline: "L"
|
|
60081
|
-
};
|
|
60082
|
-
var SHAPE_KINDS = new Set(Object.keys(SHAPE_LETTER));
|
|
60083
|
-
|
|
60084
60838
|
// src/render/json.ts
|
|
60085
60839
|
var XDOT_ATTR_NAMES = /* @__PURE__ */ new Set([
|
|
60086
60840
|
"_draw_",
|
|
@@ -60165,6 +60919,13 @@ function drawStringToOps(val2, isLatin) {
|
|
|
60165
60919
|
if (parsed === null) return [];
|
|
60166
60920
|
return parsed.ops.map((op) => opToJson(op, isLatin));
|
|
60167
60921
|
}
|
|
60922
|
+
var HeldXdotRenderer = class extends XdotRenderer {
|
|
60923
|
+
writeBack() {
|
|
60924
|
+
}
|
|
60925
|
+
attach(g) {
|
|
60926
|
+
super.writeBack(g);
|
|
60927
|
+
}
|
|
60928
|
+
};
|
|
60168
60929
|
function canonicalRootEdges(g) {
|
|
60169
60930
|
const out = [];
|
|
60170
60931
|
const counter = /* @__PURE__ */ new Map();
|
|
@@ -60195,7 +60956,7 @@ function applyDraws(attrs, d) {
|
|
|
60195
60956
|
}
|
|
60196
60957
|
function collectDrawLookup(g) {
|
|
60197
60958
|
let xg;
|
|
60198
|
-
const xr = new
|
|
60959
|
+
const xr = new HeldXdotRenderer();
|
|
60199
60960
|
try {
|
|
60200
60961
|
const ctx = createDefaultContext();
|
|
60201
60962
|
ctx.register(xr);
|
|
@@ -60232,7 +60993,7 @@ function collectDrawLookup(g) {
|
|
|
60232
60993
|
for (const [nm, gn] of g.nodes) applyDraws(node.get(nm), draws.get(gn));
|
|
60233
60994
|
for (const [gc, attrs] of cluster) applyDraws(attrs, draws.get(gc));
|
|
60234
60995
|
for (const [ge, attrs] of edge) applyDraws(attrs, draws.get(ge));
|
|
60235
|
-
return { graph: graphAttrs, node, cluster, edge };
|
|
60996
|
+
return { graph: graphAttrs, node, cluster, edge, attach: () => xr.attach(g) };
|
|
60236
60997
|
}
|
|
60237
60998
|
function isGraphLabelDeclared(g) {
|
|
60238
60999
|
if (g.attrs.has("label")) return true;
|
|
@@ -60242,7 +61003,7 @@ function isGraphLabelDeclared(g) {
|
|
|
60242
61003
|
return false;
|
|
60243
61004
|
}
|
|
60244
61005
|
function graphEffectiveAttrs(g, top) {
|
|
60245
|
-
if (top) return g
|
|
61006
|
+
if (top) return attrsWithoutLayoutBb(g);
|
|
60246
61007
|
const m = new Map(g.graphDefaultsSnapshot ?? []);
|
|
60247
61008
|
for (const [k, v] of g.attrs) m.set(k, v);
|
|
60248
61009
|
return m;
|
|
@@ -60450,15 +61211,9 @@ function buildJson(g, doXDot, preDraws) {
|
|
|
60450
61211
|
const root = buildGraphObject(g, true, ctx);
|
|
60451
61212
|
return JSON.stringify(root, null, 2) + "\n";
|
|
60452
61213
|
}
|
|
60453
|
-
var
|
|
60454
|
-
type = "json0";
|
|
61214
|
+
var JsonRendererBase = class {
|
|
60455
61215
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
60456
61216
|
quality = 0;
|
|
60457
|
-
beginGraph(_g, _job) {
|
|
60458
|
-
}
|
|
60459
|
-
endGraph(g, job) {
|
|
60460
|
-
job.write(buildJson(g, false));
|
|
60461
|
-
}
|
|
60462
61217
|
beginNode(_n, _job) {
|
|
60463
61218
|
}
|
|
60464
61219
|
endNode(_n, _job) {
|
|
@@ -60478,10 +61233,18 @@ var Json0Renderer = class {
|
|
|
60478
61233
|
polyline(_pts, _job) {
|
|
60479
61234
|
}
|
|
60480
61235
|
};
|
|
60481
|
-
var
|
|
61236
|
+
var Json0Renderer = class extends JsonRendererBase {
|
|
61237
|
+
type = "json0";
|
|
61238
|
+
beginGraph(_g, _job) {
|
|
61239
|
+
}
|
|
61240
|
+
/** C's json_begin_graph runs attach_attrs; buildJson overlays the same values. */
|
|
61241
|
+
endGraph(g, job) {
|
|
61242
|
+
job.write(buildJson(g, false));
|
|
61243
|
+
attachAttrs(g);
|
|
61244
|
+
}
|
|
61245
|
+
};
|
|
61246
|
+
var JsonRenderer = class extends JsonRendererBase {
|
|
60482
61247
|
type = "json";
|
|
60483
|
-
/** @see plugin/core/gvplugin_core.c registration table */
|
|
60484
|
-
quality = 0;
|
|
60485
61248
|
draws;
|
|
60486
61249
|
// set by beginGraph, cleared by endGraph
|
|
60487
61250
|
/** @see plugin/core/gvrender_core_json.c:json_begin_graph */
|
|
@@ -60490,26 +61253,9 @@ var JsonRenderer = class {
|
|
|
60490
61253
|
}
|
|
60491
61254
|
endGraph(g, job) {
|
|
60492
61255
|
job.write(buildJson(g, true, this.draws));
|
|
61256
|
+
this.draws?.attach();
|
|
60493
61257
|
this.draws = void 0;
|
|
60494
61258
|
}
|
|
60495
|
-
beginNode(_n, _job) {
|
|
60496
|
-
}
|
|
60497
|
-
endNode(_n, _job) {
|
|
60498
|
-
}
|
|
60499
|
-
beginEdge(_e, _job) {
|
|
60500
|
-
}
|
|
60501
|
-
endEdge(_e, _job) {
|
|
60502
|
-
}
|
|
60503
|
-
textspan(_pos, _span, _job) {
|
|
60504
|
-
}
|
|
60505
|
-
ellipse(_c, _rx, _ry, _f, _j) {
|
|
60506
|
-
}
|
|
60507
|
-
polygon(_pts, _filled, _job) {
|
|
60508
|
-
}
|
|
60509
|
-
bezier(_pts, _filled, _job) {
|
|
60510
|
-
}
|
|
60511
|
-
polyline(_pts, _job) {
|
|
60512
|
-
}
|
|
60513
61259
|
};
|
|
60514
61260
|
function createJson0Renderer() {
|
|
60515
61261
|
return new Json0Renderer();
|