@octaviaflow/core 3.0.18-beta.8 → 3.0.18-beta.9
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-CEUP4NK2.js +2850 -0
- package/dist/chunk-CEUP4NK2.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-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-S2SSBMWJ.js +2658 -0
- package/dist/chunk-S2SSBMWJ.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/components/WorkflowHeader/WorkflowHeader.d.ts.map +1 -1
- package/dist/index.cjs +736 -441
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts +27 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvas.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.cjs +433 -312
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +5 -149
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14439,10 +14439,26 @@ var import_react71 = require("react");
|
|
|
14439
14439
|
// src/workflow/hooks/useFlow.ts
|
|
14440
14440
|
var import_react69 = require("react");
|
|
14441
14441
|
var FlowInstanceContext = (0, import_react69.createContext)(null);
|
|
14442
|
+
function useFlow() {
|
|
14443
|
+
const instance = (0, import_react69.useContext)(FlowInstanceContext);
|
|
14444
|
+
if (!instance) {
|
|
14445
|
+
throw new Error("[@octaviaflow/core/workflow] useFlow() must be called inside <FlowCanvas>.");
|
|
14446
|
+
}
|
|
14447
|
+
return instance;
|
|
14448
|
+
}
|
|
14442
14449
|
|
|
14443
14450
|
// src/workflow/store/context.ts
|
|
14444
14451
|
var import_react70 = require("react");
|
|
14445
14452
|
var FlowStoreContext = (0, import_react70.createContext)(null);
|
|
14453
|
+
function useFlowStore() {
|
|
14454
|
+
const store = (0, import_react70.useContext)(FlowStoreContext);
|
|
14455
|
+
if (!store) {
|
|
14456
|
+
throw new Error(
|
|
14457
|
+
"[@octaviaflow/core/workflow] useFlowStore must be called inside a <FlowCanvas>."
|
|
14458
|
+
);
|
|
14459
|
+
}
|
|
14460
|
+
return store;
|
|
14461
|
+
}
|
|
14446
14462
|
|
|
14447
14463
|
// src/components/FlowMinimap/FlowMinimap.tsx
|
|
14448
14464
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -14806,6 +14822,18 @@ var import_react74 = require("react");
|
|
|
14806
14822
|
|
|
14807
14823
|
// src/workflow/store/selectors.ts
|
|
14808
14824
|
var import_react72 = require("react");
|
|
14825
|
+
function useFlowSelector(selector, isEqual = Object.is) {
|
|
14826
|
+
void isEqual;
|
|
14827
|
+
const store = useFlowStore();
|
|
14828
|
+
return (0, import_react72.useSyncExternalStore)(
|
|
14829
|
+
store.subscribe,
|
|
14830
|
+
() => selector(store.getSnapshot()),
|
|
14831
|
+
() => selector(store.getSnapshot())
|
|
14832
|
+
);
|
|
14833
|
+
}
|
|
14834
|
+
function useViewport() {
|
|
14835
|
+
return useFlowSelector((s) => s.viewport);
|
|
14836
|
+
}
|
|
14809
14837
|
var VIEWPORT_OR_NULL_NO_STORE_SUBSCRIBE = (_cb) => () => {
|
|
14810
14838
|
};
|
|
14811
14839
|
var VIEWPORT_OR_NULL_NO_STORE_SNAPSHOT = () => null;
|
|
@@ -28657,7 +28685,7 @@ var UserCard = (0, import_react144.forwardRef)(
|
|
|
28657
28685
|
UserCard.displayName = "UserCard";
|
|
28658
28686
|
|
|
28659
28687
|
// src/components/WorkflowEditor/WorkflowEditor.tsx
|
|
28660
|
-
var
|
|
28688
|
+
var import_react155 = require("react");
|
|
28661
28689
|
|
|
28662
28690
|
// src/hooks/useWorkflow.ts
|
|
28663
28691
|
var import_react145 = require("react");
|
|
@@ -29352,7 +29380,7 @@ function useWorkflow(options = {}) {
|
|
|
29352
29380
|
}
|
|
29353
29381
|
|
|
29354
29382
|
// src/workflow/components/FlowCanvas/FlowCanvas.tsx
|
|
29355
|
-
var
|
|
29383
|
+
var import_react154 = require("react");
|
|
29356
29384
|
|
|
29357
29385
|
// src/workflow/store/changes.ts
|
|
29358
29386
|
function applyNodeChanges(nodes, changes) {
|
|
@@ -30224,10 +30252,155 @@ function handleSideStyle(side, index, total) {
|
|
|
30224
30252
|
}
|
|
30225
30253
|
}
|
|
30226
30254
|
|
|
30227
|
-
// src/workflow/components/
|
|
30228
|
-
var import_icons49 = require("@octaviaflow/icons");
|
|
30255
|
+
// src/workflow/components/NodeResizer/NodeResizer.tsx
|
|
30229
30256
|
var import_react152 = require("react");
|
|
30230
30257
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
30258
|
+
function NodeResizer({
|
|
30259
|
+
isVisible,
|
|
30260
|
+
minWidth = 80,
|
|
30261
|
+
minHeight = 60,
|
|
30262
|
+
maxWidth,
|
|
30263
|
+
maxHeight,
|
|
30264
|
+
keepAspectRatio = false,
|
|
30265
|
+
onResize,
|
|
30266
|
+
onResizeEnd,
|
|
30267
|
+
color
|
|
30268
|
+
}) {
|
|
30269
|
+
const { node, selected } = useFlowNodeContext();
|
|
30270
|
+
const viewport = useViewport();
|
|
30271
|
+
const flow = useFlow();
|
|
30272
|
+
const dragRef = (0, import_react152.useRef)(null);
|
|
30273
|
+
const show = isVisible ?? selected;
|
|
30274
|
+
if (!show) return null;
|
|
30275
|
+
const beginResize = (e, corner) => {
|
|
30276
|
+
e.preventDefault();
|
|
30277
|
+
e.stopPropagation();
|
|
30278
|
+
e.target.setPointerCapture(e.pointerId);
|
|
30279
|
+
const w = node.width ?? DEFAULT_NODE_WIDTH3;
|
|
30280
|
+
const h = node.height ?? DEFAULT_NODE_HEIGHT3;
|
|
30281
|
+
dragRef.current = {
|
|
30282
|
+
pointerId: e.pointerId,
|
|
30283
|
+
corner,
|
|
30284
|
+
startClientX: e.clientX,
|
|
30285
|
+
startClientY: e.clientY,
|
|
30286
|
+
startWidth: w,
|
|
30287
|
+
startHeight: h,
|
|
30288
|
+
startX: node.position.x,
|
|
30289
|
+
startY: node.position.y,
|
|
30290
|
+
aspect: w / Math.max(1, h)
|
|
30291
|
+
};
|
|
30292
|
+
};
|
|
30293
|
+
const onMove = (e) => {
|
|
30294
|
+
const drag = dragRef.current;
|
|
30295
|
+
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
30296
|
+
const dx = (e.clientX - drag.startClientX) / viewport.zoom;
|
|
30297
|
+
const dy = (e.clientY - drag.startClientY) / viewport.zoom;
|
|
30298
|
+
let nextW = drag.startWidth;
|
|
30299
|
+
let nextH = drag.startHeight;
|
|
30300
|
+
let nextX = drag.startX;
|
|
30301
|
+
let nextY = drag.startY;
|
|
30302
|
+
switch (drag.corner) {
|
|
30303
|
+
case "se":
|
|
30304
|
+
nextW = drag.startWidth + dx;
|
|
30305
|
+
nextH = drag.startHeight + dy;
|
|
30306
|
+
break;
|
|
30307
|
+
case "sw":
|
|
30308
|
+
nextW = drag.startWidth - dx;
|
|
30309
|
+
nextH = drag.startHeight + dy;
|
|
30310
|
+
nextX = drag.startX + dx;
|
|
30311
|
+
break;
|
|
30312
|
+
case "ne":
|
|
30313
|
+
nextW = drag.startWidth + dx;
|
|
30314
|
+
nextH = drag.startHeight - dy;
|
|
30315
|
+
nextY = drag.startY + dy;
|
|
30316
|
+
break;
|
|
30317
|
+
case "nw":
|
|
30318
|
+
nextW = drag.startWidth - dx;
|
|
30319
|
+
nextH = drag.startHeight - dy;
|
|
30320
|
+
nextX = drag.startX + dx;
|
|
30321
|
+
nextY = drag.startY + dy;
|
|
30322
|
+
break;
|
|
30323
|
+
}
|
|
30324
|
+
if (keepAspectRatio) {
|
|
30325
|
+
nextH = nextW / drag.aspect;
|
|
30326
|
+
if (drag.corner === "nw" || drag.corner === "ne") {
|
|
30327
|
+
nextY = drag.startY + (drag.startHeight - nextH);
|
|
30328
|
+
}
|
|
30329
|
+
}
|
|
30330
|
+
nextW = Math.max(minWidth, maxWidth ? Math.min(maxWidth, nextW) : nextW);
|
|
30331
|
+
nextH = Math.max(minHeight, maxHeight ? Math.min(maxHeight, nextH) : nextH);
|
|
30332
|
+
flow.updateNode(node.id, {
|
|
30333
|
+
width: nextW,
|
|
30334
|
+
height: nextH,
|
|
30335
|
+
position: { x: nextX, y: nextY }
|
|
30336
|
+
});
|
|
30337
|
+
onResize?.({ width: nextW, height: nextH });
|
|
30338
|
+
};
|
|
30339
|
+
const onUp = (e) => {
|
|
30340
|
+
if (dragRef.current?.pointerId === e.pointerId) {
|
|
30341
|
+
const cur = flow.getNode(node.id);
|
|
30342
|
+
if (cur) {
|
|
30343
|
+
onResizeEnd?.({
|
|
30344
|
+
width: cur.width ?? DEFAULT_NODE_WIDTH3,
|
|
30345
|
+
height: cur.height ?? DEFAULT_NODE_HEIGHT3
|
|
30346
|
+
});
|
|
30347
|
+
}
|
|
30348
|
+
dragRef.current = null;
|
|
30349
|
+
}
|
|
30350
|
+
};
|
|
30351
|
+
const handleColor = color ?? "var(--ods-accent)";
|
|
30352
|
+
const handleStyle = (corner) => {
|
|
30353
|
+
const base = {
|
|
30354
|
+
position: "absolute",
|
|
30355
|
+
width: 12,
|
|
30356
|
+
height: 12,
|
|
30357
|
+
background: "var(--ods-surface-canvas)",
|
|
30358
|
+
border: `2px solid ${handleColor}`,
|
|
30359
|
+
borderRadius: 2,
|
|
30360
|
+
cursor: cursorFor(corner),
|
|
30361
|
+
touchAction: "none",
|
|
30362
|
+
// Place each handle so its CENTRE sits on the corresponding corner.
|
|
30363
|
+
transform: "translate(-50%, -50%)"
|
|
30364
|
+
};
|
|
30365
|
+
switch (corner) {
|
|
30366
|
+
case "nw":
|
|
30367
|
+
return { ...base, top: 0, left: 0 };
|
|
30368
|
+
case "ne":
|
|
30369
|
+
return { ...base, top: 0, left: "100%" };
|
|
30370
|
+
case "sw":
|
|
30371
|
+
return { ...base, top: "100%", left: 0 };
|
|
30372
|
+
case "se":
|
|
30373
|
+
return { ...base, top: "100%", left: "100%" };
|
|
30374
|
+
}
|
|
30375
|
+
};
|
|
30376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: cn("ods-node-resizer"), "data-flow-no-drag": "true", children: ["nw", "ne", "sw", "se"].map((corner) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
30377
|
+
"div",
|
|
30378
|
+
{
|
|
30379
|
+
style: handleStyle(corner),
|
|
30380
|
+
onPointerDown: (e) => beginResize(e, corner),
|
|
30381
|
+
onPointerMove: onMove,
|
|
30382
|
+
onPointerUp: onUp,
|
|
30383
|
+
onPointerCancel: onUp,
|
|
30384
|
+
"aria-label": `Resize ${corner}`
|
|
30385
|
+
},
|
|
30386
|
+
corner
|
|
30387
|
+
)) });
|
|
30388
|
+
}
|
|
30389
|
+
function cursorFor(corner) {
|
|
30390
|
+
switch (corner) {
|
|
30391
|
+
case "nw":
|
|
30392
|
+
case "se":
|
|
30393
|
+
return "nwse-resize";
|
|
30394
|
+
case "ne":
|
|
30395
|
+
case "sw":
|
|
30396
|
+
return "nesw-resize";
|
|
30397
|
+
}
|
|
30398
|
+
}
|
|
30399
|
+
|
|
30400
|
+
// src/workflow/components/kinds/BaseNode.tsx
|
|
30401
|
+
var import_icons49 = require("@octaviaflow/icons");
|
|
30402
|
+
var import_react153 = require("react");
|
|
30403
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
30231
30404
|
function BaseNode({
|
|
30232
30405
|
kind,
|
|
30233
30406
|
kindIcon,
|
|
@@ -30243,10 +30416,10 @@ function BaseNode({
|
|
|
30243
30416
|
className,
|
|
30244
30417
|
children
|
|
30245
30418
|
}) {
|
|
30246
|
-
const ctx = (0,
|
|
30247
|
-
const bridge = (0,
|
|
30419
|
+
const ctx = (0, import_react153.useContext)(FlowNodeContext);
|
|
30420
|
+
const bridge = (0, import_react153.useContext)(FlowNodeBridgeContext);
|
|
30248
30421
|
const deleteHandler = onDelete === false ? void 0 : onDelete ?? (ctx && bridge ? () => bridge.deleteNode(ctx.id) : void 0);
|
|
30249
|
-
return /* @__PURE__ */ (0,
|
|
30422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
30250
30423
|
"div",
|
|
30251
30424
|
{
|
|
30252
30425
|
className: cn(
|
|
@@ -30256,31 +30429,31 @@ function BaseNode({
|
|
|
30256
30429
|
className
|
|
30257
30430
|
),
|
|
30258
30431
|
children: [
|
|
30259
|
-
/* @__PURE__ */ (0,
|
|
30260
|
-
kindIcon && /* @__PURE__ */ (0,
|
|
30261
|
-
/* @__PURE__ */ (0,
|
|
30432
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "ods-flow-base-node__pill", children: [
|
|
30433
|
+
kindIcon && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ods-flow-base-node__pill-icon", "aria-hidden": "true", children: kindIcon }),
|
|
30434
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ods-flow-base-node__pill-label", children: kind })
|
|
30262
30435
|
] }),
|
|
30263
|
-
status && status !== "idle" && /* @__PURE__ */ (0,
|
|
30436
|
+
status && status !== "idle" && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
30264
30437
|
"span",
|
|
30265
30438
|
{
|
|
30266
30439
|
className: cn("ods-flow-base-node__status", `ods-flow-base-node__status--${status}`),
|
|
30267
30440
|
"aria-hidden": "true"
|
|
30268
30441
|
}
|
|
30269
30442
|
),
|
|
30270
|
-
/* @__PURE__ */ (0,
|
|
30271
|
-
/* @__PURE__ */ (0,
|
|
30272
|
-
/* @__PURE__ */ (0,
|
|
30273
|
-
/* @__PURE__ */ (0,
|
|
30274
|
-
/* @__PURE__ */ (0,
|
|
30275
|
-
(chip !== void 0 || description !== void 0 || valueChip !== void 0) && /* @__PURE__ */ (0,
|
|
30276
|
-
chip !== void 0 && /* @__PURE__ */ (0,
|
|
30277
|
-
description !== void 0 && /* @__PURE__ */ (0,
|
|
30278
|
-
valueChip !== void 0 && /* @__PURE__ */ (0,
|
|
30443
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "ods-flow-base-node__body", children: [
|
|
30444
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "ods-flow-base-node__content", children: [
|
|
30445
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ods-flow-base-node__bubble", "aria-hidden": "true", children: icon }),
|
|
30446
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "ods-flow-base-node__content-text", children: [
|
|
30447
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ods-flow-base-node__content-title", children: title }),
|
|
30448
|
+
(chip !== void 0 || description !== void 0 || valueChip !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "ods-flow-base-node__content-info", children: [
|
|
30449
|
+
chip !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ods-flow-base-node__chip", children: chip }),
|
|
30450
|
+
description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ods-flow-base-node__description", children: description }),
|
|
30451
|
+
valueChip !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ods-flow-base-node__value-chip", children: valueChip })
|
|
30279
30452
|
] })
|
|
30280
30453
|
] })
|
|
30281
30454
|
] }),
|
|
30282
|
-
footer && /* @__PURE__ */ (0,
|
|
30283
|
-
deleteHandler && /* @__PURE__ */ (0,
|
|
30455
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ods-flow-base-node__footer", children: footer }),
|
|
30456
|
+
deleteHandler && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
30284
30457
|
"button",
|
|
30285
30458
|
{
|
|
30286
30459
|
type: "button",
|
|
@@ -30292,7 +30465,7 @@ function BaseNode({
|
|
|
30292
30465
|
"aria-label": "Delete node",
|
|
30293
30466
|
"data-flow-no-drag": "true",
|
|
30294
30467
|
title: "Delete node",
|
|
30295
|
-
children: /* @__PURE__ */ (0,
|
|
30468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons49.TrashCanIcon, { size: 16, "aria-hidden": true })
|
|
30296
30469
|
}
|
|
30297
30470
|
)
|
|
30298
30471
|
] }),
|
|
@@ -30303,12 +30476,12 @@ function BaseNode({
|
|
|
30303
30476
|
}
|
|
30304
30477
|
|
|
30305
30478
|
// src/workflow/components/kinds/index.tsx
|
|
30306
|
-
var
|
|
30479
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30307
30480
|
var ActionNode = ({
|
|
30308
30481
|
node
|
|
30309
30482
|
}) => {
|
|
30310
30483
|
const d = node.data ?? {};
|
|
30311
|
-
return /* @__PURE__ */ (0,
|
|
30484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30312
30485
|
BaseNode,
|
|
30313
30486
|
{
|
|
30314
30487
|
kind: d.kind ?? "ACTION",
|
|
@@ -30320,8 +30493,8 @@ var ActionNode = ({
|
|
|
30320
30493
|
status: d.status,
|
|
30321
30494
|
accent: "green",
|
|
30322
30495
|
children: [
|
|
30323
|
-
/* @__PURE__ */ (0,
|
|
30324
|
-
/* @__PURE__ */ (0,
|
|
30496
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30497
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30325
30498
|
]
|
|
30326
30499
|
}
|
|
30327
30500
|
);
|
|
@@ -30330,7 +30503,7 @@ var TriggerNode = ({
|
|
|
30330
30503
|
node
|
|
30331
30504
|
}) => {
|
|
30332
30505
|
const d = node.data ?? {};
|
|
30333
|
-
return /* @__PURE__ */ (0,
|
|
30506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30334
30507
|
BaseNode,
|
|
30335
30508
|
{
|
|
30336
30509
|
kind: d.kind ?? "TRIGGER",
|
|
@@ -30341,7 +30514,7 @@ var TriggerNode = ({
|
|
|
30341
30514
|
valueChip: d.valueChip,
|
|
30342
30515
|
status: d.status,
|
|
30343
30516
|
accent: "green",
|
|
30344
|
-
children: /* @__PURE__ */ (0,
|
|
30517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30345
30518
|
}
|
|
30346
30519
|
);
|
|
30347
30520
|
};
|
|
@@ -30353,7 +30526,7 @@ var ConditionNode = ({
|
|
|
30353
30526
|
{ id: "true", label: "true" },
|
|
30354
30527
|
{ id: "false", label: "false" }
|
|
30355
30528
|
];
|
|
30356
|
-
return /* @__PURE__ */ (0,
|
|
30529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30357
30530
|
BaseNode,
|
|
30358
30531
|
{
|
|
30359
30532
|
kind: d.kind ?? "CONDITION",
|
|
@@ -30365,8 +30538,8 @@ var ConditionNode = ({
|
|
|
30365
30538
|
status: d.status,
|
|
30366
30539
|
accent: "amber",
|
|
30367
30540
|
children: [
|
|
30368
|
-
/* @__PURE__ */ (0,
|
|
30369
|
-
branches.map((b, i) => /* @__PURE__ */ (0,
|
|
30541
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30542
|
+
branches.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30370
30543
|
Handle,
|
|
30371
30544
|
{
|
|
30372
30545
|
type: "source",
|
|
@@ -30387,24 +30560,27 @@ var GroupNode = ({
|
|
|
30387
30560
|
}) => {
|
|
30388
30561
|
const d = node.data ?? {};
|
|
30389
30562
|
const collapsed = !!d.collapsed;
|
|
30563
|
+
const disabled = !!d.disabled;
|
|
30390
30564
|
const hiddenCount = d.hiddenCount;
|
|
30391
30565
|
const bridge = useFlowNodeBridge();
|
|
30392
30566
|
const onChevronClick = (e) => {
|
|
30393
30567
|
e.stopPropagation();
|
|
30394
30568
|
bridge.toggleNodeCollapse(node.id);
|
|
30395
30569
|
};
|
|
30396
|
-
return /* @__PURE__ */ (0,
|
|
30570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30397
30571
|
"div",
|
|
30398
30572
|
{
|
|
30399
30573
|
className: "ods-flow-group",
|
|
30400
30574
|
"data-collapsed": collapsed ? "true" : "false",
|
|
30575
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
30401
30576
|
style: {
|
|
30402
30577
|
width: node.width ?? 360,
|
|
30403
30578
|
height: collapsed ? 36 : node.height ?? 200
|
|
30404
30579
|
},
|
|
30405
30580
|
children: [
|
|
30406
|
-
/* @__PURE__ */ (0,
|
|
30407
|
-
|
|
30581
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(NodeResizer, { minWidth: 240, minHeight: 120 }),
|
|
30582
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ods-flow-group__header", "data-flow-no-drag": "false", children: [
|
|
30583
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30408
30584
|
"button",
|
|
30409
30585
|
{
|
|
30410
30586
|
type: "button",
|
|
@@ -30417,15 +30593,16 @@ var GroupNode = ({
|
|
|
30417
30593
|
children: collapsed ? "\u25B8" : "\u25BE"
|
|
30418
30594
|
}
|
|
30419
30595
|
),
|
|
30420
|
-
/* @__PURE__ */ (0,
|
|
30421
|
-
d.subtitle && /* @__PURE__ */ (0,
|
|
30422
|
-
|
|
30596
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-group__title", children: d.title ?? "Group" }),
|
|
30597
|
+
d.subtitle && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-group__subtitle", children: d.subtitle }),
|
|
30598
|
+
disabled && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-group__disabled-badge", "aria-label": "Disabled subflow", children: "Disabled" }),
|
|
30599
|
+
collapsed && hiddenCount !== void 0 && hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { className: "ods-flow-group__count", "aria-label": `${hiddenCount} hidden steps`, children: [
|
|
30423
30600
|
hiddenCount,
|
|
30424
30601
|
" steps"
|
|
30425
30602
|
] })
|
|
30426
30603
|
] }),
|
|
30427
|
-
/* @__PURE__ */ (0,
|
|
30428
|
-
/* @__PURE__ */ (0,
|
|
30604
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top", id: "__group_in" }),
|
|
30605
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom", id: "__group_out" })
|
|
30429
30606
|
]
|
|
30430
30607
|
}
|
|
30431
30608
|
);
|
|
@@ -30436,24 +30613,27 @@ var ForEachNode = ({
|
|
|
30436
30613
|
const d = node.data ?? {};
|
|
30437
30614
|
const iteratorExpr = d.iterator ?? d.description ?? "items[]";
|
|
30438
30615
|
const collapsed = !!d.collapsed;
|
|
30616
|
+
const disabled = !!d.disabled;
|
|
30439
30617
|
const hiddenCount = d.hiddenCount;
|
|
30440
30618
|
const bridge = useFlowNodeBridge();
|
|
30441
30619
|
const onChevronClick = (e) => {
|
|
30442
30620
|
e.stopPropagation();
|
|
30443
30621
|
bridge.toggleNodeCollapse(node.id);
|
|
30444
30622
|
};
|
|
30445
|
-
return /* @__PURE__ */ (0,
|
|
30623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30446
30624
|
"div",
|
|
30447
30625
|
{
|
|
30448
30626
|
className: "ods-flow-foreach",
|
|
30449
30627
|
"data-collapsed": collapsed ? "true" : "false",
|
|
30628
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
30450
30629
|
style: {
|
|
30451
30630
|
width: node.width ?? 420,
|
|
30452
30631
|
height: collapsed ? 40 : node.height ?? 260
|
|
30453
30632
|
},
|
|
30454
30633
|
children: [
|
|
30455
|
-
/* @__PURE__ */ (0,
|
|
30456
|
-
|
|
30634
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(NodeResizer, { minWidth: 240, minHeight: 120 }),
|
|
30635
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ods-flow-foreach__header", children: [
|
|
30636
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30457
30637
|
"button",
|
|
30458
30638
|
{
|
|
30459
30639
|
type: "button",
|
|
@@ -30466,24 +30646,57 @@ var ForEachNode = ({
|
|
|
30466
30646
|
children: collapsed ? "\u25B8" : "\u25BE"
|
|
30467
30647
|
}
|
|
30468
30648
|
),
|
|
30469
|
-
/* @__PURE__ */ (0,
|
|
30470
|
-
/* @__PURE__ */ (0,
|
|
30471
|
-
/* @__PURE__ */ (0,
|
|
30472
|
-
|
|
30649
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-foreach__icon", "aria-hidden": "true", children: "\u21BB" }),
|
|
30650
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-foreach__title", children: d.title ?? "For each" }),
|
|
30651
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("code", { className: "ods-flow-foreach__iterator", children: iteratorExpr }),
|
|
30652
|
+
disabled && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30653
|
+
"span",
|
|
30654
|
+
{
|
|
30655
|
+
className: "ods-flow-foreach__disabled-badge",
|
|
30656
|
+
"aria-label": "Disabled subflow",
|
|
30657
|
+
children: "Disabled"
|
|
30658
|
+
}
|
|
30659
|
+
),
|
|
30660
|
+
collapsed && hiddenCount !== void 0 && hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { className: "ods-flow-foreach__count", "aria-label": `${hiddenCount} hidden steps`, children: [
|
|
30473
30661
|
hiddenCount,
|
|
30474
30662
|
" steps"
|
|
30475
30663
|
] })
|
|
30476
30664
|
] }),
|
|
30477
|
-
/* @__PURE__ */ (0,
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
|
|
30484
|
-
|
|
30485
|
-
|
|
30486
|
-
|
|
30665
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top", id: "__group_in", label: !collapsed ? "in" : void 0 }),
|
|
30666
|
+
collapsed ? (
|
|
30667
|
+
// Collapsed: single bottom exit so the container behaves like a
|
|
30668
|
+
// regular action in the chain.
|
|
30669
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom", id: "__group_out" })
|
|
30670
|
+
) : (
|
|
30671
|
+
// Expanded: two bottom outputs spread across the bottom edge.
|
|
30672
|
+
// Index/total tell the Handle to position them at 33% and 66%
|
|
30673
|
+
// along the edge (per `handleSideStyle`). `each` is left of
|
|
30674
|
+
// centre, `__group_out` (labelled "done") is right of centre.
|
|
30675
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
|
|
30676
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30677
|
+
Handle,
|
|
30678
|
+
{
|
|
30679
|
+
type: "source",
|
|
30680
|
+
position: "bottom",
|
|
30681
|
+
id: "each",
|
|
30682
|
+
label: "each",
|
|
30683
|
+
index: 0,
|
|
30684
|
+
total: 2
|
|
30685
|
+
}
|
|
30686
|
+
),
|
|
30687
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30688
|
+
Handle,
|
|
30689
|
+
{
|
|
30690
|
+
type: "source",
|
|
30691
|
+
position: "bottom",
|
|
30692
|
+
id: "__group_out",
|
|
30693
|
+
label: "done",
|
|
30694
|
+
index: 1,
|
|
30695
|
+
total: 2
|
|
30696
|
+
}
|
|
30697
|
+
)
|
|
30698
|
+
] })
|
|
30699
|
+
)
|
|
30487
30700
|
]
|
|
30488
30701
|
}
|
|
30489
30702
|
);
|
|
@@ -30492,7 +30705,7 @@ var OutputNode = ({
|
|
|
30492
30705
|
node
|
|
30493
30706
|
}) => {
|
|
30494
30707
|
const d = node.data ?? {};
|
|
30495
|
-
return /* @__PURE__ */ (0,
|
|
30708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30496
30709
|
BaseNode,
|
|
30497
30710
|
{
|
|
30498
30711
|
kind: d.kind ?? "OUTPUT",
|
|
@@ -30502,7 +30715,7 @@ var OutputNode = ({
|
|
|
30502
30715
|
description: d.description ?? d.subtitle,
|
|
30503
30716
|
status: d.status,
|
|
30504
30717
|
accent: "green",
|
|
30505
|
-
children: /* @__PURE__ */ (0,
|
|
30718
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" })
|
|
30506
30719
|
}
|
|
30507
30720
|
);
|
|
30508
30721
|
};
|
|
@@ -30510,7 +30723,7 @@ var ErrorNode = ({
|
|
|
30510
30723
|
node
|
|
30511
30724
|
}) => {
|
|
30512
30725
|
const d = node.data ?? {};
|
|
30513
|
-
return /* @__PURE__ */ (0,
|
|
30726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30514
30727
|
BaseNode,
|
|
30515
30728
|
{
|
|
30516
30729
|
kind: d.kind ?? "ERROR",
|
|
@@ -30521,8 +30734,8 @@ var ErrorNode = ({
|
|
|
30521
30734
|
status: d.status ?? "error",
|
|
30522
30735
|
accent: "red",
|
|
30523
30736
|
children: [
|
|
30524
|
-
/* @__PURE__ */ (0,
|
|
30525
|
-
/* @__PURE__ */ (0,
|
|
30737
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30738
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30526
30739
|
]
|
|
30527
30740
|
}
|
|
30528
30741
|
);
|
|
@@ -30533,7 +30746,7 @@ var WaitNode = ({
|
|
|
30533
30746
|
const d = node.data ?? {};
|
|
30534
30747
|
const waitMs = d.waitMs;
|
|
30535
30748
|
const durationChip = waitMs ? `${Math.round(waitMs / 100) / 10}s` : void 0;
|
|
30536
|
-
return /* @__PURE__ */ (0,
|
|
30749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30537
30750
|
BaseNode,
|
|
30538
30751
|
{
|
|
30539
30752
|
kind: d.kind ?? "WAIT",
|
|
@@ -30544,8 +30757,8 @@ var WaitNode = ({
|
|
|
30544
30757
|
status: d.status,
|
|
30545
30758
|
accent: "violet",
|
|
30546
30759
|
children: [
|
|
30547
|
-
/* @__PURE__ */ (0,
|
|
30548
|
-
/* @__PURE__ */ (0,
|
|
30760
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30761
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30549
30762
|
]
|
|
30550
30763
|
}
|
|
30551
30764
|
);
|
|
@@ -30558,7 +30771,7 @@ var ParallelNode = ({
|
|
|
30558
30771
|
{ id: "a", label: "a" },
|
|
30559
30772
|
{ id: "b", label: "b" }
|
|
30560
30773
|
];
|
|
30561
|
-
return /* @__PURE__ */ (0,
|
|
30774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30562
30775
|
BaseNode,
|
|
30563
30776
|
{
|
|
30564
30777
|
kind: d.kind ?? "PARALLEL",
|
|
@@ -30569,8 +30782,8 @@ var ParallelNode = ({
|
|
|
30569
30782
|
status: d.status,
|
|
30570
30783
|
accent: "blue",
|
|
30571
30784
|
children: [
|
|
30572
|
-
/* @__PURE__ */ (0,
|
|
30573
|
-
branches.map((b, i) => /* @__PURE__ */ (0,
|
|
30785
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30786
|
+
branches.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30574
30787
|
Handle,
|
|
30575
30788
|
{
|
|
30576
30789
|
type: "source",
|
|
@@ -30590,7 +30803,7 @@ var StickyNode = ({
|
|
|
30590
30803
|
node
|
|
30591
30804
|
}) => {
|
|
30592
30805
|
const d = node.data ?? {};
|
|
30593
|
-
return /* @__PURE__ */ (0,
|
|
30806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30594
30807
|
"div",
|
|
30595
30808
|
{
|
|
30596
30809
|
className: "ods-flow-sticky",
|
|
@@ -30599,8 +30812,8 @@ var StickyNode = ({
|
|
|
30599
30812
|
minHeight: node.height ?? 120
|
|
30600
30813
|
},
|
|
30601
30814
|
children: [
|
|
30602
|
-
d.title && /* @__PURE__ */ (0,
|
|
30603
|
-
d.description && /* @__PURE__ */ (0,
|
|
30815
|
+
d.title && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ods-flow-sticky__title", children: d.title }),
|
|
30816
|
+
d.description && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ods-flow-sticky__body", children: d.description })
|
|
30604
30817
|
]
|
|
30605
30818
|
}
|
|
30606
30819
|
);
|
|
@@ -30609,7 +30822,7 @@ var WebhookNode = ({
|
|
|
30609
30822
|
node
|
|
30610
30823
|
}) => {
|
|
30611
30824
|
const d = node.data ?? {};
|
|
30612
|
-
return /* @__PURE__ */ (0,
|
|
30825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30613
30826
|
BaseNode,
|
|
30614
30827
|
{
|
|
30615
30828
|
kind: d.kind ?? "WEBHOOK",
|
|
@@ -30620,7 +30833,7 @@ var WebhookNode = ({
|
|
|
30620
30833
|
valueChip: d.valueChip,
|
|
30621
30834
|
status: d.status,
|
|
30622
30835
|
accent: "blue",
|
|
30623
|
-
children: /* @__PURE__ */ (0,
|
|
30836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30624
30837
|
}
|
|
30625
30838
|
);
|
|
30626
30839
|
};
|
|
@@ -30628,7 +30841,7 @@ var HttpRequestNode = ({
|
|
|
30628
30841
|
node
|
|
30629
30842
|
}) => {
|
|
30630
30843
|
const d = node.data ?? {};
|
|
30631
|
-
return /* @__PURE__ */ (0,
|
|
30844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
30632
30845
|
BaseNode,
|
|
30633
30846
|
{
|
|
30634
30847
|
kind: d.kind ?? "HTTP",
|
|
@@ -30640,8 +30853,8 @@ var HttpRequestNode = ({
|
|
|
30640
30853
|
status: d.status,
|
|
30641
30854
|
accent: "blue",
|
|
30642
30855
|
children: [
|
|
30643
|
-
/* @__PURE__ */ (0,
|
|
30644
|
-
/* @__PURE__ */ (0,
|
|
30856
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
|
|
30857
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom" })
|
|
30645
30858
|
]
|
|
30646
30859
|
}
|
|
30647
30860
|
);
|
|
@@ -30662,7 +30875,7 @@ var DEFAULT_NODE_KINDS = {
|
|
|
30662
30875
|
};
|
|
30663
30876
|
|
|
30664
30877
|
// src/workflow/components/FlowCanvas/FlowCanvas.tsx
|
|
30665
|
-
var
|
|
30878
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
30666
30879
|
var DEFAULT_VIEWPORT2 = { x: 0, y: 0, zoom: 1 };
|
|
30667
30880
|
function FlowCanvas2(props) {
|
|
30668
30881
|
const viewportPropProvided = props.viewport !== void 0 || props.defaultViewport !== void 0;
|
|
@@ -30704,6 +30917,9 @@ function FlowCanvas2(props) {
|
|
|
30704
30917
|
snapToGrid = false,
|
|
30705
30918
|
nodeCollisionGap = -1,
|
|
30706
30919
|
subflowCollisionGap,
|
|
30920
|
+
reparentOnDrag = false,
|
|
30921
|
+
autoResizeContainers = false,
|
|
30922
|
+
containerAutoResizePadding = 32,
|
|
30707
30923
|
height = "100%",
|
|
30708
30924
|
width = "100%",
|
|
30709
30925
|
className,
|
|
@@ -30718,46 +30934,46 @@ function FlowCanvas2(props) {
|
|
|
30718
30934
|
};
|
|
30719
30935
|
const panOnDrag = panOnDragProp ?? presetDefaults[preset].panOnDrag;
|
|
30720
30936
|
const zoomOnScroll = zoomOnScrollProp ?? presetDefaults[preset].zoomOnScroll;
|
|
30721
|
-
const store = (0,
|
|
30937
|
+
const store = (0, import_react154.useState)(
|
|
30722
30938
|
() => createFlowStore({
|
|
30723
30939
|
initialNodes: nodes,
|
|
30724
30940
|
initialEdges: edges,
|
|
30725
30941
|
initialViewport: controlledViewport ?? defaultViewport
|
|
30726
30942
|
})
|
|
30727
30943
|
)[0];
|
|
30728
|
-
const handleRegistry = (0,
|
|
30729
|
-
const [handleVersion, setHandleVersion] = (0,
|
|
30730
|
-
(0,
|
|
30944
|
+
const handleRegistry = (0, import_react154.useState)(() => createHandleRegistry())[0];
|
|
30945
|
+
const [handleVersion, setHandleVersion] = (0, import_react154.useState)(0);
|
|
30946
|
+
(0, import_react154.useEffect)(() => {
|
|
30731
30947
|
const unsub = handleRegistry.subscribe(() => {
|
|
30732
30948
|
setHandleVersion((v) => v + 1);
|
|
30733
30949
|
});
|
|
30734
30950
|
return unsub;
|
|
30735
30951
|
}, [handleRegistry]);
|
|
30736
|
-
const kinds = (0,
|
|
30737
|
-
const containerRef = (0,
|
|
30738
|
-
(0,
|
|
30739
|
-
(0,
|
|
30740
|
-
const [uncontrolledVp, setUncontrolledVp] = (0,
|
|
30952
|
+
const kinds = (0, import_react154.useMemo)(() => buildNodeKindRegistry(DEFAULT_NODE_KINDS, nodeKinds), [nodeKinds]);
|
|
30953
|
+
const containerRef = (0, import_react154.useRef)(null);
|
|
30954
|
+
(0, import_react154.useEffect)(() => store.setNodes(nodes), [store, nodes]);
|
|
30955
|
+
(0, import_react154.useEffect)(() => store.setEdges(edges), [store, edges]);
|
|
30956
|
+
const [uncontrolledVp, setUncontrolledVp] = (0, import_react154.useState)(controlledViewport ?? defaultViewport);
|
|
30741
30957
|
const viewport = controlledViewport ?? uncontrolledVp;
|
|
30742
|
-
(0,
|
|
30743
|
-
const setViewport = (0,
|
|
30958
|
+
(0, import_react154.useEffect)(() => store.setViewport(viewport), [store, viewport]);
|
|
30959
|
+
const setViewport = (0, import_react154.useCallback)(
|
|
30744
30960
|
(next) => {
|
|
30745
30961
|
if (controlledViewport === void 0) setUncontrolledVp(next);
|
|
30746
30962
|
onViewportChange?.(next);
|
|
30747
30963
|
},
|
|
30748
30964
|
[controlledViewport, onViewportChange]
|
|
30749
30965
|
);
|
|
30750
|
-
const selectedNodeIds = (0,
|
|
30966
|
+
const selectedNodeIds = (0, import_react154.useMemo)(() => {
|
|
30751
30967
|
const s = /* @__PURE__ */ new Set();
|
|
30752
30968
|
for (const n of nodes) if (n.selected) s.add(n.id);
|
|
30753
30969
|
return s;
|
|
30754
30970
|
}, [nodes]);
|
|
30755
|
-
const selectedEdgeIds = (0,
|
|
30971
|
+
const selectedEdgeIds = (0, import_react154.useMemo)(() => {
|
|
30756
30972
|
const s = /* @__PURE__ */ new Set();
|
|
30757
30973
|
for (const e of edges) if (e.selected) s.add(e.id);
|
|
30758
30974
|
return s;
|
|
30759
30975
|
}, [edges]);
|
|
30760
|
-
(0,
|
|
30976
|
+
(0, import_react154.useEffect)(() => {
|
|
30761
30977
|
store.setSelection(selectedNodeIds, selectedEdgeIds);
|
|
30762
30978
|
if (onSelectionChange) {
|
|
30763
30979
|
onSelectionChange({
|
|
@@ -30766,7 +30982,7 @@ function FlowCanvas2(props) {
|
|
|
30766
30982
|
});
|
|
30767
30983
|
}
|
|
30768
30984
|
}, [store, selectedNodeIds, selectedEdgeIds, nodes, edges, onSelectionChange]);
|
|
30769
|
-
const selectNode = (0,
|
|
30985
|
+
const selectNode = (0, import_react154.useCallback)(
|
|
30770
30986
|
(id, additive) => {
|
|
30771
30987
|
const next = [];
|
|
30772
30988
|
const nextEdges = [];
|
|
@@ -30789,14 +31005,14 @@ function FlowCanvas2(props) {
|
|
|
30789
31005
|
},
|
|
30790
31006
|
[nodes, edges, selectedNodeIds, onNodesChange, onEdgesChange]
|
|
30791
31007
|
);
|
|
30792
|
-
const notifyNodeClick = (0,
|
|
31008
|
+
const notifyNodeClick = (0, import_react154.useCallback)(
|
|
30793
31009
|
(id) => {
|
|
30794
31010
|
const node = nodes.find((n) => n.id === id);
|
|
30795
31011
|
if (node) onNodeClick?.(node);
|
|
30796
31012
|
},
|
|
30797
31013
|
[nodes, onNodeClick]
|
|
30798
31014
|
);
|
|
30799
|
-
const selectEdge = (0,
|
|
31015
|
+
const selectEdge = (0, import_react154.useCallback)(
|
|
30800
31016
|
(id, additive) => {
|
|
30801
31017
|
const next = [];
|
|
30802
31018
|
const nextNodes = [];
|
|
@@ -30821,7 +31037,7 @@ function FlowCanvas2(props) {
|
|
|
30821
31037
|
},
|
|
30822
31038
|
[nodes, edges, selectedEdgeIds, onEdgesChange, onNodesChange, onEdgeClick]
|
|
30823
31039
|
);
|
|
30824
|
-
const clearSelection = (0,
|
|
31040
|
+
const clearSelection = (0, import_react154.useCallback)(() => {
|
|
30825
31041
|
const ns = [];
|
|
30826
31042
|
const es = [];
|
|
30827
31043
|
for (const n of nodes) if (n.selected) ns.push(change.node.select(n.id, false));
|
|
@@ -30829,9 +31045,9 @@ function FlowCanvas2(props) {
|
|
|
30829
31045
|
if (ns.length) onNodesChange?.(ns);
|
|
30830
31046
|
if (es.length) onEdgesChange?.(es);
|
|
30831
31047
|
}, [nodes, edges, onNodesChange, onEdgesChange]);
|
|
30832
|
-
const dragRef = (0,
|
|
30833
|
-
const [draggingId, setDraggingId] = (0,
|
|
30834
|
-
const beginNodeDrag = (0,
|
|
31048
|
+
const dragRef = (0, import_react154.useRef)(null);
|
|
31049
|
+
const [draggingId, setDraggingId] = (0, import_react154.useState)(null);
|
|
31050
|
+
const beginNodeDrag = (0, import_react154.useCallback)(
|
|
30835
31051
|
(nodeId, pointerId, clientX, clientY, altKey = false) => {
|
|
30836
31052
|
if (!nodesDraggable) return;
|
|
30837
31053
|
const node = nodes.find((n) => n.id === nodeId);
|
|
@@ -30840,6 +31056,7 @@ function FlowCanvas2(props) {
|
|
|
30840
31056
|
id: d.id,
|
|
30841
31057
|
startPosition: d.position
|
|
30842
31058
|
}));
|
|
31059
|
+
const wantsReparent = altKey || reparentOnDragRef.current;
|
|
30843
31060
|
dragRef.current = {
|
|
30844
31061
|
pointerId,
|
|
30845
31062
|
nodeId,
|
|
@@ -30847,7 +31064,7 @@ function FlowCanvas2(props) {
|
|
|
30847
31064
|
startClientY: clientY,
|
|
30848
31065
|
startPosition: node.position,
|
|
30849
31066
|
descendants: kids,
|
|
30850
|
-
altDetach:
|
|
31067
|
+
altDetach: wantsReparent,
|
|
30851
31068
|
rafScheduled: false,
|
|
30852
31069
|
nextDelta: null
|
|
30853
31070
|
};
|
|
@@ -30856,12 +31073,12 @@ function FlowCanvas2(props) {
|
|
|
30856
31073
|
},
|
|
30857
31074
|
[nodes, nodesDraggable, selectNode]
|
|
30858
31075
|
);
|
|
30859
|
-
const [conn, setConn] = (0,
|
|
30860
|
-
const connRef = (0,
|
|
30861
|
-
(0,
|
|
31076
|
+
const [conn, setConn] = (0, import_react154.useState)(null);
|
|
31077
|
+
const connRef = (0, import_react154.useRef)(null);
|
|
31078
|
+
(0, import_react154.useEffect)(() => {
|
|
30862
31079
|
connRef.current = conn;
|
|
30863
31080
|
}, [conn]);
|
|
30864
|
-
const beginConnection = (0,
|
|
31081
|
+
const beginConnection = (0, import_react154.useCallback)(
|
|
30865
31082
|
(nodeId, handleId, handleType, pointerId, clientX, clientY) => {
|
|
30866
31083
|
if (!nodesConnectable) return;
|
|
30867
31084
|
const node = nodes.find((n) => n.id === nodeId);
|
|
@@ -30894,63 +31111,75 @@ function FlowCanvas2(props) {
|
|
|
30894
31111
|
},
|
|
30895
31112
|
[nodes, nodesConnectable, handleRegistry, viewport, store, onConnectStart]
|
|
30896
31113
|
);
|
|
30897
|
-
const viewportRef = (0,
|
|
30898
|
-
const nodesRef = (0,
|
|
30899
|
-
const edgesRef = (0,
|
|
30900
|
-
const onNodesChangeRefForInstance = (0,
|
|
30901
|
-
const onEdgesChangeRefForInstance = (0,
|
|
30902
|
-
const onBeforeDeleteRef = (0,
|
|
30903
|
-
const snapToGridRef = (0,
|
|
30904
|
-
const gridSizeRef = (0,
|
|
30905
|
-
const nodeCollisionGapRef = (0,
|
|
30906
|
-
const subflowCollisionGapRef = (0,
|
|
30907
|
-
(0,
|
|
31114
|
+
const viewportRef = (0, import_react154.useRef)(viewport);
|
|
31115
|
+
const nodesRef = (0, import_react154.useRef)(nodes);
|
|
31116
|
+
const edgesRef = (0, import_react154.useRef)(edges);
|
|
31117
|
+
const onNodesChangeRefForInstance = (0, import_react154.useRef)(onNodesChange);
|
|
31118
|
+
const onEdgesChangeRefForInstance = (0, import_react154.useRef)(onEdgesChange);
|
|
31119
|
+
const onBeforeDeleteRef = (0, import_react154.useRef)(onBeforeDelete);
|
|
31120
|
+
const snapToGridRef = (0, import_react154.useRef)(snapToGrid);
|
|
31121
|
+
const gridSizeRef = (0, import_react154.useRef)(gridSize);
|
|
31122
|
+
const nodeCollisionGapRef = (0, import_react154.useRef)(nodeCollisionGap);
|
|
31123
|
+
const subflowCollisionGapRef = (0, import_react154.useRef)(subflowCollisionGap ?? nodeCollisionGap);
|
|
31124
|
+
const reparentOnDragRef = (0, import_react154.useRef)(reparentOnDrag);
|
|
31125
|
+
const autoResizeContainersRef = (0, import_react154.useRef)(autoResizeContainers);
|
|
31126
|
+
const containerAutoResizePaddingRef = (0, import_react154.useRef)(containerAutoResizePadding);
|
|
31127
|
+
(0, import_react154.useEffect)(() => {
|
|
30908
31128
|
edgesRef.current = edges;
|
|
30909
31129
|
}, [edges]);
|
|
30910
|
-
(0,
|
|
31130
|
+
(0, import_react154.useEffect)(() => {
|
|
30911
31131
|
onNodesChangeRefForInstance.current = onNodesChange;
|
|
30912
31132
|
}, [onNodesChange]);
|
|
30913
|
-
(0,
|
|
31133
|
+
(0, import_react154.useEffect)(() => {
|
|
30914
31134
|
onEdgesChangeRefForInstance.current = onEdgesChange;
|
|
30915
31135
|
}, [onEdgesChange]);
|
|
30916
|
-
(0,
|
|
31136
|
+
(0, import_react154.useEffect)(() => {
|
|
30917
31137
|
onBeforeDeleteRef.current = onBeforeDelete;
|
|
30918
31138
|
}, [onBeforeDelete]);
|
|
30919
|
-
(0,
|
|
31139
|
+
(0, import_react154.useEffect)(() => {
|
|
30920
31140
|
snapToGridRef.current = snapToGrid;
|
|
30921
31141
|
}, [snapToGrid]);
|
|
30922
|
-
(0,
|
|
31142
|
+
(0, import_react154.useEffect)(() => {
|
|
30923
31143
|
gridSizeRef.current = gridSize;
|
|
30924
31144
|
}, [gridSize]);
|
|
30925
|
-
(0,
|
|
31145
|
+
(0, import_react154.useEffect)(() => {
|
|
30926
31146
|
nodeCollisionGapRef.current = nodeCollisionGap;
|
|
30927
31147
|
}, [nodeCollisionGap]);
|
|
30928
|
-
(0,
|
|
31148
|
+
(0, import_react154.useEffect)(() => {
|
|
30929
31149
|
subflowCollisionGapRef.current = subflowCollisionGap ?? nodeCollisionGap;
|
|
30930
31150
|
}, [subflowCollisionGap, nodeCollisionGap]);
|
|
30931
|
-
|
|
30932
|
-
|
|
30933
|
-
|
|
30934
|
-
|
|
30935
|
-
|
|
31151
|
+
(0, import_react154.useEffect)(() => {
|
|
31152
|
+
reparentOnDragRef.current = reparentOnDrag;
|
|
31153
|
+
}, [reparentOnDrag]);
|
|
31154
|
+
(0, import_react154.useEffect)(() => {
|
|
31155
|
+
autoResizeContainersRef.current = autoResizeContainers;
|
|
31156
|
+
}, [autoResizeContainers]);
|
|
31157
|
+
(0, import_react154.useEffect)(() => {
|
|
31158
|
+
containerAutoResizePaddingRef.current = containerAutoResizePadding;
|
|
31159
|
+
}, [containerAutoResizePadding]);
|
|
31160
|
+
const onNodesChangeRef = (0, import_react154.useRef)(onNodesChange);
|
|
31161
|
+
const onConnectRef = (0, import_react154.useRef)(onConnect);
|
|
31162
|
+
const onConnectEndRef = (0, import_react154.useRef)(onConnectEnd);
|
|
31163
|
+
const isValidConnectionRef = (0, import_react154.useRef)(isValidConnection);
|
|
31164
|
+
(0, import_react154.useEffect)(() => {
|
|
30936
31165
|
viewportRef.current = viewport;
|
|
30937
31166
|
}, [viewport]);
|
|
30938
|
-
(0,
|
|
31167
|
+
(0, import_react154.useEffect)(() => {
|
|
30939
31168
|
nodesRef.current = nodes;
|
|
30940
31169
|
}, [nodes]);
|
|
30941
|
-
(0,
|
|
31170
|
+
(0, import_react154.useEffect)(() => {
|
|
30942
31171
|
onNodesChangeRef.current = onNodesChange;
|
|
30943
31172
|
}, [onNodesChange]);
|
|
30944
|
-
(0,
|
|
31173
|
+
(0, import_react154.useEffect)(() => {
|
|
30945
31174
|
onConnectRef.current = onConnect;
|
|
30946
31175
|
}, [onConnect]);
|
|
30947
|
-
(0,
|
|
31176
|
+
(0, import_react154.useEffect)(() => {
|
|
30948
31177
|
onConnectEndRef.current = onConnectEnd;
|
|
30949
31178
|
}, [onConnectEnd]);
|
|
30950
|
-
(0,
|
|
31179
|
+
(0, import_react154.useEffect)(() => {
|
|
30951
31180
|
isValidConnectionRef.current = isValidConnection;
|
|
30952
31181
|
}, [isValidConnection]);
|
|
30953
|
-
(0,
|
|
31182
|
+
(0, import_react154.useEffect)(() => {
|
|
30954
31183
|
const onPointerMove = (e) => {
|
|
30955
31184
|
const vp = viewportRef.current;
|
|
30956
31185
|
const drag = dragRef.current;
|
|
@@ -31047,7 +31276,7 @@ function FlowCanvas2(props) {
|
|
|
31047
31276
|
)
|
|
31048
31277
|
);
|
|
31049
31278
|
}
|
|
31050
|
-
if (drag.altDetach
|
|
31279
|
+
if (drag.altDetach) {
|
|
31051
31280
|
const targetGroup = findContainingGroup(
|
|
31052
31281
|
{
|
|
31053
31282
|
x: finalPos.x + (dragNode.width ?? 0) / 2,
|
|
@@ -31057,14 +31286,26 @@ function FlowCanvas2(props) {
|
|
|
31057
31286
|
[drag.nodeId, ...drag.descendants.map((d) => d.id)]
|
|
31058
31287
|
);
|
|
31059
31288
|
const nextParentId = targetGroup?.id;
|
|
31060
|
-
|
|
31061
|
-
|
|
31062
|
-
|
|
31063
|
-
|
|
31064
|
-
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31289
|
+
if (nextParentId !== dragNode.parentId) {
|
|
31290
|
+
const updated = {
|
|
31291
|
+
...dragNode,
|
|
31292
|
+
position: finalPos,
|
|
31293
|
+
parentId: nextParentId,
|
|
31294
|
+
// Preserve extent only when staying in a group.
|
|
31295
|
+
extent: nextParentId ? dragNode.extent : void 0
|
|
31296
|
+
};
|
|
31297
|
+
changes.push(change.node.replace(drag.nodeId, updated));
|
|
31298
|
+
}
|
|
31299
|
+
}
|
|
31300
|
+
if (autoResizeContainersRef.current) {
|
|
31301
|
+
const containerChanges = computeContainerAutoResize(
|
|
31302
|
+
nodesRef.current,
|
|
31303
|
+
// Projected children: apply the position + reparent
|
|
31304
|
+
// changes we just built before measuring bboxes.
|
|
31305
|
+
changes,
|
|
31306
|
+
containerAutoResizePaddingRef.current
|
|
31307
|
+
);
|
|
31308
|
+
for (const c2 of containerChanges) changes.push(c2);
|
|
31068
31309
|
}
|
|
31069
31310
|
onNodesChangeRef.current?.(changes);
|
|
31070
31311
|
}
|
|
@@ -31137,7 +31378,7 @@ function FlowCanvas2(props) {
|
|
|
31137
31378
|
window.removeEventListener("pointercancel", onPointerCancel);
|
|
31138
31379
|
};
|
|
31139
31380
|
}, [store]);
|
|
31140
|
-
const panRef = (0,
|
|
31381
|
+
const panRef = (0, import_react154.useRef)(null);
|
|
31141
31382
|
const onCanvasPointerDown = (e) => {
|
|
31142
31383
|
if (e.button !== 0) return;
|
|
31143
31384
|
const t = e.target;
|
|
@@ -31162,7 +31403,7 @@ function FlowCanvas2(props) {
|
|
|
31162
31403
|
moved: false
|
|
31163
31404
|
};
|
|
31164
31405
|
};
|
|
31165
|
-
(0,
|
|
31406
|
+
(0, import_react154.useEffect)(() => {
|
|
31166
31407
|
const onMove = (e) => {
|
|
31167
31408
|
const pan = panRef.current;
|
|
31168
31409
|
if (!pan || pan.pointerId !== e.pointerId) return;
|
|
@@ -31218,7 +31459,7 @@ function FlowCanvas2(props) {
|
|
|
31218
31459
|
y: py - (py - viewport.y) * k
|
|
31219
31460
|
});
|
|
31220
31461
|
};
|
|
31221
|
-
const dispatch = (0,
|
|
31462
|
+
const dispatch = (0, import_react154.useCallback)(
|
|
31222
31463
|
(a) => {
|
|
31223
31464
|
if (a.type === "connection/start") {
|
|
31224
31465
|
beginConnection(a.nodeId, a.handleId, a.handleType, a.pointerId, a.clientX, a.clientY);
|
|
@@ -31226,7 +31467,7 @@ function FlowCanvas2(props) {
|
|
|
31226
31467
|
},
|
|
31227
31468
|
[beginConnection]
|
|
31228
31469
|
);
|
|
31229
|
-
const reportDimensions = (0,
|
|
31470
|
+
const reportDimensions = (0, import_react154.useCallback)(
|
|
31230
31471
|
(nodeId, width2, height2) => {
|
|
31231
31472
|
const node = nodes.find((n) => n.id === nodeId);
|
|
31232
31473
|
if (!node) return;
|
|
@@ -31235,7 +31476,7 @@ function FlowCanvas2(props) {
|
|
|
31235
31476
|
},
|
|
31236
31477
|
[nodes, onNodesChange]
|
|
31237
31478
|
);
|
|
31238
|
-
const toggleNodeCollapseImpl = (0,
|
|
31479
|
+
const toggleNodeCollapseImpl = (0, import_react154.useCallback)(
|
|
31239
31480
|
(nodeId) => {
|
|
31240
31481
|
const node = nodes.find((n) => n.id === nodeId);
|
|
31241
31482
|
if (!node) return;
|
|
@@ -31248,7 +31489,7 @@ function FlowCanvas2(props) {
|
|
|
31248
31489
|
},
|
|
31249
31490
|
[nodes, onNodesChange]
|
|
31250
31491
|
);
|
|
31251
|
-
const deleteNodeImpl = (0,
|
|
31492
|
+
const deleteNodeImpl = (0, import_react154.useCallback)(
|
|
31252
31493
|
(nodeId) => {
|
|
31253
31494
|
const incidentEdgeIds = edgesRef.current.filter((e) => e.source === nodeId || e.target === nodeId).map((e) => e.id);
|
|
31254
31495
|
if (incidentEdgeIds.length > 0) {
|
|
@@ -31258,7 +31499,7 @@ function FlowCanvas2(props) {
|
|
|
31258
31499
|
},
|
|
31259
31500
|
[onNodesChange, onEdgesChange]
|
|
31260
31501
|
);
|
|
31261
|
-
const instance = (0,
|
|
31502
|
+
const instance = (0, import_react154.useMemo)(
|
|
31262
31503
|
() => ({
|
|
31263
31504
|
// viewport
|
|
31264
31505
|
getViewport: () => viewportRef.current,
|
|
@@ -31399,14 +31640,14 @@ function FlowCanvas2(props) {
|
|
|
31399
31640
|
}),
|
|
31400
31641
|
[setViewport, minZoom, maxZoom]
|
|
31401
31642
|
);
|
|
31402
|
-
const initFiredRef = (0,
|
|
31403
|
-
(0,
|
|
31643
|
+
const initFiredRef = (0, import_react154.useRef)(false);
|
|
31644
|
+
(0, import_react154.useEffect)(() => {
|
|
31404
31645
|
if (initFiredRef.current) return;
|
|
31405
31646
|
initFiredRef.current = true;
|
|
31406
31647
|
onInit?.(instance);
|
|
31407
31648
|
}, [instance, onInit]);
|
|
31408
|
-
const fitOnInitFiredRef = (0,
|
|
31409
|
-
(0,
|
|
31649
|
+
const fitOnInitFiredRef = (0, import_react154.useRef)(false);
|
|
31650
|
+
(0, import_react154.useEffect)(() => {
|
|
31410
31651
|
if (fitOnInitFiredRef.current) return;
|
|
31411
31652
|
const opt = fitViewOnInit;
|
|
31412
31653
|
const shouldFit = opt === false ? false : opt !== void 0 ? true : !viewportPropProvided;
|
|
@@ -31421,7 +31662,7 @@ function FlowCanvas2(props) {
|
|
|
31421
31662
|
});
|
|
31422
31663
|
return () => cancelAnimationFrame(raf);
|
|
31423
31664
|
}, [fitViewOnInit, viewportPropProvided, nodes.length, instance]);
|
|
31424
|
-
(0,
|
|
31665
|
+
(0, import_react154.useEffect)(() => {
|
|
31425
31666
|
const onKey = (e) => {
|
|
31426
31667
|
if (e.key !== "Backspace" && e.key !== "Delete") return;
|
|
31427
31668
|
const target = e.target;
|
|
@@ -31442,7 +31683,7 @@ function FlowCanvas2(props) {
|
|
|
31442
31683
|
window.addEventListener("keydown", onKey);
|
|
31443
31684
|
return () => window.removeEventListener("keydown", onKey);
|
|
31444
31685
|
}, [instance, store]);
|
|
31445
|
-
const bridge = (0,
|
|
31686
|
+
const bridge = (0, import_react154.useMemo)(
|
|
31446
31687
|
() => ({
|
|
31447
31688
|
beginNodeDrag,
|
|
31448
31689
|
selectNode,
|
|
@@ -31462,16 +31703,16 @@ function FlowCanvas2(props) {
|
|
|
31462
31703
|
toggleNodeCollapseImpl
|
|
31463
31704
|
]
|
|
31464
31705
|
);
|
|
31465
|
-
const [panGesture, setPanGesture] = (0,
|
|
31706
|
+
const [panGesture, setPanGesture] = (0, import_react154.useState)(false);
|
|
31466
31707
|
const isEmpty = nodes.length === 0 && edges.length === 0;
|
|
31467
31708
|
const isConnecting = conn !== null;
|
|
31468
|
-
const visibleNodes = (0,
|
|
31469
|
-
const visibleEdges = (0,
|
|
31709
|
+
const visibleNodes = (0, import_react154.useMemo)(() => nodes.filter((n) => !n.hidden), [nodes]);
|
|
31710
|
+
const visibleEdges = (0, import_react154.useMemo)(() => {
|
|
31470
31711
|
if (visibleNodes.length === nodes.length) return edges;
|
|
31471
31712
|
const visibleIds = new Set(visibleNodes.map((n) => n.id));
|
|
31472
31713
|
return edges.filter((e) => visibleIds.has(e.source) && visibleIds.has(e.target));
|
|
31473
31714
|
}, [edges, nodes, visibleNodes]);
|
|
31474
|
-
const orderedNodes = (0,
|
|
31715
|
+
const orderedNodes = (0, import_react154.useMemo)(() => {
|
|
31475
31716
|
const isContainer = (n) => n.type === "group" || n.type === "forEach";
|
|
31476
31717
|
const depth = (n) => {
|
|
31477
31718
|
let d = 0;
|
|
@@ -31490,7 +31731,7 @@ function FlowCanvas2(props) {
|
|
|
31490
31731
|
containers.sort((a, b) => depth(a) - depth(b));
|
|
31491
31732
|
return [...containers, ...others];
|
|
31492
31733
|
}, [visibleNodes]);
|
|
31493
|
-
return /* @__PURE__ */ (0,
|
|
31734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FlowStoreContext.Provider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FlowInstanceContext.Provider, { value: instance, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(HandleRegistryContext.Provider, { value: handleRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FlowDispatchContext.Provider, { value: dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FlowNodeBridgeContext.Provider, { value: bridge, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
31494
31735
|
"div",
|
|
31495
31736
|
{
|
|
31496
31737
|
ref: containerRef,
|
|
@@ -31535,7 +31776,7 @@ function FlowCanvas2(props) {
|
|
|
31535
31776
|
},
|
|
31536
31777
|
"data-empty": isEmpty ? "true" : void 0,
|
|
31537
31778
|
children: [
|
|
31538
|
-
background !== "none" && /* @__PURE__ */ (0,
|
|
31779
|
+
background !== "none" && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
31539
31780
|
"div",
|
|
31540
31781
|
{
|
|
31541
31782
|
className: cn(
|
|
@@ -31549,7 +31790,7 @@ function FlowCanvas2(props) {
|
|
|
31549
31790
|
}
|
|
31550
31791
|
}
|
|
31551
31792
|
),
|
|
31552
|
-
/* @__PURE__ */ (0,
|
|
31793
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
31553
31794
|
"div",
|
|
31554
31795
|
{
|
|
31555
31796
|
className: "ods-flow-canvas-v2__viewport",
|
|
@@ -31560,7 +31801,7 @@ function FlowCanvas2(props) {
|
|
|
31560
31801
|
transformOrigin: "0 0"
|
|
31561
31802
|
},
|
|
31562
31803
|
children: [
|
|
31563
|
-
/* @__PURE__ */ (0,
|
|
31804
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
31564
31805
|
EdgesLayer,
|
|
31565
31806
|
{
|
|
31566
31807
|
edges: visibleEdges,
|
|
@@ -31575,7 +31816,7 @@ function FlowCanvas2(props) {
|
|
|
31575
31816
|
orderedNodes.map((node) => {
|
|
31576
31817
|
const Kind = kinds[node.type] ?? kinds.action;
|
|
31577
31818
|
if (!Kind) return null;
|
|
31578
|
-
return /* @__PURE__ */ (0,
|
|
31819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
31579
31820
|
FlowNode3,
|
|
31580
31821
|
{
|
|
31581
31822
|
node,
|
|
@@ -31590,7 +31831,7 @@ function FlowCanvas2(props) {
|
|
|
31590
31831
|
]
|
|
31591
31832
|
}
|
|
31592
31833
|
),
|
|
31593
|
-
isEmpty && emptyState && /* @__PURE__ */ (0,
|
|
31834
|
+
isEmpty && emptyState && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ods-flow-canvas-v2__empty", children: emptyState }),
|
|
31594
31835
|
children
|
|
31595
31836
|
]
|
|
31596
31837
|
}
|
|
@@ -31599,7 +31840,60 @@ function FlowCanvas2(props) {
|
|
|
31599
31840
|
function onEdgesChangeRef(id, cb) {
|
|
31600
31841
|
cb?.([change.edge.remove(id)]);
|
|
31601
31842
|
}
|
|
31602
|
-
|
|
31843
|
+
function computeContainerAutoResize(nodes, pending, padding) {
|
|
31844
|
+
const projected = /* @__PURE__ */ new Map();
|
|
31845
|
+
for (const n of nodes) projected.set(n.id, n);
|
|
31846
|
+
for (const c of pending) {
|
|
31847
|
+
if (c.type === "position" && c.position) {
|
|
31848
|
+
const cur = projected.get(c.id);
|
|
31849
|
+
if (cur) projected.set(c.id, { ...cur, position: c.position });
|
|
31850
|
+
} else if (c.type === "replace" && c.item) {
|
|
31851
|
+
projected.set(c.id, { ...projected.get(c.id), ...c.item });
|
|
31852
|
+
} else if (c.type === "add" && c.item) {
|
|
31853
|
+
projected.set(c.item.id, c.item);
|
|
31854
|
+
}
|
|
31855
|
+
}
|
|
31856
|
+
const HEADER = 56;
|
|
31857
|
+
const out = [];
|
|
31858
|
+
for (const parent of projected.values()) {
|
|
31859
|
+
if (parent.type !== "group" && parent.type !== "forEach") continue;
|
|
31860
|
+
const children = [];
|
|
31861
|
+
for (const n of projected.values()) {
|
|
31862
|
+
if (n.parentId === parent.id) children.push(n);
|
|
31863
|
+
}
|
|
31864
|
+
if (children.length === 0) continue;
|
|
31865
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
31866
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
31867
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
31868
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
31869
|
+
for (const c of children) {
|
|
31870
|
+
const cw = c.width ?? 240;
|
|
31871
|
+
const ch = c.height ?? 96;
|
|
31872
|
+
if (c.position.x < minX) minX = c.position.x;
|
|
31873
|
+
if (c.position.y < minY) minY = c.position.y;
|
|
31874
|
+
if (c.position.x + cw > maxX) maxX = c.position.x + cw;
|
|
31875
|
+
if (c.position.y + ch > maxY) maxY = c.position.y + ch;
|
|
31876
|
+
}
|
|
31877
|
+
const targetX = minX - padding;
|
|
31878
|
+
const targetY = minY - padding - HEADER;
|
|
31879
|
+
const targetW = maxX - minX + padding * 2;
|
|
31880
|
+
const targetH = maxY - minY + padding * 2 + HEADER;
|
|
31881
|
+
const curW = parent.width ?? 480;
|
|
31882
|
+
const curH = parent.height ?? 240;
|
|
31883
|
+
const nextW = Math.max(curW, targetW);
|
|
31884
|
+
const nextH = Math.max(curH, targetH);
|
|
31885
|
+
const positionDirty = parent.position.x !== targetX || parent.position.y !== targetY;
|
|
31886
|
+
const sizeDirty = curW !== nextW || curH !== nextH;
|
|
31887
|
+
if (positionDirty) {
|
|
31888
|
+
out.push(change.node.position(parent.id, { x: targetX, y: targetY }, false));
|
|
31889
|
+
}
|
|
31890
|
+
if (sizeDirty) {
|
|
31891
|
+
out.push(change.node.dimensions(parent.id, { width: nextW, height: nextH }));
|
|
31892
|
+
}
|
|
31893
|
+
}
|
|
31894
|
+
return out;
|
|
31895
|
+
}
|
|
31896
|
+
var EdgesLayer = (0, import_react154.memo)(function EdgesLayer2({
|
|
31603
31897
|
edges,
|
|
31604
31898
|
nodes,
|
|
31605
31899
|
onSelect,
|
|
@@ -31608,7 +31902,7 @@ var EdgesLayer = (0, import_react153.memo)(function EdgesLayer2({
|
|
|
31608
31902
|
ghost,
|
|
31609
31903
|
handleVersion: _handleVersion
|
|
31610
31904
|
}) {
|
|
31611
|
-
return /* @__PURE__ */ (0,
|
|
31905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
31612
31906
|
"svg",
|
|
31613
31907
|
{
|
|
31614
31908
|
className: "ods-flow-canvas-v2__edges",
|
|
@@ -31616,7 +31910,7 @@ var EdgesLayer = (0, import_react153.memo)(function EdgesLayer2({
|
|
|
31616
31910
|
width: "100%",
|
|
31617
31911
|
height: "100%",
|
|
31618
31912
|
children: [
|
|
31619
|
-
/* @__PURE__ */ (0,
|
|
31913
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("g", { style: { pointerEvents: "auto" }, children: edges.map((edge) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
31620
31914
|
FlowEdge2,
|
|
31621
31915
|
{
|
|
31622
31916
|
edge,
|
|
@@ -31628,7 +31922,7 @@ var EdgesLayer = (0, import_react153.memo)(function EdgesLayer2({
|
|
|
31628
31922
|
},
|
|
31629
31923
|
edge.id
|
|
31630
31924
|
)) }),
|
|
31631
|
-
ghost && /* @__PURE__ */ (0,
|
|
31925
|
+
ghost && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
31632
31926
|
"path",
|
|
31633
31927
|
{
|
|
31634
31928
|
d: `M ${ghost.start.x} ${ghost.start.y} L ${ghost.end.x} ${ghost.end.y}`,
|
|
@@ -31644,7 +31938,7 @@ var EdgesLayer = (0, import_react153.memo)(function EdgesLayer2({
|
|
|
31644
31938
|
});
|
|
31645
31939
|
|
|
31646
31940
|
// src/components/WorkflowEditor/WorkflowEditor.tsx
|
|
31647
|
-
var
|
|
31941
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
31648
31942
|
var NODE_KIND_MAP = {
|
|
31649
31943
|
trigger: "trigger",
|
|
31650
31944
|
action: "action",
|
|
@@ -31689,7 +31983,7 @@ function WorkflowEditor({
|
|
|
31689
31983
|
drawer,
|
|
31690
31984
|
console: consoleSlot,
|
|
31691
31985
|
minimap,
|
|
31692
|
-
emptyState = /* @__PURE__ */ (0,
|
|
31986
|
+
emptyState = /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DefaultEmptyState, {}),
|
|
31693
31987
|
children,
|
|
31694
31988
|
background = "dots",
|
|
31695
31989
|
snapToGrid = true,
|
|
@@ -31717,44 +32011,44 @@ function WorkflowEditor({
|
|
|
31717
32011
|
}) {
|
|
31718
32012
|
const wf = useWorkflow(options);
|
|
31719
32013
|
const { workflow, dispatch, canUndo, canRedo, undo, redo } = wf;
|
|
31720
|
-
const [uncontrolledLock, setUncontrolledLock] = (0,
|
|
31721
|
-
const [uncontrolledDrawer, setUncontrolledDrawer] = (0,
|
|
31722
|
-
const [uncontrolledHistory, setUncontrolledHistory] = (0,
|
|
31723
|
-
const [uncontrolledDebug, setUncontrolledDebug] = (0,
|
|
32014
|
+
const [uncontrolledLock, setUncontrolledLock] = (0, import_react155.useState)(false);
|
|
32015
|
+
const [uncontrolledDrawer, setUncontrolledDrawer] = (0, import_react155.useState)(!!drawer);
|
|
32016
|
+
const [uncontrolledHistory, setUncontrolledHistory] = (0, import_react155.useState)(false);
|
|
32017
|
+
const [uncontrolledDebug, setUncontrolledDebug] = (0, import_react155.useState)(false);
|
|
31724
32018
|
const isLockMode = controlledLockMode ?? uncontrolledLock;
|
|
31725
32019
|
const isDrawerOpen = controlledDrawerOpen ?? uncontrolledDrawer;
|
|
31726
32020
|
const isHistoryOpen = controlledHistoryOpen ?? uncontrolledHistory;
|
|
31727
32021
|
const isDebugOpen = controlledDebugOpen ?? uncontrolledDebug;
|
|
31728
|
-
const toggleLock = (0,
|
|
32022
|
+
const toggleLock = (0, import_react155.useCallback)(() => {
|
|
31729
32023
|
const next = !isLockMode;
|
|
31730
32024
|
if (controlledLockMode === void 0) setUncontrolledLock(next);
|
|
31731
32025
|
onToggleLockMode?.(next);
|
|
31732
32026
|
}, [isLockMode, controlledLockMode, onToggleLockMode]);
|
|
31733
|
-
const toggleDrawer = (0,
|
|
32027
|
+
const toggleDrawer = (0, import_react155.useCallback)(() => {
|
|
31734
32028
|
const next = !isDrawerOpen;
|
|
31735
32029
|
if (controlledDrawerOpen === void 0) setUncontrolledDrawer(next);
|
|
31736
32030
|
onToggleDrawer?.(next);
|
|
31737
32031
|
}, [isDrawerOpen, controlledDrawerOpen, onToggleDrawer]);
|
|
31738
|
-
const toggleHistory = (0,
|
|
32032
|
+
const toggleHistory = (0, import_react155.useCallback)(() => {
|
|
31739
32033
|
const next = !isHistoryOpen;
|
|
31740
32034
|
if (controlledHistoryOpen === void 0) setUncontrolledHistory(next);
|
|
31741
32035
|
onToggleHistory?.(next);
|
|
31742
32036
|
}, [isHistoryOpen, controlledHistoryOpen, onToggleHistory]);
|
|
31743
|
-
const toggleDebug = (0,
|
|
32037
|
+
const toggleDebug = (0, import_react155.useCallback)(() => {
|
|
31744
32038
|
const next = !isDebugOpen;
|
|
31745
32039
|
if (controlledDebugOpen === void 0) setUncontrolledDebug(next);
|
|
31746
32040
|
onToggleDebug?.(next);
|
|
31747
32041
|
}, [isDebugOpen, controlledDebugOpen, onToggleDebug]);
|
|
31748
|
-
const handleReset = (0,
|
|
32042
|
+
const handleReset = (0, import_react155.useCallback)(() => {
|
|
31749
32043
|
if (onReset) onReset();
|
|
31750
32044
|
else dispatch({ type: "RESET" });
|
|
31751
32045
|
}, [onReset, dispatch]);
|
|
31752
|
-
const nextNodes = (0,
|
|
32046
|
+
const nextNodes = (0, import_react155.useMemo)(
|
|
31753
32047
|
() => workflow.canvas.nodes.map(toNextNode),
|
|
31754
32048
|
[workflow.canvas.nodes]
|
|
31755
32049
|
);
|
|
31756
|
-
const nextEdges = (0,
|
|
31757
|
-
const onNodesChange = (0,
|
|
32050
|
+
const nextEdges = (0, import_react155.useMemo)(() => workflow.canvas.edges.map(toNextEdge), [workflow.canvas.edges]);
|
|
32051
|
+
const onNodesChange = (0, import_react155.useCallback)(
|
|
31758
32052
|
(changes) => {
|
|
31759
32053
|
const reduced = applyNodeChanges(
|
|
31760
32054
|
nextNodes,
|
|
@@ -31795,7 +32089,7 @@ function WorkflowEditor({
|
|
|
31795
32089
|
},
|
|
31796
32090
|
[nextNodes, workflow.canvas.nodes, wf, onNodeSelect]
|
|
31797
32091
|
);
|
|
31798
|
-
const onEdgesChange = (0,
|
|
32092
|
+
const onEdgesChange = (0, import_react155.useCallback)(
|
|
31799
32093
|
(changes) => {
|
|
31800
32094
|
const reduced = applyEdgeChanges(nextEdges, changes);
|
|
31801
32095
|
const byId = new Map(reduced.map((e) => [e.id, e]));
|
|
@@ -31805,18 +32099,18 @@ function WorkflowEditor({
|
|
|
31805
32099
|
},
|
|
31806
32100
|
[nextEdges, workflow.canvas.edges, wf]
|
|
31807
32101
|
);
|
|
31808
|
-
const onConnect = (0,
|
|
32102
|
+
const onConnect = (0, import_react155.useCallback)(
|
|
31809
32103
|
(c) => {
|
|
31810
32104
|
wf.createEdge(c.source, c.sourceHandle ?? "default", c.target, c.targetHandle ?? "default");
|
|
31811
32105
|
},
|
|
31812
32106
|
[wf]
|
|
31813
32107
|
);
|
|
31814
|
-
const [canvasSize, setCanvasSize] = (0,
|
|
31815
|
-
const handleCanvasRef = (0,
|
|
32108
|
+
const [canvasSize, setCanvasSize] = (0, import_react155.useState)({ w: 0, h: 0 });
|
|
32109
|
+
const handleCanvasRef = (0, import_react155.useCallback)((node) => {
|
|
31816
32110
|
if (!node) return;
|
|
31817
32111
|
setCanvasSize({ w: node.clientWidth, h: node.clientHeight });
|
|
31818
32112
|
}, []);
|
|
31819
|
-
const fitToView = (0,
|
|
32113
|
+
const fitToView = (0, import_react155.useCallback)(() => {
|
|
31820
32114
|
const nodes = workflow.canvas.nodes;
|
|
31821
32115
|
if (nodes.length === 0) return;
|
|
31822
32116
|
let minX = Infinity;
|
|
@@ -31844,9 +32138,9 @@ function WorkflowEditor({
|
|
|
31844
32138
|
const cy = (minY + maxY) / 2;
|
|
31845
32139
|
wf.setViewport({ x: cw / 2 - cx * zoom, y: ch / 2 - cy * zoom, zoom });
|
|
31846
32140
|
}, [workflow.canvas.nodes, canvasSize, wf]);
|
|
31847
|
-
const defaultToolbar = (0,
|
|
31848
|
-
() => /* @__PURE__ */ (0,
|
|
31849
|
-
onSave && /* @__PURE__ */ (0,
|
|
32141
|
+
const defaultToolbar = (0, import_react155.useMemo)(
|
|
32142
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(FlowToolbar, { placement: "left", children: [
|
|
32143
|
+
onSave && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31850
32144
|
FlowToolbarButton,
|
|
31851
32145
|
{
|
|
31852
32146
|
icon: FlowToolbarIcons.save,
|
|
@@ -31855,7 +32149,7 @@ function WorkflowEditor({
|
|
|
31855
32149
|
onClick: () => onSave(workflow)
|
|
31856
32150
|
}
|
|
31857
32151
|
),
|
|
31858
|
-
onRun && /* @__PURE__ */ (0,
|
|
32152
|
+
onRun && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31859
32153
|
FlowToolbarButton,
|
|
31860
32154
|
{
|
|
31861
32155
|
icon: isExecuting ? FlowToolbarIcons.stop : FlowToolbarIcons.run,
|
|
@@ -31866,7 +32160,7 @@ function WorkflowEditor({
|
|
|
31866
32160
|
onClick: isExecuting ? onStop : onRun
|
|
31867
32161
|
}
|
|
31868
32162
|
),
|
|
31869
|
-
/* @__PURE__ */ (0,
|
|
32163
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31870
32164
|
FlowToolbarButton,
|
|
31871
32165
|
{
|
|
31872
32166
|
icon: isLockMode ? FlowToolbarIcons.lock : FlowToolbarIcons.unlock,
|
|
@@ -31876,7 +32170,7 @@ function WorkflowEditor({
|
|
|
31876
32170
|
onClick: toggleLock
|
|
31877
32171
|
}
|
|
31878
32172
|
),
|
|
31879
|
-
/* @__PURE__ */ (0,
|
|
32173
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31880
32174
|
FlowToolbarButton,
|
|
31881
32175
|
{
|
|
31882
32176
|
icon: FlowToolbarIcons.reset,
|
|
@@ -31884,7 +32178,7 @@ function WorkflowEditor({
|
|
|
31884
32178
|
onClick: handleReset
|
|
31885
32179
|
}
|
|
31886
32180
|
),
|
|
31887
|
-
drawer && /* @__PURE__ */ (0,
|
|
32181
|
+
drawer && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31888
32182
|
FlowToolbarButton,
|
|
31889
32183
|
{
|
|
31890
32184
|
icon: isDrawerOpen ? FlowToolbarIcons.drawerClose : FlowToolbarIcons.drawerOpen,
|
|
@@ -31893,8 +32187,8 @@ function WorkflowEditor({
|
|
|
31893
32187
|
onClick: toggleDrawer
|
|
31894
32188
|
}
|
|
31895
32189
|
),
|
|
31896
|
-
/* @__PURE__ */ (0,
|
|
31897
|
-
onSettings && /* @__PURE__ */ (0,
|
|
32190
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(FlowToolbarDivider, {}),
|
|
32191
|
+
onSettings && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31898
32192
|
FlowToolbarButton,
|
|
31899
32193
|
{
|
|
31900
32194
|
icon: FlowToolbarIcons.settings,
|
|
@@ -31902,7 +32196,7 @@ function WorkflowEditor({
|
|
|
31902
32196
|
onClick: onSettings
|
|
31903
32197
|
}
|
|
31904
32198
|
),
|
|
31905
|
-
/* @__PURE__ */ (0,
|
|
32199
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31906
32200
|
FlowToolbarButton,
|
|
31907
32201
|
{
|
|
31908
32202
|
icon: FlowToolbarIcons.history,
|
|
@@ -31911,7 +32205,7 @@ function WorkflowEditor({
|
|
|
31911
32205
|
onClick: toggleHistory
|
|
31912
32206
|
}
|
|
31913
32207
|
),
|
|
31914
|
-
isDebugModeEnabled && /* @__PURE__ */ (0,
|
|
32208
|
+
isDebugModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31915
32209
|
FlowToolbarButton,
|
|
31916
32210
|
{
|
|
31917
32211
|
icon: FlowToolbarIcons.debug,
|
|
@@ -31920,8 +32214,8 @@ function WorkflowEditor({
|
|
|
31920
32214
|
onClick: toggleDebug
|
|
31921
32215
|
}
|
|
31922
32216
|
),
|
|
31923
|
-
/* @__PURE__ */ (0,
|
|
31924
|
-
/* @__PURE__ */ (0,
|
|
32217
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(FlowToolbarDivider, {}),
|
|
32218
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31925
32219
|
FlowToolbarButton,
|
|
31926
32220
|
{
|
|
31927
32221
|
icon: FlowToolbarIcons.undo,
|
|
@@ -31931,7 +32225,7 @@ function WorkflowEditor({
|
|
|
31931
32225
|
onClick: undo
|
|
31932
32226
|
}
|
|
31933
32227
|
),
|
|
31934
|
-
/* @__PURE__ */ (0,
|
|
32228
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31935
32229
|
FlowToolbarButton,
|
|
31936
32230
|
{
|
|
31937
32231
|
icon: FlowToolbarIcons.redo,
|
|
@@ -31941,8 +32235,8 @@ function WorkflowEditor({
|
|
|
31941
32235
|
onClick: redo
|
|
31942
32236
|
}
|
|
31943
32237
|
),
|
|
31944
|
-
/* @__PURE__ */ (0,
|
|
31945
|
-
/* @__PURE__ */ (0,
|
|
32238
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(FlowToolbarDivider, {}),
|
|
32239
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31946
32240
|
FlowToolbarZoom,
|
|
31947
32241
|
{
|
|
31948
32242
|
zoom: workflow.canvas.viewport.zoom,
|
|
@@ -31981,21 +32275,21 @@ function WorkflowEditor({
|
|
|
31981
32275
|
);
|
|
31982
32276
|
const resolvedToolbar = toolbar === "default" ? defaultToolbar : toolbar === null ? null : toolbar;
|
|
31983
32277
|
const isEmpty = workflow.canvas.nodes.length === 0 && workflow.canvas.edges.length === 0;
|
|
31984
|
-
return /* @__PURE__ */ (0,
|
|
32278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
31985
32279
|
"div",
|
|
31986
32280
|
{
|
|
31987
32281
|
className: cn("ods-workflow-editor", className),
|
|
31988
32282
|
style: { width, height, position: "relative", display: "flex", overflow: "hidden" },
|
|
31989
32283
|
children: [
|
|
31990
|
-
drawer && isDrawerOpen && /* @__PURE__ */ (0,
|
|
31991
|
-
/* @__PURE__ */ (0,
|
|
32284
|
+
drawer && isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ods-workflow-editor__drawer", children: drawer }),
|
|
32285
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
31992
32286
|
"div",
|
|
31993
32287
|
{
|
|
31994
32288
|
ref: handleCanvasRef,
|
|
31995
32289
|
className: "ods-workflow-editor__canvas-wrapper",
|
|
31996
32290
|
style: { position: "relative", flex: 1, minWidth: 0 },
|
|
31997
32291
|
children: [
|
|
31998
|
-
/* @__PURE__ */ (0,
|
|
32292
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
31999
32293
|
FlowCanvas2,
|
|
32000
32294
|
{
|
|
32001
32295
|
nodes: nextNodes,
|
|
@@ -32009,9 +32303,9 @@ function WorkflowEditor({
|
|
|
32009
32303
|
children: resolvedToolbar
|
|
32010
32304
|
}
|
|
32011
32305
|
),
|
|
32012
|
-
minimap && /* @__PURE__ */ (0,
|
|
32013
|
-
consoleSlot && /* @__PURE__ */ (0,
|
|
32014
|
-
isEmpty && emptyState && /* @__PURE__ */ (0,
|
|
32306
|
+
minimap && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ods-workflow-editor__minimap", children: minimap }),
|
|
32307
|
+
consoleSlot && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ods-workflow-editor__console", children: consoleSlot }),
|
|
32308
|
+
isEmpty && emptyState && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ods-workflow-editor__empty", children: emptyState }),
|
|
32015
32309
|
children
|
|
32016
32310
|
]
|
|
32017
32311
|
}
|
|
@@ -32021,7 +32315,7 @@ function WorkflowEditor({
|
|
|
32021
32315
|
);
|
|
32022
32316
|
}
|
|
32023
32317
|
function DefaultEmptyState() {
|
|
32024
|
-
return /* @__PURE__ */ (0,
|
|
32318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
32025
32319
|
"div",
|
|
32026
32320
|
{
|
|
32027
32321
|
style: {
|
|
@@ -32036,14 +32330,14 @@ function DefaultEmptyState() {
|
|
|
32036
32330
|
pointerEvents: "none"
|
|
32037
32331
|
},
|
|
32038
32332
|
children: [
|
|
32039
|
-
/* @__PURE__ */ (0,
|
|
32333
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
32040
32334
|
"div",
|
|
32041
32335
|
{
|
|
32042
32336
|
style: { fontSize: 14, fontWeight: 600, color: "var(--ods-text-primary)", marginBottom: 4 },
|
|
32043
32337
|
children: "Start with a trigger"
|
|
32044
32338
|
}
|
|
32045
32339
|
),
|
|
32046
|
-
/* @__PURE__ */ (0,
|
|
32340
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { style: { fontSize: 12 }, children: "Drop an action here, or use the drawer to add your first node." })
|
|
32047
32341
|
]
|
|
32048
32342
|
}
|
|
32049
32343
|
);
|
|
@@ -32053,7 +32347,7 @@ function DefaultEmptyState() {
|
|
|
32053
32347
|
var import_icons50 = require("@octaviaflow/icons");
|
|
32054
32348
|
|
|
32055
32349
|
// src/hooks/useRelativeTime.ts
|
|
32056
|
-
var
|
|
32350
|
+
var import_react156 = require("react");
|
|
32057
32351
|
function toMs(t) {
|
|
32058
32352
|
if (t == null) return null;
|
|
32059
32353
|
return typeof t === "number" ? t : t.getTime();
|
|
@@ -32072,8 +32366,8 @@ function formatRelativeTime(when, now2 = Date.now()) {
|
|
|
32072
32366
|
}
|
|
32073
32367
|
function useRelativeTime(date, options = {}) {
|
|
32074
32368
|
const { intervalMs = 3e4 } = options;
|
|
32075
|
-
const [now2, setNow] = (0,
|
|
32076
|
-
(0,
|
|
32369
|
+
const [now2, setNow] = (0, import_react156.useState)(() => Date.now());
|
|
32370
|
+
(0, import_react156.useEffect)(() => {
|
|
32077
32371
|
if (typeof window === "undefined") return;
|
|
32078
32372
|
const id = window.setInterval(() => setNow(Date.now()), intervalMs);
|
|
32079
32373
|
return () => window.clearInterval(id);
|
|
@@ -32082,7 +32376,7 @@ function useRelativeTime(date, options = {}) {
|
|
|
32082
32376
|
}
|
|
32083
32377
|
|
|
32084
32378
|
// src/hooks/useWorkflowRuntime.ts
|
|
32085
|
-
var
|
|
32379
|
+
var import_react157 = require("react");
|
|
32086
32380
|
function toMs2(t) {
|
|
32087
32381
|
if (t == null) return null;
|
|
32088
32382
|
return typeof t === "number" ? t : t.getTime();
|
|
@@ -32096,8 +32390,8 @@ function formatWorkflowRuntime(ms) {
|
|
|
32096
32390
|
return h > 0 ? `${h}:${pad2(m)}:${pad2(sec)}` : `${pad2(m)}:${pad2(sec)}`;
|
|
32097
32391
|
}
|
|
32098
32392
|
function useWorkflowRuntime(startedAt, active) {
|
|
32099
|
-
const [, force] = (0,
|
|
32100
|
-
(0,
|
|
32393
|
+
const [, force] = (0, import_react157.useState)(0);
|
|
32394
|
+
(0, import_react157.useEffect)(() => {
|
|
32101
32395
|
if (!active || startedAt == null) return;
|
|
32102
32396
|
if (typeof window === "undefined") return;
|
|
32103
32397
|
const id = window.setInterval(() => force((n) => n + 1), 1e3);
|
|
@@ -32109,7 +32403,7 @@ function useWorkflowRuntime(startedAt, active) {
|
|
|
32109
32403
|
}
|
|
32110
32404
|
|
|
32111
32405
|
// src/components/WorkflowHeader/WorkflowHeader.tsx
|
|
32112
|
-
var
|
|
32406
|
+
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
32113
32407
|
function WorkflowHeader({
|
|
32114
32408
|
name,
|
|
32115
32409
|
statusTone,
|
|
@@ -32152,21 +32446,21 @@ function WorkflowHeader({
|
|
|
32152
32446
|
className
|
|
32153
32447
|
);
|
|
32154
32448
|
if (loading) {
|
|
32155
|
-
return /* @__PURE__ */ (0,
|
|
32156
|
-
/* @__PURE__ */ (0,
|
|
32157
|
-
/* @__PURE__ */ (0,
|
|
32158
|
-
/* @__PURE__ */ (0,
|
|
32449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("header", { className: rootCls, "data-loading": "true", children: [
|
|
32450
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "ods-workflow-header__left", children: [
|
|
32451
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Skeleton, { variant: "text", width: "120px" }),
|
|
32452
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Skeleton, { variant: "text", width: "180px" })
|
|
32159
32453
|
] }),
|
|
32160
|
-
/* @__PURE__ */ (0,
|
|
32161
|
-
/* @__PURE__ */ (0,
|
|
32162
|
-
/* @__PURE__ */ (0,
|
|
32454
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "ods-workflow-header__right", children: [
|
|
32455
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Skeleton, { variant: "circular", width: "28px", height: "28px" }),
|
|
32456
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Skeleton, { variant: "circular", width: "28px", height: "28px" })
|
|
32163
32457
|
] })
|
|
32164
32458
|
] });
|
|
32165
32459
|
}
|
|
32166
32460
|
const envAccentStyle = environment?.accent ? { borderLeftColor: environment.accent } : void 0;
|
|
32167
|
-
return /* @__PURE__ */ (0,
|
|
32168
|
-
/* @__PURE__ */ (0,
|
|
32169
|
-
onBack && /* @__PURE__ */ (0,
|
|
32461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("header", { className: rootCls, "data-running": isRunning ? "true" : void 0, children: [
|
|
32462
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "ods-workflow-header__left", children: [
|
|
32463
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
32170
32464
|
"button",
|
|
32171
32465
|
{
|
|
32172
32466
|
type: "button",
|
|
@@ -32174,13 +32468,13 @@ function WorkflowHeader({
|
|
|
32174
32468
|
onClick: onBack,
|
|
32175
32469
|
"aria-label": `Back to ${typeof parentLabel === "string" ? parentLabel : "previous"}`,
|
|
32176
32470
|
children: [
|
|
32177
|
-
/* @__PURE__ */ (0,
|
|
32178
|
-
/* @__PURE__ */ (0,
|
|
32179
|
-
/* @__PURE__ */ (0,
|
|
32471
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons50.ChevronLeftIcon, { size: "sm" }),
|
|
32472
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__back-label", children: parentLabel }),
|
|
32473
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__back-separator", "aria-hidden": "true", children: "/" })
|
|
32180
32474
|
]
|
|
32181
32475
|
}
|
|
32182
32476
|
),
|
|
32183
|
-
/* @__PURE__ */ (0,
|
|
32477
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32184
32478
|
"span",
|
|
32185
32479
|
{
|
|
32186
32480
|
className: cn(
|
|
@@ -32191,10 +32485,10 @@ function WorkflowHeader({
|
|
|
32191
32485
|
role: "img"
|
|
32192
32486
|
}
|
|
32193
32487
|
),
|
|
32194
|
-
/* @__PURE__ */ (0,
|
|
32195
|
-
saveIndicator && /* @__PURE__ */ (0,
|
|
32196
|
-
/* @__PURE__ */ (0,
|
|
32197
|
-
/* @__PURE__ */ (0,
|
|
32488
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("h1", { className: "ods-workflow-header__title", title: typeof name === "string" ? name : void 0, children: name }),
|
|
32489
|
+
saveIndicator && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
|
|
32490
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__sep", "aria-hidden": "true" }),
|
|
32491
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32198
32492
|
"span",
|
|
32199
32493
|
{
|
|
32200
32494
|
className: cn(
|
|
@@ -32210,11 +32504,11 @@ function WorkflowHeader({
|
|
|
32210
32504
|
] }),
|
|
32211
32505
|
leftSlot
|
|
32212
32506
|
] }),
|
|
32213
|
-
/* @__PURE__ */ (0,
|
|
32507
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "ods-workflow-header__right", children: [
|
|
32214
32508
|
rightSlot,
|
|
32215
32509
|
environment && // Consumer-driven env chip. Accent (left border colour) comes
|
|
32216
32510
|
// from the consumer — we don't bake in environment names.
|
|
32217
|
-
/* @__PURE__ */ (0,
|
|
32511
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32218
32512
|
Chip,
|
|
32219
32513
|
{
|
|
32220
32514
|
size: "sm",
|
|
@@ -32230,71 +32524,72 @@ function WorkflowHeader({
|
|
|
32230
32524
|
children: environment.label
|
|
32231
32525
|
}
|
|
32232
32526
|
),
|
|
32233
|
-
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ (0,
|
|
32527
|
+
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32234
32528
|
Button,
|
|
32235
32529
|
{
|
|
32236
32530
|
variant: "ghost",
|
|
32237
32531
|
size: "sm",
|
|
32238
32532
|
pressed: !!isConsoleOpen,
|
|
32239
32533
|
"aria-label": isConsoleOpen ? "Hide execution console" : "Show execution console",
|
|
32240
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32534
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons50.TerminalIcon, { size: "sm" }),
|
|
32241
32535
|
onClick: onToggleConsole,
|
|
32242
32536
|
children: "Console"
|
|
32243
32537
|
}
|
|
32244
32538
|
),
|
|
32245
|
-
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ (0,
|
|
32246
|
-
isRunning ? onStop && /* @__PURE__ */ (0,
|
|
32539
|
+
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__micro-divider", "aria-hidden": "true" }),
|
|
32540
|
+
isRunning ? onStop && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32247
32541
|
Button,
|
|
32248
32542
|
{
|
|
32249
32543
|
variant: "ghost",
|
|
32250
32544
|
size: "sm",
|
|
32251
32545
|
"aria-label": runtime ? `Stop execution (running ${runtime})` : "Stop execution",
|
|
32252
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32546
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons50.StopFilledAltIcon, { size: "sm", className: "ods-workflow-header__stop-glyph" }),
|
|
32253
32547
|
onClick: onStop,
|
|
32254
|
-
children: /* @__PURE__ */ (0,
|
|
32255
|
-
/* @__PURE__ */ (0,
|
|
32256
|
-
runtime && /* @__PURE__ */ (0,
|
|
32257
|
-
/* @__PURE__ */ (0,
|
|
32258
|
-
/* @__PURE__ */ (0,
|
|
32548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("span", { className: "ods-workflow-header__stop-label", children: [
|
|
32549
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { children: "Stop" }),
|
|
32550
|
+
runtime && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
|
|
32551
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__stop-dot", "aria-hidden": "true", children: "\xB7" }),
|
|
32552
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__runtime", children: runtime })
|
|
32259
32553
|
] })
|
|
32260
32554
|
] })
|
|
32261
32555
|
}
|
|
32262
|
-
) : onRun && /* @__PURE__ */ (0,
|
|
32556
|
+
) : onRun && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32263
32557
|
Button,
|
|
32264
32558
|
{
|
|
32265
32559
|
variant: "primary",
|
|
32266
32560
|
size: "sm",
|
|
32267
32561
|
"aria-label": "Run workflow",
|
|
32268
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32562
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons50.PlayFilledAltIcon, { size: "sm" }),
|
|
32269
32563
|
onClick: onRun,
|
|
32270
32564
|
children: "Run"
|
|
32271
32565
|
}
|
|
32272
32566
|
),
|
|
32273
|
-
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
32567
|
+
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32274
32568
|
DropdownMenu,
|
|
32275
32569
|
{
|
|
32276
32570
|
"aria-label": menuLabel,
|
|
32277
32571
|
align: "end",
|
|
32572
|
+
triggerClassName: "ods-workflow-header__menu-trigger",
|
|
32278
32573
|
...menuProps,
|
|
32279
|
-
trigger: menuTrigger ?? /* @__PURE__ */ (0,
|
|
32280
|
-
|
|
32574
|
+
trigger: menuTrigger ?? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
32575
|
+
"span",
|
|
32281
32576
|
{
|
|
32282
|
-
|
|
32283
|
-
|
|
32284
|
-
|
|
32577
|
+
"aria-hidden": "true",
|
|
32578
|
+
className: "ods-workflow-header__menu-icon",
|
|
32579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons50.OverflowMenuVerticalIcon, { size: "sm" })
|
|
32285
32580
|
}
|
|
32286
32581
|
),
|
|
32287
32582
|
items: menuItems
|
|
32288
32583
|
}
|
|
32289
32584
|
))
|
|
32290
32585
|
] }),
|
|
32291
|
-
/* @__PURE__ */ (0,
|
|
32586
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { className: "ods-workflow-header__progress", "aria-hidden": "true" })
|
|
32292
32587
|
] });
|
|
32293
32588
|
}
|
|
32294
32589
|
|
|
32295
32590
|
// src/components/WorkflowHeader/WorkflowHeaderExpanded.tsx
|
|
32296
32591
|
var import_icons51 = require("@octaviaflow/icons");
|
|
32297
|
-
var
|
|
32592
|
+
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
32298
32593
|
function WorkflowHeaderExpanded({
|
|
32299
32594
|
name,
|
|
32300
32595
|
statusTone = "draft",
|
|
@@ -32322,15 +32617,15 @@ function WorkflowHeaderExpanded({
|
|
|
32322
32617
|
const tickedRuntime = useWorkflowRuntime(runStartedAt, !!isRunning);
|
|
32323
32618
|
const runtime = runtimeOverride ?? tickedRuntime ?? void 0;
|
|
32324
32619
|
const effectiveTone = statusTone === "draft" && isRunning ? "running" : statusTone;
|
|
32325
|
-
return /* @__PURE__ */ (0,
|
|
32620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
|
|
32326
32621
|
"header",
|
|
32327
32622
|
{
|
|
32328
32623
|
className: cn("ods-workflow-header-expanded", className),
|
|
32329
32624
|
"data-running": isRunning ? "true" : void 0,
|
|
32330
32625
|
children: [
|
|
32331
|
-
/* @__PURE__ */ (0,
|
|
32332
|
-
/* @__PURE__ */ (0,
|
|
32333
|
-
onBack && /* @__PURE__ */ (0,
|
|
32626
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("div", { className: "ods-workflow-header-expanded__row ods-workflow-header-expanded__row--top", children: [
|
|
32627
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("div", { className: "ods-workflow-header-expanded__left", children: [
|
|
32628
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
|
|
32334
32629
|
"button",
|
|
32335
32630
|
{
|
|
32336
32631
|
type: "button",
|
|
@@ -32338,13 +32633,13 @@ function WorkflowHeaderExpanded({
|
|
|
32338
32633
|
onClick: onBack,
|
|
32339
32634
|
"aria-label": `Back to ${typeof parentLabel === "string" ? parentLabel : "previous"}`,
|
|
32340
32635
|
children: [
|
|
32341
|
-
/* @__PURE__ */ (0,
|
|
32342
|
-
/* @__PURE__ */ (0,
|
|
32343
|
-
/* @__PURE__ */ (0,
|
|
32636
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons51.ChevronLeftIcon, { size: "sm" }),
|
|
32637
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { children: parentLabel }),
|
|
32638
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { "aria-hidden": "true", className: "ods-workflow-header-expanded__back-sep", children: "/" })
|
|
32344
32639
|
]
|
|
32345
32640
|
}
|
|
32346
32641
|
),
|
|
32347
|
-
/* @__PURE__ */ (0,
|
|
32642
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32348
32643
|
"span",
|
|
32349
32644
|
{
|
|
32350
32645
|
className: cn(
|
|
@@ -32355,10 +32650,10 @@ function WorkflowHeaderExpanded({
|
|
|
32355
32650
|
role: "img"
|
|
32356
32651
|
}
|
|
32357
32652
|
),
|
|
32358
|
-
/* @__PURE__ */ (0,
|
|
32653
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("h1", { className: "ods-workflow-header-expanded__title", children: name })
|
|
32359
32654
|
] }),
|
|
32360
|
-
/* @__PURE__ */ (0,
|
|
32361
|
-
environment && /* @__PURE__ */ (0,
|
|
32655
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("div", { className: "ods-workflow-header-expanded__right", children: [
|
|
32656
|
+
environment && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32362
32657
|
Chip,
|
|
32363
32658
|
{
|
|
32364
32659
|
size: "sm",
|
|
@@ -32370,58 +32665,58 @@ function WorkflowHeaderExpanded({
|
|
|
32370
32665
|
children: environment.label
|
|
32371
32666
|
}
|
|
32372
32667
|
),
|
|
32373
|
-
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ (0,
|
|
32668
|
+
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32374
32669
|
Button,
|
|
32375
32670
|
{
|
|
32376
32671
|
variant: "ghost",
|
|
32377
32672
|
size: "sm",
|
|
32378
32673
|
pressed: !!isConsoleOpen,
|
|
32379
32674
|
"aria-label": isConsoleOpen ? "Hide execution console" : "Show execution console",
|
|
32380
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32675
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons51.TerminalIcon, { size: "sm" }),
|
|
32381
32676
|
onClick: onToggleConsole,
|
|
32382
32677
|
children: "Console"
|
|
32383
32678
|
}
|
|
32384
32679
|
),
|
|
32385
|
-
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ (0,
|
|
32386
|
-
isRunning ? onStop && /* @__PURE__ */ (0,
|
|
32680
|
+
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "ods-workflow-header-expanded__micro-divider", "aria-hidden": "true" }),
|
|
32681
|
+
isRunning ? onStop && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32387
32682
|
Button,
|
|
32388
32683
|
{
|
|
32389
32684
|
variant: "ghost",
|
|
32390
32685
|
size: "sm",
|
|
32391
32686
|
"aria-label": runtime ? `Stop execution (running ${runtime})` : "Stop execution",
|
|
32392
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32687
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons51.StopFilledAltIcon, { size: "sm", className: "ods-workflow-header-expanded__stop-glyph" }),
|
|
32393
32688
|
onClick: onStop,
|
|
32394
|
-
children: /* @__PURE__ */ (0,
|
|
32395
|
-
/* @__PURE__ */ (0,
|
|
32396
|
-
runtime && /* @__PURE__ */ (0,
|
|
32397
|
-
/* @__PURE__ */ (0,
|
|
32398
|
-
/* @__PURE__ */ (0,
|
|
32689
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { style: { display: "inline-flex", gap: 4, alignItems: "center" }, children: [
|
|
32690
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { children: "Stop" }),
|
|
32691
|
+
runtime && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [
|
|
32692
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { "aria-hidden": "true", style: { opacity: 0.6 }, children: "\xB7" }),
|
|
32693
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "ods-workflow-header-expanded__runtime", children: runtime })
|
|
32399
32694
|
] })
|
|
32400
32695
|
] })
|
|
32401
32696
|
}
|
|
32402
|
-
) : onRun && /* @__PURE__ */ (0,
|
|
32697
|
+
) : onRun && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32403
32698
|
Button,
|
|
32404
32699
|
{
|
|
32405
32700
|
variant: "primary",
|
|
32406
32701
|
size: "sm",
|
|
32407
32702
|
"aria-label": "Run workflow",
|
|
32408
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32703
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons51.PlayFilledAltIcon, { size: "sm" }),
|
|
32409
32704
|
onClick: onRun,
|
|
32410
32705
|
children: "Run"
|
|
32411
32706
|
}
|
|
32412
32707
|
),
|
|
32413
|
-
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
32708
|
+
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32414
32709
|
DropdownMenu,
|
|
32415
32710
|
{
|
|
32416
32711
|
"aria-label": menuLabel,
|
|
32417
32712
|
align: "end",
|
|
32418
32713
|
...menuProps,
|
|
32419
|
-
trigger: menuTrigger ?? /* @__PURE__ */ (0,
|
|
32714
|
+
trigger: menuTrigger ?? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32420
32715
|
Button,
|
|
32421
32716
|
{
|
|
32422
32717
|
variant: "ghost",
|
|
32423
32718
|
size: "sm",
|
|
32424
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
32719
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons51.OverflowMenuVerticalIcon, { size: "sm" })
|
|
32425
32720
|
}
|
|
32426
32721
|
),
|
|
32427
32722
|
items: menuItems
|
|
@@ -32429,10 +32724,10 @@ function WorkflowHeaderExpanded({
|
|
|
32429
32724
|
))
|
|
32430
32725
|
] })
|
|
32431
32726
|
] }),
|
|
32432
|
-
(meta || saveLabel) && /* @__PURE__ */ (0,
|
|
32727
|
+
(meta || saveLabel) && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "ods-workflow-header-expanded__row ods-workflow-header-expanded__row--bottom", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { className: "ods-workflow-header-expanded__meta", children: [
|
|
32433
32728
|
meta,
|
|
32434
|
-
meta && saveLabel && /* @__PURE__ */ (0,
|
|
32435
|
-
saveLabel && /* @__PURE__ */ (0,
|
|
32729
|
+
meta && saveLabel && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { "aria-hidden": "true", style: { margin: "0 6px", opacity: 0.4 }, children: "\xB7" }),
|
|
32730
|
+
saveLabel && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
32436
32731
|
"span",
|
|
32437
32732
|
{
|
|
32438
32733
|
className: cn(
|
|
@@ -32444,7 +32739,7 @@ function WorkflowHeaderExpanded({
|
|
|
32444
32739
|
}
|
|
32445
32740
|
)
|
|
32446
32741
|
] }) }),
|
|
32447
|
-
/* @__PURE__ */ (0,
|
|
32742
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "ods-workflow-header-expanded__progress", "aria-hidden": "true" })
|
|
32448
32743
|
]
|
|
32449
32744
|
}
|
|
32450
32745
|
);
|
|
@@ -32453,8 +32748,8 @@ function WorkflowHeaderExpanded({
|
|
|
32453
32748
|
// src/components/XmlViewer/XmlViewer.tsx
|
|
32454
32749
|
var import_icons52 = require("@octaviaflow/icons");
|
|
32455
32750
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
32456
|
-
var
|
|
32457
|
-
var
|
|
32751
|
+
var import_react158 = require("react");
|
|
32752
|
+
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
32458
32753
|
function parseXml(src) {
|
|
32459
32754
|
if (typeof window !== "undefined" && typeof window.DOMParser !== "undefined") {
|
|
32460
32755
|
try {
|
|
@@ -32521,7 +32816,7 @@ ${pad2}</${node.name}>`;
|
|
|
32521
32816
|
}
|
|
32522
32817
|
}
|
|
32523
32818
|
}
|
|
32524
|
-
var XmlViewer = (0,
|
|
32819
|
+
var XmlViewer = (0, import_react158.forwardRef)(
|
|
32525
32820
|
function XmlViewer2({
|
|
32526
32821
|
data,
|
|
32527
32822
|
mode = "view",
|
|
@@ -32539,13 +32834,13 @@ var XmlViewer = (0, import_react157.forwardRef)(
|
|
|
32539
32834
|
className,
|
|
32540
32835
|
...rest
|
|
32541
32836
|
}, ref) {
|
|
32542
|
-
const reactId = (0,
|
|
32837
|
+
const reactId = (0, import_react158.useId)();
|
|
32543
32838
|
const baseId = providedId ?? `ods-xml-viewer-${reactId}`;
|
|
32544
|
-
const parsed = (0,
|
|
32839
|
+
const parsed = (0, import_react158.useMemo)(() => parseXml(data), [data]);
|
|
32545
32840
|
const bodyStyle = height !== void 0 ? { height: typeof height === "number" ? `${height}px` : height } : maxHeight !== void 0 ? {
|
|
32546
32841
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
32547
32842
|
} : void 0;
|
|
32548
|
-
return /* @__PURE__ */ (0,
|
|
32843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
32549
32844
|
"div",
|
|
32550
32845
|
{
|
|
32551
32846
|
...rest,
|
|
@@ -32553,9 +32848,9 @@ var XmlViewer = (0, import_react157.forwardRef)(
|
|
|
32553
32848
|
id: baseId,
|
|
32554
32849
|
className: cn("ods-xml-viewer", className),
|
|
32555
32850
|
children: [
|
|
32556
|
-
(title || status || parsed.error) && /* @__PURE__ */ (0,
|
|
32557
|
-
title && /* @__PURE__ */ (0,
|
|
32558
|
-
parsed.error && /* @__PURE__ */ (0,
|
|
32851
|
+
(title || status || parsed.error) && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__head", children: [
|
|
32852
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__title", children: title }),
|
|
32853
|
+
parsed.error && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32559
32854
|
"span",
|
|
32560
32855
|
{
|
|
32561
32856
|
className: "ods-xml-viewer__status ods-xml-viewer__status--error",
|
|
@@ -32563,9 +32858,9 @@ var XmlViewer = (0, import_react157.forwardRef)(
|
|
|
32563
32858
|
children: "Invalid XML"
|
|
32564
32859
|
}
|
|
32565
32860
|
),
|
|
32566
|
-
status && !parsed.error && /* @__PURE__ */ (0,
|
|
32861
|
+
status && !parsed.error && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__status", children: status })
|
|
32567
32862
|
] }),
|
|
32568
|
-
/* @__PURE__ */ (0,
|
|
32863
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "ods-xml-viewer__body", style: bodyStyle, "data-mode": mode, children: mode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(XmlEditBody, { text: data, onChange, onValidate }) : parsed.error ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("pre", { className: "ods-xml-viewer__raw", children: data }) : parsed.root ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32569
32864
|
XmlNodeRow,
|
|
32570
32865
|
{
|
|
32571
32866
|
node: parsed.root,
|
|
@@ -32583,8 +32878,8 @@ var XmlViewer = (0, import_react157.forwardRef)(
|
|
|
32583
32878
|
);
|
|
32584
32879
|
XmlViewer.displayName = "XmlViewer";
|
|
32585
32880
|
function XmlEditBody({ text: initial, onChange, onValidate }) {
|
|
32586
|
-
const [text, setText] = (0,
|
|
32587
|
-
const [parseError, setParseError] = (0,
|
|
32881
|
+
const [text, setText] = (0, import_react158.useState)(initial);
|
|
32882
|
+
const [parseError, setParseError] = (0, import_react158.useState)(null);
|
|
32588
32883
|
const validate = (next) => {
|
|
32589
32884
|
const result = import_fast_xml_parser.XMLValidator.validate(next);
|
|
32590
32885
|
if (result === true) {
|
|
@@ -32606,11 +32901,11 @@ function XmlEditBody({ text: initial, onChange, onValidate }) {
|
|
|
32606
32901
|
onChange?.(next);
|
|
32607
32902
|
validate(next);
|
|
32608
32903
|
};
|
|
32609
|
-
(0,
|
|
32904
|
+
(0, import_react158.useEffect)(() => {
|
|
32610
32905
|
validate(initial);
|
|
32611
32906
|
}, []);
|
|
32612
|
-
return /* @__PURE__ */ (0,
|
|
32613
|
-
parseError && /* @__PURE__ */ (0,
|
|
32907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__edit", children: [
|
|
32908
|
+
parseError && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
32614
32909
|
InlineMessage,
|
|
32615
32910
|
{
|
|
32616
32911
|
tone: "danger",
|
|
@@ -32627,7 +32922,7 @@ function XmlEditBody({ text: initial, onChange, onValidate }) {
|
|
|
32627
32922
|
]
|
|
32628
32923
|
}
|
|
32629
32924
|
),
|
|
32630
|
-
/* @__PURE__ */ (0,
|
|
32925
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32631
32926
|
CodeEditor,
|
|
32632
32927
|
{
|
|
32633
32928
|
value: text,
|
|
@@ -32647,10 +32942,10 @@ function XmlNodeRow({
|
|
|
32647
32942
|
truncateAt,
|
|
32648
32943
|
copyable
|
|
32649
32944
|
}) {
|
|
32650
|
-
const [open, setOpen] = (0,
|
|
32651
|
-
const [copied, setCopied] = (0,
|
|
32945
|
+
const [open, setOpen] = (0, import_react158.useState)(depth < defaultExpandDepth);
|
|
32946
|
+
const [copied, setCopied] = (0, import_react158.useState)(false);
|
|
32652
32947
|
const pad2 = depth * 14;
|
|
32653
|
-
const onCopy = (0,
|
|
32948
|
+
const onCopy = (0, import_react158.useCallback)(
|
|
32654
32949
|
(e) => {
|
|
32655
32950
|
e.stopPropagation();
|
|
32656
32951
|
const text = serializeNode(node);
|
|
@@ -32670,41 +32965,41 @@ function XmlNodeRow({
|
|
|
32670
32965
|
if (node.type === "text") {
|
|
32671
32966
|
const t = (node.text ?? "").trim();
|
|
32672
32967
|
const truncated = t.length > truncateAt ? `${t.slice(0, truncateAt)}\u2026` : t;
|
|
32673
|
-
return /* @__PURE__ */ (0,
|
|
32674
|
-
/* @__PURE__ */ (0,
|
|
32675
|
-
/* @__PURE__ */ (0,
|
|
32968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__row", style: { paddingLeft: pad2 }, children: [
|
|
32969
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }),
|
|
32970
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__text", children: truncated })
|
|
32676
32971
|
] });
|
|
32677
32972
|
}
|
|
32678
32973
|
if (node.type === "comment") {
|
|
32679
|
-
return /* @__PURE__ */ (0,
|
|
32680
|
-
/* @__PURE__ */ (0,
|
|
32681
|
-
/* @__PURE__ */ (0,
|
|
32974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__row", style: { paddingLeft: pad2 }, children: [
|
|
32975
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }),
|
|
32976
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__comment", children: `<!-- ${node.text} -->` })
|
|
32682
32977
|
] });
|
|
32683
32978
|
}
|
|
32684
32979
|
if (node.type === "cdata") {
|
|
32685
|
-
return /* @__PURE__ */ (0,
|
|
32686
|
-
/* @__PURE__ */ (0,
|
|
32687
|
-
/* @__PURE__ */ (0,
|
|
32980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__row", style: { paddingLeft: pad2 }, children: [
|
|
32981
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }),
|
|
32982
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__cdata", children: `<![CDATA[${node.text}]]>` })
|
|
32688
32983
|
] });
|
|
32689
32984
|
}
|
|
32690
32985
|
if (node.type === "pi") {
|
|
32691
|
-
return /* @__PURE__ */ (0,
|
|
32692
|
-
/* @__PURE__ */ (0,
|
|
32693
|
-
/* @__PURE__ */ (0,
|
|
32986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__row", style: { paddingLeft: pad2 }, children: [
|
|
32987
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }),
|
|
32988
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__pi", children: `<?${node.text}?>` })
|
|
32694
32989
|
] });
|
|
32695
32990
|
}
|
|
32696
32991
|
const children = node.children ?? [];
|
|
32697
32992
|
const isSelfClosing = children.length === 0;
|
|
32698
32993
|
const attrs = Object.entries(node.attributes ?? {});
|
|
32699
|
-
return /* @__PURE__ */ (0,
|
|
32700
|
-
/* @__PURE__ */ (0,
|
|
32994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { children: [
|
|
32995
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
32701
32996
|
"div",
|
|
32702
32997
|
{
|
|
32703
32998
|
className: "ods-xml-viewer__row ods-xml-viewer__row--element",
|
|
32704
32999
|
style: { paddingLeft: pad2 },
|
|
32705
33000
|
onClick: () => !isSelfClosing && setOpen((o) => !o),
|
|
32706
33001
|
children: [
|
|
32707
|
-
isSelfClosing ? /* @__PURE__ */ (0,
|
|
33002
|
+
isSelfClosing ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32708
33003
|
"button",
|
|
32709
33004
|
{
|
|
32710
33005
|
type: "button",
|
|
@@ -32718,30 +33013,30 @@ function XmlNodeRow({
|
|
|
32718
33013
|
e.stopPropagation();
|
|
32719
33014
|
setOpen((o) => !o);
|
|
32720
33015
|
},
|
|
32721
|
-
children: /* @__PURE__ */ (0,
|
|
33016
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_icons52.ChevronRightIcon, { size: "xs" })
|
|
32722
33017
|
}
|
|
32723
33018
|
),
|
|
32724
|
-
/* @__PURE__ */ (0,
|
|
32725
|
-
/* @__PURE__ */ (0,
|
|
32726
|
-
showAttributes && attrs.map(([k, v]) => /* @__PURE__ */ (0,
|
|
32727
|
-
/* @__PURE__ */ (0,
|
|
32728
|
-
/* @__PURE__ */ (0,
|
|
32729
|
-
/* @__PURE__ */ (0,
|
|
33019
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: "<" }),
|
|
33020
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__tag", children: node.name }),
|
|
33021
|
+
showAttributes && attrs.map(([k, v]) => /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("span", { className: "ods-xml-viewer__attr", children: [
|
|
33022
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__attr-name", children: k }),
|
|
33023
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__attr-eq", children: "=" }),
|
|
33024
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__attr-value", children: `"${v}"` })
|
|
32730
33025
|
] }, k)),
|
|
32731
|
-
isSelfClosing ? /* @__PURE__ */ (0,
|
|
32732
|
-
/* @__PURE__ */ (0,
|
|
32733
|
-
!open && /* @__PURE__ */ (0,
|
|
32734
|
-
/* @__PURE__ */ (0,
|
|
33026
|
+
isSelfClosing ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: " />" }) : /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
33027
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: ">" }),
|
|
33028
|
+
!open && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
33029
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("span", { className: "ods-xml-viewer__preview", children: [
|
|
32735
33030
|
children.length,
|
|
32736
33031
|
" child",
|
|
32737
33032
|
children.length === 1 ? "" : "ren"
|
|
32738
33033
|
] }),
|
|
32739
|
-
/* @__PURE__ */ (0,
|
|
32740
|
-
/* @__PURE__ */ (0,
|
|
32741
|
-
/* @__PURE__ */ (0,
|
|
33034
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: "</" }),
|
|
33035
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__tag", children: node.name }),
|
|
33036
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: ">" })
|
|
32742
33037
|
] })
|
|
32743
33038
|
] }),
|
|
32744
|
-
copyable && /* @__PURE__ */ (0,
|
|
33039
|
+
copyable && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32745
33040
|
"button",
|
|
32746
33041
|
{
|
|
32747
33042
|
type: "button",
|
|
@@ -32751,14 +33046,14 @@ function XmlNodeRow({
|
|
|
32751
33046
|
),
|
|
32752
33047
|
"aria-label": copied ? "Copied" : `Copy ${node.name} subtree`,
|
|
32753
33048
|
onClick: onCopy,
|
|
32754
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
33049
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_icons52.CheckmarkIcon, { size: "xs" }) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_icons52.CopyIcon, { size: "xs" })
|
|
32755
33050
|
}
|
|
32756
33051
|
)
|
|
32757
33052
|
]
|
|
32758
33053
|
}
|
|
32759
33054
|
),
|
|
32760
|
-
!isSelfClosing && open && /* @__PURE__ */ (0,
|
|
32761
|
-
children.map((c, i) => /* @__PURE__ */ (0,
|
|
33055
|
+
!isSelfClosing && open && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
33056
|
+
children.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
32762
33057
|
XmlNodeRow,
|
|
32763
33058
|
{
|
|
32764
33059
|
node: c,
|
|
@@ -32770,11 +33065,11 @@ function XmlNodeRow({
|
|
|
32770
33065
|
},
|
|
32771
33066
|
i
|
|
32772
33067
|
)),
|
|
32773
|
-
/* @__PURE__ */ (0,
|
|
32774
|
-
/* @__PURE__ */ (0,
|
|
32775
|
-
/* @__PURE__ */ (0,
|
|
32776
|
-
/* @__PURE__ */ (0,
|
|
32777
|
-
/* @__PURE__ */ (0,
|
|
33068
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "ods-xml-viewer__row", style: { paddingLeft: pad2 }, children: [
|
|
33069
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__caret-spacer" }),
|
|
33070
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: "</" }),
|
|
33071
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__tag", children: node.name }),
|
|
33072
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: "ods-xml-viewer__bracket", children: ">" })
|
|
32778
33073
|
] })
|
|
32779
33074
|
] })
|
|
32780
33075
|
] });
|
|
@@ -32782,9 +33077,9 @@ function XmlNodeRow({
|
|
|
32782
33077
|
|
|
32783
33078
|
// src/components/YamlViewer/YamlViewer.tsx
|
|
32784
33079
|
var import_icons53 = require("@octaviaflow/icons");
|
|
32785
|
-
var
|
|
33080
|
+
var import_react159 = require("react");
|
|
32786
33081
|
var import_yaml = __toESM(require("yaml"), 1);
|
|
32787
|
-
var
|
|
33082
|
+
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
32788
33083
|
function toYaml(value, indent = 0) {
|
|
32789
33084
|
const pad2 = " ".repeat(indent);
|
|
32790
33085
|
if (value === null) return "null";
|
|
@@ -32909,7 +33204,7 @@ function valueClass(v) {
|
|
|
32909
33204
|
if (/^['"].*['"]$/.test(v)) return "string";
|
|
32910
33205
|
return "string";
|
|
32911
33206
|
}
|
|
32912
|
-
var YamlViewer = (0,
|
|
33207
|
+
var YamlViewer = (0, import_react159.forwardRef)(
|
|
32913
33208
|
function YamlViewer2({
|
|
32914
33209
|
data,
|
|
32915
33210
|
mode = "view",
|
|
@@ -32927,9 +33222,9 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32927
33222
|
className,
|
|
32928
33223
|
...rest
|
|
32929
33224
|
}, ref) {
|
|
32930
|
-
const reactId = (0,
|
|
33225
|
+
const reactId = (0, import_react159.useId)();
|
|
32931
33226
|
const baseId = providedId ?? `ods-yaml-viewer-${reactId}`;
|
|
32932
|
-
const text = (0,
|
|
33227
|
+
const text = (0, import_react159.useMemo)(() => {
|
|
32933
33228
|
if (typeof data === "string") return data;
|
|
32934
33229
|
try {
|
|
32935
33230
|
return toYaml(data);
|
|
@@ -32937,15 +33232,15 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32937
33232
|
return JSON.stringify(data, null, 2);
|
|
32938
33233
|
}
|
|
32939
33234
|
}, [data]);
|
|
32940
|
-
const tokens = (0,
|
|
32941
|
-
const [collapsed, setCollapsed] = (0,
|
|
33235
|
+
const tokens = (0, import_react159.useMemo)(() => tokenizeYaml(text), [text]);
|
|
33236
|
+
const [collapsed, setCollapsed] = (0, import_react159.useState)(() => {
|
|
32942
33237
|
const s = /* @__PURE__ */ new Set();
|
|
32943
33238
|
tokens.forEach((t) => {
|
|
32944
33239
|
if (t.hasChildren && t.depth >= defaultExpandDepth) s.add(t.index);
|
|
32945
33240
|
});
|
|
32946
33241
|
return s;
|
|
32947
33242
|
});
|
|
32948
|
-
const toggle = (0,
|
|
33243
|
+
const toggle = (0, import_react159.useCallback)((idx) => {
|
|
32949
33244
|
setCollapsed((prev) => {
|
|
32950
33245
|
const next = new Set(prev);
|
|
32951
33246
|
if (next.has(idx)) next.delete(idx);
|
|
@@ -32953,7 +33248,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32953
33248
|
return next;
|
|
32954
33249
|
});
|
|
32955
33250
|
}, []);
|
|
32956
|
-
const hidden = (0,
|
|
33251
|
+
const hidden = (0, import_react159.useMemo)(() => {
|
|
32957
33252
|
const hide = /* @__PURE__ */ new Set();
|
|
32958
33253
|
for (let i = 0; i < tokens.length; i++) {
|
|
32959
33254
|
const t = tokens[i];
|
|
@@ -32968,8 +33263,8 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32968
33263
|
}
|
|
32969
33264
|
return hide;
|
|
32970
33265
|
}, [tokens, collapsed]);
|
|
32971
|
-
const [copied, setCopied] = (0,
|
|
32972
|
-
const onCopy = (0,
|
|
33266
|
+
const [copied, setCopied] = (0, import_react159.useState)(false);
|
|
33267
|
+
const onCopy = (0, import_react159.useCallback)(() => {
|
|
32973
33268
|
if (!navigator?.clipboard?.writeText) return;
|
|
32974
33269
|
navigator.clipboard.writeText(text).then(
|
|
32975
33270
|
() => {
|
|
@@ -32983,7 +33278,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32983
33278
|
const bodyStyle = height !== void 0 ? { height: typeof height === "number" ? `${height}px` : height } : maxHeight !== void 0 ? {
|
|
32984
33279
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
32985
33280
|
} : void 0;
|
|
32986
|
-
return /* @__PURE__ */ (0,
|
|
33281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
32987
33282
|
"div",
|
|
32988
33283
|
{
|
|
32989
33284
|
...rest,
|
|
@@ -32995,11 +33290,11 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
32995
33290
|
className
|
|
32996
33291
|
),
|
|
32997
33292
|
children: [
|
|
32998
|
-
(title || status || copyable) && /* @__PURE__ */ (0,
|
|
32999
|
-
title && /* @__PURE__ */ (0,
|
|
33000
|
-
/* @__PURE__ */ (0,
|
|
33001
|
-
status && /* @__PURE__ */ (0,
|
|
33002
|
-
copyable && /* @__PURE__ */ (0,
|
|
33293
|
+
(title || status || copyable) && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "ods-yaml-viewer__head", children: [
|
|
33294
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__title", children: title }),
|
|
33295
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { className: "ods-yaml-viewer__head-right", children: [
|
|
33296
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__status", children: status }),
|
|
33297
|
+
copyable && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33003
33298
|
"button",
|
|
33004
33299
|
{
|
|
33005
33300
|
type: "button",
|
|
@@ -33009,16 +33304,16 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33009
33304
|
),
|
|
33010
33305
|
"aria-label": copied ? "Copied" : "Copy YAML",
|
|
33011
33306
|
onClick: onCopy,
|
|
33012
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
33307
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons53.CheckmarkIcon, { size: "xs" }) : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons53.CopyIcon, { size: "xs" })
|
|
33013
33308
|
}
|
|
33014
33309
|
)
|
|
33015
33310
|
] })
|
|
33016
33311
|
] }),
|
|
33017
|
-
/* @__PURE__ */ (0,
|
|
33312
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "ods-yaml-viewer__body", style: bodyStyle, "data-mode": mode, children: mode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(YamlEditBody, { text, onChange, onValidate }) : tokens.map((t) => {
|
|
33018
33313
|
if (hidden.has(t.index)) return null;
|
|
33019
33314
|
const lineNo = t.index + 1;
|
|
33020
33315
|
const isCollapsed = collapsed.has(t.index);
|
|
33021
|
-
return /* @__PURE__ */ (0,
|
|
33316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
33022
33317
|
"div",
|
|
33023
33318
|
{
|
|
33024
33319
|
className: cn(
|
|
@@ -33027,7 +33322,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33027
33322
|
isCollapsed && "ods-yaml-viewer__line--collapsed"
|
|
33028
33323
|
),
|
|
33029
33324
|
children: [
|
|
33030
|
-
showLineNumbers && /* @__PURE__ */ (0,
|
|
33325
|
+
showLineNumbers && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33031
33326
|
"span",
|
|
33032
33327
|
{
|
|
33033
33328
|
className: "ods-yaml-viewer__line-no",
|
|
@@ -33035,7 +33330,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33035
33330
|
children: lineNo
|
|
33036
33331
|
}
|
|
33037
33332
|
),
|
|
33038
|
-
/* @__PURE__ */ (0,
|
|
33333
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33039
33334
|
"span",
|
|
33040
33335
|
{
|
|
33041
33336
|
className: "ods-yaml-viewer__indent",
|
|
@@ -33043,7 +33338,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33043
33338
|
"aria-hidden": "true"
|
|
33044
33339
|
}
|
|
33045
33340
|
),
|
|
33046
|
-
t.hasChildren ? /* @__PURE__ */ (0,
|
|
33341
|
+
t.hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33047
33342
|
"button",
|
|
33048
33343
|
{
|
|
33049
33344
|
type: "button",
|
|
@@ -33054,15 +33349,15 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33054
33349
|
onClick: () => toggle(t.index),
|
|
33055
33350
|
"aria-expanded": !isCollapsed,
|
|
33056
33351
|
"aria-label": isCollapsed ? "Expand" : "Collapse",
|
|
33057
|
-
children: /* @__PURE__ */ (0,
|
|
33352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons53.ChevronRightIcon, { size: "xs" })
|
|
33058
33353
|
}
|
|
33059
|
-
) : /* @__PURE__ */ (0,
|
|
33060
|
-
t.kind === "comment" && /* @__PURE__ */ (0,
|
|
33061
|
-
t.kind === "key" && /* @__PURE__ */ (0,
|
|
33062
|
-
t.raw.trim().startsWith("-") && /* @__PURE__ */ (0,
|
|
33063
|
-
/* @__PURE__ */ (0,
|
|
33064
|
-
/* @__PURE__ */ (0,
|
|
33065
|
-
t.inlineValue && /* @__PURE__ */ (0,
|
|
33354
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__caret-spacer" }),
|
|
33355
|
+
t.kind === "comment" && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__comment", children: t.raw.trim() }),
|
|
33356
|
+
t.kind === "key" && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
|
|
33357
|
+
t.raw.trim().startsWith("-") && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__dash", children: "- " }),
|
|
33358
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__key", children: t.key }),
|
|
33359
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__colon", children: ":" }),
|
|
33360
|
+
t.inlineValue && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
33066
33361
|
"span",
|
|
33067
33362
|
{
|
|
33068
33363
|
className: cn(
|
|
@@ -33075,11 +33370,11 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33075
33370
|
]
|
|
33076
33371
|
}
|
|
33077
33372
|
),
|
|
33078
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
33373
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__preview", children: " \u2026" })
|
|
33079
33374
|
] }),
|
|
33080
|
-
t.kind === "sequence" && /* @__PURE__ */ (0,
|
|
33081
|
-
/* @__PURE__ */ (0,
|
|
33082
|
-
/* @__PURE__ */ (0,
|
|
33375
|
+
t.kind === "sequence" && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
|
|
33376
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { className: "ods-yaml-viewer__dash", children: "- " }),
|
|
33377
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33083
33378
|
"span",
|
|
33084
33379
|
{
|
|
33085
33380
|
className: cn(
|
|
@@ -33090,7 +33385,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33090
33385
|
}
|
|
33091
33386
|
)
|
|
33092
33387
|
] }),
|
|
33093
|
-
t.kind === "scalar" && /* @__PURE__ */ (0,
|
|
33388
|
+
t.kind === "scalar" && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33094
33389
|
"span",
|
|
33095
33390
|
{
|
|
33096
33391
|
className: cn(
|
|
@@ -33100,7 +33395,7 @@ var YamlViewer = (0, import_react158.forwardRef)(
|
|
|
33100
33395
|
children: t.raw.trim()
|
|
33101
33396
|
}
|
|
33102
33397
|
),
|
|
33103
|
-
t.kind === "blank" && /* @__PURE__ */ (0,
|
|
33398
|
+
t.kind === "blank" && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { children: "\xA0" })
|
|
33104
33399
|
]
|
|
33105
33400
|
},
|
|
33106
33401
|
t.index
|
|
@@ -33135,8 +33430,8 @@ function extractYamlErrorPosition(err, text) {
|
|
|
33135
33430
|
return { line: 1, col: 1, message };
|
|
33136
33431
|
}
|
|
33137
33432
|
function YamlEditBody({ text: initial, onChange, onValidate }) {
|
|
33138
|
-
const [text, setText] = (0,
|
|
33139
|
-
const [parseError, setParseError] = (0,
|
|
33433
|
+
const [text, setText] = (0, import_react159.useState)(initial);
|
|
33434
|
+
const [parseError, setParseError] = (0, import_react159.useState)(null);
|
|
33140
33435
|
const validate = (next) => {
|
|
33141
33436
|
try {
|
|
33142
33437
|
import_yaml.default.parse(next);
|
|
@@ -33153,11 +33448,11 @@ function YamlEditBody({ text: initial, onChange, onValidate }) {
|
|
|
33153
33448
|
onChange?.(next);
|
|
33154
33449
|
validate(next);
|
|
33155
33450
|
};
|
|
33156
|
-
(0,
|
|
33451
|
+
(0, import_react159.useEffect)(() => {
|
|
33157
33452
|
validate(initial);
|
|
33158
33453
|
}, []);
|
|
33159
|
-
return /* @__PURE__ */ (0,
|
|
33160
|
-
parseError && /* @__PURE__ */ (0,
|
|
33454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "ods-yaml-viewer__edit", children: [
|
|
33455
|
+
parseError && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
33161
33456
|
InlineMessage,
|
|
33162
33457
|
{
|
|
33163
33458
|
tone: "danger",
|
|
@@ -33174,7 +33469,7 @@ function YamlEditBody({ text: initial, onChange, onValidate }) {
|
|
|
33174
33469
|
]
|
|
33175
33470
|
}
|
|
33176
33471
|
),
|
|
33177
|
-
/* @__PURE__ */ (0,
|
|
33472
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
33178
33473
|
CodeEditor,
|
|
33179
33474
|
{
|
|
33180
33475
|
value: text,
|
|
@@ -33188,29 +33483,29 @@ function YamlEditBody({ text: initial, onChange, onValidate }) {
|
|
|
33188
33483
|
}
|
|
33189
33484
|
|
|
33190
33485
|
// src/hooks/useBanner.ts
|
|
33191
|
-
var
|
|
33486
|
+
var import_react160 = require("react");
|
|
33192
33487
|
function useBanner(options = {}) {
|
|
33193
33488
|
const { defaultOpen = false, autoDismissAfter, onDismiss } = options;
|
|
33194
|
-
const [open, setOpen] = (0,
|
|
33195
|
-
const timerRef = (0,
|
|
33196
|
-
const onDismissRef = (0,
|
|
33197
|
-
(0,
|
|
33489
|
+
const [open, setOpen] = (0, import_react160.useState)(defaultOpen);
|
|
33490
|
+
const timerRef = (0, import_react160.useRef)(null);
|
|
33491
|
+
const onDismissRef = (0, import_react160.useRef)(onDismiss);
|
|
33492
|
+
(0, import_react160.useEffect)(() => {
|
|
33198
33493
|
onDismissRef.current = onDismiss;
|
|
33199
33494
|
}, [onDismiss]);
|
|
33200
|
-
const clearTimer = (0,
|
|
33495
|
+
const clearTimer = (0, import_react160.useCallback)(() => {
|
|
33201
33496
|
if (timerRef.current !== null) {
|
|
33202
33497
|
clearTimeout(timerRef.current);
|
|
33203
33498
|
timerRef.current = null;
|
|
33204
33499
|
}
|
|
33205
33500
|
}, []);
|
|
33206
|
-
const hide = (0,
|
|
33501
|
+
const hide = (0, import_react160.useCallback)(() => {
|
|
33207
33502
|
clearTimer();
|
|
33208
33503
|
setOpen((wasOpen) => {
|
|
33209
33504
|
if (wasOpen) onDismissRef.current?.();
|
|
33210
33505
|
return false;
|
|
33211
33506
|
});
|
|
33212
33507
|
}, [clearTimer]);
|
|
33213
|
-
const show = (0,
|
|
33508
|
+
const show = (0, import_react160.useCallback)(() => {
|
|
33214
33509
|
clearTimer();
|
|
33215
33510
|
setOpen(true);
|
|
33216
33511
|
if (typeof autoDismissAfter === "number" && Number.isFinite(autoDismissAfter) && autoDismissAfter > 0) {
|
|
@@ -33221,11 +33516,11 @@ function useBanner(options = {}) {
|
|
|
33221
33516
|
}, autoDismissAfter);
|
|
33222
33517
|
}
|
|
33223
33518
|
}, [autoDismissAfter, clearTimer]);
|
|
33224
|
-
const toggle = (0,
|
|
33519
|
+
const toggle = (0, import_react160.useCallback)(() => {
|
|
33225
33520
|
if (open) hide();
|
|
33226
33521
|
else show();
|
|
33227
33522
|
}, [open, show, hide]);
|
|
33228
|
-
(0,
|
|
33523
|
+
(0, import_react160.useEffect)(() => () => clearTimer(), [clearTimer]);
|
|
33229
33524
|
return {
|
|
33230
33525
|
open,
|
|
33231
33526
|
show,
|
|
@@ -33236,7 +33531,7 @@ function useBanner(options = {}) {
|
|
|
33236
33531
|
}
|
|
33237
33532
|
|
|
33238
33533
|
// src/hooks/useCallout.ts
|
|
33239
|
-
var
|
|
33534
|
+
var import_react161 = require("react");
|
|
33240
33535
|
var STORAGE_PREFIX = "ods:callout:dismissed:";
|
|
33241
33536
|
function readPersisted(key) {
|
|
33242
33537
|
if (!key || typeof window === "undefined") return false;
|
|
@@ -33259,13 +33554,13 @@ function writePersisted(key, value) {
|
|
|
33259
33554
|
}
|
|
33260
33555
|
function useCallout(options = {}) {
|
|
33261
33556
|
const { defaultOpen = true, persistKey, onDismiss } = options;
|
|
33262
|
-
const [open, setOpen] = (0,
|
|
33263
|
-
(0,
|
|
33557
|
+
const [open, setOpen] = (0, import_react161.useState)(defaultOpen);
|
|
33558
|
+
(0, import_react161.useEffect)(() => {
|
|
33264
33559
|
if (persistKey && readPersisted(persistKey)) {
|
|
33265
33560
|
setOpen(false);
|
|
33266
33561
|
}
|
|
33267
33562
|
}, []);
|
|
33268
|
-
const dismiss = (0,
|
|
33563
|
+
const dismiss = (0, import_react161.useCallback)(() => {
|
|
33269
33564
|
setOpen((wasOpen) => {
|
|
33270
33565
|
if (wasOpen) {
|
|
33271
33566
|
writePersisted(persistKey, true);
|
|
@@ -33274,10 +33569,10 @@ function useCallout(options = {}) {
|
|
|
33274
33569
|
return false;
|
|
33275
33570
|
});
|
|
33276
33571
|
}, [persistKey, onDismiss]);
|
|
33277
|
-
const show = (0,
|
|
33572
|
+
const show = (0, import_react161.useCallback)(() => {
|
|
33278
33573
|
setOpen(true);
|
|
33279
33574
|
}, []);
|
|
33280
|
-
const toggle = (0,
|
|
33575
|
+
const toggle = (0, import_react161.useCallback)(() => {
|
|
33281
33576
|
setOpen((prev) => {
|
|
33282
33577
|
const next = !prev;
|
|
33283
33578
|
if (!next) {
|
|
@@ -33287,7 +33582,7 @@ function useCallout(options = {}) {
|
|
|
33287
33582
|
return next;
|
|
33288
33583
|
});
|
|
33289
33584
|
}, [persistKey, onDismiss]);
|
|
33290
|
-
const reset = (0,
|
|
33585
|
+
const reset = (0, import_react161.useCallback)(() => {
|
|
33291
33586
|
writePersisted(persistKey, false);
|
|
33292
33587
|
setOpen(true);
|
|
33293
33588
|
}, [persistKey]);
|
|
@@ -33303,9 +33598,9 @@ function useCallout(options = {}) {
|
|
|
33303
33598
|
}
|
|
33304
33599
|
|
|
33305
33600
|
// src/hooks/useMediaQuery.ts
|
|
33306
|
-
var
|
|
33601
|
+
var import_react162 = require("react");
|
|
33307
33602
|
function useMediaQuery(query) {
|
|
33308
|
-
return (0,
|
|
33603
|
+
return (0, import_react162.useSyncExternalStore)(
|
|
33309
33604
|
(notify) => subscribe(query, notify),
|
|
33310
33605
|
() => getSnapshot(query),
|
|
33311
33606
|
() => false
|
|
@@ -33360,7 +33655,7 @@ function breakpointMinWidth(name) {
|
|
|
33360
33655
|
}
|
|
33361
33656
|
|
|
33362
33657
|
// src/hooks/useRating.ts
|
|
33363
|
-
var
|
|
33658
|
+
var import_react163 = require("react");
|
|
33364
33659
|
function useRating({
|
|
33365
33660
|
value: controlled,
|
|
33366
33661
|
defaultValue = 0,
|
|
@@ -33368,14 +33663,14 @@ function useRating({
|
|
|
33368
33663
|
step = 1,
|
|
33369
33664
|
onChange
|
|
33370
33665
|
} = {}) {
|
|
33371
|
-
const [internal, setInternal] = (0,
|
|
33666
|
+
const [internal, setInternal] = (0, import_react163.useState)(defaultValue);
|
|
33372
33667
|
const value = controlled ?? internal;
|
|
33373
33668
|
const isControlled = controlled !== void 0;
|
|
33374
|
-
const clamp = (0,
|
|
33669
|
+
const clamp = (0, import_react163.useCallback)(
|
|
33375
33670
|
(v) => Math.max(0, Math.min(max, v)),
|
|
33376
33671
|
[max]
|
|
33377
33672
|
);
|
|
33378
|
-
const set = (0,
|
|
33673
|
+
const set = (0, import_react163.useCallback)(
|
|
33379
33674
|
(next) => {
|
|
33380
33675
|
const clamped = clamp(next);
|
|
33381
33676
|
if (!isControlled) setInternal(clamped);
|
|
@@ -33397,10 +33692,10 @@ function useBinaryRating({
|
|
|
33397
33692
|
defaultValue = null,
|
|
33398
33693
|
onChange
|
|
33399
33694
|
} = {}) {
|
|
33400
|
-
const [internal, setInternal] = (0,
|
|
33695
|
+
const [internal, setInternal] = (0, import_react163.useState)(defaultValue);
|
|
33401
33696
|
const value = controlled ?? internal;
|
|
33402
33697
|
const isControlled = controlled !== void 0;
|
|
33403
|
-
const set = (0,
|
|
33698
|
+
const set = (0, import_react163.useCallback)(
|
|
33404
33699
|
(next) => {
|
|
33405
33700
|
if (!isControlled) setInternal(next);
|
|
33406
33701
|
onChange?.(next);
|
|
@@ -33419,30 +33714,30 @@ function useBinaryRating({
|
|
|
33419
33714
|
}
|
|
33420
33715
|
|
|
33421
33716
|
// src/hooks/useTimeline.ts
|
|
33422
|
-
var
|
|
33717
|
+
var import_react164 = require("react");
|
|
33423
33718
|
function useTimeline({
|
|
33424
33719
|
items: controlled,
|
|
33425
33720
|
defaultItems = [],
|
|
33426
33721
|
onChange
|
|
33427
33722
|
} = {}) {
|
|
33428
|
-
const [internal, setInternal] = (0,
|
|
33723
|
+
const [internal, setInternal] = (0, import_react164.useState)(defaultItems);
|
|
33429
33724
|
const items = controlled ?? internal;
|
|
33430
33725
|
const isControlled = controlled !== void 0;
|
|
33431
|
-
const commit = (0,
|
|
33726
|
+
const commit = (0, import_react164.useCallback)(
|
|
33432
33727
|
(next) => {
|
|
33433
33728
|
if (!isControlled) setInternal(next);
|
|
33434
33729
|
onChange?.(next);
|
|
33435
33730
|
},
|
|
33436
33731
|
[isControlled, onChange]
|
|
33437
33732
|
);
|
|
33438
|
-
const add = (0,
|
|
33733
|
+
const add = (0, import_react164.useCallback)(
|
|
33439
33734
|
(item) => {
|
|
33440
33735
|
if (items.some((i) => i.id === item.id)) return;
|
|
33441
33736
|
commit([...items, item]);
|
|
33442
33737
|
},
|
|
33443
33738
|
[items, commit]
|
|
33444
33739
|
);
|
|
33445
|
-
const insert = (0,
|
|
33740
|
+
const insert = (0, import_react164.useCallback)(
|
|
33446
33741
|
(index, item) => {
|
|
33447
33742
|
if (items.some((i) => i.id === item.id)) return;
|
|
33448
33743
|
const at = Math.max(0, Math.min(items.length, index));
|
|
@@ -33452,7 +33747,7 @@ function useTimeline({
|
|
|
33452
33747
|
},
|
|
33453
33748
|
[items, commit]
|
|
33454
33749
|
);
|
|
33455
|
-
const remove = (0,
|
|
33750
|
+
const remove = (0, import_react164.useCallback)(
|
|
33456
33751
|
(id) => {
|
|
33457
33752
|
const next = items.filter((i) => i.id !== id);
|
|
33458
33753
|
if (next.length === items.length) return;
|
|
@@ -33460,7 +33755,7 @@ function useTimeline({
|
|
|
33460
33755
|
},
|
|
33461
33756
|
[items, commit]
|
|
33462
33757
|
);
|
|
33463
|
-
const update = (0,
|
|
33758
|
+
const update = (0, import_react164.useCallback)(
|
|
33464
33759
|
(id, patch) => {
|
|
33465
33760
|
let changed = false;
|
|
33466
33761
|
const next = items.map((i) => {
|
|
@@ -33485,7 +33780,7 @@ function useTimeline({
|
|
|
33485
33780
|
}
|
|
33486
33781
|
|
|
33487
33782
|
// src/hooks/useTraceTimeline.ts
|
|
33488
|
-
var
|
|
33783
|
+
var import_react165 = require("react");
|
|
33489
33784
|
var GLOBAL_SEQ = 0;
|
|
33490
33785
|
var generateId = () => `ods-trace-${Date.now().toString(36)}-${(GLOBAL_SEQ++).toString(36)}`;
|
|
33491
33786
|
function useTraceTimeline({
|
|
@@ -33493,12 +33788,12 @@ function useTraceTimeline({
|
|
|
33493
33788
|
defaultSteps = [],
|
|
33494
33789
|
onChange
|
|
33495
33790
|
} = {}) {
|
|
33496
|
-
const [internal, setInternal] = (0,
|
|
33791
|
+
const [internal, setInternal] = (0, import_react165.useState)(defaultSteps);
|
|
33497
33792
|
const steps = controlled ?? internal;
|
|
33498
33793
|
const isControlled = controlled !== void 0;
|
|
33499
|
-
const stepsRef = (0,
|
|
33794
|
+
const stepsRef = (0, import_react165.useRef)(steps);
|
|
33500
33795
|
stepsRef.current = steps;
|
|
33501
|
-
const commit = (0,
|
|
33796
|
+
const commit = (0, import_react165.useCallback)(
|
|
33502
33797
|
(next) => {
|
|
33503
33798
|
stepsRef.current = next;
|
|
33504
33799
|
if (!isControlled) setInternal(next);
|
|
@@ -33506,7 +33801,7 @@ function useTraceTimeline({
|
|
|
33506
33801
|
},
|
|
33507
33802
|
[isControlled, onChange]
|
|
33508
33803
|
);
|
|
33509
|
-
const start = (0,
|
|
33804
|
+
const start = (0, import_react165.useCallback)(
|
|
33510
33805
|
(input) => {
|
|
33511
33806
|
const id = input.id ?? generateId();
|
|
33512
33807
|
const record = {
|
|
@@ -33526,7 +33821,7 @@ function useTraceTimeline({
|
|
|
33526
33821
|
},
|
|
33527
33822
|
[commit]
|
|
33528
33823
|
);
|
|
33529
|
-
const update = (0,
|
|
33824
|
+
const update = (0, import_react165.useCallback)(
|
|
33530
33825
|
(id, patch) => {
|
|
33531
33826
|
let changed = false;
|
|
33532
33827
|
const next = stepsRef.current.map((s) => {
|
|
@@ -33538,19 +33833,19 @@ function useTraceTimeline({
|
|
|
33538
33833
|
},
|
|
33539
33834
|
[commit]
|
|
33540
33835
|
);
|
|
33541
|
-
const complete = (0,
|
|
33836
|
+
const complete = (0, import_react165.useCallback)(
|
|
33542
33837
|
(id, patch = {}) => {
|
|
33543
33838
|
update(id, { ...patch, status: "success" });
|
|
33544
33839
|
},
|
|
33545
33840
|
[update]
|
|
33546
33841
|
);
|
|
33547
|
-
const fail = (0,
|
|
33842
|
+
const fail = (0, import_react165.useCallback)(
|
|
33548
33843
|
(id, patch = {}) => {
|
|
33549
33844
|
update(id, { ...patch, status: "failed" });
|
|
33550
33845
|
},
|
|
33551
33846
|
[update]
|
|
33552
33847
|
);
|
|
33553
|
-
const remove = (0,
|
|
33848
|
+
const remove = (0, import_react165.useCallback)(
|
|
33554
33849
|
(id) => {
|
|
33555
33850
|
const next = stepsRef.current.filter((s) => s.id !== id);
|
|
33556
33851
|
if (next.length === stepsRef.current.length) return;
|
|
@@ -33576,13 +33871,13 @@ function useTraceTimeline({
|
|
|
33576
33871
|
|
|
33577
33872
|
// src/provider/OdsProvider.tsx
|
|
33578
33873
|
var import_config = require("@octaviaflow/config");
|
|
33579
|
-
var
|
|
33874
|
+
var import_react166 = require("react");
|
|
33580
33875
|
var import_react_aria15 = require("react-aria");
|
|
33581
|
-
var
|
|
33582
|
-
var OdsContext = (0,
|
|
33876
|
+
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
33877
|
+
var OdsContext = (0, import_react166.createContext)(null);
|
|
33583
33878
|
function OdsProvider({ config: userConfig, children }) {
|
|
33584
|
-
const resolved = (0,
|
|
33585
|
-
(0,
|
|
33879
|
+
const resolved = (0, import_react166.useMemo)(() => (0, import_config.resolveConfig)(userConfig), [userConfig]);
|
|
33880
|
+
(0, import_react166.useEffect)(() => {
|
|
33586
33881
|
const cssVarsBlock = (0, import_config.generateCssVars)(resolved);
|
|
33587
33882
|
const match = cssVarsBlock.match(/:root\s*\{([\s\S]*)\}/);
|
|
33588
33883
|
if (match) {
|
|
@@ -33598,11 +33893,11 @@ function OdsProvider({ config: userConfig, children }) {
|
|
|
33598
33893
|
}
|
|
33599
33894
|
}
|
|
33600
33895
|
}, [resolved]);
|
|
33601
|
-
const contextValue = (0,
|
|
33602
|
-
return /* @__PURE__ */ (0,
|
|
33896
|
+
const contextValue = (0, import_react166.useMemo)(() => ({ config: resolved }), [resolved]);
|
|
33897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(OdsContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_react_aria15.OverlayProvider, { children }) });
|
|
33603
33898
|
}
|
|
33604
33899
|
function useOds() {
|
|
33605
|
-
const ctx = (0,
|
|
33900
|
+
const ctx = (0, import_react166.useContext)(OdsContext);
|
|
33606
33901
|
if (!ctx) {
|
|
33607
33902
|
throw new Error("useOds must be used within an OdsProvider");
|
|
33608
33903
|
}
|
|
@@ -33618,7 +33913,7 @@ var emptyMotion = {
|
|
|
33618
33913
|
};
|
|
33619
33914
|
function useOdsMotion() {
|
|
33620
33915
|
const config = useOds();
|
|
33621
|
-
return (0,
|
|
33916
|
+
return (0, import_react166.useMemo)(() => {
|
|
33622
33917
|
if (!config.motion.enabled) {
|
|
33623
33918
|
return emptyMotion;
|
|
33624
33919
|
}
|