@chaibuilder/sdk 1.1.11 → 1.1.13
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-Rd2EpNMr.js → AddBlocks-A7WofxHV.js} +29 -37
- package/dist/AddBlocks-Yuc4t0Z_.cjs +1 -0
- package/dist/{BrandingOptions-rTaSfm0M.cjs → BrandingOptions-KkPF1OGn.cjs} +1 -1
- package/dist/{BrandingOptions-OVjd8R6I.js → BrandingOptions-wkFrLFI_.js} +2 -2
- package/dist/{CanvasArea-zAT94LPr.js → CanvasArea-chEYQhH8.js} +52 -53
- package/dist/{CanvasArea-_eT3OREW.cjs → CanvasArea-kF46NWZK.cjs} +3 -3
- package/dist/{CurrentPage-awyWzrD1.js → CurrentPage-Wd7F9Egg.js} +15 -23
- package/dist/CurrentPage-p9MaXTOB.cjs +1 -0
- package/dist/{Layers-Iu48BWko.js → Layers-qMOMP2Mi.js} +9 -17
- package/dist/Layers-wQ0Fv9Xc.cjs +1 -0
- package/dist/{MarkAsGlobalBlock--GjBOKA4.js → MarkAsGlobalBlock-Czq45Amf.js} +2 -2
- package/dist/{MarkAsGlobalBlock-GV1kflbN.cjs → MarkAsGlobalBlock-sb3hMXLq.cjs} +1 -1
- package/dist/PagesPanel--maZxwX5.cjs +1 -0
- package/dist/{PagesPanel-FiGBY1m8.js → PagesPanel-ay4uk4mg.js} +7 -15
- package/dist/ProjectPanel-KhIpO7m3.cjs +1 -0
- package/dist/{ProjectPanel-c5QlZgrp.js → ProjectPanel-eLlbfAtj.js} +19 -27
- package/dist/{Settings-FuvoLEbx.js → Settings-lpoxaMDu.js} +8 -16
- package/dist/Settings-n2DpS5Ta.cjs +1 -0
- package/dist/SidePanels-Dud5Xh9L.cjs +1 -0
- package/dist/{SidePanels-2FjCLw9X.js → SidePanels-iRXV69vh.js} +10 -18
- package/dist/{Topbar-qloDpVn7.js → Topbar-dQYhW4iv.js} +2 -2
- package/dist/{Topbar-P3sqe-wG.cjs → Topbar-vqzjB75a.cjs} +1 -1
- package/dist/{UnsplashImages-8p0Vu9j_.cjs → UnsplashImages-3Sh4UZ-7.cjs} +1 -1
- package/dist/{UnsplashImages-aVlfl8Rj.js → UnsplashImages-AL1ASAoD.js} +2 -2
- package/dist/{UploadImages-7xgCWSqx.js → UploadImages-09wuhk2O.js} +2 -2
- package/dist/{UploadImages-PjW68B7L.cjs → UploadImages-mPzLhMiH.cjs} +1 -1
- package/dist/add-page-modal-FPnIWwqA.cjs +1 -0
- package/dist/{add-page-modal-o4WyfyUe.js → add-page-modal-TXREEFPZ.js} +20 -28
- package/dist/{confirm-alert-OQrR9mLj.js → confirm-alert-GkfW9chS.js} +2 -2
- package/dist/{confirm-alert-Wvv7pPyF.cjs → confirm-alert-YNyc3WEo.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +55 -63
- package/dist/{delete-page-modal-pWTbYmMV.js → delete-page-modal-LNME2FwD.js} +20 -28
- package/dist/delete-page-modal-sTbqZPvk.cjs +1 -0
- package/dist/{form-W_17vJvn.js → form-Fk4CaX1A.js} +1 -1
- package/dist/{form-1HQKf4Lc.cjs → form-OhgCJlVA.cjs} +1 -1
- package/dist/functions-ZWGlwlQY.cjs +1 -0
- package/dist/functions-slns6ONz.js +23 -0
- package/dist/html-to-json-kGgp07Hv.js +177 -0
- package/dist/html-to-json-po8on2ju.cjs +1 -0
- package/dist/{index-kVugkp77.cjs → index-61c5wSJn.cjs} +2 -2
- package/dist/{index-D15K4BZT.js → index-89A3jPHh.js} +2 -2
- package/dist/{index-MIe2pKhn.cjs → index-GNmGzavZ.cjs} +1 -1
- package/dist/{index-RYlMCgpN.js → index-Q5q5Y_8a.js} +16 -16
- package/dist/lib.cjs +2 -1
- package/dist/lib.d.ts +2 -65
- package/dist/lib.js +1140 -230
- package/dist/page-viewer-LPx-OTCC.js +110 -0
- package/dist/page-viewer-wQO9oV9h.cjs +1 -0
- package/dist/project-general-setting-8EwuN5lN.cjs +1 -0
- package/dist/{project-general-setting-rHyDn0aW.js → project-general-setting-sSpFUD_Y.js} +8 -16
- package/dist/{project-seo-setting-bW4cNODi.js → project-seo-setting-CGVegBtM.js} +3 -3
- package/dist/{project-seo-setting-uEYqfVt6.cjs → project-seo-setting-R77SKM1I.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.js +44 -50
- package/dist/{single-page-detail-UUVe4WYc.js → single-page-detail-32H1_IG4.js} +54 -62
- package/dist/single-page-detail-nyBEHLtT.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +6 -14
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +65 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/dist/{useAddBlockByDrop-8i3iNtPF.cjs → useAddBlockByDrop-4VH-SMj7.cjs} +1 -1
- package/dist/{useAddBlockByDrop-wiagwec5.js → useAddBlockByDrop-_kyR0iI4.js} +1 -1
- package/dist/utils-tx6hqsHY.cjs +1 -0
- package/dist/{utils-PPBbw5bk.js → utils-zWMk4dB2.js} +18 -17
- package/package.json +1 -1
- package/dist/AddBlocks-YS5XlqpG.cjs +0 -1
- package/dist/CurrentPage-J3WuljO3.cjs +0 -1
- package/dist/Layers-SkyPSf1R.cjs +0 -1
- package/dist/PagesPanel-dzL5sq6p.cjs +0 -1
- package/dist/ProjectPanel-uOP0fGfw.cjs +0 -1
- package/dist/Settings-QxjYc9wt.cjs +0 -1
- package/dist/SidePanels-9tKSnDxd.cjs +0 -1
- package/dist/add-page-modal-1ied5RTu.cjs +0 -1
- package/dist/delete-page-modal-fKBafNSA.cjs +0 -1
- package/dist/functions-JFP-oMsY.js +0 -1109
- package/dist/functions-KMQYiBHf.cjs +0 -2
- package/dist/page-viewer-CijLLu6R.js +0 -118
- package/dist/page-viewer-_mpbB5Lr.cjs +0 -1
- package/dist/project-general-setting-gwcHJ-ow.cjs +0 -1
- package/dist/single-page-detail-aNLmbldV.cjs +0 -1
- package/dist/tailwind-config-OxLD7oFU.cjs +0 -1
- package/dist/tailwind-config-d1VL1lzE.js +0 -62
- package/dist/utils-It2K33fU.cjs +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import B, { createElement as z, useState as
|
|
2
|
+
import B, { createElement as z, useState as b, useCallback as q, useMemo as V, useEffect as U, Suspense as W } from "react";
|
|
3
3
|
import { has as D, first as h, omit as J, isEmpty as j, filter as y, values as k, groupBy as T, mergeWith as K, isArray as P, keys as Q, get as X, map as N, includes as A, find as H, uniq as Y, reject as E } from "lodash";
|
|
4
4
|
import { useAtom as f } from "jotai";
|
|
5
|
-
import { O as I, j as v, _ as Z, av as R, aw as S, aD as $, aE as ee, aG as se, i as te, a8 as _, aq as re, ar as oe, as as le, at as ae, au as F, bp as ce, bq as
|
|
5
|
+
import { O as I, j as v, _ as Z, av as R, aw as S, aD as $, aE as ee, aG as se, i as te, a8 as _, aq as re, ar as oe, as as le, at as ae, au as F, bp as ce, bq as ne, br as ie, bs as de, bt as me, aI as pe, bu as ue, bv as xe, B as he, bw as fe, bx as ge, by as be, ae as je, ax as ye, ay as ke, az as w, bo as Be, bh as ve, bi as Ce, bj as we, bk as Te, S as Ne } from "./index-89A3jPHh.js";
|
|
6
6
|
import { BoxIcon as Ae } from "@radix-ui/react-icons";
|
|
7
7
|
import { syncBlocksWithDefaults as G, useChaiBlocks as O } from "@chaibuilder/runtime";
|
|
8
8
|
import { useFeature as Ie } from "flagged";
|
|
9
9
|
import { Loader as Se } from "lucide-react";
|
|
10
10
|
import { useDrag as Le, DragPreviewImage as Pe } from "react-dnd";
|
|
11
|
-
import {
|
|
11
|
+
import { g as He } from "./html-to-json-kGgp07Hv.js";
|
|
12
12
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
13
13
|
import "@radix-ui/react-toggle";
|
|
14
14
|
import "class-variance-authority";
|
|
15
|
-
import "./utils-
|
|
15
|
+
import "./utils-zWMk4dB2.js";
|
|
16
16
|
import "clsx";
|
|
17
17
|
import "tailwind-merge";
|
|
18
18
|
import "@radix-ui/react-switch";
|
|
@@ -41,17 +41,9 @@ import "redux-undo";
|
|
|
41
41
|
import "@react-hookz/web";
|
|
42
42
|
import "react-i18next";
|
|
43
43
|
import "himalaya";
|
|
44
|
-
import "./functions-JFP-oMsY.js";
|
|
45
|
-
import "@mhsdesign/jit-browser-tailwindcss";
|
|
46
|
-
import "@bobthered/tailwindcss-palette-generator";
|
|
47
|
-
import "@tailwindcss/forms";
|
|
48
|
-
import "@tailwindcss/typography";
|
|
49
|
-
import "@tailwindcss/aspect-ratio";
|
|
50
|
-
import "@tailwindcss/line-clamp";
|
|
51
|
-
import "./tailwind-config-d1VL1lzE.js";
|
|
52
44
|
const Ee = ({ block: s }) => {
|
|
53
|
-
const { type: t, icon: r, label: c } = s, { addCoreBlock:
|
|
54
|
-
D(s, "blocks") ? d(G(s.blocks), h(p)) :
|
|
45
|
+
const { type: t, icon: r, label: c } = s, { addCoreBlock: i, addPredefinedBlock: d } = I(), [p, m] = v(), [, l] = Z(), [, x] = f(R), [, a] = f(S), o = () => {
|
|
46
|
+
D(s, "blocks") ? d(G(s.blocks), h(p)) : i(s, h(p)), a(!1), x("layers");
|
|
55
47
|
}, u = Ie("dnd");
|
|
56
48
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs($, { children: [
|
|
57
49
|
/* @__PURE__ */ e.jsx(ee, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
@@ -59,8 +51,8 @@ const Ee = ({ block: s }) => {
|
|
|
59
51
|
{
|
|
60
52
|
onClick: o,
|
|
61
53
|
type: "button",
|
|
62
|
-
onDragStart: (
|
|
63
|
-
|
|
54
|
+
onDragStart: (g) => {
|
|
55
|
+
g.dataTransfer.setData("text/plain", JSON.stringify(J(s, ["component", "icon"]))), setTimeout(() => {
|
|
64
56
|
m([]), l(null), a(!1), x("layers");
|
|
65
57
|
}, 200);
|
|
66
58
|
},
|
|
@@ -76,7 +68,7 @@ const Ee = ({ block: s }) => {
|
|
|
76
68
|
] }) });
|
|
77
69
|
}, Fe = ({ block: s, closePopover: t }) => {
|
|
78
70
|
var o;
|
|
79
|
-
const [r, c] =
|
|
71
|
+
const [r, c] = b(!1), i = te("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: p } = I(), [m] = v(), [, l, x] = Le(
|
|
80
72
|
() => ({
|
|
81
73
|
type: "CHAI_BLOCK",
|
|
82
74
|
item: s
|
|
@@ -89,8 +81,8 @@ const Ee = ({ block: s }) => {
|
|
|
89
81
|
return;
|
|
90
82
|
}
|
|
91
83
|
c(!0);
|
|
92
|
-
const
|
|
93
|
-
j(
|
|
84
|
+
const g = await i(s);
|
|
85
|
+
j(g) || p(G(g), h(m)), t();
|
|
94
86
|
},
|
|
95
87
|
[s]
|
|
96
88
|
);
|
|
@@ -128,10 +120,10 @@ const Ee = ({ block: s }) => {
|
|
|
128
120
|
)
|
|
129
121
|
] });
|
|
130
122
|
}, Me = () => {
|
|
131
|
-
const { data: s } = _(), t = O(), r = y(k(t), { category: "custom" }), c = T(r, "group"),
|
|
123
|
+
const { data: s } = _(), t = O(), r = y(k(t), { category: "custom" }), c = T(r, "group"), i = T(s, "group"), d = V(() => K(c, i, (a, o) => {
|
|
132
124
|
if (P(a) && P(o))
|
|
133
125
|
return [...a, ...o];
|
|
134
|
-
}), [c,
|
|
126
|
+
}), [c, i]), [, p] = f(S), [m, l] = b(h(Q(d)) || ""), x = X(d, m, []);
|
|
135
127
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
|
|
136
128
|
/* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(re, { value: m, onValueChange: (a) => l(a), children: [
|
|
137
129
|
/* @__PURE__ */ e.jsx(oe, { className: "w-full", children: /* @__PURE__ */ e.jsx(le, { placeholder: "Select a provider" }) }),
|
|
@@ -147,12 +139,12 @@ const Ee = ({ block: s }) => {
|
|
|
147
139
|
) })
|
|
148
140
|
] });
|
|
149
141
|
}, De = () => {
|
|
150
|
-
const [s, t] =
|
|
142
|
+
const [s, t] = b(""), { addPredefinedBlock: r } = I(), [c] = v(), [, i] = f(ce), [, d] = f(R), [, p] = f(S), m = () => {
|
|
151
143
|
const l = He(s);
|
|
152
|
-
r([...l], h(c) || null), t(""),
|
|
144
|
+
r([...l], h(c) || null), t(""), i(!1), d("layers"), p(!1);
|
|
153
145
|
};
|
|
154
|
-
return /* @__PURE__ */ e.jsxs(
|
|
155
|
-
/* @__PURE__ */ e.jsx(
|
|
146
|
+
return /* @__PURE__ */ e.jsxs(ne, { className: "border-border/0 p-0 shadow-none", children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx(ie, { className: "p-3", children: /* @__PURE__ */ e.jsx(de, { children: "Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code." }) }),
|
|
156
148
|
/* @__PURE__ */ e.jsx(me, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
157
149
|
/* @__PURE__ */ e.jsx(pe, { htmlFor: "current", className: "text-sm", children: "Tailwind HTML snippet:" }),
|
|
158
150
|
/* @__PURE__ */ e.jsx(
|
|
@@ -171,7 +163,7 @@ const Ee = ({ block: s }) => {
|
|
|
171
163
|
] }) }),
|
|
172
164
|
/* @__PURE__ */ e.jsxs(xe, { className: "flex flex-col justify-end p-3", children: [
|
|
173
165
|
/* @__PURE__ */ e.jsx(he, { disabled: s.trim() === "", onClick: () => m(), size: "sm", className: "w-full", children: "Import HTML" }),
|
|
174
|
-
/* @__PURE__ */ e.jsx(fe, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(
|
|
166
|
+
/* @__PURE__ */ e.jsx(fe, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(ge, { className: "text-xs font-normal leading-4", children: "NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." }) })
|
|
175
167
|
] })
|
|
176
168
|
] });
|
|
177
169
|
}, M = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Re = (s, t) => {
|
|
@@ -179,15 +171,15 @@ const Ee = ({ block: s }) => {
|
|
|
179
171
|
return !A(M, t);
|
|
180
172
|
const r = s._type;
|
|
181
173
|
return r === "List" ? t === "ListItem" : r === "Table" ? t === "TableHead" || t === "TableBody" : r === "TableHead" || r === "TableBody" ? t === "TableRow" : r === "TableRow" ? t === "TableCell" : r === "Row" ? t === "Column" : !A(M, t);
|
|
182
|
-
},
|
|
183
|
-
const [s, t] =
|
|
184
|
-
y(
|
|
174
|
+
}, As = () => {
|
|
175
|
+
const [s, t] = b("core"), [r, c] = b("basic"), i = O(), [, d] = f(be), [p] = v(), m = je(), l = H(m, { _id: h(p) }), { data: x, isLoading: a } = _(), o = T(
|
|
176
|
+
y(i, (n) => Re(l, n.type)),
|
|
185
177
|
"category"
|
|
186
178
|
), u = Y(N(o.core, "group"));
|
|
187
179
|
U(() => {
|
|
188
180
|
!A(u, r) && !j(u) && !j(r) && c(h(u));
|
|
189
181
|
}, [u, r]);
|
|
190
|
-
const
|
|
182
|
+
const g = (n) => c((C) => C === n ? "" : n), L = !a && !j(x) || H(k(i), { category: "custom" }) !== void 0;
|
|
191
183
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
192
184
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
193
185
|
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: "Add block" }),
|
|
@@ -196,8 +188,8 @@ const Ee = ({ block: s }) => {
|
|
|
196
188
|
/* @__PURE__ */ e.jsx(
|
|
197
189
|
ye,
|
|
198
190
|
{
|
|
199
|
-
onValueChange: (
|
|
200
|
-
d(""), t(
|
|
191
|
+
onValueChange: (n) => {
|
|
192
|
+
d(""), t(n);
|
|
201
193
|
},
|
|
202
194
|
value: s,
|
|
203
195
|
className: "h-max",
|
|
@@ -211,12 +203,12 @@ const Ee = ({ block: s }) => {
|
|
|
211
203
|
s === "core" && /* @__PURE__ */ e.jsx(Be, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(ve, { type: "single", value: r, className: "w-full px-3", children: B.Children.toArray(
|
|
212
204
|
N(
|
|
213
205
|
u,
|
|
214
|
-
(
|
|
206
|
+
(n) => E(y(k(o.core), { group: n }), {
|
|
215
207
|
hidden: !0
|
|
216
|
-
}).length ? /* @__PURE__ */ e.jsxs(Ce, { value:
|
|
217
|
-
/* @__PURE__ */ e.jsx(we, { onClick: () =>
|
|
208
|
+
}).length ? /* @__PURE__ */ e.jsxs(Ce, { value: n, className: "border-border", children: [
|
|
209
|
+
/* @__PURE__ */ e.jsx(we, { onClick: () => g(n), className: "py-2 capitalize", children: n }),
|
|
218
210
|
/* @__PURE__ */ e.jsx(Te, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: B.Children.toArray(
|
|
219
|
-
E(y(k(o.core), { group:
|
|
211
|
+
E(y(k(o.core), { group: n }), { hidden: !0 }).map((C) => /* @__PURE__ */ e.jsx(Ee, { block: C }))
|
|
220
212
|
) }) })
|
|
221
213
|
] }) : null
|
|
222
214
|
)
|
|
@@ -226,5 +218,5 @@ const Ee = ({ block: s }) => {
|
|
|
226
218
|
] });
|
|
227
219
|
};
|
|
228
220
|
export {
|
|
229
|
-
|
|
221
|
+
As as default
|
|
230
222
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-GNmGzavZ.cjs"),v=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),T=require("flagged"),q=require("lucide-react"),B=require("react-dnd"),A=require("./html-to-json-po8on2ju.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-tx6hqsHY.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");const C=({block:r})=>{const{type:o,icon:l,label:d}=r,{addCoreBlock:x,addPredefinedBlock:m}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,n]=s.useHighlightBlockId(),[,f]=g.useAtom(s.activePanelAtom),[,c]=g.useAtom(s.addBlocksModalAtom),i=()=>{t.has(r,"blocks")?m(b.syncBlocksWithDefaults(r.blocks),t.first(j)):x(r,t.first(j)),c(!1),f("layers")},h=T.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:i,type:"button",onDragStart:E=>{E.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),n(null),c(!1),f("layers")},200)},draggable:h?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(h?"cursor-grab":"cursor-pointer"),children:[a.createElement(l||v.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||o})})]})})},w=({block:r,closePopover:o})=>{var i;const[l,d]=a.useState(!1),x=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,n,f]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),c=a.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){m(r,t.first(p)),o();return}d(!0);const E=await x(r);t.isEmpty(E)||j(b.syncBlocksWithDefaults(E),t.first(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:f,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:n,onClick:l?()=>{}:c,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(q.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},N=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),d=t.groupBy(l,"group"),x=t.groupBy(r,"group"),m=a.useMemo(()=>t.mergeWith(d,x,(c,i)=>{if(t.isArray(c)&&t.isArray(i))return[...c,...i]}),[d,x]),[,j]=g.useAtom(s.addBlocksModalAtom),[p,n]=a.useState(t.first(t.keys(m))||""),f=t.get(m,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:c=>n(c),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),a.Children.toArray(t.map(m,(c,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(f.map(c=>e.jsxRuntimeExports.jsx(w,{block:c,closePopover:()=>j(!1)})))})]})},S=()=>{const[r,o]=a.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,j]=g.useAtom(s.addBlocksModalAtom),p=()=>{const n=A.getBlocksFromHTML(r);l([...n],t.first(d)||null),o(""),x(!1),m("layers"),j(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:"Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code."})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:"Tailwind HTML snippet:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:r,onChange:n=>o(n.target.value),rows:12,placeholder:"Enter your code snippet here...",className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:"NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],I=(r,o)=>{if(!r)return!t.includes(k,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(k,o)},L=()=>{const[r,o]=a.useState("core"),[l,d]=a.useState("basic"),x=b.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[j]=s.useSelectedBlockIds(),p=s.useAllBlocks(),n=t.find(p,{_id:t.first(j)}),{data:f,isLoading:c}=s.useUILibraryBlocks(),i=t.groupBy(t.filter(x,u=>I(n,u.type)),"category"),h=t.uniq(t.map(i.core,"group"));a.useEffect(()=>{!t.includes(h,l)&&!t.isEmpty(h)&&!t.isEmpty(l)&&d(t.first(h))},[h,l]);const E=u=>d(R=>R===u?"":u),y=!c&&!t.isEmpty(f)||t.find(t.values(x),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:"Add block"}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r==="html"?"(Enter or paste TailwindCSS HTML snippet)":"(Click to add block to page)"})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(y?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),y?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"Custom Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import "})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:a.Children.toArray(t.map(h,u=>t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>E(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).map(R=>e.jsxRuntimeExports.jsx(C,{block:R})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(N,{})}),r==="html"&&e.jsxRuntimeExports.jsx(S,{})]})};exports.default=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),R=require("@rjsf/core"),g=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),R=require("@rjsf/core"),g=require("./index-GNmGzavZ.cjs"),r=require("./controls-aHZq-q4b.cjs"),m=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-tx6hqsHY.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(j),E=({value:t,onChange:e,id:i,onBlur:a})=>{const d=m.debounce(e,200),c=n=>d(n.target.value);return l.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:l.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:l.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:n}})=>a(i,n),onChange:c})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=g.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=g.useBrandingOptions(),a=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,a.current)||t(a.current)},[]);const d=({formData:o},s)=>{s&&(i(o),a.current=o)},{bodyFont:c,headingFont:n,primaryColor:y,bodyTextDarkColor:q,bodyTextLightColor:b,bodyBgDarkColor:h,secondaryColor:S,bodyBgLightColor:C,roundedCorners:O}=e,v={headingFont:r.f({title:"Heading font",default:n,options:f}),bodyFont:r.f({title:"Body font",default:c,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:r.y({title:"Primary",default:y}),secondaryColor:r.y({title:"Secondary",default:S}),bodyBgLightColor:r.y({title:"Body Background (Light)",default:C}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:h}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:q}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:b})},u={type:"object",properties:{}},p={};return Object.keys(v).forEach(o=>{const s=v[o];return u.properties||(u.properties={}),u.properties[o]=s.schema,p[o]=s.uiSchema,!0}),l.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[l.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:l.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),l.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:l.jsxRuntimeExports.jsx(R,{widgets:{color:E},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:p,schema:u,formData:e,validator:B,onChange:d})})]})};exports.default=P;
|
|
@@ -2,13 +2,13 @@ import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import N from "@rjsf/core";
|
|
5
|
-
import { i as j, x as k } from "./index-
|
|
5
|
+
import { i as j, x as k } from "./index-89A3jPHh.js";
|
|
6
6
|
import { f as g, c as D, y as a } from "./controls-G0puEH71.js";
|
|
7
7
|
import { debounce as P, isEqual as R } from "lodash";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
10
10
|
import "class-variance-authority";
|
|
11
|
-
import "./utils-
|
|
11
|
+
import "./utils-zWMk4dB2.js";
|
|
12
12
|
import "clsx";
|
|
13
13
|
import "tailwind-merge";
|
|
14
14
|
import "@radix-ui/react-switch";
|
|
@@ -4,26 +4,26 @@ var J = (e, t, n) => (bt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
|
4
4
|
import { j as r } from "./jsx-runtime-NV737rRe.js";
|
|
5
5
|
import X, { createElement as wt, useCallback as we, useState as U, useEffect as _, Component as Ue, Children as kt, Suspense as ze, useRef as De, useMemo as jt, lazy as Ct } from "react";
|
|
6
6
|
import { map as ie, includes as Be, toUpper as ue, round as Tt, throttle as Ye, noop as ee, isEmpty as K, first as ae, omit as St, pick as It, get as O, isString as ke, memoize as Et, each as Dt, find as Bt, filter as Ke, isNull as Ot } from "lodash";
|
|
7
|
-
import { ResetIcon as Oe, MobileIcon as Ae, LaptopIcon as At, DesktopIcon as Pt, DotsVerticalIcon as Rt, EraserIcon as Mt, ZoomInIcon as _t, DragHandleDots2Icon as Lt, ArrowUpIcon as Nt, CopyIcon as
|
|
8
|
-
import { p as je, B as le, W as Je, aI as Wt, aJ as Ht, aK as qt, aL as Ut, aM as zt, R as Ce, ai as Yt, aN as Kt, aO as Jt, aP as Xt, aQ as Vt, aR as Zt, aS as Gt, w as Qt, j as W, aj as V, D as en, E as tn, F as nn, G as rn, H as sn, I as on, J as an, K as ln, ap as cn, L as dn, U as Xe, aH as oe, aT as un, _ as G, ab as pn, aU as re, ae as Te, m as Ve, n as fn, k as hn, o as gn, h as Ze, l as Ge, ag as mn, aV as yn, aW as Qe, aX as vn, aY as xn, x as bn, a as wn, aZ as kn, a_ as jn, a6 as Cn, a$ as Tn, i as Sn, S as et, aw as In } from "./index-
|
|
7
|
+
import { ResetIcon as Oe, MobileIcon as Ae, LaptopIcon as At, DesktopIcon as Pt, DotsVerticalIcon as Rt, EraserIcon as Mt, ZoomInIcon as _t, DragHandleDots2Icon as Lt, ArrowUpIcon as Nt, CopyIcon as Ft, TrashIcon as $t } from "@radix-ui/react-icons";
|
|
8
|
+
import { p as je, B as le, W as Je, aI as Wt, aJ as Ht, aK as qt, aL as Ut, aM as zt, R as Ce, ai as Yt, aN as Kt, aO as Jt, aP as Xt, aQ as Vt, aR as Zt, aS as Gt, w as Qt, j as W, aj as V, D as en, E as tn, F as nn, G as rn, H as sn, I as on, J as an, K as ln, ap as cn, L as dn, U as Xe, aH as oe, aT as un, _ as G, ab as pn, aU as re, ae as Te, m as Ve, n as fn, k as hn, o as gn, h as Ze, l as Ge, ag as mn, aV as yn, aW as Qe, aX as vn, aY as xn, x as bn, a as wn, aZ as kn, a_ as jn, a6 as Cn, a$ as Tn, i as Sn, S as et, aw as In } from "./index-89A3jPHh.js";
|
|
9
9
|
import { useTranslation as En } from "react-i18next";
|
|
10
|
-
import { useAtom as
|
|
10
|
+
import { useAtom as F } from "jotai";
|
|
11
11
|
import Pe from "react-dom";
|
|
12
12
|
import { g as Dn, S as Re, a as tt } from "./MODIFIERS-MLfpKQY1.js";
|
|
13
|
-
import { r as nt, u as Bn, B as On, E as An } from "./index-
|
|
13
|
+
import { r as nt, u as Bn, B as On, E as An } from "./index-Q5q5Y_8a.js";
|
|
14
14
|
import { Quill as Pn } from "react-quill";
|
|
15
|
-
import { u as Rn } from "./useAddBlockByDrop-
|
|
15
|
+
import { u as Rn } from "./useAddBlockByDrop-_kyR0iI4.js";
|
|
16
16
|
import { useFeature as rt } from "flagged";
|
|
17
17
|
import { flip as Mn } from "@floating-ui/dom";
|
|
18
18
|
import { useFloating as _n, shift as Ln } from "@floating-ui/react-dom";
|
|
19
19
|
import { useResizeObserver as Nn } from "@react-hookz/web";
|
|
20
|
-
import { tailwindcssPaletteGenerator as
|
|
21
|
-
import { Provider as
|
|
20
|
+
import { tailwindcssPaletteGenerator as Fn } from "@bobthered/tailwindcss-palette-generator";
|
|
21
|
+
import { Provider as $n } from "react-wrap-balancer";
|
|
22
22
|
import { twMerge as Wn } from "tailwind-merge";
|
|
23
23
|
import { getBlockComponent as Hn } from "@chaibuilder/runtime";
|
|
24
24
|
import "@radix-ui/react-toggle";
|
|
25
25
|
import "class-variance-authority";
|
|
26
|
-
import "./utils-
|
|
26
|
+
import "./utils-zWMk4dB2.js";
|
|
27
27
|
import "clsx";
|
|
28
28
|
import "@radix-ui/react-switch";
|
|
29
29
|
import "@radix-ui/react-slot";
|
|
@@ -50,17 +50,10 @@ import "i18next";
|
|
|
50
50
|
import "react-textarea-autosize";
|
|
51
51
|
import "react-dnd";
|
|
52
52
|
import "@minoru/react-dnd-treeview";
|
|
53
|
-
import "./lib.js";
|
|
54
|
-
import "himalaya";
|
|
55
|
-
import "./functions-JFP-oMsY.js";
|
|
56
|
-
import "@mhsdesign/jit-browser-tailwindcss";
|
|
57
|
-
import "@tailwindcss/forms";
|
|
58
|
-
import "@tailwindcss/typography";
|
|
59
|
-
import "@tailwindcss/aspect-ratio";
|
|
60
|
-
import "@tailwindcss/line-clamp";
|
|
61
|
-
import "./tailwind-config-d1VL1lzE.js";
|
|
62
53
|
import "react-hotkeys-hook";
|
|
63
54
|
import "sonner";
|
|
55
|
+
import "./html-to-json-kGgp07Hv.js";
|
|
56
|
+
import "himalaya";
|
|
64
57
|
import "lucide-react";
|
|
65
58
|
const qn = () => {
|
|
66
59
|
const { undoCount: e, redoCount: t, undo: n, redo: i } = je();
|
|
@@ -310,9 +303,15 @@ const Me = ({ landscape: e = !1 }) => /* @__PURE__ */ r.jsxs(
|
|
|
310
303
|
const [t] = Ce(), [, n] = Xe(), [i, l] = U({}), o = we(() => {
|
|
311
304
|
const { width: d, height: s } = e;
|
|
312
305
|
if (d < t) {
|
|
313
|
-
const u = parseFloat((d / t).toString());
|
|
306
|
+
const u = parseFloat((d / t).toFixed(2).toString());
|
|
314
307
|
let c = {};
|
|
315
|
-
|
|
308
|
+
const f = s * u;
|
|
309
|
+
s && (c = {
|
|
310
|
+
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
311
|
+
height: 100 + (s - f) / f * 100 + "%"
|
|
312
|
+
}), l({
|
|
313
|
+
position: "relative",
|
|
314
|
+
top: 0,
|
|
316
315
|
transform: `scale(${u})`,
|
|
317
316
|
transformOrigin: "top left",
|
|
318
317
|
...c,
|
|
@@ -386,15 +385,15 @@ function Se() {
|
|
|
386
385
|
var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
387
386
|
return fe = e, fe;
|
|
388
387
|
}
|
|
389
|
-
var he,
|
|
388
|
+
var he, Fe;
|
|
390
389
|
function st() {
|
|
391
|
-
return
|
|
390
|
+
return Fe || (Fe = 1, he = Function.call.bind(Object.prototype.hasOwnProperty)), he;
|
|
392
391
|
}
|
|
393
|
-
var ge,
|
|
392
|
+
var ge, $e;
|
|
394
393
|
function Gn() {
|
|
395
|
-
if (
|
|
394
|
+
if ($e)
|
|
396
395
|
return ge;
|
|
397
|
-
|
|
396
|
+
$e = 1;
|
|
398
397
|
var e = function() {
|
|
399
398
|
};
|
|
400
399
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -477,7 +476,7 @@ function Qn() {
|
|
|
477
476
|
any: A(),
|
|
478
477
|
arrayOf: k,
|
|
479
478
|
element: N(),
|
|
480
|
-
elementType:
|
|
479
|
+
elementType: $(),
|
|
481
480
|
instanceOf: B,
|
|
482
481
|
node: ft(),
|
|
483
482
|
objectOf: q,
|
|
@@ -562,7 +561,7 @@ function Qn() {
|
|
|
562
561
|
}
|
|
563
562
|
return E(a);
|
|
564
563
|
}
|
|
565
|
-
function
|
|
564
|
+
function $() {
|
|
566
565
|
function a(p, b, y, g, j) {
|
|
567
566
|
var m = p[b];
|
|
568
567
|
if (!e.isValidElementType(m)) {
|
|
@@ -811,7 +810,7 @@ function er() {
|
|
|
811
810
|
return o.PropTypes = o, o;
|
|
812
811
|
}, ye;
|
|
813
812
|
}
|
|
814
|
-
var
|
|
813
|
+
var Os = ce.exports;
|
|
815
814
|
if (process.env.NODE_ENV !== "production") {
|
|
816
815
|
var tr = nt, nr = !0;
|
|
817
816
|
ce.exports = Qn()(tr.isElement, nr);
|
|
@@ -822,7 +821,7 @@ const M = /* @__PURE__ */ Dn(rr);
|
|
|
822
821
|
let ot, it;
|
|
823
822
|
typeof document < "u" && (ot = document);
|
|
824
823
|
typeof window < "u" && (it = window);
|
|
825
|
-
const at = X.createContext({ document: ot, window: it }), de = () => X.useContext(at), { Provider: sr, Consumer:
|
|
824
|
+
const at = X.createContext({ document: ot, window: it }), de = () => X.useContext(at), { Provider: sr, Consumer: As } = at;
|
|
826
825
|
class lt extends Ue {
|
|
827
826
|
componentDidMount() {
|
|
828
827
|
this.props.contentDidMount();
|
|
@@ -968,7 +967,7 @@ function ve() {
|
|
|
968
967
|
e.style.display = "none";
|
|
969
968
|
}
|
|
970
969
|
const dr = () => {
|
|
971
|
-
const { document: e } = de(), [t, n] =
|
|
970
|
+
const { document: e } = de(), [t, n] = F(un), i = Rn(), l = rt("dnd"), [, o] = G(), [, d] = W();
|
|
972
971
|
return Y = e, {
|
|
973
972
|
isDragging: t,
|
|
974
973
|
"data-dnd": "branch",
|
|
@@ -1005,7 +1004,7 @@ function ur(e) {
|
|
|
1005
1004
|
t && t.parentNode.removeChild(t), e = null;
|
|
1006
1005
|
}
|
|
1007
1006
|
const pr = () => {
|
|
1008
|
-
const e = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], t = pn(), [, n] = W(), [, i] = G(), [l, o] =
|
|
1007
|
+
const e = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], t = pn(), [, n] = W(), [, i] = G(), [l, o] = F(re);
|
|
1009
1008
|
return (d) => {
|
|
1010
1009
|
var w;
|
|
1011
1010
|
if (l)
|
|
@@ -1025,7 +1024,7 @@ const pr = () => {
|
|
|
1025
1024
|
c.addEventListener("blur", h, !0), f.focus(), (w = c.querySelector(".ql-clipboard")) == null || w.remove(), n([]), o(s.getAttribute("data-block-id"));
|
|
1026
1025
|
};
|
|
1027
1026
|
}, fr = () => {
|
|
1028
|
-
const [, e] = V(), [, t] = W(), [n] =
|
|
1027
|
+
const [, e] = V(), [, t] = W(), [n] = F(re);
|
|
1029
1028
|
return (i) => {
|
|
1030
1029
|
if (n)
|
|
1031
1030
|
return;
|
|
@@ -1041,7 +1040,7 @@ const pr = () => {
|
|
|
1041
1040
|
const n = Ie(e.target);
|
|
1042
1041
|
n != null && n.getAttribute("data-style-id") && t(n.getAttribute("data-style-id"));
|
|
1043
1042
|
}, 100), gr = () => {
|
|
1044
|
-
const [, e] = G(), [t] =
|
|
1043
|
+
const [, e] = G(), [t] = F(re);
|
|
1045
1044
|
return (n) => {
|
|
1046
1045
|
t || hr(n, e);
|
|
1047
1046
|
};
|
|
@@ -1075,7 +1074,7 @@ const pr = () => {
|
|
|
1075
1074
|
}
|
|
1076
1075
|
);
|
|
1077
1076
|
}, ut = (e, t) => e.querySelector(`[data-block-id="${t}"]`), yr = () => {
|
|
1078
|
-
const { window: e } = de(), [t, n] = W(), i = Te(), [, l] = V(), { undo: o, redo: d } = je(), s = Ve(), [, u] = fn(), [, c] = hn(), { pasteBlocks: f } = gn(), [, h] = Ze(), w = Ge(), { savePage: S } = mn(), [P] =
|
|
1077
|
+
const { window: e } = de(), [t, n] = W(), i = Te(), [, l] = V(), { undo: o, redo: d } = je(), s = Ve(), [, u] = fn(), [, c] = hn(), { pasteBlocks: f } = gn(), [, h] = Ze(), w = Ge(), { savePage: S } = mn(), [P] = F(re), [, x] = F(yn), E = (A) => {
|
|
1079
1078
|
A.key === "Enter" && (A.preventDefault(), t.length === 1 && x(ae(t)));
|
|
1080
1079
|
}, D = (A) => {
|
|
1081
1080
|
const k = i.find((N) => N._id === A);
|
|
@@ -1120,7 +1119,7 @@ const pr = () => {
|
|
|
1120
1119
|
e
|
|
1121
1120
|
]), null;
|
|
1122
1121
|
}, vr = ({ block: e, label: t }) => {
|
|
1123
|
-
const [, n] = W(), [, i] = G(), [, l] =
|
|
1122
|
+
const [, n] = W(), [, i] = G(), [, l] = F(Qe), o = rt("dnd");
|
|
1124
1123
|
return /* @__PURE__ */ r.jsxs(
|
|
1125
1124
|
"div",
|
|
1126
1125
|
{
|
|
@@ -1171,14 +1170,14 @@ const pr = () => {
|
|
|
1171
1170
|
}
|
|
1172
1171
|
}
|
|
1173
1172
|
),
|
|
1174
|
-
vn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx(
|
|
1175
|
-
xn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx(
|
|
1173
|
+
vn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx(Ft, { className: "hover:scale-105 ", onClick: () => i([t == null ? void 0 : t._id]) }) : null,
|
|
1174
|
+
xn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx($t, { className: "hover:scale-105 ", onClick: () => n([t == null ? void 0 : t._id]) }) : null
|
|
1176
1175
|
] })
|
|
1177
1176
|
]
|
|
1178
1177
|
}
|
|
1179
1178
|
);
|
|
1180
1179
|
}, br = ({ model: e }) => {
|
|
1181
|
-
const [t] = bn(), [n] = W(), [i] = Je(), [l] = G(), [o] = V(), [d] =
|
|
1180
|
+
const [t] = bn(), [n] = W(), [i] = Je(), [l] = G(), [o] = V(), [d] = F(Qe), { document: s, window: u } = de(), [c] = U(s == null ? void 0 : s.getElementById("highlighted-block")), [f] = U(
|
|
1182
1181
|
s == null ? void 0 : s.getElementById("selected-block")
|
|
1183
1182
|
), [h] = U(
|
|
1184
1183
|
s == null ? void 0 : s.getElementById("selected-styling-block")
|
|
@@ -1188,7 +1187,7 @@ const pr = () => {
|
|
|
1188
1187
|
}, [i, s]);
|
|
1189
1188
|
const S = O(t, "headingFont", "DM Sans"), P = O(t, "bodyFont", "DM Sans");
|
|
1190
1189
|
return _(() => {
|
|
1191
|
-
const x = O(t, "primaryColor", "#000"), E = O(t, "secondaryColor", "#FFF"), D =
|
|
1190
|
+
const x = O(t, "primaryColor", "#000"), E = O(t, "secondaryColor", "#FFF"), D = Fn({
|
|
1192
1191
|
colors: [x, E],
|
|
1193
1192
|
names: ["primary", "secondary"]
|
|
1194
1193
|
});
|
|
@@ -1211,13 +1210,13 @@ const pr = () => {
|
|
|
1211
1210
|
plugins: [
|
|
1212
1211
|
// @ts-ignore
|
|
1213
1212
|
u.tailwind.plugin.withOptions(({ prefix: k = "ui" } = {}) => ({ addVariant: N }) => {
|
|
1214
|
-
for (const
|
|
1215
|
-
N(`${k}-${
|
|
1216
|
-
`&[data-headlessui-state~="${
|
|
1217
|
-
`:where([data-headlessui-state~="${
|
|
1218
|
-
]), N(`${k}-not-${
|
|
1219
|
-
`&[data-headlessui-state]:not([data-headlessui-state~="${
|
|
1220
|
-
`:where([data-headlessui-state]:not([data-headlessui-state~="${
|
|
1213
|
+
for (const $ of ["open", "checked", "selected", "active", "disabled"])
|
|
1214
|
+
N(`${k}-${$}`, [
|
|
1215
|
+
`&[data-headlessui-state~="${$}"]`,
|
|
1216
|
+
`:where([data-headlessui-state~="${$}"]) &`
|
|
1217
|
+
]), N(`${k}-not-${$}`, [
|
|
1218
|
+
`&[data-headlessui-state]:not([data-headlessui-state~="${$}"])`,
|
|
1219
|
+
`:where([data-headlessui-state]:not([data-headlessui-state~="${$}"])) &:not([data-headlessui-state])`
|
|
1221
1220
|
]);
|
|
1222
1221
|
})
|
|
1223
1222
|
]
|
|
@@ -1335,9 +1334,9 @@ function be({ blocks: e }) {
|
|
|
1335
1334
|
}
|
|
1336
1335
|
const Sr = () => {
|
|
1337
1336
|
const e = Te();
|
|
1338
|
-
return /* @__PURE__ */ r.jsx(
|
|
1337
|
+
return /* @__PURE__ */ r.jsx($n, { children: K(e) ? null : /* @__PURE__ */ r.jsx(On, { children: /* @__PURE__ */ r.jsx(be, { blocks: Ke(e, (t) => K(t._parent)) }) }) });
|
|
1339
1338
|
}, Ir = (e, t) => e.querySelector(`[data-style-id="${t}"]`), Er = () => {
|
|
1340
|
-
const [e] =
|
|
1339
|
+
const [e] = F(jn), [t] = Ze(), [n] = Ce(), [, i] = W(), l = Cn(), [, o] = G(), d = De(null), s = De(null), [u, c] = U({ width: 0, height: 0 }), f = Vn(u), [h, w] = U(0), [S, P] = U([]), [, x] = U([]), [, E] = F(Tn), [D, A] = V(), k = Sn("loadingCanvas", !1);
|
|
1341
1340
|
_(() => {
|
|
1342
1341
|
const { clientWidth: B, clientHeight: H } = s.current;
|
|
1343
1342
|
c({ width: B, height: H }), h === 0 && w(B);
|
|
@@ -1362,7 +1361,7 @@ const Sr = () => {
|
|
|
1362
1361
|
} else
|
|
1363
1362
|
x([null]);
|
|
1364
1363
|
}, [D]);
|
|
1365
|
-
const
|
|
1364
|
+
const $ = jt(() => {
|
|
1366
1365
|
let B = Xn;
|
|
1367
1366
|
return e === "offline" && (B = B.replace(
|
|
1368
1367
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
@@ -1386,8 +1385,8 @@ const Sr = () => {
|
|
|
1386
1385
|
ref: d,
|
|
1387
1386
|
id: "canvas-iframe",
|
|
1388
1387
|
style: { width: `${n}px`, ...f },
|
|
1389
|
-
className: "relative mx-auto box-content
|
|
1390
|
-
initialContent:
|
|
1388
|
+
className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
1389
|
+
initialContent: $,
|
|
1391
1390
|
children: [
|
|
1392
1391
|
/* @__PURE__ */ r.jsx(yr, {}),
|
|
1393
1392
|
/* @__PURE__ */ r.jsx(
|
|
@@ -1406,8 +1405,8 @@ const Sr = () => {
|
|
|
1406
1405
|
)
|
|
1407
1406
|
}
|
|
1408
1407
|
);
|
|
1409
|
-
}, Dr = Ct(() => import("./AddBlocks-
|
|
1410
|
-
const [e, t] =
|
|
1408
|
+
}, Dr = Ct(() => import("./AddBlocks-A7WofxHV.js")), Ps = () => {
|
|
1409
|
+
const [e, t] = F(In);
|
|
1411
1410
|
return /* @__PURE__ */ r.jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
1412
1411
|
/* @__PURE__ */ r.jsx(Jn, {}),
|
|
1413
1412
|
/* @__PURE__ */ r.jsxs("div", { className: "relative h-full overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
|
|
@@ -1431,5 +1430,5 @@ const Sr = () => {
|
|
|
1431
1430
|
] });
|
|
1432
1431
|
};
|
|
1433
1432
|
export {
|
|
1434
|
-
|
|
1433
|
+
Ps as default
|
|
1435
1434
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),L=require("@radix-ui/react-icons"),r=require("./index-
|
|
1
|
+
"use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),L=require("@radix-ui/react-icons"),r=require("./index-GNmGzavZ.cjs"),Ue=require("react-i18next"),H=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-61c5wSJn.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-4VH-SMj7.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-tx6hqsHY.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-po8on2ju.cjs");require("himalaya");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
2
|
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.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 me=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),ye=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(L.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:s.jsxRuntimeExports.jsx(L.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(me,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(me,{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:s.jsxRuntimeExports.jsx(L.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(L.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:a,width:c,icon:i,onClick:u})=>s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>u(c),size:"sm",variant:a===n?"secondary":"ghost",children:i})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,a]=r.useSelectedBreakpoints(),c=i=>{n.includes(i)?n.length>2&&a(n.filter(u=>u!==i)):a(u=>[...u,i])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(ye.filter(i=>x.includes(n,x.toUpper(i.breakpoint))),i=>m.createElement(tt,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(L.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),x.map(ye,i=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>c(x.toUpper(i.breakpoint)),checked:x.includes(n,x.toUpper(i.breakpoint)),children:i.title},i.breakpoint))]})]})]})},st=()=>{const[e]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),c=m.useCallback(()=>{e([]),n([]),a([]),t()},[e,t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(L.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(L.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Qe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<div class="frame-root"></div>
|
|
48
48
|
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
49
49
|
</body>
|
|
50
|
-
</html>`,it=e=>{const[t]=r.useCanvasWidth(),[,n]=r.useCanvasZoom(),[a,c]=m.useState({}),i=m.useCallback(()=>{const{width:u,height:o}=e;if(u<t){const p=parseFloat((u/t).toString());let d={};o&&(d={height:
|
|
50
|
+
</html>`,it=e=>{const[t]=r.useCanvasWidth(),[,n]=r.useCanvasZoom(),[a,c]=m.useState({}),i=m.useCallback(()=>{const{width:u,height:o}=e;if(u<t){const p=parseFloat((u/t).toFixed(2).toString());let d={};const h=o*p;o&&(d={height:100+(o-h)/h*100+"%"}),c({position:"relative",top:0,transform:`scale(${p})`,transformOrigin:"top left",...d,maxWidth:"none"}),n(p*100)}else c({}),n(100)},[t,e,n]);return m.useEffect(()=>{i()},[t,e,n,i]),a};var te={exports:{}};/*
|
|
51
51
|
object-assign
|
|
52
52
|
(c) Sindre Sorhus
|
|
53
53
|
@license MIT
|
|
@@ -56,4 +56,4 @@ Valid keys: `+JSON.stringify(Object.keys(l),null," "));var M=N(b,T,y,S,v+"."+T,
|
|
|
56
56
|
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
57
57
|
}`)},[n,h]),m.useEffect(()=>{if(!u){w.textContent="";return}w.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{d&&(d.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[c,n,d]),m.useEffect(()=>{g&&(g.textContent=`${x.map(i,({id:E})=>`[data-style-id="${E}"]`).join(",")}{
|
|
58
58
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
59
|
-
}`)},[i,g]),m.useEffect(()=>{const E=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),D=x.get(t,"bodyBgLightColor","#FFFFFF"),q=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${E}] bg-[${D}] dark:text-[${A}] dark:bg-[${q}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),P&&I!==P&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${P.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,c)=>{x.isString(a)&&x.get(t,a,null)&&(e[c]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[c]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(c===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(w=>{p[w]=m.Children.toArray(o[w].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},_t=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Lt=()=>{const[e]=H.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),c=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,w]=m.useState(0),[I,P]=m.useState([]),[,E]=m.useState([]),[,A]=H.useAtom(r.canvasIframeAtom),[D,q]=r.useSelectedStylingBlocks(),R=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:O,clientHeight:$}=o.current;d({width:O,height:$}),g===0&&w(O)},[o,n,g]);const F=(O,$=0)=>{const{top:U}=O.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};m.useEffect(()=>{var O,$;if(c&&c.type!=="Multiple"&&u.current){const U=qe(u.current.contentDocument,c._id);U&&(F(U)||($=(O=u.current)==null?void 0:O.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),P([U]))}},[c]),m.useEffect(()=>{if(!x.isEmpty(D)&&u.current){const O=_t(u.current.contentDocument,x.first(D).id);E(O?[O]:[null])}else E([null])},[D]);const W=m.useMemo(()=>{let O=ot;return e==="offline"&&(O=O.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),q([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content
|
|
59
|
+
}`)},[i,g]),m.useEffect(()=>{const E=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),D=x.get(t,"bodyBgLightColor","#FFFFFF"),q=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${E}] bg-[${D}] dark:text-[${A}] dark:bg-[${q}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),P&&I!==P&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${P.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,c)=>{x.isString(a)&&x.get(t,a,null)&&(e[c]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[c]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(c===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(w=>{p[w]=m.Children.toArray(o[w].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},_t=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Lt=()=>{const[e]=H.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),c=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,w]=m.useState(0),[I,P]=m.useState([]),[,E]=m.useState([]),[,A]=H.useAtom(r.canvasIframeAtom),[D,q]=r.useSelectedStylingBlocks(),R=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:O,clientHeight:$}=o.current;d({width:O,height:$}),g===0&&w(O)},[o,n,g]);const F=(O,$=0)=>{const{top:U}=O.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};m.useEffect(()=>{var O,$;if(c&&c.type!=="Multiple"&&u.current){const U=qe(u.current.contentDocument,c._id);U&&(F(U)||($=(O=u.current)==null?void 0:O.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),P([U]))}},[c]),m.useEffect(()=>{if(!x.isEmpty(D)&&u.current){const O=_t(u.current.contentDocument,x.first(D).id);E(O?[O]:[null])}else E([null])},[D]);const W=m.useMemo(()=>{let O=ot;return e==="offline"&&(O=O.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),q([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:W,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:c,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:R?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-Yuc4t0Z_.cjs"))),Ft=()=>{const[e,t]=H.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Lt,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
|