@lincle/react-interactive-shared 0.4.0-next.12 → 0.4.0-next.13

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.
@@ -2,7 +2,7 @@ declare const NodeContext: import("react").Context<NodeContextProps>;
2
2
  export { NodeContext };
3
3
  export type NodeContextProps = {
4
4
  onNodeDrag?: (event: any, nodeId: number | string, data: any) => void;
5
- onNodeEdgeDrop?: (event: any, sourceId: string | number, targetId?: string | number) => void;
5
+ onNodeEdgeDrop?: (event: any, sourceId: number | string, targetId?: number | string) => void;
6
6
  onNodeSelect?: (nodeId: number | string) => void;
7
7
  onNodeStart?: (event: any, nodeId: number | string) => void;
8
8
  onNodeStop?: (event: any, nodeId: number | string, data: any) => void;
@@ -1,4 +1,4 @@
1
1
  import { type GridType } from '../types';
2
2
  declare const SnapContext: import("react").Context<SnapContextProps>;
3
3
  export { SnapContext };
4
- export type SnapContextProps = GridType | false;
4
+ export type SnapContextProps = false | GridType;
@@ -1,2 +1,2 @@
1
- declare const useOnNodeEdgeDrop: () => ((event: any, sourceId: string | number, targetId?: string | number) => void) | undefined;
1
+ declare const useOnNodeEdgeDrop: () => ((event: any, sourceId: number | string, targetId?: number | string) => void) | undefined;
2
2
  export { useOnNodeEdgeDrop };
@@ -1,4 +1,4 @@
1
1
  import { type FunctionComponent, type PropsWithChildren } from 'react';
2
2
  declare const ConnectProvider: FunctionComponent<ConnectProviderProps>;
3
3
  export { ConnectProvider };
4
- export type ConnectProviderProps = PropsWithChildren<{}>;
4
+ export type ConnectProviderProps = PropsWithChildren<object>;
@@ -10,12 +10,12 @@ const SnapProvider = ({ children, snap }) => {
10
10
  const grid = (_a = (0, react_shared_1.useGrid)()) !== null && _a !== void 0 ? _a : false;
11
11
  const derivedSnap = (0, react_1.useMemo)(() => {
12
12
  switch (snap) {
13
- case undefined: {
14
- return grid;
15
- }
16
13
  case false: {
17
14
  return false;
18
15
  }
16
+ case undefined: {
17
+ return grid;
18
+ }
19
19
  default: {
20
20
  return snap;
21
21
  }
@@ -2,4 +2,4 @@ import { type ConnectProviderProps, type ModeProviderProps, type NodeProviderPro
2
2
  import { type FunctionComponent } from 'react';
3
3
  declare const Providers: FunctionComponent<ProvidersProps>;
4
4
  export { Providers };
5
- export type ProvidersProps = Partial<ModeProviderProps & NodeProviderProps & ScaleProviderProps & SnapProviderProps & TransformProviderProps & TranslateProviderProps & ConnectProviderProps>;
5
+ export type ProvidersProps = Partial<ConnectProviderProps & ModeProviderProps & NodeProviderProps & ScaleProviderProps & SnapProviderProps & TransformProviderProps & TranslateProviderProps>;
package/dist/types.d.ts CHANGED
@@ -1,6 +1,11 @@
1
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';
2
+ import { type GraphProps as BaseGraphProps, type GridProps as BaseGridProps, type NodeProps as BaseNodeProps, type EdgeNodeProps, type EdgeProps, type GridType, type Line } from '@lincle/react-shared';
3
3
  import { type Dispatch, type PropsWithChildren, type ReactElement, type SetStateAction } from 'react';
4
+ export type ConnectContextProps = {
5
+ connections?: Connections;
6
+ setConnection?: (sourceId: string, connection?: Connection) => void;
7
+ setConnections?: Dispatch<SetStateAction<Connections>>;
8
+ };
4
9
  export type Connection = {
5
10
  line: Line;
6
11
  source: EdgeNodeProps;
@@ -9,11 +14,6 @@ export type Connection = {
9
14
  export type Connections = {
10
15
  [key: string]: Connection;
11
16
  };
12
- export type ConnectContextProps = {
13
- connections?: Connections;
14
- setConnection?: (sourceId: string, connection?: Connection) => void;
15
- setConnections?: Dispatch<SetStateAction<Connections>>;
16
- };
17
17
  export type ConnectionsProps = PropsWithChildren<{
18
18
  readonly scale: number;
19
19
  readonly translate: {
@@ -21,19 +21,6 @@ export type ConnectionsProps = PropsWithChildren<{
21
21
  y: number;
22
22
  };
23
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
24
  export type DraggableData = {
38
25
  deltaX: number;
39
26
  deltaY: number;
@@ -43,28 +30,41 @@ export type DraggableData = {
43
30
  x: number;
44
31
  y: number;
45
32
  };
46
- export type NodeProps = Omit<BaseNodeProps, 'ref'> & Partial<Mode> & Pick<EdgeProps, 'line'> & {
47
- move?: boolean;
48
- pull?: boolean;
33
+ export type EdgeControlProps = {
34
+ onEdgeDrop?: (sourceId: number | string, targetId?: number | string) => void;
49
35
  };
36
+ export type GraphProps = BaseGraphProps & ProvidersProps;
37
+ export type GridProps = Pick<BaseGridProps, 'children'>;
38
+ export type Mode = {
39
+ mode?: ModeType;
40
+ move: boolean;
41
+ pull: boolean;
42
+ };
43
+ export type ModeType = 'move' | 'pull' | 'select';
50
44
  export type MoveNodeProps = {
51
45
  readonly disabled: boolean;
52
46
  readonly mode?: ModeType;
53
47
  readonly onSelect?: (nodeId: number | string) => void;
54
- readonly snap?: GridType | false;
48
+ readonly snap?: false | GridType;
55
49
  };
56
- export type PullNodeProps = {
57
- readonly disabled?: boolean;
58
- readonly sourceId: number | string;
50
+ export type NodeProps = Omit<BaseNodeProps, 'ref'> & Partial<Mode> & Pick<EdgeProps, 'line'> & {
51
+ move?: boolean;
52
+ pull?: boolean;
59
53
  };
60
54
  export type Position = {
61
55
  x?: number;
62
56
  y?: number;
63
57
  };
58
+ export type PullNodeProps = {
59
+ readonly disabled?: boolean;
60
+ readonly sourceId: number | string;
61
+ };
64
62
  export type PullProps = {
65
63
  diagramId: number | string;
66
64
  path?: (id: number | string, source: EdgeNodeProps, target: EdgeNodeProps) => ReactElement;
67
65
  };
68
- export type GridProps = Pick<BaseGridProps, 'children'>;
69
- export type GraphProps = BaseGraphProps & ProvidersProps;
66
+ export type Translate = {
67
+ x: number;
68
+ y: number;
69
+ };
70
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/package.json CHANGED
@@ -1,89 +1,89 @@
1
1
  {
2
- "name": "@lincle/react-interactive-shared",
3
- "title": "lincle react interactive shared",
4
- "license": "LGPL-3.0-or-later",
5
- "version": "0.4.0-next.12",
6
- "private": false,
7
- "description": "Shared interactive libraries for @lincle",
8
- "author": "wallzero @wallzeroblog (http://wallzero.com)",
9
- "contributors": [
10
- {
11
- "name": "Connor Schlesiger",
12
- "email": "connor@schlesiger.ca",
13
- "position": "Initial and Lead Developer"
14
- }
15
- ],
16
- "main": "dist/index.js",
17
- "types": "dist/index.d.ts",
18
- "files": [
19
- "dist/",
20
- "COPYING.md",
21
- "COPYING.LESSER.md"
22
- ],
23
- "homepage": "https://gitlab.com/digested/lincle/tree/master/packages/react-interactive-shared/",
24
- "repository": {
25
- "type": "git",
26
- "url": "https://gitlab.com/digested/lincle.git"
27
- },
28
- "bugs": {
29
- "url": "https://gitlab.com/digested/lincle/issues"
30
- },
31
- "scripts": {
32
- "build": "run-s clean:dist build:prod",
33
- "build:prod": "tsc -p ./tsconfig.json",
34
- "build:watch": "run-s clean:dist build:prod build:watch:tsc",
35
- "build:watch:tsc": "tsc -p ./tsconfig.json --watch --pretty --preserveWatchOutput",
36
- "----------------------------------------------------------------": "",
37
- "build:prod:config": "",
38
- "---------------------------------------------------------------": "",
39
- "lint": "run-p lint:es",
40
- "lint:es": "eslint --resolve-plugins-relative-to . 'src/**/*.[jt]s?(x)' --ignore-pattern 'src/**/*.(d.ts|json)'",
41
- "clean": "run-s clean:dist clean:node_modules",
42
- "clean:node_modules": "rimraf node_modules yarn.lock package-lock.json",
43
- "clean:dist": "rimraf dist"
44
- },
45
- "devDependencies": {
46
- "@digest/eslint-config-jest": "^4.8.2",
47
- "@digest/eslint-config-react": "^4.8.2",
48
- "@digest/eslint-config-typescript": "^4.8.2",
49
- "@digest/jest-junit": "^4.8.2",
50
- "@digest/jest-react": "^4.8.2",
51
- "@digest/jest-typescript": "^4.8.2",
52
- "@digest/typescript": "^4.8.2",
53
- "@types/jest": "^29.5.13",
54
- "@types/lodash.debounce": "^4.0.9",
55
- "@types/lodash.throttle": "^4.1.9",
56
- "@types/node": "^22.7.4",
57
- "@types/react": "^18.3.10",
58
- "@types/react-test-renderer": "^18.3.0",
59
- "cross-env": "^7.0.3",
60
- "jest-environment-jsdom": "^29.7.0",
61
- "jest-environment-jsdom-global": "^4.0.0",
62
- "ncp": "^2.0.0",
63
- "npm-run-all": "^4.1.5",
64
- "react": "^18.3.1",
65
- "react-test-renderer": "^18.3.1",
66
- "rimraf": "^6.0.1"
67
- },
68
- "dependencies": {
69
- "@lincle/react-shared": "^0.4.0-next.12",
70
- "lodash.throttle": "^4.1.1"
71
- },
72
- "peerDependencies": {
73
- "react": "^16.0.0 || ^17.0.0 || ^18.0.0"
74
- },
75
- "keywords": [
76
- "library",
77
- "lincle",
78
- "typescript",
79
- "react",
80
- "reactjs",
81
- "reactive",
82
- "graph",
83
- "diagram",
84
- "dag",
85
- "acyclical graph",
86
- "cyclical graph"
87
- ],
88
- "gitHead": "0ecf2d35d39436bfdde9359aa18dae9e1b60794c"
2
+ "name": "@lincle/react-interactive-shared",
3
+ "title": "lincle react interactive shared",
4
+ "license": "LGPL-3.0-or-later",
5
+ "version": "0.4.0-next.13",
6
+ "private": false,
7
+ "description": "Shared interactive libraries for @lincle",
8
+ "author": "wallzero @wallzeroblog (http://wallzero.com)",
9
+ "contributors": [
10
+ {
11
+ "name": "Connor Schlesiger",
12
+ "email": "connor@schlesiger.ca",
13
+ "position": "Initial and Lead Developer"
14
+ }
15
+ ],
16
+ "main": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "files": [
19
+ "dist/",
20
+ "COPYING.md",
21
+ "COPYING.LESSER.md"
22
+ ],
23
+ "homepage": "https://gitlab.com/digested/lincle/tree/master/packages/react-interactive-shared/",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://gitlab.com/digested/lincle.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://gitlab.com/digested/lincle/issues"
30
+ },
31
+ "scripts": {
32
+ "build": "run-s clean:dist build:prod",
33
+ "build:prod": "tsc -p ./tsconfig.json",
34
+ "build:watch": "run-s clean:dist build:prod build:watch:tsc",
35
+ "build:watch:tsc": "tsc -p ./tsconfig.json --watch --pretty --preserveWatchOutput",
36
+ "----------------------------------------------------------------": "",
37
+ "build:prod:config": "",
38
+ "---------------------------------------------------------------": "",
39
+ "lint": "run-p lint:es",
40
+ "lint:es": "eslint",
41
+ "clean": "run-s clean:dist clean:node_modules",
42
+ "clean:node_modules": "rimraf node_modules yarn.lock package-lock.json",
43
+ "clean:dist": "rimraf dist"
44
+ },
45
+ "devDependencies": {
46
+ "@digest/eslint-config-jest": "^4.13.0",
47
+ "@digest/eslint-config-react": "^4.13.0",
48
+ "@digest/eslint-config-typescript": "^4.13.0",
49
+ "@digest/jest-junit": "^4.13.0",
50
+ "@digest/jest-react": "^4.13.0",
51
+ "@digest/jest-typescript": "^4.13.0",
52
+ "@digest/typescript": "^4.13.0",
53
+ "@types/jest": "^29.5.14",
54
+ "@types/lodash.debounce": "^4.0.9",
55
+ "@types/lodash.throttle": "^4.1.9",
56
+ "@types/node": "^22.10.1",
57
+ "@types/react": "^18.3.12",
58
+ "@types/react-test-renderer": "^18.3.0",
59
+ "cross-env": "^7.0.3",
60
+ "jest-environment-jsdom": "^29.7.0",
61
+ "jest-environment-jsdom-global": "^4.0.0",
62
+ "ncp": "^2.0.0",
63
+ "npm-run-all": "^4.1.5",
64
+ "react": "^18.3.1",
65
+ "react-test-renderer": "^18.3.1",
66
+ "rimraf": "^6.0.1"
67
+ },
68
+ "dependencies": {
69
+ "@lincle/react-shared": "^0.4.0-next.13",
70
+ "lodash.throttle": "^4.1.1"
71
+ },
72
+ "peerDependencies": {
73
+ "react": "^18.0.0"
74
+ },
75
+ "keywords": [
76
+ "library",
77
+ "lincle",
78
+ "typescript",
79
+ "react",
80
+ "reactjs",
81
+ "reactive",
82
+ "graph",
83
+ "diagram",
84
+ "dag",
85
+ "acyclical graph",
86
+ "cyclical graph"
87
+ ],
88
+ "gitHead": "84d45ca98dd0d6589c697cc7457a897fa777340f"
89
89
  }