libpetri 1.8.4 → 2.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.
- package/README.md +47 -0
- package/dist/{chunk-B2D5DMTO.js → chunk-4L6JVKH4.js} +165 -8
- package/dist/chunk-4L6JVKH4.js.map +1 -0
- package/dist/chunk-H62Z76FY.js +1346 -0
- package/dist/chunk-H62Z76FY.js.map +1 -0
- package/dist/chunk-SXK2Z45Z.js +50 -0
- package/dist/chunk-SXK2Z45Z.js.map +1 -0
- package/dist/debug/index.d.ts +50 -3
- package/dist/debug/index.js +64 -6
- package/dist/debug/index.js.map +1 -1
- package/dist/doclet/index.d.ts +152 -31
- package/dist/doclet/index.js +458 -57
- package/dist/doclet/index.js.map +1 -1
- package/dist/doclet/resources/petrinet-diagrams.css +384 -7
- package/dist/doclet/resources/petrinet-diagrams.js +7214 -106
- package/dist/dot-exporter-PMHOQHZ3.js +8 -0
- package/dist/{event-store-BnyHh3TF.d.ts → event-store-2zkXeQkd.d.ts} +1 -1
- package/dist/export/index.d.ts +16 -2
- package/dist/export/index.js +1 -1
- package/dist/index.d.ts +41 -5
- package/dist/index.js +1221 -35
- package/dist/index.js.map +1 -1
- package/dist/petri-net-BDrj4XZE.d.ts +1461 -0
- package/dist/render-P6GROU7J.js +16 -0
- package/dist/render-P6GROU7J.js.map +1 -0
- package/dist/verification/index.d.ts +3 -144
- package/dist/verification/index.js +30 -1214
- package/dist/verification/index.js.map +1 -1
- package/dist/viewer/index.d.ts +196 -0
- package/dist/viewer/index.js +442 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/viewer/viewer-static.iife.js +3 -0
- package/dist/viewer/viewer.css +503 -0
- package/dist/viewer/viewer.iife.js +7219 -0
- package/package.json +17 -8
- package/dist/chunk-B2D5DMTO.js.map +0 -1
- package/dist/chunk-VQ4XMJTD.js +0 -107
- package/dist/chunk-VQ4XMJTD.js.map +0 -1
- package/dist/dot-exporter-3CVCH6J4.js +0 -8
- package/dist/petri-net-D-GN9g_D.d.ts +0 -570
- /package/dist/{dot-exporter-3CVCH6J4.js.map → dot-exporter-PMHOQHZ3.js.map} +0 -0
package/dist/doclet/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Application } from 'typedoc';
|
|
2
|
-
import {
|
|
2
|
+
import { P as PetriNet, S as SubnetDef, o as Instance } from '../petri-net-BDrj4XZE.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* TypeDoc plugin for `@petrinet`
|
|
6
|
-
* from PetriNet
|
|
5
|
+
* TypeDoc plugin for `@petrinet` and `@subnet` tags — auto-generates
|
|
6
|
+
* interactive SVG diagrams from PetriNet / SubnetDef / Instance definitions
|
|
7
|
+
* and embeds them in TypeDoc output.
|
|
7
8
|
*
|
|
8
|
-
* Mirrors: `org.libpetri.doclet.PetriNetTaglet`
|
|
9
|
+
* Mirrors: `org.libpetri.doclet.PetriNetTaglet` + `SubnetTaglet`
|
|
9
10
|
*
|
|
10
11
|
* Plugin lifecycle (TypeDoc hooks):
|
|
11
|
-
* 1. `bootstrapEnd` → register `@petrinet` as known block
|
|
12
|
-
* 2. `preRenderAsyncJobs` → walk reflections, resolve
|
|
13
|
-
*
|
|
12
|
+
* 1. `bootstrapEnd` → register `@petrinet` and `@subnet` as known block tags.
|
|
13
|
+
* 2. `preRenderAsyncJobs` → walk reflections, resolve references, generate
|
|
14
|
+
* SVGs, cache HTML.
|
|
15
|
+
* 3. `comment.beforeTags` → inject cached HTML via `JSX.Raw`, skip default
|
|
16
|
+
* rendering for the recognised tags.
|
|
14
17
|
*
|
|
15
18
|
* @module doclet/petri-net-plugin
|
|
16
19
|
*/
|
|
@@ -25,33 +28,52 @@ declare function load(app: Application): void;
|
|
|
25
28
|
/**
|
|
26
29
|
* Shared HTML renderer for Petri Net diagrams in TypeDoc.
|
|
27
30
|
*
|
|
28
|
-
* Generates consistent HTML markup
|
|
29
|
-
*
|
|
31
|
+
* Generates consistent HTML markup that mounts the canonical
|
|
32
|
+
* {@link https://libpetri.org | libpetri} viewer client-side. The viewer IIFE
|
|
33
|
+
* bundle (Graphviz WASM inlined, offline-safe) is inlined into the generated
|
|
34
|
+
* HTML, making the plugin fully self-contained with no external file
|
|
35
|
+
* dependencies.
|
|
30
36
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
37
|
+
* Each diagram container carries its DOT source as a `data-dot` attribute. An
|
|
38
|
+
* init snippet reads the attribute and calls
|
|
39
|
+
* `window.LibpetriViewer.mount(dot, container, { chrome: true })` to render the
|
|
40
|
+
* SVG and wire pan/zoom + cluster legend/filter chrome.
|
|
33
41
|
*
|
|
34
42
|
* Mirrors: `org.libpetri.doclet.DiagramRenderer`
|
|
35
43
|
*
|
|
36
44
|
* @module doclet/diagram-renderer
|
|
37
45
|
*/
|
|
38
46
|
/**
|
|
39
|
-
* Escapes HTML special characters for safe embedding.
|
|
47
|
+
* Escapes HTML special characters for safe embedding as text content.
|
|
40
48
|
*/
|
|
41
49
|
declare function escapeHtml(text: string): string;
|
|
42
50
|
/**
|
|
43
|
-
* Renders a
|
|
51
|
+
* Renders a diagram from a DOT source string. The viewer renders the SVG
|
|
52
|
+
* client-side via Graphviz-WASM; no server-side SVG is emitted on the
|
|
53
|
+
* embedded path.
|
|
44
54
|
*
|
|
45
|
-
* Inlines CSS and
|
|
46
|
-
* idempotency check so it only executes
|
|
47
|
-
* `@petrinet` tags appear.
|
|
55
|
+
* Inlines CSS and the viewer IIFE from bundled resources. The IIFE is guarded
|
|
56
|
+
* by an idempotency check (`window._libpetriViewerInit`) so it only executes
|
|
57
|
+
* once per page even when multiple `@petrinet` tags appear.
|
|
48
58
|
*
|
|
49
59
|
* @param title - optional title (null/undefined for no title)
|
|
50
|
-
* @param
|
|
51
|
-
*
|
|
60
|
+
* @param dotSource - the DOT source code; embedded as `data-dot` and shown in
|
|
61
|
+
* the collapsible "View DOT Source" block
|
|
52
62
|
* @returns HTML markup with diagram controls
|
|
53
63
|
*/
|
|
54
|
-
declare function renderSvg(title: string | null | undefined,
|
|
64
|
+
declare function renderSvg(title: string | null | undefined, dotSource: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Renders a subnet- or instance-aware diagram. Identical to {@link renderSvg}
|
|
67
|
+
* apart from an extra {@code headerHtml} block (the port/channel/params
|
|
68
|
+
* badge bar) prepended above the diagram, and the CSS class
|
|
69
|
+
* {@code subnet-diagram} on the wrapper.
|
|
70
|
+
*
|
|
71
|
+
* @param title diagram title (e.g. "BoundedBuffer :: b1")
|
|
72
|
+
* @param headerHtml the HTML produced by {@link import('./subnet-header.js')}
|
|
73
|
+
* @param dotSource the DOT source code
|
|
74
|
+
* @returns HTML markup
|
|
75
|
+
*/
|
|
76
|
+
declare function renderSubnetSvg(title: string | null | undefined, headerHtml: string, dotSource: string): string;
|
|
55
77
|
|
|
56
78
|
/**
|
|
57
79
|
* SVG renderer using `@viz-js/viz` (Graphviz WASM).
|
|
@@ -75,34 +97,133 @@ declare function renderSvg(title: string | null | undefined, svgContent: string,
|
|
|
75
97
|
declare function dotToSvg(dot: string): Promise<string>;
|
|
76
98
|
|
|
77
99
|
/**
|
|
78
|
-
* Dynamic import-based
|
|
100
|
+
* Dynamic import-based resolver for `@petrinet` / `@subnet` references.
|
|
79
101
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
102
|
+
* Resolves three kinds of static exports per Java's `PetriNetTaglet` design:
|
|
103
|
+
* 1. `PetriNet` — full body diagram (existing behaviour).
|
|
104
|
+
* 2. `SubnetDef<?>` — body diagram with interface ports highlighted, plus a
|
|
105
|
+
* subnet header with port/channel badges.
|
|
106
|
+
* 3. `Instance<?>` — renamed body diagram (already prefix-clustered by the
|
|
107
|
+
* DOT exporter), plus an instance header with prefix, def name, and
|
|
108
|
+
* params summary.
|
|
109
|
+
*
|
|
110
|
+
* TypeScript cannot use reflection like Java — modules must be importable at
|
|
111
|
+
* doc time (typically from `dist/` after `npm run build`).
|
|
82
112
|
*
|
|
83
113
|
* Tag format:
|
|
84
114
|
* ```
|
|
85
|
-
* @petrinet ./path/to/module#exportName — access a
|
|
86
|
-
* @petrinet ./path/to/module#functionName() — call a function returning
|
|
115
|
+
* @petrinet ./path/to/module#exportName — access a static export
|
|
116
|
+
* @petrinet ./path/to/module#functionName() — call a function returning one
|
|
87
117
|
* @petrinet #localExport — resolve from same file
|
|
88
118
|
* ```
|
|
89
119
|
*
|
|
90
|
-
* Mirrors: `org.libpetri.doclet.PetriNetTaglet.
|
|
120
|
+
* Mirrors: `org.libpetri.doclet.PetriNetTaglet.resolveReference`
|
|
91
121
|
*
|
|
92
122
|
* @module doclet/net-resolver
|
|
93
123
|
*/
|
|
94
124
|
|
|
95
|
-
|
|
96
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Discriminated-union result from {@link resolveNet}. Each variant carries
|
|
127
|
+
* the resolved value plus a display title.
|
|
128
|
+
*/
|
|
129
|
+
type ResolvedNet = {
|
|
130
|
+
readonly kind: 'net';
|
|
131
|
+
readonly value: PetriNet;
|
|
132
|
+
readonly title: string;
|
|
133
|
+
} | {
|
|
134
|
+
readonly kind: 'subnet';
|
|
135
|
+
readonly value: SubnetDef<unknown>;
|
|
136
|
+
readonly title: string;
|
|
137
|
+
} | {
|
|
138
|
+
readonly kind: 'instance';
|
|
139
|
+
readonly value: Instance<unknown>;
|
|
97
140
|
readonly title: string;
|
|
98
|
-
}
|
|
141
|
+
};
|
|
99
142
|
/**
|
|
100
|
-
* Parses a `@petrinet` reference and resolves
|
|
143
|
+
* Parses a `@petrinet` / `@subnet` reference and resolves it via dynamic
|
|
144
|
+
* import. Returns `null` when the reference cannot be parsed or imported, or
|
|
145
|
+
* when the resolved value is none of the three supported kinds.
|
|
101
146
|
*
|
|
102
147
|
* @param reference - the tag content, e.g. `./definition#buildDebugNet()`
|
|
103
148
|
* @param sourceFilePath - absolute path to the source file containing the tag
|
|
104
|
-
* @returns the resolved PetriNet with title, or null on failure
|
|
105
149
|
*/
|
|
106
150
|
declare function resolveNet(reference: string, sourceFilePath: string): Promise<ResolvedNet | null>;
|
|
107
151
|
|
|
108
|
-
|
|
152
|
+
/**
|
|
153
|
+
* HTML-fragment generator for the small "subnet header" badge bar that the
|
|
154
|
+
* {@link import('./diagram-renderer.js')} layers above subnet diagrams.
|
|
155
|
+
*
|
|
156
|
+
* For a {@link import('../core/subnet-def.js').SubnetDef} the header lists
|
|
157
|
+
* the subnet name, the parameter type (best-effort — TypeScript erases
|
|
158
|
+
* generics at runtime so the slot is shown as a placeholder), and one badge
|
|
159
|
+
* per port and channel — colour-coded by direction
|
|
160
|
+
* (`interface-port-input` / `-output` / `-inout` CSS classes, plus
|
|
161
|
+
* `interface-channel` for sync channels).
|
|
162
|
+
*
|
|
163
|
+
* For an {@link import('../core/instance.js').Instance} the header lists the
|
|
164
|
+
* instance prefix, the originating definition's name, and the {@link
|
|
165
|
+
* import('../core/instance.js').Instance#params} summary.
|
|
166
|
+
*
|
|
167
|
+
* Mirrors: `org.libpetri.doclet.SubnetHeader`
|
|
168
|
+
*
|
|
169
|
+
* @module doclet/subnet-header
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Builds the header HTML for a {@link SubnetDef} field.
|
|
174
|
+
*
|
|
175
|
+
* @param def the subnet definition
|
|
176
|
+
* @param interfaceOnly when `true`, the header carries the "(interface only)"
|
|
177
|
+
* badge so the reader knows the body is intentionally
|
|
178
|
+
* omitted
|
|
179
|
+
*/
|
|
180
|
+
declare function forSubnetDef(def: SubnetDef<unknown>, interfaceOnly: boolean): string;
|
|
181
|
+
/**
|
|
182
|
+
* Builds the header HTML for an {@link Instance} field.
|
|
183
|
+
*/
|
|
184
|
+
declare function forInstance(instance: Instance<unknown>): string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* DOT generators for the subnet-aware diagrams the {@link
|
|
188
|
+
* import('./petri-net-plugin.js')} plugin draws.
|
|
189
|
+
*
|
|
190
|
+
* Two flavours:
|
|
191
|
+
* - {@link fullBody} — the subnet's complete body, but with its interface-port
|
|
192
|
+
* places restyled with the `interface-port` category from
|
|
193
|
+
* `petri-net-styles.json` so they read as boundary elements at a glance. A
|
|
194
|
+
* small `subgraph cluster_iface_*` with label `"interface"` surrounds the
|
|
195
|
+
* port places and channel transitions to advertise the subnet boundary
|
|
196
|
+
* visually.
|
|
197
|
+
* - {@link interfaceOnly} — a tiny diagram of just the port places, the
|
|
198
|
+
* channel transitions, and a single stub node indicating the body is
|
|
199
|
+
* omitted. Used by the `@subnet` block tag.
|
|
200
|
+
*
|
|
201
|
+
* This module stays in the doclet directory (rather than living in
|
|
202
|
+
* `export/`) because it is a doclet-presentation concern — the production
|
|
203
|
+
* export pipeline never adds the `interface` cluster.
|
|
204
|
+
*
|
|
205
|
+
* Mirrors: `org.libpetri.doclet.SubnetDotExport`
|
|
206
|
+
*
|
|
207
|
+
* @module doclet/subnet-dot-export
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Renders the full body of a {@link SubnetDef} with the interface ports
|
|
212
|
+
* restyled. The output is a post-processed version of {@link dotExport}: the
|
|
213
|
+
* port-place node attribute lines are rewritten so the post-processor swaps in
|
|
214
|
+
* the {@code interface-port} category, channel-transition lines swap in
|
|
215
|
+
* {@code sync-channel}, and an extra {@code subgraph cluster_iface_<name>}
|
|
216
|
+
* block is appended that lists the port nodes by id — overriding their
|
|
217
|
+
* cluster membership without re-emitting them (DOT semantics: a node
|
|
218
|
+
* referenced inside a subgraph block by id alone is treated as a member of
|
|
219
|
+
* that cluster).
|
|
220
|
+
*/
|
|
221
|
+
declare function fullBody(def: SubnetDef<unknown>): string;
|
|
222
|
+
/**
|
|
223
|
+
* Renders an interface-only diagram: just the port places + channel
|
|
224
|
+
* transitions + a single stub node labelled "(internals omitted)" so the
|
|
225
|
+
* reader knows the body has not been drawn.
|
|
226
|
+
*/
|
|
227
|
+
declare function interfaceOnly(def: SubnetDef<unknown>): string;
|
|
228
|
+
|
|
229
|
+
export { type ResolvedNet, dotToSvg, escapeHtml, forInstance, forSubnetDef, load, renderSubnetSvg, renderSvg, resolveNet, fullBody as subnetFullBody, interfaceOnly as subnetInterfaceOnly };
|