@brunoalz/smartgesti-site-editor 1.11.0 → 1.11.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.
@@ -1 +1 @@
1
- {"version":3,"file":"BlockPropertyEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/PropertyEditor/BlockPropertyEditor.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,YAAY,EAAsE,MAAM,cAAc,CAAC;AAKvH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAkDzD,UAAU,wBAAwB;IAChC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gEAiJ9B,CAAC"}
1
+ {"version":3,"file":"BlockPropertyEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/PropertyEditor/BlockPropertyEditor.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,YAAY,EAAsE,MAAM,cAAc,CAAC;AAKvH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAkDzD,UAAU,wBAAwB;IAChC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gEA6J9B,CAAC"}
@@ -1,12 +1,12 @@
1
- import { jsx as p, jsxs as T } from "react/jsx-runtime";
2
- import { memo as b, useMemo as d, useCallback as w } from "react";
3
- import { VariationSelector as S } from "./VariationSelector.js";
4
- import { BlockHeader as M } from "./BlockHeader.js";
5
- import { CollapsiblePropertyGroup as O } from "./CollapsiblePropertyGroup.js";
1
+ import { jsx as d, jsxs as T } from "react/jsx-runtime";
2
+ import { memo as S, useMemo as f, useCallback as b } from "react";
3
+ import { VariationSelector as M } from "./VariationSelector.js";
4
+ import { BlockHeader as O } from "./BlockHeader.js";
5
+ import { CollapsiblePropertyGroup as E } from "./CollapsiblePropertyGroup.js";
6
6
  import { evaluateShowWhen as j } from "../../engine/shared/showWhen.js";
7
- import { componentRegistry as E } from "../../engine/registry/registry.js";
8
- import { pluginRegistry as k } from "../../engine/plugins/pluginRegistry.js";
9
- const H = {
7
+ import { componentRegistry as k } from "../../engine/registry/registry.js";
8
+ import { pluginRegistry as H } from "../../engine/plugins/pluginRegistry.js";
9
+ const R = {
10
10
  // Buttons (primary)
11
11
  primaryButtonColor: "primary",
12
12
  buttonColor: "primary",
@@ -32,83 +32,92 @@ const H = {
32
32
  // Background (generic)
33
33
  bg: "bg"
34
34
  };
35
- function R(f, e) {
36
- const r = H[f];
35
+ function W(x, e) {
36
+ const r = R[x];
37
37
  if (!r) return;
38
- const s = e[r];
39
- return typeof s == "string" ? s : void 0;
38
+ const a = e[r];
39
+ return typeof a == "string" ? a : void 0;
40
40
  }
41
- const q = b(function({
41
+ const z = S(function({
42
42
  block: e,
43
43
  document: r,
44
- currentPageId: s,
45
- onUpdate: l,
46
- uploadConfig: v,
47
- focusedGroup: B
44
+ currentPageId: a,
45
+ onUpdate: c,
46
+ uploadConfig: B,
47
+ focusedGroup: F
48
48
  }) {
49
- const i = d(() => e ? E.get(e.type) : null, [e]), x = d(
50
- () => ({ document: r, currentPageId: s }),
51
- [r, s]
52
- ), h = d(() => {
49
+ const n = f(() => e ? k.get(e.type) : null, [e]), h = f(
50
+ () => ({ document: r, currentPageId: a }),
51
+ [r, a]
52
+ ), C = f(() => {
53
53
  if (!e || !r) return /* @__PURE__ */ new Set();
54
- const t = k.getEditorRestrictions(r, e.type);
54
+ const t = H.getEditorRestrictions(r, e.type);
55
55
  return t?.lockedFields ? new Set(t.lockedFields) : /* @__PURE__ */ new Set();
56
- }, [e, r]), C = d(() => {
57
- if (!e || !i?.inspectorMeta) return {};
58
- const t = e.props, o = i.defaultProps || {}, c = {};
59
- for (const [a, n] of Object.entries(
60
- i.inspectorMeta
56
+ }, [e, r]), g = f(() => {
57
+ if (!e || !n?.inspectorMeta) return {};
58
+ const t = e.props, i = n.defaultProps || {}, u = {}, v = (s, o) => {
59
+ if (!o.includes(".")) return s[o];
60
+ const p = o.split(".");
61
+ let l = s;
62
+ for (const m of p) {
63
+ if (l == null) return;
64
+ l = l[m];
65
+ }
66
+ return l;
67
+ };
68
+ for (const [s, o] of Object.entries(
69
+ n.inspectorMeta
61
70
  )) {
62
- if (n.showWhen && !j(n.showWhen, t, o, x))
71
+ if (o.showWhen && !j(o.showWhen, t, i, h))
63
72
  continue;
64
- const m = n.group || "Geral";
65
- c[m] || (c[m] = []);
66
- const u = t[a], g = n.inputType === "color" || n.inputType === "color-advanced";
67
- let y = u === void 0 || g && u === "" ? o[a] : u;
68
- y === void 0 && g && r?.theme?.colors && (y = R(
69
- a,
73
+ const p = o.group || "Geral";
74
+ u[p] || (u[p] = []);
75
+ const l = v(t, s), m = o.inputType === "color" || o.inputType === "color-advanced";
76
+ let y = l === void 0 || m && l === "" ? v(i, s) : l;
77
+ y === void 0 && m && r?.theme?.colors && (y = W(
78
+ s,
70
79
  r.theme.colors
71
80
  ));
72
- const P = h.has(a) ? { ...n, readOnly: !0 } : n;
73
- c[m].push({
74
- propName: a,
75
- meta: P,
81
+ const w = C.has(s) ? { ...o, readOnly: !0 } : o;
82
+ u[p].push({
83
+ propName: s,
84
+ meta: w,
76
85
  value: y
77
86
  });
78
87
  }
79
- return c;
80
- }, [e, i, r, x, h]), F = w((t, o) => {
81
- l(t === "logo" && (o === void 0 || o === "") ? { [t]: o, logoHeight: 70 } : { [t]: o });
82
- }, [l]);
83
- return e ? i ? /* @__PURE__ */ T("div", { className: "p-3 space-y-4", children: [
84
- /* @__PURE__ */ p(
85
- M,
88
+ return u;
89
+ }, [e, n, r, h, C]), P = b((t, i) => {
90
+ c(t === "logo" && (i === void 0 || i === "") ? { [t]: i, logoHeight: 70 } : { [t]: i });
91
+ }, [c]);
92
+ return e ? n ? /* @__PURE__ */ T("div", { className: "p-3 space-y-4", children: [
93
+ /* @__PURE__ */ d(
94
+ O,
86
95
  {
87
96
  type: e.type,
88
- name: i.name,
89
- description: i.description
97
+ name: n.name,
98
+ description: n.description
90
99
  }
91
100
  ),
92
- i.variations && /* @__PURE__ */ p(S, { block: e, onUpdate: l }),
93
- Object.keys(C).length === 0 ? /* @__PURE__ */ p("div", { className: "text-center text-gray-500 dark:text-gray-400 text-xs py-4", children: "Nenhuma propriedade configurável" }) : Object.entries(C).map(([t, o]) => /* @__PURE__ */ p(
94
- O,
101
+ n.variations && /* @__PURE__ */ d(M, { block: e, onUpdate: c }),
102
+ Object.keys(g).length === 0 ? /* @__PURE__ */ d("div", { className: "text-center text-gray-500 dark:text-gray-400 text-xs py-4", children: "Nenhuma propriedade configurável" }) : Object.entries(g).map(([t, i]) => /* @__PURE__ */ d(
103
+ E,
95
104
  {
96
105
  groupName: t,
97
- props: o,
98
- onPropChange: F,
99
- onMultiUpdate: l,
106
+ props: i,
107
+ onPropChange: P,
108
+ onMultiUpdate: c,
100
109
  allProps: e?.props,
101
- uploadConfig: v,
102
- isFocused: t === B
110
+ uploadConfig: B,
111
+ isFocused: t === F
103
112
  },
104
113
  t
105
114
  ))
106
115
  ] }) : /* @__PURE__ */ T("div", { className: "p-4 text-center text-red-500 text-sm", children: [
107
116
  "Tipo de bloco desconhecido: ",
108
117
  e.type
109
- ] }) : /* @__PURE__ */ p("div", { className: "p-4 text-center text-gray-500 dark:text-gray-400 text-sm", children: "Selecione um bloco para editar" });
118
+ ] }) : /* @__PURE__ */ d("div", { className: "p-4 text-center text-gray-500 dark:text-gray-400 text-sm", children: "Selecione um bloco para editar" });
110
119
  });
111
120
  export {
112
- q as BlockPropertyEditor
121
+ z as BlockPropertyEditor
113
122
  };
114
123
  //# sourceMappingURL=BlockPropertyEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockPropertyEditor.js","sources":["../../../src/editor/PropertyEditor/BlockPropertyEditor.tsx"],"sourcesContent":["/**\n * Block Property Editor - Refatorado\n * Editor dinâmico de propriedades baseado em inspectorMeta\n */\n\nimport { memo, useMemo, useCallback } from \"react\";\nimport { Block, SiteDocument, componentRegistry, InspectorMeta, evaluateShowWhen, pluginRegistry } from \"../../engine\";\nimport type { ShowWhenContext } from \"../../engine\";\nimport { VariationSelector } from \"./VariationSelector\";\nimport { BlockHeader } from \"./BlockHeader\";\nimport { CollapsiblePropertyGroup } from \"./CollapsiblePropertyGroup\";\nimport type { UploadConfig } from \"../LandingPageEditor\";\n\n// ============================================================================\n// Theme Color Fallback Map\n// Maps color property names → theme color token keys.\n// Used when block.props[colorProp] and defaultProps[colorProp] are both undefined,\n// so the editor shows the actual theme color instead of #000000.\n// ============================================================================\n\nconst THEME_COLOR_FALLBACKS: Record<string, string> = {\n // Buttons (primary)\n primaryButtonColor: \"primary\",\n buttonColor: \"primary\",\n primaryButtonTextColor: \"primaryText\",\n buttonTextColor: \"primaryText\",\n // Buttons (secondary)\n secondaryButtonColor: \"secondary\",\n secondaryButtonTextColor: \"primaryText\",\n // Badge\n badgeColor: \"accent\",\n badgeTextColor: \"primaryText\",\n // Links\n linkColor: \"linkColor\",\n linkHoverColor: \"primary\",\n // Border\n borderColor: \"border\",\n // Generic text\n color: \"text\",\n // Title/description\n titleColor: \"text\",\n subtitleColor: \"mutedText\",\n descriptionColor: \"mutedText\",\n // Background (generic)\n bg: \"bg\",\n};\n\n/**\n * Resolve theme color fallback for a color property.\n * Returns the theme color value if a mapping exists, undefined otherwise.\n */\nfunction resolveThemeColorFallback(\n propName: string,\n themeColors: Record<string, unknown>,\n): string | undefined {\n const themeKey = THEME_COLOR_FALLBACKS[propName];\n if (!themeKey) return undefined;\n const color = themeColors[themeKey];\n return typeof color === \"string\" ? color : undefined;\n}\n\ninterface BlockPropertyEditorProps {\n block: Block | null;\n document?: SiteDocument;\n currentPageId?: string;\n onUpdate: (updates: Record<string, any>) => void;\n uploadConfig?: UploadConfig;\n /** When set, the matching property group opens and scrolls into view */\n focusedGroup?: string | null;\n}\n\n/**\n * Componente principal do editor de propriedades\n * Memoizado para performance\n */\nexport const BlockPropertyEditor = memo(function BlockPropertyEditor({\n block,\n document,\n currentPageId,\n onUpdate,\n uploadConfig,\n focusedGroup,\n}: BlockPropertyEditorProps) {\n // Obter definição do bloco do registry\n const blockDefinition = useMemo(() => {\n if (!block) return null;\n return componentRegistry.get(block.type);\n }, [block]);\n\n // Contexto para cross-block showWhen\n const showWhenContext = useMemo<ShowWhenContext>(\n () => ({ document, currentPageId }),\n [document, currentPageId],\n );\n\n // Obter restrições de edição do plugin (se houver)\n const lockedFields = useMemo(() => {\n if (!block || !document) return new Set<string>();\n const restriction = pluginRegistry.getEditorRestrictions(document, block.type);\n if (!restriction?.lockedFields) return new Set<string>();\n return new Set(restriction.lockedFields);\n }, [block, document]);\n\n // Agrupar propriedades por grupo\n const groupedProps = useMemo(() => {\n if (!block || !blockDefinition?.inspectorMeta) return {};\n\n const props = block.props as Record<string, any>;\n const defaultProps = (blockDefinition.defaultProps || {}) as Record<string, any>;\n const groups: Record<\n string,\n Array<{ propName: string; meta: InspectorMeta; value: any }>\n > = {};\n\n for (const [propName, meta] of Object.entries(\n blockDefinition.inspectorMeta,\n )) {\n // Visibilidade condicional via showWhen\n if (meta.showWhen) {\n if (!evaluateShowWhen(meta.showWhen, props, defaultProps, showWhenContext)) {\n continue;\n }\n }\n\n const group = meta.group || \"Geral\";\n if (!groups[group]) {\n groups[group] = [];\n }\n\n // Usar valor atual ou fallback para defaultProps, e depois theme colors\n const currentValue = props[propName];\n // Para campos de cor, também fazer fallback se o valor for string vazia\n const isColorInput = meta.inputType === \"color\" || meta.inputType === \"color-advanced\";\n const shouldUseFallback = currentValue === undefined || (isColorInput && currentValue === \"\");\n let value = shouldUseFallback ? defaultProps[propName] : currentValue;\n\n // Para color inputs sem valor definido, tentar fallback para cor do theme\n if (value === undefined && isColorInput && document?.theme?.colors) {\n value = resolveThemeColorFallback(\n propName,\n document.theme.colors as unknown as Record<string, unknown>,\n );\n }\n\n // Aplicar readOnly de plugin restrictions\n const effectiveMeta = lockedFields.has(propName)\n ? { ...meta, readOnly: true }\n : meta;\n\n groups[group].push({\n propName,\n meta: effectiveMeta,\n value,\n });\n }\n\n return groups;\n }, [block, blockDefinition, document, showWhenContext, lockedFields]);\n\n // IMPORTANTE: todos os hooks devem ser chamados ANTES de qualquer early return\n const handlePropChange = useCallback((propName: string, value: any) => {\n // Se remover o logo (definir como undefined), resetar logoHeight para padrão\n if (propName === \"logo\" && (value === undefined || value === \"\")) {\n onUpdate({ [propName]: value, logoHeight: 70 });\n } else {\n onUpdate({ [propName]: value });\n }\n }, [onUpdate]);\n\n if (!block) {\n return (\n <div className=\"p-4 text-center text-gray-500 dark:text-gray-400 text-sm\">\n Selecione um bloco para editar\n </div>\n );\n }\n\n if (!blockDefinition) {\n return (\n <div className=\"p-4 text-center text-red-500 text-sm\">\n Tipo de bloco desconhecido: {block.type}\n </div>\n );\n }\n\n return (\n <div className=\"p-3 space-y-4\">\n {/* Header com ícone centralizado */}\n <BlockHeader\n type={block.type}\n name={blockDefinition.name}\n description={blockDefinition.description}\n />\n\n {/* Seletor de variações (Hero/Navbar) */}\n {blockDefinition.variations && (\n <VariationSelector block={block} onUpdate={onUpdate} />\n )}\n\n {/* Propriedades agrupadas com collapse */}\n {Object.keys(groupedProps).length === 0 ? (\n <div className=\"text-center text-gray-500 dark:text-gray-400 text-xs py-4\">\n Nenhuma propriedade configurável\n </div>\n ) : (\n Object.entries(groupedProps).map(([groupName, props]) => (\n <CollapsiblePropertyGroup\n key={groupName}\n groupName={groupName}\n props={props}\n onPropChange={handlePropChange}\n onMultiUpdate={onUpdate}\n allProps={block?.props as Record<string, any>}\n uploadConfig={uploadConfig}\n isFocused={groupName === focusedGroup}\n />\n ))\n )}\n </div>\n );\n});\n"],"names":["THEME_COLOR_FALLBACKS","resolveThemeColorFallback","propName","themeColors","themeKey","color","BlockPropertyEditor","memo","block","document","currentPageId","onUpdate","uploadConfig","focusedGroup","blockDefinition","useMemo","componentRegistry","showWhenContext","lockedFields","restriction","pluginRegistry","groupedProps","props","defaultProps","groups","meta","evaluateShowWhen","group","currentValue","isColorInput","value","effectiveMeta","handlePropChange","useCallback","jsxs","jsx","BlockHeader","VariationSelector","groupName","CollapsiblePropertyGroup"],"mappings":";;;;;;;;AAoBA,MAAMA,IAAgD;AAAA;AAAA,EAEpD,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,wBAAwB;AAAA,EACxB,iBAAiB;AAAA;AAAA,EAEjB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA;AAAA,EAE1B,YAAY;AAAA,EACZ,gBAAgB;AAAA;AAAA,EAEhB,WAAW;AAAA,EACX,gBAAgB;AAAA;AAAA,EAEhB,aAAa;AAAA;AAAA,EAEb,OAAO;AAAA;AAAA,EAEP,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,kBAAkB;AAAA;AAAA,EAElB,IAAI;AACN;AAMA,SAASC,EACPC,GACAC,GACoB;AACpB,QAAMC,IAAWJ,EAAsBE,CAAQ;AAC/C,MAAI,CAACE,EAAU;AACf,QAAMC,IAAQF,EAAYC,CAAQ;AAClC,SAAO,OA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AAA,QACjB,cAAAI;AAAA,QACA,WAAW0B,MAAczB;AAAA,MAAA;AAAA,MAPpByB;AAAA,IAAA,CASR;AAAA,EAAA,GAEL,IAvCE,gBAAAJ,EAAC,OAAA,EAAI,WAAU,wCAAuC,UAAA;AAAA,IAAA;AAAA,IACvB1B,EAAM;AAAA,EAAA,GACrC,IAVA,gBAAA2B,EAAC,OAAA,EAAI,WAAU,4DAA2D,UAAA,kCAE1E;AA+CN,CAAC;"}
1
+ {"version":3,"file":"BlockPropertyEditor.js","sources":["../../../src/editor/PropertyEditor/BlockPropertyEditor.tsx"],"sourcesContent":["/**\n * Block Property Editor - Refatorado\n * Editor dinâmico de propriedades baseado em inspectorMeta\n */\n\nimport { memo, useMemo, useCallback } from \"react\";\nimport { Block, SiteDocument, componentRegistry, InspectorMeta, evaluateShowWhen, pluginRegistry } from \"../../engine\";\nimport type { ShowWhenContext } from \"../../engine\";\nimport { VariationSelector } from \"./VariationSelector\";\nimport { BlockHeader } from \"./BlockHeader\";\nimport { CollapsiblePropertyGroup } from \"./CollapsiblePropertyGroup\";\nimport type { UploadConfig } from \"../LandingPageEditor\";\n\n// ============================================================================\n// Theme Color Fallback Map\n// Maps color property names → theme color token keys.\n// Used when block.props[colorProp] and defaultProps[colorProp] are both undefined,\n// so the editor shows the actual theme color instead of #000000.\n// ============================================================================\n\nconst THEME_COLOR_FALLBACKS: Record<string, string> = {\n // Buttons (primary)\n primaryButtonColor: \"primary\",\n buttonColor: \"primary\",\n primaryButtonTextColor: \"primaryText\",\n buttonTextColor: \"primaryText\",\n // Buttons (secondary)\n secondaryButtonColor: \"secondary\",\n secondaryButtonTextColor: \"primaryText\",\n // Badge\n badgeColor: \"accent\",\n badgeTextColor: \"primaryText\",\n // Links\n linkColor: \"linkColor\",\n linkHoverColor: \"primary\",\n // Border\n borderColor: \"border\",\n // Generic text\n color: \"text\",\n // Title/description\n titleColor: \"text\",\n subtitleColor: \"mutedText\",\n descriptionColor: \"mutedText\",\n // Background (generic)\n bg: \"bg\",\n};\n\n/**\n * Resolve theme color fallback for a color property.\n * Returns the theme color value if a mapping exists, undefined otherwise.\n */\nfunction resolveThemeColorFallback(\n propName: string,\n themeColors: Record<string, unknown>,\n): string | undefined {\n const themeKey = THEME_COLOR_FALLBACKS[propName];\n if (!themeKey) return undefined;\n const color = themeColors[themeKey];\n return typeof color === \"string\" ? color : undefined;\n}\n\ninterface BlockPropertyEditorProps {\n block: Block | null;\n document?: SiteDocument;\n currentPageId?: string;\n onUpdate: (updates: Record<string, any>) => void;\n uploadConfig?: UploadConfig;\n /** When set, the matching property group opens and scrolls into view */\n focusedGroup?: string | null;\n}\n\n/**\n * Componente principal do editor de propriedades\n * Memoizado para performance\n */\nexport const BlockPropertyEditor = memo(function BlockPropertyEditor({\n block,\n document,\n currentPageId,\n onUpdate,\n uploadConfig,\n focusedGroup,\n}: BlockPropertyEditorProps) {\n // Obter definição do bloco do registry\n const blockDefinition = useMemo(() => {\n if (!block) return null;\n return componentRegistry.get(block.type);\n }, [block]);\n\n // Contexto para cross-block showWhen\n const showWhenContext = useMemo<ShowWhenContext>(\n () => ({ document, currentPageId }),\n [document, currentPageId],\n );\n\n // Obter restrições de edição do plugin (se houver)\n const lockedFields = useMemo(() => {\n if (!block || !document) return new Set<string>();\n const restriction = pluginRegistry.getEditorRestrictions(document, block.type);\n if (!restriction?.lockedFields) return new Set<string>();\n return new Set(restriction.lockedFields);\n }, [block, document]);\n\n // Agrupar propriedades por grupo\n const groupedProps = useMemo(() => {\n if (!block || !blockDefinition?.inspectorMeta) return {};\n\n const props = block.props as Record<string, any>;\n const defaultProps = (blockDefinition.defaultProps || {}) as Record<string, any>;\n const groups: Record<\n string,\n Array<{ propName: string; meta: InspectorMeta; value: any }>\n > = {};\n\n // Helper para ler props com dot-notation (ex: \"lightbox.showArrows\" -> props.lightbox.showArrows)\n const getNestedValue = (obj: Record<string, any>, path: string): any => {\n if (!path.includes('.')) return obj[path];\n const parts = path.split('.');\n let current: any = obj;\n for (const part of parts) {\n if (current == null) return undefined;\n current = current[part];\n }\n return current;\n };\n\n for (const [propName, meta] of Object.entries(\n blockDefinition.inspectorMeta,\n )) {\n // Visibilidade condicional via showWhen\n if (meta.showWhen) {\n if (!evaluateShowWhen(meta.showWhen, props, defaultProps, showWhenContext)) {\n continue;\n }\n }\n\n const group = meta.group || \"Geral\";\n if (!groups[group]) {\n groups[group] = [];\n }\n\n // Usar valor atual ou fallback para defaultProps, e depois theme colors\n const currentValue = getNestedValue(props, propName);\n // Para campos de cor, também fazer fallback se o valor for string vazia\n const isColorInput = meta.inputType === \"color\" || meta.inputType === \"color-advanced\";\n const shouldUseFallback = currentValue === undefined || (isColorInput && currentValue === \"\");\n let value = shouldUseFallback ? getNestedValue(defaultProps, propName) : currentValue;\n\n // Para color inputs sem valor definido, tentar fallback para cor do theme\n if (value === undefined && isColorInput && document?.theme?.colors) {\n value = resolveThemeColorFallback(\n propName,\n document.theme.colors as unknown as Record<string, unknown>,\n );\n }\n\n // Aplicar readOnly de plugin restrictions\n const effectiveMeta = lockedFields.has(propName)\n ? { ...meta, readOnly: true }\n : meta;\n\n groups[group].push({\n propName,\n meta: effectiveMeta,\n value,\n });\n }\n\n return groups;\n }, [block, blockDefinition, document, showWhenContext, lockedFields]);\n\n // IMPORTANTE: todos os hooks devem ser chamados ANTES de qualquer early return\n const handlePropChange = useCallback((propName: string, value: any) => {\n // Se remover o logo (definir como undefined), resetar logoHeight para padrão\n if (propName === \"logo\" && (value === undefined || value === \"\")) {\n onUpdate({ [propName]: value, logoHeight: 70 });\n } else {\n onUpdate({ [propName]: value });\n }\n }, [onUpdate]);\n\n if (!block) {\n return (\n <div className=\"p-4 text-center text-gray-500 dark:text-gray-400 text-sm\">\n Selecione um bloco para editar\n </div>\n );\n }\n\n if (!blockDefinition) {\n return (\n <div className=\"p-4 text-center text-red-500 text-sm\">\n Tipo de bloco desconhecido: {block.type}\n </div>\n );\n }\n\n return (\n <div className=\"p-3 space-y-4\">\n {/* Header com ícone centralizado */}\n <BlockHeader\n type={block.type}\n name={blockDefinition.name}\n description={blockDefinition.description}\n />\n\n {/* Seletor de variações (Hero/Navbar) */}\n {blockDefinition.variations && (\n <VariationSelector block={block} onUpdate={onUpdate} />\n )}\n\n {/* Propriedades agrupadas com collapse */}\n {Object.keys(groupedProps).length === 0 ? (\n <div className=\"text-center text-gray-500 dark:text-gray-400 text-xs py-4\">\n Nenhuma propriedade configurável\n </div>\n ) : (\n Object.entries(groupedProps).map(([groupName, props]) => (\n <CollapsiblePropertyGroup\n key={groupName}\n groupName={groupName}\n props={props}\n onPropChange={handlePropChange}\n onMultiUpdate={onUpdate}\n allProps={block?.props as Record<string, any>}\n uploadConfig={uploadConfig}\n isFocused={groupName === focusedGroup}\n />\n ))\n )}\n </div>\n );\n});\n"],"names":["THEME_COLOR_FALLBACKS","resolveThemeColorFallback","propName","themeColors","themeKey","color","BlockPropertyEditor","memo","block","document","currentPageId","onUpdate","uploadConfig","focusedGroup","blockDefinition","useMemo","componentRegistry","showWhenContext","lockedFields","restriction","pluginRegistry","groupedProps","props","defaultProps","groups","getNestedValue","obj","path","parts","current","part","meta","evaluateShowWhen","group","currentValue","isColorInput","value","effectiveMeta","handlePropChange","useCallback","jsxs","jsx","BlockHeader","VariationSelector","groupName","CollapsiblePropertyGroup"],"mappings":";;;;;;;;AAoBA,MAAMA,IAAgD;AAAA;AAAA,EAEpD,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,wBAAwB;AAAA,EACxB,iBAAiB;AAAA;AAAA,EAEjB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA;AAAA,EAE1B,YAAY;AAAA,EACZ,gBAAgB;AAAA;AAAA,EAEhB,WAAW;AAAA,EACX,gBAAgB;AAAA;AAAA,EAEhB,aAAa;AAAA;AAAA,EAEb,OAAO;AAAA;AAAA,EAEP,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,kBAAkB;AAAA;AAAA,EAElB,IAAI;AACN;AAMA,SAASC,EACPC,GACAC,GAC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E,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;IAiBhG;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,GAAG,GACT,KAAK;IAIR;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK;IAKhE;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK;IAShE;;OAEG;IACH,MAAM,CAAC,UAAU,CACf,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,GAC5C,KAAK;IAeR;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK;CAG3C"}
@@ -1,13 +1,13 @@
1
- function $(f, n, e) {
2
- for (let r = 0; r < f.length; r++) {
3
- const a = f[r], o = `${e}/${r}`;
1
+ function $(u, n, e) {
2
+ for (let r = 0; r < u.length; r++) {
3
+ const a = u[r], o = `${e}/${r}`;
4
4
  if (a.id === n)
5
5
  return { path: o, block: a, parentIndex: r };
6
6
  const t = a.props;
7
7
  if (t?.children && Array.isArray(t.children)) {
8
- const p = `${o}/props/children`, c = $(t.children, n, p);
9
- if (c)
10
- return c;
8
+ const p = `${o}/props/children`, h = $(t.children, n, p);
9
+ if (h)
10
+ return h;
11
11
  }
12
12
  if (a.type === "card") {
13
13
  if (t.header && Array.isArray(t.header)) {
@@ -26,33 +26,41 @@ function $(f, n, e) {
26
26
  }
27
27
  return null;
28
28
  }
29
- function u(f, n, e) {
30
- const r = f.pages.find((p) => p.id === n);
29
+ function d(u, n, e) {
30
+ const r = u.pages.find((p) => p.id === n);
31
31
  if (!r) return null;
32
- const o = `/pages/${f.pages.indexOf(r)}/structure`, t = $(r.structure, e, o);
32
+ const o = `/pages/${u.pages.indexOf(r)}/structure`, t = $(r.structure, e, o);
33
33
  return t ? { path: t.path, block: t.block } : null;
34
34
  }
35
- class g {
35
+ class v {
36
36
  /**
37
37
  * Cria patch para atualizar uma propriedade de um bloco
38
38
  */
39
39
  static updateBlockProp(n, e, r, a, o) {
40
- const t = u(n, e, r);
40
+ const t = d(n, e, r);
41
41
  if (!t)
42
42
  throw new Error(`Block ${r} not found in page ${e}`);
43
- return [{ op: "replace", path: `${t.path}/props/${a}`, value: o }];
43
+ return [{ op: "replace", path: `${t.path}/props/${a.replace(/\./g, "/")}`, value: o }];
44
44
  }
45
45
  /**
46
46
  * Cria patch para atualizar múltiplas propriedades de um bloco
47
47
  */
48
48
  static updateBlockProps(n, e, r, a) {
49
- const o = [], t = u(n, e, r);
49
+ const o = [], t = d(n, e, r);
50
50
  if (!t)
51
51
  throw new Error(`Block ${r} not found in page ${e}`);
52
52
  const p = t.block.props;
53
- for (const [c, s] of Object.entries(a)) {
54
- const i = `${t.path}/props/${c}`;
55
- c in p ? o.push({ op: "replace", path: i, value: s }) : o.push({ op: "add", path: i, value: s });
53
+ for (const [h, s] of Object.entries(a)) {
54
+ const l = h.replace(/\./g, "/"), i = `${t.path}/props/${l}`, c = h.split(".");
55
+ let f = !0, g = p;
56
+ for (const P of c) {
57
+ if (g == null || !(P in g)) {
58
+ f = !1;
59
+ break;
60
+ }
61
+ g = g[P];
62
+ }
63
+ f ? o.push({ op: "replace", path: i, value: s }) : o.push({ op: "add", path: i, value: s });
56
64
  }
57
65
  return o;
58
66
  }
@@ -60,32 +68,32 @@ class g {
60
68
  * Cria patch para adicionar um bloco
61
69
  */
62
70
  static addBlock(n, e, r, a, o) {
63
- const t = n.pages.find((h) => h.id === e);
71
+ const t = n.pages.find((c) => c.id === e);
64
72
  if (!t)
65
73
  throw new Error(`Page ${e} not found`);
66
74
  if (!a) {
67
- const h = o !== void 0 ? o : t.structure.length;
68
- return [{ op: "add", path: `/pages/${n.pages.indexOf(t)}/structure/${h}`, value: r }];
75
+ const c = o !== void 0 ? o : t.structure.length;
76
+ return [{ op: "add", path: `/pages/${n.pages.indexOf(t)}/structure/${c}`, value: r }];
69
77
  }
70
- const p = u(n, e, a);
78
+ const p = d(n, e, a);
71
79
  if (!p)
72
80
  throw new Error(`Parent block ${a} not found`);
73
81
  const s = p.block.props;
74
82
  if (!s.children || !Array.isArray(s.children)) {
75
- const h = `${p.path}/props/children`;
83
+ const c = `${p.path}/props/children`;
76
84
  return [
77
- { op: "add", path: h, value: [] },
78
- { op: "add", path: `${h}/${o !== void 0 ? o : 0}`, value: r }
85
+ { op: "add", path: c, value: [] },
86
+ { op: "add", path: `${c}/${o !== void 0 ? o : 0}`, value: r }
79
87
  ];
80
88
  }
81
- const i = `${p.path}/props/children`, d = o !== void 0 ? o : s.children.length;
82
- return [{ op: "add", path: `${i}/${d}`, value: r }];
89
+ const l = `${p.path}/props/children`, i = o !== void 0 ? o : s.children.length;
90
+ return [{ op: "add", path: `${l}/${i}`, value: r }];
83
91
  }
84
92
  /**
85
93
  * Cria patch para remover um bloco
86
94
  */
87
95
  static removeBlock(n, e, r) {
88
- const a = u(n, e, r);
96
+ const a = d(n, e, r);
89
97
  if (!a)
90
98
  throw new Error(`Block ${r} not found in page ${e}`);
91
99
  return [{ op: "remove", path: a.path }];
@@ -94,25 +102,25 @@ class g {
94
102
  * Cria patch para mover um bloco
95
103
  */
96
104
  static moveBlock(n, e, r, a, o) {
97
- const t = u(n, e, r);
105
+ const t = d(n, e, r);
98
106
  if (!t)
99
107
  throw new Error(`Block ${r} not found in page ${e}`);
100
- const p = n.pages.find((l) => l.id === e), c = n.pages.indexOf(p);
108
+ const p = n.pages.find((f) => f.id === e), h = n.pages.indexOf(p);
101
109
  if (a === null) {
102
- const l = `/pages/${c}/structure/${o}`;
103
- return [{ op: "move", from: t.path, path: l }];
110
+ const f = `/pages/${h}/structure/${o}`;
111
+ return [{ op: "move", from: t.path, path: f }];
104
112
  }
105
- const s = u(n, e, a);
113
+ const s = d(n, e, a);
106
114
  if (!s)
107
115
  throw new Error(`New parent block ${a} not found`);
108
- const i = s.block.props, d = `${s.path}/props/children`;
109
- if (!i.children || !Array.isArray(i.children))
116
+ const l = s.block.props, i = `${s.path}/props/children`;
117
+ if (!l.children || !Array.isArray(l.children))
110
118
  return [
111
- { op: "add", path: d, value: [] },
112
- { op: "move", from: t.path, path: `${d}/${o}` }
119
+ { op: "add", path: i, value: [] },
120
+ { op: "move", from: t.path, path: `${i}/${o}` }
113
121
  ];
114
- const h = `${d}/${o}`;
115
- return [{ op: "move", from: t.path, path: h }];
122
+ const c = `${i}/${o}`;
123
+ return [{ op: "move", from: t.path, path: c }];
116
124
  }
117
125
  /**
118
126
  * Cria patch para atualizar tema
@@ -168,6 +176,6 @@ class g {
168
176
  }
169
177
  }
170
178
  export {
171
- g as PatchBuilder
179
+ v as PatchBuilder
172
180
  };
173
181
  //# sourceMappingURL=PatchBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PatchBuilder.js","sources":["../../../src/engine/patch/PatchBuilder.ts"],"sourcesContent":["/**\n * Patch Builder\n * Helper para criar patches JSON Patch comuns\n */\n\nimport { Patch, PatchOperation } from './types'\nimport { SiteDocument, Block, SitePage } from '../schema/siteDocument'\n\n/**\n * Encontra o caminho JSON de um bloco na estrutura\n */\nfunction findBlockPath(\n structure: Block[],\n blockId: string,\n parentPath: string\n): { path: string; block: Block; parentIndex: number } | null {\n for (let i = 0; i < structure.length; i++) {\n const block = structure[i]\n const currentPath = `${parentPath}/${i}`\n\n if (block.id === blockId) {\n return { path: currentPath, block, parentIndex: i }\n }\n\n // Verificar children recursivamente\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) {\n const childPath = `${currentPath}/props/children`\n const found = findBlockPath(props.children as Block[], blockId, childPath)\n if (found) {\n return found\n }\n }\n\n // Verificar slots (para Card)\n if (block.type === 'card') {\n if (props.header && Array.isArray(props.header)) {\n const found = findBlockPath(props.header as Block[], blockId, `${currentPath}/props/header`)\n if (found) return found\n }\n if (props.content && Array.isArray(props.content)) {\n const found = findBlockPath(props.content as Block[], blockId, `${currentPath}/props/content`)\n if (found) return found\n }\n if (props.footer && Array.isArray(props.footer)) {\n const found = findBlockPath(props.footer as Block[], blockId, `${currentPath}/props/footer`)\n if (found) return found\n }\n }\n }\n\n return null\n}\n\n/**\n * Encontra o caminho de um bloco em uma página específica\n */\nfunction findBlockPathInPage(\n document: SiteDocument,\n pageId: string,\n blockId: string\n): { path: string; block: Block } | null {\n const page = document.pages.find((p) => p.id === pageId)\n if (!page) return null\n\n const pageIndex = document.pages.indexOf(page)\n const structurePath = `/pages/${pageIndex}/structure`\n const result = findBlockPath(page.structure, blockId, structurePath)\n if (!result) return null\n\n return { path: result.path, block: result.block }\n}\n\n/**\n * Patch Builder - Helper para criar patches comuns\n */\nexport class PatchBuilder {\n /**\n * Cria patch para atualizar uma propriedade de um bloco\n */\n static updateBlockProp(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n propName: string,\n value: any\n ): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n const propPath = `${blockInfo.path}/props/${propName}`\n return [{ op: 'replace', path: propPath, value }]\n }\n\n /**\n * Cria patch para atualizar múltiplas propriedades de um bloco\n */\n static updateBlockProps(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n updates: Record<string, any>\n ): Patch {\n const patches: PatchOperation[] = []\n\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n // Verificar quais propriedades já existem\n const existingProps = blockInfo.block.props as Record<string, any>\n\n for (const [propName, value] of Object.entries(updates)) {\n const propPath = `${blockInfo.path}/props/${propName}`\n \n // Se a propriedade já existe, usar replace; caso contrário, usar add\n if (propName in existingProps) {\n patches.push({ op: 'replace', path: propPath, value })\n } else {\n patches.push({ op: 'add', path: propPath, value })\n }\n }\n\n return patches\n }\n\n /**\n * Cria patch para adicionar um bloco\n */\n static addBlock(\n document: SiteDocument,\n pageId: string,\n newBlock: Block,\n parentBlockId?: string,\n position?: number\n ): Patch {\n const page = document.pages.find((p) => p.id === pageId)\n if (!page) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n // Se não especificar parent, adiciona na raiz da página\n if (!parentBlockId) {\n const targetIndex = position !== undefined ? position : page.structure.length\n const path = `/pages/${document.pages.indexOf(page)}/structure/${targetIndex}`\n return [{ op: 'add', path, value: newBlock }]\n }\n\n // Encontrar parent block\n const parentInfo = findBlockPathInPage(document, pageId, parentBlockId)\n if (!parentInfo) {\n throw new Error(`Parent block ${parentBlockId} not found`)\n }\n\n // Verificar se parent tem children\n const parentBlock = parentInfo.block\n const props = parentBlock.props as Record<string, any>\n\n if (!props.children || !Array.isArray(props.children)) {\n // Criar array de children primeiro\n const childrenPath = `${parentInfo.path}/props/children`\n const targetIndex = position !== undefined ? position : 0\n return [\n { op: 'add', path: childrenPath, value: [] },\n { op: 'add', path: `${childrenPath}/${targetIndex}`, value: newBlock },\n ]\n }\n\n // Adicionar ao array de children existente\n const childrenPath = `${parentInfo.path}/props/children`\n const targetIndex = position !== undefined ? position : props.children.length\n return [{ op: 'add', path: `${childrenPath}/${targetIndex}`, value: newBlock }]\n }\n\n /**\n * Cria patch para remover um bloco\n */\n static removeBlock(document: SiteDocument, pageId: string, blockId: string): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n return [{ op: 'remove', path: blockInfo.path }]\n }\n\n /**\n * Cria patch para mover um bloco\n */\n static moveBlock(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n newParentBlockId: string | null,\n newPosition: number\n ): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n const page = document.pages.find((p) => p.id === pageId)!\n const pageIndex = document.pages.indexOf(page)\n\n // Se newParentBlockId é null, move para raiz da página\n if (newParentBlockId === null) {\n const newPath = `/pages/${pageIndex}/structure/${newPosition}`\n return [{ op: 'move', from: blockInfo.path, path: newPath }]\n }\n\n // Encontrar novo parent\n const newParentInfo = findBlockPathInPage(document, pageId, newParentBlockId)\n if (!newParentInfo) {\n throw new Error(`New parent block ${newParentBlockId} not found`)\n }\n\n const newParentProps = newParentInfo.block.props as Record<string, any>\n const childrenPath = `${newParentInfo.path}/props/children`\n\n // Se parent não tem children, criar array primeiro\n if (!newParentProps.children || !Array.isArray(newParentProps.children)) {\n return [\n { op: 'add', path: childrenPath, value: [] },\n { op: 'move', from: blockInfo.path, path: `${childrenPath}/${newPosition}` },\n ]\n }\n\n // Mover para children do novo parent\n const newPath = `${childrenPath}/${newPosition}`\n return [{ op: 'move', from: blockInfo.path, path: newPath }]\n }\n\n /**\n * Cria patch para atualizar tema\n */\n static updateTheme(_document: SiteDocument, themeUpdates: Partial<SiteDocument['theme']>): Patch {\n const patches: PatchOperation[] = []\n\n for (const [key, value] of Object.entries(themeUpdates)) {\n // Se for um objeto (como colors), atualizar propriedades individuais\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n for (const [subKey, subValue] of Object.entries(value)) {\n patches.push({ op: 'replace', path: `/theme/${key}/${subKey}`, value: subValue })\n }\n } else {\n patches.push({ op: 'replace', path: `/theme/${key}`, value })\n }\n }\n\n return patches\n }\n\n /**\n * Cria patch para atualizar propriedade do tema\n */\n static updateThemeProp(\n _document: SiteDocument,\n themePath: string,\n value: any\n ): Patch {\n return [{ op: 'replace', path: `/theme/${themePath}`, value }]\n }\n\n /**\n * Cria patch para adicionar uma nova página\n */\n static addPage(document: SiteDocument, newPage: SitePage): Patch {\n const position = document.pages.length\n return [{ op: 'add', path: `/pages/${position}`, value: newPage }]\n }\n\n /**\n * Cria patch para remover uma página\n */\n static removePage(document: SiteDocument, pageId: string): Patch {\n const pageIndex = document.pages.findIndex((p) => p.id === pageId)\n if (pageIndex === -1) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n return [{ op: 'remove', path: `/pages/${pageIndex}` }]\n }\n\n /**\n * Cria patch para atualizar propriedades de uma página\n */\n static updatePage(\n document: SiteDocument,\n pageId: string,\n updates: Partial<Omit<SitePage, 'structure'>>\n ): Patch {\n const pageIndex = document.pages.findIndex((p) => p.id === pageId)\n if (pageIndex === -1) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n const patches: PatchOperation[] = []\n\n for (const [key, value] of Object.entries(updates)) {\n patches.push({ op: 'replace', path: `/pages/${pageIndex}/${key}`, value })\n }\n\n return patches\n }\n\n /**\n * Combina múltiplos patches em um único patch\n */\n static combine(...patches: Patch[]): Patch {\n return patches.flat()\n }\n}\n"],"names":["findBlockPath","structure","blockId","parentPath","i","block","currentPath","props","childPath","found","findBlockPathInPage","document","pageId","page","structurePath","result","PatchBuilder","propName","value","blockInfo","updates","patches","existingProps","propPath","newBlock","parentBlockId","position","p","targetIndex","parentInfo","childrenPath","newParentBlockId","newPosition","pageIndex","newPath","newParentInfo","newParentProps","_document","themeUpdates","key","subKey","subValue","themePath","newPage"],"mappings":"AAWA,SAASA,EACPC,GACAC,GACAC,GAC4D;AAC5D,WAASC,IAAI,GAAGA,IAAIH,EAAU,QAAQG,KAAK;AACzC,UAAMC,IAAQJ,EAAUG,CAAC,GACnBE,IAAc,GAAGH,CAAU,IAAIC,CAAC;AAEtC,QAAIC,EAAM,OAAOH;AACf,aAAO,EAAE,MAAMI,GAAa,OAAAD,GAAO,aAAaD,EAAA;AAIlD,UAAMG,IAAQF,EAAM;AACpB,QAAIE,GAAO,YAAY,MAAM,QAAQA,EAAM,QAAQ,GAAG;AACpD,YAAMC,IAAY,GAAGF,CAAW,mBAC1BG,IAAQT,EAAcO,EAAM,UAAqBL,GAASM,CAAS;AACzE,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AAOgC,GAAS;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,WAAWhC,GAAwBC,GAAuB;AAC/D,UAAMqB,IAAYtB,EAAS,MAAM,UAAU,CAACgB,MAAMA,EAAE,OAAOf,CAAM;AACjE,QAAIqB,MAAc;AAChB,YAAM,IAAI,MAAM,QAAQrB,CAAM,YAAY;AAG5C,WAAO,CAAC,EAAE,IAAI,UAAU,MAAM,UAAUqB,CAAS,IAAI;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,WACLtB,GACAC,GACAQ,GACO;AACP,UAAMa,IAAYtB,EAAS,MAAM,UAAU,CAACgB,MAAMA,EAAE,OAAOf,CAAM;AACjE,QAAIqB,MAAc;AAChB,YAAM,IAAI,MAAM,QAAQrB,CAAM,YAAY;AAG5C,UAAMS,IAA4B,CAAA;AAElC,eAAW,CAACkB,GAAKrB,CAAK,KAAK,OAAO,QAAQE,CAAO;AAC/C,MAAAC,EAAQ,KAAK,EAAE,IAAI,WAAW,MAAM,UAAUY,CAAS,IAAIM,CAAG,IAAI,OAAArB,EAAA,CAAO;AAG3E,WAAOG;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,WAAWA,GAAyB;AACzC,WAAOA,EAAQ,KAAA;AAAA,EACjB;AACF;"}
1
+ {"version":3,"file":"PatchBuilder.js","sources":["../../../src/engine/patch/PatchBuilder.ts"],"sourcesContent":["/**\n * Patch Builder\n * Helper para criar patches JSON Patch comuns\n */\n\nimport { Patch, PatchOperation } from './types'\nimport { SiteDocument, Block, SitePage } from '../schema/siteDocument'\n\n/**\n * Encontra o caminho JSON de um bloco na estrutura\n */\nfunction findBlockPath(\n structure: Block[],\n blockId: string,\n parentPath: string\n): { path: string; block: Block; parentIndex: number } | null {\n for (let i = 0; i < structure.length; i++) {\n const block = structure[i]\n const currentPath = `${parentPath}/${i}`\n\n if (block.id === blockId) {\n return { path: currentPath, block, parentIndex: i }\n }\n\n // Verificar children recursivamente\n const props = block.props as Record<string, any>;\n if (props?.children && Array.isArray(props.children)) {\n const childPath = `${currentPath}/props/children`\n const found = findBlockPath(props.children as Block[], blockId, childPath)\n if (found) {\n return found\n }\n }\n\n // Verificar slots (para Card)\n if (block.type === 'card') {\n if (props.header && Array.isArray(props.header)) {\n const found = findBlockPath(props.header as Block[], blockId, `${currentPath}/props/header`)\n if (found) return found\n }\n if (props.content && Array.isArray(props.content)) {\n const found = findBlockPath(props.content as Block[], blockId, `${currentPath}/props/content`)\n if (found) return found\n }\n if (props.footer && Array.isArray(props.footer)) {\n const found = findBlockPath(props.footer as Block[], blockId, `${currentPath}/props/footer`)\n if (found) return found\n }\n }\n }\n\n return null\n}\n\n/**\n * Encontra o caminho de um bloco em uma página específica\n */\nfunction findBlockPathInPage(\n document: SiteDocument,\n pageId: string,\n blockId: string\n): { path: string; block: Block } | null {\n const page = document.pages.find((p) => p.id === pageId)\n if (!page) return null\n\n const pageIndex = document.pages.indexOf(page)\n const structurePath = `/pages/${pageIndex}/structure`\n const result = findBlockPath(page.structure, blockId, structurePath)\n if (!result) return null\n\n return { path: result.path, block: result.block }\n}\n\n/**\n * Patch Builder - Helper para criar patches comuns\n */\nexport class PatchBuilder {\n /**\n * Cria patch para atualizar uma propriedade de um bloco\n */\n static updateBlockProp(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n propName: string,\n value: any\n ): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n // Expandir dot-notation: \"lightbox.showArrows\" -> \"lightbox/showArrows\"\n const propPath = `${blockInfo.path}/props/${propName.replace(/\\./g, '/')}`\n return [{ op: 'replace', path: propPath, value }]\n }\n\n /**\n * Cria patch para atualizar múltiplas propriedades de um bloco\n */\n static updateBlockProps(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n updates: Record<string, any>\n ): Patch {\n const patches: PatchOperation[] = []\n\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n // Verificar quais propriedades já existem\n const existingProps = blockInfo.block.props as Record<string, any>\n\n for (const [propName, value] of Object.entries(updates)) {\n // Expandir dot-notation: \"lightbox.showArrows\" -> \"lightbox/showArrows\"\n const expandedName = propName.replace(/\\./g, '/')\n const propPath = `${blockInfo.path}/props/${expandedName}`\n\n // Verificar existencia considerando nested path\n const parts = propName.split('.')\n let exists = true\n let current: any = existingProps\n for (const part of parts) {\n if (current == null || !(part in current)) {\n exists = false\n break\n }\n current = current[part]\n }\n\n if (exists) {\n patches.push({ op: 'replace', path: propPath, value })\n } else {\n patches.push({ op: 'add', path: propPath, value })\n }\n }\n\n return patches\n }\n\n /**\n * Cria patch para adicionar um bloco\n */\n static addBlock(\n document: SiteDocument,\n pageId: string,\n newBlock: Block,\n parentBlockId?: string,\n position?: number\n ): Patch {\n const page = document.pages.find((p) => p.id === pageId)\n if (!page) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n // Se não especificar parent, adiciona na raiz da página\n if (!parentBlockId) {\n const targetIndex = position !== undefined ? position : page.structure.length\n const path = `/pages/${document.pages.indexOf(page)}/structure/${targetIndex}`\n return [{ op: 'add', path, value: newBlock }]\n }\n\n // Encontrar parent block\n const parentInfo = findBlockPathInPage(document, pageId, parentBlockId)\n if (!parentInfo) {\n throw new Error(`Parent block ${parentBlockId} not found`)\n }\n\n // Verificar se parent tem children\n const parentBlock = parentInfo.block\n const props = parentBlock.props as Record<string, any>\n\n if (!props.children || !Array.isArray(props.children)) {\n // Criar array de children primeiro\n const childrenPath = `${parentInfo.path}/props/children`\n const targetIndex = position !== undefined ? position : 0\n return [\n { op: 'add', path: childrenPath, value: [] },\n { op: 'add', path: `${childrenPath}/${targetIndex}`, value: newBlock },\n ]\n }\n\n // Adicionar ao array de children existente\n const childrenPath = `${parentInfo.path}/props/children`\n const targetIndex = position !== undefined ? position : props.children.length\n return [{ op: 'add', path: `${childrenPath}/${targetIndex}`, value: newBlock }]\n }\n\n /**\n * Cria patch para remover um bloco\n */\n static removeBlock(document: SiteDocument, pageId: string, blockId: string): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n return [{ op: 'remove', path: blockInfo.path }]\n }\n\n /**\n * Cria patch para mover um bloco\n */\n static moveBlock(\n document: SiteDocument,\n pageId: string,\n blockId: string,\n newParentBlockId: string | null,\n newPosition: number\n ): Patch {\n const blockInfo = findBlockPathInPage(document, pageId, blockId)\n if (!blockInfo) {\n throw new Error(`Block ${blockId} not found in page ${pageId}`)\n }\n\n const page = document.pages.find((p) => p.id === pageId)!\n const pageIndex = document.pages.indexOf(page)\n\n // Se newParentBlockId é null, move para raiz da página\n if (newParentBlockId === null) {\n const newPath = `/pages/${pageIndex}/structure/${newPosition}`\n return [{ op: 'move', from: blockInfo.path, path: newPath }]\n }\n\n // Encontrar novo parent\n const newParentInfo = findBlockPathInPage(document, pageId, newParentBlockId)\n if (!newParentInfo) {\n throw new Error(`New parent block ${newParentBlockId} not found`)\n }\n\n const newParentProps = newParentInfo.block.props as Record<string, any>\n const childrenPath = `${newParentInfo.path}/props/children`\n\n // Se parent não tem children, criar array primeiro\n if (!newParentProps.children || !Array.isArray(newParentProps.children)) {\n return [\n { op: 'add', path: childrenPath, value: [] },\n { op: 'move', from: blockInfo.path, path: `${childrenPath}/${newPosition}` },\n ]\n }\n\n // Mover para children do novo parent\n const newPath = `${childrenPath}/${newPosition}`\n return [{ op: 'move', from: blockInfo.path, path: newPath }]\n }\n\n /**\n * Cria patch para atualizar tema\n */\n static updateTheme(_document: SiteDocument, themeUpdates: Partial<SiteDocument['theme']>): Patch {\n const patches: PatchOperation[] = []\n\n for (const [key, value] of Object.entries(themeUpdates)) {\n // Se for um objeto (como colors), atualizar propriedades individuais\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n for (const [subKey, subValue] of Object.entries(value)) {\n patches.push({ op: 'replace', path: `/theme/${key}/${subKey}`, value: subValue })\n }\n } else {\n patches.push({ op: 'replace', path: `/theme/${key}`, value })\n }\n }\n\n return patches\n }\n\n /**\n * Cria patch para atualizar propriedade do tema\n */\n static updateThemeProp(\n _document: SiteDocument,\n themePath: string,\n value: any\n ): Patch {\n return [{ op: 'replace', path: `/theme/${themePath}`, value }]\n }\n\n /**\n * Cria patch para adicionar uma nova página\n */\n static addPage(document: SiteDocument, newPage: SitePage): Patch {\n const position = document.pages.length\n return [{ op: 'add', path: `/pages/${position}`, value: newPage }]\n }\n\n /**\n * Cria patch para remover uma página\n */\n static removePage(document: SiteDocument, pageId: string): Patch {\n const pageIndex = document.pages.findIndex((p) => p.id === pageId)\n if (pageIndex === -1) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n return [{ op: 'remove', path: `/pages/${pageIndex}` }]\n }\n\n /**\n * Cria patch para atualizar propriedades de uma página\n */\n static updatePage(\n document: SiteDocument,\n pageId: string,\n updates: Partial<Omit<SitePage, 'structure'>>\n ): Patch {\n const pageIndex = document.pages.findIndex((p) => p.id === pageId)\n if (pageIndex === -1) {\n throw new Error(`Page ${pageId} not found`)\n }\n\n const patches: PatchOperation[] = []\n\n for (const [key, value] of Object.entries(updates)) {\n patches.push({ op: 'replace', path: `/pages/${pageIndex}/${key}`, value })\n }\n\n return patches\n }\n\n /**\n * Combina múltiplos patches em um único patch\n */\n static combine(...patches: Patch[]): Patch {\n return patches.flat()\n }\n}\n"],"names":["findBlockPath","structure","blockId","parentPath","i","block","currentPath","props","childPath","found","findBlockPathInPage","document","pageId","page","structurePath","result","PatchBuilder","propName","value","blockInfo","updates","patches","existingProps","expandedName","propPath","parts","exists","current","part","newBlock","parentBlockId","position","p","targetIndex","parentInfo","childrenPath","newParentBlockId","newPosition","pageIndex","newPath","newParentInfo","newParentProps","_document","themeUpdates","key","subKey","subValue","themePath","newPage"],"mappings":"AAWA,SAASA,EACPC,GACAC,GACAC,GAC4D;AAC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AAW,CAACuB,GAAK1B,CAAK,KAAK,OAAO,QAAQE,CAAO;AAC/C,MAAAC,EAAQ,KAAK,EAAE,IAAI,WAAW,MAAM,UAAUiB,CAAS,IAAIM,CAAG,IAAI,OAAA1B,EAAA,CAAO;AAG3E,WAAOG;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,WAAWA,GAAyB;AACzC,WAAOA,EAAQ,KAAA;AAAA,EACjB;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunoalz/smartgesti-site-editor",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Site editor component for SmartGesti platform",