@squeed/flow-sdk 0.1.0

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.
@@ -0,0 +1,192 @@
1
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
2
+
3
+ export declare type BackgroundPattern = "dot" | "steel" | "grid" | "none";
4
+
5
+ export declare const contentObjTheme: (color: any) => {
6
+ background: any;
7
+ highlight: string;
8
+ border: string;
9
+ property: string;
10
+ boolean: string;
11
+ string: string;
12
+ number: string;
13
+ };
14
+
15
+ export declare function createFlowDiagram(jsnObjct: any, path?: string, nodes?: any[], edges?: any[], activeLabel?: string, flowConfig?: any, nodeConfig?: any, ctx?: DiagramContext): {
16
+ nodes: any[];
17
+ edges: any[];
18
+ };
19
+
20
+ declare interface DiagramContext {
21
+ invrtdRtPths: string[];
22
+ initalObjIds: {
23
+ ids: any[];
24
+ jsnObjct: any;
25
+ } | null;
26
+ }
27
+
28
+ export declare function FlowDiagram({ json, title, nodes: externalNodes, edges: externalEdges, config, callbacks, className, style, showBottomBar, }: FlowDiagramProps & {
29
+ showBottomBar?: boolean;
30
+ }): JSX_2.Element;
31
+
32
+ export declare interface FlowDiagramCallbacks {
33
+ onNodeSelect?: (nodeId: string, nodeData: any) => void;
34
+ onNodeDeselect?: () => void;
35
+ onNodeDoubleClick?: (nodeId: string, nodeData: any) => void;
36
+ onNodeHoverAction?: (actionId: string, nodeId: string, nodeData: any) => void;
37
+ onEdgeCreate?: (sourceId: string, targetId: string) => void;
38
+ onEdgeSelect?: (edgeId: string, edgeData: any) => void;
39
+ onEdgeDeselect?: () => void;
40
+ onEdgeRemove?: (edgeId: string, edgeData: any) => void;
41
+ onViewportChange?: (viewport: {
42
+ pan: {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ zoom: number;
47
+ }) => void;
48
+ onNodeCreate?: (params: {
49
+ type: string;
50
+ position: any;
51
+ sourceNodeId?: string;
52
+ }) => void;
53
+ onCyInit?: (cy: any) => void;
54
+ onDirectionChange?: (direction: FlowDirection) => void;
55
+ onNodeColorChange?: (nodeId: string, colorType: "text" | "bg", color: string) => void;
56
+ onEdgeColorChange?: (edgeId: string, color: string) => void;
57
+ onArrayModeChange?: (isArrayMode: boolean) => void;
58
+ onNodeDelete?: (nodeId: string, nodeData: any) => void;
59
+ }
60
+
61
+ export declare interface FlowDiagramConfig {
62
+ direction?: FlowDirection;
63
+ layout?: LayoutAlgorithm;
64
+ themeColor?: string;
65
+ colorMode?: "light" | "dark";
66
+ backgroundPattern?: BackgroundPattern;
67
+ minZoom?: number;
68
+ maxZoom?: number;
69
+ initialViewport?: {
70
+ pan: {
71
+ x: number;
72
+ y: number;
73
+ };
74
+ zoom: number;
75
+ };
76
+ edgeHandles?: boolean;
77
+ readOnly?: boolean;
78
+ edgeColor?: string;
79
+ nodeOverlayActions?: NodeOverlayAction[];
80
+ renderNodeOverlay?: (props: NodeOverlayProps) => React.ReactNode;
81
+ renderSelectedNodeToolbar?: (props: SelectedNodeToolbarProps) => React.ReactNode;
82
+ }
83
+
84
+ export declare interface FlowDiagramEdge {
85
+ data: {
86
+ id: string;
87
+ source: string;
88
+ target: string;
89
+ label?: string;
90
+ isInverted?: boolean;
91
+ isEdgeAnimated?: boolean;
92
+ isEdgeDashed?: boolean;
93
+ };
94
+ }
95
+
96
+ export declare interface FlowDiagramNode {
97
+ data: {
98
+ id: string;
99
+ label?: string;
100
+ text?: string;
101
+ code?: string;
102
+ type: string;
103
+ parent?: string;
104
+ headerTitle?: string;
105
+ description?: Record<string, any>;
106
+ viewProps?: any;
107
+ config?: Record<string, any>;
108
+ };
109
+ }
110
+
111
+ export declare interface FlowDiagramProps {
112
+ json?: any;
113
+ title?: string;
114
+ nodes?: FlowDiagramNode[];
115
+ edges?: FlowDiagramEdge[];
116
+ config?: FlowDiagramConfig;
117
+ callbacks?: FlowDiagramCallbacks;
118
+ className?: string;
119
+ style?: React.CSSProperties;
120
+ }
121
+
122
+ export declare type FlowDirection = "LR" | "RL" | "TB" | "BT";
123
+
124
+ export declare const getChakraColorHex: (color?: any, opacity?: any) => any;
125
+
126
+ export declare const getColorVariant: (color: string) => {
127
+ secondary: string;
128
+ primary?: undefined;
129
+ light?: undefined;
130
+ } | {
131
+ primary: string;
132
+ secondary: string;
133
+ light: string;
134
+ };
135
+
136
+ export declare function getDarkerHexColor(hex: string, factor?: number): string;
137
+
138
+ export declare type LayoutAlgorithm = "dagre" | "elk" | "tidytree" | "concentric" | "cose";
139
+
140
+ export declare interface NodeOverlayAction {
141
+ icon: any;
142
+ label: string;
143
+ id: string;
144
+ }
145
+
146
+ export declare interface NodeOverlayProps {
147
+ nodeId: string;
148
+ nodeData: any;
149
+ isRoot: boolean;
150
+ isParent: boolean;
151
+ isHovered: boolean;
152
+ setIsHovered: (v: boolean) => void;
153
+ }
154
+
155
+ export declare interface SelectedNodeToolbarProps {
156
+ selectedNodeIds: string[];
157
+ selectedNodeData: any[];
158
+ onDeselect: () => void;
159
+ }
160
+
161
+ export declare function useCustomColors(theme?: any): {
162
+ background: string;
163
+ backgroundSecondary: string;
164
+ darkBackgroundSecondary: string;
165
+ border: string;
166
+ darkColor: string;
167
+ backgroundWhiteColor: string;
168
+ borderSecondary: string;
169
+ colorActive: string;
170
+ colorInactive: string;
171
+ iconColor: string;
172
+ moreIconColor: string;
173
+ colorText: string;
174
+ themedColorText: string;
175
+ logoColor: any;
176
+ logoColorSecondary: any;
177
+ darkColorActive: string;
178
+ greenColor: string;
179
+ };
180
+
181
+ export declare function useThemeContentColors(color: any): {
182
+ bgColor: any;
183
+ highlightColor: string;
184
+ borderColor: string;
185
+ textColor: string;
186
+ propertyColor: string;
187
+ secondary: string;
188
+ bgColorFaint: any;
189
+ highlightColorFaint: string;
190
+ };
191
+
192
+ export { }