@1urso/generic-editor 0.1.64 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generic-editor.js +1271 -1164
- package/dist/generic-editor.umd.cjs +17 -17
- package/dist/index.d.ts +2 -4
- package/dist/{editor → src/editor}/context.d.ts +6 -5
- package/dist/{editor → src/editor}/types.d.ts +2 -2
- package/dist/src/editor/utils/helpers.d.ts +3 -0
- package/dist/{editor → src/editor}/utils/htmlGenerator.d.ts +2 -1
- package/dist/{editor → src/editor}/utils/layoutEngine.d.ts +2 -1
- package/dist/src/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/editor/utils/helpers.d.ts +0 -3
- /package/dist/{App.d.ts → src/App.d.ts} +0 -0
- /package/dist/{editor → src/editor}/components/AlignmentToolbar.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/AssetsPanel.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/Canvas.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ColorPicker.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/DraggableElement.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/EditorSettings.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ElementAdvancedSettings.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ElementContextMenu.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ExportDialog.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/HistoryPanel.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/LayersPanel.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/Minimap.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/Preview.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/Ruler.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ShortcutsDialog.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/SmartGuides.d.ts +0 -0
- /package/dist/{editor → src/editor}/components/ViewToolbar.d.ts +0 -0
- /package/dist/{editor → src/editor}/index.d.ts +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
package/dist/generic-editor.js
CHANGED
|
@@ -987,15 +987,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
987
987
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
988
988
|
branches: /* @__PURE__ */ new Set()
|
|
989
989
|
}), DismissableLayer = React$1.forwardRef((_, E) => {
|
|
990
|
-
let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)),
|
|
990
|
+
let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)), GF = Array.from(B.layers), [KF] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), qF = GF.indexOf(KF), JF = H ? GF.indexOf(H) : -1, YF = B.layersWithOutsidePointerEventsDisabled.size > 0, XF = JF >= qF, ZF = usePointerDownOutside((n) => {
|
|
991
991
|
let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
|
|
992
|
-
!
|
|
993
|
-
}, W),
|
|
992
|
+
!XF || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
993
|
+
}, W), QF = useFocusOutside((n) => {
|
|
994
994
|
let _ = n.target;
|
|
995
995
|
[...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
996
996
|
}, W);
|
|
997
997
|
return useEscapeKeydown((n) => {
|
|
998
|
-
|
|
998
|
+
JF === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
|
|
999
999
|
}, W), React$1.useEffect(() => {
|
|
1000
1000
|
if (H) return O && (B.layersWithOutsidePointerEventsDisabled.size === 0 && (originalBodyPointerEvents = W.body.style.pointerEvents, W.body.style.pointerEvents = "none"), B.layersWithOutsidePointerEventsDisabled.add(H)), B.layers.add(H), dispatchUpdate(), () => {
|
|
1001
1001
|
O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -1014,12 +1014,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
1014
1014
|
...z,
|
|
1015
1015
|
ref: Z,
|
|
1016
1016
|
style: {
|
|
1017
|
-
pointerEvents:
|
|
1017
|
+
pointerEvents: YF ? XF ? "auto" : "none" : void 0,
|
|
1018
1018
|
..._.style
|
|
1019
1019
|
},
|
|
1020
|
-
onFocusCapture: composeEventHandlers(_.onFocusCapture,
|
|
1021
|
-
onBlurCapture: composeEventHandlers(_.onBlurCapture,
|
|
1022
|
-
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture,
|
|
1020
|
+
onFocusCapture: composeEventHandlers(_.onFocusCapture, QF.onFocusCapture),
|
|
1021
|
+
onBlurCapture: composeEventHandlers(_.onBlurCapture, QF.onBlurCapture),
|
|
1022
|
+
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, ZF.onPointerDownCapture)
|
|
1023
1023
|
});
|
|
1024
1024
|
});
|
|
1025
1025
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -1378,7 +1378,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1378
1378
|
onScrollCapture: nothing,
|
|
1379
1379
|
onWheelCapture: nothing,
|
|
1380
1380
|
onTouchMoveCapture: nothing
|
|
1381
|
-
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation,
|
|
1381
|
+
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, GF = _.inert, KF = _.allowPinchZoom, qF = _.as, JF = qF === void 0 ? "div" : qF, YF = _.gapMode, XF = __rest(_, [
|
|
1382
1382
|
"forwardProps",
|
|
1383
1383
|
"children",
|
|
1384
1384
|
"className",
|
|
@@ -1392,21 +1392,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1392
1392
|
"allowPinchZoom",
|
|
1393
1393
|
"as",
|
|
1394
1394
|
"gapMode"
|
|
1395
|
-
]),
|
|
1396
|
-
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(
|
|
1395
|
+
]), ZF = W, QF = useMergeRefs([O, E]), $F = __assign$2(__assign$2({}, XF), j);
|
|
1396
|
+
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(ZF, {
|
|
1397
1397
|
sideCar: effectCar,
|
|
1398
1398
|
removeScrollBar: B,
|
|
1399
1399
|
shards: U,
|
|
1400
1400
|
noRelative: G,
|
|
1401
1401
|
noIsolation: Z,
|
|
1402
|
-
inert:
|
|
1402
|
+
inert: GF,
|
|
1403
1403
|
setCallbacks: M,
|
|
1404
|
-
allowPinchZoom: !!
|
|
1404
|
+
allowPinchZoom: !!KF,
|
|
1405
1405
|
lockRef: O,
|
|
1406
|
-
gapMode:
|
|
1407
|
-
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({},
|
|
1406
|
+
gapMode: YF
|
|
1407
|
+
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, $F), { ref: QF })) : React$1.createElement(JF, __assign$2({}, $F, {
|
|
1408
1408
|
className: z,
|
|
1409
|
-
ref:
|
|
1409
|
+
ref: QF
|
|
1410
1410
|
}), P));
|
|
1411
1411
|
});
|
|
1412
1412
|
RemoveScroll.defaultProps = {
|
|
@@ -1596,8 +1596,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1596
1596
|
if (!N) break;
|
|
1597
1597
|
var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
|
|
1598
1598
|
(G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
|
|
1599
|
-
var
|
|
1600
|
-
N =
|
|
1599
|
+
var GF = N.parentNode;
|
|
1600
|
+
N = GF && GF.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? GF.host : GF;
|
|
1601
1601
|
} while (!P && N !== document.body || P && (_.contains(N) || _ === N));
|
|
1602
1602
|
return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
|
|
1603
1603
|
}, getTouchXY = function(n) {
|
|
@@ -2144,7 +2144,7 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
2144
2144
|
strategy: A
|
|
2145
2145
|
}), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
|
|
2146
2146
|
for (let E = 0; E < N.length; E++) {
|
|
2147
|
-
let { name: j, fn: Z } = N[E], { x:
|
|
2147
|
+
let { name: j, fn: Z } = N[E], { x: GF, y: KF, data: qF, reset: JF } = await Z({
|
|
2148
2148
|
x: B,
|
|
2149
2149
|
y: H,
|
|
2150
2150
|
initialPlacement: O,
|
|
@@ -2158,17 +2158,17 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
2158
2158
|
floating: _
|
|
2159
2159
|
}
|
|
2160
2160
|
});
|
|
2161
|
-
B =
|
|
2161
|
+
B = GF ?? B, H = KF ?? H, W = {
|
|
2162
2162
|
...W,
|
|
2163
2163
|
[j]: {
|
|
2164
2164
|
...W[j],
|
|
2165
|
-
...
|
|
2165
|
+
...qF
|
|
2166
2166
|
}
|
|
2167
|
-
},
|
|
2167
|
+
}, JF && G <= 50 && (G++, typeof JF == "object" && (JF.placement && (U = JF.placement), JF.rects && (z = JF.rects === !0 ? await M.getElementRects({
|
|
2168
2168
|
reference: n,
|
|
2169
2169
|
floating: _,
|
|
2170
2170
|
strategy: A
|
|
2171
|
-
}) :
|
|
2171
|
+
}) : JF.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
|
|
2172
2172
|
}
|
|
2173
2173
|
return {
|
|
2174
2174
|
x: B,
|
|
@@ -2185,25 +2185,25 @@ async function detectOverflow$1(n, _) {
|
|
|
2185
2185
|
boundary: P,
|
|
2186
2186
|
rootBoundary: z,
|
|
2187
2187
|
strategy: N
|
|
2188
|
-
})),
|
|
2188
|
+
})), GF = B === "floating" ? {
|
|
2189
2189
|
x: E,
|
|
2190
2190
|
y: O,
|
|
2191
2191
|
width: j.floating.width,
|
|
2192
2192
|
height: j.floating.height
|
|
2193
|
-
} : j.reference,
|
|
2193
|
+
} : j.reference, KF = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), qF = await (A.isElement == null ? void 0 : A.isElement(KF)) && await (A.getScale == null ? void 0 : A.getScale(KF)) || {
|
|
2194
2194
|
x: 1,
|
|
2195
2195
|
y: 1
|
|
2196
|
-
},
|
|
2196
|
+
}, JF = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2197
2197
|
elements: M,
|
|
2198
|
-
rect:
|
|
2199
|
-
offsetParent:
|
|
2198
|
+
rect: GF,
|
|
2199
|
+
offsetParent: KF,
|
|
2200
2200
|
strategy: N
|
|
2201
|
-
}) :
|
|
2201
|
+
}) : GF);
|
|
2202
2202
|
return {
|
|
2203
|
-
top: (Z.top -
|
|
2204
|
-
bottom: (
|
|
2205
|
-
left: (Z.left -
|
|
2206
|
-
right: (
|
|
2203
|
+
top: (Z.top - JF.top + W.top) / qF.y,
|
|
2204
|
+
bottom: (JF.bottom - Z.bottom + W.bottom) / qF.y,
|
|
2205
|
+
left: (Z.left - JF.left + W.left) / qF.x,
|
|
2206
|
+
right: (JF.right - Z.right + W.right) / qF.x
|
|
2207
2207
|
};
|
|
2208
2208
|
}
|
|
2209
2209
|
var arrow$2 = (n) => ({
|
|
@@ -2215,17 +2215,17 @@ var arrow$2 = (n) => ({
|
|
|
2215
2215
|
let H = getPaddingObject(B), U = {
|
|
2216
2216
|
x: E,
|
|
2217
2217
|
y: O
|
|
2218
|
-
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z),
|
|
2219
|
-
(!
|
|
2220
|
-
let
|
|
2218
|
+
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), GF = W === "y", KF = GF ? "top" : "left", qF = GF ? "bottom" : "right", JF = GF ? "clientHeight" : "clientWidth", YF = j.reference[G] + j.reference[W] - U[W] - j.floating[G], XF = U[W] - j.reference[W], ZF = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), QF = ZF ? ZF[JF] : 0;
|
|
2219
|
+
(!QF || !await (M.isElement == null ? void 0 : M.isElement(ZF))) && (QF = N.floating[JF] || j.floating[G]);
|
|
2220
|
+
let $F = YF / 2 - XF / 2, eI = QF / 2 - Z[G] / 2 - 1, tI = min(H[KF], eI), nI = min(H[qF], eI), rI = tI, iI = QF - Z[G] - nI, aI = QF / 2 - Z[G] / 2 + $F, oI = clamp$3(rI, aI, iI), sI = !P.arrow && getAlignment(A) != null && aI !== oI && j.reference[G] / 2 - (aI < rI ? tI : nI) - Z[G] / 2 < 0, cI = sI ? aI < rI ? aI - rI : aI - iI : 0;
|
|
2221
2221
|
return {
|
|
2222
|
-
[W]: U[W] +
|
|
2222
|
+
[W]: U[W] + cI,
|
|
2223
2223
|
data: {
|
|
2224
|
-
[W]:
|
|
2225
|
-
centerOffset:
|
|
2226
|
-
...
|
|
2224
|
+
[W]: oI,
|
|
2225
|
+
centerOffset: aI - oI - cI,
|
|
2226
|
+
...sI && { alignmentOffset: cI }
|
|
2227
2227
|
},
|
|
2228
|
-
reset:
|
|
2228
|
+
reset: sI
|
|
2229
2229
|
};
|
|
2230
2230
|
}
|
|
2231
2231
|
}), flip$2 = function(n) {
|
|
@@ -2236,32 +2236,32 @@ var arrow$2 = (n) => ({
|
|
|
2236
2236
|
var E;
|
|
2237
2237
|
let { placement: O, middlewareData: A, rects: j, initialPlacement: M, platform: N, elements: P } = _, { mainAxis: z = !0, crossAxis: B = !0, fallbackPlacements: H, fallbackStrategy: U = "bestFit", fallbackAxisSideDirection: W = "none", flipAlignment: G = !0, ...Z } = evaluate(n, _);
|
|
2238
2238
|
if ((E = A.arrow) != null && E.alignmentOffset) return {};
|
|
2239
|
-
let
|
|
2240
|
-
!H &&
|
|
2241
|
-
let
|
|
2242
|
-
if (z &&
|
|
2243
|
-
let n = getAlignmentSides(O, j,
|
|
2244
|
-
|
|
2239
|
+
let GF = getSide(O), KF = getSideAxis(M), qF = getSide(M) === M, JF = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), YF = H || (qF || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), XF = W !== "none";
|
|
2240
|
+
!H && XF && YF.push(...getOppositeAxisPlacements(M, G, W, JF));
|
|
2241
|
+
let ZF = [M, ...YF], QF = await detectOverflow$1(_, Z), $F = [], eI = A.flip?.overflows || [];
|
|
2242
|
+
if (z && $F.push(QF[GF]), B) {
|
|
2243
|
+
let n = getAlignmentSides(O, j, JF);
|
|
2244
|
+
$F.push(QF[n[0]], QF[n[1]]);
|
|
2245
2245
|
}
|
|
2246
|
-
if (
|
|
2246
|
+
if (eI = [...eI, {
|
|
2247
2247
|
placement: O,
|
|
2248
|
-
overflows:
|
|
2249
|
-
}],
|
|
2250
|
-
let n = (A.flip?.index || 0) + 1, _ =
|
|
2251
|
-
if (_ && (!(B === "alignment" &&
|
|
2248
|
+
overflows: $F
|
|
2249
|
+
}], !$F.every((n) => n <= 0)) {
|
|
2250
|
+
let n = (A.flip?.index || 0) + 1, _ = ZF[n];
|
|
2251
|
+
if (_ && (!(B === "alignment" && KF !== getSideAxis(_)) || eI.every((n) => getSideAxis(n.placement) === KF ? n.overflows[0] > 0 : !0))) return {
|
|
2252
2252
|
data: {
|
|
2253
2253
|
index: n,
|
|
2254
|
-
overflows:
|
|
2254
|
+
overflows: eI
|
|
2255
2255
|
},
|
|
2256
2256
|
reset: { placement: _ }
|
|
2257
2257
|
};
|
|
2258
|
-
let E =
|
|
2258
|
+
let E = eI.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
|
|
2259
2259
|
if (!E) switch (U) {
|
|
2260
2260
|
case "bestFit": {
|
|
2261
|
-
let n =
|
|
2262
|
-
if (
|
|
2261
|
+
let n = eI.filter((n) => {
|
|
2262
|
+
if (XF) {
|
|
2263
2263
|
let _ = getSideAxis(n.placement);
|
|
2264
|
-
return _ ===
|
|
2264
|
+
return _ === KF || _ === "y";
|
|
2265
2265
|
}
|
|
2266
2266
|
return !0;
|
|
2267
2267
|
}).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
|
|
@@ -2404,7 +2404,7 @@ var offset$2 = function(n) {
|
|
|
2404
2404
|
let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
|
|
2405
2405
|
x: E,
|
|
2406
2406
|
y: O
|
|
2407
|
-
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _),
|
|
2407
|
+
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), GF = typeof Z == "number" ? {
|
|
2408
2408
|
mainAxis: Z,
|
|
2409
2409
|
crossAxis: 0
|
|
2410
2410
|
} : {
|
|
@@ -2413,11 +2413,11 @@ var offset$2 = function(n) {
|
|
|
2413
2413
|
...Z
|
|
2414
2414
|
};
|
|
2415
2415
|
if (P) {
|
|
2416
|
-
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] +
|
|
2416
|
+
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + GF.mainAxis, E = j.reference[U] + j.reference[n] - GF.mainAxis;
|
|
2417
2417
|
W < _ ? W = _ : W > E && (W = E);
|
|
2418
2418
|
}
|
|
2419
2419
|
if (z) {
|
|
2420
|
-
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 :
|
|
2420
|
+
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : GF.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? GF.crossAxis : 0);
|
|
2421
2421
|
G < E ? G = E : G > O && (G = O);
|
|
2422
2422
|
}
|
|
2423
2423
|
return {
|
|
@@ -2432,20 +2432,20 @@ var offset$2 = function(n) {
|
|
|
2432
2432
|
options: n,
|
|
2433
2433
|
async fn(_) {
|
|
2434
2434
|
var E, O;
|
|
2435
|
-
let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating,
|
|
2436
|
-
H === "top" || H === "bottom" ? (
|
|
2437
|
-
let
|
|
2438
|
-
if ((E = _.middlewareData.shift) != null && E.enabled.x && (
|
|
2435
|
+
let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating, GF, KF;
|
|
2436
|
+
H === "top" || H === "bottom" ? (GF = H, KF = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (KF = H, GF = U === "end" ? "top" : "bottom");
|
|
2437
|
+
let qF = Z - B.top - B.bottom, JF = G - B.left - B.right, YF = min(Z - B[GF], qF), XF = min(G - B[KF], JF), ZF = !_.middlewareData.shift, QF = YF, $F = XF;
|
|
2438
|
+
if ((E = _.middlewareData.shift) != null && E.enabled.x && ($F = JF), (O = _.middlewareData.shift) != null && O.enabled.y && (QF = qF), ZF && !U) {
|
|
2439
2439
|
let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
|
|
2440
|
-
W ?
|
|
2440
|
+
W ? $F = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : QF = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
|
|
2441
2441
|
}
|
|
2442
2442
|
await P({
|
|
2443
2443
|
..._,
|
|
2444
|
-
availableWidth:
|
|
2445
|
-
availableHeight:
|
|
2444
|
+
availableWidth: $F,
|
|
2445
|
+
availableHeight: QF
|
|
2446
2446
|
});
|
|
2447
|
-
let
|
|
2448
|
-
return G !==
|
|
2447
|
+
let eI = await M.getDimensions(N.floating);
|
|
2448
|
+
return G !== eI.width || Z !== eI.height ? { reset: { rects: !0 } } : {};
|
|
2449
2449
|
}
|
|
2450
2450
|
};
|
|
2451
2451
|
};
|
|
@@ -2829,27 +2829,27 @@ function observeMove(n, _) {
|
|
|
2829
2829
|
N === void 0 && (N = !1), P === void 0 && (P = 1), j();
|
|
2830
2830
|
let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
|
|
2831
2831
|
if (N || _(), !U || !W) return;
|
|
2832
|
-
let G = floor(H), Z = floor(A.clientWidth - (B + U)),
|
|
2833
|
-
rootMargin: -G + "px " + -Z + "px " + -
|
|
2832
|
+
let G = floor(H), Z = floor(A.clientWidth - (B + U)), GF = floor(A.clientHeight - (H + W)), KF = floor(B), qF = {
|
|
2833
|
+
rootMargin: -G + "px " + -Z + "px " + -GF + "px " + -KF + "px",
|
|
2834
2834
|
threshold: max(0, min(1, P)) || 1
|
|
2835
|
-
},
|
|
2836
|
-
function
|
|
2835
|
+
}, JF = !0;
|
|
2836
|
+
function YF(_) {
|
|
2837
2837
|
let E = _[0].intersectionRatio;
|
|
2838
2838
|
if (E !== P) {
|
|
2839
|
-
if (!
|
|
2839
|
+
if (!JF) return M();
|
|
2840
2840
|
E ? M(!1, E) : O = setTimeout(() => {
|
|
2841
2841
|
M(!1, 1e-7);
|
|
2842
2842
|
}, 1e3);
|
|
2843
2843
|
}
|
|
2844
|
-
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(),
|
|
2844
|
+
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), JF = !1;
|
|
2845
2845
|
}
|
|
2846
2846
|
try {
|
|
2847
|
-
E = new IntersectionObserver(
|
|
2848
|
-
...
|
|
2847
|
+
E = new IntersectionObserver(YF, {
|
|
2848
|
+
...qF,
|
|
2849
2849
|
root: A.ownerDocument
|
|
2850
2850
|
});
|
|
2851
2851
|
} catch {
|
|
2852
|
-
E = new IntersectionObserver(
|
|
2852
|
+
E = new IntersectionObserver(YF, qF);
|
|
2853
2853
|
}
|
|
2854
2854
|
E.observe(n);
|
|
2855
2855
|
}
|
|
@@ -2870,10 +2870,10 @@ function autoUpdate(n, _, E, O) {
|
|
|
2870
2870
|
})), E();
|
|
2871
2871
|
}), z && !P && W.observe(z), W.observe(_));
|
|
2872
2872
|
let G, Z = P ? getBoundingClientRect(n) : null;
|
|
2873
|
-
P &&
|
|
2874
|
-
function
|
|
2873
|
+
P && GF();
|
|
2874
|
+
function GF() {
|
|
2875
2875
|
let _ = getBoundingClientRect(n);
|
|
2876
|
-
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(
|
|
2876
|
+
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(GF);
|
|
2877
2877
|
}
|
|
2878
2878
|
return E(), () => {
|
|
2879
2879
|
var n;
|
|
@@ -2940,23 +2940,23 @@ function useFloating(_) {
|
|
|
2940
2940
|
isPositioned: !1
|
|
2941
2941
|
}), [W, G] = React$1.useState(A);
|
|
2942
2942
|
deepEqual(W, A) || G(A);
|
|
2943
|
-
let [Z,
|
|
2944
|
-
n !==
|
|
2945
|
-
}, []),
|
|
2946
|
-
n !==
|
|
2947
|
-
}, []),
|
|
2948
|
-
if (
|
|
2943
|
+
let [Z, GF] = React$1.useState(null), [KF, qF] = React$1.useState(null), JF = React$1.useCallback((n) => {
|
|
2944
|
+
n !== $F.current && ($F.current = n, GF(n));
|
|
2945
|
+
}, []), YF = React$1.useCallback((n) => {
|
|
2946
|
+
n !== eI.current && (eI.current = n, qF(n));
|
|
2947
|
+
}, []), XF = M || Z, ZF = N || KF, $F = React$1.useRef(null), eI = React$1.useRef(null), tI = React$1.useRef(H), nI = z != null, rI = useLatestRef(z), iI = useLatestRef(j), aI = useLatestRef(B), oI = React$1.useCallback(() => {
|
|
2948
|
+
if (!$F.current || !eI.current) return;
|
|
2949
2949
|
let n = {
|
|
2950
2950
|
placement: E,
|
|
2951
2951
|
strategy: O,
|
|
2952
2952
|
middleware: W
|
|
2953
2953
|
};
|
|
2954
|
-
|
|
2954
|
+
iI.current && (n.platform = iI.current), computePosition($F.current, eI.current, n).then((n) => {
|
|
2955
2955
|
let _ = {
|
|
2956
2956
|
...n,
|
|
2957
|
-
isPositioned:
|
|
2957
|
+
isPositioned: aI.current !== !1
|
|
2958
2958
|
};
|
|
2959
|
-
|
|
2959
|
+
sI.current && !deepEqual(tI.current, _) && (tI.current = _, ReactDOM$1.flushSync(() => {
|
|
2960
2960
|
U(_);
|
|
2961
2961
|
}));
|
|
2962
2962
|
});
|
|
@@ -2964,50 +2964,50 @@ function useFloating(_) {
|
|
|
2964
2964
|
W,
|
|
2965
2965
|
E,
|
|
2966
2966
|
O,
|
|
2967
|
-
|
|
2968
|
-
|
|
2967
|
+
iI,
|
|
2968
|
+
aI
|
|
2969
2969
|
]);
|
|
2970
2970
|
index(() => {
|
|
2971
|
-
B === !1 &&
|
|
2971
|
+
B === !1 && tI.current.isPositioned && (tI.current.isPositioned = !1, U((n) => ({
|
|
2972
2972
|
...n,
|
|
2973
2973
|
isPositioned: !1
|
|
2974
2974
|
})));
|
|
2975
2975
|
}, [B]);
|
|
2976
|
-
let
|
|
2977
|
-
index(() => (
|
|
2978
|
-
|
|
2976
|
+
let sI = React$1.useRef(!1);
|
|
2977
|
+
index(() => (sI.current = !0, () => {
|
|
2978
|
+
sI.current = !1;
|
|
2979
2979
|
}), []), index(() => {
|
|
2980
|
-
if (
|
|
2981
|
-
if (
|
|
2982
|
-
|
|
2980
|
+
if (XF && ($F.current = XF), ZF && (eI.current = ZF), XF && ZF) {
|
|
2981
|
+
if (rI.current) return rI.current(XF, ZF, oI);
|
|
2982
|
+
oI();
|
|
2983
2983
|
}
|
|
2984
2984
|
}, [
|
|
2985
|
-
|
|
2986
|
-
|
|
2985
|
+
XF,
|
|
2986
|
+
ZF,
|
|
2987
|
+
oI,
|
|
2987
2988
|
rI,
|
|
2988
|
-
|
|
2989
|
-
$F
|
|
2989
|
+
nI
|
|
2990
2990
|
]);
|
|
2991
|
-
let
|
|
2991
|
+
let cI = React$1.useMemo(() => ({
|
|
2992
|
+
reference: $F,
|
|
2993
|
+
floating: eI,
|
|
2994
|
+
setReference: JF,
|
|
2995
|
+
setFloating: YF
|
|
2996
|
+
}), [JF, YF]), lI = React$1.useMemo(() => ({
|
|
2992
2997
|
reference: XF,
|
|
2993
|
-
floating: ZF
|
|
2994
|
-
|
|
2995
|
-
setFloating: KF
|
|
2996
|
-
}), [GF, KF]), oI = React$1.useMemo(() => ({
|
|
2997
|
-
reference: qF,
|
|
2998
|
-
floating: JF
|
|
2999
|
-
}), [qF, JF]), sI = React$1.useMemo(() => {
|
|
2998
|
+
floating: ZF
|
|
2999
|
+
}), [XF, ZF]), uI = React$1.useMemo(() => {
|
|
3000
3000
|
let n = {
|
|
3001
3001
|
position: O,
|
|
3002
3002
|
left: 0,
|
|
3003
3003
|
top: 0
|
|
3004
3004
|
};
|
|
3005
|
-
if (!
|
|
3006
|
-
let _ = roundByDPR(
|
|
3005
|
+
if (!lI.floating) return n;
|
|
3006
|
+
let _ = roundByDPR(lI.floating, H.x), E = roundByDPR(lI.floating, H.y);
|
|
3007
3007
|
return P ? {
|
|
3008
3008
|
...n,
|
|
3009
3009
|
transform: "translate(" + _ + "px, " + E + "px)",
|
|
3010
|
-
...getDPR(
|
|
3010
|
+
...getDPR(lI.floating) >= 1.5 && { willChange: "transform" }
|
|
3011
3011
|
} : {
|
|
3012
3012
|
position: O,
|
|
3013
3013
|
left: _,
|
|
@@ -3016,22 +3016,22 @@ function useFloating(_) {
|
|
|
3016
3016
|
}, [
|
|
3017
3017
|
O,
|
|
3018
3018
|
P,
|
|
3019
|
-
|
|
3019
|
+
lI.floating,
|
|
3020
3020
|
H.x,
|
|
3021
3021
|
H.y
|
|
3022
3022
|
]);
|
|
3023
3023
|
return React$1.useMemo(() => ({
|
|
3024
3024
|
...H,
|
|
3025
|
-
update:
|
|
3026
|
-
refs:
|
|
3027
|
-
elements:
|
|
3028
|
-
floatingStyles:
|
|
3025
|
+
update: oI,
|
|
3026
|
+
refs: cI,
|
|
3027
|
+
elements: lI,
|
|
3028
|
+
floatingStyles: uI
|
|
3029
3029
|
}), [
|
|
3030
3030
|
H,
|
|
3031
|
-
rI,
|
|
3032
|
-
aI,
|
|
3033
3031
|
oI,
|
|
3034
|
-
|
|
3032
|
+
cI,
|
|
3033
|
+
lI,
|
|
3034
|
+
uI
|
|
3035
3035
|
]);
|
|
3036
3036
|
}
|
|
3037
3037
|
var arrow$1$1 = (n) => {
|
|
@@ -3108,70 +3108,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
|
|
|
3108
3108
|
});
|
|
3109
3109
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
3110
3110
|
var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$6), PopperContent = React$1.forwardRef((_, E) => {
|
|
3111
|
-
let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...
|
|
3111
|
+
let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...GF } = _, KF = usePopperContext(CONTENT_NAME$6, O), [qF, JF] = React$1.useState(null), YF = useComposedRefs$1(E, (n) => JF(n)), [XF, ZF] = React$1.useState(null), QF = useSize(XF), $F = QF?.width ?? 0, eI = QF?.height ?? 0, tI = A + (M === "center" ? "" : "-" + M), nI = typeof H == "number" ? H : {
|
|
3112
3112
|
top: 0,
|
|
3113
3113
|
right: 0,
|
|
3114
3114
|
bottom: 0,
|
|
3115
3115
|
left: 0,
|
|
3116
3116
|
...H
|
|
3117
|
-
},
|
|
3118
|
-
padding:
|
|
3119
|
-
boundary:
|
|
3120
|
-
altBoundary:
|
|
3121
|
-
}, { refs:
|
|
3117
|
+
}, rI = Array.isArray(B) ? B : [B], aI = rI.length > 0, oI = {
|
|
3118
|
+
padding: nI,
|
|
3119
|
+
boundary: rI.filter(isNotNull$2),
|
|
3120
|
+
altBoundary: aI
|
|
3121
|
+
}, { refs: sI, floatingStyles: cI, placement: lI, isPositioned: uI, middlewareData: dI } = useFloating({
|
|
3122
3122
|
strategy: "fixed",
|
|
3123
|
-
placement:
|
|
3123
|
+
placement: tI,
|
|
3124
3124
|
whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
|
|
3125
|
-
elements: { reference:
|
|
3125
|
+
elements: { reference: KF.anchor },
|
|
3126
3126
|
middleware: [
|
|
3127
3127
|
offset({
|
|
3128
|
-
mainAxis: j +
|
|
3128
|
+
mainAxis: j + eI,
|
|
3129
3129
|
alignmentAxis: N
|
|
3130
3130
|
}),
|
|
3131
3131
|
z && shift({
|
|
3132
3132
|
mainAxis: !0,
|
|
3133
3133
|
crossAxis: !1,
|
|
3134
3134
|
limiter: U === "partial" ? limitShift() : void 0,
|
|
3135
|
-
...
|
|
3135
|
+
...oI
|
|
3136
3136
|
}),
|
|
3137
|
-
z && flip({ ...
|
|
3137
|
+
z && flip({ ...oI }),
|
|
3138
3138
|
size({
|
|
3139
|
-
...
|
|
3139
|
+
...oI,
|
|
3140
3140
|
apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
|
|
3141
3141
|
let { width: A, height: j } = _.reference, M = n.floating.style;
|
|
3142
3142
|
M.setProperty("--radix-popper-available-width", `${E}px`), M.setProperty("--radix-popper-available-height", `${O}px`), M.setProperty("--radix-popper-anchor-width", `${A}px`), M.setProperty("--radix-popper-anchor-height", `${j}px`);
|
|
3143
3143
|
}
|
|
3144
3144
|
}),
|
|
3145
|
-
|
|
3146
|
-
element:
|
|
3145
|
+
XF && arrow({
|
|
3146
|
+
element: XF,
|
|
3147
3147
|
padding: P
|
|
3148
3148
|
}),
|
|
3149
3149
|
transformOrigin({
|
|
3150
|
-
arrowWidth:
|
|
3151
|
-
arrowHeight:
|
|
3150
|
+
arrowWidth: $F,
|
|
3151
|
+
arrowHeight: eI
|
|
3152
3152
|
}),
|
|
3153
3153
|
W && hide({
|
|
3154
3154
|
strategy: "referenceHidden",
|
|
3155
|
-
...
|
|
3155
|
+
...oI
|
|
3156
3156
|
})
|
|
3157
3157
|
]
|
|
3158
|
-
}), [
|
|
3158
|
+
}), [fI, pI] = getSideAndAlignFromPlacement(lI), mI = useCallbackRef(Z);
|
|
3159
3159
|
useLayoutEffect2(() => {
|
|
3160
|
-
|
|
3161
|
-
}, [
|
|
3162
|
-
let
|
|
3160
|
+
uI && mI?.();
|
|
3161
|
+
}, [uI, mI]);
|
|
3162
|
+
let hI = dI.arrow?.x, gI = dI.arrow?.y, _I = dI.arrow?.centerOffset !== 0, [vI, yI] = React$1.useState();
|
|
3163
3163
|
return useLayoutEffect2(() => {
|
|
3164
|
-
|
|
3165
|
-
}, [
|
|
3166
|
-
ref:
|
|
3164
|
+
qF && yI(window.getComputedStyle(qF).zIndex);
|
|
3165
|
+
}, [qF]), /* @__PURE__ */ jsx("div", {
|
|
3166
|
+
ref: sI.setFloating,
|
|
3167
3167
|
"data-radix-popper-content-wrapper": "",
|
|
3168
3168
|
style: {
|
|
3169
|
-
...
|
|
3170
|
-
transform:
|
|
3169
|
+
...cI,
|
|
3170
|
+
transform: uI ? cI.transform : "translate(0, -200%)",
|
|
3171
3171
|
minWidth: "max-content",
|
|
3172
|
-
zIndex:
|
|
3173
|
-
"--radix-popper-transform-origin": [
|
|
3174
|
-
...
|
|
3172
|
+
zIndex: vI,
|
|
3173
|
+
"--radix-popper-transform-origin": [dI.transformOrigin?.x, dI.transformOrigin?.y].join(" "),
|
|
3174
|
+
...dI.hide?.referenceHidden && {
|
|
3175
3175
|
visibility: "hidden",
|
|
3176
3176
|
pointerEvents: "none"
|
|
3177
3177
|
}
|
|
@@ -3179,19 +3179,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
3179
3179
|
dir: _.dir,
|
|
3180
3180
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
3181
3181
|
scope: O,
|
|
3182
|
-
placedSide:
|
|
3183
|
-
onArrowChange:
|
|
3184
|
-
arrowX:
|
|
3185
|
-
arrowY:
|
|
3186
|
-
shouldHideArrow:
|
|
3182
|
+
placedSide: fI,
|
|
3183
|
+
onArrowChange: ZF,
|
|
3184
|
+
arrowX: hI,
|
|
3185
|
+
arrowY: gI,
|
|
3186
|
+
shouldHideArrow: _I,
|
|
3187
3187
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3188
|
-
"data-side":
|
|
3189
|
-
"data-align":
|
|
3190
|
-
...
|
|
3191
|
-
ref:
|
|
3188
|
+
"data-side": fI,
|
|
3189
|
+
"data-align": pI,
|
|
3190
|
+
...GF,
|
|
3191
|
+
ref: YF,
|
|
3192
3192
|
style: {
|
|
3193
|
-
...
|
|
3194
|
-
animation:
|
|
3193
|
+
...GF.style,
|
|
3194
|
+
animation: uI ? void 0 : "none"
|
|
3195
3195
|
}
|
|
3196
3196
|
})
|
|
3197
3197
|
})
|
|
@@ -3274,27 +3274,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
|
|
|
3274
3274
|
}));
|
|
3275
3275
|
RovingFocusGroup.displayName = GROUP_NAME$3;
|
|
3276
3276
|
var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
3277
|
-
let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [
|
|
3277
|
+
let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [GF, KF] = useControllableState({
|
|
3278
3278
|
prop: N,
|
|
3279
3279
|
defaultProp: P ?? null,
|
|
3280
3280
|
onChange: z,
|
|
3281
3281
|
caller: GROUP_NAME$3
|
|
3282
|
-
}), [
|
|
3282
|
+
}), [qF, JF] = React$1.useState(!1), YF = useCallbackRef(B), XF = useCollection$1(O), ZF = React$1.useRef(!1), [QF, $F] = React$1.useState(0);
|
|
3283
3283
|
return React$1.useEffect(() => {
|
|
3284
3284
|
let n = W.current;
|
|
3285
|
-
if (n) return n.addEventListener(ENTRY_FOCUS,
|
|
3286
|
-
}, [
|
|
3285
|
+
if (n) return n.addEventListener(ENTRY_FOCUS, YF), () => n.removeEventListener(ENTRY_FOCUS, YF);
|
|
3286
|
+
}, [YF]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
3287
3287
|
scope: O,
|
|
3288
3288
|
orientation: A,
|
|
3289
3289
|
dir: Z,
|
|
3290
3290
|
loop: j,
|
|
3291
|
-
currentTabStopId:
|
|
3292
|
-
onItemFocus: React$1.useCallback((n) =>
|
|
3293
|
-
onItemShiftTab: React$1.useCallback(() =>
|
|
3294
|
-
onFocusableItemAdd: React$1.useCallback(() =>
|
|
3295
|
-
onFocusableItemRemove: React$1.useCallback(() =>
|
|
3291
|
+
currentTabStopId: GF,
|
|
3292
|
+
onItemFocus: React$1.useCallback((n) => KF(n), [KF]),
|
|
3293
|
+
onItemShiftTab: React$1.useCallback(() => JF(!0), []),
|
|
3294
|
+
onFocusableItemAdd: React$1.useCallback(() => $F((n) => n + 1), []),
|
|
3295
|
+
onFocusableItemRemove: React$1.useCallback(() => $F((n) => n - 1), []),
|
|
3296
3296
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3297
|
-
tabIndex:
|
|
3297
|
+
tabIndex: qF || QF === 0 ? -1 : 0,
|
|
3298
3298
|
"data-orientation": A,
|
|
3299
3299
|
...U,
|
|
3300
3300
|
ref: G,
|
|
@@ -3303,28 +3303,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3303
3303
|
..._.style
|
|
3304
3304
|
},
|
|
3305
3305
|
onMouseDown: composeEventHandlers(_.onMouseDown, () => {
|
|
3306
|
-
|
|
3306
|
+
ZF.current = !0;
|
|
3307
3307
|
}),
|
|
3308
3308
|
onFocus: composeEventHandlers(_.onFocus, (n) => {
|
|
3309
|
-
let _ = !
|
|
3310
|
-
if (n.target === n.currentTarget && _ && !
|
|
3309
|
+
let _ = !ZF.current;
|
|
3310
|
+
if (n.target === n.currentTarget && _ && !qF) {
|
|
3311
3311
|
let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
3312
3312
|
if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
|
|
3313
|
-
let n =
|
|
3313
|
+
let n = XF().filter((n) => n.focusable);
|
|
3314
3314
|
focusFirst$1([
|
|
3315
3315
|
n.find((n) => n.active),
|
|
3316
|
-
n.find((n) => n.id ===
|
|
3316
|
+
n.find((n) => n.id === GF),
|
|
3317
3317
|
...n
|
|
3318
3318
|
].filter(Boolean).map((n) => n.ref.current), H);
|
|
3319
3319
|
}
|
|
3320
3320
|
}
|
|
3321
|
-
|
|
3321
|
+
ZF.current = !1;
|
|
3322
3322
|
}),
|
|
3323
|
-
onBlur: composeEventHandlers(_.onBlur, () =>
|
|
3323
|
+
onBlur: composeEventHandlers(_.onBlur, () => JF(!1))
|
|
3324
3324
|
})
|
|
3325
3325
|
});
|
|
3326
3326
|
}), ITEM_NAME$3 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((_, E) => {
|
|
3327
|
-
let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId:
|
|
3327
|
+
let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId: GF } = H;
|
|
3328
3328
|
return React$1.useEffect(() => {
|
|
3329
3329
|
if (A) return G(), () => Z();
|
|
3330
3330
|
}, [
|
|
@@ -3367,7 +3367,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3367
3367
|
}),
|
|
3368
3368
|
children: typeof N == "function" ? N({
|
|
3369
3369
|
isCurrentTabStop: U,
|
|
3370
|
-
hasTabStop:
|
|
3370
|
+
hasTabStop: GF != null
|
|
3371
3371
|
}) : N
|
|
3372
3372
|
})
|
|
3373
3373
|
});
|
|
@@ -3518,40 +3518,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3518
3518
|
onDismiss: () => E.onOpenChange(!1)
|
|
3519
3519
|
});
|
|
3520
3520
|
}), Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((_, E) => {
|
|
3521
|
-
let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...
|
|
3521
|
+
let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...GF } = _, KF = useMenuContext(CONTENT_NAME$5, O), qF = useMenuRootContext(CONTENT_NAME$5, O), JF = usePopperScope$2(O), YF = useRovingFocusGroupScope$1(O), XF = useCollection(O), [ZF, QF] = React$1.useState(null), $F = React$1.useRef(null), eI = useComposedRefs$1(E, $F, KF.onContentChange), tI = React$1.useRef(0), nI = React$1.useRef(""), rI = React$1.useRef(0), aI = React$1.useRef(null), oI = React$1.useRef("right"), sI = React$1.useRef(0), cI = Z ? Combination_default : React$1.Fragment, lI = Z ? {
|
|
3522
3522
|
as: Slot$1,
|
|
3523
3523
|
allowPinchZoom: !0
|
|
3524
|
-
} : void 0,
|
|
3525
|
-
let _ =
|
|
3524
|
+
} : void 0, uI = (n) => {
|
|
3525
|
+
let _ = nI.current + n, E = XF().filter((n) => !n.disabled), O = document.activeElement, A = E.find((n) => n.ref.current === O)?.textValue, j = getNextMatch(E.map((n) => n.textValue), _, A), M = E.find((n) => n.textValue === j)?.ref.current;
|
|
3526
3526
|
(function n(_) {
|
|
3527
|
-
|
|
3527
|
+
nI.current = _, window.clearTimeout(tI.current), _ !== "" && (tI.current = window.setTimeout(() => n(""), 1e3));
|
|
3528
3528
|
})(_), M && setTimeout(() => M.focus());
|
|
3529
3529
|
};
|
|
3530
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
3531
|
-
let
|
|
3530
|
+
React$1.useEffect(() => () => window.clearTimeout(tI.current), []), useFocusGuards();
|
|
3531
|
+
let dI = React$1.useCallback((n) => oI.current === aI.current?.side && isPointerInGraceArea(n, aI.current?.area), []);
|
|
3532
3532
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
3533
3533
|
scope: O,
|
|
3534
|
-
searchRef:
|
|
3534
|
+
searchRef: nI,
|
|
3535
3535
|
onItemEnter: React$1.useCallback((n) => {
|
|
3536
|
-
|
|
3537
|
-
}, [
|
|
3536
|
+
dI(n) && n.preventDefault();
|
|
3537
|
+
}, [dI]),
|
|
3538
3538
|
onItemLeave: React$1.useCallback((n) => {
|
|
3539
|
-
|
|
3540
|
-
}, [
|
|
3539
|
+
dI(n) || ($F.current?.focus(), QF(null));
|
|
3540
|
+
}, [dI]),
|
|
3541
3541
|
onTriggerLeave: React$1.useCallback((n) => {
|
|
3542
|
-
|
|
3543
|
-
}, [
|
|
3544
|
-
pointerGraceTimerRef:
|
|
3542
|
+
dI(n) && n.preventDefault();
|
|
3543
|
+
}, [dI]),
|
|
3544
|
+
pointerGraceTimerRef: rI,
|
|
3545
3545
|
onPointerGraceIntentChange: React$1.useCallback((n) => {
|
|
3546
|
-
|
|
3546
|
+
aI.current = n;
|
|
3547
3547
|
}, []),
|
|
3548
|
-
children: /* @__PURE__ */ jsx(
|
|
3549
|
-
...
|
|
3548
|
+
children: /* @__PURE__ */ jsx(cI, {
|
|
3549
|
+
...lI,
|
|
3550
3550
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
3551
3551
|
asChild: !0,
|
|
3552
3552
|
trapped: j,
|
|
3553
3553
|
onMountAutoFocus: composeEventHandlers(M, (n) => {
|
|
3554
|
-
n.preventDefault(),
|
|
3554
|
+
n.preventDefault(), $F.current?.focus({ preventScroll: !0 });
|
|
3555
3555
|
}),
|
|
3556
3556
|
onUnmountAutoFocus: N,
|
|
3557
3557
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3564,44 +3564,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3564
3564
|
onDismiss: G,
|
|
3565
3565
|
children: /* @__PURE__ */ jsx(Root$2, {
|
|
3566
3566
|
asChild: !0,
|
|
3567
|
-
...
|
|
3568
|
-
dir:
|
|
3567
|
+
...YF,
|
|
3568
|
+
dir: qF.dir,
|
|
3569
3569
|
orientation: "vertical",
|
|
3570
3570
|
loop: A,
|
|
3571
|
-
currentTabStopId:
|
|
3572
|
-
onCurrentTabStopIdChange:
|
|
3571
|
+
currentTabStopId: ZF,
|
|
3572
|
+
onCurrentTabStopIdChange: QF,
|
|
3573
3573
|
onEntryFocus: composeEventHandlers(z, (n) => {
|
|
3574
|
-
|
|
3574
|
+
qF.isUsingKeyboardRef.current || n.preventDefault();
|
|
3575
3575
|
}),
|
|
3576
3576
|
preventScrollOnEntryFocus: !0,
|
|
3577
3577
|
children: /* @__PURE__ */ jsx(Content$1, {
|
|
3578
3578
|
role: "menu",
|
|
3579
3579
|
"aria-orientation": "vertical",
|
|
3580
|
-
"data-state": getOpenState(
|
|
3580
|
+
"data-state": getOpenState(KF.open),
|
|
3581
3581
|
"data-radix-menu-content": "",
|
|
3582
|
-
dir:
|
|
3582
|
+
dir: qF.dir,
|
|
3583
|
+
...JF,
|
|
3583
3584
|
...GF,
|
|
3584
|
-
|
|
3585
|
-
ref: ZF,
|
|
3585
|
+
ref: eI,
|
|
3586
3586
|
style: {
|
|
3587
3587
|
outline: "none",
|
|
3588
|
-
...
|
|
3588
|
+
...GF.style
|
|
3589
3589
|
},
|
|
3590
|
-
onKeyDown: composeEventHandlers(
|
|
3590
|
+
onKeyDown: composeEventHandlers(GF.onKeyDown, (n) => {
|
|
3591
3591
|
let _ = n.target.closest("[data-radix-menu-content]") === n.currentTarget, E = n.ctrlKey || n.altKey || n.metaKey, O = n.key.length === 1;
|
|
3592
|
-
_ && (n.key === "Tab" && n.preventDefault(), !E && O &&
|
|
3593
|
-
let A =
|
|
3592
|
+
_ && (n.key === "Tab" && n.preventDefault(), !E && O && uI(n.key));
|
|
3593
|
+
let A = $F.current;
|
|
3594
3594
|
if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
|
|
3595
3595
|
n.preventDefault();
|
|
3596
|
-
let j =
|
|
3596
|
+
let j = XF().filter((n) => !n.disabled).map((n) => n.ref.current);
|
|
3597
3597
|
LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
|
|
3598
3598
|
}),
|
|
3599
3599
|
onBlur: composeEventHandlers(_.onBlur, (n) => {
|
|
3600
|
-
n.currentTarget.contains(n.target) || (window.clearTimeout(
|
|
3600
|
+
n.currentTarget.contains(n.target) || (window.clearTimeout(tI.current), nI.current = "");
|
|
3601
3601
|
}),
|
|
3602
3602
|
onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
|
|
3603
|
-
let _ = n.target, E =
|
|
3604
|
-
n.currentTarget.contains(_) && E && (
|
|
3603
|
+
let _ = n.target, E = sI.current !== n.clientX;
|
|
3604
|
+
n.currentTarget.contains(_) && E && (oI.current = n.clientX > sI.current ? "right" : "left", sI.current = n.clientX);
|
|
3605
3605
|
}))
|
|
3606
3606
|
})
|
|
3607
3607
|
})
|
|
@@ -4549,11 +4549,11 @@ function useStateMachine(_, E) {
|
|
|
4549
4549
|
return React$1.useReducer((n, _) => E[n][_] ?? n, _);
|
|
4550
4550
|
}
|
|
4551
4551
|
var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((_, E) => {
|
|
4552
|
-
let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [
|
|
4552
|
+
let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [GF, KF] = React$1.useState(null), [qF, JF] = React$1.useState(0), [YF, XF] = React$1.useState(0), [ZF, QF] = React$1.useState(!1), [$F, eI] = React$1.useState(!1), tI = useComposedRefs$1(E, (n) => z(n)), nI = useDirection(j);
|
|
4553
4553
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
4554
4554
|
scope: O,
|
|
4555
4555
|
type: A,
|
|
4556
|
-
dir:
|
|
4556
|
+
dir: nI,
|
|
4557
4557
|
scrollHideDelay: M,
|
|
4558
4558
|
scrollArea: P,
|
|
4559
4559
|
viewport: B,
|
|
@@ -4562,22 +4562,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
|
|
|
4562
4562
|
onContentChange: W,
|
|
4563
4563
|
scrollbarX: G,
|
|
4564
4564
|
onScrollbarXChange: Z,
|
|
4565
|
-
scrollbarXEnabled:
|
|
4566
|
-
onScrollbarXEnabledChange:
|
|
4567
|
-
scrollbarY:
|
|
4568
|
-
onScrollbarYChange:
|
|
4569
|
-
scrollbarYEnabled:
|
|
4570
|
-
onScrollbarYEnabledChange:
|
|
4571
|
-
onCornerWidthChange:
|
|
4572
|
-
onCornerHeightChange:
|
|
4565
|
+
scrollbarXEnabled: ZF,
|
|
4566
|
+
onScrollbarXEnabledChange: QF,
|
|
4567
|
+
scrollbarY: GF,
|
|
4568
|
+
onScrollbarYChange: KF,
|
|
4569
|
+
scrollbarYEnabled: $F,
|
|
4570
|
+
onScrollbarYEnabledChange: eI,
|
|
4571
|
+
onCornerWidthChange: JF,
|
|
4572
|
+
onCornerHeightChange: XF,
|
|
4573
4573
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4574
|
-
dir:
|
|
4574
|
+
dir: nI,
|
|
4575
4575
|
...N,
|
|
4576
|
-
ref:
|
|
4576
|
+
ref: tI,
|
|
4577
4577
|
style: {
|
|
4578
4578
|
position: "relative",
|
|
4579
|
-
"--radix-scroll-area-corner-width":
|
|
4580
|
-
"--radix-scroll-area-corner-height":
|
|
4579
|
+
"--radix-scroll-area-corner-width": qF + "px",
|
|
4580
|
+
"--radix-scroll-area-corner-height": YF + "px",
|
|
4581
4581
|
..._.style
|
|
4582
4582
|
}
|
|
4583
4583
|
})
|
|
@@ -4848,46 +4848,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
|
|
|
4848
4848
|
}
|
|
4849
4849
|
});
|
|
4850
4850
|
}), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((_, E) => {
|
|
4851
|
-
let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z,
|
|
4852
|
-
function
|
|
4853
|
-
|
|
4854
|
-
x: n.clientX -
|
|
4855
|
-
y: n.clientY -
|
|
4851
|
+
let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z, GF] = React$1.useState(null), KF = useComposedRefs$1(E, (n) => GF(n)), qF = React$1.useRef(null), JF = React$1.useRef(""), YF = G.viewport, XF = A.content - A.viewport, ZF = useCallbackRef(H), QF = useCallbackRef(z), $F = useDebounceCallback(U, 10);
|
|
4852
|
+
function eI(n) {
|
|
4853
|
+
qF.current && B({
|
|
4854
|
+
x: n.clientX - qF.current.left,
|
|
4855
|
+
y: n.clientY - qF.current.top
|
|
4856
4856
|
});
|
|
4857
4857
|
}
|
|
4858
4858
|
return React$1.useEffect(() => {
|
|
4859
4859
|
let n = (n) => {
|
|
4860
4860
|
let _ = n.target;
|
|
4861
|
-
Z?.contains(_) &&
|
|
4861
|
+
Z?.contains(_) && ZF(n, XF);
|
|
4862
4862
|
};
|
|
4863
4863
|
return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
|
|
4864
4864
|
}, [
|
|
4865
|
-
|
|
4865
|
+
YF,
|
|
4866
4866
|
Z,
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
]), React$1.useEffect(
|
|
4867
|
+
XF,
|
|
4868
|
+
ZF
|
|
4869
|
+
]), React$1.useEffect(QF, [A, QF]), useResizeObserver$1(Z, $F), useResizeObserver$1(G.content, $F), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4870
4870
|
scope: O,
|
|
4871
4871
|
scrollbar: Z,
|
|
4872
4872
|
hasThumb: j,
|
|
4873
4873
|
onThumbChange: useCallbackRef(M),
|
|
4874
4874
|
onThumbPointerUp: useCallbackRef(N),
|
|
4875
|
-
onThumbPositionChange:
|
|
4875
|
+
onThumbPositionChange: QF,
|
|
4876
4876
|
onThumbPointerDown: useCallbackRef(P),
|
|
4877
4877
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4878
4878
|
...W,
|
|
4879
|
-
ref:
|
|
4879
|
+
ref: KF,
|
|
4880
4880
|
style: {
|
|
4881
4881
|
position: "absolute",
|
|
4882
4882
|
...W.style
|
|
4883
4883
|
},
|
|
4884
4884
|
onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
|
|
4885
|
-
n.button === 0 && (n.target.setPointerCapture(n.pointerId),
|
|
4885
|
+
n.button === 0 && (n.target.setPointerCapture(n.pointerId), qF.current = Z.getBoundingClientRect(), JF.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), eI(n));
|
|
4886
4886
|
}),
|
|
4887
|
-
onPointerMove: composeEventHandlers(_.onPointerMove,
|
|
4887
|
+
onPointerMove: composeEventHandlers(_.onPointerMove, eI),
|
|
4888
4888
|
onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
|
|
4889
4889
|
let _ = n.target;
|
|
4890
|
-
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect =
|
|
4890
|
+
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = JF.current, G.viewport && (G.viewport.style.scrollBehavior = ""), qF.current = null;
|
|
4891
4891
|
})
|
|
4892
4892
|
})
|
|
4893
4893
|
});
|
|
@@ -5029,7 +5029,7 @@ function useResizeObserver$1(n, _) {
|
|
|
5029
5029
|
}, [n, E]);
|
|
5030
5030
|
}
|
|
5031
5031
|
var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaScrollbar, Thumb$1 = ScrollAreaThumb, Corner = ScrollAreaCorner, SWITCH_NAME = "Switch", [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME), [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME), Switch = React$1.forwardRef((_, E) => {
|
|
5032
|
-
let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)),
|
|
5032
|
+
let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)), GF = React$1.useRef(!1), KF = W ? H || !!W.closest("form") : !0, [qF, JF] = useControllableState({
|
|
5033
5033
|
prop: j,
|
|
5034
5034
|
defaultProp: M ?? !1,
|
|
5035
5035
|
onChange: B,
|
|
@@ -5037,28 +5037,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
|
|
|
5037
5037
|
});
|
|
5038
5038
|
return /* @__PURE__ */ jsxs(SwitchProvider, {
|
|
5039
5039
|
scope: O,
|
|
5040
|
-
checked:
|
|
5040
|
+
checked: qF,
|
|
5041
5041
|
disabled: P,
|
|
5042
5042
|
children: [/* @__PURE__ */ jsx(Primitive.button, {
|
|
5043
5043
|
type: "button",
|
|
5044
5044
|
role: "switch",
|
|
5045
|
-
"aria-checked":
|
|
5045
|
+
"aria-checked": qF,
|
|
5046
5046
|
"aria-required": N,
|
|
5047
|
-
"data-state": getState(
|
|
5047
|
+
"data-state": getState(qF),
|
|
5048
5048
|
"data-disabled": P ? "" : void 0,
|
|
5049
5049
|
disabled: P,
|
|
5050
5050
|
value: z,
|
|
5051
5051
|
...U,
|
|
5052
5052
|
ref: Z,
|
|
5053
5053
|
onClick: composeEventHandlers(_.onClick, (n) => {
|
|
5054
|
-
|
|
5054
|
+
JF((n) => !n), KF && (GF.current = n.isPropagationStopped(), GF.current || n.stopPropagation());
|
|
5055
5055
|
})
|
|
5056
|
-
}),
|
|
5056
|
+
}), KF && /* @__PURE__ */ jsx(SwitchBubbleInput, {
|
|
5057
5057
|
control: W,
|
|
5058
|
-
bubbles: !
|
|
5058
|
+
bubbles: !GF.current,
|
|
5059
5059
|
name: A,
|
|
5060
5060
|
value: z,
|
|
5061
|
-
checked:
|
|
5061
|
+
checked: qF,
|
|
5062
5062
|
required: N,
|
|
5063
5063
|
disabled: P,
|
|
5064
5064
|
form: H,
|
|
@@ -5242,22 +5242,22 @@ var Root2 = Tabs, List = TabsList, Trigger$1 = TabsTrigger, Content = TabsConten
|
|
|
5242
5242
|
};
|
|
5243
5243
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
5244
5244
|
var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (_) => {
|
|
5245
|
-
let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent,
|
|
5245
|
+
let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent, GF = P ?? z.delayDuration, KF = React$1.useRef(!1), [qF, JF] = useControllableState({
|
|
5246
5246
|
prop: A,
|
|
5247
5247
|
defaultProp: j ?? !1,
|
|
5248
5248
|
onChange: (n) => {
|
|
5249
5249
|
n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
|
|
5250
5250
|
},
|
|
5251
5251
|
caller: TOOLTIP_NAME
|
|
5252
|
-
}),
|
|
5253
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5254
|
-
}, [
|
|
5255
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5256
|
-
}, [
|
|
5252
|
+
}), YF = React$1.useMemo(() => qF ? KF.current ? "delayed-open" : "instant-open" : "closed", [qF]), XF = React$1.useCallback(() => {
|
|
5253
|
+
window.clearTimeout(G.current), G.current = 0, KF.current = !1, JF(!0);
|
|
5254
|
+
}, [JF]), ZF = React$1.useCallback(() => {
|
|
5255
|
+
window.clearTimeout(G.current), G.current = 0, JF(!1);
|
|
5256
|
+
}, [JF]), QF = React$1.useCallback(() => {
|
|
5257
5257
|
window.clearTimeout(G.current), G.current = window.setTimeout(() => {
|
|
5258
|
-
|
|
5259
|
-
},
|
|
5260
|
-
}, [
|
|
5258
|
+
KF.current = !0, JF(!0), G.current = 0;
|
|
5259
|
+
}, GF);
|
|
5260
|
+
}, [GF, JF]);
|
|
5261
5261
|
return React$1.useEffect(() => () => {
|
|
5262
5262
|
G.current &&= (window.clearTimeout(G.current), 0);
|
|
5263
5263
|
}, []), /* @__PURE__ */ jsx(Root2$4, {
|
|
@@ -5265,22 +5265,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
|
|
|
5265
5265
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
5266
5266
|
scope: E,
|
|
5267
5267
|
contentId: W,
|
|
5268
|
-
open:
|
|
5269
|
-
stateAttribute:
|
|
5268
|
+
open: qF,
|
|
5269
|
+
stateAttribute: YF,
|
|
5270
5270
|
trigger: H,
|
|
5271
5271
|
onTriggerChange: U,
|
|
5272
5272
|
onTriggerEnter: React$1.useCallback(() => {
|
|
5273
|
-
z.isOpenDelayedRef.current ?
|
|
5273
|
+
z.isOpenDelayedRef.current ? QF() : XF();
|
|
5274
5274
|
}, [
|
|
5275
5275
|
z.isOpenDelayedRef,
|
|
5276
|
-
|
|
5277
|
-
|
|
5276
|
+
QF,
|
|
5277
|
+
XF
|
|
5278
5278
|
]),
|
|
5279
5279
|
onTriggerLeave: React$1.useCallback(() => {
|
|
5280
|
-
Z ?
|
|
5281
|
-
}, [
|
|
5282
|
-
onOpen:
|
|
5283
|
-
onClose:
|
|
5280
|
+
Z ? ZF() : (window.clearTimeout(G.current), G.current = 0);
|
|
5281
|
+
}, [ZF, Z]),
|
|
5282
|
+
onOpen: XF,
|
|
5283
|
+
onClose: ZF,
|
|
5284
5284
|
disableHoverableContent: Z,
|
|
5285
5285
|
children: O
|
|
5286
5286
|
})
|
|
@@ -6093,14 +6093,14 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
6093
6093
|
React$1.useEffect(() => U(O), [O]);
|
|
6094
6094
|
let [W, G] = React$1.useState(A);
|
|
6095
6095
|
React$1.useEffect(() => G(A), [A]);
|
|
6096
|
-
let [Z,
|
|
6097
|
-
React$1.useEffect(() =>
|
|
6098
|
-
let [
|
|
6099
|
-
React$1.useEffect(() =>
|
|
6100
|
-
let [
|
|
6101
|
-
React$1.useEffect(() =>
|
|
6102
|
-
let [
|
|
6103
|
-
return React$1.useEffect(() =>
|
|
6096
|
+
let [Z, GF] = React$1.useState(j);
|
|
6097
|
+
React$1.useEffect(() => GF(j), [j]);
|
|
6098
|
+
let [KF, qF] = React$1.useState(M);
|
|
6099
|
+
React$1.useEffect(() => qF(M), [M]);
|
|
6100
|
+
let [JF, YF] = React$1.useState(N);
|
|
6101
|
+
React$1.useEffect(() => YF(N), [N]);
|
|
6102
|
+
let [XF, ZF] = React$1.useState(P);
|
|
6103
|
+
return React$1.useEffect(() => ZF(P), [P]), React$1.createElement(A$2, {
|
|
6104
6104
|
...B,
|
|
6105
6105
|
ref: E,
|
|
6106
6106
|
isRoot: !0,
|
|
@@ -6108,62 +6108,62 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
6108
6108
|
appearance: H,
|
|
6109
6109
|
accentColor: W,
|
|
6110
6110
|
grayColor: Z,
|
|
6111
|
-
panelBackground:
|
|
6112
|
-
radius:
|
|
6113
|
-
scaling:
|
|
6111
|
+
panelBackground: KF,
|
|
6112
|
+
radius: JF,
|
|
6113
|
+
scaling: XF,
|
|
6114
6114
|
onAppearanceChange: U,
|
|
6115
6115
|
onAccentColorChange: G,
|
|
6116
|
-
onGrayColorChange:
|
|
6117
|
-
onPanelBackgroundChange:
|
|
6118
|
-
onRadiusChange:
|
|
6119
|
-
onScalingChange:
|
|
6116
|
+
onGrayColorChange: GF,
|
|
6117
|
+
onPanelBackgroundChange: qF,
|
|
6118
|
+
onRadiusChange: YF,
|
|
6119
|
+
onScalingChange: ZF
|
|
6120
6120
|
});
|
|
6121
6121
|
});
|
|
6122
6122
|
I$3.displayName = "ThemeRoot";
|
|
6123
6123
|
var A$2 = React$1.forwardRef((_, E) => {
|
|
6124
|
-
let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange:
|
|
6124
|
+
let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange: GF = d$5, onRadiusChange: KF = d$5, onScalingChange: qF = d$5, ...JF } = _, YF = A ? Slot$3 : "div", XF = z === "auto" ? a$12(P) : z, ZF = _.appearance === "light" || _.appearance === "dark", QF = M === void 0 ? j || ZF : M;
|
|
6125
6125
|
return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
|
|
6126
6126
|
appearance: N,
|
|
6127
6127
|
accentColor: P,
|
|
6128
6128
|
grayColor: z,
|
|
6129
|
-
resolvedGrayColor:
|
|
6129
|
+
resolvedGrayColor: XF,
|
|
6130
6130
|
panelBackground: B,
|
|
6131
6131
|
radius: H,
|
|
6132
6132
|
scaling: U,
|
|
6133
6133
|
onAppearanceChange: W,
|
|
6134
6134
|
onAccentColorChange: G,
|
|
6135
6135
|
onGrayColorChange: Z,
|
|
6136
|
-
onPanelBackgroundChange:
|
|
6137
|
-
onRadiusChange:
|
|
6138
|
-
onScalingChange:
|
|
6136
|
+
onPanelBackgroundChange: GF,
|
|
6137
|
+
onRadiusChange: KF,
|
|
6138
|
+
onScalingChange: qF
|
|
6139
6139
|
}), [
|
|
6140
6140
|
N,
|
|
6141
6141
|
P,
|
|
6142
6142
|
z,
|
|
6143
|
-
|
|
6143
|
+
XF,
|
|
6144
6144
|
B,
|
|
6145
6145
|
H,
|
|
6146
6146
|
U,
|
|
6147
6147
|
W,
|
|
6148
6148
|
G,
|
|
6149
6149
|
Z,
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
]) }, React$1.createElement(
|
|
6150
|
+
GF,
|
|
6151
|
+
KF,
|
|
6152
|
+
qF
|
|
6153
|
+
]) }, React$1.createElement(YF, {
|
|
6154
6154
|
"data-is-root-theme": j ? "true" : "false",
|
|
6155
6155
|
"data-accent-color": P,
|
|
6156
|
-
"data-gray-color":
|
|
6157
|
-
"data-has-background":
|
|
6156
|
+
"data-gray-color": XF,
|
|
6157
|
+
"data-has-background": QF ? "true" : "false",
|
|
6158
6158
|
"data-panel-background": B,
|
|
6159
6159
|
"data-radius": H,
|
|
6160
6160
|
"data-scaling": U,
|
|
6161
6161
|
ref: E,
|
|
6162
|
-
...
|
|
6162
|
+
...JF,
|
|
6163
6163
|
className: (0, import_classnames$20.default)("radix-themes", {
|
|
6164
6164
|
light: N === "light",
|
|
6165
6165
|
dark: N === "dark"
|
|
6166
|
-
},
|
|
6166
|
+
}, JF.className)
|
|
6167
6167
|
}));
|
|
6168
6168
|
});
|
|
6169
6169
|
A$2.displayName = "ThemeImpl";
|
|
@@ -6935,7 +6935,7 @@ function S$2(n) {
|
|
|
6935
6935
|
return [(0, import_classnames$12.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
|
|
6936
6936
|
}
|
|
6937
6937
|
var import_classnames$11 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((_, E) => {
|
|
6938
|
-
let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars:
|
|
6938
|
+
let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars: GF = t$3.scrollbars.default, ...KF } = O;
|
|
6939
6939
|
return React$1.createElement(Root$1, {
|
|
6940
6940
|
type: H,
|
|
6941
6941
|
scrollHideDelay: U,
|
|
@@ -6946,10 +6946,10 @@ var import_classnames$11 = /* @__PURE__ */ __toESM(require_classnames()), c = Re
|
|
|
6946
6946
|
asChild: N,
|
|
6947
6947
|
children: P
|
|
6948
6948
|
}, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
6949
|
-
...
|
|
6949
|
+
...KF,
|
|
6950
6950
|
ref: E,
|
|
6951
6951
|
className: "rt-ScrollAreaViewport"
|
|
6952
|
-
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
6952
|
+
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), GF === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
6953
6953
|
"data-radius": Z,
|
|
6954
6954
|
orientation: "horizontal",
|
|
6955
6955
|
className: (0, import_classnames$11.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6957,7 +6957,7 @@ var import_classnames$11 = /* @__PURE__ */ __toESM(require_classnames()), c = Re
|
|
|
6957
6957
|
value: G,
|
|
6958
6958
|
propValues: t$3.size.values
|
|
6959
6959
|
}))
|
|
6960
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6960
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), GF === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
6961
6961
|
"data-radius": Z,
|
|
6962
6962
|
orientation: "vertical",
|
|
6963
6963
|
className: (0, import_classnames$11.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6965,7 +6965,7 @@ var import_classnames$11 = /* @__PURE__ */ __toESM(require_classnames()), c = Re
|
|
|
6965
6965
|
value: G,
|
|
6966
6966
|
propValues: t$3.size.values
|
|
6967
6967
|
}))
|
|
6968
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6968
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), GF === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
6969
6969
|
});
|
|
6970
6970
|
c.displayName = "ScrollArea";
|
|
6971
6971
|
var n$2 = {
|
|
@@ -8231,17 +8231,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
8231
8231
|
E.forEach((n) => {
|
|
8232
8232
|
let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
|
|
8233
8233
|
U = j ? B === "horizontal" ? (_.clientX - j.x) / P * 100 : (_.clientY - j.y) / P * 100 : B === "horizontal" ? _.clientX < 0 ? -100 : 100 : _.clientY < 0 ? -100 : 100;
|
|
8234
|
-
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout:
|
|
8235
|
-
if (Z && W &&
|
|
8234
|
+
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: GF, separatorToPanels: KF } = A.get(E) ?? { defaultLayoutDeferred: !1 };
|
|
8235
|
+
if (Z && W && GF && KF) {
|
|
8236
8236
|
let _ = Z$1({
|
|
8237
8237
|
delta: U,
|
|
8238
8238
|
initialLayout: W,
|
|
8239
8239
|
panelConstraints: Z,
|
|
8240
8240
|
pivotIndices: n.panels.map((n) => H.indexOf(n)),
|
|
8241
|
-
prevLayout:
|
|
8241
|
+
prevLayout: GF,
|
|
8242
8242
|
trigger: "mouse-or-touch"
|
|
8243
8243
|
});
|
|
8244
|
-
if (B$1(_,
|
|
8244
|
+
if (B$1(_, GF)) {
|
|
8245
8245
|
if (U !== 0 && !z) switch (B) {
|
|
8246
8246
|
case "horizontal":
|
|
8247
8247
|
M |= U < 0 ? De : Oe$1;
|
|
@@ -8255,7 +8255,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
8255
8255
|
defaultLayoutDeferred: G,
|
|
8256
8256
|
derivedPanelConstraints: Z,
|
|
8257
8257
|
layout: _,
|
|
8258
|
-
separatorToPanels:
|
|
8258
|
+
separatorToPanels: KF
|
|
8259
8259
|
});
|
|
8260
8260
|
let E = n.group.panels.map(({ id: n }) => n).join(",");
|
|
8261
8261
|
n.group.inMemoryLayouts[E] = _;
|
|
@@ -8467,64 +8467,64 @@ function Pt(n, _) {
|
|
|
8467
8467
|
function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, disabled: A, elementRef: j, groupRef: M, id: N, onLayoutChange: P, orientation: z = "horizontal", style: B, ...H }) {
|
|
8468
8468
|
let U = useRef({}), W = le$1((n) => {
|
|
8469
8469
|
B$1(U.current, n) || (U.current = n, P?.(n));
|
|
8470
|
-
}), Z = ae$1(N),
|
|
8470
|
+
}), Z = ae$1(N), GF = useRef(null), [KF, qF] = useState(!1), [YF, QF] = useState(E ?? {}), [$F, eI] = wt(), tI = useRef({
|
|
8471
8471
|
lastExpandedPanelSizes: {},
|
|
8472
8472
|
layouts: {},
|
|
8473
8473
|
panels: [],
|
|
8474
8474
|
separators: []
|
|
8475
|
-
}),
|
|
8475
|
+
}), nI = ue$1(GF, j);
|
|
8476
8476
|
Pt(Z, M);
|
|
8477
|
-
let
|
|
8477
|
+
let rI = useMemo(() => ({
|
|
8478
8478
|
id: Z,
|
|
8479
8479
|
orientation: z,
|
|
8480
8480
|
registerPanel: (n) => {
|
|
8481
|
-
let _ =
|
|
8482
|
-
return _.panels = ie$1(z, [..._.panels, n]),
|
|
8483
|
-
_.panels = _.panels.filter((_) => _ !== n),
|
|
8481
|
+
let _ = tI.current;
|
|
8482
|
+
return _.panels = ie$1(z, [..._.panels, n]), eI(), () => {
|
|
8483
|
+
_.panels = _.panels.filter((_) => _ !== n), eI();
|
|
8484
8484
|
};
|
|
8485
8485
|
},
|
|
8486
8486
|
registerSeparator: (n) => {
|
|
8487
|
-
let _ =
|
|
8488
|
-
return _.separators = ie$1(z, [..._.separators, n]),
|
|
8489
|
-
_.separators = _.separators.filter((_) => _ !== n),
|
|
8487
|
+
let _ = tI.current;
|
|
8488
|
+
return _.separators = ie$1(z, [..._.separators, n]), eI(), () => {
|
|
8489
|
+
_.separators = _.separators.filter((_) => _ !== n), eI();
|
|
8490
8490
|
};
|
|
8491
8491
|
}
|
|
8492
8492
|
}), [
|
|
8493
8493
|
Z,
|
|
8494
|
-
|
|
8494
|
+
eI,
|
|
8495
8495
|
z
|
|
8496
|
-
]),
|
|
8496
|
+
]), aI = Lt({
|
|
8497
8497
|
defaultLayout: E,
|
|
8498
8498
|
disableCursor: O
|
|
8499
|
-
}),
|
|
8499
|
+
}), oI = useRef(null);
|
|
8500
8500
|
A$1(() => {
|
|
8501
|
-
let n =
|
|
8501
|
+
let n = GF.current;
|
|
8502
8502
|
if (n === null) return;
|
|
8503
|
-
let _ =
|
|
8504
|
-
defaultLayout:
|
|
8505
|
-
disableCursor: !!
|
|
8503
|
+
let _ = tI.current, E = {
|
|
8504
|
+
defaultLayout: aI.defaultLayout,
|
|
8505
|
+
disableCursor: !!aI.disableCursor,
|
|
8506
8506
|
disabled: !!A,
|
|
8507
8507
|
element: n,
|
|
8508
8508
|
id: Z,
|
|
8509
|
-
inMemoryLastExpandedPanelSizes:
|
|
8510
|
-
inMemoryLayouts:
|
|
8509
|
+
inMemoryLastExpandedPanelSizes: tI.current.lastExpandedPanelSizes,
|
|
8510
|
+
inMemoryLayouts: tI.current.layouts,
|
|
8511
8511
|
orientation: z,
|
|
8512
8512
|
panels: _.panels,
|
|
8513
8513
|
separators: _.separators
|
|
8514
8514
|
};
|
|
8515
|
-
|
|
8515
|
+
oI.current = E;
|
|
8516
8516
|
let O = bt(E), j = D$1().mountedGroups.get(E);
|
|
8517
8517
|
if (j) {
|
|
8518
8518
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
|
|
8519
|
-
!n && _.length > 0 && (
|
|
8519
|
+
!n && _.length > 0 && (QF(E), W?.(E));
|
|
8520
8520
|
}
|
|
8521
8521
|
let M = T$1.addListener("interactionStateChange", (n) => {
|
|
8522
8522
|
switch (n.state) {
|
|
8523
8523
|
case "active":
|
|
8524
|
-
|
|
8524
|
+
qF(n.hitRegions.some((n) => n.group === E));
|
|
8525
8525
|
break;
|
|
8526
8526
|
default:
|
|
8527
|
-
|
|
8527
|
+
qF(!1);
|
|
8528
8528
|
break;
|
|
8529
8529
|
}
|
|
8530
8530
|
}), N = T$1.addListener("mountedGroupsChange", (n) => {
|
|
@@ -8532,30 +8532,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8532
8532
|
if (_) {
|
|
8533
8533
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
|
|
8534
8534
|
if (n || E.length === 0) return;
|
|
8535
|
-
|
|
8535
|
+
QF(O), W?.(O);
|
|
8536
8536
|
}
|
|
8537
8537
|
});
|
|
8538
8538
|
return () => {
|
|
8539
|
-
|
|
8539
|
+
oI.current = null, O(), M(), N();
|
|
8540
8540
|
};
|
|
8541
8541
|
}, [
|
|
8542
8542
|
A,
|
|
8543
8543
|
Z,
|
|
8544
8544
|
W,
|
|
8545
8545
|
z,
|
|
8546
|
-
|
|
8547
|
-
|
|
8546
|
+
$F,
|
|
8547
|
+
aI
|
|
8548
8548
|
]), useEffect(() => {
|
|
8549
|
-
let n =
|
|
8549
|
+
let n = oI.current;
|
|
8550
8550
|
n && (n.defaultLayout = E, n.disableCursor = !!O);
|
|
8551
8551
|
});
|
|
8552
|
-
let
|
|
8553
|
-
for (let n in
|
|
8552
|
+
let sI = { [Fe]: KF ? "none" : void 0 };
|
|
8553
|
+
for (let n in YF) {
|
|
8554
8554
|
let _ = Ve(Z, n);
|
|
8555
|
-
|
|
8555
|
+
sI[_] = YF[n];
|
|
8556
8556
|
}
|
|
8557
8557
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
8558
|
-
value:
|
|
8558
|
+
value: rI,
|
|
8559
8559
|
children: /* @__PURE__ */ jsx("div", {
|
|
8560
8560
|
...H,
|
|
8561
8561
|
"aria-orientation": z,
|
|
@@ -8563,13 +8563,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8563
8563
|
"data-group": !0,
|
|
8564
8564
|
"data-testid": Z,
|
|
8565
8565
|
id: Z,
|
|
8566
|
-
ref:
|
|
8566
|
+
ref: nI,
|
|
8567
8567
|
style: {
|
|
8568
8568
|
height: "100%",
|
|
8569
8569
|
width: "100%",
|
|
8570
8570
|
overflow: "hidden",
|
|
8571
8571
|
...B,
|
|
8572
|
-
...
|
|
8572
|
+
...sI,
|
|
8573
8573
|
display: "flex",
|
|
8574
8574
|
flexDirection: z === "horizontal" ? "row" : "column",
|
|
8575
8575
|
flexWrap: "nowrap"
|
|
@@ -8687,12 +8687,12 @@ function It(n, _) {
|
|
|
8687
8687
|
});
|
|
8688
8688
|
}
|
|
8689
8689
|
function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O = !1, defaultSize: A, elementRef: j, id: M, maxSize: N = "100%", minSize: P = "0%", onResize: z, panelRef: B, style: H, ...U }) {
|
|
8690
|
-
let W = !!M, G = ae$1(M), Z = useRef(null),
|
|
8690
|
+
let W = !!M, G = ae$1(M), Z = useRef(null), GF = ue$1(Z, j), { id: KF, registerPanel: qF } = ce$1(), JF = z !== null, YF = le$1((n, _, E) => {
|
|
8691
8691
|
z?.(n, M, E);
|
|
8692
8692
|
});
|
|
8693
8693
|
A$1(() => {
|
|
8694
8694
|
let n = Z.current;
|
|
8695
|
-
if (n !== null) return
|
|
8695
|
+
if (n !== null) return qF({
|
|
8696
8696
|
element: n,
|
|
8697
8697
|
id: G,
|
|
8698
8698
|
idIsStable: W,
|
|
@@ -8700,7 +8700,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8700
8700
|
expandToSize: void 0,
|
|
8701
8701
|
prevSize: void 0
|
|
8702
8702
|
},
|
|
8703
|
-
onResize:
|
|
8703
|
+
onResize: JF ? YF : void 0,
|
|
8704
8704
|
panelConstraints: {
|
|
8705
8705
|
collapsedSize: E,
|
|
8706
8706
|
collapsible: O,
|
|
@@ -8713,25 +8713,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8713
8713
|
E,
|
|
8714
8714
|
O,
|
|
8715
8715
|
A,
|
|
8716
|
-
|
|
8716
|
+
JF,
|
|
8717
8717
|
G,
|
|
8718
8718
|
W,
|
|
8719
8719
|
N,
|
|
8720
8720
|
P,
|
|
8721
|
-
|
|
8722
|
-
|
|
8721
|
+
YF,
|
|
8722
|
+
qF
|
|
8723
8723
|
]), It(G, B);
|
|
8724
|
-
let
|
|
8724
|
+
let ZF = Ve(KF, G);
|
|
8725
8725
|
return /* @__PURE__ */ jsx("div", {
|
|
8726
8726
|
...U,
|
|
8727
8727
|
"data-panel": !0,
|
|
8728
8728
|
"data-testid": G,
|
|
8729
8729
|
id: G,
|
|
8730
|
-
ref:
|
|
8730
|
+
ref: GF,
|
|
8731
8731
|
style: {
|
|
8732
8732
|
...Gt,
|
|
8733
8733
|
flexBasis: 0,
|
|
8734
|
-
flexGrow: `var(${
|
|
8734
|
+
flexGrow: `var(${ZF}, 1)`,
|
|
8735
8735
|
flexShrink: 1,
|
|
8736
8736
|
overflow: "hidden",
|
|
8737
8737
|
pointerEvents: `var(${Fe})`
|
|
@@ -8794,7 +8794,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
|
|
|
8794
8794
|
};
|
|
8795
8795
|
}
|
|
8796
8796
|
function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j }) {
|
|
8797
|
-
let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(),
|
|
8797
|
+
let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(), GF = G === "horizontal" ? "vertical" : "horizontal";
|
|
8798
8798
|
return A$1(() => {
|
|
8799
8799
|
let n = H.current;
|
|
8800
8800
|
if (n !== null) {
|
|
@@ -8830,7 +8830,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8830
8830
|
]), /* @__PURE__ */ jsx("div", {
|
|
8831
8831
|
...j,
|
|
8832
8832
|
"aria-controls": N.valueControls,
|
|
8833
|
-
"aria-orientation":
|
|
8833
|
+
"aria-orientation": GF,
|
|
8834
8834
|
"aria-valuemax": N.valueMax,
|
|
8835
8835
|
"aria-valuemin": N.valueMin,
|
|
8836
8836
|
"aria-valuenow": N.valueNow,
|
|
@@ -8851,6 +8851,79 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8851
8851
|
});
|
|
8852
8852
|
}
|
|
8853
8853
|
Ot.displayName = "Separator";
|
|
8854
|
+
var package_default = {
|
|
8855
|
+
name: "@1urso/generic-editor",
|
|
8856
|
+
version: "0.1.66",
|
|
8857
|
+
publishConfig: { access: "public" },
|
|
8858
|
+
type: "module",
|
|
8859
|
+
main: "./dist/generic-editor.umd.cjs",
|
|
8860
|
+
module: "./dist/generic-editor.js",
|
|
8861
|
+
types: "./dist/index.d.ts",
|
|
8862
|
+
exports: {
|
|
8863
|
+
".": {
|
|
8864
|
+
import: "./dist/generic-editor.js",
|
|
8865
|
+
require: "./dist/generic-editor.umd.cjs"
|
|
8866
|
+
},
|
|
8867
|
+
"./dist/generic-editor.css": "./dist/generic-editor.css"
|
|
8868
|
+
},
|
|
8869
|
+
files: ["dist", "README.md"],
|
|
8870
|
+
scripts: {
|
|
8871
|
+
dev: "vite",
|
|
8872
|
+
build: "tsc -b && vite build",
|
|
8873
|
+
"build:demo": "tsc -b && vite build -c vite.config.demo.ts",
|
|
8874
|
+
lint: "eslint .",
|
|
8875
|
+
preview: "vite preview",
|
|
8876
|
+
"pack:local": "npm run build && npm pack"
|
|
8877
|
+
},
|
|
8878
|
+
peerDependencies: {
|
|
8879
|
+
"@dnd-kit/core": "^6.3.1",
|
|
8880
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
8881
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
8882
|
+
"@emotion/react": "^11.14.0",
|
|
8883
|
+
"@emotion/styled": "^11.14.1",
|
|
8884
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
8885
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
8886
|
+
"@radix-ui/themes": "^3.2.1",
|
|
8887
|
+
"framer-motion": "^12.24.12",
|
|
8888
|
+
"re-resizable": "^6.11.2",
|
|
8889
|
+
react: "^19.2.0",
|
|
8890
|
+
"react-dom": "^19.2.0",
|
|
8891
|
+
"react-resizable-panels": "^4.3.1"
|
|
8892
|
+
},
|
|
8893
|
+
devDependencies: {
|
|
8894
|
+
"@dnd-kit/core": "^6.3.1",
|
|
8895
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
8896
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
8897
|
+
"@emotion/react": "^11.14.0",
|
|
8898
|
+
"@emotion/styled": "^11.14.1",
|
|
8899
|
+
"@eslint/js": "^9.39.1",
|
|
8900
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
8901
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
8902
|
+
"@radix-ui/themes": "^3.2.1",
|
|
8903
|
+
"@types/node": "^24.10.1",
|
|
8904
|
+
"@types/react": "^19.2.5",
|
|
8905
|
+
"@types/react-dom": "^19.2.3",
|
|
8906
|
+
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
8907
|
+
eslint: "^9.39.1",
|
|
8908
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
8909
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
8910
|
+
"framer-motion": "^12.24.12",
|
|
8911
|
+
globals: "^16.5.0",
|
|
8912
|
+
"re-resizable": "^6.11.2",
|
|
8913
|
+
react: "^19.2.0",
|
|
8914
|
+
"react-dom": "^19.2.0",
|
|
8915
|
+
"react-resizable-panels": "^4.3.1",
|
|
8916
|
+
typescript: "~5.9.3",
|
|
8917
|
+
"typescript-eslint": "^8.46.4",
|
|
8918
|
+
vite: "npm:rolldown-vite@7.2.5",
|
|
8919
|
+
"vite-plugin-dts": "^4.5.4"
|
|
8920
|
+
},
|
|
8921
|
+
resolutions: { vite: "npm:rolldown-vite@7.2.5" },
|
|
8922
|
+
dependencies: {
|
|
8923
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
8924
|
+
"react-colorful": "^5.6.1"
|
|
8925
|
+
}
|
|
8926
|
+
};
|
|
8854
8927
|
const EditorContext = createContext(void 0);
|
|
8855
8928
|
var SAFE_FONTS = [
|
|
8856
8929
|
"Arial",
|
|
@@ -9008,7 +9081,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9008
9081
|
historyIndex: n,
|
|
9009
9082
|
selectedElementIds: []
|
|
9010
9083
|
} : _);
|
|
9011
|
-
}, []),
|
|
9084
|
+
}, []), GF = React.useCallback(() => {
|
|
9012
9085
|
M((n) => {
|
|
9013
9086
|
if (n.selectedElementIds.length > 0) {
|
|
9014
9087
|
let _ = n.elements.filter((_) => n.selectedElementIds.includes(_.id));
|
|
@@ -9019,7 +9092,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9019
9092
|
}
|
|
9020
9093
|
return n;
|
|
9021
9094
|
});
|
|
9022
|
-
}, []),
|
|
9095
|
+
}, []), KF = React.useCallback(() => {
|
|
9023
9096
|
M((n) => {
|
|
9024
9097
|
if (n.clipboard.length > 0) {
|
|
9025
9098
|
let _ = n.clipboard.map((n) => ({
|
|
@@ -9038,7 +9111,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9038
9111
|
}
|
|
9039
9112
|
return n;
|
|
9040
9113
|
});
|
|
9041
|
-
}, []),
|
|
9114
|
+
}, []), qF = React.useCallback((n) => {
|
|
9042
9115
|
let _ = {};
|
|
9043
9116
|
n.type === "box" && (_.backgroundColor = "var(--gray-4)"), n.type === "text-container" && (_.backgroundColor = "var(--gray-4)", _.border = "1px solid var(--gray-8)", _.padding = "8px", _.display = "flex", _.alignItems = "flex-start", _.justifyContent = "flex-start");
|
|
9044
9117
|
let E = {
|
|
@@ -9063,7 +9136,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9063
9136
|
selectedElementIds: [E.id]
|
|
9064
9137
|
};
|
|
9065
9138
|
});
|
|
9066
|
-
}, []),
|
|
9139
|
+
}, []), JF = React.useCallback((n) => {
|
|
9067
9140
|
M((_) => {
|
|
9068
9141
|
let E = _.elements.filter((_) => _.id !== n), O = _.history.slice(0, _.historyIndex + 1);
|
|
9069
9142
|
O.push(E);
|
|
@@ -9077,7 +9150,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9077
9150
|
historyIndex: O.length - 1
|
|
9078
9151
|
};
|
|
9079
9152
|
});
|
|
9080
|
-
}, []),
|
|
9153
|
+
}, []), YF = React.useCallback(() => {
|
|
9081
9154
|
M((n) => {
|
|
9082
9155
|
if (n.selectedElementIds.length === 0) return n;
|
|
9083
9156
|
let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
|
|
@@ -9092,7 +9165,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9092
9165
|
historyIndex: E.length - 1
|
|
9093
9166
|
};
|
|
9094
9167
|
});
|
|
9095
|
-
}, []),
|
|
9168
|
+
}, []), XF = React.useCallback((n, _ = !1) => {
|
|
9096
9169
|
M((E) => {
|
|
9097
9170
|
if (n === null) return {
|
|
9098
9171
|
...E,
|
|
@@ -9109,12 +9182,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9109
9182
|
selectedElementIds: [n]
|
|
9110
9183
|
};
|
|
9111
9184
|
});
|
|
9112
|
-
}, []),
|
|
9185
|
+
}, []), QF = React.useCallback((n) => {
|
|
9113
9186
|
M((_) => ({
|
|
9114
9187
|
..._,
|
|
9115
9188
|
selectedElementIds: n
|
|
9116
9189
|
}));
|
|
9117
|
-
}, []),
|
|
9190
|
+
}, []), $F = React.useCallback((n, _) => {
|
|
9118
9191
|
M((E) => {
|
|
9119
9192
|
let O = [...E.elements], A = O[n];
|
|
9120
9193
|
O.splice(n, 1), O.splice(_, 0, A);
|
|
@@ -9126,7 +9199,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9126
9199
|
historyIndex: j.length - 1
|
|
9127
9200
|
};
|
|
9128
9201
|
});
|
|
9129
|
-
}, []),
|
|
9202
|
+
}, []), eI = React.useCallback((n, _, E = !0) => {
|
|
9130
9203
|
M((O) => {
|
|
9131
9204
|
let A = O.elements.map((E) => E.id === n ? {
|
|
9132
9205
|
...E,
|
|
@@ -9139,7 +9212,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9139
9212
|
historyIndex: M
|
|
9140
9213
|
};
|
|
9141
9214
|
});
|
|
9142
|
-
}, []),
|
|
9215
|
+
}, []), tI = React.useCallback((n, _ = !0) => {
|
|
9143
9216
|
M((E) => {
|
|
9144
9217
|
let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
|
|
9145
9218
|
n.forEach(({ id: n, changes: _ }) => {
|
|
@@ -9193,7 +9266,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9193
9266
|
historyIndex: P
|
|
9194
9267
|
};
|
|
9195
9268
|
});
|
|
9196
|
-
}, []),
|
|
9269
|
+
}, []), nI = React.useCallback((n) => {
|
|
9197
9270
|
M((_) => {
|
|
9198
9271
|
let E = _.elements.filter((_) => n.includes(_.id));
|
|
9199
9272
|
if (E.length === 0) return _;
|
|
@@ -9224,7 +9297,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9224
9297
|
historyIndex: z.length - 1
|
|
9225
9298
|
};
|
|
9226
9299
|
});
|
|
9227
|
-
}, []),
|
|
9300
|
+
}, []), rI = React.useCallback((n) => {
|
|
9228
9301
|
M((_) => {
|
|
9229
9302
|
let E = _.elements.find((_) => _.id === n);
|
|
9230
9303
|
if (!E || E.type !== "group") return _;
|
|
@@ -9243,7 +9316,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9243
9316
|
historyIndex: j.length - 1
|
|
9244
9317
|
};
|
|
9245
9318
|
});
|
|
9246
|
-
}, []),
|
|
9319
|
+
}, []), aI = React.useCallback((n, _) => {
|
|
9247
9320
|
M((E) => {
|
|
9248
9321
|
let O = E.elements.map((E) => E.id === n ? {
|
|
9249
9322
|
...E,
|
|
@@ -9254,7 +9327,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9254
9327
|
elements: O
|
|
9255
9328
|
};
|
|
9256
9329
|
});
|
|
9257
|
-
}, []),
|
|
9330
|
+
}, []), oI = React.useCallback((n, _) => {
|
|
9258
9331
|
if (!n.find((n) => n.id === _ && n.type === "group")) return n;
|
|
9259
9332
|
let E = n.filter((n) => n.groupId === _);
|
|
9260
9333
|
if (E.length === 0) return n;
|
|
@@ -9266,7 +9339,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9266
9339
|
width: j - O,
|
|
9267
9340
|
height: M - A
|
|
9268
9341
|
} : n);
|
|
9269
|
-
}, []),
|
|
9342
|
+
}, []), sI = React.useCallback((n, _) => {
|
|
9270
9343
|
M((E) => {
|
|
9271
9344
|
let O = E.elements.find((_) => _.id === n), A = E.elements.find((n) => n.id === _ && n.type === "group");
|
|
9272
9345
|
if (!O || !A) return E;
|
|
@@ -9274,7 +9347,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9274
9347
|
...E,
|
|
9275
9348
|
groupId: _
|
|
9276
9349
|
} : E);
|
|
9277
|
-
j =
|
|
9350
|
+
j = oI(j, _);
|
|
9278
9351
|
let M = E.history.slice(0, E.historyIndex + 1);
|
|
9279
9352
|
M.push(j);
|
|
9280
9353
|
let N = E.historyDescriptions.slice(0, E.historyIndex + 1);
|
|
@@ -9286,7 +9359,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9286
9359
|
historyIndex: M.length - 1
|
|
9287
9360
|
};
|
|
9288
9361
|
});
|
|
9289
|
-
}, [
|
|
9362
|
+
}, [oI]), cI = React.useCallback((n) => {
|
|
9290
9363
|
M((_) => {
|
|
9291
9364
|
let E = _.elements.find((_) => _.id === n);
|
|
9292
9365
|
if (!E || !E.groupId) return _;
|
|
@@ -9294,7 +9367,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9294
9367
|
..._,
|
|
9295
9368
|
groupId: void 0
|
|
9296
9369
|
} : _);
|
|
9297
|
-
A =
|
|
9370
|
+
A = oI(A, O);
|
|
9298
9371
|
let j = _.history.slice(0, _.historyIndex + 1);
|
|
9299
9372
|
j.push(A);
|
|
9300
9373
|
let M = _.historyDescriptions.slice(0, _.historyIndex + 1);
|
|
@@ -9306,7 +9379,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9306
9379
|
historyIndex: j.length - 1
|
|
9307
9380
|
};
|
|
9308
9381
|
});
|
|
9309
|
-
}, [
|
|
9382
|
+
}, [oI]), lI = React.useCallback((n, _, E) => {
|
|
9310
9383
|
M((O) => {
|
|
9311
9384
|
let A = O.elements.find((_) => _.id === n && _.type === "group");
|
|
9312
9385
|
if (!A) return O;
|
|
@@ -9338,13 +9411,13 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9338
9411
|
historyIndex: B.length - 1
|
|
9339
9412
|
};
|
|
9340
9413
|
});
|
|
9341
|
-
}, []),
|
|
9414
|
+
}, []), uI = React.useCallback((n, _) => {
|
|
9342
9415
|
M((E) => ({
|
|
9343
9416
|
...E,
|
|
9344
9417
|
mockData: n,
|
|
9345
9418
|
singleMockData: _
|
|
9346
9419
|
}));
|
|
9347
|
-
}, []),
|
|
9420
|
+
}, []), dI = React.useCallback((n) => {
|
|
9348
9421
|
M((_) => ({
|
|
9349
9422
|
..._,
|
|
9350
9423
|
listSettings: {
|
|
@@ -9352,81 +9425,81 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9352
9425
|
...n
|
|
9353
9426
|
}
|
|
9354
9427
|
}));
|
|
9355
|
-
}, []),
|
|
9428
|
+
}, []), fI = React.useCallback((n) => {
|
|
9356
9429
|
M((_) => ({
|
|
9357
9430
|
..._,
|
|
9358
9431
|
assets: [..._.assets, n]
|
|
9359
9432
|
}));
|
|
9360
|
-
}, []),
|
|
9433
|
+
}, []), pI = React.useCallback((n) => {
|
|
9361
9434
|
M((_) => ({
|
|
9362
9435
|
..._,
|
|
9363
9436
|
assets: _.assets.filter((_) => _.id !== n)
|
|
9364
9437
|
}));
|
|
9365
|
-
}, []),
|
|
9438
|
+
}, []), mI = React.useMemo(() => ({
|
|
9366
9439
|
state: j,
|
|
9367
|
-
addElement:
|
|
9368
|
-
removeElement:
|
|
9369
|
-
removeSelected:
|
|
9370
|
-
selectElement:
|
|
9371
|
-
setSelectedElements:
|
|
9372
|
-
moveElement:
|
|
9373
|
-
updateElement:
|
|
9374
|
-
updateElements:
|
|
9375
|
-
groupElements:
|
|
9376
|
-
ungroupElements:
|
|
9377
|
-
renameElement:
|
|
9378
|
-
addToGroup:
|
|
9379
|
-
removeFromGroup:
|
|
9380
|
-
resizeGroup:
|
|
9381
|
-
setMockData:
|
|
9382
|
-
updateListSettings:
|
|
9440
|
+
addElement: qF,
|
|
9441
|
+
removeElement: JF,
|
|
9442
|
+
removeSelected: YF,
|
|
9443
|
+
selectElement: XF,
|
|
9444
|
+
setSelectedElements: QF,
|
|
9445
|
+
moveElement: $F,
|
|
9446
|
+
updateElement: eI,
|
|
9447
|
+
updateElements: tI,
|
|
9448
|
+
groupElements: nI,
|
|
9449
|
+
ungroupElements: rI,
|
|
9450
|
+
renameElement: aI,
|
|
9451
|
+
addToGroup: sI,
|
|
9452
|
+
removeFromGroup: cI,
|
|
9453
|
+
resizeGroup: lI,
|
|
9454
|
+
setMockData: uI,
|
|
9455
|
+
updateListSettings: dI,
|
|
9383
9456
|
setCanvasHeight: N,
|
|
9384
9457
|
loadState: U,
|
|
9385
9458
|
undo: W,
|
|
9386
9459
|
redo: G,
|
|
9387
9460
|
jumpToHistory: Z,
|
|
9388
|
-
copy:
|
|
9389
|
-
paste:
|
|
9461
|
+
copy: GF,
|
|
9462
|
+
paste: KF,
|
|
9390
9463
|
setGridSize: P,
|
|
9391
9464
|
setZoom: z,
|
|
9392
9465
|
setPan: B,
|
|
9393
9466
|
setSnapLines: H,
|
|
9394
|
-
addAsset:
|
|
9395
|
-
removeAsset:
|
|
9467
|
+
addAsset: fI,
|
|
9468
|
+
removeAsset: pI
|
|
9396
9469
|
}), [
|
|
9397
9470
|
j,
|
|
9398
|
-
WF,
|
|
9399
|
-
GF,
|
|
9400
|
-
KF,
|
|
9401
9471
|
qF,
|
|
9472
|
+
JF,
|
|
9402
9473
|
YF,
|
|
9403
9474
|
XF,
|
|
9404
|
-
ZF,
|
|
9405
9475
|
QF,
|
|
9406
9476
|
$F,
|
|
9407
9477
|
eI,
|
|
9478
|
+
tI,
|
|
9408
9479
|
nI,
|
|
9409
|
-
|
|
9480
|
+
rI,
|
|
9410
9481
|
aI,
|
|
9411
|
-
oI,
|
|
9412
9482
|
sI,
|
|
9413
9483
|
cI,
|
|
9484
|
+
lI,
|
|
9485
|
+
uI,
|
|
9486
|
+
dI,
|
|
9414
9487
|
N,
|
|
9415
9488
|
U,
|
|
9416
9489
|
W,
|
|
9417
9490
|
G,
|
|
9418
9491
|
Z,
|
|
9419
|
-
|
|
9420
|
-
|
|
9492
|
+
GF,
|
|
9493
|
+
KF,
|
|
9421
9494
|
P,
|
|
9422
9495
|
z,
|
|
9423
9496
|
B,
|
|
9424
9497
|
H,
|
|
9425
|
-
|
|
9426
|
-
|
|
9498
|
+
fI,
|
|
9499
|
+
pI
|
|
9427
9500
|
]);
|
|
9428
9501
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
9429
|
-
value:
|
|
9502
|
+
value: mI,
|
|
9430
9503
|
children: n
|
|
9431
9504
|
});
|
|
9432
9505
|
}, useEditor = () => {
|
|
@@ -9555,7 +9628,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9555
9628
|
id: n.id,
|
|
9556
9629
|
changes: { x: A - n.width / 2 }
|
|
9557
9630
|
};
|
|
9558
|
-
}).filter(
|
|
9631
|
+
}).filter((n) => n !== null));
|
|
9559
9632
|
},
|
|
9560
9633
|
title: "Distribuir Horizontalmente",
|
|
9561
9634
|
children: /* @__PURE__ */ jsx(SpaceEvenlyHorizontallyIcon, {})
|
|
@@ -9574,7 +9647,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9574
9647
|
id: n.id,
|
|
9575
9648
|
changes: { y: A - n.height / 2 }
|
|
9576
9649
|
};
|
|
9577
|
-
}).filter(
|
|
9650
|
+
}).filter((n) => n !== null));
|
|
9578
9651
|
},
|
|
9579
9652
|
title: "Distribuir Verticalmente",
|
|
9580
9653
|
children: /* @__PURE__ */ jsx(SpaceEvenlyVerticallyIcon, {})
|
|
@@ -9868,16 +9941,16 @@ var __assign$1 = function() {
|
|
|
9868
9941
|
maxHeight: _
|
|
9869
9942
|
};
|
|
9870
9943
|
}, _.prototype.calculateNewSizeFromDirection = function(n, _) {
|
|
9871
|
-
var E = this.props.scale || 1, O = normalizeToPair(this.props.resizeRatio || 1), A = O[0], j = O[1], M = this.state, N = M.direction, P = M.original, z = this.props, B = z.lockAspectRatio, H = z.lockAspectRatioExtraHeight, U = z.lockAspectRatioExtraWidth, W = P.width, G = P.height, Z = H || 0,
|
|
9872
|
-
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W -
|
|
9944
|
+
var E = this.props.scale || 1, O = normalizeToPair(this.props.resizeRatio || 1), A = O[0], j = O[1], M = this.state, N = M.direction, P = M.original, z = this.props, B = z.lockAspectRatio, H = z.lockAspectRatioExtraHeight, U = z.lockAspectRatioExtraWidth, W = P.width, G = P.height, Z = H || 0, GF = U || 0;
|
|
9945
|
+
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - GF) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - GF) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + GF)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + GF)), {
|
|
9873
9946
|
newWidth: W,
|
|
9874
9947
|
newHeight: G
|
|
9875
9948
|
};
|
|
9876
9949
|
}, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
|
|
9877
9950
|
var A = this.props, j = A.lockAspectRatio, M = A.lockAspectRatioExtraHeight, N = A.lockAspectRatioExtraWidth, P = O.width === void 0 ? 10 : O.width, z = E.width === void 0 || E.width < 0 ? n : E.width, B = O.height === void 0 ? 10 : O.height, H = E.height === void 0 || E.height < 0 ? _ : E.height, U = M || 0, W = N || 0;
|
|
9878
9951
|
if (j) {
|
|
9879
|
-
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W,
|
|
9880
|
-
n = clamp$1(n,
|
|
9952
|
+
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, GF = (P - W) / this.ratio + U, KF = (z - W) / this.ratio + U, qF = Math.max(P, G), JF = Math.min(z, Z), YF = Math.max(B, GF), XF = Math.min(H, KF);
|
|
9953
|
+
n = clamp$1(n, qF, JF), _ = clamp$1(_, YF, XF);
|
|
9881
9954
|
} else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
|
|
9882
9955
|
return {
|
|
9883
9956
|
newWidth: n,
|
|
@@ -9934,56 +10007,56 @@ var __assign$1 = function() {
|
|
|
9934
10007
|
} catch {}
|
|
9935
10008
|
var E = this.props, O = E.maxWidth, A = E.maxHeight, j = E.minWidth, M = E.minHeight, N = isTouchEvent$1(n) ? n.touches[0].clientX : n.clientX, P = isTouchEvent$1(n) ? n.touches[0].clientY : n.clientY, z = this.state, B = z.direction, H = z.original, U = z.width, W = z.height, G = this.getParentSize(), Z = calculateNewMax(G, this.window.innerWidth, this.window.innerHeight, O, A, j, M);
|
|
9936
10009
|
O = Z.maxWidth, A = Z.maxHeight, j = Z.minWidth, M = Z.minHeight;
|
|
9937
|
-
var
|
|
9938
|
-
this.props.snap && this.props.snap.x && (
|
|
9939
|
-
var
|
|
9940
|
-
width:
|
|
9941
|
-
height:
|
|
10010
|
+
var GF = this.calculateNewSizeFromDirection(N, P), KF = GF.newHeight, qF = GF.newWidth, JF = this.calculateNewMaxFromBoundary(O, A);
|
|
10011
|
+
this.props.snap && this.props.snap.x && (qF = findClosestSnap(qF, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (KF = findClosestSnap(KF, this.props.snap.y, this.props.snapGap));
|
|
10012
|
+
var YF = this.calculateNewSizeFromAspectRatio(qF, KF, {
|
|
10013
|
+
width: JF.maxWidth,
|
|
10014
|
+
height: JF.maxHeight
|
|
9942
10015
|
}, {
|
|
9943
10016
|
width: j,
|
|
9944
10017
|
height: M
|
|
9945
10018
|
});
|
|
9946
|
-
if (
|
|
9947
|
-
var
|
|
9948
|
-
|
|
10019
|
+
if (qF = YF.newWidth, KF = YF.newHeight, this.props.grid) {
|
|
10020
|
+
var XF = snap(qF, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), ZF = snap(KF, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), QF = this.props.snapGap || 0, $F = QF === 0 || Math.abs(XF - qF) <= QF ? XF : qF, eI = QF === 0 || Math.abs(ZF - KF) <= QF ? ZF : KF;
|
|
10021
|
+
qF = $F, KF = eI;
|
|
9949
10022
|
}
|
|
9950
|
-
var
|
|
9951
|
-
width:
|
|
9952
|
-
height:
|
|
10023
|
+
var nI = {
|
|
10024
|
+
width: qF - H.width,
|
|
10025
|
+
height: KF - H.height
|
|
9953
10026
|
};
|
|
9954
|
-
if (this.delta =
|
|
10027
|
+
if (this.delta = nI, U && typeof U == "string") {
|
|
9955
10028
|
if (U.endsWith("%")) {
|
|
9956
|
-
var
|
|
9957
|
-
|
|
10029
|
+
var rI = qF / G.width * 100;
|
|
10030
|
+
qF = `${rI}%`;
|
|
9958
10031
|
} else if (U.endsWith("vw")) {
|
|
9959
|
-
var
|
|
9960
|
-
|
|
10032
|
+
var iI = qF / this.window.innerWidth * 100;
|
|
10033
|
+
qF = `${iI}vw`;
|
|
9961
10034
|
} else if (U.endsWith("vh")) {
|
|
9962
|
-
var
|
|
9963
|
-
|
|
10035
|
+
var aI = qF / this.window.innerHeight * 100;
|
|
10036
|
+
qF = `${aI}vh`;
|
|
9964
10037
|
}
|
|
9965
10038
|
}
|
|
9966
10039
|
if (W && typeof W == "string") {
|
|
9967
10040
|
if (W.endsWith("%")) {
|
|
9968
|
-
var
|
|
9969
|
-
|
|
10041
|
+
var rI = KF / G.height * 100;
|
|
10042
|
+
KF = `${rI}%`;
|
|
9970
10043
|
} else if (W.endsWith("vw")) {
|
|
9971
|
-
var
|
|
9972
|
-
|
|
10044
|
+
var iI = KF / this.window.innerWidth * 100;
|
|
10045
|
+
KF = `${iI}vw`;
|
|
9973
10046
|
} else if (W.endsWith("vh")) {
|
|
9974
|
-
var
|
|
9975
|
-
|
|
10047
|
+
var aI = KF / this.window.innerHeight * 100;
|
|
10048
|
+
KF = `${aI}vh`;
|
|
9976
10049
|
}
|
|
9977
10050
|
}
|
|
9978
|
-
var
|
|
9979
|
-
width: this.createSizeForCssProperty(
|
|
9980
|
-
height: this.createSizeForCssProperty(
|
|
10051
|
+
var oI = {
|
|
10052
|
+
width: this.createSizeForCssProperty(qF, "width"),
|
|
10053
|
+
height: this.createSizeForCssProperty(KF, "height")
|
|
9981
10054
|
};
|
|
9982
|
-
this.flexDir === "row" ?
|
|
9983
|
-
var
|
|
9984
|
-
|
|
9985
|
-
_.setState(
|
|
9986
|
-
}), this.props.onResize &&
|
|
10055
|
+
this.flexDir === "row" ? oI.flexBasis = oI.width : this.flexDir === "column" && (oI.flexBasis = oI.height);
|
|
10056
|
+
var sI = this.state.width !== oI.width, cI = this.state.height !== oI.height, lI = this.state.flexBasis !== oI.flexBasis, uI = sI || cI || lI;
|
|
10057
|
+
uI && flushSync(function() {
|
|
10058
|
+
_.setState(oI);
|
|
10059
|
+
}), this.props.onResize && uI && this.props.onResize(n, B, this.resizable, nI);
|
|
9987
10060
|
}
|
|
9988
10061
|
}, _.prototype.onMouseUp = function(n) {
|
|
9989
10062
|
var _ = this.state, E = _.isResizing, O = _.direction;
|
|
@@ -10082,7 +10155,7 @@ const formatValue$1 = (n, _) => {
|
|
|
10082
10155
|
return String(n);
|
|
10083
10156
|
}
|
|
10084
10157
|
if (_.type === "number") {
|
|
10085
|
-
let E = parseFloat(n);
|
|
10158
|
+
let E = parseFloat(String(n));
|
|
10086
10159
|
return isNaN(E) ? String(n) : _.numberFormat === "currency" ? (_.currencySymbol || "R$") + " " + E.toFixed(_.decimalPlaces || 2) : _.numberFormat === "percent" ? E.toFixed(_.decimalPlaces || 0) + "%" : E.toFixed(_.decimalPlaces || 0);
|
|
10087
10160
|
}
|
|
10088
10161
|
return String(n);
|
|
@@ -11493,32 +11566,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
11493
11566
|
});
|
|
11494
11567
|
}, stopProp = (n) => n.stopPropagation();
|
|
11495
11568
|
const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
11496
|
-
let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z, renameElement: B, groupElements: H, ungroupElements: U } = useEditor(), [W, G] = useState(!1), [Z,
|
|
11569
|
+
let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z, renameElement: B, groupElements: H, ungroupElements: U } = useEditor(), [W, G] = useState(!1), [Z, GF] = useState(!1), [KF, qF] = useState(!1), [JF, YF] = useState(!1), [QF, $F] = useState("formatting"), [eI, tI] = useState({
|
|
11497
11570
|
open: !1,
|
|
11498
11571
|
prop: "",
|
|
11499
11572
|
value: ""
|
|
11500
|
-
}), [
|
|
11501
|
-
let _ =
|
|
11573
|
+
}), [nI, oI] = useState(!1), [sI, cI] = useState(""), [lI, uI] = useState(""), [dI, fI] = useState(_.content), [pI, mI] = useState(_.dataBinding || ""), hI = useRef(null), gI = useRef(null), _I = (n) => {
|
|
11574
|
+
let _ = hI.current;
|
|
11502
11575
|
if (_) {
|
|
11503
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
11504
|
-
|
|
11576
|
+
let E = _.selectionStart, O = _.selectionEnd, A = dI;
|
|
11577
|
+
fI(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
11505
11578
|
_.focus();
|
|
11506
11579
|
let O = E + n.length + 4;
|
|
11507
11580
|
_.setSelectionRange(O, O);
|
|
11508
11581
|
}, 0);
|
|
11509
|
-
} else
|
|
11510
|
-
},
|
|
11582
|
+
} else fI((_) => _ + `{{${n}}}`);
|
|
11583
|
+
}, vI = (n) => {
|
|
11511
11584
|
E(_.id, { style: {
|
|
11512
11585
|
..._.style,
|
|
11513
11586
|
...n
|
|
11514
11587
|
} });
|
|
11515
|
-
},
|
|
11588
|
+
}, yI = () => {
|
|
11516
11589
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11517
11590
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
11518
|
-
},
|
|
11591
|
+
}, bI = () => {
|
|
11519
11592
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11520
11593
|
n > 0 && M(n, 0);
|
|
11521
|
-
},
|
|
11594
|
+
}, xI = () => {
|
|
11522
11595
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
11523
11596
|
type: _.type,
|
|
11524
11597
|
content: _.content,
|
|
@@ -11528,7 +11601,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11528
11601
|
height: _.height,
|
|
11529
11602
|
style: _.style
|
|
11530
11603
|
});
|
|
11531
|
-
},
|
|
11604
|
+
}, SI = [
|
|
11532
11605
|
"#000000",
|
|
11533
11606
|
"#FFFFFF",
|
|
11534
11607
|
"#FF0000",
|
|
@@ -11538,8 +11611,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11538
11611
|
"#808080",
|
|
11539
11612
|
"#800080",
|
|
11540
11613
|
"transparent"
|
|
11541
|
-
],
|
|
11542
|
-
|
|
11614
|
+
], CI = (n, _) => {
|
|
11615
|
+
tI({
|
|
11543
11616
|
open: !0,
|
|
11544
11617
|
prop: n,
|
|
11545
11618
|
value: _
|
|
@@ -11556,8 +11629,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11556
11629
|
direction: "column",
|
|
11557
11630
|
gap: "3",
|
|
11558
11631
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11559
|
-
value:
|
|
11560
|
-
onChange: (n) =>
|
|
11632
|
+
value: lI,
|
|
11633
|
+
onChange: (n) => uI(n.target.value),
|
|
11561
11634
|
placeholder: "Nome da camada..."
|
|
11562
11635
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11563
11636
|
gap: "3",
|
|
@@ -11568,7 +11641,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11568
11641
|
children: "Cancelar"
|
|
11569
11642
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11570
11643
|
onClick: () => {
|
|
11571
|
-
B(_.id,
|
|
11644
|
+
B(_.id, lI), G(!1);
|
|
11572
11645
|
},
|
|
11573
11646
|
children: "Salvar"
|
|
11574
11647
|
})]
|
|
@@ -11578,7 +11651,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11578
11651
|
}),
|
|
11579
11652
|
/* @__PURE__ */ jsx(s$4, {
|
|
11580
11653
|
open: Z,
|
|
11581
|
-
onOpenChange:
|
|
11654
|
+
onOpenChange: GF,
|
|
11582
11655
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11583
11656
|
style: { maxWidth: 450 },
|
|
11584
11657
|
onPointerDown: stopProp,
|
|
@@ -11587,9 +11660,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11587
11660
|
gap: "3",
|
|
11588
11661
|
children: [
|
|
11589
11662
|
/* @__PURE__ */ jsx(r$1, {
|
|
11590
|
-
ref:
|
|
11591
|
-
value:
|
|
11592
|
-
onChange: (n) =>
|
|
11663
|
+
ref: hI,
|
|
11664
|
+
value: dI,
|
|
11665
|
+
onChange: (n) => fI(n.target.value),
|
|
11593
11666
|
placeholder: "Digite o novo texto...",
|
|
11594
11667
|
style: { height: 100 }
|
|
11595
11668
|
}),
|
|
@@ -11607,7 +11680,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11607
11680
|
color: "blue",
|
|
11608
11681
|
variant: "surface",
|
|
11609
11682
|
style: { cursor: "pointer" },
|
|
11610
|
-
onClick: () =>
|
|
11683
|
+
onClick: () => _I(n.dataName),
|
|
11611
11684
|
children: n.name
|
|
11612
11685
|
}, n.dataName))
|
|
11613
11686
|
})]
|
|
@@ -11621,7 +11694,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11621
11694
|
children: "Cancelar"
|
|
11622
11695
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11623
11696
|
onClick: () => {
|
|
11624
|
-
E(_.id, { content:
|
|
11697
|
+
E(_.id, { content: dI }), GF(!1);
|
|
11625
11698
|
},
|
|
11626
11699
|
children: "Salvar"
|
|
11627
11700
|
})]
|
|
@@ -11631,8 +11704,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11631
11704
|
})
|
|
11632
11705
|
}),
|
|
11633
11706
|
/* @__PURE__ */ jsx(s$4, {
|
|
11634
|
-
open:
|
|
11635
|
-
onOpenChange:
|
|
11707
|
+
open: KF,
|
|
11708
|
+
onOpenChange: qF,
|
|
11636
11709
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11637
11710
|
style: { maxWidth: 450 },
|
|
11638
11711
|
onPointerDown: stopProp,
|
|
@@ -11645,8 +11718,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11645
11718
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
11646
11719
|
}),
|
|
11647
11720
|
/* @__PURE__ */ jsx(u$1, {
|
|
11648
|
-
value:
|
|
11649
|
-
onChange: (n) =>
|
|
11721
|
+
value: pI,
|
|
11722
|
+
onChange: (n) => mI(n.target.value),
|
|
11650
11723
|
placeholder: "propriedade"
|
|
11651
11724
|
}),
|
|
11652
11725
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11658,8 +11731,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11658
11731
|
children: "Cancelar"
|
|
11659
11732
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11660
11733
|
onClick: () => {
|
|
11661
|
-
let n =
|
|
11662
|
-
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O),
|
|
11734
|
+
let n = pI, O = { dataBinding: n };
|
|
11735
|
+
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O), qF(!1);
|
|
11663
11736
|
},
|
|
11664
11737
|
children: "Vincular"
|
|
11665
11738
|
})]
|
|
@@ -11669,8 +11742,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11669
11742
|
})
|
|
11670
11743
|
}),
|
|
11671
11744
|
/* @__PURE__ */ jsx(s$4, {
|
|
11672
|
-
open:
|
|
11673
|
-
onOpenChange: (n) =>
|
|
11745
|
+
open: eI.open,
|
|
11746
|
+
onOpenChange: (n) => tI((_) => ({
|
|
11674
11747
|
..._,
|
|
11675
11748
|
open: n
|
|
11676
11749
|
})),
|
|
@@ -11680,8 +11753,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11680
11753
|
children: [
|
|
11681
11754
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
11682
11755
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
11683
|
-
color:
|
|
11684
|
-
onChange: (n) =>
|
|
11756
|
+
color: eI.value,
|
|
11757
|
+
onChange: (n) => tI((_) => ({
|
|
11685
11758
|
..._,
|
|
11686
11759
|
value: n
|
|
11687
11760
|
}))
|
|
@@ -11696,7 +11769,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11696
11769
|
children: "Cancelar"
|
|
11697
11770
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11698
11771
|
onClick: () => {
|
|
11699
|
-
|
|
11772
|
+
vI({ [eI.prop]: eI.value }), tI((n) => ({
|
|
11700
11773
|
...n,
|
|
11701
11774
|
open: !1
|
|
11702
11775
|
}));
|
|
@@ -11709,13 +11782,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11709
11782
|
}),
|
|
11710
11783
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
11711
11784
|
elementId: _.id,
|
|
11712
|
-
open:
|
|
11713
|
-
onOpenChange:
|
|
11714
|
-
initialTab:
|
|
11785
|
+
open: JF,
|
|
11786
|
+
onOpenChange: YF,
|
|
11787
|
+
initialTab: QF
|
|
11715
11788
|
}),
|
|
11716
11789
|
/* @__PURE__ */ jsx(s$4, {
|
|
11717
|
-
open:
|
|
11718
|
-
onOpenChange:
|
|
11790
|
+
open: nI,
|
|
11791
|
+
onOpenChange: oI,
|
|
11719
11792
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11720
11793
|
style: { maxWidth: 450 },
|
|
11721
11794
|
onPointerDown: stopProp,
|
|
@@ -11723,8 +11796,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11723
11796
|
direction: "column",
|
|
11724
11797
|
gap: "3",
|
|
11725
11798
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11726
|
-
value:
|
|
11727
|
-
onChange: (n) =>
|
|
11799
|
+
value: sI,
|
|
11800
|
+
onChange: (n) => cI(n.target.value),
|
|
11728
11801
|
placeholder: "https://exemplo.com/imagem.png"
|
|
11729
11802
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11730
11803
|
gap: "3",
|
|
@@ -11735,7 +11808,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11735
11808
|
children: "Cancelar"
|
|
11736
11809
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11737
11810
|
onClick: () => {
|
|
11738
|
-
E(_.id, { content:
|
|
11811
|
+
E(_.id, { content: sI }), oI(!1);
|
|
11739
11812
|
},
|
|
11740
11813
|
children: "Aplicar"
|
|
11741
11814
|
})]
|
|
@@ -11745,7 +11818,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11745
11818
|
}),
|
|
11746
11819
|
/* @__PURE__ */ jsx("input", {
|
|
11747
11820
|
type: "file",
|
|
11748
|
-
ref:
|
|
11821
|
+
ref: gI,
|
|
11749
11822
|
style: { display: "none" },
|
|
11750
11823
|
accept: "image/*",
|
|
11751
11824
|
onChange: (n) => {
|
|
@@ -11833,7 +11906,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11833
11906
|
className: "ContextMenuItem",
|
|
11834
11907
|
onPointerDown: stopProp,
|
|
11835
11908
|
onSelect: () => {
|
|
11836
|
-
|
|
11909
|
+
mI(_.dataBinding || ""), qF(!0);
|
|
11837
11910
|
},
|
|
11838
11911
|
children: "Outro / Manual..."
|
|
11839
11912
|
}),
|
|
@@ -11851,7 +11924,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11851
11924
|
className: "ContextMenuItem",
|
|
11852
11925
|
onPointerDown: stopProp,
|
|
11853
11926
|
onSelect: () => {
|
|
11854
|
-
|
|
11927
|
+
fI(_.content), GF(!0);
|
|
11855
11928
|
},
|
|
11856
11929
|
children: "Editar Texto..."
|
|
11857
11930
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
@@ -11859,7 +11932,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11859
11932
|
className: "ContextMenuItem",
|
|
11860
11933
|
onPointerDown: stopProp,
|
|
11861
11934
|
onSelect: () => {
|
|
11862
|
-
|
|
11935
|
+
uI(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11863
11936
|
},
|
|
11864
11937
|
children: "Renomear..."
|
|
11865
11938
|
}),
|
|
@@ -11879,14 +11952,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11879
11952
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11880
11953
|
className: "ContextMenuItem",
|
|
11881
11954
|
onPointerDown: stopProp,
|
|
11882
|
-
onSelect: () =>
|
|
11955
|
+
onSelect: () => YF(!0),
|
|
11883
11956
|
children: "Configurações Avançadas..."
|
|
11884
11957
|
}),
|
|
11885
11958
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11886
11959
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11887
11960
|
className: "ContextMenuItem",
|
|
11888
11961
|
onPointerDown: stopProp,
|
|
11889
|
-
onSelect:
|
|
11962
|
+
onSelect: xI,
|
|
11890
11963
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
11891
11964
|
}),
|
|
11892
11965
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11913,13 +11986,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11913
11986
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11914
11987
|
className: "ContextMenuItem",
|
|
11915
11988
|
onPointerDown: stopProp,
|
|
11916
|
-
onSelect: () =>
|
|
11989
|
+
onSelect: () => gI.current?.click(),
|
|
11917
11990
|
children: "Carregar do Computador"
|
|
11918
11991
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11919
11992
|
className: "ContextMenuItem",
|
|
11920
11993
|
onPointerDown: stopProp,
|
|
11921
11994
|
onSelect: () => {
|
|
11922
|
-
|
|
11995
|
+
cI(typeof _.content == "string" ? _.content : ""), oI(!0);
|
|
11923
11996
|
},
|
|
11924
11997
|
children: "Inserir URL"
|
|
11925
11998
|
})]
|
|
@@ -11939,19 +12012,19 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11939
12012
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11940
12013
|
className: "ContextMenuItem",
|
|
11941
12014
|
onPointerDown: stopProp,
|
|
11942
|
-
onSelect: () =>
|
|
12015
|
+
onSelect: () => vI({ objectFit: "cover" }),
|
|
11943
12016
|
children: "Preencher (Cover)"
|
|
11944
12017
|
}),
|
|
11945
12018
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11946
12019
|
className: "ContextMenuItem",
|
|
11947
12020
|
onPointerDown: stopProp,
|
|
11948
|
-
onSelect: () =>
|
|
12021
|
+
onSelect: () => vI({ objectFit: "contain" }),
|
|
11949
12022
|
children: "Ajustar (Contain)"
|
|
11950
12023
|
}),
|
|
11951
12024
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11952
12025
|
className: "ContextMenuItem",
|
|
11953
12026
|
onPointerDown: stopProp,
|
|
11954
|
-
onSelect: () =>
|
|
12027
|
+
onSelect: () => vI({ objectFit: "fill" }),
|
|
11955
12028
|
children: "Esticar (Fill)"
|
|
11956
12029
|
})
|
|
11957
12030
|
]
|
|
@@ -11972,12 +12045,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11972
12045
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11973
12046
|
className: "ContextMenuItem",
|
|
11974
12047
|
onPointerDown: stopProp,
|
|
11975
|
-
onSelect:
|
|
12048
|
+
onSelect: yI,
|
|
11976
12049
|
children: "Trazer para frente"
|
|
11977
12050
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11978
12051
|
className: "ContextMenuItem",
|
|
11979
12052
|
onPointerDown: stopProp,
|
|
11980
|
-
onSelect:
|
|
12053
|
+
onSelect: bI,
|
|
11981
12054
|
children: "Enviar para trás"
|
|
11982
12055
|
})]
|
|
11983
12056
|
}) })] }),
|
|
@@ -11997,7 +12070,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11997
12070
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11998
12071
|
className: "ContextMenuItem",
|
|
11999
12072
|
onPointerDown: stopProp,
|
|
12000
|
-
onSelect: () =>
|
|
12073
|
+
onSelect: () => vI({ fontFamily: n }),
|
|
12001
12074
|
style: { fontFamily: n },
|
|
12002
12075
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
12003
12076
|
className: "RightSlot",
|
|
@@ -12028,7 +12101,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12028
12101
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
12029
12102
|
className: "ContextMenuItem",
|
|
12030
12103
|
onPointerDown: stopProp,
|
|
12031
|
-
onSelect: () =>
|
|
12104
|
+
onSelect: () => vI({ fontSize: `${n}px` }),
|
|
12032
12105
|
children: [n, "px"]
|
|
12033
12106
|
}, n))
|
|
12034
12107
|
}) })] }),
|
|
@@ -12044,10 +12117,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12044
12117
|
sideOffset: 2,
|
|
12045
12118
|
alignOffset: -5,
|
|
12046
12119
|
children: [
|
|
12047
|
-
|
|
12120
|
+
SI.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
12048
12121
|
className: "ContextMenuItem",
|
|
12049
12122
|
onPointerDown: stopProp,
|
|
12050
|
-
onSelect: () =>
|
|
12123
|
+
onSelect: () => vI({ color: n }),
|
|
12051
12124
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12052
12125
|
width: 12,
|
|
12053
12126
|
height: 12,
|
|
@@ -12060,7 +12133,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12060
12133
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12061
12134
|
className: "ContextMenuItem",
|
|
12062
12135
|
onPointerDown: stopProp,
|
|
12063
|
-
onSelect: () =>
|
|
12136
|
+
onSelect: () => CI("color", _.style?.color || "#000000"),
|
|
12064
12137
|
children: "Outra Cor..."
|
|
12065
12138
|
})
|
|
12066
12139
|
]
|
|
@@ -12079,12 +12152,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12079
12152
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
12080
12153
|
className: "ContextMenuItem",
|
|
12081
12154
|
onPointerDown: stopProp,
|
|
12082
|
-
onSelect: () =>
|
|
12155
|
+
onSelect: () => vI({ fontWeight: "normal" }),
|
|
12083
12156
|
children: "Normal"
|
|
12084
12157
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
12085
12158
|
className: "ContextMenuItem",
|
|
12086
12159
|
onPointerDown: stopProp,
|
|
12087
|
-
onSelect: () =>
|
|
12160
|
+
onSelect: () => vI({ fontWeight: "bold" }),
|
|
12088
12161
|
children: "Negrito"
|
|
12089
12162
|
})]
|
|
12090
12163
|
}) })] }),
|
|
@@ -12103,19 +12176,19 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12103
12176
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12104
12177
|
className: "ContextMenuItem",
|
|
12105
12178
|
onPointerDown: stopProp,
|
|
12106
|
-
onSelect: () =>
|
|
12179
|
+
onSelect: () => vI({ textAlign: "left" }),
|
|
12107
12180
|
children: "Esquerda"
|
|
12108
12181
|
}),
|
|
12109
12182
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12110
12183
|
className: "ContextMenuItem",
|
|
12111
12184
|
onPointerDown: stopProp,
|
|
12112
|
-
onSelect: () =>
|
|
12185
|
+
onSelect: () => vI({ textAlign: "center" }),
|
|
12113
12186
|
children: "Centro"
|
|
12114
12187
|
}),
|
|
12115
12188
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12116
12189
|
className: "ContextMenuItem",
|
|
12117
12190
|
onPointerDown: stopProp,
|
|
12118
|
-
onSelect: () =>
|
|
12191
|
+
onSelect: () => vI({ textAlign: "right" }),
|
|
12119
12192
|
children: "Direita"
|
|
12120
12193
|
})
|
|
12121
12194
|
]
|
|
@@ -12135,7 +12208,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12135
12208
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12136
12209
|
className: "ContextMenuItem",
|
|
12137
12210
|
onPointerDown: stopProp,
|
|
12138
|
-
onSelect: () =>
|
|
12211
|
+
onSelect: () => vI({
|
|
12139
12212
|
display: "flex",
|
|
12140
12213
|
flexDirection: "column",
|
|
12141
12214
|
justifyContent: "flex-start"
|
|
@@ -12145,7 +12218,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12145
12218
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12146
12219
|
className: "ContextMenuItem",
|
|
12147
12220
|
onPointerDown: stopProp,
|
|
12148
|
-
onSelect: () =>
|
|
12221
|
+
onSelect: () => vI({
|
|
12149
12222
|
display: "flex",
|
|
12150
12223
|
flexDirection: "column",
|
|
12151
12224
|
justifyContent: "center"
|
|
@@ -12155,7 +12228,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12155
12228
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12156
12229
|
className: "ContextMenuItem",
|
|
12157
12230
|
onPointerDown: stopProp,
|
|
12158
|
-
onSelect: () =>
|
|
12231
|
+
onSelect: () => vI({
|
|
12159
12232
|
display: "flex",
|
|
12160
12233
|
flexDirection: "column",
|
|
12161
12234
|
justifyContent: "flex-end"
|
|
@@ -12177,10 +12250,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12177
12250
|
sideOffset: 2,
|
|
12178
12251
|
alignOffset: -5,
|
|
12179
12252
|
children: [
|
|
12180
|
-
|
|
12253
|
+
SI.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
12181
12254
|
className: "ContextMenuItem",
|
|
12182
12255
|
onPointerDown: stopProp,
|
|
12183
|
-
onSelect: () =>
|
|
12256
|
+
onSelect: () => vI({ backgroundColor: n }),
|
|
12184
12257
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12185
12258
|
width: 12,
|
|
12186
12259
|
height: 12,
|
|
@@ -12193,7 +12266,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12193
12266
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
12194
12267
|
className: "ContextMenuItem",
|
|
12195
12268
|
onPointerDown: stopProp,
|
|
12196
|
-
onSelect: () =>
|
|
12269
|
+
onSelect: () => CI("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
12197
12270
|
children: "Outra Cor..."
|
|
12198
12271
|
})
|
|
12199
12272
|
]
|
|
@@ -12221,7 +12294,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12221
12294
|
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
12222
12295
|
className: "ContextMenuItem",
|
|
12223
12296
|
onPointerDown: stopProp,
|
|
12224
|
-
onSelect: () =>
|
|
12297
|
+
onSelect: () => vI({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
12225
12298
|
children: n === "50%" ? "Círculo" : `${n}px`
|
|
12226
12299
|
}, n)),
|
|
12227
12300
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
@@ -12229,7 +12302,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12229
12302
|
className: "ContextMenuItem",
|
|
12230
12303
|
onPointerDown: stopProp,
|
|
12231
12304
|
onSelect: () => {
|
|
12232
|
-
|
|
12305
|
+
$F("style"), YF(!0);
|
|
12233
12306
|
},
|
|
12234
12307
|
children: "Personalizar..."
|
|
12235
12308
|
})
|
|
@@ -12258,7 +12331,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12258
12331
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
12259
12332
|
className: "ContextMenuItem",
|
|
12260
12333
|
onPointerDown: stopProp,
|
|
12261
|
-
onSelect: () =>
|
|
12334
|
+
onSelect: () => vI({ padding: `${n}px` }),
|
|
12262
12335
|
children: [n, "px"]
|
|
12263
12336
|
}, n)),
|
|
12264
12337
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
@@ -12266,7 +12339,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12266
12339
|
className: "ContextMenuItem",
|
|
12267
12340
|
onPointerDown: stopProp,
|
|
12268
12341
|
onSelect: () => {
|
|
12269
|
-
|
|
12342
|
+
$F("style"), YF(!0);
|
|
12270
12343
|
},
|
|
12271
12344
|
children: "Personalizar..."
|
|
12272
12345
|
})
|
|
@@ -12276,55 +12349,55 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12276
12349
|
}) })] })
|
|
12277
12350
|
] });
|
|
12278
12351
|
}, DraggableElement = React.memo(({ element: n, isSelected: _ }) => {
|
|
12279
|
-
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, W] = useState(!1), Z = useRef(null),
|
|
12352
|
+
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, W] = useState(!1), Z = useRef(null), GF = useRef({
|
|
12280
12353
|
x: 0,
|
|
12281
12354
|
y: 0
|
|
12282
|
-
}),
|
|
12355
|
+
}), KF = useRef({}), qF = useRef(!1), JF = useRef(!1), YF = useRef(0), QF = useRef(0), $F = useRef({
|
|
12283
12356
|
x: 0,
|
|
12284
12357
|
y: 0
|
|
12285
|
-
}),
|
|
12286
|
-
if (
|
|
12287
|
-
if (n.type === "text" || n.type === "text-container")
|
|
12288
|
-
let O =
|
|
12358
|
+
}), eI = useRef(!1), tI = j.canvasHeight || 150, nI = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, rI = n.content, oI = {};
|
|
12359
|
+
if (nI) {
|
|
12360
|
+
if (n.type === "text" || n.type === "text-container") rI = rI.replace(/\{\{(.*?)\}\}/g, (_, E) => {
|
|
12361
|
+
let O = nI[E.trim()];
|
|
12289
12362
|
return O == null ? _ : n.formatting ? formatValue$1(O, n.formatting) : String(O);
|
|
12290
12363
|
});
|
|
12291
12364
|
else if (n.type === "image") if (n.dataBinding) {
|
|
12292
|
-
let _ =
|
|
12293
|
-
_ != null && (
|
|
12294
|
-
} else
|
|
12295
|
-
let E =
|
|
12365
|
+
let _ = nI[n.dataBinding];
|
|
12366
|
+
_ != null && (rI = String(_));
|
|
12367
|
+
} else rI = rI.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
12368
|
+
let E = nI[_.trim()];
|
|
12296
12369
|
return E == null ? n : String(E);
|
|
12297
12370
|
});
|
|
12298
12371
|
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
12299
|
-
let E =
|
|
12300
|
-
E != null && (
|
|
12301
|
-
...
|
|
12372
|
+
let E = nI[_];
|
|
12373
|
+
E != null && (oI = {
|
|
12374
|
+
...oI,
|
|
12302
12375
|
[n]: String(E)
|
|
12303
12376
|
});
|
|
12304
12377
|
}), n.conditions && n.conditions.forEach((n) => {
|
|
12305
|
-
let _ =
|
|
12306
|
-
checkCondition$1(_, n.operator, n.value) && (
|
|
12307
|
-
...
|
|
12378
|
+
let _ = nI[n.property];
|
|
12379
|
+
checkCondition$1(_, n.operator, n.value) && (oI = {
|
|
12380
|
+
...oI,
|
|
12308
12381
|
...n.style
|
|
12309
12382
|
});
|
|
12310
12383
|
});
|
|
12311
12384
|
}
|
|
12312
|
-
let
|
|
12313
|
-
if (
|
|
12314
|
-
let { display: n, ..._ } =
|
|
12315
|
-
|
|
12385
|
+
let sI = oI.display === "none";
|
|
12386
|
+
if (sI && _) {
|
|
12387
|
+
let { display: n, ..._ } = oI;
|
|
12388
|
+
oI = _;
|
|
12316
12389
|
}
|
|
12317
|
-
let
|
|
12318
|
-
_.stopPropagation(), !
|
|
12319
|
-
},
|
|
12390
|
+
let cI = (_) => {
|
|
12391
|
+
_.stopPropagation(), !qF.current && !JF.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
12392
|
+
}, lI = (O) => {
|
|
12320
12393
|
if (n.locked || O.button !== 0) return;
|
|
12321
12394
|
O.stopPropagation();
|
|
12322
12395
|
let A = O.shiftKey;
|
|
12323
|
-
if (
|
|
12396
|
+
if (qF.current = !1, JF.current = !1, n.groupId && !_) {
|
|
12324
12397
|
E(n.groupId, A);
|
|
12325
12398
|
return;
|
|
12326
12399
|
}
|
|
12327
|
-
_ || (E(n.id, A),
|
|
12400
|
+
_ || (E(n.id, A), JF.current = !0), z(!0), GF.current = {
|
|
12328
12401
|
x: O.clientX,
|
|
12329
12402
|
y: O.clientY
|
|
12330
12403
|
}, O.currentTarget.setPointerCapture(O.pointerId);
|
|
@@ -12336,17 +12409,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12336
12409
|
x: n.x,
|
|
12337
12410
|
y: n.y
|
|
12338
12411
|
});
|
|
12339
|
-
}),
|
|
12340
|
-
},
|
|
12412
|
+
}), KF.current = N;
|
|
12413
|
+
}, uI = (_) => {
|
|
12341
12414
|
if (P) {
|
|
12342
|
-
let E = j.zoom || 1, O = (_.clientX -
|
|
12343
|
-
(Math.abs(O) > 2 || Math.abs(M) > 2) && (
|
|
12344
|
-
let P = 5 / E, z = [], B = Object.entries(
|
|
12415
|
+
let E = j.zoom || 1, O = (_.clientX - GF.current.x) / E, M = (_.clientY - GF.current.y) / E;
|
|
12416
|
+
(Math.abs(O) > 2 || Math.abs(M) > 2) && (qF.current = !0);
|
|
12417
|
+
let P = 5 / E, z = [], B = Object.entries(KF.current).map(([_, E]) => {
|
|
12345
12418
|
let A = E.x + O, N = E.y + M;
|
|
12346
12419
|
if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
|
|
12347
12420
|
else {
|
|
12348
12421
|
let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
|
|
12349
|
-
Object.keys(
|
|
12422
|
+
Object.keys(KF.current).length === 1 && j.elements.forEach((n) => {
|
|
12350
12423
|
if (n.id === _) return;
|
|
12351
12424
|
let j = n.width ?? 100, H = n.height ?? 100;
|
|
12352
12425
|
E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
|
|
@@ -12379,7 +12452,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12379
12452
|
if (A = Math.max(0, A), j.isList) {
|
|
12380
12453
|
N = Math.max(0, N);
|
|
12381
12454
|
let _ = n.height ?? 100;
|
|
12382
|
-
|
|
12455
|
+
tI > 0 && (N = Math.min(N, tI - _)), N = Math.max(0, N);
|
|
12383
12456
|
}
|
|
12384
12457
|
return {
|
|
12385
12458
|
id: _,
|
|
@@ -12391,25 +12464,25 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12391
12464
|
});
|
|
12392
12465
|
N && N(z), A(B, !1);
|
|
12393
12466
|
}
|
|
12394
|
-
},
|
|
12467
|
+
}, dI = (n) => {
|
|
12395
12468
|
P && (z(!1), n.currentTarget.releasePointerCapture(n.pointerId), A([], !0), N && N([]));
|
|
12396
|
-
},
|
|
12469
|
+
}, fI = (_) => {
|
|
12397
12470
|
_.stopPropagation(), _.preventDefault(), W(!0);
|
|
12398
12471
|
let E = _.target.closest(".resizable-element");
|
|
12399
12472
|
if (E) {
|
|
12400
12473
|
let O = E.getBoundingClientRect();
|
|
12401
|
-
|
|
12474
|
+
$F.current = {
|
|
12402
12475
|
x: O.left + O.width / 2,
|
|
12403
12476
|
y: O.top + O.height / 2
|
|
12404
12477
|
};
|
|
12405
|
-
let A = _.clientX -
|
|
12406
|
-
|
|
12478
|
+
let A = _.clientX - $F.current.x, j = _.clientY - $F.current.y;
|
|
12479
|
+
YF.current = Math.atan2(j, A) * (180 / Math.PI), QF.current = n.rotation || 0;
|
|
12407
12480
|
}
|
|
12408
12481
|
};
|
|
12409
12482
|
useEffect(() => {
|
|
12410
12483
|
let _ = (_) => {
|
|
12411
12484
|
if (U) {
|
|
12412
|
-
let E = _.clientX -
|
|
12485
|
+
let E = _.clientX - $F.current.x, A = _.clientY - $F.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - YF.current, M = (QF.current + j) % 360;
|
|
12413
12486
|
O(n.id, { rotation: M }, !1);
|
|
12414
12487
|
}
|
|
12415
12488
|
}, E = () => {
|
|
@@ -12431,7 +12504,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12431
12504
|
}
|
|
12432
12505
|
});
|
|
12433
12506
|
}, [
|
|
12434
|
-
|
|
12507
|
+
rI,
|
|
12435
12508
|
n.autoGrow,
|
|
12436
12509
|
n.containerExpansion,
|
|
12437
12510
|
n.style,
|
|
@@ -12441,7 +12514,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12441
12514
|
n.id,
|
|
12442
12515
|
n.type
|
|
12443
12516
|
]);
|
|
12444
|
-
let
|
|
12517
|
+
let pI = {
|
|
12445
12518
|
position: "relative",
|
|
12446
12519
|
left: 0,
|
|
12447
12520
|
top: 0,
|
|
@@ -12459,7 +12532,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12459
12532
|
userSelect: "none",
|
|
12460
12533
|
boxSizing: "border-box",
|
|
12461
12534
|
...n.style,
|
|
12462
|
-
...
|
|
12535
|
+
...oI
|
|
12463
12536
|
};
|
|
12464
12537
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
12465
12538
|
className: "resizable-element",
|
|
@@ -12467,9 +12540,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12467
12540
|
width: n.width ?? 100,
|
|
12468
12541
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
12469
12542
|
},
|
|
12470
|
-
maxHeight: j.isList ? Math.max(10,
|
|
12543
|
+
maxHeight: j.isList ? Math.max(10, tI - n.y) : void 0,
|
|
12471
12544
|
onResizeStart: (n) => {
|
|
12472
|
-
H(!0),
|
|
12545
|
+
H(!0), eI.current = !!n.shiftKey;
|
|
12473
12546
|
},
|
|
12474
12547
|
onResizeStop: (_, E, A, j) => {
|
|
12475
12548
|
H(!1);
|
|
@@ -12604,8 +12677,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12604
12677
|
position: "absolute",
|
|
12605
12678
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
12606
12679
|
height: n.autoGrow ? "auto" : void 0,
|
|
12607
|
-
display:
|
|
12608
|
-
opacity:
|
|
12680
|
+
display: sI && !_ ? "none" : void 0,
|
|
12681
|
+
opacity: sI && _ ? .4 : 1,
|
|
12609
12682
|
zIndex: _ ? 1e3 : void 0,
|
|
12610
12683
|
outline: "none",
|
|
12611
12684
|
overflow: "visible"
|
|
@@ -12620,7 +12693,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12620
12693
|
bottomLeft: !1,
|
|
12621
12694
|
topLeft: !1
|
|
12622
12695
|
} : void 0,
|
|
12623
|
-
lockAspectRatio:
|
|
12696
|
+
lockAspectRatio: eI.current,
|
|
12624
12697
|
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
12625
12698
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
12626
12699
|
element: n,
|
|
@@ -12633,18 +12706,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12633
12706
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
12634
12707
|
ref: Z,
|
|
12635
12708
|
style: {
|
|
12636
|
-
...
|
|
12637
|
-
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" :
|
|
12709
|
+
...pI,
|
|
12710
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : pI.whiteSpace,
|
|
12638
12711
|
width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : "100%",
|
|
12639
12712
|
height: n.type === "text-container" && n.autoGrow && n.containerExpansion === "vertical" ? "auto" : "100%"
|
|
12640
12713
|
},
|
|
12641
|
-
onPointerDown:
|
|
12642
|
-
onPointerMove:
|
|
12643
|
-
onPointerUp:
|
|
12714
|
+
onPointerDown: lI,
|
|
12715
|
+
onPointerMove: uI,
|
|
12716
|
+
onPointerUp: dI,
|
|
12644
12717
|
onMouseDown: (n) => {
|
|
12645
12718
|
n.button === 0 && n.stopPropagation();
|
|
12646
12719
|
},
|
|
12647
|
-
onClick:
|
|
12720
|
+
onClick: cI,
|
|
12648
12721
|
title: n.name,
|
|
12649
12722
|
onMouseEnter: (n) => {
|
|
12650
12723
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
@@ -12675,7 +12748,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12675
12748
|
width: "100%",
|
|
12676
12749
|
height: "100%"
|
|
12677
12750
|
},
|
|
12678
|
-
children:
|
|
12751
|
+
children: rI
|
|
12679
12752
|
}),
|
|
12680
12753
|
n.type === "text-container" && /* @__PURE__ */ jsx(p$2, {
|
|
12681
12754
|
style: {
|
|
@@ -12683,10 +12756,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12683
12756
|
height: "100%",
|
|
12684
12757
|
display: "block"
|
|
12685
12758
|
},
|
|
12686
|
-
children:
|
|
12759
|
+
children: rI
|
|
12687
12760
|
}),
|
|
12688
|
-
n.type === "image" && (
|
|
12689
|
-
src:
|
|
12761
|
+
n.type === "image" && (rI ? /* @__PURE__ */ jsx("img", {
|
|
12762
|
+
src: rI,
|
|
12690
12763
|
alt: "Element",
|
|
12691
12764
|
style: {
|
|
12692
12765
|
width: "100%",
|
|
@@ -12752,7 +12825,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12752
12825
|
zIndex: 50,
|
|
12753
12826
|
boxShadow: "0 0 0 2px white"
|
|
12754
12827
|
},
|
|
12755
|
-
onMouseDown:
|
|
12828
|
+
onMouseDown: fI,
|
|
12756
12829
|
onPointerDown: (n) => n.stopPropagation(),
|
|
12757
12830
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
12758
12831
|
position: "absolute",
|
|
@@ -12782,74 +12855,74 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12782
12855
|
borderTop: n.orientation === "horizontal" ? "1px dashed #ff0000" : "none"
|
|
12783
12856
|
} }, _)) });
|
|
12784
12857
|
}, Canvas = () => {
|
|
12785
|
-
let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: H } = useEditor(), W = useRef(null), [Z,
|
|
12858
|
+
let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: H } = useEditor(), W = useRef(null), [Z, GF] = useState(null), KF = useRef(!1), qF = useRef(!1), JF = useRef(!1), YF = useRef({
|
|
12786
12859
|
x: 0,
|
|
12787
12860
|
y: 0
|
|
12788
|
-
}),
|
|
12861
|
+
}), QF = useRef({
|
|
12789
12862
|
x: 0,
|
|
12790
12863
|
y: 0
|
|
12791
|
-
}),
|
|
12864
|
+
}), $F = useRef([]), eI = useRef([]), tI = useRef(n), nI = useRef(0);
|
|
12792
12865
|
useEffect(() => {
|
|
12793
|
-
|
|
12866
|
+
tI.current = n;
|
|
12794
12867
|
}, [n]);
|
|
12795
|
-
let
|
|
12868
|
+
let rI = useCallback((n) => {
|
|
12796
12869
|
if (!W.current) return;
|
|
12797
|
-
let _ =
|
|
12798
|
-
if (
|
|
12799
|
-
let E = n.clientX -
|
|
12870
|
+
let _ = tI.current;
|
|
12871
|
+
if (qF.current) {
|
|
12872
|
+
let E = n.clientX - QF.current.x, O = n.clientY - QF.current.y;
|
|
12800
12873
|
j({
|
|
12801
12874
|
x: _.pan.x + E,
|
|
12802
12875
|
y: _.pan.y + O
|
|
12803
|
-
}),
|
|
12876
|
+
}), QF.current = {
|
|
12804
12877
|
x: n.clientX,
|
|
12805
12878
|
y: n.clientY
|
|
12806
12879
|
};
|
|
12807
12880
|
return;
|
|
12808
12881
|
}
|
|
12809
|
-
if (!
|
|
12810
|
-
let O = W.current.getBoundingClientRect(), A = (n.clientX - O.left - _.pan.x) / _.zoom, M = (n.clientY - O.top - _.pan.y) / _.zoom, N = Math.min(
|
|
12811
|
-
|
|
12882
|
+
if (!KF.current) return;
|
|
12883
|
+
let O = W.current.getBoundingClientRect(), A = (n.clientX - O.left - _.pan.x) / _.zoom, M = (n.clientY - O.top - _.pan.y) / _.zoom, N = Math.min(YF.current.x, A), P = Math.min(YF.current.y, M), z = Math.abs(A - YF.current.x), B = Math.abs(M - YF.current.y);
|
|
12884
|
+
GF({
|
|
12812
12885
|
x: N,
|
|
12813
12886
|
y: P,
|
|
12814
12887
|
width: z,
|
|
12815
12888
|
height: B
|
|
12816
12889
|
});
|
|
12817
12890
|
let H = Date.now();
|
|
12818
|
-
if (!(H -
|
|
12891
|
+
if (!(H - nI.current < 50) && (z > 0 || B > 0)) {
|
|
12819
12892
|
let n = [];
|
|
12820
12893
|
_.elements.forEach((_) => {
|
|
12821
12894
|
let E = _.x ?? 0, O = _.y ?? 0, A = _.width ?? 100, j = _.height ?? 100, M = E + A, H = O + j, U = N + z, W = P + B;
|
|
12822
12895
|
E < U && M > N && O < W && H > P && n.push(_.id);
|
|
12823
12896
|
});
|
|
12824
|
-
let O = Array.from(new Set([
|
|
12825
|
-
A.length === O.length && A.every((n) => O.includes(n)) || (E(O),
|
|
12897
|
+
let O = Array.from(new Set([...$F.current, ...n])), A = eI.current;
|
|
12898
|
+
A.length === O.length && A.every((n) => O.includes(n)) || (E(O), eI.current = O, nI.current = H);
|
|
12826
12899
|
}
|
|
12827
|
-
}, [E, j]),
|
|
12828
|
-
(
|
|
12829
|
-
}, []),
|
|
12900
|
+
}, [E, j]), oI = useCallback((n) => {
|
|
12901
|
+
(KF.current || qF.current) && n.target.releasePointerCapture(n.pointerId), KF.current = !1, qF.current = !1, GF(null);
|
|
12902
|
+
}, []), sI = (E) => {
|
|
12830
12903
|
if (E.button === 2) return;
|
|
12831
12904
|
let O = E.target;
|
|
12832
12905
|
if (O.closest(".resize-handle") || O.closest(".rotate-handle")) return;
|
|
12833
|
-
if (E.currentTarget.setPointerCapture(E.pointerId), E.button === 1 || E.button === 0 &&
|
|
12834
|
-
E.preventDefault(),
|
|
12906
|
+
if (E.currentTarget.setPointerCapture(E.pointerId), E.button === 1 || E.button === 0 && JF.current) {
|
|
12907
|
+
E.preventDefault(), qF.current = !0, QF.current = {
|
|
12835
12908
|
x: E.clientX,
|
|
12836
12909
|
y: E.clientY
|
|
12837
12910
|
};
|
|
12838
12911
|
return;
|
|
12839
12912
|
}
|
|
12840
|
-
|
|
12913
|
+
KF.current = E.shiftKey;
|
|
12841
12914
|
let A = W.current?.getBoundingClientRect();
|
|
12842
12915
|
if (!A) return;
|
|
12843
12916
|
let j = A.left, M = A.top;
|
|
12844
|
-
|
|
12917
|
+
YF.current = {
|
|
12845
12918
|
x: (E.clientX - j - n.pan.x) / n.zoom,
|
|
12846
12919
|
y: (E.clientY - M - n.pan.y) / n.zoom
|
|
12847
|
-
},
|
|
12920
|
+
}, $F.current = n.selectedElementIds, eI.current = n.selectedElementIds, E.shiftKey || (_(null), $F.current = [], eI.current = []);
|
|
12848
12921
|
};
|
|
12849
12922
|
useEffect(() => {
|
|
12850
12923
|
let n = (n) => {
|
|
12851
12924
|
n.preventDefault();
|
|
12852
|
-
let _ =
|
|
12925
|
+
let _ = tI.current;
|
|
12853
12926
|
if (n.ctrlKey || n.metaKey) A(Math.min(Math.max(.1, _.zoom - n.deltaY * .001), 5));
|
|
12854
12927
|
else {
|
|
12855
12928
|
let E = n.shiftKey ? n.deltaY : n.deltaX, O = n.shiftKey ? n.deltaX : n.deltaY;
|
|
@@ -12864,7 +12937,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12864
12937
|
};
|
|
12865
12938
|
}, [A, j]), useEffect(() => {
|
|
12866
12939
|
let _ = (_) => {
|
|
12867
|
-
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (
|
|
12940
|
+
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (JF.current = !0, W.current && (W.current.style.cursor = "grab")), !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && ((_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "z" && (_.preventDefault(), _.shiftKey ? N() : M()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "y" && (_.preventDefault(), N()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "c" && (_.preventDefault(), P()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "v" && (_.preventDefault(), z()), (_.key === "Delete" || _.key === "Backspace") && (_.preventDefault(), B()), [
|
|
12868
12941
|
"ArrowUp",
|
|
12869
12942
|
"ArrowDown",
|
|
12870
12943
|
"ArrowLeft",
|
|
@@ -12892,7 +12965,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12892
12965
|
}), O.length > 0 && H(O);
|
|
12893
12966
|
}
|
|
12894
12967
|
}, E = (n) => {
|
|
12895
|
-
n.code === "Space" && (
|
|
12968
|
+
n.code === "Space" && (JF.current = !1, W.current && !qF.current && (W.current.style.cursor = "default"));
|
|
12896
12969
|
};
|
|
12897
12970
|
return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
|
|
12898
12971
|
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E);
|
|
@@ -12907,21 +12980,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12907
12980
|
n.selectedElementIds,
|
|
12908
12981
|
n.elements
|
|
12909
12982
|
]);
|
|
12910
|
-
let
|
|
12911
|
-
n.stopPropagation(), n.preventDefault(),
|
|
12912
|
-
},
|
|
12913
|
-
if (!
|
|
12983
|
+
let cI = useRef(!1), { setCanvasHeight: lI } = useEditor(), uI = (n) => {
|
|
12984
|
+
n.stopPropagation(), n.preventDefault(), cI.current = !0, window.addEventListener("mousemove", dI), window.addEventListener("mouseup", fI);
|
|
12985
|
+
}, dI = useCallback((n) => {
|
|
12986
|
+
if (!cI.current || !W.current) return;
|
|
12914
12987
|
let _ = W.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12915
|
-
|
|
12916
|
-
}, [
|
|
12917
|
-
|
|
12918
|
-
}, [
|
|
12988
|
+
lI(Math.round(O));
|
|
12989
|
+
}, [lI]), fI = useCallback(() => {
|
|
12990
|
+
cI.current = !1, window.removeEventListener("mousemove", dI), window.removeEventListener("mouseup", fI);
|
|
12991
|
+
}, [dI]);
|
|
12919
12992
|
useEffect(() => () => {
|
|
12920
|
-
window.removeEventListener("mousemove",
|
|
12921
|
-
}, [
|
|
12922
|
-
let
|
|
12993
|
+
window.removeEventListener("mousemove", dI), window.removeEventListener("mouseup", fI);
|
|
12994
|
+
}, [dI, fI]);
|
|
12995
|
+
let pI = (n) => {
|
|
12923
12996
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12924
|
-
},
|
|
12997
|
+
}, mI = (_) => {
|
|
12925
12998
|
_.preventDefault();
|
|
12926
12999
|
let E = _.currentTarget.getBoundingClientRect(), A = (_.clientX - E.left - n.pan.x) / n.zoom, j = (_.clientY - E.top - n.pan.y) / n.zoom, M = _.dataTransfer.getData("application/x-editor-prop");
|
|
12927
13000
|
if (M) {
|
|
@@ -12951,25 +13024,25 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12951
13024
|
} catch (n) {
|
|
12952
13025
|
console.error("Failed to parse asset", n);
|
|
12953
13026
|
}
|
|
12954
|
-
},
|
|
13027
|
+
}, hI = n.canvasHeight || 150;
|
|
12955
13028
|
return /* @__PURE__ */ jsxs(p, {
|
|
12956
13029
|
ref: W,
|
|
12957
|
-
onPointerDown:
|
|
13030
|
+
onPointerDown: sI,
|
|
12958
13031
|
onPointerMove: (n) => {
|
|
12959
|
-
(
|
|
13032
|
+
(KF.current || qF.current) && rI(n.nativeEvent);
|
|
12960
13033
|
},
|
|
12961
13034
|
onPointerUp: (n) => {
|
|
12962
|
-
(
|
|
13035
|
+
(KF.current || qF.current) && oI(n.nativeEvent);
|
|
12963
13036
|
},
|
|
12964
|
-
onDragOver:
|
|
12965
|
-
onDrop:
|
|
13037
|
+
onDragOver: pI,
|
|
13038
|
+
onDrop: mI,
|
|
12966
13039
|
style: {
|
|
12967
13040
|
width: "100%",
|
|
12968
13041
|
height: "100%",
|
|
12969
13042
|
position: "relative",
|
|
12970
13043
|
overflow: "hidden",
|
|
12971
13044
|
backgroundColor: "var(--color-background)",
|
|
12972
|
-
cursor:
|
|
13045
|
+
cursor: qF.current ? "grabbing" : "default",
|
|
12973
13046
|
backgroundImage: "radial-gradient(var(--gray-5) 1px, transparent 1px)",
|
|
12974
13047
|
backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
|
|
12975
13048
|
backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
|
|
@@ -13033,7 +13106,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13033
13106
|
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
13034
13107
|
style: {
|
|
13035
13108
|
position: "absolute",
|
|
13036
|
-
top:
|
|
13109
|
+
top: hI,
|
|
13037
13110
|
left: 0,
|
|
13038
13111
|
right: 0,
|
|
13039
13112
|
height: "10px",
|
|
@@ -13042,10 +13115,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13042
13115
|
zIndex: 100,
|
|
13043
13116
|
display: "flex",
|
|
13044
13117
|
alignItems: "center",
|
|
13045
|
-
justifyContent: "center"
|
|
13046
|
-
group: "resize-handle"
|
|
13118
|
+
justifyContent: "center"
|
|
13047
13119
|
},
|
|
13048
|
-
onMouseDown:
|
|
13120
|
+
onMouseDown: uI,
|
|
13049
13121
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
13050
13122
|
width: "100%",
|
|
13051
13123
|
height: "2px",
|
|
@@ -13069,7 +13141,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13069
13141
|
},
|
|
13070
13142
|
children: [
|
|
13071
13143
|
"Altura do Item: ",
|
|
13072
|
-
|
|
13144
|
+
hI,
|
|
13073
13145
|
"px"
|
|
13074
13146
|
]
|
|
13075
13147
|
})]
|
|
@@ -13152,22 +13224,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13152
13224
|
]
|
|
13153
13225
|
});
|
|
13154
13226
|
}, EditorSettings = () => {
|
|
13155
|
-
let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, W] = useState("down"), [Z,
|
|
13227
|
+
let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, W] = useState("down"), [Z, GF] = useState("150"), [KF, qF] = useState(""), [JF, YF] = useState("0"), [XF, QF] = useState("slideIn"), [$F, eI] = useState(.3), [tI, nI] = useState("ease-out");
|
|
13156
13228
|
return useEffect(() => {
|
|
13157
13229
|
if (A) {
|
|
13158
|
-
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), W(n.listSettings.scrollDirection || "down"),
|
|
13230
|
+
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), W(n.listSettings.scrollDirection || "down"), qF(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), GF(String(n.canvasHeight || 150)), YF(String(n.gridSize || 0));
|
|
13159
13231
|
let _ = n.listSettings.entryAnimation;
|
|
13160
|
-
|
|
13232
|
+
QF(_?.type || "slideIn"), eI(_?.duration || .3), nI(_?.timingFunction || "ease-out");
|
|
13161
13233
|
}
|
|
13162
13234
|
}, [A]), useEffect(() => {
|
|
13163
13235
|
if (!A) return;
|
|
13164
13236
|
let _ = parseInt(Z, 10);
|
|
13165
13237
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
13166
|
-
let j = parseInt(
|
|
13238
|
+
let j = parseInt(JF, 10);
|
|
13167
13239
|
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
13168
13240
|
}, [
|
|
13169
13241
|
Z,
|
|
13170
|
-
|
|
13242
|
+
JF,
|
|
13171
13243
|
A,
|
|
13172
13244
|
E,
|
|
13173
13245
|
O,
|
|
@@ -13346,7 +13418,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13346
13418
|
type: "number",
|
|
13347
13419
|
min: "10",
|
|
13348
13420
|
value: Z,
|
|
13349
|
-
onChange: (n) =>
|
|
13421
|
+
onChange: (n) => GF(n.target.value)
|
|
13350
13422
|
}),
|
|
13351
13423
|
/* @__PURE__ */ jsx(p$2, {
|
|
13352
13424
|
size: "1",
|
|
@@ -13367,8 +13439,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13367
13439
|
type: "number",
|
|
13368
13440
|
min: "0",
|
|
13369
13441
|
placeholder: "Auto (100%)",
|
|
13370
|
-
value:
|
|
13371
|
-
onChange: (n) =>
|
|
13442
|
+
value: KF,
|
|
13443
|
+
onChange: (n) => qF(n.target.value)
|
|
13372
13444
|
}),
|
|
13373
13445
|
/* @__PURE__ */ jsx(p$2, {
|
|
13374
13446
|
size: "1",
|
|
@@ -13394,8 +13466,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13394
13466
|
as: "div",
|
|
13395
13467
|
children: "Efeito"
|
|
13396
13468
|
}), /* @__PURE__ */ jsxs("select", {
|
|
13397
|
-
value:
|
|
13398
|
-
onChange: (n) =>
|
|
13469
|
+
value: XF,
|
|
13470
|
+
onChange: (n) => QF(n.target.value),
|
|
13399
13471
|
style: {
|
|
13400
13472
|
width: "100%",
|
|
13401
13473
|
padding: "6px",
|
|
@@ -13457,8 +13529,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13457
13529
|
type: "number",
|
|
13458
13530
|
step: "0.1",
|
|
13459
13531
|
min: "0.1",
|
|
13460
|
-
value:
|
|
13461
|
-
onChange: (n) =>
|
|
13532
|
+
value: $F,
|
|
13533
|
+
onChange: (n) => eI(parseFloat(n.target.value) || .3)
|
|
13462
13534
|
})] }),
|
|
13463
13535
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
13464
13536
|
size: "1",
|
|
@@ -13466,8 +13538,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13466
13538
|
as: "div",
|
|
13467
13539
|
children: "Curva (Easing)"
|
|
13468
13540
|
}), /* @__PURE__ */ jsxs("select", {
|
|
13469
|
-
value:
|
|
13470
|
-
onChange: (n) =>
|
|
13541
|
+
value: tI,
|
|
13542
|
+
onChange: (n) => nI(n.target.value),
|
|
13471
13543
|
style: {
|
|
13472
13544
|
width: "100%",
|
|
13473
13545
|
padding: "6px",
|
|
@@ -13522,8 +13594,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13522
13594
|
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
13523
13595
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
13524
13596
|
type: "number",
|
|
13525
|
-
value:
|
|
13526
|
-
onChange: (n) =>
|
|
13597
|
+
value: JF,
|
|
13598
|
+
onChange: (n) => YF(n.target.value),
|
|
13527
13599
|
placeholder: "0"
|
|
13528
13600
|
})]
|
|
13529
13601
|
})
|
|
@@ -13542,11 +13614,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13542
13614
|
children: "Cancelar"
|
|
13543
13615
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
13544
13616
|
onClick: () => {
|
|
13545
|
-
let n = parseInt(
|
|
13546
|
-
type:
|
|
13547
|
-
duration: Number(
|
|
13617
|
+
let n = parseInt(KF, 10), E = {
|
|
13618
|
+
type: XF,
|
|
13619
|
+
duration: Number($F),
|
|
13548
13620
|
delay: 0,
|
|
13549
|
-
timingFunction:
|
|
13621
|
+
timingFunction: tI
|
|
13550
13622
|
};
|
|
13551
13623
|
_({
|
|
13552
13624
|
sortProp: M === "__none__" ? "" : M,
|
|
@@ -14325,7 +14397,7 @@ var defaultKeyboardCodes = {
|
|
|
14325
14397
|
let A = n.code, { isTop: j, isRight: N, isLeft: P, isBottom: z, maxScroll: H, minScroll: U } = getScrollPosition(E), W = getScrollElementRect(E), G = {
|
|
14326
14398
|
x: Math.min(A === KeyboardCode.Right ? W.right - W.width / 2 : W.right, Math.max(A === KeyboardCode.Right ? W.left : W.left + W.width / 2, B.x)),
|
|
14327
14399
|
y: Math.min(A === KeyboardCode.Down ? W.bottom - W.height / 2 : W.bottom, Math.max(A === KeyboardCode.Down ? W.top : W.top + W.height / 2, B.y))
|
|
14328
|
-
}, Z = A === KeyboardCode.Right && !N || A === KeyboardCode.Left && !P,
|
|
14400
|
+
}, Z = A === KeyboardCode.Right && !N || A === KeyboardCode.Left && !P, GF = A === KeyboardCode.Down && !z || A === KeyboardCode.Up && !j;
|
|
14329
14401
|
if (Z && G.x !== B.x) {
|
|
14330
14402
|
let n = E.scrollLeft + _.x, j = A === KeyboardCode.Right && n <= H.x || A === KeyboardCode.Left && n >= U.x;
|
|
14331
14403
|
if (j && !_.y) {
|
|
@@ -14340,7 +14412,7 @@ var defaultKeyboardCodes = {
|
|
|
14340
14412
|
behavior: M
|
|
14341
14413
|
});
|
|
14342
14414
|
break;
|
|
14343
|
-
} else if (
|
|
14415
|
+
} else if (GF && G.y !== B.y) {
|
|
14344
14416
|
let n = E.scrollTop + _.y, j = A === KeyboardCode.Down && n <= H.y || A === KeyboardCode.Up && n >= U.y;
|
|
14345
14417
|
if (j && !_.x) {
|
|
14346
14418
|
E.scrollTo({
|
|
@@ -14532,13 +14604,13 @@ function useAutoScroller(n) {
|
|
|
14532
14604
|
let { acceleration: _, activator: E = AutoScrollActivator.Pointer, canScroll: O, draggingRect: A, enabled: j, interval: M = 5, order: N = TraversalOrder.TreeOrder, pointerCoordinates: P, scrollableAncestors: z, scrollableAncestorRects: B, delta: H, threshold: W } = n, Z = useScrollIntent({
|
|
14533
14605
|
delta: H,
|
|
14534
14606
|
disabled: !j
|
|
14535
|
-
}), [
|
|
14607
|
+
}), [GF, KF] = useInterval(), qF = useRef({
|
|
14536
14608
|
x: 0,
|
|
14537
14609
|
y: 0
|
|
14538
|
-
}),
|
|
14610
|
+
}), YF = useRef({
|
|
14539
14611
|
x: 0,
|
|
14540
14612
|
y: 0
|
|
14541
|
-
}),
|
|
14613
|
+
}), ZF = useMemo(() => {
|
|
14542
14614
|
switch (E) {
|
|
14543
14615
|
case AutoScrollActivator.Pointer: return P ? {
|
|
14544
14616
|
top: P.y,
|
|
@@ -14552,47 +14624,47 @@ function useAutoScroller(n) {
|
|
|
14552
14624
|
E,
|
|
14553
14625
|
A,
|
|
14554
14626
|
P
|
|
14555
|
-
]),
|
|
14556
|
-
let n =
|
|
14627
|
+
]), QF = useRef(null), $F = useCallback(() => {
|
|
14628
|
+
let n = QF.current;
|
|
14557
14629
|
if (!n) return;
|
|
14558
|
-
let _ =
|
|
14630
|
+
let _ = qF.current.x * YF.current.x, E = qF.current.y * YF.current.y;
|
|
14559
14631
|
n.scrollBy(_, E);
|
|
14560
|
-
}, []),
|
|
14632
|
+
}, []), eI = useMemo(() => N === TraversalOrder.TreeOrder ? [...z].reverse() : z, [N, z]);
|
|
14561
14633
|
useEffect(() => {
|
|
14562
|
-
if (!j || !z.length || !
|
|
14563
|
-
|
|
14634
|
+
if (!j || !z.length || !ZF) {
|
|
14635
|
+
KF();
|
|
14564
14636
|
return;
|
|
14565
14637
|
}
|
|
14566
|
-
for (let n of
|
|
14638
|
+
for (let n of eI) {
|
|
14567
14639
|
if (O?.(n) === !1) continue;
|
|
14568
14640
|
let E = B[z.indexOf(n)];
|
|
14569
14641
|
if (!E) continue;
|
|
14570
|
-
let { direction: A, speed: j } = getScrollDirectionAndSpeed(n, E,
|
|
14642
|
+
let { direction: A, speed: j } = getScrollDirectionAndSpeed(n, E, ZF, _, W);
|
|
14571
14643
|
for (let n of ["x", "y"]) Z[n][A[n]] || (j[n] = 0, A[n] = 0);
|
|
14572
14644
|
if (j.x > 0 || j.y > 0) {
|
|
14573
|
-
|
|
14645
|
+
KF(), QF.current = n, GF($F, M), qF.current = j, YF.current = A;
|
|
14574
14646
|
return;
|
|
14575
14647
|
}
|
|
14576
14648
|
}
|
|
14577
|
-
|
|
14649
|
+
qF.current = {
|
|
14578
14650
|
x: 0,
|
|
14579
14651
|
y: 0
|
|
14580
|
-
},
|
|
14652
|
+
}, YF.current = {
|
|
14581
14653
|
x: 0,
|
|
14582
14654
|
y: 0
|
|
14583
|
-
},
|
|
14655
|
+
}, KF();
|
|
14584
14656
|
}, [
|
|
14585
14657
|
_,
|
|
14586
|
-
|
|
14658
|
+
$F,
|
|
14587
14659
|
O,
|
|
14588
|
-
|
|
14660
|
+
KF,
|
|
14589
14661
|
j,
|
|
14590
14662
|
M,
|
|
14591
|
-
JSON.stringify(
|
|
14663
|
+
JSON.stringify(ZF),
|
|
14592
14664
|
JSON.stringify(Z),
|
|
14593
|
-
|
|
14665
|
+
GF,
|
|
14594
14666
|
z,
|
|
14595
|
-
|
|
14667
|
+
eI,
|
|
14596
14668
|
B,
|
|
14597
14669
|
JSON.stringify(W)
|
|
14598
14670
|
]);
|
|
@@ -14654,9 +14726,9 @@ var MeasuringFrequency;
|
|
|
14654
14726
|
})(MeasuringFrequency ||= {});
|
|
14655
14727
|
var defaultValue = /* @__PURE__ */ new Map();
|
|
14656
14728
|
function useDroppableMeasuring(n, _) {
|
|
14657
|
-
let { dragging: E, dependencies: O, config: A } = _, [j, M] = useState(null), { frequency: N, measure: P, strategy: z } = A, B = useRef(n), H =
|
|
14729
|
+
let { dragging: E, dependencies: O, config: A } = _, [j, M] = useState(null), { frequency: N, measure: P, strategy: z } = A, B = useRef(n), H = qF(), W = useLatestValue(H), Z = useCallback(function(n) {
|
|
14658
14730
|
n === void 0 && (n = []), !W.current && M((_) => _ === null ? n : _.concat(n.filter((n) => !_.includes(n))));
|
|
14659
|
-
}, [W]),
|
|
14731
|
+
}, [W]), GF = useRef(null), KF = useLazyMemo((_) => {
|
|
14660
14732
|
if (H && !E) return defaultValue;
|
|
14661
14733
|
if (!_ || _ === defaultValue || B.current !== n || j != null) {
|
|
14662
14734
|
let _ = /* @__PURE__ */ new Map();
|
|
@@ -14686,8 +14758,8 @@ function useDroppableMeasuring(n, _) {
|
|
|
14686
14758
|
}, [E, H]), useEffect(() => {
|
|
14687
14759
|
j && j.length > 0 && M(null);
|
|
14688
14760
|
}, [JSON.stringify(j)]), useEffect(() => {
|
|
14689
|
-
H || typeof N != "number" ||
|
|
14690
|
-
Z(),
|
|
14761
|
+
H || typeof N != "number" || GF.current !== null || (GF.current = setTimeout(() => {
|
|
14762
|
+
Z(), GF.current = null;
|
|
14691
14763
|
}, N));
|
|
14692
14764
|
}, [
|
|
14693
14765
|
N,
|
|
@@ -14695,11 +14767,11 @@ function useDroppableMeasuring(n, _) {
|
|
|
14695
14767
|
Z,
|
|
14696
14768
|
...O
|
|
14697
14769
|
]), {
|
|
14698
|
-
droppableRects:
|
|
14770
|
+
droppableRects: KF,
|
|
14699
14771
|
measureDroppableContainers: Z,
|
|
14700
14772
|
measuringScheduled: j != null
|
|
14701
14773
|
};
|
|
14702
|
-
function
|
|
14774
|
+
function qF() {
|
|
14703
14775
|
switch (z) {
|
|
14704
14776
|
case MeasuringStrategy.Always: return !1;
|
|
14705
14777
|
case MeasuringStrategy.BeforeDragging: return E;
|
|
@@ -15124,84 +15196,84 @@ var ActiveDraggableContext = /* @__PURE__ */ createContext({
|
|
|
15124
15196
|
n[n.Uninitialized = 0] = "Uninitialized", n[n.Initializing = 1] = "Initializing", n[n.Initialized = 2] = "Initialized";
|
|
15125
15197
|
})(Status ||= {});
|
|
15126
15198
|
var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
15127
|
-
let { id: E, accessibility: O, autoScroll: A = !0, children: j, sensors: M = defaultSensors, collisionDetection: N = rectIntersection, measuring: P, modifiers: z, ...B } = n, [H, W] = useReducer(reducer, void 0, getInitialState), [Z,
|
|
15199
|
+
let { id: E, accessibility: O, autoScroll: A = !0, children: j, sensors: M = defaultSensors, collisionDetection: N = rectIntersection, measuring: P, modifiers: z, ...B } = n, [H, W] = useReducer(reducer, void 0, getInitialState), [Z, GF] = useDndMonitorProvider(), [KF, qF] = useState(Status.Uninitialized), QF = KF === Status.Initialized, { draggable: { active: $F, nodes: eI, translate: tI }, droppable: { containers: rI } } = H, iI = $F == null ? null : eI.get($F), aI = useRef({
|
|
15128
15200
|
initial: null,
|
|
15129
15201
|
translated: null
|
|
15130
|
-
}),
|
|
15131
|
-
id:
|
|
15132
|
-
data:
|
|
15133
|
-
rect:
|
|
15134
|
-
}, [
|
|
15135
|
-
dragging:
|
|
15136
|
-
dependencies: [
|
|
15137
|
-
config:
|
|
15138
|
-
}),
|
|
15202
|
+
}), oI = useMemo(() => $F == null ? null : {
|
|
15203
|
+
id: $F,
|
|
15204
|
+
data: iI?.data ?? defaultData,
|
|
15205
|
+
rect: aI
|
|
15206
|
+
}, [$F, iI]), sI = useRef(null), [cI, lI] = useState(null), [uI, dI] = useState(null), fI = useLatestValue(B, Object.values(B)), pI = useUniqueId("DndDescribedBy", E), mI = useMemo(() => rI.getEnabled(), [rI]), hI = useMeasuringConfiguration(P), { droppableRects: gI, measureDroppableContainers: _I, measuringScheduled: vI } = useDroppableMeasuring(mI, {
|
|
15207
|
+
dragging: QF,
|
|
15208
|
+
dependencies: [tI.x, tI.y],
|
|
15209
|
+
config: hI.droppable
|
|
15210
|
+
}), yI = useCachedNode(eI, $F), bI = useMemo(() => uI ? getEventCoordinates(uI) : null, [uI]), xI = QI(), SI = useInitialRect(yI, hI.draggable.measure);
|
|
15139
15211
|
useLayoutShiftScrollCompensation({
|
|
15140
|
-
activeNode:
|
|
15141
|
-
config:
|
|
15142
|
-
initialRect:
|
|
15143
|
-
measure:
|
|
15212
|
+
activeNode: $F == null ? null : eI.get($F),
|
|
15213
|
+
config: xI.layoutShiftCompensation,
|
|
15214
|
+
initialRect: SI,
|
|
15215
|
+
measure: hI.draggable.measure
|
|
15144
15216
|
});
|
|
15145
|
-
let
|
|
15217
|
+
let CI = useRect(yI, hI.draggable.measure, SI), wI = useRect(yI ? yI.parentElement : null), TI = useRef({
|
|
15146
15218
|
activatorEvent: null,
|
|
15147
15219
|
active: null,
|
|
15148
|
-
activeNode:
|
|
15220
|
+
activeNode: yI,
|
|
15149
15221
|
collisionRect: null,
|
|
15150
15222
|
collisions: null,
|
|
15151
|
-
droppableRects:
|
|
15152
|
-
draggableNodes:
|
|
15223
|
+
droppableRects: gI,
|
|
15224
|
+
draggableNodes: eI,
|
|
15153
15225
|
draggingNode: null,
|
|
15154
15226
|
draggingNodeRect: null,
|
|
15155
|
-
droppableContainers:
|
|
15227
|
+
droppableContainers: rI,
|
|
15156
15228
|
over: null,
|
|
15157
15229
|
scrollableAncestors: [],
|
|
15158
15230
|
scrollAdjustedTranslate: null
|
|
15159
|
-
}),
|
|
15231
|
+
}), EI = rI.getNodeFor(TI.current.over?.id), DI = useDragOverlayMeasuring({ measure: hI.dragOverlay.measure }), OI = DI.nodeRef.current ?? yI, kI = QF ? DI.rect ?? CI : null, AI = !!(DI.nodeRef.current && DI.rect), jI = useRectDelta(AI ? null : CI), MI = useWindowRect(OI ? getWindow(OI) : null), NI = useScrollableAncestors(QF ? EI ?? yI : null), PI = useRects(NI), FI = applyModifiers(z, {
|
|
15160
15232
|
transform: {
|
|
15161
|
-
x:
|
|
15162
|
-
y:
|
|
15233
|
+
x: tI.x - jI.x,
|
|
15234
|
+
y: tI.y - jI.y,
|
|
15163
15235
|
scaleX: 1,
|
|
15164
15236
|
scaleY: 1
|
|
15165
15237
|
},
|
|
15166
|
-
activatorEvent:
|
|
15167
|
-
active:
|
|
15168
|
-
activeNodeRect:
|
|
15169
|
-
containerNodeRect:
|
|
15170
|
-
draggingNodeRect:
|
|
15171
|
-
over:
|
|
15172
|
-
overlayNodeRect:
|
|
15173
|
-
scrollableAncestors:
|
|
15174
|
-
scrollableAncestorRects:
|
|
15175
|
-
windowRect:
|
|
15176
|
-
}),
|
|
15177
|
-
active:
|
|
15178
|
-
collisionRect:
|
|
15179
|
-
droppableRects:
|
|
15180
|
-
droppableContainers:
|
|
15181
|
-
pointerCoordinates:
|
|
15182
|
-
}) : null,
|
|
15238
|
+
activatorEvent: uI,
|
|
15239
|
+
active: oI,
|
|
15240
|
+
activeNodeRect: CI,
|
|
15241
|
+
containerNodeRect: wI,
|
|
15242
|
+
draggingNodeRect: kI,
|
|
15243
|
+
over: TI.current.over,
|
|
15244
|
+
overlayNodeRect: DI.rect,
|
|
15245
|
+
scrollableAncestors: NI,
|
|
15246
|
+
scrollableAncestorRects: PI,
|
|
15247
|
+
windowRect: MI
|
|
15248
|
+
}), II = bI ? add(bI, tI) : null, LI = useScrollOffsets(NI), RI = useScrollOffsetsDelta(LI), zI = useScrollOffsetsDelta(LI, [CI]), BI = add(FI, RI), VI = kI ? getAdjustedRect(kI, FI) : null, HI = oI && VI ? N({
|
|
15249
|
+
active: oI,
|
|
15250
|
+
collisionRect: VI,
|
|
15251
|
+
droppableRects: gI,
|
|
15252
|
+
droppableContainers: mI,
|
|
15253
|
+
pointerCoordinates: II
|
|
15254
|
+
}) : null, UI = getFirstCollision(HI, "id"), [WI, GI] = useState(null), KI = adjustScale(AI ? FI : add(FI, zI), WI?.rect ?? null, CI), qI = useRef(null), JI = useCallback((n, _) => {
|
|
15183
15255
|
let { sensor: E, options: O } = _;
|
|
15184
|
-
if (
|
|
15185
|
-
let A =
|
|
15256
|
+
if (sI.current == null) return;
|
|
15257
|
+
let A = eI.get(sI.current);
|
|
15186
15258
|
if (!A) return;
|
|
15187
15259
|
let j = n.nativeEvent;
|
|
15188
|
-
|
|
15189
|
-
active:
|
|
15260
|
+
qI.current = new E({
|
|
15261
|
+
active: sI.current,
|
|
15190
15262
|
activeNode: A,
|
|
15191
15263
|
event: j,
|
|
15192
15264
|
options: O,
|
|
15193
|
-
context:
|
|
15265
|
+
context: TI,
|
|
15194
15266
|
onAbort(n) {
|
|
15195
|
-
if (!
|
|
15196
|
-
let { onDragAbort: _ } =
|
|
15267
|
+
if (!eI.get(n)) return;
|
|
15268
|
+
let { onDragAbort: _ } = fI.current, E = { id: n };
|
|
15197
15269
|
_?.(E), Z({
|
|
15198
15270
|
type: "onDragAbort",
|
|
15199
15271
|
event: E
|
|
15200
15272
|
});
|
|
15201
15273
|
},
|
|
15202
15274
|
onPending(n, _, E, O) {
|
|
15203
|
-
if (!
|
|
15204
|
-
let { onDragPending: A } =
|
|
15275
|
+
if (!eI.get(n)) return;
|
|
15276
|
+
let { onDragPending: A } = fI.current, j = {
|
|
15205
15277
|
id: n,
|
|
15206
15278
|
constraint: _,
|
|
15207
15279
|
initialCoordinates: E,
|
|
@@ -15213,27 +15285,27 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15213
15285
|
});
|
|
15214
15286
|
},
|
|
15215
15287
|
onStart(n) {
|
|
15216
|
-
let _ =
|
|
15288
|
+
let _ = sI.current;
|
|
15217
15289
|
if (_ == null) return;
|
|
15218
|
-
let E =
|
|
15290
|
+
let E = eI.get(_);
|
|
15219
15291
|
if (!E) return;
|
|
15220
|
-
let { onDragStart: O } =
|
|
15292
|
+
let { onDragStart: O } = fI.current, A = {
|
|
15221
15293
|
activatorEvent: j,
|
|
15222
15294
|
active: {
|
|
15223
15295
|
id: _,
|
|
15224
15296
|
data: E.data,
|
|
15225
|
-
rect:
|
|
15297
|
+
rect: aI
|
|
15226
15298
|
}
|
|
15227
15299
|
};
|
|
15228
15300
|
unstable_batchedUpdates(() => {
|
|
15229
|
-
O?.(A),
|
|
15301
|
+
O?.(A), qF(Status.Initializing), W({
|
|
15230
15302
|
type: Action.DragStart,
|
|
15231
15303
|
initialCoordinates: n,
|
|
15232
15304
|
active: _
|
|
15233
15305
|
}), Z({
|
|
15234
15306
|
type: "onDragStart",
|
|
15235
15307
|
event: A
|
|
15236
|
-
}),
|
|
15308
|
+
}), lI(qI.current), dI(j);
|
|
15237
15309
|
});
|
|
15238
15310
|
},
|
|
15239
15311
|
onMove(n) {
|
|
@@ -15247,9 +15319,9 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15247
15319
|
});
|
|
15248
15320
|
function M(n) {
|
|
15249
15321
|
return async function() {
|
|
15250
|
-
let { active: _, collisions: E, over: O, scrollAdjustedTranslate: A } =
|
|
15322
|
+
let { active: _, collisions: E, over: O, scrollAdjustedTranslate: A } = TI.current, M = null;
|
|
15251
15323
|
if (_ && A) {
|
|
15252
|
-
let { cancelDrop: N } =
|
|
15324
|
+
let { cancelDrop: N } = fI.current;
|
|
15253
15325
|
M = {
|
|
15254
15326
|
activatorEvent: j,
|
|
15255
15327
|
active: _,
|
|
@@ -15258,11 +15330,11 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15258
15330
|
over: O
|
|
15259
15331
|
}, n === Action.DragEnd && typeof N == "function" && await Promise.resolve(N(M)) && (n = Action.DragCancel);
|
|
15260
15332
|
}
|
|
15261
|
-
|
|
15262
|
-
W({ type: n }),
|
|
15333
|
+
sI.current = null, unstable_batchedUpdates(() => {
|
|
15334
|
+
W({ type: n }), qF(Status.Uninitialized), GI(null), lI(null), dI(null), qI.current = null;
|
|
15263
15335
|
let _ = n === Action.DragEnd ? "onDragEnd" : "onDragCancel";
|
|
15264
15336
|
if (M) {
|
|
15265
|
-
let n =
|
|
15337
|
+
let n = fI.current[_];
|
|
15266
15338
|
n?.(M), Z({
|
|
15267
15339
|
type: _,
|
|
15268
15340
|
event: M
|
|
@@ -15271,24 +15343,24 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15271
15343
|
});
|
|
15272
15344
|
};
|
|
15273
15345
|
}
|
|
15274
|
-
}, [
|
|
15275
|
-
let A = E.nativeEvent, j =
|
|
15276
|
-
if (
|
|
15346
|
+
}, [eI]), YI = useCombineActivators(M, useCallback((n, _) => (E, O) => {
|
|
15347
|
+
let A = E.nativeEvent, j = eI.get(O);
|
|
15348
|
+
if (sI.current !== null || !j || A.dndKit || A.defaultPrevented) return;
|
|
15277
15349
|
let M = { active: j };
|
|
15278
|
-
n(E, _.options, M) === !0 && (A.dndKit = { capturedBy: _.sensor },
|
|
15279
|
-
}, [
|
|
15350
|
+
n(E, _.options, M) === !0 && (A.dndKit = { capturedBy: _.sensor }, sI.current = O, JI(E, _));
|
|
15351
|
+
}, [eI, JI]));
|
|
15280
15352
|
useSensorSetup(M), useIsomorphicLayoutEffect$1(() => {
|
|
15281
|
-
|
|
15282
|
-
}, [
|
|
15283
|
-
let { onDragMove: n } =
|
|
15353
|
+
CI && KF === Status.Initializing && qF(Status.Initialized);
|
|
15354
|
+
}, [CI, KF]), useEffect(() => {
|
|
15355
|
+
let { onDragMove: n } = fI.current, { active: _, activatorEvent: E, collisions: O, over: A } = TI.current;
|
|
15284
15356
|
if (!_ || !E) return;
|
|
15285
15357
|
let j = {
|
|
15286
15358
|
active: _,
|
|
15287
15359
|
activatorEvent: E,
|
|
15288
15360
|
collisions: O,
|
|
15289
15361
|
delta: {
|
|
15290
|
-
x:
|
|
15291
|
-
y:
|
|
15362
|
+
x: BI.x,
|
|
15363
|
+
y: BI.y
|
|
15292
15364
|
},
|
|
15293
15365
|
over: A
|
|
15294
15366
|
};
|
|
@@ -15298,10 +15370,10 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15298
15370
|
event: j
|
|
15299
15371
|
});
|
|
15300
15372
|
});
|
|
15301
|
-
}, [
|
|
15302
|
-
let { active: n, activatorEvent: _, collisions: E, droppableContainers: O, scrollAdjustedTranslate: A } =
|
|
15303
|
-
if (!n ||
|
|
15304
|
-
let { onDragOver: j } =
|
|
15373
|
+
}, [BI.x, BI.y]), useEffect(() => {
|
|
15374
|
+
let { active: n, activatorEvent: _, collisions: E, droppableContainers: O, scrollAdjustedTranslate: A } = TI.current;
|
|
15375
|
+
if (!n || sI.current == null || !_ || !A) return;
|
|
15376
|
+
let { onDragOver: j } = fI.current, M = O.get(UI), N = M && M.rect.current ? {
|
|
15305
15377
|
id: M.id,
|
|
15306
15378
|
rect: M.rect.current,
|
|
15307
15379
|
data: M.data,
|
|
@@ -15317,114 +15389,114 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15317
15389
|
over: N
|
|
15318
15390
|
};
|
|
15319
15391
|
unstable_batchedUpdates(() => {
|
|
15320
|
-
|
|
15392
|
+
GI(N), j?.(P), Z({
|
|
15321
15393
|
type: "onDragOver",
|
|
15322
15394
|
event: P
|
|
15323
15395
|
});
|
|
15324
15396
|
});
|
|
15325
|
-
}, [
|
|
15326
|
-
|
|
15327
|
-
activatorEvent:
|
|
15328
|
-
active:
|
|
15329
|
-
activeNode:
|
|
15330
|
-
collisionRect:
|
|
15331
|
-
collisions:
|
|
15332
|
-
droppableRects:
|
|
15333
|
-
draggableNodes:
|
|
15334
|
-
draggingNode:
|
|
15335
|
-
draggingNodeRect:
|
|
15336
|
-
droppableContainers:
|
|
15337
|
-
over:
|
|
15338
|
-
scrollableAncestors:
|
|
15339
|
-
scrollAdjustedTranslate:
|
|
15340
|
-
},
|
|
15341
|
-
initial:
|
|
15342
|
-
translated:
|
|
15397
|
+
}, [UI]), useIsomorphicLayoutEffect$1(() => {
|
|
15398
|
+
TI.current = {
|
|
15399
|
+
activatorEvent: uI,
|
|
15400
|
+
active: oI,
|
|
15401
|
+
activeNode: yI,
|
|
15402
|
+
collisionRect: VI,
|
|
15403
|
+
collisions: HI,
|
|
15404
|
+
droppableRects: gI,
|
|
15405
|
+
draggableNodes: eI,
|
|
15406
|
+
draggingNode: OI,
|
|
15407
|
+
draggingNodeRect: kI,
|
|
15408
|
+
droppableContainers: rI,
|
|
15409
|
+
over: WI,
|
|
15410
|
+
scrollableAncestors: NI,
|
|
15411
|
+
scrollAdjustedTranslate: BI
|
|
15412
|
+
}, aI.current = {
|
|
15413
|
+
initial: kI,
|
|
15414
|
+
translated: VI
|
|
15343
15415
|
};
|
|
15344
15416
|
}, [
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
RI,
|
|
15349
|
-
ZF,
|
|
15350
|
-
TI,
|
|
15351
|
-
EI,
|
|
15352
|
-
pI,
|
|
15353
|
-
eI,
|
|
15417
|
+
oI,
|
|
15418
|
+
yI,
|
|
15419
|
+
HI,
|
|
15354
15420
|
VI,
|
|
15355
|
-
|
|
15356
|
-
|
|
15421
|
+
eI,
|
|
15422
|
+
OI,
|
|
15423
|
+
kI,
|
|
15424
|
+
gI,
|
|
15425
|
+
rI,
|
|
15426
|
+
WI,
|
|
15427
|
+
NI,
|
|
15428
|
+
BI
|
|
15357
15429
|
]), useAutoScroller({
|
|
15358
|
-
...
|
|
15359
|
-
delta:
|
|
15360
|
-
draggingRect:
|
|
15361
|
-
pointerCoordinates:
|
|
15362
|
-
scrollableAncestors:
|
|
15363
|
-
scrollableAncestorRects:
|
|
15430
|
+
...xI,
|
|
15431
|
+
delta: tI,
|
|
15432
|
+
draggingRect: VI,
|
|
15433
|
+
pointerCoordinates: II,
|
|
15434
|
+
scrollableAncestors: NI,
|
|
15435
|
+
scrollableAncestorRects: PI
|
|
15364
15436
|
});
|
|
15365
|
-
let
|
|
15366
|
-
active:
|
|
15367
|
-
activeNode:
|
|
15368
|
-
activeNodeRect:
|
|
15369
|
-
activatorEvent:
|
|
15370
|
-
collisions:
|
|
15371
|
-
containerNodeRect:
|
|
15372
|
-
dragOverlay:
|
|
15373
|
-
draggableNodes:
|
|
15374
|
-
droppableContainers:
|
|
15375
|
-
droppableRects:
|
|
15376
|
-
over:
|
|
15377
|
-
measureDroppableContainers:
|
|
15378
|
-
scrollableAncestors:
|
|
15379
|
-
scrollableAncestorRects:
|
|
15380
|
-
measuringConfiguration:
|
|
15381
|
-
measuringScheduled:
|
|
15382
|
-
windowRect:
|
|
15437
|
+
let XI = useMemo(() => ({
|
|
15438
|
+
active: oI,
|
|
15439
|
+
activeNode: yI,
|
|
15440
|
+
activeNodeRect: CI,
|
|
15441
|
+
activatorEvent: uI,
|
|
15442
|
+
collisions: HI,
|
|
15443
|
+
containerNodeRect: wI,
|
|
15444
|
+
dragOverlay: DI,
|
|
15445
|
+
draggableNodes: eI,
|
|
15446
|
+
droppableContainers: rI,
|
|
15447
|
+
droppableRects: gI,
|
|
15448
|
+
over: WI,
|
|
15449
|
+
measureDroppableContainers: _I,
|
|
15450
|
+
scrollableAncestors: NI,
|
|
15451
|
+
scrollableAncestorRects: PI,
|
|
15452
|
+
measuringConfiguration: hI,
|
|
15453
|
+
measuringScheduled: vI,
|
|
15454
|
+
windowRect: MI
|
|
15383
15455
|
}), [
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
xI,
|
|
15456
|
+
oI,
|
|
15457
|
+
yI,
|
|
15458
|
+
CI,
|
|
15459
|
+
uI,
|
|
15460
|
+
HI,
|
|
15390
15461
|
wI,
|
|
15391
|
-
|
|
15462
|
+
DI,
|
|
15392
15463
|
eI,
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15464
|
+
rI,
|
|
15465
|
+
gI,
|
|
15466
|
+
WI,
|
|
15467
|
+
_I,
|
|
15468
|
+
NI,
|
|
15469
|
+
PI,
|
|
15399
15470
|
hI,
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15471
|
+
vI,
|
|
15472
|
+
MI
|
|
15473
|
+
]), ZI = useMemo(() => ({
|
|
15474
|
+
activatorEvent: uI,
|
|
15475
|
+
activators: YI,
|
|
15476
|
+
active: oI,
|
|
15477
|
+
activeNodeRect: CI,
|
|
15478
|
+
ariaDescribedById: { draggable: pI },
|
|
15407
15479
|
dispatch: W,
|
|
15408
|
-
draggableNodes:
|
|
15409
|
-
over:
|
|
15410
|
-
measureDroppableContainers:
|
|
15480
|
+
draggableNodes: eI,
|
|
15481
|
+
over: WI,
|
|
15482
|
+
measureDroppableContainers: _I
|
|
15411
15483
|
}), [
|
|
15412
|
-
sI,
|
|
15413
|
-
KI,
|
|
15414
|
-
rI,
|
|
15415
|
-
bI,
|
|
15416
|
-
W,
|
|
15417
15484
|
uI,
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15485
|
+
YI,
|
|
15486
|
+
oI,
|
|
15487
|
+
CI,
|
|
15488
|
+
W,
|
|
15489
|
+
pI,
|
|
15490
|
+
eI,
|
|
15491
|
+
WI,
|
|
15492
|
+
_I
|
|
15421
15493
|
]);
|
|
15422
|
-
return React.createElement(DndMonitorContext.Provider, { value:
|
|
15494
|
+
return React.createElement(DndMonitorContext.Provider, { value: GF }, React.createElement(InternalContext.Provider, { value: ZI }, React.createElement(PublicContext.Provider, { value: XI }, React.createElement(ActiveDraggableContext.Provider, { value: KI }, j)), React.createElement(RestoreFocus, { disabled: O?.restoreFocus === !1 })), React.createElement(Accessibility, {
|
|
15423
15495
|
...O,
|
|
15424
|
-
hiddenTextDescribedById:
|
|
15496
|
+
hiddenTextDescribedById: pI
|
|
15425
15497
|
}));
|
|
15426
|
-
function
|
|
15427
|
-
let n =
|
|
15498
|
+
function QI() {
|
|
15499
|
+
let n = cI?.autoScrollEnabled === !1, _ = typeof A == "object" ? A.enabled === !1 : A === !1, E = QF && !n && !_;
|
|
15428
15500
|
return typeof A == "object" ? {
|
|
15429
15501
|
...A,
|
|
15430
15502
|
enabled: E
|
|
@@ -15432,13 +15504,13 @@ var DndContext = /* @__PURE__ */ memo(function(n) {
|
|
|
15432
15504
|
}
|
|
15433
15505
|
}), NullContext = /* @__PURE__ */ createContext(null), defaultRole = "button", ID_PREFIX$1 = "Draggable";
|
|
15434
15506
|
function useDraggable(n) {
|
|
15435
|
-
let { id: _, data: E, disabled: O = !1, attributes: A } = n, j = useUniqueId(ID_PREFIX$1), { activators: M, activatorEvent: N, active: P, activeNodeRect: z, ariaDescribedById: B, draggableNodes: H, over: U } = useContext(InternalContext), { role: G = defaultRole, roleDescription: Z = "draggable", tabIndex:
|
|
15507
|
+
let { id: _, data: E, disabled: O = !1, attributes: A } = n, j = useUniqueId(ID_PREFIX$1), { activators: M, activatorEvent: N, active: P, activeNodeRect: z, ariaDescribedById: B, draggableNodes: H, over: U } = useContext(InternalContext), { role: G = defaultRole, roleDescription: Z = "draggable", tabIndex: GF = 0 } = A ?? {}, KF = P?.id === _, qF = useContext(KF ? ActiveDraggableContext : NullContext), [YF, XF] = useNodeRef(), [ZF, QF] = useNodeRef(), $F = useSyntheticListeners(M, _), eI = useLatestValue(E);
|
|
15436
15508
|
return useIsomorphicLayoutEffect$1(() => (H.set(_, {
|
|
15437
15509
|
id: _,
|
|
15438
15510
|
key: j,
|
|
15439
|
-
node:
|
|
15440
|
-
activatorNode:
|
|
15441
|
-
data:
|
|
15511
|
+
node: YF,
|
|
15512
|
+
activatorNode: ZF,
|
|
15513
|
+
data: eI
|
|
15442
15514
|
}), () => {
|
|
15443
15515
|
let n = H.get(_);
|
|
15444
15516
|
n && n.key === j && H.delete(_);
|
|
@@ -15448,26 +15520,26 @@ function useDraggable(n) {
|
|
|
15448
15520
|
activeNodeRect: z,
|
|
15449
15521
|
attributes: useMemo(() => ({
|
|
15450
15522
|
role: G,
|
|
15451
|
-
tabIndex:
|
|
15523
|
+
tabIndex: GF,
|
|
15452
15524
|
"aria-disabled": O,
|
|
15453
|
-
"aria-pressed":
|
|
15525
|
+
"aria-pressed": KF && G === defaultRole ? !0 : void 0,
|
|
15454
15526
|
"aria-roledescription": Z,
|
|
15455
15527
|
"aria-describedby": B.draggable
|
|
15456
15528
|
}), [
|
|
15457
15529
|
O,
|
|
15458
15530
|
G,
|
|
15459
|
-
|
|
15460
|
-
|
|
15531
|
+
GF,
|
|
15532
|
+
KF,
|
|
15461
15533
|
Z,
|
|
15462
15534
|
B.draggable
|
|
15463
15535
|
]),
|
|
15464
|
-
isDragging:
|
|
15465
|
-
listeners: O ? void 0 :
|
|
15466
|
-
node:
|
|
15536
|
+
isDragging: KF,
|
|
15537
|
+
listeners: O ? void 0 : $F,
|
|
15538
|
+
node: YF,
|
|
15467
15539
|
over: U,
|
|
15468
|
-
setNodeRef:
|
|
15469
|
-
setActivatorNodeRef:
|
|
15470
|
-
transform:
|
|
15540
|
+
setNodeRef: XF,
|
|
15541
|
+
setActivatorNodeRef: QF,
|
|
15542
|
+
transform: qF
|
|
15471
15543
|
};
|
|
15472
15544
|
}
|
|
15473
15545
|
function useDndContext() {
|
|
@@ -15475,34 +15547,34 @@ function useDndContext() {
|
|
|
15475
15547
|
}
|
|
15476
15548
|
var ID_PREFIX$1$1 = "Droppable", defaultResizeObserverConfig = { timeout: 25 };
|
|
15477
15549
|
function useDroppable(n) {
|
|
15478
|
-
let { data: _, disabled: E = !1, id: O, resizeObserverConfig: A } = n, j = useUniqueId(ID_PREFIX$1$1), { active: M, dispatch: N, over: P, measureDroppableContainers: z } = useContext(InternalContext), B = useRef({ disabled: E }), H = useRef(!1), Z = useRef(null),
|
|
15550
|
+
let { data: _, disabled: E = !1, id: O, resizeObserverConfig: A } = n, j = useUniqueId(ID_PREFIX$1$1), { active: M, dispatch: N, over: P, measureDroppableContainers: z } = useContext(InternalContext), B = useRef({ disabled: E }), H = useRef(!1), Z = useRef(null), GF = useRef(null), { disabled: KF, updateMeasurementsFor: qF, timeout: JF } = {
|
|
15479
15551
|
...defaultResizeObserverConfig,
|
|
15480
15552
|
...A
|
|
15481
|
-
},
|
|
15553
|
+
}, YF = useLatestValue(qF ?? O), ZF = useResizeObserver({
|
|
15482
15554
|
callback: useCallback(() => {
|
|
15483
15555
|
if (!H.current) {
|
|
15484
15556
|
H.current = !0;
|
|
15485
15557
|
return;
|
|
15486
15558
|
}
|
|
15487
|
-
|
|
15488
|
-
z(Array.isArray(
|
|
15489
|
-
},
|
|
15490
|
-
}, [
|
|
15491
|
-
disabled:
|
|
15492
|
-
}), [
|
|
15493
|
-
|
|
15494
|
-
}, [
|
|
15559
|
+
GF.current != null && clearTimeout(GF.current), GF.current = setTimeout(() => {
|
|
15560
|
+
z(Array.isArray(YF.current) ? YF.current : [YF.current]), GF.current = null;
|
|
15561
|
+
}, JF);
|
|
15562
|
+
}, [JF]),
|
|
15563
|
+
disabled: KF || !M
|
|
15564
|
+
}), [QF, $F] = useNodeRef(useCallback((n, _) => {
|
|
15565
|
+
ZF && (_ && (ZF.unobserve(_), H.current = !1), n && ZF.observe(n));
|
|
15566
|
+
}, [ZF])), eI = useLatestValue(_);
|
|
15495
15567
|
return useEffect(() => {
|
|
15496
|
-
!
|
|
15497
|
-
}, [
|
|
15568
|
+
!ZF || !QF.current || (ZF.disconnect(), H.current = !1, ZF.observe(QF.current));
|
|
15569
|
+
}, [QF, ZF]), useEffect(() => (N({
|
|
15498
15570
|
type: Action.RegisterDroppable,
|
|
15499
15571
|
element: {
|
|
15500
15572
|
id: O,
|
|
15501
15573
|
key: j,
|
|
15502
15574
|
disabled: E,
|
|
15503
|
-
node:
|
|
15575
|
+
node: QF,
|
|
15504
15576
|
rect: Z,
|
|
15505
|
-
data:
|
|
15577
|
+
data: eI
|
|
15506
15578
|
}
|
|
15507
15579
|
}), () => N({
|
|
15508
15580
|
type: Action.UnregisterDroppable,
|
|
@@ -15524,9 +15596,9 @@ function useDroppable(n) {
|
|
|
15524
15596
|
active: M,
|
|
15525
15597
|
rect: Z,
|
|
15526
15598
|
isOver: P?.id === O,
|
|
15527
|
-
node:
|
|
15599
|
+
node: QF,
|
|
15528
15600
|
over: P,
|
|
15529
|
-
setNodeRef:
|
|
15601
|
+
setNodeRef: $F
|
|
15530
15602
|
};
|
|
15531
15603
|
}
|
|
15532
15604
|
function AnimationManager(n) {
|
|
@@ -15663,13 +15735,13 @@ function createDefaultDropAnimation(n) {
|
|
|
15663
15735
|
active: j,
|
|
15664
15736
|
dragOverlay: M,
|
|
15665
15737
|
...P
|
|
15666
|
-
}),
|
|
15738
|
+
}), GF = M.node.animate(U, {
|
|
15667
15739
|
duration: _,
|
|
15668
15740
|
easing: E,
|
|
15669
15741
|
fill: "forwards"
|
|
15670
15742
|
});
|
|
15671
15743
|
return new Promise((n) => {
|
|
15672
|
-
|
|
15744
|
+
GF.onfinish = () => {
|
|
15673
15745
|
Z?.(), n();
|
|
15674
15746
|
};
|
|
15675
15747
|
});
|
|
@@ -15682,39 +15754,39 @@ function useKey(n) {
|
|
|
15682
15754
|
}, [n]);
|
|
15683
15755
|
}
|
|
15684
15756
|
var DragOverlay = /* @__PURE__ */ React.memo((n) => {
|
|
15685
|
-
let { adjustScale: E = !1, children: O, dropAnimation: A, style: j, transition: M, modifiers: N, wrapperElement: P = "div", className: z, zIndex: B = 999 } = n, { activatorEvent: H, active: U, activeNodeRect: G, containerNodeRect: Z, draggableNodes:
|
|
15757
|
+
let { adjustScale: E = !1, children: O, dropAnimation: A, style: j, transition: M, modifiers: N, wrapperElement: P = "div", className: z, zIndex: B = 999 } = n, { activatorEvent: H, active: U, activeNodeRect: G, containerNodeRect: Z, draggableNodes: GF, droppableContainers: KF, dragOverlay: qF, over: JF, measuringConfiguration: YF, scrollableAncestors: XF, scrollableAncestorRects: ZF, windowRect: QF } = useDndContext(), $F = useContext(ActiveDraggableContext), eI = useKey(U?.id), tI = applyModifiers(N, {
|
|
15686
15758
|
activatorEvent: H,
|
|
15687
15759
|
active: U,
|
|
15688
15760
|
activeNodeRect: G,
|
|
15689
15761
|
containerNodeRect: Z,
|
|
15690
|
-
draggingNodeRect:
|
|
15691
|
-
over:
|
|
15692
|
-
overlayNodeRect:
|
|
15693
|
-
scrollableAncestors:
|
|
15694
|
-
scrollableAncestorRects:
|
|
15695
|
-
transform:
|
|
15696
|
-
windowRect:
|
|
15697
|
-
}),
|
|
15762
|
+
draggingNodeRect: qF.rect,
|
|
15763
|
+
over: JF,
|
|
15764
|
+
overlayNodeRect: qF.rect,
|
|
15765
|
+
scrollableAncestors: XF,
|
|
15766
|
+
scrollableAncestorRects: ZF,
|
|
15767
|
+
transform: $F,
|
|
15768
|
+
windowRect: QF
|
|
15769
|
+
}), nI = useInitialValue(G), rI = useDropAnimation({
|
|
15698
15770
|
config: A,
|
|
15699
|
-
draggableNodes:
|
|
15700
|
-
droppableContainers:
|
|
15701
|
-
measuringConfiguration:
|
|
15702
|
-
}),
|
|
15703
|
-
return React.createElement(NullifiedContextProvider, null, React.createElement(AnimationManager, { animation:
|
|
15704
|
-
key:
|
|
15771
|
+
draggableNodes: GF,
|
|
15772
|
+
droppableContainers: KF,
|
|
15773
|
+
measuringConfiguration: YF
|
|
15774
|
+
}), iI = nI ? qF.setRef : void 0;
|
|
15775
|
+
return React.createElement(NullifiedContextProvider, null, React.createElement(AnimationManager, { animation: rI }, U && eI ? React.createElement(PositionedOverlay, {
|
|
15776
|
+
key: eI,
|
|
15705
15777
|
id: U.id,
|
|
15706
|
-
ref:
|
|
15778
|
+
ref: iI,
|
|
15707
15779
|
as: P,
|
|
15708
15780
|
activatorEvent: H,
|
|
15709
15781
|
adjustScale: E,
|
|
15710
15782
|
className: z,
|
|
15711
15783
|
transition: M,
|
|
15712
|
-
rect:
|
|
15784
|
+
rect: nI,
|
|
15713
15785
|
style: {
|
|
15714
15786
|
zIndex: B,
|
|
15715
15787
|
...j
|
|
15716
15788
|
},
|
|
15717
|
-
transform:
|
|
15789
|
+
transform: tI
|
|
15718
15790
|
}, O) : null));
|
|
15719
15791
|
});
|
|
15720
15792
|
function arrayMove(n, _, E) {
|
|
@@ -15798,40 +15870,40 @@ var ID_PREFIX = "Sortable", Context = /* @__PURE__ */ React.createContext({
|
|
|
15798
15870
|
}
|
|
15799
15871
|
});
|
|
15800
15872
|
function SortableContext(n) {
|
|
15801
|
-
let { children: E, id: O, items: A, strategy: j = rectSortingStrategy, disabled: M = !1 } = n, { active: N, dragOverlay: P, droppableRects: z, over: B, measureDroppableContainers: H } = useDndContext(), U = useUniqueId(ID_PREFIX, O), W = P.rect !== null, Z = useMemo(() => A.map((n) => typeof n == "object" && "id" in n ? n.id : n), [A]),
|
|
15873
|
+
let { children: E, id: O, items: A, strategy: j = rectSortingStrategy, disabled: M = !1 } = n, { active: N, dragOverlay: P, droppableRects: z, over: B, measureDroppableContainers: H } = useDndContext(), U = useUniqueId(ID_PREFIX, O), W = P.rect !== null, Z = useMemo(() => A.map((n) => typeof n == "object" && "id" in n ? n.id : n), [A]), GF = N != null, KF = N ? Z.indexOf(N.id) : -1, qF = B ? Z.indexOf(B.id) : -1, YF = useRef(Z), ZF = !itemsEqual(Z, YF.current), QF = qF !== -1 && KF === -1 || ZF, $F = normalizeDisabled(M);
|
|
15802
15874
|
useIsomorphicLayoutEffect$1(() => {
|
|
15803
|
-
|
|
15875
|
+
ZF && GF && H(Z);
|
|
15804
15876
|
}, [
|
|
15805
|
-
|
|
15877
|
+
ZF,
|
|
15806
15878
|
Z,
|
|
15807
|
-
|
|
15879
|
+
GF,
|
|
15808
15880
|
H
|
|
15809
15881
|
]), useEffect(() => {
|
|
15810
|
-
|
|
15882
|
+
YF.current = Z;
|
|
15811
15883
|
}, [Z]);
|
|
15812
|
-
let
|
|
15813
|
-
activeIndex:
|
|
15884
|
+
let eI = useMemo(() => ({
|
|
15885
|
+
activeIndex: KF,
|
|
15814
15886
|
containerId: U,
|
|
15815
|
-
disabled:
|
|
15816
|
-
disableTransforms:
|
|
15887
|
+
disabled: $F,
|
|
15888
|
+
disableTransforms: QF,
|
|
15817
15889
|
items: Z,
|
|
15818
|
-
overIndex:
|
|
15890
|
+
overIndex: qF,
|
|
15819
15891
|
useDragOverlay: W,
|
|
15820
15892
|
sortedRects: getSortedRects(Z, z),
|
|
15821
15893
|
strategy: j
|
|
15822
15894
|
}), [
|
|
15823
|
-
|
|
15895
|
+
KF,
|
|
15824
15896
|
U,
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15897
|
+
$F.draggable,
|
|
15898
|
+
$F.droppable,
|
|
15899
|
+
QF,
|
|
15828
15900
|
Z,
|
|
15829
|
-
|
|
15901
|
+
qF,
|
|
15830
15902
|
z,
|
|
15831
15903
|
W,
|
|
15832
15904
|
j
|
|
15833
15905
|
]);
|
|
15834
|
-
return React.createElement(Context.Provider, { value:
|
|
15906
|
+
return React.createElement(Context.Provider, { value: eI }, E);
|
|
15835
15907
|
}
|
|
15836
15908
|
var defaultNewIndexGetter = (n) => {
|
|
15837
15909
|
let { id: _, items: E, activeIndex: O, overIndex: A } = n;
|
|
@@ -15873,112 +15945,112 @@ function useDerivedTransform(n) {
|
|
|
15873
15945
|
}, [j]), j;
|
|
15874
15946
|
}
|
|
15875
15947
|
function useSortable(n) {
|
|
15876
|
-
let { animateLayoutChanges: _ = defaultAnimateLayoutChanges, attributes: E, disabled: O, data: A, getNewIndex: j = defaultNewIndexGetter, id: M, strategy: N, resizeObserverConfig: P, transition: z = defaultTransition } = n, { items: B, containerId: H, activeIndex: U, disabled: Z, disableTransforms:
|
|
15948
|
+
let { animateLayoutChanges: _ = defaultAnimateLayoutChanges, attributes: E, disabled: O, data: A, getNewIndex: j = defaultNewIndexGetter, id: M, strategy: N, resizeObserverConfig: P, transition: z = defaultTransition } = n, { items: B, containerId: H, activeIndex: U, disabled: Z, disableTransforms: GF, sortedRects: KF, overIndex: qF, useDragOverlay: YF, strategy: ZF } = useContext(Context), QF = normalizeLocalDisabled(O, Z), $F = B.indexOf(M), eI = useMemo(() => ({
|
|
15877
15949
|
sortable: {
|
|
15878
15950
|
containerId: H,
|
|
15879
|
-
index:
|
|
15951
|
+
index: $F,
|
|
15880
15952
|
items: B
|
|
15881
15953
|
},
|
|
15882
15954
|
...A
|
|
15883
15955
|
}), [
|
|
15884
15956
|
H,
|
|
15885
15957
|
A,
|
|
15886
|
-
|
|
15958
|
+
$F,
|
|
15887
15959
|
B
|
|
15888
|
-
]),
|
|
15960
|
+
]), tI = useMemo(() => B.slice(B.indexOf(M)), [B, M]), { rect: nI, node: rI, isOver: iI, setNodeRef: aI } = useDroppable({
|
|
15889
15961
|
id: M,
|
|
15890
|
-
data:
|
|
15891
|
-
disabled:
|
|
15962
|
+
data: eI,
|
|
15963
|
+
disabled: QF.droppable,
|
|
15892
15964
|
resizeObserverConfig: {
|
|
15893
|
-
updateMeasurementsFor:
|
|
15965
|
+
updateMeasurementsFor: tI,
|
|
15894
15966
|
...P
|
|
15895
15967
|
}
|
|
15896
|
-
}), { active:
|
|
15968
|
+
}), { active: oI, activatorEvent: sI, activeNodeRect: cI, attributes: lI, setNodeRef: uI, listeners: dI, isDragging: fI, over: pI, setActivatorNodeRef: mI, transform: hI } = useDraggable({
|
|
15897
15969
|
id: M,
|
|
15898
|
-
data:
|
|
15970
|
+
data: eI,
|
|
15899
15971
|
attributes: {
|
|
15900
15972
|
...defaultAttributes,
|
|
15901
15973
|
...E
|
|
15902
15974
|
},
|
|
15903
|
-
disabled:
|
|
15904
|
-
}),
|
|
15905
|
-
rects:
|
|
15906
|
-
activeNodeRect:
|
|
15975
|
+
disabled: QF.draggable
|
|
15976
|
+
}), gI = useCombinedRefs(aI, uI), _I = !!oI, vI = _I && !GF && isValidIndex(U) && isValidIndex(qF), yI = !YF && fI, bI = vI ? (yI && vI ? hI : null) ?? (N ?? ZF)({
|
|
15977
|
+
rects: KF,
|
|
15978
|
+
activeNodeRect: cI,
|
|
15907
15979
|
activeIndex: U,
|
|
15908
|
-
overIndex:
|
|
15909
|
-
index:
|
|
15910
|
-
}) : null,
|
|
15980
|
+
overIndex: qF,
|
|
15981
|
+
index: $F
|
|
15982
|
+
}) : null, xI = isValidIndex(U) && isValidIndex(qF) ? j({
|
|
15911
15983
|
id: M,
|
|
15912
15984
|
items: B,
|
|
15913
15985
|
activeIndex: U,
|
|
15914
|
-
overIndex:
|
|
15915
|
-
}) :
|
|
15916
|
-
activeId:
|
|
15986
|
+
overIndex: qF
|
|
15987
|
+
}) : $F, SI = oI?.id, CI = useRef({
|
|
15988
|
+
activeId: SI,
|
|
15917
15989
|
items: B,
|
|
15918
|
-
newIndex:
|
|
15990
|
+
newIndex: xI,
|
|
15919
15991
|
containerId: H
|
|
15920
|
-
}),
|
|
15921
|
-
active:
|
|
15992
|
+
}), wI = B !== CI.current.items, TI = _({
|
|
15993
|
+
active: oI,
|
|
15922
15994
|
containerId: H,
|
|
15923
|
-
isDragging:
|
|
15924
|
-
isSorting:
|
|
15995
|
+
isDragging: fI,
|
|
15996
|
+
isSorting: _I,
|
|
15925
15997
|
id: M,
|
|
15926
|
-
index:
|
|
15998
|
+
index: $F,
|
|
15927
15999
|
items: B,
|
|
15928
|
-
newIndex:
|
|
15929
|
-
previousItems:
|
|
15930
|
-
previousContainerId:
|
|
16000
|
+
newIndex: CI.current.newIndex,
|
|
16001
|
+
previousItems: CI.current.items,
|
|
16002
|
+
previousContainerId: CI.current.containerId,
|
|
15931
16003
|
transition: z,
|
|
15932
|
-
wasDragging:
|
|
15933
|
-
}),
|
|
15934
|
-
disabled: !
|
|
15935
|
-
index:
|
|
15936
|
-
node:
|
|
15937
|
-
rect:
|
|
16004
|
+
wasDragging: CI.current.activeId != null
|
|
16005
|
+
}), EI = useDerivedTransform({
|
|
16006
|
+
disabled: !TI,
|
|
16007
|
+
index: $F,
|
|
16008
|
+
node: rI,
|
|
16009
|
+
rect: nI
|
|
15938
16010
|
});
|
|
15939
16011
|
return useEffect(() => {
|
|
15940
|
-
|
|
16012
|
+
_I && CI.current.newIndex !== xI && (CI.current.newIndex = xI), H !== CI.current.containerId && (CI.current.containerId = H), B !== CI.current.items && (CI.current.items = B);
|
|
15941
16013
|
}, [
|
|
15942
|
-
|
|
15943
|
-
|
|
16014
|
+
_I,
|
|
16015
|
+
xI,
|
|
15944
16016
|
H,
|
|
15945
16017
|
B
|
|
15946
16018
|
]), useEffect(() => {
|
|
15947
|
-
if (
|
|
15948
|
-
if (
|
|
15949
|
-
|
|
16019
|
+
if (SI === CI.current.activeId) return;
|
|
16020
|
+
if (SI != null && CI.current.activeId == null) {
|
|
16021
|
+
CI.current.activeId = SI;
|
|
15950
16022
|
return;
|
|
15951
16023
|
}
|
|
15952
16024
|
let n = setTimeout(() => {
|
|
15953
|
-
|
|
16025
|
+
CI.current.activeId = SI;
|
|
15954
16026
|
}, 50);
|
|
15955
16027
|
return () => clearTimeout(n);
|
|
15956
|
-
}, [
|
|
15957
|
-
active:
|
|
16028
|
+
}, [SI]), {
|
|
16029
|
+
active: oI,
|
|
15958
16030
|
activeIndex: U,
|
|
15959
|
-
attributes:
|
|
15960
|
-
data:
|
|
15961
|
-
rect:
|
|
15962
|
-
index:
|
|
15963
|
-
newIndex:
|
|
16031
|
+
attributes: lI,
|
|
16032
|
+
data: eI,
|
|
16033
|
+
rect: nI,
|
|
16034
|
+
index: $F,
|
|
16035
|
+
newIndex: xI,
|
|
15964
16036
|
items: B,
|
|
15965
|
-
isOver:
|
|
15966
|
-
isSorting:
|
|
15967
|
-
isDragging:
|
|
15968
|
-
listeners:
|
|
15969
|
-
node:
|
|
15970
|
-
overIndex:
|
|
15971
|
-
over:
|
|
15972
|
-
setNodeRef:
|
|
15973
|
-
setActivatorNodeRef:
|
|
15974
|
-
setDroppableNodeRef:
|
|
15975
|
-
setDraggableNodeRef:
|
|
15976
|
-
transform:
|
|
15977
|
-
transition:
|
|
16037
|
+
isOver: iI,
|
|
16038
|
+
isSorting: _I,
|
|
16039
|
+
isDragging: fI,
|
|
16040
|
+
listeners: dI,
|
|
16041
|
+
node: rI,
|
|
16042
|
+
overIndex: qF,
|
|
16043
|
+
over: pI,
|
|
16044
|
+
setNodeRef: gI,
|
|
16045
|
+
setActivatorNodeRef: mI,
|
|
16046
|
+
setDroppableNodeRef: aI,
|
|
16047
|
+
setDraggableNodeRef: uI,
|
|
16048
|
+
transform: EI ?? bI,
|
|
16049
|
+
transition: DI()
|
|
15978
16050
|
};
|
|
15979
|
-
function
|
|
15980
|
-
if (
|
|
15981
|
-
if (!(
|
|
16051
|
+
function DI() {
|
|
16052
|
+
if (EI || wI && CI.current.newIndex === $F) return disabledTransition;
|
|
16053
|
+
if (!(yI && !isKeyboardEvent(sI) || !z) && (_I || TI)) return CSS$1.Transition.toString({
|
|
15982
16054
|
...z,
|
|
15983
16055
|
property: transitionProperty
|
|
15984
16056
|
});
|
|
@@ -16357,13 +16429,13 @@ function createRenderBatcher(n, _) {
|
|
|
16357
16429
|
}, j = () => E = !0, M = stepsOrder.reduce((n, E) => (n[E] = createRenderStep(j, _ ? E : void 0), n), {}), { setup: N, read: P, resolveKeyframes: z, preUpdate: B, update: H, preRender: U, render: W, postRender: G } = M, Z = () => {
|
|
16358
16430
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
16359
16431
|
E = !1, MotionGlobalConfig.useManualTiming || (A.delta = O ? 1e3 / 60 : Math.max(Math.min(j - A.timestamp, maxElapsed), 1)), A.timestamp = j, A.isProcessing = !0, N.process(A), P.process(A), z.process(A), B.process(A), H.process(A), U.process(A), W.process(A), G.process(A), A.isProcessing = !1, E && _ && (O = !1, n(Z));
|
|
16360
|
-
},
|
|
16432
|
+
}, GF = () => {
|
|
16361
16433
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
16362
16434
|
};
|
|
16363
16435
|
return {
|
|
16364
16436
|
schedule: stepsOrder.reduce((n, _) => {
|
|
16365
16437
|
let O = M[_];
|
|
16366
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
16438
|
+
return n[_] = (n, _ = !1, A = !1) => (E || GF(), O.schedule(n, _, A)), n;
|
|
16367
16439
|
}, {}),
|
|
16368
16440
|
cancel: (n) => {
|
|
16369
16441
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -16721,40 +16793,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
16721
16793
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
16722
16794
|
...E,
|
|
16723
16795
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
16724
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
16725
|
-
O ||=
|
|
16726
|
-
let
|
|
16796
|
+
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), GF = M - j, KF = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), qF = Math.abs(GF) < 5;
|
|
16797
|
+
O ||= qF ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= qF ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
16798
|
+
let JF;
|
|
16727
16799
|
if (Z < 1) {
|
|
16728
|
-
let n = calcAngularFreq(
|
|
16729
|
-
|
|
16730
|
-
} else if (Z === 1)
|
|
16800
|
+
let n = calcAngularFreq(KF, Z);
|
|
16801
|
+
JF = (_) => M - Math.exp(-Z * KF * _) * ((G + Z * KF * GF) / n * Math.sin(n * _) + GF * Math.cos(n * _));
|
|
16802
|
+
} else if (Z === 1) JF = (n) => M - Math.exp(-KF * n) * (GF + (G + KF * GF) * n);
|
|
16731
16803
|
else {
|
|
16732
|
-
let n =
|
|
16733
|
-
|
|
16734
|
-
let E = Math.exp(-Z *
|
|
16735
|
-
return M - E * ((G + Z *
|
|
16804
|
+
let n = KF * Math.sqrt(Z * Z - 1);
|
|
16805
|
+
JF = (_) => {
|
|
16806
|
+
let E = Math.exp(-Z * KF * _), O = Math.min(n * _, 300);
|
|
16807
|
+
return M - E * ((G + Z * KF * GF) * Math.sinh(O) + n * GF * Math.cosh(O)) / n;
|
|
16736
16808
|
};
|
|
16737
16809
|
}
|
|
16738
|
-
let
|
|
16810
|
+
let YF = {
|
|
16739
16811
|
calculatedDuration: W && H || null,
|
|
16740
16812
|
next: (n) => {
|
|
16741
|
-
let _ =
|
|
16813
|
+
let _ = JF(n);
|
|
16742
16814
|
if (W) N.done = n >= H;
|
|
16743
16815
|
else {
|
|
16744
16816
|
let E = n === 0 ? G : 0;
|
|
16745
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
16817
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(JF, n, _));
|
|
16746
16818
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
16747
16819
|
N.done = j && P;
|
|
16748
16820
|
}
|
|
16749
16821
|
return N.value = N.done ? M : _, N;
|
|
16750
16822
|
},
|
|
16751
16823
|
toString: () => {
|
|
16752
|
-
let n = Math.min(calcGeneratorDuration(
|
|
16824
|
+
let n = Math.min(calcGeneratorDuration(YF), maxGeneratorDuration), _ = generateLinearEasing((_) => YF.next(n * _).value, n, 30);
|
|
16753
16825
|
return n + "ms " + _;
|
|
16754
16826
|
},
|
|
16755
16827
|
toTransition: () => {}
|
|
16756
16828
|
};
|
|
16757
|
-
return
|
|
16829
|
+
return YF;
|
|
16758
16830
|
}
|
|
16759
16831
|
spring.applyToOptions = (n) => {
|
|
16760
16832
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -16764,26 +16836,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
16764
16836
|
let H = n[0], U = {
|
|
16765
16837
|
done: !1,
|
|
16766
16838
|
value: H
|
|
16767
|
-
}, W = (n) => N !== void 0 && n < N || P !== void 0 && n > P, G = (n) => N === void 0 ? P : P === void 0 || Math.abs(N - n) < Math.abs(P - n) ? N : P, Z = E * _,
|
|
16768
|
-
|
|
16769
|
-
let
|
|
16770
|
-
let _ =
|
|
16771
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
16772
|
-
},
|
|
16773
|
-
W(U.value) && (
|
|
16839
|
+
}, W = (n) => N !== void 0 && n < N || P !== void 0 && n > P, G = (n) => N === void 0 ? P : P === void 0 || Math.abs(N - n) < Math.abs(P - n) ? N : P, Z = E * _, GF = H + Z, KF = M === void 0 ? GF : M(GF);
|
|
16840
|
+
KF !== GF && (Z = KF - H);
|
|
16841
|
+
let qF = (n) => -Z * Math.exp(-n / O), JF = (n) => KF + qF(n), YF = (n) => {
|
|
16842
|
+
let _ = qF(n), E = JF(n);
|
|
16843
|
+
U.done = Math.abs(_) <= z, U.value = U.done ? KF : E;
|
|
16844
|
+
}, XF, ZF, QF = (n) => {
|
|
16845
|
+
W(U.value) && (XF = n, ZF = spring({
|
|
16774
16846
|
keyframes: [U.value, G(U.value)],
|
|
16775
|
-
velocity: calcGeneratorVelocity(
|
|
16847
|
+
velocity: calcGeneratorVelocity(JF, n, U.value),
|
|
16776
16848
|
damping: A,
|
|
16777
16849
|
stiffness: j,
|
|
16778
16850
|
restDelta: z,
|
|
16779
16851
|
restSpeed: B
|
|
16780
16852
|
}));
|
|
16781
16853
|
};
|
|
16782
|
-
return
|
|
16854
|
+
return QF(0), {
|
|
16783
16855
|
calculatedDuration: null,
|
|
16784
16856
|
next: (n) => {
|
|
16785
16857
|
let _ = !1;
|
|
16786
|
-
return !
|
|
16858
|
+
return !ZF && XF === void 0 && (_ = !0, YF(n), QF(n)), XF !== void 0 && n >= XF ? ZF.next(n - XF) : (!_ && YF(n), U);
|
|
16787
16859
|
}
|
|
16788
16860
|
};
|
|
16789
16861
|
}
|
|
@@ -16903,22 +16975,22 @@ var WithPromise = class {
|
|
|
16903
16975
|
if (this.startTime === null) return E.next(0);
|
|
16904
16976
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
16905
16977
|
this.speed > 0 ? this.startTime = Math.min(this.startTime, n) : this.speed < 0 && (this.startTime = Math.min(n - O / this.speed, this.startTime)), _ ? this.currentTime = n : this.updateTime(n);
|
|
16906
|
-
let
|
|
16907
|
-
this.currentTime = Math.max(
|
|
16908
|
-
let
|
|
16978
|
+
let GF = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), KF = this.playbackSpeed >= 0 ? GF < 0 : GF > O;
|
|
16979
|
+
this.currentTime = Math.max(GF, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
|
|
16980
|
+
let qF = this.currentTime, JF = E;
|
|
16909
16981
|
if (B) {
|
|
16910
16982
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
16911
|
-
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (
|
|
16983
|
+
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (JF = j)), qF = clamp(0, 1, E) * M;
|
|
16912
16984
|
}
|
|
16913
|
-
let
|
|
16985
|
+
let YF = KF ? {
|
|
16914
16986
|
done: !1,
|
|
16915
16987
|
value: z[0]
|
|
16916
|
-
} :
|
|
16917
|
-
A && (
|
|
16918
|
-
let { done:
|
|
16919
|
-
!
|
|
16920
|
-
let
|
|
16921
|
-
return
|
|
16988
|
+
} : JF.next(qF);
|
|
16989
|
+
A && (YF.value = A(YF.value));
|
|
16990
|
+
let { done: XF } = YF;
|
|
16991
|
+
!KF && N !== null && (XF = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
|
|
16992
|
+
let ZF = this.holdTime === null && (this.state === "finished" || this.state === "running" && XF);
|
|
16993
|
+
return ZF && W !== inertia && (YF.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(YF.value), ZF && this.finish(), YF;
|
|
16922
16994
|
}
|
|
16923
16995
|
then(n, _) {
|
|
16924
16996
|
return this.finished.then(n, _);
|
|
@@ -17981,46 +18053,46 @@ function onlyElements(n) {
|
|
|
17981
18053
|
}), _;
|
|
17982
18054
|
}
|
|
17983
18055
|
var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
|
|
17984
|
-
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), U = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H),
|
|
18056
|
+
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), U = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), GF = useConstant(() => /* @__PURE__ */ new Map()), KF = useRef(/* @__PURE__ */ new Set()), [qF, YF] = useState(H), [QF, $F] = useState(H);
|
|
17985
18057
|
useIsomorphicLayoutEffect(() => {
|
|
17986
18058
|
G.current = !1, Z.current = H;
|
|
17987
|
-
for (let n = 0; n <
|
|
17988
|
-
let _ = getChildKey(
|
|
17989
|
-
U.includes(_) ? (
|
|
18059
|
+
for (let n = 0; n < QF.length; n++) {
|
|
18060
|
+
let _ = getChildKey(QF[n]);
|
|
18061
|
+
U.includes(_) ? (GF.delete(_), KF.current.delete(_)) : GF.get(_) !== !0 && GF.set(_, !1);
|
|
17990
18062
|
}
|
|
17991
18063
|
}, [
|
|
17992
|
-
|
|
18064
|
+
QF,
|
|
17993
18065
|
U.length,
|
|
17994
18066
|
U.join("-")
|
|
17995
18067
|
]);
|
|
17996
|
-
let
|
|
17997
|
-
if (H !==
|
|
18068
|
+
let eI = [];
|
|
18069
|
+
if (H !== qF) {
|
|
17998
18070
|
let n = [...H];
|
|
17999
|
-
for (let _ = 0; _ <
|
|
18000
|
-
let E =
|
|
18001
|
-
U.includes(O) || (n.splice(_, 0, E),
|
|
18071
|
+
for (let _ = 0; _ < QF.length; _++) {
|
|
18072
|
+
let E = QF[_], O = getChildKey(E);
|
|
18073
|
+
U.includes(O) || (n.splice(_, 0, E), eI.push(E));
|
|
18002
18074
|
}
|
|
18003
|
-
return j === "wait" &&
|
|
18075
|
+
return j === "wait" && eI.length && (n = eI), $F(onlyElements(n)), YF(H), null;
|
|
18004
18076
|
}
|
|
18005
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
18006
|
-
let { forceRender:
|
|
18007
|
-
return jsx(Fragment$1, { children:
|
|
18008
|
-
let W = getChildKey(n),
|
|
18077
|
+
process.env.NODE_ENV !== "production" && j === "wait" && QF.length > 1 && console.warn("You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.");
|
|
18078
|
+
let { forceRender: tI } = useContext(LayoutGroupContext);
|
|
18079
|
+
return jsx(Fragment$1, { children: QF.map((n) => {
|
|
18080
|
+
let W = getChildKey(n), qF = M && !z ? !1 : H === QF || U.includes(W);
|
|
18009
18081
|
return jsx(PresenceChild, {
|
|
18010
|
-
isPresent:
|
|
18082
|
+
isPresent: qF,
|
|
18011
18083
|
initial: !G.current || E ? void 0 : !1,
|
|
18012
18084
|
custom: _,
|
|
18013
18085
|
presenceAffectsLayout: A,
|
|
18014
18086
|
mode: j,
|
|
18015
18087
|
root: P,
|
|
18016
|
-
onExitComplete:
|
|
18017
|
-
if (
|
|
18018
|
-
if (
|
|
18088
|
+
onExitComplete: qF ? void 0 : () => {
|
|
18089
|
+
if (KF.current.has(W)) return;
|
|
18090
|
+
if (KF.current.add(W), GF.has(W)) GF.set(W, !0);
|
|
18019
18091
|
else return;
|
|
18020
18092
|
let n = !0;
|
|
18021
|
-
|
|
18093
|
+
GF.forEach((_) => {
|
|
18022
18094
|
_ || (n = !1);
|
|
18023
|
-
}), n && (
|
|
18095
|
+
}), n && (tI?.(), $F(Z.current), M && B?.(), O && O());
|
|
18024
18096
|
},
|
|
18025
18097
|
anchorX: N,
|
|
18026
18098
|
children: n
|
|
@@ -18449,12 +18521,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
18449
18521
|
useInsertionEffect(() => {
|
|
18450
18522
|
H && Z.current && H.update(E, P);
|
|
18451
18523
|
});
|
|
18452
|
-
let
|
|
18524
|
+
let GF = E[optimizedAppearDataAttribute], qF = useRef(!!GF && !window.MotionHandoffIsComplete?.(GF) && window.MotionHasOptimisedAnimation?.(GF));
|
|
18453
18525
|
return useIsomorphicLayoutEffect(() => {
|
|
18454
|
-
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(),
|
|
18526
|
+
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), qF.current && H.animationState && H.animationState.animateChanges());
|
|
18455
18527
|
}), useEffect(() => {
|
|
18456
|
-
H && (!
|
|
18457
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
18528
|
+
H && (!qF.current && H.animationState && H.animationState.animateChanges(), qF.current &&= (queueMicrotask(() => {
|
|
18529
|
+
window.MotionHandoffMarkAsComplete?.(GF);
|
|
18458
18530
|
}), !1), H.enteringChildren = void 0);
|
|
18459
18531
|
}), H;
|
|
18460
18532
|
}
|
|
@@ -19132,34 +19204,34 @@ function createAnimationState(n) {
|
|
|
19132
19204
|
function M(j) {
|
|
19133
19205
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
19134
19206
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
19135
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
19136
|
-
|
|
19137
|
-
let
|
|
19138
|
-
if (
|
|
19139
|
-
let
|
|
19140
|
-
|
|
19141
|
-
let { prevResolvedValues:
|
|
19142
|
-
...
|
|
19143
|
-
...
|
|
19144
|
-
},
|
|
19145
|
-
|
|
19207
|
+
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), GF = U === j ? W.isActive : null;
|
|
19208
|
+
GF === !1 && (H = _);
|
|
19209
|
+
let KF = G === N[U] && G !== M[U] && Z;
|
|
19210
|
+
if (KF && O && n.manuallyAnimateOnMount && (KF = !1), W.protectedKeys = { ...B }, !W.isActive && GF === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
|
|
19211
|
+
let qF = checkVariantsDidChange(W.prevProp, G), JF = qF || U === j && W.isActive && !KF && Z || _ > H && Z, YF = !1, XF = Array.isArray(G) ? G : [G], ZF = XF.reduce(A(U), {});
|
|
19212
|
+
GF === !1 && (ZF = {});
|
|
19213
|
+
let { prevResolvedValues: QF = {} } = W, $F = {
|
|
19214
|
+
...QF,
|
|
19215
|
+
...ZF
|
|
19216
|
+
}, eI = (_) => {
|
|
19217
|
+
JF = !0, z.has(_) && (YF = !0, z.delete(_)), W.needsAnimating[_] = !0;
|
|
19146
19218
|
let E = n.getValue(_);
|
|
19147
19219
|
E && (E.liveStyle = !1);
|
|
19148
19220
|
};
|
|
19149
|
-
for (let n in
|
|
19150
|
-
let _ =
|
|
19221
|
+
for (let n in $F) {
|
|
19222
|
+
let _ = ZF[n], E = QF[n];
|
|
19151
19223
|
if (B.hasOwnProperty(n)) continue;
|
|
19152
19224
|
let O = !1;
|
|
19153
|
-
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) :
|
|
19225
|
+
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : eI(n) : _ !== void 0 && z.has(n) ? eI(n) : W.protectedKeys[n] = !0;
|
|
19154
19226
|
}
|
|
19155
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
19227
|
+
W.prevProp = G, W.prevResolvedValues = ZF, W.isActive && (B = {
|
|
19156
19228
|
...B,
|
|
19157
|
-
...
|
|
19158
|
-
}), O && n.blockInitialAnimation && (
|
|
19159
|
-
let
|
|
19160
|
-
|
|
19229
|
+
...ZF
|
|
19230
|
+
}), O && n.blockInitialAnimation && (JF = !1);
|
|
19231
|
+
let tI = KF && qF;
|
|
19232
|
+
JF && (!tI || YF) && P.push(...XF.map((_) => {
|
|
19161
19233
|
let E = { type: U };
|
|
19162
|
-
if (typeof _ == "string" && O && !
|
|
19234
|
+
if (typeof _ == "string" && O && !tI && n.manuallyAnimateOnMount && n.parent) {
|
|
19163
19235
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
19164
19236
|
if (O.enteringChildren && A) {
|
|
19165
19237
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -20730,7 +20802,17 @@ const processLayout = (n, _) => {
|
|
|
20730
20802
|
totalHeight: j
|
|
20731
20803
|
};
|
|
20732
20804
|
};
|
|
20733
|
-
var
|
|
20805
|
+
var getTimingFunction = (n) => {
|
|
20806
|
+
switch (n) {
|
|
20807
|
+
case "linear": return "linear";
|
|
20808
|
+
case "ease-in": return "easeIn";
|
|
20809
|
+
case "ease-out": return "easeOut";
|
|
20810
|
+
case "ease-in-out": return "easeInOut";
|
|
20811
|
+
case "bounce": return "easeOut";
|
|
20812
|
+
case "ease": return "easeInOut";
|
|
20813
|
+
default: return "easeOut";
|
|
20814
|
+
}
|
|
20815
|
+
}, getAnimationVariants = (n) => {
|
|
20734
20816
|
if (!n || n.type === "none") return {
|
|
20735
20817
|
initial: {
|
|
20736
20818
|
opacity: 0,
|
|
@@ -20915,19 +20997,20 @@ var getAnimationVariants = (n) => {
|
|
|
20915
20997
|
]
|
|
20916
20998
|
});
|
|
20917
20999
|
}, ListItem = ({ item: n, elements: E, animation: O }) => {
|
|
20918
|
-
let { elements: A, totalHeight: j } = React.useMemo(() => processLayout(E, n), [E, n]), M = React.useMemo(() => getAnimationVariants(O), [O])
|
|
21000
|
+
let { elements: A, totalHeight: j } = React.useMemo(() => processLayout(E, n), [E, n]), M = React.useMemo(() => getAnimationVariants(O), [O]), N = React.useMemo(() => M.animate?.transition || {
|
|
21001
|
+
duration: O?.duration || .4,
|
|
21002
|
+
ease: getTimingFunction(O?.timingFunction)
|
|
21003
|
+
}, [O, M]);
|
|
20919
21004
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
20920
21005
|
layout: !0,
|
|
20921
|
-
|
|
20922
|
-
|
|
21006
|
+
variants: M,
|
|
21007
|
+
initial: "initial",
|
|
21008
|
+
animate: "animate",
|
|
20923
21009
|
exit: {
|
|
20924
21010
|
opacity: 0,
|
|
20925
21011
|
scale: .9
|
|
20926
21012
|
},
|
|
20927
|
-
transition:
|
|
20928
|
-
duration: O?.duration || .4,
|
|
20929
|
-
ease: O?.timingFunction || "easeOut"
|
|
20930
|
-
},
|
|
21013
|
+
transition: N,
|
|
20931
21014
|
whileHover: {
|
|
20932
21015
|
scale: 1.02,
|
|
20933
21016
|
transition: { duration: .2 }
|
|
@@ -21039,7 +21122,6 @@ const Preview = () => {
|
|
|
21039
21122
|
},
|
|
21040
21123
|
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
21041
21124
|
mode: "popLayout",
|
|
21042
|
-
initial: !1,
|
|
21043
21125
|
children: _.map((_, E) => /* @__PURE__ */ jsx(ListItem, {
|
|
21044
21126
|
item: _,
|
|
21045
21127
|
elements: n.elements,
|
|
@@ -21309,10 +21391,10 @@ const Ruler = ({ orientation: n }) => {
|
|
|
21309
21391
|
});
|
|
21310
21392
|
let N = j - n + 100, P = M - O + 100, z = window.innerWidth - 300, B = window.innerHeight - 100, H = z / N, U = B / P, W = Math.min(H, U);
|
|
21311
21393
|
W = Math.min(Math.max(W, .1), 5), _(W);
|
|
21312
|
-
let G = (n + j) / 2, Z = (O + M) / 2,
|
|
21394
|
+
let G = (n + j) / 2, Z = (O + M) / 2, GF = z / 2, KF = B / 2;
|
|
21313
21395
|
E({
|
|
21314
|
-
x:
|
|
21315
|
-
y:
|
|
21396
|
+
x: GF - G * W,
|
|
21397
|
+
y: KF - Z * W
|
|
21316
21398
|
});
|
|
21317
21399
|
},
|
|
21318
21400
|
children: /* @__PURE__ */ jsx(AspectRatioIcon, {})
|
|
@@ -21322,34 +21404,34 @@ const Ruler = ({ orientation: n }) => {
|
|
|
21322
21404
|
});
|
|
21323
21405
|
};
|
|
21324
21406
|
var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
21325
|
-
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), [W, G] = useState(!1), { addElement: Z, loadState:
|
|
21407
|
+
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), [W, G] = useState(!1), { addElement: Z, loadState: GF, state: KF, undo: qF, redo: JF, copy: YF, paste: XF, removeSelected: QF, updateElements: $F } = useEditor(), eI = React.useRef(null);
|
|
21326
21408
|
React.useEffect(() => {
|
|
21327
21409
|
let n = () => {
|
|
21328
21410
|
G(window.innerWidth < 768);
|
|
21329
21411
|
};
|
|
21330
21412
|
return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
21331
21413
|
}, []);
|
|
21332
|
-
let
|
|
21414
|
+
let tI = () => {
|
|
21333
21415
|
let n = {
|
|
21334
|
-
elements:
|
|
21335
|
-
isList:
|
|
21336
|
-
mockData:
|
|
21337
|
-
singleMockData:
|
|
21338
|
-
listSettings:
|
|
21339
|
-
canvasHeight:
|
|
21340
|
-
gridSize:
|
|
21416
|
+
elements: KF.elements,
|
|
21417
|
+
isList: KF.isList,
|
|
21418
|
+
mockData: KF.mockData,
|
|
21419
|
+
singleMockData: KF.singleMockData,
|
|
21420
|
+
listSettings: KF.listSettings,
|
|
21421
|
+
canvasHeight: KF.canvasHeight,
|
|
21422
|
+
gridSize: KF.gridSize
|
|
21341
21423
|
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
21342
21424
|
A.href = O, A.download = `layout-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, document.body.appendChild(A), A.click(), document.body.removeChild(A), URL.revokeObjectURL(O);
|
|
21343
|
-
},
|
|
21344
|
-
|
|
21345
|
-
},
|
|
21425
|
+
}, nI = () => {
|
|
21426
|
+
eI.current?.click();
|
|
21427
|
+
}, rI = (n) => {
|
|
21346
21428
|
let _ = n.target.files?.[0];
|
|
21347
21429
|
if (!_) return;
|
|
21348
21430
|
let E = new FileReader();
|
|
21349
21431
|
E.onload = (n) => {
|
|
21350
21432
|
try {
|
|
21351
21433
|
let _ = n.target?.result;
|
|
21352
|
-
|
|
21434
|
+
GF(JSON.parse(_));
|
|
21353
21435
|
} catch (n) {
|
|
21354
21436
|
console.error("Failed to import layout", n), alert("Erro ao importar layout. Arquivo inválido.");
|
|
21355
21437
|
}
|
|
@@ -21382,21 +21464,21 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21382
21464
|
}, [Z]), React.useEffect(() => {
|
|
21383
21465
|
let n = (n) => {
|
|
21384
21466
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
21385
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
21386
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
21387
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
21388
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
21389
|
-
else if (n.key === "Delete" || n.key === "Backspace")
|
|
21467
|
+
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), JF()) : (n.preventDefault(), qF());
|
|
21468
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), JF();
|
|
21469
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), YF();
|
|
21470
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), XF();
|
|
21471
|
+
else if (n.key === "Delete" || n.key === "Backspace") KF.selectedElementIds.length > 0 && (n.preventDefault(), QF());
|
|
21390
21472
|
else if ([
|
|
21391
21473
|
"ArrowUp",
|
|
21392
21474
|
"ArrowDown",
|
|
21393
21475
|
"ArrowLeft",
|
|
21394
21476
|
"ArrowRight"
|
|
21395
|
-
].includes(n.key) &&
|
|
21477
|
+
].includes(n.key) && KF.selectedElementIds.length > 0) {
|
|
21396
21478
|
n.preventDefault();
|
|
21397
21479
|
let _ = n.shiftKey ? 10 : 1, E = [];
|
|
21398
|
-
|
|
21399
|
-
let A =
|
|
21480
|
+
KF.selectedElementIds.forEach((O) => {
|
|
21481
|
+
let A = KF.elements.find((n) => n.id === O);
|
|
21400
21482
|
if (A) {
|
|
21401
21483
|
let j = {};
|
|
21402
21484
|
n.key === "ArrowUp" && (j.y = A.y - _), n.key === "ArrowDown" && (j.y = A.y + _), n.key === "ArrowLeft" && (j.x = A.x - _), n.key === "ArrowRight" && (j.x = A.x + _), E.push({
|
|
@@ -21404,29 +21486,29 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21404
21486
|
changes: j
|
|
21405
21487
|
});
|
|
21406
21488
|
}
|
|
21407
|
-
}), E.length > 0 &&
|
|
21489
|
+
}), E.length > 0 && $F(E);
|
|
21408
21490
|
}
|
|
21409
21491
|
}
|
|
21410
21492
|
};
|
|
21411
21493
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
21412
21494
|
}, [
|
|
21413
|
-
WF,
|
|
21414
|
-
GF,
|
|
21415
|
-
KF,
|
|
21416
21495
|
qF,
|
|
21496
|
+
JF,
|
|
21417
21497
|
YF,
|
|
21418
|
-
|
|
21419
|
-
|
|
21420
|
-
|
|
21498
|
+
XF,
|
|
21499
|
+
QF,
|
|
21500
|
+
KF.selectedElementIds,
|
|
21501
|
+
KF.elements,
|
|
21502
|
+
$F
|
|
21421
21503
|
]), React.useEffect(() => {
|
|
21422
21504
|
if (E) try {
|
|
21423
21505
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
21424
|
-
Array.isArray(n) ?
|
|
21506
|
+
Array.isArray(n) ? GF({ elements: n }) : n.elements && GF(n);
|
|
21425
21507
|
} catch (n) {
|
|
21426
21508
|
console.error("Failed to load initial state", n);
|
|
21427
21509
|
}
|
|
21428
|
-
}, [E,
|
|
21429
|
-
let
|
|
21510
|
+
}, [E, GF]);
|
|
21511
|
+
let oI = (n) => {
|
|
21430
21512
|
console.log(`Adding element of type: ${n}`), Z({
|
|
21431
21513
|
type: n,
|
|
21432
21514
|
content: `New ${n}`
|
|
@@ -21466,12 +21548,20 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21466
21548
|
direction: "column",
|
|
21467
21549
|
gap: "3",
|
|
21468
21550
|
children: /* @__PURE__ */ jsxs(p, { children: [
|
|
21469
|
-
/* @__PURE__ */
|
|
21470
|
-
|
|
21471
|
-
|
|
21551
|
+
/* @__PURE__ */ jsxs(p$1, {
|
|
21552
|
+
justify: "between",
|
|
21553
|
+
align: "center",
|
|
21472
21554
|
mb: "2",
|
|
21473
|
-
|
|
21474
|
-
|
|
21555
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
21556
|
+
size: "2",
|
|
21557
|
+
weight: "bold",
|
|
21558
|
+
children: "Editor"
|
|
21559
|
+
}), /* @__PURE__ */ jsxs(e, {
|
|
21560
|
+
color: "gray",
|
|
21561
|
+
variant: "soft",
|
|
21562
|
+
radius: "full",
|
|
21563
|
+
children: ["v", package_default.version]
|
|
21564
|
+
})]
|
|
21475
21565
|
}),
|
|
21476
21566
|
/* @__PURE__ */ jsxs(I$2, { children: [/* @__PURE__ */ jsx(h$1, { children: /* @__PURE__ */ jsx(o, {
|
|
21477
21567
|
variant: "solid",
|
|
@@ -21488,19 +21578,19 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21488
21578
|
style: { width: "240px" },
|
|
21489
21579
|
children: [
|
|
21490
21580
|
/* @__PURE__ */ jsx(v$3, {
|
|
21491
|
-
onSelect: () =>
|
|
21581
|
+
onSelect: () => oI("text"),
|
|
21492
21582
|
children: "Texto"
|
|
21493
21583
|
}),
|
|
21494
21584
|
/* @__PURE__ */ jsx(v$3, {
|
|
21495
|
-
onSelect: () =>
|
|
21585
|
+
onSelect: () => oI("image"),
|
|
21496
21586
|
children: "Imagem"
|
|
21497
21587
|
}),
|
|
21498
21588
|
/* @__PURE__ */ jsx(v$3, {
|
|
21499
|
-
onSelect: () =>
|
|
21589
|
+
onSelect: () => oI("box"),
|
|
21500
21590
|
children: "Caixa (Container)"
|
|
21501
21591
|
}),
|
|
21502
21592
|
/* @__PURE__ */ jsx(v$3, {
|
|
21503
|
-
onSelect: () =>
|
|
21593
|
+
onSelect: () => oI("text-container"),
|
|
21504
21594
|
children: "Container com Texto"
|
|
21505
21595
|
})
|
|
21506
21596
|
]
|
|
@@ -21516,12 +21606,12 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21516
21606
|
onClick: () => {
|
|
21517
21607
|
if (O) {
|
|
21518
21608
|
let n = {
|
|
21519
|
-
elements:
|
|
21520
|
-
isList:
|
|
21521
|
-
mockData:
|
|
21522
|
-
singleMockData:
|
|
21523
|
-
listSettings:
|
|
21524
|
-
canvasHeight:
|
|
21609
|
+
elements: KF.elements,
|
|
21610
|
+
isList: KF.isList,
|
|
21611
|
+
mockData: KF.mockData,
|
|
21612
|
+
singleMockData: KF.singleMockData,
|
|
21613
|
+
listSettings: KF.listSettings,
|
|
21614
|
+
canvasHeight: KF.canvasHeight
|
|
21525
21615
|
};
|
|
21526
21616
|
O(JSON.stringify(n, null, 2));
|
|
21527
21617
|
}
|
|
@@ -21539,7 +21629,7 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21539
21629
|
cursor: "pointer",
|
|
21540
21630
|
justifyContent: "center"
|
|
21541
21631
|
},
|
|
21542
|
-
onClick:
|
|
21632
|
+
onClick: tI,
|
|
21543
21633
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
21544
21634
|
}), /* @__PURE__ */ jsxs(o, {
|
|
21545
21635
|
variant: "soft",
|
|
@@ -21549,16 +21639,16 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
21549
21639
|
cursor: "pointer",
|
|
21550
21640
|
justifyContent: "center"
|
|
21551
21641
|
},
|
|
21552
|
-
onClick:
|
|
21642
|
+
onClick: nI,
|
|
21553
21643
|
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
21554
21644
|
})]
|
|
21555
21645
|
}),
|
|
21556
21646
|
/* @__PURE__ */ jsx("input", {
|
|
21557
21647
|
type: "file",
|
|
21558
|
-
ref:
|
|
21648
|
+
ref: eI,
|
|
21559
21649
|
style: { display: "none" },
|
|
21560
21650
|
accept: ".json",
|
|
21561
|
-
onChange:
|
|
21651
|
+
onChange: rI
|
|
21562
21652
|
}),
|
|
21563
21653
|
/* @__PURE__ */ jsx(p, {
|
|
21564
21654
|
mt: "2",
|
|
@@ -21919,65 +22009,81 @@ var camelToKebab = (n) => n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toL
|
|
|
21919
22009
|
return isNaN(E) ? String(n) : _.numberFormat === "currency" ? (_.currencySymbol || "R$") + " " + E.toFixed(_.decimalPlaces || 2) : _.numberFormat === "percent" ? E.toFixed(_.decimalPlaces || 0) + "%" : E.toFixed(_.decimalPlaces || 0);
|
|
21920
22010
|
}
|
|
21921
22011
|
return String(n);
|
|
22012
|
+
}, getSafeTimingFunction = (n) => {
|
|
22013
|
+
switch (n) {
|
|
22014
|
+
case "linear": return "linear";
|
|
22015
|
+
case "ease-in": return "ease-in";
|
|
22016
|
+
case "ease-out": return "ease-out";
|
|
22017
|
+
case "ease-in-out": return "ease-in-out";
|
|
22018
|
+
case "bounce": return "cubic-bezier(0.175, 0.885, 0.32, 1.275)";
|
|
22019
|
+
default: return "ease-out";
|
|
22020
|
+
}
|
|
21922
22021
|
}, computeLayout = (n, _) => {
|
|
21923
|
-
let E = JSON.parse(JSON.stringify(n))
|
|
21924
|
-
|
|
21925
|
-
n._originalY = n.y, n._originalHeight = n.height;
|
|
21926
|
-
});
|
|
21927
|
-
let O = (n, _) => {
|
|
22022
|
+
let E = JSON.parse(JSON.stringify(n)), O = new Map(E.map((n) => [n.id, { ...n }])), A = [], j = (n, _) => {
|
|
22023
|
+
if (n.id === _.id) return !1;
|
|
21928
22024
|
let E = .1;
|
|
21929
22025
|
return n.x >= _.x - E && n.x + n.width <= _.x + _.width + E && n.y >= _.y - E && n.y + n.height <= _.y + _.height + E;
|
|
21930
22026
|
};
|
|
21931
|
-
E.
|
|
21932
|
-
let
|
|
21933
|
-
|
|
21934
|
-
let
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
let
|
|
21940
|
-
if (
|
|
21941
|
-
_
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
let
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
|
|
21955
|
-
|
|
21956
|
-
let
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
22027
|
+
E.forEach((n) => {
|
|
22028
|
+
let M = n.type === "text", N = n.type === "text-container";
|
|
22029
|
+
if ((M || N) && n.autoGrow) {
|
|
22030
|
+
let M = n.content;
|
|
22031
|
+
M = M.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
22032
|
+
let A = _[O.trim()];
|
|
22033
|
+
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
22034
|
+
});
|
|
22035
|
+
let P = parseInt(String(n.style && n.style.fontSize || 16)), z = String(n.style && n.style.fontFamily || "Arial");
|
|
22036
|
+
if (N && n.containerExpansion === "horizontal") try {
|
|
22037
|
+
let _ = document.createElement("canvas").getContext("2d");
|
|
22038
|
+
if (_) {
|
|
22039
|
+
_.font = `${P}px ${z}`;
|
|
22040
|
+
let E = _.measureText(M), O = parseInt(String(n.style && n.style.padding || 0)) * 2, A = Math.ceil(E.width + O);
|
|
22041
|
+
A > n.width && (n.width = A, n.content = M);
|
|
22042
|
+
}
|
|
22043
|
+
} catch {}
|
|
22044
|
+
else {
|
|
22045
|
+
let _ = 0, N = parseInt(String(n.style && n.style.padding || 0)), B = Math.max(1, n.width - N * 2), H = /<([a-z]+)([^>]*?)>/i.exec(M);
|
|
22046
|
+
if (H) {
|
|
22047
|
+
let n = H[2], E = /height=["']?(\d+)["']?/i.exec(n), O = /height:\s*(\d+)px/i.exec(n);
|
|
22048
|
+
_ = E ? parseInt(E[1]) : O ? parseInt(O[1]) : measureTextHeight(M, B, z, P);
|
|
22049
|
+
} else _ = measureTextHeight(M, B, z, P);
|
|
22050
|
+
let U = _ + N * 2;
|
|
22051
|
+
(!H || H && !_) && (U += 4);
|
|
22052
|
+
let W = parseInt(String(n.style && n.style.minHeight || 0)), G = Math.max(U, W), Z = n.height, GF = G - Z;
|
|
22053
|
+
if (GF > 0) {
|
|
22054
|
+
n.height = G, n.content = M;
|
|
22055
|
+
let _ = [], N = O.get(n.id);
|
|
22056
|
+
N && E.forEach((E) => {
|
|
22057
|
+
if (E.id === n.id) return;
|
|
22058
|
+
let A = O.get(E.id);
|
|
22059
|
+
A && j(N, A) && _.push(E);
|
|
22060
|
+
});
|
|
22061
|
+
let P = new Set([n.id]);
|
|
22062
|
+
_.forEach((n) => {
|
|
22063
|
+
n.height += GF, P.add(n.id);
|
|
22064
|
+
}), A.push({
|
|
22065
|
+
triggerY: n.y + Z,
|
|
22066
|
+
delta: GF,
|
|
22067
|
+
ignoreIds: P
|
|
22068
|
+
});
|
|
22069
|
+
}
|
|
21971
22070
|
}
|
|
21972
22071
|
}
|
|
22072
|
+
}), E.forEach((n) => {
|
|
22073
|
+
let _ = O.get(n.id);
|
|
22074
|
+
if (!_) return;
|
|
22075
|
+
let E = 0;
|
|
22076
|
+
A.forEach((O) => {
|
|
22077
|
+
O.ignoreIds.has(n.id) || _.y >= O.triggerY - .1 && (E += O.delta);
|
|
22078
|
+
}), n.y += E;
|
|
21973
22079
|
});
|
|
21974
|
-
let
|
|
22080
|
+
let M = 0;
|
|
21975
22081
|
return E.forEach((n) => {
|
|
21976
22082
|
let _ = n.y + n.height;
|
|
21977
|
-
_ >
|
|
22083
|
+
_ > M && (M = _);
|
|
21978
22084
|
}), {
|
|
21979
22085
|
layoutElements: E,
|
|
21980
|
-
maxY:
|
|
22086
|
+
maxY: M
|
|
21981
22087
|
};
|
|
21982
22088
|
}, computeItemHeight = (n, _, E) => {
|
|
21983
22089
|
let { maxY: O } = computeLayout(n, _);
|
|
@@ -22153,8 +22259,9 @@ var camelToKebab = (n) => n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toL
|
|
|
22153
22259
|
A?.newestPosition === "top" && O.reverse();
|
|
22154
22260
|
let j = A?.newestPosition === "top" ? "flex-start" : "flex-end", M = A?.entryAnimation || {
|
|
22155
22261
|
type: "slideIn",
|
|
22156
|
-
duration: .3
|
|
22157
|
-
|
|
22262
|
+
duration: .3,
|
|
22263
|
+
delay: 0
|
|
22264
|
+
}, N = M.type === "none" ? "none" : M.type, P = M.duration + "s", z = getSafeTimingFunction(M.timingFunction), B = {
|
|
22158
22265
|
display: "flex",
|
|
22159
22266
|
flexDirection: "column",
|
|
22160
22267
|
justifyContent: j,
|