@infinit-canvas/react 0.1.5 → 0.1.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.
- package/dist/react-infinite-canvas.cjs +2 -2
- package/dist/react-infinite-canvas.js +539 -538
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as S, jsxs as $t, Fragment as
|
|
2
|
-
import { useRef as tt, useState as Gt, useMemo as St, useEffect as
|
|
1
|
+
import { jsx as S, jsxs as $t, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as tt, useState as Gt, useMemo as St, useEffect as ft, useCallback as F, useContext as qe, createContext as Fn, memo as Zt, useLayoutEffect as kr } from "react";
|
|
3
3
|
import { createPortal as Yn } from "react-dom";
|
|
4
4
|
const Un = 160, qn = 60;
|
|
5
5
|
function ho(t) {
|
|
@@ -949,8 +949,8 @@ function Cr(t, e) {
|
|
|
949
949
|
const s = { worker: r };
|
|
950
950
|
return mn.set(t, s), s;
|
|
951
951
|
}
|
|
952
|
-
const Vt = 160, jt = 60,
|
|
953
|
-
function
|
|
952
|
+
const Vt = 160, jt = 60, Lr = 10;
|
|
953
|
+
function Nr({
|
|
954
954
|
cards: t = [],
|
|
955
955
|
nodes: e = [],
|
|
956
956
|
edges: n = [],
|
|
@@ -967,7 +967,7 @@ function Lr({
|
|
|
967
967
|
onEdgeDoubleClick: z,
|
|
968
968
|
onEdgeMouseEnter: M,
|
|
969
969
|
onEdgeMouseMove: $,
|
|
970
|
-
onEdgeMouseLeave:
|
|
970
|
+
onEdgeMouseLeave: R,
|
|
971
971
|
onEdgeContextMenu: E,
|
|
972
972
|
onNodeDoubleClick: _,
|
|
973
973
|
onNodeMouseEnter: D,
|
|
@@ -975,32 +975,32 @@ function Lr({
|
|
|
975
975
|
onNodeMouseLeave: f,
|
|
976
976
|
onNodeContextMenu: p,
|
|
977
977
|
onPaneClick: v,
|
|
978
|
-
onPaneContextMenu:
|
|
978
|
+
onPaneContextMenu: L,
|
|
979
979
|
onPaneMouseEnter: w,
|
|
980
980
|
onPaneMouseMove: P,
|
|
981
|
-
onPaneMouseLeave:
|
|
981
|
+
onPaneMouseLeave: k,
|
|
982
982
|
onSelectionChange: B,
|
|
983
|
-
onConnectStart:
|
|
983
|
+
onConnectStart: j,
|
|
984
984
|
onConnectEnd: X,
|
|
985
|
-
onInit:
|
|
986
|
-
onMoveStart:
|
|
985
|
+
onInit: xt,
|
|
986
|
+
onMoveStart: K,
|
|
987
987
|
onMove: rt,
|
|
988
|
-
onMoveEnd:
|
|
989
|
-
onDelete:
|
|
990
|
-
onBeforeDelete:
|
|
991
|
-
onError:
|
|
992
|
-
isValidConnection:
|
|
993
|
-
dark:
|
|
988
|
+
onMoveEnd: q,
|
|
989
|
+
onDelete: G,
|
|
990
|
+
onBeforeDelete: ot,
|
|
991
|
+
onError: lt,
|
|
992
|
+
isValidConnection: ut,
|
|
993
|
+
dark: st,
|
|
994
994
|
gridSize: It = 40,
|
|
995
|
-
zoomMin:
|
|
996
|
-
zoomMax:
|
|
997
|
-
initialCamera:
|
|
998
|
-
fitView:
|
|
999
|
-
fitViewOptions:
|
|
1000
|
-
nodesDraggable:
|
|
995
|
+
zoomMin: it = 0.1,
|
|
996
|
+
zoomMax: mt = 4,
|
|
997
|
+
initialCamera: Lt = { x: 0, y: 0, zoom: 1 },
|
|
998
|
+
fitView: zt = !1,
|
|
999
|
+
fitViewOptions: dt,
|
|
1000
|
+
nodesDraggable: ht = !0,
|
|
1001
1001
|
nodesConnectable: Rt = !0,
|
|
1002
|
-
elementsSelectable:
|
|
1003
|
-
multiSelectionKeyCode:
|
|
1002
|
+
elementsSelectable: Nt = !0,
|
|
1003
|
+
multiSelectionKeyCode: gt = "Shift",
|
|
1004
1004
|
selectionOnDrag: ne = !1,
|
|
1005
1005
|
selectionMode: Ie = "partial",
|
|
1006
1006
|
connectionMode: Bt = "loose",
|
|
@@ -1023,11 +1023,11 @@ function Lr({
|
|
|
1023
1023
|
autoPanOnNodeDrag: dn = !0,
|
|
1024
1024
|
autoPanOnConnect: fn = !0,
|
|
1025
1025
|
autoPanSpeed: Qt = 5,
|
|
1026
|
-
edgesReconnectable:
|
|
1026
|
+
edgesReconnectable: Ln = !1,
|
|
1027
1027
|
elevateNodesOnSelect: hn = !1,
|
|
1028
1028
|
edgeRouting: fe = !0
|
|
1029
1029
|
} = {}) {
|
|
1030
|
-
const
|
|
1030
|
+
const vt = tt(null), Te = tt(null), Et = tt(null), pt = tt({ ...Lt }), se = tt([...t]), Z = tt([...e]), Pt = tt([...n]), yn = tt(/* @__PURE__ */ new Map()), Se = tt(!1), te = tt(null), [gn, pn] = Gt(!1), _t = tt(null), Wt = tt(null), Me = tt(null), ie = tt(null), Ut = tt(!1), Re = tt(null), [Be, Je] = Gt({ x: Lt.x, y: Lt.y, zoom: Lt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = tt(!1), O = tt({});
|
|
1031
1031
|
O.current = {
|
|
1032
1032
|
onHudUpdate: r,
|
|
1033
1033
|
onNodesProcessed: s,
|
|
@@ -1042,7 +1042,7 @@ function Lr({
|
|
|
1042
1042
|
onEdgeDoubleClick: z,
|
|
1043
1043
|
onEdgeMouseEnter: M,
|
|
1044
1044
|
onEdgeMouseMove: $,
|
|
1045
|
-
onEdgeMouseLeave:
|
|
1045
|
+
onEdgeMouseLeave: R,
|
|
1046
1046
|
onEdgeContextMenu: E,
|
|
1047
1047
|
onNodeDoubleClick: _,
|
|
1048
1048
|
onNodeMouseEnter: D,
|
|
@@ -1050,21 +1050,21 @@ function Lr({
|
|
|
1050
1050
|
onNodeMouseLeave: f,
|
|
1051
1051
|
onNodeContextMenu: p,
|
|
1052
1052
|
onPaneClick: v,
|
|
1053
|
-
onPaneContextMenu:
|
|
1053
|
+
onPaneContextMenu: L,
|
|
1054
1054
|
onPaneMouseEnter: w,
|
|
1055
1055
|
onPaneMouseMove: P,
|
|
1056
|
-
onPaneMouseLeave:
|
|
1056
|
+
onPaneMouseLeave: k,
|
|
1057
1057
|
onSelectionChange: B,
|
|
1058
|
-
onConnectStart:
|
|
1058
|
+
onConnectStart: j,
|
|
1059
1059
|
onConnectEnd: X,
|
|
1060
|
-
onInit:
|
|
1061
|
-
onMoveStart:
|
|
1060
|
+
onInit: xt,
|
|
1061
|
+
onMoveStart: K,
|
|
1062
1062
|
onMove: rt,
|
|
1063
|
-
onMoveEnd:
|
|
1064
|
-
onDelete:
|
|
1065
|
-
onBeforeDelete:
|
|
1066
|
-
onError:
|
|
1067
|
-
isValidConnection:
|
|
1063
|
+
onMoveEnd: q,
|
|
1064
|
+
onDelete: G,
|
|
1065
|
+
onBeforeDelete: ot,
|
|
1066
|
+
onError: lt,
|
|
1067
|
+
isValidConnection: ut
|
|
1068
1068
|
};
|
|
1069
1069
|
const bt = { get current() {
|
|
1070
1070
|
return O.current.onNodesChange;
|
|
@@ -1091,23 +1091,23 @@ function Lr({
|
|
|
1091
1091
|
} }, pe = { get current() {
|
|
1092
1092
|
return O.current.onNodesProcessed;
|
|
1093
1093
|
} };
|
|
1094
|
-
|
|
1094
|
+
ft(() => {
|
|
1095
1095
|
const a = (d) => {
|
|
1096
|
-
d.key ===
|
|
1096
|
+
d.key === gt && (Ut.current = !0), d.key === we && (ke.current = !0);
|
|
1097
1097
|
}, x = (d) => {
|
|
1098
|
-
d.key ===
|
|
1098
|
+
d.key === gt && (Ut.current = !1), d.key === we && (ke.current = !1);
|
|
1099
1099
|
};
|
|
1100
1100
|
return window.addEventListener("keydown", a), window.addEventListener("keyup", x), () => {
|
|
1101
1101
|
window.removeEventListener("keydown", a), window.removeEventListener("keyup", x);
|
|
1102
1102
|
};
|
|
1103
|
-
}, [
|
|
1103
|
+
}, [gt, we]);
|
|
1104
1104
|
const Jt = F(() => {
|
|
1105
1105
|
var b;
|
|
1106
|
-
const a = Z.current.filter((
|
|
1106
|
+
const a = Z.current.filter((N) => N.selected), x = Pt.current.filter((N) => N.selected), d = { nodes: a, edges: x };
|
|
1107
1107
|
(b = ye.current) == null || b.call(ye, d);
|
|
1108
|
-
for (const
|
|
1108
|
+
for (const N of he) N(d);
|
|
1109
1109
|
}, [he]);
|
|
1110
|
-
|
|
1110
|
+
ft(() => {
|
|
1111
1111
|
var a;
|
|
1112
1112
|
se.current = [...t], (a = Et.current) == null || a.postMessage({ type: "cards", data: { cards: [...t] } });
|
|
1113
1113
|
}, [t]);
|
|
@@ -1118,10 +1118,10 @@ function Lr({
|
|
|
1118
1118
|
if (!d.parentId) return d;
|
|
1119
1119
|
const b = x[d.parentId];
|
|
1120
1120
|
if (!b) return d;
|
|
1121
|
-
let
|
|
1121
|
+
let N = d.position.x, I = d.position.y, h = b;
|
|
1122
1122
|
for (; h; )
|
|
1123
|
-
|
|
1124
|
-
return { ...d, _absolutePosition: { x:
|
|
1123
|
+
N += h.position.x, I += h.position.y, h = h.parentId ? x[h.parentId] : null;
|
|
1124
|
+
return { ...d, _absolutePosition: { x: N, y: I } };
|
|
1125
1125
|
});
|
|
1126
1126
|
}, []), ee = tt([]), Q = F((a) => {
|
|
1127
1127
|
const x = yn.current;
|
|
@@ -1130,8 +1130,8 @@ function Lr({
|
|
|
1130
1130
|
for (const [, b] of x)
|
|
1131
1131
|
d[b.nodeId] || (d[b.nodeId] = []), d[b.nodeId].push({ id: b.id, type: b.type, position: b.position, x: b.x, y: b.y });
|
|
1132
1132
|
return a.map((b) => {
|
|
1133
|
-
const
|
|
1134
|
-
return
|
|
1133
|
+
const N = d[b.id];
|
|
1134
|
+
return N && N.length > 0 ? { ...b, handles: N } : b;
|
|
1135
1135
|
});
|
|
1136
1136
|
}, []), Ft = F(() => {
|
|
1137
1137
|
var x;
|
|
@@ -1139,12 +1139,12 @@ function Lr({
|
|
|
1139
1139
|
const a = Q(ee.current);
|
|
1140
1140
|
(x = Et.current) == null || x.postMessage({ type: "nodes", data: { nodes: a } });
|
|
1141
1141
|
}, [Q]);
|
|
1142
|
-
|
|
1142
|
+
ft(() => {
|
|
1143
1143
|
var d;
|
|
1144
1144
|
if (_t.current) {
|
|
1145
|
-
const b = _t.current.id,
|
|
1145
|
+
const b = _t.current.id, N = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((h) => h.id)]), I = {};
|
|
1146
1146
|
for (const h of Z.current)
|
|
1147
|
-
|
|
1147
|
+
N.has(h.id) && (I[h.id] = { ...h.position });
|
|
1148
1148
|
Z.current = [...e];
|
|
1149
1149
|
for (const h of Z.current)
|
|
1150
1150
|
I[h.id] && (h.position = I[h.id]);
|
|
@@ -1156,23 +1156,23 @@ function Lr({
|
|
|
1156
1156
|
ee.current = a;
|
|
1157
1157
|
const x = Q(a);
|
|
1158
1158
|
(d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: x } });
|
|
1159
|
-
}, [e, ze, Q]),
|
|
1159
|
+
}, [e, ze, Q]), ft(() => {
|
|
1160
1160
|
var a;
|
|
1161
1161
|
Pt.current = [...n], (a = Et.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
|
|
1162
1162
|
}, [n]);
|
|
1163
|
-
const
|
|
1164
|
-
const d =
|
|
1163
|
+
const at = F((a, x) => {
|
|
1164
|
+
const d = vt.current;
|
|
1165
1165
|
if (!d) return { x: 0, y: 0 };
|
|
1166
|
-
const b = d.getBoundingClientRect(),
|
|
1166
|
+
const b = d.getBoundingClientRect(), N = pt.current;
|
|
1167
1167
|
return {
|
|
1168
|
-
x: (a - b.left -
|
|
1169
|
-
y: (x - b.top -
|
|
1168
|
+
x: (a - b.left - N.x) / N.zoom,
|
|
1169
|
+
y: (x - b.top - N.y) / N.zoom
|
|
1170
1170
|
};
|
|
1171
1171
|
}, []), Tt = F((a, x) => {
|
|
1172
1172
|
const d = ee.current.length > 0 ? ee.current : Z.current;
|
|
1173
1173
|
let b = null;
|
|
1174
|
-
for (let
|
|
1175
|
-
const I = d[
|
|
1174
|
+
for (let N = d.length - 1; N >= 0; N--) {
|
|
1175
|
+
const I = d[N];
|
|
1176
1176
|
if (I.hidden) continue;
|
|
1177
1177
|
const h = I._absolutePosition || I.position, A = I.width || Vt, T = I.height || jt;
|
|
1178
1178
|
if (a >= h.x && a <= h.x + A && x >= h.y && x <= h.y + T) {
|
|
@@ -1203,39 +1203,39 @@ function Lr({
|
|
|
1203
1203
|
}, []), Ee = F((a) => {
|
|
1204
1204
|
const x = a.width || Vt, d = a.height || jt;
|
|
1205
1205
|
return a.handles && a.handles.length > 0 ? a.handles.map((b) => {
|
|
1206
|
-
const
|
|
1207
|
-
return { id: b.id || null, type: b.type, x:
|
|
1206
|
+
const N = xe(b, a);
|
|
1207
|
+
return { id: b.id || null, type: b.type, x: N.x, y: N.y };
|
|
1208
1208
|
}) : [
|
|
1209
1209
|
{ id: null, type: "target", x: a.position.x, y: a.position.y + d / 2 },
|
|
1210
1210
|
{ id: null, type: "source", x: a.position.x + x, y: a.position.y + d / 2 }
|
|
1211
1211
|
];
|
|
1212
1212
|
}, [xe]), tn = F((a, x) => {
|
|
1213
|
-
const d = Z.current, b = pt.current,
|
|
1213
|
+
const d = Z.current, b = pt.current, N = Math.max(Lr, Ot) / b.zoom;
|
|
1214
1214
|
for (let I = d.length - 1; I >= 0; I--) {
|
|
1215
1215
|
const h = d[I];
|
|
1216
1216
|
if (h.hidden) continue;
|
|
1217
1217
|
const A = Ee(h);
|
|
1218
1218
|
for (const T of A)
|
|
1219
|
-
if (Math.abs(a - T.x) <
|
|
1219
|
+
if (Math.abs(a - T.x) < N && Math.abs(x - T.y) < N)
|
|
1220
1220
|
return { nodeId: h.id, handleId: T.id, type: T.type, x: T.x, y: T.y };
|
|
1221
1221
|
}
|
|
1222
1222
|
return null;
|
|
1223
1223
|
}, [Ee]), ue = F((a, x) => {
|
|
1224
1224
|
const b = 8 / pt.current.zoom;
|
|
1225
|
-
for (let
|
|
1226
|
-
const I = Pt.current[
|
|
1225
|
+
for (let N = Pt.current.length - 1; N >= 0; N--) {
|
|
1226
|
+
const I = Pt.current[N], h = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
|
|
1227
1227
|
if (!h || !A) continue;
|
|
1228
|
-
const T = h.width || Vt, Y = h.height || jt, H = A.height || jt, J = h.position.x + T,
|
|
1229
|
-
if (Ir(a, x, J,
|
|
1228
|
+
const T = h.width || Vt, Y = h.height || jt, H = A.height || jt, J = h.position.x + T, ct = h.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
|
|
1229
|
+
if (Ir(a, x, J, ct, U, nt) < b) return I;
|
|
1230
1230
|
}
|
|
1231
1231
|
return null;
|
|
1232
1232
|
}, []);
|
|
1233
|
-
|
|
1234
|
-
const a = Te.current, x =
|
|
1233
|
+
ft(() => {
|
|
1234
|
+
const a = Te.current, x = vt.current;
|
|
1235
1235
|
if (!a || !x) return;
|
|
1236
|
-
const d = x.getBoundingClientRect(), b =
|
|
1237
|
-
ee.current =
|
|
1238
|
-
const I = Q(
|
|
1236
|
+
const d = x.getBoundingClientRect(), b = st !== void 0 ? st : matchMedia("(prefers-color-scheme: dark)").matches, N = ze(Z.current);
|
|
1237
|
+
ee.current = N;
|
|
1238
|
+
const I = Q(N), { worker: h } = Cr(a, {
|
|
1239
1239
|
width: d.width,
|
|
1240
1240
|
height: d.height,
|
|
1241
1241
|
camera: pt.current,
|
|
@@ -1247,30 +1247,30 @@ function Lr({
|
|
|
1247
1247
|
edgeRouting: fe
|
|
1248
1248
|
});
|
|
1249
1249
|
h.onmessage = (H) => {
|
|
1250
|
-
var J,
|
|
1251
|
-
H.data.type === "hud" && ((J = ge.current) == null || J.call(ge, H.data.data)), H.data.type === "ready" && pn(!0), H.data.type === "nodesProcessed" && ((
|
|
1250
|
+
var J, ct;
|
|
1251
|
+
H.data.type === "hud" && ((J = ge.current) == null || J.call(ge, H.data.data)), H.data.type === "ready" && pn(!0), H.data.type === "nodesProcessed" && ((ct = pe.current) == null || ct.call(pe, H.data.data));
|
|
1252
1252
|
}, Et.current = h;
|
|
1253
1253
|
const A = new ResizeObserver((H) => {
|
|
1254
|
-
const { width: J, height:
|
|
1255
|
-
h.postMessage({ type: "resize", data: { width: J, height:
|
|
1254
|
+
const { width: J, height: ct } = H[0].contentRect;
|
|
1255
|
+
h.postMessage({ type: "resize", data: { width: J, height: ct } });
|
|
1256
1256
|
});
|
|
1257
1257
|
A.observe(x);
|
|
1258
1258
|
let T, Y;
|
|
1259
|
-
return
|
|
1259
|
+
return st === void 0 && (T = matchMedia("(prefers-color-scheme: dark)"), Y = (H) => h.postMessage({ type: "theme", data: { dark: H.matches } }), T.addEventListener("change", Y)), () => {
|
|
1260
1260
|
A.disconnect(), T && Y && T.removeEventListener("change", Y), Et.current = null;
|
|
1261
1261
|
};
|
|
1262
|
-
}, []),
|
|
1262
|
+
}, []), ft(() => {
|
|
1263
1263
|
var a;
|
|
1264
|
-
|
|
1265
|
-
}, [
|
|
1264
|
+
st !== void 0 && ((a = Et.current) == null || a.postMessage({ type: "theme", data: { dark: st } }));
|
|
1265
|
+
}, [st]), ft(() => {
|
|
1266
1266
|
var a;
|
|
1267
1267
|
(a = Et.current) == null || a.postMessage({ type: "edgeRouting", data: { enabled: fe } });
|
|
1268
1268
|
}, [fe]);
|
|
1269
|
-
const
|
|
1270
|
-
var b,
|
|
1269
|
+
const Nn = tt(0), Ct = F((a = null) => {
|
|
1270
|
+
var b, N, I;
|
|
1271
1271
|
const x = pt.current;
|
|
1272
1272
|
if (re) {
|
|
1273
|
-
const h =
|
|
1273
|
+
const h = vt.current;
|
|
1274
1274
|
if (h) {
|
|
1275
1275
|
const A = h.getBoundingClientRect(), T = -re[1][0] * x.zoom + A.width, Y = -re[1][1] * x.zoom + A.height, H = -re[0][0] * x.zoom, J = -re[0][1] * x.zoom;
|
|
1276
1276
|
x.x = Math.min(H, Math.max(T, x.x)), x.y = Math.min(J, Math.max(Y, x.y));
|
|
@@ -1278,29 +1278,29 @@ function Lr({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
(b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...x } } });
|
|
1280
1280
|
const d = { x: x.x, y: x.y, zoom: x.zoom };
|
|
1281
|
-
(I = (
|
|
1281
|
+
(I = (N = O.current).onMove) == null || I.call(N, a, d);
|
|
1282
1282
|
for (const h of Kt) h(d);
|
|
1283
|
-
cancelAnimationFrame(
|
|
1283
|
+
cancelAnimationFrame(Nn.current), Nn.current = requestAnimationFrame(() => {
|
|
1284
1284
|
Je({ x: x.x, y: x.y, zoom: x.zoom });
|
|
1285
1285
|
});
|
|
1286
1286
|
}, [Kt, re]), Ce = F(() => {
|
|
1287
1287
|
var d, b;
|
|
1288
1288
|
const a = Wt.current, x = Me.current;
|
|
1289
1289
|
a && x ? ((d = Et.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: x, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((b = Et.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
|
|
1290
|
-
}, []),
|
|
1290
|
+
}, []), Le = F(() => {
|
|
1291
1291
|
var x, d;
|
|
1292
1292
|
const a = ie.current;
|
|
1293
1293
|
a ? (x = Et.current) == null || x.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
|
|
1294
1294
|
}, []), dr = F((a) => {
|
|
1295
|
-
var
|
|
1296
|
-
const x = Z.current.length > 0, d =
|
|
1295
|
+
var N, I, h, A, T, Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht;
|
|
1296
|
+
const x = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
|
|
1297
1297
|
if (x && Rt) {
|
|
1298
1298
|
const W = tn(d.x, d.y);
|
|
1299
1299
|
if (Yt && Re.current && W) {
|
|
1300
1300
|
const V = Re.current;
|
|
1301
1301
|
if (W.nodeId !== V.nodeId) {
|
|
1302
1302
|
const qt = V.handleType === "target" ? { source: W.nodeId, target: V.nodeId, sourceHandle: W.handleId || null, targetHandle: V.handleId } : { source: V.nodeId, target: W.nodeId, sourceHandle: V.handleId, targetHandle: W.handleId || null };
|
|
1303
|
-
(O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((
|
|
1303
|
+
(O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((N = ce.current) == null || N.call(ce, { ...qt, ...be }));
|
|
1304
1304
|
}
|
|
1305
1305
|
Re.current = null;
|
|
1306
1306
|
return;
|
|
@@ -1315,14 +1315,14 @@ function Lr({
|
|
|
1315
1315
|
sourceHandle: W.handleId || null,
|
|
1316
1316
|
sourceType: W.type,
|
|
1317
1317
|
startPos: { x: W.x, y: W.y }
|
|
1318
|
-
}, Me.current = { x: d.x, y: d.y }, (A =
|
|
1318
|
+
}, Me.current = { x: d.x, y: d.y }, (A = vt.current) == null || A.setPointerCapture(a.pointerId), (Y = (T = O.current).onConnectStart) == null || Y.call(T, a, { nodeId: W.nodeId, handleId: W.handleId, handleType: W.type }), Ce();
|
|
1319
1319
|
return;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
if (x) {
|
|
1323
1323
|
const W = Tt(d.x, d.y);
|
|
1324
1324
|
if (W) {
|
|
1325
|
-
if (bt.current &&
|
|
1325
|
+
if (bt.current && Nt) {
|
|
1326
1326
|
const kt = [];
|
|
1327
1327
|
if (b)
|
|
1328
1328
|
kt.push({ id: W.id, type: "select", selected: !W.selected });
|
|
@@ -1345,13 +1345,13 @@ function Lr({
|
|
|
1345
1345
|
Jt();
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
if ((H = De.current) == null || H.call(De, a, W),
|
|
1348
|
+
if ((H = De.current) == null || H.call(De, a, W), ht) {
|
|
1349
1349
|
const kt = b && W.selected;
|
|
1350
1350
|
let V = null;
|
|
1351
1351
|
if (W.parentId && W.extent === "parent") {
|
|
1352
1352
|
const et = Z.current.find((qt) => qt.id === W.parentId);
|
|
1353
1353
|
if (et) {
|
|
1354
|
-
const qt = et.width || Vt, Xe = et.height || jt, en = W.width || ((J = W.measured) == null ? void 0 : J.width) || Vt, Fe = W.height || ((
|
|
1354
|
+
const qt = et.width || Vt, Xe = et.height || jt, en = W.width || ((J = W.measured) == null ? void 0 : J.width) || Vt, Fe = W.height || ((ct = W.measured) == null ? void 0 : ct.height) || jt;
|
|
1355
1355
|
V = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
@@ -1373,7 +1373,7 @@ function Lr({
|
|
|
1373
1373
|
}
|
|
1374
1374
|
return { id: et.id, startPos: { ...et.position }, parentClamp: qt, parentId: et.parentId || null };
|
|
1375
1375
|
}) : []
|
|
1376
|
-
}, (U =
|
|
1376
|
+
}, (U = vt.current) == null || U.setPointerCapture(a.pointerId), (nt = Ae.current) == null || nt.call(Ae, a, W), bt.current) {
|
|
1377
1377
|
const et = [{ id: W.id, type: "position", dragging: !0 }];
|
|
1378
1378
|
for (const qt of _t.current.selectedStarts)
|
|
1379
1379
|
et.push({ id: qt.id, type: "position", dragging: !0 });
|
|
@@ -1383,7 +1383,7 @@ function Lr({
|
|
|
1383
1383
|
return;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
if (Pt.current.length > 0 &&
|
|
1386
|
+
if (Pt.current.length > 0 && Nt) {
|
|
1387
1387
|
const W = ue(d.x, d.y);
|
|
1388
1388
|
if (W) {
|
|
1389
1389
|
if (Dt.current) {
|
|
@@ -1400,7 +1400,7 @@ function Lr({
|
|
|
1400
1400
|
}
|
|
1401
1401
|
kt.length && (Dt.current(kt), Jt());
|
|
1402
1402
|
}
|
|
1403
|
-
(
|
|
1403
|
+
(wt = le.current) == null || wt.call(le, a, W);
|
|
1404
1404
|
return;
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
@@ -1409,17 +1409,17 @@ function Lr({
|
|
|
1409
1409
|
W.length && bt.current && bt.current(W), kt.length && Dt.current && Dt.current(kt), (W.length || kt.length) && Jt();
|
|
1410
1410
|
}
|
|
1411
1411
|
if ((Mt = We.current) == null || Mt.call(We, a), ne || b) {
|
|
1412
|
-
ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At =
|
|
1412
|
+
ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = vt.current) == null || At.setPointerCapture(a.pointerId), Le();
|
|
1413
1413
|
return;
|
|
1414
1414
|
}
|
|
1415
|
-
Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt =
|
|
1416
|
-
}, [
|
|
1415
|
+
Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt = vt.current) == null || Xt.classList.add("dragging"), (Ht = vt.current) == null || Ht.setPointerCapture(a.pointerId);
|
|
1416
|
+
}, [at, Tt, tn, ue, ht, Rt, Nt, ne, Ce, Le, Jt]), fr = F((a) => {
|
|
1417
1417
|
var d, b;
|
|
1418
1418
|
if (Wt.current) {
|
|
1419
|
-
if (Me.current =
|
|
1420
|
-
const
|
|
1421
|
-
if (
|
|
1422
|
-
const I =
|
|
1419
|
+
if (Me.current = at(a.clientX, a.clientY), Ce(), fn) {
|
|
1420
|
+
const N = vt.current;
|
|
1421
|
+
if (N) {
|
|
1422
|
+
const I = N.getBoundingClientRect(), h = 40, A = a.clientX - I.left, T = a.clientY - I.top;
|
|
1423
1423
|
let Y = 0, H = 0;
|
|
1424
1424
|
A < h ? Y = Qt : A > I.width - h && (Y = -Qt), T < h ? H = Qt : T > I.height - h && (H = -Qt), (Y || H) && (pt.current.x += Y, pt.current.y += H, Ct(a));
|
|
1425
1425
|
}
|
|
@@ -1427,13 +1427,13 @@ function Lr({
|
|
|
1427
1427
|
return;
|
|
1428
1428
|
}
|
|
1429
1429
|
if (ie.current) {
|
|
1430
|
-
ie.current.endWorld =
|
|
1431
|
-
const
|
|
1430
|
+
ie.current.endWorld = at(a.clientX, a.clientY), Le();
|
|
1431
|
+
const N = ie.current, I = Math.min(N.startWorld.x, N.endWorld.x), h = Math.min(N.startWorld.y, N.endWorld.y), A = Math.max(N.startWorld.x, N.endWorld.x), T = Math.max(N.startWorld.y, N.endWorld.y);
|
|
1432
1432
|
if (bt.current) {
|
|
1433
1433
|
const Y = [];
|
|
1434
1434
|
for (const H of Z.current) {
|
|
1435
1435
|
if (H.hidden) continue;
|
|
1436
|
-
const J = H.width || Vt,
|
|
1436
|
+
const J = H.width || Vt, ct = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= h && H.position.y + ct <= T : H.position.x + J > I && H.position.x < A && H.position.y + ct > h && H.position.y < T;
|
|
1437
1437
|
U !== !!H.selected && Y.push({ id: H.id, type: "select", selected: U });
|
|
1438
1438
|
}
|
|
1439
1439
|
Y.length && bt.current(Y);
|
|
@@ -1441,7 +1441,7 @@ function Lr({
|
|
|
1441
1441
|
return;
|
|
1442
1442
|
}
|
|
1443
1443
|
if (_t.current) {
|
|
1444
|
-
const
|
|
1444
|
+
const N = at(a.clientX, a.clientY), I = _t.current, h = N.x - I.startMouse.x, A = N.y - I.startMouse.y;
|
|
1445
1445
|
let T = { x: I.startPos.x + h, y: I.startPos.y + A };
|
|
1446
1446
|
if (me && (T = Pn(T, de)), oe && (T = Tn(T, oe)), I.parentClamp) {
|
|
1447
1447
|
const U = I.parentClamp;
|
|
@@ -1451,27 +1451,27 @@ function Lr({
|
|
|
1451
1451
|
for (const U of I.selectedStarts) {
|
|
1452
1452
|
let nt = { x: U.startPos.x + h, y: U.startPos.y + A };
|
|
1453
1453
|
if (me && (nt = Pn(nt, de)), oe && (nt = Tn(nt, oe)), U.parentClamp) {
|
|
1454
|
-
const
|
|
1455
|
-
nt = { x: Math.max(
|
|
1454
|
+
const wt = U.parentClamp;
|
|
1455
|
+
nt = { x: Math.max(wt.minX, Math.min(nt.x, wt.maxX)), y: Math.max(wt.minY, Math.min(nt.y, wt.maxY)) };
|
|
1456
1456
|
}
|
|
1457
1457
|
Y.push({ id: U.id, position: nt });
|
|
1458
1458
|
}
|
|
1459
1459
|
const H = [];
|
|
1460
1460
|
for (const U of Y) {
|
|
1461
|
-
const nt = Z.current.find((
|
|
1461
|
+
const nt = Z.current.find((wt) => wt.id === U.id);
|
|
1462
1462
|
if (nt) {
|
|
1463
1463
|
nt.position = U.position, nt.dragging = !0;
|
|
1464
|
-
let
|
|
1464
|
+
let wt = U.position;
|
|
1465
1465
|
if (nt.parentId) {
|
|
1466
1466
|
let Mt = Z.current.find((Ht) => Ht.id === nt.parentId), At = U.position.x, Xt = U.position.y;
|
|
1467
1467
|
for (; Mt; )
|
|
1468
1468
|
At += Mt.position.x, Xt += Mt.position.y, Mt = Mt.parentId ? Z.current.find((Ht) => Ht.id === Mt.parentId) : null;
|
|
1469
|
-
|
|
1469
|
+
wt = { x: At, y: Xt };
|
|
1470
1470
|
}
|
|
1471
1471
|
H.push({
|
|
1472
1472
|
id: U.id,
|
|
1473
1473
|
position: U.position,
|
|
1474
|
-
_absolutePosition:
|
|
1474
|
+
_absolutePosition: wt,
|
|
1475
1475
|
width: nt.width,
|
|
1476
1476
|
height: nt.height,
|
|
1477
1477
|
dragging: !0,
|
|
@@ -1482,13 +1482,13 @@ function Lr({
|
|
|
1482
1482
|
const J = new Set(Y.map((U) => U.id));
|
|
1483
1483
|
for (const U of Z.current)
|
|
1484
1484
|
if (U.parentId && J.has(U.parentId) && !J.has(U.id)) {
|
|
1485
|
-
let nt = Z.current.find((At) => At.id === U.parentId),
|
|
1485
|
+
let nt = Z.current.find((At) => At.id === U.parentId), wt = U.position.x, Mt = U.position.y;
|
|
1486
1486
|
for (; nt; )
|
|
1487
|
-
|
|
1487
|
+
wt += nt.position.x, Mt += nt.position.y, nt = nt.parentId ? Z.current.find((At) => At.id === nt.parentId) : null;
|
|
1488
1488
|
H.push({
|
|
1489
1489
|
id: U.id,
|
|
1490
1490
|
position: U.position,
|
|
1491
|
-
_absolutePosition: { x:
|
|
1491
|
+
_absolutePosition: { x: wt, y: Mt },
|
|
1492
1492
|
width: U.width,
|
|
1493
1493
|
height: U.height,
|
|
1494
1494
|
dragging: !1,
|
|
@@ -1496,24 +1496,24 @@ function Lr({
|
|
|
1496
1496
|
});
|
|
1497
1497
|
}
|
|
1498
1498
|
if ((d = Et.current) == null || d.postMessage({ type: "nodePositions", data: { updates: H } }), dn) {
|
|
1499
|
-
const U =
|
|
1499
|
+
const U = vt.current;
|
|
1500
1500
|
if (U) {
|
|
1501
|
-
const nt = U.getBoundingClientRect(),
|
|
1501
|
+
const nt = U.getBoundingClientRect(), wt = 40, Mt = a.clientX - nt.left, At = a.clientY - nt.top;
|
|
1502
1502
|
let Xt = 0, Ht = 0;
|
|
1503
|
-
Mt <
|
|
1503
|
+
Mt < wt ? Xt = Qt : Mt > nt.width - wt && (Xt = -Qt), At < wt ? Ht = Qt : At > nt.height - wt && (Ht = -Qt), (Xt || Ht) && (pt.current.x += Xt, pt.current.y += Ht, Ct(a));
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1506
|
+
const ct = Z.current.find((U) => U.id === I.id);
|
|
1507
|
+
ct && ((b = He.current) == null || b.call(He, a, ct));
|
|
1508
1508
|
return;
|
|
1509
1509
|
}
|
|
1510
1510
|
if (!Se.current) return;
|
|
1511
1511
|
const x = pt.current;
|
|
1512
1512
|
x.x += a.clientX - te.current.x, x.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Ct();
|
|
1513
|
-
}, [Ct,
|
|
1514
|
-
var x, d, b,
|
|
1513
|
+
}, [Ct, at, Ce, Le]), hr = F((a) => {
|
|
1514
|
+
var x, d, b, N, I;
|
|
1515
1515
|
if (Wt.current) {
|
|
1516
|
-
const h =
|
|
1516
|
+
const h = at(a.clientX, a.clientY), A = tn(h.x, h.y);
|
|
1517
1517
|
if (A && A.nodeId !== Wt.current.sourceId && (Bt === "loose" || A.type === "target")) {
|
|
1518
1518
|
const H = Wt.current.sourceType === "target" ? {
|
|
1519
1519
|
source: A.nodeId,
|
|
@@ -1532,7 +1532,7 @@ function Lr({
|
|
|
1532
1532
|
return;
|
|
1533
1533
|
}
|
|
1534
1534
|
if (ie.current) {
|
|
1535
|
-
ie.current = null,
|
|
1535
|
+
ie.current = null, Le(), Jt();
|
|
1536
1536
|
return;
|
|
1537
1537
|
}
|
|
1538
1538
|
if (_t.current) {
|
|
@@ -1545,7 +1545,7 @@ function Lr({
|
|
|
1545
1545
|
dragging: !1
|
|
1546
1546
|
}];
|
|
1547
1547
|
for (const H of h.selectedStarts) {
|
|
1548
|
-
const J = Z.current.find((
|
|
1548
|
+
const J = Z.current.find((ct) => ct.id === H.id);
|
|
1549
1549
|
Y.push({
|
|
1550
1550
|
id: H.id,
|
|
1551
1551
|
type: "position",
|
|
@@ -1559,13 +1559,13 @@ function Lr({
|
|
|
1559
1559
|
_t.current = null;
|
|
1560
1560
|
});
|
|
1561
1561
|
const A = Z.current.find((T) => T.id === h.id);
|
|
1562
|
-
A && ((
|
|
1562
|
+
A && ((N = _e.current) == null || N.call(_e, a, A));
|
|
1563
1563
|
return;
|
|
1564
1564
|
}
|
|
1565
|
-
Se.current = !1, (I =
|
|
1566
|
-
}, [
|
|
1567
|
-
|
|
1568
|
-
const a =
|
|
1565
|
+
Se.current = !1, (I = vt.current) == null || I.classList.remove("dragging");
|
|
1566
|
+
}, [at, tn, Ce, Le, Jt]);
|
|
1567
|
+
ft(() => {
|
|
1568
|
+
const a = vt.current;
|
|
1569
1569
|
if (!a) return;
|
|
1570
1570
|
const x = (d) => {
|
|
1571
1571
|
Pe && d.preventDefault();
|
|
@@ -1576,13 +1576,13 @@ function Lr({
|
|
|
1576
1576
|
return;
|
|
1577
1577
|
}
|
|
1578
1578
|
if (!Oe) return;
|
|
1579
|
-
const
|
|
1580
|
-
b.x = h - (h - b.x) *
|
|
1579
|
+
const N = d.deltaY > 0 ? 0.92 : 1.08, I = a.getBoundingClientRect(), h = d.clientX - I.left, A = d.clientY - I.top;
|
|
1580
|
+
b.x = h - (h - b.x) * N, b.y = A - (A - b.y) * N, b.zoom = Math.min(mt, Math.max(it, b.zoom * N)), Ct(d);
|
|
1581
1581
|
};
|
|
1582
1582
|
return a.addEventListener("wheel", x, { passive: !Pe }), () => a.removeEventListener("wheel", x);
|
|
1583
|
-
}, [Ct,
|
|
1583
|
+
}, [Ct, it, mt, Ge, $e, Ze, Oe, Pe]), ft(() => {
|
|
1584
1584
|
if (!Ke) return;
|
|
1585
|
-
const a =
|
|
1585
|
+
const a = vt.current;
|
|
1586
1586
|
if (!a) return;
|
|
1587
1587
|
let x = 0, d = null;
|
|
1588
1588
|
const b = (h) => {
|
|
@@ -1595,48 +1595,48 @@ function Lr({
|
|
|
1595
1595
|
y: (h.touches[0].clientY + h.touches[1].clientY) / 2 - Y.top
|
|
1596
1596
|
}, h.preventDefault();
|
|
1597
1597
|
}
|
|
1598
|
-
},
|
|
1598
|
+
}, N = (h) => {
|
|
1599
1599
|
if (h.touches.length === 2 && x > 0) {
|
|
1600
1600
|
h.preventDefault();
|
|
1601
1601
|
const A = h.touches[0].clientX - h.touches[1].clientX, T = h.touches[0].clientY - h.touches[1].clientY, Y = Math.hypot(A, T), H = Y / x;
|
|
1602
1602
|
x = Y;
|
|
1603
|
-
const J = pt.current,
|
|
1604
|
-
J.x =
|
|
1603
|
+
const J = pt.current, ct = d.x, U = d.y;
|
|
1604
|
+
J.x = ct - (ct - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(mt, Math.max(it, J.zoom * H)), Ct(h);
|
|
1605
1605
|
}
|
|
1606
1606
|
}, I = () => {
|
|
1607
1607
|
x = 0, d = null;
|
|
1608
1608
|
};
|
|
1609
|
-
return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove",
|
|
1610
|
-
a.removeEventListener("touchstart", b), a.removeEventListener("touchmove",
|
|
1609
|
+
return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", N, { passive: !1 }), a.addEventListener("touchend", I), () => {
|
|
1610
|
+
a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", N), a.removeEventListener("touchend", I);
|
|
1611
1611
|
};
|
|
1612
|
-
}, [Ke, Ct,
|
|
1612
|
+
}, [Ke, Ct, it, mt]), ft(() => {
|
|
1613
1613
|
if (!Qe) return;
|
|
1614
|
-
const a =
|
|
1614
|
+
const a = vt.current;
|
|
1615
1615
|
if (!a) return;
|
|
1616
1616
|
const x = (d) => {
|
|
1617
|
-
var H, J,
|
|
1618
|
-
const b =
|
|
1617
|
+
var H, J, ct, U;
|
|
1618
|
+
const b = at(d.clientX, d.clientY);
|
|
1619
1619
|
if (Tt(b.x, b.y)) {
|
|
1620
1620
|
(J = (H = O.current).onNodeDoubleClick) == null || J.call(H, d, Tt(b.x, b.y));
|
|
1621
1621
|
return;
|
|
1622
1622
|
}
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1625
|
-
(U = (
|
|
1623
|
+
const N = ue(b.x, b.y);
|
|
1624
|
+
if (N) {
|
|
1625
|
+
(U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, N);
|
|
1626
1626
|
return;
|
|
1627
1627
|
}
|
|
1628
1628
|
const I = 1.5, h = a.getBoundingClientRect(), A = d.clientX - h.left, T = d.clientY - h.top, Y = pt.current;
|
|
1629
|
-
Y.x = A - (A - Y.x) * I, Y.y = T - (T - Y.y) * I, Y.zoom = Math.min(
|
|
1629
|
+
Y.x = A - (A - Y.x) * I, Y.y = T - (T - Y.y) * I, Y.zoom = Math.min(mt, Math.max(it, Y.zoom * I)), Ct(d);
|
|
1630
1630
|
};
|
|
1631
1631
|
return a.addEventListener("dblclick", x), () => a.removeEventListener("dblclick", x);
|
|
1632
|
-
}, [Qe, Ct,
|
|
1633
|
-
const a =
|
|
1632
|
+
}, [Qe, Ct, it, mt, at, Tt, ue]), ft(() => {
|
|
1633
|
+
const a = vt.current;
|
|
1634
1634
|
if (!a) return;
|
|
1635
1635
|
const x = (d) => {
|
|
1636
1636
|
var h, A, T, Y, H, J;
|
|
1637
|
-
const b =
|
|
1638
|
-
if (
|
|
1639
|
-
(A = (h = O.current).onNodeContextMenu) == null || A.call(h, d,
|
|
1637
|
+
const b = at(d.clientX, d.clientY), N = Tt(b.x, b.y);
|
|
1638
|
+
if (N) {
|
|
1639
|
+
(A = (h = O.current).onNodeContextMenu) == null || A.call(h, d, N);
|
|
1640
1640
|
return;
|
|
1641
1641
|
}
|
|
1642
1642
|
const I = ue(b.x, b.y);
|
|
@@ -1647,31 +1647,31 @@ function Lr({
|
|
|
1647
1647
|
(J = (H = O.current).onPaneContextMenu) == null || J.call(H, d);
|
|
1648
1648
|
};
|
|
1649
1649
|
return a.addEventListener("contextmenu", x), () => a.removeEventListener("contextmenu", x);
|
|
1650
|
-
}, [
|
|
1651
|
-
const a =
|
|
1650
|
+
}, [at, Tt, ue]), ft(() => {
|
|
1651
|
+
const a = vt.current;
|
|
1652
1652
|
if (!a) return;
|
|
1653
1653
|
let x = null, d = null;
|
|
1654
1654
|
const b = (h) => {
|
|
1655
|
-
var Y, H, J,
|
|
1655
|
+
var Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht, W, kt, V;
|
|
1656
1656
|
(H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, h);
|
|
1657
|
-
const A =
|
|
1658
|
-
if (T !== x && (x && ((
|
|
1657
|
+
const A = at(h.clientX, h.clientY), T = Tt(A.x, A.y);
|
|
1658
|
+
if (T !== x && (x && ((ct = (J = O.current).onNodeMouseLeave) == null || ct.call(J, h, x)), T && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, h, T)), x = T), T && ((Mt = (wt = O.current).onNodeMouseMove) == null || Mt.call(wt, h, T)), !T) {
|
|
1659
1659
|
const et = ue(A.x, A.y);
|
|
1660
1660
|
et !== d && (d && ((Xt = (At = O.current).onEdgeMouseLeave) == null || Xt.call(At, h, d)), et && ((W = (Ht = O.current).onEdgeMouseEnter) == null || W.call(Ht, h, et)), d = et), et && ((V = (kt = O.current).onEdgeMouseMove) == null || V.call(kt, h, et));
|
|
1661
1661
|
}
|
|
1662
|
-
},
|
|
1662
|
+
}, N = (h) => {
|
|
1663
1663
|
var A, T;
|
|
1664
1664
|
return (T = (A = O.current).onPaneMouseEnter) == null ? void 0 : T.call(A, h);
|
|
1665
1665
|
}, I = (h) => {
|
|
1666
|
-
var A, T, Y, H, J,
|
|
1667
|
-
(T = (A = O.current).onPaneMouseLeave) == null || T.call(A, h), x && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, h, x), x = null), d && ((
|
|
1666
|
+
var A, T, Y, H, J, ct;
|
|
1667
|
+
(T = (A = O.current).onPaneMouseLeave) == null || T.call(A, h), x && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, h, x), x = null), d && ((ct = (J = O.current).onEdgeMouseLeave) == null || ct.call(J, h, d), d = null);
|
|
1668
1668
|
};
|
|
1669
|
-
return a.addEventListener("mousemove", b), a.addEventListener("mouseenter",
|
|
1670
|
-
a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter",
|
|
1669
|
+
return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", N), a.addEventListener("mouseleave", I), () => {
|
|
1670
|
+
a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", N), a.removeEventListener("mouseleave", I);
|
|
1671
1671
|
};
|
|
1672
|
-
}, [
|
|
1672
|
+
}, [at, Tt, ue]), ft(() => {
|
|
1673
1673
|
const a = Array.isArray(ve) ? ve : [ve], x = async (d) => {
|
|
1674
|
-
var b,
|
|
1674
|
+
var b, N;
|
|
1675
1675
|
if (a.includes(d.key)) {
|
|
1676
1676
|
if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA" || d.target.isContentEditable) return;
|
|
1677
1677
|
const I = Z.current.filter((T) => T.selected), h = Pt.current.filter((T) => T.selected);
|
|
@@ -1682,7 +1682,7 @@ function Lr({
|
|
|
1682
1682
|
const T = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
|
|
1683
1683
|
T.length && Dt.current(T.map((Y) => ({ id: Y.id, type: "remove" })));
|
|
1684
1684
|
}
|
|
1685
|
-
h.length && Dt.current && Dt.current(h.map((T) => ({ id: T.id, type: "remove" }))), (
|
|
1685
|
+
h.length && Dt.current && Dt.current(h.map((T) => ({ id: T.id, type: "remove" }))), (N = (b = O.current).onDelete) == null || N.call(b, { nodes: I, edges: h });
|
|
1686
1686
|
}
|
|
1687
1687
|
if ((d.ctrlKey || d.metaKey) && d.key === "a") {
|
|
1688
1688
|
if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA") return;
|
|
@@ -1699,14 +1699,14 @@ function Lr({
|
|
|
1699
1699
|
return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
|
|
1700
1700
|
}, [ve]);
|
|
1701
1701
|
const In = tt(!1);
|
|
1702
|
-
|
|
1702
|
+
ft(() => {
|
|
1703
1703
|
var a, x;
|
|
1704
1704
|
if (!In.current && Et.current) {
|
|
1705
|
-
if (In.current = !0,
|
|
1706
|
-
const d =
|
|
1705
|
+
if (In.current = !0, zt && Z.current.length > 0) {
|
|
1706
|
+
const d = vt.current;
|
|
1707
1707
|
if (d) {
|
|
1708
|
-
const b = d.getBoundingClientRect(),
|
|
1709
|
-
|
|
1708
|
+
const b = d.getBoundingClientRect(), N = (dt == null ? void 0 : dt.padding) ?? 0.1, I = Mn(Z.current), h = Rn(I, b.width, b.height, N);
|
|
1709
|
+
dt != null && dt.maxZoom && (h.zoom = Math.min(h.zoom, dt.maxZoom)), dt != null && dt.minZoom && (h.zoom = Math.max(h.zoom, dt.minZoom)), pt.current = h, Ct();
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
1712
|
(x = (a = O.current).onInit) == null || x.call(a, {
|
|
@@ -1714,24 +1714,24 @@ function Lr({
|
|
|
1714
1714
|
getEdges: () => [...Pt.current],
|
|
1715
1715
|
getViewport: () => ({ ...pt.current }),
|
|
1716
1716
|
fitView: (d = {}) => {
|
|
1717
|
-
const b =
|
|
1717
|
+
const b = vt.current;
|
|
1718
1718
|
if (!b || !Z.current.length) return;
|
|
1719
|
-
const
|
|
1719
|
+
const N = b.getBoundingClientRect(), I = Mn(Z.current), h = Rn(I, N.width, N.height, d.padding ?? 0.1);
|
|
1720
1720
|
pt.current = h, Ct();
|
|
1721
1721
|
}
|
|
1722
1722
|
});
|
|
1723
1723
|
}
|
|
1724
1724
|
});
|
|
1725
1725
|
const yr = F(() => {
|
|
1726
|
-
pt.current = { ...
|
|
1727
|
-
}, [Ct,
|
|
1726
|
+
pt.current = { ...Lt }, Ct();
|
|
1727
|
+
}, [Ct, Lt]), gr = F((a) => {
|
|
1728
1728
|
var x;
|
|
1729
1729
|
if (a)
|
|
1730
1730
|
se.current.push(a);
|
|
1731
1731
|
else {
|
|
1732
|
-
const d = pt.current, b =
|
|
1732
|
+
const d = pt.current, b = vt.current;
|
|
1733
1733
|
if (!b) return;
|
|
1734
|
-
const
|
|
1734
|
+
const N = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + N.width / 2 / d.zoom), h = Math.round(-d.y / d.zoom + N.height / 2 / d.zoom);
|
|
1735
1735
|
se.current.push({
|
|
1736
1736
|
x: I - 80,
|
|
1737
1737
|
y: h - 45,
|
|
@@ -1744,7 +1744,7 @@ function Lr({
|
|
|
1744
1744
|
(x = Et.current) == null || x.postMessage({ type: "cards", data: { cards: [...se.current] } });
|
|
1745
1745
|
}, []), pr = F((a) => {
|
|
1746
1746
|
if (a.id || (a.id = "node-" + Date.now()), !a.position) {
|
|
1747
|
-
const x = pt.current, d =
|
|
1747
|
+
const x = pt.current, d = vt.current;
|
|
1748
1748
|
if (!d) return;
|
|
1749
1749
|
const b = d.getBoundingClientRect();
|
|
1750
1750
|
a.position = {
|
|
@@ -1755,8 +1755,8 @@ function Lr({
|
|
|
1755
1755
|
a.data || (a.data = { label: a.id }), bt.current && bt.current([{ type: "add", item: a }]);
|
|
1756
1756
|
}, []), xr = F(() => ({ ...pt.current }), []), mr = F((a) => {
|
|
1757
1757
|
pt.current = { ...pt.current, ...a }, Ct();
|
|
1758
|
-
}, [Ct]), vr = F((a) =>
|
|
1759
|
-
wrapRef:
|
|
1758
|
+
}, [Ct]), vr = F((a) => at(a.x, a.y), [at]), $n = n, wr = St(() => ({
|
|
1759
|
+
wrapRef: vt,
|
|
1760
1760
|
canvasRef: Te,
|
|
1761
1761
|
workerRef: Et,
|
|
1762
1762
|
cameraRef: pt,
|
|
@@ -1767,11 +1767,11 @@ function Lr({
|
|
|
1767
1767
|
onNodesChangeRef: bt,
|
|
1768
1768
|
onEdgesChangeRef: Dt,
|
|
1769
1769
|
sendCamera: Ct,
|
|
1770
|
-
screenToWorld:
|
|
1770
|
+
screenToWorld: at,
|
|
1771
1771
|
viewportListeners: Kt,
|
|
1772
1772
|
selectionListeners: he,
|
|
1773
|
-
zoomMin:
|
|
1774
|
-
zoomMax:
|
|
1773
|
+
zoomMin: it,
|
|
1774
|
+
zoomMax: mt,
|
|
1775
1775
|
snapToGrid: me,
|
|
1776
1776
|
snapGrid: de,
|
|
1777
1777
|
nodeExtent: oe,
|
|
@@ -1793,9 +1793,9 @@ function Lr({
|
|
|
1793
1793
|
get connection() {
|
|
1794
1794
|
return Ve;
|
|
1795
1795
|
}
|
|
1796
|
-
}), [e, n, $n, Be, Ve, Ct,
|
|
1796
|
+
}), [e, n, $n, Be, Ve, Ct, at, Ft, Kt, he, it, mt, me, de, oe, be, fe]);
|
|
1797
1797
|
return {
|
|
1798
|
-
wrapRef:
|
|
1798
|
+
wrapRef: vt,
|
|
1799
1799
|
canvasRef: Te,
|
|
1800
1800
|
canvasReady: gn,
|
|
1801
1801
|
onPointerDown: dr,
|
|
@@ -1830,15 +1830,15 @@ function Ro() {
|
|
|
1830
1830
|
function $r({ node: t, nodeType: e }) {
|
|
1831
1831
|
var m, C, z;
|
|
1832
1832
|
const n = yt(), r = tt(null), s = t._absolutePosition || t.position, o = tt(null);
|
|
1833
|
-
|
|
1833
|
+
ft(() => {
|
|
1834
1834
|
const M = r.current;
|
|
1835
1835
|
if (!M) return;
|
|
1836
|
-
const $ = new ResizeObserver((
|
|
1836
|
+
const $ = new ResizeObserver((R) => {
|
|
1837
1837
|
var D, g, f, p;
|
|
1838
|
-
const { width: E, height: _ } =
|
|
1838
|
+
const { width: E, height: _ } = R[0].contentRect;
|
|
1839
1839
|
if (E > 0 && _ > 0) {
|
|
1840
|
-
const v = n.nodesRef.current.find((P) => P.id === t.id),
|
|
1841
|
-
(Math.abs((
|
|
1840
|
+
const v = n.nodesRef.current.find((P) => P.id === t.id), L = (v == null ? void 0 : v.width) || ((D = v == null ? void 0 : v.measured) == null ? void 0 : D.width), w = (v == null ? void 0 : v.height) || ((g = v == null ? void 0 : v.measured) == null ? void 0 : g.height);
|
|
1841
|
+
(Math.abs((L || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((p = (f = n.onNodesChangeRef).current) == null || p.call(f, [
|
|
1842
1842
|
{ id: t.id, type: "dimensions", dimensions: { width: E, height: _ }, setAttributes: !0 }
|
|
1843
1843
|
]));
|
|
1844
1844
|
}
|
|
@@ -1846,21 +1846,22 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1846
1846
|
return $.observe(M), () => $.disconnect();
|
|
1847
1847
|
}, [t.id, n]);
|
|
1848
1848
|
const i = F((M) => {
|
|
1849
|
-
var B,
|
|
1849
|
+
var B, j, X, xt;
|
|
1850
|
+
M.stopPropagation();
|
|
1850
1851
|
const $ = M.target.tagName;
|
|
1851
|
-
if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || M.target.isContentEditable) return;
|
|
1852
|
-
let
|
|
1853
|
-
for (;
|
|
1854
|
-
if ((B =
|
|
1855
|
-
|
|
1852
|
+
if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || $ === "LABEL" || M.target.isContentEditable) return;
|
|
1853
|
+
let R = M.target;
|
|
1854
|
+
for (; R && R !== r.current; ) {
|
|
1855
|
+
if ((B = R.classList) != null && B.contains("nodrag") || (j = R.classList) != null && j.contains("nopan")) return;
|
|
1856
|
+
R = R.parentElement;
|
|
1856
1857
|
}
|
|
1857
|
-
if (
|
|
1858
|
+
if (n.onNodesChangeRef.current) {
|
|
1858
1859
|
const K = [];
|
|
1859
1860
|
if (M.shiftKey)
|
|
1860
1861
|
K.push({ id: t.id, type: "select", selected: !t.selected });
|
|
1861
1862
|
else
|
|
1862
|
-
for (const
|
|
1863
|
-
|
|
1863
|
+
for (const q of n.nodesRef.current)
|
|
1864
|
+
q.id === t.id && !q.selected ? K.push({ id: q.id, type: "select", selected: !0 }) : q.id !== t.id && q.selected && K.push({ id: q.id, type: "select", selected: !1 });
|
|
1864
1865
|
K.length && n.onNodesChangeRef.current(K);
|
|
1865
1866
|
}
|
|
1866
1867
|
const E = n.cameraRef.current, _ = n.wrapRef.current;
|
|
@@ -1871,53 +1872,53 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1871
1872
|
startMouse: { x: g, y: f },
|
|
1872
1873
|
selectedStarts: v
|
|
1873
1874
|
};
|
|
1874
|
-
const
|
|
1875
|
+
const L = [{ id: t.id, type: "position", dragging: !0 }];
|
|
1875
1876
|
for (const K of v)
|
|
1876
|
-
|
|
1877
|
-
(
|
|
1877
|
+
L.push({ id: K.id, type: "position", dragging: !0 });
|
|
1878
|
+
(xt = (X = n.onNodesChangeRef).current) == null || xt.call(X, L);
|
|
1878
1879
|
const w = r.current;
|
|
1879
1880
|
w && w.setPointerCapture(M.pointerId);
|
|
1880
1881
|
const P = (K) => {
|
|
1881
|
-
var
|
|
1882
|
+
var it, mt, Lt, zt;
|
|
1882
1883
|
if (!o.current) return;
|
|
1883
|
-
const
|
|
1884
|
-
let
|
|
1885
|
-
if (n.snapToGrid && n.snapGrid && (
|
|
1886
|
-
x: n.snapGrid[0] * Math.round(
|
|
1887
|
-
y: n.snapGrid[1] * Math.round(
|
|
1884
|
+
const rt = n.cameraRef.current, q = _.getBoundingClientRect(), G = (K.clientX - q.left - rt.x) / rt.zoom, ot = (K.clientY - q.top - rt.y) / rt.zoom, lt = G - o.current.startMouse.x, ut = ot - o.current.startMouse.y;
|
|
1885
|
+
let st = { x: o.current.startPos.x + lt, y: o.current.startPos.y + ut };
|
|
1886
|
+
if (n.snapToGrid && n.snapGrid && (st = {
|
|
1887
|
+
x: n.snapGrid[0] * Math.round(st.x / n.snapGrid[0]),
|
|
1888
|
+
y: n.snapGrid[1] * Math.round(st.y / n.snapGrid[1])
|
|
1888
1889
|
}), t.parentId && t.extent === "parent") {
|
|
1889
|
-
const
|
|
1890
|
-
if (
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
x: Math.max(0, Math.min(
|
|
1894
|
-
y: Math.max(0, Math.min(
|
|
1890
|
+
const dt = n.nodesRef.current.find((ht) => ht.id === t.parentId);
|
|
1891
|
+
if (dt) {
|
|
1892
|
+
const ht = dt.width || 160, Rt = dt.height || 60, Nt = t.width || ((it = t.measured) == null ? void 0 : it.width) || 160, gt = t.height || ((mt = t.measured) == null ? void 0 : mt.height) || 60;
|
|
1893
|
+
st = {
|
|
1894
|
+
x: Math.max(0, Math.min(st.x, ht - Nt)),
|
|
1895
|
+
y: Math.max(0, Math.min(st.y, Rt - gt))
|
|
1895
1896
|
};
|
|
1896
1897
|
}
|
|
1897
1898
|
}
|
|
1898
|
-
const
|
|
1899
|
-
for (const
|
|
1900
|
-
let
|
|
1901
|
-
n.snapToGrid && n.snapGrid && (
|
|
1902
|
-
x: n.snapGrid[0] * Math.round(
|
|
1903
|
-
y: n.snapGrid[1] * Math.round(
|
|
1904
|
-
}),
|
|
1899
|
+
const It = [{ id: t.id, type: "position", position: st, dragging: !0 }];
|
|
1900
|
+
for (const dt of o.current.selectedStarts) {
|
|
1901
|
+
let ht = { x: dt.startPos.x + lt, y: dt.startPos.y + ut };
|
|
1902
|
+
n.snapToGrid && n.snapGrid && (ht = {
|
|
1903
|
+
x: n.snapGrid[0] * Math.round(ht.x / n.snapGrid[0]),
|
|
1904
|
+
y: n.snapGrid[1] * Math.round(ht.y / n.snapGrid[1])
|
|
1905
|
+
}), It.push({ id: dt.id, type: "position", position: ht, dragging: !0 });
|
|
1905
1906
|
}
|
|
1906
|
-
(
|
|
1907
|
-
},
|
|
1908
|
-
var
|
|
1907
|
+
(zt = (Lt = n.onNodesChangeRef).current) == null || zt.call(Lt, It);
|
|
1908
|
+
}, k = (K) => {
|
|
1909
|
+
var q, G;
|
|
1909
1910
|
if (!o.current) return;
|
|
1910
|
-
const
|
|
1911
|
-
for (const
|
|
1912
|
-
|
|
1913
|
-
(G = (
|
|
1911
|
+
const rt = [{ id: t.id, type: "position", dragging: !1 }];
|
|
1912
|
+
for (const ot of o.current.selectedStarts)
|
|
1913
|
+
rt.push({ id: ot.id, type: "position", dragging: !1 });
|
|
1914
|
+
(G = (q = n.onNodesChangeRef).current) == null || G.call(q, rt), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", P), w == null || w.removeEventListener("pointerup", k);
|
|
1914
1915
|
};
|
|
1915
|
-
w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup",
|
|
1916
|
+
w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup", k);
|
|
1916
1917
|
}, [t, n]), c = F((M) => {
|
|
1917
|
-
var g, f, p, v,
|
|
1918
|
+
var g, f, p, v, L, w;
|
|
1918
1919
|
if (!t.selected) return;
|
|
1919
1920
|
const $ = M.shiftKey ? 10 : 1;
|
|
1920
|
-
let
|
|
1921
|
+
let R = 0, E = 0;
|
|
1921
1922
|
switch (M.key) {
|
|
1922
1923
|
case "ArrowUp":
|
|
1923
1924
|
E = -$;
|
|
@@ -1926,10 +1927,10 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1926
1927
|
E = $;
|
|
1927
1928
|
break;
|
|
1928
1929
|
case "ArrowLeft":
|
|
1929
|
-
|
|
1930
|
+
R = -$;
|
|
1930
1931
|
break;
|
|
1931
1932
|
case "ArrowRight":
|
|
1932
|
-
|
|
1933
|
+
R = $;
|
|
1933
1934
|
break;
|
|
1934
1935
|
case "Escape":
|
|
1935
1936
|
(f = (g = n.onNodesChangeRef).current) == null || f.call(g, [{ id: t.id, type: "select", selected: !1 }]);
|
|
@@ -1942,10 +1943,10 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1942
1943
|
return;
|
|
1943
1944
|
}
|
|
1944
1945
|
M.preventDefault();
|
|
1945
|
-
const _ = { x: t.position.x +
|
|
1946
|
+
const _ = { x: t.position.x + R, y: t.position.y + E }, D = [{ id: t.id, type: "position", position: _ }];
|
|
1946
1947
|
for (const P of n.nodesRef.current)
|
|
1947
|
-
P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x +
|
|
1948
|
-
(w = (
|
|
1948
|
+
P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x + R, y: P.position.y + E } });
|
|
1949
|
+
(w = (L = n.onNodesChangeRef).current) == null || w.call(L, D);
|
|
1949
1950
|
}, [t, n]), u = t.width || ((m = t.measured) == null ? void 0 : m.width), l = t.height || ((C = t.measured) == null ? void 0 : C.height), y = !!(u && l);
|
|
1950
1951
|
return /* @__PURE__ */ S(je.Provider, { value: t.id, children: /* @__PURE__ */ S(
|
|
1951
1952
|
"div",
|
|
@@ -2055,75 +2056,75 @@ function Dn({ x: t, y: e, position: n, type: r, onPointerDown: s }) {
|
|
|
2055
2056
|
}
|
|
2056
2057
|
function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
2057
2058
|
var g, f, p;
|
|
2058
|
-
const s = yt(), [o, i] = Gt(null), c = F((v,
|
|
2059
|
+
const s = yt(), [o, i] = Gt(null), c = F((v, L, w, P) => {
|
|
2059
2060
|
var rt;
|
|
2060
|
-
|
|
2061
|
-
const
|
|
2062
|
-
if (!
|
|
2063
|
-
const B = v === "source" ? P : w,
|
|
2061
|
+
L.stopPropagation(), L.preventDefault();
|
|
2062
|
+
const k = s.wrapRef.current;
|
|
2063
|
+
if (!k) return;
|
|
2064
|
+
const B = v === "source" ? P : w, j = v === "source" ? t.target : t.source;
|
|
2064
2065
|
(rt = s.workerRef.current) == null || rt.postMessage({
|
|
2065
2066
|
type: "connecting",
|
|
2066
2067
|
data: { from: { x: B.x, y: B.y }, to: { x: B.x, y: B.y } }
|
|
2067
2068
|
});
|
|
2068
|
-
const X =
|
|
2069
|
-
var
|
|
2070
|
-
const
|
|
2071
|
-
(
|
|
2069
|
+
const X = k.getBoundingClientRect(), xt = (q) => {
|
|
2070
|
+
var ut;
|
|
2071
|
+
const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom;
|
|
2072
|
+
(ut = s.workerRef.current) == null || ut.postMessage({
|
|
2072
2073
|
type: "connecting",
|
|
2073
|
-
data: { from: { x: B.x, y: B.y }, to: { x:
|
|
2074
|
+
data: { from: { x: B.x, y: B.y }, to: { x: ot, y: lt } }
|
|
2074
2075
|
});
|
|
2075
|
-
},
|
|
2076
|
-
var
|
|
2077
|
-
const
|
|
2078
|
-
let
|
|
2079
|
-
const
|
|
2080
|
-
for (const
|
|
2081
|
-
if (
|
|
2082
|
-
const Rt =
|
|
2083
|
-
if (
|
|
2084
|
-
for (const [, Bt] of
|
|
2085
|
-
Bt.nodeId ===
|
|
2086
|
-
const Ie = ne.length > 0 ? ne :
|
|
2076
|
+
}, K = (q) => {
|
|
2077
|
+
var mt, Lt, zt, dt;
|
|
2078
|
+
const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom, ut = 20 / G.zoom;
|
|
2079
|
+
let st = null, It = null;
|
|
2080
|
+
const it = (mt = s.handleRegistryRef) == null ? void 0 : mt.current;
|
|
2081
|
+
for (const ht of s.nodesRef.current) {
|
|
2082
|
+
if (ht.hidden) continue;
|
|
2083
|
+
const Rt = ht.width || On, Nt = ht.height || Qn, gt = ht._absolutePosition || ht.position, ne = [];
|
|
2084
|
+
if (it)
|
|
2085
|
+
for (const [, Bt] of it)
|
|
2086
|
+
Bt.nodeId === ht.id && ne.push(Bt);
|
|
2087
|
+
const Ie = ne.length > 0 ? ne : ht.handles || [
|
|
2087
2088
|
{ type: "target", position: "left" },
|
|
2088
2089
|
{ type: "source", position: "right" }
|
|
2089
2090
|
];
|
|
2090
2091
|
for (const Bt of Ie) {
|
|
2091
2092
|
let Ot, Yt;
|
|
2092
2093
|
if (Bt.x !== void 0 && Bt.y !== void 0)
|
|
2093
|
-
Ot =
|
|
2094
|
+
Ot = gt.x + Bt.x, Yt = gt.y + Bt.y;
|
|
2094
2095
|
else
|
|
2095
2096
|
switch (Bt.position || (Bt.type === "source" ? "right" : "left")) {
|
|
2096
2097
|
case "top":
|
|
2097
|
-
Ot =
|
|
2098
|
+
Ot = gt.x + Rt / 2, Yt = gt.y;
|
|
2098
2099
|
break;
|
|
2099
2100
|
case "bottom":
|
|
2100
|
-
Ot =
|
|
2101
|
+
Ot = gt.x + Rt / 2, Yt = gt.y + Nt;
|
|
2101
2102
|
break;
|
|
2102
2103
|
case "left":
|
|
2103
|
-
Ot =
|
|
2104
|
+
Ot = gt.x, Yt = gt.y + Nt / 2;
|
|
2104
2105
|
break;
|
|
2105
2106
|
default:
|
|
2106
|
-
Ot =
|
|
2107
|
+
Ot = gt.x + Rt, Yt = gt.y + Nt / 2;
|
|
2107
2108
|
break;
|
|
2108
2109
|
}
|
|
2109
|
-
if (Math.abs(
|
|
2110
|
-
|
|
2110
|
+
if (Math.abs(ot - Ot) < ut && Math.abs(lt - Yt) < ut) {
|
|
2111
|
+
st = ht, It = Bt.id || null;
|
|
2111
2112
|
break;
|
|
2112
2113
|
}
|
|
2113
2114
|
}
|
|
2114
|
-
if (
|
|
2115
|
+
if (st) break;
|
|
2115
2116
|
}
|
|
2116
|
-
if (
|
|
2117
|
-
const
|
|
2118
|
-
(
|
|
2117
|
+
if (st) {
|
|
2118
|
+
const ht = v === "source" ? { source: st.id, target: j, sourceHandle: It, targetHandle: t.targetHandle } : { source: j, target: st.id, sourceHandle: t.sourceHandle, targetHandle: It };
|
|
2119
|
+
(zt = (Lt = s.onEdgesChangeRef).current) == null || zt.call(Lt, [
|
|
2119
2120
|
{ id: t.id, type: "remove" },
|
|
2120
|
-
{ type: "add", item: { id: t.id, ...
|
|
2121
|
+
{ type: "add", item: { id: t.id, ...ht } }
|
|
2121
2122
|
]);
|
|
2122
2123
|
}
|
|
2123
|
-
(
|
|
2124
|
+
(dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), k.removeEventListener("pointermove", xt), k.removeEventListener("pointerup", K);
|
|
2124
2125
|
};
|
|
2125
|
-
|
|
2126
|
-
}, [t, s]), u = n.find((v) => v.id === t.source), l = n.find((v) => v.id === t.target), y = u && !!(u.width || (g = u.measured) != null && g.width), m = l && !!(l.width || (f = l.measured) != null && f.width), C = (p = s.handleRegistryRef) == null ? void 0 : p.current, z = y ? Bn(u, "source", t.sourceHandle, C) : null, M = m ? Bn(l, "target", t.targetHandle, C) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default",
|
|
2126
|
+
k.addEventListener("pointermove", xt), k.addEventListener("pointerup", K);
|
|
2127
|
+
}, [t, s]), u = n.find((v) => v.id === t.source), l = n.find((v) => v.id === t.target), y = u && !!(u.width || (g = u.measured) != null && g.width), m = l && !!(l.width || (f = l.measured) != null && f.width), C = (p = s.handleRegistryRef) == null ? void 0 : p.current, z = y ? Bn(u, "source", t.sourceHandle, C) : null, M = m ? Bn(l, "target", t.targetHandle, C) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default", R = s.routedEdges || s.edges, E = R == null ? void 0 : R.find((v) => v.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, D = r !== !1 && t.reconnectable !== !1;
|
|
2127
2128
|
return !z || !M ? null : /* @__PURE__ */ $t(
|
|
2128
2129
|
"g",
|
|
2129
2130
|
{
|
|
@@ -2157,7 +2158,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
|
2157
2158
|
routedPoints: _
|
|
2158
2159
|
}
|
|
2159
2160
|
),
|
|
2160
|
-
D && (o || t.selected) && /* @__PURE__ */ $t(
|
|
2161
|
+
D && (o || t.selected) && /* @__PURE__ */ $t(Ne, { children: [
|
|
2161
2162
|
/* @__PURE__ */ S(
|
|
2162
2163
|
Dn,
|
|
2163
2164
|
{
|
|
@@ -2187,9 +2188,9 @@ const Dr = Zt(Br);
|
|
|
2187
2188
|
function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
2188
2189
|
var $;
|
|
2189
2190
|
const n = yt(), [r, s] = Gt(null), o = tt(null);
|
|
2190
|
-
if (
|
|
2191
|
-
const
|
|
2192
|
-
if (!
|
|
2191
|
+
if (ft(() => {
|
|
2192
|
+
const R = n.wrapRef.current;
|
|
2193
|
+
if (!R) return;
|
|
2193
2194
|
let E = !1, _ = null, D = !1;
|
|
2194
2195
|
const g = (w) => {
|
|
2195
2196
|
w.key === t && (D = !0);
|
|
@@ -2200,31 +2201,31 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
|
2200
2201
|
const P = w.target;
|
|
2201
2202
|
if (P.closest(".ric-node-wrapper") || P.closest(".ric-handle")) return;
|
|
2202
2203
|
E = !0;
|
|
2203
|
-
const
|
|
2204
|
-
_ = { x:
|
|
2204
|
+
const k = n.cameraRef.current, B = R.getBoundingClientRect(), j = (w.clientX - B.left - k.x) / k.zoom, X = (w.clientY - B.top - k.y) / k.zoom;
|
|
2205
|
+
_ = { x: j, y: X }, s({ startX: j, startY: X, endX: j, endY: X }), w.stopPropagation();
|
|
2205
2206
|
}, v = (w) => {
|
|
2206
2207
|
if (!E || !_) return;
|
|
2207
|
-
const P = n.cameraRef.current,
|
|
2208
|
-
s({ startX: _.x, startY: _.y, endX: B, endY:
|
|
2209
|
-
},
|
|
2210
|
-
var
|
|
2208
|
+
const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom;
|
|
2209
|
+
s({ startX: _.x, startY: _.y, endX: B, endY: j });
|
|
2210
|
+
}, L = (w) => {
|
|
2211
|
+
var K, rt;
|
|
2211
2212
|
if (!E || !_) return;
|
|
2212
2213
|
E = !1;
|
|
2213
|
-
const P = n.cameraRef.current,
|
|
2214
|
+
const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom, X = {
|
|
2214
2215
|
x: Math.min(_.x, B),
|
|
2215
|
-
y: Math.min(_.y,
|
|
2216
|
+
y: Math.min(_.y, j),
|
|
2216
2217
|
width: Math.abs(B - _.x),
|
|
2217
|
-
height: Math.abs(
|
|
2218
|
-
},
|
|
2219
|
-
for (const
|
|
2220
|
-
const
|
|
2221
|
-
let
|
|
2222
|
-
e === "full" ?
|
|
2218
|
+
height: Math.abs(j - _.y)
|
|
2219
|
+
}, xt = [];
|
|
2220
|
+
for (const q of n.nodesRef.current) {
|
|
2221
|
+
const G = q._absolutePosition || q.position, ot = q.width || 160, lt = q.height || 60;
|
|
2222
|
+
let ut;
|
|
2223
|
+
e === "full" ? ut = G.x >= X.x && G.y >= X.y && G.x + ot <= X.x + X.width && G.y + lt <= X.y + X.height : ut = G.x + ot > X.x && G.x < X.x + X.width && G.y + lt > X.y && G.y < X.y + X.height, xt.push({ id: q.id, type: "select", selected: ut });
|
|
2223
2224
|
}
|
|
2224
|
-
|
|
2225
|
+
xt.length && ((rt = (K = n.onNodesChangeRef).current) == null || rt.call(K, xt)), _ = null, s(null);
|
|
2225
2226
|
};
|
|
2226
|
-
return
|
|
2227
|
-
|
|
2227
|
+
return R.addEventListener("pointerdown", p, !0), R.addEventListener("pointermove", v), R.addEventListener("pointerup", L), window.addEventListener("keydown", g), window.addEventListener("keyup", f), () => {
|
|
2228
|
+
R.removeEventListener("pointerdown", p, !0), R.removeEventListener("pointermove", v), R.removeEventListener("pointerup", L), window.removeEventListener("keydown", g), window.removeEventListener("keyup", f);
|
|
2228
2229
|
};
|
|
2229
2230
|
}, [n, t, e]), !r) return null;
|
|
2230
2231
|
const i = (($ = n.cameraRef) == null ? void 0 : $.current) || { x: 0, y: 0, zoom: 1 }, c = Math.min(r.startX, r.endX), u = Math.min(r.startY, r.endY), l = Math.abs(r.endX - r.startX), y = Math.abs(r.endY - r.startY), m = c * i.zoom + i.x, C = u * i.zoom + i.y, z = l * i.zoom, M = y * i.zoom;
|
|
@@ -2294,20 +2295,20 @@ function on({
|
|
|
2294
2295
|
const m = qe(je), C = yt(), z = tt(null), M = tt(C);
|
|
2295
2296
|
M.current = C;
|
|
2296
2297
|
const $ = F(() => {
|
|
2297
|
-
var w, P,
|
|
2298
|
+
var w, P, k;
|
|
2298
2299
|
const D = z.current;
|
|
2299
2300
|
if (!D || !m) return;
|
|
2300
2301
|
const g = M.current, f = (w = g.handleRegistryRef) == null ? void 0 : w.current;
|
|
2301
2302
|
if (!f) return;
|
|
2302
|
-
const p = `${m}__${n || t}`, v = (
|
|
2303
|
-
if (
|
|
2304
|
-
const B = { nodeId: m, id: n || null, type: t, position: e, x:
|
|
2303
|
+
const p = `${m}__${n || t}`, v = (k = (P = g.cameraRef) == null ? void 0 : P.current) == null ? void 0 : k.zoom, L = Hr(D, v);
|
|
2304
|
+
if (L) {
|
|
2305
|
+
const B = { nodeId: m, id: n || null, type: t, position: e, x: L.x, y: L.y };
|
|
2305
2306
|
f.set(p, B);
|
|
2306
2307
|
}
|
|
2307
2308
|
}, [m, n, t, e]);
|
|
2308
2309
|
kr(() => {
|
|
2309
2310
|
$();
|
|
2310
|
-
}, [$]),
|
|
2311
|
+
}, [$]), ft(() => {
|
|
2311
2312
|
if (!m) return;
|
|
2312
2313
|
const D = M.current;
|
|
2313
2314
|
An(D, m);
|
|
@@ -2317,17 +2318,17 @@ function on({
|
|
|
2317
2318
|
return f && p.observe(f), () => {
|
|
2318
2319
|
var P;
|
|
2319
2320
|
p.disconnect();
|
|
2320
|
-
const v = M.current,
|
|
2321
|
-
|
|
2321
|
+
const v = M.current, L = (P = v.handleRegistryRef) == null ? void 0 : P.current, w = `${m}__${n || t}`;
|
|
2322
|
+
L == null || L.delete(w), Jn(v, m);
|
|
2322
2323
|
};
|
|
2323
2324
|
}, [m, n, t, e, $]);
|
|
2324
|
-
const
|
|
2325
|
-
var
|
|
2325
|
+
const R = F(() => {
|
|
2326
|
+
var k;
|
|
2326
2327
|
const D = M.current, g = D.nodesRef.current.find((B) => B.id === m);
|
|
2327
2328
|
if (!g) return null;
|
|
2328
|
-
const f = g._absolutePosition || g.position, p = (
|
|
2329
|
-
if (
|
|
2330
|
-
return { x: f.x +
|
|
2329
|
+
const f = g._absolutePosition || g.position, p = (k = D.handleRegistryRef) == null ? void 0 : k.current, v = `${m}__${n || t}`, L = p == null ? void 0 : p.get(v);
|
|
2330
|
+
if (L && L.x !== void 0 && L.y !== void 0)
|
|
2331
|
+
return { x: f.x + L.x, y: f.y + L.y };
|
|
2331
2332
|
const w = g.width || 160, P = g.height || 60;
|
|
2332
2333
|
switch (e) {
|
|
2333
2334
|
case "top":
|
|
@@ -2340,79 +2341,79 @@ function on({
|
|
|
2340
2341
|
return { x: f.x + w, y: f.y + P / 2 };
|
|
2341
2342
|
}
|
|
2342
2343
|
}, [m, n, t, e]), E = F((D) => {
|
|
2343
|
-
var
|
|
2344
|
+
var j;
|
|
2344
2345
|
if (!r || !s) return;
|
|
2345
2346
|
D.stopPropagation(), D.preventDefault();
|
|
2346
2347
|
const g = M.current, f = g.cameraRef.current, p = g.wrapRef.current;
|
|
2347
2348
|
if (!p) return;
|
|
2348
|
-
const v = p.getBoundingClientRect(),
|
|
2349
|
-
if (!
|
|
2350
|
-
const w =
|
|
2351
|
-
(
|
|
2349
|
+
const v = p.getBoundingClientRect(), L = R();
|
|
2350
|
+
if (!L) return;
|
|
2351
|
+
const w = L.x, P = L.y;
|
|
2352
|
+
(j = g.workerRef.current) == null || j.postMessage({
|
|
2352
2353
|
type: "connecting",
|
|
2353
2354
|
data: { from: { x: w, y: P }, to: { x: w, y: P } }
|
|
2354
2355
|
}), p.setPointerCapture(D.pointerId);
|
|
2355
|
-
const
|
|
2356
|
+
const k = (X) => {
|
|
2356
2357
|
var rt;
|
|
2357
|
-
const
|
|
2358
|
+
const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom;
|
|
2358
2359
|
(rt = g.workerRef.current) == null || rt.postMessage({
|
|
2359
2360
|
type: "connecting",
|
|
2360
|
-
data: { from: { x: w, y: P }, to: { x:
|
|
2361
|
+
data: { from: { x: w, y: P }, to: { x: xt, y: K } }
|
|
2361
2362
|
});
|
|
2362
2363
|
}, B = (X) => {
|
|
2363
|
-
var
|
|
2364
|
-
const
|
|
2365
|
-
let
|
|
2366
|
-
const
|
|
2367
|
-
for (const
|
|
2368
|
-
if (
|
|
2369
|
-
const
|
|
2370
|
-
if (
|
|
2371
|
-
for (const [, Rt] of
|
|
2372
|
-
Rt.nodeId ===
|
|
2373
|
-
const
|
|
2364
|
+
var lt, ut, st, It;
|
|
2365
|
+
const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom, rt = 20 / f.zoom;
|
|
2366
|
+
let q = null, G = null;
|
|
2367
|
+
const ot = (lt = g.handleRegistryRef) == null ? void 0 : lt.current;
|
|
2368
|
+
for (const it of g.nodesRef.current) {
|
|
2369
|
+
if (it.id === m || it.hidden) continue;
|
|
2370
|
+
const mt = it.width || 160, Lt = it.height || 60, zt = it._absolutePosition || it.position, dt = [];
|
|
2371
|
+
if (ot)
|
|
2372
|
+
for (const [, Rt] of ot)
|
|
2373
|
+
Rt.nodeId === it.id && dt.push(Rt);
|
|
2374
|
+
const ht = dt.length > 0 ? dt : it.handles || [
|
|
2374
2375
|
{ type: "target", position: "left" },
|
|
2375
2376
|
{ type: "source", position: "right" }
|
|
2376
2377
|
];
|
|
2377
|
-
for (const Rt of
|
|
2378
|
-
let
|
|
2378
|
+
for (const Rt of ht) {
|
|
2379
|
+
let Nt, gt;
|
|
2379
2380
|
if (Rt.x !== void 0 && Rt.y !== void 0)
|
|
2380
|
-
|
|
2381
|
+
Nt = zt.x + Rt.x, gt = zt.y + Rt.y;
|
|
2381
2382
|
else
|
|
2382
2383
|
switch (Rt.position || (Rt.type === "source" ? "right" : "left")) {
|
|
2383
2384
|
case "top":
|
|
2384
|
-
|
|
2385
|
+
Nt = zt.x + mt / 2, gt = zt.y;
|
|
2385
2386
|
break;
|
|
2386
2387
|
case "bottom":
|
|
2387
|
-
|
|
2388
|
+
Nt = zt.x + mt / 2, gt = zt.y + Lt;
|
|
2388
2389
|
break;
|
|
2389
2390
|
case "left":
|
|
2390
|
-
|
|
2391
|
+
Nt = zt.x, gt = zt.y + Lt / 2;
|
|
2391
2392
|
break;
|
|
2392
2393
|
default:
|
|
2393
|
-
|
|
2394
|
+
Nt = zt.x + mt, gt = zt.y + Lt / 2;
|
|
2394
2395
|
break;
|
|
2395
2396
|
}
|
|
2396
|
-
if (Math.abs(
|
|
2397
|
-
|
|
2397
|
+
if (Math.abs(xt - Nt) < rt && Math.abs(K - gt) < rt) {
|
|
2398
|
+
q = it, G = Rt.id || null;
|
|
2398
2399
|
break;
|
|
2399
2400
|
}
|
|
2400
2401
|
}
|
|
2401
|
-
if (
|
|
2402
|
+
if (q) break;
|
|
2402
2403
|
}
|
|
2403
|
-
if (
|
|
2404
|
-
const
|
|
2405
|
-
source: t === "source" ? m :
|
|
2406
|
-
target: t === "source" ?
|
|
2407
|
-
sourceHandle: t === "source" ? n || null :
|
|
2408
|
-
targetHandle: t === "source" ?
|
|
2404
|
+
if (q) {
|
|
2405
|
+
const it = {
|
|
2406
|
+
source: t === "source" ? m : q.id,
|
|
2407
|
+
target: t === "source" ? q.id : m,
|
|
2408
|
+
sourceHandle: t === "source" ? n || null : G,
|
|
2409
|
+
targetHandle: t === "source" ? G : n || null
|
|
2409
2410
|
};
|
|
2410
|
-
(
|
|
2411
|
+
(st = (ut = g.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
|
|
2411
2412
|
}
|
|
2412
|
-
(It = g.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove",
|
|
2413
|
+
(It = g.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove", k), p.removeEventListener("pointerup", B);
|
|
2413
2414
|
};
|
|
2414
|
-
p.addEventListener("pointermove",
|
|
2415
|
-
}, [m, n, t, e, r, s,
|
|
2415
|
+
p.addEventListener("pointermove", k), p.addEventListener("pointerup", B);
|
|
2416
|
+
}, [m, n, t, e, r, s, R]), _ = {
|
|
2416
2417
|
top: { top: 0, left: "50%", transform: "translate(-50%, -50%)" },
|
|
2417
2418
|
bottom: { bottom: 0, left: "50%", transform: "translate(-50%, 50%)" },
|
|
2418
2419
|
left: { top: "50%", left: 0, transform: "translate(-50%, -50%)" },
|
|
@@ -2578,7 +2579,7 @@ function Vn({
|
|
|
2578
2579
|
...y
|
|
2579
2580
|
}) {
|
|
2580
2581
|
const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
|
|
2581
|
-
return
|
|
2582
|
+
return ft(() => {
|
|
2582
2583
|
if (z.current) {
|
|
2583
2584
|
const M = z.current.getBBox();
|
|
2584
2585
|
C({
|
|
@@ -2648,7 +2649,7 @@ function un({
|
|
|
2648
2649
|
className: M = "",
|
|
2649
2650
|
...$
|
|
2650
2651
|
}) {
|
|
2651
|
-
return /* @__PURE__ */ $t(
|
|
2652
|
+
return /* @__PURE__ */ $t(Ne, { children: [
|
|
2652
2653
|
/* @__PURE__ */ S(
|
|
2653
2654
|
"path",
|
|
2654
2655
|
{
|
|
@@ -2721,43 +2722,43 @@ const tr = Zt(function({
|
|
|
2721
2722
|
labelBgBorderRadius: z,
|
|
2722
2723
|
style: M,
|
|
2723
2724
|
markerEnd: $,
|
|
2724
|
-
markerStart:
|
|
2725
|
+
markerStart: R,
|
|
2725
2726
|
interactionWidth: E
|
|
2726
2727
|
}) {
|
|
2727
2728
|
let _, D, g;
|
|
2728
|
-
const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x),
|
|
2729
|
-
let w, P,
|
|
2729
|
+
const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x), L = Math.max(50, v * 0.5);
|
|
2730
|
+
let w, P, k, B;
|
|
2730
2731
|
switch (i) {
|
|
2731
2732
|
case "left":
|
|
2732
|
-
w = f.x -
|
|
2733
|
+
w = f.x - L, P = f.y;
|
|
2733
2734
|
break;
|
|
2734
2735
|
case "top":
|
|
2735
|
-
w = f.x, P = f.y -
|
|
2736
|
+
w = f.x, P = f.y - L;
|
|
2736
2737
|
break;
|
|
2737
2738
|
case "bottom":
|
|
2738
|
-
w = f.x, P = f.y +
|
|
2739
|
+
w = f.x, P = f.y + L;
|
|
2739
2740
|
break;
|
|
2740
2741
|
default:
|
|
2741
|
-
w = f.x +
|
|
2742
|
+
w = f.x + L, P = f.y;
|
|
2742
2743
|
break;
|
|
2743
2744
|
}
|
|
2744
2745
|
switch (c) {
|
|
2745
2746
|
case "right":
|
|
2746
|
-
|
|
2747
|
+
k = p.x + L, B = p.y;
|
|
2747
2748
|
break;
|
|
2748
2749
|
case "top":
|
|
2749
|
-
|
|
2750
|
+
k = p.x, B = p.y - L;
|
|
2750
2751
|
break;
|
|
2751
2752
|
case "bottom":
|
|
2752
|
-
|
|
2753
|
+
k = p.x, B = p.y + L;
|
|
2753
2754
|
break;
|
|
2754
2755
|
default:
|
|
2755
|
-
|
|
2756
|
+
k = p.x - L, B = p.y;
|
|
2756
2757
|
break;
|
|
2757
2758
|
}
|
|
2758
|
-
_ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${
|
|
2759
|
-
const
|
|
2760
|
-
return D = X * X * X * f.x + 3 * X * X *
|
|
2759
|
+
_ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${k},${B} ${p.x},${p.y} L ${s},${o}`;
|
|
2760
|
+
const j = 0.5, X = 0.5;
|
|
2761
|
+
return D = X * X * X * f.x + 3 * X * X * j * w + 3 * X * j * j * k + j * j * j * p.x, g = X * X * X * f.y + 3 * X * X * j * P + 3 * X * j * j * B + j * j * j * p.y, /* @__PURE__ */ S(
|
|
2761
2762
|
un,
|
|
2762
2763
|
{
|
|
2763
2764
|
id: e,
|
|
@@ -2772,7 +2773,7 @@ const tr = Zt(function({
|
|
|
2772
2773
|
labelBgBorderRadius: z,
|
|
2773
2774
|
style: M,
|
|
2774
2775
|
markerEnd: $,
|
|
2775
|
-
markerStart:
|
|
2776
|
+
markerStart: R,
|
|
2776
2777
|
interactionWidth: E
|
|
2777
2778
|
}
|
|
2778
2779
|
);
|
|
@@ -2821,7 +2822,7 @@ function nr({
|
|
|
2821
2822
|
z = n - y, M = r;
|
|
2822
2823
|
break;
|
|
2823
2824
|
}
|
|
2824
|
-
const $ = `M ${t},${e} C ${m},${C} ${z},${M} ${n},${r}`,
|
|
2825
|
+
const $ = `M ${t},${e} C ${m},${C} ${z},${M} ${n},${r}`, R = 0.5, E = 1 - R, _ = E * E * E * t + 3 * E * E * R * m + 3 * E * R * R * z + R * R * R * n, D = E * E * E * e + 3 * E * E * R * C + 3 * E * R * R * M + R * R * R * r;
|
|
2825
2826
|
return [$, _, D, 0, 0];
|
|
2826
2827
|
}
|
|
2827
2828
|
function rr({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
|
|
@@ -2911,8 +2912,8 @@ function Yr(t, e, n, r, s, o, i, c) {
|
|
|
2911
2912
|
const z = (t + n) / 2, M = (e + r) / 2;
|
|
2912
2913
|
if (z > s + C && z < s + i - C && M > o + C && M < o + c - C) return !0;
|
|
2913
2914
|
const $ = [[s, o], [s + i, o], [s + i, o + c], [s, o + c]];
|
|
2914
|
-
for (let
|
|
2915
|
-
if (Ur(t, e, n, r, $[
|
|
2915
|
+
for (let R = 0; R < 4; R++)
|
|
2916
|
+
if (Ur(t, e, n, r, $[R][0], $[R][1], $[(R + 1) % 4][0], $[(R + 1) % 4][1])) return !0;
|
|
2916
2917
|
return !1;
|
|
2917
2918
|
}
|
|
2918
2919
|
function Ur(t, e, n, r, s, o, i, c) {
|
|
@@ -2957,44 +2958,44 @@ function sr(t, e, n) {
|
|
|
2957
2958
|
r.add(t.x), r.add(e.x), s.add(t.y), s.add(e.y);
|
|
2958
2959
|
const o = Ue + 5;
|
|
2959
2960
|
t.dir === "right" ? r.add(t.x + o) : t.dir === "left" ? r.add(t.x - o) : t.dir === "top" ? s.add(t.y - o) : t.dir === "bottom" && s.add(t.y + o), e.dir === "right" ? r.add(e.x + o) : e.dir === "left" ? r.add(e.x - o) : e.dir === "top" ? s.add(e.y - o) : e.dir === "bottom" && s.add(e.y + o);
|
|
2960
|
-
for (let
|
|
2961
|
-
const B = n[
|
|
2961
|
+
for (let k = 0; k < n.length; k++) {
|
|
2962
|
+
const B = n[k];
|
|
2962
2963
|
r.add(B.x), r.add(B.x + B.w), s.add(B.y), s.add(B.y + B.h);
|
|
2963
2964
|
}
|
|
2964
|
-
const i = [...r].sort((
|
|
2965
|
-
for (let
|
|
2966
|
-
for (let
|
|
2967
|
-
const y = i.length, m = c.length, C = (
|
|
2968
|
-
if (z === void 0 || M === void 0 || $ === void 0 ||
|
|
2969
|
-
const E = C(z, M), _ = C($,
|
|
2970
|
-
D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[
|
|
2971
|
-
const
|
|
2972
|
-
for (;
|
|
2973
|
-
let
|
|
2974
|
-
for (let
|
|
2975
|
-
g[
|
|
2976
|
-
const B =
|
|
2977
|
-
if (
|
|
2978
|
-
const
|
|
2979
|
-
let
|
|
2980
|
-
for (;
|
|
2981
|
-
const
|
|
2982
|
-
|
|
2965
|
+
const i = [...r].sort((k, B) => k - B), c = [...s].sort((k, B) => k - B), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
2966
|
+
for (let k = 0; k < i.length; k++) u.set(i[k], k);
|
|
2967
|
+
for (let k = 0; k < c.length; k++) l.set(c[k], k);
|
|
2968
|
+
const y = i.length, m = c.length, C = (k, B) => B * y + k, z = u.get(t.x), M = l.get(t.y), $ = u.get(e.x), R = l.get(e.y);
|
|
2969
|
+
if (z === void 0 || M === void 0 || $ === void 0 || R === void 0) return null;
|
|
2970
|
+
const E = C(z, M), _ = C($, R), D = new Float64Array(y * m).fill(1 / 0), g = new Float64Array(y * m).fill(1 / 0), f = new Int32Array(y * m).fill(-1), p = new Int8Array(y * m).fill(-1), v = new Uint8Array(y * m);
|
|
2971
|
+
D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[R] - t.y);
|
|
2972
|
+
const L = [E], w = 15, P = [[1, 0], [-1, 0], [0, 1], [0, -1]];
|
|
2973
|
+
for (; L.length > 0; ) {
|
|
2974
|
+
let k = 0;
|
|
2975
|
+
for (let q = 1; q < L.length; q++)
|
|
2976
|
+
g[L[q]] < g[L[k]] && (k = q);
|
|
2977
|
+
const B = L[k];
|
|
2978
|
+
if (L[k] = L[L.length - 1], L.pop(), B === _) {
|
|
2979
|
+
const q = [];
|
|
2980
|
+
let G = _;
|
|
2981
|
+
for (; G !== -1 && G !== E; ) {
|
|
2982
|
+
const ot = G / y | 0, lt = G % y;
|
|
2983
|
+
q.unshift({ x: i[lt], y: c[ot] }), G = f[G];
|
|
2983
2984
|
}
|
|
2984
|
-
return
|
|
2985
|
+
return q.unshift({ x: t.x, y: t.y }), jr(q, n);
|
|
2985
2986
|
}
|
|
2986
2987
|
if (v[B]) continue;
|
|
2987
2988
|
v[B] = 1;
|
|
2988
|
-
const
|
|
2989
|
-
for (let
|
|
2990
|
-
const
|
|
2991
|
-
if (
|
|
2992
|
-
const
|
|
2993
|
-
if (v[
|
|
2994
|
-
const
|
|
2995
|
-
if (qr(
|
|
2996
|
-
const It = Math.abs(
|
|
2997
|
-
|
|
2989
|
+
const j = B / y | 0, X = B % y, xt = i[X], K = c[j], rt = p[B];
|
|
2990
|
+
for (let q = 0; q < 4; q++) {
|
|
2991
|
+
const G = X + P[q][0], ot = j + P[q][1];
|
|
2992
|
+
if (G < 0 || G >= y || ot < 0 || ot >= m) continue;
|
|
2993
|
+
const lt = C(G, ot);
|
|
2994
|
+
if (v[lt]) continue;
|
|
2995
|
+
const ut = i[G], st = c[ot];
|
|
2996
|
+
if (qr(ut, st, n) || !zn(xt, K, ut, st, n)) continue;
|
|
2997
|
+
const It = Math.abs(ut - xt) + Math.abs(st - K), it = rt >= 0 && rt !== q ? w : 0, mt = D[B] + It + it;
|
|
2998
|
+
mt < D[lt] && (f[lt] = B, p[lt] = q, D[lt] = mt, g[lt] = mt + Math.abs(i[$] - ut) + Math.abs(c[R] - st), L.push(lt));
|
|
2998
2999
|
}
|
|
2999
3000
|
}
|
|
3000
3001
|
return null;
|
|
@@ -3074,8 +3075,8 @@ function En(t, e = 6, n = !1) {
|
|
|
3074
3075
|
for (let o = 1; o < t.length - 1; o++) {
|
|
3075
3076
|
const i = t[o - 1], c = t[o], u = t[o + 1], l = Math.abs(c.x - i.x) + Math.abs(c.y - i.y), y = Math.abs(u.x - c.x) + Math.abs(u.y - c.y), m = Math.min(r, l / 2, y / 2);
|
|
3076
3077
|
if (m > 0.5) {
|
|
3077
|
-
const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y,
|
|
3078
|
-
s += ` L ${c.x - C /
|
|
3078
|
+
const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y, R = Math.sqrt(C * C + z * z) || 1, E = Math.sqrt(M * M + $ * $) || 1;
|
|
3079
|
+
s += ` L ${c.x - C / R * m},${c.y - z / R * m}`, s += ` Q ${c.x},${c.y} ${c.x + M / E * m},${c.y + $ / E * m}`;
|
|
3079
3080
|
} else
|
|
3080
3081
|
s += ` L ${c.x},${c.y}`;
|
|
3081
3082
|
}
|
|
@@ -3113,26 +3114,26 @@ function Cn(t) {
|
|
|
3113
3114
|
}
|
|
3114
3115
|
return { x: t[0].x, y: t[0].y };
|
|
3115
3116
|
}
|
|
3116
|
-
function
|
|
3117
|
+
function Lo(t, e) {
|
|
3117
3118
|
if (!t || !e || t.length === 0 || e.length === 0) return e;
|
|
3118
3119
|
const n = {};
|
|
3119
3120
|
for (const o of t) n[o.id] = o;
|
|
3120
3121
|
const r = or(t, null), s = e.map((o) => {
|
|
3121
|
-
var p, v,
|
|
3122
|
+
var p, v, L, w;
|
|
3122
3123
|
const i = o.type || "default";
|
|
3123
3124
|
if (i === "bezier" || i === "simplebezier" || i === "default") return o;
|
|
3124
3125
|
const c = n[o.source], u = n[o.target];
|
|
3125
3126
|
if (!c || !u || c.hidden || u.hidden) return o;
|
|
3126
|
-
const l = Wn(c, "source", o.sourceHandle), y = Wn(u, "target", o.targetHandle), m = ln(l, cn), C = ln(y, cn), z = 5, M = r.filter((P) => P.id !== o.source && P.id !== o.target), $ = c._absolutePosition || c.position,
|
|
3127
|
-
M.push({ id: o.source, x: $.x - z, y: $.y - z, w:
|
|
3128
|
-
const _ = u._absolutePosition || u.position, D = u.width || ((
|
|
3127
|
+
const l = Wn(c, "source", o.sourceHandle), y = Wn(u, "target", o.targetHandle), m = ln(l, cn), C = ln(y, cn), z = 5, M = r.filter((P) => P.id !== o.source && P.id !== o.target), $ = c._absolutePosition || c.position, R = c.width || ((p = c.measured) == null ? void 0 : p.width) || sn, E = c.height || ((v = c.measured) == null ? void 0 : v.height) || an;
|
|
3128
|
+
M.push({ id: o.source, x: $.x - z, y: $.y - z, w: R + 2 * z, h: E + 2 * z });
|
|
3129
|
+
const _ = u._absolutePosition || u.position, D = u.width || ((L = u.measured) == null ? void 0 : L.width) || sn, g = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
|
|
3129
3130
|
if (M.push({ id: o.target, x: _.x - z, y: _.y - z, w: D + 2 * z, h: g + 2 * z }), M.length === 0) return o;
|
|
3130
3131
|
const f = sr(m, C, M);
|
|
3131
3132
|
return f && f.length >= 2 ? (f.unshift({ x: l.x, y: l.y }), f.push({ x: y.x, y: y.y }), { ...o, _routedPoints: f }) : o;
|
|
3132
3133
|
});
|
|
3133
3134
|
return Gr(s);
|
|
3134
3135
|
}
|
|
3135
|
-
function
|
|
3136
|
+
function No(t, e, n, r, s, o, i, c) {
|
|
3136
3137
|
const u = or(i, c ? new Set(c) : null);
|
|
3137
3138
|
if (u.length === 0) return null;
|
|
3138
3139
|
const l = { x: t, y: e, dir: s || "right" }, y = { x: n, y: r, dir: o || "left" }, m = ln(l, cn), C = ln(y, cn), z = sr(m, C, u);
|
|
@@ -3154,12 +3155,12 @@ const ir = Zt(function({
|
|
|
3154
3155
|
markerEnd: z,
|
|
3155
3156
|
markerStart: M,
|
|
3156
3157
|
interactionWidth: $,
|
|
3157
|
-
routedPoints:
|
|
3158
|
+
routedPoints: R
|
|
3158
3159
|
}) {
|
|
3159
3160
|
let E, _, D;
|
|
3160
|
-
if (
|
|
3161
|
-
E = En(
|
|
3162
|
-
const g = Cn(
|
|
3161
|
+
if (R && R.length >= 2) {
|
|
3162
|
+
E = En(R);
|
|
3163
|
+
const g = Cn(R);
|
|
3163
3164
|
_ = g.x, D = g.y;
|
|
3164
3165
|
} else
|
|
3165
3166
|
[E, _, D] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
|
|
@@ -3200,7 +3201,7 @@ const ar = Zt(function({
|
|
|
3200
3201
|
labelBgBorderRadius: z,
|
|
3201
3202
|
style: M,
|
|
3202
3203
|
markerEnd: $,
|
|
3203
|
-
markerStart:
|
|
3204
|
+
markerStart: R,
|
|
3204
3205
|
pathOptions: E,
|
|
3205
3206
|
interactionWidth: _,
|
|
3206
3207
|
routedPoints: D
|
|
@@ -3236,7 +3237,7 @@ const ar = Zt(function({
|
|
|
3236
3237
|
labelBgBorderRadius: z,
|
|
3237
3238
|
style: M,
|
|
3238
3239
|
markerEnd: $,
|
|
3239
|
-
markerStart:
|
|
3240
|
+
markerStart: R,
|
|
3240
3241
|
interactionWidth: _
|
|
3241
3242
|
}
|
|
3242
3243
|
);
|
|
@@ -3270,7 +3271,7 @@ const cr = Zt(function({
|
|
|
3270
3271
|
labelBgBorderRadius: z,
|
|
3271
3272
|
style: M,
|
|
3272
3273
|
markerEnd: $,
|
|
3273
|
-
markerStart:
|
|
3274
|
+
markerStart: R,
|
|
3274
3275
|
interactionWidth: E,
|
|
3275
3276
|
routedPoints: _
|
|
3276
3277
|
}) {
|
|
@@ -3301,7 +3302,7 @@ const cr = Zt(function({
|
|
|
3301
3302
|
labelBgBorderRadius: z,
|
|
3302
3303
|
style: M,
|
|
3303
3304
|
markerEnd: $,
|
|
3304
|
-
markerStart:
|
|
3305
|
+
markerStart: R,
|
|
3305
3306
|
interactionWidth: E
|
|
3306
3307
|
}
|
|
3307
3308
|
);
|
|
@@ -3339,7 +3340,7 @@ function Io({
|
|
|
3339
3340
|
fitView: M,
|
|
3340
3341
|
fitViewOptions: $,
|
|
3341
3342
|
// Node/Edge callbacks
|
|
3342
|
-
onNodesChange:
|
|
3343
|
+
onNodesChange: R,
|
|
3343
3344
|
onEdgesChange: E,
|
|
3344
3345
|
onConnect: _,
|
|
3345
3346
|
onConnectStart: D,
|
|
@@ -3347,33 +3348,33 @@ function Io({
|
|
|
3347
3348
|
onNodeClick: f,
|
|
3348
3349
|
onNodeDoubleClick: p,
|
|
3349
3350
|
onNodeMouseEnter: v,
|
|
3350
|
-
onNodeMouseMove:
|
|
3351
|
+
onNodeMouseMove: L,
|
|
3351
3352
|
onNodeMouseLeave: w,
|
|
3352
3353
|
onNodeContextMenu: P,
|
|
3353
|
-
onNodeDragStart:
|
|
3354
|
+
onNodeDragStart: k,
|
|
3354
3355
|
onNodeDrag: B,
|
|
3355
|
-
onNodeDragStop:
|
|
3356
|
+
onNodeDragStop: j,
|
|
3356
3357
|
onEdgeClick: X,
|
|
3357
|
-
onEdgeDoubleClick:
|
|
3358
|
-
onEdgeMouseEnter:
|
|
3358
|
+
onEdgeDoubleClick: xt,
|
|
3359
|
+
onEdgeMouseEnter: K,
|
|
3359
3360
|
onEdgeMouseMove: rt,
|
|
3360
|
-
onEdgeMouseLeave:
|
|
3361
|
-
onEdgeContextMenu:
|
|
3362
|
-
onPaneClick:
|
|
3363
|
-
onPaneContextMenu:
|
|
3364
|
-
onPaneMouseEnter:
|
|
3365
|
-
onPaneMouseMove:
|
|
3361
|
+
onEdgeMouseLeave: q,
|
|
3362
|
+
onEdgeContextMenu: G,
|
|
3363
|
+
onPaneClick: ot,
|
|
3364
|
+
onPaneContextMenu: lt,
|
|
3365
|
+
onPaneMouseEnter: ut,
|
|
3366
|
+
onPaneMouseMove: st,
|
|
3366
3367
|
onPaneMouseLeave: It,
|
|
3367
|
-
onSelectionChange:
|
|
3368
|
-
onInit:
|
|
3369
|
-
onMoveStart:
|
|
3370
|
-
onMove:
|
|
3371
|
-
onMoveEnd:
|
|
3372
|
-
onDelete:
|
|
3368
|
+
onSelectionChange: it,
|
|
3369
|
+
onInit: mt,
|
|
3370
|
+
onMoveStart: Lt,
|
|
3371
|
+
onMove: zt,
|
|
3372
|
+
onMoveEnd: dt,
|
|
3373
|
+
onDelete: ht,
|
|
3373
3374
|
onBeforeDelete: Rt,
|
|
3374
|
-
onError:
|
|
3375
|
+
onError: Nt,
|
|
3375
3376
|
// Drag and drop
|
|
3376
|
-
onDragOver:
|
|
3377
|
+
onDragOver: gt,
|
|
3377
3378
|
onDrop: ne,
|
|
3378
3379
|
onDragEnter: Ie,
|
|
3379
3380
|
onDragLeave: Bt,
|
|
@@ -3397,10 +3398,10 @@ function Io({
|
|
|
3397
3398
|
panOnScrollMode: dn,
|
|
3398
3399
|
panOnScrollSpeed: fn,
|
|
3399
3400
|
zoomOnScroll: Qt,
|
|
3400
|
-
zoomOnDoubleClick:
|
|
3401
|
+
zoomOnDoubleClick: Ln,
|
|
3401
3402
|
zoomOnPinch: hn,
|
|
3402
3403
|
preventScrolling: fe,
|
|
3403
|
-
translateExtent:
|
|
3404
|
+
translateExtent: vt,
|
|
3404
3405
|
nodeExtent: Te,
|
|
3405
3406
|
autoPanOnNodeDrag: Et,
|
|
3406
3407
|
autoPanOnConnect: pt,
|
|
@@ -3426,8 +3427,8 @@ function Io({
|
|
|
3426
3427
|
[te]
|
|
3427
3428
|
), ae = St(() => ({ ...Qr, ...r }), [r]), Kt = St(() => ({ ...Kr, ...s }), [s]), he = St(() => {
|
|
3428
3429
|
const Q = e.filter((Ft) => Ft.type && ae[Ft.type]);
|
|
3429
|
-
return Q.sort((Ft,
|
|
3430
|
-
const Tt = Ft.type === "group" || !Ft.parentId && Q.some((Ee) => Ee.parentId === Ft.id), xe =
|
|
3430
|
+
return Q.sort((Ft, at) => {
|
|
3431
|
+
const Tt = Ft.type === "group" || !Ft.parentId && Q.some((Ee) => Ee.parentId === Ft.id), xe = at.type === "group" || !at.parentId && Q.some((Ee) => Ee.parentId === at.id);
|
|
3431
3432
|
return Tt && !xe ? -1 : !Tt && xe ? 1 : 0;
|
|
3432
3433
|
});
|
|
3433
3434
|
}, [e, ae]), ke = St(() => n.filter((Q) => Q.type && Kt[Q.type]), [n, Kt]), O = St(() => e.map((Q) => Q.type && ae[Q.type] ? { ...Q, _customRendered: !0 } : Q), [e, ae]), bt = St(() => n.map((Q) => Q.type && Kt[Q.type] ? { ...Q, _customRendered: !0 } : Q), [n, Kt]), {
|
|
@@ -3438,7 +3439,7 @@ function Io({
|
|
|
3438
3439
|
onPointerMove: He,
|
|
3439
3440
|
onPointerUp: _e,
|
|
3440
3441
|
store: le
|
|
3441
|
-
} =
|
|
3442
|
+
} = Nr({
|
|
3442
3443
|
cards: t,
|
|
3443
3444
|
nodes: O,
|
|
3444
3445
|
edges: bt,
|
|
@@ -3451,7 +3452,7 @@ function Io({
|
|
|
3451
3452
|
fitViewOptions: $,
|
|
3452
3453
|
onHudUpdate: Ve,
|
|
3453
3454
|
onNodesProcessed: gn,
|
|
3454
|
-
onNodesChange:
|
|
3455
|
+
onNodesChange: R,
|
|
3455
3456
|
onEdgesChange: E,
|
|
3456
3457
|
onConnect: _,
|
|
3457
3458
|
onConnectStart: D,
|
|
@@ -3459,31 +3460,31 @@ function Io({
|
|
|
3459
3460
|
onNodeClick: f,
|
|
3460
3461
|
onNodeDoubleClick: p,
|
|
3461
3462
|
onNodeMouseEnter: v,
|
|
3462
|
-
onNodeMouseMove:
|
|
3463
|
+
onNodeMouseMove: L,
|
|
3463
3464
|
onNodeMouseLeave: w,
|
|
3464
3465
|
onNodeContextMenu: P,
|
|
3465
|
-
onNodeDragStart:
|
|
3466
|
+
onNodeDragStart: k,
|
|
3466
3467
|
onNodeDrag: B,
|
|
3467
|
-
onNodeDragStop:
|
|
3468
|
+
onNodeDragStop: j,
|
|
3468
3469
|
onEdgeClick: X,
|
|
3469
|
-
onEdgeDoubleClick:
|
|
3470
|
-
onEdgeMouseEnter:
|
|
3470
|
+
onEdgeDoubleClick: xt,
|
|
3471
|
+
onEdgeMouseEnter: K,
|
|
3471
3472
|
onEdgeMouseMove: rt,
|
|
3472
|
-
onEdgeMouseLeave:
|
|
3473
|
-
onEdgeContextMenu:
|
|
3474
|
-
onPaneClick:
|
|
3475
|
-
onPaneContextMenu:
|
|
3476
|
-
onPaneMouseEnter:
|
|
3477
|
-
onPaneMouseMove:
|
|
3473
|
+
onEdgeMouseLeave: q,
|
|
3474
|
+
onEdgeContextMenu: G,
|
|
3475
|
+
onPaneClick: ot,
|
|
3476
|
+
onPaneContextMenu: lt,
|
|
3477
|
+
onPaneMouseEnter: ut,
|
|
3478
|
+
onPaneMouseMove: st,
|
|
3478
3479
|
onPaneMouseLeave: It,
|
|
3479
|
-
onSelectionChange:
|
|
3480
|
-
onInit:
|
|
3481
|
-
onMoveStart:
|
|
3482
|
-
onMove:
|
|
3483
|
-
onMoveEnd:
|
|
3484
|
-
onDelete:
|
|
3480
|
+
onSelectionChange: it,
|
|
3481
|
+
onInit: mt,
|
|
3482
|
+
onMoveStart: Lt,
|
|
3483
|
+
onMove: zt,
|
|
3484
|
+
onMoveEnd: dt,
|
|
3485
|
+
onDelete: ht,
|
|
3485
3486
|
onBeforeDelete: Rt,
|
|
3486
|
-
onError:
|
|
3487
|
+
onError: Nt,
|
|
3487
3488
|
nodesDraggable: Ot,
|
|
3488
3489
|
nodesConnectable: Yt,
|
|
3489
3490
|
elementsSelectable: me,
|
|
@@ -3503,10 +3504,10 @@ function Io({
|
|
|
3503
3504
|
panOnScrollMode: dn,
|
|
3504
3505
|
panOnScrollSpeed: fn,
|
|
3505
3506
|
zoomOnScroll: Qt,
|
|
3506
|
-
zoomOnDoubleClick:
|
|
3507
|
+
zoomOnDoubleClick: Ln,
|
|
3507
3508
|
zoomOnPinch: hn,
|
|
3508
3509
|
preventScrolling: fe,
|
|
3509
|
-
translateExtent:
|
|
3510
|
+
translateExtent: vt,
|
|
3510
3511
|
nodeExtent: Te,
|
|
3511
3512
|
autoPanOnNodeDrag: Et,
|
|
3512
3513
|
autoPanOnConnect: pt,
|
|
@@ -3526,10 +3527,10 @@ function Io({
|
|
|
3526
3527
|
return n;
|
|
3527
3528
|
}
|
|
3528
3529
|
}), [le, e, n]), ye = tt(null), ge = tt(null), pe = tt(null), Jt = tt(null);
|
|
3529
|
-
|
|
3530
|
+
ft(() => {
|
|
3530
3531
|
let Q;
|
|
3531
3532
|
const Ft = () => {
|
|
3532
|
-
const
|
|
3533
|
+
const at = le.cameraRef.current, Tt = `translate(${at.x}px, ${at.y}px) scale(${at.zoom})`, xe = `translate(${at.x}, ${at.y}) scale(${at.zoom})`;
|
|
3533
3534
|
ye.current && (ye.current.style.transform = Tt), ge.current && ge.current.setAttribute("transform", xe), pe.current && (pe.current.style.transform = Tt), Jt.current && (Jt.current.style.transform = Tt), Q = requestAnimationFrame(Ft);
|
|
3534
3535
|
};
|
|
3535
3536
|
return Q = requestAnimationFrame(Ft), () => cancelAnimationFrame(Q);
|
|
@@ -3544,7 +3545,7 @@ function Io({
|
|
|
3544
3545
|
onPointerDown: Ae,
|
|
3545
3546
|
onPointerMove: He,
|
|
3546
3547
|
onPointerUp: _e,
|
|
3547
|
-
onDragOver:
|
|
3548
|
+
onDragOver: gt,
|
|
3548
3549
|
onDrop: ne,
|
|
3549
3550
|
onDragEnter: Ie,
|
|
3550
3551
|
onDragLeave: Bt,
|
|
@@ -3649,11 +3650,11 @@ function Io({
|
|
|
3649
3650
|
") zoom: ",
|
|
3650
3651
|
Ut.zoom,
|
|
3651
3652
|
"x",
|
|
3652
|
-
Ut.nodeCount > 0 && /* @__PURE__ */ $t(
|
|
3653
|
+
Ut.nodeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
|
|
3653
3654
|
" nodes: ",
|
|
3654
3655
|
Ut.nodeCount
|
|
3655
3656
|
] }),
|
|
3656
|
-
Ut.edgeCount > 0 && /* @__PURE__ */ $t(
|
|
3657
|
+
Ut.edgeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
|
|
3657
3658
|
" edges: ",
|
|
3658
3659
|
Ut.edgeCount
|
|
3659
3660
|
] })
|
|
@@ -3747,7 +3748,7 @@ function So(t) {
|
|
|
3747
3748
|
}
|
|
3748
3749
|
function eo() {
|
|
3749
3750
|
const t = yt(), e = F(() => [...t.nodesRef.current], [t]), n = F(() => [...t.edgesRef.current], [t]), r = F((g) => t.nodesRef.current.find((f) => f.id === g), [t]), s = F((g) => t.edgesRef.current.find((f) => f.id === g), [t]), o = F((g) => {
|
|
3750
|
-
var f, p, v,
|
|
3751
|
+
var f, p, v, L;
|
|
3751
3752
|
if (typeof g == "function") {
|
|
3752
3753
|
const w = g(t.nodesRef.current);
|
|
3753
3754
|
(p = (f = t.onNodesChangeRef).current) == null || p.call(f, [
|
|
@@ -3755,12 +3756,12 @@ function eo() {
|
|
|
3755
3756
|
...w.map((P) => ({ type: "add", item: P }))
|
|
3756
3757
|
]);
|
|
3757
3758
|
} else
|
|
3758
|
-
(
|
|
3759
|
+
(L = (v = t.onNodesChangeRef).current) == null || L.call(v, [
|
|
3759
3760
|
...t.nodesRef.current.map((w) => ({ id: w.id, type: "remove" })),
|
|
3760
3761
|
...g.map((w) => ({ type: "add", item: w }))
|
|
3761
3762
|
]);
|
|
3762
3763
|
}, [t]), i = F((g) => {
|
|
3763
|
-
var f, p, v,
|
|
3764
|
+
var f, p, v, L;
|
|
3764
3765
|
if (typeof g == "function") {
|
|
3765
3766
|
const w = g(t.edgesRef.current);
|
|
3766
3767
|
(p = (f = t.onEdgesChangeRef).current) == null || p.call(f, [
|
|
@@ -3768,18 +3769,18 @@ function eo() {
|
|
|
3768
3769
|
...w.map((P) => ({ type: "add", item: P }))
|
|
3769
3770
|
]);
|
|
3770
3771
|
} else
|
|
3771
|
-
(
|
|
3772
|
+
(L = (v = t.onEdgesChangeRef).current) == null || L.call(v, [
|
|
3772
3773
|
...t.edgesRef.current.map((w) => ({ id: w.id, type: "remove" })),
|
|
3773
3774
|
...g.map((w) => ({ type: "add", item: w }))
|
|
3774
3775
|
]);
|
|
3775
3776
|
}, [t]), c = F((g) => {
|
|
3776
3777
|
var p, v;
|
|
3777
3778
|
const f = Array.isArray(g) ? g : [g];
|
|
3778
|
-
(v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((
|
|
3779
|
+
(v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
|
|
3779
3780
|
}, [t]), u = F((g) => {
|
|
3780
3781
|
var p, v;
|
|
3781
3782
|
const f = Array.isArray(g) ? g : [g];
|
|
3782
|
-
(v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((
|
|
3783
|
+
(v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
|
|
3783
3784
|
}, [t]), l = F(({ nodes: g = [], edges: f = [] }) => {
|
|
3784
3785
|
if (g.length && t.onNodesChangeRef.current) {
|
|
3785
3786
|
t.onNodesChangeRef.current(g.map((v) => ({ id: v.id, type: "remove" })));
|
|
@@ -3799,34 +3800,34 @@ function eo() {
|
|
|
3799
3800
|
}, [t]), C = F(() => t.cameraRef.current.zoom, [t]), z = F((g) => {
|
|
3800
3801
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3801
3802
|
if (!p) return;
|
|
3802
|
-
const v = p.getBoundingClientRect(),
|
|
3803
|
-
f.x =
|
|
3803
|
+
const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1.2;
|
|
3804
|
+
f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, f.zoom * P), t.sendCamera();
|
|
3804
3805
|
}, [t]), M = F((g) => {
|
|
3805
3806
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3806
3807
|
if (!p) return;
|
|
3807
|
-
const v = p.getBoundingClientRect(),
|
|
3808
|
-
f.x =
|
|
3808
|
+
const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1 / 1.2;
|
|
3809
|
+
f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.max(t.zoomMin, f.zoom * P), t.sendCamera();
|
|
3809
3810
|
}, [t]), $ = F((g) => {
|
|
3810
3811
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3811
3812
|
if (!p) return;
|
|
3812
|
-
const v = p.getBoundingClientRect(),
|
|
3813
|
-
f.x =
|
|
3814
|
-
}, [t]),
|
|
3813
|
+
const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = g / f.zoom;
|
|
3814
|
+
f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, g)), t.sendCamera();
|
|
3815
|
+
}, [t]), R = F((g = {}) => {
|
|
3815
3816
|
const f = t.nodesRef.current;
|
|
3816
3817
|
if (!f.length) return;
|
|
3817
3818
|
const p = t.wrapRef.current;
|
|
3818
3819
|
if (!p) return;
|
|
3819
|
-
const v = p.getBoundingClientRect(),
|
|
3820
|
+
const v = p.getBoundingClientRect(), L = g.padding ?? 0.1, w = g.nodes ? f.filter((B) => g.nodes.some((j) => j.id === B.id)) : f;
|
|
3820
3821
|
if (!w.length) return;
|
|
3821
|
-
const P = Mn(w),
|
|
3822
|
-
g.maxZoom && (
|
|
3822
|
+
const P = Mn(w), k = Rn(P, v.width, v.height, L);
|
|
3823
|
+
g.maxZoom && (k.zoom = Math.min(k.zoom, g.maxZoom)), g.minZoom && (k.zoom = Math.max(k.zoom, g.minZoom)), t.cameraRef.current = k, t.sendCamera();
|
|
3823
3824
|
}, [t]), E = F((g, f, p = {}) => {
|
|
3824
3825
|
const v = t.wrapRef.current;
|
|
3825
3826
|
if (!v) return;
|
|
3826
|
-
const
|
|
3827
|
+
const L = v.getBoundingClientRect(), w = p.zoom ?? t.cameraRef.current.zoom;
|
|
3827
3828
|
t.cameraRef.current = {
|
|
3828
|
-
x:
|
|
3829
|
-
y:
|
|
3829
|
+
x: L.width / 2 - g * w,
|
|
3830
|
+
y: L.height / 2 - f * w,
|
|
3830
3831
|
zoom: w
|
|
3831
3832
|
}, t.sendCamera();
|
|
3832
3833
|
}, [t]), _ = F((g) => t.screenToWorld(g.x, g.y), [t]), D = F((g) => {
|
|
@@ -3854,7 +3855,7 @@ function eo() {
|
|
|
3854
3855
|
zoomIn: z,
|
|
3855
3856
|
zoomOut: M,
|
|
3856
3857
|
zoomTo: $,
|
|
3857
|
-
fitView:
|
|
3858
|
+
fitView: R,
|
|
3858
3859
|
setCenter: E,
|
|
3859
3860
|
screenToFlowPosition: _,
|
|
3860
3861
|
flowToScreenPosition: D
|
|
@@ -3889,13 +3890,13 @@ function Xo({ nodeId: t, type: e, handleId: n }) {
|
|
|
3889
3890
|
}
|
|
3890
3891
|
function Fo({ onChange: t, onStart: e, onEnd: n }) {
|
|
3891
3892
|
const r = yt(), s = tt(t), o = tt(e), i = tt(n);
|
|
3892
|
-
|
|
3893
|
+
ft(() => {
|
|
3893
3894
|
s.current = t;
|
|
3894
|
-
}, [t]),
|
|
3895
|
+
}, [t]), ft(() => {
|
|
3895
3896
|
o.current = e;
|
|
3896
|
-
}, [e]),
|
|
3897
|
+
}, [e]), ft(() => {
|
|
3897
3898
|
i.current = n;
|
|
3898
|
-
}, [n]),
|
|
3899
|
+
}, [n]), ft(() => {
|
|
3899
3900
|
const c = (u) => {
|
|
3900
3901
|
var l;
|
|
3901
3902
|
(l = s.current) == null || l.call(s, { x: u.x, y: u.y, zoom: u.zoom });
|
|
@@ -3905,9 +3906,9 @@ function Fo({ onChange: t, onStart: e, onEnd: n }) {
|
|
|
3905
3906
|
}
|
|
3906
3907
|
function Yo({ onChange: t }) {
|
|
3907
3908
|
const e = yt(), n = tt(t);
|
|
3908
|
-
|
|
3909
|
+
ft(() => {
|
|
3909
3910
|
n.current = t;
|
|
3910
|
-
}, [t]),
|
|
3911
|
+
}, [t]), ft(() => {
|
|
3911
3912
|
const r = (s) => {
|
|
3912
3913
|
var o;
|
|
3913
3914
|
(o = n.current) == null || o.call(n, s);
|
|
@@ -3917,7 +3918,7 @@ function Yo({ onChange: t }) {
|
|
|
3917
3918
|
}
|
|
3918
3919
|
function Uo(t) {
|
|
3919
3920
|
const [e, n] = Gt(!1), r = Array.isArray(t) ? t : [t];
|
|
3920
|
-
return
|
|
3921
|
+
return ft(() => {
|
|
3921
3922
|
const s = (i) => {
|
|
3922
3923
|
r.includes(i.key) && n(!0);
|
|
3923
3924
|
}, o = (i) => {
|
|
@@ -3975,34 +3976,34 @@ function Qo({
|
|
|
3975
3976
|
m.width = t * z, m.height = e * z, C.scale(z, z), C.clearRect(0, 0, t, e);
|
|
3976
3977
|
const M = c.nodesRef.current;
|
|
3977
3978
|
if (!M.length) return;
|
|
3978
|
-
let $ = 1 / 0,
|
|
3979
|
-
for (const
|
|
3980
|
-
const B =
|
|
3981
|
-
|
|
3979
|
+
let $ = 1 / 0, R = 1 / 0, E = -1 / 0, _ = -1 / 0;
|
|
3980
|
+
for (const k of M) {
|
|
3981
|
+
const B = k.width || wn, j = k.height || bn;
|
|
3982
|
+
k.position.x < $ && ($ = k.position.x), k.position.y < R && (R = k.position.y), k.position.x + B > E && (E = k.position.x + B), k.position.y + j > _ && (_ = k.position.y + j);
|
|
3982
3983
|
}
|
|
3983
3984
|
const D = 40;
|
|
3984
|
-
$ -= D,
|
|
3985
|
-
const g = E - $, f = _ -
|
|
3986
|
-
for (const
|
|
3987
|
-
if (
|
|
3988
|
-
const B =
|
|
3989
|
-
C.fillStyle =
|
|
3985
|
+
$ -= D, R -= D, E += D, _ += D;
|
|
3986
|
+
const g = E - $, f = _ - R, p = Math.min(t / g, e / f), v = (t - g * p) / 2, L = (e - f * p) / 2;
|
|
3987
|
+
for (const k of M) {
|
|
3988
|
+
if (k.hidden) continue;
|
|
3989
|
+
const B = k.width || wn, j = k.height || bn, X = (k.position.x - $) * p + v, xt = (k.position.y - R) * p + L, K = B * p, rt = j * p;
|
|
3990
|
+
C.fillStyle = k.selected ? "#f59e0b" : typeof n == "function" ? n(k) : n, C.fillRect(X, xt, Math.max(K, 2), Math.max(rt, 2));
|
|
3990
3991
|
}
|
|
3991
3992
|
const w = c.cameraRef.current, P = c.wrapRef.current;
|
|
3992
3993
|
if (P) {
|
|
3993
|
-
const
|
|
3994
|
+
const k = P.getBoundingClientRect(), B = -w.x / w.zoom, j = -w.y / w.zoom, X = k.width / w.zoom, xt = k.height / w.zoom;
|
|
3994
3995
|
C.fillStyle = s, C.fillRect(0, 0, t, e);
|
|
3995
|
-
const
|
|
3996
|
-
C.clearRect(
|
|
3997
|
-
for (const
|
|
3998
|
-
if (
|
|
3999
|
-
const
|
|
4000
|
-
C.fillStyle =
|
|
3996
|
+
const K = (B - $) * p + v, rt = (j - R) * p + L, q = X * p, G = xt * p;
|
|
3997
|
+
C.clearRect(K, rt, q, G);
|
|
3998
|
+
for (const ot of M) {
|
|
3999
|
+
if (ot.hidden) continue;
|
|
4000
|
+
const lt = ot.width || wn, ut = ot.height || bn, st = (ot.position.x - $) * p + v, It = (ot.position.y - R) * p + L;
|
|
4001
|
+
C.fillStyle = ot.selected ? "#f59e0b" : typeof n == "function" ? n(ot) : n, C.fillRect(st, It, Math.max(lt * p, 2), Math.max(ut * p, 2));
|
|
4001
4002
|
}
|
|
4002
|
-
C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(
|
|
4003
|
+
C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(K, rt, q, G);
|
|
4003
4004
|
}
|
|
4004
4005
|
}, [c, t, e, n, r, s]);
|
|
4005
|
-
return
|
|
4006
|
+
return ft(() => {
|
|
4006
4007
|
let m = !0;
|
|
4007
4008
|
function C() {
|
|
4008
4009
|
m && (y(), l.current = requestAnimationFrame(C));
|
|
@@ -4084,16 +4085,16 @@ function ao({
|
|
|
4084
4085
|
"aria-label": C = "Canvas controls",
|
|
4085
4086
|
children: z
|
|
4086
4087
|
}) {
|
|
4087
|
-
const M = yt(), { zoomIn: $, zoomOut:
|
|
4088
|
+
const M = yt(), { zoomIn: $, zoomOut: R, fitView: E, getZoom: _ } = eo(), [D, g] = Gt(!0), f = _() <= M.zoomMin, p = _() >= M.zoomMax, v = F(() => {
|
|
4088
4089
|
$(), s == null || s();
|
|
4089
|
-
}, [$, s]),
|
|
4090
|
-
|
|
4091
|
-
}, [
|
|
4090
|
+
}, [$, s]), L = F(() => {
|
|
4091
|
+
R(), o == null || o();
|
|
4092
|
+
}, [R, o]), w = F(() => {
|
|
4092
4093
|
E(r || { padding: 0.1 }), i == null || i();
|
|
4093
4094
|
}, [E, r, i]), P = F(() => {
|
|
4094
4095
|
const B = !D;
|
|
4095
4096
|
g(B), c == null || c(B);
|
|
4096
|
-
}, [D, c]),
|
|
4097
|
+
}, [D, c]), k = {
|
|
4097
4098
|
"top-left": { top: 10, left: 10 },
|
|
4098
4099
|
"top-right": { top: 10, right: 10 },
|
|
4099
4100
|
"top-center": { top: 10, left: "50%", transform: "translateX(-50%)" },
|
|
@@ -4111,13 +4112,13 @@ function ao({
|
|
|
4111
4112
|
flexDirection: l === "horizontal" ? "row" : "column",
|
|
4112
4113
|
gap: 2,
|
|
4113
4114
|
zIndex: 5,
|
|
4114
|
-
...
|
|
4115
|
+
...k,
|
|
4115
4116
|
...y
|
|
4116
4117
|
},
|
|
4117
4118
|
role: "toolbar",
|
|
4118
4119
|
"aria-label": C,
|
|
4119
4120
|
children: [
|
|
4120
|
-
t && /* @__PURE__ */ $t(
|
|
4121
|
+
t && /* @__PURE__ */ $t(Ne, { children: [
|
|
4121
4122
|
/* @__PURE__ */ S(
|
|
4122
4123
|
rn,
|
|
4123
4124
|
{
|
|
@@ -4132,7 +4133,7 @@ function ao({
|
|
|
4132
4133
|
/* @__PURE__ */ S(
|
|
4133
4134
|
rn,
|
|
4134
4135
|
{
|
|
4135
|
-
onClick:
|
|
4136
|
+
onClick: L,
|
|
4136
4137
|
disabled: f,
|
|
4137
4138
|
title: "Zoom out",
|
|
4138
4139
|
"aria-label": "Zoom out",
|
|
@@ -4250,20 +4251,20 @@ function ts({
|
|
|
4250
4251
|
height: D.height || 60
|
|
4251
4252
|
}, u == null || u(E, { width: z.current.width, height: z.current.height });
|
|
4252
4253
|
const g = (p) => {
|
|
4253
|
-
var
|
|
4254
|
+
var j, X;
|
|
4254
4255
|
if (!z.current) return;
|
|
4255
|
-
const v = z.current,
|
|
4256
|
-
let
|
|
4257
|
-
v.direction.includes("e") && (
|
|
4258
|
-
{ id: m, type: "dimensions", dimensions: { width:
|
|
4259
|
-
]), l == null || l(p, { width:
|
|
4256
|
+
const v = z.current, L = C.cameraRef.current, w = (p.clientX - v.startX) / L.zoom, P = (p.clientY - v.startY) / L.zoom;
|
|
4257
|
+
let k = v.width, B = v.height;
|
|
4258
|
+
v.direction.includes("e") && (k = Math.min(n, Math.max(t, v.width + w))), v.direction.includes("w") && (k = Math.min(n, Math.max(t, v.width - w))), v.direction.includes("s") && (B = Math.min(r, Math.max(e, v.height + P))), v.direction.includes("n") && (B = Math.min(r, Math.max(e, v.height - P))), (X = (j = C.onNodesChangeRef).current) == null || X.call(j, [
|
|
4259
|
+
{ id: m, type: "dimensions", dimensions: { width: k, height: B }, setAttributes: !0 }
|
|
4260
|
+
]), l == null || l(p, { width: k, height: B });
|
|
4260
4261
|
}, f = (p) => {
|
|
4261
4262
|
z.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
|
|
4262
4263
|
};
|
|
4263
4264
|
window.addEventListener("pointermove", g), window.addEventListener("pointerup", f);
|
|
4264
4265
|
}, [m, C, t, e, n, r, u, l, y]);
|
|
4265
4266
|
if (!s) return null;
|
|
4266
|
-
const $ = 8,
|
|
4267
|
+
const $ = 8, R = {
|
|
4267
4268
|
position: "absolute",
|
|
4268
4269
|
width: $,
|
|
4269
4270
|
height: $,
|
|
@@ -4273,60 +4274,60 @@ function ts({
|
|
|
4273
4274
|
zIndex: 20,
|
|
4274
4275
|
...o
|
|
4275
4276
|
};
|
|
4276
|
-
return /* @__PURE__ */ $t(
|
|
4277
|
+
return /* @__PURE__ */ $t(Ne, { children: [
|
|
4277
4278
|
/* @__PURE__ */ S(
|
|
4278
4279
|
"div",
|
|
4279
4280
|
{
|
|
4280
|
-
style: { ...
|
|
4281
|
+
style: { ...R, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
|
|
4281
4282
|
onPointerDown: (E) => M(E, "se")
|
|
4282
4283
|
}
|
|
4283
4284
|
),
|
|
4284
4285
|
/* @__PURE__ */ S(
|
|
4285
4286
|
"div",
|
|
4286
4287
|
{
|
|
4287
|
-
style: { ...
|
|
4288
|
+
style: { ...R, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
|
|
4288
4289
|
onPointerDown: (E) => M(E, "sw")
|
|
4289
4290
|
}
|
|
4290
4291
|
),
|
|
4291
4292
|
/* @__PURE__ */ S(
|
|
4292
4293
|
"div",
|
|
4293
4294
|
{
|
|
4294
|
-
style: { ...
|
|
4295
|
+
style: { ...R, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
|
|
4295
4296
|
onPointerDown: (E) => M(E, "ne")
|
|
4296
4297
|
}
|
|
4297
4298
|
),
|
|
4298
4299
|
/* @__PURE__ */ S(
|
|
4299
4300
|
"div",
|
|
4300
4301
|
{
|
|
4301
|
-
style: { ...
|
|
4302
|
+
style: { ...R, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
|
|
4302
4303
|
onPointerDown: (E) => M(E, "nw")
|
|
4303
4304
|
}
|
|
4304
4305
|
),
|
|
4305
4306
|
/* @__PURE__ */ S(
|
|
4306
4307
|
"div",
|
|
4307
4308
|
{
|
|
4308
|
-
style: { ...
|
|
4309
|
+
style: { ...R, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
|
|
4309
4310
|
onPointerDown: (E) => M(E, "e")
|
|
4310
4311
|
}
|
|
4311
4312
|
),
|
|
4312
4313
|
/* @__PURE__ */ S(
|
|
4313
4314
|
"div",
|
|
4314
4315
|
{
|
|
4315
|
-
style: { ...
|
|
4316
|
+
style: { ...R, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
|
|
4316
4317
|
onPointerDown: (E) => M(E, "w")
|
|
4317
4318
|
}
|
|
4318
4319
|
),
|
|
4319
4320
|
/* @__PURE__ */ S(
|
|
4320
4321
|
"div",
|
|
4321
4322
|
{
|
|
4322
|
-
style: { ...
|
|
4323
|
+
style: { ...R, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
|
|
4323
4324
|
onPointerDown: (E) => M(E, "n")
|
|
4324
4325
|
}
|
|
4325
4326
|
),
|
|
4326
4327
|
/* @__PURE__ */ S(
|
|
4327
4328
|
"div",
|
|
4328
4329
|
{
|
|
4329
|
-
style: { ...
|
|
4330
|
+
style: { ...R, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
|
|
4330
4331
|
onPointerDown: (E) => M(E, "s")
|
|
4331
4332
|
}
|
|
4332
4333
|
)
|
|
@@ -4528,7 +4529,7 @@ export {
|
|
|
4528
4529
|
vo as boxToRect,
|
|
4529
4530
|
or as buildObstacles,
|
|
4530
4531
|
Tn as clampPosition,
|
|
4531
|
-
|
|
4532
|
+
Lo as computeRoutedEdges,
|
|
4532
4533
|
zo as getBezierEdgeCenter,
|
|
4533
4534
|
nr as getBezierPath,
|
|
4534
4535
|
wo as getBoundsOfBoxes,
|
|
@@ -4551,14 +4552,14 @@ export {
|
|
|
4551
4552
|
Mo as nodeToRect,
|
|
4552
4553
|
Co as reconnectEdge,
|
|
4553
4554
|
mo as rectToBox,
|
|
4554
|
-
|
|
4555
|
+
No as routeSinglePath,
|
|
4555
4556
|
En as routedPointsToPath,
|
|
4556
4557
|
Pn as snapPosition,
|
|
4557
4558
|
Ho as useConnection,
|
|
4558
4559
|
Do as useEdges,
|
|
4559
4560
|
So as useEdgesState,
|
|
4560
4561
|
Xo as useHandleConnections,
|
|
4561
|
-
|
|
4562
|
+
Nr as useInfiniteCanvas,
|
|
4562
4563
|
Go as useInternalNode,
|
|
4563
4564
|
Uo as useKeyPress,
|
|
4564
4565
|
Wo as useNodeConnections,
|