ai-design-system 0.1.84 → 0.1.85
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/components/ai-elements/canvas.tsx +9 -4
- package/components/blocks/WorkflowCanvas/WorkflowCanvas.tsx +4 -0
- package/components/features/NodeEditor/NodeEditor.tsx +6 -0
- package/components/features/NodeEditor/bookgeek.preview.json +120 -8
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +91 -87
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/lib/workflow/interfaces.ts +2 -0
- package/package.json +1 -1
|
@@ -7,16 +7,21 @@ type CanvasProps = ReactFlowProps & {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const Canvas = ({
|
|
10
|
+
export const Canvas = ({
|
|
11
|
+
children,
|
|
12
|
+
panOnDrag = false,
|
|
13
|
+
selectionOnDrag,
|
|
14
|
+
...props
|
|
15
|
+
}: CanvasProps) => (
|
|
11
16
|
<ReactFlow
|
|
12
|
-
{...props}
|
|
13
17
|
deleteKeyCode={["Backspace", "Delete"]}
|
|
14
18
|
fitView
|
|
15
|
-
panOnDrag={false}
|
|
16
19
|
panOnScroll
|
|
17
20
|
proOptions={{ hideAttribution: true }}
|
|
18
|
-
selectionOnDrag={true}
|
|
19
21
|
zoomOnDoubleClick={false}
|
|
22
|
+
panOnDrag={panOnDrag}
|
|
23
|
+
selectionOnDrag={selectionOnDrag !== undefined ? selectionOnDrag : !panOnDrag}
|
|
24
|
+
{...props}
|
|
20
25
|
>
|
|
21
26
|
<Background bgColor="var(--sidebar)" />
|
|
22
27
|
<Controls />
|
|
@@ -47,6 +47,8 @@ function WorkflowCanvasInner({
|
|
|
47
47
|
onNodeClick,
|
|
48
48
|
onEdgeClick,
|
|
49
49
|
interactive = false,
|
|
50
|
+
panOnDrag = false,
|
|
51
|
+
selectionOnDrag,
|
|
50
52
|
topLeft,
|
|
51
53
|
topRight,
|
|
52
54
|
topCenter,
|
|
@@ -84,6 +86,8 @@ function WorkflowCanvasInner({
|
|
|
84
86
|
}}
|
|
85
87
|
>
|
|
86
88
|
<Canvas
|
|
89
|
+
panOnDrag={panOnDrag}
|
|
90
|
+
selectionOnDrag={selectionOnDrag}
|
|
87
91
|
className="bg-background [&_.react-flow\_\_handle]:opacity-0 [&_.react-flow\_\_handle]:pointer-events-none [&_.react-flow\_\_node:hover_.react-flow\_\_handle]:opacity-100 [&_.react-flow\_\_node:hover_.react-flow\_\_handle]:pointer-events-auto [&_.react-flow\_\_node.selected_.react-flow\_\_handle]:opacity-100 [&_.react-flow\_\_node.selected_.react-flow\_\_handle]:pointer-events-auto [&_.react-flow\_\_handle]:transition-opacity [&_.react-flow\_\_handle]:duration-150"
|
|
88
92
|
connectionLineComponent={ConnectionLine}
|
|
89
93
|
connectionMode={ConnectionMode.Strict}
|
|
@@ -52,6 +52,8 @@ export interface NodeEditorProps {
|
|
|
52
52
|
|
|
53
53
|
showMinimap?: boolean;
|
|
54
54
|
interactive?: boolean;
|
|
55
|
+
panOnDrag?: boolean | number[];
|
|
56
|
+
selectionOnDrag?: boolean;
|
|
55
57
|
hideDefaultActions?: boolean;
|
|
56
58
|
hideWorkflowName?: boolean;
|
|
57
59
|
className?: string;
|
|
@@ -99,6 +101,8 @@ export function NodeEditor({
|
|
|
99
101
|
extraActions,
|
|
100
102
|
showMinimap,
|
|
101
103
|
interactive = false,
|
|
104
|
+
panOnDrag = false,
|
|
105
|
+
selectionOnDrag,
|
|
102
106
|
hideDefaultActions = false,
|
|
103
107
|
hideWorkflowName = false,
|
|
104
108
|
className,
|
|
@@ -159,6 +163,8 @@ export function NodeEditor({
|
|
|
159
163
|
className="h-full w-full"
|
|
160
164
|
edges={edges}
|
|
161
165
|
interactive={interactive}
|
|
166
|
+
panOnDrag={panOnDrag}
|
|
167
|
+
selectionOnDrag={selectionOnDrag}
|
|
162
168
|
nodes={highlightedNodes}
|
|
163
169
|
showMinimap={showMinimap}
|
|
164
170
|
topLeft={
|
|
@@ -23,7 +23,23 @@
|
|
|
23
23
|
"label": "Get Started",
|
|
24
24
|
"top": 779
|
|
25
25
|
}
|
|
26
|
-
]
|
|
26
|
+
],
|
|
27
|
+
"action": {
|
|
28
|
+
"after": [
|
|
29
|
+
{
|
|
30
|
+
"stepId": "await-nav-welcome",
|
|
31
|
+
"actionType": "step/await-navigation",
|
|
32
|
+
"semantics": {
|
|
33
|
+
"label": "Await navigation from Welcome",
|
|
34
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
35
|
+
},
|
|
36
|
+
"config": {
|
|
37
|
+
"screenId": "welcome",
|
|
38
|
+
"route": "/welcome"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
44
|
},
|
|
29
45
|
{
|
|
@@ -61,7 +77,23 @@
|
|
|
61
77
|
"label": "Sign Up",
|
|
62
78
|
"top": 371
|
|
63
79
|
}
|
|
64
|
-
]
|
|
80
|
+
],
|
|
81
|
+
"action": {
|
|
82
|
+
"after": [
|
|
83
|
+
{
|
|
84
|
+
"stepId": "await-nav-signup",
|
|
85
|
+
"actionType": "step/await-navigation",
|
|
86
|
+
"semantics": {
|
|
87
|
+
"label": "Await navigation from Sign Up",
|
|
88
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
89
|
+
},
|
|
90
|
+
"config": {
|
|
91
|
+
"screenId": "signup",
|
|
92
|
+
"route": "/signup"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
65
97
|
}
|
|
66
98
|
},
|
|
67
99
|
{
|
|
@@ -99,7 +131,23 @@
|
|
|
99
131
|
"label": "Next",
|
|
100
132
|
"top": 791
|
|
101
133
|
}
|
|
102
|
-
]
|
|
134
|
+
],
|
|
135
|
+
"action": {
|
|
136
|
+
"after": [
|
|
137
|
+
{
|
|
138
|
+
"stepId": "await-nav-categories",
|
|
139
|
+
"actionType": "step/await-navigation",
|
|
140
|
+
"semantics": {
|
|
141
|
+
"label": "Await navigation from Categories",
|
|
142
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
143
|
+
},
|
|
144
|
+
"config": {
|
|
145
|
+
"screenId": "categories",
|
|
146
|
+
"route": "/categories"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
103
151
|
}
|
|
104
152
|
},
|
|
105
153
|
{
|
|
@@ -137,7 +185,23 @@
|
|
|
137
185
|
"label": "Done",
|
|
138
186
|
"top": 791
|
|
139
187
|
}
|
|
140
|
-
]
|
|
188
|
+
],
|
|
189
|
+
"action": {
|
|
190
|
+
"after": [
|
|
191
|
+
{
|
|
192
|
+
"stepId": "await-nav-authors",
|
|
193
|
+
"actionType": "step/await-navigation",
|
|
194
|
+
"semantics": {
|
|
195
|
+
"label": "Await navigation from Authors",
|
|
196
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
197
|
+
},
|
|
198
|
+
"config": {
|
|
199
|
+
"screenId": "authors",
|
|
200
|
+
"route": "/authors"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
141
205
|
}
|
|
142
206
|
},
|
|
143
207
|
{
|
|
@@ -160,7 +224,23 @@
|
|
|
160
224
|
"label": "Sign In",
|
|
161
225
|
"top": 307
|
|
162
226
|
}
|
|
163
|
-
]
|
|
227
|
+
],
|
|
228
|
+
"action": {
|
|
229
|
+
"after": [
|
|
230
|
+
{
|
|
231
|
+
"stepId": "await-nav-signin",
|
|
232
|
+
"actionType": "step/await-navigation",
|
|
233
|
+
"semantics": {
|
|
234
|
+
"label": "Await navigation from Sign In",
|
|
235
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
236
|
+
},
|
|
237
|
+
"config": {
|
|
238
|
+
"screenId": "signin",
|
|
239
|
+
"route": "/signin"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
164
244
|
}
|
|
165
245
|
},
|
|
166
246
|
{
|
|
@@ -183,7 +263,23 @@
|
|
|
183
263
|
"label": "Sign Up",
|
|
184
264
|
"top": 327
|
|
185
265
|
}
|
|
186
|
-
]
|
|
266
|
+
],
|
|
267
|
+
"action": {
|
|
268
|
+
"after": [
|
|
269
|
+
{
|
|
270
|
+
"stepId": "await-nav-google-signup",
|
|
271
|
+
"actionType": "step/await-navigation",
|
|
272
|
+
"semantics": {
|
|
273
|
+
"label": "Await navigation from Google Sign Up",
|
|
274
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
275
|
+
},
|
|
276
|
+
"config": {
|
|
277
|
+
"screenId": "google-signup",
|
|
278
|
+
"route": "/google-signup"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
187
283
|
}
|
|
188
284
|
},
|
|
189
285
|
{
|
|
@@ -236,7 +332,23 @@
|
|
|
236
332
|
"label": "Collection",
|
|
237
333
|
"top": 826
|
|
238
334
|
}
|
|
239
|
-
]
|
|
335
|
+
],
|
|
336
|
+
"action": {
|
|
337
|
+
"after": [
|
|
338
|
+
{
|
|
339
|
+
"stepId": "await-nav-home",
|
|
340
|
+
"actionType": "step/await-navigation",
|
|
341
|
+
"semantics": {
|
|
342
|
+
"label": "Await navigation from Home",
|
|
343
|
+
"description": "Pause and wait for user to trigger a navigation event"
|
|
344
|
+
},
|
|
345
|
+
"config": {
|
|
346
|
+
"screenId": "home",
|
|
347
|
+
"route": "/home"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
}
|
|
240
352
|
}
|
|
241
353
|
}
|
|
242
354
|
],
|
|
@@ -308,4 +420,4 @@
|
|
|
308
420
|
"type": "straight"
|
|
309
421
|
}
|
|
310
422
|
]
|
|
311
|
-
}
|
|
423
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -13006,17 +13006,26 @@ var Controls = (_a) => {
|
|
|
13006
13006
|
);
|
|
13007
13007
|
};
|
|
13008
13008
|
var Canvas = (_a) => {
|
|
13009
|
-
var _b = _a, {
|
|
13009
|
+
var _b = _a, {
|
|
13010
|
+
children,
|
|
13011
|
+
panOnDrag = false,
|
|
13012
|
+
selectionOnDrag
|
|
13013
|
+
} = _b, props = __objRest(_b, [
|
|
13014
|
+
"children",
|
|
13015
|
+
"panOnDrag",
|
|
13016
|
+
"selectionOnDrag"
|
|
13017
|
+
]);
|
|
13010
13018
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13011
13019
|
react.ReactFlow,
|
|
13012
|
-
__spreadProps(__spreadValues({
|
|
13020
|
+
__spreadProps(__spreadValues({
|
|
13013
13021
|
deleteKeyCode: ["Backspace", "Delete"],
|
|
13014
13022
|
fitView: true,
|
|
13015
|
-
panOnDrag: false,
|
|
13016
13023
|
panOnScroll: true,
|
|
13017
13024
|
proOptions: { hideAttribution: true },
|
|
13018
|
-
selectionOnDrag: true,
|
|
13019
13025
|
zoomOnDoubleClick: false,
|
|
13026
|
+
panOnDrag,
|
|
13027
|
+
selectionOnDrag: selectionOnDrag !== void 0 ? selectionOnDrag : !panOnDrag
|
|
13028
|
+
}, props), {
|
|
13020
13029
|
children: [
|
|
13021
13030
|
/* @__PURE__ */ jsxRuntime.jsx(react.Background, { bgColor: "var(--sidebar)" }),
|
|
13022
13031
|
/* @__PURE__ */ jsxRuntime.jsx(Controls, {}),
|
|
@@ -13199,6 +13208,8 @@ function WorkflowCanvasInner({
|
|
|
13199
13208
|
onNodeClick,
|
|
13200
13209
|
onEdgeClick,
|
|
13201
13210
|
interactive = false,
|
|
13211
|
+
panOnDrag = false,
|
|
13212
|
+
selectionOnDrag,
|
|
13202
13213
|
topLeft,
|
|
13203
13214
|
topRight,
|
|
13204
13215
|
topCenter,
|
|
@@ -13235,6 +13246,8 @@ function WorkflowCanvasInner({
|
|
|
13235
13246
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13236
13247
|
Canvas,
|
|
13237
13248
|
{
|
|
13249
|
+
panOnDrag,
|
|
13250
|
+
selectionOnDrag,
|
|
13238
13251
|
className: "bg-background [&_.react-flow\\_\\_handle]:opacity-0 [&_.react-flow\\_\\_handle]:pointer-events-none [&_.react-flow\\_\\_node:hover_.react-flow\\_\\_handle]:opacity-100 [&_.react-flow\\_\\_node:hover_.react-flow\\_\\_handle]:pointer-events-auto [&_.react-flow\\_\\_node.selected_.react-flow\\_\\_handle]:opacity-100 [&_.react-flow\\_\\_node.selected_.react-flow\\_\\_handle]:pointer-events-auto [&_.react-flow\\_\\_handle]:transition-opacity [&_.react-flow\\_\\_handle]:duration-150",
|
|
13239
13252
|
connectionLineComponent: Connection,
|
|
13240
13253
|
connectionMode: react.ConnectionMode.Strict,
|
|
@@ -13399,6 +13412,8 @@ function NodeEditor({
|
|
|
13399
13412
|
extraActions,
|
|
13400
13413
|
showMinimap,
|
|
13401
13414
|
interactive = false,
|
|
13415
|
+
panOnDrag = false,
|
|
13416
|
+
selectionOnDrag,
|
|
13402
13417
|
hideDefaultActions = false,
|
|
13403
13418
|
hideWorkflowName = false,
|
|
13404
13419
|
className,
|
|
@@ -13451,6 +13466,8 @@ function NodeEditor({
|
|
|
13451
13466
|
className: "h-full w-full",
|
|
13452
13467
|
edges,
|
|
13453
13468
|
interactive,
|
|
13469
|
+
panOnDrag,
|
|
13470
|
+
selectionOnDrag,
|
|
13454
13471
|
nodes: highlightedNodes,
|
|
13455
13472
|
showMinimap,
|
|
13456
13473
|
topLeft: showTopLeftToolbar ? /* @__PURE__ */ jsxRuntime.jsx(
|