@uipath/apollo-wind 0.8.1 → 0.9.1
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/archived-ui-path.svg +3 -0
- package/dist/components/ui/index.cjs +2 -2
- package/dist/examples/admin-layout-example.cjs +490 -0
- package/dist/examples/admin-layout-example.js +411 -0
- package/dist/examples/app-shell-example.cjs +452 -0
- package/dist/examples/app-shell-example.js +418 -0
- package/dist/examples/dashboard-example.cjs +590 -0
- package/dist/examples/dashboard-example.js +556 -0
- package/dist/examples/data-management-example.cjs +584 -0
- package/dist/examples/data-management-example.js +550 -0
- package/dist/examples/flow-editor-layout-example.cjs +309 -0
- package/dist/examples/flow-editor-layout-example.js +269 -0
- package/dist/examples/flow-start-example.cjs +467 -0
- package/dist/examples/flow-start-example.js +433 -0
- package/dist/examples/form-builder-example.cjs +674 -0
- package/dist/examples/form-builder-example.js +640 -0
- package/dist/examples/new-project-example.cjs +550 -0
- package/dist/examples/new-project-example.js +516 -0
- package/dist/examples/settings-example.cjs +864 -0
- package/dist/examples/settings-example.js +830 -0
- package/dist/examples/vscode-example.cjs +340 -0
- package/dist/examples/vscode-example.js +270 -0
- package/dist/templates/admin-layout-example.d.ts +92 -0
- package/dist/templates/app-shell-example.d.ts +52 -0
- package/dist/templates/dashboard-example.d.ts +11 -0
- package/dist/templates/data-management-example.d.ts +1 -0
- package/dist/templates/flow-editor-layout-example.d.ts +22 -0
- package/dist/templates/flow-start-example.d.ts +30 -0
- package/dist/templates/form-builder-example.d.ts +1 -0
- package/dist/templates/new-project-example.d.ts +30 -0
- package/dist/templates/settings-example.d.ts +1 -0
- package/dist/templates/vscode-example.d.ts +80 -0
- package/dist/ui-path.svg +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
CanvasToolbar: ()=>CanvasToolbar,
|
|
28
|
+
PublishToolbar: ()=>PublishToolbar,
|
|
29
|
+
FlowEditorLayout: ()=>FlowEditorLayout
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const button_cjs_namespaceObject = require("../components/ui/button.cjs");
|
|
35
|
+
const resizable_cjs_namespaceObject = require("../components/ui/resizable.cjs");
|
|
36
|
+
const separator_cjs_namespaceObject = require("../components/ui/separator.cjs");
|
|
37
|
+
const switch_cjs_namespaceObject = require("../components/ui/switch.cjs");
|
|
38
|
+
const tooltip_cjs_namespaceObject = require("../components/ui/tooltip.cjs");
|
|
39
|
+
const index_cjs_namespaceObject = require("../components/ui/layout/index.cjs");
|
|
40
|
+
const external_lib_index_cjs_namespaceObject = require("../lib/index.cjs");
|
|
41
|
+
const react_label_namespaceObject = require("@radix-ui/react-label");
|
|
42
|
+
const toggle_group_cjs_namespaceObject = require("../components/ui/toggle-group.cjs");
|
|
43
|
+
const dropdown_menu_cjs_namespaceObject = require("../components/ui/dropdown-menu.cjs");
|
|
44
|
+
function LatchedButton({ isActive, icon, label, onClick }) {
|
|
45
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tooltip_cjs_namespaceObject.Tooltip, {
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
48
|
+
asChild: true,
|
|
49
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
|
|
50
|
+
variant: "ghost",
|
|
51
|
+
size: "icon",
|
|
52
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('w-[40px] h-[40px] rounded-r-2xl rounded-l-none bg-background border', isActive ? '-ml-px w-[41px] border-y-border border-r-border border-l-background' : 'border-l-0 border-border hover:bg-muted'),
|
|
53
|
+
onClick: onClick,
|
|
54
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
55
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('flex items-center justify-center w-6 h-6 rounded-lg transition-colors', isActive ? 'bg-primary text-background' : 'bg-transparent text-foreground'),
|
|
56
|
+
children: icon
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_cjs_namespaceObject.TooltipContent, {
|
|
61
|
+
side: "right",
|
|
62
|
+
children: label
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function FlowEditorLayout({ className, sidebarOptions, sidebarContent, activeSidebarId, sidebarOpen = false, onSidebarChange, onSidebarOpenChange, mainContent, bottomContent, bottomOpen = false }) {
|
|
68
|
+
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
69
|
+
const bottomPanelRef = (0, external_react_namespaceObject.useRef)(null);
|
|
70
|
+
const switcherRef = (0, external_react_namespaceObject.useRef)(null);
|
|
71
|
+
const rafRef = (0, external_react_namespaceObject.useRef)(0);
|
|
72
|
+
const updateSwitcherPosition = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
73
|
+
if (!containerRef.current || !switcherRef.current) return;
|
|
74
|
+
if (!bottomOpen) {
|
|
75
|
+
switcherRef.current.style.bottom = '24px';
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const size = bottomPanelRef.current?.getSize();
|
|
79
|
+
if (void 0 !== size) {
|
|
80
|
+
const containerHeight = containerRef.current.offsetHeight;
|
|
81
|
+
const bottomHeight = size / 100 * containerHeight;
|
|
82
|
+
switcherRef.current.style.bottom = `${bottomHeight + 24}px`;
|
|
83
|
+
}
|
|
84
|
+
}, [
|
|
85
|
+
bottomOpen
|
|
86
|
+
]);
|
|
87
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
88
|
+
updateSwitcherPosition();
|
|
89
|
+
const handleResize = ()=>{
|
|
90
|
+
cancelAnimationFrame(rafRef.current);
|
|
91
|
+
rafRef.current = requestAnimationFrame(updateSwitcherPosition);
|
|
92
|
+
};
|
|
93
|
+
window.addEventListener('resize', handleResize);
|
|
94
|
+
return ()=>{
|
|
95
|
+
window.removeEventListener('resize', handleResize);
|
|
96
|
+
cancelAnimationFrame(rafRef.current);
|
|
97
|
+
};
|
|
98
|
+
}, [
|
|
99
|
+
updateSwitcherPosition
|
|
100
|
+
]);
|
|
101
|
+
const handlePanelResize = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
102
|
+
cancelAnimationFrame(rafRef.current);
|
|
103
|
+
rafRef.current = requestAnimationFrame(updateSwitcherPosition);
|
|
104
|
+
}, [
|
|
105
|
+
updateSwitcherPosition
|
|
106
|
+
]);
|
|
107
|
+
const handlePanelSelect = (0, external_react_namespaceObject.useCallback)((panelId)=>{
|
|
108
|
+
if (activeSidebarId === panelId) onSidebarOpenChange?.(!sidebarOpen);
|
|
109
|
+
else {
|
|
110
|
+
onSidebarChange?.(panelId);
|
|
111
|
+
if (!sidebarOpen) onSidebarOpenChange?.(true);
|
|
112
|
+
}
|
|
113
|
+
}, [
|
|
114
|
+
activeSidebarId,
|
|
115
|
+
sidebarOpen,
|
|
116
|
+
onSidebarChange,
|
|
117
|
+
onSidebarOpenChange
|
|
118
|
+
]);
|
|
119
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
120
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
121
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('h-screen bg-background', className),
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
124
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('bg-background overflow-hidden transition-all duration-300 ease-in-out', sidebarOpen ? 'w-72' : 'w-0'),
|
|
125
|
+
children: sidebarOpen && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
|
|
126
|
+
className: "w-72 h-full",
|
|
127
|
+
children: sidebarContent
|
|
128
|
+
})
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Column, {
|
|
131
|
+
ref: containerRef,
|
|
132
|
+
className: "flex-1 relative bg-muted m-1 rounded-3xl border",
|
|
133
|
+
children: [
|
|
134
|
+
sidebarOptions && sidebarOptions.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
|
|
135
|
+
ref: switcherRef,
|
|
136
|
+
gap: 2,
|
|
137
|
+
className: "absolute left-0 z-10",
|
|
138
|
+
style: {
|
|
139
|
+
bottom: 24
|
|
140
|
+
},
|
|
141
|
+
children: sidebarOptions.map((panel)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(LatchedButton, {
|
|
142
|
+
isActive: activeSidebarId === panel.id && sidebarOpen,
|
|
143
|
+
icon: panel.icon,
|
|
144
|
+
label: panel.label,
|
|
145
|
+
onClick: ()=>handlePanelSelect(panel.id)
|
|
146
|
+
}, panel.id))
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
|
|
149
|
+
className: "flex-1 relative rounded-3xl overflow-hidden",
|
|
150
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(resizable_cjs_namespaceObject.ResizablePanelGroup, {
|
|
151
|
+
direction: "vertical",
|
|
152
|
+
className: "h-full",
|
|
153
|
+
children: [
|
|
154
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resizable_cjs_namespaceObject.ResizablePanel, {
|
|
155
|
+
defaultSize: 100,
|
|
156
|
+
minSize: 30,
|
|
157
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
|
|
158
|
+
className: "flex-1 h-full",
|
|
159
|
+
children: mainContent
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
bottomOpen && bottomContent && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resizable_cjs_namespaceObject.ResizableHandle, {}),
|
|
165
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resizable_cjs_namespaceObject.ResizablePanel, {
|
|
166
|
+
ref: bottomPanelRef,
|
|
167
|
+
defaultSize: 30,
|
|
168
|
+
minSize: 15,
|
|
169
|
+
maxSize: 50,
|
|
170
|
+
onResize: handlePanelResize,
|
|
171
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
|
|
172
|
+
className: "flex-1 h-full bg-background",
|
|
173
|
+
children: bottomContent
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function CanvasToolbar() {
|
|
188
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Row, {
|
|
189
|
+
className: "absolute bottom-4 left-1/2 -translate-x-1/2",
|
|
190
|
+
align: "center",
|
|
191
|
+
gap: 1,
|
|
192
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
193
|
+
className: "flex items-center gap-1 rounded-lg border bg-background p-1.5",
|
|
194
|
+
children: [
|
|
195
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(toggle_group_cjs_namespaceObject.ToggleGroup, {
|
|
196
|
+
type: "single",
|
|
197
|
+
defaultValue: "build",
|
|
198
|
+
className: "gap-0",
|
|
199
|
+
children: [
|
|
200
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(toggle_group_cjs_namespaceObject.ToggleGroupItem, {
|
|
201
|
+
value: "build",
|
|
202
|
+
className: "h-8 rounded-md px-3 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
203
|
+
children: "Build"
|
|
204
|
+
}),
|
|
205
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(toggle_group_cjs_namespaceObject.ToggleGroupItem, {
|
|
206
|
+
value: "evaluate",
|
|
207
|
+
className: "h-8 rounded-md px-3 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
208
|
+
children: "Evaluate"
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
|
|
213
|
+
orientation: "vertical",
|
|
214
|
+
className: "mx-1 h-6"
|
|
215
|
+
}),
|
|
216
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
|
|
217
|
+
variant: "ghost",
|
|
218
|
+
size: "icon",
|
|
219
|
+
className: "h-8 w-8",
|
|
220
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Play, {
|
|
221
|
+
className: "h-4 w-4"
|
|
222
|
+
})
|
|
223
|
+
}),
|
|
224
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
|
|
225
|
+
orientation: "vertical",
|
|
226
|
+
className: "mx-1 h-6"
|
|
227
|
+
}),
|
|
228
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
|
|
229
|
+
variant: "ghost",
|
|
230
|
+
size: "icon",
|
|
231
|
+
className: "h-8 w-8",
|
|
232
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
|
|
233
|
+
className: "h-4 w-4"
|
|
234
|
+
})
|
|
235
|
+
}),
|
|
236
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
|
|
237
|
+
variant: "ghost",
|
|
238
|
+
size: "icon",
|
|
239
|
+
className: "h-8 w-8",
|
|
240
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Copy, {
|
|
241
|
+
className: "h-4 w-4"
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
]
|
|
245
|
+
})
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function PublishToolbar() {
|
|
249
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Row, {
|
|
250
|
+
className: "absolute bottom-4 right-4",
|
|
251
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
252
|
+
className: "flex items-center gap-3 rounded-lg border bg-background p-1.5 pl-3",
|
|
253
|
+
children: [
|
|
254
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_label_namespaceObject.Label, {
|
|
255
|
+
htmlFor: "toolbar-active",
|
|
256
|
+
className: "text-sm font-medium",
|
|
257
|
+
children: "Active"
|
|
258
|
+
}),
|
|
259
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(switch_cjs_namespaceObject.Switch, {
|
|
260
|
+
id: "toolbar-active"
|
|
261
|
+
}),
|
|
262
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
|
|
263
|
+
orientation: "vertical",
|
|
264
|
+
className: "h-6"
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
267
|
+
children: [
|
|
268
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
269
|
+
asChild: true,
|
|
270
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
|
|
271
|
+
variant: "ghost",
|
|
272
|
+
size: "icon",
|
|
273
|
+
className: "h-8 w-8",
|
|
274
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoreVertical, {
|
|
275
|
+
className: "h-4 w-4"
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
}),
|
|
279
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(dropdown_menu_cjs_namespaceObject.DropdownMenuContent, {
|
|
280
|
+
align: "end",
|
|
281
|
+
children: [
|
|
282
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
283
|
+
children: "Edit"
|
|
284
|
+
}),
|
|
285
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
286
|
+
children: "Duplicate"
|
|
287
|
+
}),
|
|
288
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
289
|
+
children: "Delete"
|
|
290
|
+
})
|
|
291
|
+
]
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
exports.CanvasToolbar = __webpack_exports__.CanvasToolbar;
|
|
300
|
+
exports.FlowEditorLayout = __webpack_exports__.FlowEditorLayout;
|
|
301
|
+
exports.PublishToolbar = __webpack_exports__.PublishToolbar;
|
|
302
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
303
|
+
"CanvasToolbar",
|
|
304
|
+
"FlowEditorLayout",
|
|
305
|
+
"PublishToolbar"
|
|
306
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
307
|
+
Object.defineProperty(exports, '__esModule', {
|
|
308
|
+
value: true
|
|
309
|
+
});
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Copy, MoreVertical, Play, Plus } from "lucide-react";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { Button } from "../components/ui/button.js";
|
|
5
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../components/ui/resizable.js";
|
|
6
|
+
import { Separator } from "../components/ui/separator.js";
|
|
7
|
+
import { Switch } from "../components/ui/switch.js";
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../components/ui/tooltip.js";
|
|
9
|
+
import { Column, Row } from "../components/ui/layout/index.js";
|
|
10
|
+
import { cn } from "../lib/index.js";
|
|
11
|
+
import { Label } from "@radix-ui/react-label";
|
|
12
|
+
import { ToggleGroup, ToggleGroupItem } from "../components/ui/toggle-group.js";
|
|
13
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../components/ui/dropdown-menu.js";
|
|
14
|
+
function LatchedButton({ isActive, icon, label, onClick }) {
|
|
15
|
+
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
18
|
+
asChild: true,
|
|
19
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
20
|
+
variant: "ghost",
|
|
21
|
+
size: "icon",
|
|
22
|
+
className: cn('w-[40px] h-[40px] rounded-r-2xl rounded-l-none bg-background border', isActive ? '-ml-px w-[41px] border-y-border border-r-border border-l-background' : 'border-l-0 border-border hover:bg-muted'),
|
|
23
|
+
onClick: onClick,
|
|
24
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
25
|
+
className: cn('flex items-center justify-center w-6 h-6 rounded-lg transition-colors', isActive ? 'bg-primary text-background' : 'bg-transparent text-foreground'),
|
|
26
|
+
children: icon
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
31
|
+
side: "right",
|
|
32
|
+
children: label
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function FlowEditorLayout({ className, sidebarOptions, sidebarContent, activeSidebarId, sidebarOpen = false, onSidebarChange, onSidebarOpenChange, mainContent, bottomContent, bottomOpen = false }) {
|
|
38
|
+
const containerRef = useRef(null);
|
|
39
|
+
const bottomPanelRef = useRef(null);
|
|
40
|
+
const switcherRef = useRef(null);
|
|
41
|
+
const rafRef = useRef(0);
|
|
42
|
+
const updateSwitcherPosition = useCallback(()=>{
|
|
43
|
+
if (!containerRef.current || !switcherRef.current) return;
|
|
44
|
+
if (!bottomOpen) {
|
|
45
|
+
switcherRef.current.style.bottom = '24px';
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const size = bottomPanelRef.current?.getSize();
|
|
49
|
+
if (void 0 !== size) {
|
|
50
|
+
const containerHeight = containerRef.current.offsetHeight;
|
|
51
|
+
const bottomHeight = size / 100 * containerHeight;
|
|
52
|
+
switcherRef.current.style.bottom = `${bottomHeight + 24}px`;
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
bottomOpen
|
|
56
|
+
]);
|
|
57
|
+
useEffect(()=>{
|
|
58
|
+
updateSwitcherPosition();
|
|
59
|
+
const handleResize = ()=>{
|
|
60
|
+
cancelAnimationFrame(rafRef.current);
|
|
61
|
+
rafRef.current = requestAnimationFrame(updateSwitcherPosition);
|
|
62
|
+
};
|
|
63
|
+
window.addEventListener('resize', handleResize);
|
|
64
|
+
return ()=>{
|
|
65
|
+
window.removeEventListener('resize', handleResize);
|
|
66
|
+
cancelAnimationFrame(rafRef.current);
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
updateSwitcherPosition
|
|
70
|
+
]);
|
|
71
|
+
const handlePanelResize = useCallback(()=>{
|
|
72
|
+
cancelAnimationFrame(rafRef.current);
|
|
73
|
+
rafRef.current = requestAnimationFrame(updateSwitcherPosition);
|
|
74
|
+
}, [
|
|
75
|
+
updateSwitcherPosition
|
|
76
|
+
]);
|
|
77
|
+
const handlePanelSelect = useCallback((panelId)=>{
|
|
78
|
+
if (activeSidebarId === panelId) onSidebarOpenChange?.(!sidebarOpen);
|
|
79
|
+
else {
|
|
80
|
+
onSidebarChange?.(panelId);
|
|
81
|
+
if (!sidebarOpen) onSidebarOpenChange?.(true);
|
|
82
|
+
}
|
|
83
|
+
}, [
|
|
84
|
+
activeSidebarId,
|
|
85
|
+
sidebarOpen,
|
|
86
|
+
onSidebarChange,
|
|
87
|
+
onSidebarOpenChange
|
|
88
|
+
]);
|
|
89
|
+
return /*#__PURE__*/ jsx(TooltipProvider, {
|
|
90
|
+
children: /*#__PURE__*/ jsxs(Row, {
|
|
91
|
+
className: cn('h-screen bg-background', className),
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ jsx("div", {
|
|
94
|
+
className: cn('bg-background overflow-hidden transition-all duration-300 ease-in-out', sidebarOpen ? 'w-72' : 'w-0'),
|
|
95
|
+
children: sidebarOpen && /*#__PURE__*/ jsx(Column, {
|
|
96
|
+
className: "w-72 h-full",
|
|
97
|
+
children: sidebarContent
|
|
98
|
+
})
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsxs(Column, {
|
|
101
|
+
ref: containerRef,
|
|
102
|
+
className: "flex-1 relative bg-muted m-1 rounded-3xl border",
|
|
103
|
+
children: [
|
|
104
|
+
sidebarOptions && sidebarOptions.length > 0 && /*#__PURE__*/ jsx(Column, {
|
|
105
|
+
ref: switcherRef,
|
|
106
|
+
gap: 2,
|
|
107
|
+
className: "absolute left-0 z-10",
|
|
108
|
+
style: {
|
|
109
|
+
bottom: 24
|
|
110
|
+
},
|
|
111
|
+
children: sidebarOptions.map((panel)=>/*#__PURE__*/ jsx(LatchedButton, {
|
|
112
|
+
isActive: activeSidebarId === panel.id && sidebarOpen,
|
|
113
|
+
icon: panel.icon,
|
|
114
|
+
label: panel.label,
|
|
115
|
+
onClick: ()=>handlePanelSelect(panel.id)
|
|
116
|
+
}, panel.id))
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsx(Column, {
|
|
119
|
+
className: "flex-1 relative rounded-3xl overflow-hidden",
|
|
120
|
+
children: /*#__PURE__*/ jsxs(ResizablePanelGroup, {
|
|
121
|
+
direction: "vertical",
|
|
122
|
+
className: "h-full",
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ jsx(ResizablePanel, {
|
|
125
|
+
defaultSize: 100,
|
|
126
|
+
minSize: 30,
|
|
127
|
+
children: /*#__PURE__*/ jsx(Column, {
|
|
128
|
+
className: "flex-1 h-full",
|
|
129
|
+
children: mainContent
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
bottomOpen && bottomContent && /*#__PURE__*/ jsxs(Fragment, {
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ jsx(ResizableHandle, {}),
|
|
135
|
+
/*#__PURE__*/ jsx(ResizablePanel, {
|
|
136
|
+
ref: bottomPanelRef,
|
|
137
|
+
defaultSize: 30,
|
|
138
|
+
minSize: 15,
|
|
139
|
+
maxSize: 50,
|
|
140
|
+
onResize: handlePanelResize,
|
|
141
|
+
children: /*#__PURE__*/ jsx(Column, {
|
|
142
|
+
className: "flex-1 h-full bg-background",
|
|
143
|
+
children: bottomContent
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function CanvasToolbar() {
|
|
158
|
+
return /*#__PURE__*/ jsx(Row, {
|
|
159
|
+
className: "absolute bottom-4 left-1/2 -translate-x-1/2",
|
|
160
|
+
align: "center",
|
|
161
|
+
gap: 1,
|
|
162
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
163
|
+
className: "flex items-center gap-1 rounded-lg border bg-background p-1.5",
|
|
164
|
+
children: [
|
|
165
|
+
/*#__PURE__*/ jsxs(ToggleGroup, {
|
|
166
|
+
type: "single",
|
|
167
|
+
defaultValue: "build",
|
|
168
|
+
className: "gap-0",
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ jsx(ToggleGroupItem, {
|
|
171
|
+
value: "build",
|
|
172
|
+
className: "h-8 rounded-md px-3 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
173
|
+
children: "Build"
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsx(ToggleGroupItem, {
|
|
176
|
+
value: "evaluate",
|
|
177
|
+
className: "h-8 rounded-md px-3 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
178
|
+
children: "Evaluate"
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
}),
|
|
182
|
+
/*#__PURE__*/ jsx(Separator, {
|
|
183
|
+
orientation: "vertical",
|
|
184
|
+
className: "mx-1 h-6"
|
|
185
|
+
}),
|
|
186
|
+
/*#__PURE__*/ jsx(Button, {
|
|
187
|
+
variant: "ghost",
|
|
188
|
+
size: "icon",
|
|
189
|
+
className: "h-8 w-8",
|
|
190
|
+
children: /*#__PURE__*/ jsx(Play, {
|
|
191
|
+
className: "h-4 w-4"
|
|
192
|
+
})
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ jsx(Separator, {
|
|
195
|
+
orientation: "vertical",
|
|
196
|
+
className: "mx-1 h-6"
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ jsx(Button, {
|
|
199
|
+
variant: "ghost",
|
|
200
|
+
size: "icon",
|
|
201
|
+
className: "h-8 w-8",
|
|
202
|
+
children: /*#__PURE__*/ jsx(Plus, {
|
|
203
|
+
className: "h-4 w-4"
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
/*#__PURE__*/ jsx(Button, {
|
|
207
|
+
variant: "ghost",
|
|
208
|
+
size: "icon",
|
|
209
|
+
className: "h-8 w-8",
|
|
210
|
+
children: /*#__PURE__*/ jsx(Copy, {
|
|
211
|
+
className: "h-4 w-4"
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function PublishToolbar() {
|
|
219
|
+
return /*#__PURE__*/ jsx(Row, {
|
|
220
|
+
className: "absolute bottom-4 right-4",
|
|
221
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
222
|
+
className: "flex items-center gap-3 rounded-lg border bg-background p-1.5 pl-3",
|
|
223
|
+
children: [
|
|
224
|
+
/*#__PURE__*/ jsx(Label, {
|
|
225
|
+
htmlFor: "toolbar-active",
|
|
226
|
+
className: "text-sm font-medium",
|
|
227
|
+
children: "Active"
|
|
228
|
+
}),
|
|
229
|
+
/*#__PURE__*/ jsx(Switch, {
|
|
230
|
+
id: "toolbar-active"
|
|
231
|
+
}),
|
|
232
|
+
/*#__PURE__*/ jsx(Separator, {
|
|
233
|
+
orientation: "vertical",
|
|
234
|
+
className: "h-6"
|
|
235
|
+
}),
|
|
236
|
+
/*#__PURE__*/ jsxs(DropdownMenu, {
|
|
237
|
+
children: [
|
|
238
|
+
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
239
|
+
asChild: true,
|
|
240
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
241
|
+
variant: "ghost",
|
|
242
|
+
size: "icon",
|
|
243
|
+
className: "h-8 w-8",
|
|
244
|
+
children: /*#__PURE__*/ jsx(MoreVertical, {
|
|
245
|
+
className: "h-4 w-4"
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
}),
|
|
249
|
+
/*#__PURE__*/ jsxs(DropdownMenuContent, {
|
|
250
|
+
align: "end",
|
|
251
|
+
children: [
|
|
252
|
+
/*#__PURE__*/ jsx(DropdownMenuItem, {
|
|
253
|
+
children: "Edit"
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ jsx(DropdownMenuItem, {
|
|
256
|
+
children: "Duplicate"
|
|
257
|
+
}),
|
|
258
|
+
/*#__PURE__*/ jsx(DropdownMenuItem, {
|
|
259
|
+
children: "Delete"
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
export { CanvasToolbar, FlowEditorLayout, PublishToolbar };
|