@statelyai/flow-dom 3.5.0 → 3.5.2
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/esm/index.js +24 -26
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -497,15 +497,14 @@ function createEntityGeometryObserver(store, options = {}) {
|
|
|
497
497
|
});
|
|
498
498
|
const first = pathData.segments[0]?.points[0];
|
|
499
499
|
const last = pathData.segments.at(-1)?.points.at(-1);
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
targetElement?.setAttribute("cy", String(last.y));
|
|
500
|
+
for (const [end, point] of [["source", first], ["target", last]]) {
|
|
501
|
+
if (!point) continue;
|
|
502
|
+
element.querySelectorAll(`[data-flow-edge-endpoint="${end}"]`).forEach((handle) => {
|
|
503
|
+
const x = Number(handle.dataset.flowEdgeEndpointOffsetX ?? 0);
|
|
504
|
+
const y = Number(handle.dataset.flowEdgeEndpointOffsetY ?? 0);
|
|
505
|
+
handle.setAttribute("cx", String(point.x + (Number.isFinite(x) ? x : 0)));
|
|
506
|
+
handle.setAttribute("cy", String(point.y + (Number.isFinite(y) ? y : 0)));
|
|
507
|
+
});
|
|
509
508
|
}
|
|
510
509
|
});
|
|
511
510
|
},
|
|
@@ -708,18 +707,18 @@ function attachViewportTransform(store, element, options = {}) {
|
|
|
708
707
|
}, promoteIdleMs);
|
|
709
708
|
};
|
|
710
709
|
writeTransform(prevViewport);
|
|
711
|
-
if (prevState
|
|
710
|
+
if (prevState === "panning") promote();
|
|
712
711
|
const subscription = store.subscribe((snapshot) => {
|
|
713
712
|
const context = snapshot.context;
|
|
714
713
|
if (context.viewport !== prevViewport) {
|
|
715
714
|
prevViewport = context.viewport;
|
|
716
715
|
writeTransform(context.viewport);
|
|
717
716
|
promote();
|
|
718
|
-
if (context.canvasState
|
|
717
|
+
if (context.canvasState !== "panning") scheduleClear();
|
|
719
718
|
}
|
|
720
719
|
if (context.canvasState !== prevState) {
|
|
721
720
|
prevState = context.canvasState;
|
|
722
|
-
if (prevState
|
|
721
|
+
if (prevState === "panning") promote();
|
|
723
722
|
else scheduleClear();
|
|
724
723
|
}
|
|
725
724
|
});
|
|
@@ -737,6 +736,7 @@ function attachInput(options) {
|
|
|
737
736
|
const keyboardTarget = options.keyboardTarget ?? "container";
|
|
738
737
|
const keyboardElement = keyboardTarget === "window" ? win : keyboardTarget === "container" ? container : keyboardTarget;
|
|
739
738
|
let capturedPointerId = null;
|
|
739
|
+
let pointerCaptureOwner = {};
|
|
740
740
|
let gestureContainerOffset = null;
|
|
741
741
|
let lastContainerOffset = null;
|
|
742
742
|
let lastClient = null;
|
|
@@ -886,6 +886,7 @@ function attachInput(options) {
|
|
|
886
886
|
container.setPointerCapture(info.pointerId);
|
|
887
887
|
} catch {}
|
|
888
888
|
capturedPointerId = info.pointerId;
|
|
889
|
+
pointerCaptureOwner = {};
|
|
889
890
|
gestureContainerOffset = lastContainerOffset ?? (() => {
|
|
890
891
|
const rect = container.getBoundingClientRect();
|
|
891
892
|
return {
|
|
@@ -895,15 +896,7 @@ function attachInput(options) {
|
|
|
895
896
|
})();
|
|
896
897
|
scheduleAutoPan();
|
|
897
898
|
}
|
|
898
|
-
if (effects.sessionEnded && capturedPointerId !== null)
|
|
899
|
-
try {
|
|
900
|
-
if (container.hasPointerCapture(capturedPointerId)) container.releasePointerCapture(capturedPointerId);
|
|
901
|
-
} catch {}
|
|
902
|
-
capturedPointerId = null;
|
|
903
|
-
gestureContainerOffset = null;
|
|
904
|
-
lastClient = null;
|
|
905
|
-
stopAutoPan();
|
|
906
|
-
}
|
|
899
|
+
if (effects.sessionEnded && capturedPointerId !== null) releaseCapturedPointer();
|
|
907
900
|
return effects;
|
|
908
901
|
}
|
|
909
902
|
function touchPoints() {
|
|
@@ -952,10 +945,11 @@ function attachInput(options) {
|
|
|
952
945
|
}
|
|
953
946
|
function releaseCapturedPointer() {
|
|
954
947
|
if (capturedPointerId === null) return;
|
|
948
|
+
const pointerId = capturedPointerId;
|
|
949
|
+
capturedPointerId = null;
|
|
955
950
|
try {
|
|
956
|
-
if (container.hasPointerCapture(
|
|
951
|
+
if (container.hasPointerCapture(pointerId)) container.releasePointerCapture(pointerId);
|
|
957
952
|
} catch {}
|
|
958
|
-
capturedPointerId = null;
|
|
959
953
|
gestureContainerOffset = null;
|
|
960
954
|
lastClient = null;
|
|
961
955
|
stopAutoPan();
|
|
@@ -1065,19 +1059,23 @@ function attachInput(options) {
|
|
|
1065
1059
|
}
|
|
1066
1060
|
function handleKey(kind) {
|
|
1067
1061
|
return (event) => {
|
|
1068
|
-
|
|
1062
|
+
const previousCaptureOwner = pointerCaptureOwner;
|
|
1063
|
+
const effects = runtime.send({
|
|
1069
1064
|
kind,
|
|
1070
1065
|
key: event.key,
|
|
1071
1066
|
editableTarget: isEditableTarget(event.target),
|
|
1072
1067
|
modifiers: modifiers(event)
|
|
1073
|
-
})
|
|
1068
|
+
});
|
|
1069
|
+
if (effects.sessionEnded && pointerCaptureOwner === previousCaptureOwner) releaseCapturedPointer();
|
|
1070
|
+
applyEffects(event, effects);
|
|
1074
1071
|
};
|
|
1075
1072
|
}
|
|
1076
1073
|
const onPointerDown = handlePointer("pointer.down");
|
|
1077
1074
|
const onPointerMove = handlePointer("pointer.move");
|
|
1078
1075
|
const onPointerUp = handlePointer("pointer.up");
|
|
1079
1076
|
const onPointerCancel = handlePointer("pointer.cancel");
|
|
1080
|
-
const onLostPointerCapture = () => {
|
|
1077
|
+
const onLostPointerCapture = (event) => {
|
|
1078
|
+
if (capturedPointerId === null || capturedPointerId !== event.pointerId) return;
|
|
1081
1079
|
stopAutoPan();
|
|
1082
1080
|
runtime.cancelSession();
|
|
1083
1081
|
capturedPointerId = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statelyai/flow-dom",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
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.
|
|
30
|
+
"@statelyai/flow": "0.13.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@vitest/coverage-v8": "^4.1.0",
|