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.
Files changed (41) hide show
  1. package/README.md +47 -0
  2. package/dist/{chunk-B2D5DMTO.js → chunk-4L6JVKH4.js} +165 -8
  3. package/dist/chunk-4L6JVKH4.js.map +1 -0
  4. package/dist/chunk-H62Z76FY.js +1346 -0
  5. package/dist/chunk-H62Z76FY.js.map +1 -0
  6. package/dist/chunk-SXK2Z45Z.js +50 -0
  7. package/dist/chunk-SXK2Z45Z.js.map +1 -0
  8. package/dist/debug/index.d.ts +50 -3
  9. package/dist/debug/index.js +64 -6
  10. package/dist/debug/index.js.map +1 -1
  11. package/dist/doclet/index.d.ts +152 -31
  12. package/dist/doclet/index.js +458 -57
  13. package/dist/doclet/index.js.map +1 -1
  14. package/dist/doclet/resources/petrinet-diagrams.css +384 -7
  15. package/dist/doclet/resources/petrinet-diagrams.js +7214 -106
  16. package/dist/dot-exporter-PMHOQHZ3.js +8 -0
  17. package/dist/{event-store-BnyHh3TF.d.ts → event-store-2zkXeQkd.d.ts} +1 -1
  18. package/dist/export/index.d.ts +16 -2
  19. package/dist/export/index.js +1 -1
  20. package/dist/index.d.ts +41 -5
  21. package/dist/index.js +1221 -35
  22. package/dist/index.js.map +1 -1
  23. package/dist/petri-net-BDrj4XZE.d.ts +1461 -0
  24. package/dist/render-P6GROU7J.js +16 -0
  25. package/dist/render-P6GROU7J.js.map +1 -0
  26. package/dist/verification/index.d.ts +3 -144
  27. package/dist/verification/index.js +30 -1214
  28. package/dist/verification/index.js.map +1 -1
  29. package/dist/viewer/index.d.ts +196 -0
  30. package/dist/viewer/index.js +442 -0
  31. package/dist/viewer/index.js.map +1 -0
  32. package/dist/viewer/viewer-static.iife.js +3 -0
  33. package/dist/viewer/viewer.css +503 -0
  34. package/dist/viewer/viewer.iife.js +7219 -0
  35. package/package.json +17 -8
  36. package/dist/chunk-B2D5DMTO.js.map +0 -1
  37. package/dist/chunk-VQ4XMJTD.js +0 -107
  38. package/dist/chunk-VQ4XMJTD.js.map +0 -1
  39. package/dist/dot-exporter-3CVCH6J4.js +0 -8
  40. package/dist/petri-net-D-GN9g_D.d.ts +0 -570
  41. /package/dist/{dot-exporter-3CVCH6J4.js.map → dot-exporter-PMHOQHZ3.js.map} +0 -0
@@ -0,0 +1,8 @@
1
+ import {
2
+ dotExport
3
+ } from "./chunk-4L6JVKH4.js";
4
+ import "./chunk-FN773SSE.js";
5
+ export {
6
+ dotExport
7
+ };
8
+ //# sourceMappingURL=dot-exporter-PMHOQHZ3.js.map
@@ -1,4 +1,4 @@
1
- import { T as Token } from './petri-net-D-GN9g_D.js';
1
+ import { T as Token } from './petri-net-BDrj4XZE.js';
2
2
 
3
3
  /**
4
4
  * Events emitted during Petri Net execution.
@@ -1,4 +1,4 @@
1
- import { a as PetriNet } from '../petri-net-D-GN9g_D.js';
1
+ import { P as PetriNet } from '../petri-net-BDrj4XZE.js';
2
2
 
3
3
  /**
4
4
  * Format-agnostic typed graph model.
@@ -41,10 +41,24 @@ interface GraphEdge {
41
41
  readonly arcType: 'input' | 'output' | 'inhibitor' | 'read' | 'reset' | 'reset-output';
42
42
  readonly attrs?: Readonly<Record<string, string>>;
43
43
  }
44
+ /**
45
+ * A subgraph (cluster) in the graph.
46
+ *
47
+ * Subgraphs may nest arbitrarily via {@link subgraphs} to model nested subnet
48
+ * instance prefixes per {@code spec/11-modular-composition.md} **MOD-040** and
49
+ * {@code spec/09-export.md} **EXP-016**. Edges whose endpoints both live
50
+ * inside the same cluster are placed inside that cluster via {@link edges} so
51
+ * Graphviz routes them correctly. Cross-cluster (or fully top-level) edges
52
+ * live on the parent {@link Graph#edges} list.
53
+ */
44
54
  interface Subgraph {
45
55
  readonly id: string;
46
56
  readonly label?: string;
47
57
  readonly nodes: readonly GraphNode[];
58
+ /** Edges whose source and target both live inside this subgraph. */
59
+ readonly edges?: readonly GraphEdge[];
60
+ /** Nested child subgraphs (deeper instance prefixes). */
61
+ readonly subgraphs?: readonly Subgraph[];
48
62
  readonly attrs?: Readonly<Record<string, string>>;
49
63
  }
50
64
  interface Graph {
@@ -96,7 +110,7 @@ interface GraphStyle {
96
110
  }
97
111
  declare const FONT: FontStyle;
98
112
  declare const GRAPH: GraphStyle;
99
- type NodeCategory = 'place' | 'start' | 'end' | 'environment' | 'transition' | 'xor-junction' | 'and-junction';
113
+ type NodeCategory = 'place' | 'start' | 'end' | 'environment' | 'transition' | 'xor-junction' | 'and-junction' | 'interface-port' | 'sync-channel';
100
114
  type EdgeCategory = 'input' | 'output' | 'inhibitor' | 'read' | 'reset' | 'reset-output';
101
115
  /** Returns the visual style for the given node category. */
102
116
  declare function nodeStyle(category: NodeCategory): NodeVisual;
@@ -8,7 +8,7 @@ import {
8
8
  nodeStyle,
9
9
  renderDot,
10
10
  sanitize
11
- } from "../chunk-B2D5DMTO.js";
11
+ } from "../chunk-4L6JVKH4.js";
12
12
  import "../chunk-FN773SSE.js";
13
13
  export {
14
14
  DEFAULT_DOT_CONFIG,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,43 @@
1
- import { P as Place, T as Token, a as PetriNet, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-D-GN9g_D.js';
2
- export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, I as In, i as InAll, j as InAtLeast, k as InExactly, l as InOne, L as LogFn, M as MAX_DURATION_MS, m as OutAnd, n as OutForwardInput, o as OutPlace, p as OutTimeout, q as OutXor, r as OutputEntry, s as PetriNetBuilder, t as Timing, u as TimingDeadline, v as TimingDelayed, w as TimingExact, x as TimingImmediate, y as TimingWindow, z as TokenInput, B as TokenOutput, C as TransitionAction, D as TransitionBuilder, F as all, G as allPlaces, H as and, J as andPlaces, K as arcPlace, N as atLeast, Q as consumptionCount, R as deadline, S as delayed, U as earliest, V as enumerateBranches, W as environmentPlace, X as exact, Y as exactly, Z as fork, _ as forwardInput, $ as hasDeadline, a0 as hasGuard, a1 as immediate, a2 as inhibitorArc, a3 as inputArc, a4 as isUnit, a5 as latest, a6 as matchesGuard, a7 as one, a8 as outPlace, a9 as outputArc, aa as passthrough, ab as place, ac as produce, ad as readArc, ae as requiredCount, af as resetArc, ag as timeout, ah as timeoutPlace, ai as tokenAt, aj as tokenOf, ak as transform, al as transformAsync, am as transformFrom, an as unitToken, ao as window, ap as withTimeout, aq as xor, ar as xorPlaces } from './petri-net-D-GN9g_D.js';
3
- import { E as EventStore } from './event-store-BnyHh3TF.js';
4
- export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store-BnyHh3TF.js';
1
+ import { P as PetriNet, S as SubnetDef, a as Place, T as Token, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-BDrj4XZE.js';
2
+ export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, C as Channel, i as ComposeBindings, F as FusionSet, j as FusionSetBuilder, I as In, k as InAll, l as InAtLeast, m as InExactly, n as InOne, o as Instance, p as Interface, q as InterfaceBuilder, L as LogFn, M as MAX_DURATION_MS, r as OutAnd, s as OutForwardInput, t as OutPlace, u as OutTimeout, v as OutXor, w as OutputEntry, x as PetriNetBuilder, y as Port, z as PortDirection, B as SubnetDefBuilder, D as SubnetInstance, G as Timing, H as TimingDeadline, J as TimingDelayed, K as TimingExact, N as TimingImmediate, Q as TimingWindow, R as TokenInput, U as TokenOutput, V as TransitionAction, W as TransitionBuilder, X as VerificationHarness, Y as VerificationResult, Z as all, _ as allPlaces, $ as and, a0 as andPlaces, a1 as arcPlace, a2 as atLeast, a3 as consumptionCount, a4 as deadline, a5 as delayed, a6 as earliest, a7 as enumerateBranches, a8 as environmentPlace, a9 as exact, aa as exactly, ab as fork, ac as forwardInput, ad as hasDeadline, ae as hasGuard, af as immediate, ag as inhibitorArc, ah as inputArc, ai as isUnit, aj as latest, ak as matchesGuard, al as one, am as outPlace, an as outputArc, ao as passthrough, ap as place, aq as produce, ar as readArc, as as requiredCount, at as resetArc, au as timeout, av as timeoutPlace, aw as tokenAt, ax as tokenOf, ay as transform, az as transformAsync, aA as transformFrom, aB as unitToken, aC as window, aD as withTimeout, aE as xor, aF as xorPlaces } from './petri-net-BDrj4XZE.js';
3
+ import { E as EventStore } from './event-store-2zkXeQkd.js';
4
+ export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store-2zkXeQkd.js';
5
+
6
+ /**
7
+ * Discriminated sum-type abstraction over Petri nets, distinguishing **closed**
8
+ * (runnable) nets from **open** (composable) subnet fragments per
9
+ * `spec/11-modular-composition.md` requirement **MOD-002**.
10
+ *
11
+ * This abstraction is the bridge between the existing flat {@link PetriNet}
12
+ * world and the modular composition extension. Code that wishes to accept
13
+ * "any net" types its parameter as `Subnet`; code that needs a runnable net
14
+ * continues to take {@link PetriNet} (or `Subnet` narrowed to `'closed'`);
15
+ * code that needs an open fragment takes {@link SubnetDef} (or `Subnet`
16
+ * narrowed to `'open'`). Misuse is rejected at compile time wherever
17
+ * TypeScript's structural typing permits.
18
+ *
19
+ * Use the literal `kind` field for exhaustive pattern matching:
20
+ *
21
+ * ```ts
22
+ * function classify(s: Subnet): string {
23
+ * switch (s.kind) {
24
+ * case 'closed': return `closed:${s.net.name}`;
25
+ * case 'open': return `open:${s.def.name}`;
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ type Subnet = {
31
+ readonly kind: 'closed';
32
+ readonly net: PetriNet;
33
+ } | {
34
+ readonly kind: 'open';
35
+ readonly def: SubnetDef<unknown>;
36
+ };
37
+ /** Wraps a {@link PetriNet} as a closed (runnable) {@link Subnet}. */
38
+ declare function closedSubnet(net: PetriNet): Subnet;
39
+ /** Wraps a {@link SubnetDef} as an open (composable) {@link Subnet}. */
40
+ declare function openSubnet(def: SubnetDef<unknown>): Subnet;
5
41
 
6
42
  /**
7
43
  * @module marking
@@ -556,4 +592,4 @@ declare function validateOutSpec(tName: string, spec: Out, producedPlaceNames: S
556
592
  */
557
593
  declare function produceTimeoutOutput(context: TransitionContext, timeoutChild: Out): void;
558
594
 
559
- export { BitmapNetExecutor, type BitmapNetExecutorOptions, type CardinalityCheck, CompiledNet, EnvironmentPlace, EventStore, type GuardSpec, Marking, Out, OutViolationError, PetriNet, type PetriNetExecutor, Place, PrecompiledNet, PrecompiledNetExecutor, type PrecompiledNetExecutorOptions, Token, Transition, TransitionContext, clearBit, containsAll, intersects, produceTimeoutOutput, setBit, testBit, validateOutSpec };
595
+ export { BitmapNetExecutor, type BitmapNetExecutorOptions, type CardinalityCheck, CompiledNet, EnvironmentPlace, EventStore, type GuardSpec, Marking, Out, OutViolationError, PetriNet, type PetriNetExecutor, Place, PrecompiledNet, PrecompiledNetExecutor, type PrecompiledNetExecutorOptions, type Subnet, SubnetDef, Token, Transition, TransitionContext, clearBit, closedSubnet, containsAll, intersects, openSubnet, produceTimeoutOutput, setBit, testBit, validateOutSpec };