@rotorsoft/act-diagram 0.2.1 → 0.3.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/dist/index.js CHANGED
@@ -372,13 +372,14 @@ function captureDispatches(handler) {
372
372
  const dispatches = [];
373
373
  if (typeof handler !== "function") return dispatches;
374
374
  try {
375
+ const safeProxy = () => new Proxy({}, { get: () => "" });
375
376
  const mockApp = {
376
377
  do: (actionName) => {
377
378
  if (typeof actionName === "string" && !dispatches.includes(actionName))
378
379
  dispatches.push(actionName);
379
380
  return Promise.resolve([]);
380
381
  },
381
- load: () => Promise.resolve({}),
382
+ load: () => Promise.resolve({ state: safeProxy(), version: 0 }),
382
383
  query: () => Promise.resolve({ count: 0 }),
383
384
  query_array: () => Promise.resolve([])
384
385
  };
@@ -1400,7 +1401,6 @@ function computeLayout(viewModel) {
1400
1401
  const actionEmitted = /* @__PURE__ */ new Set();
1401
1402
  for (const action of st.actions) {
1402
1403
  for (const en of action.emits) {
1403
- eventRows.push({ eventName: en, actionName: action.name });
1404
1404
  actionEmitted.add(en);
1405
1405
  }
1406
1406
  }
@@ -1409,6 +1409,11 @@ function computeLayout(viewModel) {
1409
1409
  eventRows.push({ eventName: ev.name, actionName: "" });
1410
1410
  }
1411
1411
  }
1412
+ for (const action of st.actions) {
1413
+ for (const en of action.emits) {
1414
+ eventRows.push({ eventName: en, actionName: action.name });
1415
+ }
1416
+ }
1412
1417
  const measuredEvents = [];
1413
1418
  let evtBlockH = 0;
1414
1419
  for (const { eventName: en, actionName } of eventRows) {
@@ -1544,7 +1549,12 @@ function computeLayout(viewModel) {
1544
1549
  actY += H + GAP / 2;
1545
1550
  actionIdx++;
1546
1551
  }
1547
- y += primaryBlockH + GAP / 2;
1552
+ const contentBottomY = Math.max(
1553
+ y + primaryBlockH,
1554
+ evtY,
1555
+ chainWatermark > -Infinity ? chainWatermark : 0
1556
+ );
1557
+ y = contentBottomY + GAP / 2;
1548
1558
  partIdx++;
1549
1559
  }
1550
1560
  for (const r of slice.reactions) {