@lincle/react-native-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 +49 -28
- package/dist/components/Edges/Marker.d.ts +3 -0
- package/dist/components/Edges/Marker.js +29 -0
- package/dist/components/{Path/index.d.ts → Edges/Paths/Path/Path.d.ts} +1 -1
- package/dist/components/Edges/Paths/Path/Path.js +57 -0
- package/dist/components/Edges/Paths/Path/index.d.ts +5 -0
- package/dist/components/Edges/Paths/Path/index.js +59 -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 -3
- package/dist/components/Edges/index.js +39 -13
- package/dist/components/{Grid → Graph/Grid}/index.d.ts +1 -1
- package/dist/components/{Grid → Graph/Grid}/index.js +9 -6
- 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 +12 -11
- package/dist/components/Nodes/index.d.ts +1 -1
- package/dist/components/Nodes/index.js +4 -2
- package/dist/components/index.d.ts +5 -8
- package/dist/components/index.js +18 -19
- package/dist/shared.d.ts +9 -5
- package/dist/shared.js +14 -6
- package/package.json +15 -21
- package/dist/components/GraphContexts/index.d.ts +0 -4
- package/dist/components/GraphContexts/index.js +0 -45
- package/dist/components/Path/index.js +0 -43
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,61 @@
|
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const [source, setSource] = (0, react_1.useState)();
|
|
17
|
-
const [target, setTarget] = (0, react_1.useState)();
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const Edge = ({ children, dash, id: edgeId, line, markerEnd, markerStart, sourceId, targetId }) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const updateEdge = (0, shared_1.useUpdateEdge)();
|
|
11
|
+
const removeEdge = (0, shared_1.useRemoveEdge)();
|
|
12
|
+
const edge = (0, shared_1.useEdge)(edgeId);
|
|
18
13
|
(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
14
|
return () => {
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
if (removeEdge) {
|
|
16
|
+
removeEdge(edgeId);
|
|
17
|
+
}
|
|
24
18
|
};
|
|
25
19
|
}, []);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
if (updateEdge) {
|
|
22
|
+
updateEdge(edgeId, {
|
|
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
|
+
dash,
|
|
38
|
+
edgeId,
|
|
39
|
+
line,
|
|
40
|
+
markerEnd,
|
|
41
|
+
markerStart,
|
|
42
|
+
removeEdge,
|
|
43
|
+
sourceId,
|
|
44
|
+
targetId,
|
|
45
|
+
updateEdge
|
|
46
|
+
]);
|
|
47
|
+
const style = (0, react_1.useMemo)(() => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return {
|
|
50
|
+
left: (_a = edge === null || edge === void 0 ? void 0 : edge.center) === null || _a === void 0 ? void 0 : _a.x,
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: (_b = edge === null || edge === void 0 ? void 0 : edge.center) === null || _b === void 0 ? void 0 : _b.y
|
|
53
|
+
};
|
|
54
|
+
}, [
|
|
55
|
+
(_a = edge === null || edge === void 0 ? void 0 : edge.center) === null || _a === void 0 ? void 0 : _a.x,
|
|
56
|
+
(_b = edge === null || edge === void 0 ? void 0 : edge.center) === null || _b === void 0 ? void 0 : _b.y
|
|
57
|
+
]);
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: style, children: children }));
|
|
38
59
|
};
|
|
60
|
+
exports.Edge = Edge;
|
|
39
61
|
Edge.displayName = 'LincleEdge';
|
|
40
|
-
exports.default = Edge;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 react_native_svg_1 = require("react-native-svg");
|
|
7
|
+
const Marker = () => {
|
|
8
|
+
const id = (0, shared_1.useDiagramId)();
|
|
9
|
+
const markerId = (0, react_1.useMemo)(() => {
|
|
10
|
+
return id ?
|
|
11
|
+
`${id}-` :
|
|
12
|
+
'';
|
|
13
|
+
}, [
|
|
14
|
+
id
|
|
15
|
+
]);
|
|
16
|
+
const arrowId = (0, react_1.useMemo)(() => {
|
|
17
|
+
return `diagram-${markerId}marker-arrow`;
|
|
18
|
+
}, [
|
|
19
|
+
markerId
|
|
20
|
+
]);
|
|
21
|
+
const circleId = (0, react_1.useMemo)(() => {
|
|
22
|
+
return `diagram-${markerId}marker-circle`;
|
|
23
|
+
}, [
|
|
24
|
+
markerId
|
|
25
|
+
]);
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Marker, { id: arrowId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '9', refY: '5', children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: 'M 0 0 L 10 5 L 0 10 z', fill: 'black' }) }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Marker, { id: circleId, markerHeight: '10', markerUnits: 'strokeWidth', markerWidth: '10', orient: 'auto', refX: '5', refY: '5', children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: '5', cy: '5', fill: 'black', r: '3' }) })] }));
|
|
27
|
+
};
|
|
28
|
+
Marker.displayName = 'LincleMarker';
|
|
29
|
+
exports.default = Marker;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 react_native_svg_1 = require("react-native-svg");
|
|
7
|
+
const Path = ({ center = true, edgeId, line, markerEnd: givenMarkerEnd, markerStart: givenMarkerStart, source, target }) => {
|
|
8
|
+
const diagramId = (0, shared_1.useDiagramId)();
|
|
9
|
+
const updateEdge = (0, shared_1.useUpdateEdge)();
|
|
10
|
+
const origins = (0, react_1.useMemo)(() => {
|
|
11
|
+
if (source &&
|
|
12
|
+
target &&
|
|
13
|
+
line) {
|
|
14
|
+
const generatedOrigins = (0, shared_1.generateOrigins)(source, target, line, center);
|
|
15
|
+
return generatedOrigins;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}, [
|
|
19
|
+
center,
|
|
20
|
+
line,
|
|
21
|
+
source,
|
|
22
|
+
target
|
|
23
|
+
]);
|
|
24
|
+
(0, react_1.useEffect)(() => {
|
|
25
|
+
if ((origins === null || origins === void 0 ? void 0 : origins.center) &&
|
|
26
|
+
updateEdge) {
|
|
27
|
+
updateEdge(edgeId, {
|
|
28
|
+
center: origins.center
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
edgeId,
|
|
33
|
+
origins === null || origins === void 0 ? void 0 : origins.center,
|
|
34
|
+
updateEdge
|
|
35
|
+
]);
|
|
36
|
+
const markerEnd = (0, react_1.useMemo)(() => {
|
|
37
|
+
const id = diagramId ?
|
|
38
|
+
`${diagramId}-` :
|
|
39
|
+
'';
|
|
40
|
+
return givenMarkerEnd !== null && givenMarkerEnd !== void 0 ? givenMarkerEnd : `url(#diagram-${id}marker-arrow)`;
|
|
41
|
+
}, [
|
|
42
|
+
diagramId,
|
|
43
|
+
givenMarkerEnd
|
|
44
|
+
]);
|
|
45
|
+
const markerStart = (0, react_1.useMemo)(() => {
|
|
46
|
+
const id = diagramId ?
|
|
47
|
+
`${diagramId}-` :
|
|
48
|
+
'';
|
|
49
|
+
return givenMarkerStart !== null && givenMarkerStart !== void 0 ? givenMarkerStart : `url(#diagram-${id}marker-circle)`;
|
|
50
|
+
}, [
|
|
51
|
+
diagramId,
|
|
52
|
+
givenMarkerStart
|
|
53
|
+
]);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_svg_1.G, { children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', id: diagramId + '1', opacity: 0, pointerEvents: 'auto', stroke: 'black', strokeWidth: 30 }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', id: diagramId + '2', markerEnd: markerEnd, markerStart: markerStart, stroke: 'black' })] }));
|
|
55
|
+
};
|
|
56
|
+
Path.displayName = 'LinclePath';
|
|
57
|
+
exports.default = Path;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 = ({ 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
|
+
if (source &&
|
|
49
|
+
target) {
|
|
50
|
+
return customPath !== null && customPath !== void 0 ? customPath : ((0, jsx_runtime_1.jsx)(Path_1.default, { center: true, edgeId: edgeId, line: line, markerEnd: markerEnd, markerStart: markerStart, source: pathSource, target: pathTarget }));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
RegisterEdge.displayName = 'LincleRegisterEdge';
|
|
57
|
+
exports.default = RegisterEdge;
|
|
58
|
+
var Path_2 = require("./Path");
|
|
59
|
+
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,5 +1,6 @@
|
|
|
1
|
-
import { type EdgesProps
|
|
1
|
+
import { type EdgesProps } from '../../shared';
|
|
2
2
|
import { type FunctionComponent } from 'react';
|
|
3
3
|
declare const Edges: FunctionComponent<EdgesProps>;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export { Edges };
|
|
5
|
+
export { default as Marker } from './Marker';
|
|
6
|
+
export { Path } from './Paths';
|
|
@@ -22,29 +22,55 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Path = exports.Marker = exports.Edges = void 0;
|
|
26
30
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
-
const
|
|
31
|
+
const Marker_1 = __importDefault(require("./Marker"));
|
|
32
|
+
const Paths_1 = __importDefault(require("./Paths"));
|
|
28
33
|
const react_1 = require("react");
|
|
34
|
+
const react_native_1 = require("react-native");
|
|
29
35
|
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
30
|
-
const styles = {
|
|
36
|
+
const styles = react_native_1.StyleSheet.create({
|
|
37
|
+
bridges: {
|
|
38
|
+
bottom: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
overflow: 'visible',
|
|
41
|
+
pointerEvents: 'box-none',
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
right: 0,
|
|
44
|
+
top: 0
|
|
45
|
+
},
|
|
31
46
|
edges: {
|
|
32
47
|
backfaceVisibility: 'hidden',
|
|
33
48
|
overflow: 'visible',
|
|
34
49
|
zIndex: -1
|
|
35
50
|
}
|
|
36
|
-
};
|
|
37
|
-
const Edges = ({ children
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
});
|
|
52
|
+
const Edges = ({ children, scale = 1, translate = {
|
|
53
|
+
x: 0,
|
|
54
|
+
y: 0
|
|
55
|
+
} }) => {
|
|
56
|
+
const { style, transform } = (0, react_1.useMemo)(() => {
|
|
57
|
+
const tx = translate.x;
|
|
58
|
+
const ty = translate.y;
|
|
59
|
+
const tz = scale;
|
|
60
|
+
return {
|
|
61
|
+
style: Object.assign(Object.assign({}, styles.bridges), { transform: `translateX(${tx}px) translateY(${ty}px) scale(${tz})`, transformOrigin: 'top left' }),
|
|
62
|
+
transform: `translate(${tx}, ${ty}) scale(${tz})`
|
|
63
|
+
};
|
|
44
64
|
}, [
|
|
45
|
-
|
|
65
|
+
translate.x,
|
|
66
|
+
translate.y,
|
|
67
|
+
scale
|
|
46
68
|
]);
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { style: styles.edges, transform: transform, children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Defs, { children: (0, jsx_runtime_1.jsx)(Marker_1.default, {}) }), (0, jsx_runtime_1.jsx)(Paths_1.default, {})] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: style, children: children })] }));
|
|
48
70
|
};
|
|
71
|
+
exports.Edges = Edges;
|
|
49
72
|
Edges.displayName = 'LincleEdges';
|
|
50
|
-
|
|
73
|
+
var Marker_2 = require("./Marker");
|
|
74
|
+
Object.defineProperty(exports, "Marker", { enumerable: true, get: function () { return __importDefault(Marker_2).default; } });
|
|
75
|
+
var Paths_2 = require("./Paths");
|
|
76
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Paths_2.Path; } });
|
|
@@ -24,22 +24,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
-
const shared_1 = require("
|
|
27
|
+
const shared_1 = require("../../../shared");
|
|
28
28
|
const react_1 = require("react");
|
|
29
|
+
const react_native_1 = require("react-native");
|
|
29
30
|
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
30
|
-
const styles = {
|
|
31
|
+
const styles = react_native_1.StyleSheet.create({
|
|
31
32
|
grid: {
|
|
32
33
|
height: '100%',
|
|
33
34
|
position: 'absolute',
|
|
34
35
|
width: '100%'
|
|
35
36
|
}
|
|
36
|
-
};
|
|
37
|
+
});
|
|
37
38
|
const SIZE = 0.4;
|
|
38
39
|
const Circle = ((0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: SIZE, cy: SIZE, fill: 'black', r: SIZE }));
|
|
39
40
|
const Grid = ({ children, scale = 1, xOffset: givenXOffset = 0, yOffset: givenYOffset = 0 }) => {
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const diagramId = (0, shared_1.useDiagramId)();
|
|
42
|
+
const [givenGridX, givenGridY] = (0, shared_1.useGrid)() || [
|
|
43
|
+
1,
|
|
44
|
+
1
|
|
45
|
+
];
|
|
43
46
|
const id = `lincle-grid-${diagramId}`;
|
|
44
47
|
const gridX = (0, react_1.useMemo)(() => {
|
|
45
48
|
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,22 +11,22 @@ 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 react_native_1 = require("react-native");
|
|
18
19
|
const Node = (_a, ref) => {
|
|
19
|
-
var _b, _c, _d
|
|
20
|
+
var _b, _c, _d;
|
|
20
21
|
var { children, height: givenHeight, id: nodeId, shape: givenShape, style: { node: nodeStyle } = {}, track = true, width: givenWidth, x: givenX = 0, y: givenY = 0 } = _a, additionalProperties = __rest(_a, ["children", "height", "id", "shape", "style", "track", "width", "x", "y"]);
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const width = (_g = givenWidth !== null && givenWidth !== void 0 ? givenWidth : defaultWidth) !== null && _g !== void 0 ? _g : 0;
|
|
22
|
+
const defaultHeight = (0, shared_1.useDefaultNodeHeight)();
|
|
23
|
+
const defaultShape = (0, shared_1.useDefaultShape)();
|
|
24
|
+
const defaultWidth = (0, shared_1.useDefaultNodeWidth)();
|
|
25
|
+
const edgeSubscriber = (0, shared_1.useEdgeSubscriber)();
|
|
26
|
+
const nodePositions = (0, shared_1.useNodePositions)();
|
|
27
|
+
const height = (_b = givenHeight !== null && givenHeight !== void 0 ? givenHeight : defaultHeight) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
+
const shape = (_c = givenShape !== null && givenShape !== void 0 ? givenShape : defaultShape) !== null && _c !== void 0 ? _c : 'oval';
|
|
29
|
+
const width = (_d = givenWidth !== null && givenWidth !== void 0 ? givenWidth : defaultWidth) !== null && _d !== void 0 ? _d : 0;
|
|
30
30
|
const { x, y } = (0, react_1.useMemo)(() => {
|
|
31
31
|
var _a;
|
|
32
32
|
if (!(givenX || givenY)) {
|
|
@@ -129,4 +129,5 @@ const Node = (_a, ref) => {
|
|
|
129
129
|
return ((0, jsx_runtime_1.jsx)(react_native_1.View, Object.assign({ "data-testid": `node-${nodeId}`, ref: ref, role: 'none', style: adjustedStyle }, additionalProperties, { children: children })));
|
|
130
130
|
};
|
|
131
131
|
Node.displayName = 'LincleNode';
|
|
132
|
-
|
|
132
|
+
const refNode = (0, react_1.forwardRef)(Node);
|
|
133
|
+
exports.Node = refNode;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Nodes = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
3
5
|
const Nodes = ({ children }) => {
|
|
4
|
-
return children;
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
5
7
|
};
|
|
8
|
+
exports.Nodes = Nodes;
|
|
6
9
|
Nodes.displayName = 'LincleNodes';
|
|
7
|
-
exports.default = Nodes;
|
|
@@ -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 ViewStyle } from 'react-native';
|
|
3
3
|
export type EdgeProps = SharedEdgeProps & {
|
|
4
4
|
style?: {
|
|
@@ -11,9 +11,13 @@ export type NodeProps = SharedNodeProps & {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export type PathProps = SharedPathProps & {
|
|
14
|
-
style?:
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
style?: ViewStyle;
|
|
15
|
+
};
|
|
16
|
+
export type EdgesProps = EdgesPartialProps & {
|
|
17
|
+
readonly scale?: number;
|
|
18
|
+
readonly translate?: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
|
-
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-native-base",
|
|
3
3
|
"title": "lincle react native 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)",
|
|
@@ -43,19 +43,16 @@
|
|
|
43
43
|
"clean:dist": "rimraf dist"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@digest/eslint-config-jest": "^4.3
|
|
47
|
-
"@digest/eslint-config-react": "^4.3
|
|
48
|
-
"@digest/eslint-config-typescript": "^4.3
|
|
49
|
-
"@digest/jest-junit": "^4.3
|
|
50
|
-
"@digest/jest-react": "^4.3
|
|
51
|
-
"@digest/jest-typescript": "^4.3
|
|
52
|
-
"@digest/typescript": "^4.3
|
|
53
|
-
"@types/bezier-js": "^4.1.3",
|
|
46
|
+
"@digest/eslint-config-jest": "^4.4.3",
|
|
47
|
+
"@digest/eslint-config-react": "^4.4.3",
|
|
48
|
+
"@digest/eslint-config-typescript": "^4.4.3",
|
|
49
|
+
"@digest/jest-junit": "^4.4.3",
|
|
50
|
+
"@digest/jest-react": "^4.4.3",
|
|
51
|
+
"@digest/jest-typescript": "^4.4.3",
|
|
52
|
+
"@digest/typescript": "^4.4.3",
|
|
54
53
|
"@types/jest": "^29.5.12",
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/node": "^20.12.12",
|
|
58
|
-
"@types/react": "^18.3.2",
|
|
54
|
+
"@types/node": "^20.14.11",
|
|
55
|
+
"@types/react": "^18.3.3",
|
|
59
56
|
"@types/react-native": "^0.73.0",
|
|
60
57
|
"@types/react-test-renderer": "^18.3.0",
|
|
61
58
|
"cross-env": "^7.0.3",
|
|
@@ -64,16 +61,13 @@
|
|
|
64
61
|
"ncp": "^2.0.0",
|
|
65
62
|
"npm-run-all": "^4.1.5",
|
|
66
63
|
"react": "^18.3.1",
|
|
67
|
-
"react-native": "^0.74.
|
|
68
|
-
"react-native-svg": "^15.
|
|
64
|
+
"react-native": "^0.74.3",
|
|
65
|
+
"react-native-svg": "^15.4.0",
|
|
69
66
|
"react-test-renderer": "^18.3.1",
|
|
70
|
-
"rimraf": "^
|
|
67
|
+
"rimraf": "^6.0.1"
|
|
71
68
|
},
|
|
72
69
|
"dependencies": {
|
|
73
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
74
|
-
"bezier-js": "^6.1.4",
|
|
75
|
-
"lodash.debounce": "^4.0.8",
|
|
76
|
-
"lodash.throttle": "^4.1.1"
|
|
70
|
+
"@lincle/react-shared": "^0.4.0-next.3"
|
|
77
71
|
},
|
|
78
72
|
"peerDependencies": {
|
|
79
73
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -95,5 +89,5 @@
|
|
|
95
89
|
"acyclical graph",
|
|
96
90
|
"cyclical graph"
|
|
97
91
|
],
|
|
98
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "0d9cda53a8175e6d2a64d7b3b81828fc98007bfb"
|
|
99
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,43 +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 react_native_svg_1 = require("react-native-svg");
|
|
7
|
-
const Path = ({ children, diagramId, line, markerEnd, markerStart, source, style: { center: centerStyle } = {}, target }) => {
|
|
8
|
-
const hasChildren = Boolean(children);
|
|
9
|
-
const origins = (0, react_1.useMemo)(() => {
|
|
10
|
-
if (source &&
|
|
11
|
-
target &&
|
|
12
|
-
line) {
|
|
13
|
-
return (0, shared_1.generateOrigins)(source, target, line, hasChildren);
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}, [
|
|
17
|
-
hasChildren,
|
|
18
|
-
line,
|
|
19
|
-
source,
|
|
20
|
-
target
|
|
21
|
-
]);
|
|
22
|
-
const center = (0, react_1.useMemo)(() => {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
return (origins === null || origins === void 0 ? void 0 : origins.center) ?
|
|
25
|
-
((0, jsx_runtime_1.jsx)(react_native_svg_1.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 })) :
|
|
26
|
-
undefined;
|
|
27
|
-
}, [
|
|
28
|
-
children,
|
|
29
|
-
origins === null || origins === void 0 ? void 0 : origins.center,
|
|
30
|
-
centerStyle
|
|
31
|
-
]);
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_native_svg_1.G, { children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', id: diagramId + '1', opacity: 0, pointerEvents: 'auto', stroke: 'black', strokeWidth: 30 }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: origins === null || origins === void 0 ? void 0 : origins.path, fill: 'transparent', id: diagramId + '2', markerEnd: markerEnd ?
|
|
33
|
-
markerEnd :
|
|
34
|
-
`url(#diagram-${diagramId ?
|
|
35
|
-
`${diagramId}-` :
|
|
36
|
-
''}marker-arrow)`, markerStart: markerStart ?
|
|
37
|
-
markerStart :
|
|
38
|
-
`url(#diagram-${diagramId ?
|
|
39
|
-
`${diagramId}-` :
|
|
40
|
-
''}marker-circle)`, stroke: 'black' })] }), center] }));
|
|
41
|
-
};
|
|
42
|
-
Path.displayName = 'LinclePath';
|
|
43
|
-
exports.default = Path;
|