@1urso/generic-editor 0.1.28 → 0.1.36
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/components/AlignmentToolbar.d.ts +2 -0
- package/dist/editor/components/ElementAdvancedSettings.d.ts +1 -0
- package/dist/editor/context.d.ts +11 -2
- package/dist/editor/utils/layoutEngine.d.ts +5 -0
- package/dist/generic-editor.css +1 -1
- package/dist/generic-editor.js +1780 -800
- package/dist/generic-editor.umd.cjs +64 -24
- package/package.json +1 -1
package/dist/generic-editor.js
CHANGED
|
@@ -26,7 +26,91 @@ function _objectWithoutPropertiesLoose(n, _) {
|
|
|
26
26
|
for (j = 0; j < O.length; j++) A = O[j], !(_.indexOf(A) >= 0) && (E[A] = n[A]);
|
|
27
27
|
return E;
|
|
28
28
|
}
|
|
29
|
-
var _excluded$
|
|
29
|
+
var _excluded$3 = ["color"], AlignBottomIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
30
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$3);
|
|
31
|
+
return createElement("svg", Object.assign({
|
|
32
|
+
width: "15",
|
|
33
|
+
height: "15",
|
|
34
|
+
viewBox: "0 0 15 15",
|
|
35
|
+
fill: "none",
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
37
|
+
}, A, { ref: _ }), createElement("path", {
|
|
38
|
+
d: "M9 3C9 2.44772 8.55229 2 8 2H7C6.44772 2 6 2.44772 6 3L6 14H1.5C1.22386 14 1 14.2239 1 14.5C1 14.7761 1.22386 15 1.5 15L6 15H9H13.5C13.7761 15 14 14.7761 14 14.5C14 14.2239 13.7761 14 13.5 14H9V3Z",
|
|
39
|
+
fill: O,
|
|
40
|
+
fillRule: "evenodd",
|
|
41
|
+
clipRule: "evenodd"
|
|
42
|
+
}));
|
|
43
|
+
}), _excluded$4 = ["color"], AlignCenterHorizontallyIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
44
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$4);
|
|
45
|
+
return createElement("svg", Object.assign({
|
|
46
|
+
width: "15",
|
|
47
|
+
height: "15",
|
|
48
|
+
viewBox: "0 0 15 15",
|
|
49
|
+
fill: "none",
|
|
50
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
51
|
+
}, A, { ref: _ }), createElement("path", {
|
|
52
|
+
d: "M1.99988 6C1.44759 6 0.999877 6.44772 0.999877 7L0.999877 8C0.999877 8.55228 1.44759 9 1.99988 9L6.99988 9L6.99988 13.5C6.99988 13.7761 7.22374 14 7.49988 14C7.77602 14 7.99988 13.7761 7.99988 13.5L7.99988 9L12.9999 9C13.5522 9 13.9999 8.55228 13.9999 8L13.9999 7C13.9999 6.44772 13.5522 6 12.9999 6L7.99988 6L7.99988 1.5C7.99988 1.22386 7.77602 1 7.49988 1C7.22373 1 6.99988 1.22386 6.99988 1.5L6.99988 6L1.99988 6Z",
|
|
53
|
+
fill: O,
|
|
54
|
+
fillRule: "evenodd",
|
|
55
|
+
clipRule: "evenodd"
|
|
56
|
+
}));
|
|
57
|
+
}), _excluded$5 = ["color"], AlignCenterVerticallyIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
58
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$5);
|
|
59
|
+
return createElement("svg", Object.assign({
|
|
60
|
+
width: "15",
|
|
61
|
+
height: "15",
|
|
62
|
+
viewBox: "0 0 15 15",
|
|
63
|
+
fill: "none",
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
65
|
+
}, A, { ref: _ }), createElement("path", {
|
|
66
|
+
d: "M6.99988 1C6.44759 1 5.99988 1.44772 5.99988 2V7H1.49988C1.22374 7 0.999878 7.22386 0.999878 7.5C0.999878 7.77614 1.22374 8 1.49988 8H5.99988V13C5.99988 13.5523 6.44759 14 6.99988 14H7.99988C8.55216 14 8.99988 13.5523 8.99988 13V8H13.4999C13.776 8 13.9999 7.77614 13.9999 7.5C13.9999 7.22386 13.776 7 13.4999 7H8.99988V2C8.99988 1.44772 8.55216 1 7.99988 1L6.99988 1Z",
|
|
67
|
+
fill: O,
|
|
68
|
+
fillRule: "evenodd",
|
|
69
|
+
clipRule: "evenodd"
|
|
70
|
+
}));
|
|
71
|
+
}), _excluded$6 = ["color"], AlignLeftIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
72
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$6);
|
|
73
|
+
return createElement("svg", Object.assign({
|
|
74
|
+
width: "15",
|
|
75
|
+
height: "15",
|
|
76
|
+
viewBox: "0 0 15 15",
|
|
77
|
+
fill: "none",
|
|
78
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
79
|
+
}, A, { ref: _ }), createElement("path", {
|
|
80
|
+
d: "M0.499995 0.999995C0.223855 0.999995 -5.58458e-07 1.22385 -5.46388e-07 1.49999L-2.18554e-08 13.4999C-9.78492e-09 13.776 0.223855 13.9999 0.499995 13.9999C0.776136 13.9999 0.999991 13.776 0.999991 13.4999L0.999991 8.99993L12 8.99993C12.5523 8.99993 13 8.55222 13 7.99993L13 6.99994C13 6.44766 12.5523 5.99995 12 5.99995L0.999991 5.99995L0.999991 1.49999C0.999991 1.22385 0.776135 0.999995 0.499995 0.999995Z",
|
|
81
|
+
fill: O,
|
|
82
|
+
fillRule: "evenodd",
|
|
83
|
+
clipRule: "evenodd"
|
|
84
|
+
}));
|
|
85
|
+
}), _excluded$7 = ["color"], AlignRightIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
86
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$7);
|
|
87
|
+
return createElement("svg", Object.assign({
|
|
88
|
+
width: "15",
|
|
89
|
+
height: "15",
|
|
90
|
+
viewBox: "0 0 15 15",
|
|
91
|
+
fill: "none",
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
93
|
+
}, A, { ref: _ }), createElement("path", {
|
|
94
|
+
d: "M14.4999 1C14.2237 1 13.9999 1.22386 13.9999 1.5L13.9999 6L2.99988 6C2.44759 6 1.99988 6.44772 1.99988 7L1.99988 8C1.99988 8.55228 2.44759 9 2.99988 9L13.9999 9L13.9999 13.5C13.9999 13.7761 14.2237 14 14.4999 14C14.776 14 14.9999 13.7761 14.9999 13.5L14.9999 9L14.9999 6L14.9999 1.5C14.9999 1.22386 14.776 1 14.4999 1Z",
|
|
95
|
+
fill: O,
|
|
96
|
+
fillRule: "evenodd",
|
|
97
|
+
clipRule: "evenodd"
|
|
98
|
+
}));
|
|
99
|
+
}), _excluded$8 = ["color"], AlignTopIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
100
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$8);
|
|
101
|
+
return createElement("svg", Object.assign({
|
|
102
|
+
width: "15",
|
|
103
|
+
height: "15",
|
|
104
|
+
viewBox: "0 0 15 15",
|
|
105
|
+
fill: "none",
|
|
106
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
107
|
+
}, A, { ref: _ }), createElement("path", {
|
|
108
|
+
d: "M1.5 0C1.22386 0 1 0.223858 1 0.5C1 0.776142 1.22386 1 1.5 1H6V12C6 12.5523 6.44772 13 7 13H8C8.55228 13 9 12.5523 9 12V1H13.5C13.7761 1 14 0.776142 14 0.5C14 0.223858 13.7761 0 13.5 0H9H6H1.5Z",
|
|
109
|
+
fill: O,
|
|
110
|
+
fillRule: "evenodd",
|
|
111
|
+
clipRule: "evenodd"
|
|
112
|
+
}));
|
|
113
|
+
}), _excluded$F = ["color"], BoxIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
30
114
|
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$F);
|
|
31
115
|
return createElement("svg", Object.assign({
|
|
32
116
|
width: "15",
|
|
@@ -110,6 +194,20 @@ var _excluded$F = ["color"], BoxIcon = /* @__PURE__ */ forwardRef(function(n, _)
|
|
|
110
194
|
fillRule: "evenodd",
|
|
111
195
|
clipRule: "evenodd"
|
|
112
196
|
}));
|
|
197
|
+
}), _excluded$1P = ["color"], DownloadIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
198
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$1P);
|
|
199
|
+
return createElement("svg", Object.assign({
|
|
200
|
+
width: "15",
|
|
201
|
+
height: "15",
|
|
202
|
+
viewBox: "0 0 15 15",
|
|
203
|
+
fill: "none",
|
|
204
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
205
|
+
}, A, { ref: _ }), createElement("path", {
|
|
206
|
+
d: "M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",
|
|
207
|
+
fill: O,
|
|
208
|
+
fillRule: "evenodd",
|
|
209
|
+
clipRule: "evenodd"
|
|
210
|
+
}));
|
|
113
211
|
}), _excluded$25 = ["color"], EyeNoneIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
114
212
|
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$25);
|
|
115
213
|
return createElement("svg", Object.assign({
|
|
@@ -208,6 +306,34 @@ var _excluded$F = ["color"], BoxIcon = /* @__PURE__ */ forwardRef(function(n, _)
|
|
|
208
306
|
fillRule: "evenodd",
|
|
209
307
|
clipRule: "evenodd"
|
|
210
308
|
}));
|
|
309
|
+
}), _excluded$42 = ["color"], SpaceEvenlyHorizontallyIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
310
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$42);
|
|
311
|
+
return createElement("svg", Object.assign({
|
|
312
|
+
width: "15",
|
|
313
|
+
height: "15",
|
|
314
|
+
viewBox: "0 0 15 15",
|
|
315
|
+
fill: "none",
|
|
316
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
317
|
+
}, A, { ref: _ }), createElement("path", {
|
|
318
|
+
d: "M14.4999 0.999992C14.2237 0.999992 13.9999 1.22385 13.9999 1.49999L13.9999 13.4999C13.9999 13.776 14.2237 13.9999 14.4999 13.9999C14.776 13.9999 14.9999 13.776 14.9999 13.4999L14.9999 1.49999C14.9999 1.22385 14.776 0.999992 14.4999 0.999992ZM0.499996 0.999992C0.223856 0.999992 -9.78509e-09 1.22385 -2.18556e-08 1.49999L4.07279e-07 13.4999C3.95208e-07 13.776 0.223855 13.9999 0.499996 13.9999C0.776136 13.9999 0.999992 13.776 0.999992 13.4999L0.999992 1.49999C0.999992 1.22385 0.776136 0.999992 0.499996 0.999992ZM1.99998 6.99994C1.99998 6.44766 2.44769 5.99995 2.99998 5.99995L5.99995 5.99995C6.55223 5.99995 6.99994 6.44766 6.99994 6.99994L6.99994 7.99993C6.99994 8.55221 6.55223 8.99992 5.99995 8.99992L2.99998 8.99992C2.4477 8.99992 1.99998 8.55221 1.99998 7.99993L1.99998 6.99994ZM8.99993 5.99995C8.44765 5.99995 7.99993 6.44766 7.99993 6.99994L7.99993 7.99993C7.99993 8.55221 8.44765 8.99992 8.99993 8.99992L11.9999 8.99992C12.5522 8.99992 12.9999 8.55221 12.9999 7.99993L12.9999 6.99994C12.9999 6.44766 12.5522 5.99995 11.9999 5.99995L8.99993 5.99995Z",
|
|
319
|
+
fill: O,
|
|
320
|
+
fillRule: "evenodd",
|
|
321
|
+
clipRule: "evenodd"
|
|
322
|
+
}));
|
|
323
|
+
}), _excluded$43 = ["color"], SpaceEvenlyVerticallyIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
324
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$43);
|
|
325
|
+
return createElement("svg", Object.assign({
|
|
326
|
+
width: "15",
|
|
327
|
+
height: "15",
|
|
328
|
+
viewBox: "0 0 15 15",
|
|
329
|
+
fill: "none",
|
|
330
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
331
|
+
}, A, { ref: _ }), createElement("path", {
|
|
332
|
+
d: "M0.999878 0.5C0.999878 0.223858 1.22374 0 1.49988 0H13.4999C13.776 0 13.9999 0.223858 13.9999 0.5C13.9999 0.776142 13.776 1 13.4999 1H1.49988C1.22374 1 0.999878 0.776142 0.999878 0.5ZM7 2C6.44772 2 6 2.44772 6 3V6C6 6.55228 6.44772 7 7 7H8C8.55228 7 9 6.55228 9 6V3C9 2.44772 8.55228 2 8 2H7ZM7 8C6.44772 8 6 8.44771 6 9V12C6 12.5523 6.44772 13 7 13H8C8.55228 13 9 12.5523 9 12V9C9 8.44772 8.55228 8 8 8H7ZM1.49988 14C1.22374 14 0.999878 14.2239 0.999878 14.5C0.999878 14.7761 1.22374 15 1.49988 15H13.4999C13.776 15 13.9999 14.7761 13.9999 14.5C13.9999 14.2239 13.776 14 13.4999 14H1.49988Z",
|
|
333
|
+
fill: O,
|
|
334
|
+
fillRule: "evenodd",
|
|
335
|
+
clipRule: "evenodd"
|
|
336
|
+
}));
|
|
211
337
|
}), _excluded$4d = ["color"], StopIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
212
338
|
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$4d);
|
|
213
339
|
return createElement("svg", Object.assign({
|
|
@@ -250,6 +376,20 @@ var _excluded$F = ["color"], BoxIcon = /* @__PURE__ */ forwardRef(function(n, _)
|
|
|
250
376
|
fillRule: "evenodd",
|
|
251
377
|
clipRule: "evenodd"
|
|
252
378
|
}));
|
|
379
|
+
}), _excluded$4O = ["color"], UploadIcon = /* @__PURE__ */ forwardRef(function(n, _) {
|
|
380
|
+
var E = n.color, O = E === void 0 ? "currentColor" : E, A = _objectWithoutPropertiesLoose(n, _excluded$4O);
|
|
381
|
+
return createElement("svg", Object.assign({
|
|
382
|
+
width: "15",
|
|
383
|
+
height: "15",
|
|
384
|
+
viewBox: "0 0 15 15",
|
|
385
|
+
fill: "none",
|
|
386
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
387
|
+
}, A, { ref: _ }), createElement("path", {
|
|
388
|
+
d: "M7.81825 1.18188C7.64251 1.00615 7.35759 1.00615 7.18185 1.18188L4.18185 4.18188C4.00611 4.35762 4.00611 4.64254 4.18185 4.81828C4.35759 4.99401 4.64251 4.99401 4.81825 4.81828L7.05005 2.58648V9.49996C7.05005 9.74849 7.25152 9.94996 7.50005 9.94996C7.74858 9.94996 7.95005 9.74849 7.95005 9.49996V2.58648L10.1819 4.81828C10.3576 4.99401 10.6425 4.99401 10.8182 4.81828C10.994 4.64254 10.994 4.35762 10.8182 4.18188L7.81825 1.18188ZM2.5 9.99997C2.77614 9.99997 3 10.2238 3 10.5V12C3 12.5538 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2238 12.2239 9.99997 12.5 9.99997C12.7761 9.99997 13 10.2238 13 10.5V12C13 13.104 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2238 2.22386 9.99997 2.5 9.99997Z",
|
|
389
|
+
fill: O,
|
|
390
|
+
fillRule: "evenodd",
|
|
391
|
+
clipRule: "evenodd"
|
|
392
|
+
}));
|
|
253
393
|
});
|
|
254
394
|
function setRef$1(n, _) {
|
|
255
395
|
if (typeof n == "function") return n(_);
|
|
@@ -664,15 +804,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
664
804
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
665
805
|
branches: /* @__PURE__ */ new Set()
|
|
666
806
|
}), DismissableLayer = React$1.forwardRef((_, E) => {
|
|
667
|
-
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)), Bj = Array.from(B.layers), [Vj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), Hj = Bj.indexOf(Vj), Uj = H ? Bj.indexOf(H) : -1, Wj = B.layersWithOutsidePointerEventsDisabled.size > 0, Gj = Uj >= Hj, Kj = usePointerDownOutside((n) => {
|
|
668
808
|
let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
|
|
669
|
-
!
|
|
670
|
-
}, W),
|
|
809
|
+
!Gj || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
810
|
+
}, W), qj = useFocusOutside((n) => {
|
|
671
811
|
let _ = n.target;
|
|
672
812
|
[...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
|
|
673
813
|
}, W);
|
|
674
814
|
return useEscapeKeydown((n) => {
|
|
675
|
-
|
|
815
|
+
Uj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
|
|
676
816
|
}, W), React$1.useEffect(() => {
|
|
677
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(), () => {
|
|
678
818
|
O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -691,12 +831,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
691
831
|
...z,
|
|
692
832
|
ref: Z,
|
|
693
833
|
style: {
|
|
694
|
-
pointerEvents:
|
|
834
|
+
pointerEvents: Wj ? Gj ? "auto" : "none" : void 0,
|
|
695
835
|
..._.style
|
|
696
836
|
},
|
|
697
|
-
onFocusCapture: composeEventHandlers(_.onFocusCapture,
|
|
698
|
-
onBlurCapture: composeEventHandlers(_.onBlurCapture,
|
|
699
|
-
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture,
|
|
837
|
+
onFocusCapture: composeEventHandlers(_.onFocusCapture, qj.onFocusCapture),
|
|
838
|
+
onBlurCapture: composeEventHandlers(_.onBlurCapture, qj.onBlurCapture),
|
|
839
|
+
onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, Kj.onPointerDownCapture)
|
|
700
840
|
});
|
|
701
841
|
});
|
|
702
842
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -1055,7 +1195,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1055
1195
|
onScrollCapture: nothing,
|
|
1056
1196
|
onWheelCapture: nothing,
|
|
1057
1197
|
onTouchMoveCapture: nothing
|
|
1058
|
-
}), 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, Bj = _.inert, Vj = _.allowPinchZoom, Hj = _.as, Uj = Hj === void 0 ? "div" : Hj, Wj = _.gapMode, Gj = __rest(_, [
|
|
1059
1199
|
"forwardProps",
|
|
1060
1200
|
"children",
|
|
1061
1201
|
"className",
|
|
@@ -1069,21 +1209,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
1069
1209
|
"allowPinchZoom",
|
|
1070
1210
|
"as",
|
|
1071
1211
|
"gapMode"
|
|
1072
|
-
]),
|
|
1073
|
-
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(
|
|
1212
|
+
]), Kj = W, qj = useMergeRefs([O, E]), Jj = __assign$2(__assign$2({}, Gj), j);
|
|
1213
|
+
return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(Kj, {
|
|
1074
1214
|
sideCar: effectCar,
|
|
1075
1215
|
removeScrollBar: B,
|
|
1076
1216
|
shards: U,
|
|
1077
1217
|
noRelative: G,
|
|
1078
1218
|
noIsolation: Z,
|
|
1079
|
-
inert:
|
|
1219
|
+
inert: Bj,
|
|
1080
1220
|
setCallbacks: M,
|
|
1081
|
-
allowPinchZoom: !!
|
|
1221
|
+
allowPinchZoom: !!Vj,
|
|
1082
1222
|
lockRef: O,
|
|
1083
|
-
gapMode:
|
|
1084
|
-
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({},
|
|
1223
|
+
gapMode: Wj
|
|
1224
|
+
}), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, Jj), { ref: qj })) : React$1.createElement(Uj, __assign$2({}, Jj, {
|
|
1085
1225
|
className: z,
|
|
1086
|
-
ref:
|
|
1226
|
+
ref: qj
|
|
1087
1227
|
}), P));
|
|
1088
1228
|
});
|
|
1089
1229
|
RemoveScroll.defaultProps = {
|
|
@@ -1273,8 +1413,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1273
1413
|
if (!N) break;
|
|
1274
1414
|
var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
|
|
1275
1415
|
(G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
|
|
1276
|
-
var
|
|
1277
|
-
N =
|
|
1416
|
+
var Bj = N.parentNode;
|
|
1417
|
+
N = Bj && Bj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Bj.host : Bj;
|
|
1278
1418
|
} while (!P && N !== document.body || P && (_.contains(N) || _ === N));
|
|
1279
1419
|
return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
|
|
1280
1420
|
}, getTouchXY = function(n) {
|
|
@@ -1821,7 +1961,7 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1821
1961
|
strategy: A
|
|
1822
1962
|
}), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
|
|
1823
1963
|
for (let E = 0; E < N.length; E++) {
|
|
1824
|
-
let { name: j, fn: Z } = N[E], { x:
|
|
1964
|
+
let { name: j, fn: Z } = N[E], { x: Bj, y: Vj, data: Hj, reset: Uj } = await Z({
|
|
1825
1965
|
x: B,
|
|
1826
1966
|
y: H,
|
|
1827
1967
|
initialPlacement: O,
|
|
@@ -1835,17 +1975,17 @@ var computePosition$1 = async (n, _, E) => {
|
|
|
1835
1975
|
floating: _
|
|
1836
1976
|
}
|
|
1837
1977
|
});
|
|
1838
|
-
B =
|
|
1978
|
+
B = Bj ?? B, H = Vj ?? H, W = {
|
|
1839
1979
|
...W,
|
|
1840
1980
|
[j]: {
|
|
1841
1981
|
...W[j],
|
|
1842
|
-
...
|
|
1982
|
+
...Hj
|
|
1843
1983
|
}
|
|
1844
|
-
},
|
|
1984
|
+
}, Uj && G <= 50 && (G++, typeof Uj == "object" && (Uj.placement && (U = Uj.placement), Uj.rects && (z = Uj.rects === !0 ? await M.getElementRects({
|
|
1845
1985
|
reference: n,
|
|
1846
1986
|
floating: _,
|
|
1847
1987
|
strategy: A
|
|
1848
|
-
}) :
|
|
1988
|
+
}) : Uj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
|
|
1849
1989
|
}
|
|
1850
1990
|
return {
|
|
1851
1991
|
x: B,
|
|
@@ -1862,25 +2002,25 @@ async function detectOverflow$1(n, _) {
|
|
|
1862
2002
|
boundary: P,
|
|
1863
2003
|
rootBoundary: z,
|
|
1864
2004
|
strategy: N
|
|
1865
|
-
})),
|
|
2005
|
+
})), Bj = B === "floating" ? {
|
|
1866
2006
|
x: E,
|
|
1867
2007
|
y: O,
|
|
1868
2008
|
width: j.floating.width,
|
|
1869
2009
|
height: j.floating.height
|
|
1870
|
-
} : j.reference,
|
|
2010
|
+
} : j.reference, Vj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), Hj = await (A.isElement == null ? void 0 : A.isElement(Vj)) && await (A.getScale == null ? void 0 : A.getScale(Vj)) || {
|
|
1871
2011
|
x: 1,
|
|
1872
2012
|
y: 1
|
|
1873
|
-
},
|
|
2013
|
+
}, Uj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1874
2014
|
elements: M,
|
|
1875
|
-
rect:
|
|
1876
|
-
offsetParent:
|
|
2015
|
+
rect: Bj,
|
|
2016
|
+
offsetParent: Vj,
|
|
1877
2017
|
strategy: N
|
|
1878
|
-
}) :
|
|
2018
|
+
}) : Bj);
|
|
1879
2019
|
return {
|
|
1880
|
-
top: (Z.top -
|
|
1881
|
-
bottom: (
|
|
1882
|
-
left: (Z.left -
|
|
1883
|
-
right: (
|
|
2020
|
+
top: (Z.top - Uj.top + W.top) / Hj.y,
|
|
2021
|
+
bottom: (Uj.bottom - Z.bottom + W.bottom) / Hj.y,
|
|
2022
|
+
left: (Z.left - Uj.left + W.left) / Hj.x,
|
|
2023
|
+
right: (Uj.right - Z.right + W.right) / Hj.x
|
|
1884
2024
|
};
|
|
1885
2025
|
}
|
|
1886
2026
|
var arrow$2 = (n) => ({
|
|
@@ -1892,17 +2032,17 @@ var arrow$2 = (n) => ({
|
|
|
1892
2032
|
let H = getPaddingObject(B), U = {
|
|
1893
2033
|
x: E,
|
|
1894
2034
|
y: O
|
|
1895
|
-
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z),
|
|
1896
|
-
(!
|
|
1897
|
-
let
|
|
2035
|
+
}, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Bj = W === "y", Vj = Bj ? "top" : "left", Hj = Bj ? "bottom" : "right", Uj = Bj ? "clientHeight" : "clientWidth", Wj = j.reference[G] + j.reference[W] - U[W] - j.floating[G], Gj = U[W] - j.reference[W], Kj = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), qj = Kj ? Kj[Uj] : 0;
|
|
2036
|
+
(!qj || !await (M.isElement == null ? void 0 : M.isElement(Kj))) && (qj = N.floating[Uj] || j.floating[G]);
|
|
2037
|
+
let Jj = Wj / 2 - Gj / 2, Yj = qj / 2 - Z[G] / 2 - 1, Xj = min(H[Vj], Yj), Zj = min(H[Hj], Yj), Qj = Xj, $j = qj - Z[G] - Zj, eM = qj / 2 - Z[G] / 2 + Jj, tM = clamp$3(Qj, eM, $j), nM = !P.arrow && getAlignment(A) != null && eM !== tM && j.reference[G] / 2 - (eM < Qj ? Xj : Zj) - Z[G] / 2 < 0, rM = nM ? eM < Qj ? eM - Qj : eM - $j : 0;
|
|
1898
2038
|
return {
|
|
1899
|
-
[W]: U[W] +
|
|
2039
|
+
[W]: U[W] + rM,
|
|
1900
2040
|
data: {
|
|
1901
|
-
[W]:
|
|
1902
|
-
centerOffset:
|
|
1903
|
-
...
|
|
2041
|
+
[W]: tM,
|
|
2042
|
+
centerOffset: eM - tM - rM,
|
|
2043
|
+
...nM && { alignmentOffset: rM }
|
|
1904
2044
|
},
|
|
1905
|
-
reset:
|
|
2045
|
+
reset: nM
|
|
1906
2046
|
};
|
|
1907
2047
|
}
|
|
1908
2048
|
}), flip$2 = function(n) {
|
|
@@ -1913,32 +2053,32 @@ var arrow$2 = (n) => ({
|
|
|
1913
2053
|
var E;
|
|
1914
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, _);
|
|
1915
2055
|
if ((E = A.arrow) != null && E.alignmentOffset) return {};
|
|
1916
|
-
let
|
|
1917
|
-
!H &&
|
|
1918
|
-
let
|
|
1919
|
-
if (z &&
|
|
1920
|
-
let n = getAlignmentSides(O, j,
|
|
1921
|
-
|
|
2056
|
+
let Bj = getSide(O), Vj = getSideAxis(M), Hj = getSide(M) === M, Uj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), Wj = H || (Hj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), Gj = W !== "none";
|
|
2057
|
+
!H && Gj && Wj.push(...getOppositeAxisPlacements(M, G, W, Uj));
|
|
2058
|
+
let Kj = [M, ...Wj], qj = await detectOverflow$1(_, Z), Jj = [], Yj = A.flip?.overflows || [];
|
|
2059
|
+
if (z && Jj.push(qj[Bj]), B) {
|
|
2060
|
+
let n = getAlignmentSides(O, j, Uj);
|
|
2061
|
+
Jj.push(qj[n[0]], qj[n[1]]);
|
|
1922
2062
|
}
|
|
1923
|
-
if (
|
|
2063
|
+
if (Yj = [...Yj, {
|
|
1924
2064
|
placement: O,
|
|
1925
|
-
overflows:
|
|
1926
|
-
}], !
|
|
1927
|
-
let n = (A.flip?.index || 0) + 1, _ =
|
|
1928
|
-
if (_ && (!(B === "alignment" &&
|
|
2065
|
+
overflows: Jj
|
|
2066
|
+
}], !Jj.every((n) => n <= 0)) {
|
|
2067
|
+
let n = (A.flip?.index || 0) + 1, _ = Kj[n];
|
|
2068
|
+
if (_ && (!(B === "alignment" && Vj !== getSideAxis(_)) || Yj.every((n) => getSideAxis(n.placement) === Vj ? n.overflows[0] > 0 : !0))) return {
|
|
1929
2069
|
data: {
|
|
1930
2070
|
index: n,
|
|
1931
|
-
overflows:
|
|
2071
|
+
overflows: Yj
|
|
1932
2072
|
},
|
|
1933
2073
|
reset: { placement: _ }
|
|
1934
2074
|
};
|
|
1935
|
-
let E =
|
|
2075
|
+
let E = Yj.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
|
|
1936
2076
|
if (!E) switch (U) {
|
|
1937
2077
|
case "bestFit": {
|
|
1938
|
-
let n =
|
|
1939
|
-
if (
|
|
2078
|
+
let n = Yj.filter((n) => {
|
|
2079
|
+
if (Gj) {
|
|
1940
2080
|
let _ = getSideAxis(n.placement);
|
|
1941
|
-
return _ ===
|
|
2081
|
+
return _ === Vj || _ === "y";
|
|
1942
2082
|
}
|
|
1943
2083
|
return !0;
|
|
1944
2084
|
}).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
|
|
@@ -2081,7 +2221,7 @@ var offset$2 = function(n) {
|
|
|
2081
2221
|
let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
|
|
2082
2222
|
x: E,
|
|
2083
2223
|
y: O
|
|
2084
|
-
}, 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, _), Bj = typeof Z == "number" ? {
|
|
2085
2225
|
mainAxis: Z,
|
|
2086
2226
|
crossAxis: 0
|
|
2087
2227
|
} : {
|
|
@@ -2090,11 +2230,11 @@ var offset$2 = function(n) {
|
|
|
2090
2230
|
...Z
|
|
2091
2231
|
};
|
|
2092
2232
|
if (P) {
|
|
2093
|
-
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] + Bj.mainAxis, E = j.reference[U] + j.reference[n] - Bj.mainAxis;
|
|
2094
2234
|
W < _ ? W = _ : W > E && (W = E);
|
|
2095
2235
|
}
|
|
2096
2236
|
if (z) {
|
|
2097
|
-
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 : Bj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Bj.crossAxis : 0);
|
|
2098
2238
|
G < E ? G = E : G > O && (G = O);
|
|
2099
2239
|
}
|
|
2100
2240
|
return {
|
|
@@ -2109,20 +2249,20 @@ var offset$2 = function(n) {
|
|
|
2109
2249
|
options: n,
|
|
2110
2250
|
async fn(_) {
|
|
2111
2251
|
var E, O;
|
|
2112
|
-
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,
|
|
2113
|
-
H === "top" || H === "bottom" ? (
|
|
2114
|
-
let
|
|
2115
|
-
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, Bj, Vj;
|
|
2253
|
+
H === "top" || H === "bottom" ? (Bj = H, Vj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (Vj = H, Bj = U === "end" ? "top" : "bottom");
|
|
2254
|
+
let Hj = Z - B.top - B.bottom, Uj = G - B.left - B.right, Wj = min(Z - B[Bj], Hj), Gj = min(G - B[Vj], Uj), Kj = !_.middlewareData.shift, qj = Wj, Jj = Gj;
|
|
2255
|
+
if ((E = _.middlewareData.shift) != null && E.enabled.x && (Jj = Uj), (O = _.middlewareData.shift) != null && O.enabled.y && (qj = Hj), Kj && !U) {
|
|
2116
2256
|
let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
|
|
2117
|
-
W ?
|
|
2257
|
+
W ? Jj = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : qj = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
|
|
2118
2258
|
}
|
|
2119
2259
|
await P({
|
|
2120
2260
|
..._,
|
|
2121
|
-
availableWidth:
|
|
2122
|
-
availableHeight:
|
|
2261
|
+
availableWidth: Jj,
|
|
2262
|
+
availableHeight: qj
|
|
2123
2263
|
});
|
|
2124
|
-
let
|
|
2125
|
-
return G !==
|
|
2264
|
+
let Yj = await M.getDimensions(N.floating);
|
|
2265
|
+
return G !== Yj.width || Z !== Yj.height ? { reset: { rects: !0 } } : {};
|
|
2126
2266
|
}
|
|
2127
2267
|
};
|
|
2128
2268
|
};
|
|
@@ -2506,27 +2646,27 @@ function observeMove(n, _) {
|
|
|
2506
2646
|
N === void 0 && (N = !1), P === void 0 && (P = 1), j();
|
|
2507
2647
|
let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
|
|
2508
2648
|
if (N || _(), !U || !W) return;
|
|
2509
|
-
let G = floor(H), Z = floor(A.clientWidth - (B + U)),
|
|
2510
|
-
rootMargin: -G + "px " + -Z + "px " + -
|
|
2649
|
+
let G = floor(H), Z = floor(A.clientWidth - (B + U)), Bj = floor(A.clientHeight - (H + W)), Vj = floor(B), Hj = {
|
|
2650
|
+
rootMargin: -G + "px " + -Z + "px " + -Bj + "px " + -Vj + "px",
|
|
2511
2651
|
threshold: max(0, min(1, P)) || 1
|
|
2512
|
-
},
|
|
2513
|
-
function
|
|
2652
|
+
}, Uj = !0;
|
|
2653
|
+
function Wj(_) {
|
|
2514
2654
|
let E = _[0].intersectionRatio;
|
|
2515
2655
|
if (E !== P) {
|
|
2516
|
-
if (!
|
|
2656
|
+
if (!Uj) return M();
|
|
2517
2657
|
E ? M(!1, E) : O = setTimeout(() => {
|
|
2518
2658
|
M(!1, 1e-7);
|
|
2519
2659
|
}, 1e3);
|
|
2520
2660
|
}
|
|
2521
|
-
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(),
|
|
2661
|
+
E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Uj = !1;
|
|
2522
2662
|
}
|
|
2523
2663
|
try {
|
|
2524
|
-
E = new IntersectionObserver(
|
|
2525
|
-
...
|
|
2664
|
+
E = new IntersectionObserver(Wj, {
|
|
2665
|
+
...Hj,
|
|
2526
2666
|
root: A.ownerDocument
|
|
2527
2667
|
});
|
|
2528
2668
|
} catch {
|
|
2529
|
-
E = new IntersectionObserver(
|
|
2669
|
+
E = new IntersectionObserver(Wj, Hj);
|
|
2530
2670
|
}
|
|
2531
2671
|
E.observe(n);
|
|
2532
2672
|
}
|
|
@@ -2547,10 +2687,10 @@ function autoUpdate(n, _, E, O) {
|
|
|
2547
2687
|
})), E();
|
|
2548
2688
|
}), z && !P && W.observe(z), W.observe(_));
|
|
2549
2689
|
let G, Z = P ? getBoundingClientRect(n) : null;
|
|
2550
|
-
P &&
|
|
2551
|
-
function
|
|
2690
|
+
P && Bj();
|
|
2691
|
+
function Bj() {
|
|
2552
2692
|
let _ = getBoundingClientRect(n);
|
|
2553
|
-
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(
|
|
2693
|
+
Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Bj);
|
|
2554
2694
|
}
|
|
2555
2695
|
return E(), () => {
|
|
2556
2696
|
var n;
|
|
@@ -2617,23 +2757,23 @@ function useFloating(_) {
|
|
|
2617
2757
|
isPositioned: !1
|
|
2618
2758
|
}), [W, G] = React$1.useState(A);
|
|
2619
2759
|
deepEqual(W, A) || G(A);
|
|
2620
|
-
let [Z,
|
|
2621
|
-
n !==
|
|
2622
|
-
}, []),
|
|
2623
|
-
n !==
|
|
2624
|
-
}, []),
|
|
2625
|
-
if (!
|
|
2760
|
+
let [Z, Bj] = React$1.useState(null), [Vj, Hj] = React$1.useState(null), Uj = React$1.useCallback((n) => {
|
|
2761
|
+
n !== Jj.current && (Jj.current = n, Bj(n));
|
|
2762
|
+
}, []), Wj = React$1.useCallback((n) => {
|
|
2763
|
+
n !== Yj.current && (Yj.current = n, Hj(n));
|
|
2764
|
+
}, []), Kj = M || Z, qj = N || Vj, Jj = React$1.useRef(null), Yj = React$1.useRef(null), Xj = React$1.useRef(H), Zj = z != null, Qj = useLatestRef(z), $j = useLatestRef(j), eM = useLatestRef(B), tM = React$1.useCallback(() => {
|
|
2765
|
+
if (!Jj.current || !Yj.current) return;
|
|
2626
2766
|
let n = {
|
|
2627
2767
|
placement: E,
|
|
2628
2768
|
strategy: O,
|
|
2629
2769
|
middleware: W
|
|
2630
2770
|
};
|
|
2631
|
-
|
|
2771
|
+
$j.current && (n.platform = $j.current), computePosition(Jj.current, Yj.current, n).then((n) => {
|
|
2632
2772
|
let _ = {
|
|
2633
2773
|
...n,
|
|
2634
|
-
isPositioned:
|
|
2774
|
+
isPositioned: eM.current !== !1
|
|
2635
2775
|
};
|
|
2636
|
-
|
|
2776
|
+
nM.current && !deepEqual(Xj.current, _) && (Xj.current = _, ReactDOM$1.flushSync(() => {
|
|
2637
2777
|
U(_);
|
|
2638
2778
|
}));
|
|
2639
2779
|
});
|
|
@@ -2641,50 +2781,50 @@ function useFloating(_) {
|
|
|
2641
2781
|
W,
|
|
2642
2782
|
E,
|
|
2643
2783
|
O,
|
|
2644
|
-
|
|
2645
|
-
|
|
2784
|
+
$j,
|
|
2785
|
+
eM
|
|
2646
2786
|
]);
|
|
2647
2787
|
index(() => {
|
|
2648
|
-
B === !1 &&
|
|
2788
|
+
B === !1 && Xj.current.isPositioned && (Xj.current.isPositioned = !1, U((n) => ({
|
|
2649
2789
|
...n,
|
|
2650
2790
|
isPositioned: !1
|
|
2651
2791
|
})));
|
|
2652
2792
|
}, [B]);
|
|
2653
|
-
let
|
|
2654
|
-
index(() => (
|
|
2655
|
-
|
|
2793
|
+
let nM = React$1.useRef(!1);
|
|
2794
|
+
index(() => (nM.current = !0, () => {
|
|
2795
|
+
nM.current = !1;
|
|
2656
2796
|
}), []), index(() => {
|
|
2657
|
-
if (
|
|
2658
|
-
if (
|
|
2659
|
-
|
|
2797
|
+
if (Kj && (Jj.current = Kj), qj && (Yj.current = qj), Kj && qj) {
|
|
2798
|
+
if (Qj.current) return Qj.current(Kj, qj, tM);
|
|
2799
|
+
tM();
|
|
2660
2800
|
}
|
|
2661
2801
|
}, [
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2802
|
+
Kj,
|
|
2803
|
+
qj,
|
|
2804
|
+
tM,
|
|
2805
|
+
Qj,
|
|
2806
|
+
Zj
|
|
2667
2807
|
]);
|
|
2668
|
-
let
|
|
2669
|
-
reference:
|
|
2670
|
-
floating:
|
|
2671
|
-
setReference:
|
|
2672
|
-
setFloating:
|
|
2673
|
-
}), [
|
|
2674
|
-
reference:
|
|
2675
|
-
floating:
|
|
2676
|
-
}), [
|
|
2808
|
+
let rM = React$1.useMemo(() => ({
|
|
2809
|
+
reference: Jj,
|
|
2810
|
+
floating: Yj,
|
|
2811
|
+
setReference: Uj,
|
|
2812
|
+
setFloating: Wj
|
|
2813
|
+
}), [Uj, Wj]), iM = React$1.useMemo(() => ({
|
|
2814
|
+
reference: Kj,
|
|
2815
|
+
floating: qj
|
|
2816
|
+
}), [Kj, qj]), aM = React$1.useMemo(() => {
|
|
2677
2817
|
let n = {
|
|
2678
2818
|
position: O,
|
|
2679
2819
|
left: 0,
|
|
2680
2820
|
top: 0
|
|
2681
2821
|
};
|
|
2682
|
-
if (!
|
|
2683
|
-
let _ = roundByDPR(
|
|
2822
|
+
if (!iM.floating) return n;
|
|
2823
|
+
let _ = roundByDPR(iM.floating, H.x), E = roundByDPR(iM.floating, H.y);
|
|
2684
2824
|
return P ? {
|
|
2685
2825
|
...n,
|
|
2686
2826
|
transform: "translate(" + _ + "px, " + E + "px)",
|
|
2687
|
-
...getDPR(
|
|
2827
|
+
...getDPR(iM.floating) >= 1.5 && { willChange: "transform" }
|
|
2688
2828
|
} : {
|
|
2689
2829
|
position: O,
|
|
2690
2830
|
left: _,
|
|
@@ -2693,22 +2833,22 @@ function useFloating(_) {
|
|
|
2693
2833
|
}, [
|
|
2694
2834
|
O,
|
|
2695
2835
|
P,
|
|
2696
|
-
|
|
2836
|
+
iM.floating,
|
|
2697
2837
|
H.x,
|
|
2698
2838
|
H.y
|
|
2699
2839
|
]);
|
|
2700
2840
|
return React$1.useMemo(() => ({
|
|
2701
2841
|
...H,
|
|
2702
|
-
update:
|
|
2703
|
-
refs:
|
|
2704
|
-
elements:
|
|
2705
|
-
floatingStyles:
|
|
2842
|
+
update: tM,
|
|
2843
|
+
refs: rM,
|
|
2844
|
+
elements: iM,
|
|
2845
|
+
floatingStyles: aM
|
|
2706
2846
|
}), [
|
|
2707
2847
|
H,
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2848
|
+
tM,
|
|
2849
|
+
rM,
|
|
2850
|
+
iM,
|
|
2851
|
+
aM
|
|
2712
2852
|
]);
|
|
2713
2853
|
}
|
|
2714
2854
|
var arrow$1$1 = (n) => {
|
|
@@ -2785,70 +2925,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
|
|
|
2785
2925
|
});
|
|
2786
2926
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
2787
2927
|
var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$6), PopperContent = React$1.forwardRef((_, E) => {
|
|
2788
|
-
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, ...Bj } = _, Vj = usePopperContext(CONTENT_NAME$6, O), [Hj, Uj] = React$1.useState(null), Wj = useComposedRefs$1(E, (n) => Uj(n)), [Gj, Kj] = React$1.useState(null), qj = useSize(Gj), Jj = qj?.width ?? 0, Xj = qj?.height ?? 0, Zj = A + (M === "center" ? "" : "-" + M), Qj = typeof H == "number" ? H : {
|
|
2789
2929
|
top: 0,
|
|
2790
2930
|
right: 0,
|
|
2791
2931
|
bottom: 0,
|
|
2792
2932
|
left: 0,
|
|
2793
2933
|
...H
|
|
2794
|
-
},
|
|
2795
|
-
padding:
|
|
2796
|
-
boundary:
|
|
2797
|
-
altBoundary:
|
|
2798
|
-
}, { refs:
|
|
2934
|
+
}, $j = Array.isArray(B) ? B : [B], eM = $j.length > 0, tM = {
|
|
2935
|
+
padding: Qj,
|
|
2936
|
+
boundary: $j.filter(isNotNull$2),
|
|
2937
|
+
altBoundary: eM
|
|
2938
|
+
}, { refs: nM, floatingStyles: rM, placement: iM, isPositioned: aM, middlewareData: oM } = useFloating({
|
|
2799
2939
|
strategy: "fixed",
|
|
2800
|
-
placement:
|
|
2940
|
+
placement: Zj,
|
|
2801
2941
|
whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
|
|
2802
|
-
elements: { reference:
|
|
2942
|
+
elements: { reference: Vj.anchor },
|
|
2803
2943
|
middleware: [
|
|
2804
2944
|
offset({
|
|
2805
|
-
mainAxis: j +
|
|
2945
|
+
mainAxis: j + Xj,
|
|
2806
2946
|
alignmentAxis: N
|
|
2807
2947
|
}),
|
|
2808
2948
|
z && shift({
|
|
2809
2949
|
mainAxis: !0,
|
|
2810
2950
|
crossAxis: !1,
|
|
2811
2951
|
limiter: U === "partial" ? limitShift() : void 0,
|
|
2812
|
-
...
|
|
2952
|
+
...tM
|
|
2813
2953
|
}),
|
|
2814
|
-
z && flip({ ...
|
|
2954
|
+
z && flip({ ...tM }),
|
|
2815
2955
|
size({
|
|
2816
|
-
...
|
|
2956
|
+
...tM,
|
|
2817
2957
|
apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
|
|
2818
2958
|
let { width: A, height: j } = _.reference, M = n.floating.style;
|
|
2819
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`);
|
|
2820
2960
|
}
|
|
2821
2961
|
}),
|
|
2822
|
-
|
|
2823
|
-
element:
|
|
2962
|
+
Gj && arrow({
|
|
2963
|
+
element: Gj,
|
|
2824
2964
|
padding: P
|
|
2825
2965
|
}),
|
|
2826
2966
|
transformOrigin({
|
|
2827
|
-
arrowWidth:
|
|
2828
|
-
arrowHeight:
|
|
2967
|
+
arrowWidth: Jj,
|
|
2968
|
+
arrowHeight: Xj
|
|
2829
2969
|
}),
|
|
2830
2970
|
W && hide({
|
|
2831
2971
|
strategy: "referenceHidden",
|
|
2832
|
-
...
|
|
2972
|
+
...tM
|
|
2833
2973
|
})
|
|
2834
2974
|
]
|
|
2835
|
-
}), [
|
|
2975
|
+
}), [sM, cM] = getSideAndAlignFromPlacement(iM), lM = useCallbackRef(Z);
|
|
2836
2976
|
useLayoutEffect2(() => {
|
|
2837
|
-
|
|
2838
|
-
}, [
|
|
2839
|
-
let
|
|
2977
|
+
aM && lM?.();
|
|
2978
|
+
}, [aM, lM]);
|
|
2979
|
+
let uM = oM.arrow?.x, dM = oM.arrow?.y, fM = oM.arrow?.centerOffset !== 0, [pM, mM] = React$1.useState();
|
|
2840
2980
|
return useLayoutEffect2(() => {
|
|
2841
|
-
|
|
2842
|
-
}, [
|
|
2843
|
-
ref:
|
|
2981
|
+
Hj && mM(window.getComputedStyle(Hj).zIndex);
|
|
2982
|
+
}, [Hj]), /* @__PURE__ */ jsx("div", {
|
|
2983
|
+
ref: nM.setFloating,
|
|
2844
2984
|
"data-radix-popper-content-wrapper": "",
|
|
2845
2985
|
style: {
|
|
2846
|
-
...
|
|
2847
|
-
transform:
|
|
2986
|
+
...rM,
|
|
2987
|
+
transform: aM ? rM.transform : "translate(0, -200%)",
|
|
2848
2988
|
minWidth: "max-content",
|
|
2849
|
-
zIndex:
|
|
2850
|
-
"--radix-popper-transform-origin": [
|
|
2851
|
-
...
|
|
2989
|
+
zIndex: pM,
|
|
2990
|
+
"--radix-popper-transform-origin": [oM.transformOrigin?.x, oM.transformOrigin?.y].join(" "),
|
|
2991
|
+
...oM.hide?.referenceHidden && {
|
|
2852
2992
|
visibility: "hidden",
|
|
2853
2993
|
pointerEvents: "none"
|
|
2854
2994
|
}
|
|
@@ -2856,19 +2996,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
2856
2996
|
dir: _.dir,
|
|
2857
2997
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
2858
2998
|
scope: O,
|
|
2859
|
-
placedSide:
|
|
2860
|
-
onArrowChange:
|
|
2861
|
-
arrowX:
|
|
2862
|
-
arrowY:
|
|
2863
|
-
shouldHideArrow:
|
|
2999
|
+
placedSide: sM,
|
|
3000
|
+
onArrowChange: Kj,
|
|
3001
|
+
arrowX: uM,
|
|
3002
|
+
arrowY: dM,
|
|
3003
|
+
shouldHideArrow: fM,
|
|
2864
3004
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
2865
|
-
"data-side":
|
|
2866
|
-
"data-align":
|
|
2867
|
-
...
|
|
2868
|
-
ref:
|
|
3005
|
+
"data-side": sM,
|
|
3006
|
+
"data-align": cM,
|
|
3007
|
+
...Bj,
|
|
3008
|
+
ref: Wj,
|
|
2869
3009
|
style: {
|
|
2870
|
-
...
|
|
2871
|
-
animation:
|
|
3010
|
+
...Bj.style,
|
|
3011
|
+
animation: aM ? void 0 : "none"
|
|
2872
3012
|
}
|
|
2873
3013
|
})
|
|
2874
3014
|
})
|
|
@@ -2951,27 +3091,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
|
|
|
2951
3091
|
}));
|
|
2952
3092
|
RovingFocusGroup.displayName = GROUP_NAME$3;
|
|
2953
3093
|
var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
2954
|
-
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), [Bj, Vj] = useControllableState({
|
|
2955
3095
|
prop: N,
|
|
2956
3096
|
defaultProp: P ?? null,
|
|
2957
3097
|
onChange: z,
|
|
2958
3098
|
caller: GROUP_NAME$3
|
|
2959
|
-
}), [
|
|
3099
|
+
}), [Hj, Uj] = React$1.useState(!1), Wj = useCallbackRef(B), Gj = useCollection$1(O), Kj = React$1.useRef(!1), [qj, Jj] = React$1.useState(0);
|
|
2960
3100
|
return React$1.useEffect(() => {
|
|
2961
3101
|
let n = W.current;
|
|
2962
|
-
if (n) return n.addEventListener(ENTRY_FOCUS,
|
|
2963
|
-
}, [
|
|
3102
|
+
if (n) return n.addEventListener(ENTRY_FOCUS, Wj), () => n.removeEventListener(ENTRY_FOCUS, Wj);
|
|
3103
|
+
}, [Wj]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
2964
3104
|
scope: O,
|
|
2965
3105
|
orientation: A,
|
|
2966
3106
|
dir: Z,
|
|
2967
3107
|
loop: j,
|
|
2968
|
-
currentTabStopId:
|
|
2969
|
-
onItemFocus: React$1.useCallback((n) =>
|
|
2970
|
-
onItemShiftTab: React$1.useCallback(() =>
|
|
2971
|
-
onFocusableItemAdd: React$1.useCallback(() =>
|
|
2972
|
-
onFocusableItemRemove: React$1.useCallback(() =>
|
|
3108
|
+
currentTabStopId: Bj,
|
|
3109
|
+
onItemFocus: React$1.useCallback((n) => Vj(n), [Vj]),
|
|
3110
|
+
onItemShiftTab: React$1.useCallback(() => Uj(!0), []),
|
|
3111
|
+
onFocusableItemAdd: React$1.useCallback(() => Jj((n) => n + 1), []),
|
|
3112
|
+
onFocusableItemRemove: React$1.useCallback(() => Jj((n) => n - 1), []),
|
|
2973
3113
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
2974
|
-
tabIndex:
|
|
3114
|
+
tabIndex: Hj || qj === 0 ? -1 : 0,
|
|
2975
3115
|
"data-orientation": A,
|
|
2976
3116
|
...U,
|
|
2977
3117
|
ref: G,
|
|
@@ -2980,28 +3120,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
2980
3120
|
..._.style
|
|
2981
3121
|
},
|
|
2982
3122
|
onMouseDown: composeEventHandlers(_.onMouseDown, () => {
|
|
2983
|
-
|
|
3123
|
+
Kj.current = !0;
|
|
2984
3124
|
}),
|
|
2985
3125
|
onFocus: composeEventHandlers(_.onFocus, (n) => {
|
|
2986
|
-
let _ = !
|
|
2987
|
-
if (n.target === n.currentTarget && _ && !
|
|
3126
|
+
let _ = !Kj.current;
|
|
3127
|
+
if (n.target === n.currentTarget && _ && !Hj) {
|
|
2988
3128
|
let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
2989
3129
|
if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
|
|
2990
|
-
let n =
|
|
3130
|
+
let n = Gj().filter((n) => n.focusable);
|
|
2991
3131
|
focusFirst$1([
|
|
2992
3132
|
n.find((n) => n.active),
|
|
2993
|
-
n.find((n) => n.id ===
|
|
3133
|
+
n.find((n) => n.id === Bj),
|
|
2994
3134
|
...n
|
|
2995
3135
|
].filter(Boolean).map((n) => n.ref.current), H);
|
|
2996
3136
|
}
|
|
2997
3137
|
}
|
|
2998
|
-
|
|
3138
|
+
Kj.current = !1;
|
|
2999
3139
|
}),
|
|
3000
|
-
onBlur: composeEventHandlers(_.onBlur, () =>
|
|
3140
|
+
onBlur: composeEventHandlers(_.onBlur, () => Uj(!1))
|
|
3001
3141
|
})
|
|
3002
3142
|
});
|
|
3003
3143
|
}), ITEM_NAME$3 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((_, E) => {
|
|
3004
|
-
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: Bj } = H;
|
|
3005
3145
|
return React$1.useEffect(() => {
|
|
3006
3146
|
if (A) return G(), () => Z();
|
|
3007
3147
|
}, [
|
|
@@ -3044,7 +3184,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
|
|
|
3044
3184
|
}),
|
|
3045
3185
|
children: typeof N == "function" ? N({
|
|
3046
3186
|
isCurrentTabStop: U,
|
|
3047
|
-
hasTabStop:
|
|
3187
|
+
hasTabStop: Bj != null
|
|
3048
3188
|
}) : N
|
|
3049
3189
|
})
|
|
3050
3190
|
});
|
|
@@ -3195,40 +3335,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3195
3335
|
onDismiss: () => E.onOpenChange(!1)
|
|
3196
3336
|
});
|
|
3197
3337
|
}), Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((_, E) => {
|
|
3198
|
-
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, ...Bj } = _, Vj = useMenuContext(CONTENT_NAME$5, O), Hj = useMenuRootContext(CONTENT_NAME$5, O), Uj = usePopperScope$2(O), Wj = useRovingFocusGroupScope$1(O), Gj = useCollection(O), [Kj, qj] = React$1.useState(null), Jj = React$1.useRef(null), Xj = useComposedRefs$1(E, Jj, Vj.onContentChange), Zj = React$1.useRef(0), Qj = React$1.useRef(""), $j = React$1.useRef(0), eM = React$1.useRef(null), tM = React$1.useRef("right"), nM = React$1.useRef(0), rM = Z ? Combination_default : React$1.Fragment, iM = Z ? {
|
|
3199
3339
|
as: Slot$1,
|
|
3200
3340
|
allowPinchZoom: !0
|
|
3201
|
-
} : void 0,
|
|
3202
|
-
let _ =
|
|
3341
|
+
} : void 0, aM = (n) => {
|
|
3342
|
+
let _ = Qj.current + n, E = Gj().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;
|
|
3203
3343
|
(function n(_) {
|
|
3204
|
-
|
|
3344
|
+
Qj.current = _, window.clearTimeout(Zj.current), _ !== "" && (Zj.current = window.setTimeout(() => n(""), 1e3));
|
|
3205
3345
|
})(_), M && setTimeout(() => M.focus());
|
|
3206
3346
|
};
|
|
3207
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
3208
|
-
let
|
|
3347
|
+
React$1.useEffect(() => () => window.clearTimeout(Zj.current), []), useFocusGuards();
|
|
3348
|
+
let oM = React$1.useCallback((n) => tM.current === eM.current?.side && isPointerInGraceArea(n, eM.current?.area), []);
|
|
3209
3349
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
3210
3350
|
scope: O,
|
|
3211
|
-
searchRef:
|
|
3351
|
+
searchRef: Qj,
|
|
3212
3352
|
onItemEnter: React$1.useCallback((n) => {
|
|
3213
|
-
|
|
3214
|
-
}, [
|
|
3353
|
+
oM(n) && n.preventDefault();
|
|
3354
|
+
}, [oM]),
|
|
3215
3355
|
onItemLeave: React$1.useCallback((n) => {
|
|
3216
|
-
|
|
3217
|
-
}, [
|
|
3356
|
+
oM(n) || (Jj.current?.focus(), qj(null));
|
|
3357
|
+
}, [oM]),
|
|
3218
3358
|
onTriggerLeave: React$1.useCallback((n) => {
|
|
3219
|
-
|
|
3220
|
-
}, [
|
|
3221
|
-
pointerGraceTimerRef:
|
|
3359
|
+
oM(n) && n.preventDefault();
|
|
3360
|
+
}, [oM]),
|
|
3361
|
+
pointerGraceTimerRef: $j,
|
|
3222
3362
|
onPointerGraceIntentChange: React$1.useCallback((n) => {
|
|
3223
|
-
|
|
3363
|
+
eM.current = n;
|
|
3224
3364
|
}, []),
|
|
3225
|
-
children: /* @__PURE__ */ jsx(
|
|
3226
|
-
...
|
|
3365
|
+
children: /* @__PURE__ */ jsx(rM, {
|
|
3366
|
+
...iM,
|
|
3227
3367
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
3228
3368
|
asChild: !0,
|
|
3229
3369
|
trapped: j,
|
|
3230
3370
|
onMountAutoFocus: composeEventHandlers(M, (n) => {
|
|
3231
|
-
n.preventDefault(),
|
|
3371
|
+
n.preventDefault(), Jj.current?.focus({ preventScroll: !0 });
|
|
3232
3372
|
}),
|
|
3233
3373
|
onUnmountAutoFocus: N,
|
|
3234
3374
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3241,44 +3381,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3241
3381
|
onDismiss: G,
|
|
3242
3382
|
children: /* @__PURE__ */ jsx(Root$2, {
|
|
3243
3383
|
asChild: !0,
|
|
3244
|
-
...
|
|
3245
|
-
dir:
|
|
3384
|
+
...Wj,
|
|
3385
|
+
dir: Hj.dir,
|
|
3246
3386
|
orientation: "vertical",
|
|
3247
3387
|
loop: A,
|
|
3248
|
-
currentTabStopId:
|
|
3249
|
-
onCurrentTabStopIdChange:
|
|
3388
|
+
currentTabStopId: Kj,
|
|
3389
|
+
onCurrentTabStopIdChange: qj,
|
|
3250
3390
|
onEntryFocus: composeEventHandlers(z, (n) => {
|
|
3251
|
-
|
|
3391
|
+
Hj.isUsingKeyboardRef.current || n.preventDefault();
|
|
3252
3392
|
}),
|
|
3253
3393
|
preventScrollOnEntryFocus: !0,
|
|
3254
3394
|
children: /* @__PURE__ */ jsx(Content$1, {
|
|
3255
3395
|
role: "menu",
|
|
3256
3396
|
"aria-orientation": "vertical",
|
|
3257
|
-
"data-state": getOpenState(
|
|
3397
|
+
"data-state": getOpenState(Vj.open),
|
|
3258
3398
|
"data-radix-menu-content": "",
|
|
3259
|
-
dir:
|
|
3260
|
-
...
|
|
3261
|
-
...
|
|
3262
|
-
ref:
|
|
3399
|
+
dir: Hj.dir,
|
|
3400
|
+
...Uj,
|
|
3401
|
+
...Bj,
|
|
3402
|
+
ref: Xj,
|
|
3263
3403
|
style: {
|
|
3264
3404
|
outline: "none",
|
|
3265
|
-
...
|
|
3405
|
+
...Bj.style
|
|
3266
3406
|
},
|
|
3267
|
-
onKeyDown: composeEventHandlers(
|
|
3407
|
+
onKeyDown: composeEventHandlers(Bj.onKeyDown, (n) => {
|
|
3268
3408
|
let _ = n.target.closest("[data-radix-menu-content]") === n.currentTarget, E = n.ctrlKey || n.altKey || n.metaKey, O = n.key.length === 1;
|
|
3269
|
-
_ && (n.key === "Tab" && n.preventDefault(), !E && O &&
|
|
3270
|
-
let A =
|
|
3409
|
+
_ && (n.key === "Tab" && n.preventDefault(), !E && O && aM(n.key));
|
|
3410
|
+
let A = Jj.current;
|
|
3271
3411
|
if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
|
|
3272
3412
|
n.preventDefault();
|
|
3273
|
-
let j =
|
|
3413
|
+
let j = Gj().filter((n) => !n.disabled).map((n) => n.ref.current);
|
|
3274
3414
|
LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
|
|
3275
3415
|
}),
|
|
3276
3416
|
onBlur: composeEventHandlers(_.onBlur, (n) => {
|
|
3277
|
-
n.currentTarget.contains(n.target) || (window.clearTimeout(
|
|
3417
|
+
n.currentTarget.contains(n.target) || (window.clearTimeout(Zj.current), Qj.current = "");
|
|
3278
3418
|
}),
|
|
3279
3419
|
onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
|
|
3280
|
-
let _ = n.target, E =
|
|
3281
|
-
n.currentTarget.contains(_) && E && (
|
|
3420
|
+
let _ = n.target, E = nM.current !== n.clientX;
|
|
3421
|
+
n.currentTarget.contains(_) && E && (tM.current = n.clientX > nM.current ? "right" : "left", nM.current = n.clientX);
|
|
3282
3422
|
}))
|
|
3283
3423
|
})
|
|
3284
3424
|
})
|
|
@@ -4226,11 +4366,11 @@ function useStateMachine(_, E) {
|
|
|
4226
4366
|
return React$1.useReducer((n, _) => E[n][_] ?? n, _);
|
|
4227
4367
|
}
|
|
4228
4368
|
var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((_, E) => {
|
|
4229
|
-
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), [Bj, Vj] = React$1.useState(null), [Hj, Uj] = React$1.useState(0), [Wj, Gj] = React$1.useState(0), [Kj, qj] = React$1.useState(!1), [Jj, Xj] = React$1.useState(!1), Zj = useComposedRefs$1(E, (n) => z(n)), Qj = useDirection(j);
|
|
4230
4370
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
4231
4371
|
scope: O,
|
|
4232
4372
|
type: A,
|
|
4233
|
-
dir:
|
|
4373
|
+
dir: Qj,
|
|
4234
4374
|
scrollHideDelay: M,
|
|
4235
4375
|
scrollArea: P,
|
|
4236
4376
|
viewport: B,
|
|
@@ -4239,22 +4379,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
|
|
|
4239
4379
|
onContentChange: W,
|
|
4240
4380
|
scrollbarX: G,
|
|
4241
4381
|
onScrollbarXChange: Z,
|
|
4242
|
-
scrollbarXEnabled:
|
|
4243
|
-
onScrollbarXEnabledChange:
|
|
4244
|
-
scrollbarY:
|
|
4245
|
-
onScrollbarYChange:
|
|
4246
|
-
scrollbarYEnabled:
|
|
4247
|
-
onScrollbarYEnabledChange:
|
|
4248
|
-
onCornerWidthChange:
|
|
4249
|
-
onCornerHeightChange:
|
|
4382
|
+
scrollbarXEnabled: Kj,
|
|
4383
|
+
onScrollbarXEnabledChange: qj,
|
|
4384
|
+
scrollbarY: Bj,
|
|
4385
|
+
onScrollbarYChange: Vj,
|
|
4386
|
+
scrollbarYEnabled: Jj,
|
|
4387
|
+
onScrollbarYEnabledChange: Xj,
|
|
4388
|
+
onCornerWidthChange: Uj,
|
|
4389
|
+
onCornerHeightChange: Gj,
|
|
4250
4390
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4251
|
-
dir:
|
|
4391
|
+
dir: Qj,
|
|
4252
4392
|
...N,
|
|
4253
|
-
ref:
|
|
4393
|
+
ref: Zj,
|
|
4254
4394
|
style: {
|
|
4255
4395
|
position: "relative",
|
|
4256
|
-
"--radix-scroll-area-corner-width":
|
|
4257
|
-
"--radix-scroll-area-corner-height":
|
|
4396
|
+
"--radix-scroll-area-corner-width": Hj + "px",
|
|
4397
|
+
"--radix-scroll-area-corner-height": Wj + "px",
|
|
4258
4398
|
..._.style
|
|
4259
4399
|
}
|
|
4260
4400
|
})
|
|
@@ -4525,46 +4665,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
|
|
|
4525
4665
|
}
|
|
4526
4666
|
});
|
|
4527
4667
|
}), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((_, E) => {
|
|
4528
|
-
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,
|
|
4529
|
-
function
|
|
4530
|
-
|
|
4531
|
-
x: n.clientX -
|
|
4532
|
-
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, Bj] = React$1.useState(null), Vj = useComposedRefs$1(E, (n) => Bj(n)), Hj = React$1.useRef(null), Uj = React$1.useRef(""), Wj = G.viewport, Gj = A.content - A.viewport, Kj = useCallbackRef(H), qj = useCallbackRef(z), Jj = useDebounceCallback(U, 10);
|
|
4669
|
+
function Xj(n) {
|
|
4670
|
+
Hj.current && B({
|
|
4671
|
+
x: n.clientX - Hj.current.left,
|
|
4672
|
+
y: n.clientY - Hj.current.top
|
|
4533
4673
|
});
|
|
4534
4674
|
}
|
|
4535
4675
|
return React$1.useEffect(() => {
|
|
4536
4676
|
let n = (n) => {
|
|
4537
4677
|
let _ = n.target;
|
|
4538
|
-
Z?.contains(_) &&
|
|
4678
|
+
Z?.contains(_) && Kj(n, Gj);
|
|
4539
4679
|
};
|
|
4540
4680
|
return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
|
|
4541
4681
|
}, [
|
|
4542
|
-
|
|
4682
|
+
Wj,
|
|
4543
4683
|
Z,
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
]), React$1.useEffect(
|
|
4684
|
+
Gj,
|
|
4685
|
+
Kj
|
|
4686
|
+
]), React$1.useEffect(qj, [A, qj]), useResizeObserver(Z, Jj), useResizeObserver(G.content, Jj), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4547
4687
|
scope: O,
|
|
4548
4688
|
scrollbar: Z,
|
|
4549
4689
|
hasThumb: j,
|
|
4550
4690
|
onThumbChange: useCallbackRef(M),
|
|
4551
4691
|
onThumbPointerUp: useCallbackRef(N),
|
|
4552
|
-
onThumbPositionChange:
|
|
4692
|
+
onThumbPositionChange: qj,
|
|
4553
4693
|
onThumbPointerDown: useCallbackRef(P),
|
|
4554
4694
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4555
4695
|
...W,
|
|
4556
|
-
ref:
|
|
4696
|
+
ref: Vj,
|
|
4557
4697
|
style: {
|
|
4558
4698
|
position: "absolute",
|
|
4559
4699
|
...W.style
|
|
4560
4700
|
},
|
|
4561
4701
|
onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
|
|
4562
|
-
n.button === 0 && (n.target.setPointerCapture(n.pointerId),
|
|
4702
|
+
n.button === 0 && (n.target.setPointerCapture(n.pointerId), Hj.current = Z.getBoundingClientRect(), Uj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), Xj(n));
|
|
4563
4703
|
}),
|
|
4564
|
-
onPointerMove: composeEventHandlers(_.onPointerMove,
|
|
4704
|
+
onPointerMove: composeEventHandlers(_.onPointerMove, Xj),
|
|
4565
4705
|
onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
|
|
4566
4706
|
let _ = n.target;
|
|
4567
|
-
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect =
|
|
4707
|
+
_.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Uj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), Hj.current = null;
|
|
4568
4708
|
})
|
|
4569
4709
|
})
|
|
4570
4710
|
});
|
|
@@ -4706,7 +4846,7 @@ function useResizeObserver(n, _) {
|
|
|
4706
4846
|
}, [n, E]);
|
|
4707
4847
|
}
|
|
4708
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) => {
|
|
4709
|
-
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)), Bj = React$1.useRef(!1), Vj = W ? H || !!W.closest("form") : !0, [Hj, Uj] = useControllableState({
|
|
4710
4850
|
prop: j,
|
|
4711
4851
|
defaultProp: M ?? !1,
|
|
4712
4852
|
onChange: B,
|
|
@@ -4714,28 +4854,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
|
|
|
4714
4854
|
});
|
|
4715
4855
|
return /* @__PURE__ */ jsxs(SwitchProvider, {
|
|
4716
4856
|
scope: O,
|
|
4717
|
-
checked:
|
|
4857
|
+
checked: Hj,
|
|
4718
4858
|
disabled: P,
|
|
4719
4859
|
children: [/* @__PURE__ */ jsx(Primitive.button, {
|
|
4720
4860
|
type: "button",
|
|
4721
4861
|
role: "switch",
|
|
4722
|
-
"aria-checked":
|
|
4862
|
+
"aria-checked": Hj,
|
|
4723
4863
|
"aria-required": N,
|
|
4724
|
-
"data-state": getState(
|
|
4864
|
+
"data-state": getState(Hj),
|
|
4725
4865
|
"data-disabled": P ? "" : void 0,
|
|
4726
4866
|
disabled: P,
|
|
4727
4867
|
value: z,
|
|
4728
4868
|
...U,
|
|
4729
4869
|
ref: Z,
|
|
4730
4870
|
onClick: composeEventHandlers(_.onClick, (n) => {
|
|
4731
|
-
|
|
4871
|
+
Uj((n) => !n), Vj && (Bj.current = n.isPropagationStopped(), Bj.current || n.stopPropagation());
|
|
4732
4872
|
})
|
|
4733
|
-
}),
|
|
4873
|
+
}), Vj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
|
|
4734
4874
|
control: W,
|
|
4735
|
-
bubbles: !
|
|
4875
|
+
bubbles: !Bj.current,
|
|
4736
4876
|
name: A,
|
|
4737
4877
|
value: z,
|
|
4738
|
-
checked:
|
|
4878
|
+
checked: Hj,
|
|
4739
4879
|
required: N,
|
|
4740
4880
|
disabled: P,
|
|
4741
4881
|
form: H,
|
|
@@ -4919,22 +5059,22 @@ var Root2 = Tabs, List = TabsList, Trigger = TabsTrigger, Content = TabsContent,
|
|
|
4919
5059
|
};
|
|
4920
5060
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
4921
5061
|
var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (_) => {
|
|
4922
|
-
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, Bj = P ?? z.delayDuration, Vj = React$1.useRef(!1), [Hj, Uj] = useControllableState({
|
|
4923
5063
|
prop: A,
|
|
4924
5064
|
defaultProp: j ?? !1,
|
|
4925
5065
|
onChange: (n) => {
|
|
4926
5066
|
n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
|
|
4927
5067
|
},
|
|
4928
5068
|
caller: TOOLTIP_NAME
|
|
4929
|
-
}),
|
|
4930
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
4931
|
-
}, [
|
|
4932
|
-
window.clearTimeout(G.current), G.current = 0,
|
|
4933
|
-
}, [
|
|
5069
|
+
}), Wj = React$1.useMemo(() => Hj ? Vj.current ? "delayed-open" : "instant-open" : "closed", [Hj]), Gj = React$1.useCallback(() => {
|
|
5070
|
+
window.clearTimeout(G.current), G.current = 0, Vj.current = !1, Uj(!0);
|
|
5071
|
+
}, [Uj]), Kj = React$1.useCallback(() => {
|
|
5072
|
+
window.clearTimeout(G.current), G.current = 0, Uj(!1);
|
|
5073
|
+
}, [Uj]), qj = React$1.useCallback(() => {
|
|
4934
5074
|
window.clearTimeout(G.current), G.current = window.setTimeout(() => {
|
|
4935
|
-
|
|
4936
|
-
},
|
|
4937
|
-
}, [
|
|
5075
|
+
Vj.current = !0, Uj(!0), G.current = 0;
|
|
5076
|
+
}, Bj);
|
|
5077
|
+
}, [Bj, Uj]);
|
|
4938
5078
|
return React$1.useEffect(() => () => {
|
|
4939
5079
|
G.current &&= (window.clearTimeout(G.current), 0);
|
|
4940
5080
|
}, []), /* @__PURE__ */ jsx(Root2$4, {
|
|
@@ -4942,22 +5082,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
|
|
|
4942
5082
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
4943
5083
|
scope: E,
|
|
4944
5084
|
contentId: W,
|
|
4945
|
-
open:
|
|
4946
|
-
stateAttribute:
|
|
5085
|
+
open: Hj,
|
|
5086
|
+
stateAttribute: Wj,
|
|
4947
5087
|
trigger: H,
|
|
4948
5088
|
onTriggerChange: U,
|
|
4949
5089
|
onTriggerEnter: React$1.useCallback(() => {
|
|
4950
|
-
z.isOpenDelayedRef.current ?
|
|
5090
|
+
z.isOpenDelayedRef.current ? qj() : Gj();
|
|
4951
5091
|
}, [
|
|
4952
5092
|
z.isOpenDelayedRef,
|
|
4953
|
-
|
|
4954
|
-
|
|
5093
|
+
qj,
|
|
5094
|
+
Gj
|
|
4955
5095
|
]),
|
|
4956
5096
|
onTriggerLeave: React$1.useCallback(() => {
|
|
4957
|
-
Z ?
|
|
4958
|
-
}, [
|
|
4959
|
-
onOpen:
|
|
4960
|
-
onClose:
|
|
5097
|
+
Z ? Kj() : (window.clearTimeout(G.current), G.current = 0);
|
|
5098
|
+
}, [Kj, Z]),
|
|
5099
|
+
onOpen: Gj,
|
|
5100
|
+
onClose: Kj,
|
|
4961
5101
|
disableHoverableContent: Z,
|
|
4962
5102
|
children: O
|
|
4963
5103
|
})
|
|
@@ -5770,14 +5910,14 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5770
5910
|
React$1.useEffect(() => U(O), [O]);
|
|
5771
5911
|
let [W, G] = React$1.useState(A);
|
|
5772
5912
|
React$1.useEffect(() => G(A), [A]);
|
|
5773
|
-
let [Z,
|
|
5774
|
-
React$1.useEffect(() =>
|
|
5775
|
-
let [
|
|
5776
|
-
React$1.useEffect(() =>
|
|
5777
|
-
let [
|
|
5778
|
-
React$1.useEffect(() =>
|
|
5779
|
-
let [
|
|
5780
|
-
return React$1.useEffect(() =>
|
|
5913
|
+
let [Z, Bj] = React$1.useState(j);
|
|
5914
|
+
React$1.useEffect(() => Bj(j), [j]);
|
|
5915
|
+
let [Vj, Hj] = React$1.useState(M);
|
|
5916
|
+
React$1.useEffect(() => Hj(M), [M]);
|
|
5917
|
+
let [Uj, Wj] = React$1.useState(N);
|
|
5918
|
+
React$1.useEffect(() => Wj(N), [N]);
|
|
5919
|
+
let [Gj, Kj] = React$1.useState(P);
|
|
5920
|
+
return React$1.useEffect(() => Kj(P), [P]), React$1.createElement(A$2, {
|
|
5781
5921
|
...B,
|
|
5782
5922
|
ref: E,
|
|
5783
5923
|
isRoot: !0,
|
|
@@ -5785,62 +5925,62 @@ var I$3 = React$1.forwardRef((_, E) => {
|
|
|
5785
5925
|
appearance: H,
|
|
5786
5926
|
accentColor: W,
|
|
5787
5927
|
grayColor: Z,
|
|
5788
|
-
panelBackground:
|
|
5789
|
-
radius:
|
|
5790
|
-
scaling:
|
|
5928
|
+
panelBackground: Vj,
|
|
5929
|
+
radius: Uj,
|
|
5930
|
+
scaling: Gj,
|
|
5791
5931
|
onAppearanceChange: U,
|
|
5792
5932
|
onAccentColorChange: G,
|
|
5793
|
-
onGrayColorChange:
|
|
5794
|
-
onPanelBackgroundChange:
|
|
5795
|
-
onRadiusChange:
|
|
5796
|
-
onScalingChange:
|
|
5933
|
+
onGrayColorChange: Bj,
|
|
5934
|
+
onPanelBackgroundChange: Hj,
|
|
5935
|
+
onRadiusChange: Wj,
|
|
5936
|
+
onScalingChange: Kj
|
|
5797
5937
|
});
|
|
5798
5938
|
});
|
|
5799
5939
|
I$3.displayName = "ThemeRoot";
|
|
5800
5940
|
var A$2 = React$1.forwardRef((_, E) => {
|
|
5801
|
-
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: Bj = d$5, onRadiusChange: Vj = d$5, onScalingChange: Hj = d$5, ...Uj } = _, Wj = A ? Slot$3 : "div", Gj = z === "auto" ? a$12(P) : z, Kj = _.appearance === "light" || _.appearance === "dark", qj = M === void 0 ? j || Kj : M;
|
|
5802
5942
|
return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
|
|
5803
5943
|
appearance: N,
|
|
5804
5944
|
accentColor: P,
|
|
5805
5945
|
grayColor: z,
|
|
5806
|
-
resolvedGrayColor:
|
|
5946
|
+
resolvedGrayColor: Gj,
|
|
5807
5947
|
panelBackground: B,
|
|
5808
5948
|
radius: H,
|
|
5809
5949
|
scaling: U,
|
|
5810
5950
|
onAppearanceChange: W,
|
|
5811
5951
|
onAccentColorChange: G,
|
|
5812
5952
|
onGrayColorChange: Z,
|
|
5813
|
-
onPanelBackgroundChange:
|
|
5814
|
-
onRadiusChange:
|
|
5815
|
-
onScalingChange:
|
|
5953
|
+
onPanelBackgroundChange: Bj,
|
|
5954
|
+
onRadiusChange: Vj,
|
|
5955
|
+
onScalingChange: Hj
|
|
5816
5956
|
}), [
|
|
5817
5957
|
N,
|
|
5818
5958
|
P,
|
|
5819
5959
|
z,
|
|
5820
|
-
|
|
5960
|
+
Gj,
|
|
5821
5961
|
B,
|
|
5822
5962
|
H,
|
|
5823
5963
|
U,
|
|
5824
5964
|
W,
|
|
5825
5965
|
G,
|
|
5826
5966
|
Z,
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
]) }, React$1.createElement(
|
|
5967
|
+
Bj,
|
|
5968
|
+
Vj,
|
|
5969
|
+
Hj
|
|
5970
|
+
]) }, React$1.createElement(Wj, {
|
|
5831
5971
|
"data-is-root-theme": j ? "true" : "false",
|
|
5832
5972
|
"data-accent-color": P,
|
|
5833
|
-
"data-gray-color":
|
|
5834
|
-
"data-has-background":
|
|
5973
|
+
"data-gray-color": Gj,
|
|
5974
|
+
"data-has-background": qj ? "true" : "false",
|
|
5835
5975
|
"data-panel-background": B,
|
|
5836
5976
|
"data-radius": H,
|
|
5837
5977
|
"data-scaling": U,
|
|
5838
5978
|
ref: E,
|
|
5839
|
-
...
|
|
5979
|
+
...Uj,
|
|
5840
5980
|
className: (0, import_classnames$18.default)("radix-themes", {
|
|
5841
5981
|
light: N === "light",
|
|
5842
5982
|
dark: N === "dark"
|
|
5843
|
-
},
|
|
5983
|
+
}, Uj.className)
|
|
5844
5984
|
}));
|
|
5845
5985
|
});
|
|
5846
5986
|
A$2.displayName = "ThemeImpl";
|
|
@@ -6612,7 +6752,7 @@ function S$2(n) {
|
|
|
6612
6752
|
return [(0, import_classnames$10.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
|
|
6613
6753
|
}
|
|
6614
6754
|
var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((_, E) => {
|
|
6615
|
-
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: Bj = t$3.scrollbars.default, ...Vj } = O;
|
|
6616
6756
|
return React$1.createElement(Root$1, {
|
|
6617
6757
|
type: H,
|
|
6618
6758
|
scrollHideDelay: U,
|
|
@@ -6623,10 +6763,10 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6623
6763
|
asChild: N,
|
|
6624
6764
|
children: P
|
|
6625
6765
|
}, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
6626
|
-
...
|
|
6766
|
+
...Vj,
|
|
6627
6767
|
ref: E,
|
|
6628
6768
|
className: "rt-ScrollAreaViewport"
|
|
6629
|
-
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
6769
|
+
}, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Bj === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
6630
6770
|
"data-radius": Z,
|
|
6631
6771
|
orientation: "horizontal",
|
|
6632
6772
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6634,7 +6774,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6634
6774
|
value: G,
|
|
6635
6775
|
propValues: t$3.size.values
|
|
6636
6776
|
}))
|
|
6637
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6777
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Bj === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
6638
6778
|
"data-radius": Z,
|
|
6639
6779
|
orientation: "vertical",
|
|
6640
6780
|
className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
|
|
@@ -6642,7 +6782,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
6642
6782
|
value: G,
|
|
6643
6783
|
propValues: t$3.size.values
|
|
6644
6784
|
}))
|
|
6645
|
-
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })),
|
|
6785
|
+
}, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Bj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
6646
6786
|
});
|
|
6647
6787
|
c.displayName = "ScrollArea";
|
|
6648
6788
|
var n$2 = {
|
|
@@ -7845,17 +7985,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
7845
7985
|
E.forEach((n) => {
|
|
7846
7986
|
let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
|
|
7847
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;
|
|
7848
|
-
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout:
|
|
7849
|
-
if (Z && W &&
|
|
7988
|
+
let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Bj, separatorToPanels: Vj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
|
|
7989
|
+
if (Z && W && Bj && Vj) {
|
|
7850
7990
|
let _ = Z$1({
|
|
7851
7991
|
delta: U,
|
|
7852
7992
|
initialLayout: W,
|
|
7853
7993
|
panelConstraints: Z,
|
|
7854
7994
|
pivotIndices: n.panels.map((n) => H.indexOf(n)),
|
|
7855
|
-
prevLayout:
|
|
7995
|
+
prevLayout: Bj,
|
|
7856
7996
|
trigger: "mouse-or-touch"
|
|
7857
7997
|
});
|
|
7858
|
-
if (B$1(_,
|
|
7998
|
+
if (B$1(_, Bj)) {
|
|
7859
7999
|
if (U !== 0 && !z) switch (B) {
|
|
7860
8000
|
case "horizontal":
|
|
7861
8001
|
M |= U < 0 ? De : Oe$1;
|
|
@@ -7869,7 +8009,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
|
|
|
7869
8009
|
defaultLayoutDeferred: G,
|
|
7870
8010
|
derivedPanelConstraints: Z,
|
|
7871
8011
|
layout: _,
|
|
7872
|
-
separatorToPanels:
|
|
8012
|
+
separatorToPanels: Vj
|
|
7873
8013
|
});
|
|
7874
8014
|
let E = n.group.panels.map(({ id: n }) => n).join(",");
|
|
7875
8015
|
n.group.inMemoryLayouts[E] = _;
|
|
@@ -8081,64 +8221,64 @@ function Pt(n, _) {
|
|
|
8081
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 }) {
|
|
8082
8222
|
let U = useRef({}), G = le$1((n) => {
|
|
8083
8223
|
B$1(U.current, n) || (U.current = n, P?.(n));
|
|
8084
|
-
}), Z = ae$1(N),
|
|
8224
|
+
}), Z = ae$1(N), Bj = useRef(null), [Vj, Gj] = useState(!1), [Kj, qj] = useState(E ?? {}), [Jj, Xj] = wt(), Zj = useRef({
|
|
8085
8225
|
lastExpandedPanelSizes: {},
|
|
8086
8226
|
layouts: {},
|
|
8087
8227
|
panels: [],
|
|
8088
8228
|
separators: []
|
|
8089
|
-
}),
|
|
8229
|
+
}), Qj = ue$1(Bj, j);
|
|
8090
8230
|
Pt(Z, M);
|
|
8091
|
-
let
|
|
8231
|
+
let $j = useMemo(() => ({
|
|
8092
8232
|
id: Z,
|
|
8093
8233
|
orientation: z,
|
|
8094
8234
|
registerPanel: (n) => {
|
|
8095
|
-
let _ =
|
|
8096
|
-
return _.panels = ie$1(z, [..._.panels, n]),
|
|
8097
|
-
_.panels = _.panels.filter((_) => _ !== n),
|
|
8235
|
+
let _ = Zj.current;
|
|
8236
|
+
return _.panels = ie$1(z, [..._.panels, n]), Xj(), () => {
|
|
8237
|
+
_.panels = _.panels.filter((_) => _ !== n), Xj();
|
|
8098
8238
|
};
|
|
8099
8239
|
},
|
|
8100
8240
|
registerSeparator: (n) => {
|
|
8101
|
-
let _ =
|
|
8102
|
-
return _.separators = ie$1(z, [..._.separators, n]),
|
|
8103
|
-
_.separators = _.separators.filter((_) => _ !== n),
|
|
8241
|
+
let _ = Zj.current;
|
|
8242
|
+
return _.separators = ie$1(z, [..._.separators, n]), Xj(), () => {
|
|
8243
|
+
_.separators = _.separators.filter((_) => _ !== n), Xj();
|
|
8104
8244
|
};
|
|
8105
8245
|
}
|
|
8106
8246
|
}), [
|
|
8107
8247
|
Z,
|
|
8108
|
-
|
|
8248
|
+
Xj,
|
|
8109
8249
|
z
|
|
8110
|
-
]),
|
|
8250
|
+
]), eM = Lt({
|
|
8111
8251
|
defaultLayout: E,
|
|
8112
8252
|
disableCursor: O
|
|
8113
|
-
}),
|
|
8253
|
+
}), tM = useRef(null);
|
|
8114
8254
|
A$1(() => {
|
|
8115
|
-
let n =
|
|
8255
|
+
let n = Bj.current;
|
|
8116
8256
|
if (n === null) return;
|
|
8117
|
-
let _ =
|
|
8118
|
-
defaultLayout:
|
|
8119
|
-
disableCursor: !!
|
|
8257
|
+
let _ = Zj.current, E = {
|
|
8258
|
+
defaultLayout: eM.defaultLayout,
|
|
8259
|
+
disableCursor: !!eM.disableCursor,
|
|
8120
8260
|
disabled: !!A,
|
|
8121
8261
|
element: n,
|
|
8122
8262
|
id: Z,
|
|
8123
|
-
inMemoryLastExpandedPanelSizes:
|
|
8124
|
-
inMemoryLayouts:
|
|
8263
|
+
inMemoryLastExpandedPanelSizes: Zj.current.lastExpandedPanelSizes,
|
|
8264
|
+
inMemoryLayouts: Zj.current.layouts,
|
|
8125
8265
|
orientation: z,
|
|
8126
8266
|
panels: _.panels,
|
|
8127
8267
|
separators: _.separators
|
|
8128
8268
|
};
|
|
8129
|
-
|
|
8269
|
+
tM.current = E;
|
|
8130
8270
|
let O = bt(E), j = D$1().mountedGroups.get(E);
|
|
8131
8271
|
if (j) {
|
|
8132
8272
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
|
|
8133
|
-
!n && _.length > 0 && (
|
|
8273
|
+
!n && _.length > 0 && (qj(E), G?.(E));
|
|
8134
8274
|
}
|
|
8135
8275
|
let M = T$1.addListener("interactionStateChange", (n) => {
|
|
8136
8276
|
switch (n.state) {
|
|
8137
8277
|
case "active":
|
|
8138
|
-
|
|
8278
|
+
Gj(n.hitRegions.some((n) => n.group === E));
|
|
8139
8279
|
break;
|
|
8140
8280
|
default:
|
|
8141
|
-
|
|
8281
|
+
Gj(!1);
|
|
8142
8282
|
break;
|
|
8143
8283
|
}
|
|
8144
8284
|
}), N = T$1.addListener("mountedGroupsChange", (n) => {
|
|
@@ -8146,30 +8286,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8146
8286
|
if (_) {
|
|
8147
8287
|
let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
|
|
8148
8288
|
if (n || E.length === 0) return;
|
|
8149
|
-
|
|
8289
|
+
qj(O), G?.(O);
|
|
8150
8290
|
}
|
|
8151
8291
|
});
|
|
8152
8292
|
return () => {
|
|
8153
|
-
|
|
8293
|
+
tM.current = null, O(), M(), N();
|
|
8154
8294
|
};
|
|
8155
8295
|
}, [
|
|
8156
8296
|
A,
|
|
8157
8297
|
Z,
|
|
8158
8298
|
G,
|
|
8159
8299
|
z,
|
|
8160
|
-
|
|
8161
|
-
|
|
8300
|
+
Jj,
|
|
8301
|
+
eM
|
|
8162
8302
|
]), useEffect(() => {
|
|
8163
|
-
let n =
|
|
8303
|
+
let n = tM.current;
|
|
8164
8304
|
n && (n.defaultLayout = E, n.disableCursor = !!O);
|
|
8165
8305
|
});
|
|
8166
|
-
let
|
|
8167
|
-
for (let n in
|
|
8306
|
+
let nM = { [Fe]: Vj ? "none" : void 0 };
|
|
8307
|
+
for (let n in Kj) {
|
|
8168
8308
|
let _ = Ve(Z, n);
|
|
8169
|
-
|
|
8309
|
+
nM[_] = Kj[n];
|
|
8170
8310
|
}
|
|
8171
8311
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
8172
|
-
value:
|
|
8312
|
+
value: $j,
|
|
8173
8313
|
children: /* @__PURE__ */ jsx("div", {
|
|
8174
8314
|
...H,
|
|
8175
8315
|
"aria-orientation": z,
|
|
@@ -8177,13 +8317,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
|
|
|
8177
8317
|
"data-group": !0,
|
|
8178
8318
|
"data-testid": Z,
|
|
8179
8319
|
id: Z,
|
|
8180
|
-
ref:
|
|
8320
|
+
ref: Qj,
|
|
8181
8321
|
style: {
|
|
8182
8322
|
height: "100%",
|
|
8183
8323
|
width: "100%",
|
|
8184
8324
|
overflow: "hidden",
|
|
8185
8325
|
...B,
|
|
8186
|
-
...
|
|
8326
|
+
...nM,
|
|
8187
8327
|
display: "flex",
|
|
8188
8328
|
flexDirection: z === "horizontal" ? "row" : "column",
|
|
8189
8329
|
flexWrap: "nowrap"
|
|
@@ -8301,12 +8441,12 @@ function It(n, _) {
|
|
|
8301
8441
|
});
|
|
8302
8442
|
}
|
|
8303
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 }) {
|
|
8304
|
-
let W = !!M, G = ae$1(M), Z = useRef(null),
|
|
8444
|
+
let W = !!M, G = ae$1(M), Z = useRef(null), Bj = ue$1(Z, j), { id: Vj, registerPanel: Hj } = ce$1(), Wj = z !== null, Gj = le$1((n, _, E) => {
|
|
8305
8445
|
z?.(n, M, E);
|
|
8306
8446
|
});
|
|
8307
8447
|
A$1(() => {
|
|
8308
8448
|
let n = Z.current;
|
|
8309
|
-
if (n !== null) return
|
|
8449
|
+
if (n !== null) return Hj({
|
|
8310
8450
|
element: n,
|
|
8311
8451
|
id: G,
|
|
8312
8452
|
idIsStable: W,
|
|
@@ -8314,7 +8454,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8314
8454
|
expandToSize: void 0,
|
|
8315
8455
|
prevSize: void 0
|
|
8316
8456
|
},
|
|
8317
|
-
onResize:
|
|
8457
|
+
onResize: Wj ? Gj : void 0,
|
|
8318
8458
|
panelConstraints: {
|
|
8319
8459
|
collapsedSize: E,
|
|
8320
8460
|
collapsible: O,
|
|
@@ -8327,25 +8467,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
|
|
|
8327
8467
|
E,
|
|
8328
8468
|
O,
|
|
8329
8469
|
A,
|
|
8330
|
-
|
|
8470
|
+
Wj,
|
|
8331
8471
|
G,
|
|
8332
8472
|
W,
|
|
8333
8473
|
N,
|
|
8334
8474
|
P,
|
|
8335
|
-
|
|
8336
|
-
|
|
8475
|
+
Gj,
|
|
8476
|
+
Hj
|
|
8337
8477
|
]), It(G, B);
|
|
8338
|
-
let
|
|
8478
|
+
let Kj = Ve(Vj, G);
|
|
8339
8479
|
return /* @__PURE__ */ jsx("div", {
|
|
8340
8480
|
...U,
|
|
8341
8481
|
"data-panel": !0,
|
|
8342
8482
|
"data-testid": G,
|
|
8343
8483
|
id: G,
|
|
8344
|
-
ref:
|
|
8484
|
+
ref: Bj,
|
|
8345
8485
|
style: {
|
|
8346
8486
|
...Gt,
|
|
8347
8487
|
flexBasis: 0,
|
|
8348
|
-
flexGrow: `var(${
|
|
8488
|
+
flexGrow: `var(${Kj}, 1)`,
|
|
8349
8489
|
flexShrink: 1,
|
|
8350
8490
|
overflow: "hidden",
|
|
8351
8491
|
pointerEvents: `var(${Fe})`
|
|
@@ -8408,7 +8548,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
|
|
|
8408
8548
|
};
|
|
8409
8549
|
}
|
|
8410
8550
|
function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j }) {
|
|
8411
|
-
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(), Bj = G === "horizontal" ? "vertical" : "horizontal";
|
|
8412
8552
|
return A$1(() => {
|
|
8413
8553
|
let n = H.current;
|
|
8414
8554
|
if (n !== null) {
|
|
@@ -8444,7 +8584,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
|
|
|
8444
8584
|
]), /* @__PURE__ */ jsx("div", {
|
|
8445
8585
|
...j,
|
|
8446
8586
|
"aria-controls": N.valueControls,
|
|
8447
|
-
"aria-orientation":
|
|
8587
|
+
"aria-orientation": Bj,
|
|
8448
8588
|
"aria-valuemax": N.valueMax,
|
|
8449
8589
|
"aria-valuemin": N.valueMin,
|
|
8450
8590
|
"aria-valuenow": N.valueNow,
|
|
@@ -8503,7 +8643,8 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8503
8643
|
theme: A,
|
|
8504
8644
|
history: [[]],
|
|
8505
8645
|
historyIndex: 0,
|
|
8506
|
-
clipboard: []
|
|
8646
|
+
clipboard: [],
|
|
8647
|
+
gridSize: 0
|
|
8507
8648
|
});
|
|
8508
8649
|
React.useEffect(() => {
|
|
8509
8650
|
j.availableFonts.forEach((n) => {
|
|
@@ -8532,6 +8673,11 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8532
8673
|
canvasHeight: n
|
|
8533
8674
|
}));
|
|
8534
8675
|
}, []), P = React.useCallback((n) => {
|
|
8676
|
+
M((_) => ({
|
|
8677
|
+
..._,
|
|
8678
|
+
gridSize: n
|
|
8679
|
+
}));
|
|
8680
|
+
}, []), z = React.useCallback((n) => {
|
|
8535
8681
|
M((_) => {
|
|
8536
8682
|
let E = n.elements || _.elements;
|
|
8537
8683
|
return {
|
|
@@ -8546,7 +8692,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8546
8692
|
clipboard: []
|
|
8547
8693
|
};
|
|
8548
8694
|
});
|
|
8549
|
-
}, []),
|
|
8695
|
+
}, []), B = React.useCallback(() => {
|
|
8550
8696
|
M((n) => {
|
|
8551
8697
|
if (n.historyIndex > 0) {
|
|
8552
8698
|
let _ = n.historyIndex - 1;
|
|
@@ -8559,7 +8705,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8559
8705
|
}
|
|
8560
8706
|
return n;
|
|
8561
8707
|
});
|
|
8562
|
-
}, []),
|
|
8708
|
+
}, []), H = React.useCallback(() => {
|
|
8563
8709
|
M((n) => {
|
|
8564
8710
|
if (n.historyIndex < n.history.length - 1) {
|
|
8565
8711
|
let _ = n.historyIndex + 1;
|
|
@@ -8572,7 +8718,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8572
8718
|
}
|
|
8573
8719
|
return n;
|
|
8574
8720
|
});
|
|
8575
|
-
}, []),
|
|
8721
|
+
}, []), U = React.useCallback(() => {
|
|
8576
8722
|
M((n) => {
|
|
8577
8723
|
if (n.selectedElementIds.length > 0) {
|
|
8578
8724
|
let _ = n.elements.filter((_) => n.selectedElementIds.includes(_.id));
|
|
@@ -8583,7 +8729,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8583
8729
|
}
|
|
8584
8730
|
return n;
|
|
8585
8731
|
});
|
|
8586
|
-
}, []),
|
|
8732
|
+
}, []), W = React.useCallback(() => {
|
|
8587
8733
|
M((n) => {
|
|
8588
8734
|
if (n.clipboard.length > 0) {
|
|
8589
8735
|
let _ = n.clipboard.map((n) => ({
|
|
@@ -8602,7 +8748,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8602
8748
|
}
|
|
8603
8749
|
return n;
|
|
8604
8750
|
});
|
|
8605
|
-
}, []),
|
|
8751
|
+
}, []), G = React.useCallback((n) => {
|
|
8606
8752
|
let _ = {};
|
|
8607
8753
|
n.type === "box" && (_.backgroundColor = "var(--gray-4)");
|
|
8608
8754
|
let E = {
|
|
@@ -8627,7 +8773,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8627
8773
|
selectedElementIds: [E.id]
|
|
8628
8774
|
};
|
|
8629
8775
|
});
|
|
8630
|
-
}, []),
|
|
8776
|
+
}, []), Z = React.useCallback((n) => {
|
|
8631
8777
|
M((_) => {
|
|
8632
8778
|
let E = _.elements.filter((_) => _.id !== n), O = _.history.slice(0, _.historyIndex + 1);
|
|
8633
8779
|
return O.push(E), {
|
|
@@ -8638,7 +8784,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8638
8784
|
historyIndex: O.length - 1
|
|
8639
8785
|
};
|
|
8640
8786
|
});
|
|
8641
|
-
}, []),
|
|
8787
|
+
}, []), Bj = React.useCallback(() => {
|
|
8642
8788
|
M((n) => {
|
|
8643
8789
|
if (n.selectedElementIds.length === 0) return n;
|
|
8644
8790
|
let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
|
|
@@ -8650,7 +8796,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8650
8796
|
historyIndex: E.length - 1
|
|
8651
8797
|
};
|
|
8652
8798
|
});
|
|
8653
|
-
}, []),
|
|
8799
|
+
}, []), Vj = React.useCallback((n, _ = !1) => {
|
|
8654
8800
|
M((E) => {
|
|
8655
8801
|
if (n === null) return {
|
|
8656
8802
|
...E,
|
|
@@ -8667,7 +8813,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8667
8813
|
selectedElementIds: [n]
|
|
8668
8814
|
};
|
|
8669
8815
|
});
|
|
8670
|
-
}, []),
|
|
8816
|
+
}, []), Hj = React.useCallback((n) => {
|
|
8817
|
+
M((_) => ({
|
|
8818
|
+
..._,
|
|
8819
|
+
selectedElementIds: n
|
|
8820
|
+
}));
|
|
8821
|
+
}, []), Uj = React.useCallback((n, _) => {
|
|
8671
8822
|
M((E) => {
|
|
8672
8823
|
let O = [...E.elements], A = O[n];
|
|
8673
8824
|
O.splice(n, 1), O.splice(_, 0, A);
|
|
@@ -8679,7 +8830,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8679
8830
|
historyIndex: j.length - 1
|
|
8680
8831
|
};
|
|
8681
8832
|
});
|
|
8682
|
-
}, []),
|
|
8833
|
+
}, []), Gj = React.useCallback((n, _, E = !0) => {
|
|
8683
8834
|
M((O) => {
|
|
8684
8835
|
let A = O.elements.map((E) => E.id === n ? {
|
|
8685
8836
|
...E,
|
|
@@ -8692,31 +8843,122 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8692
8843
|
historyIndex: M
|
|
8693
8844
|
};
|
|
8694
8845
|
});
|
|
8695
|
-
}, []),
|
|
8846
|
+
}, []), Kj = React.useCallback((n, _ = !0) => {
|
|
8696
8847
|
M((E) => {
|
|
8697
|
-
let O = [...E.elements];
|
|
8848
|
+
let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
|
|
8698
8849
|
n.forEach(({ id: n, changes: _ }) => {
|
|
8850
|
+
let O = E.elements.find((_) => _.id === n);
|
|
8851
|
+
if (O) if (O.groupId && (_.x !== void 0 || _.y !== void 0)) {
|
|
8852
|
+
let n = E.elements.find((n) => n.id === O.groupId);
|
|
8853
|
+
if (n && !j.has(n.id)) {
|
|
8854
|
+
let E = (_.x ?? O.x) - O.x, M = (_.y ?? O.y) - O.y;
|
|
8855
|
+
A.push({
|
|
8856
|
+
id: n.id,
|
|
8857
|
+
changes: {
|
|
8858
|
+
x: n.x + E,
|
|
8859
|
+
y: n.y + M
|
|
8860
|
+
}
|
|
8861
|
+
}), j.add(n.id);
|
|
8862
|
+
}
|
|
8863
|
+
} else A.push({
|
|
8864
|
+
id: n,
|
|
8865
|
+
changes: _
|
|
8866
|
+
});
|
|
8867
|
+
});
|
|
8868
|
+
let M = [...A];
|
|
8869
|
+
A.forEach(({ id: n, changes: _ }) => {
|
|
8870
|
+
if (_.x !== void 0 || _.y !== void 0) {
|
|
8871
|
+
let O = E.elements.find((_) => _.id === n);
|
|
8872
|
+
if (O && O.type === "group") {
|
|
8873
|
+
let A = (_.x ?? O.x) - O.x, j = (_.y ?? O.y) - O.y;
|
|
8874
|
+
E.elements.forEach((_) => {
|
|
8875
|
+
_.groupId === n && (M.some((n) => n.id === _.id) || M.push({
|
|
8876
|
+
id: _.id,
|
|
8877
|
+
changes: {
|
|
8878
|
+
x: _.x + A,
|
|
8879
|
+
y: _.y + j
|
|
8880
|
+
}
|
|
8881
|
+
}));
|
|
8882
|
+
});
|
|
8883
|
+
}
|
|
8884
|
+
}
|
|
8885
|
+
}), M.forEach(({ id: n, changes: _ }) => {
|
|
8699
8886
|
let E = O.findIndex((_) => _.id === n);
|
|
8700
8887
|
E !== -1 && (O[E] = {
|
|
8701
8888
|
...O[E],
|
|
8702
8889
|
..._
|
|
8703
8890
|
});
|
|
8704
8891
|
});
|
|
8705
|
-
let
|
|
8706
|
-
return _ && (
|
|
8892
|
+
let N = E.history, P = E.historyIndex;
|
|
8893
|
+
return _ && (N = E.history.slice(0, E.historyIndex + 1), N.push(O), P = N.length - 1), {
|
|
8707
8894
|
...E,
|
|
8708
8895
|
elements: O,
|
|
8709
|
-
history:
|
|
8710
|
-
historyIndex:
|
|
8896
|
+
history: N,
|
|
8897
|
+
historyIndex: P
|
|
8898
|
+
};
|
|
8899
|
+
});
|
|
8900
|
+
}, []), qj = React.useCallback((n) => {
|
|
8901
|
+
M((_) => {
|
|
8902
|
+
let E = _.elements.filter((_) => n.includes(_.id));
|
|
8903
|
+
if (E.length === 0) return _;
|
|
8904
|
+
let O = Math.min(...E.map((n) => n.x)), A = Math.min(...E.map((n) => n.y)), j = Math.max(...E.map((n) => n.x + n.width)), M = Math.max(...E.map((n) => n.y + n.height)), N = {
|
|
8905
|
+
id: crypto.randomUUID(),
|
|
8906
|
+
type: "group",
|
|
8907
|
+
name: "Novo Grupo",
|
|
8908
|
+
content: "",
|
|
8909
|
+
x: O,
|
|
8910
|
+
y: A,
|
|
8911
|
+
width: j - O,
|
|
8912
|
+
height: M - A,
|
|
8913
|
+
style: { zIndex: 0 }
|
|
8914
|
+
}, P = _.elements.map((_) => n.includes(_.id) ? {
|
|
8915
|
+
..._,
|
|
8916
|
+
groupId: N.id
|
|
8917
|
+
} : _);
|
|
8918
|
+
P.push(N);
|
|
8919
|
+
let z = _.history.slice(0, _.historyIndex + 1);
|
|
8920
|
+
return z.push(P), {
|
|
8921
|
+
..._,
|
|
8922
|
+
elements: P,
|
|
8923
|
+
selectedElementIds: [N.id],
|
|
8924
|
+
history: z,
|
|
8925
|
+
historyIndex: z.length - 1
|
|
8926
|
+
};
|
|
8927
|
+
});
|
|
8928
|
+
}, []), Jj = React.useCallback((n) => {
|
|
8929
|
+
M((_) => {
|
|
8930
|
+
let E = _.elements.find((_) => _.id === n);
|
|
8931
|
+
if (!E || E.type !== "group") return _;
|
|
8932
|
+
let O = [], A = _.elements.filter((_) => _.id !== n).map((_) => _.groupId === n ? (O.push(_.id), {
|
|
8933
|
+
..._,
|
|
8934
|
+
groupId: void 0
|
|
8935
|
+
}) : _), j = _.history.slice(0, _.historyIndex + 1);
|
|
8936
|
+
return j.push(A), {
|
|
8937
|
+
..._,
|
|
8938
|
+
elements: A,
|
|
8939
|
+
selectedElementIds: O,
|
|
8940
|
+
history: j,
|
|
8941
|
+
historyIndex: j.length - 1
|
|
8942
|
+
};
|
|
8943
|
+
});
|
|
8944
|
+
}, []), Xj = React.useCallback((n, _) => {
|
|
8945
|
+
M((E) => {
|
|
8946
|
+
let O = E.elements.map((E) => E.id === n ? {
|
|
8947
|
+
...E,
|
|
8948
|
+
name: _
|
|
8949
|
+
} : E);
|
|
8950
|
+
return {
|
|
8951
|
+
...E,
|
|
8952
|
+
elements: O
|
|
8711
8953
|
};
|
|
8712
8954
|
});
|
|
8713
|
-
}, []),
|
|
8955
|
+
}, []), Zj = React.useCallback((n, _) => {
|
|
8714
8956
|
M((E) => ({
|
|
8715
8957
|
...E,
|
|
8716
8958
|
mockData: n,
|
|
8717
8959
|
singleMockData: _
|
|
8718
8960
|
}));
|
|
8719
|
-
}, []),
|
|
8961
|
+
}, []), Qj = React.useCallback((n) => {
|
|
8720
8962
|
M((_) => ({
|
|
8721
8963
|
..._,
|
|
8722
8964
|
listSettings: {
|
|
@@ -8724,49 +8966,208 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
|
|
|
8724
8966
|
...n
|
|
8725
8967
|
}
|
|
8726
8968
|
}));
|
|
8727
|
-
}, []),
|
|
8969
|
+
}, []), $j = React.useMemo(() => ({
|
|
8728
8970
|
state: j,
|
|
8729
|
-
addElement:
|
|
8730
|
-
removeElement:
|
|
8731
|
-
removeSelected:
|
|
8732
|
-
selectElement:
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8971
|
+
addElement: G,
|
|
8972
|
+
removeElement: Z,
|
|
8973
|
+
removeSelected: Bj,
|
|
8974
|
+
selectElement: Vj,
|
|
8975
|
+
setSelectedElements: Hj,
|
|
8976
|
+
moveElement: Uj,
|
|
8977
|
+
updateElement: Gj,
|
|
8978
|
+
updateElements: Kj,
|
|
8979
|
+
groupElements: qj,
|
|
8980
|
+
ungroupElements: Jj,
|
|
8981
|
+
renameElement: Xj,
|
|
8982
|
+
setMockData: Zj,
|
|
8983
|
+
updateListSettings: Qj,
|
|
8738
8984
|
setCanvasHeight: N,
|
|
8739
|
-
loadState:
|
|
8740
|
-
undo:
|
|
8741
|
-
redo:
|
|
8742
|
-
copy:
|
|
8743
|
-
paste:
|
|
8985
|
+
loadState: z,
|
|
8986
|
+
undo: B,
|
|
8987
|
+
redo: H,
|
|
8988
|
+
copy: U,
|
|
8989
|
+
paste: W,
|
|
8990
|
+
setGridSize: P
|
|
8744
8991
|
}), [
|
|
8745
8992
|
j,
|
|
8746
|
-
W,
|
|
8747
8993
|
G,
|
|
8748
8994
|
Z,
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8995
|
+
Bj,
|
|
8996
|
+
Vj,
|
|
8997
|
+
Hj,
|
|
8998
|
+
Uj,
|
|
8999
|
+
Gj,
|
|
9000
|
+
Kj,
|
|
9001
|
+
qj,
|
|
9002
|
+
Jj,
|
|
9003
|
+
Xj,
|
|
9004
|
+
Zj,
|
|
9005
|
+
Qj,
|
|
8755
9006
|
N,
|
|
8756
|
-
P,
|
|
8757
9007
|
z,
|
|
8758
9008
|
B,
|
|
8759
9009
|
H,
|
|
8760
|
-
U
|
|
9010
|
+
U,
|
|
9011
|
+
W,
|
|
9012
|
+
P
|
|
8761
9013
|
]);
|
|
8762
9014
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
8763
|
-
value:
|
|
9015
|
+
value: $j,
|
|
8764
9016
|
children: n
|
|
8765
9017
|
});
|
|
8766
9018
|
}, useEditor = () => {
|
|
8767
9019
|
let n = useContext(EditorContext);
|
|
8768
9020
|
if (!n) throw Error("useEditor must be used within an EditorProvider");
|
|
8769
9021
|
return n;
|
|
9022
|
+
}, AlignmentToolbar = () => {
|
|
9023
|
+
let { state: n, updateElements: _ } = useEditor(), { selectedElementIds: E, elements: O } = n;
|
|
9024
|
+
if (E.length < 2) return null;
|
|
9025
|
+
let A = () => O.filter((n) => E.includes(n.id));
|
|
9026
|
+
return /* @__PURE__ */ jsxs(p$1, {
|
|
9027
|
+
gap: "2",
|
|
9028
|
+
align: "center",
|
|
9029
|
+
style: {
|
|
9030
|
+
backgroundColor: "var(--color-panel-solid)",
|
|
9031
|
+
padding: "8px",
|
|
9032
|
+
borderRadius: "8px",
|
|
9033
|
+
boxShadow: "0 2px 10px rgba(0,0,0,0.1)",
|
|
9034
|
+
border: "1px solid var(--gray-5)"
|
|
9035
|
+
},
|
|
9036
|
+
children: [
|
|
9037
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9038
|
+
variant: "ghost",
|
|
9039
|
+
color: "gray",
|
|
9040
|
+
onClick: () => {
|
|
9041
|
+
let n = A();
|
|
9042
|
+
if (n.length < 2) return;
|
|
9043
|
+
let E = Math.min(...n.map((n) => n.x));
|
|
9044
|
+
_(n.map((n) => ({
|
|
9045
|
+
id: n.id,
|
|
9046
|
+
changes: { x: E }
|
|
9047
|
+
})));
|
|
9048
|
+
},
|
|
9049
|
+
title: "Alinhar à Esquerda",
|
|
9050
|
+
children: /* @__PURE__ */ jsx(AlignLeftIcon, {})
|
|
9051
|
+
}),
|
|
9052
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9053
|
+
variant: "ghost",
|
|
9054
|
+
color: "gray",
|
|
9055
|
+
onClick: () => {
|
|
9056
|
+
let n = A();
|
|
9057
|
+
if (n.length < 2) return;
|
|
9058
|
+
let E = (Math.min(...n.map((n) => n.x)) + Math.max(...n.map((n) => n.x + n.width))) / 2;
|
|
9059
|
+
_(n.map((n) => ({
|
|
9060
|
+
id: n.id,
|
|
9061
|
+
changes: { x: E - n.width / 2 }
|
|
9062
|
+
})));
|
|
9063
|
+
},
|
|
9064
|
+
title: "Alinhar ao Centro (Horizontal)",
|
|
9065
|
+
children: /* @__PURE__ */ jsx(AlignCenterHorizontallyIcon, {})
|
|
9066
|
+
}),
|
|
9067
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9068
|
+
variant: "ghost",
|
|
9069
|
+
color: "gray",
|
|
9070
|
+
onClick: () => {
|
|
9071
|
+
let n = A();
|
|
9072
|
+
if (n.length < 2) return;
|
|
9073
|
+
let E = Math.max(...n.map((n) => n.x + n.width));
|
|
9074
|
+
_(n.map((n) => ({
|
|
9075
|
+
id: n.id,
|
|
9076
|
+
changes: { x: E - n.width }
|
|
9077
|
+
})));
|
|
9078
|
+
},
|
|
9079
|
+
title: "Alinhar à Direita",
|
|
9080
|
+
children: /* @__PURE__ */ jsx(AlignRightIcon, {})
|
|
9081
|
+
}),
|
|
9082
|
+
/* @__PURE__ */ jsx(o$2, { orientation: "vertical" }),
|
|
9083
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9084
|
+
variant: "ghost",
|
|
9085
|
+
color: "gray",
|
|
9086
|
+
onClick: () => {
|
|
9087
|
+
let n = A();
|
|
9088
|
+
if (n.length < 2) return;
|
|
9089
|
+
let E = Math.min(...n.map((n) => n.y));
|
|
9090
|
+
_(n.map((n) => ({
|
|
9091
|
+
id: n.id,
|
|
9092
|
+
changes: { y: E }
|
|
9093
|
+
})));
|
|
9094
|
+
},
|
|
9095
|
+
title: "Alinhar ao Topo",
|
|
9096
|
+
children: /* @__PURE__ */ jsx(AlignTopIcon, {})
|
|
9097
|
+
}),
|
|
9098
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9099
|
+
variant: "ghost",
|
|
9100
|
+
color: "gray",
|
|
9101
|
+
onClick: () => {
|
|
9102
|
+
let n = A();
|
|
9103
|
+
if (n.length < 2) return;
|
|
9104
|
+
let E = (Math.min(...n.map((n) => n.y)) + Math.max(...n.map((n) => n.y + n.height))) / 2;
|
|
9105
|
+
_(n.map((n) => ({
|
|
9106
|
+
id: n.id,
|
|
9107
|
+
changes: { y: E - n.height / 2 }
|
|
9108
|
+
})));
|
|
9109
|
+
},
|
|
9110
|
+
title: "Alinhar ao Centro (Vertical)",
|
|
9111
|
+
children: /* @__PURE__ */ jsx(AlignCenterVerticallyIcon, {})
|
|
9112
|
+
}),
|
|
9113
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9114
|
+
variant: "ghost",
|
|
9115
|
+
color: "gray",
|
|
9116
|
+
onClick: () => {
|
|
9117
|
+
let n = A();
|
|
9118
|
+
if (n.length < 2) return;
|
|
9119
|
+
let E = Math.max(...n.map((n) => n.y + n.height));
|
|
9120
|
+
_(n.map((n) => ({
|
|
9121
|
+
id: n.id,
|
|
9122
|
+
changes: { y: E - n.height }
|
|
9123
|
+
})));
|
|
9124
|
+
},
|
|
9125
|
+
title: "Alinhar à Base",
|
|
9126
|
+
children: /* @__PURE__ */ jsx(AlignBottomIcon, {})
|
|
9127
|
+
}),
|
|
9128
|
+
E.length >= 3 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9129
|
+
/* @__PURE__ */ jsx(o$2, { orientation: "vertical" }),
|
|
9130
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9131
|
+
variant: "ghost",
|
|
9132
|
+
color: "gray",
|
|
9133
|
+
onClick: () => {
|
|
9134
|
+
let n = A();
|
|
9135
|
+
if (n.length < 3) return;
|
|
9136
|
+
let E = [...n].sort((n, _) => n.x - _.x), O = E[0], j = E[E.length - 1], M = (j.x + j.width / 2 - (O.x + O.width / 2)) / (E.length - 1);
|
|
9137
|
+
_(E.map((n, _) => {
|
|
9138
|
+
if (_ === 0 || _ === E.length - 1) return null;
|
|
9139
|
+
let A = O.x + O.width / 2 + M * _;
|
|
9140
|
+
return {
|
|
9141
|
+
id: n.id,
|
|
9142
|
+
changes: { x: A - n.width / 2 }
|
|
9143
|
+
};
|
|
9144
|
+
}).filter(Boolean));
|
|
9145
|
+
},
|
|
9146
|
+
title: "Distribuir Horizontalmente",
|
|
9147
|
+
children: /* @__PURE__ */ jsx(SpaceEvenlyHorizontallyIcon, {})
|
|
9148
|
+
}),
|
|
9149
|
+
/* @__PURE__ */ jsx(o$1, {
|
|
9150
|
+
variant: "ghost",
|
|
9151
|
+
color: "gray",
|
|
9152
|
+
onClick: () => {
|
|
9153
|
+
let n = A();
|
|
9154
|
+
if (n.length < 3) return;
|
|
9155
|
+
let E = [...n].sort((n, _) => n.y - _.y), O = E[0], j = E[E.length - 1], M = (j.y + j.height / 2 - (O.y + O.height / 2)) / (E.length - 1);
|
|
9156
|
+
_(E.map((n, _) => {
|
|
9157
|
+
if (_ === 0 || _ === E.length - 1) return null;
|
|
9158
|
+
let A = O.y + O.height / 2 + M * _;
|
|
9159
|
+
return {
|
|
9160
|
+
id: n.id,
|
|
9161
|
+
changes: { y: A - n.height / 2 }
|
|
9162
|
+
};
|
|
9163
|
+
}).filter(Boolean));
|
|
9164
|
+
},
|
|
9165
|
+
title: "Distribuir Verticalmente",
|
|
9166
|
+
children: /* @__PURE__ */ jsx(SpaceEvenlyVerticallyIcon, {})
|
|
9167
|
+
})
|
|
9168
|
+
] })
|
|
9169
|
+
]
|
|
9170
|
+
});
|
|
8770
9171
|
};
|
|
8771
9172
|
var __assign$1 = function() {
|
|
8772
9173
|
return __assign$1 = Object.assign || function(n) {
|
|
@@ -9053,16 +9454,16 @@ var __assign$1 = function() {
|
|
|
9053
9454
|
maxHeight: _
|
|
9054
9455
|
};
|
|
9055
9456
|
}, _.prototype.calculateNewSizeFromDirection = function(n, _) {
|
|
9056
|
-
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,
|
|
9057
|
-
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W -
|
|
9457
|
+
var E = this.props.scale || 1, O = normalizeToPair(this.props.resizeRatio || 1), A = O[0], j = O[1], M = this.state, N = M.direction, P = M.original, z = this.props, B = z.lockAspectRatio, H = z.lockAspectRatioExtraHeight, U = z.lockAspectRatioExtraWidth, W = P.width, G = P.height, Z = H || 0, Bj = U || 0;
|
|
9458
|
+
return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Bj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Bj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Bj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Bj)), {
|
|
9058
9459
|
newWidth: W,
|
|
9059
9460
|
newHeight: G
|
|
9060
9461
|
};
|
|
9061
9462
|
}, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
|
|
9062
9463
|
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;
|
|
9063
9464
|
if (j) {
|
|
9064
|
-
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W,
|
|
9065
|
-
n = clamp$1(n,
|
|
9465
|
+
var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Bj = (P - W) / this.ratio + U, Vj = (z - W) / this.ratio + U, Hj = Math.max(P, G), Uj = Math.min(z, Z), Wj = Math.max(B, Bj), Gj = Math.min(H, Vj);
|
|
9466
|
+
n = clamp$1(n, Hj, Uj), _ = clamp$1(_, Wj, Gj);
|
|
9066
9467
|
} else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
|
|
9067
9468
|
return {
|
|
9068
9469
|
newWidth: n,
|
|
@@ -9119,56 +9520,56 @@ var __assign$1 = function() {
|
|
|
9119
9520
|
} catch {}
|
|
9120
9521
|
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);
|
|
9121
9522
|
O = Z.maxWidth, A = Z.maxHeight, j = Z.minWidth, M = Z.minHeight;
|
|
9122
|
-
var
|
|
9123
|
-
this.props.snap && this.props.snap.x && (
|
|
9124
|
-
var
|
|
9125
|
-
width:
|
|
9126
|
-
height:
|
|
9523
|
+
var Bj = this.calculateNewSizeFromDirection(N, P), Vj = Bj.newHeight, Hj = Bj.newWidth, Uj = this.calculateNewMaxFromBoundary(O, A);
|
|
9524
|
+
this.props.snap && this.props.snap.x && (Hj = findClosestSnap(Hj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (Vj = findClosestSnap(Vj, this.props.snap.y, this.props.snapGap));
|
|
9525
|
+
var Wj = this.calculateNewSizeFromAspectRatio(Hj, Vj, {
|
|
9526
|
+
width: Uj.maxWidth,
|
|
9527
|
+
height: Uj.maxHeight
|
|
9127
9528
|
}, {
|
|
9128
9529
|
width: j,
|
|
9129
9530
|
height: M
|
|
9130
9531
|
});
|
|
9131
|
-
if (
|
|
9132
|
-
var
|
|
9133
|
-
|
|
9532
|
+
if (Hj = Wj.newWidth, Vj = Wj.newHeight, this.props.grid) {
|
|
9533
|
+
var Gj = snap(Hj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), Kj = snap(Vj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Jj = this.props.snapGap || 0, Yj = Jj === 0 || Math.abs(Gj - Hj) <= Jj ? Gj : Hj, Xj = Jj === 0 || Math.abs(Kj - Vj) <= Jj ? Kj : Vj;
|
|
9534
|
+
Hj = Yj, Vj = Xj;
|
|
9134
9535
|
}
|
|
9135
|
-
var
|
|
9136
|
-
width:
|
|
9137
|
-
height:
|
|
9536
|
+
var Zj = {
|
|
9537
|
+
width: Hj - H.width,
|
|
9538
|
+
height: Vj - H.height
|
|
9138
9539
|
};
|
|
9139
|
-
if (this.delta =
|
|
9540
|
+
if (this.delta = Zj, U && typeof U == "string") {
|
|
9140
9541
|
if (U.endsWith("%")) {
|
|
9141
|
-
var
|
|
9142
|
-
|
|
9542
|
+
var Qj = Hj / G.width * 100;
|
|
9543
|
+
Hj = `${Qj}%`;
|
|
9143
9544
|
} else if (U.endsWith("vw")) {
|
|
9144
|
-
var
|
|
9145
|
-
|
|
9545
|
+
var $j = Hj / this.window.innerWidth * 100;
|
|
9546
|
+
Hj = `${$j}vw`;
|
|
9146
9547
|
} else if (U.endsWith("vh")) {
|
|
9147
|
-
var
|
|
9148
|
-
|
|
9548
|
+
var eM = Hj / this.window.innerHeight * 100;
|
|
9549
|
+
Hj = `${eM}vh`;
|
|
9149
9550
|
}
|
|
9150
9551
|
}
|
|
9151
9552
|
if (W && typeof W == "string") {
|
|
9152
9553
|
if (W.endsWith("%")) {
|
|
9153
|
-
var
|
|
9154
|
-
|
|
9554
|
+
var Qj = Vj / G.height * 100;
|
|
9555
|
+
Vj = `${Qj}%`;
|
|
9155
9556
|
} else if (W.endsWith("vw")) {
|
|
9156
|
-
var
|
|
9157
|
-
|
|
9557
|
+
var $j = Vj / this.window.innerWidth * 100;
|
|
9558
|
+
Vj = `${$j}vw`;
|
|
9158
9559
|
} else if (W.endsWith("vh")) {
|
|
9159
|
-
var
|
|
9160
|
-
|
|
9560
|
+
var eM = Vj / this.window.innerHeight * 100;
|
|
9561
|
+
Vj = `${eM}vh`;
|
|
9161
9562
|
}
|
|
9162
9563
|
}
|
|
9163
|
-
var
|
|
9164
|
-
width: this.createSizeForCssProperty(
|
|
9165
|
-
height: this.createSizeForCssProperty(
|
|
9564
|
+
var tM = {
|
|
9565
|
+
width: this.createSizeForCssProperty(Hj, "width"),
|
|
9566
|
+
height: this.createSizeForCssProperty(Vj, "height")
|
|
9166
9567
|
};
|
|
9167
|
-
this.flexDir === "row" ?
|
|
9168
|
-
var
|
|
9169
|
-
|
|
9170
|
-
_.setState(
|
|
9171
|
-
}), this.props.onResize &&
|
|
9568
|
+
this.flexDir === "row" ? tM.flexBasis = tM.width : this.flexDir === "column" && (tM.flexBasis = tM.height);
|
|
9569
|
+
var nM = this.state.width !== tM.width, rM = this.state.height !== tM.height, iM = this.state.flexBasis !== tM.flexBasis, aM = nM || rM || iM;
|
|
9570
|
+
aM && flushSync(function() {
|
|
9571
|
+
_.setState(tM);
|
|
9572
|
+
}), this.props.onResize && aM && this.props.onResize(n, B, this.resizable, Zj);
|
|
9172
9573
|
}
|
|
9173
9574
|
}, _.prototype.onMouseUp = function(n) {
|
|
9174
9575
|
var _ = this.state, E = _.isResizing, O = _.direction;
|
|
@@ -9619,7 +10020,7 @@ var R$1, V = typeof window < "u" ? useLayoutEffect : useEffect, $ = function() {
|
|
|
9619
10020
|
return React.createElement(re, u({}, n, { colorModel: te }));
|
|
9620
10021
|
};
|
|
9621
10022
|
const ColorPickerContent = ({ color: n, onChange: _ }) => {
|
|
9622
|
-
let E = n === "transparent" ? "#00000000" : n
|
|
10023
|
+
let E = ((n) => n === "transparent" ? "#00000000" : n ? /^[0-9A-Fa-f]{3,8}$/.test(n) ? "#" + n : n : "#000000")(n);
|
|
9623
10024
|
return /* @__PURE__ */ jsxs(p$1, {
|
|
9624
10025
|
direction: "column",
|
|
9625
10026
|
gap: "3",
|
|
@@ -9641,6 +10042,9 @@ const ColorPickerContent = ({ color: n, onChange: _ }) => {
|
|
|
9641
10042
|
} }), /* @__PURE__ */ jsx(u$1, {
|
|
9642
10043
|
value: n,
|
|
9643
10044
|
onChange: (n) => _(n.target.value),
|
|
10045
|
+
onBlur: () => {
|
|
10046
|
+
n && /^[0-9A-Fa-f]{3,8}$/.test(n) && _("#" + n);
|
|
10047
|
+
},
|
|
9644
10048
|
placeholder: "#RRGGBBAA",
|
|
9645
10049
|
style: { flexGrow: 1 }
|
|
9646
10050
|
})]
|
|
@@ -9679,9 +10083,9 @@ const ColorPickerContent = ({ color: n, onChange: _ }) => {
|
|
|
9679
10083
|
color: n,
|
|
9680
10084
|
onChange: _
|
|
9681
10085
|
})
|
|
9682
|
-
})] }), ElementAdvancedSettings = ({ elementId: n, open: _, onOpenChange: E }) => {
|
|
9683
|
-
let { state:
|
|
9684
|
-
return
|
|
10086
|
+
})] }), ElementAdvancedSettings = ({ elementId: n, open: _, onOpenChange: E, initialTab: O = "formatting" }) => {
|
|
10087
|
+
let { state: A, updateElement: j } = useEditor(), M = A.elements.find((_) => _.id === n);
|
|
10088
|
+
return M ? /* @__PURE__ */ jsx(s$4, {
|
|
9685
10089
|
open: _,
|
|
9686
10090
|
onOpenChange: E,
|
|
9687
10091
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
@@ -9692,12 +10096,16 @@ const ColorPickerContent = ({ color: n, onChange: _ }) => {
|
|
|
9692
10096
|
children: [
|
|
9693
10097
|
/* @__PURE__ */ jsx(g$2, { children: "Configurações Avançadas" }),
|
|
9694
10098
|
/* @__PURE__ */ jsxs(m$1, {
|
|
9695
|
-
defaultValue:
|
|
10099
|
+
defaultValue: O,
|
|
9696
10100
|
children: [/* @__PURE__ */ jsxs(b$1, { children: [
|
|
9697
10101
|
/* @__PURE__ */ jsx(P$1, {
|
|
9698
10102
|
value: "formatting",
|
|
9699
10103
|
children: "Formatação"
|
|
9700
10104
|
}),
|
|
10105
|
+
/* @__PURE__ */ jsx(P$1, {
|
|
10106
|
+
value: "style",
|
|
10107
|
+
children: "Estilo"
|
|
10108
|
+
}),
|
|
9701
10109
|
/* @__PURE__ */ jsx(P$1, {
|
|
9702
10110
|
value: "conditional",
|
|
9703
10111
|
children: "Condicional"
|
|
@@ -9712,23 +10120,30 @@ const ColorPickerContent = ({ color: n, onChange: _ }) => {
|
|
|
9712
10120
|
/* @__PURE__ */ jsx(f$2, {
|
|
9713
10121
|
value: "formatting",
|
|
9714
10122
|
children: /* @__PURE__ */ jsx(FormattingSettings, {
|
|
9715
|
-
element:
|
|
9716
|
-
updateElement:
|
|
10123
|
+
element: M,
|
|
10124
|
+
updateElement: j
|
|
10125
|
+
})
|
|
10126
|
+
}),
|
|
10127
|
+
/* @__PURE__ */ jsx(f$2, {
|
|
10128
|
+
value: "style",
|
|
10129
|
+
children: /* @__PURE__ */ jsx(StyleSettings, {
|
|
10130
|
+
element: M,
|
|
10131
|
+
updateElement: j
|
|
9717
10132
|
})
|
|
9718
10133
|
}),
|
|
9719
10134
|
/* @__PURE__ */ jsx(f$2, {
|
|
9720
10135
|
value: "conditional",
|
|
9721
10136
|
children: /* @__PURE__ */ jsx(ConditionalSettings, {
|
|
9722
|
-
element:
|
|
9723
|
-
updateElement:
|
|
9724
|
-
availableProps:
|
|
10137
|
+
element: M,
|
|
10138
|
+
updateElement: j,
|
|
10139
|
+
availableProps: A.availableProps
|
|
9725
10140
|
})
|
|
9726
10141
|
}),
|
|
9727
10142
|
/* @__PURE__ */ jsx(f$2, {
|
|
9728
10143
|
value: "animation",
|
|
9729
10144
|
children: /* @__PURE__ */ jsx(AnimationSettings, {
|
|
9730
|
-
element:
|
|
9731
|
-
updateElement:
|
|
10145
|
+
element: M,
|
|
10146
|
+
updateElement: j
|
|
9732
10147
|
})
|
|
9733
10148
|
})
|
|
9734
10149
|
]
|
|
@@ -9793,6 +10208,18 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
9793
10208
|
value: "fadeIn",
|
|
9794
10209
|
children: "Fade In"
|
|
9795
10210
|
}),
|
|
10211
|
+
/* @__PURE__ */ jsx("option", {
|
|
10212
|
+
value: "smoothSlideUp",
|
|
10213
|
+
children: "Slide Suave (Up)"
|
|
10214
|
+
}),
|
|
10215
|
+
/* @__PURE__ */ jsx("option", {
|
|
10216
|
+
value: "popIn",
|
|
10217
|
+
children: "Pop In"
|
|
10218
|
+
}),
|
|
10219
|
+
/* @__PURE__ */ jsx("option", {
|
|
10220
|
+
value: "blurIn",
|
|
10221
|
+
children: "Blur In"
|
|
10222
|
+
}),
|
|
9796
10223
|
/* @__PURE__ */ jsx("option", {
|
|
9797
10224
|
value: "slideInLeft",
|
|
9798
10225
|
children: "Slide In (Esquerda)"
|
|
@@ -10088,8 +10515,166 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10088
10515
|
})
|
|
10089
10516
|
]
|
|
10090
10517
|
});
|
|
10518
|
+
}, StyleSettings = ({ element: n, updateElement: _ }) => {
|
|
10519
|
+
let E = n.style || {}, [O, A] = useState(E.borderTopLeftRadius !== void 0 || E.borderTopRightRadius !== void 0 || E.borderBottomRightRadius !== void 0 || E.borderBottomLeftRadius !== void 0), j = (O) => {
|
|
10520
|
+
_(n.id, { style: {
|
|
10521
|
+
...E,
|
|
10522
|
+
...O
|
|
10523
|
+
} });
|
|
10524
|
+
}, M = (n, _) => {
|
|
10525
|
+
let E = typeof n == "number" ? n : parseInt(n) || 0;
|
|
10526
|
+
j({ [_]: E });
|
|
10527
|
+
};
|
|
10528
|
+
return /* @__PURE__ */ jsxs(p$1, {
|
|
10529
|
+
direction: "column",
|
|
10530
|
+
gap: "3",
|
|
10531
|
+
children: [
|
|
10532
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
10533
|
+
size: "2",
|
|
10534
|
+
color: "gray",
|
|
10535
|
+
children: "Personalize a aparência do elemento."
|
|
10536
|
+
}),
|
|
10537
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsxs(p$1, {
|
|
10538
|
+
align: "center",
|
|
10539
|
+
justify: "between",
|
|
10540
|
+
mb: "2",
|
|
10541
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
10542
|
+
size: "2",
|
|
10543
|
+
weight: "bold",
|
|
10544
|
+
children: "Arredondamento (Border Radius)"
|
|
10545
|
+
}), /* @__PURE__ */ jsxs(p$1, {
|
|
10546
|
+
align: "center",
|
|
10547
|
+
gap: "2",
|
|
10548
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
10549
|
+
size: "1",
|
|
10550
|
+
children: "Individual"
|
|
10551
|
+
}), /* @__PURE__ */ jsx(i, {
|
|
10552
|
+
checked: O,
|
|
10553
|
+
onCheckedChange: (n) => {
|
|
10554
|
+
if (A(n), !n) j({
|
|
10555
|
+
borderRadius: E.borderTopLeftRadius || E.borderRadius || 0,
|
|
10556
|
+
borderTopLeftRadius: void 0,
|
|
10557
|
+
borderTopRightRadius: void 0,
|
|
10558
|
+
borderBottomRightRadius: void 0,
|
|
10559
|
+
borderBottomLeftRadius: void 0
|
|
10560
|
+
});
|
|
10561
|
+
else {
|
|
10562
|
+
let n = E.borderRadius || 0;
|
|
10563
|
+
j({
|
|
10564
|
+
borderRadius: void 0,
|
|
10565
|
+
borderTopLeftRadius: n,
|
|
10566
|
+
borderTopRightRadius: n,
|
|
10567
|
+
borderBottomRightRadius: n,
|
|
10568
|
+
borderBottomLeftRadius: n
|
|
10569
|
+
});
|
|
10570
|
+
}
|
|
10571
|
+
}
|
|
10572
|
+
})]
|
|
10573
|
+
})]
|
|
10574
|
+
}), O ? /* @__PURE__ */ jsxs(o$3, {
|
|
10575
|
+
columns: "2",
|
|
10576
|
+
gap: "3",
|
|
10577
|
+
children: [
|
|
10578
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10579
|
+
size: "1",
|
|
10580
|
+
mb: "1",
|
|
10581
|
+
as: "div",
|
|
10582
|
+
children: "Superior Esq."
|
|
10583
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10584
|
+
type: "number",
|
|
10585
|
+
min: "0",
|
|
10586
|
+
value: parseInt(E.borderTopLeftRadius) || 0,
|
|
10587
|
+
onChange: (n) => M(n.target.value, "borderTopLeftRadius")
|
|
10588
|
+
})] }),
|
|
10589
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10590
|
+
size: "1",
|
|
10591
|
+
mb: "1",
|
|
10592
|
+
as: "div",
|
|
10593
|
+
children: "Superior Dir."
|
|
10594
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10595
|
+
type: "number",
|
|
10596
|
+
min: "0",
|
|
10597
|
+
value: parseInt(E.borderTopRightRadius) || 0,
|
|
10598
|
+
onChange: (n) => M(n.target.value, "borderTopRightRadius")
|
|
10599
|
+
})] }),
|
|
10600
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10601
|
+
size: "1",
|
|
10602
|
+
mb: "1",
|
|
10603
|
+
as: "div",
|
|
10604
|
+
children: "Inferior Esq."
|
|
10605
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10606
|
+
type: "number",
|
|
10607
|
+
min: "0",
|
|
10608
|
+
value: parseInt(E.borderBottomLeftRadius) || 0,
|
|
10609
|
+
onChange: (n) => M(n.target.value, "borderBottomLeftRadius")
|
|
10610
|
+
})] }),
|
|
10611
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10612
|
+
size: "1",
|
|
10613
|
+
mb: "1",
|
|
10614
|
+
as: "div",
|
|
10615
|
+
children: "Inferior Dir."
|
|
10616
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10617
|
+
type: "number",
|
|
10618
|
+
min: "0",
|
|
10619
|
+
value: parseInt(E.borderBottomRightRadius) || 0,
|
|
10620
|
+
onChange: (n) => M(n.target.value, "borderBottomRightRadius")
|
|
10621
|
+
})] })
|
|
10622
|
+
]
|
|
10623
|
+
}) : /* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10624
|
+
size: "1",
|
|
10625
|
+
mb: "1",
|
|
10626
|
+
as: "div",
|
|
10627
|
+
children: "Raio (Todos os cantos)"
|
|
10628
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10629
|
+
type: "number",
|
|
10630
|
+
min: "0",
|
|
10631
|
+
value: parseInt(E.borderRadius) || 0,
|
|
10632
|
+
onChange: (n) => j({ borderRadius: parseInt(n.target.value) || 0 })
|
|
10633
|
+
})] })] }),
|
|
10634
|
+
/* @__PURE__ */ jsx(o$2, {
|
|
10635
|
+
size: "4",
|
|
10636
|
+
my: "2"
|
|
10637
|
+
}),
|
|
10638
|
+
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10639
|
+
size: "2",
|
|
10640
|
+
weight: "bold",
|
|
10641
|
+
mb: "2",
|
|
10642
|
+
children: "Espaçamento (Padding)"
|
|
10643
|
+
}), /* @__PURE__ */ jsx(o$3, {
|
|
10644
|
+
columns: "2",
|
|
10645
|
+
gap: "3",
|
|
10646
|
+
children: /* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10647
|
+
size: "1",
|
|
10648
|
+
mb: "1",
|
|
10649
|
+
as: "div",
|
|
10650
|
+
children: "Tamanho (px)"
|
|
10651
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
10652
|
+
type: "number",
|
|
10653
|
+
min: "0",
|
|
10654
|
+
value: parseInt(E.padding) || 0,
|
|
10655
|
+
onChange: (n) => j({ padding: parseInt(n.target.value) || 0 })
|
|
10656
|
+
})] })
|
|
10657
|
+
})] })
|
|
10658
|
+
]
|
|
10659
|
+
});
|
|
10091
10660
|
}, ConditionalSettings = ({ element: n, updateElement: _, availableProps: E }) => {
|
|
10092
|
-
let O = n.conditions || [],
|
|
10661
|
+
let O = n.conditions || [], A = n.styleBindings || {}, [j, M] = useState(null), N = [
|
|
10662
|
+
{
|
|
10663
|
+
label: "Cor do Texto",
|
|
10664
|
+
value: "color"
|
|
10665
|
+
},
|
|
10666
|
+
{
|
|
10667
|
+
label: "Cor de Fundo",
|
|
10668
|
+
value: "backgroundColor"
|
|
10669
|
+
},
|
|
10670
|
+
{
|
|
10671
|
+
label: "Cor da Borda",
|
|
10672
|
+
value: "borderColor"
|
|
10673
|
+
}
|
|
10674
|
+
], P = (E, O) => {
|
|
10675
|
+
let j = { ...A };
|
|
10676
|
+
O ? j[E] = O : delete j[E], _(n.id, { styleBindings: j });
|
|
10677
|
+
}, z = () => {
|
|
10093
10678
|
let A = {
|
|
10094
10679
|
id: crypto.randomUUID(),
|
|
10095
10680
|
property: E.length > 0 ? E[0].dataName : "",
|
|
@@ -10097,25 +10682,25 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10097
10682
|
value: "",
|
|
10098
10683
|
style: { color: "#ff0000" }
|
|
10099
10684
|
};
|
|
10100
|
-
_(n.id, { conditions: [...O, A] }),
|
|
10101
|
-
},
|
|
10102
|
-
_(n.id, { conditions: O.filter((n) => n.id !== E) }),
|
|
10103
|
-
},
|
|
10685
|
+
_(n.id, { conditions: [...O, A] }), M(A.id);
|
|
10686
|
+
}, B = (E) => {
|
|
10687
|
+
_(n.id, { conditions: O.filter((n) => n.id !== E) }), j === E && M(null);
|
|
10688
|
+
}, H = (E, A) => {
|
|
10104
10689
|
_(n.id, { conditions: O.map((n) => n.id === E ? {
|
|
10105
10690
|
...n,
|
|
10106
10691
|
...A
|
|
10107
10692
|
} : n) });
|
|
10108
|
-
},
|
|
10693
|
+
}, U = (n, _) => {
|
|
10109
10694
|
let E = O.find((_) => _.id === n);
|
|
10110
|
-
E &&
|
|
10695
|
+
E && H(n, { style: {
|
|
10111
10696
|
...E.style,
|
|
10112
10697
|
..._
|
|
10113
10698
|
} });
|
|
10114
|
-
},
|
|
10699
|
+
}, W = O.find((n) => n.id === j);
|
|
10115
10700
|
return /* @__PURE__ */ jsx(p$1, {
|
|
10116
10701
|
direction: "column",
|
|
10117
10702
|
gap: "3",
|
|
10118
|
-
children:
|
|
10703
|
+
children: j ? /* @__PURE__ */ jsxs(p$1, {
|
|
10119
10704
|
direction: "column",
|
|
10120
10705
|
gap: "3",
|
|
10121
10706
|
children: [/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -10126,10 +10711,10 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10126
10711
|
children: "Editar Regra"
|
|
10127
10712
|
}), /* @__PURE__ */ jsx(o, {
|
|
10128
10713
|
variant: "ghost",
|
|
10129
|
-
onClick: () =>
|
|
10714
|
+
onClick: () => M(null),
|
|
10130
10715
|
children: "Voltar"
|
|
10131
10716
|
})]
|
|
10132
|
-
}),
|
|
10717
|
+
}), W && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10133
10718
|
/* @__PURE__ */ jsxs(p, { children: [
|
|
10134
10719
|
/* @__PURE__ */ jsx(p$2, {
|
|
10135
10720
|
size: "1",
|
|
@@ -10138,8 +10723,8 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10138
10723
|
children: "Propriedade"
|
|
10139
10724
|
}),
|
|
10140
10725
|
/* @__PURE__ */ jsxs("select", {
|
|
10141
|
-
value:
|
|
10142
|
-
onChange: (n) =>
|
|
10726
|
+
value: W.property,
|
|
10727
|
+
onChange: (n) => H(W.id, { property: n.target.value }),
|
|
10143
10728
|
style: {
|
|
10144
10729
|
width: "100%",
|
|
10145
10730
|
padding: "6px",
|
|
@@ -10157,10 +10742,10 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10157
10742
|
children: "Outra..."
|
|
10158
10743
|
})]
|
|
10159
10744
|
}),
|
|
10160
|
-
|
|
10745
|
+
W.property === "__custom__" && /* @__PURE__ */ jsx(u$1, {
|
|
10161
10746
|
placeholder: "Nome da propriedade",
|
|
10162
10747
|
mt: "2",
|
|
10163
|
-
onChange: (n) =>
|
|
10748
|
+
onChange: (n) => H(W.id, { property: n.target.value })
|
|
10164
10749
|
})
|
|
10165
10750
|
] }),
|
|
10166
10751
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -10173,8 +10758,8 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10173
10758
|
as: "div",
|
|
10174
10759
|
children: "Operador"
|
|
10175
10760
|
}), /* @__PURE__ */ jsxs("select", {
|
|
10176
|
-
value:
|
|
10177
|
-
onChange: (n) =>
|
|
10761
|
+
value: W.operator,
|
|
10762
|
+
onChange: (n) => H(W.id, { operator: n.target.value }),
|
|
10178
10763
|
style: {
|
|
10179
10764
|
width: "100%",
|
|
10180
10765
|
padding: "6px",
|
|
@@ -10221,7 +10806,7 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10221
10806
|
"contains",
|
|
10222
10807
|
"greaterThan",
|
|
10223
10808
|
"lessThan"
|
|
10224
|
-
].includes(
|
|
10809
|
+
].includes(W.operator) && /* @__PURE__ */ jsxs(p, {
|
|
10225
10810
|
flexGrow: "1",
|
|
10226
10811
|
children: [/* @__PURE__ */ jsx(p$2, {
|
|
10227
10812
|
size: "1",
|
|
@@ -10229,8 +10814,8 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10229
10814
|
as: "div",
|
|
10230
10815
|
children: "Valor"
|
|
10231
10816
|
}), /* @__PURE__ */ jsx(u$1, {
|
|
10232
|
-
value:
|
|
10233
|
-
onChange: (n) =>
|
|
10817
|
+
value: W.value,
|
|
10818
|
+
onChange: (n) => H(W.id, { value: n.target.value })
|
|
10234
10819
|
})]
|
|
10235
10820
|
})]
|
|
10236
10821
|
}),
|
|
@@ -10244,9 +10829,9 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10244
10829
|
as: "div",
|
|
10245
10830
|
children: "Ação"
|
|
10246
10831
|
}), /* @__PURE__ */ jsxs("select", {
|
|
10247
|
-
value:
|
|
10832
|
+
value: W.style.display === "none" ? "hide" : "style",
|
|
10248
10833
|
onChange: (n) => {
|
|
10249
|
-
n.target.value === "hide" ?
|
|
10834
|
+
n.target.value === "hide" ? U(W.id, { display: "none" }) : U(W.id, { display: void 0 });
|
|
10250
10835
|
},
|
|
10251
10836
|
style: {
|
|
10252
10837
|
width: "100%",
|
|
@@ -10271,7 +10856,7 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10271
10856
|
size: "4",
|
|
10272
10857
|
my: "2"
|
|
10273
10858
|
}),
|
|
10274
|
-
|
|
10859
|
+
W.style.display !== "none" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10275
10860
|
/* @__PURE__ */ jsx(p$2, {
|
|
10276
10861
|
size: "2",
|
|
10277
10862
|
weight: "bold",
|
|
@@ -10286,8 +10871,8 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10286
10871
|
as: "div",
|
|
10287
10872
|
children: "Cor do Texto"
|
|
10288
10873
|
}), /* @__PURE__ */ jsx(ColorInput, {
|
|
10289
|
-
color:
|
|
10290
|
-
onChange: (n) =>
|
|
10874
|
+
color: W.style.color || "#000000",
|
|
10875
|
+
onChange: (n) => U(W.id, { color: n })
|
|
10291
10876
|
})] }), /* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
10292
10877
|
size: "1",
|
|
10293
10878
|
mb: "1",
|
|
@@ -10298,12 +10883,12 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10298
10883
|
children: [/* @__PURE__ */ jsx(p, {
|
|
10299
10884
|
flexGrow: "1",
|
|
10300
10885
|
children: /* @__PURE__ */ jsx(ColorInput, {
|
|
10301
|
-
color:
|
|
10302
|
-
onChange: (n) =>
|
|
10886
|
+
color: W.style.backgroundColor || "#ffffff",
|
|
10887
|
+
onChange: (n) => U(W.id, { backgroundColor: n })
|
|
10303
10888
|
})
|
|
10304
10889
|
}), /* @__PURE__ */ jsx(o$1, {
|
|
10305
10890
|
variant: "outline",
|
|
10306
|
-
onClick: () =>
|
|
10891
|
+
onClick: () => U(W.id, { backgroundColor: void 0 }),
|
|
10307
10892
|
title: "Limpar fundo",
|
|
10308
10893
|
children: /* @__PURE__ */ jsx(Cross2Icon, {})
|
|
10309
10894
|
})]
|
|
@@ -10314,18 +10899,18 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10314
10899
|
mt: "2",
|
|
10315
10900
|
children: [
|
|
10316
10901
|
/* @__PURE__ */ jsx(o, {
|
|
10317
|
-
variant:
|
|
10318
|
-
onClick: () =>
|
|
10902
|
+
variant: W.style.fontWeight === "bold" ? "solid" : "outline",
|
|
10903
|
+
onClick: () => U(W.id, { fontWeight: W.style.fontWeight === "bold" ? "normal" : "bold" }),
|
|
10319
10904
|
children: "Bold"
|
|
10320
10905
|
}),
|
|
10321
10906
|
/* @__PURE__ */ jsx(o, {
|
|
10322
|
-
variant:
|
|
10323
|
-
onClick: () =>
|
|
10907
|
+
variant: W.style.fontStyle === "italic" ? "solid" : "outline",
|
|
10908
|
+
onClick: () => U(W.id, { fontStyle: W.style.fontStyle === "italic" ? "normal" : "italic" }),
|
|
10324
10909
|
children: "Italic"
|
|
10325
10910
|
}),
|
|
10326
10911
|
/* @__PURE__ */ jsx(o, {
|
|
10327
|
-
variant:
|
|
10328
|
-
onClick: () =>
|
|
10912
|
+
variant: W.style.textDecoration === "line-through" ? "solid" : "outline",
|
|
10913
|
+
onClick: () => U(W.id, { textDecoration: W.style.textDecoration === "line-through" ? "none" : "line-through" }),
|
|
10329
10914
|
children: "Riscado"
|
|
10330
10915
|
})
|
|
10331
10916
|
]
|
|
@@ -10333,6 +10918,61 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10333
10918
|
] })
|
|
10334
10919
|
] })]
|
|
10335
10920
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10921
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
10922
|
+
size: "2",
|
|
10923
|
+
weight: "bold",
|
|
10924
|
+
children: "Vínculos de Estilo (Data Binding)"
|
|
10925
|
+
}),
|
|
10926
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
10927
|
+
size: "2",
|
|
10928
|
+
color: "gray",
|
|
10929
|
+
children: "Vincule propriedades de estilo diretamente a variáveis."
|
|
10930
|
+
}),
|
|
10931
|
+
/* @__PURE__ */ jsx(p, {
|
|
10932
|
+
style: {
|
|
10933
|
+
border: "1px solid var(--gray-5)",
|
|
10934
|
+
borderRadius: 4,
|
|
10935
|
+
padding: 12
|
|
10936
|
+
},
|
|
10937
|
+
children: N.map((n) => /* @__PURE__ */ jsxs(p$1, {
|
|
10938
|
+
align: "center",
|
|
10939
|
+
justify: "between",
|
|
10940
|
+
mb: "2",
|
|
10941
|
+
style: { marginBottom: 8 },
|
|
10942
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
10943
|
+
size: "2",
|
|
10944
|
+
children: n.label
|
|
10945
|
+
}), /* @__PURE__ */ jsxs("select", {
|
|
10946
|
+
value: A[n.value] || "",
|
|
10947
|
+
onChange: (_) => P(n.value, _.target.value),
|
|
10948
|
+
style: {
|
|
10949
|
+
width: "200px",
|
|
10950
|
+
padding: "6px",
|
|
10951
|
+
borderRadius: "4px",
|
|
10952
|
+
border: "1px solid var(--gray-6)",
|
|
10953
|
+
backgroundColor: "var(--color-panel-solid)",
|
|
10954
|
+
color: "var(--gray-12)",
|
|
10955
|
+
fontSize: "13px"
|
|
10956
|
+
},
|
|
10957
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
10958
|
+
value: "",
|
|
10959
|
+
children: "(Nenhum)"
|
|
10960
|
+
}), E.map((n) => /* @__PURE__ */ jsx("option", {
|
|
10961
|
+
value: n.dataName,
|
|
10962
|
+
children: n.name
|
|
10963
|
+
}, n.dataName))]
|
|
10964
|
+
})]
|
|
10965
|
+
}, n.value))
|
|
10966
|
+
}),
|
|
10967
|
+
/* @__PURE__ */ jsx(o$2, {
|
|
10968
|
+
size: "4",
|
|
10969
|
+
my: "2"
|
|
10970
|
+
}),
|
|
10971
|
+
/* @__PURE__ */ jsx(p$2, {
|
|
10972
|
+
size: "2",
|
|
10973
|
+
weight: "bold",
|
|
10974
|
+
children: "Regras Condicionais"
|
|
10975
|
+
}),
|
|
10336
10976
|
/* @__PURE__ */ jsx(p$2, {
|
|
10337
10977
|
size: "2",
|
|
10338
10978
|
color: "gray",
|
|
@@ -10359,7 +10999,7 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10359
10999
|
p: "2",
|
|
10360
11000
|
style: { borderBottom: "1px solid var(--gray-4)" },
|
|
10361
11001
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
10362
|
-
onClick: () =>
|
|
11002
|
+
onClick: () => M(n.id),
|
|
10363
11003
|
style: {
|
|
10364
11004
|
cursor: "pointer",
|
|
10365
11005
|
flexGrow: 1
|
|
@@ -10393,45 +11033,45 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
|
|
|
10393
11033
|
}), /* @__PURE__ */ jsx(o$1, {
|
|
10394
11034
|
variant: "ghost",
|
|
10395
11035
|
color: "red",
|
|
10396
|
-
onClick: () =>
|
|
11036
|
+
onClick: () => B(n.id),
|
|
10397
11037
|
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
10398
11038
|
})]
|
|
10399
11039
|
}, n.id))]
|
|
10400
11040
|
}),
|
|
10401
11041
|
/* @__PURE__ */ jsxs(o, {
|
|
10402
|
-
onClick:
|
|
11042
|
+
onClick: z,
|
|
10403
11043
|
children: [/* @__PURE__ */ jsx(PlusIcon, {}), " Adicionar Regra"]
|
|
10404
11044
|
})
|
|
10405
11045
|
] })
|
|
10406
11046
|
});
|
|
10407
11047
|
};
|
|
10408
11048
|
const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
10409
|
-
let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z } = useEditor(), [
|
|
11049
|
+
let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z, renameElement: B, groupElements: H, ungroupElements: U } = useEditor(), [W, G] = useState(!1), [Z, Bj] = useState(!1), [Vj, Hj] = useState(!1), [Gj, Kj] = useState(!1), [qj, Zj] = useState("formatting"), [Qj, $j] = useState({
|
|
10410
11050
|
open: !1,
|
|
10411
11051
|
prop: "",
|
|
10412
11052
|
value: ""
|
|
10413
|
-
}), [
|
|
10414
|
-
let _ =
|
|
11053
|
+
}), [eM, tM] = useState(""), [nM, rM] = useState(_.content), [iM, aM] = useState(_.dataBinding || ""), oM = useRef(null), sM = useRef(null), cM = (n) => {
|
|
11054
|
+
let _ = oM.current;
|
|
10415
11055
|
if (_) {
|
|
10416
|
-
let E = _.selectionStart, O = _.selectionEnd, A =
|
|
10417
|
-
|
|
11056
|
+
let E = _.selectionStart, O = _.selectionEnd, A = nM;
|
|
11057
|
+
rM(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
|
|
10418
11058
|
_.focus();
|
|
10419
11059
|
let O = E + n.length + 4;
|
|
10420
11060
|
_.setSelectionRange(O, O);
|
|
10421
11061
|
}, 0);
|
|
10422
|
-
} else
|
|
10423
|
-
},
|
|
11062
|
+
} else rM((_) => _ + `{{${n}}}`);
|
|
11063
|
+
}, lM = (n) => {
|
|
10424
11064
|
E(_.id, { style: {
|
|
10425
11065
|
..._.style,
|
|
10426
11066
|
...n
|
|
10427
11067
|
} });
|
|
10428
|
-
},
|
|
11068
|
+
}, uM = () => {
|
|
10429
11069
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
10430
11070
|
n < z.elements.length - 1 && M(n, z.elements.length - 1);
|
|
10431
|
-
},
|
|
11071
|
+
}, dM = () => {
|
|
10432
11072
|
let n = z.elements.findIndex((n) => n.id === _.id);
|
|
10433
11073
|
n > 0 && M(n, 0);
|
|
10434
|
-
},
|
|
11074
|
+
}, fM = () => {
|
|
10435
11075
|
z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
|
|
10436
11076
|
type: _.type,
|
|
10437
11077
|
content: _.content,
|
|
@@ -10441,7 +11081,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10441
11081
|
height: _.height,
|
|
10442
11082
|
style: _.style
|
|
10443
11083
|
});
|
|
10444
|
-
},
|
|
11084
|
+
}, pM = [
|
|
10445
11085
|
"#000000",
|
|
10446
11086
|
"#FFFFFF",
|
|
10447
11087
|
"#FF0000",
|
|
@@ -10451,8 +11091,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10451
11091
|
"#808080",
|
|
10452
11092
|
"#800080",
|
|
10453
11093
|
"transparent"
|
|
10454
|
-
],
|
|
10455
|
-
|
|
11094
|
+
], mM = (n, _) => {
|
|
11095
|
+
$j({
|
|
10456
11096
|
open: !0,
|
|
10457
11097
|
prop: n,
|
|
10458
11098
|
value: _
|
|
@@ -10460,8 +11100,37 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10460
11100
|
};
|
|
10461
11101
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10462
11102
|
/* @__PURE__ */ jsx(s$4, {
|
|
10463
|
-
open:
|
|
10464
|
-
onOpenChange:
|
|
11103
|
+
open: W,
|
|
11104
|
+
onOpenChange: G,
|
|
11105
|
+
children: /* @__PURE__ */ jsxs(p$8, {
|
|
11106
|
+
style: { maxWidth: 450 },
|
|
11107
|
+
children: [/* @__PURE__ */ jsx(g$2, { children: "Renomear Camada" }), /* @__PURE__ */ jsxs(p$1, {
|
|
11108
|
+
direction: "column",
|
|
11109
|
+
gap: "3",
|
|
11110
|
+
children: [/* @__PURE__ */ jsx(u$1, {
|
|
11111
|
+
value: eM,
|
|
11112
|
+
onChange: (n) => tM(n.target.value),
|
|
11113
|
+
placeholder: "Nome da camada..."
|
|
11114
|
+
}), /* @__PURE__ */ jsxs(p$1, {
|
|
11115
|
+
gap: "3",
|
|
11116
|
+
justify: "end",
|
|
11117
|
+
children: [/* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
11118
|
+
variant: "soft",
|
|
11119
|
+
color: "gray",
|
|
11120
|
+
children: "Cancelar"
|
|
11121
|
+
}) }), /* @__PURE__ */ jsx(o, {
|
|
11122
|
+
onClick: () => {
|
|
11123
|
+
B(_.id, eM), G(!1);
|
|
11124
|
+
},
|
|
11125
|
+
children: "Salvar"
|
|
11126
|
+
})]
|
|
11127
|
+
})]
|
|
11128
|
+
})]
|
|
11129
|
+
})
|
|
11130
|
+
}),
|
|
11131
|
+
/* @__PURE__ */ jsx(s$4, {
|
|
11132
|
+
open: Z,
|
|
11133
|
+
onOpenChange: Bj,
|
|
10465
11134
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
10466
11135
|
style: { maxWidth: 450 },
|
|
10467
11136
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -10469,9 +11138,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10469
11138
|
gap: "3",
|
|
10470
11139
|
children: [
|
|
10471
11140
|
/* @__PURE__ */ jsx(r, {
|
|
10472
|
-
ref:
|
|
10473
|
-
value:
|
|
10474
|
-
onChange: (n) =>
|
|
11141
|
+
ref: oM,
|
|
11142
|
+
value: nM,
|
|
11143
|
+
onChange: (n) => rM(n.target.value),
|
|
10475
11144
|
placeholder: "Digite o novo texto...",
|
|
10476
11145
|
style: { height: 100 }
|
|
10477
11146
|
}),
|
|
@@ -10489,7 +11158,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10489
11158
|
color: "blue",
|
|
10490
11159
|
variant: "surface",
|
|
10491
11160
|
style: { cursor: "pointer" },
|
|
10492
|
-
onClick: () =>
|
|
11161
|
+
onClick: () => cM(n.dataName),
|
|
10493
11162
|
children: n.name
|
|
10494
11163
|
}, n.dataName))
|
|
10495
11164
|
})]
|
|
@@ -10503,7 +11172,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10503
11172
|
children: "Cancelar"
|
|
10504
11173
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
10505
11174
|
onClick: () => {
|
|
10506
|
-
E(_.id, { content:
|
|
11175
|
+
E(_.id, { content: nM }), Bj(!1);
|
|
10507
11176
|
},
|
|
10508
11177
|
children: "Salvar"
|
|
10509
11178
|
})]
|
|
@@ -10513,8 +11182,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10513
11182
|
})
|
|
10514
11183
|
}),
|
|
10515
11184
|
/* @__PURE__ */ jsx(s$4, {
|
|
10516
|
-
open:
|
|
10517
|
-
onOpenChange:
|
|
11185
|
+
open: Vj,
|
|
11186
|
+
onOpenChange: Hj,
|
|
10518
11187
|
children: /* @__PURE__ */ jsxs(p$8, {
|
|
10519
11188
|
style: { maxWidth: 450 },
|
|
10520
11189
|
children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
|
|
@@ -10526,8 +11195,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10526
11195
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
10527
11196
|
}),
|
|
10528
11197
|
/* @__PURE__ */ jsx(u$1, {
|
|
10529
|
-
value:
|
|
10530
|
-
onChange: (n) =>
|
|
11198
|
+
value: iM,
|
|
11199
|
+
onChange: (n) => aM(n.target.value),
|
|
10531
11200
|
placeholder: "propriedade"
|
|
10532
11201
|
}),
|
|
10533
11202
|
/* @__PURE__ */ jsxs(p$1, {
|
|
@@ -10539,8 +11208,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10539
11208
|
children: "Cancelar"
|
|
10540
11209
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
10541
11210
|
onClick: () => {
|
|
10542
|
-
let n =
|
|
10543
|
-
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O),
|
|
11211
|
+
let n = iM, O = { dataBinding: n };
|
|
11212
|
+
_.type === "text" && (O.content = `{{${n}}}`), E(_.id, O), Hj(!1);
|
|
10544
11213
|
},
|
|
10545
11214
|
children: "Vincular"
|
|
10546
11215
|
})]
|
|
@@ -10550,8 +11219,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10550
11219
|
})
|
|
10551
11220
|
}),
|
|
10552
11221
|
/* @__PURE__ */ jsx(s$4, {
|
|
10553
|
-
open:
|
|
10554
|
-
onOpenChange: (n) =>
|
|
11222
|
+
open: Qj.open,
|
|
11223
|
+
onOpenChange: (n) => $j((_) => ({
|
|
10555
11224
|
..._,
|
|
10556
11225
|
open: n
|
|
10557
11226
|
})),
|
|
@@ -10560,8 +11229,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10560
11229
|
children: [
|
|
10561
11230
|
/* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
|
|
10562
11231
|
/* @__PURE__ */ jsx(ColorPickerContent, {
|
|
10563
|
-
color:
|
|
10564
|
-
onChange: (n) =>
|
|
11232
|
+
color: Qj.value,
|
|
11233
|
+
onChange: (n) => $j((_) => ({
|
|
10565
11234
|
..._,
|
|
10566
11235
|
value: n
|
|
10567
11236
|
}))
|
|
@@ -10576,7 +11245,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10576
11245
|
children: "Cancelar"
|
|
10577
11246
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
10578
11247
|
onClick: () => {
|
|
10579
|
-
|
|
11248
|
+
lM({ [Qj.prop]: Qj.value }), $j((n) => ({
|
|
10580
11249
|
...n,
|
|
10581
11250
|
open: !1
|
|
10582
11251
|
}));
|
|
@@ -10589,12 +11258,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10589
11258
|
}),
|
|
10590
11259
|
/* @__PURE__ */ jsx(ElementAdvancedSettings, {
|
|
10591
11260
|
elementId: _.id,
|
|
10592
|
-
open:
|
|
10593
|
-
onOpenChange:
|
|
11261
|
+
open: Gj,
|
|
11262
|
+
onOpenChange: Kj,
|
|
11263
|
+
initialTab: qj
|
|
10594
11264
|
}),
|
|
10595
11265
|
/* @__PURE__ */ jsx("input", {
|
|
10596
11266
|
type: "file",
|
|
10597
|
-
ref:
|
|
11267
|
+
ref: sM,
|
|
10598
11268
|
style: { display: "none" },
|
|
10599
11269
|
accept: "image/*",
|
|
10600
11270
|
onChange: (n) => {
|
|
@@ -10660,7 +11330,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10660
11330
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10661
11331
|
className: "ContextMenuItem",
|
|
10662
11332
|
onSelect: () => {
|
|
10663
|
-
|
|
11333
|
+
aM(_.dataBinding || ""), Hj(!0);
|
|
10664
11334
|
},
|
|
10665
11335
|
children: "Outro / Manual..."
|
|
10666
11336
|
}),
|
|
@@ -10676,19 +11346,37 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10676
11346
|
_.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
10677
11347
|
className: "ContextMenuItem",
|
|
10678
11348
|
onSelect: () => {
|
|
10679
|
-
|
|
11349
|
+
rM(_.content), Bj(!0);
|
|
10680
11350
|
},
|
|
10681
11351
|
children: "Editar Texto..."
|
|
10682
11352
|
}), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
|
|
10683
11353
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10684
11354
|
className: "ContextMenuItem",
|
|
10685
|
-
onSelect: () =>
|
|
11355
|
+
onSelect: () => {
|
|
11356
|
+
tM(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
|
|
11357
|
+
},
|
|
11358
|
+
children: "Renomear..."
|
|
11359
|
+
}),
|
|
11360
|
+
z.selectedElementIds.length >= 1 && (z.selectedElementIds.includes(_.id) || _.groupId && z.selectedElementIds.includes(_.groupId)) && /* @__PURE__ */ jsx(Item2$1, {
|
|
11361
|
+
className: "ContextMenuItem",
|
|
11362
|
+
onSelect: () => H(z.selectedElementIds),
|
|
11363
|
+
children: z.selectedElementIds.length > 1 ? "Agrupar Seleção" : "Agrupar (Criar Pasta)"
|
|
11364
|
+
}),
|
|
11365
|
+
(_.type === "group" || _.groupId && z.selectedElementIds.includes(_.groupId)) && /* @__PURE__ */ jsx(Item2$1, {
|
|
11366
|
+
className: "ContextMenuItem",
|
|
11367
|
+
onSelect: () => U(_.type === "group" ? _.id : _.groupId),
|
|
11368
|
+
children: _.type === "group" ? "Desagrupar" : "Desagrupar Pai"
|
|
11369
|
+
}),
|
|
11370
|
+
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11371
|
+
/* @__PURE__ */ jsx(Item2$1, {
|
|
11372
|
+
className: "ContextMenuItem",
|
|
11373
|
+
onSelect: () => Kj(!0),
|
|
10686
11374
|
children: "Configurações Avançadas..."
|
|
10687
11375
|
}),
|
|
10688
11376
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
10689
11377
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10690
11378
|
className: "ContextMenuItem",
|
|
10691
|
-
onSelect:
|
|
11379
|
+
onSelect: fM,
|
|
10692
11380
|
children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
|
|
10693
11381
|
}),
|
|
10694
11382
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
@@ -10712,7 +11400,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10712
11400
|
alignOffset: -5,
|
|
10713
11401
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
10714
11402
|
className: "ContextMenuItem",
|
|
10715
|
-
onSelect: () =>
|
|
11403
|
+
onSelect: () => sM.current?.click(),
|
|
10716
11404
|
children: "Carregar do Computador"
|
|
10717
11405
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
10718
11406
|
className: "ContextMenuItem",
|
|
@@ -10738,17 +11426,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10738
11426
|
children: [
|
|
10739
11427
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10740
11428
|
className: "ContextMenuItem",
|
|
10741
|
-
onSelect: () =>
|
|
11429
|
+
onSelect: () => lM({ objectFit: "cover" }),
|
|
10742
11430
|
children: "Preencher (Cover)"
|
|
10743
11431
|
}),
|
|
10744
11432
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10745
11433
|
className: "ContextMenuItem",
|
|
10746
|
-
onSelect: () =>
|
|
11434
|
+
onSelect: () => lM({ objectFit: "contain" }),
|
|
10747
11435
|
children: "Ajustar (Contain)"
|
|
10748
11436
|
}),
|
|
10749
11437
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10750
11438
|
className: "ContextMenuItem",
|
|
10751
|
-
onSelect: () =>
|
|
11439
|
+
onSelect: () => lM({ objectFit: "fill" }),
|
|
10752
11440
|
children: "Esticar (Fill)"
|
|
10753
11441
|
})
|
|
10754
11442
|
]
|
|
@@ -10767,11 +11455,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10767
11455
|
alignOffset: -5,
|
|
10768
11456
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
10769
11457
|
className: "ContextMenuItem",
|
|
10770
|
-
onSelect:
|
|
11458
|
+
onSelect: uM,
|
|
10771
11459
|
children: "Trazer para frente"
|
|
10772
11460
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
10773
11461
|
className: "ContextMenuItem",
|
|
10774
|
-
onSelect:
|
|
11462
|
+
onSelect: dM,
|
|
10775
11463
|
children: "Enviar para trás"
|
|
10776
11464
|
})]
|
|
10777
11465
|
}) })] }),
|
|
@@ -10789,7 +11477,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10789
11477
|
alignOffset: -5,
|
|
10790
11478
|
children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
10791
11479
|
className: "ContextMenuItem",
|
|
10792
|
-
onSelect: () =>
|
|
11480
|
+
onSelect: () => lM({ fontFamily: n }),
|
|
10793
11481
|
style: { fontFamily: n },
|
|
10794
11482
|
children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
|
|
10795
11483
|
className: "RightSlot",
|
|
@@ -10818,7 +11506,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10818
11506
|
64
|
|
10819
11507
|
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
10820
11508
|
className: "ContextMenuItem",
|
|
10821
|
-
onSelect: () =>
|
|
11509
|
+
onSelect: () => lM({ fontSize: `${n}px` }),
|
|
10822
11510
|
children: [n, "px"]
|
|
10823
11511
|
}, n))
|
|
10824
11512
|
}) })] }),
|
|
@@ -10833,9 +11521,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10833
11521
|
sideOffset: 2,
|
|
10834
11522
|
alignOffset: -5,
|
|
10835
11523
|
children: [
|
|
10836
|
-
|
|
11524
|
+
pM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
10837
11525
|
className: "ContextMenuItem",
|
|
10838
|
-
onSelect: () =>
|
|
11526
|
+
onSelect: () => lM({ color: n }),
|
|
10839
11527
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
10840
11528
|
width: 12,
|
|
10841
11529
|
height: 12,
|
|
@@ -10847,7 +11535,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10847
11535
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
10848
11536
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10849
11537
|
className: "ContextMenuItem",
|
|
10850
|
-
onSelect: () =>
|
|
11538
|
+
onSelect: () => mM("color", _.style?.color || "#000000"),
|
|
10851
11539
|
children: "Outra Cor..."
|
|
10852
11540
|
})
|
|
10853
11541
|
]
|
|
@@ -10864,11 +11552,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10864
11552
|
alignOffset: -5,
|
|
10865
11553
|
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
10866
11554
|
className: "ContextMenuItem",
|
|
10867
|
-
onSelect: () =>
|
|
11555
|
+
onSelect: () => lM({ fontWeight: "normal" }),
|
|
10868
11556
|
children: "Normal"
|
|
10869
11557
|
}), /* @__PURE__ */ jsx(Item2$1, {
|
|
10870
11558
|
className: "ContextMenuItem",
|
|
10871
|
-
onSelect: () =>
|
|
11559
|
+
onSelect: () => lM({ fontWeight: "bold" }),
|
|
10872
11560
|
children: "Negrito"
|
|
10873
11561
|
})]
|
|
10874
11562
|
}) })] }),
|
|
@@ -10885,17 +11573,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10885
11573
|
children: [
|
|
10886
11574
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10887
11575
|
className: "ContextMenuItem",
|
|
10888
|
-
onSelect: () =>
|
|
11576
|
+
onSelect: () => lM({ textAlign: "left" }),
|
|
10889
11577
|
children: "Esquerda"
|
|
10890
11578
|
}),
|
|
10891
11579
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10892
11580
|
className: "ContextMenuItem",
|
|
10893
|
-
onSelect: () =>
|
|
11581
|
+
onSelect: () => lM({ textAlign: "center" }),
|
|
10894
11582
|
children: "Centro"
|
|
10895
11583
|
}),
|
|
10896
11584
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10897
11585
|
className: "ContextMenuItem",
|
|
10898
|
-
onSelect: () =>
|
|
11586
|
+
onSelect: () => lM({ textAlign: "right" }),
|
|
10899
11587
|
children: "Direita"
|
|
10900
11588
|
})
|
|
10901
11589
|
]
|
|
@@ -10913,7 +11601,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10913
11601
|
children: [
|
|
10914
11602
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10915
11603
|
className: "ContextMenuItem",
|
|
10916
|
-
onSelect: () =>
|
|
11604
|
+
onSelect: () => lM({
|
|
10917
11605
|
display: "flex",
|
|
10918
11606
|
flexDirection: "column",
|
|
10919
11607
|
justifyContent: "flex-start"
|
|
@@ -10922,7 +11610,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10922
11610
|
}),
|
|
10923
11611
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10924
11612
|
className: "ContextMenuItem",
|
|
10925
|
-
onSelect: () =>
|
|
11613
|
+
onSelect: () => lM({
|
|
10926
11614
|
display: "flex",
|
|
10927
11615
|
flexDirection: "column",
|
|
10928
11616
|
justifyContent: "center"
|
|
@@ -10931,7 +11619,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10931
11619
|
}),
|
|
10932
11620
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10933
11621
|
className: "ContextMenuItem",
|
|
10934
|
-
onSelect: () =>
|
|
11622
|
+
onSelect: () => lM({
|
|
10935
11623
|
display: "flex",
|
|
10936
11624
|
flexDirection: "column",
|
|
10937
11625
|
justifyContent: "flex-end"
|
|
@@ -10952,9 +11640,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10952
11640
|
sideOffset: 2,
|
|
10953
11641
|
alignOffset: -5,
|
|
10954
11642
|
children: [
|
|
10955
|
-
|
|
11643
|
+
pM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
10956
11644
|
className: "ContextMenuItem",
|
|
10957
|
-
onSelect: () =>
|
|
11645
|
+
onSelect: () => lM({ backgroundColor: n }),
|
|
10958
11646
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
10959
11647
|
width: 12,
|
|
10960
11648
|
height: 12,
|
|
@@ -10966,7 +11654,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10966
11654
|
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
10967
11655
|
/* @__PURE__ */ jsx(Item2$1, {
|
|
10968
11656
|
className: "ContextMenuItem",
|
|
10969
|
-
onSelect: () =>
|
|
11657
|
+
onSelect: () => mM("backgroundColor", _.style?.backgroundColor || "transparent"),
|
|
10970
11658
|
children: "Outra Cor..."
|
|
10971
11659
|
})
|
|
10972
11660
|
]
|
|
@@ -10977,23 +11665,33 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
10977
11665
|
className: "RightSlot",
|
|
10978
11666
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
10979
11667
|
})]
|
|
10980
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */
|
|
11668
|
+
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
10981
11669
|
className: "ContextMenuSubContent",
|
|
10982
11670
|
sideOffset: 2,
|
|
10983
11671
|
alignOffset: -5,
|
|
10984
11672
|
children: [
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
11673
|
+
[
|
|
11674
|
+
0,
|
|
11675
|
+
4,
|
|
11676
|
+
8,
|
|
11677
|
+
12,
|
|
11678
|
+
16,
|
|
11679
|
+
24,
|
|
11680
|
+
"50%"
|
|
11681
|
+
].map((n) => /* @__PURE__ */ jsx(Item2$1, {
|
|
11682
|
+
className: "ContextMenuItem",
|
|
11683
|
+
onSelect: () => lM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
|
|
11684
|
+
children: n === "50%" ? "Círculo" : `${n}px`
|
|
11685
|
+
}, n)),
|
|
11686
|
+
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11687
|
+
/* @__PURE__ */ jsx(Item2$1, {
|
|
11688
|
+
className: "ContextMenuItem",
|
|
11689
|
+
onSelect: () => {
|
|
11690
|
+
Zj("style"), Kj(!0);
|
|
11691
|
+
},
|
|
11692
|
+
children: "Personalizar..."
|
|
11693
|
+
})
|
|
11694
|
+
]
|
|
10997
11695
|
}) })] }),
|
|
10998
11696
|
/* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
|
|
10999
11697
|
className: "ContextMenuSubTrigger",
|
|
@@ -11001,23 +11699,33 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11001
11699
|
className: "RightSlot",
|
|
11002
11700
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
11003
11701
|
})]
|
|
11004
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */
|
|
11702
|
+
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
11005
11703
|
className: "ContextMenuSubContent",
|
|
11006
11704
|
sideOffset: 2,
|
|
11007
11705
|
alignOffset: -5,
|
|
11008
11706
|
children: [
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11707
|
+
[
|
|
11708
|
+
0,
|
|
11709
|
+
4,
|
|
11710
|
+
8,
|
|
11711
|
+
12,
|
|
11712
|
+
16,
|
|
11713
|
+
24,
|
|
11714
|
+
32
|
|
11715
|
+
].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
11716
|
+
className: "ContextMenuItem",
|
|
11717
|
+
onSelect: () => lM({ padding: `${n}px` }),
|
|
11718
|
+
children: [n, "px"]
|
|
11719
|
+
}, n)),
|
|
11720
|
+
/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
|
|
11721
|
+
/* @__PURE__ */ jsx(Item2$1, {
|
|
11722
|
+
className: "ContextMenuItem",
|
|
11723
|
+
onSelect: () => {
|
|
11724
|
+
Zj("style"), Kj(!0);
|
|
11725
|
+
},
|
|
11726
|
+
children: "Personalizar..."
|
|
11727
|
+
})
|
|
11728
|
+
]
|
|
11021
11729
|
}) })] })
|
|
11022
11730
|
]
|
|
11023
11731
|
}) })] })
|
|
@@ -11026,42 +11734,52 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11026
11734
|
let { selectElement: E, updateElement: O, updateElements: A, state: j } = useEditor(), [M, N] = useState(!1), [P, z] = useState(!1), B = useRef({
|
|
11027
11735
|
x: 0,
|
|
11028
11736
|
y: 0
|
|
11029
|
-
}), H = useRef({}), U = useRef(!1), G = useRef(!1), Z = useRef(0),
|
|
11737
|
+
}), H = useRef({}), U = useRef(!1), G = useRef(!1), Z = useRef(0), Bj = useRef(0), Vj = useRef({
|
|
11030
11738
|
x: 0,
|
|
11031
11739
|
y: 0
|
|
11032
|
-
}),
|
|
11033
|
-
if (
|
|
11034
|
-
if (n.type === "text")
|
|
11035
|
-
let O =
|
|
11740
|
+
}), Hj = j.canvasHeight || 150, Gj = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, Kj = n.content, qj = {};
|
|
11741
|
+
if (Gj) {
|
|
11742
|
+
if (n.type === "text") Kj = Kj.replace(/\{\{(.*?)\}\}/g, (_, E) => {
|
|
11743
|
+
let O = Gj[E.trim()];
|
|
11036
11744
|
return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
|
|
11037
11745
|
});
|
|
11038
11746
|
else if (n.type === "image") if (n.dataBinding) {
|
|
11039
|
-
let _ =
|
|
11040
|
-
_ != null && (
|
|
11041
|
-
} else
|
|
11042
|
-
let E =
|
|
11747
|
+
let _ = Gj[n.dataBinding];
|
|
11748
|
+
_ != null && (Kj = String(_));
|
|
11749
|
+
} else Kj = Kj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
|
|
11750
|
+
let E = Gj[_.trim()];
|
|
11043
11751
|
return E == null ? n : String(E);
|
|
11044
11752
|
});
|
|
11045
|
-
n.
|
|
11046
|
-
let
|
|
11047
|
-
|
|
11048
|
-
...
|
|
11753
|
+
n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
|
|
11754
|
+
let E = Gj[_];
|
|
11755
|
+
E != null && (qj = {
|
|
11756
|
+
...qj,
|
|
11757
|
+
[n]: String(E)
|
|
11758
|
+
});
|
|
11759
|
+
}), n.conditions && n.conditions.forEach((n) => {
|
|
11760
|
+
let _ = Gj[n.property];
|
|
11761
|
+
checkCondition(_, n.operator, n.value) && (qj = {
|
|
11762
|
+
...qj,
|
|
11049
11763
|
...n.style
|
|
11050
11764
|
});
|
|
11051
11765
|
});
|
|
11052
11766
|
}
|
|
11053
|
-
let
|
|
11054
|
-
if (
|
|
11055
|
-
let { display: n, ..._ } =
|
|
11056
|
-
|
|
11767
|
+
let Jj = qj.display === "none";
|
|
11768
|
+
if (Jj && _) {
|
|
11769
|
+
let { display: n, ..._ } = qj;
|
|
11770
|
+
qj = _;
|
|
11057
11771
|
}
|
|
11058
|
-
let
|
|
11772
|
+
let Zj = (_) => {
|
|
11059
11773
|
_.stopPropagation(), !U.current && !G.current && !M && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
|
|
11060
|
-
},
|
|
11774
|
+
}, Qj = (O) => {
|
|
11061
11775
|
if (O.button !== 0) return;
|
|
11062
11776
|
O.stopPropagation();
|
|
11063
11777
|
let A = O.shiftKey;
|
|
11064
|
-
U.current = !1, G.current = !1,
|
|
11778
|
+
if (U.current = !1, G.current = !1, n.groupId && !_) {
|
|
11779
|
+
E(n.groupId, A);
|
|
11780
|
+
return;
|
|
11781
|
+
}
|
|
11782
|
+
_ || (E(n.id, A), G.current = !0), N(!0), B.current = {
|
|
11065
11783
|
x: O.clientX,
|
|
11066
11784
|
y: O.clientY
|
|
11067
11785
|
};
|
|
@@ -11074,17 +11792,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11074
11792
|
y: n.y
|
|
11075
11793
|
});
|
|
11076
11794
|
}), H.current = P;
|
|
11077
|
-
},
|
|
11795
|
+
}, $j = (_) => {
|
|
11078
11796
|
_.stopPropagation(), _.preventDefault(), z(!0);
|
|
11079
11797
|
let E = _.target.closest(".resizable-element");
|
|
11080
11798
|
if (E) {
|
|
11081
11799
|
let O = E.getBoundingClientRect();
|
|
11082
|
-
|
|
11800
|
+
Vj.current = {
|
|
11083
11801
|
x: O.left + O.width / 2,
|
|
11084
11802
|
y: O.top + O.height / 2
|
|
11085
11803
|
};
|
|
11086
|
-
let A = _.clientX -
|
|
11087
|
-
Z.current = Math.atan2(j, A) * (180 / Math.PI),
|
|
11804
|
+
let A = _.clientX - Vj.current.x, j = _.clientY - Vj.current.y;
|
|
11805
|
+
Z.current = Math.atan2(j, A) * (180 / Math.PI), Bj.current = n.rotation || 0;
|
|
11088
11806
|
}
|
|
11089
11807
|
};
|
|
11090
11808
|
useEffect(() => {
|
|
@@ -11093,7 +11811,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11093
11811
|
let n = _.clientX - B.current.x, E = _.clientY - B.current.y;
|
|
11094
11812
|
(Math.abs(n) > 2 || Math.abs(E) > 2) && (U.current = !0), A(Object.entries(H.current).map(([_, O]) => {
|
|
11095
11813
|
let A = O.x + n, M = O.y + E;
|
|
11096
|
-
return j.isList && (M = Math.max(0, M)), {
|
|
11814
|
+
return j.gridSize > 0 && (A = Math.round(A / j.gridSize) * j.gridSize, M = Math.round(M / j.gridSize) * j.gridSize), j.isList && (M = Math.max(0, M)), {
|
|
11097
11815
|
id: _,
|
|
11098
11816
|
changes: {
|
|
11099
11817
|
x: A,
|
|
@@ -11103,7 +11821,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11103
11821
|
}), !1);
|
|
11104
11822
|
}
|
|
11105
11823
|
if (P) {
|
|
11106
|
-
let E = _.clientX -
|
|
11824
|
+
let E = _.clientX - Vj.current.x, A = _.clientY - Vj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Z.current, M = (Bj.current + j) % 360;
|
|
11107
11825
|
O(n.id, { rotation: M }, !1);
|
|
11108
11826
|
}
|
|
11109
11827
|
}, E = () => {
|
|
@@ -11121,7 +11839,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11121
11839
|
j.isList,
|
|
11122
11840
|
j.selectedElementIds
|
|
11123
11841
|
]);
|
|
11124
|
-
let
|
|
11842
|
+
let eM = {
|
|
11125
11843
|
position: "absolute",
|
|
11126
11844
|
left: 0,
|
|
11127
11845
|
top: 0,
|
|
@@ -11138,7 +11856,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11138
11856
|
wordBreak: n.autoGrow ? "break-word" : void 0,
|
|
11139
11857
|
userSelect: "none",
|
|
11140
11858
|
...n.style,
|
|
11141
|
-
...
|
|
11859
|
+
...qj
|
|
11142
11860
|
};
|
|
11143
11861
|
return /* @__PURE__ */ jsx(Resizable, {
|
|
11144
11862
|
className: "resizable-element",
|
|
@@ -11146,7 +11864,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11146
11864
|
width: n.width ?? 100,
|
|
11147
11865
|
height: n.autoGrow ? "auto" : n.height ?? 100
|
|
11148
11866
|
},
|
|
11149
|
-
maxHeight: j.isList ? Math.max(10,
|
|
11867
|
+
maxHeight: j.isList ? Math.max(10, Hj - n.y) : void 0,
|
|
11150
11868
|
onResizeStop: (_, E, A, j) => {
|
|
11151
11869
|
let M = (n.width ?? 100) + j.width, N = (n.height ?? 100) + j.height;
|
|
11152
11870
|
O(n.id, {
|
|
@@ -11158,8 +11876,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11158
11876
|
position: "absolute",
|
|
11159
11877
|
transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
|
|
11160
11878
|
height: n.autoGrow ? "auto" : void 0,
|
|
11161
|
-
display:
|
|
11162
|
-
opacity:
|
|
11879
|
+
display: Jj && !_ ? "none" : void 0,
|
|
11880
|
+
opacity: Jj && _ ? .4 : 1
|
|
11163
11881
|
},
|
|
11164
11882
|
enable: _ && !n.autoGrow ? void 0 : {
|
|
11165
11883
|
top: !1,
|
|
@@ -11171,6 +11889,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11171
11889
|
bottomLeft: !1,
|
|
11172
11890
|
topLeft: !1
|
|
11173
11891
|
},
|
|
11892
|
+
grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
|
|
11174
11893
|
children: /* @__PURE__ */ jsx(ElementContextMenu, {
|
|
11175
11894
|
element: n,
|
|
11176
11895
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -11180,9 +11899,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11180
11899
|
position: "relative"
|
|
11181
11900
|
},
|
|
11182
11901
|
children: [/* @__PURE__ */ jsxs(p, {
|
|
11183
|
-
style:
|
|
11184
|
-
onMouseDown:
|
|
11185
|
-
onClick:
|
|
11902
|
+
style: eM,
|
|
11903
|
+
onMouseDown: Qj,
|
|
11904
|
+
onClick: Zj,
|
|
11905
|
+
title: n.name,
|
|
11186
11906
|
onMouseEnter: (n) => {
|
|
11187
11907
|
_ || (n.currentTarget.style.borderColor = "var(--gray-6)");
|
|
11188
11908
|
},
|
|
@@ -11195,10 +11915,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11195
11915
|
width: "100%",
|
|
11196
11916
|
height: "100%"
|
|
11197
11917
|
},
|
|
11198
|
-
children:
|
|
11918
|
+
children: Kj
|
|
11199
11919
|
}),
|
|
11200
|
-
n.type === "image" && (
|
|
11201
|
-
src:
|
|
11920
|
+
n.type === "image" && (Kj ? /* @__PURE__ */ jsx("img", {
|
|
11921
|
+
src: Kj,
|
|
11202
11922
|
alt: "Element",
|
|
11203
11923
|
style: {
|
|
11204
11924
|
width: "100%",
|
|
@@ -11224,7 +11944,30 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11224
11944
|
n.type === "box" && /* @__PURE__ */ jsx(p, { style: {
|
|
11225
11945
|
width: "100%",
|
|
11226
11946
|
height: "100%"
|
|
11227
|
-
} })
|
|
11947
|
+
} }),
|
|
11948
|
+
n.type === "group" && /* @__PURE__ */ jsx(p, {
|
|
11949
|
+
style: {
|
|
11950
|
+
width: "100%",
|
|
11951
|
+
height: "100%",
|
|
11952
|
+
border: _ ? "1px dashed var(--accent-9)" : "1px dashed var(--gray-6)",
|
|
11953
|
+
opacity: .5,
|
|
11954
|
+
pointerEvents: "none"
|
|
11955
|
+
},
|
|
11956
|
+
children: /* @__PURE__ */ jsx(p$2, {
|
|
11957
|
+
size: "1",
|
|
11958
|
+
style: {
|
|
11959
|
+
position: "absolute",
|
|
11960
|
+
top: 0,
|
|
11961
|
+
left: 0,
|
|
11962
|
+
backgroundColor: "var(--accent-3)",
|
|
11963
|
+
color: "var(--accent-11)",
|
|
11964
|
+
padding: "2px 6px",
|
|
11965
|
+
fontSize: "10px",
|
|
11966
|
+
borderBottomRightRadius: "4px"
|
|
11967
|
+
},
|
|
11968
|
+
children: n.name || "Grupo"
|
|
11969
|
+
})
|
|
11970
|
+
})
|
|
11228
11971
|
]
|
|
11229
11972
|
}), _ && /* @__PURE__ */ jsx(p, {
|
|
11230
11973
|
style: {
|
|
@@ -11240,7 +11983,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11240
11983
|
zIndex: 50,
|
|
11241
11984
|
boxShadow: "0 0 0 2px white"
|
|
11242
11985
|
},
|
|
11243
|
-
onMouseDown:
|
|
11986
|
+
onMouseDown: $j,
|
|
11244
11987
|
children: /* @__PURE__ */ jsx(p, { style: {
|
|
11245
11988
|
position: "absolute",
|
|
11246
11989
|
top: 12,
|
|
@@ -11255,16 +11998,58 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11255
11998
|
})
|
|
11256
11999
|
});
|
|
11257
12000
|
}), Canvas = () => {
|
|
11258
|
-
let { state: n, selectElement: _,
|
|
11259
|
-
|
|
11260
|
-
|
|
12001
|
+
let { state: n, selectElement: _, setSelectedElements: E, addElement: O } = useEditor(), A = useRef(null), [j, M] = useState(null), N = useRef(!1), P = useRef({
|
|
12002
|
+
x: 0,
|
|
12003
|
+
y: 0
|
|
12004
|
+
}), z = useRef([]), B = (E) => {
|
|
12005
|
+
if (E.target !== A.current && E.target !== E.currentTarget) return;
|
|
12006
|
+
N.current = !0;
|
|
12007
|
+
let O = A.current?.getBoundingClientRect();
|
|
12008
|
+
O && (P.current = {
|
|
12009
|
+
x: E.clientX - O.left,
|
|
12010
|
+
y: E.clientY - O.top
|
|
12011
|
+
}, z.current = n.selectedElementIds, E.shiftKey || (_(null), z.current = []), window.addEventListener("mousemove", U), window.addEventListener("mouseup", G));
|
|
12012
|
+
}, U = useCallback((_) => {
|
|
12013
|
+
if (!N.current || !A.current) return;
|
|
12014
|
+
let O = A.current.getBoundingClientRect(), j = _.clientX - O.left, B = _.clientY - O.top, H = Math.min(P.current.x, j), U = Math.min(P.current.y, B), W = Math.abs(j - P.current.x), G = Math.abs(B - P.current.y);
|
|
12015
|
+
if (M({
|
|
12016
|
+
x: H,
|
|
12017
|
+
y: U,
|
|
12018
|
+
width: W,
|
|
12019
|
+
height: G
|
|
12020
|
+
}), W > 2 || G > 2) {
|
|
12021
|
+
let _ = [];
|
|
12022
|
+
n.elements.forEach((n) => {
|
|
12023
|
+
let E = n.x ?? 0, O = n.y ?? 0, A = n.width ?? 100, j = n.height ?? 100, M = E + A, N = O + j, P = H + W, z = U + G;
|
|
12024
|
+
E < P && M > H && O < z && N > U && _.push(n.id);
|
|
12025
|
+
}), E(Array.from(new Set([...z.current, ..._])));
|
|
12026
|
+
}
|
|
12027
|
+
}, [n.elements, E]), G = useCallback(() => {
|
|
12028
|
+
N.current = !1, M(null), window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", G);
|
|
12029
|
+
}, [U]);
|
|
12030
|
+
useEffect(() => () => {
|
|
12031
|
+
window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", G);
|
|
12032
|
+
}, [U, G]);
|
|
12033
|
+
let Z = useRef(!1), { setCanvasHeight: Bj } = useEditor(), Vj = (n) => {
|
|
12034
|
+
n.stopPropagation(), n.preventDefault(), Z.current = !0, window.addEventListener("mousemove", Hj), window.addEventListener("mouseup", Gj);
|
|
12035
|
+
}, Hj = useCallback((n) => {
|
|
12036
|
+
if (!Z.current || !A.current) return;
|
|
12037
|
+
let _ = A.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12038
|
+
Bj(Math.round(O));
|
|
12039
|
+
}, [Bj]), Gj = useCallback(() => {
|
|
12040
|
+
Z.current = !1, window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Gj);
|
|
12041
|
+
}, [Hj]);
|
|
12042
|
+
useEffect(() => () => {
|
|
12043
|
+
window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Gj);
|
|
12044
|
+
}, [Hj, Gj]);
|
|
12045
|
+
let Kj = (n) => {
|
|
11261
12046
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
11262
|
-
},
|
|
12047
|
+
}, qj = (n) => {
|
|
11263
12048
|
n.preventDefault();
|
|
11264
12049
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
11265
12050
|
if (_) {
|
|
11266
|
-
let
|
|
11267
|
-
|
|
12051
|
+
let E = n.currentTarget.getBoundingClientRect(), A = n.clientX - E.left, j = n.clientY - E.top;
|
|
12052
|
+
O({
|
|
11268
12053
|
type: "text",
|
|
11269
12054
|
content: `{{${_}}}`,
|
|
11270
12055
|
x: A,
|
|
@@ -11274,11 +12059,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11274
12059
|
dataBinding: _
|
|
11275
12060
|
});
|
|
11276
12061
|
}
|
|
11277
|
-
},
|
|
12062
|
+
}, Jj = n.canvasHeight || 150;
|
|
11278
12063
|
return /* @__PURE__ */ jsxs(p, {
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
12064
|
+
ref: A,
|
|
12065
|
+
onMouseDown: B,
|
|
12066
|
+
onDragOver: Kj,
|
|
12067
|
+
onDrop: qj,
|
|
11282
12068
|
style: {
|
|
11283
12069
|
width: "100%",
|
|
11284
12070
|
height: "100%",
|
|
@@ -11289,33 +12075,60 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11289
12075
|
backgroundSize: "20px 20px"
|
|
11290
12076
|
},
|
|
11291
12077
|
children: [
|
|
11292
|
-
|
|
12078
|
+
j && /* @__PURE__ */ jsx("div", { style: {
|
|
12079
|
+
position: "absolute",
|
|
12080
|
+
left: j.x,
|
|
12081
|
+
top: j.y,
|
|
12082
|
+
width: j.width,
|
|
12083
|
+
height: j.height,
|
|
12084
|
+
backgroundColor: "rgba(0, 120, 255, 0.1)",
|
|
12085
|
+
border: "1px solid rgba(0, 120, 255, 0.5)",
|
|
12086
|
+
pointerEvents: "none",
|
|
12087
|
+
zIndex: 9999
|
|
12088
|
+
} }),
|
|
12089
|
+
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
11293
12090
|
style: {
|
|
11294
12091
|
position: "absolute",
|
|
11295
|
-
top:
|
|
12092
|
+
top: Jj,
|
|
11296
12093
|
left: 0,
|
|
11297
12094
|
right: 0,
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
12095
|
+
height: "10px",
|
|
12096
|
+
marginTop: "-5px",
|
|
12097
|
+
cursor: "ns-resize",
|
|
12098
|
+
zIndex: 100,
|
|
12099
|
+
display: "flex",
|
|
12100
|
+
alignItems: "center",
|
|
12101
|
+
justifyContent: "center",
|
|
12102
|
+
group: "resize-handle"
|
|
11301
12103
|
},
|
|
11302
|
-
|
|
12104
|
+
onMouseDown: Vj,
|
|
12105
|
+
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12106
|
+
width: "100%",
|
|
12107
|
+
height: "2px",
|
|
12108
|
+
backgroundColor: "var(--accent-9)",
|
|
12109
|
+
borderBottom: "none",
|
|
12110
|
+
opacity: .8,
|
|
12111
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.2)"
|
|
12112
|
+
} }), /* @__PURE__ */ jsxs("div", {
|
|
11303
12113
|
style: {
|
|
11304
12114
|
position: "absolute",
|
|
11305
12115
|
right: 10,
|
|
11306
|
-
|
|
12116
|
+
top: -20,
|
|
11307
12117
|
backgroundColor: "var(--accent-9)",
|
|
11308
12118
|
color: "white",
|
|
11309
|
-
fontSize: "
|
|
11310
|
-
padding: "2px
|
|
11311
|
-
borderRadius: "
|
|
12119
|
+
fontSize: "11px",
|
|
12120
|
+
padding: "2px 6px",
|
|
12121
|
+
borderRadius: "4px",
|
|
12122
|
+
fontWeight: 500,
|
|
12123
|
+
pointerEvents: "none",
|
|
12124
|
+
boxShadow: "0 2px 5px rgba(0,0,0,0.1)"
|
|
11312
12125
|
},
|
|
11313
12126
|
children: [
|
|
11314
|
-
"
|
|
11315
|
-
|
|
11316
|
-
"px
|
|
12127
|
+
"Altura do Item: ",
|
|
12128
|
+
Jj,
|
|
12129
|
+
"px"
|
|
11317
12130
|
]
|
|
11318
|
-
})
|
|
12131
|
+
})]
|
|
11319
12132
|
}),
|
|
11320
12133
|
n.elements.length === 0 && /* @__PURE__ */ jsx(p$1, {
|
|
11321
12134
|
align: "center",
|
|
@@ -11334,25 +12147,30 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11334
12147
|
]
|
|
11335
12148
|
});
|
|
11336
12149
|
}, EditorSettings = () => {
|
|
11337
|
-
let { state: n, updateListSettings: _, setCanvasHeight: E } = useEditor(), [
|
|
12150
|
+
let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, G] = useState("down"), [Z, Bj] = useState("150"), [Vj, Hj] = useState(""), [Uj, Gj] = useState("0"), [Kj, qj] = useState("slideIn"), [Jj, Zj] = useState(.3), [Qj, $j] = useState("ease-out");
|
|
11338
12151
|
return useEffect(() => {
|
|
11339
|
-
if (
|
|
11340
|
-
|
|
12152
|
+
if (A) {
|
|
12153
|
+
N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"), Hj(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), Bj(String(n.canvasHeight || 150)), Gj(String(n.gridSize || 0));
|
|
11341
12154
|
let _ = n.listSettings.entryAnimation;
|
|
11342
|
-
|
|
12155
|
+
qj(_?.type || "slideIn"), Zj(_?.duration || .3), $j(_?.timingFunction || "ease-out");
|
|
11343
12156
|
}
|
|
11344
|
-
}, [
|
|
11345
|
-
if (!
|
|
11346
|
-
let _ = parseInt(
|
|
12157
|
+
}, [A]), useEffect(() => {
|
|
12158
|
+
if (!A) return;
|
|
12159
|
+
let _ = parseInt(Z, 10);
|
|
11347
12160
|
!isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
|
|
12161
|
+
let j = parseInt(Uj, 10);
|
|
12162
|
+
!isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
|
|
11348
12163
|
}, [
|
|
11349
|
-
|
|
11350
|
-
|
|
12164
|
+
Z,
|
|
12165
|
+
Uj,
|
|
12166
|
+
A,
|
|
11351
12167
|
E,
|
|
11352
|
-
|
|
12168
|
+
O,
|
|
12169
|
+
n.canvasHeight,
|
|
12170
|
+
n.gridSize
|
|
11353
12171
|
]), /* @__PURE__ */ jsxs(s$4, {
|
|
11354
|
-
open:
|
|
11355
|
-
onOpenChange:
|
|
12172
|
+
open: A,
|
|
12173
|
+
onOpenChange: j,
|
|
11356
12174
|
children: [/* @__PURE__ */ jsx(n$3, { children: /* @__PURE__ */ jsxs(o, {
|
|
11357
12175
|
variant: "soft",
|
|
11358
12176
|
color: "gray",
|
|
@@ -11393,8 +12211,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11393
12211
|
as: "div",
|
|
11394
12212
|
children: "Propriedade para Ordenar (ex: data, id)"
|
|
11395
12213
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11396
|
-
value:
|
|
11397
|
-
onChange: (n) =>
|
|
12214
|
+
value: M,
|
|
12215
|
+
onChange: (n) => N(n.target.value),
|
|
11398
12216
|
style: {
|
|
11399
12217
|
width: "100%",
|
|
11400
12218
|
padding: "8px",
|
|
@@ -11419,8 +12237,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11419
12237
|
as: "div",
|
|
11420
12238
|
children: "Direção"
|
|
11421
12239
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11422
|
-
value:
|
|
11423
|
-
onChange: (n) =>
|
|
12240
|
+
value: P,
|
|
12241
|
+
onChange: (n) => z(n.target.value),
|
|
11424
12242
|
style: {
|
|
11425
12243
|
width: "150px",
|
|
11426
12244
|
padding: "8px",
|
|
@@ -11451,8 +12269,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11451
12269
|
as: "div",
|
|
11452
12270
|
children: "Posição do Recente"
|
|
11453
12271
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11454
|
-
value:
|
|
11455
|
-
onChange: (n) =>
|
|
12272
|
+
value: B,
|
|
12273
|
+
onChange: (n) => H(n.target.value),
|
|
11456
12274
|
style: {
|
|
11457
12275
|
width: "100%",
|
|
11458
12276
|
padding: "8px",
|
|
@@ -11479,8 +12297,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11479
12297
|
as: "div",
|
|
11480
12298
|
children: "Comportamento de Rolagem"
|
|
11481
12299
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11482
|
-
value:
|
|
11483
|
-
onChange: (n) =>
|
|
12300
|
+
value: U,
|
|
12301
|
+
onChange: (n) => G(n.target.value),
|
|
11484
12302
|
style: {
|
|
11485
12303
|
width: "100%",
|
|
11486
12304
|
padding: "8px",
|
|
@@ -11522,8 +12340,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11522
12340
|
/* @__PURE__ */ jsx(u$1, {
|
|
11523
12341
|
type: "number",
|
|
11524
12342
|
min: "10",
|
|
11525
|
-
value:
|
|
11526
|
-
onChange: (n) =>
|
|
12343
|
+
value: Z,
|
|
12344
|
+
onChange: (n) => Bj(n.target.value)
|
|
11527
12345
|
}),
|
|
11528
12346
|
/* @__PURE__ */ jsx(p$2, {
|
|
11529
12347
|
size: "1",
|
|
@@ -11544,8 +12362,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11544
12362
|
type: "number",
|
|
11545
12363
|
min: "0",
|
|
11546
12364
|
placeholder: "Auto (100%)",
|
|
11547
|
-
value:
|
|
11548
|
-
onChange: (n) =>
|
|
12365
|
+
value: Vj,
|
|
12366
|
+
onChange: (n) => Hj(n.target.value)
|
|
11549
12367
|
}),
|
|
11550
12368
|
/* @__PURE__ */ jsx(p$2, {
|
|
11551
12369
|
size: "1",
|
|
@@ -11571,8 +12389,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11571
12389
|
as: "div",
|
|
11572
12390
|
children: "Efeito"
|
|
11573
12391
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11574
|
-
value:
|
|
11575
|
-
onChange: (n) =>
|
|
12392
|
+
value: Kj,
|
|
12393
|
+
onChange: (n) => qj(n.target.value),
|
|
11576
12394
|
style: {
|
|
11577
12395
|
width: "100%",
|
|
11578
12396
|
padding: "6px",
|
|
@@ -11591,10 +12409,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11591
12409
|
value: "slideIn",
|
|
11592
12410
|
children: "Slide (Padrão)"
|
|
11593
12411
|
}),
|
|
12412
|
+
/* @__PURE__ */ jsx("option", {
|
|
12413
|
+
value: "smoothSlideUp",
|
|
12414
|
+
children: "Slide Suave (Up)"
|
|
12415
|
+
}),
|
|
11594
12416
|
/* @__PURE__ */ jsx("option", {
|
|
11595
12417
|
value: "fadeIn",
|
|
11596
12418
|
children: "Fade In"
|
|
11597
12419
|
}),
|
|
12420
|
+
/* @__PURE__ */ jsx("option", {
|
|
12421
|
+
value: "popIn",
|
|
12422
|
+
children: "Pop In"
|
|
12423
|
+
}),
|
|
12424
|
+
/* @__PURE__ */ jsx("option", {
|
|
12425
|
+
value: "blurIn",
|
|
12426
|
+
children: "Blur In"
|
|
12427
|
+
}),
|
|
11598
12428
|
/* @__PURE__ */ jsx("option", {
|
|
11599
12429
|
value: "slideInLeft",
|
|
11600
12430
|
children: "Slide (Esq)"
|
|
@@ -11622,8 +12452,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11622
12452
|
type: "number",
|
|
11623
12453
|
step: "0.1",
|
|
11624
12454
|
min: "0.1",
|
|
11625
|
-
value:
|
|
11626
|
-
onChange: (n) =>
|
|
12455
|
+
value: Jj,
|
|
12456
|
+
onChange: (n) => Zj(parseFloat(n.target.value) || .3)
|
|
11627
12457
|
})] }),
|
|
11628
12458
|
/* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
|
|
11629
12459
|
size: "1",
|
|
@@ -11631,8 +12461,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11631
12461
|
as: "div",
|
|
11632
12462
|
children: "Curva (Easing)"
|
|
11633
12463
|
}), /* @__PURE__ */ jsxs("select", {
|
|
11634
|
-
value:
|
|
11635
|
-
onChange: (n) =>
|
|
12464
|
+
value: Qj,
|
|
12465
|
+
onChange: (n) => $j(n.target.value),
|
|
11636
12466
|
style: {
|
|
11637
12467
|
width: "100%",
|
|
11638
12468
|
padding: "6px",
|
|
@@ -11667,6 +12497,32 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11667
12497
|
size: "1",
|
|
11668
12498
|
color: "gray",
|
|
11669
12499
|
children: "Essa propriedade será usada para ordenar os itens no modo lista."
|
|
12500
|
+
}),
|
|
12501
|
+
/* @__PURE__ */ jsxs(p, {
|
|
12502
|
+
mt: "2",
|
|
12503
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
12504
|
+
size: "2",
|
|
12505
|
+
weight: "bold",
|
|
12506
|
+
children: "Grid Snapping (Travar)"
|
|
12507
|
+
}), /* @__PURE__ */ jsx(p$1, {
|
|
12508
|
+
gap: "3",
|
|
12509
|
+
align: "center",
|
|
12510
|
+
mt: "2",
|
|
12511
|
+
children: /* @__PURE__ */ jsxs(p, {
|
|
12512
|
+
flexGrow: "1",
|
|
12513
|
+
children: [/* @__PURE__ */ jsx(p$2, {
|
|
12514
|
+
size: "1",
|
|
12515
|
+
mb: "1",
|
|
12516
|
+
as: "div",
|
|
12517
|
+
children: "Tamanho do Grid (px) - 0 para desativar"
|
|
12518
|
+
}), /* @__PURE__ */ jsx(u$1, {
|
|
12519
|
+
type: "number",
|
|
12520
|
+
value: Uj,
|
|
12521
|
+
onChange: (n) => Gj(n.target.value),
|
|
12522
|
+
placeholder: "0"
|
|
12523
|
+
})]
|
|
12524
|
+
})
|
|
12525
|
+
})]
|
|
11670
12526
|
})
|
|
11671
12527
|
]
|
|
11672
12528
|
})
|
|
@@ -11681,20 +12537,20 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
11681
12537
|
children: "Cancelar"
|
|
11682
12538
|
}) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
|
|
11683
12539
|
onClick: () => {
|
|
11684
|
-
let n = parseInt(
|
|
11685
|
-
type:
|
|
11686
|
-
duration: Number(
|
|
12540
|
+
let n = parseInt(Vj, 10), E = {
|
|
12541
|
+
type: Kj,
|
|
12542
|
+
duration: Number(Jj),
|
|
11687
12543
|
delay: 0,
|
|
11688
|
-
timingFunction:
|
|
12544
|
+
timingFunction: Qj
|
|
11689
12545
|
};
|
|
11690
12546
|
_({
|
|
11691
|
-
sortProp:
|
|
11692
|
-
sortOrder:
|
|
11693
|
-
newestPosition:
|
|
11694
|
-
scrollDirection:
|
|
12547
|
+
sortProp: M === "__none__" ? "" : M,
|
|
12548
|
+
sortOrder: P,
|
|
12549
|
+
newestPosition: B,
|
|
12550
|
+
scrollDirection: U,
|
|
11695
12551
|
containerHeight: !isNaN(n) && n > 0 ? n : void 0,
|
|
11696
12552
|
entryAnimation: E
|
|
11697
|
-
}),
|
|
12553
|
+
}), j(!1);
|
|
11698
12554
|
},
|
|
11699
12555
|
children: "Salvar Alterações"
|
|
11700
12556
|
}) })]
|
|
@@ -11849,13 +12705,13 @@ function createRenderBatcher(n, _) {
|
|
|
11849
12705
|
}, 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 = () => {
|
|
11850
12706
|
let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
|
|
11851
12707
|
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));
|
|
11852
|
-
},
|
|
12708
|
+
}, Bj = () => {
|
|
11853
12709
|
E = !0, O = !0, A.isProcessing || n(Z);
|
|
11854
12710
|
};
|
|
11855
12711
|
return {
|
|
11856
12712
|
schedule: stepsOrder.reduce((n, _) => {
|
|
11857
12713
|
let O = M[_];
|
|
11858
|
-
return n[_] = (n, _ = !1, A = !1) => (E ||
|
|
12714
|
+
return n[_] = (n, _ = !1, A = !1) => (E || Bj(), O.schedule(n, _, A)), n;
|
|
11859
12715
|
}, {}),
|
|
11860
12716
|
cancel: (n) => {
|
|
11861
12717
|
for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
|
|
@@ -12213,40 +13069,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
|
12213
13069
|
}, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
|
|
12214
13070
|
...E,
|
|
12215
13071
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
|
|
12216
|
-
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)),
|
|
12217
|
-
O ||=
|
|
12218
|
-
let
|
|
13072
|
+
}), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Bj = M - j, Vj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), Hj = Math.abs(Bj) < 5;
|
|
13073
|
+
O ||= Hj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= Hj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
13074
|
+
let Uj;
|
|
12219
13075
|
if (Z < 1) {
|
|
12220
|
-
let n = calcAngularFreq(
|
|
12221
|
-
|
|
12222
|
-
} else if (Z === 1)
|
|
13076
|
+
let n = calcAngularFreq(Vj, Z);
|
|
13077
|
+
Uj = (_) => M - Math.exp(-Z * Vj * _) * ((G + Z * Vj * Bj) / n * Math.sin(n * _) + Bj * Math.cos(n * _));
|
|
13078
|
+
} else if (Z === 1) Uj = (n) => M - Math.exp(-Vj * n) * (Bj + (G + Vj * Bj) * n);
|
|
12223
13079
|
else {
|
|
12224
|
-
let n =
|
|
12225
|
-
|
|
12226
|
-
let E = Math.exp(-Z *
|
|
12227
|
-
return M - E * ((G + Z *
|
|
13080
|
+
let n = Vj * Math.sqrt(Z * Z - 1);
|
|
13081
|
+
Uj = (_) => {
|
|
13082
|
+
let E = Math.exp(-Z * Vj * _), O = Math.min(n * _, 300);
|
|
13083
|
+
return M - E * ((G + Z * Vj * Bj) * Math.sinh(O) + n * Bj * Math.cosh(O)) / n;
|
|
12228
13084
|
};
|
|
12229
13085
|
}
|
|
12230
|
-
let
|
|
13086
|
+
let Wj = {
|
|
12231
13087
|
calculatedDuration: W && H || null,
|
|
12232
13088
|
next: (n) => {
|
|
12233
|
-
let _ =
|
|
13089
|
+
let _ = Uj(n);
|
|
12234
13090
|
if (W) N.done = n >= H;
|
|
12235
13091
|
else {
|
|
12236
13092
|
let E = n === 0 ? G : 0;
|
|
12237
|
-
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(
|
|
13093
|
+
Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Uj, n, _));
|
|
12238
13094
|
let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
|
|
12239
13095
|
N.done = j && P;
|
|
12240
13096
|
}
|
|
12241
13097
|
return N.value = N.done ? M : _, N;
|
|
12242
13098
|
},
|
|
12243
13099
|
toString: () => {
|
|
12244
|
-
let n = Math.min(calcGeneratorDuration(
|
|
13100
|
+
let n = Math.min(calcGeneratorDuration(Wj), maxGeneratorDuration), _ = generateLinearEasing((_) => Wj.next(n * _).value, n, 30);
|
|
12245
13101
|
return n + "ms " + _;
|
|
12246
13102
|
},
|
|
12247
13103
|
toTransition: () => {}
|
|
12248
13104
|
};
|
|
12249
|
-
return
|
|
13105
|
+
return Wj;
|
|
12250
13106
|
}
|
|
12251
13107
|
spring.applyToOptions = (n) => {
|
|
12252
13108
|
let _ = createGeneratorEasing(n, 100, spring);
|
|
@@ -12256,26 +13112,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
|
|
|
12256
13112
|
let H = n[0], U = {
|
|
12257
13113
|
done: !1,
|
|
12258
13114
|
value: H
|
|
12259
|
-
}, 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 * _,
|
|
12260
|
-
|
|
12261
|
-
let
|
|
12262
|
-
let _ =
|
|
12263
|
-
U.done = Math.abs(_) <= z, U.value = U.done ?
|
|
12264
|
-
},
|
|
12265
|
-
W(U.value) && (
|
|
13115
|
+
}, W = (n) => N !== void 0 && n < N || P !== void 0 && n > P, G = (n) => N === void 0 ? P : P === void 0 || Math.abs(N - n) < Math.abs(P - n) ? N : P, Z = E * _, Bj = H + Z, Vj = M === void 0 ? Bj : M(Bj);
|
|
13116
|
+
Vj !== Bj && (Z = Vj - H);
|
|
13117
|
+
let Hj = (n) => -Z * Math.exp(-n / O), Uj = (n) => Vj + Hj(n), Wj = (n) => {
|
|
13118
|
+
let _ = Hj(n), E = Uj(n);
|
|
13119
|
+
U.done = Math.abs(_) <= z, U.value = U.done ? Vj : E;
|
|
13120
|
+
}, Gj, Kj, qj = (n) => {
|
|
13121
|
+
W(U.value) && (Gj = n, Kj = spring({
|
|
12266
13122
|
keyframes: [U.value, G(U.value)],
|
|
12267
|
-
velocity: calcGeneratorVelocity(
|
|
13123
|
+
velocity: calcGeneratorVelocity(Uj, n, U.value),
|
|
12268
13124
|
damping: A,
|
|
12269
13125
|
stiffness: j,
|
|
12270
13126
|
restDelta: z,
|
|
12271
13127
|
restSpeed: B
|
|
12272
13128
|
}));
|
|
12273
13129
|
};
|
|
12274
|
-
return
|
|
13130
|
+
return qj(0), {
|
|
12275
13131
|
calculatedDuration: null,
|
|
12276
13132
|
next: (n) => {
|
|
12277
13133
|
let _ = !1;
|
|
12278
|
-
return !
|
|
13134
|
+
return !Kj && Gj === void 0 && (_ = !0, Wj(n), qj(n)), Gj !== void 0 && n >= Gj ? Kj.next(n - Gj) : (!_ && Wj(n), U);
|
|
12279
13135
|
}
|
|
12280
13136
|
};
|
|
12281
13137
|
}
|
|
@@ -12395,22 +13251,22 @@ var WithPromise = class {
|
|
|
12395
13251
|
if (this.startTime === null) return E.next(0);
|
|
12396
13252
|
let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
|
|
12397
13253
|
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);
|
|
12398
|
-
let
|
|
12399
|
-
this.currentTime = Math.max(
|
|
12400
|
-
let
|
|
13254
|
+
let Bj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), Vj = this.playbackSpeed >= 0 ? Bj < 0 : Bj > O;
|
|
13255
|
+
this.currentTime = Math.max(Bj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
|
|
13256
|
+
let Hj = this.currentTime, Uj = E;
|
|
12401
13257
|
if (B) {
|
|
12402
13258
|
let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
|
|
12403
|
-
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (
|
|
13259
|
+
!E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Uj = j)), Hj = clamp(0, 1, E) * M;
|
|
12404
13260
|
}
|
|
12405
|
-
let
|
|
13261
|
+
let Wj = Vj ? {
|
|
12406
13262
|
done: !1,
|
|
12407
13263
|
value: z[0]
|
|
12408
|
-
} :
|
|
12409
|
-
A && (
|
|
12410
|
-
let { done:
|
|
12411
|
-
!
|
|
12412
|
-
let
|
|
12413
|
-
return
|
|
13264
|
+
} : Uj.next(Hj);
|
|
13265
|
+
A && (Wj.value = A(Wj.value));
|
|
13266
|
+
let { done: Gj } = Wj;
|
|
13267
|
+
!Vj && N !== null && (Gj = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
|
|
13268
|
+
let Kj = this.holdTime === null && (this.state === "finished" || this.state === "running" && Gj);
|
|
13269
|
+
return Kj && W !== inertia && (Wj.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(Wj.value), Kj && this.finish(), Wj;
|
|
12414
13270
|
}
|
|
12415
13271
|
then(n, _) {
|
|
12416
13272
|
return this.finished.then(n, _);
|
|
@@ -13473,46 +14329,46 @@ function onlyElements(n) {
|
|
|
13473
14329
|
}), _;
|
|
13474
14330
|
}
|
|
13475
14331
|
var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
|
|
13476
|
-
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H),
|
|
14332
|
+
let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Bj = useConstant(() => /* @__PURE__ */ new Map()), Vj = useRef(/* @__PURE__ */ new Set()), [Gj, Kj] = useState(H), [qj, Xj] = useState(H);
|
|
13477
14333
|
useIsomorphicLayoutEffect(() => {
|
|
13478
14334
|
G.current = !1, Z.current = H;
|
|
13479
|
-
for (let n = 0; n <
|
|
13480
|
-
let _ = getChildKey(
|
|
13481
|
-
W.includes(_) ? (
|
|
14335
|
+
for (let n = 0; n < qj.length; n++) {
|
|
14336
|
+
let _ = getChildKey(qj[n]);
|
|
14337
|
+
W.includes(_) ? (Bj.delete(_), Vj.current.delete(_)) : Bj.get(_) !== !0 && Bj.set(_, !1);
|
|
13482
14338
|
}
|
|
13483
14339
|
}, [
|
|
13484
|
-
|
|
14340
|
+
qj,
|
|
13485
14341
|
W.length,
|
|
13486
14342
|
W.join("-")
|
|
13487
14343
|
]);
|
|
13488
|
-
let
|
|
13489
|
-
if (H !==
|
|
14344
|
+
let Zj = [];
|
|
14345
|
+
if (H !== Gj) {
|
|
13490
14346
|
let n = [...H];
|
|
13491
|
-
for (let _ = 0; _ <
|
|
13492
|
-
let E =
|
|
13493
|
-
W.includes(O) || (n.splice(_, 0, E),
|
|
14347
|
+
for (let _ = 0; _ < qj.length; _++) {
|
|
14348
|
+
let E = qj[_], O = getChildKey(E);
|
|
14349
|
+
W.includes(O) || (n.splice(_, 0, E), Zj.push(E));
|
|
13494
14350
|
}
|
|
13495
|
-
return j === "wait" &&
|
|
14351
|
+
return j === "wait" && Zj.length && (n = Zj), Xj(onlyElements(n)), Kj(H), null;
|
|
13496
14352
|
}
|
|
13497
|
-
process.env.NODE_ENV !== "production" && j === "wait" &&
|
|
13498
|
-
let { forceRender:
|
|
13499
|
-
return jsx(Fragment$1, { children:
|
|
13500
|
-
let U = getChildKey(n),
|
|
14353
|
+
process.env.NODE_ENV !== "production" && j === "wait" && qj.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.");
|
|
14354
|
+
let { forceRender: Qj } = useContext(LayoutGroupContext);
|
|
14355
|
+
return jsx(Fragment$1, { children: qj.map((n) => {
|
|
14356
|
+
let U = getChildKey(n), Hj = M && !z ? !1 : H === qj || W.includes(U);
|
|
13501
14357
|
return jsx(PresenceChild, {
|
|
13502
|
-
isPresent:
|
|
14358
|
+
isPresent: Hj,
|
|
13503
14359
|
initial: !G.current || E ? void 0 : !1,
|
|
13504
14360
|
custom: _,
|
|
13505
14361
|
presenceAffectsLayout: A,
|
|
13506
14362
|
mode: j,
|
|
13507
14363
|
root: P,
|
|
13508
|
-
onExitComplete:
|
|
13509
|
-
if (
|
|
13510
|
-
if (
|
|
14364
|
+
onExitComplete: Hj ? void 0 : () => {
|
|
14365
|
+
if (Vj.current.has(U)) return;
|
|
14366
|
+
if (Vj.current.add(U), Bj.has(U)) Bj.set(U, !0);
|
|
13511
14367
|
else return;
|
|
13512
14368
|
let n = !0;
|
|
13513
|
-
|
|
14369
|
+
Bj.forEach((_) => {
|
|
13514
14370
|
_ || (n = !1);
|
|
13515
|
-
}), n && (
|
|
14371
|
+
}), n && (Qj?.(), Xj(Z.current), M && B?.(), O && O());
|
|
13516
14372
|
},
|
|
13517
14373
|
anchorX: N,
|
|
13518
14374
|
children: n
|
|
@@ -13941,12 +14797,12 @@ function useVisualElement(n, _, E, O, A, j) {
|
|
|
13941
14797
|
useInsertionEffect(() => {
|
|
13942
14798
|
H && Z.current && H.update(E, P);
|
|
13943
14799
|
});
|
|
13944
|
-
let
|
|
14800
|
+
let Vj = E[optimizedAppearDataAttribute], Hj = useRef(!!Vj && !window.MotionHandoffIsComplete?.(Vj) && window.MotionHasOptimisedAnimation?.(Vj));
|
|
13945
14801
|
return useIsomorphicLayoutEffect(() => {
|
|
13946
|
-
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(),
|
|
14802
|
+
H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), Hj.current && H.animationState && H.animationState.animateChanges());
|
|
13947
14803
|
}), useEffect(() => {
|
|
13948
|
-
H && (!
|
|
13949
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
14804
|
+
H && (!Hj.current && H.animationState && H.animationState.animateChanges(), Hj.current &&= (queueMicrotask(() => {
|
|
14805
|
+
window.MotionHandoffMarkAsComplete?.(Vj);
|
|
13950
14806
|
}), !1), H.enteringChildren = void 0);
|
|
13951
14807
|
}), H;
|
|
13952
14808
|
}
|
|
@@ -14624,34 +15480,34 @@ function createAnimationState(n) {
|
|
|
14624
15480
|
function M(j) {
|
|
14625
15481
|
let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
|
|
14626
15482
|
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
14627
|
-
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G),
|
|
14628
|
-
|
|
14629
|
-
let
|
|
14630
|
-
if (
|
|
14631
|
-
let
|
|
14632
|
-
|
|
14633
|
-
let { prevResolvedValues:
|
|
14634
|
-
...
|
|
14635
|
-
...
|
|
14636
|
-
},
|
|
14637
|
-
|
|
15483
|
+
let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Bj = U === j ? W.isActive : null;
|
|
15484
|
+
Bj === !1 && (H = _);
|
|
15485
|
+
let Vj = G === N[U] && G !== M[U] && Z;
|
|
15486
|
+
if (Vj && O && n.manuallyAnimateOnMount && (Vj = !1), W.protectedKeys = { ...B }, !W.isActive && Bj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
|
|
15487
|
+
let Hj = checkVariantsDidChange(W.prevProp, G), Uj = Hj || U === j && W.isActive && !Vj && Z || _ > H && Z, Wj = !1, Gj = Array.isArray(G) ? G : [G], Kj = Gj.reduce(A(U), {});
|
|
15488
|
+
Bj === !1 && (Kj = {});
|
|
15489
|
+
let { prevResolvedValues: qj = {} } = W, Jj = {
|
|
15490
|
+
...qj,
|
|
15491
|
+
...Kj
|
|
15492
|
+
}, Yj = (_) => {
|
|
15493
|
+
Uj = !0, z.has(_) && (Wj = !0, z.delete(_)), W.needsAnimating[_] = !0;
|
|
14638
15494
|
let E = n.getValue(_);
|
|
14639
15495
|
E && (E.liveStyle = !1);
|
|
14640
15496
|
};
|
|
14641
|
-
for (let n in
|
|
14642
|
-
let _ =
|
|
15497
|
+
for (let n in Jj) {
|
|
15498
|
+
let _ = Kj[n], E = qj[n];
|
|
14643
15499
|
if (B.hasOwnProperty(n)) continue;
|
|
14644
15500
|
let O = !1;
|
|
14645
|
-
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) :
|
|
15501
|
+
O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : Yj(n) : _ !== void 0 && z.has(n) ? Yj(n) : W.protectedKeys[n] = !0;
|
|
14646
15502
|
}
|
|
14647
|
-
W.prevProp = G, W.prevResolvedValues =
|
|
15503
|
+
W.prevProp = G, W.prevResolvedValues = Kj, W.isActive && (B = {
|
|
14648
15504
|
...B,
|
|
14649
|
-
...
|
|
14650
|
-
}), O && n.blockInitialAnimation && (
|
|
14651
|
-
let
|
|
14652
|
-
|
|
15505
|
+
...Kj
|
|
15506
|
+
}), O && n.blockInitialAnimation && (Uj = !1);
|
|
15507
|
+
let Xj = Vj && Hj;
|
|
15508
|
+
Uj && (!Xj || Wj) && P.push(...Gj.map((_) => {
|
|
14653
15509
|
let E = { type: U };
|
|
14654
|
-
if (typeof _ == "string" && O && !
|
|
15510
|
+
if (typeof _ == "string" && O && !Xj && n.manuallyAnimateOnMount && n.parent) {
|
|
14655
15511
|
let { parent: O } = n, A = resolveVariant(O, _);
|
|
14656
15512
|
if (O.enteringChildren && A) {
|
|
14657
15513
|
let { delayChildren: _ } = A.transition || {};
|
|
@@ -16149,7 +17005,66 @@ var gestureAnimations = {
|
|
|
16149
17005
|
...gestureAnimations,
|
|
16150
17006
|
...drag,
|
|
16151
17007
|
...layout
|
|
16152
|
-
}, createDomVisualElement),
|
|
17008
|
+
}, createDomVisualElement), isInside = (n, _) => n.id === _.id ? !1 : n.x >= _.x && n.x + n.width <= _.x + _.width && n.y >= _.y && n.y + n.height <= _.y + _.height, measureTextHeight = (n, _, E, O, A = 1.2) => {
|
|
17009
|
+
if (!n) return 0;
|
|
17010
|
+
let j = document.createElement("canvas").getContext("2d");
|
|
17011
|
+
if (!j) return 0;
|
|
17012
|
+
j.font = `${O}px ${E}`;
|
|
17013
|
+
let M = n.split(" "), N = "", P = 1;
|
|
17014
|
+
for (let n = 0; n < M.length; n++) {
|
|
17015
|
+
let E = N + M[n] + " ";
|
|
17016
|
+
j.measureText(E).width > _ && n > 0 ? (N = M[n] + " ", P++) : N = E;
|
|
17017
|
+
}
|
|
17018
|
+
let z = n.split("\n").length - 1;
|
|
17019
|
+
return P += z, Math.ceil(P * O * A);
|
|
17020
|
+
};
|
|
17021
|
+
const processLayout = (n, _) => {
|
|
17022
|
+
let E = n.map((n) => ({ ...n })), O = new Map(n.map((n) => [n.id, n])), A = [];
|
|
17023
|
+
E.forEach((n) => {
|
|
17024
|
+
if (n.type === "text" && n.autoGrow) {
|
|
17025
|
+
let j = n.content;
|
|
17026
|
+
_ && (j = j.replace(/\{\{(.*?)\}\}/g, (E, O) => {
|
|
17027
|
+
let A = _[O.trim()];
|
|
17028
|
+
return A == null ? E : n.formatting ? formatValue(A, n.formatting) : String(A);
|
|
17029
|
+
}));
|
|
17030
|
+
let M = parseInt(String(n.style?.fontSize || 16)), N = String(n.style?.fontFamily || "Arial"), P = measureTextHeight(j, n.width, N, M), z = n.height, B = P - z;
|
|
17031
|
+
if (B > 0) {
|
|
17032
|
+
n.height = P, n.content = j;
|
|
17033
|
+
let _ = [], M = O.get(n.id);
|
|
17034
|
+
M && E.forEach((n) => {
|
|
17035
|
+
if (n.type === "box") {
|
|
17036
|
+
let E = O.get(n.id);
|
|
17037
|
+
E && isInside(M, E) && _.push(n);
|
|
17038
|
+
}
|
|
17039
|
+
});
|
|
17040
|
+
let N = new Set([n.id]);
|
|
17041
|
+
_.forEach((n) => {
|
|
17042
|
+
n.height += B, N.add(n.id);
|
|
17043
|
+
}), A.push({
|
|
17044
|
+
triggerY: n.y + z,
|
|
17045
|
+
delta: B,
|
|
17046
|
+
ignoreIds: N
|
|
17047
|
+
});
|
|
17048
|
+
}
|
|
17049
|
+
}
|
|
17050
|
+
}), E.forEach((n) => {
|
|
17051
|
+
let _ = O.get(n.id);
|
|
17052
|
+
if (!_) return;
|
|
17053
|
+
let E = 0;
|
|
17054
|
+
A.forEach((O) => {
|
|
17055
|
+
O.ignoreIds.has(n.id) || _.y >= O.triggerY - .1 && (E += O.delta);
|
|
17056
|
+
}), n.y += E;
|
|
17057
|
+
});
|
|
17058
|
+
let j = 0;
|
|
17059
|
+
return E.forEach((n) => {
|
|
17060
|
+
let _ = n.y + n.height;
|
|
17061
|
+
_ > j && (j = _);
|
|
17062
|
+
}), {
|
|
17063
|
+
elements: E,
|
|
17064
|
+
totalHeight: j
|
|
17065
|
+
};
|
|
17066
|
+
};
|
|
17067
|
+
var getAnimationVariants = (n) => {
|
|
16153
17068
|
if (!n || n.type === "none") return {
|
|
16154
17069
|
initial: {
|
|
16155
17070
|
opacity: 0,
|
|
@@ -16305,12 +17220,12 @@ var gestureAnimations = {
|
|
|
16305
17220
|
} })
|
|
16306
17221
|
]
|
|
16307
17222
|
});
|
|
16308
|
-
}, ListItem = ({
|
|
16309
|
-
let A = React.useMemo(() => getAnimationVariants(O), [O]);
|
|
17223
|
+
}, ListItem = ({ item: n, elements: E, animation: O }) => {
|
|
17224
|
+
let { elements: A, totalHeight: j } = React.useMemo(() => processLayout(E, n), [E, n]), M = React.useMemo(() => getAnimationVariants(O), [O]);
|
|
16310
17225
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
16311
17226
|
layout: !0,
|
|
16312
|
-
initial:
|
|
16313
|
-
animate:
|
|
17227
|
+
initial: M.initial,
|
|
17228
|
+
animate: M.animate,
|
|
16314
17229
|
exit: {
|
|
16315
17230
|
opacity: 0,
|
|
16316
17231
|
scale: .9
|
|
@@ -16325,17 +17240,21 @@ var gestureAnimations = {
|
|
|
16325
17240
|
},
|
|
16326
17241
|
style: {
|
|
16327
17242
|
position: "relative",
|
|
16328
|
-
height:
|
|
17243
|
+
height: j,
|
|
16329
17244
|
width: "100%",
|
|
16330
17245
|
marginBottom: "20px",
|
|
16331
17246
|
transformOrigin: "center center"
|
|
16332
17247
|
},
|
|
16333
|
-
children:
|
|
17248
|
+
children: A.map((_) => /* @__PURE__ */ jsx(PreviewElementRenderer, {
|
|
17249
|
+
element: _,
|
|
17250
|
+
offsetY: 0,
|
|
17251
|
+
dataContext: n
|
|
17252
|
+
}, _.id))
|
|
16334
17253
|
});
|
|
16335
17254
|
};
|
|
16336
17255
|
const Preview = () => {
|
|
16337
17256
|
let { state: n } = useEditor(), [E, O] = React.useState(!1), [A, j] = React.useState([]);
|
|
16338
|
-
React.useEffect(() => {
|
|
17257
|
+
return React.useEffect(() => {
|
|
16339
17258
|
let _;
|
|
16340
17259
|
return E && n.isList ? (A.length === 0 && j([{
|
|
16341
17260
|
id: Date.now(),
|
|
@@ -16354,9 +17273,7 @@ const Preview = () => {
|
|
|
16354
17273
|
n.isList,
|
|
16355
17274
|
n.listSettings.newestPosition,
|
|
16356
17275
|
n.mockData
|
|
16357
|
-
])
|
|
16358
|
-
let M = React.useMemo(() => n.canvasHeight ? n.canvasHeight : n.elements.length === 0 ? 0 : Math.max(...n.elements.map((n) => n.y + n.height)), [n.elements, n.canvasHeight]);
|
|
16359
|
-
return /* @__PURE__ */ jsxs(p, {
|
|
17276
|
+
]), /* @__PURE__ */ jsxs(p, {
|
|
16360
17277
|
style: {
|
|
16361
17278
|
width: "100%",
|
|
16362
17279
|
height: "100%",
|
|
@@ -16367,7 +17284,7 @@ const Preview = () => {
|
|
|
16367
17284
|
children: [n.isList && /* @__PURE__ */ jsx(p, {
|
|
16368
17285
|
style: {
|
|
16369
17286
|
position: "absolute",
|
|
16370
|
-
|
|
17287
|
+
bottom: 10,
|
|
16371
17288
|
right: 10,
|
|
16372
17289
|
zIndex: 100,
|
|
16373
17290
|
backgroundColor: "var(--color-surface)",
|
|
@@ -16430,13 +17347,9 @@ const Preview = () => {
|
|
|
16430
17347
|
mode: "popLayout",
|
|
16431
17348
|
initial: !1,
|
|
16432
17349
|
children: _.map((_, E) => /* @__PURE__ */ jsx(ListItem, {
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
element: n,
|
|
16437
|
-
offsetY: 0,
|
|
16438
|
-
dataContext: _
|
|
16439
|
-
}, `${n.id}-${E}`))
|
|
17350
|
+
item: _,
|
|
17351
|
+
elements: n.elements,
|
|
17352
|
+
animation: n.listSettings.entryAnimation
|
|
16440
17353
|
}, _.id || E))
|
|
16441
17354
|
})
|
|
16442
17355
|
});
|
|
@@ -16451,7 +17364,32 @@ const Preview = () => {
|
|
|
16451
17364
|
});
|
|
16452
17365
|
};
|
|
16453
17366
|
var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
|
|
16454
|
-
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo:
|
|
17367
|
+
let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Bj, redo: Vj, copy: Hj, paste: Uj, removeSelected: Gj, updateElements: Kj, selectElement: qj } = useEditor(), Jj = React.useRef(null), Zj = () => {
|
|
17368
|
+
let n = {
|
|
17369
|
+
elements: Z.elements,
|
|
17370
|
+
isList: Z.isList,
|
|
17371
|
+
mockData: Z.mockData,
|
|
17372
|
+
singleMockData: Z.singleMockData,
|
|
17373
|
+
listSettings: Z.listSettings,
|
|
17374
|
+
canvasHeight: Z.canvasHeight,
|
|
17375
|
+
gridSize: Z.gridSize
|
|
17376
|
+
}, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
|
|
17377
|
+
A.href = O, A.download = `layout-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, document.body.appendChild(A), A.click(), document.body.removeChild(A), URL.revokeObjectURL(O);
|
|
17378
|
+
}, Qj = () => {
|
|
17379
|
+
Jj.current?.click();
|
|
17380
|
+
}, $j = (n) => {
|
|
17381
|
+
let _ = n.target.files?.[0];
|
|
17382
|
+
if (!_) return;
|
|
17383
|
+
let E = new FileReader();
|
|
17384
|
+
E.onload = (n) => {
|
|
17385
|
+
try {
|
|
17386
|
+
let _ = n.target?.result;
|
|
17387
|
+
G(JSON.parse(_));
|
|
17388
|
+
} catch (n) {
|
|
17389
|
+
console.error("Failed to import layout", n), alert("Erro ao importar layout. Arquivo inválido.");
|
|
17390
|
+
}
|
|
17391
|
+
}, E.readAsText(_), n.target.value = "";
|
|
17392
|
+
};
|
|
16455
17393
|
React.useEffect(() => {
|
|
16456
17394
|
let n = (n) => {
|
|
16457
17395
|
if (document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable) return;
|
|
@@ -16479,11 +17417,11 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16479
17417
|
}, [W]), React.useEffect(() => {
|
|
16480
17418
|
let n = (n) => {
|
|
16481
17419
|
if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
|
|
16482
|
-
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(),
|
|
16483
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(),
|
|
16484
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(),
|
|
16485
|
-
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(),
|
|
16486
|
-
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(),
|
|
17420
|
+
if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), Vj()) : (n.preventDefault(), Bj());
|
|
17421
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), Vj();
|
|
17422
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), Hj();
|
|
17423
|
+
else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Uj();
|
|
17424
|
+
else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), Gj());
|
|
16487
17425
|
else if ([
|
|
16488
17426
|
"ArrowUp",
|
|
16489
17427
|
"ArrowDown",
|
|
@@ -16501,20 +17439,20 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16501
17439
|
changes: j
|
|
16502
17440
|
});
|
|
16503
17441
|
}
|
|
16504
|
-
}), E.length > 0 &&
|
|
17442
|
+
}), E.length > 0 && Kj(E);
|
|
16505
17443
|
}
|
|
16506
17444
|
}
|
|
16507
17445
|
};
|
|
16508
17446
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
16509
17447
|
}, [
|
|
16510
|
-
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
17448
|
+
Bj,
|
|
17449
|
+
Vj,
|
|
17450
|
+
Hj,
|
|
17451
|
+
Uj,
|
|
17452
|
+
Gj,
|
|
16515
17453
|
Z.selectedElementIds,
|
|
16516
17454
|
Z.elements,
|
|
16517
|
-
|
|
17455
|
+
Kj
|
|
16518
17456
|
]), React.useEffect(() => {
|
|
16519
17457
|
if (E) try {
|
|
16520
17458
|
let n = typeof E == "string" ? JSON.parse(E) : E;
|
|
@@ -16523,7 +17461,7 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16523
17461
|
console.error("Failed to load initial state", n);
|
|
16524
17462
|
}
|
|
16525
17463
|
}, [E, G]);
|
|
16526
|
-
let
|
|
17464
|
+
let eM = (n) => {
|
|
16527
17465
|
console.log(`Adding element of type: ${n}`), W({
|
|
16528
17466
|
type: n,
|
|
16529
17467
|
content: `New ${n}`
|
|
@@ -16584,15 +17522,15 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16584
17522
|
style: { width: "240px" },
|
|
16585
17523
|
children: [
|
|
16586
17524
|
/* @__PURE__ */ jsx(v$3, {
|
|
16587
|
-
onSelect: () =>
|
|
17525
|
+
onSelect: () => eM("text"),
|
|
16588
17526
|
children: "Texto"
|
|
16589
17527
|
}),
|
|
16590
17528
|
/* @__PURE__ */ jsx(v$3, {
|
|
16591
|
-
onSelect: () =>
|
|
17529
|
+
onSelect: () => eM("image"),
|
|
16592
17530
|
children: "Imagem"
|
|
16593
17531
|
}),
|
|
16594
17532
|
/* @__PURE__ */ jsx(v$3, {
|
|
16595
|
-
onSelect: () =>
|
|
17533
|
+
onSelect: () => eM("box"),
|
|
16596
17534
|
children: "Caixa (Container)"
|
|
16597
17535
|
})
|
|
16598
17536
|
]
|
|
@@ -16620,6 +17558,38 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16620
17558
|
},
|
|
16621
17559
|
children: [/* @__PURE__ */ jsx(Share1Icon, {}), " Salvar Alterações"]
|
|
16622
17560
|
}),
|
|
17561
|
+
/* @__PURE__ */ jsxs(p$1, {
|
|
17562
|
+
gap: "2",
|
|
17563
|
+
mt: "2",
|
|
17564
|
+
children: [/* @__PURE__ */ jsxs(o, {
|
|
17565
|
+
variant: "soft",
|
|
17566
|
+
color: "gray",
|
|
17567
|
+
style: {
|
|
17568
|
+
flex: 1,
|
|
17569
|
+
cursor: "pointer",
|
|
17570
|
+
justifyContent: "center"
|
|
17571
|
+
},
|
|
17572
|
+
onClick: Zj,
|
|
17573
|
+
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
|
|
17574
|
+
}), /* @__PURE__ */ jsxs(o, {
|
|
17575
|
+
variant: "soft",
|
|
17576
|
+
color: "gray",
|
|
17577
|
+
style: {
|
|
17578
|
+
flex: 1,
|
|
17579
|
+
cursor: "pointer",
|
|
17580
|
+
justifyContent: "center"
|
|
17581
|
+
},
|
|
17582
|
+
onClick: Qj,
|
|
17583
|
+
children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
|
|
17584
|
+
})]
|
|
17585
|
+
}),
|
|
17586
|
+
/* @__PURE__ */ jsx("input", {
|
|
17587
|
+
type: "file",
|
|
17588
|
+
ref: Jj,
|
|
17589
|
+
style: { display: "none" },
|
|
17590
|
+
accept: ".json",
|
|
17591
|
+
onChange: $j
|
|
17592
|
+
}),
|
|
16623
17593
|
/* @__PURE__ */ jsx(p, {
|
|
16624
17594
|
mt: "2",
|
|
16625
17595
|
children: /* @__PURE__ */ jsx(EditorSettings, {})
|
|
@@ -16654,7 +17624,7 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16654
17624
|
overflow: "hidden"
|
|
16655
17625
|
},
|
|
16656
17626
|
onClick: (_) => {
|
|
16657
|
-
|
|
17627
|
+
qj(n.id, _.shiftKey), B(n.id), U(!0);
|
|
16658
17628
|
},
|
|
16659
17629
|
children: /* @__PURE__ */ jsxs(p$1, {
|
|
16660
17630
|
gap: "2",
|
|
@@ -16790,13 +17760,23 @@ var EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light"
|
|
|
16790
17760
|
/* @__PURE__ */ jsx(kt, {
|
|
16791
17761
|
defaultSize: 50,
|
|
16792
17762
|
minSize: 20,
|
|
16793
|
-
children: /* @__PURE__ */
|
|
17763
|
+
children: /* @__PURE__ */ jsxs(p, {
|
|
16794
17764
|
style: {
|
|
16795
17765
|
height: "100%",
|
|
16796
17766
|
width: "100%",
|
|
16797
|
-
backgroundColor: "var(--color-background)"
|
|
17767
|
+
backgroundColor: "var(--color-background)",
|
|
17768
|
+
position: "relative"
|
|
16798
17769
|
},
|
|
16799
|
-
children: /* @__PURE__ */ jsx(
|
|
17770
|
+
children: [/* @__PURE__ */ jsx(p, {
|
|
17771
|
+
style: {
|
|
17772
|
+
position: "absolute",
|
|
17773
|
+
top: 16,
|
|
17774
|
+
left: "50%",
|
|
17775
|
+
transform: "translateX(-50%)",
|
|
17776
|
+
zIndex: 20
|
|
17777
|
+
},
|
|
17778
|
+
children: /* @__PURE__ */ jsx(AlignmentToolbar, {})
|
|
17779
|
+
}), /* @__PURE__ */ jsx(Canvas, {})]
|
|
16800
17780
|
})
|
|
16801
17781
|
}),
|
|
16802
17782
|
j && /* @__PURE__ */ jsx(Ot, { style: {
|
|
@@ -16834,5 +17814,5 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
|
16834
17814
|
availableProps: n.layout.props,
|
|
16835
17815
|
theme: n.theme,
|
|
16836
17816
|
children: /* @__PURE__ */ jsx(EditorContent, { ...n })
|
|
16837
|
-
}), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = ['width', 'height', 'top', 'left', 'right', 'bottom', 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth'];\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 { from { opacity: 0; } to { opacity: 1; } }\n @keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } }\n @keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }\n @keyframes slideInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }\n @keyframes slideInDown { from { opacity: 0; transform: translateY(-50px); } to { opacity: 1; transform: translateY(0); } }\n @keyframes zoomIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }\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 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: element.autoGrow ? 'pre-wrap' : undefined,\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate item height\n const itemHeight = canvasHeight || Math.max(...elements.map(el => el.y + el.height));\n\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const itemHeight = ${itemHeight};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
|
|
17817
|
+
}), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = [\n 'width', 'height', 'top', 'left', 'right', 'bottom', \n 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth',\n 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'\n ];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n let cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n if (typeof cssValue === 'string') {\n if (/^#([0-9a-fA-F]{8})$/.test(cssValue)) {\n cssValue = hex8ToRgba(cssValue);\n }\n }\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const getAnimationStyles = (anim) => {\n if (!anim || anim.type === 'none') return {};\n return {\n animationName: anim.type,\n animationDuration: (anim.duration || 1) + 's',\n animationDelay: (anim.delay || 0) + 's',\n animationIterationCount: anim.iterationCount || 1,\n animationTimingFunction: anim.timingFunction || 'ease',\n animationFillMode: 'both'\n };\n };\n\n const keyframesCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeIn { \n from { opacity: 0; } \n to { opacity: 1; } \n }\n @keyframes slideInLeft { \n from { opacity: 0; transform: translateX(-50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInRight { \n from { opacity: 0; transform: translateX(50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInUp { \n from { opacity: 0; transform: translateY(50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes slideInDown { \n from { opacity: 0; transform: translateY(-50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes zoomIn { \n from { opacity: 0; transform: scale(0.5); } \n to { opacity: 1; transform: scale(1); } \n }\n @keyframes bounceIn {\n 0% { opacity: 0; transform: scale(0.3); }\n 50% { opacity: 1; transform: scale(1.05); }\n 70% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n @keyframes pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }\n 20%, 40%, 60%, 80% { transform: translateX(5px); }\n }\n @keyframes spin { \n from { transform: rotate(0deg); } \n to { transform: rotate(360deg); } \n }\n \n /* Improved / Smoother Animations */\n @keyframes smoothSlideUp {\n 0% { opacity: 0; transform: translateY(30px); }\n 100% { opacity: 1; transform: translateY(0); }\n }\n @keyframes popIn {\n 0% { opacity: 0; transform: scale(0.8) translateY(10px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes blurIn {\n 0% { opacity: 0; filter: blur(10px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: element.autoGrow ? 'pre-wrap' : undefined,\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate item height\n const itemHeight = canvasHeight || Math.max(...elements.map(el => el.y + el.height));\n\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const itemHeight = ${itemHeight};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 0\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
|
|
16838
17818
|
export { GenericEditor as EditorContent, generateHTML };
|