sysml-diagram 0.20.0 → 0.20.1

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
@@ -180376,6 +180376,28 @@ var SysmlDocumentBuilder = class extends DefaultDocumentBuilder {
180376
180376
  });
180377
180377
  });
180378
180378
  }
180379
+ /** REQ-006/REQ-398 - Wait for an editor change to reach the parsed document before
180380
+ * serving a diagram refresh. Custom LSP requests are not gated by Langium's
180381
+ * standard request pipeline, so a request sent just after applyEdit can
180382
+ * otherwise read the preceding document version and publish a stale model.
180383
+ */
180384
+ async waitForDocumentVersion(uri, minimumVersion, state = DocumentState.IndexedReferences, cancelToken = import_vscode_languageserver25.CancellationToken.None) {
180385
+ while (!cancelToken.isCancellationRequested) {
180386
+ let document2 = await this.getOrCreateTargetDocument(uri, cancelToken);
180387
+ if (!document2)
180388
+ return void 0;
180389
+ if ((document2.textDocument.version ?? -1) >= minimumVersion) {
180390
+ await this.waitUntil(state, uri, cancelToken);
180391
+ document2 = this.langiumDocuments.getDocument(uri);
180392
+ if (document2 && (document2.textDocument.version ?? -1) >= minimumVersion && document2.state >= state) {
180393
+ return document2;
180394
+ }
180395
+ continue;
180396
+ }
180397
+ await this.waitForDocumentVersionPhase(uri, minimumVersion, state, cancelToken);
180398
+ }
180399
+ throw OperationCancelled;
180400
+ }
180379
180401
  // REQ-075, REQ-220 — Build the global symbol graph first for this batch,
180380
180402
  // then link visible documents before background documents. See class doc,
180381
180403
  // point 2.
@@ -180486,6 +180508,34 @@ var SysmlDocumentBuilder = class extends DefaultDocumentBuilder {
180486
180508
  const state = this.buildState.get(doc.uri.toString());
180487
180509
  return Boolean(state && !state.completed);
180488
180510
  }
180511
+ waitForDocumentVersionPhase(uri, minimumVersion, state, cancelToken) {
180512
+ if (cancelToken.isCancellationRequested)
180513
+ return Promise.reject(OperationCancelled);
180514
+ const target = uri.toString();
180515
+ return new Promise((resolve8, reject2) => {
180516
+ let settled = false;
180517
+ let cancelDisposable;
180518
+ const ready = (document2) => document2?.uri.toString() === target && (document2.textDocument.version ?? -1) >= minimumVersion;
180519
+ const finish = (error) => {
180520
+ if (settled)
180521
+ return;
180522
+ settled = true;
180523
+ phaseDisposable.dispose();
180524
+ cancelDisposable?.dispose();
180525
+ if (error)
180526
+ reject2(error);
180527
+ else
180528
+ resolve8();
180529
+ };
180530
+ const phaseDisposable = this.onDocumentPhase(state, (document2) => {
180531
+ if (ready(document2))
180532
+ finish();
180533
+ });
180534
+ cancelDisposable = cancelToken.onCancellationRequested(() => finish(OperationCancelled));
180535
+ if (ready(this.langiumDocuments.getDocument(uri)))
180536
+ finish();
180537
+ });
180538
+ }
180489
180539
  optionsForState(state) {
180490
180540
  return state >= DocumentState.Validated ? this.updateBuildOptions : { validation: false };
180491
180541
  }
@@ -195474,16 +195524,7 @@ function layoutSequence(nodes, edges, overrides) {
195474
195524
  baseX.push(cursorX);
195475
195525
  cursorX += n2.data.w + LIFELINE_MIN_GAP;
195476
195526
  }
195477
- const msgHandlesOf = /* @__PURE__ */ new Map();
195478
- const pushHandle = (lid, id2, y) => {
195479
- const arr = msgHandlesOf.get(lid) ?? [];
195480
- arr.push({ id: id2, y });
195481
- msgHandlesOf.set(lid, arr);
195482
- };
195483
- edges.forEach((e, i) => {
195484
- pushHandle(e.source, `m${i}`, msgY[i]);
195485
- pushHandle(e.target, `m${i}`, msgY[i]);
195486
- });
195527
+ const msgHandles = edges.map((_edge, i) => ({ id: `m${i}`, y: msgY[i] }));
195487
195528
  const insertHandles = Array.from({ length: Math.max(maxSlot, -1) + 2 }, (_2, k) => ({
195488
195529
  id: `d${k}`,
195489
195530
  y: sequenceSlotBoundaryY(k),
@@ -195507,7 +195548,7 @@ function layoutSequence(nodes, edges, overrides) {
195507
195548
  lineBottom: bodyH,
195508
195549
  ...activation ? { activation } : {},
195509
195550
  ...eventsByLifeline.has(n2.id) ? { eventMarks: eventsByLifeline.get(n2.id) } : {},
195510
- ...msgHandlesOf.has(n2.id) ? { msgHandles: msgHandlesOf.get(n2.id) } : {},
195551
+ msgHandles,
195511
195552
  insertHandles
195512
195553
  },
195513
195554
  draggable: true
@@ -199108,35 +199149,37 @@ function PlanAxes({ g, marker }) {
199108
199149
  const sy = (mv) => g.oy - (mv - g.minV) * g.scale;
199109
199150
  const top = sy(g.maxV) - 14;
199110
199151
  const right = sx(g.maxX) + 20;
199152
+ const originX = sx(0);
199153
+ const originY = sy(0);
199111
199154
  const xticks = ticks(g.minX, g.maxX);
199112
199155
  const vticks = ticks(g.minV, g.maxV);
199113
199156
  const originOnFrame = g.minX <= 0 && g.maxX >= 0 && g.minV <= 0 && g.maxV >= 0;
199114
199157
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
199115
199158
  xticks.map((v) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
199116
199159
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { className: "dgeo-grid", x1: sx(v), y1: top, x2: sx(v), y2: g.oy, stroke: GRID }),
199117
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dgeo-tick", x: sx(v), y: g.oy + 12, textAnchor: "middle", children: v })
199160
+ v === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dgeo-tick", x: sx(v), y: originY + 12, textAnchor: "middle", children: v })
199118
199161
  ] }, `gx${v}`)),
199119
199162
  vticks.map((v) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
199120
199163
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { className: "dgeo-grid", x1: g.ox, y1: sy(v), x2: right, y2: sy(v), stroke: GRID }),
199121
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dgeo-tick", x: g.ox - 6, y: sy(v) + 3, textAnchor: "end", children: v })
199164
+ v === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dgeo-tick", x: originX - 6, y: sy(v) + 3, textAnchor: "end", children: v })
199122
199165
  ] }, `gv${v}`)),
199123
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: g.ox, y1: g.oy, x2: g.ox, y2: top, stroke: AXIS, strokeWidth: "1", markerEnd: `url(#${marker})` }),
199124
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { className: "dnode-kind", x: g.ox + 6, y: top + 4, children: [
199166
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: originX, y1: g.oy, x2: originX, y2: top, stroke: AXIS, strokeWidth: "1", markerEnd: `url(#${marker})` }),
199167
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { className: "dnode-kind", x: originX + 6, y: top + 4, children: [
199125
199168
  g.vLabel,
199126
199169
  " [",
199127
199170
  g.unit,
199128
199171
  "]"
199129
199172
  ] }),
199130
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: g.ox, y1: g.oy, x2: right, y2: g.oy, stroke: AXIS, strokeWidth: "1", markerEnd: `url(#${marker})` }),
199131
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { className: "dnode-kind", x: right, y: g.oy + 14, textAnchor: "end", children: [
199173
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: g.ox, y1: originY, x2: right, y2: originY, stroke: AXIS, strokeWidth: "1", markerEnd: `url(#${marker})` }),
199174
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { className: "dnode-kind", x: right, y: originY + 14, textAnchor: "end", children: [
199132
199175
  g.hLabel,
199133
199176
  " [",
199134
199177
  g.unit,
199135
199178
  "]"
199136
199179
  ] }),
199137
199180
  originOnFrame ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
199138
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: sx(0), cy: sy(0), r: "3", fill: "var(--violet, #a890e0)" }),
199139
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dnode-kind", x: sx(0) - 4, y: sy(0) + 14, textAnchor: "end", children: "0" })
199181
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: originX, cy: originY, r: "3", fill: "var(--violet, #a890e0)" }),
199182
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { className: "dnode-kind", x: originX - 4, y: originY + 14, textAnchor: "end", children: "0" })
199140
199183
  ] }) : null
199141
199184
  ] });
199142
199185
  }
@@ -201177,7 +201220,7 @@ async function runExport(command) {
201177
201220
  }
201178
201221
 
201179
201222
  // src/main.ts
201180
- var VERSION2 = true ? "0.20.0" : "dev";
201223
+ var VERSION2 = true ? "0.20.1" : "dev";
201181
201224
  function display(file) {
201182
201225
  const rel2 = path9.relative(process.cwd(), file);
201183
201226
  return rel2 && !rel2.startsWith("..") ? rel2.split(path9.sep).join("/") : file;