@1urso/generic-editor 0.1.40 → 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/editor/context.d.ts +2 -1
- package/dist/generic-editor.js +965 -867
- package/dist/generic-editor.umd.cjs +53 -28
- 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,9 +8769,9 @@ 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
|
-
n.type === "box" && (_.backgroundColor = "var(--gray-4)");
|
|
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 = {
|
|
8776
8776
|
id: crypto.randomUUID(),
|
|
8777
8777
|
x: 50,
|
|
@@ -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;
|
|
@@ -10469,21 +10469,53 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10469
10469
|
color: "gray",
|
|
10470
10470
|
children: "Configure como os dados serão exibidos quando substituídos."
|
|
10471
10471
|
}),
|
|
10472
|
-
n.type === "text" && /* @__PURE__ */ jsxs(p, { children: [
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10472
|
+
(n.type === "text" || n.type === "text-container") && /* @__PURE__ */ jsxs(p, { children: [
|
|
10473
|
+
/* @__PURE__ */ jsxs(p$1, {
|
|
10474
|
+
align: "center",
|
|
10475
|
+
gap: "2",
|
|
10476
|
+
mb: "3",
|
|
10477
|
+
children: [/* @__PURE__ */ jsx(i, {
|
|
10478
|
+
checked: n.autoGrow || !1,
|
|
10479
|
+
onCheckedChange: (E) => _(n.id, { autoGrow: E })
|
|
10480
|
+
}), /* @__PURE__ */ jsx(p$2, {
|
|
10481
|
+
size: "2",
|
|
10482
|
+
children: n.type === "text-container" ? "Expandir container automaticamente" : "Expandir altura automaticamente (Multilinha)"
|
|
10483
|
+
})]
|
|
10484
|
+
}),
|
|
10485
|
+
n.type === "text-container" && n.autoGrow && /* @__PURE__ */ jsxs(p, {
|
|
10486
|
+
mb: "3",
|
|
10487
|
+
ml: "4",
|
|
10488
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
10489
|
+
size: "1",
|
|
10490
|
+
mb: "1",
|
|
10491
|
+
as: "div",
|
|
10492
|
+
children: "Direção de Expansão"
|
|
10493
|
+
}), /* @__PURE__ */ jsxs("select", {
|
|
10494
|
+
value: n.containerExpansion || "vertical",
|
|
10495
|
+
onChange: (E) => _(n.id, { containerExpansion: E.target.value }),
|
|
10496
|
+
style: {
|
|
10497
|
+
width: "100%",
|
|
10498
|
+
padding: "6px",
|
|
10499
|
+
borderRadius: "4px",
|
|
10500
|
+
border: "1px solid var(--gray-6)",
|
|
10501
|
+
backgroundColor: "var(--color-panel-solid)",
|
|
10502
|
+
color: "var(--gray-12)",
|
|
10503
|
+
fontSize: "14px"
|
|
10504
|
+
},
|
|
10505
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
10506
|
+
value: "vertical",
|
|
10507
|
+
children: "Vertical (Altura Cresce)"
|
|
10508
|
+
}), /* @__PURE__ */ jsx("option", {
|
|
10509
|
+
value: "horizontal",
|
|
10510
|
+
children: "Horizontal (Largura Cresce)"
|
|
10511
|
+
})]
|
|
10512
|
+
})]
|
|
10513
|
+
}),
|
|
10514
|
+
/* @__PURE__ */ jsx(o$2, {
|
|
10515
|
+
size: "4",
|
|
10516
|
+
mb: "3"
|
|
10517
|
+
})
|
|
10518
|
+
] }),
|
|
10487
10519
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10488
10520
|
size: "1",
|
|
10489
10521
|
mb: "1",
|
|
@@ -11154,32 +11186,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
11154
11186
|
});
|
|
11155
11187
|
};
|
|
11156
11188
|
const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
11157
|
-
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({
|
|
11158
11190
|
open: !1,
|
|
11159
11191
|
prop: "",
|
|
11160
11192
|
value: ""
|
|
11161
|
-
}), [
|
|
11162
|
-
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;
|
|
11163
11195
|
if (_) {
|
|
11164
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
11165
|
-
|
|
11196
|
+
let E = _.selectionStart, O = _.selectionEnd, A = Xj;
|
|
11197
|
+
Zj(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
11166
11198
|
_.focus();
|
|
11167
11199
|
let O = E + n.length + 4;
|
|
11168
11200
|
_.setSelectionRange(O, O);
|
|
11169
11201
|
}, 0);
|
|
11170
|
-
} else
|
|
11171
|
-
},
|
|
11202
|
+
} else Zj((_) => _ + `{{${n}}}`);
|
|
11203
|
+
}, rM = (n) => {
|
|
11172
11204
|
E(_.id, { style: {
|
|
11173
11205
|
..._.style,
|
|
11174
11206
|
...n
|
|
11175
11207
|
} });
|
|
11176
|
-
},
|
|
11208
|
+
}, iM = () => {
|
|
11177
11209
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11178
11210
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
11179
|
-
},
|
|
11211
|
+
}, aM = () => {
|
|
11180
11212
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
11181
11213
|
n > 0 && M(n, 0);
|
|
11182
|
-
},
|
|
11214
|
+
}, oM = () => {
|
|
11183
11215
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
11184
11216
|
type: _.type,
|
|
11185
11217
|
content: _.content,
|
|
@@ -11189,7 +11221,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11189
11221
|
height: _.height,
|
|
11190
11222
|
style: _.style
|
|
11191
11223
|
});
|
|
11192
|
-
},
|
|
11224
|
+
}, sM = [
|
|
11193
11225
|
"#000000",
|
|
11194
11226
|
"#FFFFFF",
|
|
11195
11227
|
"#FF0000",
|
|
@@ -11199,12 +11231,36 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11199
11231
|
"#808080",
|
|
11200
11232
|
"#800080",
|
|
11201
11233
|
"transparent"
|
|
11202
|
-
],
|
|
11203
|
-
|
|
11234
|
+
], cM = (n, _) => {
|
|
11235
|
+
Uj({
|
|
11204
11236
|
open: !0,
|
|
11205
11237
|
prop: n,
|
|
11206
11238
|
value: _
|
|
11207
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);
|
|
11208
11264
|
};
|
|
11209
11265
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11210
11266
|
/* @__PURE__ */ jsx(s$4, {
|
|
@@ -11216,8 +11272,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11216
11272
|
direction: "column",
|
|
11217
11273
|
gap: "3",
|
|
11218
11274
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11219
|
-
value:
|
|
11220
|
-
onChange: (n) =>
|
|
11275
|
+
value: Jj,
|
|
11276
|
+
onChange: (n) => Yj(n.target.value),
|
|
11221
11277
|
placeholder: "Nome da camada..."
|
|
11222
11278
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11223
11279
|
gap: "3",
|
|
@@ -11228,7 +11284,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11228
11284
|
children: "Cancelar"
|
|
11229
11285
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11230
11286
|
onClick: () => {
|
|
11231
|
-
B(_.id,
|
|
11287
|
+
B(_.id, Jj), G(!1);
|
|
11232
11288
|
},
|
|
11233
11289
|
children: "Salvar"
|
|
11234
11290
|
})]
|
|
@@ -11238,7 +11294,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11238
11294
|
}),
|
|
11239
11295
|
/* @__PURE__ */ jsx(s$4, {
|
|
11240
11296
|
open: Z,
|
|
11241
|
-
onOpenChange:
|
|
11297
|
+
onOpenChange: Aj,
|
|
11242
11298
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11243
11299
|
style: { maxWidth: 450 },
|
|
11244
11300
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11246,9 +11302,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11246
11302
|
gap: "3",
|
|
11247
11303
|
children: [
|
|
11248
11304
|
/* @__PURE__ */ jsx(r, {
|
|
11249
|
-
ref:
|
|
11250
|
-
value:
|
|
11251
|
-
onChange: (n) =>
|
|
11305
|
+
ref: eM,
|
|
11306
|
+
value: Xj,
|
|
11307
|
+
onChange: (n) => Zj(n.target.value),
|
|
11252
11308
|
placeholder: "Digite o novo texto...",
|
|
11253
11309
|
style: { height: 100 }
|
|
11254
11310
|
}),
|
|
@@ -11266,7 +11322,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11266
11322
|
color: "blue",
|
|
11267
11323
|
variant: "surface",
|
|
11268
11324
|
style: { cursor: "pointer" },
|
|
11269
|
-
onClick: () =>
|
|
11325
|
+
onClick: () => nM(n.dataName),
|
|
11270
11326
|
children: n.name
|
|
11271
11327
|
}, n.dataName))
|
|
11272
11328
|
})]
|
|
@@ -11280,7 +11336,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11280
11336
|
children: "Cancelar"
|
|
11281
11337
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11282
11338
|
onClick: () => {
|
|
11283
|
-
E(_.id, { content:
|
|
11339
|
+
E(_.id, { content: Xj }), Aj(!1);
|
|
11284
11340
|
},
|
|
11285
11341
|
children: "Salvar"
|
|
11286
11342
|
})]
|
|
@@ -11290,8 +11346,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11290
11346
|
})
|
|
11291
11347
|
}),
|
|
11292
11348
|
/* @__PURE__ */ jsx(s$4, {
|
|
11293
|
-
open:
|
|
11294
|
-
onOpenChange:
|
|
11349
|
+
open: jj,
|
|
11350
|
+
onOpenChange: Mj,
|
|
11295
11351
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11296
11352
|
style: { maxWidth: 450 },
|
|
11297
11353
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11303,8 +11359,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11303
11359
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
11304
11360
|
}),
|
|
11305
11361
|
/* @__PURE__ */ jsx(u$1, {
|
|
11306
|
-
value:
|
|
11307
|
-
onChange: (n) =>
|
|
11362
|
+
value: Qj,
|
|
11363
|
+
onChange: (n) => $j(n.target.value),
|
|
11308
11364
|
placeholder: "propriedade"
|
|
11309
11365
|
}),
|
|
11310
11366
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -11315,10 +11371,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11315
11371
|
color: "gray",
|
|
11316
11372
|
children: "Cancelar"
|
|
11317
11373
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11318
|
-
onClick:
|
|
11319
|
-
let n = aM, O = { dataBinding: n };
|
|
11320
|
-
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O), zj(!1);
|
|
11321
|
-
},
|
|
11374
|
+
onClick: mM,
|
|
11322
11375
|
children: "Vincular"
|
|
11323
11376
|
})]
|
|
11324
11377
|
})
|
|
@@ -11327,8 +11380,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11327
11380
|
})
|
|
11328
11381
|
}),
|
|
11329
11382
|
/* @__PURE__ */ jsx(s$4, {
|
|
11330
|
-
open:
|
|
11331
|
-
onOpenChange: (n) =>
|
|
11383
|
+
open: Hj.open,
|
|
11384
|
+
onOpenChange: (n) => Uj((_) => ({
|
|
11332
11385
|
..._,
|
|
11333
11386
|
open: n
|
|
11334
11387
|
})),
|
|
@@ -11337,8 +11390,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11337
11390
|
children: [
|
|
11338
11391
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
11339
11392
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
11340
|
-
color:
|
|
11341
|
-
onChange: (n) =>
|
|
11393
|
+
color: Hj.value,
|
|
11394
|
+
onChange: (n) => Uj((_) => ({
|
|
11342
11395
|
..._,
|
|
11343
11396
|
value: n
|
|
11344
11397
|
}))
|
|
@@ -11352,12 +11405,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11352
11405
|
color: "gray",
|
|
11353
11406
|
children: "Cancelar"
|
|
11354
11407
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11355
|
-
onClick:
|
|
11356
|
-
uM({ [Yj.prop]: Yj.value }), Xj((n) => ({
|
|
11357
|
-
...n,
|
|
11358
|
-
open: !1
|
|
11359
|
-
}));
|
|
11360
|
-
},
|
|
11408
|
+
onClick: lM,
|
|
11361
11409
|
children: "Aplicar"
|
|
11362
11410
|
})]
|
|
11363
11411
|
})
|
|
@@ -11366,21 +11414,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11366
11414
|
}),
|
|
11367
11415
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
11368
11416
|
elementId: _.id,
|
|
11369
|
-
open:
|
|
11370
|
-
onOpenChange:
|
|
11371
|
-
initialTab:
|
|
11417
|
+
open: Fj,
|
|
11418
|
+
onOpenChange: Ij,
|
|
11419
|
+
initialTab: Lj
|
|
11372
11420
|
}),
|
|
11373
11421
|
/* @__PURE__ */ jsx(s$4, {
|
|
11374
|
-
open:
|
|
11375
|
-
onOpenChange:
|
|
11422
|
+
open: Wj,
|
|
11423
|
+
onOpenChange: Gj,
|
|
11376
11424
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11377
11425
|
style: { maxWidth: 450 },
|
|
11378
11426
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Inserir URL da Imagem" }), /* @__PURE__ */ jsxs(p$1, {
|
|
11379
11427
|
direction: "column",
|
|
11380
11428
|
gap: "3",
|
|
11381
11429
|
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11382
|
-
value:
|
|
11383
|
-
onChange: (n) =>
|
|
11430
|
+
value: Kj,
|
|
11431
|
+
onChange: (n) => qj(n.target.value),
|
|
11384
11432
|
placeholder: "https://exemplo.com/imagem.png"
|
|
11385
11433
|
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11386
11434
|
gap: "3",
|
|
@@ -11390,9 +11438,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11390
11438
|
color: "gray",
|
|
11391
11439
|
children: "Cancelar"
|
|
11392
11440
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
11393
|
-
onClick:
|
|
11394
|
-
E(_.id, { content: $j }), Qj(!1);
|
|
11395
|
-
},
|
|
11441
|
+
onClick: fM,
|
|
11396
11442
|
children: "Aplicar"
|
|
11397
11443
|
})]
|
|
11398
11444
|
})]
|
|
@@ -11401,23 +11447,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11401
11447
|
}),
|
|
11402
11448
|
/* @__PURE__ */ jsx("input", {
|
|
11403
11449
|
type: "file",
|
|
11404
|
-
ref:
|
|
11450
|
+
ref: tM,
|
|
11405
11451
|
style: { display: "none" },
|
|
11406
11452
|
accept: "image/*",
|
|
11407
|
-
onChange:
|
|
11408
|
-
let O = n.target.files?.[0];
|
|
11409
|
-
if (O) {
|
|
11410
|
-
let n = new FileReader();
|
|
11411
|
-
n.onload = (n) => {
|
|
11412
|
-
n.target?.result && E(_.id, { content: n.target.result });
|
|
11413
|
-
}, n.readAsDataURL(O);
|
|
11414
|
-
}
|
|
11415
|
-
}
|
|
11453
|
+
onChange: uM
|
|
11416
11454
|
}),
|
|
11417
11455
|
/* @__PURE__ */ jsxs(Root2$3, { children: [/* @__PURE__ */ jsx(Trigger$3, {
|
|
11418
11456
|
asChild: !0,
|
|
11419
11457
|
children: /* @__PURE__ */ jsx("div", {
|
|
11420
11458
|
style: { display: "contents" },
|
|
11459
|
+
onDoubleClick: (n) => {
|
|
11460
|
+
(_.type === "text" || _.type === "text-container") && (n.stopPropagation(), hM());
|
|
11461
|
+
},
|
|
11421
11462
|
children: n
|
|
11422
11463
|
})
|
|
11423
11464
|
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(Content2$2, {
|
|
@@ -11453,7 +11494,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11453
11494
|
className: "ContextMenuItem",
|
|
11454
11495
|
onSelect: () => {
|
|
11455
11496
|
let O = { dataBinding: n.dataName };
|
|
11456
|
-
_.type === "text" && (O.content = `{{${n.dataName}}}`), E(_.id, O);
|
|
11497
|
+
(_.type === "text" || _.type === "text-container") && (O.content = `{{${n.dataName}}}`), E(_.id, O);
|
|
11457
11498
|
},
|
|
11458
11499
|
children: [
|
|
11459
11500
|
n.name,
|
|
@@ -11466,9 +11507,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11466
11507
|
}, n.dataName)), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11467
11508
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11468
11509
|
className: "ContextMenuItem",
|
|
11469
|
-
onSelect:
|
|
11470
|
-
oM(_.dataBinding || ""), zj(!0);
|
|
11471
|
-
},
|
|
11510
|
+
onSelect: pM,
|
|
11472
11511
|
children: "Outro / Manual..."
|
|
11473
11512
|
}),
|
|
11474
11513
|
_.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }), /* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11482,15 +11521,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11482
11521
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11483
11522
|
_.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11484
11523
|
className: "ContextMenuItem",
|
|
11485
|
-
onSelect:
|
|
11486
|
-
iM(_.content), Lj(!0);
|
|
11487
|
-
},
|
|
11524
|
+
onSelect: hM,
|
|
11488
11525
|
children: "Editar Texto..."
|
|
11489
11526
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
11490
11527
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11491
11528
|
className: "ContextMenuItem",
|
|
11492
11529
|
onSelect: () => {
|
|
11493
|
-
|
|
11530
|
+
Yj(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11494
11531
|
},
|
|
11495
11532
|
children: "Renomear..."
|
|
11496
11533
|
}),
|
|
@@ -11507,13 +11544,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11507
11544
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11508
11545
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11509
11546
|
className: "ContextMenuItem",
|
|
11510
|
-
onSelect: () =>
|
|
11547
|
+
onSelect: () => Ij(!0),
|
|
11511
11548
|
children: "Configurações Avançadas..."
|
|
11512
11549
|
}),
|
|
11513
11550
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11514
11551
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11515
11552
|
className: "ContextMenuItem",
|
|
11516
|
-
onSelect:
|
|
11553
|
+
onSelect: oM,
|
|
11517
11554
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
11518
11555
|
}),
|
|
11519
11556
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -11537,13 +11574,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11537
11574
|
alignOffset: -5,
|
|
11538
11575
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11539
11576
|
className: "ContextMenuItem",
|
|
11540
|
-
onSelect: () =>
|
|
11577
|
+
onSelect: () => tM.current?.click(),
|
|
11541
11578
|
children: "Carregar do Computador"
|
|
11542
11579
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11543
11580
|
className: "ContextMenuItem",
|
|
11544
|
-
onSelect:
|
|
11545
|
-
eM(typeof _.content == "string" ? _.content : ""), Qj(!0);
|
|
11546
|
-
},
|
|
11581
|
+
onSelect: dM,
|
|
11547
11582
|
children: "Inserir URL"
|
|
11548
11583
|
})]
|
|
11549
11584
|
}) })] }),
|
|
@@ -11560,17 +11595,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11560
11595
|
children: [
|
|
11561
11596
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11562
11597
|
className: "ContextMenuItem",
|
|
11563
|
-
onSelect: () =>
|
|
11598
|
+
onSelect: () => rM({ objectFit: "cover" }),
|
|
11564
11599
|
children: "Preencher (Cover)"
|
|
11565
11600
|
}),
|
|
11566
11601
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11567
11602
|
className: "ContextMenuItem",
|
|
11568
|
-
onSelect: () =>
|
|
11603
|
+
onSelect: () => rM({ objectFit: "contain" }),
|
|
11569
11604
|
children: "Ajustar (Contain)"
|
|
11570
11605
|
}),
|
|
11571
11606
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11572
11607
|
className: "ContextMenuItem",
|
|
11573
|
-
onSelect: () =>
|
|
11608
|
+
onSelect: () => rM({ objectFit: "fill" }),
|
|
11574
11609
|
children: "Esticar (Fill)"
|
|
11575
11610
|
})
|
|
11576
11611
|
]
|
|
@@ -11589,11 +11624,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11589
11624
|
alignOffset: -5,
|
|
11590
11625
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11591
11626
|
className: "ContextMenuItem",
|
|
11592
|
-
onSelect:
|
|
11627
|
+
onSelect: iM,
|
|
11593
11628
|
children: "Trazer para frente"
|
|
11594
11629
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11595
11630
|
className: "ContextMenuItem",
|
|
11596
|
-
onSelect:
|
|
11631
|
+
onSelect: aM,
|
|
11597
11632
|
children: "Enviar para trás"
|
|
11598
11633
|
})]
|
|
11599
11634
|
}) })] }),
|
|
@@ -11611,7 +11646,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11611
11646
|
alignOffset: -5,
|
|
11612
11647
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11613
11648
|
className: "ContextMenuItem",
|
|
11614
|
-
onSelect: () =>
|
|
11649
|
+
onSelect: () => rM({ fontFamily: n }),
|
|
11615
11650
|
style: { fontFamily: n },
|
|
11616
11651
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
11617
11652
|
className: "RightSlot",
|
|
@@ -11640,7 +11675,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11640
11675
|
64
|
|
11641
11676
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11642
11677
|
className: "ContextMenuItem",
|
|
11643
|
-
onSelect: () =>
|
|
11678
|
+
onSelect: () => rM({ fontSize: `${n}px` }),
|
|
11644
11679
|
children: [n, "px"]
|
|
11645
11680
|
}, n))
|
|
11646
11681
|
}) })] }),
|
|
@@ -11655,9 +11690,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11655
11690
|
sideOffset: 2,
|
|
11656
11691
|
alignOffset: -5,
|
|
11657
11692
|
children: [
|
|
11658
|
-
|
|
11693
|
+
sM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11659
11694
|
className: "ContextMenuItem",
|
|
11660
|
-
onSelect: () =>
|
|
11695
|
+
onSelect: () => rM({ color: n }),
|
|
11661
11696
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11662
11697
|
width: 12,
|
|
11663
11698
|
height: 12,
|
|
@@ -11669,7 +11704,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11669
11704
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11670
11705
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11671
11706
|
className: "ContextMenuItem",
|
|
11672
|
-
onSelect: () =>
|
|
11707
|
+
onSelect: () => cM("color", _.style?.color || "#000000"),
|
|
11673
11708
|
children: "Outra Cor..."
|
|
11674
11709
|
})
|
|
11675
11710
|
]
|
|
@@ -11686,11 +11721,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11686
11721
|
alignOffset: -5,
|
|
11687
11722
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
11688
11723
|
className: "ContextMenuItem",
|
|
11689
|
-
onSelect: () =>
|
|
11724
|
+
onSelect: () => rM({ fontWeight: "normal" }),
|
|
11690
11725
|
children: "Normal"
|
|
11691
11726
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
11692
11727
|
className: "ContextMenuItem",
|
|
11693
|
-
onSelect: () =>
|
|
11728
|
+
onSelect: () => rM({ fontWeight: "bold" }),
|
|
11694
11729
|
children: "Negrito"
|
|
11695
11730
|
})]
|
|
11696
11731
|
}) })] }),
|
|
@@ -11707,17 +11742,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11707
11742
|
children: [
|
|
11708
11743
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11709
11744
|
className: "ContextMenuItem",
|
|
11710
|
-
onSelect: () =>
|
|
11745
|
+
onSelect: () => rM({ textAlign: "left" }),
|
|
11711
11746
|
children: "Esquerda"
|
|
11712
11747
|
}),
|
|
11713
11748
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11714
11749
|
className: "ContextMenuItem",
|
|
11715
|
-
onSelect: () =>
|
|
11750
|
+
onSelect: () => rM({ textAlign: "center" }),
|
|
11716
11751
|
children: "Centro"
|
|
11717
11752
|
}),
|
|
11718
11753
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11719
11754
|
className: "ContextMenuItem",
|
|
11720
|
-
onSelect: () =>
|
|
11755
|
+
onSelect: () => rM({ textAlign: "right" }),
|
|
11721
11756
|
children: "Direita"
|
|
11722
11757
|
})
|
|
11723
11758
|
]
|
|
@@ -11735,7 +11770,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11735
11770
|
children: [
|
|
11736
11771
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11737
11772
|
className: "ContextMenuItem",
|
|
11738
|
-
onSelect: () =>
|
|
11773
|
+
onSelect: () => rM({
|
|
11739
11774
|
display: "flex",
|
|
11740
11775
|
flexDirection: "column",
|
|
11741
11776
|
justifyContent: "flex-start"
|
|
@@ -11744,7 +11779,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11744
11779
|
}),
|
|
11745
11780
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11746
11781
|
className: "ContextMenuItem",
|
|
11747
|
-
onSelect: () =>
|
|
11782
|
+
onSelect: () => rM({
|
|
11748
11783
|
display: "flex",
|
|
11749
11784
|
flexDirection: "column",
|
|
11750
11785
|
justifyContent: "center"
|
|
@@ -11753,7 +11788,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11753
11788
|
}),
|
|
11754
11789
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11755
11790
|
className: "ContextMenuItem",
|
|
11756
|
-
onSelect: () =>
|
|
11791
|
+
onSelect: () => rM({
|
|
11757
11792
|
display: "flex",
|
|
11758
11793
|
flexDirection: "column",
|
|
11759
11794
|
justifyContent: "flex-end"
|
|
@@ -11774,9 +11809,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11774
11809
|
sideOffset: 2,
|
|
11775
11810
|
alignOffset: -5,
|
|
11776
11811
|
children: [
|
|
11777
|
-
|
|
11812
|
+
sM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11778
11813
|
className: "ContextMenuItem",
|
|
11779
|
-
onSelect: () =>
|
|
11814
|
+
onSelect: () => rM({ backgroundColor: n }),
|
|
11780
11815
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
11781
11816
|
width: 12,
|
|
11782
11817
|
height: 12,
|
|
@@ -11788,7 +11823,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11788
11823
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11789
11824
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11790
11825
|
className: "ContextMenuItem",
|
|
11791
|
-
onSelect: () =>
|
|
11826
|
+
onSelect: () => cM("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
11792
11827
|
children: "Outra Cor..."
|
|
11793
11828
|
})
|
|
11794
11829
|
]
|
|
@@ -11814,14 +11849,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11814
11849
|
"50%"
|
|
11815
11850
|
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
11816
11851
|
className: "ContextMenuItem",
|
|
11817
|
-
onSelect: () =>
|
|
11852
|
+
onSelect: () => rM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
11818
11853
|
children: n === "50%" ? "Círculo" : `${n}px`
|
|
11819
11854
|
}, n)),
|
|
11820
11855
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11821
11856
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11822
11857
|
className: "ContextMenuItem",
|
|
11823
11858
|
onSelect: () => {
|
|
11824
|
-
|
|
11859
|
+
Vj("style"), Ij(!0);
|
|
11825
11860
|
},
|
|
11826
11861
|
children: "Personalizar..."
|
|
11827
11862
|
})
|
|
@@ -11848,14 +11883,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11848
11883
|
32
|
|
11849
11884
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11850
11885
|
className: "ContextMenuItem",
|
|
11851
|
-
onSelect: () =>
|
|
11886
|
+
onSelect: () => rM({ padding: `${n}px` }),
|
|
11852
11887
|
children: [n, "px"]
|
|
11853
11888
|
}, n)),
|
|
11854
11889
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11855
11890
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
11856
11891
|
className: "ContextMenuItem",
|
|
11857
11892
|
onSelect: () => {
|
|
11858
|
-
|
|
11893
|
+
Vj("style"), Ij(!0);
|
|
11859
11894
|
},
|
|
11860
11895
|
children: "Personalizar..."
|
|
11861
11896
|
})
|
|
@@ -11865,58 +11900,58 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11865
11900
|
}) })] })
|
|
11866
11901
|
] });
|
|
11867
11902
|
}, DraggableElement = React.memo(({ element: n, isSelected: _ }) => {
|
|
11868
|
-
let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), U = useRef({
|
|
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({
|
|
11869
11904
|
x: 0,
|
|
11870
11905
|
y: 0
|
|
11871
|
-
}),
|
|
11906
|
+
}), jj = useRef({}), Mj = useRef(!1), Fj = useRef(!1), Ij = useRef(0), Lj = useRef(0), Rj = useRef({
|
|
11872
11907
|
x: 0,
|
|
11873
11908
|
y: 0
|
|
11874
|
-
}),
|
|
11875
|
-
if (
|
|
11876
|
-
if (n.type === "text")
|
|
11877
|
-
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()];
|
|
11878
11913
|
return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
|
|
11879
11914
|
});
|
|
11880
11915
|
else if (n.type === "image") if (n.dataBinding) {
|
|
11881
|
-
let _ =
|
|
11882
|
-
_ != null && (
|
|
11883
|
-
} else
|
|
11884
|
-
let E =
|
|
11916
|
+
let _ = Uj[n.dataBinding];
|
|
11917
|
+
_ != null && (Wj = String(_));
|
|
11918
|
+
} else Wj = Wj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
11919
|
+
let E = Uj[_.trim()];
|
|
11885
11920
|
return E == null ? n : String(E);
|
|
11886
11921
|
});
|
|
11887
11922
|
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
11888
|
-
let E =
|
|
11889
|
-
E != null && (
|
|
11890
|
-
...
|
|
11923
|
+
let E = Uj[_];
|
|
11924
|
+
E != null && (Gj = {
|
|
11925
|
+
...Gj,
|
|
11891
11926
|
[n]: String(E)
|
|
11892
11927
|
});
|
|
11893
11928
|
}), n.conditions && n.conditions.forEach((n) => {
|
|
11894
|
-
let _ =
|
|
11895
|
-
checkCondition(_, n.operator, n.value) && (
|
|
11896
|
-
...
|
|
11929
|
+
let _ = Uj[n.property];
|
|
11930
|
+
checkCondition(_, n.operator, n.value) && (Gj = {
|
|
11931
|
+
...Gj,
|
|
11897
11932
|
...n.style
|
|
11898
11933
|
});
|
|
11899
11934
|
});
|
|
11900
11935
|
}
|
|
11901
|
-
let
|
|
11902
|
-
if (
|
|
11903
|
-
let { display: n, ..._ } =
|
|
11904
|
-
|
|
11936
|
+
let Kj = Gj.display === "none";
|
|
11937
|
+
if (Kj && _) {
|
|
11938
|
+
let { display: n, ..._ } = Gj;
|
|
11939
|
+
Gj = _;
|
|
11905
11940
|
}
|
|
11906
|
-
let
|
|
11907
|
-
_.stopPropagation(), !
|
|
11908
|
-
},
|
|
11941
|
+
let qj = (_) => {
|
|
11942
|
+
_.stopPropagation(), !Mj.current && !Fj.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
11943
|
+
}, Jj = (O) => {
|
|
11909
11944
|
if (O.button !== 0) return;
|
|
11910
11945
|
O.stopPropagation();
|
|
11911
11946
|
let A = O.shiftKey;
|
|
11912
|
-
if (
|
|
11947
|
+
if (Mj.current = !1, Fj.current = !1, n.groupId && !_) {
|
|
11913
11948
|
E(n.groupId, A);
|
|
11914
11949
|
return;
|
|
11915
11950
|
}
|
|
11916
|
-
_ || (E(n.id, A),
|
|
11951
|
+
_ || (E(n.id, A), Fj.current = !0), z(!0), Aj.current = {
|
|
11917
11952
|
x: O.clientX,
|
|
11918
11953
|
y: O.clientY
|
|
11919
|
-
};
|
|
11954
|
+
}, O.currentTarget.setPointerCapture(O.pointerId);
|
|
11920
11955
|
let M = new Set(j.selectedElementIds);
|
|
11921
11956
|
_ || (A || M.clear(), M.add(n.id));
|
|
11922
11957
|
let N = {};
|
|
@@ -11925,90 +11960,107 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11925
11960
|
x: n.x,
|
|
11926
11961
|
y: n.y
|
|
11927
11962
|
});
|
|
11928
|
-
}),
|
|
11929
|
-
},
|
|
11930
|
-
|
|
11963
|
+
}), jj.current = N;
|
|
11964
|
+
}, Yj = (_) => {
|
|
11965
|
+
if (P) {
|
|
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]) => {
|
|
11969
|
+
let A = E.x + O, N = E.y + M;
|
|
11970
|
+
if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
|
|
11971
|
+
else {
|
|
11972
|
+
let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
|
|
11973
|
+
Object.keys(jj.current).length === 1 && j.elements.forEach((n) => {
|
|
11974
|
+
if (n.id === _) return;
|
|
11975
|
+
let j = n.width ?? 100, H = n.height ?? 100;
|
|
11976
|
+
E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
|
|
11977
|
+
orientation: "vertical",
|
|
11978
|
+
position: n.x
|
|
11979
|
+
})) : Math.abs(A - (n.x + j)) < P ? (A = n.x + j, E = !0, z.push({
|
|
11980
|
+
orientation: "vertical",
|
|
11981
|
+
position: n.x + j
|
|
11982
|
+
})) : Math.abs(A + M - n.x) < P ? (A = n.x - M, E = !0, z.push({
|
|
11983
|
+
orientation: "vertical",
|
|
11984
|
+
position: n.x
|
|
11985
|
+
})) : Math.abs(A + M - (n.x + j)) < P && (A = n.x + j - M, E = !0, z.push({
|
|
11986
|
+
orientation: "vertical",
|
|
11987
|
+
position: n.x + j
|
|
11988
|
+
}))), O || (Math.abs(N - n.y) < P ? (N = n.y, O = !0, z.push({
|
|
11989
|
+
orientation: "horizontal",
|
|
11990
|
+
position: n.y
|
|
11991
|
+
})) : Math.abs(N - (n.y + H)) < P ? (N = n.y + H, O = !0, z.push({
|
|
11992
|
+
orientation: "horizontal",
|
|
11993
|
+
position: n.y + H
|
|
11994
|
+
})) : Math.abs(N + B - n.y) < P ? (N = n.y - B, O = !0, z.push({
|
|
11995
|
+
orientation: "horizontal",
|
|
11996
|
+
position: n.y
|
|
11997
|
+
})) : Math.abs(N + B - (n.y + H)) < P && (N = n.y + H - B, O = !0, z.push({
|
|
11998
|
+
orientation: "horizontal",
|
|
11999
|
+
position: n.y + H
|
|
12000
|
+
})));
|
|
12001
|
+
});
|
|
12002
|
+
}
|
|
12003
|
+
return j.isList && (N = Math.max(0, N)), {
|
|
12004
|
+
id: _,
|
|
12005
|
+
changes: {
|
|
12006
|
+
x: A,
|
|
12007
|
+
y: N
|
|
12008
|
+
}
|
|
12009
|
+
};
|
|
12010
|
+
});
|
|
12011
|
+
N && N(z), A(B, !1);
|
|
12012
|
+
}
|
|
12013
|
+
}, Xj = (n) => {
|
|
12014
|
+
P && (z(!1), n.currentTarget.releasePointerCapture(n.pointerId), A([], !0), N && N([]));
|
|
12015
|
+
}, Zj = (_) => {
|
|
12016
|
+
_.stopPropagation(), _.preventDefault(), G(!0);
|
|
11931
12017
|
let E = _.target.closest(".resizable-element");
|
|
11932
12018
|
if (E) {
|
|
11933
12019
|
let O = E.getBoundingClientRect();
|
|
11934
|
-
|
|
12020
|
+
Rj.current = {
|
|
11935
12021
|
x: O.left + O.width / 2,
|
|
11936
12022
|
y: O.top + O.height / 2
|
|
11937
12023
|
};
|
|
11938
|
-
let A = _.clientX -
|
|
11939
|
-
|
|
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;
|
|
11940
12026
|
}
|
|
11941
12027
|
};
|
|
11942
12028
|
useEffect(() => {
|
|
11943
12029
|
let _ = (_) => {
|
|
11944
|
-
if (
|
|
11945
|
-
let E =
|
|
11946
|
-
(Math.abs(O) > 2 || Math.abs(M) > 2) && (Z.current = !0);
|
|
11947
|
-
let P = 5 / E, z = [], B = Object.entries(G.current).map(([_, E]) => {
|
|
11948
|
-
let A = E.x + O, N = E.y + M;
|
|
11949
|
-
if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
|
|
11950
|
-
else {
|
|
11951
|
-
let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
|
|
11952
|
-
Object.keys(G.current).length === 1 && j.elements.forEach((n) => {
|
|
11953
|
-
if (n.id === _) return;
|
|
11954
|
-
let j = n.width ?? 100, H = n.height ?? 100;
|
|
11955
|
-
E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
|
|
11956
|
-
orientation: "vertical",
|
|
11957
|
-
position: n.x
|
|
11958
|
-
})) : Math.abs(A - (n.x + j)) < P ? (A = n.x + j, E = !0, z.push({
|
|
11959
|
-
orientation: "vertical",
|
|
11960
|
-
position: n.x + j
|
|
11961
|
-
})) : Math.abs(A + M - n.x) < P ? (A = n.x - M, E = !0, z.push({
|
|
11962
|
-
orientation: "vertical",
|
|
11963
|
-
position: n.x
|
|
11964
|
-
})) : Math.abs(A + M - (n.x + j)) < P && (A = n.x + j - M, E = !0, z.push({
|
|
11965
|
-
orientation: "vertical",
|
|
11966
|
-
position: n.x + j
|
|
11967
|
-
}))), O || (Math.abs(N - n.y) < P ? (N = n.y, O = !0, z.push({
|
|
11968
|
-
orientation: "horizontal",
|
|
11969
|
-
position: n.y
|
|
11970
|
-
})) : Math.abs(N - (n.y + H)) < P ? (N = n.y + H, O = !0, z.push({
|
|
11971
|
-
orientation: "horizontal",
|
|
11972
|
-
position: n.y + H
|
|
11973
|
-
})) : Math.abs(N + B - n.y) < P ? (N = n.y - B, O = !0, z.push({
|
|
11974
|
-
orientation: "horizontal",
|
|
11975
|
-
position: n.y
|
|
11976
|
-
})) : Math.abs(N + B - (n.y + H)) < P && (N = n.y + H - B, O = !0, z.push({
|
|
11977
|
-
orientation: "horizontal",
|
|
11978
|
-
position: n.y + H
|
|
11979
|
-
})));
|
|
11980
|
-
});
|
|
11981
|
-
}
|
|
11982
|
-
return j.isList && (N = Math.max(0, N)), {
|
|
11983
|
-
id: _,
|
|
11984
|
-
changes: {
|
|
11985
|
-
x: A,
|
|
11986
|
-
y: N
|
|
11987
|
-
}
|
|
11988
|
-
};
|
|
11989
|
-
});
|
|
11990
|
-
N && N(z), A(B, !1);
|
|
11991
|
-
}
|
|
11992
|
-
if (B) {
|
|
11993
|
-
let E = _.clientX - Hj.current.x, A = _.clientY - Hj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Rj.current, M = (zj.current + j) % 360;
|
|
12030
|
+
if (U) {
|
|
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;
|
|
11994
12032
|
O(n.id, { rotation: M }, !1);
|
|
11995
12033
|
}
|
|
11996
12034
|
}, E = () => {
|
|
11997
|
-
|
|
12035
|
+
U && (G(!1), O(n.id, { rotation: n.rotation }, !0));
|
|
11998
12036
|
};
|
|
11999
|
-
return
|
|
12037
|
+
return U && (window.addEventListener("mousemove", _), window.addEventListener("mouseup", E)), () => {
|
|
12000
12038
|
window.removeEventListener("mousemove", _), window.removeEventListener("mouseup", E);
|
|
12001
12039
|
};
|
|
12002
12040
|
}, [
|
|
12003
|
-
|
|
12004
|
-
B,
|
|
12041
|
+
U,
|
|
12005
12042
|
n.id,
|
|
12006
12043
|
O,
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12044
|
+
n.rotation
|
|
12045
|
+
]), useEffect(() => {
|
|
12046
|
+
n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" && requestAnimationFrame(() => {
|
|
12047
|
+
if (Z.current) {
|
|
12048
|
+
let _ = Z.current.scrollWidth;
|
|
12049
|
+
Math.abs(_ - (n.width ?? 0)) > 2 && O(n.id, { width: _ }, !1);
|
|
12050
|
+
}
|
|
12051
|
+
});
|
|
12052
|
+
}, [
|
|
12053
|
+
Wj,
|
|
12054
|
+
n.autoGrow,
|
|
12055
|
+
n.containerExpansion,
|
|
12056
|
+
n.style,
|
|
12057
|
+
n.width,
|
|
12058
|
+
n.formatting,
|
|
12059
|
+
O,
|
|
12060
|
+
n.id,
|
|
12061
|
+
n.type
|
|
12010
12062
|
]);
|
|
12011
|
-
let
|
|
12063
|
+
let Qj = {
|
|
12012
12064
|
position: "absolute",
|
|
12013
12065
|
left: 0,
|
|
12014
12066
|
top: 0,
|
|
@@ -12016,8 +12068,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12016
12068
|
height: n.autoGrow ? "auto" : "100%",
|
|
12017
12069
|
minHeight: n.autoGrow ? "100%" : void 0,
|
|
12018
12070
|
padding: n.type === "image" || n.type === "text" ? 0 : "8px",
|
|
12019
|
-
border: _ ? "2px solid var(--accent-9)" : "1px dashed transparent",
|
|
12020
|
-
outline: _ ? "none" : "1px solid transparent",
|
|
12071
|
+
border: _ || B ? "2px solid var(--accent-9)" : "1px dashed transparent",
|
|
12072
|
+
outline: _ || B ? "none" : "1px solid transparent",
|
|
12021
12073
|
cursor: P ? "grabbing" : "grab",
|
|
12022
12074
|
borderRadius: "var(--radius-2)",
|
|
12023
12075
|
overflow: n.autoGrow ? "visible" : "hidden",
|
|
@@ -12025,7 +12077,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12025
12077
|
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
12026
12078
|
userSelect: "none",
|
|
12027
12079
|
...n.style,
|
|
12028
|
-
...
|
|
12080
|
+
...Gj
|
|
12029
12081
|
};
|
|
12030
12082
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
12031
12083
|
className: "resizable-element",
|
|
@@ -12033,11 +12085,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12033
12085
|
width: n.width ?? 100,
|
|
12034
12086
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
12035
12087
|
},
|
|
12036
|
-
maxHeight: j.isList ? Math.max(10,
|
|
12088
|
+
maxHeight: j.isList ? Math.max(10, Hj - n.y) : void 0,
|
|
12037
12089
|
onResizeStart: (n) => {
|
|
12038
|
-
|
|
12090
|
+
H(!0), Vj.current = !!n.shiftKey;
|
|
12039
12091
|
},
|
|
12040
12092
|
onResizeStop: (_, E, A, j) => {
|
|
12093
|
+
H(!1);
|
|
12041
12094
|
let N = (n.width ?? 100) + j.width, P = (n.height ?? 100) + j.height;
|
|
12042
12095
|
n.type === "group" ? M(n.id, N, P) : O(n.id, {
|
|
12043
12096
|
width: N,
|
|
@@ -12048,8 +12101,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12048
12101
|
position: "absolute",
|
|
12049
12102
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
12050
12103
|
height: n.autoGrow ? "auto" : void 0,
|
|
12051
|
-
display:
|
|
12052
|
-
opacity:
|
|
12104
|
+
display: Kj && !_ ? "none" : void 0,
|
|
12105
|
+
opacity: Kj && _ ? .4 : 1,
|
|
12106
|
+
zIndex: _ ? 1e3 : void 0,
|
|
12107
|
+
outline: _ ? "1px dashed var(--accent-9)" : void 0
|
|
12053
12108
|
},
|
|
12054
12109
|
enable: _ && !n.autoGrow ? void 0 : {
|
|
12055
12110
|
top: !1,
|
|
@@ -12061,7 +12116,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12061
12116
|
bottomLeft: !1,
|
|
12062
12117
|
topLeft: !1
|
|
12063
12118
|
},
|
|
12064
|
-
lockAspectRatio:
|
|
12119
|
+
lockAspectRatio: Vj.current === !0,
|
|
12065
12120
|
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
12066
12121
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
12067
12122
|
element: n,
|
|
@@ -12072,9 +12127,20 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12072
12127
|
position: "relative"
|
|
12073
12128
|
},
|
|
12074
12129
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12130
|
+
ref: Z,
|
|
12131
|
+
style: {
|
|
12132
|
+
...Qj,
|
|
12133
|
+
whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : Qj.whiteSpace,
|
|
12134
|
+
width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : "100%",
|
|
12135
|
+
height: n.type === "text-container" && n.autoGrow && n.containerExpansion === "vertical" ? "auto" : "100%"
|
|
12136
|
+
},
|
|
12137
|
+
onPointerDown: Jj,
|
|
12138
|
+
onPointerMove: Yj,
|
|
12139
|
+
onPointerUp: Xj,
|
|
12140
|
+
onMouseDown: (n) => {
|
|
12141
|
+
n.button === 0 && n.stopPropagation();
|
|
12142
|
+
},
|
|
12143
|
+
onClick: qj,
|
|
12078
12144
|
title: n.name,
|
|
12079
12145
|
onMouseEnter: (n) => {
|
|
12080
12146
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
@@ -12088,10 +12154,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12088
12154
|
width: "100%",
|
|
12089
12155
|
height: "100%"
|
|
12090
12156
|
},
|
|
12091
|
-
children:
|
|
12157
|
+
children: Wj
|
|
12158
|
+
}),
|
|
12159
|
+
n.type === "text-container" && /* @__PURE__ */ jsx(p$2, {
|
|
12160
|
+
style: {
|
|
12161
|
+
width: "100%",
|
|
12162
|
+
height: "100%",
|
|
12163
|
+
display: "block"
|
|
12164
|
+
},
|
|
12165
|
+
children: Wj
|
|
12092
12166
|
}),
|
|
12093
|
-
n.type === "image" && (
|
|
12094
|
-
src:
|
|
12167
|
+
n.type === "image" && (Wj ? /* @__PURE__ */ jsx("img", {
|
|
12168
|
+
src: Wj,
|
|
12095
12169
|
alt: "Element",
|
|
12096
12170
|
style: {
|
|
12097
12171
|
width: "100%",
|
|
@@ -12156,7 +12230,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12156
12230
|
zIndex: 50,
|
|
12157
12231
|
boxShadow: "0 0 0 2px white"
|
|
12158
12232
|
},
|
|
12159
|
-
onMouseDown:
|
|
12233
|
+
onMouseDown: Zj,
|
|
12160
12234
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
12161
12235
|
position: "absolute",
|
|
12162
12236
|
top: 12,
|
|
@@ -12171,44 +12245,44 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12171
12245
|
})
|
|
12172
12246
|
});
|
|
12173
12247
|
}), Canvas = () => {
|
|
12174
|
-
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({
|
|
12175
12249
|
x: 0,
|
|
12176
12250
|
y: 0
|
|
12177
|
-
}),
|
|
12251
|
+
}), Lj = useRef({
|
|
12178
12252
|
x: 0,
|
|
12179
12253
|
y: 0
|
|
12180
|
-
}),
|
|
12181
|
-
if (E.button === 1 || E.button === 0 &&
|
|
12182
|
-
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 = {
|
|
12183
12257
|
x: E.clientX,
|
|
12184
12258
|
y: E.clientY
|
|
12185
12259
|
};
|
|
12186
12260
|
return;
|
|
12187
12261
|
}
|
|
12188
|
-
|
|
12262
|
+
jj.current = !0;
|
|
12189
12263
|
let O = G.current?.getBoundingClientRect();
|
|
12190
12264
|
if (!O) return;
|
|
12191
12265
|
let A = O.left, j = O.top;
|
|
12192
|
-
|
|
12266
|
+
Ij.current = {
|
|
12193
12267
|
x: (E.clientX - A - n.pan.x) / n.zoom,
|
|
12194
12268
|
y: (E.clientY - j - n.pan.y) / n.zoom
|
|
12195
|
-
},
|
|
12196
|
-
},
|
|
12269
|
+
}, Rj.current = n.selectedElementIds, E.shiftKey || (_(null), Rj.current = []), window.addEventListener("mousemove", Hj), window.addEventListener("mouseup", Uj);
|
|
12270
|
+
}, Hj = useCallback((_) => {
|
|
12197
12271
|
if (!G.current) return;
|
|
12198
|
-
if (
|
|
12199
|
-
let E = _.clientX -
|
|
12272
|
+
if (Mj.current) {
|
|
12273
|
+
let E = _.clientX - Lj.current.x, O = _.clientY - Lj.current.y;
|
|
12200
12274
|
j({
|
|
12201
12275
|
x: n.pan.x + E,
|
|
12202
12276
|
y: n.pan.y + O
|
|
12203
|
-
}),
|
|
12277
|
+
}), Lj.current = {
|
|
12204
12278
|
x: _.clientX,
|
|
12205
12279
|
y: _.clientY
|
|
12206
12280
|
};
|
|
12207
12281
|
return;
|
|
12208
12282
|
}
|
|
12209
|
-
if (!
|
|
12210
|
-
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(
|
|
12211
|
-
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({
|
|
12212
12286
|
x: N,
|
|
12213
12287
|
y: P,
|
|
12214
12288
|
width: z,
|
|
@@ -12218,7 +12292,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12218
12292
|
n.elements.forEach((n) => {
|
|
12219
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;
|
|
12220
12294
|
E < U && M > N && O < W && H > P && _.push(n.id);
|
|
12221
|
-
}), E(Array.from(new Set([...
|
|
12295
|
+
}), E(Array.from(new Set([...Rj.current, ..._])));
|
|
12222
12296
|
}
|
|
12223
12297
|
}, [
|
|
12224
12298
|
n.elements,
|
|
@@ -12226,9 +12300,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12226
12300
|
n.zoom,
|
|
12227
12301
|
E,
|
|
12228
12302
|
j
|
|
12229
|
-
]),
|
|
12230
|
-
|
|
12231
|
-
}, [
|
|
12303
|
+
]), Uj = useCallback(() => {
|
|
12304
|
+
jj.current = !1, Mj.current = !1, Aj(null), window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Uj);
|
|
12305
|
+
}, [Hj]), Wj = (_) => {
|
|
12232
12306
|
if (_.ctrlKey || _.metaKey) _.preventDefault(), A(Math.min(Math.max(.1, n.zoom - _.deltaY * .001), 5));
|
|
12233
12307
|
else {
|
|
12234
12308
|
let E = _.shiftKey ? _.deltaY : _.deltaX, O = _.shiftKey ? _.deltaX : _.deltaY;
|
|
@@ -12240,7 +12314,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12240
12314
|
};
|
|
12241
12315
|
useEffect(() => {
|
|
12242
12316
|
let _ = (_) => {
|
|
12243
|
-
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()), [
|
|
12244
12318
|
"ArrowUp",
|
|
12245
12319
|
"ArrowDown",
|
|
12246
12320
|
"ArrowLeft",
|
|
@@ -12263,10 +12337,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12263
12337
|
}), O.length > 0 && U(O);
|
|
12264
12338
|
}
|
|
12265
12339
|
}, E = (n) => {
|
|
12266
|
-
n.code === "Space" && (
|
|
12340
|
+
n.code === "Space" && (Fj.current = !1, G.current && !Mj.current && (G.current.style.cursor = "default"));
|
|
12267
12341
|
};
|
|
12268
12342
|
return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
|
|
12269
|
-
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);
|
|
12270
12344
|
};
|
|
12271
12345
|
}, [
|
|
12272
12346
|
M,
|
|
@@ -12277,24 +12351,24 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12277
12351
|
U,
|
|
12278
12352
|
n.selectedElementIds,
|
|
12279
12353
|
n.elements,
|
|
12280
|
-
|
|
12281
|
-
|
|
12354
|
+
Hj,
|
|
12355
|
+
Uj
|
|
12282
12356
|
]);
|
|
12283
|
-
let
|
|
12284
|
-
n.stopPropagation(), n.preventDefault(),
|
|
12285
|
-
},
|
|
12286
|
-
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;
|
|
12287
12361
|
let _ = G.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12288
|
-
|
|
12289
|
-
}, [
|
|
12290
|
-
|
|
12291
|
-
}, [
|
|
12362
|
+
Kj(Math.round(O));
|
|
12363
|
+
}, [Kj]), Yj = useCallback(() => {
|
|
12364
|
+
Gj.current = !1, window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
|
|
12365
|
+
}, [Jj]);
|
|
12292
12366
|
useEffect(() => () => {
|
|
12293
|
-
window.removeEventListener("mousemove",
|
|
12294
|
-
}, [
|
|
12295
|
-
let
|
|
12367
|
+
window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
|
|
12368
|
+
}, [Jj, Yj]);
|
|
12369
|
+
let Xj = (n) => {
|
|
12296
12370
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12297
|
-
},
|
|
12371
|
+
}, Zj = (n) => {
|
|
12298
12372
|
n.preventDefault();
|
|
12299
12373
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
12300
12374
|
if (_) {
|
|
@@ -12309,20 +12383,20 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12309
12383
|
dataBinding: _
|
|
12310
12384
|
});
|
|
12311
12385
|
}
|
|
12312
|
-
},
|
|
12386
|
+
}, Qj = n.canvasHeight || 150;
|
|
12313
12387
|
return /* @__PURE__ */ jsxs(p, {
|
|
12314
12388
|
ref: G,
|
|
12315
|
-
onMouseDown:
|
|
12316
|
-
onDragOver:
|
|
12317
|
-
onDrop:
|
|
12318
|
-
onWheel:
|
|
12389
|
+
onMouseDown: Vj,
|
|
12390
|
+
onDragOver: Xj,
|
|
12391
|
+
onDrop: Zj,
|
|
12392
|
+
onWheel: Wj,
|
|
12319
12393
|
style: {
|
|
12320
12394
|
width: "100%",
|
|
12321
12395
|
height: "100%",
|
|
12322
12396
|
position: "relative",
|
|
12323
12397
|
overflow: "hidden",
|
|
12324
12398
|
backgroundColor: "var(--color-background)",
|
|
12325
|
-
cursor:
|
|
12399
|
+
cursor: Mj.current ? "grabbing" : "default",
|
|
12326
12400
|
backgroundImage: "radial-gradient(var(--gray-5) 1px, transparent 1px)",
|
|
12327
12401
|
backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
|
|
12328
12402
|
backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
|
|
@@ -12371,7 +12445,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12371
12445
|
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
12372
12446
|
style: {
|
|
12373
12447
|
position: "absolute",
|
|
12374
|
-
top:
|
|
12448
|
+
top: Qj,
|
|
12375
12449
|
left: 0,
|
|
12376
12450
|
right: 0,
|
|
12377
12451
|
height: "10px",
|
|
@@ -12383,7 +12457,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12383
12457
|
justifyContent: "center",
|
|
12384
12458
|
group: "resize-handle"
|
|
12385
12459
|
},
|
|
12386
|
-
onMouseDown:
|
|
12460
|
+
onMouseDown: qj,
|
|
12387
12461
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12388
12462
|
width: "100%",
|
|
12389
12463
|
height: "2px",
|
|
@@ -12407,7 +12481,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12407
12481
|
},
|
|
12408
12482
|
children: [
|
|
12409
12483
|
"Altura do Item: ",
|
|
12410
|
-
|
|
12484
|
+
Qj,
|
|
12411
12485
|
"px"
|
|
12412
12486
|
]
|
|
12413
12487
|
})]
|
|
@@ -12486,22 +12560,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12486
12560
|
})]
|
|
12487
12561
|
});
|
|
12488
12562
|
}, EditorSettings = () => {
|
|
12489
|
-
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");
|
|
12490
12564
|
return useEffect(() => {
|
|
12491
12565
|
if (A) {
|
|
12492
|
-
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));
|
|
12493
12567
|
let _ = n.listSettings.entryAnimation;
|
|
12494
|
-
|
|
12568
|
+
Lj(_?.type || "slideIn"), Vj(_?.duration || .3), Uj(_?.timingFunction || "ease-out");
|
|
12495
12569
|
}
|
|
12496
12570
|
}, [A]), useEffect(() => {
|
|
12497
12571
|
if (!A) return;
|
|
12498
12572
|
let _ = parseInt(Z, 10);
|
|
12499
12573
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
12500
|
-
let j = parseInt(
|
|
12574
|
+
let j = parseInt(Nj, 10);
|
|
12501
12575
|
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
12502
12576
|
}, [
|
|
12503
12577
|
Z,
|
|
12504
|
-
|
|
12578
|
+
Nj,
|
|
12505
12579
|
A,
|
|
12506
12580
|
E,
|
|
12507
12581
|
O,
|
|
@@ -12680,7 +12754,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12680
12754
|
type: "number",
|
|
12681
12755
|
min: "10",
|
|
12682
12756
|
value: Z,
|
|
12683
|
-
onChange: (n) =>
|
|
12757
|
+
onChange: (n) => Aj(n.target.value)
|
|
12684
12758
|
}),
|
|
12685
12759
|
/* @__PURE__ */ jsx(p$2, {
|
|
12686
12760
|
size: "1",
|
|
@@ -12701,8 +12775,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12701
12775
|
type: "number",
|
|
12702
12776
|
min: "0",
|
|
12703
12777
|
placeholder: "Auto (100%)",
|
|
12704
|
-
value:
|
|
12705
|
-
onChange: (n) =>
|
|
12778
|
+
value: jj,
|
|
12779
|
+
onChange: (n) => Mj(n.target.value)
|
|
12706
12780
|
}),
|
|
12707
12781
|
/* @__PURE__ */ jsx(p$2, {
|
|
12708
12782
|
size: "1",
|
|
@@ -12728,8 +12802,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12728
12802
|
as: "div",
|
|
12729
12803
|
children: "Efeito"
|
|
12730
12804
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12731
|
-
value:
|
|
12732
|
-
onChange: (n) =>
|
|
12805
|
+
value: Ij,
|
|
12806
|
+
onChange: (n) => Lj(n.target.value),
|
|
12733
12807
|
style: {
|
|
12734
12808
|
width: "100%",
|
|
12735
12809
|
padding: "6px",
|
|
@@ -12791,8 +12865,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12791
12865
|
type: "number",
|
|
12792
12866
|
step: "0.1",
|
|
12793
12867
|
min: "0.1",
|
|
12794
|
-
value:
|
|
12795
|
-
onChange: (n) =>
|
|
12868
|
+
value: Rj,
|
|
12869
|
+
onChange: (n) => Vj(parseFloat(n.target.value) || .3)
|
|
12796
12870
|
})] }),
|
|
12797
12871
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
12798
12872
|
size: "1",
|
|
@@ -12800,8 +12874,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12800
12874
|
as: "div",
|
|
12801
12875
|
children: "Curva (Easing)"
|
|
12802
12876
|
}), /* @__PURE__ */ jsxs("select", {
|
|
12803
|
-
value:
|
|
12804
|
-
onChange: (n) =>
|
|
12877
|
+
value: Hj,
|
|
12878
|
+
onChange: (n) => Uj(n.target.value),
|
|
12805
12879
|
style: {
|
|
12806
12880
|
width: "100%",
|
|
12807
12881
|
padding: "6px",
|
|
@@ -12856,8 +12930,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12856
12930
|
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
12857
12931
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
12858
12932
|
type: "number",
|
|
12859
|
-
value:
|
|
12860
|
-
onChange: (n) =>
|
|
12933
|
+
value: Nj,
|
|
12934
|
+
onChange: (n) => Fj(n.target.value),
|
|
12861
12935
|
placeholder: "0"
|
|
12862
12936
|
})]
|
|
12863
12937
|
})
|
|
@@ -12876,11 +12950,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12876
12950
|
children: "Cancelar"
|
|
12877
12951
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
12878
12952
|
onClick: () => {
|
|
12879
|
-
let n = parseInt(
|
|
12880
|
-
type:
|
|
12881
|
-
duration: Number(
|
|
12953
|
+
let n = parseInt(jj, 10), E = {
|
|
12954
|
+
type: Ij,
|
|
12955
|
+
duration: Number(Rj),
|
|
12882
12956
|
delay: 0,
|
|
12883
|
-
timingFunction:
|
|
12957
|
+
timingFunction: Hj
|
|
12884
12958
|
};
|
|
12885
12959
|
_({
|
|
12886
12960
|
sortProp: M === "__none__" ? "" : M,
|
|
@@ -13044,13 +13118,13 @@ function createRenderBatcher(n, _) {
|
|
|
13044
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 = () => {
|
|
13045
13119
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
13046
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));
|
|
13047
|
-
},
|
|
13121
|
+
}, Aj = () => {
|
|
13048
13122
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
13049
13123
|
};
|
|
13050
13124
|
return {
|
|
13051
13125
|
schedule: stepsOrder.reduce((n, _) => {
|
|
13052
13126
|
let O = M[_];
|
|
13053
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
13127
|
+
return n[_] = (n, _ = !1, A = !1) => (E || Aj(), O.schedule(n, _, A)), n;
|
|
13054
13128
|
}, {}),
|
|
13055
13129
|
cancel: (n) => {
|
|
13056
13130
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -13408,40 +13482,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
13408
13482
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
13409
13483
|
...E,
|
|
13410
13484
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
13411
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
13412
|
-
O ||=
|
|
13413
|
-
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;
|
|
13414
13488
|
if (Z < 1) {
|
|
13415
|
-
let n = calcAngularFreq(
|
|
13416
|
-
|
|
13417
|
-
} 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);
|
|
13418
13492
|
else {
|
|
13419
|
-
let n =
|
|
13420
|
-
|
|
13421
|
-
let E = Math.exp(-Z *
|
|
13422
|
-
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;
|
|
13423
13497
|
};
|
|
13424
13498
|
}
|
|
13425
|
-
let
|
|
13499
|
+
let Pj = {
|
|
13426
13500
|
calculatedDuration: W && H || null,
|
|
13427
13501
|
next: (n) => {
|
|
13428
|
-
let _ =
|
|
13502
|
+
let _ = Nj(n);
|
|
13429
13503
|
if (W) N.done = n >= H;
|
|
13430
13504
|
else {
|
|
13431
13505
|
let E = n === 0 ? G : 0;
|
|
13432
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
13506
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Nj, n, _));
|
|
13433
13507
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
13434
13508
|
N.done = j && P;
|
|
13435
13509
|
}
|
|
13436
13510
|
return N.value = N.done ? M : _, N;
|
|
13437
13511
|
},
|
|
13438
13512
|
toString: () => {
|
|
13439
|
-
let n = Math.min(calcGeneratorDuration(
|
|
13513
|
+
let n = Math.min(calcGeneratorDuration(Pj), maxGeneratorDuration), _ = generateLinearEasing((_) => Pj.next(n * _).value, n, 30);
|
|
13440
13514
|
return n + "ms " + _;
|
|
13441
13515
|
},
|
|
13442
13516
|
toTransition: () => {}
|
|
13443
13517
|
};
|
|
13444
|
-
return
|
|
13518
|
+
return Pj;
|
|
13445
13519
|
}
|
|
13446
13520
|
spring.applyToOptions = (n) => {
|
|
13447
13521
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -13451,26 +13525,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
13451
13525
|
let H = n[0], U = {
|
|
13452
13526
|
done: !1,
|
|
13453
13527
|
value: H
|
|
13454
|
-
}, 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 * _,
|
|
13455
|
-
|
|
13456
|
-
let
|
|
13457
|
-
let _ =
|
|
13458
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
13459
|
-
},
|
|
13460
|
-
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({
|
|
13461
13535
|
keyframes: [U.value, G(U.value)],
|
|
13462
|
-
velocity: calcGeneratorVelocity(
|
|
13536
|
+
velocity: calcGeneratorVelocity(Nj, n, U.value),
|
|
13463
13537
|
damping: A,
|
|
13464
13538
|
stiffness: j,
|
|
13465
13539
|
restDelta: z,
|
|
13466
13540
|
restSpeed: B
|
|
13467
13541
|
}));
|
|
13468
13542
|
};
|
|
13469
|
-
return
|
|
13543
|
+
return Lj(0), {
|
|
13470
13544
|
calculatedDuration: null,
|
|
13471
13545
|
next: (n) => {
|
|
13472
13546
|
let _ = !1;
|
|
13473
|
-
return !
|
|
13547
|
+
return !Ij && Fj === void 0 && (_ = !0, Pj(n), Lj(n)), Fj !== void 0 && n >= Fj ? Ij.next(n - Fj) : (!_ && Pj(n), U);
|
|
13474
13548
|
}
|
|
13475
13549
|
};
|
|
13476
13550
|
}
|
|
@@ -13590,22 +13664,22 @@ var WithPromise = class {
|
|
|
13590
13664
|
if (this.startTime === null) return E.next(0);
|
|
13591
13665
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
13592
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);
|
|
13593
|
-
let
|
|
13594
|
-
this.currentTime = Math.max(
|
|
13595
|
-
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;
|
|
13596
13670
|
if (B) {
|
|
13597
13671
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
13598
|
-
!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;
|
|
13599
13673
|
}
|
|
13600
|
-
let
|
|
13674
|
+
let Pj = jj ? {
|
|
13601
13675
|
done: !1,
|
|
13602
13676
|
value: z[0]
|
|
13603
|
-
} :
|
|
13604
|
-
A && (
|
|
13605
|
-
let { done:
|
|
13606
|
-
!
|
|
13607
|
-
let
|
|
13608
|
-
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;
|
|
13609
13683
|
}
|
|
13610
13684
|
then(n, _) {
|
|
13611
13685
|
return this.finished.then(n, _);
|
|
@@ -14668,46 +14742,46 @@ function onlyElements(n) {
|
|
|
14668
14742
|
}), _;
|
|
14669
14743
|
}
|
|
14670
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 }) => {
|
|
14671
|
-
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);
|
|
14672
14746
|
useIsomorphicLayoutEffect(() => {
|
|
14673
14747
|
G.current = !1, Z.current = H;
|
|
14674
|
-
for (let n = 0; n <
|
|
14675
|
-
let _ = getChildKey(
|
|
14676
|
-
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);
|
|
14677
14751
|
}
|
|
14678
14752
|
}, [
|
|
14679
|
-
|
|
14753
|
+
Lj,
|
|
14680
14754
|
W.length,
|
|
14681
14755
|
W.join("-")
|
|
14682
14756
|
]);
|
|
14683
|
-
let
|
|
14684
|
-
if (H !==
|
|
14757
|
+
let Vj = [];
|
|
14758
|
+
if (H !== Fj) {
|
|
14685
14759
|
let n = [...H];
|
|
14686
|
-
for (let _ = 0; _ <
|
|
14687
|
-
let E =
|
|
14688
|
-
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));
|
|
14689
14763
|
}
|
|
14690
|
-
return j === "wait" &&
|
|
14764
|
+
return j === "wait" && Vj.length && (n = Vj), Bj(onlyElements(n)), Ij(H), null;
|
|
14691
14765
|
}
|
|
14692
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
14693
|
-
let { forceRender:
|
|
14694
|
-
return jsx(Fragment$1, { children:
|
|
14695
|
-
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);
|
|
14696
14770
|
return jsx(PresenceChild, {
|
|
14697
|
-
isPresent:
|
|
14771
|
+
isPresent: Mj,
|
|
14698
14772
|
initial: !G.current || E ? void 0 : !1,
|
|
14699
14773
|
custom: _,
|
|
14700
14774
|
presenceAffectsLayout: A,
|
|
14701
14775
|
mode: j,
|
|
14702
14776
|
root: P,
|
|
14703
|
-
onExitComplete:
|
|
14704
|
-
if (
|
|
14705
|
-
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);
|
|
14706
14780
|
else return;
|
|
14707
14781
|
let n = !0;
|
|
14708
|
-
|
|
14782
|
+
Aj.forEach((_) => {
|
|
14709
14783
|
_ || (n = !1);
|
|
14710
|
-
}), n && (
|
|
14784
|
+
}), n && (Hj?.(), Bj(Z.current), M && B?.(), O && O());
|
|
14711
14785
|
},
|
|
14712
14786
|
anchorX: N,
|
|
14713
14787
|
children: n
|
|
@@ -15136,12 +15210,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
15136
15210
|
useInsertionEffect(() => {
|
|
15137
15211
|
H && Z.current && H.update(E, P);
|
|
15138
15212
|
});
|
|
15139
|
-
let
|
|
15213
|
+
let jj = E[optimizedAppearDataAttribute], Mj = useRef(!!jj && !window.MotionHandoffIsComplete?.(jj) && window.MotionHasOptimisedAnimation?.(jj));
|
|
15140
15214
|
return useIsomorphicLayoutEffect(() => {
|
|
15141
|
-
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());
|
|
15142
15216
|
}), useEffect(() => {
|
|
15143
|
-
H && (!
|
|
15144
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
15217
|
+
H && (!Mj.current && H.animationState && H.animationState.animateChanges(), Mj.current &&= (queueMicrotask(() => {
|
|
15218
|
+
window.MotionHandoffMarkAsComplete?.(jj);
|
|
15145
15219
|
}), !1), H.enteringChildren = void 0);
|
|
15146
15220
|
}), H;
|
|
15147
15221
|
}
|
|
@@ -15819,34 +15893,34 @@ function createAnimationState(n) {
|
|
|
15819
15893
|
function M(j) {
|
|
15820
15894
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
15821
15895
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
15822
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
15823
|
-
|
|
15824
|
-
let
|
|
15825
|
-
if (
|
|
15826
|
-
let
|
|
15827
|
-
|
|
15828
|
-
let { prevResolvedValues:
|
|
15829
|
-
...
|
|
15830
|
-
...
|
|
15831
|
-
},
|
|
15832
|
-
|
|
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;
|
|
15833
15907
|
let E = n.getValue(_);
|
|
15834
15908
|
E && (E.liveStyle = !1);
|
|
15835
15909
|
};
|
|
15836
|
-
for (let n in
|
|
15837
|
-
let _ =
|
|
15910
|
+
for (let n in Rj) {
|
|
15911
|
+
let _ = Ij[n], E = Lj[n];
|
|
15838
15912
|
if (B.hasOwnProperty(n)) continue;
|
|
15839
15913
|
let O = !1;
|
|
15840
|
-
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;
|
|
15841
15915
|
}
|
|
15842
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
15916
|
+
W.prevProp = G, W.prevResolvedValues = Ij, W.isActive && (B = {
|
|
15843
15917
|
...B,
|
|
15844
|
-
...
|
|
15845
|
-
}), O && n.blockInitialAnimation && (
|
|
15846
|
-
let
|
|
15847
|
-
|
|
15918
|
+
...Ij
|
|
15919
|
+
}), O && n.blockInitialAnimation && (Nj = !1);
|
|
15920
|
+
let Bj = jj && Mj;
|
|
15921
|
+
Nj && (!Bj || Pj) && P.push(...Fj.map((_) => {
|
|
15848
15922
|
let E = { type: U };
|
|
15849
|
-
if (typeof _ == "string" && O && !
|
|
15923
|
+
if (typeof _ == "string" && O && !Bj && n.manuallyAnimateOnMount && n.parent) {
|
|
15850
15924
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
15851
15925
|
if (O.enteringChildren && A) {
|
|
15852
15926
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -17364,29 +17438,40 @@ var gestureAnimations = {
|
|
|
17364
17438
|
const processLayout = (n, _) => {
|
|
17365
17439
|
let E = n.map((n) => ({ ...n })), O = new Map(n.map((n) => [n.id, n])), A = [];
|
|
17366
17440
|
E.forEach((n) => {
|
|
17367
|
-
|
|
17441
|
+
let j = n.type === "text", M = n.type === "text-container";
|
|
17442
|
+
if ((j || M) && n.autoGrow) {
|
|
17368
17443
|
let j = n.content;
|
|
17369
17444
|
_ && (j = j.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
17370
17445
|
let A = _[O.trim()];
|
|
17371
17446
|
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
17372
17447
|
}));
|
|
17373
|
-
let
|
|
17374
|
-
if (
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
let
|
|
17383
|
-
|
|
17384
|
-
n.height
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17448
|
+
let N = parseInt(String(n.style?.fontSize || 16)), P = String(n.style?.fontFamily || "Arial");
|
|
17449
|
+
if (M && n.containerExpansion === "horizontal") {
|
|
17450
|
+
let _ = document.createElement("canvas").getContext("2d");
|
|
17451
|
+
if (_) {
|
|
17452
|
+
_.font = `${N}px ${P}`;
|
|
17453
|
+
let E = _.measureText(j), O = Math.ceil(E.width + parseInt(String(n.style?.padding || 0)) * 2);
|
|
17454
|
+
O > n.width && (n.width = O, n.content = j);
|
|
17455
|
+
}
|
|
17456
|
+
} else {
|
|
17457
|
+
let _ = measureTextHeight(j, n.width, P, N), M = n.height, z = _ - M;
|
|
17458
|
+
if (z > 0) {
|
|
17459
|
+
n.height = _, n.content = j;
|
|
17460
|
+
let N = [], P = O.get(n.id);
|
|
17461
|
+
P && E.forEach((_) => {
|
|
17462
|
+
if (_.id === n.id) return;
|
|
17463
|
+
let E = O.get(_.id);
|
|
17464
|
+
E && isInside(P, E) && N.push(_);
|
|
17465
|
+
});
|
|
17466
|
+
let B = new Set([n.id]);
|
|
17467
|
+
N.forEach((n) => {
|
|
17468
|
+
n.height += z, B.add(n.id);
|
|
17469
|
+
}), A.push({
|
|
17470
|
+
triggerY: n.y + M,
|
|
17471
|
+
delta: z,
|
|
17472
|
+
ignoreIds: B
|
|
17473
|
+
});
|
|
17474
|
+
}
|
|
17390
17475
|
}
|
|
17391
17476
|
}
|
|
17392
17477
|
}), E.forEach((n) => {
|
|
@@ -17507,7 +17592,7 @@ var getAnimationVariants = (n) => {
|
|
|
17507
17592
|
}, PreviewElementRenderer = ({ element: n, offsetY: _ = 0, dataContext: E }) => {
|
|
17508
17593
|
let O = n.content;
|
|
17509
17594
|
if (E) {
|
|
17510
|
-
if (n.type === "text") O = O.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
17595
|
+
if (n.type === "text" || n.type === "text-container") O = O.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
17511
17596
|
let O = E[_.trim()];
|
|
17512
17597
|
return O == null ? n : String(O);
|
|
17513
17598
|
});
|
|
@@ -17524,15 +17609,24 @@ var getAnimationVariants = (n) => {
|
|
|
17524
17609
|
position: "absolute",
|
|
17525
17610
|
left: 0,
|
|
17526
17611
|
top: 0,
|
|
17527
|
-
width: `${n.width}px`,
|
|
17528
|
-
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`,
|
|
17529
17614
|
transform: `translate(${n.x}px, ${n.y + _}px) rotate(${n.rotation || 0}deg)`,
|
|
17530
|
-
padding: n.type === "image" || n.type === "text" ? 0 : "8px",
|
|
17531
|
-
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,
|
|
17532
17619
|
...n.style
|
|
17533
17620
|
},
|
|
17534
17621
|
children: [
|
|
17535
|
-
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
|
+
}),
|
|
17536
17630
|
n.type === "image" && (O ? /* @__PURE__ */ jsx("img", {
|
|
17537
17631
|
src: O,
|
|
17538
17632
|
alt: "Element",
|
|
@@ -17706,16 +17800,16 @@ const Preview = () => {
|
|
|
17706
17800
|
});
|
|
17707
17801
|
};
|
|
17708
17802
|
var LayersPanel = ({ onOpenSettings: n }) => {
|
|
17709
|
-
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();
|
|
17710
17804
|
Z.forEach((n) => {
|
|
17711
|
-
|
|
17805
|
+
Aj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
|
|
17712
17806
|
});
|
|
17713
|
-
let
|
|
17807
|
+
let jj = _.elements.filter((n) => n.type !== "group" && !n.groupId), Mj = (n) => {
|
|
17714
17808
|
P((_) => ({
|
|
17715
17809
|
..._,
|
|
17716
17810
|
[n]: !_[n]
|
|
17717
17811
|
}));
|
|
17718
|
-
},
|
|
17812
|
+
}, Nj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
|
|
17719
17813
|
style: {
|
|
17720
17814
|
borderRadius: 6,
|
|
17721
17815
|
backgroundColor: _.selectedElementIds.includes(O.id) ? "var(--gray-5)" : "var(--gray-3)",
|
|
@@ -17780,9 +17874,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17780
17874
|
direction: "column",
|
|
17781
17875
|
gap: "2",
|
|
17782
17876
|
children: [
|
|
17783
|
-
|
|
17877
|
+
jj.map((n) => Nj(n, 0)),
|
|
17784
17878
|
Z.map((_) => {
|
|
17785
|
-
let O = N[_.id] === !0, j =
|
|
17879
|
+
let O = N[_.id] === !0, j = Aj.get(_.id) || [];
|
|
17786
17880
|
return /* @__PURE__ */ jsxs(p, {
|
|
17787
17881
|
style: {
|
|
17788
17882
|
border: "1px dashed var(--gray-6)",
|
|
@@ -17799,7 +17893,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17799
17893
|
onClick: () => {
|
|
17800
17894
|
E(_.id), n && n(_.id);
|
|
17801
17895
|
},
|
|
17802
|
-
onDoubleClick: () =>
|
|
17896
|
+
onDoubleClick: () => Mj(_.id),
|
|
17803
17897
|
onDragOver: (n) => {
|
|
17804
17898
|
n.preventDefault();
|
|
17805
17899
|
},
|
|
@@ -17828,7 +17922,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17828
17922
|
direction: "column",
|
|
17829
17923
|
gap: "2",
|
|
17830
17924
|
style: { padding: "6px 8px" },
|
|
17831
|
-
children: [j.map((n) =>
|
|
17925
|
+
children: [j.map((n) => Nj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
|
|
17832
17926
|
size: "1",
|
|
17833
17927
|
color: "gray",
|
|
17834
17928
|
children: "Solte elementos aqui para agrupar"
|
|
@@ -17888,7 +17982,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17888
17982
|
]
|
|
17889
17983
|
});
|
|
17890
17984
|
}, EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
17891
|
-
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 = () => {
|
|
17892
17986
|
let n = {
|
|
17893
17987
|
elements: Z.elements,
|
|
17894
17988
|
isList: Z.isList,
|
|
@@ -17899,9 +17993,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17899
17993
|
gridSize: Z.gridSize
|
|
17900
17994
|
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
17901
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);
|
|
17902
|
-
},
|
|
17903
|
-
|
|
17904
|
-
},
|
|
17996
|
+
}, Vj = () => {
|
|
17997
|
+
Lj.current?.click();
|
|
17998
|
+
}, Hj = (n) => {
|
|
17905
17999
|
let _ = n.target.files?.[0];
|
|
17906
18000
|
if (!_) return;
|
|
17907
18001
|
let E = new FileReader();
|
|
@@ -17941,11 +18035,11 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17941
18035
|
}, [W]), React.useEffect(() => {
|
|
17942
18036
|
let n = (n) => {
|
|
17943
18037
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
17944
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
17945
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
17946
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
17947
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
17948
|
-
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());
|
|
17949
18043
|
else if ([
|
|
17950
18044
|
"ArrowUp",
|
|
17951
18045
|
"ArrowDown",
|
|
@@ -17963,20 +18057,20 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17963
18057
|
changes: j
|
|
17964
18058
|
});
|
|
17965
18059
|
}
|
|
17966
|
-
}), E.length > 0 &&
|
|
18060
|
+
}), E.length > 0 && Ij(E);
|
|
17967
18061
|
}
|
|
17968
18062
|
}
|
|
17969
18063
|
};
|
|
17970
18064
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
17971
18065
|
}, [
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
18066
|
+
Aj,
|
|
18067
|
+
jj,
|
|
18068
|
+
Mj,
|
|
18069
|
+
Nj,
|
|
18070
|
+
Fj,
|
|
17977
18071
|
Z.selectedElementIds,
|
|
17978
18072
|
Z.elements,
|
|
17979
|
-
|
|
18073
|
+
Ij
|
|
17980
18074
|
]), React.useEffect(() => {
|
|
17981
18075
|
if (E) try {
|
|
17982
18076
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
@@ -17985,7 +18079,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
17985
18079
|
console.error("Failed to load initial state", n);
|
|
17986
18080
|
}
|
|
17987
18081
|
}, [E, G]);
|
|
17988
|
-
let
|
|
18082
|
+
let Uj = (n) => {
|
|
17989
18083
|
console.log(`Adding element of type: ${n}`), W({
|
|
17990
18084
|
type: n,
|
|
17991
18085
|
content: `New ${n}`
|
|
@@ -18046,16 +18140,20 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18046
18140
|
style: { width: "240px" },
|
|
18047
18141
|
children: [
|
|
18048
18142
|
/* @__PURE__ */ jsx(v$3, {
|
|
18049
|
-
onSelect: () =>
|
|
18143
|
+
onSelect: () => Uj("text"),
|
|
18050
18144
|
children: "Texto"
|
|
18051
18145
|
}),
|
|
18052
18146
|
/* @__PURE__ */ jsx(v$3, {
|
|
18053
|
-
onSelect: () =>
|
|
18147
|
+
onSelect: () => Uj("image"),
|
|
18054
18148
|
children: "Imagem"
|
|
18055
18149
|
}),
|
|
18056
18150
|
/* @__PURE__ */ jsx(v$3, {
|
|
18057
|
-
onSelect: () =>
|
|
18151
|
+
onSelect: () => Uj("box"),
|
|
18058
18152
|
children: "Caixa (Container)"
|
|
18153
|
+
}),
|
|
18154
|
+
/* @__PURE__ */ jsx(v$3, {
|
|
18155
|
+
onSelect: () => Uj("text-container"),
|
|
18156
|
+
children: "Container com Texto"
|
|
18059
18157
|
})
|
|
18060
18158
|
]
|
|
18061
18159
|
})] }),
|
|
@@ -18093,7 +18191,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18093
18191
|
cursor: "pointer",
|
|
18094
18192
|
justifyContent: "center"
|
|
18095
18193
|
},
|
|
18096
|
-
onClick:
|
|
18194
|
+
onClick: Rj,
|
|
18097
18195
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
18098
18196
|
}), /* @__PURE__ */ jsxs(o, {
|
|
18099
18197
|
variant: "soft",
|
|
@@ -18103,16 +18201,16 @@ var LayersPanel = ({ onOpenSettings: n }) => {
|
|
|
18103
18201
|
cursor: "pointer",
|
|
18104
18202
|
justifyContent: "center"
|
|
18105
18203
|
},
|
|
18106
|
-
onClick:
|
|
18204
|
+
onClick: Vj,
|
|
18107
18205
|
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
18108
18206
|
})]
|
|
18109
18207
|
}),
|
|
18110
18208
|
/* @__PURE__ */ jsx("input", {
|
|
18111
18209
|
type: "file",
|
|
18112
|
-
ref:
|
|
18210
|
+
ref: Lj,
|
|
18113
18211
|
style: { display: "none" },
|
|
18114
18212
|
accept: ".json",
|
|
18115
|
-
onChange:
|
|
18213
|
+
onChange: Hj
|
|
18116
18214
|
}),
|
|
18117
18215
|
/* @__PURE__ */ jsx(p, {
|
|
18118
18216
|
mt: "2",
|
|
@@ -18298,5 +18396,5 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
|
18298
18396
|
availableProps: n.layout.props,
|
|
18299
18397
|
theme: n.theme,
|
|
18300
18398
|
children: /* @__PURE__ */ jsx(EditorContent, { ...n })
|
|
18301
|
-
}), 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 autoGrowTexts = layoutElements\n .filter(el => el.type === 'text' && el.autoGrow)\n .sort((a, b) => a.y - b.y);\n\n autoGrowTexts.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 const measuredHeight = measureTextHeight(content, textEl.width, fontFamily, fontSize);\n \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 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.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";
|
|
18302
18400
|
export { GenericEditor as EditorContent, generateHTML };
|