@infinit-canvas/react 0.1.4 → 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 +537 -537
- 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,22 +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
1850
|
M.stopPropagation();
|
|
1851
1851
|
const $ = M.target.tagName;
|
|
1852
|
-
if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || M.target.isContentEditable) return;
|
|
1853
|
-
let
|
|
1854
|
-
for (;
|
|
1855
|
-
if ((B =
|
|
1856
|
-
|
|
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;
|
|
1857
1857
|
}
|
|
1858
1858
|
if (n.onNodesChangeRef.current) {
|
|
1859
1859
|
const K = [];
|
|
1860
1860
|
if (M.shiftKey)
|
|
1861
1861
|
K.push({ id: t.id, type: "select", selected: !t.selected });
|
|
1862
1862
|
else
|
|
1863
|
-
for (const
|
|
1864
|
-
|
|
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 });
|
|
1865
1865
|
K.length && n.onNodesChangeRef.current(K);
|
|
1866
1866
|
}
|
|
1867
1867
|
const E = n.cameraRef.current, _ = n.wrapRef.current;
|
|
@@ -1872,53 +1872,53 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1872
1872
|
startMouse: { x: g, y: f },
|
|
1873
1873
|
selectedStarts: v
|
|
1874
1874
|
};
|
|
1875
|
-
const
|
|
1875
|
+
const L = [{ id: t.id, type: "position", dragging: !0 }];
|
|
1876
1876
|
for (const K of v)
|
|
1877
|
-
|
|
1878
|
-
(
|
|
1877
|
+
L.push({ id: K.id, type: "position", dragging: !0 });
|
|
1878
|
+
(xt = (X = n.onNodesChangeRef).current) == null || xt.call(X, L);
|
|
1879
1879
|
const w = r.current;
|
|
1880
1880
|
w && w.setPointerCapture(M.pointerId);
|
|
1881
1881
|
const P = (K) => {
|
|
1882
|
-
var
|
|
1882
|
+
var it, mt, Lt, zt;
|
|
1883
1883
|
if (!o.current) return;
|
|
1884
|
-
const
|
|
1885
|
-
let
|
|
1886
|
-
if (n.snapToGrid && n.snapGrid && (
|
|
1887
|
-
x: n.snapGrid[0] * Math.round(
|
|
1888
|
-
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])
|
|
1889
1889
|
}), t.parentId && t.extent === "parent") {
|
|
1890
|
-
const
|
|
1891
|
-
if (
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1894
|
-
x: Math.max(0, Math.min(
|
|
1895
|
-
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))
|
|
1896
1896
|
};
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1900
|
-
for (const
|
|
1901
|
-
let
|
|
1902
|
-
n.snapToGrid && n.snapGrid && (
|
|
1903
|
-
x: n.snapGrid[0] * Math.round(
|
|
1904
|
-
y: n.snapGrid[1] * Math.round(
|
|
1905
|
-
}),
|
|
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 });
|
|
1906
1906
|
}
|
|
1907
|
-
(
|
|
1908
|
-
},
|
|
1909
|
-
var
|
|
1907
|
+
(zt = (Lt = n.onNodesChangeRef).current) == null || zt.call(Lt, It);
|
|
1908
|
+
}, k = (K) => {
|
|
1909
|
+
var q, G;
|
|
1910
1910
|
if (!o.current) return;
|
|
1911
|
-
const
|
|
1912
|
-
for (const
|
|
1913
|
-
|
|
1914
|
-
(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);
|
|
1915
1915
|
};
|
|
1916
|
-
w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup",
|
|
1916
|
+
w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup", k);
|
|
1917
1917
|
}, [t, n]), c = F((M) => {
|
|
1918
|
-
var g, f, p, v,
|
|
1918
|
+
var g, f, p, v, L, w;
|
|
1919
1919
|
if (!t.selected) return;
|
|
1920
1920
|
const $ = M.shiftKey ? 10 : 1;
|
|
1921
|
-
let
|
|
1921
|
+
let R = 0, E = 0;
|
|
1922
1922
|
switch (M.key) {
|
|
1923
1923
|
case "ArrowUp":
|
|
1924
1924
|
E = -$;
|
|
@@ -1927,10 +1927,10 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1927
1927
|
E = $;
|
|
1928
1928
|
break;
|
|
1929
1929
|
case "ArrowLeft":
|
|
1930
|
-
|
|
1930
|
+
R = -$;
|
|
1931
1931
|
break;
|
|
1932
1932
|
case "ArrowRight":
|
|
1933
|
-
|
|
1933
|
+
R = $;
|
|
1934
1934
|
break;
|
|
1935
1935
|
case "Escape":
|
|
1936
1936
|
(f = (g = n.onNodesChangeRef).current) == null || f.call(g, [{ id: t.id, type: "select", selected: !1 }]);
|
|
@@ -1943,10 +1943,10 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1943
1943
|
return;
|
|
1944
1944
|
}
|
|
1945
1945
|
M.preventDefault();
|
|
1946
|
-
const _ = { x: t.position.x +
|
|
1946
|
+
const _ = { x: t.position.x + R, y: t.position.y + E }, D = [{ id: t.id, type: "position", position: _ }];
|
|
1947
1947
|
for (const P of n.nodesRef.current)
|
|
1948
|
-
P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x +
|
|
1949
|
-
(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);
|
|
1950
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);
|
|
1951
1951
|
return /* @__PURE__ */ S(je.Provider, { value: t.id, children: /* @__PURE__ */ S(
|
|
1952
1952
|
"div",
|
|
@@ -2056,75 +2056,75 @@ function Dn({ x: t, y: e, position: n, type: r, onPointerDown: s }) {
|
|
|
2056
2056
|
}
|
|
2057
2057
|
function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
2058
2058
|
var g, f, p;
|
|
2059
|
-
const s = yt(), [o, i] = Gt(null), c = F((v,
|
|
2059
|
+
const s = yt(), [o, i] = Gt(null), c = F((v, L, w, P) => {
|
|
2060
2060
|
var rt;
|
|
2061
|
-
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
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;
|
|
2065
2065
|
(rt = s.workerRef.current) == null || rt.postMessage({
|
|
2066
2066
|
type: "connecting",
|
|
2067
2067
|
data: { from: { x: B.x, y: B.y }, to: { x: B.x, y: B.y } }
|
|
2068
2068
|
});
|
|
2069
|
-
const X =
|
|
2070
|
-
var
|
|
2071
|
-
const
|
|
2072
|
-
(
|
|
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({
|
|
2073
2073
|
type: "connecting",
|
|
2074
|
-
data: { from: { x: B.x, y: B.y }, to: { x:
|
|
2074
|
+
data: { from: { x: B.x, y: B.y }, to: { x: ot, y: lt } }
|
|
2075
2075
|
});
|
|
2076
|
-
},
|
|
2077
|
-
var
|
|
2078
|
-
const
|
|
2079
|
-
let
|
|
2080
|
-
const
|
|
2081
|
-
for (const
|
|
2082
|
-
if (
|
|
2083
|
-
const Rt =
|
|
2084
|
-
if (
|
|
2085
|
-
for (const [, Bt] of
|
|
2086
|
-
Bt.nodeId ===
|
|
2087
|
-
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 || [
|
|
2088
2088
|
{ type: "target", position: "left" },
|
|
2089
2089
|
{ type: "source", position: "right" }
|
|
2090
2090
|
];
|
|
2091
2091
|
for (const Bt of Ie) {
|
|
2092
2092
|
let Ot, Yt;
|
|
2093
2093
|
if (Bt.x !== void 0 && Bt.y !== void 0)
|
|
2094
|
-
Ot =
|
|
2094
|
+
Ot = gt.x + Bt.x, Yt = gt.y + Bt.y;
|
|
2095
2095
|
else
|
|
2096
2096
|
switch (Bt.position || (Bt.type === "source" ? "right" : "left")) {
|
|
2097
2097
|
case "top":
|
|
2098
|
-
Ot =
|
|
2098
|
+
Ot = gt.x + Rt / 2, Yt = gt.y;
|
|
2099
2099
|
break;
|
|
2100
2100
|
case "bottom":
|
|
2101
|
-
Ot =
|
|
2101
|
+
Ot = gt.x + Rt / 2, Yt = gt.y + Nt;
|
|
2102
2102
|
break;
|
|
2103
2103
|
case "left":
|
|
2104
|
-
Ot =
|
|
2104
|
+
Ot = gt.x, Yt = gt.y + Nt / 2;
|
|
2105
2105
|
break;
|
|
2106
2106
|
default:
|
|
2107
|
-
Ot =
|
|
2107
|
+
Ot = gt.x + Rt, Yt = gt.y + Nt / 2;
|
|
2108
2108
|
break;
|
|
2109
2109
|
}
|
|
2110
|
-
if (Math.abs(
|
|
2111
|
-
|
|
2110
|
+
if (Math.abs(ot - Ot) < ut && Math.abs(lt - Yt) < ut) {
|
|
2111
|
+
st = ht, It = Bt.id || null;
|
|
2112
2112
|
break;
|
|
2113
2113
|
}
|
|
2114
2114
|
}
|
|
2115
|
-
if (
|
|
2115
|
+
if (st) break;
|
|
2116
2116
|
}
|
|
2117
|
-
if (
|
|
2118
|
-
const
|
|
2119
|
-
(
|
|
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, [
|
|
2120
2120
|
{ id: t.id, type: "remove" },
|
|
2121
|
-
{ type: "add", item: { id: t.id, ...
|
|
2121
|
+
{ type: "add", item: { id: t.id, ...ht } }
|
|
2122
2122
|
]);
|
|
2123
2123
|
}
|
|
2124
|
-
(
|
|
2124
|
+
(dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), k.removeEventListener("pointermove", xt), k.removeEventListener("pointerup", K);
|
|
2125
2125
|
};
|
|
2126
|
-
|
|
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",
|
|
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;
|
|
2128
2128
|
return !z || !M ? null : /* @__PURE__ */ $t(
|
|
2129
2129
|
"g",
|
|
2130
2130
|
{
|
|
@@ -2158,7 +2158,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
|
2158
2158
|
routedPoints: _
|
|
2159
2159
|
}
|
|
2160
2160
|
),
|
|
2161
|
-
D && (o || t.selected) && /* @__PURE__ */ $t(
|
|
2161
|
+
D && (o || t.selected) && /* @__PURE__ */ $t(Ne, { children: [
|
|
2162
2162
|
/* @__PURE__ */ S(
|
|
2163
2163
|
Dn,
|
|
2164
2164
|
{
|
|
@@ -2188,9 +2188,9 @@ const Dr = Zt(Br);
|
|
|
2188
2188
|
function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
2189
2189
|
var $;
|
|
2190
2190
|
const n = yt(), [r, s] = Gt(null), o = tt(null);
|
|
2191
|
-
if (
|
|
2192
|
-
const
|
|
2193
|
-
if (!
|
|
2191
|
+
if (ft(() => {
|
|
2192
|
+
const R = n.wrapRef.current;
|
|
2193
|
+
if (!R) return;
|
|
2194
2194
|
let E = !1, _ = null, D = !1;
|
|
2195
2195
|
const g = (w) => {
|
|
2196
2196
|
w.key === t && (D = !0);
|
|
@@ -2201,31 +2201,31 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
|
2201
2201
|
const P = w.target;
|
|
2202
2202
|
if (P.closest(".ric-node-wrapper") || P.closest(".ric-handle")) return;
|
|
2203
2203
|
E = !0;
|
|
2204
|
-
const
|
|
2205
|
-
_ = { 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();
|
|
2206
2206
|
}, v = (w) => {
|
|
2207
2207
|
if (!E || !_) return;
|
|
2208
|
-
const P = n.cameraRef.current,
|
|
2209
|
-
s({ startX: _.x, startY: _.y, endX: B, endY:
|
|
2210
|
-
},
|
|
2211
|
-
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;
|
|
2212
2212
|
if (!E || !_) return;
|
|
2213
2213
|
E = !1;
|
|
2214
|
-
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 = {
|
|
2215
2215
|
x: Math.min(_.x, B),
|
|
2216
|
-
y: Math.min(_.y,
|
|
2216
|
+
y: Math.min(_.y, j),
|
|
2217
2217
|
width: Math.abs(B - _.x),
|
|
2218
|
-
height: Math.abs(
|
|
2219
|
-
},
|
|
2220
|
-
for (const
|
|
2221
|
-
const
|
|
2222
|
-
let
|
|
2223
|
-
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 });
|
|
2224
2224
|
}
|
|
2225
|
-
|
|
2225
|
+
xt.length && ((rt = (K = n.onNodesChangeRef).current) == null || rt.call(K, xt)), _ = null, s(null);
|
|
2226
2226
|
};
|
|
2227
|
-
return
|
|
2228
|
-
|
|
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);
|
|
2229
2229
|
};
|
|
2230
2230
|
}, [n, t, e]), !r) return null;
|
|
2231
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;
|
|
@@ -2295,20 +2295,20 @@ function on({
|
|
|
2295
2295
|
const m = qe(je), C = yt(), z = tt(null), M = tt(C);
|
|
2296
2296
|
M.current = C;
|
|
2297
2297
|
const $ = F(() => {
|
|
2298
|
-
var w, P,
|
|
2298
|
+
var w, P, k;
|
|
2299
2299
|
const D = z.current;
|
|
2300
2300
|
if (!D || !m) return;
|
|
2301
2301
|
const g = M.current, f = (w = g.handleRegistryRef) == null ? void 0 : w.current;
|
|
2302
2302
|
if (!f) return;
|
|
2303
|
-
const p = `${m}__${n || t}`, v = (
|
|
2304
|
-
if (
|
|
2305
|
-
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 };
|
|
2306
2306
|
f.set(p, B);
|
|
2307
2307
|
}
|
|
2308
2308
|
}, [m, n, t, e]);
|
|
2309
2309
|
kr(() => {
|
|
2310
2310
|
$();
|
|
2311
|
-
}, [$]),
|
|
2311
|
+
}, [$]), ft(() => {
|
|
2312
2312
|
if (!m) return;
|
|
2313
2313
|
const D = M.current;
|
|
2314
2314
|
An(D, m);
|
|
@@ -2318,17 +2318,17 @@ function on({
|
|
|
2318
2318
|
return f && p.observe(f), () => {
|
|
2319
2319
|
var P;
|
|
2320
2320
|
p.disconnect();
|
|
2321
|
-
const v = M.current,
|
|
2322
|
-
|
|
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);
|
|
2323
2323
|
};
|
|
2324
2324
|
}, [m, n, t, e, $]);
|
|
2325
|
-
const
|
|
2326
|
-
var
|
|
2325
|
+
const R = F(() => {
|
|
2326
|
+
var k;
|
|
2327
2327
|
const D = M.current, g = D.nodesRef.current.find((B) => B.id === m);
|
|
2328
2328
|
if (!g) return null;
|
|
2329
|
-
const f = g._absolutePosition || g.position, p = (
|
|
2330
|
-
if (
|
|
2331
|
-
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 };
|
|
2332
2332
|
const w = g.width || 160, P = g.height || 60;
|
|
2333
2333
|
switch (e) {
|
|
2334
2334
|
case "top":
|
|
@@ -2341,79 +2341,79 @@ function on({
|
|
|
2341
2341
|
return { x: f.x + w, y: f.y + P / 2 };
|
|
2342
2342
|
}
|
|
2343
2343
|
}, [m, n, t, e]), E = F((D) => {
|
|
2344
|
-
var
|
|
2344
|
+
var j;
|
|
2345
2345
|
if (!r || !s) return;
|
|
2346
2346
|
D.stopPropagation(), D.preventDefault();
|
|
2347
2347
|
const g = M.current, f = g.cameraRef.current, p = g.wrapRef.current;
|
|
2348
2348
|
if (!p) return;
|
|
2349
|
-
const v = p.getBoundingClientRect(),
|
|
2350
|
-
if (!
|
|
2351
|
-
const w =
|
|
2352
|
-
(
|
|
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({
|
|
2353
2353
|
type: "connecting",
|
|
2354
2354
|
data: { from: { x: w, y: P }, to: { x: w, y: P } }
|
|
2355
2355
|
}), p.setPointerCapture(D.pointerId);
|
|
2356
|
-
const
|
|
2356
|
+
const k = (X) => {
|
|
2357
2357
|
var rt;
|
|
2358
|
-
const
|
|
2358
|
+
const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom;
|
|
2359
2359
|
(rt = g.workerRef.current) == null || rt.postMessage({
|
|
2360
2360
|
type: "connecting",
|
|
2361
|
-
data: { from: { x: w, y: P }, to: { x:
|
|
2361
|
+
data: { from: { x: w, y: P }, to: { x: xt, y: K } }
|
|
2362
2362
|
});
|
|
2363
2363
|
}, B = (X) => {
|
|
2364
|
-
var
|
|
2365
|
-
const
|
|
2366
|
-
let
|
|
2367
|
-
const
|
|
2368
|
-
for (const
|
|
2369
|
-
if (
|
|
2370
|
-
const
|
|
2371
|
-
if (
|
|
2372
|
-
for (const [, Rt] of
|
|
2373
|
-
Rt.nodeId ===
|
|
2374
|
-
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 || [
|
|
2375
2375
|
{ type: "target", position: "left" },
|
|
2376
2376
|
{ type: "source", position: "right" }
|
|
2377
2377
|
];
|
|
2378
|
-
for (const Rt of
|
|
2379
|
-
let
|
|
2378
|
+
for (const Rt of ht) {
|
|
2379
|
+
let Nt, gt;
|
|
2380
2380
|
if (Rt.x !== void 0 && Rt.y !== void 0)
|
|
2381
|
-
|
|
2381
|
+
Nt = zt.x + Rt.x, gt = zt.y + Rt.y;
|
|
2382
2382
|
else
|
|
2383
2383
|
switch (Rt.position || (Rt.type === "source" ? "right" : "left")) {
|
|
2384
2384
|
case "top":
|
|
2385
|
-
|
|
2385
|
+
Nt = zt.x + mt / 2, gt = zt.y;
|
|
2386
2386
|
break;
|
|
2387
2387
|
case "bottom":
|
|
2388
|
-
|
|
2388
|
+
Nt = zt.x + mt / 2, gt = zt.y + Lt;
|
|
2389
2389
|
break;
|
|
2390
2390
|
case "left":
|
|
2391
|
-
|
|
2391
|
+
Nt = zt.x, gt = zt.y + Lt / 2;
|
|
2392
2392
|
break;
|
|
2393
2393
|
default:
|
|
2394
|
-
|
|
2394
|
+
Nt = zt.x + mt, gt = zt.y + Lt / 2;
|
|
2395
2395
|
break;
|
|
2396
2396
|
}
|
|
2397
|
-
if (Math.abs(
|
|
2398
|
-
|
|
2397
|
+
if (Math.abs(xt - Nt) < rt && Math.abs(K - gt) < rt) {
|
|
2398
|
+
q = it, G = Rt.id || null;
|
|
2399
2399
|
break;
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
|
-
if (
|
|
2402
|
+
if (q) break;
|
|
2403
2403
|
}
|
|
2404
|
-
if (
|
|
2405
|
-
const
|
|
2406
|
-
source: t === "source" ? m :
|
|
2407
|
-
target: t === "source" ?
|
|
2408
|
-
sourceHandle: t === "source" ? n || null :
|
|
2409
|
-
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
|
|
2410
2410
|
};
|
|
2411
|
-
(
|
|
2411
|
+
(st = (ut = g.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
|
|
2412
2412
|
}
|
|
2413
|
-
(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);
|
|
2414
2414
|
};
|
|
2415
|
-
p.addEventListener("pointermove",
|
|
2416
|
-
}, [m, n, t, e, r, s,
|
|
2415
|
+
p.addEventListener("pointermove", k), p.addEventListener("pointerup", B);
|
|
2416
|
+
}, [m, n, t, e, r, s, R]), _ = {
|
|
2417
2417
|
top: { top: 0, left: "50%", transform: "translate(-50%, -50%)" },
|
|
2418
2418
|
bottom: { bottom: 0, left: "50%", transform: "translate(-50%, 50%)" },
|
|
2419
2419
|
left: { top: "50%", left: 0, transform: "translate(-50%, -50%)" },
|
|
@@ -2579,7 +2579,7 @@ function Vn({
|
|
|
2579
2579
|
...y
|
|
2580
2580
|
}) {
|
|
2581
2581
|
const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
|
|
2582
|
-
return
|
|
2582
|
+
return ft(() => {
|
|
2583
2583
|
if (z.current) {
|
|
2584
2584
|
const M = z.current.getBBox();
|
|
2585
2585
|
C({
|
|
@@ -2649,7 +2649,7 @@ function un({
|
|
|
2649
2649
|
className: M = "",
|
|
2650
2650
|
...$
|
|
2651
2651
|
}) {
|
|
2652
|
-
return /* @__PURE__ */ $t(
|
|
2652
|
+
return /* @__PURE__ */ $t(Ne, { children: [
|
|
2653
2653
|
/* @__PURE__ */ S(
|
|
2654
2654
|
"path",
|
|
2655
2655
|
{
|
|
@@ -2722,43 +2722,43 @@ const tr = Zt(function({
|
|
|
2722
2722
|
labelBgBorderRadius: z,
|
|
2723
2723
|
style: M,
|
|
2724
2724
|
markerEnd: $,
|
|
2725
|
-
markerStart:
|
|
2725
|
+
markerStart: R,
|
|
2726
2726
|
interactionWidth: E
|
|
2727
2727
|
}) {
|
|
2728
2728
|
let _, D, g;
|
|
2729
|
-
const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x),
|
|
2730
|
-
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;
|
|
2731
2731
|
switch (i) {
|
|
2732
2732
|
case "left":
|
|
2733
|
-
w = f.x -
|
|
2733
|
+
w = f.x - L, P = f.y;
|
|
2734
2734
|
break;
|
|
2735
2735
|
case "top":
|
|
2736
|
-
w = f.x, P = f.y -
|
|
2736
|
+
w = f.x, P = f.y - L;
|
|
2737
2737
|
break;
|
|
2738
2738
|
case "bottom":
|
|
2739
|
-
w = f.x, P = f.y +
|
|
2739
|
+
w = f.x, P = f.y + L;
|
|
2740
2740
|
break;
|
|
2741
2741
|
default:
|
|
2742
|
-
w = f.x +
|
|
2742
|
+
w = f.x + L, P = f.y;
|
|
2743
2743
|
break;
|
|
2744
2744
|
}
|
|
2745
2745
|
switch (c) {
|
|
2746
2746
|
case "right":
|
|
2747
|
-
|
|
2747
|
+
k = p.x + L, B = p.y;
|
|
2748
2748
|
break;
|
|
2749
2749
|
case "top":
|
|
2750
|
-
|
|
2750
|
+
k = p.x, B = p.y - L;
|
|
2751
2751
|
break;
|
|
2752
2752
|
case "bottom":
|
|
2753
|
-
|
|
2753
|
+
k = p.x, B = p.y + L;
|
|
2754
2754
|
break;
|
|
2755
2755
|
default:
|
|
2756
|
-
|
|
2756
|
+
k = p.x - L, B = p.y;
|
|
2757
2757
|
break;
|
|
2758
2758
|
}
|
|
2759
|
-
_ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${
|
|
2760
|
-
const
|
|
2761
|
-
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(
|
|
2762
2762
|
un,
|
|
2763
2763
|
{
|
|
2764
2764
|
id: e,
|
|
@@ -2773,7 +2773,7 @@ const tr = Zt(function({
|
|
|
2773
2773
|
labelBgBorderRadius: z,
|
|
2774
2774
|
style: M,
|
|
2775
2775
|
markerEnd: $,
|
|
2776
|
-
markerStart:
|
|
2776
|
+
markerStart: R,
|
|
2777
2777
|
interactionWidth: E
|
|
2778
2778
|
}
|
|
2779
2779
|
);
|
|
@@ -2822,7 +2822,7 @@ function nr({
|
|
|
2822
2822
|
z = n - y, M = r;
|
|
2823
2823
|
break;
|
|
2824
2824
|
}
|
|
2825
|
-
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;
|
|
2826
2826
|
return [$, _, D, 0, 0];
|
|
2827
2827
|
}
|
|
2828
2828
|
function rr({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
|
|
@@ -2912,8 +2912,8 @@ function Yr(t, e, n, r, s, o, i, c) {
|
|
|
2912
2912
|
const z = (t + n) / 2, M = (e + r) / 2;
|
|
2913
2913
|
if (z > s + C && z < s + i - C && M > o + C && M < o + c - C) return !0;
|
|
2914
2914
|
const $ = [[s, o], [s + i, o], [s + i, o + c], [s, o + c]];
|
|
2915
|
-
for (let
|
|
2916
|
-
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;
|
|
2917
2917
|
return !1;
|
|
2918
2918
|
}
|
|
2919
2919
|
function Ur(t, e, n, r, s, o, i, c) {
|
|
@@ -2958,44 +2958,44 @@ function sr(t, e, n) {
|
|
|
2958
2958
|
r.add(t.x), r.add(e.x), s.add(t.y), s.add(e.y);
|
|
2959
2959
|
const o = Ue + 5;
|
|
2960
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);
|
|
2961
|
-
for (let
|
|
2962
|
-
const B = n[
|
|
2961
|
+
for (let k = 0; k < n.length; k++) {
|
|
2962
|
+
const B = n[k];
|
|
2963
2963
|
r.add(B.x), r.add(B.x + B.w), s.add(B.y), s.add(B.y + B.h);
|
|
2964
2964
|
}
|
|
2965
|
-
const i = [...r].sort((
|
|
2966
|
-
for (let
|
|
2967
|
-
for (let
|
|
2968
|
-
const y = i.length, m = c.length, C = (
|
|
2969
|
-
if (z === void 0 || M === void 0 || $ === void 0 ||
|
|
2970
|
-
const E = C(z, M), _ = C($,
|
|
2971
|
-
D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[
|
|
2972
|
-
const
|
|
2973
|
-
for (;
|
|
2974
|
-
let
|
|
2975
|
-
for (let
|
|
2976
|
-
g[
|
|
2977
|
-
const B =
|
|
2978
|
-
if (
|
|
2979
|
-
const
|
|
2980
|
-
let
|
|
2981
|
-
for (;
|
|
2982
|
-
const
|
|
2983
|
-
|
|
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];
|
|
2984
2984
|
}
|
|
2985
|
-
return
|
|
2985
|
+
return q.unshift({ x: t.x, y: t.y }), jr(q, n);
|
|
2986
2986
|
}
|
|
2987
2987
|
if (v[B]) continue;
|
|
2988
2988
|
v[B] = 1;
|
|
2989
|
-
const
|
|
2990
|
-
for (let
|
|
2991
|
-
const
|
|
2992
|
-
if (
|
|
2993
|
-
const
|
|
2994
|
-
if (v[
|
|
2995
|
-
const
|
|
2996
|
-
if (qr(
|
|
2997
|
-
const It = Math.abs(
|
|
2998
|
-
|
|
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));
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
3001
|
return null;
|
|
@@ -3075,8 +3075,8 @@ function En(t, e = 6, n = !1) {
|
|
|
3075
3075
|
for (let o = 1; o < t.length - 1; o++) {
|
|
3076
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);
|
|
3077
3077
|
if (m > 0.5) {
|
|
3078
|
-
const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y,
|
|
3079
|
-
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}`;
|
|
3080
3080
|
} else
|
|
3081
3081
|
s += ` L ${c.x},${c.y}`;
|
|
3082
3082
|
}
|
|
@@ -3114,26 +3114,26 @@ function Cn(t) {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
return { x: t[0].x, y: t[0].y };
|
|
3116
3116
|
}
|
|
3117
|
-
function
|
|
3117
|
+
function Lo(t, e) {
|
|
3118
3118
|
if (!t || !e || t.length === 0 || e.length === 0) return e;
|
|
3119
3119
|
const n = {};
|
|
3120
3120
|
for (const o of t) n[o.id] = o;
|
|
3121
3121
|
const r = or(t, null), s = e.map((o) => {
|
|
3122
|
-
var p, v,
|
|
3122
|
+
var p, v, L, w;
|
|
3123
3123
|
const i = o.type || "default";
|
|
3124
3124
|
if (i === "bezier" || i === "simplebezier" || i === "default") return o;
|
|
3125
3125
|
const c = n[o.source], u = n[o.target];
|
|
3126
3126
|
if (!c || !u || c.hidden || u.hidden) return o;
|
|
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,
|
|
3128
|
-
M.push({ id: o.source, x: $.x - z, y: $.y - z, w:
|
|
3129
|
-
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;
|
|
3130
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;
|
|
3131
3131
|
const f = sr(m, C, M);
|
|
3132
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;
|
|
3133
3133
|
});
|
|
3134
3134
|
return Gr(s);
|
|
3135
3135
|
}
|
|
3136
|
-
function
|
|
3136
|
+
function No(t, e, n, r, s, o, i, c) {
|
|
3137
3137
|
const u = or(i, c ? new Set(c) : null);
|
|
3138
3138
|
if (u.length === 0) return null;
|
|
3139
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);
|
|
@@ -3155,12 +3155,12 @@ const ir = Zt(function({
|
|
|
3155
3155
|
markerEnd: z,
|
|
3156
3156
|
markerStart: M,
|
|
3157
3157
|
interactionWidth: $,
|
|
3158
|
-
routedPoints:
|
|
3158
|
+
routedPoints: R
|
|
3159
3159
|
}) {
|
|
3160
3160
|
let E, _, D;
|
|
3161
|
-
if (
|
|
3162
|
-
E = En(
|
|
3163
|
-
const g = Cn(
|
|
3161
|
+
if (R && R.length >= 2) {
|
|
3162
|
+
E = En(R);
|
|
3163
|
+
const g = Cn(R);
|
|
3164
3164
|
_ = g.x, D = g.y;
|
|
3165
3165
|
} else
|
|
3166
3166
|
[E, _, D] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
|
|
@@ -3201,7 +3201,7 @@ const ar = Zt(function({
|
|
|
3201
3201
|
labelBgBorderRadius: z,
|
|
3202
3202
|
style: M,
|
|
3203
3203
|
markerEnd: $,
|
|
3204
|
-
markerStart:
|
|
3204
|
+
markerStart: R,
|
|
3205
3205
|
pathOptions: E,
|
|
3206
3206
|
interactionWidth: _,
|
|
3207
3207
|
routedPoints: D
|
|
@@ -3237,7 +3237,7 @@ const ar = Zt(function({
|
|
|
3237
3237
|
labelBgBorderRadius: z,
|
|
3238
3238
|
style: M,
|
|
3239
3239
|
markerEnd: $,
|
|
3240
|
-
markerStart:
|
|
3240
|
+
markerStart: R,
|
|
3241
3241
|
interactionWidth: _
|
|
3242
3242
|
}
|
|
3243
3243
|
);
|
|
@@ -3271,7 +3271,7 @@ const cr = Zt(function({
|
|
|
3271
3271
|
labelBgBorderRadius: z,
|
|
3272
3272
|
style: M,
|
|
3273
3273
|
markerEnd: $,
|
|
3274
|
-
markerStart:
|
|
3274
|
+
markerStart: R,
|
|
3275
3275
|
interactionWidth: E,
|
|
3276
3276
|
routedPoints: _
|
|
3277
3277
|
}) {
|
|
@@ -3302,7 +3302,7 @@ const cr = Zt(function({
|
|
|
3302
3302
|
labelBgBorderRadius: z,
|
|
3303
3303
|
style: M,
|
|
3304
3304
|
markerEnd: $,
|
|
3305
|
-
markerStart:
|
|
3305
|
+
markerStart: R,
|
|
3306
3306
|
interactionWidth: E
|
|
3307
3307
|
}
|
|
3308
3308
|
);
|
|
@@ -3340,7 +3340,7 @@ function Io({
|
|
|
3340
3340
|
fitView: M,
|
|
3341
3341
|
fitViewOptions: $,
|
|
3342
3342
|
// Node/Edge callbacks
|
|
3343
|
-
onNodesChange:
|
|
3343
|
+
onNodesChange: R,
|
|
3344
3344
|
onEdgesChange: E,
|
|
3345
3345
|
onConnect: _,
|
|
3346
3346
|
onConnectStart: D,
|
|
@@ -3348,33 +3348,33 @@ function Io({
|
|
|
3348
3348
|
onNodeClick: f,
|
|
3349
3349
|
onNodeDoubleClick: p,
|
|
3350
3350
|
onNodeMouseEnter: v,
|
|
3351
|
-
onNodeMouseMove:
|
|
3351
|
+
onNodeMouseMove: L,
|
|
3352
3352
|
onNodeMouseLeave: w,
|
|
3353
3353
|
onNodeContextMenu: P,
|
|
3354
|
-
onNodeDragStart:
|
|
3354
|
+
onNodeDragStart: k,
|
|
3355
3355
|
onNodeDrag: B,
|
|
3356
|
-
onNodeDragStop:
|
|
3356
|
+
onNodeDragStop: j,
|
|
3357
3357
|
onEdgeClick: X,
|
|
3358
|
-
onEdgeDoubleClick:
|
|
3359
|
-
onEdgeMouseEnter:
|
|
3358
|
+
onEdgeDoubleClick: xt,
|
|
3359
|
+
onEdgeMouseEnter: K,
|
|
3360
3360
|
onEdgeMouseMove: rt,
|
|
3361
|
-
onEdgeMouseLeave:
|
|
3362
|
-
onEdgeContextMenu:
|
|
3363
|
-
onPaneClick:
|
|
3364
|
-
onPaneContextMenu:
|
|
3365
|
-
onPaneMouseEnter:
|
|
3366
|
-
onPaneMouseMove:
|
|
3361
|
+
onEdgeMouseLeave: q,
|
|
3362
|
+
onEdgeContextMenu: G,
|
|
3363
|
+
onPaneClick: ot,
|
|
3364
|
+
onPaneContextMenu: lt,
|
|
3365
|
+
onPaneMouseEnter: ut,
|
|
3366
|
+
onPaneMouseMove: st,
|
|
3367
3367
|
onPaneMouseLeave: It,
|
|
3368
|
-
onSelectionChange:
|
|
3369
|
-
onInit:
|
|
3370
|
-
onMoveStart:
|
|
3371
|
-
onMove:
|
|
3372
|
-
onMoveEnd:
|
|
3373
|
-
onDelete:
|
|
3368
|
+
onSelectionChange: it,
|
|
3369
|
+
onInit: mt,
|
|
3370
|
+
onMoveStart: Lt,
|
|
3371
|
+
onMove: zt,
|
|
3372
|
+
onMoveEnd: dt,
|
|
3373
|
+
onDelete: ht,
|
|
3374
3374
|
onBeforeDelete: Rt,
|
|
3375
|
-
onError:
|
|
3375
|
+
onError: Nt,
|
|
3376
3376
|
// Drag and drop
|
|
3377
|
-
onDragOver:
|
|
3377
|
+
onDragOver: gt,
|
|
3378
3378
|
onDrop: ne,
|
|
3379
3379
|
onDragEnter: Ie,
|
|
3380
3380
|
onDragLeave: Bt,
|
|
@@ -3398,10 +3398,10 @@ function Io({
|
|
|
3398
3398
|
panOnScrollMode: dn,
|
|
3399
3399
|
panOnScrollSpeed: fn,
|
|
3400
3400
|
zoomOnScroll: Qt,
|
|
3401
|
-
zoomOnDoubleClick:
|
|
3401
|
+
zoomOnDoubleClick: Ln,
|
|
3402
3402
|
zoomOnPinch: hn,
|
|
3403
3403
|
preventScrolling: fe,
|
|
3404
|
-
translateExtent:
|
|
3404
|
+
translateExtent: vt,
|
|
3405
3405
|
nodeExtent: Te,
|
|
3406
3406
|
autoPanOnNodeDrag: Et,
|
|
3407
3407
|
autoPanOnConnect: pt,
|
|
@@ -3427,8 +3427,8 @@ function Io({
|
|
|
3427
3427
|
[te]
|
|
3428
3428
|
), ae = St(() => ({ ...Qr, ...r }), [r]), Kt = St(() => ({ ...Kr, ...s }), [s]), he = St(() => {
|
|
3429
3429
|
const Q = e.filter((Ft) => Ft.type && ae[Ft.type]);
|
|
3430
|
-
return Q.sort((Ft,
|
|
3431
|
-
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);
|
|
3432
3432
|
return Tt && !xe ? -1 : !Tt && xe ? 1 : 0;
|
|
3433
3433
|
});
|
|
3434
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]), {
|
|
@@ -3439,7 +3439,7 @@ function Io({
|
|
|
3439
3439
|
onPointerMove: He,
|
|
3440
3440
|
onPointerUp: _e,
|
|
3441
3441
|
store: le
|
|
3442
|
-
} =
|
|
3442
|
+
} = Nr({
|
|
3443
3443
|
cards: t,
|
|
3444
3444
|
nodes: O,
|
|
3445
3445
|
edges: bt,
|
|
@@ -3452,7 +3452,7 @@ function Io({
|
|
|
3452
3452
|
fitViewOptions: $,
|
|
3453
3453
|
onHudUpdate: Ve,
|
|
3454
3454
|
onNodesProcessed: gn,
|
|
3455
|
-
onNodesChange:
|
|
3455
|
+
onNodesChange: R,
|
|
3456
3456
|
onEdgesChange: E,
|
|
3457
3457
|
onConnect: _,
|
|
3458
3458
|
onConnectStart: D,
|
|
@@ -3460,31 +3460,31 @@ function Io({
|
|
|
3460
3460
|
onNodeClick: f,
|
|
3461
3461
|
onNodeDoubleClick: p,
|
|
3462
3462
|
onNodeMouseEnter: v,
|
|
3463
|
-
onNodeMouseMove:
|
|
3463
|
+
onNodeMouseMove: L,
|
|
3464
3464
|
onNodeMouseLeave: w,
|
|
3465
3465
|
onNodeContextMenu: P,
|
|
3466
|
-
onNodeDragStart:
|
|
3466
|
+
onNodeDragStart: k,
|
|
3467
3467
|
onNodeDrag: B,
|
|
3468
|
-
onNodeDragStop:
|
|
3468
|
+
onNodeDragStop: j,
|
|
3469
3469
|
onEdgeClick: X,
|
|
3470
|
-
onEdgeDoubleClick:
|
|
3471
|
-
onEdgeMouseEnter:
|
|
3470
|
+
onEdgeDoubleClick: xt,
|
|
3471
|
+
onEdgeMouseEnter: K,
|
|
3472
3472
|
onEdgeMouseMove: rt,
|
|
3473
|
-
onEdgeMouseLeave:
|
|
3474
|
-
onEdgeContextMenu:
|
|
3475
|
-
onPaneClick:
|
|
3476
|
-
onPaneContextMenu:
|
|
3477
|
-
onPaneMouseEnter:
|
|
3478
|
-
onPaneMouseMove:
|
|
3473
|
+
onEdgeMouseLeave: q,
|
|
3474
|
+
onEdgeContextMenu: G,
|
|
3475
|
+
onPaneClick: ot,
|
|
3476
|
+
onPaneContextMenu: lt,
|
|
3477
|
+
onPaneMouseEnter: ut,
|
|
3478
|
+
onPaneMouseMove: st,
|
|
3479
3479
|
onPaneMouseLeave: It,
|
|
3480
|
-
onSelectionChange:
|
|
3481
|
-
onInit:
|
|
3482
|
-
onMoveStart:
|
|
3483
|
-
onMove:
|
|
3484
|
-
onMoveEnd:
|
|
3485
|
-
onDelete:
|
|
3480
|
+
onSelectionChange: it,
|
|
3481
|
+
onInit: mt,
|
|
3482
|
+
onMoveStart: Lt,
|
|
3483
|
+
onMove: zt,
|
|
3484
|
+
onMoveEnd: dt,
|
|
3485
|
+
onDelete: ht,
|
|
3486
3486
|
onBeforeDelete: Rt,
|
|
3487
|
-
onError:
|
|
3487
|
+
onError: Nt,
|
|
3488
3488
|
nodesDraggable: Ot,
|
|
3489
3489
|
nodesConnectable: Yt,
|
|
3490
3490
|
elementsSelectable: me,
|
|
@@ -3504,10 +3504,10 @@ function Io({
|
|
|
3504
3504
|
panOnScrollMode: dn,
|
|
3505
3505
|
panOnScrollSpeed: fn,
|
|
3506
3506
|
zoomOnScroll: Qt,
|
|
3507
|
-
zoomOnDoubleClick:
|
|
3507
|
+
zoomOnDoubleClick: Ln,
|
|
3508
3508
|
zoomOnPinch: hn,
|
|
3509
3509
|
preventScrolling: fe,
|
|
3510
|
-
translateExtent:
|
|
3510
|
+
translateExtent: vt,
|
|
3511
3511
|
nodeExtent: Te,
|
|
3512
3512
|
autoPanOnNodeDrag: Et,
|
|
3513
3513
|
autoPanOnConnect: pt,
|
|
@@ -3527,10 +3527,10 @@ function Io({
|
|
|
3527
3527
|
return n;
|
|
3528
3528
|
}
|
|
3529
3529
|
}), [le, e, n]), ye = tt(null), ge = tt(null), pe = tt(null), Jt = tt(null);
|
|
3530
|
-
|
|
3530
|
+
ft(() => {
|
|
3531
3531
|
let Q;
|
|
3532
3532
|
const Ft = () => {
|
|
3533
|
-
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})`;
|
|
3534
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);
|
|
3535
3535
|
};
|
|
3536
3536
|
return Q = requestAnimationFrame(Ft), () => cancelAnimationFrame(Q);
|
|
@@ -3545,7 +3545,7 @@ function Io({
|
|
|
3545
3545
|
onPointerDown: Ae,
|
|
3546
3546
|
onPointerMove: He,
|
|
3547
3547
|
onPointerUp: _e,
|
|
3548
|
-
onDragOver:
|
|
3548
|
+
onDragOver: gt,
|
|
3549
3549
|
onDrop: ne,
|
|
3550
3550
|
onDragEnter: Ie,
|
|
3551
3551
|
onDragLeave: Bt,
|
|
@@ -3650,11 +3650,11 @@ function Io({
|
|
|
3650
3650
|
") zoom: ",
|
|
3651
3651
|
Ut.zoom,
|
|
3652
3652
|
"x",
|
|
3653
|
-
Ut.nodeCount > 0 && /* @__PURE__ */ $t(
|
|
3653
|
+
Ut.nodeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
|
|
3654
3654
|
" nodes: ",
|
|
3655
3655
|
Ut.nodeCount
|
|
3656
3656
|
] }),
|
|
3657
|
-
Ut.edgeCount > 0 && /* @__PURE__ */ $t(
|
|
3657
|
+
Ut.edgeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
|
|
3658
3658
|
" edges: ",
|
|
3659
3659
|
Ut.edgeCount
|
|
3660
3660
|
] })
|
|
@@ -3748,7 +3748,7 @@ function So(t) {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
function eo() {
|
|
3750
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) => {
|
|
3751
|
-
var f, p, v,
|
|
3751
|
+
var f, p, v, L;
|
|
3752
3752
|
if (typeof g == "function") {
|
|
3753
3753
|
const w = g(t.nodesRef.current);
|
|
3754
3754
|
(p = (f = t.onNodesChangeRef).current) == null || p.call(f, [
|
|
@@ -3756,12 +3756,12 @@ function eo() {
|
|
|
3756
3756
|
...w.map((P) => ({ type: "add", item: P }))
|
|
3757
3757
|
]);
|
|
3758
3758
|
} else
|
|
3759
|
-
(
|
|
3759
|
+
(L = (v = t.onNodesChangeRef).current) == null || L.call(v, [
|
|
3760
3760
|
...t.nodesRef.current.map((w) => ({ id: w.id, type: "remove" })),
|
|
3761
3761
|
...g.map((w) => ({ type: "add", item: w }))
|
|
3762
3762
|
]);
|
|
3763
3763
|
}, [t]), i = F((g) => {
|
|
3764
|
-
var f, p, v,
|
|
3764
|
+
var f, p, v, L;
|
|
3765
3765
|
if (typeof g == "function") {
|
|
3766
3766
|
const w = g(t.edgesRef.current);
|
|
3767
3767
|
(p = (f = t.onEdgesChangeRef).current) == null || p.call(f, [
|
|
@@ -3769,18 +3769,18 @@ function eo() {
|
|
|
3769
3769
|
...w.map((P) => ({ type: "add", item: P }))
|
|
3770
3770
|
]);
|
|
3771
3771
|
} else
|
|
3772
|
-
(
|
|
3772
|
+
(L = (v = t.onEdgesChangeRef).current) == null || L.call(v, [
|
|
3773
3773
|
...t.edgesRef.current.map((w) => ({ id: w.id, type: "remove" })),
|
|
3774
3774
|
...g.map((w) => ({ type: "add", item: w }))
|
|
3775
3775
|
]);
|
|
3776
3776
|
}, [t]), c = F((g) => {
|
|
3777
3777
|
var p, v;
|
|
3778
3778
|
const f = Array.isArray(g) ? g : [g];
|
|
3779
|
-
(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 })));
|
|
3780
3780
|
}, [t]), u = F((g) => {
|
|
3781
3781
|
var p, v;
|
|
3782
3782
|
const f = Array.isArray(g) ? g : [g];
|
|
3783
|
-
(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 })));
|
|
3784
3784
|
}, [t]), l = F(({ nodes: g = [], edges: f = [] }) => {
|
|
3785
3785
|
if (g.length && t.onNodesChangeRef.current) {
|
|
3786
3786
|
t.onNodesChangeRef.current(g.map((v) => ({ id: v.id, type: "remove" })));
|
|
@@ -3800,34 +3800,34 @@ function eo() {
|
|
|
3800
3800
|
}, [t]), C = F(() => t.cameraRef.current.zoom, [t]), z = F((g) => {
|
|
3801
3801
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3802
3802
|
if (!p) return;
|
|
3803
|
-
const v = p.getBoundingClientRect(),
|
|
3804
|
-
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();
|
|
3805
3805
|
}, [t]), M = F((g) => {
|
|
3806
3806
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3807
3807
|
if (!p) return;
|
|
3808
|
-
const v = p.getBoundingClientRect(),
|
|
3809
|
-
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();
|
|
3810
3810
|
}, [t]), $ = F((g) => {
|
|
3811
3811
|
const f = t.cameraRef.current, p = t.wrapRef.current;
|
|
3812
3812
|
if (!p) return;
|
|
3813
|
-
const v = p.getBoundingClientRect(),
|
|
3814
|
-
f.x =
|
|
3815
|
-
}, [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 = {}) => {
|
|
3816
3816
|
const f = t.nodesRef.current;
|
|
3817
3817
|
if (!f.length) return;
|
|
3818
3818
|
const p = t.wrapRef.current;
|
|
3819
3819
|
if (!p) return;
|
|
3820
|
-
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;
|
|
3821
3821
|
if (!w.length) return;
|
|
3822
|
-
const P = Mn(w),
|
|
3823
|
-
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();
|
|
3824
3824
|
}, [t]), E = F((g, f, p = {}) => {
|
|
3825
3825
|
const v = t.wrapRef.current;
|
|
3826
3826
|
if (!v) return;
|
|
3827
|
-
const
|
|
3827
|
+
const L = v.getBoundingClientRect(), w = p.zoom ?? t.cameraRef.current.zoom;
|
|
3828
3828
|
t.cameraRef.current = {
|
|
3829
|
-
x:
|
|
3830
|
-
y:
|
|
3829
|
+
x: L.width / 2 - g * w,
|
|
3830
|
+
y: L.height / 2 - f * w,
|
|
3831
3831
|
zoom: w
|
|
3832
3832
|
}, t.sendCamera();
|
|
3833
3833
|
}, [t]), _ = F((g) => t.screenToWorld(g.x, g.y), [t]), D = F((g) => {
|
|
@@ -3855,7 +3855,7 @@ function eo() {
|
|
|
3855
3855
|
zoomIn: z,
|
|
3856
3856
|
zoomOut: M,
|
|
3857
3857
|
zoomTo: $,
|
|
3858
|
-
fitView:
|
|
3858
|
+
fitView: R,
|
|
3859
3859
|
setCenter: E,
|
|
3860
3860
|
screenToFlowPosition: _,
|
|
3861
3861
|
flowToScreenPosition: D
|
|
@@ -3890,13 +3890,13 @@ function Xo({ nodeId: t, type: e, handleId: n }) {
|
|
|
3890
3890
|
}
|
|
3891
3891
|
function Fo({ onChange: t, onStart: e, onEnd: n }) {
|
|
3892
3892
|
const r = yt(), s = tt(t), o = tt(e), i = tt(n);
|
|
3893
|
-
|
|
3893
|
+
ft(() => {
|
|
3894
3894
|
s.current = t;
|
|
3895
|
-
}, [t]),
|
|
3895
|
+
}, [t]), ft(() => {
|
|
3896
3896
|
o.current = e;
|
|
3897
|
-
}, [e]),
|
|
3897
|
+
}, [e]), ft(() => {
|
|
3898
3898
|
i.current = n;
|
|
3899
|
-
}, [n]),
|
|
3899
|
+
}, [n]), ft(() => {
|
|
3900
3900
|
const c = (u) => {
|
|
3901
3901
|
var l;
|
|
3902
3902
|
(l = s.current) == null || l.call(s, { x: u.x, y: u.y, zoom: u.zoom });
|
|
@@ -3906,9 +3906,9 @@ function Fo({ onChange: t, onStart: e, onEnd: n }) {
|
|
|
3906
3906
|
}
|
|
3907
3907
|
function Yo({ onChange: t }) {
|
|
3908
3908
|
const e = yt(), n = tt(t);
|
|
3909
|
-
|
|
3909
|
+
ft(() => {
|
|
3910
3910
|
n.current = t;
|
|
3911
|
-
}, [t]),
|
|
3911
|
+
}, [t]), ft(() => {
|
|
3912
3912
|
const r = (s) => {
|
|
3913
3913
|
var o;
|
|
3914
3914
|
(o = n.current) == null || o.call(n, s);
|
|
@@ -3918,7 +3918,7 @@ function Yo({ onChange: t }) {
|
|
|
3918
3918
|
}
|
|
3919
3919
|
function Uo(t) {
|
|
3920
3920
|
const [e, n] = Gt(!1), r = Array.isArray(t) ? t : [t];
|
|
3921
|
-
return
|
|
3921
|
+
return ft(() => {
|
|
3922
3922
|
const s = (i) => {
|
|
3923
3923
|
r.includes(i.key) && n(!0);
|
|
3924
3924
|
}, o = (i) => {
|
|
@@ -3976,34 +3976,34 @@ function Qo({
|
|
|
3976
3976
|
m.width = t * z, m.height = e * z, C.scale(z, z), C.clearRect(0, 0, t, e);
|
|
3977
3977
|
const M = c.nodesRef.current;
|
|
3978
3978
|
if (!M.length) return;
|
|
3979
|
-
let $ = 1 / 0,
|
|
3980
|
-
for (const
|
|
3981
|
-
const B =
|
|
3982
|
-
|
|
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);
|
|
3983
3983
|
}
|
|
3984
3984
|
const D = 40;
|
|
3985
|
-
$ -= D,
|
|
3986
|
-
const g = E - $, f = _ -
|
|
3987
|
-
for (const
|
|
3988
|
-
if (
|
|
3989
|
-
const B =
|
|
3990
|
-
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));
|
|
3991
3991
|
}
|
|
3992
3992
|
const w = c.cameraRef.current, P = c.wrapRef.current;
|
|
3993
3993
|
if (P) {
|
|
3994
|
-
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;
|
|
3995
3995
|
C.fillStyle = s, C.fillRect(0, 0, t, e);
|
|
3996
|
-
const
|
|
3997
|
-
C.clearRect(
|
|
3998
|
-
for (const
|
|
3999
|
-
if (
|
|
4000
|
-
const
|
|
4001
|
-
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));
|
|
4002
4002
|
}
|
|
4003
|
-
C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(
|
|
4003
|
+
C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(K, rt, q, G);
|
|
4004
4004
|
}
|
|
4005
4005
|
}, [c, t, e, n, r, s]);
|
|
4006
|
-
return
|
|
4006
|
+
return ft(() => {
|
|
4007
4007
|
let m = !0;
|
|
4008
4008
|
function C() {
|
|
4009
4009
|
m && (y(), l.current = requestAnimationFrame(C));
|
|
@@ -4085,16 +4085,16 @@ function ao({
|
|
|
4085
4085
|
"aria-label": C = "Canvas controls",
|
|
4086
4086
|
children: z
|
|
4087
4087
|
}) {
|
|
4088
|
-
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(() => {
|
|
4089
4089
|
$(), s == null || s();
|
|
4090
|
-
}, [$, s]),
|
|
4091
|
-
|
|
4092
|
-
}, [
|
|
4090
|
+
}, [$, s]), L = F(() => {
|
|
4091
|
+
R(), o == null || o();
|
|
4092
|
+
}, [R, o]), w = F(() => {
|
|
4093
4093
|
E(r || { padding: 0.1 }), i == null || i();
|
|
4094
4094
|
}, [E, r, i]), P = F(() => {
|
|
4095
4095
|
const B = !D;
|
|
4096
4096
|
g(B), c == null || c(B);
|
|
4097
|
-
}, [D, c]),
|
|
4097
|
+
}, [D, c]), k = {
|
|
4098
4098
|
"top-left": { top: 10, left: 10 },
|
|
4099
4099
|
"top-right": { top: 10, right: 10 },
|
|
4100
4100
|
"top-center": { top: 10, left: "50%", transform: "translateX(-50%)" },
|
|
@@ -4112,13 +4112,13 @@ function ao({
|
|
|
4112
4112
|
flexDirection: l === "horizontal" ? "row" : "column",
|
|
4113
4113
|
gap: 2,
|
|
4114
4114
|
zIndex: 5,
|
|
4115
|
-
...
|
|
4115
|
+
...k,
|
|
4116
4116
|
...y
|
|
4117
4117
|
},
|
|
4118
4118
|
role: "toolbar",
|
|
4119
4119
|
"aria-label": C,
|
|
4120
4120
|
children: [
|
|
4121
|
-
t && /* @__PURE__ */ $t(
|
|
4121
|
+
t && /* @__PURE__ */ $t(Ne, { children: [
|
|
4122
4122
|
/* @__PURE__ */ S(
|
|
4123
4123
|
rn,
|
|
4124
4124
|
{
|
|
@@ -4133,7 +4133,7 @@ function ao({
|
|
|
4133
4133
|
/* @__PURE__ */ S(
|
|
4134
4134
|
rn,
|
|
4135
4135
|
{
|
|
4136
|
-
onClick:
|
|
4136
|
+
onClick: L,
|
|
4137
4137
|
disabled: f,
|
|
4138
4138
|
title: "Zoom out",
|
|
4139
4139
|
"aria-label": "Zoom out",
|
|
@@ -4251,20 +4251,20 @@ function ts({
|
|
|
4251
4251
|
height: D.height || 60
|
|
4252
4252
|
}, u == null || u(E, { width: z.current.width, height: z.current.height });
|
|
4253
4253
|
const g = (p) => {
|
|
4254
|
-
var
|
|
4254
|
+
var j, X;
|
|
4255
4255
|
if (!z.current) return;
|
|
4256
|
-
const v = z.current,
|
|
4257
|
-
let
|
|
4258
|
-
v.direction.includes("e") && (
|
|
4259
|
-
{ id: m, type: "dimensions", dimensions: { width:
|
|
4260
|
-
]), 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 });
|
|
4261
4261
|
}, f = (p) => {
|
|
4262
4262
|
z.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
|
|
4263
4263
|
};
|
|
4264
4264
|
window.addEventListener("pointermove", g), window.addEventListener("pointerup", f);
|
|
4265
4265
|
}, [m, C, t, e, n, r, u, l, y]);
|
|
4266
4266
|
if (!s) return null;
|
|
4267
|
-
const $ = 8,
|
|
4267
|
+
const $ = 8, R = {
|
|
4268
4268
|
position: "absolute",
|
|
4269
4269
|
width: $,
|
|
4270
4270
|
height: $,
|
|
@@ -4274,60 +4274,60 @@ function ts({
|
|
|
4274
4274
|
zIndex: 20,
|
|
4275
4275
|
...o
|
|
4276
4276
|
};
|
|
4277
|
-
return /* @__PURE__ */ $t(
|
|
4277
|
+
return /* @__PURE__ */ $t(Ne, { children: [
|
|
4278
4278
|
/* @__PURE__ */ S(
|
|
4279
4279
|
"div",
|
|
4280
4280
|
{
|
|
4281
|
-
style: { ...
|
|
4281
|
+
style: { ...R, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
|
|
4282
4282
|
onPointerDown: (E) => M(E, "se")
|
|
4283
4283
|
}
|
|
4284
4284
|
),
|
|
4285
4285
|
/* @__PURE__ */ S(
|
|
4286
4286
|
"div",
|
|
4287
4287
|
{
|
|
4288
|
-
style: { ...
|
|
4288
|
+
style: { ...R, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
|
|
4289
4289
|
onPointerDown: (E) => M(E, "sw")
|
|
4290
4290
|
}
|
|
4291
4291
|
),
|
|
4292
4292
|
/* @__PURE__ */ S(
|
|
4293
4293
|
"div",
|
|
4294
4294
|
{
|
|
4295
|
-
style: { ...
|
|
4295
|
+
style: { ...R, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
|
|
4296
4296
|
onPointerDown: (E) => M(E, "ne")
|
|
4297
4297
|
}
|
|
4298
4298
|
),
|
|
4299
4299
|
/* @__PURE__ */ S(
|
|
4300
4300
|
"div",
|
|
4301
4301
|
{
|
|
4302
|
-
style: { ...
|
|
4302
|
+
style: { ...R, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
|
|
4303
4303
|
onPointerDown: (E) => M(E, "nw")
|
|
4304
4304
|
}
|
|
4305
4305
|
),
|
|
4306
4306
|
/* @__PURE__ */ S(
|
|
4307
4307
|
"div",
|
|
4308
4308
|
{
|
|
4309
|
-
style: { ...
|
|
4309
|
+
style: { ...R, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
|
|
4310
4310
|
onPointerDown: (E) => M(E, "e")
|
|
4311
4311
|
}
|
|
4312
4312
|
),
|
|
4313
4313
|
/* @__PURE__ */ S(
|
|
4314
4314
|
"div",
|
|
4315
4315
|
{
|
|
4316
|
-
style: { ...
|
|
4316
|
+
style: { ...R, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
|
|
4317
4317
|
onPointerDown: (E) => M(E, "w")
|
|
4318
4318
|
}
|
|
4319
4319
|
),
|
|
4320
4320
|
/* @__PURE__ */ S(
|
|
4321
4321
|
"div",
|
|
4322
4322
|
{
|
|
4323
|
-
style: { ...
|
|
4323
|
+
style: { ...R, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
|
|
4324
4324
|
onPointerDown: (E) => M(E, "n")
|
|
4325
4325
|
}
|
|
4326
4326
|
),
|
|
4327
4327
|
/* @__PURE__ */ S(
|
|
4328
4328
|
"div",
|
|
4329
4329
|
{
|
|
4330
|
-
style: { ...
|
|
4330
|
+
style: { ...R, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
|
|
4331
4331
|
onPointerDown: (E) => M(E, "s")
|
|
4332
4332
|
}
|
|
4333
4333
|
)
|
|
@@ -4529,7 +4529,7 @@ export {
|
|
|
4529
4529
|
vo as boxToRect,
|
|
4530
4530
|
or as buildObstacles,
|
|
4531
4531
|
Tn as clampPosition,
|
|
4532
|
-
|
|
4532
|
+
Lo as computeRoutedEdges,
|
|
4533
4533
|
zo as getBezierEdgeCenter,
|
|
4534
4534
|
nr as getBezierPath,
|
|
4535
4535
|
wo as getBoundsOfBoxes,
|
|
@@ -4552,14 +4552,14 @@ export {
|
|
|
4552
4552
|
Mo as nodeToRect,
|
|
4553
4553
|
Co as reconnectEdge,
|
|
4554
4554
|
mo as rectToBox,
|
|
4555
|
-
|
|
4555
|
+
No as routeSinglePath,
|
|
4556
4556
|
En as routedPointsToPath,
|
|
4557
4557
|
Pn as snapPosition,
|
|
4558
4558
|
Ho as useConnection,
|
|
4559
4559
|
Do as useEdges,
|
|
4560
4560
|
So as useEdgesState,
|
|
4561
4561
|
Xo as useHandleConnections,
|
|
4562
|
-
|
|
4562
|
+
Nr as useInfiniteCanvas,
|
|
4563
4563
|
Go as useInternalNode,
|
|
4564
4564
|
Uo as useKeyPress,
|
|
4565
4565
|
Wo as useNodeConnections,
|