react-html-graph 1.0.0
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/calculations/index.d.ts +32 -0
- package/dist/calculations/index.d.ts.map +1 -0
- package/dist/calculations/index.js +247 -0
- package/dist/calculations/index.js.map +1 -0
- package/dist/calculations/types.d.ts +43 -0
- package/dist/calculations/types.d.ts.map +1 -0
- package/dist/calculations/types.js +2 -0
- package/dist/calculations/types.js.map +1 -0
- package/dist/context/connection-context.d.ts +3 -0
- package/dist/context/connection-context.d.ts.map +1 -0
- package/dist/context/connection-context.js +13 -0
- package/dist/context/connection-context.js.map +1 -0
- package/dist/context/error-context.d.ts +3 -0
- package/dist/context/error-context.d.ts.map +1 -0
- package/dist/context/error-context.js +5 -0
- package/dist/context/error-context.js.map +1 -0
- package/dist/context/graph-context.d.ts +3 -0
- package/dist/context/graph-context.d.ts.map +1 -0
- package/dist/context/graph-context.js +8 -0
- package/dist/context/graph-context.js.map +1 -0
- package/dist/context/graph-root-context.d.ts +7 -0
- package/dist/context/graph-root-context.d.ts.map +1 -0
- package/dist/context/graph-root-context.js +8 -0
- package/dist/context/graph-root-context.js.map +1 -0
- package/dist/example/App.css +39 -0
- package/dist/example/App.d.ts +3 -0
- package/dist/example/App.d.ts.map +1 -0
- package/dist/example/App.js +7 -0
- package/dist/example/App.js.map +1 -0
- package/dist/example/graph-teste.d.ts +2 -0
- package/dist/example/graph-teste.d.ts.map +1 -0
- package/dist/example/graph-teste.js +205 -0
- package/dist/example/graph-teste.js.map +1 -0
- package/dist/example/index.css +48 -0
- package/dist/example/reportWebVitals.d.ts +4 -0
- package/dist/example/reportWebVitals.d.ts.map +1 -0
- package/dist/example/reportWebVitals.js +13 -0
- package/dist/example/reportWebVitals.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +161 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/viewbox.d.ts +9 -0
- package/dist/graph/viewbox.d.ts.map +1 -0
- package/dist/graph/viewbox.js +30 -0
- package/dist/graph/viewbox.js.map +1 -0
- package/dist/hooks/api.d.ts +9 -0
- package/dist/hooks/api.d.ts.map +1 -0
- package/dist/hooks/api.js +13 -0
- package/dist/hooks/api.js.map +1 -0
- package/dist/hooks/connection.d.ts +46 -0
- package/dist/hooks/connection.d.ts.map +1 -0
- package/dist/hooks/connection.js +81 -0
- package/dist/hooks/connection.js.map +1 -0
- package/dist/hooks/error.d.ts +10 -0
- package/dist/hooks/error.d.ts.map +1 -0
- package/dist/hooks/error.js +16 -0
- package/dist/hooks/error.js.map +1 -0
- package/dist/hooks/get-zoom.d.ts +2 -0
- package/dist/hooks/get-zoom.d.ts.map +1 -0
- package/dist/hooks/get-zoom.js +14 -0
- package/dist/hooks/get-zoom.js.map +1 -0
- package/dist/hooks/graph-mode.d.ts +8 -0
- package/dist/hooks/graph-mode.d.ts.map +1 -0
- package/dist/hooks/graph-mode.js +13 -0
- package/dist/hooks/graph-mode.js.map +1 -0
- package/dist/hooks/graph-root.d.ts +9 -0
- package/dist/hooks/graph-root.d.ts.map +1 -0
- package/dist/hooks/graph-root.js +13 -0
- package/dist/hooks/graph-root.js.map +1 -0
- package/dist/hooks/graph.d.ts +10 -0
- package/dist/hooks/graph.d.ts.map +1 -0
- package/dist/hooks/graph.js +12 -0
- package/dist/hooks/graph.js.map +1 -0
- package/dist/hooks/viewbox.d.ts +7 -0
- package/dist/hooks/viewbox.d.ts.map +1 -0
- package/dist/hooks/viewbox.js +12 -0
- package/dist/hooks/viewbox.js.map +1 -0
- package/dist/link/base.d.ts +34 -0
- package/dist/link/base.d.ts.map +1 -0
- package/dist/link/base.js +202 -0
- package/dist/link/base.js.map +1 -0
- package/dist/link/temp-link.d.ts +9 -0
- package/dist/link/temp-link.d.ts.map +1 -0
- package/dist/link/temp-link.js +60 -0
- package/dist/link/temp-link.js.map +1 -0
- package/dist/module.d.ts +18 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +18 -0
- package/dist/module.js.map +1 -0
- package/dist/nodes/base.d.ts +11 -0
- package/dist/nodes/base.d.ts.map +1 -0
- package/dist/nodes/base.js +117 -0
- package/dist/nodes/base.js.map +1 -0
- package/dist/ports/base.d.ts +11 -0
- package/dist/ports/base.d.ts.map +1 -0
- package/dist/ports/base.js +115 -0
- package/dist/ports/base.js.map +1 -0
- package/dist/providers/connection-provider.d.ts +10 -0
- package/dist/providers/connection-provider.d.ts.map +1 -0
- package/dist/providers/connection-provider.js +120 -0
- package/dist/providers/connection-provider.js.map +1 -0
- package/dist/style.css +78 -0
- package/dist/types.d.ts +349 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useContext, useCallback } from "react";
|
|
2
|
+
import { ConnectionContext } from "../context/connection-context";
|
|
3
|
+
import { GraphContext } from "../context/graph-context";
|
|
4
|
+
import useGraphRoot from "./graph-root";
|
|
5
|
+
/**
|
|
6
|
+
* Hook que expõe o estado de conexões e operações básicas (connect/disconnect)
|
|
7
|
+
* a partir do ConnectionContext.
|
|
8
|
+
*
|
|
9
|
+
* @returns {{ connections: PortConnection[], connect: Function, disconnect: Function }}
|
|
10
|
+
*/
|
|
11
|
+
export function useConnections() {
|
|
12
|
+
const { connections, connect, disconnect } = useContext(ConnectionContext);
|
|
13
|
+
return { connections, connect, disconnect };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hook que fornece handlers de drag para uma porta específica. Inicia o
|
|
17
|
+
* processo de arraste quando o usuário pressiona a porta (somente em modo
|
|
18
|
+
* de edição).
|
|
19
|
+
*
|
|
20
|
+
* @param nodeId Id do nó que contém a porta
|
|
21
|
+
* @param portName Nome da porta
|
|
22
|
+
* @param connectionType Tipo de conexão suportada
|
|
23
|
+
* @returns dragHandlers, isDragging, canDrag
|
|
24
|
+
*/
|
|
25
|
+
export function usePortDrag(nodeId, portName, connectionType) {
|
|
26
|
+
const { startDrag, dragState } = useContext(ConnectionContext);
|
|
27
|
+
const { mode } = useContext(GraphContext);
|
|
28
|
+
const handleMouseDown = useCallback((e) => {
|
|
29
|
+
if (mode === "readonly")
|
|
30
|
+
return;
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
startDrag(nodeId, portName, connectionType);
|
|
34
|
+
}, [mode, nodeId, portName, connectionType, startDrag]);
|
|
35
|
+
const isDragging = dragState.active &&
|
|
36
|
+
dragState.sourceNodeId === nodeId &&
|
|
37
|
+
dragState.sourcePortName === portName;
|
|
38
|
+
return {
|
|
39
|
+
dragHandlers: { onMouseDown: handleMouseDown },
|
|
40
|
+
isDragging,
|
|
41
|
+
canDrag: mode === "edit",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hook que fornece handlers de drop para uma porta específica. Finaliza o
|
|
46
|
+
* arraste e chama endDrag quando o usuário solta sobre a porta (somente em
|
|
47
|
+
* modo de edição).
|
|
48
|
+
*
|
|
49
|
+
* @param nodeId Id do nó que contém a porta
|
|
50
|
+
* @param portName Nome da porta
|
|
51
|
+
* @param connectionType Tipo de conexão suportada
|
|
52
|
+
* @returns dropHandlers, canDrop
|
|
53
|
+
*/
|
|
54
|
+
export function usePortDrop(nodeId, portName, connectionType) {
|
|
55
|
+
const { dragState, endDrag } = useContext(ConnectionContext);
|
|
56
|
+
const { mode, viewbox } = useContext(GraphContext);
|
|
57
|
+
const graphRoot = useGraphRoot();
|
|
58
|
+
const canDrop = dragState.active &&
|
|
59
|
+
dragState.connectionType === connectionType &&
|
|
60
|
+
dragState.sourceNodeId !== nodeId;
|
|
61
|
+
const handleMouseUp = useCallback((e) => {
|
|
62
|
+
if (mode === "readonly" || !dragState.active)
|
|
63
|
+
return;
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
const graph = graphRoot.current;
|
|
66
|
+
let cursorPos = { x: 0, y: 0 };
|
|
67
|
+
if (graph) {
|
|
68
|
+
const rect = graph.getBoundingClientRect();
|
|
69
|
+
cursorPos = {
|
|
70
|
+
x: (e.clientX - rect.left) / viewbox.zoom + viewbox.x,
|
|
71
|
+
y: (e.clientY - rect.top) / viewbox.zoom + viewbox.y,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
endDrag(nodeId, portName, cursorPos);
|
|
75
|
+
}, [mode, dragState.active, nodeId, portName, endDrag, viewbox, graphRoot]);
|
|
76
|
+
return {
|
|
77
|
+
dropHandlers: { onMouseUp: handleMouseUp },
|
|
78
|
+
canDrop,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/hooks/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC1B,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC3E,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,QAAgB,EAAE,cAA8B;IACxF,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC/D,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAE1C,MAAM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,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC/B,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,IAAI,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;YAC3C,SAAS,GAAG;gBACR,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;gBACrD,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;aACvD,CAAC;QACN,CAAC;QAED,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC,EACD,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAC1E,CAAC;IAEF,OAAO;QACH,YAAY,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE;QAC1C,OAAO;KACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook que fornece uma função utilitária para reportar erros de grafo
|
|
3
|
+
* usando o ErrorContext.
|
|
4
|
+
*
|
|
5
|
+
* @returns {{ reportError: (code: string, message: string, details?: Record<string, unknown>) => void }}
|
|
6
|
+
*/
|
|
7
|
+
export default function useGraphError(): {
|
|
8
|
+
reportError: (code: string, message: string, details?: Record<string, unknown>) => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/hooks/error.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa;wBAItB,MAAM,WAAW,MAAM,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAOxE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useContext, useCallback } from "react";
|
|
2
|
+
import { ErrorContext } from "../context/error-context";
|
|
3
|
+
/**
|
|
4
|
+
* Hook que fornece uma função utilitária para reportar erros de grafo
|
|
5
|
+
* usando o ErrorContext.
|
|
6
|
+
*
|
|
7
|
+
* @returns {{ reportError: (code: string, message: string, details?: Record<string, unknown>) => void }}
|
|
8
|
+
*/
|
|
9
|
+
export default function useGraphError() {
|
|
10
|
+
const { reportError } = useContext(ErrorContext);
|
|
11
|
+
const report = useCallback((code, message, details) => {
|
|
12
|
+
reportError({ code, message, details });
|
|
13
|
+
}, [reportError]);
|
|
14
|
+
return { reportError: report };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/hooks/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa;IACjC,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,WAAW,CACtB,CAAC,IAAY,EAAE,OAAe,EAAE,OAAiC,EAAE,EAAE;QACjE,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC,EACD,CAAC,WAAW,CAAC,CAChB,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-zoom.d.ts","sourceRoot":"","sources":["../../src/hooks/get-zoom.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,UAAU,iBAcjC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import useViewbox from "./viewbox";
|
|
3
|
+
export default function useGetZoom() {
|
|
4
|
+
const { zoom } = useViewbox();
|
|
5
|
+
const ref = useRef(zoom);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ref.current = zoom;
|
|
8
|
+
}, [zoom]);
|
|
9
|
+
const getZoom = useCallback(() => {
|
|
10
|
+
return ref.current;
|
|
11
|
+
}, []);
|
|
12
|
+
return getZoom;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=get-zoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-zoom.js","sourceRoot":"","sources":["../../src/hooks/get-zoom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,UAAU,MAAM,WAAW,CAAC;AAGnC,MAAM,CAAC,OAAO,UAAU,UAAU;IAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IAEjC,SAAS,CAAC,GAAG,EAAE;QACX,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,OAAO,CAAC;AAEnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-mode.d.ts","sourceRoot":"","sources":["../../src/hooks/graph-mode.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,iCAGnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { GraphContext } from "../context/graph-context";
|
|
3
|
+
/**
|
|
4
|
+
* Hook que retorna o modo atual do graph ("readonly" | "edit") a partir
|
|
5
|
+
* do GraphContext.
|
|
6
|
+
*
|
|
7
|
+
* @returns GraphMode
|
|
8
|
+
*/
|
|
9
|
+
export default function useGraphMode() {
|
|
10
|
+
const { mode } = useContext(GraphContext);
|
|
11
|
+
return mode;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=graph-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-mode.js","sourceRoot":"","sources":["../../src/hooks/graph-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY;IAChC,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook que retorna a ref do elemento raiz (graph-root) desta árvore.
|
|
3
|
+
* Todos os querySelector devem ser feitos nesse elemento para suportar
|
|
4
|
+
* múltiplas instâncias do graph na mesma página.
|
|
5
|
+
*
|
|
6
|
+
* @returns React.RefObject<HTMLElement | null>
|
|
7
|
+
*/
|
|
8
|
+
export default function useGraphRoot(): import("react").RefObject<HTMLElement | null>;
|
|
9
|
+
//# sourceMappingURL=graph-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-root.d.ts","sourceRoot":"","sources":["../../src/hooks/graph-root.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,kDAEnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { GraphRootContext } from "../context/graph-root-context";
|
|
3
|
+
/**
|
|
4
|
+
* Hook que retorna a ref do elemento raiz (graph-root) desta árvore.
|
|
5
|
+
* Todos os querySelector devem ser feitos nesse elemento para suportar
|
|
6
|
+
* múltiplas instâncias do graph na mesma página.
|
|
7
|
+
*
|
|
8
|
+
* @returns React.RefObject<HTMLElement | null>
|
|
9
|
+
*/
|
|
10
|
+
export default function useGraphRoot() {
|
|
11
|
+
return useContext(GraphRootContext);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=graph-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-root.js","sourceRoot":"","sources":["../../src/hooks/graph-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY;IAChC,OAAO,UAAU,CAAC,gBAAgB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook que fornece os itens do grafo (nós e links) a partir do GraphContext.
|
|
3
|
+
*
|
|
4
|
+
* @returns {{ nodes: React.ReactNode[], links: React.ReactNode[] }}
|
|
5
|
+
*/
|
|
6
|
+
export default function useGraphItems(): {
|
|
7
|
+
nodes: import("react").ReactNode[];
|
|
8
|
+
links: import("react").ReactNode[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/hooks/graph.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa;;;EAGpC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { GraphContext } from "../context/graph-context";
|
|
3
|
+
/**
|
|
4
|
+
* Hook que fornece os itens do grafo (nós e links) a partir do GraphContext.
|
|
5
|
+
*
|
|
6
|
+
* @returns {{ nodes: React.ReactNode[], links: React.ReactNode[] }}
|
|
7
|
+
*/
|
|
8
|
+
export default function useGraphItems() {
|
|
9
|
+
const { nodes, links } = useContext(GraphContext);
|
|
10
|
+
return { nodes, links };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/hooks/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa;IACjC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewbox.d.ts","sourceRoot":"","sources":["../../src/hooks/viewbox.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,+BAGjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { GraphContext } from "../context/graph-context";
|
|
3
|
+
/**
|
|
4
|
+
* Hook que retorna o estado do viewbox (posição e zoom) do GraphContext.
|
|
5
|
+
*
|
|
6
|
+
* @returns Viewbox
|
|
7
|
+
*/
|
|
8
|
+
export default function useViewbox() {
|
|
9
|
+
const { viewbox } = useContext(GraphContext);
|
|
10
|
+
return viewbox;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=viewbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewbox.js","sourceRoot":"","sources":["../../src/hooks/viewbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU;IAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LinkLabel } from "../types";
|
|
2
|
+
type GraphLinkProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
from: {
|
|
5
|
+
node: string;
|
|
6
|
+
port: string;
|
|
7
|
+
};
|
|
8
|
+
to: {
|
|
9
|
+
node: string;
|
|
10
|
+
port: string;
|
|
11
|
+
};
|
|
12
|
+
width?: number;
|
|
13
|
+
forwardWidth?: number;
|
|
14
|
+
reverseWidth?: number;
|
|
15
|
+
spacing?: number;
|
|
16
|
+
labels?: LinkLabel[];
|
|
17
|
+
forwardColor?: string;
|
|
18
|
+
reverseColor?: string;
|
|
19
|
+
dashSize?: number;
|
|
20
|
+
gapSize?: number;
|
|
21
|
+
forwardDuration?: number;
|
|
22
|
+
reverseDuration?: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Componente que renderiza um link entre dois nós usando caminhos SVG.
|
|
26
|
+
* Os cálculos de path e posicionamento de labels são realizados em worker
|
|
27
|
+
* para não bloquear o thread principal.
|
|
28
|
+
*
|
|
29
|
+
* @param props Propriedades do link (GraphLinkProps)
|
|
30
|
+
* @returns JSX.Element
|
|
31
|
+
*/
|
|
32
|
+
declare const MemoizedGraphLink: import("react").MemoExoticComponent<({ id, from, to, width, forwardWidth, reverseWidth, spacing, labels, forwardColor, reverseColor, dashSize, gapSize, forwardDuration, reverseDuration, }: GraphLinkProps) => import("react/jsx-runtime").JSX.Element>;
|
|
33
|
+
export default MemoizedGraphLink;
|
|
34
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/link/base.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,KAAK,cAAc,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,+LAepB,cAAc,6CA2Pf,CAAA;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import useViewbox from "../hooks/viewbox";
|
|
4
|
+
import useGraphError from "../hooks/error";
|
|
5
|
+
import useGraphRoot from "../hooks/graph-root";
|
|
6
|
+
import { calculatePath, calculateLabels } from "../calculations";
|
|
7
|
+
/**
|
|
8
|
+
* Componente que renderiza um link entre dois nós usando caminhos SVG.
|
|
9
|
+
* Os cálculos de path e posicionamento de labels são realizados em worker
|
|
10
|
+
* para não bloquear o thread principal.
|
|
11
|
+
*
|
|
12
|
+
* @param props Propriedades do link (GraphLinkProps)
|
|
13
|
+
* @returns JSX.Element
|
|
14
|
+
*/
|
|
15
|
+
const MemoizedGraphLink = memo(function GraphLink({ id, from, to, width = 3, forwardWidth, reverseWidth, spacing, labels, forwardColor = "#888", reverseColor = "#888", dashSize = 12, gapSize = 8, forwardDuration = 1, reverseDuration = 1, }) {
|
|
16
|
+
const rootRef = useRef(null);
|
|
17
|
+
const forwardRef = useRef(null);
|
|
18
|
+
const reverseRef = useRef(null);
|
|
19
|
+
const labelGroupRef = useRef(null);
|
|
20
|
+
const [invalid, setInvalid] = useState(true);
|
|
21
|
+
const [fromNode, setFromNode] = useState(null);
|
|
22
|
+
const [toNode, setToNode] = useState(null);
|
|
23
|
+
const viewbox = useViewbox();
|
|
24
|
+
const { reportError } = useGraphError();
|
|
25
|
+
const graphRoot = useGraphRoot();
|
|
26
|
+
const fwdW = forwardWidth ?? width;
|
|
27
|
+
const revW = reverseWidth ?? width;
|
|
28
|
+
const gap = spacing ?? (fwdW + revW) / 2 + 1;
|
|
29
|
+
// Refs para acesso no hot-path (sem React state/render)
|
|
30
|
+
const positionsRef = useRef(null);
|
|
31
|
+
const rafIdRef = useRef(0);
|
|
32
|
+
const calcVersionRef = useRef(0);
|
|
33
|
+
const gapRef = useRef(gap);
|
|
34
|
+
const labelsRef = useRef(labels);
|
|
35
|
+
const invalidRef = useRef(invalid);
|
|
36
|
+
gapRef.current = gap;
|
|
37
|
+
labelsRef.current = labels;
|
|
38
|
+
invalidRef.current = invalid;
|
|
39
|
+
// Descobre nós
|
|
40
|
+
const checkNodes = useCallback(() => {
|
|
41
|
+
const root = graphRoot.current;
|
|
42
|
+
if (!root)
|
|
43
|
+
return;
|
|
44
|
+
const fromElement = root.querySelector('node-graph-object[node-id="' + from.node + '"]');
|
|
45
|
+
const toElement = root.querySelector('node-graph-object[node-id="' + to.node + '"]');
|
|
46
|
+
if (!fromElement || !toElement) {
|
|
47
|
+
if (!fromElement) {
|
|
48
|
+
reportError("ORPHAN_LINK", `Link "${id}": source node "${from.node}" not found`, { linkId: id, nodeId: from.node });
|
|
49
|
+
}
|
|
50
|
+
if (!toElement) {
|
|
51
|
+
reportError("ORPHAN_LINK", `Link "${id}": target node "${to.node}" not found`, { linkId: id, nodeId: to.node });
|
|
52
|
+
}
|
|
53
|
+
return setInvalid(true);
|
|
54
|
+
}
|
|
55
|
+
setInvalid(false);
|
|
56
|
+
setFromNode(fromElement);
|
|
57
|
+
setToNode(toElement);
|
|
58
|
+
}, [from.node, to.node, id, reportError, graphRoot]);
|
|
59
|
+
useEffect(() => { checkNodes(); }, [checkNodes]);
|
|
60
|
+
// Calcula paths e labels no worker e atualiza DOM diretamente (sem React render)
|
|
61
|
+
const runCalculation = useCallback(() => {
|
|
62
|
+
const pos = positionsRef.current;
|
|
63
|
+
if (!pos || invalidRef.current)
|
|
64
|
+
return;
|
|
65
|
+
const root = rootRef.current;
|
|
66
|
+
const fwd = forwardRef.current;
|
|
67
|
+
const rev = reverseRef.current;
|
|
68
|
+
if (!root || !fwd || !rev)
|
|
69
|
+
return;
|
|
70
|
+
const currentGap = gapRef.current;
|
|
71
|
+
const currentLabels = labelsRef.current;
|
|
72
|
+
const version = ++calcVersionRef.current;
|
|
73
|
+
const halfGap = currentGap / 2;
|
|
74
|
+
const labelInputs = currentLabels?.map(lbl => ({
|
|
75
|
+
position: lbl.position ?? 0,
|
|
76
|
+
side: lbl.textAnchor === "forward" || lbl.textAnchor === "reverse" ? lbl.textAnchor : "",
|
|
77
|
+
offset: lbl.offset ?? 0,
|
|
78
|
+
}));
|
|
79
|
+
const pathPromise = calculatePath({
|
|
80
|
+
fromX: pos.fromX, fromY: pos.fromY,
|
|
81
|
+
toX: pos.toX, toY: pos.toY,
|
|
82
|
+
fromDir: pos.fromDir, toDir: pos.toDir,
|
|
83
|
+
gap: currentGap, steps: 60,
|
|
84
|
+
});
|
|
85
|
+
const labelsPromise = labelInputs?.length
|
|
86
|
+
? calculateLabels({ fromX: pos.fromX, fromY: pos.fromY, toX: pos.toX, toY: pos.toY, fromDir: pos.fromDir, toDir: pos.toDir, halfGap, labels: labelInputs })
|
|
87
|
+
: Promise.resolve(null);
|
|
88
|
+
Promise.all([pathPromise, labelsPromise]).then(([pathResult, labelResult]) => {
|
|
89
|
+
// Descarta resultado obsoleto
|
|
90
|
+
if (version !== calcVersionRef.current)
|
|
91
|
+
return;
|
|
92
|
+
const { bounds, forwardD, reverseD } = pathResult;
|
|
93
|
+
root.style.left = bounds.left + "px";
|
|
94
|
+
root.style.top = bounds.top + "px";
|
|
95
|
+
root.style.width = bounds.width + "px";
|
|
96
|
+
root.style.height = bounds.height + "px";
|
|
97
|
+
root.setAttribute("viewBox", `${bounds.left} ${bounds.top} ${bounds.width} ${bounds.height}`);
|
|
98
|
+
fwd.setAttribute("d", forwardD);
|
|
99
|
+
rev.setAttribute("d", reverseD);
|
|
100
|
+
if (labelResult) {
|
|
101
|
+
const labelGroup = labelGroupRef.current;
|
|
102
|
+
if (labelGroup) {
|
|
103
|
+
const textEls = labelGroup.querySelectorAll("text");
|
|
104
|
+
labelResult.positions.forEach((lPos, i) => {
|
|
105
|
+
const textEl = textEls[i];
|
|
106
|
+
if (!textEl)
|
|
107
|
+
return;
|
|
108
|
+
textEl.setAttribute("x", String(lPos.x));
|
|
109
|
+
textEl.setAttribute("y", String(lPos.y));
|
|
110
|
+
if (lPos.textAnchor !== "middle") {
|
|
111
|
+
textEl.setAttribute("text-anchor", lPos.textAnchor);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}, []);
|
|
118
|
+
// Determina direcao de saida da porta baseado na posicao relativa ao centro do no
|
|
119
|
+
const detectPortDir = useCallback((node, port) => {
|
|
120
|
+
if (!port)
|
|
121
|
+
return "right";
|
|
122
|
+
const relX = port.offsetLeft + port.offsetWidth / 2 - node.offsetWidth / 2;
|
|
123
|
+
const relY = port.offsetTop + port.offsetHeight / 2 - node.offsetHeight / 2;
|
|
124
|
+
if (Math.abs(relX) >= Math.abs(relY)) {
|
|
125
|
+
return relX >= 0 ? "right" : "left";
|
|
126
|
+
}
|
|
127
|
+
return relY >= 0 ? "bottom" : "top";
|
|
128
|
+
}, []);
|
|
129
|
+
// Le posicoes do DOM via ref (sem setState), agenda rAF
|
|
130
|
+
const readPositions = useCallback(() => {
|
|
131
|
+
if (!fromNode || !toNode)
|
|
132
|
+
return;
|
|
133
|
+
const fromPort = fromNode.querySelector('node-graph-port[port-id="' + from.port + '"]');
|
|
134
|
+
const toPort = toNode.querySelector('node-graph-port[port-id="' + to.port + '"]');
|
|
135
|
+
positionsRef.current = {
|
|
136
|
+
fromX: fromNode.offsetLeft + (fromPort ? fromPort.offsetLeft + fromPort.offsetWidth / 2 : fromNode.offsetWidth),
|
|
137
|
+
fromY: fromNode.offsetTop + (fromPort ? fromPort.offsetTop + fromPort.offsetHeight / 2 : fromNode.offsetHeight / 2),
|
|
138
|
+
toX: toNode.offsetLeft + (toPort ? toPort.offsetLeft + toPort.offsetWidth / 2 : 0),
|
|
139
|
+
toY: toNode.offsetTop + (toPort ? toPort.offsetTop + toPort.offsetHeight / 2 : toNode.offsetHeight / 2),
|
|
140
|
+
fromDir: detectPortDir(fromNode, fromPort),
|
|
141
|
+
toDir: detectPortDir(toNode, toPort),
|
|
142
|
+
};
|
|
143
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
144
|
+
rafIdRef.current = requestAnimationFrame(runCalculation);
|
|
145
|
+
}, [fromNode, toNode, from.port, to.port, detectPortDir, runCalculation]);
|
|
146
|
+
// Observe node changes
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!fromNode || !toNode || invalid)
|
|
149
|
+
return;
|
|
150
|
+
readPositions();
|
|
151
|
+
const mutationObserver = new MutationObserver((entries) => {
|
|
152
|
+
for (const entry of entries) {
|
|
153
|
+
if (entry.attributeName === "node-id") {
|
|
154
|
+
checkNodes();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
readPositions();
|
|
159
|
+
});
|
|
160
|
+
mutationObserver.observe(fromNode, { attributes: true, attributeFilter: ["style", "class", "node-id"] });
|
|
161
|
+
mutationObserver.observe(toNode, { attributes: true, attributeFilter: ["style", "class", "node-id"] });
|
|
162
|
+
const resizeObserver = new ResizeObserver(readPositions);
|
|
163
|
+
resizeObserver.observe(fromNode);
|
|
164
|
+
resizeObserver.observe(toNode);
|
|
165
|
+
return () => { mutationObserver.disconnect(); resizeObserver.disconnect(); };
|
|
166
|
+
}, [fromNode, toNode, invalid, checkNodes, readPositions]);
|
|
167
|
+
// Recalcula quando viewbox muda
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (!fromNode || !toNode || invalid)
|
|
170
|
+
return;
|
|
171
|
+
readPositions();
|
|
172
|
+
}, [viewbox.zoom, fromNode, toNode, invalid, readPositions]);
|
|
173
|
+
// Limpa rAF ao desmontar
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
return () => cancelAnimationFrame(rafIdRef.current);
|
|
176
|
+
}, []);
|
|
177
|
+
if (invalid)
|
|
178
|
+
return _jsx(_Fragment, {});
|
|
179
|
+
const fwdStroke = fwdW / viewbox.zoom;
|
|
180
|
+
const revStroke = revW / viewbox.zoom;
|
|
181
|
+
const scaledDash = dashSize / viewbox.zoom;
|
|
182
|
+
const scaledGap = gapSize / viewbox.zoom;
|
|
183
|
+
const dashPattern = scaledDash + " " + scaledGap;
|
|
184
|
+
const cycleLen = scaledDash + scaledGap;
|
|
185
|
+
return (_jsx("node-graph-link", { children: _jsxs("svg", { ref: rootRef, children: [_jsx("path", { ref: forwardRef, d: "", stroke: forwardColor, fill: "none", strokeWidth: fwdStroke, strokeLinecap: "round", strokeDasharray: dashPattern, style: {
|
|
186
|
+
animationDuration: forwardDuration > 0 ? forwardDuration + "s" : "0s",
|
|
187
|
+
animationDirection: "reverse",
|
|
188
|
+
["--cycle-len"]: cycleLen + "px",
|
|
189
|
+
} }), _jsx("path", { ref: reverseRef, d: "", stroke: reverseColor, fill: "none", strokeWidth: revStroke, strokeLinecap: "round", strokeDasharray: dashPattern, style: {
|
|
190
|
+
animationDuration: reverseDuration > 0 ? reverseDuration + "s" : "0s",
|
|
191
|
+
animationDirection: "reverse",
|
|
192
|
+
["--cycle-len"]: cycleLen + "px",
|
|
193
|
+
} }), labels && labels.length > 0 && (_jsx("g", { ref: labelGroupRef, children: labels.map((lbl, i) => {
|
|
194
|
+
const isDirectional = lbl.textAnchor === "forward" || lbl.textAnchor === "reverse";
|
|
195
|
+
const textAnchor = isDirectional ? undefined : (lbl.textAnchor ?? "middle");
|
|
196
|
+
return (_jsx("text", { fill: lbl.color ?? "#fff", fontSize: (lbl.fontSize ?? 12) / viewbox.zoom, fontFamily: lbl.fontFamily, fontWeight: lbl.fontWeight, fontStyle: lbl.fontStyle, textAnchor: textAnchor, opacity: lbl.opacity, letterSpacing: lbl.letterSpacing, textDecoration: lbl.textDecoration, dx: !isDirectional && lbl.dx ? lbl.dx / viewbox.zoom : undefined, dy: !isDirectional
|
|
197
|
+
? (lbl.dy != null ? lbl.dy / viewbox.zoom : -(Math.max(fwdStroke, revStroke) + 4 / viewbox.zoom))
|
|
198
|
+
: undefined, children: lbl.text }, i));
|
|
199
|
+
}) }))] }) }));
|
|
200
|
+
});
|
|
201
|
+
export default MemoizedGraphLink;
|
|
202
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/link/base.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI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AC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gCACjG,CAAC,CAAC,SAAS,YAGd,GAAG,CAAC,IAAI,IAhBJ,CAAC,CAiBH,CACV,CAAC;oBACN,CAAC,CAAC,GACF,CACP,IACC,GACQ,CAAC,CAAC;AACxB,CAAC,CAAC,CAAA;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Componente que renderiza um link temporário enquanto o usuário arrasta uma
|
|
3
|
+
* conexão entre portas. Desenha uma curva Bezier entre a posição da porta
|
|
4
|
+
* origem e o cursor.
|
|
5
|
+
*
|
|
6
|
+
* @returns JSX.Element | null
|
|
7
|
+
*/
|
|
8
|
+
export default function TempLink(): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
//# sourceMappingURL=temp-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temp-link.d.ts","sourceRoot":"","sources":["../../src/link/temp-link.tsx"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,mDA6D/B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState, useEffect } from "react";
|
|
3
|
+
import { ConnectionContext } from "../context/connection-context";
|
|
4
|
+
import useViewbox from "../hooks/viewbox";
|
|
5
|
+
import useGraphRoot from "../hooks/graph-root";
|
|
6
|
+
/**
|
|
7
|
+
* Componente que renderiza um link temporário enquanto o usuário arrasta uma
|
|
8
|
+
* conexão entre portas. Desenha uma curva Bezier entre a posição da porta
|
|
9
|
+
* origem e o cursor.
|
|
10
|
+
*
|
|
11
|
+
* @returns JSX.Element | null
|
|
12
|
+
*/
|
|
13
|
+
export default function TempLink() {
|
|
14
|
+
const { dragState } = useContext(ConnectionContext);
|
|
15
|
+
const viewbox = useViewbox();
|
|
16
|
+
const graphRoot = useGraphRoot();
|
|
17
|
+
const [cursor, setCursor] = useState({ x: 0, y: 0 });
|
|
18
|
+
const [sourcePos, setSourcePos] = useState(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!dragState.active)
|
|
21
|
+
return;
|
|
22
|
+
const handleMouseMove = (e) => {
|
|
23
|
+
const graph = graphRoot.current;
|
|
24
|
+
if (!graph)
|
|
25
|
+
return;
|
|
26
|
+
const rect = graph.getBoundingClientRect();
|
|
27
|
+
setCursor({
|
|
28
|
+
x: (e.clientX - rect.left) / viewbox.zoom + viewbox.x,
|
|
29
|
+
y: (e.clientY - rect.top) / viewbox.zoom + viewbox.y,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
33
|
+
return () => document.removeEventListener('mousemove', handleMouseMove);
|
|
34
|
+
}, [dragState.active, viewbox.zoom, viewbox.x, viewbox.y, graphRoot]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!dragState.active) {
|
|
37
|
+
setSourcePos(null);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const graph = graphRoot.current;
|
|
41
|
+
if (!graph)
|
|
42
|
+
return;
|
|
43
|
+
const el = graph.querySelector(`node-graph-object[node-id="${dragState.sourceNodeId}"] node-graph-port[port-id="${dragState.sourcePortName}"]`);
|
|
44
|
+
if (!el)
|
|
45
|
+
return;
|
|
46
|
+
const graphRect = graph.getBoundingClientRect();
|
|
47
|
+
const portRect = el.getBoundingClientRect();
|
|
48
|
+
setSourcePos({
|
|
49
|
+
x: (portRect.left + portRect.width / 2 - graphRect.left) / viewbox.zoom + viewbox.x,
|
|
50
|
+
y: (portRect.top + portRect.height / 2 - graphRect.top) / viewbox.zoom + viewbox.y,
|
|
51
|
+
});
|
|
52
|
+
}, [dragState, viewbox.zoom, viewbox.x, viewbox.y, graphRoot]);
|
|
53
|
+
if (!dragState.active || !sourcePos)
|
|
54
|
+
return null;
|
|
55
|
+
const dx = cursor.x - sourcePos.x;
|
|
56
|
+
const cp = Math.abs(dx) * 0.5 || 50;
|
|
57
|
+
const d = `M ${sourcePos.x} ${sourcePos.y} C ${sourcePos.x + cp} ${sourcePos.y}, ${cursor.x - cp} ${cursor.y}, ${cursor.x} ${cursor.y}`;
|
|
58
|
+
return (_jsx("node-graph-temp-link", { children: _jsx("svg", { children: _jsx("path", { d: d, fill: "none", stroke: "#888", strokeWidth: 2, strokeDasharray: "6 3", vectorEffect: "non-scaling-stroke" }) }) }));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=temp-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temp-link.js","sourceRoot":"","sources":["../../src/link/temp-link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ;IAC5B,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAkC,IAAI,CAAC,CAAC;IAElF,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,SAAS,CAAC,MAAM;YAAE,OAAO;QAE9B,MAAM,eAAe,GAAG,CA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