caplink-saas-ui-shared-component-library 0.5.3 → 0.5.5
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 +78 -78
- package/dist/components/dag/hooks/use-dag.d.ts +2 -56
- package/dist/components/dag/model/dag-types.d.ts +116 -0
- package/dist/components/dag/model/index.d.ts +4 -0
- package/dist/components/dag/ui/dag.d.ts +2 -7
- package/dist/components/dag/ui/defaults/default-edge.d.ts +2 -2
- package/dist/components/dag/ui/defaults/default-node.d.ts +1 -7
- package/dist/components/dag/ui/defaults/index.d.ts +1 -2
- package/dist/components/dag/ui/float-menu/default-float-buttons/button-change-orientation.d.ts +4 -2
- package/dist/components/dag/ui/index.d.ts +1 -2
- package/dist/components/dag/utils/get-layout-elements.d.ts +3 -2
- package/dist/index.d.ts +49 -61
- package/dist/index.es.js +16406 -16405
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +82 -82
- package/dist/index.umd.js.map +1 -1
- package/package.json +91 -91
package/README.md
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
# caplink-saas-ui-shared-component-library
|
|
2
|
-
|
|
3
|
-
This project is a shared component library for the Caplink SaaS UI. It is built using React and Storybook.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
1. Clone the repository
|
|
8
|
-
2. Run `npm install` to install the dependencies
|
|
9
|
-
3. Run `npm run storybook` to start the Storybook server
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
To use the components in your project, you can install the package from npm:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @caplink/saas-ui-shared-component-library
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Then import the components you need:
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
import { Button } from '@caplink/saas-ui-shared-component-library';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Development
|
|
26
|
-
|
|
27
|
-
### Components
|
|
28
|
-
|
|
29
|
-
All the components are located in the 'component-library' folder. Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
30
|
-
|
|
31
|
-
An expected component development workflow would be:
|
|
32
|
-
|
|
33
|
-
1. Create a new folder for the component
|
|
34
|
-
2. Create the component file (e.g. MyComponent.js)
|
|
35
|
-
3. Create a story file (e.g. MyComponent.stories.js)
|
|
36
|
-
4. Create a test file (e.g. MyComponent.spec.js)
|
|
37
|
-
5. Create a style file (e.g. MyComponent.css) (if needed, we use tailwindcss for styles)
|
|
38
|
-
6. If it's a complex component, create a Cypress test file (e.g. MyComponent.spec.js in the 'cypress' folder)
|
|
39
|
-
|
|
40
|
-
### Folder structure
|
|
41
|
-
|
|
42
|
-
- All the components are located in the '/component-library' folder.
|
|
43
|
-
- Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
44
|
-
- Cypress tests are located in the 'cypress' folder and should follow the same folder structure as the components.
|
|
45
|
-
|
|
46
|
-
### Storybook
|
|
47
|
-
|
|
48
|
-
We use Storybook to develop and test the components. To start the Storybook server, run:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm run sb:dev
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm run sb:build
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
This will start the Storybook server and open a browser window with the Storybook UI. You can use this to develop and test the components.
|
|
59
|
-
|
|
60
|
-
This is the gallery of components that we use to develop and test the components. It's also used to generate the documentation for the components, so it's important to keep it up to date and encompassing relevant states and use cases within the stories.
|
|
61
|
-
|
|
62
|
-
## Testing
|
|
63
|
-
|
|
64
|
-
We use multiple testing libraries to test our components. We use Jest for unit tests and Cypress for more complex integration tests that require a browser.
|
|
65
|
-
|
|
66
|
-
- All unit tests are located in the same folder as the component they are testing. The file name should be the same as the component file name, but with a '.spec.xxx' suffix.
|
|
67
|
-
- All Cypress tests are located in the 'cypress' folder.
|
|
68
|
-
|
|
69
|
-
## Contributing
|
|
70
|
-
|
|
71
|
-
This is a project for the Caplink SaaS UI team. If you are a member of the team, you can contribute to this project by following the standard Git workflow:
|
|
72
|
-
|
|
73
|
-
1. Create a new branch for your feature or bug fix
|
|
74
|
-
2. Make your changes
|
|
75
|
-
3. Push your branch to the remote repository
|
|
76
|
-
4. Create a pull request
|
|
77
|
-
|
|
78
|
-
Developing components with tests is a requirement for contributing to this project.
|
|
1
|
+
# caplink-saas-ui-shared-component-library
|
|
2
|
+
|
|
3
|
+
This project is a shared component library for the Caplink SaaS UI. It is built using React and Storybook.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Clone the repository
|
|
8
|
+
2. Run `npm install` to install the dependencies
|
|
9
|
+
3. Run `npm run storybook` to start the Storybook server
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
To use the components in your project, you can install the package from npm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @caplink/saas-ui-shared-component-library
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then import the components you need:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { Button } from '@caplink/saas-ui-shared-component-library';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
### Components
|
|
28
|
+
|
|
29
|
+
All the components are located in the 'component-library' folder. Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
30
|
+
|
|
31
|
+
An expected component development workflow would be:
|
|
32
|
+
|
|
33
|
+
1. Create a new folder for the component
|
|
34
|
+
2. Create the component file (e.g. MyComponent.js)
|
|
35
|
+
3. Create a story file (e.g. MyComponent.stories.js)
|
|
36
|
+
4. Create a test file (e.g. MyComponent.spec.js)
|
|
37
|
+
5. Create a style file (e.g. MyComponent.css) (if needed, we use tailwindcss for styles)
|
|
38
|
+
6. If it's a complex component, create a Cypress test file (e.g. MyComponent.spec.js in the 'cypress' folder)
|
|
39
|
+
|
|
40
|
+
### Folder structure
|
|
41
|
+
|
|
42
|
+
- All the components are located in the '/component-library' folder.
|
|
43
|
+
- Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
44
|
+
- Cypress tests are located in the 'cypress' folder and should follow the same folder structure as the components.
|
|
45
|
+
|
|
46
|
+
### Storybook
|
|
47
|
+
|
|
48
|
+
We use Storybook to develop and test the components. To start the Storybook server, run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run sb:dev
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run sb:build
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This will start the Storybook server and open a browser window with the Storybook UI. You can use this to develop and test the components.
|
|
59
|
+
|
|
60
|
+
This is the gallery of components that we use to develop and test the components. It's also used to generate the documentation for the components, so it's important to keep it up to date and encompassing relevant states and use cases within the stories.
|
|
61
|
+
|
|
62
|
+
## Testing
|
|
63
|
+
|
|
64
|
+
We use multiple testing libraries to test our components. We use Jest for unit tests and Cypress for more complex integration tests that require a browser.
|
|
65
|
+
|
|
66
|
+
- All unit tests are located in the same folder as the component they are testing. The file name should be the same as the component file name, but with a '.spec.xxx' suffix.
|
|
67
|
+
- All Cypress tests are located in the 'cypress' folder.
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
This is a project for the Caplink SaaS UI team. If you are a member of the team, you can contribute to this project by following the standard Git workflow:
|
|
72
|
+
|
|
73
|
+
1. Create a new branch for your feature or bug fix
|
|
74
|
+
2. Make your changes
|
|
75
|
+
3. Push your branch to the remote repository
|
|
76
|
+
4. Create a pull request
|
|
77
|
+
|
|
78
|
+
Developing components with tests is a requirement for contributing to this project.
|
|
@@ -1,57 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UseDagProps } from '../model';
|
|
2
2
|
|
|
3
|
-
export declare const useDag: () =>
|
|
4
|
-
getEdges: () => Edge[];
|
|
5
|
-
getNodes: () => Node[];
|
|
6
|
-
getNode: (id: string) => Node | undefined;
|
|
7
|
-
getEdge: (id: string) => Edge | undefined;
|
|
8
|
-
zoomIn: import('@xyflow/system').ZoomInOut;
|
|
9
|
-
zoomOut: import('@xyflow/system').ZoomInOut;
|
|
10
|
-
fitView: import('@xyflow/react').FitView;
|
|
11
|
-
addEdges: (payload: Edge | Edge[]) => void;
|
|
12
|
-
addNodes: (payload: Node | Node[]) => void;
|
|
13
|
-
deleteNodes: (node: Node | Node[]) => void;
|
|
14
|
-
deleteEdges: (edge: Edge | Edge[]) => void;
|
|
15
|
-
getNodeEdges: (nodeId: string) => Edge[];
|
|
16
|
-
changeOrientation: (direction: 'vertical' | 'horizontal') => {
|
|
17
|
-
nodes: {
|
|
18
|
-
targetPosition: import('@xyflow/react').Position;
|
|
19
|
-
sourcePosition: import('@xyflow/react').Position;
|
|
20
|
-
position: {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
};
|
|
24
|
-
id: string;
|
|
25
|
-
data: Record<string, unknown>;
|
|
26
|
-
type?: string | undefined;
|
|
27
|
-
hidden?: boolean | undefined;
|
|
28
|
-
selected?: boolean | undefined;
|
|
29
|
-
dragging?: boolean | undefined;
|
|
30
|
-
draggable?: boolean | undefined;
|
|
31
|
-
selectable?: boolean | undefined;
|
|
32
|
-
connectable?: boolean | undefined;
|
|
33
|
-
deletable?: boolean | undefined;
|
|
34
|
-
dragHandle?: string | undefined;
|
|
35
|
-
width?: number | undefined;
|
|
36
|
-
height?: number | undefined;
|
|
37
|
-
initialWidth?: number | undefined;
|
|
38
|
-
initialHeight?: number | undefined;
|
|
39
|
-
parentId?: string | undefined;
|
|
40
|
-
zIndex?: number | undefined;
|
|
41
|
-
extent?: "parent" | import('@xyflow/react').CoordinateExtent | undefined;
|
|
42
|
-
expandParent?: boolean | undefined;
|
|
43
|
-
ariaLabel?: string | undefined;
|
|
44
|
-
origin?: import('@xyflow/react').NodeOrigin | undefined;
|
|
45
|
-
handles?: import('@xyflow/system').NodeHandle[] | undefined;
|
|
46
|
-
measured?: {
|
|
47
|
-
width?: number | undefined;
|
|
48
|
-
height?: number | undefined;
|
|
49
|
-
} | undefined;
|
|
50
|
-
style?: import('react').CSSProperties | undefined;
|
|
51
|
-
className?: string | undefined;
|
|
52
|
-
resizing?: boolean | undefined;
|
|
53
|
-
focusable?: boolean | undefined;
|
|
54
|
-
}[];
|
|
55
|
-
edges: Edge[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
3
|
+
export declare const useDag: () => UseDagProps;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ComponentType, CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
export type Node<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
4
|
+
id: string;
|
|
5
|
+
data: T;
|
|
6
|
+
type?: string;
|
|
7
|
+
position: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
targetPosition?: Position;
|
|
12
|
+
sourcePosition?: Position;
|
|
13
|
+
dragging?: boolean;
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
export type NodeProps<T extends Node = Node> = Pick<T, 'id' | 'data' | 'sourcePosition' | 'targetPosition' | 'selected'> & Required<Pick<T, 'type' | 'dragging' | 'zIndex'>> & {
|
|
20
|
+
isConnectable: boolean;
|
|
21
|
+
positionAbsoluteX: number;
|
|
22
|
+
positionAbsoluteY: number;
|
|
23
|
+
};
|
|
24
|
+
export type DefaultNodeDataProps = {
|
|
25
|
+
content: React.ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
hideHandles?: boolean;
|
|
28
|
+
targetHandleClassName?: string;
|
|
29
|
+
sourceHandleClassName?: string;
|
|
30
|
+
} & Record<string, unknown>;
|
|
31
|
+
export type Edge<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
32
|
+
id: string;
|
|
33
|
+
animated?: boolean;
|
|
34
|
+
data?: T;
|
|
35
|
+
type?: string;
|
|
36
|
+
style?: React.CSSProperties;
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
selectable?: boolean;
|
|
39
|
+
source: string;
|
|
40
|
+
target: string;
|
|
41
|
+
deletable?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export type EdgePosition = {
|
|
44
|
+
sourceX: number;
|
|
45
|
+
sourceY: number;
|
|
46
|
+
targetX: number;
|
|
47
|
+
targetY: number;
|
|
48
|
+
sourcePosition: Position;
|
|
49
|
+
targetPosition: Position;
|
|
50
|
+
};
|
|
51
|
+
export type EdgeProps<T extends Edge = Edge> = Pick<T, 'id' | 'animated' | 'data' | 'style' | 'selected' | 'source' | 'target' | 'selectable' | 'deletable'> & EdgePosition & {
|
|
52
|
+
markerEnd?: string;
|
|
53
|
+
};
|
|
54
|
+
export type DefaultEdgeProps = {
|
|
55
|
+
edgePath?: 'simpleBezier' | 'smoothStep';
|
|
56
|
+
} & Record<string, unknown>;
|
|
57
|
+
export declare enum Position {
|
|
58
|
+
Left = "left",
|
|
59
|
+
Top = "top",
|
|
60
|
+
Right = "right",
|
|
61
|
+
Bottom = "bottom"
|
|
62
|
+
}
|
|
63
|
+
export type Connection = {
|
|
64
|
+
source: string;
|
|
65
|
+
sourceHandle: string | null;
|
|
66
|
+
target: string;
|
|
67
|
+
targetHandle: string | null;
|
|
68
|
+
};
|
|
69
|
+
type NodeTypes = Record<string, ComponentType<NodeProps & {
|
|
70
|
+
data: unknown;
|
|
71
|
+
type: unknown;
|
|
72
|
+
}>>;
|
|
73
|
+
type EdgeTypes = Record<string, ComponentType<EdgeProps & {
|
|
74
|
+
data: unknown;
|
|
75
|
+
type: unknown;
|
|
76
|
+
}>>;
|
|
77
|
+
export type DagProps = PropsWithChildren<{
|
|
78
|
+
isLoading?: boolean;
|
|
79
|
+
initialNodes?: Node[];
|
|
80
|
+
initialEdges?: Edge[];
|
|
81
|
+
nodeTypes?: NodeTypes;
|
|
82
|
+
edgeTypes?: EdgeTypes;
|
|
83
|
+
onNodeClick?: (event: React.MouseEvent, node: Node) => void;
|
|
84
|
+
onNodeDragStop?: (event: React.MouseEvent, node: Node) => void;
|
|
85
|
+
onNodeDragStart?: (event: React.MouseEvent, node: Node) => void;
|
|
86
|
+
onConnect?: (connection: Connection) => void;
|
|
87
|
+
}>;
|
|
88
|
+
export type UseDagProps = {
|
|
89
|
+
getEdges: () => Edge[];
|
|
90
|
+
getNodes: () => Node[];
|
|
91
|
+
getNode: (nodeId: string) => Node | undefined;
|
|
92
|
+
getEdge: (edgeId: string) => Edge | undefined;
|
|
93
|
+
zoomIn: () => void;
|
|
94
|
+
zoomOut: () => void;
|
|
95
|
+
fitView: (props: {
|
|
96
|
+
duration?: number;
|
|
97
|
+
maxZoom?: number;
|
|
98
|
+
minZoom?: number;
|
|
99
|
+
nodes?: Node[];
|
|
100
|
+
padding?: number;
|
|
101
|
+
}) => void;
|
|
102
|
+
addEdges: (edges: Edge[]) => void;
|
|
103
|
+
addNodes: (nodes: Node[]) => void;
|
|
104
|
+
deleteNodes: (node: Node | Node[]) => void;
|
|
105
|
+
deleteEdges: (edge: Edge | Edge[]) => void;
|
|
106
|
+
getNodeEdges: (nodeId: string) => Edge[];
|
|
107
|
+
changeOrientation: (props: {
|
|
108
|
+
direction: 'vertical' | 'horizontal';
|
|
109
|
+
nodeHeight?: number;
|
|
110
|
+
nodeWidth?: number;
|
|
111
|
+
}) => {
|
|
112
|
+
nodes: Node[];
|
|
113
|
+
edges: Edge[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Position, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps } from './dag-types';
|
|
2
|
+
|
|
3
|
+
export { Position };
|
|
4
|
+
export type { Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps };
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DagProps } from '../model';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
initialNodes: ReactFlowProps['nodes'];
|
|
5
|
-
initialEdges: ReactFlowProps['edges'];
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare function Dag(props: DagProps & Omit<ReactFlowProps, 'nodes' | 'edges'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Dag(props: DagProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EdgeProps } from '
|
|
1
|
+
import { DefaultEdgeProps, Edge, EdgeProps } from '../../model/dag-types';
|
|
2
2
|
|
|
3
|
-
export declare function DefaultEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, }: EdgeProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DefaultEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, data, }: EdgeProps<Edge<DefaultEdgeProps>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { Node, NodeProps } from '
|
|
1
|
+
import { DefaultNodeDataProps, Node, NodeProps } from '../../model';
|
|
2
2
|
|
|
3
|
-
export type DefaultNodeDataProps = {
|
|
4
|
-
content: React.ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
targetHandleClassName?: string;
|
|
7
|
-
sourceHandleClassName?: string;
|
|
8
|
-
} & Record<string, unknown>;
|
|
9
3
|
export declare function DefaultNode({ id, selected, data, sourcePosition, targetPosition, }: NodeProps<Node<DefaultNodeDataProps>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DefaultEdge } from './default-edge';
|
|
2
|
-
import { DefaultNode
|
|
2
|
+
import { DefaultNode } from './default-node';
|
|
3
3
|
import { SkeletonNode } from './skeleton-node';
|
|
4
4
|
|
|
5
5
|
export { DefaultNode, DefaultEdge, SkeletonNode };
|
|
6
|
-
export type { DefaultNodeDataProps };
|
package/dist/components/dag/ui/float-menu/default-float-buttons/button-change-orientation.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Edge, Node } from '
|
|
1
|
+
import { Edge, Node } from '../../../model';
|
|
2
2
|
|
|
3
3
|
export type ButtonChangeOrientationProps = {
|
|
4
4
|
orientation: 'vertical' | 'horizontal';
|
|
@@ -7,5 +7,7 @@ export type ButtonChangeOrientationProps = {
|
|
|
7
7
|
edges: Edge[];
|
|
8
8
|
}) => void;
|
|
9
9
|
shouldFitView?: boolean;
|
|
10
|
+
nodeHeight?: number;
|
|
11
|
+
nodeWidth?: number;
|
|
10
12
|
};
|
|
11
|
-
export declare const ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, nodeHeight, nodeWidth, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Edge, Node, Position } from '@xyflow/react';
|
|
2
2
|
|
|
3
|
-
interface GetLayoutedElementsProps {
|
|
3
|
+
export interface GetLayoutedElementsProps {
|
|
4
4
|
nodes: Node[];
|
|
5
5
|
edges: Edge[];
|
|
6
6
|
direction?: 'vertical' | 'horizontal';
|
|
7
|
+
nodeWidth?: number;
|
|
8
|
+
nodeHeight?: number;
|
|
7
9
|
}
|
|
8
10
|
export declare const getLayoutedElements: (props: GetLayoutedElementsProps) => {
|
|
9
11
|
nodes: {
|
|
@@ -46,4 +48,3 @@ export declare const getLayoutedElements: (props: GetLayoutedElementsProps) => {
|
|
|
46
48
|
}[];
|
|
47
49
|
edges: Edge[];
|
|
48
50
|
};
|
|
49
|
-
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Connection, Edge, Node, Position } from '@xyflow/react';
|
|
2
1
|
import { FileUploader, FileUploaderProps } from './components/file-uploader/ui';
|
|
3
2
|
import { ImageUploader, ImageUploaderProps } from './components/image-uploader/ui';
|
|
4
3
|
import { Spreadsheet } from './components/spreadsheet/ui';
|
|
5
4
|
import { useGetAdjacentNodesProps } from './components/dag/hooks';
|
|
6
|
-
import { Dag, DagContainer
|
|
5
|
+
import { Dag, DagContainer } from './components/dag/ui';
|
|
7
6
|
import { AdjacentNodes, AdjacentNodesProps } from './components/dag/ui/adjacent-nodes';
|
|
8
|
-
import { DefaultEdge, DefaultNode,
|
|
7
|
+
import { DefaultEdge, DefaultNode, SkeletonNode } from './components/dag/ui/defaults';
|
|
9
8
|
import { FloatMenu, FloatMenuButton, FloatMenuButtonGroup, FloatMenuProps } from './components/dag/ui/float-menu';
|
|
10
9
|
import { ButtonChangeOrientationProps } from './components/dag/ui/float-menu/default-float-buttons';
|
|
11
10
|
import { SearchNode, SearchNodeProps } from './components/dag/ui/search-node';
|
|
@@ -14,6 +13,8 @@ import { EmptySearchIcon } from './shared/ui/empty-search-icon';
|
|
|
14
13
|
import { FloatButton, FloatButtonProps } from './shared/ui/float-button';
|
|
15
14
|
import { IconButtonProps } from './shared/ui/icon-button';
|
|
16
15
|
import { MatrixTypes, SpreadsheetTypes } from './types';
|
|
16
|
+
import { Position, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps } from './components/dag/model';
|
|
17
|
+
import { GetLayoutedElementsProps } from './components/dag/utils/get-layout-elements';
|
|
17
18
|
|
|
18
19
|
export declare const CapLink: {
|
|
19
20
|
Spreadsheet: typeof Spreadsheet;
|
|
@@ -37,64 +38,10 @@ export declare const CapLink: {
|
|
|
37
38
|
Sidebar: typeof Sidebar;
|
|
38
39
|
SidebarHeader: typeof SidebarHeader;
|
|
39
40
|
Position: typeof Position;
|
|
40
|
-
useDag: () =>
|
|
41
|
-
|
|
42
|
-
getNodes: () => Node[];
|
|
43
|
-
getNode: (id: string) => Node | undefined;
|
|
44
|
-
getEdge: (id: string) => Edge | undefined;
|
|
45
|
-
zoomIn: import('@xyflow/system').ZoomInOut;
|
|
46
|
-
zoomOut: import('@xyflow/system').ZoomInOut;
|
|
47
|
-
fitView: import('@xyflow/react').FitView;
|
|
48
|
-
addEdges: (payload: Edge | Edge[]) => void;
|
|
49
|
-
addNodes: (payload: Node | Node[]) => void;
|
|
50
|
-
deleteNodes: (node: Node | Node[]) => void;
|
|
51
|
-
deleteEdges: (edge: Edge | Edge[]) => void;
|
|
52
|
-
getNodeEdges: (nodeId: string) => Edge[];
|
|
53
|
-
changeOrientation: (direction: "horizontal" | "vertical") => {
|
|
54
|
-
nodes: {
|
|
55
|
-
targetPosition: Position;
|
|
56
|
-
sourcePosition: Position;
|
|
57
|
-
position: {
|
|
58
|
-
x: number;
|
|
59
|
-
y: number;
|
|
60
|
-
};
|
|
61
|
-
id: string;
|
|
62
|
-
data: Record<string, unknown>;
|
|
63
|
-
type?: string | undefined;
|
|
64
|
-
hidden?: boolean | undefined;
|
|
65
|
-
selected?: boolean | undefined;
|
|
66
|
-
dragging?: boolean | undefined;
|
|
67
|
-
draggable?: boolean | undefined;
|
|
68
|
-
selectable?: boolean | undefined;
|
|
69
|
-
connectable?: boolean | undefined;
|
|
70
|
-
deletable?: boolean | undefined;
|
|
71
|
-
dragHandle?: string | undefined;
|
|
72
|
-
width?: number | undefined;
|
|
73
|
-
height?: number | undefined;
|
|
74
|
-
initialWidth?: number | undefined;
|
|
75
|
-
initialHeight?: number | undefined;
|
|
76
|
-
parentId?: string | undefined;
|
|
77
|
-
zIndex?: number | undefined;
|
|
78
|
-
extent?: "parent" | import('@xyflow/react').CoordinateExtent | undefined;
|
|
79
|
-
expandParent?: boolean | undefined;
|
|
80
|
-
ariaLabel?: string | undefined;
|
|
81
|
-
origin?: import('@xyflow/react').NodeOrigin | undefined;
|
|
82
|
-
handles?: import('@xyflow/system').NodeHandle[] | undefined;
|
|
83
|
-
measured?: {
|
|
84
|
-
width?: number | undefined;
|
|
85
|
-
height?: number | undefined;
|
|
86
|
-
} | undefined;
|
|
87
|
-
style?: import('react').CSSProperties | undefined;
|
|
88
|
-
className?: string | undefined;
|
|
89
|
-
resizing?: boolean | undefined;
|
|
90
|
-
focusable?: boolean | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
edges: Edge[];
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => Node[];
|
|
41
|
+
useDag: () => UseDagProps;
|
|
42
|
+
useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => import('@xyflow/react').Node[];
|
|
96
43
|
AdjacentNodes: typeof AdjacentNodes;
|
|
97
|
-
ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, nodeHeight, nodeWidth, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
|
|
98
45
|
ButtonZoomIn: () => import("react/jsx-runtime").JSX.Element;
|
|
99
46
|
ButtonZoomOut: () => import("react/jsx-runtime").JSX.Element;
|
|
100
47
|
FloatMenu: typeof FloatMenu;
|
|
@@ -154,5 +101,46 @@ export declare const CapLink: {
|
|
|
154
101
|
}[];
|
|
155
102
|
}>;
|
|
156
103
|
};
|
|
104
|
+
getLayoutedElements: (props: GetLayoutedElementsProps) => {
|
|
105
|
+
nodes: {
|
|
106
|
+
targetPosition: import('@xyflow/system').Position;
|
|
107
|
+
sourcePosition: import('@xyflow/system').Position;
|
|
108
|
+
position: {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
};
|
|
112
|
+
id: string;
|
|
113
|
+
data: Record<string, unknown>;
|
|
114
|
+
type?: string | undefined;
|
|
115
|
+
hidden?: boolean | undefined;
|
|
116
|
+
selected?: boolean | undefined;
|
|
117
|
+
dragging?: boolean | undefined;
|
|
118
|
+
draggable?: boolean | undefined;
|
|
119
|
+
selectable?: boolean | undefined;
|
|
120
|
+
connectable?: boolean | undefined;
|
|
121
|
+
deletable?: boolean | undefined;
|
|
122
|
+
dragHandle?: string | undefined;
|
|
123
|
+
width?: number | undefined;
|
|
124
|
+
height?: number | undefined;
|
|
125
|
+
initialWidth?: number | undefined;
|
|
126
|
+
initialHeight?: number | undefined;
|
|
127
|
+
parentId?: string | undefined;
|
|
128
|
+
zIndex?: number | undefined;
|
|
129
|
+
extent?: "parent" | import('@xyflow/system').CoordinateExtent | undefined;
|
|
130
|
+
expandParent?: boolean | undefined;
|
|
131
|
+
ariaLabel?: string | undefined;
|
|
132
|
+
origin?: import('@xyflow/system').NodeOrigin | undefined;
|
|
133
|
+
handles?: import('@xyflow/system').NodeHandle[] | undefined;
|
|
134
|
+
measured?: {
|
|
135
|
+
width?: number | undefined;
|
|
136
|
+
height?: number | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
style?: import('react').CSSProperties | undefined;
|
|
139
|
+
className?: string | undefined;
|
|
140
|
+
resizing?: boolean | undefined;
|
|
141
|
+
focusable?: boolean | undefined;
|
|
142
|
+
}[];
|
|
143
|
+
edges: import('@xyflow/react').Edge[];
|
|
144
|
+
};
|
|
157
145
|
};
|
|
158
|
-
export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes,
|
|
146
|
+
export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes, SearchNodeProps, IconButtonProps, FloatButtonProps, ContentSplitProps, SidebarProps, useGetAdjacentNodesProps, AdjacentNodesProps, ButtonChangeOrientationProps, FloatMenuProps, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps, Position, GetLayoutedElementsProps };
|