@knowvah/dot-engine 2.8.0 → 2.9.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/dist/common/graph-init.d.ts.map +1 -1
- package/dist/common/htmltable-emit.d.ts +6 -11
- package/dist/common/htmltable-emit.d.ts.map +1 -1
- package/dist/common/nodeinit.d.ts.map +1 -1
- package/dist/common/poly-gencode.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +13 -2
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/common/safefile.d.ts +23 -0
- package/dist/common/safefile.d.ts.map +1 -0
- package/dist/common/shapes.d.ts +6 -6
- package/dist/common/shapes.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/image-type.d.ts +41 -0
- package/dist/gvc/image-type.d.ts.map +1 -0
- package/dist/gvc/render-usershape.d.ts +68 -0
- package/dist/gvc/render-usershape.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +23 -1
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/index.js +46393 -44890
- package/dist/index.js.map +4 -4
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts +118 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts +39 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/circuit.d.ts +10 -0
- package/dist/layout/neato/circuit.d.ts.map +1 -0
- package/dist/layout/neato/init.d.ts +3 -2
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/ipsep-opts.d.ts +19 -0
- package/dist/layout/neato/ipsep-opts.d.ts.map +1 -0
- package/dist/layout/neato/lu.d.ts +35 -0
- package/dist/layout/neato/lu.d.ts.map +1 -0
- package/dist/layout/neato/matinv.d.ts +8 -0
- package/dist/layout/neato/matinv.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts +35 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts +110 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/start.d.ts +5 -4
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-cola.d.ts +65 -0
- package/dist/layout/neato/stress-cola.d.ts.map +1 -0
- package/dist/layout/neato/stress-kernel.d.ts +0 -2
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
- package/dist/layout/neato/stress-models.d.ts +48 -0
- package/dist/layout/neato/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/vpsc-adjust.d.ts +7 -8
- package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
- package/dist/render/color-resolve.d.ts +14 -0
- package/dist/render/color-resolve.d.ts.map +1 -1
- package/dist/render/dot/edge-draw.d.ts.map +1 -1
- package/dist/render/dot.d.ts +8 -1
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/svg-arrow-ops.d.ts +21 -4
- package/dist/render/svg-arrow-ops.d.ts.map +1 -1
- package/dist/render/svg-edge-arrows.d.ts +3 -3
- package/dist/render/svg-edge-arrows.d.ts.map +1 -1
- package/dist/render/svg-helpers.d.ts +1 -1
- package/dist/render/svg-helpers.d.ts.map +1 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render.js +8505 -7002
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/common/graph-init.ts +4 -2
- package/src/common/htmltable-emit.ts +11 -46
- package/src/common/nodeinit.ts +3 -1
- package/src/common/poly-gencode.ts +53 -3
- package/src/common/poly-init.ts +30 -17
- package/src/common/safefile.ts +74 -0
- package/src/common/shapes.ts +43 -22
- package/src/gvc/__fixtures__/p7/colors/98-point.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json +54 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg +17 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot +13 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json +150 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot +22 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot +15 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/bad.png +1 -0
- package/src/gvc/__fixtures__/p7/images/d/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/d2/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/g.gif +0 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.gv +10 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg +25 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot +30 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/j.jpg +0 -0
- package/src/gvc/__fixtures__/p7/images/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/s.svg +2 -0
- package/src/gvc/__fixtures__/p7/images/sb.svg +1 -0
- package/src/gvc/__fixtures__/p7/images/t.png +0 -0
- package/src/gvc/__fixtures__/p7/regen.sh +23 -0
- package/src/gvc/device-cluster.ts +3 -2
- package/src/gvc/device.ts +12 -4
- package/src/gvc/image-type.ts +122 -0
- package/src/gvc/render-usershape.ts +260 -0
- package/src/gvc/usershape.ts +40 -1
- package/src/layout/neato/__fixtures__/ipsep/big-dired.gv +243 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.trace +55 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot +1832 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.trace +95 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot +58 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.trace +40 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +77 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +68 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.trace +42 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +110 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +108 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +48 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.trace +45 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +47 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.trace +44 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot +66 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.trace +46 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.trace +211 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.trace +50 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot +84 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc.ts +109 -0
- package/src/layout/neato/__fixtures__/stress-models.ts +64 -0
- package/src/layout/neato/circuit.ts +31 -0
- package/src/layout/neato/index.ts +2 -2
- package/src/layout/neato/init.ts +25 -34
- package/src/layout/neato/ipsep-opts.ts +158 -0
- package/src/layout/neato/lu.ts +189 -0
- package/src/layout/neato/matinv.ts +37 -0
- package/src/layout/neato/quad-prog-vpsc-overlap.ts +365 -0
- package/src/layout/neato/quad-prog-vpsc.ts +416 -0
- package/src/layout/neato/start.ts +9 -24
- package/src/layout/neato/stress-cola.ts +497 -0
- package/src/layout/neato/stress-kernel.ts +1 -17
- package/src/layout/neato/stress-models.ts +212 -0
- package/src/layout/neato/vpsc-adjust.ts +35 -66
- package/src/render/color-resolve.ts +25 -2
- package/src/render/dot/edge-draw.ts +7 -4
- package/src/render/dot.ts +14 -1
- package/src/render/svg-arrow-ops.ts +35 -19
- package/src/render/svg-edge-arrows.ts +7 -6
- package/src/render/svg-helpers.ts +19 -11
- package/src/render/svg.ts +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowvah/dot-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Faithful TypeScript port of Graphviz (dot, neato, fdp, sfdp, circo, twopi, osage, patchwork) — no C: no native binary, no WASM. Oracle-verified against the C implementation, runs in the browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphviz",
|
package/src/common/graph-init.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { doGraphLabel } from '../layout/dot/graph-label.js';
|
|
|
30
30
|
import { mapbool, setClType, LOCAL, GLOBAL, NOCLUST } from '../layout/dot/rank.js';
|
|
31
31
|
import { cround } from './arith.js';
|
|
32
32
|
import { agwarningf } from './agerr.js';
|
|
33
|
+
import { setImagePath } from './safefile.js';
|
|
33
34
|
|
|
34
35
|
// ---------------------------------------------------------------------------
|
|
35
36
|
// Constants — @see lib/common/const.h
|
|
@@ -274,8 +275,9 @@ export function graphInit(g: Graph, useRankdir: boolean): void {
|
|
|
274
275
|
|
|
275
276
|
g.info.charset = findCharset(g); // @see input.c:631
|
|
276
277
|
|
|
277
|
-
//
|
|
278
|
-
//
|
|
278
|
+
// Gvimagepath = agget(g, "imagepath"), else Gvfilepath (unported: undefined).
|
|
279
|
+
// Set unconditionally so a previous graph's value never leaks. @see input.c:627-630
|
|
280
|
+
setImagePath(g.attrs.get('imagepath'));
|
|
279
281
|
|
|
280
282
|
// SKIPPED — GD_drawing(g)->quantum (input.c:640-641): derived at its only
|
|
281
283
|
// use-site, nodeinit.ts:129 — `lateDouble(g.root.attrs.get('quantum'), 0, 0)`
|
|
@@ -29,6 +29,7 @@ import type { RendererPlugin } from '../gvc/context.js';
|
|
|
29
29
|
import type { TextSpan } from './emit-types.js';
|
|
30
30
|
import type { PlacedHtml, PlacedCell, PlacedLine, PlacedImage } from './htmltable-pos.js';
|
|
31
31
|
import { transformPoint } from '../gvc/device.js';
|
|
32
|
+
import { gvrenderUsershape } from '../gvc/render-usershape.js';
|
|
32
33
|
import { gvrenderTextspan } from '../gvc/textspan-emit.js';
|
|
33
34
|
import {
|
|
34
35
|
withHtmlPaint, findHtmlStopColor, doBorder, mkPts,
|
|
@@ -194,61 +195,25 @@ function emitCellDecoration(
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
/** Scale the intrinsic image size per the IMG SCALE attribute. */
|
|
198
|
-
function scaleImage(d: { iw: number; ih: number; pw: number; ph: number; scale?: string }):
|
|
199
|
-
{ iw: number; ih: number } {
|
|
200
|
-
const sx = d.pw / d.iw;
|
|
201
|
-
const sy = d.ph / d.ih;
|
|
202
|
-
const mode = (d.scale ?? '').toLowerCase();
|
|
203
|
-
if (mode === 'width') return { iw: d.iw * sx, ih: d.ih };
|
|
204
|
-
if (mode === 'height') return { iw: d.iw, ih: d.ih * sy };
|
|
205
|
-
if (mode === 'both') return { iw: d.iw * sx, ih: d.ih * sy };
|
|
206
|
-
if (mode === 'true' || mode === 'yes' || mode === '1') {
|
|
207
|
-
const f = Math.min(sx, sy);
|
|
208
|
-
return { iw: d.iw * f, ih: d.ih * f };
|
|
209
|
-
}
|
|
210
|
-
return { iw: d.iw, ih: d.ih };
|
|
211
|
-
}
|
|
212
|
-
|
|
213
198
|
/**
|
|
214
|
-
* Emit a placed HTML IMG through the
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* box, apply the SCALE modes against the intrinsic size, then center
|
|
218
|
-
* the result (imagepos "mc" — hardcoded by emit_html_img).
|
|
219
|
-
*
|
|
220
|
-
* SCALE falls back to the object's imagescale attribute (C
|
|
221
|
-
* env->imgscale, default "false") when the IMG has no SCALE attr.
|
|
199
|
+
* Emit a placed HTML IMG through the shared gvrender_usershape: the cell's
|
|
200
|
+
* content box is the polygon, imagepos is the fixed "mc", and the scale is the
|
|
201
|
+
* IMG's own SCALE, else the object's imagescale (C env->imgscale).
|
|
222
202
|
*
|
|
223
|
-
* @see lib/common/htmltable.c:emit_html_img
|
|
224
|
-
* @see lib/gvc/gvrender.c:gvrender_usershape
|
|
203
|
+
* @see lib/common/htmltable.c:emit_html_img
|
|
204
|
+
* @see lib/gvc/gvrender.c:gvrender_usershape
|
|
225
205
|
*/
|
|
226
206
|
export function emitHtmlImg(
|
|
227
207
|
img: PlacedImage,
|
|
228
208
|
pos: Point,
|
|
229
|
-
|
|
209
|
+
_renderer: RendererPlugin,
|
|
230
210
|
job: RenderJob,
|
|
231
211
|
): void {
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
ur: { x: img.box.ur.x + pos.x, y: img.box.ur.y + pos.y },
|
|
236
|
-
};
|
|
237
|
-
const pw = b.ur.x - b.ll.x;
|
|
238
|
-
const ph = b.ur.y - b.ll.y;
|
|
239
|
-
// @see lib/common/htmltable.c:emit_html_img (:615-618)
|
|
212
|
+
const ll = { x: img.box.ll.x + pos.x, y: img.box.ll.y + pos.y };
|
|
213
|
+
const ur = { x: img.box.ur.x + pos.x, y: img.box.ur.y + pos.y };
|
|
214
|
+
const a: Point[] = [ur, { x: ll.x, y: ur.y }, ll, { x: ur.x, y: ll.y }];
|
|
240
215
|
const scale = img.scale !== undefined ? img.scale : htmlObjImgscale();
|
|
241
|
-
|
|
242
|
-
// imagepos "mc": center the (possibly scaled) image in the target box
|
|
243
|
-
if (iw < pw) {
|
|
244
|
-
b.ll.x += (pw - iw) / 2.0;
|
|
245
|
-
b.ur.x -= (pw - iw) / 2.0;
|
|
246
|
-
}
|
|
247
|
-
if (ih < ph) {
|
|
248
|
-
b.ll.y += (ph - ih) / 2.0;
|
|
249
|
-
b.ur.y -= (ph - ih) / 2.0;
|
|
250
|
-
}
|
|
251
|
-
renderer.usershape?.(img.src, b, job);
|
|
216
|
+
gvrenderUsershape(job, img.src, a, true, scale, 'mc');
|
|
252
217
|
}
|
|
253
218
|
|
|
254
219
|
/**
|
package/src/common/nodeinit.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { TextMeasurer } from './textmeasure.js';
|
|
|
15
15
|
import type { PolygonT, ShapeDesc, TextlabelT } from './types.js';
|
|
16
16
|
import { ShapeKind } from './types.js';
|
|
17
17
|
import { bindShape } from './shapes.js';
|
|
18
|
-
import { assignShapeInfo, buildNodeLabel, nodeAttr, nodeImageSize, readFontAttrs } from './poly-init.js';
|
|
18
|
+
import { assignShapeInfo, buildNodeLabel, nodeAttr, nodeImageSize, readFontAttrs, warnPolyInitImages } from './poly-init.js';
|
|
19
19
|
import { makeAnyLabel } from './make-label.js';
|
|
20
20
|
import { isHtmlValue, htmlValueContent } from './html-string.js';
|
|
21
21
|
import { NODE_XLABEL } from '../layout/dot/rank.js';
|
|
@@ -243,6 +243,8 @@ function initNodeFromLabel(n: Node, g: Graph, measurer: TextMeasurer): boolean {
|
|
|
243
243
|
}
|
|
244
244
|
buildNodeLabel(n, g, measurer);
|
|
245
245
|
initNodeXLabel(n, g, measurer);
|
|
246
|
+
// Layout-time poly_init warnings (once per layout; render-time polyInit is silent).
|
|
247
|
+
if (shape.kind !== ShapeKind.SH_POINT) warnPolyInitImages(n, g);
|
|
246
248
|
const poly = shape.polygon;
|
|
247
249
|
if (poly === null) return false;
|
|
248
250
|
if (shape.kind === ShapeKind.SH_POINT) {
|
|
@@ -34,10 +34,11 @@ import {
|
|
|
34
34
|
styleTokens,
|
|
35
35
|
} from './style-resolve.js';
|
|
36
36
|
import { stripedBox, wedgedEllipse } from '../render/svg-multicolor.js';
|
|
37
|
-
import { resolveRenderColor, reportColorNames } from '../render/color-resolve.js';
|
|
37
|
+
import { resolveFillColorName, resolveRenderColor, reportColorNames } from '../render/color-resolve.js';
|
|
38
38
|
import { htmlLabelColors } from './htmltable-emit-fill.js';
|
|
39
39
|
import { svgNodeId } from '../render/svg-id.js';
|
|
40
40
|
import { drawRoundCorners, mcircleHack, underlineDraw } from './poly-shapes.js';
|
|
41
|
+
import { gvrenderUsershape } from '../gvc/render-usershape.js';
|
|
41
42
|
|
|
42
43
|
// ---------------------------------------------------------------------------
|
|
43
44
|
// Multicolor test
|
|
@@ -175,6 +176,51 @@ function renderPeripheries(
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
// User shapes / images
|
|
181
|
+
// ---------------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
/** The `custom` shape: a user shape only when `shapefile` names a file. */
|
|
184
|
+
const CUSTOM_SHAPE_NAME = 'custom';
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The image name poly_gencode hands to gvrender_usershape, or undefined when
|
|
188
|
+
* the node draws none: a usershape shape (a `custom` one needs a non-empty
|
|
189
|
+
* `shapefile`, otherwise the shape's own name is the file) or a non-empty
|
|
190
|
+
* `image=`.
|
|
191
|
+
* @see lib/common/shapes.c:poly_gencode :3058-3067
|
|
192
|
+
*/
|
|
193
|
+
function usershapeName(n: Node): string | undefined {
|
|
194
|
+
const shape = n.info.shape as ShapeDesc | undefined;
|
|
195
|
+
if (shape?.usershape === true) {
|
|
196
|
+
if (shape.name !== CUSTOM_SHAPE_NAME) return shape.name;
|
|
197
|
+
const shapefile = nodeAttr(n, n.root, 'shapefile');
|
|
198
|
+
return shapefile !== undefined && shapefile !== '' ? shapefile : undefined;
|
|
199
|
+
}
|
|
200
|
+
const image = nodeAttr(n, n.root, 'image');
|
|
201
|
+
return image !== undefined && image !== '' ? image : undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Draw the node's image over its innermost periphery.
|
|
206
|
+
* `filled` is C's value after the peripheries loop (0 once any periphery was
|
|
207
|
+
* drawn); it is only meaningful to loadimage plugins that paint a background.
|
|
208
|
+
* @see lib/common/shapes.c:poly_gencode :3068-3080
|
|
209
|
+
*/
|
|
210
|
+
function renderUsershape(n: Node, d: NodeDrawCtx): void {
|
|
211
|
+
const name = usershapeName(n);
|
|
212
|
+
if (name === undefined) return;
|
|
213
|
+
const { poly, coord } = d;
|
|
214
|
+
const sides = poly.sides <= 2 ? 2 : poly.sides;
|
|
215
|
+
// get coords of innermost periphery
|
|
216
|
+
const af = poly.vertices!.slice(0, sides).map((v) => ({ x: v.x + coord.x, y: v.y + coord.y }));
|
|
217
|
+
gvrenderUsershape(
|
|
218
|
+
d.ringCtx.job, name, af, poly.peripheries === 0 && d.filled,
|
|
219
|
+
nodeAttr(n, n.root, 'imagescale') ?? 'false',
|
|
220
|
+
nodeAttr(n, n.root, 'imagepos') ?? 'mc',
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
178
224
|
// ---------------------------------------------------------------------------
|
|
179
225
|
// Label rendering
|
|
180
226
|
// ---------------------------------------------------------------------------
|
|
@@ -326,7 +372,8 @@ function applyFillState(obj: ObjState, n: Node, job: RenderJob): boolean {
|
|
|
326
372
|
// point_gencode always fills, defaulting to black (AD-4).
|
|
327
373
|
if (isPointNode(n)) {
|
|
328
374
|
obj.fill = FillType.Solid;
|
|
329
|
-
|
|
375
|
+
// point_gencode: gvrender_set_fillcolor(job, color) cuts a list at ':'.
|
|
376
|
+
obj.fillColor = resolveFillColorName(findFillDflt(n));
|
|
330
377
|
return true;
|
|
331
378
|
}
|
|
332
379
|
const fillRes = resolveNodeFillEx({
|
|
@@ -338,7 +385,8 @@ function applyFillState(obj: ObjState, n: Node, job: RenderJob): boolean {
|
|
|
338
385
|
if (fillRes.kind === 'none') { obj.fill = FillType.None; return false; }
|
|
339
386
|
if (fillRes.kind === 'solid') {
|
|
340
387
|
obj.fill = FillType.Solid;
|
|
341
|
-
|
|
388
|
+
// gvrender_set_fillcolor hands an empty name (":red") to colorxlate.
|
|
389
|
+
obj.fillColor = resolveFillColorName(fillRes.color);
|
|
342
390
|
return true;
|
|
343
391
|
}
|
|
344
392
|
applyGradientFields(obj, fillRes);
|
|
@@ -496,6 +544,8 @@ export function polyGencode(rawJob: unknown, rawNode: unknown): void {
|
|
|
496
544
|
const savedPts = job.obj?.urlMapPts;
|
|
497
545
|
let inAnchor = clustersLast ? false : beginNodeAnchor(n, renderer, job);
|
|
498
546
|
renderPeripheries(ctx.poly, ctx.coord, ctx.filled, ctx.ringCtx);
|
|
547
|
+
// point_gencode has no usershape branch.
|
|
548
|
+
if (!isPointNode(n)) renderUsershape(n, ctx);
|
|
499
549
|
// point_gencode never emits a label (AD-3).
|
|
500
550
|
if (!isPointNode(n)) renderNodeLabel(n, ctx.coord, renderer, job);
|
|
501
551
|
if (clustersLast) {
|
package/src/common/poly-init.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { nodeAttr } from './attr-get.js';
|
|
|
14
14
|
import type { PolygonT, ShapeDesc } from './types.js';
|
|
15
15
|
import { ShapeKind } from './types.js';
|
|
16
16
|
import type { TextlabelT } from './types.js';
|
|
17
|
-
import { bindShape } from './shapes.js';
|
|
17
|
+
import { bindShape, CUSTOM_SHAPE_NAME } from './shapes.js';
|
|
18
18
|
import { isHtmlValue, htmlValueContent } from './html-string.js';
|
|
19
19
|
// Circular imports: poly-init ↔ record / htmltable-pos — safe for function declarations.
|
|
20
20
|
import { recordNodeInit } from './record.js';
|
|
@@ -99,13 +99,24 @@ export function buildNodeLabel(n: Node, g: Graph, measurer: TextMeasurer): void
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* poly_init's `image`
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
102
|
+
* poly_init's shapefile and `image` warnings, emitted once per layout from
|
|
103
|
+
* common_init_node after the label is made. For a custom shape gvusershape_size
|
|
104
|
+
* fails (the port never sizes shapefiles), so gvusershape_open's "while
|
|
105
|
+
* opening" line precedes the "No or improper shapefile" line. For a non-custom
|
|
106
|
+
* shape's `image=`, the caller-supplied sizer/resolver decides; when it
|
|
107
|
+
* supplies nothing the same pair is emitted.
|
|
108
|
+
* @see lib/common/shapes.c:2027-2046
|
|
106
109
|
*/
|
|
107
|
-
function
|
|
108
|
-
|
|
110
|
+
export function warnPolyInitImages(n: Node, g: Graph): void {
|
|
111
|
+
const shape = boundShape(n, g);
|
|
112
|
+
if (shape.usershape) {
|
|
113
|
+
if (shape.name !== CUSTOM_SHAPE_NAME) return;
|
|
114
|
+
const shapefile = nodeAttr(n, g, 'shapefile');
|
|
115
|
+
// gvusershape_open only runs (and warns) for a non-empty name.
|
|
116
|
+
if (shapefile !== undefined && shapefile !== '') agwarningf(imageOpenWarning(shapefile));
|
|
117
|
+
agwarningf(`No or improper shapefile="${shapefile ?? '<nil>'}" for node "${n.name}"`);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
109
120
|
const image = nodeAttr(n, g, 'image');
|
|
110
121
|
if (image === undefined || image === '') return;
|
|
111
122
|
const gvc = g.root.info.gvc;
|
|
@@ -114,16 +125,24 @@ function warnMissingImage(n: Node, g: Graph, shapefile: string | undefined): voi
|
|
|
114
125
|
agwarningf(`No or improper image="${image}" for node "${n.name}"`);
|
|
115
126
|
}
|
|
116
127
|
|
|
128
|
+
/** The node's bound descriptor (set by common_init_node), else bound now. */
|
|
129
|
+
function boundShape(n: Node, g: Graph): ShapeDesc {
|
|
130
|
+
return (
|
|
131
|
+
(n.info.shape as ShapeDesc | undefined) ??
|
|
132
|
+
bindShape(nodeAttr(n, g, 'shape') ?? 'ellipse', nodeAttr(n, g, 'shapefile'))
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
117
136
|
/**
|
|
118
|
-
* poly_init's imagesize for a non-
|
|
137
|
+
* poly_init's imagesize for a non-usershape's `image=`: gvusershape_size in
|
|
119
138
|
* points plus the fixed 2pt padding, and GD_has_images. Null (C's imagesize 0)
|
|
120
139
|
* when there is no image or the caller supplies no size; the missing-image
|
|
121
|
-
* warning stays in
|
|
140
|
+
* warning stays in warnPolyInitImages. A custom shape's size is never
|
|
141
|
+
* available (the port opens no shapefiles).
|
|
122
142
|
* @see lib/common/shapes.c:2039-2051
|
|
123
143
|
*/
|
|
124
144
|
export function nodeImageSize(n: Node, g: Graph): { x: number; y: number } | undefined {
|
|
125
|
-
|
|
126
|
-
if (shapefile !== undefined && shapefile !== '') return undefined;
|
|
145
|
+
if (boundShape(n, g).usershape) return undefined;
|
|
127
146
|
const gvc = g.root.info.gvc;
|
|
128
147
|
const sz = usershapeSizePts(nodeAttr(n, g, 'image'), usershapeDpi(g.root.attrs), gvc?.imageSizer);
|
|
129
148
|
if (sz === null) return undefined;
|
|
@@ -135,16 +154,10 @@ export function polyInit(n: Node, g: Graph, measurer: TextMeasurer): void {
|
|
|
135
154
|
const shapeName = nodeAttr(n, g, 'shape') ?? 'ellipse';
|
|
136
155
|
const shapefile = nodeAttr(n, g, 'shapefile');
|
|
137
156
|
n.info.shape = bindShape(shapeName, shapefile);
|
|
138
|
-
// C warns when the custom shape's image cannot be sized (headless: always).
|
|
139
|
-
// @see lib/common/shapes.c:2027-2033
|
|
140
|
-
if (shapefile !== undefined && shapefile !== '' && shapeName !== 'epsf') {
|
|
141
|
-
agwarningf(`No or improper shapefile="${shapefile}" for node "${n.name}"`);
|
|
142
|
-
}
|
|
143
157
|
if ((n.info.shape as ShapeDesc).kind === ShapeKind.SH_RECORD) {
|
|
144
158
|
if (n.info.shape_info === undefined) recordNodeInit(n, g, measurer);
|
|
145
159
|
return;
|
|
146
160
|
}
|
|
147
|
-
warnMissingImage(n, g, shapefile);
|
|
148
161
|
buildNodeLabel(n, g, measurer);
|
|
149
162
|
|
|
150
163
|
// Layout-time common_init_node already installed the attr-resolved
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `safefile` and the `Gvimagepath` process global (AD-6).
|
|
5
|
+
*
|
|
6
|
+
* C resolves a relative file name against the directories in `Gvimagepath`
|
|
7
|
+
* (the graph's `imagepath`) and returns the first readable `dir/name`; NULL
|
|
8
|
+
* means the name is unsafe or unreachable. The port has no filesystem, so
|
|
9
|
+
* "readable `dir/name`" becomes "the host supplies `name`" (sizer or
|
|
10
|
+
* resolver), keyed by the raw name.
|
|
11
|
+
*
|
|
12
|
+
* @see lib/common/utils.c:safefile (253-311)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { imageIsSupplied } from '../gvc/usershape.js';
|
|
16
|
+
import { registerRenderState } from './render-state.js';
|
|
17
|
+
|
|
18
|
+
/** utils.c PATHSEP on non-Windows. */
|
|
19
|
+
const PATHSEP = ':';
|
|
20
|
+
/** C's PATH_SEPARATOR, tested on the first character of the name. */
|
|
21
|
+
const PATH_SEPARATOR = '/';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `Gvimagepath` (a C process global, initially NULL). Held in a const
|
|
25
|
+
* container, reset per render; graph_init overwrites it on every graph.
|
|
26
|
+
* @see lib/common/globals.h:Gvimagepath
|
|
27
|
+
*/
|
|
28
|
+
const imagePathState: { value: string | undefined } = { value: undefined };
|
|
29
|
+
registerRenderState(() => { imagePathState.value = undefined; });
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* graph_init's `Gvimagepath = agget(g, "imagepath")`, falling back to
|
|
33
|
+
* `Gvfilepath` (unported: it comes from the command line/environment, so the
|
|
34
|
+
* fallback is NULL).
|
|
35
|
+
* @see lib/common/input.c:graph_init (627-630)
|
|
36
|
+
*/
|
|
37
|
+
export function setImagePath(imagepath: string | undefined): void {
|
|
38
|
+
imagePathState.value = imagepath;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The directory list `mkDirlist` builds: the split on PATHSEP, empty tokens
|
|
43
|
+
* included only as `tok` yields them (it yields none for an empty list).
|
|
44
|
+
* @see lib/common/utils.c:mkDirlist
|
|
45
|
+
*/
|
|
46
|
+
export function mkDirlist(list: string): string[] {
|
|
47
|
+
return list === '' ? [] : list.split(PATHSEP);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* First directory whose `dir/str` is readable; here, the host supplies `str`.
|
|
52
|
+
* C returns the joined path; lookups stay keyed by the raw name, so the
|
|
53
|
+
* result is `str`.
|
|
54
|
+
* @see lib/common/utils.c:findPath
|
|
55
|
+
*/
|
|
56
|
+
function findPath(dirs: readonly string[], str: string): string | null {
|
|
57
|
+
return dirs.length > 0 && imageIsSupplied(str) ? str : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* NULL (here null) for a trivial name or one not found along `Gvimagepath`;
|
|
62
|
+
* the name itself when the list is empty or the name is absolute.
|
|
63
|
+
* Unported branches: `HTTPServerEnVar` (SERVER_NAME, always NULL) and
|
|
64
|
+
* `Gvfilepath` (GV_FILE_PATH, a basename search) - the browser has no
|
|
65
|
+
* environment.
|
|
66
|
+
* @see lib/common/utils.c:safefile (253-311)
|
|
67
|
+
*/
|
|
68
|
+
export function safefile(filename: string | undefined): string | null {
|
|
69
|
+
if (filename === undefined || filename === '') return null;
|
|
70
|
+
const pathlist = imagePathState.value;
|
|
71
|
+
const dirs = pathlist !== undefined && pathlist !== '' ? mkDirlist(pathlist) : [];
|
|
72
|
+
if (filename.startsWith(PATH_SEPARATOR) || dirs.length === 0) return filename;
|
|
73
|
+
return findPath(dirs, filename);
|
|
74
|
+
}
|
package/src/common/shapes.ts
CHANGED
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
import { polyGencode } from './poly-gencode.js';
|
|
28
28
|
import { recordGencode } from './record.js';
|
|
29
29
|
import { polyInside, recordInside, starInside } from './poly-inside.js';
|
|
30
|
+
import { agwarningf } from './agerr.js';
|
|
31
|
+
import { registerRenderState } from './render-state.js';
|
|
32
|
+
import { safefile } from './safefile.js';
|
|
30
33
|
import { polyPort } from './compass-port.js';
|
|
31
34
|
import { recordPort, recordPath } from './record-port.js';
|
|
32
35
|
|
|
@@ -156,32 +159,50 @@ export const Shapes: readonly ShapeDesc[] = [
|
|
|
156
159
|
*/
|
|
157
160
|
export const DEFAULT_SHAPE_NAME = 'box';
|
|
158
161
|
|
|
162
|
+
/** The name `bind_shape` forces for a shapefile node and `user_shape` accepts. */
|
|
163
|
+
export const CUSTOM_SHAPE_NAME = 'custom';
|
|
164
|
+
|
|
159
165
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
* C's process-global `UserShape` list; cleared per render (AD-4).
|
|
167
|
+
* @see lib/common/shapes.c:UserShape
|
|
168
|
+
*/
|
|
169
|
+
const userShapes = new Map<string, ShapeDesc>();
|
|
170
|
+
registerRenderState(() => userShapes.clear());
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Clone of Shapes[0] named `name`; `usershape` is set for `custom` (no `-l`
|
|
174
|
+
* library is ever loaded in the port), otherwise warns and the shape stays a
|
|
175
|
+
* plain box whose `image=` branch still runs.
|
|
176
|
+
* @see lib/common/shapes.c:user_shape (3949-3968)
|
|
177
|
+
*/
|
|
178
|
+
function userShape(name: string): ShapeDesc {
|
|
179
|
+
const found = userShapes.get(name); // find_user_shape
|
|
180
|
+
if (found !== undefined) return found;
|
|
181
|
+
const p: ShapeDesc = { ...Shapes[0], name };
|
|
182
|
+
if (name !== CUSTOM_SHAPE_NAME) {
|
|
183
|
+
agwarningf(`using ${Shapes[0].name} for unknown shape ${name}`);
|
|
184
|
+
p.usershape = false;
|
|
185
|
+
} else {
|
|
186
|
+
p.usershape = true;
|
|
187
|
+
}
|
|
188
|
+
userShapes.set(name, p);
|
|
189
|
+
return p;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns the ShapeDesc for the given name (case-sensitive). A non-empty
|
|
194
|
+
* shapefile that `safefile` accepts on a non-epsf shape forces
|
|
195
|
+
* `custom`; `custom` and unknown names go to `userShape`.
|
|
165
196
|
*
|
|
166
|
-
* @see lib/common/shapes.c:bind_shape
|
|
197
|
+
* @see lib/common/shapes.c:bind_shape (3970-3989)
|
|
167
198
|
*/
|
|
168
199
|
export function bindShape(name: string, shapefile?: string): ShapeDesc {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
// the headless oracle's output for shapefile nodes (graphs/user_shapes).
|
|
175
|
-
// The port models that endpoint directly: shapefile ⇒ the box descriptor.
|
|
176
|
-
// @see lib/common/shapes.c:bind_shape (3970), :3975-3978, :2022-2041
|
|
177
|
-
let effective = name;
|
|
178
|
-
if (shapefile !== undefined && shapefile !== '' && name !== 'epsf') {
|
|
179
|
-
effective = 'box';
|
|
180
|
-
}
|
|
181
|
-
for (const shape of Shapes) {
|
|
182
|
-
if (shape.name === effective) {
|
|
183
|
-
return shape;
|
|
200
|
+
const str = safefile(shapefile);
|
|
201
|
+
if (str !== null && name !== 'epsf') name = CUSTOM_SHAPE_NAME;
|
|
202
|
+
if (name !== CUSTOM_SHAPE_NAME) {
|
|
203
|
+
for (const shape of Shapes) {
|
|
204
|
+
if (shape.name === name) return shape;
|
|
184
205
|
}
|
|
185
206
|
}
|
|
186
|
-
return
|
|
207
|
+
return userShape(name);
|
|
187
208
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
digraph{a[shape=point fillcolor=":red"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "%1",
|
|
3
|
+
"directed": true,
|
|
4
|
+
"strict": false,
|
|
5
|
+
"_draw_":
|
|
6
|
+
[
|
|
7
|
+
{
|
|
8
|
+
"op": "c",
|
|
9
|
+
"grad": "none",
|
|
10
|
+
"color": "#fffffe00"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"op": "C",
|
|
14
|
+
"grad": "none",
|
|
15
|
+
"color": "#ffffff"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"op": "P",
|
|
19
|
+
"points": [[0.000,0.000],[0.000,3.600],[3.600,3.600],[3.600,0.000]]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"bb": "0,0,3.6,3.6",
|
|
23
|
+
"xdotversion": "1.7",
|
|
24
|
+
"_subgraph_cnt": 0,
|
|
25
|
+
"objects": [
|
|
26
|
+
{
|
|
27
|
+
"_gvid": 0,
|
|
28
|
+
"name": "a",
|
|
29
|
+
"_draw_":
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
"op": "c",
|
|
33
|
+
"grad": "none",
|
|
34
|
+
"color": "#000000"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"op": "C",
|
|
38
|
+
"grad": "none",
|
|
39
|
+
"color": "#000000"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"op": "E",
|
|
43
|
+
"rect": [1.800,1.800,1.800,1.800]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"fillcolor": ":red",
|
|
47
|
+
"height": "0.05",
|
|
48
|
+
"label": "\\N",
|
|
49
|
+
"pos": "1.8,1.8",
|
|
50
|
+
"shape": "point",
|
|
51
|
+
"width": "0.05"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Warning: is not a known color.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<!-- Generated by graphviz version 16.1.0 (20261012.1431)
|
|
5
|
+
-->
|
|
6
|
+
<!-- Pages: 1 -->
|
|
7
|
+
<svg width="12pt" height="12pt"
|
|
8
|
+
viewBox="0.00 0.00 12.00 12.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
9
|
+
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 7.6)">
|
|
10
|
+
<polygon fill="white" stroke="none" points="-4,4 -4,-7.6 7.6,-7.6 7.6,4 -4,4"/>
|
|
11
|
+
<!-- a -->
|
|
12
|
+
<g id="node1" class="node">
|
|
13
|
+
<title>a</title>
|
|
14
|
+
<ellipse fill="#000000" stroke="black" cx="1.8" cy="-1.8" rx="1.8" ry="1.8"/>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Warning: is not a known color.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
digraph {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 3.6 3.6 3.6 3.6 0 ",
|
|
3
|
+
bb="0,0,3.6,3.6",
|
|
4
|
+
xdotversion=1.7
|
|
5
|
+
];
|
|
6
|
+
node [label="\N"];
|
|
7
|
+
a [_draw_="c 7 -#000000 C 7 -#000000 E 1.8 1.8 1.8 1.8 ",
|
|
8
|
+
fillcolor=":red",
|
|
9
|
+
height=0.05,
|
|
10
|
+
pos="1.8,1.8",
|
|
11
|
+
shape=point,
|
|
12
|
+
width=0.05];
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Warning: is not a known color.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
digraph{a->b[color=blue fillcolor=":red"]}
|