@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,734 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSON and JSON0 renderer plugins.
|
|
5
|
+
*
|
|
6
|
+
* Ports plugin/core/gvrender_core_json.c — FORMAT_JSON and FORMAT_JSON0.
|
|
7
|
+
* FORMAT_DOT_JSON and FORMAT_XDOT_JSON are out of scope (AD-12).
|
|
8
|
+
*
|
|
9
|
+
* ## Draw-op / layout-attr sourcing (mirrors C's json_begin_graph)
|
|
10
|
+
*
|
|
11
|
+
* C's `json_begin_graph` (FORMAT_JSON) clones the GVC and runs a full
|
|
12
|
+
* `gvRender(gvc, g, "xdot", NULL)` over the already-laid-out graph. That xdot
|
|
13
|
+
* pass attaches every draw string (`_draw_`, `_ldraw_`, ...) plus the layout
|
|
14
|
+
* attributes (`pos`, `width`, `height`, `bb`, `xdotversion`) to the graph
|
|
15
|
+
* objects as cgraph string attributes; `json_end_graph` then serializes them,
|
|
16
|
+
* re-parsing each xdot draw string into an array of typed op objects
|
|
17
|
+
* (`write_xdot`). This port mirrors that literally: it re-renders the laid-out
|
|
18
|
+
* graph to xdot text via a fresh context and parses the text back (the same
|
|
19
|
+
* technique as `getDrawOps`/`layoutAndRenderXdot`), then looks each object's
|
|
20
|
+
* draw + layout attributes up by identity. Structure (subgraph tree, node/edge
|
|
21
|
+
* membership) and user/inherited attributes come from the ORIGINAL laid-out
|
|
22
|
+
* graph — the same object C's `json_end_graph` walks — because the port's xdot
|
|
23
|
+
* writer omits user attributes (color/label/shape) and filters "irrelevant"
|
|
24
|
+
* subgraphs, so the xdot re-parse alone is not a faithful source of structure.
|
|
25
|
+
*
|
|
26
|
+
* Output is emitted as a semantically-equivalent JSON value tree
|
|
27
|
+
* (`JSON.stringify`); byte-for-byte formatting is not required — the
|
|
28
|
+
* conformance bar is the semantic `compare-json` comparator (±0.01, colors /
|
|
29
|
+
* fonts canonicalized). `stoj`/`ind` are retained as the C-faithful string
|
|
30
|
+
* helpers referenced by the unit tests.
|
|
31
|
+
*
|
|
32
|
+
* @see plugin/core/gvrender_core_json.c
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import type { Graph } from '../model/graph.js';
|
|
36
|
+
import type { Node } from '../model/node.js';
|
|
37
|
+
import type { Edge } from '../model/edge.js';
|
|
38
|
+
import type { Point } from '../model/geom.js';
|
|
39
|
+
import type { TextSpan } from '../common/emit-types.js';
|
|
40
|
+
import type { RendererPlugin } from '../gvc/context.js';
|
|
41
|
+
import type { RenderJob } from '../gvc/job.js';
|
|
42
|
+
import type { XdotOp, XdotColor } from '../xdot/types.js';
|
|
43
|
+
import type { TextlabelT, FieldT } from '../common/types.js';
|
|
44
|
+
import { printNum, gfmt5, XdotRenderer, type XdotDraws } from './dot.js';
|
|
45
|
+
import { CHAR_LATIN1 } from '../common/graph-init.js';
|
|
46
|
+
import { parse } from '../parser/index.js';
|
|
47
|
+
import { render as deviceRender } from '../gvc/device.js';
|
|
48
|
+
import { createDefaultContext } from '../gvc/default-context.js';
|
|
49
|
+
import { parseXDot } from '../xdot/index.js';
|
|
50
|
+
import { isHtmlValue, htmlValueContent } from '../common/html-string.js';
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Constants
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
/** Draw-op attribute names re-serialized as typed op arrays. @see isXDot */
|
|
57
|
+
const XDOT_ATTR_NAMES: ReadonlySet<string> = new Set([
|
|
58
|
+
'_draw_', '_ldraw_', '_hdraw_', '_tdraw_', '_hldraw_', '_tldraw_',
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
/** Built-in node label default installed by graphviz (`\N`). Emitted for every
|
|
62
|
+
* node with no explicit/inherited label. @see lib/common/input.c NODENAME */
|
|
63
|
+
const DEFAULT_NODE_LABEL = '\\N';
|
|
64
|
+
|
|
65
|
+
/** Loosely-typed JSON value tree, serialized with JSON.stringify. */
|
|
66
|
+
type JVal = string | number | boolean | JVal[] | JObj;
|
|
67
|
+
interface JObj { [k: string]: JVal; }
|
|
68
|
+
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// stoj — @see plugin/core/gvrender_core_json.c:stoj
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
/** Convert a dot string to a JSON-embedded string (with surrounding quotes). */
|
|
74
|
+
export function stoj(s: string): string {
|
|
75
|
+
let r = '"';
|
|
76
|
+
for (const c of s) {
|
|
77
|
+
switch (c) {
|
|
78
|
+
case '"': r += '\\"'; break;
|
|
79
|
+
case '\\': r += '\\\\'; break;
|
|
80
|
+
case '/': r += '\\/'; break;
|
|
81
|
+
case '\b': r += '\\b'; break;
|
|
82
|
+
case '\f': r += '\\f'; break;
|
|
83
|
+
case '\n': r += '\\n'; break;
|
|
84
|
+
case '\r': r += '\\r'; break;
|
|
85
|
+
case '\t': r += '\\t'; break;
|
|
86
|
+
default: r += c;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return r + '"';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// indent — @see plugin/core/gvrender_core_json.c:indent
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
export function ind(level: number): string {
|
|
97
|
+
return ' '.repeat(level);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// isXDot — @see plugin/core/gvrender_core_json.c:isXDot
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
function isXDot(name: string): boolean {
|
|
105
|
+
return XDOT_ATTR_NAMES.has(name);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Draw-op serialization — @see plugin/core/gvrender_core_json.c:write_xdot
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
/** Flatten an xdot polyline to `[[x,y],...]`. @see write_polyline */
|
|
113
|
+
function opPoints(pts: ReadonlyArray<{ x: number; y: number }>): JVal[] {
|
|
114
|
+
return pts.map((p) => [p.x, p.y] as JVal);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Gradient stops as `[{frac,color},...]`. @see write_stops */
|
|
118
|
+
function gradStops(stops: ReadonlyArray<{ frac: number; color: string }>): JVal[] {
|
|
119
|
+
return stops.map((s) => ({ frac: s.frac, color: s.color } as JObj));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Serialize a gradient color op. @see write_xdot xd_grad_* / write_*_grad */
|
|
123
|
+
function gradColorOp(op: 'C' | 'c', c: XdotColor): JObj {
|
|
124
|
+
if (c.type === 'none') {
|
|
125
|
+
return { op, grad: 'none', color: c.clr };
|
|
126
|
+
}
|
|
127
|
+
if (c.type === 'linear') {
|
|
128
|
+
const g = c.ling;
|
|
129
|
+
return { op, grad: 'linear', p0: [g.x0, g.y0], p1: [g.x1, g.y1], stops: gradStops(g.stops) };
|
|
130
|
+
}
|
|
131
|
+
const g = c.ring;
|
|
132
|
+
return {
|
|
133
|
+
op, grad: 'radial',
|
|
134
|
+
p0: [g.x0, g.y0, g.r0], p1: [g.x1, g.y1, g.r1], stops: gradStops(g.stops),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Serialize one parsed xdot op to its JSON op-object shape. @see write_xdot */
|
|
139
|
+
function opToJson(op: XdotOp, isLatin: boolean): JObj {
|
|
140
|
+
switch (op.kind) {
|
|
141
|
+
case 'filled_ellipse':
|
|
142
|
+
case 'unfilled_ellipse': {
|
|
143
|
+
const e = op.ellipse;
|
|
144
|
+
return { op: op.kind === 'filled_ellipse' ? 'E' : 'e', rect: [e.x, e.y, e.w, e.h] };
|
|
145
|
+
}
|
|
146
|
+
case 'filled_polygon':
|
|
147
|
+
case 'unfilled_polygon':
|
|
148
|
+
return { op: op.kind === 'filled_polygon' ? 'P' : 'p', points: opPoints(op.polygon.pts) };
|
|
149
|
+
case 'filled_bezier':
|
|
150
|
+
case 'unfilled_bezier':
|
|
151
|
+
return { op: op.kind === 'filled_bezier' ? 'B' : 'b', points: opPoints(op.bezier.pts) };
|
|
152
|
+
case 'polyline':
|
|
153
|
+
return { op: 'L', points: opPoints(op.polyline.pts) };
|
|
154
|
+
case 'text': {
|
|
155
|
+
const t = op.text;
|
|
156
|
+
const align = t.align === 'left' ? 'l' : t.align === 'center' ? 'c' : 'r';
|
|
157
|
+
// charset=latin1: draw text is stored already-UTF-8, so C's stoj pass
|
|
158
|
+
// double-encodes it (unlike raw-stored attribute values). @see latin1Reencode
|
|
159
|
+
return { op: 'T', pt: [t.x, t.y], align, width: t.width,
|
|
160
|
+
text: isLatin ? latin1Reencode(t.text) : t.text };
|
|
161
|
+
}
|
|
162
|
+
case 'fill_color':
|
|
163
|
+
case 'pen_color':
|
|
164
|
+
return { op: op.kind === 'fill_color' ? 'C' : 'c', grad: 'none', color: op.color };
|
|
165
|
+
case 'grad_fill_color':
|
|
166
|
+
case 'grad_pen_color':
|
|
167
|
+
return gradColorOp(op.kind === 'grad_fill_color' ? 'C' : 'c', op.gradColor);
|
|
168
|
+
case 'font':
|
|
169
|
+
return { op: 'F', size: op.font.size, face: op.font.name };
|
|
170
|
+
case 'style':
|
|
171
|
+
return { op: 'S', style: op.style };
|
|
172
|
+
case 'fontchar':
|
|
173
|
+
return { op: 't', fontchar: op.fontchar };
|
|
174
|
+
case 'image':
|
|
175
|
+
// C's write_xdot emits an empty op object for xd_image (no fields).
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Parse an xdot draw string into its JSON op-object array. @see write_xdots */
|
|
181
|
+
function drawStringToOps(val: string, isLatin: boolean): JVal[] {
|
|
182
|
+
if (val === '') return [];
|
|
183
|
+
const parsed = parseXDot(val);
|
|
184
|
+
if (parsed === null) return [];
|
|
185
|
+
return parsed.ops.map((op) => opToJson(op, isLatin));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ---------------------------------------------------------------------------
|
|
189
|
+
// Draw / layout attribute lookup — mirrors json_begin_graph's xdot render
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
|
|
192
|
+
/** Per-object xdot/layout attribute strings, keyed by identity. */
|
|
193
|
+
interface DrawLookup {
|
|
194
|
+
/** Root-graph xdot attrs (`_draw_`, `bb`, `xdotversion`, ...). */
|
|
195
|
+
graph: Map<string, string>;
|
|
196
|
+
/** Node xdot/layout attrs by node name. */
|
|
197
|
+
node: Map<string, Map<string, string>>;
|
|
198
|
+
/** Cluster xdot/layout attrs, keyed by the original-graph cluster object
|
|
199
|
+
* (name is ambiguous — see collectDrawLookup). */
|
|
200
|
+
cluster: Map<Graph, Map<string, string>>;
|
|
201
|
+
/** Edge xdot/layout attrs by the original graph's Edge object. */
|
|
202
|
+
edge: Map<Edge, Map<string, string>>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Root edges in agfstnode/agfstout order, each tagged with its canonical
|
|
206
|
+
* `tail head occurrence` key (stable across the port/xdot re-parse). */
|
|
207
|
+
function canonicalRootEdges(g: Graph): Array<{ e: Edge; key: string }> {
|
|
208
|
+
const out: Array<{ e: Edge; key: string }> = [];
|
|
209
|
+
const counter = new Map<string, number>();
|
|
210
|
+
for (const [, n] of g.nodes) {
|
|
211
|
+
for (const e of n.outEdges(g)) {
|
|
212
|
+
const base = e.tail.name + '' + e.head.name;
|
|
213
|
+
const occ = counter.get(base) ?? 0;
|
|
214
|
+
counter.set(base, occ + 1);
|
|
215
|
+
out.push({ e, key: base + '' + occ });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** XdotDraws field → xdot draw-attribute name. */
|
|
222
|
+
const DRAW_FIELDS: ReadonlyArray<readonly [keyof XdotDraws, string]> = [
|
|
223
|
+
['draw', '_draw_'], ['ldraw', '_ldraw_'], ['hdraw', '_hdraw_'],
|
|
224
|
+
['tdraw', '_tdraw_'], ['hldraw', '_hldraw_'], ['tldraw', '_tldraw_'],
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
/** Overlay an object's pre-serialization draw strings onto its attr map,
|
|
228
|
+
* replacing the DOT-round-trip values (which drop a `\` before a `"`). */
|
|
229
|
+
function applyDraws(attrs: Map<string, string> | undefined, d: XdotDraws | undefined): void {
|
|
230
|
+
if (attrs === undefined || d === undefined) return;
|
|
231
|
+
for (const [field, attr] of DRAW_FIELDS) {
|
|
232
|
+
const v = d[field];
|
|
233
|
+
if (v !== undefined) attrs.set(attr, v);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Re-render the laid-out graph to xdot and index every object's draw/layout
|
|
238
|
+
* attributes by identity. Returns `undefined` if the re-render fails (e.g. a
|
|
239
|
+
* hand-built graph with no real layout state) so callers fall back cleanly. */
|
|
240
|
+
function collectDrawLookup(g: Graph): DrawLookup | undefined {
|
|
241
|
+
let xg: Graph;
|
|
242
|
+
// Inject our own XdotRenderer (last-registered wins bestRenderer) so we can
|
|
243
|
+
// read its per-object draw strings AFTER the render: the DOT-text re-parse
|
|
244
|
+
// below is faithful for coordinates but LOSSY for draw text containing `"`
|
|
245
|
+
// (a DOT quoted string cannot hold `\` before `"`; a cluster label's `\"`
|
|
246
|
+
// round-trips to `"`, id 2239). The draws map holds the pre-serialization
|
|
247
|
+
// strings C's -Tjson reads directly, so we overlay them onto the re-parse.
|
|
248
|
+
const xr = new XdotRenderer();
|
|
249
|
+
try {
|
|
250
|
+
const ctx = createDefaultContext();
|
|
251
|
+
ctx.register(xr);
|
|
252
|
+
const xdotText = deviceRender(ctx, g, 'xdot');
|
|
253
|
+
xg = parse(xdotText);
|
|
254
|
+
} catch {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
const draws = xr.drawStringsByObject();
|
|
258
|
+
const node = new Map<string, Map<string, string>>();
|
|
259
|
+
for (const [nm, xn] of xg.nodes) node.set(nm, new Map(xn.attrs));
|
|
260
|
+
// Correlate each original-graph cluster with its xdot-re-render attrs by a
|
|
261
|
+
// PARALLEL walk keyed on the cluster OBJECT, not its name. A bare-name Map
|
|
262
|
+
// collides when two clusters share a name at different tree depths (empty
|
|
263
|
+
// `cluster_1` in `cluster_0` + a real top-level `cluster_1` — graphs-b7).
|
|
264
|
+
// xg holds only the drawable clusters (the xdot writer drops anonymous/rank
|
|
265
|
+
// subgraphs), so when a g-child has no same-named xg-child at this level it
|
|
266
|
+
// is a filtered non-cluster (or a cluster nested under one): descend g but
|
|
267
|
+
// hold the xg position, matching xg's flattened cluster tree (1436).
|
|
268
|
+
const cluster = new Map<Graph, Map<string, string>>();
|
|
269
|
+
const correlate = (gSub: Graph, xgSub: Graph): void => {
|
|
270
|
+
for (const [nm, gChild] of gSub.subgraphs) {
|
|
271
|
+
const xgChild = xgSub.subgraphs.get(nm);
|
|
272
|
+
if (xgChild !== undefined) {
|
|
273
|
+
cluster.set(gChild, new Map(xgChild.attrs));
|
|
274
|
+
correlate(gChild, xgChild);
|
|
275
|
+
} else {
|
|
276
|
+
correlate(gChild, xgSub);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
correlate(g, xg);
|
|
281
|
+
// Edge draw attrs: match g-edges to xg-edges by the shared canonical key.
|
|
282
|
+
const xByKey = new Map<string, Map<string, string>>();
|
|
283
|
+
for (const { e, key } of canonicalRootEdges(xg)) xByKey.set(key, new Map(e.attrs));
|
|
284
|
+
const edge = new Map<Edge, Map<string, string>>();
|
|
285
|
+
for (const { e, key } of canonicalRootEdges(g)) {
|
|
286
|
+
const a = xByKey.get(key);
|
|
287
|
+
if (a !== undefined) edge.set(e, a);
|
|
288
|
+
}
|
|
289
|
+
const graphAttrs = new Map(xg.attrs);
|
|
290
|
+
// Overlay the lossless per-object draw strings, keyed by the ORIGINAL object,
|
|
291
|
+
// over the (coordinate-faithful but draw-text-lossy) re-parsed attrs.
|
|
292
|
+
applyDraws(graphAttrs, draws.get(g));
|
|
293
|
+
for (const [nm, gn] of g.nodes) applyDraws(node.get(nm), draws.get(gn));
|
|
294
|
+
for (const [gc, attrs] of cluster) applyDraws(attrs, draws.get(gc));
|
|
295
|
+
for (const [ge, attrs] of edge) applyDraws(attrs, draws.get(ge));
|
|
296
|
+
return { graph: graphAttrs, node, cluster, edge };
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ---------------------------------------------------------------------------
|
|
300
|
+
// Object-id assignment — @see write_graph / label_subgs
|
|
301
|
+
// ---------------------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
interface BuildCtx {
|
|
304
|
+
doXDot: boolean;
|
|
305
|
+
draws?: DrawLookup;
|
|
306
|
+
sgcnt: number;
|
|
307
|
+
subgGid: Map<Graph, number>;
|
|
308
|
+
nodeGid: Map<Node, number>;
|
|
309
|
+
edgeGid: Map<Edge, number>;
|
|
310
|
+
/** All subgraphs in DFS preorder (the flat top-level "objects" ordering). */
|
|
311
|
+
dfsSubs: Graph[];
|
|
312
|
+
/** True once any edge (or edge default) declares `label`: cgraph then carries
|
|
313
|
+
* a global `label` edge symbol, and write_attrs emits `label` (its value or
|
|
314
|
+
* the empty default) on EVERY edge — the empty-value skip exempts `label`.
|
|
315
|
+
* @see write_attrs (`*attrval=='\0' && !streq(sym->name,"label")`) */
|
|
316
|
+
edgeLabelDeclared: boolean;
|
|
317
|
+
/** Same as `edgeLabelDeclared`, for the graph-type `label` symbol: once any
|
|
318
|
+
* graph or cluster carries a label, the root and every subgraph emit `label`
|
|
319
|
+
* (their own value or the empty default). @see write_attrs label exemption */
|
|
320
|
+
graphLabelDeclared: boolean;
|
|
321
|
+
/** charset=latin1: draw-op text was stored already-UTF-8, so C's `stoj`
|
|
322
|
+
* double-encodes it. @see latin1Reencode */
|
|
323
|
+
isLatin: boolean;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** Whether a graph-type `label` symbol is declared anywhere (root, any cluster,
|
|
327
|
+
* or subgraph carries a label). @see BuildCtx.graphLabelDeclared */
|
|
328
|
+
function isGraphLabelDeclared(g: Graph): boolean {
|
|
329
|
+
if (g.attrs.has('label')) return true;
|
|
330
|
+
const lbl = graphLabel(g.info);
|
|
331
|
+
if (lbl !== undefined && lbl.text !== '') return true;
|
|
332
|
+
for (const [, sg] of g.subgraphs) if (isGraphLabelDeclared(sg)) return true;
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** Effective graph attributes: a subgraph inherits its enclosing graphs'
|
|
337
|
+
* graph-attribute values (agxget inheritance), captured at build time in
|
|
338
|
+
* `graphDefaultsSnapshot`; the root uses only its own. */
|
|
339
|
+
function graphEffectiveAttrs(g: Graph, top: boolean): Map<string, string> {
|
|
340
|
+
if (top) return g.attrs;
|
|
341
|
+
const m = new Map<string, string>(g.graphDefaultsSnapshot ?? []);
|
|
342
|
+
for (const [k, v] of g.attrs) m.set(k, v);
|
|
343
|
+
return m;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Whether a `label` edge attribute symbol is declared anywhere in the graph
|
|
347
|
+
* (an explicit edge label or an `edge [label=...]` default). */
|
|
348
|
+
function isEdgeLabelDeclared(g: Graph): boolean {
|
|
349
|
+
for (const e of g.edges) if (e.attrs.has('label')) return true;
|
|
350
|
+
const walk = (sg: Graph): boolean => {
|
|
351
|
+
if (sg.edgeDefaults.has('label')) return true;
|
|
352
|
+
for (const [, sub] of sg.subgraphs) if (walk(sub)) return true;
|
|
353
|
+
return false;
|
|
354
|
+
};
|
|
355
|
+
return walk(g);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** DFS preorder over the subgraph tree. @see label_subgs recursion order */
|
|
359
|
+
function dfsSubgraphs(g: Graph, out: Graph[]): void {
|
|
360
|
+
for (const [, sg] of g.subgraphs) {
|
|
361
|
+
out.push(sg);
|
|
362
|
+
dfsSubgraphs(sg, out);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** Assign every object its `_gvid`, mirroring write_graph's top-level pass:
|
|
367
|
+
* subgraphs DFS-preorder 0..sgcnt-1, then nodes sgcnt.., then edges 0.. in
|
|
368
|
+
* agfstnode/agfstout order. @see plugin/core/gvrender_core_json.c:write_graph */
|
|
369
|
+
function assignIds(g: Graph, doXDot: boolean, draws?: DrawLookup): BuildCtx {
|
|
370
|
+
const dfsSubs: Graph[] = [];
|
|
371
|
+
dfsSubgraphs(g, dfsSubs);
|
|
372
|
+
const subgGid = new Map<Graph, number>();
|
|
373
|
+
dfsSubs.forEach((sg, i) => subgGid.set(sg, i));
|
|
374
|
+
const sgcnt = dfsSubs.length;
|
|
375
|
+
const nodeGid = new Map<Node, number>();
|
|
376
|
+
let ncnt = 0;
|
|
377
|
+
for (const [, n] of g.nodes) nodeGid.set(n, sgcnt + ncnt++);
|
|
378
|
+
const edgeGid = new Map<Edge, number>();
|
|
379
|
+
let ecnt = 0;
|
|
380
|
+
for (const { e } of canonicalRootEdges(g)) edgeGid.set(e, ecnt++);
|
|
381
|
+
return {
|
|
382
|
+
doXDot, draws, sgcnt, subgGid, nodeGid, edgeGid, dfsSubs,
|
|
383
|
+
edgeLabelDeclared: isEdgeLabelDeclared(g),
|
|
384
|
+
graphLabelDeclared: isGraphLabelDeclared(g),
|
|
385
|
+
isLatin: g.info.charset === CHAR_LATIN1,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// ---------------------------------------------------------------------------
|
|
390
|
+
// Attribute emission — @see write_attrs
|
|
391
|
+
// ---------------------------------------------------------------------------
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Emit an object's attributes into `o`, mirroring C's write_attrs: `agxget`
|
|
395
|
+
* returns HTML-string content with the marker stripped, empty non-`label`
|
|
396
|
+
* values are skipped, and xdot draw attrs are re-serialized as op arrays.
|
|
397
|
+
* `base` carries user/inherited attrs; `overlay` (from the xdot re-render)
|
|
398
|
+
* supplies the post-layout `pos`/`width`/`height`/`bb`/draw strings and wins
|
|
399
|
+
* on conflict.
|
|
400
|
+
*/
|
|
401
|
+
function emitAttrs(
|
|
402
|
+
o: JObj,
|
|
403
|
+
base: Map<string, string>,
|
|
404
|
+
overlay: Map<string, string> | undefined,
|
|
405
|
+
ctx: BuildCtx,
|
|
406
|
+
): void {
|
|
407
|
+
const merged = new Map(base);
|
|
408
|
+
if (overlay !== undefined) for (const [k, v] of overlay) merged.set(k, v);
|
|
409
|
+
for (const [k, rawV] of merged) {
|
|
410
|
+
// agxget mirror: HTML strings surface as their marker-stripped content.
|
|
411
|
+
const v = isHtmlValue(rawV) ? htmlValueContent(rawV) : rawV;
|
|
412
|
+
if (v === '' && k !== 'label') continue;
|
|
413
|
+
if (ctx.doXDot && isXDot(k)) {
|
|
414
|
+
o[k] = drawStringToOps(v, ctx.isLatin);
|
|
415
|
+
} else if (!isXDot(k)) {
|
|
416
|
+
o[k] = v;
|
|
417
|
+
}
|
|
418
|
+
// json0 (!doXDot): xdot draw attrs are not emitted at all.
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ---------------------------------------------------------------------------
|
|
423
|
+
// Label geometry — @see attach_attrs_and_arrows / rec_attach_bb (output.c)
|
|
424
|
+
// ---------------------------------------------------------------------------
|
|
425
|
+
//
|
|
426
|
+
// The port's xdot writer omits the label-geometry attributes that native
|
|
427
|
+
// attach_attrs sets (`lp` for labeled edges; `lp`/`lwidth`/`lheight` for
|
|
428
|
+
// labeled graphs and clusters), so they are sourced here directly from the
|
|
429
|
+
// laid-out model. yDir is identity for the common (non-rankdir=BT/RL) case —
|
|
430
|
+
// coordinates are stored post-layout in the output frame, matching node `pos`.
|
|
431
|
+
|
|
432
|
+
/** The TextlabelT on a graph/cluster info, or undefined. */
|
|
433
|
+
function graphLabel(info: { label?: unknown }): TextlabelT | undefined {
|
|
434
|
+
const l = info.label;
|
|
435
|
+
if (l !== undefined && l !== null && typeof l === 'object' && 'pos' in l) {
|
|
436
|
+
return l as TextlabelT;
|
|
437
|
+
}
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** Format a label position as `x,y`. @see attach_attrs (yDir identity). */
|
|
442
|
+
function labelPos(l: TextlabelT): string {
|
|
443
|
+
return gfmt5(l.pos.x) + ',' + gfmt5(l.pos.y);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Attach edge label positions the port's xdot writer omits: `lp` (center
|
|
447
|
+
* label), `head_lp`/`tail_lp` (end labels), and `xlp` (exterior label, only
|
|
448
|
+
* when its position is set). @see attach_attrs ED_label/head_label/tail_label/xlabel */
|
|
449
|
+
function attachEdgeLabelPositions(o: JObj, e: Edge): void {
|
|
450
|
+
// C attaches pos/lp/head_lp/tail_lp/xlp only inside `if (ED_spl(e))`: a
|
|
451
|
+
// concentrated/merged edge with no spline of its own carries none of them, so
|
|
452
|
+
// its label position must be omitted (2368_1, 2470). @see attach_attrs
|
|
453
|
+
if (!e.info.spl) return;
|
|
454
|
+
if (e.info.label !== undefined) o.lp = labelPos(e.info.label);
|
|
455
|
+
if (e.info.head_label !== undefined) o.head_lp = labelPos(e.info.head_label);
|
|
456
|
+
if (e.info.tail_label !== undefined) o.tail_lp = labelPos(e.info.tail_label);
|
|
457
|
+
const xl = e.info.xlabel as TextlabelT | undefined;
|
|
458
|
+
if (xl !== undefined && xl.set) o.xlp = labelPos(xl);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** Attach a node's exterior-label position `xlp` when set.
|
|
462
|
+
* @see attach_attrs (ND_xlabel && ->set -> "xlp") */
|
|
463
|
+
function attachNodeXlp(o: JObj, n: Node): void {
|
|
464
|
+
const xl = n.info.xlabel as TextlabelT | undefined;
|
|
465
|
+
if (xl !== undefined && xl.set) o.xlp = labelPos(xl);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** Attach `lp`/`lwidth`/`lheight` for a labeled graph/cluster.
|
|
469
|
+
* @see rec_attach_bb (GD_label -> "lp"/"lwidth"/"lheight") */
|
|
470
|
+
function attachGraphLabelGeom(o: JObj, g: Graph): void {
|
|
471
|
+
const lbl = graphLabel(g.info);
|
|
472
|
+
if (lbl !== undefined && lbl.text !== '') {
|
|
473
|
+
o.lp = gfmt5(lbl.pos.x) + ',' + gfmt5(lbl.pos.y);
|
|
474
|
+
o.lwidth = (lbl.dimen.x / 72).toFixed(2);
|
|
475
|
+
o.lheight = (lbl.dimen.y / 72).toFixed(2);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Recursively collect a record node's leaf-field rectangles (node-relative
|
|
480
|
+
* box + node coord), each `LLx,LLy,URx,URy` rounded. @see set_record_rects */
|
|
481
|
+
function setRecordRects(f: FieldT, coord: Point, out: string[]): void {
|
|
482
|
+
if (f.n_flds === 0) {
|
|
483
|
+
out.push(
|
|
484
|
+
gfmt5(f.b.ll.x + coord.x) + ',' + gfmt5(f.b.ll.y + coord.y) + ',' +
|
|
485
|
+
gfmt5(f.b.ur.x + coord.x) + ',' + gfmt5(f.b.ur.y + coord.y),
|
|
486
|
+
);
|
|
487
|
+
} else if (f.fld !== null) {
|
|
488
|
+
for (const sub of f.fld) setRecordRects(sub, coord, out);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** Attach `rects` for a record-shape node. @see attach_attrs (ND_shape==record) */
|
|
493
|
+
function attachNodeRects(o: JObj, n: Node): void {
|
|
494
|
+
const shape = n.info.shape as { name?: string } | undefined;
|
|
495
|
+
if (shape?.name !== 'record') return;
|
|
496
|
+
const f = n.info.shape_info as FieldT | undefined;
|
|
497
|
+
if (f === undefined) return;
|
|
498
|
+
const parts: string[] = [];
|
|
499
|
+
setRecordRects(f, n.info.coord, parts);
|
|
500
|
+
if (parts.length > 0) o.rects = parts.join(' ');
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// ---------------------------------------------------------------------------
|
|
504
|
+
// Node / edge object builders — @see write_node / write_edge
|
|
505
|
+
// ---------------------------------------------------------------------------
|
|
506
|
+
|
|
507
|
+
/** Effective node attributes: inherited defaults, explicit overrides, and the
|
|
508
|
+
* built-in `\N` label default. Mirrors agnxtattr/agxget resolution. */
|
|
509
|
+
function nodeEffectiveAttrs(n: Node): Map<string, string> {
|
|
510
|
+
const m = new Map<string, string>(n.nodeDefaultsSnapshot ?? []);
|
|
511
|
+
for (const [k, v] of n.attrs) m.set(k, v);
|
|
512
|
+
if (!m.has('label')) m.set('label', DEFAULT_NODE_LABEL);
|
|
513
|
+
return m;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** @see plugin/core/gvrender_core_json.c:write_node (top) */
|
|
517
|
+
function buildNodeObject(n: Node, ctx: BuildCtx): JObj {
|
|
518
|
+
const o: JObj = { _gvid: ctx.nodeGid.get(n)!, name: n.name };
|
|
519
|
+
const eff = nodeEffectiveAttrs(n);
|
|
520
|
+
const xd = ctx.draws?.node.get(n.name);
|
|
521
|
+
if (xd === undefined) {
|
|
522
|
+
// Fallback (json0 / hand-built graph): synthesize the layout attrs the
|
|
523
|
+
// xdot render would otherwise supply, from the laid-out node.
|
|
524
|
+
eff.set('pos', printNum(n.info.coord.x) + ',' + printNum(n.info.coord.y));
|
|
525
|
+
eff.set('width', printNum(n.info.width));
|
|
526
|
+
eff.set('height', printNum(n.info.height));
|
|
527
|
+
}
|
|
528
|
+
emitAttrs(o, eff, xd, ctx);
|
|
529
|
+
attachNodeRects(o, n);
|
|
530
|
+
attachNodeXlp(o, n);
|
|
531
|
+
// Only synthesize an empty `_draw_` when the whole xdot re-render failed
|
|
532
|
+
// (hand-built graph / no layout state). When the re-render succeeded, an
|
|
533
|
+
// object with no draw string genuinely has no `_draw_` — the oracle omits
|
|
534
|
+
// the key too, so forcing it here would be a spurious divergence.
|
|
535
|
+
if (ctx.doXDot && ctx.draws === undefined && !('_draw_' in o)) o._draw_ = [];
|
|
536
|
+
return o;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/** @see plugin/core/gvrender_core_json.c:write_edge (top) */
|
|
540
|
+
function buildEdgeObject(e: Edge, ctx: BuildCtx): JObj {
|
|
541
|
+
const o: JObj = {
|
|
542
|
+
_gvid: ctx.edgeGid.get(e)!,
|
|
543
|
+
tail: ctx.nodeGid.get(e.tail)!,
|
|
544
|
+
head: ctx.nodeGid.get(e.head)!,
|
|
545
|
+
};
|
|
546
|
+
emitAttrs(o, e.attrs, ctx.draws?.edge.get(e), ctx);
|
|
547
|
+
// A declared `label` edge symbol makes write_attrs emit `label` on every
|
|
548
|
+
// edge — the empty value included. @see BuildCtx.edgeLabelDeclared
|
|
549
|
+
if (ctx.edgeLabelDeclared && !('label' in o)) o.label = '';
|
|
550
|
+
attachEdgeLabelPositions(o, e);
|
|
551
|
+
if (ctx.doXDot && ctx.draws === undefined && !('_draw_' in o)) o._draw_ = [];
|
|
552
|
+
return o;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// ---------------------------------------------------------------------------
|
|
556
|
+
// Graph / subgraph object builder — @see write_graph / write_subgs
|
|
557
|
+
// ---------------------------------------------------------------------------
|
|
558
|
+
|
|
559
|
+
/** Member edges of a (sub)graph in AGSEQ order, as `_gvid` ints.
|
|
560
|
+
* @see write_edges (agfstnode/agfstout collection + agseqasc qsort) */
|
|
561
|
+
function memberEdgeGids(g: Graph, ctx: BuildCtx): number[] {
|
|
562
|
+
const edges: Edge[] = [];
|
|
563
|
+
for (const [, n] of g.nodes) {
|
|
564
|
+
for (const e of n.outEdges(g)) {
|
|
565
|
+
if (ctx.edgeGid.has(e)) edges.push(e);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
edges.sort((a, b) => a.seq - b.seq);
|
|
569
|
+
return edges.map((e) => ctx.edgeGid.get(e)!);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/** Full edge objects for the top graph, AGSEQ-ordered. @see write_edges (top) */
|
|
573
|
+
function buildEdgesArray(g: Graph, ctx: BuildCtx): JObj[] {
|
|
574
|
+
const edges = canonicalRootEdges(g).map(({ e }) => e);
|
|
575
|
+
edges.sort((a, b) => a.seq - b.seq);
|
|
576
|
+
return edges.map((e) => buildEdgeObject(e, ctx));
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** @see plugin/core/gvrender_core_json.c:write_graph */
|
|
580
|
+
function buildGraphObject(g: Graph, top: boolean, ctx: BuildCtx): JObj {
|
|
581
|
+
const o: JObj = {};
|
|
582
|
+
// write_hdr
|
|
583
|
+
o.name = g.name;
|
|
584
|
+
if (top) {
|
|
585
|
+
o.directed = g.kind === 'directed' || g.kind === 'strict-directed';
|
|
586
|
+
o.strict = g.kind === 'strict-directed' || g.kind === 'strict-undirected';
|
|
587
|
+
}
|
|
588
|
+
// write_attrs (subgraphs inherit enclosing graph attrs via agxget)
|
|
589
|
+
const overlay = top ? ctx.draws?.graph : ctx.draws?.cluster.get(g);
|
|
590
|
+
emitAttrs(o, graphEffectiveAttrs(g, top), overlay, ctx);
|
|
591
|
+
attachGraphLabelGeom(o, g);
|
|
592
|
+
// A declared graph `label` symbol makes write_attrs emit `label` on every
|
|
593
|
+
// graph object — the empty value included. @see BuildCtx.graphLabelDeclared
|
|
594
|
+
if (ctx.graphLabelDeclared && !('label' in o)) o.label = '';
|
|
595
|
+
// _subgraph_cnt (top) / _gvid (subgraph)
|
|
596
|
+
if (top) {
|
|
597
|
+
o._subgraph_cnt = ctx.sgcnt;
|
|
598
|
+
} else {
|
|
599
|
+
o._gvid = ctx.subgGid.get(g)!;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (top) {
|
|
603
|
+
// "objects": all subgraphs (DFS preorder) then all node objects. Emitted
|
|
604
|
+
// only when the graph has any subgraph or node. @see write_subgs/write_nodes
|
|
605
|
+
if (ctx.dfsSubs.length > 0 || g.nodes.size > 0) {
|
|
606
|
+
const objects: JObj[] = [];
|
|
607
|
+
for (const sg of ctx.dfsSubs) objects.push(buildGraphObject(sg, false, ctx));
|
|
608
|
+
for (const [, n] of g.nodes) objects.push(buildNodeObject(n, ctx));
|
|
609
|
+
o.objects = objects;
|
|
610
|
+
}
|
|
611
|
+
} else {
|
|
612
|
+
// Member reference lists (int _gvid arrays), each only when non-empty.
|
|
613
|
+
const childGids: number[] = [];
|
|
614
|
+
for (const [, sg] of g.subgraphs) childGids.push(ctx.subgGid.get(sg)!);
|
|
615
|
+
if (childGids.length > 0) o.subgraphs = childGids;
|
|
616
|
+
const nodeGids: number[] = [];
|
|
617
|
+
for (const [, n] of g.nodes) {
|
|
618
|
+
const gid = ctx.nodeGid.get(n);
|
|
619
|
+
if (gid !== undefined) nodeGids.push(gid);
|
|
620
|
+
}
|
|
621
|
+
if (nodeGids.length > 0) o.nodes = nodeGids;
|
|
622
|
+
const eGids = memberEdgeGids(g, ctx);
|
|
623
|
+
if (eGids.length > 0) o.edges = eGids;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// write_edges (top only — the flat full-edge array)
|
|
627
|
+
if (top) {
|
|
628
|
+
const edges = buildEdgesArray(g, ctx);
|
|
629
|
+
if (edges.length > 0) o.edges = edges;
|
|
630
|
+
}
|
|
631
|
+
return o;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// ---------------------------------------------------------------------------
|
|
635
|
+
// buildJson — @see plugin/core/gvrender_core_json.c:write_graph (top entry)
|
|
636
|
+
// ---------------------------------------------------------------------------
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Reinterpret a string's UTF-8 bytes as Latin-1 code points. Mirrors C's
|
|
640
|
+
* `stoj` applying `latin1ToUTF8` a SECOND time to text that input processing
|
|
641
|
+
* already converted latin1→UTF-8, when `charset=latin1`. The double pass is a
|
|
642
|
+
* graphviz quirk (the SVG backend does not do it), so `-Tjson` on a latin1
|
|
643
|
+
* graph emits mojibake — `á` becomes `á`. No-op on pure ASCII.
|
|
644
|
+
* @see plugin/core/gvrender_core_json.c:82,121 stoj (sp->isLatin branch)
|
|
645
|
+
*/
|
|
646
|
+
function latin1Reencode(s: string): string {
|
|
647
|
+
const bytes = new TextEncoder().encode(s);
|
|
648
|
+
let out = '';
|
|
649
|
+
for (const b of bytes) out += String.fromCharCode(b);
|
|
650
|
+
return out;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export function buildJson(g: Graph, doXDot: boolean): string {
|
|
654
|
+
const draws = doXDot ? collectDrawLookup(g) : undefined;
|
|
655
|
+
const ctx = assignIds(g, doXDot, draws);
|
|
656
|
+
const root = buildGraphObject(g, true, ctx);
|
|
657
|
+
return JSON.stringify(root, null, 2) + '\n';
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// ---------------------------------------------------------------------------
|
|
661
|
+
// Json0Renderer
|
|
662
|
+
// ---------------------------------------------------------------------------
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* JSON0 renderer — position data only, no xdot draw operations.
|
|
666
|
+
*
|
|
667
|
+
* @see plugin/core/gvrender_core_json.c FORMAT_JSON0
|
|
668
|
+
*/
|
|
669
|
+
export class Json0Renderer implements RendererPlugin {
|
|
670
|
+
readonly type = 'json0';
|
|
671
|
+
/** @see plugin/core/gvplugin_core.c registration table */
|
|
672
|
+
readonly quality = 0;
|
|
673
|
+
|
|
674
|
+
beginGraph(_g: Graph, _job: RenderJob): void { /* no-op */ }
|
|
675
|
+
|
|
676
|
+
endGraph(g: Graph, job: RenderJob): void {
|
|
677
|
+
job.write(buildJson(g, false));
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
beginNode(_n: Node, _job: RenderJob): void { /* no-op */ }
|
|
681
|
+
endNode(_n: Node, _job: RenderJob): void { /* no-op */ }
|
|
682
|
+
beginEdge(_e: Edge, _job: RenderJob): void { /* no-op */ }
|
|
683
|
+
endEdge(_e: Edge, _job: RenderJob): void { /* no-op */ }
|
|
684
|
+
textspan(_pos: Point, _span: TextSpan, _job: RenderJob): void { /* no-op */ }
|
|
685
|
+
ellipse(_c: Point, _rx: number, _ry: number, _f: boolean, _j: RenderJob): void { /* no-op */ }
|
|
686
|
+
polygon(_pts: Point[], _filled: boolean, _job: RenderJob): void { /* no-op */ }
|
|
687
|
+
bezier(_pts: Point[], _filled: boolean, _job: RenderJob): void { /* no-op */ }
|
|
688
|
+
polyline(_pts: Point[], _job: RenderJob): void { /* no-op */ }
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// ---------------------------------------------------------------------------
|
|
692
|
+
// JsonRenderer
|
|
693
|
+
// ---------------------------------------------------------------------------
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* JSON renderer — position data plus _draw_ arrays.
|
|
697
|
+
*
|
|
698
|
+
* @see plugin/core/gvrender_core_json.c FORMAT_JSON
|
|
699
|
+
*/
|
|
700
|
+
export class JsonRenderer implements RendererPlugin {
|
|
701
|
+
readonly type = 'json';
|
|
702
|
+
/** @see plugin/core/gvplugin_core.c registration table */
|
|
703
|
+
readonly quality = 0;
|
|
704
|
+
|
|
705
|
+
beginGraph(_g: Graph, _job: RenderJob): void { /* no-op */ }
|
|
706
|
+
|
|
707
|
+
endGraph(g: Graph, job: RenderJob): void {
|
|
708
|
+
job.write(buildJson(g, true));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
beginNode(_n: Node, _job: RenderJob): void { /* no-op */ }
|
|
712
|
+
endNode(_n: Node, _job: RenderJob): void { /* no-op */ }
|
|
713
|
+
beginEdge(_e: Edge, _job: RenderJob): void { /* no-op */ }
|
|
714
|
+
endEdge(_e: Edge, _job: RenderJob): void { /* no-op */ }
|
|
715
|
+
textspan(_pos: Point, _span: TextSpan, _job: RenderJob): void { /* no-op */ }
|
|
716
|
+
ellipse(_c: Point, _rx: number, _ry: number, _f: boolean, _j: RenderJob): void { /* no-op */ }
|
|
717
|
+
polygon(_pts: Point[], _filled: boolean, _job: RenderJob): void { /* no-op */ }
|
|
718
|
+
bezier(_pts: Point[], _filled: boolean, _job: RenderJob): void { /* no-op */ }
|
|
719
|
+
polyline(_pts: Point[], _job: RenderJob): void { /* no-op */ }
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// ---------------------------------------------------------------------------
|
|
723
|
+
// Factory functions
|
|
724
|
+
// ---------------------------------------------------------------------------
|
|
725
|
+
|
|
726
|
+
/** @see plugin/core/gvrender_core_json.c FORMAT_JSON0 */
|
|
727
|
+
export function createJson0Renderer(): RendererPlugin {
|
|
728
|
+
return new Json0Renderer();
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** @see plugin/core/gvrender_core_json.c FORMAT_JSON */
|
|
732
|
+
export function createJsonRenderer(): RendererPlugin {
|
|
733
|
+
return new JsonRenderer();
|
|
734
|
+
}
|