@easybits.cloud/html-tailwind-generator 0.2.134 → 0.2.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components4.d.ts +10 -5
- package/dist/components4.js +210 -54
- package/dist/components4.js.map +1 -1
- package/package.json +1 -1
package/dist/components4.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ interface BrandKitItem {
|
|
|
41
41
|
logoUrl?: string | null;
|
|
42
42
|
isDefault?: boolean;
|
|
43
43
|
}
|
|
44
|
-
interface Props$
|
|
44
|
+
interface Props$2 {
|
|
45
45
|
initialHtml: string;
|
|
46
46
|
theme?: string;
|
|
47
47
|
customColors?: Record<string, string>;
|
|
@@ -89,7 +89,7 @@ declare const PANEL_TABS: readonly [{
|
|
|
89
89
|
readonly icon: "◈";
|
|
90
90
|
}];
|
|
91
91
|
type PanelId = (typeof PANEL_TABS)[number]["id"];
|
|
92
|
-
declare const GrapesEditor: React.ForwardRefExoticComponent<Props$
|
|
92
|
+
declare const GrapesEditor: React.ForwardRefExoticComponent<Props$2 & React.RefAttributes<GrapesEditorHandle>>;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Predefined blocks for GrapesJS editor.
|
|
@@ -111,13 +111,18 @@ declare const LANDING_BLOCKS: ({
|
|
|
111
111
|
media: string;
|
|
112
112
|
})[];
|
|
113
113
|
|
|
114
|
-
interface Props {
|
|
114
|
+
interface Props$1 {
|
|
115
115
|
editor: Editor | null;
|
|
116
116
|
/** Bumped when theme/customColors change — forces color preview re-resolve */
|
|
117
117
|
themeVersion?: number;
|
|
118
118
|
/** Resolved theme colors keyed by semantic name (e.g. "primary" → "#6366f1") */
|
|
119
119
|
themeColors?: Record<string, string>;
|
|
120
120
|
}
|
|
121
|
-
declare function TailwindClassEditor({ editor, themeVersion, themeColors }: Props): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function TailwindClassEditor({ editor, themeVersion, themeColors }: Props$1): react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
interface Props {
|
|
124
|
+
editor: Editor | null;
|
|
125
|
+
}
|
|
126
|
+
declare function ImageSrcEditor({ editor }: Props): react_jsx_runtime.JSX.Element | null;
|
|
122
127
|
|
|
123
|
-
export { type AiAction, GrapesEditor, type GrapesEditorHandle, LANDING_BLOCKS, type PanelId, TailwindClassEditor };
|
|
128
|
+
export { type AiAction, GrapesEditor, type GrapesEditorHandle, ImageSrcEditor, LANDING_BLOCKS, type PanelId, TailwindClassEditor };
|
package/dist/components4.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-VV5I53WR.js";
|
|
6
6
|
|
|
7
7
|
// src/components4/GrapesEditor.tsx
|
|
8
|
-
import { useEffect as
|
|
8
|
+
import { useEffect as useEffect3, useRef as useRef2, useState as useState3, forwardRef, useImperativeHandle } from "react";
|
|
9
9
|
|
|
10
10
|
// src/components4/blocks.ts
|
|
11
11
|
var LANDING_BLOCKS = [
|
|
@@ -1015,6 +1015,158 @@ function TailwindClassEditor({ editor, themeVersion = 0, themeColors = {} }) {
|
|
|
1015
1015
|
] });
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
+
// src/components4/ImageSrcEditor.tsx
|
|
1019
|
+
import { useEffect as useEffect2, useState as useState2, useCallback as useCallback2 } from "react";
|
|
1020
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1021
|
+
function readSrc(component) {
|
|
1022
|
+
if (!component) return "";
|
|
1023
|
+
const attrs = component.getAttributes?.() || {};
|
|
1024
|
+
return attrs.src || "";
|
|
1025
|
+
}
|
|
1026
|
+
function readAlt(component) {
|
|
1027
|
+
if (!component) return "";
|
|
1028
|
+
const attrs = component.getAttributes?.() || {};
|
|
1029
|
+
return attrs.alt || "";
|
|
1030
|
+
}
|
|
1031
|
+
function isImageComponent(component) {
|
|
1032
|
+
if (!component) return false;
|
|
1033
|
+
if (component.get?.("type") === "image") return true;
|
|
1034
|
+
const el = component.getEl?.();
|
|
1035
|
+
return el?.tagName === "IMG";
|
|
1036
|
+
}
|
|
1037
|
+
function isValidHttpUrl(value) {
|
|
1038
|
+
if (!value) return false;
|
|
1039
|
+
try {
|
|
1040
|
+
const u = new URL(value);
|
|
1041
|
+
return u.protocol === "http:" || u.protocol === "https:";
|
|
1042
|
+
} catch {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function ImageSrcEditor({ editor }) {
|
|
1047
|
+
const [selectedComponent, setSelectedComponent] = useState2(null);
|
|
1048
|
+
const [isImg, setIsImg] = useState2(false);
|
|
1049
|
+
const [src, setSrc] = useState2("");
|
|
1050
|
+
const [alt, setAlt] = useState2("");
|
|
1051
|
+
const [previewError, setPreviewError] = useState2(false);
|
|
1052
|
+
const apply = useCallback2((next) => {
|
|
1053
|
+
if (!selectedComponent) return;
|
|
1054
|
+
selectedComponent.addAttributes?.(next);
|
|
1055
|
+
const el = selectedComponent.getEl?.();
|
|
1056
|
+
if (el) {
|
|
1057
|
+
if (next.src !== void 0) el.setAttribute("src", next.src);
|
|
1058
|
+
if (next.alt !== void 0) el.setAttribute("alt", next.alt);
|
|
1059
|
+
}
|
|
1060
|
+
editor?.trigger("sidebar:change");
|
|
1061
|
+
}, [editor, selectedComponent]);
|
|
1062
|
+
const applySrc = useCallback2(() => {
|
|
1063
|
+
if (!isValidHttpUrl(src)) return;
|
|
1064
|
+
apply({ src });
|
|
1065
|
+
}, [apply, src]);
|
|
1066
|
+
const applyAlt = useCallback2(() => {
|
|
1067
|
+
apply({ alt });
|
|
1068
|
+
}, [apply, alt]);
|
|
1069
|
+
useEffect2(() => {
|
|
1070
|
+
if (!editor) return;
|
|
1071
|
+
const onSelected = (component) => {
|
|
1072
|
+
setSelectedComponent(component);
|
|
1073
|
+
const img = isImageComponent(component);
|
|
1074
|
+
setIsImg(img);
|
|
1075
|
+
if (img) {
|
|
1076
|
+
setSrc(readSrc(component));
|
|
1077
|
+
setAlt(readAlt(component));
|
|
1078
|
+
setPreviewError(false);
|
|
1079
|
+
} else {
|
|
1080
|
+
setSrc("");
|
|
1081
|
+
setAlt("");
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
const onDeselected = () => {
|
|
1085
|
+
setSelectedComponent(null);
|
|
1086
|
+
setIsImg(false);
|
|
1087
|
+
setSrc("");
|
|
1088
|
+
setAlt("");
|
|
1089
|
+
};
|
|
1090
|
+
editor.on("component:selected", onSelected);
|
|
1091
|
+
editor.on("component:deselected", onDeselected);
|
|
1092
|
+
const current = editor.getSelected();
|
|
1093
|
+
if (current) onSelected(current);
|
|
1094
|
+
return () => {
|
|
1095
|
+
editor.off("component:selected", onSelected);
|
|
1096
|
+
editor.off("component:deselected", onDeselected);
|
|
1097
|
+
};
|
|
1098
|
+
}, [editor]);
|
|
1099
|
+
if (!isImg) return null;
|
|
1100
|
+
const urlValid = isValidHttpUrl(src);
|
|
1101
|
+
return /* @__PURE__ */ jsxs2("div", { className: "p-3 border-b border-gray-800 bg-gray-900/50", children: [
|
|
1102
|
+
/* @__PURE__ */ jsx2("p", { className: "text-[10px] text-gray-400 font-bold uppercase tracking-wider mb-2", children: "Imagen" }),
|
|
1103
|
+
src && !previewError && /* @__PURE__ */ jsx2("div", { className: "mb-2 rounded-md overflow-hidden border border-gray-700 bg-gray-950", style: { aspectRatio: "16 / 9" }, children: /* @__PURE__ */ jsx2(
|
|
1104
|
+
"img",
|
|
1105
|
+
{
|
|
1106
|
+
src,
|
|
1107
|
+
alt: "",
|
|
1108
|
+
className: "w-full h-full object-cover",
|
|
1109
|
+
onError: () => setPreviewError(true),
|
|
1110
|
+
onLoad: () => setPreviewError(false)
|
|
1111
|
+
}
|
|
1112
|
+
) }),
|
|
1113
|
+
/* @__PURE__ */ jsx2("label", { className: "block text-[10px] text-gray-500 uppercase tracking-wider mb-1", children: "URL" }),
|
|
1114
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1 mb-2", children: [
|
|
1115
|
+
/* @__PURE__ */ jsx2(
|
|
1116
|
+
"input",
|
|
1117
|
+
{
|
|
1118
|
+
type: "text",
|
|
1119
|
+
value: src,
|
|
1120
|
+
onChange: (e) => {
|
|
1121
|
+
setSrc(e.target.value);
|
|
1122
|
+
setPreviewError(false);
|
|
1123
|
+
},
|
|
1124
|
+
onKeyDown: (e) => {
|
|
1125
|
+
if (e.key === "Enter") applySrc();
|
|
1126
|
+
},
|
|
1127
|
+
placeholder: "https://...",
|
|
1128
|
+
className: "flex-1 bg-gray-800 text-xs text-white rounded px-2 py-1.5 outline-none border border-transparent focus:border-brand-500 min-w-0"
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ jsx2(
|
|
1132
|
+
"button",
|
|
1133
|
+
{
|
|
1134
|
+
onClick: applySrc,
|
|
1135
|
+
disabled: !urlValid,
|
|
1136
|
+
className: "px-2.5 py-1.5 text-[10px] font-bold rounded bg-brand-500 hover:bg-brand-600 transition-colors shrink-0 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
1137
|
+
children: "Aplicar"
|
|
1138
|
+
}
|
|
1139
|
+
)
|
|
1140
|
+
] }),
|
|
1141
|
+
src && !urlValid && /* @__PURE__ */ jsx2("p", { className: "text-[10px] text-amber-500 mb-2", children: "URL inv\xE1lida \u2014 debe empezar con http:// o https://" }),
|
|
1142
|
+
previewError && urlValid && /* @__PURE__ */ jsx2("p", { className: "text-[10px] text-red-400 mb-2", children: "No se pudo cargar la imagen desde esa URL." }),
|
|
1143
|
+
/* @__PURE__ */ jsx2("label", { className: "block text-[10px] text-gray-500 uppercase tracking-wider mb-1", children: "Alt" }),
|
|
1144
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1", children: [
|
|
1145
|
+
/* @__PURE__ */ jsx2(
|
|
1146
|
+
"input",
|
|
1147
|
+
{
|
|
1148
|
+
type: "text",
|
|
1149
|
+
value: alt,
|
|
1150
|
+
onChange: (e) => setAlt(e.target.value),
|
|
1151
|
+
onKeyDown: (e) => {
|
|
1152
|
+
if (e.key === "Enter") applyAlt();
|
|
1153
|
+
},
|
|
1154
|
+
placeholder: "Descripci\xF3n...",
|
|
1155
|
+
className: "flex-1 bg-gray-800 text-xs text-white rounded px-2 py-1.5 outline-none border border-transparent focus:border-brand-500 min-w-0"
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
/* @__PURE__ */ jsx2(
|
|
1159
|
+
"button",
|
|
1160
|
+
{
|
|
1161
|
+
onClick: applyAlt,
|
|
1162
|
+
className: "px-2.5 py-1.5 text-[10px] font-bold rounded bg-gray-700 hover:bg-gray-600 transition-colors shrink-0",
|
|
1163
|
+
children: "Aplicar"
|
|
1164
|
+
}
|
|
1165
|
+
)
|
|
1166
|
+
] })
|
|
1167
|
+
] });
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1018
1170
|
// src/components4/grapesDarkCss.ts
|
|
1019
1171
|
var GRAPES_DARK_CSS = `
|
|
1020
1172
|
/* Dark theme for GrapesJS editor \u2014 matches EasyBits dark sidebar */
|
|
@@ -1118,7 +1270,7 @@ var GRAPES_DARK_CSS = `
|
|
|
1118
1270
|
`;
|
|
1119
1271
|
|
|
1120
1272
|
// src/components4/GrapesEditor.tsx
|
|
1121
|
-
import { Fragment, jsx as
|
|
1273
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1122
1274
|
var darkCssInjected = false;
|
|
1123
1275
|
function injectDarkCss() {
|
|
1124
1276
|
if (darkCssInjected || typeof document === "undefined") return;
|
|
@@ -1152,7 +1304,7 @@ var PANEL_TABS = [
|
|
|
1152
1304
|
];
|
|
1153
1305
|
var GrapesEditor = forwardRef(
|
|
1154
1306
|
({ initialHtml, theme = "minimal", customColors: rawCustomColors, brandKits, onChange, onAiAction, onThemeChange, onBrandKitChange, initialBrandKitId, hiddenTabs = [], canvasStyles, devices, panelSide = "left", blocks: customBlocks, onVisibleSectionChange }, ref) => {
|
|
1155
|
-
|
|
1307
|
+
useEffect3(() => {
|
|
1156
1308
|
injectDarkCss();
|
|
1157
1309
|
}, []);
|
|
1158
1310
|
const customColors = flattenColors(rawCustomColors);
|
|
@@ -1174,13 +1326,13 @@ var GrapesEditor = forwardRef(
|
|
|
1174
1326
|
themeRef.current = theme;
|
|
1175
1327
|
const customColorsRef = useRef2(customColors);
|
|
1176
1328
|
customColorsRef.current = customColors;
|
|
1177
|
-
const [activeBrandKitId, setActiveBrandKitId] =
|
|
1329
|
+
const [activeBrandKitId, setActiveBrandKitId] = useState3(initialBrandKitId || null);
|
|
1178
1330
|
const visibleTabs = PANEL_TABS.filter((t) => !hiddenTabs.includes(t.id));
|
|
1179
|
-
const [activePanel, setActivePanel] =
|
|
1331
|
+
const [activePanel, setActivePanel] = useState3(
|
|
1180
1332
|
() => visibleTabs.find((t) => t.id === "styles")?.id ?? visibleTabs[0]?.id ?? "styles"
|
|
1181
1333
|
);
|
|
1182
|
-
const [ready, setReady] =
|
|
1183
|
-
const [themeVersion, setThemeVersion] =
|
|
1334
|
+
const [ready, setReady] = useState3(false);
|
|
1335
|
+
const [themeVersion, setThemeVersion] = useState3(0);
|
|
1184
1336
|
useImperativeHandle(ref, () => ({
|
|
1185
1337
|
getEditor: () => editorRef.current,
|
|
1186
1338
|
getHtml: () => {
|
|
@@ -1316,7 +1468,7 @@ ${vars}
|
|
|
1316
1468
|
}
|
|
1317
1469
|
return null;
|
|
1318
1470
|
}
|
|
1319
|
-
|
|
1471
|
+
useEffect3(() => {
|
|
1320
1472
|
if (!editorContainerRef.current || editorRef.current) return;
|
|
1321
1473
|
let mounted = true;
|
|
1322
1474
|
(async () => {
|
|
@@ -1668,7 +1820,7 @@ ${html}` : html;
|
|
|
1668
1820
|
editorRef.current = null;
|
|
1669
1821
|
};
|
|
1670
1822
|
}, []);
|
|
1671
|
-
|
|
1823
|
+
useEffect3(() => {
|
|
1672
1824
|
const ed = editorRef.current;
|
|
1673
1825
|
if (!ed) return;
|
|
1674
1826
|
const doc = ed.Canvas.getDocument();
|
|
@@ -1691,52 +1843,55 @@ ${html}` : html;
|
|
|
1691
1843
|
setTimeout(() => setThemeVersion((v) => v + 1), 100);
|
|
1692
1844
|
}, [theme, customColors]);
|
|
1693
1845
|
const sidebarBorder = panelSide === "right" ? "border-l" : "border-r";
|
|
1694
|
-
const sidebar = /* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1846
|
+
const sidebar = /* @__PURE__ */ jsxs3("div", { className: `w-80 shrink-0 flex flex-col bg-black ${sidebarBorder} border-gray-700 overflow-hidden`, children: [
|
|
1847
|
+
/* @__PURE__ */ jsx3("div", { className: "flex border-b border-gray-700", children: visibleTabs.map((tab) => /* @__PURE__ */ jsxs3(
|
|
1696
1848
|
"button",
|
|
1697
1849
|
{
|
|
1698
1850
|
onClick: () => setActivePanel(tab.id),
|
|
1699
1851
|
className: `flex-1 py-2.5 text-xs font-bold transition-colors ${activePanel === tab.id ? "bg-gray-800 text-white border-b-2 border-brand-500" : "text-gray-400 hover:text-gray-200 hover:bg-gray-800/50"}`,
|
|
1700
1852
|
title: tab.label,
|
|
1701
1853
|
children: [
|
|
1702
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ jsx3("span", { className: "block text-base mb-0.5", children: tab.icon }),
|
|
1703
1855
|
tab.label
|
|
1704
1856
|
]
|
|
1705
1857
|
},
|
|
1706
1858
|
tab.id
|
|
1707
1859
|
)) }),
|
|
1708
|
-
!hiddenTabs.includes("blocks") && /* @__PURE__ */
|
|
1860
|
+
!hiddenTabs.includes("blocks") && /* @__PURE__ */ jsx3(
|
|
1709
1861
|
"div",
|
|
1710
1862
|
{
|
|
1711
1863
|
ref: blocksRef,
|
|
1712
1864
|
className: `flex-1 overflow-auto p-2 ${activePanel === "blocks" ? "" : "hidden"}`
|
|
1713
1865
|
}
|
|
1714
1866
|
),
|
|
1715
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsx3(
|
|
1716
1868
|
"div",
|
|
1717
1869
|
{
|
|
1718
1870
|
ref: layersRef,
|
|
1719
1871
|
className: `flex-1 overflow-auto ${activePanel === "layers" ? "" : "hidden"}`
|
|
1720
1872
|
}
|
|
1721
1873
|
),
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1874
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex-1 overflow-auto ${activePanel === "styles" ? "" : "hidden"}`, children: [
|
|
1875
|
+
ready && /* @__PURE__ */ jsx3(ImageSrcEditor, { editor: editorRef.current }),
|
|
1876
|
+
ready && /* @__PURE__ */ jsx3(
|
|
1877
|
+
TailwindClassEditor,
|
|
1878
|
+
{
|
|
1879
|
+
editor: editorRef.current,
|
|
1880
|
+
themeVersion,
|
|
1881
|
+
themeColors: (() => {
|
|
1882
|
+
if (customColors && Object.keys(customColors).length) return customColors;
|
|
1883
|
+
const t = LANDING_THEMES.find((t2) => t2.id === theme);
|
|
1884
|
+
return t?.colors || {};
|
|
1885
|
+
})()
|
|
1886
|
+
}
|
|
1887
|
+
)
|
|
1888
|
+
] }),
|
|
1889
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex-1 overflow-auto p-3 ${activePanel === "themes" ? "" : "hidden"}`, children: [
|
|
1890
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs text-gray-400 font-bold uppercase tracking-wider mb-3", children: "Temas" }),
|
|
1891
|
+
/* @__PURE__ */ jsx3("div", { className: "grid grid-cols-2 gap-2", children: LANDING_THEMES.map((t) => {
|
|
1737
1892
|
const isActive = theme === t.id;
|
|
1738
1893
|
const displayColors = isActive && customColors && Object.keys(customColors).length ? { ...t.colors, ...customColors } : t.colors;
|
|
1739
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsxs3(
|
|
1740
1895
|
"button",
|
|
1741
1896
|
{
|
|
1742
1897
|
onClick: () => {
|
|
@@ -1746,12 +1901,12 @@ ${html}` : html;
|
|
|
1746
1901
|
},
|
|
1747
1902
|
className: `flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${isActive ? "border-brand-500 bg-brand-500/10" : "border-gray-700 hover:border-gray-500"}`,
|
|
1748
1903
|
children: [
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-1", children: [
|
|
1905
|
+
/* @__PURE__ */ jsx3("div", { className: "w-5 h-5 rounded-full border border-gray-600", style: { background: displayColors.primary }, title: "Primary" }),
|
|
1906
|
+
/* @__PURE__ */ jsx3("div", { className: "w-5 h-5 rounded-full border border-gray-600", style: { background: displayColors.surface }, title: "Surface" }),
|
|
1907
|
+
/* @__PURE__ */ jsx3("div", { className: "w-5 h-5 rounded-full border border-gray-600", style: { background: displayColors.accent }, title: "Accent" })
|
|
1753
1908
|
] }),
|
|
1754
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[10px] font-bold text-gray-300", children: t.label })
|
|
1755
1910
|
]
|
|
1756
1911
|
},
|
|
1757
1912
|
t.id
|
|
@@ -1776,12 +1931,12 @@ ${html}` : html;
|
|
|
1776
1931
|
"on-secondary": "On Secondary",
|
|
1777
1932
|
"on-accent": "On Accent"
|
|
1778
1933
|
};
|
|
1779
|
-
return /* @__PURE__ */
|
|
1934
|
+
return /* @__PURE__ */ jsx3("div", { className: "mt-3 space-y-1", children: Object.entries(currentColors).map(([key, hex]) => /* @__PURE__ */ jsxs3(
|
|
1780
1935
|
"label",
|
|
1781
1936
|
{
|
|
1782
1937
|
className: "flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer",
|
|
1783
1938
|
children: [
|
|
1784
|
-
/* @__PURE__ */
|
|
1939
|
+
/* @__PURE__ */ jsx3(
|
|
1785
1940
|
"input",
|
|
1786
1941
|
{
|
|
1787
1942
|
type: "color",
|
|
@@ -1793,19 +1948,19 @@ ${html}` : html;
|
|
|
1793
1948
|
className: "w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded"
|
|
1794
1949
|
}
|
|
1795
1950
|
),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1951
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[10px] text-gray-400 flex-1 truncate", children: COLOR_LABELS[key] || key }),
|
|
1952
|
+
/* @__PURE__ */ jsx3("code", { className: "text-[10px] text-gray-500 group-hover:text-gray-300 font-mono", children: hex })
|
|
1798
1953
|
]
|
|
1799
1954
|
},
|
|
1800
1955
|
key
|
|
1801
1956
|
)) });
|
|
1802
1957
|
})(),
|
|
1803
|
-
brandKits && brandKits.length > 0 && /* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1958
|
+
brandKits && brandKits.length > 0 && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1959
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs text-gray-400 font-bold uppercase tracking-wider mt-5 mb-3", children: "Brand Kits" }),
|
|
1960
|
+
/* @__PURE__ */ jsx3("div", { className: "grid grid-cols-2 gap-2", children: brandKits.map((bk) => {
|
|
1806
1961
|
const bkBase = flattenColors(bk.colors) || {};
|
|
1807
1962
|
const displayColors = activeBrandKitId === bk.id && customColors && Object.keys(customColors).length ? { ...bkBase, ...customColors } : bkBase;
|
|
1808
|
-
return /* @__PURE__ */
|
|
1963
|
+
return /* @__PURE__ */ jsxs3(
|
|
1809
1964
|
"button",
|
|
1810
1965
|
{
|
|
1811
1966
|
onClick: () => {
|
|
@@ -1815,7 +1970,7 @@ ${html}` : html;
|
|
|
1815
1970
|
},
|
|
1816
1971
|
className: `flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${activeBrandKitId === bk.id ? "border-brand-500 bg-brand-500/10" : "border-gray-700 hover:border-gray-500"}`,
|
|
1817
1972
|
children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1973
|
+
/* @__PURE__ */ jsx3("div", { className: "flex gap-1", children: ["primary", "surface", "accent"].map((key) => /* @__PURE__ */ jsx3(
|
|
1819
1974
|
"div",
|
|
1820
1975
|
{
|
|
1821
1976
|
className: "w-5 h-5 rounded-full border border-gray-600",
|
|
@@ -1823,7 +1978,7 @@ ${html}` : html;
|
|
|
1823
1978
|
},
|
|
1824
1979
|
key
|
|
1825
1980
|
)) }),
|
|
1826
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[10px] font-bold text-gray-300 truncate max-w-full", children: bk.name })
|
|
1827
1982
|
]
|
|
1828
1983
|
},
|
|
1829
1984
|
bk.id
|
|
@@ -1834,12 +1989,12 @@ ${html}` : html;
|
|
|
1834
1989
|
if (!bk) return null;
|
|
1835
1990
|
const baseColors = flattenColors(bk.colors) || {};
|
|
1836
1991
|
const colors = customColors && Object.keys(customColors).length ? { ...baseColors, ...customColors } : baseColors;
|
|
1837
|
-
return /* @__PURE__ */
|
|
1992
|
+
return /* @__PURE__ */ jsx3("div", { className: "mt-3 space-y-1", children: Object.entries(colors).map(([key, hex]) => /* @__PURE__ */ jsxs3(
|
|
1838
1993
|
"label",
|
|
1839
1994
|
{
|
|
1840
1995
|
className: "flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer",
|
|
1841
1996
|
children: [
|
|
1842
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsx3(
|
|
1843
1998
|
"input",
|
|
1844
1999
|
{
|
|
1845
2000
|
type: "color",
|
|
@@ -1851,8 +2006,8 @@ ${html}` : html;
|
|
|
1851
2006
|
className: "w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded"
|
|
1852
2007
|
}
|
|
1853
2008
|
),
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[10px] text-gray-400 flex-1 truncate", children: key }),
|
|
2010
|
+
/* @__PURE__ */ jsx3("code", { className: "text-[10px] text-gray-500 group-hover:text-gray-300 font-mono", children: hex })
|
|
1856
2011
|
]
|
|
1857
2012
|
},
|
|
1858
2013
|
key
|
|
@@ -1861,16 +2016,16 @@ ${html}` : html;
|
|
|
1861
2016
|
] })
|
|
1862
2017
|
] })
|
|
1863
2018
|
] });
|
|
1864
|
-
const canvas = /* @__PURE__ */
|
|
1865
|
-
return /* @__PURE__ */
|
|
1866
|
-
panelSide === "right" ? /* @__PURE__ */
|
|
2019
|
+
const canvas = /* @__PURE__ */ jsx3("div", { ref: editorContainerRef, className: "flex-1 h-full bg-black" });
|
|
2020
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex h-full w-full relative", children: [
|
|
2021
|
+
panelSide === "right" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1867
2022
|
canvas,
|
|
1868
2023
|
sidebar
|
|
1869
|
-
] }) : /* @__PURE__ */
|
|
2024
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1870
2025
|
sidebar,
|
|
1871
2026
|
canvas
|
|
1872
2027
|
] }),
|
|
1873
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ jsx3(
|
|
1874
2029
|
"div",
|
|
1875
2030
|
{
|
|
1876
2031
|
className: `absolute inset-0 z-50 pointer-events-none bg-gray-950/40 backdrop-blur-[2px] transition-all duration-500 ${ready ? "opacity-0 invisible" : "opacity-100"}`
|
|
@@ -1883,6 +2038,7 @@ GrapesEditor.displayName = "GrapesEditor";
|
|
|
1883
2038
|
var GrapesEditor_default = GrapesEditor;
|
|
1884
2039
|
export {
|
|
1885
2040
|
GrapesEditor_default as GrapesEditor,
|
|
2041
|
+
ImageSrcEditor,
|
|
1886
2042
|
LANDING_BLOCKS,
|
|
1887
2043
|
TailwindClassEditor
|
|
1888
2044
|
};
|
package/dist/components4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components4/GrapesEditor.tsx","../src/components4/blocks.ts","../src/components4/TailwindClassEditor.tsx","../src/components4/grapesDarkCss.ts"],"sourcesContent":["import { useEffect, useRef, useState, forwardRef, useImperativeHandle } from \"react\";\nimport type { Editor } from \"grapesjs\";\nimport { LANDING_BLOCKS } from \"./blocks\";\nimport { buildSingleThemeCss, buildCustomTheme, LANDING_THEMES } from \"../themes\";\nimport TailwindClassEditor from \"./TailwindClassEditor\";\nimport { GRAPES_DARK_CSS } from \"./grapesDarkCss\";\n\n/** Inject GrapesJS dark theme CSS once at runtime */\nlet darkCssInjected = false;\nfunction injectDarkCss() {\n if (darkCssInjected || typeof document === \"undefined\") return;\n darkCssInjected = true;\n const style = document.createElement(\"style\");\n style.setAttribute(\"data-grapes-dark\", \"\");\n style.textContent = GRAPES_DARK_CSS;\n document.head.appendChild(style);\n}\n\n/** Flatten brand kit colors: keep string entries and convert extras array to named colors */\nfunction flattenColors(colors: Record<string, any> | undefined): Record<string, string> | undefined {\n if (!colors) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(colors)) {\n if (typeof v === \"string\") {\n out[k] = v;\n } else if (k === \"extras\" && Array.isArray(v)) {\n v.forEach((extra: { name?: string; hex?: string }, i: number) => {\n if (extra?.hex) {\n out[extra.name || `extra-${i + 1}`] = extra.hex;\n }\n });\n }\n }\n return Object.keys(out).length ? out : undefined;\n}\n\nexport interface AiAction {\n type: \"refine-element\";\n componentId: string;\n html: string;\n sectionHtml?: string;\n sectionComponentId?: string;\n isSection?: boolean;\n}\n\nexport interface GrapesEditorHandle {\n getEditor: () => Editor | null;\n getHtml: () => string;\n setHtml: (html: string) => void;\n /** Replace a component's HTML by its GrapesJS ID */\n replaceComponent: (componentId: string, newHtml: string) => void;\n /** Toggle preview mode, returns new state */\n togglePreview: () => boolean;\n /** Toggle sw-visibility (component border guides), returns new state */\n toggleSwVisibility: () => boolean;\n /** Scroll the canvas iframe to a section by data-section-id. Falls back to iframe DOM query if the component model lost the attribute. */\n scrollToSection: (sectionId: string) => void;\n /** Scroll the canvas to the N-th content section (skips __grapes_css__ style). Index-based is robust even when GrapesJS strips data-* attributes during parse. */\n scrollToIndex: (index: number) => void;\n /** Set canvas zoom level (percentage, e.g. 50 = 50%) */\n setZoom: (value: number) => void;\n /** Get current canvas zoom level */\n getZoom: () => number;\n}\n\ninterface BrandKitItem {\n id: string;\n name: string;\n colors: Record<string, string>;\n fonts?: { heading?: string; body?: string } | null;\n mood?: string | null;\n logoUrl?: string | null;\n isDefault?: boolean;\n}\n\ninterface Props {\n initialHtml: string;\n theme?: string;\n customColors?: Record<string, string>;\n brandKits?: BrandKitItem[];\n onChange?: (html: string) => void;\n onAiAction?: (action: AiAction) => void;\n onThemeChange?: (themeId: string, customColors?: Record<string, string>, brandKitId?: string) => void;\n onBrandKitChange?: (brandKit: BrandKitItem | null) => void;\n /** Persisted brand kit ID — restored from metadata on load */\n initialBrandKitId?: string;\n /** Hide specific panel tabs (e.g. [\"blocks\"] for documents) */\n hiddenTabs?: PanelId[];\n /** Extra CSS injected into the canvas iframe (e.g. document page sizing) */\n canvasStyles?: string;\n /** Set to false to hide device switcher (always single viewport) */\n devices?: false;\n /** Which side to render the panel sidebar — default \"left\" */\n panelSide?: \"left\" | \"right\";\n /** Override default blocks (LANDING_BLOCKS). Pass custom blocks for different editors (e.g. presentations). */\n blocks?: { id: string; label: string; category: string; content: string | object; media?: string }[];\n /** Called when the most visible section changes due to canvas scroll */\n onVisibleSectionChange?: (sectionId: string) => void;\n}\n\nconst PANEL_TABS = [\n { id: \"blocks\", label: \"Bloques\", icon: \"⊞\" },\n { id: \"layers\", label: \"Capas\", icon: \"☰\" },\n { id: \"styles\", label: \"Estilos\", icon: \"◑\" },\n { id: \"themes\", label: \"Temas\", icon: \"◈\" },\n] as const;\n\nexport type PanelId = (typeof PANEL_TABS)[number][\"id\"];\n\nconst GrapesEditor = forwardRef<GrapesEditorHandle, Props>(\n ({ initialHtml, theme = \"minimal\", customColors: rawCustomColors, brandKits, onChange, onAiAction, onThemeChange, onBrandKitChange, initialBrandKitId, hiddenTabs = [], canvasStyles, devices, panelSide = \"left\", blocks: customBlocks, onVisibleSectionChange }, ref) => {\n // Inject dark CSS on first render\n useEffect(() => { injectDarkCss(); }, []);\n\n // Strip non-string entries (e.g. extras array from brand kits)\n const customColors = flattenColors(rawCustomColors);\n const editorContainerRef = useRef<HTMLDivElement>(null);\n const blocksRef = useRef<HTMLDivElement>(null);\n const layersRef = useRef<HTMLDivElement>(null);\n const editorRef = useRef<Editor | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onAiActionRef = useRef(onAiAction);\n onAiActionRef.current = onAiAction;\n const onVisibleSectionChangeRef = useRef(onVisibleSectionChange);\n onVisibleSectionChangeRef.current = onVisibleSectionChange;\n const onThemeChangeRef = useRef(onThemeChange);\n onThemeChangeRef.current = onThemeChange;\n const onBrandKitChangeRef = useRef(onBrandKitChange);\n onBrandKitChangeRef.current = onBrandKitChange;\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const customColorsRef = useRef(customColors);\n customColorsRef.current = customColors;\n const [activeBrandKitId, setActiveBrandKitId] = useState<string | null>(initialBrandKitId || null);\n const visibleTabs = PANEL_TABS.filter((t) => !hiddenTabs.includes(t.id));\n const [activePanel, setActivePanel] = useState<PanelId>(() =>\n visibleTabs.find((t) => t.id === \"styles\")?.id ?? visibleTabs[0]?.id ?? \"styles\"\n );\n const [ready, setReady] = useState(false);\n const [themeVersion, setThemeVersion] = useState(0);\n\n useImperativeHandle(ref, () => ({\n getEditor: () => editorRef.current,\n getHtml: () => {\n const ed = editorRef.current;\n if (!ed) return \"\";\n const html = ed.getHtml();\n const css = ed.getCss();\n return css ? `<style>${css}</style>\\n${html}` : html;\n },\n setHtml: (html: string) => editorRef.current?.setComponents(html),\n togglePreview: () => {\n const ed = editorRef.current;\n if (!ed) return false;\n const cmd = ed.Commands;\n if (cmd.isActive(\"preview\")) {\n cmd.stop(\"preview\");\n if (!cmd.isActive(\"sw-visibility\")) cmd.run(\"sw-visibility\");\n return false;\n } else {\n if (cmd.isActive(\"sw-visibility\")) cmd.stop(\"sw-visibility\");\n ed.select();\n cmd.run(\"preview\");\n return true;\n }\n },\n toggleSwVisibility: () => {\n const ed = editorRef.current;\n if (!ed) return false;\n const cmd = ed.Commands;\n if (cmd.isActive(\"sw-visibility\")) {\n cmd.stop(\"sw-visibility\");\n return false;\n } else {\n cmd.run(\"sw-visibility\");\n return true;\n }\n },\n scrollToSection: (sectionId: string) => {\n const ed = editorRef.current;\n if (!ed) return;\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comps = wrapper.components().models || [];\n\n // (a) Try the GrapesJS model. This is the fast path when attributes were preserved.\n const target = comps.find((c: any) => c.getAttributes()[\"data-section-id\"] === sectionId);\n if (target) {\n ed.select(target);\n (ed.Canvas as any).scrollTo?.(target, { behavior: \"smooth\", block: \"start\", force: true });\n return;\n }\n\n // (b) GrapesJS sometimes discards custom `data-*` attributes from the model\n // while keeping them on the rendered DOM. Scroll via the iframe element directly —\n // Canvas.scrollTo accepts an HTMLElement too.\n const doc = ed.Canvas.getDocument();\n const el = doc?.querySelector(`[data-section-id=\"${sectionId}\"]`) as HTMLElement | null;\n if (el) {\n (ed.Canvas as any).scrollTo?.(el, { behavior: \"smooth\", block: \"start\", force: true });\n return;\n }\n\n console.warn(\"[scrollToSection] Section not found:\", sectionId, \"Model attrs:\", comps.map((c: any) => c.getAttributes()[\"data-section-id\"]), \"DOM has [data-section-id]?\", !!doc?.querySelector(\"[data-section-id]\"));\n },\n\n scrollToIndex: (index: number) => {\n const ed = editorRef.current;\n if (!ed) return;\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comps = wrapper.components().models || [];\n // Skip head-like tags that importers (splitIntoPages) prepend per page:\n // <link>, <style>, <script>, <meta>, <title>, <base>. Without this filter,\n // `contentComps[N]` can land on a zero-height <link> instead of the target\n // <section>, which makes every click scroll to the same place.\n const HEAD_TAGS = new Set([\"style\", \"script\", \"link\", \"meta\", \"title\", \"base\"]);\n const contentComps = comps.filter((c: any) => {\n const tag = (c.get(\"tagName\") || \"\").toLowerCase();\n return tag && !HEAD_TAGS.has(tag);\n });\n const target = contentComps[index];\n if (!target) return;\n ed.select(target);\n const el = target.getEl() as HTMLElement | undefined;\n if (index === 0) {\n ed.Canvas.getDocument()?.documentElement?.scrollTo({ top: 0, behavior: \"smooth\" });\n return;\n }\n el?.scrollIntoView({ behavior: \"smooth\", block: \"center\" });\n },\n replaceComponent: (componentId: string, newHtml: string) => {\n const ed = editorRef.current;\n if (!ed) return;\n function findById(parent: any): any {\n if (parent.getId() === componentId) return parent;\n for (const child of parent.components().models || []) {\n const found = findById(child);\n if (found) return found;\n }\n return null;\n }\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comp = findById(wrapper);\n if (comp) {\n comp.replaceWith(newHtml);\n } else {\n console.warn(\"[replaceComponent] Component not found:\", componentId);\n }\n },\n setZoom: (value: number) => {\n editorRef.current?.Canvas.setZoom(value);\n },\n getZoom: () => {\n return editorRef.current?.Canvas.getZoom() ?? 100;\n },\n }));\n\n function getThemeCss() {\n try {\n const cc = customColorsRef.current;\n if (cc && Object.keys(cc).length) {\n if (!cc[\"on-primary\"] && cc.primary) {\n const full = buildCustomTheme(cc as any);\n const vars = Object.entries(full.colors)\n .map(([k, v]) => ` --color-${k}: ${v};`)\n .join(\"\\n\");\n return `:root {\\n${vars}\\n}`;\n }\n const vars = Object.entries(cc)\n .map(([k, v]) => ` --color-${k}: ${v};`)\n .join(\"\\n\");\n return `:root {\\n${vars}\\n}`;\n }\n return buildSingleThemeCss(themeRef.current).css || \"\";\n } catch {\n return \"\";\n }\n }\n\n function findSectionAncestor(comp: any): any {\n let current = comp;\n while (current) {\n if (current.get(\"tagName\") === \"section\") return current;\n current = current.parent();\n }\n return null;\n }\n\n useEffect(() => {\n if (!editorContainerRef.current || editorRef.current) return;\n let mounted = true;\n\n (async () => {\n const grapesjs = (await import(\"grapesjs\")).default;\n if (!mounted || !editorContainerRef.current) return;\n\n // Inject grapesjs base CSS\n if (!document.querySelector('link[href*=\"grapes.min.css\"]')) {\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = \"https://unpkg.com/grapesjs/dist/css/grapes.min.css\";\n document.head.appendChild(link);\n }\n\n const initialThemeCss = getThemeCss();\n const COLORS_MAP: Record<string, string> = {\n primary: \"--color-primary\", \"primary-light\": \"--color-primary-light\", \"primary-dark\": \"--color-primary-dark\",\n secondary: \"--color-secondary\", accent: \"--color-accent\",\n surface: \"--color-surface\", \"surface-alt\": \"--color-surface-alt\",\n \"on-primary\": \"--color-on-primary\", \"on-secondary\": \"--color-on-secondary\", \"on-accent\": \"--color-on-accent\",\n \"on-surface\": \"--color-on-surface\", \"on-surface-muted\": \"--color-on-surface-muted\",\n };\n const fallbackRules: string[] = [];\n for (const [name, cssVar] of Object.entries(COLORS_MAP)) {\n fallbackRules.push(`.bg-${name} { background-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.text-${name} { color: var(${cssVar}) !important }`);\n fallbackRules.push(`.border-${name} { border-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.from-${name} { --tw-gradient-from: var(${cssVar}) }`);\n fallbackRules.push(`.to-${name} { --tw-gradient-to: var(${cssVar}) }`);\n fallbackRules.push(`.hover\\\\:bg-${name}:hover { background-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.hover\\\\:text-${name}:hover { color: var(${cssVar}) !important }`);\n }\n\n const editor = grapesjs.init({\n container: editorContainerRef.current,\n height: \"100%\",\n width: \"auto\",\n fromElement: false,\n storageManager: false,\n panels: { defaults: [] },\n canvas: {\n scripts: [\n `data:text/javascript,window.tailwind=${encodeURIComponent(JSON.stringify({config:{\n theme: { extend: { colors: {\n primary: \"var(--color-primary)\",\n \"primary-light\": \"var(--color-primary-light)\",\n \"primary-dark\": \"var(--color-primary-dark)\",\n secondary: \"var(--color-secondary)\",\n accent: \"var(--color-accent)\",\n surface: \"var(--color-surface)\",\n \"surface-alt\": \"var(--color-surface-alt)\",\n \"on-primary\": \"var(--color-on-primary)\",\n \"on-secondary\": \"var(--color-on-secondary)\",\n \"on-accent\": \"var(--color-on-accent)\",\n \"on-surface\": \"var(--color-on-surface)\",\n \"on-surface-muted\": \"var(--color-on-surface-muted)\",\n }}}}\n }))}`,\n \"https://cdn.tailwindcss.com\",\n ],\n styles: [\n `data:text/css,${encodeURIComponent(initialThemeCss + \"\\n\" + fallbackRules.join(\"\\n\") + (canvasStyles ? \"\\n\" + canvasStyles : \"\"))}`,\n ],\n },\n deviceManager: devices === false ? false as any : {\n devices: [\n { name: \"Desktop\", width: \"\" },\n { name: \"Tablet\", width: \"768px\" },\n { name: \"Mobile\", width: \"375px\" },\n ],\n },\n styleManager: false as any,\n layerManager: {\n appendTo: layersRef.current!,\n },\n blockManager: hiddenTabs.includes(\"blocks\") ? false as any : {\n appendTo: blocksRef.current!,\n blocks: (customBlocks || LANDING_BLOCKS).map((b) => ({\n id: b.id,\n label: b.label,\n category: b.category,\n content: b.content,\n media: b.media,\n })),\n },\n allowScripts: 1,\n } as any);\n\n // ─── AI Commands ────────────────────────────────\n editor.Commands.add(\"ai-open-menu\", {\n run(ed: Editor) {\n const selected = ed.getSelected();\n if (!selected) return;\n const section = findSectionAncestor(selected);\n const isSection = selected.get(\"tagName\") === \"section\";\n onAiActionRef.current?.({\n type: \"refine-element\",\n componentId: selected.getId(),\n html: selected.toHTML(),\n sectionHtml: section ? section.toHTML() : undefined,\n sectionComponentId: section ? section.getId() : undefined,\n isSection,\n } as any);\n },\n });\n\n // ─── Switch to Styles tab on selection ───\n editor.on(\"component:selected\", () => {\n setActivePanel(\"styles\");\n });\n editor.on(\"component:deselected\", () => {\n // Stay on current panel\n });\n\n // ─── Inject AI buttons into component toolbar on selection ───\n editor.on(\"component:selected\", (component: any) => {\n const toolbar = component.get(\"toolbar\") || [];\n const hasAi = toolbar.some((t: any) => t.id === \"ai-refine\");\n if (hasAi) return;\n\n const aiButtons: any[] = [\n {\n id: \"ai-menu\",\n label: `<svg title=\"AI\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"#9870ED\" style=\"vertical-align:middle;cursor:pointer\"><path d=\"M12 2l2.09 6.26L20.18 10l-6.09 1.74L12 18l-2.09-6.26L3.82 10l6.09-1.74z\"/><path d=\"M19 2l.75 2.25L22 5l-2.25.75L19 8l-.75-2.25L16 5l2.25-.75z\" opacity=\".7\"/><path d=\"M5 16l.5 1.5L7 18l-1.5.5L5 20l-.5-1.5L3 18l1.5-.5z\" opacity=\".5\"/></svg>`,\n command: \"ai-open-menu\",\n },\n ];\n\n component.set(\"toolbar\", [...toolbar, ...aiButtons]);\n });\n\n // ─── Theme + extras in iframe ────────────────────\n editor.on(\"canvas:frame:load\", ({ window: fw }: { window: Window }) => {\n const doc = fw.document;\n\n const style = doc.createElement(\"style\");\n style.id = \"easybits-theme\";\n style.textContent = getThemeCss();\n doc.head.appendChild(style);\n\n const shimmerStyle = doc.createElement(\"style\");\n shimmerStyle.textContent = `\n .easybits-refining { position: relative; overflow: hidden; }\n .easybits-refining::after {\n content: '';\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, transparent 0%, rgba(152,112,237,0.08) 50%, transparent 100%);\n animation: easybits-shimmer 1.5s infinite;\n pointer-events: none;\n z-index: 9999;\n }\n @keyframes easybits-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(100%); }\n }\n `;\n doc.head.appendChild(shimmerStyle);\n\n const swStyle = doc.createElement(\"style\");\n swStyle.textContent = `\n .gjs-dashed *[data-gjs-type] {\n outline: 1px dashed rgba(152,112,237,0.35) !important;\n outline-offset: -1px;\n }\n .gjs-dashed *[data-gjs-type]:hover {\n outline-color: rgba(152,112,237,0.7) !important;\n }\n `;\n doc.head.appendChild(swStyle);\n\n if (canvasStyles) {\n const extraStyle = doc.createElement(\"style\");\n extraStyle.id = \"easybits-canvas-styles\";\n extraStyle.textContent = canvasStyles;\n doc.head.appendChild(extraStyle);\n }\n\n doc.addEventListener(\"keydown\", (e: KeyboardEvent) => {\n if (e.key !== \" \") return;\n const el = e.target as HTMLElement;\n if (!el?.isContentEditable) return;\n const tag = el.tagName?.toLowerCase();\n if (tag === \"a\" || tag === \"button\" || el.closest(\"a\") || el.closest(\"button\")) {\n e.preventDefault();\n doc.execCommand(\"insertText\", false, \" \");\n }\n });\n\n if (!doc.getElementById(\"easybits-semantic-fallback\")) {\n const fallback = doc.createElement(\"style\");\n fallback.id = \"easybits-semantic-fallback\";\n const rules: string[] = [];\n for (const [name, cssVar] of Object.entries(COLORS_MAP)) {\n rules.push(`.bg-${name} { background-color: var(${cssVar}) !important }`);\n rules.push(`.text-${name} { color: var(${cssVar}) !important }`);\n rules.push(`.border-${name} { border-color: var(${cssVar}) !important }`);\n rules.push(`.from-${name} { --tw-gradient-from: var(${cssVar}) }`);\n rules.push(`.to-${name} { --tw-gradient-to: var(${cssVar}) }`);\n rules.push(`.hover\\\\:bg-${name}:hover { background-color: var(${cssVar}) !important }`);\n rules.push(`.hover\\\\:text-${name}:hover { color: var(${cssVar}) !important }`);\n }\n fallback.textContent = rules.join(\"\\n\");\n doc.head.appendChild(fallback);\n }\n\n const applyTwConfig = () => {\n if ((fw as any).tailwind) {\n (fw as any).tailwind.config = {\n theme: { extend: { colors: Object.fromEntries(\n Object.keys(COLORS_MAP).map(name => [name, `var(${COLORS_MAP[name]})`])\n )}}\n };\n }\n };\n applyTwConfig();\n const twScript = doc.querySelector('script[src*=\"tailwindcss\"]');\n if (twScript) {\n twScript.addEventListener(\"load\", () => {\n applyTwConfig();\n doc.body.style.display = \"none\";\n doc.body.offsetHeight;\n doc.body.style.display = \"\";\n });\n }\n\n // Scroll-spy\n {\n let scrollRaf = 0;\n const onScroll = () => {\n cancelAnimationFrame(scrollRaf);\n scrollRaf = requestAnimationFrame(() => {\n if (!onVisibleSectionChangeRef.current) return;\n const sectionEls = doc.querySelectorAll(\"[data-section-id]\");\n if (!sectionEls.length) return;\n const viewH = fw.innerHeight;\n let bestId = \"\";\n let bestVisible = 0;\n sectionEls.forEach((el) => {\n const rect = el.getBoundingClientRect();\n const top = Math.max(0, rect.top);\n const bottom = Math.min(viewH, rect.bottom);\n const visible = Math.max(0, bottom - top);\n if (visible > bestVisible) {\n bestVisible = visible;\n bestId = el.getAttribute(\"data-section-id\") || \"\";\n }\n });\n if (bestId) onVisibleSectionChangeRef.current(bestId);\n });\n };\n fw.addEventListener(\"scroll\", onScroll, { passive: true });\n }\n });\n\n if (initialHtml) editor.setComponents(initialHtml);\n\n // ─── Name layers based on content ───\n function nameLayers() {\n const wrapper = editor.DomComponents.getWrapper();\n if (!wrapper) return;\n wrapper.components().forEach((comp: any, i: number) => {\n if (comp.get(\"custom-name\")) return;\n const tag = (comp.get(\"tagName\") || \"\").toLowerCase();\n if (tag !== \"section\") return;\n const html = comp.toHTML().toLowerCase();\n let name = `Section ${i + 1}`;\n if (html.includes(\"hero\") || (i === 0 && html.includes(\"<h1\"))) name = \"Hero\";\n else if (html.includes(\"pricing\") || html.includes(\"precio\") || html.includes(\"inversión\")) name = \"Pricing\";\n else if (html.includes(\"testimonial\") || html.includes(\"dicen\") || html.includes(\"quote\")) name = \"Testimonials\";\n else if (html.includes(\"faq\") || html.includes(\"pregunt\") || html.includes(\"<details\")) name = \"FAQ\";\n else if (html.includes(\"footer\") || html.includes(\"©\") || html.includes(\"derechos\")) name = \"Footer\";\n else if (html.includes(\"feature\") || html.includes(\"palanca\") || html.includes(\"servicio\")) name = \"Features\";\n else if (html.includes(\"stat\") || html.includes(\"número\") || html.includes(\"+%\")) name = \"Stats\";\n else if (html.includes(\"team\") || html.includes(\"equipo\")) name = \"Team\";\n else if (html.includes(\"cta\") || html.includes(\"listo\") || html.includes(\"empez\")) name = \"CTA\";\n else if (html.includes(\"newsletter\") || html.includes(\"suscri\") || html.includes(\"email\")) name = \"Newsletter\";\n else if (html.includes(\"proceso\") || html.includes(\"step\") || html.includes(\"cómo func\")) name = \"Process\";\n else if (html.includes(\"problema\") || html.includes(\"pain\")) name = \"Problem\";\n else if (html.includes(\"logo\") || html.includes(\"trusted\") || html.includes(\"brand\")) name = \"Logo Cloud\";\n comp.set(\"custom-name\", name);\n });\n }\n editor.on(\"load\", nameLayers);\n editor.on(\"component:add\", () => setTimeout(nameLayers, 200));\n\n let userHasInteracted = false;\n const interactionEvents = [\n \"canvas:drop\", \"block:drag:stop\", \"component:drag:end\",\n \"component:input\", \"undo\", \"redo\",\n ];\n const markInteracted = () => { userHasInteracted = true; };\n interactionEvents.forEach((evt) => editor.on(evt, markInteracted));\n editor.on(\"sidebar:change\", markInteracted);\n\n const notify = () => {\n if (!userHasInteracted) return;\n const html = editor.getHtml();\n if (!html || !html.trim()) return;\n const css = editor.getCss();\n const fullHtml = css ? `<style>${css}</style>\\n${html}` : html;\n onChangeRef.current?.(fullHtml);\n };\n\n [\n \"component:update\", \"component:add\", \"component:remove\",\n \"component:drag:end\", \"component:input\", \"canvas:drop\",\n \"block:drag:stop\", \"undo\", \"redo\",\n ].forEach((evt) => editor.on(evt, notify));\n\n // Collapse all block categories except CTA\n try {\n const bm = editor.BlockManager;\n const cats = bm.getCategories?.();\n if (cats && cats.forEach) {\n cats.forEach((cat: any) => {\n try {\n const name = (typeof cat.get === \"function\" ? cat.get(\"id\") || cat.get(\"label\") : cat.id || cat.label) || \"\";\n if (name !== \"CTA\") {\n if (typeof cat.set === \"function\") cat.set(\"open\", false);\n }\n } catch { /* skip */ }\n });\n }\n } catch { /* skip */ }\n\n editorRef.current = editor;\n editor.on(\"load\", () => {\n setReady(true);\n let attempts = 0;\n const interval = setInterval(() => {\n attempts++;\n try {\n const active = editor.Commands?.getActive();\n if (!active) { clearInterval(interval); return; }\n for (const cmd of Object.keys(active)) {\n if (cmd === \"show-offset\") {\n editor.stopCommand(cmd);\n }\n }\n } catch {}\n if (attempts >= 30) clearInterval(interval);\n }, 100);\n if (editor.Commands.isActive(\"sw-visibility\")) {\n editor.Commands.stop(\"sw-visibility\");\n }\n });\n })().catch((err) => {\n console.error(\"GrapesJS init failed:\", err);\n });\n\n return () => {\n mounted = false;\n editorRef.current?.destroy();\n editorRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Update theme CSS dynamically\n useEffect(() => {\n const ed = editorRef.current;\n if (!ed) return;\n const doc = ed.Canvas.getDocument();\n if (!doc) return;\n\n const old = doc.getElementById(\"easybits-theme\");\n if (old) old.remove();\n const style = doc.createElement(\"style\");\n style.id = \"easybits-theme\";\n style.textContent = getThemeCss();\n doc.head.appendChild(style);\n\n const oldFallback = doc.getElementById(\"easybits-semantic-fallback\");\n if (oldFallback) {\n const content = oldFallback.textContent;\n oldFallback.remove();\n const fb = doc.createElement(\"style\");\n fb.id = \"easybits-semantic-fallback\";\n fb.textContent = content;\n doc.head.appendChild(fb);\n }\n\n setTimeout(() => setThemeVersion((v) => v + 1), 100);\n }, [theme, customColors]);\n\n const sidebarBorder = panelSide === \"right\" ? \"border-l\" : \"border-r\";\n\n const sidebar = (\n <div className={`w-80 shrink-0 flex flex-col bg-black ${sidebarBorder} border-gray-700 overflow-hidden`}>\n <div className=\"flex border-b border-gray-700\">\n {visibleTabs.map((tab) => (\n <button\n key={tab.id}\n onClick={() => setActivePanel(tab.id)}\n className={`flex-1 py-2.5 text-xs font-bold transition-colors ${\n activePanel === tab.id\n ? \"bg-gray-800 text-white border-b-2 border-brand-500\"\n : \"text-gray-400 hover:text-gray-200 hover:bg-gray-800/50\"\n }`}\n title={tab.label}\n >\n <span className=\"block text-base mb-0.5\">{tab.icon}</span>\n {tab.label}\n </button>\n ))}\n </div>\n\n {!hiddenTabs.includes(\"blocks\") && <div\n ref={blocksRef}\n className={`flex-1 overflow-auto p-2 ${activePanel === \"blocks\" ? \"\" : \"hidden\"}`}\n />}\n <div\n ref={layersRef}\n className={`flex-1 overflow-auto ${activePanel === \"layers\" ? \"\" : \"hidden\"}`}\n />\n <div className={`flex-1 overflow-auto ${activePanel === \"styles\" ? \"\" : \"hidden\"}`}>\n {ready && <TailwindClassEditor\n editor={editorRef.current}\n themeVersion={themeVersion}\n themeColors={(() => {\n if (customColors && Object.keys(customColors).length) return customColors;\n const t = LANDING_THEMES.find((t) => t.id === theme);\n return t?.colors || {};\n })()}\n />}\n </div>\n <div className={`flex-1 overflow-auto p-3 ${activePanel === \"themes\" ? \"\" : \"hidden\"}`}>\n <p className=\"text-xs text-gray-400 font-bold uppercase tracking-wider mb-3\">Temas</p>\n <div className=\"grid grid-cols-2 gap-2\">\n {LANDING_THEMES.map((t) => {\n const isActive = theme === t.id;\n const displayColors = isActive && customColors && Object.keys(customColors).length\n ? { ...t.colors, ...customColors }\n : t.colors;\n return (\n <button\n key={t.id}\n onClick={() => {\n onThemeChangeRef.current?.(t.id);\n setActiveBrandKitId(null);\n onBrandKitChangeRef.current?.(null);\n }}\n className={`flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${\n isActive\n ? \"border-brand-500 bg-brand-500/10\"\n : \"border-gray-700 hover:border-gray-500\"\n }`}\n >\n <div className=\"flex gap-1\">\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.primary }} title=\"Primary\" />\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.surface }} title=\"Surface\" />\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.accent }} title=\"Accent\" />\n </div>\n <span className=\"text-[10px] font-bold text-gray-300\">{t.label}</span>\n </button>\n );\n })}\n </div>\n\n {(() => {\n const active = LANDING_THEMES.find((t) => t.id === theme);\n const baseColors: Record<string, string> = active?.colors ? { ...active.colors } : {};\n const currentColors: Record<string, string> = customColors && Object.keys(customColors).length\n ? { ...baseColors, ...customColors }\n : baseColors;\n if (!Object.keys(currentColors).length) return null;\n const COLOR_LABELS: Record<string, string> = {\n primary: \"Primary\", \"primary-light\": \"Primary Light\", \"primary-dark\": \"Primary Dark\",\n secondary: \"Secondary\", accent: \"Accent\", surface: \"Surface\",\n \"surface-alt\": \"Surface Alt\", \"on-surface\": \"On Surface\",\n \"on-surface-muted\": \"On Surface Muted\", \"on-primary\": \"On Primary\",\n \"on-secondary\": \"On Secondary\", \"on-accent\": \"On Accent\",\n };\n return (\n <div className=\"mt-3 space-y-1\">\n {Object.entries(currentColors).map(([key, hex]) => (\n <label\n key={key}\n className=\"flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer\"\n >\n <input\n type=\"color\"\n value={hex}\n onChange={(e) => {\n const updated = { ...currentColors, [key]: e.target.value };\n onThemeChangeRef.current?.(themeRef.current, updated);\n }}\n className=\"w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded\"\n />\n <span className=\"text-[10px] text-gray-400 flex-1 truncate\">{COLOR_LABELS[key] || key}</span>\n <code className=\"text-[10px] text-gray-500 group-hover:text-gray-300 font-mono\">{hex}</code>\n </label>\n ))}\n </div>\n );\n })()}\n\n {brandKits && brandKits.length > 0 && (\n <>\n <p className=\"text-xs text-gray-400 font-bold uppercase tracking-wider mt-5 mb-3\">Brand Kits</p>\n <div className=\"grid grid-cols-2 gap-2\">\n {brandKits.map((bk) => {\n const bkBase = flattenColors(bk.colors as Record<string, any>) || {};\n const displayColors = activeBrandKitId === bk.id && customColors && Object.keys(customColors).length\n ? { ...bkBase, ...customColors }\n : bkBase;\n return (\n <button\n key={bk.id}\n onClick={() => {\n onThemeChangeRef.current?.(\"custom\", bkBase, bk.id);\n setActiveBrandKitId(bk.id);\n onBrandKitChangeRef.current?.(bk);\n }}\n className={`flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${\n activeBrandKitId === bk.id\n ? \"border-brand-500 bg-brand-500/10\"\n : \"border-gray-700 hover:border-gray-500\"\n }`}\n >\n <div className=\"flex gap-1\">\n {[\"primary\", \"surface\", \"accent\"].map((key) => (\n <div\n key={key}\n className=\"w-5 h-5 rounded-full border border-gray-600\"\n style={{ background: displayColors[key] || \"#888\" }}\n />\n ))}\n </div>\n <span className=\"text-[10px] font-bold text-gray-300 truncate max-w-full\">{bk.name}</span>\n </button>\n );\n })}\n </div>\n {activeBrandKitId && (() => {\n const bk = brandKits?.find((b) => b.id === activeBrandKitId);\n if (!bk) return null;\n const baseColors = flattenColors(bk.colors as Record<string, any>) || {};\n const colors = customColors && Object.keys(customColors).length\n ? { ...baseColors, ...customColors }\n : baseColors;\n return (\n <div className=\"mt-3 space-y-1\">\n {Object.entries(colors).map(([key, hex]) => (\n <label\n key={key}\n className=\"flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer\"\n >\n <input\n type=\"color\"\n value={hex}\n onChange={(e) => {\n const updated = { ...colors, [key]: e.target.value };\n onThemeChangeRef.current?.(\"custom\", updated, activeBrandKitId || undefined);\n }}\n className=\"w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded\"\n />\n <span className=\"text-[10px] text-gray-400 flex-1 truncate\">{key}</span>\n <code className=\"text-[10px] text-gray-500 group-hover:text-gray-300 font-mono\">{hex}</code>\n </label>\n ))}\n </div>\n );\n })()}\n </>\n )}\n </div>\n </div>\n );\n\n const canvas = <div ref={editorContainerRef} className=\"flex-1 h-full bg-black\" />;\n\n return (\n <div className=\"flex h-full w-full relative\">\n {panelSide === \"right\" ? <>{canvas}{sidebar}</> : <>{sidebar}{canvas}</>}\n\n {/* Glass overlay while GrapesJS loads */}\n <div\n className={`absolute inset-0 z-50 pointer-events-none bg-gray-950/40 backdrop-blur-[2px] transition-all duration-500 ${\n ready ? \"opacity-0 invisible\" : \"opacity-100\"\n }`}\n />\n </div>\n );\n }\n);\n\nGrapesEditor.displayName = \"GrapesEditor\";\nexport default GrapesEditor;\n","/**\n * Predefined blocks for GrapesJS editor.\n * All section blocks use semantic colors (bg-primary, text-on-surface, etc.)\n */\nexport const LANDING_BLOCKS = [\n // ─── Basic Elements ───────────────────────────────────\n {\n id: \"text-block\",\n label: \"Text\",\n category: \"Basic\",\n content: `<p class=\"text-base text-on-surface\">Edit this text. Double click to start typing.</p>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M4 7V4h16v3\"/><path d=\"M9 20h6\"/><path d=\"M12 4v16\"/></svg>`,\n },\n {\n id: \"heading-block\",\n label: \"Heading\",\n category: \"Basic\",\n content: `<h2 class=\"text-4xl font-black text-on-surface\">Your Heading Here</h2>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M4 12h16\"/><path d=\"M4 4v16\"/><path d=\"M20 4v16\"/></svg>`,\n },\n {\n id: \"image-block\",\n label: \"Image\",\n category: \"Basic\",\n content: { type: \"image\" },\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><path d=\"m21 15-5-5L5 21\"/></svg>`,\n },\n {\n id: \"button-block\",\n label: \"Button\",\n category: \"Basic\",\n content: `<a href=\"#\" class=\"inline-block px-8 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Click Me</a>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"8\" width=\"18\" height=\"8\" rx=\"4\"/><path d=\"M8 12h8\"/></svg>`,\n },\n {\n id: \"link-block\",\n label: \"Link\",\n category: \"Basic\",\n content: `<a href=\"#\" class=\"text-primary font-bold underline hover:text-primary-dark transition\">Your Link</a>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>`,\n },\n {\n id: \"video-block\",\n label: \"Video\",\n category: \"Basic\",\n content: { type: \"video\" },\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polygon points=\"5 3 19 12 5 21 5 3\"/></svg>`,\n },\n {\n id: \"divider-block\",\n label: \"Divider\",\n category: \"Basic\",\n content: `<hr class=\"border-t-2 border-gray-200 my-8\" />`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M3 12h18\"/></svg>`,\n },\n {\n id: \"spacer-block\",\n label: \"Spacer\",\n category: \"Basic\",\n content: `<div class=\"h-16\"></div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M12 5v14\"/><path d=\"M5 5h14\"/><path d=\"M5 19h14\"/></svg>`,\n },\n // ─── Layout ───────────────────────────────────────────\n {\n id: \"container-block\",\n label: \"Container\",\n category: \"Layout\",\n content: `<div class=\"max-w-6xl mx-auto px-6 py-12\"></div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/></svg>`,\n },\n {\n id: \"two-columns\",\n label: \"2 Columns\",\n category: \"Layout\",\n content: `<div class=\"grid grid-cols-2 gap-8 px-6 py-12 max-w-6xl mx-auto\">\n <div class=\"bg-surface-alt rounded-xl p-8 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-8 min-h-[120px]\"></div>\n</div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"2\" y=\"3\" width=\"9\" height=\"18\" rx=\"1\"/><rect x=\"13\" y=\"3\" width=\"9\" height=\"18\" rx=\"1\"/></svg>`,\n },\n {\n id: \"three-columns\",\n label: \"3 Columns\",\n category: \"Layout\",\n content: `<div class=\"grid grid-cols-3 gap-6 px-6 py-12 max-w-6xl mx-auto\">\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n</div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"1\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/><rect x=\"9\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/><rect x=\"17\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/></svg>`,\n },\n // ─── Heroes ───────────────────────────────────────────\n {\n id: \"hero-centered\",\n label: \"Hero Centered\",\n category: \"Heroes\",\n content: `<section class=\"bg-primary py-24 px-6 text-center\">\n <div class=\"max-w-4xl mx-auto\">\n <h1 class=\"text-5xl md:text-7xl font-black text-on-primary mb-6\">Your Amazing Headline</h1>\n <p class=\"text-xl text-on-primary/80 mb-10 max-w-2xl mx-auto\">A compelling subtitle that explains your value proposition in one or two sentences.</p>\n <div class=\"flex gap-4 justify-center flex-wrap\">\n <a href=\"#\" class=\"px-8 py-4 bg-accent text-on-accent font-bold rounded-xl hover:opacity-90 transition\">Get Started</a>\n <a href=\"#\" class=\"px-8 py-4 border-2 border-on-primary text-on-primary font-bold rounded-xl hover:bg-on-primary/10 transition\">Learn More</a>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"6\" y=\"2\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"8\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"9\" y=\"8\" width=\"3\" height=\"1.5\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"13\" y=\"8\" width=\"3\" height=\"1.5\" rx=\".5\" fill=\"#d1d5db\"/></svg>`,\n },\n {\n id: \"hero-split\",\n label: \"Hero Split\",\n category: \"Heroes\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto grid md:grid-cols-2 gap-12 items-center\">\n <div>\n <h1 class=\"text-5xl font-black text-on-surface mb-6\">Build Something Amazing</h1>\n <p class=\"text-lg text-on-surface/70 mb-8\">Describe your product or service. Focus on the benefits and what makes you different.</p>\n <a href=\"#\" class=\"inline-block px-8 py-4 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Start Now</a>\n </div>\n <img src=\"https://placehold.co/600x400/e2e8f0/64748b?text=Your+Image\" alt=\"Hero image\" class=\"rounded-2xl w-full\" />\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"2\" width=\"10\" height=\"2\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"1\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"1\" y=\"8\" width=\"4\" height=\"1.5\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"13\" y=\"1\" width=\"10\" height=\"10\" rx=\"1\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"hero-image-bg\",\n label: \"Hero Image BG\",\n category: \"Heroes\",\n content: `<section class=\"relative bg-primary-dark py-32 px-6 text-center overflow-hidden\">\n <img src=\"https://placehold.co/1920x800/1f2937/374151?text=Background\" alt=\"\" class=\"absolute inset-0 w-full h-full object-cover opacity-40\" />\n <div class=\"relative max-w-4xl mx-auto\">\n <h1 class=\"text-5xl md:text-7xl font-black text-on-primary mb-6\">Bold Statement Here</h1>\n <p class=\"text-xl text-on-primary/80 mb-10 max-w-2xl mx-auto\">A powerful subtitle on top of a beautiful background image.</p>\n <a href=\"#\" class=\"inline-block px-10 py-4 bg-accent text-on-accent font-bold rounded-xl text-lg hover:opacity-90 transition\">Get Started</a>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#374151\"/><rect x=\"6\" y=\"2\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"9\" y=\"8\" width=\"6\" height=\"1.5\" rx=\".5\" fill=\"#fff\"/></svg>`,\n },\n // ─── Features ─────────────────────────────────────────\n {\n id: \"features-grid\",\n label: \"Features Grid\",\n category: \"Features\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-4\">Features</h2>\n <p class=\"text-center text-on-surface/60 mb-12 max-w-2xl mx-auto\">Everything you need to succeed.</p>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-primary rounded-xl flex items-center justify-center text-on-primary text-xl mb-4\">⚡</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Lightning Fast</h3>\n <p class=\"text-on-surface/60\">Built for speed from the ground up.</p>\n </div>\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-secondary rounded-xl flex items-center justify-center text-on-secondary text-xl mb-4\">🔒</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Secure</h3>\n <p class=\"text-on-surface/60\">Enterprise-grade security by default.</p>\n </div>\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-accent rounded-xl flex items-center justify-center text-on-accent text-xl mb-4\">🎨</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Beautiful</h3>\n <p class=\"text-on-surface/60\">Pixel-perfect designs that stand out.</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"features-bento\",\n label: \"Bento Grid\",\n category: \"Features\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Why Choose Us</h2>\n <div class=\"grid md:grid-cols-3 gap-4\">\n <div class=\"md:col-span-2 bg-primary rounded-2xl p-10 text-on-primary\">\n <h3 class=\"text-2xl font-black mb-3\">All-in-one Platform</h3>\n <p class=\"text-on-primary/80\">Everything you need under one roof. No more juggling between tools.</p>\n </div>\n <div class=\"bg-secondary rounded-2xl p-10 text-on-secondary\">\n <h3 class=\"text-2xl font-black mb-3\">Fast Setup</h3>\n <p class=\"text-on-secondary/80\">Get started in under 5 minutes.</p>\n </div>\n <div class=\"bg-accent rounded-2xl p-10 text-on-accent\">\n <h3 class=\"text-2xl font-black mb-3\">24/7 Support</h3>\n <p class=\"text-on-accent/80\">Always here when you need us.</p>\n </div>\n <div class=\"md:col-span-2 bg-on-surface/5 rounded-2xl p-10\">\n <h3 class=\"text-2xl font-black text-on-surface mb-3\">Analytics Dashboard</h3>\n <p class=\"text-on-surface/60\">Track everything that matters with beautiful real-time charts.</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"14\" height=\"4\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#10b981\"/><rect x=\"1\" y=\"7\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#f59e0b\"/><rect x=\"9\" y=\"7\" width=\"14\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── Testimonials ─────────────────────────────────────\n {\n id: \"testimonials-cards\",\n label: \"Testimonials\",\n category: \"Social Proof\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">What People Say</h2>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"This product changed how we work. Absolutely incredible results in just weeks.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-primary rounded-full flex items-center justify-center text-on-primary font-bold\">A</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Alex Johnson</p><p class=\"text-xs text-on-surface/50\">CEO, TechCo</p></div>\n </div>\n </div>\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"The best tool I've used in my career. Support team is amazing.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-secondary rounded-full flex items-center justify-center text-on-secondary font-bold\">M</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Maria Garcia</p><p class=\"text-xs text-on-surface/50\">Designer, StudioX</p></div>\n </div>\n </div>\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"10x improvement in productivity. I recommend it to everyone.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-accent rounded-full flex items-center justify-center text-on-accent font-bold\">S</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Sam Lee</p><p class=\"text-xs text-on-surface/50\">CTO, BuildIt</p></div>\n </div>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"logo-cloud\",\n label: \"Logo Cloud\",\n category: \"Social Proof\",\n content: `<section class=\"bg-surface py-16 px-6\">\n <div class=\"max-w-4xl mx-auto text-center\">\n <p class=\"text-sm font-bold text-on-surface/40 uppercase tracking-wider mb-8\">Trusted by industry leaders</p>\n <div class=\"flex flex-wrap justify-center items-center gap-12 opacity-50\">\n <span class=\"text-2xl font-black text-on-surface\">Brand</span>\n <span class=\"text-2xl font-black text-on-surface\">Company</span>\n <span class=\"text-2xl font-black text-on-surface\">Startup</span>\n <span class=\"text-2xl font-black text-on-surface\">Agency</span>\n <span class=\"text-2xl font-black text-on-surface\">Studio</span>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"2\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"8\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"14\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"20\" y=\"5\" width=\"3\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/></svg>`,\n },\n // ─── Pricing ──────────────────────────────────────────\n {\n id: \"pricing-cards\",\n label: \"Pricing Cards\",\n category: \"Pricing\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-5xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-4\">Pricing</h2>\n <p class=\"text-center text-on-surface/60 mb-12\">Simple, transparent pricing.</p>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"border-2 border-on-surface/10 rounded-2xl p-8 bg-surface\">\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Basic</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$9<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ 5 Projects</li><li>✓ Basic Support</li><li>✓ 1 GB Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 border-2 border-primary text-primary font-bold rounded-xl hover:bg-primary/5 transition\">Choose Plan</a>\n </div>\n <div class=\"border-2 border-primary rounded-2xl p-8 bg-primary/5 relative\">\n <span class=\"absolute -top-3 left-1/2 -translate-x-1/2 bg-primary text-on-primary text-xs font-bold px-3 py-1 rounded-full\">Popular</span>\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Pro</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$29<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ Unlimited Projects</li><li>✓ Priority Support</li><li>✓ 50 GB Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Choose Plan</a>\n </div>\n <div class=\"border-2 border-on-surface/10 rounded-2xl p-8 bg-surface\">\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Enterprise</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$99<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ Everything in Pro</li><li>✓ Dedicated Support</li><li>✓ Unlimited Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 border-2 border-primary text-primary font-bold rounded-xl hover:bg-primary/5 transition\">Contact Sales</a>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"0\" width=\"6\" height=\"11\" rx=\".5\" fill=\"#ddd6fe\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── FAQ ──────────────────────────────────────────────\n {\n id: \"faq-section\",\n label: \"FAQ\",\n category: \"Content\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-3xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Frequently Asked Questions</h2>\n <div class=\"space-y-6\">\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\" open>\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n What is included in the free plan?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">The free plan includes up to 3 projects, basic analytics, and community support.</p>\n </details>\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\">\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n Can I upgrade at any time?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">Yes! You can upgrade or downgrade your plan at any time. Changes take effect immediately.</p>\n </details>\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\">\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n Do you offer refunds?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">We offer a 30-day money-back guarantee. No questions asked.</p>\n </details>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"3\" y=\"1\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"3\" y=\"5\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"3\" y=\"9\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── Stats ────────────────────────────────────────────\n {\n id: \"stats-section\",\n label: \"Stats\",\n category: \"Content\",\n content: `<section class=\"bg-primary py-16 px-6\">\n <div class=\"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-4 gap-8 text-center\">\n <div><div class=\"text-4xl font-black text-on-primary\">10K+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Customers</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">99.9%</div><p class=\"text-on-primary/70 mt-1 text-sm\">Uptime</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">50M+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Requests/day</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">150+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Countries</p></div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#6366f1\"/><rect x=\"2\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"14\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"20\" y=\"3\" width=\"3\" height=\"3\" rx=\".5\" fill=\"#fff\"/></svg>`,\n },\n // ─── Team ─────────────────────────────────────────────\n {\n id: \"team-section\",\n label: \"Team\",\n category: \"Content\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-5xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Our Team</h2>\n <div class=\"grid md:grid-cols-4 gap-8 text-center\">\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Jane Smith</h3>\n <p class=\"text-sm text-on-surface/50\">CEO</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">John Doe</h3>\n <p class=\"text-sm text-on-surface/50\">CTO</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Lisa Park</h3>\n <p class=\"text-sm text-on-surface/50\">Designer</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Mike Chen</h3>\n <p class=\"text-sm text-on-surface/50\">Engineer</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><circle cx=\"4\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"10\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"16\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"22\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/></svg>`,\n },\n // ─── CTA ──────────────────────────────────────────────\n {\n id: \"cta-section\",\n label: \"Call to Action\",\n category: \"CTA\",\n content: `<section class=\"bg-primary py-20 px-6\">\n <div class=\"max-w-3xl mx-auto text-center\">\n <h2 class=\"text-4xl font-black text-on-primary mb-4\">Ready to get started?</h2>\n <p class=\"text-lg text-on-primary/80 mb-8\">Join thousands of happy customers and start building today.</p>\n <a href=\"#\" class=\"inline-block px-10 py-4 bg-accent text-on-accent font-bold rounded-xl text-lg hover:opacity-90 transition\">Start Free Trial</a>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#6366f1\"/><rect x=\"6\" y=\"3\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"7\" width=\"8\" height=\"2\" rx=\".5\" fill=\"#f59e0b\"/></svg>`,\n },\n {\n id: \"newsletter-section\",\n label: \"Newsletter\",\n category: \"CTA\",\n content: `<section class=\"bg-on-surface/5 py-20 px-6\">\n <div class=\"max-w-xl mx-auto text-center\">\n <h2 class=\"text-3xl font-black text-on-surface mb-4\">Stay Updated</h2>\n <p class=\"text-on-surface/60 mb-8\">Get the latest news and updates straight to your inbox.</p>\n <form class=\"flex gap-3 max-w-md mx-auto\">\n <input type=\"email\" placeholder=\"your@email.com\" class=\"flex-1 px-4 py-3 rounded-xl border-2 border-on-surface/20 bg-surface focus:border-primary focus:outline-none\" />\n <button class=\"px-6 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Subscribe</button>\n </form>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"5\" y=\"6\" width=\"10\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"16\" y=\"6\" width=\"4\" height=\"2.5\" rx=\".5\" fill=\"#6366f1\"/></svg>`,\n },\n // ─── Footer ───────────────────────────────────────────\n {\n id: \"footer\",\n label: \"Footer\",\n category: \"Footer\",\n content: `<section class=\"bg-on-surface py-12 px-6\">\n <div class=\"max-w-6xl mx-auto flex flex-col md:flex-row justify-between items-center gap-6\">\n <div class=\"text-surface font-black text-xl\">YourBrand</div>\n <nav class=\"flex gap-6 text-surface/70 text-sm\">\n <a href=\"#\" class=\"hover:text-surface transition\">About</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Features</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Pricing</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Contact</a>\n </nav>\n <p class=\"text-surface/50 text-xs\">© 2026 YourBrand. All rights reserved.</p>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#1f2937\"/><rect x=\"1\" y=\"5\" width=\"6\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"10\" y=\"5\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"16\" y=\"5\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#6b7280\"/></svg>`,\n },\n {\n id: \"footer-columns\",\n label: \"Footer Columns\",\n category: \"Footer\",\n content: `<section class=\"bg-on-surface py-16 px-6\">\n <div class=\"max-w-6xl mx-auto grid md:grid-cols-4 gap-8\">\n <div>\n <h4 class=\"text-surface font-black text-lg mb-4\">YourBrand</h4>\n <p class=\"text-surface/50 text-sm\">Building the future, one pixel at a time.</p>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Product</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">Features</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Pricing</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Changelog</a></li></ul>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Company</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">About</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Blog</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Careers</a></li></ul>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Legal</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">Privacy</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Terms</a></li></ul>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#1f2937\"/><rect x=\"1\" y=\"2\" width=\"5\" height=\"1\" rx=\".25\" fill=\"#fff\"/><rect x=\"8\" y=\"2\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"8\" y=\"4\" width=\"3\" height=\".5\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"8\" y=\"5.5\" width=\"3\" height=\".5\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"14\" y=\"2\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"20\" y=\"2\" width=\"3\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/></svg>`,\n },\n];\n","import { useEffect, useState, useRef, useCallback } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type { Editor } from \"grapesjs\";\n\ninterface Props {\n editor: Editor | null;\n /** Bumped when theme/customColors change — forces color preview re-resolve */\n themeVersion?: number;\n /** Resolved theme colors keyed by semantic name (e.g. \"primary\" → \"#6366f1\") */\n themeColors?: Record<string, string>;\n}\n\ninterface ClassCategory {\n label: string;\n classes: string[];\n}\n\nconst CATEGORIES: { id: string; label: string; test: (c: string) => boolean }[] = [\n { id: \"layout\", label: \"Layout\", test: (c) => /^(flex|grid|block|inline|hidden|col-|row-|justify-|items-|self-|overflow-|order-|relative|absolute|fixed|sticky|inset-|top-|right-|bottom-|left-|z-|container)/.test(c) },\n { id: \"spacing\", label: \"Spacing\", test: (c) => /^(p-|px-|py-|pt-|pr-|pb-|pl-|m-|mx-|my-|mt-|mr-|mb-|ml-|gap-|space-)/.test(c) },\n { id: \"sizing\", label: \"Sizing\", test: (c) => /^(w-|h-|min-w-|max-w-|min-h-|max-h-|size-)/.test(c) },\n { id: \"typography\", label: \"Typography\", test: (c) => /^(text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl|left|center|right|justify|wrap|nowrap|ellipsis|balance)|font-|leading-|tracking-|uppercase|lowercase|capitalize|italic|not-italic|truncate|line-clamp|whitespace-)/.test(c) },\n { id: \"colors\", label: \"Colors\", test: (c) => /^(bg-|text-(?!xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl|left|center|right|justify|wrap|nowrap|ellipsis|balance)|from-|to-|via-|decoration-)/.test(c) },\n { id: \"borders\", label: \"Borders\", test: (c) => /^(border|rounded|ring-|divide-|outline-)/.test(c) },\n { id: \"effects\", label: \"Effects\", test: (c) => /^(shadow|opacity-|blur-|transition|duration-|ease-|animate-|transform|scale-|rotate-|translate-|hover:|focus:|active:|group-)/.test(c) },\n];\n\nfunction categorize(classes: string[]): ClassCategory[] {\n const buckets: Record<string, string[]> = {};\n const other: string[] = [];\n\n for (const cls of classes) {\n let matched = false;\n for (const cat of CATEGORIES) {\n // Strip responsive prefix for matching\n const bare = cls.replace(/^(sm:|md:|lg:|xl:|2xl:)/, \"\");\n if (cat.test(bare)) {\n (buckets[cat.id] ??= []).push(cls);\n matched = true;\n break;\n }\n }\n if (!matched) other.push(cls);\n }\n\n const result: ClassCategory[] = [];\n for (const cat of CATEGORIES) {\n if (buckets[cat.id]?.length) {\n result.push({ label: cat.label, classes: buckets[cat.id] });\n }\n }\n if (other.length) result.push({ label: \"Other\", classes: other });\n return result;\n}\n\n// Semantic theme color hints — grouped by property\nconst THEME_HINTS: { label: string; prefix: string; colors: { cls: string; name: string }[] }[] = [\n {\n label: \"Texto\", prefix: \"text-\",\n colors: [\n { cls: \"text-on-primary\", name: \"on-primary\" }, { cls: \"text-on-secondary\", name: \"on-secondary\" },\n { cls: \"text-on-accent\", name: \"on-accent\" }, { cls: \"text-on-surface\", name: \"on-surface\" },\n { cls: \"text-on-surface-muted\", name: \"on-surface-muted\" },\n ],\n },\n {\n label: \"Fondo\", prefix: \"bg-\",\n colors: [\n { cls: \"bg-primary\", name: \"primary\" }, { cls: \"bg-primary-light\", name: \"primary-light\" },\n { cls: \"bg-primary-dark\", name: \"primary-dark\" }, { cls: \"bg-secondary\", name: \"secondary\" },\n { cls: \"bg-accent\", name: \"accent\" }, { cls: \"bg-surface\", name: \"surface\" },\n { cls: \"bg-surface-alt\", name: \"surface-alt\" },\n ],\n },\n {\n label: \"Borde\", prefix: \"border-\",\n colors: [\n { cls: \"border-primary\", name: \"primary\" }, { cls: \"border-secondary\", name: \"secondary\" },\n { cls: \"border-accent\", name: \"accent\" }, { cls: \"border-surface-alt\", name: \"surface-alt\" },\n ],\n },\n];\n\n// Curated autocomplete list\nconst COMMON_CLASSES = [\n // Layout\n \"flex\", \"flex-col\", \"flex-row\", \"flex-wrap\", \"grid\", \"grid-cols-2\", \"grid-cols-3\", \"grid-cols-4\",\n \"block\", \"inline-block\", \"hidden\", \"relative\", \"absolute\", \"fixed\", \"sticky\",\n \"justify-start\", \"justify-center\", \"justify-end\", \"justify-between\", \"justify-around\",\n \"items-start\", \"items-center\", \"items-end\", \"items-stretch\",\n \"overflow-hidden\", \"overflow-auto\", \"z-10\", \"z-20\", \"z-50\",\n // Spacing\n \"p-0\", \"p-1\", \"p-2\", \"p-3\", \"p-4\", \"p-6\", \"p-8\", \"p-10\", \"p-12\", \"p-16\", \"p-20\",\n \"px-2\", \"px-4\", \"px-6\", \"px-8\", \"px-10\", \"px-12\", \"px-16\",\n \"py-2\", \"py-4\", \"py-6\", \"py-8\", \"py-10\", \"py-12\", \"py-16\", \"py-20\", \"py-24\",\n \"m-0\", \"m-auto\", \"mx-auto\", \"my-2\", \"my-4\", \"my-6\", \"my-8\",\n \"mt-2\", \"mt-4\", \"mt-6\", \"mt-8\", \"mb-2\", \"mb-4\", \"mb-6\", \"mb-8\",\n \"gap-1\", \"gap-2\", \"gap-3\", \"gap-4\", \"gap-6\", \"gap-8\", \"gap-10\", \"gap-12\",\n \"space-x-2\", \"space-x-4\", \"space-y-2\", \"space-y-4\", \"space-y-6\",\n // Sizing\n \"w-full\", \"w-auto\", \"w-1/2\", \"w-1/3\", \"w-2/3\", \"w-1/4\", \"w-3/4\", \"w-screen\",\n \"w-8\", \"w-10\", \"w-12\", \"w-16\", \"w-20\", \"w-24\", \"w-32\", \"w-48\", \"w-64\",\n \"h-full\", \"h-auto\", \"h-screen\", \"h-8\", \"h-10\", \"h-12\", \"h-16\", \"h-20\", \"h-24\", \"h-32\", \"h-48\", \"h-64\",\n \"max-w-sm\", \"max-w-md\", \"max-w-lg\", \"max-w-xl\", \"max-w-2xl\", \"max-w-4xl\", \"max-w-6xl\", \"max-w-7xl\", \"max-w-full\",\n \"min-h-screen\", \"min-h-0\",\n // Typography\n \"text-xs\", \"text-sm\", \"text-base\", \"text-lg\", \"text-xl\", \"text-2xl\", \"text-3xl\", \"text-4xl\", \"text-5xl\", \"text-6xl\",\n \"font-thin\", \"font-light\", \"font-normal\", \"font-medium\", \"font-semibold\", \"font-bold\", \"font-extrabold\", \"font-black\",\n \"text-left\", \"text-center\", \"text-right\", \"leading-tight\", \"leading-normal\", \"leading-relaxed\",\n \"tracking-tight\", \"tracking-normal\", \"tracking-wide\", \"uppercase\", \"lowercase\", \"capitalize\", \"italic\", \"truncate\",\n // Colors (semantic)\n \"bg-primary\", \"bg-primary-light\", \"bg-primary-dark\", \"bg-secondary\", \"bg-accent\", \"bg-surface\", \"bg-surface-alt\",\n \"text-on-primary\", \"text-on-secondary\", \"text-on-accent\", \"text-on-surface\", \"text-on-surface-muted\",\n // Colors (common)\n \"bg-white\", \"bg-black\", \"bg-transparent\", \"bg-gray-50\", \"bg-gray-100\", \"bg-gray-200\", \"bg-gray-800\", \"bg-gray-900\",\n \"text-white\", \"text-black\", \"text-gray-300\", \"text-gray-400\", \"text-gray-500\", \"text-gray-600\", \"text-gray-700\", \"text-gray-900\",\n // Borders\n \"border\", \"border-0\", \"border-2\", \"border-4\", \"border-t\", \"border-b\",\n \"border-gray-200\", \"border-gray-300\", \"border-gray-700\",\n \"rounded\", \"rounded-md\", \"rounded-lg\", \"rounded-xl\", \"rounded-2xl\", \"rounded-3xl\", \"rounded-full\", \"rounded-none\",\n \"ring-1\", \"ring-2\", \"ring-4\",\n // Effects\n \"shadow-sm\", \"shadow\", \"shadow-md\", \"shadow-lg\", \"shadow-xl\", \"shadow-2xl\", \"shadow-none\",\n \"opacity-0\", \"opacity-50\", \"opacity-75\", \"opacity-100\",\n \"transition\", \"transition-all\", \"transition-colors\", \"duration-150\", \"duration-200\", \"duration-300\",\n \"hover:opacity-80\", \"hover:scale-105\", \"hover:shadow-lg\",\n \"animate-pulse\", \"animate-bounce\",\n // Misc\n \"cursor-pointer\", \"select-none\", \"object-cover\", \"object-contain\", \"aspect-square\", \"aspect-video\",\n];\n\nexport default function TailwindClassEditor({ editor, themeVersion = 0, themeColors = {} }: Props) {\n const [classes, setClasses] = useState<string[]>([]);\n const [search, setSearch] = useState(\"\");\n const [showSuggestions, setShowSuggestions] = useState(false);\n const [highlightIdx, setHighlightIdx] = useState(-1);\n const [selectedComponent, setSelectedComponent] = useState<any>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const suggestionsRef = useRef<HTMLDivElement>(null);\n\n const readClasses = useCallback((component: any) => {\n if (!component) return [];\n const attrs = component.getAttributes?.() || {};\n const modelClass = attrs.class || \"\";\n if (modelClass) {\n return modelClass.split(/\\s+/).filter((c: string) => c && !c.startsWith(\"gjs-\"));\n }\n const el = component.getEl?.();\n if (!el) return [];\n const raw = typeof el.className === \"string\" ? el.className : el.className?.baseVal || \"\";\n return raw.split(/\\s+/).filter((c: string) => c && !c.startsWith(\"gjs-\"));\n }, []);\n\n const writeClasses = useCallback((component: any, newClasses: string[]) => {\n if (!component) return;\n const merged = twMerge(newClasses.join(\" \"));\n const newClassList = merged.split(/\\s+/).filter(Boolean);\n\n const el = component.getEl();\n if (el) {\n const raw = typeof el.className === \"string\" ? el.className : el.className?.baseVal || \"\";\n const gjsClasses = raw.split(/\\s+/).filter((c: string) => c.startsWith(\"gjs-\"));\n el.className = [...gjsClasses, ...newClassList].join(\" \");\n }\n\n const currentClasses = component.getClasses();\n currentClasses.forEach((cls: string) => {\n if (!cls.startsWith(\"gjs-\")) component.removeClass(cls);\n });\n newClassList.forEach((cls: string) => component.addClass(cls));\n\n editor?.trigger(\"sidebar:change\");\n\n setClasses(newClassList);\n }, [editor]);\n\n useEffect(() => {\n if (!editor) return;\n const onSelected = (component: any) => {\n setSelectedComponent(component);\n setClasses(readClasses(component));\n setSearch(\"\");\n };\n const onDeselected = () => {\n setSelectedComponent(null);\n setClasses([]);\n };\n const onUpdate = (component: any) => {\n if (component === selectedComponent || editor.getSelected() === component) {\n setClasses(readClasses(component));\n }\n };\n\n editor.on(\"component:selected\", onSelected);\n editor.on(\"component:deselected\", onDeselected);\n editor.on(\"component:update\", onUpdate);\n\n const current = editor.getSelected();\n if (current) onSelected(current);\n\n return () => {\n editor.off(\"component:selected\", onSelected);\n editor.off(\"component:deselected\", onDeselected);\n editor.off(\"component:update\", onUpdate);\n };\n }, [editor, readClasses, selectedComponent]);\n\n const removeClass = (cls: string) => {\n if (!selectedComponent) return;\n writeClasses(selectedComponent, classes.filter((c) => c !== cls));\n };\n\n const addClass = (cls: string) => {\n if (!selectedComponent || !cls.trim()) return;\n writeClasses(selectedComponent, [...classes, cls.trim()]);\n setSearch(\"\");\n setShowSuggestions(false);\n inputRef.current?.focus();\n };\n\n const filteredSuggestions = search.trim()\n ? COMMON_CLASSES.filter(\n (c) => c.includes(search.trim().toLowerCase()) && !classes.includes(c)\n ).slice(0, 20)\n : [];\n\n const categories = categorize(classes);\n\n const getColorPreview = (cls: string): string | null => {\n if (!editor || !selectedComponent) return null;\n const bare = cls.replace(/^(sm:|md:|lg:|xl:|2xl:)/, \"\");\n if (!/^(bg-|text-|from-|to-|via-|border-)/.test(bare)) return null;\n if (/^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|left|center|right)/.test(bare)) return null;\n try {\n const doc = editor.Canvas.getDocument();\n const win = doc?.defaultView;\n if (!win) return null;\n const tmp = doc.createElement(\"div\");\n tmp.className = cls;\n tmp.style.position = \"absolute\";\n tmp.style.visibility = \"hidden\";\n doc.body.appendChild(tmp);\n const computed = win.getComputedStyle(tmp);\n const color = bare.startsWith(\"text-\") || bare.startsWith(\"decoration-\")\n ? computed.color\n : bare.startsWith(\"border-\")\n ? computed.borderColor\n : computed.backgroundColor;\n doc.body.removeChild(tmp);\n if (color && color !== \"rgba(0, 0, 0, 0)\" && color !== \"transparent\") return color;\n } catch { /* ignore */ }\n return null;\n };\n\n if (!selectedComponent) {\n return (\n <div className=\"p-4 text-center text-gray-500 text-xs\">\n <p className=\"mb-1 text-base\">◎</p>\n Selecciona un elemento para editar sus clases Tailwind\n </div>\n );\n }\n\n const tagName = selectedComponent.get?.(\"tagName\") || \"div\";\n\n return (\n <div className=\"flex flex-col h-full\">\n <div className=\"px-3 py-2 border-b border-gray-700 flex items-center gap-2\">\n <code className=\"text-[11px] bg-gray-800 text-brand-400 px-1.5 py-0.5 rounded font-mono\">\n <{tagName}>\n </code>\n <span className=\"text-[10px] text-gray-500\">{classes.length} clases</span>\n </div>\n\n <div className=\"px-3 py-2 border-b border-gray-700 relative\">\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => {\n setSearch(e.target.value);\n setShowSuggestions(true);\n setHighlightIdx(-1);\n }}\n onFocus={() => setShowSuggestions(true)}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" && showSuggestions && filteredSuggestions.length > 0) {\n e.preventDefault();\n setHighlightIdx((i) => Math.min(i + 1, filteredSuggestions.length - 1));\n } else if (e.key === \"ArrowUp\" && showSuggestions && filteredSuggestions.length > 0) {\n e.preventDefault();\n setHighlightIdx((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\" && search.trim()) {\n e.preventDefault();\n if (showSuggestions && filteredSuggestions.length > 0) {\n addClass(filteredSuggestions[highlightIdx >= 0 ? highlightIdx : 0]);\n } else {\n addClass(search.trim());\n }\n } else if (e.key === \"Escape\") {\n setShowSuggestions(false);\n setSearch(\"\");\n setHighlightIdx(-1);\n }\n }}\n placeholder=\"Agregar clase...\"\n className=\"w-full bg-gray-800 border border-gray-600 rounded-lg px-3 py-1.5 text-xs text-gray-200 placeholder-gray-500 focus:border-brand-500 focus:outline-none\"\n />\n\n {showSuggestions && filteredSuggestions.length > 0 && (\n <div\n ref={suggestionsRef}\n className=\"absolute left-3 right-3 top-full mt-1 bg-gray-800 border border-gray-600 rounded-lg shadow-xl z-50 max-h-48 overflow-auto\"\n >\n {filteredSuggestions.map((s, i) => (\n <button\n key={s}\n ref={(el) => { if (i === highlightIdx && el) el.scrollIntoView({ block: \"nearest\" }); }}\n onMouseDown={(e) => {\n e.preventDefault();\n addClass(s);\n }}\n onMouseEnter={() => setHighlightIdx(i)}\n className={`w-full text-left px-3 py-1.5 text-xs transition-colors font-mono ${\n i === highlightIdx ? \"bg-brand-500/20 text-white\" : \"text-gray-300 hover:bg-gray-700 hover:text-white\"\n }`}\n >\n {s}\n </button>\n ))}\n </div>\n )}\n </div>\n\n <div className=\"flex-1 overflow-auto p-3 space-y-3\">\n {categories.length === 0 && (\n <p className=\"text-xs text-gray-500 text-center py-4\">Sin clases Tailwind</p>\n )}\n {categories.map((cat) => (\n <div key={cat.label}>\n <p className=\"text-[10px] text-gray-500 font-bold uppercase tracking-wider mb-1.5\">\n {cat.label}\n </p>\n <div className=\"flex flex-wrap gap-1\">\n {cat.classes.map((cls) => {\n const color = getColorPreview(cls);\n return (\n <span\n key={cls}\n className=\"inline-flex items-center gap-1 bg-gray-800 border border-gray-600 rounded-md px-2 py-0.5 text-[11px] font-mono text-gray-300 hover:border-gray-400 group\"\n >\n {color && (\n <span\n className=\"w-2.5 h-2.5 rounded-full border border-gray-500 shrink-0\"\n style={{ backgroundColor: color }}\n />\n )}\n {cls}\n <button\n onClick={() => removeClass(cls)}\n className=\"text-gray-600 hover:text-red-400 transition-colors ml-0.5 opacity-0 group-hover:opacity-100\"\n title=\"Eliminar\"\n >\n ×\n </button>\n </span>\n );\n })}\n </div>\n </div>\n ))}\n\n <div className=\"border-t border-gray-700 pt-3 mt-1 space-y-2.5\">\n <p className=\"text-[10px] text-gray-500 font-bold uppercase tracking-wider\">Colores del tema</p>\n {THEME_HINTS.map((group) => (\n <div key={group.label}>\n <p className=\"text-[10px] text-gray-600 mb-1\">{group.label}</p>\n <div className=\"flex flex-wrap gap-1\">\n {group.colors.map(({ cls, name }) => {\n const semanticName = cls.replace(/^(bg-|text-|border-)/, \"\");\n const color = themeColors[semanticName] || getColorPreview(cls);\n const isActive = classes.includes(cls);\n return (\n <button\n key={cls}\n onClick={() => isActive ? removeClass(cls) : addClass(cls)}\n className={`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-mono transition-all ${\n isActive\n ? \"bg-brand-500/20 border border-brand-500 text-brand-300\"\n : \"bg-gray-800/60 border border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300\"\n }`}\n title={cls}\n >\n <span\n className=\"w-2.5 h-2.5 rounded-full border border-gray-600 shrink-0\"\n style={{ backgroundColor: color || \"#666\" }}\n />\n {name}\n </button>\n );\n })}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n );\n}\n","/** GrapesJS dark theme CSS — injected at runtime to avoid CSS bundling */\nexport const GRAPES_DARK_CSS = `\n/* Dark theme for GrapesJS editor — matches EasyBits dark sidebar */\n\n/* Main editor background */\n.gjs-one-bg { background-color: #111827 !important; }\n.gjs-two-color { color: #e5e7eb !important; }\n.gjs-three-bg { background-color: #1f2937 !important; }\n.gjs-four-color, .gjs-four-color-h:hover { color: #9ca3af !important; }\n\n/* Editor chrome */\n.gjs-editor { background-color: #000000 !important; }\n\n/* Block manager */\n.gjs-blocks-cs { background-color: #111827 !important; }\n.gjs-block { background-color: #1f2937 !important; color: #e5e7eb !important; border: 1px solid #374151 !important; border-radius: 8px !important; }\n.gjs-block:hover { border-color: #9870ED !important; }\n.gjs-block-label { color: #d1d5db !important; }\n.gjs-block svg { fill: #9ca3af !important; }\n\n/* Block categories */\n.gjs-block-categories { background-color: #111827 !important; }\n.gjs-block-category { background-color: #111827 !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-block-category .gjs-title { background-color: #111827 !important; color: #e5e7eb !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-block-category .gjs-title:hover { background-color: #1f2937 !important; }\n.gjs-block-category .gjs-caret-icon { color: #9ca3af !important; }\n\n/* Layer manager */\n.gjs-layers { background-color: #111827 !important; }\n.gjs-layer { background-color: #111827 !important; color: #e5e7eb !important; }\n.gjs-layer:hover { background-color: #1f2937 !important; }\n.gjs-layer-title { color: #e5e7eb !important; }\n.gjs-layer-title-inn { background-color: transparent !important; }\n.gjs-layer.gjs-selected .gjs-layer-title { background-color: rgba(152, 112, 237, 0.15) !important; }\n.gjs-layer-name { color: #e5e7eb !important; }\n.gjs-layer-vis { color: #9ca3af !important; }\n.gjs-layer-caret { color: #9ca3af !important; }\n\n/* Style manager */\n.gjs-sm-sectors { background-color: #111827 !important; }\n.gjs-sm-sector { background-color: #111827 !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-sector-title { background-color: #111827 !important; color: #e5e7eb !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-sector-title:hover { background-color: #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-properties { background-color: #111827 !important; }\n.gjs-sm-label { color: #9ca3af !important; }\n.gjs-field { background-color: #1f2937 !important; border: 1px solid #374151 !important; color: #e5e7eb !important; }\n.gjs-field input, .gjs-field select, .gjs-field textarea { color: #e5e7eb !important; background-color: transparent !important; }\n.gjs-field .gjs-input-holder { color: #e5e7eb !important; }\n.gjs-field-arrows { color: #9ca3af !important; }\n.gjs-sm-composite { background-color: #111827 !important; }\n.gjs-sm-stack #gjs-sm-add { color: #9ca3af !important; }\n\n/* Trait manager */\n.gjs-trt-traits { background-color: #111827 !important; }\n.gjs-trt-trait { color: #e5e7eb !important; }\n\n/* Panels */\n.gjs-pn-panel { background-color: #111827 !important; }\n.gjs-pn-btn { color: #9ca3af !important; }\n.gjs-pn-btn:hover { color: #e5e7eb !important; }\n.gjs-pn-btn.gjs-pn-active { color: #9870ED !important; }\n\n/* Canvas — full width, no padding */\n.gjs-cv-canvas { background-color: #000000 !important; }\n.gjs-frame-wrapper { padding: 0 !important; }\n.gjs-frame { width: 100% !important; left: 0 !important; }\n\n/* Toolbar on selected component */\n.gjs-toolbar { background-color: #9870ED !important; }\n.gjs-toolbar-item { color: white !important; }\n\n/* Selection highlight */\n.gjs-selected { outline: 2px solid #9870ED !important; outline-offset: -2px; }\n.gjs-highlighter { outline: 2px solid #9870ED !important; }\n\n/* Scrollbars */\n.gjs-editor ::-webkit-scrollbar { width: 6px; }\n.gjs-editor ::-webkit-scrollbar-track { background: #111827; }\n.gjs-editor ::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }\n.gjs-editor ::-webkit-scrollbar-thumb:hover { background: #4b5563; }\n\n/* Hide native GrapesJS panel buttons (preview eye, etc.) but keep panel system functional */\n.gjs-pn-btn {\n display: none !important;\n}\n/* The panels container that holds the buttons row */\n.gjs-pn-commands,\n.gjs-pn-options,\n.gjs-pn-views {\n height: 0 !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n/* Rich text editor */\n.gjs-rte-toolbar { background-color: #1f2937 !important; border: 1px solid #374151 !important; }\n.gjs-rte-actionbar { background-color: #1f2937 !important; }\n.gjs-rte-action { color: #e5e7eb !important; }\n`;\n"],"mappings":";;;;;;;AAAA,SAAS,aAAAA,YAAW,UAAAC,SAAQ,YAAAC,WAAU,YAAY,2BAA2B;;;ACItE,IAAM,iBAAiB;AAAA;AAAA,EAE5B;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS,EAAE,MAAM,QAAQ;AAAA,IACzB,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,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":["../src/components4/GrapesEditor.tsx","../src/components4/blocks.ts","../src/components4/TailwindClassEditor.tsx","../src/components4/ImageSrcEditor.tsx","../src/components4/grapesDarkCss.ts"],"sourcesContent":["import { useEffect, useRef, useState, forwardRef, useImperativeHandle } from \"react\";\nimport type { Editor } from \"grapesjs\";\nimport { LANDING_BLOCKS } from \"./blocks\";\nimport { buildSingleThemeCss, buildCustomTheme, LANDING_THEMES } from \"../themes\";\nimport TailwindClassEditor from \"./TailwindClassEditor\";\nimport ImageSrcEditor from \"./ImageSrcEditor\";\nimport { GRAPES_DARK_CSS } from \"./grapesDarkCss\";\n\n/** Inject GrapesJS dark theme CSS once at runtime */\nlet darkCssInjected = false;\nfunction injectDarkCss() {\n if (darkCssInjected || typeof document === \"undefined\") return;\n darkCssInjected = true;\n const style = document.createElement(\"style\");\n style.setAttribute(\"data-grapes-dark\", \"\");\n style.textContent = GRAPES_DARK_CSS;\n document.head.appendChild(style);\n}\n\n/** Flatten brand kit colors: keep string entries and convert extras array to named colors */\nfunction flattenColors(colors: Record<string, any> | undefined): Record<string, string> | undefined {\n if (!colors) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(colors)) {\n if (typeof v === \"string\") {\n out[k] = v;\n } else if (k === \"extras\" && Array.isArray(v)) {\n v.forEach((extra: { name?: string; hex?: string }, i: number) => {\n if (extra?.hex) {\n out[extra.name || `extra-${i + 1}`] = extra.hex;\n }\n });\n }\n }\n return Object.keys(out).length ? out : undefined;\n}\n\nexport interface AiAction {\n type: \"refine-element\";\n componentId: string;\n html: string;\n sectionHtml?: string;\n sectionComponentId?: string;\n isSection?: boolean;\n}\n\nexport interface GrapesEditorHandle {\n getEditor: () => Editor | null;\n getHtml: () => string;\n setHtml: (html: string) => void;\n /** Replace a component's HTML by its GrapesJS ID */\n replaceComponent: (componentId: string, newHtml: string) => void;\n /** Toggle preview mode, returns new state */\n togglePreview: () => boolean;\n /** Toggle sw-visibility (component border guides), returns new state */\n toggleSwVisibility: () => boolean;\n /** Scroll the canvas iframe to a section by data-section-id. Falls back to iframe DOM query if the component model lost the attribute. */\n scrollToSection: (sectionId: string) => void;\n /** Scroll the canvas to the N-th content section (skips __grapes_css__ style). Index-based is robust even when GrapesJS strips data-* attributes during parse. */\n scrollToIndex: (index: number) => void;\n /** Set canvas zoom level (percentage, e.g. 50 = 50%) */\n setZoom: (value: number) => void;\n /** Get current canvas zoom level */\n getZoom: () => number;\n}\n\ninterface BrandKitItem {\n id: string;\n name: string;\n colors: Record<string, string>;\n fonts?: { heading?: string; body?: string } | null;\n mood?: string | null;\n logoUrl?: string | null;\n isDefault?: boolean;\n}\n\ninterface Props {\n initialHtml: string;\n theme?: string;\n customColors?: Record<string, string>;\n brandKits?: BrandKitItem[];\n onChange?: (html: string) => void;\n onAiAction?: (action: AiAction) => void;\n onThemeChange?: (themeId: string, customColors?: Record<string, string>, brandKitId?: string) => void;\n onBrandKitChange?: (brandKit: BrandKitItem | null) => void;\n /** Persisted brand kit ID — restored from metadata on load */\n initialBrandKitId?: string;\n /** Hide specific panel tabs (e.g. [\"blocks\"] for documents) */\n hiddenTabs?: PanelId[];\n /** Extra CSS injected into the canvas iframe (e.g. document page sizing) */\n canvasStyles?: string;\n /** Set to false to hide device switcher (always single viewport) */\n devices?: false;\n /** Which side to render the panel sidebar — default \"left\" */\n panelSide?: \"left\" | \"right\";\n /** Override default blocks (LANDING_BLOCKS). Pass custom blocks for different editors (e.g. presentations). */\n blocks?: { id: string; label: string; category: string; content: string | object; media?: string }[];\n /** Called when the most visible section changes due to canvas scroll */\n onVisibleSectionChange?: (sectionId: string) => void;\n}\n\nconst PANEL_TABS = [\n { id: \"blocks\", label: \"Bloques\", icon: \"⊞\" },\n { id: \"layers\", label: \"Capas\", icon: \"☰\" },\n { id: \"styles\", label: \"Estilos\", icon: \"◑\" },\n { id: \"themes\", label: \"Temas\", icon: \"◈\" },\n] as const;\n\nexport type PanelId = (typeof PANEL_TABS)[number][\"id\"];\n\nconst GrapesEditor = forwardRef<GrapesEditorHandle, Props>(\n ({ initialHtml, theme = \"minimal\", customColors: rawCustomColors, brandKits, onChange, onAiAction, onThemeChange, onBrandKitChange, initialBrandKitId, hiddenTabs = [], canvasStyles, devices, panelSide = \"left\", blocks: customBlocks, onVisibleSectionChange }, ref) => {\n // Inject dark CSS on first render\n useEffect(() => { injectDarkCss(); }, []);\n\n // Strip non-string entries (e.g. extras array from brand kits)\n const customColors = flattenColors(rawCustomColors);\n const editorContainerRef = useRef<HTMLDivElement>(null);\n const blocksRef = useRef<HTMLDivElement>(null);\n const layersRef = useRef<HTMLDivElement>(null);\n const editorRef = useRef<Editor | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onAiActionRef = useRef(onAiAction);\n onAiActionRef.current = onAiAction;\n const onVisibleSectionChangeRef = useRef(onVisibleSectionChange);\n onVisibleSectionChangeRef.current = onVisibleSectionChange;\n const onThemeChangeRef = useRef(onThemeChange);\n onThemeChangeRef.current = onThemeChange;\n const onBrandKitChangeRef = useRef(onBrandKitChange);\n onBrandKitChangeRef.current = onBrandKitChange;\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const customColorsRef = useRef(customColors);\n customColorsRef.current = customColors;\n const [activeBrandKitId, setActiveBrandKitId] = useState<string | null>(initialBrandKitId || null);\n const visibleTabs = PANEL_TABS.filter((t) => !hiddenTabs.includes(t.id));\n const [activePanel, setActivePanel] = useState<PanelId>(() =>\n visibleTabs.find((t) => t.id === \"styles\")?.id ?? visibleTabs[0]?.id ?? \"styles\"\n );\n const [ready, setReady] = useState(false);\n const [themeVersion, setThemeVersion] = useState(0);\n\n useImperativeHandle(ref, () => ({\n getEditor: () => editorRef.current,\n getHtml: () => {\n const ed = editorRef.current;\n if (!ed) return \"\";\n const html = ed.getHtml();\n const css = ed.getCss();\n return css ? `<style>${css}</style>\\n${html}` : html;\n },\n setHtml: (html: string) => editorRef.current?.setComponents(html),\n togglePreview: () => {\n const ed = editorRef.current;\n if (!ed) return false;\n const cmd = ed.Commands;\n if (cmd.isActive(\"preview\")) {\n cmd.stop(\"preview\");\n if (!cmd.isActive(\"sw-visibility\")) cmd.run(\"sw-visibility\");\n return false;\n } else {\n if (cmd.isActive(\"sw-visibility\")) cmd.stop(\"sw-visibility\");\n ed.select();\n cmd.run(\"preview\");\n return true;\n }\n },\n toggleSwVisibility: () => {\n const ed = editorRef.current;\n if (!ed) return false;\n const cmd = ed.Commands;\n if (cmd.isActive(\"sw-visibility\")) {\n cmd.stop(\"sw-visibility\");\n return false;\n } else {\n cmd.run(\"sw-visibility\");\n return true;\n }\n },\n scrollToSection: (sectionId: string) => {\n const ed = editorRef.current;\n if (!ed) return;\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comps = wrapper.components().models || [];\n\n // (a) Try the GrapesJS model. This is the fast path when attributes were preserved.\n const target = comps.find((c: any) => c.getAttributes()[\"data-section-id\"] === sectionId);\n if (target) {\n ed.select(target);\n (ed.Canvas as any).scrollTo?.(target, { behavior: \"smooth\", block: \"start\", force: true });\n return;\n }\n\n // (b) GrapesJS sometimes discards custom `data-*` attributes from the model\n // while keeping them on the rendered DOM. Scroll via the iframe element directly —\n // Canvas.scrollTo accepts an HTMLElement too.\n const doc = ed.Canvas.getDocument();\n const el = doc?.querySelector(`[data-section-id=\"${sectionId}\"]`) as HTMLElement | null;\n if (el) {\n (ed.Canvas as any).scrollTo?.(el, { behavior: \"smooth\", block: \"start\", force: true });\n return;\n }\n\n console.warn(\"[scrollToSection] Section not found:\", sectionId, \"Model attrs:\", comps.map((c: any) => c.getAttributes()[\"data-section-id\"]), \"DOM has [data-section-id]?\", !!doc?.querySelector(\"[data-section-id]\"));\n },\n\n scrollToIndex: (index: number) => {\n const ed = editorRef.current;\n if (!ed) return;\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comps = wrapper.components().models || [];\n // Skip head-like tags that importers (splitIntoPages) prepend per page:\n // <link>, <style>, <script>, <meta>, <title>, <base>. Without this filter,\n // `contentComps[N]` can land on a zero-height <link> instead of the target\n // <section>, which makes every click scroll to the same place.\n const HEAD_TAGS = new Set([\"style\", \"script\", \"link\", \"meta\", \"title\", \"base\"]);\n const contentComps = comps.filter((c: any) => {\n const tag = (c.get(\"tagName\") || \"\").toLowerCase();\n return tag && !HEAD_TAGS.has(tag);\n });\n const target = contentComps[index];\n if (!target) return;\n ed.select(target);\n const el = target.getEl() as HTMLElement | undefined;\n if (index === 0) {\n ed.Canvas.getDocument()?.documentElement?.scrollTo({ top: 0, behavior: \"smooth\" });\n return;\n }\n el?.scrollIntoView({ behavior: \"smooth\", block: \"center\" });\n },\n replaceComponent: (componentId: string, newHtml: string) => {\n const ed = editorRef.current;\n if (!ed) return;\n function findById(parent: any): any {\n if (parent.getId() === componentId) return parent;\n for (const child of parent.components().models || []) {\n const found = findById(child);\n if (found) return found;\n }\n return null;\n }\n const wrapper = ed.DomComponents.getWrapper();\n if (!wrapper) return;\n const comp = findById(wrapper);\n if (comp) {\n comp.replaceWith(newHtml);\n } else {\n console.warn(\"[replaceComponent] Component not found:\", componentId);\n }\n },\n setZoom: (value: number) => {\n editorRef.current?.Canvas.setZoom(value);\n },\n getZoom: () => {\n return editorRef.current?.Canvas.getZoom() ?? 100;\n },\n }));\n\n function getThemeCss() {\n try {\n const cc = customColorsRef.current;\n if (cc && Object.keys(cc).length) {\n if (!cc[\"on-primary\"] && cc.primary) {\n const full = buildCustomTheme(cc as any);\n const vars = Object.entries(full.colors)\n .map(([k, v]) => ` --color-${k}: ${v};`)\n .join(\"\\n\");\n return `:root {\\n${vars}\\n}`;\n }\n const vars = Object.entries(cc)\n .map(([k, v]) => ` --color-${k}: ${v};`)\n .join(\"\\n\");\n return `:root {\\n${vars}\\n}`;\n }\n return buildSingleThemeCss(themeRef.current).css || \"\";\n } catch {\n return \"\";\n }\n }\n\n function findSectionAncestor(comp: any): any {\n let current = comp;\n while (current) {\n if (current.get(\"tagName\") === \"section\") return current;\n current = current.parent();\n }\n return null;\n }\n\n useEffect(() => {\n if (!editorContainerRef.current || editorRef.current) return;\n let mounted = true;\n\n (async () => {\n const grapesjs = (await import(\"grapesjs\")).default;\n if (!mounted || !editorContainerRef.current) return;\n\n // Inject grapesjs base CSS\n if (!document.querySelector('link[href*=\"grapes.min.css\"]')) {\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = \"https://unpkg.com/grapesjs/dist/css/grapes.min.css\";\n document.head.appendChild(link);\n }\n\n const initialThemeCss = getThemeCss();\n const COLORS_MAP: Record<string, string> = {\n primary: \"--color-primary\", \"primary-light\": \"--color-primary-light\", \"primary-dark\": \"--color-primary-dark\",\n secondary: \"--color-secondary\", accent: \"--color-accent\",\n surface: \"--color-surface\", \"surface-alt\": \"--color-surface-alt\",\n \"on-primary\": \"--color-on-primary\", \"on-secondary\": \"--color-on-secondary\", \"on-accent\": \"--color-on-accent\",\n \"on-surface\": \"--color-on-surface\", \"on-surface-muted\": \"--color-on-surface-muted\",\n };\n const fallbackRules: string[] = [];\n for (const [name, cssVar] of Object.entries(COLORS_MAP)) {\n fallbackRules.push(`.bg-${name} { background-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.text-${name} { color: var(${cssVar}) !important }`);\n fallbackRules.push(`.border-${name} { border-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.from-${name} { --tw-gradient-from: var(${cssVar}) }`);\n fallbackRules.push(`.to-${name} { --tw-gradient-to: var(${cssVar}) }`);\n fallbackRules.push(`.hover\\\\:bg-${name}:hover { background-color: var(${cssVar}) !important }`);\n fallbackRules.push(`.hover\\\\:text-${name}:hover { color: var(${cssVar}) !important }`);\n }\n\n const editor = grapesjs.init({\n container: editorContainerRef.current,\n height: \"100%\",\n width: \"auto\",\n fromElement: false,\n storageManager: false,\n panels: { defaults: [] },\n canvas: {\n scripts: [\n `data:text/javascript,window.tailwind=${encodeURIComponent(JSON.stringify({config:{\n theme: { extend: { colors: {\n primary: \"var(--color-primary)\",\n \"primary-light\": \"var(--color-primary-light)\",\n \"primary-dark\": \"var(--color-primary-dark)\",\n secondary: \"var(--color-secondary)\",\n accent: \"var(--color-accent)\",\n surface: \"var(--color-surface)\",\n \"surface-alt\": \"var(--color-surface-alt)\",\n \"on-primary\": \"var(--color-on-primary)\",\n \"on-secondary\": \"var(--color-on-secondary)\",\n \"on-accent\": \"var(--color-on-accent)\",\n \"on-surface\": \"var(--color-on-surface)\",\n \"on-surface-muted\": \"var(--color-on-surface-muted)\",\n }}}}\n }))}`,\n \"https://cdn.tailwindcss.com\",\n ],\n styles: [\n `data:text/css,${encodeURIComponent(initialThemeCss + \"\\n\" + fallbackRules.join(\"\\n\") + (canvasStyles ? \"\\n\" + canvasStyles : \"\"))}`,\n ],\n },\n deviceManager: devices === false ? false as any : {\n devices: [\n { name: \"Desktop\", width: \"\" },\n { name: \"Tablet\", width: \"768px\" },\n { name: \"Mobile\", width: \"375px\" },\n ],\n },\n styleManager: false as any,\n layerManager: {\n appendTo: layersRef.current!,\n },\n blockManager: hiddenTabs.includes(\"blocks\") ? false as any : {\n appendTo: blocksRef.current!,\n blocks: (customBlocks || LANDING_BLOCKS).map((b) => ({\n id: b.id,\n label: b.label,\n category: b.category,\n content: b.content,\n media: b.media,\n })),\n },\n allowScripts: 1,\n } as any);\n\n // ─── AI Commands ────────────────────────────────\n editor.Commands.add(\"ai-open-menu\", {\n run(ed: Editor) {\n const selected = ed.getSelected();\n if (!selected) return;\n const section = findSectionAncestor(selected);\n const isSection = selected.get(\"tagName\") === \"section\";\n onAiActionRef.current?.({\n type: \"refine-element\",\n componentId: selected.getId(),\n html: selected.toHTML(),\n sectionHtml: section ? section.toHTML() : undefined,\n sectionComponentId: section ? section.getId() : undefined,\n isSection,\n } as any);\n },\n });\n\n // ─── Switch to Styles tab on selection ───\n editor.on(\"component:selected\", () => {\n setActivePanel(\"styles\");\n });\n editor.on(\"component:deselected\", () => {\n // Stay on current panel\n });\n\n // ─── Inject AI buttons into component toolbar on selection ───\n editor.on(\"component:selected\", (component: any) => {\n const toolbar = component.get(\"toolbar\") || [];\n const hasAi = toolbar.some((t: any) => t.id === \"ai-refine\");\n if (hasAi) return;\n\n const aiButtons: any[] = [\n {\n id: \"ai-menu\",\n label: `<svg title=\"AI\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"#9870ED\" style=\"vertical-align:middle;cursor:pointer\"><path d=\"M12 2l2.09 6.26L20.18 10l-6.09 1.74L12 18l-2.09-6.26L3.82 10l6.09-1.74z\"/><path d=\"M19 2l.75 2.25L22 5l-2.25.75L19 8l-.75-2.25L16 5l2.25-.75z\" opacity=\".7\"/><path d=\"M5 16l.5 1.5L7 18l-1.5.5L5 20l-.5-1.5L3 18l1.5-.5z\" opacity=\".5\"/></svg>`,\n command: \"ai-open-menu\",\n },\n ];\n\n component.set(\"toolbar\", [...toolbar, ...aiButtons]);\n });\n\n // ─── Theme + extras in iframe ────────────────────\n editor.on(\"canvas:frame:load\", ({ window: fw }: { window: Window }) => {\n const doc = fw.document;\n\n const style = doc.createElement(\"style\");\n style.id = \"easybits-theme\";\n style.textContent = getThemeCss();\n doc.head.appendChild(style);\n\n const shimmerStyle = doc.createElement(\"style\");\n shimmerStyle.textContent = `\n .easybits-refining { position: relative; overflow: hidden; }\n .easybits-refining::after {\n content: '';\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, transparent 0%, rgba(152,112,237,0.08) 50%, transparent 100%);\n animation: easybits-shimmer 1.5s infinite;\n pointer-events: none;\n z-index: 9999;\n }\n @keyframes easybits-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(100%); }\n }\n `;\n doc.head.appendChild(shimmerStyle);\n\n const swStyle = doc.createElement(\"style\");\n swStyle.textContent = `\n .gjs-dashed *[data-gjs-type] {\n outline: 1px dashed rgba(152,112,237,0.35) !important;\n outline-offset: -1px;\n }\n .gjs-dashed *[data-gjs-type]:hover {\n outline-color: rgba(152,112,237,0.7) !important;\n }\n `;\n doc.head.appendChild(swStyle);\n\n if (canvasStyles) {\n const extraStyle = doc.createElement(\"style\");\n extraStyle.id = \"easybits-canvas-styles\";\n extraStyle.textContent = canvasStyles;\n doc.head.appendChild(extraStyle);\n }\n\n doc.addEventListener(\"keydown\", (e: KeyboardEvent) => {\n if (e.key !== \" \") return;\n const el = e.target as HTMLElement;\n if (!el?.isContentEditable) return;\n const tag = el.tagName?.toLowerCase();\n if (tag === \"a\" || tag === \"button\" || el.closest(\"a\") || el.closest(\"button\")) {\n e.preventDefault();\n doc.execCommand(\"insertText\", false, \" \");\n }\n });\n\n if (!doc.getElementById(\"easybits-semantic-fallback\")) {\n const fallback = doc.createElement(\"style\");\n fallback.id = \"easybits-semantic-fallback\";\n const rules: string[] = [];\n for (const [name, cssVar] of Object.entries(COLORS_MAP)) {\n rules.push(`.bg-${name} { background-color: var(${cssVar}) !important }`);\n rules.push(`.text-${name} { color: var(${cssVar}) !important }`);\n rules.push(`.border-${name} { border-color: var(${cssVar}) !important }`);\n rules.push(`.from-${name} { --tw-gradient-from: var(${cssVar}) }`);\n rules.push(`.to-${name} { --tw-gradient-to: var(${cssVar}) }`);\n rules.push(`.hover\\\\:bg-${name}:hover { background-color: var(${cssVar}) !important }`);\n rules.push(`.hover\\\\:text-${name}:hover { color: var(${cssVar}) !important }`);\n }\n fallback.textContent = rules.join(\"\\n\");\n doc.head.appendChild(fallback);\n }\n\n const applyTwConfig = () => {\n if ((fw as any).tailwind) {\n (fw as any).tailwind.config = {\n theme: { extend: { colors: Object.fromEntries(\n Object.keys(COLORS_MAP).map(name => [name, `var(${COLORS_MAP[name]})`])\n )}}\n };\n }\n };\n applyTwConfig();\n const twScript = doc.querySelector('script[src*=\"tailwindcss\"]');\n if (twScript) {\n twScript.addEventListener(\"load\", () => {\n applyTwConfig();\n doc.body.style.display = \"none\";\n doc.body.offsetHeight;\n doc.body.style.display = \"\";\n });\n }\n\n // Scroll-spy\n {\n let scrollRaf = 0;\n const onScroll = () => {\n cancelAnimationFrame(scrollRaf);\n scrollRaf = requestAnimationFrame(() => {\n if (!onVisibleSectionChangeRef.current) return;\n const sectionEls = doc.querySelectorAll(\"[data-section-id]\");\n if (!sectionEls.length) return;\n const viewH = fw.innerHeight;\n let bestId = \"\";\n let bestVisible = 0;\n sectionEls.forEach((el) => {\n const rect = el.getBoundingClientRect();\n const top = Math.max(0, rect.top);\n const bottom = Math.min(viewH, rect.bottom);\n const visible = Math.max(0, bottom - top);\n if (visible > bestVisible) {\n bestVisible = visible;\n bestId = el.getAttribute(\"data-section-id\") || \"\";\n }\n });\n if (bestId) onVisibleSectionChangeRef.current(bestId);\n });\n };\n fw.addEventListener(\"scroll\", onScroll, { passive: true });\n }\n });\n\n if (initialHtml) editor.setComponents(initialHtml);\n\n // ─── Name layers based on content ───\n function nameLayers() {\n const wrapper = editor.DomComponents.getWrapper();\n if (!wrapper) return;\n wrapper.components().forEach((comp: any, i: number) => {\n if (comp.get(\"custom-name\")) return;\n const tag = (comp.get(\"tagName\") || \"\").toLowerCase();\n if (tag !== \"section\") return;\n const html = comp.toHTML().toLowerCase();\n let name = `Section ${i + 1}`;\n if (html.includes(\"hero\") || (i === 0 && html.includes(\"<h1\"))) name = \"Hero\";\n else if (html.includes(\"pricing\") || html.includes(\"precio\") || html.includes(\"inversión\")) name = \"Pricing\";\n else if (html.includes(\"testimonial\") || html.includes(\"dicen\") || html.includes(\"quote\")) name = \"Testimonials\";\n else if (html.includes(\"faq\") || html.includes(\"pregunt\") || html.includes(\"<details\")) name = \"FAQ\";\n else if (html.includes(\"footer\") || html.includes(\"©\") || html.includes(\"derechos\")) name = \"Footer\";\n else if (html.includes(\"feature\") || html.includes(\"palanca\") || html.includes(\"servicio\")) name = \"Features\";\n else if (html.includes(\"stat\") || html.includes(\"número\") || html.includes(\"+%\")) name = \"Stats\";\n else if (html.includes(\"team\") || html.includes(\"equipo\")) name = \"Team\";\n else if (html.includes(\"cta\") || html.includes(\"listo\") || html.includes(\"empez\")) name = \"CTA\";\n else if (html.includes(\"newsletter\") || html.includes(\"suscri\") || html.includes(\"email\")) name = \"Newsletter\";\n else if (html.includes(\"proceso\") || html.includes(\"step\") || html.includes(\"cómo func\")) name = \"Process\";\n else if (html.includes(\"problema\") || html.includes(\"pain\")) name = \"Problem\";\n else if (html.includes(\"logo\") || html.includes(\"trusted\") || html.includes(\"brand\")) name = \"Logo Cloud\";\n comp.set(\"custom-name\", name);\n });\n }\n editor.on(\"load\", nameLayers);\n editor.on(\"component:add\", () => setTimeout(nameLayers, 200));\n\n let userHasInteracted = false;\n const interactionEvents = [\n \"canvas:drop\", \"block:drag:stop\", \"component:drag:end\",\n \"component:input\", \"undo\", \"redo\",\n ];\n const markInteracted = () => { userHasInteracted = true; };\n interactionEvents.forEach((evt) => editor.on(evt, markInteracted));\n editor.on(\"sidebar:change\", markInteracted);\n\n const notify = () => {\n if (!userHasInteracted) return;\n const html = editor.getHtml();\n if (!html || !html.trim()) return;\n const css = editor.getCss();\n const fullHtml = css ? `<style>${css}</style>\\n${html}` : html;\n onChangeRef.current?.(fullHtml);\n };\n\n [\n \"component:update\", \"component:add\", \"component:remove\",\n \"component:drag:end\", \"component:input\", \"canvas:drop\",\n \"block:drag:stop\", \"undo\", \"redo\",\n ].forEach((evt) => editor.on(evt, notify));\n\n // Collapse all block categories except CTA\n try {\n const bm = editor.BlockManager;\n const cats = bm.getCategories?.();\n if (cats && cats.forEach) {\n cats.forEach((cat: any) => {\n try {\n const name = (typeof cat.get === \"function\" ? cat.get(\"id\") || cat.get(\"label\") : cat.id || cat.label) || \"\";\n if (name !== \"CTA\") {\n if (typeof cat.set === \"function\") cat.set(\"open\", false);\n }\n } catch { /* skip */ }\n });\n }\n } catch { /* skip */ }\n\n editorRef.current = editor;\n editor.on(\"load\", () => {\n setReady(true);\n let attempts = 0;\n const interval = setInterval(() => {\n attempts++;\n try {\n const active = editor.Commands?.getActive();\n if (!active) { clearInterval(interval); return; }\n for (const cmd of Object.keys(active)) {\n if (cmd === \"show-offset\") {\n editor.stopCommand(cmd);\n }\n }\n } catch {}\n if (attempts >= 30) clearInterval(interval);\n }, 100);\n if (editor.Commands.isActive(\"sw-visibility\")) {\n editor.Commands.stop(\"sw-visibility\");\n }\n });\n })().catch((err) => {\n console.error(\"GrapesJS init failed:\", err);\n });\n\n return () => {\n mounted = false;\n editorRef.current?.destroy();\n editorRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Update theme CSS dynamically\n useEffect(() => {\n const ed = editorRef.current;\n if (!ed) return;\n const doc = ed.Canvas.getDocument();\n if (!doc) return;\n\n const old = doc.getElementById(\"easybits-theme\");\n if (old) old.remove();\n const style = doc.createElement(\"style\");\n style.id = \"easybits-theme\";\n style.textContent = getThemeCss();\n doc.head.appendChild(style);\n\n const oldFallback = doc.getElementById(\"easybits-semantic-fallback\");\n if (oldFallback) {\n const content = oldFallback.textContent;\n oldFallback.remove();\n const fb = doc.createElement(\"style\");\n fb.id = \"easybits-semantic-fallback\";\n fb.textContent = content;\n doc.head.appendChild(fb);\n }\n\n setTimeout(() => setThemeVersion((v) => v + 1), 100);\n }, [theme, customColors]);\n\n const sidebarBorder = panelSide === \"right\" ? \"border-l\" : \"border-r\";\n\n const sidebar = (\n <div className={`w-80 shrink-0 flex flex-col bg-black ${sidebarBorder} border-gray-700 overflow-hidden`}>\n <div className=\"flex border-b border-gray-700\">\n {visibleTabs.map((tab) => (\n <button\n key={tab.id}\n onClick={() => setActivePanel(tab.id)}\n className={`flex-1 py-2.5 text-xs font-bold transition-colors ${\n activePanel === tab.id\n ? \"bg-gray-800 text-white border-b-2 border-brand-500\"\n : \"text-gray-400 hover:text-gray-200 hover:bg-gray-800/50\"\n }`}\n title={tab.label}\n >\n <span className=\"block text-base mb-0.5\">{tab.icon}</span>\n {tab.label}\n </button>\n ))}\n </div>\n\n {!hiddenTabs.includes(\"blocks\") && <div\n ref={blocksRef}\n className={`flex-1 overflow-auto p-2 ${activePanel === \"blocks\" ? \"\" : \"hidden\"}`}\n />}\n <div\n ref={layersRef}\n className={`flex-1 overflow-auto ${activePanel === \"layers\" ? \"\" : \"hidden\"}`}\n />\n <div className={`flex-1 overflow-auto ${activePanel === \"styles\" ? \"\" : \"hidden\"}`}>\n {ready && <ImageSrcEditor editor={editorRef.current} />}\n {ready && <TailwindClassEditor\n editor={editorRef.current}\n themeVersion={themeVersion}\n themeColors={(() => {\n if (customColors && Object.keys(customColors).length) return customColors;\n const t = LANDING_THEMES.find((t) => t.id === theme);\n return t?.colors || {};\n })()}\n />}\n </div>\n <div className={`flex-1 overflow-auto p-3 ${activePanel === \"themes\" ? \"\" : \"hidden\"}`}>\n <p className=\"text-xs text-gray-400 font-bold uppercase tracking-wider mb-3\">Temas</p>\n <div className=\"grid grid-cols-2 gap-2\">\n {LANDING_THEMES.map((t) => {\n const isActive = theme === t.id;\n const displayColors = isActive && customColors && Object.keys(customColors).length\n ? { ...t.colors, ...customColors }\n : t.colors;\n return (\n <button\n key={t.id}\n onClick={() => {\n onThemeChangeRef.current?.(t.id);\n setActiveBrandKitId(null);\n onBrandKitChangeRef.current?.(null);\n }}\n className={`flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${\n isActive\n ? \"border-brand-500 bg-brand-500/10\"\n : \"border-gray-700 hover:border-gray-500\"\n }`}\n >\n <div className=\"flex gap-1\">\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.primary }} title=\"Primary\" />\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.surface }} title=\"Surface\" />\n <div className=\"w-5 h-5 rounded-full border border-gray-600\" style={{ background: displayColors.accent }} title=\"Accent\" />\n </div>\n <span className=\"text-[10px] font-bold text-gray-300\">{t.label}</span>\n </button>\n );\n })}\n </div>\n\n {(() => {\n const active = LANDING_THEMES.find((t) => t.id === theme);\n const baseColors: Record<string, string> = active?.colors ? { ...active.colors } : {};\n const currentColors: Record<string, string> = customColors && Object.keys(customColors).length\n ? { ...baseColors, ...customColors }\n : baseColors;\n if (!Object.keys(currentColors).length) return null;\n const COLOR_LABELS: Record<string, string> = {\n primary: \"Primary\", \"primary-light\": \"Primary Light\", \"primary-dark\": \"Primary Dark\",\n secondary: \"Secondary\", accent: \"Accent\", surface: \"Surface\",\n \"surface-alt\": \"Surface Alt\", \"on-surface\": \"On Surface\",\n \"on-surface-muted\": \"On Surface Muted\", \"on-primary\": \"On Primary\",\n \"on-secondary\": \"On Secondary\", \"on-accent\": \"On Accent\",\n };\n return (\n <div className=\"mt-3 space-y-1\">\n {Object.entries(currentColors).map(([key, hex]) => (\n <label\n key={key}\n className=\"flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer\"\n >\n <input\n type=\"color\"\n value={hex}\n onChange={(e) => {\n const updated = { ...currentColors, [key]: e.target.value };\n onThemeChangeRef.current?.(themeRef.current, updated);\n }}\n className=\"w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded\"\n />\n <span className=\"text-[10px] text-gray-400 flex-1 truncate\">{COLOR_LABELS[key] || key}</span>\n <code className=\"text-[10px] text-gray-500 group-hover:text-gray-300 font-mono\">{hex}</code>\n </label>\n ))}\n </div>\n );\n })()}\n\n {brandKits && brandKits.length > 0 && (\n <>\n <p className=\"text-xs text-gray-400 font-bold uppercase tracking-wider mt-5 mb-3\">Brand Kits</p>\n <div className=\"grid grid-cols-2 gap-2\">\n {brandKits.map((bk) => {\n const bkBase = flattenColors(bk.colors as Record<string, any>) || {};\n const displayColors = activeBrandKitId === bk.id && customColors && Object.keys(customColors).length\n ? { ...bkBase, ...customColors }\n : bkBase;\n return (\n <button\n key={bk.id}\n onClick={() => {\n onThemeChangeRef.current?.(\"custom\", bkBase, bk.id);\n setActiveBrandKitId(bk.id);\n onBrandKitChangeRef.current?.(bk);\n }}\n className={`flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all ${\n activeBrandKitId === bk.id\n ? \"border-brand-500 bg-brand-500/10\"\n : \"border-gray-700 hover:border-gray-500\"\n }`}\n >\n <div className=\"flex gap-1\">\n {[\"primary\", \"surface\", \"accent\"].map((key) => (\n <div\n key={key}\n className=\"w-5 h-5 rounded-full border border-gray-600\"\n style={{ background: displayColors[key] || \"#888\" }}\n />\n ))}\n </div>\n <span className=\"text-[10px] font-bold text-gray-300 truncate max-w-full\">{bk.name}</span>\n </button>\n );\n })}\n </div>\n {activeBrandKitId && (() => {\n const bk = brandKits?.find((b) => b.id === activeBrandKitId);\n if (!bk) return null;\n const baseColors = flattenColors(bk.colors as Record<string, any>) || {};\n const colors = customColors && Object.keys(customColors).length\n ? { ...baseColors, ...customColors }\n : baseColors;\n return (\n <div className=\"mt-3 space-y-1\">\n {Object.entries(colors).map(([key, hex]) => (\n <label\n key={key}\n className=\"flex items-center gap-2 w-full px-2 py-1 rounded-lg hover:bg-gray-800 transition-colors group text-left cursor-pointer\"\n >\n <input\n type=\"color\"\n value={hex}\n onChange={(e) => {\n const updated = { ...colors, [key]: e.target.value };\n onThemeChangeRef.current?.(\"custom\", updated, activeBrandKitId || undefined);\n }}\n className=\"w-4 h-4 rounded border border-gray-600 shrink-0 cursor-pointer p-0 bg-transparent [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:border-none [&::-webkit-color-swatch]:rounded\"\n />\n <span className=\"text-[10px] text-gray-400 flex-1 truncate\">{key}</span>\n <code className=\"text-[10px] text-gray-500 group-hover:text-gray-300 font-mono\">{hex}</code>\n </label>\n ))}\n </div>\n );\n })()}\n </>\n )}\n </div>\n </div>\n );\n\n const canvas = <div ref={editorContainerRef} className=\"flex-1 h-full bg-black\" />;\n\n return (\n <div className=\"flex h-full w-full relative\">\n {panelSide === \"right\" ? <>{canvas}{sidebar}</> : <>{sidebar}{canvas}</>}\n\n {/* Glass overlay while GrapesJS loads */}\n <div\n className={`absolute inset-0 z-50 pointer-events-none bg-gray-950/40 backdrop-blur-[2px] transition-all duration-500 ${\n ready ? \"opacity-0 invisible\" : \"opacity-100\"\n }`}\n />\n </div>\n );\n }\n);\n\nGrapesEditor.displayName = \"GrapesEditor\";\nexport default GrapesEditor;\n","/**\n * Predefined blocks for GrapesJS editor.\n * All section blocks use semantic colors (bg-primary, text-on-surface, etc.)\n */\nexport const LANDING_BLOCKS = [\n // ─── Basic Elements ───────────────────────────────────\n {\n id: \"text-block\",\n label: \"Text\",\n category: \"Basic\",\n content: `<p class=\"text-base text-on-surface\">Edit this text. Double click to start typing.</p>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M4 7V4h16v3\"/><path d=\"M9 20h6\"/><path d=\"M12 4v16\"/></svg>`,\n },\n {\n id: \"heading-block\",\n label: \"Heading\",\n category: \"Basic\",\n content: `<h2 class=\"text-4xl font-black text-on-surface\">Your Heading Here</h2>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M4 12h16\"/><path d=\"M4 4v16\"/><path d=\"M20 4v16\"/></svg>`,\n },\n {\n id: \"image-block\",\n label: \"Image\",\n category: \"Basic\",\n content: { type: \"image\" },\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><path d=\"m21 15-5-5L5 21\"/></svg>`,\n },\n {\n id: \"button-block\",\n label: \"Button\",\n category: \"Basic\",\n content: `<a href=\"#\" class=\"inline-block px-8 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Click Me</a>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"8\" width=\"18\" height=\"8\" rx=\"4\"/><path d=\"M8 12h8\"/></svg>`,\n },\n {\n id: \"link-block\",\n label: \"Link\",\n category: \"Basic\",\n content: `<a href=\"#\" class=\"text-primary font-bold underline hover:text-primary-dark transition\">Your Link</a>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>`,\n },\n {\n id: \"video-block\",\n label: \"Video\",\n category: \"Basic\",\n content: { type: \"video\" },\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polygon points=\"5 3 19 12 5 21 5 3\"/></svg>`,\n },\n {\n id: \"divider-block\",\n label: \"Divider\",\n category: \"Basic\",\n content: `<hr class=\"border-t-2 border-gray-200 my-8\" />`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M3 12h18\"/></svg>`,\n },\n {\n id: \"spacer-block\",\n label: \"Spacer\",\n category: \"Basic\",\n content: `<div class=\"h-16\"></div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M12 5v14\"/><path d=\"M5 5h14\"/><path d=\"M5 19h14\"/></svg>`,\n },\n // ─── Layout ───────────────────────────────────────────\n {\n id: \"container-block\",\n label: \"Container\",\n category: \"Layout\",\n content: `<div class=\"max-w-6xl mx-auto px-6 py-12\"></div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/></svg>`,\n },\n {\n id: \"two-columns\",\n label: \"2 Columns\",\n category: \"Layout\",\n content: `<div class=\"grid grid-cols-2 gap-8 px-6 py-12 max-w-6xl mx-auto\">\n <div class=\"bg-surface-alt rounded-xl p-8 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-8 min-h-[120px]\"></div>\n</div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"2\" y=\"3\" width=\"9\" height=\"18\" rx=\"1\"/><rect x=\"13\" y=\"3\" width=\"9\" height=\"18\" rx=\"1\"/></svg>`,\n },\n {\n id: \"three-columns\",\n label: \"3 Columns\",\n category: \"Layout\",\n content: `<div class=\"grid grid-cols-3 gap-6 px-6 py-12 max-w-6xl mx-auto\">\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n <div class=\"bg-surface-alt rounded-xl p-6 min-h-[120px]\"></div>\n</div>`,\n media: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"1\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/><rect x=\"9\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/><rect x=\"17\" y=\"3\" width=\"6\" height=\"18\" rx=\"1\"/></svg>`,\n },\n // ─── Heroes ───────────────────────────────────────────\n {\n id: \"hero-centered\",\n label: \"Hero Centered\",\n category: \"Heroes\",\n content: `<section class=\"bg-primary py-24 px-6 text-center\">\n <div class=\"max-w-4xl mx-auto\">\n <h1 class=\"text-5xl md:text-7xl font-black text-on-primary mb-6\">Your Amazing Headline</h1>\n <p class=\"text-xl text-on-primary/80 mb-10 max-w-2xl mx-auto\">A compelling subtitle that explains your value proposition in one or two sentences.</p>\n <div class=\"flex gap-4 justify-center flex-wrap\">\n <a href=\"#\" class=\"px-8 py-4 bg-accent text-on-accent font-bold rounded-xl hover:opacity-90 transition\">Get Started</a>\n <a href=\"#\" class=\"px-8 py-4 border-2 border-on-primary text-on-primary font-bold rounded-xl hover:bg-on-primary/10 transition\">Learn More</a>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"6\" y=\"2\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"8\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"9\" y=\"8\" width=\"3\" height=\"1.5\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"13\" y=\"8\" width=\"3\" height=\"1.5\" rx=\".5\" fill=\"#d1d5db\"/></svg>`,\n },\n {\n id: \"hero-split\",\n label: \"Hero Split\",\n category: \"Heroes\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto grid md:grid-cols-2 gap-12 items-center\">\n <div>\n <h1 class=\"text-5xl font-black text-on-surface mb-6\">Build Something Amazing</h1>\n <p class=\"text-lg text-on-surface/70 mb-8\">Describe your product or service. Focus on the benefits and what makes you different.</p>\n <a href=\"#\" class=\"inline-block px-8 py-4 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Start Now</a>\n </div>\n <img src=\"https://placehold.co/600x400/e2e8f0/64748b?text=Your+Image\" alt=\"Hero image\" class=\"rounded-2xl w-full\" />\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"2\" width=\"10\" height=\"2\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"1\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"1\" y=\"8\" width=\"4\" height=\"1.5\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"13\" y=\"1\" width=\"10\" height=\"10\" rx=\"1\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"hero-image-bg\",\n label: \"Hero Image BG\",\n category: \"Heroes\",\n content: `<section class=\"relative bg-primary-dark py-32 px-6 text-center overflow-hidden\">\n <img src=\"https://placehold.co/1920x800/1f2937/374151?text=Background\" alt=\"\" class=\"absolute inset-0 w-full h-full object-cover opacity-40\" />\n <div class=\"relative max-w-4xl mx-auto\">\n <h1 class=\"text-5xl md:text-7xl font-black text-on-primary mb-6\">Bold Statement Here</h1>\n <p class=\"text-xl text-on-primary/80 mb-10 max-w-2xl mx-auto\">A powerful subtitle on top of a beautiful background image.</p>\n <a href=\"#\" class=\"inline-block px-10 py-4 bg-accent text-on-accent font-bold rounded-xl text-lg hover:opacity-90 transition\">Get Started</a>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#374151\"/><rect x=\"6\" y=\"2\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"5\" width=\"8\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"9\" y=\"8\" width=\"6\" height=\"1.5\" rx=\".5\" fill=\"#fff\"/></svg>`,\n },\n // ─── Features ─────────────────────────────────────────\n {\n id: \"features-grid\",\n label: \"Features Grid\",\n category: \"Features\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-4\">Features</h2>\n <p class=\"text-center text-on-surface/60 mb-12 max-w-2xl mx-auto\">Everything you need to succeed.</p>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-primary rounded-xl flex items-center justify-center text-on-primary text-xl mb-4\">⚡</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Lightning Fast</h3>\n <p class=\"text-on-surface/60\">Built for speed from the ground up.</p>\n </div>\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-secondary rounded-xl flex items-center justify-center text-on-secondary text-xl mb-4\">🔒</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Secure</h3>\n <p class=\"text-on-surface/60\">Enterprise-grade security by default.</p>\n </div>\n <div class=\"bg-primary/5 rounded-2xl p-8\">\n <div class=\"w-12 h-12 bg-accent rounded-xl flex items-center justify-center text-on-accent text-xl mb-4\">🎨</div>\n <h3 class=\"text-xl font-black text-on-surface mb-2\">Beautiful</h3>\n <p class=\"text-on-surface/60\">Pixel-perfect designs that stand out.</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"features-bento\",\n label: \"Bento Grid\",\n category: \"Features\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Why Choose Us</h2>\n <div class=\"grid md:grid-cols-3 gap-4\">\n <div class=\"md:col-span-2 bg-primary rounded-2xl p-10 text-on-primary\">\n <h3 class=\"text-2xl font-black mb-3\">All-in-one Platform</h3>\n <p class=\"text-on-primary/80\">Everything you need under one roof. No more juggling between tools.</p>\n </div>\n <div class=\"bg-secondary rounded-2xl p-10 text-on-secondary\">\n <h3 class=\"text-2xl font-black mb-3\">Fast Setup</h3>\n <p class=\"text-on-secondary/80\">Get started in under 5 minutes.</p>\n </div>\n <div class=\"bg-accent rounded-2xl p-10 text-on-accent\">\n <h3 class=\"text-2xl font-black mb-3\">24/7 Support</h3>\n <p class=\"text-on-accent/80\">Always here when you need us.</p>\n </div>\n <div class=\"md:col-span-2 bg-on-surface/5 rounded-2xl p-10\">\n <h3 class=\"text-2xl font-black text-on-surface mb-3\">Analytics Dashboard</h3>\n <p class=\"text-on-surface/60\">Track everything that matters with beautiful real-time charts.</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"14\" height=\"4\" rx=\".5\" fill=\"#6366f1\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#10b981\"/><rect x=\"1\" y=\"7\" width=\"6\" height=\"4\" rx=\".5\" fill=\"#f59e0b\"/><rect x=\"9\" y=\"7\" width=\"14\" height=\"4\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── Testimonials ─────────────────────────────────────\n {\n id: \"testimonials-cards\",\n label: \"Testimonials\",\n category: \"Social Proof\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-6xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">What People Say</h2>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"This product changed how we work. Absolutely incredible results in just weeks.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-primary rounded-full flex items-center justify-center text-on-primary font-bold\">A</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Alex Johnson</p><p class=\"text-xs text-on-surface/50\">CEO, TechCo</p></div>\n </div>\n </div>\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"The best tool I've used in my career. Support team is amazing.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-secondary rounded-full flex items-center justify-center text-on-secondary font-bold\">M</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Maria Garcia</p><p class=\"text-xs text-on-surface/50\">Designer, StudioX</p></div>\n </div>\n </div>\n <div class=\"bg-on-surface/5 rounded-2xl p-8\">\n <p class=\"text-on-surface/80 mb-6\">\"10x improvement in productivity. I recommend it to everyone.\"</p>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 bg-accent rounded-full flex items-center justify-center text-on-accent font-bold\">S</div>\n <div><p class=\"font-bold text-on-surface text-sm\">Sam Lee</p><p class=\"text-xs text-on-surface/50\">CTO, BuildIt</p></div>\n </div>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n {\n id: \"logo-cloud\",\n label: \"Logo Cloud\",\n category: \"Social Proof\",\n content: `<section class=\"bg-surface py-16 px-6\">\n <div class=\"max-w-4xl mx-auto text-center\">\n <p class=\"text-sm font-bold text-on-surface/40 uppercase tracking-wider mb-8\">Trusted by industry leaders</p>\n <div class=\"flex flex-wrap justify-center items-center gap-12 opacity-50\">\n <span class=\"text-2xl font-black text-on-surface\">Brand</span>\n <span class=\"text-2xl font-black text-on-surface\">Company</span>\n <span class=\"text-2xl font-black text-on-surface\">Startup</span>\n <span class=\"text-2xl font-black text-on-surface\">Agency</span>\n <span class=\"text-2xl font-black text-on-surface\">Studio</span>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"2\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"8\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"14\" y=\"5\" width=\"4\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/><rect x=\"20\" y=\"5\" width=\"3\" height=\"2\" rx=\".5\" fill=\"#d1d5db\"/></svg>`,\n },\n // ─── Pricing ──────────────────────────────────────────\n {\n id: \"pricing-cards\",\n label: \"Pricing Cards\",\n category: \"Pricing\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-5xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-4\">Pricing</h2>\n <p class=\"text-center text-on-surface/60 mb-12\">Simple, transparent pricing.</p>\n <div class=\"grid md:grid-cols-3 gap-8\">\n <div class=\"border-2 border-on-surface/10 rounded-2xl p-8 bg-surface\">\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Basic</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$9<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ 5 Projects</li><li>✓ Basic Support</li><li>✓ 1 GB Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 border-2 border-primary text-primary font-bold rounded-xl hover:bg-primary/5 transition\">Choose Plan</a>\n </div>\n <div class=\"border-2 border-primary rounded-2xl p-8 bg-primary/5 relative\">\n <span class=\"absolute -top-3 left-1/2 -translate-x-1/2 bg-primary text-on-primary text-xs font-bold px-3 py-1 rounded-full\">Popular</span>\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Pro</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$29<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ Unlimited Projects</li><li>✓ Priority Support</li><li>✓ 50 GB Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Choose Plan</a>\n </div>\n <div class=\"border-2 border-on-surface/10 rounded-2xl p-8 bg-surface\">\n <h3 class=\"text-lg font-bold text-on-surface mb-2\">Enterprise</h3>\n <div class=\"text-4xl font-black text-on-surface mb-6\">$99<span class=\"text-lg font-normal text-on-surface/50\">/mo</span></div>\n <ul class=\"space-y-3 text-on-surface/70 mb-8\"><li>✓ Everything in Pro</li><li>✓ Dedicated Support</li><li>✓ Unlimited Storage</li></ul>\n <a href=\"#\" class=\"block text-center px-6 py-3 border-2 border-primary text-primary font-bold rounded-xl hover:bg-primary/5 transition\">Contact Sales</a>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"1\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"9\" y=\"0\" width=\"6\" height=\"11\" rx=\".5\" fill=\"#ddd6fe\"/><rect x=\"17\" y=\"1\" width=\"6\" height=\"10\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── FAQ ──────────────────────────────────────────────\n {\n id: \"faq-section\",\n label: \"FAQ\",\n category: \"Content\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-3xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Frequently Asked Questions</h2>\n <div class=\"space-y-6\">\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\" open>\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n What is included in the free plan?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">The free plan includes up to 3 projects, basic analytics, and community support.</p>\n </details>\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\">\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n Can I upgrade at any time?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">Yes! You can upgrade or downgrade your plan at any time. Changes take effect immediately.</p>\n </details>\n <details class=\"bg-on-surface/5 rounded-xl p-6 group\">\n <summary class=\"font-bold text-on-surface cursor-pointer list-none flex justify-between items-center\">\n Do you offer refunds?\n <span class=\"text-on-surface/40 group-open:rotate-180 transition-transform\">▼</span>\n </summary>\n <p class=\"text-on-surface/60 mt-4\">We offer a 30-day money-back guarantee. No questions asked.</p>\n </details>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"3\" y=\"1\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"3\" y=\"5\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"3\" y=\"9\" width=\"18\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/></svg>`,\n },\n // ─── Stats ────────────────────────────────────────────\n {\n id: \"stats-section\",\n label: \"Stats\",\n category: \"Content\",\n content: `<section class=\"bg-primary py-16 px-6\">\n <div class=\"max-w-5xl mx-auto grid grid-cols-2 md:grid-cols-4 gap-8 text-center\">\n <div><div class=\"text-4xl font-black text-on-primary\">10K+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Customers</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">99.9%</div><p class=\"text-on-primary/70 mt-1 text-sm\">Uptime</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">50M+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Requests/day</p></div>\n <div><div class=\"text-4xl font-black text-on-primary\">150+</div><p class=\"text-on-primary/70 mt-1 text-sm\">Countries</p></div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#6366f1\"/><rect x=\"2\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"14\" y=\"3\" width=\"4\" height=\"3\" rx=\".5\" fill=\"#fff\"/><rect x=\"20\" y=\"3\" width=\"3\" height=\"3\" rx=\".5\" fill=\"#fff\"/></svg>`,\n },\n // ─── Team ─────────────────────────────────────────────\n {\n id: \"team-section\",\n label: \"Team\",\n category: \"Content\",\n content: `<section class=\"bg-surface py-20 px-6\">\n <div class=\"max-w-5xl mx-auto\">\n <h2 class=\"text-4xl font-black text-on-surface text-center mb-12\">Our Team</h2>\n <div class=\"grid md:grid-cols-4 gap-8 text-center\">\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Jane Smith</h3>\n <p class=\"text-sm text-on-surface/50\">CEO</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">John Doe</h3>\n <p class=\"text-sm text-on-surface/50\">CTO</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Lisa Park</h3>\n <p class=\"text-sm text-on-surface/50\">Designer</p>\n </div>\n <div>\n <img src=\"https://placehold.co/200x200/e2e8f0/64748b?text=Photo\" alt=\"Team member\" class=\"w-24 h-24 rounded-full mx-auto mb-4 object-cover\" />\n <h3 class=\"font-bold text-on-surface\">Mike Chen</h3>\n <p class=\"text-sm text-on-surface/50\">Engineer</p>\n </div>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><circle cx=\"4\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"10\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"16\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/><circle cx=\"22\" cy=\"5\" r=\"2\" fill=\"#d1d5db\"/></svg>`,\n },\n // ─── CTA ──────────────────────────────────────────────\n {\n id: \"cta-section\",\n label: \"Call to Action\",\n category: \"CTA\",\n content: `<section class=\"bg-primary py-20 px-6\">\n <div class=\"max-w-3xl mx-auto text-center\">\n <h2 class=\"text-4xl font-black text-on-primary mb-4\">Ready to get started?</h2>\n <p class=\"text-lg text-on-primary/80 mb-8\">Join thousands of happy customers and start building today.</p>\n <a href=\"#\" class=\"inline-block px-10 py-4 bg-accent text-on-accent font-bold rounded-xl text-lg hover:opacity-90 transition\">Start Free Trial</a>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#6366f1\"/><rect x=\"6\" y=\"3\" width=\"12\" height=\"2\" rx=\".5\" fill=\"#fff\"/><rect x=\"8\" y=\"7\" width=\"8\" height=\"2\" rx=\".5\" fill=\"#f59e0b\"/></svg>`,\n },\n {\n id: \"newsletter-section\",\n label: \"Newsletter\",\n category: \"CTA\",\n content: `<section class=\"bg-on-surface/5 py-20 px-6\">\n <div class=\"max-w-xl mx-auto text-center\">\n <h2 class=\"text-3xl font-black text-on-surface mb-4\">Stay Updated</h2>\n <p class=\"text-on-surface/60 mb-8\">Get the latest news and updates straight to your inbox.</p>\n <form class=\"flex gap-3 max-w-md mx-auto\">\n <input type=\"email\" placeholder=\"your@email.com\" class=\"flex-1 px-4 py-3 rounded-xl border-2 border-on-surface/20 bg-surface focus:border-primary focus:outline-none\" />\n <button class=\"px-6 py-3 bg-primary text-on-primary font-bold rounded-xl hover:opacity-90 transition\">Subscribe</button>\n </form>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#f3f4f6\"/><rect x=\"5\" y=\"6\" width=\"10\" height=\"2.5\" rx=\".5\" fill=\"#e5e7eb\"/><rect x=\"16\" y=\"6\" width=\"4\" height=\"2.5\" rx=\".5\" fill=\"#6366f1\"/></svg>`,\n },\n // ─── Footer ───────────────────────────────────────────\n {\n id: \"footer\",\n label: \"Footer\",\n category: \"Footer\",\n content: `<section class=\"bg-on-surface py-12 px-6\">\n <div class=\"max-w-6xl mx-auto flex flex-col md:flex-row justify-between items-center gap-6\">\n <div class=\"text-surface font-black text-xl\">YourBrand</div>\n <nav class=\"flex gap-6 text-surface/70 text-sm\">\n <a href=\"#\" class=\"hover:text-surface transition\">About</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Features</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Pricing</a>\n <a href=\"#\" class=\"hover:text-surface transition\">Contact</a>\n </nav>\n <p class=\"text-surface/50 text-xs\">© 2026 YourBrand. All rights reserved.</p>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#1f2937\"/><rect x=\"1\" y=\"5\" width=\"6\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"10\" y=\"5\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"16\" y=\"5\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#6b7280\"/></svg>`,\n },\n {\n id: \"footer-columns\",\n label: \"Footer Columns\",\n category: \"Footer\",\n content: `<section class=\"bg-on-surface py-16 px-6\">\n <div class=\"max-w-6xl mx-auto grid md:grid-cols-4 gap-8\">\n <div>\n <h4 class=\"text-surface font-black text-lg mb-4\">YourBrand</h4>\n <p class=\"text-surface/50 text-sm\">Building the future, one pixel at a time.</p>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Product</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">Features</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Pricing</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Changelog</a></li></ul>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Company</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">About</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Blog</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Careers</a></li></ul>\n </div>\n <div>\n <h4 class=\"text-surface font-bold text-sm mb-4\">Legal</h4>\n <ul class=\"space-y-2 text-surface/60 text-sm\"><li><a href=\"#\" class=\"hover:text-surface transition\">Privacy</a></li><li><a href=\"#\" class=\"hover:text-surface transition\">Terms</a></li></ul>\n </div>\n </div>\n</section>`,\n media: `<svg viewBox=\"0 0 24 12\" fill=\"none\"><rect width=\"24\" height=\"12\" rx=\"1\" fill=\"#1f2937\"/><rect x=\"1\" y=\"2\" width=\"5\" height=\"1\" rx=\".25\" fill=\"#fff\"/><rect x=\"8\" y=\"2\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"8\" y=\"4\" width=\"3\" height=\".5\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"8\" y=\"5.5\" width=\"3\" height=\".5\" rx=\".25\" fill=\"#6b7280\"/><rect x=\"14\" y=\"2\" width=\"4\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/><rect x=\"20\" y=\"2\" width=\"3\" height=\"1\" rx=\".25\" fill=\"#9ca3af\"/></svg>`,\n },\n];\n","import { useEffect, useState, useRef, useCallback } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type { Editor } from \"grapesjs\";\n\ninterface Props {\n editor: Editor | null;\n /** Bumped when theme/customColors change — forces color preview re-resolve */\n themeVersion?: number;\n /** Resolved theme colors keyed by semantic name (e.g. \"primary\" → \"#6366f1\") */\n themeColors?: Record<string, string>;\n}\n\ninterface ClassCategory {\n label: string;\n classes: string[];\n}\n\nconst CATEGORIES: { id: string; label: string; test: (c: string) => boolean }[] = [\n { id: \"layout\", label: \"Layout\", test: (c) => /^(flex|grid|block|inline|hidden|col-|row-|justify-|items-|self-|overflow-|order-|relative|absolute|fixed|sticky|inset-|top-|right-|bottom-|left-|z-|container)/.test(c) },\n { id: \"spacing\", label: \"Spacing\", test: (c) => /^(p-|px-|py-|pt-|pr-|pb-|pl-|m-|mx-|my-|mt-|mr-|mb-|ml-|gap-|space-)/.test(c) },\n { id: \"sizing\", label: \"Sizing\", test: (c) => /^(w-|h-|min-w-|max-w-|min-h-|max-h-|size-)/.test(c) },\n { id: \"typography\", label: \"Typography\", test: (c) => /^(text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl|left|center|right|justify|wrap|nowrap|ellipsis|balance)|font-|leading-|tracking-|uppercase|lowercase|capitalize|italic|not-italic|truncate|line-clamp|whitespace-)/.test(c) },\n { id: \"colors\", label: \"Colors\", test: (c) => /^(bg-|text-(?!xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl|left|center|right|justify|wrap|nowrap|ellipsis|balance)|from-|to-|via-|decoration-)/.test(c) },\n { id: \"borders\", label: \"Borders\", test: (c) => /^(border|rounded|ring-|divide-|outline-)/.test(c) },\n { id: \"effects\", label: \"Effects\", test: (c) => /^(shadow|opacity-|blur-|transition|duration-|ease-|animate-|transform|scale-|rotate-|translate-|hover:|focus:|active:|group-)/.test(c) },\n];\n\nfunction categorize(classes: string[]): ClassCategory[] {\n const buckets: Record<string, string[]> = {};\n const other: string[] = [];\n\n for (const cls of classes) {\n let matched = false;\n for (const cat of CATEGORIES) {\n // Strip responsive prefix for matching\n const bare = cls.replace(/^(sm:|md:|lg:|xl:|2xl:)/, \"\");\n if (cat.test(bare)) {\n (buckets[cat.id] ??= []).push(cls);\n matched = true;\n break;\n }\n }\n if (!matched) other.push(cls);\n }\n\n const result: ClassCategory[] = [];\n for (const cat of CATEGORIES) {\n if (buckets[cat.id]?.length) {\n result.push({ label: cat.label, classes: buckets[cat.id] });\n }\n }\n if (other.length) result.push({ label: \"Other\", classes: other });\n return result;\n}\n\n// Semantic theme color hints — grouped by property\nconst THEME_HINTS: { label: string; prefix: string; colors: { cls: string; name: string }[] }[] = [\n {\n label: \"Texto\", prefix: \"text-\",\n colors: [\n { cls: \"text-on-primary\", name: \"on-primary\" }, { cls: \"text-on-secondary\", name: \"on-secondary\" },\n { cls: \"text-on-accent\", name: \"on-accent\" }, { cls: \"text-on-surface\", name: \"on-surface\" },\n { cls: \"text-on-surface-muted\", name: \"on-surface-muted\" },\n ],\n },\n {\n label: \"Fondo\", prefix: \"bg-\",\n colors: [\n { cls: \"bg-primary\", name: \"primary\" }, { cls: \"bg-primary-light\", name: \"primary-light\" },\n { cls: \"bg-primary-dark\", name: \"primary-dark\" }, { cls: \"bg-secondary\", name: \"secondary\" },\n { cls: \"bg-accent\", name: \"accent\" }, { cls: \"bg-surface\", name: \"surface\" },\n { cls: \"bg-surface-alt\", name: \"surface-alt\" },\n ],\n },\n {\n label: \"Borde\", prefix: \"border-\",\n colors: [\n { cls: \"border-primary\", name: \"primary\" }, { cls: \"border-secondary\", name: \"secondary\" },\n { cls: \"border-accent\", name: \"accent\" }, { cls: \"border-surface-alt\", name: \"surface-alt\" },\n ],\n },\n];\n\n// Curated autocomplete list\nconst COMMON_CLASSES = [\n // Layout\n \"flex\", \"flex-col\", \"flex-row\", \"flex-wrap\", \"grid\", \"grid-cols-2\", \"grid-cols-3\", \"grid-cols-4\",\n \"block\", \"inline-block\", \"hidden\", \"relative\", \"absolute\", \"fixed\", \"sticky\",\n \"justify-start\", \"justify-center\", \"justify-end\", \"justify-between\", \"justify-around\",\n \"items-start\", \"items-center\", \"items-end\", \"items-stretch\",\n \"overflow-hidden\", \"overflow-auto\", \"z-10\", \"z-20\", \"z-50\",\n // Spacing\n \"p-0\", \"p-1\", \"p-2\", \"p-3\", \"p-4\", \"p-6\", \"p-8\", \"p-10\", \"p-12\", \"p-16\", \"p-20\",\n \"px-2\", \"px-4\", \"px-6\", \"px-8\", \"px-10\", \"px-12\", \"px-16\",\n \"py-2\", \"py-4\", \"py-6\", \"py-8\", \"py-10\", \"py-12\", \"py-16\", \"py-20\", \"py-24\",\n \"m-0\", \"m-auto\", \"mx-auto\", \"my-2\", \"my-4\", \"my-6\", \"my-8\",\n \"mt-2\", \"mt-4\", \"mt-6\", \"mt-8\", \"mb-2\", \"mb-4\", \"mb-6\", \"mb-8\",\n \"gap-1\", \"gap-2\", \"gap-3\", \"gap-4\", \"gap-6\", \"gap-8\", \"gap-10\", \"gap-12\",\n \"space-x-2\", \"space-x-4\", \"space-y-2\", \"space-y-4\", \"space-y-6\",\n // Sizing\n \"w-full\", \"w-auto\", \"w-1/2\", \"w-1/3\", \"w-2/3\", \"w-1/4\", \"w-3/4\", \"w-screen\",\n \"w-8\", \"w-10\", \"w-12\", \"w-16\", \"w-20\", \"w-24\", \"w-32\", \"w-48\", \"w-64\",\n \"h-full\", \"h-auto\", \"h-screen\", \"h-8\", \"h-10\", \"h-12\", \"h-16\", \"h-20\", \"h-24\", \"h-32\", \"h-48\", \"h-64\",\n \"max-w-sm\", \"max-w-md\", \"max-w-lg\", \"max-w-xl\", \"max-w-2xl\", \"max-w-4xl\", \"max-w-6xl\", \"max-w-7xl\", \"max-w-full\",\n \"min-h-screen\", \"min-h-0\",\n // Typography\n \"text-xs\", \"text-sm\", \"text-base\", \"text-lg\", \"text-xl\", \"text-2xl\", \"text-3xl\", \"text-4xl\", \"text-5xl\", \"text-6xl\",\n \"font-thin\", \"font-light\", \"font-normal\", \"font-medium\", \"font-semibold\", \"font-bold\", \"font-extrabold\", \"font-black\",\n \"text-left\", \"text-center\", \"text-right\", \"leading-tight\", \"leading-normal\", \"leading-relaxed\",\n \"tracking-tight\", \"tracking-normal\", \"tracking-wide\", \"uppercase\", \"lowercase\", \"capitalize\", \"italic\", \"truncate\",\n // Colors (semantic)\n \"bg-primary\", \"bg-primary-light\", \"bg-primary-dark\", \"bg-secondary\", \"bg-accent\", \"bg-surface\", \"bg-surface-alt\",\n \"text-on-primary\", \"text-on-secondary\", \"text-on-accent\", \"text-on-surface\", \"text-on-surface-muted\",\n // Colors (common)\n \"bg-white\", \"bg-black\", \"bg-transparent\", \"bg-gray-50\", \"bg-gray-100\", \"bg-gray-200\", \"bg-gray-800\", \"bg-gray-900\",\n \"text-white\", \"text-black\", \"text-gray-300\", \"text-gray-400\", \"text-gray-500\", \"text-gray-600\", \"text-gray-700\", \"text-gray-900\",\n // Borders\n \"border\", \"border-0\", \"border-2\", \"border-4\", \"border-t\", \"border-b\",\n \"border-gray-200\", \"border-gray-300\", \"border-gray-700\",\n \"rounded\", \"rounded-md\", \"rounded-lg\", \"rounded-xl\", \"rounded-2xl\", \"rounded-3xl\", \"rounded-full\", \"rounded-none\",\n \"ring-1\", \"ring-2\", \"ring-4\",\n // Effects\n \"shadow-sm\", \"shadow\", \"shadow-md\", \"shadow-lg\", \"shadow-xl\", \"shadow-2xl\", \"shadow-none\",\n \"opacity-0\", \"opacity-50\", \"opacity-75\", \"opacity-100\",\n \"transition\", \"transition-all\", \"transition-colors\", \"duration-150\", \"duration-200\", \"duration-300\",\n \"hover:opacity-80\", \"hover:scale-105\", \"hover:shadow-lg\",\n \"animate-pulse\", \"animate-bounce\",\n // Misc\n \"cursor-pointer\", \"select-none\", \"object-cover\", \"object-contain\", \"aspect-square\", \"aspect-video\",\n];\n\nexport default function TailwindClassEditor({ editor, themeVersion = 0, themeColors = {} }: Props) {\n const [classes, setClasses] = useState<string[]>([]);\n const [search, setSearch] = useState(\"\");\n const [showSuggestions, setShowSuggestions] = useState(false);\n const [highlightIdx, setHighlightIdx] = useState(-1);\n const [selectedComponent, setSelectedComponent] = useState<any>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const suggestionsRef = useRef<HTMLDivElement>(null);\n\n const readClasses = useCallback((component: any) => {\n if (!component) return [];\n const attrs = component.getAttributes?.() || {};\n const modelClass = attrs.class || \"\";\n if (modelClass) {\n return modelClass.split(/\\s+/).filter((c: string) => c && !c.startsWith(\"gjs-\"));\n }\n const el = component.getEl?.();\n if (!el) return [];\n const raw = typeof el.className === \"string\" ? el.className : el.className?.baseVal || \"\";\n return raw.split(/\\s+/).filter((c: string) => c && !c.startsWith(\"gjs-\"));\n }, []);\n\n const writeClasses = useCallback((component: any, newClasses: string[]) => {\n if (!component) return;\n const merged = twMerge(newClasses.join(\" \"));\n const newClassList = merged.split(/\\s+/).filter(Boolean);\n\n const el = component.getEl();\n if (el) {\n const raw = typeof el.className === \"string\" ? el.className : el.className?.baseVal || \"\";\n const gjsClasses = raw.split(/\\s+/).filter((c: string) => c.startsWith(\"gjs-\"));\n el.className = [...gjsClasses, ...newClassList].join(\" \");\n }\n\n const currentClasses = component.getClasses();\n currentClasses.forEach((cls: string) => {\n if (!cls.startsWith(\"gjs-\")) component.removeClass(cls);\n });\n newClassList.forEach((cls: string) => component.addClass(cls));\n\n editor?.trigger(\"sidebar:change\");\n\n setClasses(newClassList);\n }, [editor]);\n\n useEffect(() => {\n if (!editor) return;\n const onSelected = (component: any) => {\n setSelectedComponent(component);\n setClasses(readClasses(component));\n setSearch(\"\");\n };\n const onDeselected = () => {\n setSelectedComponent(null);\n setClasses([]);\n };\n const onUpdate = (component: any) => {\n if (component === selectedComponent || editor.getSelected() === component) {\n setClasses(readClasses(component));\n }\n };\n\n editor.on(\"component:selected\", onSelected);\n editor.on(\"component:deselected\", onDeselected);\n editor.on(\"component:update\", onUpdate);\n\n const current = editor.getSelected();\n if (current) onSelected(current);\n\n return () => {\n editor.off(\"component:selected\", onSelected);\n editor.off(\"component:deselected\", onDeselected);\n editor.off(\"component:update\", onUpdate);\n };\n }, [editor, readClasses, selectedComponent]);\n\n const removeClass = (cls: string) => {\n if (!selectedComponent) return;\n writeClasses(selectedComponent, classes.filter((c) => c !== cls));\n };\n\n const addClass = (cls: string) => {\n if (!selectedComponent || !cls.trim()) return;\n writeClasses(selectedComponent, [...classes, cls.trim()]);\n setSearch(\"\");\n setShowSuggestions(false);\n inputRef.current?.focus();\n };\n\n const filteredSuggestions = search.trim()\n ? COMMON_CLASSES.filter(\n (c) => c.includes(search.trim().toLowerCase()) && !classes.includes(c)\n ).slice(0, 20)\n : [];\n\n const categories = categorize(classes);\n\n const getColorPreview = (cls: string): string | null => {\n if (!editor || !selectedComponent) return null;\n const bare = cls.replace(/^(sm:|md:|lg:|xl:|2xl:)/, \"\");\n if (!/^(bg-|text-|from-|to-|via-|border-)/.test(bare)) return null;\n if (/^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|left|center|right)/.test(bare)) return null;\n try {\n const doc = editor.Canvas.getDocument();\n const win = doc?.defaultView;\n if (!win) return null;\n const tmp = doc.createElement(\"div\");\n tmp.className = cls;\n tmp.style.position = \"absolute\";\n tmp.style.visibility = \"hidden\";\n doc.body.appendChild(tmp);\n const computed = win.getComputedStyle(tmp);\n const color = bare.startsWith(\"text-\") || bare.startsWith(\"decoration-\")\n ? computed.color\n : bare.startsWith(\"border-\")\n ? computed.borderColor\n : computed.backgroundColor;\n doc.body.removeChild(tmp);\n if (color && color !== \"rgba(0, 0, 0, 0)\" && color !== \"transparent\") return color;\n } catch { /* ignore */ }\n return null;\n };\n\n if (!selectedComponent) {\n return (\n <div className=\"p-4 text-center text-gray-500 text-xs\">\n <p className=\"mb-1 text-base\">◎</p>\n Selecciona un elemento para editar sus clases Tailwind\n </div>\n );\n }\n\n const tagName = selectedComponent.get?.(\"tagName\") || \"div\";\n\n return (\n <div className=\"flex flex-col h-full\">\n <div className=\"px-3 py-2 border-b border-gray-700 flex items-center gap-2\">\n <code className=\"text-[11px] bg-gray-800 text-brand-400 px-1.5 py-0.5 rounded font-mono\">\n <{tagName}>\n </code>\n <span className=\"text-[10px] text-gray-500\">{classes.length} clases</span>\n </div>\n\n <div className=\"px-3 py-2 border-b border-gray-700 relative\">\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => {\n setSearch(e.target.value);\n setShowSuggestions(true);\n setHighlightIdx(-1);\n }}\n onFocus={() => setShowSuggestions(true)}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" && showSuggestions && filteredSuggestions.length > 0) {\n e.preventDefault();\n setHighlightIdx((i) => Math.min(i + 1, filteredSuggestions.length - 1));\n } else if (e.key === \"ArrowUp\" && showSuggestions && filteredSuggestions.length > 0) {\n e.preventDefault();\n setHighlightIdx((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\" && search.trim()) {\n e.preventDefault();\n if (showSuggestions && filteredSuggestions.length > 0) {\n addClass(filteredSuggestions[highlightIdx >= 0 ? highlightIdx : 0]);\n } else {\n addClass(search.trim());\n }\n } else if (e.key === \"Escape\") {\n setShowSuggestions(false);\n setSearch(\"\");\n setHighlightIdx(-1);\n }\n }}\n placeholder=\"Agregar clase...\"\n className=\"w-full bg-gray-800 border border-gray-600 rounded-lg px-3 py-1.5 text-xs text-gray-200 placeholder-gray-500 focus:border-brand-500 focus:outline-none\"\n />\n\n {showSuggestions && filteredSuggestions.length > 0 && (\n <div\n ref={suggestionsRef}\n className=\"absolute left-3 right-3 top-full mt-1 bg-gray-800 border border-gray-600 rounded-lg shadow-xl z-50 max-h-48 overflow-auto\"\n >\n {filteredSuggestions.map((s, i) => (\n <button\n key={s}\n ref={(el) => { if (i === highlightIdx && el) el.scrollIntoView({ block: \"nearest\" }); }}\n onMouseDown={(e) => {\n e.preventDefault();\n addClass(s);\n }}\n onMouseEnter={() => setHighlightIdx(i)}\n className={`w-full text-left px-3 py-1.5 text-xs transition-colors font-mono ${\n i === highlightIdx ? \"bg-brand-500/20 text-white\" : \"text-gray-300 hover:bg-gray-700 hover:text-white\"\n }`}\n >\n {s}\n </button>\n ))}\n </div>\n )}\n </div>\n\n <div className=\"flex-1 overflow-auto p-3 space-y-3\">\n {categories.length === 0 && (\n <p className=\"text-xs text-gray-500 text-center py-4\">Sin clases Tailwind</p>\n )}\n {categories.map((cat) => (\n <div key={cat.label}>\n <p className=\"text-[10px] text-gray-500 font-bold uppercase tracking-wider mb-1.5\">\n {cat.label}\n </p>\n <div className=\"flex flex-wrap gap-1\">\n {cat.classes.map((cls) => {\n const color = getColorPreview(cls);\n return (\n <span\n key={cls}\n className=\"inline-flex items-center gap-1 bg-gray-800 border border-gray-600 rounded-md px-2 py-0.5 text-[11px] font-mono text-gray-300 hover:border-gray-400 group\"\n >\n {color && (\n <span\n className=\"w-2.5 h-2.5 rounded-full border border-gray-500 shrink-0\"\n style={{ backgroundColor: color }}\n />\n )}\n {cls}\n <button\n onClick={() => removeClass(cls)}\n className=\"text-gray-600 hover:text-red-400 transition-colors ml-0.5 opacity-0 group-hover:opacity-100\"\n title=\"Eliminar\"\n >\n ×\n </button>\n </span>\n );\n })}\n </div>\n </div>\n ))}\n\n <div className=\"border-t border-gray-700 pt-3 mt-1 space-y-2.5\">\n <p className=\"text-[10px] text-gray-500 font-bold uppercase tracking-wider\">Colores del tema</p>\n {THEME_HINTS.map((group) => (\n <div key={group.label}>\n <p className=\"text-[10px] text-gray-600 mb-1\">{group.label}</p>\n <div className=\"flex flex-wrap gap-1\">\n {group.colors.map(({ cls, name }) => {\n const semanticName = cls.replace(/^(bg-|text-|border-)/, \"\");\n const color = themeColors[semanticName] || getColorPreview(cls);\n const isActive = classes.includes(cls);\n return (\n <button\n key={cls}\n onClick={() => isActive ? removeClass(cls) : addClass(cls)}\n className={`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-mono transition-all ${\n isActive\n ? \"bg-brand-500/20 border border-brand-500 text-brand-300\"\n : \"bg-gray-800/60 border border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300\"\n }`}\n title={cls}\n >\n <span\n className=\"w-2.5 h-2.5 rounded-full border border-gray-600 shrink-0\"\n style={{ backgroundColor: color || \"#666\" }}\n />\n {name}\n </button>\n );\n })}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n );\n}\n","import { useEffect, useState, useCallback } from \"react\";\nimport type { Editor } from \"grapesjs\";\n\ninterface Props {\n editor: Editor | null;\n}\n\nfunction readSrc(component: any): string {\n if (!component) return \"\";\n const attrs = component.getAttributes?.() || {};\n return attrs.src || \"\";\n}\n\nfunction readAlt(component: any): string {\n if (!component) return \"\";\n const attrs = component.getAttributes?.() || {};\n return attrs.alt || \"\";\n}\n\nfunction isImageComponent(component: any): boolean {\n if (!component) return false;\n if (component.get?.(\"type\") === \"image\") return true;\n const el = component.getEl?.();\n return el?.tagName === \"IMG\";\n}\n\nfunction isValidHttpUrl(value: string): boolean {\n if (!value) return false;\n try {\n const u = new URL(value);\n return u.protocol === \"http:\" || u.protocol === \"https:\";\n } catch {\n return false;\n }\n}\n\nexport default function ImageSrcEditor({ editor }: Props) {\n const [selectedComponent, setSelectedComponent] = useState<any>(null);\n const [isImg, setIsImg] = useState(false);\n const [src, setSrc] = useState(\"\");\n const [alt, setAlt] = useState(\"\");\n const [previewError, setPreviewError] = useState(false);\n\n const apply = useCallback((next: { src?: string; alt?: string }) => {\n if (!selectedComponent) return;\n selectedComponent.addAttributes?.(next);\n const el = selectedComponent.getEl?.();\n if (el) {\n if (next.src !== undefined) el.setAttribute(\"src\", next.src);\n if (next.alt !== undefined) el.setAttribute(\"alt\", next.alt);\n }\n editor?.trigger(\"sidebar:change\");\n }, [editor, selectedComponent]);\n\n const applySrc = useCallback(() => {\n if (!isValidHttpUrl(src)) return;\n apply({ src });\n }, [apply, src]);\n\n const applyAlt = useCallback(() => {\n apply({ alt });\n }, [apply, alt]);\n\n useEffect(() => {\n if (!editor) return;\n\n const onSelected = (component: any) => {\n setSelectedComponent(component);\n const img = isImageComponent(component);\n setIsImg(img);\n if (img) {\n setSrc(readSrc(component));\n setAlt(readAlt(component));\n setPreviewError(false);\n } else {\n setSrc(\"\");\n setAlt(\"\");\n }\n };\n const onDeselected = () => {\n setSelectedComponent(null);\n setIsImg(false);\n setSrc(\"\");\n setAlt(\"\");\n };\n\n editor.on(\"component:selected\", onSelected);\n editor.on(\"component:deselected\", onDeselected);\n\n const current = editor.getSelected();\n if (current) onSelected(current);\n\n return () => {\n editor.off(\"component:selected\", onSelected);\n editor.off(\"component:deselected\", onDeselected);\n };\n }, [editor]);\n\n if (!isImg) return null;\n\n const urlValid = isValidHttpUrl(src);\n\n return (\n <div className=\"p-3 border-b border-gray-800 bg-gray-900/50\">\n <p className=\"text-[10px] text-gray-400 font-bold uppercase tracking-wider mb-2\">Imagen</p>\n\n {src && !previewError && (\n <div className=\"mb-2 rounded-md overflow-hidden border border-gray-700 bg-gray-950\" style={{ aspectRatio: \"16 / 9\" }}>\n <img\n src={src}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n onError={() => setPreviewError(true)}\n onLoad={() => setPreviewError(false)}\n />\n </div>\n )}\n\n <label className=\"block text-[10px] text-gray-500 uppercase tracking-wider mb-1\">URL</label>\n <div className=\"flex items-center gap-1 mb-2\">\n <input\n type=\"text\"\n value={src}\n onChange={(e) => { setSrc(e.target.value); setPreviewError(false); }}\n onKeyDown={(e) => { if (e.key === \"Enter\") applySrc(); }}\n placeholder=\"https://...\"\n className=\"flex-1 bg-gray-800 text-xs text-white rounded px-2 py-1.5 outline-none border border-transparent focus:border-brand-500 min-w-0\"\n />\n <button\n onClick={applySrc}\n disabled={!urlValid}\n className=\"px-2.5 py-1.5 text-[10px] font-bold rounded bg-brand-500 hover:bg-brand-600 transition-colors shrink-0 disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n Aplicar\n </button>\n </div>\n {src && !urlValid && (\n <p className=\"text-[10px] text-amber-500 mb-2\">URL inválida — debe empezar con http:// o https://</p>\n )}\n {previewError && urlValid && (\n <p className=\"text-[10px] text-red-400 mb-2\">No se pudo cargar la imagen desde esa URL.</p>\n )}\n\n <label className=\"block text-[10px] text-gray-500 uppercase tracking-wider mb-1\">Alt</label>\n <div className=\"flex items-center gap-1\">\n <input\n type=\"text\"\n value={alt}\n onChange={(e) => setAlt(e.target.value)}\n onKeyDown={(e) => { if (e.key === \"Enter\") applyAlt(); }}\n placeholder=\"Descripción...\"\n className=\"flex-1 bg-gray-800 text-xs text-white rounded px-2 py-1.5 outline-none border border-transparent focus:border-brand-500 min-w-0\"\n />\n <button\n onClick={applyAlt}\n className=\"px-2.5 py-1.5 text-[10px] font-bold rounded bg-gray-700 hover:bg-gray-600 transition-colors shrink-0\"\n >\n Aplicar\n </button>\n </div>\n </div>\n );\n}\n","/** GrapesJS dark theme CSS — injected at runtime to avoid CSS bundling */\nexport const GRAPES_DARK_CSS = `\n/* Dark theme for GrapesJS editor — matches EasyBits dark sidebar */\n\n/* Main editor background */\n.gjs-one-bg { background-color: #111827 !important; }\n.gjs-two-color { color: #e5e7eb !important; }\n.gjs-three-bg { background-color: #1f2937 !important; }\n.gjs-four-color, .gjs-four-color-h:hover { color: #9ca3af !important; }\n\n/* Editor chrome */\n.gjs-editor { background-color: #000000 !important; }\n\n/* Block manager */\n.gjs-blocks-cs { background-color: #111827 !important; }\n.gjs-block { background-color: #1f2937 !important; color: #e5e7eb !important; border: 1px solid #374151 !important; border-radius: 8px !important; }\n.gjs-block:hover { border-color: #9870ED !important; }\n.gjs-block-label { color: #d1d5db !important; }\n.gjs-block svg { fill: #9ca3af !important; }\n\n/* Block categories */\n.gjs-block-categories { background-color: #111827 !important; }\n.gjs-block-category { background-color: #111827 !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-block-category .gjs-title { background-color: #111827 !important; color: #e5e7eb !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-block-category .gjs-title:hover { background-color: #1f2937 !important; }\n.gjs-block-category .gjs-caret-icon { color: #9ca3af !important; }\n\n/* Layer manager */\n.gjs-layers { background-color: #111827 !important; }\n.gjs-layer { background-color: #111827 !important; color: #e5e7eb !important; }\n.gjs-layer:hover { background-color: #1f2937 !important; }\n.gjs-layer-title { color: #e5e7eb !important; }\n.gjs-layer-title-inn { background-color: transparent !important; }\n.gjs-layer.gjs-selected .gjs-layer-title { background-color: rgba(152, 112, 237, 0.15) !important; }\n.gjs-layer-name { color: #e5e7eb !important; }\n.gjs-layer-vis { color: #9ca3af !important; }\n.gjs-layer-caret { color: #9ca3af !important; }\n\n/* Style manager */\n.gjs-sm-sectors { background-color: #111827 !important; }\n.gjs-sm-sector { background-color: #111827 !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-sector-title { background-color: #111827 !important; color: #e5e7eb !important; border-bottom: 1px solid #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-sector-title:hover { background-color: #1f2937 !important; }\n.gjs-sm-sector .gjs-sm-properties { background-color: #111827 !important; }\n.gjs-sm-label { color: #9ca3af !important; }\n.gjs-field { background-color: #1f2937 !important; border: 1px solid #374151 !important; color: #e5e7eb !important; }\n.gjs-field input, .gjs-field select, .gjs-field textarea { color: #e5e7eb !important; background-color: transparent !important; }\n.gjs-field .gjs-input-holder { color: #e5e7eb !important; }\n.gjs-field-arrows { color: #9ca3af !important; }\n.gjs-sm-composite { background-color: #111827 !important; }\n.gjs-sm-stack #gjs-sm-add { color: #9ca3af !important; }\n\n/* Trait manager */\n.gjs-trt-traits { background-color: #111827 !important; }\n.gjs-trt-trait { color: #e5e7eb !important; }\n\n/* Panels */\n.gjs-pn-panel { background-color: #111827 !important; }\n.gjs-pn-btn { color: #9ca3af !important; }\n.gjs-pn-btn:hover { color: #e5e7eb !important; }\n.gjs-pn-btn.gjs-pn-active { color: #9870ED !important; }\n\n/* Canvas — full width, no padding */\n.gjs-cv-canvas { background-color: #000000 !important; }\n.gjs-frame-wrapper { padding: 0 !important; }\n.gjs-frame { width: 100% !important; left: 0 !important; }\n\n/* Toolbar on selected component */\n.gjs-toolbar { background-color: #9870ED !important; }\n.gjs-toolbar-item { color: white !important; }\n\n/* Selection highlight */\n.gjs-selected { outline: 2px solid #9870ED !important; outline-offset: -2px; }\n.gjs-highlighter { outline: 2px solid #9870ED !important; }\n\n/* Scrollbars */\n.gjs-editor ::-webkit-scrollbar { width: 6px; }\n.gjs-editor ::-webkit-scrollbar-track { background: #111827; }\n.gjs-editor ::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }\n.gjs-editor ::-webkit-scrollbar-thumb:hover { background: #4b5563; }\n\n/* Hide native GrapesJS panel buttons (preview eye, etc.) but keep panel system functional */\n.gjs-pn-btn {\n display: none !important;\n}\n/* The panels container that holds the buttons row */\n.gjs-pn-commands,\n.gjs-pn-options,\n.gjs-pn-views {\n height: 0 !important;\n overflow: hidden !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n/* Rich text editor */\n.gjs-rte-toolbar { background-color: #1f2937 !important; border: 1px solid #374151 !important; }\n.gjs-rte-actionbar { background-color: #1f2937 !important; }\n.gjs-rte-action { color: #e5e7eb !important; }\n`;\n"],"mappings":";;;;;;;AAAA,SAAS,aAAAA,YAAW,UAAAC,SAAQ,YAAAC,WAAU,YAAY,2BAA2B;;;ACItE,IAAM,iBAAiB;AAAA;AAAA,EAE5B;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS,EAAE,MAAM,QAAQ;AAAA,IACzB,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,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AC;AAAA;AAAA,UACC,WAAW,4GACT,QAAQ,wBAAwB,aAClC;AAAA;AAAA,MACF;AAAA,OACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;AAC3B,IAAO,uBAAQ;","names":["useEffect","useRef","useState","useEffect","useState","useCallback","jsx","jsxs","jsx","jsxs","useEffect","useRef","useState","vars","t"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easybits.cloud/html-tailwind-generator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.135",
|
|
4
4
|
"description": "AI-powered landing page generator with Tailwind CSS — canvas editor, streaming generation, and one-click deploy",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"type": "module",
|