@chaibuilder/sdk 1.1.14 → 1.1.16
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/AddBlocks-1DrS62uN.js +222 -0
- package/dist/AddBlocks-jqRRefXj.cjs +1 -0
- package/dist/BrandingOptions-TRVyCvVq.cjs +1 -0
- package/dist/{BrandingOptions-4qzTYdj5.js → BrandingOptions-zFJ28xmJ.js} +18 -19
- package/dist/CanvasArea-5oxRxEDL.cjs +59 -0
- package/dist/CanvasArea-j8iIkWN-.js +1438 -0
- package/dist/{CurrentPage-zxrdTVsG.cjs → CurrentPage-CsENtl7b.cjs} +1 -1
- package/dist/{CurrentPage-spjJpQSM.js → CurrentPage-cNRrM2vd.js} +1 -1
- package/dist/{Layers-QNAlCI4j.js → Layers-6Fa_6Vy2.js} +2 -2
- package/dist/{Layers-YyBChBtg.cjs → Layers-r6pP4nDP.cjs} +1 -1
- package/dist/MarkAsGlobalBlock-CDmEHNx7.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-xOHhiMDl.js → MarkAsGlobalBlock-uhj0kGZo.js} +23 -23
- package/dist/{PagesPanel-BeJrveus.cjs → PagesPanel-UXqoXG-j.cjs} +1 -1
- package/dist/{PagesPanel--LI-BoSj.js → PagesPanel-s2qoPZc-.js} +2 -2
- package/dist/{ProjectPanel-VNj0jXca.js → ProjectPanel-9z6zVYBb.js} +2 -2
- package/dist/{ProjectPanel-MjcAymKT.cjs → ProjectPanel-izG3GYtn.cjs} +1 -1
- package/dist/Settings-iLeODb_n.js +2188 -0
- package/dist/Settings-olFxwKg4.cjs +1 -0
- package/dist/SidePanels-1QED7mo6.cjs +1 -0
- package/dist/{SidePanels-4lvmnnlw.js → SidePanels-CWAz1HdY.js} +125 -124
- package/dist/add-page-modal-rn0OScnT.cjs +1 -0
- package/dist/{add-page-modal-fZnKopNf.js → add-page-modal-vT0-45wi.js} +6 -7
- package/dist/controls-QnyBNkXG.cjs +36 -0
- package/dist/controls-kEuiMMDf.js +4600 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-P_KKu12n.cjs → delete-page-modal-EZ4gIG3s.cjs} +1 -1
- package/dist/{delete-page-modal-fRoXPfhG.js → delete-page-modal-hWmFarnh.js} +1 -1
- package/dist/index-Ge20J9Pa.cjs +206 -0
- package/dist/{index-CQz6j3ex.js → index-TWBwhGkh.js} +4957 -4262
- package/dist/mockServiceWorker.js +10 -18
- package/dist/{page-viewer-39ZtxLzx.js → page-viewer-TZC26UCW.js} +2 -2
- package/dist/{page-viewer-_lc8vqU4.cjs → page-viewer-yH4HdYhv.cjs} +1 -1
- package/dist/{project-general-setting-CCVuGyHh.js → project-general-setting-SjVbcwgp.js} +7 -8
- package/dist/project-general-setting-eEQDxjVm.cjs +1 -0
- package/dist/{project-seo-setting-Wo7E46w7.js → project-seo-setting-EhqUcTKy.js} +7 -8
- package/dist/project-seo-setting-N0OnBCvh.cjs +1 -0
- package/dist/single-page-detail-76T7ZZzC.cjs +1 -0
- package/dist/{single-page-detail-r1GJF00l.js → single-page-detail-ePzFhs8m.js} +47 -48
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +1 -1
- package/package.json +3 -2
- package/dist/AddBlocks-AG_J7s2Z.cjs +0 -1
- package/dist/AddBlocks-FsdsASNp.js +0 -222
- package/dist/BrandingOptions-xBuqDpj0.cjs +0 -1
- package/dist/CanvasArea-4m1-c1yq.cjs +0 -59
- package/dist/CanvasArea-U3egqewu.js +0 -1434
- package/dist/MarkAsGlobalBlock-LXDkmFUr.cjs +0 -1
- package/dist/Settings-BrYkhn3H.cjs +0 -1
- package/dist/Settings-LZJwbkO6.js +0 -2189
- package/dist/SidePanels-_5oUp-eI.cjs +0 -1
- package/dist/add-page-modal-rWhPuGd9.cjs +0 -1
- package/dist/controls-G0puEH71.js +0 -120
- package/dist/controls-aHZq-q4b.cjs +0 -1
- package/dist/index-1Dr-VtaT.cjs +0 -206
- package/dist/project-general-setting-LEzDhwoq.cjs +0 -1
- package/dist/project-seo-setting-orwH-Ufg.cjs +0 -1
- package/dist/single-page-detail-jkDYF7lW.cjs +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
+
import v, { createElement as V, useState as b, useCallback as U, useMemo as W, useEffect as J, Suspense as K } from "react";
|
|
3
|
+
import { t as R, h as f, o as Y, a as j, b as y, F as k, Y as N, Z, L as S, k as Q, g as X, d as T, c as A, j as L, _ as $, R as F } from "./lodash-3gkdNK5u.js";
|
|
4
|
+
import { useAtom as g } from "jotai";
|
|
5
|
+
import { useTranslation as D } from "react-i18next";
|
|
6
|
+
import { O as _, j as B, _ as ee, av as G, aw as P, aD as se, aE as te, aG as re, i as oe, a8 as z, aq as ae, ar as le, as as ce, at as ne, au as H, bp as ie, bq as de, br as me, bs as pe, bt as ue, aI as xe, bu as he, bv as fe, B as ge, bw as be, bx as je, by as ye, ae as ke, ax as ve, ay as Be, az as C, bo as we, bh as Ce, bi as Ne, bj as Te, bk as Ae, S as _e } from "./index-0OqmBgqo.js";
|
|
7
|
+
import { BoxIcon as Pe } from "@radix-ui/react-icons";
|
|
8
|
+
import { syncBlocksWithDefaults as O, useChaiBlocks as q } from "@chaibuilder/runtime";
|
|
9
|
+
import { useFeature as Ie } from "flagged";
|
|
10
|
+
import { Loader as Se } from "lucide-react";
|
|
11
|
+
import { useDrag as Le, DragPreviewImage as Fe } from "react-dnd";
|
|
12
|
+
import { g as He } from "./html-to-json-Y5M0N8PH.js";
|
|
13
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
14
|
+
import "@radix-ui/react-toggle";
|
|
15
|
+
import "class-variance-authority";
|
|
16
|
+
import "./utils-XsPKXMVo.js";
|
|
17
|
+
import "clsx";
|
|
18
|
+
import "tailwind-merge";
|
|
19
|
+
import "@radix-ui/react-switch";
|
|
20
|
+
import "@radix-ui/react-slot";
|
|
21
|
+
import "@radix-ui/react-accordion";
|
|
22
|
+
import "@radix-ui/react-alert-dialog";
|
|
23
|
+
import "@radix-ui/react-dialog";
|
|
24
|
+
import "@radix-ui/react-label";
|
|
25
|
+
import "@radix-ui/react-scroll-area";
|
|
26
|
+
import "@radix-ui/react-tabs";
|
|
27
|
+
import "@radix-ui/react-tooltip";
|
|
28
|
+
import "@radix-ui/react-popover";
|
|
29
|
+
import "@radix-ui/react-menubar";
|
|
30
|
+
import "@radix-ui/react-hover-card";
|
|
31
|
+
import "@radix-ui/react-select";
|
|
32
|
+
import "@radix-ui/react-dropdown-menu";
|
|
33
|
+
import "@radix-ui/react-separator";
|
|
34
|
+
import "@radix-ui/react-toast";
|
|
35
|
+
import "cmdk";
|
|
36
|
+
import "@radix-ui/react-context-menu";
|
|
37
|
+
import "react-icons-picker";
|
|
38
|
+
import "react-dom";
|
|
39
|
+
import "react-quill";
|
|
40
|
+
import "flat-to-nested";
|
|
41
|
+
import "redux-undo";
|
|
42
|
+
import "@react-hookz/web";
|
|
43
|
+
import "himalaya";
|
|
44
|
+
const Ee = ({ block: s }) => {
|
|
45
|
+
const { type: t, icon: r, label: a } = s, { addCoreBlock: d, addPredefinedBlock: n } = _(), [p, m] = B(), [, x] = ee(), [, o] = g(G), [, l] = g(P), c = () => {
|
|
46
|
+
R(s, "blocks") ? n(O(s.blocks), f(p)) : d(s, f(p)), l(!1), o("layers");
|
|
47
|
+
}, h = Ie("dnd");
|
|
48
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(se, { children: [
|
|
49
|
+
/* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
onClick: c,
|
|
53
|
+
type: "button",
|
|
54
|
+
onDragStart: (u) => {
|
|
55
|
+
u.dataTransfer.setData("text/plain", JSON.stringify(Y(s, ["component", "icon"]))), setTimeout(() => {
|
|
56
|
+
m([]), x(null), l(!1), o("layers");
|
|
57
|
+
}, 200);
|
|
58
|
+
},
|
|
59
|
+
draggable: h ? "true" : "false",
|
|
60
|
+
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (h ? "cursor-grab" : "cursor-pointer"),
|
|
61
|
+
children: [
|
|
62
|
+
V(r || Pe, { className: "w-4 h-4 mx-auto" }),
|
|
63
|
+
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || t })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
) }),
|
|
67
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx("p", { children: a || t }) })
|
|
68
|
+
] }) });
|
|
69
|
+
}, Re = ({ block: s, closePopover: t }) => {
|
|
70
|
+
var c;
|
|
71
|
+
const [r, a] = b(!1), d = oe("getExternalPredefinedBlock"), { addCoreBlock: n, addPredefinedBlock: p } = _(), [m] = B(), [, x, o] = Le(
|
|
72
|
+
() => ({
|
|
73
|
+
type: "CHAI_BLOCK",
|
|
74
|
+
item: s
|
|
75
|
+
}),
|
|
76
|
+
[s]
|
|
77
|
+
), l = U(
|
|
78
|
+
async (h) => {
|
|
79
|
+
if (h.stopPropagation(), R(s, "component")) {
|
|
80
|
+
n(s, f(m)), t();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
a(!0);
|
|
84
|
+
const u = await d(s);
|
|
85
|
+
j(u) || p(O(u), f(m)), t();
|
|
86
|
+
},
|
|
87
|
+
[s]
|
|
88
|
+
);
|
|
89
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
90
|
+
/* @__PURE__ */ e.jsx(
|
|
91
|
+
Fe,
|
|
92
|
+
{
|
|
93
|
+
connect: o,
|
|
94
|
+
src: "https://placehold.co/100x30/000000/FFF?text=" + ((c = s.name || s.label) == null ? void 0 : c.replace(" ", "+"))
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ e.jsxs(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
ref: x,
|
|
101
|
+
onClick: r ? () => {
|
|
102
|
+
} : l,
|
|
103
|
+
className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
104
|
+
children: [
|
|
105
|
+
r && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
106
|
+
/* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
|
|
107
|
+
" ",
|
|
108
|
+
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
109
|
+
] }),
|
|
110
|
+
s.preview ? /* @__PURE__ */ e.jsx(
|
|
111
|
+
"img",
|
|
112
|
+
{
|
|
113
|
+
src: s.preview,
|
|
114
|
+
className: "min-h-[50px] w-full rounded-md border border-gray-300",
|
|
115
|
+
alt: s.label
|
|
116
|
+
}
|
|
117
|
+
) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
122
|
+
}, De = () => {
|
|
123
|
+
const { data: s } = z(), t = q(), r = y(k(t), { category: "custom" }), a = N(r, "group"), d = N(s, "group"), n = W(() => Z(a, d, (l, c) => {
|
|
124
|
+
if (S(l) && S(c))
|
|
125
|
+
return [...l, ...c];
|
|
126
|
+
}), [a, d]), [, p] = g(P), [m, x] = b(f(Q(n)) || ""), o = X(n, m, []);
|
|
127
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
|
|
128
|
+
/* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(ae, { value: m, onValueChange: (l) => x(l), children: [
|
|
129
|
+
/* @__PURE__ */ e.jsx(le, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: "Select a provider" }) }),
|
|
130
|
+
/* @__PURE__ */ e.jsxs(ne, { children: [
|
|
131
|
+
/* @__PURE__ */ e.jsx(H, { value: "", children: "Choose" }),
|
|
132
|
+
v.Children.toArray(
|
|
133
|
+
T(n, (l, c) => /* @__PURE__ */ e.jsx(H, { value: c, children: c }, c))
|
|
134
|
+
)
|
|
135
|
+
] })
|
|
136
|
+
] }) }),
|
|
137
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: v.Children.toArray(
|
|
138
|
+
o.map((l) => /* @__PURE__ */ e.jsx(Re, { block: l, closePopover: () => p(!1) }))
|
|
139
|
+
) })
|
|
140
|
+
] });
|
|
141
|
+
}, Ge = () => {
|
|
142
|
+
const { t: s } = D(), [t, r] = b(""), { addPredefinedBlock: a } = _(), [d] = B(), [, n] = g(ie), [, p] = g(G), [, m] = g(P), x = () => {
|
|
143
|
+
const o = He(t);
|
|
144
|
+
a([...o], f(d) || null), r(""), n(!1), p("layers"), m(!1);
|
|
145
|
+
};
|
|
146
|
+
return /* @__PURE__ */ e.jsxs(de, { className: "border-border/0 p-0 shadow-none", children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx(me, { className: "p-3", children: /* @__PURE__ */ e.jsx(pe, { children: s("html_snippet_description") }) }),
|
|
148
|
+
/* @__PURE__ */ e.jsx(ue, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
149
|
+
/* @__PURE__ */ e.jsx(xe, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
150
|
+
/* @__PURE__ */ e.jsx(
|
|
151
|
+
he,
|
|
152
|
+
{
|
|
153
|
+
autoFocus: !0,
|
|
154
|
+
tabIndex: 1,
|
|
155
|
+
ref: (o) => o && o.focus(),
|
|
156
|
+
defaultValue: t,
|
|
157
|
+
onChange: (o) => r(o.target.value),
|
|
158
|
+
rows: 12,
|
|
159
|
+
placeholder: s("enter_code_snippet"),
|
|
160
|
+
className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] }) }),
|
|
164
|
+
/* @__PURE__ */ e.jsxs(fe, { className: "flex flex-col justify-end p-3", children: [
|
|
165
|
+
/* @__PURE__ */ e.jsx(ge, { disabled: t.trim() === "", onClick: () => x(), size: "sm", className: "w-full", children: s("import_html") }),
|
|
166
|
+
/* @__PURE__ */ e.jsx(be, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(je, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
167
|
+
] })
|
|
168
|
+
] });
|
|
169
|
+
}, E = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], ze = (s, t) => {
|
|
170
|
+
if (!s)
|
|
171
|
+
return !A(E, t);
|
|
172
|
+
const r = s._type;
|
|
173
|
+
return r === "List" ? t === "ListItem" : r === "Table" ? t === "TableHead" || t === "TableBody" : r === "TableHead" || r === "TableBody" ? t === "TableRow" : r === "TableRow" ? t === "TableCell" : r === "Row" ? t === "Column" : !A(E, t);
|
|
174
|
+
}, Ps = () => {
|
|
175
|
+
const { t: s } = D(), [t, r] = b("core"), [a, d] = b("basic"), n = q(), [, p] = g(ye), [m] = B(), x = ke(), o = L(x, { _id: f(m) }), { data: l, isLoading: c } = z(), h = N(
|
|
176
|
+
y(n, (i) => ze(o, i.type)),
|
|
177
|
+
"category"
|
|
178
|
+
), u = $(T(h.core, "group"));
|
|
179
|
+
J(() => {
|
|
180
|
+
!A(u, a) && !j(u) && !j(a) && d(f(u));
|
|
181
|
+
}, [u, a]);
|
|
182
|
+
const M = (i) => d((w) => w === i ? "" : i), I = !c && !j(l) || L(k(n), { category: "custom" }) !== void 0;
|
|
183
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
184
|
+
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
185
|
+
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
|
|
186
|
+
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(t === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
|
|
187
|
+
] }),
|
|
188
|
+
/* @__PURE__ */ e.jsx(
|
|
189
|
+
ve,
|
|
190
|
+
{
|
|
191
|
+
onValueChange: (i) => {
|
|
192
|
+
p(""), r(i);
|
|
193
|
+
},
|
|
194
|
+
value: t,
|
|
195
|
+
className: "h-max",
|
|
196
|
+
children: /* @__PURE__ */ e.jsxs(Be, { className: "grid w-full " + (I ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
197
|
+
/* @__PURE__ */ e.jsx(C, { value: "core", children: s("core") }),
|
|
198
|
+
I ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("custom_blocks") }) : null,
|
|
199
|
+
/* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") })
|
|
200
|
+
] })
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
t === "core" && /* @__PURE__ */ e.jsx(we, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(Ce, { type: "single", value: a, className: "w-full px-3", children: v.Children.toArray(
|
|
204
|
+
T(
|
|
205
|
+
u,
|
|
206
|
+
(i) => F(y(k(h.core), { group: i }), {
|
|
207
|
+
hidden: !0
|
|
208
|
+
}).length ? /* @__PURE__ */ e.jsxs(Ne, { value: i, className: "border-border", children: [
|
|
209
|
+
/* @__PURE__ */ e.jsx(Te, { onClick: () => M(i), className: "py-2 capitalize", children: i }),
|
|
210
|
+
/* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: v.Children.toArray(
|
|
211
|
+
F(y(k(h.core), { group: i }), { hidden: !0 }).map((w) => /* @__PURE__ */ e.jsx(Ee, { block: w }))
|
|
212
|
+
) }) })
|
|
213
|
+
] }) : null
|
|
214
|
+
)
|
|
215
|
+
) }) }),
|
|
216
|
+
t === "ui-blocks" && /* @__PURE__ */ e.jsx(K, { fallback: /* @__PURE__ */ e.jsx(_e, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(De, {}) }),
|
|
217
|
+
t === "html" && /* @__PURE__ */ e.jsx(Ge, {})
|
|
218
|
+
] });
|
|
219
|
+
};
|
|
220
|
+
export {
|
|
221
|
+
Ps as default
|
|
222
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),c=require("react"),t=require("./lodash-2us0VT8I.cjs"),E=require("jotai"),v=require("react-i18next"),s=require("./index-d55M5MRz.cjs"),A=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),T=require("flagged"),C=require("lucide-react"),y=require("react-dnd"),w=require("./html-to-json-aAZkA0f5.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("himalaya");const N=({block:r})=>{const{type:o,icon:l,label:i}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,n]=E.useAtom(s.activePanelAtom),[,a]=E.useAtom(s.addBlocksModalAtom),d=()=>{t.has(r,"blocks")?u(R.syncBlocksWithDefaults(r.blocks),t.head(j)):m(r,t.head(j)),a(!1),n("layers")},g=T.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:d,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),f(null),a(!1),n("layers")},200)},draggable:g?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(g?"cursor-grab":"cursor-pointer"),children:[c.createElement(l||A.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:i||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:i||o})})]})})},S=({block:r,closePopover:o})=>{var d;const[l,i]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:u,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,f,n]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),a=c.useCallback(async g=>{if(g.stopPropagation(),t.has(r,"component")){u(r,t.head(p)),o();return}i(!0);const h=await m(r);t.isEmpty(h)||j(R.syncBlocksWithDefaults(h),t.head(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:n,src:"https://placehold.co/100x30/000000/FFF?text="+((d=r.name||r.label)==null?void 0:d.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:f,onClick:l?()=>{}:a,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(C.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},I=()=>{const{data:r}=s.useUILibraryBlocks(),o=R.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),i=t.groupBy(l,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(i,m,(a,d)=>{if(t.isArray(a)&&t.isArray(d))return[...a,...d]}),[i,m]),[,j]=E.useAtom(s.addBlocksModalAtom),[p,f]=c.useState(t.head(t.keys(u))||""),n=t.get(u,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:a=>f(a),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(u,(a,d)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:d,children:d},d)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(n.map(a=>e.jsxRuntimeExports.jsx(S,{block:a,closePopover:()=>j(!1)})))})]})},_=()=>{const{t:r}=v.useTranslation(),[o,l]=c.useState(""),{addPredefinedBlock:i}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=E.useAtom(s.addBlockOffCanvasAtom),[,j]=E.useAtom(s.activePanelAtom),[,p]=E.useAtom(s.addBlocksModalAtom),f=()=>{const n=w.getBlocksFromHTML(o);i([...n],t.head(m)||null),l(""),u(!1),j("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:o,onChange:n=>l(n.target.value),rows:12,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:o.trim()==="",onClick:()=>f(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],P=(r,o)=>{if(!r)return!t.includes(k,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(k,o)},L=()=>{const{t:r}=v.useTranslation(),[o,l]=c.useState("core"),[i,m]=c.useState("basic"),u=R.useChaiBlocks(),[,j]=E.useAtom(s.showPredefinedBlockCategoryAtom),[p]=s.useSelectedBlockIds(),f=s.useAllBlocks(),n=t.find(f,{_id:t.head(p)}),{data:a,isLoading:d}=s.useUILibraryBlocks(),g=t.groupBy(t.filter(u,x=>P(n,x.type)),"category"),h=t.uniq(t.map(g.core,"group"));c.useEffect(()=>{!t.includes(h,i)&&!t.isEmpty(h)&&!t.isEmpty(i)&&m(t.head(h))},[h,i]);const q=x=>m(b=>b===x?"":x),B=!d&&!t.isEmpty(a)||t.find(t.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(o==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:x=>{j(""),l(x)},value:o,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),B?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")})]})}),o==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:i,className:"w-full px-3",children:c.Children.toArray(t.map(h,x=>t.reject(t.filter(t.values(g.core),{group:x}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:x,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>q(x),className:"py-2 capitalize",children:x}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(g.core),{group:x}),{hidden:!0}).map(b=>e.jsxRuntimeExports.jsx(N,{block:b})))})})]}):null))})}),o==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(I,{})}),o==="html"&&e.jsxRuntimeExports.jsx(_,{})]})};exports.default=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),g=require("./index-d55M5MRz.cjs"),r=require("./controls-QnyBNkXG.cjs"),m=require("./lodash-2us0VT8I.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");function R(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=R(j),N=({value:t,onChange:e,id:i,onBlur:a})=>{const d=m.debounce(e,200),c=n=>d(n.target.value);return l.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:l.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:l.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:n}})=>a(i,n),onChange:c})})})},y=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=g.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=g.useBrandingOptions(),a=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,a.current)||t(a.current)},[]);const d=({formData:o},s)=>{s&&(i(o),a.current=o)},{bodyFont:c,headingFont:n,primaryColor:f,bodyTextDarkColor:q,bodyTextLightColor:b,bodyBgDarkColor:h,secondaryColor:S,bodyBgLightColor:C,roundedCorners:O}=e,v={headingFont:r.Ty({title:"Heading font",default:n,options:y}),bodyFont:r.Ty({title:"Body font",default:c,options:y}),roundedCorners:r.my({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:r.Ey({title:"Primary",default:f}),secondaryColor:r.Ey({title:"Secondary",default:S}),bodyBgLightColor:r.Ey({title:"Body Background (Light)",default:C}),bodyBgDarkColor:r.Ey({title:"Body Background (Dark)",default:h}),bodyTextLightColor:r.Ey({title:"Body Text (Light)",default:q}),bodyTextDarkColor:r.Ey({title:"Body Text (Dark)",default:b})},u={type:"object",properties:{}},p={};return Object.keys(v).forEach(o=>{const s=v[o];return u.properties||(u.properties={}),u.properties[o]=s.schema,p[o]=s.uiSchema,!0}),l.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[l.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:l.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),l.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:l.jsxRuntimeExports.jsx(E,{widgets:{color:N},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:p,schema:u,formData:e,validator:B,onChange:d})})]})};exports.default=P;
|
|
@@ -3,7 +3,7 @@ import * as c from "react";
|
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import N from "@rjsf/core";
|
|
5
5
|
import { i as j, x as k } from "./index-0OqmBgqo.js";
|
|
6
|
-
import {
|
|
6
|
+
import { T as g, m as D, E as o } from "./controls-kEuiMMDf.js";
|
|
7
7
|
import { $ as P, X as R } from "./lodash-3gkdNK5u.js";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -39,8 +39,7 @@ import "redux-undo";
|
|
|
39
39
|
import "@chaibuilder/runtime";
|
|
40
40
|
import "@react-hookz/web";
|
|
41
41
|
import "react-i18next";
|
|
42
|
-
|
|
43
|
-
const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
42
|
+
const T = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
44
43
|
const p = P(e, 200), d = (l) => p(l.target.value);
|
|
45
44
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
46
45
|
"input",
|
|
@@ -108,14 +107,14 @@ const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
|
108
107
|
c.useEffect(() => () => {
|
|
109
108
|
R(e, i.current) || s(i.current);
|
|
110
109
|
}, []);
|
|
111
|
-
const p = ({ formData:
|
|
112
|
-
n && (u(
|
|
110
|
+
const p = ({ formData: a }, n) => {
|
|
111
|
+
n && (u(a), i.current = a);
|
|
113
112
|
}, {
|
|
114
113
|
bodyFont: d,
|
|
115
114
|
headingFont: l,
|
|
116
115
|
primaryColor: h,
|
|
117
|
-
bodyTextDarkColor:
|
|
118
|
-
bodyTextLightColor:
|
|
116
|
+
bodyTextDarkColor: y,
|
|
117
|
+
bodyTextLightColor: x,
|
|
119
118
|
bodyBgDarkColor: b,
|
|
120
119
|
secondaryColor: C,
|
|
121
120
|
bodyBgLightColor: S,
|
|
@@ -135,39 +134,39 @@ const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
|
135
134
|
title: "Rounded Corner",
|
|
136
135
|
default: parseInt(B || 5, 10)
|
|
137
136
|
}),
|
|
138
|
-
primaryColor:
|
|
139
|
-
secondaryColor:
|
|
140
|
-
bodyBgLightColor:
|
|
137
|
+
primaryColor: o({ title: "Primary", default: h }),
|
|
138
|
+
secondaryColor: o({ title: "Secondary", default: C }),
|
|
139
|
+
bodyBgLightColor: o({
|
|
141
140
|
title: "Body Background (Light)",
|
|
142
141
|
default: S
|
|
143
142
|
}),
|
|
144
|
-
bodyBgDarkColor:
|
|
143
|
+
bodyBgDarkColor: o({
|
|
145
144
|
title: "Body Background (Dark)",
|
|
146
145
|
default: b
|
|
147
146
|
}),
|
|
148
|
-
bodyTextLightColor:
|
|
147
|
+
bodyTextLightColor: o({
|
|
149
148
|
title: "Body Text (Light)",
|
|
150
|
-
default:
|
|
149
|
+
default: y
|
|
151
150
|
}),
|
|
152
|
-
bodyTextDarkColor:
|
|
151
|
+
bodyTextDarkColor: o({
|
|
153
152
|
title: "Body Text (Dark)",
|
|
154
|
-
default:
|
|
153
|
+
default: x
|
|
155
154
|
})
|
|
156
155
|
// TODO: exteend more options from user
|
|
157
156
|
}, r = {
|
|
158
157
|
type: "object",
|
|
159
158
|
properties: {}
|
|
160
159
|
}, v = {};
|
|
161
|
-
return Object.keys(m).forEach((
|
|
162
|
-
const n = m[
|
|
163
|
-
return r.properties || (r.properties = {}), r.properties[
|
|
160
|
+
return Object.keys(m).forEach((a) => {
|
|
161
|
+
const n = m[a];
|
|
162
|
+
return r.properties || (r.properties = {}), r.properties[a] = n.schema, v[a] = n.uiSchema, !0;
|
|
164
163
|
}), /* @__PURE__ */ t.jsxs("div", { className: "flex h-full select-none flex-col", children: [
|
|
165
164
|
/* @__PURE__ */ t.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Branding Options" }) }),
|
|
166
165
|
/* @__PURE__ */ t.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ t.jsx(
|
|
167
166
|
N,
|
|
168
167
|
{
|
|
169
168
|
widgets: {
|
|
170
|
-
color:
|
|
169
|
+
color: T
|
|
171
170
|
},
|
|
172
171
|
idSeparator: ".",
|
|
173
172
|
autoComplete: "off",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";var $e=Object.defineProperty;var Ue=(e,t,n)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>(Ue(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),g=require("react"),f=require("./lodash-2us0VT8I.cjs"),L=require("@radix-ui/react-icons"),r=require("./index-d55M5MRz.cjs"),ne=require("react-i18next"),F=require("jotai"),ge=require("react-dom"),Q=require("./MODIFIERS-WFzDQfiT.cjs"),X=require("./index-Ge20J9Pa.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-Ckzuvu-s.cjs"),Ce=require("flagged"),Ke=require("@floating-ui/dom"),me=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Ve=require("@bobthered/tailwindcss-palette-generator"),Ze=require("react-wrap-balancer"),Qe=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const Xe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:i}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=ne.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
|
+
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:n("use_setting")}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
3
|
+
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const ye=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),ve=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(ye,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(ye,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(L.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(L.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:i,width:a,icon:c,onClick:d})=>{const{t:o}=ne.useTranslation();return s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>d(a),size:"sm",variant:i===n?"secondary":"ghost",children:c})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:o(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:o(t)})]})})})]})},nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,i]=r.useSelectedBreakpoints(),{t:a}=ne.useTranslation(),c=d=>{n.includes(d)?n.length>2&&i(n.filter(o=>o!==d)):i(o=>[...o,d])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[f.map(ve.filter(d=>f.includes(n,f.toUpper(d.breakpoint))),d=>g.createElement(tt,{...d,onClick:t,key:d.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(L.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:a("Breakpoints")}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),f.map(ve,d=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:d.breakpoint==="xs",onCheckedChange:()=>c(f.toUpper(d.breakpoint)),checked:f.includes(n,f.toUpper(d.breakpoint)),children:a(d.title)},d.breakpoint))]})]})]})},st=()=>{const{t:e}=ne.useTranslation(),[t]=r.useSetAllBlocks(),{createSnapshot:n}=r.useCanvasHistory(),[,i]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),c=g.useCallback(()=>{t([]),i([]),a([]),n()},[t,n]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(L.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:c,children:e("yes")})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(L.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[f.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Xe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
|
|
4
|
+
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
|
|
9
|
+
<style>
|
|
10
|
+
html { height: 100%; overflow:auto; }
|
|
11
|
+
body { height: 100%; }
|
|
12
|
+
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
+
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
+
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
+
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
+
html{
|
|
17
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
+
scrollbar-width: none; /* Firefox */
|
|
19
|
+
}
|
|
20
|
+
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
+
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
+
|
|
23
|
+
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
+
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
+
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
+
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
+
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
28
|
+
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
29
|
+
a{ pointer-events: none !important; }
|
|
30
|
+
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
31
|
+
[contenteditable="true"] {
|
|
32
|
+
outline: none;
|
|
33
|
+
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
34
|
+
-webkit-user-select: text;
|
|
35
|
+
-moz-user-select: text;
|
|
36
|
+
user-select: text;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
<style id="hidden-blocks"></style>
|
|
40
|
+
<style id="selected-block"></style>
|
|
41
|
+
<style id="selected-styling-block"></style>
|
|
42
|
+
<style id="highlighted-block"></style>
|
|
43
|
+
<style id="dragged-block"></style>
|
|
44
|
+
|
|
45
|
+
</head>
|
|
46
|
+
<body class="font-body antialiased h-full">
|
|
47
|
+
<div class="frame-root"></div>
|
|
48
|
+
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
49
|
+
</body>
|
|
50
|
+
</html>`,it=e=>{const[t]=r.useCanvasWidth(),[,n]=r.useCanvasZoom(),[i,a]=g.useState({}),c=g.useCallback(()=>{const{width:d,height:o}=e;if(d<t){const u=parseFloat((d/t).toFixed(2).toString());let x={};const h=o*u;o&&(x={height:100+(o-h)/h*100+"%"}),a({position:"relative",top:0,transform:`scale(${u})`,transformOrigin:"top left",...x,maxWidth:"none"}),n(u*100)}else a({}),n(100)},[t,e,n]);return g.useEffect(()=>{c()},[t,e,n,c]),i};var te={exports:{}};/*
|
|
51
|
+
object-assign
|
|
52
|
+
(c) Sindre Sorhus
|
|
53
|
+
@license MIT
|
|
54
|
+
*/var re,je;function at(){if(je)return re;je=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(c){if(c==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(c)}function a(){try{if(!Object.assign)return!1;var c=new String("abc");if(c[5]="de",Object.getOwnPropertyNames(c)[0]==="5")return!1;for(var d={},o=0;o<10;o++)d["_"+String.fromCharCode(o)]=o;var u=Object.getOwnPropertyNames(d).map(function(h){return d[h]});if(u.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return re=a()?Object.assign:function(c,d){for(var o,u=i(c),x,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var m in o)t.call(o,m)&&(u[m]=o[m]);if(e){x=e(o);for(var y=0;y<x.length;y++)n.call(o,x[y])&&(u[x[y]]=o[x[y]])}}return u},re}var oe,be;function fe(){if(be)return oe;be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oe=e,oe}var ie,Ee;function Te(){return Ee||(Ee=1,ie=Function.call.bind(Object.prototype.hasOwnProperty)),ie}var ae,ke;function lt(){if(ke)return ae;ke=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=fe(),n={},i=Te();e=function(c){var d="Warning: "+c;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}}}function a(c,d,o,u,x){if(process.env.NODE_ENV!=="production"){for(var h in c)if(i(c,h)){var m;try{if(typeof c[h]!="function"){var y=Error((u||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}m=c[h](d,h,u,o,null,t)}catch(q){m=q}if(m&&!(m instanceof Error)&&e((u||"React class")+": type specification of "+o+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var B=x?x():"";e("Failed "+o+" type: "+m.message+(B??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ae=a,ae}var le,Re;function ct(){if(Re)return le;Re=1;var e=X.reactIsExports,t=at(),n=fe(),i=Te(),a=lt(),c=function(){};process.env.NODE_ENV!=="production"&&(c=function(o){var u="Warning: "+o;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function d(){return null}return le=function(o,u){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function m(l){var p=l&&(x&&l[x]||l[h]);if(typeof p=="function")return p}var y="<<anonymous>>",B={array:D("array"),bigint:D("bigint"),bool:D("boolean"),func:D("function"),number:D("number"),object:D("object"),string:D("string"),symbol:D("symbol"),any:O(),arrayOf:w,element:H(),elementType:W(),instanceOf:_,node:Me(),objectOf:U,oneOf:$,oneOfType:Pe,shape:Le,exact:Ne};function q(l,p){return l===p?l!==0||1/l===1/p:l!==l&&p!==p}function k(l,p){this.message=l,this.data=p&&typeof p=="object"?p:{},this.stack=""}k.prototype=Error.prototype;function A(l){if(process.env.NODE_ENV!=="production")var p={},R=0;function b(S,j,E,C,I,T,N){if(C=C||y,T=T||E,N!==n){if(u){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+E;!p[J]&&R<3&&(c("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),p[J]=!0,R++)}}return j[E]==null?S?j[E]===null?new k("The "+I+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new k("The "+I+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:l(j,E,C,I,T)}var v=b.bind(null,!1);return v.isRequired=b.bind(null,!0),v}function D(l){function p(R,b,v,S,j,E){var C=R[b],I=z(C);if(I!==l){var T=V(C);return new k("Invalid "+S+" `"+j+"` of type "+("`"+T+"` supplied to `"+v+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return A(p)}function O(){return A(d)}function w(l){function p(R,b,v,S,j){if(typeof l!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside arrayOf.");var E=R[b];if(!Array.isArray(E)){var C=z(E);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an array."))}for(var I=0;I<E.length;I++){var T=l(E,I,v,S,j+"["+I+"]",n);if(T instanceof Error)return T}return null}return A(p)}function H(){function l(p,R,b,v,S){var j=p[R];if(!o(j)){var E=z(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement."))}return null}return A(l)}function W(){function l(p,R,b,v,S){var j=p[R];if(!e.isValidElementType(j)){var E=z(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement type."))}return null}return A(l)}function _(l){function p(R,b,v,S,j){if(!(R[b]instanceof l)){var E=l.name||y,C=We(R[b]);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected ")+("instance of `"+E+"`."))}return null}return A(p)}function $(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?c("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):c("Invalid argument supplied to oneOf, expected an array.")),d;function p(R,b,v,S,j){for(var E=R[b],C=0;C<l.length;C++)if(q(E,l[C]))return null;var I=JSON.stringify(l,function(N,P){var J=V(P);return J==="symbol"?String(P):P});return new k("Invalid "+S+" `"+j+"` of value `"+String(E)+"` "+("supplied to `"+v+"`, expected one of "+I+"."))}return A(p)}function U(l){function p(R,b,v,S,j){if(typeof l!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside objectOf.");var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an object."));for(var I in E)if(i(E,I)){var T=l(E,I,v,S,j+"."+I,n);if(T instanceof Error)return T}return null}return A(p)}function Pe(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&c("Invalid argument supplied to oneOfType, expected an instance of array."),d;for(var p=0;p<l.length;p++){var R=l[p];if(typeof R!="function")return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+He(R)+" at index "+p+"."),d}function b(v,S,j,E,C){for(var I=[],T=0;T<l.length;T++){var N=l[T],P=N(v,S,j,E,C,n);if(P==null)return null;P.data&&i(P.data,"expectedType")&&I.push(P.data.expectedType)}var J=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new k("Invalid "+E+" `"+C+"` supplied to "+("`"+j+"`"+J+"."))}return A(b)}function Me(){function l(p,R,b,v,S){return ee(p[R])?null:new k("Invalid "+v+" `"+S+"` supplied to "+("`"+b+"`, expected a ReactNode."))}return A(l)}function he(l,p,R,b,v){return new k((l||"React class")+": "+p+" type `"+R+"."+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+v+"`.")}function Le(l){function p(R,b,v,S,j){var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));for(var I in l){var T=l[I];if(typeof T!="function")return he(v,S,j,I,V(T));var N=T(E,I,v,S,j+"."+I,n);if(N)return N}return null}return A(p)}function Ne(l){function p(R,b,v,S,j){var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));var I=t({},R[b],l);for(var T in I){var N=l[T];if(i(l,T)&&typeof N!="function")return he(v,S,j,T,V(N));if(!N)return new k("Invalid "+S+" `"+j+"` key `"+T+"` supplied to `"+v+"`.\nBad object: "+JSON.stringify(R[b],null," ")+`
|
|
55
|
+
Valid keys: `+JSON.stringify(Object.keys(l),null," "));var P=N(E,T,v,S,j+"."+T,n);if(P)return P}return null}return A(p)}function ee(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(ee);if(l===null||o(l))return!0;var p=m(l);if(p){var R=p.call(l),b;if(p!==l.entries){for(;!(b=R.next()).done;)if(!ee(b.value))return!1}else for(;!(b=R.next()).done;){var v=b.value;if(v&&!ee(v[1]))return!1}}else return!1;return!0;default:return!1}}function Fe(l,p){return l==="symbol"?!0:p?p["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&p instanceof Symbol:!1}function z(l){var p=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":Fe(p,l)?"symbol":p}function V(l){if(typeof l>"u"||l===null)return""+l;var p=z(l);if(p==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return p}function He(l){var p=V(l);switch(p){case"array":case"object":return"an "+p;case"boolean":case"date":case"regexp":return"a "+p;default:return p}}function We(l){return!l.constructor||!l.constructor.name?y:l.constructor.name}return B.checkPropTypes=a,B.resetWarningCache=a.resetWarningCache,B.PropTypes=B,B},le}var ce,we;function dt(){if(we)return ce;we=1;var e=fe();function t(){}function n(){}return n.resetWarningCache=t,ce=function(){function i(d,o,u,x,h,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}i.isRequired=i;function a(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},ce}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=X.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const M=Q.getDefaultExportFromCjs(ft);let Ie,Be;typeof document<"u"&&(Ie=document);typeof window<"u"&&(Be=window);const Ae=g.createContext({document:Ie,window:Be}),se=()=>g.useContext(Ae),{Provider:xt,Consumer:$t}=Ae;class De extends g.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return g.Children.only(this.props.children)}}K(De,"propTypes",{children:M.element.isRequired,contentDidMount:M.func.isRequired,contentDidUpdate:M.func.isRequired});class ue extends g.Component{constructor(n,i){super(n,i);K(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:i}=this.props;typeof i=="function"?i(n):i&&(i.current=n)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=g.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const i=this.props.contentDidMount,a=this.props.contentDidUpdate,c=n.defaultView||n.parentView,d=s.jsxRuntimeExports.jsx(De,{contentDidMount:i,contentDidUpdate:a,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:c},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[ge.createPortal(this.props.head,this.getDoc().head),ge.createPortal(d,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(ue,"propTypes",{style:M.object,head:M.node,initialContent:M.string,mountTarget:M.string,contentDidMount:M.func,contentDidUpdate:M.func,children:M.oneOfType([M.element,M.arrayOf(M.element)])}),K(ue,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const ht=g.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(ue,{...e,forwardedRef:t}));let Y=null,G=[],Z=null,_e=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),i=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),c=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:i,paddingRight:a,paddingBottom:c}}const Se=(e,t,n)=>{if(!Y)return;const i=e.getBoundingClientRect(),a=Y==null?void 0:Y.getElementById("placeholder"),{paddingLeft:c,paddingTop:d,paddingRight:o,paddingBottom:u}=gt(e);a.style.width=t==="vertical"?i.width-c-o+"px":"2px",a.style.height=t==="vertical"?"2px":i.height-d-u+"px",a.style.display="block";const x=G.reduce((h,m)=>Math.abs(m-n)<Math.abs(h-n)?m:h);_e=G.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+c+"px"):(a.style.top=e.offsetTop+d+"px",a.style.left=e.offsetLeft+x+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),i=t==="horizontal",a=parseInt(n.paddingLeft),c=parseInt(n.paddingTop);let d=i?a:c;G=[d],Array.from(e.children).forEach(o=>{const u=window.getComputedStyle(o),x=parseInt(i?u.marginLeft+u.marginRight:u.marginTop+u.marginBottom),h=i?o.offsetWidth:o.offsetHeight;G.push(d+h+x),d+=h+x})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const i=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(i.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=f.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const i=e.clientY-t.offsetTop;Se(t,n,i)}else{const i=e.clientX-t.offsetLeft;Se(t,n,i)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function de(){const e=Y==null?void 0:Y.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=se(),[t,n]=F.useAtom(r.draggingFlagAtom),i=Ye.useAddBlockByDrop(),a=Ce.useFeature("dnd"),[,c]=r.useHighlightBlockId(),[,d]=r.useSelectedBlockIds();return Y=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?vt:f.noop,onDrop:a?o=>{Z==null||Z.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const u=JSON.parse(o.dataTransfer.getData("text/plain"));let x=o.target.getAttribute("data-block-id");x===null&&(x=o.target.parentElement.getAttribute("data-block-id")),i({block:u,dropTargetId:x||null,relativeIndex:_e}),n(!1),de(),setTimeout(()=>{de()},300)}:f.noop,onDragEnter:a?o=>{const u=o;Z=u.target,u.stopPropagation(),u.preventDefault(),G=[];const x=u.target;mt(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),c(""),d([])}:f.noop,onDragLeave:a?o=>{const u=o;Z=null,u.stopPropagation(),u.preventDefault(),u.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:f.noop,onMouseOut:a?()=>{n(!1),de()}:f.noop}};function xe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useHighlightBlockId(),[i,a]=F.useAtom(r.inlineEditingActiveAtom);return c=>{var m;if(i)return;const d=xe(c.target),o=d.getAttribute("data-block-type");if(!o||!e.includes(o))return;const u=d.cloneNode(!0);d.style.display="none",Array.from(u.attributes).forEach(y=>{y.name!=="class"&&u.removeAttribute(y.name)}),o==="Text"&&(u.style.display="inline-block"),d.parentNode.insertBefore(u,d.nextSibling);const x=new ze.Quill(u,{placeholder:"Type here..."});function h(){const y=x.getText(0,x.getLength());t([d.getAttribute("data-block-id")],{content:y}),d.removeAttribute("style"),u.removeEventListener("blur",h,!0),bt(x),a(""),n("")}u.addEventListener("blur",h,!0),x.focus(),(m=u.querySelector(".ql-clipboard"))==null||m.remove(),a(d.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=F.useAtom(r.inlineEditingActiveAtom);return i=>{if(n)return;i.stopPropagation();const a=xe(i.target);if(a!=null&&a.getAttribute("data-block-parent")){const c=a.getAttribute("data-style-prop"),d=a.getAttribute("data-style-id"),o=a.getAttribute("data-block-parent");e([{id:d,prop:c,blockId:o}]),t([o])}else a!=null&&a.getAttribute("data-block-id")&&t([a.getAttribute("data-block-id")])}},Rt=f.throttle((e,t)=>{const n=xe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),wt=()=>{const[,e]=r.useHighlightBlockId(),[t]=F.useAtom(r.inlineEditingActiveAtom);return n=>{t||Rt(n,e)}},St=({children:e})=>{const{document:t}=se(),[n]=r.useSelectedBlockIds(),[i,a]=r.useSelectedStylingBlocks();g.useEffect(()=>{setTimeout(()=>{if(!f.isEmpty(i))return;const x=qe(t,f.head(n));if(x){const h=x.getAttribute("data-style-prop");if(h){const m=x.getAttribute("data-style-id"),y=x.getAttribute("data-block-parent");a([{id:m,prop:h,blockId:y}])}}},100)},[t,n,a,i]);const c=Et(),d=kt(),o=wt(),u=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:d,onDoubleClick:c,onMouseMove:o,...f.omit(u,"isDragging"),className:"relative mb-5 max-w-full "+(u.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=se(),[t,n]=r.useSelectedBlockIds(),i=r.useAllBlocks(),[,a]=r.useSelectedStylingBlocks(),{undo:c,redo:d}=r.useCanvasHistory(),o=r.useDuplicateBlocks(),[,u]=r.useCutBlockIds(),[,x]=r.useCopyBlockIds(),{pasteBlocks:h}=r.usePasteBlocks(),[,m]=r.usePreviewMode(),y=r.useRemoveBlocks(),{savePage:B}=r.useSavePage(),[q]=F.useAtom(r.inlineEditingActiveAtom),[,k]=F.useAtom(r.editLayerNameAtom),A=O=>{O.key==="Enter"&&(O.preventDefault(),t.length===1&&k(f.head(t)))},D=O=>{const w=i.find(H=>H._id===O);return w?w._parent:null};return g.useEffect(()=>{const O=w=>{if(w.key==="Escape"){n([]),a([]);return}if(A(w),!q&&(w.key==="Delete"||w.key==="Backspace")&&(w.preventDefault(),y(t)),w.ctrlKey||w.metaKey){if(w.key==="ArrowUp"){w.preventDefault();const H=t.length>0?D(t[0]):null;H&&n([H])}if(["z","y","d","x","c","p","s","v"].includes(w.key)){if(q&&["x","z","v"].includes(w.key))return!0;w.preventDefault()}w.key==="s"&&(w.stopPropagation(),w.preventDefault(),B()),w.key==="z"&&c(),w.key==="y"&&d(),w.key==="d"&&o(t),w.key==="x"&&u(t),w.key==="c"&&x(t),w.key==="v"&&t.length>0&&h(t[0])}};return e.removeEventListener("keydown",O),e.addEventListener("keydown",O),()=>{e.removeEventListener("keydown",O)}},[t,n,c,y,m,d,o,u,x,h,q,B,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,i]=r.useHighlightBlockId(),[,a]=F.useAtom(r.draggedBlockIdAtom),c=Ce.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:c?"true":"false",onDragStart:d=>{d.dataTransfer.setData("text/plain",JSON.stringify(f.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{n([]),i(null)},200)},children:[s.jsxRuntimeExports.jsx(L.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),i=r.useDuplicateBlocks(),[,a]=r.useSelectedBlockIds(),[,c]=r.useSelectedStylingBlocks(),[d]=F.useAtom(r.inlineEditingActiveAtom),{floatingStyles:o,refs:u,update:x}=me.useFloating({placement:"top-start",middleware:[me.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>x(),e!==null);const h=f.get(t,"_parent",null),m=f.isEmpty(f.get(t,"_name",""))?f.get(t,"_type",""):f.get(t,"_name","");return!e||!t||d?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:u.setFloating,style:o,onClick:y=>{y.stopPropagation(),y.preventDefault()},onKeyDown:y=>y.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:m,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[h&&s.jsxRuntimeExports.jsx(L.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{c([]),a([h])}}),r.canDuplicateBlock(f.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.CopyIcon,{className:"hover:scale-105 ",onClick:()=>i([t==null?void 0:t._id])}):null,r.canDeleteBlock(f.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[i]=r.useDarkMode(),[a]=r.useHighlightBlockId(),[c]=r.useSelectedStylingBlocks(),[d]=F.useAtom(r.draggedBlockIdAtom),{document:o,window:u}=se(),[x]=g.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=g.useState(o==null?void 0:o.getElementById("selected-block")),[m]=g.useState(o==null?void 0:o.getElementById("selected-styling-block")),[y]=g.useState(o==null?void 0:o.getElementById("dragged-block"));g.useEffect(()=>{i?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[i,o]);const B=f.get(t,"headingFont","DM Sans"),q=f.get(t,"bodyFont","DM Sans");return g.useEffect(()=>{const k=f.get(t,"primaryColor","#000"),A=f.get(t,"secondaryColor","#FFF"),D=Ve.tailwindcssPaletteGenerator({colors:[k,A],names:["primary","secondary"]});D.primary.DEFAULT=k,D.secondary.DEFAULT=A;const O=f.get(t,"roundedCorners","0");!u||!u.tailwind||(u.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[B],body:[q]},extend:{borderRadius:{global:`${O||"0"}px`},colors:D}},plugins:[u.tailwind.plugin.withOptions(({prefix:w="ui"}={})=>({addVariant:H})=>{for(const W of["open","checked","selected","active","disabled"])H(`${w}-${W}`,[`&[data-headlessui-state~="${W}"]`,`:where([data-headlessui-state~="${W}"]) &`]),H(`${w}-not-${W}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${W}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${W}"])) &:not([data-headlessui-state])`])})]})},[t,u,B,q]),g.useEffect(()=>{h&&(h.textContent=`${f.map(n,k=>`[data-block-id="${k}"]`).join(",")}{
|
|
56
|
+
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
57
|
+
}`)},[n,h]),g.useEffect(()=>{if(!d){y.textContent="";return}y.textContent=`[data-block-id="${d}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[d]),g.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,n,x]),g.useEffect(()=>{m&&(m.textContent=`${f.map(c,({id:k})=>`[data-style-id="${k}"]`).join(",")}{
|
|
58
|
+
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
59
|
+
}`)},[c,m]),g.useEffect(()=>{const k=f.get(t,"bodyTextLightColor","#64748b"),A=f.get(t,"bodyTextDarkColor","#94a3b8"),D=f.get(t,"bodyBgLightColor","#FFFFFF"),O=f.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${k}] bg-[${D}] dark:text-[${A}] dark:bg-[${O}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[B&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${B.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),q&&B!==q&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${q.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),B&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${B}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{f.isString(e[n])&&e[n].startsWith(Q.SLOT_KEY)&&(t[n]=e[n].replace(Q.SLOT_KEY,"").split(","))}),t},Dt=f.memoize(e=>{const t=e.replace(Q.STYLES_KEY,"").split(",");return Qe.twMerge(t[0],t[1])});function _t(e,t){return f.get(e,`${t}_attrs`,{})}function Ot(e){const t={};return Object.keys(e).forEach(n=>{if(f.isString(e[n])&&e[n].startsWith(Q.STYLES_KEY)){const i=Dt(e[n]);t[n]={className:i,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,..._t(e,n)}}}),t}function qt(e,t){const n=f.get(e,"_bindings",{});return f.isEmpty(n)?{...e}:(f.forEach(n,(i,a)=>{f.isString(i)&&f.get(t,i,null)&&(e[a]=f.get(t,i,null))}),e)}function pe({blocks:e}){const t=r.useAllBlocks(),n=g.useCallback(c=>Ot(c),[]),[i]=X.useChaiExternalData(),[a]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((c,d)=>{if(a===c._id)return null;const o=At(c),u={};f.isEmpty(o)||Object.keys(o).forEach(y=>{u[y]=g.Children.toArray(o[y].map(B=>s.jsxRuntimeExports.jsx(pe,{blocks:[f.find(t,{_id:B})]})))});const x=f.filter(t,{_parent:c._id});u.children=x.length?s.jsxRuntimeExports.jsx(pe,{blocks:x}):null;const h=Ge.getBlockComponent(c._type),m=f.get(h,"component",null);return f.isNull(m)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${c==null?void 0:c._type} not registered -->`}):s.jsxRuntimeExports.jsx(g.Suspense,{children:g.createElement(m,{blockProps:{"data-block-id":c._id,"data-block-type":c._type,"data-dnd":r.canAddChildBlock(c._type)?"branch":"leaf"},inBuilder:!0,index:d,...qt(c,i),...n(c),...u})})}))})}const Pt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ze.Provider,{children:f.isEmpty(e)?null:s.jsxRuntimeExports.jsx(X.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(pe,{blocks:f.filter(e,t=>f.isEmpty(t._parent))})})})},Mt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Lt=()=>{const[e]=F.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,i]=r.useSelectedBlockIds(),a=r.useSelectedBlock(),[,c]=r.useHighlightBlockId(),d=g.useRef(null),o=g.useRef(null),[u,x]=g.useState({width:0,height:0}),h=it(u),[m,y]=g.useState(0),[B,q]=g.useState([]),[,k]=g.useState([]),[,A]=F.useAtom(r.canvasIframeAtom),[D,O]=r.useSelectedStylingBlocks(),w=r.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:_,clientHeight:$}=o.current;x({width:_,height:$}),m===0&&y(_)},[o,n,m]);const H=(_,$=0)=>{const{top:U}=_.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};g.useEffect(()=>{var _,$;if(a&&a.type!=="Multiple"&&d.current){const U=qe(d.current.contentDocument,a._id);U&&(H(U)||($=(_=d.current)==null?void 0:_.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),q([U]))}},[a]),g.useEffect(()=>{if(!f.isEmpty(D)&&d.current){const _=Mt(d.current.contentDocument,f.head(D).id);k(_?[_]:[null])}else k([null])},[D]);const W=g.useMemo(()=>{let _=ot;return e==="offline"&&(_=_.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),_=_.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),_=_.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),_},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),O([])},onMouseLeave:()=>setTimeout(()=>c(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:m>0&&!f.isEmpty(h)?{width:t?"100%":m}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(d.current),ref:d,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:W,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:a,selectedBlockElement:f.head(B)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:w?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Pt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-jqRRefXj.cjs"))),Ft=()=>{const[e,t]=F.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[s.jsxRuntimeExports.jsx(g.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(X.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Lt,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
|