@knowvah/dot-engine 1.5.0 → 1.6.1

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 (45) hide show
  1. package/dist/api/geometry.d.ts +21 -3
  2. package/dist/api/geometry.d.ts.map +1 -1
  3. package/dist/api.js +4 -4
  4. package/dist/api.js.map +2 -2
  5. package/dist/cdt/splay.d.ts.map +1 -1
  6. package/dist/common/htmltable-emit-rules.d.ts.map +1 -1
  7. package/dist/common/shape-clip.d.ts +17 -0
  8. package/dist/common/shape-clip.d.ts.map +1 -0
  9. package/dist/index.js +601 -578
  10. package/dist/index.js.map +4 -4
  11. package/dist/layout/dot/edge-route.d.ts.map +1 -1
  12. package/dist/layout/dot/pack-components.d.ts.map +1 -1
  13. package/dist/layout/dot/sameport.d.ts +1 -13
  14. package/dist/layout/dot/sameport.d.ts.map +1 -1
  15. package/dist/layout/dot/self-loop.d.ts.map +1 -1
  16. package/dist/layout/dot/splines-groups.d.ts.map +1 -1
  17. package/dist/layout/neato/index.d.ts.map +1 -1
  18. package/dist/layout/neato/init.d.ts.map +1 -1
  19. package/dist/ortho/ortho-route.d.ts.map +1 -1
  20. package/dist/render/dot.d.ts.map +1 -1
  21. package/dist/render.js +1209 -1186
  22. package/dist/render.js.map +4 -4
  23. package/package.json +14 -5
  24. package/src/api/geometry.ts +25 -10
  25. package/src/cdt/splay.ts +0 -2
  26. package/src/common/arm-pow.ts +3 -3
  27. package/src/common/htmltable-emit-rules.ts +0 -10
  28. package/src/common/random.ts +2 -2
  29. package/src/common/shape-clip.ts +48 -0
  30. package/src/common/spline-midpoint.ts +1 -1
  31. package/src/layout/circo/circular.ts +1 -1
  32. package/src/layout/dot/edge-route.ts +18 -6
  33. package/src/layout/dot/ns.ts +1 -1
  34. package/src/layout/dot/pack-components.ts +0 -1
  35. package/src/layout/dot/sameport.ts +1 -25
  36. package/src/layout/dot/self-loop.ts +4 -2
  37. package/src/layout/dot/splines-flat-labeled.ts +1 -1
  38. package/src/layout/dot/splines-groups.ts +8 -1
  39. package/src/layout/neato/cdt-surface.ts +1 -1
  40. package/src/layout/neato/index.ts +0 -3
  41. package/src/layout/neato/init.ts +0 -1
  42. package/src/ortho/ortho-route.ts +1 -3
  43. package/src/ortho/trap-query.ts +1 -1
  44. package/src/render/dot.ts +3 -10
  45. package/src/vpsc/Solver.ts +1 -1
@@ -83,7 +83,10 @@ export interface NodeGeometry {
83
83
  *
84
84
  * `points` concatenates all bezier control points from the edge spline,
85
85
  * in order. An edge with no routed spline produces an empty `points` array.
86
- * `label` is present only when the edge carries a centre label.
86
+ * `label` is present only when the edge carries a centre label that layout
87
+ * placed. It carries the same `lp->set` gate as the labels below: dot's
88
+ * label search can leave a centre label unplaced (sentinel pos), and
89
+ * `render()` then declines to draw it.
87
90
  *
88
91
  * `tailLabel`/`headLabel` are the `taillabel`/`headlabel` port labels. They
89
92
  * are present only once the layout has actually *placed* them (C `lp->set`),
@@ -92,6 +95,12 @@ export interface NodeGeometry {
92
95
  * type) still holds calloc-zero coordinates, so it is reported as absent
93
96
  * rather than as a label at the origin.
94
97
  *
98
+ * `xlabel` is the `xlabel` external label, positioned by the force-placement
99
+ * search rather than by spline midpoint arithmetic, so it is not derivable
100
+ * from `label` or `points`. It carries the same `lp->set` gate: a declared
101
+ * xlabel the search could not fit is reported as absent, exactly as
102
+ * `render()` declines to draw it.
103
+ *
95
104
  * `sp`/`ep` are the arrow attachment points. When an end carries an arrow the
96
105
  * spline is shortened to leave room for it, and the arrow spans from the
97
106
  * terminal control point out to this point — so a consumer drawing its own
@@ -105,7 +114,8 @@ export interface NodeGeometry {
105
114
  * (measured: ~1.5pt at `penwidth=1`, ~6.2pt at `penwidth=5`), so `ep` is the
106
115
  * point to draw an arrow *to*, not a copy of the rendered polygon's tip.
107
116
  *
108
- * @see lib/common/types.h:ED_spl, ED_label, ED_tail_label, ED_head_label
117
+ * @see lib/common/types.h:ED_spl, ED_label, ED_tail_label, ED_head_label,
118
+ * ED_xlabel
109
119
  * @see lib/common/types.h:bezier (sflag/eflag, sp/ep)
110
120
  */
111
121
  export interface EdgeGeometry {
@@ -132,7 +142,7 @@ export interface EdgeGeometry {
132
142
  x: number;
133
143
  y: number;
134
144
  };
135
- /** Centre edge label position, if present. @see lib/common/types.h:ED_label */
145
+ /** Centre edge label position, if placed. @see lib/common/types.h:ED_label */
136
146
  label?: {
137
147
  x: number;
138
148
  y: number;
@@ -153,6 +163,14 @@ export interface EdgeGeometry {
153
163
  x: number;
154
164
  y: number;
155
165
  };
166
+ /**
167
+ * `xlabel` (external label) position, if placed.
168
+ * @see lib/common/types.h:ED_xlabel
169
+ */
170
+ xlabel?: {
171
+ x: number;
172
+ y: number;
173
+ };
156
174
  }
157
175
  /**
158
176
  * Per-cluster geometry extracted after layout, in points.
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/api/geometry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAU/C,+CAA+C;AAC/C,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM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AAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAoLD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,cAAc,CAuB1E"}
package/dist/api.js CHANGED
@@ -706,14 +706,14 @@ function snapshotEdge(edge, flipY) {
706
706
  head: edge.head.name,
707
707
  points: collectEdgePoints(edge, flipY)
708
708
  };
709
- const lbl = edge.info.label;
710
- if (lbl !== void 0) {
711
- geom.label = { x: lbl.pos.x, y: flipY(lbl.pos.y) };
712
- }
709
+ const label = placedLabelPos(edge.info.label, flipY);
710
+ if (label !== void 0) geom.label = label;
713
711
  const tailLabel = placedLabelPos(edge.info.tail_label, flipY);
714
712
  if (tailLabel !== void 0) geom.tailLabel = tailLabel;
715
713
  const headLabel = placedLabelPos(edge.info.head_label, flipY);
716
714
  if (headLabel !== void 0) geom.headLabel = headLabel;
715
+ const xlabel = placedLabelPos(edge.info.xlabel, flipY);
716
+ if (xlabel !== void 0) geom.xlabel = xlabel;
717
717
  const { sp, ep } = arrowAttachPoints(edge, flipY);
718
718
  if (sp !== void 0) geom.sp = sp;
719
719
  if (ep !== void 0) geom.ep = ep;