sysml-diagram 0.40.0 → 0.41.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/out/main.js CHANGED
@@ -192585,18 +192585,13 @@ function collapseActionFrames(model, hiddenInternals, isHost = isCollapsibleActi
192585
192585
  };
192586
192586
  const roots = new Set([...requested].filter((id2) => rootOf3(frameById.get(id2)?.parent) === void 0));
192587
192587
  const dockOf = /* @__PURE__ */ new Map();
192588
- const proxyHost = /* @__PURE__ */ new Map();
192589
- const ownerOfHiddenPort = /* @__PURE__ */ new Map();
192590
192588
  const hiddenFrameIds = /* @__PURE__ */ new Set();
192591
192589
  for (const f of frames) {
192592
192590
  const root4 = roots.has(f.id) ? rootOf3(f.parent) : rootOf3(f.id);
192593
192591
  if (root4 === void 0) continue;
192594
192592
  hiddenFrameIds.add(f.id);
192595
192593
  dockOf.set(f.id, root4);
192596
- for (const p of f.ports ?? []) {
192597
- proxyHost.set(p.id, root4);
192598
- ownerOfHiddenPort.set(p.id, { port: p, owner: f.id });
192599
- }
192594
+ for (const p of f.ports ?? []) dockOf.set(p.id, root4);
192600
192595
  }
192601
192596
  const hiddenNodeIds = /* @__PURE__ */ new Set();
192602
192597
  for (const n2 of model.nodes) {
@@ -192604,31 +192599,21 @@ function collapseActionFrames(model, hiddenInternals, isHost = isCollapsibleActi
192604
192599
  if (root4 === void 0) continue;
192605
192600
  hiddenNodeIds.add(n2.id);
192606
192601
  dockOf.set(n2.id, root4);
192607
- for (const p of n2.ports ?? []) {
192608
- proxyHost.set(p.id, root4);
192609
- ownerOfHiddenPort.set(p.id, { port: p, owner: n2.id });
192610
- }
192602
+ for (const p of n2.ports ?? []) dockOf.set(p.id, root4);
192611
192603
  }
192604
+ const ownPinOf = /* @__PURE__ */ new Map();
192612
192605
  for (const id2 of roots) {
192613
192606
  dockOf.delete(id2);
192614
192607
  for (const p of frameById.get(id2)?.ports ?? []) {
192615
- proxyHost.delete(p.id);
192616
- ownerOfHiddenPort.delete(p.id);
192608
+ dockOf.delete(p.id);
192609
+ ownPinOf.set(p.id, id2);
192617
192610
  }
192618
192611
  }
192619
- const nodeById = new Map(model.nodes.map((n2) => [n2.id, n2]));
192620
- const containerOf = (id2) => {
192621
- const frame2 = frameById.get(id2);
192622
- if (frame2) return frame2.parent;
192623
- return nodeById.get(id2)?.frame;
192624
- };
192625
- const containerLabel = (id2) => frameById.get(id2)?.label ?? nodeById.get(id2)?.name;
192626
- const hiddenPortById = new Map([...ownerOfHiddenPort].map(([id2, entry]) => [id2, entry.port]));
192627
- const containerRootOf = (id2) => proxyHost.get(id2) ?? dockOf.get(id2);
192612
+ const collapsedOwnerOf = (id2) => dockOf.get(id2) ?? ownPinOf.get(id2) ?? id2;
192628
192613
  const seenEdge = /* @__PURE__ */ new Set();
192629
192614
  const edges = model.edges.filter((e) => {
192630
- const fromRoot = containerRootOf(e.from);
192631
- return fromRoot === void 0 || fromRoot !== containerRootOf(e.to);
192615
+ if (!dockOf.has(e.from) && !dockOf.has(e.to)) return true;
192616
+ return collapsedOwnerOf(e.from) !== collapsedOwnerOf(e.to);
192632
192617
  }).filter((e) => e.from === e.to || (dockOf.get(e.from) ?? e.from) !== (dockOf.get(e.to) ?? e.to)).map((e) => {
192633
192618
  const from = dockOf.get(e.from) ?? e.from;
192634
192619
  const to = dockOf.get(e.to) ?? e.to;
@@ -192639,23 +192624,9 @@ function collapseActionFrames(model, hiddenInternals, isHost = isCollapsibleActi
192639
192624
  seenEdge.add(`${key2}:${e.id}`);
192640
192625
  return true;
192641
192626
  });
192642
- const referenced = /* @__PURE__ */ new Set();
192643
- for (const e of edges) {
192644
- if (proxyHost.has(e.from)) referenced.add(e.from);
192645
- if (proxyHost.has(e.to)) referenced.add(e.to);
192646
- }
192647
- const proxies = proxyPortsByHost(
192648
- referenced,
192649
- proxyHost,
192650
- ownerOfHiddenPort,
192651
- containerLabel,
192652
- containerOf,
192653
- hiddenPortById
192654
- );
192655
192627
  const collapsedNodes = [...roots].flatMap((id2) => {
192656
192628
  const f = frameById.get(id2);
192657
192629
  if (!f) return [];
192658
- const stand = proxies.get(id2) ?? [];
192659
192630
  return [{
192660
192631
  id: f.id,
192661
192632
  layoutKey: f.layoutKey,
@@ -192665,7 +192636,9 @@ function collapseActionFrames(model, hiddenInternals, isHost = isCollapsibleActi
192665
192636
  shape: collapsedShape,
192666
192637
  type: f.type,
192667
192638
  multiplicity: f.multiplicity,
192668
- ports: stand.length ? [...f.ports ?? [], ...stand] : f.ports,
192639
+ // issue #286 the collapsed action keeps ITS OWN pins and nothing
192640
+ // else. A pin of a hidden action stays with that action.
192641
+ ports: f.ports,
192669
192642
  compartments: f.compartments,
192670
192643
  frame: f.parent,
192671
192644
  source: f.source,
@@ -213023,7 +212996,7 @@ async function runExport(command) {
213023
212996
  }
213024
212997
 
213025
212998
  // src/main.ts
213026
- var VERSION2 = true ? "0.40.0" : "dev";
212999
+ var VERSION2 = true ? "0.41.0" : "dev";
213027
213000
  function display(file) {
213028
213001
  const rel2 = path9.relative(process.cwd(), file);
213029
213002
  return rel2 && !rel2.startsWith("..") ? rel2.split(path9.sep).join("/") : file;