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