likec4 1.27.3 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/src/main.js +562 -441
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +548 -545
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/likec4.10Nsb-Q7.mjs +2192 -0
- package/dist/shared/{likec4.sbYSTpRI.mjs → likec4.7Lz9HWDi.mjs} +1 -1
- package/dist/shared/{likec4.QmEWuoHf.d.mts → likec4.DwrogUe0.d.mts} +22 -22
- package/dist/vite-plugin/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +21 -21
- package/react/index.d.mts +470 -192
- package/react/index.mjs +27 -27
- package/dist/shared/likec4.CY1x3B5z.mjs +0 -2199
package/__app__/src/main.js
CHANGED
|
@@ -719,7 +719,7 @@ function useHovered() {
|
|
|
719
719
|
const [hovered, setHovered] = useState(-1);
|
|
720
720
|
return [hovered, { setHovered, resetHovered: () => setHovered(-1) }];
|
|
721
721
|
}
|
|
722
|
-
function clamp$
|
|
722
|
+
function clamp$5(value, min2, max2) {
|
|
723
723
|
return min2 === void 0 && max2 === void 0 ? value : min2 !== void 0 && max2 === void 0 ? Math.max(value, min2) : Math.min(min2 === void 0 && max2 !== void 0 ? value : Math.max(value, min2), max2);
|
|
724
724
|
}
|
|
725
725
|
function randomId(prefix2 = "mantine-") {
|
|
@@ -1060,8 +1060,8 @@ function useMergedRef(...refs) {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
function clampUseMovePosition(position) {
|
|
1062
1062
|
return {
|
|
1063
|
-
x: clamp$
|
|
1064
|
-
y: clamp$
|
|
1063
|
+
x: clamp$5(position.x, 0, 1),
|
|
1064
|
+
y: clamp$5(position.y, 0, 1)
|
|
1065
1065
|
};
|
|
1066
1066
|
}
|
|
1067
1067
|
function useMove(onChange, handlers, dir = "ltr") {
|
|
@@ -1075,10 +1075,10 @@ function useMove(onChange, handlers, dir = "ltr") {
|
|
|
1075
1075
|
node2.style.userSelect = "none";
|
|
1076
1076
|
const rect = node2.getBoundingClientRect();
|
|
1077
1077
|
if (rect.width && rect.height) {
|
|
1078
|
-
const _x = clamp$
|
|
1078
|
+
const _x = clamp$5((x2 - rect.left) / rect.width, 0, 1);
|
|
1079
1079
|
onChange({
|
|
1080
1080
|
x: dir === "ltr" ? _x : 1 - _x,
|
|
1081
|
-
y: clamp$
|
|
1081
|
+
y: clamp$5((y2 - rect.top) / rect.height, 0, 1)
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
@@ -3400,7 +3400,7 @@ const min$1 = Math.min, max$1 = Math.max, round = Math.round, floor = Math.floor
|
|
|
3400
3400
|
start: "end",
|
|
3401
3401
|
end: "start"
|
|
3402
3402
|
};
|
|
3403
|
-
function clamp$
|
|
3403
|
+
function clamp$4(start2, value, end) {
|
|
3404
3404
|
return max$1(start2, min$1(value, end));
|
|
3405
3405
|
}
|
|
3406
3406
|
function evaluate(value, param) {
|
|
@@ -3671,7 +3671,7 @@ const arrow$3 = (options) => ({
|
|
|
3671
3671
|
}, axis = getAlignmentAxis(placement), length = getAxisLength(axis), arrowDimensions = await platform2.getDimensions(element), isYAxis = axis === "y", minProp = isYAxis ? "top" : "left", maxProp = isYAxis ? "bottom" : "right", clientProp = isYAxis ? "clientHeight" : "clientWidth", endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length], startDiff = coords[axis] - rects.reference[axis], arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
3672
3672
|
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
3673
3673
|
(!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) && (clientSize = elements.floating[clientProp] || rects.floating[length]);
|
|
3674
|
-
const centerToReference = endDiff / 2 - startDiff / 2, largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1, minPadding = min$1(paddingObject[minProp], largestPossiblePadding), maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding), min$1$1 = minPadding, max2 = clientSize - arrowDimensions[length] - maxPadding, center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference, offset2 = clamp$
|
|
3674
|
+
const centerToReference = endDiff / 2 - startDiff / 2, largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1, minPadding = min$1(paddingObject[minProp], largestPossiblePadding), maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding), min$1$1 = minPadding, max2 = clientSize - arrowDimensions[length] - maxPadding, center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference, offset2 = clamp$4(min$1$1, center, max2), shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0, alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
|
|
3675
3675
|
return {
|
|
3676
3676
|
[axis]: coords[axis] + alignmentOffset,
|
|
3677
3677
|
data: {
|
|
@@ -3925,11 +3925,11 @@ const offset$3 = function(options) {
|
|
|
3925
3925
|
let mainAxisCoord = coords[mainAxis], crossAxisCoord = coords[crossAxis];
|
|
3926
3926
|
if (checkMainAxis) {
|
|
3927
3927
|
const minSide = mainAxis === "y" ? "top" : "left", maxSide = mainAxis === "y" ? "bottom" : "right", min2 = mainAxisCoord + overflow[minSide], max2 = mainAxisCoord - overflow[maxSide];
|
|
3928
|
-
mainAxisCoord = clamp$
|
|
3928
|
+
mainAxisCoord = clamp$4(min2, mainAxisCoord, max2);
|
|
3929
3929
|
}
|
|
3930
3930
|
if (checkCrossAxis) {
|
|
3931
3931
|
const minSide = crossAxis === "y" ? "top" : "left", maxSide = crossAxis === "y" ? "bottom" : "right", min2 = crossAxisCoord + overflow[minSide], max2 = crossAxisCoord - overflow[maxSide];
|
|
3932
|
-
crossAxisCoord = clamp$
|
|
3932
|
+
crossAxisCoord = clamp$4(min2, crossAxisCoord, max2);
|
|
3933
3933
|
}
|
|
3934
3934
|
const limitedCoords = limiter.fn({
|
|
3935
3935
|
...state,
|
|
@@ -5488,11 +5488,11 @@ function linearScale(input2, output) {
|
|
|
5488
5488
|
return output[0] + ratio * (value - input2[0]);
|
|
5489
5489
|
};
|
|
5490
5490
|
}
|
|
5491
|
-
function clamp$
|
|
5491
|
+
function clamp$3(value, [min2, max2]) {
|
|
5492
5492
|
return Math.min(max2, Math.max(min2, value));
|
|
5493
5493
|
}
|
|
5494
5494
|
function getThumbOffsetFromScroll(scrollPos, sizes2, dir = "ltr") {
|
|
5495
|
-
const thumbSizePx = getThumbSize(sizes2), scrollbarPadding = sizes2.scrollbar.paddingStart + sizes2.scrollbar.paddingEnd, scrollbar = sizes2.scrollbar.size - scrollbarPadding, maxScrollPos = sizes2.content - sizes2.viewport, maxThumbPos = scrollbar - thumbSizePx, scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0], scrollWithoutMomentum = clamp$
|
|
5495
|
+
const thumbSizePx = getThumbSize(sizes2), scrollbarPadding = sizes2.scrollbar.paddingStart + sizes2.scrollbar.paddingEnd, scrollbar = sizes2.scrollbar.size - scrollbarPadding, maxScrollPos = sizes2.content - sizes2.viewport, maxThumbPos = scrollbar - thumbSizePx, scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0], scrollWithoutMomentum = clamp$3(scrollPos, scrollClampRange);
|
|
5496
5496
|
return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
|
|
5497
5497
|
}
|
|
5498
5498
|
function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes2, dir = "ltr") {
|
|
@@ -12157,9 +12157,9 @@ const defaultProps$a = {
|
|
|
12157
12157
|
varsResolver: varsResolver$6,
|
|
12158
12158
|
unstyled
|
|
12159
12159
|
}), { dir } = useDirection(), [hovered, setHovered] = useState(!1), [_value, setValue] = useUncontrolled({
|
|
12160
|
-
value: typeof value == "number" ? clamp$
|
|
12161
|
-
defaultValue: typeof defaultValue == "number" ? clamp$
|
|
12162
|
-
finalValue: clamp$
|
|
12160
|
+
value: typeof value == "number" ? clamp$5(value, min2, max2) : value,
|
|
12161
|
+
defaultValue: typeof defaultValue == "number" ? clamp$5(defaultValue, min2, max2) : defaultValue,
|
|
12162
|
+
finalValue: clamp$5(0, min2, max2),
|
|
12163
12163
|
onChange
|
|
12164
12164
|
}), valueRef = useRef(_value), root2 = useRef(null), thumb = useRef(null), position = getPosition({ value: _value, min: min2, max: max2 }), scaledValue = scale2(_value), _label = typeof label2 == "function" ? label2(scaledValue) : label2, precision = _precision ?? getPrecision(step), handleChange = useCallback(
|
|
12165
12165
|
({ x: x2 }) => {
|
|
@@ -17008,8 +17008,8 @@ function removeItem(arr, item) {
|
|
|
17008
17008
|
const index2 = arr.indexOf(item);
|
|
17009
17009
|
index2 > -1 && arr.splice(index2, 1);
|
|
17010
17010
|
}
|
|
17011
|
-
|
|
17012
|
-
|
|
17011
|
+
let invariant = () => {
|
|
17012
|
+
};
|
|
17013
17013
|
const MotionGlobalConfig = {
|
|
17014
17014
|
useManualTiming: !1
|
|
17015
17015
|
};
|
|
@@ -17018,7 +17018,7 @@ function memo(callback) {
|
|
|
17018
17018
|
let result;
|
|
17019
17019
|
return () => (result === void 0 && (result = callback()), result);
|
|
17020
17020
|
}
|
|
17021
|
-
const progress = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
|
|
17021
|
+
const noop$3 = /* @__NO_SIDE_EFFECTS__ */ (any) => any, progress = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
|
|
17022
17022
|
const toFromDifference = to - from;
|
|
17023
17023
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
17024
17024
|
};
|
|
@@ -17052,12 +17052,12 @@ function velocityPerSecond(velocity, frameDuration) {
|
|
|
17052
17052
|
return frameDuration ? velocity * (1e3 / frameDuration) : 0;
|
|
17053
17053
|
}
|
|
17054
17054
|
const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
|
|
17055
|
-
class
|
|
17055
|
+
class GroupAnimation {
|
|
17056
17056
|
constructor(animations2) {
|
|
17057
17057
|
this.stop = () => this.runAll("stop"), this.animations = animations2.filter(Boolean);
|
|
17058
17058
|
}
|
|
17059
17059
|
get finished() {
|
|
17060
|
-
return Promise.all(this.animations.map((animation) =>
|
|
17060
|
+
return Promise.all(this.animations.map((animation) => animation.finished));
|
|
17061
17061
|
}
|
|
17062
17062
|
/**
|
|
17063
17063
|
* TODO: Filter out cancelled or stopped animations before returning
|
|
@@ -17122,46 +17122,16 @@ class BaseGroupPlaybackControls {
|
|
|
17122
17122
|
this.runAll("complete");
|
|
17123
17123
|
}
|
|
17124
17124
|
}
|
|
17125
|
-
class
|
|
17126
|
-
then(onResolve,
|
|
17127
|
-
return
|
|
17125
|
+
class GroupAnimationWithThen extends GroupAnimation {
|
|
17126
|
+
then(onResolve, _onReject) {
|
|
17127
|
+
return this.finished.finally(onResolve).then(() => {
|
|
17128
|
+
});
|
|
17128
17129
|
}
|
|
17129
17130
|
}
|
|
17130
|
-
|
|
17131
|
-
return transition ? transition[key2] || transition.default || transition : void 0;
|
|
17132
|
-
}
|
|
17133
|
-
const maxGeneratorDuration = 2e4;
|
|
17134
|
-
function calcGeneratorDuration(generator) {
|
|
17135
|
-
let duration = 0;
|
|
17136
|
-
const timeStep = 50;
|
|
17137
|
-
let state = generator.next(duration);
|
|
17138
|
-
for (; !state.done && duration < maxGeneratorDuration; )
|
|
17139
|
-
duration += timeStep, state = generator.next(duration);
|
|
17140
|
-
return duration >= maxGeneratorDuration ? 1 / 0 : duration;
|
|
17141
|
-
}
|
|
17142
|
-
function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
17143
|
-
const generator = createGenerator({ ...options, keyframes: [0, scale2] }), duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
17144
|
-
return {
|
|
17145
|
-
type: "keyframes",
|
|
17146
|
-
ease: (progress2) => generator.next(duration * progress2).value / scale2,
|
|
17147
|
-
duration: /* @__PURE__ */ millisecondsToSeconds(duration)
|
|
17148
|
-
};
|
|
17149
|
-
}
|
|
17150
|
-
function isGenerator(type) {
|
|
17151
|
-
return typeof type == "function";
|
|
17152
|
-
}
|
|
17153
|
-
function attachTimeline(animation, timeline) {
|
|
17154
|
-
animation.timeline = timeline, animation.onfinish = null;
|
|
17155
|
-
}
|
|
17156
|
-
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] == "number", supportsFlags = {
|
|
17157
|
-
linearEasing: void 0
|
|
17158
|
-
};
|
|
17131
|
+
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] == "number", supportsFlags = {};
|
|
17159
17132
|
function memoSupports(callback, supportsFlag) {
|
|
17160
17133
|
const memoized = /* @__PURE__ */ memo(callback);
|
|
17161
|
-
return () =>
|
|
17162
|
-
var _a;
|
|
17163
|
-
return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
|
|
17164
|
-
};
|
|
17134
|
+
return () => supportsFlags[supportsFlag] ?? memoized();
|
|
17165
17135
|
}
|
|
17166
17136
|
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
17167
17137
|
try {
|
|
@@ -17174,13 +17144,9 @@ const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
|
17174
17144
|
let points = "";
|
|
17175
17145
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
17176
17146
|
for (let i2 = 0; i2 < numPoints; i2++)
|
|
17177
|
-
points += easing(
|
|
17147
|
+
points += easing(i2 / (numPoints - 1)) + ", ";
|
|
17178
17148
|
return `linear(${points.substring(0, points.length - 2)})`;
|
|
17179
|
-
}
|
|
17180
|
-
function isWaapiSupportedEasing(easing) {
|
|
17181
|
-
return !!(typeof easing == "function" && supportsLinearEasing() || !easing || typeof easing == "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
17182
|
-
}
|
|
17183
|
-
const cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`, supportedWaapiEasing = {
|
|
17149
|
+
}, cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`, supportedWaapiEasing = {
|
|
17184
17150
|
linear: "linear",
|
|
17185
17151
|
ease: "ease",
|
|
17186
17152
|
easeIn: "ease-in",
|
|
@@ -17195,6 +17161,51 @@ function mapEasingToNativeEasing(easing, duration) {
|
|
|
17195
17161
|
if (easing)
|
|
17196
17162
|
return typeof easing == "function" && supportsLinearEasing() ? generateLinearEasing(easing, duration) : isBezierDefinition(easing) ? cubicBezierAsString(easing) : Array.isArray(easing) ? easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[easing];
|
|
17197
17163
|
}
|
|
17164
|
+
function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}, pseudoElement = void 0) {
|
|
17165
|
+
const keyframeOptions = {
|
|
17166
|
+
[valueName]: keyframes2
|
|
17167
|
+
};
|
|
17168
|
+
times && (keyframeOptions.offset = times);
|
|
17169
|
+
const easing = mapEasingToNativeEasing(ease2, duration);
|
|
17170
|
+
return Array.isArray(easing) && (keyframeOptions.easing = easing), element.animate(keyframeOptions, {
|
|
17171
|
+
delay: delay2,
|
|
17172
|
+
duration,
|
|
17173
|
+
easing: Array.isArray(easing) ? "linear" : easing,
|
|
17174
|
+
fill: "both",
|
|
17175
|
+
iterations: repeat + 1,
|
|
17176
|
+
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
17177
|
+
pseudoElement
|
|
17178
|
+
});
|
|
17179
|
+
}
|
|
17180
|
+
function isGenerator(type) {
|
|
17181
|
+
return typeof type == "function" && "applyToOptions" in type;
|
|
17182
|
+
}
|
|
17183
|
+
function getValueTransition$1(transition, key2) {
|
|
17184
|
+
return transition?.[key2] ?? transition?.default ?? transition;
|
|
17185
|
+
}
|
|
17186
|
+
const maxGeneratorDuration = 2e4;
|
|
17187
|
+
function calcGeneratorDuration(generator) {
|
|
17188
|
+
let duration = 0;
|
|
17189
|
+
const timeStep = 50;
|
|
17190
|
+
let state = generator.next(duration);
|
|
17191
|
+
for (; !state.done && duration < maxGeneratorDuration; )
|
|
17192
|
+
duration += timeStep, state = generator.next(duration);
|
|
17193
|
+
return duration >= maxGeneratorDuration ? 1 / 0 : duration;
|
|
17194
|
+
}
|
|
17195
|
+
function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
17196
|
+
const generator = createGenerator({ ...options, keyframes: [0, scale2] }), duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
17197
|
+
return {
|
|
17198
|
+
type: "keyframes",
|
|
17199
|
+
ease: (progress2) => generator.next(duration * progress2).value / scale2,
|
|
17200
|
+
duration: /* @__PURE__ */ millisecondsToSeconds(duration)
|
|
17201
|
+
};
|
|
17202
|
+
}
|
|
17203
|
+
function isWaapiSupportedEasing(easing) {
|
|
17204
|
+
return !!(typeof easing == "function" && supportsLinearEasing() || !easing || typeof easing == "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
17205
|
+
}
|
|
17206
|
+
function attachTimeline(animation, timeline) {
|
|
17207
|
+
animation.timeline = timeline, animation.onfinish = null;
|
|
17208
|
+
}
|
|
17198
17209
|
const stepsOrder = [
|
|
17199
17210
|
"read",
|
|
17200
17211
|
// Read
|
|
@@ -17293,12 +17304,11 @@ function setDragLock(axis) {
|
|
|
17293
17304
|
});
|
|
17294
17305
|
}
|
|
17295
17306
|
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
17296
|
-
var _a;
|
|
17297
17307
|
if (elementOrSelector instanceof EventTarget)
|
|
17298
17308
|
return [elementOrSelector];
|
|
17299
17309
|
if (typeof elementOrSelector == "string") {
|
|
17300
17310
|
let root2 = document;
|
|
17301
|
-
const elements =
|
|
17311
|
+
const elements = selectorCache?.[elementOrSelector] ?? root2.querySelectorAll(elementOrSelector);
|
|
17302
17312
|
return elements ? Array.from(elements) : [];
|
|
17303
17313
|
}
|
|
17304
17314
|
return Array.from(elementOrSelector);
|
|
@@ -17383,7 +17393,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
17383
17393
|
window.addEventListener("pointerup", onPointerUp, eventOptions), window.addEventListener("pointercancel", onPointerCancel, eventOptions);
|
|
17384
17394
|
};
|
|
17385
17395
|
return targets.forEach((target) => {
|
|
17386
|
-
(options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), target instanceof HTMLElement && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && target.
|
|
17396
|
+
(options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), target instanceof HTMLElement && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex") && (target.tabIndex = 0));
|
|
17387
17397
|
}), cancelEvents;
|
|
17388
17398
|
}
|
|
17389
17399
|
const MAX_VELOCITY_DELTA = 30, isFloat = (value) => !isNaN(parseFloat(value));
|
|
@@ -17395,7 +17405,7 @@ class MotionValue {
|
|
|
17395
17405
|
* - `transformer`: A function to transform incoming values with.
|
|
17396
17406
|
*/
|
|
17397
17407
|
constructor(init2, options = {}) {
|
|
17398
|
-
this.version = "12.6.
|
|
17408
|
+
this.version = "12.6.3", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v, render = !0) => {
|
|
17399
17409
|
const currentTime = time.now();
|
|
17400
17410
|
this.updatedAt !== currentTime && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(v), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), render && this.events.renderRequest && this.events.renderRequest.notify(this.current);
|
|
17401
17411
|
}, this.hasAnimated = !1, this.setCurrent(init2), this.owner = options.owner;
|
|
@@ -17789,7 +17799,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
|
|
|
17789
17799
|
}
|
|
17790
17800
|
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), optimizedAppearDataId = "framerAppearId", optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId), SwitchLayoutGroupContext = createContext({});
|
|
17791
17801
|
function useVisualElement(Component2, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
17792
|
-
var _a, _b;
|
|
17793
17802
|
const { visualElement: parent } = useContext(MotionContext), lazyContext = useContext(LazyContext), presenceContext = useContext(PresenceContext), reducedMotionConfig = useContext(MotionConfigContext).reducedMotion, visualElementRef = useRef(null);
|
|
17794
17803
|
createVisualElement = createVisualElement || lazyContext.renderer, !visualElementRef.current && createVisualElement && (visualElementRef.current = createVisualElement(Component2, {
|
|
17795
17804
|
visualState,
|
|
@@ -17805,13 +17814,12 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
|
|
|
17805
17814
|
useInsertionEffect$1(() => {
|
|
17806
17815
|
visualElement && isMounted.current && visualElement.update(props, presenceContext);
|
|
17807
17816
|
});
|
|
17808
|
-
const optimisedAppearId = props[optimizedAppearDataAttribute], wantsHandoff = useRef(!!optimisedAppearId && !
|
|
17817
|
+
const optimisedAppearId = props[optimizedAppearDataAttribute], wantsHandoff = useRef(!!optimisedAppearId && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
|
|
17809
17818
|
return useIsomorphicLayoutEffect$2(() => {
|
|
17810
17819
|
visualElement && (isMounted.current = !0, window.MotionIsMounted = !0, visualElement.updateFeatures(), microtask.render(visualElement.render), wantsHandoff.current && visualElement.animationState && visualElement.animationState.animateChanges());
|
|
17811
17820
|
}), useEffect(() => {
|
|
17812
17821
|
visualElement && (!wantsHandoff.current && visualElement.animationState && visualElement.animationState.animateChanges(), wantsHandoff.current && (queueMicrotask(() => {
|
|
17813
|
-
|
|
17814
|
-
(_a2 = window.MotionHandoffMarkAsComplete) === null || _a2 === void 0 || _a2.call(window, optimisedAppearId);
|
|
17822
|
+
window.MotionHandoffMarkAsComplete?.(optimisedAppearId);
|
|
17815
17823
|
}), wantsHandoff.current = !1));
|
|
17816
17824
|
}), visualElement;
|
|
17817
17825
|
}
|
|
@@ -17840,7 +17848,6 @@ function getClosestProjectingNode(visualElement) {
|
|
|
17840
17848
|
return visualElement.options.allowProjection !== !1 ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
|
|
17841
17849
|
}
|
|
17842
17850
|
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component: Component2 }) {
|
|
17843
|
-
var _a, _b;
|
|
17844
17851
|
function MotionComponent(props, externalRef) {
|
|
17845
17852
|
let MeasureLayout2;
|
|
17846
17853
|
const configAndProps = {
|
|
@@ -17855,7 +17862,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
|
|
|
17855
17862
|
}
|
|
17856
17863
|
return jsxs(MotionContext.Provider, { value: context2, children: [MeasureLayout2 && context2.visualElement ? jsx(MeasureLayout2, { visualElement: context2.visualElement, ...configAndProps }) : null, useRender(Component2, props, useMotionRef(visualState, context2.visualElement, externalRef), visualState, isStatic, context2.visualElement)] });
|
|
17857
17864
|
}
|
|
17858
|
-
MotionComponent.displayName = `motion.${typeof Component2 == "string" ? Component2 : `create(${
|
|
17865
|
+
MotionComponent.displayName = `motion.${typeof Component2 == "string" ? Component2 : `create(${Component2.displayName ?? Component2.name ?? ""})`}`;
|
|
17859
17866
|
const ForwardRefMotionComponent = forwardRef(MotionComponent);
|
|
17860
17867
|
return ForwardRefMotionComponent[motionComponentSymbol] = Component2, ForwardRefMotionComponent;
|
|
17861
17868
|
}
|
|
@@ -17903,13 +17910,13 @@ const transformPropOrder = [
|
|
|
17903
17910
|
function isForcedMotionValue(key2, { layout: layout2, layoutId }) {
|
|
17904
17911
|
return transformProps.has(key2) || key2.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key2] || key2 === "opacity");
|
|
17905
17912
|
}
|
|
17906
|
-
const isMotionValue = (value) => !!(value && value.getVelocity), getValueAsType = (value, type) => type && typeof value == "number" ? type.transform(value) : value, clamp$
|
|
17913
|
+
const isMotionValue = (value) => !!(value && value.getVelocity), getValueAsType = (value, type) => type && typeof value == "number" ? type.transform(value) : value, clamp$2 = (min2, max2, v) => v > max2 ? max2 : v < min2 ? min2 : v, number = {
|
|
17907
17914
|
test: (v) => typeof v == "number",
|
|
17908
17915
|
parse: parseFloat,
|
|
17909
17916
|
transform: (v) => v
|
|
17910
17917
|
}, alpha = {
|
|
17911
17918
|
...number,
|
|
17912
|
-
transform: (v) => clamp$
|
|
17919
|
+
transform: (v) => clamp$2(0, 1, v)
|
|
17913
17920
|
}, scale = {
|
|
17914
17921
|
...number,
|
|
17915
17922
|
default: 1
|
|
@@ -18244,10 +18251,9 @@ function makeLatestValues(props, context2, presenceContext, scrapeMotionValues)
|
|
|
18244
18251
|
return values2;
|
|
18245
18252
|
}
|
|
18246
18253
|
function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
18247
|
-
var _a;
|
|
18248
18254
|
const { style: style2 } = props, newValues = {};
|
|
18249
18255
|
for (const key2 in style2)
|
|
18250
|
-
(isMotionValue(style2[key2]) || prevProps.style && isMotionValue(prevProps.style[key2]) || isForcedMotionValue(key2, props) ||
|
|
18256
|
+
(isMotionValue(style2[key2]) || prevProps.style && isMotionValue(prevProps.style[key2]) || isForcedMotionValue(key2, props) || visualElement?.getValue(key2)?.liveStyle !== void 0) && (newValues[key2] = style2[key2]);
|
|
18251
18257
|
return newValues;
|
|
18252
18258
|
}
|
|
18253
18259
|
const htmlMotionConfig = {
|
|
@@ -18424,7 +18430,7 @@ const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){
|
|
|
18424
18430
|
[cName]: parseFloat(c2),
|
|
18425
18431
|
alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
|
|
18426
18432
|
};
|
|
18427
|
-
}, clampRgbUnit = (v) => clamp$
|
|
18433
|
+
}, clampRgbUnit = (v) => clamp$2(0, 255, v), rgbUnit = {
|
|
18428
18434
|
...number,
|
|
18429
18435
|
transform: (v) => Math.round(clampRgbUnit(v))
|
|
18430
18436
|
}, rgba$1 = {
|
|
@@ -18455,8 +18461,7 @@ const hex$1 = {
|
|
|
18455
18461
|
transform: (v) => typeof v == "string" ? v : v.hasOwnProperty("red") ? rgba$1.transform(v) : hsla$1.transform(v)
|
|
18456
18462
|
}, colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
18457
18463
|
function test(v) {
|
|
18458
|
-
|
|
18459
|
-
return isNaN(v) && typeof v == "string" && (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) + (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
|
|
18464
|
+
return isNaN(v) && typeof v == "string" && (v.match(floatRegex)?.length || 0) + (v.match(colorRegex)?.length || 0) > 0;
|
|
18460
18465
|
}
|
|
18461
18466
|
const NUMBER_TOKEN = "number", COLOR_TOKEN = "color", VAR_TOKEN = "var", VAR_FUNCTION_TOKEN = "var(", SPLIT_TOKEN = "${}", complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
18462
18467
|
function analyseComplexValue(value) {
|
|
@@ -18638,8 +18643,7 @@ function measureAllKeyframes() {
|
|
|
18638
18643
|
element.render();
|
|
18639
18644
|
const restore = transformsToRestore.get(element);
|
|
18640
18645
|
restore && restore.forEach(([key2, value]) => {
|
|
18641
|
-
|
|
18642
|
-
(_a = element.getValue(key2)) === null || _a === void 0 || _a.set(value);
|
|
18646
|
+
element.getValue(key2)?.set(value);
|
|
18643
18647
|
});
|
|
18644
18648
|
}), resolversToMeasure.forEach((resolver) => resolver.measureEndState()), resolversToMeasure.forEach((resolver) => {
|
|
18645
18649
|
resolver.suspendedScrollY !== void 0 && window.scrollTo(0, resolver.suspendedScrollY);
|
|
@@ -18765,14 +18769,13 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
18765
18769
|
measureKeyframe !== void 0 && element.getValue(name, measureKeyframe).jump(measureKeyframe, !1);
|
|
18766
18770
|
}
|
|
18767
18771
|
measureEndState() {
|
|
18768
|
-
var _a;
|
|
18769
18772
|
const { element, name, unresolvedKeyframes } = this;
|
|
18770
18773
|
if (!element || !element.current)
|
|
18771
18774
|
return;
|
|
18772
18775
|
const value = element.getValue(name);
|
|
18773
18776
|
value && value.jump(this.measuredOrigin, !1);
|
|
18774
18777
|
const finalKeyframeIndex = unresolvedKeyframes.length - 1, finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
|
|
18775
|
-
unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)), finalKeyframe !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = finalKeyframe),
|
|
18778
|
+
unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)), finalKeyframe !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = finalKeyframe), this.removedTransforms?.length && this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
|
|
18776
18779
|
element.getValue(unsetTransformName).set(unsetTransformValue);
|
|
18777
18780
|
}), this.resolveNoneKeyframes();
|
|
18778
18781
|
}
|
|
@@ -18946,10 +18949,9 @@ function mixObject(a2, b2) {
|
|
|
18946
18949
|
};
|
|
18947
18950
|
}
|
|
18948
18951
|
function matchOrder(origin, target) {
|
|
18949
|
-
var _a;
|
|
18950
18952
|
const orderedOrigin = [], pointers = { color: 0, var: 0, number: 0 };
|
|
18951
18953
|
for (let i2 = 0; i2 < target.values.length; i2++) {
|
|
18952
|
-
const type = target.types[i2], originIndex = origin.indexes[type][pointers[type]], originValue =
|
|
18954
|
+
const type = target.types[i2], originIndex = origin.indexes[type][pointers[type]], originValue = origin.values[originIndex] ?? 0;
|
|
18953
18955
|
orderedOrigin[i2] = originValue, pointers[type]++;
|
|
18954
18956
|
}
|
|
18955
18957
|
return orderedOrigin;
|
|
@@ -18997,7 +18999,7 @@ const springDefaults = {
|
|
|
18997
18999
|
}, safeMin = 1e-3;
|
|
18998
19000
|
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
|
|
18999
19001
|
let envelope, derivative, dampingRatio = 1 - bounce;
|
|
19000
|
-
dampingRatio = clamp$
|
|
19002
|
+
dampingRatio = clamp$2(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio), duration = clamp$2(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration)), dampingRatio < 1 ? (envelope = (undampedFreq2) => {
|
|
19001
19003
|
const exponentialDecay = undampedFreq2 * dampingRatio, delta = exponentialDecay * duration, a2 = exponentialDecay - velocity, b2 = calcAngularFreq(undampedFreq2, dampingRatio), c2 = Math.exp(-delta);
|
|
19002
19004
|
return safeMin - a2 / b2 * c2;
|
|
19003
19005
|
}, derivative = (undampedFreq2) => {
|
|
@@ -19051,7 +19053,7 @@ function getSpringOptions(options) {
|
|
|
19051
19053
|
};
|
|
19052
19054
|
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys))
|
|
19053
19055
|
if (options.visualDuration) {
|
|
19054
|
-
const visualDuration = options.visualDuration, root2 = 2 * Math.PI / (visualDuration * 1.2), stiffness = root2 * root2, damping = 2 * clamp$
|
|
19056
|
+
const visualDuration = options.visualDuration, root2 = 2 * Math.PI / (visualDuration * 1.2), stiffness = root2 * root2, damping = 2 * clamp$2(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
|
|
19055
19057
|
springOptions = {
|
|
19056
19058
|
...springOptions,
|
|
19057
19059
|
mass: springDefaults.mass,
|
|
@@ -19113,10 +19115,16 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
19113
19115
|
toString: () => {
|
|
19114
19116
|
const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration), easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
|
|
19115
19117
|
return calculatedDuration + "ms " + easing;
|
|
19118
|
+
},
|
|
19119
|
+
toTransition: () => {
|
|
19116
19120
|
}
|
|
19117
19121
|
};
|
|
19118
19122
|
return generator;
|
|
19119
19123
|
}
|
|
19124
|
+
spring.applyToOptions = (options) => {
|
|
19125
|
+
const generatorOptions = createGeneratorEasing(options, 100, spring);
|
|
19126
|
+
return options.ease = supportsLinearEasing() ? generatorOptions.ease : "easeOut", options.duration = /* @__PURE__ */ secondsToMilliseconds(generatorOptions.duration), options.type = "keyframes", options;
|
|
19127
|
+
};
|
|
19120
19128
|
function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min: min2, max: max2, restDelta = 0.5, restSpeed }) {
|
|
19121
19129
|
const origin = keyframes2[0], state = {
|
|
19122
19130
|
done: !1,
|
|
@@ -19200,7 +19208,7 @@ function interpolate$1(input2, output, { clamp: isClamp = !0, ease: ease2, mixer
|
|
|
19200
19208
|
const progressInRange = /* @__PURE__ */ progress(input2[i2], input2[i2 + 1], v);
|
|
19201
19209
|
return mixers[i2](progressInRange);
|
|
19202
19210
|
};
|
|
19203
|
-
return isClamp ? (v) => interpolator(clamp$
|
|
19211
|
+
return isClamp ? (v) => interpolator(clamp$2(input2[0], input2[inputLength - 1], v)) : interpolator;
|
|
19204
19212
|
}
|
|
19205
19213
|
function fillOffset(offset2, remaining) {
|
|
19206
19214
|
const min2 = offset2[offset2.length - 1];
|
|
@@ -19310,7 +19318,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
19310
19318
|
if (repeat) {
|
|
19311
19319
|
const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
|
|
19312
19320
|
let currentIteration = Math.floor(progress2), iterationProgress = progress2 % 1;
|
|
19313
|
-
!iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), !!(currentIteration % 2) && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp$
|
|
19321
|
+
!iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), !!(currentIteration % 2) && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp$2(0, 1, iterationProgress) * resolvedDuration;
|
|
19314
19322
|
}
|
|
19315
19323
|
const state = isInDelayPhase ? { done: !1, value: keyframes2[0] } : frameGenerator.next(elapsed);
|
|
19316
19324
|
mapPercentToKeyframes && (state.value = mapPercentToKeyframes(state.value));
|
|
@@ -19349,12 +19357,11 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
19349
19357
|
this.holdTime !== null ? this.startTime = now2 - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = now2) : this.startTime = startTime ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start();
|
|
19350
19358
|
}
|
|
19351
19359
|
pause() {
|
|
19352
|
-
var _a;
|
|
19353
19360
|
if (!this._resolved) {
|
|
19354
19361
|
this.pendingPlayState = "paused";
|
|
19355
19362
|
return;
|
|
19356
19363
|
}
|
|
19357
|
-
this.state = "paused", this.holdTime =
|
|
19364
|
+
this.state = "paused", this.holdTime = this.currentTime ?? 0;
|
|
19358
19365
|
}
|
|
19359
19366
|
complete() {
|
|
19360
19367
|
this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
|
|
@@ -19376,6 +19383,9 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
19376
19383
|
sample(time2) {
|
|
19377
19384
|
return this.startTime = 0, this.tick(time2, !0);
|
|
19378
19385
|
}
|
|
19386
|
+
get finished() {
|
|
19387
|
+
return this.currentFinishedPromise;
|
|
19388
|
+
}
|
|
19379
19389
|
}
|
|
19380
19390
|
const acceleratedValues = /* @__PURE__ */ new Set([
|
|
19381
19391
|
"opacity",
|
|
@@ -19385,21 +19395,7 @@ const acceleratedValues = /* @__PURE__ */ new Set([
|
|
|
19385
19395
|
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
19386
19396
|
// or until we implement support for linear() easing.
|
|
19387
19397
|
// "background-color"
|
|
19388
|
-
]);
|
|
19389
|
-
function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}) {
|
|
19390
|
-
const keyframeOptions = { [valueName]: keyframes2 };
|
|
19391
|
-
times && (keyframeOptions.offset = times);
|
|
19392
|
-
const easing = mapEasingToNativeEasing(ease2, duration);
|
|
19393
|
-
return Array.isArray(easing) && (keyframeOptions.easing = easing), element.animate(keyframeOptions, {
|
|
19394
|
-
delay: delay2,
|
|
19395
|
-
duration,
|
|
19396
|
-
easing: Array.isArray(easing) ? "linear" : easing,
|
|
19397
|
-
fill: "both",
|
|
19398
|
-
iterations: repeat + 1,
|
|
19399
|
-
direction: repeatType === "reverse" ? "alternate" : "normal"
|
|
19400
|
-
});
|
|
19401
|
-
}
|
|
19402
|
-
const supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")), sampleDelta = 10, maxDuration = 2e4;
|
|
19398
|
+
]), supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")), sampleDelta = 10, maxDuration = 2e4;
|
|
19403
19399
|
function requiresPregeneratedKeyframes(options) {
|
|
19404
19400
|
return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
19405
19401
|
}
|
|
@@ -19486,6 +19482,9 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
19486
19482
|
const { animation } = resolved;
|
|
19487
19483
|
return animation.playbackRate;
|
|
19488
19484
|
}
|
|
19485
|
+
get finished() {
|
|
19486
|
+
return this.resolved.animation.finished;
|
|
19487
|
+
}
|
|
19489
19488
|
set speed(newSpeed) {
|
|
19490
19489
|
const { resolved } = this;
|
|
19491
19490
|
if (!resolved)
|
|
@@ -19635,7 +19634,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
19635
19634
|
if (finalKeyframe !== void 0)
|
|
19636
19635
|
return frame$1.update(() => {
|
|
19637
19636
|
options.onUpdate(finalKeyframe), options.onComplete();
|
|
19638
|
-
}), new
|
|
19637
|
+
}), new GroupAnimationWithThen([]);
|
|
19639
19638
|
}
|
|
19640
19639
|
return !isHandoff && AcceleratedAnimation.supports(options) ? new AcceleratedAnimation(options) : new MainThreadAnimation(options);
|
|
19641
19640
|
};
|
|
@@ -19644,12 +19643,11 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key2) {
|
|
|
19644
19643
|
return needsAnimating[key2] = !1, shouldBlock;
|
|
19645
19644
|
}
|
|
19646
19645
|
function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
|
|
19647
|
-
var _a;
|
|
19648
19646
|
let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
|
|
19649
19647
|
transitionOverride && (transition = transitionOverride);
|
|
19650
19648
|
const animations2 = [], animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type];
|
|
19651
19649
|
for (const key2 in target) {
|
|
19652
|
-
const value = visualElement.getValue(key2,
|
|
19650
|
+
const value = visualElement.getValue(key2, visualElement.latestValues[key2] ?? null), valueTarget = target[key2];
|
|
19653
19651
|
if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key2))
|
|
19654
19652
|
continue;
|
|
19655
19653
|
const valueTransition = {
|
|
@@ -19675,8 +19673,7 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
19675
19673
|
}), animations2;
|
|
19676
19674
|
}
|
|
19677
19675
|
function animateVariant(visualElement, variant, options = {}) {
|
|
19678
|
-
|
|
19679
|
-
const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
|
|
19676
|
+
const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? visualElement.presenceContext?.custom : void 0);
|
|
19680
19677
|
let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
|
|
19681
19678
|
options.transitionOverride && (transition = options.transitionOverride);
|
|
19682
19679
|
const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve(), getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => {
|
|
@@ -19750,8 +19747,7 @@ function animateList(visualElement) {
|
|
|
19750
19747
|
function createAnimationState(visualElement) {
|
|
19751
19748
|
let animate2 = animateList(visualElement), state = createState(), isInitialRender = !0;
|
|
19752
19749
|
const buildResolvedTypeValues = (type) => (acc, definition) => {
|
|
19753
|
-
|
|
19754
|
-
const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
|
|
19750
|
+
const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0);
|
|
19755
19751
|
if (resolved) {
|
|
19756
19752
|
const { transition, transitionEnd, ...target } = resolved;
|
|
19757
19753
|
acc = { ...acc, ...target, ...transitionEnd };
|
|
@@ -19815,13 +19811,9 @@ function createAnimationState(visualElement) {
|
|
|
19815
19811
|
return isInitialRender && (props.initial === !1 || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount && (shouldAnimate = !1), isInitialRender = !1, shouldAnimate ? animate2(animations2) : Promise.resolve();
|
|
19816
19812
|
}
|
|
19817
19813
|
function setActive(type, isActive) {
|
|
19818
|
-
var _a;
|
|
19819
19814
|
if (state[type].isActive === isActive)
|
|
19820
19815
|
return Promise.resolve();
|
|
19821
|
-
|
|
19822
|
-
var _a2;
|
|
19823
|
-
return (_a2 = child.animationState) === null || _a2 === void 0 ? void 0 : _a2.setActive(type, isActive);
|
|
19824
|
-
}), state[type].isActive = isActive;
|
|
19816
|
+
visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive)), state[type].isActive = isActive;
|
|
19825
19817
|
const animations2 = animateChanges(type);
|
|
19826
19818
|
for (const key2 in state)
|
|
19827
19819
|
state[key2].protectedKeys = {};
|
|
@@ -19890,8 +19882,7 @@ class AnimationFeature extends Feature {
|
|
|
19890
19882
|
animate2 !== prevAnimate && this.updateAnimationControlsSubscription();
|
|
19891
19883
|
}
|
|
19892
19884
|
unmount() {
|
|
19893
|
-
|
|
19894
|
-
this.node.animationState.reset(), (_a = this.unmountControls) === null || _a === void 0 || _a.call(this);
|
|
19885
|
+
this.node.animationState.reset(), this.unmountControls?.();
|
|
19895
19886
|
}
|
|
19896
19887
|
}
|
|
19897
19888
|
let id$2 = 0;
|
|
@@ -20169,7 +20160,7 @@ function calcViewportConstraints(layoutBox, constraintsBox) {
|
|
|
20169
20160
|
function calcOrigin(source, target) {
|
|
20170
20161
|
let origin = 0.5;
|
|
20171
20162
|
const sourceLength = calcLength(source), targetLength = calcLength(target);
|
|
20172
|
-
return targetLength > sourceLength ? origin = /* @__PURE__ */ progress(target.min, target.max - sourceLength, source.min) : sourceLength > targetLength && (origin = /* @__PURE__ */ progress(source.min, source.max - targetLength, target.min)), clamp$
|
|
20163
|
+
return targetLength > sourceLength ? origin = /* @__PURE__ */ progress(target.min, target.max - sourceLength, source.min) : sourceLength > targetLength && (origin = /* @__PURE__ */ progress(source.min, source.max - targetLength, target.min)), clamp$2(0, 1, origin);
|
|
20173
20164
|
}
|
|
20174
20165
|
function rebaseAxisConstraints(layout2, constraints) {
|
|
20175
20166
|
const relativeConstraints = {};
|
|
@@ -20230,10 +20221,7 @@ class VisualElementDragControls {
|
|
|
20230
20221
|
return;
|
|
20231
20222
|
}
|
|
20232
20223
|
this.updateAxis("x", info.point, offset2), this.updateAxis("y", info.point, offset2), this.visualElement.render(), onDrag && onDrag(event, info);
|
|
20233
|
-
}, onSessionEnd = (event, info) => this.stop(event, info), resumeAnimation = () => eachAxis((axis) => {
|
|
20234
|
-
var _a;
|
|
20235
|
-
return this.getAnimationState(axis) === "paused" && ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
|
|
20236
|
-
}), { dragSnapToOrigin } = this.getProps();
|
|
20224
|
+
}, onSessionEnd = (event, info) => this.stop(event, info), resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" && this.getAxisMotionValue(axis).animation?.play()), { dragSnapToOrigin } = this.getProps();
|
|
20237
20225
|
this.panSession = new PanSession(originEvent, {
|
|
20238
20226
|
onSessionStart,
|
|
20239
20227
|
onStart,
|
|
@@ -20271,8 +20259,7 @@ class VisualElementDragControls {
|
|
|
20271
20259
|
this.constraints && this.constraints[axis] && (next = applyConstraints(next, this.constraints[axis], this.elastic[axis])), axisValue.set(next);
|
|
20272
20260
|
}
|
|
20273
20261
|
resolveConstraints() {
|
|
20274
|
-
|
|
20275
|
-
const { dragConstraints, dragElastic } = this.getProps(), layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout, prevConstraints = this.constraints;
|
|
20262
|
+
const { dragConstraints, dragElastic } = this.getProps(), layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, prevConstraints = this.constraints;
|
|
20276
20263
|
dragConstraints && isRefObject(dragConstraints) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : dragConstraints && layout2 ? this.constraints = calcRelativeConstraints(layout2.layoutBox, dragConstraints) : this.constraints = !1, this.elastic = resolveDragElastic(dragElastic), prevConstraints !== this.constraints && layout2 && this.constraints && !this.hasMutatedConstraints && eachAxis((axis) => {
|
|
20277
20264
|
this.constraints !== !1 && this.getAxisMotionValue(axis) && (this.constraints[axis] = rebaseAxisConstraints(layout2.layoutBox[axis], this.constraints[axis]));
|
|
20278
20265
|
});
|
|
@@ -20321,14 +20308,10 @@ class VisualElementDragControls {
|
|
|
20321
20308
|
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
|
|
20322
20309
|
}
|
|
20323
20310
|
pauseAnimation() {
|
|
20324
|
-
eachAxis((axis) =>
|
|
20325
|
-
var _a;
|
|
20326
|
-
return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause();
|
|
20327
|
-
});
|
|
20311
|
+
eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause());
|
|
20328
20312
|
}
|
|
20329
20313
|
getAnimationState(axis) {
|
|
20330
|
-
|
|
20331
|
-
return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
|
|
20314
|
+
return this.getAxisMotionValue(axis).animation?.state;
|
|
20332
20315
|
}
|
|
20333
20316
|
/**
|
|
20334
20317
|
* Drag works differently depending on which props are provided.
|
|
@@ -20859,7 +20842,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
20859
20842
|
}
|
|
20860
20843
|
this.isUpdating || this.nodes.forEach(clearIsLayoutDirty), this.isUpdating = !1, this.nodes.forEach(resetTransformStyle), this.nodes.forEach(updateLayout), this.nodes.forEach(notifyLayoutUpdate), this.clearAllSnapshots();
|
|
20861
20844
|
const now2 = time.now();
|
|
20862
|
-
frameData.delta = clamp$
|
|
20845
|
+
frameData.delta = clamp$2(0, 1e3 / 60, now2 - frameData.timestamp), frameData.timestamp = now2, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
|
|
20863
20846
|
}
|
|
20864
20847
|
didUpdate() {
|
|
20865
20848
|
this.updateScheduled || (this.updateScheduled = !0, microtask.read(this.scheduleUpdate));
|
|
@@ -20923,21 +20906,19 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
20923
20906
|
};
|
|
20924
20907
|
}
|
|
20925
20908
|
measurePageBox() {
|
|
20926
|
-
var _a;
|
|
20927
20909
|
const { visualElement } = this.options;
|
|
20928
20910
|
if (!visualElement)
|
|
20929
20911
|
return createBox();
|
|
20930
20912
|
const box = visualElement.measureViewportBox();
|
|
20931
|
-
if (!(
|
|
20913
|
+
if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) {
|
|
20932
20914
|
const { scroll } = this.root;
|
|
20933
20915
|
scroll && (translateAxis(box.x, scroll.offset.x), translateAxis(box.y, scroll.offset.y));
|
|
20934
20916
|
}
|
|
20935
20917
|
return box;
|
|
20936
20918
|
}
|
|
20937
20919
|
removeElementScroll(box) {
|
|
20938
|
-
var _a;
|
|
20939
20920
|
const boxWithoutScroll = createBox();
|
|
20940
|
-
if (copyBoxInto(boxWithoutScroll, box),
|
|
20921
|
+
if (copyBoxInto(boxWithoutScroll, box), this.scroll?.wasRoot)
|
|
20941
20922
|
return boxWithoutScroll;
|
|
20942
20923
|
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
20943
20924
|
const node2 = this.path[i2], { scroll, options } = node2;
|
|
@@ -20987,11 +20968,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
20987
20968
|
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
20988
20969
|
}
|
|
20989
20970
|
resolveTargetDelta(forceRecalculation = !1) {
|
|
20990
|
-
var _a;
|
|
20991
20971
|
const lead = this.getLead();
|
|
20992
20972
|
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
20993
20973
|
const isShared = !!this.resumingFrom || this !== lead;
|
|
20994
|
-
if (!(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty ||
|
|
20974
|
+
if (!(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
|
|
20995
20975
|
return;
|
|
20996
20976
|
const { layout: layout2, layoutId } = this.options;
|
|
20997
20977
|
if (!(!this.layout || !(layout2 || layoutId))) {
|
|
@@ -21014,10 +20994,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21014
20994
|
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
21015
20995
|
}
|
|
21016
20996
|
calcProjection() {
|
|
21017
|
-
var _a;
|
|
21018
20997
|
const lead = this.getLead(), isShared = !!this.resumingFrom || this !== lead;
|
|
21019
20998
|
let canSkip = !0;
|
|
21020
|
-
if ((this.isProjectionDirty ||
|
|
20999
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (canSkip = !1), isShared && (this.isSharedProjectionDirty || this.isTransformDirty) && (canSkip = !1), this.resolvedRelativeTargetAt === frameData.timestamp && (canSkip = !1), canSkip)
|
|
21021
21000
|
return;
|
|
21022
21001
|
const { layout: layout2, layoutId } = this.options;
|
|
21023
21002
|
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(layout2 || layoutId))
|
|
@@ -21039,8 +21018,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21039
21018
|
this.isVisible = !0;
|
|
21040
21019
|
}
|
|
21041
21020
|
scheduleRender(notifyAll = !0) {
|
|
21042
|
-
|
|
21043
|
-
if ((_a = this.options.visualElement) === null || _a === void 0 || _a.scheduleRender(), notifyAll) {
|
|
21021
|
+
if (this.options.visualElement?.scheduleRender(), notifyAll) {
|
|
21044
21022
|
const stack = this.getStack();
|
|
21045
21023
|
stack && stack.scheduleRender();
|
|
21046
21024
|
}
|
|
@@ -21110,14 +21088,12 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21110
21088
|
return stack ? stack.lead === this : !0;
|
|
21111
21089
|
}
|
|
21112
21090
|
getLead() {
|
|
21113
|
-
var _a;
|
|
21114
21091
|
const { layoutId } = this.options;
|
|
21115
|
-
return layoutId ?
|
|
21092
|
+
return layoutId ? this.getStack()?.lead || this : this;
|
|
21116
21093
|
}
|
|
21117
21094
|
getPrevLead() {
|
|
21118
|
-
var _a;
|
|
21119
21095
|
const { layoutId } = this.options;
|
|
21120
|
-
return layoutId ?
|
|
21096
|
+
return layoutId ? this.getStack()?.prevLead : void 0;
|
|
21121
21097
|
}
|
|
21122
21098
|
getStack() {
|
|
21123
21099
|
const { layoutId } = this.options;
|
|
@@ -21150,7 +21126,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21150
21126
|
visualElement.scheduleRender();
|
|
21151
21127
|
}
|
|
21152
21128
|
getProjectionStyles(styleProp) {
|
|
21153
|
-
var _a, _b;
|
|
21154
21129
|
if (!this.instance || this.isSVG)
|
|
21155
21130
|
return;
|
|
21156
21131
|
if (!this.isVisible)
|
|
@@ -21168,7 +21143,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21168
21143
|
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
21169
21144
|
this.applyTransformsToTarget(), styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender), transformTemplate && (styles.transform = transformTemplate(valuesToRender, styles.transform));
|
|
21170
21145
|
const { x: x2, y: y2 } = this.projectionDelta;
|
|
21171
|
-
styles.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`, lead.animationValues ? styles.opacity = lead === this ?
|
|
21146
|
+
styles.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`, lead.animationValues ? styles.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit : styles.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
|
|
21172
21147
|
for (const key2 in scaleCorrectors) {
|
|
21173
21148
|
if (valuesToRender[key2] === void 0)
|
|
21174
21149
|
continue;
|
|
@@ -21187,10 +21162,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
21187
21162
|
}
|
|
21188
21163
|
// Only run on root
|
|
21189
21164
|
resetTree() {
|
|
21190
|
-
this.root.nodes.forEach((node2) =>
|
|
21191
|
-
var _a;
|
|
21192
|
-
return (_a = node2.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
|
|
21193
|
-
}), this.root.nodes.forEach(clearMeasurements), this.root.sharedNodes.clear();
|
|
21165
|
+
this.root.nodes.forEach((node2) => node2.currentAnimation?.stop()), this.root.nodes.forEach(clearMeasurements), this.root.sharedNodes.clear();
|
|
21194
21166
|
}
|
|
21195
21167
|
};
|
|
21196
21168
|
}
|
|
@@ -21198,8 +21170,7 @@ function updateLayout(node2) {
|
|
|
21198
21170
|
node2.updateLayout();
|
|
21199
21171
|
}
|
|
21200
21172
|
function notifyLayoutUpdate(node2) {
|
|
21201
|
-
|
|
21202
|
-
const snapshot = ((_a = node2.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node2.snapshot;
|
|
21173
|
+
const snapshot = node2.resumeFrom?.snapshot || node2.snapshot;
|
|
21203
21174
|
if (node2.isLead() && node2.layout && snapshot && node2.hasListeners("didUpdate")) {
|
|
21204
21175
|
const { layoutBox: layout2, measuredBox: measuredLayout } = node2.layout, { animationType } = node2.options, isShared = snapshot.source !== node2.layout.source;
|
|
21205
21176
|
animationType === "size" ? eachAxis((axis) => {
|
|
@@ -21301,8 +21272,7 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
|
|
|
21301
21272
|
return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
|
|
21302
21273
|
}
|
|
21303
21274
|
function checkNodeWasScrollRoot(node2) {
|
|
21304
|
-
|
|
21305
|
-
return node2 !== node2.root && ((_a = node2.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
|
|
21275
|
+
return node2 !== node2.root && node2.scroll?.wasRoot;
|
|
21306
21276
|
}
|
|
21307
21277
|
const DocumentProjectionNode = createProjectionNode({
|
|
21308
21278
|
attachResizeListener: (ref, notify2) => addDomEvent(ref, "resize", notify2),
|
|
@@ -21665,8 +21635,7 @@ class VisualElement {
|
|
|
21665
21635
|
* directly from the instance (which might have performance implications).
|
|
21666
21636
|
*/
|
|
21667
21637
|
readValue(key2, target) {
|
|
21668
|
-
|
|
21669
|
-
let value = this.latestValues[key2] !== void 0 || !this.current ? this.latestValues[key2] : (_a = this.getBaseTargetFromProps(this.props, key2)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key2, this.options);
|
|
21638
|
+
let value = this.latestValues[key2] !== void 0 || !this.current ? this.latestValues[key2] : this.getBaseTargetFromProps(this.props, key2) ?? this.readValueFromInstance(this.current, key2, this.options);
|
|
21670
21639
|
return value != null && (typeof value == "string" && (isNumericalString(value) || isZeroValueString(value)) ? value = parseFloat(value) : !findValueType(value) && complex.test(target) && (value = getAnimatableNone(key2, target)), this.setBaseTarget(key2, isMotionValue(value) ? value.get() : value)), isMotionValue(value) ? value.get() : value;
|
|
21671
21640
|
}
|
|
21672
21641
|
/**
|
|
@@ -21681,11 +21650,10 @@ class VisualElement {
|
|
|
21681
21650
|
* props.
|
|
21682
21651
|
*/
|
|
21683
21652
|
getBaseTarget(key2) {
|
|
21684
|
-
var _a;
|
|
21685
21653
|
const { initial } = this.props;
|
|
21686
21654
|
let valueFromInitial;
|
|
21687
21655
|
if (typeof initial == "string" || typeof initial == "object") {
|
|
21688
|
-
const variant = resolveVariantFromProps(this.props, initial,
|
|
21656
|
+
const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
|
|
21689
21657
|
variant && (valueFromInitial = variant[key2]);
|
|
21690
21658
|
}
|
|
21691
21659
|
if (initial && valueFromInitial !== void 0)
|
|
@@ -21823,8 +21791,7 @@ function calculateRepeatDuration(duration, repeat, _repeatDelay) {
|
|
|
21823
21791
|
return duration * (repeat + 1);
|
|
21824
21792
|
}
|
|
21825
21793
|
function calcNextTime(current, next, prev, labels) {
|
|
21826
|
-
|
|
21827
|
-
return typeof next == "number" ? next : next.startsWith("-") || next.startsWith("+") ? Math.max(0, current + parseFloat(next)) : next === "<" ? prev : (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
|
|
21794
|
+
return typeof next == "number" ? next : next.startsWith("-") || next.startsWith("+") ? Math.max(0, current + parseFloat(next)) : next === "<" ? prev : labels.get(next) ?? current;
|
|
21828
21795
|
}
|
|
21829
21796
|
function eraseKeyframes(sequence, startTime, endTime) {
|
|
21830
21797
|
for (let i2 = 0; i2 < sequence.length; i2++) {
|
|
@@ -22044,7 +22011,7 @@ function isSequence(value) {
|
|
|
22044
22011
|
function createScopedAnimate(scope) {
|
|
22045
22012
|
function scopedAnimate(subjectOrSequence, optionsOrKeyframes, options) {
|
|
22046
22013
|
let animations2 = [];
|
|
22047
|
-
return isSequence(subjectOrSequence) ? animations2 = animateSequence(subjectOrSequence, optionsOrKeyframes, scope) : animations2 = animateSubject(subjectOrSequence, optionsOrKeyframes, options, scope), new
|
|
22014
|
+
return isSequence(subjectOrSequence) ? animations2 = animateSequence(subjectOrSequence, optionsOrKeyframes, scope) : animations2 = animateSubject(subjectOrSequence, optionsOrKeyframes, options, scope), new GroupAnimationWithThen(animations2);
|
|
22048
22015
|
}
|
|
22049
22016
|
return scopedAnimate;
|
|
22050
22017
|
}
|
|
@@ -24744,18 +24711,18 @@ const errorMessages = {
|
|
|
24744
24711
|
[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
|
|
24745
24712
|
[Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]
|
|
24746
24713
|
], elementSelectionKeys = ["Enter", " ", "Escape"];
|
|
24747
|
-
var ConnectionMode;
|
|
24714
|
+
var ConnectionMode$1;
|
|
24748
24715
|
(function(ConnectionMode2) {
|
|
24749
24716
|
ConnectionMode2.Strict = "strict", ConnectionMode2.Loose = "loose";
|
|
24750
|
-
})(ConnectionMode || (ConnectionMode = {}));
|
|
24751
|
-
var PanOnScrollMode;
|
|
24717
|
+
})(ConnectionMode$1 || (ConnectionMode$1 = {}));
|
|
24718
|
+
var PanOnScrollMode$1;
|
|
24752
24719
|
(function(PanOnScrollMode2) {
|
|
24753
24720
|
PanOnScrollMode2.Free = "free", PanOnScrollMode2.Vertical = "vertical", PanOnScrollMode2.Horizontal = "horizontal";
|
|
24754
|
-
})(PanOnScrollMode || (PanOnScrollMode = {}));
|
|
24755
|
-
var SelectionMode;
|
|
24721
|
+
})(PanOnScrollMode$1 || (PanOnScrollMode$1 = {}));
|
|
24722
|
+
var SelectionMode$1;
|
|
24756
24723
|
(function(SelectionMode2) {
|
|
24757
24724
|
SelectionMode2.Partial = "partial", SelectionMode2.Full = "full";
|
|
24758
|
-
})(SelectionMode || (SelectionMode = {}));
|
|
24725
|
+
})(SelectionMode$1 || (SelectionMode$1 = {}));
|
|
24759
24726
|
const initialConnection = {
|
|
24760
24727
|
inProgress: !1,
|
|
24761
24728
|
isValid: null,
|
|
@@ -24768,29 +24735,29 @@ const initialConnection = {
|
|
|
24768
24735
|
toPosition: null,
|
|
24769
24736
|
toNode: null
|
|
24770
24737
|
};
|
|
24771
|
-
var ConnectionLineType;
|
|
24738
|
+
var ConnectionLineType$1;
|
|
24772
24739
|
(function(ConnectionLineType2) {
|
|
24773
24740
|
ConnectionLineType2.Bezier = "default", ConnectionLineType2.Straight = "straight", ConnectionLineType2.Step = "step", ConnectionLineType2.SmoothStep = "smoothstep", ConnectionLineType2.SimpleBezier = "simplebezier";
|
|
24774
|
-
})(ConnectionLineType || (ConnectionLineType = {}));
|
|
24775
|
-
var MarkerType;
|
|
24741
|
+
})(ConnectionLineType$1 || (ConnectionLineType$1 = {}));
|
|
24742
|
+
var MarkerType$1;
|
|
24776
24743
|
(function(MarkerType2) {
|
|
24777
24744
|
MarkerType2.Arrow = "arrow", MarkerType2.ArrowClosed = "arrowclosed";
|
|
24778
|
-
})(MarkerType || (MarkerType = {}));
|
|
24779
|
-
var Position;
|
|
24745
|
+
})(MarkerType$1 || (MarkerType$1 = {}));
|
|
24746
|
+
var Position$1;
|
|
24780
24747
|
(function(Position2) {
|
|
24781
24748
|
Position2.Left = "left", Position2.Top = "top", Position2.Right = "right", Position2.Bottom = "bottom";
|
|
24782
|
-
})(Position || (Position = {}));
|
|
24749
|
+
})(Position$1 || (Position$1 = {}));
|
|
24783
24750
|
const oppositePosition = {
|
|
24784
|
-
[Position.Left]: Position.Right,
|
|
24785
|
-
[Position.Right]: Position.Left,
|
|
24786
|
-
[Position.Top]: Position.Bottom,
|
|
24787
|
-
[Position.Bottom]: Position.Top
|
|
24751
|
+
[Position$1.Left]: Position$1.Right,
|
|
24752
|
+
[Position$1.Right]: Position$1.Left,
|
|
24753
|
+
[Position$1.Top]: Position$1.Bottom,
|
|
24754
|
+
[Position$1.Bottom]: Position$1.Top
|
|
24788
24755
|
};
|
|
24789
24756
|
function getConnectionStatus(isValid) {
|
|
24790
24757
|
return isValid === null ? null : isValid ? "valid" : "invalid";
|
|
24791
24758
|
}
|
|
24792
|
-
const isEdgeBase = (element) => "id" in element && "source" in element && "target" in element, isNodeBase = (element) => "id" in element && "position" in element && !("source" in element) && !("target" in element), isInternalNodeBase = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin = (node2, nodeOrigin = [0, 0]) => {
|
|
24793
|
-
const { width, height } = getNodeDimensions(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
|
|
24759
|
+
const isEdgeBase = (element) => "id" in element && "source" in element && "target" in element, isNodeBase = (element) => "id" in element && "position" in element && !("source" in element) && !("target" in element), isInternalNodeBase$1 = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin$1 = (node2, nodeOrigin = [0, 0]) => {
|
|
24760
|
+
const { width, height } = getNodeDimensions$1(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
|
|
24794
24761
|
return {
|
|
24795
24762
|
x: node2.position.x - offsetX,
|
|
24796
24763
|
y: node2.position.y - offsetY
|
|
@@ -24801,11 +24768,11 @@ const isEdgeBase = (element) => "id" in element && "source" in element && "targe
|
|
|
24801
24768
|
const box = nodes.reduce((currBox, nodeOrId) => {
|
|
24802
24769
|
const isId = typeof nodeOrId == "string";
|
|
24803
24770
|
let currentNode = !params.nodeLookup && !isId ? nodeOrId : void 0;
|
|
24804
|
-
params.nodeLookup && (currentNode = isId ? params.nodeLookup.get(nodeOrId) : isInternalNodeBase(nodeOrId) ? nodeOrId : params.nodeLookup.get(nodeOrId.id));
|
|
24771
|
+
params.nodeLookup && (currentNode = isId ? params.nodeLookup.get(nodeOrId) : isInternalNodeBase$1(nodeOrId) ? nodeOrId : params.nodeLookup.get(nodeOrId.id));
|
|
24805
24772
|
const nodeBox = currentNode ? nodeToBox(currentNode, params.nodeOrigin) : { x: 0, y: 0, x2: 0, y2: 0 };
|
|
24806
|
-
return getBoundsOfBoxes(currBox, nodeBox);
|
|
24773
|
+
return getBoundsOfBoxes$1(currBox, nodeBox);
|
|
24807
24774
|
}, { x: 1 / 0, y: 1 / 0, x2: -1 / 0, y2: -1 / 0 });
|
|
24808
|
-
return boxToRect(box);
|
|
24775
|
+
return boxToRect$1(box);
|
|
24809
24776
|
}, getInternalNodesBounds = (nodeLookup, params = {}) => {
|
|
24810
24777
|
if (nodeLookup.size === 0)
|
|
24811
24778
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -24813,9 +24780,9 @@ const isEdgeBase = (element) => "id" in element && "source" in element && "targe
|
|
|
24813
24780
|
return nodeLookup.forEach((node2) => {
|
|
24814
24781
|
if (params.filter === void 0 || params.filter(node2)) {
|
|
24815
24782
|
const nodeBox = nodeToBox(node2);
|
|
24816
|
-
box = getBoundsOfBoxes(box, nodeBox);
|
|
24783
|
+
box = getBoundsOfBoxes$1(box, nodeBox);
|
|
24817
24784
|
}
|
|
24818
|
-
}), boxToRect(box);
|
|
24785
|
+
}), boxToRect$1(box);
|
|
24819
24786
|
}, getNodesInside = (nodes, rect, [tx, ty, tScale] = [0, 0, 1], partially = !1, excludeNonSelectableNodes = !1) => {
|
|
24820
24787
|
const paneRect = {
|
|
24821
24788
|
...pointToRendererPoint(rect, [tx, ty, tScale]),
|
|
@@ -24826,7 +24793,7 @@ const isEdgeBase = (element) => "id" in element && "source" in element && "targe
|
|
|
24826
24793
|
const { measured, selectable = !0, hidden: hidden2 = !1 } = node2;
|
|
24827
24794
|
if (excludeNonSelectableNodes && !selectable || hidden2)
|
|
24828
24795
|
continue;
|
|
24829
|
-
const width = measured.width ?? node2.width ?? node2.initialWidth ?? null, height = measured.height ?? node2.height ?? node2.initialHeight ?? null, overlappingArea = getOverlappingArea(paneRect, nodeToRect(node2)), area = (width ?? 0) * (height ?? 0), partiallyVisible = partially && overlappingArea > 0;
|
|
24796
|
+
const width = measured.width ?? node2.width ?? node2.initialWidth ?? null, height = measured.height ?? node2.height ?? node2.initialHeight ?? null, overlappingArea = getOverlappingArea(paneRect, nodeToRect$1(node2)), area = (width ?? 0) * (height ?? 0), partiallyVisible = partially && overlappingArea > 0;
|
|
24830
24797
|
(!node2.internals.handleBounds || partiallyVisible || overlappingArea >= area || node2.dragging) && visibleNodes.push(node2);
|
|
24831
24798
|
}
|
|
24832
24799
|
return visibleNodes;
|
|
@@ -24845,7 +24812,7 @@ function getFitViewNodes(nodeLookup, options) {
|
|
|
24845
24812
|
async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
|
|
24846
24813
|
if (nodes.size === 0)
|
|
24847
24814
|
return Promise.resolve(!0);
|
|
24848
|
-
const nodesToFit = getFitViewNodes(nodes, options), bounds = getInternalNodesBounds(nodesToFit), viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
|
|
24815
|
+
const nodesToFit = getFitViewNodes(nodes, options), bounds = getInternalNodesBounds(nodesToFit), viewport = getViewportForBounds$1(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
|
|
24849
24816
|
return await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0);
|
|
24850
24817
|
}
|
|
24851
24818
|
function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError }) {
|
|
@@ -24896,37 +24863,37 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
|
|
|
24896
24863
|
});
|
|
24897
24864
|
return typeof onBeforeDeleteResult == "boolean" ? onBeforeDeleteResult ? { edges: matchingEdges, nodes: matchingNodes } : { edges: [], nodes: [] } : onBeforeDeleteResult;
|
|
24898
24865
|
}
|
|
24899
|
-
const clamp = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
|
|
24900
|
-
x: clamp(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
|
|
24901
|
-
y: clamp(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
|
|
24866
|
+
const clamp$1 = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
|
|
24867
|
+
x: clamp$1(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
|
|
24868
|
+
y: clamp$1(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
|
|
24902
24869
|
});
|
|
24903
24870
|
function clampPositionToParent(childPosition, childDimensions, parent) {
|
|
24904
|
-
const { width: parentWidth, height: parentHeight } = getNodeDimensions(parent), { x: parentX, y: parentY } = parent.internals.positionAbsolute;
|
|
24871
|
+
const { width: parentWidth, height: parentHeight } = getNodeDimensions$1(parent), { x: parentX, y: parentY } = parent.internals.positionAbsolute;
|
|
24905
24872
|
return clampPosition(childPosition, [
|
|
24906
24873
|
[parentX, parentY],
|
|
24907
24874
|
[parentX + parentWidth, parentY + parentHeight]
|
|
24908
24875
|
], childDimensions);
|
|
24909
24876
|
}
|
|
24910
|
-
const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp(Math.abs(value - min2), 1, min2) / min2 : value > max2 ? -clamp(Math.abs(value - max2), 1, min2) / min2 : 0, calcAutoPan = (pos, bounds, speed = 15, distance2 = 40) => {
|
|
24877
|
+
const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp$1(Math.abs(value - min2), 1, min2) / min2 : value > max2 ? -clamp$1(Math.abs(value - max2), 1, min2) / min2 : 0, calcAutoPan = (pos, bounds, speed = 15, distance2 = 40) => {
|
|
24911
24878
|
const xMovement = calcAutoPanVelocity(pos.x, distance2, bounds.width - distance2) * speed, yMovement = calcAutoPanVelocity(pos.y, distance2, bounds.height - distance2) * speed;
|
|
24912
24879
|
return [xMovement, yMovement];
|
|
24913
|
-
}, getBoundsOfBoxes = (box1, box2) => ({
|
|
24880
|
+
}, getBoundsOfBoxes$1 = (box1, box2) => ({
|
|
24914
24881
|
x: Math.min(box1.x, box2.x),
|
|
24915
24882
|
y: Math.min(box1.y, box2.y),
|
|
24916
24883
|
x2: Math.max(box1.x2, box2.x2),
|
|
24917
24884
|
y2: Math.max(box1.y2, box2.y2)
|
|
24918
|
-
}), rectToBox = ({ x: x2, y: y2, width, height }) => ({
|
|
24885
|
+
}), rectToBox$1 = ({ x: x2, y: y2, width, height }) => ({
|
|
24919
24886
|
x: x2,
|
|
24920
24887
|
y: y2,
|
|
24921
24888
|
x2: x2 + width,
|
|
24922
24889
|
y2: y2 + height
|
|
24923
|
-
}), boxToRect = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
|
|
24890
|
+
}), boxToRect$1 = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
|
|
24924
24891
|
x: x2,
|
|
24925
24892
|
y: y2,
|
|
24926
24893
|
width: x22 - x2,
|
|
24927
24894
|
height: y22 - y2
|
|
24928
|
-
}), nodeToRect = (node2, nodeOrigin = [0, 0]) => {
|
|
24929
|
-
const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
|
|
24895
|
+
}), nodeToRect$1 = (node2, nodeOrigin = [0, 0]) => {
|
|
24896
|
+
const { x: x2, y: y2 } = isInternalNodeBase$1(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin$1(node2, nodeOrigin);
|
|
24930
24897
|
return {
|
|
24931
24898
|
x: x2,
|
|
24932
24899
|
y: y2,
|
|
@@ -24934,14 +24901,14 @@ const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp(Math.abs
|
|
|
24934
24901
|
height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
|
|
24935
24902
|
};
|
|
24936
24903
|
}, nodeToBox = (node2, nodeOrigin = [0, 0]) => {
|
|
24937
|
-
const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
|
|
24904
|
+
const { x: x2, y: y2 } = isInternalNodeBase$1(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin$1(node2, nodeOrigin);
|
|
24938
24905
|
return {
|
|
24939
24906
|
x: x2,
|
|
24940
24907
|
y: y2,
|
|
24941
24908
|
x2: x2 + (node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0),
|
|
24942
24909
|
y2: y2 + (node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0)
|
|
24943
24910
|
};
|
|
24944
|
-
}, getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2))), getOverlappingArea = (rectA, rectB) => {
|
|
24911
|
+
}, getBoundsOfRects$1 = (rect1, rect2) => boxToRect$1(getBoundsOfBoxes$1(rectToBox$1(rect1), rectToBox$1(rect2))), getOverlappingArea = (rectA, rectB) => {
|
|
24945
24912
|
const xOverlap = Math.max(0, Math.min(rectA.x + rectA.width, rectB.x + rectB.width) - Math.max(rectA.x, rectB.x)), yOverlap = Math.max(0, Math.min(rectA.y + rectA.height, rectB.y + rectB.height) - Math.max(rectA.y, rectB.y));
|
|
24946
24913
|
return Math.ceil(xOverlap * yOverlap);
|
|
24947
24914
|
}, isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y), isNumeric = (n2) => !isNaN(n2) && isFinite(n2), devWarn = (id2, message) => {
|
|
@@ -24954,11 +24921,11 @@ const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp(Math.abs
|
|
|
24954
24921
|
y: (y2 - ty) / tScale
|
|
24955
24922
|
};
|
|
24956
24923
|
return snapToGrid ? snapPosition(position, snapGrid) : position;
|
|
24957
|
-
}, rendererPointToPoint = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
|
|
24924
|
+
}, rendererPointToPoint$1 = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
|
|
24958
24925
|
x: x2 * tScale + tx,
|
|
24959
24926
|
y: y2 * tScale + ty
|
|
24960
24927
|
});
|
|
24961
|
-
function parsePadding(padding, viewport) {
|
|
24928
|
+
function parsePadding$1(padding, viewport) {
|
|
24962
24929
|
if (typeof padding == "number")
|
|
24963
24930
|
return Math.floor(viewport - viewport / (1 + padding));
|
|
24964
24931
|
if (typeof padding == "string" && padding.endsWith("px")) {
|
|
@@ -24973,9 +24940,9 @@ function parsePadding(padding, viewport) {
|
|
|
24973
24940
|
}
|
|
24974
24941
|
return console.error(`[React Flow] The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`), 0;
|
|
24975
24942
|
}
|
|
24976
|
-
function parsePaddings(padding, width, height) {
|
|
24943
|
+
function parsePaddings$1(padding, width, height) {
|
|
24977
24944
|
if (typeof padding == "string" || typeof padding == "number") {
|
|
24978
|
-
const paddingY = parsePadding(padding, height), paddingX = parsePadding(padding, width);
|
|
24945
|
+
const paddingY = parsePadding$1(padding, height), paddingX = parsePadding$1(padding, width);
|
|
24979
24946
|
return {
|
|
24980
24947
|
top: paddingY,
|
|
24981
24948
|
right: paddingX,
|
|
@@ -24986,13 +24953,13 @@ function parsePaddings(padding, width, height) {
|
|
|
24986
24953
|
};
|
|
24987
24954
|
}
|
|
24988
24955
|
if (typeof padding == "object") {
|
|
24989
|
-
const top = parsePadding(padding.top ?? padding.y ?? 0, height), bottom = parsePadding(padding.bottom ?? padding.y ?? 0, height), left = parsePadding(padding.left ?? padding.x ?? 0, width), right = parsePadding(padding.right ?? padding.x ?? 0, width);
|
|
24956
|
+
const top = parsePadding$1(padding.top ?? padding.y ?? 0, height), bottom = parsePadding$1(padding.bottom ?? padding.y ?? 0, height), left = parsePadding$1(padding.left ?? padding.x ?? 0, width), right = parsePadding$1(padding.right ?? padding.x ?? 0, width);
|
|
24990
24957
|
return { top, right, bottom, left, x: left + right, y: top + bottom };
|
|
24991
24958
|
}
|
|
24992
24959
|
return { top: 0, right: 0, bottom: 0, left: 0, x: 0, y: 0 };
|
|
24993
24960
|
}
|
|
24994
|
-
function calculateAppliedPaddings(bounds, x2, y2, zoom2, width, height) {
|
|
24995
|
-
const { x: left, y: top } = rendererPointToPoint(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
|
|
24961
|
+
function calculateAppliedPaddings$1(bounds, x2, y2, zoom2, width, height) {
|
|
24962
|
+
const { x: left, y: top } = rendererPointToPoint$1(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint$1({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
|
|
24996
24963
|
return {
|
|
24997
24964
|
left: Math.floor(left),
|
|
24998
24965
|
top: Math.floor(top),
|
|
@@ -25000,8 +24967,8 @@ function calculateAppliedPaddings(bounds, x2, y2, zoom2, width, height) {
|
|
|
25000
24967
|
bottom: Math.floor(bottom)
|
|
25001
24968
|
};
|
|
25002
24969
|
}
|
|
25003
|
-
const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
|
|
25004
|
-
const p2 = parsePaddings(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings(bounds, x2, y2, clampedZoom, width, height), offset2 = {
|
|
24970
|
+
const getViewportForBounds$1 = (bounds, width, height, minZoom, maxZoom, padding) => {
|
|
24971
|
+
const p2 = parsePaddings$1(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp$1(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings$1(bounds, x2, y2, clampedZoom, width, height), offset2 = {
|
|
25005
24972
|
left: Math.min(newPadding.left - p2.left, 0),
|
|
25006
24973
|
top: Math.min(newPadding.top - p2.top, 0),
|
|
25007
24974
|
right: Math.min(newPadding.right - p2.right, 0),
|
|
@@ -25012,11 +24979,11 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
|
|
|
25012
24979
|
y: y2 - offset2.top + offset2.bottom,
|
|
25013
24980
|
zoom: clampedZoom
|
|
25014
24981
|
};
|
|
25015
|
-
}, isMacOs = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
|
|
24982
|
+
}, isMacOs$1 = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
|
|
25016
24983
|
function isCoordinateExtent(extent) {
|
|
25017
24984
|
return extent !== void 0 && extent !== "parent";
|
|
25018
24985
|
}
|
|
25019
|
-
function getNodeDimensions(node2) {
|
|
24986
|
+
function getNodeDimensions$1(node2) {
|
|
25020
24987
|
return {
|
|
25021
24988
|
width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
|
|
25022
24989
|
height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
|
|
@@ -25078,41 +25045,41 @@ const isMouseEvent = (event) => "clientX" in event, getEventPosition = (event, b
|
|
|
25078
25045
|
};
|
|
25079
25046
|
});
|
|
25080
25047
|
};
|
|
25081
|
-
function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
|
|
25048
|
+
function getBezierEdgeCenter$1({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
|
|
25082
25049
|
const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125, centerY2 = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125, offsetX = Math.abs(centerX - sourceX), offsetY = Math.abs(centerY2 - sourceY);
|
|
25083
25050
|
return [centerX, centerY2, offsetX, offsetY];
|
|
25084
25051
|
}
|
|
25085
|
-
function calculateControlOffset(distance2, curvature) {
|
|
25052
|
+
function calculateControlOffset$1(distance2, curvature) {
|
|
25086
25053
|
return distance2 >= 0 ? 0.5 * distance2 : curvature * 25 * Math.sqrt(-distance2);
|
|
25087
25054
|
}
|
|
25088
|
-
function getControlWithCurvature({ pos, x1, y1, x2, y2, c: c2 }) {
|
|
25055
|
+
function getControlWithCurvature$1({ pos, x1, y1, x2, y2, c: c2 }) {
|
|
25089
25056
|
switch (pos) {
|
|
25090
|
-
case Position.Left:
|
|
25091
|
-
return [x1 - calculateControlOffset(x1 - x2, c2), y1];
|
|
25092
|
-
case Position.Right:
|
|
25093
|
-
return [x1 + calculateControlOffset(x2 - x1, c2), y1];
|
|
25094
|
-
case Position.Top:
|
|
25095
|
-
return [x1, y1 - calculateControlOffset(y1 - y2, c2)];
|
|
25096
|
-
case Position.Bottom:
|
|
25097
|
-
return [x1, y1 + calculateControlOffset(y2 - y1, c2)];
|
|
25098
|
-
}
|
|
25099
|
-
}
|
|
25100
|
-
function getBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
|
|
25101
|
-
const [sourceControlX, sourceControlY] = getControlWithCurvature({
|
|
25057
|
+
case Position$1.Left:
|
|
25058
|
+
return [x1 - calculateControlOffset$1(x1 - x2, c2), y1];
|
|
25059
|
+
case Position$1.Right:
|
|
25060
|
+
return [x1 + calculateControlOffset$1(x2 - x1, c2), y1];
|
|
25061
|
+
case Position$1.Top:
|
|
25062
|
+
return [x1, y1 - calculateControlOffset$1(y1 - y2, c2)];
|
|
25063
|
+
case Position$1.Bottom:
|
|
25064
|
+
return [x1, y1 + calculateControlOffset$1(y2 - y1, c2)];
|
|
25065
|
+
}
|
|
25066
|
+
}
|
|
25067
|
+
function getBezierPath$1({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top, curvature = 0.25 }) {
|
|
25068
|
+
const [sourceControlX, sourceControlY] = getControlWithCurvature$1({
|
|
25102
25069
|
pos: sourcePosition,
|
|
25103
25070
|
x1: sourceX,
|
|
25104
25071
|
y1: sourceY,
|
|
25105
25072
|
x2: targetX,
|
|
25106
25073
|
y2: targetY,
|
|
25107
25074
|
c: curvature
|
|
25108
|
-
}), [targetControlX, targetControlY] = getControlWithCurvature({
|
|
25075
|
+
}), [targetControlX, targetControlY] = getControlWithCurvature$1({
|
|
25109
25076
|
pos: targetPosition,
|
|
25110
25077
|
x1: targetX,
|
|
25111
25078
|
y1: targetY,
|
|
25112
25079
|
x2: sourceX,
|
|
25113
25080
|
y2: sourceY,
|
|
25114
25081
|
c: curvature
|
|
25115
|
-
}), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
|
|
25082
|
+
}), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter$1({
|
|
25116
25083
|
sourceX,
|
|
25117
25084
|
sourceY,
|
|
25118
25085
|
targetX,
|
|
@@ -25141,7 +25108,7 @@ function getElevatedEdgeZIndex({ sourceNode, targetNode, selected: selected2 = !
|
|
|
25141
25108
|
return zIndex + (edgeOrConnectedNodeSelected ? selectedZIndex : 0);
|
|
25142
25109
|
}
|
|
25143
25110
|
function isEdgeVisible({ sourceNode, targetNode, width, height, transform: transform2 }) {
|
|
25144
|
-
const edgeBox = getBoundsOfBoxes(nodeToBox(sourceNode), nodeToBox(targetNode));
|
|
25111
|
+
const edgeBox = getBoundsOfBoxes$1(nodeToBox(sourceNode), nodeToBox(targetNode));
|
|
25145
25112
|
edgeBox.x === edgeBox.x2 && (edgeBox.x2 += 1), edgeBox.y === edgeBox.y2 && (edgeBox.y2 += 1);
|
|
25146
25113
|
const viewRect = {
|
|
25147
25114
|
x: -transform2[0] / transform2[2],
|
|
@@ -25149,7 +25116,7 @@ function isEdgeVisible({ sourceNode, targetNode, width, height, transform: trans
|
|
|
25149
25116
|
width: width / transform2[2],
|
|
25150
25117
|
height: height / transform2[2]
|
|
25151
25118
|
};
|
|
25152
|
-
return getOverlappingArea(viewRect, boxToRect(edgeBox)) > 0;
|
|
25119
|
+
return getOverlappingArea(viewRect, boxToRect$1(edgeBox)) > 0;
|
|
25153
25120
|
}
|
|
25154
25121
|
const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__${source}${sourceHandle || ""}-${target}${targetHandle || ""}`, connectionExists = (edge, edges) => 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)), addEdge = (edgeParams, edges) => {
|
|
25155
25122
|
if (!edgeParams.source || !edgeParams.target)
|
|
@@ -25170,12 +25137,12 @@ function getStraightPath({ sourceX, sourceY, targetX, targetY }) {
|
|
|
25170
25137
|
return [`M ${sourceX},${sourceY}L ${targetX},${targetY}`, labelX, labelY, offsetX, offsetY];
|
|
25171
25138
|
}
|
|
25172
25139
|
const handleDirections = {
|
|
25173
|
-
[Position.Left]: { x: -1, y: 0 },
|
|
25174
|
-
[Position.Right]: { x: 1, y: 0 },
|
|
25175
|
-
[Position.Top]: { x: 0, y: -1 },
|
|
25176
|
-
[Position.Bottom]: { x: 0, y: 1 }
|
|
25177
|
-
}, getDirection = ({ source, sourcePosition = Position.Bottom, target }) => sourcePosition === Position.Left || sourcePosition === Position.Right ? source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 } : source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 }, distance = (a2, b2) => Math.sqrt(Math.pow(b2.x - a2.x, 2) + Math.pow(b2.y - a2.y, 2));
|
|
25178
|
-
function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset: offset2 }) {
|
|
25140
|
+
[Position$1.Left]: { x: -1, y: 0 },
|
|
25141
|
+
[Position$1.Right]: { x: 1, y: 0 },
|
|
25142
|
+
[Position$1.Top]: { x: 0, y: -1 },
|
|
25143
|
+
[Position$1.Bottom]: { x: 0, y: 1 }
|
|
25144
|
+
}, getDirection = ({ source, sourcePosition = Position$1.Bottom, target }) => sourcePosition === Position$1.Left || sourcePosition === Position$1.Right ? source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 } : source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 }, distance = (a2, b2) => Math.sqrt(Math.pow(b2.x - a2.x, 2) + Math.pow(b2.y - a2.y, 2));
|
|
25145
|
+
function getPoints({ source, sourcePosition = Position$1.Bottom, target, targetPosition = Position$1.Top, center, offset: offset2 }) {
|
|
25179
25146
|
const sourceDir = handleDirections[sourcePosition], targetDir = handleDirections[targetPosition], sourceGapped = { x: source.x + sourceDir.x * offset2, y: source.y + sourceDir.y * offset2 }, targetGapped = { x: target.x + targetDir.x * offset2, y: target.y + targetDir.y * offset2 }, dir = getDirection({
|
|
25180
25147
|
source: sourceGapped,
|
|
25181
25148
|
sourcePosition,
|
|
@@ -25233,7 +25200,7 @@ function getBend(a2, b2, c2, size2) {
|
|
|
25233
25200
|
const xDir = a2.x < c2.x ? 1 : -1, yDir = a2.y < c2.y ? -1 : 1;
|
|
25234
25201
|
return `L ${x2},${y2 + bendSize * yDir}Q ${x2},${y2} ${x2 + bendSize * xDir},${y2}`;
|
|
25235
25202
|
}
|
|
25236
|
-
function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius: borderRadius2 = 5, centerX, centerY: centerY2, offset: offset2 = 20 }) {
|
|
25203
|
+
function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top, borderRadius: borderRadius2 = 5, centerX, centerY: centerY2, offset: offset2 = 20 }) {
|
|
25237
25204
|
const [points, labelX, labelY, offsetX, offsetY] = getPoints({
|
|
25238
25205
|
source: { x: sourceX, y: sourceY },
|
|
25239
25206
|
sourcePosition,
|
|
@@ -25256,7 +25223,7 @@ function getEdgePosition(params) {
|
|
|
25256
25223
|
return null;
|
|
25257
25224
|
const sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles), targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles), sourceHandle = getHandle$1(sourceHandleBounds?.source ?? [], params.sourceHandle), targetHandle = getHandle$1(
|
|
25258
25225
|
// when connection type is loose we can define all handles as sources and connect source -> source
|
|
25259
|
-
params.connectionMode === ConnectionMode.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
|
|
25226
|
+
params.connectionMode === ConnectionMode$1.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
|
|
25260
25227
|
params.targetHandle
|
|
25261
25228
|
);
|
|
25262
25229
|
if (!sourceHandle || !targetHandle)
|
|
@@ -25265,7 +25232,7 @@ function getEdgePosition(params) {
|
|
|
25265
25232
|
sourceHandle: params.sourceHandle,
|
|
25266
25233
|
targetHandle: params.targetHandle
|
|
25267
25234
|
})), null;
|
|
25268
|
-
const sourcePosition = sourceHandle?.position || Position.Bottom, targetPosition = targetHandle?.position || Position.Top, source = getHandlePosition(sourceNode, sourceHandle, sourcePosition), target = getHandlePosition(targetNode, targetHandle, targetPosition);
|
|
25235
|
+
const sourcePosition = sourceHandle?.position || Position$1.Bottom, targetPosition = targetHandle?.position || Position$1.Top, source = getHandlePosition(sourceNode, sourceHandle, sourcePosition), target = getHandlePosition(targetNode, targetHandle, targetPosition);
|
|
25269
25236
|
return {
|
|
25270
25237
|
sourceX: source.x,
|
|
25271
25238
|
sourceY: source.y,
|
|
@@ -25286,18 +25253,18 @@ function toHandleBounds(handles) {
|
|
|
25286
25253
|
target
|
|
25287
25254
|
};
|
|
25288
25255
|
}
|
|
25289
|
-
function getHandlePosition(node2, handle, fallbackPosition = Position.Left, center = !1) {
|
|
25290
|
-
const x2 = (handle?.x ?? 0) + node2.internals.positionAbsolute.x, y2 = (handle?.y ?? 0) + node2.internals.positionAbsolute.y, { width, height } = handle ?? getNodeDimensions(node2);
|
|
25256
|
+
function getHandlePosition(node2, handle, fallbackPosition = Position$1.Left, center = !1) {
|
|
25257
|
+
const x2 = (handle?.x ?? 0) + node2.internals.positionAbsolute.x, y2 = (handle?.y ?? 0) + node2.internals.positionAbsolute.y, { width, height } = handle ?? getNodeDimensions$1(node2);
|
|
25291
25258
|
if (center)
|
|
25292
25259
|
return { x: x2 + width / 2, y: y2 + height / 2 };
|
|
25293
25260
|
switch (handle?.position ?? fallbackPosition) {
|
|
25294
|
-
case Position.Top:
|
|
25261
|
+
case Position$1.Top:
|
|
25295
25262
|
return { x: x2 + width / 2, y: y2 };
|
|
25296
|
-
case Position.Right:
|
|
25263
|
+
case Position$1.Right:
|
|
25297
25264
|
return { x: x2 + width, y: y2 + height / 2 };
|
|
25298
|
-
case Position.Bottom:
|
|
25265
|
+
case Position$1.Bottom:
|
|
25299
25266
|
return { x: x2 + width / 2, y: y2 + height };
|
|
25300
|
-
case Position.Left:
|
|
25267
|
+
case Position$1.Left:
|
|
25301
25268
|
return { x: x2, y: y2 + height / 2 };
|
|
25302
25269
|
}
|
|
25303
25270
|
}
|
|
@@ -25324,16 +25291,16 @@ function getNodeToolbarTransform(nodeRect, viewport, position, offset2, align) {
|
|
|
25324
25291
|
nodeRect.y * viewport.zoom + viewport.y - offset2
|
|
25325
25292
|
], shift2 = [-100 * alignmentOffset, -100];
|
|
25326
25293
|
switch (position) {
|
|
25327
|
-
case Position.Right:
|
|
25294
|
+
case Position$1.Right:
|
|
25328
25295
|
pos = [
|
|
25329
25296
|
(nodeRect.x + nodeRect.width) * viewport.zoom + viewport.x + offset2,
|
|
25330
25297
|
(nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y
|
|
25331
25298
|
], shift2 = [0, -100 * alignmentOffset];
|
|
25332
25299
|
break;
|
|
25333
|
-
case Position.Bottom:
|
|
25300
|
+
case Position$1.Bottom:
|
|
25334
25301
|
pos[1] = (nodeRect.y + nodeRect.height) * viewport.zoom + viewport.y + offset2, shift2[1] = 0;
|
|
25335
25302
|
break;
|
|
25336
|
-
case Position.Left:
|
|
25303
|
+
case Position$1.Left:
|
|
25337
25304
|
pos = [
|
|
25338
25305
|
nodeRect.x * viewport.zoom + viewport.x - offset2,
|
|
25339
25306
|
(nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y
|
|
@@ -25363,7 +25330,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
|
|
|
25363
25330
|
if (node2.parentId)
|
|
25364
25331
|
updateChildNode(node2, nodeLookup, parentLookup, _options);
|
|
25365
25332
|
else {
|
|
25366
|
-
const positionWithOrigin = getNodePositionWithOrigin(node2, _options.nodeOrigin), extent = isCoordinateExtent(node2.extent) ? node2.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(node2));
|
|
25333
|
+
const positionWithOrigin = getNodePositionWithOrigin$1(node2, _options.nodeOrigin), extent = isCoordinateExtent(node2.extent) ? node2.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions$1(node2));
|
|
25367
25334
|
node2.internals.positionAbsolute = clampedPosition;
|
|
25368
25335
|
}
|
|
25369
25336
|
}
|
|
@@ -25377,7 +25344,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
|
|
|
25377
25344
|
if (_options.checkEquality && userNode === internalNode?.internals.userNode)
|
|
25378
25345
|
nodeLookup.set(userNode.id, internalNode);
|
|
25379
25346
|
else {
|
|
25380
|
-
const positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin), extent = isCoordinateExtent(userNode.extent) ? userNode.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(userNode));
|
|
25347
|
+
const positionWithOrigin = getNodePositionWithOrigin$1(userNode, _options.nodeOrigin), extent = isCoordinateExtent(userNode.extent) ? userNode.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions$1(userNode));
|
|
25381
25348
|
internalNode = {
|
|
25382
25349
|
..._options.defaults,
|
|
25383
25350
|
...userNode,
|
|
@@ -25425,7 +25392,7 @@ function calculateZ(node2, selectedNodeZ) {
|
|
|
25425
25392
|
return (isNumeric(node2.zIndex) ? node2.zIndex : 0) + (node2.selected ? selectedNodeZ : 0);
|
|
25426
25393
|
}
|
|
25427
25394
|
function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ) {
|
|
25428
|
-
const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute, childDimensions = getNodeDimensions(childNode), positionWithOrigin = getNodePositionWithOrigin(childNode, nodeOrigin), clampedPosition = isCoordinateExtent(childNode.extent) ? clampPosition(positionWithOrigin, childNode.extent, childDimensions) : positionWithOrigin;
|
|
25395
|
+
const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute, childDimensions = getNodeDimensions$1(childNode), positionWithOrigin = getNodePositionWithOrigin$1(childNode, nodeOrigin), clampedPosition = isCoordinateExtent(childNode.extent) ? clampPosition(positionWithOrigin, childNode.extent, childDimensions) : positionWithOrigin;
|
|
25429
25396
|
let absolutePosition = clampPosition({ x: parentX + clampedPosition.x, y: parentY + clampedPosition.y }, nodeExtent, childDimensions);
|
|
25430
25397
|
childNode.extent === "parent" && (absolutePosition = clampPositionToParent(absolutePosition, childDimensions, parentNode));
|
|
25431
25398
|
const childZ = calculateZ(childNode, selectedNodeZ), parentZ = parentNode.internals.z ?? 0;
|
|
@@ -25441,11 +25408,11 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
|
|
|
25441
25408
|
const parent = nodeLookup.get(child.parentId);
|
|
25442
25409
|
if (!parent)
|
|
25443
25410
|
continue;
|
|
25444
|
-
const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect(parent), expandedRect = getBoundsOfRects(parentRect, child.rect);
|
|
25411
|
+
const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect$1(parent), expandedRect = getBoundsOfRects$1(parentRect, child.rect);
|
|
25445
25412
|
parentExpansions.set(child.parentId, { expandedRect, parent });
|
|
25446
25413
|
}
|
|
25447
25414
|
return parentExpansions.size > 0 && parentExpansions.forEach(({ expandedRect, parent }, parentId) => {
|
|
25448
|
-
const positionAbsolute = parent.internals.positionAbsolute, dimensions = getNodeDimensions(parent), origin = parent.origin ?? nodeOrigin, xChange = expandedRect.x < positionAbsolute.x ? Math.round(Math.abs(positionAbsolute.x - expandedRect.x)) : 0, yChange = expandedRect.y < positionAbsolute.y ? Math.round(Math.abs(positionAbsolute.y - expandedRect.y)) : 0, newWidth = Math.max(dimensions.width, Math.round(expandedRect.width)), newHeight = Math.max(dimensions.height, Math.round(expandedRect.height)), widthChange = (newWidth - dimensions.width) * origin[0], heightChange = (newHeight - dimensions.height) * origin[1];
|
|
25415
|
+
const positionAbsolute = parent.internals.positionAbsolute, dimensions = getNodeDimensions$1(parent), origin = parent.origin ?? nodeOrigin, xChange = expandedRect.x < positionAbsolute.x ? Math.round(Math.abs(positionAbsolute.x - expandedRect.x)) : 0, yChange = expandedRect.y < positionAbsolute.y ? Math.round(Math.abs(positionAbsolute.y - expandedRect.y)) : 0, newWidth = Math.max(dimensions.width, Math.round(expandedRect.width)), newHeight = Math.max(dimensions.height, Math.round(expandedRect.height)), widthChange = (newWidth - dimensions.width) * origin[0], heightChange = (newHeight - dimensions.height) * origin[1];
|
|
25449
25416
|
(xChange > 0 || yChange > 0 || widthChange || heightChange) && (changes.push({
|
|
25450
25417
|
id: parentId,
|
|
25451
25418
|
type: "position",
|
|
@@ -25517,7 +25484,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
|
|
|
25517
25484
|
}), node2.expandParent && node2.parentId && parentExpandChildren.push({
|
|
25518
25485
|
id: node2.id,
|
|
25519
25486
|
parentId: node2.parentId,
|
|
25520
|
-
rect: nodeToRect(newNode, nodeOrigin)
|
|
25487
|
+
rect: nodeToRect$1(newNode, nodeOrigin)
|
|
25521
25488
|
}));
|
|
25522
25489
|
}
|
|
25523
25490
|
}
|
|
@@ -25634,7 +25601,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
25634
25601
|
let hasChange = !1, nodesBox = { x: 0, y: 0, x2: 0, y2: 0 };
|
|
25635
25602
|
if (dragItems.size > 1 && nodeExtent) {
|
|
25636
25603
|
const rect = getInternalNodesBounds(dragItems);
|
|
25637
|
-
nodesBox = rectToBox(rect);
|
|
25604
|
+
nodesBox = rectToBox$1(rect);
|
|
25638
25605
|
}
|
|
25639
25606
|
for (const [id2, dragItem] of dragItems) {
|
|
25640
25607
|
if (!nodeLookup.has(id2))
|
|
@@ -25743,7 +25710,7 @@ function getNodesWithinDistance(position, nodeLookup, distance2) {
|
|
|
25743
25710
|
height: distance2 * 2
|
|
25744
25711
|
};
|
|
25745
25712
|
for (const node2 of nodeLookup.values())
|
|
25746
|
-
getOverlappingArea(rect, nodeToRect(node2)) > 0 && nodes.push(node2);
|
|
25713
|
+
getOverlappingArea(rect, nodeToRect$1(node2)) > 0 && nodes.push(node2);
|
|
25747
25714
|
return nodes;
|
|
25748
25715
|
}
|
|
25749
25716
|
const ADDITIONAL_DISTANCE = 250;
|
|
@@ -25806,7 +25773,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
25806
25773
|
}, fromNodeInternal = nodeLookup.get(nodeId), newConnection = {
|
|
25807
25774
|
inProgress: !0,
|
|
25808
25775
|
isValid: null,
|
|
25809
|
-
from: getHandlePosition(fromNodeInternal, fromHandle, Position.Left, !0),
|
|
25776
|
+
from: getHandlePosition(fromNodeInternal, fromHandle, Position$1.Left, !0),
|
|
25810
25777
|
fromHandle,
|
|
25811
25778
|
fromPosition: fromHandle.position,
|
|
25812
25779
|
fromNode: fromNodeInternal,
|
|
@@ -25842,7 +25809,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
25842
25809
|
// from stays the same
|
|
25843
25810
|
...previousConnection,
|
|
25844
25811
|
isValid,
|
|
25845
|
-
to: closestHandle && isValid ? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, transform2) : position,
|
|
25812
|
+
to: closestHandle && isValid ? rendererPointToPoint$1({ x: closestHandle.x, y: closestHandle.y }, transform2) : position,
|
|
25846
25813
|
toHandle: result.toHandle,
|
|
25847
25814
|
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
|
|
25848
25815
|
toNode: result.toHandle ? nodeLookup.get(result.toHandle.nodeId) : null
|
|
@@ -25877,7 +25844,7 @@ function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId
|
|
|
25877
25844
|
targetHandle: isTarget ? fromHandleId : handleId
|
|
25878
25845
|
};
|
|
25879
25846
|
result.connection = connection;
|
|
25880
|
-
const isValid = connectable && connectableEnd && (connectionMode === ConnectionMode.Strict ? isTarget && handleType === "source" || !isTarget && handleType === "target" : handleNodeId !== fromNodeId || handleId !== fromHandleId);
|
|
25847
|
+
const isValid = connectable && connectableEnd && (connectionMode === ConnectionMode$1.Strict ? isTarget && handleType === "source" || !isTarget && handleType === "target" : handleNodeId !== fromNodeId || handleId !== fromHandleId);
|
|
25881
25848
|
result.isValid = isValid && isValidConnection(connection), result.toHandle = getHandle(handleNodeId, handleType, handleId, nodeLookup, connectionMode, !1);
|
|
25882
25849
|
}
|
|
25883
25850
|
return result;
|
|
@@ -25944,7 +25911,7 @@ const viewChanged = (prevViewport, eventViewport) => prevViewport.x !== eventVie
|
|
|
25944
25911
|
const hasDuration = typeof duration == "number" && duration > 0;
|
|
25945
25912
|
return hasDuration || onEnd(), hasDuration ? selection2.transition().duration(duration).on("end", onEnd) : selection2;
|
|
25946
25913
|
}, wheelDelta = (event) => {
|
|
25947
|
-
const factor = event.ctrlKey && isMacOs() ? 10 : 1;
|
|
25914
|
+
const factor = event.ctrlKey && isMacOs$1() ? 10 : 1;
|
|
25948
25915
|
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * factor;
|
|
25949
25916
|
};
|
|
25950
25917
|
function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection, d3Zoom, panOnScrollMode, panOnScrollSpeed, zoomOnPinch, onPanZoomStart, onPanZoom, onPanZoomEnd }) {
|
|
@@ -25959,8 +25926,8 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
|
|
|
25959
25926
|
return;
|
|
25960
25927
|
}
|
|
25961
25928
|
const deltaNormalize = event.deltaMode === 1 ? 20 : 1;
|
|
25962
|
-
let deltaX = panOnScrollMode === PanOnScrollMode.Vertical ? 0 : event.deltaX * deltaNormalize, deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize;
|
|
25963
|
-
!isMacOs() && event.shiftKey && panOnScrollMode !== PanOnScrollMode.Vertical && (deltaX = event.deltaY * deltaNormalize, deltaY = 0), d3Zoom.translateBy(
|
|
25929
|
+
let deltaX = panOnScrollMode === PanOnScrollMode$1.Vertical ? 0 : event.deltaX * deltaNormalize, deltaY = panOnScrollMode === PanOnScrollMode$1.Horizontal ? 0 : event.deltaY * deltaNormalize;
|
|
25930
|
+
!isMacOs$1() && event.shiftKey && panOnScrollMode !== PanOnScrollMode$1.Vertical && (deltaX = event.deltaY * deltaNormalize, deltaY = 0), d3Zoom.translateBy(
|
|
25964
25931
|
d3Selection,
|
|
25965
25932
|
-(deltaX / currentZoom) * panOnScrollSpeed,
|
|
25966
25933
|
-(deltaY / currentZoom) * panOnScrollSpeed,
|
|
@@ -25975,7 +25942,8 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
|
|
|
25975
25942
|
}
|
|
25976
25943
|
function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomHandler }) {
|
|
25977
25944
|
return function(event, d2) {
|
|
25978
|
-
|
|
25945
|
+
const isWheel = event.type === "wheel", preventZoom = !preventScrolling && isWheel && !event.ctrlKey, hasNoWheelClass = isWrappedWithClass(event, noWheelClassName);
|
|
25946
|
+
if (event.ctrlKey && isWheel && hasNoWheelClass && event.preventDefault(), preventZoom || hasNoWheelClass)
|
|
25979
25947
|
return null;
|
|
25980
25948
|
event.preventDefault(), d3ZoomHandler.call(this, event, d2);
|
|
25981
25949
|
};
|
|
@@ -26035,7 +26003,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
|
|
|
26035
26003
|
setViewportConstrained({
|
|
26036
26004
|
x: viewport.x,
|
|
26037
26005
|
y: viewport.y,
|
|
26038
|
-
zoom: clamp(viewport.zoom, minZoom, maxZoom)
|
|
26006
|
+
zoom: clamp$1(viewport.zoom, minZoom, maxZoom)
|
|
26039
26007
|
}, [
|
|
26040
26008
|
[0, 0],
|
|
26041
26009
|
[bbox.width, bbox.height]
|
|
@@ -26159,10 +26127,10 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
|
|
|
26159
26127
|
setClickDistance
|
|
26160
26128
|
};
|
|
26161
26129
|
}
|
|
26162
|
-
var ResizeControlVariant;
|
|
26130
|
+
var ResizeControlVariant$1;
|
|
26163
26131
|
(function(ResizeControlVariant2) {
|
|
26164
26132
|
ResizeControlVariant2.Line = "line", ResizeControlVariant2.Handle = "handle";
|
|
26165
|
-
})(ResizeControlVariant || (ResizeControlVariant = {}));
|
|
26133
|
+
})(ResizeControlVariant$1 || (ResizeControlVariant$1 = {}));
|
|
26166
26134
|
function getResizeDirection({ width, prevWidth, height, prevHeight, affectsX, affectsY }) {
|
|
26167
26135
|
const deltaWidth = width - prevWidth, deltaHeight = height - prevHeight, direction = [deltaWidth > 0 ? 1 : deltaWidth < 0 ? -1 : 0, deltaHeight > 0 ? 1 : deltaHeight < 0 ? -1 : 0];
|
|
26168
26136
|
return deltaWidth && affectsX && (direction[0] = direction[0] * -1), deltaHeight && affectsY && (direction[1] = direction[1] * -1), direction;
|
|
@@ -26331,7 +26299,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
26331
26299
|
}), nextValues = { ...prevValues, direction };
|
|
26332
26300
|
shouldResize?.(event, nextValues) !== !1 && (onResize?.(event, nextValues), onChange(change, childChanges));
|
|
26333
26301
|
}).on("end", (event) => {
|
|
26334
|
-
onResizeEnd?.(event, { ...prevValues }), onEnd?.();
|
|
26302
|
+
onResizeEnd?.(event, { ...prevValues }), onEnd?.({ ...prevValues });
|
|
26335
26303
|
});
|
|
26336
26304
|
selection2.call(dragHandler);
|
|
26337
26305
|
}
|
|
@@ -26660,7 +26628,7 @@ const useViewportHelper = () => {
|
|
|
26660
26628
|
}, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
|
|
26661
26629
|
},
|
|
26662
26630
|
fitBounds: async (bounds, options) => {
|
|
26663
|
-
const { width, height, minZoom, maxZoom, panZoom } = store.getState(), viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
|
|
26631
|
+
const { width, height, minZoom, maxZoom, panZoom } = store.getState(), viewport = getViewportForBounds$1(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
|
|
26664
26632
|
return panZoom ? (await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
|
|
26665
26633
|
},
|
|
26666
26634
|
screenToFlowPosition: (clientPosition, options = {}) => {
|
|
@@ -26677,7 +26645,7 @@ const useViewportHelper = () => {
|
|
|
26677
26645
|
const { transform: transform2, domNode } = store.getState();
|
|
26678
26646
|
if (!domNode)
|
|
26679
26647
|
return flowPosition;
|
|
26680
|
-
const { x: domX, y: domY } = domNode.getBoundingClientRect(), rendererPosition = rendererPointToPoint(flowPosition, transform2);
|
|
26648
|
+
const { x: domX, y: domY } = domNode.getBoundingClientRect(), rendererPosition = rendererPointToPoint$1(flowPosition, transform2);
|
|
26681
26649
|
return {
|
|
26682
26650
|
x: rendererPosition.x + domX,
|
|
26683
26651
|
y: rendererPosition.y + domY
|
|
@@ -26804,12 +26772,12 @@ function BatchProvider({ children: children2 }) {
|
|
|
26804
26772
|
next = typeof payload == "function" ? payload(next) : payload;
|
|
26805
26773
|
if (hasDefaultNodes)
|
|
26806
26774
|
setNodes(next);
|
|
26807
|
-
else
|
|
26775
|
+
else {
|
|
26808
26776
|
const changes = getElementsDiffChanges({
|
|
26809
26777
|
items: next,
|
|
26810
26778
|
lookup: nodeLookup
|
|
26811
26779
|
});
|
|
26812
|
-
changes.length > 0 ? onNodesChange(changes) : fitViewQueued && window.requestAnimationFrame(() => {
|
|
26780
|
+
changes.length > 0 ? onNodesChange?.(changes) : fitViewQueued && window.requestAnimationFrame(() => {
|
|
26813
26781
|
const { fitViewQueued: fitViewQueued2, nodes: nodes2, setNodes: setNodes2 } = store.getState();
|
|
26814
26782
|
fitViewQueued2 && setNodes2(nodes2);
|
|
26815
26783
|
});
|
|
@@ -26846,7 +26814,7 @@ function useReactFlow() {
|
|
|
26846
26814
|
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
|
26847
26815
|
height: nodeToUse.measured?.height ?? nodeToUse.height
|
|
26848
26816
|
};
|
|
26849
|
-
return nodeToRect(nodeWithPosition);
|
|
26817
|
+
return nodeToRect$1(nodeWithPosition);
|
|
26850
26818
|
}, updateNode = (id2, nodeUpdate, options = { replace: !1 }) => {
|
|
26851
26819
|
setNodes((prevNodes) => prevNodes.map((node2) => {
|
|
26852
26820
|
if (node2.id === id2) {
|
|
@@ -26919,7 +26887,7 @@ function useReactFlow() {
|
|
|
26919
26887
|
const internalNode = store.getState().nodeLookup.get(n2.id);
|
|
26920
26888
|
if (internalNode && !isRect && (n2.id === nodeOrRect.id || !internalNode.internals.positionAbsolute))
|
|
26921
26889
|
return !1;
|
|
26922
|
-
const currNodeRect = nodeToRect(hasNodesOption ? n2 : internalNode), overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
|
|
26890
|
+
const currNodeRect = nodeToRect$1(hasNodesOption ? n2 : internalNode), overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
|
|
26923
26891
|
return partially && overlappingArea > 0 || overlappingArea >= nodeRect.width * nodeRect.height;
|
|
26924
26892
|
}) : [];
|
|
26925
26893
|
},
|
|
@@ -27002,7 +26970,7 @@ const containerStyle = {
|
|
|
27002
26970
|
userSelectionActive: s2.userSelectionActive,
|
|
27003
26971
|
lib: s2.lib
|
|
27004
26972
|
});
|
|
27005
|
-
function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = !0, children: children2, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
|
|
26973
|
+
function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode$1.Free, zoomOnDoubleClick = !0, panOnDrag = !0, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = !0, children: children2, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
|
|
27006
26974
|
const store = useStoreApi(), zoomPane = useRef(null), { userSelectionActive, lib: lib2 } = useStore$1(selector$j, shallow$1), zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode), panZoom = useRef();
|
|
27007
26975
|
useResizeHandler(zoomPane);
|
|
27008
26976
|
const onTransformChange = useCallback((transform2) => {
|
|
@@ -27096,7 +27064,7 @@ const wrapHandler = (handler, containerRef) => (event) => {
|
|
|
27096
27064
|
connectionInProgress: s2.connection.inProgress,
|
|
27097
27065
|
dragging: s2.paneDragging
|
|
27098
27066
|
});
|
|
27099
|
-
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
27067
|
+
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode$1.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
27100
27068
|
const store = useStoreApi(), { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore$1(selector$h, shallow$1), hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive), container2 = useRef(null), containerBounds = useRef(), selectedNodeIds = useRef(/* @__PURE__ */ new Set()), selectedEdgeIds = useRef(/* @__PURE__ */ new Set()), selectionInProgress = useRef(!1), selectionStarted = useRef(!1), onClick = (event) => {
|
|
27101
27069
|
if (selectionInProgress.current || connectionInProgress) {
|
|
27102
27070
|
selectionInProgress.current = !1;
|
|
@@ -27138,7 +27106,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
27138
27106
|
width: Math.abs(mouseX - startX),
|
|
27139
27107
|
height: Math.abs(mouseY - startY)
|
|
27140
27108
|
}, prevSelectedNodeIds = selectedNodeIds.current, prevSelectedEdgeIds = selectedEdgeIds.current;
|
|
27141
|
-
selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode.Partial, !0).map((node2) => node2.id)), selectedEdgeIds.current = /* @__PURE__ */ new Set();
|
|
27109
|
+
selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode$1.Partial, !0).map((node2) => node2.id)), selectedEdgeIds.current = /* @__PURE__ */ new Set();
|
|
27142
27110
|
const edgesSelectable = defaultEdgeOptions?.selectable ?? !0;
|
|
27143
27111
|
for (const nodeId of selectedNodeIds.current) {
|
|
27144
27112
|
const connections = connectionLookup.get(nodeId);
|
|
@@ -27255,13 +27223,13 @@ const useNodeId = () => useContext(NodeIdContext), selector$g = (s2) => ({
|
|
|
27255
27223
|
connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
|
|
27256
27224
|
connectingTo,
|
|
27257
27225
|
clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.id === handleId && clickHandle?.type === type,
|
|
27258
|
-
isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
|
|
27226
|
+
isPossibleEndHandle: connectionMode === ConnectionMode$1.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
|
|
27259
27227
|
connectionInProcess: !!fromHandle,
|
|
27260
27228
|
clickConnectionInProcess: !!clickHandle,
|
|
27261
27229
|
valid: connectingTo && isValid
|
|
27262
27230
|
};
|
|
27263
27231
|
};
|
|
27264
|
-
function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = !0, isConnectableStart = !0, isConnectableEnd = !0, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
|
|
27232
|
+
function HandleComponent({ type = "source", position = Position$1.Top, isValidConnection, isConnectable = !0, isConnectableStart = !0, isConnectableEnd = !0, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
|
|
27265
27233
|
const handleId = id2 || null, isTarget = type === "target", store = useStoreApi(), nodeId = useNodeId(), { connectOnClick, noPanClassName, rfId } = useStore$1(selector$g, shallow$1), { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore$1(connectingSelector(nodeId, handleId, type), shallow$1);
|
|
27266
27234
|
nodeId || store.getState().onError?.("010", errorMessages.error010());
|
|
27267
27235
|
const onConnectExtended = (params) => {
|
|
@@ -27357,16 +27325,16 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
27357
27325
|
]), onMouseDown: onPointerDown2, onTouchStart: onPointerDown2, onClick: connectOnClick ? onClick : void 0, ref, ...rest, children: children2 });
|
|
27358
27326
|
}
|
|
27359
27327
|
const Handle = memo$2(fixedForwardRef(HandleComponent));
|
|
27360
|
-
function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
|
|
27328
|
+
function InputNode({ data, isConnectable, sourcePosition = Position$1.Bottom }) {
|
|
27361
27329
|
return jsxs(Fragment$1, { children: [data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
27362
27330
|
}
|
|
27363
|
-
function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom }) {
|
|
27331
|
+
function DefaultNode({ data, isConnectable, targetPosition = Position$1.Top, sourcePosition = Position$1.Bottom }) {
|
|
27364
27332
|
return jsxs(Fragment$1, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
|
|
27365
27333
|
}
|
|
27366
27334
|
function GroupNode() {
|
|
27367
27335
|
return null;
|
|
27368
27336
|
}
|
|
27369
|
-
function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
|
|
27337
|
+
function OutputNode({ data, isConnectable, targetPosition = Position$1.Top }) {
|
|
27370
27338
|
return jsxs(Fragment$1, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label] });
|
|
27371
27339
|
}
|
|
27372
27340
|
const arrowKeyDiffs = {
|
|
@@ -27488,7 +27456,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
|
|
|
27488
27456
|
}), moveSelectedNodes = useMoveSelectedNodes();
|
|
27489
27457
|
if (node2.hidden)
|
|
27490
27458
|
return null;
|
|
27491
|
-
const nodeDimensions = getNodeDimensions(node2), inlineDimensions = getNodeInlineStyleDimensions(node2), hasPointerEvents = isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave, onMouseEnterHandler = onMouseEnter ? (event) => onMouseEnter(event, { ...internals.userNode }) : void 0, onMouseMoveHandler = onMouseMove ? (event) => onMouseMove(event, { ...internals.userNode }) : void 0, onMouseLeaveHandler = onMouseLeave ? (event) => onMouseLeave(event, { ...internals.userNode }) : void 0, onContextMenuHandler = onContextMenu ? (event) => onContextMenu(event, { ...internals.userNode }) : void 0, onDoubleClickHandler = onDoubleClick ? (event) => onDoubleClick(event, { ...internals.userNode }) : void 0, onSelectNodeHandler = (event) => {
|
|
27459
|
+
const nodeDimensions = getNodeDimensions$1(node2), inlineDimensions = getNodeInlineStyleDimensions(node2), hasPointerEvents = isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave, onMouseEnterHandler = onMouseEnter ? (event) => onMouseEnter(event, { ...internals.userNode }) : void 0, onMouseMoveHandler = onMouseMove ? (event) => onMouseMove(event, { ...internals.userNode }) : void 0, onMouseLeaveHandler = onMouseLeave ? (event) => onMouseLeave(event, { ...internals.userNode }) : void 0, onContextMenuHandler = onContextMenu ? (event) => onContextMenu(event, { ...internals.userNode }) : void 0, onDoubleClickHandler = onDoubleClick ? (event) => onDoubleClick(event, { ...internals.userNode }) : void 0, onSelectNodeHandler = (event) => {
|
|
27492
27460
|
const { selectNodesOnDrag, nodeDragThreshold } = store.getState();
|
|
27493
27461
|
isSelectable && (!selectNodesOnDrag || !isDraggable || nodeDragThreshold > 0) && handleNodeClick({
|
|
27494
27462
|
id: id2,
|
|
@@ -27603,8 +27571,8 @@ const ArrowSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => jsx("polyli
|
|
|
27603
27571
|
fill: color2,
|
|
27604
27572
|
strokeWidth
|
|
27605
27573
|
}, strokeLinecap: "round", strokeLinejoin: "round", points: "-5,-4 0,0 -5,4 -5,-4" }), MarkerSymbols = {
|
|
27606
|
-
[MarkerType.Arrow]: ArrowSymbol,
|
|
27607
|
-
[MarkerType.ArrowClosed]: ArrowClosedSymbol
|
|
27574
|
+
[MarkerType$1.Arrow]: ArrowSymbol,
|
|
27575
|
+
[MarkerType$1.ArrowClosed]: ArrowClosedSymbol
|
|
27608
27576
|
};
|
|
27609
27577
|
function useMarkerSymbol(type) {
|
|
27610
27578
|
const store = useStoreApi();
|
|
@@ -27644,9 +27612,9 @@ function BaseEdge({ path, labelX, labelY, label: label2, labelStyle, labelShowBg
|
|
|
27644
27612
|
return jsxs(Fragment$1, { children: [jsx("path", { ...props, d: path, fill: "none", className: cc(["react-flow__edge-path", props.className]) }), interactionWidth && jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }), label2 && isNumeric(labelX) && isNumeric(labelY) ? jsx(EdgeText, { x: labelX, y: labelY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius }) : null] });
|
|
27645
27613
|
}
|
|
27646
27614
|
function getControl({ pos, x1, y1, x2, y2 }) {
|
|
27647
|
-
return pos === Position.Left || pos === Position.Right ? [0.5 * (x1 + x2), y1] : [x1, 0.5 * (y1 + y2)];
|
|
27615
|
+
return pos === Position$1.Left || pos === Position$1.Right ? [0.5 * (x1 + x2), y1] : [x1, 0.5 * (y1 + y2)];
|
|
27648
27616
|
}
|
|
27649
|
-
function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top }) {
|
|
27617
|
+
function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top }) {
|
|
27650
27618
|
const [sourceControlX, sourceControlY] = getControl({
|
|
27651
27619
|
pos: sourcePosition,
|
|
27652
27620
|
x1: sourceX,
|
|
@@ -27659,7 +27627,7 @@ function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Botto
|
|
|
27659
27627
|
y1: targetY,
|
|
27660
27628
|
x2: sourceX,
|
|
27661
27629
|
y2: sourceY
|
|
27662
|
-
}), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
|
|
27630
|
+
}), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter$1({
|
|
27663
27631
|
sourceX,
|
|
27664
27632
|
sourceY,
|
|
27665
27633
|
targetX,
|
|
@@ -27678,7 +27646,7 @@ function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Botto
|
|
|
27678
27646
|
];
|
|
27679
27647
|
}
|
|
27680
27648
|
function createSimpleBezierEdge(params) {
|
|
27681
|
-
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position.Bottom, targetPosition = Position.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth }) => {
|
|
27649
|
+
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth }) => {
|
|
27682
27650
|
const [path, labelX, labelY] = getSimpleBezierPath({
|
|
27683
27651
|
sourceX,
|
|
27684
27652
|
sourceY,
|
|
@@ -27694,7 +27662,7 @@ const SimpleBezierEdge = createSimpleBezierEdge({ isInternal: !1 }), SimpleBezie
|
|
|
27694
27662
|
SimpleBezierEdge.displayName = "SimpleBezierEdge";
|
|
27695
27663
|
SimpleBezierEdgeInternal.displayName = "SimpleBezierEdgeInternal";
|
|
27696
27664
|
function createSmoothStepEdge(params) {
|
|
27697
|
-
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, sourcePosition = Position.Bottom, targetPosition = Position.Top, markerEnd, markerStart, pathOptions, interactionWidth }) => {
|
|
27665
|
+
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, markerEnd, markerStart, pathOptions, interactionWidth }) => {
|
|
27698
27666
|
const [path, labelX, labelY] = getSmoothStepPath({
|
|
27699
27667
|
sourceX,
|
|
27700
27668
|
sourceY,
|
|
@@ -27730,8 +27698,8 @@ const StraightEdge = createStraightEdge({ isInternal: !1 }), StraightEdgeInterna
|
|
|
27730
27698
|
StraightEdge.displayName = "StraightEdge";
|
|
27731
27699
|
StraightEdgeInternal.displayName = "StraightEdgeInternal";
|
|
27732
27700
|
function createBezierEdge(params) {
|
|
27733
|
-
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position.Bottom, targetPosition = Position.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, pathOptions, interactionWidth }) => {
|
|
27734
|
-
const [path, labelX, labelY] = getBezierPath({
|
|
27701
|
+
return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, pathOptions, interactionWidth }) => {
|
|
27702
|
+
const [path, labelX, labelY] = getBezierPath$1({
|
|
27735
27703
|
sourceX,
|
|
27736
27704
|
sourceY,
|
|
27737
27705
|
sourcePosition,
|
|
@@ -27759,7 +27727,7 @@ const builtinEdgeTypes = {
|
|
|
27759
27727
|
targetY: null,
|
|
27760
27728
|
sourcePosition: null,
|
|
27761
27729
|
targetPosition: null
|
|
27762
|
-
}, shiftX = (x2, shift2, position) => position === Position.Left ? x2 - shift2 : position === Position.Right ? x2 + shift2 : x2, shiftY = (y2, shift2, position) => position === Position.Top ? y2 - shift2 : position === Position.Bottom ? y2 + shift2 : y2, EdgeUpdaterClassName = "react-flow__edgeupdater";
|
|
27730
|
+
}, shiftX = (x2, shift2, position) => position === Position$1.Left ? x2 - shift2 : position === Position$1.Right ? x2 + shift2 : x2, shiftY = (y2, shift2, position) => position === Position$1.Top ? y2 - shift2 : position === Position$1.Bottom ? y2 + shift2 : y2, EdgeUpdaterClassName = "react-flow__edgeupdater";
|
|
27763
27731
|
function EdgeAnchor({ position, centerX, centerY: centerY2, radius = 10, onMouseDown, onMouseEnter, onMouseOut, type }) {
|
|
27764
27732
|
return jsx("circle", { onMouseDown, onMouseEnter, onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY2, radius, position), r: radius, stroke: "transparent", fill: "transparent" });
|
|
27765
27733
|
}
|
|
@@ -27917,7 +27885,7 @@ function ConnectionLineWrapper({ containerStyle: containerStyle2, style: style2,
|
|
|
27917
27885
|
const { nodesConnectable, width, height, isValid, inProgress } = useStore$1(selector$7, shallow$1);
|
|
27918
27886
|
return !(width && nodesConnectable && inProgress) ? null : jsx("svg", { style: containerStyle2, width, height, className: "react-flow__connectionline react-flow__container", children: jsx("g", { className: cc(["react-flow__connection", getConnectionStatus(isValid)]), children: jsx(ConnectionLine, { style: style2, type, CustomComponent: component, isValid }) }) });
|
|
27919
27887
|
}
|
|
27920
|
-
const ConnectionLine = ({ style: style2, type = ConnectionLineType.Bezier, CustomComponent, isValid }) => {
|
|
27888
|
+
const ConnectionLine = ({ style: style2, type = ConnectionLineType$1.Bezier, CustomComponent, isValid }) => {
|
|
27921
27889
|
const { inProgress, from, fromNode, fromHandle, fromPosition, to, toNode, toHandle, toPosition } = useConnection();
|
|
27922
27890
|
if (!inProgress)
|
|
27923
27891
|
return;
|
|
@@ -27933,19 +27901,19 @@ const ConnectionLine = ({ style: style2, type = ConnectionLineType.Bezier, Custo
|
|
|
27933
27901
|
targetPosition: toPosition
|
|
27934
27902
|
};
|
|
27935
27903
|
switch (type) {
|
|
27936
|
-
case ConnectionLineType.Bezier:
|
|
27937
|
-
[path] = getBezierPath(pathParams);
|
|
27904
|
+
case ConnectionLineType$1.Bezier:
|
|
27905
|
+
[path] = getBezierPath$1(pathParams);
|
|
27938
27906
|
break;
|
|
27939
|
-
case ConnectionLineType.SimpleBezier:
|
|
27907
|
+
case ConnectionLineType$1.SimpleBezier:
|
|
27940
27908
|
[path] = getSimpleBezierPath(pathParams);
|
|
27941
27909
|
break;
|
|
27942
|
-
case ConnectionLineType.Step:
|
|
27910
|
+
case ConnectionLineType$1.Step:
|
|
27943
27911
|
[path] = getSmoothStepPath({
|
|
27944
27912
|
...pathParams,
|
|
27945
27913
|
borderRadius: 0
|
|
27946
27914
|
});
|
|
27947
27915
|
break;
|
|
27948
|
-
case ConnectionLineType.SmoothStep:
|
|
27916
|
+
case ConnectionLineType$1.SmoothStep:
|
|
27949
27917
|
[path] = getSmoothStepPath(pathParams);
|
|
27950
27918
|
break;
|
|
27951
27919
|
default:
|
|
@@ -27978,7 +27946,7 @@ const GraphView = memo$2(GraphViewComponent), getInitialState = ({ nodes, edges,
|
|
|
27978
27946
|
if (fitView && width && height) {
|
|
27979
27947
|
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
27980
27948
|
filter: (node2) => !!((node2.width || node2.initialWidth) && (node2.height || node2.initialHeight))
|
|
27981
|
-
}), { x: x2, y: y2, zoom: zoom2 } = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
|
|
27949
|
+
}), { x: x2, y: y2, zoom: zoom2 } = getViewportForBounds$1(bounds, width, height, 0.5, 2, 0.1);
|
|
27982
27950
|
transform2 = [x2, y2, zoom2];
|
|
27983
27951
|
}
|
|
27984
27952
|
return {
|
|
@@ -28004,7 +27972,7 @@ const GraphView = memo$2(GraphViewComponent), getInitialState = ({ nodes, edges,
|
|
|
28004
27972
|
nodesSelectionActive: !1,
|
|
28005
27973
|
userSelectionActive: !1,
|
|
28006
27974
|
userSelectionRect: null,
|
|
28007
|
-
connectionMode: ConnectionMode.Strict,
|
|
27975
|
+
connectionMode: ConnectionMode$1.Strict,
|
|
28008
27976
|
domNode: null,
|
|
28009
27977
|
paneDragging: !1,
|
|
28010
27978
|
noPanClassName: "nopan",
|
|
@@ -28224,7 +28192,7 @@ const wrapperStyle = {
|
|
|
28224
28192
|
position: "relative",
|
|
28225
28193
|
zIndex: 0
|
|
28226
28194
|
};
|
|
28227
|
-
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug: debug2, onScroll, ...rest }, ref) {
|
|
28195
|
+
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType$1.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode$1.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs$1() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs$1() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode$1.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug: debug2, onScroll, ...rest }, ref) {
|
|
28228
28196
|
const rfId = id2 || "1", colorModeClassName = useColorModeClass(colorMode), wrapperOnScroll = useCallback((e2) => {
|
|
28229
28197
|
e2.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" }), onScroll?.(e2);
|
|
28230
28198
|
}, [onScroll]);
|
|
@@ -28359,7 +28327,7 @@ function MiniMapNodes({
|
|
|
28359
28327
|
}
|
|
28360
28328
|
function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
|
|
28361
28329
|
const { node: node2, x: x2, y: y2, width, height } = useStore$1((s2) => {
|
|
28362
|
-
const
|
|
28330
|
+
const { internals } = s2.nodeLookup.get(id2), node22 = internals.userNode, { x: x22, y: y22 } = internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions$1(node22);
|
|
28363
28331
|
return {
|
|
28364
28332
|
node: node22,
|
|
28365
28333
|
x: x22,
|
|
@@ -28381,7 +28349,7 @@ const defaultWidth = 200, defaultHeight = 150, filterHidden = (node2) => !node2.
|
|
|
28381
28349
|
};
|
|
28382
28350
|
return {
|
|
28383
28351
|
viewBB,
|
|
28384
|
-
boundingRect: s2.nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds(s2.nodeLookup, { filter: filterHidden }), viewBB) : viewBB,
|
|
28352
|
+
boundingRect: s2.nodeLookup.size > 0 ? getBoundsOfRects$1(getInternalNodesBounds(s2.nodeLookup, { filter: filterHidden }), viewBB) : viewBB,
|
|
28385
28353
|
rfId: s2.rfId,
|
|
28386
28354
|
panZoom: s2.panZoom,
|
|
28387
28355
|
translateExtent: s2.translateExtent,
|
|
@@ -28442,7 +28410,7 @@ function MiniMapComponent({
|
|
|
28442
28410
|
const [x22, y22] = minimapInstance.current?.pointer(event) || [0, 0];
|
|
28443
28411
|
onClick(event, { x: x22, y: y22 });
|
|
28444
28412
|
} : void 0, onSvgNodeClick = onNodeClick ? useCallback((event, nodeId) => {
|
|
28445
|
-
const node2 = store.getState().nodeLookup.get(nodeId);
|
|
28413
|
+
const node2 = store.getState().nodeLookup.get(nodeId).internals.userNode;
|
|
28446
28414
|
onNodeClick(event, node2);
|
|
28447
28415
|
}, []) : void 0;
|
|
28448
28416
|
return jsx(Panel, { position, style: {
|
|
@@ -28453,14 +28421,14 @@ function MiniMapComponent({
|
|
|
28453
28421
|
"--xy-minimap-mask-stroke-width-props": typeof maskStrokeWidth == "number" ? maskStrokeWidth * viewScale : void 0,
|
|
28454
28422
|
"--xy-minimap-node-background-color-props": typeof nodeColor == "string" ? nodeColor : void 0,
|
|
28455
28423
|
"--xy-minimap-node-stroke-color-props": typeof nodeStrokeColor == "string" ? nodeStrokeColor : void 0,
|
|
28456
|
-
"--xy-minimap-node-stroke-width-props": typeof nodeStrokeWidth == "
|
|
28424
|
+
"--xy-minimap-node-stroke-width-props": typeof nodeStrokeWidth == "number" ? nodeStrokeWidth : void 0
|
|
28457
28425
|
}, className: cc(["react-flow__minimap", className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x2} ${y2} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [ariaLabel && jsx("title", { id: labelledBy, children: ariaLabel }), jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor, nodeStrokeColor, nodeBorderRadius, nodeClassName, nodeStrokeWidth, nodeComponent }), jsx("path", { className: "react-flow__minimap-mask", d: `M${x2 - offset2},${y2 - offset2}h${width + offset2 * 2}v${height + offset2 * 2}h${-width - offset2 * 2}z
|
|
28458
28426
|
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fillRule: "evenodd", pointerEvents: "none" })] }) });
|
|
28459
28427
|
}
|
|
28460
28428
|
MiniMapComponent.displayName = "MiniMap";
|
|
28461
28429
|
memo$2(MiniMapComponent);
|
|
28462
|
-
function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style: style2 = {}, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, shouldResize, onResizeStart, onResize, onResizeEnd }) {
|
|
28463
|
-
const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), defaultPosition = variant === ResizeControlVariant.Line ? "right" : "bottom-right", controlPosition = position ?? defaultPosition, resizer = useRef(null);
|
|
28430
|
+
function ResizeControl({ nodeId, position, variant = ResizeControlVariant$1.Handle, className, style: style2 = {}, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, shouldResize, onResizeStart, onResize, onResizeEnd }) {
|
|
28431
|
+
const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), defaultPosition = variant === ResizeControlVariant$1.Line ? "right" : "bottom-right", controlPosition = position ?? defaultPosition, resizer = useRef(null);
|
|
28464
28432
|
useEffect(() => {
|
|
28465
28433
|
if (!(!resizeControlRef.current || !id2))
|
|
28466
28434
|
return resizer.current || (resizer.current = XYResizer({
|
|
@@ -28524,11 +28492,15 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
28524
28492
|
}
|
|
28525
28493
|
triggerNodeChanges(changes);
|
|
28526
28494
|
},
|
|
28527
|
-
onEnd: () => {
|
|
28495
|
+
onEnd: ({ width, height }) => {
|
|
28528
28496
|
const dimensionChange = {
|
|
28529
28497
|
id: id2,
|
|
28530
28498
|
type: "dimensions",
|
|
28531
|
-
resizing: !1
|
|
28499
|
+
resizing: !1,
|
|
28500
|
+
dimensions: {
|
|
28501
|
+
width,
|
|
28502
|
+
height
|
|
28503
|
+
}
|
|
28532
28504
|
};
|
|
28533
28505
|
store.getState().triggerNodeChanges([dimensionChange]);
|
|
28534
28506
|
}
|
|
@@ -28560,7 +28532,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
28560
28532
|
onResizeEnd,
|
|
28561
28533
|
shouldResize
|
|
28562
28534
|
]);
|
|
28563
|
-
const positionClassNames = controlPosition.split("-"), colorStyleProp = variant === ResizeControlVariant.Line ? "borderColor" : "backgroundColor", controlStyle = color2 ? { ...style2, [colorStyleProp]: color2 } : style2;
|
|
28535
|
+
const positionClassNames = controlPosition.split("-"), colorStyleProp = variant === ResizeControlVariant$1.Line ? "borderColor" : "backgroundColor", controlStyle = color2 ? { ...style2, [colorStyleProp]: color2 } : style2;
|
|
28564
28536
|
return jsx("div", { className: cc(["react-flow__resize-control", "nodrag", ...positionClassNames, variant, className]), ref: resizeControlRef, style: controlStyle, children: children2 });
|
|
28565
28537
|
}
|
|
28566
28538
|
memo$2(ResizeControl);
|
|
@@ -28582,7 +28554,7 @@ const nodeEqualityFn = (a2, b2) => a2?.internals.positionAbsolute.x !== b2?.inte
|
|
|
28582
28554
|
zoom: state.transform[2],
|
|
28583
28555
|
selectedNodesCount: state.nodes.filter((node2) => node2.selected).length
|
|
28584
28556
|
});
|
|
28585
|
-
function NodeToolbar({ nodeId, children: children2, className, style: style2, isVisible, position = Position.Top, offset: offset2 = 10, align = "center", ...rest }) {
|
|
28557
|
+
function NodeToolbar({ nodeId, children: children2, className, style: style2, isVisible, position = Position$1.Top, offset: offset2 = 10, align = "center", ...rest }) {
|
|
28586
28558
|
const contextNodeId = useNodeId(), nodesSelector2 = useCallback((state) => (Array.isArray(nodeId) ? nodeId : [nodeId || contextNodeId || ""]).reduce((res, id2) => {
|
|
28587
28559
|
const node2 = state.nodeLookup.get(id2);
|
|
28588
28560
|
return node2 && res.set(node2.id, node2), res;
|
|
@@ -29850,6 +29822,165 @@ const useXYStoreApi = useStoreApi, useXYInternalNode = useInternalNode, selectZo
|
|
|
29850
29822
|
function useIsZoomTooSmall() {
|
|
29851
29823
|
return useStore$1(selectZoom);
|
|
29852
29824
|
}
|
|
29825
|
+
var ConnectionMode;
|
|
29826
|
+
(function(ConnectionMode2) {
|
|
29827
|
+
ConnectionMode2.Strict = "strict", ConnectionMode2.Loose = "loose";
|
|
29828
|
+
})(ConnectionMode || (ConnectionMode = {}));
|
|
29829
|
+
var PanOnScrollMode;
|
|
29830
|
+
(function(PanOnScrollMode2) {
|
|
29831
|
+
PanOnScrollMode2.Free = "free", PanOnScrollMode2.Vertical = "vertical", PanOnScrollMode2.Horizontal = "horizontal";
|
|
29832
|
+
})(PanOnScrollMode || (PanOnScrollMode = {}));
|
|
29833
|
+
var SelectionMode;
|
|
29834
|
+
(function(SelectionMode2) {
|
|
29835
|
+
SelectionMode2.Partial = "partial", SelectionMode2.Full = "full";
|
|
29836
|
+
})(SelectionMode || (SelectionMode = {}));
|
|
29837
|
+
var ConnectionLineType;
|
|
29838
|
+
(function(ConnectionLineType2) {
|
|
29839
|
+
ConnectionLineType2.Bezier = "default", ConnectionLineType2.Straight = "straight", ConnectionLineType2.Step = "step", ConnectionLineType2.SmoothStep = "smoothstep", ConnectionLineType2.SimpleBezier = "simplebezier";
|
|
29840
|
+
})(ConnectionLineType || (ConnectionLineType = {}));
|
|
29841
|
+
var MarkerType;
|
|
29842
|
+
(function(MarkerType2) {
|
|
29843
|
+
MarkerType2.Arrow = "arrow", MarkerType2.ArrowClosed = "arrowclosed";
|
|
29844
|
+
})(MarkerType || (MarkerType = {}));
|
|
29845
|
+
var Position;
|
|
29846
|
+
(function(Position2) {
|
|
29847
|
+
Position2.Left = "left", Position2.Top = "top", Position2.Right = "right", Position2.Bottom = "bottom";
|
|
29848
|
+
})(Position || (Position = {}));
|
|
29849
|
+
Position.Left + "", Position.Right, Position.Right + "", Position.Left, Position.Top + "", Position.Bottom, Position.Bottom + "", Position.Top;
|
|
29850
|
+
const isInternalNodeBase = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin = (node2, nodeOrigin = [0, 0]) => {
|
|
29851
|
+
const { width, height } = getNodeDimensions(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
|
|
29852
|
+
return {
|
|
29853
|
+
x: node2.position.x - offsetX,
|
|
29854
|
+
y: node2.position.y - offsetY
|
|
29855
|
+
};
|
|
29856
|
+
}, clamp = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), getBoundsOfBoxes = (box1, box2) => ({
|
|
29857
|
+
x: Math.min(box1.x, box2.x),
|
|
29858
|
+
y: Math.min(box1.y, box2.y),
|
|
29859
|
+
x2: Math.max(box1.x2, box2.x2),
|
|
29860
|
+
y2: Math.max(box1.y2, box2.y2)
|
|
29861
|
+
}), rectToBox = ({ x: x2, y: y2, width, height }) => ({
|
|
29862
|
+
x: x2,
|
|
29863
|
+
y: y2,
|
|
29864
|
+
x2: x2 + width,
|
|
29865
|
+
y2: y2 + height
|
|
29866
|
+
}), boxToRect = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
|
|
29867
|
+
x: x2,
|
|
29868
|
+
y: y2,
|
|
29869
|
+
width: x22 - x2,
|
|
29870
|
+
height: y22 - y2
|
|
29871
|
+
}), nodeToRect = (node2, nodeOrigin = [0, 0]) => {
|
|
29872
|
+
const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
|
|
29873
|
+
return {
|
|
29874
|
+
x: x2,
|
|
29875
|
+
y: y2,
|
|
29876
|
+
width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
|
|
29877
|
+
height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
|
|
29878
|
+
};
|
|
29879
|
+
}, getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2))), rendererPointToPoint = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
|
|
29880
|
+
x: x2 * tScale + tx,
|
|
29881
|
+
y: y2 * tScale + ty
|
|
29882
|
+
});
|
|
29883
|
+
function parsePadding(padding, viewport) {
|
|
29884
|
+
return Math.floor(viewport - viewport / (1 + padding));
|
|
29885
|
+
}
|
|
29886
|
+
function parsePaddings(padding, width, height) {
|
|
29887
|
+
{
|
|
29888
|
+
const paddingY = parsePadding(padding, height), paddingX = parsePadding(padding, width);
|
|
29889
|
+
return {
|
|
29890
|
+
top: paddingY,
|
|
29891
|
+
right: paddingX,
|
|
29892
|
+
bottom: paddingY,
|
|
29893
|
+
left: paddingX,
|
|
29894
|
+
x: paddingX * 2,
|
|
29895
|
+
y: paddingY * 2
|
|
29896
|
+
};
|
|
29897
|
+
}
|
|
29898
|
+
}
|
|
29899
|
+
function calculateAppliedPaddings(bounds, x2, y2, zoom2, width, height) {
|
|
29900
|
+
const { x: left, y: top } = rendererPointToPoint(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
|
|
29901
|
+
return {
|
|
29902
|
+
left: Math.floor(left),
|
|
29903
|
+
top: Math.floor(top),
|
|
29904
|
+
right: Math.floor(right),
|
|
29905
|
+
bottom: Math.floor(bottom)
|
|
29906
|
+
};
|
|
29907
|
+
}
|
|
29908
|
+
const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
|
|
29909
|
+
const p2 = parsePaddings(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings(bounds, x2, y2, clampedZoom, width, height), offset2 = {
|
|
29910
|
+
left: Math.min(newPadding.left - p2.left, 0),
|
|
29911
|
+
top: Math.min(newPadding.top - p2.top, 0),
|
|
29912
|
+
right: Math.min(newPadding.right - p2.right, 0),
|
|
29913
|
+
bottom: Math.min(newPadding.bottom - p2.bottom, 0)
|
|
29914
|
+
};
|
|
29915
|
+
return {
|
|
29916
|
+
x: x2 - offset2.left + offset2.right,
|
|
29917
|
+
y: y2 - offset2.top + offset2.bottom,
|
|
29918
|
+
zoom: clampedZoom
|
|
29919
|
+
};
|
|
29920
|
+
}, isMacOs = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
|
|
29921
|
+
function getNodeDimensions(node2) {
|
|
29922
|
+
return {
|
|
29923
|
+
width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
|
|
29924
|
+
height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
|
|
29925
|
+
};
|
|
29926
|
+
}
|
|
29927
|
+
function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
|
|
29928
|
+
const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125, centerY2 = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125, offsetX = Math.abs(centerX - sourceX), offsetY = Math.abs(centerY2 - sourceY);
|
|
29929
|
+
return [centerX, centerY2, offsetX, offsetY];
|
|
29930
|
+
}
|
|
29931
|
+
function calculateControlOffset(distance2, curvature) {
|
|
29932
|
+
return distance2 >= 0 ? 0.5 * distance2 : curvature * 25 * Math.sqrt(-distance2);
|
|
29933
|
+
}
|
|
29934
|
+
function getControlWithCurvature({ pos, x1, y1, x2, y2, c: c2 }) {
|
|
29935
|
+
switch (pos) {
|
|
29936
|
+
case Position.Left:
|
|
29937
|
+
return [x1 - calculateControlOffset(x1 - x2, c2), y1];
|
|
29938
|
+
case Position.Right:
|
|
29939
|
+
return [x1 + calculateControlOffset(x2 - x1, c2), y1];
|
|
29940
|
+
case Position.Top:
|
|
29941
|
+
return [x1, y1 - calculateControlOffset(y1 - y2, c2)];
|
|
29942
|
+
case Position.Bottom:
|
|
29943
|
+
return [x1, y1 + calculateControlOffset(y2 - y1, c2)];
|
|
29944
|
+
}
|
|
29945
|
+
}
|
|
29946
|
+
function getBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
|
|
29947
|
+
const [sourceControlX, sourceControlY] = getControlWithCurvature({
|
|
29948
|
+
pos: sourcePosition,
|
|
29949
|
+
x1: sourceX,
|
|
29950
|
+
y1: sourceY,
|
|
29951
|
+
x2: targetX,
|
|
29952
|
+
y2: targetY,
|
|
29953
|
+
c: curvature
|
|
29954
|
+
}), [targetControlX, targetControlY] = getControlWithCurvature({
|
|
29955
|
+
pos: targetPosition,
|
|
29956
|
+
x1: targetX,
|
|
29957
|
+
y1: targetY,
|
|
29958
|
+
x2: sourceX,
|
|
29959
|
+
y2: sourceY,
|
|
29960
|
+
c: curvature
|
|
29961
|
+
}), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
|
|
29962
|
+
sourceX,
|
|
29963
|
+
sourceY,
|
|
29964
|
+
targetX,
|
|
29965
|
+
targetY,
|
|
29966
|
+
sourceControlX,
|
|
29967
|
+
sourceControlY,
|
|
29968
|
+
targetControlX,
|
|
29969
|
+
targetControlY
|
|
29970
|
+
});
|
|
29971
|
+
return [
|
|
29972
|
+
`M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`,
|
|
29973
|
+
labelX,
|
|
29974
|
+
labelY,
|
|
29975
|
+
offsetX,
|
|
29976
|
+
offsetY
|
|
29977
|
+
];
|
|
29978
|
+
}
|
|
29979
|
+
Position.Left + "", Position.Right + "", Position.Top + "", Position.Bottom + "";
|
|
29980
|
+
var ResizeControlVariant;
|
|
29981
|
+
(function(ResizeControlVariant2) {
|
|
29982
|
+
ResizeControlVariant2.Line = "line", ResizeControlVariant2.Handle = "handle";
|
|
29983
|
+
})(ResizeControlVariant || (ResizeControlVariant = {}));
|
|
29853
29984
|
const { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
|
|
29854
29985
|
function crt(v) {
|
|
29855
29986
|
return v < 0 ? -pow(-v, 1 / 3) : pow(v, 1 / 3);
|
|
@@ -35683,14 +35814,13 @@ const EdgePath = forwardRef(({
|
|
|
35683
35814
|
alignItems: "center"
|
|
35684
35815
|
});
|
|
35685
35816
|
function ElementActionButtons({
|
|
35686
|
-
id: id2,
|
|
35687
35817
|
selected: selected2 = !1,
|
|
35688
35818
|
data: {
|
|
35689
35819
|
hovered: isHovered = !1
|
|
35690
35820
|
},
|
|
35691
35821
|
buttons: buttons2
|
|
35692
35822
|
}) {
|
|
35693
|
-
const zoomTooSmall = useIsZoomTooSmall();
|
|
35823
|
+
const id2 = useId$1(), zoomTooSmall = useIsZoomTooSmall();
|
|
35694
35824
|
return !buttons2.length || zoomTooSmall ? null : /* @__PURE__ */ jsx(Box$1, { className: container$4, children: /* @__PURE__ */ jsx(
|
|
35695
35825
|
Box$1,
|
|
35696
35826
|
{
|
|
@@ -35723,9 +35853,10 @@ function ElementActionButtons({
|
|
|
35723
35853
|
onDoubleClick: stopPropagation$1,
|
|
35724
35854
|
children: button2.icon
|
|
35725
35855
|
},
|
|
35726
|
-
|
|
35856
|
+
`${id2}-${button2.key ?? index2}`
|
|
35727
35857
|
))
|
|
35728
|
-
}
|
|
35858
|
+
},
|
|
35859
|
+
`${id2}-action-buttons`
|
|
35729
35860
|
) });
|
|
35730
35861
|
}
|
|
35731
35862
|
const container$3 = css({
|
|
@@ -35757,11 +35888,13 @@ function ElementDetailsButton({
|
|
|
35757
35888
|
icon: icon2,
|
|
35758
35889
|
onClick
|
|
35759
35890
|
}) {
|
|
35891
|
+
const id2 = useId$1();
|
|
35760
35892
|
return /* @__PURE__ */ jsx(Box$1, { className: cx(container$3, "details-button"), children: /* @__PURE__ */ jsx(
|
|
35761
35893
|
ActionIcon$1,
|
|
35762
35894
|
{
|
|
35763
35895
|
className: cx("nodrag nopan", actionBtn$1({ variant: "transparent" })),
|
|
35764
35896
|
component: m$2.button,
|
|
35897
|
+
layout: !0,
|
|
35765
35898
|
initial: !1,
|
|
35766
35899
|
style: {
|
|
35767
35900
|
originX: 0.45,
|
|
@@ -35782,7 +35915,8 @@ function ElementDetailsButton({
|
|
|
35782
35915
|
onClick,
|
|
35783
35916
|
onDoubleClick: stopPropagation$1,
|
|
35784
35917
|
children: icon2 ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
|
|
35785
|
-
}
|
|
35918
|
+
},
|
|
35919
|
+
id2
|
|
35786
35920
|
) });
|
|
35787
35921
|
}
|
|
35788
35922
|
const container$2 = css({
|
|
@@ -36425,8 +36559,8 @@ const style = {
|
|
|
36425
36559
|
left: "50%",
|
|
36426
36560
|
visibility: "hidden"
|
|
36427
36561
|
}, DefaultHandles = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
36428
|
-
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style }),
|
|
36429
|
-
/* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, style })
|
|
36562
|
+
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position$1.Top, style }),
|
|
36563
|
+
/* @__PURE__ */ jsx(Handle, { type: "source", position: Position$1.Bottom, style })
|
|
36430
36564
|
] });
|
|
36431
36565
|
class VectorImpl {
|
|
36432
36566
|
constructor(x2, y2) {
|
|
@@ -37104,7 +37238,17 @@ const curve = d3line().curve(curveCatmullRomOpen).x((d2) => d2.x).y((d2) => d2.y
|
|
|
37104
37238
|
}
|
|
37105
37239
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
37106
37240
|
/* @__PURE__ */ jsxs(EdgeContainer, { ...props, className: clsx(isControlPointDragging && controlDragging), children: [
|
|
37107
|
-
/* @__PURE__ */ jsx(
|
|
37241
|
+
/* @__PURE__ */ jsx(
|
|
37242
|
+
EdgePath,
|
|
37243
|
+
{
|
|
37244
|
+
...props,
|
|
37245
|
+
svgPath: edgePath,
|
|
37246
|
+
ref: svgPathRef,
|
|
37247
|
+
...enableEdgeEditing && {
|
|
37248
|
+
onEdgePointerDown
|
|
37249
|
+
}
|
|
37250
|
+
}
|
|
37251
|
+
),
|
|
37108
37252
|
/* @__PURE__ */ jsx(
|
|
37109
37253
|
EdgeLabelContainer,
|
|
37110
37254
|
{
|
|
@@ -38525,7 +38669,7 @@ const ElementDetailsButtonWithHandler$1 = (props) => {
|
|
|
38525
38669
|
);
|
|
38526
38670
|
}, ElementNode$1 = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { component: m$2.div, layoutId: props.id, nodeProps: props, children: [
|
|
38527
38671
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
38528
|
-
/* @__PURE__ */ jsx(ElementTitle, { ...props
|
|
38672
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
38529
38673
|
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler$1, { ...props }),
|
|
38530
38674
|
/* @__PURE__ */ jsx(ElementActions$1, { ...props }),
|
|
38531
38675
|
/* @__PURE__ */ jsx(ElementPorts$1, { ...props })
|
|
@@ -42426,22 +42570,6 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
|
|
|
42426
42570
|
xl: {
|
|
42427
42571
|
[offset]: "4rem"
|
|
42428
42572
|
}
|
|
42429
|
-
// inset: '[calc(2rem + var(--_level, 0) * 1rem), 2rem, 2rem, 2rem]',
|
|
42430
|
-
// width: 'calc(100vw - 4rem)',
|
|
42431
|
-
// height: 'calc(100vh - 4rem - var(--_level, 0) * 1rem)',
|
|
42432
|
-
// },
|
|
42433
|
-
// lg: {
|
|
42434
|
-
// inset: '[calc(4rem + var(--_level, 0) * 1rem), 4rem, 4rem, 4rem]',
|
|
42435
|
-
// width: 'calc(100vw - 8rem)',
|
|
42436
|
-
// height: 'calc(100vh - 8rem)',
|
|
42437
|
-
// },
|
|
42438
|
-
// xl: {
|
|
42439
|
-
// [borderRadius]: '8px',
|
|
42440
|
-
// padding: '8px',
|
|
42441
|
-
// inset: '[calc(5rem + var(--_level, 0) * 1rem), 5rem, 5rem, 5rem]',
|
|
42442
|
-
// width: 'calc(100vw - 10rem)',
|
|
42443
|
-
// height: 'calc(100vh - 10rem - var(--_level, 0) * 1rem)',
|
|
42444
|
-
// },
|
|
42445
42573
|
}), body = css.raw({
|
|
42446
42574
|
position: "relative",
|
|
42447
42575
|
containerName: "overlay-dialog",
|
|
@@ -42459,106 +42587,91 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
|
|
|
42459
42587
|
base: {
|
|
42460
42588
|
dialog,
|
|
42461
42589
|
body
|
|
42462
|
-
}
|
|
42463
|
-
|
|
42464
|
-
|
|
42465
|
-
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
-
|
|
42590
|
+
}
|
|
42591
|
+
}), Overlay = forwardRef(({
|
|
42592
|
+
onClose,
|
|
42593
|
+
className,
|
|
42594
|
+
classes: classes2,
|
|
42595
|
+
overlayLevel = 0,
|
|
42596
|
+
children: children2,
|
|
42597
|
+
...rest
|
|
42598
|
+
}, ref) => {
|
|
42599
|
+
const [opened, setOpened] = useState(!1), dialogRef = useRef(null), isClosingRef = useRef(!1), motionNotReduced = useReducedMotionConfig() !== !0, onCloseRef = useSyncedRef(onClose), close = useDebouncedCallback(
|
|
42600
|
+
() => {
|
|
42601
|
+
isClosingRef.current || (isClosingRef.current = !0, onCloseRef.current());
|
|
42602
|
+
},
|
|
42603
|
+
[],
|
|
42604
|
+
50
|
|
42605
|
+
);
|
|
42606
|
+
useEffect(() => {
|
|
42607
|
+
const cancel = (e2) => {
|
|
42608
|
+
e2.preventDefault(), close();
|
|
42609
|
+
};
|
|
42610
|
+
return dialogRef.current?.addEventListener("cancel", cancel, { capture: !0 }), () => {
|
|
42611
|
+
dialogRef.current?.removeEventListener("cancel", cancel, { capture: !0 });
|
|
42612
|
+
};
|
|
42613
|
+
}, []), useTimeoutEffect(() => {
|
|
42614
|
+
dialogRef.current?.open || dialogRef.current?.showModal();
|
|
42615
|
+
}, 30), useTimeoutEffect(() => {
|
|
42616
|
+
setOpened(!0);
|
|
42617
|
+
}, 120);
|
|
42618
|
+
const styles = overlay({
|
|
42619
|
+
level: overlayLevel
|
|
42620
|
+
});
|
|
42621
|
+
return /* @__PURE__ */ jsx(
|
|
42622
|
+
m$2.dialog,
|
|
42623
|
+
{
|
|
42624
|
+
ref: useMergedRef(dialogRef, ref),
|
|
42625
|
+
className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes2?.dialog, className),
|
|
42626
|
+
layout: !0,
|
|
42627
|
+
style: {
|
|
42628
|
+
// @ts-ignore
|
|
42629
|
+
[level]: overlayLevel
|
|
42469
42630
|
},
|
|
42470
|
-
|
|
42471
|
-
|
|
42472
|
-
[
|
|
42631
|
+
...motionNotReduced ? {
|
|
42632
|
+
initial: {
|
|
42633
|
+
[backdropBlur]: "0px",
|
|
42634
|
+
[backdropOpacity]: "0%",
|
|
42635
|
+
scale: overlayLevel > 0 ? 0.9 : 1.075,
|
|
42636
|
+
opacity: 0
|
|
42637
|
+
},
|
|
42638
|
+
animate: {
|
|
42639
|
+
[backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
|
|
42640
|
+
[backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
|
|
42641
|
+
scale: 1,
|
|
42642
|
+
opacity: 1,
|
|
42643
|
+
transition: {
|
|
42644
|
+
delay: 0.075
|
|
42645
|
+
}
|
|
42646
|
+
},
|
|
42647
|
+
exit: {
|
|
42648
|
+
scale: 1.2,
|
|
42649
|
+
opacity: 0,
|
|
42650
|
+
[backdropBlur]: "0px",
|
|
42651
|
+
[backdropOpacity]: "0%"
|
|
42473
42652
|
}
|
|
42474
|
-
}
|
|
42475
|
-
|
|
42476
|
-
|
|
42477
|
-
[
|
|
42653
|
+
} : {
|
|
42654
|
+
initial: {
|
|
42655
|
+
[backdropBlur]: "8px",
|
|
42656
|
+
[backdropOpacity]: "60%"
|
|
42478
42657
|
}
|
|
42479
42658
|
},
|
|
42480
|
-
|
|
42481
|
-
|
|
42482
|
-
|
|
42659
|
+
onClick: (e2) => {
|
|
42660
|
+
if (e2.stopPropagation(), e2.target?.nodeName?.toUpperCase() === "DIALOG") {
|
|
42661
|
+
dialogRef.current?.close();
|
|
42662
|
+
return;
|
|
42483
42663
|
}
|
|
42484
|
-
}
|
|
42485
|
-
}
|
|
42486
|
-
}
|
|
42487
|
-
}), Overlay = forwardRef(
|
|
42488
|
-
({ children: children2, onClose, className, classes: classes2, overlayLevel = 0, ...rest }, ref) => {
|
|
42489
|
-
const [opened, setOpened] = useState(!1), dialogRef = useRef(null), isClosingRef = useRef(!1), motionNotReduced = useReducedMotionConfig() !== !0, onCloseRef = useSyncedRef(onClose), close = useDebouncedCallback(
|
|
42490
|
-
() => {
|
|
42491
|
-
isClosingRef.current || (isClosingRef.current = !0, onCloseRef.current());
|
|
42492
42664
|
},
|
|
42493
|
-
|
|
42494
|
-
|
|
42495
|
-
|
|
42496
|
-
|
|
42497
|
-
|
|
42498
|
-
|
|
42499
|
-
}
|
|
42500
|
-
|
|
42501
|
-
|
|
42502
|
-
|
|
42503
|
-
}, []), useTimeoutEffect(() => {
|
|
42504
|
-
dialogRef.current?.open || dialogRef.current?.showModal();
|
|
42505
|
-
}, 20), useTimeoutEffect(() => {
|
|
42506
|
-
setOpened(!0);
|
|
42507
|
-
}, 120);
|
|
42508
|
-
const styles = overlay({
|
|
42509
|
-
level: overlayLevel
|
|
42510
|
-
});
|
|
42511
|
-
return /* @__PURE__ */ jsx(
|
|
42512
|
-
m$2.dialog,
|
|
42513
|
-
{
|
|
42514
|
-
ref: useMergedRef(dialogRef, ref),
|
|
42515
|
-
className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes2?.dialog, className),
|
|
42516
|
-
layout: !0,
|
|
42517
|
-
...motionNotReduced ? {
|
|
42518
|
-
initial: {
|
|
42519
|
-
[backdropBlur]: "0px",
|
|
42520
|
-
[backdropOpacity]: "0%",
|
|
42521
|
-
scale: overlayLevel > 0 ? 0.9 : 1.075,
|
|
42522
|
-
opacity: 0
|
|
42523
|
-
},
|
|
42524
|
-
animate: {
|
|
42525
|
-
[backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
|
|
42526
|
-
[backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
|
|
42527
|
-
scale: 1,
|
|
42528
|
-
opacity: 1,
|
|
42529
|
-
transition: {
|
|
42530
|
-
delay: 0.075
|
|
42531
|
-
}
|
|
42532
|
-
},
|
|
42533
|
-
exit: {
|
|
42534
|
-
scale: 1.2,
|
|
42535
|
-
opacity: 0,
|
|
42536
|
-
[backdropBlur]: "0px",
|
|
42537
|
-
[backdropOpacity]: "0%"
|
|
42538
|
-
}
|
|
42539
|
-
} : {
|
|
42540
|
-
initial: {
|
|
42541
|
-
[backdropBlur]: "8px",
|
|
42542
|
-
[backdropOpacity]: "60%"
|
|
42543
|
-
}
|
|
42544
|
-
},
|
|
42545
|
-
onClick: (e2) => {
|
|
42546
|
-
if (e2.stopPropagation(), e2.target?.nodeName?.toUpperCase() === "DIALOG") {
|
|
42547
|
-
dialogRef.current?.close();
|
|
42548
|
-
return;
|
|
42549
|
-
}
|
|
42550
|
-
},
|
|
42551
|
-
onDoubleClick: stopPropagation$1,
|
|
42552
|
-
onPointerDown: stopPropagation$1,
|
|
42553
|
-
onClose: (e2) => {
|
|
42554
|
-
e2.stopPropagation(), close();
|
|
42555
|
-
},
|
|
42556
|
-
...rest,
|
|
42557
|
-
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, removeScrollBar: !1, children: /* @__PURE__ */ jsx(Box$1, { className: cx(styles.body, "overlay-body", classes2?.body), children: opened && /* @__PURE__ */ jsx(Fragment$1, { children: children2 }) }) })
|
|
42558
|
-
}
|
|
42559
|
-
);
|
|
42560
|
-
}
|
|
42561
|
-
);
|
|
42665
|
+
onDoubleClick: stopPropagation$1,
|
|
42666
|
+
onPointerDown: stopPropagation$1,
|
|
42667
|
+
onClose: (e2) => {
|
|
42668
|
+
e2.stopPropagation(), close();
|
|
42669
|
+
},
|
|
42670
|
+
...rest,
|
|
42671
|
+
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, removeScrollBar: !1, children: /* @__PURE__ */ jsx(Box$1, { className: cx(styles.body, "overlay-body", classes2?.body), children: opened && /* @__PURE__ */ jsx(Fragment$1, { children: children2 }) }) })
|
|
42672
|
+
}
|
|
42673
|
+
);
|
|
42674
|
+
});
|
|
42562
42675
|
Overlay.displayName = "Overlay";
|
|
42563
42676
|
var xstate_cjsExports = /* @__PURE__ */ requireXstate_cjs();
|
|
42564
42677
|
function _update$1(current, update) {
|
|
@@ -43518,7 +43631,7 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
|
|
|
43518
43631
|
invariant$2(xyflow2, "xyflow is not initialized"), invariant$2(xystore, "xystore is not initialized"), bounds ??= context2.bounds;
|
|
43519
43632
|
const maxZoom = Math.max(xyflow2.getZoom(), 1);
|
|
43520
43633
|
if (bounds) {
|
|
43521
|
-
const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, 0.1);
|
|
43634
|
+
const { width, height } = xystore.getState(), viewport = getViewportForBounds$1(bounds, width, height, MinZoom, maxZoom, 0.1);
|
|
43522
43635
|
xyflow2.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
43523
43636
|
} else
|
|
43524
43637
|
xyflow2.fitView({
|
|
@@ -43733,7 +43846,9 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
|
|
|
43733
43846
|
}
|
|
43734
43847
|
}), hotkeyLogic = xstate_cjsExports.fromCallback(({ sendBack }) => {
|
|
43735
43848
|
const handler = getHotkeyHandler([
|
|
43736
|
-
["Escape", () =>
|
|
43849
|
+
["Escape", (event) => {
|
|
43850
|
+
event.stopPropagation(), sendBack({ type: "close" });
|
|
43851
|
+
}, {
|
|
43737
43852
|
preventDefault: !0
|
|
43738
43853
|
}]
|
|
43739
43854
|
]);
|
|
@@ -44083,7 +44198,7 @@ const RelationshipEdge = customEdge((props) => {
|
|
|
44083
44198
|
);
|
|
44084
44199
|
}, ElementNode = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
44085
44200
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
44086
|
-
/* @__PURE__ */ jsx(ElementTitle, { ...props
|
|
44201
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
44087
44202
|
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
44088
44203
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
44089
44204
|
/* @__PURE__ */ jsx(ElementPorts, { ...props })
|
|
@@ -44597,7 +44712,7 @@ const selectOverlays = (s2) => s2.context.overlays.map((overlay2) => {
|
|
|
44597
44712
|
return /* @__PURE__ */ jsx(
|
|
44598
44713
|
Overlay,
|
|
44599
44714
|
{
|
|
44600
|
-
overlayLevel:
|
|
44715
|
+
overlayLevel: index2,
|
|
44601
44716
|
onClose: () => close(overlay2.actorRef),
|
|
44602
44717
|
children: /* @__PURE__ */ jsx(RelationshipsBrowser, { actorRef: overlay2.actorRef })
|
|
44603
44718
|
},
|
|
@@ -44607,7 +44722,7 @@ const selectOverlays = (s2) => s2.context.overlays.map((overlay2) => {
|
|
|
44607
44722
|
return /* @__PURE__ */ jsx(
|
|
44608
44723
|
Overlay,
|
|
44609
44724
|
{
|
|
44610
|
-
overlayLevel:
|
|
44725
|
+
overlayLevel: index2,
|
|
44611
44726
|
onClose: () => close(overlay2.actorRef),
|
|
44612
44727
|
children: /* @__PURE__ */ jsx(RelationshipDetails, { actorRef: overlay2.actorRef })
|
|
44613
44728
|
},
|
|
@@ -47973,14 +48088,20 @@ function updateActiveWalkthrough({ context: context2 }) {
|
|
|
47973
48088
|
}
|
|
47974
48089
|
const hotkeyActorLogic = xstate_cjsExports.fromCallback(({ sendBack }) => {
|
|
47975
48090
|
const escHandler = getHotkeyHandler([
|
|
47976
|
-
["Escape", () =>
|
|
48091
|
+
["Escape", (event) => {
|
|
48092
|
+
event.stopPropagation(), sendBack({ type: "key.esc" });
|
|
48093
|
+
}, {
|
|
47977
48094
|
preventDefault: !0
|
|
47978
48095
|
}]
|
|
47979
48096
|
]), arrowshandler = getHotkeyHandler([
|
|
47980
|
-
["ArrowLeft", () =>
|
|
48097
|
+
["ArrowLeft", (event) => {
|
|
48098
|
+
event.stopPropagation(), sendBack({ type: "key.arrow.left" });
|
|
48099
|
+
}, {
|
|
47981
48100
|
preventDefault: !0
|
|
47982
48101
|
}],
|
|
47983
|
-
["ArrowRight", () =>
|
|
48102
|
+
["ArrowRight", (event) => {
|
|
48103
|
+
event.stopPropagation(), sendBack({ type: "key.arrow.right" });
|
|
48104
|
+
}, {
|
|
47984
48105
|
preventDefault: !0
|
|
47985
48106
|
}]
|
|
47986
48107
|
]);
|
|
@@ -48190,7 +48311,7 @@ const diagramMachine = xstate_cjsExports.setup({
|
|
|
48190
48311
|
const {
|
|
48191
48312
|
bounds = context2.view.bounds,
|
|
48192
48313
|
duration = 450
|
|
48193
|
-
} = params ?? {}, { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds(
|
|
48314
|
+
} = params ?? {}, { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds$1(
|
|
48194
48315
|
bounds,
|
|
48195
48316
|
width,
|
|
48196
48317
|
height,
|
|
@@ -48201,7 +48322,7 @@ const diagramMachine = xstate_cjsExports.setup({
|
|
|
48201
48322
|
viewport.x = Math.round(viewport.x), viewport.y = Math.round(viewport.y), panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
48202
48323
|
},
|
|
48203
48324
|
"xyflow:fitFocusedBounds": ({ context: context2 }) => {
|
|
48204
|
-
const { bounds, duration = 450 } = focusedBounds({ context: context2 }), { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds(
|
|
48325
|
+
const { bounds, duration = 450 } = focusedBounds({ context: context2 }), { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds$1(
|
|
48205
48326
|
bounds,
|
|
48206
48327
|
width,
|
|
48207
48328
|
height,
|