@octaviaflow/core 3.0.18-beta.2 → 3.0.18-beta.20
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/chunk-2NGC7AI3.js +2637 -0
- package/dist/chunk-2NGC7AI3.js.map +1 -0
- package/dist/chunk-2O6K5PLY.js +2637 -0
- package/dist/chunk-2O6K5PLY.js.map +1 -0
- package/dist/chunk-2ZIOFEIS.js +3001 -0
- package/dist/chunk-2ZIOFEIS.js.map +1 -0
- package/dist/chunk-3DWB2PUF.js +2991 -0
- package/dist/chunk-3DWB2PUF.js.map +1 -0
- package/dist/chunk-4ZALUTZS.js +2936 -0
- package/dist/chunk-4ZALUTZS.js.map +1 -0
- package/dist/chunk-5ARKSRED.js +2951 -0
- package/dist/chunk-5ARKSRED.js.map +1 -0
- package/dist/chunk-5OSGSJMM.js +2981 -0
- package/dist/chunk-5OSGSJMM.js.map +1 -0
- package/dist/chunk-5YQQMEF3.js +2981 -0
- package/dist/chunk-5YQQMEF3.js.map +1 -0
- package/dist/chunk-6QCJK7H7.js +2991 -0
- package/dist/chunk-6QCJK7H7.js.map +1 -0
- package/dist/chunk-76TP67ED.js +2984 -0
- package/dist/chunk-76TP67ED.js.map +1 -0
- package/dist/chunk-A6KMO4JV.js +2949 -0
- package/dist/chunk-A6KMO4JV.js.map +1 -0
- package/dist/chunk-B7FTWSTM.js +2938 -0
- package/dist/chunk-B7FTWSTM.js.map +1 -0
- package/dist/chunk-BCO6M26F.js +2940 -0
- package/dist/chunk-BCO6M26F.js.map +1 -0
- package/dist/chunk-C3UD2AZ5.js +2637 -0
- package/dist/chunk-C3UD2AZ5.js.map +1 -0
- package/dist/chunk-CEUP4NK2.js +2850 -0
- package/dist/chunk-CEUP4NK2.js.map +1 -0
- package/dist/chunk-DBNSBJO7.js +2993 -0
- package/dist/chunk-DBNSBJO7.js.map +1 -0
- package/dist/chunk-ECIHUVU7.js +2986 -0
- package/dist/chunk-ECIHUVU7.js.map +1 -0
- package/dist/chunk-EERNYLFL.js +2860 -0
- package/dist/chunk-EERNYLFL.js.map +1 -0
- package/dist/chunk-EKFDJX4G.js +2872 -0
- package/dist/chunk-EKFDJX4G.js.map +1 -0
- package/dist/chunk-GJA3GJUZ.js +2844 -0
- package/dist/chunk-GJA3GJUZ.js.map +1 -0
- package/dist/chunk-HDOTOZNA.js +2936 -0
- package/dist/chunk-HDOTOZNA.js.map +1 -0
- package/dist/chunk-IOKUV7FD.js +2658 -0
- package/dist/chunk-IOKUV7FD.js.map +1 -0
- package/dist/chunk-IUIICQU5.js +2946 -0
- package/dist/chunk-IUIICQU5.js.map +1 -0
- package/dist/chunk-J2UYZI6D.js +2946 -0
- package/dist/chunk-J2UYZI6D.js.map +1 -0
- package/dist/chunk-J7YASALS.js +2859 -0
- package/dist/chunk-J7YASALS.js.map +1 -0
- package/dist/chunk-JIEUYBQT.js +2658 -0
- package/dist/chunk-JIEUYBQT.js.map +1 -0
- package/dist/chunk-K2H7JLQW.js +2952 -0
- package/dist/chunk-K2H7JLQW.js.map +1 -0
- package/dist/chunk-KUXYBP66.js +2953 -0
- package/dist/chunk-KUXYBP66.js.map +1 -0
- package/dist/chunk-KYMYNYFV.js +2656 -0
- package/dist/chunk-KYMYNYFV.js.map +1 -0
- package/dist/chunk-MMXL343D.js +2974 -0
- package/dist/chunk-MMXL343D.js.map +1 -0
- package/dist/chunk-MXJL3EPE.js +2986 -0
- package/dist/chunk-MXJL3EPE.js.map +1 -0
- package/dist/chunk-MYZ25B2R.js +2995 -0
- package/dist/chunk-MYZ25B2R.js.map +1 -0
- package/dist/chunk-NTMEYB7B.js +2949 -0
- package/dist/chunk-NTMEYB7B.js.map +1 -0
- package/dist/chunk-PVJXX6GP.js +2640 -0
- package/dist/chunk-PVJXX6GP.js.map +1 -0
- package/dist/chunk-Q6ERDPQR.js +2981 -0
- package/dist/chunk-Q6ERDPQR.js.map +1 -0
- package/dist/chunk-S2SSBMWJ.js +2658 -0
- package/dist/chunk-S2SSBMWJ.js.map +1 -0
- package/dist/chunk-SLVDAZSX.js +2946 -0
- package/dist/chunk-SLVDAZSX.js.map +1 -0
- package/dist/chunk-UQBPYONV.js +2991 -0
- package/dist/chunk-UQBPYONV.js.map +1 -0
- package/dist/chunk-UXMNBS22.js +2955 -0
- package/dist/chunk-UXMNBS22.js.map +1 -0
- package/dist/chunk-WEGED7TA.js +2991 -0
- package/dist/chunk-WEGED7TA.js.map +1 -0
- package/dist/chunk-WEPTBLWX.js +2847 -0
- package/dist/chunk-WEPTBLWX.js.map +1 -0
- package/dist/chunk-WG4ZQMPS.js +2844 -0
- package/dist/chunk-WG4ZQMPS.js.map +1 -0
- package/dist/chunk-XEPEBHAW.js +2808 -0
- package/dist/chunk-XEPEBHAW.js.map +1 -0
- package/dist/chunk-XG2OYFX6.js +2925 -0
- package/dist/chunk-XG2OYFX6.js.map +1 -0
- package/dist/chunk-ZAMJEU42.js +2992 -0
- package/dist/chunk-ZAMJEU42.js.map +1 -0
- package/dist/chunk-ZRAM6FXB.js +2949 -0
- package/dist/chunk-ZRAM6FXB.js.map +1 -0
- package/dist/components/CsvViewer/CsvViewer.d.ts +51 -0
- package/dist/components/CsvViewer/CsvViewer.d.ts.map +1 -0
- package/dist/components/CsvViewer/index.d.ts +2 -0
- package/dist/components/CsvViewer/index.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +19 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +12 -2
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/ExecutionConsole/ExecutionConsole.d.ts +8 -2
- package/dist/components/ExecutionConsole/ExecutionConsole.d.ts.map +1 -1
- package/dist/components/FlowMinimap/FlowMinimap.d.ts +17 -1
- package/dist/components/FlowMinimap/FlowMinimap.d.ts.map +1 -1
- package/dist/components/FlowToolbar/FlowToolbar.d.ts +16 -10
- package/dist/components/FlowToolbar/FlowToolbar.d.ts.map +1 -1
- package/dist/components/JsonViewer/JsonViewer.d.ts +42 -7
- package/dist/components/JsonViewer/JsonViewer.d.ts.map +1 -1
- package/dist/components/JsonViewer/index.d.ts +1 -1
- package/dist/components/JsonViewer/index.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/WorkflowHeader/WorkflowHeader.d.ts +130 -0
- package/dist/components/WorkflowHeader/WorkflowHeader.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/WorkflowHeaderExpanded.d.ts +69 -0
- package/dist/components/WorkflowHeader/WorkflowHeaderExpanded.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/index.d.ts +3 -0
- package/dist/components/WorkflowHeader/index.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderCentered.d.ts +40 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderCentered.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderCommand.d.ts +39 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderCommand.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderMinimal.d.ts +44 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderMinimal.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderRail.d.ts +45 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderRail.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderStudio.d.ts +48 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderStudio.d.ts.map +1 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderTiered.d.ts +52 -0
- package/dist/components/WorkflowHeader/misc/WorkflowHeaderTiered.d.ts.map +1 -0
- package/dist/components/XmlViewer/XmlViewer.d.ts +26 -1
- package/dist/components/XmlViewer/XmlViewer.d.ts.map +1 -1
- package/dist/components/XmlViewer/index.d.ts +1 -1
- package/dist/components/XmlViewer/index.d.ts.map +1 -1
- package/dist/components/YamlViewer/YamlViewer.d.ts +26 -1
- package/dist/components/YamlViewer/YamlViewer.d.ts.map +1 -1
- package/dist/components/YamlViewer/index.d.ts +1 -1
- package/dist/components/YamlViewer/index.d.ts.map +1 -1
- package/dist/hooks/useRelativeTime.d.ts +28 -0
- package/dist/hooks/useRelativeTime.d.ts.map +1 -0
- package/dist/hooks/useWorkflowRuntime.d.ts +20 -0
- package/dist/hooks/useWorkflowRuntime.d.ts.map +1 -0
- package/dist/index.cjs +4918 -3536
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4317 -3305
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts +27 -9
- package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts.map +1 -1
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts +49 -1
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts.map +1 -1
- package/dist/workflow/components/FlowEdge/FlowEdge.d.ts.map +1 -1
- package/dist/workflow/components/Handle/Handle.d.ts +9 -1
- package/dist/workflow/components/Handle/Handle.d.ts.map +1 -1
- package/dist/workflow/components/Handle/handleRegistry.d.ts +19 -0
- package/dist/workflow/components/Handle/handleRegistry.d.ts.map +1 -1
- package/dist/workflow/components/kinds/index.d.ts +4 -0
- package/dist/workflow/components/kinds/index.d.ts.map +1 -1
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/store/selectors.d.ts +12 -0
- package/dist/workflow/store/selectors.d.ts.map +1 -1
- package/dist/workflow/utils/parenting.d.ts +5 -3
- package/dist/workflow/utils/parenting.d.ts.map +1 -1
- package/dist/workflow.cjs +694 -452
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +86 -265
- package/dist/workflow.js.map +1 -1
- package/package.json +7 -3
package/dist/workflow.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
GroupNode,
|
|
13
13
|
Handle,
|
|
14
14
|
HttpRequestNode,
|
|
15
|
+
NodeResizer,
|
|
15
16
|
OutputNode,
|
|
16
17
|
ParallelNode,
|
|
17
18
|
StickyNode,
|
|
@@ -35,10 +36,21 @@ import {
|
|
|
35
36
|
smoothStepPath,
|
|
36
37
|
stepPath,
|
|
37
38
|
straightPath,
|
|
39
|
+
useConnection,
|
|
40
|
+
useEdgeById,
|
|
41
|
+
useEdges,
|
|
38
42
|
useFlow,
|
|
39
43
|
useFlowNodeContext,
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
useFlowSelector,
|
|
45
|
+
useIsEdgeSelected,
|
|
46
|
+
useIsNodeSelected,
|
|
47
|
+
useNodeById,
|
|
48
|
+
useNodeData,
|
|
49
|
+
useNodes,
|
|
50
|
+
useSelection,
|
|
51
|
+
useViewport,
|
|
52
|
+
useViewportOrNull
|
|
53
|
+
} from "./chunk-2ZIOFEIS.js";
|
|
42
54
|
import {
|
|
43
55
|
cn
|
|
44
56
|
} from "./chunk-ZAUUGK2Y.js";
|
|
@@ -339,60 +351,6 @@ function createElkEngine(elk, defaults = {}) {
|
|
|
339
351
|
};
|
|
340
352
|
}
|
|
341
353
|
|
|
342
|
-
// src/workflow/store/selectors.ts
|
|
343
|
-
import { useMemo as useMemo2, useSyncExternalStore } from "react";
|
|
344
|
-
function useFlowSelector(selector, isEqual = Object.is) {
|
|
345
|
-
void isEqual;
|
|
346
|
-
const store = useFlowStore();
|
|
347
|
-
return useSyncExternalStore(
|
|
348
|
-
store.subscribe,
|
|
349
|
-
() => selector(store.getSnapshot()),
|
|
350
|
-
() => selector(store.getSnapshot())
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
function useNodes() {
|
|
354
|
-
return useFlowSelector((s) => s.nodes);
|
|
355
|
-
}
|
|
356
|
-
function useEdges() {
|
|
357
|
-
return useFlowSelector((s) => s.edges);
|
|
358
|
-
}
|
|
359
|
-
function useViewport() {
|
|
360
|
-
return useFlowSelector((s) => s.viewport);
|
|
361
|
-
}
|
|
362
|
-
function useNodeById(id) {
|
|
363
|
-
return useFlowSelector((s) => s.nodes.find((n) => n.id === id));
|
|
364
|
-
}
|
|
365
|
-
function useNodeData(id) {
|
|
366
|
-
return useFlowSelector(
|
|
367
|
-
(s) => s.nodes.find((n) => n.id === id)?.data ?? void 0
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
function useEdgeById(id) {
|
|
371
|
-
return useFlowSelector((s) => s.edges.find((e) => e.id === id));
|
|
372
|
-
}
|
|
373
|
-
function useIsNodeSelected(id) {
|
|
374
|
-
return useFlowSelector((s) => s.selectedNodeIds.has(id));
|
|
375
|
-
}
|
|
376
|
-
function useIsEdgeSelected(id) {
|
|
377
|
-
return useFlowSelector((s) => s.selectedEdgeIds.has(id));
|
|
378
|
-
}
|
|
379
|
-
function useConnection() {
|
|
380
|
-
return useFlowSelector((s) => s.connection);
|
|
381
|
-
}
|
|
382
|
-
function useSelection() {
|
|
383
|
-
const nodes = useNodes();
|
|
384
|
-
const edges = useEdges();
|
|
385
|
-
const selectedNodeIds = useFlowSelector((s) => s.selectedNodeIds);
|
|
386
|
-
const selectedEdgeIds = useFlowSelector((s) => s.selectedEdgeIds);
|
|
387
|
-
return useMemo2(
|
|
388
|
-
() => ({
|
|
389
|
-
nodes: nodes.filter((n) => selectedNodeIds.has(n.id)),
|
|
390
|
-
edges: edges.filter((e) => selectedEdgeIds.has(e.id))
|
|
391
|
-
}),
|
|
392
|
-
[nodes, edges, selectedNodeIds, selectedEdgeIds]
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
354
|
// src/workflow/components/ConfigPanel/ConfigPanel.tsx
|
|
397
355
|
import {
|
|
398
356
|
useCallback as useCallback3,
|
|
@@ -400,7 +358,7 @@ import {
|
|
|
400
358
|
useRef as useRef3,
|
|
401
359
|
useState as useState3
|
|
402
360
|
} from "react";
|
|
403
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
361
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
404
362
|
var SAVE_STATE_LABEL = {
|
|
405
363
|
clean: "Saved",
|
|
406
364
|
dirty: "Unsaved changes",
|
|
@@ -418,26 +376,27 @@ var SAVE_STATE_DOT = {
|
|
|
418
376
|
function ConfigPanel({
|
|
419
377
|
open = true,
|
|
420
378
|
title,
|
|
421
|
-
kindLabel,
|
|
422
379
|
icon,
|
|
380
|
+
headerActions,
|
|
423
381
|
banner,
|
|
424
382
|
tabs,
|
|
425
383
|
activeTab: controlledActive,
|
|
426
384
|
defaultActiveTab,
|
|
427
385
|
onTabChange,
|
|
428
|
-
saveState
|
|
386
|
+
saveState,
|
|
429
387
|
onTitleChange,
|
|
430
388
|
onClose,
|
|
431
389
|
onSave,
|
|
432
390
|
onCancel,
|
|
391
|
+
padding = 12,
|
|
433
392
|
resizable = true,
|
|
434
|
-
defaultWidth =
|
|
435
|
-
minWidth =
|
|
393
|
+
defaultWidth = 400,
|
|
394
|
+
minWidth = 400,
|
|
436
395
|
maxWidth = 720,
|
|
437
396
|
maxWidthContainerInset = 80,
|
|
438
397
|
variant = "pinned",
|
|
439
398
|
children,
|
|
440
|
-
|
|
399
|
+
footerActions,
|
|
441
400
|
className,
|
|
442
401
|
style
|
|
443
402
|
}) {
|
|
@@ -534,55 +493,53 @@ function ConfigPanel({
|
|
|
534
493
|
"aria-hidden": "true"
|
|
535
494
|
}
|
|
536
495
|
),
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
"input",
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
"button",
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
] })
|
|
585
|
-
] }),
|
|
496
|
+
/* @__PURE__ */ jsx("header", { className: "ods-flow-config-panel__header", children: /* @__PURE__ */ jsxs("div", { className: "ods-flow-config-panel__title-row", children: [
|
|
497
|
+
icon && /* @__PURE__ */ jsx("span", { className: "ods-flow-config-panel__icon", children: icon }),
|
|
498
|
+
editingTitle ? /* @__PURE__ */ jsx(
|
|
499
|
+
"input",
|
|
500
|
+
{
|
|
501
|
+
className: "ods-flow-config-panel__title-input",
|
|
502
|
+
value: draftTitle,
|
|
503
|
+
autoFocus: true,
|
|
504
|
+
onChange: (e) => setDraftTitle(e.target.value),
|
|
505
|
+
onBlur: () => commitTitle(draftTitle),
|
|
506
|
+
onKeyDown: titleKeyDown,
|
|
507
|
+
"aria-label": "Edit title"
|
|
508
|
+
}
|
|
509
|
+
) : /* @__PURE__ */ jsx(
|
|
510
|
+
"button",
|
|
511
|
+
{
|
|
512
|
+
type: "button",
|
|
513
|
+
className: "ods-flow-config-panel__title",
|
|
514
|
+
onDoubleClick: () => {
|
|
515
|
+
if (!onTitleChange) return;
|
|
516
|
+
setDraftTitle(title ?? "");
|
|
517
|
+
setEditingTitle(true);
|
|
518
|
+
},
|
|
519
|
+
title: onTitleChange ? "Double-click to rename" : void 0,
|
|
520
|
+
children: title ?? "Untitled"
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
headerActions && /* @__PURE__ */ jsx("div", { className: "ods-flow-config-panel__header-actions", children: headerActions }),
|
|
524
|
+
onClose && /* @__PURE__ */ jsx(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
type: "button",
|
|
528
|
+
className: "ods-flow-config-panel__close",
|
|
529
|
+
onClick: onClose,
|
|
530
|
+
"aria-label": "Close panel",
|
|
531
|
+
children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
532
|
+
"path",
|
|
533
|
+
{
|
|
534
|
+
d: "M3 3l8 8M11 3l-8 8",
|
|
535
|
+
stroke: "currentColor",
|
|
536
|
+
strokeWidth: "1.5",
|
|
537
|
+
strokeLinecap: "round"
|
|
538
|
+
}
|
|
539
|
+
) })
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
] }) }),
|
|
586
543
|
tabs && tabs.length > 1 && /* @__PURE__ */ jsx("nav", { className: "ods-flow-config-panel__tabs", role: "tablist", children: tabs.map((t) => /* @__PURE__ */ jsxs(
|
|
587
544
|
"button",
|
|
588
545
|
{
|
|
@@ -603,9 +560,17 @@ function ConfigPanel({
|
|
|
603
560
|
t.id
|
|
604
561
|
)) }),
|
|
605
562
|
banner && /* @__PURE__ */ jsx("div", { className: "ods-flow-config-panel__banner", children: banner }),
|
|
606
|
-
/* @__PURE__ */ jsx(
|
|
563
|
+
/* @__PURE__ */ jsx(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
className: "ods-flow-config-panel__body",
|
|
567
|
+
role: "tabpanel",
|
|
568
|
+
style: { padding },
|
|
569
|
+
children: tabs ? activeTab?.content : children
|
|
570
|
+
}
|
|
571
|
+
),
|
|
607
572
|
/* @__PURE__ */ jsxs("footer", { className: "ods-flow-config-panel__footer", children: [
|
|
608
|
-
/* @__PURE__ */ jsxs(
|
|
573
|
+
saveState && /* @__PURE__ */ jsxs(
|
|
609
574
|
"span",
|
|
610
575
|
{
|
|
611
576
|
className: cn(
|
|
@@ -625,7 +590,7 @@ function ConfigPanel({
|
|
|
625
590
|
]
|
|
626
591
|
}
|
|
627
592
|
),
|
|
628
|
-
|
|
593
|
+
/* @__PURE__ */ jsx("div", { className: "ods-flow-config-panel__footer-actions", children: footerActions ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
629
594
|
onCancel && /* @__PURE__ */ jsx(
|
|
630
595
|
"button",
|
|
631
596
|
{
|
|
@@ -641,164 +606,19 @@ function ConfigPanel({
|
|
|
641
606
|
type: "button",
|
|
642
607
|
className: "ods-flow-config-panel__btn ods-flow-config-panel__btn--primary",
|
|
643
608
|
onClick: onSave,
|
|
644
|
-
disabled: saveState === "saving"
|
|
609
|
+
disabled: saveState === "saving",
|
|
645
610
|
children: saveState === "saving" ? "Saving\u2026" : "Save"
|
|
646
611
|
}
|
|
647
612
|
)
|
|
648
|
-
] })
|
|
613
|
+
] }) })
|
|
649
614
|
] })
|
|
650
615
|
]
|
|
651
616
|
}
|
|
652
617
|
);
|
|
653
618
|
}
|
|
654
619
|
|
|
655
|
-
// src/workflow/components/NodeResizer/NodeResizer.tsx
|
|
656
|
-
import { useRef as useRef4 } from "react";
|
|
657
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
658
|
-
function NodeResizer({
|
|
659
|
-
isVisible,
|
|
660
|
-
minWidth = 80,
|
|
661
|
-
minHeight = 60,
|
|
662
|
-
maxWidth,
|
|
663
|
-
maxHeight,
|
|
664
|
-
keepAspectRatio = false,
|
|
665
|
-
onResize,
|
|
666
|
-
onResizeEnd,
|
|
667
|
-
color
|
|
668
|
-
}) {
|
|
669
|
-
const { node, selected } = useFlowNodeContext();
|
|
670
|
-
const viewport = useViewport();
|
|
671
|
-
const flow = useFlow();
|
|
672
|
-
const dragRef = useRef4(null);
|
|
673
|
-
const show = isVisible ?? selected;
|
|
674
|
-
if (!show) return null;
|
|
675
|
-
const beginResize = (e, corner) => {
|
|
676
|
-
e.preventDefault();
|
|
677
|
-
e.stopPropagation();
|
|
678
|
-
e.target.setPointerCapture(e.pointerId);
|
|
679
|
-
const w = node.width ?? DEFAULT_NODE_WIDTH;
|
|
680
|
-
const h = node.height ?? DEFAULT_NODE_HEIGHT;
|
|
681
|
-
dragRef.current = {
|
|
682
|
-
pointerId: e.pointerId,
|
|
683
|
-
corner,
|
|
684
|
-
startClientX: e.clientX,
|
|
685
|
-
startClientY: e.clientY,
|
|
686
|
-
startWidth: w,
|
|
687
|
-
startHeight: h,
|
|
688
|
-
startX: node.position.x,
|
|
689
|
-
startY: node.position.y,
|
|
690
|
-
aspect: w / Math.max(1, h)
|
|
691
|
-
};
|
|
692
|
-
};
|
|
693
|
-
const onMove = (e) => {
|
|
694
|
-
const drag = dragRef.current;
|
|
695
|
-
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
696
|
-
const dx = (e.clientX - drag.startClientX) / viewport.zoom;
|
|
697
|
-
const dy = (e.clientY - drag.startClientY) / viewport.zoom;
|
|
698
|
-
let nextW = drag.startWidth;
|
|
699
|
-
let nextH = drag.startHeight;
|
|
700
|
-
let nextX = drag.startX;
|
|
701
|
-
let nextY = drag.startY;
|
|
702
|
-
switch (drag.corner) {
|
|
703
|
-
case "se":
|
|
704
|
-
nextW = drag.startWidth + dx;
|
|
705
|
-
nextH = drag.startHeight + dy;
|
|
706
|
-
break;
|
|
707
|
-
case "sw":
|
|
708
|
-
nextW = drag.startWidth - dx;
|
|
709
|
-
nextH = drag.startHeight + dy;
|
|
710
|
-
nextX = drag.startX + dx;
|
|
711
|
-
break;
|
|
712
|
-
case "ne":
|
|
713
|
-
nextW = drag.startWidth + dx;
|
|
714
|
-
nextH = drag.startHeight - dy;
|
|
715
|
-
nextY = drag.startY + dy;
|
|
716
|
-
break;
|
|
717
|
-
case "nw":
|
|
718
|
-
nextW = drag.startWidth - dx;
|
|
719
|
-
nextH = drag.startHeight - dy;
|
|
720
|
-
nextX = drag.startX + dx;
|
|
721
|
-
nextY = drag.startY + dy;
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
if (keepAspectRatio) {
|
|
725
|
-
nextH = nextW / drag.aspect;
|
|
726
|
-
if (drag.corner === "nw" || drag.corner === "ne") {
|
|
727
|
-
nextY = drag.startY + (drag.startHeight - nextH);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
nextW = Math.max(minWidth, maxWidth ? Math.min(maxWidth, nextW) : nextW);
|
|
731
|
-
nextH = Math.max(minHeight, maxHeight ? Math.min(maxHeight, nextH) : nextH);
|
|
732
|
-
flow.updateNode(node.id, {
|
|
733
|
-
width: nextW,
|
|
734
|
-
height: nextH,
|
|
735
|
-
position: { x: nextX, y: nextY }
|
|
736
|
-
});
|
|
737
|
-
onResize?.({ width: nextW, height: nextH });
|
|
738
|
-
};
|
|
739
|
-
const onUp = (e) => {
|
|
740
|
-
if (dragRef.current?.pointerId === e.pointerId) {
|
|
741
|
-
const cur = flow.getNode(node.id);
|
|
742
|
-
if (cur) {
|
|
743
|
-
onResizeEnd?.({
|
|
744
|
-
width: cur.width ?? DEFAULT_NODE_WIDTH,
|
|
745
|
-
height: cur.height ?? DEFAULT_NODE_HEIGHT
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
dragRef.current = null;
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
const handleColor = color ?? "var(--ods-accent)";
|
|
752
|
-
const handleStyle = (corner) => {
|
|
753
|
-
const base = {
|
|
754
|
-
position: "absolute",
|
|
755
|
-
width: 12,
|
|
756
|
-
height: 12,
|
|
757
|
-
background: "var(--ods-surface-canvas)",
|
|
758
|
-
border: `2px solid ${handleColor}`,
|
|
759
|
-
borderRadius: 2,
|
|
760
|
-
cursor: cursorFor(corner),
|
|
761
|
-
touchAction: "none",
|
|
762
|
-
// Place each handle so its CENTRE sits on the corresponding corner.
|
|
763
|
-
transform: "translate(-50%, -50%)"
|
|
764
|
-
};
|
|
765
|
-
switch (corner) {
|
|
766
|
-
case "nw":
|
|
767
|
-
return { ...base, top: 0, left: 0 };
|
|
768
|
-
case "ne":
|
|
769
|
-
return { ...base, top: 0, left: "100%" };
|
|
770
|
-
case "sw":
|
|
771
|
-
return { ...base, top: "100%", left: 0 };
|
|
772
|
-
case "se":
|
|
773
|
-
return { ...base, top: "100%", left: "100%" };
|
|
774
|
-
}
|
|
775
|
-
};
|
|
776
|
-
return /* @__PURE__ */ jsx2("div", { className: cn("ods-node-resizer"), "data-flow-no-drag": "true", children: ["nw", "ne", "sw", "se"].map((corner) => /* @__PURE__ */ jsx2(
|
|
777
|
-
"div",
|
|
778
|
-
{
|
|
779
|
-
style: handleStyle(corner),
|
|
780
|
-
onPointerDown: (e) => beginResize(e, corner),
|
|
781
|
-
onPointerMove: onMove,
|
|
782
|
-
onPointerUp: onUp,
|
|
783
|
-
onPointerCancel: onUp,
|
|
784
|
-
"aria-label": `Resize ${corner}`
|
|
785
|
-
},
|
|
786
|
-
corner
|
|
787
|
-
)) });
|
|
788
|
-
}
|
|
789
|
-
function cursorFor(corner) {
|
|
790
|
-
switch (corner) {
|
|
791
|
-
case "nw":
|
|
792
|
-
case "se":
|
|
793
|
-
return "nwse-resize";
|
|
794
|
-
case "ne":
|
|
795
|
-
case "sw":
|
|
796
|
-
return "nesw-resize";
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
620
|
// src/workflow/components/NodeToolbar/NodeToolbar.tsx
|
|
801
|
-
import { jsx as
|
|
621
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
802
622
|
function NodeToolbar({
|
|
803
623
|
isVisible,
|
|
804
624
|
position = "top",
|
|
@@ -813,7 +633,7 @@ function NodeToolbar({
|
|
|
813
633
|
const show = isVisible ?? node.selected;
|
|
814
634
|
if (!show) return null;
|
|
815
635
|
const inverseScale = 1 / viewport.zoom;
|
|
816
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ jsx2(
|
|
817
637
|
"div",
|
|
818
638
|
{
|
|
819
639
|
className: cn("ods-node-toolbar", `ods-node-toolbar--${position}`, className),
|
|
@@ -825,7 +645,7 @@ function NodeToolbar({
|
|
|
825
645
|
onPointerDown: (e) => e.stopPropagation(),
|
|
826
646
|
onMouseDown: (e) => e.stopPropagation(),
|
|
827
647
|
onClick: (e) => e.stopPropagation(),
|
|
828
|
-
children: /* @__PURE__ */
|
|
648
|
+
children: /* @__PURE__ */ jsx2(
|
|
829
649
|
"div",
|
|
830
650
|
{
|
|
831
651
|
className: "ods-node-toolbar__inner",
|
|
@@ -1024,6 +844,7 @@ export {
|
|
|
1024
844
|
useNodeData,
|
|
1025
845
|
useNodes,
|
|
1026
846
|
useSelection,
|
|
1027
|
-
useViewport
|
|
847
|
+
useViewport,
|
|
848
|
+
useViewportOrNull
|
|
1028
849
|
};
|
|
1029
850
|
//# sourceMappingURL=workflow.js.map
|