libpetri 1.8.5 → 2.1.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 (46) hide show
  1. package/README.md +47 -0
  2. package/dist/{chunk-B2D5DMTO.js → chunk-B2CV5M3L.js} +228 -9
  3. package/dist/chunk-B2CV5M3L.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-RNWTYK5B.js +419 -0
  7. package/dist/chunk-RNWTYK5B.js.map +1 -0
  8. package/dist/chunk-SXK2Z45Z.js +50 -0
  9. package/dist/chunk-SXK2Z45Z.js.map +1 -0
  10. package/dist/debug/index.d.ts +50 -3
  11. package/dist/debug/index.js +64 -6
  12. package/dist/debug/index.js.map +1 -1
  13. package/dist/doclet/index.d.ts +152 -31
  14. package/dist/doclet/index.js +458 -57
  15. package/dist/doclet/index.js.map +1 -1
  16. package/dist/doclet/resources/petrinet-diagrams.css +640 -7
  17. package/dist/doclet/resources/petrinet-diagrams.js +7238 -114
  18. package/dist/dot-exporter-WJMCJEFK.js +8 -0
  19. package/dist/{event-store-BnyHh3TF.d.ts → event-store-2zkXeQkd.d.ts} +1 -1
  20. package/dist/export/index.d.ts +18 -4
  21. package/dist/export/index.js +1 -1
  22. package/dist/index.d.ts +41 -5
  23. package/dist/index.js +1221 -35
  24. package/dist/index.js.map +1 -1
  25. package/dist/petri-net-BDrj4XZE.d.ts +1461 -0
  26. package/dist/render-QK57X4TP.js +73 -0
  27. package/dist/render-QK57X4TP.js.map +1 -0
  28. package/dist/verification/index.d.ts +3 -144
  29. package/dist/verification/index.js +30 -1214
  30. package/dist/verification/index.js.map +1 -1
  31. package/dist/viewer/index.d.ts +227 -0
  32. package/dist/viewer/index.js +877 -0
  33. package/dist/viewer/index.js.map +1 -0
  34. package/dist/viewer/layout/index.d.ts +200 -0
  35. package/dist/viewer/layout/index.js +15 -0
  36. package/dist/viewer/layout/index.js.map +1 -0
  37. package/dist/viewer/viewer-static.iife.js +3 -0
  38. package/dist/viewer/viewer.css +759 -0
  39. package/dist/viewer/viewer.iife.js +7243 -0
  40. package/package.json +28 -8
  41. package/dist/chunk-B2D5DMTO.js.map +0 -1
  42. package/dist/chunk-VQ4XMJTD.js +0 -107
  43. package/dist/chunk-VQ4XMJTD.js.map +0 -1
  44. package/dist/dot-exporter-3CVCH6J4.js +0 -8
  45. package/dist/petri-net-D-GN9g_D.d.ts +0 -570
  46. /package/dist/{dot-exporter-3CVCH6J4.js.map → dot-exporter-WJMCJEFK.js.map} +0 -0
@@ -1,7 +1,12 @@
1
+ import {
2
+ eventInstancePrefix
3
+ } from "../chunk-SXK2Z45Z.js";
1
4
  import {
2
5
  dotExport,
6
+ instancePrefixOf,
7
+ parentOf,
3
8
  sanitize
4
- } from "../chunk-B2D5DMTO.js";
9
+ } from "../chunk-B2CV5M3L.js";
5
10
  import "../chunk-FN773SSE.js";
6
11
 
7
12
  // src/debug/debug-command.ts
@@ -332,24 +337,69 @@ function buildNetStructure(session) {
332
337
  }
333
338
  const placeInfos = [];
334
339
  for (const [name, info] of places.data) {
335
- placeInfos.push({
340
+ const placeInfo = {
336
341
  name,
337
342
  graphId: `p_${sanitize(name)}`,
338
343
  tokenType: info.tokenType,
339
344
  isStart: !info.hasIncoming,
340
345
  isEnd: !info.hasOutgoing,
341
- isEnvironment: false
342
- });
346
+ isEnvironment: false,
347
+ ...maybeInstancePrefix(name)
348
+ };
349
+ placeInfos.push(placeInfo);
343
350
  }
344
351
  const transitionInfos = [];
345
352
  for (const t of session.transitions) {
346
353
  transitionInfos.push({
347
354
  name: t.name,
348
- graphId: `t_${sanitize(t.name)}`
355
+ graphId: `t_${sanitize(t.name)}`,
356
+ ...maybeInstancePrefix(t.name)
349
357
  });
350
358
  }
351
359
  return { places: placeInfos, transitions: transitionInfos };
352
360
  }
361
+ function maybeInstancePrefix(name) {
362
+ const prefix = instancePrefixOf(name);
363
+ return prefix === void 0 ? {} : { instancePrefix: prefix };
364
+ }
365
+ function buildSubnetInstances(session) {
366
+ if (!session.places) {
367
+ return [];
368
+ }
369
+ const byPrefix = /* @__PURE__ */ new Map();
370
+ function ensure(prefix) {
371
+ let acc = byPrefix.get(prefix);
372
+ if (!acc) {
373
+ acc = { transitionNames: [], placeNames: [] };
374
+ byPrefix.set(prefix, acc);
375
+ }
376
+ return acc;
377
+ }
378
+ for (const t of session.transitions) {
379
+ const prefix = instancePrefixOf(t.name);
380
+ if (prefix !== void 0) {
381
+ ensure(prefix).transitionNames.push(t.name);
382
+ }
383
+ }
384
+ for (const name of session.places.data.keys()) {
385
+ const prefix = instancePrefixOf(name);
386
+ if (prefix !== void 0) {
387
+ ensure(prefix).placeNames.push(name);
388
+ }
389
+ }
390
+ const result = [];
391
+ for (const [prefix, acc] of byPrefix) {
392
+ const parent = parentOf(prefix);
393
+ const info = {
394
+ prefix,
395
+ transitionNames: acc.transitionNames,
396
+ exposedPlaceNames: acc.placeNames,
397
+ ...parent === void 0 ? {} : { parentPrefix: parent }
398
+ };
399
+ result.push(info);
400
+ }
401
+ return result;
402
+ }
353
403
  var DebugSessionRegistry = class {
354
404
  _sessions = /* @__PURE__ */ new Map();
355
405
  _maxSessions;
@@ -576,6 +626,12 @@ function replayDelta(base, delta) {
576
626
 
577
627
  // src/debug/net-event-converter.ts
578
628
  function toEventInfo(event, compact = false) {
629
+ const info = toEventInfoInner(event, compact);
630
+ const prefix = eventInstancePrefix(event);
631
+ if (prefix === void 0) return info;
632
+ return { ...info, details: { ...info.details, instancePrefix: prefix } };
633
+ }
634
+ function toEventInfoInner(event, compact = false) {
579
635
  switch (event.type) {
580
636
  case "execution-started":
581
637
  return {
@@ -870,6 +926,7 @@ var DebugProtocolHandler = class {
870
926
  const events = eventStore.events();
871
927
  const computed = computeState(events);
872
928
  const structure = buildNetStructure(debugSession);
929
+ const subnetInstances = buildSubnetInstances(debugSession);
873
930
  this.send(client, {
874
931
  type: "subscribed",
875
932
  sessionId: cmd.sessionId,
@@ -880,7 +937,8 @@ var DebugProtocolHandler = class {
880
937
  enabledTransitions: computed.enabledTransitions,
881
938
  inFlightTransitions: computed.inFlightTransitions,
882
939
  eventCount: eventStore.eventCount(),
883
- mode: cmd.mode
940
+ mode: cmd.mode,
941
+ subnetInstances
884
942
  });
885
943
  const fromIndex = cmd.fromIndex ?? 0;
886
944
  if (cmd.mode === "live") {