@chaibuilder/sdk 0.1.11 → 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-9d1873e7.js → AddBlocks-73aa52ed.js} +46 -46
- package/dist/{AddBlocks-12a3610b.cjs → AddBlocks-eafcb8ab.cjs} +2 -2
- package/dist/{BrandingOptions-7439ff1e.cjs → BrandingOptions-45caece9.cjs} +1 -1
- package/dist/{BrandingOptions-69d302c5.js → BrandingOptions-6e8c6721.js} +1 -1
- package/dist/{CanvasArea-7424817c.js → CanvasArea-3049f560.js} +2 -2
- package/dist/{CanvasArea-6f24eabe.cjs → CanvasArea-a392ffc1.cjs} +2 -2
- package/dist/{CurrentPage-1e98746d.js → CurrentPage-3d3209a1.js} +1 -1
- package/dist/{CurrentPage-526d5497.cjs → CurrentPage-def95a2d.cjs} +1 -1
- package/dist/{Layers-8233c000.js → Layers-23512777.js} +2 -2
- package/dist/{Layers-1fa4a7ad.cjs → Layers-3bdb61c3.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-46fcc533.js → MarkAsGlobalBlock-37ae563e.js} +1 -1
- package/dist/{MarkAsGlobalBlock-9b4b1f4f.cjs → MarkAsGlobalBlock-d10b749d.cjs} +1 -1
- package/dist/{PagesPanel-4aafb70f.cjs → PagesPanel-2e626ee0.cjs} +1 -1
- package/dist/{PagesPanel-51d88965.js → PagesPanel-a0cb2a3c.js} +2 -2
- package/dist/{ProjectPanel-0748603f.cjs → ProjectPanel-453caab3.cjs} +1 -1
- package/dist/{ProjectPanel-af75d218.js → ProjectPanel-590ad7b5.js} +2 -2
- package/dist/{Settings-29f58509.js → Settings-201df828.js} +2 -2
- package/dist/{Settings-c184ce31.cjs → Settings-3f024a5e.cjs} +1 -1
- package/dist/{SidePanels-54124742.js → SidePanels-2135b1a7.js} +2 -2
- package/dist/{SidePanels-279903d7.cjs → SidePanels-2d310a73.cjs} +1 -1
- package/dist/{Topbar-c52e0d3e.js → Topbar-4e436076.js} +1 -1
- package/dist/{Topbar-c7ce8963.cjs → Topbar-f722a517.cjs} +1 -1
- package/dist/{add-page-modal-6be96646.cjs → add-page-modal-17cd6043.cjs} +1 -1
- package/dist/{add-page-modal-fda0926e.js → add-page-modal-e38900bd.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-0aa98758.js → delete-page-modal-69202329.js} +1 -1
- package/dist/{delete-page-modal-d7a7059c.cjs → delete-page-modal-7e833472.cjs} +1 -1
- package/dist/{form-1ead8a4a.js → form-52b48fbc.js} +1 -1
- package/dist/{form-d82a2694.cjs → form-e9748a4e.cjs} +1 -1
- package/dist/{index-2524cb40.cjs → index-4462d894.cjs} +2 -2
- package/dist/{index-d0cc5c76.js → index-9ba9f277.js} +5 -4
- package/dist/{link-fcfa7b45.cjs → link-26d3158f.cjs} +1 -1
- package/dist/{link-82714c4b.js → link-eeef0a29.js} +5 -5
- package/dist/{page-viewer-a53f2a9b.cjs → page-viewer-2fb5485c.cjs} +1 -1
- package/dist/{page-viewer-b65e1389.js → page-viewer-ddaba8df.js} +2 -2
- package/dist/{project-general-setting-40d772a0.js → project-general-setting-5810b457.js} +3 -3
- package/dist/{project-general-setting-c4907c79.cjs → project-general-setting-fc4ea1f6.cjs} +1 -1
- package/dist/{project-seo-setting-245555ef.js → project-seo-setting-23fb5e80.js} +2 -2
- package/dist/{project-seo-setting-5a54c6a6.cjs → project-seo-setting-b3372d3f.cjs} +1 -1
- package/dist/{single-page-detail-5e2a7ffe.cjs → single-page-detail-128a33a7.cjs} +1 -1
- package/dist/{single-page-detail-15c218dc.js → single-page-detail-359a0806.js} +4 -4
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/package.json +1 -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;
|
|
@@ -3,7 +3,7 @@ import { S as u, c as p, b as g, d as x, f as h } from "./select-7fddd7c3.js";
|
|
|
3
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
4
|
import { toast as w } from "sonner";
|
|
5
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-
|
|
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
8
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-icons";
|
|
@@ -1 +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-
|
|
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;
|
|
@@ -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, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-2524cb40.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-9b4b1f4f.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-4462d894.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-d10b749d.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
|
|
@@ -2,7 +2,7 @@ import { j as l } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import { GlobeIcon as m } from "@radix-ui/react-icons";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
4
|
import { B as i } from "./useBuilderProp-81a14920.js";
|
|
5
|
-
import { _ as c } from "./index-
|
|
5
|
+
import { _ as c } from "./index-9ba9f277.js";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import { capitalize as p } from "lodash";
|
|
8
8
|
import "@radix-ui/react-slot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-4462d894.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");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");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-4462d894.cjs");require("i18next");require("react-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("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");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");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-17cd6043.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-2fb5485c.cjs"))),c=()=>{const{data:u=[],isLoading:n}=t.usePages(),{data:r}=t.useProject(),o=s.sortBy(s.filter(u,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("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:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
|