@weasel-js/diagram 1.15.1 → 1.16.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.
@@ -1,10 +1,10 @@
1
- import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-UUMLQEMR.js';
2
- import { edgeRouter, registerMarkShape, withDiagramRegistry, diagramLabelOf, routesOf, layoutPoses, routeWrites, editEdgeLabelBinding, editEdgeLabelAction, diagramGroupOf, diagramContainerOf, headerBox, buildGraph, LAYOUTS, LABEL_DRAG_AFFORDANCE_KIND, EDIT_EDGE_LABEL_ACTION_ID, labelDragLayer, laneOutlineOf, recordedRows, keyedIndex, boxIndex, boxesMeeting, routerOf, labelScratchOf, ROUTERS, avoid, LABEL_PLACEMENT, editableLabels, titleIdOf, orthogonal, diagramAnchorOf, MIN_LANE_SIZE, EDGE_DERIVE_PATH, titleInFrame, regionSpecs, DIAGRAM_THEME_KEY, diagramThemeOf, endAims, resolveEnd, themeLabelFamily, diagramThemeFrom, themeFont, bodyBox, boxCenter, roleEdgeStyle, DEFAULT_FONT, withColors, roleStyle, GLYPH, themeLabelFont, firstLanes, DEFAULT_LANE_SIZE } from './chunk-NEX4QKQQ.js';
3
- import { diagramEdgeOf, isPromise, diagramNodeOf, portsOf, portSitesOf, outlinePath, outlineDetail, outlineSolid, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, dataKeyReader, layoutBody, forceRelaxation, center, portOf, labelCenter, labelSpotAt, contentBox, boxForContent, grid, chain, tree, isPinned, layoutOwnsRoute } from './chunk-UOFQBGJY.js';
4
- import { bodyPredicate, dragPanContribution, WeaselProvider, useScene, useSelection, useLatest, SceneCanvas, useDepSource, RIGID_POSE_COMPOSITION, registerNodeShape, reconcileSpecs, pagesBounds, pagesLayer, usePoseRun, drawnBoundsScene, pointAlongPath, scenePoseAdapter, drawnAABBOf, composeWorldPose, worldPosesOf, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, nodeGates, scenePoseFrame, fitViewToBounds, clampView, AUTO_POSE_DESCRIPTOR, composeAffordanceLayer, createResizeAction, createDeleteAction, isTextData, effectivePose, polylineFromPoints, SNAP_ROLES, ActionDisabledReason, commitDeleteToScene, refusalOf, snapMods, documentDepOf, translatePoseViaDescriptor, definesFrame, paintsLayer, viewToTransform, ellipsePath, carriedDescendants, sceneCarrySource, derivedDepOf, localizeWorldPoses, PathBuilder, startCarry, createInsertOp, createSetDataOp, documentPose } from '@weasel-js/core';
1
+ import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-6S5QNNPB.js';
2
+ import { edgeStrokeOf, DEFAULT_EDGE_STYLE, edgeRouter, registerMarkShape, withDiagramRegistry, diagramLabelOf, routesOf, layoutPoses, routeWrites, editEdgeLabelBinding, editEdgeLabelAction, diagramGroupOf, diagramContainerOf, headerBox, buildGraph, LAYOUTS, LABEL_DRAG_AFFORDANCE_KIND, EDIT_EDGE_LABEL_ACTION_ID, labelDragLayer, laneOutlineOf, recordedRows, keyedIndex, boxIndex, boxesMeeting, routerOf, labelScratchOf, ROUTERS, avoid, LABEL_PLACEMENT, editableLabels, titleIdOf, orthogonal, diagramAnchorOf, MIN_LANE_SIZE, EDGE_DERIVE_PATH, titleInFrame, regionSpecs, DIAGRAM_THEME_KEY, diagramThemeOf, endAims, resolveEnd, themeLabelFamily, diagramThemeFrom, themeFont, bodyBox, boxCenter, roleEdgeStyle, DEFAULT_FONT, withColors, roleStyle, GLYPH, themeLabelFont, firstLanes, DEFAULT_LANE_SIZE } from './chunk-3MAKSWI2.js';
3
+ import { diagramEdgeOf, isPromise, diagramNodeOf, portsOf, portSitesOf, outlinePath, outlineDetail, outlineSolid, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, dataKeyReader, layoutBody, forceRelaxation, center, portOf, labelCenter, labelSpotAt, contentBox, boxForContent, grid, chain, tree, isPinned, layoutOwnsRoute } from './chunk-6EPWNUHC.js';
4
+ import { bodyPredicate, dragPanContribution, WeaselProvider, useScene, useSelection, useLatest, SceneCanvas, useDepSource, viewRectToScreen, RIGID_POSE_COMPOSITION, registerNodeShape, reconcileSpecs, pagesBounds, pagesLayer, usePoseRun, drawnBoundsScene, pointAlongPath, scenePoseAdapter, drawnAABBOf, composeWorldPose, worldPosesOf, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, nodeGates, scenePoseFrame, fitViewToBounds, clampView, viewportWorldRect, AUTO_POSE_DESCRIPTOR, composeAffordanceLayer, createResizeAction, createDeleteAction, isTextData, effectivePose, polylineFromPoints, SNAP_ROLES, ActionDisabledReason, commitDeleteToScene, refusalOf, snapMods, documentDepOf, translatePoseViaDescriptor, definesFrame, paintsLayer, viewToTransform, ellipsePath, carriedDescendants, sceneCarrySource, derivedDepOf, localizeWorldPoses, PathBuilder, startCarry, createInsertOp, createSetDataOp, documentPose } from '@weasel-js/core';
5
5
  import { createSettledCache } from '@weasel-js/geom/nd';
6
6
  import { AUTO_POSE_DESCRIPTOR as AUTO_POSE_DESCRIPTOR$1, rotatePoint } from '@weasel-js/core/math';
7
- import { clampRectWithin, placeRect, pathContainsPoint } from '@weasel-js/geom';
7
+ import { unionRects, clampRectWithin, placeRect, lerpPoint, rectContainsPoint, pathContainsPoint, rectContainsPointHalfOpen } from '@weasel-js/geom';
8
8
  import { nudgeGap, moveItems, nearestGap, isNoopDrop } from '@weasel-js/ui-logic';
9
9
  import { forwardRef, useMemo, useEffect, useState, useRef, useCallback, useImperativeHandle, useLayoutEffect } from 'react';
10
10
  import { useLatest as useLatest$1, adoptCssOnce } from '@weasel-js/react';
@@ -136,8 +136,8 @@ function bodyAt(participants, at, opts = {}) {
136
136
  if (bounds.width <= 0 || bounds.height <= 0) continue;
137
137
  const rotation = geometry.getRotation?.(participant.pose) ?? 0;
138
138
  const local = rotation === 0 ? at : rotatePoint(at.x, at.y, bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, -rotation);
139
- const inside2 = trait.outline === void 0 ? local.x >= bounds.x && local.x <= bounds.x + bounds.width && local.y >= bounds.y && local.y <= bounds.y + bounds.height : pathContainsPoint(outlinePath(trait.outline, bounds), local.x, local.y);
140
- if (inside2) hit = { end: { kind: "body", nodeId: node.id, point: { x: at.x, y: at.y } }, participant };
139
+ const inside = trait.outline === void 0 ? local.x >= bounds.x && local.x <= bounds.x + bounds.width && local.y >= bounds.y && local.y <= bounds.y + bounds.height : pathContainsPoint(outlinePath(trait.outline, bounds), local.x, local.y);
140
+ if (inside) hit = { end: { kind: "body", nodeId: node.id, point: { x: at.x, y: at.y } }, participant };
141
141
  }
142
142
  return hit;
143
143
  }
@@ -239,11 +239,7 @@ var defaultCanConnect = (from, to) => {
239
239
  return from.type === to.type;
240
240
  };
241
241
  var DEFAULT_SNAP = 16;
242
- var DEFAULT_EDGE_STROKE = {
243
- paint: { color: "#7ba7c7" },
244
- width: 2,
245
- markerEnd: "arrow"
246
- };
242
+ var DEFAULT_EDGE_STROKE = edgeStrokeOf(DEFAULT_EDGE_STYLE);
247
243
  var DEFAULT_ROUTER = "straight";
248
244
  function connectBinding(actionId = CONNECT_ACTION_ID) {
249
245
  return {
@@ -352,8 +348,6 @@ function createConnectAction(opts) {
352
348
  enabled: () => true
353
349
  };
354
350
  }
355
-
356
- // src/containers/canDropInto.ts
357
351
  function diagramCanDropInto(scene, canReparent) {
358
352
  const nodeOf = (id) => scene.get(id);
359
353
  const roleOf = (id) => {
@@ -391,8 +385,7 @@ function diagramDropParentAt(scene, point, role) {
391
385
  const world = frame === null || compose === void 0 ? pose : compose(frame, pose);
392
386
  const trait = diagramContainerOf(node);
393
387
  const b = bodyBox(world, trait?.header);
394
- const inside2 = point.x >= b.x && point.x < b.x + b.width && point.y >= b.y && point.y < b.y + b.height;
395
- if (!inside2) continue;
388
+ if (!rectContainsPointHalfOpen(b, point.x, point.y)) continue;
396
389
  if (trait?.role === "container" || trait?.role === "lane") best = id;
397
390
  walk(scene.childrenOf(id), world);
398
391
  }
@@ -452,7 +445,6 @@ function slideOthers(scene, slots, carried) {
452
445
  // src/reorder.ts
453
446
  var REORDER_ACTION_ID = "diagram.reorder";
454
447
  var END_GAP = 24;
455
- var inside = (p, b) => p.x >= b.x && p.x <= b.x + b.width && p.y >= b.y && p.y <= b.y + b.height;
456
448
  function sequenceSlots(axis, items) {
457
449
  const [along2, across, size, depth] = axis === "x" ? ["x", "y", "width", "height"] : ["y", "x", "height", "width"];
458
450
  const lo = (b) => b[along2];
@@ -474,7 +466,7 @@ function sequenceSlots(axis, items) {
474
466
  return { axis, items, gaps };
475
467
  }
476
468
  function pickAt(slots, at) {
477
- const from = slots?.items.findIndex((i) => i.grip !== null && inside(at, i.grip ?? i.bounds)) ?? -1;
469
+ const from = slots?.items.findIndex((i) => i.grip !== null && rectContainsPoint(i.grip ?? i.bounds, at.x, at.y)) ?? -1;
478
470
  return from < 0 ? null : { from, item: slots.items[from] };
479
471
  }
480
472
  function gapAt(held, by) {
@@ -508,7 +500,7 @@ function createReorderAction(opts) {
508
500
  const held = { slots, ...picked };
509
501
  const { axis } = slots;
510
502
  const region2 = opts.region?.(ctx.deps, held.item) ?? null;
511
- const leaves = (at) => region2 !== null && !inside(at, region2);
503
+ const leaves = (at) => region2 !== null && !rectContainsPoint(region2, at.x, at.y);
512
504
  let by = ctx.world[axis] - start[axis];
513
505
  let open = true;
514
506
  const verdicts = /* @__PURE__ */ new Map();
@@ -597,14 +589,6 @@ function worldRectOf(scene, id) {
597
589
  const live = { ...scenePoseAdapter(scene), getPose: (at) => effectivePose(scene, scene.get(at)) };
598
590
  return drawnAABBOf(drawn, id, composeWorldPose(live, id, scene.composition.compose), { includeStroke: false });
599
591
  }
600
- function screenRectOf(rect, view) {
601
- return {
602
- x: (rect.x - view.x) * view.scale.x,
603
- y: (rect.y - view.y) * view.scale.y,
604
- width: rect.width * view.scale.x,
605
- height: rect.height * view.scale.y
606
- };
607
- }
608
592
  var CENTER = "center";
609
593
  function place(el, overlay, anchor, view) {
610
594
  const size = { width: el.offsetWidth, height: el.offsetHeight };
@@ -626,7 +610,7 @@ function useOverlayPlacement(canvasRef, scene, overlays) {
626
610
  const world = worldRectOf(scene, overlay.target);
627
611
  el.hidden = world === null;
628
612
  if (world === null) continue;
629
- const rect = screenRectOf(world, view);
613
+ const rect = viewRectToScreen(view, world);
630
614
  const anchor = { ...rect, x: rect.x + surface.offsetLeft, y: rect.y + surface.offsetTop };
631
615
  place(el, overlay, anchor, {
632
616
  x: surface.offsetLeft,
@@ -2305,10 +2289,10 @@ function obstaclesOf(specs, world) {
2305
2289
  if (s.parent == null) continue;
2306
2290
  children.set(s.parent, [...children.get(s.parent) ?? [], s.id]);
2307
2291
  }
2308
- const inside2 = (id, into) => {
2292
+ const inside = (id, into) => {
2309
2293
  for (const child of children.get(id) ?? []) {
2310
2294
  into.add(child);
2311
- inside2(child, into);
2295
+ inside(child, into);
2312
2296
  }
2313
2297
  return into;
2314
2298
  };
@@ -2322,7 +2306,7 @@ function obstaclesOf(specs, world) {
2322
2306
  const header = region2 === null ? null : headerBox(box, region2.header);
2323
2307
  if (header !== null) out.push({ id: headerIdOf(node.id), kind: "shape", box: header });
2324
2308
  if (region2?.role === "lane") continue;
2325
- out.push(region2 === null ? { id: node.id, kind: "shape", box } : { id: node.id, kind: "region", box, members: inside2(node.id, /* @__PURE__ */ new Set()) });
2309
+ out.push(region2 === null ? { id: node.id, kind: "shape", box } : { id: node.id, kind: "region", box, members: inside(node.id, /* @__PURE__ */ new Set()) });
2326
2310
  }
2327
2311
  return out;
2328
2312
  }
@@ -2816,19 +2800,18 @@ function usePendingPlan() {
2816
2800
  useEffect(() => () => pending.drop(), [pending]);
2817
2801
  return pending;
2818
2802
  }
2819
- var lerp = (a, b, u) => ({ x: a.x + (b.x - a.x) * u, y: a.y + (b.y - a.y) * u });
2820
2803
  function along(points, s) {
2821
2804
  if (points.length === 1) return points[0];
2822
2805
  const lengths = points.slice(1).map((p, i) => Math.hypot(p.x - points[i].x, p.y - points[i].y));
2823
2806
  const total = lengths.reduce((a, b) => a + b, 0);
2824
2807
  let left = s * total;
2825
2808
  for (const [i, len] of lengths.entries()) {
2826
- if (left <= len || i === lengths.length - 1) return lerp(points[i], points[i + 1], len === 0 ? 0 : Math.min(left / len, 1));
2809
+ if (left <= len || i === lengths.length - 1) return lerpPoint(points[i], points[i + 1], len === 0 ? 0 : Math.min(left / len, 1));
2827
2810
  left -= len;
2828
2811
  }
2829
2812
  return points[points.length - 1];
2830
2813
  }
2831
- var straightRun = (count, start, end) => Array.from({ length: count }, (_, k) => lerp(start, end, (k + 1) / (count + 1)));
2814
+ var straightRun = (count, start, end) => Array.from({ length: count }, (_, k) => lerpPoint(start, end, (k + 1) / (count + 1)));
2832
2815
  function respread(points, count, start, end) {
2833
2816
  if (points.length === count) return [...points];
2834
2817
  if (points.length === 0) return straightRun(count, start, end);
@@ -2889,7 +2872,7 @@ function easedPaths(scene, easings, u, poseOf, geometry = AUTO_POSE_DESCRIPTOR)
2889
2872
  const [a, b] = deps;
2890
2873
  target = u >= 1 || a === void 0 || b === void 0 ? [] : straightRun(from.length, centerOf(a), centerOf(b));
2891
2874
  }
2892
- const waypoints = target.length === 0 && u >= 1 ? [] : from.map((p, k) => lerp(p, target[k], u));
2875
+ const waypoints = target.length === 0 && u >= 1 ? [] : from.map((p, k) => lerpPoint(p, target[k], u));
2893
2876
  const data = node.data;
2894
2877
  const diagram = { ...data.diagram, ...ends, waypoints };
2895
2878
  const path = node.derivePath({ ...node, data: { ...data, diagram } }, deps);
@@ -3168,6 +3151,7 @@ var isDiagramBody = (node) => diagramContainerOf(node) === null && diagramGroupO
3168
3151
  var isBodyOrRegion = (node) => diagramContainerOf(node) !== null || isDiagramBody(node);
3169
3152
 
3170
3153
  // src/sequence/edit.ts
3154
+ var sameList = (a, b) => a === b || a !== null && b !== null && a.fragment === b.fragment && a.section === b.section;
3171
3155
  var hasId = (s) => "id" in s;
3172
3156
  function stepListOf(steps, parent) {
3173
3157
  if (parent === null) return steps;
@@ -3248,10 +3232,10 @@ function moveStep(data, id, to) {
3248
3232
  if (from === null || step === null) return data;
3249
3233
  if (to.parent !== null && (to.parent.fragment === id || contains(step, to.parent.fragment))) return data;
3250
3234
  if (stepListOf(data.steps, to.parent) === null) return data;
3251
- const sameList = JSON.stringify(from.parent) === JSON.stringify(to.parent);
3252
- if (sameList && (to.index === from.index || to.index === from.index + 1)) return data;
3235
+ const within = sameList(from.parent, to.parent);
3236
+ if (within && (to.index === from.index || to.index === from.index + 1)) return data;
3253
3237
  const removed = withList(data.steps, from.parent, (list) => list.filter((_, i) => i !== from.index));
3254
- const index = sameList && to.index > from.index ? to.index - 1 : to.index;
3238
+ const index = within && to.index > from.index ? to.index - 1 : to.index;
3255
3239
  const steps = withList(removed, to.parent, (list) => [...list.slice(0, index), step, ...list.slice(index)]);
3256
3240
  return { ...data, steps };
3257
3241
  }
@@ -3663,17 +3647,6 @@ function walkRows(data, m, cols, top) {
3663
3647
  }
3664
3648
 
3665
3649
  // src/sequence/layout.ts
3666
- function unionRect(rects) {
3667
- if (rects.length === 0) return null;
3668
- const x = Math.min(...rects.map((r) => r.x));
3669
- const y = Math.min(...rects.map((r) => r.y));
3670
- return {
3671
- x,
3672
- y,
3673
- width: Math.max(...rects.map((r) => r.x + r.width)) - x,
3674
- height: Math.max(...rects.map((r) => r.y + r.height)) - y
3675
- };
3676
- }
3677
3650
  function sequenceLayout(data, opts = {}) {
3678
3651
  const m = seqMeasure(opts.measure, opts.font);
3679
3652
  const boxLabelHeight = Math.max(0, ...(data.boxes ?? []).map((b) => (b.label ?? "") === "" ? 0 : m.text(b.label).height + 4));
@@ -3685,7 +3658,7 @@ function sequenceLayout(data, opts = {}) {
3685
3658
  const lifelines = rows.lifelines.map((l) => ({ ...l, y1: l.y1 ?? foot, destroyed: l.y1 !== null }));
3686
3659
  const boxes = (data.boxes ?? []).flatMap((b) => {
3687
3660
  const heads = rows.heads.filter((h) => b.members.includes(h.id)).map((h) => h.box);
3688
- const around = unionRect(heads);
3661
+ const around = unionRects(heads);
3689
3662
  if (around === null) return [];
3690
3663
  const label = (b.label ?? "") === "" ? null : m.text(b.label);
3691
3664
  const x = around.x - SEQ.boxPad;
@@ -3694,7 +3667,7 @@ function sequenceLayout(data, opts = {}) {
3694
3667
  const box = { x, y, width, height: foot + SEQ.boxPad - y };
3695
3668
  return [{ id: b.id, box, ...label ? { label: { x: x + (width - label.width) / 2, y: y + 2, ...label } } : {} }];
3696
3669
  });
3697
- const all = unionRect([
3670
+ const all = unionRects([
3698
3671
  ...rows.heads.map((h) => h.box),
3699
3672
  ...rows.notes.map((n) => n.box),
3700
3673
  ...rows.fragments.map((f) => f.box),
@@ -4921,15 +4894,7 @@ function diagramBounds(specs, extra) {
4921
4894
  for (const p of [...edge?.waypoints ?? [], ...edge?.route ?? []]) boxes.push({ x: p.x, y: p.y, width: 0, height: 0 });
4922
4895
  }
4923
4896
  if (extra !== void 0) boxes.push(extra);
4924
- if (boxes.length === 0) return null;
4925
- const x = Math.min(...boxes.map((b) => b.x));
4926
- const y = Math.min(...boxes.map((b) => b.y));
4927
- return {
4928
- x,
4929
- y,
4930
- width: Math.max(...boxes.map((b) => b.x + b.width)) - x,
4931
- height: Math.max(...boxes.map((b) => b.y + b.height)) - y
4932
- };
4897
+ return unionRects(boxes);
4933
4898
  }
4934
4899
  function fitDiagram(specs, size, fit = {}, extra) {
4935
4900
  const bounds = diagramBounds(specs, extra);
@@ -4949,9 +4914,8 @@ function diagramViewBounds(specs, padding, extra) {
4949
4914
  var IDENTITY = { x: 0, y: 0, scale: { x: 1, y: 1 } };
4950
4915
  var sameView = (a, b) => a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y;
4951
4916
  function inView(inner, view, size) {
4952
- const x1 = view.x + size.width / view.scale.x;
4953
- const y1 = view.y + size.height / view.scale.y;
4954
- return inner.x >= view.x && inner.y >= view.y && inner.x + inner.width <= x1 && inner.y + inner.height <= y1;
4917
+ const shown = viewportWorldRect(view, size);
4918
+ return inner.x >= shown.x && inner.y >= shown.y && inner.x + inner.width <= shown.x + shown.width && inner.y + inner.height <= shown.y + shown.height;
4955
4919
  }
4956
4920
  function useDiagramFit(args) {
4957
4921
  const { canvasRef, specs, controlled, size, fit, extra } = args;
@@ -5058,6 +5022,7 @@ function Inner({
5058
5022
  bounded,
5059
5023
  refit,
5060
5024
  background,
5025
+ animator,
5061
5026
  pages,
5062
5027
  view,
5063
5028
  onViewChange,
@@ -5172,24 +5137,27 @@ function Inner({
5172
5137
  scene,
5173
5138
  selection,
5174
5139
  features,
5175
- ...resizes ? { selectTool } : {},
5176
- ...textEditor ? { textEditor } : {},
5177
5140
  enableKeybindings: enableKeybindings ?? edits,
5178
5141
  ambient,
5179
5142
  actions: editing.actions,
5180
- ...tools ? { tools } : {},
5181
- ...onToolsCreated ? { onToolsCreated } : {},
5182
5143
  onClick,
5183
- ...onHover ? { onHover } : {},
5184
5144
  width,
5185
5145
  height,
5186
- ...fills ? { onResize: setMeasured } : {},
5187
- ...defaultView ? { defaultView } : {},
5188
- ...view ? { view } : {},
5189
- ...onViewChange ? { onViewChange } : {},
5190
- ...viewBounds ? { viewBounds } : {},
5191
- ...background ? { backgroundFill: background } : {},
5192
- ...layers ? { layers } : {},
5146
+ ...setOnly({
5147
+ selectTool: resizes ? selectTool : void 0,
5148
+ textEditor,
5149
+ tools,
5150
+ onToolsCreated,
5151
+ onHover,
5152
+ onResize: fills ? setMeasured : void 0,
5153
+ defaultView,
5154
+ view,
5155
+ onViewChange,
5156
+ viewBounds,
5157
+ backgroundFill: background,
5158
+ animator,
5159
+ layers
5160
+ }),
5193
5161
  children: /* @__PURE__ */ jsx(DropRules, { scene, canReparent })
5194
5162
  }
5195
5163
  ),
@@ -5200,6 +5168,11 @@ function Inner({
5200
5168
  ] });
5201
5169
  }
5202
5170
  var NO_OVERLAYS = [];
5171
+ function setOnly(props) {
5172
+ const out = {};
5173
+ for (const [key, value] of Object.entries(props)) if (value !== void 0 && value !== null) out[key] = value;
5174
+ return out;
5175
+ }
5203
5176
  function useRegisteredLayers(canvasRef, layers) {
5204
5177
  useEffect(() => {
5205
5178
  const canvas = canvasRef.current;
@@ -5240,7 +5213,7 @@ function useDiagramApi(apiRef, canvasRef, scene, live, setRun, fitNow) {
5240
5213
  const world = worldRectOf(scene, id);
5241
5214
  const r = canvas?.element?.getBoundingClientRect();
5242
5215
  if (canvas == null || world === null || r === void 0) return null;
5243
- const rect = screenRectOf(world, canvas.getView());
5216
+ const rect = viewRectToScreen(canvas.getView(), world);
5244
5217
  return { ...rect, x: rect.x + r.left, y: rect.y + r.top };
5245
5218
  },
5246
5219
  subscribeFrame: (fn) => canvasRef.current?.subscribeFrame(() => fn()) ?? (() => {
@@ -5248,6 +5221,6 @@ function useDiagramApi(apiRef, canvasRef, scene, live, setRun, fitNow) {
5248
5221
  }), [canvasRef, live, scene, setRun, fitNow]);
5249
5222
  }
5250
5223
 
5251
- export { ADD_LANE_ACTION_ID, ANYWHERE, CONNECT_ACTION_ID, CONTAINERS_GROUP, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DIAGRAM_ITEM_CARRY, DiagramView, EASED_LAYOUTS, EDGE_END_AFFORDANCE_KIND, EDGE_END_LAYER_ID, EDIT_CONTAINER_TITLE_ACTION_ID, GRAB_EDGE_END_ACTION_ID, GRAB_LABEL_ACTION_ID, GRAB_PORT_ACTION_ID, GRAB_SEQUENCE_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, ITEM_DROP_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID, MOVE_LABEL_ACTION_ID, PORT_AFFORDANCE_KIND, PORT_LAYER_ID, RECONNECT_ACTION_ID, RELEASE_MEMBERS_ACTION_ID, REMOVE_WAYPOINT_ACTION_ID, REORDER_ACTION_ID, RESET_LABEL_ACTION_ID, RESET_ROUTE_ACTION_ID, ROUTER_LABELS, ROUTE_EDIT_ACTION_ID, SELECT_LABEL_EDGE_ACTION_ID, SELECT_SEQUENCE_PART_ACTION_ID, SEQ, SEQUENCE_AFFORDANCE_KIND, SEQUENCE_DRAG_ACTION_ID, SEQUENCE_LAYER_ID, SEQUENCE_ROLES, SEQ_ARROWS, SEQ_MULTI_SECTION, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addBox, addLane, addParticipant, addSection, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, commitSequence, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createItemDropAction, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSequenceDeleteAction, createSequenceDragAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramSequence, diagramShape, diagramWaypoints, dragItemProps, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, edgePolylines, editContainerTitleAction, editContainerTitleBinding, findStep, foldSequenceText, forceProducer, freshSeqId, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, hopDataOps, inOrUnder, insertMark, insertMessage, insertNote, insertStep, insertWaypoint, isBodyEnd, isBodyOrRegion, isDiagramBody, isSequenceText, itemDropContribution, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, moveParticipant, moveStep, movedLabelData, newParticipant, pinSegment, placeOf, placedSequences, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, reconnectMessage, redrawSequences, regionHeaderAt, registerDiagramShape, releaseMembers, removeBox, removeMarks, removeMarksOf, removeParticipant, removeSection, removeSegment, removeStep, removeStepAt, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routedData, routerActions, sceneEdges, sceneParticipants, segmentAxis, selectSequencePartAction, seqIdTaken, sequenceCommitOf, sequenceDeletes, sequenceLayout, sequencePartNodeOf, sequencePartOf, sequenceRootOf, sequenceScratchOf, sequenceSlots, sequenceSpecs, sequenceTextOf, setAutonumber, setFragmentType, setMessageActivation, setMessageArrow, setParticipantOutline, setSequenceText, startItemDrag, startSequence, stepListOf, themeWrites, unpinSegment, unwrapFragment, useLiveLayout, useMirroredSelection, useSequenceTextEdit, waypointLayer, waypointScratchOf, withHopsData, withRouter, worldWith, wrapSteps };
5252
- //# sourceMappingURL=chunk-EIHPPOAM.js.map
5253
- //# sourceMappingURL=chunk-EIHPPOAM.js.map
5224
+ export { ADD_LANE_ACTION_ID, ANYWHERE, CONNECT_ACTION_ID, CONTAINERS_GROUP, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DIAGRAM_ITEM_CARRY, DiagramView, EASED_LAYOUTS, EDGE_END_AFFORDANCE_KIND, EDGE_END_LAYER_ID, EDIT_CONTAINER_TITLE_ACTION_ID, GRAB_EDGE_END_ACTION_ID, GRAB_LABEL_ACTION_ID, GRAB_PORT_ACTION_ID, GRAB_SEQUENCE_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, ITEM_DROP_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID, MOVE_LABEL_ACTION_ID, PORT_AFFORDANCE_KIND, PORT_LAYER_ID, RECONNECT_ACTION_ID, RELEASE_MEMBERS_ACTION_ID, REMOVE_WAYPOINT_ACTION_ID, REORDER_ACTION_ID, RESET_LABEL_ACTION_ID, RESET_ROUTE_ACTION_ID, ROUTER_LABELS, ROUTE_EDIT_ACTION_ID, SELECT_LABEL_EDGE_ACTION_ID, SELECT_SEQUENCE_PART_ACTION_ID, SEQ, SEQUENCE_AFFORDANCE_KIND, SEQUENCE_DRAG_ACTION_ID, SEQUENCE_LAYER_ID, SEQUENCE_ROLES, SEQ_ARROWS, SEQ_MULTI_SECTION, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addBox, addLane, addParticipant, addSection, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, commitSequence, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createItemDropAction, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSequenceDeleteAction, createSequenceDragAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramSequence, diagramShape, diagramWaypoints, dragItemProps, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, edgePolylines, editContainerTitleAction, editContainerTitleBinding, findStep, foldSequenceText, forceProducer, freshSeqId, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, hopDataOps, inOrUnder, insertMark, insertMessage, insertNote, insertStep, insertWaypoint, isBodyEnd, isBodyOrRegion, isDiagramBody, isSequenceText, itemDropContribution, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, moveParticipant, moveStep, movedLabelData, newParticipant, pinSegment, placeOf, placedSequences, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, reconnectMessage, redrawSequences, regionHeaderAt, registerDiagramShape, releaseMembers, removeBox, removeMarks, removeMarksOf, removeParticipant, removeSection, removeSegment, removeStep, removeStepAt, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routedData, routerActions, sameList, sceneEdges, sceneParticipants, segmentAxis, selectSequencePartAction, seqIdTaken, sequenceCommitOf, sequenceDeletes, sequenceLayout, sequencePartNodeOf, sequencePartOf, sequenceRootOf, sequenceScratchOf, sequenceSlots, sequenceSpecs, sequenceTextOf, setAutonumber, setFragmentType, setMessageActivation, setMessageArrow, setParticipantOutline, setSequenceText, startItemDrag, startSequence, stepListOf, themeWrites, unpinSegment, unwrapFragment, useLiveLayout, useMirroredSelection, useSequenceTextEdit, waypointLayer, waypointScratchOf, withHopsData, withRouter, worldWith, wrapSteps };
5225
+ //# sourceMappingURL=chunk-6EZFP3SG.js.map
5226
+ //# sourceMappingURL=chunk-6EZFP3SG.js.map