@brunoalz/smartgesti-site-editor 1.10.0 → 1.10.1
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/engine/preview/Preview.d.ts.map +1 -1
- package/dist/engine/preview/Preview.js +124 -116
- package/dist/engine/preview/Preview.js.map +1 -1
- package/dist/engine/registry/blocks/sections/imageGallery.d.ts.map +1 -1
- package/dist/engine/registry/blocks/sections/imageGallery.js +12 -14
- package/dist/engine/registry/blocks/sections/imageGallery.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/engine/preview/Preview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,YAAY,EAAS,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2DAA2D;IAC3D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAwDD;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,YAAY,EACZ,eAAe,EACf,oBAA4B,EAC5B,YAAmB,GACpB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../../src/engine/preview/Preview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,YAAY,EAAS,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2DAA2D;IAC3D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAwDD;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,YAAY,EACZ,eAAe,EACf,oBAA4B,EAC5B,YAAmB,GACpB,EAAE,YAAY,2CAimBd"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { componentRegistry as
|
|
4
|
-
import { exportPageToHtml as
|
|
5
|
-
import { detectChangedBlocks as
|
|
6
|
-
import { hashDocument as
|
|
7
|
-
import { logger as
|
|
8
|
-
function
|
|
9
|
-
const u = (
|
|
10
|
-
for (const d of
|
|
11
|
-
if (d.id ===
|
|
1
|
+
import { jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as k, useState as X, useEffect as S, useMemo as Y } from "react";
|
|
3
|
+
import { componentRegistry as K } from "../registry/registry.js";
|
|
4
|
+
import { exportPageToHtml as Q, exportBlockToHtml as U } from "../export/exportHtml.js";
|
|
5
|
+
import { detectChangedBlocks as V } from "../../utils/changeDetector.js";
|
|
6
|
+
import { hashDocument as H } from "../../utils/documentHash.js";
|
|
7
|
+
import { logger as J } from "../../utils/logger.js";
|
|
8
|
+
function Z(o, x) {
|
|
9
|
+
const u = (T) => {
|
|
10
|
+
for (const d of T) {
|
|
11
|
+
if (d.id === x) return d;
|
|
12
12
|
const n = d.props;
|
|
13
13
|
if (n?.children && Array.isArray(n.children)) {
|
|
14
14
|
const r = u(n.children);
|
|
@@ -33,58 +33,58 @@ function U(o, v) {
|
|
|
33
33
|
};
|
|
34
34
|
return u(o.structure);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
for (const d of
|
|
39
|
-
const n =
|
|
40
|
-
|
|
36
|
+
function ee(o) {
|
|
37
|
+
const x = {}, u = (T) => {
|
|
38
|
+
for (const d of T) {
|
|
39
|
+
const n = K.get(d.type);
|
|
40
|
+
x[d.id] = n?.name || d.type;
|
|
41
41
|
const r = d.props;
|
|
42
42
|
r?.children && Array.isArray(r.children) && u(r.children), d.type === "card" && (Array.isArray(r?.header) && u(r.header), Array.isArray(r?.content) && u(r.content), Array.isArray(r?.footer) && u(r.footer));
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
return o?.structure && u(o.structure),
|
|
45
|
+
return o?.structure && u(o.structure), x;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function se({
|
|
48
48
|
document: o,
|
|
49
|
-
pageId:
|
|
49
|
+
pageId: x,
|
|
50
50
|
className: u,
|
|
51
|
-
style:
|
|
51
|
+
style: T,
|
|
52
52
|
onBlockClick: d,
|
|
53
53
|
selectedBlockId: n,
|
|
54
54
|
showSelectionOverlay: r = !1,
|
|
55
|
-
focusedGroup:
|
|
55
|
+
focusedGroup: B = null
|
|
56
56
|
}) {
|
|
57
|
-
const s =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, [n]),
|
|
57
|
+
const s = k(null), A = k(null), _ = k(null), q = k(null), L = k(!1), [G, C] = X(!0), D = k(n), R = k(r), M = k(B);
|
|
58
|
+
S(() => {
|
|
59
|
+
D.current = n;
|
|
60
|
+
}, [n]), S(() => {
|
|
61
61
|
R.current = r;
|
|
62
|
-
}, [r]),
|
|
63
|
-
M.current =
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
62
|
+
}, [r]), S(() => {
|
|
63
|
+
M.current = B;
|
|
64
|
+
}, [B]);
|
|
65
|
+
const p = Y(() => x ? o.pages.find((t) => t.id === x) : o.pages[0], [o, x]), $ = k({});
|
|
66
|
+
S(() => {
|
|
67
|
+
$.current = ee(p);
|
|
68
|
+
}, [p]);
|
|
69
|
+
const I = (t) => {
|
|
70
70
|
if (!s.current) return;
|
|
71
71
|
const e = s.current.contentDocument || s.current.contentWindow?.document;
|
|
72
72
|
if (!e) return;
|
|
73
73
|
const i = R.current, l = M.current;
|
|
74
74
|
requestAnimationFrame(() => {
|
|
75
75
|
const c = e.getElementById("block-highlight");
|
|
76
|
-
c && c.remove(), e.querySelectorAll("[data-block-id]").forEach((
|
|
77
|
-
const
|
|
78
|
-
|
|
76
|
+
c && c.remove(), e.querySelectorAll("[data-block-id]").forEach((h) => {
|
|
77
|
+
const m = h;
|
|
78
|
+
m.style.outline = "", m.style.outlineOffset = "";
|
|
79
79
|
});
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const E = e.getElementById("sg-block-label");
|
|
81
|
+
E && E.remove();
|
|
82
82
|
const N = e.getElementById("sg-group-highlight");
|
|
83
83
|
N && N.remove();
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
84
|
+
const w = e.getElementById("sg-group-label");
|
|
85
|
+
if (w && w.remove(), t) {
|
|
86
|
+
const h = e.createElement("style");
|
|
87
|
+
if (h.id = "block-highlight", h.textContent = `
|
|
88
88
|
[data-block-id="${t}"] {
|
|
89
89
|
outline: 2px solid #3b82f6 !important;
|
|
90
90
|
outline-offset: 2px !important;
|
|
@@ -101,34 +101,34 @@ function ae({
|
|
|
101
101
|
pointer-events: none;
|
|
102
102
|
z-index: -1;
|
|
103
103
|
}
|
|
104
|
-
`, e.head.appendChild(
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
|
|
104
|
+
`, e.head.appendChild(h), i) {
|
|
105
|
+
const m = e.querySelector(`[data-block-id="${t}"]`);
|
|
106
|
+
if (m) {
|
|
107
|
+
const y = $.current[t] || t, v = e.createElement("div");
|
|
108
|
+
v.id = "sg-block-label", v.textContent = y, v.style.cssText = "position:absolute;top:-22px;left:0;background:#3b82f6;color:#fff;font-size:11px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10000;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:16px;", getComputedStyle(m).position === "static" && (m.style.position = "relative"), m.appendChild(v);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
if (l) {
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
|
|
112
|
+
const y = e.querySelector(`[data-block-id="${t}"]`)?.querySelector(`[data-block-group="${l}"]`);
|
|
113
|
+
if (y) {
|
|
114
|
+
const v = e.createElement("style");
|
|
115
|
+
v.id = "sg-group-highlight", v.textContent = `
|
|
116
116
|
[data-block-id="${t}"] [data-block-group="${l}"] {
|
|
117
117
|
outline: 2px solid #8b5cf6 !important;
|
|
118
118
|
outline-offset: 2px !important;
|
|
119
119
|
position: relative;
|
|
120
120
|
}
|
|
121
|
-
`, e.head.appendChild(
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
`, e.head.appendChild(v);
|
|
122
|
+
const b = e.createElement("div");
|
|
123
|
+
b.id = "sg-group-label", b.textContent = l, b.style.cssText = "position:absolute;top:-20px;right:0;background:#8b5cf6;color:#fff;font-size:10px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10001;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:14px;", getComputedStyle(y).position === "static" && (y.style.position = "relative"), y.appendChild(b);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
},
|
|
128
|
+
}, W = () => {
|
|
129
129
|
s.current?.contentWindow && s.current.contentWindow.postMessage({
|
|
130
130
|
type: "sg-set-block-names",
|
|
131
|
-
names:
|
|
131
|
+
names: $.current
|
|
132
132
|
}, "*");
|
|
133
133
|
}, O = (t) => {
|
|
134
134
|
if (!s.current) return;
|
|
@@ -159,14 +159,14 @@ function ae({
|
|
|
159
159
|
outline-offset: 1px !important;
|
|
160
160
|
background: rgba(139, 92, 246, 0.04);
|
|
161
161
|
}
|
|
162
|
-
`, e.head.appendChild(l),
|
|
162
|
+
`, e.head.appendChild(l), W();
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
if (!(!s.current || !
|
|
164
|
+
I(D.current || null);
|
|
165
|
+
}, g = (t, e) => {
|
|
166
|
+
if (!(!s.current || !p))
|
|
167
167
|
try {
|
|
168
|
-
e &&
|
|
169
|
-
let i =
|
|
168
|
+
e && C(!0);
|
|
169
|
+
let i = Q(p, t, !0);
|
|
170
170
|
const l = `
|
|
171
171
|
<script>
|
|
172
172
|
(function() {
|
|
@@ -273,109 +273,117 @@ function ae({
|
|
|
273
273
|
`;
|
|
274
274
|
i = i.replace("</body>", `${l}</body>`), i.includes("</body>") || (i = i + l);
|
|
275
275
|
const c = s.current, a = () => {
|
|
276
|
-
|
|
276
|
+
I(D.current || null), R.current && O(!0);
|
|
277
277
|
};
|
|
278
278
|
e ? (c.onload = () => {
|
|
279
|
-
|
|
279
|
+
C(!1), A.current = JSON.parse(JSON.stringify(t)), _.current = H(t), a();
|
|
280
280
|
}, setTimeout(() => {
|
|
281
|
-
|
|
282
|
-
}, 1e3)) : (
|
|
281
|
+
C(!1), A.current = JSON.parse(JSON.stringify(t)), _.current = H(t), a();
|
|
282
|
+
}, 1e3)) : (A.current = JSON.parse(JSON.stringify(t)), _.current = H(t), c.onload = () => {
|
|
283
283
|
a();
|
|
284
284
|
}), c.srcdoc = i;
|
|
285
285
|
} catch (i) {
|
|
286
|
-
|
|
286
|
+
J.error("[Preview] Error:", i), e && C(!1);
|
|
287
287
|
}
|
|
288
|
-
},
|
|
289
|
-
if (!(!s.current || !
|
|
288
|
+
}, j = (t, e) => {
|
|
289
|
+
if (!(!s.current || !p))
|
|
290
290
|
try {
|
|
291
|
-
const i =
|
|
291
|
+
const i = Z(p, t);
|
|
292
292
|
if (!i) {
|
|
293
|
-
|
|
293
|
+
g(e, !1);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
const l =
|
|
296
|
+
const l = U(i, void 0, e.theme);
|
|
297
297
|
requestAnimationFrame(() => {
|
|
298
298
|
const c = s.current;
|
|
299
299
|
if (!c) return;
|
|
300
300
|
const a = c.contentDocument || c.contentWindow?.document;
|
|
301
301
|
if (!a) return;
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
302
|
+
const E = a.querySelector(`[data-block-id="${t}"]`);
|
|
303
|
+
if (E)
|
|
304
304
|
try {
|
|
305
|
-
a.querySelectorAll(`style[data-block-style="${t}"]`).forEach((
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
305
|
+
a.querySelectorAll(`style[data-block-style="${t}"]`).forEach((f) => f.remove()), a.querySelectorAll(`script[data-block-style="${t}"]`).forEach((f) => f.remove());
|
|
306
|
+
const h = a.createElement("div");
|
|
307
|
+
h.innerHTML = l, h.querySelectorAll("style").forEach((f) => {
|
|
308
|
+
f.setAttribute("data-block-style", t);
|
|
309
|
+
});
|
|
310
|
+
const y = [];
|
|
311
|
+
h.querySelectorAll("script").forEach((f) => {
|
|
312
|
+
y.push({ text: f.textContent || "" }), f.remove();
|
|
309
313
|
});
|
|
310
|
-
const
|
|
311
|
-
for (;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
const b = a.createDocumentFragment();
|
|
315
|
+
for (; h.firstChild; )
|
|
316
|
+
b.appendChild(h.firstChild);
|
|
317
|
+
b.childNodes.length > 0 ? E.parentNode?.replaceChild(b, E) : E.outerHTML = l, y.forEach(({ text: f }) => {
|
|
318
|
+
if (!f.trim()) return;
|
|
319
|
+
const z = a.createElement("script");
|
|
320
|
+
z.setAttribute("data-block-style", t), z.textContent = f, a.body.appendChild(z);
|
|
321
|
+
}), A.current = JSON.parse(JSON.stringify(e)), _.current = H(e), I(D.current || null);
|
|
314
322
|
} catch (N) {
|
|
315
|
-
|
|
323
|
+
J.error("[Preview] Erro ao atualizar:", N), g(e, !1);
|
|
316
324
|
}
|
|
317
325
|
else
|
|
318
|
-
|
|
326
|
+
g(e, !1);
|
|
319
327
|
});
|
|
320
328
|
} catch (i) {
|
|
321
|
-
|
|
329
|
+
J.error("[Preview] Erro:", i), g(e, !1);
|
|
322
330
|
}
|
|
323
331
|
};
|
|
324
|
-
return
|
|
325
|
-
if (!
|
|
326
|
-
|
|
332
|
+
return S(() => {
|
|
333
|
+
if (!p) {
|
|
334
|
+
C(!1);
|
|
327
335
|
return;
|
|
328
336
|
}
|
|
329
|
-
const t =
|
|
330
|
-
if (!
|
|
331
|
-
s.current && (
|
|
337
|
+
const t = H(o);
|
|
338
|
+
if (!L.current) {
|
|
339
|
+
s.current && (L.current = !0, q.current = p?.id ?? null, g(o, !0));
|
|
332
340
|
return;
|
|
333
341
|
}
|
|
334
342
|
if (!s.current) return;
|
|
335
|
-
const e =
|
|
336
|
-
if (
|
|
337
|
-
|
|
343
|
+
const e = p?.id ?? null;
|
|
344
|
+
if (q.current !== e) {
|
|
345
|
+
q.current = e, g(o, !1);
|
|
338
346
|
return;
|
|
339
347
|
}
|
|
340
348
|
if (_.current === t)
|
|
341
349
|
return;
|
|
342
|
-
const i =
|
|
350
|
+
const i = A.current ? JSON.stringify(A.current.theme) : null, l = JSON.stringify(o.theme);
|
|
343
351
|
if (i !== l) {
|
|
344
|
-
|
|
352
|
+
g(o, !1);
|
|
345
353
|
return;
|
|
346
354
|
}
|
|
347
|
-
const c =
|
|
348
|
-
|
|
355
|
+
const c = V(
|
|
356
|
+
A.current || o,
|
|
349
357
|
o,
|
|
350
|
-
|
|
358
|
+
p?.id
|
|
351
359
|
);
|
|
352
360
|
if (c.length === 0) {
|
|
353
|
-
|
|
361
|
+
J.debug(
|
|
354
362
|
"[Preview] Hash changed but no changes detected, forcing reload"
|
|
355
|
-
),
|
|
363
|
+
), g(o, !1);
|
|
356
364
|
return;
|
|
357
365
|
}
|
|
358
366
|
if (c.some(
|
|
359
367
|
(a) => a.blockId === "__structural__" || a.changedProps?.includes("children")
|
|
360
368
|
)) {
|
|
361
|
-
|
|
369
|
+
g(o, !1);
|
|
362
370
|
return;
|
|
363
371
|
}
|
|
364
372
|
if (c.length === 1) {
|
|
365
373
|
const a = c[0];
|
|
366
374
|
if (!(a.changedProps || []).some(
|
|
367
|
-
(
|
|
375
|
+
(w) => w === "children" || w === "header" || w === "content" || w === "footer"
|
|
368
376
|
)) {
|
|
369
|
-
|
|
377
|
+
j(a.blockId, o);
|
|
370
378
|
return;
|
|
371
379
|
}
|
|
372
380
|
}
|
|
373
|
-
|
|
374
|
-
}, [o,
|
|
375
|
-
|
|
376
|
-
}, [n,
|
|
377
|
-
|
|
378
|
-
}, [r]),
|
|
381
|
+
g(o, !1);
|
|
382
|
+
}, [o, p]), S(() => {
|
|
383
|
+
L.current && I(n || null);
|
|
384
|
+
}, [n, B]), S(() => {
|
|
385
|
+
L.current && O(r);
|
|
386
|
+
}, [r]), S(() => {
|
|
379
387
|
if (!d) return;
|
|
380
388
|
const t = (e) => {
|
|
381
389
|
e.data?.type === "block-click" && e.data?.blockId && d(e.data.blockId, e.data.group || void 0);
|
|
@@ -383,8 +391,8 @@ function ae({
|
|
|
383
391
|
return window.addEventListener("message", t), () => {
|
|
384
392
|
window.removeEventListener("message", t);
|
|
385
393
|
};
|
|
386
|
-
}, [d]),
|
|
387
|
-
|
|
394
|
+
}, [d]), p ? /* @__PURE__ */ F("div", { className: u, style: { position: "relative", ...T }, children: [
|
|
395
|
+
G && /* @__PURE__ */ P(
|
|
388
396
|
"div",
|
|
389
397
|
{
|
|
390
398
|
style: {
|
|
@@ -399,10 +407,10 @@ function ae({
|
|
|
399
407
|
backgroundColor: "rgba(255, 255, 255, 0.8)",
|
|
400
408
|
zIndex: 10
|
|
401
409
|
},
|
|
402
|
-
children: /* @__PURE__ */
|
|
410
|
+
children: /* @__PURE__ */ P("div", { style: { color: "#6b7280" }, children: "Carregando preview..." })
|
|
403
411
|
}
|
|
404
412
|
),
|
|
405
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ P(
|
|
406
414
|
"iframe",
|
|
407
415
|
{
|
|
408
416
|
ref: s,
|
|
@@ -415,9 +423,9 @@ function ae({
|
|
|
415
423
|
title: "Preview do site"
|
|
416
424
|
}
|
|
417
425
|
)
|
|
418
|
-
] }) : /* @__PURE__ */
|
|
426
|
+
] }) : /* @__PURE__ */ P("div", { className: u, style: T, children: /* @__PURE__ */ P("div", { style: { padding: "2rem", textAlign: "center", color: "#6b7280" }, children: "Página não encontrada" }) });
|
|
419
427
|
}
|
|
420
428
|
export {
|
|
421
|
-
|
|
429
|
+
se as Preview
|
|
422
430
|
};
|
|
423
431
|
//# sourceMappingURL=Preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.js","sources":["../../../src/engine/preview/Preview.tsx"],"sourcesContent":["/**\n * Preview\n * Sem dependências circulares, sem reloads desnecessários\n */\n\nimport React, { useEffect, useRef, useState, useMemo } from \"react\";\nimport { SiteDocument, Block } from \"../schema/siteDocument\";\nimport { componentRegistry } from \"../registry/registry\";\nimport { exportPageToHtml, exportBlockToHtml } from \"../export/exportHtml\";\nimport { detectChangedBlocks } from \"../../utils/changeDetector\";\nimport { hashDocument } from \"../../utils/documentHash\";\nimport { logger } from \"../../utils/logger\";\n\nexport interface PreviewProps {\n document: SiteDocument;\n pageId?: string;\n className?: string;\n style?: React.CSSProperties;\n onBlockClick?: (blockId: string, group?: string) => void;\n selectedBlockId?: string | null;\n /** Exibe hover e label de seleção nos blocos do preview */\n showSelectionOverlay?: boolean;\n /** Grupo focado para indicador visual no preview */\n focusedGroup?: string | null;\n}\n\n/**\n * Encontra um bloco na estrutura recursivamente\n */\nfunction findBlockInPage(page: any, blockId: string): Block | null {\n const findInBlocks = (blocks: Block[]): Block | null => {\n for (const block of blocks) {\n if (block.id === blockId) return block;\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) {\n const found = findInBlocks(props.children);\n if (found) return found;\n }\n if (block.type === \"card\") {\n if (props.header && Array.isArray(props.header)) {\n const found = findInBlocks(props.header);\n if (found) return found;\n }\n if (props.content && Array.isArray(props.content)) {\n const found = findInBlocks(props.content);\n if (found) return found;\n }\n if (props.footer && Array.isArray(props.footer)) {\n const found = findInBlocks(props.footer);\n if (found) return found;\n }\n }\n }\n return null;\n };\n return findInBlocks(page.structure);\n}\n\n/**\n * Monta mapa blockId → nome legível (da registry)\n */\nfunction buildBlockNameMap(page: any): Record<string, string> {\n const map: Record<string, string> = {};\n const walk = (blocks: Block[]) => {\n for (const block of blocks) {\n const def = componentRegistry.get(block.type);\n map[block.id] = def?.name || block.type;\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) walk(props.children);\n if (block.type === \"card\") {\n if (Array.isArray(props?.header)) walk(props.header);\n if (Array.isArray(props?.content)) walk(props.content);\n if (Array.isArray(props?.footer)) walk(props.footer);\n }\n }\n };\n if (page?.structure) walk(page.structure);\n return map;\n}\n\n/**\n * Componente de preview usando iframe isolado\n */\nexport function Preview({\n document,\n pageId,\n className,\n style,\n onBlockClick,\n selectedBlockId,\n showSelectionOverlay = false,\n focusedGroup = null,\n}: PreviewProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const previousDocRef = useRef<SiteDocument | null>(null);\n const previousDocHashRef = useRef<string | null>(null);\n const previousPageIdRef = useRef<string | null>(null);\n const isInitializedRef = useRef<boolean>(false);\n const [isLoading, setIsLoading] = useState(true);\n\n // Usar ref para selectedBlockId (necessário para highlight assíncrono)\n const selectedBlockIdRef = useRef(selectedBlockId);\n const showSelectionOverlayRef = useRef(showSelectionOverlay);\n const focusedGroupRef = useRef(focusedGroup);\n\n // Atualizar refs quando props mudam\n useEffect(() => {\n selectedBlockIdRef.current = selectedBlockId;\n }, [selectedBlockId]);\n\n useEffect(() => {\n showSelectionOverlayRef.current = showSelectionOverlay;\n }, [showSelectionOverlay]);\n\n useEffect(() => {\n focusedGroupRef.current = focusedGroup;\n }, [focusedGroup]);\n\n const page = useMemo(() => {\n return pageId\n ? document.pages.find((p) => p.id === pageId)\n : document.pages[0];\n }, [document, pageId]);\n\n // Mapa blockId → nome legível para labels\n const blockNameMapRef = useRef<Record<string, string>>({});\n useEffect(() => {\n blockNameMapRef.current = buildBlockNameMap(page);\n }, [page]);\n\n // Atualizar highlight + selection overlay diretamente no iframe (sem reload)\n const updateHighlight = (blockId: string | null) => {\n if (!iframeRef.current) return;\n\n const iframeDoc =\n iframeRef.current.contentDocument ||\n iframeRef.current.contentWindow?.document;\n if (!iframeDoc) return;\n\n const overlayEnabled = showSelectionOverlayRef.current;\n const group = focusedGroupRef.current;\n\n requestAnimationFrame(() => {\n // Remover highlight anterior\n const oldStyle = iframeDoc.getElementById(\"block-highlight\");\n if (oldStyle) oldStyle.remove();\n\n const allBlocks = iframeDoc.querySelectorAll(\"[data-block-id]\");\n allBlocks.forEach((el) => {\n const htmlEl = el as HTMLElement;\n htmlEl.style.outline = \"\";\n htmlEl.style.outlineOffset = \"\";\n });\n\n // Remover labels anteriores\n const oldLabel = iframeDoc.getElementById(\"sg-block-label\");\n if (oldLabel) oldLabel.remove();\n const oldGroupStyle = iframeDoc.getElementById(\"sg-group-highlight\");\n if (oldGroupStyle) oldGroupStyle.remove();\n const oldGroupLabel = iframeDoc.getElementById(\"sg-group-label\");\n if (oldGroupLabel) oldGroupLabel.remove();\n\n // Adicionar novo highlight\n if (blockId) {\n const highlightStyle = iframeDoc.createElement(\"style\");\n highlightStyle.id = \"block-highlight\";\n highlightStyle.textContent = `\n [data-block-id=\"${blockId}\"] {\n outline: 2px solid #3b82f6 !important;\n outline-offset: 2px !important;\n position: relative;\n }\n [data-block-id=\"${blockId}\"]::before {\n content: '';\n position: absolute;\n top: -4px;\n left: -4px;\n right: -4px;\n bottom: -4px;\n background: rgba(59, 130, 246, 0.1);\n pointer-events: none;\n z-index: -1;\n }\n `;\n iframeDoc.head.appendChild(highlightStyle);\n\n // Selection label (only when overlay is enabled)\n if (overlayEnabled) {\n const selectedEl = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`) as HTMLElement;\n if (selectedEl) {\n const blockName = blockNameMapRef.current[blockId] || blockId;\n const label = iframeDoc.createElement(\"div\");\n label.id = \"sg-block-label\";\n label.textContent = blockName;\n label.style.cssText = \"position:absolute;top:-22px;left:0;background:#3b82f6;color:#fff;font-size:11px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10000;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:16px;\";\n const pos = getComputedStyle(selectedEl).position;\n if (pos === \"static\") selectedEl.style.position = \"relative\";\n selectedEl.appendChild(label);\n }\n }\n\n // Indicador de grupo — mostra qual sub-seção foi clicada (purple)\n if (group) {\n const blockEl = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`);\n const groupEl = blockEl?.querySelector(`[data-block-group=\"${group}\"]`) as HTMLElement;\n if (groupEl) {\n const ghStyle = iframeDoc.createElement(\"style\");\n ghStyle.id = \"sg-group-highlight\";\n ghStyle.textContent = `\n [data-block-id=\"${blockId}\"] [data-block-group=\"${group}\"] {\n outline: 2px solid #8b5cf6 !important;\n outline-offset: 2px !important;\n position: relative;\n }\n `;\n iframeDoc.head.appendChild(ghStyle);\n\n const gLabel = iframeDoc.createElement(\"div\");\n gLabel.id = \"sg-group-label\";\n gLabel.textContent = group;\n gLabel.style.cssText = \"position:absolute;top:-20px;right:0;background:#8b5cf6;color:#fff;font-size:10px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10001;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:14px;\";\n const gPos = getComputedStyle(groupEl).position;\n if (gPos === \"static\") groupEl.style.position = \"relative\";\n groupEl.appendChild(gLabel);\n }\n }\n }\n });\n };\n\n // Enviar mapa de nomes para o iframe\n const sendBlockNamesToIframe = () => {\n if (!iframeRef.current?.contentWindow) return;\n iframeRef.current.contentWindow.postMessage({\n type: \"sg-set-block-names\",\n names: blockNameMapRef.current,\n }, \"*\");\n };\n\n // Atualizar hover overlay (injetar/remover CSS de hover nos blocos)\n const updateSelectionOverlay = (enabled: boolean) => {\n if (!iframeRef.current) return;\n\n const iframeDoc =\n iframeRef.current.contentDocument ||\n iframeRef.current.contentWindow?.document;\n if (!iframeDoc) return;\n\n const existingStyle = iframeDoc.getElementById(\"sg-hover-overlay\");\n if (existingStyle) existingStyle.remove();\n\n // Remove tooltip when disabling\n if (!enabled) {\n const tooltip = iframeDoc.getElementById(\"sg-hover-tooltip\");\n if (tooltip) tooltip.style.opacity = \"0\";\n }\n\n if (enabled) {\n const hoverStyle = iframeDoc.createElement(\"style\");\n hoverStyle.id = \"sg-hover-overlay\";\n hoverStyle.textContent = `\n [data-block-id] {\n cursor: pointer;\n transition: outline 0.15s ease, outline-offset 0.15s ease;\n }\n [data-block-id]:hover {\n outline: 2px dashed #94a3b8 !important;\n outline-offset: 2px !important;\n }\n [data-block-group] {\n cursor: pointer;\n transition: outline 0.15s ease, background 0.15s ease;\n }\n [data-block-group]:hover {\n outline: 1.5px dashed #a78bfa !important;\n outline-offset: 1px !important;\n background: rgba(139, 92, 246, 0.04);\n }\n `;\n iframeDoc.head.appendChild(hoverStyle);\n sendBlockNamesToIframe();\n }\n\n // Re-apply highlight (recalcula label)\n updateHighlight(selectedBlockIdRef.current || null);\n };\n\n // Atualizar preview completo (com srcdoc - causa reload)\n const updateFullPreview = (doc: SiteDocument, showLoading: boolean) => {\n if (!iframeRef.current || !page) return;\n\n try {\n if (showLoading) {\n setIsLoading(true);\n }\n\n let html = exportPageToHtml(page, doc, true);\n\n // Adicionar click handler + hover handler: links não navegam, enviam editor-navigate; outros cliques enviam block-click\n const clickHandler = `\n <script>\n (function() {\n // Click handler\n document.addEventListener('click', function(e) {\n var target = e.target;\n var anchor = target;\n while (anchor && anchor.tagName !== 'A') {\n anchor = anchor.parentElement;\n }\n if (anchor && anchor.tagName === 'A' && anchor.href) {\n e.preventDefault();\n e.stopPropagation();\n window.parent.postMessage({\n type: 'editor-navigate',\n href: anchor.getAttribute('href') || anchor.href\n }, '*');\n return;\n }\n var element = target;\n var group = null;\n while (element && !element.dataset.blockId) {\n if (element.dataset && element.dataset.blockGroup && !group) {\n group = element.dataset.blockGroup;\n }\n element = element.parentElement;\n }\n if (element && element.dataset.blockId) {\n window.parent.postMessage({\n type: 'block-click',\n blockId: element.dataset.blockId,\n group: group\n }, '*');\n }\n }, true);\n\n // Hover tooltip — block name map injected from parent via postMessage\n var _blockNames = {};\n var _hoverTooltip = null;\n\n window.addEventListener('message', function(e) {\n if (e.data && e.data.type === 'sg-set-block-names') {\n _blockNames = e.data.names || {};\n }\n });\n\n function getTooltip() {\n if (_hoverTooltip) return _hoverTooltip;\n _hoverTooltip = document.createElement('div');\n _hoverTooltip.id = 'sg-hover-tooltip';\n _hoverTooltip.style.cssText = 'position:fixed;top:0;left:0;background:#334155;color:#fff;font-size:11px;font-weight:500;padding:3px 8px;border-radius:4px;z-index:99999;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:16px;opacity:0;transition:opacity 0.12s ease;box-shadow:0 2px 6px rgba(0,0,0,0.2);';\n document.body.appendChild(_hoverTooltip);\n return _hoverTooltip;\n }\n\n var _currentHoveredBlock = null;\n var _currentHoveredGroup = null;\n\n document.addEventListener('mouseover', function(e) {\n // Check if hover overlay is active\n if (!document.getElementById('sg-hover-overlay')) return;\n var el = e.target;\n var groupName = null;\n while (el && !el.dataset.blockId) {\n if (el.dataset && el.dataset.blockGroup && !groupName) {\n groupName = el.dataset.blockGroup;\n }\n el = el.parentElement;\n }\n if (el && el.dataset.blockId) {\n if (el !== _currentHoveredBlock || groupName !== _currentHoveredGroup) {\n _currentHoveredBlock = el;\n _currentHoveredGroup = groupName;\n var tt = getTooltip();\n var blockName = _blockNames[el.dataset.blockId] || el.dataset.blockId;\n tt.textContent = groupName ? (blockName + ' \\\\u203A ' + groupName) : blockName;\n tt.style.opacity = '1';\n }\n }\n }, true);\n\n document.addEventListener('mousemove', function(e) {\n if (_hoverTooltip && _hoverTooltip.style.opacity === '1') {\n _hoverTooltip.style.left = (e.clientX + 12) + 'px';\n _hoverTooltip.style.top = (e.clientY - 28) + 'px';\n }\n }, true);\n\n document.addEventListener('mouseout', function(e) {\n var el = e.target;\n while (el && !el.dataset.blockId) el = el.parentElement;\n if (el === _currentHoveredBlock) {\n var related = e.relatedTarget;\n while (related && related !== el) related = related.parentElement;\n if (!related) {\n _currentHoveredBlock = null;\n _currentHoveredGroup = null;\n if (_hoverTooltip) _hoverTooltip.style.opacity = '0';\n }\n }\n }, true);\n })();\n </script>\n `;\n html = html.replace(\"</body>\", `${clickHandler}</body>`);\n if (!html.includes(\"</body>\")) {\n html = html + clickHandler;\n }\n\n const iframe = iframeRef.current;\n\n const applyOverlayAfterLoad = () => {\n updateHighlight(selectedBlockIdRef.current || null);\n if (showSelectionOverlayRef.current) {\n updateSelectionOverlay(true);\n }\n };\n\n if (showLoading) {\n iframe.onload = () => {\n setIsLoading(false);\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n applyOverlayAfterLoad();\n };\n setTimeout(() => {\n setIsLoading(false);\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n applyOverlayAfterLoad();\n }, 1000);\n } else {\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n iframe.onload = () => {\n applyOverlayAfterLoad();\n };\n }\n\n iframe.srcdoc = html;\n } catch (error) {\n logger.error(\"[Preview] Error:\", error);\n if (showLoading) {\n setIsLoading(false);\n }\n }\n };\n\n // Atualizar apenas um bloco (sem reload)\n const updatePartialPreview = (blockId: string, doc: SiteDocument) => {\n if (!iframeRef.current || !page) return;\n\n try {\n const block = findBlockInPage(page, blockId);\n if (!block) {\n updateFullPreview(doc, false);\n return;\n }\n\n const blockHtml = exportBlockToHtml(block, undefined, doc.theme);\n\n requestAnimationFrame(() => {\n const iframe = iframeRef.current;\n if (!iframe) return;\n\n const iframeDoc =\n iframe.contentDocument || iframe.contentWindow?.document;\n if (!iframeDoc) return;\n\n const element = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`);\n if (element) {\n try {\n // Remover <style> tags antigas associadas a este bloco\n const oldStyles = iframeDoc.querySelectorAll(`style[data-block-style=\"${blockId}\"]`);\n oldStyles.forEach(s => s.remove());\n\n const temp = iframeDoc.createElement(\"div\");\n temp.innerHTML = blockHtml;\n\n // Marcar e extrair <style> tags para inserção separada\n const styleTags = temp.querySelectorAll(\"style\");\n styleTags.forEach(style => {\n style.setAttribute(\"data-block-style\", blockId);\n });\n\n // Usar DocumentFragment para substituir com múltiplos elementos irmãos\n // (ex: <style>hover CSS</style><button>text</button>)\n const fragment = iframeDoc.createDocumentFragment();\n while (temp.firstChild) {\n fragment.appendChild(temp.firstChild);\n }\n\n if (fragment.childNodes.length > 0) {\n element.parentNode?.replaceChild(fragment, element);\n } else {\n element.outerHTML = blockHtml;\n }\n\n // Atualizar refs\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n\n // Reaplicar highlight\n updateHighlight(selectedBlockIdRef.current || null);\n } catch (error) {\n logger.error(\"[Preview] Erro ao atualizar:\", error);\n updateFullPreview(doc, false);\n }\n } else {\n updateFullPreview(doc, false);\n }\n });\n } catch (error) {\n logger.error(\"[Preview] Erro:\", error);\n updateFullPreview(doc, false);\n }\n };\n\n // Efeito para mudanças no DOCUMENTO (não no selectedBlockId)\n useEffect(() => {\n if (!page) {\n setIsLoading(false);\n return;\n }\n\n const currentDocHash = hashDocument(document);\n\n // Primeira renderização\n if (!isInitializedRef.current) {\n if (iframeRef.current) {\n isInitializedRef.current = true;\n previousPageIdRef.current = page?.id ?? null;\n updateFullPreview(document, true);\n }\n return;\n }\n\n if (!iframeRef.current) return;\n\n // Detectar troca de página (pageId mudou)\n const currentPageId = page?.id ?? null;\n if (previousPageIdRef.current !== currentPageId) {\n previousPageIdRef.current = currentPageId;\n updateFullPreview(document, false);\n return;\n }\n\n // Se hash não mudou, não há mudanças no documento\n if (previousDocHashRef.current === currentDocHash) {\n return;\n }\n\n // Se o theme mudou, forçar reload completo (CSS variables precisam ser regeneradas)\n const prevThemeJson = previousDocRef.current ? JSON.stringify(previousDocRef.current.theme) : null;\n const currThemeJson = JSON.stringify(document.theme);\n if (prevThemeJson !== currThemeJson) {\n updateFullPreview(document, false);\n return;\n }\n\n // Detectar mudanças na página atual\n const changedBlocks = detectChangedBlocks(\n previousDocRef.current || document,\n document,\n page?.id,\n );\n\n // Se não há mudanças detectadas mas o hash mudou, forçar reload\n if (changedBlocks.length === 0) {\n logger.debug(\n \"[Preview] Hash changed but no changes detected, forcing reload\",\n );\n updateFullPreview(document, false);\n return;\n }\n\n // Mudança estrutural (bloco adicionado/removido) = reload completo\n if (\n changedBlocks.some(\n (c) =>\n c.blockId === \"__structural__\" ||\n c.changedProps?.includes(\"children\"),\n )\n ) {\n updateFullPreview(document, false);\n return;\n }\n\n // Mudança de 1 bloco (não estrutural) = atualização parcial\n if (changedBlocks.length === 1) {\n const change = changedBlocks[0];\n const changedProps = change.changedProps || [];\n\n const isStructural = changedProps.some(\n (prop) =>\n prop === \"children\" ||\n prop === \"header\" ||\n prop === \"content\" ||\n prop === \"footer\",\n );\n\n if (!isStructural) {\n updatePartialPreview(change.blockId, document);\n return;\n }\n }\n\n // Fallback: reload completo SEM loader\n updateFullPreview(document, false);\n }, [document, page]); // APENAS document e page - sem funções\n\n // Efeito SEPARADO para highlight (não recarrega o preview)\n useEffect(() => {\n if (!isInitializedRef.current) return;\n updateHighlight(selectedBlockId || null);\n }, [selectedBlockId, focusedGroup]); // eslint-disable-line react-hooks/exhaustive-deps -- updateHighlight reads focusedGroupRef\n\n // Efeito para toggle do selection overlay\n useEffect(() => {\n if (!isInitializedRef.current) return;\n updateSelectionOverlay(showSelectionOverlay);\n }, [showSelectionOverlay]); // eslint-disable-line react-hooks/exhaustive-deps -- same pattern as updateFullPreview\n\n // Listener para cliques\n useEffect(() => {\n if (!onBlockClick) return;\n\n const handleMessage = (event: MessageEvent) => {\n if (event.data?.type === \"block-click\" && event.data?.blockId) {\n onBlockClick(event.data.blockId, event.data.group || undefined);\n }\n };\n\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\"message\", handleMessage);\n };\n }, [onBlockClick]);\n\n if (!page) {\n return (\n <div className={className} style={style}>\n <div style={{ padding: \"2rem\", textAlign: \"center\", color: \"#6b7280\" }}>\n Página não encontrada\n </div>\n </div>\n );\n }\n\n return (\n <div className={className} style={{ position: \"relative\", ...style }}>\n {isLoading && (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"rgba(255, 255, 255, 0.8)\",\n zIndex: 10,\n }}\n >\n <div style={{ color: \"#6b7280\" }}>Carregando preview...</div>\n </div>\n )}\n <iframe\n ref={iframeRef}\n style={{\n width: \"100%\",\n height: \"100%\",\n border: \"none\",\n backgroundColor: \"#ffffff\",\n }}\n title=\"Preview do site\"\n />\n </div>\n );\n}\n"],"names":["findBlockInPage","page","blockId","findInBlocks","blocks","block","props","found","buildBlockNameMap","map","walk","def","componentRegistry","Preview","document","pageId","className","style","onBlockClick","selectedBlockId","showSelectionOverlay","focusedGroup","iframeRef","useRef","previousDocRef","previousDocHashRef","previousPageIdRef","isInitializedRef","isLoading","setIsLoading","useState","selectedBlockIdRef","showSelectionOverlayRef","focusedGroupRef","useEffect","useMemo","p","blockNameMapRef","updateHighlight","iframeDoc","overlayEnabled","group","oldStyle","el","htmlEl","oldLabel","oldGroupStyle","oldGroupLabel","highlightStyle","selectedEl","blockName","label","groupEl","ghStyle","gLabel","sendBlockNamesToIframe","updateSelectionOverlay","enabled","existingStyle","tooltip","hoverStyle","updateFullPreview","doc","showLoading","html","exportPageToHtml","clickHandler","iframe","applyOverlayAfterLoad","hashDocument","error","logger","updatePartialPreview","blockHtml","exportBlockToHtml","element","s","temp","fragment","currentDocHash","currentPageId","prevThemeJson","currThemeJson","changedBlocks","detectChangedBlocks","c","change","prop","handleMessage","event","jsxs","jsx"],"mappings":";;;;;;;AA6BA,SAASA,EAAgBC,GAAWC,GAA+B;AACjE,QAAMC,IAAe,CAACC,MAAkC;AACtD,eAAWC,KAASD,GAAQ;AAC1B,UAAIC,EAAM,OAAOH,EAAS,QAAOG;AACjC,YAAMC,IAAQD,EAAM;AACpB,UAAIC,GAAO,YAAY,MAAM,QAAQA,EAAM,QAAQ,GAAG;AACpD,cAAMC,IAAQJ,EAAaG,EAAM,QAAQ;AACzC,YAAIC,EAAO,QAAOA;AAAA,MACpB;AACA,UAAIF,EAAM,SAAS,QAAQ;AACzB,YAAIC,EAAM,UAAU,MAAM,QAAQA,EAAM,MAAM,GAAG;AAC/C,gBAAMC,IAAQJ,EAAaG,EAAM,MAAM;AACvC,cAAIC,EAAO,QAAOA;AAAA,QACpB;AACA,YAAID,EAAM,WAAW,MAAM,QAAQA,EAAM,OAAO,GAAG;AACjD,gBAAMC,IAAQJ,EAAaG,EAAM,OAAO;AACxC,cAAIC,EAAO,QAAOA;AAAA,QACpB;AACA,YAAID,EAAM,UAAU,MAAM,QAAQA,EAAM,MAAM,GAAG;AAC/C,gBAAMC,IAAQJ,EAAaG,EA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AgB;AAAA,UAChB,iBAAiB;AAAA,UACjB,QAAQ;AAAA,QAAA;AAAA,QAGV,4BAAC,OAAA,EAAI,OAAO,EAAE,OAAO,UAAA,GAAa,UAAA,wBAAA,CAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,IAG3D,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKrE;AAAA,QACL,OAAO;AAAA,UACL,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,iBAAiB;AAAA,QAAA;AAAA,QAEnB,OAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,GACF,sBAtCG,OAAA,EAAI,WAAAN,GAAsB,OAAAC,GACzB,UAAA,gBAAA0E,EAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,UAAU,OAAO,UAAA,GAAa,mCAExE,GACF;AAoCN;"}
|
|
1
|
+
{"version":3,"file":"Preview.js","sources":["../../../src/engine/preview/Preview.tsx"],"sourcesContent":["/**\n * Preview\n * Sem dependências circulares, sem reloads desnecessários\n */\n\nimport React, { useEffect, useRef, useState, useMemo } from \"react\";\nimport { SiteDocument, Block } from \"../schema/siteDocument\";\nimport { componentRegistry } from \"../registry/registry\";\nimport { exportPageToHtml, exportBlockToHtml } from \"../export/exportHtml\";\nimport { detectChangedBlocks } from \"../../utils/changeDetector\";\nimport { hashDocument } from \"../../utils/documentHash\";\nimport { logger } from \"../../utils/logger\";\n\nexport interface PreviewProps {\n document: SiteDocument;\n pageId?: string;\n className?: string;\n style?: React.CSSProperties;\n onBlockClick?: (blockId: string, group?: string) => void;\n selectedBlockId?: string | null;\n /** Exibe hover e label de seleção nos blocos do preview */\n showSelectionOverlay?: boolean;\n /** Grupo focado para indicador visual no preview */\n focusedGroup?: string | null;\n}\n\n/**\n * Encontra um bloco na estrutura recursivamente\n */\nfunction findBlockInPage(page: any, blockId: string): Block | null {\n const findInBlocks = (blocks: Block[]): Block | null => {\n for (const block of blocks) {\n if (block.id === blockId) return block;\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) {\n const found = findInBlocks(props.children);\n if (found) return found;\n }\n if (block.type === \"card\") {\n if (props.header && Array.isArray(props.header)) {\n const found = findInBlocks(props.header);\n if (found) return found;\n }\n if (props.content && Array.isArray(props.content)) {\n const found = findInBlocks(props.content);\n if (found) return found;\n }\n if (props.footer && Array.isArray(props.footer)) {\n const found = findInBlocks(props.footer);\n if (found) return found;\n }\n }\n }\n return null;\n };\n return findInBlocks(page.structure);\n}\n\n/**\n * Monta mapa blockId → nome legível (da registry)\n */\nfunction buildBlockNameMap(page: any): Record<string, string> {\n const map: Record<string, string> = {};\n const walk = (blocks: Block[]) => {\n for (const block of blocks) {\n const def = componentRegistry.get(block.type);\n map[block.id] = def?.name || block.type;\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) walk(props.children);\n if (block.type === \"card\") {\n if (Array.isArray(props?.header)) walk(props.header);\n if (Array.isArray(props?.content)) walk(props.content);\n if (Array.isArray(props?.footer)) walk(props.footer);\n }\n }\n };\n if (page?.structure) walk(page.structure);\n return map;\n}\n\n/**\n * Componente de preview usando iframe isolado\n */\nexport function Preview({\n document,\n pageId,\n className,\n style,\n onBlockClick,\n selectedBlockId,\n showSelectionOverlay = false,\n focusedGroup = null,\n}: PreviewProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const previousDocRef = useRef<SiteDocument | null>(null);\n const previousDocHashRef = useRef<string | null>(null);\n const previousPageIdRef = useRef<string | null>(null);\n const isInitializedRef = useRef<boolean>(false);\n const [isLoading, setIsLoading] = useState(true);\n\n // Usar ref para selectedBlockId (necessário para highlight assíncrono)\n const selectedBlockIdRef = useRef(selectedBlockId);\n const showSelectionOverlayRef = useRef(showSelectionOverlay);\n const focusedGroupRef = useRef(focusedGroup);\n\n // Atualizar refs quando props mudam\n useEffect(() => {\n selectedBlockIdRef.current = selectedBlockId;\n }, [selectedBlockId]);\n\n useEffect(() => {\n showSelectionOverlayRef.current = showSelectionOverlay;\n }, [showSelectionOverlay]);\n\n useEffect(() => {\n focusedGroupRef.current = focusedGroup;\n }, [focusedGroup]);\n\n const page = useMemo(() => {\n return pageId\n ? document.pages.find((p) => p.id === pageId)\n : document.pages[0];\n }, [document, pageId]);\n\n // Mapa blockId → nome legível para labels\n const blockNameMapRef = useRef<Record<string, string>>({});\n useEffect(() => {\n blockNameMapRef.current = buildBlockNameMap(page);\n }, [page]);\n\n // Atualizar highlight + selection overlay diretamente no iframe (sem reload)\n const updateHighlight = (blockId: string | null) => {\n if (!iframeRef.current) return;\n\n const iframeDoc =\n iframeRef.current.contentDocument ||\n iframeRef.current.contentWindow?.document;\n if (!iframeDoc) return;\n\n const overlayEnabled = showSelectionOverlayRef.current;\n const group = focusedGroupRef.current;\n\n requestAnimationFrame(() => {\n // Remover highlight anterior\n const oldStyle = iframeDoc.getElementById(\"block-highlight\");\n if (oldStyle) oldStyle.remove();\n\n const allBlocks = iframeDoc.querySelectorAll(\"[data-block-id]\");\n allBlocks.forEach((el) => {\n const htmlEl = el as HTMLElement;\n htmlEl.style.outline = \"\";\n htmlEl.style.outlineOffset = \"\";\n });\n\n // Remover labels anteriores\n const oldLabel = iframeDoc.getElementById(\"sg-block-label\");\n if (oldLabel) oldLabel.remove();\n const oldGroupStyle = iframeDoc.getElementById(\"sg-group-highlight\");\n if (oldGroupStyle) oldGroupStyle.remove();\n const oldGroupLabel = iframeDoc.getElementById(\"sg-group-label\");\n if (oldGroupLabel) oldGroupLabel.remove();\n\n // Adicionar novo highlight\n if (blockId) {\n const highlightStyle = iframeDoc.createElement(\"style\");\n highlightStyle.id = \"block-highlight\";\n highlightStyle.textContent = `\n [data-block-id=\"${blockId}\"] {\n outline: 2px solid #3b82f6 !important;\n outline-offset: 2px !important;\n position: relative;\n }\n [data-block-id=\"${blockId}\"]::before {\n content: '';\n position: absolute;\n top: -4px;\n left: -4px;\n right: -4px;\n bottom: -4px;\n background: rgba(59, 130, 246, 0.1);\n pointer-events: none;\n z-index: -1;\n }\n `;\n iframeDoc.head.appendChild(highlightStyle);\n\n // Selection label (only when overlay is enabled)\n if (overlayEnabled) {\n const selectedEl = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`) as HTMLElement;\n if (selectedEl) {\n const blockName = blockNameMapRef.current[blockId] || blockId;\n const label = iframeDoc.createElement(\"div\");\n label.id = \"sg-block-label\";\n label.textContent = blockName;\n label.style.cssText = \"position:absolute;top:-22px;left:0;background:#3b82f6;color:#fff;font-size:11px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10000;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:16px;\";\n const pos = getComputedStyle(selectedEl).position;\n if (pos === \"static\") selectedEl.style.position = \"relative\";\n selectedEl.appendChild(label);\n }\n }\n\n // Indicador de grupo — mostra qual sub-seção foi clicada (purple)\n if (group) {\n const blockEl = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`);\n const groupEl = blockEl?.querySelector(`[data-block-group=\"${group}\"]`) as HTMLElement;\n if (groupEl) {\n const ghStyle = iframeDoc.createElement(\"style\");\n ghStyle.id = \"sg-group-highlight\";\n ghStyle.textContent = `\n [data-block-id=\"${blockId}\"] [data-block-group=\"${group}\"] {\n outline: 2px solid #8b5cf6 !important;\n outline-offset: 2px !important;\n position: relative;\n }\n `;\n iframeDoc.head.appendChild(ghStyle);\n\n const gLabel = iframeDoc.createElement(\"div\");\n gLabel.id = \"sg-group-label\";\n gLabel.textContent = group;\n gLabel.style.cssText = \"position:absolute;top:-20px;right:0;background:#8b5cf6;color:#fff;font-size:10px;font-weight:600;padding:2px 8px;border-radius:4px 4px 0 0;z-index:10001;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:14px;\";\n const gPos = getComputedStyle(groupEl).position;\n if (gPos === \"static\") groupEl.style.position = \"relative\";\n groupEl.appendChild(gLabel);\n }\n }\n }\n });\n };\n\n // Enviar mapa de nomes para o iframe\n const sendBlockNamesToIframe = () => {\n if (!iframeRef.current?.contentWindow) return;\n iframeRef.current.contentWindow.postMessage({\n type: \"sg-set-block-names\",\n names: blockNameMapRef.current,\n }, \"*\");\n };\n\n // Atualizar hover overlay (injetar/remover CSS de hover nos blocos)\n const updateSelectionOverlay = (enabled: boolean) => {\n if (!iframeRef.current) return;\n\n const iframeDoc =\n iframeRef.current.contentDocument ||\n iframeRef.current.contentWindow?.document;\n if (!iframeDoc) return;\n\n const existingStyle = iframeDoc.getElementById(\"sg-hover-overlay\");\n if (existingStyle) existingStyle.remove();\n\n // Remove tooltip when disabling\n if (!enabled) {\n const tooltip = iframeDoc.getElementById(\"sg-hover-tooltip\");\n if (tooltip) tooltip.style.opacity = \"0\";\n }\n\n if (enabled) {\n const hoverStyle = iframeDoc.createElement(\"style\");\n hoverStyle.id = \"sg-hover-overlay\";\n hoverStyle.textContent = `\n [data-block-id] {\n cursor: pointer;\n transition: outline 0.15s ease, outline-offset 0.15s ease;\n }\n [data-block-id]:hover {\n outline: 2px dashed #94a3b8 !important;\n outline-offset: 2px !important;\n }\n [data-block-group] {\n cursor: pointer;\n transition: outline 0.15s ease, background 0.15s ease;\n }\n [data-block-group]:hover {\n outline: 1.5px dashed #a78bfa !important;\n outline-offset: 1px !important;\n background: rgba(139, 92, 246, 0.04);\n }\n `;\n iframeDoc.head.appendChild(hoverStyle);\n sendBlockNamesToIframe();\n }\n\n // Re-apply highlight (recalcula label)\n updateHighlight(selectedBlockIdRef.current || null);\n };\n\n // Atualizar preview completo (com srcdoc - causa reload)\n const updateFullPreview = (doc: SiteDocument, showLoading: boolean) => {\n if (!iframeRef.current || !page) return;\n\n try {\n if (showLoading) {\n setIsLoading(true);\n }\n\n let html = exportPageToHtml(page, doc, true);\n\n // Adicionar click handler + hover handler: links não navegam, enviam editor-navigate; outros cliques enviam block-click\n const clickHandler = `\n <script>\n (function() {\n // Click handler\n document.addEventListener('click', function(e) {\n var target = e.target;\n var anchor = target;\n while (anchor && anchor.tagName !== 'A') {\n anchor = anchor.parentElement;\n }\n if (anchor && anchor.tagName === 'A' && anchor.href) {\n e.preventDefault();\n e.stopPropagation();\n window.parent.postMessage({\n type: 'editor-navigate',\n href: anchor.getAttribute('href') || anchor.href\n }, '*');\n return;\n }\n var element = target;\n var group = null;\n while (element && !element.dataset.blockId) {\n if (element.dataset && element.dataset.blockGroup && !group) {\n group = element.dataset.blockGroup;\n }\n element = element.parentElement;\n }\n if (element && element.dataset.blockId) {\n window.parent.postMessage({\n type: 'block-click',\n blockId: element.dataset.blockId,\n group: group\n }, '*');\n }\n }, true);\n\n // Hover tooltip — block name map injected from parent via postMessage\n var _blockNames = {};\n var _hoverTooltip = null;\n\n window.addEventListener('message', function(e) {\n if (e.data && e.data.type === 'sg-set-block-names') {\n _blockNames = e.data.names || {};\n }\n });\n\n function getTooltip() {\n if (_hoverTooltip) return _hoverTooltip;\n _hoverTooltip = document.createElement('div');\n _hoverTooltip.id = 'sg-hover-tooltip';\n _hoverTooltip.style.cssText = 'position:fixed;top:0;left:0;background:#334155;color:#fff;font-size:11px;font-weight:500;padding:3px 8px;border-radius:4px;z-index:99999;pointer-events:none;font-family:system-ui,sans-serif;white-space:nowrap;line-height:16px;opacity:0;transition:opacity 0.12s ease;box-shadow:0 2px 6px rgba(0,0,0,0.2);';\n document.body.appendChild(_hoverTooltip);\n return _hoverTooltip;\n }\n\n var _currentHoveredBlock = null;\n var _currentHoveredGroup = null;\n\n document.addEventListener('mouseover', function(e) {\n // Check if hover overlay is active\n if (!document.getElementById('sg-hover-overlay')) return;\n var el = e.target;\n var groupName = null;\n while (el && !el.dataset.blockId) {\n if (el.dataset && el.dataset.blockGroup && !groupName) {\n groupName = el.dataset.blockGroup;\n }\n el = el.parentElement;\n }\n if (el && el.dataset.blockId) {\n if (el !== _currentHoveredBlock || groupName !== _currentHoveredGroup) {\n _currentHoveredBlock = el;\n _currentHoveredGroup = groupName;\n var tt = getTooltip();\n var blockName = _blockNames[el.dataset.blockId] || el.dataset.blockId;\n tt.textContent = groupName ? (blockName + ' \\\\u203A ' + groupName) : blockName;\n tt.style.opacity = '1';\n }\n }\n }, true);\n\n document.addEventListener('mousemove', function(e) {\n if (_hoverTooltip && _hoverTooltip.style.opacity === '1') {\n _hoverTooltip.style.left = (e.clientX + 12) + 'px';\n _hoverTooltip.style.top = (e.clientY - 28) + 'px';\n }\n }, true);\n\n document.addEventListener('mouseout', function(e) {\n var el = e.target;\n while (el && !el.dataset.blockId) el = el.parentElement;\n if (el === _currentHoveredBlock) {\n var related = e.relatedTarget;\n while (related && related !== el) related = related.parentElement;\n if (!related) {\n _currentHoveredBlock = null;\n _currentHoveredGroup = null;\n if (_hoverTooltip) _hoverTooltip.style.opacity = '0';\n }\n }\n }, true);\n })();\n </script>\n `;\n html = html.replace(\"</body>\", `${clickHandler}</body>`);\n if (!html.includes(\"</body>\")) {\n html = html + clickHandler;\n }\n\n const iframe = iframeRef.current;\n\n const applyOverlayAfterLoad = () => {\n updateHighlight(selectedBlockIdRef.current || null);\n if (showSelectionOverlayRef.current) {\n updateSelectionOverlay(true);\n }\n };\n\n if (showLoading) {\n iframe.onload = () => {\n setIsLoading(false);\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n applyOverlayAfterLoad();\n };\n setTimeout(() => {\n setIsLoading(false);\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n applyOverlayAfterLoad();\n }, 1000);\n } else {\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n iframe.onload = () => {\n applyOverlayAfterLoad();\n };\n }\n\n iframe.srcdoc = html;\n } catch (error) {\n logger.error(\"[Preview] Error:\", error);\n if (showLoading) {\n setIsLoading(false);\n }\n }\n };\n\n // Atualizar apenas um bloco (sem reload)\n const updatePartialPreview = (blockId: string, doc: SiteDocument) => {\n if (!iframeRef.current || !page) return;\n\n try {\n const block = findBlockInPage(page, blockId);\n if (!block) {\n updateFullPreview(doc, false);\n return;\n }\n\n const blockHtml = exportBlockToHtml(block, undefined, doc.theme);\n\n requestAnimationFrame(() => {\n const iframe = iframeRef.current;\n if (!iframe) return;\n\n const iframeDoc =\n iframe.contentDocument || iframe.contentWindow?.document;\n if (!iframeDoc) return;\n\n const element = iframeDoc.querySelector(`[data-block-id=\"${blockId}\"]`);\n if (element) {\n try {\n // Remover <style> e <script> tags antigas associadas a este bloco\n const oldStyles = iframeDoc.querySelectorAll(`style[data-block-style=\"${blockId}\"]`);\n oldStyles.forEach(s => s.remove());\n const oldScripts = iframeDoc.querySelectorAll(`script[data-block-style=\"${blockId}\"]`);\n oldScripts.forEach(s => s.remove());\n\n const temp = iframeDoc.createElement(\"div\");\n temp.innerHTML = blockHtml;\n\n // Marcar e extrair <style> tags para inserção separada\n const styleTags = temp.querySelectorAll(\"style\");\n styleTags.forEach(style => {\n style.setAttribute(\"data-block-style\", blockId);\n });\n\n // Extrair <script> tags antes da inserção no DOM\n // (scripts inseridos via innerHTML/fragment NÃO são executados pelo browser)\n const scriptTags: { text: string }[] = [];\n const scripts = temp.querySelectorAll(\"script\");\n scripts.forEach(script => {\n scriptTags.push({ text: script.textContent || \"\" });\n script.remove();\n });\n\n // Usar DocumentFragment para substituir com múltiplos elementos irmãos\n // (ex: <style>hover CSS</style><button>text</button>)\n const fragment = iframeDoc.createDocumentFragment();\n while (temp.firstChild) {\n fragment.appendChild(temp.firstChild);\n }\n\n if (fragment.childNodes.length > 0) {\n element.parentNode?.replaceChild(fragment, element);\n } else {\n element.outerHTML = blockHtml;\n }\n\n // Re-executar scripts criando novos elementos <script>\n // (o browser executa scripts criados via createElement + appendChild)\n scriptTags.forEach(({ text }) => {\n if (!text.trim()) return;\n const newScript = iframeDoc.createElement(\"script\");\n newScript.setAttribute(\"data-block-style\", blockId);\n newScript.textContent = text;\n iframeDoc.body.appendChild(newScript);\n });\n\n // Atualizar refs\n previousDocRef.current = JSON.parse(JSON.stringify(doc));\n previousDocHashRef.current = hashDocument(doc);\n\n // Reaplicar highlight\n updateHighlight(selectedBlockIdRef.current || null);\n } catch (error) {\n logger.error(\"[Preview] Erro ao atualizar:\", error);\n updateFullPreview(doc, false);\n }\n } else {\n updateFullPreview(doc, false);\n }\n });\n } catch (error) {\n logger.error(\"[Preview] Erro:\", error);\n updateFullPreview(doc, false);\n }\n };\n\n // Efeito para mudanças no DOCUMENTO (não no selectedBlockId)\n useEffect(() => {\n if (!page) {\n setIsLoading(false);\n return;\n }\n\n const currentDocHash = hashDocument(document);\n\n // Primeira renderização\n if (!isInitializedRef.current) {\n if (iframeRef.current) {\n isInitializedRef.current = true;\n previousPageIdRef.current = page?.id ?? null;\n updateFullPreview(document, true);\n }\n return;\n }\n\n if (!iframeRef.current) return;\n\n // Detectar troca de página (pageId mudou)\n const currentPageId = page?.id ?? null;\n if (previousPageIdRef.current !== currentPageId) {\n previousPageIdRef.current = currentPageId;\n updateFullPreview(document, false);\n return;\n }\n\n // Se hash não mudou, não há mudanças no documento\n if (previousDocHashRef.current === currentDocHash) {\n return;\n }\n\n // Se o theme mudou, forçar reload completo (CSS variables precisam ser regeneradas)\n const prevThemeJson = previousDocRef.current ? JSON.stringify(previousDocRef.current.theme) : null;\n const currThemeJson = JSON.stringify(document.theme);\n if (prevThemeJson !== currThemeJson) {\n updateFullPreview(document, false);\n return;\n }\n\n // Detectar mudanças na página atual\n const changedBlocks = detectChangedBlocks(\n previousDocRef.current || document,\n document,\n page?.id,\n );\n\n // Se não há mudanças detectadas mas o hash mudou, forçar reload\n if (changedBlocks.length === 0) {\n logger.debug(\n \"[Preview] Hash changed but no changes detected, forcing reload\",\n );\n updateFullPreview(document, false);\n return;\n }\n\n // Mudança estrutural (bloco adicionado/removido) = reload completo\n if (\n changedBlocks.some(\n (c) =>\n c.blockId === \"__structural__\" ||\n c.changedProps?.includes(\"children\"),\n )\n ) {\n updateFullPreview(document, false);\n return;\n }\n\n // Mudança de 1 bloco (não estrutural) = atualização parcial\n if (changedBlocks.length === 1) {\n const change = changedBlocks[0];\n const changedProps = change.changedProps || [];\n\n const isStructural = changedProps.some(\n (prop) =>\n prop === \"children\" ||\n prop === \"header\" ||\n prop === \"content\" ||\n prop === \"footer\",\n );\n\n if (!isStructural) {\n updatePartialPreview(change.blockId, document);\n return;\n }\n }\n\n // Fallback: reload completo SEM loader\n updateFullPreview(document, false);\n }, [document, page]); // APENAS document e page - sem funções\n\n // Efeito SEPARADO para highlight (não recarrega o preview)\n useEffect(() => {\n if (!isInitializedRef.current) return;\n updateHighlight(selectedBlockId || null);\n }, [selectedBlockId, focusedGroup]); // eslint-disable-line react-hooks/exhaustive-deps -- updateHighlight reads focusedGroupRef\n\n // Efeito para toggle do selection overlay\n useEffect(() => {\n if (!isInitializedRef.current) return;\n updateSelectionOverlay(showSelectionOverlay);\n }, [showSelectionOverlay]); // eslint-disable-line react-hooks/exhaustive-deps -- same pattern as updateFullPreview\n\n // Listener para cliques\n useEffect(() => {\n if (!onBlockClick) return;\n\n const handleMessage = (event: MessageEvent) => {\n if (event.data?.type === \"block-click\" && event.data?.blockId) {\n onBlockClick(event.data.blockId, event.data.group || undefined);\n }\n };\n\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\"message\", handleMessage);\n };\n }, [onBlockClick]);\n\n if (!page) {\n return (\n <div className={className} style={style}>\n <div style={{ padding: \"2rem\", textAlign: \"center\", color: \"#6b7280\" }}>\n Página não encontrada\n </div>\n </div>\n );\n }\n\n return (\n <div className={className} style={{ position: \"relative\", ...style }}>\n {isLoading && (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"rgba(255, 255, 255, 0.8)\",\n zIndex: 10,\n }}\n >\n <div style={{ color: \"#6b7280\" }}>Carregando preview...</div>\n </div>\n )}\n <iframe\n ref={iframeRef}\n style={{\n width: \"100%\",\n height: \"100%\",\n border: \"none\",\n backgroundColor: \"#ffffff\",\n }}\n title=\"Preview do site\"\n />\n </div>\n );\n}\n"],"names":["findBlockInPage","page","blockId","findInBlocks","blocks","block","props","found","buildBlockNameMap","map","walk","def","componentRegistry","Preview","document","pageId","className","style","onBlockClick","selectedBlockId","showSelectionOverlay","focusedGroup","iframeRef","useRef","previousDocRef","previousDocHashRef","previousPageIdRef","isInitializedRef","isLoading","setIsLoading","useState","selectedBlockIdRef","showSelectionOverlayRef","focusedGroupRef","useEffect","useMemo","p","blockNameMapRef","updateHighlight","iframeDoc","overlayEnabled","group","oldStyle","el","htmlEl","oldLabel","oldGroupStyle","oldGroupLabel","highlightStyle","selectedEl","blockName","label","groupEl","ghStyle","gLabel","sendBlockNamesToIframe","updateSelectionOverlay","enabled","existingStyle","tooltip","hoverStyle","updateFullPreview","doc","showLoading","html","exportPageToHtml","clickHandler","iframe","applyOverlayAfterLoad","hashDocument","error","logger","updatePartialPreview","blockHtml","exportBlockToHtml","element","s","temp","scriptTags","script","fragment","text","newScript","currentDocHash","currentPageId","prevThemeJson","currThemeJson","changedBlocks","detectChangedBlocks","c","change","prop","handleMessage","event","jsxs","jsx"],"mappings":";;;;;;;AA6BA,SAASA,EAAgBC,GAAWC,GAA+B;AACjE,QAAMC,IAAe,CAACC,MAAkC;AACtD,eAAWC,KAASD,GAAQ;AAC1B,UAAIC,EAAM,OAAOH,EAAS,QAAOG;AACjC,YAAMC,IAAQD,EAAM;AACpB,UAAIC,GAAO,YAAY,MAAM,QAAQA,EAAM,QAAQ,GAAG;AACpD,cAAMC,IAAQJ,EAAaG,EAAM,QAAQ;AACzC,YAAIC,EAAO,QAAOA;AAAA,MACpB;AACA,UAAIF,EAAM,SAAS,QAAQ;AACzB,YAAIC,EAAM,UAAU,MAAM,QAAQA,EAAM,MAAM,GAAG;AAC/C,gBAAMC,IAAQJ,EAAaG,EAAM,MAAM;AACvC,cAAIC,EAAO,QAAOA;AAAA,QACpB;AACA,YAAID,EAAM,WAAW,MAAM,QAAQA,EAAM,OAAO,GAAG;A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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageGallery.d.ts","sourceRoot":"","sources":["../../../../../src/engine/registry/blocks/sections/imageGallery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAAC,OAAO,CAuElE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"imageGallery.d.ts","sourceRoot":"","sources":["../../../../../src/engine/registry/blocks/sections/imageGallery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAAC,OAAO,CAuElE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,cAAc,CA+P7D,CAAC;AAKF,eAAe,iBAAiB,CAAC"}
|
|
@@ -88,12 +88,10 @@ const o = {
|
|
|
88
88
|
inputType: "text",
|
|
89
89
|
group: "Conteúdo"
|
|
90
90
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
description: "Gerencie as imagens da galeria"
|
|
96
|
-
},
|
|
91
|
+
// Note: "images" field is hidden because there's no modal UI for it yet.
|
|
92
|
+
// Users add images via defaultProps or programmatically.
|
|
93
|
+
// The gallery-images input type exists but shows confusing "[object Object]..." text.
|
|
94
|
+
// Will be re-enabled when GalleryImagesInput modal component is implemented.
|
|
97
95
|
// =========================================================================
|
|
98
96
|
// GRUPO: Layout
|
|
99
97
|
// =========================================================================
|
|
@@ -113,18 +111,18 @@ const o = {
|
|
|
113
111
|
label: "Colunas",
|
|
114
112
|
inputType: "number",
|
|
115
113
|
min: 2,
|
|
116
|
-
max:
|
|
114
|
+
max: 12,
|
|
117
115
|
group: "Layout",
|
|
118
|
-
description: "Número de colunas no desktop"
|
|
116
|
+
description: "Número de colunas no desktop (responsivo: 4→3→2→1)"
|
|
119
117
|
},
|
|
120
118
|
gap: {
|
|
121
|
-
label: "Espaçamento",
|
|
119
|
+
label: "Espaçamento (rem)",
|
|
122
120
|
inputType: "number",
|
|
123
121
|
min: 0,
|
|
124
|
-
max:
|
|
122
|
+
max: 5,
|
|
125
123
|
step: 0.5,
|
|
126
124
|
group: "Layout",
|
|
127
|
-
description: "Espaçamento entre imagens (
|
|
125
|
+
description: "Espaçamento entre imagens (0 = sem espaço)"
|
|
128
126
|
},
|
|
129
127
|
aspectRatio: {
|
|
130
128
|
label: "Proporção",
|
|
@@ -155,14 +153,14 @@ const o = {
|
|
|
155
153
|
description: "Arredondamento das imagens (px)"
|
|
156
154
|
},
|
|
157
155
|
imageShadow: {
|
|
158
|
-
label: "Sombra",
|
|
156
|
+
label: "Sombra da Imagem",
|
|
159
157
|
inputType: "select",
|
|
160
158
|
options: [
|
|
161
|
-
{ value: "none", label: "
|
|
159
|
+
{ value: "none", label: "Nenhuma" },
|
|
162
160
|
{ value: "sm", label: "Pequena" },
|
|
163
161
|
{ value: "md", label: "Média" },
|
|
164
162
|
{ value: "lg", label: "Grande" },
|
|
165
|
-
{ value: "xl", label: "Extra
|
|
163
|
+
{ value: "xl", label: "Extra Grande" }
|
|
166
164
|
],
|
|
167
165
|
group: "Aparência"
|
|
168
166
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageGallery.js","sources":["../../../../../src/engine/registry/blocks/sections/imageGallery.ts"],"sourcesContent":["import { BlockDefinition } from \"../../types\";\nimport { componentRegistry } from \"../../registry\";\nimport type { ImageGalleryBlock } from \"../../../schema/siteDocument\";\nimport { galleryVariations } from \"../../../presets/galleryVariations\";\n\n/**\n * Valores padrão do ImageGallery - Use para garantir consistência em templates e factories\n */\nexport const IMAGE_GALLERY_DEFAULT_PROPS: ImageGalleryBlock[\"props\"] = {\n // Conteúdo\n title: \"Nossa Galeria\",\n subtitle: \"Confira nossas imagens\",\n images: [\n {\n id: \"1\",\n src: \"https://placehold.co/800x600/3b82f6/ffffff?text=Image+1\",\n alt: \"Imagem de demonstração 1\",\n title: \"Projeto 1\",\n description: \"Descrição da primeira imagem\",\n },\n {\n id: \"2\",\n src: \"https://placehold.co/800x600/8b5cf6/ffffff?text=Image+2\",\n alt: \"Imagem de demonstração 2\",\n title: \"Projeto 2\",\n description: \"Descrição da segunda imagem\",\n },\n {\n id: \"3\",\n src: \"https://placehold.co/800x600/ec4899/ffffff?text=Image+3\",\n alt: \"Imagem de demonstração 3\",\n title: \"Projeto 3\",\n description: \"Descrição da terceira imagem\",\n },\n {\n id: \"4\",\n src: \"https://placehold.co/800x600/10b981/ffffff?text=Image+4\",\n alt: \"Imagem de demonstração 4\",\n title: \"Projeto 4\",\n description: \"Descrição da quarta imagem\",\n },\n ],\n\n // Layout\n variation: \"gallery-grid\",\n columns: 4,\n gap: 1,\n aspectRatio: \"auto\",\n\n // Aparência\n imageBorderRadius: 8,\n imageShadow: \"md\",\n\n // Animações\n enterAnimation: \"fade-scale\",\n hoverEffect: \"zoom-overlay\",\n hoverIntensity: 50,\n\n // Lightbox\n lightbox: {\n mode: \"adaptive\",\n showArrows: true,\n showThumbnails: true,\n showCounter: true,\n showCaption: true,\n enableZoom: true,\n enableDownload: false,\n enableAutoplay: false,\n autoplayInterval: 5,\n closeOnBackdropClick: true,\n closeOnEsc: true,\n enableKeyboard: true,\n enableTouchGestures: true,\n transitionDuration: 300,\n },\n\n // Performance\n lazyLoad: true,\n showWarningAt: 50,\n};\n\nexport const imageGalleryBlock: BlockDefinition<\"imageGallery\"> = {\n type: \"imageGallery\",\n name: \"Galeria de Imagens\",\n description: \"Galeria de imagens com lightbox profissional e zoom\",\n category: \"sections\",\n canHaveChildren: false,\n defaultProps: IMAGE_GALLERY_DEFAULT_PROPS,\n variations: Object.values(galleryVariations),\n\n inspectorMeta: {\n // =========================================================================\n // GRUPO: Conteúdo\n // =========================================================================\n title: {\n label: \"Título\",\n inputType: \"text\",\n group: \"Conteúdo\",\n },\n subtitle: {\n label: \"Subtítulo\",\n inputType: \"text\",\n group: \"Conteúdo\",\n },\n images: {\n label: \"Imagens\",\n inputType: \"gallery-images\",\n group: \"Conteúdo\",\n description: \"Gerencie as imagens da galeria\",\n },\n\n // =========================================================================\n // GRUPO: Layout\n // =========================================================================\n variation: {\n label: \"Layout\",\n inputType: \"select\",\n options: [\n { value: \"gallery-grid\", label: \"Grid Clássico\" },\n { value: \"gallery-masonry\", label: \"Masonry (v1.1)\" },\n { value: \"gallery-featured\", label: \"Destaque (v1.2)\" },\n { value: \"gallery-carousel\", label: \"Carrossel (v1.3)\" },\n { value: \"gallery-alternating\", label: \"Alternado (v1.4)\" },\n ],\n group: \"Layout\",\n },\n columns: {\n label: \"Colunas\",\n inputType: \"number\",\n min: 2,\n max: 4,\n group: \"Layout\",\n description: \"Número de colunas no desktop\",\n },\n gap: {\n label: \"Espaçamento\",\n inputType: \"number\",\n min: 0,\n max: 3,\n step: 0.5,\n group: \"Layout\",\n description: \"Espaçamento entre imagens (rem)\",\n },\n aspectRatio: {\n label: \"Proporção\",\n inputType: \"select\",\n options: [\n { value: \"auto\", label: \"Original\" },\n { value: \"1/1\", label: \"Quadrado (1:1)\" },\n { value: \"4/3\", label: \"Paisagem (4:3)\" },\n { value: \"16/9\", label: \"Widescreen (16:9)\" },\n { value: \"3/2\", label: \"Clássico (3:2)\" },\n ],\n group: \"Layout\",\n },\n\n // =========================================================================\n // GRUPO: Aparência\n // =========================================================================\n bg: {\n label: \"Cor de Fundo\",\n inputType: \"color\",\n group: \"Aparência\",\n },\n imageBorderRadius: {\n label: \"Borda Arredondada\",\n inputType: \"number\",\n min: 0,\n max: 32,\n group: \"Aparência\",\n description: \"Arredondamento das imagens (px)\",\n },\n imageShadow: {\n label: \"Sombra\",\n inputType: \"select\",\n options: [\n { value: \"none\", label: \"Sem sombra\" },\n { value: \"sm\", label: \"Pequena\" },\n { value: \"md\", label: \"Média\" },\n { value: \"lg\", label: \"Grande\" },\n { value: \"xl\", label: \"Extra grande\" },\n ],\n group: \"Aparência\",\n },\n\n // =========================================================================\n // GRUPO: Animações\n // =========================================================================\n enterAnimation: {\n label: \"Animação de Entrada\",\n inputType: \"select\",\n options: [\n { value: \"fade-scale\", label: \"Fade + Zoom\" },\n { value: \"stagger\", label: \"Cascata\" },\n { value: \"slide-up\", label: \"Desliza de Baixo\" },\n { value: \"none\", label: \"Sem animação\" },\n ],\n group: \"Animações\",\n },\n hoverEffect: {\n label: \"Efeito de Hover\",\n inputType: \"select\",\n options: [\n { value: \"zoom-overlay\", label: \"Zoom + Overlay\" },\n { value: \"glow\", label: \"Brilho\" },\n { value: \"scale\", label: \"Aumentar\" },\n { value: \"caption-reveal\", label: \"Revelar Legenda\" },\n { value: \"none\", label: \"Sem efeito\" },\n ],\n group: \"Animações\",\n },\n hoverIntensity: {\n label: \"Intensidade do Hover\",\n inputType: \"number\",\n min: 0,\n max: 100,\n group: \"Animações\",\n description: \"Intensidade do efeito (0-100%)\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Tema\n // =========================================================================\n \"lightbox.mode\": {\n label: \"Tema do Lightbox\",\n inputType: \"select\",\n options: [\n { value: \"adaptive\", label: \"Adaptável (Auto)\" },\n { value: \"dark\", label: \"Escuro\" },\n { value: \"light\", label: \"Claro\" },\n { value: \"theme\", label: \"Seguir Tema do Site\" },\n ],\n group: \"Lightbox - Tema\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Navegação\n // =========================================================================\n \"lightbox.showArrows\": {\n label: \"Mostrar Setas\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n \"lightbox.showThumbnails\": {\n label: \"Mostrar Miniaturas\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n \"lightbox.showCounter\": {\n label: \"Mostrar Contador\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n description: 'Exibe \"3 de 12\"',\n },\n \"lightbox.showCaption\": {\n label: \"Mostrar Legenda\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Funcionalidades\n // =========================================================================\n \"lightbox.enableZoom\": {\n label: \"Ativar Zoom\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.enableDownload\": {\n label: \"Ativar Download\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Permitir download de imagens (v1.1)\",\n },\n \"lightbox.enableAutoplay\": {\n label: \"Ativar Autoplay\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Reprodução automática (v1.3)\",\n },\n \"lightbox.autoplayInterval\": {\n label: \"Intervalo do Autoplay\",\n inputType: \"number\",\n min: 2,\n max: 10,\n group: \"Lightbox - Funcionalidades\",\n description: \"Intervalo em segundos\",\n },\n \"lightbox.closeOnBackdropClick\": {\n label: \"Fechar ao Clicar Fora\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.closeOnEsc\": {\n label: \"Fechar com ESC\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.enableKeyboard\": {\n label: \"Navegação por Teclado\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Arrows, +, -, 0\",\n },\n \"lightbox.enableTouchGestures\": {\n label: \"Gestos Touch\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Swipe, pinch, double-tap\",\n },\n \"lightbox.transitionDuration\": {\n label: \"Duração da Transição\",\n inputType: \"number\",\n min: 100,\n max: 1000,\n step: 50,\n group: \"Lightbox - Funcionalidades\",\n description: \"Velocidade da animação (ms)\",\n },\n\n // =========================================================================\n // GRUPO: Performance\n // =========================================================================\n lazyLoad: {\n label: \"Lazy Loading\",\n inputType: \"checkbox\",\n group: \"Performance\",\n description: \"Carregar imagens sob demanda\",\n },\n showWarningAt: {\n label: \"Aviso de Performance\",\n inputType: \"number\",\n min: 20,\n max: 100,\n group: \"Performance\",\n description: \"Mostrar alerta após N imagens\",\n },\n },\n};\n\n// Register the block\ncomponentRegistry.register(imageGalleryBlock);\n\nexport default imageGalleryBlock;\n"],"names":["IMAGE_GALLERY_DEFAULT_PROPS","imageGalleryBlock","galleryVariations","componentRegistry"],"mappings":";;AAQO,MAAMA,IAA0D;AAAA;AAAA,EAErE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,IACN;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,EACf;AAAA;AAAA,EAIF,WAAW;AAAA,EACX,SAAS;AAAA,EACT,KAAK;AAAA,EACL,aAAa;AAAA;AAAA,EAGb,mBAAmB;AAAA,EACnB,aAAa;AAAA;AAAA,EAGb,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,gBAAgB;AAAA;AAAA,EAGhB,UAAU;AAAA,IACR,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,gBAAgB;AAA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ks/sections/imageGallery.ts"],"sourcesContent":["import { BlockDefinition } from \"../../types\";\nimport { componentRegistry } from \"../../registry\";\nimport type { ImageGalleryBlock } from \"../../../schema/siteDocument\";\nimport { galleryVariations } from \"../../../presets/galleryVariations\";\n\n/**\n * Valores padrão do ImageGallery - Use para garantir consistência em templates e factories\n */\nexport const IMAGE_GALLERY_DEFAULT_PROPS: ImageGalleryBlock[\"props\"] = {\n // Conteúdo\n title: \"Nossa Galeria\",\n subtitle: \"Confira nossas imagens\",\n images: [\n {\n id: \"1\",\n src: \"https://placehold.co/800x600/3b82f6/ffffff?text=Image+1\",\n alt: \"Imagem de demonstração 1\",\n title: \"Projeto 1\",\n description: \"Descrição da primeira imagem\",\n },\n {\n id: \"2\",\n src: \"https://placehold.co/800x600/8b5cf6/ffffff?text=Image+2\",\n alt: \"Imagem de demonstração 2\",\n title: \"Projeto 2\",\n description: \"Descrição da segunda imagem\",\n },\n {\n id: \"3\",\n src: \"https://placehold.co/800x600/ec4899/ffffff?text=Image+3\",\n alt: \"Imagem de demonstração 3\",\n title: \"Projeto 3\",\n description: \"Descrição da terceira imagem\",\n },\n {\n id: \"4\",\n src: \"https://placehold.co/800x600/10b981/ffffff?text=Image+4\",\n alt: \"Imagem de demonstração 4\",\n title: \"Projeto 4\",\n description: \"Descrição da quarta imagem\",\n },\n ],\n\n // Layout\n variation: \"gallery-grid\",\n columns: 4,\n gap: 1,\n aspectRatio: \"auto\",\n\n // Aparência\n imageBorderRadius: 8,\n imageShadow: \"md\",\n\n // Animações\n enterAnimation: \"fade-scale\",\n hoverEffect: \"zoom-overlay\",\n hoverIntensity: 50,\n\n // Lightbox\n lightbox: {\n mode: \"adaptive\",\n showArrows: true,\n showThumbnails: true,\n showCounter: true,\n showCaption: true,\n enableZoom: true,\n enableDownload: false,\n enableAutoplay: false,\n autoplayInterval: 5,\n closeOnBackdropClick: true,\n closeOnEsc: true,\n enableKeyboard: true,\n enableTouchGestures: true,\n transitionDuration: 300,\n },\n\n // Performance\n lazyLoad: true,\n showWarningAt: 50,\n};\n\nexport const imageGalleryBlock: BlockDefinition<\"imageGallery\"> = {\n type: \"imageGallery\",\n name: \"Galeria de Imagens\",\n description: \"Galeria de imagens com lightbox profissional e zoom\",\n category: \"sections\",\n canHaveChildren: false,\n defaultProps: IMAGE_GALLERY_DEFAULT_PROPS,\n variations: Object.values(galleryVariations),\n\n inspectorMeta: {\n // =========================================================================\n // GRUPO: Conteúdo\n // =========================================================================\n title: {\n label: \"Título\",\n inputType: \"text\",\n group: \"Conteúdo\",\n },\n subtitle: {\n label: \"Subtítulo\",\n inputType: \"text\",\n group: \"Conteúdo\",\n },\n // Note: \"images\" field is hidden because there's no modal UI for it yet.\n // Users add images via defaultProps or programmatically.\n // The gallery-images input type exists but shows confusing \"[object Object]...\" text.\n // Will be re-enabled when GalleryImagesInput modal component is implemented.\n\n // =========================================================================\n // GRUPO: Layout\n // =========================================================================\n variation: {\n label: \"Layout\",\n inputType: \"select\",\n options: [\n { value: \"gallery-grid\", label: \"Grid Clássico\" },\n { value: \"gallery-masonry\", label: \"Masonry (v1.1)\" },\n { value: \"gallery-featured\", label: \"Destaque (v1.2)\" },\n { value: \"gallery-carousel\", label: \"Carrossel (v1.3)\" },\n { value: \"gallery-alternating\", label: \"Alternado (v1.4)\" },\n ],\n group: \"Layout\",\n },\n columns: {\n label: \"Colunas\",\n inputType: \"number\",\n min: 2,\n max: 12,\n group: \"Layout\",\n description: \"Número de colunas no desktop (responsivo: 4→3→2→1)\",\n },\n gap: {\n label: \"Espaçamento (rem)\",\n inputType: \"number\",\n min: 0,\n max: 5,\n step: 0.5,\n group: \"Layout\",\n description: \"Espaçamento entre imagens (0 = sem espaço)\",\n },\n aspectRatio: {\n label: \"Proporção\",\n inputType: \"select\",\n options: [\n { value: \"auto\", label: \"Original\" },\n { value: \"1/1\", label: \"Quadrado (1:1)\" },\n { value: \"4/3\", label: \"Paisagem (4:3)\" },\n { value: \"16/9\", label: \"Widescreen (16:9)\" },\n { value: \"3/2\", label: \"Clássico (3:2)\" },\n ],\n group: \"Layout\",\n },\n\n // =========================================================================\n // GRUPO: Aparência\n // =========================================================================\n bg: {\n label: \"Cor de Fundo\",\n inputType: \"color\",\n group: \"Aparência\",\n },\n imageBorderRadius: {\n label: \"Borda Arredondada\",\n inputType: \"number\",\n min: 0,\n max: 32,\n group: \"Aparência\",\n description: \"Arredondamento das imagens (px)\",\n },\n imageShadow: {\n label: \"Sombra da Imagem\",\n inputType: \"select\",\n options: [\n { value: \"none\", label: \"Nenhuma\" },\n { value: \"sm\", label: \"Pequena\" },\n { value: \"md\", label: \"Média\" },\n { value: \"lg\", label: \"Grande\" },\n { value: \"xl\", label: \"Extra Grande\" },\n ],\n group: \"Aparência\",\n },\n\n // =========================================================================\n // GRUPO: Animações\n // =========================================================================\n enterAnimation: {\n label: \"Animação de Entrada\",\n inputType: \"select\",\n options: [\n { value: \"fade-scale\", label: \"Fade + Zoom\" },\n { value: \"stagger\", label: \"Cascata\" },\n { value: \"slide-up\", label: \"Desliza de Baixo\" },\n { value: \"none\", label: \"Sem animação\" },\n ],\n group: \"Animações\",\n },\n hoverEffect: {\n label: \"Efeito de Hover\",\n inputType: \"select\",\n options: [\n { value: \"zoom-overlay\", label: \"Zoom + Overlay\" },\n { value: \"glow\", label: \"Brilho\" },\n { value: \"scale\", label: \"Aumentar\" },\n { value: \"caption-reveal\", label: \"Revelar Legenda\" },\n { value: \"none\", label: \"Sem efeito\" },\n ],\n group: \"Animações\",\n },\n hoverIntensity: {\n label: \"Intensidade do Hover\",\n inputType: \"number\",\n min: 0,\n max: 100,\n group: \"Animações\",\n description: \"Intensidade do efeito (0-100%)\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Tema\n // =========================================================================\n \"lightbox.mode\": {\n label: \"Tema do Lightbox\",\n inputType: \"select\",\n options: [\n { value: \"adaptive\", label: \"Adaptável (Auto)\" },\n { value: \"dark\", label: \"Escuro\" },\n { value: \"light\", label: \"Claro\" },\n { value: \"theme\", label: \"Seguir Tema do Site\" },\n ],\n group: \"Lightbox - Tema\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Navegação\n // =========================================================================\n \"lightbox.showArrows\": {\n label: \"Mostrar Setas\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n \"lightbox.showThumbnails\": {\n label: \"Mostrar Miniaturas\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n \"lightbox.showCounter\": {\n label: \"Mostrar Contador\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n description: 'Exibe \"3 de 12\"',\n },\n \"lightbox.showCaption\": {\n label: \"Mostrar Legenda\",\n inputType: \"checkbox\",\n group: \"Lightbox - Navegação\",\n },\n\n // =========================================================================\n // GRUPO: Lightbox - Funcionalidades\n // =========================================================================\n \"lightbox.enableZoom\": {\n label: \"Ativar Zoom\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.enableDownload\": {\n label: \"Ativar Download\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Permitir download de imagens (v1.1)\",\n },\n \"lightbox.enableAutoplay\": {\n label: \"Ativar Autoplay\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Reprodução automática (v1.3)\",\n },\n \"lightbox.autoplayInterval\": {\n label: \"Intervalo do Autoplay\",\n inputType: \"number\",\n min: 2,\n max: 10,\n group: \"Lightbox - Funcionalidades\",\n description: \"Intervalo em segundos\",\n },\n \"lightbox.closeOnBackdropClick\": {\n label: \"Fechar ao Clicar Fora\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.closeOnEsc\": {\n label: \"Fechar com ESC\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n },\n \"lightbox.enableKeyboard\": {\n label: \"Navegação por Teclado\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Arrows, +, -, 0\",\n },\n \"lightbox.enableTouchGestures\": {\n label: \"Gestos Touch\",\n inputType: \"checkbox\",\n group: \"Lightbox - Funcionalidades\",\n description: \"Swipe, pinch, double-tap\",\n },\n \"lightbox.transitionDuration\": {\n label: \"Duração da Transição\",\n inputType: \"number\",\n min: 100,\n max: 1000,\n step: 50,\n group: \"Lightbox - Funcionalidades\",\n description: \"Velocidade da animação (ms)\",\n },\n\n // =========================================================================\n // GRUPO: Performance\n // =========================================================================\n lazyLoad: {\n label: \"Lazy Loading\",\n inputType: \"checkbox\",\n group: \"Performance\",\n description: \"Carregar imagens sob demanda\",\n },\n showWarningAt: {\n label: \"Aviso de Performance\",\n inputType: \"number\",\n min: 20,\n max: 100,\n group: \"Performance\",\n description: \"Mostrar alerta após N imagens\",\n },\n },\n};\n\n// Register the block\ncomponentRegistry.register(imageGalleryBlock);\n\nexport default imageGalleryBlock;\n"],"names":["IMAGE_GALLERY_DEFAULT_PROPS","imageGalleryBlock","galleryVariations","componentRegistry"],"mappings":";;AAQO,MAAMA,IAA0D;AAAA;AAAA,EAErE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,IACN;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,IAAI;AAAA,MACJ,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,EACf;AAAA;AAAA,EAIF,WAAW;AAAA,EACX,SAAS;AAAA,EACT,KAAK;AAAA,EACL,aAAa;AAAA;AAAA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