@workflow/web 5.3.2 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/assets/app-Czi_mceE.css +1 -0
- package/build/client/assets/arrow-up-right-74VYxbbA.js +9 -0
- package/build/client/assets/{entry.client-xzxVCL3o.js → entry.client-BqbaswKw.js} +13 -35
- package/build/client/assets/{highlighted-body-JLMTFACH-1yzOVKg0.js → highlighted-body-JLMTFACH-D51eQJbG.js} +2 -2
- package/build/client/assets/{home--wf0CrF6.js → home-DLo3pUJ2.js} +104 -167
- package/build/client/assets/{index-wl5l5E8H.js → index-BUQuaV5X.js} +78 -149
- package/build/client/assets/{manifest-7b81d8d4.js → manifest-67b853ed.js} +1 -1
- package/build/client/assets/mermaid-WFAXDIZX-Bd_l_owX.css +1 -0
- package/build/client/assets/{mermaid-WFAXDIZX-CB__BxYb.js → mermaid-WFAXDIZX-CCgeQ0jh.js} +2044 -2169
- package/build/client/assets/{root-C1XwTNUK.js → root-D8difEo9.js} +8 -33
- package/build/client/assets/root-d42YLYYg.css +1 -0
- package/build/client/assets/{rpc-client-SbyXJdFV.js → rpc-client-DL_nSX36.js} +3 -4
- package/build/client/assets/{run-detail-2CnpdXm1.js → run-detail-DcpR_rST.js} +234 -445
- package/build/client/assets/run-detail-DmVxTs86.css +1 -0
- package/build/client/assets/{run-usage-C3aywyqa.js → run-usage-0JrO5fG2.js} +5 -5
- package/build/client/assets/{run-usage-DRV6lopZ.js → run-usage-CK_ia-7k.js} +36 -53
- package/build/client/assets/{skeleton-DMLgjvZZ.js → skeleton-B2Cf2UXN.js} +3 -21
- package/build/client/assets/{url-state-JAVaNZ_m.js → url-state-n9DuWtVx.js} +521 -779
- package/build/client/assets/{zstd-browser-decoder-Z5736ep5.js → zstd-browser-decoder-CqZHDp17.js} +2 -2
- package/build/server/assets/{app-C4Vf0mu1.js → app-DLSid73Q.js} +13263 -14020
- package/build/server/assets/{esm-CETb4fkq.js → esm-BzrGWk7J.js} +2 -2
- package/build/server/assets/{highlighted-body-JLMTFACH-CF_5tt3-.js → highlighted-body-JLMTFACH-CtQ_zvjG.js} +1 -1
- package/build/server/assets/{index-BrYeW--s.js → index-BI8sdTIq.js} +398 -490
- package/build/server/assets/{mermaid-WFAXDIZX-BHZz_uL6.js → mermaid-WFAXDIZX-BlWV_MqD.js} +1 -1
- package/build/server/assets/{token-k0na1G9v.js → token-BE7-D9Dt.js} +6 -6
- package/build/server/assets/{token-B94O3LuJ.js → token-DOXFZxpM.js} +5 -5
- package/build/server/assets/{token-util-DFlzY9Hw.js → token-util-DjnKfD7P.js} +2 -2
- package/build/server/assets/{token-util-DgTmPzWb.js → token-util-V29s95lj.js} +1 -1
- package/build/server/assets/{wrapper-BEqyNEir.js → wrapper-DBwRVVUb.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-LnaKiDUZ.js → zstd-browser-decoder-Crq3t_fM.js} +1 -1
- package/build/server/index.js +1 -1
- package/package.json +8 -8
- package/build/client/assets/app-BHCSMHev.css +0 -1
- package/build/client/assets/arrow-up-right-DyaB_ak4.js +0 -15
- package/build/client/assets/mermaid-WFAXDIZX-D8CjRQta.css +0 -1
- package/build/client/assets/root-C3ED6Dwc.css +0 -1
- package/build/client/assets/run-detail-CWoGxu_0.css +0 -1
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
1
|
var __typeError = (msg) => {
|
|
3
2
|
throw TypeError(msg);
|
|
4
3
|
};
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
5
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
6
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
7
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
8
|
var _keys, _a;
|
|
12
|
-
import { c as createLucideIcon,
|
|
13
|
-
import { r as reactExports, j as jsxRuntimeExports, H as React2, a as requireReact, R as ReactExports, I as getDefaultExportFromCjs, g as reactDomExports, C as useSearchParams, B as useNavigate } from "./index-
|
|
14
|
-
import { b as CircleAlert, C as Circle, R as RotateCw } from "./skeleton-
|
|
15
|
-
import { m as fetchRuns, n as bulkCancelRuns$1, o as reenqueueRun$1, w as wakeUpRun$1, p as resumeHook$1, q as fetchHookToken$1, s as cancelRun$1, t as recreateRun$1 } from "./rpc-client-
|
|
16
|
-
/**
|
|
17
|
-
* @license lucide-react v0.575.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/
|
|
9
|
+
import { c as createLucideIcon, N as ChevronDown, a as cn, a6 as isRunCreationEvent, b4 as startHookId, a3 as isHookLifecycleEventType, X as cva, s as useComposedRefs, A as createContextScope, M as createSlot, v as useLayoutEffect2, x as useId, P as Primitive, E as composeEventHandlers, w as useControllableState, L as useCallbackRef$1, z as createPopperScope, y as Popper, D as PopperAnchor, G as Presence, F as Portal, b5 as dispatchDiscreteCustomEvent, b6 as useFocusScopeBranch, b7 as useFocusScopeBranchRegistry, b8 as FocusScopeBranchProvider, H as FocusScope, J as DismissableLayer, K as PopperContent, C as ChevronRight, p as Check, b9 as VERCEL_403_ERROR_MESSAGE, T as Tooltip, e as TooltipTrigger, a7 as CopyButton, f as TooltipContent, U as STATUS_DOT, ba as formatDuration, B as Button, t as toast, bb as useDismissableLayerSurface } from "./mermaid-WFAXDIZX-CCgeQ0jh.js";
|
|
10
|
+
import { r as reactExports, j as jsxRuntimeExports, H as React2, a as requireReact, R as ReactExports, I as getDefaultExportFromCjs, g as reactDomExports, C as useSearchParams, B as useNavigate } from "./index-BUQuaV5X.js";
|
|
11
|
+
import { b as CircleAlert, C as Circle, R as RotateCw } from "./skeleton-B2Cf2UXN.js";
|
|
12
|
+
import { m as fetchRuns, n as bulkCancelRuns$1, o as reenqueueRun$1, w as wakeUpRun$1, p as resumeHook$1, q as fetchHookToken$1, s as cancelRun$1, t as recreateRun$1 } from "./rpc-client-DL_nSX36.js";
|
|
22
13
|
const __iconNode$d = [
|
|
23
14
|
["path", { d: "M6.87 6.87a8 8 0 1 0 11.26 11.26", key: "3on8tj" }],
|
|
24
15
|
["path", { d: "M19.9 14.25a8 8 0 0 0-9.15-9.15", key: "15ghsc" }],
|
|
@@ -28,12 +19,6 @@ const __iconNode$d = [
|
|
|
28
19
|
["path", { d: "M4 4 2 6", key: "1ycko6" }]
|
|
29
20
|
];
|
|
30
21
|
const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$d);
|
|
31
|
-
/**
|
|
32
|
-
* @license lucide-react v0.575.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/
|
|
37
22
|
const __iconNode$c = [
|
|
38
23
|
["path", { d: "M12 8V4H8", key: "hb8ula" }],
|
|
39
24
|
["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
|
|
@@ -43,20 +28,8 @@ const __iconNode$c = [
|
|
|
43
28
|
["path", { d: "M9 13v2", key: "rq6x2g" }]
|
|
44
29
|
];
|
|
45
30
|
const Bot = createLucideIcon("bot", __iconNode$c);
|
|
46
|
-
/**
|
|
47
|
-
* @license lucide-react v0.575.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/
|
|
52
31
|
const __iconNode$b = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
53
32
|
const ChevronUp = createLucideIcon("chevron-up", __iconNode$b);
|
|
54
|
-
/**
|
|
55
|
-
* @license lucide-react v0.575.0 - ISC
|
|
56
|
-
*
|
|
57
|
-
* This source code is licensed under the ISC license.
|
|
58
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/
|
|
60
33
|
const __iconNode$a = [
|
|
61
34
|
[
|
|
62
35
|
"path",
|
|
@@ -68,46 +41,22 @@ const __iconNode$a = [
|
|
|
68
41
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
69
42
|
];
|
|
70
43
|
const CirclePlay = createLucideIcon("circle-play", __iconNode$a);
|
|
71
|
-
/**
|
|
72
|
-
* @license lucide-react v0.575.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/
|
|
77
44
|
const __iconNode$9 = [
|
|
78
45
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
79
46
|
["rect", { x: "9", y: "9", width: "6", height: "6", rx: "1", key: "1ssd4o" }]
|
|
80
47
|
];
|
|
81
48
|
const CircleStop = createLucideIcon("circle-stop", __iconNode$9);
|
|
82
|
-
/**
|
|
83
|
-
* @license lucide-react v0.575.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/
|
|
88
49
|
const __iconNode$8 = [
|
|
89
50
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
90
51
|
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
91
52
|
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
92
53
|
];
|
|
93
54
|
const CircleX = createLucideIcon("circle-x", __iconNode$8);
|
|
94
|
-
/**
|
|
95
|
-
* @license lucide-react v0.575.0 - ISC
|
|
96
|
-
*
|
|
97
|
-
* This source code is licensed under the ISC license.
|
|
98
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
-
*/
|
|
100
55
|
const __iconNode$7 = [
|
|
101
56
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
102
57
|
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
|
|
103
58
|
];
|
|
104
59
|
const Clock = createLucideIcon("clock", __iconNode$7);
|
|
105
|
-
/**
|
|
106
|
-
* @license lucide-react v0.575.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/
|
|
111
60
|
const __iconNode$6 = [
|
|
112
61
|
[
|
|
113
62
|
"path",
|
|
@@ -118,36 +67,18 @@ const __iconNode$6 = [
|
|
|
118
67
|
]
|
|
119
68
|
];
|
|
120
69
|
const Diamond = createLucideIcon("diamond", __iconNode$6);
|
|
121
|
-
/**
|
|
122
|
-
* @license lucide-react v0.575.0 - ISC
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the ISC license.
|
|
125
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/
|
|
127
70
|
const __iconNode$5 = [
|
|
128
71
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
129
72
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
130
73
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
131
74
|
];
|
|
132
75
|
const Ellipsis = createLucideIcon("ellipsis", __iconNode$5);
|
|
133
|
-
/**
|
|
134
|
-
* @license lucide-react v0.575.0 - ISC
|
|
135
|
-
*
|
|
136
|
-
* This source code is licensed under the ISC license.
|
|
137
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/
|
|
139
76
|
const __iconNode$4 = [
|
|
140
77
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
141
78
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
142
79
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
143
80
|
];
|
|
144
81
|
const Link2 = createLucideIcon("link-2", __iconNode$4);
|
|
145
|
-
/**
|
|
146
|
-
* @license lucide-react v0.575.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/
|
|
151
82
|
const __iconNode$3 = [
|
|
152
83
|
[
|
|
153
84
|
"path",
|
|
@@ -159,12 +90,6 @@ const __iconNode$3 = [
|
|
|
159
90
|
["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
|
|
160
91
|
];
|
|
161
92
|
const Send = createLucideIcon("send", __iconNode$3);
|
|
162
|
-
/**
|
|
163
|
-
* @license lucide-react v0.575.0 - ISC
|
|
164
|
-
*
|
|
165
|
-
* This source code is licensed under the ISC license.
|
|
166
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/
|
|
168
93
|
const __iconNode$2 = [
|
|
169
94
|
[
|
|
170
95
|
"path",
|
|
@@ -175,23 +100,11 @@ const __iconNode$2 = [
|
|
|
175
100
|
]
|
|
176
101
|
];
|
|
177
102
|
const Wrench = createLucideIcon("wrench", __iconNode$2);
|
|
178
|
-
/**
|
|
179
|
-
* @license lucide-react v0.575.0 - ISC
|
|
180
|
-
*
|
|
181
|
-
* This source code is licensed under the ISC license.
|
|
182
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/
|
|
184
103
|
const __iconNode$1 = [
|
|
185
104
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
186
105
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
187
106
|
];
|
|
188
107
|
const X = createLucideIcon("x", __iconNode$1);
|
|
189
|
-
/**
|
|
190
|
-
* @license lucide-react v0.575.0 - ISC
|
|
191
|
-
*
|
|
192
|
-
* This source code is licensed under the ISC license.
|
|
193
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
-
*/
|
|
195
108
|
const __iconNode = [
|
|
196
109
|
[
|
|
197
110
|
"path",
|
|
@@ -221,8 +134,7 @@ class ErrorBoundary extends reactExports.Component {
|
|
|
221
134
|
this.setState({ hasError: false, error: null });
|
|
222
135
|
}
|
|
223
136
|
componentDidCatch(error, errorInfo) {
|
|
224
|
-
|
|
225
|
-
(_b = (_a2 = this.props).onCatch) == null ? void 0 : _b.call(_a2, error, () => this.retry());
|
|
137
|
+
this.props.onCatch?.(error, () => this.retry());
|
|
226
138
|
}
|
|
227
139
|
render() {
|
|
228
140
|
if (this.state.hasError) {
|
|
@@ -230,16 +142,16 @@ class ErrorBoundary extends reactExports.Component {
|
|
|
230
142
|
return this.props.fallback;
|
|
231
143
|
}
|
|
232
144
|
const err = this.state.error instanceof Error ? this.state.error : null;
|
|
233
|
-
const errorDetails =
|
|
145
|
+
const errorDetails = err?.stack ? `${err.message}
|
|
234
146
|
|
|
235
|
-
${err.stack}` :
|
|
236
|
-
return jsxRuntimeExports.jsx(ErrorCard, { title: this.props.title || "
|
|
147
|
+
${err.stack}` : err?.message ?? "Unknown error";
|
|
148
|
+
return jsxRuntimeExports.jsx(ErrorCard, { title: this.props.title || "Failed to load this section", details: errorDetails });
|
|
237
149
|
}
|
|
238
150
|
return this.props.children;
|
|
239
151
|
}
|
|
240
152
|
}
|
|
241
153
|
function eventTimestamp(event) {
|
|
242
|
-
const value =
|
|
154
|
+
const value = event?.occurredAt ?? event?.createdAt;
|
|
243
155
|
if (!value)
|
|
244
156
|
return void 0;
|
|
245
157
|
const date2 = value instanceof Date ? value : new Date(value);
|
|
@@ -252,27 +164,25 @@ function tokenOf(startHook) {
|
|
|
252
164
|
return typeof token === "string" && token.length > 0 ? token : void 0;
|
|
253
165
|
}
|
|
254
166
|
function findStartHookCreation(events, run) {
|
|
255
|
-
var _a2, _b;
|
|
256
167
|
const creationEvent = events.find(isRunCreationEvent);
|
|
257
|
-
const runId =
|
|
258
|
-
if (!
|
|
168
|
+
const runId = run?.runId ?? creationEvent?.runId ?? events[0]?.runId;
|
|
169
|
+
if (!runId?.startsWith("wrun_") || runId.length <= "wrun_".length) {
|
|
259
170
|
return void 0;
|
|
260
171
|
}
|
|
261
172
|
const hookId = startHookId(runId);
|
|
262
|
-
const token = tokenOf(creationEvent && "eventData" in creationEvent ?
|
|
173
|
+
const token = tokenOf(creationEvent && "eventData" in creationEvent ? creationEvent.eventData?.startHook : void 0) ?? tokenOf(run?.startHook);
|
|
263
174
|
const hookEvents = events.filter((event) => event.correlationId === hookId && isHookLifecycleEventType(event.eventType));
|
|
264
175
|
if (token === void 0 && hookEvents.length === 0)
|
|
265
176
|
return void 0;
|
|
266
177
|
if (hookEvents.some((event) => event.eventType === "hook_created")) {
|
|
267
178
|
return void 0;
|
|
268
179
|
}
|
|
269
|
-
const createdAt = eventTimestamp(creationEvent) ?? (
|
|
180
|
+
const createdAt = eventTimestamp(creationEvent) ?? (run?.createdAt ? new Date(run.createdAt) : void 0) ?? eventTimestamp(hookEvents[0]);
|
|
270
181
|
if (!createdAt)
|
|
271
182
|
return void 0;
|
|
272
183
|
return { hookId, runId, token, createdAt };
|
|
273
184
|
}
|
|
274
185
|
function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
275
|
-
var _a2;
|
|
276
186
|
const [jsonInput, setJsonInput] = reactExports.useState("");
|
|
277
187
|
const [parseError, setParseError] = reactExports.useState(null);
|
|
278
188
|
const textareaRef = reactExports.useRef(null);
|
|
@@ -315,7 +225,7 @@ function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
|
315
225
|
e.preventDefault();
|
|
316
226
|
void submitPayload();
|
|
317
227
|
}, [submitPayload]);
|
|
318
|
-
const isMacPlatform = typeof navigator !== "undefined" && (
|
|
228
|
+
const isMacPlatform = typeof navigator !== "undefined" && (navigator.userAgentData?.platform ?? navigator.userAgent).toLowerCase().includes("mac");
|
|
319
229
|
const handleKeyDown = reactExports.useCallback((e) => {
|
|
320
230
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter" && !isSubmitting) {
|
|
321
231
|
e.preventDefault();
|
|
@@ -328,7 +238,7 @@ function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
|
328
238
|
return jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", role: "dialog", "aria-modal": "true", "aria-labelledby": "resolve-hook-modal-title", children: [jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-black/70", onClick: isSubmitting ? void 0 : onClose }), jsxRuntimeExports.jsxs("div", { className: "relative z-10 w-[480px] max-w-[calc(100%_-_32px)] overflow-hidden !border-none bg-background-100 text-gray-1000 material-menu", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [jsxRuntimeExports.jsx("h2", { id: "resolve-hook-modal-title", className: "m-0 font-semibold text-base text-gray-1000", children: "Resolve Hook" }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, "aria-label": "Close modal", className: "flex cursor-pointer items-center justify-center rounded-md !border-none !bg-transparent p-1 text-gray-900 transition-colors hover:!bg-gray-alpha-200 disabled:cursor-not-allowed disabled:opacity-50", children: jsxRuntimeExports.jsx(X, { className: "size-4" }) })] }), jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [jsxRuntimeExports.jsxs("div", { className: "px-6 pb-4", children: [jsxRuntimeExports.jsx("label", { htmlFor: "json-payload", className: "mb-1.5 block font-medium text-gray-1000 text-sm", children: "JSON Payload" }), jsxRuntimeExports.jsxs("p", { className: "mt-0 mb-3 text-[13px] text-gray-900 leading-[1.5]", children: ["Enter a JSON value to send to the hook. Leave empty to send", " ", jsxRuntimeExports.jsx("code", { className: "rounded bg-gray-alpha-200 px-1.5 py-0.5 font-mono text-gray-1000 text-xs", children: "null" }), "."] }), jsxRuntimeExports.jsx("textarea", { ref: textareaRef, id: "json-payload", value: jsonInput, onChange: (e) => {
|
|
329
239
|
setJsonInput(e.target.value);
|
|
330
240
|
setParseError(null);
|
|
331
|
-
}, onKeyDown: handleKeyDown, disabled: isSubmitting, placeholder: '{"key": "value"}', className: cn("box-border h-40 w-full resize-none rounded-lg border bg-background-100 px-3 py-2 font-mono text-[13px] text-gray-1000 leading-[1.5] outline-none disabled:cursor-not-allowed disabled:opacity-50", parseError ? "border-red-700" : "border-gray-alpha-400") }), parseError && jsxRuntimeExports.jsx("p", { className: "mt-2 mb-0 text-[13px] text-red-900", children: parseError }), jsxRuntimeExports.jsxs("p", { className: "mt-2 mb-0 text-gray-800 text-xs", children: ["Press", " ", jsxRuntimeExports.jsxs("kbd", { className: "rounded border border-gray-alpha-400 bg-gray-alpha-200 px-[5px] py-0.5 font-mono text-[11px]", children: [isMacPlatform ? "⌘" : "Ctrl", "+Enter"] }), " ", "to submit"] })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2 border-gray-alpha-400 border-t px-6 py-3", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, className: "cursor-pointer rounded-lg border border-gray-alpha-400 bg-background-100 px-4 py-2 font-medium text-gray-1000 text-sm transition-colors hover:bg-gray-alpha-100 disabled:cursor-not-allowed disabled:opacity-50", children: "Cancel" }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => void submitPayload(), disabled: isSubmitting, className: "flex cursor-pointer items-center gap-1.5 rounded-lg !border-none bg-gray-1000 px-4 py-2 font-medium text-background-100 text-sm transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:opacity-50", children: [jsxRuntimeExports.jsx(Send, { className: "size-3.5" }), isSubmitting ? "Sending
|
|
241
|
+
}, onKeyDown: handleKeyDown, disabled: isSubmitting, placeholder: '{"key": "value"}', className: cn("box-border h-40 w-full resize-none rounded-lg border bg-background-100 px-3 py-2 font-mono text-[13px] text-gray-1000 leading-[1.5] outline-none disabled:cursor-not-allowed disabled:opacity-50", parseError ? "border-red-700" : "border-gray-alpha-400") }), parseError && jsxRuntimeExports.jsx("p", { className: "mt-2 mb-0 text-[13px] text-red-900", children: parseError }), jsxRuntimeExports.jsxs("p", { className: "mt-2 mb-0 text-gray-800 text-xs", children: ["Press", " ", jsxRuntimeExports.jsxs("kbd", { className: "rounded border border-gray-alpha-400 bg-gray-alpha-200 px-[5px] py-0.5 font-mono text-[11px]", children: [isMacPlatform ? "⌘" : "Ctrl", "+Enter"] }), " ", "to submit"] })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2 border-gray-alpha-400 border-t px-6 py-3", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, className: "cursor-pointer rounded-lg border border-gray-alpha-400 bg-background-100 px-4 py-2 font-medium text-gray-1000 text-sm transition-colors hover:bg-gray-alpha-100 disabled:cursor-not-allowed disabled:opacity-50", children: "Cancel" }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => void submitPayload(), disabled: isSubmitting, className: "flex cursor-pointer items-center gap-1.5 rounded-lg !border-none bg-gray-1000 px-4 py-2 font-medium text-background-100 text-sm transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:opacity-50", children: [jsxRuntimeExports.jsx(Send, { className: "size-3.5" }), isSubmitting ? "Sending…" : "Send Payload"] })] })] })] })] });
|
|
332
242
|
}
|
|
333
243
|
const millisecondsInWeek = 6048e5;
|
|
334
244
|
const millisecondsInDay = 864e5;
|
|
@@ -336,7 +246,7 @@ const millisecondsInMinute = 6e4;
|
|
|
336
246
|
const minutesInYear = 525600;
|
|
337
247
|
const minutesInMonth = 43200;
|
|
338
248
|
const minutesInDay = 1440;
|
|
339
|
-
const constructFromSymbol = Symbol.for("constructDateFrom");
|
|
249
|
+
const constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
|
|
340
250
|
function constructFrom(date2, value) {
|
|
341
251
|
if (typeof date2 === "function") return date2(value);
|
|
342
252
|
if (date2 && typeof date2 === "object" && constructFromSymbol in date2)
|
|
@@ -351,22 +261,21 @@ let defaultOptions$1 = {};
|
|
|
351
261
|
function getDefaultOptions() {
|
|
352
262
|
return defaultOptions$1;
|
|
353
263
|
}
|
|
354
|
-
function startOfWeek(date2,
|
|
355
|
-
var _a2, _b, _c, _d;
|
|
264
|
+
function startOfWeek(date2, options2) {
|
|
356
265
|
const defaultOptions2 = getDefaultOptions();
|
|
357
|
-
const weekStartsOn =
|
|
358
|
-
const _date = toDate(date2,
|
|
266
|
+
const weekStartsOn = options2?.weekStartsOn ?? options2?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
267
|
+
const _date = toDate(date2, options2?.in);
|
|
359
268
|
const day = _date.getDay();
|
|
360
269
|
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
361
270
|
_date.setDate(_date.getDate() - diff);
|
|
362
271
|
_date.setHours(0, 0, 0, 0);
|
|
363
272
|
return _date;
|
|
364
273
|
}
|
|
365
|
-
function startOfISOWeek(date2,
|
|
366
|
-
return startOfWeek(date2, { ...
|
|
274
|
+
function startOfISOWeek(date2, options2) {
|
|
275
|
+
return startOfWeek(date2, { ...options2, weekStartsOn: 1 });
|
|
367
276
|
}
|
|
368
|
-
function getISOWeekYear(date2,
|
|
369
|
-
const _date = toDate(date2,
|
|
277
|
+
function getISOWeekYear(date2, options2) {
|
|
278
|
+
const _date = toDate(date2, options2?.in);
|
|
370
279
|
const year = _date.getFullYear();
|
|
371
280
|
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
372
281
|
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
@@ -407,14 +316,14 @@ function normalizeDates(context, ...dates) {
|
|
|
407
316
|
);
|
|
408
317
|
return dates.map(normalize2);
|
|
409
318
|
}
|
|
410
|
-
function startOfDay(date2,
|
|
411
|
-
const _date = toDate(date2,
|
|
319
|
+
function startOfDay(date2, options2) {
|
|
320
|
+
const _date = toDate(date2, options2?.in);
|
|
412
321
|
_date.setHours(0, 0, 0, 0);
|
|
413
322
|
return _date;
|
|
414
323
|
}
|
|
415
|
-
function differenceInCalendarDays(laterDate, earlierDate,
|
|
324
|
+
function differenceInCalendarDays(laterDate, earlierDate, options2) {
|
|
416
325
|
const [laterDate_, earlierDate_] = normalizeDates(
|
|
417
|
-
|
|
326
|
+
options2?.in,
|
|
418
327
|
laterDate,
|
|
419
328
|
earlierDate
|
|
420
329
|
);
|
|
@@ -424,8 +333,8 @@ function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
|
424
333
|
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
425
334
|
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
426
335
|
}
|
|
427
|
-
function startOfISOWeekYear(date2,
|
|
428
|
-
const year = getISOWeekYear(date2,
|
|
336
|
+
function startOfISOWeekYear(date2, options2) {
|
|
337
|
+
const year = getISOWeekYear(date2, options2);
|
|
429
338
|
const fourthOfJanuary = constructFrom(date2, 0);
|
|
430
339
|
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
431
340
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
@@ -453,8 +362,8 @@ function getRoundingMethod(method) {
|
|
|
453
362
|
return result === 0 ? 0 : result;
|
|
454
363
|
};
|
|
455
364
|
}
|
|
456
|
-
function startOfYear(date2,
|
|
457
|
-
const date_ = toDate(date2,
|
|
365
|
+
function startOfYear(date2, options2) {
|
|
366
|
+
const date_ = toDate(date2, options2?.in);
|
|
458
367
|
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
459
368
|
date_.setHours(0, 0, 0, 0);
|
|
460
369
|
return date_;
|
|
@@ -522,7 +431,7 @@ const formatDistanceLocale = {
|
|
|
522
431
|
other: "almost {{count}} years"
|
|
523
432
|
}
|
|
524
433
|
};
|
|
525
|
-
const formatDistance = (token, count2,
|
|
434
|
+
const formatDistance = (token, count2, options2) => {
|
|
526
435
|
let result;
|
|
527
436
|
const tokenValue = formatDistanceLocale[token];
|
|
528
437
|
if (typeof tokenValue === "string") {
|
|
@@ -532,8 +441,8 @@ const formatDistance = (token, count2, options) => {
|
|
|
532
441
|
} else {
|
|
533
442
|
result = tokenValue.other.replace("{{count}}", count2.toString());
|
|
534
443
|
}
|
|
535
|
-
if (
|
|
536
|
-
if (
|
|
444
|
+
if (options2?.addSuffix) {
|
|
445
|
+
if (options2.comparison && options2.comparison > 0) {
|
|
537
446
|
return "in " + result;
|
|
538
447
|
} else {
|
|
539
448
|
return result + " ago";
|
|
@@ -542,8 +451,8 @@ const formatDistance = (token, count2, options) => {
|
|
|
542
451
|
return result;
|
|
543
452
|
};
|
|
544
453
|
function buildFormatLongFn(args) {
|
|
545
|
-
return (
|
|
546
|
-
const width =
|
|
454
|
+
return (options2 = {}) => {
|
|
455
|
+
const width = options2.width ? String(options2.width) : args.defaultWidth;
|
|
547
456
|
const format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
548
457
|
return format2;
|
|
549
458
|
};
|
|
@@ -590,16 +499,16 @@ const formatRelativeLocale = {
|
|
|
590
499
|
};
|
|
591
500
|
const formatRelative$1 = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
592
501
|
function buildLocalizeFn(args) {
|
|
593
|
-
return (value,
|
|
594
|
-
const context =
|
|
502
|
+
return (value, options2) => {
|
|
503
|
+
const context = options2?.context ? String(options2.context) : "standalone";
|
|
595
504
|
let valuesArray;
|
|
596
505
|
if (context === "formatting" && args.formattingValues) {
|
|
597
506
|
const defaultWidth2 = args.defaultFormattingWidth || args.defaultWidth;
|
|
598
|
-
const width =
|
|
507
|
+
const width = options2?.width ? String(options2.width) : defaultWidth2;
|
|
599
508
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth2];
|
|
600
509
|
} else {
|
|
601
510
|
const defaultWidth2 = args.defaultWidth;
|
|
602
|
-
const width =
|
|
511
|
+
const width = options2?.width ? String(options2.width) : args.defaultWidth;
|
|
603
512
|
valuesArray = args.values[width] || args.values[defaultWidth2];
|
|
604
513
|
}
|
|
605
514
|
const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
@@ -767,8 +676,8 @@ const localize = {
|
|
|
767
676
|
})
|
|
768
677
|
};
|
|
769
678
|
function buildMatchFn(args) {
|
|
770
|
-
return (string,
|
|
771
|
-
const width =
|
|
679
|
+
return (string, options2 = {}) => {
|
|
680
|
+
const width = options2.width;
|
|
772
681
|
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
773
682
|
const matchResult = string.match(matchPattern);
|
|
774
683
|
if (!matchResult) {
|
|
@@ -782,9 +691,9 @@ function buildMatchFn(args) {
|
|
|
782
691
|
);
|
|
783
692
|
let value;
|
|
784
693
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
785
|
-
value =
|
|
694
|
+
value = options2.valueCallback ? (
|
|
786
695
|
// [TODO] -- I challenge you to fix the type
|
|
787
|
-
|
|
696
|
+
options2.valueCallback(value)
|
|
788
697
|
) : value;
|
|
789
698
|
const rest = string.slice(matchedString.length);
|
|
790
699
|
return { value, rest };
|
|
@@ -807,14 +716,14 @@ function findIndex(array2, predicate) {
|
|
|
807
716
|
return void 0;
|
|
808
717
|
}
|
|
809
718
|
function buildMatchPatternFn(args) {
|
|
810
|
-
return (string,
|
|
719
|
+
return (string, options2 = {}) => {
|
|
811
720
|
const matchResult = string.match(args.matchPattern);
|
|
812
721
|
if (!matchResult) return null;
|
|
813
722
|
const matchedString = matchResult[0];
|
|
814
723
|
const parseResult = string.match(args.parsePattern);
|
|
815
724
|
if (!parseResult) return null;
|
|
816
725
|
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
817
|
-
value =
|
|
726
|
+
value = options2.valueCallback ? options2.valueCallback(value) : value;
|
|
818
727
|
const rest = string.slice(matchedString.length);
|
|
819
728
|
return { value, rest };
|
|
820
729
|
};
|
|
@@ -948,31 +857,30 @@ const enUS = {
|
|
|
948
857
|
firstWeekContainsDate: 1
|
|
949
858
|
}
|
|
950
859
|
};
|
|
951
|
-
function getDayOfYear(date2,
|
|
952
|
-
const _date = toDate(date2,
|
|
860
|
+
function getDayOfYear(date2, options2) {
|
|
861
|
+
const _date = toDate(date2, options2?.in);
|
|
953
862
|
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
954
863
|
const dayOfYear = diff + 1;
|
|
955
864
|
return dayOfYear;
|
|
956
865
|
}
|
|
957
|
-
function getISOWeek(date2,
|
|
958
|
-
const _date = toDate(date2,
|
|
866
|
+
function getISOWeek(date2, options2) {
|
|
867
|
+
const _date = toDate(date2, options2?.in);
|
|
959
868
|
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
960
869
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
961
870
|
}
|
|
962
|
-
function getWeekYear(date2,
|
|
963
|
-
|
|
964
|
-
const _date = toDate(date2, options == null ? void 0 : options.in);
|
|
871
|
+
function getWeekYear(date2, options2) {
|
|
872
|
+
const _date = toDate(date2, options2?.in);
|
|
965
873
|
const year = _date.getFullYear();
|
|
966
874
|
const defaultOptions2 = getDefaultOptions();
|
|
967
|
-
const firstWeekContainsDate =
|
|
968
|
-
const firstWeekOfNextYear = constructFrom(
|
|
875
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
876
|
+
const firstWeekOfNextYear = constructFrom(options2?.in || date2, 0);
|
|
969
877
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
970
878
|
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
971
|
-
const startOfNextYear = startOfWeek(firstWeekOfNextYear,
|
|
972
|
-
const firstWeekOfThisYear = constructFrom(
|
|
879
|
+
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options2);
|
|
880
|
+
const firstWeekOfThisYear = constructFrom(options2?.in || date2, 0);
|
|
973
881
|
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
974
882
|
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
975
|
-
const startOfThisYear = startOfWeek(firstWeekOfThisYear,
|
|
883
|
+
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options2);
|
|
976
884
|
if (+_date >= +startOfNextYear) {
|
|
977
885
|
return year + 1;
|
|
978
886
|
} else if (+_date >= +startOfThisYear) {
|
|
@@ -981,20 +889,19 @@ function getWeekYear(date2, options) {
|
|
|
981
889
|
return year - 1;
|
|
982
890
|
}
|
|
983
891
|
}
|
|
984
|
-
function startOfWeekYear(date2,
|
|
985
|
-
var _a2, _b, _c, _d;
|
|
892
|
+
function startOfWeekYear(date2, options2) {
|
|
986
893
|
const defaultOptions2 = getDefaultOptions();
|
|
987
|
-
const firstWeekContainsDate =
|
|
988
|
-
const year = getWeekYear(date2,
|
|
989
|
-
const firstWeek = constructFrom(
|
|
894
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
895
|
+
const year = getWeekYear(date2, options2);
|
|
896
|
+
const firstWeek = constructFrom(options2?.in || date2, 0);
|
|
990
897
|
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
991
898
|
firstWeek.setHours(0, 0, 0, 0);
|
|
992
|
-
const _date = startOfWeek(firstWeek,
|
|
899
|
+
const _date = startOfWeek(firstWeek, options2);
|
|
993
900
|
return _date;
|
|
994
901
|
}
|
|
995
|
-
function getWeek(date2,
|
|
996
|
-
const _date = toDate(date2,
|
|
997
|
-
const diff = +startOfWeek(_date,
|
|
902
|
+
function getWeek(date2, options2) {
|
|
903
|
+
const _date = toDate(date2, options2?.in);
|
|
904
|
+
const diff = +startOfWeek(_date, options2) - +startOfWeekYear(_date, options2);
|
|
998
905
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
999
906
|
}
|
|
1000
907
|
function addLeadingZeros(number, targetLength) {
|
|
@@ -1097,8 +1004,8 @@ const formatters = {
|
|
|
1097
1004
|
return lightFormatters.y(date2, token);
|
|
1098
1005
|
},
|
|
1099
1006
|
// Local week-numbering year
|
|
1100
|
-
Y: function(date2, token, localize2,
|
|
1101
|
-
const signedWeekYear = getWeekYear(date2,
|
|
1007
|
+
Y: function(date2, token, localize2, options2) {
|
|
1008
|
+
const signedWeekYear = getWeekYear(date2, options2);
|
|
1102
1009
|
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
1103
1010
|
if (token === "YY") {
|
|
1104
1011
|
const twoDigitYear = weekYear % 100;
|
|
@@ -1255,8 +1162,8 @@ const formatters = {
|
|
|
1255
1162
|
}
|
|
1256
1163
|
},
|
|
1257
1164
|
// Local week of year
|
|
1258
|
-
w: function(date2, token, localize2,
|
|
1259
|
-
const week = getWeek(date2,
|
|
1165
|
+
w: function(date2, token, localize2, options2) {
|
|
1166
|
+
const week = getWeek(date2, options2);
|
|
1260
1167
|
if (token === "wo") {
|
|
1261
1168
|
return localize2.ordinalNumber(week, { unit: "week" });
|
|
1262
1169
|
}
|
|
@@ -1319,9 +1226,9 @@ const formatters = {
|
|
|
1319
1226
|
}
|
|
1320
1227
|
},
|
|
1321
1228
|
// Local day of week
|
|
1322
|
-
e: function(date2, token, localize2,
|
|
1229
|
+
e: function(date2, token, localize2, options2) {
|
|
1323
1230
|
const dayOfWeek = date2.getDay();
|
|
1324
|
-
const localDayOfWeek = (dayOfWeek -
|
|
1231
|
+
const localDayOfWeek = (dayOfWeek - options2.weekStartsOn + 8) % 7 || 7;
|
|
1325
1232
|
switch (token) {
|
|
1326
1233
|
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
1327
1234
|
case "e":
|
|
@@ -1359,9 +1266,9 @@ const formatters = {
|
|
|
1359
1266
|
}
|
|
1360
1267
|
},
|
|
1361
1268
|
// Stand-alone local day of week
|
|
1362
|
-
c: function(date2, token, localize2,
|
|
1269
|
+
c: function(date2, token, localize2, options2) {
|
|
1363
1270
|
const dayOfWeek = date2.getDay();
|
|
1364
|
-
const localDayOfWeek = (dayOfWeek -
|
|
1271
|
+
const localDayOfWeek = (dayOfWeek - options2.weekStartsOn + 8) % 7 || 7;
|
|
1365
1272
|
switch (token) {
|
|
1366
1273
|
// Numerical value (same as in `e`)
|
|
1367
1274
|
case "c":
|
|
@@ -1780,13 +1687,12 @@ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
|
1780
1687
|
const escapedStringRegExp = /^'([^]*?)'?$/;
|
|
1781
1688
|
const doubleQuoteRegExp = /''/g;
|
|
1782
1689
|
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
1783
|
-
function format(date2, formatStr,
|
|
1784
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1690
|
+
function format(date2, formatStr, options2) {
|
|
1785
1691
|
const defaultOptions2 = getDefaultOptions();
|
|
1786
|
-
const locale =
|
|
1787
|
-
const firstWeekContainsDate =
|
|
1788
|
-
const weekStartsOn =
|
|
1789
|
-
const originalDate = toDate(date2,
|
|
1692
|
+
const locale = options2?.locale ?? defaultOptions2.locale ?? enUS;
|
|
1693
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1694
|
+
const weekStartsOn = options2?.weekStartsOn ?? options2?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
1695
|
+
const originalDate = toDate(date2, options2?.in);
|
|
1790
1696
|
if (!isValid(originalDate)) {
|
|
1791
1697
|
throw new RangeError("Invalid time value");
|
|
1792
1698
|
}
|
|
@@ -1826,7 +1732,7 @@ function format(date2, formatStr, options) {
|
|
|
1826
1732
|
return parts.map((part) => {
|
|
1827
1733
|
if (!part.isToken) return part.value;
|
|
1828
1734
|
const token = part.value;
|
|
1829
|
-
if (!
|
|
1735
|
+
if (!options2?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options2?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
|
|
1830
1736
|
warnOrThrowProtectedError(token, formatStr, String(date2));
|
|
1831
1737
|
}
|
|
1832
1738
|
const formatter = formatters[token[0]];
|
|
@@ -1840,27 +1746,27 @@ function cleanEscapedString(input) {
|
|
|
1840
1746
|
}
|
|
1841
1747
|
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
1842
1748
|
}
|
|
1843
|
-
function formatDistanceStrict(laterDate, earlierDate,
|
|
1749
|
+
function formatDistanceStrict(laterDate, earlierDate, options2) {
|
|
1844
1750
|
const defaultOptions2 = getDefaultOptions();
|
|
1845
|
-
const locale =
|
|
1751
|
+
const locale = options2?.locale ?? defaultOptions2.locale ?? enUS;
|
|
1846
1752
|
const comparison = compareAsc(laterDate, earlierDate);
|
|
1847
1753
|
if (isNaN(comparison)) {
|
|
1848
1754
|
throw new RangeError("Invalid time value");
|
|
1849
1755
|
}
|
|
1850
|
-
const localizeOptions = Object.assign({},
|
|
1851
|
-
addSuffix:
|
|
1756
|
+
const localizeOptions = Object.assign({}, options2, {
|
|
1757
|
+
addSuffix: options2?.addSuffix,
|
|
1852
1758
|
comparison
|
|
1853
1759
|
});
|
|
1854
1760
|
const [laterDate_, earlierDate_] = normalizeDates(
|
|
1855
|
-
|
|
1761
|
+
options2?.in,
|
|
1856
1762
|
...comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]
|
|
1857
1763
|
);
|
|
1858
|
-
const roundingMethod = getRoundingMethod(
|
|
1764
|
+
const roundingMethod = getRoundingMethod(options2?.roundingMethod ?? "round");
|
|
1859
1765
|
const milliseconds = earlierDate_.getTime() - laterDate_.getTime();
|
|
1860
1766
|
const minutes = milliseconds / millisecondsInMinute;
|
|
1861
1767
|
const timezoneOffset = getTimezoneOffsetInMilliseconds(earlierDate_) - getTimezoneOffsetInMilliseconds(laterDate_);
|
|
1862
1768
|
const dstNormalizedMinutes = (milliseconds - timezoneOffset) / millisecondsInMinute;
|
|
1863
|
-
const defaultUnit =
|
|
1769
|
+
const defaultUnit = options2?.unit;
|
|
1864
1770
|
let unit;
|
|
1865
1771
|
if (!defaultUnit) {
|
|
1866
1772
|
if (minutes < 1) {
|
|
@@ -1899,15 +1805,14 @@ function formatDistanceStrict(laterDate, earlierDate, options) {
|
|
|
1899
1805
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
1900
1806
|
}
|
|
1901
1807
|
}
|
|
1902
|
-
function formatDistanceToNowStrict(date2,
|
|
1903
|
-
return formatDistanceStrict(date2, constructNow(date2),
|
|
1808
|
+
function formatDistanceToNowStrict(date2, options2) {
|
|
1809
|
+
return formatDistanceStrict(date2, constructNow(date2), options2);
|
|
1904
1810
|
}
|
|
1905
|
-
function formatRelative(date2, baseDate,
|
|
1906
|
-
|
|
1907
|
-
const [date_, baseDate_] = normalizeDates(options == null ? void 0 : options.in, date2, baseDate);
|
|
1811
|
+
function formatRelative(date2, baseDate, options2) {
|
|
1812
|
+
const [date_, baseDate_] = normalizeDates(options2?.in, date2, baseDate);
|
|
1908
1813
|
const defaultOptions2 = getDefaultOptions();
|
|
1909
1814
|
const locale = defaultOptions2.locale ?? enUS;
|
|
1910
|
-
const weekStartsOn = defaultOptions2.weekStartsOn ??
|
|
1815
|
+
const weekStartsOn = defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
1911
1816
|
const diff = differenceInCalendarDays(date_, baseDate_);
|
|
1912
1817
|
if (isNaN(diff)) {
|
|
1913
1818
|
throw new RangeError("Invalid time value");
|
|
@@ -2570,7 +2475,7 @@ function createCollection2(name) {
|
|
|
2570
2475
|
reactExports.useEffect(() => {
|
|
2571
2476
|
const element = ref.current;
|
|
2572
2477
|
const registered = registeredRef.current;
|
|
2573
|
-
if ((
|
|
2478
|
+
if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) {
|
|
2574
2479
|
return;
|
|
2575
2480
|
}
|
|
2576
2481
|
registeredRef.current = element ? { element, itemData: memoizedItemData } : null;
|
|
@@ -2715,8 +2620,8 @@ function useFocusGuards() {
|
|
|
2715
2620
|
count++;
|
|
2716
2621
|
return () => {
|
|
2717
2622
|
if (count === 1) {
|
|
2718
|
-
guards
|
|
2719
|
-
guards
|
|
2623
|
+
guards?.start.remove();
|
|
2624
|
+
guards?.end.remove();
|
|
2720
2625
|
guards = null;
|
|
2721
2626
|
}
|
|
2722
2627
|
count = Math.max(0, count - 1);
|
|
@@ -3292,12 +3197,12 @@ function innerCreateMedium(defaults, middleware2) {
|
|
|
3292
3197
|
};
|
|
3293
3198
|
return medium;
|
|
3294
3199
|
}
|
|
3295
|
-
function createSidecarMedium(
|
|
3296
|
-
if (
|
|
3297
|
-
|
|
3200
|
+
function createSidecarMedium(options2) {
|
|
3201
|
+
if (options2 === void 0) {
|
|
3202
|
+
options2 = {};
|
|
3298
3203
|
}
|
|
3299
3204
|
var medium = innerCreateMedium(null);
|
|
3300
|
-
medium.options = __assign({ async: true, ssr: false },
|
|
3205
|
+
medium.options = __assign({ async: true, ssr: false }, options2);
|
|
3301
3206
|
return medium;
|
|
3302
3207
|
}
|
|
3303
3208
|
var SideCar$1 = function(_a2) {
|
|
@@ -3978,14 +3883,13 @@ var MenuContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
3978
3883
|
shards
|
|
3979
3884
|
} : void 0;
|
|
3980
3885
|
const handleTypeaheadSearch = /* @__PURE__ */ __name$3((key) => {
|
|
3981
|
-
var _a2, _b;
|
|
3982
3886
|
const search = searchRef.current + key;
|
|
3983
3887
|
const items = getItems().filter((item) => !item.disabled);
|
|
3984
3888
|
const currentItem = document.activeElement;
|
|
3985
|
-
const currentMatch =
|
|
3889
|
+
const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;
|
|
3986
3890
|
const values = items.map((item) => item.textValue);
|
|
3987
3891
|
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
3988
|
-
const newItem =
|
|
3892
|
+
const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
|
|
3989
3893
|
function updateSearch(value) {
|
|
3990
3894
|
searchRef.current = value;
|
|
3991
3895
|
window.clearTimeout(timerRef.current);
|
|
@@ -4002,9 +3906,8 @@ var MenuContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4002
3906
|
}, []);
|
|
4003
3907
|
useFocusGuards();
|
|
4004
3908
|
const isPointerMovingToSubmenu = reactExports.useCallback((event) => {
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
return isMovingTowards && isPointerInGraceArea(event, (_b = pointerGraceIntentRef.current) == null ? void 0 : _b.area);
|
|
3909
|
+
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
3910
|
+
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
4008
3911
|
}, []);
|
|
4009
3912
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4010
3913
|
MenuContentProvider,
|
|
@@ -4019,9 +3922,8 @@ var MenuContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4019
3922
|
),
|
|
4020
3923
|
onItemLeave: reactExports.useCallback(
|
|
4021
3924
|
(event) => {
|
|
4022
|
-
var _a2;
|
|
4023
3925
|
if (isPointerMovingToSubmenu(event)) return;
|
|
4024
|
-
|
|
3926
|
+
contentRef.current?.focus();
|
|
4025
3927
|
setCurrentItemId(null);
|
|
4026
3928
|
},
|
|
4027
3929
|
[isPointerMovingToSubmenu]
|
|
@@ -4043,9 +3945,8 @@ var MenuContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4043
3945
|
trapped: trapFocus,
|
|
4044
3946
|
branches: branchNodes,
|
|
4045
3947
|
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => {
|
|
4046
|
-
var _a2;
|
|
4047
3948
|
event.preventDefault();
|
|
4048
|
-
|
|
3949
|
+
contentRef.current?.focus({ preventScroll: true });
|
|
4049
3950
|
}),
|
|
4050
3951
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
4051
3952
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4153,7 +4054,7 @@ var MenuItem = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4153
4054
|
const menuItem = ref.current;
|
|
4154
4055
|
if (!disabled && menuItem) {
|
|
4155
4056
|
const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
|
|
4156
|
-
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect
|
|
4057
|
+
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });
|
|
4157
4058
|
dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
|
|
4158
4059
|
if (itemSelectEvent.defaultPrevented) {
|
|
4159
4060
|
isPointerDownRef.current = false;
|
|
@@ -4170,13 +4071,11 @@ var MenuItem = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4170
4071
|
disabled,
|
|
4171
4072
|
onClick: composeEventHandlers(props.onClick, handleSelect),
|
|
4172
4073
|
onPointerDown: (event) => {
|
|
4173
|
-
|
|
4174
|
-
(_a2 = props.onPointerDown) == null ? void 0 : _a2.call(props, event);
|
|
4074
|
+
props.onPointerDown?.(event);
|
|
4175
4075
|
isPointerDownRef.current = true;
|
|
4176
4076
|
},
|
|
4177
4077
|
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
4178
|
-
|
|
4179
|
-
if (!isPointerDownRef.current) (_a2 = event.currentTarget) == null ? void 0 : _a2.click();
|
|
4078
|
+
if (!isPointerDownRef.current) event.currentTarget?.click();
|
|
4180
4079
|
}),
|
|
4181
4080
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
4182
4081
|
if (disabled || event.target !== event.currentTarget) {
|
|
@@ -4265,7 +4164,7 @@ var MenuCheckboxItem = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4265
4164
|
"data-state": getCheckedState(checked),
|
|
4266
4165
|
onSelect: composeEventHandlers(
|
|
4267
4166
|
checkboxItemProps.onSelect,
|
|
4268
|
-
() => onCheckedChange
|
|
4167
|
+
() => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),
|
|
4269
4168
|
{ checkForDefaultPrevented: false }
|
|
4270
4169
|
)
|
|
4271
4170
|
}
|
|
@@ -4294,10 +4193,7 @@ var MenuRadioItem = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4294
4193
|
"data-state": getCheckedState(checked),
|
|
4295
4194
|
onSelect: composeEventHandlers(
|
|
4296
4195
|
radioItemProps.onSelect,
|
|
4297
|
-
() =>
|
|
4298
|
-
var _a2;
|
|
4299
|
-
return (_a2 = context.onValueChange) == null ? void 0 : _a2.call(context, value);
|
|
4300
|
-
},
|
|
4196
|
+
() => context.onValueChange?.(value),
|
|
4301
4197
|
{ checkForDefaultPrevented: false }
|
|
4302
4198
|
)
|
|
4303
4199
|
}
|
|
@@ -4380,8 +4276,7 @@ var MenuSubTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4380
4276
|
...props,
|
|
4381
4277
|
ref: composedRefs,
|
|
4382
4278
|
onClick: (event) => {
|
|
4383
|
-
|
|
4384
|
-
(_a2 = props.onClick) == null ? void 0 : _a2.call(props, event);
|
|
4279
|
+
props.onClick?.(event);
|
|
4385
4280
|
if (props.disabled || event.defaultPrevented) return;
|
|
4386
4281
|
event.currentTarget.focus();
|
|
4387
4282
|
if (!context.open) context.onOpenChange(true);
|
|
@@ -4403,11 +4298,10 @@ var MenuSubTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4403
4298
|
onPointerLeave: composeEventHandlers(
|
|
4404
4299
|
props.onPointerLeave,
|
|
4405
4300
|
whenMouse((event) => {
|
|
4406
|
-
var _a2, _b;
|
|
4407
4301
|
clearOpenTimer();
|
|
4408
|
-
const contentRect =
|
|
4302
|
+
const contentRect = context.content?.getBoundingClientRect();
|
|
4409
4303
|
if (contentRect) {
|
|
4410
|
-
const side =
|
|
4304
|
+
const side = context.content?.dataset.side;
|
|
4411
4305
|
const rightSide = side === "right";
|
|
4412
4306
|
const bleed = rightSide ? -5 : 5;
|
|
4413
4307
|
const contentNearEdge = contentRect[rightSide ? "left" : "right"];
|
|
@@ -4437,7 +4331,6 @@ var MenuSubTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4437
4331
|
})
|
|
4438
4332
|
),
|
|
4439
4333
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
4440
|
-
var _a2;
|
|
4441
4334
|
if (props.disabled || event.target !== event.currentTarget) {
|
|
4442
4335
|
return;
|
|
4443
4336
|
}
|
|
@@ -4447,7 +4340,7 @@ var MenuSubTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4447
4340
|
}
|
|
4448
4341
|
if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
|
|
4449
4342
|
context.onOpenChange(true);
|
|
4450
|
-
|
|
4343
|
+
context.content?.focus();
|
|
4451
4344
|
event.preventDefault();
|
|
4452
4345
|
}
|
|
4453
4346
|
})
|
|
@@ -4478,8 +4371,7 @@ var MenuSubContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4478
4371
|
disableOutsideScroll: false,
|
|
4479
4372
|
trapFocus: false,
|
|
4480
4373
|
onOpenAutoFocus: (event) => {
|
|
4481
|
-
|
|
4482
|
-
if (rootContext.isUsingKeyboardRef.current) (_a2 = ref.current) == null ? void 0 : _a2.focus();
|
|
4374
|
+
if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();
|
|
4483
4375
|
event.preventDefault();
|
|
4484
4376
|
},
|
|
4485
4377
|
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
@@ -4491,12 +4383,11 @@ var MenuSubContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4491
4383
|
event.preventDefault();
|
|
4492
4384
|
}),
|
|
4493
4385
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
4494
|
-
var _a2;
|
|
4495
4386
|
const isKeyDownInside = event.currentTarget.contains(event.target);
|
|
4496
4387
|
const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
|
|
4497
4388
|
if (isKeyDownInside && isCloseKey) {
|
|
4498
4389
|
context.onOpenChange(false);
|
|
4499
|
-
|
|
4390
|
+
subContext.trigger?.focus();
|
|
4500
4391
|
event.preventDefault();
|
|
4501
4392
|
}
|
|
4502
4393
|
})
|
|
@@ -4669,8 +4560,7 @@ var DropdownMenuContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
4669
4560
|
...contentProps,
|
|
4670
4561
|
ref: forwardedRef,
|
|
4671
4562
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
4672
|
-
|
|
4673
|
-
if (!hasInteractedOutsideRef.current) (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
|
|
4563
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
4674
4564
|
hasInteractedOutsideRef.current = false;
|
|
4675
4565
|
event.preventDefault();
|
|
4676
4566
|
}),
|
|
@@ -4873,15 +4763,6 @@ const DropdownMenuSeparator = reactExports.forwardRef(({ className, ...props },
|
|
|
4873
4763
|
DropdownMenuSeparator.displayName = DropdownMenuSeparator$1.displayName;
|
|
4874
4764
|
var shim = { exports: {} };
|
|
4875
4765
|
var useSyncExternalStoreShim_production = {};
|
|
4876
|
-
/**
|
|
4877
|
-
* @license React
|
|
4878
|
-
* use-sync-external-store-shim.production.js
|
|
4879
|
-
*
|
|
4880
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4881
|
-
*
|
|
4882
|
-
* This source code is licensed under the MIT license found in the
|
|
4883
|
-
* LICENSE file in the root directory of this source tree.
|
|
4884
|
-
*/
|
|
4885
4766
|
var hasRequiredUseSyncExternalStoreShim_production;
|
|
4886
4767
|
function requireUseSyncExternalStoreShim_production() {
|
|
4887
4768
|
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
@@ -5132,19 +5013,19 @@ let __timestamp = 0;
|
|
|
5132
5013
|
const getTimestamp = () => ++__timestamp;
|
|
5133
5014
|
async function internalMutate(...args) {
|
|
5134
5015
|
const [cache2, _key, _data, _opts] = args;
|
|
5135
|
-
const
|
|
5016
|
+
const options2 = mergeObjects$1({
|
|
5136
5017
|
populateCache: true,
|
|
5137
5018
|
throwOnError: true
|
|
5138
5019
|
}, typeof _opts === "boolean" ? {
|
|
5139
5020
|
revalidate: _opts
|
|
5140
5021
|
} : _opts || {});
|
|
5141
|
-
let populateCache =
|
|
5142
|
-
const rollbackOnErrorOption =
|
|
5143
|
-
let optimisticData =
|
|
5022
|
+
let populateCache = options2.populateCache;
|
|
5023
|
+
const rollbackOnErrorOption = options2.rollbackOnError;
|
|
5024
|
+
let optimisticData = options2.optimisticData;
|
|
5144
5025
|
const rollbackOnError = (error) => {
|
|
5145
5026
|
return typeof rollbackOnErrorOption === "function" ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;
|
|
5146
5027
|
};
|
|
5147
|
-
const throwOnError =
|
|
5028
|
+
const throwOnError = options2.throwOnError;
|
|
5148
5029
|
if (isFunction(_key)) {
|
|
5149
5030
|
const keyFilter = _key;
|
|
5150
5031
|
const matchedKeys = [];
|
|
@@ -5167,7 +5048,7 @@ async function internalMutate(...args) {
|
|
|
5167
5048
|
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
|
|
5168
5049
|
const startRevalidate = () => {
|
|
5169
5050
|
const revalidators = EVENT_REVALIDATORS[key];
|
|
5170
|
-
const revalidate = isFunction(
|
|
5051
|
+
const revalidate = isFunction(options2.revalidate) ? options2.revalidate(get2().data, _k) : options2.revalidate !== false;
|
|
5171
5052
|
if (revalidate) {
|
|
5172
5053
|
delete FETCH[key];
|
|
5173
5054
|
delete PRELOAD[key];
|
|
@@ -5260,9 +5141,9 @@ const revalidateAllKeys = (revalidators, type) => {
|
|
|
5260
5141
|
if (revalidators[key][0]) revalidators[key][0](type);
|
|
5261
5142
|
}
|
|
5262
5143
|
};
|
|
5263
|
-
const initCache = (provider,
|
|
5144
|
+
const initCache = (provider, options2) => {
|
|
5264
5145
|
if (!SWRGlobalState.has(provider)) {
|
|
5265
|
-
const opts = mergeObjects$1(defaultConfigOptions,
|
|
5146
|
+
const opts = mergeObjects$1(defaultConfigOptions, options2);
|
|
5266
5147
|
const EVENT_REVALIDATORS = /* @__PURE__ */ Object.create(null);
|
|
5267
5148
|
const mutate2 = internalMutate.bind(UNDEFINED, provider);
|
|
5268
5149
|
let unmount = noop$1;
|
|
@@ -6151,26 +6032,26 @@ const infinite = (useSWRNext) => (getKey, fn, config) => {
|
|
|
6151
6032
|
const mutate2 = reactExports.useCallback(
|
|
6152
6033
|
// eslint-disable-next-line func-names
|
|
6153
6034
|
function(data, opts) {
|
|
6154
|
-
const
|
|
6035
|
+
const options2 = typeof opts === "boolean" ? {
|
|
6155
6036
|
revalidate: opts
|
|
6156
6037
|
} : opts || {};
|
|
6157
|
-
const shouldRevalidate =
|
|
6038
|
+
const shouldRevalidate = options2.revalidate !== false;
|
|
6158
6039
|
if (!infiniteKey) return EMPTY_PROMISE;
|
|
6159
6040
|
if (shouldRevalidate) {
|
|
6160
6041
|
if (!isUndefined(data)) {
|
|
6161
6042
|
set2({
|
|
6162
6043
|
_i: false,
|
|
6163
|
-
_r:
|
|
6044
|
+
_r: options2.revalidate
|
|
6164
6045
|
});
|
|
6165
6046
|
} else {
|
|
6166
6047
|
set2({
|
|
6167
6048
|
_i: true,
|
|
6168
|
-
_r:
|
|
6049
|
+
_r: options2.revalidate
|
|
6169
6050
|
});
|
|
6170
6051
|
}
|
|
6171
6052
|
}
|
|
6172
6053
|
return arguments.length ? swr.mutate(data, {
|
|
6173
|
-
...
|
|
6054
|
+
...options2,
|
|
6174
6055
|
revalidate: shouldRevalidate
|
|
6175
6056
|
}) : swr.mutate();
|
|
6176
6057
|
},
|
|
@@ -6243,16 +6124,16 @@ const OBSERVABILITY_UPGRADE_REQUIRED_CODE = "observability-upgrade-required";
|
|
|
6243
6124
|
const OBSERVABILITY_UPGRADE_REQUIRED_MESSAGE = "This workflow observability data is outside your current plan window. Upgrade Observability Plus to view up to 30 days of workflow data.";
|
|
6244
6125
|
const OBSERVABILITY_UPGRADE_REQUIRED_TITLE = "Upgrade Observability Plus";
|
|
6245
6126
|
class WorkflowWebAPIError extends Error {
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6127
|
+
request;
|
|
6128
|
+
layer;
|
|
6129
|
+
constructor(message2, options2) {
|
|
6130
|
+
super(message2, { cause: options2?.cause });
|
|
6250
6131
|
this.name = "WorkflowWebAPIError";
|
|
6251
|
-
this.request =
|
|
6252
|
-
this.layer =
|
|
6253
|
-
if (
|
|
6132
|
+
this.request = options2?.request;
|
|
6133
|
+
this.layer = options2?.layer;
|
|
6134
|
+
if (options2?.cause instanceof Error) {
|
|
6254
6135
|
this.stack = `${this.stack}
|
|
6255
|
-
Caused by: ${
|
|
6136
|
+
Caused by: ${options2.cause.stack}`;
|
|
6256
6137
|
}
|
|
6257
6138
|
}
|
|
6258
6139
|
}
|
|
@@ -6264,8 +6145,7 @@ function createWorkflowAPIError(serverError) {
|
|
|
6264
6145
|
});
|
|
6265
6146
|
}
|
|
6266
6147
|
function isObservabilityUpgradeRequired(error) {
|
|
6267
|
-
|
|
6268
|
-
return error instanceof WorkflowWebAPIError && ((_a2 = error.request) == null ? void 0 : _a2.status) === 402 && ((_b = error.request) == null ? void 0 : _b.code) === OBSERVABILITY_UPGRADE_REQUIRED_CODE;
|
|
6148
|
+
return error instanceof WorkflowWebAPIError && error.request?.status === 402 && error.request?.code === OBSERVABILITY_UPGRADE_REQUIRED_CODE;
|
|
6269
6149
|
}
|
|
6270
6150
|
function getErrorTitle(error, fallback) {
|
|
6271
6151
|
if (isObservabilityUpgradeRequired(error)) {
|
|
@@ -6274,13 +6154,12 @@ function getErrorTitle(error, fallback) {
|
|
|
6274
6154
|
return fallback;
|
|
6275
6155
|
}
|
|
6276
6156
|
const getErrorMessage = (error) => {
|
|
6277
|
-
var _a2;
|
|
6278
6157
|
if (isObservabilityUpgradeRequired(error)) {
|
|
6279
6158
|
return OBSERVABILITY_UPGRADE_REQUIRED_MESSAGE;
|
|
6280
6159
|
}
|
|
6281
6160
|
if ("layer" in error && error.layer) {
|
|
6282
6161
|
if (error instanceof WorkflowWebAPIError) {
|
|
6283
|
-
if (
|
|
6162
|
+
if (error.request?.status === 403) {
|
|
6284
6163
|
return VERCEL_403_ERROR_MESSAGE;
|
|
6285
6164
|
}
|
|
6286
6165
|
}
|
|
@@ -6319,13 +6198,12 @@ async function unwrapOrThrow(promise) {
|
|
|
6319
6198
|
if (error) throw error;
|
|
6320
6199
|
return result;
|
|
6321
6200
|
}
|
|
6322
|
-
function useInfiniteList(cacheKey, fetchFn, getItemKey,
|
|
6323
|
-
|
|
6324
|
-
const { keepPreviousData = true, revalidateCached = false } = options;
|
|
6201
|
+
function useInfiniteList(cacheKey, fetchFn, getItemKey, options2 = {}) {
|
|
6202
|
+
const { keepPreviousData = true, revalidateCached = false } = options2;
|
|
6325
6203
|
const getKey = reactExports.useCallback(
|
|
6326
6204
|
(_index, prev) => {
|
|
6327
6205
|
if (prev && (!prev.hasMore || !prev.cursor)) return null;
|
|
6328
|
-
return [cacheKey,
|
|
6206
|
+
return [cacheKey, prev?.cursor ?? null];
|
|
6329
6207
|
},
|
|
6330
6208
|
[cacheKey]
|
|
6331
6209
|
);
|
|
@@ -6361,8 +6239,8 @@ function useInfiniteList(cacheKey, fetchFn, getItemKey, options = {}) {
|
|
|
6361
6239
|
}
|
|
6362
6240
|
return result;
|
|
6363
6241
|
}, [pages, getItemKey]);
|
|
6364
|
-
const lastPage = pages
|
|
6365
|
-
const hasMore = Boolean(
|
|
6242
|
+
const lastPage = pages?.[pages.length - 1];
|
|
6243
|
+
const hasMore = Boolean(lastPage?.hasMore && lastPage?.cursor);
|
|
6366
6244
|
const isLoadingMore = size > 0 && Boolean(pages) && pages.length < size;
|
|
6367
6245
|
const loadMore = reactExports.useCallback(() => {
|
|
6368
6246
|
if (isValidating || !hasMore) return;
|
|
@@ -6384,7 +6262,7 @@ function useInfiniteList(cacheKey, fetchFn, getItemKey, options = {}) {
|
|
|
6384
6262
|
hasMore,
|
|
6385
6263
|
loadMore,
|
|
6386
6264
|
reload,
|
|
6387
|
-
pageInfo:
|
|
6265
|
+
pageInfo: pages?.[0]?.pageInfo
|
|
6388
6266
|
};
|
|
6389
6267
|
}
|
|
6390
6268
|
function useWorkflowRunsInfinite(env, params) {
|
|
@@ -6414,14 +6292,6 @@ function useWorkflowRunsInfinite(env, params) {
|
|
|
6414
6292
|
const getItemKey = reactExports.useCallback((run) => run.runId, []);
|
|
6415
6293
|
return useInfiniteList(cacheKey, fetchFn, getItemKey);
|
|
6416
6294
|
}
|
|
6417
|
-
const DEFAULT_PAGE_SIZE = 10;
|
|
6418
|
-
const LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
6419
|
-
function getPaginationDisplay(currentPage, totalPages, hasMore) {
|
|
6420
|
-
if (hasMore) {
|
|
6421
|
-
return `Page ${currentPage} of ${totalPages}+`;
|
|
6422
|
-
}
|
|
6423
|
-
return `Page ${currentPage} of ${totalPages}`;
|
|
6424
|
-
}
|
|
6425
6295
|
async function cancelRun(env, runId) {
|
|
6426
6296
|
await unwrapOrThrow(cancelRun$1(env, runId));
|
|
6427
6297
|
}
|
|
@@ -6434,8 +6304,8 @@ async function recreateRun(env, runId) {
|
|
|
6434
6304
|
async function reenqueueRun(env, runId) {
|
|
6435
6305
|
await unwrapOrThrow(reenqueueRun$1(env, runId));
|
|
6436
6306
|
}
|
|
6437
|
-
async function wakeUpRun(env, runId,
|
|
6438
|
-
return unwrapOrThrow(wakeUpRun$1(env, runId,
|
|
6307
|
+
async function wakeUpRun(env, runId, options2) {
|
|
6308
|
+
return unwrapOrThrow(wakeUpRun$1(env, runId, options2));
|
|
6439
6309
|
}
|
|
6440
6310
|
async function resumeHook(env, token, payload) {
|
|
6441
6311
|
return unwrapOrThrow(resumeHook$1(env, token, payload));
|
|
@@ -6512,18 +6382,6 @@ function RelativeTime({
|
|
|
6512
6382
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: absoluteTime }) })
|
|
6513
6383
|
] });
|
|
6514
6384
|
}
|
|
6515
|
-
function getStatusColorClass(status) {
|
|
6516
|
-
switch (status) {
|
|
6517
|
-
case "running":
|
|
6518
|
-
return "bg-geist-warning";
|
|
6519
|
-
case "completed":
|
|
6520
|
-
return "bg-geist-cyan";
|
|
6521
|
-
case "failed":
|
|
6522
|
-
return "bg-geist-error";
|
|
6523
|
-
default:
|
|
6524
|
-
return "bg-gray-500";
|
|
6525
|
-
}
|
|
6526
|
-
}
|
|
6527
6385
|
function getErrorCode(error) {
|
|
6528
6386
|
if (error !== null && typeof error === "object" && "code" in error && typeof error.code === "string") {
|
|
6529
6387
|
return error.code;
|
|
@@ -6536,16 +6394,12 @@ function StatusBadge({
|
|
|
6536
6394
|
className,
|
|
6537
6395
|
durationMs
|
|
6538
6396
|
}) {
|
|
6539
|
-
var _a2;
|
|
6540
6397
|
const content = /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: cn("flex flex-row gap-2", className), children: [
|
|
6541
6398
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
6542
6399
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6543
6400
|
"span",
|
|
6544
6401
|
{
|
|
6545
|
-
className: cn(
|
|
6546
|
-
"size-2 rounded-full shrink-0",
|
|
6547
|
-
getStatusColorClass(status)
|
|
6548
|
-
)
|
|
6402
|
+
className: cn("size-2 rounded-full shrink-0", STATUS_DOT[status])
|
|
6549
6403
|
}
|
|
6550
6404
|
),
|
|
6551
6405
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs font-medium capitalize", children: status })
|
|
@@ -6556,11 +6410,11 @@ function StatusBadge({
|
|
|
6556
6410
|
")"
|
|
6557
6411
|
] })
|
|
6558
6412
|
] });
|
|
6559
|
-
const errorCode = status === "failed" ? getErrorCode(context
|
|
6413
|
+
const errorCode = status === "failed" ? getErrorCode(context?.error) : void 0;
|
|
6560
6414
|
if (errorCode) {
|
|
6561
6415
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorCodeBadge, { content, errorCode });
|
|
6562
6416
|
}
|
|
6563
|
-
const cancelReason =
|
|
6417
|
+
const cancelReason = context?.cancelReason?.trim();
|
|
6564
6418
|
if (status === "cancelled" && cancelReason) {
|
|
6565
6419
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
|
|
6566
6420
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6611,7 +6465,6 @@ function useRunActions({
|
|
|
6611
6465
|
const eventAnalysis = reactExports.useMemo(() => analyzeEvents(events), [events]);
|
|
6612
6466
|
const hasPendingSleeps = eventAnalysis.hasPendingSleeps;
|
|
6613
6467
|
const handleReplay = reactExports.useCallback(async () => {
|
|
6614
|
-
var _a2, _b;
|
|
6615
6468
|
if (rerunning || replayDisabledReason) return null;
|
|
6616
6469
|
try {
|
|
6617
6470
|
setRerunning(true);
|
|
@@ -6619,8 +6472,8 @@ function useRunActions({
|
|
|
6619
6472
|
toast.success("New run started", {
|
|
6620
6473
|
description: `Run ID: ${newRunId}`
|
|
6621
6474
|
});
|
|
6622
|
-
|
|
6623
|
-
|
|
6475
|
+
callbacks?.onSuccess?.();
|
|
6476
|
+
callbacks?.onNavigateToRun?.(newRunId);
|
|
6624
6477
|
return newRunId;
|
|
6625
6478
|
} catch (err) {
|
|
6626
6479
|
toast.error("Failed to re-run", {
|
|
@@ -6632,7 +6485,6 @@ function useRunActions({
|
|
|
6632
6485
|
}
|
|
6633
6486
|
}, [env, runId, rerunning, replayDisabledReason, callbacks]);
|
|
6634
6487
|
const handleReenqueue = reactExports.useCallback(async () => {
|
|
6635
|
-
var _a2;
|
|
6636
6488
|
if (reenqueuing) return;
|
|
6637
6489
|
try {
|
|
6638
6490
|
setReenqueuing(true);
|
|
@@ -6640,7 +6492,7 @@ function useRunActions({
|
|
|
6640
6492
|
toast.success("Run re-enqueued", {
|
|
6641
6493
|
description: "The workflow orchestration layer has been re-enqueued."
|
|
6642
6494
|
});
|
|
6643
|
-
|
|
6495
|
+
callbacks?.onSuccess?.();
|
|
6644
6496
|
} catch (err) {
|
|
6645
6497
|
toast.error("Failed to re-enqueue", {
|
|
6646
6498
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -6650,7 +6502,6 @@ function useRunActions({
|
|
|
6650
6502
|
}
|
|
6651
6503
|
}, [env, runId, reenqueuing, callbacks]);
|
|
6652
6504
|
const handleWakeUp = reactExports.useCallback(async () => {
|
|
6653
|
-
var _a2;
|
|
6654
6505
|
if (wakingUp) return;
|
|
6655
6506
|
try {
|
|
6656
6507
|
setWakingUp(true);
|
|
@@ -6664,7 +6515,7 @@ function useRunActions({
|
|
|
6664
6515
|
description: "There were no active sleep calls to cancel."
|
|
6665
6516
|
});
|
|
6666
6517
|
}
|
|
6667
|
-
|
|
6518
|
+
callbacks?.onSuccess?.();
|
|
6668
6519
|
} catch (err) {
|
|
6669
6520
|
toast.error("Failed to cancel sleeps", {
|
|
6670
6521
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -6674,7 +6525,6 @@ function useRunActions({
|
|
|
6674
6525
|
}
|
|
6675
6526
|
}, [env, runId, wakingUp, callbacks]);
|
|
6676
6527
|
const handleCancel = reactExports.useCallback(async () => {
|
|
6677
|
-
var _a2;
|
|
6678
6528
|
if (cancelling) return;
|
|
6679
6529
|
const isRunActive = runStatus === "pending" || runStatus === "running";
|
|
6680
6530
|
if (!isRunActive) {
|
|
@@ -6687,7 +6537,7 @@ function useRunActions({
|
|
|
6687
6537
|
setCancelling(true);
|
|
6688
6538
|
await cancelRun(env, runId);
|
|
6689
6539
|
toast.success("Run cancelled");
|
|
6690
|
-
|
|
6540
|
+
callbacks?.onSuccess?.();
|
|
6691
6541
|
} catch (err) {
|
|
6692
6542
|
toast.error("Failed to cancel", {
|
|
6693
6543
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -7823,24 +7673,24 @@ function onRemove(typename) {
|
|
|
7823
7673
|
else delete this.__on;
|
|
7824
7674
|
};
|
|
7825
7675
|
}
|
|
7826
|
-
function onAdd(typename, value,
|
|
7676
|
+
function onAdd(typename, value, options2) {
|
|
7827
7677
|
return function() {
|
|
7828
7678
|
var on = this.__on, o, listener = contextListener(value);
|
|
7829
7679
|
if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
|
7830
7680
|
if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
|
7831
7681
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
7832
|
-
this.addEventListener(o.type, o.listener = listener, o.options =
|
|
7682
|
+
this.addEventListener(o.type, o.listener = listener, o.options = options2);
|
|
7833
7683
|
o.value = value;
|
|
7834
7684
|
return;
|
|
7835
7685
|
}
|
|
7836
7686
|
}
|
|
7837
|
-
this.addEventListener(typename.type, listener,
|
|
7838
|
-
o = { type: typename.type, name: typename.name, value, listener, options };
|
|
7687
|
+
this.addEventListener(typename.type, listener, options2);
|
|
7688
|
+
o = { type: typename.type, name: typename.name, value, listener, options: options2 };
|
|
7839
7689
|
if (!on) this.__on = [o];
|
|
7840
7690
|
else on.push(o);
|
|
7841
7691
|
};
|
|
7842
7692
|
}
|
|
7843
|
-
function selection_on(typename, value,
|
|
7693
|
+
function selection_on(typename, value, options2) {
|
|
7844
7694
|
var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
|
7845
7695
|
if (arguments.length < 2) {
|
|
7846
7696
|
var on = this.node().__on;
|
|
@@ -7854,7 +7704,7 @@ function selection_on(typename, value, options) {
|
|
|
7854
7704
|
return;
|
|
7855
7705
|
}
|
|
7856
7706
|
on = value ? onAdd : onRemove;
|
|
7857
|
-
for (i = 0; i < n; ++i) this.each(on(typenames[i], value,
|
|
7707
|
+
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options2));
|
|
7858
7708
|
return this;
|
|
7859
7709
|
}
|
|
7860
7710
|
function dispatchEvent(node, type, params) {
|
|
@@ -10044,12 +9894,12 @@ const getConnectedEdges = (nodes, edges) => {
|
|
|
10044
9894
|
});
|
|
10045
9895
|
return edges.filter((edge) => nodeIds.has(edge.source) || nodeIds.has(edge.target));
|
|
10046
9896
|
};
|
|
10047
|
-
function getFitViewNodes(nodeLookup,
|
|
9897
|
+
function getFitViewNodes(nodeLookup, options2) {
|
|
10048
9898
|
const fitViewNodes = /* @__PURE__ */ new Map();
|
|
10049
|
-
const optionNodeIds =
|
|
9899
|
+
const optionNodeIds = options2?.nodes ? new Set(options2.nodes.map((node) => node.id)) : null;
|
|
10050
9900
|
nodeLookup.forEach((n) => {
|
|
10051
9901
|
let isVisible2;
|
|
10052
|
-
if (
|
|
9902
|
+
if (options2?.includeHiddenNodes) {
|
|
10053
9903
|
const { width, height } = getNodeDimensions(n);
|
|
10054
9904
|
isVisible2 = width > 0 && height > 0;
|
|
10055
9905
|
} else {
|
|
@@ -10061,17 +9911,17 @@ function getFitViewNodes(nodeLookup, options) {
|
|
|
10061
9911
|
});
|
|
10062
9912
|
return fitViewNodes;
|
|
10063
9913
|
}
|
|
10064
|
-
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
|
|
9914
|
+
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options2) {
|
|
10065
9915
|
if (nodes.size === 0) {
|
|
10066
9916
|
return true;
|
|
10067
9917
|
}
|
|
10068
|
-
const nodesToFit = getFitViewNodes(nodes,
|
|
9918
|
+
const nodesToFit = getFitViewNodes(nodes, options2);
|
|
10069
9919
|
const bounds = getInternalNodesBounds(nodesToFit);
|
|
10070
|
-
const viewport = getViewportForBounds(bounds, width, height,
|
|
9920
|
+
const viewport = getViewportForBounds(bounds, width, height, options2?.minZoom ?? minZoom, options2?.maxZoom ?? maxZoom, options2?.padding ?? 0.1);
|
|
10071
9921
|
await panZoom.setViewport(viewport, {
|
|
10072
|
-
duration:
|
|
10073
|
-
ease:
|
|
10074
|
-
interpolate:
|
|
9922
|
+
duration: options2?.duration,
|
|
9923
|
+
ease: options2?.ease,
|
|
9924
|
+
interpolate: options2?.interpolate
|
|
10075
9925
|
});
|
|
10076
9926
|
return true;
|
|
10077
9927
|
}
|
|
@@ -10083,7 +9933,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
|
|
|
10083
9933
|
let extent = node.extent || nodeExtent;
|
|
10084
9934
|
if (node.extent === "parent" && !node.expandParent) {
|
|
10085
9935
|
if (!parentNode) {
|
|
10086
|
-
onError
|
|
9936
|
+
onError?.("005", errorMessages["error005"]());
|
|
10087
9937
|
} else {
|
|
10088
9938
|
const { width: parentWidth, height: parentHeight } = getNodeDimensions(parentNode);
|
|
10089
9939
|
if (parentWidth && parentHeight) {
|
|
@@ -10101,7 +9951,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
|
|
|
10101
9951
|
}
|
|
10102
9952
|
const positionAbsolute = isCoordinateExtent(extent) ? clampPosition(nextPosition, extent, node.measured) : nextPosition;
|
|
10103
9953
|
if (node.measured.width === void 0 || node.measured.height === void 0) {
|
|
10104
|
-
onError
|
|
9954
|
+
onError?.("015", errorMessages["error015"]());
|
|
10105
9955
|
}
|
|
10106
9956
|
return {
|
|
10107
9957
|
position: {
|
|
@@ -10151,8 +10001,8 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
|
|
|
10151
10001
|
}
|
|
10152
10002
|
const clamp = (val, min = 0, max = 1) => Math.min(Math.max(val, min), max);
|
|
10153
10003
|
const clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
|
|
10154
|
-
x: clamp(position.x, extent[0][0], extent[1][0] - (
|
|
10155
|
-
y: clamp(position.y, extent[0][1], extent[1][1] - (
|
|
10004
|
+
x: clamp(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
|
|
10005
|
+
y: clamp(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
|
|
10156
10006
|
});
|
|
10157
10007
|
function clampPositionToParent(childPosition, childDimensions, parent) {
|
|
10158
10008
|
const { width: parentWidth, height: parentHeight } = getNodeDimensions(parent);
|
|
@@ -10194,23 +10044,21 @@ const boxToRect = ({ x, y, x2, y2 }) => ({
|
|
|
10194
10044
|
height: y2 - y
|
|
10195
10045
|
});
|
|
10196
10046
|
const nodeToRect = (node, nodeOrigin = [0, 0]) => {
|
|
10197
|
-
var _a2, _b;
|
|
10198
10047
|
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
10199
10048
|
return {
|
|
10200
10049
|
x,
|
|
10201
10050
|
y,
|
|
10202
|
-
width:
|
|
10203
|
-
height:
|
|
10051
|
+
width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
|
|
10052
|
+
height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
|
|
10204
10053
|
};
|
|
10205
10054
|
};
|
|
10206
10055
|
const nodeToBox = (node, nodeOrigin = [0, 0]) => {
|
|
10207
|
-
var _a2, _b;
|
|
10208
10056
|
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
10209
10057
|
return {
|
|
10210
10058
|
x,
|
|
10211
10059
|
y,
|
|
10212
|
-
x2: x + (
|
|
10213
|
-
y2: y + (
|
|
10060
|
+
x2: x + (node.measured?.width ?? node.width ?? node.initialWidth ?? 0),
|
|
10061
|
+
y2: y + (node.measured?.height ?? node.height ?? node.initialHeight ?? 0)
|
|
10214
10062
|
};
|
|
10215
10063
|
};
|
|
10216
10064
|
const getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));
|
|
@@ -10319,23 +10167,18 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
|
|
|
10319
10167
|
zoom: clampedZoom
|
|
10320
10168
|
};
|
|
10321
10169
|
};
|
|
10322
|
-
const isMacOs = () =>
|
|
10323
|
-
var _a2;
|
|
10324
|
-
return typeof navigator !== "undefined" && ((_a2 = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : _a2.indexOf("Mac")) >= 0;
|
|
10325
|
-
};
|
|
10170
|
+
const isMacOs = () => typeof navigator !== "undefined" && navigator?.userAgent?.indexOf("Mac") >= 0;
|
|
10326
10171
|
function isCoordinateExtent(extent) {
|
|
10327
10172
|
return extent !== void 0 && extent !== null && extent !== "parent";
|
|
10328
10173
|
}
|
|
10329
10174
|
function getNodeDimensions(node) {
|
|
10330
|
-
var _a2, _b;
|
|
10331
10175
|
return {
|
|
10332
|
-
width:
|
|
10333
|
-
height:
|
|
10176
|
+
width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
|
|
10177
|
+
height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
|
|
10334
10178
|
};
|
|
10335
10179
|
}
|
|
10336
10180
|
function nodeHasDimensions(node) {
|
|
10337
|
-
|
|
10338
|
-
return (((_a2 = node.measured) == null ? void 0 : _a2.width) ?? node.width ?? node.initialWidth) !== void 0 && (((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight) !== void 0;
|
|
10181
|
+
return (node.measured?.width ?? node.width ?? node.initialWidth) !== void 0 && (node.measured?.height ?? node.height ?? node.initialHeight) !== void 0;
|
|
10339
10182
|
}
|
|
10340
10183
|
function evaluateAbsolutePosition(position, dimensions = { width: 0, height: 0 }, parentId, nodeLookup, nodeOrigin) {
|
|
10341
10184
|
const positionAbsolute = { ...position };
|
|
@@ -10375,7 +10218,7 @@ function getConnectionStatus(isValid2) {
|
|
|
10375
10218
|
}
|
|
10376
10219
|
function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform: transform2, containerBounds }) {
|
|
10377
10220
|
const { x, y } = getEventPosition(event);
|
|
10378
|
-
const pointerPos = pointToRendererPoint({ x: x - (
|
|
10221
|
+
const pointerPos = pointToRendererPoint({ x: x - (containerBounds?.left ?? 0), y: y - (containerBounds?.top ?? 0) }, transform2);
|
|
10379
10222
|
const { x: xSnapped, y: ySnapped } = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos;
|
|
10380
10223
|
return {
|
|
10381
10224
|
xSnapped,
|
|
@@ -10387,28 +10230,23 @@ const getDimensions = (node) => ({
|
|
|
10387
10230
|
width: node.offsetWidth,
|
|
10388
10231
|
height: node.offsetHeight
|
|
10389
10232
|
});
|
|
10390
|
-
const getHostForElement = (element) =>
|
|
10391
|
-
var _a2;
|
|
10392
|
-
return ((_a2 = element == null ? void 0 : element.getRootNode) == null ? void 0 : _a2.call(element)) || (window == null ? void 0 : window.document);
|
|
10393
|
-
};
|
|
10233
|
+
const getHostForElement = (element) => element?.getRootNode?.() || window?.document;
|
|
10394
10234
|
const inputTags = ["INPUT", "SELECT", "TEXTAREA"];
|
|
10395
10235
|
function isInputDOMNode(event) {
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
if ((target == null ? void 0 : target.nodeType) !== 1)
|
|
10236
|
+
const target = event.composedPath?.()?.[0] || event.target;
|
|
10237
|
+
if (target?.nodeType !== 1)
|
|
10399
10238
|
return false;
|
|
10400
10239
|
const isInput = inputTags.includes(target.nodeName) || target.hasAttribute("contenteditable");
|
|
10401
10240
|
return isInput || !!target.closest(".nokey");
|
|
10402
10241
|
}
|
|
10403
10242
|
const isMouseEvent = (event) => "clientX" in event;
|
|
10404
10243
|
const getEventPosition = (event, bounds) => {
|
|
10405
|
-
var _a2, _b;
|
|
10406
10244
|
const isMouse = isMouseEvent(event);
|
|
10407
|
-
const evtX = isMouse ? event.clientX :
|
|
10408
|
-
const evtY = isMouse ? event.clientY :
|
|
10245
|
+
const evtX = isMouse ? event.clientX : event.touches?.[0].clientX;
|
|
10246
|
+
const evtY = isMouse ? event.clientY : event.touches?.[0].clientY;
|
|
10409
10247
|
return {
|
|
10410
|
-
x: evtX - (
|
|
10411
|
-
y: evtY - (
|
|
10248
|
+
x: evtX - (bounds?.left ?? 0),
|
|
10249
|
+
y: evtY - (bounds?.top ?? 0)
|
|
10412
10250
|
};
|
|
10413
10251
|
};
|
|
10414
10252
|
const getHandleBounds = (type, nodeElement, nodeBounds, zoom2, nodeId) => {
|
|
@@ -10524,13 +10362,12 @@ const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__
|
|
|
10524
10362
|
const connectionExists = (edge, edges) => {
|
|
10525
10363
|
return edges.some((el) => el.source === edge.source && el.target === edge.target && (el.sourceHandle === edge.sourceHandle || !el.sourceHandle && !edge.sourceHandle) && (el.targetHandle === edge.targetHandle || !el.targetHandle && !edge.targetHandle));
|
|
10526
10364
|
};
|
|
10527
|
-
const addEdge$1 = (edgeParams, edges,
|
|
10528
|
-
var _a2;
|
|
10365
|
+
const addEdge$1 = (edgeParams, edges, options2 = {}) => {
|
|
10529
10366
|
if (!edgeParams.source || !edgeParams.target) {
|
|
10530
|
-
|
|
10367
|
+
options2.onError?.("006", errorMessages["error006"]());
|
|
10531
10368
|
return edges;
|
|
10532
10369
|
}
|
|
10533
|
-
const edgeIdGenerator =
|
|
10370
|
+
const edgeIdGenerator = options2.getEdgeId || getEdgeId;
|
|
10534
10371
|
let edge;
|
|
10535
10372
|
if (isEdgeBase(edgeParams)) {
|
|
10536
10373
|
edge = { ...edgeParams };
|
|
@@ -10703,33 +10540,31 @@ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom,
|
|
|
10703
10540
|
return [path, labelX, labelY, offsetX, offsetY];
|
|
10704
10541
|
}
|
|
10705
10542
|
function isNodeInitialized(node) {
|
|
10706
|
-
|
|
10707
|
-
return node && !!(node.internals.handleBounds || ((_a2 = node.handles) == null ? void 0 : _a2.length)) && !!(node.measured.width || node.width || node.initialWidth);
|
|
10543
|
+
return node && !!(node.internals.handleBounds || node.handles?.length) && !!(node.measured.width || node.width || node.initialWidth);
|
|
10708
10544
|
}
|
|
10709
10545
|
function getEdgePosition(params) {
|
|
10710
|
-
var _a2;
|
|
10711
10546
|
const { sourceNode, targetNode } = params;
|
|
10712
10547
|
if (!isNodeInitialized(sourceNode) || !isNodeInitialized(targetNode)) {
|
|
10713
10548
|
return null;
|
|
10714
10549
|
}
|
|
10715
10550
|
const sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles);
|
|
10716
10551
|
const targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles);
|
|
10717
|
-
const sourceHandle = getHandle$1(
|
|
10552
|
+
const sourceHandle = getHandle$1(sourceHandleBounds?.source ?? [], params.sourceHandle);
|
|
10718
10553
|
const targetHandle = getHandle$1(
|
|
10719
10554
|
// when connection type is loose we can define all handles as sources and connect source -> source
|
|
10720
|
-
params.connectionMode === ConnectionMode.Strict ?
|
|
10555
|
+
params.connectionMode === ConnectionMode.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
|
|
10721
10556
|
params.targetHandle
|
|
10722
10557
|
);
|
|
10723
10558
|
if (!sourceHandle || !targetHandle) {
|
|
10724
|
-
|
|
10559
|
+
params.onError?.("008", errorMessages["error008"](!sourceHandle ? "source" : "target", {
|
|
10725
10560
|
id: params.id,
|
|
10726
10561
|
sourceHandle: params.sourceHandle,
|
|
10727
10562
|
targetHandle: params.targetHandle
|
|
10728
10563
|
}));
|
|
10729
10564
|
return null;
|
|
10730
10565
|
}
|
|
10731
|
-
const sourcePosition =
|
|
10732
|
-
const targetPosition =
|
|
10566
|
+
const sourcePosition = sourceHandle?.position || Position.Bottom;
|
|
10567
|
+
const targetPosition = targetHandle?.position || Position.Top;
|
|
10733
10568
|
const source = getHandlePosition(sourceNode, sourceHandle, sourcePosition);
|
|
10734
10569
|
const target = getHandlePosition(targetNode, targetHandle, targetPosition);
|
|
10735
10570
|
return {
|
|
@@ -10762,13 +10597,13 @@ function toHandleBounds(handles) {
|
|
|
10762
10597
|
};
|
|
10763
10598
|
}
|
|
10764
10599
|
function getHandlePosition(node, handle, fallbackPosition = Position.Left, center = false) {
|
|
10765
|
-
const x = (
|
|
10766
|
-
const y = (
|
|
10600
|
+
const x = (handle?.x ?? 0) + node.internals.positionAbsolute.x;
|
|
10601
|
+
const y = (handle?.y ?? 0) + node.internals.positionAbsolute.y;
|
|
10767
10602
|
const { width, height } = handle ?? getNodeDimensions(node);
|
|
10768
10603
|
if (center) {
|
|
10769
10604
|
return { x: x + width / 2, y: y + height / 2 };
|
|
10770
10605
|
}
|
|
10771
|
-
const position =
|
|
10606
|
+
const position = handle?.position ?? fallbackPosition;
|
|
10772
10607
|
switch (position) {
|
|
10773
10608
|
case Position.Top:
|
|
10774
10609
|
return { x: x + width / 2, y };
|
|
@@ -10833,8 +10668,8 @@ function mergeObjects(base, incoming) {
|
|
|
10833
10668
|
}
|
|
10834
10669
|
return result;
|
|
10835
10670
|
}
|
|
10836
|
-
function updateAbsolutePositions(nodeLookup, parentLookup,
|
|
10837
|
-
const _options = mergeObjects(defaultOptions,
|
|
10671
|
+
function updateAbsolutePositions(nodeLookup, parentLookup, options2) {
|
|
10672
|
+
const _options = mergeObjects(defaultOptions, options2);
|
|
10838
10673
|
for (const node of nodeLookup.values()) {
|
|
10839
10674
|
if (node.parentId) {
|
|
10840
10675
|
updateChildNode(node, nodeLookup, parentLookup, _options);
|
|
@@ -10848,7 +10683,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
|
|
|
10848
10683
|
}
|
|
10849
10684
|
function parseHandles(userNode, internalNode) {
|
|
10850
10685
|
if (!userNode.handles) {
|
|
10851
|
-
return !userNode.measured ? void 0 : internalNode
|
|
10686
|
+
return !userNode.measured ? void 0 : internalNode?.internals.handleBounds;
|
|
10852
10687
|
}
|
|
10853
10688
|
const source = [];
|
|
10854
10689
|
const target = [];
|
|
@@ -10877,19 +10712,18 @@ function parseHandles(userNode, internalNode) {
|
|
|
10877
10712
|
function isManualZIndexMode(zIndexMode) {
|
|
10878
10713
|
return zIndexMode === "manual";
|
|
10879
10714
|
}
|
|
10880
|
-
function adoptUserNodes(nodes, nodeLookup, parentLookup,
|
|
10881
|
-
|
|
10882
|
-
const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
|
|
10715
|
+
function adoptUserNodes(nodes, nodeLookup, parentLookup, options2 = {}) {
|
|
10716
|
+
const _options = mergeObjects(adoptUserNodesDefaultOptions, options2);
|
|
10883
10717
|
const rootParentIndex = { i: 0 };
|
|
10884
10718
|
const tmpLookup = new Map(nodeLookup);
|
|
10885
|
-
const selectedNodeZ =
|
|
10719
|
+
const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
|
|
10886
10720
|
let nodesInitialized = nodes.length > 0;
|
|
10887
10721
|
let hasSelectedNodes = false;
|
|
10888
10722
|
nodeLookup.clear();
|
|
10889
10723
|
parentLookup.clear();
|
|
10890
10724
|
for (const userNode of nodes) {
|
|
10891
10725
|
let internalNode = tmpLookup.get(userNode.id);
|
|
10892
|
-
if (_options.checkEquality && userNode ===
|
|
10726
|
+
if (_options.checkEquality && userNode === internalNode?.internals.userNode) {
|
|
10893
10727
|
nodeLookup.set(userNode.id, internalNode);
|
|
10894
10728
|
} else {
|
|
10895
10729
|
const positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin);
|
|
@@ -10899,8 +10733,8 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
10899
10733
|
..._options.defaults,
|
|
10900
10734
|
...userNode,
|
|
10901
10735
|
measured: {
|
|
10902
|
-
width:
|
|
10903
|
-
height:
|
|
10736
|
+
width: userNode.measured?.width,
|
|
10737
|
+
height: userNode.measured?.height
|
|
10904
10738
|
},
|
|
10905
10739
|
internals: {
|
|
10906
10740
|
positionAbsolute: clampedPosition,
|
|
@@ -10916,9 +10750,9 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
10916
10750
|
nodesInitialized = false;
|
|
10917
10751
|
}
|
|
10918
10752
|
if (userNode.parentId) {
|
|
10919
|
-
updateChildNode(internalNode, nodeLookup, parentLookup,
|
|
10753
|
+
updateChildNode(internalNode, nodeLookup, parentLookup, options2, rootParentIndex);
|
|
10920
10754
|
}
|
|
10921
|
-
hasSelectedNodes
|
|
10755
|
+
hasSelectedNodes ||= userNode.selected ?? false;
|
|
10922
10756
|
}
|
|
10923
10757
|
return { nodesInitialized, hasSelectedNodes };
|
|
10924
10758
|
}
|
|
@@ -10933,8 +10767,8 @@ function updateParentLookup(node, parentLookup) {
|
|
|
10933
10767
|
parentLookup.set(node.parentId, /* @__PURE__ */ new Map([[node.id, node]]));
|
|
10934
10768
|
}
|
|
10935
10769
|
}
|
|
10936
|
-
function updateChildNode(node, nodeLookup, parentLookup,
|
|
10937
|
-
const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions,
|
|
10770
|
+
function updateChildNode(node, nodeLookup, parentLookup, options2, rootParentIndex) {
|
|
10771
|
+
const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions, options2);
|
|
10938
10772
|
const parentId = node.parentId;
|
|
10939
10773
|
const parentNode = nodeLookup.get(parentId);
|
|
10940
10774
|
if (!parentNode) {
|
|
@@ -10989,7 +10823,6 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
|
|
|
10989
10823
|
};
|
|
10990
10824
|
}
|
|
10991
10825
|
function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0, 0]) {
|
|
10992
|
-
var _a2;
|
|
10993
10826
|
const changes = [];
|
|
10994
10827
|
const parentExpansions = /* @__PURE__ */ new Map();
|
|
10995
10828
|
for (const child of children2) {
|
|
@@ -10997,13 +10830,12 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
10997
10830
|
if (!parent) {
|
|
10998
10831
|
continue;
|
|
10999
10832
|
}
|
|
11000
|
-
const parentRect =
|
|
10833
|
+
const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect(parent);
|
|
11001
10834
|
const expandedRect = getBoundsOfRects(parentRect, child.rect);
|
|
11002
10835
|
parentExpansions.set(child.parentId, { expandedRect, parent });
|
|
11003
10836
|
}
|
|
11004
10837
|
if (parentExpansions.size > 0) {
|
|
11005
10838
|
parentExpansions.forEach(({ expandedRect, parent }, parentId) => {
|
|
11006
|
-
var _a3;
|
|
11007
10839
|
const positionAbsolute = parent.internals.positionAbsolute;
|
|
11008
10840
|
const dimensions = getNodeDimensions(parent);
|
|
11009
10841
|
const origin = parent.origin ?? nodeOrigin;
|
|
@@ -11022,7 +10854,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
11022
10854
|
y: parent.position.y - yChange + heightChange
|
|
11023
10855
|
}
|
|
11024
10856
|
});
|
|
11025
|
-
|
|
10857
|
+
parentLookup.get(parentId)?.forEach((childNode) => {
|
|
11026
10858
|
if (!children2.some((child) => child.id === childNode.id)) {
|
|
11027
10859
|
changes.push({
|
|
11028
10860
|
id: childNode.id,
|
|
@@ -11051,7 +10883,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
11051
10883
|
return changes;
|
|
11052
10884
|
}
|
|
11053
10885
|
function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent, zIndexMode) {
|
|
11054
|
-
const viewportNode = domNode
|
|
10886
|
+
const viewportNode = domNode?.querySelector(".xyflow__viewport");
|
|
11055
10887
|
let updatedInternals = false;
|
|
11056
10888
|
if (!viewportNode) {
|
|
11057
10889
|
return { changes: [], updatedInternals };
|
|
@@ -11185,14 +11017,13 @@ function isParentSelected(node, nodeLookup) {
|
|
|
11185
11017
|
return isParentSelected(parentNode, nodeLookup);
|
|
11186
11018
|
}
|
|
11187
11019
|
function hasSelector(target, selector2, domNode) {
|
|
11188
|
-
var _a2;
|
|
11189
11020
|
let current = target;
|
|
11190
11021
|
do {
|
|
11191
|
-
if (
|
|
11022
|
+
if (current?.matches?.(selector2))
|
|
11192
11023
|
return true;
|
|
11193
11024
|
if (current === domNode)
|
|
11194
11025
|
return false;
|
|
11195
|
-
current = current
|
|
11026
|
+
current = current?.parentElement;
|
|
11196
11027
|
} while (current);
|
|
11197
11028
|
return false;
|
|
11198
11029
|
}
|
|
@@ -11228,10 +11059,9 @@ function getDragItems(nodeLookup, nodesDraggable, mousePos, nodeId, onlyDragNode
|
|
|
11228
11059
|
return dragItems;
|
|
11229
11060
|
}
|
|
11230
11061
|
function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true }) {
|
|
11231
|
-
var _a2, _b, _c;
|
|
11232
11062
|
const nodesFromDragItems = [];
|
|
11233
11063
|
for (const [id2, dragItem] of dragItems) {
|
|
11234
|
-
const node2 =
|
|
11064
|
+
const node2 = nodeLookup.get(id2)?.internals.userNode;
|
|
11235
11065
|
if (node2) {
|
|
11236
11066
|
nodesFromDragItems.push({
|
|
11237
11067
|
...node2,
|
|
@@ -11243,11 +11073,11 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true
|
|
|
11243
11073
|
if (!nodeId) {
|
|
11244
11074
|
return [nodesFromDragItems[0], nodesFromDragItems];
|
|
11245
11075
|
}
|
|
11246
|
-
const node =
|
|
11076
|
+
const node = nodeLookup.get(nodeId)?.internals.userNode;
|
|
11247
11077
|
return [
|
|
11248
11078
|
!node ? nodesFromDragItems[0] : {
|
|
11249
11079
|
...node,
|
|
11250
|
-
position:
|
|
11080
|
+
position: dragItems.get(nodeId)?.position || node.position,
|
|
11251
11081
|
dragging
|
|
11252
11082
|
},
|
|
11253
11083
|
nodesFromDragItems
|
|
@@ -11340,10 +11170,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
11340
11170
|
dragItems,
|
|
11341
11171
|
nodeLookup
|
|
11342
11172
|
});
|
|
11343
|
-
onDrag
|
|
11344
|
-
onNodeDrag
|
|
11173
|
+
onDrag?.(dragEvent, dragItems, currentNode, currentNodes);
|
|
11174
|
+
onNodeDrag?.(dragEvent, currentNode, currentNodes);
|
|
11345
11175
|
if (!nodeId) {
|
|
11346
|
-
onSelectionDrag
|
|
11176
|
+
onSelectionDrag?.(dragEvent, currentNodes);
|
|
11347
11177
|
}
|
|
11348
11178
|
}
|
|
11349
11179
|
}
|
|
@@ -11368,17 +11198,16 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
11368
11198
|
autoPanId = requestAnimationFrame(autoPan);
|
|
11369
11199
|
}
|
|
11370
11200
|
function startDrag(event) {
|
|
11371
|
-
var _a2, _b;
|
|
11372
11201
|
const { nodeLookup, multiSelectionActive, nodesDraggable, transform: transform2, snapGrid, snapToGrid, selectNodesOnDrag, onNodeDragStart, onSelectionDragStart, unselectNodesAndEdges } = getStoreItems();
|
|
11373
11202
|
dragStarted = true;
|
|
11374
|
-
const isUnselectedNodeDrag = !!nodeId && !multiSelectionActive && !
|
|
11203
|
+
const isUnselectedNodeDrag = !!nodeId && !multiSelectionActive && !nodeLookup.get(nodeId)?.selected;
|
|
11375
11204
|
if ((!selectNodesOnDrag || !isSelectable) && !multiSelectionActive && nodeId) {
|
|
11376
|
-
if (!
|
|
11205
|
+
if (!nodeLookup.get(nodeId)?.selected) {
|
|
11377
11206
|
unselectNodesAndEdges();
|
|
11378
11207
|
}
|
|
11379
11208
|
}
|
|
11380
11209
|
if (isSelectable && selectNodesOnDrag && nodeId) {
|
|
11381
|
-
onNodeMouseDown
|
|
11210
|
+
onNodeMouseDown?.(nodeId);
|
|
11382
11211
|
}
|
|
11383
11212
|
const pointerPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds });
|
|
11384
11213
|
lastPos = pointerPos;
|
|
@@ -11389,16 +11218,16 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
11389
11218
|
dragItems,
|
|
11390
11219
|
nodeLookup
|
|
11391
11220
|
});
|
|
11392
|
-
onDragStart
|
|
11393
|
-
onNodeDragStart
|
|
11221
|
+
onDragStart?.(event.sourceEvent, dragItems, currentNode, currentNodes);
|
|
11222
|
+
onNodeDragStart?.(event.sourceEvent, currentNode, currentNodes);
|
|
11394
11223
|
if (!nodeId) {
|
|
11395
|
-
onSelectionDragStart
|
|
11224
|
+
onSelectionDragStart?.(event.sourceEvent, currentNodes);
|
|
11396
11225
|
}
|
|
11397
11226
|
}
|
|
11398
11227
|
}
|
|
11399
11228
|
const d3DragInstance = drag().clickDistance(nodeClickDistance).on("start", (event) => {
|
|
11400
11229
|
const { domNode: domNode2, nodeDragThreshold, transform: transform2, snapGrid, snapToGrid } = getStoreItems();
|
|
11401
|
-
containerBounds =
|
|
11230
|
+
containerBounds = domNode2?.getBoundingClientRect() || null;
|
|
11402
11231
|
abortDrag = false;
|
|
11403
11232
|
nodePositionsChanged = false;
|
|
11404
11233
|
dragEvent = event.sourceEvent;
|
|
@@ -11459,10 +11288,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
11459
11288
|
nodeLookup,
|
|
11460
11289
|
dragging: false
|
|
11461
11290
|
});
|
|
11462
|
-
onDragStop
|
|
11463
|
-
onNodeDragStop
|
|
11291
|
+
onDragStop?.(event.sourceEvent, dragItems, currentNode, currentNodes);
|
|
11292
|
+
onNodeDragStop?.(event.sourceEvent, currentNode, currentNodes);
|
|
11464
11293
|
if (!nodeId) {
|
|
11465
|
-
onSelectionDragStop
|
|
11294
|
+
onSelectionDragStop?.(event.sourceEvent, currentNodes);
|
|
11466
11295
|
}
|
|
11467
11296
|
}
|
|
11468
11297
|
}
|
|
@@ -11474,7 +11303,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
11474
11303
|
d3Selection.call(d3DragInstance);
|
|
11475
11304
|
}
|
|
11476
11305
|
function destroy() {
|
|
11477
|
-
d3Selection
|
|
11306
|
+
d3Selection?.on(".drag", null);
|
|
11478
11307
|
}
|
|
11479
11308
|
return {
|
|
11480
11309
|
update,
|
|
@@ -11498,12 +11327,11 @@ function getNodesWithinDistance(position, nodeLookup, distance2) {
|
|
|
11498
11327
|
}
|
|
11499
11328
|
const ADDITIONAL_DISTANCE = 250;
|
|
11500
11329
|
function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
|
|
11501
|
-
var _a2, _b;
|
|
11502
11330
|
let closestHandles = [];
|
|
11503
11331
|
let minDistance = Infinity;
|
|
11504
11332
|
const closeNodes = getNodesWithinDistance(position, nodeLookup, connectionRadius + ADDITIONAL_DISTANCE);
|
|
11505
11333
|
for (const node of closeNodes) {
|
|
11506
|
-
const allHandles = [...
|
|
11334
|
+
const allHandles = [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
|
|
11507
11335
|
for (const handle of allHandles) {
|
|
11508
11336
|
if (fromHandle.nodeId === handle.nodeId && fromHandle.type === handle.type && fromHandle.id === handle.id) {
|
|
11509
11337
|
continue;
|
|
@@ -11531,21 +11359,20 @@ function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
|
|
|
11531
11359
|
return closestHandles[0];
|
|
11532
11360
|
}
|
|
11533
11361
|
function getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode, withAbsolutePosition = false) {
|
|
11534
|
-
var _a2, _b, _c;
|
|
11535
11362
|
const node = nodeLookup.get(nodeId);
|
|
11536
11363
|
if (!node) {
|
|
11537
11364
|
return null;
|
|
11538
11365
|
}
|
|
11539
|
-
const handles = connectionMode === "strict" ?
|
|
11540
|
-
const handle = (handleId ? handles
|
|
11366
|
+
const handles = connectionMode === "strict" ? node.internals.handleBounds?.[handleType] : [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
|
|
11367
|
+
const handle = (handleId ? handles?.find((h) => h.id === handleId) : handles?.[0]) ?? null;
|
|
11541
11368
|
return handle && withAbsolutePosition ? { ...handle, ...getHandlePosition(node, handle, handle.position, true) } : handle;
|
|
11542
11369
|
}
|
|
11543
11370
|
function getHandleType(edgeUpdaterType, handleDomNode) {
|
|
11544
11371
|
if (edgeUpdaterType) {
|
|
11545
11372
|
return edgeUpdaterType;
|
|
11546
|
-
} else if (handleDomNode
|
|
11373
|
+
} else if (handleDomNode?.classList.contains("target")) {
|
|
11547
11374
|
return "target";
|
|
11548
|
-
} else if (handleDomNode
|
|
11375
|
+
} else if (handleDomNode?.classList.contains("source")) {
|
|
11549
11376
|
return "source";
|
|
11550
11377
|
}
|
|
11551
11378
|
return null;
|
|
@@ -11566,7 +11393,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11566
11393
|
let closestHandle;
|
|
11567
11394
|
const { x, y } = getEventPosition(event);
|
|
11568
11395
|
const handleType = getHandleType(edgeUpdaterType, handleDomNode);
|
|
11569
|
-
const containerBounds = domNode
|
|
11396
|
+
const containerBounds = domNode?.getBoundingClientRect();
|
|
11570
11397
|
let connectionStarted = false;
|
|
11571
11398
|
if (!containerBounds || !handleType) {
|
|
11572
11399
|
return;
|
|
@@ -11612,7 +11439,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11612
11439
|
function startConnection() {
|
|
11613
11440
|
connectionStarted = true;
|
|
11614
11441
|
updateConnection(previousConnection);
|
|
11615
|
-
onConnectStart
|
|
11442
|
+
onConnectStart?.(event, { nodeId, handleId, handleType });
|
|
11616
11443
|
}
|
|
11617
11444
|
if (dragThreshold === 0) {
|
|
11618
11445
|
startConnection();
|
|
@@ -11675,16 +11502,16 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11675
11502
|
}
|
|
11676
11503
|
if (connectionStarted) {
|
|
11677
11504
|
if ((closestHandle || resultHandleDomNode) && connection && isValid2) {
|
|
11678
|
-
onConnect
|
|
11505
|
+
onConnect?.(connection);
|
|
11679
11506
|
}
|
|
11680
11507
|
const { inProgress, ...connectionState } = previousConnection;
|
|
11681
11508
|
const finalConnectionState = {
|
|
11682
11509
|
...connectionState,
|
|
11683
11510
|
toPosition: previousConnection.toHandle ? previousConnection.toPosition : null
|
|
11684
11511
|
};
|
|
11685
|
-
onConnectEnd
|
|
11512
|
+
onConnectEnd?.(event2, finalConnectionState);
|
|
11686
11513
|
if (edgeUpdaterType) {
|
|
11687
|
-
onReconnectEnd
|
|
11514
|
+
onReconnectEnd?.(event2, finalConnectionState);
|
|
11688
11515
|
}
|
|
11689
11516
|
}
|
|
11690
11517
|
cancelConnection();
|
|
@@ -11705,10 +11532,10 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11705
11532
|
}
|
|
11706
11533
|
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, nodeLookup }) {
|
|
11707
11534
|
const isTarget = fromType === "target";
|
|
11708
|
-
const handleDomNode = handle ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle
|
|
11535
|
+
const handleDomNode = handle ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`) : null;
|
|
11709
11536
|
const { x, y } = getEventPosition(event);
|
|
11710
11537
|
const handleBelow = doc.elementFromPoint(x, y);
|
|
11711
|
-
const handleToCheck =
|
|
11538
|
+
const handleToCheck = handleBelow?.classList.contains(`${lib}-flow__handle`) ? handleBelow : handleDomNode;
|
|
11712
11539
|
const result = {
|
|
11713
11540
|
handleDomNode: handleToCheck,
|
|
11714
11541
|
isValid: false,
|
|
@@ -11859,12 +11686,12 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
|
|
|
11859
11686
|
clearTimeout(zoomPanValues.panScrollTimeout);
|
|
11860
11687
|
if (!zoomPanValues.isPanScrolling) {
|
|
11861
11688
|
zoomPanValues.isPanScrolling = true;
|
|
11862
|
-
onPanZoomStart
|
|
11689
|
+
onPanZoomStart?.(event, nextViewport);
|
|
11863
11690
|
} else {
|
|
11864
|
-
onPanZoom
|
|
11691
|
+
onPanZoom?.(event, nextViewport);
|
|
11865
11692
|
}
|
|
11866
11693
|
zoomPanValues.panScrollTimeout = setTimeout(() => {
|
|
11867
|
-
onPanZoomEnd
|
|
11694
|
+
onPanZoomEnd?.(event, nextViewport);
|
|
11868
11695
|
zoomPanValues.isPanScrolling = false;
|
|
11869
11696
|
}, 150);
|
|
11870
11697
|
};
|
|
@@ -11886,38 +11713,35 @@ function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomH
|
|
|
11886
11713
|
}
|
|
11887
11714
|
function createPanZoomStartHandler({ zoomPanValues, onDraggingChange, onPanZoomStart }) {
|
|
11888
11715
|
return (event) => {
|
|
11889
|
-
|
|
11890
|
-
if ((_a2 = event.sourceEvent) == null ? void 0 : _a2.internal) {
|
|
11716
|
+
if (event.sourceEvent?.internal) {
|
|
11891
11717
|
return;
|
|
11892
11718
|
}
|
|
11893
11719
|
const viewport = transformToViewport(event.transform);
|
|
11894
|
-
zoomPanValues.mouseButton =
|
|
11720
|
+
zoomPanValues.mouseButton = event.sourceEvent?.button || 0;
|
|
11895
11721
|
zoomPanValues.isZoomingOrPanning = true;
|
|
11896
11722
|
zoomPanValues.prevViewport = viewport;
|
|
11897
|
-
if (
|
|
11723
|
+
if (event.sourceEvent?.type === "mousedown") {
|
|
11898
11724
|
onDraggingChange(true);
|
|
11899
11725
|
}
|
|
11900
11726
|
if (onPanZoomStart) {
|
|
11901
|
-
onPanZoomStart
|
|
11727
|
+
onPanZoomStart?.(event.sourceEvent, viewport);
|
|
11902
11728
|
}
|
|
11903
11729
|
};
|
|
11904
11730
|
}
|
|
11905
11731
|
function createPanZoomHandler({ zoomPanValues, panOnDrag, onPaneContextMenu, onTransformChange, onPanZoom }) {
|
|
11906
11732
|
return (event) => {
|
|
11907
|
-
var _a2, _b;
|
|
11908
11733
|
zoomPanValues.usedRightMouseButton = !!(onPaneContextMenu && isRightClickPan(panOnDrag, zoomPanValues.mouseButton ?? 0));
|
|
11909
|
-
if (!
|
|
11734
|
+
if (!event.sourceEvent?.sync) {
|
|
11910
11735
|
onTransformChange([event.transform.x, event.transform.y, event.transform.k]);
|
|
11911
11736
|
}
|
|
11912
|
-
if (onPanZoom && !
|
|
11913
|
-
onPanZoom
|
|
11737
|
+
if (onPanZoom && !event.sourceEvent?.internal) {
|
|
11738
|
+
onPanZoom?.(event.sourceEvent, transformToViewport(event.transform));
|
|
11914
11739
|
}
|
|
11915
11740
|
};
|
|
11916
11741
|
}
|
|
11917
11742
|
function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDraggingChange, onPanZoomEnd, onPaneContextMenu }) {
|
|
11918
11743
|
return (event) => {
|
|
11919
|
-
|
|
11920
|
-
if ((_a2 = event.sourceEvent) == null ? void 0 : _a2.internal) {
|
|
11744
|
+
if (event.sourceEvent?.internal) {
|
|
11921
11745
|
return;
|
|
11922
11746
|
}
|
|
11923
11747
|
zoomPanValues.isZoomingOrPanning = false;
|
|
@@ -11932,7 +11756,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
11932
11756
|
clearTimeout(zoomPanValues.timerId);
|
|
11933
11757
|
zoomPanValues.timerId = setTimeout(
|
|
11934
11758
|
() => {
|
|
11935
|
-
onPanZoomEnd
|
|
11759
|
+
onPanZoomEnd?.(event.sourceEvent, viewport);
|
|
11936
11760
|
},
|
|
11937
11761
|
// we need a setTimeout for panOnScroll to suppress multiple end events fired during scroll
|
|
11938
11762
|
panOnScroll ? 150 : 0
|
|
@@ -11942,7 +11766,6 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
11942
11766
|
}
|
|
11943
11767
|
function createFilter({ panActivationKeyPressed, zoomActivationKeyPressed, zoomOnScroll, zoomOnPinch, panOnDrag, panOnScroll, zoomOnDoubleClick, userSelectionActive, noWheelClassName, noPanClassName, lib, connectionInProgress }) {
|
|
11944
11768
|
return (event) => {
|
|
11945
|
-
var _a2;
|
|
11946
11769
|
const zoomScroll = zoomActivationKeyPressed || zoomOnScroll;
|
|
11947
11770
|
const pinchZoom = zoomOnPinch && event.ctrlKey;
|
|
11948
11771
|
const isWheelEvent = event.type === "wheel";
|
|
@@ -11967,7 +11790,7 @@ function createFilter({ panActivationKeyPressed, zoomActivationKeyPressed, zoomO
|
|
|
11967
11790
|
if (!zoomOnPinch && event.ctrlKey && isWheelEvent) {
|
|
11968
11791
|
return false;
|
|
11969
11792
|
}
|
|
11970
|
-
if (!zoomOnPinch && event.type === "touchstart" &&
|
|
11793
|
+
if (!zoomOnPinch && event.type === "touchstart" && event.touches?.length > 1) {
|
|
11971
11794
|
event.preventDefault();
|
|
11972
11795
|
return false;
|
|
11973
11796
|
}
|
|
@@ -12001,14 +11824,14 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
12001
11824
|
];
|
|
12002
11825
|
const extentResizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver((entries) => {
|
|
12003
11826
|
const entry = entries[0];
|
|
12004
|
-
if (entry
|
|
11827
|
+
if (entry?.contentRect) {
|
|
12005
11828
|
cachedExtent = [
|
|
12006
11829
|
[0, 0],
|
|
12007
11830
|
[entry.contentRect.width, entry.contentRect.height]
|
|
12008
11831
|
];
|
|
12009
11832
|
}
|
|
12010
11833
|
}) : null;
|
|
12011
|
-
extentResizeObserver
|
|
11834
|
+
extentResizeObserver?.observe(domNode);
|
|
12012
11835
|
const d3ZoomInstance = zoom().extent(() => cachedExtent).scaleExtent([minZoom, maxZoom]).translateExtent(translateExtent);
|
|
12013
11836
|
const d3Selection = select(domNode).call(d3ZoomInstance);
|
|
12014
11837
|
setViewportConstrained({
|
|
@@ -12022,10 +11845,10 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
12022
11845
|
const d3ZoomHandler = d3Selection.on("wheel.zoom");
|
|
12023
11846
|
const d3DblClickZoomHandler = d3Selection.on("dblclick.zoom");
|
|
12024
11847
|
d3ZoomInstance.wheelDelta(wheelDelta);
|
|
12025
|
-
async function setTransform(transform2,
|
|
11848
|
+
async function setTransform(transform2, options2) {
|
|
12026
11849
|
if (d3Selection) {
|
|
12027
11850
|
return new Promise((resolve) => {
|
|
12028
|
-
d3ZoomInstance
|
|
11851
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).transform(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), transform2);
|
|
12029
11852
|
});
|
|
12030
11853
|
}
|
|
12031
11854
|
return false;
|
|
@@ -12099,19 +11922,19 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
12099
11922
|
}
|
|
12100
11923
|
function destroy() {
|
|
12101
11924
|
d3ZoomInstance.on("zoom", null);
|
|
12102
|
-
extentResizeObserver
|
|
11925
|
+
extentResizeObserver?.disconnect();
|
|
12103
11926
|
}
|
|
12104
11927
|
async function setViewportConstrained(viewport2, extent, translateExtent2) {
|
|
12105
11928
|
const nextTransform = viewportToTransform(viewport2);
|
|
12106
|
-
const contrainedTransform = d3ZoomInstance
|
|
11929
|
+
const contrainedTransform = d3ZoomInstance?.constrain()(nextTransform, extent, translateExtent2);
|
|
12107
11930
|
if (contrainedTransform) {
|
|
12108
11931
|
await setTransform(contrainedTransform);
|
|
12109
11932
|
}
|
|
12110
11933
|
return contrainedTransform;
|
|
12111
11934
|
}
|
|
12112
|
-
async function setViewport(viewport2,
|
|
11935
|
+
async function setViewport(viewport2, options2) {
|
|
12113
11936
|
const nextTransform = viewportToTransform(viewport2);
|
|
12114
|
-
await setTransform(nextTransform,
|
|
11937
|
+
await setTransform(nextTransform, options2);
|
|
12115
11938
|
return nextTransform;
|
|
12116
11939
|
}
|
|
12117
11940
|
function syncViewport(viewport2) {
|
|
@@ -12119,7 +11942,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
12119
11942
|
const nextTransform = viewportToTransform(viewport2);
|
|
12120
11943
|
const currentTransform = d3Selection.property("__zoom");
|
|
12121
11944
|
if (currentTransform.k !== viewport2.zoom || currentTransform.x !== viewport2.x || currentTransform.y !== viewport2.y) {
|
|
12122
|
-
d3ZoomInstance
|
|
11945
|
+
d3ZoomInstance?.transform(d3Selection, nextTransform, null, { sync: true });
|
|
12123
11946
|
}
|
|
12124
11947
|
}
|
|
12125
11948
|
}
|
|
@@ -12127,31 +11950,31 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
12127
11950
|
const transform$1 = d3Selection ? transform(d3Selection.node()) : { x: 0, y: 0, k: 1 };
|
|
12128
11951
|
return { x: transform$1.x, y: transform$1.y, zoom: transform$1.k };
|
|
12129
11952
|
}
|
|
12130
|
-
async function scaleTo(zoom2,
|
|
11953
|
+
async function scaleTo(zoom2, options2) {
|
|
12131
11954
|
if (d3Selection) {
|
|
12132
11955
|
return new Promise((resolve) => {
|
|
12133
|
-
d3ZoomInstance
|
|
11956
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleTo(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), zoom2);
|
|
12134
11957
|
});
|
|
12135
11958
|
}
|
|
12136
11959
|
return false;
|
|
12137
11960
|
}
|
|
12138
|
-
async function scaleBy(factor,
|
|
11961
|
+
async function scaleBy(factor, options2) {
|
|
12139
11962
|
if (d3Selection) {
|
|
12140
11963
|
return new Promise((resolve) => {
|
|
12141
|
-
d3ZoomInstance
|
|
11964
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleBy(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), factor);
|
|
12142
11965
|
});
|
|
12143
11966
|
}
|
|
12144
11967
|
return false;
|
|
12145
11968
|
}
|
|
12146
11969
|
function setScaleExtent(scaleExtent) {
|
|
12147
|
-
d3ZoomInstance
|
|
11970
|
+
d3ZoomInstance?.scaleExtent(scaleExtent);
|
|
12148
11971
|
}
|
|
12149
11972
|
function setTranslateExtent(translateExtent2) {
|
|
12150
|
-
d3ZoomInstance
|
|
11973
|
+
d3ZoomInstance?.translateExtent(translateExtent2);
|
|
12151
11974
|
}
|
|
12152
11975
|
function setClickDistance(distance2) {
|
|
12153
11976
|
const validDistance = !isNumeric(distance2) || distance2 < 0 ? 0 : distance2;
|
|
12154
|
-
d3ZoomInstance
|
|
11977
|
+
d3ZoomInstance?.clickDistance(validDistance);
|
|
12155
11978
|
}
|
|
12156
11979
|
return {
|
|
12157
11980
|
update,
|
|
@@ -12382,7 +12205,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
12382
12205
|
if (!node) {
|
|
12383
12206
|
return;
|
|
12384
12207
|
}
|
|
12385
|
-
containerBounds =
|
|
12208
|
+
containerBounds = paneDomNode?.getBoundingClientRect() ?? null;
|
|
12386
12209
|
const { xSnapped, ySnapped } = getPointerPosition(event.sourceEvent, {
|
|
12387
12210
|
transform: transform2,
|
|
12388
12211
|
snapGrid,
|
|
@@ -12434,7 +12257,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
12434
12257
|
}
|
|
12435
12258
|
}
|
|
12436
12259
|
}
|
|
12437
|
-
onResizeStart
|
|
12260
|
+
onResizeStart?.(event, { ...prevValues });
|
|
12438
12261
|
}).on("drag", (event) => {
|
|
12439
12262
|
const { transform: transform2, snapGrid, snapToGrid, nodeOrigin: storeNodeOrigin } = getStoreItems();
|
|
12440
12263
|
const pointerPosition = getPointerPosition(event.sourceEvent, {
|
|
@@ -12511,7 +12334,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
12511
12334
|
affectsY: params.controlDirection.affectsY
|
|
12512
12335
|
});
|
|
12513
12336
|
const nextValues = { ...prevValues, direction };
|
|
12514
|
-
const callResize = shouldResize
|
|
12337
|
+
const callResize = shouldResize?.(event, nextValues);
|
|
12515
12338
|
if (callResize === false) {
|
|
12516
12339
|
prevValues = lastValid.prevValues;
|
|
12517
12340
|
startValues.x = lastValid.startX;
|
|
@@ -12521,11 +12344,11 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
12521
12344
|
});
|
|
12522
12345
|
return;
|
|
12523
12346
|
}
|
|
12524
|
-
onResize
|
|
12347
|
+
onResize?.(event, nextValues);
|
|
12525
12348
|
onChange(change, childChanges);
|
|
12526
12349
|
}).on("end", (event) => {
|
|
12527
|
-
onResizeEnd
|
|
12528
|
-
onEnd
|
|
12350
|
+
onResizeEnd?.(event, { ...prevValues });
|
|
12351
|
+
onEnd?.({ ...prevValues });
|
|
12529
12352
|
});
|
|
12530
12353
|
selection2.call(dragHandler);
|
|
12531
12354
|
}
|
|
@@ -12539,15 +12362,6 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
12539
12362
|
}
|
|
12540
12363
|
var withSelector = { exports: {} };
|
|
12541
12364
|
var withSelector_production = {};
|
|
12542
|
-
/**
|
|
12543
|
-
* @license React
|
|
12544
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
12545
|
-
*
|
|
12546
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12547
|
-
*
|
|
12548
|
-
* This source code is licensed under the MIT license found in the
|
|
12549
|
-
* LICENSE file in the root directory of this source tree.
|
|
12550
|
-
*/
|
|
12551
12365
|
var hasRequiredWithSelector_production;
|
|
12552
12366
|
function requireWithSelector_production() {
|
|
12553
12367
|
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
@@ -12767,7 +12581,7 @@ function Attribution({ proOptions, position = "bottom-right" }) {
|
|
|
12767
12581
|
return;
|
|
12768
12582
|
}
|
|
12769
12583
|
}, []);
|
|
12770
|
-
if (proOptions
|
|
12584
|
+
if (proOptions?.hideAttribution) {
|
|
12771
12585
|
return null;
|
|
12772
12586
|
}
|
|
12773
12587
|
return jsxRuntimeExports.jsx(Panel, { position, className: "react-flow__attribution", "data-message": `Please only hide this attribution when you are subscribed to React Flow Pro: ${link}`, children: jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", "aria-label": "React Flow attribution", children: "React Flow" }) });
|
|
@@ -12796,7 +12610,7 @@ function SelectionListenerInner({ onSelectionChange }) {
|
|
|
12796
12610
|
const { selectedNodes, selectedEdges } = useStore(selector$l, areEqual$1);
|
|
12797
12611
|
reactExports.useEffect(() => {
|
|
12798
12612
|
const params = { nodes: selectedNodes, edges: selectedEdges };
|
|
12799
|
-
onSelectionChange
|
|
12613
|
+
onSelectionChange?.(params);
|
|
12800
12614
|
store.getState().onSelectionChangeHandlers.forEach((fn) => fn(params));
|
|
12801
12615
|
}, [selectedNodes, selectedEdges, onSelectionChange]);
|
|
12802
12616
|
return null;
|
|
@@ -12951,7 +12765,6 @@ function getMediaQuery() {
|
|
|
12951
12765
|
return window.matchMedia("(prefers-color-scheme: dark)");
|
|
12952
12766
|
}
|
|
12953
12767
|
function useColorModeClass(colorMode) {
|
|
12954
|
-
var _a2;
|
|
12955
12768
|
const [colorModeClass, setColorModeClass] = reactExports.useState(colorMode === "system" ? null : colorMode);
|
|
12956
12769
|
reactExports.useEffect(() => {
|
|
12957
12770
|
if (colorMode !== "system") {
|
|
@@ -12959,17 +12772,17 @@ function useColorModeClass(colorMode) {
|
|
|
12959
12772
|
return;
|
|
12960
12773
|
}
|
|
12961
12774
|
const mediaQuery = getMediaQuery();
|
|
12962
|
-
const updateColorModeClass = () => setColorModeClass(
|
|
12775
|
+
const updateColorModeClass = () => setColorModeClass(mediaQuery?.matches ? "dark" : "light");
|
|
12963
12776
|
updateColorModeClass();
|
|
12964
|
-
mediaQuery
|
|
12777
|
+
mediaQuery?.addEventListener("change", updateColorModeClass);
|
|
12965
12778
|
return () => {
|
|
12966
|
-
mediaQuery
|
|
12779
|
+
mediaQuery?.removeEventListener("change", updateColorModeClass);
|
|
12967
12780
|
};
|
|
12968
12781
|
}, [colorMode]);
|
|
12969
|
-
return colorModeClass !== null ? colorModeClass :
|
|
12782
|
+
return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? "dark" : "light";
|
|
12970
12783
|
}
|
|
12971
12784
|
const defaultDoc = typeof document !== "undefined" ? document : null;
|
|
12972
|
-
function useKeyPress(keyCode = null,
|
|
12785
|
+
function useKeyPress(keyCode = null, options2 = { target: defaultDoc, actInsideInputWithModifier: true }) {
|
|
12973
12786
|
const [keyPressed, setKeyPressed] = reactExports.useState(false);
|
|
12974
12787
|
const modifierPressed = reactExports.useRef(false);
|
|
12975
12788
|
const pressedKeys = reactExports.useRef(/* @__PURE__ */ new Set([]));
|
|
@@ -12983,11 +12796,10 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
12983
12796
|
return [[], []];
|
|
12984
12797
|
}, [keyCode]);
|
|
12985
12798
|
reactExports.useEffect(() => {
|
|
12986
|
-
const target =
|
|
12987
|
-
const actInsideInputWithModifier =
|
|
12799
|
+
const target = options2?.target ?? defaultDoc;
|
|
12800
|
+
const actInsideInputWithModifier = options2?.actInsideInputWithModifier ?? true;
|
|
12988
12801
|
if (keyCode !== null) {
|
|
12989
12802
|
const downHandler = (event) => {
|
|
12990
|
-
var _a2, _b;
|
|
12991
12803
|
modifierPressed.current = event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;
|
|
12992
12804
|
const preventAction = (!modifierPressed.current || modifierPressed.current && !actInsideInputWithModifier) && isInputDOMNode(event);
|
|
12993
12805
|
if (preventAction) {
|
|
@@ -12996,9 +12808,9 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
12996
12808
|
const keyOrCode = useKeyOrCode(event.code, keysToWatch);
|
|
12997
12809
|
pressedKeys.current.add(event[keyOrCode]);
|
|
12998
12810
|
if (isMatchingKey(keyCodes, pressedKeys.current, false)) {
|
|
12999
|
-
const target2 =
|
|
13000
|
-
const isInteractiveElement =
|
|
13001
|
-
if (
|
|
12811
|
+
const target2 = event.composedPath?.()?.[0] || event.target;
|
|
12812
|
+
const isInteractiveElement = target2?.nodeName === "BUTTON" || target2?.nodeName === "A";
|
|
12813
|
+
if (options2.preventDefault !== false && (modifierPressed.current || !isInteractiveElement)) {
|
|
13002
12814
|
event.preventDefault();
|
|
13003
12815
|
}
|
|
13004
12816
|
setKeyPressed(true);
|
|
@@ -13021,13 +12833,13 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
13021
12833
|
pressedKeys.current.clear();
|
|
13022
12834
|
setKeyPressed(false);
|
|
13023
12835
|
};
|
|
13024
|
-
target
|
|
13025
|
-
target
|
|
12836
|
+
target?.addEventListener("keydown", downHandler);
|
|
12837
|
+
target?.addEventListener("keyup", upHandler);
|
|
13026
12838
|
window.addEventListener("blur", resetHandler);
|
|
13027
12839
|
window.addEventListener("contextmenu", resetHandler);
|
|
13028
12840
|
return () => {
|
|
13029
|
-
target
|
|
13030
|
-
target
|
|
12841
|
+
target?.removeEventListener("keydown", downHandler);
|
|
12842
|
+
target?.removeEventListener("keyup", upHandler);
|
|
13031
12843
|
window.removeEventListener("blur", resetHandler);
|
|
13032
12844
|
window.removeEventListener("contextmenu", resetHandler);
|
|
13033
12845
|
};
|
|
@@ -13045,20 +12857,20 @@ const useViewportHelper = () => {
|
|
|
13045
12857
|
const store = useStoreApi();
|
|
13046
12858
|
return reactExports.useMemo(() => {
|
|
13047
12859
|
return {
|
|
13048
|
-
zoomIn: async (
|
|
12860
|
+
zoomIn: async (options2) => {
|
|
13049
12861
|
const { panZoom } = store.getState();
|
|
13050
|
-
return panZoom ? panZoom.scaleBy(1.2,
|
|
12862
|
+
return panZoom ? panZoom.scaleBy(1.2, options2) : false;
|
|
13051
12863
|
},
|
|
13052
|
-
zoomOut: async (
|
|
12864
|
+
zoomOut: async (options2) => {
|
|
13053
12865
|
const { panZoom } = store.getState();
|
|
13054
|
-
return panZoom ? panZoom.scaleBy(1 / 1.2,
|
|
12866
|
+
return panZoom ? panZoom.scaleBy(1 / 1.2, options2) : false;
|
|
13055
12867
|
},
|
|
13056
|
-
zoomTo: async (zoomLevel,
|
|
12868
|
+
zoomTo: async (zoomLevel, options2) => {
|
|
13057
12869
|
const { panZoom } = store.getState();
|
|
13058
|
-
return panZoom ? panZoom.scaleTo(zoomLevel,
|
|
12870
|
+
return panZoom ? panZoom.scaleTo(zoomLevel, options2) : false;
|
|
13059
12871
|
},
|
|
13060
12872
|
getZoom: () => store.getState().transform[2],
|
|
13061
|
-
setViewport: async (viewport,
|
|
12873
|
+
setViewport: async (viewport, options2) => {
|
|
13062
12874
|
const { transform: [tX, tY, tZoom], panZoom } = store.getState();
|
|
13063
12875
|
if (!panZoom) {
|
|
13064
12876
|
return false;
|
|
@@ -13067,30 +12879,30 @@ const useViewportHelper = () => {
|
|
|
13067
12879
|
x: viewport.x ?? tX,
|
|
13068
12880
|
y: viewport.y ?? tY,
|
|
13069
12881
|
zoom: viewport.zoom ?? tZoom
|
|
13070
|
-
},
|
|
12882
|
+
}, options2);
|
|
13071
12883
|
return true;
|
|
13072
12884
|
},
|
|
13073
12885
|
getViewport: () => {
|
|
13074
12886
|
const [x, y, zoom2] = store.getState().transform;
|
|
13075
12887
|
return { x, y, zoom: zoom2 };
|
|
13076
12888
|
},
|
|
13077
|
-
setCenter: async (x, y,
|
|
13078
|
-
return store.getState().setCenter(x, y,
|
|
12889
|
+
setCenter: async (x, y, options2) => {
|
|
12890
|
+
return store.getState().setCenter(x, y, options2);
|
|
13079
12891
|
},
|
|
13080
|
-
fitBounds: async (bounds,
|
|
12892
|
+
fitBounds: async (bounds, options2) => {
|
|
13081
12893
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
13082
|
-
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom,
|
|
12894
|
+
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options2?.padding ?? 0.1);
|
|
13083
12895
|
if (!panZoom) {
|
|
13084
12896
|
return false;
|
|
13085
12897
|
}
|
|
13086
12898
|
await panZoom.setViewport(viewport, {
|
|
13087
|
-
duration:
|
|
13088
|
-
ease:
|
|
13089
|
-
interpolate:
|
|
12899
|
+
duration: options2?.duration,
|
|
12900
|
+
ease: options2?.ease,
|
|
12901
|
+
interpolate: options2?.interpolate
|
|
13090
12902
|
});
|
|
13091
12903
|
return true;
|
|
13092
12904
|
},
|
|
13093
|
-
screenToFlowPosition: (clientPosition,
|
|
12905
|
+
screenToFlowPosition: (clientPosition, options2 = {}) => {
|
|
13094
12906
|
const { transform: transform2, snapGrid, snapToGrid, domNode } = store.getState();
|
|
13095
12907
|
if (!domNode) {
|
|
13096
12908
|
return clientPosition;
|
|
@@ -13100,8 +12912,8 @@ const useViewportHelper = () => {
|
|
|
13100
12912
|
x: clientPosition.x - domX,
|
|
13101
12913
|
y: clientPosition.y - domY
|
|
13102
12914
|
};
|
|
13103
|
-
const _snapGrid =
|
|
13104
|
-
const _snapToGrid =
|
|
12915
|
+
const _snapGrid = options2.snapGrid ?? snapGrid;
|
|
12916
|
+
const _snapToGrid = options2.snapToGrid ?? snapToGrid;
|
|
13105
12917
|
return pointToRendererPoint(correctedPosition, transform2, _snapToGrid, _snapGrid);
|
|
13106
12918
|
},
|
|
13107
12919
|
flowToScreenPosition: (flowPosition) => {
|
|
@@ -13228,12 +13040,11 @@ function getSelectionChanges(items, selectedIds = /* @__PURE__ */ new Set()) {
|
|
|
13228
13040
|
return changes;
|
|
13229
13041
|
}
|
|
13230
13042
|
function getElementsDiffChanges({ items = [], lookup }) {
|
|
13231
|
-
var _a2;
|
|
13232
13043
|
const changes = [];
|
|
13233
13044
|
const itemsLookup = new Map(items.map((item) => [item.id, item]));
|
|
13234
13045
|
for (const [index2, item] of items.entries()) {
|
|
13235
13046
|
const lookupItem = lookup.get(item.id);
|
|
13236
|
-
const storeItem =
|
|
13047
|
+
const storeItem = lookupItem?.internals?.userNode ?? lookupItem;
|
|
13237
13048
|
if (storeItem !== void 0 && storeItem !== item) {
|
|
13238
13049
|
changes.push({ id: item.id, item, type: "replace" });
|
|
13239
13050
|
}
|
|
@@ -13256,10 +13067,10 @@ function elementToRemoveChange(item) {
|
|
|
13256
13067
|
};
|
|
13257
13068
|
}
|
|
13258
13069
|
const defaultOnError = createDevWarn();
|
|
13259
|
-
function addEdge(edgeParams, edges,
|
|
13070
|
+
function addEdge(edgeParams, edges, options2 = {}) {
|
|
13260
13071
|
return addEdge$1(edgeParams, edges, {
|
|
13261
|
-
...
|
|
13262
|
-
onError:
|
|
13072
|
+
...options2,
|
|
13073
|
+
onError: options2.onError ?? defaultOnError
|
|
13263
13074
|
});
|
|
13264
13075
|
}
|
|
13265
13076
|
const isNode = (element) => isNodeBase(element);
|
|
@@ -13313,7 +13124,7 @@ function BatchProvider({ children: children2 }) {
|
|
|
13313
13124
|
setNodes(next);
|
|
13314
13125
|
}
|
|
13315
13126
|
if (changes.length > 0) {
|
|
13316
|
-
onNodesChange
|
|
13127
|
+
onNodesChange?.(changes);
|
|
13317
13128
|
} else if (fitViewQueued) {
|
|
13318
13129
|
window.requestAnimationFrame(() => {
|
|
13319
13130
|
const { fitViewQueued: fitViewQueued2, nodes: nodes2, setNodes: setNodes2 } = store.getState();
|
|
@@ -13365,42 +13176,38 @@ function useReactFlow() {
|
|
|
13365
13176
|
batchContext.edgeQueue.push(payload);
|
|
13366
13177
|
};
|
|
13367
13178
|
const getNodeRect = (node) => {
|
|
13368
|
-
var _a2, _b;
|
|
13369
13179
|
const { nodeLookup, nodeOrigin } = store.getState();
|
|
13370
13180
|
const nodeToUse = isNode(node) ? node : nodeLookup.get(node.id);
|
|
13371
13181
|
const position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, nodeLookup, nodeOrigin) : nodeToUse.position;
|
|
13372
13182
|
const nodeWithPosition = {
|
|
13373
13183
|
...nodeToUse,
|
|
13374
13184
|
position,
|
|
13375
|
-
width:
|
|
13376
|
-
height:
|
|
13185
|
+
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
|
13186
|
+
height: nodeToUse.measured?.height ?? nodeToUse.height
|
|
13377
13187
|
};
|
|
13378
13188
|
return nodeToRect(nodeWithPosition, nodeToUse.parentId ? void 0 : nodeOrigin);
|
|
13379
13189
|
};
|
|
13380
|
-
const updateNode = (id2, nodeUpdate,
|
|
13190
|
+
const updateNode = (id2, nodeUpdate, options2 = { replace: false }) => {
|
|
13381
13191
|
setNodes((prevNodes) => prevNodes.map((node) => {
|
|
13382
13192
|
if (node.id === id2) {
|
|
13383
13193
|
const nextNode = typeof nodeUpdate === "function" ? nodeUpdate(node) : nodeUpdate;
|
|
13384
|
-
return
|
|
13194
|
+
return options2.replace && isNode(nextNode) ? nextNode : { ...node, ...nextNode };
|
|
13385
13195
|
}
|
|
13386
13196
|
return node;
|
|
13387
13197
|
}));
|
|
13388
13198
|
};
|
|
13389
|
-
const updateEdge = (id2, edgeUpdate,
|
|
13199
|
+
const updateEdge = (id2, edgeUpdate, options2 = { replace: false }) => {
|
|
13390
13200
|
setEdges((prevEdges) => prevEdges.map((edge) => {
|
|
13391
13201
|
if (edge.id === id2) {
|
|
13392
13202
|
const nextEdge = typeof edgeUpdate === "function" ? edgeUpdate(edge) : edgeUpdate;
|
|
13393
|
-
return
|
|
13203
|
+
return options2.replace && isEdge(nextEdge) ? nextEdge : { ...edge, ...nextEdge };
|
|
13394
13204
|
}
|
|
13395
13205
|
return edge;
|
|
13396
13206
|
}));
|
|
13397
13207
|
};
|
|
13398
13208
|
return {
|
|
13399
13209
|
getNodes: () => store.getState().nodes.map((n) => ({ ...n })),
|
|
13400
|
-
getNode: (id2) =>
|
|
13401
|
-
var _a2;
|
|
13402
|
-
return (_a2 = getInternalNode(id2)) == null ? void 0 : _a2.internals.userNode;
|
|
13403
|
-
},
|
|
13210
|
+
getNode: (id2) => getInternalNode(id2)?.internals.userNode,
|
|
13404
13211
|
getInternalNode,
|
|
13405
13212
|
getEdges: () => {
|
|
13406
13213
|
const { edges = [] } = store.getState();
|
|
@@ -13443,16 +13250,16 @@ function useReactFlow() {
|
|
|
13443
13250
|
const hasMatchingNodes = matchingNodes.length > 0;
|
|
13444
13251
|
if (hasMatchingEdges) {
|
|
13445
13252
|
const edgeChanges = matchingEdges.map(elementToRemoveChange);
|
|
13446
|
-
onEdgesDelete
|
|
13253
|
+
onEdgesDelete?.(matchingEdges);
|
|
13447
13254
|
triggerEdgeChanges(edgeChanges);
|
|
13448
13255
|
}
|
|
13449
13256
|
if (hasMatchingNodes) {
|
|
13450
13257
|
const nodeChanges = matchingNodes.map(elementToRemoveChange);
|
|
13451
|
-
onNodesDelete
|
|
13258
|
+
onNodesDelete?.(matchingNodes);
|
|
13452
13259
|
triggerNodeChanges(nodeChanges);
|
|
13453
13260
|
}
|
|
13454
13261
|
if (hasMatchingNodes || hasMatchingEdges) {
|
|
13455
|
-
onDelete
|
|
13262
|
+
onDelete?.({ nodes: matchingNodes, edges: matchingEdges });
|
|
13456
13263
|
}
|
|
13457
13264
|
return { deletedNodes: matchingNodes, deletedEdges: matchingEdges };
|
|
13458
13265
|
},
|
|
@@ -13491,34 +13298,28 @@ function useReactFlow() {
|
|
|
13491
13298
|
return partiallyVisible || overlappingArea >= area.width * area.height || overlappingArea >= nodeRect.width * nodeRect.height;
|
|
13492
13299
|
},
|
|
13493
13300
|
updateNode,
|
|
13494
|
-
updateNodeData: (id2, dataUpdate,
|
|
13301
|
+
updateNodeData: (id2, dataUpdate, options2 = { replace: false }) => {
|
|
13495
13302
|
updateNode(id2, (node) => {
|
|
13496
13303
|
const nextData = typeof dataUpdate === "function" ? dataUpdate(node) : dataUpdate;
|
|
13497
|
-
return
|
|
13498
|
-
},
|
|
13304
|
+
return options2.replace ? { ...node, data: nextData } : { ...node, data: { ...node.data, ...nextData } };
|
|
13305
|
+
}, options2);
|
|
13499
13306
|
},
|
|
13500
13307
|
updateEdge,
|
|
13501
|
-
updateEdgeData: (id2, dataUpdate,
|
|
13308
|
+
updateEdgeData: (id2, dataUpdate, options2 = { replace: false }) => {
|
|
13502
13309
|
updateEdge(id2, (edge) => {
|
|
13503
13310
|
const nextData = typeof dataUpdate === "function" ? dataUpdate(edge) : dataUpdate;
|
|
13504
|
-
return
|
|
13505
|
-
},
|
|
13311
|
+
return options2.replace ? { ...edge, data: nextData } : { ...edge, data: { ...edge.data, ...nextData } };
|
|
13312
|
+
}, options2);
|
|
13506
13313
|
},
|
|
13507
13314
|
getNodesBounds: (nodes) => {
|
|
13508
13315
|
const { nodeLookup, nodeOrigin } = store.getState();
|
|
13509
13316
|
return getNodesBounds(nodes, { nodeLookup, nodeOrigin });
|
|
13510
13317
|
},
|
|
13511
|
-
getHandleConnections: ({ type, id: id2, nodeId }) => {
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
},
|
|
13515
|
-
getNodeConnections: ({ type, handleId, nodeId }) => {
|
|
13516
|
-
var _a2;
|
|
13517
|
-
return Array.from(((_a2 = store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)) == null ? void 0 : _a2.values()) ?? []);
|
|
13518
|
-
},
|
|
13519
|
-
fitView: async (options) => {
|
|
13318
|
+
getHandleConnections: ({ type, id: id2, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}-${type}${id2 ? `-${id2}` : ""}`)?.values() ?? []),
|
|
13319
|
+
getNodeConnections: ({ type, handleId, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)?.values() ?? []),
|
|
13320
|
+
fitView: async (options2) => {
|
|
13520
13321
|
const fitViewResolver = store.getState().fitViewResolver ?? withResolvers();
|
|
13521
|
-
store.setState({ fitViewQueued: true, fitViewOptions:
|
|
13322
|
+
store.setState({ fitViewQueued: true, fitViewOptions: options2, fitViewResolver });
|
|
13522
13323
|
batchContext.nodeQueue.push((nodes) => [...nodes]);
|
|
13523
13324
|
return fitViewResolver.promise;
|
|
13524
13325
|
}
|
|
@@ -13554,13 +13355,12 @@ function useResizeHandler(domNode) {
|
|
|
13554
13355
|
const store = useStoreApi();
|
|
13555
13356
|
reactExports.useEffect(() => {
|
|
13556
13357
|
const updateDimensions = () => {
|
|
13557
|
-
|
|
13558
|
-
if (!domNode.current || !(((_b = (_a2 = domNode.current).checkVisibility) == null ? void 0 : _b.call(_a2)) ?? true)) {
|
|
13358
|
+
if (!domNode.current || !(domNode.current.checkVisibility?.() ?? true)) {
|
|
13559
13359
|
return false;
|
|
13560
13360
|
}
|
|
13561
13361
|
const size = getDimensions(domNode.current);
|
|
13562
13362
|
if (size.height === 0 || size.width === 0) {
|
|
13563
|
-
|
|
13363
|
+
store.getState().onError?.("004", errorMessages["error004"]());
|
|
13564
13364
|
}
|
|
13565
13365
|
store.setState({ width: size.width || 500, height: size.height || 500 });
|
|
13566
13366
|
};
|
|
@@ -13596,7 +13396,7 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13596
13396
|
const panZoom = reactExports.useRef();
|
|
13597
13397
|
useResizeHandler(zoomPane);
|
|
13598
13398
|
const onTransformChange = reactExports.useCallback((transform2) => {
|
|
13599
|
-
onViewportChange
|
|
13399
|
+
onViewportChange?.({ x: transform2[0], y: transform2[1], zoom: transform2[2] });
|
|
13600
13400
|
if (!isControlledViewport) {
|
|
13601
13401
|
store.setState({ transform: transform2 });
|
|
13602
13402
|
}
|
|
@@ -13612,18 +13412,18 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13612
13412
|
onDraggingChange: (paneDragging) => store.setState((prevState) => prevState.paneDragging === paneDragging ? prevState : { paneDragging }),
|
|
13613
13413
|
onPanZoomStart: (event, vp) => {
|
|
13614
13414
|
const { onViewportChangeStart, onMoveStart } = store.getState();
|
|
13615
|
-
onMoveStart
|
|
13616
|
-
onViewportChangeStart
|
|
13415
|
+
onMoveStart?.(event, vp);
|
|
13416
|
+
onViewportChangeStart?.(vp);
|
|
13617
13417
|
},
|
|
13618
13418
|
onPanZoom: (event, vp) => {
|
|
13619
13419
|
const { onViewportChange: onViewportChange2, onMove } = store.getState();
|
|
13620
|
-
onMove
|
|
13621
|
-
onViewportChange2
|
|
13420
|
+
onMove?.(event, vp);
|
|
13421
|
+
onViewportChange2?.(vp);
|
|
13622
13422
|
},
|
|
13623
13423
|
onPanZoomEnd: (event, vp) => {
|
|
13624
13424
|
const { onViewportChangeEnd, onMoveEnd } = store.getState();
|
|
13625
|
-
onMoveEnd
|
|
13626
|
-
onViewportChangeEnd
|
|
13425
|
+
onMoveEnd?.(event, vp);
|
|
13426
|
+
onViewportChangeEnd?.(vp);
|
|
13627
13427
|
}
|
|
13628
13428
|
});
|
|
13629
13429
|
const { x, y, zoom: zoom2 } = panZoom.current.getViewport();
|
|
@@ -13633,14 +13433,12 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13633
13433
|
domNode: zoomPane.current.closest(".react-flow")
|
|
13634
13434
|
});
|
|
13635
13435
|
return () => {
|
|
13636
|
-
|
|
13637
|
-
(_a2 = panZoom.current) == null ? void 0 : _a2.destroy();
|
|
13436
|
+
panZoom.current?.destroy();
|
|
13638
13437
|
};
|
|
13639
13438
|
}
|
|
13640
13439
|
}, []);
|
|
13641
13440
|
reactExports.useEffect(() => {
|
|
13642
|
-
|
|
13643
|
-
(_a2 = panZoom.current) == null ? void 0 : _a2.update({
|
|
13441
|
+
panZoom.current?.update({
|
|
13644
13442
|
onPaneContextMenu,
|
|
13645
13443
|
zoomOnScroll,
|
|
13646
13444
|
zoomOnPinch,
|
|
@@ -13705,7 +13503,7 @@ const wrapHandler = (handler, containerRef) => {
|
|
|
13705
13503
|
if (event.target !== containerRef.current) {
|
|
13706
13504
|
return;
|
|
13707
13505
|
}
|
|
13708
|
-
handler
|
|
13506
|
+
handler?.(event);
|
|
13709
13507
|
};
|
|
13710
13508
|
};
|
|
13711
13509
|
const selector$g = (s) => ({
|
|
@@ -13739,19 +13537,19 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13739
13537
|
const connectionClone = structuredClone(connection);
|
|
13740
13538
|
delete connectionClone.inProgress;
|
|
13741
13539
|
connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
|
|
13742
|
-
onClickConnectEnd
|
|
13540
|
+
onClickConnectEnd?.(event.nativeEvent, connectionClone);
|
|
13743
13541
|
store.setState({ connectionClickStartHandle: null });
|
|
13744
13542
|
}
|
|
13745
|
-
onPaneClick
|
|
13543
|
+
onPaneClick?.(event);
|
|
13746
13544
|
resetSelectedElements();
|
|
13747
13545
|
store.setState({ nodesSelectionActive: false });
|
|
13748
13546
|
};
|
|
13749
13547
|
const onContextMenu = (event) => {
|
|
13750
|
-
if (Array.isArray(panOnDrag) &&
|
|
13548
|
+
if (Array.isArray(panOnDrag) && panOnDrag?.includes(2)) {
|
|
13751
13549
|
event.preventDefault();
|
|
13752
13550
|
return;
|
|
13753
13551
|
}
|
|
13754
|
-
onPaneContextMenu
|
|
13552
|
+
onPaneContextMenu?.(event);
|
|
13755
13553
|
};
|
|
13756
13554
|
const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : void 0;
|
|
13757
13555
|
const onClickCapture = (event) => {
|
|
@@ -13761,12 +13559,11 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13761
13559
|
}
|
|
13762
13560
|
};
|
|
13763
13561
|
const onPointerDownCapture = (event) => {
|
|
13764
|
-
var _a2, _b;
|
|
13765
13562
|
if (event.pointerType === "touch" && panOnDrag !== false && !selectionKeyPressed) {
|
|
13766
13563
|
return;
|
|
13767
13564
|
}
|
|
13768
13565
|
const { domNode, transform: transform2 } = store.getState();
|
|
13769
|
-
containerBounds.current = domNode
|
|
13566
|
+
containerBounds.current = domNode?.getBoundingClientRect();
|
|
13770
13567
|
if (!containerBounds.current)
|
|
13771
13568
|
return;
|
|
13772
13569
|
const eventTargetIsContainer = event.target === container.current;
|
|
@@ -13775,7 +13572,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13775
13572
|
if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
|
|
13776
13573
|
return;
|
|
13777
13574
|
}
|
|
13778
|
-
|
|
13575
|
+
event.target?.setPointerCapture?.(event.pointerId);
|
|
13779
13576
|
selectionInProgress.current = false;
|
|
13780
13577
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
13781
13578
|
const userSelectionStartPosition = pointToRendererPoint({ x, y }, transform2);
|
|
@@ -13814,7 +13611,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13814
13611
|
const prevSelectedEdgeIds = selectedEdgeIds.current;
|
|
13815
13612
|
selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode.Partial, true).map((node) => node.id));
|
|
13816
13613
|
selectedEdgeIds.current = /* @__PURE__ */ new Set();
|
|
13817
|
-
const edgesSelectable =
|
|
13614
|
+
const edgesSelectable = defaultEdgeOptions?.selectable ?? true;
|
|
13818
13615
|
for (const nodeId of selectedNodeIds.current) {
|
|
13819
13616
|
const connections = connectionLookup.get(nodeId);
|
|
13820
13617
|
if (!connections)
|
|
@@ -13878,7 +13675,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13878
13675
|
return;
|
|
13879
13676
|
}
|
|
13880
13677
|
resetSelectedElements();
|
|
13881
|
-
onSelectionStart
|
|
13678
|
+
onSelectionStart?.(event);
|
|
13882
13679
|
}
|
|
13883
13680
|
selectionInProgress.current = true;
|
|
13884
13681
|
if (!autoPanStarted.current) {
|
|
@@ -13888,7 +13685,6 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13888
13685
|
commitUserSelectionRect(mouseX, mouseY);
|
|
13889
13686
|
};
|
|
13890
13687
|
const onPointerUp = (event) => {
|
|
13891
|
-
var _a2, _b;
|
|
13892
13688
|
if (!isSelectionEnabled) {
|
|
13893
13689
|
if (event.target === container.current && store.getState().connection.inProgress) {
|
|
13894
13690
|
connectionEndedOnPane.current = true;
|
|
@@ -13898,16 +13694,16 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13898
13694
|
if (event.button !== 0) {
|
|
13899
13695
|
return;
|
|
13900
13696
|
}
|
|
13901
|
-
|
|
13697
|
+
event.target?.releasePointerCapture?.(event.pointerId);
|
|
13902
13698
|
if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
|
|
13903
|
-
onClick
|
|
13699
|
+
onClick?.(event);
|
|
13904
13700
|
}
|
|
13905
13701
|
store.setState({
|
|
13906
13702
|
userSelectionActive: false,
|
|
13907
13703
|
userSelectionRect: null
|
|
13908
13704
|
});
|
|
13909
13705
|
if (selectionInProgress.current) {
|
|
13910
|
-
onSelectionEnd
|
|
13706
|
+
onSelectionEnd?.(event);
|
|
13911
13707
|
store.setState({
|
|
13912
13708
|
nodesSelectionActive: selectedNodeIds.current.size > 0
|
|
13913
13709
|
});
|
|
@@ -13915,8 +13711,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13915
13711
|
cleanupAutoPan();
|
|
13916
13712
|
};
|
|
13917
13713
|
const onPointerCancel = (event) => {
|
|
13918
|
-
|
|
13919
|
-
(_b = (_a2 = event.target) == null ? void 0 : _a2.releasePointerCapture) == null ? void 0 : _b.call(_a2, event.pointerId);
|
|
13714
|
+
event.target?.releasePointerCapture?.(event.pointerId);
|
|
13920
13715
|
cleanupAutoPan();
|
|
13921
13716
|
};
|
|
13922
13717
|
const draggable = panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0);
|
|
@@ -13926,7 +13721,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
|
13926
13721
|
const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
|
|
13927
13722
|
const node = nodeLookup.get(id2);
|
|
13928
13723
|
if (!node) {
|
|
13929
|
-
onError
|
|
13724
|
+
onError?.("012", errorMessages["error012"](id2));
|
|
13930
13725
|
return;
|
|
13931
13726
|
}
|
|
13932
13727
|
store.setState({ nodesSelectionActive: false });
|
|
@@ -13934,10 +13729,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
|
13934
13729
|
addSelectedNodes([id2]);
|
|
13935
13730
|
} else if (unselect || node.selected && multiSelectionActive) {
|
|
13936
13731
|
unselectNodesAndEdges({ nodes: [node], edges: [] });
|
|
13937
|
-
requestAnimationFrame(() =>
|
|
13938
|
-
var _a2;
|
|
13939
|
-
return (_a2 = nodeRef == null ? void 0 : nodeRef.current) == null ? void 0 : _a2.blur();
|
|
13940
|
-
});
|
|
13732
|
+
requestAnimationFrame(() => nodeRef?.current?.blur());
|
|
13941
13733
|
}
|
|
13942
13734
|
}
|
|
13943
13735
|
function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable, nodeClickDistance }) {
|
|
@@ -13965,8 +13757,7 @@ function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, n
|
|
|
13965
13757
|
}
|
|
13966
13758
|
});
|
|
13967
13759
|
return () => {
|
|
13968
|
-
|
|
13969
|
-
(_a2 = xyDrag.current) == null ? void 0 : _a2.destroy();
|
|
13760
|
+
xyDrag.current?.destroy();
|
|
13970
13761
|
xyDrag.current = void 0;
|
|
13971
13762
|
};
|
|
13972
13763
|
}, [disabled, store, nodeRef]);
|
|
@@ -14062,19 +13853,18 @@ const connectingSelector = (nodeId, handleId, type) => (state) => {
|
|
|
14062
13853
|
if (!fromHandle && !clickHandle) {
|
|
14063
13854
|
return idleConnectingState;
|
|
14064
13855
|
}
|
|
14065
|
-
const connectingTo =
|
|
13856
|
+
const connectingTo = toHandle?.nodeId === nodeId && toHandle?.id === handleId && toHandle?.type === type;
|
|
14066
13857
|
return {
|
|
14067
|
-
connectingFrom:
|
|
13858
|
+
connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
|
|
14068
13859
|
connectingTo,
|
|
14069
|
-
clickConnecting:
|
|
14070
|
-
isPossibleEndHandle: connectionMode === ConnectionMode.Strict ?
|
|
13860
|
+
clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.id === handleId && clickHandle?.type === type,
|
|
13861
|
+
isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
|
|
14071
13862
|
connectionInProcess: !!fromHandle,
|
|
14072
13863
|
clickConnectionInProcess: !!clickHandle,
|
|
14073
13864
|
valid: connectingTo && isValid2
|
|
14074
13865
|
};
|
|
14075
13866
|
};
|
|
14076
13867
|
function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = true, isConnectableStart = true, isConnectableEnd = true, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
|
|
14077
|
-
var _a2, _b;
|
|
14078
13868
|
const handleId = id2 || null;
|
|
14079
13869
|
const isTarget = type === "target";
|
|
14080
13870
|
const store = useStoreApi();
|
|
@@ -14082,7 +13872,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14082
13872
|
const { connectOnClick, noPanClassName, rfId } = useHandleConfig();
|
|
14083
13873
|
const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow$1);
|
|
14084
13874
|
if (!nodeId) {
|
|
14085
|
-
|
|
13875
|
+
store.getState().onError?.("010", errorMessages["error010"]());
|
|
14086
13876
|
}
|
|
14087
13877
|
const onConnectExtended = (params) => {
|
|
14088
13878
|
const { defaultEdgeOptions, onConnect: onConnectAction, hasDefaultEdges } = store.getState();
|
|
@@ -14094,8 +13884,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14094
13884
|
const { edges, setEdges, onError } = store.getState();
|
|
14095
13885
|
setEdges(addEdge(edgeParams, edges, { onError }));
|
|
14096
13886
|
}
|
|
14097
|
-
onConnectAction
|
|
14098
|
-
onConnect
|
|
13887
|
+
onConnectAction?.(edgeParams);
|
|
13888
|
+
onConnect?.(edgeParams);
|
|
14099
13889
|
};
|
|
14100
13890
|
const onPointerDown2 = (event) => {
|
|
14101
13891
|
if (!nodeId) {
|
|
@@ -14119,16 +13909,10 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14119
13909
|
panBy: currentStore.panBy,
|
|
14120
13910
|
cancelConnection: currentStore.cancelConnection,
|
|
14121
13911
|
onConnectStart: currentStore.onConnectStart,
|
|
14122
|
-
onConnectEnd: (...args) =>
|
|
14123
|
-
var _a3, _b2;
|
|
14124
|
-
return (_b2 = (_a3 = store.getState()).onConnectEnd) == null ? void 0 : _b2.call(_a3, ...args);
|
|
14125
|
-
},
|
|
13912
|
+
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
|
14126
13913
|
updateConnection: currentStore.updateConnection,
|
|
14127
13914
|
onConnect: onConnectExtended,
|
|
14128
|
-
isValidConnection: isValidConnection || ((...args) =>
|
|
14129
|
-
var _a3, _b2;
|
|
14130
|
-
return ((_b2 = (_a3 = store.getState()).isValidConnection) == null ? void 0 : _b2.call(_a3, ...args)) ?? true;
|
|
14131
|
-
}),
|
|
13915
|
+
isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? true),
|
|
14132
13916
|
getTransform: () => store.getState().transform,
|
|
14133
13917
|
getFromHandle: () => store.getState().connection.fromHandle,
|
|
14134
13918
|
autoPanSpeed: currentStore.autoPanSpeed,
|
|
@@ -14136,9 +13920,9 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14136
13920
|
});
|
|
14137
13921
|
}
|
|
14138
13922
|
if (isMouseTriggered) {
|
|
14139
|
-
onMouseDown
|
|
13923
|
+
onMouseDown?.(event);
|
|
14140
13924
|
} else {
|
|
14141
|
-
onTouchStart
|
|
13925
|
+
onTouchStart?.(event);
|
|
14142
13926
|
}
|
|
14143
13927
|
};
|
|
14144
13928
|
const onClick = (event) => {
|
|
@@ -14147,7 +13931,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14147
13931
|
return;
|
|
14148
13932
|
}
|
|
14149
13933
|
if (!connectionClickStartHandle) {
|
|
14150
|
-
onClickConnectStart
|
|
13934
|
+
onClickConnectStart?.(event.nativeEvent, { nodeId, handleId, handleType: type });
|
|
14151
13935
|
store.setState({ connectionClickStartHandle: { nodeId, type, id: handleId } });
|
|
14152
13936
|
return;
|
|
14153
13937
|
}
|
|
@@ -14175,7 +13959,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14175
13959
|
const connectionClone = structuredClone(connectionState);
|
|
14176
13960
|
delete connectionClone.inProgress;
|
|
14177
13961
|
connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
|
|
14178
|
-
onClickConnectEnd
|
|
13962
|
+
onClickConnectEnd?.(event, connectionClone);
|
|
14179
13963
|
store.setState({ connectionClickStartHandle: null });
|
|
14180
13964
|
};
|
|
14181
13965
|
return jsxRuntimeExports.jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
|
|
@@ -14204,16 +13988,16 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
14204
13988
|
}
|
|
14205
13989
|
const Handle = reactExports.memo(fixedForwardRef(HandleComponent));
|
|
14206
13990
|
function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
|
|
14207
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [data
|
|
13991
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [data?.label, jsxRuntimeExports.jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
14208
13992
|
}
|
|
14209
13993
|
function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom }) {
|
|
14210
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data
|
|
13994
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label, jsxRuntimeExports.jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
14211
13995
|
}
|
|
14212
13996
|
function GroupNode() {
|
|
14213
13997
|
return null;
|
|
14214
13998
|
}
|
|
14215
13999
|
function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
|
|
14216
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data
|
|
14000
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label] });
|
|
14217
14001
|
}
|
|
14218
14002
|
const arrowKeyDiffs = {
|
|
14219
14003
|
ArrowUp: { x: 0, y: -1 },
|
|
@@ -14228,16 +14012,15 @@ const builtinNodeTypes = {
|
|
|
14228
14012
|
group: GroupNode
|
|
14229
14013
|
};
|
|
14230
14014
|
function getNodeInlineStyleDimensions(node) {
|
|
14231
|
-
var _a2, _b, _c, _d;
|
|
14232
14015
|
if (node.internals.handleBounds === void 0) {
|
|
14233
14016
|
return {
|
|
14234
|
-
width: node.width ?? node.initialWidth ??
|
|
14235
|
-
height: node.height ?? node.initialHeight ??
|
|
14017
|
+
width: node.width ?? node.initialWidth ?? node.style?.width,
|
|
14018
|
+
height: node.height ?? node.initialHeight ?? node.style?.height
|
|
14236
14019
|
};
|
|
14237
14020
|
}
|
|
14238
14021
|
return {
|
|
14239
|
-
width: node.width ??
|
|
14240
|
-
height: node.height ??
|
|
14022
|
+
width: node.width ?? node.style?.width,
|
|
14023
|
+
height: node.height ?? node.style?.height
|
|
14241
14024
|
};
|
|
14242
14025
|
}
|
|
14243
14026
|
const selector$e = (s) => {
|
|
@@ -14257,9 +14040,8 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
|
|
|
14257
14040
|
const moveSelectedNodes = useMoveSelectedNodes();
|
|
14258
14041
|
const nodeRef = reactExports.useRef(null);
|
|
14259
14042
|
reactExports.useEffect(() => {
|
|
14260
|
-
var _a2;
|
|
14261
14043
|
if (!disableKeyboardA11y) {
|
|
14262
|
-
|
|
14044
|
+
nodeRef.current?.focus({
|
|
14263
14045
|
preventScroll: true
|
|
14264
14046
|
});
|
|
14265
14047
|
}
|
|
@@ -14338,7 +14120,7 @@ function useResizeObserver() {
|
|
|
14338
14120
|
});
|
|
14339
14121
|
reactExports.useEffect(() => {
|
|
14340
14122
|
return () => {
|
|
14341
|
-
resizeObserver
|
|
14123
|
+
resizeObserver?.disconnect();
|
|
14342
14124
|
};
|
|
14343
14125
|
}, [resizeObserver]);
|
|
14344
14126
|
return resizeObserver;
|
|
@@ -14354,16 +14136,16 @@ function useNodeObserver({ node, nodeType, hasDimensions, resizeObserver }) {
|
|
|
14354
14136
|
reactExports.useEffect(() => {
|
|
14355
14137
|
if (nodeRef.current && !node.hidden && (!isInitialized || observedNode.current !== nodeRef.current)) {
|
|
14356
14138
|
if (observedNode.current) {
|
|
14357
|
-
resizeObserver
|
|
14139
|
+
resizeObserver?.unobserve(observedNode.current);
|
|
14358
14140
|
}
|
|
14359
|
-
resizeObserver
|
|
14141
|
+
resizeObserver?.observe(nodeRef.current);
|
|
14360
14142
|
observedNode.current = nodeRef.current;
|
|
14361
14143
|
}
|
|
14362
14144
|
}, [isInitialized, node.hidden]);
|
|
14363
14145
|
reactExports.useEffect(() => {
|
|
14364
14146
|
return () => {
|
|
14365
14147
|
if (observedNode.current) {
|
|
14366
|
-
resizeObserver
|
|
14148
|
+
resizeObserver?.unobserve(observedNode.current);
|
|
14367
14149
|
observedNode.current = null;
|
|
14368
14150
|
}
|
|
14369
14151
|
};
|
|
@@ -14394,11 +14176,11 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
|
|
|
14394
14176
|
};
|
|
14395
14177
|
}, shallow$1);
|
|
14396
14178
|
let nodeType = node.type || "default";
|
|
14397
|
-
let NodeComponent =
|
|
14179
|
+
let NodeComponent = nodeTypes2?.[nodeType] || builtinNodeTypes[nodeType];
|
|
14398
14180
|
if (NodeComponent === void 0) {
|
|
14399
|
-
onError
|
|
14181
|
+
onError?.("003", errorMessages["error003"](nodeType));
|
|
14400
14182
|
nodeType = "default";
|
|
14401
|
-
NodeComponent =
|
|
14183
|
+
NodeComponent = nodeTypes2?.["default"] || builtinNodeTypes.default;
|
|
14402
14184
|
}
|
|
14403
14185
|
const isDraggable = !!(node.draggable || nodesDraggable && typeof node.draggable === "undefined");
|
|
14404
14186
|
const isSelectable = !!(node.selectable || elementsSelectable && typeof node.selectable === "undefined");
|
|
@@ -14470,8 +14252,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
|
|
|
14470
14252
|
}
|
|
14471
14253
|
};
|
|
14472
14254
|
const onFocus = () => {
|
|
14473
|
-
|
|
14474
|
-
if (disableKeyboardA11y || !((_a2 = nodeRef.current) == null ? void 0 : _a2.matches(":focus-visible"))) {
|
|
14255
|
+
if (disableKeyboardA11y || !nodeRef.current?.matches(":focus-visible")) {
|
|
14475
14256
|
return;
|
|
14476
14257
|
}
|
|
14477
14258
|
const { transform: transform2, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
|
|
@@ -14599,10 +14380,9 @@ const MarkerSymbols = {
|
|
|
14599
14380
|
function useMarkerSymbol(type) {
|
|
14600
14381
|
const store = useStoreApi();
|
|
14601
14382
|
const symbol = reactExports.useMemo(() => {
|
|
14602
|
-
var _a2, _b;
|
|
14603
14383
|
const symbolExists = Object.prototype.hasOwnProperty.call(MarkerSymbols, type);
|
|
14604
14384
|
if (!symbolExists) {
|
|
14605
|
-
|
|
14385
|
+
store.getState().onError?.("009", errorMessages["error009"](type));
|
|
14606
14386
|
return null;
|
|
14607
14387
|
}
|
|
14608
14388
|
return MarkerSymbols[type];
|
|
@@ -14623,8 +14403,8 @@ const MarkerDefinitions = ({ defaultColor, rfId }) => {
|
|
|
14623
14403
|
const markers2 = createMarkerIds(edges, {
|
|
14624
14404
|
id: rfId,
|
|
14625
14405
|
defaultColor,
|
|
14626
|
-
defaultMarkerStart: defaultEdgeOptions
|
|
14627
|
-
defaultMarkerEnd: defaultEdgeOptions
|
|
14406
|
+
defaultMarkerStart: defaultEdgeOptions?.markerStart,
|
|
14407
|
+
defaultMarkerEnd: defaultEdgeOptions?.markerEnd
|
|
14628
14408
|
});
|
|
14629
14409
|
return markers2;
|
|
14630
14410
|
}, [edges, defaultEdgeOptions, rfId, defaultColor]);
|
|
@@ -14726,9 +14506,9 @@ function createSmoothStepEdge(params) {
|
|
|
14726
14506
|
targetX,
|
|
14727
14507
|
targetY,
|
|
14728
14508
|
targetPosition,
|
|
14729
|
-
borderRadius: pathOptions
|
|
14730
|
-
offset: pathOptions
|
|
14731
|
-
stepPosition: pathOptions
|
|
14509
|
+
borderRadius: pathOptions?.borderRadius,
|
|
14510
|
+
offset: pathOptions?.offset,
|
|
14511
|
+
stepPosition: pathOptions?.stepPosition
|
|
14732
14512
|
});
|
|
14733
14513
|
const _id = params.isInternal ? void 0 : id2;
|
|
14734
14514
|
return jsxRuntimeExports.jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
|
|
@@ -14740,12 +14520,8 @@ SmoothStepEdge.displayName = "SmoothStepEdge";
|
|
|
14740
14520
|
SmoothStepEdgeInternal.displayName = "SmoothStepEdgeInternal";
|
|
14741
14521
|
function createStepEdge(params) {
|
|
14742
14522
|
return reactExports.memo(({ id: id2, ...props }) => {
|
|
14743
|
-
var _a2;
|
|
14744
14523
|
const _id = params.isInternal ? void 0 : id2;
|
|
14745
|
-
return jsxRuntimeExports.jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: reactExports.useMemo(() => {
|
|
14746
|
-
var _a3;
|
|
14747
|
-
return { borderRadius: 0, offset: (_a3 = props.pathOptions) == null ? void 0 : _a3.offset };
|
|
14748
|
-
}, [(_a2 = props.pathOptions) == null ? void 0 : _a2.offset]) });
|
|
14524
|
+
return jsxRuntimeExports.jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: reactExports.useMemo(() => ({ borderRadius: 0, offset: props.pathOptions?.offset }), [props.pathOptions?.offset]) });
|
|
14749
14525
|
});
|
|
14750
14526
|
}
|
|
14751
14527
|
const StepEdge = createStepEdge({ isInternal: false });
|
|
@@ -14772,7 +14548,7 @@ function createBezierEdge(params) {
|
|
|
14772
14548
|
targetX,
|
|
14773
14549
|
targetY,
|
|
14774
14550
|
targetPosition,
|
|
14775
|
-
curvature: pathOptions
|
|
14551
|
+
curvature: pathOptions?.curvature
|
|
14776
14552
|
});
|
|
14777
14553
|
const _id = params.isInternal ? void 0 : id2;
|
|
14778
14554
|
return jsxRuntimeExports.jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
|
|
@@ -14826,13 +14602,13 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
|
|
|
14826
14602
|
const isTarget = oppositeHandle.type === "target";
|
|
14827
14603
|
const _onReconnectEnd = (evt, connectionState) => {
|
|
14828
14604
|
setReconnecting(false);
|
|
14829
|
-
onReconnectEnd
|
|
14605
|
+
onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
|
|
14830
14606
|
};
|
|
14831
|
-
const onConnectEdge = (connection) => onReconnect
|
|
14607
|
+
const onConnectEdge = (connection) => onReconnect?.(edge, connection);
|
|
14832
14608
|
const _onConnectStart = (_event, params) => {
|
|
14833
14609
|
setReconnecting(true);
|
|
14834
|
-
onReconnectStart
|
|
14835
|
-
onConnectStart
|
|
14610
|
+
onReconnectStart?.(event, edge, oppositeHandle.type);
|
|
14611
|
+
onConnectStart?.(_event, params);
|
|
14836
14612
|
};
|
|
14837
14613
|
XYHandle.onPointerDown(event.nativeEvent, {
|
|
14838
14614
|
autoPanOnConnect,
|
|
@@ -14848,16 +14624,10 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
|
|
|
14848
14624
|
flowId,
|
|
14849
14625
|
cancelConnection,
|
|
14850
14626
|
panBy: panBy2,
|
|
14851
|
-
isValidConnection: (...args) =>
|
|
14852
|
-
var _a2, _b;
|
|
14853
|
-
return ((_b = (_a2 = store.getState()).isValidConnection) == null ? void 0 : _b.call(_a2, ...args)) ?? true;
|
|
14854
|
-
},
|
|
14627
|
+
isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? true,
|
|
14855
14628
|
onConnect: onConnectEdge,
|
|
14856
14629
|
onConnectStart: _onConnectStart,
|
|
14857
|
-
onConnectEnd: (...args) =>
|
|
14858
|
-
var _a2, _b;
|
|
14859
|
-
return (_b = (_a2 = store.getState()).onConnectEnd) == null ? void 0 : _b.call(_a2, ...args);
|
|
14860
|
-
},
|
|
14630
|
+
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
|
14861
14631
|
onReconnectEnd: _onReconnectEnd,
|
|
14862
14632
|
updateConnection,
|
|
14863
14633
|
getTransform: () => store.getState().transform,
|
|
@@ -14877,11 +14647,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14877
14647
|
const defaultEdgeOptions = useStore((s) => s.defaultEdgeOptions);
|
|
14878
14648
|
edge = defaultEdgeOptions ? { ...defaultEdgeOptions, ...edge } : edge;
|
|
14879
14649
|
let edgeType = edge.type || "default";
|
|
14880
|
-
let EdgeComponent =
|
|
14650
|
+
let EdgeComponent = edgeTypes2?.[edgeType] || builtinEdgeTypes[edgeType];
|
|
14881
14651
|
if (EdgeComponent === void 0) {
|
|
14882
|
-
onError
|
|
14652
|
+
onError?.("011", errorMessages["error011"](edgeType));
|
|
14883
14653
|
edgeType = "default";
|
|
14884
|
-
EdgeComponent =
|
|
14654
|
+
EdgeComponent = edgeTypes2?.["default"] || builtinEdgeTypes.default;
|
|
14885
14655
|
}
|
|
14886
14656
|
const isFocusable = !!(edge.focusable || edgesFocusable && typeof edge.focusable === "undefined");
|
|
14887
14657
|
const isReconnectable = typeof onReconnect !== "undefined" && (edge.reconnectable || edgesReconnectable && typeof edge.reconnectable === "undefined");
|
|
@@ -14924,13 +14694,12 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14924
14694
|
return null;
|
|
14925
14695
|
}
|
|
14926
14696
|
const onEdgeClick = (event) => {
|
|
14927
|
-
var _a2;
|
|
14928
14697
|
const { addSelectedEdges, unselectNodesAndEdges, multiSelectionActive } = store.getState();
|
|
14929
14698
|
if (isSelectable) {
|
|
14930
14699
|
store.setState({ nodesSelectionActive: false });
|
|
14931
14700
|
if (edge.selected && multiSelectionActive) {
|
|
14932
14701
|
unselectNodesAndEdges({ nodes: [], edges: [edge] });
|
|
14933
|
-
|
|
14702
|
+
edgeRef.current?.blur();
|
|
14934
14703
|
} else {
|
|
14935
14704
|
addSelectedEdges([id2]);
|
|
14936
14705
|
}
|
|
@@ -14955,12 +14724,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14955
14724
|
onMouseLeave(event, { ...edge });
|
|
14956
14725
|
} : void 0;
|
|
14957
14726
|
const onKeyDown = (event) => {
|
|
14958
|
-
var _a2;
|
|
14959
14727
|
if (!disableKeyboardA11y && elementSelectionKeys.includes(event.key) && isSelectable) {
|
|
14960
14728
|
const { unselectNodesAndEdges, addSelectedEdges } = store.getState();
|
|
14961
14729
|
const unselect = event.key === "Escape";
|
|
14962
14730
|
if (unselect) {
|
|
14963
|
-
|
|
14731
|
+
edgeRef.current?.blur();
|
|
14964
14732
|
unselectNodesAndEdges({ edges: [edge] });
|
|
14965
14733
|
} else {
|
|
14966
14734
|
addSelectedEdges([id2]);
|
|
@@ -15030,16 +14798,13 @@ function useOnInitHandler(onInit) {
|
|
|
15030
14798
|
}
|
|
15031
14799
|
}, [onInit, rfInstance.viewportInitialized]);
|
|
15032
14800
|
}
|
|
15033
|
-
const selector$8 = (state) =>
|
|
15034
|
-
var _a2;
|
|
15035
|
-
return (_a2 = state.panZoom) == null ? void 0 : _a2.syncViewport;
|
|
15036
|
-
};
|
|
14801
|
+
const selector$8 = (state) => state.panZoom?.syncViewport;
|
|
15037
14802
|
function useViewportSync(viewport) {
|
|
15038
14803
|
const syncViewport = useStore(selector$8);
|
|
15039
14804
|
const store = useStoreApi();
|
|
15040
14805
|
reactExports.useEffect(() => {
|
|
15041
14806
|
if (viewport) {
|
|
15042
|
-
syncViewport
|
|
14807
|
+
syncViewport?.(viewport);
|
|
15043
14808
|
store.setState({ transform: [viewport.x, viewport.y, viewport.zoom] });
|
|
15044
14809
|
}
|
|
15045
14810
|
}, [viewport, syncViewport]);
|
|
@@ -15153,7 +14918,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
15153
14918
|
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
15154
14919
|
filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight))
|
|
15155
14920
|
});
|
|
15156
|
-
const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom,
|
|
14921
|
+
const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
|
|
15157
14922
|
transform2 = [x, y, zoom2];
|
|
15158
14923
|
}
|
|
15159
14924
|
return {
|
|
@@ -15258,7 +15023,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15258
15023
|
minZoom: minZoom2,
|
|
15259
15024
|
maxZoom: maxZoom2
|
|
15260
15025
|
}, fitViewOptions2);
|
|
15261
|
-
fitViewResolver
|
|
15026
|
+
fitViewResolver?.resolve(true);
|
|
15262
15027
|
set2({ fitViewResolver: null });
|
|
15263
15028
|
}
|
|
15264
15029
|
return {
|
|
@@ -15335,11 +15100,11 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15335
15100
|
} else {
|
|
15336
15101
|
set2({});
|
|
15337
15102
|
}
|
|
15338
|
-
if (
|
|
15103
|
+
if (changes?.length > 0) {
|
|
15339
15104
|
if (debug) {
|
|
15340
15105
|
console.log("React Flow: trigger node changes", changes);
|
|
15341
15106
|
}
|
|
15342
|
-
triggerNodeChanges
|
|
15107
|
+
triggerNodeChanges?.(changes);
|
|
15343
15108
|
}
|
|
15344
15109
|
},
|
|
15345
15110
|
updateNodePositions: (nodeDragItems, dragging = false) => {
|
|
@@ -15348,7 +15113,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15348
15113
|
const { nodeLookup, triggerNodeChanges, connection, updateConnection, onNodesChangeMiddlewareMap } = get2();
|
|
15349
15114
|
for (const [id2, dragItem] of nodeDragItems) {
|
|
15350
15115
|
const node = nodeLookup.get(id2);
|
|
15351
|
-
const expandParent = !!(
|
|
15116
|
+
const expandParent = !!(node?.expandParent && node?.parentId && dragItem?.position);
|
|
15352
15117
|
const change = {
|
|
15353
15118
|
id: id2,
|
|
15354
15119
|
type: "position",
|
|
@@ -15387,7 +15152,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15387
15152
|
},
|
|
15388
15153
|
triggerNodeChanges: (changes) => {
|
|
15389
15154
|
const { onNodesChange, setNodes, nodes: nodes2, hasDefaultNodes, debug } = get2();
|
|
15390
|
-
if (changes
|
|
15155
|
+
if (changes?.length) {
|
|
15391
15156
|
if (hasDefaultNodes) {
|
|
15392
15157
|
const updatedNodes = applyNodeChanges(changes, nodes2);
|
|
15393
15158
|
setNodes(updatedNodes);
|
|
@@ -15395,12 +15160,12 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15395
15160
|
if (debug) {
|
|
15396
15161
|
console.log("React Flow: trigger node changes", changes);
|
|
15397
15162
|
}
|
|
15398
|
-
onNodesChange
|
|
15163
|
+
onNodesChange?.(changes);
|
|
15399
15164
|
}
|
|
15400
15165
|
},
|
|
15401
15166
|
triggerEdgeChanges: (changes) => {
|
|
15402
15167
|
const { onEdgesChange, setEdges, edges: edges2, hasDefaultEdges, debug } = get2();
|
|
15403
|
-
if (changes
|
|
15168
|
+
if (changes?.length) {
|
|
15404
15169
|
if (hasDefaultEdges) {
|
|
15405
15170
|
const updatedEdges = applyEdgeChanges(changes, edges2);
|
|
15406
15171
|
setEdges(updatedEdges);
|
|
@@ -15408,7 +15173,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15408
15173
|
if (debug) {
|
|
15409
15174
|
console.log("React Flow: trigger edge changes", changes);
|
|
15410
15175
|
}
|
|
15411
|
-
onEdgesChange
|
|
15176
|
+
onEdgesChange?.(changes);
|
|
15412
15177
|
}
|
|
15413
15178
|
},
|
|
15414
15179
|
addSelectedNodes: (selectedNodeIds) => {
|
|
@@ -15454,17 +15219,16 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15454
15219
|
},
|
|
15455
15220
|
setMinZoom: (minZoom2) => {
|
|
15456
15221
|
const { panZoom, maxZoom: maxZoom2 } = get2();
|
|
15457
|
-
panZoom
|
|
15222
|
+
panZoom?.setScaleExtent([minZoom2, maxZoom2]);
|
|
15458
15223
|
set2({ minZoom: minZoom2 });
|
|
15459
15224
|
},
|
|
15460
15225
|
setMaxZoom: (maxZoom2) => {
|
|
15461
15226
|
const { panZoom, minZoom: minZoom2 } = get2();
|
|
15462
|
-
panZoom
|
|
15227
|
+
panZoom?.setScaleExtent([minZoom2, maxZoom2]);
|
|
15463
15228
|
set2({ maxZoom: maxZoom2 });
|
|
15464
15229
|
},
|
|
15465
15230
|
setTranslateExtent: (translateExtent) => {
|
|
15466
|
-
|
|
15467
|
-
(_a2 = get2().panZoom) == null ? void 0 : _a2.setTranslateExtent(translateExtent);
|
|
15231
|
+
get2().panZoom?.setTranslateExtent(translateExtent);
|
|
15468
15232
|
set2({ translateExtent });
|
|
15469
15233
|
},
|
|
15470
15234
|
resetSelectedElements: () => {
|
|
@@ -15495,17 +15259,17 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
15495
15259
|
const { transform: transform2, width: width2, height: height2, panZoom, translateExtent } = get2();
|
|
15496
15260
|
return panBy({ delta, panZoom, transform: transform2, translateExtent, width: width2, height: height2 });
|
|
15497
15261
|
},
|
|
15498
|
-
setCenter: async (x, y,
|
|
15262
|
+
setCenter: async (x, y, options2) => {
|
|
15499
15263
|
const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get2();
|
|
15500
15264
|
if (!panZoom) {
|
|
15501
15265
|
return false;
|
|
15502
15266
|
}
|
|
15503
|
-
const nextZoom = typeof
|
|
15267
|
+
const nextZoom = typeof options2?.zoom !== "undefined" ? options2.zoom : maxZoom2;
|
|
15504
15268
|
await panZoom.setViewport({
|
|
15505
15269
|
x: width2 / 2 - x * nextZoom,
|
|
15506
15270
|
y: height2 / 2 - y * nextZoom,
|
|
15507
15271
|
zoom: nextZoom
|
|
15508
|
-
}, { duration:
|
|
15272
|
+
}, { duration: options2?.duration, ease: options2?.ease, interpolate: options2?.interpolate });
|
|
15509
15273
|
return true;
|
|
15510
15274
|
},
|
|
15511
15275
|
cancelConnection: () => {
|
|
@@ -15556,15 +15320,12 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
15556
15320
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
15557
15321
|
const wrapperOnScroll = reactExports.useCallback((e) => {
|
|
15558
15322
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
15559
|
-
onScroll
|
|
15323
|
+
onScroll?.(e);
|
|
15560
15324
|
}, [onScroll]);
|
|
15561
15325
|
return jsxRuntimeExports.jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxRuntimeExports.jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsxRuntimeExports.jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug, ariaLabelConfig, zIndexMode }), jsxRuntimeExports.jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, autoPanOnSelection, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange, nodesDraggable }), jsxRuntimeExports.jsx(SelectionListener, { onSelectionChange }), children2, jsxRuntimeExports.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntimeExports.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
15562
15326
|
}
|
|
15563
15327
|
var index = fixedForwardRef(ReactFlow);
|
|
15564
|
-
const selector$6 = (s) =>
|
|
15565
|
-
var _a2;
|
|
15566
|
-
return (_a2 = s.domNode) == null ? void 0 : _a2.querySelector(".react-flow__edgelabel-renderer");
|
|
15567
|
-
};
|
|
15328
|
+
const selector$6 = (s) => s.domNode?.querySelector(".react-flow__edgelabel-renderer");
|
|
15568
15329
|
function EdgeLabelRenderer({ children: children2 }) {
|
|
15569
15330
|
const edgeLabelRenderer = useStore(selector$6);
|
|
15570
15331
|
if (!edgeLabelRenderer) {
|
|
@@ -15669,15 +15430,15 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
|
|
|
15669
15430
|
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
15670
15431
|
const onZoomInHandler = () => {
|
|
15671
15432
|
zoomIn();
|
|
15672
|
-
onZoomIn
|
|
15433
|
+
onZoomIn?.();
|
|
15673
15434
|
};
|
|
15674
15435
|
const onZoomOutHandler = () => {
|
|
15675
15436
|
zoomOut();
|
|
15676
|
-
onZoomOut
|
|
15437
|
+
onZoomOut?.();
|
|
15677
15438
|
};
|
|
15678
15439
|
const onFitViewHandler = () => {
|
|
15679
15440
|
fitView(fitViewOptions);
|
|
15680
|
-
onFitView
|
|
15441
|
+
onFitView?.();
|
|
15681
15442
|
};
|
|
15682
15443
|
const onToggleInteractivity = () => {
|
|
15683
15444
|
store.setState({
|
|
@@ -15685,7 +15446,7 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
|
|
|
15685
15446
|
nodesConnectable: !isInteractive,
|
|
15686
15447
|
elementsSelectable: !isInteractive
|
|
15687
15448
|
});
|
|
15688
|
-
onInteractiveChange
|
|
15449
|
+
onInteractiveChange?.(!isInteractive);
|
|
15689
15450
|
};
|
|
15690
15451
|
const orientationClass = orientation === "horizontal" ? "horizontal" : "vertical";
|
|
15691
15452
|
return jsxRuntimeExports.jsxs(Panel, { className: cc(["react-flow__controls", orientationClass, className]), position, style: style2, "data-testid": "rf__controls", "aria-label": ariaLabel ?? ariaLabelConfig["controls.ariaLabel"], children: [showZoom && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: ariaLabelConfig["controls.zoomIn.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomIn.ariaLabel"], disabled: maxZoomReached, children: jsxRuntimeExports.jsx(PlusIcon, {}) }), jsxRuntimeExports.jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: ariaLabelConfig["controls.zoomOut.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomOut.ariaLabel"], disabled: minZoomReached, children: jsxRuntimeExports.jsx(MinusIcon, {}) })] }), showFitView && jsxRuntimeExports.jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: ariaLabelConfig["controls.fitView.ariaLabel"], "aria-label": ariaLabelConfig["controls.fitView.ariaLabel"], children: jsxRuntimeExports.jsx(FitViewIcon, {}) }), showInteractive && jsxRuntimeExports.jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: ariaLabelConfig["controls.interactive.ariaLabel"], "aria-label": ariaLabelConfig["controls.interactive.ariaLabel"], children: isInteractive ? jsxRuntimeExports.jsx(UnlockIcon, {}) : jsxRuntimeExports.jsx(LockIcon, {}) }), children2] });
|
|
@@ -15818,8 +15579,8 @@ function MiniMapComponent({
|
|
|
15818
15579
|
const store = useStoreApi();
|
|
15819
15580
|
const svg = reactExports.useRef(null);
|
|
15820
15581
|
const { boundingRect, panZoom, viewBB, rfId, translateExtent, flowWidth, flowHeight, ariaLabelConfig } = useStore(selector$1, areEqual);
|
|
15821
|
-
const elementWidth =
|
|
15822
|
-
const elementHeight =
|
|
15582
|
+
const elementWidth = style2?.width ?? defaultWidth;
|
|
15583
|
+
const elementHeight = style2?.height ?? defaultHeight;
|
|
15823
15584
|
const scaledWidth = boundingRect.width / elementWidth;
|
|
15824
15585
|
const scaledHeight = boundingRect.height / elementHeight;
|
|
15825
15586
|
const viewScale = Math.max(scaledWidth, scaledHeight);
|
|
@@ -15844,14 +15605,12 @@ function MiniMapComponent({
|
|
|
15844
15605
|
getViewScale: () => viewScaleRef.current
|
|
15845
15606
|
});
|
|
15846
15607
|
return () => {
|
|
15847
|
-
|
|
15848
|
-
(_a2 = minimapInstance.current) == null ? void 0 : _a2.destroy();
|
|
15608
|
+
minimapInstance.current?.destroy();
|
|
15849
15609
|
};
|
|
15850
15610
|
}
|
|
15851
15611
|
}, [panZoom]);
|
|
15852
15612
|
reactExports.useEffect(() => {
|
|
15853
|
-
|
|
15854
|
-
(_a2 = minimapInstance.current) == null ? void 0 : _a2.update({
|
|
15613
|
+
minimapInstance.current?.update({
|
|
15855
15614
|
translateExtent,
|
|
15856
15615
|
width: flowWidth,
|
|
15857
15616
|
height: flowHeight,
|
|
@@ -15862,13 +15621,12 @@ function MiniMapComponent({
|
|
|
15862
15621
|
});
|
|
15863
15622
|
}, [pannable, zoomable, inversePan, zoomStep, translateExtent, flowWidth, flowHeight]);
|
|
15864
15623
|
const onSvgClick = onClick ? (event) => {
|
|
15865
|
-
|
|
15866
|
-
const [x2, y2] = ((_a2 = minimapInstance.current) == null ? void 0 : _a2.pointer(event)) || [0, 0];
|
|
15624
|
+
const [x2, y2] = minimapInstance.current?.pointer(event) || [0, 0];
|
|
15867
15625
|
onClick(event, { x: x2, y: y2 });
|
|
15868
15626
|
} : void 0;
|
|
15869
15627
|
const nodeClickHandler = reactExports.useCallback((event, nodeId) => {
|
|
15870
15628
|
const node = store.getState().nodeLookup.get(nodeId).internals.userNode;
|
|
15871
|
-
onNodeClick
|
|
15629
|
+
onNodeClick?.(event, node);
|
|
15872
15630
|
}, [onNodeClick]);
|
|
15873
15631
|
const onSvgNodeClick = onNodeClick ? nodeClickHandler : void 0;
|
|
15874
15632
|
const _ariaLabel = ariaLabel ?? ariaLabelConfig["minimap.ariaLabel"];
|
|
@@ -16006,8 +15764,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
16006
15764
|
shouldResize
|
|
16007
15765
|
});
|
|
16008
15766
|
return () => {
|
|
16009
|
-
|
|
16010
|
-
(_a2 = resizer.current) == null ? void 0 : _a2.destroy();
|
|
15767
|
+
resizer.current?.destroy();
|
|
16011
15768
|
};
|
|
16012
15769
|
}, [
|
|
16013
15770
|
controlPosition,
|
|
@@ -16038,21 +15795,20 @@ const LAYOUT = {
|
|
|
16038
15795
|
PARALLEL_GROUP_PADDING: 25
|
|
16039
15796
|
};
|
|
16040
15797
|
function LoopNodeComponent({ data, selected: selected2 }) {
|
|
16041
|
-
var _a2, _b, _c, _d;
|
|
16042
15798
|
const nodeData = data;
|
|
16043
15799
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
16044
15800
|
"div",
|
|
16045
15801
|
{
|
|
16046
15802
|
className: `relative ${nodeData.className || ""}`,
|
|
16047
15803
|
style: {
|
|
16048
|
-
borderWidth:
|
|
15804
|
+
borderWidth: nodeData.nodeStyle?.borderWidth ?? 1,
|
|
16049
15805
|
borderRadius: 8,
|
|
16050
15806
|
padding: 12,
|
|
16051
15807
|
width: 220,
|
|
16052
15808
|
borderStyle: "solid",
|
|
16053
|
-
backgroundColor:
|
|
16054
|
-
borderColor:
|
|
16055
|
-
opacity:
|
|
15809
|
+
backgroundColor: nodeData.nodeStyle?.backgroundColor,
|
|
15810
|
+
borderColor: nodeData.nodeStyle?.borderColor ?? "#9ca3af",
|
|
15811
|
+
opacity: nodeData.nodeStyle?.opacity,
|
|
16056
15812
|
boxShadow: selected2 ? "0 0 0 2px rgba(168, 85, 247, 0.5)" : void 0
|
|
16057
15813
|
},
|
|
16058
15814
|
children: [
|
|
@@ -16127,7 +15883,6 @@ function ParallelGroupComponent({ data }) {
|
|
|
16127
15883
|
);
|
|
16128
15884
|
}
|
|
16129
15885
|
function DiamondNodeComponent({ data, selected: selected2 }) {
|
|
16130
|
-
var _a2, _b, _c;
|
|
16131
15886
|
const nodeData = data;
|
|
16132
15887
|
const size = 160;
|
|
16133
15888
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -16149,9 +15904,9 @@ function DiamondNodeComponent({ data, selected: selected2 }) {
|
|
|
16149
15904
|
borderWidth: 2,
|
|
16150
15905
|
borderStyle: "solid",
|
|
16151
15906
|
borderRadius: 4,
|
|
16152
|
-
backgroundColor:
|
|
16153
|
-
borderColor:
|
|
16154
|
-
opacity:
|
|
15907
|
+
backgroundColor: nodeData.nodeStyle?.backgroundColor,
|
|
15908
|
+
borderColor: nodeData.nodeStyle?.borderColor ?? "#ef4444",
|
|
15909
|
+
opacity: nodeData.nodeStyle?.opacity,
|
|
16155
15910
|
boxShadow: selected2 ? "0 0 0 2px rgba(239, 68, 68, 0.5)" : void 0
|
|
16156
15911
|
}
|
|
16157
15912
|
}
|
|
@@ -16166,7 +15921,6 @@ function DiamondNodeComponent({ data, selected: selected2 }) {
|
|
|
16166
15921
|
padding: size * 0.25
|
|
16167
15922
|
// Keep text within the diamond's inscribed area
|
|
16168
15923
|
},
|
|
16169
|
-
title: typeof nodeData.label === "string" ? nodeData.label : void 0,
|
|
16170
15924
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-center line-clamp-3 overflow-hidden", children: nodeData.label })
|
|
16171
15925
|
}
|
|
16172
15926
|
),
|
|
@@ -16342,7 +16096,6 @@ function getNodeIcon(nodeKind, label) {
|
|
|
16342
16096
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-3.5 w-3.5 text-green-900" });
|
|
16343
16097
|
}
|
|
16344
16098
|
function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
16345
|
-
var _a2, _b, _c, _d, _e;
|
|
16346
16099
|
const nodes = workflow.nodes.map((node) => ({ ...node }));
|
|
16347
16100
|
const groupNodes = [];
|
|
16348
16101
|
const additionalEdges = [];
|
|
@@ -16350,7 +16103,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
16350
16103
|
const loopNodes = /* @__PURE__ */ new Map();
|
|
16351
16104
|
const conditionalGroups = /* @__PURE__ */ new Map();
|
|
16352
16105
|
for (const node of nodes) {
|
|
16353
|
-
if (
|
|
16106
|
+
if (node.metadata?.parallelGroupId) {
|
|
16354
16107
|
const group = parallelGroups.get(node.metadata.parallelGroupId) || {
|
|
16355
16108
|
nodes: [],
|
|
16356
16109
|
method: node.metadata.parallelMethod
|
|
@@ -16358,12 +16111,12 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
16358
16111
|
group.nodes.push(node);
|
|
16359
16112
|
parallelGroups.set(node.metadata.parallelGroupId, group);
|
|
16360
16113
|
}
|
|
16361
|
-
if (
|
|
16114
|
+
if (node.metadata?.loopId) {
|
|
16362
16115
|
const group = loopNodes.get(node.metadata.loopId) || [];
|
|
16363
16116
|
group.push(node);
|
|
16364
16117
|
loopNodes.set(node.metadata.loopId, group);
|
|
16365
16118
|
}
|
|
16366
|
-
if (
|
|
16119
|
+
if (node.metadata?.conditionalId) {
|
|
16367
16120
|
const groups = conditionalGroups.get(node.metadata.conditionalId) || {
|
|
16368
16121
|
thenBranch: [],
|
|
16369
16122
|
elseBranch: []
|
|
@@ -16420,8 +16173,8 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
16420
16173
|
const elseNodes = branches.elseBranch;
|
|
16421
16174
|
if (thenNodes.length > 0 && elseNodes.length > 0) {
|
|
16422
16175
|
const baseY = Math.min(
|
|
16423
|
-
|
|
16424
|
-
|
|
16176
|
+
thenNodes[0]?.position.y || 0,
|
|
16177
|
+
elseNodes[0]?.position.y || 0
|
|
16425
16178
|
);
|
|
16426
16179
|
thenNodes.forEach((node, idx) => {
|
|
16427
16180
|
node.position = {
|
|
@@ -16439,10 +16192,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
16439
16192
|
}
|
|
16440
16193
|
for (const [, loopNodeList] of loopNodes) {
|
|
16441
16194
|
if (loopNodeList.length > 0) {
|
|
16442
|
-
const isAwaitLoop = loopNodeList.some((n) =>
|
|
16443
|
-
var _a3;
|
|
16444
|
-
return (_a3 = n.metadata) == null ? void 0 : _a3.loopIsAwait;
|
|
16445
|
-
});
|
|
16195
|
+
const isAwaitLoop = loopNodeList.some((n) => n.metadata?.loopIsAwait);
|
|
16446
16196
|
for (const loopNode of loopNodeList) {
|
|
16447
16197
|
additionalEdges.push({
|
|
16448
16198
|
id: `self_loop_${loopNode.id}`,
|
|
@@ -16459,10 +16209,9 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
16459
16209
|
return { nodes, groupNodes, additionalEdges };
|
|
16460
16210
|
}
|
|
16461
16211
|
function consolidateEdges(edges, nodes) {
|
|
16462
|
-
var _a2;
|
|
16463
16212
|
const nodeToGroup = /* @__PURE__ */ new Map();
|
|
16464
16213
|
for (const node of nodes) {
|
|
16465
|
-
if (
|
|
16214
|
+
if (node.metadata?.parallelGroupId) {
|
|
16466
16215
|
nodeToGroup.set(node.id, node.metadata.parallelGroupId);
|
|
16467
16216
|
}
|
|
16468
16217
|
}
|
|
@@ -16504,7 +16253,6 @@ function consolidateEdges(edges, nodes) {
|
|
|
16504
16253
|
return consolidatedEdges;
|
|
16505
16254
|
}
|
|
16506
16255
|
function convertToReactFlowNodes(workflow) {
|
|
16507
|
-
var _a2;
|
|
16508
16256
|
const { nodes, groupNodes } = calculateEnhancedLayout(workflow);
|
|
16509
16257
|
const nodeToParent = /* @__PURE__ */ new Map();
|
|
16510
16258
|
const groupPositions = /* @__PURE__ */ new Map();
|
|
@@ -16514,7 +16262,7 @@ function convertToReactFlowNodes(workflow) {
|
|
|
16514
16262
|
}
|
|
16515
16263
|
}
|
|
16516
16264
|
for (const node of nodes) {
|
|
16517
|
-
const parallelGroupId =
|
|
16265
|
+
const parallelGroupId = node.metadata?.parallelGroupId ? `group_${node.metadata.parallelGroupId}` : null;
|
|
16518
16266
|
if (parallelGroupId && groupPositions.has(parallelGroupId)) {
|
|
16519
16267
|
nodeToParent.set(node.id, parallelGroupId);
|
|
16520
16268
|
}
|
|
@@ -16539,8 +16287,8 @@ function convertToReactFlowNodes(workflow) {
|
|
|
16539
16287
|
nodes.forEach((node) => {
|
|
16540
16288
|
const styles = getNodeStyle(node.data.nodeKind);
|
|
16541
16289
|
const metadata = node.metadata;
|
|
16542
|
-
const isLoopNode = !!
|
|
16543
|
-
const isAwaitLoop = !!
|
|
16290
|
+
const isLoopNode = !!metadata?.loopId;
|
|
16291
|
+
const isAwaitLoop = !!metadata?.loopIsAwait;
|
|
16544
16292
|
const isConditionalNode = node.data.nodeKind === "conditional";
|
|
16545
16293
|
let nodeType = isConditionalNode ? "diamondNode" : isLoopNode ? "loopNode" : "default";
|
|
16546
16294
|
if (node.type === "workflowStart") {
|
|
@@ -16813,8 +16561,8 @@ function WorkflowGraphViewer({ workflow }) {
|
|
|
16813
16561
|
}
|
|
16814
16562
|
) });
|
|
16815
16563
|
}
|
|
16816
|
-
var
|
|
16817
|
-
var __name = (target, value) =>
|
|
16564
|
+
var __defProp = Object.defineProperty;
|
|
16565
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
16818
16566
|
var DIALOG_NAME = "Dialog";
|
|
16819
16567
|
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
16820
16568
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
@@ -16963,9 +16711,8 @@ var DialogContentModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
16963
16711
|
trapFocus: context.open,
|
|
16964
16712
|
disableOutsidePointerEvents: context.open,
|
|
16965
16713
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
16966
|
-
var _a2;
|
|
16967
16714
|
event.preventDefault();
|
|
16968
|
-
|
|
16715
|
+
context.triggerRef.current?.focus();
|
|
16969
16716
|
}),
|
|
16970
16717
|
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
16971
16718
|
const originalEvent = event.detail.originalEvent;
|
|
@@ -16995,18 +16742,16 @@ var DialogContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
16995
16742
|
trapFocus: false,
|
|
16996
16743
|
disableOutsidePointerEvents: false,
|
|
16997
16744
|
onCloseAutoFocus: (event) => {
|
|
16998
|
-
|
|
16999
|
-
(_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
|
|
16745
|
+
props.onCloseAutoFocus?.(event);
|
|
17000
16746
|
if (!event.defaultPrevented) {
|
|
17001
|
-
if (!hasInteractedOutsideRef.current)
|
|
16747
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
17002
16748
|
event.preventDefault();
|
|
17003
16749
|
}
|
|
17004
16750
|
hasInteractedOutsideRef.current = false;
|
|
17005
16751
|
hasPointerDownOutsideRef.current = false;
|
|
17006
16752
|
},
|
|
17007
16753
|
onInteractOutside: (event) => {
|
|
17008
|
-
|
|
17009
|
-
(_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
|
|
16754
|
+
props.onInteractOutside?.(event);
|
|
17010
16755
|
if (!event.defaultPrevented) {
|
|
17011
16756
|
hasInteractedOutsideRef.current = true;
|
|
17012
16757
|
if (event.detail.originalEvent.type === "pointerdown") {
|
|
@@ -17014,7 +16759,7 @@ var DialogContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
17014
16759
|
}
|
|
17015
16760
|
}
|
|
17016
16761
|
const target = event.target;
|
|
17017
|
-
const targetIsTrigger =
|
|
16762
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
17018
16763
|
if (targetIsTrigger) event.preventDefault();
|
|
17019
16764
|
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
17020
16765
|
event.preventDefault();
|
|
@@ -17128,7 +16873,7 @@ function useOptimisticSearchParams() {
|
|
|
17128
16873
|
const [optimisticParams, setOptimisticParams] = reactExports.useOptimistic(searchParams);
|
|
17129
16874
|
const [, startTransition] = reactExports.useTransition();
|
|
17130
16875
|
const updateSearchParams = reactExports.useCallback(
|
|
17131
|
-
(updates,
|
|
16876
|
+
(updates, options2) => {
|
|
17132
16877
|
const next = new URLSearchParams(optimisticParams);
|
|
17133
16878
|
for (const [key, value] of Object.entries(updates)) {
|
|
17134
16879
|
if (value === null) {
|
|
@@ -17142,7 +16887,7 @@ function useOptimisticSearchParams() {
|
|
|
17142
16887
|
setOptimisticParams(next);
|
|
17143
16888
|
await navigate(
|
|
17144
16889
|
{ search: search ? `?${search}` : "" },
|
|
17145
|
-
{ preventScrollReset: true, ...
|
|
16890
|
+
{ preventScrollReset: true, ...options2 }
|
|
17146
16891
|
);
|
|
17147
16892
|
});
|
|
17148
16893
|
},
|
|
@@ -17151,68 +16896,65 @@ function useOptimisticSearchParams() {
|
|
|
17151
16896
|
return [optimisticParams, updateSearchParams];
|
|
17152
16897
|
}
|
|
17153
16898
|
export {
|
|
17154
|
-
|
|
16899
|
+
DialogTrigger as $,
|
|
17155
16900
|
Alert as A,
|
|
17156
|
-
|
|
16901
|
+
DialogTitle as B,
|
|
17157
16902
|
CopyableText as C,
|
|
17158
|
-
|
|
16903
|
+
DropdownMenu as D,
|
|
17159
16904
|
Ellipsis as E,
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
16905
|
+
DialogDescription as F,
|
|
16906
|
+
DialogPortal as G,
|
|
16907
|
+
DialogOverlay as H,
|
|
16908
|
+
unwrapServerActionResult as I,
|
|
16909
|
+
WorkflowGraphViewer as J,
|
|
16910
|
+
useOptimisticSearchParams as K,
|
|
16911
|
+
TabsList as L,
|
|
16912
|
+
TabsTrigger as M,
|
|
16913
|
+
TabsContent as N,
|
|
16914
|
+
ErrorBoundary as O,
|
|
16915
|
+
findStartHookCreation as P,
|
|
16916
|
+
Wrench as Q,
|
|
17172
16917
|
ResolveHookModal as R,
|
|
17173
16918
|
Send as S,
|
|
17174
16919
|
Tabs as T,
|
|
17175
|
-
|
|
17176
|
-
|
|
16920
|
+
ErrorCard as U,
|
|
16921
|
+
format as V,
|
|
17177
16922
|
WorkflowWebAPIError as W,
|
|
17178
16923
|
X,
|
|
17179
|
-
|
|
16924
|
+
useInfiniteList as Y,
|
|
17180
16925
|
Zap as Z,
|
|
17181
|
-
|
|
16926
|
+
createDialogScope as _,
|
|
17182
16927
|
RelativeTime as a,
|
|
17183
|
-
|
|
17184
|
-
|
|
17185
|
-
|
|
17186
|
-
|
|
17187
|
-
|
|
17188
|
-
|
|
17189
|
-
|
|
17190
|
-
RunActionsButtons as a7,
|
|
17191
|
-
cancelRun as a8,
|
|
17192
|
-
recreateRun as a9,
|
|
16928
|
+
LAYOUT as a0,
|
|
16929
|
+
tabsListClassName as a1,
|
|
16930
|
+
tabsTriggerClassName as a2,
|
|
16931
|
+
wakeUpRun as a3,
|
|
16932
|
+
RunActionsButtons as a4,
|
|
16933
|
+
cancelRun as a5,
|
|
16934
|
+
recreateRun as a6,
|
|
17193
16935
|
AlertTitle as b,
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
16936
|
+
AlertDescription as c,
|
|
16937
|
+
getErrorMessage as d,
|
|
16938
|
+
DropdownMenuTrigger as e,
|
|
17197
16939
|
fetchHookToken as f,
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
16940
|
+
getErrorTitle as g,
|
|
16941
|
+
DropdownMenuContent as h,
|
|
16942
|
+
DropdownMenuItem as i,
|
|
16943
|
+
useDirection as j,
|
|
16944
|
+
createCollection as k,
|
|
16945
|
+
hideOthers as l,
|
|
16946
|
+
useFocusGuards as m,
|
|
16947
|
+
ReactRemoveScroll as n,
|
|
16948
|
+
ChevronUp as o,
|
|
16949
|
+
useWorkflowRunsInfinite as p,
|
|
16950
|
+
bulkCancelRuns as q,
|
|
17209
16951
|
resumeHook as r,
|
|
17210
|
-
|
|
17211
|
-
|
|
16952
|
+
reenqueueRun as s,
|
|
16953
|
+
StatusBadge as t,
|
|
17212
16954
|
unwrapOrThrow as u,
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
16955
|
+
CircleX as v,
|
|
16956
|
+
RunActionsDropdownItems as w,
|
|
16957
|
+
Dialog as x,
|
|
16958
|
+
DialogContent as y,
|
|
16959
|
+
DialogClose as z
|
|
17218
16960
|
};
|