@chaibuilder/sdk 1.0.19 → 1.0.21
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-eoo1CzaK.js → AddBlocks-0-e393Fn.js} +29 -27
- package/dist/AddBlocks-p68Cz79o.cjs +3 -0
- package/dist/BrandingOptions-HtNCJO9_.cjs +1 -0
- package/dist/{BrandingOptions-1zbCs5bl.js → BrandingOptions-QqqJ-YRb.js} +15 -22
- package/dist/{CanvasArea-Mpb5yTgf.js → CanvasArea-0hMAhzxn.js} +15 -14
- package/dist/{CanvasArea-AsL1cGRZ.cjs → CanvasArea-pZz5czrV.cjs} +4 -4
- package/dist/{CurrentPage-ddbm_deC.js → CurrentPage-UOkxZISs.js} +16 -15
- package/dist/CurrentPage-phMDH1Ub.cjs +1 -0
- package/dist/Layers-NKZXi2LV.cjs +1 -0
- package/dist/{Layers-3UtlSah_.js → Layers-TB-Lriju.js} +18 -17
- package/dist/MODIFIERS-MLfpKQY1.js +73 -0
- package/dist/MODIFIERS-WFzDQfiT.cjs +1 -0
- package/dist/MarkAsGlobalBlock-5h3wP4zj.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-ySc-D4SB.js → MarkAsGlobalBlock-Pa8po8qP.js} +11 -10
- package/dist/PagesPanel-ffrNyFyp.cjs +1 -0
- package/dist/{PagesPanel-nLcJD9CK.js → PagesPanel-mAMSbYPt.js} +20 -19
- package/dist/ProjectPanel-1ywILLme.cjs +1 -0
- package/dist/{ProjectPanel-sFE2KDi-.js → ProjectPanel-XvsYajju.js} +17 -16
- package/dist/{Settings-UOB68lg0.js → Settings-8AbHXcDP.js} +98 -96
- package/dist/Settings-hdmnT_mI.cjs +1 -0
- package/dist/{SidePanels-IFF2nXXZ.js → SidePanels-LQg3mdC4.js} +28 -27
- package/dist/SidePanels-xaNrI3oK.cjs +1 -0
- package/dist/Topbar-A3WZDrK4.cjs +1 -0
- package/dist/{Topbar-lX9OMPwj.js → Topbar-wA6jhMj9.js} +27 -26
- package/dist/UnsplashImages-E8zPMgJf.cjs +1 -0
- package/dist/{UnsplashImages-u_QTABzi.js → UnsplashImages-mzIO1QeT.js} +9 -8
- package/dist/UploadImages-qEuDUEMn.cjs +1 -0
- package/dist/{UploadImages-gV5xDHIu.js → UploadImages-qMeaY4sk.js} +9 -8
- package/dist/add-page-modal-9deiA1W9.cjs +1 -0
- package/dist/{add-page-modal-1z_f7PxL.js → add-page-modal-oER3yE4F.js} +21 -19
- package/dist/{confirm-alert-ZQ-sxX0X.js → confirm-alert-rDSai_jQ.js} +10 -9
- package/dist/confirm-alert-tH8UCCSF.cjs +1 -0
- package/dist/controls-G0puEH71.js +120 -0
- package/dist/controls-aHZq-q4b.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +72 -71
- package/dist/{delete-page-modal-OnKk3P5L.js → delete-page-modal-QzQdrLYI.js} +22 -21
- package/dist/delete-page-modal-ShTRkqkB.cjs +1 -0
- package/dist/{form-Osm1AmO5.cjs → form-MlgUSEy_.cjs} +1 -1
- package/dist/{form-zZJyZuNH.js → form-vWeEsG9Y.js} +2 -2
- package/dist/functions-eu6BbvqO.cjs +2 -0
- package/dist/functions-hmbWDcnW.js +1108 -0
- package/dist/{index-2EHcmZqL.js → index-G55KtqnU.js} +191 -190
- package/dist/index-T5MFAHA0.cjs +1 -0
- package/dist/{index-2-Cf7p7w.js → index-mLIwGF5W.js} +5439 -5429
- package/dist/{index-vKSUqeQx.cjs → index-pCHSFoQO.cjs} +44 -44
- package/dist/{jsx-runtime-qAwJ85SY.js → jsx-runtime-NV737rRe.js} +1 -1
- package/dist/{jsx-runtime-WKRPbKtm.cjs → jsx-runtime-WUGKV8jN.cjs} +6 -6
- package/dist/lib.cjs +1 -2
- package/dist/lib.js +116 -1208
- package/dist/page-viewer-GPNN1H92.cjs +1 -0
- package/dist/{page-viewer-d2r9KEIw.js → page-viewer-X3IEOrUC.js} +18 -17
- package/dist/project-general-setting-HZeYf9A1.cjs +1 -0
- package/dist/{project-general-setting--Qu-QJlM.js → project-general-setting-oujmeWOG.js} +22 -20
- package/dist/project-seo-setting-3FZQXaTn.cjs +1 -0
- package/dist/{project-seo-setting-v6l-AbZS.js → project-seo-setting-_X6ckVa4.js} +17 -24
- package/dist/render.cjs +1 -1
- package/dist/render.js +39 -43
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/dist/single-page-detail-ILshOKys.cjs +1 -0
- package/dist/{single-page-detail-olLc2XXk.js → single-page-detail-SxboE7TI.js} +47 -45
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +20 -19
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +145 -144
- package/dist/utils-It2K33fU.cjs +1 -0
- package/dist/{Class-nQk08vqd.js → utils-PPBbw5bk.js} +115 -183
- package/package.json +2 -7
- package/dist/AddBlocks-jU0NwP_s.cjs +0 -3
- package/dist/BrandingOptions-DXAH3zCN.cjs +0 -1
- package/dist/Class-RZuPYbUS.cjs +0 -1
- package/dist/CurrentPage-VYXjpKJ-.cjs +0 -1
- package/dist/Layers-cUeI3Uhq.cjs +0 -1
- package/dist/MarkAsGlobalBlock-lYL8cO9x.cjs +0 -1
- package/dist/PagesPanel-iFpq7X9a.cjs +0 -1
- package/dist/ProjectPanel-Nq_fot83.cjs +0 -1
- package/dist/Settings-jiWn1Oof.cjs +0 -1
- package/dist/SidePanels-JhPtKGnL.cjs +0 -1
- package/dist/Topbar-qi5ab8rR.cjs +0 -1
- package/dist/UnsplashImages-a2r7b3kB.cjs +0 -1
- package/dist/UploadImages-jLQgLujd.cjs +0 -1
- package/dist/add-page-modal-iRSIjkvI.cjs +0 -1
- package/dist/blocks.cjs +0 -1
- package/dist/blocks.d.ts +0 -4
- package/dist/blocks.js +0 -20
- package/dist/confirm-alert-z74-fGOT.cjs +0 -1
- package/dist/delete-page-modal-a3Tb8T6e.cjs +0 -1
- package/dist/index-XvLiA8z7.js +0 -1191
- package/dist/index-c8zW_D2V.cjs +0 -1
- package/dist/index-fwo4wa7u.cjs +0 -1
- package/dist/index-gmZcUXyn.js +0 -25
- package/dist/index-l9moYwFE.cjs +0 -9
- package/dist/page-viewer-9OzvKHZd.cjs +0 -1
- package/dist/project-general-setting-15WMnfLc.cjs +0 -1
- package/dist/project-seo-setting-PvLLVhvk.cjs +0 -1
- package/dist/single-page-detail-jIi5lRLh.cjs +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
2
|
-
import
|
|
3
|
-
import { has as z, first as g, isEmpty as w, filter as k, values as
|
|
1
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
+
import v, { createElement as K, useState as j, useCallback as q, useMemo as V, useEffect as W, Suspense as J } from "react";
|
|
3
|
+
import { has as z, first as g, isEmpty as w, filter as k, values as B, groupBy as I, mergeWith as Q, isArray as H, get as X, map as L, includes as P, find as E, uniq as Y, reject as M } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { O as F, j as C, az as
|
|
6
|
-
import { useDrag as
|
|
7
|
-
import { BoxIcon as
|
|
8
|
-
import {
|
|
5
|
+
import { O as F, j as C, az as D, aA as N, aH as Z, aI as $, aK as ee, i as se, a8 as O, bv as re, bw as te, bx as oe, by as le, bz as ae, bA as ie, aM as ce, bB as ne, bC as de, B as me, bD as pe, bE as ue, bF as xe, ae as he, aB as fe, aC as be, aD as A, bp as ge, bi as je, bj as ye, bk as we, bl as ke, S as Be } from "./index-G55KtqnU.js";
|
|
6
|
+
import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
|
|
7
|
+
import { BoxIcon as ve, ExclamationTriangleIcon as Ce, Cross1Icon as Ne } from "@radix-ui/react-icons";
|
|
8
|
+
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/runtime";
|
|
9
9
|
import { Loader as Te } from "lucide-react";
|
|
10
10
|
import { getBlocksFromHTML as Ae } from "./lib.js";
|
|
11
|
-
import {
|
|
11
|
+
import { c as Ie } from "./utils-PPBbw5bk.js";
|
|
12
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
12
13
|
import "@radix-ui/react-toggle";
|
|
13
14
|
import "class-variance-authority";
|
|
14
15
|
import "@radix-ui/react-switch";
|
|
@@ -37,6 +38,7 @@ import "redux-undo";
|
|
|
37
38
|
import "@react-hookz/web";
|
|
38
39
|
import "react-i18next";
|
|
39
40
|
import "himalaya";
|
|
41
|
+
import "./functions-hmbWDcnW.js";
|
|
40
42
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
41
43
|
import "@bobthered/tailwindcss-palette-generator";
|
|
42
44
|
import "@tailwindcss/forms";
|
|
@@ -46,15 +48,15 @@ import "@tailwindcss/line-clamp";
|
|
|
46
48
|
import "clsx";
|
|
47
49
|
import "tailwind-merge";
|
|
48
50
|
const Le = ({ block: s }) => {
|
|
49
|
-
const { type: r, icon: t, label: a } = s, { addCoreBlock: c, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(
|
|
51
|
+
const { type: r, icon: t, label: a } = s, { addCoreBlock: c, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(D), [, o] = h(N), f = () => {
|
|
50
52
|
z(s, "blocks") ? d(G(s.blocks), g(m)) : c(s, g(m)), o(!1), n("layers");
|
|
51
|
-
}, [, x, p] =
|
|
53
|
+
}, [, x, p] = R(() => ({
|
|
52
54
|
type: "CHAI_BLOCK",
|
|
53
55
|
item: s
|
|
54
56
|
}));
|
|
55
57
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
56
58
|
/* @__PURE__ */ e.jsx(
|
|
57
|
-
|
|
59
|
+
_,
|
|
58
60
|
{
|
|
59
61
|
connect: p,
|
|
60
62
|
src: "https://placehold.co/100x30/000000/FFF?text=" + (a || r).replace(/ /g, "+")
|
|
@@ -69,7 +71,7 @@ const Le = ({ block: s }) => {
|
|
|
69
71
|
ref: x,
|
|
70
72
|
className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
71
73
|
children: [
|
|
72
|
-
K(t ||
|
|
74
|
+
K(t || ve, { className: "w-4 h-4 mx-auto" }),
|
|
73
75
|
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || r })
|
|
74
76
|
]
|
|
75
77
|
}
|
|
@@ -79,7 +81,7 @@ const Le = ({ block: s }) => {
|
|
|
79
81
|
] });
|
|
80
82
|
}, Pe = ({ block: s, closePopover: r }) => {
|
|
81
83
|
var p;
|
|
82
|
-
const [t, a] = j(!1), c = se("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, o, f] =
|
|
84
|
+
const [t, a] = j(!1), c = se("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, o, f] = R(
|
|
83
85
|
() => ({
|
|
84
86
|
type: "CHAI_BLOCK",
|
|
85
87
|
item: s
|
|
@@ -99,7 +101,7 @@ const Le = ({ block: s }) => {
|
|
|
99
101
|
);
|
|
100
102
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
101
103
|
/* @__PURE__ */ e.jsx(
|
|
102
|
-
|
|
104
|
+
_,
|
|
103
105
|
{
|
|
104
106
|
connect: f,
|
|
105
107
|
src: "https://placehold.co/100x30/000000/FFF?text=" + ((p = s.name || s.label) == null ? void 0 : p.replace(" ", "+"))
|
|
@@ -124,7 +126,7 @@ const Le = ({ block: s }) => {
|
|
|
124
126
|
)
|
|
125
127
|
] });
|
|
126
128
|
}, Fe = () => {
|
|
127
|
-
const { data: s, isLoading: r } =
|
|
129
|
+
const { data: s, isLoading: r } = O(), t = U(), a = k(B(t), { category: "custom" }), c = I(a, "group"), d = I(s, "group"), [m, n] = j(null), o = V(() => Q(c, d, (l, u) => {
|
|
128
130
|
if (H(l) && H(u))
|
|
129
131
|
return [...l, ...u];
|
|
130
132
|
}), [c, d]), [, f] = h(N), [x, p] = j("Navbar"), b = X(o, x, []);
|
|
@@ -136,7 +138,7 @@ const Le = ({ block: s }) => {
|
|
|
136
138
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
137
139
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
138
140
|
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
139
|
-
] }) :
|
|
141
|
+
] }) : v.Children.toArray(
|
|
140
142
|
L(o, (l, u) => /* @__PURE__ */ e.jsx(
|
|
141
143
|
"li",
|
|
142
144
|
{
|
|
@@ -158,12 +160,12 @@ const Le = ({ block: s }) => {
|
|
|
158
160
|
}
|
|
159
161
|
))
|
|
160
162
|
) }),
|
|
161
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children:
|
|
163
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: v.Children.toArray(
|
|
162
164
|
b.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
163
165
|
) })
|
|
164
166
|
] });
|
|
165
167
|
}, He = () => {
|
|
166
|
-
const [s, r] = j(""), { addPredefinedBlock: t } = F(), [a] = C(), [, c] = h(re), [, d] = h(
|
|
168
|
+
const [s, r] = j(""), { addPredefinedBlock: t } = F(), [a] = C(), [, c] = h(re), [, d] = h(D), [, m] = h(N), n = () => {
|
|
167
169
|
const o = Ae(s);
|
|
168
170
|
t([...o], g(a) || null), r(""), c(!1), d("layers"), m(!1);
|
|
169
171
|
};
|
|
@@ -203,15 +205,15 @@ const Le = ({ block: s }) => {
|
|
|
203
205
|
return !P(S, r);
|
|
204
206
|
const t = s._type;
|
|
205
207
|
return t === "List" ? r === "ListItem" : t === "Table" ? r === "TableHead" || r === "TableBody" : t === "TableHead" || t === "TableBody" ? r === "TableRow" : t === "TableRow" ? r === "TableCell" : t === "Row" ? r === "Column" : !P(S, r);
|
|
206
|
-
},
|
|
207
|
-
const [s, r] = j("core"), [t, a] = j("basic"), c = U(), [, d] = h(xe), [, m] = h(N), [n] = C(), o = he(), f = E(o, { _id: g(n) }), { data: x, isLoading: p } =
|
|
208
|
+
}, Ls = () => {
|
|
209
|
+
const [s, r] = j("core"), [t, a] = j("basic"), c = U(), [, d] = h(xe), [, m] = h(N), [n] = C(), o = he(), f = E(o, { _id: g(n) }), { data: x, isLoading: p } = O(), b = I(
|
|
208
210
|
k(c, (i) => Ee(f, i.type)),
|
|
209
211
|
"category"
|
|
210
212
|
), l = Y(L(b.core, "group"));
|
|
211
213
|
W(() => {
|
|
212
214
|
!P(l, t) && !w(l) && !w(t) && a(g(l));
|
|
213
215
|
}, [l, t]);
|
|
214
|
-
const u = (i) => a((T) => T === i ? "" : i), y = !p && !w(x) || E(
|
|
216
|
+
const u = (i) => a((T) => T === i ? "" : i), y = !p && !w(x) || E(B(c), { category: "custom" }) !== void 0;
|
|
215
217
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
216
218
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
|
|
217
219
|
/* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
|
|
@@ -245,23 +247,23 @@ const Le = ({ block: s }) => {
|
|
|
245
247
|
] })
|
|
246
248
|
}
|
|
247
249
|
),
|
|
248
|
-
s === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(je, { type: "single", value: t, className: "w-full px-3", children:
|
|
250
|
+
s === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(je, { type: "single", value: t, className: "w-full px-3", children: v.Children.toArray(
|
|
249
251
|
L(
|
|
250
252
|
l,
|
|
251
|
-
(i) => M(k(
|
|
253
|
+
(i) => M(k(B(b.core), { group: i }), {
|
|
252
254
|
hidden: !0
|
|
253
255
|
}).length ? /* @__PURE__ */ e.jsxs(ye, { value: i, className: "border-border", children: [
|
|
254
256
|
/* @__PURE__ */ e.jsx(we, { onClick: () => u(i), className: "py-2 capitalize", children: i }),
|
|
255
|
-
/* @__PURE__ */ e.jsx(ke, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children:
|
|
256
|
-
M(k(
|
|
257
|
+
/* @__PURE__ */ e.jsx(ke, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: v.Children.toArray(
|
|
258
|
+
M(k(B(b.core), { group: i }), { hidden: !0 }).map((T) => /* @__PURE__ */ e.jsx(Le, { block: T }))
|
|
257
259
|
) }) })
|
|
258
260
|
] }) : null
|
|
259
261
|
)
|
|
260
262
|
) }) }),
|
|
261
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(
|
|
263
|
+
s === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(Be, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
262
264
|
s === "html" && /* @__PURE__ */ e.jsx(He, {})
|
|
263
265
|
] });
|
|
264
266
|
};
|
|
265
267
|
export {
|
|
266
|
-
|
|
268
|
+
Ls as default
|
|
267
269
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-T5MFAHA0.cjs"),y=require("react-dnd"),w=require("@radix-ui/react-icons"),k=require("@chaibuilder/runtime"),q=require("lucide-react"),A=require("./lib.cjs"),T=require("./utils-It2K33fU.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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");require("./functions-eu6BbvqO.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("clsx");require("tailwind-merge");const C=({block:r})=>{const{type:o,icon:l,label:c}=r,{addCoreBlock:d,addPredefinedBlock:m}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.activePanelAtom),[,i]=g.useAtom(s.addBlocksModalAtom),E=()=>{t.has(r,"blocks")?m(k.syncBlocksWithDefaults(r.blocks),t.first(p)):d(r,t.first(p)),i(!1),x("layers")},[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||o).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:f,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(l||w.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||o})})]})]})},N=({block:r,closePopover:o})=>{var j;const[l,c]=n.useState(!1),d=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=s.useAddBlock(),[x]=s.useSelectedBlockIds(),[,i,E]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),f=n.useCallback(async b=>{if(b.stopPropagation(),t.has(r,"component")){m(r,t.first(x)),o();return}c(!0);const a=await d(r);t.isEmpty(a)||p(k.syncBlocksWithDefaults(a),t.first(x)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=r.name||r.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:l?()=>{}:f,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:[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.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:r.name})})]})]})},I=()=>{const{data:r,isLoading:o}=s.useUILibraryBlocks(),l=k.useChaiBlocks(),c=t.filter(t.values(l),{category:"custom"}),d=t.groupBy(c,"group"),m=t.groupBy(r,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>t.mergeWith(d,m,(a,h)=>{if(t.isArray(a)&&t.isArray(h))return[...a,...h]}),[d,m]),[,E]=g.useAtom(s.addBlocksModalAtom),[f,j]=n.useState("Navbar"),b=t.get(i,f,[]);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:o?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(t.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const R=setTimeout(()=>{j(h)},300);x(R)},onClick:()=>j(h),className:T.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",f===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(b.map(a=>e.jsxRuntimeExports.jsx(N,{block:a,closePopover:()=>E(!1)})))})]})},L=()=>{const[r,o]=n.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[c]=s.useSelectedBlockIds(),[,d]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,p]=g.useAtom(s.addBlocksModalAtom),x=()=>{const i=A.getBlocksFromHTML(r);l([...i],t.first(c)||null),o(""),d(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(s.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(s.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.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(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:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:r,onChange:i=>o(i.target.value),rows:12,placeholder:`<div>
|
|
2
|
+
<h1>Enter code here</h1>
|
|
3
|
+
</div>`,className:"resize-none overflow-x-auto whitespace-pre 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:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(s.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(w.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(s.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."})]})]})]})},v=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],P=(r,o)=>{if(!r)return!t.includes(v,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(v,o)},S=()=>{const[r,o]=n.useState("core"),[l,c]=n.useState("basic"),d=k.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(s.addBlocksModalAtom),[x]=s.useSelectedBlockIds(),i=s.useAllBlocks(),E=t.find(i,{_id:t.first(x)}),{data:f,isLoading:j}=s.useUILibraryBlocks(),b=t.groupBy(t.filter(d,u=>P(E,u.type)),"category"),a=t.uniq(t.map(b.core,"group"));n.useEffect(()=>{!t.includes(a,l)&&!t.isEmpty(a)&&!t.isEmpty(l)&&c(t.first(a))},[a,l]);const h=u=>c(B=>B===u?"":u),R=!j&&!t.isEmpty(f)||t.find(t.values(d),{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:r==="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(w.Cross1Icon,{width:12})," Close"]})]}),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 "+(R?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),R?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"UI 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:n.Children.toArray(t.map(a,u=>t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>h(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).map(B=>e.jsxRuntimeExports.jsx(C,{block:B})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(I,{})}),r==="html"&&e.jsxRuntimeExports.jsx(L,{})]})};exports.default=S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WUGKV8jN.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-T5MFAHA0.cjs"),e=require("./controls-aHZq-q4b.cjs"),R=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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 P(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 v=P(C),p=[{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"}],k=()=>{const r=c.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=c.useBrandingOptions(),a=v.useRef(t);v.useEffect(()=>()=>{R.isEqual(t,a.current)||r(a.current)},[]);const y=({formData:l},n)=>{n&&(i(l),a.current=l)},{bodyFont:f,headingFont:g,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:m,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:S,roundedCorners:O}=t,s={headingFont:e.f({title:"Heading font",default:g,options:p}),bodyFont:e.f({title:"Body font",default:f,options:p}),roundedCorners:e.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:e.y({title:"Primary",default:q}),secondaryColor:e.y({title:"Secondary",default:h}),bodyBgLightColor:e.y({title:"Body Background (Light)",default:S}),bodyBgDarkColor:e.y({title:"Body Background (Dark)",default:x}),bodyTextLightColor:e.y({title:"Body Text (Light)",default:b}),bodyTextDarkColor:e.y({title:"Body Text (Dark)",default:m})},u={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const n=s[l];return u.properties||(u.properties={}),u.properties[l]=n.schema,d[l]=n.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(j,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:u,formData:t,validator:B,onChange:y})})]})};exports.default=k;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { j as i } from "./jsx-runtime-
|
|
1
|
+
import { j as i } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { i as D, x as N } from "./index-
|
|
6
|
-
import { f as p, c as P, y as e } from "./
|
|
5
|
+
import { i as D, x as N } from "./index-G55KtqnU.js";
|
|
6
|
+
import { f as p, c as P, y as e } from "./controls-G0puEH71.js";
|
|
7
7
|
import { isEqual as R } from "lodash";
|
|
8
|
-
import "./
|
|
9
|
-
import "clsx";
|
|
10
|
-
import "tailwind-merge";
|
|
8
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
11
9
|
import "@radix-ui/react-toggle";
|
|
12
10
|
import "class-variance-authority";
|
|
11
|
+
import "./utils-PPBbw5bk.js";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "tailwind-merge";
|
|
13
14
|
import "@radix-ui/react-switch";
|
|
14
15
|
import "@radix-ui/react-slot";
|
|
15
16
|
import "@radix-ui/react-accordion";
|
|
@@ -35,18 +36,10 @@ import "react-quill";
|
|
|
35
36
|
import "jotai";
|
|
36
37
|
import "flat-to-nested";
|
|
37
38
|
import "redux-undo";
|
|
38
|
-
import "
|
|
39
|
+
import "@chaibuilder/runtime";
|
|
39
40
|
import "@react-hookz/web";
|
|
40
41
|
import "react-i18next";
|
|
41
|
-
|
|
42
|
-
import "himalaya";
|
|
43
|
-
import "@mhsdesign/jit-browser-tailwindcss";
|
|
44
|
-
import "@bobthered/tailwindcss-palette-generator";
|
|
45
|
-
import "@tailwindcss/forms";
|
|
46
|
-
import "@tailwindcss/typography";
|
|
47
|
-
import "@tailwindcss/aspect-ratio";
|
|
48
|
-
import "@tailwindcss/line-clamp";
|
|
49
|
-
const m = [
|
|
42
|
+
const d = [
|
|
50
43
|
{ title: "Roboto", value: "Roboto" },
|
|
51
44
|
{ title: "Open Sans", value: "Open Sans" },
|
|
52
45
|
{ title: "Montserrat", value: "Montserrat" },
|
|
@@ -96,11 +89,11 @@ const m = [
|
|
|
96
89
|
{ title: "Lustria", value: "Lustria" },
|
|
97
90
|
{ title: "Ovo", value: "Ovo" },
|
|
98
91
|
{ title: "Suranna", value: "Suranna" }
|
|
99
|
-
],
|
|
100
|
-
const
|
|
92
|
+
], gt = () => {
|
|
93
|
+
const m = D("onSaveBrandingOptions", async () => {
|
|
101
94
|
}), [o, v] = N(), r = s.useRef(o);
|
|
102
95
|
s.useEffect(() => () => {
|
|
103
|
-
R(o, r.current) ||
|
|
96
|
+
R(o, r.current) || m(r.current);
|
|
104
97
|
}, []);
|
|
105
98
|
const c = ({ formData: t }, l) => {
|
|
106
99
|
l && (v(t), r.current = t);
|
|
@@ -118,12 +111,12 @@ const m = [
|
|
|
118
111
|
headingFont: p({
|
|
119
112
|
title: "Heading font",
|
|
120
113
|
default: g,
|
|
121
|
-
options:
|
|
114
|
+
options: d
|
|
122
115
|
}),
|
|
123
116
|
bodyFont: p({
|
|
124
117
|
title: "Body font",
|
|
125
118
|
default: f,
|
|
126
|
-
options:
|
|
119
|
+
options: d
|
|
127
120
|
}),
|
|
128
121
|
roundedCorners: P({
|
|
129
122
|
title: "Rounded Corner",
|
|
@@ -175,5 +168,5 @@ const m = [
|
|
|
175
168
|
] });
|
|
176
169
|
};
|
|
177
170
|
export {
|
|
178
|
-
|
|
171
|
+
gt as default
|
|
179
172
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var lt = (n, t, r) => t in n ? at(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r;
|
|
3
3
|
var q = (n, t, r) => (lt(n, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import { j as e } from "./jsx-runtime-
|
|
4
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
5
5
|
import z, { createElement as ct, useCallback as V, useState as F, useEffect as _, Component as _e, Children as dt, Suspense as Me, useRef as je, useMemo as ut, lazy as pt } from "react";
|
|
6
6
|
import { map as Q, includes as we, toUpper as oe, round as ft, isEmpty as U, first as ee, get as A, isString as he, memoize as ht, each as mt, find as yt, filter as Ne, isNull as gt } from "lodash";
|
|
7
7
|
import { ResetIcon as ke, MobileIcon as Ce, LaptopIcon as vt, DesktopIcon as xt, DotsVerticalIcon as bt, EraserIcon as jt, ZoomInIcon as wt, DragHandleDots2Icon as kt, ArrowUpIcon as Ct, CopyIcon as Tt, TrashIcon as Et } from "@radix-ui/react-icons";
|
|
8
|
-
import { p as me, B as te, W as Le, aM as St, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-
|
|
8
|
+
import { p as me, B as te, W as Le, aM as St, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-G55KtqnU.js";
|
|
9
9
|
import { useTranslation as He } from "react-i18next";
|
|
10
10
|
import { useAtom as J } from "jotai";
|
|
11
11
|
import Te from "react-dom";
|
|
12
|
-
import { g as un, S as Ee, a as Ye } from "./
|
|
13
|
-
import { r as Ke, u as pn, B as fn, E as hn } from "./index-
|
|
12
|
+
import { g as un, S as Ee, a as Ye } from "./MODIFIERS-MLfpKQY1.js";
|
|
13
|
+
import { r as Ke, u as pn, B as fn, E as hn } from "./index-mLIwGF5W.js";
|
|
14
14
|
import { flip as mn } from "@floating-ui/dom";
|
|
15
15
|
import { useFloating as yn, shift as gn } from "@floating-ui/react-dom";
|
|
16
16
|
import { useDrag as vn } from "react-dnd";
|
|
@@ -18,9 +18,11 @@ import { useResizeObserver as xn } from "@react-hookz/web";
|
|
|
18
18
|
import { tailwindcssPaletteGenerator as bn } from "@bobthered/tailwindcss-palette-generator";
|
|
19
19
|
import { Provider as jn } from "react-wrap-balancer";
|
|
20
20
|
import { twMerge as wn } from "tailwind-merge";
|
|
21
|
-
import {
|
|
21
|
+
import { getBlockComponent as kn } from "@chaibuilder/runtime";
|
|
22
22
|
import "@radix-ui/react-toggle";
|
|
23
23
|
import "class-variance-authority";
|
|
24
|
+
import "./utils-PPBbw5bk.js";
|
|
25
|
+
import "clsx";
|
|
24
26
|
import "@radix-ui/react-switch";
|
|
25
27
|
import "@radix-ui/react-slot";
|
|
26
28
|
import "@radix-ui/react-accordion";
|
|
@@ -43,19 +45,18 @@ import "react-icons-picker";
|
|
|
43
45
|
import "react-quill";
|
|
44
46
|
import "flat-to-nested";
|
|
45
47
|
import "redux-undo";
|
|
46
|
-
import "clsx";
|
|
47
48
|
import "i18next";
|
|
48
|
-
import "
|
|
49
|
+
import "react-textarea-autosize";
|
|
50
|
+
import "flagged";
|
|
51
|
+
import "@minoru/react-dnd-treeview";
|
|
49
52
|
import "./lib.js";
|
|
50
53
|
import "himalaya";
|
|
54
|
+
import "./functions-hmbWDcnW.js";
|
|
51
55
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
52
56
|
import "@tailwindcss/forms";
|
|
53
57
|
import "@tailwindcss/typography";
|
|
54
58
|
import "@tailwindcss/aspect-ratio";
|
|
55
59
|
import "@tailwindcss/line-clamp";
|
|
56
|
-
import "react-textarea-autosize";
|
|
57
|
-
import "flagged";
|
|
58
|
-
import "@minoru/react-dnd-treeview";
|
|
59
60
|
import "react-hotkeys-hook";
|
|
60
61
|
import "sonner";
|
|
61
62
|
import "lucide-react";
|
|
@@ -795,7 +796,7 @@ function _n() {
|
|
|
795
796
|
return o.PropTypes = o, o;
|
|
796
797
|
}, ue;
|
|
797
798
|
}
|
|
798
|
-
var
|
|
799
|
+
var ls = ne.exports;
|
|
799
800
|
if (process.env.NODE_ENV !== "production") {
|
|
800
801
|
var Mn = Ke, Nn = !0;
|
|
801
802
|
ne.exports = Rn()(Mn.isElement, Nn);
|
|
@@ -806,7 +807,7 @@ const P = /* @__PURE__ */ un(Ln);
|
|
|
806
807
|
let Xe, Je;
|
|
807
808
|
typeof document < "u" && (Xe = document);
|
|
808
809
|
typeof window < "u" && (Je = window);
|
|
809
|
-
const Ze = z.createContext({ document: Xe, window: Je }), xe = () => z.useContext(Ze), { Provider: Wn, Consumer:
|
|
810
|
+
const Ze = z.createContext({ document: Xe, window: Je }), xe = () => z.useContext(Ze), { Provider: Wn, Consumer: cs } = Ze;
|
|
810
811
|
class Ge extends _e {
|
|
811
812
|
componentDidMount() {
|
|
812
813
|
this.props.contentDidMount();
|
|
@@ -1267,7 +1268,7 @@ const Gn = () => {
|
|
|
1267
1268
|
)
|
|
1268
1269
|
}
|
|
1269
1270
|
);
|
|
1270
|
-
}, tr = pt(() => import("./AddBlocks-
|
|
1271
|
+
}, tr = pt(() => import("./AddBlocks-0-e393Fn.js")), ds = () => {
|
|
1271
1272
|
const [n, t] = J(dn);
|
|
1272
1273
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
1273
1274
|
/* @__PURE__ */ e.jsx(Dn, {}),
|
|
@@ -1292,5 +1293,5 @@ const Gn = () => {
|
|
|
1292
1293
|
] });
|
|
1293
1294
|
};
|
|
1294
1295
|
export {
|
|
1295
|
-
|
|
1296
|
+
ds as default
|
|
1296
1297
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ae=Object.defineProperty;var Pe=(n,t,s)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var U=(n,t,s)=>(Pe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-
|
|
1
|
+
"use strict";var Ae=Object.defineProperty;var Pe=(n,t,s)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var U=(n,t,s)=>(Pe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),h=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),i=require("./index-T5MFAHA0.cjs"),je=require("react-i18next"),Y=require("jotai"),ue=require("react-dom"),K=require("./MODIFIERS-WFzDQfiT.cjs"),V=require("./index-pCHSFoQO.cjs"),Me=require("@floating-ui/dom"),de=require("@floating-ui/react-dom"),_e=require("react-dnd"),Ne=require("@react-hookz/web"),Le=require("@bobthered/tailwindcss-palette-generator"),We=require("react-wrap-balancer"),Fe=require("tailwind-merge"),$e=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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("react-quill");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("flagged");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-eu6BbvqO.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Ue=()=>{const{undoCount:n,redoCount:t,undo:s,redo:c}=i.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{})}),e.jsxRuntimeExports.jsx(i.Button,{disabled:!t,onClick:c,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function He(){const[n,t]=i.useDarkMode(),{t:s}=je.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(i.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"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:[e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${n?"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 pe=({landscape:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.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"}})]}),fe=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(M.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:e.jsxRuntimeExports.jsx(M.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.jsxRuntimeExports.jsx(pe,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:e.jsxRuntimeExports.jsx(pe,{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:e.jsxRuntimeExports.jsx(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],ze=({title:n,content:t,currentBreakpoint:s,breakpoint:c,width:u,icon:o,onClick:a})=>e.jsxRuntimeExports.jsxs(i.HoverCard,{children:[e.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>a(u),size:"sm",variant:c===s?"secondary":"ghost",children:o})}),e.jsxRuntimeExports.jsx(i.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),Ye=()=>{const[,n,t]=i.useCanvasWidth(),[s,c]=i.useSelectedBreakpoints(),u=o=>{s.includes(o)?s.length>2&&c(s.filter(a=>a!==o)):c(a=>[...a,o])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(fe.filter(o=>x.includes(s,x.toUpper(o.breakpoint))),o=>h.createElement(ze,{...o,onClick:t,key:o.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),x.map(fe,o=>e.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(x.toUpper(o.breakpoint)),checked:x.includes(s,x.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},Ke=()=>{const[n]=i.useSetAllBlocks(),{createSnapshot:t}=i.useCanvasHistory(),[,s]=i.useSelectedBlockIds(),[,c]=i.useSelectedStylingBlocks(),u=h.useCallback(()=>{n([]),s([]),c([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},Ve=()=>{const n=i.useFeatureSupport("darkMode",!1),[t]=i.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(He,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ue,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ke,{})]})]})},Xe=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
object-assign
|
|
39
39
|
(c) Sindre Sorhus
|
|
40
40
|
@license MIT
|
|
41
|
-
*/var Q,xe;function Ge(){if(xe)return Q;xe=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function c(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},f=0;f<10;f++)a["_"+String.fromCharCode(f)]=f;var j=Object.getOwnPropertyNames(a).map(function(p){return a[p]});if(j.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(p){R[p]=p}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Q=u()?Object.assign:function(o,a){for(var f,j=c(o),R,p=1;p<arguments.length;p++){f=Object(arguments[p]);for(var d in f)t.call(f,d)&&(j[d]=f[d]);if(n){R=n(f);for(var g=0;g<R.length;g++)s.call(f,R[g])&&(j[R[g]]=f[R[g]])}}return j},Q}var ee,he;function ae(){if(he)return ee;he=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ee=n,ee}var te,me;function Ee(){return me||(me=1,te=Function.call.bind(Object.prototype.hasOwnProperty)),te}var ne,ye;function Je(){if(ye)return ne;ye=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ae(),s={},c=Ee();n=function(o){var a="Warning: "+o;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function u(o,a,f,j,R){if(process.env.NODE_ENV!=="production"){for(var p in o)if(c(o,p)){var d;try{if(typeof o[p]!="function"){var g=Error((j||"React class")+": "+f+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=o[p](a,p,j,f,null,t)}catch(O){d=O}if(d&&!(d instanceof Error)&&n((j||"React class")+": type specification of "+f+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in s)){s[d.message]=!0;var S=R?R():"";n("Failed "+f+" type: "+d.message+(S??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},ne=u,ne}var se,ge;function Qe(){if(ge)return se;ge=1;var n=V.reactIsExports,t=Ge(),s=ae(),c=Ee(),u=Je(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(f){var j="Warning: "+f;typeof console<"u"&&console.error(j);try{throw new Error(j)}catch{}});function a(){return null}return se=function(f,j){var R=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function d(r){var l=r&&(R&&r[R]||r[p]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any
|
|
42
|
-
Valid keys: `+JSON.stringify(Object.keys(r),null," "));var A=_(b,I,y,C,v+"."+I,s);if(A)return A}return null}return B(l)}function X(r){switch(typeof r){case"number":case"string":case"undefined":return!0;case"boolean":return!r;case"object":if(Array.isArray(r))return r.every(X);if(r===null||f(r))return!0;var l=d(r);if(l){var k=l.call(r),E;if(l!==r.entries){for(;!(E=k.next()).done;)if(!X(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function De(r,l){return r==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function
|
|
41
|
+
*/var Q,xe;function Ge(){if(xe)return Q;xe=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function c(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},f=0;f<10;f++)a["_"+String.fromCharCode(f)]=f;var j=Object.getOwnPropertyNames(a).map(function(p){return a[p]});if(j.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(p){R[p]=p}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Q=u()?Object.assign:function(o,a){for(var f,j=c(o),R,p=1;p<arguments.length;p++){f=Object(arguments[p]);for(var d in f)t.call(f,d)&&(j[d]=f[d]);if(n){R=n(f);for(var g=0;g<R.length;g++)s.call(f,R[g])&&(j[R[g]]=f[R[g]])}}return j},Q}var ee,he;function ae(){if(he)return ee;he=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ee=n,ee}var te,me;function Ee(){return me||(me=1,te=Function.call.bind(Object.prototype.hasOwnProperty)),te}var ne,ye;function Je(){if(ye)return ne;ye=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ae(),s={},c=Ee();n=function(o){var a="Warning: "+o;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function u(o,a,f,j,R){if(process.env.NODE_ENV!=="production"){for(var p in o)if(c(o,p)){var d;try{if(typeof o[p]!="function"){var g=Error((j||"React class")+": "+f+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=o[p](a,p,j,f,null,t)}catch(O){d=O}if(d&&!(d instanceof Error)&&n((j||"React class")+": type specification of "+f+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in s)){s[d.message]=!0;var S=R?R():"";n("Failed "+f+" type: "+d.message+(S??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},ne=u,ne}var se,ge;function Qe(){if(ge)return se;ge=1;var n=V.reactIsExports,t=Ge(),s=ae(),c=Ee(),u=Je(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(f){var j="Warning: "+f;typeof console<"u"&&console.error(j);try{throw new Error(j)}catch{}});function a(){return null}return se=function(f,j){var R=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function d(r){var l=r&&(R&&r[R]||r[p]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:F(),arrayOf:N,element:G(),elementType:J(),instanceOf:q,node:Te(),objectOf:W,oneOf:L,oneOfType:Ce,shape:Ie,exact:Be};function O(r,l){return r===l?r!==0||1/r===1/l:r!==r&&l!==l}function w(r,l){this.message=r,this.data=l&&typeof l=="object"?l:{},this.stack=""}w.prototype=Error.prototype;function B(r){if(process.env.NODE_ENV!=="production")var l={},k=0;function E(C,v,b,T,D,I,_){if(T=T||g,I=I||b,_!==s){if(j){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var H=T+":"+b;!l[H]&&k<3&&(o("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),l[H]=!0,k++)}}return v[b]==null?C?v[b]===null?new w("The "+D+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new w("The "+D+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:r(v,b,T,D,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function m(r){function l(k,E,y,C,v,b){var T=k[E],D=$(T);if(D!==r){var I=z(T);return new w("Invalid "+C+" `"+v+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+r+"`."),{expectedType:r})}return null}return B(l)}function F(){return B(a)}function N(r){function l(k,E,y,C,v){if(typeof r!="function")return new w("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[E];if(!Array.isArray(b)){var T=$(b);return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var D=0;D<b.length;D++){var I=r(b,D,y,C,v+"["+D+"]",s);if(I instanceof Error)return I}return null}return B(l)}function G(){function r(l,k,E,y,C){var v=l[k];if(!f(v)){var b=$(v);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return B(r)}function J(){function r(l,k,E,y,C){var v=l[k];if(!n.isValidElementType(v)){var b=$(v);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return B(r)}function q(r){function l(k,E,y,C,v){if(!(k[E]instanceof r)){var b=r.name||g,T=qe(k[E]);return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return B(l)}function L(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),a;function l(k,E,y,C,v){for(var b=k[E],T=0;T<r.length;T++)if(O(b,r[T]))return null;var D=JSON.stringify(r,function(_,A){var H=z(A);return H==="symbol"?String(A):A});return new w("Invalid "+C+" `"+v+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+D+"."))}return B(l)}function W(r){function l(k,E,y,C,v){if(typeof r!="function")return new w("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[E],T=$(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var D in b)if(c(b,D)){var I=r(b,D,y,C,v+"."+D,s);if(I instanceof Error)return I}return null}return B(l)}function Ce(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var l=0;l<r.length;l++){var k=r[l];if(typeof k!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Oe(k)+" at index "+l+"."),a}function E(y,C,v,b,T){for(var D=[],I=0;I<r.length;I++){var _=r[I],A=_(y,C,v,b,T,s);if(A==null)return null;A.data&&c(A.data,"expectedType")&&D.push(A.data.expectedType)}var H=D.length>0?", expected one of type ["+D.join(", ")+"]":"";return new w("Invalid "+b+" `"+T+"` supplied to "+("`"+v+"`"+H+"."))}return B(E)}function Te(){function r(l,k,E,y,C){return X(l[k])?null:new w("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return B(r)}function le(r,l,k,E,y){return new w((r||"React class")+": "+l+" type `"+k+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Ie(r){function l(k,E,y,C,v){var b=k[E],T=$(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var D in r){var I=r[D];if(typeof I!="function")return le(y,C,v,D,z(I));var _=I(b,D,y,C,v+"."+D,s);if(_)return _}return null}return B(l)}function Be(r){function l(k,E,y,C,v){var b=k[E],T=$(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var D=t({},k[E],r);for(var I in D){var _=r[I];if(c(r,I)&&typeof _!="function")return le(y,C,v,I,z(_));if(!_)return new w("Invalid "+C+" `"+v+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[E],null," ")+`
|
|
42
|
+
Valid keys: `+JSON.stringify(Object.keys(r),null," "));var A=_(b,I,y,C,v+"."+I,s);if(A)return A}return null}return B(l)}function X(r){switch(typeof r){case"number":case"string":case"undefined":return!0;case"boolean":return!r;case"object":if(Array.isArray(r))return r.every(X);if(r===null||f(r))return!0;var l=d(r);if(l){var k=l.call(r),E;if(l!==r.entries){for(;!(E=k.next()).done;)if(!X(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function De(r,l){return r==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function $(r){var l=typeof r;return Array.isArray(r)?"array":r instanceof RegExp?"object":De(l,r)?"symbol":l}function z(r){if(typeof r>"u"||r===null)return""+r;var l=$(r);if(l==="object"){if(r instanceof Date)return"date";if(r instanceof RegExp)return"regexp"}return l}function Oe(r){var l=z(r);switch(l){case"array":case"object":return"an "+l;case"boolean":case"date":case"regexp":return"a "+l;default:return l}}function qe(r){return!r.constructor||!r.constructor.name?g:r.constructor.name}return S.checkPropTypes=u,S.resetWarningCache=u.resetWarningCache,S.PropTypes=S,S},se}var re,ve;function et(){if(ve)return re;ve=1;var n=ae();function t(){}function s(){}return s.resetWarningCache=t,re=function(){function c(a,f,j,R,p,d){if(d!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}c.isRequired=c;function u(){return c}var o={array:c,bigint:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:u,element:c,elementType:c,instanceOf:u,node:c,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:s,resetWarningCache:t};return o.PropTypes=o,o},re}var Rt=Z.exports;if(process.env.NODE_ENV!=="production"){var tt=V.reactIsExports,nt=!0;Z.exports=Qe()(tt.isElement,nt)}else Z.exports=et()();var st=Z.exports;const P=K.getDefaultExportFromCjs(st);let be,Re;typeof document<"u"&&(be=document);typeof window<"u"&&(Re=window);const ke=h.createContext({document:be,window:Re}),ce=()=>h.useContext(ke),{Provider:rt,Consumer:kt}=ke;class we extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}U(we,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class ie extends h.Component{constructor(s,c){super(s,c);U(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:c}=this.props;typeof c=="function"?c(s):c&&(c.current=s)});U(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});U(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const c=this.props.contentDidMount,u=this.props.contentDidUpdate,o=s.defaultView||s.parentView,a=e.jsxRuntimeExports.jsx(we,{contentDidMount:c,contentDidUpdate:u,children:e.jsxRuntimeExports.jsx(rt,{value:{document:s,window:o},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),f=this.getMountTarget();return[ue.createPortal(this.props.head,this.getDoc().head),ue.createPortal(a,f)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}U(ie,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),U(ie,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const it=h.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(ie,{...n,forwardedRef:t})),ot=({children:n})=>{const{document:t}=ce(),[s]=i.useSelectedBlockIds(),[c,u]=i.useSelectedStylingBlocks();return h.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(c))return;const o=Se(t,x.first(s));if(o){const a=o.getAttribute("data-style-prop");if(a){const f=o.getAttribute("data-style-id"),j=o.getAttribute("data-block-parent");u([{id:f,prop:a,blockId:j}])}}},100)},[t,s,u,c]),e.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:n})},Se=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),at=()=>{const{window:n}=ce(),[t,s]=i.useSelectedBlockIds(),[,c]=i.useSelectedStylingBlocks(),{undo:u,redo:o}=i.useCanvasHistory(),a=i.useDuplicateBlocks(),[,f]=i.useCutBlockIds(),[,j]=i.useCopyBlockIds(),{pasteBlocks:R}=i.usePasteBlocks(),[,p]=i.usePreviewMode(),d=i.useRemoveBlocks(),{savePage:g}=i.useSavePage(),[S]=Y.useAtom(i.inlineEditingActiveAtom),[,O]=Y.useAtom(i.editLayerNameAtom),w=B=>{B.key==="Enter"&&(B.preventDefault(),t.length===1&&O(x.first(t)))};return h.useEffect(()=>{const B=m=>{if(m.key==="Escape"){s([]),c([]);return}if(w(m),!S&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),d(t)),m.ctrlKey||m.metaKey){if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(S&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),g()),m.key==="z"&&u(),m.key==="y"&&o(),m.key==="d"&&a(t),m.key==="x"&&f(t),m.key==="c"&&j(t),m.key==="v"&&t.length>0&&R(t[0])}};return n.removeEventListener("keydown",B),n.addEventListener("keydown",B),()=>{n.removeEventListener("keydown",B)}},[t,s,u,d,p,o,a,f,j,R,S,g,n]),null},ct=({block:n,label:t})=>{const[,s]=_e.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},lt=({selectedBlockElement:n,block:t})=>{const s=i.useRemoveBlocks(),c=i.useDuplicateBlocks(),[,u]=i.useSelectedBlockIds(),[,o]=i.useSelectedStylingBlocks(),{floatingStyles:a,refs:f,update:j}=de.useFloating({placement:"top-start",middleware:[de.shift(),Me.flip()],elements:{reference:n}});Ne.useResizeObserver(n,()=>j(),n!==null);const R=x.get(t,"_parent",null),p=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:f.setFloating,style:a,onClick:d=>{d.stopPropagation(),d.preventDefault()},onKeyDown:d=>d.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(ct,{label:p,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[R&&e.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{o([]),u([R])}}),i.canDuplicateBlock(x.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>c([t==null?void 0:t._id])}):null,i.canDeleteBlock(x.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},ut=({model:n})=>{const[t]=i.useBrandingOptions(),[s]=i.useSelectedBlockIds(),[c]=i.useDarkMode(),[u]=i.useHighlightBlockId(),[o]=i.useSelectedStylingBlocks(),{document:a,window:f}=ce(),[j]=h.useState(a==null?void 0:a.getElementById("highlighted-block")),[R]=h.useState(a==null?void 0:a.getElementById("selected-block")),[p]=h.useState(a==null?void 0:a.getElementById("selected-styling-block"));h.useEffect(()=>{c?a==null||a.documentElement.classList.add("dark"):a==null||a.documentElement.classList.remove("dark")},[c,a]);const d=x.get(t,"headingFont","DM Sans"),g=x.get(t,"bodyFont","DM Sans");return h.useEffect(()=>{const S=x.get(t,"primaryColor","#000"),O=x.get(t,"secondaryColor","#FFF"),w=Le.tailwindcssPaletteGenerator({colors:[S,O],names:["primary","secondary"]});w.primary.DEFAULT=S,w.secondary.DEFAULT=O;const B=x.get(t,"roundedCorners","0");!f||!f.tailwind||(f.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[d],body:[g]},extend:{borderRadius:{global:`${B||"0"}px`},colors:w}},plugins:[f.tailwind.plugin.withOptions(({prefix:m="ui"}={})=>({addVariant:F})=>{for(const N of["open","checked","selected","active","disabled"])F(`${m}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),F(`${m}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,f,d,g]),h.useEffect(()=>{R&&(R.textContent=`${x.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
|
|
43
43
|
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
44
44
|
}`)},[s,R]),h.useEffect(()=>{j&&(j.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,s,j]),h.useEffect(()=>{p&&(p.textContent=`${x.map(o,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
|
|
45
45
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
46
|
-
}`)},[o,p]),h.useEffect(()=>{if(n==="section")return;const S=x.get(t,"bodyTextLightColor","#64748b"),O=x.get(t,"bodyTextDarkColor","#94a3b8"),w=x.get(t,"bodyBgLightColor","#FFFFFF"),B=x.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${O}] dark:bg-[${B}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${d.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&d!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),d&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${d}",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},dt=()=>{const{t:n}=je.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},pt=n=>{const t={};return Object.keys(n).forEach(s=>{x.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},ft=x.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return
|
|
46
|
+
}`)},[o,p]),h.useEffect(()=>{if(n==="section")return;const S=x.get(t,"bodyTextLightColor","#64748b"),O=x.get(t,"bodyTextDarkColor","#94a3b8"),w=x.get(t,"bodyBgLightColor","#FFFFFF"),B=x.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${O}] dark:bg-[${B}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${d.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&d!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),d&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${d}",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},dt=()=>{const{t:n}=je.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},pt=n=>{const t={};return Object.keys(n).forEach(s=>{x.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},ft=x.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return Fe.twMerge(t[0],t[1])});function xt(n,t){return x.get(n,`${t}_attrs`,{})}function ht(n,t,s,c){const u={};return Object.keys(n).forEach(o=>{if(x.isString(n[o])&&n[o].startsWith(K.STYLES_KEY)){const a=ft(n[o]);u[o]={className:a,"data-style-prop":o,"data-block-parent":n._id,"data-style-id":`${o}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:c,...xt(n,o)}}}),u}function mt(n,t){const s=x.get(n,"_bindings",{});return x.isEmpty(s)?{...n}:(x.each(s,(c,u)=>{x.isString(c)&&x.get(t,c,null)&&(n[u]=x.get(t,c,null))}),n)}function oe({blocks:n}){const t=i.useAllBlocks(),[,s]=i.useHighlightBlockId(),[,c]=i.useSelectedStylingBlocks(),[,u]=i.useSelectedBlockIds(),o=h.useCallback(p=>{var g;const d=(g=p.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(d||""),p.stopPropagation()},[s]),a=h.useCallback(p=>{s(""),p.stopPropagation()},[s]),f=h.useCallback(p=>{p.stopPropagation();const d=p.currentTarget;if(d.getAttribute("data-block-parent")){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}]),u([O])}else if(d.getAttribute("data-block-id")&&(u([d.getAttribute("data-block-id")]),d.getAttribute("data-block-parent"))){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}])}},[c,u]),j=h.useCallback(p=>ht(p,o,a,f),[f,o,a]),[R]=V.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((p,d)=>{const g=pt(p),S={};x.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map(F=>e.jsxRuntimeExports.jsx(oe,{blocks:[x.find(t,{_id:F})]})))});const O=x.filter(t,{_parent:p._id});S.children=O.length?e.jsxRuntimeExports.jsx(oe,{blocks:O}):null;const w=$e.getBlockComponent(p._type),B=x.get(w,"component",null);return x.isNull(B)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${p==null?void 0:p._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(B,{blockProps:{onClick:f,"data-block-id":p._id,"data-block-type":p._type},inBuilder:!0,index:d,...mt(p,R),...j(p),...S})})}))})}const yt=()=>{const n=i.useAllBlocks();return e.jsxRuntimeExports.jsx(We.Provider,{children:x.isEmpty(n)?e.jsxRuntimeExports.jsx(dt,{}):e.jsxRuntimeExports.jsx(V.BlocksExternalDataProvider,{children:e.jsxRuntimeExports.jsx(oe,{blocks:x.filter(n,t=>x.isEmpty(t._parent))})})})},gt=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),vt=()=>{const[n]=Y.useAtom(i.networkModeAtom),[t]=i.usePreviewMode(),[s]=i.useCanvasWidth(),[,c]=i.useSelectedBlockIds(),u=i.useSelectedBlock(),[,o]=i.useHighlightBlockId(),a=h.useRef(null),f=h.useRef(null),[j,R]=h.useState({width:0,height:0}),p=Ze(j),[d,g]=h.useState(0),[S,O]=h.useState([]),[,w]=h.useState([]),[,B]=Y.useAtom(i.canvasIframeAtom),[m,F]=i.useSelectedStylingBlocks(),N=i.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:q,clientHeight:L}=f.current;R({width:q,height:L}),d===0&&g(q)},[f,s,d]);const G=(q,L=0)=>{const{top:W}=q.getBoundingClientRect();return W+L>=0&&W-L<=window.innerHeight};h.useEffect(()=>{var q,L;if(u&&u.type!=="Multiple"&&a.current){const W=Se(a.current.contentDocument,u._id);W&&(G(W)||(L=(q=a.current)==null?void 0:q.contentWindow)==null||L.scrollTo({top:W.offsetTop,behavior:"smooth"}),O([W]))}},[u]),h.useEffect(()=>{if(!x.isEmpty(m)&&a.current){const q=gt(a.current.contentDocument,x.first(m).id);w(q?[q]:[null])}else w([null])},[m]);const J=h.useMemo(()=>{let q=Xe;return n==="offline"&&(q=q.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),q=q.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),q=q.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),q},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{c([]),F([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full",style:d>0&&!x.isEmpty(p)?{width:t?"100%":d}:{},ref:f,children:e.jsxRuntimeExports.jsxs(it,{contentDidMount:()=>B(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...p},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:J,children:[e.jsxRuntimeExports.jsx(at,{}),e.jsxRuntimeExports.jsx(lt,{block:u,selectedBlockElement:x.first(S)}),e.jsxRuntimeExports.jsx(ut,{model:"page"}),e.jsxRuntimeExports.jsxs(ot,{children:[N?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(yt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},jt=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-p68Cz79o.cjs"))),Et=()=>{const[n,t]=Y.useAtom(i.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(Ve,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/80 px-2 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:[e.jsxRuntimeExports.jsx(h.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(V.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(vt,{})})}),n?e.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:s=>s.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:e.jsxRuntimeExports.jsx(jt,{})})}):null]})]})};exports.default=Et;
|