@brunoalz/smartgesti-site-editor 1.3.0 → 1.4.0

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.
Files changed (53) hide show
  1. package/dist/editor/LandingPageEditor.d.ts.map +1 -1
  2. package/dist/editor/LandingPageEditor.js +183 -169
  3. package/dist/editor/LandingPageEditor.js.map +1 -1
  4. package/dist/editor/PaletteSelector.d.ts +3 -0
  5. package/dist/editor/PaletteSelector.d.ts.map +1 -1
  6. package/dist/editor/PaletteSelector.js +114 -25
  7. package/dist/editor/PaletteSelector.js.map +1 -1
  8. package/dist/editor/components/RightPanel.d.ts +2 -0
  9. package/dist/editor/components/RightPanel.d.ts.map +1 -1
  10. package/dist/editor/components/RightPanel.js +23 -22
  11. package/dist/editor/components/RightPanel.js.map +1 -1
  12. package/dist/engine/export/exporters/content/AvatarExporter.js +2 -2
  13. package/dist/engine/export/exporters/content/AvatarExporter.js.map +1 -1
  14. package/dist/engine/export/exporters/content/BadgeExporter.js +11 -11
  15. package/dist/engine/export/exporters/content/BadgeExporter.js.map +1 -1
  16. package/dist/engine/export/exporters/sections/AdminSectionExporters.js +17 -17
  17. package/dist/engine/export/exporters/sections/AdminSectionExporters.js.map +1 -1
  18. package/dist/engine/export/exporters/sections/BlogPostExporters.js +34 -34
  19. package/dist/engine/export/exporters/sections/BlogPostExporters.js.map +1 -1
  20. package/dist/engine/export/exporters/sections/ContentGridExporters.js +16 -16
  21. package/dist/engine/export/exporters/sections/ContentGridExporters.js.map +1 -1
  22. package/dist/engine/export/exporters/sections/MarketingExporters.js +4 -4
  23. package/dist/engine/export/exporters/sections/MarketingExporters.js.map +1 -1
  24. package/dist/engine/render/renderers/content/BadgeRenderer.js +12 -12
  25. package/dist/engine/render/renderers/content/BadgeRenderer.js.map +1 -1
  26. package/dist/engine/render/renderers/sections/AboutSectionRenderer.js +8 -8
  27. package/dist/engine/render/renderers/sections/AboutSectionRenderer.js.map +1 -1
  28. package/dist/engine/render/renderers/sections/ContactSectionRenderer.js +52 -52
  29. package/dist/engine/render/renderers/sections/ContactSectionRenderer.js.map +1 -1
  30. package/dist/engine/render/renderers/sections/FeatureGridRenderer.js +5 -5
  31. package/dist/engine/render/renderers/sections/FeatureGridRenderer.js.map +1 -1
  32. package/dist/engine/render/renderers/sections/FeatureRenderer.js +9 -9
  33. package/dist/engine/render/renderers/sections/FeatureRenderer.js.map +1 -1
  34. package/dist/engine/render/renderers/sections/PricingCardRenderer.js +5 -5
  35. package/dist/engine/render/renderers/sections/PricingCardRenderer.js.map +1 -1
  36. package/dist/engine/render/renderers/sections/ProductShowcaseRenderer.js +17 -17
  37. package/dist/engine/render/renderers/sections/ProductShowcaseRenderer.js.map +1 -1
  38. package/dist/hooks/useEditorState.d.ts +2 -0
  39. package/dist/hooks/useEditorState.d.ts.map +1 -1
  40. package/dist/hooks/useEditorState.js +82 -77
  41. package/dist/hooks/useEditorState.js.map +1 -1
  42. package/dist/shared/templates/index.d.ts +4 -0
  43. package/dist/shared/templates/index.d.ts.map +1 -1
  44. package/dist/shared/templates/index.js +14 -7
  45. package/dist/shared/templates/index.js.map +1 -1
  46. package/dist/shared/templates/smartgesti-admin.d.ts.map +1 -1
  47. package/dist/shared/templates/smartgesti-admin.js +1 -4
  48. package/dist/shared/templates/smartgesti-admin.js.map +1 -1
  49. package/dist/utils/colorUtils.d.ts +73 -16
  50. package/dist/utils/colorUtils.d.ts.map +1 -1
  51. package/dist/utils/colorUtils.js +95 -9
  52. package/dist/utils/colorUtils.js.map +1 -1
  53. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LandingPageEditor.d.ts","sourceRoot":"","sources":["../../src/editor/LandingPageEditor.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,YAAY,EAAuB,MAAM,WAAW,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAWtD,MAAM,WAAW,YAAY;IAC3B,QAAQ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AAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAMD,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,YAAY,GACb,EAAE,sBAAsB,2CAqUxB"}
@@ -1,251 +1,265 @@
1
- import { jsx as i, jsxs as G } from "react/jsx-runtime";
2
- import { useState as y, useCallback as P, useEffect as F } from "react";
3
- import { TemplatePicker as ie } from "./TemplatePicker.js";
4
- import { useEditorState as de } from "../hooks/useEditorState.js";
5
- import { useKeyboardShortcuts as fe } from "../hooks/useKeyboardShortcuts.js";
6
- import { getTemplate as H } from "../shared/templates/index.js";
1
+ import { jsx as p, jsxs as j } from "react/jsx-runtime";
2
+ import { useState as k, useCallback as P, useEffect as H } from "react";
3
+ import { TemplatePicker as ce } from "./TemplatePicker.js";
4
+ import { useEditorState as ie } from "../hooks/useEditorState.js";
5
+ import { useKeyboardShortcuts as pe } from "../hooks/useKeyboardShortcuts.js";
6
+ import { getTemplate as A, templateDefaultPalette as F } from "../shared/templates/index.js";
7
+ import { findPaletteByName as de } from "./PaletteSelector.js";
7
8
  import { sharedTemplateToEngineDocument as K } from "../utils/sharedTemplateToEngine.js";
8
9
  import { findBlockInStructure as ue } from "../utils/blockUtils.js";
9
- import { isLightColor as M } from "../utils/colorUtils.js";
10
- import { logger as B } from "../utils/logger.js";
10
+ import { derivePaletteColors as he } from "../utils/colorUtils.js";
11
+ import { logger as x } from "../utils/logger.js";
11
12
  import { processBlockDataURLs as me } from "../utils/dataURLUtils.js";
12
- import { Toolbar as pe } from "./components/Toolbar.js";
13
- import { LeftPanel as he } from "./components/LeftPanel.js";
14
- import { CenterPanel as ge } from "./components/CenterPanel.js";
15
- import { RightPanel as ve } from "./components/RightPanel.js";
16
- import { PatchBuilder as ke } from "../engine/patch/PatchBuilder.js";
17
- function Ne({
18
- initialData: W,
19
- defaultTemplateId: b,
13
+ import { Toolbar as fe } from "./components/Toolbar.js";
14
+ import { LeftPanel as ge } from "./components/LeftPanel.js";
15
+ import { CenterPanel as ve } from "./components/CenterPanel.js";
16
+ import { RightPanel as ke } from "./components/RightPanel.js";
17
+ import { PatchBuilder as Pe } from "../engine/patch/PatchBuilder.js";
18
+ function Oe({
19
+ initialData: M,
20
+ defaultTemplateId: C,
20
21
  onSave: w,
21
- onPublish: x,
22
- uploadConfig: C
22
+ onPublish: y,
23
+ uploadConfig: b
23
24
  }) {
24
25
  const {
25
- document: o,
26
- currentPageId: T,
26
+ document: t,
27
+ currentPageId: $,
27
28
  currentPage: d,
28
- selectedBlockId: m,
29
- selectedBlock: q,
30
- history: z,
31
- setCurrentPageId: p,
32
- addPage: J,
33
- removePage: Q,
34
- canRemovePage: V,
35
- setSelectedBlockId: s,
29
+ selectedBlockId: h,
30
+ selectedBlock: V,
31
+ history: W,
32
+ setCurrentPageId: m,
33
+ addPage: q,
34
+ removePage: z,
35
+ canRemovePage: J,
36
+ setSelectedBlockId: c,
36
37
  handleUndo: D,
37
- handleRedo: L,
38
- handleDeleteBlock: U,
39
- handleUpdateBlock: X,
40
- applyChange: h,
41
- resetToTemplate: Y,
42
- isPaletteSelected: E,
38
+ handleRedo: T,
39
+ handleDeleteBlock: E,
40
+ handleUpdateBlock: Q,
41
+ applyChange: f,
42
+ resetToTemplate: X,
43
+ isPaletteSelected: U,
43
44
  loadDocument: S,
44
- activePlugins: Z,
45
- activatePlugin: _,
46
- deactivatePlugin: ee
47
- } = de({ initialData: W }), [oe, g] = y(!1), [I, re] = y(
45
+ selectedPalette: I,
46
+ setSelectedPalette: u,
47
+ activePlugins: Y,
48
+ activatePlugin: Z,
49
+ deactivatePlugin: _
50
+ } = ie({ initialData: M }), [ee, g] = k(!1), [B, oe] = k(
48
51
  null
49
- ), [R, $] = y(null), [N, te] = y(!1), O = P(
52
+ ), [L, R] = k(null), [N, te] = k(!1), G = P(
50
53
  (e) => {
51
- const r = H(e);
52
- if (!r) return;
53
- const t = K(r);
54
- S(t), re(e);
54
+ const o = A(e);
55
+ if (!o) return;
56
+ const r = K(o);
57
+ S(r), oe(e);
58
+ const a = F[e];
59
+ a && u(a);
55
60
  },
56
- [S]
61
+ [S, u]
57
62
  );
58
- F(() => {
59
- !o && b && O(b);
60
- }, [b]);
61
- const j = async () => {
62
- if (!(!o || !w || !C)) {
63
+ H(() => {
64
+ !t && C && G(C);
65
+ }, [C]);
66
+ const O = async () => {
67
+ if (!(!t || !w || !b)) {
63
68
  g(!0);
64
69
  try {
65
70
  const e = await Promise.all(
66
- (o.pages || []).map(async (t) => ({
67
- ...t,
71
+ (t.pages || []).map(async (r) => ({
72
+ ...r,
68
73
  structure: await Promise.all(
69
- (t.structure || []).map((n) => me(n, C))
74
+ (r.structure || []).map((a) => me(a, b))
70
75
  )
71
76
  }))
72
- ), r = {
73
- ...o,
77
+ ), o = {
78
+ ...t,
74
79
  pages: e
75
80
  };
76
- await w(r);
81
+ await w(o);
77
82
  } catch (e) {
78
- throw B.error("Error saving:", e), e;
83
+ throw x.error("Error saving:", e), e;
79
84
  } finally {
80
85
  g(!1);
81
86
  }
82
87
  }
83
- }, ne = async () => {
84
- if (!(!o || !x)) {
88
+ }, re = async () => {
89
+ if (!(!t || !y)) {
85
90
  g(!0);
86
91
  try {
87
- await x(o);
92
+ await y(t);
88
93
  } catch (e) {
89
- B.error("Error publishing:", e);
94
+ x.error("Error publishing:", e);
90
95
  } finally {
91
96
  g(!1);
92
97
  }
93
98
  }
94
99
  }, ae = P(
95
- (e, r) => {
96
- if (!o || !d) return;
97
- const t = d.id;
98
- if (t)
100
+ (e, o) => {
101
+ if (!t || !d) return;
102
+ const r = d.id;
103
+ if (r)
99
104
  try {
100
- const n = ke.updateBlockProps(
101
- o,
105
+ const a = Pe.updateBlockProps(
102
106
  t,
107
+ r,
103
108
  e,
104
- r
109
+ o
105
110
  );
106
- n?.length && h(n, "Update block properties");
107
- } catch (n) {
108
- B.error("Error updating block:", n);
111
+ a?.length && f(a, "Update block properties");
112
+ } catch (a) {
113
+ x.error("Error updating block:", a);
109
114
  }
110
115
  },
111
- [o, d, h]
112
- ), ce = P((e) => {
113
- if (!o) return;
114
- const r = M(e.background ?? "#ffffff"), t = M(e.primary ?? "#3b82f6"), n = r ? "#6b7280" : "#9ca3af", c = t ? "#1f2937" : "#ffffff", a = e.menuLinkColor || e.primary, f = [], A = o.theme.colors, le = {
115
- primary: e.primary,
116
- secondary: e.secondary,
117
- accent: e.accent,
118
- bg: e.background,
119
- surface: e.surface || A.surface || "#f8fafc",
120
- text: e.text || A.text || "#1e293b",
121
- mutedText: n,
122
- primaryText: c,
123
- linkColor: e.linkColor || e.primary,
124
- menuLinkColor: a
125
- };
126
- for (const [l, u] of Object.entries(le))
127
- f.push({ op: "replace", path: `/theme/colors/${l}`, value: u });
128
- for (let l = 0; l < o.pages.length; l++) {
129
- const u = o.pages[l];
130
- if (u?.structure) {
131
- for (let v = 0; v < u.structure.length; v++)
132
- if (u.structure[v].type === "navbar") {
133
- const k = `/pages/${l}/structure/${v}/props`;
134
- f.push(
135
- { op: "replace", path: `${k}/linkColor`, value: a },
136
- { op: "replace", path: `${k}/linkHoverColor`, value: e.primary },
137
- { op: "replace", path: `${k}/buttonColor`, value: e.primary },
138
- { op: "replace", path: `${k}/buttonTextColor`, value: c }
116
+ [t, d, f]
117
+ ), le = P((e) => {
118
+ if (!t) return;
119
+ const o = he(e), r = [];
120
+ for (const [l, n] of Object.entries(o.themeColors))
121
+ r.push({ op: "replace", path: `/theme/colors/${l}`, value: n });
122
+ const a = /* @__PURE__ */ new Set([
123
+ "hero-gradient",
124
+ "hero-parallax",
125
+ "hero-overlay",
126
+ "hero-carousel"
127
+ ]);
128
+ for (let l = 0; l < t.pages.length; l++) {
129
+ const n = t.pages[l];
130
+ if (n?.structure)
131
+ for (let i = 0; i < n.structure.length; i++) {
132
+ const v = n.structure[i], s = `/pages/${l}/structure/${i}/props`;
133
+ if (v.type === "hero") {
134
+ const se = v.props?.variation || "";
135
+ a.has(se) && r.push(
136
+ { op: "replace", path: `${s}/background`, value: `linear-gradient(135deg, ${o.heroGradientStart} 0%, ${o.heroGradientEnd} 100%)` },
137
+ { op: "replace", path: `${s}/titleColor`, value: o.heroTitleColor },
138
+ { op: "replace", path: `${s}/subtitleColor`, value: o.heroSubtitleColor },
139
+ { op: "replace", path: `${s}/descriptionColor`, value: o.heroDescColor }
139
140
  );
140
- }
141
- }
141
+ } else v.type === "navbar" ? r.push(
142
+ { op: "replace", path: `${s}/bg`, value: o.navbarBg },
143
+ { op: "replace", path: `${s}/linkColor`, value: o.themeColors.menuLinkColor },
144
+ { op: "replace", path: `${s}/linkHoverColor`, value: o.themeColors.primary },
145
+ { op: "replace", path: `${s}/buttonColor`, value: o.themeColors.primary },
146
+ { op: "replace", path: `${s}/buttonTextColor`, value: o.themeColors.primaryText }
147
+ ) : v.type === "footer" && r.push(
148
+ { op: "replace", path: `${s}/linkHoverColor`, value: o.footerLinkHover }
149
+ );
150
+ }
142
151
  }
143
- h(f, "Update color palette");
144
- }, [o, h]), se = P((e, r) => {
145
- s(e), $(r || null);
146
- }, [s]);
147
- return fe({
152
+ f(r, "Update color palette"), u(e.name ?? null);
153
+ }, [t, f, u]), ne = P((e, o) => {
154
+ c(e), R(o || null);
155
+ }, [c]);
156
+ return pe({
148
157
  onUndo: D,
149
- onRedo: L,
150
- onSave: j,
158
+ onRedo: T,
159
+ onSave: O,
151
160
  onDelete: () => {
152
- m && U(m);
161
+ h && E(h);
153
162
  },
154
- onDeselect: () => s(null)
155
- }), F(() => {
156
- const e = (r) => {
157
- if (r.data?.type !== "editor-navigate" || !r.data.href) return;
158
- const t = String(r.data.href);
159
- if (!o) return;
160
- const n = t.match(/^(?:\/site)?\/p\/([^#?]+)/);
161
- if (n) {
162
- const c = n[1], a = o.pages.find((f) => f.slug === c);
163
- a && p(a.id);
163
+ onDeselect: () => c(null)
164
+ }), H(() => {
165
+ const e = (o) => {
166
+ if (o.data?.type !== "editor-navigate" || !o.data.href) return;
167
+ const r = String(o.data.href);
168
+ if (!t) return;
169
+ const a = r.match(/^(?:\/site)?\/p\/([^#?]+)/);
170
+ if (a) {
171
+ const l = a[1], n = t.pages.find((i) => i.slug === l);
172
+ n && m(n.id);
164
173
  return;
165
174
  }
166
- if (t.startsWith("#")) {
167
- const c = t.slice(1);
168
- for (const a of o.pages)
169
- if (ue(a.structure || [], c)) {
170
- p(a.id), s(c);
175
+ if (r.startsWith("#")) {
176
+ const l = r.slice(1);
177
+ for (const n of t.pages)
178
+ if (ue(n.structure || [], l)) {
179
+ m(n.id), c(l);
171
180
  break;
172
181
  }
173
182
  }
174
183
  };
175
184
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
176
- }, [o, p, s]), o ? /* @__PURE__ */ G("div", { className: "h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden", children: [
177
- /* @__PURE__ */ i(
178
- pe,
185
+ }, [t, m, c]), t ? /* @__PURE__ */ j("div", { className: "h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden", children: [
186
+ /* @__PURE__ */ p(
187
+ fe,
179
188
  {
180
- history: z,
181
- isSaving: oe,
189
+ history: W,
190
+ isSaving: ee,
182
191
  onUndo: D,
183
- onRedo: L,
184
- onSave: j,
185
- onPublish: x ? ne : void 0,
186
- onReset: I ? () => {
187
- const e = H(I);
188
- e && S(K(e));
189
- } : Y,
192
+ onRedo: T,
193
+ onSave: O,
194
+ onPublish: y ? re : void 0,
195
+ onReset: B ? () => {
196
+ const e = A(B);
197
+ if (e) {
198
+ S(K(e));
199
+ const o = F[B];
200
+ o && u(o);
201
+ }
202
+ } : X,
190
203
  showSelectionOverlay: N,
191
204
  onToggleSelectionOverlay: () => te((e) => !e)
192
205
  }
193
206
  ),
194
- /* @__PURE__ */ G("div", { className: "flex-1 flex overflow-hidden min-h-0 max-h-full", children: [
195
- /* @__PURE__ */ i(
196
- he,
207
+ /* @__PURE__ */ j("div", { className: "flex-1 flex overflow-hidden min-h-0 max-h-full", children: [
208
+ /* @__PURE__ */ p(
209
+ ge,
197
210
  {
198
211
  currentPage: d,
199
- selectedBlockId: m,
200
- isPaletteSelected: E,
212
+ selectedBlockId: h,
213
+ isPaletteSelected: U,
201
214
  onSelectBlock: (e) => {
202
- s(e), $(null);
215
+ c(e), R(null);
203
216
  },
204
- onDeleteBlock: U
217
+ onDeleteBlock: E
205
218
  }
206
219
  ),
207
- /* @__PURE__ */ i(
208
- ge,
220
+ /* @__PURE__ */ p(
221
+ ve,
209
222
  {
210
- document: o,
211
- currentPageId: T,
223
+ document: t,
224
+ currentPageId: $,
212
225
  currentPage: d,
213
- selectedBlockId: m,
214
- onBlockClick: se,
215
- onSelectPage: p,
226
+ selectedBlockId: h,
227
+ onBlockClick: ne,
228
+ onSelectPage: m,
216
229
  onAddPage: () => {
217
230
  const e = prompt("Nome da página:");
218
231
  if (!e) return;
219
- const r = e.toLowerCase().replace(/\s+/g, "-");
220
- J(r, e, r);
232
+ const o = e.toLowerCase().replace(/\s+/g, "-");
233
+ q(o, e, o);
221
234
  },
222
- onRemovePage: Q,
223
- canRemovePage: V,
235
+ onRemovePage: z,
236
+ canRemovePage: J,
224
237
  onUpdateBlock: ae,
225
- activePlugins: Z,
226
- onActivatePlugin: _,
227
- onDeactivatePlugin: ee,
238
+ activePlugins: Y,
239
+ onActivatePlugin: Z,
240
+ onDeactivatePlugin: _,
228
241
  showSelectionOverlay: N,
229
- focusedGroup: R
242
+ focusedGroup: L
230
243
  }
231
244
  ),
232
- /* @__PURE__ */ i(
233
- ve,
245
+ /* @__PURE__ */ p(
246
+ ke,
234
247
  {
235
- isPaletteSelected: E,
236
- selectedBlock: q,
237
- onPaletteChange: ce,
238
- onUpdateBlock: X,
239
- uploadConfig: C,
240
- document: o,
241
- currentPageId: T,
242
- focusedGroup: R
248
+ isPaletteSelected: U,
249
+ selectedBlock: V,
250
+ selectedPalette: I ? de(I) : void 0,
251
+ onPaletteChange: le,
252
+ onUpdateBlock: Q,
253
+ uploadConfig: b,
254
+ document: t,
255
+ currentPageId: $,
256
+ focusedGroup: L
243
257
  }
244
258
  )
245
259
  ] })
246
- ] }) : /* @__PURE__ */ i("div", { className: "h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden", children: /* @__PURE__ */ i(ie, { onSelectTemplate: O }) });
260
+ ] }) : /* @__PURE__ */ p("div", { className: "h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden", children: /* @__PURE__ */ p(ce, { onSelectTemplate: G }) });
247
261
  }
248
262
  export {
249
- Ne as LandingPageEditor
263
+ Oe as LandingPageEditor
250
264
  };
251
265
  //# sourceMappingURL=LandingPageEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LandingPageEditor.js","sources":["../../src/editor/LandingPageEditor.tsx"],"sourcesContent":["/**\n * Landing Page Editor\n * Editor de landing pages usando block engine\n */\n\nimport { useState, useCallback, useEffect, lazy, Suspense } from \"react\";\nimport { TemplatePicker } from \"./TemplatePicker\";\nimport { Toolbar, LeftPanel, CenterPanel, RightPanel } from \"./components\";\nimport { useEditorState } from \"../hooks/useEditorState\";\nimport { useKeyboardShortcuts } from \"../hooks/useKeyboardShortcuts\";\nimport { LoadingSpinner } from \"./components/LoadingSpinner\";\nimport { SiteDocument, PatchBuilder, Block } from \"../engine\";\nimport { getTemplate } from \"../shared/templates\";\nimport type { TemplateId } from \"../shared/templates\";\nimport { sharedTemplateToEngineDocument } from \"../utils/sharedTemplateToEngine\";\nimport { findBlockInStructure } from \"../utils/blockUtils\";\nimport { isLightColor } from \"../utils/colorUtils\";\nimport { logger } from \"../utils/logger\";\nimport { processBlockDataURLs } from \"../utils/dataURLUtils\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UploadConfig {\n tenantId?: string;\n schoolId?: string;\n siteId?: string | null;\n authToken?: string;\n}\n\nexport interface LandingPageEditorProps {\n initialData?: SiteDocument;\n /** ID do template a carregar quando não houver initialData (ex.: \"escola-edvi\") */\n defaultTemplateId?: TemplateId;\n onSave?: (data: SiteDocument) => Promise<void>;\n onPublish?: (data: SiteDocument) => Promise<void>;\n /** Configuração para upload seguro de imagens/vídeos */\n uploadConfig?: UploadConfig;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function LandingPageEditor({\n initialData,\n defaultTemplateId,\n onSave,\n onPublish,\n uploadConfig,\n}: LandingPageEditorProps) {\n // Hook de estado do editor (edição por páginas; sem navegação)\n const {\n document,\n currentPageId,\n currentPage,\n selectedBlockId,\n selectedBlock,\n history,\n setCurrentPageId,\n addPage,\n removePage,\n canRemovePage,\n setSelectedBlockId,\n handleUndo,\n handleRedo,\n handleDeleteBlock,\n handleUpdateBlock,\n applyChange,\n resetToTemplate,\n isPaletteSelected,\n loadDocument,\n activePlugins,\n activatePlugin,\n deactivatePlugin,\n } = useEditorState({ initialData });\n\n // Estado local da UI\n const [isSaving, setIsSaving] = useState(false);\n const [currentTemplateId, setCurrentTemplateId] = useState<TemplateId | null>(\n null,\n );\n const [focusedGroup, setFocusedGroup] = useState<string | null>(null);\n const [showSelectionOverlay, setShowSelectionOverlay] = useState(false);\n\n // Carregar template escolhido (converter shared → engine e carregar no editor)\n const handleSelectTemplate = useCallback(\n (templateId: TemplateId) => {\n const sharedDoc = getTemplate(templateId);\n if (!sharedDoc) return;\n const engineDoc = sharedTemplateToEngineDocument(sharedDoc);\n loadDocument(engineDoc);\n setCurrentTemplateId(templateId);\n },\n [loadDocument],\n );\n\n // Ao montar sem documento: carregar defaultTemplateId se informado\n useEffect(() => {\n if (!document && defaultTemplateId) {\n handleSelectTemplate(defaultTemplateId);\n }\n }, [defaultTemplateId]); // eslint-disable-line react-hooks/exhaustive-deps -- carregar só uma vez quando defaultTemplateId existe\n\n // Handlers de save/publish\n const handleSave = async () => {\n if (!document || !onSave || !uploadConfig) return;\n setIsSaving(true);\n try {\n // Processar o documento para fazer upload de todos os Data URLs\n const processedPages = await Promise.all(\n (document.pages || []).map(async (page) => ({\n ...page,\n structure: await Promise.all(\n (page.structure || []).map((block) => processBlockDataURLs(block, uploadConfig))\n ),\n }))\n );\n\n const processedDocument = {\n ...document,\n pages: processedPages,\n };\n\n await onSave(processedDocument);\n } catch (error) {\n logger.error(\"Error saving:\", error);\n throw error;\n } finally {\n setIsSaving(false);\n }\n };\n\n const handlePublish = async () => {\n if (!document || !onPublish) return;\n setIsSaving(true);\n try {\n await onPublish(document);\n } catch (error) {\n logger.error(\"Error publishing:\", error);\n } finally {\n setIsSaving(false);\n }\n };\n\n // Handler para atualizar um bloco específico\n const handleUpdateBlockById = useCallback(\n (blockId: string, updates: Record<string, any>) => {\n if (!document || !currentPage) return;\n const pageId = (currentPage as any).id;\n if (!pageId) return;\n\n try {\n const patch = PatchBuilder.updateBlockProps(\n document,\n pageId,\n blockId,\n updates\n );\n if (patch?.length) {\n applyChange(patch, \"Update block properties\");\n }\n } catch (error) {\n logger.error(\"Error updating block:\", error);\n }\n },\n [document, currentPage, applyChange]\n );\n\n // Handler para atualizar paleta de cores (inclui mutedText, primaryText, linkColor e menuLinkColor)\n // Também atualiza links e botões do navbar para refletir a paleta escolhida\n const handlePaletteChange = useCallback((palette: any) => {\n if (!document) return;\n const bgLight = isLightColor(palette.background ?? \"#ffffff\");\n const primaryLight = isLightColor(palette.primary ?? \"#3b82f6\");\n const mutedText = bgLight ? \"#6b7280\" : \"#9ca3af\";\n const primaryText = primaryLight ? \"#1f2937\" : \"#ffffff\";\n const menuLinkColor = palette.menuLinkColor || palette.primary;\n\n // Construir todas as operações de patch em um único array\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const allPatches: Array<{ op: \"replace\"; path: string; value: any }> = [];\n\n // 1. Theme color updates\n const themeColors = document.theme.colors;\n const newColors: Record<string, string> = {\n primary: palette.primary,\n secondary: palette.secondary,\n accent: palette.accent,\n bg: palette.background,\n surface: palette.surface || themeColors.surface || \"#f8fafc\",\n text: palette.text || themeColors.text || \"#1e293b\",\n mutedText,\n primaryText,\n linkColor: palette.linkColor || palette.primary,\n menuLinkColor,\n };\n for (const [key, value] of Object.entries(newColors)) {\n allPatches.push({ op: \"replace\", path: `/theme/colors/${key}`, value });\n }\n\n // 2. Navbar link/button color updates (todas as páginas)\n for (let pageIdx = 0; pageIdx < document.pages.length; pageIdx++) {\n const page = document.pages[pageIdx];\n if (!page?.structure) continue;\n for (let blockIdx = 0; blockIdx < page.structure.length; blockIdx++) {\n if (page.structure[blockIdx].type === \"navbar\") {\n const base = `/pages/${pageIdx}/structure/${blockIdx}/props`;\n allPatches.push(\n { op: \"replace\", path: `${base}/linkColor`, value: menuLinkColor },\n { op: \"replace\", path: `${base}/linkHoverColor`, value: palette.primary },\n { op: \"replace\", path: `${base}/buttonColor`, value: palette.primary },\n { op: \"replace\", path: `${base}/buttonTextColor`, value: primaryText },\n );\n }\n }\n }\n\n applyChange(allPatches, \"Update color palette\");\n }, [document, applyChange]);\n\n // Handler para clique no preview (com grupo opcional para scroll-to-group)\n const handleBlockClick = useCallback((blockId: string, group?: string) => {\n setSelectedBlockId(blockId);\n setFocusedGroup(group || null);\n }, [setSelectedBlockId]);\n\n // Limpar focusedGroup quando o bloco selecionado muda (via seleção no painel esquerdo, etc.)\n // Nota: handleBlockClick já define o focusedGroup corretamente quando vem do preview\n\n // No editor: cliques em links no preview não navegam; trocam a página em edição\n // Keyboard shortcuts\n useKeyboardShortcuts({\n onUndo: handleUndo,\n onRedo: handleRedo,\n onSave: handleSave,\n onDelete: () => {\n if (selectedBlockId) {\n handleDeleteBlock(selectedBlockId);\n }\n },\n onDeselect: () => setSelectedBlockId(null),\n });\n\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (event.data?.type !== \"editor-navigate\" || !event.data.href) return;\n const href = String(event.data.href);\n if (!document) return;\n // Links internos: /site/p/:slug ou /p/:slug\n const match = href.match(/^(?:\\/site)?\\/p\\/([^#?]+)/);\n if (match) {\n const slug = match[1];\n const page = document.pages.find((p) => p.slug === slug);\n if (page) setCurrentPageId(page.id);\n return;\n }\n // Âncora #id: selecionar bloco com esse id e trocar para a página que o contém\n if (href.startsWith(\"#\")) {\n const id = href.slice(1);\n for (const p of document.pages) {\n if (findBlockInStructure(p.structure || [], id)) {\n setCurrentPageId(p.id);\n setSelectedBlockId(id);\n break;\n }\n }\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [document, setCurrentPageId, setSelectedBlockId]);\n\n // Sem documento: mostrar seletor de templates\n if (!document) {\n return (\n <div className=\"h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden\">\n <TemplatePicker onSelectTemplate={handleSelectTemplate} />\n </div>\n );\n }\n\n return (\n <div className=\"h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden\">\n {/* Toolbar */}\n <Toolbar\n history={history}\n isSaving={isSaving}\n onUndo={handleUndo}\n onRedo={handleRedo}\n onSave={handleSave}\n onPublish={onPublish ? handlePublish : undefined}\n onReset={\n currentTemplateId\n ? () => {\n // Recarregar o mesmo template\n const sharedDoc = getTemplate(currentTemplateId);\n if (sharedDoc)\n loadDocument(sharedTemplateToEngineDocument(sharedDoc));\n }\n : resetToTemplate\n }\n showSelectionOverlay={showSelectionOverlay}\n onToggleSelectionOverlay={() => setShowSelectionOverlay(prev => !prev)}\n />\n\n {/* Main Content - 3 Columns */}\n <div className=\"flex-1 flex overflow-hidden min-h-0 max-h-full\">\n {/* Left: Block Selector + Paletas */}\n <LeftPanel\n currentPage={currentPage}\n selectedBlockId={selectedBlockId}\n isPaletteSelected={isPaletteSelected}\n onSelectBlock={(id) => { setSelectedBlockId(id); setFocusedGroup(null); }}\n onDeleteBlock={handleDeleteBlock}\n />\n\n {/* Center: Preview (apenas a página em edição) */}\n <CenterPanel\n document={document}\n currentPageId={currentPageId}\n currentPage={currentPage}\n selectedBlockId={selectedBlockId}\n onBlockClick={handleBlockClick}\n onSelectPage={setCurrentPageId}\n onAddPage={() => {\n const name = prompt(\"Nome da página:\");\n if (!name) return;\n const slug = name.toLowerCase().replace(/\\s+/g, \"-\");\n const id = slug;\n addPage(id, name, slug);\n }}\n onRemovePage={removePage}\n canRemovePage={canRemovePage}\n onUpdateBlock={handleUpdateBlockById}\n activePlugins={activePlugins}\n onActivatePlugin={activatePlugin}\n onDeactivatePlugin={deactivatePlugin}\n showSelectionOverlay={showSelectionOverlay}\n focusedGroup={focusedGroup}\n />\n\n {/* Right: Editor Panel */}\n <RightPanel\n isPaletteSelected={isPaletteSelected}\n selectedBlock={selectedBlock}\n onPaletteChange={handlePaletteChange}\n onUpdateBlock={handleUpdateBlock}\n uploadConfig={uploadConfig}\n document={document}\n currentPageId={currentPageId}\n focusedGroup={focusedGroup}\n />\n </div>\n </div>\n );\n}\n"],"names":["LandingPageEditor","initialData","defaultTemplateId","onSave","onPublish","uploadConfig","document","currentPageId","currentPage","selectedBlockId","selectedBlock","history","setCurrentPageId","addPage","removePage","canRemovePage","setSelectedBlockId","handleUndo","handleRedo","handleDeleteBlock","handleUpdateBlock","applyChange","resetToTemplate","isPaletteSelected","loadDocument","activePlugins","activatePlugin","deactivatePlugin","useEditorState","isSaving","setIsSaving","useState","currentTemplateId","setCurrentTemplateId","focusedGroup","setFocusedGroup","showSelectionOverlay","setShowSelectionOverlay","handleSelectTemplate","useCallback","templateId","sharedDoc","getTemplate","engineDoc","sharedTemplateToEngineDocument","useEffect","handleSave","processedPages","page","block","processBlockDataURLs","processedDocument","error","logger","handlePublish","handleUpdateBlockById","blockId","updates","pageId","patch","PatchBuilder","handlePaletteChange","palette","bgLight","isLightColor","primaryLight","mutedText","primaryText","menuLinkColor","allPatches","themeColors","newColors","key","value","pageIdx","blockIdx","base","handleBlockClick","group","useKeyboardShortcuts","handleMessage","event","href","match","slug","p","id","findBlockInStructure","jsxs","jsx","Toolbar","prev","LeftPanel","CenterPanel","name","RightPanel","TemplatePicker"],"mappings":";;;;;;;;;;;;;;;;AA6CO,SAASA,GAAkB;AAAA,EAChC,aAAAC;AAA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AAEnD,YAAAjF,EADWuE,GACCU,GAAMV,CAAI;AAAA,UACxB;AAAA,UACA,cAActE;AAAA,UACd,eAAAC;AAAA,UACA,eAAewC;AAAA,UACf,eAAA9B;AAAA,UACA,kBAAkBC;AAAA,UAClB,oBAAoBC;AAAA,UACpB,sBAAAS;AAAA,UACA,cAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,MAIF,gBAAAuD;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,mBAAAxE;AAAA,UACA,eAAAb;AAAA,UACA,iBAAiBmD;AAAA,UACjB,eAAezC;AAAA,UACf,cAAAf;AAAA,UACA,UAAAC;AAAA,UACA,eAAAC;AAAA,UACA,cAAA2B;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,GACF,IA9EE,gBAAAuD,EAAC,SAAI,WAAU,qEACb,4BAACO,IAAA,EAAe,kBAAkB1D,GAAsB,EAAA,CAC1D;AA8EN;"}
1
+ {"version":3,"file":"LandingPageEditor.js","sources":["../../src/editor/LandingPageEditor.tsx"],"sourcesContent":["/**\n * Landing Page Editor\n * Editor de landing pages usando block engine\n */\n\nimport { useState, useCallback, useEffect, lazy, Suspense } from \"react\";\nimport { TemplatePicker } from \"./TemplatePicker\";\nimport { Toolbar, LeftPanel, CenterPanel, RightPanel } from \"./components\";\nimport { useEditorState } from \"../hooks/useEditorState\";\nimport { useKeyboardShortcuts } from \"../hooks/useKeyboardShortcuts\";\nimport { LoadingSpinner } from \"./components/LoadingSpinner\";\nimport { SiteDocument, PatchBuilder, Block } from \"../engine\";\nimport { getTemplate, templateDefaultPalette } from \"../shared/templates\";\nimport type { TemplateId } from \"../shared/templates\";\nimport { findPaletteByName } from \"./PaletteSelector\";\nimport { sharedTemplateToEngineDocument } from \"../utils/sharedTemplateToEngine\";\nimport { findBlockInStructure } from \"../utils/blockUtils\";\nimport { derivePaletteColors } from \"../utils/colorUtils\";\nimport { logger } from \"../utils/logger\";\nimport { processBlockDataURLs } from \"../utils/dataURLUtils\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UploadConfig {\n tenantId?: string;\n schoolId?: string;\n siteId?: string | null;\n authToken?: string;\n}\n\nexport interface LandingPageEditorProps {\n initialData?: SiteDocument;\n /** ID do template a carregar quando não houver initialData (ex.: \"escola-edvi\") */\n defaultTemplateId?: TemplateId;\n onSave?: (data: SiteDocument) => Promise<void>;\n onPublish?: (data: SiteDocument) => Promise<void>;\n /** Configuração para upload seguro de imagens/vídeos */\n uploadConfig?: UploadConfig;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function LandingPageEditor({\n initialData,\n defaultTemplateId,\n onSave,\n onPublish,\n uploadConfig,\n}: LandingPageEditorProps) {\n // Hook de estado do editor (edição por páginas; sem navegação)\n const {\n document,\n currentPageId,\n currentPage,\n selectedBlockId,\n selectedBlock,\n history,\n setCurrentPageId,\n addPage,\n removePage,\n canRemovePage,\n setSelectedBlockId,\n handleUndo,\n handleRedo,\n handleDeleteBlock,\n handleUpdateBlock,\n applyChange,\n resetToTemplate,\n isPaletteSelected,\n loadDocument,\n selectedPalette,\n setSelectedPalette,\n activePlugins,\n activatePlugin,\n deactivatePlugin,\n } = useEditorState({ initialData });\n\n // Estado local da UI\n const [isSaving, setIsSaving] = useState(false);\n const [currentTemplateId, setCurrentTemplateId] = useState<TemplateId | null>(\n null,\n );\n const [focusedGroup, setFocusedGroup] = useState<string | null>(null);\n const [showSelectionOverlay, setShowSelectionOverlay] = useState(false);\n\n // Carregar template escolhido (converter shared → engine e carregar no editor)\n const handleSelectTemplate = useCallback(\n (templateId: TemplateId) => {\n const sharedDoc = getTemplate(templateId);\n if (!sharedDoc) return;\n const engineDoc = sharedTemplateToEngineDocument(sharedDoc);\n loadDocument(engineDoc);\n setCurrentTemplateId(templateId);\n\n // Auto-selecionar paleta correspondente ao template\n const paletteName = templateDefaultPalette[templateId];\n if (paletteName) {\n setSelectedPalette(paletteName);\n }\n },\n [loadDocument, setSelectedPalette],\n );\n\n // Ao montar sem documento: carregar defaultTemplateId se informado\n useEffect(() => {\n if (!document && defaultTemplateId) {\n handleSelectTemplate(defaultTemplateId);\n }\n }, [defaultTemplateId]); // eslint-disable-line react-hooks/exhaustive-deps -- carregar só uma vez quando defaultTemplateId existe\n\n // Handlers de save/publish\n const handleSave = async () => {\n if (!document || !onSave || !uploadConfig) return;\n setIsSaving(true);\n try {\n // Processar o documento para fazer upload de todos os Data URLs\n const processedPages = await Promise.all(\n (document.pages || []).map(async (page) => ({\n ...page,\n structure: await Promise.all(\n (page.structure || []).map((block) => processBlockDataURLs(block, uploadConfig))\n ),\n }))\n );\n\n const processedDocument = {\n ...document,\n pages: processedPages,\n };\n\n await onSave(processedDocument);\n } catch (error) {\n logger.error(\"Error saving:\", error);\n throw error;\n } finally {\n setIsSaving(false);\n }\n };\n\n const handlePublish = async () => {\n if (!document || !onPublish) return;\n setIsSaving(true);\n try {\n await onPublish(document);\n } catch (error) {\n logger.error(\"Error publishing:\", error);\n } finally {\n setIsSaving(false);\n }\n };\n\n // Handler para atualizar um bloco específico\n const handleUpdateBlockById = useCallback(\n (blockId: string, updates: Record<string, any>) => {\n if (!document || !currentPage) return;\n const pageId = (currentPage as any).id;\n if (!pageId) return;\n\n try {\n const patch = PatchBuilder.updateBlockProps(\n document,\n pageId,\n blockId,\n updates\n );\n if (patch?.length) {\n applyChange(patch, \"Update block properties\");\n }\n } catch (error) {\n logger.error(\"Error updating block:\", error);\n }\n },\n [document, currentPage, applyChange]\n );\n\n // Handler para atualizar paleta de cores\n // Usa derivePaletteColors() para derivar todas as cores e patcha Hero/Navbar/Footer alem do theme\n const handlePaletteChange = useCallback((palette: any) => {\n if (!document) return;\n const derived = derivePaletteColors(palette);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const allPatches: Array<{ op: \"replace\"; path: string; value: any }> = [];\n\n // 1. Theme color updates\n for (const [key, value] of Object.entries(derived.themeColors)) {\n allPatches.push({ op: \"replace\", path: `/theme/colors/${key}`, value });\n }\n\n // 2. Block-level patches (todas as paginas)\n // Hero variations that use dark gradient backgrounds\n const darkGradientVariations = new Set([\n \"hero-gradient\", \"hero-parallax\", \"hero-overlay\", \"hero-carousel\",\n ]);\n\n for (let pageIdx = 0; pageIdx < document.pages.length; pageIdx++) {\n const page = document.pages[pageIdx];\n if (!page?.structure) continue;\n for (let blockIdx = 0; blockIdx < page.structure.length; blockIdx++) {\n const block = page.structure[blockIdx];\n const base = `/pages/${pageIdx}/structure/${blockIdx}/props`;\n\n if (block.type === \"hero\") {\n const variation = (block.props as any)?.variation || \"\";\n if (darkGradientVariations.has(variation)) {\n allPatches.push(\n { op: \"replace\", path: `${base}/background`, value: `linear-gradient(135deg, ${derived.heroGradientStart} 0%, ${derived.heroGradientEnd} 100%)` },\n { op: \"replace\", path: `${base}/titleColor`, value: derived.heroTitleColor },\n { op: \"replace\", path: `${base}/subtitleColor`, value: derived.heroSubtitleColor },\n { op: \"replace\", path: `${base}/descriptionColor`, value: derived.heroDescColor },\n );\n }\n } else if (block.type === \"navbar\") {\n allPatches.push(\n { op: \"replace\", path: `${base}/bg`, value: derived.navbarBg },\n { op: \"replace\", path: `${base}/linkColor`, value: derived.themeColors.menuLinkColor },\n { op: \"replace\", path: `${base}/linkHoverColor`, value: derived.themeColors.primary },\n { op: \"replace\", path: `${base}/buttonColor`, value: derived.themeColors.primary },\n { op: \"replace\", path: `${base}/buttonTextColor`, value: derived.themeColors.primaryText },\n );\n } else if (block.type === \"footer\") {\n allPatches.push(\n { op: \"replace\", path: `${base}/linkHoverColor`, value: derived.footerLinkHover },\n );\n }\n }\n }\n\n applyChange(allPatches, \"Update color palette\");\n setSelectedPalette(palette.name ?? null);\n }, [document, applyChange, setSelectedPalette]);\n\n // Handler para clique no preview (com grupo opcional para scroll-to-group)\n const handleBlockClick = useCallback((blockId: string, group?: string) => {\n setSelectedBlockId(blockId);\n setFocusedGroup(group || null);\n }, [setSelectedBlockId]);\n\n // Limpar focusedGroup quando o bloco selecionado muda (via seleção no painel esquerdo, etc.)\n // Nota: handleBlockClick já define o focusedGroup corretamente quando vem do preview\n\n // No editor: cliques em links no preview não navegam; trocam a página em edição\n // Keyboard shortcuts\n useKeyboardShortcuts({\n onUndo: handleUndo,\n onRedo: handleRedo,\n onSave: handleSave,\n onDelete: () => {\n if (selectedBlockId) {\n handleDeleteBlock(selectedBlockId);\n }\n },\n onDeselect: () => setSelectedBlockId(null),\n });\n\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (event.data?.type !== \"editor-navigate\" || !event.data.href) return;\n const href = String(event.data.href);\n if (!document) return;\n // Links internos: /site/p/:slug ou /p/:slug\n const match = href.match(/^(?:\\/site)?\\/p\\/([^#?]+)/);\n if (match) {\n const slug = match[1];\n const page = document.pages.find((p) => p.slug === slug);\n if (page) setCurrentPageId(page.id);\n return;\n }\n // Âncora #id: selecionar bloco com esse id e trocar para a página que o contém\n if (href.startsWith(\"#\")) {\n const id = href.slice(1);\n for (const p of document.pages) {\n if (findBlockInStructure(p.structure || [], id)) {\n setCurrentPageId(p.id);\n setSelectedBlockId(id);\n break;\n }\n }\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [document, setCurrentPageId, setSelectedBlockId]);\n\n // Sem documento: mostrar seletor de templates\n if (!document) {\n return (\n <div className=\"h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden\">\n <TemplatePicker onSelectTemplate={handleSelectTemplate} />\n </div>\n );\n }\n\n return (\n <div className=\"h-[91vh] max-h-[91vh] flex flex-col bg-background overflow-hidden\">\n {/* Toolbar */}\n <Toolbar\n history={history}\n isSaving={isSaving}\n onUndo={handleUndo}\n onRedo={handleRedo}\n onSave={handleSave}\n onPublish={onPublish ? handlePublish : undefined}\n onReset={\n currentTemplateId\n ? () => {\n // Recarregar o mesmo template\n const sharedDoc = getTemplate(currentTemplateId);\n if (sharedDoc) {\n loadDocument(sharedTemplateToEngineDocument(sharedDoc));\n const paletteName = templateDefaultPalette[currentTemplateId];\n if (paletteName) {\n setSelectedPalette(paletteName);\n }\n }\n }\n : resetToTemplate\n }\n showSelectionOverlay={showSelectionOverlay}\n onToggleSelectionOverlay={() => setShowSelectionOverlay(prev => !prev)}\n />\n\n {/* Main Content - 3 Columns */}\n <div className=\"flex-1 flex overflow-hidden min-h-0 max-h-full\">\n {/* Left: Block Selector + Paletas */}\n <LeftPanel\n currentPage={currentPage}\n selectedBlockId={selectedBlockId}\n isPaletteSelected={isPaletteSelected}\n onSelectBlock={(id) => { setSelectedBlockId(id); setFocusedGroup(null); }}\n onDeleteBlock={handleDeleteBlock}\n />\n\n {/* Center: Preview (apenas a página em edição) */}\n <CenterPanel\n document={document}\n currentPageId={currentPageId}\n currentPage={currentPage}\n selectedBlockId={selectedBlockId}\n onBlockClick={handleBlockClick}\n onSelectPage={setCurrentPageId}\n onAddPage={() => {\n const name = prompt(\"Nome da página:\");\n if (!name) return;\n const slug = name.toLowerCase().replace(/\\s+/g, \"-\");\n const id = slug;\n addPage(id, name, slug);\n }}\n onRemovePage={removePage}\n canRemovePage={canRemovePage}\n onUpdateBlock={handleUpdateBlockById}\n activePlugins={activePlugins}\n onActivatePlugin={activatePlugin}\n onDeactivatePlugin={deactivatePlugin}\n showSelectionOverlay={showSelectionOverlay}\n focusedGroup={focusedGroup}\n />\n\n {/* Right: Editor Panel */}\n <RightPanel\n isPaletteSelected={isPaletteSelected}\n selectedBlock={selectedBlock}\n selectedPalette={selectedPalette ? findPaletteByName(selectedPalette) : undefined}\n onPaletteChange={handlePaletteChange}\n onUpdateBlock={handleUpdateBlock}\n uploadConfig={uploadConfig}\n document={document}\n currentPageId={currentPageId}\n focusedGroup={focusedGroup}\n />\n </div>\n </div>\n );\n}\n"],"names":["LandingPageEditor","initialData","defaultTemplateId","onSave","onPublish","uploadConfig","document","currentPageId","currentPage","selectedBlockId","selectedBlock","history","setCurrentPageId","addPage","removePage","canRemovePage","setSelectedBlockId","handleUndo","handleRedo","handleDeleteBlock","handleUpdateBlock","applyChange","resetToTemplate","isPaletteSelected","loadDocument","selectedPalette","setSelectedPalette","activePlugins","activatePlugin","deactivatePlugin","useEditorState","isSaving","setIsSaving","useState","currentTemplateId","setCurrentTemplateId","focusedGroup","setFocusedGroup","showSelectionOverlay","setShowSelectionOverlay","handleSelectTemplate","useCallback","templateId","sharedDoc","getTemplate","engineDoc","sharedTemplateToEngineDocument","paletteName","templateDefaultPalette","useEffect","handleSave","processedPages","page","block","processBlockDataURLs","processedDocument","error","logger","handlePublish","handleUpdateBlockById","blockId","updates","pageId","patch","PatchBuilder","handlePaletteChange","palette","derived","derivePaletteColors","allPatches","key","value","darkGradientVariations","pageIdx","blockIdx","base","variation","handleBlockClick","group","useKeyboardShortcuts","handleMessage","event","href","match","slug","p","id","findBlockInStructure","jsxs","jsx","Toolbar","prev","LeftPanel","CenterPanel","name","RightPanel","findPaletteByName","TemplatePicker"],"mappings":";;;;;;;;;;;;;;;;;AA8CO,SAASA,GAAkB;AAAA,EAChC,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AACF,GAA2B;AAEzB,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACEC,GAAe,EAAE,aAAA7B,GAAa,GAG5B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,QAAQ,GAAG;AAEnD,YAAAjF,EADWuE,GACCU,GAAMV,CAAI;AAAA,UACxB;AAAA,UACA,cAActE;AAAA,UACd,eAAAC;AAAA,UACA,eAAe4C;AAAA,UACf,eAAAhC;AAAA,UACA,kBAAkBC;AAAA,UAClB,oBAAoBC;AAAA,UACpB,sBAAAS;AAAA,UACA,cAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,MAIF,gBAAAqD;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,mBAAAxE;AAAA,UACA,eAAAb;AAAA,UACA,iBAAiBe,IAAkBuE,GAAkBvE,CAAe,IAAI;AAAA,UACxE,iBAAiBwC;AAAA,UACjB,eAAe7C;AAAA,UACf,cAAAf;AAAA,UACA,UAAAC;AAAA,UACA,eAAAC;AAAA,UACA,cAAA6B;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,GACF,IApFE,gBAAAqD,EAAC,SAAI,WAAU,qEACb,4BAACQ,IAAA,EAAe,kBAAkBzD,GAAsB,EAAA,CAC1D;AAoFN;"}
@@ -13,8 +13,11 @@ export interface ColorPalette {
13
13
  linkColor?: string;
14
14
  menuLinkColor?: string;
15
15
  gradient: string[];
16
+ heroGradientStart?: string;
17
+ heroGradientEnd?: string;
16
18
  }
17
19
  export declare const colorPalettes: ColorPalette[];
20
+ export declare function findPaletteByName(name: string): ColorPalette | undefined;
18
21
  interface PaletteSelectorProps {
19
22
  selectedPalette?: ColorPalette;
20
23
  onPaletteChange: (palette: ColorPalette) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"PaletteSelector.d.ts","sourceRoot":"","sources":["../../src/editor/PaletteSelector.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CA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