@chaibuilder/sdk 0.1.10 → 0.1.12
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-f76f509d.js → AddBlocks-73aa52ed.js} +46 -46
- package/dist/{AddBlocks-2feb85b6.cjs → AddBlocks-eafcb8ab.cjs} +2 -2
- package/dist/{BrandingOptions-96d7aa44.cjs → BrandingOptions-45caece9.cjs} +1 -1
- package/dist/{BrandingOptions-852c1274.js → BrandingOptions-6e8c6721.js} +1 -1
- package/dist/{CanvasArea-714b0fdd.js → CanvasArea-3049f560.js} +2 -2
- package/dist/{CanvasArea-a272e5ce.cjs → CanvasArea-a392ffc1.cjs} +2 -2
- package/dist/{CurrentPage-235f6546.js → CurrentPage-3d3209a1.js} +21 -21
- package/dist/CurrentPage-def95a2d.cjs +1 -0
- package/dist/{ImagesPanel-8ccab6d9.js → ImagesPanel-36a2f276.js} +1 -1
- package/dist/{ImagesPanel-addb2bf9.cjs → ImagesPanel-731cda7a.cjs} +1 -1
- package/dist/{Layers-1ce42e18.js → Layers-23512777.js} +2 -2
- package/dist/{Layers-42588f4e.cjs → Layers-3bdb61c3.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-f559dc7f.js → MarkAsGlobalBlock-37ae563e.js} +1 -1
- package/dist/{MarkAsGlobalBlock-a75613f0.cjs → MarkAsGlobalBlock-d10b749d.cjs} +1 -1
- package/dist/PagesPanel-2e626ee0.cjs +1 -0
- package/dist/{PagesPanel-40fa913f.js → PagesPanel-a0cb2a3c.js} +8 -14
- package/dist/{ProjectPanel-f8629c81.cjs → ProjectPanel-453caab3.cjs} +1 -1
- package/dist/{ProjectPanel-232d9d07.js → ProjectPanel-590ad7b5.js} +2 -2
- package/dist/{Settings-abd094d0.js → Settings-201df828.js} +3 -3
- package/dist/{Settings-8a78ef02.cjs → Settings-3f024a5e.cjs} +1 -1
- package/dist/{SidePanels-c1f857a8.js → SidePanels-2135b1a7.js} +2 -2
- package/dist/{SidePanels-edb9c3ac.cjs → SidePanels-2d310a73.cjs} +1 -1
- package/dist/{Topbar-8a8249c5.js → Topbar-4e436076.js} +1 -1
- package/dist/{Topbar-a8ca3af7.cjs → Topbar-f722a517.cjs} +1 -1
- package/dist/UploadImages-33c1507a.cjs +1 -0
- package/dist/{UploadImages-1839950f.js → UploadImages-f0ba3215.js} +5 -3
- package/dist/{add-page-modal-1bc36ab2.cjs → add-page-modal-17cd6043.cjs} +1 -1
- package/dist/{add-page-modal-0d32113a.js → add-page-modal-e38900bd.js} +4 -4
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-96c453aa.js → delete-page-modal-69202329.js} +1 -1
- package/dist/{delete-page-modal-22b50aea.cjs → delete-page-modal-7e833472.cjs} +1 -1
- package/dist/{form-526188f9.js → form-52b48fbc.js} +1 -1
- package/dist/{form-431f0141.cjs → form-e9748a4e.cjs} +1 -1
- package/dist/{index-8bd8bb62.cjs → index-4462d894.cjs} +2 -2
- package/dist/{index-3ab5dba5.js → index-9ba9f277.js} +9 -8
- package/dist/{link-8b201d2c.cjs → link-26d3158f.cjs} +1 -1
- package/dist/{link-ebe8a751.js → link-eeef0a29.js} +6 -6
- package/dist/{page-viewer-36ef3ef4.cjs → page-viewer-2fb5485c.cjs} +1 -1
- package/dist/{page-viewer-a32d8269.js → page-viewer-ddaba8df.js} +4 -4
- package/dist/{project-general-setting-6a64c051.js → project-general-setting-5810b457.js} +4 -4
- package/dist/{project-general-setting-f8edd93b.cjs → project-general-setting-fc4ea1f6.cjs} +1 -1
- package/dist/{project-seo-setting-f31a84f5.js → project-seo-setting-23fb5e80.js} +3 -3
- package/dist/{project-seo-setting-157acce4.cjs → project-seo-setting-b3372d3f.cjs} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +133 -59
- package/dist/server.js +82 -48
- package/dist/{single-page-detail-4f2cce8a.cjs → single-page-detail-128a33a7.cjs} +1 -1
- package/dist/{single-page-detail-8ccf6b26.js → single-page-detail-359a0806.js} +5 -5
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/package.json +1 -1
- package/dist/CurrentPage-b22f60aa.cjs +0 -1
- package/dist/PagesPanel-edd76634.cjs +0 -1
- package/dist/UploadImages-d398bc93.cjs +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import
|
|
3
|
-
import { has as
|
|
2
|
+
import T, { createElement as K, useState as j, useMemo as W, useCallback as q, useEffect as V, Suspense as X } from "react";
|
|
3
|
+
import { has as R, first as b, filter as w, values as k, groupBy as I, mergeWith as Y, isArray as H, get as $, map as L, isEmpty as B, find as M, uniq as J, includes as P, reject as E } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
5
|
import { A as Q, a as Z, b as ee, c as se } from "./accordion-c0176dc5.js";
|
|
6
6
|
import { S as re } from "./scroll-area-9f64a082.js";
|
|
7
|
-
import { T as oe, a as te, b as
|
|
7
|
+
import { T as oe, a as te, b as A } from "./tabs-85caa1e8.js";
|
|
8
8
|
import { d as le, e as ae, f as ce, u as ne, B as ie, S as de } from "./useBuilderProp-81a14920.js";
|
|
9
|
-
import { useDrag as
|
|
9
|
+
import { useDrag as _, DragPreviewImage as O } from "react-dnd";
|
|
10
10
|
import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
|
|
11
|
-
import { T as F, h as
|
|
11
|
+
import { T as F, h as v, a as z, b as C, W as D, X as xe, Y as he, y as fe } from "./index-9ba9f277.js";
|
|
12
12
|
import "react-i18next";
|
|
13
|
-
import { syncBlocksWithDefaults as
|
|
13
|
+
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/blocks";
|
|
14
14
|
import { Loader as ge } from "lucide-react";
|
|
15
15
|
import { c as be } from "./utils-ac68b2c8.js";
|
|
16
|
-
import { C as je, c as ye, e as we, f as ke, g as Be, T as Te, d as
|
|
16
|
+
import { C as je, c as ye, e as we, f as ke, g as Be, T as Te, d as ve, A as Ce, a as Ne } from "./textarea-0750bcd2.js";
|
|
17
17
|
import { L as Ae } from "./label-e770a087.js";
|
|
18
18
|
import { b as Ie } from "./html-to-json-8397fab5.js";
|
|
19
19
|
import "@radix-ui/react-accordion";
|
|
@@ -37,15 +37,15 @@ import "tailwind-merge";
|
|
|
37
37
|
import "@radix-ui/react-label";
|
|
38
38
|
import "himalaya";
|
|
39
39
|
const Le = ({ block: s }) => {
|
|
40
|
-
const { type: r, icon: o, label: a } = s, { addCoreBlock:
|
|
41
|
-
|
|
42
|
-
}, [, x, u] =
|
|
40
|
+
const { type: r, icon: o, label: a } = s, { addCoreBlock: n, addPredefinedBlock: d } = F(), [m] = v(), [, i] = h(z), [, t] = h(C), f = () => {
|
|
41
|
+
R(s, "blocks") ? d(G(s.blocks), b(m)) : n(s, b(m)), t(!1), i("layers");
|
|
42
|
+
}, [, x, u] = _(() => ({
|
|
43
43
|
type: "CHAI_BLOCK",
|
|
44
44
|
item: s
|
|
45
45
|
}));
|
|
46
46
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
47
47
|
/* @__PURE__ */ e.jsx(
|
|
48
|
-
|
|
48
|
+
O,
|
|
49
49
|
{
|
|
50
50
|
connect: u,
|
|
51
51
|
src: "https://placehold.co/100x30/000000/FFF?text=" + (a || r).replace(/ /g, "+")
|
|
@@ -60,7 +60,7 @@ const Le = ({ block: s }) => {
|
|
|
60
60
|
ref: x,
|
|
61
61
|
className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
62
62
|
children: [
|
|
63
|
-
|
|
63
|
+
K(o || me, { className: "w-4 h-4 mx-auto" }),
|
|
64
64
|
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || r })
|
|
65
65
|
]
|
|
66
66
|
}
|
|
@@ -70,27 +70,27 @@ const Le = ({ block: s }) => {
|
|
|
70
70
|
] });
|
|
71
71
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
72
72
|
var u;
|
|
73
|
-
const [o, a] = j(!1),
|
|
73
|
+
const [o, a] = j(!1), n = ne("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [i] = v(), [, t, f] = _(
|
|
74
74
|
() => ({
|
|
75
75
|
type: "CHAI_BLOCK",
|
|
76
76
|
item: s
|
|
77
77
|
}),
|
|
78
78
|
[s]
|
|
79
|
-
), x =
|
|
79
|
+
), x = q(
|
|
80
80
|
async (g) => {
|
|
81
|
-
if (g.stopPropagation(),
|
|
82
|
-
d(s, b(
|
|
81
|
+
if (g.stopPropagation(), R(s, "component")) {
|
|
82
|
+
d(s, b(i)), r();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
a(!0);
|
|
86
|
-
const l = await
|
|
87
|
-
|
|
86
|
+
const l = await n(s);
|
|
87
|
+
B(l) || m(G(l), b(i)), r();
|
|
88
88
|
},
|
|
89
89
|
[s]
|
|
90
90
|
);
|
|
91
91
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
92
92
|
/* @__PURE__ */ e.jsx(
|
|
93
|
-
|
|
93
|
+
O,
|
|
94
94
|
{
|
|
95
95
|
connect: f,
|
|
96
96
|
src: "https://placehold.co/100x30/000000/FFF?text=" + ((u = s.name || s.label) == null ? void 0 : u.replace(" ", "+"))
|
|
@@ -115,10 +115,10 @@ const Le = ({ block: s }) => {
|
|
|
115
115
|
)
|
|
116
116
|
] });
|
|
117
117
|
}, Fe = () => {
|
|
118
|
-
const { data: s, isLoading: r } =
|
|
118
|
+
const { data: s, isLoading: r } = D(), o = U(), a = w(k(o), { category: "custom" }), n = I(a, "group"), d = I(s, "group"), [m, i] = j(null), t = W(() => Y(n, d, (l, p) => {
|
|
119
119
|
if (H(l) && H(p))
|
|
120
120
|
return [...l, ...p];
|
|
121
|
-
}), [
|
|
121
|
+
}), [n, d]), [, f] = h(C), [x, u] = j("Navbar"), g = $(t, x, []);
|
|
122
122
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
|
|
123
123
|
/* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
124
124
|
/* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
|
|
@@ -127,18 +127,18 @@ const Le = ({ block: s }) => {
|
|
|
127
127
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
128
128
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
129
129
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
130
|
-
] }) :
|
|
130
|
+
] }) : T.Children.toArray(
|
|
131
131
|
L(t, (l, p) => /* @__PURE__ */ e.jsx(
|
|
132
132
|
"li",
|
|
133
133
|
{
|
|
134
134
|
onMouseOut: () => {
|
|
135
|
-
clearTimeout(m),
|
|
135
|
+
clearTimeout(m), i(null);
|
|
136
136
|
},
|
|
137
137
|
onMouseEnter: () => {
|
|
138
138
|
const y = setTimeout(() => {
|
|
139
139
|
u(p);
|
|
140
140
|
}, 300);
|
|
141
|
-
|
|
141
|
+
i(y);
|
|
142
142
|
},
|
|
143
143
|
onClick: () => u(p),
|
|
144
144
|
className: be(
|
|
@@ -149,14 +149,14 @@ const Le = ({ block: s }) => {
|
|
|
149
149
|
}
|
|
150
150
|
))
|
|
151
151
|
) }),
|
|
152
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children:
|
|
152
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: T.Children.toArray(
|
|
153
153
|
g.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
154
154
|
) })
|
|
155
155
|
] });
|
|
156
156
|
}, He = () => {
|
|
157
|
-
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] =
|
|
157
|
+
const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = v(), [, n] = h(xe), [, d] = h(z), [, m] = h(C), i = () => {
|
|
158
158
|
const t = Ie(s);
|
|
159
|
-
o([...t], b(a) || null), r(""),
|
|
159
|
+
o([...t], b(a) || null), r(""), n(!1), d("layers"), m(!1);
|
|
160
160
|
};
|
|
161
161
|
return /* @__PURE__ */ e.jsxs(je, { className: "border-border/0 p-0 shadow-none", children: [
|
|
162
162
|
/* @__PURE__ */ e.jsxs(ye, { className: "p-3", children: [
|
|
@@ -181,28 +181,28 @@ const Le = ({ block: s }) => {
|
|
|
181
181
|
}
|
|
182
182
|
)
|
|
183
183
|
] }) }),
|
|
184
|
-
/* @__PURE__ */ e.jsxs(
|
|
185
|
-
/* @__PURE__ */ e.jsx(ie, { disabled: s.trim() === "", onClick: () =>
|
|
186
|
-
/* @__PURE__ */ e.jsxs(
|
|
184
|
+
/* @__PURE__ */ e.jsxs(ve, { className: "flex flex-col justify-end p-3", children: [
|
|
185
|
+
/* @__PURE__ */ e.jsx(ie, { disabled: s.trim() === "", onClick: () => i(), size: "sm", className: "w-full", children: "Import" }),
|
|
186
|
+
/* @__PURE__ */ e.jsxs(Ce, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
|
|
187
187
|
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4" }),
|
|
188
188
|
/* @__PURE__ */ e.jsx(Ne, { className: "text-sm leading-4", children: "Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." })
|
|
189
189
|
] })
|
|
190
190
|
] })
|
|
191
191
|
] });
|
|
192
|
-
}, Me = He,
|
|
192
|
+
}, Me = He, S = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Ee = (s, r) => {
|
|
193
193
|
if (!s)
|
|
194
|
-
return !P(
|
|
194
|
+
return !P(S, r);
|
|
195
195
|
const o = s._type;
|
|
196
|
-
return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(
|
|
196
|
+
return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(S, r);
|
|
197
197
|
}, ys = () => {
|
|
198
|
-
const [s, r] = j("core"), [o, a] = j("basic"),
|
|
199
|
-
w(
|
|
198
|
+
const [s, r] = j("core"), [o, a] = j("basic"), n = U(), [, d] = h(he), [, m] = h(C), [i] = v(), t = fe(), f = M(t, { _id: b(i) }), { data: x, isLoading: u } = D(), g = I(
|
|
199
|
+
w(n, (c) => Ee(f, c.type)),
|
|
200
200
|
"category"
|
|
201
201
|
), l = J(L(g.core, "group"));
|
|
202
|
-
|
|
203
|
-
!P(l, o) && !
|
|
202
|
+
V(() => {
|
|
203
|
+
!P(l, o) && !B(l) && !B(o) && a(b(l));
|
|
204
204
|
}, [l, o]);
|
|
205
|
-
const p = (c) => a((
|
|
205
|
+
const p = (c) => a((N) => N === c ? "" : c), y = !u && !B(x) || M(k(n), { category: "custom" }) !== void 0;
|
|
206
206
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
207
207
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
|
|
208
208
|
/* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
|
|
@@ -230,26 +230,26 @@ const Le = ({ block: s }) => {
|
|
|
230
230
|
value: s,
|
|
231
231
|
className: "h-max",
|
|
232
232
|
children: /* @__PURE__ */ e.jsxs(te, { className: "grid w-full " + (y ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
233
|
-
/* @__PURE__ */ e.jsx(
|
|
234
|
-
y ? /* @__PURE__ */ e.jsx(
|
|
235
|
-
/* @__PURE__ */ e.jsx(
|
|
233
|
+
/* @__PURE__ */ e.jsx(A, { value: "core", children: "Core" }),
|
|
234
|
+
y ? /* @__PURE__ */ e.jsx(A, { value: "ui-blocks", children: "UI Blocks" }) : null,
|
|
235
|
+
/* @__PURE__ */ e.jsx(A, { value: "html", children: "Import" })
|
|
236
236
|
] })
|
|
237
237
|
}
|
|
238
238
|
),
|
|
239
|
-
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(Q, { type: "single", value: o, className: "w-full px-3", children:
|
|
239
|
+
s === "core" && /* @__PURE__ */ e.jsx(re, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(Q, { type: "single", value: o, className: "w-full px-3", children: T.Children.toArray(
|
|
240
240
|
L(
|
|
241
241
|
l,
|
|
242
|
-
(c) =>
|
|
242
|
+
(c) => E(w(k(g.core), { group: c }), {
|
|
243
243
|
hidden: !0
|
|
244
244
|
}).length ? /* @__PURE__ */ e.jsxs(Z, { value: c, className: "border-border", children: [
|
|
245
245
|
/* @__PURE__ */ e.jsx(ee, { onClick: () => p(c), className: "py-2 capitalize", children: c }),
|
|
246
|
-
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children:
|
|
247
|
-
|
|
246
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: T.Children.toArray(
|
|
247
|
+
E(w(k(g.core), { group: c }), { hidden: !0 }).map((N) => /* @__PURE__ */ e.jsx(Le, { block: N }))
|
|
248
248
|
) }) })
|
|
249
249
|
] }) : null
|
|
250
250
|
)
|
|
251
251
|
) }) }),
|
|
252
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(
|
|
252
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx(X, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
253
253
|
s === "html" && /* @__PURE__ */ e.jsx(Me, {})
|
|
254
254
|
] });
|
|
255
255
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-088530b9.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-088530b9.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-4462d894.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),I=require("lucide-react"),L=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),P=require("./label-167415e5.cjs"),S=require("./html-to-json-78bfa1f3.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("./MODIFIERS-70fef873.cjs");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const M=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:u,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,x]=b.useAtom(l.activePanelAtom),[,i]=b.useAtom(l.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):u(t,s.first(p)),i(!1),x("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},F=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),u=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[x]=l.useSelectedBlockIds(),[,i,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=n.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}c(!0);const a=await u(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:g,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(I.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):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:t.name})})]})]})},H=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),u=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>s.mergeWith(u,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[u,m]),[,E]=b.useAtom(l.addBlocksModalAtom),[g,j]=n.useState("Navbar"),R=s.get(i,g,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:L.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(R.map(a=>e.jsxRuntimeExports.jsx(F,{block:a,closePopover:()=>E(!1)})))})]})},D=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,u]=b.useAtom(l.addBlockOffCanvasAtom),[,m]=b.useAtom(l.activePanelAtom),[,p]=b.useAtom(l.addBlocksModalAtom),x=()=>{const i=S.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),u(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(P.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
|
|
2
2
|
<h1>Enter code here</h1>
|
|
3
|
-
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},O=D,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],U=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},z=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),u=T.useChaiBlocks(),[,m]=b.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(l.addBlocksModalAtom),[x]=l.useSelectedBlockIds(),i=l.useAllBlocks(),E=s.find(i,{_id:s.first(x)}),{data:g,isLoading:j}=l.useUILibraryBlocks(),R=s.groupBy(s.filter(u,d=>U(E,d.type)),"category"),a=s.uniq(s.map(R.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(g)||s.find(s.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 justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(q.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(M,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(H,{})}),t==="html"&&e.jsxRuntimeExports.jsx(O,{})]})};exports.default=z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-4462d894.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function k(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const c=k(O),v=[{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"}],D=()=>{const r=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{P.isEqual(t,a.current)||r(a.current)},[]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:q,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:h}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:q}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:x}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:C,onChange:p})})]})};exports.default=D;
|
|
@@ -2,7 +2,7 @@ import { j as a } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import B from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { w as N } from "./index-
|
|
5
|
+
import { w as N } from "./index-9ba9f277.js";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import { u as D } from "./useBuilderProp-81a14920.js";
|
|
8
8
|
import { SelectOption as p, Numeric as P, Color as e } from "@chaibuilder/blocks";
|
|
@@ -6,7 +6,7 @@ import G, { createElement as gt, useCallback as Q, useState as H, useEffect as F
|
|
|
6
6
|
import { map as ie, includes as Me, toUpper as ye, round as St, isEmpty as ee, first as ce, get as $, memoize as Tt, find as jt, filter as Ze, isString as Je } from "lodash";
|
|
7
7
|
import { ResetIcon as De, DotsVerticalIcon as Ct, MobileIcon as Be, LaptopIcon as kt, DesktopIcon as Rt, EraserIcon as At, ZoomInIcon as _t, ArrowUpIcon as Pt, CopyIcon as It, TrashIcon as Ot, DragHandleDots2Icon as Mt } from "@radix-ui/react-icons";
|
|
8
8
|
import { B as le, u as Qe, S as et } from "./useBuilderProp-81a14920.js";
|
|
9
|
-
import { c as ke, d as tt, e as Re, f as Dt, g as Bt, h as X, i as Z, j as $t, k as rt, l as nt, m as Nt, n as Lt, o as Ft, p as ot, q as st, u as Wt, r as qt, s as Ut, t as Yt, v as zt, w as Ht, x as Ae, y as at, z as Kt, A as Vt, B as Gt, b as Xt, E as Zt } from "./index-
|
|
9
|
+
import { c as ke, d as tt, e as Re, f as Dt, g as Bt, h as X, i as Z, j as $t, k as rt, l as nt, m as Nt, n as Lt, o as Ft, p as ot, q as st, u as Wt, r as qt, s as Ut, t as Yt, v as zt, w as Ht, x as Ae, y as at, z as Kt, A as Vt, B as Gt, b as Xt, E as Zt } from "./index-9ba9f277.js";
|
|
10
10
|
import { useTranslation as it } from "react-i18next";
|
|
11
11
|
import { S as se } from "./separator-a80d065b.js";
|
|
12
12
|
import { S as Jt, D as Qt, c as er, d as tr, h as rr, i as nr, f as or, H as sr, a as ar, b as ir } from "./dropdown-menu-ae3ed09b.js";
|
|
@@ -1427,7 +1427,7 @@ const nn = () => {
|
|
|
1427
1427
|
)
|
|
1428
1428
|
}
|
|
1429
1429
|
);
|
|
1430
|
-
}, an = wt(() => import("./AddBlocks-
|
|
1430
|
+
}, an = wt(() => import("./AddBlocks-73aa52ed.js")), to = () => {
|
|
1431
1431
|
const e = Qe("mode", ve.STATIC), [r, n] = te(Xt), i = {
|
|
1432
1432
|
[ve.STATIC]: /* @__PURE__ */ t.jsx(sn, {}),
|
|
1433
1433
|
[ve.FRAMEWORK]: null
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ke=Object.defineProperty;var Ve=(e,r,n)=>r in e?Ke(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var J=(e,r,n)=>(Ve(e,typeof r!="symbol"?r+"":r,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),v=require("lodash"),W=require("@radix-ui/react-icons"),X=require("./useBuilderProp-5e57d0c8.cjs"),h=require("./index-
|
|
1
|
+
"use strict";var Ke=Object.defineProperty;var Ve=(e,r,n)=>r in e?Ke(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var J=(e,r,n)=>(Ve(e,typeof r!="symbol"?r+"":r,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),v=require("lodash"),W=require("@radix-ui/react-icons"),X=require("./useBuilderProp-5e57d0c8.cjs"),h=require("./index-4462d894.cjs"),Ne=require("react-i18next"),se=require("./separator-a597dba7.cjs"),V=require("./dropdown-menu-84b2439e.cjs"),Ge=require("./label-167415e5.cjs"),G=require("./alert-dialog-4ce6ed22.cjs"),ee=require("jotai"),Xe=require("@floating-ui/dom"),ke=require("@floating-ui/react-dom"),Ze=require("react-dnd"),Je=require("@react-hookz/web"),Qe=require("@bobthered/tailwindcss-palette-generator"),et=require("react-wrap-balancer"),tt=require("tailwind-merge"),ie=require("./MODIFIERS-70fef873.cjs"),rt=require("@chaibuilder/blocks"),Ce=require("react-dom"),nt=require("./_commonjsHelpers-5a53b418.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("lucide-react");require("sonner");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");require("@radix-ui/react-alert-dialog");const st=()=>{const{undoCount:e,redoCount:r,undo:n,redo:a}=h.useCanvasHistory();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(X.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(W.ResetIcon,{})}),t.jsxRuntimeExports.jsx(X.Button,{disabled:!r,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(W.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ot(){const[e,r]=h.useDarkMode(),{t:n}=Ne.useTranslation();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(Ge.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),t.jsxRuntimeExports.jsxs(V.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{r(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
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:[t.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),t.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
3
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 Te=({landscape:e=!1})=>t.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:[t.jsxRuntimeExports.jsx("g",{strokeWidth:0}),t.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),t.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"}})]}),Ae=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:t.jsxRuntimeExports.jsx(W.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:t.jsxRuntimeExports.jsx(W.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:t.jsxRuntimeExports.jsx(Te,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:t.jsxRuntimeExports.jsx(Te,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:t.jsxRuntimeExports.jsx(W.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:t.jsxRuntimeExports.jsx(W.DesktopIcon,{}),width:1920}],it=({title:e,content:r,currentBreakpoint:n,breakpoint:a,width:u,icon:o,onClick:i})=>t.jsxRuntimeExports.jsxs(V.HoverCard,{children:[t.jsxRuntimeExports.jsx(V.HoverCardTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(X.Button,{onClick:()=>i(u),size:"sm",variant:a===n?"secondary":"ghost",children:o})}),t.jsxRuntimeExports.jsx(V.HoverCardContent,{className:"w-52 border-border",children:t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[t.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),t.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r})]})})})]}),at=()=>{const[,e,r]=h.useCanvasWidth(),[n,a]=h.useSelectedBreakpoints(),u=o=>{n.includes(o)?n.length>2&&a(n.filter(i=>i!==o)):a(i=>[...i,o])};return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[v.map(Ae.filter(o=>v.includes(n,v.toUpper(o.breakpoint))),o=>g.createElement(it,{...o,onClick:r,key:o.breakpoint,currentBreakpoint:e})),t.jsxRuntimeExports.jsxs(V.DropdownMenu,{children:[t.jsxRuntimeExports.jsx(V.DropdownMenuTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:t.jsxRuntimeExports.jsx(W.DotsVerticalIcon,{className:"scale-90 transform"})})}),t.jsxRuntimeExports.jsxs(V.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[t.jsxRuntimeExports.jsx(V.DropdownMenuLabel,{children:"Breakpoints"}),t.jsxRuntimeExports.jsx(V.DropdownMenuSeparator,{}),v.map(Ae,o=>t.jsxRuntimeExports.jsx(V.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(v.toUpper(o.breakpoint)),checked:v.includes(n,v.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},ct=()=>{const[e]=h.useSetAllBlocks(),{createSnapshot:r}=h.useCanvasHistory(),[,n]=h.useSelectedBlockIds(),[,a]=h.useSelectedStylingBlocks(),u=g.useCallback(()=>{e([]),n([]),a([]),r()},[e,r]);return t.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:t.jsxRuntimeExports.jsxs(G.AlertDialog,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs(X.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[t.jsxRuntimeExports.jsx(W.EraserIcon,{})," Clear"]})}),t.jsxRuntimeExports.jsxs(G.AlertDialogContent,{className:"border-border",children:[t.jsxRuntimeExports.jsxs(G.AlertDialogHeader,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogTitle,{children:"Clear whole canvas?"}),t.jsxRuntimeExports.jsx(G.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),t.jsxRuntimeExports.jsxs(G.AlertDialogFooter,{children:[t.jsxRuntimeExports.jsx(G.AlertDialogCancel,{children:"Cancel"}),t.jsxRuntimeExports.jsx(G.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},lt=()=>{const e=h.useFeatureSupport("darkMode",!1),[r]=h.useCanvasZoom();return t.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"})]}):null,t.jsxRuntimeExports.jsx(at,{}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[t.jsxRuntimeExports.jsx(W.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",t.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[v.round(r,0),"%"]})]}),t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(st,{})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[t.jsxRuntimeExports.jsx(se.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(ct,{})]})]})},fe={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},ut=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
@@ -57,4 +57,4 @@ Valid keys: `+JSON.stringify(Object.keys(s),null," "));var c=L(C,P,b,I,S+"."+P,
|
|
|
57
57
|
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
58
58
|
}`)},[n,f]),g.useEffect(()=>{y&&(y.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,n,y]),g.useEffect(()=>{m&&(m.textContent=`${v.map(o,({id:E})=>`[data-style-id="${E}"]`).join(",")}{
|
|
59
59
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
60
|
-
}`)},[o,m]),g.useEffect(()=>{if(e==="section")return;const E=v.get(r,"bodyTextLightColor","#64748b"),B=v.get(r,"bodyTextDarkColor","#94a3b8"),w=v.get(r,"bodyBgLightColor","#FFFFFF"),A=v.get(r,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${E}] bg-[${w}] dark:text-[${B}] dark:bg-[${A}]`},[r,i,e]),e==="page"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[x&&t.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${x.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&x!==R&&t.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&t.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${x}",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},Tt=()=>{const{t:e}=Ne.useTranslation();return t.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:t.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:e("canvas_empty")})})},At=e=>{const r={};return Object.keys(e).forEach(n=>{v.isString(e[n])&&e[n].startsWith(ie.SLOT_KEY)&&(r[n]=e[n].replace(ie.SLOT_KEY,"").split(","))}),r},It=v.memoize(e=>{const r=e.replace(ie.STYLES_KEY,"").split(",");return tt.twMerge(r[0],r[1])});function _t(e,r){return v.get(e,`${r}_attrs`,{})}function Pt(e,r,n,a){const u={};return Object.keys(e).forEach(o=>{if(v.isString(e[o])&&e[o].startsWith(ie.STYLES_KEY)){const i=It(e[o]);u[o]={className:i,"data-style-prop":o,"data-block-parent":e._id,"data-style-id":`${o}-${e._id}`,onMouseEnter:r,onMouseLeave:n,onClick:a,..._t(e,o)}}}),u}function be({blocks:e}){const r=h.useAllBlocks(),[,n]=h.useHighlightBlockId(),[,a]=h.useSelectedStylingBlocks(),[,u]=h.useSelectedBlockIds(),o=g.useCallback(f=>{var x;const m=(x=f.currentTarget)==null?void 0:x.getAttribute("data-style-id");n(m||""),f.stopPropagation()},[n]),i=g.useCallback(f=>{n(""),f.stopPropagation()},[n]),p=g.useCallback(f=>{f.stopPropagation();const m=f.currentTarget;if(m.getAttribute("data-block-parent")){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}]),u([E])}else if(m.getAttribute("data-block-id")&&(u([m.getAttribute("data-block-id")]),m.getAttribute("data-block-parent"))){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}])}},[a,u]),y=g.useCallback(f=>Pt(f,o,i,p),[o,i]);return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((f,m)=>{const x=At(f),R={};v.isEmpty(x)||Object.keys(x).forEach(A=>{R[A]=g.Children.toArray(x[A].map(j=>t.jsxRuntimeExports.jsx(be,{blocks:[v.find(r,{_id:j})]})))});const E=v.filter(r,{_parent:f._id});R.children=E.length?t.jsxRuntimeExports.jsx(be,{blocks:E}):null;const B=rt.getBlockComponent(f._type),w=(B==null?void 0:B.component)||null;return g.createElement(w,{blockProps:{onClick:p,"data-block-id":f._id,"data-block-type":f._type},...f,index:m,...y(f),...R,inBuilder:!0})}))})}const Ot=()=>{const e=h.useAllBlocks();return t.jsxRuntimeExports.jsx(et.Provider,{children:e.length?t.jsxRuntimeExports.jsx(be,{blocks:v.filter(e,r=>v.isEmpty(r._parent))}):t.jsxRuntimeExports.jsx(Tt,{})})},Mt=(e,r)=>e.querySelector(`[data-style-id="${r}"]`),Dt=()=>{const[e]=ee.useAtom(h.networkModeAtom),[r]=h.usePreviewMode(),[n]=h.useCanvasWidth(),[,a]=h.useSelectedBlockIds(),u=h.useSelectedBlock(),[,o]=h.useHighlightBlockId(),i=g.useRef(null),p=g.useRef(null),[y,f]=g.useState({width:0,height:0}),m=dt(y),[x,R]=g.useState(0),[E,B]=g.useState([]),[,w]=g.useState([]),[,A]=ee.useAtom(h.canvasIframeAtom),[j,z]=h.useSelectedStylingBlocks(),q=X.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:$,clientHeight:Y}=p.current;f({width:$,height:Y}),x===0&&R($)},[p,n,x]);const N=($,Y=0)=>{const{top:U}=$.getBoundingClientRect();return U+Y>=0&&U-Y<=window.innerHeight};g.useEffect(()=>{var $,Y;if(u&&u.type!=="Multiple"&&i.current){const U=He(i.current.contentDocument,u._id);U&&(N(U)||(Y=($=i.current)==null?void 0:$.contentWindow)==null||Y.scrollTo({top:U.offsetTop,behavior:"smooth"}),B([U]))}},[u]),g.useEffect(()=>{if(!v.isEmpty(j)&&i.current){const $=Mt(i.current.contentDocument,v.first(j).id);w($?[$]:[null])}else w([null])},[j]);const l=g.useMemo(()=>{let $=ut;return e==="offline"&&($=$.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/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 t.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),z([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:x>0&&!v.isEmpty(m)?{width:r?"100%":x}:{},ref:p,children:t.jsxRuntimeExports.jsxs(bt,{contentDidMount:()=>A(i.current),ref:i,id:"canvas-iframe",style:{width:`${n}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:l,children:[t.jsxRuntimeExports.jsx(St,{}),t.jsxRuntimeExports.jsx(kt,{block:u,selectedBlockElement:v.first(E)}),t.jsxRuntimeExports.jsx(Ct,{model:"page"}),t.jsxRuntimeExports.jsxs(Rt,{children:[q?t.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:t.jsxRuntimeExports.jsx(X.Skeleton,{className:"h-full"})}):t.jsxRuntimeExports.jsx(Ot,{}),t.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Bt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-
|
|
60
|
+
}`)},[o,m]),g.useEffect(()=>{if(e==="section")return;const E=v.get(r,"bodyTextLightColor","#64748b"),B=v.get(r,"bodyTextDarkColor","#94a3b8"),w=v.get(r,"bodyBgLightColor","#FFFFFF"),A=v.get(r,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${E}] bg-[${w}] dark:text-[${B}] dark:bg-[${A}]`},[r,i,e]),e==="page"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[x&&t.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${x.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&x!==R&&t.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&t.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${x}",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},Tt=()=>{const{t:e}=Ne.useTranslation();return t.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:t.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:e("canvas_empty")})})},At=e=>{const r={};return Object.keys(e).forEach(n=>{v.isString(e[n])&&e[n].startsWith(ie.SLOT_KEY)&&(r[n]=e[n].replace(ie.SLOT_KEY,"").split(","))}),r},It=v.memoize(e=>{const r=e.replace(ie.STYLES_KEY,"").split(",");return tt.twMerge(r[0],r[1])});function _t(e,r){return v.get(e,`${r}_attrs`,{})}function Pt(e,r,n,a){const u={};return Object.keys(e).forEach(o=>{if(v.isString(e[o])&&e[o].startsWith(ie.STYLES_KEY)){const i=It(e[o]);u[o]={className:i,"data-style-prop":o,"data-block-parent":e._id,"data-style-id":`${o}-${e._id}`,onMouseEnter:r,onMouseLeave:n,onClick:a,..._t(e,o)}}}),u}function be({blocks:e}){const r=h.useAllBlocks(),[,n]=h.useHighlightBlockId(),[,a]=h.useSelectedStylingBlocks(),[,u]=h.useSelectedBlockIds(),o=g.useCallback(f=>{var x;const m=(x=f.currentTarget)==null?void 0:x.getAttribute("data-style-id");n(m||""),f.stopPropagation()},[n]),i=g.useCallback(f=>{n(""),f.stopPropagation()},[n]),p=g.useCallback(f=>{f.stopPropagation();const m=f.currentTarget;if(m.getAttribute("data-block-parent")){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}]),u([E])}else if(m.getAttribute("data-block-id")&&(u([m.getAttribute("data-block-id")]),m.getAttribute("data-block-parent"))){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}])}},[a,u]),y=g.useCallback(f=>Pt(f,o,i,p),[o,i]);return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((f,m)=>{const x=At(f),R={};v.isEmpty(x)||Object.keys(x).forEach(A=>{R[A]=g.Children.toArray(x[A].map(j=>t.jsxRuntimeExports.jsx(be,{blocks:[v.find(r,{_id:j})]})))});const E=v.filter(r,{_parent:f._id});R.children=E.length?t.jsxRuntimeExports.jsx(be,{blocks:E}):null;const B=rt.getBlockComponent(f._type),w=(B==null?void 0:B.component)||null;return g.createElement(w,{blockProps:{onClick:p,"data-block-id":f._id,"data-block-type":f._type},...f,index:m,...y(f),...R,inBuilder:!0})}))})}const Ot=()=>{const e=h.useAllBlocks();return t.jsxRuntimeExports.jsx(et.Provider,{children:e.length?t.jsxRuntimeExports.jsx(be,{blocks:v.filter(e,r=>v.isEmpty(r._parent))}):t.jsxRuntimeExports.jsx(Tt,{})})},Mt=(e,r)=>e.querySelector(`[data-style-id="${r}"]`),Dt=()=>{const[e]=ee.useAtom(h.networkModeAtom),[r]=h.usePreviewMode(),[n]=h.useCanvasWidth(),[,a]=h.useSelectedBlockIds(),u=h.useSelectedBlock(),[,o]=h.useHighlightBlockId(),i=g.useRef(null),p=g.useRef(null),[y,f]=g.useState({width:0,height:0}),m=dt(y),[x,R]=g.useState(0),[E,B]=g.useState([]),[,w]=g.useState([]),[,A]=ee.useAtom(h.canvasIframeAtom),[j,z]=h.useSelectedStylingBlocks(),q=X.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:$,clientHeight:Y}=p.current;f({width:$,height:Y}),x===0&&R($)},[p,n,x]);const N=($,Y=0)=>{const{top:U}=$.getBoundingClientRect();return U+Y>=0&&U-Y<=window.innerHeight};g.useEffect(()=>{var $,Y;if(u&&u.type!=="Multiple"&&i.current){const U=He(i.current.contentDocument,u._id);U&&(N(U)||(Y=($=i.current)==null?void 0:$.contentWindow)==null||Y.scrollTo({top:U.offsetTop,behavior:"smooth"}),B([U]))}},[u]),g.useEffect(()=>{if(!v.isEmpty(j)&&i.current){const $=Mt(i.current.contentDocument,v.first(j).id);w($?[$]:[null])}else w([null])},[j]);const l=g.useMemo(()=>{let $=ut;return e==="offline"&&($=$.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/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 t.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),z([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:x>0&&!v.isEmpty(m)?{width:r?"100%":x}:{},ref:p,children:t.jsxRuntimeExports.jsxs(bt,{contentDidMount:()=>A(i.current),ref:i,id:"canvas-iframe",style:{width:`${n}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:l,children:[t.jsxRuntimeExports.jsx(St,{}),t.jsxRuntimeExports.jsx(kt,{block:u,selectedBlockElement:v.first(E)}),t.jsxRuntimeExports.jsx(Ct,{model:"page"}),t.jsxRuntimeExports.jsxs(Rt,{children:[q?t.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:t.jsxRuntimeExports.jsx(X.Skeleton,{className:"h-full"})}):t.jsxRuntimeExports.jsx(Ot,{}),t.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Bt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-eafcb8ab.cjs"))),qt=()=>{const e=X.useBuilderProp("mode",fe.STATIC),[r,n]=ee.useAtom(h.addBlocksModalAtom),a={[fe.STATIC]:t.jsxRuntimeExports.jsx(Dt,{}),[fe.FRAMEWORK]:null}[e];return t.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[t.jsxRuntimeExports.jsx(lt,{}),t.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[t.jsxRuntimeExports.jsx(g.Suspense,{fallback:t.jsxRuntimeExports.jsx(X.Skeleton,{className:"h-full"}),children:t.jsxRuntimeExports.jsx(h.ErrorBoundary,{children:a})}),r?t.jsxRuntimeExports.jsx("div",{onClick:()=>n(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:t.jsxRuntimeExports.jsx("div",{onClick:u=>u.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:t.jsxRuntimeExports.jsx(Bt,{})})}):null]})]})};exports.default=qt;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import { S as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import {
|
|
2
|
+
import { S as u, c as p, b as g, d as x, f as h } from "./select-7fddd7c3.js";
|
|
3
|
+
import { sortBy as f, filter as j, get as y, isEmpty as P, capitalize as v, map as b, find as S } from "lodash";
|
|
4
|
+
import { toast as w } from "sonner";
|
|
5
|
+
import { useEffect as C } from "react";
|
|
6
|
+
import { O as N, N as k, u as B, Q as E, R as I } from "./index-9ba9f277.js";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import { BriefcaseIcon as
|
|
8
|
+
import { BriefcaseIcon as L } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-icons";
|
|
10
10
|
import "@radix-ui/react-select";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -29,26 +29,26 @@ import "himalaya";
|
|
|
29
29
|
import "redux-undo";
|
|
30
30
|
import "@react-hookz/web";
|
|
31
31
|
import "@chaibuilder/blocks";
|
|
32
|
-
const
|
|
33
|
-
const { data:
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
|
|
32
|
+
const le = () => {
|
|
33
|
+
const { data: t } = N(), { data: o, isLoading: n } = k(), { syncState: m } = B(), l = E(), [a, s] = I(), i = f(j(o, { type: "STATIC" }), (r) => y(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
|
|
34
|
+
C(() => () => s(null), [s]);
|
|
35
|
+
const c = (r) => {
|
|
36
|
+
if (m !== "SAVED")
|
|
37
|
+
w.error("You have unsaved changes. Please save before changing the page.");
|
|
38
38
|
else {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const d = S(i, { uuid: r });
|
|
40
|
+
l(d);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
return
|
|
43
|
+
return n || P(a) ? null : /* @__PURE__ */ e.jsx(
|
|
44
44
|
"nav",
|
|
45
45
|
{
|
|
46
46
|
className: "flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800",
|
|
47
47
|
"aria-label": "Breadcrumb",
|
|
48
48
|
children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
|
|
49
49
|
/* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
|
|
50
|
-
/* @__PURE__ */ e.jsx(
|
|
51
|
-
|
|
50
|
+
/* @__PURE__ */ e.jsx(L, { className: "w-4 h-4 mr-2" }),
|
|
51
|
+
v(t.name)
|
|
52
52
|
] }) }),
|
|
53
53
|
/* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
54
54
|
/* @__PURE__ */ e.jsx(
|
|
@@ -71,9 +71,9 @@ const ie = () => {
|
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
|
-
/* @__PURE__ */ e.jsxs(
|
|
75
|
-
/* @__PURE__ */ e.jsx(p, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(
|
|
76
|
-
/* @__PURE__ */ e.jsx(x, { children:
|
|
74
|
+
/* @__PURE__ */ e.jsxs(u, { value: a || "", onValueChange: c, children: [
|
|
75
|
+
/* @__PURE__ */ e.jsx(p, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(g, { placeholder: "Page" }) }),
|
|
76
|
+
/* @__PURE__ */ e.jsx(x, { children: b(i, (r) => /* @__PURE__ */ e.jsx(h, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
|
|
77
77
|
] })
|
|
78
78
|
] }) })
|
|
79
79
|
] })
|
|
@@ -81,5 +81,5 @@ const ie = () => {
|
|
|
81
81
|
);
|
|
82
82
|
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
le as default
|
|
85
85
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),s=require("./select-0e32300c.cjs"),t=require("lodash"),j=require("sonner"),q=require("react"),i=require("./index-4462d894.cjs");require("react-i18next");const h=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const p=()=>{const{data:n}=i.useProject(),{data:c,isLoading:l}=i.usePages(),{syncState:x}=i.useSavePage(),d=i.useChangePage(),[u,a]=i.useCurrentPage(),o=t.sortBy(t.filter(c,{type:"STATIC"}),r=>t.get(r,"uuid")===(n==null?void 0:n.homepage)?0:1);q.useEffect(()=>()=>a(null),[a]);const m=r=>{if(x!=="SAVED")j.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=t.find(o,{uuid:r});d(g)}};return l||t.isEmpty(u)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(h.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),t.capitalize(n.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:u||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{children:t.map(o,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
|
@@ -5,7 +5,7 @@ import "@radix-ui/react-tabs";
|
|
|
5
5
|
import "./utils-ac68b2c8.js";
|
|
6
6
|
import "clsx";
|
|
7
7
|
import "tailwind-merge";
|
|
8
|
-
const f = o.lazy(() => import("./UnsplashImages-afaa7706.js")), p = o.lazy(() => import("./UploadImages-
|
|
8
|
+
const f = o.lazy(() => import("./UnsplashImages-afaa7706.js")), p = o.lazy(() => import("./UploadImages-f0ba3215.js")), x = ({
|
|
9
9
|
isModalView: l = !1,
|
|
10
10
|
onSelect: a = () => {
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-68492dc9.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-68492dc9.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-33c1507a.cjs"))),o=({isModalView:a=!1,onSelect:t=()=>{}})=>{const[r,n]=l.useState("unsplash");return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:a?"Select or upload images":"Images"})}),e.jsxRuntimeExports.jsxs(s.Tabs,{value:r,onValueChange:u=>n(u),className:"flex h-full w-full flex-col py-2",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"w-full",children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"unsplash",className:"w-1/2",children:"Unsplash"}),e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"upload",className:"w-1/2",children:"Upload"})]}),r==="unsplash"?e.jsxRuntimeExports.jsx(s.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(x,{isModalView:a,onSelect:t})})}):e.jsxRuntimeExports.jsx(s.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(i,{isModalView:a,onSelect:t})})})]})]})},c=o;exports.default=c;
|
|
@@ -4,7 +4,7 @@ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHor
|
|
|
4
4
|
import { useDrop as be, useDragLayer as ke } from "react-dnd";
|
|
5
5
|
import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
|
|
6
6
|
import { useTranslation as Ce } from "react-i18next";
|
|
7
|
-
import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-
|
|
7
|
+
import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-9ba9f277.js";
|
|
8
8
|
import { c as w } from "./utils-ac68b2c8.js";
|
|
9
9
|
import { useMemo as Fe, lazy as ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
|
|
10
10
|
import { S as Ke } from "./MODIFIERS-c2e02614.js";
|
|
@@ -183,7 +183,7 @@ const es = (s) => {
|
|
|
183
183
|
}, ns = (s) => {
|
|
184
184
|
const t = s.depth * 10 + 16;
|
|
185
185
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
|
|
186
|
-
}, os = ze(() => import("./MarkAsGlobalBlock-
|
|
186
|
+
}, os = ze(() => import("./MarkAsGlobalBlock-37ae563e.js")), rs = () => {
|
|
187
187
|
const [s] = g(), [, t] = Ne();
|
|
188
188
|
return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
|
|
189
189
|
/* @__PURE__ */ e.jsx(ge, {}),
|