@knowvah/dot-engine 2.8.1 → 2.10.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.
Files changed (524) hide show
  1. package/dist/common/graph-init.d.ts.map +1 -1
  2. package/dist/common/htmltable.d.ts +1 -1
  3. package/dist/common/htmltable.d.ts.map +1 -1
  4. package/dist/common/poly-gencode.d.ts.map +1 -1
  5. package/dist/common/poly-init.d.ts +9 -8
  6. package/dist/common/poly-init.d.ts.map +1 -1
  7. package/dist/common/safefile.d.ts +38 -0
  8. package/dist/common/safefile.d.ts.map +1 -0
  9. package/dist/common/shapes.d.ts +6 -6
  10. package/dist/common/shapes.d.ts.map +1 -1
  11. package/dist/gvc/device.d.ts.map +1 -1
  12. package/dist/gvc/image-resolver.d.ts +5 -0
  13. package/dist/gvc/image-resolver.d.ts.map +1 -1
  14. package/dist/gvc/image-type.d.ts +41 -0
  15. package/dist/gvc/image-type.d.ts.map +1 -0
  16. package/dist/gvc/render-usershape.d.ts +8 -0
  17. package/dist/gvc/render-usershape.d.ts.map +1 -1
  18. package/dist/gvc/usershape.d.ts +25 -1
  19. package/dist/gvc/usershape.d.ts.map +1 -1
  20. package/dist/index.js +9179 -7729
  21. package/dist/index.js.map +4 -4
  22. package/dist/layout/neato/__fixtures__/kk-models.d.ts +59 -0
  23. package/dist/layout/neato/__fixtures__/kk-models.d.ts.map +1 -0
  24. package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts +124 -0
  25. package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts.map +1 -0
  26. package/dist/layout/neato/__fixtures__/stress-models.d.ts +39 -0
  27. package/dist/layout/neato/__fixtures__/stress-models.d.ts.map +1 -0
  28. package/dist/layout/neato/circuit.d.ts +48 -0
  29. package/dist/layout/neato/circuit.d.ts.map +1 -0
  30. package/dist/layout/neato/constrained-majorization.d.ts.map +1 -1
  31. package/dist/layout/neato/index.d.ts +6 -3
  32. package/dist/layout/neato/index.d.ts.map +1 -1
  33. package/dist/layout/neato/init.d.ts +3 -2
  34. package/dist/layout/neato/init.d.ts.map +1 -1
  35. package/dist/layout/neato/ipsep-opts.d.ts +19 -0
  36. package/dist/layout/neato/ipsep-opts.d.ts.map +1 -0
  37. package/dist/layout/neato/kk-paths.d.ts +11 -1
  38. package/dist/layout/neato/kk-paths.d.ts.map +1 -1
  39. package/dist/layout/neato/kk-solve.d.ts.map +1 -1
  40. package/dist/layout/neato/kk.d.ts +5 -3
  41. package/dist/layout/neato/kk.d.ts.map +1 -1
  42. package/dist/layout/neato/kkutils.d.ts +45 -0
  43. package/dist/layout/neato/kkutils.d.ts.map +1 -1
  44. package/dist/layout/neato/lu.d.ts +35 -0
  45. package/dist/layout/neato/lu.d.ts.map +1 -0
  46. package/dist/layout/neato/matinv.d.ts +8 -0
  47. package/dist/layout/neato/matinv.d.ts.map +1 -0
  48. package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts +35 -0
  49. package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts.map +1 -0
  50. package/dist/layout/neato/quad-prog-vpsc.d.ts +110 -0
  51. package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -0
  52. package/dist/layout/neato/start.d.ts +11 -9
  53. package/dist/layout/neato/start.d.ts.map +1 -1
  54. package/dist/layout/neato/stress-cola.d.ts +65 -0
  55. package/dist/layout/neato/stress-cola.d.ts.map +1 -0
  56. package/dist/layout/neato/stress-kernel.d.ts +0 -2
  57. package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
  58. package/dist/layout/neato/stress-models.d.ts +54 -0
  59. package/dist/layout/neato/stress-models.d.ts.map +1 -0
  60. package/dist/layout/neato/vpsc-adjust.d.ts +7 -8
  61. package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
  62. package/dist/render/color-resolve.d.ts +14 -0
  63. package/dist/render/color-resolve.d.ts.map +1 -1
  64. package/dist/render/dot/edge-draw.d.ts.map +1 -1
  65. package/dist/render/svg-arrow-ops.d.ts +21 -4
  66. package/dist/render/svg-arrow-ops.d.ts.map +1 -1
  67. package/dist/render/svg-edge-arrows.d.ts +3 -3
  68. package/dist/render/svg-edge-arrows.d.ts.map +1 -1
  69. package/dist/render/svg-helpers.d.ts +1 -1
  70. package/dist/render/svg-helpers.d.ts.map +1 -1
  71. package/dist/render/svg.d.ts.map +1 -1
  72. package/dist/render.js +9179 -7729
  73. package/dist/render.js.map +4 -4
  74. package/dist/vpsc/SweepLine.d.ts +21 -8
  75. package/dist/vpsc/SweepLine.d.ts.map +1 -1
  76. package/dist/vpsc/sweepTypes.d.ts +12 -2
  77. package/dist/vpsc/sweepTypes.d.ts.map +1 -1
  78. package/package.json +1 -1
  79. package/src/common/graph-init.ts +8 -2
  80. package/src/common/htmltable.ts +6 -4
  81. package/src/common/poly-gencode.ts +2 -1
  82. package/src/common/poly-init.ts +51 -22
  83. package/src/common/safefile.ts +92 -0
  84. package/src/common/shapes.ts +43 -22
  85. package/src/gvc/__fixtures__/p7/colors/98-point.gv +1 -0
  86. package/src/gvc/__fixtures__/p7/colors/98-point.json +54 -0
  87. package/src/gvc/__fixtures__/p7/colors/98-point.json.stderr +1 -0
  88. package/src/gvc/__fixtures__/p7/colors/98-point.svg +17 -0
  89. package/src/gvc/__fixtures__/p7/colors/98-point.svg.stderr +1 -0
  90. package/src/gvc/__fixtures__/p7/colors/98-point.xdot +13 -0
  91. package/src/gvc/__fixtures__/p7/colors/98-point.xdot.stderr +1 -0
  92. package/src/gvc/__fixtures__/p7/colors/99-edge-color.gv +1 -0
  93. package/src/gvc/__fixtures__/p7/colors/99-edge-color.json +150 -0
  94. package/src/gvc/__fixtures__/p7/colors/99-edge-color.json.stderr +1 -0
  95. package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg +30 -0
  96. package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg.stderr +1 -0
  97. package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot +22 -0
  98. package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot.stderr +1 -0
  99. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.gv +1 -0
  100. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json +149 -0
  101. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json.stderr +0 -0
  102. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg +30 -0
  103. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg.stderr +0 -0
  104. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot +21 -0
  105. package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot.stderr +0 -0
  106. package/src/gvc/__fixtures__/p7/colors/99-edge.gv +1 -0
  107. package/src/gvc/__fixtures__/p7/colors/99-edge.json +149 -0
  108. package/src/gvc/__fixtures__/p7/colors/99-edge.json.stderr +1 -0
  109. package/src/gvc/__fixtures__/p7/colors/99-edge.svg +30 -0
  110. package/src/gvc/__fixtures__/p7/colors/99-edge.svg.stderr +1 -0
  111. package/src/gvc/__fixtures__/p7/colors/99-edge.xdot +21 -0
  112. package/src/gvc/__fixtures__/p7/colors/99-edge.xdot.stderr +1 -0
  113. package/src/gvc/__fixtures__/p7/images/100-rotate.gv +1 -0
  114. package/src/gvc/__fixtures__/p7/images/100-rotate.svg +19 -0
  115. package/src/gvc/__fixtures__/p7/images/100-rotate.svg.stderr +0 -0
  116. package/src/gvc/__fixtures__/p7/images/101-bad.cmapx +2 -0
  117. package/src/gvc/__fixtures__/p7/images/101-bad.cmapx.stderr +2 -0
  118. package/src/gvc/__fixtures__/p7/images/101-bad.dot +8 -0
  119. package/src/gvc/__fixtures__/p7/images/101-bad.dot.stderr +2 -0
  120. package/src/gvc/__fixtures__/p7/images/101-bad.gv +1 -0
  121. package/src/gvc/__fixtures__/p7/images/101-bad.json +68 -0
  122. package/src/gvc/__fixtures__/p7/images/101-bad.json.stderr +2 -0
  123. package/src/gvc/__fixtures__/p7/images/101-bad.plain +3 -0
  124. package/src/gvc/__fixtures__/p7/images/101-bad.plain.stderr +2 -0
  125. package/src/gvc/__fixtures__/p7/images/101-bad.svg +18 -0
  126. package/src/gvc/__fixtures__/p7/images/101-bad.svg.stderr +2 -0
  127. package/src/gvc/__fixtures__/p7/images/101-bad.xdot +13 -0
  128. package/src/gvc/__fixtures__/p7/images/101-bad.xdot.stderr +2 -0
  129. package/src/gvc/__fixtures__/p7/images/101-gif.cmapx +2 -0
  130. package/src/gvc/__fixtures__/p7/images/101-gif.cmapx.stderr +0 -0
  131. package/src/gvc/__fixtures__/p7/images/101-gif.dot +8 -0
  132. package/src/gvc/__fixtures__/p7/images/101-gif.dot.stderr +0 -0
  133. package/src/gvc/__fixtures__/p7/images/101-gif.gv +1 -0
  134. package/src/gvc/__fixtures__/p7/images/101-gif.json +70 -0
  135. package/src/gvc/__fixtures__/p7/images/101-gif.json.stderr +1 -0
  136. package/src/gvc/__fixtures__/p7/images/101-gif.plain +3 -0
  137. package/src/gvc/__fixtures__/p7/images/101-gif.plain.stderr +0 -0
  138. package/src/gvc/__fixtures__/p7/images/101-gif.svg +19 -0
  139. package/src/gvc/__fixtures__/p7/images/101-gif.svg.stderr +0 -0
  140. package/src/gvc/__fixtures__/p7/images/101-gif.xdot +13 -0
  141. package/src/gvc/__fixtures__/p7/images/101-gif.xdot.stderr +0 -0
  142. package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx +2 -0
  143. package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx.stderr +0 -0
  144. package/src/gvc/__fixtures__/p7/images/101-jpg.dot +8 -0
  145. package/src/gvc/__fixtures__/p7/images/101-jpg.dot.stderr +0 -0
  146. package/src/gvc/__fixtures__/p7/images/101-jpg.gv +1 -0
  147. package/src/gvc/__fixtures__/p7/images/101-jpg.json +70 -0
  148. package/src/gvc/__fixtures__/p7/images/101-jpg.json.stderr +1 -0
  149. package/src/gvc/__fixtures__/p7/images/101-jpg.plain +3 -0
  150. package/src/gvc/__fixtures__/p7/images/101-jpg.plain.stderr +0 -0
  151. package/src/gvc/__fixtures__/p7/images/101-jpg.svg +19 -0
  152. package/src/gvc/__fixtures__/p7/images/101-jpg.svg.stderr +0 -0
  153. package/src/gvc/__fixtures__/p7/images/101-jpg.xdot +13 -0
  154. package/src/gvc/__fixtures__/p7/images/101-jpg.xdot.stderr +0 -0
  155. package/src/gvc/__fixtures__/p7/images/101-png.cmapx +2 -0
  156. package/src/gvc/__fixtures__/p7/images/101-png.cmapx.stderr +0 -0
  157. package/src/gvc/__fixtures__/p7/images/101-png.dot +8 -0
  158. package/src/gvc/__fixtures__/p7/images/101-png.dot.stderr +0 -0
  159. package/src/gvc/__fixtures__/p7/images/101-png.gv +1 -0
  160. package/src/gvc/__fixtures__/p7/images/101-png.json +70 -0
  161. package/src/gvc/__fixtures__/p7/images/101-png.json.stderr +1 -0
  162. package/src/gvc/__fixtures__/p7/images/101-png.plain +3 -0
  163. package/src/gvc/__fixtures__/p7/images/101-png.plain.stderr +0 -0
  164. package/src/gvc/__fixtures__/p7/images/101-png.svg +19 -0
  165. package/src/gvc/__fixtures__/p7/images/101-png.svg.stderr +0 -0
  166. package/src/gvc/__fixtures__/p7/images/101-png.xdot +13 -0
  167. package/src/gvc/__fixtures__/p7/images/101-png.xdot.stderr +0 -0
  168. package/src/gvc/__fixtures__/p7/images/101-svg.cmapx +2 -0
  169. package/src/gvc/__fixtures__/p7/images/101-svg.cmapx.stderr +0 -0
  170. package/src/gvc/__fixtures__/p7/images/101-svg.dot +8 -0
  171. package/src/gvc/__fixtures__/p7/images/101-svg.dot.stderr +0 -0
  172. package/src/gvc/__fixtures__/p7/images/101-svg.gv +1 -0
  173. package/src/gvc/__fixtures__/p7/images/101-svg.json +70 -0
  174. package/src/gvc/__fixtures__/p7/images/101-svg.json.stderr +1 -0
  175. package/src/gvc/__fixtures__/p7/images/101-svg.plain +3 -0
  176. package/src/gvc/__fixtures__/p7/images/101-svg.plain.stderr +0 -0
  177. package/src/gvc/__fixtures__/p7/images/101-svg.svg +19 -0
  178. package/src/gvc/__fixtures__/p7/images/101-svg.svg.stderr +0 -0
  179. package/src/gvc/__fixtures__/p7/images/101-svg.xdot +13 -0
  180. package/src/gvc/__fixtures__/p7/images/101-svg.xdot.stderr +0 -0
  181. package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx +2 -0
  182. package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx.stderr +2 -0
  183. package/src/gvc/__fixtures__/p7/images/101-svgbare.dot +8 -0
  184. package/src/gvc/__fixtures__/p7/images/101-svgbare.dot.stderr +2 -0
  185. package/src/gvc/__fixtures__/p7/images/101-svgbare.gv +1 -0
  186. package/src/gvc/__fixtures__/p7/images/101-svgbare.json +68 -0
  187. package/src/gvc/__fixtures__/p7/images/101-svgbare.json.stderr +2 -0
  188. package/src/gvc/__fixtures__/p7/images/101-svgbare.plain +3 -0
  189. package/src/gvc/__fixtures__/p7/images/101-svgbare.plain.stderr +2 -0
  190. package/src/gvc/__fixtures__/p7/images/101-svgbare.svg +18 -0
  191. package/src/gvc/__fixtures__/p7/images/101-svgbare.svg.stderr +2 -0
  192. package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot +13 -0
  193. package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot.stderr +2 -0
  194. package/src/gvc/__fixtures__/p7/images/102-ip-abs.gv +1 -0
  195. package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg +18 -0
  196. package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg.stderr +2 -0
  197. package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot +14 -0
  198. package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot.stderr +2 -0
  199. package/src/gvc/__fixtures__/p7/images/102-ip-found.gv +1 -0
  200. package/src/gvc/__fixtures__/p7/images/102-ip-found.svg +19 -0
  201. package/src/gvc/__fixtures__/p7/images/102-ip-found.svg.stderr +0 -0
  202. package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot +14 -0
  203. package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot.stderr +0 -0
  204. package/src/gvc/__fixtures__/p7/images/102-ip-missing.gv +1 -0
  205. package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg +18 -0
  206. package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg.stderr +2 -0
  207. package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot +14 -0
  208. package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot.stderr +2 -0
  209. package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.gv +1 -0
  210. package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg +18 -0
  211. package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg.stderr +2 -0
  212. package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot +15 -0
  213. package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot.stderr +2 -0
  214. package/src/gvc/__fixtures__/p7/images/102-ip-two.gv +1 -0
  215. package/src/gvc/__fixtures__/p7/images/102-ip-two.svg +19 -0
  216. package/src/gvc/__fixtures__/p7/images/102-ip-two.svg.stderr +0 -0
  217. package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot +14 -0
  218. package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot.stderr +0 -0
  219. package/src/gvc/__fixtures__/p7/images/97-custom.gv +1 -0
  220. package/src/gvc/__fixtures__/p7/images/97-custom.svg +18 -0
  221. package/src/gvc/__fixtures__/p7/images/97-custom.svg.stderr +1 -0
  222. package/src/gvc/__fixtures__/p7/images/97-custom.xdot +13 -0
  223. package/src/gvc/__fixtures__/p7/images/97-custom.xdot.stderr +1 -0
  224. package/src/gvc/__fixtures__/p7/images/97-nosuch-image.gv +1 -0
  225. package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg +19 -0
  226. package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg.stderr +1 -0
  227. package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot +14 -0
  228. package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot.stderr +1 -0
  229. package/src/gvc/__fixtures__/p7/images/bad.png +1 -0
  230. package/src/gvc/__fixtures__/p7/images/d/r.png +0 -0
  231. package/src/gvc/__fixtures__/p7/images/d2/r.png +0 -0
  232. package/src/gvc/__fixtures__/p7/images/g.gif +0 -0
  233. package/src/gvc/__fixtures__/p7/images/graphs-val_val.gv +10 -0
  234. package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg +25 -0
  235. package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg.stderr +3 -0
  236. package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot +30 -0
  237. package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot.stderr +3 -0
  238. package/src/gvc/__fixtures__/p7/images/j.jpg +0 -0
  239. package/src/gvc/__fixtures__/p7/images/r.png +0 -0
  240. package/src/gvc/__fixtures__/p7/images/s.svg +2 -0
  241. package/src/gvc/__fixtures__/p7/images/sb.svg +1 -0
  242. package/src/gvc/__fixtures__/p7/images/t.png +0 -0
  243. package/src/gvc/__fixtures__/p7/regen.sh +23 -0
  244. package/src/gvc/__fixtures__/p8/bad.png +1 -0
  245. package/src/gvc/__fixtures__/p8/d/r.png +0 -0
  246. package/src/gvc/__fixtures__/p8/html-img-bad.gv +1 -0
  247. package/src/gvc/__fixtures__/p8/html-img-bad.svg +19 -0
  248. package/src/gvc/__fixtures__/p8/html-img-bad.svg.stderr +3 -0
  249. package/src/gvc/__fixtures__/p8/html-img-bad.xdot +13 -0
  250. package/src/gvc/__fixtures__/p8/html-img-bad.xdot.stderr +3 -0
  251. package/src/gvc/__fixtures__/p8/ip-shapefile.gv +1 -0
  252. package/src/gvc/__fixtures__/p8/ip-shapefile.svg +19 -0
  253. package/src/gvc/__fixtures__/p8/ip-shapefile.svg.stderr +0 -0
  254. package/src/gvc/__fixtures__/p8/ip-shapefile.xdot +15 -0
  255. package/src/gvc/__fixtures__/p8/ip-shapefile.xdot.stderr +0 -0
  256. package/src/gvc/__fixtures__/p8/regen.sh +13 -0
  257. package/src/gvc/device.ts +11 -4
  258. package/src/gvc/image-resolver.ts +8 -0
  259. package/src/gvc/image-type.ts +122 -0
  260. package/src/gvc/render-usershape.ts +52 -1
  261. package/src/gvc/usershape.ts +45 -1
  262. package/src/layout/neato/__fixtures__/ipsep/big-dired.gv +243 -0
  263. package/src/layout/neato/__fixtures__/ipsep/big-dired.trace +55 -0
  264. package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot +1832 -0
  265. package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot.stderr +0 -0
  266. package/src/layout/neato/__fixtures__/ipsep/cluster.gv +1 -0
  267. package/src/layout/neato/__fixtures__/ipsep/cluster.trace +95 -0
  268. package/src/layout/neato/__fixtures__/ipsep/cluster.xdot +58 -0
  269. package/src/layout/neato/__fixtures__/ipsep/cluster.xdot.stderr +0 -0
  270. package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.gv +1 -0
  271. package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.trace +40 -0
  272. package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot +72 -0
  273. package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot.stderr +0 -0
  274. package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.gv +1 -0
  275. package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.trace +43 -0
  276. package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot +72 -0
  277. package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot.stderr +0 -0
  278. package/src/layout/neato/__fixtures__/ipsep/dired-hier.gv +1 -0
  279. package/src/layout/neato/__fixtures__/ipsep/dired-hier.trace +43 -0
  280. package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot +71 -0
  281. package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot.stderr +0 -0
  282. package/src/layout/neato/__fixtures__/ipsep/dired-true.gv +1 -0
  283. package/src/layout/neato/__fixtures__/ipsep/dired-true.trace +51 -0
  284. package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot +71 -0
  285. package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot.stderr +0 -0
  286. package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.gv +1 -0
  287. package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.trace +41 -0
  288. package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +77 -0
  289. package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot.stderr +0 -0
  290. package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.gv +1 -0
  291. package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.trace +41 -0
  292. package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +68 -0
  293. package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot.stderr +0 -0
  294. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.gv +1 -0
  295. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.trace +42 -0
  296. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +110 -0
  297. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot.stderr +0 -0
  298. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.gv +1 -0
  299. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.trace +49 -0
  300. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +108 -0
  301. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot.stderr +0 -0
  302. package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.gv +1 -0
  303. package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.trace +43 -0
  304. package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +83 -0
  305. package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot.stderr +0 -0
  306. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.gv +1 -0
  307. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.trace +49 -0
  308. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +48 -0
  309. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot.stderr +0 -0
  310. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.gv +1 -0
  311. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.trace +45 -0
  312. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +47 -0
  313. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot.stderr +0 -0
  314. package/src/layout/neato/__fixtures__/ipsep/len-dired.gv +1 -0
  315. package/src/layout/neato/__fixtures__/ipsep/len-dired.trace +44 -0
  316. package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot +66 -0
  317. package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot.stderr +0 -0
  318. package/src/layout/neato/__fixtures__/ipsep/model-circuit.gv +1 -0
  319. package/src/layout/neato/__fixtures__/ipsep/model-circuit.trace +46 -0
  320. package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot +83 -0
  321. package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot.stderr +0 -0
  322. package/src/layout/neato/__fixtures__/ipsep/model-mds-len.gv +1 -0
  323. package/src/layout/neato/__fixtures__/ipsep/model-mds-len.trace +52 -0
  324. package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot +72 -0
  325. package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot.stderr +0 -0
  326. package/src/layout/neato/__fixtures__/ipsep/model-mds.gv +1 -0
  327. package/src/layout/neato/__fixtures__/ipsep/model-mds.trace +52 -0
  328. package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot +83 -0
  329. package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot.stderr +2 -0
  330. package/src/layout/neato/__fixtures__/ipsep/model-subset.gv +1 -0
  331. package/src/layout/neato/__fixtures__/ipsep/model-subset.trace +49 -0
  332. package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot +83 -0
  333. package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot.stderr +0 -0
  334. package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.gv +1 -0
  335. package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.trace +211 -0
  336. package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot +60 -0
  337. package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot.stderr +0 -0
  338. package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.gv +1 -0
  339. package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.trace +50 -0
  340. package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot +60 -0
  341. package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot.stderr +0 -0
  342. package/src/layout/neato/__fixtures__/ipsep/start-self-dired.gv +1 -0
  343. package/src/layout/neato/__fixtures__/ipsep/start-self-dired.trace +51 -0
  344. package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot +72 -0
  345. package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot.stderr +0 -0
  346. package/src/layout/neato/__fixtures__/ipsep/start-self.gv +1 -0
  347. package/src/layout/neato/__fixtures__/ipsep/start-self.trace +43 -0
  348. package/src/layout/neato/__fixtures__/ipsep/start-self.xdot +84 -0
  349. package/src/layout/neato/__fixtures__/ipsep/start-self.xdot.stderr +0 -0
  350. package/src/layout/neato/__fixtures__/kk-models.ts +82 -0
  351. package/src/layout/neato/__fixtures__/models/hier-circuit.gv +15 -0
  352. package/src/layout/neato/__fixtures__/models/hier-circuit.xdot +92 -0
  353. package/src/layout/neato/__fixtures__/models/hier-circuit.xdot.stderr +0 -0
  354. package/src/layout/neato/__fixtures__/models/hier-default.gv +14 -0
  355. package/src/layout/neato/__fixtures__/models/hier-default.xdot +91 -0
  356. package/src/layout/neato/__fixtures__/models/hier-default.xdot.stderr +0 -0
  357. package/src/layout/neato/__fixtures__/models/hier-disc-circuit.gv +9 -0
  358. package/src/layout/neato/__fixtures__/models/hier-disc-circuit.xdot +54 -0
  359. package/src/layout/neato/__fixtures__/models/hier-disc-circuit.xdot.stderr +0 -0
  360. package/src/layout/neato/__fixtures__/models/hier-len-circuit.gv +15 -0
  361. package/src/layout/neato/__fixtures__/models/hier-len-circuit.xdot +97 -0
  362. package/src/layout/neato/__fixtures__/models/hier-len-circuit.xdot.stderr +0 -0
  363. package/src/layout/neato/__fixtures__/models/hier-len-mds.gv +15 -0
  364. package/src/layout/neato/__fixtures__/models/hier-len-mds.xdot +97 -0
  365. package/src/layout/neato/__fixtures__/models/hier-len-mds.xdot.stderr +0 -0
  366. package/src/layout/neato/__fixtures__/models/hier-len-subset.gv +15 -0
  367. package/src/layout/neato/__fixtures__/models/hier-len-subset.xdot +97 -0
  368. package/src/layout/neato/__fixtures__/models/hier-len-subset.xdot.stderr +0 -0
  369. package/src/layout/neato/__fixtures__/models/hier-long-mds.gv +15 -0
  370. package/src/layout/neato/__fixtures__/models/hier-long-mds.xdot +95 -0
  371. package/src/layout/neato/__fixtures__/models/hier-long-mds.xdot.stderr +0 -0
  372. package/src/layout/neato/__fixtures__/models/hier-mds-nolen.gv +15 -0
  373. package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot +92 -0
  374. package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot.stderr +2 -0
  375. package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.gv +10 -0
  376. package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot +54 -0
  377. package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot.stderr +3 -0
  378. package/src/layout/neato/__fixtures__/models/hier-shortpath.gv +15 -0
  379. package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot +92 -0
  380. package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot.stderr +0 -0
  381. package/src/layout/neato/__fixtures__/models/hier-subset.gv +15 -0
  382. package/src/layout/neato/__fixtures__/models/hier-subset.xdot +92 -0
  383. package/src/layout/neato/__fixtures__/models/hier-subset.xdot.stderr +0 -0
  384. package/src/layout/neato/__fixtures__/models/kk-circuit.gv +15 -0
  385. package/src/layout/neato/__fixtures__/models/kk-circuit.xdot +81 -0
  386. package/src/layout/neato/__fixtures__/models/kk-circuit.xdot.stderr +4 -0
  387. package/src/layout/neato/__fixtures__/models/kk-default.gv +14 -0
  388. package/src/layout/neato/__fixtures__/models/kk-default.xdot +80 -0
  389. package/src/layout/neato/__fixtures__/models/kk-default.xdot.stderr +0 -0
  390. package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.gv +10 -0
  391. package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.native-crash +1 -0
  392. package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.xdot +0 -0
  393. package/src/layout/neato/__fixtures__/models/kk-disc-circuit-pack.xdot.stderr +0 -0
  394. package/src/layout/neato/__fixtures__/models/kk-disc-circuit.gv +9 -0
  395. package/src/layout/neato/__fixtures__/models/kk-disc-circuit.xdot +49 -0
  396. package/src/layout/neato/__fixtures__/models/kk-disc-circuit.xdot.stderr +4 -0
  397. package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.gv +10 -0
  398. package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.xdot +50 -0
  399. package/src/layout/neato/__fixtures__/models/kk-disc-shortpath-pack.xdot.stderr +0 -0
  400. package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.gv +13 -0
  401. package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.native-crash +1 -0
  402. package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.xdot +0 -0
  403. package/src/layout/neato/__fixtures__/models/kk-disc4-circuit-pack.xdot.stderr +4 -0
  404. package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.gv +13 -0
  405. package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.xdot +66 -0
  406. package/src/layout/neato/__fixtures__/models/kk-disc4-shortpath-pack.xdot.stderr +0 -0
  407. package/src/layout/neato/__fixtures__/models/kk-iso-circuit.gv +11 -0
  408. package/src/layout/neato/__fixtures__/models/kk-iso-circuit.xdot +51 -0
  409. package/src/layout/neato/__fixtures__/models/kk-iso-circuit.xdot.stderr +4 -0
  410. package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.gv +11 -0
  411. package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.xdot +57 -0
  412. package/src/layout/neato/__fixtures__/models/kk-iso-len-circuit.xdot.stderr +4 -0
  413. package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.gv +11 -0
  414. package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.xdot +57 -0
  415. package/src/layout/neato/__fixtures__/models/kk-iso-len-mds.xdot.stderr +0 -0
  416. package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.gv +11 -0
  417. package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.xdot +57 -0
  418. package/src/layout/neato/__fixtures__/models/kk-iso-long-mds.xdot.stderr +0 -0
  419. package/src/layout/neato/__fixtures__/models/kk-large.gv +203 -0
  420. package/src/layout/neato/__fixtures__/models/kk-large.pow.json +1088 -0
  421. package/src/layout/neato/__fixtures__/models/kk-large.xdot +1208 -0
  422. package/src/layout/neato/__fixtures__/models/kk-large.xdot.stderr +0 -0
  423. package/src/layout/neato/__fixtures__/models/kk-len-circuit.gv +15 -0
  424. package/src/layout/neato/__fixtures__/models/kk-len-circuit.xdot +86 -0
  425. package/src/layout/neato/__fixtures__/models/kk-len-circuit.xdot.stderr +4 -0
  426. package/src/layout/neato/__fixtures__/models/kk-len-mds.gv +15 -0
  427. package/src/layout/neato/__fixtures__/models/kk-len-mds.xdot +86 -0
  428. package/src/layout/neato/__fixtures__/models/kk-len-mds.xdot.stderr +0 -0
  429. package/src/layout/neato/__fixtures__/models/kk-len-subset.gv +15 -0
  430. package/src/layout/neato/__fixtures__/models/kk-len-subset.xdot +86 -0
  431. package/src/layout/neato/__fixtures__/models/kk-len-subset.xdot.stderr +0 -0
  432. package/src/layout/neato/__fixtures__/models/kk-mds-nolen.gv +15 -0
  433. package/src/layout/neato/__fixtures__/models/kk-mds-nolen.xdot +81 -0
  434. package/src/layout/neato/__fixtures__/models/kk-mds-nolen.xdot.stderr +2 -0
  435. package/src/layout/neato/__fixtures__/models/kk-shortpath.gv +15 -0
  436. package/src/layout/neato/__fixtures__/models/kk-shortpath.xdot +81 -0
  437. package/src/layout/neato/__fixtures__/models/kk-shortpath.xdot.stderr +0 -0
  438. package/src/layout/neato/__fixtures__/models/kk-subset.gv +15 -0
  439. package/src/layout/neato/__fixtures__/models/kk-subset.xdot +81 -0
  440. package/src/layout/neato/__fixtures__/models/kk-subset.xdot.stderr +0 -0
  441. package/src/layout/neato/__fixtures__/models/large-circuit.gv +203 -0
  442. package/src/layout/neato/__fixtures__/models/large-circuit.xdot +1208 -0
  443. package/src/layout/neato/__fixtures__/models/large-circuit.xdot.stderr +0 -0
  444. package/src/layout/neato/__fixtures__/models/major-circuit.gv +14 -0
  445. package/src/layout/neato/__fixtures__/models/major-circuit.xdot +80 -0
  446. package/src/layout/neato/__fixtures__/models/major-circuit.xdot.stderr +0 -0
  447. package/src/layout/neato/__fixtures__/models/major-default.gv +13 -0
  448. package/src/layout/neato/__fixtures__/models/major-default.xdot +79 -0
  449. package/src/layout/neato/__fixtures__/models/major-default.xdot.stderr +0 -0
  450. package/src/layout/neato/__fixtures__/models/major-disc-circuit.gv +8 -0
  451. package/src/layout/neato/__fixtures__/models/major-disc-circuit.xdot +48 -0
  452. package/src/layout/neato/__fixtures__/models/major-disc-circuit.xdot.stderr +0 -0
  453. package/src/layout/neato/__fixtures__/models/major-len-circuit.gv +14 -0
  454. package/src/layout/neato/__fixtures__/models/major-len-circuit.xdot +85 -0
  455. package/src/layout/neato/__fixtures__/models/major-len-circuit.xdot.stderr +0 -0
  456. package/src/layout/neato/__fixtures__/models/major-len-mds.gv +14 -0
  457. package/src/layout/neato/__fixtures__/models/major-len-mds.xdot +85 -0
  458. package/src/layout/neato/__fixtures__/models/major-len-mds.xdot.stderr +0 -0
  459. package/src/layout/neato/__fixtures__/models/major-len-subset.gv +14 -0
  460. package/src/layout/neato/__fixtures__/models/major-len-subset.xdot +85 -0
  461. package/src/layout/neato/__fixtures__/models/major-len-subset.xdot.stderr +0 -0
  462. package/src/layout/neato/__fixtures__/models/major-long-mds.gv +14 -0
  463. package/src/layout/neato/__fixtures__/models/major-long-mds.xdot +83 -0
  464. package/src/layout/neato/__fixtures__/models/major-long-mds.xdot.stderr +0 -0
  465. package/src/layout/neato/__fixtures__/models/major-long-shortpath.gv +14 -0
  466. package/src/layout/neato/__fixtures__/models/major-long-shortpath.xdot +83 -0
  467. package/src/layout/neato/__fixtures__/models/major-long-shortpath.xdot.stderr +0 -0
  468. package/src/layout/neato/__fixtures__/models/major-mds-edge-default.gv +15 -0
  469. package/src/layout/neato/__fixtures__/models/major-mds-edge-default.xdot +81 -0
  470. package/src/layout/neato/__fixtures__/models/major-mds-edge-default.xdot.stderr +0 -0
  471. package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.gv +14 -0
  472. package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.xdot +80 -0
  473. package/src/layout/neato/__fixtures__/models/major-mds-nolen-anon.xdot.stderr +2 -0
  474. package/src/layout/neato/__fixtures__/models/major-mds-nolen.gv +14 -0
  475. package/src/layout/neato/__fixtures__/models/major-mds-nolen.xdot +80 -0
  476. package/src/layout/neato/__fixtures__/models/major-mds-nolen.xdot.stderr +2 -0
  477. package/src/layout/neato/__fixtures__/models/major-model-Subset.gv +14 -0
  478. package/src/layout/neato/__fixtures__/models/major-model-Subset.xdot +80 -0
  479. package/src/layout/neato/__fixtures__/models/major-model-Subset.xdot.stderr +1 -0
  480. package/src/layout/neato/__fixtures__/models/major-model-foo-anon.gv +14 -0
  481. package/src/layout/neato/__fixtures__/models/major-model-foo-anon.xdot +80 -0
  482. package/src/layout/neato/__fixtures__/models/major-model-foo-anon.xdot.stderr +1 -0
  483. package/src/layout/neato/__fixtures__/models/major-model-foo.gv +14 -0
  484. package/src/layout/neato/__fixtures__/models/major-model-foo.xdot +80 -0
  485. package/src/layout/neato/__fixtures__/models/major-model-foo.xdot.stderr +1 -0
  486. package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.gv +9 -0
  487. package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.xdot +48 -0
  488. package/src/layout/neato/__fixtures__/models/major-pin-disc-circuit.xdot.stderr +2 -0
  489. package/src/layout/neato/__fixtures__/models/major-shortpath.gv +14 -0
  490. package/src/layout/neato/__fixtures__/models/major-shortpath.xdot +80 -0
  491. package/src/layout/neato/__fixtures__/models/major-shortpath.xdot.stderr +0 -0
  492. package/src/layout/neato/__fixtures__/models/major-subset.gv +14 -0
  493. package/src/layout/neato/__fixtures__/models/major-subset.xdot +80 -0
  494. package/src/layout/neato/__fixtures__/models/major-subset.xdot.stderr +0 -0
  495. package/src/layout/neato/__fixtures__/models/regen.sh +46 -0
  496. package/src/layout/neato/__fixtures__/quad-prog-vpsc.ts +115 -0
  497. package/src/layout/neato/__fixtures__/stress-models.ts +64 -0
  498. package/src/layout/neato/circuit.ts +96 -0
  499. package/src/layout/neato/constrained-majorization.ts +5 -22
  500. package/src/layout/neato/index.ts +43 -16
  501. package/src/layout/neato/init.ts +31 -44
  502. package/src/layout/neato/ipsep-opts.ts +158 -0
  503. package/src/layout/neato/kk-paths.ts +23 -1
  504. package/src/layout/neato/kk-solve.ts +5 -3
  505. package/src/layout/neato/kk.ts +53 -21
  506. package/src/layout/neato/kkutils.ts +108 -3
  507. package/src/layout/neato/lu.ts +189 -0
  508. package/src/layout/neato/matinv.ts +37 -0
  509. package/src/layout/neato/quad-prog-vpsc-overlap.ts +365 -0
  510. package/src/layout/neato/quad-prog-vpsc.ts +416 -0
  511. package/src/layout/neato/start.ts +24 -84
  512. package/src/layout/neato/stress-cola.ts +497 -0
  513. package/src/layout/neato/stress-kernel.ts +1 -17
  514. package/src/layout/neato/stress-models.ts +208 -0
  515. package/src/layout/neato/vpsc-adjust.ts +35 -66
  516. package/src/layout/pack/index.ts +2 -2
  517. package/src/render/color-resolve.ts +25 -2
  518. package/src/render/dot/edge-draw.ts +7 -4
  519. package/src/render/svg-arrow-ops.ts +35 -19
  520. package/src/render/svg-edge-arrows.ts +7 -6
  521. package/src/render/svg-helpers.ts +19 -11
  522. package/src/render/svg.ts +15 -3
  523. package/src/vpsc/SweepLine.ts +39 -26
  524. package/src/vpsc/sweepTypes.ts +13 -2
@@ -7,17 +7,30 @@
7
7
  import { Variable } from "./Variable.js";
8
8
  import { Constraint } from "./Constraint.js";
9
9
  import { Rectangle } from "./Solver.js";
10
- import { SweepNode, SweepEvent } from "./sweepTypes.js";
11
- export declare function makeNode(v: Variable, r: Rectangle, pos: number): SweepNode;
10
+ import { NodeSet, SweepNode, SweepEvent } from "./sweepTypes.js";
11
+ /**
12
+ * `seq` is the `make_shared<Node>` order: the rectangle index of the pass.
13
+ * @see lib/vpsc/generate-constraints.cpp: Node::Node
14
+ */
15
+ export declare function makeNode(v: Variable, r: Rectangle, pos: number, seq: number): SweepNode;
12
16
  export declare function compareEventsSameRect(ea: SweepEvent, eb: SweepEvent): number;
13
17
  export declare function compareEvents(ea: SweepEvent, eb: SweepEvent): number;
18
+ /**
19
+ * C++ ends with `u < v` on `Node*`. Addresses cannot be reproduced and vary run
20
+ * to run, so a position tie goes by creation order (part-8 AD-8).
21
+ * @see lib/vpsc/generate-constraints.cpp: CmpNodePos::operator()
22
+ */
14
23
  export declare function nodePosLt(a: SweepNode, b: SweepNode): boolean;
15
- export declare function scanlineInsert(sl: SweepNode[], node: SweepNode): void;
16
- export declare function scanlineRemove(sl: SweepNode[], node: SweepNode): void;
17
- export declare function getLeftNeighbours(sl: SweepNode[], v: SweepNode): Set<SweepNode>;
18
- export declare function getRightNeighbours(sl: SweepNode[], v: SweepNode): Set<SweepNode>;
19
- export declare function xOpenNeighbour(sl: SweepNode[], v: SweepNode): void;
20
- export declare function openLinkChain(sl: SweepNode[], v: SweepNode): void;
24
+ /** @see lib/vpsc/generate-constraints.cpp: NodeSet::insert (std::set, so no duplicates) */
25
+ export declare function scanlineInsert(sl: NodeSet, node: SweepNode): void;
26
+ export declare function scanlineRemove(sl: NodeSet, node: SweepNode): void;
27
+ /** @see lib/vpsc/generate-constraints.cpp: getLeftNeighbours */
28
+ export declare function getLeftNeighbours(sl: NodeSet, v: SweepNode): NodeSet;
29
+ /** @see lib/vpsc/generate-constraints.cpp: getRightNeighbours */
30
+ export declare function getRightNeighbours(sl: NodeSet, v: SweepNode): NodeSet;
31
+ /** @see lib/vpsc/generate-constraints.cpp: Node::setNeighbours */
32
+ export declare function xOpenNeighbour(sl: NodeSet, v: SweepNode): void;
33
+ export declare function openLinkChain(sl: NodeSet, v: SweepNode): void;
21
34
  export declare function xCloseLeft(v: SweepNode, cs: Constraint[]): void;
22
35
  export declare function xCloseRight(v: SweepNode, cs: Constraint[]): void;
23
36
  export declare function xCloseNeighbour(v: SweepNode, cs: Constraint[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"SweepLine.d.ts","sourceRoot":"","sources":["../../src/vpsc/SweepLine.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAU,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEhE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAM1E;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAG5E;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,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B,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,EAAE,EAAE,QAAQ,EAAE,EACd,iBAAiB,EAAE,OAAO,GACzB,UAAU,EAAE,CAkBd;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,EAAE,EAAE,QAAQ,EAAE,GACb,UAAU,EAAE,CAgBd"}
@@ -12,14 +12,24 @@ export declare const EvType: {
12
12
  readonly Close: 1;
13
13
  };
14
14
  export type EvType = (typeof EvType)[keyof typeof EvType];
15
+ /**
16
+ * `std::set<Node*, CmpNodePos>`: an array kept in `nodePosLt` order.
17
+ * @see lib/vpsc/generate-constraints.cpp: NodeSet
18
+ */
19
+ export type NodeSet = SweepNode[];
15
20
  export interface SweepNode {
16
21
  v: Variable;
17
22
  r: Rectangle;
18
23
  pos: number;
24
+ /**
25
+ * Creation order in this pass, standing in for the `Node*` address that
26
+ * `CmpNodePos` compares on a position tie (part-8 AD-8).
27
+ */
28
+ seq: number;
19
29
  firstAbove: SweepNode | null;
20
30
  firstBelow: SweepNode | null;
21
- leftNeighbours: Set<SweepNode>;
22
- rightNeighbours: Set<SweepNode>;
31
+ leftNeighbours: NodeSet;
32
+ rightNeighbours: NodeSet;
23
33
  }
24
34
  export interface SweepEvent {
25
35
  type: EvType;
@@ -1 +1 @@
1
- {"version":3,"file":"sweepTypes.d.ts","sourceRoot":"","sources":["../../src/vpsc/sweepTypes.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,MAAM;;;CAAiC,CAAC;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,QAAQ,CAAC;IACZ,CAA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
  {
2
2
  "name": "@knowvah/dot-engine",
3
- "version": "2.8.1",
3
+ "version": "2.10.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",
@@ -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 { setImageHooks, setImagePath } from './safefile.js';
33
34
 
34
35
  // ---------------------------------------------------------------------------
35
36
  // Constants — @see lib/common/const.h
@@ -274,8 +275,13 @@ export function graphInit(g: Graph, useRankdir: boolean): void {
274
275
 
275
276
  g.info.charset = findCharset(g); // @see input.c:631
276
277
 
277
- // SKIPPED — Gvimagepath / `imagepath` (input.c:633-638): the port loads no
278
- // images from disk (browser-safe: image data arrives as a parameter).
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'));
281
+ // The layout's own sizer/resolver stand in for the filesystem safefile reads
282
+ // (AD-7); the context installs itself on the root before the engine runs.
283
+ const gvc = g.root.info.gvc;
284
+ setImageHooks(gvc?.imageSizer, gvc?.imageResolver);
279
285
 
280
286
  // SKIPPED — GD_drawing(g)->quantum (input.c:640-641): derived at its only
281
287
  // use-site, nodeinit.ts:129 — `lateDouble(g.root.attrs.get('quantum'), 0, 0)`
@@ -22,10 +22,10 @@ import type {
22
22
  HtmlCell, HtmlCellContent, HtmlImage, HtmlLabel, HtmlTable, HtmlText,
23
23
  ImageSizer,
24
24
  } from './htmltable-types.js';
25
- import { DEFAULT_DPI, imageIsSupplied, imageOpenWarning, usershapeSizePts } from '../gvc/usershape.js';
25
+ import { DEFAULT_DPI, imageOpenFailure, usershapeSizePts } from '../gvc/usershape.js';
26
26
  import { registerRenderState } from './render-state.js';
27
27
  import { PointSet } from './pointset.js';
28
- import type { ImageResolver } from '../gvc/image-resolver.js';
28
+ import { getGlobalImageResolver, type ImageResolver } from '../gvc/image-resolver.js';
29
29
  import type { TextMeasurer } from './textmeasure.js';
30
30
  import { buildLineRuns, runsAreSimple } from './htmltable-pos-runs.js';
31
31
  import { withTableFont } from './htmltable-fontinfo.js';
@@ -142,7 +142,8 @@ const sizeHtmlImg = (img: HtmlImage, { imageSizer, imageResolver, imageDpi, stde
142
142
  // share layoutHtmlTable, so guard against re-sizing (and re-warning). The
143
143
  // returned rv still follows C on every call.
144
144
  if (img.width !== undefined && img.height !== undefined) return missingImages.set.has(img) ? 1 : 0;
145
- const sz = usershapeSizePts(img.src, imageDpi ?? DEFAULT_DPI, imageSizer);
145
+ const resolver = imageResolver ?? getGlobalImageResolver() ?? undefined;
146
+ const sz = usershapeSizePts(img.src, imageDpi ?? DEFAULT_DPI, imageSizer, resolver);
146
147
  if (sz !== null) {
147
148
  img.width = sz.x; img.height = sz.y;
148
149
  return 0;
@@ -150,7 +151,8 @@ const sizeHtmlImg = (img: HtmlImage, { imageSizer, imageResolver, imageDpi, stde
150
151
  // Missing-image: gvusershape_open's warning (unless bytes are supplied),
151
152
  // then zero size + the Error.
152
153
  // @see lib/gvc/gvusershape.c:gvusershape_file_access
153
- if (!imageIsSupplied(img.src, imageSizer, imageResolver)) agerrLine(stderr, `Warning: ${imageOpenWarning(img.src)}`);
154
+ const failure = imageOpenFailure(img.src, imageSizer, resolver);
155
+ if (failure !== null) agerrLine(stderr, `Warning: ${failure}`);
154
156
  // C: agerrorf("No or improper image file=\"%s\"\n", img->src) — agerr
155
157
  // prefixes "Error: " on stderr.
156
158
  agerrLine(stderr, `Error: No or improper image file="${img.src}"`);
@@ -372,7 +372,8 @@ function applyFillState(obj: ObjState, n: Node, job: RenderJob): boolean {
372
372
  // point_gencode always fills, defaulting to black (AD-4).
373
373
  if (isPointNode(n)) {
374
374
  obj.fill = FillType.Solid;
375
- obj.fillColor = resolveRenderColor(findFillDflt(n));
375
+ // point_gencode: gvrender_set_fillcolor(job, color) cuts a list at ':'.
376
+ obj.fillColor = resolveFillColorName(findFillDflt(n));
376
377
  return true;
377
378
  }
378
379
  const fillRes = resolveNodeFillEx({
@@ -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';
@@ -26,7 +26,8 @@ import {
26
26
  } from './make-label.js';
27
27
  import { computeVertices } from './poly-vertices.js';
28
28
  import { agwarningf } from './agerr.js';
29
- import { imageIsSupplied, imageOpenWarning, usershapeDpi, usershapeSizePts } from '../gvc/usershape.js';
29
+ import { getGlobalImageResolver } from '../gvc/image-resolver.js';
30
+ import { imageOpenFailure, usershapeDpi, usershapeSizePts } from '../gvc/usershape.js';
30
31
 
31
32
  // Default half-dimensions in points (72 dpi, 0.75 in wide, 0.5 in tall)
32
33
  const DEFAULT_LW = 27;
@@ -98,44 +99,72 @@ export function buildNodeLabel(n: Node, g: Graph, measurer: TextMeasurer): void
98
99
  n.info.label = makeAnyLabel(content, isHtml, font, measurer, n);
99
100
  }
100
101
 
102
+ /**
103
+ * gvusershape_size for a custom shape's non-empty shapefile: true when the
104
+ * caller's hooks size it (no warning at all), else prints gvusershape_open's
105
+ * failure line, if any.
106
+ * @see lib/common/shapes.c:2033, lib/gvc/gvusershape.c:gvusershape_open
107
+ */
108
+ function warnShapefileOpen(g: Graph, shapefile: string): boolean {
109
+ const gvc = g.root.info.gvc;
110
+ const resolver = gvc?.imageResolver ?? getGlobalImageResolver() ?? undefined;
111
+ if (usershapeSizePts(shapefile, usershapeDpi(g.root.attrs), gvc?.imageSizer, resolver) !== null) return true;
112
+ const failure = imageOpenFailure(shapefile, gvc?.imageSizer, resolver);
113
+ if (failure !== null) agwarningf(failure);
114
+ return false;
115
+ }
116
+
101
117
  /**
102
118
  * 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.
119
+ * common_init_node after the label is made. For a custom shape whose
120
+ * gvusershape_size fails, gvusershape_open's warning precedes the "No or
121
+ * improper shapefile" line; a shapefile the caller's sizer/resolver sizes prints
122
+ * nothing. For a non-custom shape's `image=`, the caller-supplied sizer/resolver
123
+ * decides; when it supplies nothing the same pair is emitted.
108
124
  * @see lib/common/shapes.c:2027-2046
109
125
  */
110
126
  export function warnPolyInitImages(n: Node, g: Graph): void {
111
- const shapefile = nodeAttr(n, g, 'shapefile');
112
- if (shapefile !== undefined && shapefile !== '') {
113
- if (nodeAttr(n, g, 'shape') !== 'epsf') {
114
- agwarningf(imageOpenWarning(shapefile));
115
- agwarningf(`No or improper shapefile="${shapefile}" for node "${n.name}"`);
116
- return;
117
- }
127
+ const shape = boundShape(n, g);
128
+ if (shape.usershape) {
129
+ if (shape.name !== CUSTOM_SHAPE_NAME) return;
130
+ const shapefile = nodeAttr(n, g, 'shapefile');
131
+ if (shapefile !== undefined && shapefile !== '' && warnShapefileOpen(g, shapefile)) return;
132
+ agwarningf(`No or improper shapefile="${shapefile ?? '<nil>'}" for node "${n.name}"`);
133
+ return;
118
134
  }
119
135
  const image = nodeAttr(n, g, 'image');
120
136
  if (image === undefined || image === '') return;
121
137
  const gvc = g.root.info.gvc;
122
- if (imageIsSupplied(image, gvc?.imageSizer, gvc?.imageResolver)) return;
123
- agwarningf(imageOpenWarning(image));
138
+ const failure = imageOpenFailure(image, gvc?.imageSizer, gvc?.imageResolver ?? getGlobalImageResolver() ?? undefined);
139
+ if (failure === null) return;
140
+ agwarningf(failure);
124
141
  agwarningf(`No or improper image="${image}" for node "${n.name}"`);
125
142
  }
126
143
 
144
+ /** The node's bound descriptor (set by common_init_node), else bound now. */
145
+ function boundShape(n: Node, g: Graph): ShapeDesc {
146
+ return (
147
+ (n.info.shape as ShapeDesc | undefined) ??
148
+ bindShape(nodeAttr(n, g, 'shape') ?? 'ellipse', nodeAttr(n, g, 'shapefile'))
149
+ );
150
+ }
151
+
127
152
  /**
128
- * poly_init's imagesize for a non-custom shape's `image=`: gvusershape_size in
153
+ * poly_init's imagesize for a non-usershape's `image=`: gvusershape_size in
129
154
  * points plus the fixed 2pt padding, and GD_has_images. Null (C's imagesize 0)
130
155
  * when there is no image or the caller supplies no size; the missing-image
131
- * warning stays in warnMissingImage.
132
- * @see lib/common/shapes.c:2039-2051
156
+ * warning stays in warnPolyInitImages. A `custom` shape sizes its shapefile
157
+ * the same way; any other usershape has imagesize 0.
158
+ * @see lib/common/shapes.c:2027-2051
133
159
  */
134
160
  export function nodeImageSize(n: Node, g: Graph): { x: number; y: number } | undefined {
135
- const shapefile = nodeAttr(n, g, 'shapefile');
136
- if (shapefile !== undefined && shapefile !== '') return undefined;
161
+ const shape = boundShape(n, g);
162
+ if (shape.usershape && shape.name !== CUSTOM_SHAPE_NAME) return undefined;
137
163
  const gvc = g.root.info.gvc;
138
- const sz = usershapeSizePts(nodeAttr(n, g, 'image'), usershapeDpi(g.root.attrs), gvc?.imageSizer);
164
+ const sz = usershapeSizePts(
165
+ shape.usershape ? nodeAttr(n, g, 'shapefile') : nodeAttr(n, g, 'image'), usershapeDpi(g.root.attrs), gvc?.imageSizer,
166
+ gvc?.imageResolver ?? getGlobalImageResolver() ?? undefined,
167
+ );
139
168
  if (sz === null) return undefined;
140
169
  g.root.info.has_images = true;
141
170
  return { x: sz.x + 2, y: sz.y + 2 }; // some fixed padding
@@ -0,0 +1,92 @@
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 type { ImageResolver } from '../gvc/image-resolver.js';
16
+ import { imageIsSupplied, type ImageSizer } from '../gvc/usershape.js';
17
+ import { registerRenderState } from './render-state.js';
18
+
19
+ /** utils.c PATHSEP on non-Windows. */
20
+ const PATHSEP = ':';
21
+ /** C's PATH_SEPARATOR, tested on the first character of the name. */
22
+ const PATH_SEPARATOR = '/';
23
+
24
+ /**
25
+ * `Gvimagepath` (a C process global, initially NULL). Held in a const
26
+ * container, reset per render; graph_init overwrites it on every graph.
27
+ * @see lib/common/globals.h:Gvimagepath
28
+ */
29
+ const imagePathState: { value: string | undefined } = { value: undefined };
30
+ registerRenderState(() => { imagePathState.value = undefined; });
31
+
32
+ /**
33
+ * The layout's effective sizer and resolver (the per-context hooks, else
34
+ * undefined so the global ones apply). They stand in for C's filesystem and
35
+ * are set beside `Gvimagepath` at graph init (AD-7).
36
+ */
37
+ const imageHooksState: { sizer: ImageSizer | undefined; resolver: ImageResolver | undefined } = {
38
+ sizer: undefined,
39
+ resolver: undefined,
40
+ };
41
+ registerRenderState(() => { imageHooksState.sizer = undefined; imageHooksState.resolver = undefined; });
42
+
43
+ /** Record the layout's per-context image hooks; graph_init calls this per graph. */
44
+ export function setImageHooks(sizer: ImageSizer | undefined, resolver: ImageResolver | undefined): void {
45
+ imageHooksState.sizer = sizer;
46
+ imageHooksState.resolver = resolver;
47
+ }
48
+
49
+ /**
50
+ * graph_init's `Gvimagepath = agget(g, "imagepath")`, falling back to
51
+ * `Gvfilepath` (unported: it comes from the command line/environment, so the
52
+ * fallback is NULL).
53
+ * @see lib/common/input.c:graph_init (627-630)
54
+ */
55
+ export function setImagePath(imagepath: string | undefined): void {
56
+ imagePathState.value = imagepath;
57
+ }
58
+
59
+ /**
60
+ * The directory list `mkDirlist` builds: the split on PATHSEP, empty tokens
61
+ * included only as `tok` yields them (it yields none for an empty list).
62
+ * @see lib/common/utils.c:mkDirlist
63
+ */
64
+ export function mkDirlist(list: string): string[] {
65
+ return list === '' ? [] : list.split(PATHSEP);
66
+ }
67
+
68
+ /**
69
+ * First directory whose `dir/str` is readable; here, the host supplies `str`.
70
+ * C returns the joined path; lookups stay keyed by the raw name, so the
71
+ * result is `str`.
72
+ * @see lib/common/utils.c:findPath
73
+ */
74
+ function findPath(dirs: readonly string[], str: string): string | null {
75
+ return dirs.length > 0 && imageIsSupplied(str, imageHooksState.sizer, imageHooksState.resolver) ? str : null;
76
+ }
77
+
78
+ /**
79
+ * NULL (here null) for a trivial name or one not found along `Gvimagepath`;
80
+ * the name itself when the list is empty or the name is absolute.
81
+ * Unported branches: `HTTPServerEnVar` (SERVER_NAME, always NULL) and
82
+ * `Gvfilepath` (GV_FILE_PATH, a basename search) - the browser has no
83
+ * environment.
84
+ * @see lib/common/utils.c:safefile (253-311)
85
+ */
86
+ export function safefile(filename: string | undefined): string | null {
87
+ if (filename === undefined || filename === '') return null;
88
+ const pathlist = imagePathState.value;
89
+ const dirs = pathlist !== undefined && pathlist !== '' ? mkDirlist(pathlist) : [];
90
+ if (filename.startsWith(PATH_SEPARATOR) || dirs.length === 0) return filename;
91
+ return findPath(dirs, filename);
92
+ }
@@ -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
- * Returns the ShapeDesc for the given name (case-sensitive).
161
- * Falls back to Shapes[0] (box) when the name is not recognised.
162
- *
163
- * Equivalent to C's bind_shape() for built-in shapes; the user-shape
164
- * and shapefile branches require a node argument not yet ported.
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
- // C bind_shape: a non-empty shapefile attr (safefile is a pass-through when
170
- // no HTTP server / Gvfilepath is configured) switches any non-epsf shape to
171
- // "custom" — a user_shape clone of Shapes[0] (box). Headless, the image
172
- // never loads (gvusershape_size fails, warning printed at sizing), so the
173
- // node renders as a plain box outline at its normal dims — which is exactly
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 Shapes[0];
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"]}