@1urso/generic-editor 0.1.36 → 0.1.37
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/README.md +26 -0
- package/dist/editor/context.d.ts +3 -0
- package/dist/editor/index.d.ts +1 -1
- package/dist/generic-editor.js +989 -736
- package/dist/generic-editor.umd.cjs +63 -10
- package/package.json +1 -1
package/dist/generic-editor.js
CHANGED
|
@@ -804,15 +804,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
804
804
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
805
805
|
branches: /* @__PURE__ */ new Set()
|
|
806
806
|
}), DismissableLayer = React$1.forwardRef((_, E) => {
|
|
807
|
-
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)),
|
|
807
|
+
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)), Lj = Array.from(B.layers), [Rj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), zj = Lj.indexOf(Rj), Bj = H ? Lj.indexOf(H) : -1, Vj = B.layersWithOutsidePointerEventsDisabled.size > 0, Hj = Bj >= zj, Uj = usePointerDownOutside((n) => {
|
|
808
808
|
let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
|
|
809
|
-
!
|
|
810
|
-
}, W),
|
|
809
|
+
!Hj || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
810
|
+
}, W), Wj = useFocusOutside((n) => {
|
|
811
811
|
let _ = n.target;
|
|
812
812
|
[...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
813
813
|
}, W);
|
|
814
814
|
return useEscapeKeydown((n) => {
|
|
815
|
-
|
|
815
|
+
Bj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
|
|
816
816
|
}, W), React$1.useEffect(() => {
|
|
817
817
|
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(), () => {
|
|
818
818
|
O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -831,12 +831,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
831
831
|
...z,
|
|
832
832
|
ref: Z,
|
|
833
833
|
style: {
|
|
834
|
-
pointerEvents:
|
|
834
|
+
pointerEvents: Vj ? Hj ? "auto" : "none" : void 0,
|
|
835
835
|
..._.style
|
|
836
836
|
},
|
|
837
|
-
onFocusCapture: composeEventHandlers(_.onFocusCapture,
|
|
838
|
-
onBlurCapture: composeEventHandlers(_.onBlurCapture,
|
|
839
|
-
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture,
|
|
837
|
+
onFocusCapture: composeEventHandlers(_.onFocusCapture, Wj.onFocusCapture),
|
|
838
|
+
onBlurCapture: composeEventHandlers(_.onBlurCapture, Wj.onBlurCapture),
|
|
839
|
+
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, Uj.onPointerDownCapture)
|
|
840
840
|
});
|
|
841
841
|
});
|
|
842
842
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -1195,7 +1195,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1195
1195
|
onScrollCapture: nothing,
|
|
1196
1196
|
onWheelCapture: nothing,
|
|
1197
1197
|
onTouchMoveCapture: nothing
|
|
1198
|
-
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation,
|
|
1198
|
+
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, Lj = _.inert, Rj = _.allowPinchZoom, zj = _.as, Bj = zj === void 0 ? "div" : zj, Vj = _.gapMode, Hj = __rest(_, [
|
|
1199
1199
|
"forwardProps",
|
|
1200
1200
|
"children",
|
|
1201
1201
|
"className",
|
|
@@ -1209,21 +1209,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1209
1209
|
"allowPinchZoom",
|
|
1210
1210
|
"as",
|
|
1211
1211
|
"gapMode"
|
|
1212
|
-
]),
|
|
1213
|
-
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(
|
|
1212
|
+
]), Uj = W, Wj = useMergeRefs([O, E]), Gj = __assign$2(__assign$2({}, Hj), j);
|
|
1213
|
+
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(Uj, {
|
|
1214
1214
|
sideCar: effectCar,
|
|
1215
1215
|
removeScrollBar: B,
|
|
1216
1216
|
shards: U,
|
|
1217
1217
|
noRelative: G,
|
|
1218
1218
|
noIsolation: Z,
|
|
1219
|
-
inert:
|
|
1219
|
+
inert: Lj,
|
|
1220
1220
|
setCallbacks: M,
|
|
1221
|
-
allowPinchZoom: !!
|
|
1221
|
+
allowPinchZoom: !!Rj,
|
|
1222
1222
|
lockRef: O,
|
|
1223
|
-
gapMode:
|
|
1224
|
-
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({},
|
|
1223
|
+
gapMode: Vj
|
|
1224
|
+
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, Gj), { ref: Wj })) : React$1.createElement(Bj, __assign$2({}, Gj, {
|
|
1225
1225
|
className: z,
|
|
1226
|
-
ref:
|
|
1226
|
+
ref: Wj
|
|
1227
1227
|
}), P));
|
|
1228
1228
|
});
|
|
1229
1229
|
RemoveScroll.defaultProps = {
|
|
@@ -1413,8 +1413,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1413
1413
|
if (!N) break;
|
|
1414
1414
|
var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
|
|
1415
1415
|
(G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
|
|
1416
|
-
var
|
|
1417
|
-
N =
|
|
1416
|
+
var Lj = N.parentNode;
|
|
1417
|
+
N = Lj && Lj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Lj.host : Lj;
|
|
1418
1418
|
} while (!P && N !== document.body || P && (_.contains(N) || _ === N));
|
|
1419
1419
|
return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
|
|
1420
1420
|
}, getTouchXY = function(n) {
|
|
@@ -1961,7 +1961,7 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1961
1961
|
strategy: A
|
|
1962
1962
|
}), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
|
|
1963
1963
|
for (let E = 0; E < N.length; E++) {
|
|
1964
|
-
let { name: j, fn: Z } = N[E], { x:
|
|
1964
|
+
let { name: j, fn: Z } = N[E], { x: Lj, y: Rj, data: zj, reset: Bj } = await Z({
|
|
1965
1965
|
x: B,
|
|
1966
1966
|
y: H,
|
|
1967
1967
|
initialPlacement: O,
|
|
@@ -1975,17 +1975,17 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1975
1975
|
floating: _
|
|
1976
1976
|
}
|
|
1977
1977
|
});
|
|
1978
|
-
B =
|
|
1978
|
+
B = Lj ?? B, H = Rj ?? H, W = {
|
|
1979
1979
|
...W,
|
|
1980
1980
|
[j]: {
|
|
1981
1981
|
...W[j],
|
|
1982
|
-
...
|
|
1982
|
+
...zj
|
|
1983
1983
|
}
|
|
1984
|
-
},
|
|
1984
|
+
}, Bj && G <= 50 && (G++, typeof Bj == "object" && (Bj.placement && (U = Bj.placement), Bj.rects && (z = Bj.rects === !0 ? await M.getElementRects({
|
|
1985
1985
|
reference: n,
|
|
1986
1986
|
floating: _,
|
|
1987
1987
|
strategy: A
|
|
1988
|
-
}) :
|
|
1988
|
+
}) : Bj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
|
|
1989
1989
|
}
|
|
1990
1990
|
return {
|
|
1991
1991
|
x: B,
|
|
@@ -2002,25 +2002,25 @@ async function detectOverflow$1(n, _) {
|
|
|
2002
2002
|
boundary: P,
|
|
2003
2003
|
rootBoundary: z,
|
|
2004
2004
|
strategy: N
|
|
2005
|
-
})),
|
|
2005
|
+
})), Lj = B === "floating" ? {
|
|
2006
2006
|
x: E,
|
|
2007
2007
|
y: O,
|
|
2008
2008
|
width: j.floating.width,
|
|
2009
2009
|
height: j.floating.height
|
|
2010
|
-
} : j.reference,
|
|
2010
|
+
} : j.reference, Rj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), zj = await (A.isElement == null ? void 0 : A.isElement(Rj)) && await (A.getScale == null ? void 0 : A.getScale(Rj)) || {
|
|
2011
2011
|
x: 1,
|
|
2012
2012
|
y: 1
|
|
2013
|
-
},
|
|
2013
|
+
}, Bj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2014
2014
|
elements: M,
|
|
2015
|
-
rect:
|
|
2016
|
-
offsetParent:
|
|
2015
|
+
rect: Lj,
|
|
2016
|
+
offsetParent: Rj,
|
|
2017
2017
|
strategy: N
|
|
2018
|
-
}) :
|
|
2018
|
+
}) : Lj);
|
|
2019
2019
|
return {
|
|
2020
|
-
top: (Z.top -
|
|
2021
|
-
bottom: (
|
|
2022
|
-
left: (Z.left -
|
|
2023
|
-
right: (
|
|
2020
|
+
top: (Z.top - Bj.top + W.top) / zj.y,
|
|
2021
|
+
bottom: (Bj.bottom - Z.bottom + W.bottom) / zj.y,
|
|
2022
|
+
left: (Z.left - Bj.left + W.left) / zj.x,
|
|
2023
|
+
right: (Bj.right - Z.right + W.right) / zj.x
|
|
2024
2024
|
};
|
|
2025
2025
|
}
|
|
2026
2026
|
var arrow$2 = (n) => ({
|
|
@@ -2032,17 +2032,17 @@ var arrow$2 = (n) => ({
|
|
|
2032
2032
|
let H = getPaddingObject(B), U = {
|
|
2033
2033
|
x: E,
|
|
2034
2034
|
y: O
|
|
2035
|
-
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z),
|
|
2036
|
-
(!
|
|
2037
|
-
let
|
|
2035
|
+
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Lj = W === "y", Rj = Lj ? "top" : "left", zj = Lj ? "bottom" : "right", Bj = Lj ? "clientHeight" : "clientWidth", Vj = j.reference[G] + j.reference[W] - U[W] - j.floating[G], Hj = U[W] - j.reference[W], Uj = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), Wj = Uj ? Uj[Bj] : 0;
|
|
2036
|
+
(!Wj || !await (M.isElement == null ? void 0 : M.isElement(Uj))) && (Wj = N.floating[Bj] || j.floating[G]);
|
|
2037
|
+
let Gj = Vj / 2 - Hj / 2, Kj = Wj / 2 - Z[G] / 2 - 1, qj = min(H[Rj], Kj), Jj = min(H[zj], Kj), Yj = qj, Xj = Wj - Z[G] - Jj, Zj = Wj / 2 - Z[G] / 2 + Gj, Qj = clamp$3(Yj, Zj, Xj), $j = !P.arrow && getAlignment(A) != null && Zj !== Qj && j.reference[G] / 2 - (Zj < Yj ? qj : Jj) - Z[G] / 2 < 0, eM = $j ? Zj < Yj ? Zj - Yj : Zj - Xj : 0;
|
|
2038
2038
|
return {
|
|
2039
|
-
[W]: U[W] +
|
|
2039
|
+
[W]: U[W] + eM,
|
|
2040
2040
|
data: {
|
|
2041
|
-
[W]:
|
|
2042
|
-
centerOffset:
|
|
2043
|
-
|
|
2041
|
+
[W]: Qj,
|
|
2042
|
+
centerOffset: Zj - Qj - eM,
|
|
2043
|
+
...$j && { alignmentOffset: eM }
|
|
2044
2044
|
},
|
|
2045
|
-
reset:
|
|
2045
|
+
reset: $j
|
|
2046
2046
|
};
|
|
2047
2047
|
}
|
|
2048
2048
|
}), flip$2 = function(n) {
|
|
@@ -2053,32 +2053,32 @@ var arrow$2 = (n) => ({
|
|
|
2053
2053
|
var E;
|
|
2054
2054
|
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, _);
|
|
2055
2055
|
if ((E = A.arrow) != null && E.alignmentOffset) return {};
|
|
2056
|
-
let
|
|
2057
|
-
!H &&
|
|
2058
|
-
let
|
|
2059
|
-
if (z &&
|
|
2060
|
-
let n = getAlignmentSides(O, j,
|
|
2061
|
-
|
|
2056
|
+
let Lj = getSide(O), Rj = getSideAxis(M), zj = getSide(M) === M, Bj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), Vj = H || (zj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), Hj = W !== "none";
|
|
2057
|
+
!H && Hj && Vj.push(...getOppositeAxisPlacements(M, G, W, Bj));
|
|
2058
|
+
let Uj = [M, ...Vj], Wj = await detectOverflow$1(_, Z), Gj = [], Kj = A.flip?.overflows || [];
|
|
2059
|
+
if (z && Gj.push(Wj[Lj]), B) {
|
|
2060
|
+
let n = getAlignmentSides(O, j, Bj);
|
|
2061
|
+
Gj.push(Wj[n[0]], Wj[n[1]]);
|
|
2062
2062
|
}
|
|
2063
|
-
if (
|
|
2063
|
+
if (Kj = [...Kj, {
|
|
2064
2064
|
placement: O,
|
|
2065
|
-
overflows:
|
|
2066
|
-
}], !
|
|
2067
|
-
let n = (A.flip?.index || 0) + 1, _ =
|
|
2068
|
-
if (_ && (!(B === "alignment" &&
|
|
2065
|
+
overflows: Gj
|
|
2066
|
+
}], !Gj.every((n) => n <= 0)) {
|
|
2067
|
+
let n = (A.flip?.index || 0) + 1, _ = Uj[n];
|
|
2068
|
+
if (_ && (!(B === "alignment" && Rj !== getSideAxis(_)) || Kj.every((n) => getSideAxis(n.placement) === Rj ? n.overflows[0] > 0 : !0))) return {
|
|
2069
2069
|
data: {
|
|
2070
2070
|
index: n,
|
|
2071
|
-
overflows:
|
|
2071
|
+
overflows: Kj
|
|
2072
2072
|
},
|
|
2073
2073
|
reset: { placement: _ }
|
|
2074
2074
|
};
|
|
2075
|
-
let E =
|
|
2075
|
+
let E = Kj.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
|
|
2076
2076
|
if (!E) switch (U) {
|
|
2077
2077
|
case "bestFit": {
|
|
2078
|
-
let n =
|
|
2079
|
-
if (
|
|
2078
|
+
let n = Kj.filter((n) => {
|
|
2079
|
+
if (Hj) {
|
|
2080
2080
|
let _ = getSideAxis(n.placement);
|
|
2081
|
-
return _ ===
|
|
2081
|
+
return _ === Rj || _ === "y";
|
|
2082
2082
|
}
|
|
2083
2083
|
return !0;
|
|
2084
2084
|
}).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
|
|
@@ -2221,7 +2221,7 @@ var offset$2 = function(n) {
|
|
|
2221
2221
|
let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
|
|
2222
2222
|
x: E,
|
|
2223
2223
|
y: O
|
|
2224
|
-
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _),
|
|
2224
|
+
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), Lj = typeof Z == "number" ? {
|
|
2225
2225
|
mainAxis: Z,
|
|
2226
2226
|
crossAxis: 0
|
|
2227
2227
|
} : {
|
|
@@ -2230,11 +2230,11 @@ var offset$2 = function(n) {
|
|
|
2230
2230
|
...Z
|
|
2231
2231
|
};
|
|
2232
2232
|
if (P) {
|
|
2233
|
-
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] +
|
|
2233
|
+
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + Lj.mainAxis, E = j.reference[U] + j.reference[n] - Lj.mainAxis;
|
|
2234
2234
|
W < _ ? W = _ : W > E && (W = E);
|
|
2235
2235
|
}
|
|
2236
2236
|
if (z) {
|
|
2237
|
-
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 :
|
|
2237
|
+
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : Lj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Lj.crossAxis : 0);
|
|
2238
2238
|
G < E ? G = E : G > O && (G = O);
|
|
2239
2239
|
}
|
|
2240
2240
|
return {
|
|
@@ -2249,20 +2249,20 @@ var offset$2 = function(n) {
|
|
|
2249
2249
|
options: n,
|
|
2250
2250
|
async fn(_) {
|
|
2251
2251
|
var E, O;
|
|
2252
|
-
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,
|
|
2253
|
-
H === "top" || H === "bottom" ? (
|
|
2254
|
-
let
|
|
2255
|
-
if ((E = _.middlewareData.shift) != null && E.enabled.x && (
|
|
2252
|
+
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, Lj, Rj;
|
|
2253
|
+
H === "top" || H === "bottom" ? (Lj = H, Rj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (Rj = H, Lj = U === "end" ? "top" : "bottom");
|
|
2254
|
+
let zj = Z - B.top - B.bottom, Bj = G - B.left - B.right, Vj = min(Z - B[Lj], zj), Hj = min(G - B[Rj], Bj), Uj = !_.middlewareData.shift, Wj = Vj, Gj = Hj;
|
|
2255
|
+
if ((E = _.middlewareData.shift) != null && E.enabled.x && (Gj = Bj), (O = _.middlewareData.shift) != null && O.enabled.y && (Wj = zj), Uj && !U) {
|
|
2256
2256
|
let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
|
|
2257
|
-
W ?
|
|
2257
|
+
W ? Gj = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : Wj = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
|
|
2258
2258
|
}
|
|
2259
2259
|
await P({
|
|
2260
2260
|
..._,
|
|
2261
|
-
availableWidth:
|
|
2262
|
-
availableHeight:
|
|
2261
|
+
availableWidth: Gj,
|
|
2262
|
+
availableHeight: Wj
|
|
2263
2263
|
});
|
|
2264
|
-
let
|
|
2265
|
-
return G !==
|
|
2264
|
+
let Kj = await M.getDimensions(N.floating);
|
|
2265
|
+
return G !== Kj.width || Z !== Kj.height ? { reset: { rects: !0 } } : {};
|
|
2266
2266
|
}
|
|
2267
2267
|
};
|
|
2268
2268
|
};
|
|
@@ -2646,27 +2646,27 @@ function observeMove(n, _) {
|
|
|
2646
2646
|
N === void 0 && (N = !1), P === void 0 && (P = 1), j();
|
|
2647
2647
|
let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
|
|
2648
2648
|
if (N || _(), !U || !W) return;
|
|
2649
|
-
let G = floor(H), Z = floor(A.clientWidth - (B + U)),
|
|
2650
|
-
rootMargin: -G + "px " + -Z + "px " + -
|
|
2649
|
+
let G = floor(H), Z = floor(A.clientWidth - (B + U)), Lj = floor(A.clientHeight - (H + W)), Rj = floor(B), zj = {
|
|
2650
|
+
rootMargin: -G + "px " + -Z + "px " + -Lj + "px " + -Rj + "px",
|
|
2651
2651
|
threshold: max(0, min(1, P)) || 1
|
|
2652
|
-
},
|
|
2653
|
-
function
|
|
2652
|
+
}, Bj = !0;
|
|
2653
|
+
function Vj(_) {
|
|
2654
2654
|
let E = _[0].intersectionRatio;
|
|
2655
2655
|
if (E !== P) {
|
|
2656
|
-
if (!
|
|
2656
|
+
if (!Bj) return M();
|
|
2657
2657
|
E ? M(!1, E) : O = setTimeout(() => {
|
|
2658
2658
|
M(!1, 1e-7);
|
|
2659
2659
|
}, 1e3);
|
|
2660
2660
|
}
|
|
2661
|
-
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(),
|
|
2661
|
+
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Bj = !1;
|
|
2662
2662
|
}
|
|
2663
2663
|
try {
|
|
2664
|
-
E = new IntersectionObserver(
|
|
2665
|
-
...
|
|
2664
|
+
E = new IntersectionObserver(Vj, {
|
|
2665
|
+
...zj,
|
|
2666
2666
|
root: A.ownerDocument
|
|
2667
2667
|
});
|
|
2668
2668
|
} catch {
|
|
2669
|
-
E = new IntersectionObserver(
|
|
2669
|
+
E = new IntersectionObserver(Vj, zj);
|
|
2670
2670
|
}
|
|
2671
2671
|
E.observe(n);
|
|
2672
2672
|
}
|
|
@@ -2687,10 +2687,10 @@ function autoUpdate(n, _, E, O) {
|
|
|
2687
2687
|
})), E();
|
|
2688
2688
|
}), z && !P && W.observe(z), W.observe(_));
|
|
2689
2689
|
let G, Z = P ? getBoundingClientRect(n) : null;
|
|
2690
|
-
P &&
|
|
2691
|
-
function
|
|
2690
|
+
P && Lj();
|
|
2691
|
+
function Lj() {
|
|
2692
2692
|
let _ = getBoundingClientRect(n);
|
|
2693
|
-
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(
|
|
2693
|
+
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Lj);
|
|
2694
2694
|
}
|
|
2695
2695
|
return E(), () => {
|
|
2696
2696
|
var n;
|
|
@@ -2757,23 +2757,23 @@ function useFloating(_) {
|
|
|
2757
2757
|
isPositioned: !1
|
|
2758
2758
|
}), [W, G] = React$1.useState(A);
|
|
2759
2759
|
deepEqual(W, A) || G(A);
|
|
2760
|
-
let [Z,
|
|
2761
|
-
n !==
|
|
2762
|
-
}, []),
|
|
2763
|
-
n !==
|
|
2764
|
-
}, []),
|
|
2765
|
-
if (!
|
|
2760
|
+
let [Z, Lj] = React$1.useState(null), [Rj, zj] = React$1.useState(null), Bj = React$1.useCallback((n) => {
|
|
2761
|
+
n !== Gj.current && (Gj.current = n, Lj(n));
|
|
2762
|
+
}, []), Vj = React$1.useCallback((n) => {
|
|
2763
|
+
n !== Kj.current && (Kj.current = n, zj(n));
|
|
2764
|
+
}, []), Uj = M || Z, Wj = N || Rj, Gj = React$1.useRef(null), Kj = React$1.useRef(null), qj = React$1.useRef(H), Jj = z != null, Yj = useLatestRef(z), Xj = useLatestRef(j), Zj = useLatestRef(B), Qj = React$1.useCallback(() => {
|
|
2765
|
+
if (!Gj.current || !Kj.current) return;
|
|
2766
2766
|
let n = {
|
|
2767
2767
|
placement: E,
|
|
2768
2768
|
strategy: O,
|
|
2769
2769
|
middleware: W
|
|
2770
2770
|
};
|
|
2771
|
-
|
|
2771
|
+
Xj.current && (n.platform = Xj.current), computePosition(Gj.current, Kj.current, n).then((n) => {
|
|
2772
2772
|
let _ = {
|
|
2773
2773
|
...n,
|
|
2774
|
-
isPositioned:
|
|
2774
|
+
isPositioned: Zj.current !== !1
|
|
2775
2775
|
};
|
|
2776
|
-
|
|
2776
|
+
$j.current && !deepEqual(qj.current, _) && (qj.current = _, ReactDOM$1.flushSync(() => {
|
|
2777
2777
|
U(_);
|
|
2778
2778
|
}));
|
|
2779
2779
|
});
|
|
@@ -2781,50 +2781,50 @@ function useFloating(_) {
|
|
|
2781
2781
|
W,
|
|
2782
2782
|
E,
|
|
2783
2783
|
O,
|
|
2784
|
-
|
|
2785
|
-
|
|
2784
|
+
Xj,
|
|
2785
|
+
Zj
|
|
2786
2786
|
]);
|
|
2787
2787
|
index(() => {
|
|
2788
|
-
B === !1 &&
|
|
2788
|
+
B === !1 && qj.current.isPositioned && (qj.current.isPositioned = !1, U((n) => ({
|
|
2789
2789
|
...n,
|
|
2790
2790
|
isPositioned: !1
|
|
2791
2791
|
})));
|
|
2792
2792
|
}, [B]);
|
|
2793
|
-
let
|
|
2794
|
-
index(() => (
|
|
2795
|
-
|
|
2793
|
+
let $j = React$1.useRef(!1);
|
|
2794
|
+
index(() => ($j.current = !0, () => {
|
|
2795
|
+
$j.current = !1;
|
|
2796
2796
|
}), []), index(() => {
|
|
2797
|
-
if (
|
|
2798
|
-
if (
|
|
2799
|
-
|
|
2797
|
+
if (Uj && (Gj.current = Uj), Wj && (Kj.current = Wj), Uj && Wj) {
|
|
2798
|
+
if (Yj.current) return Yj.current(Uj, Wj, Qj);
|
|
2799
|
+
Qj();
|
|
2800
2800
|
}
|
|
2801
2801
|
}, [
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
tM,
|
|
2802
|
+
Uj,
|
|
2803
|
+
Wj,
|
|
2805
2804
|
Qj,
|
|
2806
|
-
|
|
2805
|
+
Yj,
|
|
2806
|
+
Jj
|
|
2807
2807
|
]);
|
|
2808
|
-
let
|
|
2809
|
-
reference:
|
|
2810
|
-
floating:
|
|
2811
|
-
setReference:
|
|
2812
|
-
setFloating:
|
|
2813
|
-
}), [
|
|
2814
|
-
reference:
|
|
2815
|
-
floating:
|
|
2816
|
-
}), [
|
|
2808
|
+
let eM = React$1.useMemo(() => ({
|
|
2809
|
+
reference: Gj,
|
|
2810
|
+
floating: Kj,
|
|
2811
|
+
setReference: Bj,
|
|
2812
|
+
setFloating: Vj
|
|
2813
|
+
}), [Bj, Vj]), tM = React$1.useMemo(() => ({
|
|
2814
|
+
reference: Uj,
|
|
2815
|
+
floating: Wj
|
|
2816
|
+
}), [Uj, Wj]), nM = React$1.useMemo(() => {
|
|
2817
2817
|
let n = {
|
|
2818
2818
|
position: O,
|
|
2819
2819
|
left: 0,
|
|
2820
2820
|
top: 0
|
|
2821
2821
|
};
|
|
2822
|
-
if (!
|
|
2823
|
-
let _ = roundByDPR(
|
|
2822
|
+
if (!tM.floating) return n;
|
|
2823
|
+
let _ = roundByDPR(tM.floating, H.x), E = roundByDPR(tM.floating, H.y);
|
|
2824
2824
|
return P ? {
|
|
2825
2825
|
...n,
|
|
2826
2826
|
transform: "translate(" + _ + "px, " + E + "px)",
|
|
2827
|
-
...getDPR(
|
|
2827
|
+
...getDPR(tM.floating) >= 1.5 && { willChange: "transform" }
|
|
2828
2828
|
} : {
|
|
2829
2829
|
position: O,
|
|
2830
2830
|
left: _,
|
|
@@ -2833,22 +2833,22 @@ function useFloating(_) {
|
|
|
2833
2833
|
}, [
|
|
2834
2834
|
O,
|
|
2835
2835
|
P,
|
|
2836
|
-
|
|
2836
|
+
tM.floating,
|
|
2837
2837
|
H.x,
|
|
2838
2838
|
H.y
|
|
2839
2839
|
]);
|
|
2840
2840
|
return React$1.useMemo(() => ({
|
|
2841
2841
|
...H,
|
|
2842
|
-
update:
|
|
2843
|
-
refs:
|
|
2844
|
-
elements:
|
|
2845
|
-
floatingStyles:
|
|
2842
|
+
update: Qj,
|
|
2843
|
+
refs: eM,
|
|
2844
|
+
elements: tM,
|
|
2845
|
+
floatingStyles: nM
|
|
2846
2846
|
}), [
|
|
2847
2847
|
H,
|
|
2848
|
+
Qj,
|
|
2849
|
+
eM,
|
|
2848
2850
|
tM,
|
|
2849
|
-
|
|
2850
|
-
iM,
|
|
2851
|
-
aM
|
|
2851
|
+
nM
|
|
2852
2852
|
]);
|
|
2853
2853
|
}
|
|
2854
2854
|
var arrow$1$1 = (n) => {
|
|
@@ -2925,70 +2925,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
|
|
|
2925
2925
|
});
|
|
2926
2926
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
2927
2927
|
var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$6), PopperContent = React$1.forwardRef((_, E) => {
|
|
2928
|
-
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, ...
|
|
2928
|
+
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, ...Lj } = _, Rj = usePopperContext(CONTENT_NAME$6, O), [zj, Bj] = React$1.useState(null), Vj = useComposedRefs$1(E, (n) => Bj(n)), [Hj, Uj] = React$1.useState(null), Wj = useSize(Hj), Gj = Wj?.width ?? 0, qj = Wj?.height ?? 0, Jj = A + (M === "center" ? "" : "-" + M), Yj = typeof H == "number" ? H : {
|
|
2929
2929
|
top: 0,
|
|
2930
2930
|
right: 0,
|
|
2931
2931
|
bottom: 0,
|
|
2932
2932
|
left: 0,
|
|
2933
2933
|
...H
|
|
2934
|
-
},
|
|
2935
|
-
padding:
|
|
2936
|
-
boundary:
|
|
2937
|
-
altBoundary:
|
|
2938
|
-
}, { refs:
|
|
2934
|
+
}, Xj = Array.isArray(B) ? B : [B], Zj = Xj.length > 0, Qj = {
|
|
2935
|
+
padding: Yj,
|
|
2936
|
+
boundary: Xj.filter(isNotNull$2),
|
|
2937
|
+
altBoundary: Zj
|
|
2938
|
+
}, { refs: $j, floatingStyles: eM, placement: tM, isPositioned: nM, middlewareData: rM } = useFloating({
|
|
2939
2939
|
strategy: "fixed",
|
|
2940
|
-
placement:
|
|
2940
|
+
placement: Jj,
|
|
2941
2941
|
whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
|
|
2942
|
-
elements: { reference:
|
|
2942
|
+
elements: { reference: Rj.anchor },
|
|
2943
2943
|
middleware: [
|
|
2944
2944
|
offset({
|
|
2945
|
-
mainAxis: j +
|
|
2945
|
+
mainAxis: j + qj,
|
|
2946
2946
|
alignmentAxis: N
|
|
2947
2947
|
}),
|
|
2948
2948
|
z && shift({
|
|
2949
2949
|
mainAxis: !0,
|
|
2950
2950
|
crossAxis: !1,
|
|
2951
2951
|
limiter: U === "partial" ? limitShift() : void 0,
|
|
2952
|
-
...
|
|
2952
|
+
...Qj
|
|
2953
2953
|
}),
|
|
2954
|
-
z && flip({ ...
|
|
2954
|
+
z && flip({ ...Qj }),
|
|
2955
2955
|
size({
|
|
2956
|
-
...
|
|
2956
|
+
...Qj,
|
|
2957
2957
|
apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
|
|
2958
2958
|
let { width: A, height: j } = _.reference, M = n.floating.style;
|
|
2959
2959
|
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`);
|
|
2960
2960
|
}
|
|
2961
2961
|
}),
|
|
2962
|
-
|
|
2963
|
-
element:
|
|
2962
|
+
Hj && arrow({
|
|
2963
|
+
element: Hj,
|
|
2964
2964
|
padding: P
|
|
2965
2965
|
}),
|
|
2966
2966
|
transformOrigin({
|
|
2967
|
-
arrowWidth:
|
|
2968
|
-
arrowHeight:
|
|
2967
|
+
arrowWidth: Gj,
|
|
2968
|
+
arrowHeight: qj
|
|
2969
2969
|
}),
|
|
2970
2970
|
W && hide({
|
|
2971
2971
|
strategy: "referenceHidden",
|
|
2972
|
-
...
|
|
2972
|
+
...Qj
|
|
2973
2973
|
})
|
|
2974
2974
|
]
|
|
2975
|
-
}), [
|
|
2975
|
+
}), [iM, aM] = getSideAndAlignFromPlacement(tM), oM = useCallbackRef(Z);
|
|
2976
2976
|
useLayoutEffect2(() => {
|
|
2977
|
-
|
|
2978
|
-
}, [
|
|
2979
|
-
let
|
|
2977
|
+
nM && oM?.();
|
|
2978
|
+
}, [nM, oM]);
|
|
2979
|
+
let sM = rM.arrow?.x, cM = rM.arrow?.y, lM = rM.arrow?.centerOffset !== 0, [uM, dM] = React$1.useState();
|
|
2980
2980
|
return useLayoutEffect2(() => {
|
|
2981
|
-
|
|
2982
|
-
}, [
|
|
2983
|
-
ref:
|
|
2981
|
+
zj && dM(window.getComputedStyle(zj).zIndex);
|
|
2982
|
+
}, [zj]), /* @__PURE__ */ jsx("div", {
|
|
2983
|
+
ref: $j.setFloating,
|
|
2984
2984
|
"data-radix-popper-content-wrapper": "",
|
|
2985
2985
|
style: {
|
|
2986
|
-
...
|
|
2987
|
-
transform:
|
|
2986
|
+
...eM,
|
|
2987
|
+
transform: nM ? eM.transform : "translate(0, -200%)",
|
|
2988
2988
|
minWidth: "max-content",
|
|
2989
|
-
zIndex:
|
|
2990
|
-
"--radix-popper-transform-origin": [
|
|
2991
|
-
...
|
|
2989
|
+
zIndex: uM,
|
|
2990
|
+
"--radix-popper-transform-origin": [rM.transformOrigin?.x, rM.transformOrigin?.y].join(" "),
|
|
2991
|
+
...rM.hide?.referenceHidden && {
|
|
2992
2992
|
visibility: "hidden",
|
|
2993
2993
|
pointerEvents: "none"
|
|
2994
2994
|
}
|
|
@@ -2996,19 +2996,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
2996
2996
|
dir: _.dir,
|
|
2997
2997
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
2998
2998
|
scope: O,
|
|
2999
|
-
placedSide:
|
|
3000
|
-
onArrowChange:
|
|
3001
|
-
arrowX:
|
|
3002
|
-
arrowY:
|
|
3003
|
-
shouldHideArrow:
|
|
2999
|
+
placedSide: iM,
|
|
3000
|
+
onArrowChange: Uj,
|
|
3001
|
+
arrowX: sM,
|
|
3002
|
+
arrowY: cM,
|
|
3003
|
+
shouldHideArrow: lM,
|
|
3004
3004
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3005
|
-
"data-side":
|
|
3006
|
-
"data-align":
|
|
3007
|
-
...
|
|
3008
|
-
ref:
|
|
3005
|
+
"data-side": iM,
|
|
3006
|
+
"data-align": aM,
|
|
3007
|
+
...Lj,
|
|
3008
|
+
ref: Vj,
|
|
3009
3009
|
style: {
|
|
3010
|
-
...
|
|
3011
|
-
animation:
|
|
3010
|
+
...Lj.style,
|
|
3011
|
+
animation: nM ? void 0 : "none"
|
|
3012
3012
|
}
|
|
3013
3013
|
})
|
|
3014
3014
|
})
|
|
@@ -3091,27 +3091,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
|
|
|
3091
3091
|
}));
|
|
3092
3092
|
RovingFocusGroup.displayName = GROUP_NAME$3;
|
|
3093
3093
|
var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
3094
|
-
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), [
|
|
3094
|
+
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), [Lj, Rj] = useControllableState({
|
|
3095
3095
|
prop: N,
|
|
3096
3096
|
defaultProp: P ?? null,
|
|
3097
3097
|
onChange: z,
|
|
3098
3098
|
caller: GROUP_NAME$3
|
|
3099
|
-
}), [
|
|
3099
|
+
}), [zj, Bj] = React$1.useState(!1), Vj = useCallbackRef(B), Hj = useCollection$1(O), Uj = React$1.useRef(!1), [Wj, Gj] = React$1.useState(0);
|
|
3100
3100
|
return React$1.useEffect(() => {
|
|
3101
3101
|
let n = W.current;
|
|
3102
|
-
if (n) return n.addEventListener(ENTRY_FOCUS,
|
|
3103
|
-
}, [
|
|
3102
|
+
if (n) return n.addEventListener(ENTRY_FOCUS, Vj), () => n.removeEventListener(ENTRY_FOCUS, Vj);
|
|
3103
|
+
}, [Vj]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
3104
3104
|
scope: O,
|
|
3105
3105
|
orientation: A,
|
|
3106
3106
|
dir: Z,
|
|
3107
3107
|
loop: j,
|
|
3108
|
-
currentTabStopId:
|
|
3109
|
-
onItemFocus: React$1.useCallback((n) =>
|
|
3110
|
-
onItemShiftTab: React$1.useCallback(() =>
|
|
3111
|
-
onFocusableItemAdd: React$1.useCallback(() =>
|
|
3112
|
-
onFocusableItemRemove: React$1.useCallback(() =>
|
|
3108
|
+
currentTabStopId: Lj,
|
|
3109
|
+
onItemFocus: React$1.useCallback((n) => Rj(n), [Rj]),
|
|
3110
|
+
onItemShiftTab: React$1.useCallback(() => Bj(!0), []),
|
|
3111
|
+
onFocusableItemAdd: React$1.useCallback(() => Gj((n) => n + 1), []),
|
|
3112
|
+
onFocusableItemRemove: React$1.useCallback(() => Gj((n) => n - 1), []),
|
|
3113
3113
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3114
|
-
tabIndex:
|
|
3114
|
+
tabIndex: zj || Wj === 0 ? -1 : 0,
|
|
3115
3115
|
"data-orientation": A,
|
|
3116
3116
|
...U,
|
|
3117
3117
|
ref: G,
|
|
@@ -3120,28 +3120,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3120
3120
|
..._.style
|
|
3121
3121
|
},
|
|
3122
3122
|
onMouseDown: composeEventHandlers(_.onMouseDown, () => {
|
|
3123
|
-
|
|
3123
|
+
Uj.current = !0;
|
|
3124
3124
|
}),
|
|
3125
3125
|
onFocus: composeEventHandlers(_.onFocus, (n) => {
|
|
3126
|
-
let _ = !
|
|
3127
|
-
if (n.target === n.currentTarget && _ && !
|
|
3126
|
+
let _ = !Uj.current;
|
|
3127
|
+
if (n.target === n.currentTarget && _ && !zj) {
|
|
3128
3128
|
let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
3129
3129
|
if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
|
|
3130
|
-
let n =
|
|
3130
|
+
let n = Hj().filter((n) => n.focusable);
|
|
3131
3131
|
focusFirst$1([
|
|
3132
3132
|
n.find((n) => n.active),
|
|
3133
|
-
n.find((n) => n.id ===
|
|
3133
|
+
n.find((n) => n.id === Lj),
|
|
3134
3134
|
...n
|
|
3135
3135
|
].filter(Boolean).map((n) => n.ref.current), H);
|
|
3136
3136
|
}
|
|
3137
3137
|
}
|
|
3138
|
-
|
|
3138
|
+
Uj.current = !1;
|
|
3139
3139
|
}),
|
|
3140
|
-
onBlur: composeEventHandlers(_.onBlur, () =>
|
|
3140
|
+
onBlur: composeEventHandlers(_.onBlur, () => Bj(!1))
|
|
3141
3141
|
})
|
|
3142
3142
|
});
|
|
3143
3143
|
}), ITEM_NAME$3 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((_, E) => {
|
|
3144
|
-
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:
|
|
3144
|
+
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: Lj } = H;
|
|
3145
3145
|
return React$1.useEffect(() => {
|
|
3146
3146
|
if (A) return G(), () => Z();
|
|
3147
3147
|
}, [
|
|
@@ -3184,7 +3184,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3184
3184
|
}),
|
|
3185
3185
|
children: typeof N == "function" ? N({
|
|
3186
3186
|
isCurrentTabStop: U,
|
|
3187
|
-
hasTabStop:
|
|
3187
|
+
hasTabStop: Lj != null
|
|
3188
3188
|
}) : N
|
|
3189
3189
|
})
|
|
3190
3190
|
});
|
|
@@ -3335,40 +3335,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3335
3335
|
onDismiss: () => E.onOpenChange(!1)
|
|
3336
3336
|
});
|
|
3337
3337
|
}), Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((_, E) => {
|
|
3338
|
-
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, ...
|
|
3338
|
+
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, ...Lj } = _, Rj = useMenuContext(CONTENT_NAME$5, O), zj = useMenuRootContext(CONTENT_NAME$5, O), Bj = usePopperScope$2(O), Vj = useRovingFocusGroupScope$1(O), Hj = useCollection(O), [Uj, Wj] = React$1.useState(null), Gj = React$1.useRef(null), qj = useComposedRefs$1(E, Gj, Rj.onContentChange), Jj = React$1.useRef(0), Yj = React$1.useRef(""), Xj = React$1.useRef(0), Zj = React$1.useRef(null), Qj = React$1.useRef("right"), $j = React$1.useRef(0), eM = Z ? Combination_default : React$1.Fragment, tM = Z ? {
|
|
3339
3339
|
as: Slot$1,
|
|
3340
3340
|
allowPinchZoom: !0
|
|
3341
|
-
} : void 0,
|
|
3342
|
-
let _ =
|
|
3341
|
+
} : void 0, nM = (n) => {
|
|
3342
|
+
let _ = Yj.current + n, E = Hj().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;
|
|
3343
3343
|
(function n(_) {
|
|
3344
|
-
|
|
3344
|
+
Yj.current = _, window.clearTimeout(Jj.current), _ !== "" && (Jj.current = window.setTimeout(() => n(""), 1e3));
|
|
3345
3345
|
})(_), M && setTimeout(() => M.focus());
|
|
3346
3346
|
};
|
|
3347
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
3348
|
-
let
|
|
3347
|
+
React$1.useEffect(() => () => window.clearTimeout(Jj.current), []), useFocusGuards();
|
|
3348
|
+
let rM = React$1.useCallback((n) => Qj.current === Zj.current?.side && isPointerInGraceArea(n, Zj.current?.area), []);
|
|
3349
3349
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
3350
3350
|
scope: O,
|
|
3351
|
-
searchRef:
|
|
3351
|
+
searchRef: Yj,
|
|
3352
3352
|
onItemEnter: React$1.useCallback((n) => {
|
|
3353
|
-
|
|
3354
|
-
}, [
|
|
3353
|
+
rM(n) && n.preventDefault();
|
|
3354
|
+
}, [rM]),
|
|
3355
3355
|
onItemLeave: React$1.useCallback((n) => {
|
|
3356
|
-
|
|
3357
|
-
}, [
|
|
3356
|
+
rM(n) || (Gj.current?.focus(), Wj(null));
|
|
3357
|
+
}, [rM]),
|
|
3358
3358
|
onTriggerLeave: React$1.useCallback((n) => {
|
|
3359
|
-
|
|
3360
|
-
}, [
|
|
3361
|
-
pointerGraceTimerRef:
|
|
3359
|
+
rM(n) && n.preventDefault();
|
|
3360
|
+
}, [rM]),
|
|
3361
|
+
pointerGraceTimerRef: Xj,
|
|
3362
3362
|
onPointerGraceIntentChange: React$1.useCallback((n) => {
|
|
3363
|
-
|
|
3363
|
+
Zj.current = n;
|
|
3364
3364
|
}, []),
|
|
3365
|
-
children: /* @__PURE__ */ jsx(
|
|
3366
|
-
...
|
|
3365
|
+
children: /* @__PURE__ */ jsx(eM, {
|
|
3366
|
+
...tM,
|
|
3367
3367
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
3368
3368
|
asChild: !0,
|
|
3369
3369
|
trapped: j,
|
|
3370
3370
|
onMountAutoFocus: composeEventHandlers(M, (n) => {
|
|
3371
|
-
n.preventDefault(),
|
|
3371
|
+
n.preventDefault(), Gj.current?.focus({ preventScroll: !0 });
|
|
3372
3372
|
}),
|
|
3373
3373
|
onUnmountAutoFocus: N,
|
|
3374
3374
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3381,44 +3381,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3381
3381
|
onDismiss: G,
|
|
3382
3382
|
children: /* @__PURE__ */ jsx(Root$2, {
|
|
3383
3383
|
asChild: !0,
|
|
3384
|
-
...
|
|
3385
|
-
dir:
|
|
3384
|
+
...Vj,
|
|
3385
|
+
dir: zj.dir,
|
|
3386
3386
|
orientation: "vertical",
|
|
3387
3387
|
loop: A,
|
|
3388
|
-
currentTabStopId:
|
|
3389
|
-
onCurrentTabStopIdChange:
|
|
3388
|
+
currentTabStopId: Uj,
|
|
3389
|
+
onCurrentTabStopIdChange: Wj,
|
|
3390
3390
|
onEntryFocus: composeEventHandlers(z, (n) => {
|
|
3391
|
-
|
|
3391
|
+
zj.isUsingKeyboardRef.current || n.preventDefault();
|
|
3392
3392
|
}),
|
|
3393
3393
|
preventScrollOnEntryFocus: !0,
|
|
3394
3394
|
children: /* @__PURE__ */ jsx(Content$1, {
|
|
3395
3395
|
role: "menu",
|
|
3396
3396
|
"aria-orientation": "vertical",
|
|
3397
|
-
"data-state": getOpenState(
|
|
3397
|
+
"data-state": getOpenState(Rj.open),
|
|
3398
3398
|
"data-radix-menu-content": "",
|
|
3399
|
-
dir:
|
|
3400
|
-
...Uj,
|
|
3399
|
+
dir: zj.dir,
|
|
3401
3400
|
...Bj,
|
|
3402
|
-
|
|
3401
|
+
...Lj,
|
|
3402
|
+
ref: qj,
|
|
3403
3403
|
style: {
|
|
3404
3404
|
outline: "none",
|
|
3405
|
-
...
|
|
3405
|
+
...Lj.style
|
|
3406
3406
|
},
|
|
3407
|
-
onKeyDown: composeEventHandlers(
|
|
3407
|
+
onKeyDown: composeEventHandlers(Lj.onKeyDown, (n) => {
|
|
3408
3408
|
let _ = n.target.closest("[data-radix-menu-content]") === n.currentTarget, E = n.ctrlKey || n.altKey || n.metaKey, O = n.key.length === 1;
|
|
3409
|
-
_ && (n.key === "Tab" && n.preventDefault(), !E && O &&
|
|
3410
|
-
let A =
|
|
3409
|
+
_ && (n.key === "Tab" && n.preventDefault(), !E && O && nM(n.key));
|
|
3410
|
+
let A = Gj.current;
|
|
3411
3411
|
if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
|
|
3412
3412
|
n.preventDefault();
|
|
3413
|
-
let j =
|
|
3413
|
+
let j = Hj().filter((n) => !n.disabled).map((n) => n.ref.current);
|
|
3414
3414
|
LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
|
|
3415
3415
|
}),
|
|
3416
3416
|
onBlur: composeEventHandlers(_.onBlur, (n) => {
|
|
3417
|
-
n.currentTarget.contains(n.target) || (window.clearTimeout(
|
|
3417
|
+
n.currentTarget.contains(n.target) || (window.clearTimeout(Jj.current), Yj.current = "");
|
|
3418
3418
|
}),
|
|
3419
3419
|
onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
|
|
3420
|
-
let _ = n.target, E =
|
|
3421
|
-
n.currentTarget.contains(_) && E && (
|
|
3420
|
+
let _ = n.target, E = $j.current !== n.clientX;
|
|
3421
|
+
n.currentTarget.contains(_) && E && (Qj.current = n.clientX > $j.current ? "right" : "left", $j.current = n.clientX);
|
|
3422
3422
|
}))
|
|
3423
3423
|
})
|
|
3424
3424
|
})
|
|
@@ -4366,11 +4366,11 @@ function useStateMachine(_, E) {
|
|
|
4366
4366
|
return React$1.useReducer((n, _) => E[n][_] ?? n, _);
|
|
4367
4367
|
}
|
|
4368
4368
|
var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((_, E) => {
|
|
4369
|
-
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), [
|
|
4369
|
+
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), [Lj, Rj] = React$1.useState(null), [zj, Bj] = React$1.useState(0), [Vj, Hj] = React$1.useState(0), [Uj, Wj] = React$1.useState(!1), [Gj, qj] = React$1.useState(!1), Jj = useComposedRefs$1(E, (n) => z(n)), Yj = useDirection(j);
|
|
4370
4370
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
4371
4371
|
scope: O,
|
|
4372
4372
|
type: A,
|
|
4373
|
-
dir:
|
|
4373
|
+
dir: Yj,
|
|
4374
4374
|
scrollHideDelay: M,
|
|
4375
4375
|
scrollArea: P,
|
|
4376
4376
|
viewport: B,
|
|
@@ -4379,22 +4379,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
|
|
|
4379
4379
|
onContentChange: W,
|
|
4380
4380
|
scrollbarX: G,
|
|
4381
4381
|
onScrollbarXChange: Z,
|
|
4382
|
-
scrollbarXEnabled:
|
|
4383
|
-
onScrollbarXEnabledChange:
|
|
4384
|
-
scrollbarY:
|
|
4385
|
-
onScrollbarYChange:
|
|
4386
|
-
scrollbarYEnabled:
|
|
4387
|
-
onScrollbarYEnabledChange:
|
|
4388
|
-
onCornerWidthChange:
|
|
4389
|
-
onCornerHeightChange:
|
|
4382
|
+
scrollbarXEnabled: Uj,
|
|
4383
|
+
onScrollbarXEnabledChange: Wj,
|
|
4384
|
+
scrollbarY: Lj,
|
|
4385
|
+
onScrollbarYChange: Rj,
|
|
4386
|
+
scrollbarYEnabled: Gj,
|
|
4387
|
+
onScrollbarYEnabledChange: qj,
|
|
4388
|
+
onCornerWidthChange: Bj,
|
|
4389
|
+
onCornerHeightChange: Hj,
|
|
4390
4390
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4391
|
-
dir:
|
|
4391
|
+
dir: Yj,
|
|
4392
4392
|
...N,
|
|
4393
|
-
ref:
|
|
4393
|
+
ref: Jj,
|
|
4394
4394
|
style: {
|
|
4395
4395
|
position: "relative",
|
|
4396
|
-
"--radix-scroll-area-corner-width":
|
|
4397
|
-
"--radix-scroll-area-corner-height":
|
|
4396
|
+
"--radix-scroll-area-corner-width": zj + "px",
|
|
4397
|
+
"--radix-scroll-area-corner-height": Vj + "px",
|
|
4398
4398
|
..._.style
|
|
4399
4399
|
}
|
|
4400
4400
|
})
|
|
@@ -4665,46 +4665,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
|
|
|
4665
4665
|
}
|
|
4666
4666
|
});
|
|
4667
4667
|
}), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((_, E) => {
|
|
4668
|
-
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,
|
|
4669
|
-
function
|
|
4670
|
-
|
|
4671
|
-
x: n.clientX -
|
|
4672
|
-
y: n.clientY -
|
|
4668
|
+
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, Lj] = React$1.useState(null), Rj = useComposedRefs$1(E, (n) => Lj(n)), zj = React$1.useRef(null), Bj = React$1.useRef(""), Vj = G.viewport, Hj = A.content - A.viewport, Uj = useCallbackRef(H), Wj = useCallbackRef(z), Gj = useDebounceCallback(U, 10);
|
|
4669
|
+
function qj(n) {
|
|
4670
|
+
zj.current && B({
|
|
4671
|
+
x: n.clientX - zj.current.left,
|
|
4672
|
+
y: n.clientY - zj.current.top
|
|
4673
4673
|
});
|
|
4674
4674
|
}
|
|
4675
4675
|
return React$1.useEffect(() => {
|
|
4676
4676
|
let n = (n) => {
|
|
4677
4677
|
let _ = n.target;
|
|
4678
|
-
Z?.contains(_) &&
|
|
4678
|
+
Z?.contains(_) && Uj(n, Hj);
|
|
4679
4679
|
};
|
|
4680
4680
|
return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
|
|
4681
4681
|
}, [
|
|
4682
|
-
|
|
4682
|
+
Vj,
|
|
4683
4683
|
Z,
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
]), React$1.useEffect(
|
|
4684
|
+
Hj,
|
|
4685
|
+
Uj
|
|
4686
|
+
]), React$1.useEffect(Wj, [A, Wj]), useResizeObserver(Z, Gj), useResizeObserver(G.content, Gj), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4687
4687
|
scope: O,
|
|
4688
4688
|
scrollbar: Z,
|
|
4689
4689
|
hasThumb: j,
|
|
4690
4690
|
onThumbChange: useCallbackRef(M),
|
|
4691
4691
|
onThumbPointerUp: useCallbackRef(N),
|
|
4692
|
-
onThumbPositionChange:
|
|
4692
|
+
onThumbPositionChange: Wj,
|
|
4693
4693
|
onThumbPointerDown: useCallbackRef(P),
|
|
4694
4694
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4695
4695
|
...W,
|
|
4696
|
-
ref:
|
|
4696
|
+
ref: Rj,
|
|
4697
4697
|
style: {
|
|
4698
4698
|
position: "absolute",
|
|
4699
4699
|
...W.style
|
|
4700
4700
|
},
|
|
4701
4701
|
onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
|
|
4702
|
-
n.button === 0 && (n.target.setPointerCapture(n.pointerId),
|
|
4702
|
+
n.button === 0 && (n.target.setPointerCapture(n.pointerId), zj.current = Z.getBoundingClientRect(), Bj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), qj(n));
|
|
4703
4703
|
}),
|
|
4704
|
-
onPointerMove: composeEventHandlers(_.onPointerMove,
|
|
4704
|
+
onPointerMove: composeEventHandlers(_.onPointerMove, qj),
|
|
4705
4705
|
onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
|
|
4706
4706
|
let _ = n.target;
|
|
4707
|
-
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect =
|
|
4707
|
+
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Bj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), zj.current = null;
|
|
4708
4708
|
})
|
|
4709
4709
|
})
|
|
4710
4710
|
});
|
|
@@ -4846,7 +4846,7 @@ function useResizeObserver(n, _) {
|
|
|
4846
4846
|
}, [n, E]);
|
|
4847
4847
|
}
|
|
4848
4848
|
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) => {
|
|
4849
|
-
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)),
|
|
4849
|
+
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)), Lj = React$1.useRef(!1), Rj = W ? H || !!W.closest("form") : !0, [zj, Bj] = useControllableState({
|
|
4850
4850
|
prop: j,
|
|
4851
4851
|
defaultProp: M ?? !1,
|
|
4852
4852
|
onChange: B,
|
|
@@ -4854,28 +4854,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
|
|
|
4854
4854
|
});
|
|
4855
4855
|
return /* @__PURE__ */ jsxs(SwitchProvider, {
|
|
4856
4856
|
scope: O,
|
|
4857
|
-
checked:
|
|
4857
|
+
checked: zj,
|
|
4858
4858
|
disabled: P,
|
|
4859
4859
|
children: [/* @__PURE__ */ jsx(Primitive.button, {
|
|
4860
4860
|
type: "button",
|
|
4861
4861
|
role: "switch",
|
|
4862
|
-
"aria-checked":
|
|
4862
|
+
"aria-checked": zj,
|
|
4863
4863
|
"aria-required": N,
|
|
4864
|
-
"data-state": getState(
|
|
4864
|
+
"data-state": getState(zj),
|
|
4865
4865
|
"data-disabled": P ? "" : void 0,
|
|
4866
4866
|
disabled: P,
|
|
4867
4867
|
value: z,
|
|
4868
4868
|
...U,
|
|
4869
4869
|
ref: Z,
|
|
4870
4870
|
onClick: composeEventHandlers(_.onClick, (n) => {
|
|
4871
|
-
|
|
4871
|
+
Bj((n) => !n), Rj && (Lj.current = n.isPropagationStopped(), Lj.current || n.stopPropagation());
|
|
4872
4872
|
})
|
|
4873
|
-
}),
|
|
4873
|
+
}), Rj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
|
|
4874
4874
|
control: W,
|
|
4875
|
-
bubbles: !
|
|
4875
|
+
bubbles: !Lj.current,
|
|
4876
4876
|
name: A,
|
|
4877
4877
|
value: z,
|
|
4878
|
-
checked:
|
|
4878
|
+
checked: zj,
|
|
4879
4879
|
required: N,
|
|
4880
4880
|
disabled: P,
|
|
4881
4881
|
form: H,
|
|
@@ -5059,22 +5059,22 @@ var Root2 = Tabs, List = TabsList, Trigger = TabsTrigger, Content = TabsContent,
|
|
|
5059
5059
|
};
|
|
5060
5060
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
5061
5061
|
var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (_) => {
|
|
5062
|
-
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,
|
|
5062
|
+
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, Lj = P ?? z.delayDuration, Rj = React$1.useRef(!1), [zj, Bj] = useControllableState({
|
|
5063
5063
|
prop: A,
|
|
5064
5064
|
defaultProp: j ?? !1,
|
|
5065
5065
|
onChange: (n) => {
|
|
5066
5066
|
n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
|
|
5067
5067
|
},
|
|
5068
5068
|
caller: TOOLTIP_NAME
|
|
5069
|
-
}),
|
|
5070
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5071
|
-
}, [
|
|
5072
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5073
|
-
}, [
|
|
5069
|
+
}), Vj = React$1.useMemo(() => zj ? Rj.current ? "delayed-open" : "instant-open" : "closed", [zj]), Hj = React$1.useCallback(() => {
|
|
5070
|
+
window.clearTimeout(G.current), G.current = 0, Rj.current = !1, Bj(!0);
|
|
5071
|
+
}, [Bj]), Uj = React$1.useCallback(() => {
|
|
5072
|
+
window.clearTimeout(G.current), G.current = 0, Bj(!1);
|
|
5073
|
+
}, [Bj]), Wj = React$1.useCallback(() => {
|
|
5074
5074
|
window.clearTimeout(G.current), G.current = window.setTimeout(() => {
|
|
5075
|
-
|
|
5076
|
-
},
|
|
5077
|
-
}, [
|
|
5075
|
+
Rj.current = !0, Bj(!0), G.current = 0;
|
|
5076
|
+
}, Lj);
|
|
5077
|
+
}, [Lj, Bj]);
|
|
5078
5078
|
return React$1.useEffect(() => () => {
|
|
5079
5079
|
G.current &&= (window.clearTimeout(G.current), 0);
|
|
5080
5080
|
}, []), /* @__PURE__ */ jsx(Root2$4, {
|
|
@@ -5082,22 +5082,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
|
|
|
5082
5082
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
5083
5083
|
scope: E,
|
|
5084
5084
|
contentId: W,
|
|
5085
|
-
open:
|
|
5086
|
-
stateAttribute:
|
|
5085
|
+
open: zj,
|
|
5086
|
+
stateAttribute: Vj,
|
|
5087
5087
|
trigger: H,
|
|
5088
5088
|
onTriggerChange: U,
|
|
5089
5089
|
onTriggerEnter: React$1.useCallback(() => {
|
|
5090
|
-
z.isOpenDelayedRef.current ?
|
|
5090
|
+
z.isOpenDelayedRef.current ? Wj() : Hj();
|
|
5091
5091
|
}, [
|
|
5092
5092
|
z.isOpenDelayedRef,
|
|
5093
|
-
|
|
5094
|
-
|
|
5093
|
+
Wj,
|
|
5094
|
+
Hj
|
|
5095
5095
|
]),
|
|
5096
5096
|
onTriggerLeave: React$1.useCallback(() => {
|
|
5097
|
-
Z ?
|
|
5098
|
-
}, [
|
|
5099
|
-
onOpen:
|
|
5100
|
-
onClose:
|
|
5097
|
+
Z ? Uj() : (window.clearTimeout(G.current), G.current = 0);
|
|
5098
|
+
}, [Uj, Z]),
|
|
5099
|
+
onOpen: Hj,
|
|
5100
|
+
onClose: Uj,
|
|
5101
5101
|
disableHoverableContent: Z,
|
|
5102
5102
|
children: O
|
|
5103
5103
|
})
|
|
@@ -5910,14 +5910,14 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5910
5910
|
React$1.useEffect(() => U(O), [O]);
|
|
5911
5911
|
let [W, G] = React$1.useState(A);
|
|
5912
5912
|
React$1.useEffect(() => G(A), [A]);
|
|
5913
|
-
let [Z,
|
|
5914
|
-
React$1.useEffect(() =>
|
|
5915
|
-
let [
|
|
5916
|
-
React$1.useEffect(() =>
|
|
5917
|
-
let [
|
|
5918
|
-
React$1.useEffect(() =>
|
|
5919
|
-
let [
|
|
5920
|
-
return React$1.useEffect(() =>
|
|
5913
|
+
let [Z, Lj] = React$1.useState(j);
|
|
5914
|
+
React$1.useEffect(() => Lj(j), [j]);
|
|
5915
|
+
let [Rj, zj] = React$1.useState(M);
|
|
5916
|
+
React$1.useEffect(() => zj(M), [M]);
|
|
5917
|
+
let [Bj, Vj] = React$1.useState(N);
|
|
5918
|
+
React$1.useEffect(() => Vj(N), [N]);
|
|
5919
|
+
let [Hj, Uj] = React$1.useState(P);
|
|
5920
|
+
return React$1.useEffect(() => Uj(P), [P]), React$1.createElement(A$2, {
|
|
5921
5921
|
...B,
|
|
5922
5922
|
ref: E,
|
|
5923
5923
|
isRoot: !0,
|
|
@@ -5925,62 +5925,62 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5925
5925
|
appearance: H,
|
|
5926
5926
|
accentColor: W,
|
|
5927
5927
|
grayColor: Z,
|
|
5928
|
-
panelBackground:
|
|
5929
|
-
radius:
|
|
5930
|
-
scaling:
|
|
5928
|
+
panelBackground: Rj,
|
|
5929
|
+
radius: Bj,
|
|
5930
|
+
scaling: Hj,
|
|
5931
5931
|
onAppearanceChange: U,
|
|
5932
5932
|
onAccentColorChange: G,
|
|
5933
|
-
onGrayColorChange:
|
|
5934
|
-
onPanelBackgroundChange:
|
|
5935
|
-
onRadiusChange:
|
|
5936
|
-
onScalingChange:
|
|
5933
|
+
onGrayColorChange: Lj,
|
|
5934
|
+
onPanelBackgroundChange: zj,
|
|
5935
|
+
onRadiusChange: Vj,
|
|
5936
|
+
onScalingChange: Uj
|
|
5937
5937
|
});
|
|
5938
5938
|
});
|
|
5939
5939
|
I$3.displayName = "ThemeRoot";
|
|
5940
5940
|
var A$2 = React$1.forwardRef((_, E) => {
|
|
5941
|
-
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:
|
|
5941
|
+
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: Lj = d$5, onRadiusChange: Rj = d$5, onScalingChange: zj = d$5, ...Bj } = _, Vj = A ? Slot$3 : "div", Hj = z === "auto" ? a$12(P) : z, Uj = _.appearance === "light" || _.appearance === "dark", Wj = M === void 0 ? j || Uj : M;
|
|
5942
5942
|
return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
|
|
5943
5943
|
appearance: N,
|
|
5944
5944
|
accentColor: P,
|
|
5945
5945
|
grayColor: z,
|
|
5946
|
-
resolvedGrayColor:
|
|
5946
|
+
resolvedGrayColor: Hj,
|
|
5947
5947
|
panelBackground: B,
|
|
5948
5948
|
radius: H,
|
|
5949
5949
|
scaling: U,
|
|
5950
5950
|
onAppearanceChange: W,
|
|
5951
5951
|
onAccentColorChange: G,
|
|
5952
5952
|
onGrayColorChange: Z,
|
|
5953
|
-
onPanelBackgroundChange:
|
|
5954
|
-
onRadiusChange:
|
|
5955
|
-
onScalingChange:
|
|
5953
|
+
onPanelBackgroundChange: Lj,
|
|
5954
|
+
onRadiusChange: Rj,
|
|
5955
|
+
onScalingChange: zj
|
|
5956
5956
|
}), [
|
|
5957
5957
|
N,
|
|
5958
5958
|
P,
|
|
5959
5959
|
z,
|
|
5960
|
-
|
|
5960
|
+
Hj,
|
|
5961
5961
|
B,
|
|
5962
5962
|
H,
|
|
5963
5963
|
U,
|
|
5964
5964
|
W,
|
|
5965
5965
|
G,
|
|
5966
5966
|
Z,
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
]) }, React$1.createElement(
|
|
5967
|
+
Lj,
|
|
5968
|
+
Rj,
|
|
5969
|
+
zj
|
|
5970
|
+
]) }, React$1.createElement(Vj, {
|
|
5971
5971
|
"data-is-root-theme": j ? "true" : "false",
|
|
5972
5972
|
"data-accent-color": P,
|
|
5973
|
-
"data-gray-color":
|
|
5974
|
-
"data-has-background":
|
|
5973
|
+
"data-gray-color": Hj,
|
|
5974
|
+
"data-has-background": Wj ? "true" : "false",
|
|
5975
5975
|
"data-panel-background": B,
|
|
5976
5976
|
"data-radius": H,
|
|
5977
5977
|
"data-scaling": U,
|
|
5978
5978
|
ref: E,
|
|
5979
|
-
...
|
|
5979
|
+
...Bj,
|
|
5980
5980
|
className: (0, import_classnames$18.default)("radix-themes", {
|
|
5981
5981
|
light: N === "light",
|
|
5982
5982
|
dark: N === "dark"
|
|
5983
|
-
},
|
|
5983
|
+
}, Bj.className)
|
|
5984
5984
|
}));
|
|
5985
5985
|
});
|
|
5986
5986
|
A$2.displayName = "ThemeImpl";
|
|
@@ -6752,7 +6752,7 @@ function S$2(n) {
|
|
|
6752
6752
|
return [(0, import_classnames$10.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
|
|
6753
6753
|
}
|
|
6754
6754
|
var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((_, E) => {
|
|
6755
|
-
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:
|
|
6755
|
+
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: Lj = t$3.scrollbars.default, ...Rj } = O;
|
|
6756
6756
|
return React$1.createElement(Root$1, {
|
|
6757
6757
|
type: H,
|
|
6758
6758
|
scrollHideDelay: U,
|
|
@@ -6763,10 +6763,10 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6763
6763
|
asChild: N,
|
|
6764
6764
|
children: P
|
|
6765
6765
|
}, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
6766
|
-
...
|
|
6766
|
+
...Rj,
|
|
6767
6767
|
ref: E,
|
|
6768
6768
|
className: "rt-ScrollAreaViewport"
|
|
6769
|
-
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
6769
|
+
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Lj === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
6770
6770
|
"data-radius": Z,
|
|
6771
6771
|
orientation: "horizontal",
|
|
6772
6772
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6774,7 +6774,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6774
6774
|
value: G,
|
|
6775
6775
|
propValues: t$3.size.values
|
|
6776
6776
|
}))
|
|
6777
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6777
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Lj === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
6778
6778
|
"data-radius": Z,
|
|
6779
6779
|
orientation: "vertical",
|
|
6780
6780
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6782,7 +6782,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6782
6782
|
value: G,
|
|
6783
6783
|
propValues: t$3.size.values
|
|
6784
6784
|
}))
|
|
6785
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6785
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Lj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
6786
6786
|
});
|
|
6787
6787
|
c.displayName = "ScrollArea";
|
|
6788
6788
|
var n$2 = {
|
|
@@ -7985,17 +7985,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
7985
7985
|
E.forEach((n) => {
|
|
7986
7986
|
let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
|
|
7987
7987
|
U = j ? B === "horizontal" ? (_.clientX - j.x) / P * 100 : (_.clientY - j.y) / P * 100 : B === "horizontal" ? _.clientX < 0 ? -100 : 100 : _.clientY < 0 ? -100 : 100;
|
|
7988
|
-
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout:
|
|
7989
|
-
if (Z && W &&
|
|
7988
|
+
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Lj, separatorToPanels: Rj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
|
|
7989
|
+
if (Z && W && Lj && Rj) {
|
|
7990
7990
|
let _ = Z$1({
|
|
7991
7991
|
delta: U,
|
|
7992
7992
|
initialLayout: W,
|
|
7993
7993
|
panelConstraints: Z,
|
|
7994
7994
|
pivotIndices: n.panels.map((n) => H.indexOf(n)),
|
|
7995
|
-
prevLayout:
|
|
7995
|
+
prevLayout: Lj,
|
|
7996
7996
|
trigger: "mouse-or-touch"
|
|
7997
7997
|
});
|
|
7998
|
-
if (B$1(_,
|
|
7998
|
+
if (B$1(_, Lj)) {
|
|
7999
7999
|
if (U !== 0 && !z) switch (B) {
|
|
8000
8000
|
case "horizontal":
|
|
8001
8001
|
M |= U < 0 ? De : Oe$1;
|
|
@@ -8009,7 +8009,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
8009
8009
|
defaultLayoutDeferred: G,
|
|
8010
8010
|
derivedPanelConstraints: Z,
|
|
8011
8011
|
layout: _,
|
|
8012
|
-
separatorToPanels:
|
|
8012
|
+
separatorToPanels: Rj
|
|
8013
8013
|
});
|
|
8014
8014
|
let E = n.group.panels.map(({ id: n }) => n).join(",");
|
|
8015
8015
|
n.group.inMemoryLayouts[E] = _;
|
|
@@ -8221,64 +8221,64 @@ function Pt(n, _) {
|
|
|
8221
8221
|
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 }) {
|
|
8222
8222
|
let U = useRef({}), G = le$1((n) => {
|
|
8223
8223
|
B$1(U.current, n) || (U.current = n, P?.(n));
|
|
8224
|
-
}), Z = ae$1(N),
|
|
8224
|
+
}), Z = ae$1(N), Lj = useRef(null), [Rj, Hj] = useState(!1), [Uj, Wj] = useState(E ?? {}), [Gj, qj] = wt(), Jj = useRef({
|
|
8225
8225
|
lastExpandedPanelSizes: {},
|
|
8226
8226
|
layouts: {},
|
|
8227
8227
|
panels: [],
|
|
8228
8228
|
separators: []
|
|
8229
|
-
}),
|
|
8229
|
+
}), Yj = ue$1(Lj, j);
|
|
8230
8230
|
Pt(Z, M);
|
|
8231
|
-
let
|
|
8231
|
+
let Xj = useMemo(() => ({
|
|
8232
8232
|
id: Z,
|
|
8233
8233
|
orientation: z,
|
|
8234
8234
|
registerPanel: (n) => {
|
|
8235
|
-
let _ =
|
|
8236
|
-
return _.panels = ie$1(z, [..._.panels, n]),
|
|
8237
|
-
_.panels = _.panels.filter((_) => _ !== n),
|
|
8235
|
+
let _ = Jj.current;
|
|
8236
|
+
return _.panels = ie$1(z, [..._.panels, n]), qj(), () => {
|
|
8237
|
+
_.panels = _.panels.filter((_) => _ !== n), qj();
|
|
8238
8238
|
};
|
|
8239
8239
|
},
|
|
8240
8240
|
registerSeparator: (n) => {
|
|
8241
|
-
let _ =
|
|
8242
|
-
return _.separators = ie$1(z, [..._.separators, n]),
|
|
8243
|
-
_.separators = _.separators.filter((_) => _ !== n),
|
|
8241
|
+
let _ = Jj.current;
|
|
8242
|
+
return _.separators = ie$1(z, [..._.separators, n]), qj(), () => {
|
|
8243
|
+
_.separators = _.separators.filter((_) => _ !== n), qj();
|
|
8244
8244
|
};
|
|
8245
8245
|
}
|
|
8246
8246
|
}), [
|
|
8247
8247
|
Z,
|
|
8248
|
-
|
|
8248
|
+
qj,
|
|
8249
8249
|
z
|
|
8250
|
-
]),
|
|
8250
|
+
]), Zj = Lt({
|
|
8251
8251
|
defaultLayout: E,
|
|
8252
8252
|
disableCursor: O
|
|
8253
|
-
}),
|
|
8253
|
+
}), Qj = useRef(null);
|
|
8254
8254
|
A$1(() => {
|
|
8255
|
-
let n =
|
|
8255
|
+
let n = Lj.current;
|
|
8256
8256
|
if (n === null) return;
|
|
8257
|
-
let _ =
|
|
8258
|
-
defaultLayout:
|
|
8259
|
-
disableCursor: !!
|
|
8257
|
+
let _ = Jj.current, E = {
|
|
8258
|
+
defaultLayout: Zj.defaultLayout,
|
|
8259
|
+
disableCursor: !!Zj.disableCursor,
|
|
8260
8260
|
disabled: !!A,
|
|
8261
8261
|
element: n,
|
|
8262
8262
|
id: Z,
|
|
8263
|
-
inMemoryLastExpandedPanelSizes:
|
|
8264
|
-
inMemoryLayouts:
|
|
8263
|
+
inMemoryLastExpandedPanelSizes: Jj.current.lastExpandedPanelSizes,
|
|
8264
|
+
inMemoryLayouts: Jj.current.layouts,
|
|
8265
8265
|
orientation: z,
|
|
8266
8266
|
panels: _.panels,
|
|
8267
8267
|
separators: _.separators
|
|
8268
8268
|
};
|
|
8269
|
-
|
|
8269
|
+
Qj.current = E;
|
|
8270
8270
|
let O = bt(E), j = D$1().mountedGroups.get(E);
|
|
8271
8271
|
if (j) {
|
|
8272
8272
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
|
|
8273
|
-
!n && _.length > 0 && (
|
|
8273
|
+
!n && _.length > 0 && (Wj(E), G?.(E));
|
|
8274
8274
|
}
|
|
8275
8275
|
let M = T$1.addListener("interactionStateChange", (n) => {
|
|
8276
8276
|
switch (n.state) {
|
|
8277
8277
|
case "active":
|
|
8278
|
-
|
|
8278
|
+
Hj(n.hitRegions.some((n) => n.group === E));
|
|
8279
8279
|
break;
|
|
8280
8280
|
default:
|
|
8281
|
-
|
|
8281
|
+
Hj(!1);
|
|
8282
8282
|
break;
|
|
8283
8283
|
}
|
|
8284
8284
|
}), N = T$1.addListener("mountedGroupsChange", (n) => {
|
|
@@ -8286,30 +8286,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8286
8286
|
if (_) {
|
|
8287
8287
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
|
|
8288
8288
|
if (n || E.length === 0) return;
|
|
8289
|
-
|
|
8289
|
+
Wj(O), G?.(O);
|
|
8290
8290
|
}
|
|
8291
8291
|
});
|
|
8292
8292
|
return () => {
|
|
8293
|
-
|
|
8293
|
+
Qj.current = null, O(), M(), N();
|
|
8294
8294
|
};
|
|
8295
8295
|
}, [
|
|
8296
8296
|
A,
|
|
8297
8297
|
Z,
|
|
8298
8298
|
G,
|
|
8299
8299
|
z,
|
|
8300
|
-
|
|
8301
|
-
|
|
8300
|
+
Gj,
|
|
8301
|
+
Zj
|
|
8302
8302
|
]), useEffect(() => {
|
|
8303
|
-
let n =
|
|
8303
|
+
let n = Qj.current;
|
|
8304
8304
|
n && (n.defaultLayout = E, n.disableCursor = !!O);
|
|
8305
8305
|
});
|
|
8306
|
-
let
|
|
8307
|
-
for (let n in
|
|
8306
|
+
let $j = { [Fe]: Rj ? "none" : void 0 };
|
|
8307
|
+
for (let n in Uj) {
|
|
8308
8308
|
let _ = Ve(Z, n);
|
|
8309
|
-
|
|
8309
|
+
$j[_] = Uj[n];
|
|
8310
8310
|
}
|
|
8311
8311
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
8312
|
-
value:
|
|
8312
|
+
value: Xj,
|
|
8313
8313
|
children: /* @__PURE__ */ jsx("div", {
|
|
8314
8314
|
...H,
|
|
8315
8315
|
"aria-orientation": z,
|
|
@@ -8317,13 +8317,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8317
8317
|
"data-group": !0,
|
|
8318
8318
|
"data-testid": Z,
|
|
8319
8319
|
id: Z,
|
|
8320
|
-
ref:
|
|
8320
|
+
ref: Yj,
|
|
8321
8321
|
style: {
|
|
8322
8322
|
height: "100%",
|
|
8323
8323
|
width: "100%",
|
|
8324
8324
|
overflow: "hidden",
|
|
8325
8325
|
...B,
|
|
8326
|
-
|
|
8326
|
+
...$j,
|
|
8327
8327
|
display: "flex",
|
|
8328
8328
|
flexDirection: z === "horizontal" ? "row" : "column",
|
|
8329
8329
|
flexWrap: "nowrap"
|
|
@@ -8441,12 +8441,12 @@ function It(n, _) {
|
|
|
8441
8441
|
});
|
|
8442
8442
|
}
|
|
8443
8443
|
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 }) {
|
|
8444
|
-
let W = !!M, G = ae$1(M), Z = useRef(null),
|
|
8444
|
+
let W = !!M, G = ae$1(M), Z = useRef(null), Lj = ue$1(Z, j), { id: Rj, registerPanel: zj } = ce$1(), Vj = z !== null, Hj = le$1((n, _, E) => {
|
|
8445
8445
|
z?.(n, M, E);
|
|
8446
8446
|
});
|
|
8447
8447
|
A$1(() => {
|
|
8448
8448
|
let n = Z.current;
|
|
8449
|
-
if (n !== null) return
|
|
8449
|
+
if (n !== null) return zj({
|
|
8450
8450
|
element: n,
|
|
8451
8451
|
id: G,
|
|
8452
8452
|
idIsStable: W,
|
|
@@ -8454,7 +8454,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8454
8454
|
expandToSize: void 0,
|
|
8455
8455
|
prevSize: void 0
|
|
8456
8456
|
},
|
|
8457
|
-
onResize:
|
|
8457
|
+
onResize: Vj ? Hj : void 0,
|
|
8458
8458
|
panelConstraints: {
|
|
8459
8459
|
collapsedSize: E,
|
|
8460
8460
|
collapsible: O,
|
|
@@ -8467,25 +8467,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8467
8467
|
E,
|
|
8468
8468
|
O,
|
|
8469
8469
|
A,
|
|
8470
|
-
|
|
8470
|
+
Vj,
|
|
8471
8471
|
G,
|
|
8472
8472
|
W,
|
|
8473
8473
|
N,
|
|
8474
8474
|
P,
|
|
8475
|
-
|
|
8476
|
-
|
|
8475
|
+
Hj,
|
|
8476
|
+
zj
|
|
8477
8477
|
]), It(G, B);
|
|
8478
|
-
let
|
|
8478
|
+
let Uj = Ve(Rj, G);
|
|
8479
8479
|
return /* @__PURE__ */ jsx("div", {
|
|
8480
8480
|
...U,
|
|
8481
8481
|
"data-panel": !0,
|
|
8482
8482
|
"data-testid": G,
|
|
8483
8483
|
id: G,
|
|
8484
|
-
ref:
|
|
8484
|
+
ref: Lj,
|
|
8485
8485
|
style: {
|
|
8486
8486
|
...Gt,
|
|
8487
8487
|
flexBasis: 0,
|
|
8488
|
-
flexGrow: `var(${
|
|
8488
|
+
flexGrow: `var(${Uj}, 1)`,
|
|
8489
8489
|
flexShrink: 1,
|
|
8490
8490
|
overflow: "hidden",
|
|
8491
8491
|
pointerEvents: `var(${Fe})`
|
|
@@ -8548,7 +8548,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
|
|
|
8548
8548
|
};
|
|
8549
8549
|
}
|
|
8550
8550
|
function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j }) {
|
|
8551
|
-
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(),
|
|
8551
|
+
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(), Lj = G === "horizontal" ? "vertical" : "horizontal";
|
|
8552
8552
|
return A$1(() => {
|
|
8553
8553
|
let n = H.current;
|
|
8554
8554
|
if (n !== null) {
|
|
@@ -8584,7 +8584,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8584
8584
|
]), /* @__PURE__ */ jsx("div", {
|
|
8585
8585
|
...j,
|
|
8586
8586
|
"aria-controls": N.valueControls,
|
|
8587
|
-
"aria-orientation":
|
|
8587
|
+
"aria-orientation": Lj,
|
|
8588
8588
|
"aria-valuemax": N.valueMax,
|
|
8589
8589
|
"aria-valuemin": N.valueMin,
|
|
8590
8590
|
"aria-valuenow": N.valueNow,
|
|
@@ -8784,7 +8784,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8784
8784
|
historyIndex: O.length - 1
|
|
8785
8785
|
};
|
|
8786
8786
|
});
|
|
8787
|
-
}, []),
|
|
8787
|
+
}, []), Lj = React.useCallback(() => {
|
|
8788
8788
|
M((n) => {
|
|
8789
8789
|
if (n.selectedElementIds.length === 0) return n;
|
|
8790
8790
|
let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
|
|
@@ -8796,7 +8796,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8796
8796
|
historyIndex: E.length - 1
|
|
8797
8797
|
};
|
|
8798
8798
|
});
|
|
8799
|
-
}, []),
|
|
8799
|
+
}, []), Rj = React.useCallback((n, _ = !1) => {
|
|
8800
8800
|
M((E) => {
|
|
8801
8801
|
if (n === null) return {
|
|
8802
8802
|
...E,
|
|
@@ -8813,12 +8813,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8813
8813
|
selectedElementIds: [n]
|
|
8814
8814
|
};
|
|
8815
8815
|
});
|
|
8816
|
-
}, []),
|
|
8816
|
+
}, []), zj = React.useCallback((n) => {
|
|
8817
8817
|
M((_) => ({
|
|
8818
8818
|
..._,
|
|
8819
8819
|
selectedElementIds: n
|
|
8820
8820
|
}));
|
|
8821
|
-
}, []),
|
|
8821
|
+
}, []), Bj = React.useCallback((n, _) => {
|
|
8822
8822
|
M((E) => {
|
|
8823
8823
|
let O = [...E.elements], A = O[n];
|
|
8824
8824
|
O.splice(n, 1), O.splice(_, 0, A);
|
|
@@ -8830,7 +8830,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8830
8830
|
historyIndex: j.length - 1
|
|
8831
8831
|
};
|
|
8832
8832
|
});
|
|
8833
|
-
}, []),
|
|
8833
|
+
}, []), Hj = React.useCallback((n, _, E = !0) => {
|
|
8834
8834
|
M((O) => {
|
|
8835
8835
|
let A = O.elements.map((E) => E.id === n ? {
|
|
8836
8836
|
...E,
|
|
@@ -8843,7 +8843,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8843
8843
|
historyIndex: M
|
|
8844
8844
|
};
|
|
8845
8845
|
});
|
|
8846
|
-
}, []),
|
|
8846
|
+
}, []), Uj = React.useCallback((n, _ = !0) => {
|
|
8847
8847
|
M((E) => {
|
|
8848
8848
|
let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
|
|
8849
8849
|
n.forEach(({ id: n, changes: _ }) => {
|
|
@@ -8897,7 +8897,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8897
8897
|
historyIndex: P
|
|
8898
8898
|
};
|
|
8899
8899
|
});
|
|
8900
|
-
}, []),
|
|
8900
|
+
}, []), Wj = React.useCallback((n) => {
|
|
8901
8901
|
M((_) => {
|
|
8902
8902
|
let E = _.elements.filter((_) => n.includes(_.id));
|
|
8903
8903
|
if (E.length === 0) return _;
|
|
@@ -8925,7 +8925,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8925
8925
|
historyIndex: z.length - 1
|
|
8926
8926
|
};
|
|
8927
8927
|
});
|
|
8928
|
-
}, []),
|
|
8928
|
+
}, []), Gj = React.useCallback((n) => {
|
|
8929
8929
|
M((_) => {
|
|
8930
8930
|
let E = _.elements.find((_) => _.id === n);
|
|
8931
8931
|
if (!E || E.type !== "group") return _;
|
|
@@ -8941,7 +8941,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8941
8941
|
historyIndex: j.length - 1
|
|
8942
8942
|
};
|
|
8943
8943
|
});
|
|
8944
|
-
}, []),
|
|
8944
|
+
}, []), qj = React.useCallback((n, _) => {
|
|
8945
8945
|
M((E) => {
|
|
8946
8946
|
let O = E.elements.map((E) => E.id === n ? {
|
|
8947
8947
|
...E,
|
|
@@ -8952,13 +8952,88 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8952
8952
|
elements: O
|
|
8953
8953
|
};
|
|
8954
8954
|
});
|
|
8955
|
-
}, []),
|
|
8955
|
+
}, []), Jj = React.useCallback((n, _) => {
|
|
8956
|
+
if (!n.find((n) => n.id === _ && n.type === "group")) return n;
|
|
8957
|
+
let E = n.filter((n) => n.groupId === _);
|
|
8958
|
+
if (E.length === 0) return n;
|
|
8959
|
+
let O = Math.min(...E.map((n) => n.x)), A = Math.min(...E.map((n) => n.y)), j = Math.max(...E.map((n) => n.x + n.width)), M = Math.max(...E.map((n) => n.y + n.height));
|
|
8960
|
+
return n.map((n) => n.id === _ ? {
|
|
8961
|
+
...n,
|
|
8962
|
+
x: O,
|
|
8963
|
+
y: A,
|
|
8964
|
+
width: j - O,
|
|
8965
|
+
height: M - A
|
|
8966
|
+
} : n);
|
|
8967
|
+
}, []), Yj = React.useCallback((n, _) => {
|
|
8968
|
+
M((E) => {
|
|
8969
|
+
let O = E.elements.find((_) => _.id === n), A = E.elements.find((n) => n.id === _ && n.type === "group");
|
|
8970
|
+
if (!O || !A) return E;
|
|
8971
|
+
let j = E.elements.map((E) => E.id === n ? {
|
|
8972
|
+
...E,
|
|
8973
|
+
groupId: _
|
|
8974
|
+
} : E);
|
|
8975
|
+
j = Jj(j, _);
|
|
8976
|
+
let M = E.history.slice(0, E.historyIndex + 1);
|
|
8977
|
+
return M.push(j), {
|
|
8978
|
+
...E,
|
|
8979
|
+
elements: j,
|
|
8980
|
+
history: M,
|
|
8981
|
+
historyIndex: M.length - 1
|
|
8982
|
+
};
|
|
8983
|
+
});
|
|
8984
|
+
}, [Jj]), Xj = React.useCallback((n) => {
|
|
8985
|
+
M((_) => {
|
|
8986
|
+
let E = _.elements.find((_) => _.id === n);
|
|
8987
|
+
if (!E || !E.groupId) return _;
|
|
8988
|
+
let O = E.groupId, A = _.elements.map((_) => _.id === n ? {
|
|
8989
|
+
..._,
|
|
8990
|
+
groupId: void 0
|
|
8991
|
+
} : _);
|
|
8992
|
+
A = Jj(A, O);
|
|
8993
|
+
let j = _.history.slice(0, _.historyIndex + 1);
|
|
8994
|
+
return j.push(A), {
|
|
8995
|
+
..._,
|
|
8996
|
+
elements: A,
|
|
8997
|
+
history: j,
|
|
8998
|
+
historyIndex: j.length - 1
|
|
8999
|
+
};
|
|
9000
|
+
});
|
|
9001
|
+
}, [Jj]), Zj = React.useCallback((n, _, E) => {
|
|
9002
|
+
M((O) => {
|
|
9003
|
+
let A = O.elements.find((_) => _.id === n && _.type === "group");
|
|
9004
|
+
if (!A) return O;
|
|
9005
|
+
let j = _ / A.width, M = E / A.height, N = A.x, P = A.y, z = O.elements.map((O) => {
|
|
9006
|
+
if (O.id === n) return {
|
|
9007
|
+
...O,
|
|
9008
|
+
width: _,
|
|
9009
|
+
height: E
|
|
9010
|
+
};
|
|
9011
|
+
if (O.groupId === n) {
|
|
9012
|
+
let n = O.x - N, _ = O.y - P, E = N + n * j, A = P + _ * M;
|
|
9013
|
+
return {
|
|
9014
|
+
...O,
|
|
9015
|
+
x: E,
|
|
9016
|
+
y: A,
|
|
9017
|
+
width: Math.max(1, O.width * j),
|
|
9018
|
+
height: Math.max(1, O.height * M)
|
|
9019
|
+
};
|
|
9020
|
+
}
|
|
9021
|
+
return O;
|
|
9022
|
+
}), B = O.history.slice(0, O.historyIndex + 1);
|
|
9023
|
+
return B.push(z), {
|
|
9024
|
+
...O,
|
|
9025
|
+
elements: z,
|
|
9026
|
+
history: B,
|
|
9027
|
+
historyIndex: B.length - 1
|
|
9028
|
+
};
|
|
9029
|
+
});
|
|
9030
|
+
}, []), Qj = React.useCallback((n, _) => {
|
|
8956
9031
|
M((E) => ({
|
|
8957
9032
|
...E,
|
|
8958
9033
|
mockData: n,
|
|
8959
9034
|
singleMockData: _
|
|
8960
9035
|
}));
|
|
8961
|
-
}, []),
|
|
9036
|
+
}, []), $j = React.useCallback((n) => {
|
|
8962
9037
|
M((_) => ({
|
|
8963
9038
|
..._,
|
|
8964
9039
|
listSettings: {
|
|
@@ -8966,21 +9041,24 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8966
9041
|
...n
|
|
8967
9042
|
}
|
|
8968
9043
|
}));
|
|
8969
|
-
}, []),
|
|
9044
|
+
}, []), eM = React.useMemo(() => ({
|
|
8970
9045
|
state: j,
|
|
8971
9046
|
addElement: G,
|
|
8972
9047
|
removeElement: Z,
|
|
8973
|
-
removeSelected:
|
|
8974
|
-
selectElement:
|
|
8975
|
-
setSelectedElements:
|
|
8976
|
-
moveElement:
|
|
8977
|
-
updateElement:
|
|
8978
|
-
updateElements:
|
|
8979
|
-
groupElements:
|
|
8980
|
-
ungroupElements:
|
|
8981
|
-
renameElement:
|
|
8982
|
-
|
|
8983
|
-
|
|
9048
|
+
removeSelected: Lj,
|
|
9049
|
+
selectElement: Rj,
|
|
9050
|
+
setSelectedElements: zj,
|
|
9051
|
+
moveElement: Bj,
|
|
9052
|
+
updateElement: Hj,
|
|
9053
|
+
updateElements: Uj,
|
|
9054
|
+
groupElements: Wj,
|
|
9055
|
+
ungroupElements: Gj,
|
|
9056
|
+
renameElement: qj,
|
|
9057
|
+
addToGroup: Yj,
|
|
9058
|
+
removeFromGroup: Xj,
|
|
9059
|
+
resizeGroup: Zj,
|
|
9060
|
+
setMockData: Qj,
|
|
9061
|
+
updateListSettings: $j,
|
|
8984
9062
|
setCanvasHeight: N,
|
|
8985
9063
|
loadState: z,
|
|
8986
9064
|
undo: B,
|
|
@@ -8992,17 +9070,20 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8992
9070
|
j,
|
|
8993
9071
|
G,
|
|
8994
9072
|
Z,
|
|
9073
|
+
Lj,
|
|
9074
|
+
Rj,
|
|
9075
|
+
zj,
|
|
8995
9076
|
Bj,
|
|
8996
|
-
Vj,
|
|
8997
9077
|
Hj,
|
|
8998
9078
|
Uj,
|
|
9079
|
+
Wj,
|
|
8999
9080
|
Gj,
|
|
9000
|
-
Kj,
|
|
9001
9081
|
qj,
|
|
9002
|
-
|
|
9082
|
+
Yj,
|
|
9003
9083
|
Xj,
|
|
9004
9084
|
Zj,
|
|
9005
9085
|
Qj,
|
|
9086
|
+
$j,
|
|
9006
9087
|
N,
|
|
9007
9088
|
z,
|
|
9008
9089
|
B,
|
|
@@ -9012,7 +9093,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9012
9093
|
P
|
|
9013
9094
|
]);
|
|
9014
9095
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
9015
|
-
value:
|
|
9096
|
+
value: eM,
|
|
9016
9097
|
children: n
|
|
9017
9098
|
});
|
|
9018
9099
|
}, useEditor = () => {
|
|
@@ -9454,16 +9535,16 @@ var __assign$1 = function() {
|
|
|
9454
9535
|
maxHeight: _
|
|
9455
9536
|
};
|
|
9456
9537
|
}, _.prototype.calculateNewSizeFromDirection = function(n, _) {
|
|
9457
|
-
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,
|
|
9458
|
-
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W -
|
|
9538
|
+
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, Lj = U || 0;
|
|
9539
|
+
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Lj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Lj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Lj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Lj)), {
|
|
9459
9540
|
newWidth: W,
|
|
9460
9541
|
newHeight: G
|
|
9461
9542
|
};
|
|
9462
9543
|
}, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
|
|
9463
9544
|
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;
|
|
9464
9545
|
if (j) {
|
|
9465
|
-
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W,
|
|
9466
|
-
n = clamp$1(n,
|
|
9546
|
+
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Lj = (P - W) / this.ratio + U, Rj = (z - W) / this.ratio + U, zj = Math.max(P, G), Bj = Math.min(z, Z), Vj = Math.max(B, Lj), Hj = Math.min(H, Rj);
|
|
9547
|
+
n = clamp$1(n, zj, Bj), _ = clamp$1(_, Vj, Hj);
|
|
9467
9548
|
} else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
|
|
9468
9549
|
return {
|
|
9469
9550
|
newWidth: n,
|
|
@@ -9520,56 +9601,56 @@ var __assign$1 = function() {
|
|
|
9520
9601
|
} catch {}
|
|
9521
9602
|
var E = this.props, O = E.maxWidth, A = E.maxHeight, j = E.minWidth, M = E.minHeight, N = isTouchEvent(n) ? n.touches[0].clientX : n.clientX, P = isTouchEvent(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);
|
|
9522
9603
|
O = Z.maxWidth, A = Z.maxHeight, j = Z.minWidth, M = Z.minHeight;
|
|
9523
|
-
var
|
|
9524
|
-
this.props.snap && this.props.snap.x && (
|
|
9525
|
-
var
|
|
9526
|
-
width:
|
|
9527
|
-
height:
|
|
9604
|
+
var Lj = this.calculateNewSizeFromDirection(N, P), Rj = Lj.newHeight, zj = Lj.newWidth, Bj = this.calculateNewMaxFromBoundary(O, A);
|
|
9605
|
+
this.props.snap && this.props.snap.x && (zj = findClosestSnap(zj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (Rj = findClosestSnap(Rj, this.props.snap.y, this.props.snapGap));
|
|
9606
|
+
var Vj = this.calculateNewSizeFromAspectRatio(zj, Rj, {
|
|
9607
|
+
width: Bj.maxWidth,
|
|
9608
|
+
height: Bj.maxHeight
|
|
9528
9609
|
}, {
|
|
9529
9610
|
width: j,
|
|
9530
9611
|
height: M
|
|
9531
9612
|
});
|
|
9532
|
-
if (
|
|
9533
|
-
var
|
|
9534
|
-
|
|
9613
|
+
if (zj = Vj.newWidth, Rj = Vj.newHeight, this.props.grid) {
|
|
9614
|
+
var Hj = snap(zj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), Uj = snap(Rj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Gj = this.props.snapGap || 0, Kj = Gj === 0 || Math.abs(Hj - zj) <= Gj ? Hj : zj, qj = Gj === 0 || Math.abs(Uj - Rj) <= Gj ? Uj : Rj;
|
|
9615
|
+
zj = Kj, Rj = qj;
|
|
9535
9616
|
}
|
|
9536
|
-
var
|
|
9537
|
-
width:
|
|
9538
|
-
height:
|
|
9617
|
+
var Jj = {
|
|
9618
|
+
width: zj - H.width,
|
|
9619
|
+
height: Rj - H.height
|
|
9539
9620
|
};
|
|
9540
|
-
if (this.delta =
|
|
9621
|
+
if (this.delta = Jj, U && typeof U == "string") {
|
|
9541
9622
|
if (U.endsWith("%")) {
|
|
9542
|
-
var
|
|
9543
|
-
|
|
9623
|
+
var Yj = zj / G.width * 100;
|
|
9624
|
+
zj = `${Yj}%`;
|
|
9544
9625
|
} else if (U.endsWith("vw")) {
|
|
9545
|
-
var
|
|
9546
|
-
|
|
9626
|
+
var Xj = zj / this.window.innerWidth * 100;
|
|
9627
|
+
zj = `${Xj}vw`;
|
|
9547
9628
|
} else if (U.endsWith("vh")) {
|
|
9548
|
-
var
|
|
9549
|
-
|
|
9629
|
+
var Zj = zj / this.window.innerHeight * 100;
|
|
9630
|
+
zj = `${Zj}vh`;
|
|
9550
9631
|
}
|
|
9551
9632
|
}
|
|
9552
9633
|
if (W && typeof W == "string") {
|
|
9553
9634
|
if (W.endsWith("%")) {
|
|
9554
|
-
var
|
|
9555
|
-
|
|
9635
|
+
var Yj = Rj / G.height * 100;
|
|
9636
|
+
Rj = `${Yj}%`;
|
|
9556
9637
|
} else if (W.endsWith("vw")) {
|
|
9557
|
-
var
|
|
9558
|
-
|
|
9638
|
+
var Xj = Rj / this.window.innerWidth * 100;
|
|
9639
|
+
Rj = `${Xj}vw`;
|
|
9559
9640
|
} else if (W.endsWith("vh")) {
|
|
9560
|
-
var
|
|
9561
|
-
|
|
9641
|
+
var Zj = Rj / this.window.innerHeight * 100;
|
|
9642
|
+
Rj = `${Zj}vh`;
|
|
9562
9643
|
}
|
|
9563
9644
|
}
|
|
9564
|
-
var
|
|
9565
|
-
width: this.createSizeForCssProperty(
|
|
9566
|
-
height: this.createSizeForCssProperty(
|
|
9645
|
+
var Qj = {
|
|
9646
|
+
width: this.createSizeForCssProperty(zj, "width"),
|
|
9647
|
+
height: this.createSizeForCssProperty(Rj, "height")
|
|
9567
9648
|
};
|
|
9568
|
-
this.flexDir === "row" ?
|
|
9569
|
-
var
|
|
9570
|
-
|
|
9571
|
-
_.setState(
|
|
9572
|
-
}), this.props.onResize &&
|
|
9649
|
+
this.flexDir === "row" ? Qj.flexBasis = Qj.width : this.flexDir === "column" && (Qj.flexBasis = Qj.height);
|
|
9650
|
+
var $j = this.state.width !== Qj.width, eM = this.state.height !== Qj.height, tM = this.state.flexBasis !== Qj.flexBasis, nM = $j || eM || tM;
|
|
9651
|
+
nM && flushSync(function() {
|
|
9652
|
+
_.setState(Qj);
|
|
9653
|
+
}), this.props.onResize && nM && this.props.onResize(n, B, this.resizable, Jj);
|
|
9573
9654
|
}
|
|
9574
9655
|
}, _.prototype.onMouseUp = function(n) {
|
|
9575
9656
|
var _ = this.state, E = _.isResizing, O = _.direction;
|
|
@@ -11046,32 +11127,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
11046
11127
|
});
|
|
11047
11128
|
};
|
|
11048
11129
|
const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
11049
|
-
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,
|
|
11130
|
+
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, Lj] = useState(!1), [Rj, zj] = useState(!1), [Hj, Uj] = useState(!1), [Wj, Jj] = useState("formatting"), [Yj, Xj] = useState({
|
|
11050
11131
|
open: !1,
|
|
11051
11132
|
prop: "",
|
|
11052
11133
|
value: ""
|
|
11053
|
-
}), [eM, tM] = useState(""), [
|
|
11054
|
-
let _ =
|
|
11134
|
+
}), [Zj, Qj] = useState(!1), [$j, eM] = useState(""), [tM, nM] = useState(""), [rM, iM] = useState(_.content), [aM, oM] = useState(_.dataBinding || ""), sM = useRef(null), cM = useRef(null), lM = (n) => {
|
|
11135
|
+
let _ = sM.current;
|
|
11055
11136
|
if (_) {
|
|
11056
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
11057
|
-
|
|
11137
|
+
let E = _.selectionStart, O = _.selectionEnd, A = rM;
|
|
11138
|
+
iM(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
11058
11139
|
_.focus();
|
|
11059
11140
|
let O = E + n.length + 4;
|
|
11060
11141
|
_.setSelectionRange(O, O);
|
|
11061
11142
|
}, 0);
|
|
11062
|
-
} else
|
|
11063
|
-
},
|
|
11143
|
+
} else iM((_) => _ + `{{${n}}}`);
|
|
11144
|
+
}, uM = (n) => {
|
|
11064
11145
|
E(_.id, { style: {
|
|
11065
11146
|
..._.style,
|
|
11066
11147
|
...n
|
|
11067
11148
|
} });
|
|
11068
|
-
},
|
|
11149
|
+
}, dM = () => {
|
|
11069
11150
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11070
11151
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
11071
|
-
},
|
|
11152
|
+
}, fM = () => {
|
|
11072
11153
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11073
11154
|
n > 0 && M(n, 0);
|
|
11074
|
-
},
|
|
11155
|
+
}, pM = () => {
|
|
11075
11156
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
11076
11157
|
type: _.type,
|
|
11077
11158
|
content: _.content,
|
|
@@ -11081,7 +11162,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11081
11162
|
height: _.height,
|
|
11082
11163
|
style: _.style
|
|
11083
11164
|
});
|
|
11084
|
-
},
|
|
11165
|
+
}, mM = [
|
|
11085
11166
|
"#000000",
|
|
11086
11167
|
"#FFFFFF",
|
|
11087
11168
|
"#FF0000",
|
|
@@ -11091,8 +11172,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11091
11172
|
"#808080",
|
|
11092
11173
|
"#800080",
|
|
11093
11174
|
"transparent"
|
|
11094
|
-
],
|
|
11095
|
-
|
|
11175
|
+
], hM = (n, _) => {
|
|
11176
|
+
Xj({
|
|
11096
11177
|
open: !0,
|
|
11097
11178
|
prop: n,
|
|
11098
11179
|
value: _
|
|
@@ -11108,8 +11189,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11108
11189
|
direction: "column",
|
|
11109
11190
|
gap: "3",
|
|
11110
11191
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11111
|
-
value:
|
|
11112
|
-
onChange: (n) =>
|
|
11192
|
+
value: tM,
|
|
11193
|
+
onChange: (n) => nM(n.target.value),
|
|
11113
11194
|
placeholder: "Nome da camada..."
|
|
11114
11195
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11115
11196
|
gap: "3",
|
|
@@ -11120,7 +11201,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11120
11201
|
children: "Cancelar"
|
|
11121
11202
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11122
11203
|
onClick: () => {
|
|
11123
|
-
B(_.id,
|
|
11204
|
+
B(_.id, tM), G(!1);
|
|
11124
11205
|
},
|
|
11125
11206
|
children: "Salvar"
|
|
11126
11207
|
})]
|
|
@@ -11130,7 +11211,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11130
11211
|
}),
|
|
11131
11212
|
/* @__PURE__ */ jsx(s$4, {
|
|
11132
11213
|
open: Z,
|
|
11133
|
-
onOpenChange:
|
|
11214
|
+
onOpenChange: Lj,
|
|
11134
11215
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11135
11216
|
style: { maxWidth: 450 },
|
|
11136
11217
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11138,9 +11219,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11138
11219
|
gap: "3",
|
|
11139
11220
|
children: [
|
|
11140
11221
|
/* @__PURE__ */ jsx(r, {
|
|
11141
|
-
ref:
|
|
11142
|
-
value:
|
|
11143
|
-
onChange: (n) =>
|
|
11222
|
+
ref: sM,
|
|
11223
|
+
value: rM,
|
|
11224
|
+
onChange: (n) => iM(n.target.value),
|
|
11144
11225
|
placeholder: "Digite o novo texto...",
|
|
11145
11226
|
style: { height: 100 }
|
|
11146
11227
|
}),
|
|
@@ -11158,7 +11239,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11158
11239
|
color: "blue",
|
|
11159
11240
|
variant: "surface",
|
|
11160
11241
|
style: { cursor: "pointer" },
|
|
11161
|
-
onClick: () =>
|
|
11242
|
+
onClick: () => lM(n.dataName),
|
|
11162
11243
|
children: n.name
|
|
11163
11244
|
}, n.dataName))
|
|
11164
11245
|
})]
|
|
@@ -11172,7 +11253,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11172
11253
|
children: "Cancelar"
|
|
11173
11254
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11174
11255
|
onClick: () => {
|
|
11175
|
-
E(_.id, { content:
|
|
11256
|
+
E(_.id, { content: rM }), Lj(!1);
|
|
11176
11257
|
},
|
|
11177
11258
|
children: "Salvar"
|
|
11178
11259
|
})]
|
|
@@ -11182,8 +11263,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11182
11263
|
})
|
|
11183
11264
|
}),
|
|
11184
11265
|
/* @__PURE__ */ jsx(s$4, {
|
|
11185
|
-
open:
|
|
11186
|
-
onOpenChange:
|
|
11266
|
+
open: Rj,
|
|
11267
|
+
onOpenChange: zj,
|
|
11187
11268
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11188
11269
|
style: { maxWidth: 450 },
|
|
11189
11270
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11195,8 +11276,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11195
11276
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
11196
11277
|
}),
|
|
11197
11278
|
/* @__PURE__ */ jsx(u$1, {
|
|
11198
|
-
value:
|
|
11199
|
-
onChange: (n) =>
|
|
11279
|
+
value: aM,
|
|
11280
|
+
onChange: (n) => oM(n.target.value),
|
|
11200
11281
|
placeholder: "propriedade"
|
|
11201
11282
|
}),
|
|
11202
11283
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11208,8 +11289,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11208
11289
|
children: "Cancelar"
|
|
11209
11290
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11210
11291
|
onClick: () => {
|
|
11211
|
-
let n =
|
|
11212
|
-
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O),
|
|
11292
|
+
let n = aM, O = { dataBinding: n };
|
|
11293
|
+
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O), zj(!1);
|
|
11213
11294
|
},
|
|
11214
11295
|
children: "Vincular"
|
|
11215
11296
|
})]
|
|
@@ -11219,8 +11300,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11219
11300
|
})
|
|
11220
11301
|
}),
|
|
11221
11302
|
/* @__PURE__ */ jsx(s$4, {
|
|
11222
|
-
open:
|
|
11223
|
-
onOpenChange: (n) =>
|
|
11303
|
+
open: Yj.open,
|
|
11304
|
+
onOpenChange: (n) => Xj((_) => ({
|
|
11224
11305
|
..._,
|
|
11225
11306
|
open: n
|
|
11226
11307
|
})),
|
|
@@ -11229,8 +11310,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11229
11310
|
children: [
|
|
11230
11311
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
11231
11312
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
11232
|
-
color:
|
|
11233
|
-
onChange: (n) =>
|
|
11313
|
+
color: Yj.value,
|
|
11314
|
+
onChange: (n) => Xj((_) => ({
|
|
11234
11315
|
..._,
|
|
11235
11316
|
value: n
|
|
11236
11317
|
}))
|
|
@@ -11245,7 +11326,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11245
11326
|
children: "Cancelar"
|
|
11246
11327
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11247
11328
|
onClick: () => {
|
|
11248
|
-
|
|
11329
|
+
uM({ [Yj.prop]: Yj.value }), Xj((n) => ({
|
|
11249
11330
|
...n,
|
|
11250
11331
|
open: !1
|
|
11251
11332
|
}));
|
|
@@ -11258,13 +11339,42 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11258
11339
|
}),
|
|
11259
11340
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
11260
11341
|
elementId: _.id,
|
|
11261
|
-
open:
|
|
11262
|
-
onOpenChange:
|
|
11263
|
-
initialTab:
|
|
11342
|
+
open: Hj,
|
|
11343
|
+
onOpenChange: Uj,
|
|
11344
|
+
initialTab: Wj
|
|
11345
|
+
}),
|
|
11346
|
+
/* @__PURE__ */ jsx(s$4, {
|
|
11347
|
+
open: Zj,
|
|
11348
|
+
onOpenChange: Qj,
|
|
11349
|
+
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11350
|
+
style: { maxWidth: 450 },
|
|
11351
|
+
children: [/* @__PURE__ */ jsx(g$2, { children: "Inserir URL da Imagem" }), /* @__PURE__ */ jsxs(p$1, {
|
|
11352
|
+
direction: "column",
|
|
11353
|
+
gap: "3",
|
|
11354
|
+
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11355
|
+
value: $j,
|
|
11356
|
+
onChange: (n) => eM(n.target.value),
|
|
11357
|
+
placeholder: "https://exemplo.com/imagem.png"
|
|
11358
|
+
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11359
|
+
gap: "3",
|
|
11360
|
+
justify: "end",
|
|
11361
|
+
children: [/* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
11362
|
+
variant: "soft",
|
|
11363
|
+
color: "gray",
|
|
11364
|
+
children: "Cancelar"
|
|
11365
|
+
}) }), /* @__PURE__ */ jsx(o, {
|
|
11366
|
+
onClick: () => {
|
|
11367
|
+
E(_.id, { content: $j }), Qj(!1);
|
|
11368
|
+
},
|
|
11369
|
+
children: "Aplicar"
|
|
11370
|
+
})]
|
|
11371
|
+
})]
|
|
11372
|
+
})]
|
|
11373
|
+
})
|
|
11264
11374
|
}),
|
|
11265
11375
|
/* @__PURE__ */ jsx("input", {
|
|
11266
11376
|
type: "file",
|
|
11267
|
-
ref:
|
|
11377
|
+
ref: cM,
|
|
11268
11378
|
style: { display: "none" },
|
|
11269
11379
|
accept: "image/*",
|
|
11270
11380
|
onChange: (n) => {
|
|
@@ -11330,7 +11440,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11330
11440
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11331
11441
|
className: "ContextMenuItem",
|
|
11332
11442
|
onSelect: () => {
|
|
11333
|
-
|
|
11443
|
+
oM(_.dataBinding || ""), zj(!0);
|
|
11334
11444
|
},
|
|
11335
11445
|
children: "Outro / Manual..."
|
|
11336
11446
|
}),
|
|
@@ -11346,14 +11456,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11346
11456
|
_.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11347
11457
|
className: "ContextMenuItem",
|
|
11348
11458
|
onSelect: () => {
|
|
11349
|
-
|
|
11459
|
+
iM(_.content), Lj(!0);
|
|
11350
11460
|
},
|
|
11351
11461
|
children: "Editar Texto..."
|
|
11352
11462
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11353
11463
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11354
11464
|
className: "ContextMenuItem",
|
|
11355
11465
|
onSelect: () => {
|
|
11356
|
-
|
|
11466
|
+
nM(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11357
11467
|
},
|
|
11358
11468
|
children: "Renomear..."
|
|
11359
11469
|
}),
|
|
@@ -11370,13 +11480,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11370
11480
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11371
11481
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11372
11482
|
className: "ContextMenuItem",
|
|
11373
|
-
onSelect: () =>
|
|
11483
|
+
onSelect: () => Uj(!0),
|
|
11374
11484
|
children: "Configurações Avançadas..."
|
|
11375
11485
|
}),
|
|
11376
11486
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11377
11487
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11378
11488
|
className: "ContextMenuItem",
|
|
11379
|
-
onSelect:
|
|
11489
|
+
onSelect: pM,
|
|
11380
11490
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
11381
11491
|
}),
|
|
11382
11492
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11400,15 +11510,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11400
11510
|
alignOffset: -5,
|
|
11401
11511
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11402
11512
|
className: "ContextMenuItem",
|
|
11403
|
-
onSelect: () =>
|
|
11513
|
+
onSelect: () => cM.current?.click(),
|
|
11404
11514
|
children: "Carregar do Computador"
|
|
11405
11515
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11406
11516
|
className: "ContextMenuItem",
|
|
11407
11517
|
onSelect: () => {
|
|
11408
|
-
|
|
11409
|
-
let n = window.prompt("Insira a URL da imagem:", _.content);
|
|
11410
|
-
n !== null && E(_.id, { content: n });
|
|
11411
|
-
}, 10);
|
|
11518
|
+
eM(typeof _.content == "string" ? _.content : ""), Qj(!0);
|
|
11412
11519
|
},
|
|
11413
11520
|
children: "Inserir URL"
|
|
11414
11521
|
})]
|
|
@@ -11426,17 +11533,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11426
11533
|
children: [
|
|
11427
11534
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11428
11535
|
className: "ContextMenuItem",
|
|
11429
|
-
onSelect: () =>
|
|
11536
|
+
onSelect: () => uM({ objectFit: "cover" }),
|
|
11430
11537
|
children: "Preencher (Cover)"
|
|
11431
11538
|
}),
|
|
11432
11539
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11433
11540
|
className: "ContextMenuItem",
|
|
11434
|
-
onSelect: () =>
|
|
11541
|
+
onSelect: () => uM({ objectFit: "contain" }),
|
|
11435
11542
|
children: "Ajustar (Contain)"
|
|
11436
11543
|
}),
|
|
11437
11544
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11438
11545
|
className: "ContextMenuItem",
|
|
11439
|
-
onSelect: () =>
|
|
11546
|
+
onSelect: () => uM({ objectFit: "fill" }),
|
|
11440
11547
|
children: "Esticar (Fill)"
|
|
11441
11548
|
})
|
|
11442
11549
|
]
|
|
@@ -11455,11 +11562,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11455
11562
|
alignOffset: -5,
|
|
11456
11563
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11457
11564
|
className: "ContextMenuItem",
|
|
11458
|
-
onSelect:
|
|
11565
|
+
onSelect: dM,
|
|
11459
11566
|
children: "Trazer para frente"
|
|
11460
11567
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11461
11568
|
className: "ContextMenuItem",
|
|
11462
|
-
onSelect:
|
|
11569
|
+
onSelect: fM,
|
|
11463
11570
|
children: "Enviar para trás"
|
|
11464
11571
|
})]
|
|
11465
11572
|
}) })] }),
|
|
@@ -11477,7 +11584,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11477
11584
|
alignOffset: -5,
|
|
11478
11585
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11479
11586
|
className: "ContextMenuItem",
|
|
11480
|
-
onSelect: () =>
|
|
11587
|
+
onSelect: () => uM({ fontFamily: n }),
|
|
11481
11588
|
style: { fontFamily: n },
|
|
11482
11589
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
11483
11590
|
className: "RightSlot",
|
|
@@ -11506,7 +11613,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11506
11613
|
64
|
|
11507
11614
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11508
11615
|
className: "ContextMenuItem",
|
|
11509
|
-
onSelect: () =>
|
|
11616
|
+
onSelect: () => uM({ fontSize: `${n}px` }),
|
|
11510
11617
|
children: [n, "px"]
|
|
11511
11618
|
}, n))
|
|
11512
11619
|
}) })] }),
|
|
@@ -11521,9 +11628,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11521
11628
|
sideOffset: 2,
|
|
11522
11629
|
alignOffset: -5,
|
|
11523
11630
|
children: [
|
|
11524
|
-
|
|
11631
|
+
mM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11525
11632
|
className: "ContextMenuItem",
|
|
11526
|
-
onSelect: () =>
|
|
11633
|
+
onSelect: () => uM({ color: n }),
|
|
11527
11634
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11528
11635
|
width: 12,
|
|
11529
11636
|
height: 12,
|
|
@@ -11535,7 +11642,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11535
11642
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11536
11643
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11537
11644
|
className: "ContextMenuItem",
|
|
11538
|
-
onSelect: () =>
|
|
11645
|
+
onSelect: () => hM("color", _.style?.color || "#000000"),
|
|
11539
11646
|
children: "Outra Cor..."
|
|
11540
11647
|
})
|
|
11541
11648
|
]
|
|
@@ -11552,11 +11659,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11552
11659
|
alignOffset: -5,
|
|
11553
11660
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11554
11661
|
className: "ContextMenuItem",
|
|
11555
|
-
onSelect: () =>
|
|
11662
|
+
onSelect: () => uM({ fontWeight: "normal" }),
|
|
11556
11663
|
children: "Normal"
|
|
11557
11664
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11558
11665
|
className: "ContextMenuItem",
|
|
11559
|
-
onSelect: () =>
|
|
11666
|
+
onSelect: () => uM({ fontWeight: "bold" }),
|
|
11560
11667
|
children: "Negrito"
|
|
11561
11668
|
})]
|
|
11562
11669
|
}) })] }),
|
|
@@ -11573,17 +11680,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11573
11680
|
children: [
|
|
11574
11681
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11575
11682
|
className: "ContextMenuItem",
|
|
11576
|
-
onSelect: () =>
|
|
11683
|
+
onSelect: () => uM({ textAlign: "left" }),
|
|
11577
11684
|
children: "Esquerda"
|
|
11578
11685
|
}),
|
|
11579
11686
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11580
11687
|
className: "ContextMenuItem",
|
|
11581
|
-
onSelect: () =>
|
|
11688
|
+
onSelect: () => uM({ textAlign: "center" }),
|
|
11582
11689
|
children: "Centro"
|
|
11583
11690
|
}),
|
|
11584
11691
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11585
11692
|
className: "ContextMenuItem",
|
|
11586
|
-
onSelect: () =>
|
|
11693
|
+
onSelect: () => uM({ textAlign: "right" }),
|
|
11587
11694
|
children: "Direita"
|
|
11588
11695
|
})
|
|
11589
11696
|
]
|
|
@@ -11601,7 +11708,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11601
11708
|
children: [
|
|
11602
11709
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11603
11710
|
className: "ContextMenuItem",
|
|
11604
|
-
onSelect: () =>
|
|
11711
|
+
onSelect: () => uM({
|
|
11605
11712
|
display: "flex",
|
|
11606
11713
|
flexDirection: "column",
|
|
11607
11714
|
justifyContent: "flex-start"
|
|
@@ -11610,7 +11717,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11610
11717
|
}),
|
|
11611
11718
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11612
11719
|
className: "ContextMenuItem",
|
|
11613
|
-
onSelect: () =>
|
|
11720
|
+
onSelect: () => uM({
|
|
11614
11721
|
display: "flex",
|
|
11615
11722
|
flexDirection: "column",
|
|
11616
11723
|
justifyContent: "center"
|
|
@@ -11619,7 +11726,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11619
11726
|
}),
|
|
11620
11727
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11621
11728
|
className: "ContextMenuItem",
|
|
11622
|
-
onSelect: () =>
|
|
11729
|
+
onSelect: () => uM({
|
|
11623
11730
|
display: "flex",
|
|
11624
11731
|
flexDirection: "column",
|
|
11625
11732
|
justifyContent: "flex-end"
|
|
@@ -11640,9 +11747,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11640
11747
|
sideOffset: 2,
|
|
11641
11748
|
alignOffset: -5,
|
|
11642
11749
|
children: [
|
|
11643
|
-
|
|
11750
|
+
mM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11644
11751
|
className: "ContextMenuItem",
|
|
11645
|
-
onSelect: () =>
|
|
11752
|
+
onSelect: () => uM({ backgroundColor: n }),
|
|
11646
11753
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11647
11754
|
width: 12,
|
|
11648
11755
|
height: 12,
|
|
@@ -11654,7 +11761,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11654
11761
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11655
11762
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11656
11763
|
className: "ContextMenuItem",
|
|
11657
|
-
onSelect: () =>
|
|
11764
|
+
onSelect: () => hM("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
11658
11765
|
children: "Outra Cor..."
|
|
11659
11766
|
})
|
|
11660
11767
|
]
|
|
@@ -11680,14 +11787,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11680
11787
|
"50%"
|
|
11681
11788
|
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
11682
11789
|
className: "ContextMenuItem",
|
|
11683
|
-
onSelect: () =>
|
|
11790
|
+
onSelect: () => uM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
11684
11791
|
children: n === "50%" ? "Círculo" : `${n}px`
|
|
11685
11792
|
}, n)),
|
|
11686
11793
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11687
11794
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11688
11795
|
className: "ContextMenuItem",
|
|
11689
11796
|
onSelect: () => {
|
|
11690
|
-
|
|
11797
|
+
Jj("style"), Uj(!0);
|
|
11691
11798
|
},
|
|
11692
11799
|
children: "Personalizar..."
|
|
11693
11800
|
})
|
|
@@ -11714,14 +11821,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11714
11821
|
32
|
|
11715
11822
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11716
11823
|
className: "ContextMenuItem",
|
|
11717
|
-
onSelect: () =>
|
|
11824
|
+
onSelect: () => uM({ padding: `${n}px` }),
|
|
11718
11825
|
children: [n, "px"]
|
|
11719
11826
|
}, n)),
|
|
11720
11827
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11721
11828
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11722
11829
|
className: "ContextMenuItem",
|
|
11723
11830
|
onSelect: () => {
|
|
11724
|
-
|
|
11831
|
+
Jj("style"), Uj(!0);
|
|
11725
11832
|
},
|
|
11726
11833
|
children: "Personalizar..."
|
|
11727
11834
|
})
|
|
@@ -11731,85 +11838,85 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11731
11838
|
}) })] })
|
|
11732
11839
|
] });
|
|
11733
11840
|
}, DraggableElement = React.memo(({ element: n, isSelected: _ }) => {
|
|
11734
|
-
let { selectElement: E, updateElement: O, updateElements: A, state: j } = useEditor(), [
|
|
11841
|
+
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M } = useEditor(), [N, P] = useState(!1), [z, B] = useState(!1), H = useRef({
|
|
11735
11842
|
x: 0,
|
|
11736
11843
|
y: 0
|
|
11737
|
-
}),
|
|
11844
|
+
}), U = useRef({}), G = useRef(!1), Z = useRef(!1), Lj = useRef(0), Rj = useRef(0), zj = useRef({
|
|
11738
11845
|
x: 0,
|
|
11739
11846
|
y: 0
|
|
11740
|
-
}), Hj = j.canvasHeight || 150,
|
|
11741
|
-
if (
|
|
11742
|
-
if (n.type === "text")
|
|
11743
|
-
let O =
|
|
11847
|
+
}), Hj = useRef(!1), Uj = j.canvasHeight || 150, Wj = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, Gj = n.content, Jj = {};
|
|
11848
|
+
if (Wj) {
|
|
11849
|
+
if (n.type === "text") Gj = Gj.replace(/\{\{(.*?)\}\}/g, (_, E) => {
|
|
11850
|
+
let O = Wj[E.trim()];
|
|
11744
11851
|
return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
|
|
11745
11852
|
});
|
|
11746
11853
|
else if (n.type === "image") if (n.dataBinding) {
|
|
11747
|
-
let _ =
|
|
11748
|
-
_ != null && (
|
|
11749
|
-
} else
|
|
11750
|
-
let E =
|
|
11854
|
+
let _ = Wj[n.dataBinding];
|
|
11855
|
+
_ != null && (Gj = String(_));
|
|
11856
|
+
} else Gj = Gj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
11857
|
+
let E = Wj[_.trim()];
|
|
11751
11858
|
return E == null ? n : String(E);
|
|
11752
11859
|
});
|
|
11753
11860
|
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
11754
|
-
let E =
|
|
11755
|
-
E != null && (
|
|
11756
|
-
...
|
|
11861
|
+
let E = Wj[_];
|
|
11862
|
+
E != null && (Jj = {
|
|
11863
|
+
...Jj,
|
|
11757
11864
|
[n]: String(E)
|
|
11758
11865
|
});
|
|
11759
11866
|
}), n.conditions && n.conditions.forEach((n) => {
|
|
11760
|
-
let _ =
|
|
11761
|
-
checkCondition(_, n.operator, n.value) && (
|
|
11762
|
-
...
|
|
11867
|
+
let _ = Wj[n.property];
|
|
11868
|
+
checkCondition(_, n.operator, n.value) && (Jj = {
|
|
11869
|
+
...Jj,
|
|
11763
11870
|
...n.style
|
|
11764
11871
|
});
|
|
11765
11872
|
});
|
|
11766
11873
|
}
|
|
11767
|
-
let
|
|
11768
|
-
if (
|
|
11769
|
-
let { display: n, ..._ } =
|
|
11770
|
-
|
|
11874
|
+
let Yj = Jj.display === "none";
|
|
11875
|
+
if (Yj && _) {
|
|
11876
|
+
let { display: n, ..._ } = Jj;
|
|
11877
|
+
Jj = _;
|
|
11771
11878
|
}
|
|
11772
|
-
let
|
|
11773
|
-
_.stopPropagation(), !
|
|
11774
|
-
},
|
|
11879
|
+
let Xj = (_) => {
|
|
11880
|
+
_.stopPropagation(), !G.current && !Z.current && !N && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
11881
|
+
}, Zj = (O) => {
|
|
11775
11882
|
if (O.button !== 0) return;
|
|
11776
11883
|
O.stopPropagation();
|
|
11777
11884
|
let A = O.shiftKey;
|
|
11778
|
-
if (
|
|
11885
|
+
if (G.current = !1, Z.current = !1, n.groupId && !_) {
|
|
11779
11886
|
E(n.groupId, A);
|
|
11780
11887
|
return;
|
|
11781
11888
|
}
|
|
11782
|
-
_ || (E(n.id, A),
|
|
11889
|
+
_ || (E(n.id, A), Z.current = !0), P(!0), H.current = {
|
|
11783
11890
|
x: O.clientX,
|
|
11784
11891
|
y: O.clientY
|
|
11785
11892
|
};
|
|
11786
11893
|
let M = new Set(j.selectedElementIds);
|
|
11787
11894
|
_ || (A || M.clear(), M.add(n.id));
|
|
11788
|
-
let
|
|
11895
|
+
let N = {};
|
|
11789
11896
|
j.elements.forEach((n) => {
|
|
11790
|
-
M.has(n.id) && (
|
|
11897
|
+
M.has(n.id) && (N[n.id] = {
|
|
11791
11898
|
x: n.x,
|
|
11792
11899
|
y: n.y
|
|
11793
11900
|
});
|
|
11794
|
-
}),
|
|
11795
|
-
},
|
|
11796
|
-
_.stopPropagation(), _.preventDefault(),
|
|
11901
|
+
}), U.current = N;
|
|
11902
|
+
}, Qj = (_) => {
|
|
11903
|
+
_.stopPropagation(), _.preventDefault(), B(!0);
|
|
11797
11904
|
let E = _.target.closest(".resizable-element");
|
|
11798
11905
|
if (E) {
|
|
11799
11906
|
let O = E.getBoundingClientRect();
|
|
11800
|
-
|
|
11907
|
+
zj.current = {
|
|
11801
11908
|
x: O.left + O.width / 2,
|
|
11802
11909
|
y: O.top + O.height / 2
|
|
11803
11910
|
};
|
|
11804
|
-
let A = _.clientX -
|
|
11805
|
-
|
|
11911
|
+
let A = _.clientX - zj.current.x, j = _.clientY - zj.current.y;
|
|
11912
|
+
Lj.current = Math.atan2(j, A) * (180 / Math.PI), Rj.current = n.rotation || 0;
|
|
11806
11913
|
}
|
|
11807
11914
|
};
|
|
11808
11915
|
useEffect(() => {
|
|
11809
11916
|
let _ = (_) => {
|
|
11810
|
-
if (
|
|
11811
|
-
let n = _.clientX -
|
|
11812
|
-
(Math.abs(n) > 2 || Math.abs(E) > 2) && (
|
|
11917
|
+
if (N) {
|
|
11918
|
+
let n = _.clientX - H.current.x, E = _.clientY - H.current.y;
|
|
11919
|
+
(Math.abs(n) > 2 || Math.abs(E) > 2) && (G.current = !0), A(Object.entries(U.current).map(([_, O]) => {
|
|
11813
11920
|
let A = O.x + n, M = O.y + E;
|
|
11814
11921
|
return j.gridSize > 0 && (A = Math.round(A / j.gridSize) * j.gridSize, M = Math.round(M / j.gridSize) * j.gridSize), j.isList && (M = Math.max(0, M)), {
|
|
11815
11922
|
id: _,
|
|
@@ -11820,26 +11927,26 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11820
11927
|
};
|
|
11821
11928
|
}), !1);
|
|
11822
11929
|
}
|
|
11823
|
-
if (
|
|
11824
|
-
let E = _.clientX -
|
|
11930
|
+
if (z) {
|
|
11931
|
+
let E = _.clientX - zj.current.x, A = _.clientY - zj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Lj.current, M = (Rj.current + j) % 360;
|
|
11825
11932
|
O(n.id, { rotation: M }, !1);
|
|
11826
11933
|
}
|
|
11827
11934
|
}, E = () => {
|
|
11828
|
-
|
|
11935
|
+
N && (P(!1), A([], !0)), z && (B(!1), O(n.id, { rotation: n.rotation }, !0));
|
|
11829
11936
|
};
|
|
11830
|
-
return (
|
|
11937
|
+
return (N || z) && (window.addEventListener("mousemove", _), window.addEventListener("mouseup", E)), () => {
|
|
11831
11938
|
window.removeEventListener("mousemove", _), window.removeEventListener("mouseup", E);
|
|
11832
11939
|
};
|
|
11833
11940
|
}, [
|
|
11834
|
-
|
|
11835
|
-
|
|
11941
|
+
N,
|
|
11942
|
+
z,
|
|
11836
11943
|
n.id,
|
|
11837
11944
|
O,
|
|
11838
11945
|
A,
|
|
11839
11946
|
j.isList,
|
|
11840
11947
|
j.selectedElementIds
|
|
11841
11948
|
]);
|
|
11842
|
-
let
|
|
11949
|
+
let $j = {
|
|
11843
11950
|
position: "absolute",
|
|
11844
11951
|
left: 0,
|
|
11845
11952
|
top: 0,
|
|
@@ -11849,14 +11956,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11849
11956
|
padding: n.type === "image" || n.type === "text" ? 0 : "8px",
|
|
11850
11957
|
border: _ ? "2px solid var(--accent-9)" : "1px dashed transparent",
|
|
11851
11958
|
outline: _ ? "none" : "1px solid transparent",
|
|
11852
|
-
cursor:
|
|
11959
|
+
cursor: N ? "grabbing" : "grab",
|
|
11853
11960
|
borderRadius: "var(--radius-2)",
|
|
11854
11961
|
overflow: n.autoGrow ? "visible" : "hidden",
|
|
11855
11962
|
whiteSpace: n.autoGrow ? "pre-wrap" : void 0,
|
|
11856
11963
|
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
11857
11964
|
userSelect: "none",
|
|
11858
11965
|
...n.style,
|
|
11859
|
-
...
|
|
11966
|
+
...Jj
|
|
11860
11967
|
};
|
|
11861
11968
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
11862
11969
|
className: "resizable-element",
|
|
@@ -11864,20 +11971,23 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11864
11971
|
width: n.width ?? 100,
|
|
11865
11972
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
11866
11973
|
},
|
|
11867
|
-
maxHeight: j.isList ? Math.max(10,
|
|
11974
|
+
maxHeight: j.isList ? Math.max(10, Uj - n.y) : void 0,
|
|
11975
|
+
onResizeStart: (n) => {
|
|
11976
|
+
Hj.current = !!n.shiftKey;
|
|
11977
|
+
},
|
|
11868
11978
|
onResizeStop: (_, E, A, j) => {
|
|
11869
|
-
let
|
|
11870
|
-
O(n.id, {
|
|
11871
|
-
width:
|
|
11872
|
-
height:
|
|
11979
|
+
let N = (n.width ?? 100) + j.width, P = (n.height ?? 100) + j.height;
|
|
11980
|
+
n.type === "group" ? M(n.id, N, P) : O(n.id, {
|
|
11981
|
+
width: N,
|
|
11982
|
+
height: P
|
|
11873
11983
|
});
|
|
11874
11984
|
},
|
|
11875
11985
|
style: {
|
|
11876
11986
|
position: "absolute",
|
|
11877
11987
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
11878
11988
|
height: n.autoGrow ? "auto" : void 0,
|
|
11879
|
-
display:
|
|
11880
|
-
opacity:
|
|
11989
|
+
display: Yj && !_ ? "none" : void 0,
|
|
11990
|
+
opacity: Yj && _ ? .4 : 1
|
|
11881
11991
|
},
|
|
11882
11992
|
enable: _ && !n.autoGrow ? void 0 : {
|
|
11883
11993
|
top: !1,
|
|
@@ -11889,6 +11999,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11889
11999
|
bottomLeft: !1,
|
|
11890
12000
|
topLeft: !1
|
|
11891
12001
|
},
|
|
12002
|
+
lockAspectRatio: Hj.current === !0,
|
|
11892
12003
|
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
11893
12004
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
11894
12005
|
element: n,
|
|
@@ -11899,9 +12010,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11899
12010
|
position: "relative"
|
|
11900
12011
|
},
|
|
11901
12012
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
11902
|
-
style:
|
|
11903
|
-
onMouseDown:
|
|
11904
|
-
onClick:
|
|
12013
|
+
style: $j,
|
|
12014
|
+
onMouseDown: Zj,
|
|
12015
|
+
onClick: Xj,
|
|
11905
12016
|
title: n.name,
|
|
11906
12017
|
onMouseEnter: (n) => {
|
|
11907
12018
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
@@ -11915,10 +12026,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11915
12026
|
width: "100%",
|
|
11916
12027
|
height: "100%"
|
|
11917
12028
|
},
|
|
11918
|
-
children:
|
|
12029
|
+
children: Gj
|
|
11919
12030
|
}),
|
|
11920
|
-
n.type === "image" && (
|
|
11921
|
-
src:
|
|
12031
|
+
n.type === "image" && (Gj ? /* @__PURE__ */ jsx("img", {
|
|
12032
|
+
src: Gj,
|
|
11922
12033
|
alt: "Element",
|
|
11923
12034
|
style: {
|
|
11924
12035
|
width: "100%",
|
|
@@ -11983,7 +12094,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11983
12094
|
zIndex: 50,
|
|
11984
12095
|
boxShadow: "0 0 0 2px white"
|
|
11985
12096
|
},
|
|
11986
|
-
onMouseDown:
|
|
12097
|
+
onMouseDown: Qj,
|
|
11987
12098
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
11988
12099
|
position: "absolute",
|
|
11989
12100
|
top: 12,
|
|
@@ -12030,21 +12141,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12030
12141
|
useEffect(() => () => {
|
|
12031
12142
|
window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", G);
|
|
12032
12143
|
}, [U, G]);
|
|
12033
|
-
let Z = useRef(!1), { setCanvasHeight:
|
|
12034
|
-
n.stopPropagation(), n.preventDefault(), Z.current = !0, window.addEventListener("mousemove",
|
|
12035
|
-
},
|
|
12144
|
+
let Z = useRef(!1), { setCanvasHeight: Lj } = useEditor(), Rj = (n) => {
|
|
12145
|
+
n.stopPropagation(), n.preventDefault(), Z.current = !0, window.addEventListener("mousemove", zj), window.addEventListener("mouseup", Hj);
|
|
12146
|
+
}, zj = useCallback((n) => {
|
|
12036
12147
|
if (!Z.current || !A.current) return;
|
|
12037
12148
|
let _ = A.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12038
|
-
|
|
12039
|
-
}, [
|
|
12040
|
-
Z.current = !1, window.removeEventListener("mousemove",
|
|
12041
|
-
}, [
|
|
12149
|
+
Lj(Math.round(O));
|
|
12150
|
+
}, [Lj]), Hj = useCallback(() => {
|
|
12151
|
+
Z.current = !1, window.removeEventListener("mousemove", zj), window.removeEventListener("mouseup", Hj);
|
|
12152
|
+
}, [zj]);
|
|
12042
12153
|
useEffect(() => () => {
|
|
12043
|
-
window.removeEventListener("mousemove",
|
|
12044
|
-
}, [
|
|
12045
|
-
let
|
|
12154
|
+
window.removeEventListener("mousemove", zj), window.removeEventListener("mouseup", Hj);
|
|
12155
|
+
}, [zj, Hj]);
|
|
12156
|
+
let Uj = (n) => {
|
|
12046
12157
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12047
|
-
},
|
|
12158
|
+
}, Wj = (n) => {
|
|
12048
12159
|
n.preventDefault();
|
|
12049
12160
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
12050
12161
|
if (_) {
|
|
@@ -12059,12 +12170,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12059
12170
|
dataBinding: _
|
|
12060
12171
|
});
|
|
12061
12172
|
}
|
|
12062
|
-
},
|
|
12173
|
+
}, Gj = n.canvasHeight || 150;
|
|
12063
12174
|
return /* @__PURE__ */ jsxs(p, {
|
|
12064
12175
|
ref: A,
|
|
12065
12176
|
onMouseDown: B,
|
|
12066
|
-
onDragOver:
|
|
12067
|
-
onDrop:
|
|
12177
|
+
onDragOver: Uj,
|
|
12178
|
+
onDrop: Wj,
|
|
12068
12179
|
style: {
|
|
12069
12180
|
width: "100%",
|
|
12070
12181
|
height: "100%",
|
|
@@ -12089,7 +12200,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12089
12200
|
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
12090
12201
|
style: {
|
|
12091
12202
|
position: "absolute",
|
|
12092
|
-
top:
|
|
12203
|
+
top: Gj,
|
|
12093
12204
|
left: 0,
|
|
12094
12205
|
right: 0,
|
|
12095
12206
|
height: "10px",
|
|
@@ -12101,7 +12212,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12101
12212
|
justifyContent: "center",
|
|
12102
12213
|
group: "resize-handle"
|
|
12103
12214
|
},
|
|
12104
|
-
onMouseDown:
|
|
12215
|
+
onMouseDown: Rj,
|
|
12105
12216
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12106
12217
|
width: "100%",
|
|
12107
12218
|
height: "2px",
|
|
@@ -12125,7 +12236,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12125
12236
|
},
|
|
12126
12237
|
children: [
|
|
12127
12238
|
"Altura do Item: ",
|
|
12128
|
-
|
|
12239
|
+
Gj,
|
|
12129
12240
|
"px"
|
|
12130
12241
|
]
|
|
12131
12242
|
})]
|
|
@@ -12147,22 +12258,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12147
12258
|
]
|
|
12148
12259
|
});
|
|
12149
12260
|
}, EditorSettings = () => {
|
|
12150
|
-
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, G] = useState("down"), [Z,
|
|
12261
|
+
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, G] = useState("down"), [Z, Lj] = useState("150"), [Rj, zj] = useState(""), [Bj, Hj] = useState("0"), [Uj, Wj] = useState("slideIn"), [Gj, Jj] = useState(.3), [Yj, Xj] = useState("ease-out");
|
|
12151
12262
|
return useEffect(() => {
|
|
12152
12263
|
if (A) {
|
|
12153
|
-
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"),
|
|
12264
|
+
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"), zj(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), Lj(String(n.canvasHeight || 150)), Hj(String(n.gridSize || 0));
|
|
12154
12265
|
let _ = n.listSettings.entryAnimation;
|
|
12155
|
-
|
|
12266
|
+
Wj(_?.type || "slideIn"), Jj(_?.duration || .3), Xj(_?.timingFunction || "ease-out");
|
|
12156
12267
|
}
|
|
12157
12268
|
}, [A]), useEffect(() => {
|
|
12158
12269
|
if (!A) return;
|
|
12159
12270
|
let _ = parseInt(Z, 10);
|
|
12160
12271
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
12161
|
-
let j = parseInt(
|
|
12272
|
+
let j = parseInt(Bj, 10);
|
|
12162
12273
|
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
12163
12274
|
}, [
|
|
12164
12275
|
Z,
|
|
12165
|
-
|
|
12276
|
+
Bj,
|
|
12166
12277
|
A,
|
|
12167
12278
|
E,
|
|
12168
12279
|
O,
|
|
@@ -12341,7 +12452,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12341
12452
|
type: "number",
|
|
12342
12453
|
min: "10",
|
|
12343
12454
|
value: Z,
|
|
12344
|
-
onChange: (n) =>
|
|
12455
|
+
onChange: (n) => Lj(n.target.value)
|
|
12345
12456
|
}),
|
|
12346
12457
|
/* @__PURE__ */ jsx(p$2, {
|
|
12347
12458
|
size: "1",
|
|
@@ -12362,8 +12473,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12362
12473
|
type: "number",
|
|
12363
12474
|
min: "0",
|
|
12364
12475
|
placeholder: "Auto (100%)",
|
|
12365
|
-
value:
|
|
12366
|
-
onChange: (n) =>
|
|
12476
|
+
value: Rj,
|
|
12477
|
+
onChange: (n) => zj(n.target.value)
|
|
12367
12478
|
}),
|
|
12368
12479
|
/* @__PURE__ */ jsx(p$2, {
|
|
12369
12480
|
size: "1",
|
|
@@ -12389,8 +12500,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12389
12500
|
as: "div",
|
|
12390
12501
|
children: "Efeito"
|
|
12391
12502
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12392
|
-
value:
|
|
12393
|
-
onChange: (n) =>
|
|
12503
|
+
value: Uj,
|
|
12504
|
+
onChange: (n) => Wj(n.target.value),
|
|
12394
12505
|
style: {
|
|
12395
12506
|
width: "100%",
|
|
12396
12507
|
padding: "6px",
|
|
@@ -12452,8 +12563,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12452
12563
|
type: "number",
|
|
12453
12564
|
step: "0.1",
|
|
12454
12565
|
min: "0.1",
|
|
12455
|
-
value:
|
|
12456
|
-
onChange: (n) =>
|
|
12566
|
+
value: Gj,
|
|
12567
|
+
onChange: (n) => Jj(parseFloat(n.target.value) || .3)
|
|
12457
12568
|
})] }),
|
|
12458
12569
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
12459
12570
|
size: "1",
|
|
@@ -12461,8 +12572,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12461
12572
|
as: "div",
|
|
12462
12573
|
children: "Curva (Easing)"
|
|
12463
12574
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12464
|
-
value:
|
|
12465
|
-
onChange: (n) =>
|
|
12575
|
+
value: Yj,
|
|
12576
|
+
onChange: (n) => Xj(n.target.value),
|
|
12466
12577
|
style: {
|
|
12467
12578
|
width: "100%",
|
|
12468
12579
|
padding: "6px",
|
|
@@ -12517,8 +12628,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12517
12628
|
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
12518
12629
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
12519
12630
|
type: "number",
|
|
12520
|
-
value:
|
|
12521
|
-
onChange: (n) =>
|
|
12631
|
+
value: Bj,
|
|
12632
|
+
onChange: (n) => Hj(n.target.value),
|
|
12522
12633
|
placeholder: "0"
|
|
12523
12634
|
})]
|
|
12524
12635
|
})
|
|
@@ -12537,11 +12648,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12537
12648
|
children: "Cancelar"
|
|
12538
12649
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
12539
12650
|
onClick: () => {
|
|
12540
|
-
let n = parseInt(
|
|
12541
|
-
type:
|
|
12542
|
-
duration: Number(
|
|
12651
|
+
let n = parseInt(Rj, 10), E = {
|
|
12652
|
+
type: Uj,
|
|
12653
|
+
duration: Number(Gj),
|
|
12543
12654
|
delay: 0,
|
|
12544
|
-
timingFunction:
|
|
12655
|
+
timingFunction: Yj
|
|
12545
12656
|
};
|
|
12546
12657
|
_({
|
|
12547
12658
|
sortProp: M === "__none__" ? "" : M,
|
|
@@ -12705,13 +12816,13 @@ function createRenderBatcher(n, _) {
|
|
|
12705
12816
|
}, 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 = () => {
|
|
12706
12817
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
12707
12818
|
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));
|
|
12708
|
-
},
|
|
12819
|
+
}, Lj = () => {
|
|
12709
12820
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
12710
12821
|
};
|
|
12711
12822
|
return {
|
|
12712
12823
|
schedule: stepsOrder.reduce((n, _) => {
|
|
12713
12824
|
let O = M[_];
|
|
12714
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
12825
|
+
return n[_] = (n, _ = !1, A = !1) => (E || Lj(), O.schedule(n, _, A)), n;
|
|
12715
12826
|
}, {}),
|
|
12716
12827
|
cancel: (n) => {
|
|
12717
12828
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -13069,40 +13180,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
13069
13180
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
13070
13181
|
...E,
|
|
13071
13182
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
13072
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
13073
|
-
O ||=
|
|
13074
|
-
let
|
|
13183
|
+
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Lj = M - j, Rj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), zj = Math.abs(Lj) < 5;
|
|
13184
|
+
O ||= zj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= zj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
13185
|
+
let Bj;
|
|
13075
13186
|
if (Z < 1) {
|
|
13076
|
-
let n = calcAngularFreq(
|
|
13077
|
-
|
|
13078
|
-
} else if (Z === 1)
|
|
13187
|
+
let n = calcAngularFreq(Rj, Z);
|
|
13188
|
+
Bj = (_) => M - Math.exp(-Z * Rj * _) * ((G + Z * Rj * Lj) / n * Math.sin(n * _) + Lj * Math.cos(n * _));
|
|
13189
|
+
} else if (Z === 1) Bj = (n) => M - Math.exp(-Rj * n) * (Lj + (G + Rj * Lj) * n);
|
|
13079
13190
|
else {
|
|
13080
|
-
let n =
|
|
13081
|
-
|
|
13082
|
-
let E = Math.exp(-Z *
|
|
13083
|
-
return M - E * ((G + Z *
|
|
13191
|
+
let n = Rj * Math.sqrt(Z * Z - 1);
|
|
13192
|
+
Bj = (_) => {
|
|
13193
|
+
let E = Math.exp(-Z * Rj * _), O = Math.min(n * _, 300);
|
|
13194
|
+
return M - E * ((G + Z * Rj * Lj) * Math.sinh(O) + n * Lj * Math.cosh(O)) / n;
|
|
13084
13195
|
};
|
|
13085
13196
|
}
|
|
13086
|
-
let
|
|
13197
|
+
let Vj = {
|
|
13087
13198
|
calculatedDuration: W && H || null,
|
|
13088
13199
|
next: (n) => {
|
|
13089
|
-
let _ =
|
|
13200
|
+
let _ = Bj(n);
|
|
13090
13201
|
if (W) N.done = n >= H;
|
|
13091
13202
|
else {
|
|
13092
13203
|
let E = n === 0 ? G : 0;
|
|
13093
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
13204
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Bj, n, _));
|
|
13094
13205
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
13095
13206
|
N.done = j && P;
|
|
13096
13207
|
}
|
|
13097
13208
|
return N.value = N.done ? M : _, N;
|
|
13098
13209
|
},
|
|
13099
13210
|
toString: () => {
|
|
13100
|
-
let n = Math.min(calcGeneratorDuration(
|
|
13211
|
+
let n = Math.min(calcGeneratorDuration(Vj), maxGeneratorDuration), _ = generateLinearEasing((_) => Vj.next(n * _).value, n, 30);
|
|
13101
13212
|
return n + "ms " + _;
|
|
13102
13213
|
},
|
|
13103
13214
|
toTransition: () => {}
|
|
13104
13215
|
};
|
|
13105
|
-
return
|
|
13216
|
+
return Vj;
|
|
13106
13217
|
}
|
|
13107
13218
|
spring.applyToOptions = (n) => {
|
|
13108
13219
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -13112,26 +13223,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
13112
13223
|
let H = n[0], U = {
|
|
13113
13224
|
done: !1,
|
|
13114
13225
|
value: H
|
|
13115
|
-
}, 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 * _,
|
|
13116
|
-
|
|
13117
|
-
let
|
|
13118
|
-
let _ =
|
|
13119
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
13120
|
-
},
|
|
13121
|
-
W(U.value) && (
|
|
13226
|
+
}, 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 * _, Lj = H + Z, Rj = M === void 0 ? Lj : M(Lj);
|
|
13227
|
+
Rj !== Lj && (Z = Rj - H);
|
|
13228
|
+
let zj = (n) => -Z * Math.exp(-n / O), Bj = (n) => Rj + zj(n), Vj = (n) => {
|
|
13229
|
+
let _ = zj(n), E = Bj(n);
|
|
13230
|
+
U.done = Math.abs(_) <= z, U.value = U.done ? Rj : E;
|
|
13231
|
+
}, Hj, Uj, Wj = (n) => {
|
|
13232
|
+
W(U.value) && (Hj = n, Uj = spring({
|
|
13122
13233
|
keyframes: [U.value, G(U.value)],
|
|
13123
|
-
velocity: calcGeneratorVelocity(
|
|
13234
|
+
velocity: calcGeneratorVelocity(Bj, n, U.value),
|
|
13124
13235
|
damping: A,
|
|
13125
13236
|
stiffness: j,
|
|
13126
13237
|
restDelta: z,
|
|
13127
13238
|
restSpeed: B
|
|
13128
13239
|
}));
|
|
13129
13240
|
};
|
|
13130
|
-
return
|
|
13241
|
+
return Wj(0), {
|
|
13131
13242
|
calculatedDuration: null,
|
|
13132
13243
|
next: (n) => {
|
|
13133
13244
|
let _ = !1;
|
|
13134
|
-
return !
|
|
13245
|
+
return !Uj && Hj === void 0 && (_ = !0, Vj(n), Wj(n)), Hj !== void 0 && n >= Hj ? Uj.next(n - Hj) : (!_ && Vj(n), U);
|
|
13135
13246
|
}
|
|
13136
13247
|
};
|
|
13137
13248
|
}
|
|
@@ -13251,22 +13362,22 @@ var WithPromise = class {
|
|
|
13251
13362
|
if (this.startTime === null) return E.next(0);
|
|
13252
13363
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
13253
13364
|
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);
|
|
13254
|
-
let
|
|
13255
|
-
this.currentTime = Math.max(
|
|
13256
|
-
let
|
|
13365
|
+
let Lj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), Rj = this.playbackSpeed >= 0 ? Lj < 0 : Lj > O;
|
|
13366
|
+
this.currentTime = Math.max(Lj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
|
|
13367
|
+
let zj = this.currentTime, Bj = E;
|
|
13257
13368
|
if (B) {
|
|
13258
13369
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
13259
|
-
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (
|
|
13370
|
+
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Bj = j)), zj = clamp(0, 1, E) * M;
|
|
13260
13371
|
}
|
|
13261
|
-
let
|
|
13372
|
+
let Vj = Rj ? {
|
|
13262
13373
|
done: !1,
|
|
13263
13374
|
value: z[0]
|
|
13264
|
-
} :
|
|
13265
|
-
A && (
|
|
13266
|
-
let { done:
|
|
13267
|
-
!
|
|
13268
|
-
let
|
|
13269
|
-
return
|
|
13375
|
+
} : Bj.next(zj);
|
|
13376
|
+
A && (Vj.value = A(Vj.value));
|
|
13377
|
+
let { done: Hj } = Vj;
|
|
13378
|
+
!Rj && N !== null && (Hj = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
|
|
13379
|
+
let Uj = this.holdTime === null && (this.state === "finished" || this.state === "running" && Hj);
|
|
13380
|
+
return Uj && W !== inertia && (Vj.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(Vj.value), Uj && this.finish(), Vj;
|
|
13270
13381
|
}
|
|
13271
13382
|
then(n, _) {
|
|
13272
13383
|
return this.finished.then(n, _);
|
|
@@ -14329,46 +14440,46 @@ function onlyElements(n) {
|
|
|
14329
14440
|
}), _;
|
|
14330
14441
|
}
|
|
14331
14442
|
var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
|
|
14332
|
-
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H),
|
|
14443
|
+
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Lj = useConstant(() => /* @__PURE__ */ new Map()), Rj = useRef(/* @__PURE__ */ new Set()), [Hj, Uj] = useState(H), [Wj, qj] = useState(H);
|
|
14333
14444
|
useIsomorphicLayoutEffect(() => {
|
|
14334
14445
|
G.current = !1, Z.current = H;
|
|
14335
|
-
for (let n = 0; n <
|
|
14336
|
-
let _ = getChildKey(
|
|
14337
|
-
W.includes(_) ? (
|
|
14446
|
+
for (let n = 0; n < Wj.length; n++) {
|
|
14447
|
+
let _ = getChildKey(Wj[n]);
|
|
14448
|
+
W.includes(_) ? (Lj.delete(_), Rj.current.delete(_)) : Lj.get(_) !== !0 && Lj.set(_, !1);
|
|
14338
14449
|
}
|
|
14339
14450
|
}, [
|
|
14340
|
-
|
|
14451
|
+
Wj,
|
|
14341
14452
|
W.length,
|
|
14342
14453
|
W.join("-")
|
|
14343
14454
|
]);
|
|
14344
|
-
let
|
|
14345
|
-
if (H !==
|
|
14455
|
+
let Jj = [];
|
|
14456
|
+
if (H !== Hj) {
|
|
14346
14457
|
let n = [...H];
|
|
14347
|
-
for (let _ = 0; _ <
|
|
14348
|
-
let E =
|
|
14349
|
-
W.includes(O) || (n.splice(_, 0, E),
|
|
14458
|
+
for (let _ = 0; _ < Wj.length; _++) {
|
|
14459
|
+
let E = Wj[_], O = getChildKey(E);
|
|
14460
|
+
W.includes(O) || (n.splice(_, 0, E), Jj.push(E));
|
|
14350
14461
|
}
|
|
14351
|
-
return j === "wait" &&
|
|
14462
|
+
return j === "wait" && Jj.length && (n = Jj), qj(onlyElements(n)), Uj(H), null;
|
|
14352
14463
|
}
|
|
14353
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
14354
|
-
let { forceRender:
|
|
14355
|
-
return jsx(Fragment$1, { children:
|
|
14356
|
-
let U = getChildKey(n),
|
|
14464
|
+
process.env.NODE_ENV !== "production" && j === "wait" && Wj.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.");
|
|
14465
|
+
let { forceRender: Yj } = useContext(LayoutGroupContext);
|
|
14466
|
+
return jsx(Fragment$1, { children: Wj.map((n) => {
|
|
14467
|
+
let U = getChildKey(n), zj = M && !z ? !1 : H === Wj || W.includes(U);
|
|
14357
14468
|
return jsx(PresenceChild, {
|
|
14358
|
-
isPresent:
|
|
14469
|
+
isPresent: zj,
|
|
14359
14470
|
initial: !G.current || E ? void 0 : !1,
|
|
14360
14471
|
custom: _,
|
|
14361
14472
|
presenceAffectsLayout: A,
|
|
14362
14473
|
mode: j,
|
|
14363
14474
|
root: P,
|
|
14364
|
-
onExitComplete:
|
|
14365
|
-
if (
|
|
14366
|
-
if (
|
|
14475
|
+
onExitComplete: zj ? void 0 : () => {
|
|
14476
|
+
if (Rj.current.has(U)) return;
|
|
14477
|
+
if (Rj.current.add(U), Lj.has(U)) Lj.set(U, !0);
|
|
14367
14478
|
else return;
|
|
14368
14479
|
let n = !0;
|
|
14369
|
-
|
|
14480
|
+
Lj.forEach((_) => {
|
|
14370
14481
|
_ || (n = !1);
|
|
14371
|
-
}), n && (
|
|
14482
|
+
}), n && (Yj?.(), qj(Z.current), M && B?.(), O && O());
|
|
14372
14483
|
},
|
|
14373
14484
|
anchorX: N,
|
|
14374
14485
|
children: n
|
|
@@ -14797,12 +14908,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
14797
14908
|
useInsertionEffect(() => {
|
|
14798
14909
|
H && Z.current && H.update(E, P);
|
|
14799
14910
|
});
|
|
14800
|
-
let
|
|
14911
|
+
let Rj = E[optimizedAppearDataAttribute], zj = useRef(!!Rj && !window.MotionHandoffIsComplete?.(Rj) && window.MotionHasOptimisedAnimation?.(Rj));
|
|
14801
14912
|
return useIsomorphicLayoutEffect(() => {
|
|
14802
|
-
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(),
|
|
14913
|
+
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), zj.current && H.animationState && H.animationState.animateChanges());
|
|
14803
14914
|
}), useEffect(() => {
|
|
14804
|
-
H && (!
|
|
14805
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
14915
|
+
H && (!zj.current && H.animationState && H.animationState.animateChanges(), zj.current &&= (queueMicrotask(() => {
|
|
14916
|
+
window.MotionHandoffMarkAsComplete?.(Rj);
|
|
14806
14917
|
}), !1), H.enteringChildren = void 0);
|
|
14807
14918
|
}), H;
|
|
14808
14919
|
}
|
|
@@ -15480,34 +15591,34 @@ function createAnimationState(n) {
|
|
|
15480
15591
|
function M(j) {
|
|
15481
15592
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
15482
15593
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
15483
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
15484
|
-
|
|
15485
|
-
let
|
|
15486
|
-
if (
|
|
15487
|
-
let
|
|
15488
|
-
|
|
15489
|
-
let { prevResolvedValues:
|
|
15490
|
-
...
|
|
15491
|
-
...
|
|
15492
|
-
},
|
|
15493
|
-
|
|
15594
|
+
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Lj = U === j ? W.isActive : null;
|
|
15595
|
+
Lj === !1 && (H = _);
|
|
15596
|
+
let Rj = G === N[U] && G !== M[U] && Z;
|
|
15597
|
+
if (Rj && O && n.manuallyAnimateOnMount && (Rj = !1), W.protectedKeys = { ...B }, !W.isActive && Lj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
|
|
15598
|
+
let zj = checkVariantsDidChange(W.prevProp, G), Bj = zj || U === j && W.isActive && !Rj && Z || _ > H && Z, Vj = !1, Hj = Array.isArray(G) ? G : [G], Uj = Hj.reduce(A(U), {});
|
|
15599
|
+
Lj === !1 && (Uj = {});
|
|
15600
|
+
let { prevResolvedValues: Wj = {} } = W, Gj = {
|
|
15601
|
+
...Wj,
|
|
15602
|
+
...Uj
|
|
15603
|
+
}, Kj = (_) => {
|
|
15604
|
+
Bj = !0, z.has(_) && (Vj = !0, z.delete(_)), W.needsAnimating[_] = !0;
|
|
15494
15605
|
let E = n.getValue(_);
|
|
15495
15606
|
E && (E.liveStyle = !1);
|
|
15496
15607
|
};
|
|
15497
|
-
for (let n in
|
|
15498
|
-
let _ =
|
|
15608
|
+
for (let n in Gj) {
|
|
15609
|
+
let _ = Uj[n], E = Wj[n];
|
|
15499
15610
|
if (B.hasOwnProperty(n)) continue;
|
|
15500
15611
|
let O = !1;
|
|
15501
|
-
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) :
|
|
15612
|
+
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : Kj(n) : _ !== void 0 && z.has(n) ? Kj(n) : W.protectedKeys[n] = !0;
|
|
15502
15613
|
}
|
|
15503
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
15614
|
+
W.prevProp = G, W.prevResolvedValues = Uj, W.isActive && (B = {
|
|
15504
15615
|
...B,
|
|
15505
|
-
...
|
|
15506
|
-
}), O && n.blockInitialAnimation && (
|
|
15507
|
-
let
|
|
15508
|
-
|
|
15616
|
+
...Uj
|
|
15617
|
+
}), O && n.blockInitialAnimation && (Bj = !1);
|
|
15618
|
+
let qj = Rj && zj;
|
|
15619
|
+
Bj && (!qj || Vj) && P.push(...Hj.map((_) => {
|
|
15509
15620
|
let E = { type: U };
|
|
15510
|
-
if (typeof _ == "string" && O && !
|
|
15621
|
+
if (typeof _ == "string" && O && !qj && n.manuallyAnimateOnMount && n.parent) {
|
|
15511
15622
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
15512
15623
|
if (O.enteringChildren && A) {
|
|
15513
15624
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -17363,8 +17474,190 @@ const Preview = () => {
|
|
|
17363
17474
|
})]
|
|
17364
17475
|
});
|
|
17365
17476
|
};
|
|
17366
|
-
var
|
|
17367
|
-
let
|
|
17477
|
+
var LayersPanel = ({ onOpenSettings: n }) => {
|
|
17478
|
+
let { state: _, selectElement: E, renameElement: O, addToGroup: A, removeFromGroup: j, groupElements: M } = useEditor(), [N, P] = useState({}), [z, B] = useState(!1), [H, U] = useState(null), [W, G] = useState(""), Z = _.elements.filter((n) => n.type === "group"), Lj = /* @__PURE__ */ new Map();
|
|
17479
|
+
Z.forEach((n) => {
|
|
17480
|
+
Lj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
|
|
17481
|
+
});
|
|
17482
|
+
let Rj = _.elements.filter((n) => n.type !== "group" && !n.groupId), zj = (n) => {
|
|
17483
|
+
P((_) => ({
|
|
17484
|
+
..._,
|
|
17485
|
+
[n]: !_[n]
|
|
17486
|
+
}));
|
|
17487
|
+
}, Bj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
|
|
17488
|
+
style: {
|
|
17489
|
+
borderRadius: 6,
|
|
17490
|
+
backgroundColor: _.selectedElementIds.includes(O.id) ? "var(--gray-5)" : "var(--gray-3)",
|
|
17491
|
+
border: _.selectedElementIds.includes(O.id) ? "1px solid var(--gray-8)" : "1px solid var(--gray-5)",
|
|
17492
|
+
cursor: "pointer",
|
|
17493
|
+
overflow: "hidden",
|
|
17494
|
+
padding: "6px 8px",
|
|
17495
|
+
paddingLeft: `${8 + j * 16}px`
|
|
17496
|
+
},
|
|
17497
|
+
draggable: !0,
|
|
17498
|
+
onDragStart: (n) => {
|
|
17499
|
+
n.dataTransfer.setData("application/x-editor-element", O.id), n.dataTransfer.effectAllowed = "move";
|
|
17500
|
+
},
|
|
17501
|
+
onDragOver: (n) => {
|
|
17502
|
+
n.preventDefault();
|
|
17503
|
+
},
|
|
17504
|
+
onDrop: (n) => {
|
|
17505
|
+
let E = n.dataTransfer.getData("application/x-editor-element");
|
|
17506
|
+
if (!(!E || E === O.id)) if (O.type === "group") A(E, O.id);
|
|
17507
|
+
else {
|
|
17508
|
+
let n = _.elements.find((n) => n.id === E);
|
|
17509
|
+
if (!n) return;
|
|
17510
|
+
let j = O;
|
|
17511
|
+
!n.groupId && !j.groupId ? M([E, j.id]) : !j.groupId && n.groupId ? A(j.id, n.groupId) : !n.groupId && j.groupId && A(E, j.groupId);
|
|
17512
|
+
}
|
|
17513
|
+
},
|
|
17514
|
+
onClick: (_) => {
|
|
17515
|
+
E(O.id, _.shiftKey), n && n(O.id);
|
|
17516
|
+
},
|
|
17517
|
+
children: /* @__PURE__ */ jsxs(p$1, {
|
|
17518
|
+
gap: "2",
|
|
17519
|
+
align: "center",
|
|
17520
|
+
style: {
|
|
17521
|
+
width: "100%",
|
|
17522
|
+
overflow: "hidden"
|
|
17523
|
+
},
|
|
17524
|
+
children: [
|
|
17525
|
+
O.type === "text" && /* @__PURE__ */ jsx(TextIcon, {}),
|
|
17526
|
+
O.type === "image" && /* @__PURE__ */ jsx(ImageIcon, {}),
|
|
17527
|
+
O.type === "box" && /* @__PURE__ */ jsx(BoxIcon, {}),
|
|
17528
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
17529
|
+
truncate: !0,
|
|
17530
|
+
style: {
|
|
17531
|
+
flex: 1,
|
|
17532
|
+
textAlign: "left"
|
|
17533
|
+
},
|
|
17534
|
+
children: O.name || (O.type === "text" ? O.content.length > 20 ? O.content.substring(0, 20) + "..." : O.content : O.type === "image" ? "Imagem" : "Container")
|
|
17535
|
+
}),
|
|
17536
|
+
O.type === "group" && /* @__PURE__ */ jsx(o, {
|
|
17537
|
+
variant: "ghost",
|
|
17538
|
+
color: "gray",
|
|
17539
|
+
size: "1",
|
|
17540
|
+
onClick: (n) => {
|
|
17541
|
+
n.stopPropagation(), U(O.id), G(O.name || "Grupo"), B(!0);
|
|
17542
|
+
},
|
|
17543
|
+
children: "Renomear"
|
|
17544
|
+
})
|
|
17545
|
+
]
|
|
17546
|
+
})
|
|
17547
|
+
}, O.id);
|
|
17548
|
+
return /* @__PURE__ */ jsxs(p$1, {
|
|
17549
|
+
direction: "column",
|
|
17550
|
+
gap: "2",
|
|
17551
|
+
children: [
|
|
17552
|
+
Rj.map((n) => Bj(n, 0)),
|
|
17553
|
+
Z.map((_) => {
|
|
17554
|
+
let O = N[_.id] === !0, j = Lj.get(_.id) || [];
|
|
17555
|
+
return /* @__PURE__ */ jsxs(p, {
|
|
17556
|
+
style: {
|
|
17557
|
+
border: "1px dashed var(--gray-6)",
|
|
17558
|
+
borderRadius: 6,
|
|
17559
|
+
backgroundColor: "var(--gray-3)"
|
|
17560
|
+
},
|
|
17561
|
+
children: [/* @__PURE__ */ jsx(p$1, {
|
|
17562
|
+
align: "center",
|
|
17563
|
+
justify: "between",
|
|
17564
|
+
style: {
|
|
17565
|
+
padding: "6px 8px",
|
|
17566
|
+
cursor: "pointer"
|
|
17567
|
+
},
|
|
17568
|
+
onClick: () => {
|
|
17569
|
+
E(_.id), n && n(_.id);
|
|
17570
|
+
},
|
|
17571
|
+
onDoubleClick: () => zj(_.id),
|
|
17572
|
+
onDragOver: (n) => {
|
|
17573
|
+
n.preventDefault();
|
|
17574
|
+
},
|
|
17575
|
+
onDrop: (n) => {
|
|
17576
|
+
let E = n.dataTransfer.getData("application/x-editor-element");
|
|
17577
|
+
E && E !== _.id && A(E, _.id);
|
|
17578
|
+
},
|
|
17579
|
+
children: /* @__PURE__ */ jsxs(p$1, {
|
|
17580
|
+
align: "center",
|
|
17581
|
+
gap: "2",
|
|
17582
|
+
children: [
|
|
17583
|
+
/* @__PURE__ */ jsx(BoxIcon, {}),
|
|
17584
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
17585
|
+
style: { fontWeight: 600 },
|
|
17586
|
+
children: _.name || "Grupo"
|
|
17587
|
+
}),
|
|
17588
|
+
/* @__PURE__ */ jsx(e, {
|
|
17589
|
+
variant: "soft",
|
|
17590
|
+
color: "blue",
|
|
17591
|
+
size: "1",
|
|
17592
|
+
children: j.length
|
|
17593
|
+
})
|
|
17594
|
+
]
|
|
17595
|
+
})
|
|
17596
|
+
}), !O && /* @__PURE__ */ jsxs(p$1, {
|
|
17597
|
+
direction: "column",
|
|
17598
|
+
gap: "2",
|
|
17599
|
+
style: { padding: "6px 8px" },
|
|
17600
|
+
children: [j.map((n) => Bj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
|
|
17601
|
+
size: "1",
|
|
17602
|
+
color: "gray",
|
|
17603
|
+
children: "Solte elementos aqui para agrupar"
|
|
17604
|
+
})]
|
|
17605
|
+
})]
|
|
17606
|
+
}, _.id);
|
|
17607
|
+
}),
|
|
17608
|
+
/* @__PURE__ */ jsx(p, {
|
|
17609
|
+
style: {
|
|
17610
|
+
marginTop: 8,
|
|
17611
|
+
padding: "6px 8px",
|
|
17612
|
+
border: "1px dashed var(--gray-6)",
|
|
17613
|
+
borderRadius: 6
|
|
17614
|
+
},
|
|
17615
|
+
onDragOver: (n) => {
|
|
17616
|
+
n.preventDefault();
|
|
17617
|
+
},
|
|
17618
|
+
onDrop: (n) => {
|
|
17619
|
+
let _ = n.dataTransfer.getData("application/x-editor-element");
|
|
17620
|
+
_ && j(_);
|
|
17621
|
+
},
|
|
17622
|
+
children: /* @__PURE__ */ jsx(p$2, {
|
|
17623
|
+
size: "1",
|
|
17624
|
+
color: "gray",
|
|
17625
|
+
children: "Soltar aqui para remover do grupo"
|
|
17626
|
+
})
|
|
17627
|
+
}),
|
|
17628
|
+
/* @__PURE__ */ jsx(s$4, {
|
|
17629
|
+
open: z,
|
|
17630
|
+
onOpenChange: B,
|
|
17631
|
+
children: /* @__PURE__ */ jsxs(p$8, {
|
|
17632
|
+
style: { maxWidth: 420 },
|
|
17633
|
+
children: [/* @__PURE__ */ jsx(g$2, { children: "Renomear Grupo" }), /* @__PURE__ */ jsxs(p$1, {
|
|
17634
|
+
direction: "column",
|
|
17635
|
+
gap: "3",
|
|
17636
|
+
children: [/* @__PURE__ */ jsx(u$1, {
|
|
17637
|
+
value: W,
|
|
17638
|
+
onChange: (n) => G(n.target.value),
|
|
17639
|
+
placeholder: "Nome do grupo..."
|
|
17640
|
+
}), /* @__PURE__ */ jsxs(p$1, {
|
|
17641
|
+
gap: "3",
|
|
17642
|
+
justify: "end",
|
|
17643
|
+
children: [/* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
17644
|
+
variant: "soft",
|
|
17645
|
+
color: "gray",
|
|
17646
|
+
children: "Cancelar"
|
|
17647
|
+
}) }), /* @__PURE__ */ jsx(o, {
|
|
17648
|
+
onClick: () => {
|
|
17649
|
+
H && O(H, W), B(!1);
|
|
17650
|
+
},
|
|
17651
|
+
children: "Salvar"
|
|
17652
|
+
})]
|
|
17653
|
+
})]
|
|
17654
|
+
})]
|
|
17655
|
+
})
|
|
17656
|
+
})
|
|
17657
|
+
]
|
|
17658
|
+
});
|
|
17659
|
+
}, EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
17660
|
+
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Lj, redo: Rj, copy: zj, paste: Bj, removeSelected: Hj, updateElements: Uj } = useEditor(), Wj = React.useRef(null), Gj = () => {
|
|
17368
17661
|
let n = {
|
|
17369
17662
|
elements: Z.elements,
|
|
17370
17663
|
isList: Z.isList,
|
|
@@ -17375,9 +17668,9 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17375
17668
|
gridSize: Z.gridSize
|
|
17376
17669
|
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
17377
17670
|
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);
|
|
17378
|
-
},
|
|
17379
|
-
|
|
17380
|
-
},
|
|
17671
|
+
}, Jj = () => {
|
|
17672
|
+
Wj.current?.click();
|
|
17673
|
+
}, Yj = (n) => {
|
|
17381
17674
|
let _ = n.target.files?.[0];
|
|
17382
17675
|
if (!_) return;
|
|
17383
17676
|
let E = new FileReader();
|
|
@@ -17417,11 +17710,11 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17417
17710
|
}, [W]), React.useEffect(() => {
|
|
17418
17711
|
let n = (n) => {
|
|
17419
17712
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
17420
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
17421
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
17422
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
17423
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
17424
|
-
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(),
|
|
17713
|
+
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), Rj()) : (n.preventDefault(), Lj());
|
|
17714
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), Rj();
|
|
17715
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), zj();
|
|
17716
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Bj();
|
|
17717
|
+
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), Hj());
|
|
17425
17718
|
else if ([
|
|
17426
17719
|
"ArrowUp",
|
|
17427
17720
|
"ArrowDown",
|
|
@@ -17439,20 +17732,20 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17439
17732
|
changes: j
|
|
17440
17733
|
});
|
|
17441
17734
|
}
|
|
17442
|
-
}), E.length > 0 &&
|
|
17735
|
+
}), E.length > 0 && Uj(E);
|
|
17443
17736
|
}
|
|
17444
17737
|
}
|
|
17445
17738
|
};
|
|
17446
17739
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
17447
17740
|
}, [
|
|
17741
|
+
Lj,
|
|
17742
|
+
Rj,
|
|
17743
|
+
zj,
|
|
17448
17744
|
Bj,
|
|
17449
|
-
Vj,
|
|
17450
17745
|
Hj,
|
|
17451
|
-
Uj,
|
|
17452
|
-
Gj,
|
|
17453
17746
|
Z.selectedElementIds,
|
|
17454
17747
|
Z.elements,
|
|
17455
|
-
|
|
17748
|
+
Uj
|
|
17456
17749
|
]), React.useEffect(() => {
|
|
17457
17750
|
if (E) try {
|
|
17458
17751
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
@@ -17461,7 +17754,7 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17461
17754
|
console.error("Failed to load initial state", n);
|
|
17462
17755
|
}
|
|
17463
17756
|
}, [E, G]);
|
|
17464
|
-
let
|
|
17757
|
+
let Xj = (n) => {
|
|
17465
17758
|
console.log(`Adding element of type: ${n}`), W({
|
|
17466
17759
|
type: n,
|
|
17467
17760
|
content: `New ${n}`
|
|
@@ -17522,15 +17815,15 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17522
17815
|
style: { width: "240px" },
|
|
17523
17816
|
children: [
|
|
17524
17817
|
/* @__PURE__ */ jsx(v$3, {
|
|
17525
|
-
onSelect: () =>
|
|
17818
|
+
onSelect: () => Xj("text"),
|
|
17526
17819
|
children: "Texto"
|
|
17527
17820
|
}),
|
|
17528
17821
|
/* @__PURE__ */ jsx(v$3, {
|
|
17529
|
-
onSelect: () =>
|
|
17822
|
+
onSelect: () => Xj("image"),
|
|
17530
17823
|
children: "Imagem"
|
|
17531
17824
|
}),
|
|
17532
17825
|
/* @__PURE__ */ jsx(v$3, {
|
|
17533
|
-
onSelect: () =>
|
|
17826
|
+
onSelect: () => Xj("box"),
|
|
17534
17827
|
children: "Caixa (Container)"
|
|
17535
17828
|
})
|
|
17536
17829
|
]
|
|
@@ -17569,7 +17862,7 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17569
17862
|
cursor: "pointer",
|
|
17570
17863
|
justifyContent: "center"
|
|
17571
17864
|
},
|
|
17572
|
-
onClick:
|
|
17865
|
+
onClick: Gj,
|
|
17573
17866
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
17574
17867
|
}), /* @__PURE__ */ jsxs(o, {
|
|
17575
17868
|
variant: "soft",
|
|
@@ -17579,16 +17872,16 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17579
17872
|
cursor: "pointer",
|
|
17580
17873
|
justifyContent: "center"
|
|
17581
17874
|
},
|
|
17582
|
-
onClick:
|
|
17875
|
+
onClick: Jj,
|
|
17583
17876
|
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
17584
17877
|
})]
|
|
17585
17878
|
}),
|
|
17586
17879
|
/* @__PURE__ */ jsx("input", {
|
|
17587
17880
|
type: "file",
|
|
17588
|
-
ref:
|
|
17881
|
+
ref: Wj,
|
|
17589
17882
|
style: { display: "none" },
|
|
17590
17883
|
accept: ".json",
|
|
17591
|
-
onChange:
|
|
17884
|
+
onChange: Yj
|
|
17592
17885
|
}),
|
|
17593
17886
|
/* @__PURE__ */ jsx(p, {
|
|
17594
17887
|
mt: "2",
|
|
@@ -17611,49 +17904,9 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
17611
17904
|
mb: "2",
|
|
17612
17905
|
as: "div",
|
|
17613
17906
|
children: "Elementos"
|
|
17614
|
-
}), /* @__PURE__ */
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
children: [Z.elements.map((n) => /* @__PURE__ */ jsx(o, {
|
|
17618
|
-
variant: Z.selectedElementIds.includes(n.id) ? "solid" : "soft",
|
|
17619
|
-
color: "gray",
|
|
17620
|
-
size: "2",
|
|
17621
|
-
style: {
|
|
17622
|
-
justifyContent: "flex-start",
|
|
17623
|
-
cursor: "pointer",
|
|
17624
|
-
overflow: "hidden"
|
|
17625
|
-
},
|
|
17626
|
-
onClick: (_) => {
|
|
17627
|
-
qj(n.id, _.shiftKey), B(n.id), U(!0);
|
|
17628
|
-
},
|
|
17629
|
-
children: /* @__PURE__ */ jsxs(p$1, {
|
|
17630
|
-
gap: "2",
|
|
17631
|
-
align: "center",
|
|
17632
|
-
style: {
|
|
17633
|
-
width: "100%",
|
|
17634
|
-
overflow: "hidden"
|
|
17635
|
-
},
|
|
17636
|
-
children: [
|
|
17637
|
-
n.type === "text" && /* @__PURE__ */ jsx(TextIcon, {}),
|
|
17638
|
-
n.type === "image" && /* @__PURE__ */ jsx(ImageIcon, {}),
|
|
17639
|
-
n.type === "box" && /* @__PURE__ */ jsx(BoxIcon, {}),
|
|
17640
|
-
/* @__PURE__ */ jsx(p$2, {
|
|
17641
|
-
truncate: !0,
|
|
17642
|
-
style: {
|
|
17643
|
-
flex: 1,
|
|
17644
|
-
textAlign: "left"
|
|
17645
|
-
},
|
|
17646
|
-
children: n.type === "text" ? n.content.length > 20 ? n.content.substring(0, 20) + "..." : n.content : n.type === "image" ? "Imagem" : "Container"
|
|
17647
|
-
})
|
|
17648
|
-
]
|
|
17649
|
-
})
|
|
17650
|
-
}, n.id)), Z.elements.length === 0 && /* @__PURE__ */ jsx(p$2, {
|
|
17651
|
-
size: "1",
|
|
17652
|
-
color: "gray",
|
|
17653
|
-
style: { fontStyle: "italic" },
|
|
17654
|
-
children: "Nenhum elemento adicionado."
|
|
17655
|
-
})]
|
|
17656
|
-
})] }),
|
|
17907
|
+
}), /* @__PURE__ */ jsx(LayersPanel, { onOpenSettings: (n) => {
|
|
17908
|
+
B(n), U(!0);
|
|
17909
|
+
} })] }),
|
|
17657
17910
|
/* @__PURE__ */ jsx(o$2, { size: "4" }),
|
|
17658
17911
|
/* @__PURE__ */ jsxs(p, { children: [
|
|
17659
17912
|
/* @__PURE__ */ jsx(p$2, {
|
|
@@ -17814,5 +18067,5 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
|
17814
18067
|
availableProps: n.layout.props,
|
|
17815
18068
|
theme: n.theme,
|
|
17816
18069
|
children: /* @__PURE__ */ jsx(EditorContent, { ...n })
|
|
17817
|
-
}), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = [\n 'width', 'height', 'top', 'left', 'right', 'bottom', \n 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth',\n 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'\n ];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n let cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n if (typeof cssValue === 'string') {\n if (/^#([0-9a-fA-F]{8})$/.test(cssValue)) {\n cssValue = hex8ToRgba(cssValue);\n }\n }\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const getAnimationStyles = (anim) => {\n if (!anim || anim.type === 'none') return {};\n return {\n animationName: anim.type,\n animationDuration: (anim.duration || 1) + 's',\n animationDelay: (anim.delay || 0) + 's',\n animationIterationCount: anim.iterationCount || 1,\n animationTimingFunction: anim.timingFunction || 'ease',\n animationFillMode: 'both'\n };\n };\n\n const keyframesCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeIn { \n from { opacity: 0; } \n to { opacity: 1; } \n }\n @keyframes slideInLeft { \n from { opacity: 0; transform: translateX(-50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInRight { \n from { opacity: 0; transform: translateX(50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInUp { \n from { opacity: 0; transform: translateY(50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes slideInDown { \n from { opacity: 0; transform: translateY(-50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes zoomIn { \n from { opacity: 0; transform: scale(0.5); } \n to { opacity: 1; transform: scale(1); } \n }\n @keyframes bounceIn {\n 0% { opacity: 0; transform: scale(0.3); }\n 50% { opacity: 1; transform: scale(1.05); }\n 70% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n @keyframes pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }\n 20%, 40%, 60%, 80% { transform: translateX(5px); }\n }\n @keyframes spin { \n from { transform: rotate(0deg); } \n to { transform: rotate(360deg); } \n }\n \n /* Improved / Smoother Animations */\n @keyframes smoothSlideUp {\n 0% { opacity: 0; transform: translateY(30px); }\n 100% { opacity: 1; transform: translateY(0); }\n }\n @keyframes popIn {\n 0% { opacity: 0; transform: scale(0.8) translateY(10px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes blurIn {\n 0% { opacity: 0; filter: blur(10px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: element.autoGrow ? 'pre-wrap' : undefined,\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate item height\n const itemHeight = canvasHeight || Math.max(...elements.map(el => el.y + el.height));\n\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const itemHeight = ${itemHeight};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
|
|
18070
|
+
}), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const measureTextHeight = (text, width, fontFamily, fontSize, lineHeightMultiplier = 1.2) => {\n if (!text) return 0;\n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return 0;\n context.font = `${fontSize}px ${fontFamily}`;\n const words = String(text).split(' ');\n let line = '';\n let lineCount = 1;\n for (let i = 0; i < words.length; i++) {\n const testLine = line + words[i] + ' ';\n const metrics = context.measureText(testLine);\n const testWidth = metrics.width;\n if (testWidth > width && i > 0) {\n line = words[i] + ' ';\n lineCount++;\n } else {\n line = testLine;\n }\n }\n const explicitLines = String(text).split('\\n').length - 1;\n lineCount += explicitLines;\n return Math.ceil(lineCount * fontSize * lineHeightMultiplier);\n } catch (_) {\n return 0;\n }\n };\n\n const computeItemHeight = (elements, itemData, fallbackHeight) => {\n if (fallbackHeight) return fallbackHeight;\n let maxY = 0;\n elements.forEach(el => {\n let height = el.height;\n if (el.type === 'text' && el.autoGrow) {\n let content = el.content;\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n const fontSize = parseInt(String((el.style && el.style.fontSize) || 16));\n const fontFamily = String((el.style && el.style.fontFamily) || 'Arial');\n const measured = measureTextHeight(content, el.width, fontFamily, fontSize);\n height = Math.max(height, measured);\n }\n const bottom = el.y + height;\n if (bottom > maxY) maxY = bottom;\n });\n return maxY;\n };\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = [\n 'width', 'height', 'top', 'left', 'right', 'bottom', \n 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth',\n 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'\n ];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n let cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n if (typeof cssValue === 'string') {\n if (/^#([0-9a-fA-F]{8})$/.test(cssValue)) {\n cssValue = hex8ToRgba(cssValue);\n }\n }\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const getAnimationStyles = (anim) => {\n if (!anim || anim.type === 'none') return {};\n return {\n animationName: anim.type,\n animationDuration: (anim.duration || 1) + 's',\n animationDelay: (anim.delay || 0) + 's',\n animationIterationCount: anim.iterationCount || 1,\n animationTimingFunction: anim.timingFunction || 'ease',\n animationFillMode: 'both'\n };\n };\n\n const keyframesCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeIn { \n from { opacity: 0; } \n to { opacity: 1; } \n }\n @keyframes slideInLeft { \n from { opacity: 0; transform: translateX(-50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInRight { \n from { opacity: 0; transform: translateX(50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInUp { \n from { opacity: 0; transform: translateY(50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes slideInDown { \n from { opacity: 0; transform: translateY(-50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes zoomIn { \n from { opacity: 0; transform: scale(0.5); } \n to { opacity: 1; transform: scale(1); } \n }\n @keyframes bounceIn {\n 0% { opacity: 0; transform: scale(0.3); }\n 50% { opacity: 1; transform: scale(1.05); }\n 70% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n @keyframes pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }\n 20%, 40%, 60%, 80% { transform: translateX(5px); }\n }\n @keyframes spin { \n from { transform: rotate(0deg); } \n to { transform: rotate(360deg); } \n }\n \n /* Improved / Smoother Animations */\n @keyframes smoothSlideUp {\n 0% { opacity: 0; transform: translateY(30px); }\n 100% { opacity: 1; transform: translateY(0); }\n }\n @keyframes popIn {\n 0% { opacity: 0; transform: scale(0.8) translateY(10px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes blurIn {\n 0% { opacity: 0; filter: blur(10px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: element.autoGrow ? 'pre-wrap' : undefined,\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate per-item height respecting autoGrow\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemHeight = computeItemHeight(elements, item, canvasHeight);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const measureTextHeight = ${measureTextHeight.toString()};\n const computeItemHeight = ${computeItemHeight.toString()};\n const itemHeightFallback = ${canvasHeight || 0};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemHeight = computeItemHeight(elements, data, itemHeightFallback);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
|
|
17818
18071
|
export { GenericEditor as EditorContent, generateHTML };
|