@lincle/react-native-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 -8
- package/dist/components/Edges/Connections/index.js +1 -8
- package/dist/components/Edges/index.js +10 -2
- package/dist/components/{Interaction → Nodes/Interaction}/index.d.ts +2 -2
- package/dist/components/{Interaction → Nodes/Interaction}/index.js +5 -34
- package/dist/components/Nodes/index.d.ts +3 -1
- package/dist/components/Nodes/index.js +18 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/shared.d.ts +1 -1
- package/package.json +7 -7
|
@@ -1,10 +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<{
|
|
5
|
-
readonly scale: number;
|
|
6
|
-
readonly translate: {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
};
|
|
10
|
-
}>;
|
|
@@ -6,15 +6,8 @@ import { StyleSheet } from 'react-native';
|
|
|
6
6
|
import { Defs, Svg } from 'react-native-svg';
|
|
7
7
|
const { svgStyle } = StyleSheet.create({
|
|
8
8
|
svgStyle: {
|
|
9
|
-
bottom: 0,
|
|
10
|
-
height: '100%',
|
|
11
|
-
left: 0,
|
|
12
9
|
overflow: 'visible',
|
|
13
|
-
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
right: 0,
|
|
16
|
-
top: 0,
|
|
17
|
-
width: '100%'
|
|
10
|
+
position: 'absolute'
|
|
18
11
|
}
|
|
19
12
|
});
|
|
20
13
|
const Connections = ({ scale = 1, translate = {
|
|
@@ -9,15 +9,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx,
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Edges as BaseEdges } from '../../base';
|
|
14
14
|
import { useScale, useTranslate } from '../../shared';
|
|
15
15
|
import Connections from './Connections';
|
|
16
|
+
import { StyleSheet, View } from 'react-native';
|
|
17
|
+
const { edgesStyle } = StyleSheet.create({
|
|
18
|
+
edgesStyle: {
|
|
19
|
+
height: '100%',
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: '100%'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
16
24
|
const Edges = (_a) => {
|
|
17
25
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
18
26
|
const scale = useScale();
|
|
19
27
|
const translate = useTranslate();
|
|
20
|
-
return (_jsxs(
|
|
28
|
+
return (_jsxs(View, { style: edgesStyle, children: [_jsx(BaseEdges, Object.assign({ scale: scale, translate: translate }, props, { children: children })), _jsx(Connections, { scale: scale, translate: translate })] }));
|
|
21
29
|
};
|
|
22
30
|
Edges.displayName = 'LincleInteractiveEdges';
|
|
23
31
|
export { Edges };
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { useMode, useOnMode, useOnScale, useOnTranslateThrottle, useScale, useTranslate } from '
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMode, useOnMode, useOnScale, useOnTranslateThrottle, useScale, useTranslate } from '../../../shared';
|
|
3
3
|
import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
|
|
4
|
-
import {
|
|
4
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
5
5
|
import { StyleSheet, View } from 'react-native';
|
|
6
6
|
const CLICK_TIME = 500;
|
|
7
7
|
const useDoubleTap = () => {
|
|
@@ -33,11 +33,6 @@ const styles = StyleSheet.create({
|
|
|
33
33
|
height: '100%',
|
|
34
34
|
overflow: 'visible'
|
|
35
35
|
},
|
|
36
|
-
content: {
|
|
37
|
-
height: '100%',
|
|
38
|
-
position: 'absolute',
|
|
39
|
-
width: '100%'
|
|
40
|
-
},
|
|
41
36
|
zoomable: {
|
|
42
37
|
overflow: 'visible'
|
|
43
38
|
}
|
|
@@ -66,30 +61,6 @@ const Interaction = ({ children, onPointerUp }) => {
|
|
|
66
61
|
onScale,
|
|
67
62
|
onTranslateThrottle
|
|
68
63
|
]);
|
|
69
|
-
const { edges, nodes } = useMemo(() => {
|
|
70
|
-
const filteredChildren = Children.toArray(children).filter((child) => {
|
|
71
|
-
var _a;
|
|
72
|
-
const name = (_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.displayName;
|
|
73
|
-
return name === 'LincleInteractiveNodes' ||
|
|
74
|
-
'LincleInteractiveEdges';
|
|
75
|
-
});
|
|
76
|
-
const filteredNodes = filteredChildren.filter((child) => {
|
|
77
|
-
var _a;
|
|
78
|
-
const name = (_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.displayName;
|
|
79
|
-
return name === 'LincleInteractiveNodes';
|
|
80
|
-
});
|
|
81
|
-
const filteredEdges = filteredChildren.filter((child) => {
|
|
82
|
-
var _a;
|
|
83
|
-
const name = (_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.displayName;
|
|
84
|
-
return name === 'LincleInteractiveEdges';
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
edges: filteredEdges,
|
|
88
|
-
nodes: filteredNodes
|
|
89
|
-
};
|
|
90
|
-
}, [
|
|
91
|
-
children
|
|
92
|
-
]);
|
|
93
64
|
const handleTapEnd = useCallback(() => {
|
|
94
65
|
if (onMode) {
|
|
95
66
|
switch (graphMode) {
|
|
@@ -128,7 +99,7 @@ const Interaction = ({ children, onPointerUp }) => {
|
|
|
128
99
|
handleTapEnd,
|
|
129
100
|
onPointerUp
|
|
130
101
|
]);
|
|
131
|
-
return (
|
|
102
|
+
return (_jsx(View, { style: styles.container, children: _jsx(ReactNativeZoomableView, { bindToBorders: false, doubleTapDelay: 1, doubleTapZoomToCenter: false, initialOffsetX: translate.x, initialOffsetY: translate.y, initialZoom: scale, maxZoom: 1.5, minZoom: 0.5, movementSensibility: 1, onSingleTap: handlePointerUp, onTransform: handleOnTransform, onZoomAfter: handleZoom, panEnabled: true, style: styles.zoomable, visualTouchFeedbackEnabled: false, zoomStep: 0.5, children: children }) }));
|
|
132
103
|
};
|
|
133
104
|
Interaction.displayName = 'LincleInteractiveInteraction';
|
|
134
|
-
export
|
|
105
|
+
export default Interaction;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Nodes as BaseNodes } from '../../base';
|
|
14
|
+
import Interaction from './Interaction';
|
|
15
|
+
const Nodes = (_a) => {
|
|
16
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
17
|
+
return (_jsx(Interaction, { children: _jsx(BaseNodes, Object.assign({}, props, { children: children })) }));
|
|
18
|
+
};
|
|
2
19
|
Nodes.displayName = 'LincleInteractiveNodes';
|
|
3
20
|
export { Nodes };
|
package/dist/components/index.js
CHANGED
package/dist/shared.d.ts
CHANGED
|
@@ -41,5 +41,5 @@ export type MoveNodeProps = Omit<NodeProps, 'onDrag' | 'onSelect'> & SharedMoveN
|
|
|
41
41
|
readonly onDrag?: (event: GestureResponderEvent, data: DraggableData, position: Position) => void;
|
|
42
42
|
};
|
|
43
43
|
export type GraphProps = Omit<InteractiveGraphProps, 'onNodeDrag' | 'onNodeSelect' | 'onNodeStart' | 'onNodeStop'> & GraphNodeControlProps;
|
|
44
|
-
export { type Connection, type Connections, type EdgeNodeProps, type GridProps, type ModeType, type Position, Providers, useConnection, useConnections, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useMode, useModeGiven, useMove, useNodePositions, useOnMode, useOnNodeDrag, useOnNodeEdgeDrop, useOnNodeSelect, useOnNodeStart, useOnNodeStop, useOnScale, useOnTranslateThrottle, usePull, useScale, useSetConnection, useSnap, useTranslate } from '@lincle/react-interactive-shared';
|
|
44
|
+
export { type Connection, type Connections, type ConnectionsProps, type EdgeNodeProps, type GridProps, type ModeType, type Position, Providers, useConnection, useConnections, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape, useDiagramId, useMode, useModeGiven, useMove, useNodePositions, useOnMode, useOnNodeDrag, useOnNodeEdgeDrop, useOnNodeSelect, useOnNodeStart, useOnNodeStop, useOnScale, useOnTranslateThrottle, usePull, useScale, useSetConnection, useSnap, useTranslate } from '@lincle/react-interactive-shared';
|
|
45
45
|
export { Graph as GraphBase, Marker, useUpdateEdge } from '@lincle/react-native-base';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-native-interactive",
|
|
3
3
|
"title": "lincle react native 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)",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@digest/typescript": "^4.4.3",
|
|
53
53
|
"@openspacelabs/react-native-zoomable-view": "^2.1.6",
|
|
54
54
|
"@types/jest": "^29.5.12",
|
|
55
|
-
"@types/node": "^
|
|
55
|
+
"@types/node": "^22.0.0",
|
|
56
56
|
"@types/react": "^18.3.3",
|
|
57
57
|
"@types/react-native": "^0.73.0",
|
|
58
58
|
"@types/react-test-renderer": "^18.3.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"ncp": "^2.0.0",
|
|
63
63
|
"npm-run-all": "^4.1.5",
|
|
64
64
|
"react": "^18.3.1",
|
|
65
|
-
"react-native": "^0.74.
|
|
65
|
+
"react-native": "^0.74.4",
|
|
66
66
|
"react-native-draggable": "^3.3.0",
|
|
67
67
|
"react-native-reanimated": "^3.14.0",
|
|
68
68
|
"react-native-svg": "^15.4.0",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"rimraf": "^6.0.1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@lincle/react-interactive-shared": "^0.4.0-next.
|
|
74
|
-
"@lincle/react-native-base": "^0.4.0-next.
|
|
75
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
73
|
+
"@lincle/react-interactive-shared": "^0.4.0-next.4",
|
|
74
|
+
"@lincle/react-native-base": "^0.4.0-next.4",
|
|
75
|
+
"@lincle/react-shared": "^0.4.0-next.4"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@openspacelabs/react-native-zoomable-view": "^2.1.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"dragndrop",
|
|
102
102
|
"drag"
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "6bbaaf166913673c8990505ea8de66a0587ce372"
|
|
105
105
|
}
|