@knowvah/dot-engine 2.12.1 → 2.12.3

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 (308) hide show
  1. package/dist/api/builder.d.ts +7 -1
  2. package/dist/api/builder.d.ts.map +1 -1
  3. package/dist/api.js +14 -7
  4. package/dist/api.js.map +2 -2
  5. package/dist/common/compass-port.d.ts.map +1 -1
  6. package/dist/common/edge-label-init.d.ts +26 -1
  7. package/dist/common/edge-label-init.d.ts.map +1 -1
  8. package/dist/common/graph-init.d.ts.map +1 -1
  9. package/dist/common/htmltable-label.d.ts.map +1 -1
  10. package/dist/common/htmltable-lex.d.ts +3 -1
  11. package/dist/common/htmltable-lex.d.ts.map +1 -1
  12. package/dist/common/htmltable-parse-image.d.ts +23 -0
  13. package/dist/common/htmltable-parse-image.d.ts.map +1 -0
  14. package/dist/common/htmltable-parse-state.d.ts +4 -0
  15. package/dist/common/htmltable-parse-state.d.ts.map +1 -1
  16. package/dist/common/htmltable-parse.d.ts +33 -2
  17. package/dist/common/htmltable-parse.d.ts.map +1 -1
  18. package/dist/common/nodeinit.d.ts +16 -2
  19. package/dist/common/nodeinit.d.ts.map +1 -1
  20. package/dist/common/poly-inside.d.ts.map +1 -1
  21. package/dist/common/splines-geom.d.ts +2 -1
  22. package/dist/common/splines-geom.d.ts.map +1 -1
  23. package/dist/common/splines-path-begin.d.ts.map +1 -1
  24. package/dist/common/splines-path-end.d.ts.map +1 -1
  25. package/dist/common/splines-routespl.d.ts +3 -0
  26. package/dist/common/splines-routespl.d.ts.map +1 -1
  27. package/dist/gvc/context.d.ts +8 -0
  28. package/dist/gvc/context.d.ts.map +1 -1
  29. package/dist/gvc/emit-gates.d.ts +5 -10
  30. package/dist/gvc/emit-gates.d.ts.map +1 -1
  31. package/dist/gvc/emit-xdot.d.ts +7 -6
  32. package/dist/gvc/emit-xdot.d.ts.map +1 -1
  33. package/dist/gvc/job.d.ts +5 -2
  34. package/dist/gvc/job.d.ts.map +1 -1
  35. package/dist/gvc/viewport.d.ts +10 -5
  36. package/dist/gvc/viewport.d.ts.map +1 -1
  37. package/dist/index.js +21565 -21326
  38. package/dist/index.js.map +4 -4
  39. package/dist/layout/dot/classify.d.ts.map +1 -1
  40. package/dist/layout/dot/edge-route-chain-views.d.ts +35 -0
  41. package/dist/layout/dot/edge-route-chain-views.d.ts.map +1 -0
  42. package/dist/layout/dot/edge-route-chain.d.ts +20 -16
  43. package/dist/layout/dot/edge-route-chain.d.ts.map +1 -1
  44. package/dist/layout/dot/edge-route-faithful.d.ts.map +1 -1
  45. package/dist/layout/dot/edge-route.d.ts +7 -3
  46. package/dist/layout/dot/edge-route.d.ts.map +1 -1
  47. package/dist/layout/dot/fastgr.d.ts +5 -3
  48. package/dist/layout/dot/fastgr.d.ts.map +1 -1
  49. package/dist/layout/dot/flat-adj-record.d.ts +22 -0
  50. package/dist/layout/dot/flat-adj-record.d.ts.map +1 -0
  51. package/dist/layout/dot/flat.d.ts +22 -7
  52. package/dist/layout/dot/flat.d.ts.map +1 -1
  53. package/dist/layout/dot/init.d.ts +49 -9
  54. package/dist/layout/dot/init.d.ts.map +1 -1
  55. package/dist/layout/dot/mincross-build.d.ts +6 -0
  56. package/dist/layout/dot/mincross-build.d.ts.map +1 -1
  57. package/dist/layout/dot/mincross-flat.d.ts +10 -1
  58. package/dist/layout/dot/mincross-flat.d.ts.map +1 -1
  59. package/dist/layout/dot/mincross.d.ts +6 -1
  60. package/dist/layout/dot/mincross.d.ts.map +1 -1
  61. package/dist/layout/dot/ns-subtree.d.ts +9 -6
  62. package/dist/layout/dot/ns-subtree.d.ts.map +1 -1
  63. package/dist/layout/dot/pack-components.d.ts +4 -3
  64. package/dist/layout/dot/pack-components.d.ts.map +1 -1
  65. package/dist/layout/dot/position-aux.d.ts +69 -21
  66. package/dist/layout/dot/position-aux.d.ts.map +1 -1
  67. package/dist/layout/dot/position-bbox.d.ts.map +1 -1
  68. package/dist/layout/dot/position-ycoords.d.ts.map +1 -1
  69. package/dist/layout/dot/position.d.ts.map +1 -1
  70. package/dist/layout/dot/rank-dot2.d.ts +7 -25
  71. package/dist/layout/dot/rank-dot2.d.ts.map +1 -1
  72. package/dist/layout/dot/self-loop.d.ts +11 -4
  73. package/dist/layout/dot/self-loop.d.ts.map +1 -1
  74. package/dist/layout/dot/splines-clone.d.ts +2 -1
  75. package/dist/layout/dot/splines-clone.d.ts.map +1 -1
  76. package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
  77. package/dist/layout/dot/splines-flat-multi.d.ts +11 -3
  78. package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -1
  79. package/dist/layout/dot/splines-flat.d.ts +18 -0
  80. package/dist/layout/dot/splines-flat.d.ts.map +1 -1
  81. package/dist/layout/dot/splines-groups.d.ts.map +1 -1
  82. package/dist/layout/dot/splines-route.d.ts +6 -3
  83. package/dist/layout/dot/splines-route.d.ts.map +1 -1
  84. package/dist/layout/dot/straight-edges.d.ts.map +1 -1
  85. package/dist/layout/fdp/ports.d.ts.map +1 -1
  86. package/dist/layout/fdp/tlayout.d.ts +3 -0
  87. package/dist/layout/fdp/tlayout.d.ts.map +1 -1
  88. package/dist/layout/neato/__fixtures__/hier-imds.d.ts +5 -4
  89. package/dist/layout/neato/__fixtures__/hier-imds.d.ts.map +1 -1
  90. package/dist/layout/neato/__fixtures__/hier-majorization.d.ts +6 -5
  91. package/dist/layout/neato/__fixtures__/hier-majorization.d.ts.map +1 -1
  92. package/dist/layout/neato/conjgrad-mkernel.d.ts.map +1 -1
  93. package/dist/layout/neato/conjgrad.d.ts +7 -6
  94. package/dist/layout/neato/conjgrad.d.ts.map +1 -1
  95. package/dist/layout/neato/matrix-ops-dense.d.ts +1 -6
  96. package/dist/layout/neato/matrix-ops-dense.d.ts.map +1 -1
  97. package/dist/layout/neato/matrix-ops.d.ts +0 -6
  98. package/dist/layout/neato/matrix-ops.d.ts.map +1 -1
  99. package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -1
  100. package/dist/layout/neato/sgd.d.ts.map +1 -1
  101. package/dist/model/cgraph-ops.d.ts +10 -2
  102. package/dist/model/cgraph-ops.d.ts.map +1 -1
  103. package/dist/model/edge.d.ts +7 -2
  104. package/dist/model/edge.d.ts.map +1 -1
  105. package/dist/model/edgeInfo.d.ts +17 -2
  106. package/dist/model/edgeInfo.d.ts.map +1 -1
  107. package/dist/model/graph.d.ts +4 -3
  108. package/dist/model/graph.d.ts.map +1 -1
  109. package/dist/model/lazy-attrs.d.ts.map +1 -1
  110. package/dist/model/rankEntry.d.ts +3 -1
  111. package/dist/model/rankEntry.d.ts.map +1 -1
  112. package/dist/ortho/index.d.ts +0 -1
  113. package/dist/ortho/index.d.ts.map +1 -1
  114. package/dist/ortho/partition.d.ts +2 -4
  115. package/dist/ortho/partition.d.ts.map +1 -1
  116. package/dist/parser/builder.d.ts.map +1 -1
  117. package/dist/pathplan/route.d.ts +93 -0
  118. package/dist/pathplan/route.d.ts.map +1 -1
  119. package/dist/render/dot/agwrite.d.ts +26 -10
  120. package/dist/render/dot/agwrite.d.ts.map +1 -1
  121. package/dist/render/dot/attrs.d.ts +15 -4
  122. package/dist/render/dot/attrs.d.ts.map +1 -1
  123. package/dist/render/dot/types.d.ts +7 -2
  124. package/dist/render/dot/types.d.ts.map +1 -1
  125. package/dist/render/dot/write-back.d.ts +14 -0
  126. package/dist/render/dot/write-back.d.ts.map +1 -1
  127. package/dist/render/dot/xdot-ops.d.ts +20 -29
  128. package/dist/render/dot/xdot-ops.d.ts.map +1 -1
  129. package/dist/render/dot.d.ts +4 -2
  130. package/dist/render/dot.d.ts.map +1 -1
  131. package/dist/render/json-cluster-edge.d.ts +17 -4
  132. package/dist/render/json-cluster-edge.d.ts.map +1 -1
  133. package/dist/render/json-nonfinite.d.ts +17 -0
  134. package/dist/render/json-nonfinite.d.ts.map +1 -0
  135. package/dist/render/json.d.ts +4 -0
  136. package/dist/render/json.d.ts.map +1 -1
  137. package/dist/render/map.d.ts +3 -0
  138. package/dist/render/map.d.ts.map +1 -1
  139. package/dist/render/svg-graph.d.ts.map +1 -1
  140. package/dist/render/svg-id.d.ts +10 -1
  141. package/dist/render/svg-id.d.ts.map +1 -1
  142. package/dist/render/svg.d.ts +3 -1
  143. package/dist/render/svg.d.ts.map +1 -1
  144. package/dist/render.js +21517 -21278
  145. package/dist/render.js.map +4 -4
  146. package/dist/util/bsd-qsort.d.ts.map +1 -1
  147. package/dist/util/overflow.d.ts +37 -0
  148. package/dist/util/overflow.d.ts.map +1 -0
  149. package/dist/xdot/parse.d.ts.map +1 -1
  150. package/dist/xdot/strtod.d.ts +23 -0
  151. package/dist/xdot/strtod.d.ts.map +1 -0
  152. package/package.json +3 -2
  153. package/src/api/builder.ts +8 -2
  154. package/src/common/compass-port.ts +36 -20
  155. package/src/common/edge-label-init.ts +43 -17
  156. package/src/common/graph-init.ts +11 -1
  157. package/src/common/htmltable-label.ts +9 -4
  158. package/src/common/htmltable-lex.ts +5 -2
  159. package/src/common/htmltable-parse-image.ts +69 -0
  160. package/src/common/htmltable-parse-state.ts +6 -0
  161. package/src/common/htmltable-parse.ts +34 -44
  162. package/src/common/nodeinit.ts +28 -8
  163. package/src/common/poly-inside.ts +11 -5
  164. package/src/common/splines-geom.ts +24 -6
  165. package/src/common/splines-path-begin.ts +4 -3
  166. package/src/common/splines-path-end.ts +4 -3
  167. package/src/common/splines-routespl.ts +32 -0
  168. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.1 +19 -19
  169. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.2 +19 -19
  170. package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.3 +19 -19
  171. package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.2 +18 -18
  172. package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.3 +12 -12
  173. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.1 +20 -20
  174. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.2 +31 -31
  175. package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.3 +33 -33
  176. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +10 -10
  177. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +28 -28
  178. package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +28 -28
  179. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.1 +21 -28
  180. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.2 +100 -102
  181. package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.3 +137 -139
  182. package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.1 +1 -1
  183. package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.2 +1 -1
  184. package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.3 +1 -1
  185. package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.1 +3 -3
  186. package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.2 +3 -3
  187. package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.3 +3 -3
  188. package/src/gvc/__fixtures__/rerender/regen.sh +6 -0
  189. package/src/gvc/context.ts +8 -0
  190. package/src/gvc/device.ts +6 -6
  191. package/src/gvc/emit-gates.ts +6 -15
  192. package/src/gvc/emit-xdot.ts +10 -11
  193. package/src/gvc/job.ts +5 -2
  194. package/src/gvc/viewport.ts +13 -7
  195. package/src/layout/dot/__fixtures__/flat-adj-aux-syms.native-16.1.json +1210 -0
  196. package/src/layout/dot/classify.ts +5 -2
  197. package/src/layout/dot/edge-route-chain-views.ts +120 -0
  198. package/src/layout/dot/edge-route-chain.ts +103 -117
  199. package/src/layout/dot/edge-route-faithful.ts +20 -5
  200. package/src/layout/dot/edge-route.ts +44 -49
  201. package/src/layout/dot/fastgr.ts +9 -3
  202. package/src/layout/dot/flat-adj-record.ts +68 -0
  203. package/src/layout/dot/flat.ts +38 -17
  204. package/src/layout/dot/init.ts +59 -13
  205. package/src/layout/dot/mincross-build.ts +14 -1
  206. package/src/layout/dot/mincross-flat.ts +15 -5
  207. package/src/layout/dot/mincross.ts +6 -2
  208. package/src/layout/dot/ns-subtree.ts +11 -7
  209. package/src/layout/dot/pack-components.ts +6 -4
  210. package/src/layout/dot/position-aux.ts +122 -42
  211. package/src/layout/dot/position-bbox.ts +14 -1
  212. package/src/layout/dot/position-ycoords.ts +7 -1
  213. package/src/layout/dot/position.ts +4 -1
  214. package/src/layout/dot/rank-dot2.ts +13 -94
  215. package/src/layout/dot/self-loop.ts +29 -11
  216. package/src/layout/dot/splines-clone.ts +8 -2
  217. package/src/layout/dot/splines-flat-labeled.ts +3 -2
  218. package/src/layout/dot/splines-flat-multi.ts +12 -4
  219. package/src/layout/dot/splines-flat.ts +9 -19
  220. package/src/layout/dot/splines-groups.ts +5 -3
  221. package/src/layout/dot/splines-route.ts +10 -11
  222. package/src/layout/dot/straight-edges.ts +5 -3
  223. package/src/layout/fdp/ports.ts +6 -2
  224. package/src/layout/fdp/tlayout.ts +6 -5
  225. package/src/layout/neato/__fixtures__/conjgrad-d.json +1 -0
  226. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.dot +141 -141
  227. package/src/layout/neato/__fixtures__/dim/hier-big-dim3.xdot +339 -339
  228. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.dot +140 -140
  229. package/src/layout/neato/__fixtures__/dim/hier-big-dim4.xdot +323 -323
  230. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.dot +141 -141
  231. package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.xdot +339 -339
  232. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.dot +251 -251
  233. package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.xdot +535 -535
  234. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.dot +14 -14
  235. package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.xdot +32 -32
  236. package/src/layout/neato/__fixtures__/dim/hier-dim4.dot +8 -8
  237. package/src/layout/neato/__fixtures__/dim/hier-dim4.xdot +14 -14
  238. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.dot +17 -17
  239. package/src/layout/neato/__fixtures__/dim/hier-len-dim3.xdot +35 -35
  240. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.dot +2 -2
  241. package/src/layout/neato/__fixtures__/dim/hier-noedge-big.xdot +2 -2
  242. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.dot +11 -11
  243. package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.xdot +21 -21
  244. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.dot +14 -14
  245. package/src/layout/neato/__fixtures__/dim/hier-star-dim3.xdot +26 -26
  246. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.dot +13 -13
  247. package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.xdot +30 -30
  248. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.dot +10 -10
  249. package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.xdot +19 -19
  250. package/src/layout/neato/__fixtures__/dim/smart-units.json +1 -1
  251. package/src/layout/neato/__fixtures__/hier/cases/dirnone.plain +10 -10
  252. package/src/layout/neato/__fixtures__/hier/cases/tdist.plain +12 -12
  253. package/src/layout/neato/__fixtures__/hier/hier-probe.plain +1 -1
  254. package/src/layout/neato/__fixtures__/hier/hier-probe.xdot +19 -19
  255. package/src/layout/neato/__fixtures__/hier-imds.ts +14 -13
  256. package/src/layout/neato/__fixtures__/hier-majorization.ts +24 -23
  257. package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +20 -20
  258. package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +8 -8
  259. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +34 -34
  260. package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +32 -32
  261. package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +18 -18
  262. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +13 -13
  263. package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +12 -12
  264. package/src/layout/neato/__fixtures__/models/hier-circuit.xdot +33 -33
  265. package/src/layout/neato/__fixtures__/models/hier-default.xdot +30 -30
  266. package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot +30 -30
  267. package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot +35 -35
  268. package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot +30 -30
  269. package/src/layout/neato/conjgrad-mkernel.ts +6 -2
  270. package/src/layout/neato/conjgrad.ts +38 -35
  271. package/src/layout/neato/matrix-ops-dense.ts +2 -20
  272. package/src/layout/neato/matrix-ops.ts +0 -20
  273. package/src/layout/neato/quad-prog-vpsc.ts +7 -5
  274. package/src/layout/neato/sgd.ts +2 -1
  275. package/src/layout/neato/smart-ini-x.ts +15 -15
  276. package/src/layout/neato/stress-subspace.ts +5 -5
  277. package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.dot +6 -6
  278. package/src/layout/sfdp/__fixtures__/dim/dim3.dot +6 -6
  279. package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.dot +6 -6
  280. package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.dot +6 -6
  281. package/src/layout/sfdp/__fixtures__/dim/regen.sh +2 -0
  282. package/src/model/cgraph-ops.ts +4 -3
  283. package/src/model/edge.ts +11 -4
  284. package/src/model/edgeInfo.ts +18 -2
  285. package/src/model/graph.ts +4 -3
  286. package/src/model/lazy-attrs.ts +3 -1
  287. package/src/model/rankEntry.ts +3 -1
  288. package/src/ortho/index.ts +0 -1
  289. package/src/ortho/partition.ts +10 -22
  290. package/src/parser/builder.ts +12 -3
  291. package/src/pathplan/route.ts +14 -4
  292. package/src/render/dot/agwrite.ts +45 -18
  293. package/src/render/dot/attrs.ts +18 -7
  294. package/src/render/dot/types.ts +7 -2
  295. package/src/render/dot/write-back.ts +27 -3
  296. package/src/render/dot/xdot-ops.ts +25 -56
  297. package/src/render/dot.ts +7 -5
  298. package/src/render/json-cluster-edge.ts +42 -5
  299. package/src/render/json-nonfinite.ts +51 -0
  300. package/src/render/json.ts +23 -26
  301. package/src/render/map.ts +3 -0
  302. package/src/render/svg-graph.ts +3 -15
  303. package/src/render/svg-id.ts +11 -2
  304. package/src/render/svg.ts +4 -1
  305. package/src/util/bsd-qsort.ts +2 -1
  306. package/src/util/overflow.ts +74 -0
  307. package/src/xdot/parse.ts +9 -19
  308. package/src/xdot/strtod.ts +167 -0
@@ -64,6 +64,14 @@ export interface RendererPlugin {
64
64
  readonly type: string;
65
65
  /** Capability quality — higher wins when multiple plugins match the same format. */
66
66
  readonly quality: number;
67
+ /**
68
+ * The pad around the drawing, in graph units (points), when the graph sets no
69
+ * `pad=`. A renderer that omits it gets `DEFAULT_GRAPH_PAD`, as C's output
70
+ * languages that are not render plugins do.
71
+ * @see lib/gvc/gvcjob.h gvrender_features_t.default_pad
72
+ * @see lib/common/emit.c:3290-3304 init_job_pad
73
+ */
74
+ readonly defaultPad?: number;
67
75
 
68
76
  beginGraph(g: Graph, job: RenderJob): void;
69
77
  endGraph(g: Graph, job: RenderJob): void;
package/src/gvc/device.ts CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { POINTS_PER_INCH } from '../model/geom.js';
16
16
  import { lateDouble } from '../common/nodeinit.js';
17
- import { parseDrawingSize, initJobViewportZoom, parseLandscape, parseGraphPad, parseGraphMargin } from './viewport.js';
17
+ import { parseDrawingSize, initJobViewportZoom, parseLandscape, parseGraphPad, parseGraphMargin, DEFAULT_GRAPH_PAD } from './viewport.js';
18
18
  import type { Graph } from '../model/graph.js';
19
19
  import type { Node } from '../model/node.js';
20
20
  import type { Edge } from '../model/edge.js';
@@ -231,7 +231,7 @@ export function renderEdge(e: Edge, renderer: RendererPlugin, job: RenderJob): v
231
231
  * @see lib/common/emit.c:emit_page (3656-3657)
232
232
  */
233
233
  export function renderGraphLabel(g: Graph, renderer: RendererPlugin, job: RenderJob): void {
234
- // @see lib/common/emit.c:emit_begin_graph / getObjId (root graph → graph0)
234
+ // @see lib/common/emit.c:emit_begin_graph / getObjId (graph being emitted → graph<AGSEQ>)
235
235
  setHtmlAnchorObj(svgGraphId(g, job), labelTextOf(g.info.label), job.obj ?? undefined);
236
236
  renderOneLabel(g.info.label as TextlabelT | undefined, renderer, job, false);
237
237
  }
@@ -450,10 +450,10 @@ export function render(ctx: GvcContext, g: Graph, format: string, inlineImages =
450
450
  // a recompute, it is the mechanism that produces C's near-empty output.
451
451
  // @see lib/common/emit.c:3272 init_gvc (gvc->bb = GD_bb(g))
452
452
  job.bb = g.info.bb;
453
- // init_job_pad: job.pad from `pad=`, before the size= fit, which uses the
454
- // padded bb (C calls init_job_pad before init_job_viewport, emit.c:4289-4291).
453
+ // init_job_pad: job.pad from `pad=`, else the render device's default pad,
454
+ // before the size= fit, which uses the padded bb (emit.c:4289-4291).
455
455
  // @see lib/common/emit.c:3241-3251 (attr read); :3290-3304 (fallback)
456
- job.pad = parseGraphPad(g.attrs.get('pad'));
456
+ job.pad = parseGraphPad(g.attrs.get('pad'), renderer.defaultPad ?? DEFAULT_GRAPH_PAD);
457
457
  // init_job_margin, right after init_job_pad (emit.c:4290-4291). margin does
458
458
  // not feed the size= fit (only pad does); emitSvgTag/svgBeginPage use it after
459
459
  // Z is known, as C resolves it before init_job_viewport and uses it after.
@@ -478,7 +478,7 @@ export function render(ctx: GvcContext, g: Graph, format: string, inlineImages =
478
478
  // not job->zoom. job.scale is read only by the SVG group/dims.
479
479
  const drawingSize = parseDrawingSize(g.attrs.get('size'));
480
480
  const z = initJobViewportZoom(job.bb, drawingSize, job.pad);
481
- job.clip = deviceClip(g, renderer, job); // @see emit.c:setup_page (xdot's default pad is 0)
481
+ job.clip = deviceClip(g, job); // @see lib/common/emit.c:1550-1564 setup_page
482
482
  // init_job_dpi (emit.c:3333): GD_drawing->dpi = late_double(dpi, resolution, 0)
483
483
  // (input.c:713). When >0 it becomes job->dpi; otherwise the SVG device's
484
484
  // default_dpi = 72 (gvrender_core_svg.c:814) applies. init_job_viewport then
@@ -31,27 +31,18 @@ function nodeBBox(n: Node): Box {
31
31
  }
32
32
 
33
33
  /**
34
- * node_in_box: is the node's own bbox within job's page/view clip?
34
+ * node_in_box: is the node's own bbox within the job's page clip?
35
35
  *
36
- * C's `job->clip` is derived from `job->bb` (= `GD_bb(g)`) expanded by
37
- * `job->pad` on every side (init_job_viewport's `job->bb = gvc->bb ±
38
- * job->pad`, feeding `job->view`/`job->focus`, which setup_page's `job->clip`
39
- * algebraically reduces back to for the single-page, unpaginated case this
40
- * port implements — Z and rotation cancel out of that derivation). This port
41
- * has no separate `page=` pagination model, so `job.bb` padded by `job.pad`
42
- * IS `job->clip` here.
36
+ * emit_node passes `job->clip`, which setup_page builds from the bb padded by
37
+ * the device's pad (see deviceClip). The edge gate, the clusters and the
38
+ * background read the same box, so `job.clip` has to be set before a node is
39
+ * rendered; `render` sets it.
43
40
  *
44
41
  * @see lib/common/emit.c:1636-1639 node_in_box
45
42
  * @see lib/common/emit.c:1808 emit_node gate
46
- * @see lib/common/emit.c:3356 init_job_viewport (job->bb = gvc->bb ± pad)
47
- * @see lib/common/emit.c:1553-1564 setup_page (job->clip from focus/view)
48
43
  */
49
44
  export function nodeInBox(n: Node, job: RenderJob): boolean {
50
- const clip: Box = {
51
- ll: { x: job.bb.ll.x - job.pad.x, y: job.bb.ll.y - job.pad.y },
52
- ur: { x: job.bb.ur.x + job.pad.x, y: job.bb.ur.y + job.pad.y },
53
- };
54
- return boxOverlap(nodeBBox(n), clip);
45
+ return boxOverlap(nodeBBox(n), job.clip);
55
46
  }
56
47
 
57
48
  /**
@@ -19,7 +19,7 @@ import { transformPoint } from './device-transform.js';
19
19
  import { graphXdots } from './init-xdot.js';
20
20
  import { gvrenderSetStyle } from './gvrender-set-style.js';
21
21
  import type { ObjState, RenderJob } from './job.js';
22
- import { initJobViewportZoom, parseDrawingSize, parseGraphPad, setupPageClip } from './viewport.js';
22
+ import { initJobViewportZoom, parseDrawingSize, setupPageClip } from './viewport.js';
23
23
 
24
24
  /** @see lib/common/const.h:48 */
25
25
  const DEFAULT_COLOR = 'black';
@@ -30,17 +30,16 @@ const DEFAULT_FILL = 'lightgrey';
30
30
  const DEFAULT_LINE_STYLE: readonly string[] = ['solid', 'setlinewidth(1)'];
31
31
 
32
32
  /**
33
- * job->clip for this device, computed in C's order, rounding included. svg's
34
- * pad is `job.pad` (default 4); the xdot device's default is 0, so with no
35
- * `pad` its clip is the bb.
36
- * @see plugin/core/gvrender_core_dot.c:739 render_features_dot
37
- * @see lib/common/emit.c:1558
33
+ * job->clip, computed in C's order, rounding included, from the bb and
34
+ * `job.pad`. init_job_pad has already made that pad the device's: with no
35
+ * `pad=` it is 4 on svg and map, and 0 on dot, xdot, plain and json, whose clip
36
+ * is then the bb.
37
+ * @see lib/common/emit.c:3290-3304 init_job_pad
38
+ * @see lib/common/emit.c:1550-1564 setup_page
38
39
  */
39
- export function deviceClip(g: Graph, renderer: RendererPlugin, job: RenderJob): Box {
40
- const attr = g.attrs.get('pad');
41
- const pad = renderer.type === 'svg' ? job.pad : attr ? parseGraphPad(attr) : { x: 0, y: 0 };
40
+ export function deviceClip(g: Graph, job: RenderJob): Box {
42
41
  const size = parseDrawingSize(g.attrs.get('size'));
43
- return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
42
+ return setupPageClip(job.bb, size, job.pad, initJobViewportZoom(job.bb, size, job.pad));
44
43
  }
45
44
 
46
45
  /**
@@ -210,7 +209,7 @@ export function emitXdot(g: Graph, renderer: RendererPlugin, job: RenderJob): vo
210
209
  const obj = job.obj;
211
210
  if (xd === undefined || obj === null) return;
212
211
  applyBackgroundState(g, renderer, obj);
213
- const inClip = zeroBoxInClip(deviceClip(g, renderer, job));
212
+ const inClip = zeroBoxInClip(deviceClip(g, job));
214
213
  const warned = { image: false };
215
214
  let styled = false;
216
215
  for (const op of xd.ops) {
package/src/gvc/job.ts CHANGED
@@ -274,10 +274,13 @@ export class RenderJob {
274
274
  readonly format: string;
275
275
 
276
276
  bb: Box = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
277
+ /** `pad=`, or else the render device's default pad (`RendererPlugin.defaultPad`).
278
+ * @see lib/common/emit.c:3290-3304 init_job_pad */
277
279
  pad: Point = { x: 0, y: 0 };
278
280
  /** Current page clip in graph units, as setup_page computes it from the
279
- * viewport focus/view (see setupPageClip). Read by the SVG page translate and
280
- * background. @see lib/gvc/gvcjob.h:GVJ_s.clip; lib/common/emit.c:setup_page */
281
+ * viewport focus/view (see setupPageClip). Read by the node and edge gates
282
+ * and by the SVG page translate and background.
283
+ * @see lib/gvc/gvcjob.h:GVJ_s.clip; lib/common/emit.c:setup_page */
281
284
  clip: Box = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
282
285
  /** Graph-level `margin=` (init_job_margin); page-pagination margin, distinct
283
286
  * from node/cluster label margin. @see lib/common/emit.c:3309-3331 */
@@ -26,7 +26,7 @@
26
26
 
27
27
  import type { Box, Point } from '../model/geom.js';
28
28
  import { POINTS_PER_INCH } from '../model/geom.js';
29
- import { SVG_PAD, SVG_MARGIN } from '../render/svg-helpers.js';
29
+ import { SVG_MARGIN } from '../render/svg-helpers.js';
30
30
  import type { Graph } from '../model/graph.js';
31
31
  import { cround } from '../common/arith.js';
32
32
 
@@ -76,14 +76,20 @@ export function parseDrawingSize(raw: string | undefined): DrawingSize | null {
76
76
  return null;
77
77
  }
78
78
 
79
+ /**
80
+ * The pad init_job_pad gives an output language that is not a render plugin,
81
+ * in points. Here it is the pad of a renderer that states no `defaultPad`.
82
+ * @see lib/common/const.h:96
83
+ */
84
+ export const DEFAULT_GRAPH_PAD = 4;
85
+
79
86
  /**
80
87
  * Port of the `pad=` graph-attribute parse: init_gvc reads it via
81
88
  * `sscanf(p, "%lf,%lf", &xf, &yf)` (2 values matched → both axes
82
89
  * independently; 1 value → y = x; 0 matched — attr absent or unparsable —
83
- * leaves `graph_sets_pad` false) and init_job_pad falls back to the SVG
84
- * plugin's `default_pad` (this port's only renderer) when unset, which is
85
- * numerically identical to `DEFAULT_GRAPH_PAD` (4pt) — so the two C fallback
86
- * branches collapse to the same constant here (`SVG_PAD`).
90
+ * leaves `graph_sets_pad` false) and init_job_pad then takes `fallback` on
91
+ * both axes: the render plugin's `default_pad` (`RendererPlugin.defaultPad`),
92
+ * or `DEFAULT_GRAPH_PAD` where there is none.
87
93
  *
88
94
  * Unlike `size=`, pad values are NOT rounded (`xf * POINTS_PER_INCH`
89
95
  * directly — no `POINTS()` macro) and are not required to be positive.
@@ -91,7 +97,7 @@ export function parseDrawingSize(raw: string | undefined): DrawingSize | null {
91
97
  * @see lib/common/emit.c:3241-3251 init_gvc (pad attr read)
92
98
  * @see lib/common/emit.c:3290-3304 init_job_pad (fallback)
93
99
  */
94
- export function parseGraphPad(raw: string | undefined): Point {
100
+ export function parseGraphPad(raw: string | undefined, fallback: number): Point {
95
101
  if (raw !== undefined) {
96
102
  const xy = PAD_XY_RE.exec(raw);
97
103
  if (xy) {
@@ -103,7 +109,7 @@ export function parseGraphPad(raw: string | undefined): Point {
103
109
  return { x: v, y: v };
104
110
  }
105
111
  }
106
- return { x: SVG_PAD, y: SVG_PAD };
112
+ return { x: fallback, y: fallback };
107
113
  }
108
114
 
109
115
  /**