@1urso/generic-editor 0.1.49 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generic-editor.js +1161 -766
- package/dist/generic-editor.umd.cjs +66 -512
- package/package.json +1 -1
package/dist/generic-editor.js
CHANGED
|
@@ -3,6 +3,7 @@ import React, { Children, Component, Fragment, PureComponent, createContext, cre
|
|
|
3
3
|
import * as ReactDOM$1 from "react-dom";
|
|
4
4
|
import ReactDOM, { flushSync } from "react-dom";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
6
7
|
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (n, _) => () => (n && (_ = n(n = 0)), _), __commonJSMin = (n, _) => () => (_ || n((_ = { exports: {} }).exports, _), _.exports), __export = (n) => {
|
|
7
8
|
let _ = {};
|
|
8
9
|
for (var E in n) __defProp(_, E, {
|
|
@@ -804,15 +805,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
804
805
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
805
806
|
branches: /* @__PURE__ */ new Set()
|
|
806
807
|
}), 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)),
|
|
808
|
+
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)), Yj = Array.from(B.layers), [Xj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), Zj = Yj.indexOf(Xj), Qj = H ? Yj.indexOf(H) : -1, $j = B.layersWithOutsidePointerEventsDisabled.size > 0, eM = Qj >= Zj, tM = usePointerDownOutside((n) => {
|
|
808
809
|
let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
|
|
809
|
-
!
|
|
810
|
-
}, W),
|
|
810
|
+
!eM || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
811
|
+
}, W), nM = useFocusOutside((n) => {
|
|
811
812
|
let _ = n.target;
|
|
812
813
|
[...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
813
814
|
}, W);
|
|
814
815
|
return useEscapeKeydown((n) => {
|
|
815
|
-
|
|
816
|
+
Qj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
|
|
816
817
|
}, W), React$1.useEffect(() => {
|
|
817
818
|
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
819
|
O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -831,12 +832,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
831
832
|
...z,
|
|
832
833
|
ref: Z,
|
|
833
834
|
style: {
|
|
834
|
-
pointerEvents:
|
|
835
|
+
pointerEvents: $j ? eM ? "auto" : "none" : void 0,
|
|
835
836
|
..._.style
|
|
836
837
|
},
|
|
837
|
-
onFocusCapture: composeEventHandlers(_.onFocusCapture,
|
|
838
|
-
onBlurCapture: composeEventHandlers(_.onBlurCapture,
|
|
839
|
-
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture,
|
|
838
|
+
onFocusCapture: composeEventHandlers(_.onFocusCapture, nM.onFocusCapture),
|
|
839
|
+
onBlurCapture: composeEventHandlers(_.onBlurCapture, nM.onBlurCapture),
|
|
840
|
+
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, tM.onPointerDownCapture)
|
|
840
841
|
});
|
|
841
842
|
});
|
|
842
843
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -1195,7 +1196,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1195
1196
|
onScrollCapture: nothing,
|
|
1196
1197
|
onWheelCapture: nothing,
|
|
1197
1198
|
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,
|
|
1199
|
+
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, Yj = _.inert, Xj = _.allowPinchZoom, Zj = _.as, Qj = Zj === void 0 ? "div" : Zj, $j = _.gapMode, eM = __rest(_, [
|
|
1199
1200
|
"forwardProps",
|
|
1200
1201
|
"children",
|
|
1201
1202
|
"className",
|
|
@@ -1209,21 +1210,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1209
1210
|
"allowPinchZoom",
|
|
1210
1211
|
"as",
|
|
1211
1212
|
"gapMode"
|
|
1212
|
-
]),
|
|
1213
|
-
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(
|
|
1213
|
+
]), tM = W, nM = useMergeRefs([O, E]), rM = __assign$2(__assign$2({}, eM), j);
|
|
1214
|
+
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(tM, {
|
|
1214
1215
|
sideCar: effectCar,
|
|
1215
1216
|
removeScrollBar: B,
|
|
1216
1217
|
shards: U,
|
|
1217
1218
|
noRelative: G,
|
|
1218
1219
|
noIsolation: Z,
|
|
1219
|
-
inert:
|
|
1220
|
+
inert: Yj,
|
|
1220
1221
|
setCallbacks: M,
|
|
1221
|
-
allowPinchZoom: !!
|
|
1222
|
+
allowPinchZoom: !!Xj,
|
|
1222
1223
|
lockRef: O,
|
|
1223
|
-
gapMode:
|
|
1224
|
-
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({},
|
|
1224
|
+
gapMode: $j
|
|
1225
|
+
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, rM), { ref: nM })) : React$1.createElement(Qj, __assign$2({}, rM, {
|
|
1225
1226
|
className: z,
|
|
1226
|
-
ref:
|
|
1227
|
+
ref: nM
|
|
1227
1228
|
}), P));
|
|
1228
1229
|
});
|
|
1229
1230
|
RemoveScroll.defaultProps = {
|
|
@@ -1413,8 +1414,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1413
1414
|
if (!N) break;
|
|
1414
1415
|
var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
|
|
1415
1416
|
(G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
|
|
1416
|
-
var
|
|
1417
|
-
N =
|
|
1417
|
+
var Yj = N.parentNode;
|
|
1418
|
+
N = Yj && Yj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Yj.host : Yj;
|
|
1418
1419
|
} while (!P && N !== document.body || P && (_.contains(N) || _ === N));
|
|
1419
1420
|
return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
|
|
1420
1421
|
}, getTouchXY = function(n) {
|
|
@@ -1961,7 +1962,7 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1961
1962
|
strategy: A
|
|
1962
1963
|
}), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
|
|
1963
1964
|
for (let E = 0; E < N.length; E++) {
|
|
1964
|
-
let { name: j, fn: Z } = N[E], { x:
|
|
1965
|
+
let { name: j, fn: Z } = N[E], { x: Yj, y: Xj, data: Zj, reset: Qj } = await Z({
|
|
1965
1966
|
x: B,
|
|
1966
1967
|
y: H,
|
|
1967
1968
|
initialPlacement: O,
|
|
@@ -1975,17 +1976,17 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1975
1976
|
floating: _
|
|
1976
1977
|
}
|
|
1977
1978
|
});
|
|
1978
|
-
B =
|
|
1979
|
+
B = Yj ?? B, H = Xj ?? H, W = {
|
|
1979
1980
|
...W,
|
|
1980
1981
|
[j]: {
|
|
1981
1982
|
...W[j],
|
|
1982
|
-
...
|
|
1983
|
+
...Zj
|
|
1983
1984
|
}
|
|
1984
|
-
},
|
|
1985
|
+
}, Qj && G <= 50 && (G++, typeof Qj == "object" && (Qj.placement && (U = Qj.placement), Qj.rects && (z = Qj.rects === !0 ? await M.getElementRects({
|
|
1985
1986
|
reference: n,
|
|
1986
1987
|
floating: _,
|
|
1987
1988
|
strategy: A
|
|
1988
|
-
}) :
|
|
1989
|
+
}) : Qj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
|
|
1989
1990
|
}
|
|
1990
1991
|
return {
|
|
1991
1992
|
x: B,
|
|
@@ -2002,25 +2003,25 @@ async function detectOverflow$1(n, _) {
|
|
|
2002
2003
|
boundary: P,
|
|
2003
2004
|
rootBoundary: z,
|
|
2004
2005
|
strategy: N
|
|
2005
|
-
})),
|
|
2006
|
+
})), Yj = B === "floating" ? {
|
|
2006
2007
|
x: E,
|
|
2007
2008
|
y: O,
|
|
2008
2009
|
width: j.floating.width,
|
|
2009
2010
|
height: j.floating.height
|
|
2010
|
-
} : j.reference,
|
|
2011
|
+
} : j.reference, Xj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), Zj = await (A.isElement == null ? void 0 : A.isElement(Xj)) && await (A.getScale == null ? void 0 : A.getScale(Xj)) || {
|
|
2011
2012
|
x: 1,
|
|
2012
2013
|
y: 1
|
|
2013
|
-
},
|
|
2014
|
+
}, Qj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2014
2015
|
elements: M,
|
|
2015
|
-
rect:
|
|
2016
|
-
offsetParent:
|
|
2016
|
+
rect: Yj,
|
|
2017
|
+
offsetParent: Xj,
|
|
2017
2018
|
strategy: N
|
|
2018
|
-
}) :
|
|
2019
|
+
}) : Yj);
|
|
2019
2020
|
return {
|
|
2020
|
-
top: (Z.top -
|
|
2021
|
-
bottom: (
|
|
2022
|
-
left: (Z.left -
|
|
2023
|
-
right: (
|
|
2021
|
+
top: (Z.top - Qj.top + W.top) / Zj.y,
|
|
2022
|
+
bottom: (Qj.bottom - Z.bottom + W.bottom) / Zj.y,
|
|
2023
|
+
left: (Z.left - Qj.left + W.left) / Zj.x,
|
|
2024
|
+
right: (Qj.right - Z.right + W.right) / Zj.x
|
|
2024
2025
|
};
|
|
2025
2026
|
}
|
|
2026
2027
|
var arrow$2 = (n) => ({
|
|
@@ -2032,17 +2033,17 @@ var arrow$2 = (n) => ({
|
|
|
2032
2033
|
let H = getPaddingObject(B), U = {
|
|
2033
2034
|
x: E,
|
|
2034
2035
|
y: O
|
|
2035
|
-
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z),
|
|
2036
|
-
(!
|
|
2037
|
-
let
|
|
2036
|
+
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Yj = W === "y", Xj = Yj ? "top" : "left", Zj = Yj ? "bottom" : "right", Qj = Yj ? "clientHeight" : "clientWidth", $j = j.reference[G] + j.reference[W] - U[W] - j.floating[G], eM = U[W] - j.reference[W], tM = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), nM = tM ? tM[Qj] : 0;
|
|
2037
|
+
(!nM || !await (M.isElement == null ? void 0 : M.isElement(tM))) && (nM = N.floating[Qj] || j.floating[G]);
|
|
2038
|
+
let rM = $j / 2 - eM / 2, iM = nM / 2 - Z[G] / 2 - 1, aM = min(H[Xj], iM), oM = min(H[Zj], iM), sM = aM, cM = nM - Z[G] - oM, lM = nM / 2 - Z[G] / 2 + rM, uM = clamp$3(sM, lM, cM), dM = !P.arrow && getAlignment(A) != null && lM !== uM && j.reference[G] / 2 - (lM < sM ? aM : oM) - Z[G] / 2 < 0, fM = dM ? lM < sM ? lM - sM : lM - cM : 0;
|
|
2038
2039
|
return {
|
|
2039
|
-
[W]: U[W] +
|
|
2040
|
+
[W]: U[W] + fM,
|
|
2040
2041
|
data: {
|
|
2041
|
-
[W]:
|
|
2042
|
-
centerOffset:
|
|
2043
|
-
|
|
2042
|
+
[W]: uM,
|
|
2043
|
+
centerOffset: lM - uM - fM,
|
|
2044
|
+
...dM && { alignmentOffset: fM }
|
|
2044
2045
|
},
|
|
2045
|
-
reset:
|
|
2046
|
+
reset: dM
|
|
2046
2047
|
};
|
|
2047
2048
|
}
|
|
2048
2049
|
}), flip$2 = function(n) {
|
|
@@ -2053,32 +2054,32 @@ var arrow$2 = (n) => ({
|
|
|
2053
2054
|
var E;
|
|
2054
2055
|
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
2056
|
if ((E = A.arrow) != null && E.alignmentOffset) return {};
|
|
2056
|
-
let
|
|
2057
|
-
!H &&
|
|
2058
|
-
let
|
|
2059
|
-
if (z &&
|
|
2060
|
-
let n = getAlignmentSides(O, j,
|
|
2061
|
-
|
|
2057
|
+
let Yj = getSide(O), Xj = getSideAxis(M), Zj = getSide(M) === M, Qj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), $j = H || (Zj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), eM = W !== "none";
|
|
2058
|
+
!H && eM && $j.push(...getOppositeAxisPlacements(M, G, W, Qj));
|
|
2059
|
+
let tM = [M, ...$j], nM = await detectOverflow$1(_, Z), rM = [], iM = A.flip?.overflows || [];
|
|
2060
|
+
if (z && rM.push(nM[Yj]), B) {
|
|
2061
|
+
let n = getAlignmentSides(O, j, Qj);
|
|
2062
|
+
rM.push(nM[n[0]], nM[n[1]]);
|
|
2062
2063
|
}
|
|
2063
|
-
if (
|
|
2064
|
+
if (iM = [...iM, {
|
|
2064
2065
|
placement: O,
|
|
2065
|
-
overflows:
|
|
2066
|
-
}], !
|
|
2067
|
-
let n = (A.flip?.index || 0) + 1, _ =
|
|
2068
|
-
if (_ && (!(B === "alignment" &&
|
|
2066
|
+
overflows: rM
|
|
2067
|
+
}], !rM.every((n) => n <= 0)) {
|
|
2068
|
+
let n = (A.flip?.index || 0) + 1, _ = tM[n];
|
|
2069
|
+
if (_ && (!(B === "alignment" && Xj !== getSideAxis(_)) || iM.every((n) => getSideAxis(n.placement) === Xj ? n.overflows[0] > 0 : !0))) return {
|
|
2069
2070
|
data: {
|
|
2070
2071
|
index: n,
|
|
2071
|
-
overflows:
|
|
2072
|
+
overflows: iM
|
|
2072
2073
|
},
|
|
2073
2074
|
reset: { placement: _ }
|
|
2074
2075
|
};
|
|
2075
|
-
let E =
|
|
2076
|
+
let E = iM.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
|
|
2076
2077
|
if (!E) switch (U) {
|
|
2077
2078
|
case "bestFit": {
|
|
2078
|
-
let n =
|
|
2079
|
-
if (
|
|
2079
|
+
let n = iM.filter((n) => {
|
|
2080
|
+
if (eM) {
|
|
2080
2081
|
let _ = getSideAxis(n.placement);
|
|
2081
|
-
return _ ===
|
|
2082
|
+
return _ === Xj || _ === "y";
|
|
2082
2083
|
}
|
|
2083
2084
|
return !0;
|
|
2084
2085
|
}).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
|
|
@@ -2221,7 +2222,7 @@ var offset$2 = function(n) {
|
|
|
2221
2222
|
let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
|
|
2222
2223
|
x: E,
|
|
2223
2224
|
y: O
|
|
2224
|
-
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _),
|
|
2225
|
+
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), Yj = typeof Z == "number" ? {
|
|
2225
2226
|
mainAxis: Z,
|
|
2226
2227
|
crossAxis: 0
|
|
2227
2228
|
} : {
|
|
@@ -2230,11 +2231,11 @@ var offset$2 = function(n) {
|
|
|
2230
2231
|
...Z
|
|
2231
2232
|
};
|
|
2232
2233
|
if (P) {
|
|
2233
|
-
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] +
|
|
2234
|
+
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + Yj.mainAxis, E = j.reference[U] + j.reference[n] - Yj.mainAxis;
|
|
2234
2235
|
W < _ ? W = _ : W > E && (W = E);
|
|
2235
2236
|
}
|
|
2236
2237
|
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 :
|
|
2238
|
+
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : Yj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Yj.crossAxis : 0);
|
|
2238
2239
|
G < E ? G = E : G > O && (G = O);
|
|
2239
2240
|
}
|
|
2240
2241
|
return {
|
|
@@ -2249,20 +2250,20 @@ var offset$2 = function(n) {
|
|
|
2249
2250
|
options: n,
|
|
2250
2251
|
async fn(_) {
|
|
2251
2252
|
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 && (
|
|
2253
|
+
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, Yj, Xj;
|
|
2254
|
+
H === "top" || H === "bottom" ? (Yj = H, Xj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (Xj = H, Yj = U === "end" ? "top" : "bottom");
|
|
2255
|
+
let Zj = Z - B.top - B.bottom, Qj = G - B.left - B.right, $j = min(Z - B[Yj], Zj), eM = min(G - B[Xj], Qj), tM = !_.middlewareData.shift, nM = $j, rM = eM;
|
|
2256
|
+
if ((E = _.middlewareData.shift) != null && E.enabled.x && (rM = Qj), (O = _.middlewareData.shift) != null && O.enabled.y && (nM = Zj), tM && !U) {
|
|
2256
2257
|
let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
|
|
2257
|
-
W ?
|
|
2258
|
+
W ? rM = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : nM = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
|
|
2258
2259
|
}
|
|
2259
2260
|
await P({
|
|
2260
2261
|
..._,
|
|
2261
|
-
availableWidth:
|
|
2262
|
-
availableHeight:
|
|
2262
|
+
availableWidth: rM,
|
|
2263
|
+
availableHeight: nM
|
|
2263
2264
|
});
|
|
2264
|
-
let
|
|
2265
|
-
return G !==
|
|
2265
|
+
let iM = await M.getDimensions(N.floating);
|
|
2266
|
+
return G !== iM.width || Z !== iM.height ? { reset: { rects: !0 } } : {};
|
|
2266
2267
|
}
|
|
2267
2268
|
};
|
|
2268
2269
|
};
|
|
@@ -2646,27 +2647,27 @@ function observeMove(n, _) {
|
|
|
2646
2647
|
N === void 0 && (N = !1), P === void 0 && (P = 1), j();
|
|
2647
2648
|
let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
|
|
2648
2649
|
if (N || _(), !U || !W) return;
|
|
2649
|
-
let G = floor(H), Z = floor(A.clientWidth - (B + U)),
|
|
2650
|
-
rootMargin: -G + "px " + -Z + "px " + -
|
|
2650
|
+
let G = floor(H), Z = floor(A.clientWidth - (B + U)), Yj = floor(A.clientHeight - (H + W)), Xj = floor(B), Zj = {
|
|
2651
|
+
rootMargin: -G + "px " + -Z + "px " + -Yj + "px " + -Xj + "px",
|
|
2651
2652
|
threshold: max(0, min(1, P)) || 1
|
|
2652
|
-
},
|
|
2653
|
-
function
|
|
2653
|
+
}, Qj = !0;
|
|
2654
|
+
function $j(_) {
|
|
2654
2655
|
let E = _[0].intersectionRatio;
|
|
2655
2656
|
if (E !== P) {
|
|
2656
|
-
if (!
|
|
2657
|
+
if (!Qj) return M();
|
|
2657
2658
|
E ? M(!1, E) : O = setTimeout(() => {
|
|
2658
2659
|
M(!1, 1e-7);
|
|
2659
2660
|
}, 1e3);
|
|
2660
2661
|
}
|
|
2661
|
-
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(),
|
|
2662
|
+
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Qj = !1;
|
|
2662
2663
|
}
|
|
2663
2664
|
try {
|
|
2664
|
-
E = new IntersectionObserver(
|
|
2665
|
-
...
|
|
2665
|
+
E = new IntersectionObserver($j, {
|
|
2666
|
+
...Zj,
|
|
2666
2667
|
root: A.ownerDocument
|
|
2667
2668
|
});
|
|
2668
2669
|
} catch {
|
|
2669
|
-
E = new IntersectionObserver(
|
|
2670
|
+
E = new IntersectionObserver($j, Zj);
|
|
2670
2671
|
}
|
|
2671
2672
|
E.observe(n);
|
|
2672
2673
|
}
|
|
@@ -2687,10 +2688,10 @@ function autoUpdate(n, _, E, O) {
|
|
|
2687
2688
|
})), E();
|
|
2688
2689
|
}), z && !P && W.observe(z), W.observe(_));
|
|
2689
2690
|
let G, Z = P ? getBoundingClientRect(n) : null;
|
|
2690
|
-
P &&
|
|
2691
|
-
function
|
|
2691
|
+
P && Yj();
|
|
2692
|
+
function Yj() {
|
|
2692
2693
|
let _ = getBoundingClientRect(n);
|
|
2693
|
-
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(
|
|
2694
|
+
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Yj);
|
|
2694
2695
|
}
|
|
2695
2696
|
return E(), () => {
|
|
2696
2697
|
var n;
|
|
@@ -2757,23 +2758,23 @@ function useFloating(_) {
|
|
|
2757
2758
|
isPositioned: !1
|
|
2758
2759
|
}), [W, G] = React$1.useState(A);
|
|
2759
2760
|
deepEqual(W, A) || G(A);
|
|
2760
|
-
let [Z,
|
|
2761
|
-
n !==
|
|
2762
|
-
}, []),
|
|
2763
|
-
n !==
|
|
2764
|
-
}, []),
|
|
2765
|
-
if (!
|
|
2761
|
+
let [Z, Yj] = React$1.useState(null), [Xj, Zj] = React$1.useState(null), Qj = React$1.useCallback((n) => {
|
|
2762
|
+
n !== rM.current && (rM.current = n, Yj(n));
|
|
2763
|
+
}, []), $j = React$1.useCallback((n) => {
|
|
2764
|
+
n !== iM.current && (iM.current = n, Zj(n));
|
|
2765
|
+
}, []), tM = M || Z, nM = N || Xj, rM = React$1.useRef(null), iM = React$1.useRef(null), aM = React$1.useRef(H), oM = z != null, sM = useLatestRef(z), cM = useLatestRef(j), lM = useLatestRef(B), uM = React$1.useCallback(() => {
|
|
2766
|
+
if (!rM.current || !iM.current) return;
|
|
2766
2767
|
let n = {
|
|
2767
2768
|
placement: E,
|
|
2768
2769
|
strategy: O,
|
|
2769
2770
|
middleware: W
|
|
2770
2771
|
};
|
|
2771
|
-
|
|
2772
|
+
cM.current && (n.platform = cM.current), computePosition(rM.current, iM.current, n).then((n) => {
|
|
2772
2773
|
let _ = {
|
|
2773
2774
|
...n,
|
|
2774
|
-
isPositioned:
|
|
2775
|
+
isPositioned: lM.current !== !1
|
|
2775
2776
|
};
|
|
2776
|
-
|
|
2777
|
+
dM.current && !deepEqual(aM.current, _) && (aM.current = _, ReactDOM$1.flushSync(() => {
|
|
2777
2778
|
U(_);
|
|
2778
2779
|
}));
|
|
2779
2780
|
});
|
|
@@ -2781,50 +2782,50 @@ function useFloating(_) {
|
|
|
2781
2782
|
W,
|
|
2782
2783
|
E,
|
|
2783
2784
|
O,
|
|
2784
|
-
|
|
2785
|
-
|
|
2785
|
+
cM,
|
|
2786
|
+
lM
|
|
2786
2787
|
]);
|
|
2787
2788
|
index(() => {
|
|
2788
|
-
B === !1 &&
|
|
2789
|
+
B === !1 && aM.current.isPositioned && (aM.current.isPositioned = !1, U((n) => ({
|
|
2789
2790
|
...n,
|
|
2790
2791
|
isPositioned: !1
|
|
2791
2792
|
})));
|
|
2792
2793
|
}, [B]);
|
|
2793
|
-
let
|
|
2794
|
-
index(() => (
|
|
2795
|
-
|
|
2794
|
+
let dM = React$1.useRef(!1);
|
|
2795
|
+
index(() => (dM.current = !0, () => {
|
|
2796
|
+
dM.current = !1;
|
|
2796
2797
|
}), []), index(() => {
|
|
2797
|
-
if (
|
|
2798
|
-
if (
|
|
2799
|
-
|
|
2798
|
+
if (tM && (rM.current = tM), nM && (iM.current = nM), tM && nM) {
|
|
2799
|
+
if (sM.current) return sM.current(tM, nM, uM);
|
|
2800
|
+
uM();
|
|
2800
2801
|
}
|
|
2801
2802
|
}, [
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2803
|
+
tM,
|
|
2804
|
+
nM,
|
|
2805
|
+
uM,
|
|
2806
|
+
sM,
|
|
2807
|
+
oM
|
|
2807
2808
|
]);
|
|
2808
|
-
let
|
|
2809
|
-
reference:
|
|
2810
|
-
floating:
|
|
2811
|
-
setReference:
|
|
2812
|
-
setFloating:
|
|
2813
|
-
}), [
|
|
2814
|
-
reference:
|
|
2815
|
-
floating:
|
|
2816
|
-
}), [
|
|
2809
|
+
let fM = React$1.useMemo(() => ({
|
|
2810
|
+
reference: rM,
|
|
2811
|
+
floating: iM,
|
|
2812
|
+
setReference: Qj,
|
|
2813
|
+
setFloating: $j
|
|
2814
|
+
}), [Qj, $j]), pM = React$1.useMemo(() => ({
|
|
2815
|
+
reference: tM,
|
|
2816
|
+
floating: nM
|
|
2817
|
+
}), [tM, nM]), mM = React$1.useMemo(() => {
|
|
2817
2818
|
let n = {
|
|
2818
2819
|
position: O,
|
|
2819
2820
|
left: 0,
|
|
2820
2821
|
top: 0
|
|
2821
2822
|
};
|
|
2822
|
-
if (!
|
|
2823
|
-
let _ = roundByDPR(
|
|
2823
|
+
if (!pM.floating) return n;
|
|
2824
|
+
let _ = roundByDPR(pM.floating, H.x), E = roundByDPR(pM.floating, H.y);
|
|
2824
2825
|
return P ? {
|
|
2825
2826
|
...n,
|
|
2826
2827
|
transform: "translate(" + _ + "px, " + E + "px)",
|
|
2827
|
-
...getDPR(
|
|
2828
|
+
...getDPR(pM.floating) >= 1.5 && { willChange: "transform" }
|
|
2828
2829
|
} : {
|
|
2829
2830
|
position: O,
|
|
2830
2831
|
left: _,
|
|
@@ -2833,22 +2834,22 @@ function useFloating(_) {
|
|
|
2833
2834
|
}, [
|
|
2834
2835
|
O,
|
|
2835
2836
|
P,
|
|
2836
|
-
|
|
2837
|
+
pM.floating,
|
|
2837
2838
|
H.x,
|
|
2838
2839
|
H.y
|
|
2839
2840
|
]);
|
|
2840
2841
|
return React$1.useMemo(() => ({
|
|
2841
2842
|
...H,
|
|
2842
|
-
update:
|
|
2843
|
-
refs:
|
|
2844
|
-
elements:
|
|
2845
|
-
floatingStyles:
|
|
2843
|
+
update: uM,
|
|
2844
|
+
refs: fM,
|
|
2845
|
+
elements: pM,
|
|
2846
|
+
floatingStyles: mM
|
|
2846
2847
|
}), [
|
|
2847
2848
|
H,
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2849
|
+
uM,
|
|
2850
|
+
fM,
|
|
2851
|
+
pM,
|
|
2852
|
+
mM
|
|
2852
2853
|
]);
|
|
2853
2854
|
}
|
|
2854
2855
|
var arrow$1$1 = (n) => {
|
|
@@ -2925,70 +2926,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
|
|
|
2925
2926
|
});
|
|
2926
2927
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
2927
2928
|
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, ...
|
|
2929
|
+
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, ...Yj } = _, Xj = usePopperContext(CONTENT_NAME$6, O), [Zj, Qj] = React$1.useState(null), $j = useComposedRefs$1(E, (n) => Qj(n)), [eM, tM] = React$1.useState(null), nM = useSize(eM), rM = nM?.width ?? 0, aM = nM?.height ?? 0, oM = A + (M === "center" ? "" : "-" + M), sM = typeof H == "number" ? H : {
|
|
2929
2930
|
top: 0,
|
|
2930
2931
|
right: 0,
|
|
2931
2932
|
bottom: 0,
|
|
2932
2933
|
left: 0,
|
|
2933
2934
|
...H
|
|
2934
|
-
},
|
|
2935
|
-
padding:
|
|
2936
|
-
boundary:
|
|
2937
|
-
altBoundary:
|
|
2938
|
-
}, { refs:
|
|
2935
|
+
}, cM = Array.isArray(B) ? B : [B], lM = cM.length > 0, uM = {
|
|
2936
|
+
padding: sM,
|
|
2937
|
+
boundary: cM.filter(isNotNull$2),
|
|
2938
|
+
altBoundary: lM
|
|
2939
|
+
}, { refs: dM, floatingStyles: fM, placement: pM, isPositioned: mM, middlewareData: hM } = useFloating({
|
|
2939
2940
|
strategy: "fixed",
|
|
2940
|
-
placement:
|
|
2941
|
+
placement: oM,
|
|
2941
2942
|
whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
|
|
2942
|
-
elements: { reference:
|
|
2943
|
+
elements: { reference: Xj.anchor },
|
|
2943
2944
|
middleware: [
|
|
2944
2945
|
offset({
|
|
2945
|
-
mainAxis: j +
|
|
2946
|
+
mainAxis: j + aM,
|
|
2946
2947
|
alignmentAxis: N
|
|
2947
2948
|
}),
|
|
2948
2949
|
z && shift({
|
|
2949
2950
|
mainAxis: !0,
|
|
2950
2951
|
crossAxis: !1,
|
|
2951
2952
|
limiter: U === "partial" ? limitShift() : void 0,
|
|
2952
|
-
...
|
|
2953
|
+
...uM
|
|
2953
2954
|
}),
|
|
2954
|
-
z && flip({ ...
|
|
2955
|
+
z && flip({ ...uM }),
|
|
2955
2956
|
size({
|
|
2956
|
-
...
|
|
2957
|
+
...uM,
|
|
2957
2958
|
apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
|
|
2958
2959
|
let { width: A, height: j } = _.reference, M = n.floating.style;
|
|
2959
2960
|
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
2961
|
}
|
|
2961
2962
|
}),
|
|
2962
|
-
|
|
2963
|
-
element:
|
|
2963
|
+
eM && arrow({
|
|
2964
|
+
element: eM,
|
|
2964
2965
|
padding: P
|
|
2965
2966
|
}),
|
|
2966
2967
|
transformOrigin({
|
|
2967
|
-
arrowWidth:
|
|
2968
|
-
arrowHeight:
|
|
2968
|
+
arrowWidth: rM,
|
|
2969
|
+
arrowHeight: aM
|
|
2969
2970
|
}),
|
|
2970
2971
|
W && hide({
|
|
2971
2972
|
strategy: "referenceHidden",
|
|
2972
|
-
...
|
|
2973
|
+
...uM
|
|
2973
2974
|
})
|
|
2974
2975
|
]
|
|
2975
|
-
}), [
|
|
2976
|
+
}), [gM, _M] = getSideAndAlignFromPlacement(pM), vM = useCallbackRef(Z);
|
|
2976
2977
|
useLayoutEffect2(() => {
|
|
2977
|
-
|
|
2978
|
-
}, [
|
|
2979
|
-
let
|
|
2978
|
+
mM && vM?.();
|
|
2979
|
+
}, [mM, vM]);
|
|
2980
|
+
let yM = hM.arrow?.x, bM = hM.arrow?.y, xM = hM.arrow?.centerOffset !== 0, [SM, CM] = React$1.useState();
|
|
2980
2981
|
return useLayoutEffect2(() => {
|
|
2981
|
-
|
|
2982
|
-
}, [
|
|
2983
|
-
ref:
|
|
2982
|
+
Zj && CM(window.getComputedStyle(Zj).zIndex);
|
|
2983
|
+
}, [Zj]), /* @__PURE__ */ jsx("div", {
|
|
2984
|
+
ref: dM.setFloating,
|
|
2984
2985
|
"data-radix-popper-content-wrapper": "",
|
|
2985
2986
|
style: {
|
|
2986
|
-
...
|
|
2987
|
-
transform:
|
|
2987
|
+
...fM,
|
|
2988
|
+
transform: mM ? fM.transform : "translate(0, -200%)",
|
|
2988
2989
|
minWidth: "max-content",
|
|
2989
|
-
zIndex:
|
|
2990
|
-
"--radix-popper-transform-origin": [
|
|
2991
|
-
...
|
|
2990
|
+
zIndex: SM,
|
|
2991
|
+
"--radix-popper-transform-origin": [hM.transformOrigin?.x, hM.transformOrigin?.y].join(" "),
|
|
2992
|
+
...hM.hide?.referenceHidden && {
|
|
2992
2993
|
visibility: "hidden",
|
|
2993
2994
|
pointerEvents: "none"
|
|
2994
2995
|
}
|
|
@@ -2996,19 +2997,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
2996
2997
|
dir: _.dir,
|
|
2997
2998
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
2998
2999
|
scope: O,
|
|
2999
|
-
placedSide:
|
|
3000
|
-
onArrowChange:
|
|
3001
|
-
arrowX:
|
|
3002
|
-
arrowY:
|
|
3003
|
-
shouldHideArrow:
|
|
3000
|
+
placedSide: gM,
|
|
3001
|
+
onArrowChange: tM,
|
|
3002
|
+
arrowX: yM,
|
|
3003
|
+
arrowY: bM,
|
|
3004
|
+
shouldHideArrow: xM,
|
|
3004
3005
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3005
|
-
"data-side":
|
|
3006
|
-
"data-align":
|
|
3007
|
-
...
|
|
3008
|
-
ref:
|
|
3006
|
+
"data-side": gM,
|
|
3007
|
+
"data-align": _M,
|
|
3008
|
+
...Yj,
|
|
3009
|
+
ref: $j,
|
|
3009
3010
|
style: {
|
|
3010
|
-
...
|
|
3011
|
-
animation:
|
|
3011
|
+
...Yj.style,
|
|
3012
|
+
animation: mM ? void 0 : "none"
|
|
3012
3013
|
}
|
|
3013
3014
|
})
|
|
3014
3015
|
})
|
|
@@ -3091,27 +3092,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
|
|
|
3091
3092
|
}));
|
|
3092
3093
|
RovingFocusGroup.displayName = GROUP_NAME$3;
|
|
3093
3094
|
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), [
|
|
3095
|
+
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), [Yj, Xj] = useControllableState({
|
|
3095
3096
|
prop: N,
|
|
3096
3097
|
defaultProp: P ?? null,
|
|
3097
3098
|
onChange: z,
|
|
3098
3099
|
caller: GROUP_NAME$3
|
|
3099
|
-
}), [
|
|
3100
|
+
}), [Zj, Qj] = React$1.useState(!1), $j = useCallbackRef(B), eM = useCollection$1(O), tM = React$1.useRef(!1), [nM, rM] = React$1.useState(0);
|
|
3100
3101
|
return React$1.useEffect(() => {
|
|
3101
3102
|
let n = W.current;
|
|
3102
|
-
if (n) return n.addEventListener(ENTRY_FOCUS,
|
|
3103
|
-
}, [
|
|
3103
|
+
if (n) return n.addEventListener(ENTRY_FOCUS, $j), () => n.removeEventListener(ENTRY_FOCUS, $j);
|
|
3104
|
+
}, [$j]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
3104
3105
|
scope: O,
|
|
3105
3106
|
orientation: A,
|
|
3106
3107
|
dir: Z,
|
|
3107
3108
|
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(() =>
|
|
3109
|
+
currentTabStopId: Yj,
|
|
3110
|
+
onItemFocus: React$1.useCallback((n) => Xj(n), [Xj]),
|
|
3111
|
+
onItemShiftTab: React$1.useCallback(() => Qj(!0), []),
|
|
3112
|
+
onFocusableItemAdd: React$1.useCallback(() => rM((n) => n + 1), []),
|
|
3113
|
+
onFocusableItemRemove: React$1.useCallback(() => rM((n) => n - 1), []),
|
|
3113
3114
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3114
|
-
tabIndex:
|
|
3115
|
+
tabIndex: Zj || nM === 0 ? -1 : 0,
|
|
3115
3116
|
"data-orientation": A,
|
|
3116
3117
|
...U,
|
|
3117
3118
|
ref: G,
|
|
@@ -3120,28 +3121,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3120
3121
|
..._.style
|
|
3121
3122
|
},
|
|
3122
3123
|
onMouseDown: composeEventHandlers(_.onMouseDown, () => {
|
|
3123
|
-
|
|
3124
|
+
tM.current = !0;
|
|
3124
3125
|
}),
|
|
3125
3126
|
onFocus: composeEventHandlers(_.onFocus, (n) => {
|
|
3126
|
-
let _ = !
|
|
3127
|
-
if (n.target === n.currentTarget && _ && !
|
|
3127
|
+
let _ = !tM.current;
|
|
3128
|
+
if (n.target === n.currentTarget && _ && !Zj) {
|
|
3128
3129
|
let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
3129
3130
|
if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
|
|
3130
|
-
let n =
|
|
3131
|
+
let n = eM().filter((n) => n.focusable);
|
|
3131
3132
|
focusFirst$1([
|
|
3132
3133
|
n.find((n) => n.active),
|
|
3133
|
-
n.find((n) => n.id ===
|
|
3134
|
+
n.find((n) => n.id === Yj),
|
|
3134
3135
|
...n
|
|
3135
3136
|
].filter(Boolean).map((n) => n.ref.current), H);
|
|
3136
3137
|
}
|
|
3137
3138
|
}
|
|
3138
|
-
|
|
3139
|
+
tM.current = !1;
|
|
3139
3140
|
}),
|
|
3140
|
-
onBlur: composeEventHandlers(_.onBlur, () =>
|
|
3141
|
+
onBlur: composeEventHandlers(_.onBlur, () => Qj(!1))
|
|
3141
3142
|
})
|
|
3142
3143
|
});
|
|
3143
3144
|
}), 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:
|
|
3145
|
+
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: Yj } = H;
|
|
3145
3146
|
return React$1.useEffect(() => {
|
|
3146
3147
|
if (A) return G(), () => Z();
|
|
3147
3148
|
}, [
|
|
@@ -3184,7 +3185,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3184
3185
|
}),
|
|
3185
3186
|
children: typeof N == "function" ? N({
|
|
3186
3187
|
isCurrentTabStop: U,
|
|
3187
|
-
hasTabStop:
|
|
3188
|
+
hasTabStop: Yj != null
|
|
3188
3189
|
}) : N
|
|
3189
3190
|
})
|
|
3190
3191
|
});
|
|
@@ -3335,40 +3336,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3335
3336
|
onDismiss: () => E.onOpenChange(!1)
|
|
3336
3337
|
});
|
|
3337
3338
|
}), 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, ...
|
|
3339
|
+
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, ...Yj } = _, Xj = useMenuContext(CONTENT_NAME$5, O), Zj = useMenuRootContext(CONTENT_NAME$5, O), Qj = usePopperScope$2(O), $j = useRovingFocusGroupScope$1(O), eM = useCollection(O), [tM, nM] = React$1.useState(null), rM = React$1.useRef(null), aM = useComposedRefs$1(E, rM, Xj.onContentChange), oM = React$1.useRef(0), sM = React$1.useRef(""), cM = React$1.useRef(0), lM = React$1.useRef(null), uM = React$1.useRef("right"), dM = React$1.useRef(0), fM = Z ? Combination_default : React$1.Fragment, pM = Z ? {
|
|
3339
3340
|
as: Slot$1,
|
|
3340
3341
|
allowPinchZoom: !0
|
|
3341
|
-
} : void 0,
|
|
3342
|
-
let _ =
|
|
3342
|
+
} : void 0, mM = (n) => {
|
|
3343
|
+
let _ = sM.current + n, E = eM().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
3344
|
(function n(_) {
|
|
3344
|
-
|
|
3345
|
+
sM.current = _, window.clearTimeout(oM.current), _ !== "" && (oM.current = window.setTimeout(() => n(""), 1e3));
|
|
3345
3346
|
})(_), M && setTimeout(() => M.focus());
|
|
3346
3347
|
};
|
|
3347
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
3348
|
-
let
|
|
3348
|
+
React$1.useEffect(() => () => window.clearTimeout(oM.current), []), useFocusGuards();
|
|
3349
|
+
let hM = React$1.useCallback((n) => uM.current === lM.current?.side && isPointerInGraceArea(n, lM.current?.area), []);
|
|
3349
3350
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
3350
3351
|
scope: O,
|
|
3351
|
-
searchRef:
|
|
3352
|
+
searchRef: sM,
|
|
3352
3353
|
onItemEnter: React$1.useCallback((n) => {
|
|
3353
|
-
|
|
3354
|
-
}, [
|
|
3354
|
+
hM(n) && n.preventDefault();
|
|
3355
|
+
}, [hM]),
|
|
3355
3356
|
onItemLeave: React$1.useCallback((n) => {
|
|
3356
|
-
|
|
3357
|
-
}, [
|
|
3357
|
+
hM(n) || (rM.current?.focus(), nM(null));
|
|
3358
|
+
}, [hM]),
|
|
3358
3359
|
onTriggerLeave: React$1.useCallback((n) => {
|
|
3359
|
-
|
|
3360
|
-
}, [
|
|
3361
|
-
pointerGraceTimerRef:
|
|
3360
|
+
hM(n) && n.preventDefault();
|
|
3361
|
+
}, [hM]),
|
|
3362
|
+
pointerGraceTimerRef: cM,
|
|
3362
3363
|
onPointerGraceIntentChange: React$1.useCallback((n) => {
|
|
3363
|
-
|
|
3364
|
+
lM.current = n;
|
|
3364
3365
|
}, []),
|
|
3365
|
-
children: /* @__PURE__ */ jsx(
|
|
3366
|
-
...
|
|
3366
|
+
children: /* @__PURE__ */ jsx(fM, {
|
|
3367
|
+
...pM,
|
|
3367
3368
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
3368
3369
|
asChild: !0,
|
|
3369
3370
|
trapped: j,
|
|
3370
3371
|
onMountAutoFocus: composeEventHandlers(M, (n) => {
|
|
3371
|
-
n.preventDefault(),
|
|
3372
|
+
n.preventDefault(), rM.current?.focus({ preventScroll: !0 });
|
|
3372
3373
|
}),
|
|
3373
3374
|
onUnmountAutoFocus: N,
|
|
3374
3375
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3381,44 +3382,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3381
3382
|
onDismiss: G,
|
|
3382
3383
|
children: /* @__PURE__ */ jsx(Root$2, {
|
|
3383
3384
|
asChild: !0,
|
|
3384
|
-
|
|
3385
|
-
dir:
|
|
3385
|
+
...$j,
|
|
3386
|
+
dir: Zj.dir,
|
|
3386
3387
|
orientation: "vertical",
|
|
3387
3388
|
loop: A,
|
|
3388
|
-
currentTabStopId:
|
|
3389
|
-
onCurrentTabStopIdChange:
|
|
3389
|
+
currentTabStopId: tM,
|
|
3390
|
+
onCurrentTabStopIdChange: nM,
|
|
3390
3391
|
onEntryFocus: composeEventHandlers(z, (n) => {
|
|
3391
|
-
|
|
3392
|
+
Zj.isUsingKeyboardRef.current || n.preventDefault();
|
|
3392
3393
|
}),
|
|
3393
3394
|
preventScrollOnEntryFocus: !0,
|
|
3394
3395
|
children: /* @__PURE__ */ jsx(Content$1, {
|
|
3395
3396
|
role: "menu",
|
|
3396
3397
|
"aria-orientation": "vertical",
|
|
3397
|
-
"data-state": getOpenState(
|
|
3398
|
+
"data-state": getOpenState(Xj.open),
|
|
3398
3399
|
"data-radix-menu-content": "",
|
|
3399
|
-
dir:
|
|
3400
|
-
...
|
|
3401
|
-
...
|
|
3402
|
-
ref:
|
|
3400
|
+
dir: Zj.dir,
|
|
3401
|
+
...Qj,
|
|
3402
|
+
...Yj,
|
|
3403
|
+
ref: aM,
|
|
3403
3404
|
style: {
|
|
3404
3405
|
outline: "none",
|
|
3405
|
-
...
|
|
3406
|
+
...Yj.style
|
|
3406
3407
|
},
|
|
3407
|
-
onKeyDown: composeEventHandlers(
|
|
3408
|
+
onKeyDown: composeEventHandlers(Yj.onKeyDown, (n) => {
|
|
3408
3409
|
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 =
|
|
3410
|
+
_ && (n.key === "Tab" && n.preventDefault(), !E && O && mM(n.key));
|
|
3411
|
+
let A = rM.current;
|
|
3411
3412
|
if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
|
|
3412
3413
|
n.preventDefault();
|
|
3413
|
-
let j =
|
|
3414
|
+
let j = eM().filter((n) => !n.disabled).map((n) => n.ref.current);
|
|
3414
3415
|
LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
|
|
3415
3416
|
}),
|
|
3416
3417
|
onBlur: composeEventHandlers(_.onBlur, (n) => {
|
|
3417
|
-
n.currentTarget.contains(n.target) || (window.clearTimeout(
|
|
3418
|
+
n.currentTarget.contains(n.target) || (window.clearTimeout(oM.current), sM.current = "");
|
|
3418
3419
|
}),
|
|
3419
3420
|
onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
|
|
3420
|
-
let _ = n.target, E =
|
|
3421
|
-
n.currentTarget.contains(_) && E && (
|
|
3421
|
+
let _ = n.target, E = dM.current !== n.clientX;
|
|
3422
|
+
n.currentTarget.contains(_) && E && (uM.current = n.clientX > dM.current ? "right" : "left", dM.current = n.clientX);
|
|
3422
3423
|
}))
|
|
3423
3424
|
})
|
|
3424
3425
|
})
|
|
@@ -4366,11 +4367,11 @@ function useStateMachine(_, E) {
|
|
|
4366
4367
|
return React$1.useReducer((n, _) => E[n][_] ?? n, _);
|
|
4367
4368
|
}
|
|
4368
4369
|
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), [
|
|
4370
|
+
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), [Yj, Xj] = React$1.useState(null), [Zj, Qj] = React$1.useState(0), [$j, eM] = React$1.useState(0), [tM, nM] = React$1.useState(!1), [rM, aM] = React$1.useState(!1), oM = useComposedRefs$1(E, (n) => z(n)), sM = useDirection(j);
|
|
4370
4371
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
4371
4372
|
scope: O,
|
|
4372
4373
|
type: A,
|
|
4373
|
-
dir:
|
|
4374
|
+
dir: sM,
|
|
4374
4375
|
scrollHideDelay: M,
|
|
4375
4376
|
scrollArea: P,
|
|
4376
4377
|
viewport: B,
|
|
@@ -4379,22 +4380,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
|
|
|
4379
4380
|
onContentChange: W,
|
|
4380
4381
|
scrollbarX: G,
|
|
4381
4382
|
onScrollbarXChange: Z,
|
|
4382
|
-
scrollbarXEnabled:
|
|
4383
|
-
onScrollbarXEnabledChange:
|
|
4384
|
-
scrollbarY:
|
|
4385
|
-
onScrollbarYChange:
|
|
4386
|
-
scrollbarYEnabled:
|
|
4387
|
-
onScrollbarYEnabledChange:
|
|
4388
|
-
onCornerWidthChange:
|
|
4389
|
-
onCornerHeightChange:
|
|
4383
|
+
scrollbarXEnabled: tM,
|
|
4384
|
+
onScrollbarXEnabledChange: nM,
|
|
4385
|
+
scrollbarY: Yj,
|
|
4386
|
+
onScrollbarYChange: Xj,
|
|
4387
|
+
scrollbarYEnabled: rM,
|
|
4388
|
+
onScrollbarYEnabledChange: aM,
|
|
4389
|
+
onCornerWidthChange: Qj,
|
|
4390
|
+
onCornerHeightChange: eM,
|
|
4390
4391
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4391
|
-
dir:
|
|
4392
|
+
dir: sM,
|
|
4392
4393
|
...N,
|
|
4393
|
-
ref:
|
|
4394
|
+
ref: oM,
|
|
4394
4395
|
style: {
|
|
4395
4396
|
position: "relative",
|
|
4396
|
-
"--radix-scroll-area-corner-width":
|
|
4397
|
-
"--radix-scroll-area-corner-height":
|
|
4397
|
+
"--radix-scroll-area-corner-width": Zj + "px",
|
|
4398
|
+
"--radix-scroll-area-corner-height": $j + "px",
|
|
4398
4399
|
..._.style
|
|
4399
4400
|
}
|
|
4400
4401
|
})
|
|
@@ -4665,46 +4666,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
|
|
|
4665
4666
|
}
|
|
4666
4667
|
});
|
|
4667
4668
|
}), [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 -
|
|
4669
|
+
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, Yj] = React$1.useState(null), Xj = useComposedRefs$1(E, (n) => Yj(n)), Zj = React$1.useRef(null), Qj = React$1.useRef(""), $j = G.viewport, eM = A.content - A.viewport, tM = useCallbackRef(H), nM = useCallbackRef(z), rM = useDebounceCallback(U, 10);
|
|
4670
|
+
function aM(n) {
|
|
4671
|
+
Zj.current && B({
|
|
4672
|
+
x: n.clientX - Zj.current.left,
|
|
4673
|
+
y: n.clientY - Zj.current.top
|
|
4673
4674
|
});
|
|
4674
4675
|
}
|
|
4675
4676
|
return React$1.useEffect(() => {
|
|
4676
4677
|
let n = (n) => {
|
|
4677
4678
|
let _ = n.target;
|
|
4678
|
-
Z?.contains(_) &&
|
|
4679
|
+
Z?.contains(_) && tM(n, eM);
|
|
4679
4680
|
};
|
|
4680
4681
|
return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
|
|
4681
4682
|
}, [
|
|
4682
|
-
|
|
4683
|
+
$j,
|
|
4683
4684
|
Z,
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
]), React$1.useEffect(
|
|
4685
|
+
eM,
|
|
4686
|
+
tM
|
|
4687
|
+
]), React$1.useEffect(nM, [A, nM]), useResizeObserver(Z, rM), useResizeObserver(G.content, rM), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4687
4688
|
scope: O,
|
|
4688
4689
|
scrollbar: Z,
|
|
4689
4690
|
hasThumb: j,
|
|
4690
4691
|
onThumbChange: useCallbackRef(M),
|
|
4691
4692
|
onThumbPointerUp: useCallbackRef(N),
|
|
4692
|
-
onThumbPositionChange:
|
|
4693
|
+
onThumbPositionChange: nM,
|
|
4693
4694
|
onThumbPointerDown: useCallbackRef(P),
|
|
4694
4695
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4695
4696
|
...W,
|
|
4696
|
-
ref:
|
|
4697
|
+
ref: Xj,
|
|
4697
4698
|
style: {
|
|
4698
4699
|
position: "absolute",
|
|
4699
4700
|
...W.style
|
|
4700
4701
|
},
|
|
4701
4702
|
onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
|
|
4702
|
-
n.button === 0 && (n.target.setPointerCapture(n.pointerId),
|
|
4703
|
+
n.button === 0 && (n.target.setPointerCapture(n.pointerId), Zj.current = Z.getBoundingClientRect(), Qj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), aM(n));
|
|
4703
4704
|
}),
|
|
4704
|
-
onPointerMove: composeEventHandlers(_.onPointerMove,
|
|
4705
|
+
onPointerMove: composeEventHandlers(_.onPointerMove, aM),
|
|
4705
4706
|
onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
|
|
4706
4707
|
let _ = n.target;
|
|
4707
|
-
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect =
|
|
4708
|
+
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Qj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), Zj.current = null;
|
|
4708
4709
|
})
|
|
4709
4710
|
})
|
|
4710
4711
|
});
|
|
@@ -4846,7 +4847,7 @@ function useResizeObserver(n, _) {
|
|
|
4846
4847
|
}, [n, E]);
|
|
4847
4848
|
}
|
|
4848
4849
|
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)),
|
|
4850
|
+
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)), Yj = React$1.useRef(!1), Xj = W ? H || !!W.closest("form") : !0, [Zj, Qj] = useControllableState({
|
|
4850
4851
|
prop: j,
|
|
4851
4852
|
defaultProp: M ?? !1,
|
|
4852
4853
|
onChange: B,
|
|
@@ -4854,28 +4855,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
|
|
|
4854
4855
|
});
|
|
4855
4856
|
return /* @__PURE__ */ jsxs(SwitchProvider, {
|
|
4856
4857
|
scope: O,
|
|
4857
|
-
checked:
|
|
4858
|
+
checked: Zj,
|
|
4858
4859
|
disabled: P,
|
|
4859
4860
|
children: [/* @__PURE__ */ jsx(Primitive.button, {
|
|
4860
4861
|
type: "button",
|
|
4861
4862
|
role: "switch",
|
|
4862
|
-
"aria-checked":
|
|
4863
|
+
"aria-checked": Zj,
|
|
4863
4864
|
"aria-required": N,
|
|
4864
|
-
"data-state": getState(
|
|
4865
|
+
"data-state": getState(Zj),
|
|
4865
4866
|
"data-disabled": P ? "" : void 0,
|
|
4866
4867
|
disabled: P,
|
|
4867
4868
|
value: z,
|
|
4868
4869
|
...U,
|
|
4869
4870
|
ref: Z,
|
|
4870
4871
|
onClick: composeEventHandlers(_.onClick, (n) => {
|
|
4871
|
-
|
|
4872
|
+
Qj((n) => !n), Xj && (Yj.current = n.isPropagationStopped(), Yj.current || n.stopPropagation());
|
|
4872
4873
|
})
|
|
4873
|
-
}),
|
|
4874
|
+
}), Xj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
|
|
4874
4875
|
control: W,
|
|
4875
|
-
bubbles: !
|
|
4876
|
+
bubbles: !Yj.current,
|
|
4876
4877
|
name: A,
|
|
4877
4878
|
value: z,
|
|
4878
|
-
checked:
|
|
4879
|
+
checked: Zj,
|
|
4879
4880
|
required: N,
|
|
4880
4881
|
disabled: P,
|
|
4881
4882
|
form: H,
|
|
@@ -5059,22 +5060,22 @@ var Root2 = Tabs, List = TabsList, Trigger = TabsTrigger, Content = TabsContent,
|
|
|
5059
5060
|
};
|
|
5060
5061
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
5061
5062
|
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,
|
|
5063
|
+
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, Yj = P ?? z.delayDuration, Xj = React$1.useRef(!1), [Zj, Qj] = useControllableState({
|
|
5063
5064
|
prop: A,
|
|
5064
5065
|
defaultProp: j ?? !1,
|
|
5065
5066
|
onChange: (n) => {
|
|
5066
5067
|
n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
|
|
5067
5068
|
},
|
|
5068
5069
|
caller: TOOLTIP_NAME
|
|
5069
|
-
}),
|
|
5070
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5071
|
-
}, [
|
|
5072
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5073
|
-
}, [
|
|
5070
|
+
}), $j = React$1.useMemo(() => Zj ? Xj.current ? "delayed-open" : "instant-open" : "closed", [Zj]), eM = React$1.useCallback(() => {
|
|
5071
|
+
window.clearTimeout(G.current), G.current = 0, Xj.current = !1, Qj(!0);
|
|
5072
|
+
}, [Qj]), tM = React$1.useCallback(() => {
|
|
5073
|
+
window.clearTimeout(G.current), G.current = 0, Qj(!1);
|
|
5074
|
+
}, [Qj]), nM = React$1.useCallback(() => {
|
|
5074
5075
|
window.clearTimeout(G.current), G.current = window.setTimeout(() => {
|
|
5075
|
-
|
|
5076
|
-
},
|
|
5077
|
-
}, [
|
|
5076
|
+
Xj.current = !0, Qj(!0), G.current = 0;
|
|
5077
|
+
}, Yj);
|
|
5078
|
+
}, [Yj, Qj]);
|
|
5078
5079
|
return React$1.useEffect(() => () => {
|
|
5079
5080
|
G.current &&= (window.clearTimeout(G.current), 0);
|
|
5080
5081
|
}, []), /* @__PURE__ */ jsx(Root2$4, {
|
|
@@ -5082,22 +5083,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
|
|
|
5082
5083
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
5083
5084
|
scope: E,
|
|
5084
5085
|
contentId: W,
|
|
5085
|
-
open:
|
|
5086
|
-
stateAttribute:
|
|
5086
|
+
open: Zj,
|
|
5087
|
+
stateAttribute: $j,
|
|
5087
5088
|
trigger: H,
|
|
5088
5089
|
onTriggerChange: U,
|
|
5089
5090
|
onTriggerEnter: React$1.useCallback(() => {
|
|
5090
|
-
z.isOpenDelayedRef.current ?
|
|
5091
|
+
z.isOpenDelayedRef.current ? nM() : eM();
|
|
5091
5092
|
}, [
|
|
5092
5093
|
z.isOpenDelayedRef,
|
|
5093
|
-
|
|
5094
|
-
|
|
5094
|
+
nM,
|
|
5095
|
+
eM
|
|
5095
5096
|
]),
|
|
5096
5097
|
onTriggerLeave: React$1.useCallback(() => {
|
|
5097
|
-
Z ?
|
|
5098
|
-
}, [
|
|
5099
|
-
onOpen:
|
|
5100
|
-
onClose:
|
|
5098
|
+
Z ? tM() : (window.clearTimeout(G.current), G.current = 0);
|
|
5099
|
+
}, [tM, Z]),
|
|
5100
|
+
onOpen: eM,
|
|
5101
|
+
onClose: tM,
|
|
5101
5102
|
disableHoverableContent: Z,
|
|
5102
5103
|
children: O
|
|
5103
5104
|
})
|
|
@@ -5910,14 +5911,14 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5910
5911
|
React$1.useEffect(() => U(O), [O]);
|
|
5911
5912
|
let [W, G] = React$1.useState(A);
|
|
5912
5913
|
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(() =>
|
|
5914
|
+
let [Z, Yj] = React$1.useState(j);
|
|
5915
|
+
React$1.useEffect(() => Yj(j), [j]);
|
|
5916
|
+
let [Xj, Zj] = React$1.useState(M);
|
|
5917
|
+
React$1.useEffect(() => Zj(M), [M]);
|
|
5918
|
+
let [Qj, $j] = React$1.useState(N);
|
|
5919
|
+
React$1.useEffect(() => $j(N), [N]);
|
|
5920
|
+
let [eM, tM] = React$1.useState(P);
|
|
5921
|
+
return React$1.useEffect(() => tM(P), [P]), React$1.createElement(A$2, {
|
|
5921
5922
|
...B,
|
|
5922
5923
|
ref: E,
|
|
5923
5924
|
isRoot: !0,
|
|
@@ -5925,62 +5926,62 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5925
5926
|
appearance: H,
|
|
5926
5927
|
accentColor: W,
|
|
5927
5928
|
grayColor: Z,
|
|
5928
|
-
panelBackground:
|
|
5929
|
-
radius:
|
|
5930
|
-
scaling:
|
|
5929
|
+
panelBackground: Xj,
|
|
5930
|
+
radius: Qj,
|
|
5931
|
+
scaling: eM,
|
|
5931
5932
|
onAppearanceChange: U,
|
|
5932
5933
|
onAccentColorChange: G,
|
|
5933
|
-
onGrayColorChange:
|
|
5934
|
-
onPanelBackgroundChange:
|
|
5935
|
-
onRadiusChange:
|
|
5936
|
-
onScalingChange:
|
|
5934
|
+
onGrayColorChange: Yj,
|
|
5935
|
+
onPanelBackgroundChange: Zj,
|
|
5936
|
+
onRadiusChange: $j,
|
|
5937
|
+
onScalingChange: tM
|
|
5937
5938
|
});
|
|
5938
5939
|
});
|
|
5939
5940
|
I$3.displayName = "ThemeRoot";
|
|
5940
5941
|
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:
|
|
5942
|
+
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: Yj = d$5, onRadiusChange: Xj = d$5, onScalingChange: Zj = d$5, ...Qj } = _, $j = A ? Slot$3 : "div", eM = z === "auto" ? a$12(P) : z, tM = _.appearance === "light" || _.appearance === "dark", nM = M === void 0 ? j || tM : M;
|
|
5942
5943
|
return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
|
|
5943
5944
|
appearance: N,
|
|
5944
5945
|
accentColor: P,
|
|
5945
5946
|
grayColor: z,
|
|
5946
|
-
resolvedGrayColor:
|
|
5947
|
+
resolvedGrayColor: eM,
|
|
5947
5948
|
panelBackground: B,
|
|
5948
5949
|
radius: H,
|
|
5949
5950
|
scaling: U,
|
|
5950
5951
|
onAppearanceChange: W,
|
|
5951
5952
|
onAccentColorChange: G,
|
|
5952
5953
|
onGrayColorChange: Z,
|
|
5953
|
-
onPanelBackgroundChange:
|
|
5954
|
-
onRadiusChange:
|
|
5955
|
-
onScalingChange:
|
|
5954
|
+
onPanelBackgroundChange: Yj,
|
|
5955
|
+
onRadiusChange: Xj,
|
|
5956
|
+
onScalingChange: Zj
|
|
5956
5957
|
}), [
|
|
5957
5958
|
N,
|
|
5958
5959
|
P,
|
|
5959
5960
|
z,
|
|
5960
|
-
|
|
5961
|
+
eM,
|
|
5961
5962
|
B,
|
|
5962
5963
|
H,
|
|
5963
5964
|
U,
|
|
5964
5965
|
W,
|
|
5965
5966
|
G,
|
|
5966
5967
|
Z,
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
]) }, React$1.createElement(
|
|
5968
|
+
Yj,
|
|
5969
|
+
Xj,
|
|
5970
|
+
Zj
|
|
5971
|
+
]) }, React$1.createElement($j, {
|
|
5971
5972
|
"data-is-root-theme": j ? "true" : "false",
|
|
5972
5973
|
"data-accent-color": P,
|
|
5973
|
-
"data-gray-color":
|
|
5974
|
-
"data-has-background":
|
|
5974
|
+
"data-gray-color": eM,
|
|
5975
|
+
"data-has-background": nM ? "true" : "false",
|
|
5975
5976
|
"data-panel-background": B,
|
|
5976
5977
|
"data-radius": H,
|
|
5977
5978
|
"data-scaling": U,
|
|
5978
5979
|
ref: E,
|
|
5979
|
-
...
|
|
5980
|
+
...Qj,
|
|
5980
5981
|
className: (0, import_classnames$18.default)("radix-themes", {
|
|
5981
5982
|
light: N === "light",
|
|
5982
5983
|
dark: N === "dark"
|
|
5983
|
-
},
|
|
5984
|
+
}, Qj.className)
|
|
5984
5985
|
}));
|
|
5985
5986
|
});
|
|
5986
5987
|
A$2.displayName = "ThemeImpl";
|
|
@@ -6752,7 +6753,7 @@ function S$2(n) {
|
|
|
6752
6753
|
return [(0, import_classnames$10.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
|
|
6753
6754
|
}
|
|
6754
6755
|
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:
|
|
6756
|
+
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: Yj = t$3.scrollbars.default, ...Xj } = O;
|
|
6756
6757
|
return React$1.createElement(Root$1, {
|
|
6757
6758
|
type: H,
|
|
6758
6759
|
scrollHideDelay: U,
|
|
@@ -6763,10 +6764,10 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6763
6764
|
asChild: N,
|
|
6764
6765
|
children: P
|
|
6765
6766
|
}, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
6766
|
-
...
|
|
6767
|
+
...Xj,
|
|
6767
6768
|
ref: E,
|
|
6768
6769
|
className: "rt-ScrollAreaViewport"
|
|
6769
|
-
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
6770
|
+
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Yj === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
6770
6771
|
"data-radius": Z,
|
|
6771
6772
|
orientation: "horizontal",
|
|
6772
6773
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6774,7 +6775,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6774
6775
|
value: G,
|
|
6775
6776
|
propValues: t$3.size.values
|
|
6776
6777
|
}))
|
|
6777
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6778
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Yj === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
6778
6779
|
"data-radius": Z,
|
|
6779
6780
|
orientation: "vertical",
|
|
6780
6781
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6782,7 +6783,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6782
6783
|
value: G,
|
|
6783
6784
|
propValues: t$3.size.values
|
|
6784
6785
|
}))
|
|
6785
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6786
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Yj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
6786
6787
|
});
|
|
6787
6788
|
c.displayName = "ScrollArea";
|
|
6788
6789
|
var n$2 = {
|
|
@@ -7985,17 +7986,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
7985
7986
|
E.forEach((n) => {
|
|
7986
7987
|
let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
|
|
7987
7988
|
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 &&
|
|
7989
|
+
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Yj, separatorToPanels: Xj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
|
|
7990
|
+
if (Z && W && Yj && Xj) {
|
|
7990
7991
|
let _ = Z$1({
|
|
7991
7992
|
delta: U,
|
|
7992
7993
|
initialLayout: W,
|
|
7993
7994
|
panelConstraints: Z,
|
|
7994
7995
|
pivotIndices: n.panels.map((n) => H.indexOf(n)),
|
|
7995
|
-
prevLayout:
|
|
7996
|
+
prevLayout: Yj,
|
|
7996
7997
|
trigger: "mouse-or-touch"
|
|
7997
7998
|
});
|
|
7998
|
-
if (B$1(_,
|
|
7999
|
+
if (B$1(_, Yj)) {
|
|
7999
8000
|
if (U !== 0 && !z) switch (B) {
|
|
8000
8001
|
case "horizontal":
|
|
8001
8002
|
M |= U < 0 ? De : Oe$1;
|
|
@@ -8009,7 +8010,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
8009
8010
|
defaultLayoutDeferred: G,
|
|
8010
8011
|
derivedPanelConstraints: Z,
|
|
8011
8012
|
layout: _,
|
|
8012
|
-
separatorToPanels:
|
|
8013
|
+
separatorToPanels: Xj
|
|
8013
8014
|
});
|
|
8014
8015
|
let E = n.group.panels.map(({ id: n }) => n).join(",");
|
|
8015
8016
|
n.group.inMemoryLayouts[E] = _;
|
|
@@ -8221,64 +8222,64 @@ function Pt(n, _) {
|
|
|
8221
8222
|
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
8223
|
let U = useRef({}), G = le$1((n) => {
|
|
8223
8224
|
B$1(U.current, n) || (U.current = n, P?.(n));
|
|
8224
|
-
}), Z = ae$1(N),
|
|
8225
|
+
}), Z = ae$1(N), Yj = useRef(null), [Xj, eM] = useState(!1), [tM, nM] = useState(E ?? {}), [rM, aM] = wt(), oM = useRef({
|
|
8225
8226
|
lastExpandedPanelSizes: {},
|
|
8226
8227
|
layouts: {},
|
|
8227
8228
|
panels: [],
|
|
8228
8229
|
separators: []
|
|
8229
|
-
}),
|
|
8230
|
+
}), sM = ue$1(Yj, j);
|
|
8230
8231
|
Pt(Z, M);
|
|
8231
|
-
let
|
|
8232
|
+
let cM = useMemo(() => ({
|
|
8232
8233
|
id: Z,
|
|
8233
8234
|
orientation: z,
|
|
8234
8235
|
registerPanel: (n) => {
|
|
8235
|
-
let _ =
|
|
8236
|
-
return _.panels = ie$1(z, [..._.panels, n]),
|
|
8237
|
-
_.panels = _.panels.filter((_) => _ !== n),
|
|
8236
|
+
let _ = oM.current;
|
|
8237
|
+
return _.panels = ie$1(z, [..._.panels, n]), aM(), () => {
|
|
8238
|
+
_.panels = _.panels.filter((_) => _ !== n), aM();
|
|
8238
8239
|
};
|
|
8239
8240
|
},
|
|
8240
8241
|
registerSeparator: (n) => {
|
|
8241
|
-
let _ =
|
|
8242
|
-
return _.separators = ie$1(z, [..._.separators, n]),
|
|
8243
|
-
_.separators = _.separators.filter((_) => _ !== n),
|
|
8242
|
+
let _ = oM.current;
|
|
8243
|
+
return _.separators = ie$1(z, [..._.separators, n]), aM(), () => {
|
|
8244
|
+
_.separators = _.separators.filter((_) => _ !== n), aM();
|
|
8244
8245
|
};
|
|
8245
8246
|
}
|
|
8246
8247
|
}), [
|
|
8247
8248
|
Z,
|
|
8248
|
-
|
|
8249
|
+
aM,
|
|
8249
8250
|
z
|
|
8250
|
-
]),
|
|
8251
|
+
]), lM = Lt({
|
|
8251
8252
|
defaultLayout: E,
|
|
8252
8253
|
disableCursor: O
|
|
8253
|
-
}),
|
|
8254
|
+
}), uM = useRef(null);
|
|
8254
8255
|
A$1(() => {
|
|
8255
|
-
let n =
|
|
8256
|
+
let n = Yj.current;
|
|
8256
8257
|
if (n === null) return;
|
|
8257
|
-
let _ =
|
|
8258
|
-
defaultLayout:
|
|
8259
|
-
disableCursor: !!
|
|
8258
|
+
let _ = oM.current, E = {
|
|
8259
|
+
defaultLayout: lM.defaultLayout,
|
|
8260
|
+
disableCursor: !!lM.disableCursor,
|
|
8260
8261
|
disabled: !!A,
|
|
8261
8262
|
element: n,
|
|
8262
8263
|
id: Z,
|
|
8263
|
-
inMemoryLastExpandedPanelSizes:
|
|
8264
|
-
inMemoryLayouts:
|
|
8264
|
+
inMemoryLastExpandedPanelSizes: oM.current.lastExpandedPanelSizes,
|
|
8265
|
+
inMemoryLayouts: oM.current.layouts,
|
|
8265
8266
|
orientation: z,
|
|
8266
8267
|
panels: _.panels,
|
|
8267
8268
|
separators: _.separators
|
|
8268
8269
|
};
|
|
8269
|
-
|
|
8270
|
+
uM.current = E;
|
|
8270
8271
|
let O = bt(E), j = D$1().mountedGroups.get(E);
|
|
8271
8272
|
if (j) {
|
|
8272
8273
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
|
|
8273
|
-
!n && _.length > 0 && (
|
|
8274
|
+
!n && _.length > 0 && (nM(E), G?.(E));
|
|
8274
8275
|
}
|
|
8275
8276
|
let M = T$1.addListener("interactionStateChange", (n) => {
|
|
8276
8277
|
switch (n.state) {
|
|
8277
8278
|
case "active":
|
|
8278
|
-
|
|
8279
|
+
eM(n.hitRegions.some((n) => n.group === E));
|
|
8279
8280
|
break;
|
|
8280
8281
|
default:
|
|
8281
|
-
|
|
8282
|
+
eM(!1);
|
|
8282
8283
|
break;
|
|
8283
8284
|
}
|
|
8284
8285
|
}), N = T$1.addListener("mountedGroupsChange", (n) => {
|
|
@@ -8286,30 +8287,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8286
8287
|
if (_) {
|
|
8287
8288
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
|
|
8288
8289
|
if (n || E.length === 0) return;
|
|
8289
|
-
|
|
8290
|
+
nM(O), G?.(O);
|
|
8290
8291
|
}
|
|
8291
8292
|
});
|
|
8292
8293
|
return () => {
|
|
8293
|
-
|
|
8294
|
+
uM.current = null, O(), M(), N();
|
|
8294
8295
|
};
|
|
8295
8296
|
}, [
|
|
8296
8297
|
A,
|
|
8297
8298
|
Z,
|
|
8298
8299
|
G,
|
|
8299
8300
|
z,
|
|
8300
|
-
|
|
8301
|
-
|
|
8301
|
+
rM,
|
|
8302
|
+
lM
|
|
8302
8303
|
]), useEffect(() => {
|
|
8303
|
-
let n =
|
|
8304
|
+
let n = uM.current;
|
|
8304
8305
|
n && (n.defaultLayout = E, n.disableCursor = !!O);
|
|
8305
8306
|
});
|
|
8306
|
-
let
|
|
8307
|
-
for (let n in
|
|
8307
|
+
let dM = { [Fe]: Xj ? "none" : void 0 };
|
|
8308
|
+
for (let n in tM) {
|
|
8308
8309
|
let _ = Ve(Z, n);
|
|
8309
|
-
|
|
8310
|
+
dM[_] = tM[n];
|
|
8310
8311
|
}
|
|
8311
8312
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
8312
|
-
value:
|
|
8313
|
+
value: cM,
|
|
8313
8314
|
children: /* @__PURE__ */ jsx("div", {
|
|
8314
8315
|
...H,
|
|
8315
8316
|
"aria-orientation": z,
|
|
@@ -8317,13 +8318,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8317
8318
|
"data-group": !0,
|
|
8318
8319
|
"data-testid": Z,
|
|
8319
8320
|
id: Z,
|
|
8320
|
-
ref:
|
|
8321
|
+
ref: sM,
|
|
8321
8322
|
style: {
|
|
8322
8323
|
height: "100%",
|
|
8323
8324
|
width: "100%",
|
|
8324
8325
|
overflow: "hidden",
|
|
8325
8326
|
...B,
|
|
8326
|
-
|
|
8327
|
+
...dM,
|
|
8327
8328
|
display: "flex",
|
|
8328
8329
|
flexDirection: z === "horizontal" ? "row" : "column",
|
|
8329
8330
|
flexWrap: "nowrap"
|
|
@@ -8441,12 +8442,12 @@ function It(n, _) {
|
|
|
8441
8442
|
});
|
|
8442
8443
|
}
|
|
8443
8444
|
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),
|
|
8445
|
+
let W = !!M, G = ae$1(M), Z = useRef(null), Yj = ue$1(Z, j), { id: Xj, registerPanel: Zj } = ce$1(), $j = z !== null, eM = le$1((n, _, E) => {
|
|
8445
8446
|
z?.(n, M, E);
|
|
8446
8447
|
});
|
|
8447
8448
|
A$1(() => {
|
|
8448
8449
|
let n = Z.current;
|
|
8449
|
-
if (n !== null) return
|
|
8450
|
+
if (n !== null) return Zj({
|
|
8450
8451
|
element: n,
|
|
8451
8452
|
id: G,
|
|
8452
8453
|
idIsStable: W,
|
|
@@ -8454,7 +8455,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8454
8455
|
expandToSize: void 0,
|
|
8455
8456
|
prevSize: void 0
|
|
8456
8457
|
},
|
|
8457
|
-
onResize:
|
|
8458
|
+
onResize: $j ? eM : void 0,
|
|
8458
8459
|
panelConstraints: {
|
|
8459
8460
|
collapsedSize: E,
|
|
8460
8461
|
collapsible: O,
|
|
@@ -8467,25 +8468,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8467
8468
|
E,
|
|
8468
8469
|
O,
|
|
8469
8470
|
A,
|
|
8470
|
-
|
|
8471
|
+
$j,
|
|
8471
8472
|
G,
|
|
8472
8473
|
W,
|
|
8473
8474
|
N,
|
|
8474
8475
|
P,
|
|
8475
|
-
|
|
8476
|
-
|
|
8476
|
+
eM,
|
|
8477
|
+
Zj
|
|
8477
8478
|
]), It(G, B);
|
|
8478
|
-
let
|
|
8479
|
+
let tM = Ve(Xj, G);
|
|
8479
8480
|
return /* @__PURE__ */ jsx("div", {
|
|
8480
8481
|
...U,
|
|
8481
8482
|
"data-panel": !0,
|
|
8482
8483
|
"data-testid": G,
|
|
8483
8484
|
id: G,
|
|
8484
|
-
ref:
|
|
8485
|
+
ref: Yj,
|
|
8485
8486
|
style: {
|
|
8486
8487
|
...Gt,
|
|
8487
8488
|
flexBasis: 0,
|
|
8488
|
-
flexGrow: `var(${
|
|
8489
|
+
flexGrow: `var(${tM}, 1)`,
|
|
8489
8490
|
flexShrink: 1,
|
|
8490
8491
|
overflow: "hidden",
|
|
8491
8492
|
pointerEvents: `var(${Fe})`
|
|
@@ -8548,7 +8549,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
|
|
|
8548
8549
|
};
|
|
8549
8550
|
}
|
|
8550
8551
|
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(),
|
|
8552
|
+
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(), Yj = G === "horizontal" ? "vertical" : "horizontal";
|
|
8552
8553
|
return A$1(() => {
|
|
8553
8554
|
let n = H.current;
|
|
8554
8555
|
if (n !== null) {
|
|
@@ -8584,7 +8585,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8584
8585
|
]), /* @__PURE__ */ jsx("div", {
|
|
8585
8586
|
...j,
|
|
8586
8587
|
"aria-controls": N.valueControls,
|
|
8587
|
-
"aria-orientation":
|
|
8588
|
+
"aria-orientation": Yj,
|
|
8588
8589
|
"aria-valuemax": N.valueMax,
|
|
8589
8590
|
"aria-valuemin": N.valueMin,
|
|
8590
8591
|
"aria-valuenow": N.valueNow,
|
|
@@ -8750,7 +8751,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8750
8751
|
}
|
|
8751
8752
|
return n;
|
|
8752
8753
|
});
|
|
8753
|
-
}, []),
|
|
8754
|
+
}, []), Yj = React.useCallback(() => {
|
|
8754
8755
|
M((n) => {
|
|
8755
8756
|
if (n.clipboard.length > 0) {
|
|
8756
8757
|
let _ = n.clipboard.map((n) => ({
|
|
@@ -8769,7 +8770,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8769
8770
|
}
|
|
8770
8771
|
return n;
|
|
8771
8772
|
});
|
|
8772
|
-
}, []),
|
|
8773
|
+
}, []), Xj = React.useCallback((n) => {
|
|
8773
8774
|
let _ = {};
|
|
8774
8775
|
n.type === "box" && (_.backgroundColor = "var(--gray-4)"), n.type === "text-container" && (_.backgroundColor = "var(--gray-4)", _.border = "1px solid var(--gray-8)", _.padding = "8px", _.display = "flex", _.alignItems = "flex-start", _.justifyContent = "flex-start");
|
|
8775
8776
|
let E = {
|
|
@@ -8794,7 +8795,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8794
8795
|
selectedElementIds: [E.id]
|
|
8795
8796
|
};
|
|
8796
8797
|
});
|
|
8797
|
-
}, []),
|
|
8798
|
+
}, []), Zj = React.useCallback((n) => {
|
|
8798
8799
|
M((_) => {
|
|
8799
8800
|
let E = _.elements.filter((_) => _.id !== n), O = _.history.slice(0, _.historyIndex + 1);
|
|
8800
8801
|
return O.push(E), {
|
|
@@ -8805,7 +8806,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8805
8806
|
historyIndex: O.length - 1
|
|
8806
8807
|
};
|
|
8807
8808
|
});
|
|
8808
|
-
}, []),
|
|
8809
|
+
}, []), Qj = React.useCallback(() => {
|
|
8809
8810
|
M((n) => {
|
|
8810
8811
|
if (n.selectedElementIds.length === 0) return n;
|
|
8811
8812
|
let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
|
|
@@ -8817,7 +8818,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8817
8818
|
historyIndex: E.length - 1
|
|
8818
8819
|
};
|
|
8819
8820
|
});
|
|
8820
|
-
}, []),
|
|
8821
|
+
}, []), eM = React.useCallback((n, _ = !1) => {
|
|
8821
8822
|
M((E) => {
|
|
8822
8823
|
if (n === null) return {
|
|
8823
8824
|
...E,
|
|
@@ -8834,12 +8835,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8834
8835
|
selectedElementIds: [n]
|
|
8835
8836
|
};
|
|
8836
8837
|
});
|
|
8837
|
-
}, []),
|
|
8838
|
+
}, []), tM = React.useCallback((n) => {
|
|
8838
8839
|
M((_) => ({
|
|
8839
8840
|
..._,
|
|
8840
8841
|
selectedElementIds: n
|
|
8841
8842
|
}));
|
|
8842
|
-
}, []),
|
|
8843
|
+
}, []), nM = React.useCallback((n, _) => {
|
|
8843
8844
|
M((E) => {
|
|
8844
8845
|
let O = [...E.elements], A = O[n];
|
|
8845
8846
|
O.splice(n, 1), O.splice(_, 0, A);
|
|
@@ -8851,7 +8852,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8851
8852
|
historyIndex: j.length - 1
|
|
8852
8853
|
};
|
|
8853
8854
|
});
|
|
8854
|
-
}, []),
|
|
8855
|
+
}, []), rM = React.useCallback((n, _, E = !0) => {
|
|
8855
8856
|
M((O) => {
|
|
8856
8857
|
let A = O.elements.map((E) => E.id === n ? {
|
|
8857
8858
|
...E,
|
|
@@ -8864,7 +8865,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8864
8865
|
historyIndex: M
|
|
8865
8866
|
};
|
|
8866
8867
|
});
|
|
8867
|
-
}, []),
|
|
8868
|
+
}, []), aM = React.useCallback((n, _ = !0) => {
|
|
8868
8869
|
M((E) => {
|
|
8869
8870
|
let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
|
|
8870
8871
|
n.forEach(({ id: n, changes: _ }) => {
|
|
@@ -8918,7 +8919,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8918
8919
|
historyIndex: P
|
|
8919
8920
|
};
|
|
8920
8921
|
});
|
|
8921
|
-
}, []),
|
|
8922
|
+
}, []), oM = React.useCallback((n) => {
|
|
8922
8923
|
M((_) => {
|
|
8923
8924
|
let E = _.elements.filter((_) => n.includes(_.id));
|
|
8924
8925
|
if (E.length === 0) return _;
|
|
@@ -8946,7 +8947,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8946
8947
|
historyIndex: z.length - 1
|
|
8947
8948
|
};
|
|
8948
8949
|
});
|
|
8949
|
-
}, []),
|
|
8950
|
+
}, []), sM = React.useCallback((n) => {
|
|
8950
8951
|
M((_) => {
|
|
8951
8952
|
let E = _.elements.find((_) => _.id === n);
|
|
8952
8953
|
if (!E || E.type !== "group") return _;
|
|
@@ -8962,7 +8963,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8962
8963
|
historyIndex: j.length - 1
|
|
8963
8964
|
};
|
|
8964
8965
|
});
|
|
8965
|
-
}, []),
|
|
8966
|
+
}, []), cM = React.useCallback((n, _) => {
|
|
8966
8967
|
M((E) => {
|
|
8967
8968
|
let O = E.elements.map((E) => E.id === n ? {
|
|
8968
8969
|
...E,
|
|
@@ -8973,7 +8974,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8973
8974
|
elements: O
|
|
8974
8975
|
};
|
|
8975
8976
|
});
|
|
8976
|
-
}, []),
|
|
8977
|
+
}, []), lM = React.useCallback((n, _) => {
|
|
8977
8978
|
if (!n.find((n) => n.id === _ && n.type === "group")) return n;
|
|
8978
8979
|
let E = n.filter((n) => n.groupId === _);
|
|
8979
8980
|
if (E.length === 0) return n;
|
|
@@ -8985,7 +8986,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8985
8986
|
width: j - O,
|
|
8986
8987
|
height: M - A
|
|
8987
8988
|
} : n);
|
|
8988
|
-
}, []),
|
|
8989
|
+
}, []), uM = React.useCallback((n, _) => {
|
|
8989
8990
|
M((E) => {
|
|
8990
8991
|
let O = E.elements.find((_) => _.id === n), A = E.elements.find((n) => n.id === _ && n.type === "group");
|
|
8991
8992
|
if (!O || !A) return E;
|
|
@@ -8993,7 +8994,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8993
8994
|
...E,
|
|
8994
8995
|
groupId: _
|
|
8995
8996
|
} : E);
|
|
8996
|
-
j =
|
|
8997
|
+
j = lM(j, _);
|
|
8997
8998
|
let M = E.history.slice(0, E.historyIndex + 1);
|
|
8998
8999
|
return M.push(j), {
|
|
8999
9000
|
...E,
|
|
@@ -9002,7 +9003,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9002
9003
|
historyIndex: M.length - 1
|
|
9003
9004
|
};
|
|
9004
9005
|
});
|
|
9005
|
-
}, [
|
|
9006
|
+
}, [lM]), dM = React.useCallback((n) => {
|
|
9006
9007
|
M((_) => {
|
|
9007
9008
|
let E = _.elements.find((_) => _.id === n);
|
|
9008
9009
|
if (!E || !E.groupId) return _;
|
|
@@ -9010,7 +9011,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9010
9011
|
..._,
|
|
9011
9012
|
groupId: void 0
|
|
9012
9013
|
} : _);
|
|
9013
|
-
A =
|
|
9014
|
+
A = lM(A, O);
|
|
9014
9015
|
let j = _.history.slice(0, _.historyIndex + 1);
|
|
9015
9016
|
return j.push(A), {
|
|
9016
9017
|
..._,
|
|
@@ -9019,7 +9020,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9019
9020
|
historyIndex: j.length - 1
|
|
9020
9021
|
};
|
|
9021
9022
|
});
|
|
9022
|
-
}, [
|
|
9023
|
+
}, [lM]), fM = React.useCallback((n, _, E) => {
|
|
9023
9024
|
M((O) => {
|
|
9024
9025
|
let A = O.elements.find((_) => _.id === n && _.type === "group");
|
|
9025
9026
|
if (!A) return O;
|
|
@@ -9048,13 +9049,13 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9048
9049
|
historyIndex: B.length - 1
|
|
9049
9050
|
};
|
|
9050
9051
|
});
|
|
9051
|
-
}, []),
|
|
9052
|
+
}, []), pM = React.useCallback((n, _) => {
|
|
9052
9053
|
M((E) => ({
|
|
9053
9054
|
...E,
|
|
9054
9055
|
mockData: n,
|
|
9055
9056
|
singleMockData: _
|
|
9056
9057
|
}));
|
|
9057
|
-
}, []),
|
|
9058
|
+
}, []), mM = React.useCallback((n) => {
|
|
9058
9059
|
M((_) => ({
|
|
9059
9060
|
..._,
|
|
9060
9061
|
listSettings: {
|
|
@@ -9062,65 +9063,65 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9062
9063
|
...n
|
|
9063
9064
|
}
|
|
9064
9065
|
}));
|
|
9065
|
-
}, []),
|
|
9066
|
+
}, []), hM = React.useMemo(() => ({
|
|
9066
9067
|
state: j,
|
|
9067
|
-
addElement:
|
|
9068
|
-
removeElement:
|
|
9069
|
-
removeSelected:
|
|
9070
|
-
selectElement:
|
|
9071
|
-
setSelectedElements:
|
|
9072
|
-
moveElement:
|
|
9073
|
-
updateElement:
|
|
9074
|
-
updateElements:
|
|
9075
|
-
groupElements:
|
|
9076
|
-
ungroupElements:
|
|
9077
|
-
renameElement:
|
|
9078
|
-
addToGroup:
|
|
9079
|
-
removeFromGroup:
|
|
9080
|
-
resizeGroup:
|
|
9081
|
-
setMockData:
|
|
9082
|
-
updateListSettings:
|
|
9068
|
+
addElement: Xj,
|
|
9069
|
+
removeElement: Zj,
|
|
9070
|
+
removeSelected: Qj,
|
|
9071
|
+
selectElement: eM,
|
|
9072
|
+
setSelectedElements: tM,
|
|
9073
|
+
moveElement: nM,
|
|
9074
|
+
updateElement: rM,
|
|
9075
|
+
updateElements: aM,
|
|
9076
|
+
groupElements: oM,
|
|
9077
|
+
ungroupElements: sM,
|
|
9078
|
+
renameElement: cM,
|
|
9079
|
+
addToGroup: uM,
|
|
9080
|
+
removeFromGroup: dM,
|
|
9081
|
+
resizeGroup: fM,
|
|
9082
|
+
setMockData: pM,
|
|
9083
|
+
updateListSettings: mM,
|
|
9083
9084
|
setCanvasHeight: N,
|
|
9084
9085
|
loadState: U,
|
|
9085
9086
|
undo: W,
|
|
9086
9087
|
redo: G,
|
|
9087
9088
|
copy: Z,
|
|
9088
|
-
paste:
|
|
9089
|
+
paste: Yj,
|
|
9089
9090
|
setGridSize: P,
|
|
9090
9091
|
setZoom: z,
|
|
9091
9092
|
setPan: B,
|
|
9092
9093
|
setSnapLines: H
|
|
9093
9094
|
}), [
|
|
9094
9095
|
j,
|
|
9095
|
-
Rj,
|
|
9096
|
-
zj,
|
|
9097
|
-
Bj,
|
|
9098
|
-
Hj,
|
|
9099
|
-
Uj,
|
|
9100
|
-
Wj,
|
|
9101
|
-
Gj,
|
|
9102
|
-
qj,
|
|
9103
|
-
Jj,
|
|
9104
|
-
Yj,
|
|
9105
9096
|
Xj,
|
|
9097
|
+
Zj,
|
|
9106
9098
|
Qj,
|
|
9107
|
-
$j,
|
|
9108
9099
|
eM,
|
|
9109
9100
|
tM,
|
|
9110
9101
|
nM,
|
|
9102
|
+
rM,
|
|
9103
|
+
aM,
|
|
9104
|
+
oM,
|
|
9105
|
+
sM,
|
|
9106
|
+
cM,
|
|
9107
|
+
uM,
|
|
9108
|
+
dM,
|
|
9109
|
+
fM,
|
|
9110
|
+
pM,
|
|
9111
|
+
mM,
|
|
9111
9112
|
N,
|
|
9112
9113
|
U,
|
|
9113
9114
|
W,
|
|
9114
9115
|
G,
|
|
9115
9116
|
Z,
|
|
9116
|
-
|
|
9117
|
+
Yj,
|
|
9117
9118
|
P,
|
|
9118
9119
|
z,
|
|
9119
9120
|
B,
|
|
9120
9121
|
H
|
|
9121
9122
|
]);
|
|
9122
9123
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
9123
|
-
value:
|
|
9124
|
+
value: hM,
|
|
9124
9125
|
children: n
|
|
9125
9126
|
});
|
|
9126
9127
|
}, useEditor = () => {
|
|
@@ -9562,16 +9563,16 @@ var __assign$1 = function() {
|
|
|
9562
9563
|
maxHeight: _
|
|
9563
9564
|
};
|
|
9564
9565
|
}, _.prototype.calculateNewSizeFromDirection = function(n, _) {
|
|
9565
|
-
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,
|
|
9566
|
-
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W -
|
|
9566
|
+
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, Yj = U || 0;
|
|
9567
|
+
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Yj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Yj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Yj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Yj)), {
|
|
9567
9568
|
newWidth: W,
|
|
9568
9569
|
newHeight: G
|
|
9569
9570
|
};
|
|
9570
9571
|
}, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
|
|
9571
9572
|
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;
|
|
9572
9573
|
if (j) {
|
|
9573
|
-
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W,
|
|
9574
|
-
n = clamp$1(n,
|
|
9574
|
+
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Yj = (P - W) / this.ratio + U, Xj = (z - W) / this.ratio + U, Zj = Math.max(P, G), Qj = Math.min(z, Z), $j = Math.max(B, Yj), eM = Math.min(H, Xj);
|
|
9575
|
+
n = clamp$1(n, Zj, Qj), _ = clamp$1(_, $j, eM);
|
|
9575
9576
|
} else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
|
|
9576
9577
|
return {
|
|
9577
9578
|
newWidth: n,
|
|
@@ -9628,56 +9629,56 @@ var __assign$1 = function() {
|
|
|
9628
9629
|
} catch {}
|
|
9629
9630
|
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);
|
|
9630
9631
|
O = Z.maxWidth, A = Z.maxHeight, j = Z.minWidth, M = Z.minHeight;
|
|
9631
|
-
var
|
|
9632
|
-
this.props.snap && this.props.snap.x && (
|
|
9633
|
-
var
|
|
9634
|
-
width:
|
|
9635
|
-
height:
|
|
9632
|
+
var Yj = this.calculateNewSizeFromDirection(N, P), Xj = Yj.newHeight, Zj = Yj.newWidth, Qj = this.calculateNewMaxFromBoundary(O, A);
|
|
9633
|
+
this.props.snap && this.props.snap.x && (Zj = findClosestSnap(Zj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (Xj = findClosestSnap(Xj, this.props.snap.y, this.props.snapGap));
|
|
9634
|
+
var $j = this.calculateNewSizeFromAspectRatio(Zj, Xj, {
|
|
9635
|
+
width: Qj.maxWidth,
|
|
9636
|
+
height: Qj.maxHeight
|
|
9636
9637
|
}, {
|
|
9637
9638
|
width: j,
|
|
9638
9639
|
height: M
|
|
9639
9640
|
});
|
|
9640
|
-
if (
|
|
9641
|
-
var
|
|
9642
|
-
|
|
9641
|
+
if (Zj = $j.newWidth, Xj = $j.newHeight, this.props.grid) {
|
|
9642
|
+
var eM = snap(Zj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), tM = snap(Xj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), rM = this.props.snapGap || 0, iM = rM === 0 || Math.abs(eM - Zj) <= rM ? eM : Zj, aM = rM === 0 || Math.abs(tM - Xj) <= rM ? tM : Xj;
|
|
9643
|
+
Zj = iM, Xj = aM;
|
|
9643
9644
|
}
|
|
9644
|
-
var
|
|
9645
|
-
width:
|
|
9646
|
-
height:
|
|
9645
|
+
var oM = {
|
|
9646
|
+
width: Zj - H.width,
|
|
9647
|
+
height: Xj - H.height
|
|
9647
9648
|
};
|
|
9648
|
-
if (this.delta =
|
|
9649
|
+
if (this.delta = oM, U && typeof U == "string") {
|
|
9649
9650
|
if (U.endsWith("%")) {
|
|
9650
|
-
var
|
|
9651
|
-
|
|
9651
|
+
var sM = Zj / G.width * 100;
|
|
9652
|
+
Zj = `${sM}%`;
|
|
9652
9653
|
} else if (U.endsWith("vw")) {
|
|
9653
|
-
var
|
|
9654
|
-
|
|
9654
|
+
var cM = Zj / this.window.innerWidth * 100;
|
|
9655
|
+
Zj = `${cM}vw`;
|
|
9655
9656
|
} else if (U.endsWith("vh")) {
|
|
9656
|
-
var
|
|
9657
|
-
|
|
9657
|
+
var lM = Zj / this.window.innerHeight * 100;
|
|
9658
|
+
Zj = `${lM}vh`;
|
|
9658
9659
|
}
|
|
9659
9660
|
}
|
|
9660
9661
|
if (W && typeof W == "string") {
|
|
9661
9662
|
if (W.endsWith("%")) {
|
|
9662
|
-
var
|
|
9663
|
-
|
|
9663
|
+
var sM = Xj / G.height * 100;
|
|
9664
|
+
Xj = `${sM}%`;
|
|
9664
9665
|
} else if (W.endsWith("vw")) {
|
|
9665
|
-
var
|
|
9666
|
-
|
|
9666
|
+
var cM = Xj / this.window.innerWidth * 100;
|
|
9667
|
+
Xj = `${cM}vw`;
|
|
9667
9668
|
} else if (W.endsWith("vh")) {
|
|
9668
|
-
var
|
|
9669
|
-
|
|
9669
|
+
var lM = Xj / this.window.innerHeight * 100;
|
|
9670
|
+
Xj = `${lM}vh`;
|
|
9670
9671
|
}
|
|
9671
9672
|
}
|
|
9672
|
-
var
|
|
9673
|
-
width: this.createSizeForCssProperty(
|
|
9674
|
-
height: this.createSizeForCssProperty(
|
|
9673
|
+
var uM = {
|
|
9674
|
+
width: this.createSizeForCssProperty(Zj, "width"),
|
|
9675
|
+
height: this.createSizeForCssProperty(Xj, "height")
|
|
9675
9676
|
};
|
|
9676
|
-
this.flexDir === "row" ?
|
|
9677
|
-
var
|
|
9678
|
-
|
|
9679
|
-
_.setState(
|
|
9680
|
-
}), this.props.onResize &&
|
|
9677
|
+
this.flexDir === "row" ? uM.flexBasis = uM.width : this.flexDir === "column" && (uM.flexBasis = uM.height);
|
|
9678
|
+
var dM = this.state.width !== uM.width, fM = this.state.height !== uM.height, pM = this.state.flexBasis !== uM.flexBasis, mM = dM || fM || pM;
|
|
9679
|
+
mM && flushSync(function() {
|
|
9680
|
+
_.setState(uM);
|
|
9681
|
+
}), this.props.onResize && mM && this.props.onResize(n, B, this.resizable, oM);
|
|
9681
9682
|
}
|
|
9682
9683
|
}, _.prototype.onMouseUp = function(n) {
|
|
9683
9684
|
var _ = this.state, E = _.isResizing, O = _.direction;
|
|
@@ -9761,7 +9762,7 @@ var __assign$1 = function() {
|
|
|
9761
9762
|
snapGap: 0
|
|
9762
9763
|
}, _;
|
|
9763
9764
|
}(PureComponent);
|
|
9764
|
-
const formatValue = (n, _) => {
|
|
9765
|
+
const formatValue$1 = (n, _) => {
|
|
9765
9766
|
if (n == null) return "";
|
|
9766
9767
|
if (_.type === "boolean") return String(n) === "true" || n === !0 || typeof n == "number" && n > 0 ? _.trueLabel || "Sim" : _.falseLabel || "Não";
|
|
9767
9768
|
if (_.type === "date") try {
|
|
@@ -9780,7 +9781,7 @@ const formatValue = (n, _) => {
|
|
|
9780
9781
|
return isNaN(E) ? String(n) : _.numberFormat === "currency" ? (_.currencySymbol || "R$") + " " + E.toFixed(_.decimalPlaces || 2) : _.numberFormat === "percent" ? E.toFixed(_.decimalPlaces || 0) + "%" : E.toFixed(_.decimalPlaces || 0);
|
|
9781
9782
|
}
|
|
9782
9783
|
return String(n);
|
|
9783
|
-
}, checkCondition = (n, _, E) => {
|
|
9784
|
+
}, checkCondition$1 = (n, _, E) => {
|
|
9784
9785
|
let O = String(n).toLowerCase(), A = String(E).toLowerCase();
|
|
9785
9786
|
switch (_) {
|
|
9786
9787
|
case "equals": return O === A;
|
|
@@ -11186,32 +11187,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
11186
11187
|
});
|
|
11187
11188
|
};
|
|
11188
11189
|
const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
11189
|
-
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,
|
|
11190
|
+
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, Yj] = useState(!1), [Xj, Zj] = useState(!1), [eM, tM] = useState(!1), [nM, oM] = useState("formatting"), [sM, cM] = useState({
|
|
11190
11191
|
open: !1,
|
|
11191
11192
|
prop: "",
|
|
11192
11193
|
value: ""
|
|
11193
|
-
}), [
|
|
11194
|
-
let _ =
|
|
11194
|
+
}), [lM, uM] = useState(!1), [dM, fM] = useState(""), [pM, mM] = useState(""), [hM, gM] = useState(_.content), [_M, vM] = useState(_.dataBinding || ""), yM = useRef(null), bM = useRef(null), xM = (n) => {
|
|
11195
|
+
let _ = yM.current;
|
|
11195
11196
|
if (_) {
|
|
11196
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
11197
|
-
|
|
11197
|
+
let E = _.selectionStart, O = _.selectionEnd, A = hM;
|
|
11198
|
+
gM(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
11198
11199
|
_.focus();
|
|
11199
11200
|
let O = E + n.length + 4;
|
|
11200
11201
|
_.setSelectionRange(O, O);
|
|
11201
11202
|
}, 0);
|
|
11202
|
-
} else
|
|
11203
|
-
},
|
|
11203
|
+
} else gM((_) => _ + `{{${n}}}`);
|
|
11204
|
+
}, SM = (n) => {
|
|
11204
11205
|
E(_.id, { style: {
|
|
11205
11206
|
..._.style,
|
|
11206
11207
|
...n
|
|
11207
11208
|
} });
|
|
11208
|
-
},
|
|
11209
|
+
}, CM = () => {
|
|
11209
11210
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11210
11211
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
11211
|
-
},
|
|
11212
|
+
}, wM = () => {
|
|
11212
11213
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11213
11214
|
n > 0 && M(n, 0);
|
|
11214
|
-
},
|
|
11215
|
+
}, TM = () => {
|
|
11215
11216
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
11216
11217
|
type: _.type,
|
|
11217
11218
|
content: _.content,
|
|
@@ -11221,7 +11222,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11221
11222
|
height: _.height,
|
|
11222
11223
|
style: _.style
|
|
11223
11224
|
});
|
|
11224
|
-
},
|
|
11225
|
+
}, EM = [
|
|
11225
11226
|
"#000000",
|
|
11226
11227
|
"#FFFFFF",
|
|
11227
11228
|
"#FF0000",
|
|
@@ -11231,8 +11232,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11231
11232
|
"#808080",
|
|
11232
11233
|
"#800080",
|
|
11233
11234
|
"transparent"
|
|
11234
|
-
],
|
|
11235
|
-
|
|
11235
|
+
], DM = (n, _) => {
|
|
11236
|
+
cM({
|
|
11236
11237
|
open: !0,
|
|
11237
11238
|
prop: n,
|
|
11238
11239
|
value: _
|
|
@@ -11248,8 +11249,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11248
11249
|
direction: "column",
|
|
11249
11250
|
gap: "3",
|
|
11250
11251
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11251
|
-
value:
|
|
11252
|
-
onChange: (n) =>
|
|
11252
|
+
value: pM,
|
|
11253
|
+
onChange: (n) => mM(n.target.value),
|
|
11253
11254
|
placeholder: "Nome da camada..."
|
|
11254
11255
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11255
11256
|
gap: "3",
|
|
@@ -11260,7 +11261,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11260
11261
|
children: "Cancelar"
|
|
11261
11262
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11262
11263
|
onClick: () => {
|
|
11263
|
-
B(_.id,
|
|
11264
|
+
B(_.id, pM), G(!1);
|
|
11264
11265
|
},
|
|
11265
11266
|
children: "Salvar"
|
|
11266
11267
|
})]
|
|
@@ -11270,7 +11271,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11270
11271
|
}),
|
|
11271
11272
|
/* @__PURE__ */ jsx(s$4, {
|
|
11272
11273
|
open: Z,
|
|
11273
|
-
onOpenChange:
|
|
11274
|
+
onOpenChange: Yj,
|
|
11274
11275
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11275
11276
|
style: { maxWidth: 450 },
|
|
11276
11277
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11278,9 +11279,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11278
11279
|
gap: "3",
|
|
11279
11280
|
children: [
|
|
11280
11281
|
/* @__PURE__ */ jsx(r, {
|
|
11281
|
-
ref:
|
|
11282
|
-
value:
|
|
11283
|
-
onChange: (n) =>
|
|
11282
|
+
ref: yM,
|
|
11283
|
+
value: hM,
|
|
11284
|
+
onChange: (n) => gM(n.target.value),
|
|
11284
11285
|
placeholder: "Digite o novo texto...",
|
|
11285
11286
|
style: { height: 100 }
|
|
11286
11287
|
}),
|
|
@@ -11298,7 +11299,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11298
11299
|
color: "blue",
|
|
11299
11300
|
variant: "surface",
|
|
11300
11301
|
style: { cursor: "pointer" },
|
|
11301
|
-
onClick: () =>
|
|
11302
|
+
onClick: () => xM(n.dataName),
|
|
11302
11303
|
children: n.name
|
|
11303
11304
|
}, n.dataName))
|
|
11304
11305
|
})]
|
|
@@ -11312,7 +11313,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11312
11313
|
children: "Cancelar"
|
|
11313
11314
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11314
11315
|
onClick: () => {
|
|
11315
|
-
E(_.id, { content:
|
|
11316
|
+
E(_.id, { content: hM }), Yj(!1);
|
|
11316
11317
|
},
|
|
11317
11318
|
children: "Salvar"
|
|
11318
11319
|
})]
|
|
@@ -11322,8 +11323,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11322
11323
|
})
|
|
11323
11324
|
}),
|
|
11324
11325
|
/* @__PURE__ */ jsx(s$4, {
|
|
11325
|
-
open:
|
|
11326
|
-
onOpenChange:
|
|
11326
|
+
open: Xj,
|
|
11327
|
+
onOpenChange: Zj,
|
|
11327
11328
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11328
11329
|
style: { maxWidth: 450 },
|
|
11329
11330
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11335,8 +11336,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11335
11336
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
11336
11337
|
}),
|
|
11337
11338
|
/* @__PURE__ */ jsx(u$1, {
|
|
11338
|
-
value:
|
|
11339
|
-
onChange: (n) =>
|
|
11339
|
+
value: _M,
|
|
11340
|
+
onChange: (n) => vM(n.target.value),
|
|
11340
11341
|
placeholder: "propriedade"
|
|
11341
11342
|
}),
|
|
11342
11343
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11348,8 +11349,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11348
11349
|
children: "Cancelar"
|
|
11349
11350
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11350
11351
|
onClick: () => {
|
|
11351
|
-
let n =
|
|
11352
|
-
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O),
|
|
11352
|
+
let n = _M, O = { dataBinding: n };
|
|
11353
|
+
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O), Zj(!1);
|
|
11353
11354
|
},
|
|
11354
11355
|
children: "Vincular"
|
|
11355
11356
|
})]
|
|
@@ -11359,8 +11360,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11359
11360
|
})
|
|
11360
11361
|
}),
|
|
11361
11362
|
/* @__PURE__ */ jsx(s$4, {
|
|
11362
|
-
open:
|
|
11363
|
-
onOpenChange: (n) =>
|
|
11363
|
+
open: sM.open,
|
|
11364
|
+
onOpenChange: (n) => cM((_) => ({
|
|
11364
11365
|
..._,
|
|
11365
11366
|
open: n
|
|
11366
11367
|
})),
|
|
@@ -11369,8 +11370,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11369
11370
|
children: [
|
|
11370
11371
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
11371
11372
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
11372
|
-
color:
|
|
11373
|
-
onChange: (n) =>
|
|
11373
|
+
color: sM.value,
|
|
11374
|
+
onChange: (n) => cM((_) => ({
|
|
11374
11375
|
..._,
|
|
11375
11376
|
value: n
|
|
11376
11377
|
}))
|
|
@@ -11385,7 +11386,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11385
11386
|
children: "Cancelar"
|
|
11386
11387
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11387
11388
|
onClick: () => {
|
|
11388
|
-
|
|
11389
|
+
SM({ [sM.prop]: sM.value }), cM((n) => ({
|
|
11389
11390
|
...n,
|
|
11390
11391
|
open: !1
|
|
11391
11392
|
}));
|
|
@@ -11398,21 +11399,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11398
11399
|
}),
|
|
11399
11400
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
11400
11401
|
elementId: _.id,
|
|
11401
|
-
open:
|
|
11402
|
-
onOpenChange:
|
|
11403
|
-
initialTab:
|
|
11402
|
+
open: eM,
|
|
11403
|
+
onOpenChange: tM,
|
|
11404
|
+
initialTab: nM
|
|
11404
11405
|
}),
|
|
11405
11406
|
/* @__PURE__ */ jsx(s$4, {
|
|
11406
|
-
open:
|
|
11407
|
-
onOpenChange:
|
|
11407
|
+
open: lM,
|
|
11408
|
+
onOpenChange: uM,
|
|
11408
11409
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11409
11410
|
style: { maxWidth: 450 },
|
|
11410
11411
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Inserir URL da Imagem" }), /* @__PURE__ */ jsxs(p$1, {
|
|
11411
11412
|
direction: "column",
|
|
11412
11413
|
gap: "3",
|
|
11413
11414
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11414
|
-
value:
|
|
11415
|
-
onChange: (n) =>
|
|
11415
|
+
value: dM,
|
|
11416
|
+
onChange: (n) => fM(n.target.value),
|
|
11416
11417
|
placeholder: "https://exemplo.com/imagem.png"
|
|
11417
11418
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11418
11419
|
gap: "3",
|
|
@@ -11423,7 +11424,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11423
11424
|
children: "Cancelar"
|
|
11424
11425
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11425
11426
|
onClick: () => {
|
|
11426
|
-
E(_.id, { content:
|
|
11427
|
+
E(_.id, { content: dM }), uM(!1);
|
|
11427
11428
|
},
|
|
11428
11429
|
children: "Aplicar"
|
|
11429
11430
|
})]
|
|
@@ -11433,7 +11434,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11433
11434
|
}),
|
|
11434
11435
|
/* @__PURE__ */ jsx("input", {
|
|
11435
11436
|
type: "file",
|
|
11436
|
-
ref:
|
|
11437
|
+
ref: bM,
|
|
11437
11438
|
style: { display: "none" },
|
|
11438
11439
|
accept: "image/*",
|
|
11439
11440
|
onChange: (n) => {
|
|
@@ -11499,7 +11500,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11499
11500
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11500
11501
|
className: "ContextMenuItem",
|
|
11501
11502
|
onSelect: () => {
|
|
11502
|
-
|
|
11503
|
+
vM(_.dataBinding || ""), Zj(!0);
|
|
11503
11504
|
},
|
|
11504
11505
|
children: "Outro / Manual..."
|
|
11505
11506
|
}),
|
|
@@ -11515,14 +11516,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11515
11516
|
(_.type === "text" || _.type === "text-container") && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11516
11517
|
className: "ContextMenuItem",
|
|
11517
11518
|
onSelect: () => {
|
|
11518
|
-
|
|
11519
|
+
gM(_.content), Yj(!0);
|
|
11519
11520
|
},
|
|
11520
11521
|
children: "Editar Texto..."
|
|
11521
11522
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11522
11523
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11523
11524
|
className: "ContextMenuItem",
|
|
11524
11525
|
onSelect: () => {
|
|
11525
|
-
|
|
11526
|
+
mM(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11526
11527
|
},
|
|
11527
11528
|
children: "Renomear..."
|
|
11528
11529
|
}),
|
|
@@ -11539,13 +11540,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11539
11540
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11540
11541
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11541
11542
|
className: "ContextMenuItem",
|
|
11542
|
-
onSelect: () =>
|
|
11543
|
+
onSelect: () => tM(!0),
|
|
11543
11544
|
children: "Configurações Avançadas..."
|
|
11544
11545
|
}),
|
|
11545
11546
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11546
11547
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11547
11548
|
className: "ContextMenuItem",
|
|
11548
|
-
onSelect:
|
|
11549
|
+
onSelect: TM,
|
|
11549
11550
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
11550
11551
|
}),
|
|
11551
11552
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11569,12 +11570,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11569
11570
|
alignOffset: -5,
|
|
11570
11571
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11571
11572
|
className: "ContextMenuItem",
|
|
11572
|
-
onSelect: () =>
|
|
11573
|
+
onSelect: () => bM.current?.click(),
|
|
11573
11574
|
children: "Carregar do Computador"
|
|
11574
11575
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11575
11576
|
className: "ContextMenuItem",
|
|
11576
11577
|
onSelect: () => {
|
|
11577
|
-
|
|
11578
|
+
fM(typeof _.content == "string" ? _.content : ""), uM(!0);
|
|
11578
11579
|
},
|
|
11579
11580
|
children: "Inserir URL"
|
|
11580
11581
|
})]
|
|
@@ -11592,17 +11593,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11592
11593
|
children: [
|
|
11593
11594
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11594
11595
|
className: "ContextMenuItem",
|
|
11595
|
-
onSelect: () =>
|
|
11596
|
+
onSelect: () => SM({ objectFit: "cover" }),
|
|
11596
11597
|
children: "Preencher (Cover)"
|
|
11597
11598
|
}),
|
|
11598
11599
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11599
11600
|
className: "ContextMenuItem",
|
|
11600
|
-
onSelect: () =>
|
|
11601
|
+
onSelect: () => SM({ objectFit: "contain" }),
|
|
11601
11602
|
children: "Ajustar (Contain)"
|
|
11602
11603
|
}),
|
|
11603
11604
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11604
11605
|
className: "ContextMenuItem",
|
|
11605
|
-
onSelect: () =>
|
|
11606
|
+
onSelect: () => SM({ objectFit: "fill" }),
|
|
11606
11607
|
children: "Esticar (Fill)"
|
|
11607
11608
|
})
|
|
11608
11609
|
]
|
|
@@ -11621,11 +11622,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11621
11622
|
alignOffset: -5,
|
|
11622
11623
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11623
11624
|
className: "ContextMenuItem",
|
|
11624
|
-
onSelect:
|
|
11625
|
+
onSelect: CM,
|
|
11625
11626
|
children: "Trazer para frente"
|
|
11626
11627
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11627
11628
|
className: "ContextMenuItem",
|
|
11628
|
-
onSelect:
|
|
11629
|
+
onSelect: wM,
|
|
11629
11630
|
children: "Enviar para trás"
|
|
11630
11631
|
})]
|
|
11631
11632
|
}) })] }),
|
|
@@ -11643,7 +11644,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11643
11644
|
alignOffset: -5,
|
|
11644
11645
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11645
11646
|
className: "ContextMenuItem",
|
|
11646
|
-
onSelect: () =>
|
|
11647
|
+
onSelect: () => SM({ fontFamily: n }),
|
|
11647
11648
|
style: { fontFamily: n },
|
|
11648
11649
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
11649
11650
|
className: "RightSlot",
|
|
@@ -11672,7 +11673,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11672
11673
|
64
|
|
11673
11674
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11674
11675
|
className: "ContextMenuItem",
|
|
11675
|
-
onSelect: () =>
|
|
11676
|
+
onSelect: () => SM({ fontSize: `${n}px` }),
|
|
11676
11677
|
children: [n, "px"]
|
|
11677
11678
|
}, n))
|
|
11678
11679
|
}) })] }),
|
|
@@ -11687,9 +11688,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11687
11688
|
sideOffset: 2,
|
|
11688
11689
|
alignOffset: -5,
|
|
11689
11690
|
children: [
|
|
11690
|
-
|
|
11691
|
+
EM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11691
11692
|
className: "ContextMenuItem",
|
|
11692
|
-
onSelect: () =>
|
|
11693
|
+
onSelect: () => SM({ color: n }),
|
|
11693
11694
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11694
11695
|
width: 12,
|
|
11695
11696
|
height: 12,
|
|
@@ -11701,7 +11702,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11701
11702
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11702
11703
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11703
11704
|
className: "ContextMenuItem",
|
|
11704
|
-
onSelect: () =>
|
|
11705
|
+
onSelect: () => DM("color", _.style?.color || "#000000"),
|
|
11705
11706
|
children: "Outra Cor..."
|
|
11706
11707
|
})
|
|
11707
11708
|
]
|
|
@@ -11718,11 +11719,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11718
11719
|
alignOffset: -5,
|
|
11719
11720
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11720
11721
|
className: "ContextMenuItem",
|
|
11721
|
-
onSelect: () =>
|
|
11722
|
+
onSelect: () => SM({ fontWeight: "normal" }),
|
|
11722
11723
|
children: "Normal"
|
|
11723
11724
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11724
11725
|
className: "ContextMenuItem",
|
|
11725
|
-
onSelect: () =>
|
|
11726
|
+
onSelect: () => SM({ fontWeight: "bold" }),
|
|
11726
11727
|
children: "Negrito"
|
|
11727
11728
|
})]
|
|
11728
11729
|
}) })] }),
|
|
@@ -11739,17 +11740,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11739
11740
|
children: [
|
|
11740
11741
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11741
11742
|
className: "ContextMenuItem",
|
|
11742
|
-
onSelect: () =>
|
|
11743
|
+
onSelect: () => SM({ textAlign: "left" }),
|
|
11743
11744
|
children: "Esquerda"
|
|
11744
11745
|
}),
|
|
11745
11746
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11746
11747
|
className: "ContextMenuItem",
|
|
11747
|
-
onSelect: () =>
|
|
11748
|
+
onSelect: () => SM({ textAlign: "center" }),
|
|
11748
11749
|
children: "Centro"
|
|
11749
11750
|
}),
|
|
11750
11751
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11751
11752
|
className: "ContextMenuItem",
|
|
11752
|
-
onSelect: () =>
|
|
11753
|
+
onSelect: () => SM({ textAlign: "right" }),
|
|
11753
11754
|
children: "Direita"
|
|
11754
11755
|
})
|
|
11755
11756
|
]
|
|
@@ -11767,7 +11768,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11767
11768
|
children: [
|
|
11768
11769
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11769
11770
|
className: "ContextMenuItem",
|
|
11770
|
-
onSelect: () =>
|
|
11771
|
+
onSelect: () => SM({
|
|
11771
11772
|
display: "flex",
|
|
11772
11773
|
flexDirection: "column",
|
|
11773
11774
|
justifyContent: "flex-start"
|
|
@@ -11776,7 +11777,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11776
11777
|
}),
|
|
11777
11778
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11778
11779
|
className: "ContextMenuItem",
|
|
11779
|
-
onSelect: () =>
|
|
11780
|
+
onSelect: () => SM({
|
|
11780
11781
|
display: "flex",
|
|
11781
11782
|
flexDirection: "column",
|
|
11782
11783
|
justifyContent: "center"
|
|
@@ -11785,7 +11786,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11785
11786
|
}),
|
|
11786
11787
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11787
11788
|
className: "ContextMenuItem",
|
|
11788
|
-
onSelect: () =>
|
|
11789
|
+
onSelect: () => SM({
|
|
11789
11790
|
display: "flex",
|
|
11790
11791
|
flexDirection: "column",
|
|
11791
11792
|
justifyContent: "flex-end"
|
|
@@ -11806,9 +11807,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11806
11807
|
sideOffset: 2,
|
|
11807
11808
|
alignOffset: -5,
|
|
11808
11809
|
children: [
|
|
11809
|
-
|
|
11810
|
+
EM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11810
11811
|
className: "ContextMenuItem",
|
|
11811
|
-
onSelect: () =>
|
|
11812
|
+
onSelect: () => SM({ backgroundColor: n }),
|
|
11812
11813
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11813
11814
|
width: 12,
|
|
11814
11815
|
height: 12,
|
|
@@ -11820,7 +11821,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11820
11821
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11821
11822
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11822
11823
|
className: "ContextMenuItem",
|
|
11823
|
-
onSelect: () =>
|
|
11824
|
+
onSelect: () => DM("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
11824
11825
|
children: "Outra Cor..."
|
|
11825
11826
|
})
|
|
11826
11827
|
]
|
|
@@ -11846,14 +11847,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11846
11847
|
"50%"
|
|
11847
11848
|
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
11848
11849
|
className: "ContextMenuItem",
|
|
11849
|
-
onSelect: () =>
|
|
11850
|
+
onSelect: () => SM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
11850
11851
|
children: n === "50%" ? "Círculo" : `${n}px`
|
|
11851
11852
|
}, n)),
|
|
11852
11853
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11853
11854
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11854
11855
|
className: "ContextMenuItem",
|
|
11855
11856
|
onSelect: () => {
|
|
11856
|
-
|
|
11857
|
+
oM("style"), tM(!0);
|
|
11857
11858
|
},
|
|
11858
11859
|
children: "Personalizar..."
|
|
11859
11860
|
})
|
|
@@ -11880,14 +11881,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11880
11881
|
32
|
|
11881
11882
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11882
11883
|
className: "ContextMenuItem",
|
|
11883
|
-
onSelect: () =>
|
|
11884
|
+
onSelect: () => SM({ padding: `${n}px` }),
|
|
11884
11885
|
children: [n, "px"]
|
|
11885
11886
|
}, n)),
|
|
11886
11887
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11887
11888
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11888
11889
|
className: "ContextMenuItem",
|
|
11889
11890
|
onSelect: () => {
|
|
11890
|
-
|
|
11891
|
+
oM("style"), tM(!0);
|
|
11891
11892
|
},
|
|
11892
11893
|
children: "Personalizar..."
|
|
11893
11894
|
})
|
|
@@ -11897,55 +11898,55 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11897
11898
|
}) })] })
|
|
11898
11899
|
] });
|
|
11899
11900
|
}, DraggableElement = React.memo(({ element: n, isSelected: _ }) => {
|
|
11900
|
-
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, G] = useState(!1), Z = useRef(null),
|
|
11901
|
+
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, G] = useState(!1), Z = useRef(null), Yj = useRef({
|
|
11901
11902
|
x: 0,
|
|
11902
11903
|
y: 0
|
|
11903
|
-
}),
|
|
11904
|
+
}), Xj = useRef({}), Zj = useRef(!1), eM = useRef(!1), tM = useRef(0), nM = useRef(0), rM = useRef({
|
|
11904
11905
|
x: 0,
|
|
11905
11906
|
y: 0
|
|
11906
|
-
}),
|
|
11907
|
-
if (
|
|
11908
|
-
if (n.type === "text" || n.type === "text-container")
|
|
11909
|
-
let O =
|
|
11910
|
-
return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
|
|
11907
|
+
}), oM = useRef(!1), sM = j.canvasHeight || 150, cM = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, lM = n.content, uM = {};
|
|
11908
|
+
if (cM) {
|
|
11909
|
+
if (n.type === "text" || n.type === "text-container") lM = lM.replace(/\{\{(.*?)\}\}/g, (_, E) => {
|
|
11910
|
+
let O = cM[E.trim()];
|
|
11911
|
+
return O == null ? _ : n.formatting ? formatValue$1(O, n.formatting) : String(O);
|
|
11911
11912
|
});
|
|
11912
11913
|
else if (n.type === "image") if (n.dataBinding) {
|
|
11913
|
-
let _ =
|
|
11914
|
-
_ != null && (
|
|
11915
|
-
} else
|
|
11916
|
-
let E =
|
|
11914
|
+
let _ = cM[n.dataBinding];
|
|
11915
|
+
_ != null && (lM = String(_));
|
|
11916
|
+
} else lM = lM.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
11917
|
+
let E = cM[_.trim()];
|
|
11917
11918
|
return E == null ? n : String(E);
|
|
11918
11919
|
});
|
|
11919
11920
|
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
11920
|
-
let E =
|
|
11921
|
-
E != null && (
|
|
11922
|
-
...
|
|
11921
|
+
let E = cM[_];
|
|
11922
|
+
E != null && (uM = {
|
|
11923
|
+
...uM,
|
|
11923
11924
|
[n]: String(E)
|
|
11924
11925
|
});
|
|
11925
11926
|
}), n.conditions && n.conditions.forEach((n) => {
|
|
11926
|
-
let _ =
|
|
11927
|
-
checkCondition(_, n.operator, n.value) && (
|
|
11928
|
-
...
|
|
11927
|
+
let _ = cM[n.property];
|
|
11928
|
+
checkCondition$1(_, n.operator, n.value) && (uM = {
|
|
11929
|
+
...uM,
|
|
11929
11930
|
...n.style
|
|
11930
11931
|
});
|
|
11931
11932
|
});
|
|
11932
11933
|
}
|
|
11933
|
-
let
|
|
11934
|
-
if (
|
|
11935
|
-
let { display: n, ..._ } =
|
|
11936
|
-
|
|
11934
|
+
let dM = uM.display === "none";
|
|
11935
|
+
if (dM && _) {
|
|
11936
|
+
let { display: n, ..._ } = uM;
|
|
11937
|
+
uM = _;
|
|
11937
11938
|
}
|
|
11938
|
-
let
|
|
11939
|
-
_.stopPropagation(), !
|
|
11940
|
-
},
|
|
11939
|
+
let fM = (_) => {
|
|
11940
|
+
_.stopPropagation(), !Zj.current && !eM.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
11941
|
+
}, pM = (O) => {
|
|
11941
11942
|
if (O.button !== 0) return;
|
|
11942
11943
|
O.stopPropagation();
|
|
11943
11944
|
let A = O.shiftKey;
|
|
11944
|
-
if (
|
|
11945
|
+
if (Zj.current = !1, eM.current = !1, n.groupId && !_) {
|
|
11945
11946
|
E(n.groupId, A);
|
|
11946
11947
|
return;
|
|
11947
11948
|
}
|
|
11948
|
-
_ || (E(n.id, A),
|
|
11949
|
+
_ || (E(n.id, A), eM.current = !0), z(!0), Yj.current = {
|
|
11949
11950
|
x: O.clientX,
|
|
11950
11951
|
y: O.clientY
|
|
11951
11952
|
}, O.currentTarget.setPointerCapture(O.pointerId);
|
|
@@ -11957,17 +11958,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11957
11958
|
x: n.x,
|
|
11958
11959
|
y: n.y
|
|
11959
11960
|
});
|
|
11960
|
-
}),
|
|
11961
|
-
},
|
|
11961
|
+
}), Xj.current = N;
|
|
11962
|
+
}, mM = (_) => {
|
|
11962
11963
|
if (P) {
|
|
11963
|
-
let E = j.zoom || 1, O = (_.clientX -
|
|
11964
|
-
(Math.abs(O) > 2 || Math.abs(M) > 2) && (
|
|
11965
|
-
let P = 5 / E, z = [], B = Object.entries(
|
|
11964
|
+
let E = j.zoom || 1, O = (_.clientX - Yj.current.x) / E, M = (_.clientY - Yj.current.y) / E;
|
|
11965
|
+
(Math.abs(O) > 2 || Math.abs(M) > 2) && (Zj.current = !0);
|
|
11966
|
+
let P = 5 / E, z = [], B = Object.entries(Xj.current).map(([_, E]) => {
|
|
11966
11967
|
let A = E.x + O, N = E.y + M;
|
|
11967
11968
|
if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
|
|
11968
11969
|
else {
|
|
11969
11970
|
let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
|
|
11970
|
-
Object.keys(
|
|
11971
|
+
Object.keys(Xj.current).length === 1 && j.elements.forEach((n) => {
|
|
11971
11972
|
if (n.id === _) return;
|
|
11972
11973
|
let j = n.width ?? 100, H = n.height ?? 100;
|
|
11973
11974
|
E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
|
|
@@ -12000,7 +12001,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12000
12001
|
if (A = Math.max(0, A), j.isList) {
|
|
12001
12002
|
N = Math.max(0, N);
|
|
12002
12003
|
let _ = n.height ?? 100;
|
|
12003
|
-
|
|
12004
|
+
sM > 0 && (N = Math.min(N, sM - _)), N = Math.max(0, N);
|
|
12004
12005
|
}
|
|
12005
12006
|
return {
|
|
12006
12007
|
id: _,
|
|
@@ -12012,25 +12013,25 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12012
12013
|
});
|
|
12013
12014
|
N && N(z), A(B, !1);
|
|
12014
12015
|
}
|
|
12015
|
-
},
|
|
12016
|
+
}, hM = (n) => {
|
|
12016
12017
|
P && (z(!1), n.currentTarget.releasePointerCapture(n.pointerId), A([], !0), N && N([]));
|
|
12017
|
-
},
|
|
12018
|
+
}, gM = (_) => {
|
|
12018
12019
|
_.stopPropagation(), _.preventDefault(), G(!0);
|
|
12019
12020
|
let E = _.target.closest(".resizable-element");
|
|
12020
12021
|
if (E) {
|
|
12021
12022
|
let O = E.getBoundingClientRect();
|
|
12022
|
-
|
|
12023
|
+
rM.current = {
|
|
12023
12024
|
x: O.left + O.width / 2,
|
|
12024
12025
|
y: O.top + O.height / 2
|
|
12025
12026
|
};
|
|
12026
|
-
let A = _.clientX -
|
|
12027
|
-
|
|
12027
|
+
let A = _.clientX - rM.current.x, j = _.clientY - rM.current.y;
|
|
12028
|
+
tM.current = Math.atan2(j, A) * (180 / Math.PI), nM.current = n.rotation || 0;
|
|
12028
12029
|
}
|
|
12029
12030
|
};
|
|
12030
12031
|
useEffect(() => {
|
|
12031
12032
|
let _ = (_) => {
|
|
12032
12033
|
if (U) {
|
|
12033
|
-
let E = _.clientX -
|
|
12034
|
+
let E = _.clientX - rM.current.x, A = _.clientY - rM.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - tM.current, M = (nM.current + j) % 360;
|
|
12034
12035
|
O(n.id, { rotation: M }, !1);
|
|
12035
12036
|
}
|
|
12036
12037
|
}, E = () => {
|
|
@@ -12052,7 +12053,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12052
12053
|
}
|
|
12053
12054
|
});
|
|
12054
12055
|
}, [
|
|
12055
|
-
|
|
12056
|
+
lM,
|
|
12056
12057
|
n.autoGrow,
|
|
12057
12058
|
n.containerExpansion,
|
|
12058
12059
|
n.style,
|
|
@@ -12062,7 +12063,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12062
12063
|
n.id,
|
|
12063
12064
|
n.type
|
|
12064
12065
|
]);
|
|
12065
|
-
let
|
|
12066
|
+
let _M = {
|
|
12066
12067
|
position: "relative",
|
|
12067
12068
|
left: 0,
|
|
12068
12069
|
top: 0,
|
|
@@ -12080,7 +12081,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12080
12081
|
userSelect: "none",
|
|
12081
12082
|
boxSizing: "border-box",
|
|
12082
12083
|
...n.style,
|
|
12083
|
-
...
|
|
12084
|
+
...uM
|
|
12084
12085
|
};
|
|
12085
12086
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
12086
12087
|
className: "resizable-element",
|
|
@@ -12088,9 +12089,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12088
12089
|
width: n.width ?? 100,
|
|
12089
12090
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
12090
12091
|
},
|
|
12091
|
-
maxHeight: j.isList ? Math.max(10,
|
|
12092
|
+
maxHeight: j.isList ? Math.max(10, sM - n.y) : void 0,
|
|
12092
12093
|
onResizeStart: (n) => {
|
|
12093
|
-
H(!0),
|
|
12094
|
+
H(!0), oM.current = !!n.shiftKey;
|
|
12094
12095
|
},
|
|
12095
12096
|
onResizeStop: (_, E, A, j) => {
|
|
12096
12097
|
H(!1);
|
|
@@ -12177,8 +12178,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12177
12178
|
position: "absolute",
|
|
12178
12179
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
12179
12180
|
height: n.autoGrow ? "auto" : void 0,
|
|
12180
|
-
display:
|
|
12181
|
-
opacity:
|
|
12181
|
+
display: dM && !_ ? "none" : void 0,
|
|
12182
|
+
opacity: dM && _ ? .4 : 1,
|
|
12182
12183
|
zIndex: _ ? 1e3 : void 0,
|
|
12183
12184
|
outline: "none",
|
|
12184
12185
|
overflow: "visible"
|
|
@@ -12193,7 +12194,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12193
12194
|
bottomLeft: !1,
|
|
12194
12195
|
topLeft: !1
|
|
12195
12196
|
},
|
|
12196
|
-
lockAspectRatio:
|
|
12197
|
+
lockAspectRatio: oM.current === !0,
|
|
12197
12198
|
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
12198
12199
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
12199
12200
|
element: n,
|
|
@@ -12206,18 +12207,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12206
12207
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
12207
12208
|
ref: Z,
|
|
12208
12209
|
style: {
|
|
12209
|
-
...
|
|
12210
|
-
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" :
|
|
12210
|
+
..._M,
|
|
12211
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : _M.whiteSpace,
|
|
12211
12212
|
width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : "100%",
|
|
12212
12213
|
height: n.type === "text-container" && n.autoGrow && n.containerExpansion === "vertical" ? "auto" : "100%"
|
|
12213
12214
|
},
|
|
12214
|
-
onPointerDown:
|
|
12215
|
-
onPointerMove:
|
|
12216
|
-
onPointerUp:
|
|
12215
|
+
onPointerDown: pM,
|
|
12216
|
+
onPointerMove: mM,
|
|
12217
|
+
onPointerUp: hM,
|
|
12217
12218
|
onMouseDown: (n) => {
|
|
12218
12219
|
n.button === 0 && n.stopPropagation();
|
|
12219
12220
|
},
|
|
12220
|
-
onClick:
|
|
12221
|
+
onClick: fM,
|
|
12221
12222
|
title: n.name,
|
|
12222
12223
|
onMouseEnter: (n) => {
|
|
12223
12224
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
@@ -12248,7 +12249,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12248
12249
|
width: "100%",
|
|
12249
12250
|
height: "100%"
|
|
12250
12251
|
},
|
|
12251
|
-
children:
|
|
12252
|
+
children: lM
|
|
12252
12253
|
}),
|
|
12253
12254
|
n.type === "text-container" && /* @__PURE__ */ jsx(p$2, {
|
|
12254
12255
|
style: {
|
|
@@ -12256,10 +12257,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12256
12257
|
height: "100%",
|
|
12257
12258
|
display: "block"
|
|
12258
12259
|
},
|
|
12259
|
-
children:
|
|
12260
|
+
children: lM
|
|
12260
12261
|
}),
|
|
12261
|
-
n.type === "image" && (
|
|
12262
|
-
src:
|
|
12262
|
+
n.type === "image" && (lM ? /* @__PURE__ */ jsx("img", {
|
|
12263
|
+
src: lM,
|
|
12263
12264
|
alt: "Element",
|
|
12264
12265
|
style: {
|
|
12265
12266
|
width: "100%",
|
|
@@ -12324,7 +12325,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12324
12325
|
zIndex: 50,
|
|
12325
12326
|
boxShadow: "0 0 0 2px white"
|
|
12326
12327
|
},
|
|
12327
|
-
onMouseDown:
|
|
12328
|
+
onMouseDown: gM,
|
|
12328
12329
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
12329
12330
|
position: "absolute",
|
|
12330
12331
|
top: 12,
|
|
@@ -12339,44 +12340,44 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12339
12340
|
})
|
|
12340
12341
|
});
|
|
12341
12342
|
}), Canvas = () => {
|
|
12342
|
-
let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: U } = useEditor(), G = useRef(null), [Z,
|
|
12343
|
+
let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: U } = useEditor(), G = useRef(null), [Z, Yj] = useState(null), Xj = useRef(!1), Zj = useRef(!1), eM = useRef(!1), tM = useRef({
|
|
12343
12344
|
x: 0,
|
|
12344
12345
|
y: 0
|
|
12345
|
-
}),
|
|
12346
|
+
}), nM = useRef({
|
|
12346
12347
|
x: 0,
|
|
12347
12348
|
y: 0
|
|
12348
|
-
}),
|
|
12349
|
-
if (E.button === 1 || E.button === 0 &&
|
|
12350
|
-
E.preventDefault(),
|
|
12349
|
+
}), rM = useRef([]), oM = (E) => {
|
|
12350
|
+
if (E.button === 1 || E.button === 0 && eM.current) {
|
|
12351
|
+
E.preventDefault(), Zj.current = !0, nM.current = {
|
|
12351
12352
|
x: E.clientX,
|
|
12352
12353
|
y: E.clientY
|
|
12353
12354
|
};
|
|
12354
12355
|
return;
|
|
12355
12356
|
}
|
|
12356
|
-
|
|
12357
|
+
Xj.current = !0;
|
|
12357
12358
|
let O = G.current?.getBoundingClientRect();
|
|
12358
12359
|
if (!O) return;
|
|
12359
12360
|
let A = O.left, j = O.top;
|
|
12360
|
-
|
|
12361
|
+
tM.current = {
|
|
12361
12362
|
x: (E.clientX - A - n.pan.x) / n.zoom,
|
|
12362
12363
|
y: (E.clientY - j - n.pan.y) / n.zoom
|
|
12363
|
-
},
|
|
12364
|
-
},
|
|
12364
|
+
}, rM.current = n.selectedElementIds, E.shiftKey || (_(null), rM.current = []), window.addEventListener("mousemove", sM), window.addEventListener("mouseup", cM);
|
|
12365
|
+
}, sM = useCallback((_) => {
|
|
12365
12366
|
if (!G.current) return;
|
|
12366
|
-
if (
|
|
12367
|
-
let E = _.clientX -
|
|
12367
|
+
if (Zj.current) {
|
|
12368
|
+
let E = _.clientX - nM.current.x, O = _.clientY - nM.current.y;
|
|
12368
12369
|
j({
|
|
12369
12370
|
x: n.pan.x + E,
|
|
12370
12371
|
y: n.pan.y + O
|
|
12371
|
-
}),
|
|
12372
|
+
}), nM.current = {
|
|
12372
12373
|
x: _.clientX,
|
|
12373
12374
|
y: _.clientY
|
|
12374
12375
|
};
|
|
12375
12376
|
return;
|
|
12376
12377
|
}
|
|
12377
|
-
if (!
|
|
12378
|
-
let O = G.current.getBoundingClientRect(), A = (_.clientX - O.left - n.pan.x) / n.zoom, M = (_.clientY - O.top - n.pan.y) / n.zoom, N = Math.min(
|
|
12379
|
-
if (
|
|
12378
|
+
if (!Xj.current) return;
|
|
12379
|
+
let O = G.current.getBoundingClientRect(), A = (_.clientX - O.left - n.pan.x) / n.zoom, M = (_.clientY - O.top - n.pan.y) / n.zoom, N = Math.min(tM.current.x, A), P = Math.min(tM.current.y, M), z = Math.abs(A - tM.current.x), B = Math.abs(M - tM.current.y);
|
|
12380
|
+
if (Yj({
|
|
12380
12381
|
x: N,
|
|
12381
12382
|
y: P,
|
|
12382
12383
|
width: z,
|
|
@@ -12386,7 +12387,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12386
12387
|
n.elements.forEach((n) => {
|
|
12387
12388
|
let E = n.x ?? 0, O = n.y ?? 0, A = n.width ?? 100, j = n.height ?? 100, M = E + A, H = O + j, U = N + z, W = P + B;
|
|
12388
12389
|
E < U && M > N && O < W && H > P && _.push(n.id);
|
|
12389
|
-
}), E(Array.from(new Set([...
|
|
12390
|
+
}), E(Array.from(new Set([...rM.current, ..._])));
|
|
12390
12391
|
}
|
|
12391
12392
|
}, [
|
|
12392
12393
|
n.elements,
|
|
@@ -12394,15 +12395,15 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12394
12395
|
n.zoom,
|
|
12395
12396
|
E,
|
|
12396
12397
|
j
|
|
12397
|
-
]),
|
|
12398
|
-
|
|
12399
|
-
}, [
|
|
12398
|
+
]), cM = useCallback(() => {
|
|
12399
|
+
Xj.current = !1, Zj.current = !1, Yj(null), window.removeEventListener("mousemove", sM), window.removeEventListener("mouseup", cM);
|
|
12400
|
+
}, [sM]), lM = useRef(n);
|
|
12400
12401
|
useEffect(() => {
|
|
12401
|
-
|
|
12402
|
+
lM.current = n;
|
|
12402
12403
|
}, [n]), useEffect(() => {
|
|
12403
12404
|
let n = (n) => {
|
|
12404
12405
|
n.preventDefault();
|
|
12405
|
-
let _ =
|
|
12406
|
+
let _ = lM.current;
|
|
12406
12407
|
if (n.ctrlKey || n.metaKey) A(Math.min(Math.max(.1, _.zoom - n.deltaY * .001), 5));
|
|
12407
12408
|
else {
|
|
12408
12409
|
let E = n.shiftKey ? n.deltaY : n.deltaX, O = n.shiftKey ? n.deltaX : n.deltaY;
|
|
@@ -12417,7 +12418,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12417
12418
|
};
|
|
12418
12419
|
}, [A, j]), useEffect(() => {
|
|
12419
12420
|
let _ = (_) => {
|
|
12420
|
-
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (
|
|
12421
|
+
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (eM.current = !0, G.current && (G.current.style.cursor = "grab")), !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && ((_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "z" && (_.preventDefault(), _.shiftKey ? N() : M()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "y" && (_.preventDefault(), N()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "c" && (_.preventDefault(), P()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "v" && (_.preventDefault(), z()), (_.key === "Delete" || _.key === "Backspace") && (_.preventDefault(), B()), [
|
|
12421
12422
|
"ArrowUp",
|
|
12422
12423
|
"ArrowDown",
|
|
12423
12424
|
"ArrowLeft",
|
|
@@ -12445,10 +12446,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12445
12446
|
}), O.length > 0 && U(O);
|
|
12446
12447
|
}
|
|
12447
12448
|
}, E = (n) => {
|
|
12448
|
-
n.code === "Space" && (
|
|
12449
|
+
n.code === "Space" && (eM.current = !1, G.current && !Zj.current && (G.current.style.cursor = "default"));
|
|
12449
12450
|
};
|
|
12450
12451
|
return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
|
|
12451
|
-
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove",
|
|
12452
|
+
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove", sM), window.removeEventListener("mouseup", cM);
|
|
12452
12453
|
};
|
|
12453
12454
|
}, [
|
|
12454
12455
|
M,
|
|
@@ -12459,24 +12460,24 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12459
12460
|
U,
|
|
12460
12461
|
n.selectedElementIds,
|
|
12461
12462
|
n.elements,
|
|
12462
|
-
|
|
12463
|
-
|
|
12463
|
+
sM,
|
|
12464
|
+
cM
|
|
12464
12465
|
]);
|
|
12465
|
-
let
|
|
12466
|
-
n.stopPropagation(), n.preventDefault(),
|
|
12467
|
-
},
|
|
12468
|
-
if (!
|
|
12466
|
+
let uM = useRef(!1), { setCanvasHeight: dM } = useEditor(), fM = (n) => {
|
|
12467
|
+
n.stopPropagation(), n.preventDefault(), uM.current = !0, window.addEventListener("mousemove", pM), window.addEventListener("mouseup", mM);
|
|
12468
|
+
}, pM = useCallback((n) => {
|
|
12469
|
+
if (!uM.current || !G.current) return;
|
|
12469
12470
|
let _ = G.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12470
|
-
|
|
12471
|
-
}, [
|
|
12472
|
-
|
|
12473
|
-
}, [
|
|
12471
|
+
dM(Math.round(O));
|
|
12472
|
+
}, [dM]), mM = useCallback(() => {
|
|
12473
|
+
uM.current = !1, window.removeEventListener("mousemove", pM), window.removeEventListener("mouseup", mM);
|
|
12474
|
+
}, [pM]);
|
|
12474
12475
|
useEffect(() => () => {
|
|
12475
|
-
window.removeEventListener("mousemove",
|
|
12476
|
-
}, [
|
|
12477
|
-
let
|
|
12476
|
+
window.removeEventListener("mousemove", pM), window.removeEventListener("mouseup", mM);
|
|
12477
|
+
}, [pM, mM]);
|
|
12478
|
+
let hM = (n) => {
|
|
12478
12479
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12479
|
-
},
|
|
12480
|
+
}, gM = (n) => {
|
|
12480
12481
|
n.preventDefault();
|
|
12481
12482
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
12482
12483
|
if (_) {
|
|
@@ -12491,19 +12492,19 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12491
12492
|
dataBinding: _
|
|
12492
12493
|
});
|
|
12493
12494
|
}
|
|
12494
|
-
},
|
|
12495
|
+
}, _M = n.canvasHeight || 150;
|
|
12495
12496
|
return /* @__PURE__ */ jsxs(p, {
|
|
12496
12497
|
ref: G,
|
|
12497
|
-
onMouseDown:
|
|
12498
|
-
onDragOver:
|
|
12499
|
-
onDrop:
|
|
12498
|
+
onMouseDown: oM,
|
|
12499
|
+
onDragOver: hM,
|
|
12500
|
+
onDrop: gM,
|
|
12500
12501
|
style: {
|
|
12501
12502
|
width: "100%",
|
|
12502
12503
|
height: "100%",
|
|
12503
12504
|
position: "relative",
|
|
12504
12505
|
overflow: "hidden",
|
|
12505
12506
|
backgroundColor: "var(--color-background)",
|
|
12506
|
-
cursor:
|
|
12507
|
+
cursor: Zj.current ? "grabbing" : "default",
|
|
12507
12508
|
backgroundImage: "radial-gradient(var(--gray-5) 1px, transparent 1px)",
|
|
12508
12509
|
backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
|
|
12509
12510
|
backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
|
|
@@ -12576,7 +12577,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12576
12577
|
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
12577
12578
|
style: {
|
|
12578
12579
|
position: "absolute",
|
|
12579
|
-
top:
|
|
12580
|
+
top: _M,
|
|
12580
12581
|
left: 0,
|
|
12581
12582
|
right: 0,
|
|
12582
12583
|
height: "10px",
|
|
@@ -12588,7 +12589,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12588
12589
|
justifyContent: "center",
|
|
12589
12590
|
group: "resize-handle"
|
|
12590
12591
|
},
|
|
12591
|
-
onMouseDown:
|
|
12592
|
+
onMouseDown: fM,
|
|
12592
12593
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12593
12594
|
width: "100%",
|
|
12594
12595
|
height: "2px",
|
|
@@ -12612,7 +12613,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12612
12613
|
},
|
|
12613
12614
|
children: [
|
|
12614
12615
|
"Altura do Item: ",
|
|
12615
|
-
|
|
12616
|
+
_M,
|
|
12616
12617
|
"px"
|
|
12617
12618
|
]
|
|
12618
12619
|
})]
|
|
@@ -12691,22 +12692,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12691
12692
|
})]
|
|
12692
12693
|
});
|
|
12693
12694
|
}, EditorSettings = () => {
|
|
12694
|
-
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,
|
|
12695
|
+
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, Yj] = useState("150"), [Xj, Zj] = useState(""), [Qj, eM] = useState("0"), [tM, nM] = useState("slideIn"), [rM, oM] = useState(.3), [sM, cM] = useState("ease-out");
|
|
12695
12696
|
return useEffect(() => {
|
|
12696
12697
|
if (A) {
|
|
12697
|
-
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"),
|
|
12698
|
+
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) : ""), Yj(String(n.canvasHeight || 150)), eM(String(n.gridSize || 0));
|
|
12698
12699
|
let _ = n.listSettings.entryAnimation;
|
|
12699
|
-
|
|
12700
|
+
nM(_?.type || "slideIn"), oM(_?.duration || .3), cM(_?.timingFunction || "ease-out");
|
|
12700
12701
|
}
|
|
12701
12702
|
}, [A]), useEffect(() => {
|
|
12702
12703
|
if (!A) return;
|
|
12703
12704
|
let _ = parseInt(Z, 10);
|
|
12704
12705
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
12705
|
-
let j = parseInt(
|
|
12706
|
+
let j = parseInt(Qj, 10);
|
|
12706
12707
|
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
12707
12708
|
}, [
|
|
12708
12709
|
Z,
|
|
12709
|
-
|
|
12710
|
+
Qj,
|
|
12710
12711
|
A,
|
|
12711
12712
|
E,
|
|
12712
12713
|
O,
|
|
@@ -12885,7 +12886,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12885
12886
|
type: "number",
|
|
12886
12887
|
min: "10",
|
|
12887
12888
|
value: Z,
|
|
12888
|
-
onChange: (n) =>
|
|
12889
|
+
onChange: (n) => Yj(n.target.value)
|
|
12889
12890
|
}),
|
|
12890
12891
|
/* @__PURE__ */ jsx(p$2, {
|
|
12891
12892
|
size: "1",
|
|
@@ -12906,8 +12907,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12906
12907
|
type: "number",
|
|
12907
12908
|
min: "0",
|
|
12908
12909
|
placeholder: "Auto (100%)",
|
|
12909
|
-
value:
|
|
12910
|
-
onChange: (n) =>
|
|
12910
|
+
value: Xj,
|
|
12911
|
+
onChange: (n) => Zj(n.target.value)
|
|
12911
12912
|
}),
|
|
12912
12913
|
/* @__PURE__ */ jsx(p$2, {
|
|
12913
12914
|
size: "1",
|
|
@@ -12933,8 +12934,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12933
12934
|
as: "div",
|
|
12934
12935
|
children: "Efeito"
|
|
12935
12936
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12936
|
-
value:
|
|
12937
|
-
onChange: (n) =>
|
|
12937
|
+
value: tM,
|
|
12938
|
+
onChange: (n) => nM(n.target.value),
|
|
12938
12939
|
style: {
|
|
12939
12940
|
width: "100%",
|
|
12940
12941
|
padding: "6px",
|
|
@@ -12996,8 +12997,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12996
12997
|
type: "number",
|
|
12997
12998
|
step: "0.1",
|
|
12998
12999
|
min: "0.1",
|
|
12999
|
-
value:
|
|
13000
|
-
onChange: (n) =>
|
|
13000
|
+
value: rM,
|
|
13001
|
+
onChange: (n) => oM(parseFloat(n.target.value) || .3)
|
|
13001
13002
|
})] }),
|
|
13002
13003
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
13003
13004
|
size: "1",
|
|
@@ -13005,8 +13006,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13005
13006
|
as: "div",
|
|
13006
13007
|
children: "Curva (Easing)"
|
|
13007
13008
|
}), /* @__PURE__ */ jsxs("select", {
|
|
13008
|
-
value:
|
|
13009
|
-
onChange: (n) =>
|
|
13009
|
+
value: sM,
|
|
13010
|
+
onChange: (n) => cM(n.target.value),
|
|
13010
13011
|
style: {
|
|
13011
13012
|
width: "100%",
|
|
13012
13013
|
padding: "6px",
|
|
@@ -13061,8 +13062,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13061
13062
|
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
13062
13063
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
13063
13064
|
type: "number",
|
|
13064
|
-
value:
|
|
13065
|
-
onChange: (n) =>
|
|
13065
|
+
value: Qj,
|
|
13066
|
+
onChange: (n) => eM(n.target.value),
|
|
13066
13067
|
placeholder: "0"
|
|
13067
13068
|
})]
|
|
13068
13069
|
})
|
|
@@ -13081,11 +13082,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
13081
13082
|
children: "Cancelar"
|
|
13082
13083
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
13083
13084
|
onClick: () => {
|
|
13084
|
-
let n = parseInt(
|
|
13085
|
-
type:
|
|
13086
|
-
duration: Number(
|
|
13085
|
+
let n = parseInt(Xj, 10), E = {
|
|
13086
|
+
type: tM,
|
|
13087
|
+
duration: Number(rM),
|
|
13087
13088
|
delay: 0,
|
|
13088
|
-
timingFunction:
|
|
13089
|
+
timingFunction: sM
|
|
13089
13090
|
};
|
|
13090
13091
|
_({
|
|
13091
13092
|
sortProp: M === "__none__" ? "" : M,
|
|
@@ -13249,13 +13250,13 @@ function createRenderBatcher(n, _) {
|
|
|
13249
13250
|
}, 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 = () => {
|
|
13250
13251
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
13251
13252
|
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));
|
|
13252
|
-
},
|
|
13253
|
+
}, Yj = () => {
|
|
13253
13254
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
13254
13255
|
};
|
|
13255
13256
|
return {
|
|
13256
13257
|
schedule: stepsOrder.reduce((n, _) => {
|
|
13257
13258
|
let O = M[_];
|
|
13258
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
13259
|
+
return n[_] = (n, _ = !1, A = !1) => (E || Yj(), O.schedule(n, _, A)), n;
|
|
13259
13260
|
}, {}),
|
|
13260
13261
|
cancel: (n) => {
|
|
13261
13262
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -13613,40 +13614,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
13613
13614
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
13614
13615
|
...E,
|
|
13615
13616
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
13616
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
13617
|
-
O ||=
|
|
13618
|
-
let
|
|
13617
|
+
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Yj = M - j, Xj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), Zj = Math.abs(Yj) < 5;
|
|
13618
|
+
O ||= Zj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= Zj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
13619
|
+
let Qj;
|
|
13619
13620
|
if (Z < 1) {
|
|
13620
|
-
let n = calcAngularFreq(
|
|
13621
|
-
|
|
13622
|
-
} else if (Z === 1)
|
|
13621
|
+
let n = calcAngularFreq(Xj, Z);
|
|
13622
|
+
Qj = (_) => M - Math.exp(-Z * Xj * _) * ((G + Z * Xj * Yj) / n * Math.sin(n * _) + Yj * Math.cos(n * _));
|
|
13623
|
+
} else if (Z === 1) Qj = (n) => M - Math.exp(-Xj * n) * (Yj + (G + Xj * Yj) * n);
|
|
13623
13624
|
else {
|
|
13624
|
-
let n =
|
|
13625
|
-
|
|
13626
|
-
let E = Math.exp(-Z *
|
|
13627
|
-
return M - E * ((G + Z *
|
|
13625
|
+
let n = Xj * Math.sqrt(Z * Z - 1);
|
|
13626
|
+
Qj = (_) => {
|
|
13627
|
+
let E = Math.exp(-Z * Xj * _), O = Math.min(n * _, 300);
|
|
13628
|
+
return M - E * ((G + Z * Xj * Yj) * Math.sinh(O) + n * Yj * Math.cosh(O)) / n;
|
|
13628
13629
|
};
|
|
13629
13630
|
}
|
|
13630
|
-
let
|
|
13631
|
+
let $j = {
|
|
13631
13632
|
calculatedDuration: W && H || null,
|
|
13632
13633
|
next: (n) => {
|
|
13633
|
-
let _ =
|
|
13634
|
+
let _ = Qj(n);
|
|
13634
13635
|
if (W) N.done = n >= H;
|
|
13635
13636
|
else {
|
|
13636
13637
|
let E = n === 0 ? G : 0;
|
|
13637
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
13638
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Qj, n, _));
|
|
13638
13639
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
13639
13640
|
N.done = j && P;
|
|
13640
13641
|
}
|
|
13641
13642
|
return N.value = N.done ? M : _, N;
|
|
13642
13643
|
},
|
|
13643
13644
|
toString: () => {
|
|
13644
|
-
let n = Math.min(calcGeneratorDuration(
|
|
13645
|
+
let n = Math.min(calcGeneratorDuration($j), maxGeneratorDuration), _ = generateLinearEasing((_) => $j.next(n * _).value, n, 30);
|
|
13645
13646
|
return n + "ms " + _;
|
|
13646
13647
|
},
|
|
13647
13648
|
toTransition: () => {}
|
|
13648
13649
|
};
|
|
13649
|
-
return
|
|
13650
|
+
return $j;
|
|
13650
13651
|
}
|
|
13651
13652
|
spring.applyToOptions = (n) => {
|
|
13652
13653
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -13656,26 +13657,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
13656
13657
|
let H = n[0], U = {
|
|
13657
13658
|
done: !1,
|
|
13658
13659
|
value: H
|
|
13659
|
-
}, 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 * _,
|
|
13660
|
-
|
|
13661
|
-
let
|
|
13662
|
-
let _ =
|
|
13663
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
13664
|
-
},
|
|
13665
|
-
W(U.value) && (
|
|
13660
|
+
}, 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 * _, Yj = H + Z, Xj = M === void 0 ? Yj : M(Yj);
|
|
13661
|
+
Xj !== Yj && (Z = Xj - H);
|
|
13662
|
+
let Zj = (n) => -Z * Math.exp(-n / O), Qj = (n) => Xj + Zj(n), $j = (n) => {
|
|
13663
|
+
let _ = Zj(n), E = Qj(n);
|
|
13664
|
+
U.done = Math.abs(_) <= z, U.value = U.done ? Xj : E;
|
|
13665
|
+
}, eM, tM, nM = (n) => {
|
|
13666
|
+
W(U.value) && (eM = n, tM = spring({
|
|
13666
13667
|
keyframes: [U.value, G(U.value)],
|
|
13667
|
-
velocity: calcGeneratorVelocity(
|
|
13668
|
+
velocity: calcGeneratorVelocity(Qj, n, U.value),
|
|
13668
13669
|
damping: A,
|
|
13669
13670
|
stiffness: j,
|
|
13670
13671
|
restDelta: z,
|
|
13671
13672
|
restSpeed: B
|
|
13672
13673
|
}));
|
|
13673
13674
|
};
|
|
13674
|
-
return
|
|
13675
|
+
return nM(0), {
|
|
13675
13676
|
calculatedDuration: null,
|
|
13676
13677
|
next: (n) => {
|
|
13677
13678
|
let _ = !1;
|
|
13678
|
-
return !
|
|
13679
|
+
return !tM && eM === void 0 && (_ = !0, $j(n), nM(n)), eM !== void 0 && n >= eM ? tM.next(n - eM) : (!_ && $j(n), U);
|
|
13679
13680
|
}
|
|
13680
13681
|
};
|
|
13681
13682
|
}
|
|
@@ -13795,22 +13796,22 @@ var WithPromise = class {
|
|
|
13795
13796
|
if (this.startTime === null) return E.next(0);
|
|
13796
13797
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
13797
13798
|
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);
|
|
13798
|
-
let
|
|
13799
|
-
this.currentTime = Math.max(
|
|
13800
|
-
let
|
|
13799
|
+
let Yj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), Xj = this.playbackSpeed >= 0 ? Yj < 0 : Yj > O;
|
|
13800
|
+
this.currentTime = Math.max(Yj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
|
|
13801
|
+
let Zj = this.currentTime, Qj = E;
|
|
13801
13802
|
if (B) {
|
|
13802
13803
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
13803
|
-
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (
|
|
13804
|
+
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Qj = j)), Zj = clamp(0, 1, E) * M;
|
|
13804
13805
|
}
|
|
13805
|
-
let
|
|
13806
|
+
let $j = Xj ? {
|
|
13806
13807
|
done: !1,
|
|
13807
13808
|
value: z[0]
|
|
13808
|
-
} :
|
|
13809
|
-
A && (
|
|
13810
|
-
let { done:
|
|
13811
|
-
!
|
|
13812
|
-
let
|
|
13813
|
-
return
|
|
13809
|
+
} : Qj.next(Zj);
|
|
13810
|
+
A && ($j.value = A($j.value));
|
|
13811
|
+
let { done: eM } = $j;
|
|
13812
|
+
!Xj && N !== null && (eM = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
|
|
13813
|
+
let tM = this.holdTime === null && (this.state === "finished" || this.state === "running" && eM);
|
|
13814
|
+
return tM && W !== inertia && ($j.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G($j.value), tM && this.finish(), $j;
|
|
13814
13815
|
}
|
|
13815
13816
|
then(n, _) {
|
|
13816
13817
|
return this.finished.then(n, _);
|
|
@@ -14873,46 +14874,46 @@ function onlyElements(n) {
|
|
|
14873
14874
|
}), _;
|
|
14874
14875
|
}
|
|
14875
14876
|
var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
|
|
14876
|
-
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H),
|
|
14877
|
+
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Yj = useConstant(() => /* @__PURE__ */ new Map()), Xj = useRef(/* @__PURE__ */ new Set()), [eM, tM] = useState(H), [nM, aM] = useState(H);
|
|
14877
14878
|
useIsomorphicLayoutEffect(() => {
|
|
14878
14879
|
G.current = !1, Z.current = H;
|
|
14879
|
-
for (let n = 0; n <
|
|
14880
|
-
let _ = getChildKey(
|
|
14881
|
-
W.includes(_) ? (
|
|
14880
|
+
for (let n = 0; n < nM.length; n++) {
|
|
14881
|
+
let _ = getChildKey(nM[n]);
|
|
14882
|
+
W.includes(_) ? (Yj.delete(_), Xj.current.delete(_)) : Yj.get(_) !== !0 && Yj.set(_, !1);
|
|
14882
14883
|
}
|
|
14883
14884
|
}, [
|
|
14884
|
-
|
|
14885
|
+
nM,
|
|
14885
14886
|
W.length,
|
|
14886
14887
|
W.join("-")
|
|
14887
14888
|
]);
|
|
14888
|
-
let
|
|
14889
|
-
if (H !==
|
|
14889
|
+
let oM = [];
|
|
14890
|
+
if (H !== eM) {
|
|
14890
14891
|
let n = [...H];
|
|
14891
|
-
for (let _ = 0; _ <
|
|
14892
|
-
let E =
|
|
14893
|
-
W.includes(O) || (n.splice(_, 0, E),
|
|
14892
|
+
for (let _ = 0; _ < nM.length; _++) {
|
|
14893
|
+
let E = nM[_], O = getChildKey(E);
|
|
14894
|
+
W.includes(O) || (n.splice(_, 0, E), oM.push(E));
|
|
14894
14895
|
}
|
|
14895
|
-
return j === "wait" &&
|
|
14896
|
+
return j === "wait" && oM.length && (n = oM), aM(onlyElements(n)), tM(H), null;
|
|
14896
14897
|
}
|
|
14897
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
14898
|
-
let { forceRender:
|
|
14899
|
-
return jsx(Fragment$1, { children:
|
|
14900
|
-
let U = getChildKey(n),
|
|
14898
|
+
process.env.NODE_ENV !== "production" && j === "wait" && nM.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.");
|
|
14899
|
+
let { forceRender: sM } = useContext(LayoutGroupContext);
|
|
14900
|
+
return jsx(Fragment$1, { children: nM.map((n) => {
|
|
14901
|
+
let U = getChildKey(n), Zj = M && !z ? !1 : H === nM || W.includes(U);
|
|
14901
14902
|
return jsx(PresenceChild, {
|
|
14902
|
-
isPresent:
|
|
14903
|
+
isPresent: Zj,
|
|
14903
14904
|
initial: !G.current || E ? void 0 : !1,
|
|
14904
14905
|
custom: _,
|
|
14905
14906
|
presenceAffectsLayout: A,
|
|
14906
14907
|
mode: j,
|
|
14907
14908
|
root: P,
|
|
14908
|
-
onExitComplete:
|
|
14909
|
-
if (
|
|
14910
|
-
if (
|
|
14909
|
+
onExitComplete: Zj ? void 0 : () => {
|
|
14910
|
+
if (Xj.current.has(U)) return;
|
|
14911
|
+
if (Xj.current.add(U), Yj.has(U)) Yj.set(U, !0);
|
|
14911
14912
|
else return;
|
|
14912
14913
|
let n = !0;
|
|
14913
|
-
|
|
14914
|
+
Yj.forEach((_) => {
|
|
14914
14915
|
_ || (n = !1);
|
|
14915
|
-
}), n && (
|
|
14916
|
+
}), n && (sM?.(), aM(Z.current), M && B?.(), O && O());
|
|
14916
14917
|
},
|
|
14917
14918
|
anchorX: N,
|
|
14918
14919
|
children: n
|
|
@@ -15341,12 +15342,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
15341
15342
|
useInsertionEffect(() => {
|
|
15342
15343
|
H && Z.current && H.update(E, P);
|
|
15343
15344
|
});
|
|
15344
|
-
let
|
|
15345
|
+
let Xj = E[optimizedAppearDataAttribute], Zj = useRef(!!Xj && !window.MotionHandoffIsComplete?.(Xj) && window.MotionHasOptimisedAnimation?.(Xj));
|
|
15345
15346
|
return useIsomorphicLayoutEffect(() => {
|
|
15346
|
-
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(),
|
|
15347
|
+
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), Zj.current && H.animationState && H.animationState.animateChanges());
|
|
15347
15348
|
}), useEffect(() => {
|
|
15348
|
-
H && (!
|
|
15349
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
15349
|
+
H && (!Zj.current && H.animationState && H.animationState.animateChanges(), Zj.current &&= (queueMicrotask(() => {
|
|
15350
|
+
window.MotionHandoffMarkAsComplete?.(Xj);
|
|
15350
15351
|
}), !1), H.enteringChildren = void 0);
|
|
15351
15352
|
}), H;
|
|
15352
15353
|
}
|
|
@@ -16024,34 +16025,34 @@ function createAnimationState(n) {
|
|
|
16024
16025
|
function M(j) {
|
|
16025
16026
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
16026
16027
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
16027
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
16028
|
-
|
|
16029
|
-
let
|
|
16030
|
-
if (
|
|
16031
|
-
let
|
|
16032
|
-
|
|
16033
|
-
let { prevResolvedValues:
|
|
16034
|
-
...
|
|
16035
|
-
...
|
|
16036
|
-
},
|
|
16037
|
-
|
|
16028
|
+
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Yj = U === j ? W.isActive : null;
|
|
16029
|
+
Yj === !1 && (H = _);
|
|
16030
|
+
let Xj = G === N[U] && G !== M[U] && Z;
|
|
16031
|
+
if (Xj && O && n.manuallyAnimateOnMount && (Xj = !1), W.protectedKeys = { ...B }, !W.isActive && Yj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
|
|
16032
|
+
let Zj = checkVariantsDidChange(W.prevProp, G), Qj = Zj || U === j && W.isActive && !Xj && Z || _ > H && Z, $j = !1, eM = Array.isArray(G) ? G : [G], tM = eM.reduce(A(U), {});
|
|
16033
|
+
Yj === !1 && (tM = {});
|
|
16034
|
+
let { prevResolvedValues: nM = {} } = W, rM = {
|
|
16035
|
+
...nM,
|
|
16036
|
+
...tM
|
|
16037
|
+
}, iM = (_) => {
|
|
16038
|
+
Qj = !0, z.has(_) && ($j = !0, z.delete(_)), W.needsAnimating[_] = !0;
|
|
16038
16039
|
let E = n.getValue(_);
|
|
16039
16040
|
E && (E.liveStyle = !1);
|
|
16040
16041
|
};
|
|
16041
|
-
for (let n in
|
|
16042
|
-
let _ =
|
|
16042
|
+
for (let n in rM) {
|
|
16043
|
+
let _ = tM[n], E = nM[n];
|
|
16043
16044
|
if (B.hasOwnProperty(n)) continue;
|
|
16044
16045
|
let O = !1;
|
|
16045
|
-
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) :
|
|
16046
|
+
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : iM(n) : _ !== void 0 && z.has(n) ? iM(n) : W.protectedKeys[n] = !0;
|
|
16046
16047
|
}
|
|
16047
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
16048
|
+
W.prevProp = G, W.prevResolvedValues = tM, W.isActive && (B = {
|
|
16048
16049
|
...B,
|
|
16049
|
-
...
|
|
16050
|
-
}), O && n.blockInitialAnimation && (
|
|
16051
|
-
let
|
|
16052
|
-
|
|
16050
|
+
...tM
|
|
16051
|
+
}), O && n.blockInitialAnimation && (Qj = !1);
|
|
16052
|
+
let aM = Xj && Zj;
|
|
16053
|
+
Qj && (!aM || $j) && P.push(...eM.map((_) => {
|
|
16053
16054
|
let E = { type: U };
|
|
16054
|
-
if (typeof _ == "string" && O && !
|
|
16055
|
+
if (typeof _ == "string" && O && !aM && n.manuallyAnimateOnMount && n.parent) {
|
|
16055
16056
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
16056
16057
|
if (O.enteringChildren && A) {
|
|
16057
16058
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -17553,7 +17554,7 @@ var gestureAnimations = {
|
|
|
17553
17554
|
if (n.id === _.id) return !1;
|
|
17554
17555
|
let E = .1;
|
|
17555
17556
|
return n.x >= _.x - E && n.x + n.width <= _.x + _.width + E && n.y >= _.y - E && n.y + n.height <= _.y + _.height + E;
|
|
17556
|
-
}, measureTextHeight = (n, _, E, O, A = 1.2) => {
|
|
17557
|
+
}, measureTextHeight$1 = (n, _, E, O, A = 1.2) => {
|
|
17557
17558
|
if (!n) return 0;
|
|
17558
17559
|
let j = document.createElement("canvas").getContext("2d");
|
|
17559
17560
|
if (!j) return 0;
|
|
@@ -17574,7 +17575,7 @@ const processLayout = (n, _) => {
|
|
|
17574
17575
|
let j = n.content;
|
|
17575
17576
|
_ && (j = j.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
17576
17577
|
let A = _[O.trim()];
|
|
17577
|
-
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
17578
|
+
return A == null ? E : n.formatting ? formatValue$1(A, n.formatting) : String(A);
|
|
17578
17579
|
}));
|
|
17579
17580
|
let N = parseInt(String(n.style?.fontSize || 16)), P = String(n.style?.fontFamily || "Arial");
|
|
17580
17581
|
if (M && n.containerExpansion === "horizontal") {
|
|
@@ -17585,7 +17586,7 @@ const processLayout = (n, _) => {
|
|
|
17585
17586
|
O > n.width && (n.width = O, n.content = j);
|
|
17586
17587
|
}
|
|
17587
17588
|
} else {
|
|
17588
|
-
let _ = measureTextHeight(j, n.width, P, N), M = n.height, z = _ - M;
|
|
17589
|
+
let _ = measureTextHeight$1(j, n.width, P, N), M = n.height, z = _ - M;
|
|
17589
17590
|
if (z > 0) {
|
|
17590
17591
|
n.height = _, n.content = j;
|
|
17591
17592
|
let N = [], P = O.get(n.id);
|
|
@@ -17725,7 +17726,7 @@ var getAnimationVariants = (n) => {
|
|
|
17725
17726
|
if (E) {
|
|
17726
17727
|
if (n.type === "text" || n.type === "text-container") O = O.replace(/\{\{(.*?)\}\}/g, (_, O) => {
|
|
17727
17728
|
let A = E[O.trim()];
|
|
17728
|
-
return A == null ? _ : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
17729
|
+
return A == null ? _ : n.formatting ? formatValue$1(A, n.formatting) : String(A);
|
|
17729
17730
|
});
|
|
17730
17731
|
else if (n.type === "image") if (n.dataBinding) {
|
|
17731
17732
|
let _ = E[n.dataBinding];
|
|
@@ -17950,16 +17951,16 @@ const Preview = () => {
|
|
|
17950
17951
|
});
|
|
17951
17952
|
};
|
|
17952
17953
|
var LayersPanel = ({ onOpenSettings: n }) => {
|
|
17953
|
-
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"),
|
|
17954
|
+
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"), Yj = /* @__PURE__ */ new Map();
|
|
17954
17955
|
Z.forEach((n) => {
|
|
17955
|
-
|
|
17956
|
+
Yj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
|
|
17956
17957
|
});
|
|
17957
|
-
let
|
|
17958
|
+
let Xj = _.elements.filter((n) => n.type !== "group" && !n.groupId), Zj = (n) => {
|
|
17958
17959
|
P((_) => ({
|
|
17959
17960
|
..._,
|
|
17960
17961
|
[n]: !_[n]
|
|
17961
17962
|
}));
|
|
17962
|
-
},
|
|
17963
|
+
}, Qj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
|
|
17963
17964
|
style: {
|
|
17964
17965
|
borderRadius: 6,
|
|
17965
17966
|
backgroundColor: _.selectedElementIds.includes(O.id) ? "var(--gray-5)" : "var(--gray-3)",
|
|
@@ -18024,9 +18025,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18024
18025
|
direction: "column",
|
|
18025
18026
|
gap: "2",
|
|
18026
18027
|
children: [
|
|
18027
|
-
|
|
18028
|
+
Xj.map((n) => Qj(n, 0)),
|
|
18028
18029
|
Z.map((_) => {
|
|
18029
|
-
let O = N[_.id] === !0, j =
|
|
18030
|
+
let O = N[_.id] === !0, j = Yj.get(_.id) || [];
|
|
18030
18031
|
return /* @__PURE__ */ jsxs(p, {
|
|
18031
18032
|
style: {
|
|
18032
18033
|
border: "1px dashed var(--gray-6)",
|
|
@@ -18043,7 +18044,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18043
18044
|
onClick: () => {
|
|
18044
18045
|
E(_.id), n && n(_.id);
|
|
18045
18046
|
},
|
|
18046
|
-
onDoubleClick: () =>
|
|
18047
|
+
onDoubleClick: () => Zj(_.id),
|
|
18047
18048
|
onDragOver: (n) => {
|
|
18048
18049
|
n.preventDefault();
|
|
18049
18050
|
},
|
|
@@ -18072,7 +18073,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18072
18073
|
direction: "column",
|
|
18073
18074
|
gap: "2",
|
|
18074
18075
|
style: { padding: "6px 8px" },
|
|
18075
|
-
children: [j.map((n) =>
|
|
18076
|
+
children: [j.map((n) => Qj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
|
|
18076
18077
|
size: "1",
|
|
18077
18078
|
color: "gray",
|
|
18078
18079
|
children: "Solte elementos aqui para agrupar"
|
|
@@ -18132,7 +18133,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18132
18133
|
]
|
|
18133
18134
|
});
|
|
18134
18135
|
}, EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
18135
|
-
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo:
|
|
18136
|
+
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Yj, redo: Xj, copy: Zj, paste: Qj, removeSelected: eM, updateElements: tM } = useEditor(), nM = React.useRef(null), rM = () => {
|
|
18136
18137
|
let n = {
|
|
18137
18138
|
elements: Z.elements,
|
|
18138
18139
|
isList: Z.isList,
|
|
@@ -18143,9 +18144,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18143
18144
|
gridSize: Z.gridSize
|
|
18144
18145
|
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
18145
18146
|
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);
|
|
18146
|
-
},
|
|
18147
|
-
|
|
18148
|
-
},
|
|
18147
|
+
}, oM = () => {
|
|
18148
|
+
nM.current?.click();
|
|
18149
|
+
}, sM = (n) => {
|
|
18149
18150
|
let _ = n.target.files?.[0];
|
|
18150
18151
|
if (!_) return;
|
|
18151
18152
|
let E = new FileReader();
|
|
@@ -18185,11 +18186,11 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18185
18186
|
}, [W]), React.useEffect(() => {
|
|
18186
18187
|
let n = (n) => {
|
|
18187
18188
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
18188
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
18189
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
18190
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
18191
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
18192
|
-
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(),
|
|
18189
|
+
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), Xj()) : (n.preventDefault(), Yj());
|
|
18190
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), Xj();
|
|
18191
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), Zj();
|
|
18192
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Qj();
|
|
18193
|
+
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), eM());
|
|
18193
18194
|
else if ([
|
|
18194
18195
|
"ArrowUp",
|
|
18195
18196
|
"ArrowDown",
|
|
@@ -18207,20 +18208,20 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18207
18208
|
changes: j
|
|
18208
18209
|
});
|
|
18209
18210
|
}
|
|
18210
|
-
}), E.length > 0 &&
|
|
18211
|
+
}), E.length > 0 && tM(E);
|
|
18211
18212
|
}
|
|
18212
18213
|
}
|
|
18213
18214
|
};
|
|
18214
18215
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
18215
18216
|
}, [
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18217
|
+
Yj,
|
|
18218
|
+
Xj,
|
|
18219
|
+
Zj,
|
|
18220
|
+
Qj,
|
|
18221
|
+
eM,
|
|
18221
18222
|
Z.selectedElementIds,
|
|
18222
18223
|
Z.elements,
|
|
18223
|
-
|
|
18224
|
+
tM
|
|
18224
18225
|
]), React.useEffect(() => {
|
|
18225
18226
|
if (E) try {
|
|
18226
18227
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
@@ -18229,7 +18230,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18229
18230
|
console.error("Failed to load initial state", n);
|
|
18230
18231
|
}
|
|
18231
18232
|
}, [E, G]);
|
|
18232
|
-
let
|
|
18233
|
+
let cM = (n) => {
|
|
18233
18234
|
console.log(`Adding element of type: ${n}`), W({
|
|
18234
18235
|
type: n,
|
|
18235
18236
|
content: `New ${n}`
|
|
@@ -18290,19 +18291,19 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18290
18291
|
style: { width: "240px" },
|
|
18291
18292
|
children: [
|
|
18292
18293
|
/* @__PURE__ */ jsx(v$3, {
|
|
18293
|
-
onSelect: () =>
|
|
18294
|
+
onSelect: () => cM("text"),
|
|
18294
18295
|
children: "Texto"
|
|
18295
18296
|
}),
|
|
18296
18297
|
/* @__PURE__ */ jsx(v$3, {
|
|
18297
|
-
onSelect: () =>
|
|
18298
|
+
onSelect: () => cM("image"),
|
|
18298
18299
|
children: "Imagem"
|
|
18299
18300
|
}),
|
|
18300
18301
|
/* @__PURE__ */ jsx(v$3, {
|
|
18301
|
-
onSelect: () =>
|
|
18302
|
+
onSelect: () => cM("box"),
|
|
18302
18303
|
children: "Caixa (Container)"
|
|
18303
18304
|
}),
|
|
18304
18305
|
/* @__PURE__ */ jsx(v$3, {
|
|
18305
|
-
onSelect: () =>
|
|
18306
|
+
onSelect: () => cM("text-container"),
|
|
18306
18307
|
children: "Container com Texto"
|
|
18307
18308
|
})
|
|
18308
18309
|
]
|
|
@@ -18341,7 +18342,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18341
18342
|
cursor: "pointer",
|
|
18342
18343
|
justifyContent: "center"
|
|
18343
18344
|
},
|
|
18344
|
-
onClick:
|
|
18345
|
+
onClick: rM,
|
|
18345
18346
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
18346
18347
|
}), /* @__PURE__ */ jsxs(o, {
|
|
18347
18348
|
variant: "soft",
|
|
@@ -18351,16 +18352,16 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18351
18352
|
cursor: "pointer",
|
|
18352
18353
|
justifyContent: "center"
|
|
18353
18354
|
},
|
|
18354
|
-
onClick:
|
|
18355
|
+
onClick: oM,
|
|
18355
18356
|
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
18356
18357
|
})]
|
|
18357
18358
|
}),
|
|
18358
18359
|
/* @__PURE__ */ jsx("input", {
|
|
18359
18360
|
type: "file",
|
|
18360
|
-
ref:
|
|
18361
|
+
ref: nM,
|
|
18361
18362
|
style: { display: "none" },
|
|
18362
18363
|
accept: ".json",
|
|
18363
|
-
onChange:
|
|
18364
|
+
onChange: sM
|
|
18364
18365
|
}),
|
|
18365
18366
|
/* @__PURE__ */ jsx(p, {
|
|
18366
18367
|
mt: "2",
|
|
@@ -18546,5 +18547,399 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
|
18546
18547
|
availableProps: n.layout.props,
|
|
18547
18548
|
theme: n.theme,
|
|
18548
18549
|
children: /* @__PURE__ */ jsx(EditorContent, { ...n })
|
|
18549
|
-
}), 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 computeLayout = (elements, itemData) => {\n const layoutElements = JSON.parse(JSON.stringify(elements));\n \n const isInside = (inner, outer) => {\n const eps = 0.1;\n return (\n inner.x >= outer.x - eps &&\n inner.x + inner.width <= outer.x + outer.width + eps &&\n inner.y >= outer.y - eps &&\n inner.y + inner.height <= outer.y + outer.height + eps\n );\n };\n\n const autoGrowElements = layoutElements\n .filter(el => (el.type === 'text' || el.type === 'text-container') && el.autoGrow)\n .sort((a, b) => a.y - b.y);\n\n autoGrowElements.forEach(textEl => {\n let content = textEl.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 \n const fontSize = parseInt(String((textEl.style && textEl.style.fontSize) || 16));\n const fontFamily = String((textEl.style && textEl.style.fontFamily) || 'Arial');\n \n const isHorizontal = textEl.type === 'text-container' && textEl.containerExpansion === 'horizontal';\n \n if (isHorizontal) {\n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (context) {\n context.font = `${fontSize}px ${fontFamily}`;\n const metrics = context.measureText(content);\n const padding = parseInt(String((textEl.style && textEl.style.padding) || 0)) * 2;\n const newWidth = Math.ceil(metrics.width + padding);\n if (newWidth > textEl.width) {\n textEl.width = newWidth;\n }\n }\n } catch(e) {}\n } else {\n const measuredHeight = measureTextHeight(content, textEl.width, fontFamily, fontSize);\n const designHeight = textEl.height;\n const delta = measuredHeight - designHeight;\n \n if (delta > 0) {\n const originalBottom = textEl.y + designHeight;\n const originalTextRect = {\n x: textEl.x,\n y: textEl.y,\n width: textEl.width,\n height: designHeight\n };\n \n textEl.height = measuredHeight;\n \n layoutElements.forEach(other => {\n if (other.id === textEl.id) return;\n \n if (isInside(originalTextRect, other)) {\n other.height += delta;\n }\n \n if (other.y >= originalBottom) {\n other.y += delta;\n }\n });\n }\n }\n });\n \n let maxY = 0;\n layoutElements.forEach(el => {\n const bottom = el.y + el.height;\n if (bottom > maxY) maxY = bottom;\n });\n \n return { layoutElements, maxY };\n };\n\n const computeItemHeight = (elements, itemData, fallbackHeight) => {\n const { maxY } = computeLayout(elements, itemData);\n return fallbackHeight ? Math.max(maxY, fallbackHeight) : 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 const { layoutElements } = computeLayout(elements, itemData);\n return layoutElements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text' || element.type === 'text-container') {\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 // Resolve Style Bindings\n let bindingStyles = {};\n if (element.styleBindings) {\n Object.entries(element.styleBindings).forEach(([styleProp, variableName]) => {\n const val = itemData[variableName];\n if (val !== undefined && val !== null) {\n bindingStyles[styleProp] = String(val);\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.type === 'text-container' && element.autoGrow && element.containerExpansion === 'horizontal') ? 'nowrap' : (element.autoGrow ? 'pre-wrap' : undefined),\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles,\n ...bindingStyles\n };\n \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' || element.type === 'text-container') {\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 } else if (element.type === 'checkbox') {\n let isChecked = false;\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n isChecked = val === true || String(val) === 'true';\n }\n const checkboxStyle = styleObjectToString({\n ...baseStyle,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n });\n return `<div style=\"${checkboxStyle}\"><input type=\"checkbox\" ${isChecked ? 'checked' : ''} disabled style=\"width:100%;height:100%;margin:0;\" /></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 });\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 computeLayout = ${computeLayout.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 });\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";
|
|
18550
|
+
});
|
|
18551
|
+
var camelToKebab = (n) => n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), hex8ToRgba = (n) => {
|
|
18552
|
+
let _ = /^#([0-9a-fA-F]{8})$/.exec(n);
|
|
18553
|
+
if (!_) return n;
|
|
18554
|
+
let E = _[1];
|
|
18555
|
+
return `rgba(${parseInt(E.slice(0, 2), 16)}, ${parseInt(E.slice(2, 4), 16)}, ${parseInt(E.slice(4, 6), 16)}, ${parseInt(E.slice(6, 8), 16) / 255})`;
|
|
18556
|
+
}, styleObjectToString = (n) => {
|
|
18557
|
+
if (!n) return "";
|
|
18558
|
+
let _ = [
|
|
18559
|
+
"width",
|
|
18560
|
+
"height",
|
|
18561
|
+
"top",
|
|
18562
|
+
"left",
|
|
18563
|
+
"right",
|
|
18564
|
+
"bottom",
|
|
18565
|
+
"fontSize",
|
|
18566
|
+
"borderRadius",
|
|
18567
|
+
"padding",
|
|
18568
|
+
"margin",
|
|
18569
|
+
"borderWidth",
|
|
18570
|
+
"borderTopLeftRadius",
|
|
18571
|
+
"borderTopRightRadius",
|
|
18572
|
+
"borderBottomRightRadius",
|
|
18573
|
+
"borderBottomLeftRadius"
|
|
18574
|
+
];
|
|
18575
|
+
return Object.entries(n).map(([n, E]) => {
|
|
18576
|
+
if (E == null) return "";
|
|
18577
|
+
let O = camelToKebab(n), A = typeof E == "number" && _.includes(n) ? E + "px" : E;
|
|
18578
|
+
return typeof A == "string" && /^#([0-9a-fA-F]{8})$/.test(A) && (A = hex8ToRgba(A)), `${O}: ${A}`;
|
|
18579
|
+
}).filter(Boolean).join("; ");
|
|
18580
|
+
}, measureTextHeight = (n, _, E, O, A = 1.2) => {
|
|
18581
|
+
if (!n) return 0;
|
|
18582
|
+
try {
|
|
18583
|
+
let j = document.createElement("canvas").getContext("2d");
|
|
18584
|
+
if (!j) return 0;
|
|
18585
|
+
j.font = `${O}px ${E}`;
|
|
18586
|
+
let M = String(n).split(" "), N = "", P = 1;
|
|
18587
|
+
for (let n = 0; n < M.length; n++) {
|
|
18588
|
+
let E = N + M[n] + " ";
|
|
18589
|
+
j.measureText(E).width > _ && n > 0 ? (N = M[n] + " ", P++) : N = E;
|
|
18590
|
+
}
|
|
18591
|
+
let z = String(n).split("\n").length - 1;
|
|
18592
|
+
return P += z, Math.ceil(P * O * A);
|
|
18593
|
+
} catch {
|
|
18594
|
+
return 0;
|
|
18595
|
+
}
|
|
18596
|
+
}, checkCondition = (n, _, E) => {
|
|
18597
|
+
let O = String(n).toLowerCase(), A = String(E).toLowerCase();
|
|
18598
|
+
switch (_) {
|
|
18599
|
+
case "equals": return O === A;
|
|
18600
|
+
case "notEquals": return O !== A;
|
|
18601
|
+
case "contains": return O.includes(A);
|
|
18602
|
+
case "greaterThan": return parseFloat(O) > parseFloat(A);
|
|
18603
|
+
case "lessThan": return parseFloat(O) < parseFloat(A);
|
|
18604
|
+
case "truthy": return !!n;
|
|
18605
|
+
case "falsy": return !n;
|
|
18606
|
+
default: return !1;
|
|
18607
|
+
}
|
|
18608
|
+
}, formatValue = (n, _) => {
|
|
18609
|
+
if (!_ || _.type === "text") return n == null ? "" : String(n);
|
|
18610
|
+
if (n == null) return "";
|
|
18611
|
+
if (_.type === "boolean") return String(n) === "true" || n === !0 || typeof n == "number" && n > 0 ? _.trueLabel || "Sim" : _.falseLabel || "Não";
|
|
18612
|
+
if (_.type === "date") try {
|
|
18613
|
+
let E = new Date(n);
|
|
18614
|
+
if (isNaN(E.getTime())) return String(n);
|
|
18615
|
+
if (_.dateFormat) {
|
|
18616
|
+
let n = E.getDate().toString().padStart(2, "0"), O = (E.getMonth() + 1).toString().padStart(2, "0"), A = E.getFullYear(), j = E.getHours().toString().padStart(2, "0"), M = E.getMinutes().toString().padStart(2, "0"), N = E.getSeconds().toString().padStart(2, "0");
|
|
18617
|
+
return _.dateFormat.replace("DD", n).replace("MM", O).replace("YYYY", String(A)).replace("HH", j).replace("mm", M).replace("ss", N);
|
|
18618
|
+
}
|
|
18619
|
+
return E.toLocaleDateString();
|
|
18620
|
+
} catch {
|
|
18621
|
+
return String(n);
|
|
18622
|
+
}
|
|
18623
|
+
if (_.type === "number") {
|
|
18624
|
+
let E = parseFloat(n);
|
|
18625
|
+
return isNaN(E) ? String(n) : _.numberFormat === "currency" ? (_.currencySymbol || "R$") + " " + E.toFixed(_.decimalPlaces || 2) : _.numberFormat === "percent" ? E.toFixed(_.decimalPlaces || 0) + "%" : E.toFixed(_.decimalPlaces || 0);
|
|
18626
|
+
}
|
|
18627
|
+
return String(n);
|
|
18628
|
+
}, computeLayout = (n, _) => {
|
|
18629
|
+
let E = JSON.parse(JSON.stringify(n)), O = (n, _) => {
|
|
18630
|
+
let E = .1;
|
|
18631
|
+
return n.x >= _.x - E && n.x + n.width <= _.x + _.width + E && n.y >= _.y - E && n.y + n.height <= _.y + _.height + E;
|
|
18632
|
+
};
|
|
18633
|
+
E.filter((n) => (n.type === "text" || n.type === "text-container") && n.autoGrow).sort((n, _) => n.y - _.y).forEach((n) => {
|
|
18634
|
+
let A = n.content;
|
|
18635
|
+
A = A.replace(/\{\{(.*?)\}\}/g, (n, E) => {
|
|
18636
|
+
let O = _[E.trim()];
|
|
18637
|
+
return O == null ? n : String(O);
|
|
18638
|
+
});
|
|
18639
|
+
let j = parseInt(String(n.style && n.style.fontSize || 16)), M = String(n.style && n.style.fontFamily || "Arial");
|
|
18640
|
+
if (n.type === "text-container" && n.containerExpansion === "horizontal") try {
|
|
18641
|
+
let _ = document.createElement("canvas").getContext("2d");
|
|
18642
|
+
if (_) {
|
|
18643
|
+
_.font = `${j}px ${M}`;
|
|
18644
|
+
let E = _.measureText(A), O = parseInt(String(n.style && n.style.padding || 0)) * 2, N = Math.ceil(E.width + O);
|
|
18645
|
+
N > n.width && (n.width = N);
|
|
18646
|
+
}
|
|
18647
|
+
} catch {}
|
|
18648
|
+
else {
|
|
18649
|
+
let _ = measureTextHeight(A, n.width, M, j), N = n.height, P = _ - N;
|
|
18650
|
+
if (P > 0) {
|
|
18651
|
+
let A = n.y + N, j = {
|
|
18652
|
+
x: n.x,
|
|
18653
|
+
y: n.y,
|
|
18654
|
+
width: n.width,
|
|
18655
|
+
height: N
|
|
18656
|
+
};
|
|
18657
|
+
n.height = _, E.forEach((_) => {
|
|
18658
|
+
_.id !== n.id && (O(j, _) && (_.height += P), _.y >= A && (_.y += P));
|
|
18659
|
+
});
|
|
18660
|
+
}
|
|
18661
|
+
}
|
|
18662
|
+
});
|
|
18663
|
+
let A = 0;
|
|
18664
|
+
return E.forEach((n) => {
|
|
18665
|
+
let _ = n.y + n.height;
|
|
18666
|
+
_ > A && (A = _);
|
|
18667
|
+
}), {
|
|
18668
|
+
layoutElements: E,
|
|
18669
|
+
maxY: A
|
|
18670
|
+
};
|
|
18671
|
+
}, computeItemHeight = (n, _, E) => {
|
|
18672
|
+
let { maxY: O } = computeLayout(n, _);
|
|
18673
|
+
return E ? Math.max(O, E) : O;
|
|
18674
|
+
}, vanillaRenderItem = (n, _, E = 0, O = 0) => {
|
|
18675
|
+
let { layoutElements: A } = computeLayout(n, _);
|
|
18676
|
+
return A.map((n) => {
|
|
18677
|
+
let E = n.content, A = "";
|
|
18678
|
+
if (n.type === "text" || n.type === "text-container") E = E.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
18679
|
+
let A = _[O.trim()];
|
|
18680
|
+
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
18681
|
+
});
|
|
18682
|
+
else if (n.type === "image") if (n.dataBinding) {
|
|
18683
|
+
let O = _[n.dataBinding];
|
|
18684
|
+
A = O == null ? E : String(O);
|
|
18685
|
+
} else A = E.replace(/\{\{(.*?)\}\}/g, (n, E) => {
|
|
18686
|
+
let O = _[E.trim()];
|
|
18687
|
+
return O == null ? n : String(O);
|
|
18688
|
+
});
|
|
18689
|
+
let j = {};
|
|
18690
|
+
n.conditions && n.conditions.forEach((n) => {
|
|
18691
|
+
let E = _[n.property];
|
|
18692
|
+
checkCondition(E, n.operator, n.value) && (j = {
|
|
18693
|
+
...j,
|
|
18694
|
+
...n.style
|
|
18695
|
+
});
|
|
18696
|
+
});
|
|
18697
|
+
let M = {};
|
|
18698
|
+
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, E]) => {
|
|
18699
|
+
let O = _[E];
|
|
18700
|
+
O != null && (M[n] = String(O));
|
|
18701
|
+
});
|
|
18702
|
+
let N = {
|
|
18703
|
+
position: "absolute",
|
|
18704
|
+
left: n.x,
|
|
18705
|
+
top: n.y + O,
|
|
18706
|
+
width: n.width,
|
|
18707
|
+
height: n.autoGrow ? "auto" : n.height,
|
|
18708
|
+
transform: n.rotation ? `rotate(${n.rotation}deg)` : void 0,
|
|
18709
|
+
overflow: n.autoGrow ? "visible" : "hidden",
|
|
18710
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : n.autoGrow ? "pre-wrap" : void 0,
|
|
18711
|
+
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
18712
|
+
...n.style,
|
|
18713
|
+
...j,
|
|
18714
|
+
...M
|
|
18715
|
+
}, P = styleObjectToString(N);
|
|
18716
|
+
if (n.type === "text" || n.type === "text-container") return `<div style="${P}">${E}</div>`;
|
|
18717
|
+
if (n.type === "image") {
|
|
18718
|
+
let _ = styleObjectToString({
|
|
18719
|
+
width: "100%",
|
|
18720
|
+
height: "100%",
|
|
18721
|
+
objectFit: n.style?.objectFit || "cover",
|
|
18722
|
+
display: "block"
|
|
18723
|
+
});
|
|
18724
|
+
return `<div style="${P}"><img src="${A}" alt="Element" style="${_}" /></div>`;
|
|
18725
|
+
} else if (n.type === "box") return `<div style="${P}"></div>`;
|
|
18726
|
+
else if (n.type === "checkbox") {
|
|
18727
|
+
let E = !1;
|
|
18728
|
+
if (n.dataBinding) {
|
|
18729
|
+
let O = _[n.dataBinding];
|
|
18730
|
+
E = O === !0 || String(O) === "true";
|
|
18731
|
+
}
|
|
18732
|
+
return `<div style="${styleObjectToString({
|
|
18733
|
+
...N,
|
|
18734
|
+
display: "flex",
|
|
18735
|
+
alignItems: "center",
|
|
18736
|
+
justifyContent: "center"
|
|
18737
|
+
})}"><input type="checkbox" ${E ? "checked" : ""} disabled style="width:100%;height:100%;margin:0;" /></div>`;
|
|
18738
|
+
}
|
|
18739
|
+
return "";
|
|
18740
|
+
}).join("\n");
|
|
18741
|
+
}, ElementRenderer = ({ element: n, itemData: _ }) => {
|
|
18742
|
+
let E = n.content, O = "";
|
|
18743
|
+
if (n.type === "text" || n.type === "text-container") E = E.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
18744
|
+
let A = _[O.trim()];
|
|
18745
|
+
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
18746
|
+
});
|
|
18747
|
+
else if (n.type === "image") if (n.dataBinding) {
|
|
18748
|
+
let A = _[n.dataBinding];
|
|
18749
|
+
O = A == null ? E : String(A);
|
|
18750
|
+
} else O = E.replace(/\{\{(.*?)\}\}/g, (n, E) => {
|
|
18751
|
+
let O = _[E.trim()];
|
|
18752
|
+
return O == null ? n : String(O);
|
|
18753
|
+
});
|
|
18754
|
+
let A = {};
|
|
18755
|
+
n.conditions && n.conditions.forEach((n) => {
|
|
18756
|
+
let E = _[n.property];
|
|
18757
|
+
checkCondition(E, n.operator, n.value) && (A = {
|
|
18758
|
+
...A,
|
|
18759
|
+
...n.style
|
|
18760
|
+
});
|
|
18761
|
+
});
|
|
18762
|
+
let j = {};
|
|
18763
|
+
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, E]) => {
|
|
18764
|
+
let O = _[E];
|
|
18765
|
+
O != null && (j[n] = String(O));
|
|
18766
|
+
});
|
|
18767
|
+
let M = {
|
|
18768
|
+
position: "absolute",
|
|
18769
|
+
left: n.x,
|
|
18770
|
+
top: n.y,
|
|
18771
|
+
width: n.width,
|
|
18772
|
+
height: n.autoGrow ? "auto" : n.height,
|
|
18773
|
+
transform: n.rotation ? `rotate(${n.rotation}deg)` : void 0,
|
|
18774
|
+
overflow: n.autoGrow ? "visible" : "hidden",
|
|
18775
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : n.autoGrow ? "pre-wrap" : void 0,
|
|
18776
|
+
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
18777
|
+
...n.style,
|
|
18778
|
+
...A,
|
|
18779
|
+
...j
|
|
18780
|
+
};
|
|
18781
|
+
if (n.type === "text" || n.type === "text-container") return /* @__PURE__ */ jsx("div", {
|
|
18782
|
+
style: M,
|
|
18783
|
+
children: E
|
|
18784
|
+
});
|
|
18785
|
+
if (n.type === "image") {
|
|
18786
|
+
let _ = {
|
|
18787
|
+
width: "100%",
|
|
18788
|
+
height: "100%",
|
|
18789
|
+
objectFit: n.style?.objectFit || "cover",
|
|
18790
|
+
display: "block"
|
|
18791
|
+
};
|
|
18792
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18793
|
+
style: M,
|
|
18794
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
18795
|
+
src: O,
|
|
18796
|
+
alt: "Element",
|
|
18797
|
+
style: _
|
|
18798
|
+
})
|
|
18799
|
+
});
|
|
18800
|
+
} else if (n.type === "box") return /* @__PURE__ */ jsx("div", { style: M });
|
|
18801
|
+
else if (n.type === "checkbox") {
|
|
18802
|
+
let E = !1;
|
|
18803
|
+
if (n.dataBinding) {
|
|
18804
|
+
let O = _[n.dataBinding];
|
|
18805
|
+
E = O === !0 || String(O) === "true";
|
|
18806
|
+
}
|
|
18807
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18808
|
+
style: {
|
|
18809
|
+
...M,
|
|
18810
|
+
display: "flex",
|
|
18811
|
+
alignItems: "center",
|
|
18812
|
+
justifyContent: "center"
|
|
18813
|
+
},
|
|
18814
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
18815
|
+
type: "checkbox",
|
|
18816
|
+
checked: E,
|
|
18817
|
+
disabled: !0,
|
|
18818
|
+
style: {
|
|
18819
|
+
width: "100%",
|
|
18820
|
+
height: "100%",
|
|
18821
|
+
margin: 0
|
|
18822
|
+
}
|
|
18823
|
+
})
|
|
18824
|
+
});
|
|
18825
|
+
}
|
|
18826
|
+
return null;
|
|
18827
|
+
}, HtmlDocument = ({ elements: n, data: _, options: E }) => {
|
|
18828
|
+
let { isList: O, listSettings: A } = E;
|
|
18829
|
+
if (O && Array.isArray(_)) {
|
|
18830
|
+
let O = [..._];
|
|
18831
|
+
if (A?.sortProp) {
|
|
18832
|
+
let n = A.sortProp, _ = A.sortOrder === "asc" ? 1 : -1;
|
|
18833
|
+
O.sort((E, O) => (E[n] < O[n] ? -1 : 1) * _);
|
|
18834
|
+
}
|
|
18835
|
+
A?.newestPosition === "top" && O.reverse();
|
|
18836
|
+
let j = A?.newestPosition === "top" ? "flex-start" : "flex-end", M = A?.entryAnimation || {
|
|
18837
|
+
type: "slideIn",
|
|
18838
|
+
duration: .3
|
|
18839
|
+
}, N = M.type === "none" ? "none" : M.type, P = M.duration + "s", z = M.timingFunction || "ease-out", B = {
|
|
18840
|
+
display: "flex",
|
|
18841
|
+
flexDirection: "column",
|
|
18842
|
+
justifyContent: j,
|
|
18843
|
+
height: A?.containerHeight ? A.containerHeight + "px" : "100%",
|
|
18844
|
+
width: "100%",
|
|
18845
|
+
overflowY: "auto",
|
|
18846
|
+
overflowX: "hidden",
|
|
18847
|
+
boxSizing: "border-box",
|
|
18848
|
+
padding: "10px"
|
|
18849
|
+
};
|
|
18850
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
18851
|
+
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: "\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 .list-wrapper::-webkit-scrollbar { width: 6px; }\n .list-wrapper::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.2); border-radius: 3px; }\n " } }),
|
|
18852
|
+
/* @__PURE__ */ jsx("div", {
|
|
18853
|
+
className: "list-wrapper",
|
|
18854
|
+
style: B,
|
|
18855
|
+
children: O.map((_, O) => /* @__PURE__ */ jsx("div", {
|
|
18856
|
+
className: "list-item",
|
|
18857
|
+
style: {
|
|
18858
|
+
position: "relative",
|
|
18859
|
+
height: computeItemHeight(n, _, E.canvasHeight || 0),
|
|
18860
|
+
width: "100%",
|
|
18861
|
+
flexShrink: 0,
|
|
18862
|
+
animation: `${N} ${P} ${z}`,
|
|
18863
|
+
marginBottom: "10px"
|
|
18864
|
+
},
|
|
18865
|
+
children: computeLayout(n, _).layoutElements.map((n) => /* @__PURE__ */ jsx(ElementRenderer, {
|
|
18866
|
+
element: n,
|
|
18867
|
+
itemData: _
|
|
18868
|
+
}, n.id))
|
|
18869
|
+
}, O))
|
|
18870
|
+
}),
|
|
18871
|
+
A?.scrollDirection === "up" && /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: "document.addEventListener('DOMContentLoaded', () => { const w = document.querySelector('.list-wrapper'); if(w) w.scrollTop = w.scrollHeight; });" } })
|
|
18872
|
+
] });
|
|
18873
|
+
}
|
|
18874
|
+
let { layoutElements: j } = computeLayout(n, _);
|
|
18875
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18876
|
+
style: {
|
|
18877
|
+
position: "relative",
|
|
18878
|
+
width: "100%",
|
|
18879
|
+
height: "100%",
|
|
18880
|
+
overflow: "hidden"
|
|
18881
|
+
},
|
|
18882
|
+
children: j.map((n) => /* @__PURE__ */ jsx(ElementRenderer, {
|
|
18883
|
+
element: n,
|
|
18884
|
+
itemData: _
|
|
18885
|
+
}, n.id))
|
|
18886
|
+
});
|
|
18887
|
+
};
|
|
18888
|
+
const generateHTML = (n, _, E = {}) => renderToStaticMarkup(/* @__PURE__ */ jsx(HtmlDocument, {
|
|
18889
|
+
elements: n,
|
|
18890
|
+
data: _,
|
|
18891
|
+
options: E
|
|
18892
|
+
})) + (E.isList ? getRuntimeScript(n, E) : "");
|
|
18893
|
+
var getRuntimeScript = (n, _) => `
|
|
18894
|
+
<script>
|
|
18895
|
+
(function() {
|
|
18896
|
+
try {
|
|
18897
|
+
const elements = ${JSON.stringify(n)};
|
|
18898
|
+
|
|
18899
|
+
// Helper functions definitions
|
|
18900
|
+
const camelToKebab = ${camelToKebab.toString()};
|
|
18901
|
+
const hex8ToRgba = ${hex8ToRgba.toString()};
|
|
18902
|
+
const styleObjectToString = ${styleObjectToString.toString()};
|
|
18903
|
+
const measureTextHeight = ${measureTextHeight.toString()};
|
|
18904
|
+
const checkCondition = ${checkCondition.toString()};
|
|
18905
|
+
const formatValue = ${formatValue.toString()};
|
|
18906
|
+
const computeLayout = ${computeLayout.toString()};
|
|
18907
|
+
const computeItemHeight = ${computeItemHeight.toString()};
|
|
18908
|
+
const renderItem = ${vanillaRenderItem.toString()};
|
|
18909
|
+
|
|
18910
|
+
const itemHeightFallback = ${_.canvasHeight || 0};
|
|
18911
|
+
const newestPosition = "${_.listSettings && _.listSettings.newestPosition || "bottom"}";
|
|
18912
|
+
const scrollDirection = "${_.listSettings && _.listSettings.scrollDirection || "down"}";
|
|
18913
|
+
|
|
18914
|
+
window.addItem = function(data) {
|
|
18915
|
+
const wrapper = document.querySelector('.list-wrapper');
|
|
18916
|
+
if (!wrapper) return;
|
|
18917
|
+
|
|
18918
|
+
const itemHtml = renderItem(elements, data, 0, 0);
|
|
18919
|
+
const itemHeight = computeItemHeight(elements, data, itemHeightFallback);
|
|
18920
|
+
const itemContainerStyle = styleObjectToString({
|
|
18921
|
+
position: 'relative',
|
|
18922
|
+
height: itemHeight,
|
|
18923
|
+
width: '100%'
|
|
18924
|
+
});
|
|
18925
|
+
|
|
18926
|
+
const div = document.createElement('div');
|
|
18927
|
+
div.className = 'list-item';
|
|
18928
|
+
div.setAttribute('style', itemContainerStyle);
|
|
18929
|
+
div.innerHTML = itemHtml;
|
|
18930
|
+
|
|
18931
|
+
if (newestPosition === 'top') {
|
|
18932
|
+
wrapper.insertBefore(div, wrapper.firstChild);
|
|
18933
|
+
} else {
|
|
18934
|
+
wrapper.appendChild(div);
|
|
18935
|
+
}
|
|
18936
|
+
|
|
18937
|
+
if (scrollDirection === 'up') {
|
|
18938
|
+
wrapper.scrollTop = wrapper.scrollHeight;
|
|
18939
|
+
}
|
|
18940
|
+
};
|
|
18941
|
+
} catch(e) { console.error("Smart List Init Error", e); }
|
|
18942
|
+
})();
|
|
18943
|
+
<\/script>
|
|
18944
|
+
`;
|
|
18550
18945
|
export { GenericEditor as EditorContent, generateHTML };
|