@chaibuilder/sdk 1.2.64 → 1.2.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/CanvasArea-fSdH_RiN.cjs +1 -0
  2. package/dist/{CanvasArea-kB6ky_uL.js → CanvasArea-ut5yknzX.js} +58 -54
  3. package/dist/{CodeEditor-37od44Ou.js → CodeEditor-Qff4q7sx.js} +1 -1
  4. package/dist/{CurrentPage-bHq9Uusr.js → CurrentPage-jHSVy3hq.js} +38 -26
  5. package/dist/CurrentPage-p_AM4lrF.cjs +1 -0
  6. package/dist/{PagesPanel-wIPAyjJK.js → PagesPanel-U3InJ9Db.js} +20 -8
  7. package/dist/PagesPanel-wqDb4D-x.cjs +1 -0
  8. package/dist/{ProjectPanel-L-SlDizV.js → ProjectPanel-XODJTO4J.js} +36 -24
  9. package/dist/ProjectPanel-fWESzHr6.cjs +1 -0
  10. package/dist/{SidePanels-UQj0XTnb.js → SidePanels-ijaUKSek.js} +96 -82
  11. package/dist/SidePanels-lrMQqc0h.cjs +1 -0
  12. package/dist/Topbar-RrCDxd0i.cjs +1 -0
  13. package/dist/{Topbar-1O05wogM.js → Topbar-vHlnfxPs.js} +45 -30
  14. package/dist/UILibrariesPanel-7btHgBD0.cjs +1 -0
  15. package/dist/{UILibrariesPanel-vshiYI6G.js → UILibrariesPanel-NVUMUPUj.js} +85 -65
  16. package/dist/{UnsplashImages-Eq7hprBO.js → UnsplashImages-UkHihhA5.js} +18 -18
  17. package/dist/{UploadImages-lco2Tea3.js → UploadImages-HtuJZJlo.js} +1 -1
  18. package/dist/add-page-modal-RwIj1FxH.cjs +1 -0
  19. package/dist/{add-page-modal-qr7rvJzN.js → add-page-modal-TOfMfmPA.js} +33 -24
  20. package/dist/{confirm-alert-P6TAevaP.js → confirm-alert-eIp2cAkc.js} +1 -1
  21. package/dist/core.cjs +1 -1
  22. package/dist/core.d.ts +7 -8
  23. package/dist/core.js +74 -59
  24. package/dist/{delete-page-modal-55oioI9i.js → delete-page-modal-4bxjpVBD.js} +33 -21
  25. package/dist/delete-page-modal-qYDZmpgT.cjs +1 -0
  26. package/dist/email.cjs +1 -1
  27. package/dist/email.js +20 -5
  28. package/dist/{form-5ke_lZv8.js → form-NAzFjGs0.js} +9 -9
  29. package/dist/html-to-json-NqRjgFqp.cjs +1 -0
  30. package/dist/html-to-json-l_mw5y-e.js +243 -0
  31. package/dist/{index-6w-6HYBd.cjs → index--k2M8kzI.cjs} +1 -1
  32. package/dist/{index-audsIPBC.cjs → index-5XyNUAjc.cjs} +81 -22
  33. package/dist/{index-b33n_-zO.js → index-C7mB4XFm.js} +117 -117
  34. package/dist/{index-fnkMn4Pk.js → index-YZhtVcj_.js} +4 -4
  35. package/dist/{index-wRAIA8zZ.js → index-lFgDm1oa.js} +48587 -45055
  36. package/dist/lib.cjs +2 -2
  37. package/dist/lib.js +22 -22
  38. package/dist/page-viewer-4wrnWnK0.js +124 -0
  39. package/dist/page-viewer-ra0GLx1p.cjs +1 -0
  40. package/dist/{project-general-setting-NEkNjf7V.js → project-general-setting-IwZUkYF3.js} +18 -9
  41. package/dist/project-general-setting-lFjTUhHD.cjs +1 -0
  42. package/dist/{project-seo-setting-YmspOYsF.js → project-seo-setting-e1fTqVsd.js} +2 -2
  43. package/dist/{single-page-detail-jHzoDP7B.js → single-page-detail-ZNWFKqLW.js} +64 -55
  44. package/dist/single-page-detail-g55Anu7R.cjs +1 -0
  45. package/dist/studio.cjs +1 -1
  46. package/dist/studio.js +18 -6
  47. package/dist/style.css +2 -2
  48. package/dist/ui.js +67 -67
  49. package/package.json +1 -1
  50. package/dist/AddBlocks-6dJmFSgk.js +0 -142
  51. package/dist/AddBlocks-doCNVVbk.cjs +0 -1
  52. package/dist/CanvasArea-kdnkFfKR.cjs +0 -1
  53. package/dist/CurrentPage-Ekl5Cwbv.cjs +0 -1
  54. package/dist/PagesPanel-SMHrEmCb.cjs +0 -1
  55. package/dist/ProjectPanel-YruLal65.cjs +0 -1
  56. package/dist/Settings-WXkCyhAv.js +0 -2380
  57. package/dist/Settings-_5VHcgFC.cjs +0 -1
  58. package/dist/SidePanels-UeIZB3e1.cjs +0 -1
  59. package/dist/StaticCanvas-7C52tXAv.js +0 -749
  60. package/dist/StaticCanvas-ll9VTXI5.cjs +0 -60
  61. package/dist/ThemeConfigPanel-_86vVxLz.cjs +0 -1
  62. package/dist/ThemeConfigPanel-gw8B2zvx.js +0 -194
  63. package/dist/Topbar-gb17oHdJ.cjs +0 -1
  64. package/dist/UILibrariesPanel-03Y3F3A_.cjs +0 -1
  65. package/dist/add-page-modal-rOKavDFX.cjs +0 -1
  66. package/dist/atoms-KQpaDRnF.cjs +0 -1
  67. package/dist/atoms-Oomqut88.js +0 -6
  68. package/dist/delete-page-modal-wdAiMVnL.cjs +0 -1
  69. package/dist/html-to-json-_01DXd-a.js +0 -192
  70. package/dist/html-to-json-ndxaXRT8.cjs +0 -1
  71. package/dist/index-e0c8PmRQ.js +0 -205
  72. package/dist/index-gi1LIOCw.cjs +0 -1
  73. package/dist/page-viewer-t44DP65U.js +0 -112
  74. package/dist/page-viewer-wU7T0f48.cjs +0 -1
  75. package/dist/plugin-2hf9pCRy.cjs +0 -1
  76. package/dist/plugin-wDnsBVPp.js +0 -54
  77. package/dist/project-general-setting-87cX9vvO.cjs +0 -1
  78. package/dist/single-page-detail-27UjWK8L.cjs +0 -1
@@ -1,749 +0,0 @@
1
- var kt = Object.defineProperty;
2
- var wt = (n, e, t) => e in n ? kt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var M = (n, e, t) => (wt(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { j as d } from "./jsx-runtime-WbnYoNE9.js";
5
- import L, { useState as A, useCallback as Y, useEffect as S, Component as ct, Children as Ct, Suspense as St, useRef as et, useMemo as It } from "react";
6
- import { throttle as dt, has as N, isEmpty as T, first as V, omit as pt, pick as Bt, get as f, map as nt, isString as J, memoize as _t, each as At, find as Dt, filter as ut, isNull as Tt } from "lodash-es";
7
- import { useAtom as v } from "jotai";
8
- import { J as Q, as as Et, bC as jt, aq as Mt, aA as E, j as F, D as Lt, y as Ft, bD as O, z as $, E as Rt, k as Ht, n as Pt, p as Ot, m as $t, aj as Nt, ax as qt, bE as Wt, i as gt, b7 as Ut, t as zt, bF as Kt, _ as Yt, l as Vt, s as Gt, h as ot, $ as Xt } from "./index-b33n_-zO.js";
9
- import st from "react-dom";
10
- import k from "prop-types";
11
- import { Quill as Jt } from "react-quill";
12
- import { d as q, a as mt } from "./atoms-Oomqut88.js";
13
- import { d as Qt, u as Zt, e as te } from "./index-wRAIA8zZ.js";
14
- import { flip as ee } from "@floating-ui/dom";
15
- import { useFloating as ne, shift as oe } from "@floating-ui/react-dom";
16
- import { DragHandleDots2Icon as se, ArrowUpIcon as ie, CopyIcon as re, TrashIcon as le } from "@radix-ui/react-icons";
17
- import { useResizeObserver as ae } from "@react-hookz/web";
18
- import { useFeature as ce } from "flagged";
19
- import de from "@tailwindcss/typography";
20
- import pe from "@tailwindcss/forms";
21
- import ue from "@tailwindcss/aspect-ratio";
22
- import ge from "tailwindcss-palette-generator";
23
- import { p as me } from "./plugin-wDnsBVPp.js";
24
- import { twMerge as fe } from "tailwind-merge";
25
- import { S as it, a as ft } from "./MODIFIERS-fd5XOmum.js";
26
- import { getBlockComponent as he } from "@chaibuilder/runtime";
27
- import { includes as rt } from "lodash";
28
- import { Provider as ye } from "react-wrap-balancer";
29
- import "./_commonjsHelpers-UyOWmZb0.js";
30
- import "@radix-ui/react-toggle";
31
- import "class-variance-authority";
32
- import "./utils-VpVqnC9m.js";
33
- import "clsx";
34
- import "@radix-ui/react-switch";
35
- import "@radix-ui/react-slot";
36
- import "@radix-ui/react-accordion";
37
- import "@radix-ui/react-alert-dialog";
38
- import "@radix-ui/react-dialog";
39
- import "@radix-ui/react-label";
40
- import "@radix-ui/react-scroll-area";
41
- import "@radix-ui/react-tabs";
42
- import "@radix-ui/react-tooltip";
43
- import "@radix-ui/react-popover";
44
- import "@radix-ui/react-menubar";
45
- import "@radix-ui/react-hover-card";
46
- import "@radix-ui/react-select";
47
- import "@radix-ui/react-dropdown-menu";
48
- import "@radix-ui/react-separator";
49
- import "@radix-ui/react-toast";
50
- import "cmdk";
51
- import "@radix-ui/react-context-menu";
52
- import "react-icons-picker";
53
- import "./Functions-7jnEwJyw.js";
54
- import "tree-model";
55
- import "react-i18next";
56
- import "i18next";
57
- import "react-arborist";
58
- import "lucide-react";
59
- import "./index-VBXQixVm.js";
60
- import "react-hotkeys-hook";
61
- const xe = `<!doctype html>
62
- <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
63
- <head>
64
- <meta charset="UTF-8">
65
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
66
- <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
67
- <style>
68
- html { height: 100%; overflow:auto; }
69
- body { height: 100%; }
70
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
71
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
72
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
73
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
74
- html{
75
- -ms-overflow-style: none; /* IE and Edge */
76
- scrollbar-width: none; /* Firefox */
77
- }
78
- /** IMPORTANT: Make fields content editable in SAFARI */
79
- [contenteditable] {-webkit-user-select: text;user-select: text;}
80
-
81
- html::-webkit-scrollbar { width: 0 !important }
82
- .aspect-auto{aspect-ratio: auto;}
83
- .aspect-square{aspect-ratio: 1/1;}
84
- .aspect-video{aspect-ratio: 16/9;}
85
- .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
86
- .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
87
- a{ pointer-events: none !important; }
88
- [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
89
- [contenteditable="true"] {
90
- outline: none;
91
- box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
92
- -webkit-user-select: text;
93
- -moz-user-select: text;
94
- user-select: text;
95
- }
96
- .frame-root .frame-content { height: 100%; }
97
- [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
98
- [data-dnd="yes"] { pointer-events: auto !important}
99
- [data-dnd="no"] { pointer-events: none !important; }
100
- [data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
101
- [data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
102
- [force-show] { display: block !important; }
103
- </style>
104
- <style id="hidden-blocks"></style>
105
- <style id="selected-block"></style>
106
- <style id="selected-styling-block"></style>
107
- <style id="highlighted-block"></style>
108
- <style id="dragged-block"></style>
109
- <style id="drop-target-block"></style>
110
-
111
- </head>
112
- <body class="font-body antialiased h-full">
113
- <div class="frame-root h-full"></div>
114
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
115
- </body>
116
- </html>`, be = (n) => {
117
- const [e] = Q(), [, t] = Et(), [o, l] = A({}), c = Y(() => {
118
- const { width: r, height: i } = n;
119
- if (r < e) {
120
- const s = parseFloat((r / e).toFixed(2).toString());
121
- let u = {};
122
- const a = i * s;
123
- i && (u = {
124
- // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
125
- height: 100 + (i - a) / a * 100 + "%"
126
- }), l({
127
- position: "relative",
128
- top: 0,
129
- transform: `scale(${s})`,
130
- transformOrigin: "top left",
131
- ...u,
132
- maxWidth: "none"
133
- }), t(s * 100);
134
- } else
135
- l({}), t(100);
136
- }, [e, n, t]);
137
- return S(() => {
138
- c();
139
- }, [e, n, t, c]), o;
140
- };
141
- let ht, yt;
142
- typeof document < "u" && (ht = document);
143
- typeof window < "u" && (yt = window);
144
- const xt = L.createContext({ document: ht, window: yt }), W = () => L.useContext(xt), { Provider: ve, Consumer: Qn } = xt;
145
- class bt extends ct {
146
- componentDidMount() {
147
- this.props.contentDidMount();
148
- }
149
- componentDidUpdate() {
150
- this.props.contentDidUpdate();
151
- }
152
- render() {
153
- return Ct.only(this.props.children);
154
- }
155
- }
156
- M(bt, "propTypes", {
157
- children: k.element.isRequired,
158
- contentDidMount: k.func.isRequired,
159
- contentDidUpdate: k.func.isRequired
160
- });
161
- class G extends ct {
162
- constructor(t, o) {
163
- super(t, o);
164
- M(this, "setRef", (t) => {
165
- this.nodeRef.current = t;
166
- const { forwardedRef: o } = this.props;
167
- typeof o == "function" ? o(t) : o && (o.current = t);
168
- });
169
- M(this, "handleLoad", () => {
170
- clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
171
- });
172
- // In certain situations on a cold cache DOMContentLoaded never gets called
173
- // fallback to an interval to check if that's the case
174
- M(this, "loadCheck", () => setInterval(() => {
175
- this.handleLoad();
176
- }, 500));
177
- this._isMounted = !1, this.nodeRef = L.createRef(), this.state = { iframeLoaded: !1 };
178
- }
179
- componentDidMount() {
180
- this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
181
- }
182
- componentWillUnmount() {
183
- this._isMounted = !1, this.nodeRef.current.removeEventListener("DOMContentLoaded", this.handleLoad);
184
- }
185
- getDoc() {
186
- return this.nodeRef.current ? this.nodeRef.current.contentDocument : null;
187
- }
188
- getMountTarget() {
189
- const t = this.getDoc();
190
- return this.props.mountTarget ? t.querySelector(this.props.mountTarget) : t.body.children[0];
191
- }
192
- renderFrameContents() {
193
- if (!this._isMounted)
194
- return null;
195
- const t = this.getDoc();
196
- if (!t)
197
- return null;
198
- const o = this.props.contentDidMount, l = this.props.contentDidUpdate, c = t.defaultView || t.parentView, r = /* @__PURE__ */ d.jsx(bt, { contentDidMount: o, contentDidUpdate: l, children: /* @__PURE__ */ d.jsx(ve, { value: { document: t, window: c }, children: /* @__PURE__ */ d.jsx("div", { className: "frame-content", children: this.props.children }) }) }), i = this.getMountTarget();
199
- return [st.createPortal(this.props.head, this.getDoc().head), st.createPortal(r, i)];
200
- }
201
- render() {
202
- const t = {
203
- ...this.props,
204
- srcDoc: this.props.initialContent,
205
- children: void 0
206
- // The iframe isn't ready so we drop children from props here. #12, #17
207
- };
208
- return delete t.head, delete t.initialContent, delete t.mountTarget, delete t.contentDidMount, delete t.contentDidUpdate, delete t.forwardedRef, /* @__PURE__ */ d.jsx("iframe", { ...t, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
209
- }
210
- }
211
- // React warns when you render directly into the body since browser extensions
212
- // also inject into the body and can mess up React. For this reason
213
- // initialContent is expected to have a div inside of the body
214
- // element that we render react into.
215
- M(G, "propTypes", {
216
- style: k.object,
217
- // eslint-disable-line
218
- head: k.node,
219
- initialContent: k.string,
220
- mountTarget: k.string,
221
- className: k.string,
222
- contentDidMount: k.func,
223
- contentDidUpdate: k.func,
224
- children: k.oneOfType([k.element, k.arrayOf(k.element)])
225
- }), M(G, "defaultProps", {
226
- style: {},
227
- head: null,
228
- children: void 0,
229
- mountTarget: void 0,
230
- contentDidMount: () => {
231
- },
232
- contentDidUpdate: () => {
233
- },
234
- initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
235
- });
236
- const ke = L.forwardRef((n, e) => /* @__PURE__ */ d.jsx(G, { ...n, forwardedRef: e }));
237
- function Z(n) {
238
- const e = window.getComputedStyle(n), t = e.display;
239
- if (t === "flex" || t === "inline-flex") {
240
- const o = e.flexDirection;
241
- return o === "column" || o === "column-reverse" ? "vertical" : "horizontal";
242
- } else if (t === "grid") {
243
- const o = e.gridAutoFlow, l = e.gridTemplateRows, c = e.gridTemplateColumns;
244
- return o.includes("column") || l.split(" ").length > c.split(" ").length ? "vertical" : "horizontal";
245
- } else if (t === "block" || t === "inline-block")
246
- return "vertical";
247
- return "horizontal";
248
- }
249
- let x = null, B = [], lt = null, z = null;
250
- const at = (n, e, t) => {
251
- if (!x || !n)
252
- return;
253
- const o = x == null ? void 0 : x.getElementById("placeholder"), l = B.map(([s]) => s), c = l.reduce(
254
- (s, u) => Math.abs(u - t) < Math.abs(s - t) ? u : s,
255
- 0
256
- ), r = l.indexOf(c);
257
- if (!B[r])
258
- return;
259
- const i = B[r];
260
- o.style.width = e === "vertical" ? i[2] + "px" : "2px", o.style.height = e === "vertical" ? "2px" : i[2] + "px", o.style.display = "block", e === "vertical" ? (o.style.top = i[0] + "px", o.style.left = i[1] + "px") : (o.style.top = i[1] + "px", o.style.left = i[0] + "px");
261
- };
262
- function we(n, e) {
263
- let t = 0, o = 1 / 0;
264
- return e.forEach((l, c) => {
265
- const r = Math.abs(l[0] - n);
266
- r < o && (o = r, t = c);
267
- }), t;
268
- }
269
- const Ce = (n) => {
270
- const t = Z(n) === "horizontal";
271
- B = [], Array.from(n.children).forEach((o, l) => {
272
- if (o.classList.contains("pointer-events-none"))
273
- return;
274
- const c = t ? o.offsetLeft : o.offsetTop, r = t ? [o.offsetTop, o.clientHeight] : [o.offsetLeft, o.clientWidth];
275
- if (B.push([c, r[0], r[1]]), l === n.children.length - 1) {
276
- const i = t ? o.offsetLeft + o.clientWidth : o.offsetTop + o.clientHeight;
277
- B.push([i, r[0], r[1]]);
278
- }
279
- });
280
- }, Se = dt((n) => {
281
- var l;
282
- const e = n.target, t = Z(e), o = (l = x == null ? void 0 : x.defaultView) == null ? void 0 : l.scrollY;
283
- t === "vertical" ? at(e, t, n.clientY + o) : at(e, t, n.clientX);
284
- }, 0);
285
- function K() {
286
- const n = x == null ? void 0 : x.getElementById("placeholder");
287
- n.style.display = "none", Ie("pointer-none"), Be();
288
- }
289
- function Ie(n) {
290
- (x == null ? void 0 : x.querySelectorAll(`.${n}`)).forEach((t) => {
291
- t.classList.remove(n);
292
- });
293
- }
294
- function Be() {
295
- const n = x == null ? void 0 : x.querySelector('[data-drop="yes"]');
296
- n && n.removeAttribute("data-drop");
297
- }
298
- const _e = () => {
299
- const { document: n } = W(), [e, t] = v(jt), { addCoreBlock: o } = Mt(), [, l] = E(), [, c] = F(), { moveBlocks: r } = Lt(), [i, s] = v(q), [, u] = v(mt), a = () => {
300
- K(), t(!1), c([i._id]), s(null), u(null), B = [];
301
- };
302
- return x = n, {
303
- isDragging: e,
304
- onDragOver: (g) => {
305
- g.preventDefault(), g.stopPropagation(), Se(g);
306
- },
307
- onDrop: (g) => {
308
- var D;
309
- const p = lt, b = Z(p) === "vertical" ? g.clientY + ((D = x == null ? void 0 : x.defaultView) == null ? void 0 : D.scrollY) : g.clientX;
310
- z = we(b, B);
311
- const m = i, w = p.getAttribute("data-block-id");
312
- if (!N(m, "_id")) {
313
- o(m, w === "canvas" ? null : w, z), setTimeout(a, 300);
314
- return;
315
- }
316
- let C = p.getAttribute("data-block-id");
317
- C === null && (C = g.target.parentElement.getAttribute("data-block-id")), r([m._id], C === "canvas" ? null : C, z), a(), setTimeout(K, 300);
318
- },
319
- onDragEnter: (g) => {
320
- const p = g, h = p.target;
321
- lt = h;
322
- const b = h.getAttribute("data-block-id");
323
- u(b), p.stopPropagation(), p.preventDefault(), B = [], Ce(h), t(!0), l(""), c([]);
324
- },
325
- onDragLeave: (g) => {
326
- g.target.getAttribute("data-block-id") === "canvas" && (u(null), t(!1), K(), B = []);
327
- }
328
- };
329
- };
330
- function tt(n) {
331
- return n.getAttribute("data-block-id") ? n : n.closest("[data-block-id]");
332
- }
333
- function Ae(n) {
334
- n.container.innerHTML = "", n.container.parentNode.removeChild(n.container);
335
- var e = document.querySelector(".ql-toolbar");
336
- e && e.parentNode.removeChild(e), n = null;
337
- }
338
- const De = () => {
339
- const n = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], e = Ft(), [, t] = E(), [o, l] = v(O);
340
- return (c) => {
341
- var g;
342
- if (o)
343
- return;
344
- const r = tt(c.target), i = r.getAttribute("data-block-type");
345
- if (!i || !n.includes(i))
346
- return;
347
- const s = r.cloneNode(!0);
348
- r.style.display = "none", Array.from(s.attributes).forEach((p) => {
349
- p.name !== "class" && s.removeAttribute(p.name);
350
- }), i === "Text" && (s.style.display = "inline-block"), r.parentNode.insertBefore(s, r.nextSibling);
351
- const u = new Jt(s, { placeholder: "Type here..." });
352
- function a() {
353
- const p = u.getText(0, u.getLength());
354
- e([r.getAttribute("data-block-id")], { content: p }), r.removeAttribute("style"), s.removeEventListener("blur", a, !0), Ae(u), l(""), t("");
355
- }
356
- s.addEventListener("blur", a, !0), s.addEventListener("keydown", (p) => {
357
- (p.key === "Enter" || p.key === "Escape") && a();
358
- }), u.focus(), (g = s.querySelector(".ql-clipboard")) == null || g.remove(), l(r.getAttribute("data-block-id"));
359
- };
360
- }, Te = () => {
361
- const [, n] = $(), [e, t] = F(), [, o] = E(), [l] = v(O), [c] = v(Rt);
362
- return (r) => {
363
- if (l)
364
- return;
365
- r.stopPropagation();
366
- const i = tt(r.target);
367
- if (i != null && i.getAttribute("data-block-id") && (i == null ? void 0 : i.getAttribute("data-block-id")) === "container") {
368
- t([]), n([]), o("");
369
- return;
370
- }
371
- if (i != null && i.getAttribute("data-block-parent")) {
372
- const s = i.getAttribute("data-style-prop"), u = i.getAttribute("data-style-id"), a = i.getAttribute("data-block-parent");
373
- e.includes(a) || c == null || c.closeAll(), n([{ id: u, prop: s, blockId: a }]), t([a]);
374
- } else if (i != null && i.getAttribute("data-block-id")) {
375
- let s = i.getAttribute("data-block-id");
376
- e.includes(s) || c == null || c.closeAll(), n([]), t([s]);
377
- }
378
- o("");
379
- };
380
- }, Ee = dt((n, e) => {
381
- const t = tt(n.target);
382
- t != null && t.getAttribute("data-style-id") && e(t.getAttribute("data-style-id"));
383
- }, 100), je = () => {
384
- const [, n] = E(), [e] = v(O);
385
- return (t) => {
386
- e || Ee(t, n);
387
- };
388
- }, Me = ({ children: n }) => {
389
- const { document: e } = W(), [t] = F(), [o, l] = $();
390
- S(() => {
391
- setTimeout(() => {
392
- if (!T(o))
393
- return;
394
- const u = vt(e, V(t));
395
- if (u) {
396
- const a = u.getAttribute("data-style-prop");
397
- if (a) {
398
- const g = u.getAttribute("data-style-id"), p = u.getAttribute("data-block-parent");
399
- l([{ id: g, prop: a, blockId: p }]);
400
- }
401
- }
402
- }, 100);
403
- }, [e, t, l, o]);
404
- const c = De(), r = Te(), i = je(), s = _e();
405
- return /* @__PURE__ */ d.jsx(
406
- "div",
407
- {
408
- "data-block-id": "canvas",
409
- id: "canvas",
410
- onClick: r,
411
- onDoubleClick: c,
412
- onMouseMove: i,
413
- ...pt(s, "isDragging"),
414
- className: "relative mb-5 h-full max-w-full px-1 " + (s.isDragging ? "dragging" : ""),
415
- children: n
416
- }
417
- );
418
- }, vt = (n, e) => n.querySelector(`[data-block-id="${e}"]`), Le = () => {
419
- const { document: n } = W();
420
- return Qt(n), null;
421
- }, Fe = ({ block: n, label: e }) => {
422
- const [, t] = F(), [, o] = E(), [, l] = v(q), c = ce("dnd");
423
- return /* @__PURE__ */ d.jsxs(
424
- "div",
425
- {
426
- className: "mr-10 flex cursor-default items-center space-x-1 px-1",
427
- draggable: c ? "true" : "false",
428
- onDragStart: (r) => {
429
- r.dataTransfer.setData("text/plain", JSON.stringify(Bt(n, ["_id", "_type", "_name"]))), l(n), setTimeout(() => {
430
- t([]), o(null);
431
- }, 200);
432
- },
433
- children: [
434
- /* @__PURE__ */ d.jsx(se, {}),
435
- e
436
- ]
437
- }
438
- );
439
- }, Re = ({ selectedBlockElement: n, block: e }) => {
440
- const t = Ht(), o = Pt(), [, l] = F(), [, c] = E(), [, r] = $(), [i] = v(O), { floatingStyles: s, refs: u, update: a } = ne({
441
- placement: "top-start",
442
- middleware: [oe(), ee()],
443
- elements: {
444
- reference: n
445
- }
446
- });
447
- ae(n, () => a(), n !== null);
448
- const g = f(e, "_parent", null), p = T(f(e, "_name", "")) ? f(e, "_type", "") : f(e, "_name", "");
449
- return !n || !e || i ? null : /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsxs(
450
- "div",
451
- {
452
- role: "button",
453
- tabIndex: 0,
454
- ref: u.setFloating,
455
- style: s,
456
- onClick: (h) => {
457
- h.stopPropagation(), h.preventDefault();
458
- },
459
- onMouseEnter: (h) => {
460
- h.stopPropagation(), c(null);
461
- },
462
- onKeyDown: (h) => h.stopPropagation(),
463
- className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
464
- children: [
465
- /* @__PURE__ */ d.jsx(Fe, { label: p, block: e }),
466
- /* @__PURE__ */ d.jsxs("div", { className: "flex gap-2 px-1", children: [
467
- g && /* @__PURE__ */ d.jsx(
468
- ie,
469
- {
470
- className: "hover:scale-105",
471
- onClick: () => {
472
- r([]), l([g]);
473
- }
474
- }
475
- ),
476
- Ot(f(e, "_type", "")) ? /* @__PURE__ */ d.jsx(re, { className: "hover:scale-105", onClick: () => o([e == null ? void 0 : e._id]) }) : null,
477
- $t(f(e, "_type", "")) ? /* @__PURE__ */ d.jsx(le, { className: "hover:scale-105", onClick: () => t([e == null ? void 0 : e._id]) }) : null
478
- ] })
479
- ]
480
- }
481
- ) });
482
- }, He = ({ model: n }) => {
483
- const [e] = Nt(), [t] = F(), [o] = qt(), [l] = E(), [c] = $(), [r] = v(q), [i] = v(mt), { document: s, window: u } = W(), [a] = A(s == null ? void 0 : s.getElementById("highlighted-block")), [g] = A(
484
- s == null ? void 0 : s.getElementById("selected-block")
485
- ), [p] = A(
486
- s == null ? void 0 : s.getElementById("selected-styling-block")
487
- ), [h] = A(
488
- s == null ? void 0 : s.getElementById("dragged-block")
489
- );
490
- S(() => {
491
- o ? s == null || s.documentElement.classList.add("dark") : s == null || s.documentElement.classList.remove("dark");
492
- }, [o, s]);
493
- const b = f(e, "headingFont", "DM Sans"), m = f(e, "bodyFont", "DM Sans");
494
- return S(() => {
495
- const w = f(e, "primaryColor", "#000"), C = f(e, "secondaryColor", "#FFF"), D = f(e, "bodyBgLightColor", "#fff"), j = f(e, "bodyBgDarkColor", "#000"), R = f(e, "bodyTextDarkColor", "#000"), P = f(e, "bodyTextLightColor", "#fff"), U = ge([
496
- { color: w, name: "primary" },
497
- { color: C, name: "secondary" }
498
- ]), y = {
499
- "bg-light": D,
500
- "bg-dark": j,
501
- "text-dark": R,
502
- "text-light": P
503
- }, I = f(e, "roundedCorners", "0");
504
- !u || !u.tailwind || (u.tailwind.config = {
505
- darkMode: "class",
506
- theme: {
507
- extend: {
508
- container: {
509
- center: !0,
510
- padding: "1rem",
511
- screens: {
512
- "2xl": "1400px"
513
- }
514
- },
515
- fontFamily: {
516
- heading: [b],
517
- body: [m]
518
- },
519
- borderRadius: {
520
- DEFAULT: `${I || "0"}px`
521
- },
522
- colors: { ...y, ...U }
523
- }
524
- },
525
- plugins: [
526
- de,
527
- pe,
528
- ue,
529
- me(function({ addBase: _, theme: H }) {
530
- _({
531
- "h1,h2,h3,h4,h5,h6": {
532
- fontFamily: H("fontFamily.heading")
533
- },
534
- body: {
535
- fontFamily: H("fontFamily.body"),
536
- color: H("colors.text-light"),
537
- backgroundColor: H("colors.bg-light")
538
- },
539
- ".dark body": {
540
- color: H("colors.text-dark"),
541
- backgroundColor: H("colors.bg-dark")
542
- }
543
- });
544
- })
545
- ]
546
- });
547
- }, [e, u, b, m]), S(() => {
548
- g && (g.textContent = `${nt(t, (w) => `[data-block-id="${w}"]`).join(",")}{
549
- outline: 1px solid ${t.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
550
- }`);
551
- }, [t, g]), S(() => {
552
- h.textContent = r ? `[data-block-id="${r._id}"], [data-block-id="${r._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
553
- }, [r, h]), S(() => {
554
- a && (a.textContent = l ? `[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
555
- }, [l, t, a]), S(() => {
556
- p && (p.textContent = `${nt(c, ({ id: w }) => `[data-style-id="${w}"]`).join(",")}{
557
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
558
- }`);
559
- }, [c, p]), S(() => {
560
- s.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
561
- }, [i]), /* @__PURE__ */ d.jsx(d.Fragment, { children: (b || m) && /* @__PURE__ */ d.jsx(
562
- "link",
563
- {
564
- rel: "stylesheet",
565
- href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && m && b !== m ? "&" : ""}${m && m !== b ? `family=${m.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
566
- }
567
- ) });
568
- }, Pe = () => v(Wt), Oe = (n, e) => {
569
- const t = ["xs", "sm", "md", "lg", "xl", "2xl"], o = t.indexOf(e), l = n.split(" ");
570
- let c = new Array(t.length).fill(!1);
571
- for (const r of l) {
572
- let [i, s] = r.split(":");
573
- s || (s = i, i = "xs");
574
- const u = t.indexOf(i);
575
- if (u <= o) {
576
- const a = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
577
- if (a.includes(s))
578
- for (let p = u; p < t.length; p++)
579
- c[p] = !0;
580
- else if (g.includes(s))
581
- for (let p = u; p < t.length; p++)
582
- c[p] = !1;
583
- }
584
- }
585
- return c[o];
586
- }, $e = (n) => {
587
- const e = {};
588
- return Object.keys(n).forEach((t) => {
589
- J(n[t]) && n[t].startsWith(it) && (e[t] = n[t].replace(it, "").split(","));
590
- }), e;
591
- }, Ne = _t((n) => {
592
- const e = n.replace(ft, "").split(",");
593
- return fe(e[0], e[1]);
594
- });
595
- function qe(n, e) {
596
- return f(n, `${e}_attrs`, {});
597
- }
598
- function We(n, e) {
599
- const t = {};
600
- return Object.keys(n).forEach((o) => {
601
- if (J(n[o]) && n[o].startsWith(ft)) {
602
- const l = Ne(n[o]), c = qe(n, o);
603
- t[o] = {
604
- className: l,
605
- "data-style-prop": o,
606
- "data-block-parent": n._id,
607
- "data-style-id": `${o}-${n._id}`,
608
- ...c
609
- };
610
- const r = N(c, "x-show") || N(c, "x-if");
611
- r && (t.__isHidden = r && !Oe(l, e));
612
- }
613
- }), t;
614
- }
615
- function Ue(n, e) {
616
- const t = f(n, "_bindings", {});
617
- return T(t) ? { ...n } : (At(t, (o, l) => {
618
- J(o) && f(e, o, null) && (n[l] = f(e, o, null));
619
- }), n);
620
- }
621
- function X({ blocks: n }) {
622
- const [e] = gt(), [t] = v(Ut), [o] = v(q), [, l] = Q(), [c] = Pe(), r = Y((a) => We(a, l), [l]), [i] = Zt(), [s] = v(O), u = Y(
623
- (a) => a.reduce((g, p) => {
624
- const h = f(c, p, {});
625
- return { ...g, ...h };
626
- }, {}),
627
- [c, e]
628
- );
629
- return /* @__PURE__ */ d.jsx(d.Fragment, { children: L.Children.toArray(
630
- n.map((a, g) => {
631
- if (s === a._id)
632
- return null;
633
- const p = $e(a), h = {};
634
- T(p) || Object.keys(p).forEach((R) => {
635
- h[R] = L.Children.toArray(
636
- p[R].map((P) => /* @__PURE__ */ d.jsx(X, { blocks: [Dt(e, { _id: P })] }))
637
- );
638
- });
639
- const b = ut(e, { _parent: a._id });
640
- h.children = b.length ? /* @__PURE__ */ d.jsx(X, { blocks: b }) : null;
641
- const m = he(a._type), w = f(m, "builderComponent", f(m, "component", null));
642
- if (Tt(w))
643
- return /* @__PURE__ */ d.jsx("noscript", { children: `<!-- ${a == null ? void 0 : a._type} not registered -->` });
644
- const C = N(m, "getBlockStateFrom") ? m == null ? void 0 : m.getBlockStateFrom(a, e) : [], D = u(C), j = r(a);
645
- return f(j, "__isHidden", !1) && !rt(t, a._id) ? null : /* @__PURE__ */ d.jsx(St, { children: L.createElement(w, {
646
- blockProps: {
647
- ...rt(t, a._id) ? { "force-show": "" } : {},
648
- "data-block-id": a._id,
649
- "data-block-type": a._type,
650
- ...o ? (
651
- // @ts-ignore
652
- {
653
- "data-dnd": zt(a._type, o == null ? void 0 : o._type) ? "yes" : "no"
654
- }
655
- ) : {}
656
- },
657
- index: g,
658
- ...Ue(a, i),
659
- ...pt(j, ["__isHidden"]),
660
- ...h,
661
- inBuilder: !0,
662
- blockState: D
663
- }) });
664
- })
665
- ) });
666
- }
667
- const ze = () => {
668
- const [n] = gt(), e = T(n) ? null : /* @__PURE__ */ d.jsx(te, { children: /* @__PURE__ */ d.jsx(X, { blocks: ut(n, (t) => T(t._parent)) }) });
669
- return /* @__PURE__ */ d.jsx(d.Fragment, { children: e });
670
- }, Ke = (n, e) => n.querySelector(`[data-style-id="${e}"]`), Zn = () => {
671
- const [n] = v(Kt), [e] = Yt(), [t] = Q(), [, o] = F(), l = Vt(), [, c] = E(), r = et(null), i = et(null), [s, u] = A({ width: 0, height: 0 }), a = be(s), [g, p] = A(0), [h, b] = A([]), [, m] = A([]), [, w] = v(Gt), [C, D] = $(), j = ot("loading", !1), R = ot("htmlDir", "ltr");
672
- S(() => {
673
- const { clientWidth: y, clientHeight: I } = i.current;
674
- u({ width: y, height: I }), g === 0 && p(y);
675
- }, [i, t, g]);
676
- const P = (y, I = 0) => {
677
- const { top: _ } = y.getBoundingClientRect();
678
- return _ + I >= 0 && _ - I <= window.innerHeight;
679
- };
680
- S(() => {
681
- var y, I;
682
- if (l && l.type !== "Multiple" && r.current) {
683
- const _ = vt(r.current.contentDocument, l._id);
684
- _ && (P(_) || (I = (y = r.current) == null ? void 0 : y.contentWindow) == null || I.scrollTo({ top: _.offsetTop, behavior: "smooth" }), b([_]));
685
- }
686
- }, [l]), S(() => {
687
- if (!T(C) && r.current) {
688
- const y = Ke(
689
- r.current.contentDocument,
690
- V(C).id
691
- );
692
- m(y ? [y] : [null]);
693
- } else
694
- m([null]);
695
- }, [C]);
696
- const U = It(() => {
697
- let y = xe;
698
- return y = y.replace("__HTML_DIR__", R), n === "offline" && (y = y.replace(
699
- "https://old.chaibuilder.com/offline/tailwind.cdn.js",
700
- "/offline/tailwind.cdn.js"
701
- ), y = y.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), y = y.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), y;
702
- }, [n]);
703
- return /* @__PURE__ */ d.jsx(
704
- "div",
705
- {
706
- onClick: () => {
707
- o([]), D([]);
708
- },
709
- onMouseLeave: () => setTimeout(() => c(""), 300),
710
- className: "relative mx-auto h-full w-full overflow-hidden",
711
- style: g > 0 && !T(a) ? { width: e ? "100%" : g } : {},
712
- ref: i,
713
- children: /* @__PURE__ */ d.jsxs(
714
- ke,
715
- {
716
- contentDidMount: () => w(r.current),
717
- ref: r,
718
- id: "canvas-iframe",
719
- style: { width: `${t}px`, ...a },
720
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
721
- initialContent: U,
722
- children: [
723
- /* @__PURE__ */ d.jsx(Le, {}),
724
- /* @__PURE__ */ d.jsx(
725
- Re,
726
- {
727
- block: l,
728
- selectedBlockElement: V(h)
729
- }
730
- ),
731
- /* @__PURE__ */ d.jsx(He, { model: "page" }),
732
- /* @__PURE__ */ d.jsx(ye, { children: /* @__PURE__ */ d.jsx(Me, { children: j ? /* @__PURE__ */ d.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ d.jsx(Xt, { className: "h-full" }) }) : /* @__PURE__ */ d.jsx(ze, {}) }) }),
733
- /* @__PURE__ */ d.jsx("br", {}),
734
- /* @__PURE__ */ d.jsx(
735
- "div",
736
- {
737
- id: "placeholder",
738
- className: "pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"
739
- }
740
- )
741
- ]
742
- }
743
- )
744
- }
745
- );
746
- };
747
- export {
748
- Zn as default
749
- };