@knowvah/dot-engine 0.1.0
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/LICENSE +277 -0
- package/README.md +292 -0
- package/dist/api/builder.d.ts +78 -0
- package/dist/api/builder.d.ts.map +1 -0
- package/dist/api/edge-ops.d.ts +45 -0
- package/dist/api/edge-ops.d.ts.map +1 -0
- package/dist/api/geometry.d.ts +159 -0
- package/dist/api/geometry.d.ts.map +1 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api.js +719 -0
- package/dist/api.js.map +7 -0
- package/dist/bundle.js +101 -0
- package/dist/cdt/bag.d.ts +58 -0
- package/dist/cdt/bag.d.ts.map +1 -0
- package/dist/cdt/hash-core.d.ts +40 -0
- package/dist/cdt/hash-core.d.ts.map +1 -0
- package/dist/cdt/hash.d.ts +74 -0
- package/dist/cdt/hash.d.ts.map +1 -0
- package/dist/cdt/index.d.ts +16 -0
- package/dist/cdt/index.d.ts.map +1 -0
- package/dist/cdt/splay-core.d.ts +78 -0
- package/dist/cdt/splay-core.d.ts.map +1 -0
- package/dist/cdt/splay.d.ts +63 -0
- package/dist/cdt/splay.d.ts.map +1 -0
- package/dist/cdt/strhash.d.ts +26 -0
- package/dist/cdt/strhash.d.ts.map +1 -0
- package/dist/cdt/types.d.ts +11 -0
- package/dist/cdt/types.d.ts.map +1 -0
- package/dist/common/arith.d.ts +35 -0
- package/dist/common/arith.d.ts.map +1 -0
- package/dist/common/arm-pow-data.d.ts +17 -0
- package/dist/common/arm-pow-data.d.ts.map +1 -0
- package/dist/common/arm-pow.d.ts +12 -0
- package/dist/common/arm-pow.d.ts.map +1 -0
- package/dist/common/arrows-constants.d.ts +97 -0
- package/dist/common/arrows-constants.d.ts.map +1 -0
- package/dist/common/arrows-geometry.d.ts +24 -0
- package/dist/common/arrows-geometry.d.ts.map +1 -0
- package/dist/common/arrows-miter.d.ts +24 -0
- package/dist/common/arrows-miter.d.ts.map +1 -0
- package/dist/common/arrows-shapes-poly.d.ts +24 -0
- package/dist/common/arrows-shapes-poly.d.ts.map +1 -0
- package/dist/common/arrows-shapes-util.d.ts +77 -0
- package/dist/common/arrows-shapes-util.d.ts.map +1 -0
- package/dist/common/arrows-shapes.d.ts +48 -0
- package/dist/common/arrows-shapes.d.ts.map +1 -0
- package/dist/common/arrows-types.d.ts +59 -0
- package/dist/common/arrows-types.d.ts.map +1 -0
- package/dist/common/arrows.d.ts +69 -0
- package/dist/common/arrows.d.ts.map +1 -0
- package/dist/common/color.d.ts +66 -0
- package/dist/common/color.d.ts.map +1 -0
- package/dist/common/colorData.d.ts +10 -0
- package/dist/common/colorData.d.ts.map +1 -0
- package/dist/common/compass-port.d.ts +39 -0
- package/dist/common/compass-port.d.ts.map +1 -0
- package/dist/common/crand.d.ts +42 -0
- package/dist/common/crand.d.ts.map +1 -0
- package/dist/common/edge-label-init.d.ts +51 -0
- package/dist/common/edge-label-init.d.ts.map +1 -0
- package/dist/common/edge-offset.d.ts +66 -0
- package/dist/common/edge-offset.d.ts.map +1 -0
- package/dist/common/ellipse-wedge.d.ts +10 -0
- package/dist/common/ellipse-wedge.d.ts.map +1 -0
- package/dist/common/emit-types.d.ts +255 -0
- package/dist/common/emit-types.d.ts.map +1 -0
- package/dist/common/fma.d.ts +10 -0
- package/dist/common/fma.d.ts.map +1 -0
- package/dist/common/graph-init.d.ts +61 -0
- package/dist/common/graph-init.d.ts.map +1 -0
- package/dist/common/html-entities.d.ts +17 -0
- package/dist/common/html-entities.d.ts.map +1 -0
- package/dist/common/html-string.d.ts +14 -0
- package/dist/common/html-string.d.ts.map +1 -0
- package/dist/common/htmltable-emit-fill.d.ts +84 -0
- package/dist/common/htmltable-emit-fill.d.ts.map +1 -0
- package/dist/common/htmltable-emit-rules.d.ts +79 -0
- package/dist/common/htmltable-emit-rules.d.ts.map +1 -0
- package/dist/common/htmltable-emit.d.ts +63 -0
- package/dist/common/htmltable-emit.d.ts.map +1 -0
- package/dist/common/htmltable-lex.d.ts +16 -0
- package/dist/common/htmltable-lex.d.ts.map +1 -0
- package/dist/common/htmltable-parse.d.ts +37 -0
- package/dist/common/htmltable-parse.d.ts.map +1 -0
- package/dist/common/htmltable-port.d.ts +15 -0
- package/dist/common/htmltable-port.d.ts.map +1 -0
- package/dist/common/htmltable-pos-runs.d.ts +88 -0
- package/dist/common/htmltable-pos-runs.d.ts.map +1 -0
- package/dist/common/htmltable-pos.d.ts +192 -0
- package/dist/common/htmltable-pos.d.ts.map +1 -0
- package/dist/common/htmltable-types.d.ts +237 -0
- package/dist/common/htmltable-types.d.ts.map +1 -0
- package/dist/common/htmltable.d.ts +74 -0
- package/dist/common/htmltable.d.ts.map +1 -0
- package/dist/common/layers.d.ts +20 -0
- package/dist/common/layers.d.ts.map +1 -0
- package/dist/common/make-label.d.ts +60 -0
- package/dist/common/make-label.d.ts.map +1 -0
- package/dist/common/multicolor.d.ts +46 -0
- package/dist/common/multicolor.d.ts.map +1 -0
- package/dist/common/nodeinit.d.ts +45 -0
- package/dist/common/nodeinit.d.ts.map +1 -0
- package/dist/common/poly-gencode.d.ts +40 -0
- package/dist/common/poly-gencode.d.ts.map +1 -0
- package/dist/common/poly-init.d.ts +51 -0
- package/dist/common/poly-init.d.ts.map +1 -0
- package/dist/common/poly-inside.d.ts +37 -0
- package/dist/common/poly-inside.d.ts.map +1 -0
- package/dist/common/poly-shapes-cases.d.ts +31 -0
- package/dist/common/poly-shapes-cases.d.ts.map +1 -0
- package/dist/common/poly-shapes-cases2.d.ts +25 -0
- package/dist/common/poly-shapes-cases2.d.ts.map +1 -0
- package/dist/common/poly-shapes-util.d.ts +42 -0
- package/dist/common/poly-shapes-util.d.ts.map +1 -0
- package/dist/common/poly-shapes.d.ts +39 -0
- package/dist/common/poly-shapes.d.ts.map +1 -0
- package/dist/common/poly-sizing.d.ts +189 -0
- package/dist/common/poly-sizing.d.ts.map +1 -0
- package/dist/common/poly-vertices.d.ts +42 -0
- package/dist/common/poly-vertices.d.ts.map +1 -0
- package/dist/common/postproc.d.ts +49 -0
- package/dist/common/postproc.d.ts.map +1 -0
- package/dist/common/ps-fontalias.d.ts +36 -0
- package/dist/common/ps-fontalias.d.ts.map +1 -0
- package/dist/common/random.d.ts +8 -0
- package/dist/common/random.d.ts.map +1 -0
- package/dist/common/record-port.d.ts +34 -0
- package/dist/common/record-port.d.ts.map +1 -0
- package/dist/common/record.d.ts +105 -0
- package/dist/common/record.d.ts.map +1 -0
- package/dist/common/shapeData.d.ts +186 -0
- package/dist/common/shapeData.d.ts.map +1 -0
- package/dist/common/shapes.d.ts +36 -0
- package/dist/common/shapes.d.ts.map +1 -0
- package/dist/common/spline-midpoint.d.ts +31 -0
- package/dist/common/spline-midpoint.d.ts.map +1 -0
- package/dist/common/splines-clip.d.ts +21 -0
- package/dist/common/splines-clip.d.ts.map +1 -0
- package/dist/common/splines-constants.d.ts +42 -0
- package/dist/common/splines-constants.d.ts.map +1 -0
- package/dist/common/splines-geom.d.ts +51 -0
- package/dist/common/splines-geom.d.ts.map +1 -0
- package/dist/common/splines-path-begin.d.ts +17 -0
- package/dist/common/splines-path-begin.d.ts.map +1 -0
- package/dist/common/splines-path-end.d.ts +17 -0
- package/dist/common/splines-path-end.d.ts.map +1 -0
- package/dist/common/splines-path-shared.d.ts +53 -0
- package/dist/common/splines-path-shared.d.ts.map +1 -0
- package/dist/common/splines-routespl.d.ts +40 -0
- package/dist/common/splines-routespl.d.ts.map +1 -0
- package/dist/common/splines-selfedge.d.ts +21 -0
- package/dist/common/splines-selfedge.d.ts.map +1 -0
- package/dist/common/splines.d.ts +18 -0
- package/dist/common/splines.d.ts.map +1 -0
- package/dist/common/style-resolve.d.ts +197 -0
- package/dist/common/style-resolve.d.ts.map +1 -0
- package/dist/common/subst.d.ts +31 -0
- package/dist/common/subst.d.ts.map +1 -0
- package/dist/common/taper.d.ts +23 -0
- package/dist/common/taper.d.ts.map +1 -0
- package/dist/common/textmeasure-factory.d.ts +33 -0
- package/dist/common/textmeasure-factory.d.ts.map +1 -0
- package/dist/common/textmeasure-lookup.d.ts +17 -0
- package/dist/common/textmeasure-lookup.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-a.d.ts +13 -0
- package/dist/common/textmeasure-lut-data-a.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-b.d.ts +12 -0
- package/dist/common/textmeasure-lut-data-b.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-c.d.ts +13 -0
- package/dist/common/textmeasure-lut-data-c.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data.d.ts +27 -0
- package/dist/common/textmeasure-lut-data.d.ts.map +1 -0
- package/dist/common/textmeasure.d.ts +120 -0
- package/dist/common/textmeasure.d.ts.map +1 -0
- package/dist/common/types.d.ts +316 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/xlabels-place.d.ts +125 -0
- package/dist/common/xlabels-place.d.ts.map +1 -0
- package/dist/debug.d.ts +58 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/errors.d.ts +63 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/gvc/anchor.d.ts +86 -0
- package/dist/gvc/anchor.d.ts.map +1 -0
- package/dist/gvc/context.d.ts +177 -0
- package/dist/gvc/context.d.ts.map +1 -0
- package/dist/gvc/default-context.d.ts +20 -0
- package/dist/gvc/default-context.d.ts.map +1 -0
- package/dist/gvc/device-cluster.d.ts +25 -0
- package/dist/gvc/device-cluster.d.ts.map +1 -0
- package/dist/gvc/device.d.ts +99 -0
- package/dist/gvc/device.d.ts.map +1 -0
- package/dist/gvc/edge-labels.d.ts +10 -0
- package/dist/gvc/edge-labels.d.ts.map +1 -0
- package/dist/gvc/emit-walk.d.ts +22 -0
- package/dist/gvc/emit-walk.d.ts.map +1 -0
- package/dist/gvc/image-resolver.d.ts +44 -0
- package/dist/gvc/image-resolver.d.ts.map +1 -0
- package/dist/gvc/job.d.ts +234 -0
- package/dist/gvc/job.d.ts.map +1 -0
- package/dist/gvc/textlayout.d.ts +33 -0
- package/dist/gvc/textlayout.d.ts.map +1 -0
- package/dist/gvc/textspan-emit.d.ts +41 -0
- package/dist/gvc/textspan-emit.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +25 -0
- package/dist/gvc/usershape.d.ts.map +1 -0
- package/dist/gvc/viewport.d.ts +71 -0
- package/dist/gvc/viewport.d.ts.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52862 -0
- package/dist/index.js.map +7 -0
- package/dist/label/index.d.ts +74 -0
- package/dist/label/index.d.ts.map +1 -0
- package/dist/label/node.d.ts +108 -0
- package/dist/label/node.d.ts.map +1 -0
- package/dist/label/rectangle.d.ts +60 -0
- package/dist/label/rectangle.d.ts.map +1 -0
- package/dist/label/split-q.d.ts +13 -0
- package/dist/label/split-q.d.ts.map +1 -0
- package/dist/label/xlabels-geom.d.ts +46 -0
- package/dist/label/xlabels-geom.d.ts.map +1 -0
- package/dist/label/xlabels-intersect.d.ts +79 -0
- package/dist/label/xlabels-intersect.d.ts.map +1 -0
- package/dist/label/xlabels.d.ts +67 -0
- package/dist/label/xlabels.d.ts.map +1 -0
- package/dist/layout/circo/blockpath.d.ts +120 -0
- package/dist/layout/circo/blockpath.d.ts.map +1 -0
- package/dist/layout/circo/blocks.d.ts +135 -0
- package/dist/layout/circo/blocks.d.ts.map +1 -0
- package/dist/layout/circo/blocktree.d.ts +51 -0
- package/dist/layout/circo/blocktree.d.ts.map +1 -0
- package/dist/layout/circo/circular.d.ts +59 -0
- package/dist/layout/circo/circular.d.ts.map +1 -0
- package/dist/layout/circo/index.d.ts +35 -0
- package/dist/layout/circo/index.d.ts.map +1 -0
- package/dist/layout/circo/init.d.ts +50 -0
- package/dist/layout/circo/init.d.ts.map +1 -0
- package/dist/layout/circo/position-helpers.d.ts +33 -0
- package/dist/layout/circo/position-helpers.d.ts.map +1 -0
- package/dist/layout/circo/position.d.ts +66 -0
- package/dist/layout/circo/position.d.ts.map +1 -0
- package/dist/layout/dot/acyclic.d.ts +8 -0
- package/dist/layout/dot/acyclic.d.ts.map +1 -0
- package/dist/layout/dot/aspect.d.ts +17 -0
- package/dist/layout/dot/aspect.d.ts.map +1 -0
- package/dist/layout/dot/classify.d.ts +52 -0
- package/dist/layout/dot/classify.d.ts.map +1 -0
- package/dist/layout/dot/cluster-path.d.ts +38 -0
- package/dist/layout/dot/cluster-path.d.ts.map +1 -0
- package/dist/layout/dot/cluster.d.ts +102 -0
- package/dist/layout/dot/cluster.d.ts.map +1 -0
- package/dist/layout/dot/compound-clip.d.ts +69 -0
- package/dist/layout/dot/compound-clip.d.ts.map +1 -0
- package/dist/layout/dot/compound-geom.d.ts +115 -0
- package/dist/layout/dot/compound-geom.d.ts.map +1 -0
- package/dist/layout/dot/compound.d.ts +56 -0
- package/dist/layout/dot/compound.d.ts.map +1 -0
- package/dist/layout/dot/conc.d.ts +88 -0
- package/dist/layout/dot/conc.d.ts.map +1 -0
- package/dist/layout/dot/decomp.d.ts +66 -0
- package/dist/layout/dot/decomp.d.ts.map +1 -0
- package/dist/layout/dot/edge-order.d.ts +27 -0
- package/dist/layout/dot/edge-order.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-arrow.d.ts +46 -0
- package/dist/layout/dot/edge-route-arrow.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-boxes.d.ts +75 -0
- package/dist/layout/dot/edge-route-boxes.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-chain.d.ts +67 -0
- package/dist/layout/dot/edge-route-chain.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-clip.d.ts +88 -0
- package/dist/layout/dot/edge-route-clip.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-faithful.d.ts +94 -0
- package/dist/layout/dot/edge-route-faithful.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-geom.d.ts +43 -0
- package/dist/layout/dot/edge-route-geom.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-helpers.d.ts +50 -0
- package/dist/layout/dot/edge-route-helpers.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-poly.d.ts +48 -0
- package/dist/layout/dot/edge-route-poly.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-rank.d.ts +57 -0
- package/dist/layout/dot/edge-route-rank.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-routing.d.ts +99 -0
- package/dist/layout/dot/edge-route-routing.d.ts.map +1 -0
- package/dist/layout/dot/edge-route.d.ts +57 -0
- package/dist/layout/dot/edge-route.d.ts.map +1 -0
- package/dist/layout/dot/fastgr.d.ts +147 -0
- package/dist/layout/dot/fastgr.d.ts.map +1 -0
- package/dist/layout/dot/flat-utils.d.ts +21 -0
- package/dist/layout/dot/flat-utils.d.ts.map +1 -0
- package/dist/layout/dot/flat.d.ts +152 -0
- package/dist/layout/dot/flat.d.ts.map +1 -0
- package/dist/layout/dot/graph-label.d.ts +18 -0
- package/dist/layout/dot/graph-label.d.ts.map +1 -0
- package/dist/layout/dot/index.d.ts +128 -0
- package/dist/layout/dot/index.d.ts.map +1 -0
- package/dist/layout/dot/init.d.ts +93 -0
- package/dist/layout/dot/init.d.ts.map +1 -0
- package/dist/layout/dot/label-order.d.ts +45 -0
- package/dist/layout/dot/label-order.d.ts.map +1 -0
- package/dist/layout/dot/mincross-build.d.ts +52 -0
- package/dist/layout/dot/mincross-build.d.ts.map +1 -0
- package/dist/layout/dot/mincross-cross.d.ts +80 -0
- package/dist/layout/dot/mincross-cross.d.ts.map +1 -0
- package/dist/layout/dot/mincross-flat.d.ts +27 -0
- package/dist/layout/dot/mincross-flat.d.ts.map +1 -0
- package/dist/layout/dot/mincross-order.d.ts +89 -0
- package/dist/layout/dot/mincross-order.d.ts.map +1 -0
- package/dist/layout/dot/mincross-utils.d.ts +60 -0
- package/dist/layout/dot/mincross-utils.d.ts.map +1 -0
- package/dist/layout/dot/mincross.d.ts +75 -0
- package/dist/layout/dot/mincross.d.ts.map +1 -0
- package/dist/layout/dot/ns-core.d.ts +37 -0
- package/dist/layout/dot/ns-core.d.ts.map +1 -0
- package/dist/layout/dot/ns-range.d.ts +17 -0
- package/dist/layout/dot/ns-range.d.ts.map +1 -0
- package/dist/layout/dot/ns-subtree.d.ts +78 -0
- package/dist/layout/dot/ns-subtree.d.ts.map +1 -0
- package/dist/layout/dot/ns.d.ts +86 -0
- package/dist/layout/dot/ns.d.ts.map +1 -0
- package/dist/layout/dot/ortho-adapter.d.ts +19 -0
- package/dist/layout/dot/ortho-adapter.d.ts.map +1 -0
- package/dist/layout/dot/pack-components.d.ts +100 -0
- package/dist/layout/dot/pack-components.d.ts.map +1 -0
- package/dist/layout/dot/position-aux.d.ts +110 -0
- package/dist/layout/dot/position-aux.d.ts.map +1 -0
- package/dist/layout/dot/position-bbox.d.ts +57 -0
- package/dist/layout/dot/position-bbox.d.ts.map +1 -0
- package/dist/layout/dot/position-cluster.d.ts +48 -0
- package/dist/layout/dot/position-cluster.d.ts.map +1 -0
- package/dist/layout/dot/position-ycoords.d.ts +42 -0
- package/dist/layout/dot/position-ycoords.d.ts.map +1 -0
- package/dist/layout/dot/position.d.ts +47 -0
- package/dist/layout/dot/position.d.ts.map +1 -0
- package/dist/layout/dot/rank-dot2.d.ts +114 -0
- package/dist/layout/dot/rank-dot2.d.ts.map +1 -0
- package/dist/layout/dot/rank.d.ts +119 -0
- package/dist/layout/dot/rank.d.ts.map +1 -0
- package/dist/layout/dot/sameport.d.ts +70 -0
- package/dist/layout/dot/sameport.d.ts.map +1 -0
- package/dist/layout/dot/self-loop.d.ts +54 -0
- package/dist/layout/dot/self-loop.d.ts.map +1 -0
- package/dist/layout/dot/splines-clone.d.ts +33 -0
- package/dist/layout/dot/splines-clone.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat-labeled.d.ts +101 -0
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat-multi.d.ts +35 -0
- package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat.d.ts +116 -0
- package/dist/layout/dot/splines-flat.d.ts.map +1 -0
- package/dist/layout/dot/splines-groups.d.ts +38 -0
- package/dist/layout/dot/splines-groups.d.ts.map +1 -0
- package/dist/layout/dot/splines-label.d.ts +105 -0
- package/dist/layout/dot/splines-label.d.ts.map +1 -0
- package/dist/layout/dot/splines-route-type.d.ts +28 -0
- package/dist/layout/dot/splines-route-type.d.ts.map +1 -0
- package/dist/layout/dot/splines-route.d.ts +99 -0
- package/dist/layout/dot/splines-route.d.ts.map +1 -0
- package/dist/layout/dot/splines.d.ts +157 -0
- package/dist/layout/dot/splines.d.ts.map +1 -0
- package/dist/layout/dot/straight-edges.d.ts +39 -0
- package/dist/layout/dot/straight-edges.d.ts.map +1 -0
- package/dist/layout/fdp/cluster-edges.d.ts +31 -0
- package/dist/layout/fdp/cluster-edges.d.ts.map +1 -0
- package/dist/layout/fdp/comp.d.ts +29 -0
- package/dist/layout/fdp/comp.d.ts.map +1 -0
- package/dist/layout/fdp/derive.d.ts +39 -0
- package/dist/layout/fdp/derive.d.ts.map +1 -0
- package/dist/layout/fdp/fdp-model.d.ts +101 -0
- package/dist/layout/fdp/fdp-model.d.ts.map +1 -0
- package/dist/layout/fdp/grid.d.ts +49 -0
- package/dist/layout/fdp/grid.d.ts.map +1 -0
- package/dist/layout/fdp/index.d.ts +36 -0
- package/dist/layout/fdp/index.d.ts.map +1 -0
- package/dist/layout/fdp/init.d.ts +26 -0
- package/dist/layout/fdp/init.d.ts.map +1 -0
- package/dist/layout/fdp/layout.d.ts +57 -0
- package/dist/layout/fdp/layout.d.ts.map +1 -0
- package/dist/layout/fdp/normalize.d.ts +18 -0
- package/dist/layout/fdp/normalize.d.ts.map +1 -0
- package/dist/layout/fdp/ports.d.ts +41 -0
- package/dist/layout/fdp/ports.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout-init.d.ts +21 -0
- package/dist/layout/fdp/tlayout-init.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout-parms.d.ts +98 -0
- package/dist/layout/fdp/tlayout-parms.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout.d.ts +43 -0
- package/dist/layout/fdp/tlayout.d.ts.map +1 -0
- package/dist/layout/fdp/xlayout.d.ts +26 -0
- package/dist/layout/fdp/xlayout.d.ts.map +1 -0
- package/dist/layout/neato/bfs.d.ts +43 -0
- package/dist/layout/neato/bfs.d.ts.map +1 -0
- package/dist/layout/neato/cdt-surface.d.ts +16 -0
- package/dist/layout/neato/cdt-surface.d.ts.map +1 -0
- package/dist/layout/neato/conjgrad.d.ts +61 -0
- package/dist/layout/neato/conjgrad.d.ts.map +1 -0
- package/dist/layout/neato/delaunay.d.ts +28 -0
- package/dist/layout/neato/delaunay.d.ts.map +1 -0
- package/dist/layout/neato/dijkstra.d.ts +80 -0
- package/dist/layout/neato/dijkstra.d.ts.map +1 -0
- package/dist/layout/neato/fdp-adjust.d.ts +31 -0
- package/dist/layout/neato/fdp-adjust.d.ts.map +1 -0
- package/dist/layout/neato/index.d.ts +58 -0
- package/dist/layout/neato/index.d.ts.map +1 -0
- package/dist/layout/neato/init.d.ts +207 -0
- package/dist/layout/neato/init.d.ts.map +1 -0
- package/dist/layout/neato/legal.d.ts +7 -0
- package/dist/layout/neato/legal.d.ts.map +1 -0
- package/dist/layout/neato/matrix-ops.d.ts +28 -0
- package/dist/layout/neato/matrix-ops.d.ts.map +1 -0
- package/dist/layout/neato/multispline-router.d.ts +80 -0
- package/dist/layout/neato/multispline-router.d.ts.map +1 -0
- package/dist/layout/neato/multispline.d.ts +24 -0
- package/dist/layout/neato/multispline.d.ts.map +1 -0
- package/dist/layout/neato/overlap-prism.d.ts +26 -0
- package/dist/layout/neato/overlap-prism.d.ts.map +1 -0
- package/dist/layout/neato/overlap.d.ts +85 -0
- package/dist/layout/neato/overlap.d.ts.map +1 -0
- package/dist/layout/neato/sc-adjust.d.ts +33 -0
- package/dist/layout/neato/sc-adjust.d.ts.map +1 -0
- package/dist/layout/neato/sep-factor.d.ts +41 -0
- package/dist/layout/neato/sep-factor.d.ts.map +1 -0
- package/dist/layout/neato/set-aspect.d.ts +33 -0
- package/dist/layout/neato/set-aspect.d.ts.map +1 -0
- package/dist/layout/neato/sgd.d.ts +166 -0
- package/dist/layout/neato/sgd.d.ts.map +1 -0
- package/dist/layout/neato/splines.d.ts +153 -0
- package/dist/layout/neato/splines.d.ts.map +1 -0
- package/dist/layout/neato/stress-kernel.d.ts +53 -0
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -0
- package/dist/layout/neato/stress.d.ts +158 -0
- package/dist/layout/neato/stress.d.ts.map +1 -0
- package/dist/layout/osage/index.d.ts +158 -0
- package/dist/layout/osage/index.d.ts.map +1 -0
- package/dist/layout/osage/layout.d.ts +49 -0
- package/dist/layout/osage/layout.d.ts.map +1 -0
- package/dist/layout/osage/types.d.ts +28 -0
- package/dist/layout/osage/types.d.ts.map +1 -0
- package/dist/layout/pack/array-pack.d.ts +114 -0
- package/dist/layout/pack/array-pack.d.ts.map +1 -0
- package/dist/layout/pack/index.d.ts +157 -0
- package/dist/layout/pack/index.d.ts.map +1 -0
- package/dist/layout/pack/poly-pack.d.ts +126 -0
- package/dist/layout/pack/poly-pack.d.ts.map +1 -0
- package/dist/layout/pack/poly-place.d.ts +27 -0
- package/dist/layout/pack/poly-place.d.ts.map +1 -0
- package/dist/layout/pack/spiral-search.d.ts +18 -0
- package/dist/layout/pack/spiral-search.d.ts.map +1 -0
- package/dist/layout/pack/test-helpers.d.ts +7 -0
- package/dist/layout/pack/test-helpers.d.ts.map +1 -0
- package/dist/layout/pack/types.d.ts +74 -0
- package/dist/layout/pack/types.d.ts.map +1 -0
- package/dist/layout/patchwork/index.d.ts +136 -0
- package/dist/layout/patchwork/index.d.ts.map +1 -0
- package/dist/layout/patchwork/tree-map.d.ts +32 -0
- package/dist/layout/patchwork/tree-map.d.ts.map +1 -0
- package/dist/layout/patchwork/tree-node.d.ts +46 -0
- package/dist/layout/patchwork/tree-node.d.ts.map +1 -0
- package/dist/layout/sfdp/index.d.ts +39 -0
- package/dist/layout/sfdp/index.d.ts.map +1 -0
- package/dist/layout/sfdp/init.d.ts +61 -0
- package/dist/layout/sfdp/init.d.ts.map +1 -0
- package/dist/layout/sfdp/multilevel.d.ts +23 -0
- package/dist/layout/sfdp/multilevel.d.ts.map +1 -0
- package/dist/layout/sfdp/quadtree.d.ts +45 -0
- package/dist/layout/sfdp/quadtree.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-matrix-multiply.d.ts +34 -0
- package/dist/layout/sfdp/sparse-matrix-multiply.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-matrix.d.ts +101 -0
- package/dist/layout/sfdp/sparse-matrix.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-solve.d.ts +14 -0
- package/dist/layout/sfdp/sparse-solve.d.ts.map +1 -0
- package/dist/layout/sfdp/spring-driver.d.ts +18 -0
- package/dist/layout/sfdp/spring-driver.d.ts.map +1 -0
- package/dist/layout/sfdp/spring-electrical.d.ts +61 -0
- package/dist/layout/sfdp/spring-electrical.d.ts.map +1 -0
- package/dist/layout/twopi/circle.d.ts +83 -0
- package/dist/layout/twopi/circle.d.ts.map +1 -0
- package/dist/layout/twopi/index.d.ts +24 -0
- package/dist/layout/twopi/index.d.ts.map +1 -0
- package/dist/layout/twopi/init.d.ts +85 -0
- package/dist/layout/twopi/init.d.ts.map +1 -0
- package/dist/layout/twopi/pipeline.d.ts +37 -0
- package/dist/layout/twopi/pipeline.d.ts.map +1 -0
- package/dist/layout/twopi/twopi-test-helpers.d.ts +12 -0
- package/dist/layout/twopi/twopi-test-helpers.d.ts.map +1 -0
- package/dist/model/algData.d.ts +175 -0
- package/dist/model/algData.d.ts.map +1 -0
- package/dist/model/cgraph-ops.d.ts +86 -0
- package/dist/model/cgraph-ops.d.ts.map +1 -0
- package/dist/model/edge.d.ts +80 -0
- package/dist/model/edge.d.ts.map +1 -0
- package/dist/model/edgeInfo.d.ts +299 -0
- package/dist/model/edgeInfo.d.ts.map +1 -0
- package/dist/model/geom.d.ts +149 -0
- package/dist/model/geom.d.ts.map +1 -0
- package/dist/model/graph.d.ts +135 -0
- package/dist/model/graph.d.ts.map +1 -0
- package/dist/model/graphInfo.d.ts +418 -0
- package/dist/model/graphInfo.d.ts.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/layoutParams.d.ts +85 -0
- package/dist/model/layoutParams.d.ts.map +1 -0
- package/dist/model/node.d.ts +101 -0
- package/dist/model/node.d.ts.map +1 -0
- package/dist/model/nodeInfo.d.ts +278 -0
- package/dist/model/nodeInfo.d.ts.map +1 -0
- package/dist/model/rankEntry.d.ts +80 -0
- package/dist/model/rankEntry.d.ts.map +1 -0
- package/dist/ortho/chan-dict.d.ts +82 -0
- package/dist/ortho/chan-dict.d.ts.map +1 -0
- package/dist/ortho/fpq.d.ts +54 -0
- package/dist/ortho/fpq.d.ts.map +1 -0
- package/dist/ortho/index.d.ts +35 -0
- package/dist/ortho/index.d.ts.map +1 -0
- package/dist/ortho/maze-channels.d.ts +47 -0
- package/dist/ortho/maze-channels.d.ts.map +1 -0
- package/dist/ortho/maze.d.ts +27 -0
- package/dist/ortho/maze.d.ts.map +1 -0
- package/dist/ortho/ortho-parallel.d.ts +26 -0
- package/dist/ortho/ortho-parallel.d.ts.map +1 -0
- package/dist/ortho/ortho-route.d.ts +31 -0
- package/dist/ortho/ortho-route.d.ts.map +1 -0
- package/dist/ortho/partition.d.ts +34 -0
- package/dist/ortho/partition.d.ts.map +1 -0
- package/dist/ortho/rawgraph.d.ts +41 -0
- package/dist/ortho/rawgraph.d.ts.map +1 -0
- package/dist/ortho/sgraph.d.ts +74 -0
- package/dist/ortho/sgraph.d.ts.map +1 -0
- package/dist/ortho/trap-query.d.ts +32 -0
- package/dist/ortho/trap-query.d.ts.map +1 -0
- package/dist/ortho/trap-segment.d.ts +23 -0
- package/dist/ortho/trap-segment.d.ts.map +1 -0
- package/dist/ortho/trap-types.d.ts +91 -0
- package/dist/ortho/trap-types.d.ts.map +1 -0
- package/dist/ortho/trap-update.d.ts +12 -0
- package/dist/ortho/trap-update.d.ts.map +1 -0
- package/dist/ortho/trapezoid.d.ts +18 -0
- package/dist/ortho/trapezoid.d.ts.map +1 -0
- package/dist/ortho/types.d.ts +241 -0
- package/dist/ortho/types.d.ts.map +1 -0
- package/dist/parser/ast.d.ts +49 -0
- package/dist/parser/ast.d.ts.map +1 -0
- package/dist/parser/builder.d.ts +75 -0
- package/dist/parser/builder.d.ts.map +1 -0
- package/dist/parser/index.d.ts +97 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/pathplan/index.d.ts +8 -0
- package/dist/pathplan/index.d.ts.map +1 -0
- package/dist/pathplan/route.d.ts +9 -0
- package/dist/pathplan/route.d.ts.map +1 -0
- package/dist/pathplan/shortest.d.ts +5 -0
- package/dist/pathplan/shortest.d.ts.map +1 -0
- package/dist/pathplan/solvers.d.ts +5 -0
- package/dist/pathplan/solvers.d.ts.map +1 -0
- package/dist/pathplan/triang.d.ts +25 -0
- package/dist/pathplan/triang.d.ts.map +1 -0
- package/dist/pathplan/types.d.ts +22 -0
- package/dist/pathplan/types.d.ts.map +1 -0
- package/dist/pathplan/visibility.d.ts +13 -0
- package/dist/pathplan/visibility.d.ts.map +1 -0
- package/dist/pathplan/vispath.d.ts +9 -0
- package/dist/pathplan/vispath.d.ts.map +1 -0
- package/dist/rbtree/index.d.ts +127 -0
- package/dist/rbtree/index.d.ts.map +1 -0
- package/dist/render/color-resolve.d.ts +38 -0
- package/dist/render/color-resolve.d.ts.map +1 -0
- package/dist/render/dot.d.ts +379 -0
- package/dist/render/dot.d.ts.map +1 -0
- package/dist/render/index.d.ts +24 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/json.d.ts +89 -0
- package/dist/render/json.d.ts.map +1 -0
- package/dist/render/map-test-helpers.d.ts +13 -0
- package/dist/render/map-test-helpers.d.ts.map +1 -0
- package/dist/render/map.d.ts +197 -0
- package/dist/render/map.d.ts.map +1 -0
- package/dist/render/public.d.ts +64 -0
- package/dist/render/public.d.ts.map +1 -0
- package/dist/render/svg-arrow-ops.d.ts +10 -0
- package/dist/render/svg-arrow-ops.d.ts.map +1 -0
- package/dist/render/svg-cluster.d.ts +9 -0
- package/dist/render/svg-cluster.d.ts.map +1 -0
- package/dist/render/svg-edge-ortho-radius.d.ts +31 -0
- package/dist/render/svg-edge-ortho-radius.d.ts.map +1 -0
- package/dist/render/svg-edge-split.d.ts +48 -0
- package/dist/render/svg-edge-split.d.ts.map +1 -0
- package/dist/render/svg-gradient.d.ts +46 -0
- package/dist/render/svg-gradient.d.ts.map +1 -0
- package/dist/render/svg-graph.d.ts +97 -0
- package/dist/render/svg-graph.d.ts.map +1 -0
- package/dist/render/svg-helpers.d.ts +122 -0
- package/dist/render/svg-helpers.d.ts.map +1 -0
- package/dist/render/svg-id.d.ts +28 -0
- package/dist/render/svg-id.d.ts.map +1 -0
- package/dist/render/svg-multicolor.d.ts +60 -0
- package/dist/render/svg-multicolor.d.ts.map +1 -0
- package/dist/render/svg-parallel-edge.d.ts +28 -0
- package/dist/render/svg-parallel-edge.d.ts.map +1 -0
- package/dist/render/svg-tapered-edge.d.ts +18 -0
- package/dist/render/svg-tapered-edge.d.ts.map +1 -0
- package/dist/render/svg.d.ts +104 -0
- package/dist/render/svg.d.ts.map +1 -0
- package/dist/render/xdot-public.d.ts +95 -0
- package/dist/render/xdot-public.d.ts.map +1 -0
- package/dist/render/xml-escape.d.ts +21 -0
- package/dist/render/xml-escape.d.ts.map +1 -0
- package/dist/render.js +52556 -0
- package/dist/render.js.map +7 -0
- package/dist/util/agxbuf.d.ts +72 -0
- package/dist/util/agxbuf.d.ts.map +1 -0
- package/dist/util/bsd-qsort.d.ts +22 -0
- package/dist/util/bsd-qsort.d.ts.map +1 -0
- package/dist/util/index.d.ts +11 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/list.d.ts +47 -0
- package/dist/util/list.d.ts.map +1 -0
- package/dist/util/math.d.ts +54 -0
- package/dist/util/math.d.ts.map +1 -0
- package/dist/util/mt19937.d.ts +40 -0
- package/dist/util/mt19937.d.ts.map +1 -0
- package/dist/util/printf-round.d.ts +45 -0
- package/dist/util/printf-round.d.ts.map +1 -0
- package/dist/util/xml.d.ts +24 -0
- package/dist/util/xml.d.ts.map +1 -0
- package/dist/vpsc/Block.d.ts +116 -0
- package/dist/vpsc/Block.d.ts.map +1 -0
- package/dist/vpsc/Blocks.d.ts +66 -0
- package/dist/vpsc/Blocks.d.ts.map +1 -0
- package/dist/vpsc/Constraint.d.ts +51 -0
- package/dist/vpsc/Constraint.d.ts.map +1 -0
- package/dist/vpsc/HeapUtils.d.ts +37 -0
- package/dist/vpsc/HeapUtils.d.ts.map +1 -0
- package/dist/vpsc/Solver.d.ts +107 -0
- package/dist/vpsc/Solver.d.ts.map +1 -0
- package/dist/vpsc/SweepLine.d.ts +38 -0
- package/dist/vpsc/SweepLine.d.ts.map +1 -0
- package/dist/vpsc/Variable.d.ts +38 -0
- package/dist/vpsc/Variable.d.ts.map +1 -0
- package/dist/vpsc/index.d.ts +54 -0
- package/dist/vpsc/index.d.ts.map +1 -0
- package/dist/vpsc/sweepTypes.d.ts +29 -0
- package/dist/vpsc/sweepTypes.d.ts.map +1 -0
- package/dist/xdot/index.d.ts +6 -0
- package/dist/xdot/index.d.ts.map +1 -0
- package/dist/xdot/lex.d.ts +22 -0
- package/dist/xdot/lex.d.ts.map +1 -0
- package/dist/xdot/misc.d.ts +13 -0
- package/dist/xdot/misc.d.ts.map +1 -0
- package/dist/xdot/parse.d.ts +21 -0
- package/dist/xdot/parse.d.ts.map +1 -0
- package/dist/xdot/types.d.ts +152 -0
- package/dist/xdot/types.d.ts.map +1 -0
- package/package.json +113 -0
- package/src/api/builder.ts +277 -0
- package/src/api/edge-ops.ts +113 -0
- package/src/api/geometry.ts +307 -0
- package/src/api/index.ts +46 -0
- package/src/cdt/bag.ts +196 -0
- package/src/cdt/hash-core.ts +84 -0
- package/src/cdt/hash.ts +207 -0
- package/src/cdt/index.ts +17 -0
- package/src/cdt/splay-core.ts +301 -0
- package/src/cdt/splay.ts +191 -0
- package/src/cdt/strhash.ts +52 -0
- package/src/cdt/types.ts +13 -0
- package/src/common/arith.ts +39 -0
- package/src/common/arm-pow-data.ts +201 -0
- package/src/common/arm-pow.ts +296 -0
- package/src/common/arrows-constants.ts +175 -0
- package/src/common/arrows-geometry.ts +62 -0
- package/src/common/arrows-miter.ts +84 -0
- package/src/common/arrows-shapes-poly.ts +241 -0
- package/src/common/arrows-shapes-util.ts +162 -0
- package/src/common/arrows-shapes.ts +360 -0
- package/src/common/arrows-types.ts +59 -0
- package/src/common/arrows.ts +209 -0
- package/src/common/color.ts +340 -0
- package/src/common/colorData.ts +264 -0
- package/src/common/compass-port.ts +384 -0
- package/src/common/crand.ts +79 -0
- package/src/common/edge-label-init.ts +310 -0
- package/src/common/edge-offset.ts +140 -0
- package/src/common/ellipse-wedge.ts +189 -0
- package/src/common/emit-types.ts +332 -0
- package/src/common/fma.ts +52 -0
- package/src/common/graph-init.ts +359 -0
- package/src/common/html-entities.ts +299 -0
- package/src/common/html-string.ts +22 -0
- package/src/common/htmltable-emit-fill.ts +367 -0
- package/src/common/htmltable-emit-rules.ts +293 -0
- package/src/common/htmltable-emit.ts +345 -0
- package/src/common/htmltable-lex.ts +138 -0
- package/src/common/htmltable-parse.ts +539 -0
- package/src/common/htmltable-port.ts +32 -0
- package/src/common/htmltable-pos-runs.ts +313 -0
- package/src/common/htmltable-pos.ts +601 -0
- package/src/common/htmltable-types.ts +262 -0
- package/src/common/htmltable.ts +477 -0
- package/src/common/layers.ts +113 -0
- package/src/common/make-label.ts +192 -0
- package/src/common/multicolor.ts +167 -0
- package/src/common/nodeinit.ts +339 -0
- package/src/common/poly-gencode.ts +475 -0
- package/src/common/poly-init.ts +133 -0
- package/src/common/poly-inside.ts +202 -0
- package/src/common/poly-shapes-cases.ts +253 -0
- package/src/common/poly-shapes-cases2.ts +170 -0
- package/src/common/poly-shapes-util.ts +124 -0
- package/src/common/poly-shapes.ts +181 -0
- package/src/common/poly-sizing.ts +639 -0
- package/src/common/poly-vertices.ts +237 -0
- package/src/common/postproc.ts +436 -0
- package/src/common/ps-fontalias.ts +112 -0
- package/src/common/random.ts +37 -0
- package/src/common/record-port.ts +89 -0
- package/src/common/record.ts +523 -0
- package/src/common/shapeData.ts +502 -0
- package/src/common/shapes.ts +187 -0
- package/src/common/spline-midpoint.ts +105 -0
- package/src/common/splines-clip.ts +449 -0
- package/src/common/splines-constants.ts +53 -0
- package/src/common/splines-geom.ts +194 -0
- package/src/common/splines-path-begin.ts +243 -0
- package/src/common/splines-path-end.ts +231 -0
- package/src/common/splines-path-shared.ts +258 -0
- package/src/common/splines-routespl.ts +444 -0
- package/src/common/splines-selfedge.ts +403 -0
- package/src/common/splines.ts +33 -0
- package/src/common/style-resolve.ts +481 -0
- package/src/common/subst.ts +126 -0
- package/src/common/taper.ts +219 -0
- package/src/common/textmeasure-factory.ts +86 -0
- package/src/common/textmeasure-lookup.ts +50 -0
- package/src/common/textmeasure-lut-data-a.ts +182 -0
- package/src/common/textmeasure-lut-data-b.ts +140 -0
- package/src/common/textmeasure-lut-data-c.ts +221 -0
- package/src/common/textmeasure-lut-data.ts +78 -0
- package/src/common/textmeasure.ts +321 -0
- package/src/common/types.ts +425 -0
- package/src/common/xlabels-place.ts +475 -0
- package/src/debug.ts +38 -0
- package/src/errors.ts +95 -0
- package/src/gvc/anchor.ts +530 -0
- package/src/gvc/context.ts +260 -0
- package/src/gvc/default-context.ts +70 -0
- package/src/gvc/device-cluster.ts +114 -0
- package/src/gvc/device.ts +598 -0
- package/src/gvc/edge-labels.ts +116 -0
- package/src/gvc/emit-walk.ts +98 -0
- package/src/gvc/image-resolver.ts +137 -0
- package/src/gvc/job.ts +401 -0
- package/src/gvc/textlayout.ts +44 -0
- package/src/gvc/textspan-emit.ts +100 -0
- package/src/gvc/usershape.ts +33 -0
- package/src/gvc/viewport.ts +203 -0
- package/src/index.ts +165 -0
- package/src/label/index.ts +302 -0
- package/src/label/node.ts +278 -0
- package/src/label/rectangle.ts +123 -0
- package/src/label/split-q.ts +237 -0
- package/src/label/xlabels-geom.ts +132 -0
- package/src/label/xlabels-intersect.ts +421 -0
- package/src/label/xlabels.ts +212 -0
- package/src/layout/circo/blockpath.ts +560 -0
- package/src/layout/circo/blocks.ts +234 -0
- package/src/layout/circo/blocktree.ts +246 -0
- package/src/layout/circo/circular.ts +227 -0
- package/src/layout/circo/index.ts +90 -0
- package/src/layout/circo/init.ts +84 -0
- package/src/layout/circo/position-helpers.ts +104 -0
- package/src/layout/circo/position.ts +196 -0
- package/src/layout/dot/__fixtures__/xcoord-pivot-divergence.gv +79 -0
- package/src/layout/dot/acyclic.ts +60 -0
- package/src/layout/dot/aspect.ts +22 -0
- package/src/layout/dot/classify.ts +462 -0
- package/src/layout/dot/cluster-path.ts +200 -0
- package/src/layout/dot/cluster.ts +480 -0
- package/src/layout/dot/compound-clip.ts +224 -0
- package/src/layout/dot/compound-geom.ts +282 -0
- package/src/layout/dot/compound.ts +294 -0
- package/src/layout/dot/conc.ts +433 -0
- package/src/layout/dot/decomp.ts +165 -0
- package/src/layout/dot/edge-order.ts +62 -0
- package/src/layout/dot/edge-route-arrow.ts +87 -0
- package/src/layout/dot/edge-route-boxes.ts +99 -0
- package/src/layout/dot/edge-route-chain.ts +420 -0
- package/src/layout/dot/edge-route-clip.ts +253 -0
- package/src/layout/dot/edge-route-faithful.ts +404 -0
- package/src/layout/dot/edge-route-geom.ts +90 -0
- package/src/layout/dot/edge-route-helpers.ts +170 -0
- package/src/layout/dot/edge-route-poly.ts +174 -0
- package/src/layout/dot/edge-route-rank.ts +136 -0
- package/src/layout/dot/edge-route-routing.ts +219 -0
- package/src/layout/dot/edge-route.ts +490 -0
- package/src/layout/dot/fastgr.ts +377 -0
- package/src/layout/dot/flat-utils.ts +52 -0
- package/src/layout/dot/flat.ts +518 -0
- package/src/layout/dot/graph-label.ts +114 -0
- package/src/layout/dot/index.ts +302 -0
- package/src/layout/dot/init.ts +300 -0
- package/src/layout/dot/label-order.ts +161 -0
- package/src/layout/dot/mincross-build.ts +373 -0
- package/src/layout/dot/mincross-cross.ts +409 -0
- package/src/layout/dot/mincross-flat.ts +213 -0
- package/src/layout/dot/mincross-order.ts +401 -0
- package/src/layout/dot/mincross-utils.ts +170 -0
- package/src/layout/dot/mincross.ts +386 -0
- package/src/layout/dot/ns-core.ts +122 -0
- package/src/layout/dot/ns-range.ts +228 -0
- package/src/layout/dot/ns-subtree.ts +347 -0
- package/src/layout/dot/ns.ts +506 -0
- package/src/layout/dot/ortho-adapter.ts +133 -0
- package/src/layout/dot/pack-components.ts +433 -0
- package/src/layout/dot/position-aux.ts +382 -0
- package/src/layout/dot/position-bbox.ts +221 -0
- package/src/layout/dot/position-cluster.ts +286 -0
- package/src/layout/dot/position-ycoords.ts +287 -0
- package/src/layout/dot/position.ts +194 -0
- package/src/layout/dot/rank-dot2.ts +528 -0
- package/src/layout/dot/rank.ts +547 -0
- package/src/layout/dot/sameport.ts +278 -0
- package/src/layout/dot/self-loop.ts +147 -0
- package/src/layout/dot/splines-clone.ts +121 -0
- package/src/layout/dot/splines-flat-labeled.ts +408 -0
- package/src/layout/dot/splines-flat-multi.ts +188 -0
- package/src/layout/dot/splines-flat.ts +598 -0
- package/src/layout/dot/splines-groups.ts +190 -0
- package/src/layout/dot/splines-label.ts +432 -0
- package/src/layout/dot/splines-route-type.ts +44 -0
- package/src/layout/dot/splines-route.ts +478 -0
- package/src/layout/dot/splines.ts +538 -0
- package/src/layout/dot/straight-edges.ts +332 -0
- package/src/layout/fdp/cluster-edges.ts +0 -0
- package/src/layout/fdp/comp.ts +160 -0
- package/src/layout/fdp/derive.ts +272 -0
- package/src/layout/fdp/fdp-model.ts +238 -0
- package/src/layout/fdp/grid.ts +77 -0
- package/src/layout/fdp/index.ts +113 -0
- package/src/layout/fdp/init.ts +116 -0
- package/src/layout/fdp/layout.ts +485 -0
- package/src/layout/fdp/normalize.ts +100 -0
- package/src/layout/fdp/ports.ts +161 -0
- package/src/layout/fdp/tlayout-init.ts +230 -0
- package/src/layout/fdp/tlayout-parms.ts +234 -0
- package/src/layout/fdp/tlayout.ts +317 -0
- package/src/layout/fdp/xlayout.ts +350 -0
- package/src/layout/neato/bfs.ts +131 -0
- package/src/layout/neato/cdt-surface.ts +693 -0
- package/src/layout/neato/conjgrad.ts +159 -0
- package/src/layout/neato/delaunay.ts +259 -0
- package/src/layout/neato/dijkstra.ts +296 -0
- package/src/layout/neato/fdp-adjust.ts +124 -0
- package/src/layout/neato/index.ts +310 -0
- package/src/layout/neato/init.ts +505 -0
- package/src/layout/neato/legal.ts +316 -0
- package/src/layout/neato/matrix-ops.ts +112 -0
- package/src/layout/neato/multispline-router.ts +417 -0
- package/src/layout/neato/multispline.ts +427 -0
- package/src/layout/neato/overlap-prism.ts +503 -0
- package/src/layout/neato/overlap.ts +158 -0
- package/src/layout/neato/sc-adjust.ts +206 -0
- package/src/layout/neato/sep-factor.ts +118 -0
- package/src/layout/neato/set-aspect.ts +178 -0
- package/src/layout/neato/sgd.ts +461 -0
- package/src/layout/neato/splines.ts +1014 -0
- package/src/layout/neato/stress-kernel.ts +362 -0
- package/src/layout/neato/stress.ts +420 -0
- package/src/layout/osage/index.ts +548 -0
- package/src/layout/osage/layout.ts +254 -0
- package/src/layout/osage/types.ts +31 -0
- package/src/layout/pack/array-pack.ts +254 -0
- package/src/layout/pack/index.ts +570 -0
- package/src/layout/pack/poly-pack.ts +266 -0
- package/src/layout/pack/poly-place.ts +426 -0
- package/src/layout/pack/spiral-search.ts +106 -0
- package/src/layout/pack/test-helpers.ts +46 -0
- package/src/layout/pack/types.ts +85 -0
- package/src/layout/patchwork/index.ts +441 -0
- package/src/layout/patchwork/tree-map.ts +183 -0
- package/src/layout/patchwork/tree-node.ts +120 -0
- package/src/layout/sfdp/index.ts +231 -0
- package/src/layout/sfdp/init.ts +224 -0
- package/src/layout/sfdp/multilevel.ts +262 -0
- package/src/layout/sfdp/quadtree.ts +267 -0
- package/src/layout/sfdp/sparse-matrix-multiply.ts +160 -0
- package/src/layout/sfdp/sparse-matrix.ts +367 -0
- package/src/layout/sfdp/sparse-solve.ts +122 -0
- package/src/layout/sfdp/spring-driver.ts +209 -0
- package/src/layout/sfdp/spring-electrical.ts +431 -0
- package/src/layout/twopi/circle.ts +339 -0
- package/src/layout/twopi/index.ts +78 -0
- package/src/layout/twopi/init.ts +174 -0
- package/src/layout/twopi/pipeline.ts +98 -0
- package/src/layout/twopi/twopi-test-helpers.ts +44 -0
- package/src/model/algData.ts +194 -0
- package/src/model/cgraph-ops.ts +175 -0
- package/src/model/edge.ts +104 -0
- package/src/model/edgeInfo.ts +431 -0
- package/src/model/geom.ts +204 -0
- package/src/model/graph.ts +172 -0
- package/src/model/graphInfo.ts +528 -0
- package/src/model/index.ts +10 -0
- package/src/model/layoutParams.ts +127 -0
- package/src/model/node.ts +138 -0
- package/src/model/nodeInfo.ts +424 -0
- package/src/model/rankEntry.ts +95 -0
- package/src/ortho/chan-dict.ts +236 -0
- package/src/ortho/fpq.ts +149 -0
- package/src/ortho/index.ts +206 -0
- package/src/ortho/maze-channels.ts +196 -0
- package/src/ortho/maze.ts +311 -0
- package/src/ortho/ortho-parallel.ts +254 -0
- package/src/ortho/ortho-route.ts +349 -0
- package/src/ortho/partition.ts +303 -0
- package/src/ortho/rawgraph.ts +119 -0
- package/src/ortho/sgraph.ts +283 -0
- package/src/ortho/trap-query.ts +174 -0
- package/src/ortho/trap-segment.ts +303 -0
- package/src/ortho/trap-types.ts +171 -0
- package/src/ortho/trap-update.ts +89 -0
- package/src/ortho/trapezoid.ts +120 -0
- package/src/ortho/types.ts +286 -0
- package/src/parser/__fixtures__/directed.dot +10 -0
- package/src/parser/__fixtures__/simple.dot +7 -0
- package/src/parser/__fixtures__/subgraph.dot +17 -0
- package/src/parser/ast.ts +64 -0
- package/src/parser/builder.ts +401 -0
- package/src/parser/dot.d.ts +208 -0
- package/src/parser/dot.js +3321 -0
- package/src/parser/dot.pegjs +263 -0
- package/src/parser/index.ts +353 -0
- package/src/pathplan/index.ts +9 -0
- package/src/pathplan/route.ts +284 -0
- package/src/pathplan/shortest.ts +268 -0
- package/src/pathplan/solvers.ts +65 -0
- package/src/pathplan/triang.ts +221 -0
- package/src/pathplan/types.ts +16 -0
- package/src/pathplan/visibility.ts +170 -0
- package/src/pathplan/vispath.ts +118 -0
- package/src/rbtree/index.ts +418 -0
- package/src/render/color-resolve.ts +171 -0
- package/src/render/dot.ts +1514 -0
- package/src/render/index.ts +29 -0
- package/src/render/json.ts +734 -0
- package/src/render/map-test-helpers.ts +61 -0
- package/src/render/map.ts +528 -0
- package/src/render/public.ts +131 -0
- package/src/render/svg-arrow-ops.ts +113 -0
- package/src/render/svg-cluster.ts +24 -0
- package/src/render/svg-edge-ortho-radius.ts +228 -0
- package/src/render/svg-edge-split.ts +180 -0
- package/src/render/svg-gradient.ts +185 -0
- package/src/render/svg-graph.ts +415 -0
- package/src/render/svg-helpers.ts +623 -0
- package/src/render/svg-id.ts +76 -0
- package/src/render/svg-multicolor.ts +313 -0
- package/src/render/svg-parallel-edge.ts +123 -0
- package/src/render/svg-tapered-edge.ts +56 -0
- package/src/render/svg.ts +307 -0
- package/src/render/xdot-public.ts +164 -0
- package/src/render/xml-escape.ts +56 -0
- package/src/util/agxbuf.ts +138 -0
- package/src/util/bsd-qsort.ts +251 -0
- package/src/util/index.ts +25 -0
- package/src/util/list.ts +122 -0
- package/src/util/math.ts +104 -0
- package/src/util/mt19937.ts +143 -0
- package/src/util/printf-round.ts +163 -0
- package/src/util/xml.ts +184 -0
- package/src/vpsc/Block.ts +375 -0
- package/src/vpsc/Blocks.ts +164 -0
- package/src/vpsc/Constraint.ts +94 -0
- package/src/vpsc/HeapUtils.ts +88 -0
- package/src/vpsc/Solver.ts +274 -0
- package/src/vpsc/SweepLine.ts +214 -0
- package/src/vpsc/Variable.ts +54 -0
- package/src/vpsc/index.ts +122 -0
- package/src/vpsc/sweepTypes.ts +31 -0
- package/src/xdot/index.ts +7 -0
- package/src/xdot/lex.ts +151 -0
- package/src/xdot/misc.ts +226 -0
- package/src/xdot/parse.ts +349 -0
- package/src/xdot/types.ts +158 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript port of lib/dotgen/flat.c.
|
|
5
|
+
*
|
|
6
|
+
* Handles labeled flat (same-rank) edges: virtual node insertion into rank
|
|
7
|
+
* arrays, label-node slot allocation, and the abomination rank-array shift
|
|
8
|
+
* when labeled flat edges fall at rank 0.
|
|
9
|
+
*
|
|
10
|
+
* Note: all functions are exported because lizard 1.22.1's TypeScript parser
|
|
11
|
+
* only recognises function boundaries when the `export` keyword is present.
|
|
12
|
+
* Non-exported TS functions with return-type annotations cause the parser to
|
|
13
|
+
* merge them into the preceding function's body, inflating CCN counts.
|
|
14
|
+
*
|
|
15
|
+
* @see lib/dotgen/flat.c
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Graph } from '../../model/graph.js';
|
|
19
|
+
import type { Node } from '../../model/node.js';
|
|
20
|
+
import type { Edge } from '../../model/edge.js';
|
|
21
|
+
import type { RankEntry } from '../../model/rankEntry.js';
|
|
22
|
+
import type { EdgeList } from '../../model/nodeInfo.js';
|
|
23
|
+
import { FLATORDER, NORMAL, VIRTUAL, virtualNode, virtualEdge } from './fastgr.js';
|
|
24
|
+
import { recSaveVlists, recResetVlists, dotRoot } from './mincross.js';
|
|
25
|
+
import { checkLabelOrder } from './label-order.js';
|
|
26
|
+
import {
|
|
27
|
+
nodeOrder, nodeRank, graphMaxrank, graphMinrank, getOrd,
|
|
28
|
+
} from './flat-utils.js';
|
|
29
|
+
import type { TextlabelT } from '../../common/types.js';
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// make_vn_slot @see lib/dotgen/flat.c:make_vn_slot
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
export function shiftSlotRight(rk: RankEntry, pos: number): void {
|
|
36
|
+
for (let i = rk.n; i > pos; i--) {
|
|
37
|
+
rk.v[i] = rk.v[i - 1];
|
|
38
|
+
const cur = rk.v[i];
|
|
39
|
+
const curOrd = cur.info.order;
|
|
40
|
+
if (curOrd !== undefined) cur.info.order = curOrd + 1;
|
|
41
|
+
else cur.info.order = 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Insert a virtual node slot at position `pos` in rank `r` of graph `g`.
|
|
47
|
+
* @see lib/dotgen/flat.c:make_vn_slot
|
|
48
|
+
*/
|
|
49
|
+
export function makeVnSlot(g: Graph, r: number, pos: number): Node {
|
|
50
|
+
const rk = g.info.rank![r];
|
|
51
|
+
if (rk.v.length <= rk.n + 1) rk.v.push(null as unknown as Node);
|
|
52
|
+
shiftSlotRight(rk, pos);
|
|
53
|
+
const v = virtualNode(g);
|
|
54
|
+
rk.v[pos] = v;
|
|
55
|
+
v.info.order = pos;
|
|
56
|
+
v.info.rank = r;
|
|
57
|
+
rk.n++;
|
|
58
|
+
return v;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// flat_limits @see lib/dotgen/flat.c:flat_limits / setbounds / findlr
|
|
63
|
+
//
|
|
64
|
+
// Placement of a labeled flat edge's label virtual node on rank r-1 is
|
|
65
|
+
// topology-aware: it does NOT compare the r-1 vnodes' own orders against the
|
|
66
|
+
// flat edge's endpoint orders (those live on a different rank). Instead, for
|
|
67
|
+
// each node already on rank r-1, it inspects where that node's edges connect on
|
|
68
|
+
// rank r relative to the flat edge's endpoint-order span [lpos,rpos], and
|
|
69
|
+
// places the label at the midpoint of the resulting hard/soft bounds. A crude
|
|
70
|
+
// order-vs-order comparison mis-placed the label (graphviz #1213: the back-edge
|
|
71
|
+
// chain vnodes shifted +1 order, perturbing their positions and routing
|
|
72
|
+
// corridors and warping every constraint=false back-edge spline).
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
// bound indices @see lib/dotgen/flat.c HLB/HRB/SLB/SRB
|
|
76
|
+
const HLB = 0;
|
|
77
|
+
const HRB = 1;
|
|
78
|
+
const SLB = 2;
|
|
79
|
+
const SRB = 3;
|
|
80
|
+
|
|
81
|
+
/** Sorted [lo, hi] of the orders of u and v. @see lib/dotgen/flat.c:findlr */
|
|
82
|
+
export function findlr(u: Node, v: Node): [number, number] {
|
|
83
|
+
const a = nodeOrder(u);
|
|
84
|
+
const b = nodeOrder(v);
|
|
85
|
+
return a > b ? [b, a] : [a, b];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A flat label vnode (no in-edges): bound by where its two endpoints sit
|
|
89
|
+
* relative to [lpos,rpos]. @see lib/dotgen/flat.c:setbounds (flat branch) */
|
|
90
|
+
export function setBoundsFlat(v: Node, bounds: number[], lpos: number, rpos: number): void {
|
|
91
|
+
const out = v.info.out;
|
|
92
|
+
if (out === undefined || out.size < 2) return; // C asserts size == 2
|
|
93
|
+
const ord = nodeOrder(v);
|
|
94
|
+
const [l, r] = findlr(out.list[0].head, out.list[1].head);
|
|
95
|
+
if (r <= lpos) { bounds[SLB] = bounds[HLB] = ord; }
|
|
96
|
+
else if (l >= rpos) { bounds[SRB] = bounds[HRB] = ord; }
|
|
97
|
+
else if (l < lpos && r > rpos) { /* spanning this one — ignore */ }
|
|
98
|
+
else {
|
|
99
|
+
if (l < lpos || (l === lpos && r < rpos)) bounds[SLB] = ord;
|
|
100
|
+
if (r > rpos || (r === rpos && l > lpos)) bounds[SRB] = ord;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A forward chain vnode (has in-edges): hard-bound by whether all its
|
|
105
|
+
* downstream connections fall left or right of the span.
|
|
106
|
+
* @see lib/dotgen/flat.c:setbounds (forward branch) */
|
|
107
|
+
export function setBoundsForward(v: Node, bounds: number[], lpos: number, rpos: number): void {
|
|
108
|
+
const out = v.info.out;
|
|
109
|
+
const size = out?.size ?? 0;
|
|
110
|
+
let onleft = false;
|
|
111
|
+
let onright = false;
|
|
112
|
+
for (let i = 0; i < size; i++) {
|
|
113
|
+
const ho = nodeOrder(out!.list[i].head);
|
|
114
|
+
if (ho <= lpos) { onleft = true; continue; }
|
|
115
|
+
if (ho >= rpos) { onright = true; continue; }
|
|
116
|
+
}
|
|
117
|
+
const ord = nodeOrder(v);
|
|
118
|
+
if (onleft && !onright) bounds[HLB] = ord + 1;
|
|
119
|
+
if (onright && !onleft) bounds[HRB] = ord - 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Update label-placement bounds from one rank-(r-1) node `v`, given the flat
|
|
123
|
+
* edge's endpoint-order span [lpos,rpos] on rank r. @see lib/dotgen/flat.c:setbounds */
|
|
124
|
+
export function setBounds(v: Node, bounds: number[], lpos: number, rpos: number): void {
|
|
125
|
+
if ((v.info.node_type ?? NORMAL) !== VIRTUAL) return;
|
|
126
|
+
if ((v.info.in?.size ?? 0) === 0) setBoundsFlat(v, bounds, lpos, rpos);
|
|
127
|
+
else setBoundsForward(v, bounds, lpos, rpos);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Find the best order position for a flat-edge label virtual node in rank r-1.
|
|
132
|
+
* Faithful port of C's bound-scan (NOT a simple order comparison).
|
|
133
|
+
* @see lib/dotgen/flat.c:flat_limits
|
|
134
|
+
*/
|
|
135
|
+
export function flatLimits(g: Graph, e: Edge): number {
|
|
136
|
+
const r = nodeRank(e.tail) - 1;
|
|
137
|
+
if (r < 0 || !g.info.rank) return 0;
|
|
138
|
+
const rk = g.info.rank[r];
|
|
139
|
+
let lnode = 0;
|
|
140
|
+
let rnode = rk.n - 1;
|
|
141
|
+
// bounds = [HLB, HRB, SLB, SRB]
|
|
142
|
+
const bounds = [lnode - 1, rnode + 1, lnode - 1, rnode + 1];
|
|
143
|
+
const [lpos, rpos] = findlr(e.tail, e.head);
|
|
144
|
+
while (lnode <= rnode) {
|
|
145
|
+
setBounds(rk.v[lnode], bounds, lpos, rpos);
|
|
146
|
+
if (lnode !== rnode) setBounds(rk.v[rnode], bounds, lpos, rpos);
|
|
147
|
+
lnode++;
|
|
148
|
+
rnode--;
|
|
149
|
+
if (bounds[HRB] - bounds[HLB] <= 1) break;
|
|
150
|
+
}
|
|
151
|
+
// C integer division truncates toward zero (Math.trunc).
|
|
152
|
+
if (bounds[HLB] <= bounds[HRB]) return Math.trunc((bounds[HLB] + bounds[HRB] + 1) / 2);
|
|
153
|
+
return Math.trunc((bounds[SLB] + bounds[SRB] + 1) / 2);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
// flat_node @see lib/dotgen/flat.c:flat_node
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
type LabelWithDimen = { dimen?: { x: number; y: number } };
|
|
161
|
+
|
|
162
|
+
export function graphRanksep(g: Graph): number {
|
|
163
|
+
return g.info.ranksep ?? 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* ypos = LL.y of the label box, grabbed before make_vn_slot so the new slot does
|
|
168
|
+
* not perturb it. @see lib/dotgen/flat.c:flat_node 154-159
|
|
169
|
+
*/
|
|
170
|
+
export function flatLabelYpos(g: Graph, r: number): number {
|
|
171
|
+
const rank = g.info.rank!;
|
|
172
|
+
const above = rank[r - 1].v[0];
|
|
173
|
+
if (above) return above.info.coord.y - rank[r - 1].ht1;
|
|
174
|
+
const here = rank[r].v[0];
|
|
175
|
+
return here.info.coord.y + rank[r].ht2 + graphRanksep(g);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Set ht/lw/rw on the label vnode from the label dimen (flip swaps x/y); return
|
|
180
|
+
* half-height. @see lib/dotgen/flat.c:flat_node 161-167
|
|
181
|
+
*/
|
|
182
|
+
export function flatNodeDims(g: Graph, vn: Node, lbl: TextlabelT): number {
|
|
183
|
+
let dx = lbl.dimen.x;
|
|
184
|
+
let dy = lbl.dimen.y;
|
|
185
|
+
if (g.info.flip === true) { const t = dx; dx = dy; dy = t; }
|
|
186
|
+
vn.info.ht = dy;
|
|
187
|
+
vn.info.lw = vn.info.rw = dx / 2;
|
|
188
|
+
return dy / 2;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Create the two FLATORDER virtual edges (vn→tail, vn→head) with label ports.
|
|
193
|
+
* @see lib/dotgen/flat.c:flat_node 170-177
|
|
194
|
+
*/
|
|
195
|
+
export function flatNodeEdges(vn: Node, e: Edge): void {
|
|
196
|
+
const et = virtualEdge(vn, e.tail, e);
|
|
197
|
+
et.info.tail_port.p.x = -vn.info.lw;
|
|
198
|
+
et.info.head_port.p.x = e.tail.info.rw;
|
|
199
|
+
et.info.edge_type = FLATORDER;
|
|
200
|
+
const eh = virtualEdge(vn, e.head, e);
|
|
201
|
+
eh.info.tail_port.p.x = vn.info.rw;
|
|
202
|
+
eh.info.head_port.p.x = e.head.info.lw;
|
|
203
|
+
eh.info.edge_type = FLATORDER;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create a VIRTUAL label node (ND_alg → e) above a non-adjacent flat edge.
|
|
208
|
+
*
|
|
209
|
+
* `g` is the graph being laid out. C reads it as `dot_root(agtail(e))`, which is
|
|
210
|
+
* `GD_dotroot(agroot(e))` — a MUTABLE slot on the cgraph root that `dot_init_subg`
|
|
211
|
+
* re-points at the graph currently being laid out. It is therefore NOT the same as
|
|
212
|
+
* `agroot(agtail(e))`: under `pack`, each connected component is laid out as its own
|
|
213
|
+
* dot-root, so `dot_root()` yields the COMPONENT while `agroot()` yields the true
|
|
214
|
+
* root (which has no rank table at all). The port has no such mutable slot, so the
|
|
215
|
+
* layout graph is threaded in from `flat_edges` — which is exactly what C's
|
|
216
|
+
* `dot_root()` evaluates to at every call site here.
|
|
217
|
+
*
|
|
218
|
+
* @see lib/dotgen/flat.c:flat_node (g = dot_root(agtail(e)))
|
|
219
|
+
* @see lib/dotgen/dotinit.c:dot_init_subg (GD_dotroot(agroot(g)) = droot)
|
|
220
|
+
*/
|
|
221
|
+
export function flatNode(g: Graph, e: Edge): void {
|
|
222
|
+
const lbl = e.info.label;
|
|
223
|
+
if (lbl === undefined) return;
|
|
224
|
+
const r = nodeRank(e.tail);
|
|
225
|
+
const place = flatLimits(g, e);
|
|
226
|
+
const ypos = flatLabelYpos(g, r);
|
|
227
|
+
const vn = makeVnSlot(g, r - 1, place);
|
|
228
|
+
const h2 = flatNodeDims(g, vn, lbl);
|
|
229
|
+
vn.info.label = lbl;
|
|
230
|
+
vn.info.coord.y = ypos + h2;
|
|
231
|
+
flatNodeEdges(vn, e);
|
|
232
|
+
const rk = g.info.rank![r - 1];
|
|
233
|
+
if (rk.ht1 < h2) rk.ht1 = h2;
|
|
234
|
+
if (rk.ht2 < h2) rk.ht2 = h2;
|
|
235
|
+
vn.info.posAlg = e;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// abomination @see lib/dotgen/flat.c:abomination
|
|
239
|
+
|
|
240
|
+
/** Fresh empty rank entry (the slot vacated by the +1 renumber). */
|
|
241
|
+
export function emptyRankEntry(): RankEntry {
|
|
242
|
+
return {
|
|
243
|
+
n: 0, v: [], an: 0, av: [],
|
|
244
|
+
ht1: 1, ht2: 1, pht1: 1, pht2: 1,
|
|
245
|
+
candidate: false, valid: false, cache_nc: 0, flat: undefined, vStart: 0,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Shift a cluster subtree's absolute-rank-indexed state to follow the +1
|
|
251
|
+
* renumber performed by `abomination` (AD-2).
|
|
252
|
+
*
|
|
253
|
+
* C needs no such pass: its abomination adds the label rank at index -1
|
|
254
|
+
* (`GD_rank(g) = rptr + 1`, `GD_minrank(g)--`) and never touches ND_rank, so a
|
|
255
|
+
* cluster's GD_minrank/GD_maxrank, GD_rank(clust)[] and GD_rankleader(clust)[]
|
|
256
|
+
* — all indexed by ABSOLUTE rank — stay correct. JS has no negative index, so
|
|
257
|
+
* the port renumbers +1 instead, and every absolute-rank-indexed structure has
|
|
258
|
+
* to move with it. Skipping the clusters leaves them pointing one rank too low:
|
|
259
|
+
* the next step of flat_edges (rec_reset_vlists → reset_vlist) re-aliases
|
|
260
|
+
* GD_rank(clust)[r].v = GD_rank(root)[r].v at the cluster's stale r, which now
|
|
261
|
+
* addresses the newly inserted flat-label rank instead of the cluster's own.
|
|
262
|
+
*
|
|
263
|
+
* @see lib/dotgen/flat.c:abomination
|
|
264
|
+
* @see lib/dotgen/mincross.c:reset_vlist
|
|
265
|
+
*/
|
|
266
|
+
export function shiftClusterRanks(g: Graph): void {
|
|
267
|
+
const nClust = g.info.n_cluster ?? 0;
|
|
268
|
+
for (let c = 1; c <= nClust; c++) {
|
|
269
|
+
const sub = g.info.clust![c - 1];
|
|
270
|
+
const mn = graphMinrank(sub);
|
|
271
|
+
const mx = graphMaxrank(sub);
|
|
272
|
+
const rank = sub.info.rank;
|
|
273
|
+
if (rank) {
|
|
274
|
+
for (let r = mx; r >= mn; r--) rank[r + 1] = rank[r];
|
|
275
|
+
rank[mn] = emptyRankEntry();
|
|
276
|
+
// The shift overwrote the zeroed sentinel that `allocate_ranks` parks at
|
|
277
|
+
// maxrank+1 (C: gv_calloc(maxrank + 2)); re-establish it at the NEW
|
|
278
|
+
// maxrank+1 so rank[maxrank+1] is never a hole. @see below (abomination).
|
|
279
|
+
rank[mx + 2] = emptyRankEntry();
|
|
280
|
+
}
|
|
281
|
+
// GD_rankleader(clust)[r] is absolute-rank-indexed too (save_vlist writes
|
|
282
|
+
// it at r = minrank..maxrank; map_interclust_node reads it at ND_rank(n)).
|
|
283
|
+
const rl = sub.info.rankleader;
|
|
284
|
+
if (rl) for (let r = mx; r >= mn; r--) rl[r + 1] = rl[r];
|
|
285
|
+
sub.info.minrank = mn + 1;
|
|
286
|
+
sub.info.maxrank = mx + 1;
|
|
287
|
+
shiftClusterRanks(sub);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Make room for a flat label vnode below the lowest rank (name from C; AD-2).
|
|
292
|
+
* @see lib/dotgen/flat.c:abomination */
|
|
293
|
+
export function abomination(g: Graph): void {
|
|
294
|
+
// C shifts its base pointer so rank[-1] is valid (minrank → -1). JS has no
|
|
295
|
+
// negative indices, so AD-2 renumbers: insert an empty rank at index 0, shift
|
|
296
|
+
// ranks up, bump every ND_rank and maxrank by 1, minrank stays 0. The vnode C
|
|
297
|
+
// places at rank -1 then lands at rank 0. position.ts re-runs setYcoords after.
|
|
298
|
+
// needsAbomination only fires on rank mn == 0 (C asserts GD_minrank == 0).
|
|
299
|
+
const mx = graphMaxrank(g);
|
|
300
|
+
const rank = g.info.rank!;
|
|
301
|
+
for (let r = mx; r >= 0; r--) rank[r + 1] = rank[r];
|
|
302
|
+
rank[0] = emptyRankEntry();
|
|
303
|
+
// C allocates THREE extra rank slots here ("one for new rank, one for
|
|
304
|
+
// sentinel, one for off-by-one", flat.c:193) and re-bases the pointer, so the
|
|
305
|
+
// zeroed sentinel that `allocate_ranks` keeps at maxrank+1
|
|
306
|
+
// (`gv_calloc(GD_maxrank(g) + 2)`, mincross.c:1155) survives the insert. This
|
|
307
|
+
// port shifts UP in place instead of using a -1 index, so the shift writes the
|
|
308
|
+
// old top rank OVER that sentinel; without re-establishing it, rank[maxrank+1]
|
|
309
|
+
// is a hole. Readers that index maxrank+1 unguarded — `transposeCounts`' useOut
|
|
310
|
+
// gate (`GD_rank(g)[r+1].n`, mincross.c:650) and `mergeRanks`
|
|
311
|
+
// (`GD_rank(root)[mx+1].valid`, cluster.c:245) — would then fault on undefined.
|
|
312
|
+
// @see lib/dotgen/flat.c:abomination (gv_recalloc to GD_maxrank(g) + 3)
|
|
313
|
+
rank[mx + 2] = emptyRankEntry();
|
|
314
|
+
for (let n: Node | undefined = g.info.nlist; n; n = n.info.next) {
|
|
315
|
+
n.info.rank = (n.info.rank ?? 0) + 1;
|
|
316
|
+
}
|
|
317
|
+
g.info.maxrank = mx + 1;
|
|
318
|
+
// The root's nlist holds every node (merge_ranks calls fast_node(root, v) on
|
|
319
|
+
// each cluster member), so the ND_rank bump above already covers the clusters'
|
|
320
|
+
// nodes. What it does NOT cover is the clusters' own rank-indexed bookkeeping.
|
|
321
|
+
shiftClusterRanks(g);
|
|
322
|
+
// Record the +1 renumber so make_LR_constraints can recover C's rank-index
|
|
323
|
+
// parity: C inserts the label rank at -1 and keeps real nodes on even ranks;
|
|
324
|
+
// this 0-based shift puts them on odd ranks, inverting `sep[i & 1]`.
|
|
325
|
+
g.info.abomShift = (g.info.abomShift ?? 0) + 1;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ---------------------------------------------------------------------------
|
|
329
|
+
// checkFlatAdjacent @see lib/dotgen/flat.c:checkFlatAdjacent
|
|
330
|
+
// ---------------------------------------------------------------------------
|
|
331
|
+
|
|
332
|
+
export function hasInterveningNode(rk: RankEntry, lo: number, hi: number): boolean {
|
|
333
|
+
for (let i = 0; i < rk.n; i++) {
|
|
334
|
+
const ord = getOrd(rk, i);
|
|
335
|
+
if (ord <= lo || ord >= hi) continue;
|
|
336
|
+
// C only treats a between-node as blocking flat-edge adjacency when it is a
|
|
337
|
+
// NORMAL node or a LABELED virtual node; an UNLABELED virtual node (e.g. an
|
|
338
|
+
// edge merely passing through the rank) does NOT block. The port previously
|
|
339
|
+
// blocked on any node. @see lib/dotgen/flat.c:checkFlatAdjacent
|
|
340
|
+
const n = rk.v[i];
|
|
341
|
+
const t = n.info.node_type ?? NORMAL;
|
|
342
|
+
if (t === NORMAL || (t === VIRTUAL && n.info.label !== undefined)) return true;
|
|
343
|
+
}
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Mark flat edge as adjacent if no nodes fall between its endpoints in rank.
|
|
349
|
+
* When adjacent, C marks the edge AND every edge in its `to_virt` chain (the
|
|
350
|
+
* `do { ED_adjacent(e)=1; e=ED_to_virt(e); } while(e)` loop): the class rep must
|
|
351
|
+
* carry the flag too, because flat_edges' `other`-loop copies adjacency from the
|
|
352
|
+
* rep (`ED_adjacent(e) = ED_adjacent(le)`). Marking only the leaf left the rep
|
|
353
|
+
* unmarked, so that copy clobbered the flag back to 0 and the edge mis-routed
|
|
354
|
+
* through the generic fitter (a spurious y-slope on a flat edge).
|
|
355
|
+
*
|
|
356
|
+
* `g` is the graph being laid out — C's `dot_root(tn)`, NOT `agroot(tn)`. See
|
|
357
|
+
* `flatNode` above for why these differ under `pack`.
|
|
358
|
+
*
|
|
359
|
+
* @see lib/dotgen/flat.c:checkFlatAdjacent (rank = &GD_rank(dot_root(tn))[...])
|
|
360
|
+
*/
|
|
361
|
+
export function checkFlatAdjacent(g: Graph, e: Edge): void {
|
|
362
|
+
const tOrd = nodeOrder(e.tail);
|
|
363
|
+
const hOrd = nodeOrder(e.head);
|
|
364
|
+
const lo = Math.min(tOrd, hOrd);
|
|
365
|
+
const hi = Math.max(tOrd, hOrd);
|
|
366
|
+
let adjacent = hi - lo <= 1;
|
|
367
|
+
if (!adjacent) {
|
|
368
|
+
adjacent = !hasInterveningNode(g.info.rank![nodeRank(e.tail)], lo, hi);
|
|
369
|
+
}
|
|
370
|
+
if (!adjacent) return;
|
|
371
|
+
for (let le: Edge | undefined = e; le; le = le.info.to_virt) le.info.adjacent = 1;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
// ---------------------------------------------------------------------------
|
|
376
|
+
// flatEdges helpers @see lib/dotgen/flat.c:flat_edges
|
|
377
|
+
// ---------------------------------------------------------------------------
|
|
378
|
+
|
|
379
|
+
export function isLabeledFlat(e: Edge): boolean {
|
|
380
|
+
return e.info.label !== undefined;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function markEdgeList(g: Graph, edges: EdgeList | undefined): void {
|
|
384
|
+
if (!edges) return;
|
|
385
|
+
for (let i = 0; i < edges.size; i++) checkFlatAdjacent(g, edges.list[i]);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export function markAdjacent(g: Graph): void {
|
|
389
|
+
for (let n: Node | undefined = g.info.nlist; n; n = n.info.next) {
|
|
390
|
+
markEdgeList(g, n.info.flat_out);
|
|
391
|
+
// ND_other entries are marked only when actually flat: a cross-rank merged
|
|
392
|
+
// 2-cycle member must NOT get adjacent=1 (the chain-walk would set it on
|
|
393
|
+
// its rep too, and groupSize's flat-adjacent short-circuit would then
|
|
394
|
+
// swallow portcmp group breaks). @see lib/dotgen/flat.c:272-276
|
|
395
|
+
if (n.info.other) {
|
|
396
|
+
for (let i = 0; i < n.info.other.size; i++) {
|
|
397
|
+
const e = n.info.other.list[i];
|
|
398
|
+
if (nodeRank(e.tail) === nodeRank(e.head)) checkFlatAdjacent(g, e);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function rankHasNonAdjacentLabel(rk: RankEntry): boolean {
|
|
405
|
+
for (let i = 0; i < rk.n; i++) {
|
|
406
|
+
const fo = rk.v[i].info.flat_out;
|
|
407
|
+
if (!fo) continue;
|
|
408
|
+
for (let j = 0; j < fo.size; j++) {
|
|
409
|
+
if (isLabeledFlat(fo.list[j]) && !fo.list[j].info.adjacent) return true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* AD-1: C gates this on `GD_rank(g)[0].flat || GD_n_cluster(g) > 0` and then
|
|
417
|
+
* scans for a labeled non-adjacent flat edge on rank mn. In this port the
|
|
418
|
+
* `rank[mn].flat` adjacency matrix is unreliable at position-time (mincross
|
|
419
|
+
* builds it before `flat_out` is populated), so we detect the rank-mn labeled
|
|
420
|
+
* non-adjacent flat edge directly via `flat_out` — which is the real gate. This
|
|
421
|
+
* only fires for a graph with such an edge on the lowest rank (none of the 115
|
|
422
|
+
* goldens have one), so it is byte-safe. @see lib/dotgen/flat.c:flat_edges 279
|
|
423
|
+
*/
|
|
424
|
+
export function needsAbomination(g: Graph): boolean {
|
|
425
|
+
const mn = graphMinrank(g);
|
|
426
|
+
const rank = g.info.rank;
|
|
427
|
+
if (!rank || rank[mn] === undefined) return false;
|
|
428
|
+
return rankHasNonAdjacentLabel(rank[mn]);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/** Label width contribution (flip-aware), or 0 if no label dimen. */
|
|
432
|
+
function labelWidth(g: Graph, e: Edge): number {
|
|
433
|
+
const lbl = e.info.label as (LabelWithDimen | undefined);
|
|
434
|
+
if (!lbl || !lbl.dimen) return 0;
|
|
435
|
+
return g.info.flip === true ? lbl.dimen.y : lbl.dimen.x;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** Store the representative's flat-label width directly. @see flat.c:300 */
|
|
439
|
+
export function applyLabelDist(g: Graph, e: Edge): void {
|
|
440
|
+
e.info.dist = labelWidth(g, e);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** Resolve a flat edge to its class representative via the to_virt chain.
|
|
444
|
+
* @see lib/dotgen/flat.c:flat_edges (`while (ED_to_virt(le)) le = ED_to_virt(le)`) */
|
|
445
|
+
function flatClassRep(e: Edge): Edge {
|
|
446
|
+
let le = e;
|
|
447
|
+
while (le.info.to_virt) le = le.info.to_virt;
|
|
448
|
+
return le;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** flat_out loop body: store label dist on e (the rep), or add a label vnode.
|
|
452
|
+
* @see lib/dotgen/flat.c:flat_edges 296-307 */
|
|
453
|
+
export function processFlatOutLabel(g: Graph, e: Edge, reset: boolean): boolean {
|
|
454
|
+
if (!isLabeledFlat(e)) return reset;
|
|
455
|
+
if (e.info.adjacent) { applyLabelDist(g, e); return reset; }
|
|
456
|
+
flatNode(g, e);
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** other loop body: inherit adjacency from the class rep, and for an adjacent
|
|
461
|
+
* labeled edge MAX its label width onto the rep's dist (not the edge itself);
|
|
462
|
+
* non-adjacent labeled edges add a label vnode. Skips cross-rank and self
|
|
463
|
+
* edges. @see lib/dotgen/flat.c:flat_edges 309-326 */
|
|
464
|
+
export function processOtherLabel(g: Graph, e: Edge, reset: boolean): boolean {
|
|
465
|
+
if (nodeRank(e.tail) !== nodeRank(e.head)) return reset;
|
|
466
|
+
if (e.tail === e.head) return reset;
|
|
467
|
+
const le = flatClassRep(e);
|
|
468
|
+
e.info.adjacent = le.info.adjacent;
|
|
469
|
+
if (!isLabeledFlat(e)) return reset;
|
|
470
|
+
if (e.info.adjacent) {
|
|
471
|
+
le.info.dist = Math.max(labelWidth(g, e), le.info.dist ?? 0);
|
|
472
|
+
return reset;
|
|
473
|
+
}
|
|
474
|
+
flatNode(g, e);
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* The flat_edges dist/label-vnode pass. C nests BOTH the flat_out and other
|
|
480
|
+
* loops inside `if (ND_flat_out(n).list)`, so a node with no flat_out processes
|
|
481
|
+
* neither. @see lib/dotgen/flat.c:flat_edges 288-330
|
|
482
|
+
*/
|
|
483
|
+
export function processNodes(g: Graph): boolean {
|
|
484
|
+
let reset = false;
|
|
485
|
+
for (let n: Node | undefined = g.info.nlist; n; n = n.info.next) {
|
|
486
|
+
const fo = n.info.flat_out;
|
|
487
|
+
if (!fo) continue;
|
|
488
|
+
for (let i = 0; i < fo.size; i++) reset = processFlatOutLabel(g, fo.list[i], reset);
|
|
489
|
+
const ot = n.info.other;
|
|
490
|
+
if (ot) for (let i = 0; i < ot.size; i++) reset = processOtherLabel(g, ot.list[i], reset);
|
|
491
|
+
}
|
|
492
|
+
return reset;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// ---------------------------------------------------------------------------
|
|
496
|
+
// flatEdges @see lib/dotgen/flat.c:flat_edges
|
|
497
|
+
// ---------------------------------------------------------------------------
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Process flat edges for label placement and abomination.
|
|
501
|
+
* Returns true if rank arrays were modified (label nodes inserted).
|
|
502
|
+
* @see lib/dotgen/flat.c:flat_edges
|
|
503
|
+
*/
|
|
504
|
+
export function flatEdges(g: Graph): boolean {
|
|
505
|
+
markAdjacent(g);
|
|
506
|
+
if (needsAbomination(g)) abomination(g);
|
|
507
|
+
recSaveVlists(g);
|
|
508
|
+
const reset = processNodes(g);
|
|
509
|
+
if (reset) {
|
|
510
|
+
checkLabelOrder(g);
|
|
511
|
+
// Cluster rank windows (rankleader/vStart/n) are stale once flat_node
|
|
512
|
+
// inserted label vnodes and shifted ND_order; C re-derives them here.
|
|
513
|
+
// Only Root is consulted by the reset chain, so a bare {root} suffices
|
|
514
|
+
// in place of the mincross-pass context. @see lib/dotgen/flat.c:333
|
|
515
|
+
recResetVlists({ root: dotRoot(g) }, g);
|
|
516
|
+
}
|
|
517
|
+
return reset;
|
|
518
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cluster label dimension setup for dot layout.
|
|
5
|
+
*
|
|
6
|
+
* @see lib/common/input.c:do_graph_label
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Graph } from '../../model/graph.js';
|
|
10
|
+
import type { Point } from '../../model/geom.js';
|
|
11
|
+
import type { TextMeasurer } from '../../common/textmeasure.js';
|
|
12
|
+
import { makeAnyLabel, DEFAULT_FONTSIZE, DEFAULT_FONTNAME, DEFAULT_COLOR } from '../../common/make-label.js';
|
|
13
|
+
import { isHtmlValue, htmlValueContent } from '../../common/html-string.js';
|
|
14
|
+
import { BOTTOM_IX, TOP_IX, RIGHT_IX, LEFT_IX } from './position-aux.js';
|
|
15
|
+
|
|
16
|
+
/** Graph has a label. @see lib/common/const.h:GRAPH_LABEL */
|
|
17
|
+
export const GRAPH_LABEL = 1 << 3;
|
|
18
|
+
|
|
19
|
+
/** @see lib/common/const.h:GAP */
|
|
20
|
+
const GAP = 4;
|
|
21
|
+
|
|
22
|
+
/** LABEL_AT_BOTTOM=0, LABEL_AT_TOP=1, LABEL_AT_LEFT=2, LABEL_AT_RIGHT=4.
|
|
23
|
+
* @see lib/common/const.h */
|
|
24
|
+
const LABEL_AT_TOP = 1;
|
|
25
|
+
const LABEL_AT_LEFT = 2;
|
|
26
|
+
const LABEL_AT_RIGHT = 4;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Cluster label-position flag from `labelloc` (top/bottom) AND `labeljust`
|
|
30
|
+
* (left/right), mirroring C `do_graph_label`. The cluster default is TOP (the
|
|
31
|
+
* root default is BOTTOM — see rootLabelPos); the labeljust logic is identical
|
|
32
|
+
* for both. Both keys inherit from an ancestor's default (C `agget`), so read
|
|
33
|
+
* them through graphAttrInherited — the same helper `label`/`fontname` use —
|
|
34
|
+
* not raw `sg.attrs`, else an inherited `labelloc=bottom` is lost.
|
|
35
|
+
* @see lib/common/input.c:858-877 do_graph_label
|
|
36
|
+
*/
|
|
37
|
+
function readLabelPos(sg: Graph): number {
|
|
38
|
+
const loc = graphAttrInherited(sg, 'labelloc');
|
|
39
|
+
let pos = loc && loc[0] === 'b' ? 0 : LABEL_AT_TOP;
|
|
40
|
+
const just = graphAttrInherited(sg, 'labeljust');
|
|
41
|
+
if (just) {
|
|
42
|
+
if (just[0] === 'l') pos |= LABEL_AT_LEFT;
|
|
43
|
+
else if (just[0] === 'r') pos |= LABEL_AT_RIGHT;
|
|
44
|
+
}
|
|
45
|
+
return pos;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Read a graph attribute with subgraph→root inheritance, mirroring C's
|
|
50
|
+
* agxget (late_nnstring(sg, agfindgraphattr(sg, key), ...) in do_graph_label):
|
|
51
|
+
* a cluster inherits `fontname`/`fontsize`/`fontcolor` set on an ancestor
|
|
52
|
+
* (e.g. root `graph[fontname=Arial]`) when it sets none of its own.
|
|
53
|
+
* @see lib/common/input.c:do_graph_label
|
|
54
|
+
*/
|
|
55
|
+
function graphAttrInherited(sg: Graph, key: string): string | undefined {
|
|
56
|
+
// Own value wins; otherwise the ancestor defaults SNAPSHOTTED when this
|
|
57
|
+
// subgraph opened (not a live parent walk) — so an ancestor attribute set
|
|
58
|
+
// later in statement order does not retroactively apply (2184).
|
|
59
|
+
// @see lib/cgraph/graph.c:agsubg (parse-time defval copy)
|
|
60
|
+
return sg.attrs.get(key) ?? sg.graphDefaultsSnapshot?.get(key);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readFontParams(sg: Graph): { fontsize: number; fontname: string; fontcolor: string } {
|
|
64
|
+
return {
|
|
65
|
+
fontsize: parseFloat(graphAttrInherited(sg, 'fontsize') ?? '') || DEFAULT_FONTSIZE,
|
|
66
|
+
fontname: graphAttrInherited(sg, 'fontname') ?? DEFAULT_FONTNAME,
|
|
67
|
+
fontcolor: graphAttrInherited(sg, 'fontcolor') ?? DEFAULT_COLOR,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Apply PAD and store in sg.info.border at the index appropriate for flip/pos. */
|
|
72
|
+
function applyLabelBorder(sg: Graph, dimen: Point): void {
|
|
73
|
+
if (!sg.info.border) {
|
|
74
|
+
sg.info.border = [{ x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }];
|
|
75
|
+
}
|
|
76
|
+
const labelPos = sg.info.label_pos ?? 1;
|
|
77
|
+
if (!sg.root.info.flip) {
|
|
78
|
+
sg.info.border[(labelPos & 1) ? TOP_IX : BOTTOM_IX] = dimen;
|
|
79
|
+
} else {
|
|
80
|
+
sg.info.border[(labelPos & 1) ? RIGHT_IX : LEFT_IX] = { x: dimen.y, y: dimen.x };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Compute cluster label dimensions and set sg.info.border so that clustHt
|
|
86
|
+
* accounts for label height.
|
|
87
|
+
*
|
|
88
|
+
* @see lib/common/input.c:do_graph_label
|
|
89
|
+
* @see lib/common/input.c:850 — make_label(sg, str, aghtmlstr(str), false, ...)
|
|
90
|
+
*/
|
|
91
|
+
export function doGraphLabel(sg: Graph, measurer: TextMeasurer | undefined): void {
|
|
92
|
+
if (!measurer) return;
|
|
93
|
+
// C reads agget(sg, "label"), which returns the value seeded at subgraph
|
|
94
|
+
// creation from the nearest ancestor's default (agmakeattrs copies the parent
|
|
95
|
+
// dict's defvals). So a cluster with no label of its own inherits a parent
|
|
96
|
+
// cluster's — or even the root graph's — label. graphviz #1323's nested
|
|
97
|
+
// cluster_mount1/cluster_mount2 (label commented out) inherit the enclosing
|
|
98
|
+
// cluster_vfsmount's "struct vfsmount" and each render it.
|
|
99
|
+
// @see lib/common/input.c:844 do_graph_label — agget(sg, "label")
|
|
100
|
+
// @see lib/cgraph/attr.c:165 agmakeattrs — copies parent defvals at creation
|
|
101
|
+
const str = graphAttrInherited(sg, 'label');
|
|
102
|
+
if (!str) return;
|
|
103
|
+
|
|
104
|
+
const { fontsize, fontname, fontcolor } = readFontParams(sg);
|
|
105
|
+
const isHtml = isHtmlValue(str);
|
|
106
|
+
const content = isHtml ? htmlValueContent(str) : str;
|
|
107
|
+
const label = makeAnyLabel(content, isHtml, { fontname, fontsize, fontcolor }, measurer, sg);
|
|
108
|
+
sg.info.label = label;
|
|
109
|
+
sg.root.info.has_labels |= GRAPH_LABEL;
|
|
110
|
+
|
|
111
|
+
if (sg === sg.root) return;
|
|
112
|
+
sg.info.label_pos = readLabelPos(sg);
|
|
113
|
+
applyLabelBorder(sg, { x: label.dimen.x + 4 * GAP, y: label.dimen.y + 2 * GAP });
|
|
114
|
+
}
|