@lincle/react-web-interactive 0.4.0-next.3 → 0.4.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Edges/Connections/index.d.ts +2 -2
- package/dist/components/Edges/Connections/index.js +19 -2
- package/dist/components/Edges/index.js +4 -1
- package/dist/components/{Interaction → Nodes/Interaction}/index.d.ts +2 -2
- package/dist/components/{Interaction → Nodes/Interaction}/index.js +15 -8
- package/dist/components/Nodes/index.d.ts +4 -1
- package/dist/components/Nodes/index.js +23 -2
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/shared.d.ts +1 -1
- package/dist/styles.g.css +0 -118
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ConnectionsProps } from '../../../shared';
|
|
2
|
+
import { type FunctionComponent } from 'react';
|
|
2
3
|
declare const Connections: FunctionComponent<ConnectionsProps>;
|
|
3
4
|
export default Connections;
|
|
4
|
-
export type ConnectionsProps = PropsWithChildren<{}>;
|
|
@@ -4,7 +4,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
4
4
|
const shared_1 = require("../../../shared");
|
|
5
5
|
const Edge_1 = require("../../Edge");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const Connections = (
|
|
7
|
+
const Connections = ({ scale = 1, translate = {
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0
|
|
10
|
+
} }) => {
|
|
8
11
|
const connections = (0, shared_1.useConnections)();
|
|
9
12
|
const paths = (0, react_1.useMemo)(() => {
|
|
10
13
|
return Object.keys(connections).map((sourceId) => {
|
|
@@ -14,7 +17,21 @@ const Connections = () => {
|
|
|
14
17
|
}, [
|
|
15
18
|
connections
|
|
16
19
|
]);
|
|
17
|
-
|
|
20
|
+
const style = (0, react_1.useMemo)(() => {
|
|
21
|
+
const tx = translate.x;
|
|
22
|
+
const ty = translate.y;
|
|
23
|
+
const tz = scale;
|
|
24
|
+
const transform = `translateX(${tx}px) translateY(${ty}px) scale(${tz})`;
|
|
25
|
+
return {
|
|
26
|
+
transform,
|
|
27
|
+
transformOrigin: 'top left'
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
translate.x,
|
|
31
|
+
translate.y,
|
|
32
|
+
scale
|
|
33
|
+
]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("svg", { className: 'lincle-base-edges', style: style, children: paths }));
|
|
18
35
|
};
|
|
19
36
|
Connections.displayName = 'LincleInteractiveConnections';
|
|
20
37
|
exports.default = Connections;
|
|
@@ -17,10 +17,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.Edges = void 0;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const base_1 = require("../../base");
|
|
20
|
+
const shared_1 = require("../../shared");
|
|
20
21
|
const Connections_1 = __importDefault(require("./Connections"));
|
|
21
22
|
const Edges = (_a) => {
|
|
22
23
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
23
|
-
|
|
24
|
+
const scale = (0, shared_1.useScale)();
|
|
25
|
+
const translate = (0, shared_1.useTranslate)();
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(base_1.Edges, Object.assign({ scale: scale, translate: translate }, props, { children: children })), (0, jsx_runtime_1.jsx)(Connections_1.default, { scale: scale, translate: translate })] }));
|
|
24
27
|
};
|
|
25
28
|
exports.Edges = Edges;
|
|
26
29
|
Edges.displayName = 'LincleInteractiveEdges';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InteractionProps } from '
|
|
1
|
+
import { type InteractionProps } from '../../../shared';
|
|
2
2
|
import { type FunctionComponent } from 'react';
|
|
3
3
|
declare const Interaction: FunctionComponent<InteractionProps>;
|
|
4
|
-
export
|
|
4
|
+
export default Interaction;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Interaction = void 0;
|
|
4
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const shared_1 = require("
|
|
4
|
+
const shared_1 = require("../../../shared");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const react_map_interaction_1 = require("react-map-interaction");
|
|
8
7
|
const CLICK_TIME = 500;
|
|
@@ -38,8 +37,8 @@ const Interaction = ({ children, onMouseDown, onMouseUp, onTouchEnd, onTouchStar
|
|
|
38
37
|
const graphMode = (0, shared_1.useMode)();
|
|
39
38
|
const givenMode = (0, shared_1.useModeGiven)();
|
|
40
39
|
const onMode = (0, shared_1.useOnMode)();
|
|
41
|
-
const maxScale = (0, shared_1.
|
|
42
|
-
const minScale = (0, shared_1.
|
|
40
|
+
const maxScale = (0, shared_1.useMaxScale)();
|
|
41
|
+
const minScale = (0, shared_1.useMinScale)();
|
|
43
42
|
const pan = (0, shared_1.usePan)();
|
|
44
43
|
const zoom = (0, shared_1.useZoom)();
|
|
45
44
|
const keypress = (0, react_1.useRef)(false);
|
|
@@ -184,9 +183,17 @@ const Interaction = ({ children, onMouseDown, onMouseUp, onTouchEnd, onTouchStar
|
|
|
184
183
|
scale,
|
|
185
184
|
translate
|
|
186
185
|
]);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
const child = (0, react_1.useCallback)(() => {
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: 'lincle-interactive-graph', onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onTouchEnd: handleTouchEnd, onTouchStart: handleTouchStart, role: 'none', children: (0, jsx_runtime_1.jsx)("div", { className: 'lincle-interactive-transform', style: style, children: children }) }));
|
|
188
|
+
}, [
|
|
189
|
+
children,
|
|
190
|
+
handleMouseDown,
|
|
191
|
+
handleMouseUp,
|
|
192
|
+
handleTouchEnd,
|
|
193
|
+
handleTouchStart,
|
|
194
|
+
style
|
|
195
|
+
]);
|
|
196
|
+
return ((0, jsx_runtime_1.jsx)(react_map_interaction_1.MapInteraction, { defaultScale: scale, defaultTranslation: defaultTranslation, disablePan: !pan, disableZoom: !zoom, maxScale: maxScale, minScale: minScale, onChange: handleChange, value: transform, children: child }));
|
|
190
197
|
};
|
|
191
|
-
exports.Interaction = Interaction;
|
|
192
198
|
Interaction.displayName = 'LincleInteractiveInteraction';
|
|
199
|
+
exports.default = Interaction;
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.Nodes = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const base_1 = require("../../base");
|
|
20
|
+
const Interaction_1 = __importDefault(require("./Interaction"));
|
|
21
|
+
const Nodes = (_a) => {
|
|
22
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(Interaction_1.default, { children: (0, jsx_runtime_1.jsx)(base_1.Nodes, Object.assign({}, props, { children: children })) }));
|
|
24
|
+
};
|
|
25
|
+
exports.Nodes = Nodes;
|
|
26
|
+
Nodes.displayName = 'LincleInteractiveNodes';
|
package/dist/components/index.js
CHANGED
|
@@ -17,6 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Edge"), exports);
|
|
18
18
|
__exportStar(require("./Edges"), exports);
|
|
19
19
|
__exportStar(require("./Graph"), exports);
|
|
20
|
-
__exportStar(require("./Interaction"), exports);
|
|
21
20
|
__exportStar(require("./Node"), exports);
|
|
22
21
|
__exportStar(require("./Nodes"), exports);
|
package/dist/shared.d.ts
CHANGED
|
@@ -40,5 +40,5 @@ export type MoveNodeProps = Omit<NodeProps, 'onDrag' | 'onSelect'> & SharedMoveN
|
|
|
40
40
|
readonly onDrag?: (event: DraggableEvent, data: DraggableData, position: Position) => void;
|
|
41
41
|
};
|
|
42
42
|
export type GraphProps = Omit<InteractiveGraphProps, 'onNodeDrag' | 'onNodeSelect' | 'onNodeStart' | 'onNodeStop'> & InteractionProps & GraphNodeControlProps;
|
|
43
|
-
export { type DraggableData, type EdgeNodeProps, type EdgesProps, type GridProps, type ModeType, type Position, Providers, useConnections, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useMaxScale, useMinScale, useMode, useModeGiven, useMove, useNodePositions, useOnMode, useOnNodeDrag, useOnNodeEdgeDrop, useOnNodeSelect, useOnNodeStart, useOnNodeStop, useOnScale, useOnTranslate, usePan, usePull, useScale, useSetConnection, useSnap, useTranslate, useZoom } from '@lincle/react-interactive-shared';
|
|
43
|
+
export { type ConnectionsProps, type DraggableData, type EdgeNodeProps, type EdgesProps, type GridProps, type ModeType, type NodesProps, type Position, Providers, useConnections, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useMaxScale, useMinScale, useMode, useModeGiven, useMove, useNodePositions, useOnMode, useOnNodeDrag, useOnNodeEdgeDrop, useOnNodeSelect, useOnNodeStart, useOnNodeStop, useOnScale, useOnTranslate, usePan, usePull, useScale, useSetConnection, useSnap, useTranslate, useZoom } from '@lincle/react-interactive-shared';
|
|
44
44
|
export { Graph as GraphBase } from '@lincle/react-web-base';
|
package/dist/styles.g.css
CHANGED
|
@@ -1,116 +1,3 @@
|
|
|
1
|
-
/* edge */
|
|
2
|
-
|
|
3
|
-
.lincle-base-edges {
|
|
4
|
-
position: absolute;
|
|
5
|
-
z-index: -1;
|
|
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
|
-
backface-visibility: hidden;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.lincle-base-edges > :not(path) {
|
|
16
|
-
cursor: unset;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.lincle-base-edge-marker-arrow {
|
|
20
|
-
fill: black;
|
|
21
|
-
pointer-events: none;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.lincle-base-edge-marker-circle {
|
|
25
|
-
fill: black;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* grid */
|
|
29
|
-
|
|
30
|
-
.lincle-base-grid {
|
|
31
|
-
position: absolute;
|
|
32
|
-
width: 100%;
|
|
33
|
-
height: 100%;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* node */
|
|
37
|
-
|
|
38
|
-
.lincle-base-node {
|
|
39
|
-
position: absolute;
|
|
40
|
-
transform-origin: 0 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* path */
|
|
44
|
-
|
|
45
|
-
.lincle-base-edge-path {
|
|
46
|
-
stroke: black;
|
|
47
|
-
pointer-events: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.lincle-base-edge-path:hover {
|
|
51
|
-
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
52
|
-
stroke-dasharray: 5 5;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.lincle-base-edge-dash-all .lincle-base-edge-path {
|
|
56
|
-
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
57
|
-
stroke-dasharray: 5 5;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.lincle-base-edge-dash-none .lincle-base-edge-path {
|
|
61
|
-
animation: none;
|
|
62
|
-
stroke-dasharray: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.lincle-base-edge-dash-on {
|
|
66
|
-
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
67
|
-
stroke-dasharray: 5 5;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.lincle-base-edge-dash-off.lincle-base-edge-path:hover {
|
|
71
|
-
animation: none;
|
|
72
|
-
stroke-dasharray: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.lincle-base-edge-path-border {
|
|
76
|
-
stroke-width: 8px;
|
|
77
|
-
stroke-linecap: square;
|
|
78
|
-
stroke: black;
|
|
79
|
-
opacity: 0;
|
|
80
|
-
pointer-events: all;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.lincle-interactive-drag + svg > path {
|
|
84
|
-
animation: lincle-interactive-dash 20s linear reverse infinite;
|
|
85
|
-
stroke-dasharray: 5 5;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.lincle-base-edge-path-border:hover + path {
|
|
89
|
-
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
90
|
-
stroke-dasharray: 5 5;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.lincle-base-edge-path-border:hover + .lincle-base-edge-path {
|
|
94
|
-
animation: lincle-base-edgedash 1.5s linear reverse infinite;
|
|
95
|
-
stroke-dasharray: 5 5;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.lincle-base-edge-path-border:hover + .lincle-base-edge-dash-off.lincle-base-edge-path {
|
|
99
|
-
animation: none;
|
|
100
|
-
stroke-dasharray: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.lincle-base-edge-dash-none .lincle-base-edge-path-border:hover + .lincle-base-edge-path {
|
|
104
|
-
animation: none;
|
|
105
|
-
stroke-dasharray: none;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
@keyframes lincle-base-edgedash {
|
|
109
|
-
to {
|
|
110
|
-
stroke-dashoffset: 30;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
1
|
/* Interaction */
|
|
115
2
|
|
|
116
3
|
.lincle-interactive-graph {
|
|
@@ -135,11 +22,6 @@
|
|
|
135
22
|
|
|
136
23
|
/* Pull */
|
|
137
24
|
|
|
138
|
-
.lincle-interactive-connection {
|
|
139
|
-
position: absolute;
|
|
140
|
-
overflow: visible;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
25
|
.lincle-interactive-drag {
|
|
144
26
|
position: absolute;
|
|
145
27
|
z-index: 1;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-web-interactive",
|
|
3
3
|
"title": "lincle react web interactive",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "0.4.0-next.
|
|
5
|
+
"version": "0.4.0-next.4",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A 'reactive' React node and edge generator",
|
|
8
8
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@digest/stylelint-config": "^4.4.3",
|
|
54
54
|
"@digest/typescript": "^4.4.3",
|
|
55
55
|
"@types/jest": "^29.5.12",
|
|
56
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^22.0.0",
|
|
57
57
|
"@types/react": "^18.3.3",
|
|
58
58
|
"@types/react-dom": "^18.3.0",
|
|
59
59
|
"@types/react-test-renderer": "^18.3.0",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"rimraf": "^6.0.1"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@lincle/react-interactive-shared": "^0.4.0-next.
|
|
72
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
73
|
-
"@lincle/react-web-base": "^0.4.0-next.
|
|
71
|
+
"@lincle/react-interactive-shared": "^0.4.0-next.4",
|
|
72
|
+
"@lincle/react-shared": "^0.4.0-next.4",
|
|
73
|
+
"@lincle/react-web-base": "^0.4.0-next.4",
|
|
74
74
|
"react-draggable": "^4.4.6",
|
|
75
75
|
"react-map-interaction": "^2.1.0"
|
|
76
76
|
},
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"dragndrop",
|
|
98
98
|
"drag"
|
|
99
99
|
],
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "6bbaaf166913673c8990505ea8de66a0587ce372"
|
|
101
101
|
}
|