@knowvah/dot-engine 1.1.1 → 1.2.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 (61) hide show
  1. package/README.md +32 -17
  2. package/dist/api.js +24 -0
  3. package/dist/api.js.map +2 -2
  4. package/dist/common/arrows.d.ts.map +1 -1
  5. package/dist/common/edge-label-init.d.ts.map +1 -1
  6. package/dist/common/htmltable-emit.d.ts +0 -8
  7. package/dist/common/htmltable-emit.d.ts.map +1 -1
  8. package/dist/common/ps-fontalias.d.ts +22 -9
  9. package/dist/common/ps-fontalias.d.ts.map +1 -1
  10. package/dist/common/splines-clip.d.ts.map +1 -1
  11. package/dist/gvc/device.d.ts.map +1 -1
  12. package/dist/gvc/job.d.ts +4 -0
  13. package/dist/gvc/job.d.ts.map +1 -1
  14. package/dist/index.js +1981 -1533
  15. package/dist/index.js.map +4 -4
  16. package/dist/layout/dot/index.d.ts +1 -1
  17. package/dist/layout/dot/index.d.ts.map +1 -1
  18. package/dist/layout/sfdp/init.d.ts.map +1 -1
  19. package/dist/model/graph.d.ts +24 -0
  20. package/dist/model/graph.d.ts.map +1 -1
  21. package/dist/parser/builder.d.ts +32 -0
  22. package/dist/parser/builder.d.ts.map +1 -1
  23. package/dist/render/dot/agwrite.d.ts +186 -0
  24. package/dist/render/dot/agwrite.d.ts.map +1 -0
  25. package/dist/render/dot/attrs.d.ts +220 -0
  26. package/dist/render/dot/attrs.d.ts.map +1 -0
  27. package/dist/render/dot/edge-draw.d.ts +60 -0
  28. package/dist/render/dot/edge-draw.d.ts.map +1 -0
  29. package/dist/render/dot/types.d.ts +28 -0
  30. package/dist/render/dot/types.d.ts.map +1 -0
  31. package/dist/render/dot/xdot-ops.d.ts +206 -0
  32. package/dist/render/dot/xdot-ops.d.ts.map +1 -0
  33. package/dist/render/dot.d.ts +58 -277
  34. package/dist/render/dot.d.ts.map +1 -1
  35. package/dist/render/map.d.ts +14 -1
  36. package/dist/render/map.d.ts.map +1 -1
  37. package/dist/render/svg-graph.d.ts.map +1 -1
  38. package/dist/render.js +1942 -1494
  39. package/dist/render.js.map +4 -4
  40. package/package.json +1 -1
  41. package/src/common/arrows.ts +17 -4
  42. package/src/common/edge-label-init.ts +9 -2
  43. package/src/common/htmltable-emit.ts +36 -8
  44. package/src/common/poly-gencode.ts +8 -8
  45. package/src/common/ps-fontalias.ts +80 -49
  46. package/src/common/splines-clip.ts +36 -10
  47. package/src/gvc/device.ts +18 -6
  48. package/src/gvc/job.ts +4 -0
  49. package/src/layout/dot/index.ts +37 -5
  50. package/src/layout/sfdp/init.ts +11 -0
  51. package/src/model/graph.ts +26 -0
  52. package/src/parser/builder.ts +90 -5
  53. package/src/render/dot/agwrite.ts +506 -0
  54. package/src/render/dot/attrs.ts +437 -0
  55. package/src/render/dot/edge-draw.ts +203 -0
  56. package/src/render/dot/types.ts +32 -0
  57. package/src/render/dot/xdot-ops.ts +432 -0
  58. package/src/render/dot.ts +114 -1131
  59. package/src/render/map.ts +18 -1
  60. package/src/render/svg-graph.ts +4 -0
  61. package/src/render/svg-helpers.ts +1 -1
package/README.md CHANGED
@@ -21,10 +21,18 @@ literal byte-for-byte SVG output — see [Conformance](./docs/conformance.md) fo
21
21
  the exact definition and the comparison code, and
22
22
  [known divergences](./docs/known-divergences.md) for the documented exceptions.
23
23
 
24
- > **Status: `0.1.x` — in active development, published to npm.** The port is
25
- > mature enough to lay out and render real graphs across all engines; the C
26
- > feature surface is not 100% covered. The `dot` engine is the primary
27
- > fidelity target. See [Status & coverage](#status--coverage) below.
24
+ > **Status: published and semver-stable from 1.0.0.** The public API —
25
+ > `renderSvg`, `/api`, `/render` — follows semver: a breaking change gets a
26
+ > major bump. The version line does **not** track C feature coverage, and the
27
+ > two are independent signals.
28
+ >
29
+ > The rendering surface is settled: parsing, all eight layout engines, SVG,
30
+ > and the `json` / `xdot` / `dot` / `plain` / imagemap text formats. It does
31
+ > not cover the whole C feature surface, and the remainder is **out of scope
32
+ > rather than pending** — the unported C areas stay inventoried in the
33
+ > [port catalog](./plans/port-catalog/README.md) so you can check a specific
34
+ > feature before depending on it. The `dot` engine is the primary fidelity
35
+ > target. See [Status & coverage](#status--coverage) below.
28
36
 
29
37
  ## Why this exists
30
38
 
@@ -261,32 +269,39 @@ from the canonical C Graphviz. New behavior is pinned to the C source — see
261
269
  ## Status & coverage
262
270
 
263
271
  - **What works:** parsing, all eight layout engines, SVG output, and the
264
- intermediate `json` / `xdot` / `dot` / imagemap text formats.
272
+ intermediate `json` / `xdot` / `dot` / `plain` / imagemap text formats.
265
273
  - **Conformance bar:** a render is **conformant** when it matches the C oracle
266
274
  within a ±0.01 deterministic tolerance (`dot`, `circo`, `twopi`, `osage`,
267
275
  `patchwork`) or is characterized at a looser ±0.5 tolerance for the
268
276
  iterative force-directed engines (`neato`, `fdp`, `sfdp`) — never literal
269
277
  byte equality. Full definition: [Conformance](./docs/conformance.md).
270
- - **Current parity** (fresh corpus sweeps, dated 2026-07-11 — see
271
- [`test/corpus/PARITY.md`](./test/corpus/PARITY.md) and the
272
- [docs-site parity pages](https://knowvah.github.io/dot-engine/engines) for
273
- live counts): `dot` SVG 762/788 conformant (+14 structural-match, 0
274
- unaccepted tracked gaps — every remaining non-conformant graph is a
275
- documented, accepted divergence); `dot` xdot 754/759; `circo` xdot 745/762;
276
- `twopi` xdot 740/762; `osage` xdot 744/759; `patchwork` xdot 757/762
277
- (all deterministic, ±0.01). `neato`/`fdp`/`sfdp` are characterized at ±0.5
278
- rather than gated at the deterministic bar, per the tolerance split above.
278
+ - **Current parity:** `dot` SVG 762/788 conformant (0 unaccepted tracked gaps —
279
+ every remaining non-conformant graph is a documented, accepted divergence);
280
+ `dot` xdot 761/761; `patchwork` xdot 762/762; `osage` xdot 755/762; `circo`
281
+ xdot 752/762; `twopi` xdot 746/762 (all deterministic, ±0.01).
282
+ `neato`/`fdp`/`sfdp` are characterized at ±0.5 rather than gated at the
283
+ deterministic bar, per the tolerance split above. These figures are a
284
+ snapshot of one row each from [`test/corpus/PARITY.md`](./test/corpus/PARITY.md),
285
+ which is generated by `test/corpus/parity-report.ts` and covers every
286
+ engine × surface track (SVG, xdot, json, plain, imagemap); read it, or the
287
+ [docs-site parity pages](https://knowvah.github.io/dot-engine/engines),
288
+ rather than this bullet for current counts.
279
289
  - **What's tracked:** every C algorithm and its port status is inventoried in
280
290
  the [port catalog](./plans/port-catalog/README.md). Items marked `[ ]` there
281
- are real gaps, not footnotes.
291
+ are genuinely unported — not footnotes, and not a roadmap either. Treat the
292
+ catalog as the authoritative answer to "is feature X in?".
282
293
  - **Known behavioral divergences from C** (differences investigated,
283
294
  root-caused, and deliberately not chased) are listed in
284
295
  [`docs/known-divergences.md`](./docs/known-divergences.md).
285
296
 
286
297
  ## Known limitations
287
298
 
288
- - **Feature coverage is incomplete.** The C source defines completeness; gaps
289
- are tracked in the port catalog rather than hidden.
299
+ - **The feature surface is narrower than C's, by design.** The C source
300
+ defines completeness, and this port does not reach it. The uncovered areas
301
+ are listed in the [port catalog](./plans/port-catalog/README.md) rather than
302
+ hidden — check it before depending on a specific C feature. They are not a
303
+ backlog; absence from the shipped surface is a scope decision, not a
304
+ pending item.
290
305
  - **Very large graphs are impractical to lay out at runtime.** Graphs beyond
291
306
  roughly 10k nodes or a few MB of DOT source hit a scale ceiling — layout
292
307
  (mincross, ranking, spline routing) is superlinear. This is **shared with
package/dist/api.js CHANGED
@@ -67,6 +67,30 @@ var Graph = class {
67
67
  * @see lib/cgraph/graph.c:agsubg (attr defval copy)
68
68
  */
69
69
  graphDefaultsSnapshot;
70
+ /**
71
+ * Keys in `attrs` the BUILDER seeded from `graphDefaultsSnapshot` rather than
72
+ * the input declaring them in this scope (see builder.ts GRAPH_LABEL_INHERIT_
73
+ * KEYS). cgraph distinguishes these structurally — a seeded value is inherited
74
+ * through the dict view and has no local symbol, while a local declaration
75
+ * creates one even when its value equals the inherited value — so the
76
+ * serializer needs the provenance to decide what write_dict would print.
77
+ * Undefined on the root graph and on any scope that seeded nothing.
78
+ * @see lib/cgraph/write.c:262 write_dict
79
+ */
80
+ seededAttrs;
81
+ /**
82
+ * Graph-attribute keys whose declaration in THIS scope was the first anywhere
83
+ * in the graph. cgraph's `setattr` splits on exactly this: a key with no
84
+ * existing symbol takes the global-declaration branch, which ends up seeding
85
+ * every direct subgraph that already exists with a local empty value (see
86
+ * `eagerEmptyParts`); a key some earlier scope already declared takes the
87
+ * "new local definition" branch and touches no subgraph at all. So an
88
+ * identical `graph [fill=x]` statement makes a child print `fill=""` or print
89
+ * nothing purely according to whether a SIBLING declared `fill` first.
90
+ * Undefined on any scope that declared nothing new.
91
+ * @see lib/cgraph/attr.c:257 setattr (lsym / psym / global branches)
92
+ */
93
+ firstGraphDecl;
70
94
  /**
71
95
  * Layout-engine info; replaces GD_* macros via agbindrec (AD-1).
72
96
  * @see lib/cgraph/cgraph.h:agbindrec