@statelyai/flow-dom 3.4.4 → 3.4.6

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 (2) hide show
  1. package/dist/esm/index.js +16 -11
  2. package/package.json +2 -2
package/dist/esm/index.js CHANGED
@@ -414,13 +414,22 @@ function createEntityGeometryObserver(store, options = {}) {
414
414
  });
415
415
  },
416
416
  observeEdge(element, target) {
417
+ const inferredSegments = /* @__PURE__ */ new WeakMap();
417
418
  return observe(target.id, () => {
418
419
  const pathData = target.getPathData();
419
420
  if (!pathData) return;
420
- element.querySelectorAll("[data-flow-edge-segment]").forEach((path) => {
421
- const index = Number(path.dataset.flowEdgeSegment);
422
- const segment = pathData.segments[index];
423
- if (segment) path.setAttribute("d", pathToSVG(segment));
421
+ const svgSegments = pathData.segments.map(pathToSVG);
422
+ element.querySelectorAll("path").forEach((path) => {
423
+ const explicitIndex = path.dataset.flowEdgeSegment;
424
+ let index = explicitIndex === void 0 ? inferredSegments.get(path) : Number(explicitIndex);
425
+ if (index === void 0) {
426
+ const matchedIndex = svgSegments.indexOf(path.getAttribute("d") ?? "");
427
+ if (matchedIndex < 0) return;
428
+ index = matchedIndex;
429
+ inferredSegments.set(path, index);
430
+ }
431
+ const segment = svgSegments[index];
432
+ if (segment !== void 0) path.setAttribute("d", segment);
424
433
  });
425
434
  const first = pathData.segments[0]?.points[0];
426
435
  const last = pathData.segments.at(-1)?.points.at(-1);
@@ -682,12 +691,7 @@ function attachInput(options) {
682
691
  sendPointer("pointer.move", lastClient.x, lastClient.y, {
683
692
  pointerId: lastClient.pointerId,
684
693
  button: -1,
685
- modifiers: {
686
- shift: false,
687
- meta: false,
688
- ctrl: false,
689
- alt: false
690
- },
694
+ modifiers: lastClient.modifiers,
691
695
  target: null
692
696
  });
693
697
  }
@@ -925,7 +929,8 @@ function attachInput(options) {
925
929
  if (kind === "pointer.down" || capturedPointerId !== null && event.pointerId === capturedPointerId) lastClient = {
926
930
  x: event.clientX,
927
931
  y: event.clientY,
928
- pointerId: event.pointerId
932
+ pointerId: event.pointerId,
933
+ modifiers: modifiers(event)
929
934
  };
930
935
  const detail = kind === "pointer.down" && event.button === 0 ? computeClickDetail(event) : event.detail;
931
936
  applyEffects(event, sendPointer(kind, event.clientX, event.clientY, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/flow-dom",
3
- "version": "3.4.4",
3
+ "version": "3.4.6",
4
4
  "description": "DOM-specific helpers for @statelyai/flow with core re-exports.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@statelyai/flow": "0.9.1"
30
+ "@statelyai/flow": "0.11.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@vitest/coverage-v8": "^4.1.0",