libpetri 3.0.0 → 4.0.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 (38) hide show
  1. package/README.md +54 -2
  2. package/dist/chunk-KO6TSB47.js +1016 -0
  3. package/dist/chunk-KO6TSB47.js.map +1 -0
  4. package/dist/{chunk-5W6SVYPD.js → chunk-WYCGGQAW.js} +1744 -737
  5. package/dist/chunk-WYCGGQAW.js.map +1 -0
  6. package/dist/debug/index.d.ts +2 -2
  7. package/dist/doclet/index.d.ts +12 -3
  8. package/dist/doclet/index.js +5 -1
  9. package/dist/doclet/index.js.map +1 -1
  10. package/dist/doclet/resources/petrinet-diagrams.css +21 -0
  11. package/dist/doclet/resources/petrinet-diagrams.js +6366 -6360
  12. package/dist/{render-ZGZEZ5RK.js → elk-place-YVNQFGXI.js} +3 -258
  13. package/dist/elk-place-YVNQFGXI.js.map +1 -0
  14. package/dist/{event-store-Df_sAVQ_.d.ts → event-store-2FOAeUyh.d.ts} +1 -1
  15. package/dist/export/index.d.ts +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +6 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/pan-zoom-Cp51IkDl.d.ts +33 -0
  20. package/dist/{petri-net-UQBBkvLl.d.ts → petri-net-hduM6tJf.d.ts} +20 -1
  21. package/dist/preprocess-FN3F75JR.js +193 -0
  22. package/dist/preprocess-FN3F75JR.js.map +1 -0
  23. package/dist/render-QOHGDWNE.js +78 -0
  24. package/dist/render-QOHGDWNE.js.map +1 -0
  25. package/dist/render-dom/index.d.ts +28 -29
  26. package/dist/render-dom/index.js +14 -21
  27. package/dist/render-dom/index.js.map +1 -1
  28. package/dist/verification/index.d.ts +440 -71
  29. package/dist/verification/index.js +43 -5
  30. package/dist/verification/index.js.map +1 -1
  31. package/dist/viewer/index.d.ts +24 -32
  32. package/dist/viewer/index.js +9 -1003
  33. package/dist/viewer/index.js.map +1 -1
  34. package/dist/viewer/viewer.css +21 -0
  35. package/dist/viewer/viewer.iife.js +6366 -6360
  36. package/package.json +5 -8
  37. package/dist/chunk-5W6SVYPD.js.map +0 -1
  38. package/dist/render-ZGZEZ5RK.js.map +0 -1
package/README.md CHANGED
@@ -59,13 +59,61 @@ Use places and transitions for coordination rather than hiding concurrency insid
59
59
  |---|---|
60
60
  | `libpetri` | Core model, runtime, events, and composition |
61
61
  | `libpetri/export` | DOT mapping and rendering |
62
- | `libpetri/verification` | Structural analysis, state classes, and Z3-backed SMT verification |
62
+ | `libpetri/verification` | Structural analysis, state classes, and SMT verification through the `z3` executable |
63
63
  | `libpetri/debug` | Debug protocol and session archives |
64
- | `libpetri/viewer` | Interactive DOT/SVG viewer |
64
+ | `libpetri/viewer` | Interactive DOT/SVG viewer, the canonical renderer |
65
+ | `libpetri/render-dom` | Thin compatibility wrapper over `libpetri/viewer` |
65
66
  | `libpetri/doclet` | TypeDoc integration |
66
67
 
67
68
  The model supports input, output, read, inhibitor, and reset arcs; immediate, deadline, delayed, window, and exact timing; AND/XOR/timeout routing; environment places; reusable subnets; place fusion; and ν-net identity correlation.
68
69
 
70
+ ## Visualization
71
+
72
+ `libpetri/viewer` is the canonical renderer. It lays nodes out with ELK, routes edges orthogonally, and draws the result through Graphviz `nop2`, then adds pan/zoom, cluster collapse, subnet toggling, and filtering. Every first-party surface uses it: the debug UI, the TypeDoc plugin here, the Java javadoc taglet, and the Rust docgen all embed the same bundle, so a net looks the same whichever port documented it.
73
+
74
+ ```typescript
75
+ import { dotExport } from 'libpetri/export';
76
+ import { mount } from 'libpetri/viewer';
77
+
78
+ const handle = await mount(dotExport(net), document.getElementById('diagram')!, {
79
+ chrome: true,
80
+ });
81
+ handle.fit();
82
+ ```
83
+
84
+ The viewer is browser-only and declares `@viz-js/viz`, `panzoom`, and `elkjs` as optional peer dependencies, so a headless runtime install does not pull in a rendering stack. Install all three wherever you mount it:
85
+
86
+ ```bash
87
+ npm install @viz-js/viz panzoom elkjs
88
+ ```
89
+
90
+ Without `elkjs` the default layout throws and names the missing peer; `mount(dot, el, { layout: 'graphviz' })` falls back to stock Graphviz layout, which is the one supported way to render without it.
91
+
92
+ Not every path through the package produces the same picture:
93
+
94
+ | Path | Layout | Edges |
95
+ |---|---|---|
96
+ | `mount()` from `libpetri/viewer` | ELK placement, ELK routes via `nop2` | orthogonal |
97
+ | `renderDotToContainer()` from `libpetri/render-dom` | delegates to `mount()` | orthogonal |
98
+ | the TypeDoc plugin | embeds the viewer, mounts client-side | orthogonal |
99
+ | `dotToSvg()` from `libpetri/doclet` | stock Graphviz `dot` | diagonal splines |
100
+ | `dotExport()` piped to your own `dot -Tsvg` | stock Graphviz `dot` | diagonal splines |
101
+
102
+ If a diagram renders with diagonal edges where you expected right angles, it went through one of the bottom two rows, or through a viewer bundle older than 2.10.5. Generated doc pages record which one drew them in `data-libpetri-viewer` on the diagram container.
103
+
104
+ ### TypeDoc plugin
105
+
106
+ Register the plugin and declare the block tag it reads:
107
+
108
+ ```json
109
+ {
110
+ "plugin": ["libpetri/doclet"],
111
+ "blockTags": ["@petrinet"]
112
+ }
113
+ ```
114
+
115
+ An `@petrinet` tag on a symbol that builds or exposes a net renders that net as a diagram in the generated page, with the DOT source in a collapsible block underneath. The viewer bundle is inlined into the HTML, so the output is self-contained and works offline with no `dot` binary and no network access.
116
+
69
117
  ## Build and test
70
118
 
71
119
  ```bash
@@ -75,6 +123,10 @@ npm run check
75
123
  npm test
76
124
  ```
77
125
 
126
+ ## SMT verification needs a `z3` executable
127
+
128
+ The package does not bundle a solver. `SmtVerifier` runs the `z3` executable found on `PATH` (or named by `LIBPETRI_Z3`), version 4.8.0 or newer, one process per query, so the event loop stays free while it solves; `z3Available()` from `libpetri/verification` tells you whether one resolves, and without it every verification returns `unknown` with a reason naming the command. Set `LIBPETRI_SMT_DUMP` to a directory to keep every SMT-LIB2 script and solver reply. The timeout is per solver invocation. The verification entry is Node-only.
129
+
78
130
  ## Project links
79
131
 
80
132
  - [Language-agnostic specification](https://github.com/debe/libpetri/blob/main/spec/00-index.md)