caplink-saas-ui-shared-component-library 0.5.3 → 0.5.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/dag/hooks/use-dag.d.ts +2 -56
- package/dist/components/dag/model/dag-types.d.ts +108 -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 +1 -1
- 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 +1 -1
- package/dist/components/dag/ui/index.d.ts +1 -2
- package/dist/index.d.ts +6 -60
- package/dist/index.es.js +16260 -16271
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +81 -81
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,108 @@
|
|
|
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
|
+
targetHandleClassName?: string;
|
|
28
|
+
sourceHandleClassName?: string;
|
|
29
|
+
} & Record<string, unknown>;
|
|
30
|
+
export type Edge<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
31
|
+
id: string;
|
|
32
|
+
animated?: boolean;
|
|
33
|
+
data?: T;
|
|
34
|
+
type?: string;
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
selected?: boolean;
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
source: string;
|
|
39
|
+
target: string;
|
|
40
|
+
deletable?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type EdgePosition = {
|
|
43
|
+
sourceX: number;
|
|
44
|
+
sourceY: number;
|
|
45
|
+
targetX: number;
|
|
46
|
+
targetY: number;
|
|
47
|
+
sourcePosition: Position;
|
|
48
|
+
targetPosition: Position;
|
|
49
|
+
};
|
|
50
|
+
export type EdgeProps<T extends Edge = Edge> = Pick<T, 'id' | 'animated' | 'data' | 'style' | 'selected' | 'source' | 'target' | 'selectable' | 'deletable'> & EdgePosition & {
|
|
51
|
+
markerEnd?: string;
|
|
52
|
+
};
|
|
53
|
+
export declare enum Position {
|
|
54
|
+
Left = "left",
|
|
55
|
+
Top = "top",
|
|
56
|
+
Right = "right",
|
|
57
|
+
Bottom = "bottom"
|
|
58
|
+
}
|
|
59
|
+
export type Connection = {
|
|
60
|
+
source: string;
|
|
61
|
+
sourceHandle: string | null;
|
|
62
|
+
target: string;
|
|
63
|
+
targetHandle: string | null;
|
|
64
|
+
};
|
|
65
|
+
type NodeTypes = Record<string, ComponentType<NodeProps & {
|
|
66
|
+
data: unknown;
|
|
67
|
+
type: unknown;
|
|
68
|
+
}>>;
|
|
69
|
+
type EdgeTypes = Record<string, ComponentType<EdgeProps & {
|
|
70
|
+
data: unknown;
|
|
71
|
+
type: unknown;
|
|
72
|
+
}>>;
|
|
73
|
+
export type DagProps = PropsWithChildren<{
|
|
74
|
+
isLoading?: boolean;
|
|
75
|
+
initialNodes?: Node[];
|
|
76
|
+
initialEdges?: Edge[];
|
|
77
|
+
nodeTypes?: NodeTypes;
|
|
78
|
+
edgeTypes?: EdgeTypes;
|
|
79
|
+
onNodeClick?: (event: React.MouseEvent, node: Node) => void;
|
|
80
|
+
onNodeDragStop?: (event: React.MouseEvent, node: Node) => void;
|
|
81
|
+
onNodeDragStart?: (event: React.MouseEvent, node: Node) => void;
|
|
82
|
+
onConnect?: (connection: Connection) => void;
|
|
83
|
+
}>;
|
|
84
|
+
export type UseDagProps = {
|
|
85
|
+
getEdges: () => Edge[];
|
|
86
|
+
getNodes: () => Node[];
|
|
87
|
+
getNode: (nodeId: string) => Node | undefined;
|
|
88
|
+
getEdge: (edgeId: string) => Edge | undefined;
|
|
89
|
+
zoomIn: () => void;
|
|
90
|
+
zoomOut: () => void;
|
|
91
|
+
fitView: (props: {
|
|
92
|
+
duration?: number;
|
|
93
|
+
maxZoom?: number;
|
|
94
|
+
minZoom?: number;
|
|
95
|
+
nodes?: Node[];
|
|
96
|
+
padding?: number;
|
|
97
|
+
}) => void;
|
|
98
|
+
addEdges: (edges: Edge[]) => void;
|
|
99
|
+
addNodes: (nodes: Node[]) => void;
|
|
100
|
+
deleteNodes: (node: Node | Node[]) => void;
|
|
101
|
+
deleteEdges: (edge: Edge | Edge[]) => void;
|
|
102
|
+
getNodeEdges: (nodeId: string) => Edge[];
|
|
103
|
+
changeOrientation: (direction: 'vertical' | 'horizontal') => {
|
|
104
|
+
nodes: Node[];
|
|
105
|
+
edges: Edge[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
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 { EdgeProps } from '../../model';
|
|
2
2
|
|
|
3
3
|
export declare function DefaultEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, }: EdgeProps): 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/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,7 @@ 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
17
|
|
|
18
18
|
export declare const CapLink: {
|
|
19
19
|
Spreadsheet: typeof Spreadsheet;
|
|
@@ -37,62 +37,8 @@ export declare const CapLink: {
|
|
|
37
37
|
Sidebar: typeof Sidebar;
|
|
38
38
|
SidebarHeader: typeof SidebarHeader;
|
|
39
39
|
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[];
|
|
40
|
+
useDag: () => UseDagProps;
|
|
41
|
+
useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => import('@xyflow/react').Node[];
|
|
96
42
|
AdjacentNodes: typeof AdjacentNodes;
|
|
97
43
|
ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
|
|
98
44
|
ButtonZoomIn: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -155,4 +101,4 @@ export declare const CapLink: {
|
|
|
155
101
|
}>;
|
|
156
102
|
};
|
|
157
103
|
};
|
|
158
|
-
export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes,
|
|
104
|
+
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, };
|