@workflow/web 4.1.34 → 4.1.35
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/{encryption-Cu4jq70Y.js → encryption-BhH0xZid.js} +2 -2
- package/build/client/assets/{entry.client-C7XgFTHI.js → entry.client-CaUKWFDB.js} +13 -35
- package/build/client/assets/{highlighted-body-B3W2YXNL-CK5bxjZc.js → highlighted-body-B3W2YXNL-D5wXP22M.js} +2 -2
- package/build/client/assets/{home-vGjXNC_q.js → home-CjokEfcx.js} +92 -164
- package/build/client/assets/{index-BQ-Xa8kF.js → index-BbkkdbNz.js} +78 -149
- package/build/client/assets/{index-CXBr7N7m.js → index-DY3Cy2uF.js} +20 -23
- package/build/client/assets/{manifest-5d325d67.js → manifest-cbe27963.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-CCVNMOf9.js → mermaid-3ZIDBTTL-8p93TMNC.js} +315 -479
- package/build/client/assets/mermaid-3ZIDBTTL-DHICBbcE.css +1 -0
- package/build/client/assets/{root-DjobWPwY.js → root-D-ZCwNhI.js} +5 -35
- package/build/client/assets/root-DzrclYrK.css +1 -0
- package/build/client/assets/{run-detail-nLEl00wq.js → run-detail-H0o7UsyU.js} +141 -205
- package/build/client/assets/server-build-DMZyIeNn.css +1 -0
- package/build/client/assets/{worker-CqHKTA7D.js → worker-DxRAeS-i.js} +2 -2
- package/build/client/assets/{workflow-graph-viewer-CTw33ANm.js → workflow-graph-viewer-C-MZ2XPV.js} +466 -723
- package/build/server/assets/{app-CYvC9qzx.js → app-BX9dMsx4.js} +67 -153
- package/build/server/assets/{highlighted-body-B3W2YXNL-rgouBaKE.js → highlighted-body-B3W2YXNL-CHc9_Xzp.js} +2 -2
- package/build/server/assets/{index-BUlN7QFn.js → index-BC_EEwAS.js} +2 -2
- package/build/server/assets/{index-DTsZ56KK.js → index-BNN2zck_.js} +3 -3
- package/build/server/assets/{index-CMfOrLiJ.js → index-C-y3EhAf.js} +25 -32
- package/build/server/assets/{mermaid-3ZIDBTTL-DrSJagSv.js → mermaid-3ZIDBTTL-CP_u5jLd.js} +2 -2
- package/build/server/assets/{server-build-Bx0fBara.js → server-build-C0EUGBN0.js} +6483 -7670
- package/build/server/assets/{token-3JN9PPgD.js → token-DYdYwRhs.js} +6 -6
- package/build/server/assets/{token-util-Dq4hPEUy.js → token-util-BZHkMK_T.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +4 -4
- package/build/client/assets/mermaid-3ZIDBTTL-yyHEMZs4.css +0 -1
- package/build/client/assets/root-BOS11TzD.css +0 -1
- package/build/client/assets/server-build-CNEy-GiI.css +0 -1
package/build/client/assets/{workflow-graph-viewer-CTw33ANm.js → workflow-graph-viewer-C-MZ2XPV.js}
RENAMED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { c as createLucideIcon, aK as cn, d as cn$1, G as cva, aL as composeRefs, E as useComposedRefs, aM as useFloating, aN as offset, aO as shift, aP as limitShift, aQ as flip, aR as size, aS as arrow, aT as hide, aU as autoUpdate, T as Tooltip, a as TooltipTrigger, b as TooltipContent, aV as cancelRun$1, aW as reenqueueRun$1, aX as wakeUpRun$1, aY as resumeHook$1, aZ as recreateRun$1, v as createContextScope$1, n as useComposedRefs$1, w as createSlot, _ as formatDuration, B as Button, t as toast, p as useId$1, P as Primitive$1, o as composeEventHandlers$1, x as useControllableState$1, m as useCallbackRef$2, H as Presence$1 } from "./mermaid-3ZIDBTTL-CCVNMOf9.js";
|
|
5
|
-
import { r as reactExports, j as jsxRuntimeExports, f as reactDomExports, R as ReactExports, H as React, D as ReactDOM, a as requireReact, g as getDefaultExportFromCjs } from "./index-BQ-Xa8kF.js";
|
|
6
|
-
import { V as VERCEL_403_ERROR_MESSAGE } from "./index-CXBr7N7m.js";
|
|
1
|
+
import { c as createLucideIcon, aK as cn, d as cn$1, G as cva, aL as composeRefs, E as useComposedRefs, aM as useFloating, aN as offset, aO as shift, aP as limitShift, aQ as flip, aR as size, aS as arrow, aT as hide, aU as autoUpdate, T as Tooltip, a as TooltipTrigger, b as TooltipContent, aV as cancelRun$1, aW as reenqueueRun$1, aX as wakeUpRun$1, aY as resumeHook$1, aZ as recreateRun$1, v as createContextScope$1, n as useComposedRefs$1, w as createSlot, _ as formatDuration, B as Button, t as toast, p as useId$1, P as Primitive$1, o as composeEventHandlers$1, x as useControllableState$1, m as useCallbackRef$2, H as Presence$1 } from "./mermaid-3ZIDBTTL-8p93TMNC.js";
|
|
2
|
+
import { r as reactExports, j as jsxRuntimeExports, f as reactDomExports, R as ReactExports, H as React, D as ReactDOM, a as requireReact, g as getDefaultExportFromCjs } from "./index-BbkkdbNz.js";
|
|
3
|
+
import { V as VERCEL_403_ERROR_MESSAGE } from "./index-DY3Cy2uF.js";
|
|
7
4
|
function parseName(tag, name) {
|
|
8
5
|
if (typeof name !== "string") {
|
|
9
6
|
return null;
|
|
@@ -19,7 +16,7 @@ function parseName(tag, name) {
|
|
|
19
16
|
moduleShortName = moduleSpecifier.split("/").at(-1) ?? "";
|
|
20
17
|
} else {
|
|
21
18
|
const withoutVersion = moduleSpecifier.split("@").slice(0, -1).join("@") || moduleSpecifier.split("@")[0];
|
|
22
|
-
moduleShortName =
|
|
19
|
+
moduleShortName = withoutVersion?.split("/").at(-1) ?? "";
|
|
23
20
|
}
|
|
24
21
|
if (["default", "__default"].includes(shortName) && moduleShortName) {
|
|
25
22
|
shortName = moduleShortName;
|
|
@@ -36,12 +33,6 @@ function parseWorkflowName(name) {
|
|
|
36
33
|
function parseStepName(name) {
|
|
37
34
|
return parseName("step", name);
|
|
38
35
|
}
|
|
39
|
-
/**
|
|
40
|
-
* @license lucide-react v0.575.0 - ISC
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the ISC license.
|
|
43
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/
|
|
45
36
|
const __iconNode$h = [
|
|
46
37
|
["path", { d: "M6.87 6.87a8 8 0 1 0 11.26 11.26", key: "3on8tj" }],
|
|
47
38
|
["path", { d: "M19.9 14.25a8 8 0 0 0-9.15-9.15", key: "15ghsc" }],
|
|
@@ -51,56 +42,20 @@ const __iconNode$h = [
|
|
|
51
42
|
["path", { d: "M4 4 2 6", key: "1ycko6" }]
|
|
52
43
|
];
|
|
53
44
|
const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$h);
|
|
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
45
|
const __iconNode$g = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
61
46
|
const Check = createLucideIcon("check", __iconNode$g);
|
|
62
|
-
/**
|
|
63
|
-
* @license lucide-react v0.575.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/
|
|
68
47
|
const __iconNode$f = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
69
48
|
const ChevronDown = createLucideIcon("chevron-down", __iconNode$f);
|
|
70
|
-
/**
|
|
71
|
-
* @license lucide-react v0.575.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/
|
|
76
49
|
const __iconNode$e = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
77
50
|
const ChevronRight = createLucideIcon("chevron-right", __iconNode$e);
|
|
78
|
-
/**
|
|
79
|
-
* @license lucide-react v0.575.0 - ISC
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the ISC license.
|
|
82
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/
|
|
84
51
|
const __iconNode$d = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
85
52
|
const ChevronUp = createLucideIcon("chevron-up", __iconNode$d);
|
|
86
|
-
/**
|
|
87
|
-
* @license lucide-react v0.575.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/
|
|
92
53
|
const __iconNode$c = [
|
|
93
54
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
94
55
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
95
56
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
96
57
|
];
|
|
97
58
|
const CircleAlert = createLucideIcon("circle-alert", __iconNode$c);
|
|
98
|
-
/**
|
|
99
|
-
* @license lucide-react v0.575.0 - ISC
|
|
100
|
-
*
|
|
101
|
-
* This source code is licensed under the ISC license.
|
|
102
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/
|
|
104
59
|
const __iconNode$b = [
|
|
105
60
|
[
|
|
106
61
|
"path",
|
|
@@ -112,100 +67,46 @@ const __iconNode$b = [
|
|
|
112
67
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
113
68
|
];
|
|
114
69
|
const CirclePlay = createLucideIcon("circle-play", __iconNode$b);
|
|
115
|
-
/**
|
|
116
|
-
* @license lucide-react v0.575.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/
|
|
121
70
|
const __iconNode$a = [
|
|
122
71
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
123
72
|
["rect", { x: "9", y: "9", width: "6", height: "6", rx: "1", key: "1ssd4o" }]
|
|
124
73
|
];
|
|
125
74
|
const CircleStop = createLucideIcon("circle-stop", __iconNode$a);
|
|
126
|
-
/**
|
|
127
|
-
* @license lucide-react v0.575.0 - ISC
|
|
128
|
-
*
|
|
129
|
-
* This source code is licensed under the ISC license.
|
|
130
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/
|
|
132
75
|
const __iconNode$9 = [
|
|
133
76
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
134
77
|
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
135
78
|
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
136
79
|
];
|
|
137
80
|
const CircleX = createLucideIcon("circle-x", __iconNode$9);
|
|
138
|
-
/**
|
|
139
|
-
* @license lucide-react v0.575.0 - ISC
|
|
140
|
-
*
|
|
141
|
-
* This source code is licensed under the ISC license.
|
|
142
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
-
*/
|
|
144
81
|
const __iconNode$8 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
|
|
145
82
|
const Circle = createLucideIcon("circle", __iconNode$8);
|
|
146
|
-
/**
|
|
147
|
-
* @license lucide-react v0.575.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/
|
|
152
83
|
const __iconNode$7 = [
|
|
153
84
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
154
85
|
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
|
|
155
86
|
];
|
|
156
87
|
const Clock = createLucideIcon("clock", __iconNode$7);
|
|
157
|
-
/**
|
|
158
|
-
* @license lucide-react v0.575.0 - ISC
|
|
159
|
-
*
|
|
160
|
-
* This source code is licensed under the ISC license.
|
|
161
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/
|
|
163
88
|
const __iconNode$6 = [
|
|
164
89
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
165
90
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
166
91
|
];
|
|
167
92
|
const Copy = createLucideIcon("copy", __iconNode$6);
|
|
168
|
-
/**
|
|
169
|
-
* @license lucide-react v0.575.0 - ISC
|
|
170
|
-
*
|
|
171
|
-
* This source code is licensed under the ISC license.
|
|
172
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
-
*/
|
|
174
93
|
const __iconNode$5 = [
|
|
175
94
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
176
95
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
177
96
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
178
97
|
];
|
|
179
98
|
const Ellipsis = createLucideIcon("ellipsis", __iconNode$5);
|
|
180
|
-
/**
|
|
181
|
-
* @license lucide-react v0.575.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/
|
|
186
99
|
const __iconNode$4 = [
|
|
187
100
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
188
101
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
189
102
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
190
103
|
];
|
|
191
104
|
const Link2 = createLucideIcon("link-2", __iconNode$4);
|
|
192
|
-
/**
|
|
193
|
-
* @license lucide-react v0.575.0 - ISC
|
|
194
|
-
*
|
|
195
|
-
* This source code is licensed under the ISC license.
|
|
196
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/
|
|
198
105
|
const __iconNode$3 = [
|
|
199
106
|
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
200
107
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
201
108
|
];
|
|
202
109
|
const RotateCw = createLucideIcon("rotate-cw", __iconNode$3);
|
|
203
|
-
/**
|
|
204
|
-
* @license lucide-react v0.575.0 - ISC
|
|
205
|
-
*
|
|
206
|
-
* This source code is licensed under the ISC license.
|
|
207
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/
|
|
209
110
|
const __iconNode$2 = [
|
|
210
111
|
[
|
|
211
112
|
"path",
|
|
@@ -217,23 +118,11 @@ const __iconNode$2 = [
|
|
|
217
118
|
["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
|
|
218
119
|
];
|
|
219
120
|
const Send = createLucideIcon("send", __iconNode$2);
|
|
220
|
-
/**
|
|
221
|
-
* @license lucide-react v0.575.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/
|
|
226
121
|
const __iconNode$1 = [
|
|
227
122
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
228
123
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
229
124
|
];
|
|
230
125
|
const X = createLucideIcon("x", __iconNode$1);
|
|
231
|
-
/**
|
|
232
|
-
* @license lucide-react v0.575.0 - ISC
|
|
233
|
-
*
|
|
234
|
-
* This source code is licensed under the ISC license.
|
|
235
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/
|
|
237
126
|
const __iconNode = [
|
|
238
127
|
[
|
|
239
128
|
"path",
|
|
@@ -263,8 +152,7 @@ class ErrorBoundary extends reactExports.Component {
|
|
|
263
152
|
this.setState({ hasError: false, error: null });
|
|
264
153
|
}
|
|
265
154
|
componentDidCatch(error, errorInfo) {
|
|
266
|
-
|
|
267
|
-
(_b = (_a = this.props).onCatch) == null ? void 0 : _b.call(_a, error, () => this.retry());
|
|
155
|
+
this.props.onCatch?.(error, () => this.retry());
|
|
268
156
|
}
|
|
269
157
|
render() {
|
|
270
158
|
if (this.state.hasError) {
|
|
@@ -272,16 +160,15 @@ class ErrorBoundary extends reactExports.Component {
|
|
|
272
160
|
return this.props.fallback;
|
|
273
161
|
}
|
|
274
162
|
const err = this.state.error instanceof Error ? this.state.error : null;
|
|
275
|
-
const errorDetails =
|
|
163
|
+
const errorDetails = err?.stack ? `${err.message}
|
|
276
164
|
|
|
277
|
-
${err.stack}` :
|
|
165
|
+
${err.stack}` : err?.message ?? "Unknown error";
|
|
278
166
|
return jsxRuntimeExports.jsx(ErrorCard, { title: this.props.title || "An error occurred", details: errorDetails });
|
|
279
167
|
}
|
|
280
168
|
return this.props.children;
|
|
281
169
|
}
|
|
282
170
|
}
|
|
283
171
|
function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
284
|
-
var _a;
|
|
285
172
|
const [jsonInput, setJsonInput] = reactExports.useState("");
|
|
286
173
|
const [parseError, setParseError] = reactExports.useState(null);
|
|
287
174
|
const textareaRef = reactExports.useRef(null);
|
|
@@ -324,7 +211,7 @@ function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
|
324
211
|
e.preventDefault();
|
|
325
212
|
void submitPayload();
|
|
326
213
|
}, [submitPayload]);
|
|
327
|
-
const isMacPlatform = typeof navigator !== "undefined" && (
|
|
214
|
+
const isMacPlatform = typeof navigator !== "undefined" && (navigator.userAgentData?.platform ?? navigator.userAgent).toLowerCase().includes("mac");
|
|
328
215
|
const handleKeyDown = reactExports.useCallback((e) => {
|
|
329
216
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter" && !isSubmitting) {
|
|
330
217
|
e.preventDefault();
|
|
@@ -487,7 +374,7 @@ const millisecondsInMinute = 6e4;
|
|
|
487
374
|
const minutesInYear = 525600;
|
|
488
375
|
const minutesInMonth = 43200;
|
|
489
376
|
const minutesInDay = 1440;
|
|
490
|
-
const constructFromSymbol = Symbol.for("constructDateFrom");
|
|
377
|
+
const constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
|
|
491
378
|
function constructFrom(date2, value) {
|
|
492
379
|
if (typeof date2 === "function") return date2(value);
|
|
493
380
|
if (date2 && typeof date2 === "object" && constructFromSymbol in date2)
|
|
@@ -502,22 +389,21 @@ let defaultOptions$1 = {};
|
|
|
502
389
|
function getDefaultOptions() {
|
|
503
390
|
return defaultOptions$1;
|
|
504
391
|
}
|
|
505
|
-
function startOfWeek(date2,
|
|
506
|
-
var _a, _b, _c, _d;
|
|
392
|
+
function startOfWeek(date2, options2) {
|
|
507
393
|
const defaultOptions2 = getDefaultOptions();
|
|
508
|
-
const weekStartsOn =
|
|
509
|
-
const _date = toDate(date2,
|
|
394
|
+
const weekStartsOn = options2?.weekStartsOn ?? options2?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
395
|
+
const _date = toDate(date2, options2?.in);
|
|
510
396
|
const day = _date.getDay();
|
|
511
397
|
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
512
398
|
_date.setDate(_date.getDate() - diff);
|
|
513
399
|
_date.setHours(0, 0, 0, 0);
|
|
514
400
|
return _date;
|
|
515
401
|
}
|
|
516
|
-
function startOfISOWeek(date2,
|
|
517
|
-
return startOfWeek(date2, { ...
|
|
402
|
+
function startOfISOWeek(date2, options2) {
|
|
403
|
+
return startOfWeek(date2, { ...options2, weekStartsOn: 1 });
|
|
518
404
|
}
|
|
519
|
-
function getISOWeekYear(date2,
|
|
520
|
-
const _date = toDate(date2,
|
|
405
|
+
function getISOWeekYear(date2, options2) {
|
|
406
|
+
const _date = toDate(date2, options2?.in);
|
|
521
407
|
const year = _date.getFullYear();
|
|
522
408
|
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
523
409
|
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
@@ -558,14 +444,14 @@ function normalizeDates(context, ...dates) {
|
|
|
558
444
|
);
|
|
559
445
|
return dates.map(normalize);
|
|
560
446
|
}
|
|
561
|
-
function startOfDay(date2,
|
|
562
|
-
const _date = toDate(date2,
|
|
447
|
+
function startOfDay(date2, options2) {
|
|
448
|
+
const _date = toDate(date2, options2?.in);
|
|
563
449
|
_date.setHours(0, 0, 0, 0);
|
|
564
450
|
return _date;
|
|
565
451
|
}
|
|
566
|
-
function differenceInCalendarDays(laterDate, earlierDate,
|
|
452
|
+
function differenceInCalendarDays(laterDate, earlierDate, options2) {
|
|
567
453
|
const [laterDate_, earlierDate_] = normalizeDates(
|
|
568
|
-
|
|
454
|
+
options2?.in,
|
|
569
455
|
laterDate,
|
|
570
456
|
earlierDate
|
|
571
457
|
);
|
|
@@ -575,8 +461,8 @@ function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
|
575
461
|
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
576
462
|
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
577
463
|
}
|
|
578
|
-
function startOfISOWeekYear(date2,
|
|
579
|
-
const year = getISOWeekYear(date2,
|
|
464
|
+
function startOfISOWeekYear(date2, options2) {
|
|
465
|
+
const year = getISOWeekYear(date2, options2);
|
|
580
466
|
const fourthOfJanuary = constructFrom(date2, 0);
|
|
581
467
|
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
582
468
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
@@ -604,8 +490,8 @@ function getRoundingMethod(method) {
|
|
|
604
490
|
return result === 0 ? 0 : result;
|
|
605
491
|
};
|
|
606
492
|
}
|
|
607
|
-
function startOfYear(date2,
|
|
608
|
-
const date_ = toDate(date2,
|
|
493
|
+
function startOfYear(date2, options2) {
|
|
494
|
+
const date_ = toDate(date2, options2?.in);
|
|
609
495
|
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
610
496
|
date_.setHours(0, 0, 0, 0);
|
|
611
497
|
return date_;
|
|
@@ -673,7 +559,7 @@ const formatDistanceLocale = {
|
|
|
673
559
|
other: "almost {{count}} years"
|
|
674
560
|
}
|
|
675
561
|
};
|
|
676
|
-
const formatDistance = (token, count2,
|
|
562
|
+
const formatDistance = (token, count2, options2) => {
|
|
677
563
|
let result;
|
|
678
564
|
const tokenValue = formatDistanceLocale[token];
|
|
679
565
|
if (typeof tokenValue === "string") {
|
|
@@ -683,8 +569,8 @@ const formatDistance = (token, count2, options) => {
|
|
|
683
569
|
} else {
|
|
684
570
|
result = tokenValue.other.replace("{{count}}", count2.toString());
|
|
685
571
|
}
|
|
686
|
-
if (
|
|
687
|
-
if (
|
|
572
|
+
if (options2?.addSuffix) {
|
|
573
|
+
if (options2.comparison && options2.comparison > 0) {
|
|
688
574
|
return "in " + result;
|
|
689
575
|
} else {
|
|
690
576
|
return result + " ago";
|
|
@@ -693,8 +579,8 @@ const formatDistance = (token, count2, options) => {
|
|
|
693
579
|
return result;
|
|
694
580
|
};
|
|
695
581
|
function buildFormatLongFn(args) {
|
|
696
|
-
return (
|
|
697
|
-
const width =
|
|
582
|
+
return (options2 = {}) => {
|
|
583
|
+
const width = options2.width ? String(options2.width) : args.defaultWidth;
|
|
698
584
|
const format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
699
585
|
return format2;
|
|
700
586
|
};
|
|
@@ -741,16 +627,16 @@ const formatRelativeLocale = {
|
|
|
741
627
|
};
|
|
742
628
|
const formatRelative$1 = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
743
629
|
function buildLocalizeFn(args) {
|
|
744
|
-
return (value,
|
|
745
|
-
const context =
|
|
630
|
+
return (value, options2) => {
|
|
631
|
+
const context = options2?.context ? String(options2.context) : "standalone";
|
|
746
632
|
let valuesArray;
|
|
747
633
|
if (context === "formatting" && args.formattingValues) {
|
|
748
634
|
const defaultWidth2 = args.defaultFormattingWidth || args.defaultWidth;
|
|
749
|
-
const width =
|
|
635
|
+
const width = options2?.width ? String(options2.width) : defaultWidth2;
|
|
750
636
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth2];
|
|
751
637
|
} else {
|
|
752
638
|
const defaultWidth2 = args.defaultWidth;
|
|
753
|
-
const width =
|
|
639
|
+
const width = options2?.width ? String(options2.width) : args.defaultWidth;
|
|
754
640
|
valuesArray = args.values[width] || args.values[defaultWidth2];
|
|
755
641
|
}
|
|
756
642
|
const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
@@ -918,8 +804,8 @@ const localize = {
|
|
|
918
804
|
})
|
|
919
805
|
};
|
|
920
806
|
function buildMatchFn(args) {
|
|
921
|
-
return (string,
|
|
922
|
-
const width =
|
|
807
|
+
return (string, options2 = {}) => {
|
|
808
|
+
const width = options2.width;
|
|
923
809
|
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
924
810
|
const matchResult = string.match(matchPattern);
|
|
925
811
|
if (!matchResult) {
|
|
@@ -933,9 +819,9 @@ function buildMatchFn(args) {
|
|
|
933
819
|
);
|
|
934
820
|
let value;
|
|
935
821
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
936
|
-
value =
|
|
822
|
+
value = options2.valueCallback ? (
|
|
937
823
|
// [TODO] -- I challenge you to fix the type
|
|
938
|
-
|
|
824
|
+
options2.valueCallback(value)
|
|
939
825
|
) : value;
|
|
940
826
|
const rest = string.slice(matchedString.length);
|
|
941
827
|
return { value, rest };
|
|
@@ -958,14 +844,14 @@ function findIndex(array2, predicate) {
|
|
|
958
844
|
return void 0;
|
|
959
845
|
}
|
|
960
846
|
function buildMatchPatternFn(args) {
|
|
961
|
-
return (string,
|
|
847
|
+
return (string, options2 = {}) => {
|
|
962
848
|
const matchResult = string.match(args.matchPattern);
|
|
963
849
|
if (!matchResult) return null;
|
|
964
850
|
const matchedString = matchResult[0];
|
|
965
851
|
const parseResult = string.match(args.parsePattern);
|
|
966
852
|
if (!parseResult) return null;
|
|
967
853
|
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
968
|
-
value =
|
|
854
|
+
value = options2.valueCallback ? options2.valueCallback(value) : value;
|
|
969
855
|
const rest = string.slice(matchedString.length);
|
|
970
856
|
return { value, rest };
|
|
971
857
|
};
|
|
@@ -1099,31 +985,30 @@ const enUS = {
|
|
|
1099
985
|
firstWeekContainsDate: 1
|
|
1100
986
|
}
|
|
1101
987
|
};
|
|
1102
|
-
function getDayOfYear(date2,
|
|
1103
|
-
const _date = toDate(date2,
|
|
988
|
+
function getDayOfYear(date2, options2) {
|
|
989
|
+
const _date = toDate(date2, options2?.in);
|
|
1104
990
|
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
1105
991
|
const dayOfYear = diff + 1;
|
|
1106
992
|
return dayOfYear;
|
|
1107
993
|
}
|
|
1108
|
-
function getISOWeek(date2,
|
|
1109
|
-
const _date = toDate(date2,
|
|
994
|
+
function getISOWeek(date2, options2) {
|
|
995
|
+
const _date = toDate(date2, options2?.in);
|
|
1110
996
|
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
1111
997
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1112
998
|
}
|
|
1113
|
-
function getWeekYear(date2,
|
|
1114
|
-
|
|
1115
|
-
const _date = toDate(date2, options == null ? void 0 : options.in);
|
|
999
|
+
function getWeekYear(date2, options2) {
|
|
1000
|
+
const _date = toDate(date2, options2?.in);
|
|
1116
1001
|
const year = _date.getFullYear();
|
|
1117
1002
|
const defaultOptions2 = getDefaultOptions();
|
|
1118
|
-
const firstWeekContainsDate =
|
|
1119
|
-
const firstWeekOfNextYear = constructFrom(
|
|
1003
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1004
|
+
const firstWeekOfNextYear = constructFrom(options2?.in || date2, 0);
|
|
1120
1005
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
1121
1006
|
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
1122
|
-
const startOfNextYear = startOfWeek(firstWeekOfNextYear,
|
|
1123
|
-
const firstWeekOfThisYear = constructFrom(
|
|
1007
|
+
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options2);
|
|
1008
|
+
const firstWeekOfThisYear = constructFrom(options2?.in || date2, 0);
|
|
1124
1009
|
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
1125
1010
|
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
1126
|
-
const startOfThisYear = startOfWeek(firstWeekOfThisYear,
|
|
1011
|
+
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options2);
|
|
1127
1012
|
if (+_date >= +startOfNextYear) {
|
|
1128
1013
|
return year + 1;
|
|
1129
1014
|
} else if (+_date >= +startOfThisYear) {
|
|
@@ -1132,20 +1017,19 @@ function getWeekYear(date2, options) {
|
|
|
1132
1017
|
return year - 1;
|
|
1133
1018
|
}
|
|
1134
1019
|
}
|
|
1135
|
-
function startOfWeekYear(date2,
|
|
1136
|
-
var _a, _b, _c, _d;
|
|
1020
|
+
function startOfWeekYear(date2, options2) {
|
|
1137
1021
|
const defaultOptions2 = getDefaultOptions();
|
|
1138
|
-
const firstWeekContainsDate =
|
|
1139
|
-
const year = getWeekYear(date2,
|
|
1140
|
-
const firstWeek = constructFrom(
|
|
1022
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1023
|
+
const year = getWeekYear(date2, options2);
|
|
1024
|
+
const firstWeek = constructFrom(options2?.in || date2, 0);
|
|
1141
1025
|
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
1142
1026
|
firstWeek.setHours(0, 0, 0, 0);
|
|
1143
|
-
const _date = startOfWeek(firstWeek,
|
|
1027
|
+
const _date = startOfWeek(firstWeek, options2);
|
|
1144
1028
|
return _date;
|
|
1145
1029
|
}
|
|
1146
|
-
function getWeek(date2,
|
|
1147
|
-
const _date = toDate(date2,
|
|
1148
|
-
const diff = +startOfWeek(_date,
|
|
1030
|
+
function getWeek(date2, options2) {
|
|
1031
|
+
const _date = toDate(date2, options2?.in);
|
|
1032
|
+
const diff = +startOfWeek(_date, options2) - +startOfWeekYear(_date, options2);
|
|
1149
1033
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
1150
1034
|
}
|
|
1151
1035
|
function addLeadingZeros(number, targetLength) {
|
|
@@ -1248,8 +1132,8 @@ const formatters = {
|
|
|
1248
1132
|
return lightFormatters.y(date2, token);
|
|
1249
1133
|
},
|
|
1250
1134
|
// Local week-numbering year
|
|
1251
|
-
Y: function(date2, token, localize2,
|
|
1252
|
-
const signedWeekYear = getWeekYear(date2,
|
|
1135
|
+
Y: function(date2, token, localize2, options2) {
|
|
1136
|
+
const signedWeekYear = getWeekYear(date2, options2);
|
|
1253
1137
|
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
1254
1138
|
if (token === "YY") {
|
|
1255
1139
|
const twoDigitYear = weekYear % 100;
|
|
@@ -1406,8 +1290,8 @@ const formatters = {
|
|
|
1406
1290
|
}
|
|
1407
1291
|
},
|
|
1408
1292
|
// Local week of year
|
|
1409
|
-
w: function(date2, token, localize2,
|
|
1410
|
-
const week = getWeek(date2,
|
|
1293
|
+
w: function(date2, token, localize2, options2) {
|
|
1294
|
+
const week = getWeek(date2, options2);
|
|
1411
1295
|
if (token === "wo") {
|
|
1412
1296
|
return localize2.ordinalNumber(week, { unit: "week" });
|
|
1413
1297
|
}
|
|
@@ -1470,9 +1354,9 @@ const formatters = {
|
|
|
1470
1354
|
}
|
|
1471
1355
|
},
|
|
1472
1356
|
// Local day of week
|
|
1473
|
-
e: function(date2, token, localize2,
|
|
1357
|
+
e: function(date2, token, localize2, options2) {
|
|
1474
1358
|
const dayOfWeek = date2.getDay();
|
|
1475
|
-
const localDayOfWeek = (dayOfWeek -
|
|
1359
|
+
const localDayOfWeek = (dayOfWeek - options2.weekStartsOn + 8) % 7 || 7;
|
|
1476
1360
|
switch (token) {
|
|
1477
1361
|
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
1478
1362
|
case "e":
|
|
@@ -1510,9 +1394,9 @@ const formatters = {
|
|
|
1510
1394
|
}
|
|
1511
1395
|
},
|
|
1512
1396
|
// Stand-alone local day of week
|
|
1513
|
-
c: function(date2, token, localize2,
|
|
1397
|
+
c: function(date2, token, localize2, options2) {
|
|
1514
1398
|
const dayOfWeek = date2.getDay();
|
|
1515
|
-
const localDayOfWeek = (dayOfWeek -
|
|
1399
|
+
const localDayOfWeek = (dayOfWeek - options2.weekStartsOn + 8) % 7 || 7;
|
|
1516
1400
|
switch (token) {
|
|
1517
1401
|
// Numerical value (same as in `e`)
|
|
1518
1402
|
case "c":
|
|
@@ -1931,13 +1815,12 @@ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
|
1931
1815
|
const escapedStringRegExp = /^'([^]*?)'?$/;
|
|
1932
1816
|
const doubleQuoteRegExp = /''/g;
|
|
1933
1817
|
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
1934
|
-
function format(date2, formatStr,
|
|
1935
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1818
|
+
function format(date2, formatStr, options2) {
|
|
1936
1819
|
const defaultOptions2 = getDefaultOptions();
|
|
1937
|
-
const locale =
|
|
1938
|
-
const firstWeekContainsDate =
|
|
1939
|
-
const weekStartsOn =
|
|
1940
|
-
const originalDate = toDate(date2,
|
|
1820
|
+
const locale = options2?.locale ?? defaultOptions2.locale ?? enUS;
|
|
1821
|
+
const firstWeekContainsDate = options2?.firstWeekContainsDate ?? options2?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
|
|
1822
|
+
const weekStartsOn = options2?.weekStartsOn ?? options2?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
1823
|
+
const originalDate = toDate(date2, options2?.in);
|
|
1941
1824
|
if (!isValid(originalDate)) {
|
|
1942
1825
|
throw new RangeError("Invalid time value");
|
|
1943
1826
|
}
|
|
@@ -1977,7 +1860,7 @@ function format(date2, formatStr, options) {
|
|
|
1977
1860
|
return parts.map((part) => {
|
|
1978
1861
|
if (!part.isToken) return part.value;
|
|
1979
1862
|
const token = part.value;
|
|
1980
|
-
if (!
|
|
1863
|
+
if (!options2?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options2?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
|
|
1981
1864
|
warnOrThrowProtectedError(token, formatStr, String(date2));
|
|
1982
1865
|
}
|
|
1983
1866
|
const formatter = formatters[token[0]];
|
|
@@ -1991,27 +1874,27 @@ function cleanEscapedString(input) {
|
|
|
1991
1874
|
}
|
|
1992
1875
|
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
1993
1876
|
}
|
|
1994
|
-
function formatDistanceStrict(laterDate, earlierDate,
|
|
1877
|
+
function formatDistanceStrict(laterDate, earlierDate, options2) {
|
|
1995
1878
|
const defaultOptions2 = getDefaultOptions();
|
|
1996
|
-
const locale =
|
|
1879
|
+
const locale = options2?.locale ?? defaultOptions2.locale ?? enUS;
|
|
1997
1880
|
const comparison = compareAsc(laterDate, earlierDate);
|
|
1998
1881
|
if (isNaN(comparison)) {
|
|
1999
1882
|
throw new RangeError("Invalid time value");
|
|
2000
1883
|
}
|
|
2001
|
-
const localizeOptions = Object.assign({},
|
|
2002
|
-
addSuffix:
|
|
1884
|
+
const localizeOptions = Object.assign({}, options2, {
|
|
1885
|
+
addSuffix: options2?.addSuffix,
|
|
2003
1886
|
comparison
|
|
2004
1887
|
});
|
|
2005
1888
|
const [laterDate_, earlierDate_] = normalizeDates(
|
|
2006
|
-
|
|
1889
|
+
options2?.in,
|
|
2007
1890
|
...comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]
|
|
2008
1891
|
);
|
|
2009
|
-
const roundingMethod = getRoundingMethod(
|
|
1892
|
+
const roundingMethod = getRoundingMethod(options2?.roundingMethod ?? "round");
|
|
2010
1893
|
const milliseconds = earlierDate_.getTime() - laterDate_.getTime();
|
|
2011
1894
|
const minutes = milliseconds / millisecondsInMinute;
|
|
2012
1895
|
const timezoneOffset = getTimezoneOffsetInMilliseconds(earlierDate_) - getTimezoneOffsetInMilliseconds(laterDate_);
|
|
2013
1896
|
const dstNormalizedMinutes = (milliseconds - timezoneOffset) / millisecondsInMinute;
|
|
2014
|
-
const defaultUnit =
|
|
1897
|
+
const defaultUnit = options2?.unit;
|
|
2015
1898
|
let unit;
|
|
2016
1899
|
if (!defaultUnit) {
|
|
2017
1900
|
if (minutes < 1) {
|
|
@@ -2050,15 +1933,14 @@ function formatDistanceStrict(laterDate, earlierDate, options) {
|
|
|
2050
1933
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
2051
1934
|
}
|
|
2052
1935
|
}
|
|
2053
|
-
function formatDistanceToNowStrict(date2,
|
|
2054
|
-
return formatDistanceStrict(date2, constructNow(date2),
|
|
1936
|
+
function formatDistanceToNowStrict(date2, options2) {
|
|
1937
|
+
return formatDistanceStrict(date2, constructNow(date2), options2);
|
|
2055
1938
|
}
|
|
2056
|
-
function formatRelative(date2, baseDate,
|
|
2057
|
-
|
|
2058
|
-
const [date_, baseDate_] = normalizeDates(options == null ? void 0 : options.in, date2, baseDate);
|
|
1939
|
+
function formatRelative(date2, baseDate, options2) {
|
|
1940
|
+
const [date_, baseDate_] = normalizeDates(options2?.in, date2, baseDate);
|
|
2059
1941
|
const defaultOptions2 = getDefaultOptions();
|
|
2060
1942
|
const locale = defaultOptions2.locale ?? enUS;
|
|
2061
|
-
const weekStartsOn = defaultOptions2.weekStartsOn ??
|
|
1943
|
+
const weekStartsOn = defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
|
|
2062
1944
|
const diff = differenceInCalendarDays(date_, baseDate_);
|
|
2063
1945
|
if (isNaN(diff)) {
|
|
2064
1946
|
throw new RangeError("Invalid time value");
|
|
@@ -2204,9 +2086,9 @@ const AlertDescription = reactExports.forwardRef(({ className, ...props }, ref)
|
|
|
2204
2086
|
AlertDescription.displayName = "AlertDescription";
|
|
2205
2087
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
2206
2088
|
return function handleEvent(event) {
|
|
2207
|
-
originalEventHandler
|
|
2089
|
+
originalEventHandler?.(event);
|
|
2208
2090
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
2209
|
-
return ourEventHandler
|
|
2091
|
+
return ourEventHandler?.(event);
|
|
2210
2092
|
}
|
|
2211
2093
|
};
|
|
2212
2094
|
}
|
|
@@ -2233,16 +2115,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
2233
2115
|
const index2 = defaultContexts.length;
|
|
2234
2116
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
2235
2117
|
const Provider2 = (props) => {
|
|
2236
|
-
var _a;
|
|
2237
2118
|
const { scope, children: children2, ...context } = props;
|
|
2238
|
-
const Context =
|
|
2119
|
+
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
2239
2120
|
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
2240
2121
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children: children2 });
|
|
2241
2122
|
};
|
|
2242
2123
|
Provider2.displayName = rootComponentName + "Provider";
|
|
2243
2124
|
function useContext2(consumerName, scope) {
|
|
2244
|
-
|
|
2245
|
-
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
2125
|
+
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
2246
2126
|
const context = reactExports.useContext(Context);
|
|
2247
2127
|
if (context) return context;
|
|
2248
2128
|
if (defaultContext !== void 0) return defaultContext;
|
|
@@ -2255,7 +2135,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
2255
2135
|
return reactExports.createContext(defaultContext);
|
|
2256
2136
|
});
|
|
2257
2137
|
return function useScope(scope) {
|
|
2258
|
-
const contexts =
|
|
2138
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
2259
2139
|
return reactExports.useMemo(
|
|
2260
2140
|
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
2261
2141
|
[scope, contexts]
|
|
@@ -2290,10 +2170,7 @@ function useCallbackRef$1(callback) {
|
|
|
2290
2170
|
reactExports.useEffect(() => {
|
|
2291
2171
|
callbackRef.current = callback;
|
|
2292
2172
|
});
|
|
2293
|
-
return reactExports.useMemo(() => (...args) =>
|
|
2294
|
-
var _a;
|
|
2295
|
-
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
2296
|
-
}, []);
|
|
2173
|
+
return reactExports.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
2297
2174
|
}
|
|
2298
2175
|
function useControllableState({
|
|
2299
2176
|
prop,
|
|
@@ -2397,13 +2274,12 @@ function mergeProps(slotProps, childProps) {
|
|
|
2397
2274
|
return { ...slotProps, ...overrideProps };
|
|
2398
2275
|
}
|
|
2399
2276
|
function getElementRef$1(element) {
|
|
2400
|
-
|
|
2401
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
2277
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
2402
2278
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2403
2279
|
if (mayWarn) {
|
|
2404
2280
|
return element.ref;
|
|
2405
2281
|
}
|
|
2406
|
-
getter =
|
|
2282
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
2407
2283
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2408
2284
|
if (mayWarn) {
|
|
2409
2285
|
return element.props.ref;
|
|
@@ -2433,7 +2309,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
2433
2309
|
const { asChild, ...primitiveProps } = props;
|
|
2434
2310
|
const Comp = asChild ? Slot : node;
|
|
2435
2311
|
if (typeof window !== "undefined") {
|
|
2436
|
-
window[Symbol.for("radix-ui")] = true;
|
|
2312
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
2437
2313
|
}
|
|
2438
2314
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2439
2315
|
});
|
|
@@ -2508,7 +2384,7 @@ function useDirection$1(localDir) {
|
|
|
2508
2384
|
const globalDir = reactExports.useContext(DirectionContext$1);
|
|
2509
2385
|
return localDir || globalDir || "ltr";
|
|
2510
2386
|
}
|
|
2511
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis
|
|
2387
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
2512
2388
|
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
2513
2389
|
reactExports.useEffect(() => {
|
|
2514
2390
|
const handleKeyDown = (event) => {
|
|
@@ -2543,7 +2419,7 @@ var DismissableLayer = reactExports.forwardRef(
|
|
|
2543
2419
|
} = props;
|
|
2544
2420
|
const context = reactExports.useContext(DismissableLayerContext);
|
|
2545
2421
|
const [node, setNode] = reactExports.useState(null);
|
|
2546
|
-
const ownerDocument =
|
|
2422
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
2547
2423
|
const [, force] = reactExports.useState({});
|
|
2548
2424
|
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
2549
2425
|
const layers = Array.from(context.layers);
|
|
@@ -2556,22 +2432,22 @@ var DismissableLayer = reactExports.forwardRef(
|
|
|
2556
2432
|
const target = event.target;
|
|
2557
2433
|
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2558
2434
|
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
2559
|
-
onPointerDownOutside
|
|
2560
|
-
onInteractOutside
|
|
2561
|
-
if (!event.defaultPrevented) onDismiss
|
|
2435
|
+
onPointerDownOutside?.(event);
|
|
2436
|
+
onInteractOutside?.(event);
|
|
2437
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
2562
2438
|
}, ownerDocument);
|
|
2563
2439
|
const focusOutside = useFocusOutside((event) => {
|
|
2564
2440
|
const target = event.target;
|
|
2565
2441
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2566
2442
|
if (isFocusInBranch) return;
|
|
2567
|
-
onFocusOutside
|
|
2568
|
-
onInteractOutside
|
|
2569
|
-
if (!event.defaultPrevented) onDismiss
|
|
2443
|
+
onFocusOutside?.(event);
|
|
2444
|
+
onInteractOutside?.(event);
|
|
2445
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
2570
2446
|
}, ownerDocument);
|
|
2571
2447
|
useEscapeKeydown((event) => {
|
|
2572
2448
|
const isHighestLayer = index2 === context.layers.size - 1;
|
|
2573
2449
|
if (!isHighestLayer) return;
|
|
2574
|
-
onEscapeKeyDown
|
|
2450
|
+
onEscapeKeyDown?.(event);
|
|
2575
2451
|
if (!event.defaultPrevented && onDismiss) {
|
|
2576
2452
|
event.preventDefault();
|
|
2577
2453
|
onDismiss();
|
|
@@ -2644,7 +2520,7 @@ var DismissableLayerBranch = reactExports.forwardRef((props, forwardedRef) => {
|
|
|
2644
2520
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
2645
2521
|
});
|
|
2646
2522
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
2647
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
|
|
2523
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
2648
2524
|
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
2649
2525
|
const isPointerInsideReactTreeRef = reactExports.useRef(false);
|
|
2650
2526
|
const handleClickRef = reactExports.useRef(() => {
|
|
@@ -2687,7 +2563,7 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
|
|
|
2687
2563
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
2688
2564
|
};
|
|
2689
2565
|
}
|
|
2690
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis
|
|
2566
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
2691
2567
|
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
2692
2568
|
const isFocusInsideReactTreeRef = reactExports.useRef(false);
|
|
2693
2569
|
reactExports.useEffect(() => {
|
|
@@ -2923,15 +2799,14 @@ function createFocusScopesStack() {
|
|
|
2923
2799
|
add(focusScope) {
|
|
2924
2800
|
const activeFocusScope = stack[0];
|
|
2925
2801
|
if (focusScope !== activeFocusScope) {
|
|
2926
|
-
activeFocusScope
|
|
2802
|
+
activeFocusScope?.pause();
|
|
2927
2803
|
}
|
|
2928
2804
|
stack = arrayRemove(stack, focusScope);
|
|
2929
2805
|
stack.unshift(focusScope);
|
|
2930
2806
|
},
|
|
2931
2807
|
remove(focusScope) {
|
|
2932
|
-
var _a;
|
|
2933
2808
|
stack = arrayRemove(stack, focusScope);
|
|
2934
|
-
|
|
2809
|
+
stack[0]?.resume();
|
|
2935
2810
|
}
|
|
2936
2811
|
};
|
|
2937
2812
|
}
|
|
@@ -2946,7 +2821,7 @@ function arrayRemove(array2, item) {
|
|
|
2946
2821
|
function removeLinks(items) {
|
|
2947
2822
|
return items.filter((item) => item.tagName !== "A");
|
|
2948
2823
|
}
|
|
2949
|
-
var useLayoutEffect2 = Boolean(globalThis
|
|
2824
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? reactExports.useLayoutEffect : () => {
|
|
2950
2825
|
};
|
|
2951
2826
|
var useReactId = React["useId".toString()] || (() => void 0);
|
|
2952
2827
|
var count = 0;
|
|
@@ -3026,7 +2901,7 @@ var PopperAnchor = reactExports.forwardRef(
|
|
|
3026
2901
|
const ref = reactExports.useRef(null);
|
|
3027
2902
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
3028
2903
|
reactExports.useEffect(() => {
|
|
3029
|
-
context.onAnchorChange(
|
|
2904
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
3030
2905
|
});
|
|
3031
2906
|
return virtualRef ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
3032
2907
|
}
|
|
@@ -3036,7 +2911,6 @@ var CONTENT_NAME$3 = "PopperContent";
|
|
|
3036
2911
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$3);
|
|
3037
2912
|
var PopperContent = reactExports.forwardRef(
|
|
3038
2913
|
(props, forwardedRef) => {
|
|
3039
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3040
2914
|
const {
|
|
3041
2915
|
__scopePopper,
|
|
3042
2916
|
side = "bottom",
|
|
@@ -3058,8 +2932,8 @@ var PopperContent = reactExports.forwardRef(
|
|
|
3058
2932
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
3059
2933
|
const [arrow$1, setArrow] = reactExports.useState(null);
|
|
3060
2934
|
const arrowSize = useSize(arrow$1);
|
|
3061
|
-
const arrowWidth =
|
|
3062
|
-
const arrowHeight =
|
|
2935
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
2936
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
3063
2937
|
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
3064
2938
|
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
3065
2939
|
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
@@ -3112,12 +2986,12 @@ var PopperContent = reactExports.forwardRef(
|
|
|
3112
2986
|
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
3113
2987
|
useLayoutEffect2(() => {
|
|
3114
2988
|
if (isPositioned) {
|
|
3115
|
-
handlePlaced
|
|
2989
|
+
handlePlaced?.();
|
|
3116
2990
|
}
|
|
3117
2991
|
}, [isPositioned, handlePlaced]);
|
|
3118
|
-
const arrowX =
|
|
3119
|
-
const arrowY =
|
|
3120
|
-
const cannotCenterArrow =
|
|
2992
|
+
const arrowX = middlewareData.arrow?.x;
|
|
2993
|
+
const arrowY = middlewareData.arrow?.y;
|
|
2994
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
3121
2995
|
const [contentZIndex, setContentZIndex] = reactExports.useState();
|
|
3122
2996
|
useLayoutEffect2(() => {
|
|
3123
2997
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
@@ -3134,13 +3008,13 @@ var PopperContent = reactExports.forwardRef(
|
|
|
3134
3008
|
minWidth: "max-content",
|
|
3135
3009
|
zIndex: contentZIndex,
|
|
3136
3010
|
["--radix-popper-transform-origin"]: [
|
|
3137
|
-
|
|
3138
|
-
|
|
3011
|
+
middlewareData.transformOrigin?.x,
|
|
3012
|
+
middlewareData.transformOrigin?.y
|
|
3139
3013
|
].join(" "),
|
|
3140
3014
|
// hide the content if using the hide middleware and should be hidden
|
|
3141
3015
|
// set visibility to hidden and disable pointer events so the UI behaves
|
|
3142
3016
|
// as if the PopperContent isn't there at all
|
|
3143
|
-
...
|
|
3017
|
+
...middlewareData.hide?.referenceHidden && {
|
|
3144
3018
|
visibility: "hidden",
|
|
3145
3019
|
pointerEvents: "none"
|
|
3146
3020
|
}
|
|
@@ -3235,20 +3109,19 @@ PopperArrow.displayName = ARROW_NAME$2;
|
|
|
3235
3109
|
function isNotNull(value) {
|
|
3236
3110
|
return value !== null;
|
|
3237
3111
|
}
|
|
3238
|
-
var transformOrigin = (
|
|
3112
|
+
var transformOrigin = (options2) => ({
|
|
3239
3113
|
name: "transformOrigin",
|
|
3240
|
-
options,
|
|
3114
|
+
options: options2,
|
|
3241
3115
|
fn(data) {
|
|
3242
|
-
var _a, _b, _c;
|
|
3243
3116
|
const { placement, rects, middlewareData } = data;
|
|
3244
|
-
const cannotCenterArrow =
|
|
3117
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
3245
3118
|
const isArrowHidden = cannotCenterArrow;
|
|
3246
|
-
const arrowWidth = isArrowHidden ? 0 :
|
|
3247
|
-
const arrowHeight = isArrowHidden ? 0 :
|
|
3119
|
+
const arrowWidth = isArrowHidden ? 0 : options2.arrowWidth;
|
|
3120
|
+
const arrowHeight = isArrowHidden ? 0 : options2.arrowHeight;
|
|
3248
3121
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
3249
3122
|
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
3250
|
-
const arrowXCenter = (
|
|
3251
|
-
const arrowYCenter = (
|
|
3123
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
3124
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
3252
3125
|
let x = "";
|
|
3253
3126
|
let y = "";
|
|
3254
3127
|
if (placedSide === "bottom") {
|
|
@@ -3277,11 +3150,10 @@ var Content$1 = PopperContent;
|
|
|
3277
3150
|
var Arrow = PopperArrow;
|
|
3278
3151
|
var PORTAL_NAME$2 = "Portal";
|
|
3279
3152
|
var Portal$1 = reactExports.forwardRef((props, forwardedRef) => {
|
|
3280
|
-
var _a;
|
|
3281
3153
|
const { container: containerProp, ...portalProps } = props;
|
|
3282
3154
|
const [mounted, setMounted] = reactExports.useState(false);
|
|
3283
3155
|
useLayoutEffect2(() => setMounted(true), []);
|
|
3284
|
-
const container = containerProp || mounted &&
|
|
3156
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
3285
3157
|
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
3286
3158
|
});
|
|
3287
3159
|
Portal$1.displayName = PORTAL_NAME$2;
|
|
@@ -3332,7 +3204,7 @@ function usePresence(present) {
|
|
|
3332
3204
|
const currentAnimationName = getAnimationName(styles);
|
|
3333
3205
|
if (present) {
|
|
3334
3206
|
send("MOUNT");
|
|
3335
|
-
} else if (currentAnimationName === "none" ||
|
|
3207
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
3336
3208
|
send("UNMOUNT");
|
|
3337
3209
|
} else {
|
|
3338
3210
|
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
@@ -3392,16 +3264,15 @@ function usePresence(present) {
|
|
|
3392
3264
|
};
|
|
3393
3265
|
}
|
|
3394
3266
|
function getAnimationName(styles) {
|
|
3395
|
-
return
|
|
3267
|
+
return styles?.animationName || "none";
|
|
3396
3268
|
}
|
|
3397
3269
|
function getElementRef(element) {
|
|
3398
|
-
|
|
3399
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
3270
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
3400
3271
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
3401
3272
|
if (mayWarn) {
|
|
3402
3273
|
return element.ref;
|
|
3403
3274
|
}
|
|
3404
|
-
getter =
|
|
3275
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
3405
3276
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
3406
3277
|
if (mayWarn) {
|
|
3407
3278
|
return element.props.ref;
|
|
@@ -3909,12 +3780,12 @@ function innerCreateMedium(defaults, middleware) {
|
|
|
3909
3780
|
};
|
|
3910
3781
|
return medium;
|
|
3911
3782
|
}
|
|
3912
|
-
function createSidecarMedium(
|
|
3913
|
-
if (
|
|
3914
|
-
|
|
3783
|
+
function createSidecarMedium(options2) {
|
|
3784
|
+
if (options2 === void 0) {
|
|
3785
|
+
options2 = {};
|
|
3915
3786
|
}
|
|
3916
3787
|
var medium = innerCreateMedium(null);
|
|
3917
|
-
medium.options = __assign({ async: true, ssr: false },
|
|
3788
|
+
medium.options = __assign({ async: true, ssr: false }, options2);
|
|
3918
3789
|
return medium;
|
|
3919
3790
|
}
|
|
3920
3791
|
var SideCar$1 = function(_a) {
|
|
@@ -4560,14 +4431,13 @@ var MenuContentImpl = reactExports.forwardRef(
|
|
|
4560
4431
|
const ScrollLockWrapper = disableOutsideScroll ? ReactRemoveScroll : reactExports.Fragment;
|
|
4561
4432
|
const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;
|
|
4562
4433
|
const handleTypeaheadSearch = (key) => {
|
|
4563
|
-
var _a, _b;
|
|
4564
4434
|
const search = searchRef.current + key;
|
|
4565
4435
|
const items = getItems().filter((item) => !item.disabled);
|
|
4566
4436
|
const currentItem = document.activeElement;
|
|
4567
|
-
const currentMatch =
|
|
4437
|
+
const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;
|
|
4568
4438
|
const values = items.map((item) => item.textValue);
|
|
4569
4439
|
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
4570
|
-
const newItem =
|
|
4440
|
+
const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
|
|
4571
4441
|
(function updateSearch(value) {
|
|
4572
4442
|
searchRef.current = value;
|
|
4573
4443
|
window.clearTimeout(timerRef.current);
|
|
@@ -4582,9 +4452,8 @@ var MenuContentImpl = reactExports.forwardRef(
|
|
|
4582
4452
|
}, []);
|
|
4583
4453
|
useFocusGuards();
|
|
4584
4454
|
const isPointerMovingToSubmenu = reactExports.useCallback((event) => {
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
return isMovingTowards && isPointerInGraceArea(event, (_b = pointerGraceIntentRef.current) == null ? void 0 : _b.area);
|
|
4455
|
+
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
4456
|
+
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
4588
4457
|
}, []);
|
|
4589
4458
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4590
4459
|
MenuContentProvider,
|
|
@@ -4599,9 +4468,8 @@ var MenuContentImpl = reactExports.forwardRef(
|
|
|
4599
4468
|
),
|
|
4600
4469
|
onItemLeave: reactExports.useCallback(
|
|
4601
4470
|
(event) => {
|
|
4602
|
-
var _a;
|
|
4603
4471
|
if (isPointerMovingToSubmenu(event)) return;
|
|
4604
|
-
|
|
4472
|
+
contentRef.current?.focus();
|
|
4605
4473
|
setCurrentItemId(null);
|
|
4606
4474
|
},
|
|
4607
4475
|
[isPointerMovingToSubmenu]
|
|
@@ -4622,9 +4490,8 @@ var MenuContentImpl = reactExports.forwardRef(
|
|
|
4622
4490
|
asChild: true,
|
|
4623
4491
|
trapped: trapFocus,
|
|
4624
4492
|
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => {
|
|
4625
|
-
var _a;
|
|
4626
4493
|
event.preventDefault();
|
|
4627
|
-
|
|
4494
|
+
contentRef.current?.focus({ preventScroll: true });
|
|
4628
4495
|
}),
|
|
4629
4496
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
4630
4497
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4742,7 +4609,7 @@ var MenuItem = reactExports.forwardRef(
|
|
|
4742
4609
|
const menuItem = ref.current;
|
|
4743
4610
|
if (!disabled && menuItem) {
|
|
4744
4611
|
const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
|
|
4745
|
-
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect
|
|
4612
|
+
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });
|
|
4746
4613
|
dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
|
|
4747
4614
|
if (itemSelectEvent.defaultPrevented) {
|
|
4748
4615
|
isPointerDownRef.current = false;
|
|
@@ -4759,13 +4626,11 @@ var MenuItem = reactExports.forwardRef(
|
|
|
4759
4626
|
disabled,
|
|
4760
4627
|
onClick: composeEventHandlers(props.onClick, handleSelect),
|
|
4761
4628
|
onPointerDown: (event) => {
|
|
4762
|
-
|
|
4763
|
-
(_a = props.onPointerDown) == null ? void 0 : _a.call(props, event);
|
|
4629
|
+
props.onPointerDown?.(event);
|
|
4764
4630
|
isPointerDownRef.current = true;
|
|
4765
4631
|
},
|
|
4766
4632
|
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
4767
|
-
|
|
4768
|
-
if (!isPointerDownRef.current) (_a = event.currentTarget) == null ? void 0 : _a.click();
|
|
4633
|
+
if (!isPointerDownRef.current) event.currentTarget?.click();
|
|
4769
4634
|
}),
|
|
4770
4635
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
4771
4636
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
@@ -4850,7 +4715,7 @@ var MenuCheckboxItem = reactExports.forwardRef(
|
|
|
4850
4715
|
"data-state": getCheckedState(checked),
|
|
4851
4716
|
onSelect: composeEventHandlers(
|
|
4852
4717
|
checkboxItemProps.onSelect,
|
|
4853
|
-
() => onCheckedChange
|
|
4718
|
+
() => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),
|
|
4854
4719
|
{ checkForDefaultPrevented: false }
|
|
4855
4720
|
)
|
|
4856
4721
|
}
|
|
@@ -4888,10 +4753,7 @@ var MenuRadioItem = reactExports.forwardRef(
|
|
|
4888
4753
|
"data-state": getCheckedState(checked),
|
|
4889
4754
|
onSelect: composeEventHandlers(
|
|
4890
4755
|
radioItemProps.onSelect,
|
|
4891
|
-
() =>
|
|
4892
|
-
var _a;
|
|
4893
|
-
return (_a = context.onValueChange) == null ? void 0 : _a.call(context, value);
|
|
4894
|
-
},
|
|
4756
|
+
() => context.onValueChange?.(value),
|
|
4895
4757
|
{ checkForDefaultPrevented: false }
|
|
4896
4758
|
)
|
|
4897
4759
|
}
|
|
@@ -4985,8 +4847,7 @@ var MenuSubTrigger = reactExports.forwardRef(
|
|
|
4985
4847
|
...props,
|
|
4986
4848
|
ref: composeRefs(forwardedRef, subContext.onTriggerChange),
|
|
4987
4849
|
onClick: (event) => {
|
|
4988
|
-
|
|
4989
|
-
(_a = props.onClick) == null ? void 0 : _a.call(props, event);
|
|
4850
|
+
props.onClick?.(event);
|
|
4990
4851
|
if (props.disabled || event.defaultPrevented) return;
|
|
4991
4852
|
event.currentTarget.focus();
|
|
4992
4853
|
if (!context.open) context.onOpenChange(true);
|
|
@@ -5008,11 +4869,10 @@ var MenuSubTrigger = reactExports.forwardRef(
|
|
|
5008
4869
|
onPointerLeave: composeEventHandlers(
|
|
5009
4870
|
props.onPointerLeave,
|
|
5010
4871
|
whenMouse((event) => {
|
|
5011
|
-
var _a, _b;
|
|
5012
4872
|
clearOpenTimer();
|
|
5013
|
-
const contentRect =
|
|
4873
|
+
const contentRect = context.content?.getBoundingClientRect();
|
|
5014
4874
|
if (contentRect) {
|
|
5015
|
-
const side =
|
|
4875
|
+
const side = context.content?.dataset.side;
|
|
5016
4876
|
const rightSide = side === "right";
|
|
5017
4877
|
const bleed = rightSide ? -5 : 5;
|
|
5018
4878
|
const contentNearEdge = contentRect[rightSide ? "left" : "right"];
|
|
@@ -5042,12 +4902,11 @@ var MenuSubTrigger = reactExports.forwardRef(
|
|
|
5042
4902
|
})
|
|
5043
4903
|
),
|
|
5044
4904
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
5045
|
-
var _a;
|
|
5046
4905
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
5047
4906
|
if (props.disabled || isTypingAhead && event.key === " ") return;
|
|
5048
4907
|
if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
|
|
5049
4908
|
context.onOpenChange(true);
|
|
5050
|
-
|
|
4909
|
+
context.content?.focus();
|
|
5051
4910
|
event.preventDefault();
|
|
5052
4911
|
}
|
|
5053
4912
|
})
|
|
@@ -5079,8 +4938,7 @@ var MenuSubContent = reactExports.forwardRef(
|
|
|
5079
4938
|
disableOutsideScroll: false,
|
|
5080
4939
|
trapFocus: false,
|
|
5081
4940
|
onOpenAutoFocus: (event) => {
|
|
5082
|
-
|
|
5083
|
-
if (rootContext.isUsingKeyboardRef.current) (_a = ref.current) == null ? void 0 : _a.focus();
|
|
4941
|
+
if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();
|
|
5084
4942
|
event.preventDefault();
|
|
5085
4943
|
},
|
|
5086
4944
|
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
@@ -5092,12 +4950,11 @@ var MenuSubContent = reactExports.forwardRef(
|
|
|
5092
4950
|
event.preventDefault();
|
|
5093
4951
|
}),
|
|
5094
4952
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
5095
|
-
var _a;
|
|
5096
4953
|
const isKeyDownInside = event.currentTarget.contains(event.target);
|
|
5097
4954
|
const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
|
|
5098
4955
|
if (isKeyDownInside && isCloseKey) {
|
|
5099
4956
|
context.onOpenChange(false);
|
|
5100
|
-
|
|
4957
|
+
subContext.trigger?.focus();
|
|
5101
4958
|
event.preventDefault();
|
|
5102
4959
|
}
|
|
5103
4960
|
})
|
|
@@ -5273,8 +5130,7 @@ var DropdownMenuContent$1 = reactExports.forwardRef(
|
|
|
5273
5130
|
...contentProps,
|
|
5274
5131
|
ref: forwardedRef,
|
|
5275
5132
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
5276
|
-
|
|
5277
|
-
if (!hasInteractedOutsideRef.current) (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
5133
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
5278
5134
|
hasInteractedOutsideRef.current = false;
|
|
5279
5135
|
event.preventDefault();
|
|
5280
5136
|
}),
|
|
@@ -5622,16 +5478,16 @@ function Skeleton({
|
|
|
5622
5478
|
);
|
|
5623
5479
|
}
|
|
5624
5480
|
class WorkflowWebAPIError extends Error {
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5481
|
+
request;
|
|
5482
|
+
layer;
|
|
5483
|
+
constructor(message2, options2) {
|
|
5484
|
+
super(message2, { cause: options2?.cause });
|
|
5629
5485
|
this.name = "WorkflowWebAPIError";
|
|
5630
|
-
this.request =
|
|
5631
|
-
this.layer =
|
|
5632
|
-
if (
|
|
5486
|
+
this.request = options2?.request;
|
|
5487
|
+
this.layer = options2?.layer;
|
|
5488
|
+
if (options2?.cause instanceof Error) {
|
|
5633
5489
|
this.stack = `${this.stack}
|
|
5634
|
-
Caused by: ${
|
|
5490
|
+
Caused by: ${options2.cause.stack}`;
|
|
5635
5491
|
}
|
|
5636
5492
|
}
|
|
5637
5493
|
}
|
|
@@ -5643,10 +5499,9 @@ function createWorkflowAPIError(serverError) {
|
|
|
5643
5499
|
});
|
|
5644
5500
|
}
|
|
5645
5501
|
const getErrorMessage = (error) => {
|
|
5646
|
-
var _a;
|
|
5647
5502
|
if ("layer" in error && error.layer) {
|
|
5648
5503
|
if (error instanceof WorkflowWebAPIError) {
|
|
5649
|
-
if (
|
|
5504
|
+
if (error.request?.status === 403) {
|
|
5650
5505
|
return VERCEL_403_ERROR_MESSAGE;
|
|
5651
5506
|
}
|
|
5652
5507
|
}
|
|
@@ -5694,8 +5549,8 @@ async function recreateRun(env, runId) {
|
|
|
5694
5549
|
async function reenqueueRun(env, runId) {
|
|
5695
5550
|
await unwrapOrThrow(reenqueueRun$1(env, runId));
|
|
5696
5551
|
}
|
|
5697
|
-
async function wakeUpRun(env, runId,
|
|
5698
|
-
return unwrapOrThrow(wakeUpRun$1(env, runId,
|
|
5552
|
+
async function wakeUpRun(env, runId, options2) {
|
|
5553
|
+
return unwrapOrThrow(wakeUpRun$1(env, runId, options2));
|
|
5699
5554
|
}
|
|
5700
5555
|
async function resumeHook(env, token, payload) {
|
|
5701
5556
|
return unwrapOrThrow(resumeHook$1(env, token, payload));
|
|
@@ -5811,7 +5666,7 @@ function StatusBadge({
|
|
|
5811
5666
|
")"
|
|
5812
5667
|
] })
|
|
5813
5668
|
] });
|
|
5814
|
-
const errorCode = status === "failed" ? getErrorCode(context
|
|
5669
|
+
const errorCode = status === "failed" ? getErrorCode(context?.error) : void 0;
|
|
5815
5670
|
if (errorCode) {
|
|
5816
5671
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorCodeBadge, { content, errorCode });
|
|
5817
5672
|
}
|
|
@@ -5862,7 +5717,6 @@ function useRunActions({
|
|
|
5862
5717
|
const eventAnalysis = reactExports.useMemo(() => analyzeEvents(events), [events]);
|
|
5863
5718
|
const hasPendingSleeps = eventAnalysis.hasPendingSleeps;
|
|
5864
5719
|
const handleReplay = reactExports.useCallback(async () => {
|
|
5865
|
-
var _a, _b;
|
|
5866
5720
|
if (rerunning) return null;
|
|
5867
5721
|
try {
|
|
5868
5722
|
setRerunning(true);
|
|
@@ -5870,8 +5724,8 @@ function useRunActions({
|
|
|
5870
5724
|
toast.success("New run started", {
|
|
5871
5725
|
description: `Run ID: ${newRunId}`
|
|
5872
5726
|
});
|
|
5873
|
-
|
|
5874
|
-
|
|
5727
|
+
callbacks?.onSuccess?.();
|
|
5728
|
+
callbacks?.onNavigateToRun?.(newRunId);
|
|
5875
5729
|
return newRunId;
|
|
5876
5730
|
} catch (err) {
|
|
5877
5731
|
toast.error("Failed to re-run", {
|
|
@@ -5883,7 +5737,6 @@ function useRunActions({
|
|
|
5883
5737
|
}
|
|
5884
5738
|
}, [env, runId, rerunning, callbacks]);
|
|
5885
5739
|
const handleReenqueue = reactExports.useCallback(async () => {
|
|
5886
|
-
var _a;
|
|
5887
5740
|
if (reenqueuing) return;
|
|
5888
5741
|
try {
|
|
5889
5742
|
setReenqueuing(true);
|
|
@@ -5891,7 +5744,7 @@ function useRunActions({
|
|
|
5891
5744
|
toast.success("Run re-enqueued", {
|
|
5892
5745
|
description: "The workflow orchestration layer has been re-enqueued."
|
|
5893
5746
|
});
|
|
5894
|
-
|
|
5747
|
+
callbacks?.onSuccess?.();
|
|
5895
5748
|
} catch (err) {
|
|
5896
5749
|
toast.error("Failed to re-enqueue", {
|
|
5897
5750
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -5901,7 +5754,6 @@ function useRunActions({
|
|
|
5901
5754
|
}
|
|
5902
5755
|
}, [env, runId, reenqueuing, callbacks]);
|
|
5903
5756
|
const handleWakeUp = reactExports.useCallback(async () => {
|
|
5904
|
-
var _a;
|
|
5905
5757
|
if (wakingUp) return;
|
|
5906
5758
|
try {
|
|
5907
5759
|
setWakingUp(true);
|
|
@@ -5915,7 +5767,7 @@ function useRunActions({
|
|
|
5915
5767
|
description: "There were no active sleep calls to cancel."
|
|
5916
5768
|
});
|
|
5917
5769
|
}
|
|
5918
|
-
|
|
5770
|
+
callbacks?.onSuccess?.();
|
|
5919
5771
|
} catch (err) {
|
|
5920
5772
|
toast.error("Failed to cancel sleeps", {
|
|
5921
5773
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -5925,7 +5777,6 @@ function useRunActions({
|
|
|
5925
5777
|
}
|
|
5926
5778
|
}, [env, runId, wakingUp, callbacks]);
|
|
5927
5779
|
const handleCancel = reactExports.useCallback(async () => {
|
|
5928
|
-
var _a;
|
|
5929
5780
|
if (cancelling) return;
|
|
5930
5781
|
const isRunActive = runStatus === "pending" || runStatus === "running";
|
|
5931
5782
|
if (!isRunActive) {
|
|
@@ -5938,7 +5789,7 @@ function useRunActions({
|
|
|
5938
5789
|
setCancelling(true);
|
|
5939
5790
|
await cancelRun(env, runId);
|
|
5940
5791
|
toast.success("Run cancelled");
|
|
5941
|
-
|
|
5792
|
+
callbacks?.onSuccess?.();
|
|
5942
5793
|
} catch (err) {
|
|
5943
5794
|
toast.error("Failed to cancel", {
|
|
5944
5795
|
description: err instanceof Error ? err.message : "Unknown error"
|
|
@@ -7255,24 +7106,24 @@ function onRemove(typename) {
|
|
|
7255
7106
|
else delete this.__on;
|
|
7256
7107
|
};
|
|
7257
7108
|
}
|
|
7258
|
-
function onAdd(typename, value,
|
|
7109
|
+
function onAdd(typename, value, options2) {
|
|
7259
7110
|
return function() {
|
|
7260
7111
|
var on = this.__on, o, listener = contextListener(value);
|
|
7261
7112
|
if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
|
7262
7113
|
if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
|
7263
7114
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
7264
|
-
this.addEventListener(o.type, o.listener = listener, o.options =
|
|
7115
|
+
this.addEventListener(o.type, o.listener = listener, o.options = options2);
|
|
7265
7116
|
o.value = value;
|
|
7266
7117
|
return;
|
|
7267
7118
|
}
|
|
7268
7119
|
}
|
|
7269
|
-
this.addEventListener(typename.type, listener,
|
|
7270
|
-
o = { type: typename.type, name: typename.name, value, listener, options };
|
|
7120
|
+
this.addEventListener(typename.type, listener, options2);
|
|
7121
|
+
o = { type: typename.type, name: typename.name, value, listener, options: options2 };
|
|
7271
7122
|
if (!on) this.__on = [o];
|
|
7272
7123
|
else on.push(o);
|
|
7273
7124
|
};
|
|
7274
7125
|
}
|
|
7275
|
-
function selection_on(typename, value,
|
|
7126
|
+
function selection_on(typename, value, options2) {
|
|
7276
7127
|
var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
|
7277
7128
|
if (arguments.length < 2) {
|
|
7278
7129
|
var on = this.node().__on;
|
|
@@ -7286,7 +7137,7 @@ function selection_on(typename, value, options) {
|
|
|
7286
7137
|
return;
|
|
7287
7138
|
}
|
|
7288
7139
|
on = value ? onAdd : onRemove;
|
|
7289
|
-
for (i = 0; i < n; ++i) this.each(on(typenames[i], value,
|
|
7140
|
+
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options2));
|
|
7290
7141
|
return this;
|
|
7291
7142
|
}
|
|
7292
7143
|
function dispatchEvent(node, type, params) {
|
|
@@ -9474,28 +9325,28 @@ const getConnectedEdges = (nodes, edges) => {
|
|
|
9474
9325
|
});
|
|
9475
9326
|
return edges.filter((edge) => nodeIds.has(edge.source) || nodeIds.has(edge.target));
|
|
9476
9327
|
};
|
|
9477
|
-
function getFitViewNodes(nodeLookup,
|
|
9328
|
+
function getFitViewNodes(nodeLookup, options2) {
|
|
9478
9329
|
const fitViewNodes = /* @__PURE__ */ new Map();
|
|
9479
|
-
const optionNodeIds =
|
|
9330
|
+
const optionNodeIds = options2?.nodes ? new Set(options2.nodes.map((node) => node.id)) : null;
|
|
9480
9331
|
nodeLookup.forEach((n) => {
|
|
9481
|
-
const isVisible = n.measured.width && n.measured.height && (
|
|
9332
|
+
const isVisible = n.measured.width && n.measured.height && (options2?.includeHiddenNodes || !n.hidden);
|
|
9482
9333
|
if (isVisible && (!optionNodeIds || optionNodeIds.has(n.id))) {
|
|
9483
9334
|
fitViewNodes.set(n.id, n);
|
|
9484
9335
|
}
|
|
9485
9336
|
});
|
|
9486
9337
|
return fitViewNodes;
|
|
9487
9338
|
}
|
|
9488
|
-
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
|
|
9339
|
+
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options2) {
|
|
9489
9340
|
if (nodes.size === 0) {
|
|
9490
9341
|
return Promise.resolve(true);
|
|
9491
9342
|
}
|
|
9492
|
-
const nodesToFit = getFitViewNodes(nodes,
|
|
9343
|
+
const nodesToFit = getFitViewNodes(nodes, options2);
|
|
9493
9344
|
const bounds = getInternalNodesBounds(nodesToFit);
|
|
9494
|
-
const viewport = getViewportForBounds(bounds, width, height,
|
|
9345
|
+
const viewport = getViewportForBounds(bounds, width, height, options2?.minZoom ?? minZoom, options2?.maxZoom ?? maxZoom, options2?.padding ?? 0.1);
|
|
9495
9346
|
await panZoom.setViewport(viewport, {
|
|
9496
|
-
duration:
|
|
9497
|
-
ease:
|
|
9498
|
-
interpolate:
|
|
9347
|
+
duration: options2?.duration,
|
|
9348
|
+
ease: options2?.ease,
|
|
9349
|
+
interpolate: options2?.interpolate
|
|
9499
9350
|
});
|
|
9500
9351
|
return Promise.resolve(true);
|
|
9501
9352
|
}
|
|
@@ -9507,7 +9358,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
|
|
|
9507
9358
|
let extent = node.extent || nodeExtent;
|
|
9508
9359
|
if (node.extent === "parent" && !node.expandParent) {
|
|
9509
9360
|
if (!parentNode) {
|
|
9510
|
-
onError
|
|
9361
|
+
onError?.("005", errorMessages["error005"]());
|
|
9511
9362
|
} else {
|
|
9512
9363
|
const parentWidth = parentNode.measured.width;
|
|
9513
9364
|
const parentHeight = parentNode.measured.height;
|
|
@@ -9526,7 +9377,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
|
|
|
9526
9377
|
}
|
|
9527
9378
|
const positionAbsolute = isCoordinateExtent(extent) ? clampPosition(nextPosition, extent, node.measured) : nextPosition;
|
|
9528
9379
|
if (node.measured.width === void 0 || node.measured.height === void 0) {
|
|
9529
|
-
onError
|
|
9380
|
+
onError?.("015", errorMessages["error015"]());
|
|
9530
9381
|
}
|
|
9531
9382
|
return {
|
|
9532
9383
|
position: {
|
|
@@ -9576,8 +9427,8 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
|
|
|
9576
9427
|
}
|
|
9577
9428
|
const clamp = (val, min = 0, max = 1) => Math.min(Math.max(val, min), max);
|
|
9578
9429
|
const clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
|
|
9579
|
-
x: clamp(position.x, extent[0][0], extent[1][0] - (
|
|
9580
|
-
y: clamp(position.y, extent[0][1], extent[1][1] - (
|
|
9430
|
+
x: clamp(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
|
|
9431
|
+
y: clamp(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
|
|
9581
9432
|
});
|
|
9582
9433
|
function clampPositionToParent(childPosition, childDimensions, parent) {
|
|
9583
9434
|
const { width: parentWidth, height: parentHeight } = getNodeDimensions(parent);
|
|
@@ -9619,23 +9470,21 @@ const boxToRect = ({ x, y, x2, y2 }) => ({
|
|
|
9619
9470
|
height: y2 - y
|
|
9620
9471
|
});
|
|
9621
9472
|
const nodeToRect = (node, nodeOrigin = [0, 0]) => {
|
|
9622
|
-
var _a, _b;
|
|
9623
9473
|
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
9624
9474
|
return {
|
|
9625
9475
|
x,
|
|
9626
9476
|
y,
|
|
9627
|
-
width:
|
|
9628
|
-
height:
|
|
9477
|
+
width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
|
|
9478
|
+
height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
|
|
9629
9479
|
};
|
|
9630
9480
|
};
|
|
9631
9481
|
const nodeToBox = (node, nodeOrigin = [0, 0]) => {
|
|
9632
|
-
var _a, _b;
|
|
9633
9482
|
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
9634
9483
|
return {
|
|
9635
9484
|
x,
|
|
9636
9485
|
y,
|
|
9637
|
-
x2: x + (
|
|
9638
|
-
y2: y + (
|
|
9486
|
+
x2: x + (node.measured?.width ?? node.width ?? node.initialWidth ?? 0),
|
|
9487
|
+
y2: y + (node.measured?.height ?? node.height ?? node.initialHeight ?? 0)
|
|
9639
9488
|
};
|
|
9640
9489
|
};
|
|
9641
9490
|
const getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));
|
|
@@ -9743,23 +9592,18 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
|
|
|
9743
9592
|
zoom: clampedZoom
|
|
9744
9593
|
};
|
|
9745
9594
|
};
|
|
9746
|
-
const isMacOs = () =>
|
|
9747
|
-
var _a;
|
|
9748
|
-
return typeof navigator !== "undefined" && ((_a = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : _a.indexOf("Mac")) >= 0;
|
|
9749
|
-
};
|
|
9595
|
+
const isMacOs = () => typeof navigator !== "undefined" && navigator?.userAgent?.indexOf("Mac") >= 0;
|
|
9750
9596
|
function isCoordinateExtent(extent) {
|
|
9751
9597
|
return extent !== void 0 && extent !== null && extent !== "parent";
|
|
9752
9598
|
}
|
|
9753
9599
|
function getNodeDimensions(node) {
|
|
9754
|
-
var _a, _b;
|
|
9755
9600
|
return {
|
|
9756
|
-
width:
|
|
9757
|
-
height:
|
|
9601
|
+
width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
|
|
9602
|
+
height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
|
|
9758
9603
|
};
|
|
9759
9604
|
}
|
|
9760
9605
|
function nodeHasDimensions(node) {
|
|
9761
|
-
|
|
9762
|
-
return (((_a = node.measured) == null ? void 0 : _a.width) ?? node.width ?? node.initialWidth) !== void 0 && (((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight) !== void 0;
|
|
9606
|
+
return (node.measured?.width ?? node.width ?? node.initialWidth) !== void 0 && (node.measured?.height ?? node.height ?? node.initialHeight) !== void 0;
|
|
9763
9607
|
}
|
|
9764
9608
|
function evaluateAbsolutePosition(position, dimensions = { width: 0, height: 0 }, parentId, nodeLookup, nodeOrigin) {
|
|
9765
9609
|
const positionAbsolute = { ...position };
|
|
@@ -9796,7 +9640,7 @@ function mergeAriaLabelConfig(partial) {
|
|
|
9796
9640
|
}
|
|
9797
9641
|
function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform: transform2, containerBounds }) {
|
|
9798
9642
|
const { x, y } = getEventPosition(event);
|
|
9799
|
-
const pointerPos = pointToRendererPoint({ x: x - (
|
|
9643
|
+
const pointerPos = pointToRendererPoint({ x: x - (containerBounds?.left ?? 0), y: y - (containerBounds?.top ?? 0) }, transform2);
|
|
9800
9644
|
const { x: xSnapped, y: ySnapped } = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos;
|
|
9801
9645
|
return {
|
|
9802
9646
|
xSnapped,
|
|
@@ -9808,28 +9652,23 @@ const getDimensions = (node) => ({
|
|
|
9808
9652
|
width: node.offsetWidth,
|
|
9809
9653
|
height: node.offsetHeight
|
|
9810
9654
|
});
|
|
9811
|
-
const getHostForElement = (element) =>
|
|
9812
|
-
var _a;
|
|
9813
|
-
return ((_a = element == null ? void 0 : element.getRootNode) == null ? void 0 : _a.call(element)) || (window == null ? void 0 : window.document);
|
|
9814
|
-
};
|
|
9655
|
+
const getHostForElement = (element) => element?.getRootNode?.() || window?.document;
|
|
9815
9656
|
const inputTags = ["INPUT", "SELECT", "TEXTAREA"];
|
|
9816
9657
|
function isInputDOMNode(event) {
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
if ((target == null ? void 0 : target.nodeType) !== 1)
|
|
9658
|
+
const target = event.composedPath?.()?.[0] || event.target;
|
|
9659
|
+
if (target?.nodeType !== 1)
|
|
9820
9660
|
return false;
|
|
9821
9661
|
const isInput = inputTags.includes(target.nodeName) || target.hasAttribute("contenteditable");
|
|
9822
9662
|
return isInput || !!target.closest(".nokey");
|
|
9823
9663
|
}
|
|
9824
9664
|
const isMouseEvent = (event) => "clientX" in event;
|
|
9825
9665
|
const getEventPosition = (event, bounds) => {
|
|
9826
|
-
var _a, _b;
|
|
9827
9666
|
const isMouse = isMouseEvent(event);
|
|
9828
|
-
const evtX = isMouse ? event.clientX :
|
|
9829
|
-
const evtY = isMouse ? event.clientY :
|
|
9667
|
+
const evtX = isMouse ? event.clientX : event.touches?.[0].clientX;
|
|
9668
|
+
const evtY = isMouse ? event.clientY : event.touches?.[0].clientY;
|
|
9830
9669
|
return {
|
|
9831
|
-
x: evtX - (
|
|
9832
|
-
y: evtY - (
|
|
9670
|
+
x: evtX - (bounds?.left ?? 0),
|
|
9671
|
+
y: evtY - (bounds?.top ?? 0)
|
|
9833
9672
|
};
|
|
9834
9673
|
};
|
|
9835
9674
|
const getHandleBounds = (type, nodeElement, nodeBounds, zoom2, nodeId) => {
|
|
@@ -9945,11 +9784,11 @@ const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__
|
|
|
9945
9784
|
const connectionExists = (edge, edges) => {
|
|
9946
9785
|
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));
|
|
9947
9786
|
};
|
|
9948
|
-
const addEdge = (edgeParams, edges,
|
|
9787
|
+
const addEdge = (edgeParams, edges, options2 = {}) => {
|
|
9949
9788
|
if (!edgeParams.source || !edgeParams.target) {
|
|
9950
9789
|
return edges;
|
|
9951
9790
|
}
|
|
9952
|
-
const edgeIdGenerator =
|
|
9791
|
+
const edgeIdGenerator = options2.getEdgeId || getEdgeId;
|
|
9953
9792
|
let edge;
|
|
9954
9793
|
if (isEdgeBase(edgeParams)) {
|
|
9955
9794
|
edge = { ...edgeParams };
|
|
@@ -10123,33 +9962,31 @@ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom,
|
|
|
10123
9962
|
return [path, labelX, labelY, offsetX, offsetY];
|
|
10124
9963
|
}
|
|
10125
9964
|
function isNodeInitialized(node) {
|
|
10126
|
-
|
|
10127
|
-
return node && !!(node.internals.handleBounds || ((_a = node.handles) == null ? void 0 : _a.length)) && !!(node.measured.width || node.width || node.initialWidth);
|
|
9965
|
+
return node && !!(node.internals.handleBounds || node.handles?.length) && !!(node.measured.width || node.width || node.initialWidth);
|
|
10128
9966
|
}
|
|
10129
9967
|
function getEdgePosition(params) {
|
|
10130
|
-
var _a;
|
|
10131
9968
|
const { sourceNode, targetNode } = params;
|
|
10132
9969
|
if (!isNodeInitialized(sourceNode) || !isNodeInitialized(targetNode)) {
|
|
10133
9970
|
return null;
|
|
10134
9971
|
}
|
|
10135
9972
|
const sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles);
|
|
10136
9973
|
const targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles);
|
|
10137
|
-
const sourceHandle = getHandle$1(
|
|
9974
|
+
const sourceHandle = getHandle$1(sourceHandleBounds?.source ?? [], params.sourceHandle);
|
|
10138
9975
|
const targetHandle = getHandle$1(
|
|
10139
9976
|
// when connection type is loose we can define all handles as sources and connect source -> source
|
|
10140
|
-
params.connectionMode === ConnectionMode.Strict ?
|
|
9977
|
+
params.connectionMode === ConnectionMode.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
|
|
10141
9978
|
params.targetHandle
|
|
10142
9979
|
);
|
|
10143
9980
|
if (!sourceHandle || !targetHandle) {
|
|
10144
|
-
|
|
9981
|
+
params.onError?.("008", errorMessages["error008"](!sourceHandle ? "source" : "target", {
|
|
10145
9982
|
id: params.id,
|
|
10146
9983
|
sourceHandle: params.sourceHandle,
|
|
10147
9984
|
targetHandle: params.targetHandle
|
|
10148
9985
|
}));
|
|
10149
9986
|
return null;
|
|
10150
9987
|
}
|
|
10151
|
-
const sourcePosition =
|
|
10152
|
-
const targetPosition =
|
|
9988
|
+
const sourcePosition = sourceHandle?.position || Position.Bottom;
|
|
9989
|
+
const targetPosition = targetHandle?.position || Position.Top;
|
|
10153
9990
|
const source = getHandlePosition(sourceNode, sourceHandle, sourcePosition);
|
|
10154
9991
|
const target = getHandlePosition(targetNode, targetHandle, targetPosition);
|
|
10155
9992
|
return {
|
|
@@ -10182,13 +10019,13 @@ function toHandleBounds(handles) {
|
|
|
10182
10019
|
};
|
|
10183
10020
|
}
|
|
10184
10021
|
function getHandlePosition(node, handle, fallbackPosition = Position.Left, center = false) {
|
|
10185
|
-
const x = (
|
|
10186
|
-
const y = (
|
|
10022
|
+
const x = (handle?.x ?? 0) + node.internals.positionAbsolute.x;
|
|
10023
|
+
const y = (handle?.y ?? 0) + node.internals.positionAbsolute.y;
|
|
10187
10024
|
const { width, height } = handle ?? getNodeDimensions(node);
|
|
10188
10025
|
if (center) {
|
|
10189
10026
|
return { x: x + width / 2, y: y + height / 2 };
|
|
10190
10027
|
}
|
|
10191
|
-
const position =
|
|
10028
|
+
const position = handle?.position ?? fallbackPosition;
|
|
10192
10029
|
switch (position) {
|
|
10193
10030
|
case Position.Top:
|
|
10194
10031
|
return { x: x + width / 2, y };
|
|
@@ -10253,8 +10090,8 @@ function mergeObjects(base, incoming) {
|
|
|
10253
10090
|
}
|
|
10254
10091
|
return result;
|
|
10255
10092
|
}
|
|
10256
|
-
function updateAbsolutePositions(nodeLookup, parentLookup,
|
|
10257
|
-
const _options = mergeObjects(defaultOptions,
|
|
10093
|
+
function updateAbsolutePositions(nodeLookup, parentLookup, options2) {
|
|
10094
|
+
const _options = mergeObjects(defaultOptions, options2);
|
|
10258
10095
|
for (const node of nodeLookup.values()) {
|
|
10259
10096
|
if (node.parentId) {
|
|
10260
10097
|
updateChildNode(node, nodeLookup, parentLookup, _options);
|
|
@@ -10268,7 +10105,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
|
|
|
10268
10105
|
}
|
|
10269
10106
|
function parseHandles(userNode, internalNode) {
|
|
10270
10107
|
if (!userNode.handles) {
|
|
10271
|
-
return !userNode.measured ? void 0 : internalNode
|
|
10108
|
+
return !userNode.measured ? void 0 : internalNode?.internals.handleBounds;
|
|
10272
10109
|
}
|
|
10273
10110
|
const source = [];
|
|
10274
10111
|
const target = [];
|
|
@@ -10297,18 +10134,17 @@ function parseHandles(userNode, internalNode) {
|
|
|
10297
10134
|
function isManualZIndexMode(zIndexMode) {
|
|
10298
10135
|
return zIndexMode === "manual";
|
|
10299
10136
|
}
|
|
10300
|
-
function adoptUserNodes(nodes, nodeLookup, parentLookup,
|
|
10301
|
-
|
|
10302
|
-
const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
|
|
10137
|
+
function adoptUserNodes(nodes, nodeLookup, parentLookup, options2 = {}) {
|
|
10138
|
+
const _options = mergeObjects(adoptUserNodesDefaultOptions, options2);
|
|
10303
10139
|
const rootParentIndex = { i: 0 };
|
|
10304
10140
|
const tmpLookup = new Map(nodeLookup);
|
|
10305
|
-
const selectedNodeZ =
|
|
10141
|
+
const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
|
|
10306
10142
|
let nodesInitialized = nodes.length > 0;
|
|
10307
10143
|
nodeLookup.clear();
|
|
10308
10144
|
parentLookup.clear();
|
|
10309
10145
|
for (const userNode of nodes) {
|
|
10310
10146
|
let internalNode = tmpLookup.get(userNode.id);
|
|
10311
|
-
if (_options.checkEquality && userNode ===
|
|
10147
|
+
if (_options.checkEquality && userNode === internalNode?.internals.userNode) {
|
|
10312
10148
|
nodeLookup.set(userNode.id, internalNode);
|
|
10313
10149
|
} else {
|
|
10314
10150
|
const positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin);
|
|
@@ -10318,8 +10154,8 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
10318
10154
|
..._options.defaults,
|
|
10319
10155
|
...userNode,
|
|
10320
10156
|
measured: {
|
|
10321
|
-
width:
|
|
10322
|
-
height:
|
|
10157
|
+
width: userNode.measured?.width,
|
|
10158
|
+
height: userNode.measured?.height
|
|
10323
10159
|
},
|
|
10324
10160
|
internals: {
|
|
10325
10161
|
positionAbsolute: clampedPosition,
|
|
@@ -10335,7 +10171,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
10335
10171
|
nodesInitialized = false;
|
|
10336
10172
|
}
|
|
10337
10173
|
if (userNode.parentId) {
|
|
10338
|
-
updateChildNode(internalNode, nodeLookup, parentLookup,
|
|
10174
|
+
updateChildNode(internalNode, nodeLookup, parentLookup, options2, rootParentIndex);
|
|
10339
10175
|
}
|
|
10340
10176
|
}
|
|
10341
10177
|
return nodesInitialized;
|
|
@@ -10351,8 +10187,8 @@ function updateParentLookup(node, parentLookup) {
|
|
|
10351
10187
|
parentLookup.set(node.parentId, /* @__PURE__ */ new Map([[node.id, node]]));
|
|
10352
10188
|
}
|
|
10353
10189
|
}
|
|
10354
|
-
function updateChildNode(node, nodeLookup, parentLookup,
|
|
10355
|
-
const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions,
|
|
10190
|
+
function updateChildNode(node, nodeLookup, parentLookup, options2, rootParentIndex) {
|
|
10191
|
+
const { elevateNodesOnSelect, nodeOrigin, nodeExtent, zIndexMode } = mergeObjects(defaultOptions, options2);
|
|
10356
10192
|
const parentId = node.parentId;
|
|
10357
10193
|
const parentNode = nodeLookup.get(parentId);
|
|
10358
10194
|
if (!parentNode) {
|
|
@@ -10407,7 +10243,6 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
|
|
|
10407
10243
|
};
|
|
10408
10244
|
}
|
|
10409
10245
|
function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0, 0]) {
|
|
10410
|
-
var _a;
|
|
10411
10246
|
const changes = [];
|
|
10412
10247
|
const parentExpansions = /* @__PURE__ */ new Map();
|
|
10413
10248
|
for (const child of children2) {
|
|
@@ -10415,13 +10250,12 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
10415
10250
|
if (!parent) {
|
|
10416
10251
|
continue;
|
|
10417
10252
|
}
|
|
10418
|
-
const parentRect =
|
|
10253
|
+
const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect(parent);
|
|
10419
10254
|
const expandedRect = getBoundsOfRects(parentRect, child.rect);
|
|
10420
10255
|
parentExpansions.set(child.parentId, { expandedRect, parent });
|
|
10421
10256
|
}
|
|
10422
10257
|
if (parentExpansions.size > 0) {
|
|
10423
10258
|
parentExpansions.forEach(({ expandedRect, parent }, parentId) => {
|
|
10424
|
-
var _a2;
|
|
10425
10259
|
const positionAbsolute = parent.internals.positionAbsolute;
|
|
10426
10260
|
const dimensions = getNodeDimensions(parent);
|
|
10427
10261
|
const origin = parent.origin ?? nodeOrigin;
|
|
@@ -10440,7 +10274,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
10440
10274
|
y: parent.position.y - yChange + heightChange
|
|
10441
10275
|
}
|
|
10442
10276
|
});
|
|
10443
|
-
|
|
10277
|
+
parentLookup.get(parentId)?.forEach((childNode) => {
|
|
10444
10278
|
if (!children2.some((child) => child.id === childNode.id)) {
|
|
10445
10279
|
changes.push({
|
|
10446
10280
|
id: childNode.id,
|
|
@@ -10469,7 +10303,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
10469
10303
|
return changes;
|
|
10470
10304
|
}
|
|
10471
10305
|
function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent, zIndexMode) {
|
|
10472
|
-
const viewportNode = domNode
|
|
10306
|
+
const viewportNode = domNode?.querySelector(".xyflow__viewport");
|
|
10473
10307
|
let updatedInternals = false;
|
|
10474
10308
|
if (!viewportNode) {
|
|
10475
10309
|
return { changes: [], updatedInternals };
|
|
@@ -10600,14 +10434,13 @@ function isParentSelected(node, nodeLookup) {
|
|
|
10600
10434
|
return isParentSelected(parentNode, nodeLookup);
|
|
10601
10435
|
}
|
|
10602
10436
|
function hasSelector(target, selector2, domNode) {
|
|
10603
|
-
var _a;
|
|
10604
10437
|
let current = target;
|
|
10605
10438
|
do {
|
|
10606
|
-
if (
|
|
10439
|
+
if (current?.matches?.(selector2))
|
|
10607
10440
|
return true;
|
|
10608
10441
|
if (current === domNode)
|
|
10609
10442
|
return false;
|
|
10610
|
-
current = current
|
|
10443
|
+
current = current?.parentElement;
|
|
10611
10444
|
} while (current);
|
|
10612
10445
|
return false;
|
|
10613
10446
|
}
|
|
@@ -10642,10 +10475,9 @@ function getDragItems(nodeLookup, nodesDraggable, mousePos, nodeId) {
|
|
|
10642
10475
|
return dragItems;
|
|
10643
10476
|
}
|
|
10644
10477
|
function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true }) {
|
|
10645
|
-
var _a, _b, _c;
|
|
10646
10478
|
const nodesFromDragItems = [];
|
|
10647
10479
|
for (const [id2, dragItem] of dragItems) {
|
|
10648
|
-
const node2 =
|
|
10480
|
+
const node2 = nodeLookup.get(id2)?.internals.userNode;
|
|
10649
10481
|
if (node2) {
|
|
10650
10482
|
nodesFromDragItems.push({
|
|
10651
10483
|
...node2,
|
|
@@ -10657,11 +10489,11 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true
|
|
|
10657
10489
|
if (!nodeId) {
|
|
10658
10490
|
return [nodesFromDragItems[0], nodesFromDragItems];
|
|
10659
10491
|
}
|
|
10660
|
-
const node =
|
|
10492
|
+
const node = nodeLookup.get(nodeId)?.internals.userNode;
|
|
10661
10493
|
return [
|
|
10662
10494
|
!node ? nodesFromDragItems[0] : {
|
|
10663
10495
|
...node,
|
|
10664
|
-
position:
|
|
10496
|
+
position: dragItems.get(nodeId)?.position || node.position,
|
|
10665
10497
|
dragging
|
|
10666
10498
|
},
|
|
10667
10499
|
nodesFromDragItems
|
|
@@ -10754,10 +10586,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
10754
10586
|
dragItems,
|
|
10755
10587
|
nodeLookup
|
|
10756
10588
|
});
|
|
10757
|
-
onDrag
|
|
10758
|
-
onNodeDrag
|
|
10589
|
+
onDrag?.(dragEvent, dragItems, currentNode, currentNodes);
|
|
10590
|
+
onNodeDrag?.(dragEvent, currentNode, currentNodes);
|
|
10759
10591
|
if (!nodeId) {
|
|
10760
|
-
onSelectionDrag
|
|
10592
|
+
onSelectionDrag?.(dragEvent, currentNodes);
|
|
10761
10593
|
}
|
|
10762
10594
|
}
|
|
10763
10595
|
}
|
|
@@ -10782,16 +10614,15 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
10782
10614
|
autoPanId = requestAnimationFrame(autoPan);
|
|
10783
10615
|
}
|
|
10784
10616
|
function startDrag(event) {
|
|
10785
|
-
var _a;
|
|
10786
10617
|
const { nodeLookup, multiSelectionActive, nodesDraggable, transform: transform2, snapGrid, snapToGrid, selectNodesOnDrag, onNodeDragStart, onSelectionDragStart, unselectNodesAndEdges } = getStoreItems();
|
|
10787
10618
|
dragStarted = true;
|
|
10788
10619
|
if ((!selectNodesOnDrag || !isSelectable) && !multiSelectionActive && nodeId) {
|
|
10789
|
-
if (!
|
|
10620
|
+
if (!nodeLookup.get(nodeId)?.selected) {
|
|
10790
10621
|
unselectNodesAndEdges();
|
|
10791
10622
|
}
|
|
10792
10623
|
}
|
|
10793
10624
|
if (isSelectable && selectNodesOnDrag && nodeId) {
|
|
10794
|
-
onNodeMouseDown
|
|
10625
|
+
onNodeMouseDown?.(nodeId);
|
|
10795
10626
|
}
|
|
10796
10627
|
const pointerPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds });
|
|
10797
10628
|
lastPos = pointerPos;
|
|
@@ -10802,16 +10633,16 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
10802
10633
|
dragItems,
|
|
10803
10634
|
nodeLookup
|
|
10804
10635
|
});
|
|
10805
|
-
onDragStart
|
|
10806
|
-
onNodeDragStart
|
|
10636
|
+
onDragStart?.(event.sourceEvent, dragItems, currentNode, currentNodes);
|
|
10637
|
+
onNodeDragStart?.(event.sourceEvent, currentNode, currentNodes);
|
|
10807
10638
|
if (!nodeId) {
|
|
10808
|
-
onSelectionDragStart
|
|
10639
|
+
onSelectionDragStart?.(event.sourceEvent, currentNodes);
|
|
10809
10640
|
}
|
|
10810
10641
|
}
|
|
10811
10642
|
}
|
|
10812
10643
|
const d3DragInstance = drag().clickDistance(nodeClickDistance).on("start", (event) => {
|
|
10813
10644
|
const { domNode: domNode2, nodeDragThreshold, transform: transform2, snapGrid, snapToGrid } = getStoreItems();
|
|
10814
|
-
containerBounds =
|
|
10645
|
+
containerBounds = domNode2?.getBoundingClientRect() || null;
|
|
10815
10646
|
abortDrag = false;
|
|
10816
10647
|
nodePositionsChanged = false;
|
|
10817
10648
|
dragEvent = event.sourceEvent;
|
|
@@ -10869,10 +10700,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
10869
10700
|
nodeLookup,
|
|
10870
10701
|
dragging: false
|
|
10871
10702
|
});
|
|
10872
|
-
onDragStop
|
|
10873
|
-
onNodeDragStop
|
|
10703
|
+
onDragStop?.(event.sourceEvent, dragItems, currentNode, currentNodes);
|
|
10704
|
+
onNodeDragStop?.(event.sourceEvent, currentNode, currentNodes);
|
|
10874
10705
|
if (!nodeId) {
|
|
10875
|
-
onSelectionDragStop
|
|
10706
|
+
onSelectionDragStop?.(event.sourceEvent, currentNodes);
|
|
10876
10707
|
}
|
|
10877
10708
|
}
|
|
10878
10709
|
}
|
|
@@ -10884,7 +10715,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
10884
10715
|
d3Selection.call(d3DragInstance);
|
|
10885
10716
|
}
|
|
10886
10717
|
function destroy() {
|
|
10887
|
-
d3Selection
|
|
10718
|
+
d3Selection?.on(".drag", null);
|
|
10888
10719
|
}
|
|
10889
10720
|
return {
|
|
10890
10721
|
update,
|
|
@@ -10908,12 +10739,11 @@ function getNodesWithinDistance(position, nodeLookup, distance2) {
|
|
|
10908
10739
|
}
|
|
10909
10740
|
const ADDITIONAL_DISTANCE = 250;
|
|
10910
10741
|
function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
|
|
10911
|
-
var _a, _b;
|
|
10912
10742
|
let closestHandles = [];
|
|
10913
10743
|
let minDistance = Infinity;
|
|
10914
10744
|
const closeNodes = getNodesWithinDistance(position, nodeLookup, connectionRadius + ADDITIONAL_DISTANCE);
|
|
10915
10745
|
for (const node of closeNodes) {
|
|
10916
|
-
const allHandles = [...
|
|
10746
|
+
const allHandles = [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
|
|
10917
10747
|
for (const handle of allHandles) {
|
|
10918
10748
|
if (fromHandle.nodeId === handle.nodeId && fromHandle.type === handle.type && fromHandle.id === handle.id) {
|
|
10919
10749
|
continue;
|
|
@@ -10941,21 +10771,20 @@ function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
|
|
|
10941
10771
|
return closestHandles[0];
|
|
10942
10772
|
}
|
|
10943
10773
|
function getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode, withAbsolutePosition = false) {
|
|
10944
|
-
var _a, _b, _c;
|
|
10945
10774
|
const node = nodeLookup.get(nodeId);
|
|
10946
10775
|
if (!node) {
|
|
10947
10776
|
return null;
|
|
10948
10777
|
}
|
|
10949
|
-
const handles = connectionMode === "strict" ?
|
|
10950
|
-
const handle = (handleId ? handles
|
|
10778
|
+
const handles = connectionMode === "strict" ? node.internals.handleBounds?.[handleType] : [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
|
|
10779
|
+
const handle = (handleId ? handles?.find((h) => h.id === handleId) : handles?.[0]) ?? null;
|
|
10951
10780
|
return handle && withAbsolutePosition ? { ...handle, ...getHandlePosition(node, handle, handle.position, true) } : handle;
|
|
10952
10781
|
}
|
|
10953
10782
|
function getHandleType(edgeUpdaterType, handleDomNode) {
|
|
10954
10783
|
if (edgeUpdaterType) {
|
|
10955
10784
|
return edgeUpdaterType;
|
|
10956
|
-
} else if (handleDomNode
|
|
10785
|
+
} else if (handleDomNode?.classList.contains("target")) {
|
|
10957
10786
|
return "target";
|
|
10958
|
-
} else if (handleDomNode
|
|
10787
|
+
} else if (handleDomNode?.classList.contains("source")) {
|
|
10959
10788
|
return "source";
|
|
10960
10789
|
}
|
|
10961
10790
|
return null;
|
|
@@ -10976,7 +10805,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
10976
10805
|
let closestHandle;
|
|
10977
10806
|
const { x, y } = getEventPosition(event);
|
|
10978
10807
|
const handleType = getHandleType(edgeUpdaterType, handleDomNode);
|
|
10979
|
-
const containerBounds = domNode
|
|
10808
|
+
const containerBounds = domNode?.getBoundingClientRect();
|
|
10980
10809
|
let connectionStarted = false;
|
|
10981
10810
|
if (!containerBounds || !handleType) {
|
|
10982
10811
|
return;
|
|
@@ -11022,7 +10851,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11022
10851
|
function startConnection() {
|
|
11023
10852
|
connectionStarted = true;
|
|
11024
10853
|
updateConnection(previousConnection);
|
|
11025
|
-
onConnectStart
|
|
10854
|
+
onConnectStart?.(event, { nodeId, handleId, handleType });
|
|
11026
10855
|
}
|
|
11027
10856
|
if (dragThreshold === 0) {
|
|
11028
10857
|
startConnection();
|
|
@@ -11085,16 +10914,16 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11085
10914
|
}
|
|
11086
10915
|
if (connectionStarted) {
|
|
11087
10916
|
if ((closestHandle || resultHandleDomNode) && connection && isValid2) {
|
|
11088
|
-
onConnect
|
|
10917
|
+
onConnect?.(connection);
|
|
11089
10918
|
}
|
|
11090
10919
|
const { inProgress, ...connectionState } = previousConnection;
|
|
11091
10920
|
const finalConnectionState = {
|
|
11092
10921
|
...connectionState,
|
|
11093
10922
|
toPosition: previousConnection.toHandle ? previousConnection.toPosition : null
|
|
11094
10923
|
};
|
|
11095
|
-
onConnectEnd
|
|
10924
|
+
onConnectEnd?.(event2, finalConnectionState);
|
|
11096
10925
|
if (edgeUpdaterType) {
|
|
11097
|
-
onReconnectEnd
|
|
10926
|
+
onReconnectEnd?.(event2, finalConnectionState);
|
|
11098
10927
|
}
|
|
11099
10928
|
}
|
|
11100
10929
|
cancelConnection();
|
|
@@ -11115,10 +10944,10 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
11115
10944
|
}
|
|
11116
10945
|
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, nodeLookup }) {
|
|
11117
10946
|
const isTarget = fromType === "target";
|
|
11118
|
-
const handleDomNode = handle ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle
|
|
10947
|
+
const handleDomNode = handle ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`) : null;
|
|
11119
10948
|
const { x, y } = getEventPosition(event);
|
|
11120
10949
|
const handleBelow = doc.elementFromPoint(x, y);
|
|
11121
|
-
const handleToCheck =
|
|
10950
|
+
const handleToCheck = handleBelow?.classList.contains(`${lib}-flow__handle`) ? handleBelow : handleDomNode;
|
|
11122
10951
|
const result = {
|
|
11123
10952
|
handleDomNode: handleToCheck,
|
|
11124
10953
|
isValid: false,
|
|
@@ -11269,11 +11098,11 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
|
|
|
11269
11098
|
clearTimeout(zoomPanValues.panScrollTimeout);
|
|
11270
11099
|
if (!zoomPanValues.isPanScrolling) {
|
|
11271
11100
|
zoomPanValues.isPanScrolling = true;
|
|
11272
|
-
onPanZoomStart
|
|
11101
|
+
onPanZoomStart?.(event, nextViewport);
|
|
11273
11102
|
} else {
|
|
11274
|
-
onPanZoom
|
|
11103
|
+
onPanZoom?.(event, nextViewport);
|
|
11275
11104
|
zoomPanValues.panScrollTimeout = setTimeout(() => {
|
|
11276
|
-
onPanZoomEnd
|
|
11105
|
+
onPanZoomEnd?.(event, nextViewport);
|
|
11277
11106
|
zoomPanValues.isPanScrolling = false;
|
|
11278
11107
|
}, 150);
|
|
11279
11108
|
}
|
|
@@ -11296,38 +11125,35 @@ function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomH
|
|
|
11296
11125
|
}
|
|
11297
11126
|
function createPanZoomStartHandler({ zoomPanValues, onDraggingChange, onPanZoomStart }) {
|
|
11298
11127
|
return (event) => {
|
|
11299
|
-
|
|
11300
|
-
if ((_a = event.sourceEvent) == null ? void 0 : _a.internal) {
|
|
11128
|
+
if (event.sourceEvent?.internal) {
|
|
11301
11129
|
return;
|
|
11302
11130
|
}
|
|
11303
11131
|
const viewport = transformToViewport(event.transform);
|
|
11304
|
-
zoomPanValues.mouseButton =
|
|
11132
|
+
zoomPanValues.mouseButton = event.sourceEvent?.button || 0;
|
|
11305
11133
|
zoomPanValues.isZoomingOrPanning = true;
|
|
11306
11134
|
zoomPanValues.prevViewport = viewport;
|
|
11307
|
-
if (
|
|
11135
|
+
if (event.sourceEvent?.type === "mousedown") {
|
|
11308
11136
|
onDraggingChange(true);
|
|
11309
11137
|
}
|
|
11310
11138
|
if (onPanZoomStart) {
|
|
11311
|
-
onPanZoomStart
|
|
11139
|
+
onPanZoomStart?.(event.sourceEvent, viewport);
|
|
11312
11140
|
}
|
|
11313
11141
|
};
|
|
11314
11142
|
}
|
|
11315
11143
|
function createPanZoomHandler({ zoomPanValues, panOnDrag, onPaneContextMenu, onTransformChange, onPanZoom }) {
|
|
11316
11144
|
return (event) => {
|
|
11317
|
-
var _a, _b;
|
|
11318
11145
|
zoomPanValues.usedRightMouseButton = !!(onPaneContextMenu && isRightClickPan(panOnDrag, zoomPanValues.mouseButton ?? 0));
|
|
11319
|
-
if (!
|
|
11146
|
+
if (!event.sourceEvent?.sync) {
|
|
11320
11147
|
onTransformChange([event.transform.x, event.transform.y, event.transform.k]);
|
|
11321
11148
|
}
|
|
11322
|
-
if (onPanZoom && !
|
|
11323
|
-
onPanZoom
|
|
11149
|
+
if (onPanZoom && !event.sourceEvent?.internal) {
|
|
11150
|
+
onPanZoom?.(event.sourceEvent, transformToViewport(event.transform));
|
|
11324
11151
|
}
|
|
11325
11152
|
};
|
|
11326
11153
|
}
|
|
11327
11154
|
function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDraggingChange, onPanZoomEnd, onPaneContextMenu }) {
|
|
11328
11155
|
return (event) => {
|
|
11329
|
-
|
|
11330
|
-
if ((_a = event.sourceEvent) == null ? void 0 : _a.internal) {
|
|
11156
|
+
if (event.sourceEvent?.internal) {
|
|
11331
11157
|
return;
|
|
11332
11158
|
}
|
|
11333
11159
|
zoomPanValues.isZoomingOrPanning = false;
|
|
@@ -11342,7 +11168,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
11342
11168
|
clearTimeout(zoomPanValues.timerId);
|
|
11343
11169
|
zoomPanValues.timerId = setTimeout(
|
|
11344
11170
|
() => {
|
|
11345
|
-
onPanZoomEnd
|
|
11171
|
+
onPanZoomEnd?.(event.sourceEvent, viewport);
|
|
11346
11172
|
},
|
|
11347
11173
|
// we need a setTimeout for panOnScroll to supress multiple end events fired during scroll
|
|
11348
11174
|
panOnScroll ? 150 : 0
|
|
@@ -11352,7 +11178,6 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
11352
11178
|
}
|
|
11353
11179
|
function createFilter({ zoomActivationKeyPressed, zoomOnScroll, zoomOnPinch, panOnDrag, panOnScroll, zoomOnDoubleClick, userSelectionActive, noWheelClassName, noPanClassName, lib, connectionInProgress }) {
|
|
11354
11180
|
return (event) => {
|
|
11355
|
-
var _a;
|
|
11356
11181
|
const zoomScroll = zoomActivationKeyPressed || zoomOnScroll;
|
|
11357
11182
|
const pinchZoom = zoomOnPinch && event.ctrlKey;
|
|
11358
11183
|
const isWheelEvent = event.type === "wheel";
|
|
@@ -11377,7 +11202,7 @@ function createFilter({ zoomActivationKeyPressed, zoomOnScroll, zoomOnPinch, pan
|
|
|
11377
11202
|
if (!zoomOnPinch && event.ctrlKey && isWheelEvent) {
|
|
11378
11203
|
return false;
|
|
11379
11204
|
}
|
|
11380
|
-
if (!zoomOnPinch && event.type === "touchstart" &&
|
|
11205
|
+
if (!zoomOnPinch && event.type === "touchstart" && event.touches?.length > 1) {
|
|
11381
11206
|
event.preventDefault();
|
|
11382
11207
|
return false;
|
|
11383
11208
|
}
|
|
@@ -11418,10 +11243,10 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
11418
11243
|
const d3ZoomHandler = d3Selection.on("wheel.zoom");
|
|
11419
11244
|
const d3DblClickZoomHandler = d3Selection.on("dblclick.zoom");
|
|
11420
11245
|
d3ZoomInstance.wheelDelta(wheelDelta);
|
|
11421
|
-
function setTransform(transform2,
|
|
11246
|
+
function setTransform(transform2, options2) {
|
|
11422
11247
|
if (d3Selection) {
|
|
11423
11248
|
return new Promise((resolve) => {
|
|
11424
|
-
d3ZoomInstance
|
|
11249
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).transform(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), transform2);
|
|
11425
11250
|
});
|
|
11426
11251
|
}
|
|
11427
11252
|
return Promise.resolve(false);
|
|
@@ -11499,15 +11324,15 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
11499
11324
|
}
|
|
11500
11325
|
async function setViewportConstrained(viewport2, extent, translateExtent2) {
|
|
11501
11326
|
const nextTransform = viewportToTransform(viewport2);
|
|
11502
|
-
const contrainedTransform = d3ZoomInstance
|
|
11327
|
+
const contrainedTransform = d3ZoomInstance?.constrain()(nextTransform, extent, translateExtent2);
|
|
11503
11328
|
if (contrainedTransform) {
|
|
11504
11329
|
await setTransform(contrainedTransform);
|
|
11505
11330
|
}
|
|
11506
11331
|
return new Promise((resolve) => resolve(contrainedTransform));
|
|
11507
11332
|
}
|
|
11508
|
-
async function setViewport(viewport2,
|
|
11333
|
+
async function setViewport(viewport2, options2) {
|
|
11509
11334
|
const nextTransform = viewportToTransform(viewport2);
|
|
11510
|
-
await setTransform(nextTransform,
|
|
11335
|
+
await setTransform(nextTransform, options2);
|
|
11511
11336
|
return new Promise((resolve) => resolve(nextTransform));
|
|
11512
11337
|
}
|
|
11513
11338
|
function syncViewport(viewport2) {
|
|
@@ -11515,7 +11340,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
11515
11340
|
const nextTransform = viewportToTransform(viewport2);
|
|
11516
11341
|
const currentTransform = d3Selection.property("__zoom");
|
|
11517
11342
|
if (currentTransform.k !== viewport2.zoom || currentTransform.x !== viewport2.x || currentTransform.y !== viewport2.y) {
|
|
11518
|
-
d3ZoomInstance
|
|
11343
|
+
d3ZoomInstance?.transform(d3Selection, nextTransform, null, { sync: true });
|
|
11519
11344
|
}
|
|
11520
11345
|
}
|
|
11521
11346
|
}
|
|
@@ -11523,31 +11348,31 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
|
|
|
11523
11348
|
const transform$1 = d3Selection ? transform(d3Selection.node()) : { x: 0, y: 0, k: 1 };
|
|
11524
11349
|
return { x: transform$1.x, y: transform$1.y, zoom: transform$1.k };
|
|
11525
11350
|
}
|
|
11526
|
-
function scaleTo(zoom2,
|
|
11351
|
+
function scaleTo(zoom2, options2) {
|
|
11527
11352
|
if (d3Selection) {
|
|
11528
11353
|
return new Promise((resolve) => {
|
|
11529
|
-
d3ZoomInstance
|
|
11354
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleTo(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), zoom2);
|
|
11530
11355
|
});
|
|
11531
11356
|
}
|
|
11532
11357
|
return Promise.resolve(false);
|
|
11533
11358
|
}
|
|
11534
|
-
function scaleBy(factor,
|
|
11359
|
+
function scaleBy(factor, options2) {
|
|
11535
11360
|
if (d3Selection) {
|
|
11536
11361
|
return new Promise((resolve) => {
|
|
11537
|
-
d3ZoomInstance
|
|
11362
|
+
d3ZoomInstance?.interpolate(options2?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleBy(getD3Transition(d3Selection, options2?.duration, options2?.ease, () => resolve(true)), factor);
|
|
11538
11363
|
});
|
|
11539
11364
|
}
|
|
11540
11365
|
return Promise.resolve(false);
|
|
11541
11366
|
}
|
|
11542
11367
|
function setScaleExtent(scaleExtent) {
|
|
11543
|
-
d3ZoomInstance
|
|
11368
|
+
d3ZoomInstance?.scaleExtent(scaleExtent);
|
|
11544
11369
|
}
|
|
11545
11370
|
function setTranslateExtent(translateExtent2) {
|
|
11546
|
-
d3ZoomInstance
|
|
11371
|
+
d3ZoomInstance?.translateExtent(translateExtent2);
|
|
11547
11372
|
}
|
|
11548
11373
|
function setClickDistance(distance2) {
|
|
11549
11374
|
const validDistance = !isNumeric(distance2) || distance2 < 0 ? 0 : distance2;
|
|
11550
|
-
d3ZoomInstance
|
|
11375
|
+
d3ZoomInstance?.clickDistance(validDistance);
|
|
11551
11376
|
}
|
|
11552
11377
|
return {
|
|
11553
11378
|
update,
|
|
@@ -11785,7 +11610,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
11785
11610
|
if (!node) {
|
|
11786
11611
|
return;
|
|
11787
11612
|
}
|
|
11788
|
-
containerBounds =
|
|
11613
|
+
containerBounds = paneDomNode?.getBoundingClientRect() ?? null;
|
|
11789
11614
|
const { xSnapped, ySnapped } = getPointerPosition(event.sourceEvent, {
|
|
11790
11615
|
transform: transform2,
|
|
11791
11616
|
snapGrid,
|
|
@@ -11831,7 +11656,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
11831
11656
|
}
|
|
11832
11657
|
}
|
|
11833
11658
|
}
|
|
11834
|
-
onResizeStart
|
|
11659
|
+
onResizeStart?.(event, { ...prevValues });
|
|
11835
11660
|
}).on("drag", (event) => {
|
|
11836
11661
|
const { transform: transform2, snapGrid, snapToGrid, nodeOrigin: storeNodeOrigin } = getStoreItems();
|
|
11837
11662
|
const pointerPosition = getPointerPosition(event.sourceEvent, {
|
|
@@ -11899,19 +11724,19 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
11899
11724
|
affectsY: params.controlDirection.affectsY
|
|
11900
11725
|
});
|
|
11901
11726
|
const nextValues = { ...prevValues, direction };
|
|
11902
|
-
const callResize = shouldResize
|
|
11727
|
+
const callResize = shouldResize?.(event, nextValues);
|
|
11903
11728
|
if (callResize === false) {
|
|
11904
11729
|
return;
|
|
11905
11730
|
}
|
|
11906
11731
|
resizeDetected = true;
|
|
11907
|
-
onResize
|
|
11732
|
+
onResize?.(event, nextValues);
|
|
11908
11733
|
onChange(change, childChanges);
|
|
11909
11734
|
}).on("end", (event) => {
|
|
11910
11735
|
if (!resizeDetected) {
|
|
11911
11736
|
return;
|
|
11912
11737
|
}
|
|
11913
|
-
onResizeEnd
|
|
11914
|
-
onEnd
|
|
11738
|
+
onResizeEnd?.(event, { ...prevValues });
|
|
11739
|
+
onEnd?.({ ...prevValues });
|
|
11915
11740
|
resizeDetected = false;
|
|
11916
11741
|
});
|
|
11917
11742
|
selection2.call(dragHandler);
|
|
@@ -11928,15 +11753,6 @@ var withSelector = { exports: {} };
|
|
|
11928
11753
|
var withSelector_production = {};
|
|
11929
11754
|
var shim = { exports: {} };
|
|
11930
11755
|
var useSyncExternalStoreShim_production = {};
|
|
11931
|
-
/**
|
|
11932
|
-
* @license React
|
|
11933
|
-
* use-sync-external-store-shim.production.js
|
|
11934
|
-
*
|
|
11935
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11936
|
-
*
|
|
11937
|
-
* This source code is licensed under the MIT license found in the
|
|
11938
|
-
* LICENSE file in the root directory of this source tree.
|
|
11939
|
-
*/
|
|
11940
11756
|
var hasRequiredUseSyncExternalStoreShim_production;
|
|
11941
11757
|
function requireUseSyncExternalStoreShim_production() {
|
|
11942
11758
|
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
@@ -11994,15 +11810,6 @@ function requireShim() {
|
|
|
11994
11810
|
}
|
|
11995
11811
|
return shim.exports;
|
|
11996
11812
|
}
|
|
11997
|
-
/**
|
|
11998
|
-
* @license React
|
|
11999
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
12000
|
-
*
|
|
12001
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12002
|
-
*
|
|
12003
|
-
* This source code is licensed under the MIT license found in the
|
|
12004
|
-
* LICENSE file in the root directory of this source tree.
|
|
12005
|
-
*/
|
|
12006
11813
|
var hasRequiredWithSelector_production;
|
|
12007
11814
|
function requireWithSelector_production() {
|
|
12008
11815
|
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
@@ -12216,7 +12023,7 @@ const Panel = reactExports.forwardRef(({ position = "top-left", children: childr
|
|
|
12216
12023
|
});
|
|
12217
12024
|
Panel.displayName = "Panel";
|
|
12218
12025
|
function Attribution({ proOptions, position = "bottom-right" }) {
|
|
12219
|
-
if (proOptions
|
|
12026
|
+
if (proOptions?.hideAttribution) {
|
|
12220
12027
|
return null;
|
|
12221
12028
|
}
|
|
12222
12029
|
return jsxRuntimeExports.jsx(Panel, { position, className: "react-flow__attribution", "data-message": "Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev", children: jsxRuntimeExports.jsx("a", { href: "https://reactflow.dev", target: "_blank", rel: "noopener noreferrer", "aria-label": "React Flow attribution", children: "React Flow" }) });
|
|
@@ -12245,7 +12052,7 @@ function SelectionListenerInner({ onSelectionChange }) {
|
|
|
12245
12052
|
const { selectedNodes, selectedEdges } = useStore(selector$m, areEqual);
|
|
12246
12053
|
reactExports.useEffect(() => {
|
|
12247
12054
|
const params = { nodes: selectedNodes, edges: selectedEdges };
|
|
12248
|
-
onSelectionChange
|
|
12055
|
+
onSelectionChange?.(params);
|
|
12249
12056
|
store.getState().onSelectionChangeHandlers.forEach((fn) => fn(params));
|
|
12250
12057
|
}, [selectedNodes, selectedEdges, onSelectionChange]);
|
|
12251
12058
|
return null;
|
|
@@ -12400,7 +12207,6 @@ function getMediaQuery() {
|
|
|
12400
12207
|
return window.matchMedia("(prefers-color-scheme: dark)");
|
|
12401
12208
|
}
|
|
12402
12209
|
function useColorModeClass(colorMode) {
|
|
12403
|
-
var _a;
|
|
12404
12210
|
const [colorModeClass, setColorModeClass] = reactExports.useState(colorMode === "system" ? null : colorMode);
|
|
12405
12211
|
reactExports.useEffect(() => {
|
|
12406
12212
|
if (colorMode !== "system") {
|
|
@@ -12408,17 +12214,17 @@ function useColorModeClass(colorMode) {
|
|
|
12408
12214
|
return;
|
|
12409
12215
|
}
|
|
12410
12216
|
const mediaQuery = getMediaQuery();
|
|
12411
|
-
const updateColorModeClass = () => setColorModeClass(
|
|
12217
|
+
const updateColorModeClass = () => setColorModeClass(mediaQuery?.matches ? "dark" : "light");
|
|
12412
12218
|
updateColorModeClass();
|
|
12413
|
-
mediaQuery
|
|
12219
|
+
mediaQuery?.addEventListener("change", updateColorModeClass);
|
|
12414
12220
|
return () => {
|
|
12415
|
-
mediaQuery
|
|
12221
|
+
mediaQuery?.removeEventListener("change", updateColorModeClass);
|
|
12416
12222
|
};
|
|
12417
12223
|
}, [colorMode]);
|
|
12418
|
-
return colorModeClass !== null ? colorModeClass :
|
|
12224
|
+
return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? "dark" : "light";
|
|
12419
12225
|
}
|
|
12420
12226
|
const defaultDoc = typeof document !== "undefined" ? document : null;
|
|
12421
|
-
function useKeyPress(keyCode = null,
|
|
12227
|
+
function useKeyPress(keyCode = null, options2 = { target: defaultDoc, actInsideInputWithModifier: true }) {
|
|
12422
12228
|
const [keyPressed, setKeyPressed] = reactExports.useState(false);
|
|
12423
12229
|
const modifierPressed = reactExports.useRef(false);
|
|
12424
12230
|
const pressedKeys = reactExports.useRef(/* @__PURE__ */ new Set([]));
|
|
@@ -12432,11 +12238,10 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
12432
12238
|
return [[], []];
|
|
12433
12239
|
}, [keyCode]);
|
|
12434
12240
|
reactExports.useEffect(() => {
|
|
12435
|
-
const target =
|
|
12436
|
-
const actInsideInputWithModifier =
|
|
12241
|
+
const target = options2?.target ?? defaultDoc;
|
|
12242
|
+
const actInsideInputWithModifier = options2?.actInsideInputWithModifier ?? true;
|
|
12437
12243
|
if (keyCode !== null) {
|
|
12438
12244
|
const downHandler = (event) => {
|
|
12439
|
-
var _a, _b;
|
|
12440
12245
|
modifierPressed.current = event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;
|
|
12441
12246
|
const preventAction = (!modifierPressed.current || modifierPressed.current && !actInsideInputWithModifier) && isInputDOMNode(event);
|
|
12442
12247
|
if (preventAction) {
|
|
@@ -12445,9 +12250,9 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
12445
12250
|
const keyOrCode = useKeyOrCode(event.code, keysToWatch);
|
|
12446
12251
|
pressedKeys.current.add(event[keyOrCode]);
|
|
12447
12252
|
if (isMatchingKey(keyCodes, pressedKeys.current, false)) {
|
|
12448
|
-
const target2 =
|
|
12449
|
-
const isInteractiveElement =
|
|
12450
|
-
if (
|
|
12253
|
+
const target2 = event.composedPath?.()?.[0] || event.target;
|
|
12254
|
+
const isInteractiveElement = target2?.nodeName === "BUTTON" || target2?.nodeName === "A";
|
|
12255
|
+
if (options2.preventDefault !== false && (modifierPressed.current || !isInteractiveElement)) {
|
|
12451
12256
|
event.preventDefault();
|
|
12452
12257
|
}
|
|
12453
12258
|
setKeyPressed(true);
|
|
@@ -12470,13 +12275,13 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
12470
12275
|
pressedKeys.current.clear();
|
|
12471
12276
|
setKeyPressed(false);
|
|
12472
12277
|
};
|
|
12473
|
-
target
|
|
12474
|
-
target
|
|
12278
|
+
target?.addEventListener("keydown", downHandler);
|
|
12279
|
+
target?.addEventListener("keyup", upHandler);
|
|
12475
12280
|
window.addEventListener("blur", resetHandler);
|
|
12476
12281
|
window.addEventListener("contextmenu", resetHandler);
|
|
12477
12282
|
return () => {
|
|
12478
|
-
target
|
|
12479
|
-
target
|
|
12283
|
+
target?.removeEventListener("keydown", downHandler);
|
|
12284
|
+
target?.removeEventListener("keyup", upHandler);
|
|
12480
12285
|
window.removeEventListener("blur", resetHandler);
|
|
12481
12286
|
window.removeEventListener("contextmenu", resetHandler);
|
|
12482
12287
|
};
|
|
@@ -12494,20 +12299,20 @@ const useViewportHelper = () => {
|
|
|
12494
12299
|
const store = useStoreApi();
|
|
12495
12300
|
return reactExports.useMemo(() => {
|
|
12496
12301
|
return {
|
|
12497
|
-
zoomIn: (
|
|
12302
|
+
zoomIn: (options2) => {
|
|
12498
12303
|
const { panZoom } = store.getState();
|
|
12499
|
-
return panZoom ? panZoom.scaleBy(1.2, { duration:
|
|
12304
|
+
return panZoom ? panZoom.scaleBy(1.2, { duration: options2?.duration }) : Promise.resolve(false);
|
|
12500
12305
|
},
|
|
12501
|
-
zoomOut: (
|
|
12306
|
+
zoomOut: (options2) => {
|
|
12502
12307
|
const { panZoom } = store.getState();
|
|
12503
|
-
return panZoom ? panZoom.scaleBy(1 / 1.2, { duration:
|
|
12308
|
+
return panZoom ? panZoom.scaleBy(1 / 1.2, { duration: options2?.duration }) : Promise.resolve(false);
|
|
12504
12309
|
},
|
|
12505
|
-
zoomTo: (zoomLevel,
|
|
12310
|
+
zoomTo: (zoomLevel, options2) => {
|
|
12506
12311
|
const { panZoom } = store.getState();
|
|
12507
|
-
return panZoom ? panZoom.scaleTo(zoomLevel, { duration:
|
|
12312
|
+
return panZoom ? panZoom.scaleTo(zoomLevel, { duration: options2?.duration }) : Promise.resolve(false);
|
|
12508
12313
|
},
|
|
12509
12314
|
getZoom: () => store.getState().transform[2],
|
|
12510
|
-
setViewport: async (viewport,
|
|
12315
|
+
setViewport: async (viewport, options2) => {
|
|
12511
12316
|
const { transform: [tX, tY, tZoom], panZoom } = store.getState();
|
|
12512
12317
|
if (!panZoom) {
|
|
12513
12318
|
return Promise.resolve(false);
|
|
@@ -12516,30 +12321,30 @@ const useViewportHelper = () => {
|
|
|
12516
12321
|
x: viewport.x ?? tX,
|
|
12517
12322
|
y: viewport.y ?? tY,
|
|
12518
12323
|
zoom: viewport.zoom ?? tZoom
|
|
12519
|
-
},
|
|
12324
|
+
}, options2);
|
|
12520
12325
|
return Promise.resolve(true);
|
|
12521
12326
|
},
|
|
12522
12327
|
getViewport: () => {
|
|
12523
12328
|
const [x, y, zoom2] = store.getState().transform;
|
|
12524
12329
|
return { x, y, zoom: zoom2 };
|
|
12525
12330
|
},
|
|
12526
|
-
setCenter: async (x, y,
|
|
12527
|
-
return store.getState().setCenter(x, y,
|
|
12331
|
+
setCenter: async (x, y, options2) => {
|
|
12332
|
+
return store.getState().setCenter(x, y, options2);
|
|
12528
12333
|
},
|
|
12529
|
-
fitBounds: async (bounds,
|
|
12334
|
+
fitBounds: async (bounds, options2) => {
|
|
12530
12335
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
12531
|
-
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom,
|
|
12336
|
+
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options2?.padding ?? 0.1);
|
|
12532
12337
|
if (!panZoom) {
|
|
12533
12338
|
return Promise.resolve(false);
|
|
12534
12339
|
}
|
|
12535
12340
|
await panZoom.setViewport(viewport, {
|
|
12536
|
-
duration:
|
|
12537
|
-
ease:
|
|
12538
|
-
interpolate:
|
|
12341
|
+
duration: options2?.duration,
|
|
12342
|
+
ease: options2?.ease,
|
|
12343
|
+
interpolate: options2?.interpolate
|
|
12539
12344
|
});
|
|
12540
12345
|
return Promise.resolve(true);
|
|
12541
12346
|
},
|
|
12542
|
-
screenToFlowPosition: (clientPosition,
|
|
12347
|
+
screenToFlowPosition: (clientPosition, options2 = {}) => {
|
|
12543
12348
|
const { transform: transform2, snapGrid, snapToGrid, domNode } = store.getState();
|
|
12544
12349
|
if (!domNode) {
|
|
12545
12350
|
return clientPosition;
|
|
@@ -12549,8 +12354,8 @@ const useViewportHelper = () => {
|
|
|
12549
12354
|
x: clientPosition.x - domX,
|
|
12550
12355
|
y: clientPosition.y - domY
|
|
12551
12356
|
};
|
|
12552
|
-
const _snapGrid =
|
|
12553
|
-
const _snapToGrid =
|
|
12357
|
+
const _snapGrid = options2.snapGrid ?? snapGrid;
|
|
12358
|
+
const _snapToGrid = options2.snapToGrid ?? snapToGrid;
|
|
12554
12359
|
return pointToRendererPoint(correctedPosition, transform2, _snapToGrid, _snapGrid);
|
|
12555
12360
|
},
|
|
12556
12361
|
flowToScreenPosition: (flowPosition) => {
|
|
@@ -12680,12 +12485,11 @@ function getSelectionChanges(items, selectedIds = /* @__PURE__ */ new Set(), mut
|
|
|
12680
12485
|
return changes;
|
|
12681
12486
|
}
|
|
12682
12487
|
function getElementsDiffChanges({ items = [], lookup }) {
|
|
12683
|
-
var _a;
|
|
12684
12488
|
const changes = [];
|
|
12685
12489
|
const itemsLookup = new Map(items.map((item) => [item.id, item]));
|
|
12686
12490
|
for (const [index2, item] of items.entries()) {
|
|
12687
12491
|
const lookupItem = lookup.get(item.id);
|
|
12688
|
-
const storeItem =
|
|
12492
|
+
const storeItem = lookupItem?.internals?.userNode ?? lookupItem;
|
|
12689
12493
|
if (storeItem !== void 0 && storeItem !== item) {
|
|
12690
12494
|
changes.push({ id: item.id, item, type: "replace" });
|
|
12691
12495
|
}
|
|
@@ -12758,7 +12562,7 @@ function BatchProvider({ children: children2 }) {
|
|
|
12758
12562
|
setNodes(next);
|
|
12759
12563
|
}
|
|
12760
12564
|
if (changes.length > 0) {
|
|
12761
|
-
onNodesChange
|
|
12565
|
+
onNodesChange?.(changes);
|
|
12762
12566
|
} else if (fitViewQueued) {
|
|
12763
12567
|
window.requestAnimationFrame(() => {
|
|
12764
12568
|
const { fitViewQueued: fitViewQueued2, nodes: nodes2, setNodes: setNodes2 } = store.getState();
|
|
@@ -12810,42 +12614,38 @@ function useReactFlow() {
|
|
|
12810
12614
|
batchContext.edgeQueue.push(payload);
|
|
12811
12615
|
};
|
|
12812
12616
|
const getNodeRect = (node) => {
|
|
12813
|
-
var _a, _b;
|
|
12814
12617
|
const { nodeLookup, nodeOrigin } = store.getState();
|
|
12815
12618
|
const nodeToUse = isNode(node) ? node : nodeLookup.get(node.id);
|
|
12816
12619
|
const position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, nodeLookup, nodeOrigin) : nodeToUse.position;
|
|
12817
12620
|
const nodeWithPosition = {
|
|
12818
12621
|
...nodeToUse,
|
|
12819
12622
|
position,
|
|
12820
|
-
width:
|
|
12821
|
-
height:
|
|
12623
|
+
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
|
12624
|
+
height: nodeToUse.measured?.height ?? nodeToUse.height
|
|
12822
12625
|
};
|
|
12823
12626
|
return nodeToRect(nodeWithPosition);
|
|
12824
12627
|
};
|
|
12825
|
-
const updateNode = (id2, nodeUpdate,
|
|
12628
|
+
const updateNode = (id2, nodeUpdate, options2 = { replace: false }) => {
|
|
12826
12629
|
setNodes((prevNodes) => prevNodes.map((node) => {
|
|
12827
12630
|
if (node.id === id2) {
|
|
12828
12631
|
const nextNode = typeof nodeUpdate === "function" ? nodeUpdate(node) : nodeUpdate;
|
|
12829
|
-
return
|
|
12632
|
+
return options2.replace && isNode(nextNode) ? nextNode : { ...node, ...nextNode };
|
|
12830
12633
|
}
|
|
12831
12634
|
return node;
|
|
12832
12635
|
}));
|
|
12833
12636
|
};
|
|
12834
|
-
const updateEdge = (id2, edgeUpdate,
|
|
12637
|
+
const updateEdge = (id2, edgeUpdate, options2 = { replace: false }) => {
|
|
12835
12638
|
setEdges((prevEdges) => prevEdges.map((edge) => {
|
|
12836
12639
|
if (edge.id === id2) {
|
|
12837
12640
|
const nextEdge = typeof edgeUpdate === "function" ? edgeUpdate(edge) : edgeUpdate;
|
|
12838
|
-
return
|
|
12641
|
+
return options2.replace && isEdge(nextEdge) ? nextEdge : { ...edge, ...nextEdge };
|
|
12839
12642
|
}
|
|
12840
12643
|
return edge;
|
|
12841
12644
|
}));
|
|
12842
12645
|
};
|
|
12843
12646
|
return {
|
|
12844
12647
|
getNodes: () => store.getState().nodes.map((n) => ({ ...n })),
|
|
12845
|
-
getNode: (id2) =>
|
|
12846
|
-
var _a;
|
|
12847
|
-
return (_a = getInternalNode(id2)) == null ? void 0 : _a.internals.userNode;
|
|
12848
|
-
},
|
|
12648
|
+
getNode: (id2) => getInternalNode(id2)?.internals.userNode,
|
|
12849
12649
|
getInternalNode,
|
|
12850
12650
|
getEdges: () => {
|
|
12851
12651
|
const { edges = [] } = store.getState();
|
|
@@ -12888,16 +12688,16 @@ function useReactFlow() {
|
|
|
12888
12688
|
const hasMatchingNodes = matchingNodes.length > 0;
|
|
12889
12689
|
if (hasMatchingEdges) {
|
|
12890
12690
|
const edgeChanges = matchingEdges.map(elementToRemoveChange);
|
|
12891
|
-
onEdgesDelete
|
|
12691
|
+
onEdgesDelete?.(matchingEdges);
|
|
12892
12692
|
triggerEdgeChanges(edgeChanges);
|
|
12893
12693
|
}
|
|
12894
12694
|
if (hasMatchingNodes) {
|
|
12895
12695
|
const nodeChanges = matchingNodes.map(elementToRemoveChange);
|
|
12896
|
-
onNodesDelete
|
|
12696
|
+
onNodesDelete?.(matchingNodes);
|
|
12897
12697
|
triggerNodeChanges(nodeChanges);
|
|
12898
12698
|
}
|
|
12899
12699
|
if (hasMatchingNodes || hasMatchingEdges) {
|
|
12900
|
-
onDelete
|
|
12700
|
+
onDelete?.({ nodes: matchingNodes, edges: matchingEdges });
|
|
12901
12701
|
}
|
|
12902
12702
|
return { deletedNodes: matchingNodes, deletedEdges: matchingEdges };
|
|
12903
12703
|
},
|
|
@@ -12935,34 +12735,28 @@ function useReactFlow() {
|
|
|
12935
12735
|
return partiallyVisible || overlappingArea >= area.width * area.height || overlappingArea >= nodeRect.width * nodeRect.height;
|
|
12936
12736
|
},
|
|
12937
12737
|
updateNode,
|
|
12938
|
-
updateNodeData: (id2, dataUpdate,
|
|
12738
|
+
updateNodeData: (id2, dataUpdate, options2 = { replace: false }) => {
|
|
12939
12739
|
updateNode(id2, (node) => {
|
|
12940
12740
|
const nextData = typeof dataUpdate === "function" ? dataUpdate(node) : dataUpdate;
|
|
12941
|
-
return
|
|
12942
|
-
},
|
|
12741
|
+
return options2.replace ? { ...node, data: nextData } : { ...node, data: { ...node.data, ...nextData } };
|
|
12742
|
+
}, options2);
|
|
12943
12743
|
},
|
|
12944
12744
|
updateEdge,
|
|
12945
|
-
updateEdgeData: (id2, dataUpdate,
|
|
12745
|
+
updateEdgeData: (id2, dataUpdate, options2 = { replace: false }) => {
|
|
12946
12746
|
updateEdge(id2, (edge) => {
|
|
12947
12747
|
const nextData = typeof dataUpdate === "function" ? dataUpdate(edge) : dataUpdate;
|
|
12948
|
-
return
|
|
12949
|
-
},
|
|
12748
|
+
return options2.replace ? { ...edge, data: nextData } : { ...edge, data: { ...edge.data, ...nextData } };
|
|
12749
|
+
}, options2);
|
|
12950
12750
|
},
|
|
12951
12751
|
getNodesBounds: (nodes) => {
|
|
12952
12752
|
const { nodeLookup, nodeOrigin } = store.getState();
|
|
12953
12753
|
return getNodesBounds(nodes, { nodeLookup, nodeOrigin });
|
|
12954
12754
|
},
|
|
12955
|
-
getHandleConnections: ({ type, id: id2, nodeId }) => {
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
},
|
|
12959
|
-
getNodeConnections: ({ type, handleId, nodeId }) => {
|
|
12960
|
-
var _a;
|
|
12961
|
-
return Array.from(((_a = store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)) == null ? void 0 : _a.values()) ?? []);
|
|
12962
|
-
},
|
|
12963
|
-
fitView: async (options) => {
|
|
12755
|
+
getHandleConnections: ({ type, id: id2, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}-${type}${id2 ? `-${id2}` : ""}`)?.values() ?? []),
|
|
12756
|
+
getNodeConnections: ({ type, handleId, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)?.values() ?? []),
|
|
12757
|
+
fitView: async (options2) => {
|
|
12964
12758
|
const fitViewResolver = store.getState().fitViewResolver ?? withResolvers();
|
|
12965
|
-
store.setState({ fitViewQueued: true, fitViewOptions:
|
|
12759
|
+
store.setState({ fitViewQueued: true, fitViewOptions: options2, fitViewResolver });
|
|
12966
12760
|
batchContext.nodeQueue.push((nodes) => [...nodes]);
|
|
12967
12761
|
return fitViewResolver.promise;
|
|
12968
12762
|
}
|
|
@@ -12998,13 +12792,12 @@ function useResizeHandler(domNode) {
|
|
|
12998
12792
|
const store = useStoreApi();
|
|
12999
12793
|
reactExports.useEffect(() => {
|
|
13000
12794
|
const updateDimensions = () => {
|
|
13001
|
-
|
|
13002
|
-
if (!domNode.current || !(((_b = (_a = domNode.current).checkVisibility) == null ? void 0 : _b.call(_a)) ?? true)) {
|
|
12795
|
+
if (!domNode.current || !(domNode.current.checkVisibility?.() ?? true)) {
|
|
13003
12796
|
return false;
|
|
13004
12797
|
}
|
|
13005
12798
|
const size2 = getDimensions(domNode.current);
|
|
13006
12799
|
if (size2.height === 0 || size2.width === 0) {
|
|
13007
|
-
|
|
12800
|
+
store.getState().onError?.("004", errorMessages["error004"]());
|
|
13008
12801
|
}
|
|
13009
12802
|
store.setState({ width: size2.width || 500, height: size2.height || 500 });
|
|
13010
12803
|
};
|
|
@@ -13042,7 +12835,7 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13042
12835
|
const panZoom = reactExports.useRef();
|
|
13043
12836
|
useResizeHandler(zoomPane);
|
|
13044
12837
|
const onTransformChange = reactExports.useCallback((transform2) => {
|
|
13045
|
-
onViewportChange
|
|
12838
|
+
onViewportChange?.({ x: transform2[0], y: transform2[1], zoom: transform2[2] });
|
|
13046
12839
|
if (!isControlledViewport) {
|
|
13047
12840
|
store.setState({ transform: transform2 });
|
|
13048
12841
|
}
|
|
@@ -13058,18 +12851,18 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13058
12851
|
onDraggingChange: (paneDragging) => store.setState((prevState) => prevState.paneDragging === paneDragging ? prevState : { paneDragging }),
|
|
13059
12852
|
onPanZoomStart: (event, vp) => {
|
|
13060
12853
|
const { onViewportChangeStart, onMoveStart } = store.getState();
|
|
13061
|
-
onMoveStart
|
|
13062
|
-
onViewportChangeStart
|
|
12854
|
+
onMoveStart?.(event, vp);
|
|
12855
|
+
onViewportChangeStart?.(vp);
|
|
13063
12856
|
},
|
|
13064
12857
|
onPanZoom: (event, vp) => {
|
|
13065
12858
|
const { onViewportChange: onViewportChange2, onMove } = store.getState();
|
|
13066
|
-
onMove
|
|
13067
|
-
onViewportChange2
|
|
12859
|
+
onMove?.(event, vp);
|
|
12860
|
+
onViewportChange2?.(vp);
|
|
13068
12861
|
},
|
|
13069
12862
|
onPanZoomEnd: (event, vp) => {
|
|
13070
12863
|
const { onViewportChangeEnd, onMoveEnd } = store.getState();
|
|
13071
|
-
onMoveEnd
|
|
13072
|
-
onViewportChangeEnd
|
|
12864
|
+
onMoveEnd?.(event, vp);
|
|
12865
|
+
onViewportChangeEnd?.(vp);
|
|
13073
12866
|
}
|
|
13074
12867
|
});
|
|
13075
12868
|
const { x, y, zoom: zoom2 } = panZoom.current.getViewport();
|
|
@@ -13079,14 +12872,12 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
13079
12872
|
domNode: zoomPane.current.closest(".react-flow")
|
|
13080
12873
|
});
|
|
13081
12874
|
return () => {
|
|
13082
|
-
|
|
13083
|
-
(_a = panZoom.current) == null ? void 0 : _a.destroy();
|
|
12875
|
+
panZoom.current?.destroy();
|
|
13084
12876
|
};
|
|
13085
12877
|
}
|
|
13086
12878
|
}, []);
|
|
13087
12879
|
reactExports.useEffect(() => {
|
|
13088
|
-
|
|
13089
|
-
(_a = panZoom.current) == null ? void 0 : _a.update({
|
|
12880
|
+
panZoom.current?.update({
|
|
13090
12881
|
onPaneContextMenu,
|
|
13091
12882
|
zoomOnScroll,
|
|
13092
12883
|
zoomOnPinch,
|
|
@@ -13149,7 +12940,7 @@ const wrapHandler = (handler, containerRef) => {
|
|
|
13149
12940
|
if (event.target !== containerRef.current) {
|
|
13150
12941
|
return;
|
|
13151
12942
|
}
|
|
13152
|
-
handler
|
|
12943
|
+
handler?.(event);
|
|
13153
12944
|
};
|
|
13154
12945
|
};
|
|
13155
12946
|
const selector$h = (s) => ({
|
|
@@ -13172,16 +12963,16 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13172
12963
|
selectionInProgress.current = false;
|
|
13173
12964
|
return;
|
|
13174
12965
|
}
|
|
13175
|
-
onPaneClick
|
|
12966
|
+
onPaneClick?.(event);
|
|
13176
12967
|
store.getState().resetSelectedElements();
|
|
13177
12968
|
store.setState({ nodesSelectionActive: false });
|
|
13178
12969
|
};
|
|
13179
12970
|
const onContextMenu = (event) => {
|
|
13180
|
-
if (Array.isArray(panOnDrag) &&
|
|
12971
|
+
if (Array.isArray(panOnDrag) && panOnDrag?.includes(2)) {
|
|
13181
12972
|
event.preventDefault();
|
|
13182
12973
|
return;
|
|
13183
12974
|
}
|
|
13184
|
-
onPaneContextMenu
|
|
12975
|
+
onPaneContextMenu?.(event);
|
|
13185
12976
|
};
|
|
13186
12977
|
const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : void 0;
|
|
13187
12978
|
const onClickCapture = (event) => {
|
|
@@ -13191,9 +12982,8 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13191
12982
|
}
|
|
13192
12983
|
};
|
|
13193
12984
|
const onPointerDownCapture = (event) => {
|
|
13194
|
-
var _a, _b;
|
|
13195
12985
|
const { domNode } = store.getState();
|
|
13196
|
-
containerBounds.current = domNode
|
|
12986
|
+
containerBounds.current = domNode?.getBoundingClientRect();
|
|
13197
12987
|
if (!containerBounds.current)
|
|
13198
12988
|
return;
|
|
13199
12989
|
const eventTargetIsContainer = event.target === container.current;
|
|
@@ -13202,7 +12992,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13202
12992
|
if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
|
|
13203
12993
|
return;
|
|
13204
12994
|
}
|
|
13205
|
-
|
|
12995
|
+
event.target?.setPointerCapture?.(event.pointerId);
|
|
13206
12996
|
selectionInProgress.current = false;
|
|
13207
12997
|
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
13208
12998
|
store.setState({
|
|
@@ -13234,7 +13024,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13234
13024
|
return;
|
|
13235
13025
|
}
|
|
13236
13026
|
resetSelectedElements();
|
|
13237
|
-
onSelectionStart
|
|
13027
|
+
onSelectionStart?.(event);
|
|
13238
13028
|
}
|
|
13239
13029
|
selectionInProgress.current = true;
|
|
13240
13030
|
const nextUserSelectRect = {
|
|
@@ -13249,7 +13039,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13249
13039
|
const prevSelectedEdgeIds = selectedEdgeIds.current;
|
|
13250
13040
|
selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode.Partial, true).map((node) => node.id));
|
|
13251
13041
|
selectedEdgeIds.current = /* @__PURE__ */ new Set();
|
|
13252
|
-
const edgesSelectable =
|
|
13042
|
+
const edgesSelectable = defaultEdgeOptions?.selectable ?? true;
|
|
13253
13043
|
for (const nodeId of selectedNodeIds.current) {
|
|
13254
13044
|
const connections = connectionLookup.get(nodeId);
|
|
13255
13045
|
if (!connections)
|
|
@@ -13276,20 +13066,19 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
13276
13066
|
});
|
|
13277
13067
|
};
|
|
13278
13068
|
const onPointerUp = (event) => {
|
|
13279
|
-
var _a, _b;
|
|
13280
13069
|
if (event.button !== 0) {
|
|
13281
13070
|
return;
|
|
13282
13071
|
}
|
|
13283
|
-
|
|
13072
|
+
event.target?.releasePointerCapture?.(event.pointerId);
|
|
13284
13073
|
if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
|
|
13285
|
-
onClick
|
|
13074
|
+
onClick?.(event);
|
|
13286
13075
|
}
|
|
13287
13076
|
store.setState({
|
|
13288
13077
|
userSelectionActive: false,
|
|
13289
13078
|
userSelectionRect: null
|
|
13290
13079
|
});
|
|
13291
13080
|
if (selectionInProgress.current) {
|
|
13292
|
-
onSelectionEnd
|
|
13081
|
+
onSelectionEnd?.(event);
|
|
13293
13082
|
store.setState({
|
|
13294
13083
|
nodesSelectionActive: selectedNodeIds.current.size > 0
|
|
13295
13084
|
});
|
|
@@ -13302,7 +13091,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
|
13302
13091
|
const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
|
|
13303
13092
|
const node = nodeLookup.get(id2);
|
|
13304
13093
|
if (!node) {
|
|
13305
|
-
onError
|
|
13094
|
+
onError?.("012", errorMessages["error012"](id2));
|
|
13306
13095
|
return;
|
|
13307
13096
|
}
|
|
13308
13097
|
store.setState({ nodesSelectionActive: false });
|
|
@@ -13310,10 +13099,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
|
13310
13099
|
addSelectedNodes([id2]);
|
|
13311
13100
|
} else if (unselect || node.selected && multiSelectionActive) {
|
|
13312
13101
|
unselectNodesAndEdges({ nodes: [node], edges: [] });
|
|
13313
|
-
requestAnimationFrame(() =>
|
|
13314
|
-
var _a;
|
|
13315
|
-
return (_a = nodeRef == null ? void 0 : nodeRef.current) == null ? void 0 : _a.blur();
|
|
13316
|
-
});
|
|
13102
|
+
requestAnimationFrame(() => nodeRef?.current?.blur());
|
|
13317
13103
|
}
|
|
13318
13104
|
}
|
|
13319
13105
|
function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable, nodeClickDistance }) {
|
|
@@ -13351,8 +13137,7 @@ function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, n
|
|
|
13351
13137
|
nodeClickDistance
|
|
13352
13138
|
});
|
|
13353
13139
|
return () => {
|
|
13354
|
-
|
|
13355
|
-
(_a = xyDrag.current) == null ? void 0 : _a.destroy();
|
|
13140
|
+
xyDrag.current?.destroy();
|
|
13356
13141
|
};
|
|
13357
13142
|
}, [noDragClassName, handleSelector, disabled, isSelectable, nodeRef, nodeId, nodeClickDistance]);
|
|
13358
13143
|
return dragging;
|
|
@@ -13410,19 +13195,18 @@ const selector$g = (s) => ({
|
|
|
13410
13195
|
const connectingSelector = (nodeId, handleId, type) => (state) => {
|
|
13411
13196
|
const { connectionClickStartHandle: clickHandle, connectionMode, connection } = state;
|
|
13412
13197
|
const { fromHandle, toHandle, isValid: isValid2 } = connection;
|
|
13413
|
-
const connectingTo =
|
|
13198
|
+
const connectingTo = toHandle?.nodeId === nodeId && toHandle?.id === handleId && toHandle?.type === type;
|
|
13414
13199
|
return {
|
|
13415
|
-
connectingFrom:
|
|
13200
|
+
connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
|
|
13416
13201
|
connectingTo,
|
|
13417
|
-
clickConnecting:
|
|
13418
|
-
isPossibleEndHandle: connectionMode === ConnectionMode.Strict ?
|
|
13202
|
+
clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.id === handleId && clickHandle?.type === type,
|
|
13203
|
+
isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
|
|
13419
13204
|
connectionInProcess: !!fromHandle,
|
|
13420
13205
|
clickConnectionInProcess: !!clickHandle,
|
|
13421
13206
|
valid: connectingTo && isValid2
|
|
13422
13207
|
};
|
|
13423
13208
|
};
|
|
13424
13209
|
function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = true, isConnectableStart = true, isConnectableEnd = true, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
|
|
13425
|
-
var _a, _b;
|
|
13426
13210
|
const handleId = id2 || null;
|
|
13427
13211
|
const isTarget = type === "target";
|
|
13428
13212
|
const store = useStoreApi();
|
|
@@ -13430,7 +13214,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13430
13214
|
const { connectOnClick, noPanClassName, rfId } = useStore(selector$g, shallow$1);
|
|
13431
13215
|
const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow$1);
|
|
13432
13216
|
if (!nodeId) {
|
|
13433
|
-
|
|
13217
|
+
store.getState().onError?.("010", errorMessages["error010"]());
|
|
13434
13218
|
}
|
|
13435
13219
|
const onConnectExtended = (params) => {
|
|
13436
13220
|
const { defaultEdgeOptions, onConnect: onConnectAction, hasDefaultEdges } = store.getState();
|
|
@@ -13442,8 +13226,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13442
13226
|
const { edges, setEdges } = store.getState();
|
|
13443
13227
|
setEdges(addEdge(edgeParams, edges));
|
|
13444
13228
|
}
|
|
13445
|
-
onConnectAction
|
|
13446
|
-
onConnect
|
|
13229
|
+
onConnectAction?.(edgeParams);
|
|
13230
|
+
onConnect?.(edgeParams);
|
|
13447
13231
|
};
|
|
13448
13232
|
const onPointerDown2 = (event) => {
|
|
13449
13233
|
if (!nodeId) {
|
|
@@ -13467,16 +13251,10 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13467
13251
|
panBy: currentStore.panBy,
|
|
13468
13252
|
cancelConnection: currentStore.cancelConnection,
|
|
13469
13253
|
onConnectStart: currentStore.onConnectStart,
|
|
13470
|
-
onConnectEnd: (...args) =>
|
|
13471
|
-
var _a2, _b2;
|
|
13472
|
-
return (_b2 = (_a2 = store.getState()).onConnectEnd) == null ? void 0 : _b2.call(_a2, ...args);
|
|
13473
|
-
},
|
|
13254
|
+
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
|
13474
13255
|
updateConnection: currentStore.updateConnection,
|
|
13475
13256
|
onConnect: onConnectExtended,
|
|
13476
|
-
isValidConnection: isValidConnection || ((...args) =>
|
|
13477
|
-
var _a2, _b2;
|
|
13478
|
-
return ((_b2 = (_a2 = store.getState()).isValidConnection) == null ? void 0 : _b2.call(_a2, ...args)) ?? true;
|
|
13479
|
-
}),
|
|
13257
|
+
isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? true),
|
|
13480
13258
|
getTransform: () => store.getState().transform,
|
|
13481
13259
|
getFromHandle: () => store.getState().connection.fromHandle,
|
|
13482
13260
|
autoPanSpeed: currentStore.autoPanSpeed,
|
|
@@ -13484,9 +13262,9 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13484
13262
|
});
|
|
13485
13263
|
}
|
|
13486
13264
|
if (isMouseTriggered) {
|
|
13487
|
-
onMouseDown
|
|
13265
|
+
onMouseDown?.(event);
|
|
13488
13266
|
} else {
|
|
13489
|
-
onTouchStart
|
|
13267
|
+
onTouchStart?.(event);
|
|
13490
13268
|
}
|
|
13491
13269
|
};
|
|
13492
13270
|
const onClick = (event) => {
|
|
@@ -13495,7 +13273,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13495
13273
|
return;
|
|
13496
13274
|
}
|
|
13497
13275
|
if (!connectionClickStartHandle) {
|
|
13498
|
-
onClickConnectStart
|
|
13276
|
+
onClickConnectStart?.(event.nativeEvent, { nodeId, handleId, handleType: type });
|
|
13499
13277
|
store.setState({ connectionClickStartHandle: { nodeId, type, id: handleId } });
|
|
13500
13278
|
return;
|
|
13501
13279
|
}
|
|
@@ -13523,7 +13301,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13523
13301
|
const connectionClone = structuredClone(connectionState);
|
|
13524
13302
|
delete connectionClone.inProgress;
|
|
13525
13303
|
connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
|
|
13526
|
-
onClickConnectEnd
|
|
13304
|
+
onClickConnectEnd?.(event, connectionClone);
|
|
13527
13305
|
store.setState({ connectionClickStartHandle: null });
|
|
13528
13306
|
};
|
|
13529
13307
|
return jsxRuntimeExports.jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
|
|
@@ -13552,16 +13330,16 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
13552
13330
|
}
|
|
13553
13331
|
const Handle = reactExports.memo(fixedForwardRef(HandleComponent));
|
|
13554
13332
|
function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
|
|
13555
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [data
|
|
13333
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [data?.label, jsxRuntimeExports.jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
13556
13334
|
}
|
|
13557
13335
|
function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom }) {
|
|
13558
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data
|
|
13336
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label, jsxRuntimeExports.jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
13559
13337
|
}
|
|
13560
13338
|
function GroupNode() {
|
|
13561
13339
|
return null;
|
|
13562
13340
|
}
|
|
13563
13341
|
function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
|
|
13564
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data
|
|
13342
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label] });
|
|
13565
13343
|
}
|
|
13566
13344
|
const arrowKeyDiffs = {
|
|
13567
13345
|
ArrowUp: { x: 0, y: -1 },
|
|
@@ -13576,16 +13354,15 @@ const builtinNodeTypes = {
|
|
|
13576
13354
|
group: GroupNode
|
|
13577
13355
|
};
|
|
13578
13356
|
function getNodeInlineStyleDimensions(node) {
|
|
13579
|
-
var _a, _b, _c, _d;
|
|
13580
13357
|
if (node.internals.handleBounds === void 0) {
|
|
13581
13358
|
return {
|
|
13582
|
-
width: node.width ?? node.initialWidth ??
|
|
13583
|
-
height: node.height ?? node.initialHeight ??
|
|
13359
|
+
width: node.width ?? node.initialWidth ?? node.style?.width,
|
|
13360
|
+
height: node.height ?? node.initialHeight ?? node.style?.height
|
|
13584
13361
|
};
|
|
13585
13362
|
}
|
|
13586
13363
|
return {
|
|
13587
|
-
width: node.width ??
|
|
13588
|
-
height: node.height ??
|
|
13364
|
+
width: node.width ?? node.style?.width,
|
|
13365
|
+
height: node.height ?? node.style?.height
|
|
13589
13366
|
};
|
|
13590
13367
|
}
|
|
13591
13368
|
const selector$f = (s) => {
|
|
@@ -13605,9 +13382,8 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
|
|
|
13605
13382
|
const moveSelectedNodes = useMoveSelectedNodes();
|
|
13606
13383
|
const nodeRef = reactExports.useRef(null);
|
|
13607
13384
|
reactExports.useEffect(() => {
|
|
13608
|
-
var _a;
|
|
13609
13385
|
if (!disableKeyboardA11y) {
|
|
13610
|
-
|
|
13386
|
+
nodeRef.current?.focus({
|
|
13611
13387
|
preventScroll: true
|
|
13612
13388
|
});
|
|
13613
13389
|
}
|
|
@@ -13686,7 +13462,7 @@ function useResizeObserver() {
|
|
|
13686
13462
|
});
|
|
13687
13463
|
reactExports.useEffect(() => {
|
|
13688
13464
|
return () => {
|
|
13689
|
-
resizeObserver
|
|
13465
|
+
resizeObserver?.disconnect();
|
|
13690
13466
|
};
|
|
13691
13467
|
}, [resizeObserver]);
|
|
13692
13468
|
return resizeObserver;
|
|
@@ -13702,16 +13478,16 @@ function useNodeObserver({ node, nodeType, hasDimensions, resizeObserver }) {
|
|
|
13702
13478
|
reactExports.useEffect(() => {
|
|
13703
13479
|
if (nodeRef.current && !node.hidden && (!isInitialized || observedNode.current !== nodeRef.current)) {
|
|
13704
13480
|
if (observedNode.current) {
|
|
13705
|
-
resizeObserver
|
|
13481
|
+
resizeObserver?.unobserve(observedNode.current);
|
|
13706
13482
|
}
|
|
13707
|
-
resizeObserver
|
|
13483
|
+
resizeObserver?.observe(nodeRef.current);
|
|
13708
13484
|
observedNode.current = nodeRef.current;
|
|
13709
13485
|
}
|
|
13710
13486
|
}, [isInitialized, node.hidden]);
|
|
13711
13487
|
reactExports.useEffect(() => {
|
|
13712
13488
|
return () => {
|
|
13713
13489
|
if (observedNode.current) {
|
|
13714
|
-
resizeObserver
|
|
13490
|
+
resizeObserver?.unobserve(observedNode.current);
|
|
13715
13491
|
observedNode.current = null;
|
|
13716
13492
|
}
|
|
13717
13493
|
};
|
|
@@ -13742,11 +13518,11 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
|
|
|
13742
13518
|
};
|
|
13743
13519
|
}, shallow$1);
|
|
13744
13520
|
let nodeType = node.type || "default";
|
|
13745
|
-
let NodeComponent =
|
|
13521
|
+
let NodeComponent = nodeTypes2?.[nodeType] || builtinNodeTypes[nodeType];
|
|
13746
13522
|
if (NodeComponent === void 0) {
|
|
13747
|
-
onError
|
|
13523
|
+
onError?.("003", errorMessages["error003"](nodeType));
|
|
13748
13524
|
nodeType = "default";
|
|
13749
|
-
NodeComponent =
|
|
13525
|
+
NodeComponent = nodeTypes2?.["default"] || builtinNodeTypes.default;
|
|
13750
13526
|
}
|
|
13751
13527
|
const isDraggable = !!(node.draggable || nodesDraggable && typeof node.draggable === "undefined");
|
|
13752
13528
|
const isSelectable = !!(node.selectable || elementsSelectable && typeof node.selectable === "undefined");
|
|
@@ -13818,8 +13594,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
|
|
|
13818
13594
|
}
|
|
13819
13595
|
};
|
|
13820
13596
|
const onFocus = () => {
|
|
13821
|
-
|
|
13822
|
-
if (disableKeyboardA11y || !((_a = nodeRef.current) == null ? void 0 : _a.matches(":focus-visible"))) {
|
|
13597
|
+
if (disableKeyboardA11y || !nodeRef.current?.matches(":focus-visible")) {
|
|
13823
13598
|
return;
|
|
13824
13599
|
}
|
|
13825
13600
|
const { transform: transform2, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
|
|
@@ -13948,10 +13723,9 @@ const MarkerSymbols = {
|
|
|
13948
13723
|
function useMarkerSymbol(type) {
|
|
13949
13724
|
const store = useStoreApi();
|
|
13950
13725
|
const symbol = reactExports.useMemo(() => {
|
|
13951
|
-
var _a, _b;
|
|
13952
13726
|
const symbolExists = Object.prototype.hasOwnProperty.call(MarkerSymbols, type);
|
|
13953
13727
|
if (!symbolExists) {
|
|
13954
|
-
|
|
13728
|
+
store.getState().onError?.("009", errorMessages["error009"](type));
|
|
13955
13729
|
return null;
|
|
13956
13730
|
}
|
|
13957
13731
|
return MarkerSymbols[type];
|
|
@@ -13972,8 +13746,8 @@ const MarkerDefinitions = ({ defaultColor, rfId }) => {
|
|
|
13972
13746
|
const markers2 = createMarkerIds(edges, {
|
|
13973
13747
|
id: rfId,
|
|
13974
13748
|
defaultColor,
|
|
13975
|
-
defaultMarkerStart: defaultEdgeOptions
|
|
13976
|
-
defaultMarkerEnd: defaultEdgeOptions
|
|
13749
|
+
defaultMarkerStart: defaultEdgeOptions?.markerStart,
|
|
13750
|
+
defaultMarkerEnd: defaultEdgeOptions?.markerEnd
|
|
13977
13751
|
});
|
|
13978
13752
|
return markers2;
|
|
13979
13753
|
}, [edges, defaultEdgeOptions, rfId, defaultColor]);
|
|
@@ -14075,9 +13849,9 @@ function createSmoothStepEdge(params) {
|
|
|
14075
13849
|
targetX,
|
|
14076
13850
|
targetY,
|
|
14077
13851
|
targetPosition,
|
|
14078
|
-
borderRadius: pathOptions
|
|
14079
|
-
offset: pathOptions
|
|
14080
|
-
stepPosition: pathOptions
|
|
13852
|
+
borderRadius: pathOptions?.borderRadius,
|
|
13853
|
+
offset: pathOptions?.offset,
|
|
13854
|
+
stepPosition: pathOptions?.stepPosition
|
|
14081
13855
|
});
|
|
14082
13856
|
const _id = params.isInternal ? void 0 : id2;
|
|
14083
13857
|
return jsxRuntimeExports.jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
|
|
@@ -14089,12 +13863,8 @@ SmoothStepEdge.displayName = "SmoothStepEdge";
|
|
|
14089
13863
|
SmoothStepEdgeInternal.displayName = "SmoothStepEdgeInternal";
|
|
14090
13864
|
function createStepEdge(params) {
|
|
14091
13865
|
return reactExports.memo(({ id: id2, ...props }) => {
|
|
14092
|
-
var _a;
|
|
14093
13866
|
const _id = params.isInternal ? void 0 : id2;
|
|
14094
|
-
return jsxRuntimeExports.jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: reactExports.useMemo(() => {
|
|
14095
|
-
var _a2;
|
|
14096
|
-
return { borderRadius: 0, offset: (_a2 = props.pathOptions) == null ? void 0 : _a2.offset };
|
|
14097
|
-
}, [(_a = props.pathOptions) == null ? void 0 : _a.offset]) });
|
|
13867
|
+
return jsxRuntimeExports.jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: reactExports.useMemo(() => ({ borderRadius: 0, offset: props.pathOptions?.offset }), [props.pathOptions?.offset]) });
|
|
14098
13868
|
});
|
|
14099
13869
|
}
|
|
14100
13870
|
const StepEdge = createStepEdge({ isInternal: false });
|
|
@@ -14121,7 +13891,7 @@ function createBezierEdge(params) {
|
|
|
14121
13891
|
targetX,
|
|
14122
13892
|
targetY,
|
|
14123
13893
|
targetPosition,
|
|
14124
|
-
curvature: pathOptions
|
|
13894
|
+
curvature: pathOptions?.curvature
|
|
14125
13895
|
});
|
|
14126
13896
|
const _id = params.isInternal ? void 0 : id2;
|
|
14127
13897
|
return jsxRuntimeExports.jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
|
|
@@ -14174,13 +13944,13 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
|
|
|
14174
13944
|
const isTarget = oppositeHandle.type === "target";
|
|
14175
13945
|
const _onReconnectEnd = (evt, connectionState) => {
|
|
14176
13946
|
setReconnecting(false);
|
|
14177
|
-
onReconnectEnd
|
|
13947
|
+
onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
|
|
14178
13948
|
};
|
|
14179
|
-
const onConnectEdge = (connection) => onReconnect
|
|
13949
|
+
const onConnectEdge = (connection) => onReconnect?.(edge, connection);
|
|
14180
13950
|
const _onConnectStart = (_event, params) => {
|
|
14181
13951
|
setReconnecting(true);
|
|
14182
|
-
onReconnectStart
|
|
14183
|
-
onConnectStart
|
|
13952
|
+
onReconnectStart?.(event, edge, oppositeHandle.type);
|
|
13953
|
+
onConnectStart?.(_event, params);
|
|
14184
13954
|
};
|
|
14185
13955
|
XYHandle.onPointerDown(event.nativeEvent, {
|
|
14186
13956
|
autoPanOnConnect,
|
|
@@ -14196,16 +13966,10 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
|
|
|
14196
13966
|
flowId,
|
|
14197
13967
|
cancelConnection,
|
|
14198
13968
|
panBy: panBy2,
|
|
14199
|
-
isValidConnection: (...args) =>
|
|
14200
|
-
var _a, _b;
|
|
14201
|
-
return ((_b = (_a = store.getState()).isValidConnection) == null ? void 0 : _b.call(_a, ...args)) ?? true;
|
|
14202
|
-
},
|
|
13969
|
+
isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? true,
|
|
14203
13970
|
onConnect: onConnectEdge,
|
|
14204
13971
|
onConnectStart: _onConnectStart,
|
|
14205
|
-
onConnectEnd: (...args) =>
|
|
14206
|
-
var _a, _b;
|
|
14207
|
-
return (_b = (_a = store.getState()).onConnectEnd) == null ? void 0 : _b.call(_a, ...args);
|
|
14208
|
-
},
|
|
13972
|
+
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
|
14209
13973
|
onReconnectEnd: _onReconnectEnd,
|
|
14210
13974
|
updateConnection,
|
|
14211
13975
|
getTransform: () => store.getState().transform,
|
|
@@ -14225,11 +13989,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14225
13989
|
const defaultEdgeOptions = useStore((s) => s.defaultEdgeOptions);
|
|
14226
13990
|
edge = defaultEdgeOptions ? { ...defaultEdgeOptions, ...edge } : edge;
|
|
14227
13991
|
let edgeType = edge.type || "default";
|
|
14228
|
-
let EdgeComponent =
|
|
13992
|
+
let EdgeComponent = edgeTypes2?.[edgeType] || builtinEdgeTypes[edgeType];
|
|
14229
13993
|
if (EdgeComponent === void 0) {
|
|
14230
|
-
onError
|
|
13994
|
+
onError?.("011", errorMessages["error011"](edgeType));
|
|
14231
13995
|
edgeType = "default";
|
|
14232
|
-
EdgeComponent =
|
|
13996
|
+
EdgeComponent = edgeTypes2?.["default"] || builtinEdgeTypes.default;
|
|
14233
13997
|
}
|
|
14234
13998
|
const isFocusable = !!(edge.focusable || edgesFocusable && typeof edge.focusable === "undefined");
|
|
14235
13999
|
const isReconnectable = typeof onReconnect !== "undefined" && (edge.reconnectable || edgesReconnectable && typeof edge.reconnectable === "undefined");
|
|
@@ -14275,13 +14039,12 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14275
14039
|
return null;
|
|
14276
14040
|
}
|
|
14277
14041
|
const onEdgeClick = (event) => {
|
|
14278
|
-
var _a;
|
|
14279
14042
|
const { addSelectedEdges, unselectNodesAndEdges, multiSelectionActive } = store.getState();
|
|
14280
14043
|
if (isSelectable) {
|
|
14281
14044
|
store.setState({ nodesSelectionActive: false });
|
|
14282
14045
|
if (edge.selected && multiSelectionActive) {
|
|
14283
14046
|
unselectNodesAndEdges({ nodes: [], edges: [edge] });
|
|
14284
|
-
|
|
14047
|
+
edgeRef.current?.blur();
|
|
14285
14048
|
} else {
|
|
14286
14049
|
addSelectedEdges([id2]);
|
|
14287
14050
|
}
|
|
@@ -14306,12 +14069,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
14306
14069
|
onMouseLeave(event, { ...edge });
|
|
14307
14070
|
} : void 0;
|
|
14308
14071
|
const onKeyDown = (event) => {
|
|
14309
|
-
var _a;
|
|
14310
14072
|
if (!disableKeyboardA11y && elementSelectionKeys.includes(event.key) && isSelectable) {
|
|
14311
14073
|
const { unselectNodesAndEdges, addSelectedEdges } = store.getState();
|
|
14312
14074
|
const unselect = event.key === "Escape";
|
|
14313
14075
|
if (unselect) {
|
|
14314
|
-
|
|
14076
|
+
edgeRef.current?.blur();
|
|
14315
14077
|
unselectNodesAndEdges({ edges: [edge] });
|
|
14316
14078
|
} else {
|
|
14317
14079
|
addSelectedEdges([id2]);
|
|
@@ -14364,16 +14126,13 @@ function useOnInitHandler(onInit) {
|
|
|
14364
14126
|
}
|
|
14365
14127
|
}, [onInit, rfInstance.viewportInitialized]);
|
|
14366
14128
|
}
|
|
14367
|
-
const selector$8 = (state) =>
|
|
14368
|
-
var _a;
|
|
14369
|
-
return (_a = state.panZoom) == null ? void 0 : _a.syncViewport;
|
|
14370
|
-
};
|
|
14129
|
+
const selector$8 = (state) => state.panZoom?.syncViewport;
|
|
14371
14130
|
function useViewportSync(viewport) {
|
|
14372
14131
|
const syncViewport = useStore(selector$8);
|
|
14373
14132
|
const store = useStoreApi();
|
|
14374
14133
|
reactExports.useEffect(() => {
|
|
14375
14134
|
if (viewport) {
|
|
14376
|
-
syncViewport
|
|
14135
|
+
syncViewport?.(viewport);
|
|
14377
14136
|
store.setState({ transform: [viewport.x, viewport.y, viewport.zoom] });
|
|
14378
14137
|
}
|
|
14379
14138
|
}, [viewport, syncViewport]);
|
|
@@ -14486,7 +14245,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
14486
14245
|
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
14487
14246
|
filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight))
|
|
14488
14247
|
});
|
|
14489
|
-
const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom,
|
|
14248
|
+
const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
|
|
14490
14249
|
transform2 = [x, y, zoom2];
|
|
14491
14250
|
}
|
|
14492
14251
|
return {
|
|
@@ -14569,7 +14328,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14569
14328
|
minZoom: minZoom2,
|
|
14570
14329
|
maxZoom: maxZoom2
|
|
14571
14330
|
}, fitViewOptions2);
|
|
14572
|
-
fitViewResolver
|
|
14331
|
+
fitViewResolver?.resolve(true);
|
|
14573
14332
|
set2({ fitViewResolver: null });
|
|
14574
14333
|
}
|
|
14575
14334
|
return {
|
|
@@ -14639,11 +14398,11 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14639
14398
|
} else {
|
|
14640
14399
|
set2({});
|
|
14641
14400
|
}
|
|
14642
|
-
if (
|
|
14401
|
+
if (changes?.length > 0) {
|
|
14643
14402
|
if (debug) {
|
|
14644
14403
|
console.log("React Flow: trigger node changes", changes);
|
|
14645
14404
|
}
|
|
14646
|
-
triggerNodeChanges
|
|
14405
|
+
triggerNodeChanges?.(changes);
|
|
14647
14406
|
}
|
|
14648
14407
|
},
|
|
14649
14408
|
updateNodePositions: (nodeDragItems, dragging = false) => {
|
|
@@ -14652,7 +14411,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14652
14411
|
const { nodeLookup, triggerNodeChanges, connection, updateConnection, onNodesChangeMiddlewareMap } = get2();
|
|
14653
14412
|
for (const [id2, dragItem] of nodeDragItems) {
|
|
14654
14413
|
const node = nodeLookup.get(id2);
|
|
14655
|
-
const expandParent = !!(
|
|
14414
|
+
const expandParent = !!(node?.expandParent && node?.parentId && dragItem?.position);
|
|
14656
14415
|
const change = {
|
|
14657
14416
|
id: id2,
|
|
14658
14417
|
type: "position",
|
|
@@ -14691,7 +14450,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14691
14450
|
},
|
|
14692
14451
|
triggerNodeChanges: (changes) => {
|
|
14693
14452
|
const { onNodesChange, setNodes, nodes: nodes2, hasDefaultNodes, debug } = get2();
|
|
14694
|
-
if (changes
|
|
14453
|
+
if (changes?.length) {
|
|
14695
14454
|
if (hasDefaultNodes) {
|
|
14696
14455
|
const updatedNodes = applyNodeChanges(changes, nodes2);
|
|
14697
14456
|
setNodes(updatedNodes);
|
|
@@ -14699,12 +14458,12 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14699
14458
|
if (debug) {
|
|
14700
14459
|
console.log("React Flow: trigger node changes", changes);
|
|
14701
14460
|
}
|
|
14702
|
-
onNodesChange
|
|
14461
|
+
onNodesChange?.(changes);
|
|
14703
14462
|
}
|
|
14704
14463
|
},
|
|
14705
14464
|
triggerEdgeChanges: (changes) => {
|
|
14706
14465
|
const { onEdgesChange, setEdges, edges: edges2, hasDefaultEdges, debug } = get2();
|
|
14707
|
-
if (changes
|
|
14466
|
+
if (changes?.length) {
|
|
14708
14467
|
if (hasDefaultEdges) {
|
|
14709
14468
|
const updatedEdges = applyEdgeChanges(changes, edges2);
|
|
14710
14469
|
setEdges(updatedEdges);
|
|
@@ -14712,7 +14471,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14712
14471
|
if (debug) {
|
|
14713
14472
|
console.log("React Flow: trigger edge changes", changes);
|
|
14714
14473
|
}
|
|
14715
|
-
onEdgesChange
|
|
14474
|
+
onEdgesChange?.(changes);
|
|
14716
14475
|
}
|
|
14717
14476
|
},
|
|
14718
14477
|
addSelectedNodes: (selectedNodeIds) => {
|
|
@@ -14762,17 +14521,16 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14762
14521
|
},
|
|
14763
14522
|
setMinZoom: (minZoom2) => {
|
|
14764
14523
|
const { panZoom, maxZoom: maxZoom2 } = get2();
|
|
14765
|
-
panZoom
|
|
14524
|
+
panZoom?.setScaleExtent([minZoom2, maxZoom2]);
|
|
14766
14525
|
set2({ minZoom: minZoom2 });
|
|
14767
14526
|
},
|
|
14768
14527
|
setMaxZoom: (maxZoom2) => {
|
|
14769
14528
|
const { panZoom, minZoom: minZoom2 } = get2();
|
|
14770
|
-
panZoom
|
|
14529
|
+
panZoom?.setScaleExtent([minZoom2, maxZoom2]);
|
|
14771
14530
|
set2({ maxZoom: maxZoom2 });
|
|
14772
14531
|
},
|
|
14773
14532
|
setTranslateExtent: (translateExtent) => {
|
|
14774
|
-
|
|
14775
|
-
(_a = get2().panZoom) == null ? void 0 : _a.setTranslateExtent(translateExtent);
|
|
14533
|
+
get2().panZoom?.setTranslateExtent(translateExtent);
|
|
14776
14534
|
set2({ translateExtent });
|
|
14777
14535
|
},
|
|
14778
14536
|
resetSelectedElements: () => {
|
|
@@ -14803,17 +14561,17 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
14803
14561
|
const { transform: transform2, width: width2, height: height2, panZoom, translateExtent } = get2();
|
|
14804
14562
|
return panBy({ delta, panZoom, transform: transform2, translateExtent, width: width2, height: height2 });
|
|
14805
14563
|
},
|
|
14806
|
-
setCenter: async (x, y,
|
|
14564
|
+
setCenter: async (x, y, options2) => {
|
|
14807
14565
|
const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get2();
|
|
14808
14566
|
if (!panZoom) {
|
|
14809
14567
|
return Promise.resolve(false);
|
|
14810
14568
|
}
|
|
14811
|
-
const nextZoom = typeof
|
|
14569
|
+
const nextZoom = typeof options2?.zoom !== "undefined" ? options2.zoom : maxZoom2;
|
|
14812
14570
|
await panZoom.setViewport({
|
|
14813
14571
|
x: width2 / 2 - x * nextZoom,
|
|
14814
14572
|
y: height2 / 2 - y * nextZoom,
|
|
14815
14573
|
zoom: nextZoom
|
|
14816
|
-
}, { duration:
|
|
14574
|
+
}, { duration: options2?.duration, ease: options2?.ease, interpolate: options2?.interpolate });
|
|
14817
14575
|
return Promise.resolve(true);
|
|
14818
14576
|
},
|
|
14819
14577
|
cancelConnection: () => {
|
|
@@ -14864,15 +14622,12 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
14864
14622
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
14865
14623
|
const wrapperOnScroll = reactExports.useCallback((e) => {
|
|
14866
14624
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
14867
|
-
onScroll
|
|
14625
|
+
onScroll?.(e);
|
|
14868
14626
|
}, [onScroll]);
|
|
14869
14627
|
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(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, 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 }), 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(SelectionListener, { onSelectionChange }), children2, jsxRuntimeExports.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntimeExports.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
14870
14628
|
}
|
|
14871
14629
|
var index = fixedForwardRef(ReactFlow);
|
|
14872
|
-
const selector$6 = (s) =>
|
|
14873
|
-
var _a;
|
|
14874
|
-
return (_a = s.domNode) == null ? void 0 : _a.querySelector(".react-flow__edgelabel-renderer");
|
|
14875
|
-
};
|
|
14630
|
+
const selector$6 = (s) => s.domNode?.querySelector(".react-flow__edgelabel-renderer");
|
|
14876
14631
|
function EdgeLabelRenderer({ children: children2 }) {
|
|
14877
14632
|
const edgeLabelRenderer = useStore(selector$6);
|
|
14878
14633
|
if (!edgeLabelRenderer) {
|
|
@@ -14977,15 +14732,15 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
|
|
|
14977
14732
|
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
14978
14733
|
const onZoomInHandler = () => {
|
|
14979
14734
|
zoomIn();
|
|
14980
|
-
onZoomIn
|
|
14735
|
+
onZoomIn?.();
|
|
14981
14736
|
};
|
|
14982
14737
|
const onZoomOutHandler = () => {
|
|
14983
14738
|
zoomOut();
|
|
14984
|
-
onZoomOut
|
|
14739
|
+
onZoomOut?.();
|
|
14985
14740
|
};
|
|
14986
14741
|
const onFitViewHandler = () => {
|
|
14987
14742
|
fitView(fitViewOptions);
|
|
14988
|
-
onFitView
|
|
14743
|
+
onFitView?.();
|
|
14989
14744
|
};
|
|
14990
14745
|
const onToggleInteractivity = () => {
|
|
14991
14746
|
store.setState({
|
|
@@ -14993,7 +14748,7 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
|
|
|
14993
14748
|
nodesConnectable: !isInteractive,
|
|
14994
14749
|
elementsSelectable: !isInteractive
|
|
14995
14750
|
});
|
|
14996
|
-
onInteractiveChange
|
|
14751
|
+
onInteractiveChange?.(!isInteractive);
|
|
14997
14752
|
};
|
|
14998
14753
|
const orientationClass = orientation === "horizontal" ? "horizontal" : "vertical";
|
|
14999
14754
|
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] });
|
|
@@ -15117,8 +14872,8 @@ function MiniMapComponent({
|
|
|
15117
14872
|
const store = useStoreApi();
|
|
15118
14873
|
const svg = reactExports.useRef(null);
|
|
15119
14874
|
const { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight, ariaLabelConfig } = useStore(selector$1, shallow$1);
|
|
15120
|
-
const elementWidth =
|
|
15121
|
-
const elementHeight =
|
|
14875
|
+
const elementWidth = style2?.width ?? defaultWidth;
|
|
14876
|
+
const elementHeight = style2?.height ?? defaultHeight;
|
|
15122
14877
|
const scaledWidth = boundingRect.width / elementWidth;
|
|
15123
14878
|
const scaledHeight = boundingRect.height / elementHeight;
|
|
15124
14879
|
const viewScale = Math.max(scaledWidth, scaledHeight);
|
|
@@ -15142,14 +14897,12 @@ function MiniMapComponent({
|
|
|
15142
14897
|
getViewScale: () => viewScaleRef.current
|
|
15143
14898
|
});
|
|
15144
14899
|
return () => {
|
|
15145
|
-
|
|
15146
|
-
(_a = minimapInstance.current) == null ? void 0 : _a.destroy();
|
|
14900
|
+
minimapInstance.current?.destroy();
|
|
15147
14901
|
};
|
|
15148
14902
|
}
|
|
15149
14903
|
}, [panZoom]);
|
|
15150
14904
|
reactExports.useEffect(() => {
|
|
15151
|
-
|
|
15152
|
-
(_a = minimapInstance.current) == null ? void 0 : _a.update({
|
|
14905
|
+
minimapInstance.current?.update({
|
|
15153
14906
|
translateExtent,
|
|
15154
14907
|
width: flowWidth,
|
|
15155
14908
|
height: flowHeight,
|
|
@@ -15160,8 +14913,7 @@ function MiniMapComponent({
|
|
|
15160
14913
|
});
|
|
15161
14914
|
}, [pannable, zoomable, inversePan, zoomStep, translateExtent, flowWidth, flowHeight]);
|
|
15162
14915
|
const onSvgClick = onClick ? (event) => {
|
|
15163
|
-
|
|
15164
|
-
const [x2, y2] = ((_a = minimapInstance.current) == null ? void 0 : _a.pointer(event)) || [0, 0];
|
|
14916
|
+
const [x2, y2] = minimapInstance.current?.pointer(event) || [0, 0];
|
|
15165
14917
|
onClick(event, { x: x2, y: y2 });
|
|
15166
14918
|
} : void 0;
|
|
15167
14919
|
const onSvgNodeClick = onNodeClick ? reactExports.useCallback((event, nodeId) => {
|
|
@@ -15303,8 +15055,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
15303
15055
|
shouldResize
|
|
15304
15056
|
});
|
|
15305
15057
|
return () => {
|
|
15306
|
-
|
|
15307
|
-
(_a = resizer.current) == null ? void 0 : _a.destroy();
|
|
15058
|
+
resizer.current?.destroy();
|
|
15308
15059
|
};
|
|
15309
15060
|
}, [
|
|
15310
15061
|
controlPosition,
|
|
@@ -15335,21 +15086,20 @@ const LAYOUT = {
|
|
|
15335
15086
|
PARALLEL_GROUP_PADDING: 25
|
|
15336
15087
|
};
|
|
15337
15088
|
function LoopNodeComponent({ data, selected: selected2 }) {
|
|
15338
|
-
var _a, _b, _c, _d;
|
|
15339
15089
|
const nodeData = data;
|
|
15340
15090
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
15341
15091
|
"div",
|
|
15342
15092
|
{
|
|
15343
15093
|
className: `relative ${nodeData.className || ""}`,
|
|
15344
15094
|
style: {
|
|
15345
|
-
borderWidth:
|
|
15095
|
+
borderWidth: nodeData.nodeStyle?.borderWidth ?? 1,
|
|
15346
15096
|
borderRadius: 8,
|
|
15347
15097
|
padding: 12,
|
|
15348
15098
|
width: 220,
|
|
15349
15099
|
borderStyle: "solid",
|
|
15350
|
-
backgroundColor:
|
|
15351
|
-
borderColor:
|
|
15352
|
-
opacity:
|
|
15100
|
+
backgroundColor: nodeData.nodeStyle?.backgroundColor,
|
|
15101
|
+
borderColor: nodeData.nodeStyle?.borderColor ?? "#9ca3af",
|
|
15102
|
+
opacity: nodeData.nodeStyle?.opacity,
|
|
15353
15103
|
boxShadow: selected2 ? "0 0 0 2px rgba(168, 85, 247, 0.5)" : void 0
|
|
15354
15104
|
},
|
|
15355
15105
|
children: [
|
|
@@ -15424,7 +15174,6 @@ function ParallelGroupComponent({ data }) {
|
|
|
15424
15174
|
);
|
|
15425
15175
|
}
|
|
15426
15176
|
function DiamondNodeComponent({ data, selected: selected2 }) {
|
|
15427
|
-
var _a, _b, _c;
|
|
15428
15177
|
const nodeData = data;
|
|
15429
15178
|
const size2 = 160;
|
|
15430
15179
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -15446,9 +15195,9 @@ function DiamondNodeComponent({ data, selected: selected2 }) {
|
|
|
15446
15195
|
borderWidth: 2,
|
|
15447
15196
|
borderStyle: "solid",
|
|
15448
15197
|
borderRadius: 4,
|
|
15449
|
-
backgroundColor:
|
|
15450
|
-
borderColor:
|
|
15451
|
-
opacity:
|
|
15198
|
+
backgroundColor: nodeData.nodeStyle?.backgroundColor,
|
|
15199
|
+
borderColor: nodeData.nodeStyle?.borderColor ?? "#ef4444",
|
|
15200
|
+
opacity: nodeData.nodeStyle?.opacity,
|
|
15452
15201
|
boxShadow: selected2 ? "0 0 0 2px rgba(239, 68, 68, 0.5)" : void 0
|
|
15453
15202
|
}
|
|
15454
15203
|
}
|
|
@@ -15639,7 +15388,6 @@ function getNodeIcon(nodeKind, label) {
|
|
|
15639
15388
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" });
|
|
15640
15389
|
}
|
|
15641
15390
|
function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
15642
|
-
var _a, _b, _c, _d, _e;
|
|
15643
15391
|
const nodes = workflow.nodes.map((node) => ({ ...node }));
|
|
15644
15392
|
const groupNodes = [];
|
|
15645
15393
|
const additionalEdges = [];
|
|
@@ -15647,7 +15395,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
15647
15395
|
const loopNodes = /* @__PURE__ */ new Map();
|
|
15648
15396
|
const conditionalGroups = /* @__PURE__ */ new Map();
|
|
15649
15397
|
for (const node of nodes) {
|
|
15650
|
-
if (
|
|
15398
|
+
if (node.metadata?.parallelGroupId) {
|
|
15651
15399
|
const group = parallelGroups.get(node.metadata.parallelGroupId) || {
|
|
15652
15400
|
nodes: [],
|
|
15653
15401
|
method: node.metadata.parallelMethod
|
|
@@ -15655,12 +15403,12 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
15655
15403
|
group.nodes.push(node);
|
|
15656
15404
|
parallelGroups.set(node.metadata.parallelGroupId, group);
|
|
15657
15405
|
}
|
|
15658
|
-
if (
|
|
15406
|
+
if (node.metadata?.loopId) {
|
|
15659
15407
|
const group = loopNodes.get(node.metadata.loopId) || [];
|
|
15660
15408
|
group.push(node);
|
|
15661
15409
|
loopNodes.set(node.metadata.loopId, group);
|
|
15662
15410
|
}
|
|
15663
|
-
if (
|
|
15411
|
+
if (node.metadata?.conditionalId) {
|
|
15664
15412
|
const groups = conditionalGroups.get(node.metadata.conditionalId) || {
|
|
15665
15413
|
thenBranch: [],
|
|
15666
15414
|
elseBranch: []
|
|
@@ -15717,8 +15465,8 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
15717
15465
|
const elseNodes = branches.elseBranch;
|
|
15718
15466
|
if (thenNodes.length > 0 && elseNodes.length > 0) {
|
|
15719
15467
|
const baseY = Math.min(
|
|
15720
|
-
|
|
15721
|
-
|
|
15468
|
+
thenNodes[0]?.position.y || 0,
|
|
15469
|
+
elseNodes[0]?.position.y || 0
|
|
15722
15470
|
);
|
|
15723
15471
|
thenNodes.forEach((node, idx) => {
|
|
15724
15472
|
node.position = {
|
|
@@ -15736,10 +15484,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
15736
15484
|
}
|
|
15737
15485
|
for (const [, loopNodeList] of loopNodes) {
|
|
15738
15486
|
if (loopNodeList.length > 0) {
|
|
15739
|
-
const isAwaitLoop = loopNodeList.some((n) =>
|
|
15740
|
-
var _a2;
|
|
15741
|
-
return (_a2 = n.metadata) == null ? void 0 : _a2.loopIsAwait;
|
|
15742
|
-
});
|
|
15487
|
+
const isAwaitLoop = loopNodeList.some((n) => n.metadata?.loopIsAwait);
|
|
15743
15488
|
for (const loopNode of loopNodeList) {
|
|
15744
15489
|
additionalEdges.push({
|
|
15745
15490
|
id: `self_loop_${loopNode.id}`,
|
|
@@ -15756,10 +15501,9 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT) {
|
|
|
15756
15501
|
return { nodes, groupNodes, additionalEdges };
|
|
15757
15502
|
}
|
|
15758
15503
|
function consolidateEdges(edges, nodes) {
|
|
15759
|
-
var _a;
|
|
15760
15504
|
const nodeToGroup = /* @__PURE__ */ new Map();
|
|
15761
15505
|
for (const node of nodes) {
|
|
15762
|
-
if (
|
|
15506
|
+
if (node.metadata?.parallelGroupId) {
|
|
15763
15507
|
nodeToGroup.set(node.id, node.metadata.parallelGroupId);
|
|
15764
15508
|
}
|
|
15765
15509
|
}
|
|
@@ -15801,7 +15545,6 @@ function consolidateEdges(edges, nodes) {
|
|
|
15801
15545
|
return consolidatedEdges;
|
|
15802
15546
|
}
|
|
15803
15547
|
function convertToReactFlowNodes(workflow) {
|
|
15804
|
-
var _a;
|
|
15805
15548
|
const { nodes, groupNodes } = calculateEnhancedLayout(workflow);
|
|
15806
15549
|
const nodeToParent = /* @__PURE__ */ new Map();
|
|
15807
15550
|
const groupPositions = /* @__PURE__ */ new Map();
|
|
@@ -15811,7 +15554,7 @@ function convertToReactFlowNodes(workflow) {
|
|
|
15811
15554
|
}
|
|
15812
15555
|
}
|
|
15813
15556
|
for (const node of nodes) {
|
|
15814
|
-
const parallelGroupId =
|
|
15557
|
+
const parallelGroupId = node.metadata?.parallelGroupId ? `group_${node.metadata.parallelGroupId}` : null;
|
|
15815
15558
|
if (parallelGroupId && groupPositions.has(parallelGroupId)) {
|
|
15816
15559
|
nodeToParent.set(node.id, parallelGroupId);
|
|
15817
15560
|
}
|
|
@@ -15836,8 +15579,8 @@ function convertToReactFlowNodes(workflow) {
|
|
|
15836
15579
|
nodes.forEach((node) => {
|
|
15837
15580
|
const styles = getNodeStyle(node.data.nodeKind);
|
|
15838
15581
|
const metadata = node.metadata;
|
|
15839
|
-
const isLoopNode = !!
|
|
15840
|
-
const isAwaitLoop = !!
|
|
15582
|
+
const isLoopNode = !!metadata?.loopId;
|
|
15583
|
+
const isAwaitLoop = !!metadata?.loopIsAwait;
|
|
15841
15584
|
const isConditionalNode = node.data.nodeKind === "conditional";
|
|
15842
15585
|
let nodeType = isConditionalNode ? "diamondNode" : isLoopNode ? "loopNode" : "default";
|
|
15843
15586
|
if (node.type === "workflowStart") {
|