@1urso/generic-editor 0.1.41 → 0.1.42
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 +797 -785
- package/dist/generic-editor.umd.cjs +15 -15
- package/package.json +1 -1
package/dist/generic-editor.js
CHANGED
|
@@ -804,15 +804,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
804
804
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
805
805
|
branches: /* @__PURE__ */ new Set()
|
|
806
806
|
}), DismissableLayer = React$1.forwardRef((_, E) => {
|
|
807
|
-
let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)),
|
|
807
|
+
let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)), Aj = Array.from(B.layers), [jj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), Mj = Aj.indexOf(jj), Nj = H ? Aj.indexOf(H) : -1, Pj = B.layersWithOutsidePointerEventsDisabled.size > 0, Fj = Nj >= Mj, Ij = usePointerDownOutside((n) => {
|
|
808
808
|
let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
|
|
809
|
-
!
|
|
810
|
-
}, W),
|
|
809
|
+
!Fj || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
810
|
+
}, W), Lj = useFocusOutside((n) => {
|
|
811
811
|
let _ = n.target;
|
|
812
812
|
[...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
813
813
|
}, W);
|
|
814
814
|
return useEscapeKeydown((n) => {
|
|
815
|
-
|
|
815
|
+
Nj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
|
|
816
816
|
}, W), React$1.useEffect(() => {
|
|
817
817
|
if (H) return O && (B.layersWithOutsidePointerEventsDisabled.size === 0 && (originalBodyPointerEvents = W.body.style.pointerEvents, W.body.style.pointerEvents = "none"), B.layersWithOutsidePointerEventsDisabled.add(H)), B.layers.add(H), dispatchUpdate(), () => {
|
|
818
818
|
O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -831,12 +831,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
831
831
|
...z,
|
|
832
832
|
ref: Z,
|
|
833
833
|
style: {
|
|
834
|
-
pointerEvents:
|
|
834
|
+
pointerEvents: Pj ? Fj ? "auto" : "none" : void 0,
|
|
835
835
|
..._.style
|
|
836
836
|
},
|
|
837
|
-
onFocusCapture: composeEventHandlers(_.onFocusCapture,
|
|
838
|
-
onBlurCapture: composeEventHandlers(_.onBlurCapture,
|
|
839
|
-
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture,
|
|
837
|
+
onFocusCapture: composeEventHandlers(_.onFocusCapture, Lj.onFocusCapture),
|
|
838
|
+
onBlurCapture: composeEventHandlers(_.onBlurCapture, Lj.onBlurCapture),
|
|
839
|
+
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, Ij.onPointerDownCapture)
|
|
840
840
|
});
|
|
841
841
|
});
|
|
842
842
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -1195,7 +1195,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1195
1195
|
onScrollCapture: nothing,
|
|
1196
1196
|
onWheelCapture: nothing,
|
|
1197
1197
|
onTouchMoveCapture: nothing
|
|
1198
|
-
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation,
|
|
1198
|
+
}), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, Aj = _.inert, jj = _.allowPinchZoom, Mj = _.as, Nj = Mj === void 0 ? "div" : Mj, Pj = _.gapMode, Fj = __rest(_, [
|
|
1199
1199
|
"forwardProps",
|
|
1200
1200
|
"children",
|
|
1201
1201
|
"className",
|
|
@@ -1209,21 +1209,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1209
1209
|
"allowPinchZoom",
|
|
1210
1210
|
"as",
|
|
1211
1211
|
"gapMode"
|
|
1212
|
-
]),
|
|
1213
|
-
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(
|
|
1212
|
+
]), Ij = W, Lj = useMergeRefs([O, E]), Rj = __assign$2(__assign$2({}, Fj), j);
|
|
1213
|
+
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(Ij, {
|
|
1214
1214
|
sideCar: effectCar,
|
|
1215
1215
|
removeScrollBar: B,
|
|
1216
1216
|
shards: U,
|
|
1217
1217
|
noRelative: G,
|
|
1218
1218
|
noIsolation: Z,
|
|
1219
|
-
inert:
|
|
1219
|
+
inert: Aj,
|
|
1220
1220
|
setCallbacks: M,
|
|
1221
|
-
allowPinchZoom: !!
|
|
1221
|
+
allowPinchZoom: !!jj,
|
|
1222
1222
|
lockRef: O,
|
|
1223
|
-
gapMode:
|
|
1224
|
-
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({},
|
|
1223
|
+
gapMode: Pj
|
|
1224
|
+
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, Rj), { ref: Lj })) : React$1.createElement(Nj, __assign$2({}, Rj, {
|
|
1225
1225
|
className: z,
|
|
1226
|
-
ref:
|
|
1226
|
+
ref: Lj
|
|
1227
1227
|
}), P));
|
|
1228
1228
|
});
|
|
1229
1229
|
RemoveScroll.defaultProps = {
|
|
@@ -1413,8 +1413,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1413
1413
|
if (!N) break;
|
|
1414
1414
|
var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
|
|
1415
1415
|
(G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
|
|
1416
|
-
var
|
|
1417
|
-
N =
|
|
1416
|
+
var Aj = N.parentNode;
|
|
1417
|
+
N = Aj && Aj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Aj.host : Aj;
|
|
1418
1418
|
} while (!P && N !== document.body || P && (_.contains(N) || _ === N));
|
|
1419
1419
|
return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
|
|
1420
1420
|
}, getTouchXY = function(n) {
|
|
@@ -1961,7 +1961,7 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1961
1961
|
strategy: A
|
|
1962
1962
|
}), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
|
|
1963
1963
|
for (let E = 0; E < N.length; E++) {
|
|
1964
|
-
let { name: j, fn: Z } = N[E], { x:
|
|
1964
|
+
let { name: j, fn: Z } = N[E], { x: Aj, y: jj, data: Mj, reset: Nj } = await Z({
|
|
1965
1965
|
x: B,
|
|
1966
1966
|
y: H,
|
|
1967
1967
|
initialPlacement: O,
|
|
@@ -1975,17 +1975,17 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1975
1975
|
floating: _
|
|
1976
1976
|
}
|
|
1977
1977
|
});
|
|
1978
|
-
B =
|
|
1978
|
+
B = Aj ?? B, H = jj ?? H, W = {
|
|
1979
1979
|
...W,
|
|
1980
1980
|
[j]: {
|
|
1981
1981
|
...W[j],
|
|
1982
|
-
...
|
|
1982
|
+
...Mj
|
|
1983
1983
|
}
|
|
1984
|
-
},
|
|
1984
|
+
}, Nj && G <= 50 && (G++, typeof Nj == "object" && (Nj.placement && (U = Nj.placement), Nj.rects && (z = Nj.rects === !0 ? await M.getElementRects({
|
|
1985
1985
|
reference: n,
|
|
1986
1986
|
floating: _,
|
|
1987
1987
|
strategy: A
|
|
1988
|
-
}) :
|
|
1988
|
+
}) : Nj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
|
|
1989
1989
|
}
|
|
1990
1990
|
return {
|
|
1991
1991
|
x: B,
|
|
@@ -2002,25 +2002,25 @@ async function detectOverflow$1(n, _) {
|
|
|
2002
2002
|
boundary: P,
|
|
2003
2003
|
rootBoundary: z,
|
|
2004
2004
|
strategy: N
|
|
2005
|
-
})),
|
|
2005
|
+
})), Aj = B === "floating" ? {
|
|
2006
2006
|
x: E,
|
|
2007
2007
|
y: O,
|
|
2008
2008
|
width: j.floating.width,
|
|
2009
2009
|
height: j.floating.height
|
|
2010
|
-
} : j.reference,
|
|
2010
|
+
} : j.reference, jj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), Mj = await (A.isElement == null ? void 0 : A.isElement(jj)) && await (A.getScale == null ? void 0 : A.getScale(jj)) || {
|
|
2011
2011
|
x: 1,
|
|
2012
2012
|
y: 1
|
|
2013
|
-
},
|
|
2013
|
+
}, Nj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2014
2014
|
elements: M,
|
|
2015
|
-
rect:
|
|
2016
|
-
offsetParent:
|
|
2015
|
+
rect: Aj,
|
|
2016
|
+
offsetParent: jj,
|
|
2017
2017
|
strategy: N
|
|
2018
|
-
}) :
|
|
2018
|
+
}) : Aj);
|
|
2019
2019
|
return {
|
|
2020
|
-
top: (Z.top -
|
|
2021
|
-
bottom: (
|
|
2022
|
-
left: (Z.left -
|
|
2023
|
-
right: (
|
|
2020
|
+
top: (Z.top - Nj.top + W.top) / Mj.y,
|
|
2021
|
+
bottom: (Nj.bottom - Z.bottom + W.bottom) / Mj.y,
|
|
2022
|
+
left: (Z.left - Nj.left + W.left) / Mj.x,
|
|
2023
|
+
right: (Nj.right - Z.right + W.right) / Mj.x
|
|
2024
2024
|
};
|
|
2025
2025
|
}
|
|
2026
2026
|
var arrow$2 = (n) => ({
|
|
@@ -2032,17 +2032,17 @@ var arrow$2 = (n) => ({
|
|
|
2032
2032
|
let H = getPaddingObject(B), U = {
|
|
2033
2033
|
x: E,
|
|
2034
2034
|
y: O
|
|
2035
|
-
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z),
|
|
2036
|
-
(!
|
|
2037
|
-
let
|
|
2035
|
+
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Aj = W === "y", jj = Aj ? "top" : "left", Mj = Aj ? "bottom" : "right", Nj = Aj ? "clientHeight" : "clientWidth", Pj = j.reference[G] + j.reference[W] - U[W] - j.floating[G], Fj = U[W] - j.reference[W], Ij = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), Lj = Ij ? Ij[Nj] : 0;
|
|
2036
|
+
(!Lj || !await (M.isElement == null ? void 0 : M.isElement(Ij))) && (Lj = N.floating[Nj] || j.floating[G]);
|
|
2037
|
+
let Rj = Pj / 2 - Fj / 2, zj = Lj / 2 - Z[G] / 2 - 1, Bj = min(H[jj], zj), Vj = min(H[Mj], zj), Hj = Bj, Uj = Lj - Z[G] - Vj, Wj = Lj / 2 - Z[G] / 2 + Rj, Gj = clamp$3(Hj, Wj, Uj), Kj = !P.arrow && getAlignment(A) != null && Wj !== Gj && j.reference[G] / 2 - (Wj < Hj ? Bj : Vj) - Z[G] / 2 < 0, qj = Kj ? Wj < Hj ? Wj - Hj : Wj - Uj : 0;
|
|
2038
2038
|
return {
|
|
2039
|
-
[W]: U[W] +
|
|
2039
|
+
[W]: U[W] + qj,
|
|
2040
2040
|
data: {
|
|
2041
|
-
[W]:
|
|
2042
|
-
centerOffset:
|
|
2043
|
-
|
|
2041
|
+
[W]: Gj,
|
|
2042
|
+
centerOffset: Wj - Gj - qj,
|
|
2043
|
+
...Kj && { alignmentOffset: qj }
|
|
2044
2044
|
},
|
|
2045
|
-
reset:
|
|
2045
|
+
reset: Kj
|
|
2046
2046
|
};
|
|
2047
2047
|
}
|
|
2048
2048
|
}), flip$2 = function(n) {
|
|
@@ -2053,32 +2053,32 @@ var arrow$2 = (n) => ({
|
|
|
2053
2053
|
var E;
|
|
2054
2054
|
let { placement: O, middlewareData: A, rects: j, initialPlacement: M, platform: N, elements: P } = _, { mainAxis: z = !0, crossAxis: B = !0, fallbackPlacements: H, fallbackStrategy: U = "bestFit", fallbackAxisSideDirection: W = "none", flipAlignment: G = !0, ...Z } = evaluate(n, _);
|
|
2055
2055
|
if ((E = A.arrow) != null && E.alignmentOffset) return {};
|
|
2056
|
-
let
|
|
2057
|
-
!H &&
|
|
2058
|
-
let
|
|
2059
|
-
if (z &&
|
|
2060
|
-
let n = getAlignmentSides(O, j,
|
|
2061
|
-
|
|
2056
|
+
let Aj = getSide(O), jj = getSideAxis(M), Mj = getSide(M) === M, Nj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), Pj = H || (Mj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), Fj = W !== "none";
|
|
2057
|
+
!H && Fj && Pj.push(...getOppositeAxisPlacements(M, G, W, Nj));
|
|
2058
|
+
let Ij = [M, ...Pj], Lj = await detectOverflow$1(_, Z), Rj = [], zj = A.flip?.overflows || [];
|
|
2059
|
+
if (z && Rj.push(Lj[Aj]), B) {
|
|
2060
|
+
let n = getAlignmentSides(O, j, Nj);
|
|
2061
|
+
Rj.push(Lj[n[0]], Lj[n[1]]);
|
|
2062
2062
|
}
|
|
2063
|
-
if (
|
|
2063
|
+
if (zj = [...zj, {
|
|
2064
2064
|
placement: O,
|
|
2065
|
-
overflows:
|
|
2066
|
-
}], !
|
|
2067
|
-
let n = (A.flip?.index || 0) + 1, _ =
|
|
2068
|
-
if (_ && (!(B === "alignment" &&
|
|
2065
|
+
overflows: Rj
|
|
2066
|
+
}], !Rj.every((n) => n <= 0)) {
|
|
2067
|
+
let n = (A.flip?.index || 0) + 1, _ = Ij[n];
|
|
2068
|
+
if (_ && (!(B === "alignment" && jj !== getSideAxis(_)) || zj.every((n) => getSideAxis(n.placement) === jj ? n.overflows[0] > 0 : !0))) return {
|
|
2069
2069
|
data: {
|
|
2070
2070
|
index: n,
|
|
2071
|
-
overflows:
|
|
2071
|
+
overflows: zj
|
|
2072
2072
|
},
|
|
2073
2073
|
reset: { placement: _ }
|
|
2074
2074
|
};
|
|
2075
|
-
let E =
|
|
2075
|
+
let E = zj.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
|
|
2076
2076
|
if (!E) switch (U) {
|
|
2077
2077
|
case "bestFit": {
|
|
2078
|
-
let n =
|
|
2079
|
-
if (
|
|
2078
|
+
let n = zj.filter((n) => {
|
|
2079
|
+
if (Fj) {
|
|
2080
2080
|
let _ = getSideAxis(n.placement);
|
|
2081
|
-
return _ ===
|
|
2081
|
+
return _ === jj || _ === "y";
|
|
2082
2082
|
}
|
|
2083
2083
|
return !0;
|
|
2084
2084
|
}).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
|
|
@@ -2221,7 +2221,7 @@ var offset$2 = function(n) {
|
|
|
2221
2221
|
let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
|
|
2222
2222
|
x: E,
|
|
2223
2223
|
y: O
|
|
2224
|
-
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _),
|
|
2224
|
+
}, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), Aj = typeof Z == "number" ? {
|
|
2225
2225
|
mainAxis: Z,
|
|
2226
2226
|
crossAxis: 0
|
|
2227
2227
|
} : {
|
|
@@ -2230,11 +2230,11 @@ var offset$2 = function(n) {
|
|
|
2230
2230
|
...Z
|
|
2231
2231
|
};
|
|
2232
2232
|
if (P) {
|
|
2233
|
-
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] +
|
|
2233
|
+
let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + Aj.mainAxis, E = j.reference[U] + j.reference[n] - Aj.mainAxis;
|
|
2234
2234
|
W < _ ? W = _ : W > E && (W = E);
|
|
2235
2235
|
}
|
|
2236
2236
|
if (z) {
|
|
2237
|
-
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 :
|
|
2237
|
+
let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : Aj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Aj.crossAxis : 0);
|
|
2238
2238
|
G < E ? G = E : G > O && (G = O);
|
|
2239
2239
|
}
|
|
2240
2240
|
return {
|
|
@@ -2249,20 +2249,20 @@ var offset$2 = function(n) {
|
|
|
2249
2249
|
options: n,
|
|
2250
2250
|
async fn(_) {
|
|
2251
2251
|
var E, O;
|
|
2252
|
-
let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating,
|
|
2253
|
-
H === "top" || H === "bottom" ? (
|
|
2254
|
-
let
|
|
2255
|
-
if ((E = _.middlewareData.shift) != null && E.enabled.x && (
|
|
2252
|
+
let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating, Aj, jj;
|
|
2253
|
+
H === "top" || H === "bottom" ? (Aj = H, jj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (jj = H, Aj = U === "end" ? "top" : "bottom");
|
|
2254
|
+
let Mj = Z - B.top - B.bottom, Nj = G - B.left - B.right, Pj = min(Z - B[Aj], Mj), Fj = min(G - B[jj], Nj), Ij = !_.middlewareData.shift, Lj = Pj, Rj = Fj;
|
|
2255
|
+
if ((E = _.middlewareData.shift) != null && E.enabled.x && (Rj = Nj), (O = _.middlewareData.shift) != null && O.enabled.y && (Lj = Mj), Ij && !U) {
|
|
2256
2256
|
let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
|
|
2257
|
-
W ?
|
|
2257
|
+
W ? Rj = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : Lj = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
|
|
2258
2258
|
}
|
|
2259
2259
|
await P({
|
|
2260
2260
|
..._,
|
|
2261
|
-
availableWidth:
|
|
2262
|
-
availableHeight:
|
|
2261
|
+
availableWidth: Rj,
|
|
2262
|
+
availableHeight: Lj
|
|
2263
2263
|
});
|
|
2264
|
-
let
|
|
2265
|
-
return G !==
|
|
2264
|
+
let zj = await M.getDimensions(N.floating);
|
|
2265
|
+
return G !== zj.width || Z !== zj.height ? { reset: { rects: !0 } } : {};
|
|
2266
2266
|
}
|
|
2267
2267
|
};
|
|
2268
2268
|
};
|
|
@@ -2646,27 +2646,27 @@ function observeMove(n, _) {
|
|
|
2646
2646
|
N === void 0 && (N = !1), P === void 0 && (P = 1), j();
|
|
2647
2647
|
let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
|
|
2648
2648
|
if (N || _(), !U || !W) return;
|
|
2649
|
-
let G = floor(H), Z = floor(A.clientWidth - (B + U)),
|
|
2650
|
-
rootMargin: -G + "px " + -Z + "px " + -
|
|
2649
|
+
let G = floor(H), Z = floor(A.clientWidth - (B + U)), Aj = floor(A.clientHeight - (H + W)), jj = floor(B), Mj = {
|
|
2650
|
+
rootMargin: -G + "px " + -Z + "px " + -Aj + "px " + -jj + "px",
|
|
2651
2651
|
threshold: max(0, min(1, P)) || 1
|
|
2652
|
-
},
|
|
2653
|
-
function
|
|
2652
|
+
}, Nj = !0;
|
|
2653
|
+
function Pj(_) {
|
|
2654
2654
|
let E = _[0].intersectionRatio;
|
|
2655
2655
|
if (E !== P) {
|
|
2656
|
-
if (!
|
|
2656
|
+
if (!Nj) return M();
|
|
2657
2657
|
E ? M(!1, E) : O = setTimeout(() => {
|
|
2658
2658
|
M(!1, 1e-7);
|
|
2659
2659
|
}, 1e3);
|
|
2660
2660
|
}
|
|
2661
|
-
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(),
|
|
2661
|
+
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Nj = !1;
|
|
2662
2662
|
}
|
|
2663
2663
|
try {
|
|
2664
|
-
E = new IntersectionObserver(
|
|
2665
|
-
...
|
|
2664
|
+
E = new IntersectionObserver(Pj, {
|
|
2665
|
+
...Mj,
|
|
2666
2666
|
root: A.ownerDocument
|
|
2667
2667
|
});
|
|
2668
2668
|
} catch {
|
|
2669
|
-
E = new IntersectionObserver(
|
|
2669
|
+
E = new IntersectionObserver(Pj, Mj);
|
|
2670
2670
|
}
|
|
2671
2671
|
E.observe(n);
|
|
2672
2672
|
}
|
|
@@ -2687,10 +2687,10 @@ function autoUpdate(n, _, E, O) {
|
|
|
2687
2687
|
})), E();
|
|
2688
2688
|
}), z && !P && W.observe(z), W.observe(_));
|
|
2689
2689
|
let G, Z = P ? getBoundingClientRect(n) : null;
|
|
2690
|
-
P &&
|
|
2691
|
-
function
|
|
2690
|
+
P && Aj();
|
|
2691
|
+
function Aj() {
|
|
2692
2692
|
let _ = getBoundingClientRect(n);
|
|
2693
|
-
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(
|
|
2693
|
+
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Aj);
|
|
2694
2694
|
}
|
|
2695
2695
|
return E(), () => {
|
|
2696
2696
|
var n;
|
|
@@ -2757,23 +2757,23 @@ function useFloating(_) {
|
|
|
2757
2757
|
isPositioned: !1
|
|
2758
2758
|
}), [W, G] = React$1.useState(A);
|
|
2759
2759
|
deepEqual(W, A) || G(A);
|
|
2760
|
-
let [Z,
|
|
2761
|
-
n !==
|
|
2762
|
-
}, []),
|
|
2763
|
-
n !==
|
|
2764
|
-
}, []),
|
|
2765
|
-
if (!
|
|
2760
|
+
let [Z, Aj] = React$1.useState(null), [jj, Mj] = React$1.useState(null), Nj = React$1.useCallback((n) => {
|
|
2761
|
+
n !== Rj.current && (Rj.current = n, Aj(n));
|
|
2762
|
+
}, []), Pj = React$1.useCallback((n) => {
|
|
2763
|
+
n !== zj.current && (zj.current = n, Mj(n));
|
|
2764
|
+
}, []), Ij = M || Z, Lj = N || jj, Rj = React$1.useRef(null), zj = React$1.useRef(null), Bj = React$1.useRef(H), Vj = z != null, Hj = useLatestRef(z), Uj = useLatestRef(j), Wj = useLatestRef(B), Gj = React$1.useCallback(() => {
|
|
2765
|
+
if (!Rj.current || !zj.current) return;
|
|
2766
2766
|
let n = {
|
|
2767
2767
|
placement: E,
|
|
2768
2768
|
strategy: O,
|
|
2769
2769
|
middleware: W
|
|
2770
2770
|
};
|
|
2771
|
-
|
|
2771
|
+
Uj.current && (n.platform = Uj.current), computePosition(Rj.current, zj.current, n).then((n) => {
|
|
2772
2772
|
let _ = {
|
|
2773
2773
|
...n,
|
|
2774
|
-
isPositioned:
|
|
2774
|
+
isPositioned: Wj.current !== !1
|
|
2775
2775
|
};
|
|
2776
|
-
|
|
2776
|
+
Kj.current && !deepEqual(Bj.current, _) && (Bj.current = _, ReactDOM$1.flushSync(() => {
|
|
2777
2777
|
U(_);
|
|
2778
2778
|
}));
|
|
2779
2779
|
});
|
|
@@ -2781,50 +2781,50 @@ function useFloating(_) {
|
|
|
2781
2781
|
W,
|
|
2782
2782
|
E,
|
|
2783
2783
|
O,
|
|
2784
|
-
|
|
2785
|
-
|
|
2784
|
+
Uj,
|
|
2785
|
+
Wj
|
|
2786
2786
|
]);
|
|
2787
2787
|
index(() => {
|
|
2788
|
-
B === !1 &&
|
|
2788
|
+
B === !1 && Bj.current.isPositioned && (Bj.current.isPositioned = !1, U((n) => ({
|
|
2789
2789
|
...n,
|
|
2790
2790
|
isPositioned: !1
|
|
2791
2791
|
})));
|
|
2792
2792
|
}, [B]);
|
|
2793
|
-
let
|
|
2794
|
-
index(() => (
|
|
2795
|
-
|
|
2793
|
+
let Kj = React$1.useRef(!1);
|
|
2794
|
+
index(() => (Kj.current = !0, () => {
|
|
2795
|
+
Kj.current = !1;
|
|
2796
2796
|
}), []), index(() => {
|
|
2797
|
-
if (
|
|
2798
|
-
if (
|
|
2799
|
-
|
|
2797
|
+
if (Ij && (Rj.current = Ij), Lj && (zj.current = Lj), Ij && Lj) {
|
|
2798
|
+
if (Hj.current) return Hj.current(Ij, Lj, Gj);
|
|
2799
|
+
Gj();
|
|
2800
2800
|
}
|
|
2801
2801
|
}, [
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2802
|
+
Ij,
|
|
2803
|
+
Lj,
|
|
2804
|
+
Gj,
|
|
2805
|
+
Hj,
|
|
2806
|
+
Vj
|
|
2807
2807
|
]);
|
|
2808
|
-
let
|
|
2809
|
-
reference:
|
|
2810
|
-
floating:
|
|
2811
|
-
setReference:
|
|
2812
|
-
setFloating:
|
|
2813
|
-
}), [
|
|
2814
|
-
reference:
|
|
2815
|
-
floating:
|
|
2816
|
-
}), [
|
|
2808
|
+
let qj = React$1.useMemo(() => ({
|
|
2809
|
+
reference: Rj,
|
|
2810
|
+
floating: zj,
|
|
2811
|
+
setReference: Nj,
|
|
2812
|
+
setFloating: Pj
|
|
2813
|
+
}), [Nj, Pj]), Jj = React$1.useMemo(() => ({
|
|
2814
|
+
reference: Ij,
|
|
2815
|
+
floating: Lj
|
|
2816
|
+
}), [Ij, Lj]), Yj = React$1.useMemo(() => {
|
|
2817
2817
|
let n = {
|
|
2818
2818
|
position: O,
|
|
2819
2819
|
left: 0,
|
|
2820
2820
|
top: 0
|
|
2821
2821
|
};
|
|
2822
|
-
if (!
|
|
2823
|
-
let _ = roundByDPR(
|
|
2822
|
+
if (!Jj.floating) return n;
|
|
2823
|
+
let _ = roundByDPR(Jj.floating, H.x), E = roundByDPR(Jj.floating, H.y);
|
|
2824
2824
|
return P ? {
|
|
2825
2825
|
...n,
|
|
2826
2826
|
transform: "translate(" + _ + "px, " + E + "px)",
|
|
2827
|
-
...getDPR(
|
|
2827
|
+
...getDPR(Jj.floating) >= 1.5 && { willChange: "transform" }
|
|
2828
2828
|
} : {
|
|
2829
2829
|
position: O,
|
|
2830
2830
|
left: _,
|
|
@@ -2833,22 +2833,22 @@ function useFloating(_) {
|
|
|
2833
2833
|
}, [
|
|
2834
2834
|
O,
|
|
2835
2835
|
P,
|
|
2836
|
-
|
|
2836
|
+
Jj.floating,
|
|
2837
2837
|
H.x,
|
|
2838
2838
|
H.y
|
|
2839
2839
|
]);
|
|
2840
2840
|
return React$1.useMemo(() => ({
|
|
2841
2841
|
...H,
|
|
2842
|
-
update:
|
|
2843
|
-
refs:
|
|
2844
|
-
elements:
|
|
2845
|
-
floatingStyles:
|
|
2842
|
+
update: Gj,
|
|
2843
|
+
refs: qj,
|
|
2844
|
+
elements: Jj,
|
|
2845
|
+
floatingStyles: Yj
|
|
2846
2846
|
}), [
|
|
2847
2847
|
H,
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2848
|
+
Gj,
|
|
2849
|
+
qj,
|
|
2850
|
+
Jj,
|
|
2851
|
+
Yj
|
|
2852
2852
|
]);
|
|
2853
2853
|
}
|
|
2854
2854
|
var arrow$1$1 = (n) => {
|
|
@@ -2925,70 +2925,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
|
|
|
2925
2925
|
});
|
|
2926
2926
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
2927
2927
|
var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$6), PopperContent = React$1.forwardRef((_, E) => {
|
|
2928
|
-
let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...
|
|
2928
|
+
let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...Aj } = _, jj = usePopperContext(CONTENT_NAME$6, O), [Mj, Nj] = React$1.useState(null), Pj = useComposedRefs$1(E, (n) => Nj(n)), [Fj, Ij] = React$1.useState(null), Lj = useSize(Fj), Rj = Lj?.width ?? 0, Bj = Lj?.height ?? 0, Vj = A + (M === "center" ? "" : "-" + M), Hj = typeof H == "number" ? H : {
|
|
2929
2929
|
top: 0,
|
|
2930
2930
|
right: 0,
|
|
2931
2931
|
bottom: 0,
|
|
2932
2932
|
left: 0,
|
|
2933
2933
|
...H
|
|
2934
|
-
},
|
|
2935
|
-
padding:
|
|
2936
|
-
boundary:
|
|
2937
|
-
altBoundary:
|
|
2938
|
-
}, { refs:
|
|
2934
|
+
}, Uj = Array.isArray(B) ? B : [B], Wj = Uj.length > 0, Gj = {
|
|
2935
|
+
padding: Hj,
|
|
2936
|
+
boundary: Uj.filter(isNotNull$2),
|
|
2937
|
+
altBoundary: Wj
|
|
2938
|
+
}, { refs: Kj, floatingStyles: qj, placement: Jj, isPositioned: Yj, middlewareData: Xj } = useFloating({
|
|
2939
2939
|
strategy: "fixed",
|
|
2940
|
-
placement:
|
|
2940
|
+
placement: Vj,
|
|
2941
2941
|
whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
|
|
2942
|
-
elements: { reference:
|
|
2942
|
+
elements: { reference: jj.anchor },
|
|
2943
2943
|
middleware: [
|
|
2944
2944
|
offset({
|
|
2945
|
-
mainAxis: j +
|
|
2945
|
+
mainAxis: j + Bj,
|
|
2946
2946
|
alignmentAxis: N
|
|
2947
2947
|
}),
|
|
2948
2948
|
z && shift({
|
|
2949
2949
|
mainAxis: !0,
|
|
2950
2950
|
crossAxis: !1,
|
|
2951
2951
|
limiter: U === "partial" ? limitShift() : void 0,
|
|
2952
|
-
...
|
|
2952
|
+
...Gj
|
|
2953
2953
|
}),
|
|
2954
|
-
z && flip({ ...
|
|
2954
|
+
z && flip({ ...Gj }),
|
|
2955
2955
|
size({
|
|
2956
|
-
...
|
|
2956
|
+
...Gj,
|
|
2957
2957
|
apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
|
|
2958
2958
|
let { width: A, height: j } = _.reference, M = n.floating.style;
|
|
2959
2959
|
M.setProperty("--radix-popper-available-width", `${E}px`), M.setProperty("--radix-popper-available-height", `${O}px`), M.setProperty("--radix-popper-anchor-width", `${A}px`), M.setProperty("--radix-popper-anchor-height", `${j}px`);
|
|
2960
2960
|
}
|
|
2961
2961
|
}),
|
|
2962
|
-
|
|
2963
|
-
element:
|
|
2962
|
+
Fj && arrow({
|
|
2963
|
+
element: Fj,
|
|
2964
2964
|
padding: P
|
|
2965
2965
|
}),
|
|
2966
2966
|
transformOrigin({
|
|
2967
|
-
arrowWidth:
|
|
2968
|
-
arrowHeight:
|
|
2967
|
+
arrowWidth: Rj,
|
|
2968
|
+
arrowHeight: Bj
|
|
2969
2969
|
}),
|
|
2970
2970
|
W && hide({
|
|
2971
2971
|
strategy: "referenceHidden",
|
|
2972
|
-
...
|
|
2972
|
+
...Gj
|
|
2973
2973
|
})
|
|
2974
2974
|
]
|
|
2975
|
-
}), [
|
|
2975
|
+
}), [Zj, Qj] = getSideAndAlignFromPlacement(Jj), $j = useCallbackRef(Z);
|
|
2976
2976
|
useLayoutEffect2(() => {
|
|
2977
|
-
|
|
2978
|
-
}, [
|
|
2979
|
-
let
|
|
2977
|
+
Yj && $j?.();
|
|
2978
|
+
}, [Yj, $j]);
|
|
2979
|
+
let eM = Xj.arrow?.x, tM = Xj.arrow?.y, nM = Xj.arrow?.centerOffset !== 0, [rM, iM] = React$1.useState();
|
|
2980
2980
|
return useLayoutEffect2(() => {
|
|
2981
|
-
|
|
2982
|
-
}, [
|
|
2983
|
-
ref:
|
|
2981
|
+
Mj && iM(window.getComputedStyle(Mj).zIndex);
|
|
2982
|
+
}, [Mj]), /* @__PURE__ */ jsx("div", {
|
|
2983
|
+
ref: Kj.setFloating,
|
|
2984
2984
|
"data-radix-popper-content-wrapper": "",
|
|
2985
2985
|
style: {
|
|
2986
|
-
...
|
|
2987
|
-
transform:
|
|
2986
|
+
...qj,
|
|
2987
|
+
transform: Yj ? qj.transform : "translate(0, -200%)",
|
|
2988
2988
|
minWidth: "max-content",
|
|
2989
|
-
zIndex:
|
|
2990
|
-
"--radix-popper-transform-origin": [
|
|
2991
|
-
...
|
|
2989
|
+
zIndex: rM,
|
|
2990
|
+
"--radix-popper-transform-origin": [Xj.transformOrigin?.x, Xj.transformOrigin?.y].join(" "),
|
|
2991
|
+
...Xj.hide?.referenceHidden && {
|
|
2992
2992
|
visibility: "hidden",
|
|
2993
2993
|
pointerEvents: "none"
|
|
2994
2994
|
}
|
|
@@ -2996,19 +2996,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
2996
2996
|
dir: _.dir,
|
|
2997
2997
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
2998
2998
|
scope: O,
|
|
2999
|
-
placedSide:
|
|
3000
|
-
onArrowChange:
|
|
3001
|
-
arrowX:
|
|
3002
|
-
arrowY:
|
|
3003
|
-
shouldHideArrow:
|
|
2999
|
+
placedSide: Zj,
|
|
3000
|
+
onArrowChange: Ij,
|
|
3001
|
+
arrowX: eM,
|
|
3002
|
+
arrowY: tM,
|
|
3003
|
+
shouldHideArrow: nM,
|
|
3004
3004
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3005
|
-
"data-side":
|
|
3006
|
-
"data-align":
|
|
3007
|
-
...
|
|
3008
|
-
ref:
|
|
3005
|
+
"data-side": Zj,
|
|
3006
|
+
"data-align": Qj,
|
|
3007
|
+
...Aj,
|
|
3008
|
+
ref: Pj,
|
|
3009
3009
|
style: {
|
|
3010
|
-
...
|
|
3011
|
-
animation:
|
|
3010
|
+
...Aj.style,
|
|
3011
|
+
animation: Yj ? void 0 : "none"
|
|
3012
3012
|
}
|
|
3013
3013
|
})
|
|
3014
3014
|
})
|
|
@@ -3091,27 +3091,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
|
|
|
3091
3091
|
}));
|
|
3092
3092
|
RovingFocusGroup.displayName = GROUP_NAME$3;
|
|
3093
3093
|
var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
3094
|
-
let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [
|
|
3094
|
+
let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [Aj, jj] = useControllableState({
|
|
3095
3095
|
prop: N,
|
|
3096
3096
|
defaultProp: P ?? null,
|
|
3097
3097
|
onChange: z,
|
|
3098
3098
|
caller: GROUP_NAME$3
|
|
3099
|
-
}), [
|
|
3099
|
+
}), [Mj, Nj] = React$1.useState(!1), Pj = useCallbackRef(B), Fj = useCollection$1(O), Ij = React$1.useRef(!1), [Lj, Rj] = React$1.useState(0);
|
|
3100
3100
|
return React$1.useEffect(() => {
|
|
3101
3101
|
let n = W.current;
|
|
3102
|
-
if (n) return n.addEventListener(ENTRY_FOCUS,
|
|
3103
|
-
}, [
|
|
3102
|
+
if (n) return n.addEventListener(ENTRY_FOCUS, Pj), () => n.removeEventListener(ENTRY_FOCUS, Pj);
|
|
3103
|
+
}, [Pj]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
3104
3104
|
scope: O,
|
|
3105
3105
|
orientation: A,
|
|
3106
3106
|
dir: Z,
|
|
3107
3107
|
loop: j,
|
|
3108
|
-
currentTabStopId:
|
|
3109
|
-
onItemFocus: React$1.useCallback((n) =>
|
|
3110
|
-
onItemShiftTab: React$1.useCallback(() =>
|
|
3111
|
-
onFocusableItemAdd: React$1.useCallback(() =>
|
|
3112
|
-
onFocusableItemRemove: React$1.useCallback(() =>
|
|
3108
|
+
currentTabStopId: Aj,
|
|
3109
|
+
onItemFocus: React$1.useCallback((n) => jj(n), [jj]),
|
|
3110
|
+
onItemShiftTab: React$1.useCallback(() => Nj(!0), []),
|
|
3111
|
+
onFocusableItemAdd: React$1.useCallback(() => Rj((n) => n + 1), []),
|
|
3112
|
+
onFocusableItemRemove: React$1.useCallback(() => Rj((n) => n - 1), []),
|
|
3113
3113
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3114
|
-
tabIndex:
|
|
3114
|
+
tabIndex: Mj || Lj === 0 ? -1 : 0,
|
|
3115
3115
|
"data-orientation": A,
|
|
3116
3116
|
...U,
|
|
3117
3117
|
ref: G,
|
|
@@ -3120,28 +3120,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3120
3120
|
..._.style
|
|
3121
3121
|
},
|
|
3122
3122
|
onMouseDown: composeEventHandlers(_.onMouseDown, () => {
|
|
3123
|
-
|
|
3123
|
+
Ij.current = !0;
|
|
3124
3124
|
}),
|
|
3125
3125
|
onFocus: composeEventHandlers(_.onFocus, (n) => {
|
|
3126
|
-
let _ = !
|
|
3127
|
-
if (n.target === n.currentTarget && _ && !
|
|
3126
|
+
let _ = !Ij.current;
|
|
3127
|
+
if (n.target === n.currentTarget && _ && !Mj) {
|
|
3128
3128
|
let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
3129
3129
|
if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
|
|
3130
|
-
let n =
|
|
3130
|
+
let n = Fj().filter((n) => n.focusable);
|
|
3131
3131
|
focusFirst$1([
|
|
3132
3132
|
n.find((n) => n.active),
|
|
3133
|
-
n.find((n) => n.id ===
|
|
3133
|
+
n.find((n) => n.id === Aj),
|
|
3134
3134
|
...n
|
|
3135
3135
|
].filter(Boolean).map((n) => n.ref.current), H);
|
|
3136
3136
|
}
|
|
3137
3137
|
}
|
|
3138
|
-
|
|
3138
|
+
Ij.current = !1;
|
|
3139
3139
|
}),
|
|
3140
|
-
onBlur: composeEventHandlers(_.onBlur, () =>
|
|
3140
|
+
onBlur: composeEventHandlers(_.onBlur, () => Nj(!1))
|
|
3141
3141
|
})
|
|
3142
3142
|
});
|
|
3143
3143
|
}), ITEM_NAME$3 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((_, E) => {
|
|
3144
|
-
let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId:
|
|
3144
|
+
let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId: Aj } = H;
|
|
3145
3145
|
return React$1.useEffect(() => {
|
|
3146
3146
|
if (A) return G(), () => Z();
|
|
3147
3147
|
}, [
|
|
@@ -3184,7 +3184,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3184
3184
|
}),
|
|
3185
3185
|
children: typeof N == "function" ? N({
|
|
3186
3186
|
isCurrentTabStop: U,
|
|
3187
|
-
hasTabStop:
|
|
3187
|
+
hasTabStop: Aj != null
|
|
3188
3188
|
}) : N
|
|
3189
3189
|
})
|
|
3190
3190
|
});
|
|
@@ -3335,40 +3335,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3335
3335
|
onDismiss: () => E.onOpenChange(!1)
|
|
3336
3336
|
});
|
|
3337
3337
|
}), Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((_, E) => {
|
|
3338
|
-
let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...
|
|
3338
|
+
let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...Aj } = _, jj = useMenuContext(CONTENT_NAME$5, O), Mj = useMenuRootContext(CONTENT_NAME$5, O), Nj = usePopperScope$2(O), Pj = useRovingFocusGroupScope$1(O), Fj = useCollection(O), [Ij, Lj] = React$1.useState(null), Rj = React$1.useRef(null), Bj = useComposedRefs$1(E, Rj, jj.onContentChange), Vj = React$1.useRef(0), Hj = React$1.useRef(""), Uj = React$1.useRef(0), Wj = React$1.useRef(null), Gj = React$1.useRef("right"), Kj = React$1.useRef(0), qj = Z ? Combination_default : React$1.Fragment, Jj = Z ? {
|
|
3339
3339
|
as: Slot$1,
|
|
3340
3340
|
allowPinchZoom: !0
|
|
3341
|
-
} : void 0,
|
|
3342
|
-
let _ =
|
|
3341
|
+
} : void 0, Yj = (n) => {
|
|
3342
|
+
let _ = Hj.current + n, E = Fj().filter((n) => !n.disabled), O = document.activeElement, A = E.find((n) => n.ref.current === O)?.textValue, j = getNextMatch(E.map((n) => n.textValue), _, A), M = E.find((n) => n.textValue === j)?.ref.current;
|
|
3343
3343
|
(function n(_) {
|
|
3344
|
-
|
|
3344
|
+
Hj.current = _, window.clearTimeout(Vj.current), _ !== "" && (Vj.current = window.setTimeout(() => n(""), 1e3));
|
|
3345
3345
|
})(_), M && setTimeout(() => M.focus());
|
|
3346
3346
|
};
|
|
3347
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
3348
|
-
let
|
|
3347
|
+
React$1.useEffect(() => () => window.clearTimeout(Vj.current), []), useFocusGuards();
|
|
3348
|
+
let Xj = React$1.useCallback((n) => Gj.current === Wj.current?.side && isPointerInGraceArea(n, Wj.current?.area), []);
|
|
3349
3349
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
3350
3350
|
scope: O,
|
|
3351
|
-
searchRef:
|
|
3351
|
+
searchRef: Hj,
|
|
3352
3352
|
onItemEnter: React$1.useCallback((n) => {
|
|
3353
|
-
|
|
3354
|
-
}, [
|
|
3353
|
+
Xj(n) && n.preventDefault();
|
|
3354
|
+
}, [Xj]),
|
|
3355
3355
|
onItemLeave: React$1.useCallback((n) => {
|
|
3356
|
-
|
|
3357
|
-
}, [
|
|
3356
|
+
Xj(n) || (Rj.current?.focus(), Lj(null));
|
|
3357
|
+
}, [Xj]),
|
|
3358
3358
|
onTriggerLeave: React$1.useCallback((n) => {
|
|
3359
|
-
|
|
3360
|
-
}, [
|
|
3361
|
-
pointerGraceTimerRef:
|
|
3359
|
+
Xj(n) && n.preventDefault();
|
|
3360
|
+
}, [Xj]),
|
|
3361
|
+
pointerGraceTimerRef: Uj,
|
|
3362
3362
|
onPointerGraceIntentChange: React$1.useCallback((n) => {
|
|
3363
|
-
|
|
3363
|
+
Wj.current = n;
|
|
3364
3364
|
}, []),
|
|
3365
|
-
children: /* @__PURE__ */ jsx(
|
|
3366
|
-
...
|
|
3365
|
+
children: /* @__PURE__ */ jsx(qj, {
|
|
3366
|
+
...Jj,
|
|
3367
3367
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
3368
3368
|
asChild: !0,
|
|
3369
3369
|
trapped: j,
|
|
3370
3370
|
onMountAutoFocus: composeEventHandlers(M, (n) => {
|
|
3371
|
-
n.preventDefault(),
|
|
3371
|
+
n.preventDefault(), Rj.current?.focus({ preventScroll: !0 });
|
|
3372
3372
|
}),
|
|
3373
3373
|
onUnmountAutoFocus: N,
|
|
3374
3374
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3381,44 +3381,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3381
3381
|
onDismiss: G,
|
|
3382
3382
|
children: /* @__PURE__ */ jsx(Root$2, {
|
|
3383
3383
|
asChild: !0,
|
|
3384
|
-
...
|
|
3385
|
-
dir:
|
|
3384
|
+
...Pj,
|
|
3385
|
+
dir: Mj.dir,
|
|
3386
3386
|
orientation: "vertical",
|
|
3387
3387
|
loop: A,
|
|
3388
|
-
currentTabStopId:
|
|
3389
|
-
onCurrentTabStopIdChange:
|
|
3388
|
+
currentTabStopId: Ij,
|
|
3389
|
+
onCurrentTabStopIdChange: Lj,
|
|
3390
3390
|
onEntryFocus: composeEventHandlers(z, (n) => {
|
|
3391
|
-
|
|
3391
|
+
Mj.isUsingKeyboardRef.current || n.preventDefault();
|
|
3392
3392
|
}),
|
|
3393
3393
|
preventScrollOnEntryFocus: !0,
|
|
3394
3394
|
children: /* @__PURE__ */ jsx(Content$1, {
|
|
3395
3395
|
role: "menu",
|
|
3396
3396
|
"aria-orientation": "vertical",
|
|
3397
|
-
"data-state": getOpenState(
|
|
3397
|
+
"data-state": getOpenState(jj.open),
|
|
3398
3398
|
"data-radix-menu-content": "",
|
|
3399
|
-
dir:
|
|
3400
|
-
...
|
|
3401
|
-
...
|
|
3402
|
-
ref:
|
|
3399
|
+
dir: Mj.dir,
|
|
3400
|
+
...Nj,
|
|
3401
|
+
...Aj,
|
|
3402
|
+
ref: Bj,
|
|
3403
3403
|
style: {
|
|
3404
3404
|
outline: "none",
|
|
3405
|
-
...
|
|
3405
|
+
...Aj.style
|
|
3406
3406
|
},
|
|
3407
|
-
onKeyDown: composeEventHandlers(
|
|
3407
|
+
onKeyDown: composeEventHandlers(Aj.onKeyDown, (n) => {
|
|
3408
3408
|
let _ = n.target.closest("[data-radix-menu-content]") === n.currentTarget, E = n.ctrlKey || n.altKey || n.metaKey, O = n.key.length === 1;
|
|
3409
|
-
_ && (n.key === "Tab" && n.preventDefault(), !E && O &&
|
|
3410
|
-
let A =
|
|
3409
|
+
_ && (n.key === "Tab" && n.preventDefault(), !E && O && Yj(n.key));
|
|
3410
|
+
let A = Rj.current;
|
|
3411
3411
|
if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
|
|
3412
3412
|
n.preventDefault();
|
|
3413
|
-
let j =
|
|
3413
|
+
let j = Fj().filter((n) => !n.disabled).map((n) => n.ref.current);
|
|
3414
3414
|
LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
|
|
3415
3415
|
}),
|
|
3416
3416
|
onBlur: composeEventHandlers(_.onBlur, (n) => {
|
|
3417
|
-
n.currentTarget.contains(n.target) || (window.clearTimeout(
|
|
3417
|
+
n.currentTarget.contains(n.target) || (window.clearTimeout(Vj.current), Hj.current = "");
|
|
3418
3418
|
}),
|
|
3419
3419
|
onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
|
|
3420
|
-
let _ = n.target, E =
|
|
3421
|
-
n.currentTarget.contains(_) && E && (
|
|
3420
|
+
let _ = n.target, E = Kj.current !== n.clientX;
|
|
3421
|
+
n.currentTarget.contains(_) && E && (Gj.current = n.clientX > Kj.current ? "right" : "left", Kj.current = n.clientX);
|
|
3422
3422
|
}))
|
|
3423
3423
|
})
|
|
3424
3424
|
})
|
|
@@ -4366,11 +4366,11 @@ function useStateMachine(_, E) {
|
|
|
4366
4366
|
return React$1.useReducer((n, _) => E[n][_] ?? n, _);
|
|
4367
4367
|
}
|
|
4368
4368
|
var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((_, E) => {
|
|
4369
|
-
let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [
|
|
4369
|
+
let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [Aj, jj] = React$1.useState(null), [Mj, Nj] = React$1.useState(0), [Pj, Fj] = React$1.useState(0), [Ij, Lj] = React$1.useState(!1), [Rj, Bj] = React$1.useState(!1), Vj = useComposedRefs$1(E, (n) => z(n)), Hj = useDirection(j);
|
|
4370
4370
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
4371
4371
|
scope: O,
|
|
4372
4372
|
type: A,
|
|
4373
|
-
dir:
|
|
4373
|
+
dir: Hj,
|
|
4374
4374
|
scrollHideDelay: M,
|
|
4375
4375
|
scrollArea: P,
|
|
4376
4376
|
viewport: B,
|
|
@@ -4379,22 +4379,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
|
|
|
4379
4379
|
onContentChange: W,
|
|
4380
4380
|
scrollbarX: G,
|
|
4381
4381
|
onScrollbarXChange: Z,
|
|
4382
|
-
scrollbarXEnabled:
|
|
4383
|
-
onScrollbarXEnabledChange:
|
|
4384
|
-
scrollbarY:
|
|
4385
|
-
onScrollbarYChange:
|
|
4386
|
-
scrollbarYEnabled:
|
|
4387
|
-
onScrollbarYEnabledChange:
|
|
4388
|
-
onCornerWidthChange:
|
|
4389
|
-
onCornerHeightChange:
|
|
4382
|
+
scrollbarXEnabled: Ij,
|
|
4383
|
+
onScrollbarXEnabledChange: Lj,
|
|
4384
|
+
scrollbarY: Aj,
|
|
4385
|
+
onScrollbarYChange: jj,
|
|
4386
|
+
scrollbarYEnabled: Rj,
|
|
4387
|
+
onScrollbarYEnabledChange: Bj,
|
|
4388
|
+
onCornerWidthChange: Nj,
|
|
4389
|
+
onCornerHeightChange: Fj,
|
|
4390
4390
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4391
|
-
dir:
|
|
4391
|
+
dir: Hj,
|
|
4392
4392
|
...N,
|
|
4393
|
-
ref:
|
|
4393
|
+
ref: Vj,
|
|
4394
4394
|
style: {
|
|
4395
4395
|
position: "relative",
|
|
4396
|
-
"--radix-scroll-area-corner-width":
|
|
4397
|
-
"--radix-scroll-area-corner-height":
|
|
4396
|
+
"--radix-scroll-area-corner-width": Mj + "px",
|
|
4397
|
+
"--radix-scroll-area-corner-height": Pj + "px",
|
|
4398
4398
|
..._.style
|
|
4399
4399
|
}
|
|
4400
4400
|
})
|
|
@@ -4665,46 +4665,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
|
|
|
4665
4665
|
}
|
|
4666
4666
|
});
|
|
4667
4667
|
}), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((_, E) => {
|
|
4668
|
-
let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z,
|
|
4669
|
-
function
|
|
4670
|
-
|
|
4671
|
-
x: n.clientX -
|
|
4672
|
-
y: n.clientY -
|
|
4668
|
+
let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z, Aj] = React$1.useState(null), jj = useComposedRefs$1(E, (n) => Aj(n)), Mj = React$1.useRef(null), Nj = React$1.useRef(""), Pj = G.viewport, Fj = A.content - A.viewport, Ij = useCallbackRef(H), Lj = useCallbackRef(z), Rj = useDebounceCallback(U, 10);
|
|
4669
|
+
function Bj(n) {
|
|
4670
|
+
Mj.current && B({
|
|
4671
|
+
x: n.clientX - Mj.current.left,
|
|
4672
|
+
y: n.clientY - Mj.current.top
|
|
4673
4673
|
});
|
|
4674
4674
|
}
|
|
4675
4675
|
return React$1.useEffect(() => {
|
|
4676
4676
|
let n = (n) => {
|
|
4677
4677
|
let _ = n.target;
|
|
4678
|
-
Z?.contains(_) &&
|
|
4678
|
+
Z?.contains(_) && Ij(n, Fj);
|
|
4679
4679
|
};
|
|
4680
4680
|
return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
|
|
4681
4681
|
}, [
|
|
4682
|
-
|
|
4682
|
+
Pj,
|
|
4683
4683
|
Z,
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
]), React$1.useEffect(
|
|
4684
|
+
Fj,
|
|
4685
|
+
Ij
|
|
4686
|
+
]), React$1.useEffect(Lj, [A, Lj]), useResizeObserver(Z, Rj), useResizeObserver(G.content, Rj), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4687
4687
|
scope: O,
|
|
4688
4688
|
scrollbar: Z,
|
|
4689
4689
|
hasThumb: j,
|
|
4690
4690
|
onThumbChange: useCallbackRef(M),
|
|
4691
4691
|
onThumbPointerUp: useCallbackRef(N),
|
|
4692
|
-
onThumbPositionChange:
|
|
4692
|
+
onThumbPositionChange: Lj,
|
|
4693
4693
|
onThumbPointerDown: useCallbackRef(P),
|
|
4694
4694
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4695
4695
|
...W,
|
|
4696
|
-
ref:
|
|
4696
|
+
ref: jj,
|
|
4697
4697
|
style: {
|
|
4698
4698
|
position: "absolute",
|
|
4699
4699
|
...W.style
|
|
4700
4700
|
},
|
|
4701
4701
|
onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
|
|
4702
|
-
n.button === 0 && (n.target.setPointerCapture(n.pointerId),
|
|
4702
|
+
n.button === 0 && (n.target.setPointerCapture(n.pointerId), Mj.current = Z.getBoundingClientRect(), Nj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), Bj(n));
|
|
4703
4703
|
}),
|
|
4704
|
-
onPointerMove: composeEventHandlers(_.onPointerMove,
|
|
4704
|
+
onPointerMove: composeEventHandlers(_.onPointerMove, Bj),
|
|
4705
4705
|
onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
|
|
4706
4706
|
let _ = n.target;
|
|
4707
|
-
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect =
|
|
4707
|
+
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Nj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), Mj.current = null;
|
|
4708
4708
|
})
|
|
4709
4709
|
})
|
|
4710
4710
|
});
|
|
@@ -4846,7 +4846,7 @@ function useResizeObserver(n, _) {
|
|
|
4846
4846
|
}, [n, E]);
|
|
4847
4847
|
}
|
|
4848
4848
|
var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaScrollbar, Thumb$1 = ScrollAreaThumb, Corner = ScrollAreaCorner, SWITCH_NAME = "Switch", [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME), [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME), Switch = React$1.forwardRef((_, E) => {
|
|
4849
|
-
let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)),
|
|
4849
|
+
let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)), Aj = React$1.useRef(!1), jj = W ? H || !!W.closest("form") : !0, [Mj, Nj] = useControllableState({
|
|
4850
4850
|
prop: j,
|
|
4851
4851
|
defaultProp: M ?? !1,
|
|
4852
4852
|
onChange: B,
|
|
@@ -4854,28 +4854,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
|
|
|
4854
4854
|
});
|
|
4855
4855
|
return /* @__PURE__ */ jsxs(SwitchProvider, {
|
|
4856
4856
|
scope: O,
|
|
4857
|
-
checked:
|
|
4857
|
+
checked: Mj,
|
|
4858
4858
|
disabled: P,
|
|
4859
4859
|
children: [/* @__PURE__ */ jsx(Primitive.button, {
|
|
4860
4860
|
type: "button",
|
|
4861
4861
|
role: "switch",
|
|
4862
|
-
"aria-checked":
|
|
4862
|
+
"aria-checked": Mj,
|
|
4863
4863
|
"aria-required": N,
|
|
4864
|
-
"data-state": getState(
|
|
4864
|
+
"data-state": getState(Mj),
|
|
4865
4865
|
"data-disabled": P ? "" : void 0,
|
|
4866
4866
|
disabled: P,
|
|
4867
4867
|
value: z,
|
|
4868
4868
|
...U,
|
|
4869
4869
|
ref: Z,
|
|
4870
4870
|
onClick: composeEventHandlers(_.onClick, (n) => {
|
|
4871
|
-
|
|
4871
|
+
Nj((n) => !n), jj && (Aj.current = n.isPropagationStopped(), Aj.current || n.stopPropagation());
|
|
4872
4872
|
})
|
|
4873
|
-
}),
|
|
4873
|
+
}), jj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
|
|
4874
4874
|
control: W,
|
|
4875
|
-
bubbles: !
|
|
4875
|
+
bubbles: !Aj.current,
|
|
4876
4876
|
name: A,
|
|
4877
4877
|
value: z,
|
|
4878
|
-
checked:
|
|
4878
|
+
checked: Mj,
|
|
4879
4879
|
required: N,
|
|
4880
4880
|
disabled: P,
|
|
4881
4881
|
form: H,
|
|
@@ -5059,22 +5059,22 @@ var Root2 = Tabs, List = TabsList, Trigger = TabsTrigger, Content = TabsContent,
|
|
|
5059
5059
|
};
|
|
5060
5060
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
5061
5061
|
var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (_) => {
|
|
5062
|
-
let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent,
|
|
5062
|
+
let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent, Aj = P ?? z.delayDuration, jj = React$1.useRef(!1), [Mj, Nj] = useControllableState({
|
|
5063
5063
|
prop: A,
|
|
5064
5064
|
defaultProp: j ?? !1,
|
|
5065
5065
|
onChange: (n) => {
|
|
5066
5066
|
n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
|
|
5067
5067
|
},
|
|
5068
5068
|
caller: TOOLTIP_NAME
|
|
5069
|
-
}),
|
|
5070
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5071
|
-
}, [
|
|
5072
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
5073
|
-
}, [
|
|
5069
|
+
}), Pj = React$1.useMemo(() => Mj ? jj.current ? "delayed-open" : "instant-open" : "closed", [Mj]), Fj = React$1.useCallback(() => {
|
|
5070
|
+
window.clearTimeout(G.current), G.current = 0, jj.current = !1, Nj(!0);
|
|
5071
|
+
}, [Nj]), Ij = React$1.useCallback(() => {
|
|
5072
|
+
window.clearTimeout(G.current), G.current = 0, Nj(!1);
|
|
5073
|
+
}, [Nj]), Lj = React$1.useCallback(() => {
|
|
5074
5074
|
window.clearTimeout(G.current), G.current = window.setTimeout(() => {
|
|
5075
|
-
|
|
5076
|
-
},
|
|
5077
|
-
}, [
|
|
5075
|
+
jj.current = !0, Nj(!0), G.current = 0;
|
|
5076
|
+
}, Aj);
|
|
5077
|
+
}, [Aj, Nj]);
|
|
5078
5078
|
return React$1.useEffect(() => () => {
|
|
5079
5079
|
G.current &&= (window.clearTimeout(G.current), 0);
|
|
5080
5080
|
}, []), /* @__PURE__ */ jsx(Root2$4, {
|
|
@@ -5082,22 +5082,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
|
|
|
5082
5082
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
5083
5083
|
scope: E,
|
|
5084
5084
|
contentId: W,
|
|
5085
|
-
open:
|
|
5086
|
-
stateAttribute:
|
|
5085
|
+
open: Mj,
|
|
5086
|
+
stateAttribute: Pj,
|
|
5087
5087
|
trigger: H,
|
|
5088
5088
|
onTriggerChange: U,
|
|
5089
5089
|
onTriggerEnter: React$1.useCallback(() => {
|
|
5090
|
-
z.isOpenDelayedRef.current ?
|
|
5090
|
+
z.isOpenDelayedRef.current ? Lj() : Fj();
|
|
5091
5091
|
}, [
|
|
5092
5092
|
z.isOpenDelayedRef,
|
|
5093
|
-
|
|
5094
|
-
|
|
5093
|
+
Lj,
|
|
5094
|
+
Fj
|
|
5095
5095
|
]),
|
|
5096
5096
|
onTriggerLeave: React$1.useCallback(() => {
|
|
5097
|
-
Z ?
|
|
5098
|
-
}, [
|
|
5099
|
-
onOpen:
|
|
5100
|
-
onClose:
|
|
5097
|
+
Z ? Ij() : (window.clearTimeout(G.current), G.current = 0);
|
|
5098
|
+
}, [Ij, Z]),
|
|
5099
|
+
onOpen: Fj,
|
|
5100
|
+
onClose: Ij,
|
|
5101
5101
|
disableHoverableContent: Z,
|
|
5102
5102
|
children: O
|
|
5103
5103
|
})
|
|
@@ -5910,14 +5910,14 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5910
5910
|
React$1.useEffect(() => U(O), [O]);
|
|
5911
5911
|
let [W, G] = React$1.useState(A);
|
|
5912
5912
|
React$1.useEffect(() => G(A), [A]);
|
|
5913
|
-
let [Z,
|
|
5914
|
-
React$1.useEffect(() =>
|
|
5915
|
-
let [
|
|
5916
|
-
React$1.useEffect(() =>
|
|
5917
|
-
let [
|
|
5918
|
-
React$1.useEffect(() =>
|
|
5919
|
-
let [
|
|
5920
|
-
return React$1.useEffect(() =>
|
|
5913
|
+
let [Z, Aj] = React$1.useState(j);
|
|
5914
|
+
React$1.useEffect(() => Aj(j), [j]);
|
|
5915
|
+
let [jj, Mj] = React$1.useState(M);
|
|
5916
|
+
React$1.useEffect(() => Mj(M), [M]);
|
|
5917
|
+
let [Nj, Pj] = React$1.useState(N);
|
|
5918
|
+
React$1.useEffect(() => Pj(N), [N]);
|
|
5919
|
+
let [Fj, Ij] = React$1.useState(P);
|
|
5920
|
+
return React$1.useEffect(() => Ij(P), [P]), React$1.createElement(A$2, {
|
|
5921
5921
|
...B,
|
|
5922
5922
|
ref: E,
|
|
5923
5923
|
isRoot: !0,
|
|
@@ -5925,62 +5925,62 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5925
5925
|
appearance: H,
|
|
5926
5926
|
accentColor: W,
|
|
5927
5927
|
grayColor: Z,
|
|
5928
|
-
panelBackground:
|
|
5929
|
-
radius:
|
|
5930
|
-
scaling:
|
|
5928
|
+
panelBackground: jj,
|
|
5929
|
+
radius: Nj,
|
|
5930
|
+
scaling: Fj,
|
|
5931
5931
|
onAppearanceChange: U,
|
|
5932
5932
|
onAccentColorChange: G,
|
|
5933
|
-
onGrayColorChange:
|
|
5934
|
-
onPanelBackgroundChange:
|
|
5935
|
-
onRadiusChange:
|
|
5936
|
-
onScalingChange:
|
|
5933
|
+
onGrayColorChange: Aj,
|
|
5934
|
+
onPanelBackgroundChange: Mj,
|
|
5935
|
+
onRadiusChange: Pj,
|
|
5936
|
+
onScalingChange: Ij
|
|
5937
5937
|
});
|
|
5938
5938
|
});
|
|
5939
5939
|
I$3.displayName = "ThemeRoot";
|
|
5940
5940
|
var A$2 = React$1.forwardRef((_, E) => {
|
|
5941
|
-
let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange:
|
|
5941
|
+
let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange: Aj = d$5, onRadiusChange: jj = d$5, onScalingChange: Mj = d$5, ...Nj } = _, Pj = A ? Slot$3 : "div", Fj = z === "auto" ? a$12(P) : z, Ij = _.appearance === "light" || _.appearance === "dark", Lj = M === void 0 ? j || Ij : M;
|
|
5942
5942
|
return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
|
|
5943
5943
|
appearance: N,
|
|
5944
5944
|
accentColor: P,
|
|
5945
5945
|
grayColor: z,
|
|
5946
|
-
resolvedGrayColor:
|
|
5946
|
+
resolvedGrayColor: Fj,
|
|
5947
5947
|
panelBackground: B,
|
|
5948
5948
|
radius: H,
|
|
5949
5949
|
scaling: U,
|
|
5950
5950
|
onAppearanceChange: W,
|
|
5951
5951
|
onAccentColorChange: G,
|
|
5952
5952
|
onGrayColorChange: Z,
|
|
5953
|
-
onPanelBackgroundChange:
|
|
5954
|
-
onRadiusChange:
|
|
5955
|
-
onScalingChange:
|
|
5953
|
+
onPanelBackgroundChange: Aj,
|
|
5954
|
+
onRadiusChange: jj,
|
|
5955
|
+
onScalingChange: Mj
|
|
5956
5956
|
}), [
|
|
5957
5957
|
N,
|
|
5958
5958
|
P,
|
|
5959
5959
|
z,
|
|
5960
|
-
|
|
5960
|
+
Fj,
|
|
5961
5961
|
B,
|
|
5962
5962
|
H,
|
|
5963
5963
|
U,
|
|
5964
5964
|
W,
|
|
5965
5965
|
G,
|
|
5966
5966
|
Z,
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
]) }, React$1.createElement(
|
|
5967
|
+
Aj,
|
|
5968
|
+
jj,
|
|
5969
|
+
Mj
|
|
5970
|
+
]) }, React$1.createElement(Pj, {
|
|
5971
5971
|
"data-is-root-theme": j ? "true" : "false",
|
|
5972
5972
|
"data-accent-color": P,
|
|
5973
|
-
"data-gray-color":
|
|
5974
|
-
"data-has-background":
|
|
5973
|
+
"data-gray-color": Fj,
|
|
5974
|
+
"data-has-background": Lj ? "true" : "false",
|
|
5975
5975
|
"data-panel-background": B,
|
|
5976
5976
|
"data-radius": H,
|
|
5977
5977
|
"data-scaling": U,
|
|
5978
5978
|
ref: E,
|
|
5979
|
-
...
|
|
5979
|
+
...Nj,
|
|
5980
5980
|
className: (0, import_classnames$18.default)("radix-themes", {
|
|
5981
5981
|
light: N === "light",
|
|
5982
5982
|
dark: N === "dark"
|
|
5983
|
-
},
|
|
5983
|
+
}, Nj.className)
|
|
5984
5984
|
}));
|
|
5985
5985
|
});
|
|
5986
5986
|
A$2.displayName = "ThemeImpl";
|
|
@@ -6752,7 +6752,7 @@ function S$2(n) {
|
|
|
6752
6752
|
return [(0, import_classnames$10.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
|
|
6753
6753
|
}
|
|
6754
6754
|
var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((_, E) => {
|
|
6755
|
-
let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars:
|
|
6755
|
+
let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars: Aj = t$3.scrollbars.default, ...jj } = O;
|
|
6756
6756
|
return React$1.createElement(Root$1, {
|
|
6757
6757
|
type: H,
|
|
6758
6758
|
scrollHideDelay: U,
|
|
@@ -6763,10 +6763,10 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6763
6763
|
asChild: N,
|
|
6764
6764
|
children: P
|
|
6765
6765
|
}, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
6766
|
-
...
|
|
6766
|
+
...jj,
|
|
6767
6767
|
ref: E,
|
|
6768
6768
|
className: "rt-ScrollAreaViewport"
|
|
6769
|
-
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
6769
|
+
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Aj === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
6770
6770
|
"data-radius": Z,
|
|
6771
6771
|
orientation: "horizontal",
|
|
6772
6772
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6774,7 +6774,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6774
6774
|
value: G,
|
|
6775
6775
|
propValues: t$3.size.values
|
|
6776
6776
|
}))
|
|
6777
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6777
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Aj === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
6778
6778
|
"data-radius": Z,
|
|
6779
6779
|
orientation: "vertical",
|
|
6780
6780
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6782,7 +6782,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6782
6782
|
value: G,
|
|
6783
6783
|
propValues: t$3.size.values
|
|
6784
6784
|
}))
|
|
6785
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6785
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Aj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
6786
6786
|
});
|
|
6787
6787
|
c.displayName = "ScrollArea";
|
|
6788
6788
|
var n$2 = {
|
|
@@ -7985,17 +7985,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
7985
7985
|
E.forEach((n) => {
|
|
7986
7986
|
let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
|
|
7987
7987
|
U = j ? B === "horizontal" ? (_.clientX - j.x) / P * 100 : (_.clientY - j.y) / P * 100 : B === "horizontal" ? _.clientX < 0 ? -100 : 100 : _.clientY < 0 ? -100 : 100;
|
|
7988
|
-
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout:
|
|
7989
|
-
if (Z && W &&
|
|
7988
|
+
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Aj, separatorToPanels: jj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
|
|
7989
|
+
if (Z && W && Aj && jj) {
|
|
7990
7990
|
let _ = Z$1({
|
|
7991
7991
|
delta: U,
|
|
7992
7992
|
initialLayout: W,
|
|
7993
7993
|
panelConstraints: Z,
|
|
7994
7994
|
pivotIndices: n.panels.map((n) => H.indexOf(n)),
|
|
7995
|
-
prevLayout:
|
|
7995
|
+
prevLayout: Aj,
|
|
7996
7996
|
trigger: "mouse-or-touch"
|
|
7997
7997
|
});
|
|
7998
|
-
if (B$1(_,
|
|
7998
|
+
if (B$1(_, Aj)) {
|
|
7999
7999
|
if (U !== 0 && !z) switch (B) {
|
|
8000
8000
|
case "horizontal":
|
|
8001
8001
|
M |= U < 0 ? De : Oe$1;
|
|
@@ -8009,7 +8009,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
8009
8009
|
defaultLayoutDeferred: G,
|
|
8010
8010
|
derivedPanelConstraints: Z,
|
|
8011
8011
|
layout: _,
|
|
8012
|
-
separatorToPanels:
|
|
8012
|
+
separatorToPanels: jj
|
|
8013
8013
|
});
|
|
8014
8014
|
let E = n.group.panels.map(({ id: n }) => n).join(",");
|
|
8015
8015
|
n.group.inMemoryLayouts[E] = _;
|
|
@@ -8221,64 +8221,64 @@ function Pt(n, _) {
|
|
|
8221
8221
|
function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, disabled: A, elementRef: j, groupRef: M, id: N, onLayoutChange: P, orientation: z = "horizontal", style: B, ...H }) {
|
|
8222
8222
|
let U = useRef({}), G = le$1((n) => {
|
|
8223
8223
|
B$1(U.current, n) || (U.current = n, P?.(n));
|
|
8224
|
-
}), Z = ae$1(N),
|
|
8224
|
+
}), Z = ae$1(N), Aj = useRef(null), [jj, Fj] = useState(!1), [Ij, Lj] = useState(E ?? {}), [Rj, Bj] = wt(), Vj = useRef({
|
|
8225
8225
|
lastExpandedPanelSizes: {},
|
|
8226
8226
|
layouts: {},
|
|
8227
8227
|
panels: [],
|
|
8228
8228
|
separators: []
|
|
8229
|
-
}),
|
|
8229
|
+
}), Hj = ue$1(Aj, j);
|
|
8230
8230
|
Pt(Z, M);
|
|
8231
|
-
let
|
|
8231
|
+
let Uj = useMemo(() => ({
|
|
8232
8232
|
id: Z,
|
|
8233
8233
|
orientation: z,
|
|
8234
8234
|
registerPanel: (n) => {
|
|
8235
|
-
let _ =
|
|
8236
|
-
return _.panels = ie$1(z, [..._.panels, n]),
|
|
8237
|
-
_.panels = _.panels.filter((_) => _ !== n),
|
|
8235
|
+
let _ = Vj.current;
|
|
8236
|
+
return _.panels = ie$1(z, [..._.panels, n]), Bj(), () => {
|
|
8237
|
+
_.panels = _.panels.filter((_) => _ !== n), Bj();
|
|
8238
8238
|
};
|
|
8239
8239
|
},
|
|
8240
8240
|
registerSeparator: (n) => {
|
|
8241
|
-
let _ =
|
|
8242
|
-
return _.separators = ie$1(z, [..._.separators, n]),
|
|
8243
|
-
_.separators = _.separators.filter((_) => _ !== n),
|
|
8241
|
+
let _ = Vj.current;
|
|
8242
|
+
return _.separators = ie$1(z, [..._.separators, n]), Bj(), () => {
|
|
8243
|
+
_.separators = _.separators.filter((_) => _ !== n), Bj();
|
|
8244
8244
|
};
|
|
8245
8245
|
}
|
|
8246
8246
|
}), [
|
|
8247
8247
|
Z,
|
|
8248
|
-
|
|
8248
|
+
Bj,
|
|
8249
8249
|
z
|
|
8250
|
-
]),
|
|
8250
|
+
]), Wj = Lt({
|
|
8251
8251
|
defaultLayout: E,
|
|
8252
8252
|
disableCursor: O
|
|
8253
|
-
}),
|
|
8253
|
+
}), Gj = useRef(null);
|
|
8254
8254
|
A$1(() => {
|
|
8255
|
-
let n =
|
|
8255
|
+
let n = Aj.current;
|
|
8256
8256
|
if (n === null) return;
|
|
8257
|
-
let _ =
|
|
8258
|
-
defaultLayout:
|
|
8259
|
-
disableCursor: !!
|
|
8257
|
+
let _ = Vj.current, E = {
|
|
8258
|
+
defaultLayout: Wj.defaultLayout,
|
|
8259
|
+
disableCursor: !!Wj.disableCursor,
|
|
8260
8260
|
disabled: !!A,
|
|
8261
8261
|
element: n,
|
|
8262
8262
|
id: Z,
|
|
8263
|
-
inMemoryLastExpandedPanelSizes:
|
|
8264
|
-
inMemoryLayouts:
|
|
8263
|
+
inMemoryLastExpandedPanelSizes: Vj.current.lastExpandedPanelSizes,
|
|
8264
|
+
inMemoryLayouts: Vj.current.layouts,
|
|
8265
8265
|
orientation: z,
|
|
8266
8266
|
panels: _.panels,
|
|
8267
8267
|
separators: _.separators
|
|
8268
8268
|
};
|
|
8269
|
-
|
|
8269
|
+
Gj.current = E;
|
|
8270
8270
|
let O = bt(E), j = D$1().mountedGroups.get(E);
|
|
8271
8271
|
if (j) {
|
|
8272
8272
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
|
|
8273
|
-
!n && _.length > 0 && (
|
|
8273
|
+
!n && _.length > 0 && (Lj(E), G?.(E));
|
|
8274
8274
|
}
|
|
8275
8275
|
let M = T$1.addListener("interactionStateChange", (n) => {
|
|
8276
8276
|
switch (n.state) {
|
|
8277
8277
|
case "active":
|
|
8278
|
-
|
|
8278
|
+
Fj(n.hitRegions.some((n) => n.group === E));
|
|
8279
8279
|
break;
|
|
8280
8280
|
default:
|
|
8281
|
-
|
|
8281
|
+
Fj(!1);
|
|
8282
8282
|
break;
|
|
8283
8283
|
}
|
|
8284
8284
|
}), N = T$1.addListener("mountedGroupsChange", (n) => {
|
|
@@ -8286,30 +8286,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8286
8286
|
if (_) {
|
|
8287
8287
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
|
|
8288
8288
|
if (n || E.length === 0) return;
|
|
8289
|
-
|
|
8289
|
+
Lj(O), G?.(O);
|
|
8290
8290
|
}
|
|
8291
8291
|
});
|
|
8292
8292
|
return () => {
|
|
8293
|
-
|
|
8293
|
+
Gj.current = null, O(), M(), N();
|
|
8294
8294
|
};
|
|
8295
8295
|
}, [
|
|
8296
8296
|
A,
|
|
8297
8297
|
Z,
|
|
8298
8298
|
G,
|
|
8299
8299
|
z,
|
|
8300
|
-
|
|
8301
|
-
|
|
8300
|
+
Rj,
|
|
8301
|
+
Wj
|
|
8302
8302
|
]), useEffect(() => {
|
|
8303
|
-
let n =
|
|
8303
|
+
let n = Gj.current;
|
|
8304
8304
|
n && (n.defaultLayout = E, n.disableCursor = !!O);
|
|
8305
8305
|
});
|
|
8306
|
-
let
|
|
8307
|
-
for (let n in
|
|
8306
|
+
let Kj = { [Fe]: jj ? "none" : void 0 };
|
|
8307
|
+
for (let n in Ij) {
|
|
8308
8308
|
let _ = Ve(Z, n);
|
|
8309
|
-
|
|
8309
|
+
Kj[_] = Ij[n];
|
|
8310
8310
|
}
|
|
8311
8311
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
8312
|
-
value:
|
|
8312
|
+
value: Uj,
|
|
8313
8313
|
children: /* @__PURE__ */ jsx("div", {
|
|
8314
8314
|
...H,
|
|
8315
8315
|
"aria-orientation": z,
|
|
@@ -8317,13 +8317,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8317
8317
|
"data-group": !0,
|
|
8318
8318
|
"data-testid": Z,
|
|
8319
8319
|
id: Z,
|
|
8320
|
-
ref:
|
|
8320
|
+
ref: Hj,
|
|
8321
8321
|
style: {
|
|
8322
8322
|
height: "100%",
|
|
8323
8323
|
width: "100%",
|
|
8324
8324
|
overflow: "hidden",
|
|
8325
8325
|
...B,
|
|
8326
|
-
|
|
8326
|
+
...Kj,
|
|
8327
8327
|
display: "flex",
|
|
8328
8328
|
flexDirection: z === "horizontal" ? "row" : "column",
|
|
8329
8329
|
flexWrap: "nowrap"
|
|
@@ -8441,12 +8441,12 @@ function It(n, _) {
|
|
|
8441
8441
|
});
|
|
8442
8442
|
}
|
|
8443
8443
|
function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O = !1, defaultSize: A, elementRef: j, id: M, maxSize: N = "100%", minSize: P = "0%", onResize: z, panelRef: B, style: H, ...U }) {
|
|
8444
|
-
let W = !!M, G = ae$1(M), Z = useRef(null),
|
|
8444
|
+
let W = !!M, G = ae$1(M), Z = useRef(null), Aj = ue$1(Z, j), { id: jj, registerPanel: Mj } = ce$1(), Pj = z !== null, Fj = le$1((n, _, E) => {
|
|
8445
8445
|
z?.(n, M, E);
|
|
8446
8446
|
});
|
|
8447
8447
|
A$1(() => {
|
|
8448
8448
|
let n = Z.current;
|
|
8449
|
-
if (n !== null) return
|
|
8449
|
+
if (n !== null) return Mj({
|
|
8450
8450
|
element: n,
|
|
8451
8451
|
id: G,
|
|
8452
8452
|
idIsStable: W,
|
|
@@ -8454,7 +8454,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8454
8454
|
expandToSize: void 0,
|
|
8455
8455
|
prevSize: void 0
|
|
8456
8456
|
},
|
|
8457
|
-
onResize:
|
|
8457
|
+
onResize: Pj ? Fj : void 0,
|
|
8458
8458
|
panelConstraints: {
|
|
8459
8459
|
collapsedSize: E,
|
|
8460
8460
|
collapsible: O,
|
|
@@ -8467,25 +8467,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8467
8467
|
E,
|
|
8468
8468
|
O,
|
|
8469
8469
|
A,
|
|
8470
|
-
|
|
8470
|
+
Pj,
|
|
8471
8471
|
G,
|
|
8472
8472
|
W,
|
|
8473
8473
|
N,
|
|
8474
8474
|
P,
|
|
8475
|
-
|
|
8476
|
-
|
|
8475
|
+
Fj,
|
|
8476
|
+
Mj
|
|
8477
8477
|
]), It(G, B);
|
|
8478
|
-
let
|
|
8478
|
+
let Ij = Ve(jj, G);
|
|
8479
8479
|
return /* @__PURE__ */ jsx("div", {
|
|
8480
8480
|
...U,
|
|
8481
8481
|
"data-panel": !0,
|
|
8482
8482
|
"data-testid": G,
|
|
8483
8483
|
id: G,
|
|
8484
|
-
ref:
|
|
8484
|
+
ref: Aj,
|
|
8485
8485
|
style: {
|
|
8486
8486
|
...Gt,
|
|
8487
8487
|
flexBasis: 0,
|
|
8488
|
-
flexGrow: `var(${
|
|
8488
|
+
flexGrow: `var(${Ij}, 1)`,
|
|
8489
8489
|
flexShrink: 1,
|
|
8490
8490
|
overflow: "hidden",
|
|
8491
8491
|
pointerEvents: `var(${Fe})`
|
|
@@ -8548,7 +8548,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
|
|
|
8548
8548
|
};
|
|
8549
8549
|
}
|
|
8550
8550
|
function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j }) {
|
|
8551
|
-
let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(),
|
|
8551
|
+
let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(), Aj = G === "horizontal" ? "vertical" : "horizontal";
|
|
8552
8552
|
return A$1(() => {
|
|
8553
8553
|
let n = H.current;
|
|
8554
8554
|
if (n !== null) {
|
|
@@ -8584,7 +8584,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8584
8584
|
]), /* @__PURE__ */ jsx("div", {
|
|
8585
8585
|
...j,
|
|
8586
8586
|
"aria-controls": N.valueControls,
|
|
8587
|
-
"aria-orientation":
|
|
8587
|
+
"aria-orientation": Aj,
|
|
8588
8588
|
"aria-valuemax": N.valueMax,
|
|
8589
8589
|
"aria-valuemin": N.valueMin,
|
|
8590
8590
|
"aria-valuenow": N.valueNow,
|
|
@@ -8750,7 +8750,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8750
8750
|
}
|
|
8751
8751
|
return n;
|
|
8752
8752
|
});
|
|
8753
|
-
}, []),
|
|
8753
|
+
}, []), Aj = React.useCallback(() => {
|
|
8754
8754
|
M((n) => {
|
|
8755
8755
|
if (n.clipboard.length > 0) {
|
|
8756
8756
|
let _ = n.clipboard.map((n) => ({
|
|
@@ -8769,7 +8769,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8769
8769
|
}
|
|
8770
8770
|
return n;
|
|
8771
8771
|
});
|
|
8772
|
-
}, []),
|
|
8772
|
+
}, []), jj = React.useCallback((n) => {
|
|
8773
8773
|
let _ = {};
|
|
8774
8774
|
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
8775
|
let E = {
|
|
@@ -8794,7 +8794,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8794
8794
|
selectedElementIds: [E.id]
|
|
8795
8795
|
};
|
|
8796
8796
|
});
|
|
8797
|
-
}, []),
|
|
8797
|
+
}, []), Mj = React.useCallback((n) => {
|
|
8798
8798
|
M((_) => {
|
|
8799
8799
|
let E = _.elements.filter((_) => _.id !== n), O = _.history.slice(0, _.historyIndex + 1);
|
|
8800
8800
|
return O.push(E), {
|
|
@@ -8805,7 +8805,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8805
8805
|
historyIndex: O.length - 1
|
|
8806
8806
|
};
|
|
8807
8807
|
});
|
|
8808
|
-
}, []),
|
|
8808
|
+
}, []), Nj = React.useCallback(() => {
|
|
8809
8809
|
M((n) => {
|
|
8810
8810
|
if (n.selectedElementIds.length === 0) return n;
|
|
8811
8811
|
let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
|
|
@@ -8817,7 +8817,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8817
8817
|
historyIndex: E.length - 1
|
|
8818
8818
|
};
|
|
8819
8819
|
});
|
|
8820
|
-
}, []),
|
|
8820
|
+
}, []), Fj = React.useCallback((n, _ = !1) => {
|
|
8821
8821
|
M((E) => {
|
|
8822
8822
|
if (n === null) return {
|
|
8823
8823
|
...E,
|
|
@@ -8834,12 +8834,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8834
8834
|
selectedElementIds: [n]
|
|
8835
8835
|
};
|
|
8836
8836
|
});
|
|
8837
|
-
}, []),
|
|
8837
|
+
}, []), Ij = React.useCallback((n) => {
|
|
8838
8838
|
M((_) => ({
|
|
8839
8839
|
..._,
|
|
8840
8840
|
selectedElementIds: n
|
|
8841
8841
|
}));
|
|
8842
|
-
}, []),
|
|
8842
|
+
}, []), Lj = React.useCallback((n, _) => {
|
|
8843
8843
|
M((E) => {
|
|
8844
8844
|
let O = [...E.elements], A = O[n];
|
|
8845
8845
|
O.splice(n, 1), O.splice(_, 0, A);
|
|
@@ -8851,7 +8851,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8851
8851
|
historyIndex: j.length - 1
|
|
8852
8852
|
};
|
|
8853
8853
|
});
|
|
8854
|
-
}, []),
|
|
8854
|
+
}, []), Rj = React.useCallback((n, _, E = !0) => {
|
|
8855
8855
|
M((O) => {
|
|
8856
8856
|
let A = O.elements.map((E) => E.id === n ? {
|
|
8857
8857
|
...E,
|
|
@@ -8864,7 +8864,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8864
8864
|
historyIndex: M
|
|
8865
8865
|
};
|
|
8866
8866
|
});
|
|
8867
|
-
}, []),
|
|
8867
|
+
}, []), Bj = React.useCallback((n, _ = !0) => {
|
|
8868
8868
|
M((E) => {
|
|
8869
8869
|
let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
|
|
8870
8870
|
n.forEach(({ id: n, changes: _ }) => {
|
|
@@ -8918,7 +8918,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8918
8918
|
historyIndex: P
|
|
8919
8919
|
};
|
|
8920
8920
|
});
|
|
8921
|
-
}, []),
|
|
8921
|
+
}, []), Vj = React.useCallback((n) => {
|
|
8922
8922
|
M((_) => {
|
|
8923
8923
|
let E = _.elements.filter((_) => n.includes(_.id));
|
|
8924
8924
|
if (E.length === 0) return _;
|
|
@@ -8946,7 +8946,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8946
8946
|
historyIndex: z.length - 1
|
|
8947
8947
|
};
|
|
8948
8948
|
});
|
|
8949
|
-
}, []),
|
|
8949
|
+
}, []), Hj = React.useCallback((n) => {
|
|
8950
8950
|
M((_) => {
|
|
8951
8951
|
let E = _.elements.find((_) => _.id === n);
|
|
8952
8952
|
if (!E || E.type !== "group") return _;
|
|
@@ -8962,7 +8962,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8962
8962
|
historyIndex: j.length - 1
|
|
8963
8963
|
};
|
|
8964
8964
|
});
|
|
8965
|
-
}, []),
|
|
8965
|
+
}, []), Uj = React.useCallback((n, _) => {
|
|
8966
8966
|
M((E) => {
|
|
8967
8967
|
let O = E.elements.map((E) => E.id === n ? {
|
|
8968
8968
|
...E,
|
|
@@ -8973,7 +8973,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8973
8973
|
elements: O
|
|
8974
8974
|
};
|
|
8975
8975
|
});
|
|
8976
|
-
}, []),
|
|
8976
|
+
}, []), Wj = React.useCallback((n, _) => {
|
|
8977
8977
|
if (!n.find((n) => n.id === _ && n.type === "group")) return n;
|
|
8978
8978
|
let E = n.filter((n) => n.groupId === _);
|
|
8979
8979
|
if (E.length === 0) return n;
|
|
@@ -8985,7 +8985,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8985
8985
|
width: j - O,
|
|
8986
8986
|
height: M - A
|
|
8987
8987
|
} : n);
|
|
8988
|
-
}, []),
|
|
8988
|
+
}, []), Gj = React.useCallback((n, _) => {
|
|
8989
8989
|
M((E) => {
|
|
8990
8990
|
let O = E.elements.find((_) => _.id === n), A = E.elements.find((n) => n.id === _ && n.type === "group");
|
|
8991
8991
|
if (!O || !A) return E;
|
|
@@ -8993,7 +8993,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8993
8993
|
...E,
|
|
8994
8994
|
groupId: _
|
|
8995
8995
|
} : E);
|
|
8996
|
-
j =
|
|
8996
|
+
j = Wj(j, _);
|
|
8997
8997
|
let M = E.history.slice(0, E.historyIndex + 1);
|
|
8998
8998
|
return M.push(j), {
|
|
8999
8999
|
...E,
|
|
@@ -9002,7 +9002,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9002
9002
|
historyIndex: M.length - 1
|
|
9003
9003
|
};
|
|
9004
9004
|
});
|
|
9005
|
-
}, [
|
|
9005
|
+
}, [Wj]), Kj = React.useCallback((n) => {
|
|
9006
9006
|
M((_) => {
|
|
9007
9007
|
let E = _.elements.find((_) => _.id === n);
|
|
9008
9008
|
if (!E || !E.groupId) return _;
|
|
@@ -9010,7 +9010,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9010
9010
|
..._,
|
|
9011
9011
|
groupId: void 0
|
|
9012
9012
|
} : _);
|
|
9013
|
-
A =
|
|
9013
|
+
A = Wj(A, O);
|
|
9014
9014
|
let j = _.history.slice(0, _.historyIndex + 1);
|
|
9015
9015
|
return j.push(A), {
|
|
9016
9016
|
..._,
|
|
@@ -9019,7 +9019,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9019
9019
|
historyIndex: j.length - 1
|
|
9020
9020
|
};
|
|
9021
9021
|
});
|
|
9022
|
-
}, [
|
|
9022
|
+
}, [Wj]), qj = React.useCallback((n, _, E) => {
|
|
9023
9023
|
M((O) => {
|
|
9024
9024
|
let A = O.elements.find((_) => _.id === n && _.type === "group");
|
|
9025
9025
|
if (!A) return O;
|
|
@@ -9048,13 +9048,13 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9048
9048
|
historyIndex: B.length - 1
|
|
9049
9049
|
};
|
|
9050
9050
|
});
|
|
9051
|
-
}, []),
|
|
9051
|
+
}, []), Jj = React.useCallback((n, _) => {
|
|
9052
9052
|
M((E) => ({
|
|
9053
9053
|
...E,
|
|
9054
9054
|
mockData: n,
|
|
9055
9055
|
singleMockData: _
|
|
9056
9056
|
}));
|
|
9057
|
-
}, []),
|
|
9057
|
+
}, []), Yj = React.useCallback((n) => {
|
|
9058
9058
|
M((_) => ({
|
|
9059
9059
|
..._,
|
|
9060
9060
|
listSettings: {
|
|
@@ -9062,65 +9062,65 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
9062
9062
|
...n
|
|
9063
9063
|
}
|
|
9064
9064
|
}));
|
|
9065
|
-
}, []),
|
|
9065
|
+
}, []), Xj = React.useMemo(() => ({
|
|
9066
9066
|
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:
|
|
9067
|
+
addElement: jj,
|
|
9068
|
+
removeElement: Mj,
|
|
9069
|
+
removeSelected: Nj,
|
|
9070
|
+
selectElement: Fj,
|
|
9071
|
+
setSelectedElements: Ij,
|
|
9072
|
+
moveElement: Lj,
|
|
9073
|
+
updateElement: Rj,
|
|
9074
|
+
updateElements: Bj,
|
|
9075
|
+
groupElements: Vj,
|
|
9076
|
+
ungroupElements: Hj,
|
|
9077
|
+
renameElement: Uj,
|
|
9078
|
+
addToGroup: Gj,
|
|
9079
|
+
removeFromGroup: Kj,
|
|
9080
|
+
resizeGroup: qj,
|
|
9081
|
+
setMockData: Jj,
|
|
9082
|
+
updateListSettings: Yj,
|
|
9083
9083
|
setCanvasHeight: N,
|
|
9084
9084
|
loadState: U,
|
|
9085
9085
|
undo: W,
|
|
9086
9086
|
redo: G,
|
|
9087
9087
|
copy: Z,
|
|
9088
|
-
paste:
|
|
9088
|
+
paste: Aj,
|
|
9089
9089
|
setGridSize: P,
|
|
9090
9090
|
setZoom: z,
|
|
9091
9091
|
setPan: B,
|
|
9092
9092
|
setSnapLines: H
|
|
9093
9093
|
}), [
|
|
9094
9094
|
j,
|
|
9095
|
+
jj,
|
|
9096
|
+
Mj,
|
|
9097
|
+
Nj,
|
|
9098
|
+
Fj,
|
|
9099
|
+
Ij,
|
|
9100
|
+
Lj,
|
|
9095
9101
|
Rj,
|
|
9096
|
-
zj,
|
|
9097
9102
|
Bj,
|
|
9103
|
+
Vj,
|
|
9098
9104
|
Hj,
|
|
9099
9105
|
Uj,
|
|
9100
|
-
Wj,
|
|
9101
9106
|
Gj,
|
|
9107
|
+
Kj,
|
|
9102
9108
|
qj,
|
|
9103
9109
|
Jj,
|
|
9104
9110
|
Yj,
|
|
9105
|
-
Xj,
|
|
9106
|
-
Qj,
|
|
9107
|
-
$j,
|
|
9108
|
-
eM,
|
|
9109
|
-
tM,
|
|
9110
|
-
nM,
|
|
9111
9111
|
N,
|
|
9112
9112
|
U,
|
|
9113
9113
|
W,
|
|
9114
9114
|
G,
|
|
9115
9115
|
Z,
|
|
9116
|
-
|
|
9116
|
+
Aj,
|
|
9117
9117
|
P,
|
|
9118
9118
|
z,
|
|
9119
9119
|
B,
|
|
9120
9120
|
H
|
|
9121
9121
|
]);
|
|
9122
9122
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
9123
|
-
value:
|
|
9123
|
+
value: Xj,
|
|
9124
9124
|
children: n
|
|
9125
9125
|
});
|
|
9126
9126
|
}, useEditor = () => {
|
|
@@ -9562,16 +9562,16 @@ var __assign$1 = function() {
|
|
|
9562
9562
|
maxHeight: _
|
|
9563
9563
|
};
|
|
9564
9564
|
}, _.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 -
|
|
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, Aj = U || 0;
|
|
9566
|
+
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Aj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Aj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Aj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Aj)), {
|
|
9567
9567
|
newWidth: W,
|
|
9568
9568
|
newHeight: G
|
|
9569
9569
|
};
|
|
9570
9570
|
}, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
|
|
9571
9571
|
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
9572
|
if (j) {
|
|
9573
|
-
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W,
|
|
9574
|
-
n = clamp$1(n,
|
|
9573
|
+
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Aj = (P - W) / this.ratio + U, jj = (z - W) / this.ratio + U, Mj = Math.max(P, G), Nj = Math.min(z, Z), Pj = Math.max(B, Aj), Fj = Math.min(H, jj);
|
|
9574
|
+
n = clamp$1(n, Mj, Nj), _ = clamp$1(_, Pj, Fj);
|
|
9575
9575
|
} else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
|
|
9576
9576
|
return {
|
|
9577
9577
|
newWidth: n,
|
|
@@ -9628,56 +9628,56 @@ var __assign$1 = function() {
|
|
|
9628
9628
|
} catch {}
|
|
9629
9629
|
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
9630
|
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:
|
|
9631
|
+
var Aj = this.calculateNewSizeFromDirection(N, P), jj = Aj.newHeight, Mj = Aj.newWidth, Nj = this.calculateNewMaxFromBoundary(O, A);
|
|
9632
|
+
this.props.snap && this.props.snap.x && (Mj = findClosestSnap(Mj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (jj = findClosestSnap(jj, this.props.snap.y, this.props.snapGap));
|
|
9633
|
+
var Pj = this.calculateNewSizeFromAspectRatio(Mj, jj, {
|
|
9634
|
+
width: Nj.maxWidth,
|
|
9635
|
+
height: Nj.maxHeight
|
|
9636
9636
|
}, {
|
|
9637
9637
|
width: j,
|
|
9638
9638
|
height: M
|
|
9639
9639
|
});
|
|
9640
|
-
if (
|
|
9641
|
-
var
|
|
9642
|
-
|
|
9640
|
+
if (Mj = Pj.newWidth, jj = Pj.newHeight, this.props.grid) {
|
|
9641
|
+
var Fj = snap(Mj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), Ij = snap(jj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Rj = this.props.snapGap || 0, zj = Rj === 0 || Math.abs(Fj - Mj) <= Rj ? Fj : Mj, Bj = Rj === 0 || Math.abs(Ij - jj) <= Rj ? Ij : jj;
|
|
9642
|
+
Mj = zj, jj = Bj;
|
|
9643
9643
|
}
|
|
9644
|
-
var
|
|
9645
|
-
width:
|
|
9646
|
-
height:
|
|
9644
|
+
var Vj = {
|
|
9645
|
+
width: Mj - H.width,
|
|
9646
|
+
height: jj - H.height
|
|
9647
9647
|
};
|
|
9648
|
-
if (this.delta =
|
|
9648
|
+
if (this.delta = Vj, U && typeof U == "string") {
|
|
9649
9649
|
if (U.endsWith("%")) {
|
|
9650
|
-
var
|
|
9651
|
-
|
|
9650
|
+
var Hj = Mj / G.width * 100;
|
|
9651
|
+
Mj = `${Hj}%`;
|
|
9652
9652
|
} else if (U.endsWith("vw")) {
|
|
9653
|
-
var
|
|
9654
|
-
|
|
9653
|
+
var Uj = Mj / this.window.innerWidth * 100;
|
|
9654
|
+
Mj = `${Uj}vw`;
|
|
9655
9655
|
} else if (U.endsWith("vh")) {
|
|
9656
|
-
var
|
|
9657
|
-
|
|
9656
|
+
var Wj = Mj / this.window.innerHeight * 100;
|
|
9657
|
+
Mj = `${Wj}vh`;
|
|
9658
9658
|
}
|
|
9659
9659
|
}
|
|
9660
9660
|
if (W && typeof W == "string") {
|
|
9661
9661
|
if (W.endsWith("%")) {
|
|
9662
|
-
var
|
|
9663
|
-
|
|
9662
|
+
var Hj = jj / G.height * 100;
|
|
9663
|
+
jj = `${Hj}%`;
|
|
9664
9664
|
} else if (W.endsWith("vw")) {
|
|
9665
|
-
var
|
|
9666
|
-
|
|
9665
|
+
var Uj = jj / this.window.innerWidth * 100;
|
|
9666
|
+
jj = `${Uj}vw`;
|
|
9667
9667
|
} else if (W.endsWith("vh")) {
|
|
9668
|
-
var
|
|
9669
|
-
|
|
9668
|
+
var Wj = jj / this.window.innerHeight * 100;
|
|
9669
|
+
jj = `${Wj}vh`;
|
|
9670
9670
|
}
|
|
9671
9671
|
}
|
|
9672
|
-
var
|
|
9673
|
-
width: this.createSizeForCssProperty(
|
|
9674
|
-
height: this.createSizeForCssProperty(
|
|
9672
|
+
var Gj = {
|
|
9673
|
+
width: this.createSizeForCssProperty(Mj, "width"),
|
|
9674
|
+
height: this.createSizeForCssProperty(jj, "height")
|
|
9675
9675
|
};
|
|
9676
|
-
this.flexDir === "row" ?
|
|
9677
|
-
var
|
|
9678
|
-
|
|
9679
|
-
_.setState(
|
|
9680
|
-
}), this.props.onResize &&
|
|
9676
|
+
this.flexDir === "row" ? Gj.flexBasis = Gj.width : this.flexDir === "column" && (Gj.flexBasis = Gj.height);
|
|
9677
|
+
var Kj = this.state.width !== Gj.width, qj = this.state.height !== Gj.height, Jj = this.state.flexBasis !== Gj.flexBasis, Yj = Kj || qj || Jj;
|
|
9678
|
+
Yj && flushSync(function() {
|
|
9679
|
+
_.setState(Gj);
|
|
9680
|
+
}), this.props.onResize && Yj && this.props.onResize(n, B, this.resizable, Vj);
|
|
9681
9681
|
}
|
|
9682
9682
|
}, _.prototype.onMouseUp = function(n) {
|
|
9683
9683
|
var _ = this.state, E = _.isResizing, O = _.direction;
|
|
@@ -11186,32 +11186,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
11186
11186
|
});
|
|
11187
11187
|
};
|
|
11188
11188
|
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,
|
|
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, Aj] = useState(!1), [jj, Mj] = useState(!1), [Fj, Ij] = useState(!1), [Lj, Vj] = useState("formatting"), [Hj, Uj] = useState({
|
|
11190
11190
|
open: !1,
|
|
11191
11191
|
prop: "",
|
|
11192
11192
|
value: ""
|
|
11193
|
-
}), [
|
|
11194
|
-
let _ =
|
|
11193
|
+
}), [Wj, Gj] = useState(!1), [Kj, qj] = useState(""), [Jj, Yj] = useState(""), [Xj, Zj] = useState(_.content), [Qj, $j] = useState(_.dataBinding || ""), eM = useRef(null), tM = useRef(null), nM = (n) => {
|
|
11194
|
+
let _ = eM.current;
|
|
11195
11195
|
if (_) {
|
|
11196
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
11197
|
-
|
|
11196
|
+
let E = _.selectionStart, O = _.selectionEnd, A = Xj;
|
|
11197
|
+
Zj(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
11198
11198
|
_.focus();
|
|
11199
11199
|
let O = E + n.length + 4;
|
|
11200
11200
|
_.setSelectionRange(O, O);
|
|
11201
11201
|
}, 0);
|
|
11202
|
-
} else
|
|
11203
|
-
},
|
|
11202
|
+
} else Zj((_) => _ + `{{${n}}}`);
|
|
11203
|
+
}, rM = (n) => {
|
|
11204
11204
|
E(_.id, { style: {
|
|
11205
11205
|
..._.style,
|
|
11206
11206
|
...n
|
|
11207
11207
|
} });
|
|
11208
|
-
},
|
|
11208
|
+
}, iM = () => {
|
|
11209
11209
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11210
11210
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
11211
|
-
},
|
|
11211
|
+
}, aM = () => {
|
|
11212
11212
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11213
11213
|
n > 0 && M(n, 0);
|
|
11214
|
-
},
|
|
11214
|
+
}, oM = () => {
|
|
11215
11215
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
11216
11216
|
type: _.type,
|
|
11217
11217
|
content: _.content,
|
|
@@ -11221,7 +11221,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11221
11221
|
height: _.height,
|
|
11222
11222
|
style: _.style
|
|
11223
11223
|
});
|
|
11224
|
-
},
|
|
11224
|
+
}, sM = [
|
|
11225
11225
|
"#000000",
|
|
11226
11226
|
"#FFFFFF",
|
|
11227
11227
|
"#FF0000",
|
|
@@ -11231,12 +11231,36 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11231
11231
|
"#808080",
|
|
11232
11232
|
"#800080",
|
|
11233
11233
|
"transparent"
|
|
11234
|
-
],
|
|
11235
|
-
|
|
11234
|
+
], cM = (n, _) => {
|
|
11235
|
+
Uj({
|
|
11236
11236
|
open: !0,
|
|
11237
11237
|
prop: n,
|
|
11238
11238
|
value: _
|
|
11239
11239
|
});
|
|
11240
|
+
}, lM = () => {
|
|
11241
|
+
rM({ [Hj.prop]: Hj.value }), Uj((n) => ({
|
|
11242
|
+
...n,
|
|
11243
|
+
open: !1
|
|
11244
|
+
}));
|
|
11245
|
+
}, uM = (n) => {
|
|
11246
|
+
let O = n.target.files?.[0];
|
|
11247
|
+
if (O) {
|
|
11248
|
+
let n = new FileReader();
|
|
11249
|
+
n.onload = (n) => {
|
|
11250
|
+
n.target?.result && E(_.id, { content: n.target.result });
|
|
11251
|
+
}, n.readAsDataURL(O);
|
|
11252
|
+
}
|
|
11253
|
+
}, dM = () => {
|
|
11254
|
+
qj(typeof _.content == "string" ? _.content : ""), Gj(!0);
|
|
11255
|
+
}, fM = () => {
|
|
11256
|
+
E(_.id, { content: Kj }), Gj(!1);
|
|
11257
|
+
}, pM = () => {
|
|
11258
|
+
$j(_.dataBinding || ""), Mj(!0);
|
|
11259
|
+
}, mM = () => {
|
|
11260
|
+
let n = Qj, O = { dataBinding: n };
|
|
11261
|
+
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O), Mj(!1);
|
|
11262
|
+
}, hM = () => {
|
|
11263
|
+
Zj(_.content), Aj(!0);
|
|
11240
11264
|
};
|
|
11241
11265
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11242
11266
|
/* @__PURE__ */ jsx(s$4, {
|
|
@@ -11248,8 +11272,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11248
11272
|
direction: "column",
|
|
11249
11273
|
gap: "3",
|
|
11250
11274
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11251
|
-
value:
|
|
11252
|
-
onChange: (n) =>
|
|
11275
|
+
value: Jj,
|
|
11276
|
+
onChange: (n) => Yj(n.target.value),
|
|
11253
11277
|
placeholder: "Nome da camada..."
|
|
11254
11278
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11255
11279
|
gap: "3",
|
|
@@ -11260,7 +11284,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11260
11284
|
children: "Cancelar"
|
|
11261
11285
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11262
11286
|
onClick: () => {
|
|
11263
|
-
B(_.id,
|
|
11287
|
+
B(_.id, Jj), G(!1);
|
|
11264
11288
|
},
|
|
11265
11289
|
children: "Salvar"
|
|
11266
11290
|
})]
|
|
@@ -11270,7 +11294,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11270
11294
|
}),
|
|
11271
11295
|
/* @__PURE__ */ jsx(s$4, {
|
|
11272
11296
|
open: Z,
|
|
11273
|
-
onOpenChange:
|
|
11297
|
+
onOpenChange: Aj,
|
|
11274
11298
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11275
11299
|
style: { maxWidth: 450 },
|
|
11276
11300
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11278,9 +11302,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11278
11302
|
gap: "3",
|
|
11279
11303
|
children: [
|
|
11280
11304
|
/* @__PURE__ */ jsx(r, {
|
|
11281
|
-
ref:
|
|
11282
|
-
value:
|
|
11283
|
-
onChange: (n) =>
|
|
11305
|
+
ref: eM,
|
|
11306
|
+
value: Xj,
|
|
11307
|
+
onChange: (n) => Zj(n.target.value),
|
|
11284
11308
|
placeholder: "Digite o novo texto...",
|
|
11285
11309
|
style: { height: 100 }
|
|
11286
11310
|
}),
|
|
@@ -11298,7 +11322,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11298
11322
|
color: "blue",
|
|
11299
11323
|
variant: "surface",
|
|
11300
11324
|
style: { cursor: "pointer" },
|
|
11301
|
-
onClick: () =>
|
|
11325
|
+
onClick: () => nM(n.dataName),
|
|
11302
11326
|
children: n.name
|
|
11303
11327
|
}, n.dataName))
|
|
11304
11328
|
})]
|
|
@@ -11312,7 +11336,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11312
11336
|
children: "Cancelar"
|
|
11313
11337
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11314
11338
|
onClick: () => {
|
|
11315
|
-
E(_.id, { content:
|
|
11339
|
+
E(_.id, { content: Xj }), Aj(!1);
|
|
11316
11340
|
},
|
|
11317
11341
|
children: "Salvar"
|
|
11318
11342
|
})]
|
|
@@ -11322,8 +11346,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11322
11346
|
})
|
|
11323
11347
|
}),
|
|
11324
11348
|
/* @__PURE__ */ jsx(s$4, {
|
|
11325
|
-
open:
|
|
11326
|
-
onOpenChange:
|
|
11349
|
+
open: jj,
|
|
11350
|
+
onOpenChange: Mj,
|
|
11327
11351
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11328
11352
|
style: { maxWidth: 450 },
|
|
11329
11353
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11335,8 +11359,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11335
11359
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
11336
11360
|
}),
|
|
11337
11361
|
/* @__PURE__ */ jsx(u$1, {
|
|
11338
|
-
value:
|
|
11339
|
-
onChange: (n) =>
|
|
11362
|
+
value: Qj,
|
|
11363
|
+
onChange: (n) => $j(n.target.value),
|
|
11340
11364
|
placeholder: "propriedade"
|
|
11341
11365
|
}),
|
|
11342
11366
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11347,10 +11371,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11347
11371
|
color: "gray",
|
|
11348
11372
|
children: "Cancelar"
|
|
11349
11373
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11350
|
-
onClick:
|
|
11351
|
-
let n = aM, O = { dataBinding: n };
|
|
11352
|
-
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O), zj(!1);
|
|
11353
|
-
},
|
|
11374
|
+
onClick: mM,
|
|
11354
11375
|
children: "Vincular"
|
|
11355
11376
|
})]
|
|
11356
11377
|
})
|
|
@@ -11359,8 +11380,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11359
11380
|
})
|
|
11360
11381
|
}),
|
|
11361
11382
|
/* @__PURE__ */ jsx(s$4, {
|
|
11362
|
-
open:
|
|
11363
|
-
onOpenChange: (n) =>
|
|
11383
|
+
open: Hj.open,
|
|
11384
|
+
onOpenChange: (n) => Uj((_) => ({
|
|
11364
11385
|
..._,
|
|
11365
11386
|
open: n
|
|
11366
11387
|
})),
|
|
@@ -11369,8 +11390,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11369
11390
|
children: [
|
|
11370
11391
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
11371
11392
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
11372
|
-
color:
|
|
11373
|
-
onChange: (n) =>
|
|
11393
|
+
color: Hj.value,
|
|
11394
|
+
onChange: (n) => Uj((_) => ({
|
|
11374
11395
|
..._,
|
|
11375
11396
|
value: n
|
|
11376
11397
|
}))
|
|
@@ -11384,12 +11405,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11384
11405
|
color: "gray",
|
|
11385
11406
|
children: "Cancelar"
|
|
11386
11407
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11387
|
-
onClick:
|
|
11388
|
-
uM({ [Yj.prop]: Yj.value }), Xj((n) => ({
|
|
11389
|
-
...n,
|
|
11390
|
-
open: !1
|
|
11391
|
-
}));
|
|
11392
|
-
},
|
|
11408
|
+
onClick: lM,
|
|
11393
11409
|
children: "Aplicar"
|
|
11394
11410
|
})]
|
|
11395
11411
|
})
|
|
@@ -11398,21 +11414,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11398
11414
|
}),
|
|
11399
11415
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
11400
11416
|
elementId: _.id,
|
|
11401
|
-
open:
|
|
11402
|
-
onOpenChange:
|
|
11403
|
-
initialTab:
|
|
11417
|
+
open: Fj,
|
|
11418
|
+
onOpenChange: Ij,
|
|
11419
|
+
initialTab: Lj
|
|
11404
11420
|
}),
|
|
11405
11421
|
/* @__PURE__ */ jsx(s$4, {
|
|
11406
|
-
open:
|
|
11407
|
-
onOpenChange:
|
|
11422
|
+
open: Wj,
|
|
11423
|
+
onOpenChange: Gj,
|
|
11408
11424
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11409
11425
|
style: { maxWidth: 450 },
|
|
11410
11426
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Inserir URL da Imagem" }), /* @__PURE__ */ jsxs(p$1, {
|
|
11411
11427
|
direction: "column",
|
|
11412
11428
|
gap: "3",
|
|
11413
11429
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11414
|
-
value:
|
|
11415
|
-
onChange: (n) =>
|
|
11430
|
+
value: Kj,
|
|
11431
|
+
onChange: (n) => qj(n.target.value),
|
|
11416
11432
|
placeholder: "https://exemplo.com/imagem.png"
|
|
11417
11433
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11418
11434
|
gap: "3",
|
|
@@ -11422,9 +11438,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11422
11438
|
color: "gray",
|
|
11423
11439
|
children: "Cancelar"
|
|
11424
11440
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11425
|
-
onClick:
|
|
11426
|
-
E(_.id, { content: $j }), Qj(!1);
|
|
11427
|
-
},
|
|
11441
|
+
onClick: fM,
|
|
11428
11442
|
children: "Aplicar"
|
|
11429
11443
|
})]
|
|
11430
11444
|
})]
|
|
@@ -11433,23 +11447,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11433
11447
|
}),
|
|
11434
11448
|
/* @__PURE__ */ jsx("input", {
|
|
11435
11449
|
type: "file",
|
|
11436
|
-
ref:
|
|
11450
|
+
ref: tM,
|
|
11437
11451
|
style: { display: "none" },
|
|
11438
11452
|
accept: "image/*",
|
|
11439
|
-
onChange:
|
|
11440
|
-
let O = n.target.files?.[0];
|
|
11441
|
-
if (O) {
|
|
11442
|
-
let n = new FileReader();
|
|
11443
|
-
n.onload = (n) => {
|
|
11444
|
-
n.target?.result && E(_.id, { content: n.target.result });
|
|
11445
|
-
}, n.readAsDataURL(O);
|
|
11446
|
-
}
|
|
11447
|
-
}
|
|
11453
|
+
onChange: uM
|
|
11448
11454
|
}),
|
|
11449
11455
|
/* @__PURE__ */ jsxs(Root2$3, { children: [/* @__PURE__ */ jsx(Trigger$3, {
|
|
11450
11456
|
asChild: !0,
|
|
11451
11457
|
children: /* @__PURE__ */ jsx("div", {
|
|
11452
11458
|
style: { display: "contents" },
|
|
11459
|
+
onDoubleClick: (n) => {
|
|
11460
|
+
(_.type === "text" || _.type === "text-container") && (n.stopPropagation(), hM());
|
|
11461
|
+
},
|
|
11453
11462
|
children: n
|
|
11454
11463
|
})
|
|
11455
11464
|
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(Content2$2, {
|
|
@@ -11485,7 +11494,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11485
11494
|
className: "ContextMenuItem",
|
|
11486
11495
|
onSelect: () => {
|
|
11487
11496
|
let O = { dataBinding: n.dataName };
|
|
11488
|
-
_.type === "text" && (O.content = `{{${n.dataName}}}`), E(_.id, O);
|
|
11497
|
+
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n.dataName}}}`), E(_.id, O);
|
|
11489
11498
|
},
|
|
11490
11499
|
children: [
|
|
11491
11500
|
n.name,
|
|
@@ -11498,9 +11507,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11498
11507
|
}, n.dataName)), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11499
11508
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11500
11509
|
className: "ContextMenuItem",
|
|
11501
|
-
onSelect:
|
|
11502
|
-
oM(_.dataBinding || ""), zj(!0);
|
|
11503
|
-
},
|
|
11510
|
+
onSelect: pM,
|
|
11504
11511
|
children: "Outro / Manual..."
|
|
11505
11512
|
}),
|
|
11506
11513
|
_.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }), /* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11514,15 +11521,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11514
11521
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11515
11522
|
_.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11516
11523
|
className: "ContextMenuItem",
|
|
11517
|
-
onSelect:
|
|
11518
|
-
iM(_.content), Lj(!0);
|
|
11519
|
-
},
|
|
11524
|
+
onSelect: hM,
|
|
11520
11525
|
children: "Editar Texto..."
|
|
11521
11526
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11522
11527
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11523
11528
|
className: "ContextMenuItem",
|
|
11524
11529
|
onSelect: () => {
|
|
11525
|
-
|
|
11530
|
+
Yj(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11526
11531
|
},
|
|
11527
11532
|
children: "Renomear..."
|
|
11528
11533
|
}),
|
|
@@ -11539,13 +11544,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11539
11544
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11540
11545
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11541
11546
|
className: "ContextMenuItem",
|
|
11542
|
-
onSelect: () =>
|
|
11547
|
+
onSelect: () => Ij(!0),
|
|
11543
11548
|
children: "Configurações Avançadas..."
|
|
11544
11549
|
}),
|
|
11545
11550
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11546
11551
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11547
11552
|
className: "ContextMenuItem",
|
|
11548
|
-
onSelect:
|
|
11553
|
+
onSelect: oM,
|
|
11549
11554
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
11550
11555
|
}),
|
|
11551
11556
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11569,13 +11574,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11569
11574
|
alignOffset: -5,
|
|
11570
11575
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11571
11576
|
className: "ContextMenuItem",
|
|
11572
|
-
onSelect: () =>
|
|
11577
|
+
onSelect: () => tM.current?.click(),
|
|
11573
11578
|
children: "Carregar do Computador"
|
|
11574
11579
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11575
11580
|
className: "ContextMenuItem",
|
|
11576
|
-
onSelect:
|
|
11577
|
-
eM(typeof _.content == "string" ? _.content : ""), Qj(!0);
|
|
11578
|
-
},
|
|
11581
|
+
onSelect: dM,
|
|
11579
11582
|
children: "Inserir URL"
|
|
11580
11583
|
})]
|
|
11581
11584
|
}) })] }),
|
|
@@ -11592,17 +11595,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11592
11595
|
children: [
|
|
11593
11596
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11594
11597
|
className: "ContextMenuItem",
|
|
11595
|
-
onSelect: () =>
|
|
11598
|
+
onSelect: () => rM({ objectFit: "cover" }),
|
|
11596
11599
|
children: "Preencher (Cover)"
|
|
11597
11600
|
}),
|
|
11598
11601
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11599
11602
|
className: "ContextMenuItem",
|
|
11600
|
-
onSelect: () =>
|
|
11603
|
+
onSelect: () => rM({ objectFit: "contain" }),
|
|
11601
11604
|
children: "Ajustar (Contain)"
|
|
11602
11605
|
}),
|
|
11603
11606
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11604
11607
|
className: "ContextMenuItem",
|
|
11605
|
-
onSelect: () =>
|
|
11608
|
+
onSelect: () => rM({ objectFit: "fill" }),
|
|
11606
11609
|
children: "Esticar (Fill)"
|
|
11607
11610
|
})
|
|
11608
11611
|
]
|
|
@@ -11621,11 +11624,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11621
11624
|
alignOffset: -5,
|
|
11622
11625
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11623
11626
|
className: "ContextMenuItem",
|
|
11624
|
-
onSelect:
|
|
11627
|
+
onSelect: iM,
|
|
11625
11628
|
children: "Trazer para frente"
|
|
11626
11629
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11627
11630
|
className: "ContextMenuItem",
|
|
11628
|
-
onSelect:
|
|
11631
|
+
onSelect: aM,
|
|
11629
11632
|
children: "Enviar para trás"
|
|
11630
11633
|
})]
|
|
11631
11634
|
}) })] }),
|
|
@@ -11643,7 +11646,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11643
11646
|
alignOffset: -5,
|
|
11644
11647
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11645
11648
|
className: "ContextMenuItem",
|
|
11646
|
-
onSelect: () =>
|
|
11649
|
+
onSelect: () => rM({ fontFamily: n }),
|
|
11647
11650
|
style: { fontFamily: n },
|
|
11648
11651
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
11649
11652
|
className: "RightSlot",
|
|
@@ -11672,7 +11675,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11672
11675
|
64
|
|
11673
11676
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11674
11677
|
className: "ContextMenuItem",
|
|
11675
|
-
onSelect: () =>
|
|
11678
|
+
onSelect: () => rM({ fontSize: `${n}px` }),
|
|
11676
11679
|
children: [n, "px"]
|
|
11677
11680
|
}, n))
|
|
11678
11681
|
}) })] }),
|
|
@@ -11687,9 +11690,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11687
11690
|
sideOffset: 2,
|
|
11688
11691
|
alignOffset: -5,
|
|
11689
11692
|
children: [
|
|
11690
|
-
|
|
11693
|
+
sM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11691
11694
|
className: "ContextMenuItem",
|
|
11692
|
-
onSelect: () =>
|
|
11695
|
+
onSelect: () => rM({ color: n }),
|
|
11693
11696
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11694
11697
|
width: 12,
|
|
11695
11698
|
height: 12,
|
|
@@ -11701,7 +11704,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11701
11704
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11702
11705
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11703
11706
|
className: "ContextMenuItem",
|
|
11704
|
-
onSelect: () =>
|
|
11707
|
+
onSelect: () => cM("color", _.style?.color || "#000000"),
|
|
11705
11708
|
children: "Outra Cor..."
|
|
11706
11709
|
})
|
|
11707
11710
|
]
|
|
@@ -11718,11 +11721,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11718
11721
|
alignOffset: -5,
|
|
11719
11722
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11720
11723
|
className: "ContextMenuItem",
|
|
11721
|
-
onSelect: () =>
|
|
11724
|
+
onSelect: () => rM({ fontWeight: "normal" }),
|
|
11722
11725
|
children: "Normal"
|
|
11723
11726
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11724
11727
|
className: "ContextMenuItem",
|
|
11725
|
-
onSelect: () =>
|
|
11728
|
+
onSelect: () => rM({ fontWeight: "bold" }),
|
|
11726
11729
|
children: "Negrito"
|
|
11727
11730
|
})]
|
|
11728
11731
|
}) })] }),
|
|
@@ -11739,17 +11742,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11739
11742
|
children: [
|
|
11740
11743
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11741
11744
|
className: "ContextMenuItem",
|
|
11742
|
-
onSelect: () =>
|
|
11745
|
+
onSelect: () => rM({ textAlign: "left" }),
|
|
11743
11746
|
children: "Esquerda"
|
|
11744
11747
|
}),
|
|
11745
11748
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11746
11749
|
className: "ContextMenuItem",
|
|
11747
|
-
onSelect: () =>
|
|
11750
|
+
onSelect: () => rM({ textAlign: "center" }),
|
|
11748
11751
|
children: "Centro"
|
|
11749
11752
|
}),
|
|
11750
11753
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11751
11754
|
className: "ContextMenuItem",
|
|
11752
|
-
onSelect: () =>
|
|
11755
|
+
onSelect: () => rM({ textAlign: "right" }),
|
|
11753
11756
|
children: "Direita"
|
|
11754
11757
|
})
|
|
11755
11758
|
]
|
|
@@ -11767,7 +11770,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11767
11770
|
children: [
|
|
11768
11771
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11769
11772
|
className: "ContextMenuItem",
|
|
11770
|
-
onSelect: () =>
|
|
11773
|
+
onSelect: () => rM({
|
|
11771
11774
|
display: "flex",
|
|
11772
11775
|
flexDirection: "column",
|
|
11773
11776
|
justifyContent: "flex-start"
|
|
@@ -11776,7 +11779,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11776
11779
|
}),
|
|
11777
11780
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11778
11781
|
className: "ContextMenuItem",
|
|
11779
|
-
onSelect: () =>
|
|
11782
|
+
onSelect: () => rM({
|
|
11780
11783
|
display: "flex",
|
|
11781
11784
|
flexDirection: "column",
|
|
11782
11785
|
justifyContent: "center"
|
|
@@ -11785,7 +11788,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11785
11788
|
}),
|
|
11786
11789
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11787
11790
|
className: "ContextMenuItem",
|
|
11788
|
-
onSelect: () =>
|
|
11791
|
+
onSelect: () => rM({
|
|
11789
11792
|
display: "flex",
|
|
11790
11793
|
flexDirection: "column",
|
|
11791
11794
|
justifyContent: "flex-end"
|
|
@@ -11806,9 +11809,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11806
11809
|
sideOffset: 2,
|
|
11807
11810
|
alignOffset: -5,
|
|
11808
11811
|
children: [
|
|
11809
|
-
|
|
11812
|
+
sM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11810
11813
|
className: "ContextMenuItem",
|
|
11811
|
-
onSelect: () =>
|
|
11814
|
+
onSelect: () => rM({ backgroundColor: n }),
|
|
11812
11815
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11813
11816
|
width: 12,
|
|
11814
11817
|
height: 12,
|
|
@@ -11820,7 +11823,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11820
11823
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11821
11824
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11822
11825
|
className: "ContextMenuItem",
|
|
11823
|
-
onSelect: () =>
|
|
11826
|
+
onSelect: () => cM("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
11824
11827
|
children: "Outra Cor..."
|
|
11825
11828
|
})
|
|
11826
11829
|
]
|
|
@@ -11846,14 +11849,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11846
11849
|
"50%"
|
|
11847
11850
|
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
11848
11851
|
className: "ContextMenuItem",
|
|
11849
|
-
onSelect: () =>
|
|
11852
|
+
onSelect: () => rM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
11850
11853
|
children: n === "50%" ? "Círculo" : `${n}px`
|
|
11851
11854
|
}, n)),
|
|
11852
11855
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11853
11856
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11854
11857
|
className: "ContextMenuItem",
|
|
11855
11858
|
onSelect: () => {
|
|
11856
|
-
|
|
11859
|
+
Vj("style"), Ij(!0);
|
|
11857
11860
|
},
|
|
11858
11861
|
children: "Personalizar..."
|
|
11859
11862
|
})
|
|
@@ -11880,14 +11883,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11880
11883
|
32
|
|
11881
11884
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11882
11885
|
className: "ContextMenuItem",
|
|
11883
|
-
onSelect: () =>
|
|
11886
|
+
onSelect: () => rM({ padding: `${n}px` }),
|
|
11884
11887
|
children: [n, "px"]
|
|
11885
11888
|
}, n)),
|
|
11886
11889
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11887
11890
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11888
11891
|
className: "ContextMenuItem",
|
|
11889
11892
|
onSelect: () => {
|
|
11890
|
-
|
|
11893
|
+
Vj("style"), Ij(!0);
|
|
11891
11894
|
},
|
|
11892
11895
|
children: "Personalizar..."
|
|
11893
11896
|
})
|
|
@@ -11897,55 +11900,55 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11897
11900
|
}) })] })
|
|
11898
11901
|
] });
|
|
11899
11902
|
}, 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),
|
|
11903
|
+
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), Aj = useRef({
|
|
11901
11904
|
x: 0,
|
|
11902
11905
|
y: 0
|
|
11903
|
-
}),
|
|
11906
|
+
}), jj = useRef({}), Mj = useRef(!1), Fj = useRef(!1), Ij = useRef(0), Lj = useRef(0), Rj = useRef({
|
|
11904
11907
|
x: 0,
|
|
11905
11908
|
y: 0
|
|
11906
|
-
}),
|
|
11907
|
-
if (
|
|
11908
|
-
if (n.type === "text")
|
|
11909
|
-
let O =
|
|
11909
|
+
}), Vj = useRef(!1), Hj = j.canvasHeight || 150, Uj = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, Wj = n.content, Gj = {};
|
|
11910
|
+
if (Uj) {
|
|
11911
|
+
if (n.type === "text" || n.type === "text-container") Wj = Wj.replace(/\{\{(.*?)\}\}/g, (_, E) => {
|
|
11912
|
+
let O = Uj[E.trim()];
|
|
11910
11913
|
return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
|
|
11911
11914
|
});
|
|
11912
11915
|
else if (n.type === "image") if (n.dataBinding) {
|
|
11913
|
-
let _ =
|
|
11914
|
-
_ != null && (
|
|
11915
|
-
} else
|
|
11916
|
-
let E =
|
|
11916
|
+
let _ = Uj[n.dataBinding];
|
|
11917
|
+
_ != null && (Wj = String(_));
|
|
11918
|
+
} else Wj = Wj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
11919
|
+
let E = Uj[_.trim()];
|
|
11917
11920
|
return E == null ? n : String(E);
|
|
11918
11921
|
});
|
|
11919
11922
|
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
11920
|
-
let E =
|
|
11921
|
-
E != null && (
|
|
11922
|
-
...
|
|
11923
|
+
let E = Uj[_];
|
|
11924
|
+
E != null && (Gj = {
|
|
11925
|
+
...Gj,
|
|
11923
11926
|
[n]: String(E)
|
|
11924
11927
|
});
|
|
11925
11928
|
}), n.conditions && n.conditions.forEach((n) => {
|
|
11926
|
-
let _ =
|
|
11927
|
-
checkCondition(_, n.operator, n.value) && (
|
|
11928
|
-
...
|
|
11929
|
+
let _ = Uj[n.property];
|
|
11930
|
+
checkCondition(_, n.operator, n.value) && (Gj = {
|
|
11931
|
+
...Gj,
|
|
11929
11932
|
...n.style
|
|
11930
11933
|
});
|
|
11931
11934
|
});
|
|
11932
11935
|
}
|
|
11933
|
-
let
|
|
11934
|
-
if (
|
|
11935
|
-
let { display: n, ..._ } =
|
|
11936
|
-
|
|
11936
|
+
let Kj = Gj.display === "none";
|
|
11937
|
+
if (Kj && _) {
|
|
11938
|
+
let { display: n, ..._ } = Gj;
|
|
11939
|
+
Gj = _;
|
|
11937
11940
|
}
|
|
11938
|
-
let
|
|
11939
|
-
_.stopPropagation(), !
|
|
11940
|
-
},
|
|
11941
|
+
let qj = (_) => {
|
|
11942
|
+
_.stopPropagation(), !Mj.current && !Fj.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
11943
|
+
}, Jj = (O) => {
|
|
11941
11944
|
if (O.button !== 0) return;
|
|
11942
11945
|
O.stopPropagation();
|
|
11943
11946
|
let A = O.shiftKey;
|
|
11944
|
-
if (
|
|
11947
|
+
if (Mj.current = !1, Fj.current = !1, n.groupId && !_) {
|
|
11945
11948
|
E(n.groupId, A);
|
|
11946
11949
|
return;
|
|
11947
11950
|
}
|
|
11948
|
-
_ || (E(n.id, A),
|
|
11951
|
+
_ || (E(n.id, A), Fj.current = !0), z(!0), Aj.current = {
|
|
11949
11952
|
x: O.clientX,
|
|
11950
11953
|
y: O.clientY
|
|
11951
11954
|
}, O.currentTarget.setPointerCapture(O.pointerId);
|
|
@@ -11957,17 +11960,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11957
11960
|
x: n.x,
|
|
11958
11961
|
y: n.y
|
|
11959
11962
|
});
|
|
11960
|
-
}),
|
|
11961
|
-
},
|
|
11963
|
+
}), jj.current = N;
|
|
11964
|
+
}, Yj = (_) => {
|
|
11962
11965
|
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(
|
|
11966
|
+
let E = j.zoom || 1, O = (_.clientX - Aj.current.x) / E, M = (_.clientY - Aj.current.y) / E;
|
|
11967
|
+
(Math.abs(O) > 2 || Math.abs(M) > 2) && (Mj.current = !0);
|
|
11968
|
+
let P = 5 / E, z = [], B = Object.entries(jj.current).map(([_, E]) => {
|
|
11966
11969
|
let A = E.x + O, N = E.y + M;
|
|
11967
11970
|
if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
|
|
11968
11971
|
else {
|
|
11969
11972
|
let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
|
|
11970
|
-
Object.keys(
|
|
11973
|
+
Object.keys(jj.current).length === 1 && j.elements.forEach((n) => {
|
|
11971
11974
|
if (n.id === _) return;
|
|
11972
11975
|
let j = n.width ?? 100, H = n.height ?? 100;
|
|
11973
11976
|
E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
|
|
@@ -12007,25 +12010,25 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12007
12010
|
});
|
|
12008
12011
|
N && N(z), A(B, !1);
|
|
12009
12012
|
}
|
|
12010
|
-
},
|
|
12013
|
+
}, Xj = (n) => {
|
|
12011
12014
|
P && (z(!1), n.currentTarget.releasePointerCapture(n.pointerId), A([], !0), N && N([]));
|
|
12012
|
-
},
|
|
12015
|
+
}, Zj = (_) => {
|
|
12013
12016
|
_.stopPropagation(), _.preventDefault(), G(!0);
|
|
12014
12017
|
let E = _.target.closest(".resizable-element");
|
|
12015
12018
|
if (E) {
|
|
12016
12019
|
let O = E.getBoundingClientRect();
|
|
12017
|
-
|
|
12020
|
+
Rj.current = {
|
|
12018
12021
|
x: O.left + O.width / 2,
|
|
12019
12022
|
y: O.top + O.height / 2
|
|
12020
12023
|
};
|
|
12021
|
-
let A = _.clientX -
|
|
12022
|
-
|
|
12024
|
+
let A = _.clientX - Rj.current.x, j = _.clientY - Rj.current.y;
|
|
12025
|
+
Ij.current = Math.atan2(j, A) * (180 / Math.PI), Lj.current = n.rotation || 0;
|
|
12023
12026
|
}
|
|
12024
12027
|
};
|
|
12025
12028
|
useEffect(() => {
|
|
12026
12029
|
let _ = (_) => {
|
|
12027
12030
|
if (U) {
|
|
12028
|
-
let E = _.clientX -
|
|
12031
|
+
let E = _.clientX - Rj.current.x, A = _.clientY - Rj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Ij.current, M = (Lj.current + j) % 360;
|
|
12029
12032
|
O(n.id, { rotation: M }, !1);
|
|
12030
12033
|
}
|
|
12031
12034
|
}, E = () => {
|
|
@@ -12047,7 +12050,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12047
12050
|
}
|
|
12048
12051
|
});
|
|
12049
12052
|
}, [
|
|
12050
|
-
|
|
12053
|
+
Wj,
|
|
12051
12054
|
n.autoGrow,
|
|
12052
12055
|
n.containerExpansion,
|
|
12053
12056
|
n.style,
|
|
@@ -12057,7 +12060,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12057
12060
|
n.id,
|
|
12058
12061
|
n.type
|
|
12059
12062
|
]);
|
|
12060
|
-
let
|
|
12063
|
+
let Qj = {
|
|
12061
12064
|
position: "absolute",
|
|
12062
12065
|
left: 0,
|
|
12063
12066
|
top: 0,
|
|
@@ -12074,7 +12077,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12074
12077
|
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
12075
12078
|
userSelect: "none",
|
|
12076
12079
|
...n.style,
|
|
12077
|
-
...
|
|
12080
|
+
...Gj
|
|
12078
12081
|
};
|
|
12079
12082
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
12080
12083
|
className: "resizable-element",
|
|
@@ -12082,9 +12085,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12082
12085
|
width: n.width ?? 100,
|
|
12083
12086
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
12084
12087
|
},
|
|
12085
|
-
maxHeight: j.isList ? Math.max(10,
|
|
12088
|
+
maxHeight: j.isList ? Math.max(10, Hj - n.y) : void 0,
|
|
12086
12089
|
onResizeStart: (n) => {
|
|
12087
|
-
H(!0),
|
|
12090
|
+
H(!0), Vj.current = !!n.shiftKey;
|
|
12088
12091
|
},
|
|
12089
12092
|
onResizeStop: (_, E, A, j) => {
|
|
12090
12093
|
H(!1);
|
|
@@ -12098,8 +12101,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12098
12101
|
position: "absolute",
|
|
12099
12102
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
12100
12103
|
height: n.autoGrow ? "auto" : void 0,
|
|
12101
|
-
display:
|
|
12102
|
-
opacity:
|
|
12104
|
+
display: Kj && !_ ? "none" : void 0,
|
|
12105
|
+
opacity: Kj && _ ? .4 : 1,
|
|
12103
12106
|
zIndex: _ ? 1e3 : void 0,
|
|
12104
12107
|
outline: _ ? "1px dashed var(--accent-9)" : void 0
|
|
12105
12108
|
},
|
|
@@ -12113,7 +12116,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12113
12116
|
bottomLeft: !1,
|
|
12114
12117
|
topLeft: !1
|
|
12115
12118
|
},
|
|
12116
|
-
lockAspectRatio:
|
|
12119
|
+
lockAspectRatio: Vj.current === !0,
|
|
12117
12120
|
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
12118
12121
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
12119
12122
|
element: n,
|
|
@@ -12126,18 +12129,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12126
12129
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
12127
12130
|
ref: Z,
|
|
12128
12131
|
style: {
|
|
12129
|
-
...
|
|
12130
|
-
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" :
|
|
12132
|
+
...Qj,
|
|
12133
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : Qj.whiteSpace,
|
|
12131
12134
|
width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : "100%",
|
|
12132
12135
|
height: n.type === "text-container" && n.autoGrow && n.containerExpansion === "vertical" ? "auto" : "100%"
|
|
12133
12136
|
},
|
|
12134
|
-
onPointerDown:
|
|
12135
|
-
onPointerMove:
|
|
12136
|
-
onPointerUp:
|
|
12137
|
+
onPointerDown: Jj,
|
|
12138
|
+
onPointerMove: Yj,
|
|
12139
|
+
onPointerUp: Xj,
|
|
12137
12140
|
onMouseDown: (n) => {
|
|
12138
12141
|
n.button === 0 && n.stopPropagation();
|
|
12139
12142
|
},
|
|
12140
|
-
onClick:
|
|
12143
|
+
onClick: qj,
|
|
12141
12144
|
title: n.name,
|
|
12142
12145
|
onMouseEnter: (n) => {
|
|
12143
12146
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
@@ -12151,7 +12154,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12151
12154
|
width: "100%",
|
|
12152
12155
|
height: "100%"
|
|
12153
12156
|
},
|
|
12154
|
-
children:
|
|
12157
|
+
children: Wj
|
|
12155
12158
|
}),
|
|
12156
12159
|
n.type === "text-container" && /* @__PURE__ */ jsx(p$2, {
|
|
12157
12160
|
style: {
|
|
@@ -12159,10 +12162,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12159
12162
|
height: "100%",
|
|
12160
12163
|
display: "block"
|
|
12161
12164
|
},
|
|
12162
|
-
children:
|
|
12165
|
+
children: Wj
|
|
12163
12166
|
}),
|
|
12164
|
-
n.type === "image" && (
|
|
12165
|
-
src:
|
|
12167
|
+
n.type === "image" && (Wj ? /* @__PURE__ */ jsx("img", {
|
|
12168
|
+
src: Wj,
|
|
12166
12169
|
alt: "Element",
|
|
12167
12170
|
style: {
|
|
12168
12171
|
width: "100%",
|
|
@@ -12227,7 +12230,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12227
12230
|
zIndex: 50,
|
|
12228
12231
|
boxShadow: "0 0 0 2px white"
|
|
12229
12232
|
},
|
|
12230
|
-
onMouseDown:
|
|
12233
|
+
onMouseDown: Zj,
|
|
12231
12234
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
12232
12235
|
position: "absolute",
|
|
12233
12236
|
top: 12,
|
|
@@ -12242,44 +12245,44 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12242
12245
|
})
|
|
12243
12246
|
});
|
|
12244
12247
|
}), Canvas = () => {
|
|
12245
|
-
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,
|
|
12248
|
+
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, Aj] = useState(null), jj = useRef(!1), Mj = useRef(!1), Fj = useRef(!1), Ij = useRef({
|
|
12246
12249
|
x: 0,
|
|
12247
12250
|
y: 0
|
|
12248
|
-
}),
|
|
12251
|
+
}), Lj = useRef({
|
|
12249
12252
|
x: 0,
|
|
12250
12253
|
y: 0
|
|
12251
|
-
}),
|
|
12252
|
-
if (E.button === 1 || E.button === 0 &&
|
|
12253
|
-
E.preventDefault(),
|
|
12254
|
+
}), Rj = useRef([]), Vj = (E) => {
|
|
12255
|
+
if (E.button === 1 || E.button === 0 && Fj.current) {
|
|
12256
|
+
E.preventDefault(), Mj.current = !0, Lj.current = {
|
|
12254
12257
|
x: E.clientX,
|
|
12255
12258
|
y: E.clientY
|
|
12256
12259
|
};
|
|
12257
12260
|
return;
|
|
12258
12261
|
}
|
|
12259
|
-
|
|
12262
|
+
jj.current = !0;
|
|
12260
12263
|
let O = G.current?.getBoundingClientRect();
|
|
12261
12264
|
if (!O) return;
|
|
12262
12265
|
let A = O.left, j = O.top;
|
|
12263
|
-
|
|
12266
|
+
Ij.current = {
|
|
12264
12267
|
x: (E.clientX - A - n.pan.x) / n.zoom,
|
|
12265
12268
|
y: (E.clientY - j - n.pan.y) / n.zoom
|
|
12266
|
-
},
|
|
12267
|
-
},
|
|
12269
|
+
}, Rj.current = n.selectedElementIds, E.shiftKey || (_(null), Rj.current = []), window.addEventListener("mousemove", Hj), window.addEventListener("mouseup", Uj);
|
|
12270
|
+
}, Hj = useCallback((_) => {
|
|
12268
12271
|
if (!G.current) return;
|
|
12269
|
-
if (
|
|
12270
|
-
let E = _.clientX -
|
|
12272
|
+
if (Mj.current) {
|
|
12273
|
+
let E = _.clientX - Lj.current.x, O = _.clientY - Lj.current.y;
|
|
12271
12274
|
j({
|
|
12272
12275
|
x: n.pan.x + E,
|
|
12273
12276
|
y: n.pan.y + O
|
|
12274
|
-
}),
|
|
12277
|
+
}), Lj.current = {
|
|
12275
12278
|
x: _.clientX,
|
|
12276
12279
|
y: _.clientY
|
|
12277
12280
|
};
|
|
12278
12281
|
return;
|
|
12279
12282
|
}
|
|
12280
|
-
if (!
|
|
12281
|
-
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(
|
|
12282
|
-
if (
|
|
12283
|
+
if (!jj.current) return;
|
|
12284
|
+
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(Ij.current.x, A), P = Math.min(Ij.current.y, M), z = Math.abs(A - Ij.current.x), B = Math.abs(M - Ij.current.y);
|
|
12285
|
+
if (Aj({
|
|
12283
12286
|
x: N,
|
|
12284
12287
|
y: P,
|
|
12285
12288
|
width: z,
|
|
@@ -12289,7 +12292,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12289
12292
|
n.elements.forEach((n) => {
|
|
12290
12293
|
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;
|
|
12291
12294
|
E < U && M > N && O < W && H > P && _.push(n.id);
|
|
12292
|
-
}), E(Array.from(new Set([...
|
|
12295
|
+
}), E(Array.from(new Set([...Rj.current, ..._])));
|
|
12293
12296
|
}
|
|
12294
12297
|
}, [
|
|
12295
12298
|
n.elements,
|
|
@@ -12297,9 +12300,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12297
12300
|
n.zoom,
|
|
12298
12301
|
E,
|
|
12299
12302
|
j
|
|
12300
|
-
]),
|
|
12301
|
-
|
|
12302
|
-
}, [
|
|
12303
|
+
]), Uj = useCallback(() => {
|
|
12304
|
+
jj.current = !1, Mj.current = !1, Aj(null), window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Uj);
|
|
12305
|
+
}, [Hj]), Wj = (_) => {
|
|
12303
12306
|
if (_.ctrlKey || _.metaKey) _.preventDefault(), A(Math.min(Math.max(.1, n.zoom - _.deltaY * .001), 5));
|
|
12304
12307
|
else {
|
|
12305
12308
|
let E = _.shiftKey ? _.deltaY : _.deltaX, O = _.shiftKey ? _.deltaX : _.deltaY;
|
|
@@ -12311,7 +12314,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12311
12314
|
};
|
|
12312
12315
|
useEffect(() => {
|
|
12313
12316
|
let _ = (_) => {
|
|
12314
|
-
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (
|
|
12317
|
+
if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (Fj.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()), [
|
|
12315
12318
|
"ArrowUp",
|
|
12316
12319
|
"ArrowDown",
|
|
12317
12320
|
"ArrowLeft",
|
|
@@ -12334,10 +12337,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12334
12337
|
}), O.length > 0 && U(O);
|
|
12335
12338
|
}
|
|
12336
12339
|
}, E = (n) => {
|
|
12337
|
-
n.code === "Space" && (
|
|
12340
|
+
n.code === "Space" && (Fj.current = !1, G.current && !Mj.current && (G.current.style.cursor = "default"));
|
|
12338
12341
|
};
|
|
12339
12342
|
return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
|
|
12340
|
-
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove",
|
|
12343
|
+
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Uj);
|
|
12341
12344
|
};
|
|
12342
12345
|
}, [
|
|
12343
12346
|
M,
|
|
@@ -12348,24 +12351,24 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12348
12351
|
U,
|
|
12349
12352
|
n.selectedElementIds,
|
|
12350
12353
|
n.elements,
|
|
12351
|
-
|
|
12352
|
-
|
|
12354
|
+
Hj,
|
|
12355
|
+
Uj
|
|
12353
12356
|
]);
|
|
12354
|
-
let
|
|
12355
|
-
n.stopPropagation(), n.preventDefault(),
|
|
12356
|
-
},
|
|
12357
|
-
if (!
|
|
12357
|
+
let Gj = useRef(!1), { setCanvasHeight: Kj } = useEditor(), qj = (n) => {
|
|
12358
|
+
n.stopPropagation(), n.preventDefault(), Gj.current = !0, window.addEventListener("mousemove", Jj), window.addEventListener("mouseup", Yj);
|
|
12359
|
+
}, Jj = useCallback((n) => {
|
|
12360
|
+
if (!Gj.current || !G.current) return;
|
|
12358
12361
|
let _ = G.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12359
|
-
|
|
12360
|
-
}, [
|
|
12361
|
-
|
|
12362
|
-
}, [
|
|
12362
|
+
Kj(Math.round(O));
|
|
12363
|
+
}, [Kj]), Yj = useCallback(() => {
|
|
12364
|
+
Gj.current = !1, window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
|
|
12365
|
+
}, [Jj]);
|
|
12363
12366
|
useEffect(() => () => {
|
|
12364
|
-
window.removeEventListener("mousemove",
|
|
12365
|
-
}, [
|
|
12366
|
-
let
|
|
12367
|
+
window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
|
|
12368
|
+
}, [Jj, Yj]);
|
|
12369
|
+
let Xj = (n) => {
|
|
12367
12370
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12368
|
-
},
|
|
12371
|
+
}, Zj = (n) => {
|
|
12369
12372
|
n.preventDefault();
|
|
12370
12373
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
12371
12374
|
if (_) {
|
|
@@ -12380,20 +12383,20 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12380
12383
|
dataBinding: _
|
|
12381
12384
|
});
|
|
12382
12385
|
}
|
|
12383
|
-
},
|
|
12386
|
+
}, Qj = n.canvasHeight || 150;
|
|
12384
12387
|
return /* @__PURE__ */ jsxs(p, {
|
|
12385
12388
|
ref: G,
|
|
12386
|
-
onMouseDown:
|
|
12387
|
-
onDragOver:
|
|
12388
|
-
onDrop:
|
|
12389
|
-
onWheel:
|
|
12389
|
+
onMouseDown: Vj,
|
|
12390
|
+
onDragOver: Xj,
|
|
12391
|
+
onDrop: Zj,
|
|
12392
|
+
onWheel: Wj,
|
|
12390
12393
|
style: {
|
|
12391
12394
|
width: "100%",
|
|
12392
12395
|
height: "100%",
|
|
12393
12396
|
position: "relative",
|
|
12394
12397
|
overflow: "hidden",
|
|
12395
12398
|
backgroundColor: "var(--color-background)",
|
|
12396
|
-
cursor:
|
|
12399
|
+
cursor: Mj.current ? "grabbing" : "default",
|
|
12397
12400
|
backgroundImage: "radial-gradient(var(--gray-5) 1px, transparent 1px)",
|
|
12398
12401
|
backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
|
|
12399
12402
|
backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
|
|
@@ -12442,7 +12445,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12442
12445
|
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
12443
12446
|
style: {
|
|
12444
12447
|
position: "absolute",
|
|
12445
|
-
top:
|
|
12448
|
+
top: Qj,
|
|
12446
12449
|
left: 0,
|
|
12447
12450
|
right: 0,
|
|
12448
12451
|
height: "10px",
|
|
@@ -12454,7 +12457,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12454
12457
|
justifyContent: "center",
|
|
12455
12458
|
group: "resize-handle"
|
|
12456
12459
|
},
|
|
12457
|
-
onMouseDown:
|
|
12460
|
+
onMouseDown: qj,
|
|
12458
12461
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12459
12462
|
width: "100%",
|
|
12460
12463
|
height: "2px",
|
|
@@ -12478,7 +12481,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12478
12481
|
},
|
|
12479
12482
|
children: [
|
|
12480
12483
|
"Altura do Item: ",
|
|
12481
|
-
|
|
12484
|
+
Qj,
|
|
12482
12485
|
"px"
|
|
12483
12486
|
]
|
|
12484
12487
|
})]
|
|
@@ -12557,22 +12560,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12557
12560
|
})]
|
|
12558
12561
|
});
|
|
12559
12562
|
}, EditorSettings = () => {
|
|
12560
|
-
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,
|
|
12563
|
+
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, Aj] = useState("150"), [jj, Mj] = useState(""), [Nj, Fj] = useState("0"), [Ij, Lj] = useState("slideIn"), [Rj, Vj] = useState(.3), [Hj, Uj] = useState("ease-out");
|
|
12561
12564
|
return useEffect(() => {
|
|
12562
12565
|
if (A) {
|
|
12563
|
-
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"),
|
|
12566
|
+
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"), Mj(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), Aj(String(n.canvasHeight || 150)), Fj(String(n.gridSize || 0));
|
|
12564
12567
|
let _ = n.listSettings.entryAnimation;
|
|
12565
|
-
|
|
12568
|
+
Lj(_?.type || "slideIn"), Vj(_?.duration || .3), Uj(_?.timingFunction || "ease-out");
|
|
12566
12569
|
}
|
|
12567
12570
|
}, [A]), useEffect(() => {
|
|
12568
12571
|
if (!A) return;
|
|
12569
12572
|
let _ = parseInt(Z, 10);
|
|
12570
12573
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
12571
|
-
let j = parseInt(
|
|
12574
|
+
let j = parseInt(Nj, 10);
|
|
12572
12575
|
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
12573
12576
|
}, [
|
|
12574
12577
|
Z,
|
|
12575
|
-
|
|
12578
|
+
Nj,
|
|
12576
12579
|
A,
|
|
12577
12580
|
E,
|
|
12578
12581
|
O,
|
|
@@ -12751,7 +12754,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12751
12754
|
type: "number",
|
|
12752
12755
|
min: "10",
|
|
12753
12756
|
value: Z,
|
|
12754
|
-
onChange: (n) =>
|
|
12757
|
+
onChange: (n) => Aj(n.target.value)
|
|
12755
12758
|
}),
|
|
12756
12759
|
/* @__PURE__ */ jsx(p$2, {
|
|
12757
12760
|
size: "1",
|
|
@@ -12772,8 +12775,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12772
12775
|
type: "number",
|
|
12773
12776
|
min: "0",
|
|
12774
12777
|
placeholder: "Auto (100%)",
|
|
12775
|
-
value:
|
|
12776
|
-
onChange: (n) =>
|
|
12778
|
+
value: jj,
|
|
12779
|
+
onChange: (n) => Mj(n.target.value)
|
|
12777
12780
|
}),
|
|
12778
12781
|
/* @__PURE__ */ jsx(p$2, {
|
|
12779
12782
|
size: "1",
|
|
@@ -12799,8 +12802,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12799
12802
|
as: "div",
|
|
12800
12803
|
children: "Efeito"
|
|
12801
12804
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12802
|
-
value:
|
|
12803
|
-
onChange: (n) =>
|
|
12805
|
+
value: Ij,
|
|
12806
|
+
onChange: (n) => Lj(n.target.value),
|
|
12804
12807
|
style: {
|
|
12805
12808
|
width: "100%",
|
|
12806
12809
|
padding: "6px",
|
|
@@ -12862,8 +12865,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12862
12865
|
type: "number",
|
|
12863
12866
|
step: "0.1",
|
|
12864
12867
|
min: "0.1",
|
|
12865
|
-
value:
|
|
12866
|
-
onChange: (n) =>
|
|
12868
|
+
value: Rj,
|
|
12869
|
+
onChange: (n) => Vj(parseFloat(n.target.value) || .3)
|
|
12867
12870
|
})] }),
|
|
12868
12871
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
12869
12872
|
size: "1",
|
|
@@ -12871,8 +12874,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12871
12874
|
as: "div",
|
|
12872
12875
|
children: "Curva (Easing)"
|
|
12873
12876
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12874
|
-
value:
|
|
12875
|
-
onChange: (n) =>
|
|
12877
|
+
value: Hj,
|
|
12878
|
+
onChange: (n) => Uj(n.target.value),
|
|
12876
12879
|
style: {
|
|
12877
12880
|
width: "100%",
|
|
12878
12881
|
padding: "6px",
|
|
@@ -12927,8 +12930,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12927
12930
|
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
12928
12931
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
12929
12932
|
type: "number",
|
|
12930
|
-
value:
|
|
12931
|
-
onChange: (n) =>
|
|
12933
|
+
value: Nj,
|
|
12934
|
+
onChange: (n) => Fj(n.target.value),
|
|
12932
12935
|
placeholder: "0"
|
|
12933
12936
|
})]
|
|
12934
12937
|
})
|
|
@@ -12947,11 +12950,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12947
12950
|
children: "Cancelar"
|
|
12948
12951
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
12949
12952
|
onClick: () => {
|
|
12950
|
-
let n = parseInt(
|
|
12951
|
-
type:
|
|
12952
|
-
duration: Number(
|
|
12953
|
+
let n = parseInt(jj, 10), E = {
|
|
12954
|
+
type: Ij,
|
|
12955
|
+
duration: Number(Rj),
|
|
12953
12956
|
delay: 0,
|
|
12954
|
-
timingFunction:
|
|
12957
|
+
timingFunction: Hj
|
|
12955
12958
|
};
|
|
12956
12959
|
_({
|
|
12957
12960
|
sortProp: M === "__none__" ? "" : M,
|
|
@@ -13115,13 +13118,13 @@ function createRenderBatcher(n, _) {
|
|
|
13115
13118
|
}, 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 = () => {
|
|
13116
13119
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
13117
13120
|
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));
|
|
13118
|
-
},
|
|
13121
|
+
}, Aj = () => {
|
|
13119
13122
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
13120
13123
|
};
|
|
13121
13124
|
return {
|
|
13122
13125
|
schedule: stepsOrder.reduce((n, _) => {
|
|
13123
13126
|
let O = M[_];
|
|
13124
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
13127
|
+
return n[_] = (n, _ = !1, A = !1) => (E || Aj(), O.schedule(n, _, A)), n;
|
|
13125
13128
|
}, {}),
|
|
13126
13129
|
cancel: (n) => {
|
|
13127
13130
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -13479,40 +13482,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
13479
13482
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
13480
13483
|
...E,
|
|
13481
13484
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
13482
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
13483
|
-
O ||=
|
|
13484
|
-
let
|
|
13485
|
+
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Aj = M - j, jj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), Mj = Math.abs(Aj) < 5;
|
|
13486
|
+
O ||= Mj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= Mj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
13487
|
+
let Nj;
|
|
13485
13488
|
if (Z < 1) {
|
|
13486
|
-
let n = calcAngularFreq(
|
|
13487
|
-
|
|
13488
|
-
} else if (Z === 1)
|
|
13489
|
+
let n = calcAngularFreq(jj, Z);
|
|
13490
|
+
Nj = (_) => M - Math.exp(-Z * jj * _) * ((G + Z * jj * Aj) / n * Math.sin(n * _) + Aj * Math.cos(n * _));
|
|
13491
|
+
} else if (Z === 1) Nj = (n) => M - Math.exp(-jj * n) * (Aj + (G + jj * Aj) * n);
|
|
13489
13492
|
else {
|
|
13490
|
-
let n =
|
|
13491
|
-
|
|
13492
|
-
let E = Math.exp(-Z *
|
|
13493
|
-
return M - E * ((G + Z *
|
|
13493
|
+
let n = jj * Math.sqrt(Z * Z - 1);
|
|
13494
|
+
Nj = (_) => {
|
|
13495
|
+
let E = Math.exp(-Z * jj * _), O = Math.min(n * _, 300);
|
|
13496
|
+
return M - E * ((G + Z * jj * Aj) * Math.sinh(O) + n * Aj * Math.cosh(O)) / n;
|
|
13494
13497
|
};
|
|
13495
13498
|
}
|
|
13496
|
-
let
|
|
13499
|
+
let Pj = {
|
|
13497
13500
|
calculatedDuration: W && H || null,
|
|
13498
13501
|
next: (n) => {
|
|
13499
|
-
let _ =
|
|
13502
|
+
let _ = Nj(n);
|
|
13500
13503
|
if (W) N.done = n >= H;
|
|
13501
13504
|
else {
|
|
13502
13505
|
let E = n === 0 ? G : 0;
|
|
13503
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
13506
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Nj, n, _));
|
|
13504
13507
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
13505
13508
|
N.done = j && P;
|
|
13506
13509
|
}
|
|
13507
13510
|
return N.value = N.done ? M : _, N;
|
|
13508
13511
|
},
|
|
13509
13512
|
toString: () => {
|
|
13510
|
-
let n = Math.min(calcGeneratorDuration(
|
|
13513
|
+
let n = Math.min(calcGeneratorDuration(Pj), maxGeneratorDuration), _ = generateLinearEasing((_) => Pj.next(n * _).value, n, 30);
|
|
13511
13514
|
return n + "ms " + _;
|
|
13512
13515
|
},
|
|
13513
13516
|
toTransition: () => {}
|
|
13514
13517
|
};
|
|
13515
|
-
return
|
|
13518
|
+
return Pj;
|
|
13516
13519
|
}
|
|
13517
13520
|
spring.applyToOptions = (n) => {
|
|
13518
13521
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -13522,26 +13525,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
13522
13525
|
let H = n[0], U = {
|
|
13523
13526
|
done: !1,
|
|
13524
13527
|
value: H
|
|
13525
|
-
}, 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 * _,
|
|
13526
|
-
|
|
13527
|
-
let
|
|
13528
|
-
let _ =
|
|
13529
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
13530
|
-
},
|
|
13531
|
-
W(U.value) && (
|
|
13528
|
+
}, 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 * _, Aj = H + Z, jj = M === void 0 ? Aj : M(Aj);
|
|
13529
|
+
jj !== Aj && (Z = jj - H);
|
|
13530
|
+
let Mj = (n) => -Z * Math.exp(-n / O), Nj = (n) => jj + Mj(n), Pj = (n) => {
|
|
13531
|
+
let _ = Mj(n), E = Nj(n);
|
|
13532
|
+
U.done = Math.abs(_) <= z, U.value = U.done ? jj : E;
|
|
13533
|
+
}, Fj, Ij, Lj = (n) => {
|
|
13534
|
+
W(U.value) && (Fj = n, Ij = spring({
|
|
13532
13535
|
keyframes: [U.value, G(U.value)],
|
|
13533
|
-
velocity: calcGeneratorVelocity(
|
|
13536
|
+
velocity: calcGeneratorVelocity(Nj, n, U.value),
|
|
13534
13537
|
damping: A,
|
|
13535
13538
|
stiffness: j,
|
|
13536
13539
|
restDelta: z,
|
|
13537
13540
|
restSpeed: B
|
|
13538
13541
|
}));
|
|
13539
13542
|
};
|
|
13540
|
-
return
|
|
13543
|
+
return Lj(0), {
|
|
13541
13544
|
calculatedDuration: null,
|
|
13542
13545
|
next: (n) => {
|
|
13543
13546
|
let _ = !1;
|
|
13544
|
-
return !
|
|
13547
|
+
return !Ij && Fj === void 0 && (_ = !0, Pj(n), Lj(n)), Fj !== void 0 && n >= Fj ? Ij.next(n - Fj) : (!_ && Pj(n), U);
|
|
13545
13548
|
}
|
|
13546
13549
|
};
|
|
13547
13550
|
}
|
|
@@ -13661,22 +13664,22 @@ var WithPromise = class {
|
|
|
13661
13664
|
if (this.startTime === null) return E.next(0);
|
|
13662
13665
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
13663
13666
|
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);
|
|
13664
|
-
let
|
|
13665
|
-
this.currentTime = Math.max(
|
|
13666
|
-
let
|
|
13667
|
+
let Aj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), jj = this.playbackSpeed >= 0 ? Aj < 0 : Aj > O;
|
|
13668
|
+
this.currentTime = Math.max(Aj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
|
|
13669
|
+
let Mj = this.currentTime, Nj = E;
|
|
13667
13670
|
if (B) {
|
|
13668
13671
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
13669
|
-
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (
|
|
13672
|
+
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Nj = j)), Mj = clamp(0, 1, E) * M;
|
|
13670
13673
|
}
|
|
13671
|
-
let
|
|
13674
|
+
let Pj = jj ? {
|
|
13672
13675
|
done: !1,
|
|
13673
13676
|
value: z[0]
|
|
13674
|
-
} :
|
|
13675
|
-
A && (
|
|
13676
|
-
let { done:
|
|
13677
|
-
!
|
|
13678
|
-
let
|
|
13679
|
-
return
|
|
13677
|
+
} : Nj.next(Mj);
|
|
13678
|
+
A && (Pj.value = A(Pj.value));
|
|
13679
|
+
let { done: Fj } = Pj;
|
|
13680
|
+
!jj && N !== null && (Fj = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
|
|
13681
|
+
let Ij = this.holdTime === null && (this.state === "finished" || this.state === "running" && Fj);
|
|
13682
|
+
return Ij && W !== inertia && (Pj.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(Pj.value), Ij && this.finish(), Pj;
|
|
13680
13683
|
}
|
|
13681
13684
|
then(n, _) {
|
|
13682
13685
|
return this.finished.then(n, _);
|
|
@@ -14739,46 +14742,46 @@ function onlyElements(n) {
|
|
|
14739
14742
|
}), _;
|
|
14740
14743
|
}
|
|
14741
14744
|
var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
|
|
14742
|
-
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H),
|
|
14745
|
+
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Aj = useConstant(() => /* @__PURE__ */ new Map()), jj = useRef(/* @__PURE__ */ new Set()), [Fj, Ij] = useState(H), [Lj, Bj] = useState(H);
|
|
14743
14746
|
useIsomorphicLayoutEffect(() => {
|
|
14744
14747
|
G.current = !1, Z.current = H;
|
|
14745
|
-
for (let n = 0; n <
|
|
14746
|
-
let _ = getChildKey(
|
|
14747
|
-
W.includes(_) ? (
|
|
14748
|
+
for (let n = 0; n < Lj.length; n++) {
|
|
14749
|
+
let _ = getChildKey(Lj[n]);
|
|
14750
|
+
W.includes(_) ? (Aj.delete(_), jj.current.delete(_)) : Aj.get(_) !== !0 && Aj.set(_, !1);
|
|
14748
14751
|
}
|
|
14749
14752
|
}, [
|
|
14750
|
-
|
|
14753
|
+
Lj,
|
|
14751
14754
|
W.length,
|
|
14752
14755
|
W.join("-")
|
|
14753
14756
|
]);
|
|
14754
|
-
let
|
|
14755
|
-
if (H !==
|
|
14757
|
+
let Vj = [];
|
|
14758
|
+
if (H !== Fj) {
|
|
14756
14759
|
let n = [...H];
|
|
14757
|
-
for (let _ = 0; _ <
|
|
14758
|
-
let E =
|
|
14759
|
-
W.includes(O) || (n.splice(_, 0, E),
|
|
14760
|
+
for (let _ = 0; _ < Lj.length; _++) {
|
|
14761
|
+
let E = Lj[_], O = getChildKey(E);
|
|
14762
|
+
W.includes(O) || (n.splice(_, 0, E), Vj.push(E));
|
|
14760
14763
|
}
|
|
14761
|
-
return j === "wait" &&
|
|
14764
|
+
return j === "wait" && Vj.length && (n = Vj), Bj(onlyElements(n)), Ij(H), null;
|
|
14762
14765
|
}
|
|
14763
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
14764
|
-
let { forceRender:
|
|
14765
|
-
return jsx(Fragment$1, { children:
|
|
14766
|
-
let U = getChildKey(n),
|
|
14766
|
+
process.env.NODE_ENV !== "production" && j === "wait" && Lj.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.");
|
|
14767
|
+
let { forceRender: Hj } = useContext(LayoutGroupContext);
|
|
14768
|
+
return jsx(Fragment$1, { children: Lj.map((n) => {
|
|
14769
|
+
let U = getChildKey(n), Mj = M && !z ? !1 : H === Lj || W.includes(U);
|
|
14767
14770
|
return jsx(PresenceChild, {
|
|
14768
|
-
isPresent:
|
|
14771
|
+
isPresent: Mj,
|
|
14769
14772
|
initial: !G.current || E ? void 0 : !1,
|
|
14770
14773
|
custom: _,
|
|
14771
14774
|
presenceAffectsLayout: A,
|
|
14772
14775
|
mode: j,
|
|
14773
14776
|
root: P,
|
|
14774
|
-
onExitComplete:
|
|
14775
|
-
if (
|
|
14776
|
-
if (
|
|
14777
|
+
onExitComplete: Mj ? void 0 : () => {
|
|
14778
|
+
if (jj.current.has(U)) return;
|
|
14779
|
+
if (jj.current.add(U), Aj.has(U)) Aj.set(U, !0);
|
|
14777
14780
|
else return;
|
|
14778
14781
|
let n = !0;
|
|
14779
|
-
|
|
14782
|
+
Aj.forEach((_) => {
|
|
14780
14783
|
_ || (n = !1);
|
|
14781
|
-
}), n && (
|
|
14784
|
+
}), n && (Hj?.(), Bj(Z.current), M && B?.(), O && O());
|
|
14782
14785
|
},
|
|
14783
14786
|
anchorX: N,
|
|
14784
14787
|
children: n
|
|
@@ -15207,12 +15210,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
15207
15210
|
useInsertionEffect(() => {
|
|
15208
15211
|
H && Z.current && H.update(E, P);
|
|
15209
15212
|
});
|
|
15210
|
-
let
|
|
15213
|
+
let jj = E[optimizedAppearDataAttribute], Mj = useRef(!!jj && !window.MotionHandoffIsComplete?.(jj) && window.MotionHasOptimisedAnimation?.(jj));
|
|
15211
15214
|
return useIsomorphicLayoutEffect(() => {
|
|
15212
|
-
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(),
|
|
15215
|
+
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), Mj.current && H.animationState && H.animationState.animateChanges());
|
|
15213
15216
|
}), useEffect(() => {
|
|
15214
|
-
H && (!
|
|
15215
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
15217
|
+
H && (!Mj.current && H.animationState && H.animationState.animateChanges(), Mj.current &&= (queueMicrotask(() => {
|
|
15218
|
+
window.MotionHandoffMarkAsComplete?.(jj);
|
|
15216
15219
|
}), !1), H.enteringChildren = void 0);
|
|
15217
15220
|
}), H;
|
|
15218
15221
|
}
|
|
@@ -15890,34 +15893,34 @@ function createAnimationState(n) {
|
|
|
15890
15893
|
function M(j) {
|
|
15891
15894
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
15892
15895
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
15893
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
15894
|
-
|
|
15895
|
-
let
|
|
15896
|
-
if (
|
|
15897
|
-
let
|
|
15898
|
-
|
|
15899
|
-
let { prevResolvedValues:
|
|
15900
|
-
...
|
|
15901
|
-
...
|
|
15902
|
-
},
|
|
15903
|
-
|
|
15896
|
+
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Aj = U === j ? W.isActive : null;
|
|
15897
|
+
Aj === !1 && (H = _);
|
|
15898
|
+
let jj = G === N[U] && G !== M[U] && Z;
|
|
15899
|
+
if (jj && O && n.manuallyAnimateOnMount && (jj = !1), W.protectedKeys = { ...B }, !W.isActive && Aj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
|
|
15900
|
+
let Mj = checkVariantsDidChange(W.prevProp, G), Nj = Mj || U === j && W.isActive && !jj && Z || _ > H && Z, Pj = !1, Fj = Array.isArray(G) ? G : [G], Ij = Fj.reduce(A(U), {});
|
|
15901
|
+
Aj === !1 && (Ij = {});
|
|
15902
|
+
let { prevResolvedValues: Lj = {} } = W, Rj = {
|
|
15903
|
+
...Lj,
|
|
15904
|
+
...Ij
|
|
15905
|
+
}, zj = (_) => {
|
|
15906
|
+
Nj = !0, z.has(_) && (Pj = !0, z.delete(_)), W.needsAnimating[_] = !0;
|
|
15904
15907
|
let E = n.getValue(_);
|
|
15905
15908
|
E && (E.liveStyle = !1);
|
|
15906
15909
|
};
|
|
15907
|
-
for (let n in
|
|
15908
|
-
let _ =
|
|
15910
|
+
for (let n in Rj) {
|
|
15911
|
+
let _ = Ij[n], E = Lj[n];
|
|
15909
15912
|
if (B.hasOwnProperty(n)) continue;
|
|
15910
15913
|
let O = !1;
|
|
15911
|
-
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) :
|
|
15914
|
+
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : zj(n) : _ !== void 0 && z.has(n) ? zj(n) : W.protectedKeys[n] = !0;
|
|
15912
15915
|
}
|
|
15913
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
15916
|
+
W.prevProp = G, W.prevResolvedValues = Ij, W.isActive && (B = {
|
|
15914
15917
|
...B,
|
|
15915
|
-
...
|
|
15916
|
-
}), O && n.blockInitialAnimation && (
|
|
15917
|
-
let
|
|
15918
|
-
|
|
15918
|
+
...Ij
|
|
15919
|
+
}), O && n.blockInitialAnimation && (Nj = !1);
|
|
15920
|
+
let Bj = jj && Mj;
|
|
15921
|
+
Nj && (!Bj || Pj) && P.push(...Fj.map((_) => {
|
|
15919
15922
|
let E = { type: U };
|
|
15920
|
-
if (typeof _ == "string" && O && !
|
|
15923
|
+
if (typeof _ == "string" && O && !Bj && n.manuallyAnimateOnMount && n.parent) {
|
|
15921
15924
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
15922
15925
|
if (O.enteringChildren && A) {
|
|
15923
15926
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -17589,7 +17592,7 @@ var getAnimationVariants = (n) => {
|
|
|
17589
17592
|
}, PreviewElementRenderer = ({ element: n, offsetY: _ = 0, dataContext: E }) => {
|
|
17590
17593
|
let O = n.content;
|
|
17591
17594
|
if (E) {
|
|
17592
|
-
if (n.type === "text") O = O.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
17595
|
+
if (n.type === "text" || n.type === "text-container") O = O.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
17593
17596
|
let O = E[_.trim()];
|
|
17594
17597
|
return O == null ? n : String(O);
|
|
17595
17598
|
});
|
|
@@ -17606,15 +17609,24 @@ var getAnimationVariants = (n) => {
|
|
|
17606
17609
|
position: "absolute",
|
|
17607
17610
|
left: 0,
|
|
17608
17611
|
top: 0,
|
|
17609
|
-
width: `${n.width}px`,
|
|
17610
|
-
height: `${n.height}px`,
|
|
17612
|
+
width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : `${n.width}px`,
|
|
17613
|
+
height: n.autoGrow ? "auto" : `${n.height}px`,
|
|
17611
17614
|
transform: `translate(${n.x}px, ${n.y + _}px) rotate(${n.rotation || 0}deg)`,
|
|
17612
|
-
padding: n.type === "image" || n.type === "text" ? 0 : "8px",
|
|
17613
|
-
overflow: "hidden",
|
|
17615
|
+
padding: n.type === "image" || n.type === "text" || n.type === "text-container" ? 0 : "8px",
|
|
17616
|
+
overflow: n.autoGrow ? "visible" : "hidden",
|
|
17617
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : n.autoGrow ? "pre-wrap" : void 0,
|
|
17618
|
+
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
17614
17619
|
...n.style
|
|
17615
17620
|
},
|
|
17616
17621
|
children: [
|
|
17617
|
-
n.type === "text" && /* @__PURE__ */ jsx(p$2, {
|
|
17622
|
+
(n.type === "text" || n.type === "text-container") && /* @__PURE__ */ jsx(p$2, {
|
|
17623
|
+
style: {
|
|
17624
|
+
width: "100%",
|
|
17625
|
+
height: "100%",
|
|
17626
|
+
display: "block"
|
|
17627
|
+
},
|
|
17628
|
+
children: O
|
|
17629
|
+
}),
|
|
17618
17630
|
n.type === "image" && (O ? /* @__PURE__ */ jsx("img", {
|
|
17619
17631
|
src: O,
|
|
17620
17632
|
alt: "Element",
|
|
@@ -17788,16 +17800,16 @@ const Preview = () => {
|
|
|
17788
17800
|
});
|
|
17789
17801
|
};
|
|
17790
17802
|
var LayersPanel = ({ onOpenSettings: n }) => {
|
|
17791
|
-
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"),
|
|
17803
|
+
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"), Aj = /* @__PURE__ */ new Map();
|
|
17792
17804
|
Z.forEach((n) => {
|
|
17793
|
-
|
|
17805
|
+
Aj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
|
|
17794
17806
|
});
|
|
17795
|
-
let
|
|
17807
|
+
let jj = _.elements.filter((n) => n.type !== "group" && !n.groupId), Mj = (n) => {
|
|
17796
17808
|
P((_) => ({
|
|
17797
17809
|
..._,
|
|
17798
17810
|
[n]: !_[n]
|
|
17799
17811
|
}));
|
|
17800
|
-
},
|
|
17812
|
+
}, Nj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
|
|
17801
17813
|
style: {
|
|
17802
17814
|
borderRadius: 6,
|
|
17803
17815
|
backgroundColor: _.selectedElementIds.includes(O.id) ? "var(--gray-5)" : "var(--gray-3)",
|
|
@@ -17862,9 +17874,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17862
17874
|
direction: "column",
|
|
17863
17875
|
gap: "2",
|
|
17864
17876
|
children: [
|
|
17865
|
-
|
|
17877
|
+
jj.map((n) => Nj(n, 0)),
|
|
17866
17878
|
Z.map((_) => {
|
|
17867
|
-
let O = N[_.id] === !0, j =
|
|
17879
|
+
let O = N[_.id] === !0, j = Aj.get(_.id) || [];
|
|
17868
17880
|
return /* @__PURE__ */ jsxs(p, {
|
|
17869
17881
|
style: {
|
|
17870
17882
|
border: "1px dashed var(--gray-6)",
|
|
@@ -17881,7 +17893,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17881
17893
|
onClick: () => {
|
|
17882
17894
|
E(_.id), n && n(_.id);
|
|
17883
17895
|
},
|
|
17884
|
-
onDoubleClick: () =>
|
|
17896
|
+
onDoubleClick: () => Mj(_.id),
|
|
17885
17897
|
onDragOver: (n) => {
|
|
17886
17898
|
n.preventDefault();
|
|
17887
17899
|
},
|
|
@@ -17910,7 +17922,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17910
17922
|
direction: "column",
|
|
17911
17923
|
gap: "2",
|
|
17912
17924
|
style: { padding: "6px 8px" },
|
|
17913
|
-
children: [j.map((n) =>
|
|
17925
|
+
children: [j.map((n) => Nj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
|
|
17914
17926
|
size: "1",
|
|
17915
17927
|
color: "gray",
|
|
17916
17928
|
children: "Solte elementos aqui para agrupar"
|
|
@@ -17970,7 +17982,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17970
17982
|
]
|
|
17971
17983
|
});
|
|
17972
17984
|
}, EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
17973
|
-
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo:
|
|
17985
|
+
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Aj, redo: jj, copy: Mj, paste: Nj, removeSelected: Fj, updateElements: Ij } = useEditor(), Lj = React.useRef(null), Rj = () => {
|
|
17974
17986
|
let n = {
|
|
17975
17987
|
elements: Z.elements,
|
|
17976
17988
|
isList: Z.isList,
|
|
@@ -17981,9 +17993,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17981
17993
|
gridSize: Z.gridSize
|
|
17982
17994
|
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
17983
17995
|
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);
|
|
17984
|
-
},
|
|
17985
|
-
|
|
17986
|
-
},
|
|
17996
|
+
}, Vj = () => {
|
|
17997
|
+
Lj.current?.click();
|
|
17998
|
+
}, Hj = (n) => {
|
|
17987
17999
|
let _ = n.target.files?.[0];
|
|
17988
18000
|
if (!_) return;
|
|
17989
18001
|
let E = new FileReader();
|
|
@@ -18023,11 +18035,11 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18023
18035
|
}, [W]), React.useEffect(() => {
|
|
18024
18036
|
let n = (n) => {
|
|
18025
18037
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
18026
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
18027
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
18028
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
18029
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
18030
|
-
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(),
|
|
18038
|
+
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), jj()) : (n.preventDefault(), Aj());
|
|
18039
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), jj();
|
|
18040
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), Mj();
|
|
18041
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Nj();
|
|
18042
|
+
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), Fj());
|
|
18031
18043
|
else if ([
|
|
18032
18044
|
"ArrowUp",
|
|
18033
18045
|
"ArrowDown",
|
|
@@ -18045,20 +18057,20 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18045
18057
|
changes: j
|
|
18046
18058
|
});
|
|
18047
18059
|
}
|
|
18048
|
-
}), E.length > 0 &&
|
|
18060
|
+
}), E.length > 0 && Ij(E);
|
|
18049
18061
|
}
|
|
18050
18062
|
}
|
|
18051
18063
|
};
|
|
18052
18064
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
18053
18065
|
}, [
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18066
|
+
Aj,
|
|
18067
|
+
jj,
|
|
18068
|
+
Mj,
|
|
18069
|
+
Nj,
|
|
18070
|
+
Fj,
|
|
18059
18071
|
Z.selectedElementIds,
|
|
18060
18072
|
Z.elements,
|
|
18061
|
-
|
|
18073
|
+
Ij
|
|
18062
18074
|
]), React.useEffect(() => {
|
|
18063
18075
|
if (E) try {
|
|
18064
18076
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
@@ -18067,7 +18079,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18067
18079
|
console.error("Failed to load initial state", n);
|
|
18068
18080
|
}
|
|
18069
18081
|
}, [E, G]);
|
|
18070
|
-
let
|
|
18082
|
+
let Uj = (n) => {
|
|
18071
18083
|
console.log(`Adding element of type: ${n}`), W({
|
|
18072
18084
|
type: n,
|
|
18073
18085
|
content: `New ${n}`
|
|
@@ -18128,19 +18140,19 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18128
18140
|
style: { width: "240px" },
|
|
18129
18141
|
children: [
|
|
18130
18142
|
/* @__PURE__ */ jsx(v$3, {
|
|
18131
|
-
onSelect: () =>
|
|
18143
|
+
onSelect: () => Uj("text"),
|
|
18132
18144
|
children: "Texto"
|
|
18133
18145
|
}),
|
|
18134
18146
|
/* @__PURE__ */ jsx(v$3, {
|
|
18135
|
-
onSelect: () =>
|
|
18147
|
+
onSelect: () => Uj("image"),
|
|
18136
18148
|
children: "Imagem"
|
|
18137
18149
|
}),
|
|
18138
18150
|
/* @__PURE__ */ jsx(v$3, {
|
|
18139
|
-
onSelect: () =>
|
|
18151
|
+
onSelect: () => Uj("box"),
|
|
18140
18152
|
children: "Caixa (Container)"
|
|
18141
18153
|
}),
|
|
18142
18154
|
/* @__PURE__ */ jsx(v$3, {
|
|
18143
|
-
onSelect: () =>
|
|
18155
|
+
onSelect: () => Uj("text-container"),
|
|
18144
18156
|
children: "Container com Texto"
|
|
18145
18157
|
})
|
|
18146
18158
|
]
|
|
@@ -18179,7 +18191,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18179
18191
|
cursor: "pointer",
|
|
18180
18192
|
justifyContent: "center"
|
|
18181
18193
|
},
|
|
18182
|
-
onClick:
|
|
18194
|
+
onClick: Rj,
|
|
18183
18195
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
18184
18196
|
}), /* @__PURE__ */ jsxs(o, {
|
|
18185
18197
|
variant: "soft",
|
|
@@ -18189,16 +18201,16 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18189
18201
|
cursor: "pointer",
|
|
18190
18202
|
justifyContent: "center"
|
|
18191
18203
|
},
|
|
18192
|
-
onClick:
|
|
18204
|
+
onClick: Vj,
|
|
18193
18205
|
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
18194
18206
|
})]
|
|
18195
18207
|
}),
|
|
18196
18208
|
/* @__PURE__ */ jsx("input", {
|
|
18197
18209
|
type: "file",
|
|
18198
|
-
ref:
|
|
18210
|
+
ref: Lj,
|
|
18199
18211
|
style: { display: "none" },
|
|
18200
18212
|
accept: ".json",
|
|
18201
|
-
onChange:
|
|
18213
|
+
onChange: Hj
|
|
18202
18214
|
}),
|
|
18203
18215
|
/* @__PURE__ */ jsx(p, {
|
|
18204
18216
|
mt: "2",
|
|
@@ -18384,5 +18396,5 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
|
18384
18396
|
availableProps: n.layout.props,
|
|
18385
18397
|
theme: n.theme,
|
|
18386
18398
|
children: /* @__PURE__ */ jsx(EditorContent, { ...n })
|
|
18387
|
-
}), 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 // Horizontal expansion: Update width only\n // Requires canvas context which is available in measureTextHeight scope or we create new one\n // For simplicity, we can't easily access the measure logic here if it's not exposed, \n // but measureTextHeight is available in this scope.\n // However measureTextHeight calculates HEIGHT. We need WIDTH.\n \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 // Vertical Expansion\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') {\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 // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate per-item height respecting autoGrow\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemHeight = computeItemHeight(elements, item, canvasHeight);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%'\n });\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";
|
|
18399
|
+
}), 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 // Horizontal expansion: Update width only\n // Requires canvas context which is available in measureTextHeight scope or we create new one\n // For simplicity, we can't easily access the measure logic here if it's not exposed, \n // but measureTextHeight is available in this scope.\n // However measureTextHeight calculates HEIGHT. We need WIDTH.\n \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 // Vertical Expansion\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') {\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 // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text' || 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 }\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";
|
|
18388
18400
|
export { GenericEditor as EditorContent, generateHTML };
|