@lincle/react-interactive-shared 0.0.1 → 0.4.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +165 -0
- package/dist/Contexts/ConnectContext.d.ts +3 -0
- package/dist/Contexts/ConnectContext.js +7 -0
- package/dist/Contexts/ModeContext.d.ts +7 -0
- package/dist/Contexts/ModeContext.js +16 -0
- package/dist/Contexts/NodeContext.d.ts +9 -0
- package/dist/Contexts/NodeContext.js +7 -0
- package/dist/Contexts/ScaleContext.d.ts +6 -0
- package/dist/Contexts/ScaleContext.js +14 -0
- package/dist/Contexts/SnapContext.d.ts +4 -0
- package/dist/Contexts/SnapContext.js +12 -0
- package/dist/Contexts/TransformContext.d.ts +8 -0
- package/dist/Contexts/TransformContext.js +12 -0
- package/dist/Contexts/TranslateContext.d.ts +8 -0
- package/dist/Contexts/TranslateContext.js +12 -0
- package/dist/Contexts/index.d.ts +7 -0
- package/dist/Contexts/index.js +23 -0
- package/dist/Hooks/index.d.ts +23 -0
- package/dist/Hooks/index.js +39 -0
- package/dist/Hooks/useConnection.d.ts +2 -0
- package/dist/Hooks/useConnection.js +10 -0
- package/dist/Hooks/useConnections.d.ts +2 -0
- package/dist/Hooks/useConnections.js +10 -0
- package/dist/Hooks/useMaxScale.d.ts +2 -0
- package/dist/Hooks/useMaxScale.js +10 -0
- package/dist/Hooks/useMinScale.d.ts +2 -0
- package/dist/Hooks/useMinScale.js +10 -0
- package/dist/Hooks/useMode.d.ts +2 -0
- package/dist/Hooks/useMode.js +10 -0
- package/dist/Hooks/useModeGiven.d.ts +2 -0
- package/dist/Hooks/useModeGiven.js +10 -0
- package/dist/Hooks/useMove.d.ts +2 -0
- package/dist/Hooks/useMove.js +10 -0
- package/dist/Hooks/useOnMode.d.ts +2 -0
- package/dist/Hooks/useOnMode.js +10 -0
- package/dist/Hooks/useOnNodeDrag.d.ts +2 -0
- package/dist/Hooks/useOnNodeDrag.js +10 -0
- package/dist/Hooks/useOnNodeEdgeDrop.d.ts +2 -0
- package/dist/Hooks/useOnNodeEdgeDrop.js +10 -0
- package/dist/Hooks/useOnNodeSelect.d.ts +2 -0
- package/dist/Hooks/useOnNodeSelect.js +10 -0
- package/dist/Hooks/useOnNodeStart.d.ts +2 -0
- package/dist/Hooks/useOnNodeStart.js +10 -0
- package/dist/Hooks/useOnNodeStop.d.ts +2 -0
- package/dist/Hooks/useOnNodeStop.js +10 -0
- package/dist/Hooks/useOnScale.d.ts +2 -0
- package/dist/Hooks/useOnScale.js +10 -0
- package/dist/Hooks/useOnTranslate.d.ts +2 -0
- package/dist/Hooks/useOnTranslate.js +10 -0
- package/dist/Hooks/useOnTranslateThrottle.d.ts +2 -0
- package/dist/Hooks/useOnTranslateThrottle.js +50 -0
- package/dist/Hooks/usePan.d.ts +2 -0
- package/dist/Hooks/usePan.js +10 -0
- package/dist/Hooks/usePull.d.ts +2 -0
- package/dist/Hooks/usePull.js +10 -0
- package/dist/Hooks/useScale.d.ts +2 -0
- package/dist/Hooks/useScale.js +10 -0
- package/dist/Hooks/useSetConnection.d.ts +3 -0
- package/dist/Hooks/useSetConnection.js +17 -0
- package/dist/Hooks/useSnap.d.ts +2 -0
- package/dist/Hooks/useSnap.js +10 -0
- package/dist/Hooks/useTranslate.d.ts +2 -0
- package/dist/Hooks/useTranslate.js +10 -0
- package/dist/Hooks/useZoom.d.ts +2 -0
- package/dist/Hooks/useZoom.js +10 -0
- package/dist/Providers/ConnectProvider.d.ts +4 -0
- package/dist/Providers/ConnectProvider.js +44 -0
- package/dist/Providers/ModeProvider.d.ts +5 -0
- package/dist/Providers/ModeProvider.js +34 -0
- package/dist/Providers/NodeProvider.d.ts +5 -0
- package/dist/Providers/NodeProvider.js +35 -0
- package/dist/Providers/Providers.d.ts +7 -0
- package/dist/Providers/Providers.js +23 -0
- package/dist/Providers/ScaleProvider.d.ts +5 -0
- package/dist/Providers/ScaleProvider.js +34 -0
- package/dist/Providers/SnapProvider.d.ts +7 -0
- package/dist/Providers/SnapProvider.js +30 -0
- package/dist/Providers/TransformProvider.d.ts +5 -0
- package/dist/Providers/TransformProvider.js +22 -0
- package/dist/Providers/TranslateProvider.d.ts +5 -0
- package/dist/Providers/TranslateProvider.js +43 -0
- package/dist/Providers/index.d.ts +5 -0
- package/dist/Providers/index.js +14 -0
- package/dist/defaultSettings.d.ts +32 -0
- package/dist/defaultSettings.js +19 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/shared.d.ts +1 -0
- package/dist/shared.js +8 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +8 -0
- package/package.json +25 -26
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type ProvidersProps } from './Providers';
|
|
2
|
+
import { type EdgeNodeProps, type EdgeProps, type GraphProps as BaseGraphProps, type GridProps as BaseGridProps, type GridType, type Line, type NodeProps as BaseNodeProps } from '@lincle/react-shared';
|
|
3
|
+
import { type Dispatch, type PropsWithChildren, type ReactElement, type SetStateAction } from 'react';
|
|
4
|
+
export type Connection = {
|
|
5
|
+
line: Line;
|
|
6
|
+
source: EdgeNodeProps;
|
|
7
|
+
target: EdgeNodeProps;
|
|
8
|
+
};
|
|
9
|
+
export type Connections = {
|
|
10
|
+
[key: string]: Connection;
|
|
11
|
+
};
|
|
12
|
+
export type ConnectContextProps = {
|
|
13
|
+
connections?: Connections;
|
|
14
|
+
setConnection?: (sourceId: string, connection?: Connection) => void;
|
|
15
|
+
setConnections?: Dispatch<SetStateAction<Connections>>;
|
|
16
|
+
};
|
|
17
|
+
export type ConnectionsProps = PropsWithChildren<{
|
|
18
|
+
readonly scale: number;
|
|
19
|
+
readonly translate: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
export type ModeType = 'move' | 'pull' | 'select';
|
|
25
|
+
export type Mode = {
|
|
26
|
+
mode?: ModeType;
|
|
27
|
+
move: boolean;
|
|
28
|
+
pull: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type EdgeControlProps = {
|
|
31
|
+
onEdgeDrop?: (sourceId: number | string, targetId?: number | string) => void;
|
|
32
|
+
};
|
|
33
|
+
export type Translate = {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
export type DraggableData = {
|
|
38
|
+
deltaX: number;
|
|
39
|
+
deltaY: number;
|
|
40
|
+
lastX: number;
|
|
41
|
+
lastY: number;
|
|
42
|
+
node?: Element;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
};
|
|
46
|
+
export type NodeProps = Omit<BaseNodeProps, 'ref'> & Partial<Mode> & Pick<EdgeProps, 'line'> & {
|
|
47
|
+
move?: boolean;
|
|
48
|
+
pull?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export type MoveNodeProps = {
|
|
51
|
+
readonly disabled: boolean;
|
|
52
|
+
readonly mode?: ModeType;
|
|
53
|
+
readonly onSelect?: (nodeId: number | string) => void;
|
|
54
|
+
readonly snap?: GridType | false;
|
|
55
|
+
};
|
|
56
|
+
export type PullNodeProps = {
|
|
57
|
+
readonly disabled?: boolean;
|
|
58
|
+
readonly sourceId: number | string;
|
|
59
|
+
};
|
|
60
|
+
export type Position = {
|
|
61
|
+
x?: number;
|
|
62
|
+
y?: number;
|
|
63
|
+
};
|
|
64
|
+
export type PullProps = {
|
|
65
|
+
diagramId: number | string;
|
|
66
|
+
path?: (id: number | string, source: EdgeNodeProps, target: EdgeNodeProps) => ReactElement;
|
|
67
|
+
};
|
|
68
|
+
export type GridProps = Pick<BaseGridProps, 'children'>;
|
|
69
|
+
export type GraphProps = BaseGraphProps & ProvidersProps;
|
|
70
|
+
export { type EdgeNodeProps, type EdgeProps, type EdgesProps, type GridType, type Line, type NodesProps, type PathProps, type Shape, useDefaultLine, useDefaultNodeHeight, useDefaultNodeWidth, useDefaultShape } from '@lincle/react-shared';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDefaultShape = exports.useDefaultNodeWidth = exports.useDefaultNodeHeight = exports.useDefaultLine = void 0;
|
|
4
|
+
var react_shared_1 = require("@lincle/react-shared");
|
|
5
|
+
Object.defineProperty(exports, "useDefaultLine", { enumerable: true, get: function () { return react_shared_1.useDefaultLine; } });
|
|
6
|
+
Object.defineProperty(exports, "useDefaultNodeHeight", { enumerable: true, get: function () { return react_shared_1.useDefaultNodeHeight; } });
|
|
7
|
+
Object.defineProperty(exports, "useDefaultNodeWidth", { enumerable: true, get: function () { return react_shared_1.useDefaultNodeWidth; } });
|
|
8
|
+
Object.defineProperty(exports, "useDefaultShape", { enumerable: true, get: function () { return react_shared_1.useDefaultShape; } });
|
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"name": "@lincle/react-interactive-shared",
|
|
3
3
|
"title": "lincle react interactive shared",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.4.0-next.10",
|
|
6
|
+
"private": false,
|
|
6
7
|
"description": "Shared interactive libraries for @lincle",
|
|
7
8
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
8
9
|
"contributors": [
|
|
@@ -19,13 +20,13 @@
|
|
|
19
20
|
"COPYING.md",
|
|
20
21
|
"COPYING.LESSER.md"
|
|
21
22
|
],
|
|
22
|
-
"homepage": "https://gitlab.com/
|
|
23
|
+
"homepage": "https://gitlab.com/digested/lincle/tree/master/packages/react-interactive-shared/",
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
|
-
"url": "https://gitlab.com/
|
|
26
|
+
"url": "https://gitlab.com/digested/lincle.git"
|
|
26
27
|
},
|
|
27
28
|
"bugs": {
|
|
28
|
-
"url": "https://gitlab.com/
|
|
29
|
+
"url": "https://gitlab.com/digested/lincle/issues"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"build": "run-s clean:dist build:prod",
|
|
@@ -42,33 +43,30 @@
|
|
|
42
43
|
"clean:dist": "rimraf dist"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@digest/eslint-config-jest": "^4.
|
|
46
|
-
"@digest/eslint-config-react": "^4.
|
|
47
|
-
"@digest/eslint-config-typescript": "^4.
|
|
48
|
-
"@digest/jest-junit": "^4.
|
|
49
|
-
"@digest/jest-react": "^4.
|
|
50
|
-
"@digest/jest-typescript": "^4.
|
|
51
|
-
"@digest/typescript": "^4.
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/lodash.throttle": "^4.1.
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/react": "^18.
|
|
58
|
-
"@types/react-dom": "^18.2.7",
|
|
59
|
-
"@types/react-test-renderer": "^18.0.1",
|
|
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",
|
|
53
|
+
"@types/jest": "^29.5.12",
|
|
54
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
55
|
+
"@types/lodash.throttle": "^4.1.9",
|
|
56
|
+
"@types/node": "^22.1.0",
|
|
57
|
+
"@types/react": "^18.3.3",
|
|
58
|
+
"@types/react-test-renderer": "^18.3.0",
|
|
60
59
|
"cross-env": "^7.0.3",
|
|
61
|
-
"jest-environment-jsdom": "^29.
|
|
60
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
62
61
|
"jest-environment-jsdom-global": "^4.0.0",
|
|
63
62
|
"ncp": "^2.0.0",
|
|
64
63
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"react": "^18.
|
|
66
|
-
"react-test-renderer": "^18.
|
|
67
|
-
"rimraf": "^
|
|
64
|
+
"react": "^18.3.1",
|
|
65
|
+
"react-test-renderer": "^18.3.1",
|
|
66
|
+
"rimraf": "^6.0.1"
|
|
68
67
|
},
|
|
69
68
|
"dependencies": {
|
|
70
|
-
"@lincle/react-shared": "^0.0.
|
|
71
|
-
"lodash.debounce": "^4.0.8",
|
|
69
|
+
"@lincle/react-shared": "^0.4.0-next.10",
|
|
72
70
|
"lodash.throttle": "^4.1.1"
|
|
73
71
|
},
|
|
74
72
|
"peerDependencies": {
|
|
@@ -86,5 +84,6 @@
|
|
|
86
84
|
"dag",
|
|
87
85
|
"acyclical graph",
|
|
88
86
|
"cyclical graph"
|
|
89
|
-
]
|
|
87
|
+
],
|
|
88
|
+
"gitHead": "c672cbc4ddbc1944133ea10ac26a4c04e7d8e3ba"
|
|
90
89
|
}
|