@lincle/react-web-base 0.4.0-next.2 → 0.4.0-next.3
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/README.md +1 -1
- package/dist/components/Edge/index.d.ts +1 -1
- package/dist/components/Edge/index.js +50 -28
- package/dist/components/Edges/Marker.d.ts +3 -0
- package/dist/components/Edges/Marker.js +26 -0
- package/dist/components/{Path/index.d.ts → Edges/Paths/Path/Path.d.ts} +1 -1
- package/dist/components/Edges/Paths/Path/Path.js +56 -0
- package/dist/components/Edges/Paths/Path/index.d.ts +5 -0
- package/dist/components/Edges/Paths/Path/index.js +73 -0
- package/dist/components/Edges/Paths/index.d.ts +5 -0
- package/dist/components/Edges/Paths/index.js +33 -0
- package/dist/components/Edges/index.d.ts +4 -7
- package/dist/components/Edges/index.js +26 -11
- package/dist/components/{Grid → Graph/Grid}/index.d.ts +1 -1
- package/dist/components/{Grid → Graph/Grid}/index.js +6 -4
- package/dist/components/Graph/index.d.ts +2 -1
- package/dist/components/Graph/index.js +11 -4
- package/dist/components/Node/index.d.ts +2 -3
- package/dist/components/Node/index.js +27 -13
- package/dist/components/Nodes/index.d.ts +1 -1
- package/dist/components/Nodes/index.js +2 -1
- package/dist/components/index.d.ts +5 -8
- package/dist/components/index.js +18 -19
- package/dist/shared.d.ts +7 -6
- package/dist/shared.js +14 -6
- package/dist/styles.g.css +7 -7
- package/package.json +14 -18
- package/dist/components/GraphContexts/index.d.ts +0 -4
- package/dist/components/GraphContexts/index.js +0 -45
- package/dist/components/Path/index.js +0 -45
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ import { Edge, Edges, Graph, Node, Nodes } from "@lincle/react-web-base";
|
|
|
84
84
|
import "@lincle/react-web-base/dist/main.min.css";
|
|
85
85
|
import "./styles.css";
|
|
86
86
|
|
|
87
|
-
const App: FunctionComponent = ()
|
|
87
|
+
const App: FunctionComponent = () => {
|
|
88
88
|
return (
|
|
89
89
|
<div className="App">
|
|
90
90
|
<Graph id="SimpleDiagram" key="1" nodeHeight={50} nodeWidth={50}>
|
|
@@ -1,40 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Edge = void 0;
|
|
6
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
5
|
const shared_1 = require("../../shared");
|
|
8
|
-
const Path_1 = __importDefault(require("../Path"));
|
|
9
6
|
const react_1 = require("react");
|
|
10
|
-
const Edge = ({ children, className
|
|
11
|
-
var _a, _b
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const line = givenLine !== null && givenLine !== void 0 ? givenLine : defaultLine;
|
|
16
|
-
const [source, setSource] = (0, react_1.useState)();
|
|
17
|
-
const [target, setTarget] = (0, react_1.useState)();
|
|
7
|
+
const Edge = ({ children, className, dash, id: edgeId, line, markerEnd, markerStart, sourceId, targetId }) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const updateEdge = (0, shared_1.useUpdateEdge)();
|
|
10
|
+
const removeEdge = (0, shared_1.useRemoveEdge)();
|
|
11
|
+
const edge = (0, shared_1.useEdge)(edgeId);
|
|
18
12
|
(0, react_1.useEffect)(() => {
|
|
19
|
-
setSource(edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.register(edgeId, sourceId, setSource));
|
|
20
|
-
setTarget(edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.register(edgeId, targetId, setTarget));
|
|
21
13
|
return () => {
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
if (removeEdge) {
|
|
15
|
+
removeEdge(edgeId);
|
|
16
|
+
}
|
|
24
17
|
};
|
|
25
18
|
}, []);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (updateEdge) {
|
|
21
|
+
updateEdge(edgeId, {
|
|
22
|
+
className,
|
|
23
|
+
dash,
|
|
24
|
+
line,
|
|
25
|
+
markerEnd,
|
|
26
|
+
markerStart,
|
|
27
|
+
sourceId,
|
|
28
|
+
targetId
|
|
29
|
+
});
|
|
34
30
|
}
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
return () => {
|
|
32
|
+
if (removeEdge) {
|
|
33
|
+
removeEdge(edgeId);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
37
|
+
className,
|
|
38
|
+
dash,
|
|
39
|
+
edgeId,
|
|
40
|
+
line,
|
|
41
|
+
markerEnd,
|
|
42
|
+
markerStart,
|
|
43
|
+
removeEdge,
|
|
44
|
+
sourceId,
|
|
45
|
+
targetId,
|
|
46
|
+
updateEdge
|
|
47
|
+
]);
|
|
48
|
+
const style = (0, react_1.useMemo)(() => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
return {
|
|
51
|
+
left: (_a = edge === null || edge === void 0 ? void 0 : edge.center) === null || _a === void 0 ? void 0 : _a.x,
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: (_b = edge === null || edge === void 0 ? void 0 : edge.center) === null || _b === void 0 ? void 0 : _b.y
|
|
54
|
+
};
|
|
55
|
+
}, [
|
|
56
|
+
(_a = edge === null || edge === void 0 ? void 0 : edge.center) === null || _a === void 0 ? void 0 : _a.x,
|
|
57
|
+
(_b = edge === null || edge === void 0 ? void 0 : edge.center) === null || _b === void 0 ? void 0 : _b.y
|
|
58
|
+
]);
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: style, children: children }));
|
|
38
60
|
};
|
|
61
|
+
exports.Edge = Edge;
|
|
39
62
|
Edge.displayName = 'LincleEdge';
|
|
40
|
-
exports.default = Edge;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Marker = () => {
|
|
7
|
+
const id = (0, shared_1.useDiagramId)();
|
|
8
|
+
const markerId = (0, react_1.useMemo)(() => {
|
|
9
|
+
return id ?
|
|
10
|
+
`${id}-` :
|
|
11
|
+
'';
|
|
12
|
+
}, []);
|
|
13
|
+
const arrowId = (0, react_1.useMemo)(() => {
|
|
14
|
+
return `diagram-${markerId}marker-arrow`;
|
|
15
|
+
}, [
|
|
16
|
+
markerId
|
|
17
|
+
]);
|
|
18
|
+
const circleId = (0, react_1.useMemo)(() => {
|
|
19
|
+
return `diagram-${markerId}marker-circle`;
|
|
20
|
+
}, [
|
|
21
|
+
markerId
|
|
22
|
+
]);
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("marker", { id: arrowId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '9', refY: '5', children: (0, jsx_runtime_1.jsx)("path", { className: 'lincle-base-edge-marker-arrow', d: 'M 0 0 L 10 5 L 0 10 z' }) }), (0, jsx_runtime_1.jsx)("marker", { id: circleId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '5', refY: '5', children: (0, jsx_runtime_1.jsx)("circle", { className: 'lincle-base-edge-marker-circle', cx: '5', cy: '5', r: '3' }) })] }));
|
|
24
|
+
};
|
|
25
|
+
Marker.displayName = 'LincleMarker';
|
|
26
|
+
exports.default = Marker;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const shared_1 = require("../../../../shared");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Path = ({ center = true, className = '', edgeId, line, markerEnd: givenMarkerEnd, markerStart: givenMarkerStart, source, style: pathStyle = {}, target }) => {
|
|
7
|
+
const diagramId = (0, shared_1.useDiagramId)();
|
|
8
|
+
const updateEdge = (0, shared_1.useUpdateEdge)();
|
|
9
|
+
const origins = (0, react_1.useMemo)(() => {
|
|
10
|
+
if (source &&
|
|
11
|
+
target &&
|
|
12
|
+
line) {
|
|
13
|
+
const generatedOrigins = (0, shared_1.generateOrigins)(source, target, line, center);
|
|
14
|
+
return generatedOrigins;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}, [
|
|
18
|
+
center,
|
|
19
|
+
line,
|
|
20
|
+
source,
|
|
21
|
+
target
|
|
22
|
+
]);
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
if ((origins === null || origins === void 0 ? void 0 : origins.center) &&
|
|
25
|
+
updateEdge) {
|
|
26
|
+
updateEdge(edgeId, {
|
|
27
|
+
center: origins.center
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}, [
|
|
31
|
+
edgeId,
|
|
32
|
+
origins === null || origins === void 0 ? void 0 : origins.center,
|
|
33
|
+
updateEdge
|
|
34
|
+
]);
|
|
35
|
+
const markerEnd = (0, react_1.useMemo)(() => {
|
|
36
|
+
const id = diagramId ?
|
|
37
|
+
`${diagramId}-` :
|
|
38
|
+
'';
|
|
39
|
+
return givenMarkerEnd !== null && givenMarkerEnd !== void 0 ? givenMarkerEnd : `url(#diagram-${id}marker-arrow)`;
|
|
40
|
+
}, [
|
|
41
|
+
diagramId,
|
|
42
|
+
givenMarkerEnd
|
|
43
|
+
]);
|
|
44
|
+
const markerStart = (0, react_1.useMemo)(() => {
|
|
45
|
+
const id = diagramId ?
|
|
46
|
+
`${diagramId}-` :
|
|
47
|
+
'';
|
|
48
|
+
return givenMarkerStart !== null && givenMarkerStart !== void 0 ? givenMarkerStart : `url(#diagram-${id}marker-circle)`;
|
|
49
|
+
}, [
|
|
50
|
+
diagramId,
|
|
51
|
+
givenMarkerStart
|
|
52
|
+
]);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { className: 'lincle-base-edge-path-border', d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent' }), (0, jsx_runtime_1.jsx)("path", { className: `${className} lincle-base-edge-path`, d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', markerEnd: markerEnd, markerStart: markerStart, style: pathStyle })] }));
|
|
54
|
+
};
|
|
55
|
+
Path.displayName = 'LinclePath';
|
|
56
|
+
exports.default = Path;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Path = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const shared_1 = require("../../../../shared");
|
|
9
|
+
const Path_1 = __importDefault(require("./Path"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const RegisterEdge = ({ className = '', dash, id: edgeId, line: givenLine, markerEnd, markerStart, path, sourceId, targetId }) => {
|
|
12
|
+
const defaultLine = (0, shared_1.useDefaultLine)();
|
|
13
|
+
const edgeSubscriber = (0, shared_1.useEdgeSubscriber)();
|
|
14
|
+
const line = givenLine !== null && givenLine !== void 0 ? givenLine : defaultLine;
|
|
15
|
+
const [source, setSource] = (0, react_1.useState)();
|
|
16
|
+
const [target, setTarget] = (0, react_1.useState)();
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
setSource(edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.register(edgeId, sourceId, setSource));
|
|
19
|
+
setTarget(edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.register(edgeId, targetId, setTarget));
|
|
20
|
+
return () => {
|
|
21
|
+
edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.unregister(edgeId, sourceId);
|
|
22
|
+
edgeSubscriber === null || edgeSubscriber === void 0 ? void 0 : edgeSubscriber.unregister(edgeId, targetId);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
const pathSource = (0, react_1.useMemo)(() => {
|
|
26
|
+
return source ? Object.assign(Object.assign({}, source), { x: source.x, y: source.y }) :
|
|
27
|
+
undefined;
|
|
28
|
+
}, [
|
|
29
|
+
source === null || source === void 0 ? void 0 : source.x,
|
|
30
|
+
source === null || source === void 0 ? void 0 : source.y
|
|
31
|
+
]);
|
|
32
|
+
const pathTarget = (0, react_1.useMemo)(() => {
|
|
33
|
+
return target ? Object.assign(Object.assign({}, target), { x: target.x, y: target.y }) :
|
|
34
|
+
undefined;
|
|
35
|
+
}, [
|
|
36
|
+
target === null || target === void 0 ? void 0 : target.x,
|
|
37
|
+
target === null || target === void 0 ? void 0 : target.y
|
|
38
|
+
]);
|
|
39
|
+
const customPath = (0, react_1.useMemo)(() => {
|
|
40
|
+
return path ?
|
|
41
|
+
path(pathSource, pathTarget) :
|
|
42
|
+
undefined;
|
|
43
|
+
}, [
|
|
44
|
+
path,
|
|
45
|
+
pathSource,
|
|
46
|
+
pathTarget
|
|
47
|
+
]);
|
|
48
|
+
const generatedClassName = (0, react_1.useMemo)(() => {
|
|
49
|
+
if (dash === true) {
|
|
50
|
+
return `${className} lincle-base-edge-dash-on'`;
|
|
51
|
+
}
|
|
52
|
+
else if (dash === false) {
|
|
53
|
+
return `${className} lincle-base-edge-dash-off'`;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
className,
|
|
60
|
+
dash
|
|
61
|
+
]);
|
|
62
|
+
if (source &&
|
|
63
|
+
target) {
|
|
64
|
+
return customPath !== null && customPath !== void 0 ? customPath : ((0, jsx_runtime_1.jsx)(Path_1.default, { center: true, className: generatedClassName, edgeId: edgeId, line: line, markerEnd: markerEnd, markerStart: markerStart, source: pathSource, target: pathTarget }));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
RegisterEdge.displayName = 'LincleRegisterEdge';
|
|
71
|
+
exports.default = RegisterEdge;
|
|
72
|
+
var Path_2 = require("./Path");
|
|
73
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return __importDefault(Path_2).default; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Path = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const shared_1 = require("../../../shared");
|
|
9
|
+
const Path_1 = __importDefault(require("./Path"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const Paths = () => {
|
|
12
|
+
const edges = (0, shared_1.useEdges)();
|
|
13
|
+
const paths = (0, react_1.useMemo)(() => {
|
|
14
|
+
const edgesMap = Object.keys(edges).map((edgeId) => {
|
|
15
|
+
const { sourceId, targetId } = edges[edgeId];
|
|
16
|
+
if (sourceId &&
|
|
17
|
+
targetId) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(Path_1.default, { id: edgeId, sourceId: sourceId, targetId: targetId }, edgeId));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return edgesMap;
|
|
25
|
+
}, [
|
|
26
|
+
edges
|
|
27
|
+
]);
|
|
28
|
+
return paths;
|
|
29
|
+
};
|
|
30
|
+
Paths.displayName = 'LincleGraph';
|
|
31
|
+
exports.default = Paths;
|
|
32
|
+
var Path_2 = require("./Path");
|
|
33
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_2.Path; } });
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { type EdgesProps
|
|
2
|
-
import { type
|
|
1
|
+
import { type EdgesProps } from '../../shared';
|
|
2
|
+
import { type FunctionComponent } from 'react';
|
|
3
3
|
declare const Edges: FunctionComponent<EdgesProps>;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
readonly className?: string;
|
|
7
|
-
readonly style?: CSSProperties;
|
|
8
|
-
};
|
|
4
|
+
export { Edges };
|
|
5
|
+
export { Path } from './Paths';
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Path = exports.Edges = void 0;
|
|
3
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
8
|
+
const Marker_1 = __importDefault(require("./Marker"));
|
|
9
|
+
const Paths_1 = __importDefault(require("./Paths"));
|
|
5
10
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const dashClass = (dash) => {
|
|
12
|
+
if (dash === true) {
|
|
13
|
+
return 'lincle-base-edge-dash-all';
|
|
14
|
+
}
|
|
15
|
+
else if (dash === false) {
|
|
16
|
+
return 'lincle-base-edge-dash-none';
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Edges = ({ children, className: givenClassName = '', dash, style }) => {
|
|
23
|
+
const className = (0, react_1.useMemo)(() => {
|
|
24
|
+
return `lincle-base-edges ${givenClassName} ${dashClass(dash)}`;
|
|
13
25
|
}, [
|
|
14
|
-
|
|
26
|
+
dash,
|
|
27
|
+
givenClassName
|
|
15
28
|
]);
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: className, style: style, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)(Marker_1.default, {}) }), (0, jsx_runtime_1.jsx)(Paths_1.default, {})] }), children] }));
|
|
17
30
|
};
|
|
31
|
+
exports.Edges = Edges;
|
|
18
32
|
Edges.displayName = 'LincleEdges';
|
|
19
|
-
|
|
33
|
+
var Paths_2 = require("./Paths");
|
|
34
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Paths_2.Path; } });
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const shared_1 = require("
|
|
4
|
+
const shared_1 = require("../../../shared");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const SIZE = 0.4;
|
|
7
7
|
const Circle = ((0, jsx_runtime_1.jsx)("circle", { cx: SIZE, cy: SIZE, fill: 'black', r: SIZE }));
|
|
8
8
|
const Grid = ({ children, scale = 1, xOffset: givenXOffset = 0, yOffset: givenYOffset = 0 }) => {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
const diagramId = (0, shared_1.useDiagramId)();
|
|
10
|
+
const [givenGridX, givenGridY] = (0, shared_1.useGrid)() || [
|
|
11
|
+
1,
|
|
12
|
+
1
|
|
13
|
+
];
|
|
12
14
|
const id = `lincle-grid-${diagramId}`;
|
|
13
15
|
const gridX = (0, react_1.useMemo)(() => {
|
|
14
16
|
return givenGridX * scale;
|
|
@@ -3,14 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Grid = exports.Graph = void 0;
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
const shared_1 = require("../../shared");
|
|
9
|
+
const Grid_1 = __importDefault(require("./Grid"));
|
|
10
|
+
const Graph = ({ children, edgeFrequency, grid, id, line, nodeFrequency, nodeHeight, nodeWidth, shape, showGrid }) => {
|
|
9
11
|
if (!id) {
|
|
10
12
|
console.error('No ID provided to @lincle/base Graph!');
|
|
11
13
|
return null;
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
const gird = showGrid === false ?
|
|
16
|
+
null :
|
|
17
|
+
(0, jsx_runtime_1.jsx)(Grid_1.default, {});
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(shared_1.Providers, { edgeFrequency: edgeFrequency, grid: grid, id: id, line: line, nodeFrequency: nodeFrequency, nodeHeight: nodeHeight, nodeWidth: nodeWidth, shape: shape, children: [gird, children] }));
|
|
14
19
|
};
|
|
20
|
+
exports.Graph = Graph;
|
|
15
21
|
Graph.displayName = 'LincleGraph';
|
|
16
|
-
|
|
22
|
+
var Grid_2 = require("./Grid");
|
|
23
|
+
Object.defineProperty(exports, "Grid", { enumerable: true, get: function () { return __importDefault(Grid_2).default; } });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type NodeProps } from '../../shared';
|
|
3
|
-
declare const
|
|
4
|
-
export
|
|
2
|
+
declare const refNode: import("react").ForwardRefExoticComponent<Omit<NodeProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export { refNode as Node };
|
|
@@ -11,21 +11,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Node = void 0;
|
|
14
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
16
|
const shared_1 = require("../../shared");
|
|
16
17
|
const react_1 = require("react");
|
|
17
18
|
const Node = (_a, ref) => {
|
|
18
|
-
var _b, _c, _d
|
|
19
|
-
var { children, className = '', height: givenHeight, id: nodeId, shape: givenShape, style: { node: nodeStyle } = {}, width: givenWidth, x: givenX = 0, y: givenY = 0 } = _a, additionalProperties = __rest(_a, ["children", "className", "height", "id", "shape", "style", "width", "x", "y"]);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const width = (_g = givenWidth !== null && givenWidth !== void 0 ? givenWidth : defaultWidth) !== null && _g !== void 0 ? _g : 0;
|
|
19
|
+
var _b, _c, _d;
|
|
20
|
+
var { children, className: givenClassName = '', height: givenHeight, id: nodeId, shape: givenShape, style: { node: nodeStyle } = {}, width: givenWidth, x: givenX = 0, y: givenY = 0 } = _a, additionalProperties = __rest(_a, ["children", "className", "height", "id", "shape", "style", "width", "x", "y"]);
|
|
21
|
+
const defaultHeight = (0, shared_1.useDefaultNodeHeight)();
|
|
22
|
+
const defaultShape = (0, shared_1.useDefaultShape)();
|
|
23
|
+
const defaultWidth = (0, shared_1.useDefaultNodeWidth)();
|
|
24
|
+
const edgeSubscriber = (0, shared_1.useEdgeSubscriber)();
|
|
25
|
+
const nodePositions = (0, shared_1.useNodePositions)();
|
|
26
|
+
const height = (_b = givenHeight !== null && givenHeight !== void 0 ? givenHeight : defaultHeight) !== null && _b !== void 0 ? _b : 0;
|
|
27
|
+
const shape = (_c = givenShape !== null && givenShape !== void 0 ? givenShape : defaultShape) !== null && _c !== void 0 ? _c : 'oval';
|
|
28
|
+
const width = (_d = givenWidth !== null && givenWidth !== void 0 ? givenWidth : defaultWidth) !== null && _d !== void 0 ? _d : 0;
|
|
29
29
|
const { x, y } = (0, react_1.useMemo)(() => {
|
|
30
30
|
var _a;
|
|
31
31
|
if (!(givenX || givenY)) {
|
|
@@ -119,7 +119,21 @@ const Node = (_a, ref) => {
|
|
|
119
119
|
x,
|
|
120
120
|
y
|
|
121
121
|
]);
|
|
122
|
-
|
|
122
|
+
const className = (0, react_1.useMemo)(() => {
|
|
123
|
+
return `${givenClassName} lincle-base-node ${shape === 'oval' ?
|
|
124
|
+
'lincle-base-node-round' :
|
|
125
|
+
''}`;
|
|
126
|
+
}, [
|
|
127
|
+
givenClassName,
|
|
128
|
+
shape
|
|
129
|
+
]);
|
|
130
|
+
const dataTestId = (0, react_1.useMemo)(() => {
|
|
131
|
+
return `node-${nodeId}`;
|
|
132
|
+
}, [
|
|
133
|
+
nodeId
|
|
134
|
+
]);
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: className, "data-testid": dataTestId, ref: ref, role: 'none', style: adjustedStyle }, additionalProperties, { children: children })));
|
|
123
136
|
};
|
|
124
137
|
Node.displayName = 'LincleNode';
|
|
125
|
-
|
|
138
|
+
const refNode = (0, react_1.forwardRef)(Node);
|
|
139
|
+
exports.Node = refNode;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export { default as Node } from './Node';
|
|
7
|
-
export { default as Nodes } from './Nodes';
|
|
8
|
-
export { default as Path } from './Path';
|
|
1
|
+
export * from './Edge';
|
|
2
|
+
export * from './Edges';
|
|
3
|
+
export * from './Graph';
|
|
4
|
+
export * from './Node';
|
|
5
|
+
export * from './Nodes';
|
package/dist/components/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var Graph_1 = require("./Graph");
|
|
12
|
-
Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return __importDefault(Graph_1).default; } });
|
|
13
|
-
var GraphContexts_1 = require("./GraphContexts");
|
|
14
|
-
Object.defineProperty(exports, "GraphContexts", { enumerable: true, get: function () { return __importDefault(GraphContexts_1).default; } });
|
|
15
|
-
var Grid_1 = require("./Grid");
|
|
16
|
-
Object.defineProperty(exports, "Grid", { enumerable: true, get: function () { return __importDefault(Grid_1).default; } });
|
|
17
|
-
var Node_1 = require("./Node");
|
|
18
|
-
Object.defineProperty(exports, "Node", { enumerable: true, get: function () { return __importDefault(Node_1).default; } });
|
|
19
|
-
var Nodes_1 = require("./Nodes");
|
|
20
|
-
Object.defineProperty(exports, "Nodes", { enumerable: true, get: function () { return __importDefault(Nodes_1).default; } });
|
|
21
|
-
var Path_1 = require("./Path");
|
|
22
|
-
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return __importDefault(Path_1).default; } });
|
|
17
|
+
__exportStar(require("./Edge"), exports);
|
|
18
|
+
__exportStar(require("./Edges"), exports);
|
|
19
|
+
__exportStar(require("./Graph"), exports);
|
|
20
|
+
__exportStar(require("./Node"), exports);
|
|
21
|
+
__exportStar(require("./Nodes"), exports);
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EdgeProps as SharedEdgeProps, type NodeProps as SharedNodeProps, type PathProps as SharedPathProps } from '@lincle/react-shared';
|
|
1
|
+
import { type EdgeProps as SharedEdgeProps, type EdgesProps as EdgesPartialProps, type NodeProps as SharedNodeProps, type PathProps as SharedPathProps } from '@lincle/react-shared';
|
|
2
2
|
import { type CSSProperties } from 'react';
|
|
3
3
|
export type EdgeProps = SharedEdgeProps & {
|
|
4
4
|
className?: string;
|
|
@@ -14,9 +14,10 @@ export type NodeProps = SharedNodeProps & {
|
|
|
14
14
|
};
|
|
15
15
|
export type PathProps = SharedPathProps & {
|
|
16
16
|
className?: string;
|
|
17
|
-
style?:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
export type EdgesProps = EdgesPartialProps & {
|
|
20
|
+
readonly className?: string;
|
|
21
|
+
readonly style?: CSSProperties;
|
|
21
22
|
};
|
|
22
|
-
export {
|
|
23
|
+
export { type EdgeNodeProps, generateOrigins, type GraphProps, type GridProps, type Line, type NodesProps, Providers, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useEdge, useEdges, useEdgeSubscriber, useGrid, useNodePositions, useRemoveEdge, useUpdateEdge } from '@lincle/react-shared';
|
package/dist/shared.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useUpdateEdge = exports.useRemoveEdge = exports.useNodePositions = exports.useGrid = exports.useEdgeSubscriber = exports.useEdges = exports.useEdge = exports.useDiagramId = exports.useDefaultShape = exports.useDefaultNodeWidth = exports.useDefaultNodeHeight = exports.useDefaultLine = exports.Providers = exports.generateOrigins = void 0;
|
|
4
4
|
var react_shared_1 = require("@lincle/react-shared");
|
|
5
|
-
Object.defineProperty(exports, "defaultSettings", { enumerable: true, get: function () { return react_shared_1.defaultSettings; } });
|
|
6
|
-
Object.defineProperty(exports, "EdgeSubscriber", { enumerable: true, get: function () { return react_shared_1.EdgeSubscriber; } });
|
|
7
5
|
Object.defineProperty(exports, "generateOrigins", { enumerable: true, get: function () { return react_shared_1.generateOrigins; } });
|
|
8
|
-
Object.defineProperty(exports, "
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "Providers", { enumerable: true, get: function () { return react_shared_1.Providers; } });
|
|
7
|
+
Object.defineProperty(exports, "useDefaultLine", { enumerable: true, get: function () { return react_shared_1.useDefaultLine; } });
|
|
8
|
+
Object.defineProperty(exports, "useDefaultNodeHeight", { enumerable: true, get: function () { return react_shared_1.useDefaultNodeHeight; } });
|
|
9
|
+
Object.defineProperty(exports, "useDefaultNodeWidth", { enumerable: true, get: function () { return react_shared_1.useDefaultNodeWidth; } });
|
|
10
|
+
Object.defineProperty(exports, "useDefaultShape", { enumerable: true, get: function () { return react_shared_1.useDefaultShape; } });
|
|
11
|
+
Object.defineProperty(exports, "useDiagramId", { enumerable: true, get: function () { return react_shared_1.useDiagramId; } });
|
|
12
|
+
Object.defineProperty(exports, "useEdge", { enumerable: true, get: function () { return react_shared_1.useEdge; } });
|
|
13
|
+
Object.defineProperty(exports, "useEdges", { enumerable: true, get: function () { return react_shared_1.useEdges; } });
|
|
14
|
+
Object.defineProperty(exports, "useEdgeSubscriber", { enumerable: true, get: function () { return react_shared_1.useEdgeSubscriber; } });
|
|
15
|
+
Object.defineProperty(exports, "useGrid", { enumerable: true, get: function () { return react_shared_1.useGrid; } });
|
|
16
|
+
Object.defineProperty(exports, "useNodePositions", { enumerable: true, get: function () { return react_shared_1.useNodePositions; } });
|
|
17
|
+
Object.defineProperty(exports, "useRemoveEdge", { enumerable: true, get: function () { return react_shared_1.useRemoveEdge; } });
|
|
18
|
+
Object.defineProperty(exports, "useUpdateEdge", { enumerable: true, get: function () { return react_shared_1.useUpdateEdge; } });
|
package/dist/styles.g.css
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
.lincle-base-edges {
|
|
4
4
|
position: absolute;
|
|
5
|
-
|
|
5
|
+
inset: 0;
|
|
6
6
|
overflow: visible;
|
|
7
|
-
|
|
8
|
-
/* width: 1px; */
|
|
9
|
-
|
|
10
|
-
/* height: 1px; */
|
|
11
|
-
filter: drop-shadow(0 3px 6px rgba(0 0 0 / 16%)) drop-shadow(0 3px 6px rgba(0 0 0 23%));
|
|
12
7
|
backface-visibility: hidden;
|
|
8
|
+
filter: drop-shadow(0 3px 6px rgba(0 0 0 / 16%)) drop-shadow(0 3px 6px rgba(0 0 0 23%));
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
.lincle-base-edges > :not(path) {
|
|
@@ -39,6 +35,10 @@
|
|
|
39
35
|
transform-origin: 0 0;
|
|
40
36
|
}
|
|
41
37
|
|
|
38
|
+
.lincle-base-node-round {
|
|
39
|
+
border-radius: 50%
|
|
40
|
+
}
|
|
41
|
+
|
|
42
42
|
/* path */
|
|
43
43
|
|
|
44
44
|
.lincle-base-edge-path {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.lincle-base-edge-path-border {
|
|
74
|
-
stroke-width:
|
|
74
|
+
stroke-width: 8px;
|
|
75
75
|
stroke: black;
|
|
76
76
|
opacity: 0;
|
|
77
77
|
pointer-events: all;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-web-base",
|
|
3
3
|
"title": "lincle react web base",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "0.4.0-next.
|
|
5
|
+
"version": "0.4.0-next.3",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A 'reactive' React node and edge generator",
|
|
8
8
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
@@ -44,19 +44,17 @@
|
|
|
44
44
|
"clean:dist": "rimraf dist"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@digest/eslint-config-jest": "^4.3
|
|
48
|
-
"@digest/eslint-config-react": "^4.3
|
|
49
|
-
"@digest/eslint-config-typescript": "^4.3
|
|
50
|
-
"@digest/jest-junit": "^4.3
|
|
51
|
-
"@digest/jest-react": "^4.3
|
|
52
|
-
"@digest/jest-typescript": "^4.3
|
|
53
|
-
"@digest/
|
|
54
|
-
"@
|
|
47
|
+
"@digest/eslint-config-jest": "^4.4.3",
|
|
48
|
+
"@digest/eslint-config-react": "^4.4.3",
|
|
49
|
+
"@digest/eslint-config-typescript": "^4.4.3",
|
|
50
|
+
"@digest/jest-junit": "^4.4.3",
|
|
51
|
+
"@digest/jest-react": "^4.4.3",
|
|
52
|
+
"@digest/jest-typescript": "^4.4.3",
|
|
53
|
+
"@digest/stylelint-config": "^4.4.3",
|
|
54
|
+
"@digest/typescript": "^4.4.3",
|
|
55
55
|
"@types/jest": "^29.5.12",
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/
|
|
58
|
-
"@types/node": "^20.12.12",
|
|
59
|
-
"@types/react": "^18.3.2",
|
|
56
|
+
"@types/node": "^20.14.11",
|
|
57
|
+
"@types/react": "^18.3.3",
|
|
60
58
|
"@types/react-dom": "^18.3.0",
|
|
61
59
|
"@types/react-test-renderer": "^18.3.0",
|
|
62
60
|
"cross-env": "^7.0.3",
|
|
@@ -67,12 +65,10 @@
|
|
|
67
65
|
"react": "^18.3.1",
|
|
68
66
|
"react-dom": "^18.3.1",
|
|
69
67
|
"react-test-renderer": "^18.3.1",
|
|
70
|
-
"rimraf": "^
|
|
68
|
+
"rimraf": "^6.0.1"
|
|
71
69
|
},
|
|
72
70
|
"dependencies": {
|
|
73
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
74
|
-
"lodash.debounce": "^4.0.8",
|
|
75
|
-
"lodash.throttle": "^4.1.1"
|
|
71
|
+
"@lincle/react-shared": "^0.4.0-next.3"
|
|
76
72
|
},
|
|
77
73
|
"peerDependencies": {
|
|
78
74
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -93,5 +89,5 @@
|
|
|
93
89
|
"acyclical graph",
|
|
94
90
|
"cyclical graph"
|
|
95
91
|
],
|
|
96
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "0d9cda53a8175e6d2a64d7b3b81828fc98007bfb"
|
|
97
93
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const shared_1 = require("../../shared");
|
|
8
|
-
const Grid_1 = __importDefault(require("../Grid"));
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const GraphContexts = ({ children, edgeFrequency = shared_1.defaultSettings.edgeFrequency, grid = shared_1.defaultSettings.grid, id, line = shared_1.defaultSettings.line, nodeFrequency = shared_1.defaultSettings.nodeFrequency, nodeHeight = shared_1.defaultSettings.height, nodeWidth = shared_1.defaultSettings.width, shape = shared_1.defaultSettings.shape }) => {
|
|
11
|
-
const diagramId = (0, react_1.useMemo)(() => {
|
|
12
|
-
return id;
|
|
13
|
-
}, []);
|
|
14
|
-
const permanent = (0, react_1.useMemo)(() => {
|
|
15
|
-
return {
|
|
16
|
-
diagramId,
|
|
17
|
-
edgeSubscriber: new shared_1.EdgeSubscriber(edgeFrequency),
|
|
18
|
-
nodePositions: new shared_1.NodePositions()
|
|
19
|
-
};
|
|
20
|
-
}, []);
|
|
21
|
-
const provides = (0, react_1.useMemo)(() => {
|
|
22
|
-
return Object.assign(Object.assign({}, permanent), { defaultSettings: {
|
|
23
|
-
edgeFrequency,
|
|
24
|
-
height: nodeHeight,
|
|
25
|
-
line,
|
|
26
|
-
nodeFrequency,
|
|
27
|
-
shape,
|
|
28
|
-
width: nodeWidth
|
|
29
|
-
} });
|
|
30
|
-
}, [
|
|
31
|
-
edgeFrequency,
|
|
32
|
-
line,
|
|
33
|
-
nodeFrequency,
|
|
34
|
-
nodeHeight,
|
|
35
|
-
nodeWidth,
|
|
36
|
-
permanent,
|
|
37
|
-
shape
|
|
38
|
-
]);
|
|
39
|
-
const hiddenGrid = grid === false ?
|
|
40
|
-
children :
|
|
41
|
-
((0, jsx_runtime_1.jsxs)(shared_1.GridContext.Provider, { value: grid, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, {}), children] }));
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(shared_1.GraphContext.Provider, { value: provides, children: hiddenGrid }));
|
|
43
|
-
};
|
|
44
|
-
GraphContexts.displayName = 'LincleGraphContexts';
|
|
45
|
-
exports.default = GraphContexts;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const shared_1 = require("../../shared");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const Path = ({ children, className = '', diagramId, line, markerEnd, markerStart, source, style: { center: centerStyle, path: pathStyle } = {
|
|
7
|
-
center: {},
|
|
8
|
-
path: {}
|
|
9
|
-
}, target }) => {
|
|
10
|
-
const hasChildren = Boolean(children);
|
|
11
|
-
const origins = (0, react_1.useMemo)(() => {
|
|
12
|
-
if (source &&
|
|
13
|
-
target &&
|
|
14
|
-
line) {
|
|
15
|
-
return (0, shared_1.generateOrigins)(source, target, line, hasChildren);
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
}, [
|
|
19
|
-
hasChildren,
|
|
20
|
-
line,
|
|
21
|
-
source,
|
|
22
|
-
target
|
|
23
|
-
]);
|
|
24
|
-
const center = (0, react_1.useMemo)(() => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
return (origins === null || origins === void 0 ? void 0 : origins.center) ?
|
|
27
|
-
((0, jsx_runtime_1.jsx)("g", { height: '1px', style: centerStyle, transform: `translate(${(_a = origins === null || origins === void 0 ? void 0 : origins.center) === null || _a === void 0 ? void 0 : _a.x},${(_b = origins === null || origins === void 0 ? void 0 : origins.center) === null || _b === void 0 ? void 0 : _b.y})`, width: '1px', children: children })) :
|
|
28
|
-
undefined;
|
|
29
|
-
}, [
|
|
30
|
-
centerStyle,
|
|
31
|
-
children,
|
|
32
|
-
origins === null || origins === void 0 ? void 0 : origins.center
|
|
33
|
-
]);
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { className: 'lincle-base-edge-path-border', d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent' }), (0, jsx_runtime_1.jsx)("path", { className: `${className} lincle-base-edge-path`, d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', markerEnd: markerEnd ?
|
|
35
|
-
markerEnd :
|
|
36
|
-
`url(#diagram-${diagramId ?
|
|
37
|
-
`${diagramId}-` :
|
|
38
|
-
''}marker-arrow)`, markerStart: markerStart ?
|
|
39
|
-
markerStart :
|
|
40
|
-
`url(#diagram-${diagramId ?
|
|
41
|
-
`${diagramId}-` :
|
|
42
|
-
''}marker-circle)`, style: pathStyle })] }), center] }));
|
|
43
|
-
};
|
|
44
|
-
Path.displayName = 'LinclePath';
|
|
45
|
-
exports.default = Path;
|