@infinit-canvas/react 0.1.0 → 0.1.1
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 +151 -136
- package/package.json +1 -1
- package/src/types.d.ts +131 -0
|
@@ -1004,7 +1004,7 @@ function Lr({
|
|
|
1004
1004
|
selectionOnDrag: ne = !1,
|
|
1005
1005
|
selectionMode: Ie = "partial",
|
|
1006
1006
|
connectionMode: Bt = "loose",
|
|
1007
|
-
connectionRadius:
|
|
1007
|
+
connectionRadius: Ot = 20,
|
|
1008
1008
|
connectOnClick: Yt = !1,
|
|
1009
1009
|
snapToGrid: me = !1,
|
|
1010
1010
|
snapGrid: de = [15, 15],
|
|
@@ -1013,22 +1013,22 @@ function Lr({
|
|
|
1013
1013
|
panOnScroll: Ge = !1,
|
|
1014
1014
|
panOnScrollMode: $e = "free",
|
|
1015
1015
|
panOnScrollSpeed: Ze = 0.5,
|
|
1016
|
-
zoomOnScroll:
|
|
1017
|
-
zoomOnDoubleClick:
|
|
1018
|
-
zoomOnPinch:
|
|
1016
|
+
zoomOnScroll: Oe = !0,
|
|
1017
|
+
zoomOnDoubleClick: Qe = !0,
|
|
1018
|
+
zoomOnPinch: Ke = !0,
|
|
1019
1019
|
preventScrolling: Pe = !0,
|
|
1020
1020
|
translateExtent: re,
|
|
1021
1021
|
nodeExtent: oe,
|
|
1022
1022
|
defaultEdgeOptions: be = {},
|
|
1023
1023
|
autoPanOnNodeDrag: dn = !0,
|
|
1024
1024
|
autoPanOnConnect: fn = !0,
|
|
1025
|
-
autoPanSpeed:
|
|
1025
|
+
autoPanSpeed: Qt = 5,
|
|
1026
1026
|
edgesReconnectable: Nn = !1,
|
|
1027
1027
|
elevateNodesOnSelect: hn = !1,
|
|
1028
1028
|
edgeRouting: fe = !0
|
|
1029
1029
|
} = {}) {
|
|
1030
|
-
const pt = V(null), Te = V(null), zt = V(null), gt = V({ ...Nt }), se = V([...t]), Z = V([...e]), Pt = V([...n]), yn = V(/* @__PURE__ */ new Map()), Se = V(!1), te = V(null), [gn, pn] = Gt(!1), _t = V(null), Wt = V(null), Me = V(null), ie = V(null), Ut = V(!1), Re = V(null), [Be, Je] = Gt({ x: Nt.x, y: Nt.y, zoom: Nt.zoom }), [Ve, ae] = Gt(null),
|
|
1031
|
-
|
|
1030
|
+
const pt = V(null), Te = V(null), zt = V(null), gt = V({ ...Nt }), se = V([...t]), Z = V([...e]), Pt = V([...n]), yn = V(/* @__PURE__ */ new Map()), Se = V(!1), te = V(null), [gn, pn] = Gt(!1), _t = V(null), Wt = V(null), Me = V(null), ie = V(null), Ut = V(!1), Re = V(null), [Be, Je] = Gt({ x: Nt.x, y: Nt.y, zoom: Nt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = V(!1), O = V({});
|
|
1031
|
+
O.current = {
|
|
1032
1032
|
onHudUpdate: r,
|
|
1033
1033
|
onNodesProcessed: s,
|
|
1034
1034
|
onNodesChange: o,
|
|
@@ -1067,29 +1067,29 @@ function Lr({
|
|
|
1067
1067
|
isValidConnection: ct
|
|
1068
1068
|
};
|
|
1069
1069
|
const wt = { get current() {
|
|
1070
|
-
return
|
|
1070
|
+
return O.current.onNodesChange;
|
|
1071
1071
|
} }, Dt = { get current() {
|
|
1072
|
-
return
|
|
1072
|
+
return O.current.onEdgesChange;
|
|
1073
1073
|
} }, ce = { get current() {
|
|
1074
|
-
return
|
|
1074
|
+
return O.current.onConnect;
|
|
1075
1075
|
} }, De = { get current() {
|
|
1076
|
-
return
|
|
1076
|
+
return O.current.onNodeClick;
|
|
1077
1077
|
} }, He = { get current() {
|
|
1078
|
-
return
|
|
1078
|
+
return O.current.onNodeDragStart;
|
|
1079
1079
|
} }, Ae = { get current() {
|
|
1080
|
-
return
|
|
1080
|
+
return O.current.onNodeDrag;
|
|
1081
1081
|
} }, _e = { get current() {
|
|
1082
|
-
return
|
|
1082
|
+
return O.current.onNodeDragStop;
|
|
1083
1083
|
} }, le = { get current() {
|
|
1084
|
-
return
|
|
1084
|
+
return O.current.onEdgeClick;
|
|
1085
1085
|
} }, We = { get current() {
|
|
1086
|
-
return
|
|
1086
|
+
return O.current.onPaneClick;
|
|
1087
1087
|
} }, ye = { get current() {
|
|
1088
|
-
return
|
|
1088
|
+
return O.current.onSelectionChange;
|
|
1089
1089
|
} }, ge = { get current() {
|
|
1090
|
-
return
|
|
1090
|
+
return O.current.onHudUpdate;
|
|
1091
1091
|
} }, pe = { get current() {
|
|
1092
|
-
return
|
|
1092
|
+
return O.current.onNodesProcessed;
|
|
1093
1093
|
} };
|
|
1094
1094
|
ut(() => {
|
|
1095
1095
|
const a = (d) => {
|
|
@@ -1123,7 +1123,7 @@ function Lr({
|
|
|
1123
1123
|
I += h.position.x, $ += h.position.y, h = h.parentId ? m[h.parentId] : null;
|
|
1124
1124
|
return { ...d, _absolutePosition: { x: I, y: $ } };
|
|
1125
1125
|
});
|
|
1126
|
-
}, []), ee = V([]),
|
|
1126
|
+
}, []), ee = V([]), Q = F((a) => {
|
|
1127
1127
|
const m = yn.current;
|
|
1128
1128
|
if (!m || m.size === 0) return a;
|
|
1129
1129
|
const d = {};
|
|
@@ -1136,9 +1136,9 @@ function Lr({
|
|
|
1136
1136
|
}, []), Ft = F(() => {
|
|
1137
1137
|
var m;
|
|
1138
1138
|
if (_t.current) return;
|
|
1139
|
-
const a =
|
|
1139
|
+
const a = Q(ee.current);
|
|
1140
1140
|
(m = zt.current) == null || m.postMessage({ type: "nodes", data: { nodes: a } });
|
|
1141
|
-
}, [
|
|
1141
|
+
}, [Q]);
|
|
1142
1142
|
ut(() => {
|
|
1143
1143
|
var d;
|
|
1144
1144
|
if (_t.current) {
|
|
@@ -1154,9 +1154,9 @@ function Lr({
|
|
|
1154
1154
|
Z.current = [...e];
|
|
1155
1155
|
const a = ze(e);
|
|
1156
1156
|
ee.current = a;
|
|
1157
|
-
const m =
|
|
1157
|
+
const m = Q(a);
|
|
1158
1158
|
(d = zt.current) == null || d.postMessage({ type: "nodes", data: { nodes: m } });
|
|
1159
|
-
}, [e, ze,
|
|
1159
|
+
}, [e, ze, Q]), ut(() => {
|
|
1160
1160
|
var a;
|
|
1161
1161
|
Pt.current = [...n], (a = zt.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
|
|
1162
1162
|
}, [n]);
|
|
@@ -1210,7 +1210,7 @@ function Lr({
|
|
|
1210
1210
|
{ id: null, type: "source", x: a.position.x + m, y: a.position.y + d / 2 }
|
|
1211
1211
|
];
|
|
1212
1212
|
}, [xe]), tn = F((a, m) => {
|
|
1213
|
-
const d = Z.current, w = gt.current, I = Math.max(Nr,
|
|
1213
|
+
const d = Z.current, w = gt.current, I = Math.max(Nr, Ot) / w.zoom;
|
|
1214
1214
|
for (let $ = d.length - 1; $ >= 0; $--) {
|
|
1215
1215
|
const h = d[$];
|
|
1216
1216
|
if (h.hidden) continue;
|
|
@@ -1225,8 +1225,8 @@ function Lr({
|
|
|
1225
1225
|
for (let I = Pt.current.length - 1; I >= 0; I--) {
|
|
1226
1226
|
const $ = Pt.current[I], h = Z.current.find((bt) => bt.id === $.source), A = Z.current.find((bt) => bt.id === $.target);
|
|
1227
1227
|
if (!h || !A) continue;
|
|
1228
|
-
const S = h.width || Vt, U = h.height || jt, _ = A.height || jt,
|
|
1229
|
-
if (Ir(a, m,
|
|
1228
|
+
const S = h.width || Vt, U = h.height || jt, _ = A.height || jt, K = h.position.x + S, it = h.position.y + U / 2, q = A.position.x, nt = A.position.y + _ / 2;
|
|
1229
|
+
if (Ir(a, m, K, it, q, nt) < w) return $;
|
|
1230
1230
|
}
|
|
1231
1231
|
return null;
|
|
1232
1232
|
}, []);
|
|
@@ -1235,7 +1235,7 @@ function Lr({
|
|
|
1235
1235
|
if (!a || !m) return;
|
|
1236
1236
|
const d = m.getBoundingClientRect(), w = lt !== void 0 ? lt : matchMedia("(prefers-color-scheme: dark)").matches, I = ze(Z.current);
|
|
1237
1237
|
ee.current = I;
|
|
1238
|
-
const $ =
|
|
1238
|
+
const $ = Q(I), { worker: h } = Cr(a, {
|
|
1239
1239
|
width: d.width,
|
|
1240
1240
|
height: d.height,
|
|
1241
1241
|
camera: gt.current,
|
|
@@ -1247,12 +1247,12 @@ function Lr({
|
|
|
1247
1247
|
edgeRouting: fe
|
|
1248
1248
|
});
|
|
1249
1249
|
h.onmessage = (_) => {
|
|
1250
|
-
var
|
|
1251
|
-
_.data.type === "hud" && ((
|
|
1250
|
+
var K, it;
|
|
1251
|
+
_.data.type === "hud" && ((K = ge.current) == null || K.call(ge, _.data.data)), _.data.type === "ready" && pn(!0), _.data.type === "nodesProcessed" && ((it = pe.current) == null || it.call(pe, _.data.data));
|
|
1252
1252
|
}, zt.current = h;
|
|
1253
1253
|
const A = new ResizeObserver((_) => {
|
|
1254
|
-
const { width:
|
|
1255
|
-
h.postMessage({ type: "resize", data: { width:
|
|
1254
|
+
const { width: K, height: it } = _[0].contentRect;
|
|
1255
|
+
h.postMessage({ type: "resize", data: { width: K, height: it } });
|
|
1256
1256
|
});
|
|
1257
1257
|
A.observe(m);
|
|
1258
1258
|
let S, U;
|
|
@@ -1272,18 +1272,18 @@ function Lr({
|
|
|
1272
1272
|
if (re) {
|
|
1273
1273
|
const h = pt.current;
|
|
1274
1274
|
if (h) {
|
|
1275
|
-
const A = h.getBoundingClientRect(), S = -re[1][0] * m.zoom + A.width, U = -re[1][1] * m.zoom + A.height, _ = -re[0][0] * m.zoom,
|
|
1276
|
-
m.x = Math.min(_, Math.max(S, m.x)), m.y = Math.min(
|
|
1275
|
+
const A = h.getBoundingClientRect(), S = -re[1][0] * m.zoom + A.width, U = -re[1][1] * m.zoom + A.height, _ = -re[0][0] * m.zoom, K = -re[0][1] * m.zoom;
|
|
1276
|
+
m.x = Math.min(_, Math.max(S, m.x)), m.y = Math.min(K, Math.max(U, m.y));
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
1279
|
(w = zt.current) == null || w.postMessage({ type: "camera", data: { camera: { ...m } } });
|
|
1280
1280
|
const d = { x: m.x, y: m.y, zoom: m.zoom };
|
|
1281
|
-
($ = (I =
|
|
1282
|
-
for (const h of
|
|
1281
|
+
($ = (I = O.current).onMove) == null || $.call(I, a, d);
|
|
1282
|
+
for (const h of Kt) h(d);
|
|
1283
1283
|
cancelAnimationFrame(Ln.current), Ln.current = requestAnimationFrame(() => {
|
|
1284
1284
|
Je({ x: m.x, y: m.y, zoom: m.zoom });
|
|
1285
1285
|
});
|
|
1286
|
-
}, [
|
|
1286
|
+
}, [Kt, re]), Ce = F(() => {
|
|
1287
1287
|
var d, w;
|
|
1288
1288
|
const a = Wt.current, m = Me.current;
|
|
1289
1289
|
a && m ? ((d = zt.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: m, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((w = zt.current) == null || w.postMessage({ type: "connecting", data: null }), ae(null));
|
|
@@ -1292,7 +1292,7 @@ function Lr({
|
|
|
1292
1292
|
const a = ie.current;
|
|
1293
1293
|
a ? (m = zt.current) == null || m.postMessage({ type: "selectionBox", data: a }) : (d = zt.current) == null || d.postMessage({ type: "selectionBox", data: null });
|
|
1294
1294
|
}, []), dr = F((a) => {
|
|
1295
|
-
var I, $, h, A, S, U, _,
|
|
1295
|
+
var I, $, h, A, S, U, _, K, it, q, nt, xt, bt, Ht, Xt, At;
|
|
1296
1296
|
const m = Z.current.length > 0, d = st(a.clientX, a.clientY), w = Ut.current;
|
|
1297
1297
|
if (m && kt) {
|
|
1298
1298
|
const X = tn(d.x, d.y);
|
|
@@ -1300,14 +1300,14 @@ function Lr({
|
|
|
1300
1300
|
const J = Re.current;
|
|
1301
1301
|
if (X.nodeId !== J.nodeId) {
|
|
1302
1302
|
const qt = J.handleType === "target" ? { source: X.nodeId, target: J.nodeId, sourceHandle: X.handleId || null, targetHandle: J.handleId } : { source: J.nodeId, target: X.nodeId, sourceHandle: J.handleId, targetHandle: X.handleId || null };
|
|
1303
|
-
(
|
|
1303
|
+
(O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((I = ce.current) == null || I.call(ce, { ...qt, ...be }));
|
|
1304
1304
|
}
|
|
1305
1305
|
Re.current = null;
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
1308
|
if (Bt === "strict" ? X && X.type === "source" : X != null) {
|
|
1309
1309
|
if (Yt) {
|
|
1310
|
-
Re.current = { nodeId: X.nodeId, handleId: X.handleId || null, handleType: X.type }, (h = ($ =
|
|
1310
|
+
Re.current = { nodeId: X.nodeId, handleId: X.handleId || null, handleType: X.type }, (h = ($ = O.current).onConnectStart) == null || h.call($, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type });
|
|
1311
1311
|
return;
|
|
1312
1312
|
}
|
|
1313
1313
|
Wt.current = {
|
|
@@ -1315,7 +1315,7 @@ function Lr({
|
|
|
1315
1315
|
sourceHandle: X.handleId || null,
|
|
1316
1316
|
sourceType: X.type,
|
|
1317
1317
|
startPos: { x: X.x, y: X.y }
|
|
1318
|
-
}, Me.current = { x: d.x, y: d.y }, (A = pt.current) == null || A.setPointerCapture(a.pointerId), (U = (S =
|
|
1318
|
+
}, Me.current = { x: d.x, y: d.y }, (A = pt.current) == null || A.setPointerCapture(a.pointerId), (U = (S = O.current).onConnectStart) == null || U.call(S, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type }), Ce();
|
|
1319
1319
|
return;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
@@ -1351,7 +1351,7 @@ function Lr({
|
|
|
1351
1351
|
if (X.parentId && X.extent === "parent") {
|
|
1352
1352
|
const tt = Z.current.find((qt) => qt.id === X.parentId);
|
|
1353
1353
|
if (tt) {
|
|
1354
|
-
const qt = tt.width || Vt, Xe = tt.height || jt, en = X.width || ((
|
|
1354
|
+
const qt = tt.width || Vt, Xe = tt.height || jt, en = X.width || ((K = X.measured) == null ? void 0 : K.width) || Vt, Fe = X.height || ((it = X.measured) == null ? void 0 : it.height) || jt;
|
|
1355
1355
|
J = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
@@ -1421,7 +1421,7 @@ function Lr({
|
|
|
1421
1421
|
if (I) {
|
|
1422
1422
|
const $ = I.getBoundingClientRect(), h = 40, A = a.clientX - $.left, S = a.clientY - $.top;
|
|
1423
1423
|
let U = 0, _ = 0;
|
|
1424
|
-
A < h ? U =
|
|
1424
|
+
A < h ? U = Qt : A > $.width - h && (U = -Qt), S < h ? _ = Qt : S > $.height - h && (_ = -Qt), (U || _) && (gt.current.x += U, gt.current.y += _, Et(a));
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
return;
|
|
@@ -1433,7 +1433,7 @@ function Lr({
|
|
|
1433
1433
|
const U = [];
|
|
1434
1434
|
for (const _ of Z.current) {
|
|
1435
1435
|
if (_.hidden) continue;
|
|
1436
|
-
const
|
|
1436
|
+
const K = _.width || Vt, it = _.height || jt, q = Ie === "full" ? _.position.x >= $ && _.position.x + K <= A && _.position.y >= h && _.position.y + it <= S : _.position.x + K > $ && _.position.x < A && _.position.y + it > h && _.position.y < S;
|
|
1437
1437
|
q !== !!_.selected && U.push({ id: _.id, type: "select", selected: q });
|
|
1438
1438
|
}
|
|
1439
1439
|
U.length && wt.current(U);
|
|
@@ -1479,9 +1479,9 @@ function Lr({
|
|
|
1479
1479
|
});
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
const
|
|
1482
|
+
const K = new Set(U.map((q) => q.id));
|
|
1483
1483
|
for (const q of Z.current)
|
|
1484
|
-
if (q.parentId &&
|
|
1484
|
+
if (q.parentId && K.has(q.parentId) && !K.has(q.id)) {
|
|
1485
1485
|
let nt = Z.current.find((Ht) => Ht.id === q.parentId), xt = q.position.x, bt = q.position.y;
|
|
1486
1486
|
for (; nt; )
|
|
1487
1487
|
xt += nt.position.x, bt += nt.position.y, nt = nt.parentId ? Z.current.find((Ht) => Ht.id === nt.parentId) : null;
|
|
@@ -1500,7 +1500,7 @@ function Lr({
|
|
|
1500
1500
|
if (q) {
|
|
1501
1501
|
const nt = q.getBoundingClientRect(), xt = 40, bt = a.clientX - nt.left, Ht = a.clientY - nt.top;
|
|
1502
1502
|
let Xt = 0, At = 0;
|
|
1503
|
-
bt < xt ? Xt =
|
|
1503
|
+
bt < xt ? Xt = Qt : bt > nt.width - xt && (Xt = -Qt), Ht < xt ? At = Qt : Ht > nt.height - xt && (At = -Qt), (Xt || At) && (gt.current.x += Xt, gt.current.y += At, Et(a));
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
1506
|
const it = Z.current.find((q) => q.id === $.id);
|
|
@@ -1526,9 +1526,9 @@ function Lr({
|
|
|
1526
1526
|
sourceHandle: Wt.current.sourceHandle,
|
|
1527
1527
|
targetHandle: A.handleId || null
|
|
1528
1528
|
};
|
|
1529
|
-
(
|
|
1529
|
+
(O.current.isValidConnection ? O.current.isValidConnection(_) : !0) && ((m = ce.current) == null || m.call(ce, { ..._, ...be }));
|
|
1530
1530
|
}
|
|
1531
|
-
(w = (d =
|
|
1531
|
+
(w = (d = O.current).onConnectEnd) == null || w.call(d, a.nativeEvent || a), Wt.current = null, Me.current = null, Ce();
|
|
1532
1532
|
return;
|
|
1533
1533
|
}
|
|
1534
1534
|
if (ie.current) {
|
|
@@ -1545,11 +1545,11 @@ function Lr({
|
|
|
1545
1545
|
dragging: !1
|
|
1546
1546
|
}];
|
|
1547
1547
|
for (const _ of h.selectedStarts) {
|
|
1548
|
-
const
|
|
1548
|
+
const K = Z.current.find((it) => it.id === _.id);
|
|
1549
1549
|
U.push({
|
|
1550
1550
|
id: _.id,
|
|
1551
1551
|
type: "position",
|
|
1552
|
-
position:
|
|
1552
|
+
position: K ? { ...K.position } : void 0,
|
|
1553
1553
|
dragging: !1
|
|
1554
1554
|
});
|
|
1555
1555
|
}
|
|
@@ -1575,13 +1575,13 @@ function Lr({
|
|
|
1575
1575
|
$e === "horizontal" ? w.x -= d.deltaY * S : ($e === "vertical" || (w.x -= d.deltaX * S), w.y -= d.deltaY * S), Et(d);
|
|
1576
1576
|
return;
|
|
1577
1577
|
}
|
|
1578
|
-
if (!
|
|
1578
|
+
if (!Oe) return;
|
|
1579
1579
|
const I = d.deltaY > 0 ? 0.92 : 1.08, $ = a.getBoundingClientRect(), h = d.clientX - $.left, A = d.clientY - $.top;
|
|
1580
1580
|
w.x = h - (h - w.x) * I, w.y = A - (A - w.y) * I, w.zoom = Math.min(ot, Math.max(et, w.zoom * I)), Et(d);
|
|
1581
1581
|
};
|
|
1582
1582
|
return a.addEventListener("wheel", m, { passive: !Pe }), () => a.removeEventListener("wheel", m);
|
|
1583
|
-
}, [Et, et, ot, Ge, $e, Ze,
|
|
1584
|
-
if (!
|
|
1583
|
+
}, [Et, et, ot, Ge, $e, Ze, Oe, Pe]), ut(() => {
|
|
1584
|
+
if (!Ke) return;
|
|
1585
1585
|
const a = pt.current;
|
|
1586
1586
|
if (!a) return;
|
|
1587
1587
|
let m = 0, d = null;
|
|
@@ -1600,8 +1600,8 @@ function Lr({
|
|
|
1600
1600
|
h.preventDefault();
|
|
1601
1601
|
const A = h.touches[0].clientX - h.touches[1].clientX, S = h.touches[0].clientY - h.touches[1].clientY, U = Math.hypot(A, S), _ = U / m;
|
|
1602
1602
|
m = U;
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1603
|
+
const K = gt.current, it = d.x, q = d.y;
|
|
1604
|
+
K.x = it - (it - K.x) * _, K.y = q - (q - K.y) * _, K.zoom = Math.min(ot, Math.max(et, K.zoom * _)), Et(h);
|
|
1605
1605
|
}
|
|
1606
1606
|
}, $ = () => {
|
|
1607
1607
|
m = 0, d = null;
|
|
@@ -1609,42 +1609,42 @@ function Lr({
|
|
|
1609
1609
|
return a.addEventListener("touchstart", w, { passive: !1 }), a.addEventListener("touchmove", I, { passive: !1 }), a.addEventListener("touchend", $), () => {
|
|
1610
1610
|
a.removeEventListener("touchstart", w), a.removeEventListener("touchmove", I), a.removeEventListener("touchend", $);
|
|
1611
1611
|
};
|
|
1612
|
-
}, [
|
|
1613
|
-
if (!
|
|
1612
|
+
}, [Ke, Et, et, ot]), ut(() => {
|
|
1613
|
+
if (!Qe) return;
|
|
1614
1614
|
const a = pt.current;
|
|
1615
1615
|
if (!a) return;
|
|
1616
1616
|
const m = (d) => {
|
|
1617
|
-
var _,
|
|
1617
|
+
var _, K, it, q;
|
|
1618
1618
|
const w = st(d.clientX, d.clientY);
|
|
1619
1619
|
if (Tt(w.x, w.y)) {
|
|
1620
|
-
(
|
|
1620
|
+
(K = (_ = O.current).onNodeDoubleClick) == null || K.call(_, d, Tt(w.x, w.y));
|
|
1621
1621
|
return;
|
|
1622
1622
|
}
|
|
1623
1623
|
const I = ue(w.x, w.y);
|
|
1624
1624
|
if (I) {
|
|
1625
|
-
(q = (it =
|
|
1625
|
+
(q = (it = O.current).onEdgeDoubleClick) == null || q.call(it, d, I);
|
|
1626
1626
|
return;
|
|
1627
1627
|
}
|
|
1628
1628
|
const $ = 1.5, h = a.getBoundingClientRect(), A = d.clientX - h.left, S = d.clientY - h.top, U = gt.current;
|
|
1629
1629
|
U.x = A - (A - U.x) * $, U.y = S - (S - U.y) * $, U.zoom = Math.min(ot, Math.max(et, U.zoom * $)), Et(d);
|
|
1630
1630
|
};
|
|
1631
1631
|
return a.addEventListener("dblclick", m), () => a.removeEventListener("dblclick", m);
|
|
1632
|
-
}, [
|
|
1632
|
+
}, [Qe, Et, et, ot, st, Tt, ue]), ut(() => {
|
|
1633
1633
|
const a = pt.current;
|
|
1634
1634
|
if (!a) return;
|
|
1635
1635
|
const m = (d) => {
|
|
1636
|
-
var h, A, S, U, _,
|
|
1636
|
+
var h, A, S, U, _, K;
|
|
1637
1637
|
const w = st(d.clientX, d.clientY), I = Tt(w.x, w.y);
|
|
1638
1638
|
if (I) {
|
|
1639
|
-
(A = (h =
|
|
1639
|
+
(A = (h = O.current).onNodeContextMenu) == null || A.call(h, d, I);
|
|
1640
1640
|
return;
|
|
1641
1641
|
}
|
|
1642
1642
|
const $ = ue(w.x, w.y);
|
|
1643
1643
|
if ($) {
|
|
1644
|
-
(U = (S =
|
|
1644
|
+
(U = (S = O.current).onEdgeContextMenu) == null || U.call(S, d, $);
|
|
1645
1645
|
return;
|
|
1646
1646
|
}
|
|
1647
|
-
(
|
|
1647
|
+
(K = (_ = O.current).onPaneContextMenu) == null || K.call(_, d);
|
|
1648
1648
|
};
|
|
1649
1649
|
return a.addEventListener("contextmenu", m), () => a.removeEventListener("contextmenu", m);
|
|
1650
1650
|
}, [st, Tt, ue]), ut(() => {
|
|
@@ -1652,19 +1652,19 @@ function Lr({
|
|
|
1652
1652
|
if (!a) return;
|
|
1653
1653
|
let m = null, d = null;
|
|
1654
1654
|
const w = (h) => {
|
|
1655
|
-
var U, _,
|
|
1656
|
-
(_ = (U =
|
|
1655
|
+
var U, _, K, it, q, nt, xt, bt, Ht, Xt, At, X, Mt, J;
|
|
1656
|
+
(_ = (U = O.current).onPaneMouseMove) == null || _.call(U, h);
|
|
1657
1657
|
const A = st(h.clientX, h.clientY), S = Tt(A.x, A.y);
|
|
1658
|
-
if (S !== m && (m && ((it = (
|
|
1658
|
+
if (S !== m && (m && ((it = (K = O.current).onNodeMouseLeave) == null || it.call(K, h, m)), S && ((nt = (q = O.current).onNodeMouseEnter) == null || nt.call(q, h, S)), m = S), S && ((bt = (xt = O.current).onNodeMouseMove) == null || bt.call(xt, h, S)), !S) {
|
|
1659
1659
|
const tt = ue(A.x, A.y);
|
|
1660
|
-
tt !== d && (d && ((Xt = (Ht =
|
|
1660
|
+
tt !== d && (d && ((Xt = (Ht = O.current).onEdgeMouseLeave) == null || Xt.call(Ht, h, d)), tt && ((X = (At = O.current).onEdgeMouseEnter) == null || X.call(At, h, tt)), d = tt), tt && ((J = (Mt = O.current).onEdgeMouseMove) == null || J.call(Mt, h, tt));
|
|
1661
1661
|
}
|
|
1662
1662
|
}, I = (h) => {
|
|
1663
1663
|
var A, S;
|
|
1664
|
-
return (S = (A =
|
|
1664
|
+
return (S = (A = O.current).onPaneMouseEnter) == null ? void 0 : S.call(A, h);
|
|
1665
1665
|
}, $ = (h) => {
|
|
1666
|
-
var A, S, U, _,
|
|
1667
|
-
(S = (A =
|
|
1666
|
+
var A, S, U, _, K, it;
|
|
1667
|
+
(S = (A = O.current).onPaneMouseLeave) == null || S.call(A, h), m && ((_ = (U = O.current).onNodeMouseLeave) == null || _.call(U, h, m), m = null), d && ((it = (K = O.current).onEdgeMouseLeave) == null || it.call(K, h, d), d = null);
|
|
1668
1668
|
};
|
|
1669
1669
|
return a.addEventListener("mousemove", w), a.addEventListener("mouseenter", I), a.addEventListener("mouseleave", $), () => {
|
|
1670
1670
|
a.removeEventListener("mousemove", w), a.removeEventListener("mouseenter", I), a.removeEventListener("mouseleave", $);
|
|
@@ -1675,14 +1675,14 @@ function Lr({
|
|
|
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 $ = Z.current.filter((S) => S.selected), h = Pt.current.filter((S) => S.selected);
|
|
1678
|
-
if (!$.length && !h.length ||
|
|
1678
|
+
if (!$.length && !h.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: $, edges: h }))
|
|
1679
1679
|
return;
|
|
1680
1680
|
const A = new Set($.map((S) => S.id));
|
|
1681
1681
|
if ($.length && wt.current && (wt.current($.map((S) => ({ id: S.id, type: "remove" }))), Dt.current)) {
|
|
1682
1682
|
const S = Pt.current.filter((U) => A.has(U.source) || A.has(U.target));
|
|
1683
1683
|
S.length && Dt.current(S.map((U) => ({ id: U.id, type: "remove" })));
|
|
1684
1684
|
}
|
|
1685
|
-
h.length && Dt.current && Dt.current(h.map((S) => ({ id: S.id, type: "remove" }))), (I = (w =
|
|
1685
|
+
h.length && Dt.current && Dt.current(h.map((S) => ({ id: S.id, type: "remove" }))), (I = (w = O.current).onDelete) == null || I.call(w, { nodes: $, 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;
|
|
@@ -1709,7 +1709,7 @@ function Lr({
|
|
|
1709
1709
|
vt != null && vt.maxZoom && (h.zoom = Math.min(h.zoom, vt.maxZoom)), vt != null && vt.minZoom && (h.zoom = Math.max(h.zoom, vt.minZoom)), gt.current = h, Et();
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
|
-
(m = (a =
|
|
1712
|
+
(m = (a = O.current).onInit) == null || m.call(a, {
|
|
1713
1713
|
getNodes: () => [...Z.current],
|
|
1714
1714
|
getEdges: () => [...Pt.current],
|
|
1715
1715
|
getViewport: () => ({ ...gt.current }),
|
|
@@ -1768,7 +1768,7 @@ function Lr({
|
|
|
1768
1768
|
onEdgesChangeRef: Dt,
|
|
1769
1769
|
sendCamera: Et,
|
|
1770
1770
|
screenToWorld: st,
|
|
1771
|
-
viewportListeners:
|
|
1771
|
+
viewportListeners: Kt,
|
|
1772
1772
|
selectionListeners: he,
|
|
1773
1773
|
zoomMin: et,
|
|
1774
1774
|
zoomMax: ot,
|
|
@@ -1793,7 +1793,7 @@ function Lr({
|
|
|
1793
1793
|
get connection() {
|
|
1794
1794
|
return Ve;
|
|
1795
1795
|
}
|
|
1796
|
-
}), [e, n, $n, Be, Ve, Et, st, Ft,
|
|
1796
|
+
}), [e, n, $n, Be, Ve, Et, st, Ft, Kt, he, et, ot, me, de, oe, be, fe]);
|
|
1797
1797
|
return {
|
|
1798
1798
|
wrapRef: pt,
|
|
1799
1799
|
canvasRef: Te,
|
|
@@ -1989,10 +1989,10 @@ function $r({ node: t, nodeType: e }) {
|
|
|
1989
1989
|
}
|
|
1990
1990
|
) });
|
|
1991
1991
|
}
|
|
1992
|
-
const Pr = Zt($r),
|
|
1992
|
+
const Pr = Zt($r), On = 160, Qn = 60;
|
|
1993
1993
|
function Bn(t, e, n, r) {
|
|
1994
1994
|
var c, u;
|
|
1995
|
-
const s = t.width || ((c = t.measured) == null ? void 0 : c.width) ||
|
|
1995
|
+
const s = t.width || ((c = t.measured) == null ? void 0 : c.width) || On, o = t.height || ((u = t.measured) == null ? void 0 : u.height) || Qn, i = t._absolutePosition || t.position;
|
|
1996
1996
|
if (t.handleBounds) {
|
|
1997
1997
|
const l = t.handleBounds[e] || [], g = n ? l.find((v) => v.id === n) : l[0];
|
|
1998
1998
|
if (g && g.x !== void 0 && g.y !== void 0) {
|
|
@@ -2072,7 +2072,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
|
2072
2072
|
const et = (ot = s.handleRegistryRef) == null ? void 0 : ot.current;
|
|
2073
2073
|
for (const Lt of s.nodesRef.current) {
|
|
2074
2074
|
if (Lt.hidden) continue;
|
|
2075
|
-
const kt = Lt.width ||
|
|
2075
|
+
const kt = Lt.width || On, $t = Lt.height || Qn, mt = Lt._absolutePosition || Lt.position, ne = [];
|
|
2076
2076
|
if (et)
|
|
2077
2077
|
for (const [, Bt] of et)
|
|
2078
2078
|
Bt.nodeId === Lt.id && ne.push(Bt);
|
|
@@ -2081,25 +2081,25 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
|
2081
2081
|
{ type: "source", position: "right" }
|
|
2082
2082
|
];
|
|
2083
2083
|
for (const Bt of Ie) {
|
|
2084
|
-
let
|
|
2084
|
+
let Ot, Yt;
|
|
2085
2085
|
if (Bt.x !== void 0 && Bt.y !== void 0)
|
|
2086
|
-
|
|
2086
|
+
Ot = mt.x + Bt.x, Yt = mt.y + Bt.y;
|
|
2087
2087
|
else
|
|
2088
2088
|
switch (Bt.position || (Bt.type === "source" ? "right" : "left")) {
|
|
2089
2089
|
case "top":
|
|
2090
|
-
|
|
2090
|
+
Ot = mt.x + kt / 2, Yt = mt.y;
|
|
2091
2091
|
break;
|
|
2092
2092
|
case "bottom":
|
|
2093
|
-
|
|
2093
|
+
Ot = mt.x + kt / 2, Yt = mt.y + $t;
|
|
2094
2094
|
break;
|
|
2095
2095
|
case "left":
|
|
2096
|
-
|
|
2096
|
+
Ot = mt.x, Yt = mt.y + $t / 2;
|
|
2097
2097
|
break;
|
|
2098
2098
|
default:
|
|
2099
|
-
|
|
2099
|
+
Ot = mt.x + kt, Yt = mt.y + $t / 2;
|
|
2100
2100
|
break;
|
|
2101
2101
|
}
|
|
2102
|
-
if (Math.abs(rt -
|
|
2102
|
+
if (Math.abs(rt - Ot) < ct && Math.abs(at - Yt) < ct) {
|
|
2103
2103
|
lt = Lt, Ct = Bt.id || null;
|
|
2104
2104
|
break;
|
|
2105
2105
|
}
|
|
@@ -2177,7 +2177,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
|
|
|
2177
2177
|
);
|
|
2178
2178
|
}
|
|
2179
2179
|
const Dr = Zt(Br);
|
|
2180
|
-
function
|
|
2180
|
+
function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
2181
2181
|
var T;
|
|
2182
2182
|
const n = ht(), [r, s] = Gt(null), o = V(null);
|
|
2183
2183
|
if (ut(() => {
|
|
@@ -2240,8 +2240,8 @@ function On({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
|
|
|
2240
2240
|
}
|
|
2241
2241
|
);
|
|
2242
2242
|
}
|
|
2243
|
-
|
|
2244
|
-
const Hr = Zt(
|
|
2243
|
+
Kn.displayName = "SelectionBox";
|
|
2244
|
+
const Hr = Zt(Kn);
|
|
2245
2245
|
function Jn(t, e) {
|
|
2246
2246
|
var s, o, i, c;
|
|
2247
2247
|
const n = (s = t.handleRegistryRef) == null ? void 0 : s.current;
|
|
@@ -3235,7 +3235,7 @@ const ar = Zt(function({
|
|
|
3235
3235
|
);
|
|
3236
3236
|
});
|
|
3237
3237
|
ar.displayName = "SmoothStepEdge";
|
|
3238
|
-
const
|
|
3238
|
+
const Or = Zt(function({ id: e, ...n }) {
|
|
3239
3239
|
var s;
|
|
3240
3240
|
const r = St(
|
|
3241
3241
|
() => {
|
|
@@ -3246,7 +3246,7 @@ const Qr = Zt(function({ id: e, ...n }) {
|
|
|
3246
3246
|
);
|
|
3247
3247
|
return /* @__PURE__ */ B(ar, { ...n, id: e, pathOptions: r });
|
|
3248
3248
|
});
|
|
3249
|
-
|
|
3249
|
+
Or.displayName = "StepEdge";
|
|
3250
3250
|
const cr = Zt(function({
|
|
3251
3251
|
id: e,
|
|
3252
3252
|
sourceX: n,
|
|
@@ -3300,11 +3300,11 @@ const cr = Zt(function({
|
|
|
3300
3300
|
);
|
|
3301
3301
|
});
|
|
3302
3302
|
cr.displayName = "SimpleBezierEdge";
|
|
3303
|
-
const
|
|
3303
|
+
const Qr = {
|
|
3304
3304
|
input: _r,
|
|
3305
3305
|
output: Wr,
|
|
3306
3306
|
group: Xr
|
|
3307
|
-
},
|
|
3307
|
+
}, Kr = {
|
|
3308
3308
|
// smoothstep/step are handled by the canvas worker directly (not React SVG)
|
|
3309
3309
|
bezier: tr,
|
|
3310
3310
|
straight: ir,
|
|
@@ -3371,7 +3371,7 @@ function Io({
|
|
|
3371
3371
|
onDragEnter: Ie,
|
|
3372
3372
|
onDragLeave: Bt,
|
|
3373
3373
|
// Behavior
|
|
3374
|
-
nodesDraggable:
|
|
3374
|
+
nodesDraggable: Ot,
|
|
3375
3375
|
nodesConnectable: Yt,
|
|
3376
3376
|
elementsSelectable: me,
|
|
3377
3377
|
multiSelectionKeyCode: de,
|
|
@@ -3380,16 +3380,16 @@ function Io({
|
|
|
3380
3380
|
connectionMode: Ge,
|
|
3381
3381
|
connectionRadius: $e,
|
|
3382
3382
|
connectOnClick: Ze,
|
|
3383
|
-
isValidConnection:
|
|
3384
|
-
defaultEdgeOptions:
|
|
3385
|
-
snapToGrid:
|
|
3383
|
+
isValidConnection: Oe,
|
|
3384
|
+
defaultEdgeOptions: Qe,
|
|
3385
|
+
snapToGrid: Ke,
|
|
3386
3386
|
snapGrid: Pe,
|
|
3387
3387
|
deleteKeyCode: re,
|
|
3388
3388
|
panActivationKeyCode: oe,
|
|
3389
3389
|
panOnScroll: be,
|
|
3390
3390
|
panOnScrollMode: dn,
|
|
3391
3391
|
panOnScrollSpeed: fn,
|
|
3392
|
-
zoomOnScroll:
|
|
3392
|
+
zoomOnScroll: Qt,
|
|
3393
3393
|
zoomOnDoubleClick: Nn,
|
|
3394
3394
|
zoomOnPinch: hn,
|
|
3395
3395
|
preventScrolling: fe,
|
|
@@ -3413,17 +3413,17 @@ function Io({
|
|
|
3413
3413
|
...ie
|
|
3414
3414
|
}) {
|
|
3415
3415
|
const [Ut, Re] = Gt({ wx: 0, wy: 0, zoom: "1.00" }), Be = V(null), Je = V(null), Ve = F(
|
|
3416
|
-
(
|
|
3417
|
-
Re(
|
|
3416
|
+
(Q) => {
|
|
3417
|
+
Re(Q), te == null || te(Q);
|
|
3418
3418
|
},
|
|
3419
3419
|
[te]
|
|
3420
|
-
), ae = St(() => ({ ...
|
|
3421
|
-
const
|
|
3422
|
-
return
|
|
3423
|
-
const Tt = Ft.type === "group" || !Ft.parentId &&
|
|
3420
|
+
), ae = St(() => ({ ...Qr, ...r }), [r]), Kt = St(() => ({ ...Kr, ...s }), [s]), he = St(() => {
|
|
3421
|
+
const Q = e.filter((Ft) => Ft.type && ae[Ft.type]);
|
|
3422
|
+
return Q.sort((Ft, st) => {
|
|
3423
|
+
const Tt = Ft.type === "group" || !Ft.parentId && Q.some((Ee) => Ee.parentId === Ft.id), xe = st.type === "group" || !st.parentId && Q.some((Ee) => Ee.parentId === st.id);
|
|
3424
3424
|
return Tt && !xe ? -1 : !Tt && xe ? 1 : 0;
|
|
3425
3425
|
});
|
|
3426
|
-
}, [e, ae]), ke = St(() => n.filter((
|
|
3426
|
+
}, [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]), wt = St(() => n.map((Q) => Q.type && Kt[Q.type] ? { ...Q, _customRendered: !0 } : Q), [n, Kt]), {
|
|
3427
3427
|
wrapRef: Dt,
|
|
3428
3428
|
canvasRef: ce,
|
|
3429
3429
|
canvasReady: De,
|
|
@@ -3433,7 +3433,7 @@ function Io({
|
|
|
3433
3433
|
store: le
|
|
3434
3434
|
} = Lr({
|
|
3435
3435
|
cards: t,
|
|
3436
|
-
nodes:
|
|
3436
|
+
nodes: O,
|
|
3437
3437
|
edges: wt,
|
|
3438
3438
|
dark: o,
|
|
3439
3439
|
gridSize: i,
|
|
@@ -3477,7 +3477,7 @@ function Io({
|
|
|
3477
3477
|
onDelete: Lt,
|
|
3478
3478
|
onBeforeDelete: kt,
|
|
3479
3479
|
onError: $t,
|
|
3480
|
-
nodesDraggable:
|
|
3480
|
+
nodesDraggable: Ot,
|
|
3481
3481
|
nodesConnectable: Yt,
|
|
3482
3482
|
elementsSelectable: me,
|
|
3483
3483
|
multiSelectionKeyCode: de,
|
|
@@ -3486,16 +3486,16 @@ function Io({
|
|
|
3486
3486
|
connectionMode: Ge,
|
|
3487
3487
|
connectionRadius: $e,
|
|
3488
3488
|
connectOnClick: Ze,
|
|
3489
|
-
isValidConnection:
|
|
3490
|
-
defaultEdgeOptions:
|
|
3491
|
-
snapToGrid:
|
|
3489
|
+
isValidConnection: Oe,
|
|
3490
|
+
defaultEdgeOptions: Qe,
|
|
3491
|
+
snapToGrid: Ke,
|
|
3492
3492
|
snapGrid: Pe,
|
|
3493
3493
|
deleteKeyCode: re,
|
|
3494
3494
|
panActivationKeyCode: oe,
|
|
3495
3495
|
panOnScroll: be,
|
|
3496
3496
|
panOnScrollMode: dn,
|
|
3497
3497
|
panOnScrollSpeed: fn,
|
|
3498
|
-
zoomOnScroll:
|
|
3498
|
+
zoomOnScroll: Qt,
|
|
3499
3499
|
zoomOnDoubleClick: Nn,
|
|
3500
3500
|
zoomOnPinch: hn,
|
|
3501
3501
|
preventScrolling: fe,
|
|
@@ -3520,12 +3520,12 @@ function Io({
|
|
|
3520
3520
|
}
|
|
3521
3521
|
}), [le, e, n]), ye = V(null), ge = V(null), pe = V(null), Jt = V(null);
|
|
3522
3522
|
ut(() => {
|
|
3523
|
-
let
|
|
3523
|
+
let Q;
|
|
3524
3524
|
const Ft = () => {
|
|
3525
3525
|
const st = le.cameraRef.current, Tt = `translate(${st.x}px, ${st.y}px) scale(${st.zoom})`, xe = `translate(${st.x}, ${st.y}) scale(${st.zoom})`;
|
|
3526
|
-
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),
|
|
3526
|
+
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);
|
|
3527
3527
|
};
|
|
3528
|
-
return
|
|
3528
|
+
return Q = requestAnimationFrame(Ft), () => cancelAnimationFrame(Q);
|
|
3529
3529
|
}, [le]);
|
|
3530
3530
|
const ze = he.length > 0, ee = ke.length > 0;
|
|
3531
3531
|
return /* @__PURE__ */ B(Zn.Provider, { value: We, children: /* @__PURE__ */ It(
|
|
@@ -3558,15 +3558,15 @@ function Io({
|
|
|
3558
3558
|
pointerEvents: "none",
|
|
3559
3559
|
overflow: "visible"
|
|
3560
3560
|
},
|
|
3561
|
-
children: /* @__PURE__ */ B("g", { ref: ge, children: ke.map((
|
|
3561
|
+
children: /* @__PURE__ */ B("g", { ref: ge, children: ke.map((Q) => /* @__PURE__ */ B(
|
|
3562
3562
|
Dr,
|
|
3563
3563
|
{
|
|
3564
|
-
edge:
|
|
3565
|
-
edgeType:
|
|
3564
|
+
edge: Q,
|
|
3565
|
+
edgeType: Kt[Q.type],
|
|
3566
3566
|
nodes: e,
|
|
3567
3567
|
reconnectable: Z
|
|
3568
3568
|
},
|
|
3569
|
-
|
|
3569
|
+
Q.id
|
|
3570
3570
|
)) })
|
|
3571
3571
|
}
|
|
3572
3572
|
),
|
|
@@ -3585,21 +3585,21 @@ function Io({
|
|
|
3585
3585
|
pointerEvents: "none",
|
|
3586
3586
|
zIndex: 10
|
|
3587
3587
|
},
|
|
3588
|
-
children: he.map((
|
|
3588
|
+
children: he.map((Q) => /* @__PURE__ */ B(
|
|
3589
3589
|
Pr,
|
|
3590
3590
|
{
|
|
3591
|
-
node:
|
|
3592
|
-
nodeType: ae[
|
|
3591
|
+
node: Q,
|
|
3592
|
+
nodeType: ae[Q.type]
|
|
3593
3593
|
},
|
|
3594
|
-
|
|
3594
|
+
Q.id
|
|
3595
3595
|
))
|
|
3596
3596
|
}
|
|
3597
3597
|
),
|
|
3598
3598
|
/* @__PURE__ */ B(
|
|
3599
3599
|
"div",
|
|
3600
3600
|
{
|
|
3601
|
-
ref: (
|
|
3602
|
-
Be.current =
|
|
3601
|
+
ref: (Q) => {
|
|
3602
|
+
Be.current = Q, pe.current = Q;
|
|
3603
3603
|
},
|
|
3604
3604
|
className: "ric-edge-labels",
|
|
3605
3605
|
style: {
|
|
@@ -3617,8 +3617,8 @@ function Io({
|
|
|
3617
3617
|
/* @__PURE__ */ B(
|
|
3618
3618
|
"div",
|
|
3619
3619
|
{
|
|
3620
|
-
ref: (
|
|
3621
|
-
Je.current =
|
|
3620
|
+
ref: (Q) => {
|
|
3621
|
+
Je.current = Q, Jt.current = Q;
|
|
3622
3622
|
},
|
|
3623
3623
|
className: "ric-viewport-portal",
|
|
3624
3624
|
style: {
|
|
@@ -3942,7 +3942,7 @@ function Zo(t) {
|
|
|
3942
3942
|
const e = ht();
|
|
3943
3943
|
return typeof t == "function" ? t(e) : e;
|
|
3944
3944
|
}
|
|
3945
|
-
function
|
|
3945
|
+
function Oo() {
|
|
3946
3946
|
const t = ht();
|
|
3947
3947
|
return St(() => ({
|
|
3948
3948
|
getState: () => t,
|
|
@@ -3952,7 +3952,7 @@ function Qo() {
|
|
|
3952
3952
|
}), [t]);
|
|
3953
3953
|
}
|
|
3954
3954
|
const wn = 160, bn = 60;
|
|
3955
|
-
function
|
|
3955
|
+
function Qo({
|
|
3956
3956
|
width: t = 200,
|
|
3957
3957
|
height: e = 150,
|
|
3958
3958
|
nodeColor: n = "#3b82f6",
|
|
@@ -4173,7 +4173,7 @@ const co = {
|
|
|
4173
4173
|
lineHeight: 1,
|
|
4174
4174
|
color: "#333",
|
|
4175
4175
|
padding: 0
|
|
4176
|
-
},
|
|
4176
|
+
}, Ko = Zt(ao);
|
|
4177
4177
|
function Jo({
|
|
4178
4178
|
variant: t = "lines",
|
|
4179
4179
|
gap: e = 40,
|
|
@@ -4473,14 +4473,26 @@ function ur({
|
|
|
4473
4473
|
);
|
|
4474
4474
|
}
|
|
4475
4475
|
ur.displayName = "ConnectionLine";
|
|
4476
|
-
const ss = Zt(ur)
|
|
4476
|
+
const ss = Zt(ur), is = Object.freeze({
|
|
4477
|
+
Top: "top",
|
|
4478
|
+
Bottom: "bottom",
|
|
4479
|
+
Left: "left",
|
|
4480
|
+
Right: "right"
|
|
4481
|
+
}), as = Object.freeze({
|
|
4482
|
+
Arrow: "arrow",
|
|
4483
|
+
ArrowClosed: "arrowclosed"
|
|
4484
|
+
});
|
|
4485
|
+
function cs(t) {
|
|
4486
|
+
const e = t.width || t.measured && t.measured.width || 0, n = t.height || t.measured && t.measured.height || 0, r = t._absolutePosition || t.position || { x: 0, y: 0 };
|
|
4487
|
+
return { x: r.x, y: r.y, x2: r.x + e, y2: r.y + n };
|
|
4488
|
+
}
|
|
4477
4489
|
export {
|
|
4478
4490
|
Jo as Background,
|
|
4479
4491
|
un as BaseEdge,
|
|
4480
4492
|
tr as BezierEdge,
|
|
4481
4493
|
ss as ConnectionLine,
|
|
4482
4494
|
rn as ControlButton,
|
|
4483
|
-
|
|
4495
|
+
Ko as Controls,
|
|
4484
4496
|
ko as DefaultNode,
|
|
4485
4497
|
rs as EdgeLabelRenderer,
|
|
4486
4498
|
Fr as EdgeText,
|
|
@@ -4490,15 +4502,17 @@ export {
|
|
|
4490
4502
|
Io as InfiniteCanvas,
|
|
4491
4503
|
$o as InfiniteCanvasProvider,
|
|
4492
4504
|
_r as InputNode,
|
|
4493
|
-
|
|
4505
|
+
as as MarkerType,
|
|
4506
|
+
Qo as MiniMap,
|
|
4494
4507
|
ts as NodeResizer,
|
|
4495
4508
|
es as NodeToolbar,
|
|
4496
4509
|
Wr as OutputNode,
|
|
4497
4510
|
Vo as Panel,
|
|
4511
|
+
is as Position,
|
|
4498
4512
|
Hr as SelectionBox,
|
|
4499
4513
|
cr as SimpleBezierEdge,
|
|
4500
4514
|
ar as SmoothStepEdge,
|
|
4501
|
-
|
|
4515
|
+
Or as StepEdge,
|
|
4502
4516
|
ir as StraightEdge,
|
|
4503
4517
|
os as ViewportPortal,
|
|
4504
4518
|
Po as addEdge,
|
|
@@ -4526,6 +4540,7 @@ export {
|
|
|
4526
4540
|
Rn as getViewportForBounds,
|
|
4527
4541
|
yo as isEdge,
|
|
4528
4542
|
ho as isNode,
|
|
4543
|
+
cs as nodeToBox,
|
|
4529
4544
|
Mo as nodeToRect,
|
|
4530
4545
|
Co as reconnectEdge,
|
|
4531
4546
|
mo as rectToBox,
|
|
@@ -4549,7 +4564,7 @@ export {
|
|
|
4549
4564
|
Fo as useOnViewportChange,
|
|
4550
4565
|
eo as useReactFlow,
|
|
4551
4566
|
Zo as useStore,
|
|
4552
|
-
|
|
4567
|
+
Oo as useStoreApi,
|
|
4553
4568
|
qo as useUpdateNodeInternals,
|
|
4554
4569
|
Ho as useViewport
|
|
4555
4570
|
};
|