@chaibuilder/sdk 1.2.23 → 1.2.25
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/README.md +6 -5
- package/dist/AddBlocks-Ol3iIVKa.js +207 -0
- package/dist/AddBlocks-a1c-7Ewz.cjs +1 -0
- package/dist/BrandingOptions-6rnt0UaA.cjs +1 -0
- package/dist/{BrandingOptions-eUSoIgjj.js → BrandingOptions-iTyWpwTs.js} +40 -54
- package/dist/CanvasArea-R4ogF9AT.cjs +55 -0
- package/dist/{CanvasArea-ulUy_rmB.js → CanvasArea-dZjng782.js} +340 -324
- package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +163 -0
- package/dist/ChaiBuilderEditor-vP4at00I.js +27974 -0
- package/dist/{Class-lGzsNBOK.js → Class-ahc3NIbq.js} +26 -29
- package/dist/Class-eieto7e-.cjs +1 -0
- package/dist/Controls-3Cc1XYXg.js +105 -0
- package/dist/Controls-ky25Ebo3.cjs +1 -0
- package/dist/CurrentPage-3gQTH0Zt.cjs +1 -0
- package/dist/{CurrentPage-SFhXzQMy.js → CurrentPage-Kmfp-kFk.js} +41 -55
- package/dist/Functions-Hvon6AMZ.cjs +1 -0
- package/dist/Functions-NzT2Six_.js +15 -0
- package/dist/ImagesPanel-J1RlG7xG.cjs +1 -0
- package/dist/ImagesPanel-Wb0GF_NA.js +29 -0
- package/dist/ListTree-CZ-mtjZ9.cjs +1 -0
- package/dist/{ListTree-ZeVWczTF.js → ListTree-N3jeD790.js} +92 -102
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-CNqNUapY.js} +10 -4
- package/dist/MODIFIERS-o1p3VnpS.cjs +1 -0
- package/dist/PagesPanel-Gi0z6gaf.cjs +1 -0
- package/dist/PagesPanel-u1IB-nRr.js +48 -0
- package/dist/ProjectPanel-EydGZmMW.js +71 -0
- package/dist/ProjectPanel-kiiljG4H.cjs +1 -0
- package/dist/{STRINGS--j49GZJP.js → STRINGS-b432aBJJ.js} +2 -2
- package/dist/Settings-8ilCSH8b.cjs +1 -0
- package/dist/{Settings-FZWm8Fc3.js → Settings-jCcd-VE6.js} +407 -401
- package/dist/SidePanels-T36C6Lhc.cjs +1 -0
- package/dist/{SidePanels-wrkkpcGE.js → SidePanels-pHMYprpW.js} +107 -117
- package/dist/Topbar-CvWQuspR.cjs +1 -0
- package/dist/Topbar-pbIDUE_B.js +122 -0
- package/dist/UnsplashImages-KBZPd9dv.cjs +1 -0
- package/dist/{UnsplashImages-eZedbK2J.js → UnsplashImages-L7x_3RQf.js} +50 -63
- package/dist/UploadImages-GkkJVAgG.cjs +1 -0
- package/dist/{UploadImages-71QziLbr.js → UploadImages-zdEJRLD8.js} +37 -60
- package/dist/accordion-oPUeqPCZ.js +42 -0
- package/dist/accordion-ynvFtV_p.cjs +1 -0
- package/dist/add-page-modal-9SGv2hgc.cjs +1 -0
- package/dist/add-page-modal-JCDXZIPW.js +95 -0
- package/dist/alert-dialog-P9xMMB6C.cjs +1 -0
- package/dist/alert-dialog-rypfO5ly.js +64 -0
- package/dist/badge-E-S7CqUt.cjs +1 -0
- package/dist/badge-tEwO7C51.js +23 -0
- package/dist/block-helpers-OKHmRRol.cjs +1 -0
- package/dist/block-helpers-oSFpSsGz.js +23 -0
- package/dist/command-BxR6jaCI.cjs +1 -0
- package/dist/command-Pn3HKDuV.js +97 -0
- package/dist/confirm-alert-uNm0lZ0y.cjs +1 -0
- package/dist/confirm-alert-wR5_VJ1l.js +36 -0
- package/dist/context-menu-8dC9uGXj.js +122 -0
- package/dist/context-menu-IgLbIuth.cjs +1 -0
- package/dist/{controls-OfJWSEqC.js → controls-IS5qnRce.js} +20 -85
- package/dist/controls-L7DPvB0m.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +7 -4
- package/dist/core.js +150 -75
- package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-4kA60XdB.js} +6 -8
- package/dist/defaultTheme-mrkeGFGI.cjs +1 -0
- package/dist/delete-page-modal-7KmP1elv.js +67 -0
- package/dist/delete-page-modal-SgfwvfNu.cjs +1 -0
- package/dist/dropdown-menu-El86_9Uo.js +124 -0
- package/dist/dropdown-menu-SiHzqWwZ.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +3 -292
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +5 -2
- package/dist/email.js +18 -37
- package/dist/{form-zKUMQFuB.js → form-0_RLz2TB.js} +12 -12
- package/dist/form-W58AVUdf.cjs +1 -0
- package/dist/hover-card-KUwpDkW8.cjs +1 -0
- package/dist/hover-card-q138xxXR.js +45 -0
- package/dist/{html-to-json-ngX9ef2u.js → html-to-json-2xtb7520.js} +41 -41
- package/dist/{html-to-json-efmv1pCj.cjs → html-to-json-uSnxl72F.cjs} +1 -1
- package/dist/iconBase-gbUAAO2L.cjs +1 -0
- package/dist/iconBase-h4DuR_XT.js +63 -0
- package/dist/index-9MmykVSc.cjs +1 -0
- package/dist/index-hElOGcFr.js +2200 -0
- package/dist/index-lDTsQp7h.js +188 -0
- package/dist/index-rq5Y9ZDy.cjs +1 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/label-KaP7MRrs.js +10 -0
- package/dist/label-tFm8HZdb.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +62 -66
- package/dist/link-WbcKdQ9k.cjs +1 -0
- package/dist/link-xuhP-4dN.js +196 -0
- package/dist/page-viewer-Hx5hxHKm.cjs +1 -0
- package/dist/{page-viewer-7AwzWRtB.js → page-viewer-NnOwmAmu.js} +44 -58
- package/dist/popover-a84pbVhQ.js +23 -0
- package/dist/popover-fKjgcRUx.cjs +1 -0
- package/dist/{project-general-setting-pYPoqvqd.js → project-general-setting-9ju3TDju.js} +35 -43
- package/dist/project-general-setting-FxkwjvJz.cjs +1 -0
- package/dist/{project-seo-setting-zXKOcjep.js → project-seo-setting-36CdUszM.js} +23 -40
- package/dist/project-seo-setting-RU7qiXxb.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +13 -14
- package/dist/scroll-area-FiHvy-TZ.cjs +1 -0
- package/dist/scroll-area-ewXbxc3n.js +30 -0
- package/dist/select-7bjg-rr9.cjs +1 -0
- package/dist/select-POGdEDHT.js +75 -0
- package/dist/separator-3Civ-6hb.cjs +1 -0
- package/dist/separator-SctTn0Qi.js +18 -0
- package/dist/single-page-detail-beY0MT1b.cjs +1 -0
- package/dist/{single-page-detail-q2TDxN-P.js → single-page-detail-hD1jKZ8k.js} +65 -73
- package/dist/skeleton-STeL9VrJ.cjs +1 -0
- package/dist/skeleton-lu8e7q2y.js +239 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +5 -2
- package/dist/studio.js +24 -40
- package/dist/tabs-_4WbA1cc.cjs +1 -0
- package/dist/tabs-yQ3oGziM.js +106 -0
- package/dist/textarea-1kZEh7ki.cjs +1 -0
- package/dist/textarea-b2QvVhrK.js +73 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +364 -159
- package/dist/useAddBlock-8pxOEYIl.cjs +1 -0
- package/dist/useAddBlock-FEKFJNwQ.js +69 -0
- package/dist/useChaiExternalData-fkFgoS80.js +6 -0
- package/dist/useChaiExternalData-rwoAZ6uU.cjs +1 -0
- package/dist/useDarkMode-7i57segK.cjs +1 -0
- package/dist/useDarkMode-8VHJlYyE.js +23 -0
- package/dist/useSelectedBreakpoints-6NK5qd7T.js +10 -0
- package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +1 -0
- package/dist/useStylingState-Iuj84yvc.js +186 -0
- package/dist/useStylingState-OIvJMV6p.cjs +1 -0
- package/dist/useUiLibraries-nCdauJ4N.cjs +1 -0
- package/dist/useUiLibraries-psyWFbNc.js +12 -0
- package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +1 -0
- package/dist/useUpdateBlocksProps-vWcDp-P9.js +23 -0
- package/dist/utils-dze1SGvB.js +6 -0
- package/dist/utils-qK_SjzzV.cjs +1 -0
- package/dist/web-blocks.cjs +1 -6
- package/dist/web-blocks.js +3 -1153
- package/package.json +1 -1
- package/dist/AddBlocks-b0Vk6eqO.js +0 -206
- package/dist/AddBlocks-bgu08YJC.cjs +0 -1
- package/dist/BrandingOptions-AljW1cXz.cjs +0 -1
- package/dist/CanvasArea-dp1tzDkK.cjs +0 -55
- package/dist/Class-PoYusiA5.cjs +0 -1
- package/dist/CurrentPage-rWHgPomd.cjs +0 -1
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/ListTree-5n8U4-IF.cjs +0 -1
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/PagesPanel-IkZjy0Gn.js +0 -64
- package/dist/PagesPanel-sBN51kKZ.cjs +0 -1
- package/dist/ProjectPanel-e98TJLfI.js +0 -85
- package/dist/ProjectPanel-lbQH31jc.cjs +0 -1
- package/dist/Settings-qytQoyTv.cjs +0 -1
- package/dist/SidePanels-YRIM1IPq.cjs +0 -1
- package/dist/Topbar-LUyDFBkK.js +0 -129
- package/dist/Topbar-NOSnWo7V.cjs +0 -1
- package/dist/UnsplashImages-f-ObKOC-.cjs +0 -1
- package/dist/UploadImages-oOnccvT9.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-g3fd00P5.cjs +0 -1
- package/dist/add-page-modal-yQ6qL6Ui.js +0 -104
- package/dist/confirm-alert-3flAvzWH.js +0 -60
- package/dist/confirm-alert-LQsGNYz8.cjs +0 -1
- package/dist/controls-KK2oLIa8.cjs +0 -1
- package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
- package/dist/delete-page-modal-iMmkPec0.js +0 -83
- package/dist/delete-page-modal-tzZmqGzE.cjs +0 -1
- package/dist/empty-slot-ZBlsQi6m.js +0 -15
- package/dist/empty-slot-nzYOgZuS.cjs +0 -1
- package/dist/form-LBHtTduy.cjs +0 -1
- package/dist/index--dUsFH1I.cjs +0 -1
- package/dist/index-HD1UKc4P.js +0 -3079
- package/dist/index-YpnaudSM.js +0 -63
- package/dist/index-bOWwCMRF.cjs +0 -206
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-ecnGWzh9.cjs +0 -1
- package/dist/index-fvMaxES9.cjs +0 -1
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-m4WGov7e.js +0 -2202
- package/dist/index-uLtBNl55.js +0 -39503
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/page-viewer-5gTszT-n.cjs +0 -1
- package/dist/project-general-setting-52CTYL_w.cjs +0 -1
- package/dist/project-seo-setting-jTweI1DX.cjs +0 -1
- package/dist/single-page-detail-jy2SPcp1.cjs +0 -1
package/README.md
CHANGED
|
@@ -36,16 +36,17 @@ Step 4: Add the builder to your page.
|
|
|
36
36
|
```tsx
|
|
37
37
|
import "./chaibuilder.tailwind.css";
|
|
38
38
|
import "@chaibuilder/sdk/styles";
|
|
39
|
+
import "@chaibuilder/sdk/web-blocks";
|
|
39
40
|
import { ChaiBuilderEditor } from "@chaibuilder/sdk";
|
|
40
|
-
import { loadWebBlocks } from "@chaibuilder/sdk/web-blocks";
|
|
41
|
-
loadWebBlocks();
|
|
42
41
|
|
|
43
42
|
const BuilderFullPage = () => {
|
|
44
43
|
return (
|
|
45
44
|
<ChaiBuilderEditor
|
|
46
|
-
blocks={[]}
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
blocks={[{_type: 'Heading', _id: 'a', content: 'This is a heading', styles: '#styles:,text-3xl font-bold'}]}
|
|
46
|
+
onSave={async ({ blocks, providers, brandingOptions } ) => {
|
|
47
|
+
console.log(blocks, providers, brandingOptions );
|
|
48
|
+
return true
|
|
49
|
+
}}
|
|
49
50
|
/>
|
|
50
51
|
);
|
|
51
52
|
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import k, { createElement as O, useMemo as U, useState as g, useCallback as V, useEffect as q, Suspense as J } from "react";
|
|
3
|
+
import { omit as R, has as F, isFunction as W, first as h, filter as b, values as v, groupBy as w, mergeWith as K, isArray as L, keys as Y, get as $, map as T, noop as Q, isEmpty as y, uniq as X, includes as Z, find as ee, reject as I } from "lodash-es";
|
|
4
|
+
import { useAtom as N } from "jotai";
|
|
5
|
+
import { useTranslation as H } from "react-i18next";
|
|
6
|
+
import { A as se, a as re, b as te, c as oe } from "./accordion-oPUeqPCZ.js";
|
|
7
|
+
import { S as le } from "./scroll-area-ewXbxc3n.js";
|
|
8
|
+
import { T as ae, g as ce, h as C } from "./tabs-yQ3oGziM.js";
|
|
9
|
+
import { T as ie, a as ne, c as de, u as A, B as me, S as pe } from "./skeleton-lu8e7q2y.js";
|
|
10
|
+
import { BoxIcon as ue } from "@radix-ui/react-icons";
|
|
11
|
+
import { j as _, f as xe, s as S, J as he } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
12
|
+
import { u as P } from "./useAddBlock-FEKFJNwQ.js";
|
|
13
|
+
import { syncBlocksWithDefaults as M, useChaiBlocks as G } from "@chaibuilder/runtime";
|
|
14
|
+
import { useFeature as fe } from "flagged";
|
|
15
|
+
import { O as B } from "./STRINGS-b432aBJJ.js";
|
|
16
|
+
import { u as z } from "./useUiLibraries-psyWFbNc.js";
|
|
17
|
+
import { Loader as ge } from "lucide-react";
|
|
18
|
+
import { S as je, c as be, b as ve, d as ye, f as E } from "./select-POGdEDHT.js";
|
|
19
|
+
import { C as ke, c as Be, f as Ne, g as Ce, T as we, d as Te, A as Ae, a as _e } from "./textarea-b2QvVhrK.js";
|
|
20
|
+
import { L as Se } from "./label-KaP7MRrs.js";
|
|
21
|
+
import { g as Pe } from "./html-to-json-2xtb7520.js";
|
|
22
|
+
import "@radix-ui/react-accordion";
|
|
23
|
+
import "./utils-dze1SGvB.js";
|
|
24
|
+
import "clsx";
|
|
25
|
+
import "tailwind-merge";
|
|
26
|
+
import "@radix-ui/react-scroll-area";
|
|
27
|
+
import "@radix-ui/react-dialog";
|
|
28
|
+
import "@radix-ui/react-tabs";
|
|
29
|
+
import "@radix-ui/react-slot";
|
|
30
|
+
import "class-variance-authority";
|
|
31
|
+
import "@radix-ui/react-tooltip";
|
|
32
|
+
import "@radix-ui/react-toast";
|
|
33
|
+
import "./MODIFIERS-CNqNUapY.js";
|
|
34
|
+
import "react-dom";
|
|
35
|
+
import "@floating-ui/react-dom";
|
|
36
|
+
import "i18next";
|
|
37
|
+
import "./Functions-NzT2Six_.js";
|
|
38
|
+
import "react-hotkeys-hook";
|
|
39
|
+
import "@react-hookz/web";
|
|
40
|
+
import "./block-helpers-oSFpSsGz.js";
|
|
41
|
+
import "./Controls-3Cc1XYXg.js";
|
|
42
|
+
import "@radix-ui/react-select";
|
|
43
|
+
import "@radix-ui/react-label";
|
|
44
|
+
import "himalaya";
|
|
45
|
+
const Le = ({ block: s }) => {
|
|
46
|
+
const { type: t, icon: c, label: l } = s, { addCoreBlock: d, addPredefinedBlock: i } = P(), [n, r] = _(), [, p] = xe(), [, m] = N(S), o = () => {
|
|
47
|
+
if (F(s, "blocks")) {
|
|
48
|
+
const u = W(s.blocks) ? s.blocks() : s.blocks;
|
|
49
|
+
i(M(u), h(n));
|
|
50
|
+
} else
|
|
51
|
+
d(s, h(n));
|
|
52
|
+
m(B);
|
|
53
|
+
}, a = fe("dnd");
|
|
54
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(ie, { children: [
|
|
55
|
+
/* @__PURE__ */ e.jsx(ne, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
onClick: o,
|
|
59
|
+
type: "button",
|
|
60
|
+
onDragStart: (u) => {
|
|
61
|
+
u.dataTransfer.setData("text/plain", JSON.stringify(R(s, ["component", "icon"]))), setTimeout(() => {
|
|
62
|
+
r([]), p(null), m(B);
|
|
63
|
+
}, 200);
|
|
64
|
+
},
|
|
65
|
+
draggable: a ? "true" : "false",
|
|
66
|
+
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
|
|
67
|
+
children: [
|
|
68
|
+
O(c || ue, { className: "w-4 h-4 mx-auto" }),
|
|
69
|
+
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || t })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) }),
|
|
73
|
+
/* @__PURE__ */ e.jsx(de, { children: /* @__PURE__ */ e.jsx("p", { children: l || t }) })
|
|
74
|
+
] }) });
|
|
75
|
+
}, Ie = ({ block: s, closePopover: t }) => {
|
|
76
|
+
const [c, l] = g(!1), d = A("getExternalPredefinedBlock", Q()), { addCoreBlock: i, addPredefinedBlock: n } = P(), [r] = _(), p = V(
|
|
77
|
+
async (m) => {
|
|
78
|
+
if (m.stopPropagation(), F(s, "component")) {
|
|
79
|
+
i(s, h(r)), t();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
l(!0);
|
|
83
|
+
const o = await d(s);
|
|
84
|
+
y(o) || n(M(o), h(r)), t();
|
|
85
|
+
},
|
|
86
|
+
[s]
|
|
87
|
+
);
|
|
88
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
onClick: c ? () => {
|
|
92
|
+
} : p,
|
|
93
|
+
className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
94
|
+
children: [
|
|
95
|
+
c && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
96
|
+
/* @__PURE__ */ e.jsx(ge, { className: "animate-spin", size: 15, color: "white" }),
|
|
97
|
+
" ",
|
|
98
|
+
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
99
|
+
] }),
|
|
100
|
+
s.preview ? /* @__PURE__ */ e.jsx(
|
|
101
|
+
"img",
|
|
102
|
+
{
|
|
103
|
+
src: s.preview,
|
|
104
|
+
className: "min-h-[50px] w-full rounded-md border border-gray-300",
|
|
105
|
+
alt: s.label
|
|
106
|
+
}
|
|
107
|
+
) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
) });
|
|
111
|
+
}, Ee = () => {
|
|
112
|
+
const { data: s } = z(), t = G(), c = b(v(t), { category: "custom" }), l = w(c, "group"), d = w(s, "group"), i = U(() => K(l, d, (o, a) => {
|
|
113
|
+
if (L(o) && L(a))
|
|
114
|
+
return [...o, ...a];
|
|
115
|
+
}), [l, d]), [n, r] = g(h(Y(i)) || ""), [, p] = N(S), m = $(i, n, []);
|
|
116
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
|
|
117
|
+
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(je, { value: n, onValueChange: (o) => r(o), children: [
|
|
118
|
+
/* @__PURE__ */ e.jsx(be, { className: "w-full", children: /* @__PURE__ */ e.jsx(ve, { placeholder: "Select a provider" }) }),
|
|
119
|
+
/* @__PURE__ */ e.jsxs(ye, { children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
|
|
121
|
+
k.Children.toArray(
|
|
122
|
+
T(i, (o, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
] }) }),
|
|
126
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: k.Children.toArray(
|
|
127
|
+
m.map((o) => /* @__PURE__ */ e.jsx(Ie, { block: o, closePopover: () => p(B) }))
|
|
128
|
+
) })
|
|
129
|
+
] });
|
|
130
|
+
}, Fe = () => {
|
|
131
|
+
const { t: s } = H(), [t, c] = g(""), { addPredefinedBlock: l } = P(), [d] = _(), [, i] = N(S), n = () => {
|
|
132
|
+
const r = Pe(t);
|
|
133
|
+
l([...r], h(d) || null), c(""), i(B);
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ e.jsxs(ke, { className: "border-border/0 p-0 shadow-none", children: [
|
|
136
|
+
/* @__PURE__ */ e.jsx(Be, { className: "p-3", children: /* @__PURE__ */ e.jsx(Ne, { children: s("html_snippet_description") }) }),
|
|
137
|
+
/* @__PURE__ */ e.jsx(Ce, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
138
|
+
/* @__PURE__ */ e.jsx(Se, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
139
|
+
/* @__PURE__ */ e.jsx(
|
|
140
|
+
we,
|
|
141
|
+
{
|
|
142
|
+
autoFocus: !0,
|
|
143
|
+
tabIndex: 1,
|
|
144
|
+
ref: (r) => r && r.focus(),
|
|
145
|
+
onChange: (r) => c(r.target.value),
|
|
146
|
+
rows: 12,
|
|
147
|
+
value: t,
|
|
148
|
+
placeholder: s("enter_code_snippet"),
|
|
149
|
+
className: "resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }) }),
|
|
153
|
+
/* @__PURE__ */ e.jsxs(Te, { className: "flex flex-col justify-end p-3", children: [
|
|
154
|
+
/* @__PURE__ */ e.jsx(me, { disabled: t.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
|
|
155
|
+
/* @__PURE__ */ e.jsx(Ae, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(_e, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
156
|
+
] })
|
|
157
|
+
] });
|
|
158
|
+
}, He = Fe, Ts = () => {
|
|
159
|
+
const { t: s } = H(), [t, c] = g("core"), [l, d] = g("basic"), i = G(), [, n] = N(he), r = A("importHTMLSupport", !0), p = A("filterChaiBlock", () => !0), { data: m, isLoading: o } = z(), a = b(i, p), u = w(a, "category"), f = X(T(u.core, "group"));
|
|
160
|
+
q(() => {
|
|
161
|
+
!Z(f, l) && !y(f) && !y(l) && d(h(f));
|
|
162
|
+
}, [f, l]);
|
|
163
|
+
const j = !o && !y(m) || ee(v(a), { category: "custom" }) !== void 0;
|
|
164
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
|
|
165
|
+
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
166
|
+
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
|
|
167
|
+
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(t === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ e.jsx(
|
|
170
|
+
ae,
|
|
171
|
+
{
|
|
172
|
+
onValueChange: (x) => {
|
|
173
|
+
n(""), c(x);
|
|
174
|
+
},
|
|
175
|
+
value: t,
|
|
176
|
+
className: "h-max",
|
|
177
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
178
|
+
ce,
|
|
179
|
+
{
|
|
180
|
+
className: "grid w-full " + (j && r ? "grid-cols-3" : j && !r || !j && r ? "grid-cols-2" : "grid-cols-1"),
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ e.jsx(C, { value: "core", children: s("Blocks") }),
|
|
183
|
+
j ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("ui_library") }) : null,
|
|
184
|
+
r ? /* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") }) : null
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
t === "core" && /* @__PURE__ */ e.jsx(le, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: k.Children.toArray(
|
|
191
|
+
T(
|
|
192
|
+
f,
|
|
193
|
+
(x) => I(b(v(u.core), { group: x }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(se, { type: "single", value: x, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(re, { value: x, children: [
|
|
194
|
+
/* @__PURE__ */ e.jsx(te, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: x }),
|
|
195
|
+
/* @__PURE__ */ e.jsx(oe, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: k.Children.toArray(
|
|
196
|
+
I(b(v(u.core), { group: x }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(Le, { block: D }))
|
|
197
|
+
) }) })
|
|
198
|
+
] }) }) : null
|
|
199
|
+
)
|
|
200
|
+
) }) }),
|
|
201
|
+
t === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(pe, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Ee, {}) }),
|
|
202
|
+
t === "html" && r ? /* @__PURE__ */ e.jsx(He, {}) : null
|
|
203
|
+
] });
|
|
204
|
+
};
|
|
205
|
+
export {
|
|
206
|
+
Ts as default
|
|
207
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),l=require("react"),s=require("lodash-es"),q=require("jotai"),T=require("react-i18next"),v=require("./accordion-ynvFtV_p.cjs"),S=require("./scroll-area-FiHvy-TZ.cjs"),y=require("./tabs-_4WbA1cc.cjs"),j=require("./skeleton-STeL9VrJ.cjs"),_=require("@radix-ui/react-icons"),h=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),C=require("./useAddBlock-8pxOEYIl.cjs"),N=require("@chaibuilder/runtime"),I=require("flagged"),B=require("./STRINGS-gPz7CUOk.cjs"),A=require("./useUiLibraries-nCdauJ4N.cjs"),P=require("lucide-react"),R=require("./select-7bjg-rr9.cjs"),p=require("./textarea-1kZEh7ki.cjs"),L=require("./label-tFm8HZdb.cjs"),F=require("./html-to-json-uSnxl72F.cjs");require("@radix-ui/react-accordion");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-scroll-area");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-o1p3VnpS.cjs");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@react-hookz/web");require("./block-helpers-OKHmRRol.cjs");require("./Controls-ky25Ebo3.cjs");require("@radix-ui/react-select");require("@radix-ui/react-label");require("himalaya");const H=({block:t})=>{const{type:o,icon:a,label:n}=t,{addCoreBlock:x,addPredefinedBlock:u}=C.useAddBlock(),[d,r]=h.useSelectedBlockIds(),[,f]=h.useHighlightBlockId(),[,m]=q.useAtom(h.activePanelAtom),i=()=>{if(s.has(t,"blocks")){const g=s.isFunction(t.blocks)?t.blocks():t.blocks;u(N.syncBlocksWithDefaults(g),s.first(d))}else x(t,s.first(d));m(B.OUTLINE_KEY)},c=I.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(j.Tooltip,{children:[e.jsxRuntimeExports.jsx(j.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:i,type:"button",onDragStart:g=>{g.dataTransfer.setData("text/plain",JSON.stringify(s.omit(t,["component","icon"]))),setTimeout(()=>{r([]),f(null),m(B.OUTLINE_KEY)},200)},draggable:c?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(c?"cursor-grab":"cursor-pointer"),children:[l.createElement(a||_.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:n||o})]})}),e.jsxRuntimeExports.jsx(j.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:n||o})})]})})},U=({block:t,closePopover:o})=>{const[a,n]=l.useState(!1),x=j.useBuilderProp("getExternalPredefinedBlock",s.noop()),{addCoreBlock:u,addPredefinedBlock:d}=C.useAddBlock(),[r]=h.useSelectedBlockIds(),f=l.useCallback(async m=>{if(m.stopPropagation(),s.has(t,"component")){u(t,s.first(r)),o();return}n(!0);const i=await x(t);s.isEmpty(i)||d(N.syncBlocksWithDefaults(i),s.first(r)),o()},[t]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:a?()=>{}:f,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:[a&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.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:t.label})})]})})},M=()=>{const{data:t}=A.useUILibraryBlocks(),o=N.useChaiBlocks(),a=s.filter(s.values(o),{category:"custom"}),n=s.groupBy(a,"group"),x=s.groupBy(t,"group"),u=l.useMemo(()=>s.mergeWith(n,x,(i,c)=>{if(s.isArray(i)&&s.isArray(c))return[...i,...c]}),[n,x]),[d,r]=l.useState(s.first(s.keys(u))||""),[,f]=q.useAtom(h.activePanelAtom),m=s.get(u,d,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(R.Select,{value:d,onValueChange:i=>r(i),children:[e.jsxRuntimeExports.jsx(R.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(R.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(R.SelectContent,{children:[e.jsxRuntimeExports.jsx(R.SelectItem,{value:"",children:"Choose"}),l.Children.toArray(s.map(u,(i,c)=>e.jsxRuntimeExports.jsx(R.SelectItem,{value:c,children:c},c)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:l.Children.toArray(m.map(i=>e.jsxRuntimeExports.jsx(U,{block:i,closePopover:()=>f(B.OUTLINE_KEY)})))})]})},G=()=>{const{t}=T.useTranslation(),[o,a]=l.useState(""),{addPredefinedBlock:n}=C.useAddBlock(),[x]=h.useSelectedBlockIds(),[,u]=q.useAtom(h.activePanelAtom),d=()=>{const r=F.getBlocksFromHTML(o);n([...r],s.first(x)||null),a(""),u(B.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(p.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(p.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(p.CardDescription,{children:t("html_snippet_description")})}),e.jsxRuntimeExports.jsx(p.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(L.Label,{htmlFor:"current",className:"text-sm",children:t("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(p.Textarea,{autoFocus:!0,tabIndex:1,ref:r=>r&&r.focus(),onChange:r=>a(r.target.value),rows:12,value:o,placeholder:t("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(p.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(j.Button,{disabled:o.trim()==="",onClick:()=>d(),size:"sm",className:"w-full",children:t("import_html")}),e.jsxRuntimeExports.jsx(p.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(p.AlertTitle,{className:"text-xs font-normal leading-4",children:t("note_imported_html")})})]})]})},O=G,D=()=>{const{t}=T.useTranslation(),[o,a]=l.useState("core"),[n,x]=l.useState("basic"),u=N.useChaiBlocks(),[,d]=q.useAtom(h.showPredefinedBlockCategoryAtom),r=j.useBuilderProp("importHTMLSupport",!0),f=j.useBuilderProp("filterChaiBlock",()=>!0),{data:m,isLoading:i}=A.useUILibraryBlocks(),c=s.filter(u,f),g=s.groupBy(c,"category"),b=s.uniq(s.map(g.core,"group"));l.useEffect(()=>{!s.includes(b,n)&&!s.isEmpty(b)&&!s.isEmpty(n)&&x(s.first(b))},[b,n]);const k=!i&&!s.isEmpty(m)||s.find(s.values(c),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 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:t("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t(o==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(y.Tabs,{onValueChange:E=>{d(""),a(E)},value:o,className:"h-max",children:e.jsxRuntimeExports.jsxs(y.TabsList,{className:"grid w-full "+(k&&r?"grid-cols-3":k&&!r||!k&&r?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"core",children:t("Blocks")}),k?e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"ui-blocks",children:t("ui_library")}):null,r?e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"html",children:t("import")}):null]})}),o==="core"&&e.jsxRuntimeExports.jsx(S.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:l.Children.toArray(s.map(b,E=>s.reject(s.filter(s.values(g.core),{group:E}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(v.Accordion,{type:"single",value:E,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(v.AccordionItem,{value:E,children:[e.jsxRuntimeExports.jsx(v.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:E}),e.jsxRuntimeExports.jsx(v.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:l.Children.toArray(s.reject(s.filter(s.values(g.core),{group:E}),{hidden:!0}).map(w=>e.jsxRuntimeExports.jsx(H,{block:w})))})})]})}):null))})}),o==="ui-blocks"&&e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx(j.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(M,{})}),o==="html"&&r?e.jsxRuntimeExports.jsx(O,{}):null]})};exports.default=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-JYMCiFoE.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),g=require("./ChaiBuilderEditor-m30yoOgJ.cjs");require("react-i18next");const k=require("./skeleton-STeL9VrJ.cjs"),a=require("./controls-L7DPvB0m.cjs"),p=require("lodash-es");require("./MODIFIERS-o1p3VnpS.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("tailwind-merge");require("@radix-ui/react-icons");require("react-hotkeys-hook");require("@react-hookz/web");require("@chaibuilder/runtime");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),P=({value:t,onChange:e,id:i,onBlur:l})=>{const n=p.debounce(e,200),v=u=>n(u.target.value);return r.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:r.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:r.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},m=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const t=k.useBuilderProp("onSaveBrandingOptions",p.noop),[e,i]=g.useBrandingOptions(),[l]=g.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{p.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:q,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:a.s({title:"Heading font",default:b,options:m}),bodyFont:a.s({title:"Body font",default:u,options:m}),roundedCorners:a.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:a.f({title:"Primary",default:h}),secondaryColor:a.f({title:"Secondary",default:q})};l||(s={...s,bodyBgLightColor:a.f({title:"Body Background (Light Mode)",default:O}),bodyTextLightColor:a.f({title:"Body Text (Light Mode)",default:y}),bodyBgDarkColor:a.f({title:"Body Background (Dark mode)",default:S}),bodyTextDarkColor:a.f({title:"Body Text (Dark mode)",default:C})});const d={type:"object",properties:{}},f={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,f[o]=c.uiSchema,!0}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),r.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:r.jsxRuntimeExports.jsx(E,{widgets:{color:P},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:f,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=D;
|
|
@@ -1,54 +1,40 @@
|
|
|
1
|
-
import { j as t } from "./jsx-runtime-
|
|
1
|
+
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import N from "@rjsf/validator-ajv8";
|
|
4
4
|
import j from "@rjsf/core";
|
|
5
|
-
import { h as k,
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import "
|
|
5
|
+
import { h as k, L as w } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
6
|
+
import "react-i18next";
|
|
7
|
+
import { u as D } from "./skeleton-lu8e7q2y.js";
|
|
8
|
+
import { s as f, c as L, f as o } from "./controls-IS5qnRce.js";
|
|
9
|
+
import { debounce as P, noop as R, isEqual as M } from "lodash-es";
|
|
10
|
+
import "./MODIFIERS-CNqNUapY.js";
|
|
10
11
|
import "clsx";
|
|
11
|
-
import "
|
|
12
|
-
import "
|
|
12
|
+
import "@radix-ui/react-scroll-area";
|
|
13
|
+
import "react-dom";
|
|
14
|
+
import "@floating-ui/react-dom";
|
|
13
15
|
import "jotai";
|
|
14
|
-
import "
|
|
16
|
+
import "i18next";
|
|
17
|
+
import "flagged";
|
|
18
|
+
import "./Functions-NzT2Six_.js";
|
|
19
|
+
import "tailwind-merge";
|
|
20
|
+
import "@radix-ui/react-icons";
|
|
21
|
+
import "react-hotkeys-hook";
|
|
15
22
|
import "@react-hookz/web";
|
|
16
|
-
import "
|
|
17
|
-
import "@radix-ui/react-toggle";
|
|
18
|
-
import "class-variance-authority";
|
|
19
|
-
import "./Class-lGzsNBOK.js";
|
|
20
|
-
import "@radix-ui/react-switch";
|
|
23
|
+
import "@chaibuilder/runtime";
|
|
21
24
|
import "@radix-ui/react-slot";
|
|
22
|
-
import "
|
|
23
|
-
import "
|
|
24
|
-
import "@radix-ui/react-alert-dialog";
|
|
25
|
-
import "@radix-ui/react-dialog";
|
|
26
|
-
import "@radix-ui/react-label";
|
|
27
|
-
import "@radix-ui/react-scroll-area";
|
|
28
|
-
import "@radix-ui/react-tabs";
|
|
25
|
+
import "class-variance-authority";
|
|
26
|
+
import "./utils-dze1SGvB.js";
|
|
29
27
|
import "@radix-ui/react-tooltip";
|
|
30
|
-
import "@radix-ui/react-popover";
|
|
31
|
-
import "@radix-ui/react-menubar";
|
|
32
|
-
import "@radix-ui/react-hover-card";
|
|
33
|
-
import "@radix-ui/react-select";
|
|
34
|
-
import "@radix-ui/react-dropdown-menu";
|
|
35
|
-
import "@radix-ui/react-separator";
|
|
36
28
|
import "@radix-ui/react-toast";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
import "react-icons-picker";
|
|
40
|
-
import "react-dom";
|
|
41
|
-
import "react-quill";
|
|
42
|
-
import "react-i18next";
|
|
43
|
-
const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
44
|
-
const i = R(e, 200), m = (l) => i(l.target.value);
|
|
29
|
+
const F = ({ value: u, onChange: e, id: d, onBlur: p }) => {
|
|
30
|
+
const i = P(e, 200), m = (l) => i(l.target.value);
|
|
45
31
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
46
32
|
"input",
|
|
47
33
|
{
|
|
48
34
|
type: "color",
|
|
49
35
|
className: "text-xs p-0",
|
|
50
36
|
value: u,
|
|
51
|
-
onBlur: ({ target: { value: l } }) => d
|
|
37
|
+
onBlur: ({ target: { value: l } }) => p(d, l),
|
|
52
38
|
onChange: m
|
|
53
39
|
}
|
|
54
40
|
) }) });
|
|
@@ -102,13 +88,13 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
102
88
|
{ title: "Lustria", value: "Lustria" },
|
|
103
89
|
{ title: "Ovo", value: "Ovo" },
|
|
104
90
|
{ title: "Suranna", value: "Suranna" }
|
|
105
|
-
],
|
|
106
|
-
const u =
|
|
91
|
+
], st = () => {
|
|
92
|
+
const u = D("onSaveBrandingOptions", R), [e, d] = k(), [p] = w(), i = c.useRef(e);
|
|
107
93
|
c.useEffect(() => () => {
|
|
108
|
-
|
|
94
|
+
M(e, i.current) || u(i.current);
|
|
109
95
|
}, []);
|
|
110
|
-
const m = ({ formData:
|
|
111
|
-
s && (
|
|
96
|
+
const m = ({ formData: a }, s) => {
|
|
97
|
+
s && (d(a), i.current = a);
|
|
112
98
|
}, {
|
|
113
99
|
bodyFont: l,
|
|
114
100
|
headingFont: h,
|
|
@@ -131,28 +117,28 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
131
117
|
default: l,
|
|
132
118
|
options: g
|
|
133
119
|
}),
|
|
134
|
-
roundedCorners:
|
|
120
|
+
roundedCorners: L({
|
|
135
121
|
title: "Rounded Corner",
|
|
136
122
|
default: parseInt(O || 5, 10)
|
|
137
123
|
}),
|
|
138
|
-
primaryColor:
|
|
139
|
-
secondaryColor:
|
|
124
|
+
primaryColor: o({ title: "Primary", default: x }),
|
|
125
|
+
secondaryColor: o({ title: "Secondary", default: S })
|
|
140
126
|
};
|
|
141
|
-
|
|
127
|
+
p || (r = {
|
|
142
128
|
...r,
|
|
143
|
-
bodyBgLightColor:
|
|
129
|
+
bodyBgLightColor: o({
|
|
144
130
|
title: "Body Background (Light Mode)",
|
|
145
131
|
default: B
|
|
146
132
|
}),
|
|
147
|
-
bodyTextLightColor:
|
|
133
|
+
bodyTextLightColor: o({
|
|
148
134
|
title: "Body Text (Light Mode)",
|
|
149
135
|
default: y
|
|
150
136
|
}),
|
|
151
|
-
bodyBgDarkColor:
|
|
137
|
+
bodyBgDarkColor: o({
|
|
152
138
|
title: "Body Background (Dark mode)",
|
|
153
139
|
default: C
|
|
154
140
|
}),
|
|
155
|
-
bodyTextDarkColor:
|
|
141
|
+
bodyTextDarkColor: o({
|
|
156
142
|
title: "Body Text (Dark mode)",
|
|
157
143
|
default: b
|
|
158
144
|
})
|
|
@@ -161,15 +147,15 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
161
147
|
type: "object",
|
|
162
148
|
properties: {}
|
|
163
149
|
}, v = {};
|
|
164
|
-
return Object.keys(r).forEach((
|
|
165
|
-
const s = r[
|
|
166
|
-
return n.properties || (n.properties = {}), n.properties[
|
|
150
|
+
return Object.keys(r).forEach((a) => {
|
|
151
|
+
const s = r[a];
|
|
152
|
+
return n.properties || (n.properties = {}), n.properties[a] = s.schema, v[a] = s.uiSchema, !0;
|
|
167
153
|
}), /* @__PURE__ */ t.jsxs("div", { className: "flex h-full w-60 select-none flex-col", children: [
|
|
168
154
|
/* @__PURE__ */ t.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Branding Options" }) }),
|
|
169
155
|
/* @__PURE__ */ t.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ t.jsx(
|
|
170
156
|
j,
|
|
171
157
|
{
|
|
172
|
-
widgets: { color:
|
|
158
|
+
widgets: { color: F },
|
|
173
159
|
idSeparator: ".",
|
|
174
160
|
autoComplete: "off",
|
|
175
161
|
omitExtraData: !0,
|
|
@@ -185,5 +171,5 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
185
171
|
] });
|
|
186
172
|
};
|
|
187
173
|
export {
|
|
188
|
-
|
|
174
|
+
st as default
|
|
189
175
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";var pe=Object.defineProperty;var xe=(e,t,s)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var M=(e,t,s)=>(xe(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-JYMCiFoE.cjs"),p=require("react"),a=require("lodash-es"),w=require("@radix-ui/react-icons"),S=require("./skeleton-STeL9VrJ.cjs"),u=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),F=require("./separator-3Civ-6hb.cjs"),U=require("react-i18next"),P=require("./useDarkMode-7i57segK.cjs"),H=require("./hover-card-KUwpDkW8.cjs"),me=require("./label-tFm8HZdb.cjs"),N=require("./dropdown-menu-SiHzqWwZ.cjs"),V=require("./useSelectedBreakpoints-7ONXb-vN.cjs"),D=require("./alert-dialog-P9xMMB6C.cjs"),B=require("jotai"),ge=require("./useUpdateBlocksProps-Unn8lUyj.cjs"),he=require("react-quill"),fe=require("./useAddBlock-8pxOEYIl.cjs"),se=require("flagged"),je=require("@floating-ui/dom"),G=require("@floating-ui/react-dom"),Q=require("./block-helpers-OKHmRRol.cjs"),ye=require("@react-hookz/web"),Ee=require("@bobthered/tailwindcss-palette-generator"),ke=require("@tailwindcss/typography"),ve=require("@tailwindcss/forms"),be=require("@tailwindcss/aspect-ratio"),Re=require("react-wrap-balancer"),we=require("tailwind-merge"),O=require("./STRINGS-gPz7CUOk.cjs"),ne=require("@chaibuilder/runtime"),oe=require("./useChaiExternalData-rwoAZ6uU.cjs"),J=require("react-dom"),R=require("prop-types");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("i18next");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-label");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-alert-dialog");require("./Controls-ky25Ebo3.cjs");const Be=()=>p.useMemo(()=>ne.getChaiDataProviders(),[]),Se=({children:e})=>{const[,t]=oe.useChaiExternalData(),[s]=u.usePageDataProviders(),l=Be();return p.useEffect(()=>(t({}),a.each(s,r=>{const i=a.find(l,{providerKey:r.providerKey});if(i){const d=(i==null?void 0:i.mockFn)||(i==null?void 0:i.dataFn);d&&d(r.args).then(o=>t(c=>({...c,[r.providerKey]:o})))}}),()=>{a.each(s,r=>{t(i=>(delete i[r.providerKey],i))})}),[l,s,t]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e})},Ce=()=>{const{hasUndo:e,hasRedo:t,undo:s,redo:l}=u.useUndoManager();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(S.Button,{disabled:!e(),size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{})}),n.jsxRuntimeExports.jsx(S.Button,{disabled:!t(),onClick:l,size:"sm",className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function Ie(){const[e,t]=P.useDarkMode(),{t:s}=U.useTranslation();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(me.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),n.jsxRuntimeExports.jsxs(H.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
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:[n.jsxRuntimeExports.jsx("span",{className:"sr-only",children:s("use_setting")}),n.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
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 X=({landscape:e=!1})=>n.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:[n.jsxRuntimeExports.jsx("g",{strokeWidth:0}),n.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),n.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"}})]}),De=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:n.jsxRuntimeExports.jsx(X,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:n.jsxRuntimeExports.jsx(X,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:n.jsxRuntimeExports.jsx(w.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:n.jsxRuntimeExports.jsx(w.DesktopIcon,{}),width:1920}],ee=({title:e,content:t,currentBreakpoint:s,breakpoint:l,width:r,icon:i,onClick:d})=>{const{t:o}=U.useTranslation();return n.jsxRuntimeExports.jsxs(H.HoverCard,{children:[n.jsxRuntimeExports.jsx(H.HoverCardTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx(S.Button,{onClick:()=>d(r),size:"sm",variant:l===s?"secondary":"ghost",children:i})}),n.jsxRuntimeExports.jsx(H.HoverCardContent,{className:"w-52 border-border",children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:n.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[n.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:o(e)}),n.jsxRuntimeExports.jsx("p",{className:"text-xs",children:o(t)})]})})})]})},Ae=()=>{const[,e,t]=P.useCanvasWidth(),[s,l]=V.useSelectedBreakpoints(),{t:r}=U.useTranslation(),i=S.useBuilderProp("breakpoints",De),d=o=>{s.includes(o)?s.length>2&&l(s.filter(c=>c!==o)):l(c=>[...c,o])};return i.length<4?n.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:a.map(i,o=>p.createElement(ee,{...o,onClick:t,key:o.breakpoint,currentBreakpoint:e}))}):n.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[a.map(i.filter(o=>a.includes(s,a.toUpper(o.breakpoint))),o=>p.createElement(ee,{...o,onClick:t,key:o.breakpoint,currentBreakpoint:e})),n.jsxRuntimeExports.jsxs(N.DropdownMenu,{children:[n.jsxRuntimeExports.jsx(N.DropdownMenuTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:n.jsxRuntimeExports.jsx(w.DotsVerticalIcon,{className:"scale-90 transform"})})}),n.jsxRuntimeExports.jsxs(N.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[n.jsxRuntimeExports.jsx(N.DropdownMenuLabel,{children:r("Breakpoints")}),n.jsxRuntimeExports.jsx(N.DropdownMenuSeparator,{}),a.map(i,o=>n.jsxRuntimeExports.jsx(N.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>d(a.toUpper(o.breakpoint)),checked:a.includes(s,a.toUpper(o.breakpoint)),children:r(o.title)},o.breakpoint))]})]})]})},_e=()=>{const{t:e}=U.useTranslation(),{setNewBlocks:t}=u.useBlocksStoreUndoableActions(),[,s]=u.useSelectedBlockIds(),[,l]=u.useSelectedStylingBlocks(),r=p.useCallback(()=>{t([]),s([]),l([])},[t]);return n.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n.jsxRuntimeExports.jsxs(D.AlertDialog,{children:[n.jsxRuntimeExports.jsx(D.AlertDialogTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsxs(S.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[n.jsxRuntimeExports.jsx(w.EraserIcon,{})," ",e("clear")]})}),n.jsxRuntimeExports.jsxs(D.AlertDialogContent,{className:"border-border",children:[n.jsxRuntimeExports.jsxs(D.AlertDialogHeader,{children:[n.jsxRuntimeExports.jsx(D.AlertDialogTitle,{children:e("clear_canvas_title")}),n.jsxRuntimeExports.jsx(D.AlertDialogDescription,{children:e("clear_canvas_description")})]}),n.jsxRuntimeExports.jsxs(D.AlertDialogFooter,{children:[n.jsxRuntimeExports.jsx(D.AlertDialogCancel,{children:e("cancel")}),n.jsxRuntimeExports.jsx(D.AlertDialogAction,{onClick:r,children:e("yes")})]})]})]})})},Me=()=>{const e=S.useBuilderProp("darkMode",!1),[t]=V.useCanvasZoom();return n.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[n.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ie,{}),n.jsxRuntimeExports.jsx(F.Separator,{orientation:"vertical"})]}):null,n.jsxRuntimeExports.jsx(Ae,{}),n.jsxRuntimeExports.jsx(F.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[n.jsxRuntimeExports.jsx(w.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",n.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(t,0),"%"]})]}),n.jsxRuntimeExports.jsx(F.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(Ce,{})]}),n.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[n.jsxRuntimeExports.jsx(F.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(_e,{})]})]})},Te=`<!doctype html>
|
|
4
|
+
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
|
|
9
|
+
<style>
|
|
10
|
+
html { height: 100%; overflow:auto; }
|
|
11
|
+
body { height: 100%; }
|
|
12
|
+
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
+
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
+
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
+
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
+
html{
|
|
17
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
+
scrollbar-width: none; /* Firefox */
|
|
19
|
+
}
|
|
20
|
+
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
+
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
+
|
|
23
|
+
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
+
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
+
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
+
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
+
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
28
|
+
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
29
|
+
a{ pointer-events: none !important; }
|
|
30
|
+
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
31
|
+
[contenteditable="true"] {
|
|
32
|
+
outline: none;
|
|
33
|
+
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
34
|
+
-webkit-user-select: text;
|
|
35
|
+
-moz-user-select: text;
|
|
36
|
+
user-select: text;
|
|
37
|
+
}
|
|
38
|
+
.frame-root .frame-content { height: 100%; }
|
|
39
|
+
</style>
|
|
40
|
+
<style id="hidden-blocks"></style>
|
|
41
|
+
<style id="selected-block"></style>
|
|
42
|
+
<style id="selected-styling-block"></style>
|
|
43
|
+
<style id="highlighted-block"></style>
|
|
44
|
+
<style id="dragged-block"></style>
|
|
45
|
+
|
|
46
|
+
</head>
|
|
47
|
+
<body class="font-body antialiased h-full">
|
|
48
|
+
<div class="frame-root h-full"></div>
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
50
|
+
</body>
|
|
51
|
+
</html>`,Ne=e=>{const[t]=P.useCanvasWidth(),[,s]=V.useCanvasZoom(),[l,r]=p.useState({}),i=p.useCallback(()=>{const{width:d,height:o}=e;if(d<t){const c=parseFloat((d/t).toFixed(2).toString());let x={};const m=o*c;o&&(x={height:100+(o-m)/m*100+"%"}),r({position:"relative",top:0,transform:`scale(${c})`,transformOrigin:"top left",...x,maxWidth:"none"}),s(c*100)}else r({}),s(100)},[t,e,s]);return p.useEffect(()=>{i()},[t,e,s,i]),l};let ie,re;typeof document<"u"&&(ie=document);typeof window<"u"&&(re=window);const le=p.createContext({document:ie,window:re}),z=()=>p.useContext(le),{Provider:qe,Consumer:dt}=le;class ae extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}M(ae,"propTypes",{children:R.element.isRequired,contentDidMount:R.func.isRequired,contentDidUpdate:R.func.isRequired});class K extends p.Component{constructor(s,l){super(s,l);M(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:l}=this.props;typeof l=="function"?l(s):l&&(l.current=s)});M(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});M(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.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 l=this.props.contentDidMount,r=this.props.contentDidUpdate,i=s.defaultView||s.parentView,d=n.jsxRuntimeExports.jsx(ae,{contentDidMount:l,contentDidUpdate:r,children:n.jsxRuntimeExports.jsx(qe,{value:{document:s,window:i},children:n.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[J.createPortal(this.props.head,this.getDoc().head),J.createPortal(d,o)]}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,n.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}M(K,"propTypes",{style:R.object,head:R.node,initialContent:R.string,mountTarget:R.string,contentDidMount:R.func,contentDidUpdate:R.func,children:R.oneOfType([R.element,R.arrayOf(R.element)])}),M(K,"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 Le=p.forwardRef((e,t)=>n.jsxRuntimeExports.jsx(K,{...e,forwardedRef:t})),Pe=()=>{const{addCoreBlock:e}=fe.useAddBlock(),t=S.useBuilderProp("getExternalPredefinedBlock",a.noop);return p.useCallback(async s=>{const{block:l,dropTargetId:r,relativeIndex:i}=s;if(a.has(l,"format")){const d=await t(l);return e({blocks:d},r===0?null:r,i)}return e(l,r===0?null:r,i)},[e])};let A=null,L=[],q=null,ce=null;function $e(e){const t=window.getComputedStyle(e),s=parseInt(t.paddingLeft,10),l=parseInt(t.paddingTop,10),r=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:s,paddingTop:l,paddingRight:r,paddingBottom:i}}const te=(e,t,s)=>{if(!A)return;const l=e.getBoundingClientRect(),r=A==null?void 0:A.getElementById("placeholder"),{paddingLeft:i,paddingTop:d,paddingRight:o,paddingBottom:c}=$e(e);r.style.width=t==="vertical"?l.width-i-o+"px":"2px",r.style.height=t==="vertical"?"2px":l.height-d-c+"px",r.style.display="block";const x=L.reduce((m,f)=>Math.abs(f-s)<Math.abs(m-s)?f:m);ce=L.indexOf(x),t==="vertical"?(r.style.top=e.offsetTop+x+"px",r.style.left=e.offsetLeft+i+"px"):(r.style.top=e.offsetTop+d+"px",r.style.left=e.offsetLeft+x+"px")},Fe=e=>{const t=de(e),s=window.getComputedStyle(e),l=t==="horizontal",r=parseInt(s.paddingLeft),i=parseInt(s.paddingTop);let d=l?r:i;L=[d],Array.from(e.children).forEach(o=>{const c=window.getComputedStyle(o),x=parseInt(l?c.marginLeft+c.marginRight:c.marginTop+c.marginBottom),m=l?o.offsetWidth:o.offsetHeight;L.push(d+m+x),d+=m+x})};function de(e){const t=window.getComputedStyle(e).display,s=window.getComputedStyle(e).flexDirection;if(t==="flex")return s==="column"||s==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const l=window.getComputedStyle(e).gridTemplateRows,r=window.getComputedStyle(e).gridTemplateColumns;if(l.includes("auto"))return"vertical";if(r.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const He=a.throttle(e=>{const t=e.target,s=de(t);if(s==="vertical"){const l=e.clientY-t.offsetTop;te(t,s,l)}else{const l=e.clientX-t.offsetLeft;te(t,s,l)}},200),Oe=e=>{e.preventDefault(),e.stopPropagation(),He(e)};function W(){const e=A==null?void 0:A.getElementById("placeholder");e.style.display="none"}const Ue=()=>{const{document:e}=z(),[t,s]=B.useAtom(u.draggingFlagAtom),l=Pe(),r=se.useFeature("dnd"),[,i]=u.useHighlightBlockId(),[,d]=u.useSelectedBlockIds();return A=e,{isDragging:t,"data-dnd":"branch",onDragOver:r?Oe:a.noop,onDrop:r?o=>{q==null||q.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const c=JSON.parse(o.dataTransfer.getData("text/plain"));let x=o.target.getAttribute("data-block-id");x===null&&(x=o.target.parentElement.getAttribute("data-block-id")),l({block:c,dropTargetId:x||null,relativeIndex:ce}),s(!1),W(),setTimeout(()=>{W()},300)}:a.noop,onDragEnter:r?o=>{const c=o;q=c.target,c.stopPropagation(),c.preventDefault(),L=[];const x=c.target;Fe(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),s(!0),i(""),d([])}:a.noop,onDragLeave:r?o=>{const c=o;q=null,c.stopPropagation(),c.preventDefault(),c.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:r?()=>{s(!1),W()}:a.noop}};function Z(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function ze(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const We=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=ge.useUpdateBlocksProps(),[,s]=u.useHighlightBlockId(),[l,r]=B.useAtom(u.inlineEditingActiveAtom);return i=>{var f;if(l)return;const d=Z(i.target),o=d.getAttribute("data-block-type");if(!o||!e.includes(o))return;const c=d.cloneNode(!0);d.style.display="none",Array.from(c.attributes).forEach(j=>{j.name!=="class"&&c.removeAttribute(j.name)}),o==="Text"&&(c.style.display="inline-block"),d.parentNode.insertBefore(c,d.nextSibling);const x=new he.Quill(c,{placeholder:"Type here..."});function m(){const j=x.getText(0,x.getLength());t([d.getAttribute("data-block-id")],{content:j}),d.removeAttribute("style"),c.removeEventListener("blur",m,!0),ze(x),r(""),s("")}c.addEventListener("blur",m,!0),x.focus(),(f=c.querySelector(".ql-clipboard"))==null||f.remove(),r(d.getAttribute("data-block-id"))}},Ke=()=>{const[,e]=u.useSelectedStylingBlocks(),[,t]=u.useSelectedBlockIds(),[,s]=u.useHighlightBlockId(),[l]=B.useAtom(u.inlineEditingActiveAtom);return r=>{if(l)return;r.stopPropagation();const i=Z(r.target);if(i!=null&&i.getAttribute("data-block-id")&&(i==null?void 0:i.getAttribute("data-block-id"))==="container"){t([]),e([]),s("");return}if(i!=null&&i.getAttribute("data-block-parent")){const d=i.getAttribute("data-style-prop"),o=i.getAttribute("data-style-id"),c=i.getAttribute("data-block-parent");e([{id:o,prop:d,blockId:c}]),t([c])}else i!=null&&i.getAttribute("data-block-id")&&t([i.getAttribute("data-block-id")]);s("")}},Ye=a.throttle((e,t)=>{const s=Z(e.target);s!=null&&s.getAttribute("data-style-id")&&t(s.getAttribute("data-style-id"))},100),Ve=()=>{const[,e]=u.useHighlightBlockId(),[t]=B.useAtom(u.inlineEditingActiveAtom);return s=>{t||Ye(s,e)}},Ze=({children:e})=>{const{document:t}=z(),[s]=u.useSelectedBlockIds(),[l,r]=u.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(l))return;const x=ue(t,a.first(s));if(x){const m=x.getAttribute("data-style-prop");if(m){const f=x.getAttribute("data-style-id"),j=x.getAttribute("data-block-parent");r([{id:f,prop:m,blockId:j}])}}},100)},[t,s,r,l]);const i=We(),d=Ke(),o=Ve(),c=Ue();return n.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:d,onDoubleClick:i,onMouseMove:o,...a.omit(c,"isDragging"),className:"relative mb-5 h-full max-w-full "+(c.isDragging?"dragging":""),children:e})},ue=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ge=()=>{const{window:e}=z(),[t,s]=u.useSelectedBlockIds(),[l]=u.useBlocksStore(),[,r]=u.useSelectedStylingBlocks(),{undo:i,redo:d}=u.useUndoManager(),o=u.useDuplicateBlocks(),[,c]=u.usePreviewMode(),x=u.useRemoveBlocks(),{savePage:m}=u.useSavePage(),[f]=B.useAtom(u.inlineEditingActiveAtom),[,j]=B.useAtom(u.editLayerNameAtom),b=y=>{y.key==="Enter"&&(y.preventDefault(),t.length===1&&j(a.first(t)))},C=y=>{const h=l.find(v=>v._id===y);return h?h._parent:null};return p.useEffect(()=>{const y=h=>{if(h.key==="Escape"){s([]),r([]);return}if(b(h),!f&&(h.key==="Delete"||h.key==="Backspace")&&(h.preventDefault(),x(t)),h.ctrlKey||h.metaKey){if(h.key==="ArrowUp"){h.preventDefault();const v=t.length>0?C(t[0]):null;v&&s([v])}if(["z","y","d","x","c","p","s","v"].includes(h.key)){if(f&&["x","z","v"].includes(h.key))return!0;h.preventDefault()}h.key==="s"&&(h.stopPropagation(),h.preventDefault(),m()),h.key==="z"&&i(),h.key==="y"&&d(),h.key==="d"&&o(t)}};return e.removeEventListener("keydown",y),e.addEventListener("keydown",y),()=>{e.removeEventListener("keydown",y)}},[t,s,i,x,c,d,o,f,m,e]),null},Qe=({block:e,label:t})=>{const[,s]=u.useSelectedBlockIds(),[,l]=u.useHighlightBlockId(),[,r]=B.useAtom(u.draggedBlockIdAtom),i=se.useFeature("dnd");return n.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:d=>{d.dataTransfer.setData("text/plain",JSON.stringify(a.pick(e,["_id","_type"]))),r(e._id),setTimeout(()=>{s([]),l(null)},200)},children:[n.jsxRuntimeExports.jsx(w.DragHandleDots2Icon,{}),t]})},Je=({selectedBlockElement:e,block:t})=>{const s=u.useRemoveBlocks(),l=u.useDuplicateBlocks(),[,r]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),[d]=B.useAtom(u.inlineEditingActiveAtom),{floatingStyles:o,refs:c,update:x}=G.useFloating({placement:"top-start",middleware:[G.shift(),je.flip()],elements:{reference:e}});ye.useResizeObserver(e,()=>x(),e!==null);const m=a.get(t,"_parent",null),f=a.isEmpty(a.get(t,"_name",""))?a.get(t,"_type",""):a.get(t,"_name","");return!e||!t||d?null:n.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:c.setFloating,style:o,onClick:j=>{j.stopPropagation(),j.preventDefault()},onKeyDown:j=>j.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[n.jsxRuntimeExports.jsx(Qe,{label:f,block:t}),n.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[m&&n.jsxRuntimeExports.jsx(w.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{i([]),r([m])}}),Q.canDuplicateBlock(a.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.CopyIcon,{className:"hover:scale-105",onClick:()=>l([t==null?void 0:t._id])}):null,Q.canDeleteBlock(a.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.TrashIcon,{className:"hover:scale-105",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},Xe=({model:e})=>{const[t]=u.useBrandingOptions(),[s]=u.useSelectedBlockIds(),[l]=P.useDarkMode(),[r]=u.useHighlightBlockId(),[i]=u.useSelectedStylingBlocks(),[d]=B.useAtom(u.draggedBlockIdAtom),{document:o,window:c}=z(),[x]=p.useState(o==null?void 0:o.getElementById("highlighted-block")),[m]=p.useState(o==null?void 0:o.getElementById("selected-block")),[f]=p.useState(o==null?void 0:o.getElementById("selected-styling-block")),[j]=p.useState(o==null?void 0:o.getElementById("dragged-block"));p.useEffect(()=>{l?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[l,o]);const b=a.get(t,"headingFont","DM Sans"),C=a.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const y=a.get(t,"primaryColor","#000"),h=a.get(t,"secondaryColor","#FFF"),v=Ee.tailwindcssPaletteGenerator({colors:[y,h],names:["primary","secondary"]});v.primary.DEFAULT=y,v.secondary.DEFAULT=h;const T=a.get(t,"roundedCorners","0");!c||!c.tailwind||(c.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[b],body:[C]},extend:{borderRadius:{global:`${T||"0"}px`},colors:v}},plugins:[ke,ve,be,c.tailwind.plugin.withOptions(()=>({addVariant:$,e:I})=>{$("hs-accordion-active",[({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active.${I(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .${I(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle .${I(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${I(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle.${I(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${I(`hs-accordion-active${g}${E}`)}`)}]),$("hs-accordion-selected",({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion .selected.${I(`hs-accordion-selected${g}${E}`)}`)})})]})},[t,c,b,C]),p.useEffect(()=>{m&&(m.textContent=`${a.map(s,y=>`[data-block-id="${y}"]`).join(",")}{
|
|
52
|
+
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
53
|
+
}`)},[s,m]),p.useEffect(()=>{if(!d){j.textContent="";return}j.textContent=`[data-block-id="${d}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[d]),p.useEffect(()=>{x&&(x.textContent=r?`[data-style-id="${r}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[r,s,x]),p.useEffect(()=>{f&&(f.textContent=`${a.map(i,({id:y})=>`[data-style-id="${y}"]`).join(",")}{
|
|
54
|
+
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
55
|
+
}`)},[i,f]),p.useEffect(()=>{const y=a.get(t,"bodyTextLightColor","#64748b"),h=a.get(t,"bodyTextDarkColor","#94a3b8"),v=a.get(t,"bodyBgLightColor","#FFFFFF"),T=a.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${y}] bg-[${v}] dark:text-[${h}] dark:bg-[${T}]`},[t,o,e]),e==="page"?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[b&&n.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${b.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),C&&b!==C&&n.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${C.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),b&&n.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${b}",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},et=e=>{const t={};return Object.keys(e).forEach(s=>{a.isString(e[s])&&e[s].startsWith(O.SLOT_KEY)&&(t[s]=e[s].replace(O.SLOT_KEY,"").split(","))}),t},tt=a.memoize(e=>{const t=e.replace(O.STYLES_KEY,"").split(",");return we.twMerge(t[0],t[1])});function st(e,t){return a.get(e,`${t}_attrs`,{})}function nt(e){const t={};return Object.keys(e).forEach(s=>{if(a.isString(e[s])&&e[s].startsWith(O.STYLES_KEY)){const l=tt(e[s]);t[s]={className:l,"data-style-prop":s,"data-block-parent":e._id,"data-style-id":`${s}-${e._id}`,...st(e,s)}}}),t}function ot(e,t){const s=a.get(e,"_bindings",{});return a.isEmpty(s)?{...e}:(a.each(s,(l,r)=>{a.isString(l)&&a.get(t,l,null)&&(e[r]=a.get(t,l,null))}),e)}function Y({blocks:e}){const[t]=u.useBlocksStore(),s=p.useCallback(i=>nt(i),[]),[l]=oe.useChaiExternalData(),[r]=B.useAtom(u.inlineEditingActiveAtom);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((i,d)=>{if(r===i._id)return null;const o=et(i),c={};a.isEmpty(o)||Object.keys(o).forEach(j=>{c[j]=p.Children.toArray(o[j].map(b=>n.jsxRuntimeExports.jsx(Y,{blocks:[a.find(t,{_id:b})]})))});const x=a.filter(t,{_parent:i._id});c.children=x.length?n.jsxRuntimeExports.jsx(Y,{blocks:x}):null;const m=ne.getBlockComponent(i._type),f=a.get(m,"builderComponent",a.get(m,"component",null));return a.isNull(f)?n.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):n.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(f,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":a.has(m,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:d,...ot(i,l),...s(i),...c})})}))})}const it=()=>{const[e]=u.useBlocksStore(),t=a.isEmpty(e)?null:n.jsxRuntimeExports.jsx(Se,{children:n.jsxRuntimeExports.jsx(Y,{blocks:a.filter(e,s=>a.isEmpty(s._parent))})});return n.jsxRuntimeExports.jsx(Re.Provider,{children:t})},rt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),lt=()=>{const[e]=B.useAtom(u.networkModeAtom),[t]=u.usePreviewMode(),[s]=P.useCanvasWidth(),[,l]=u.useSelectedBlockIds(),r=u.useSelectedBlock(),[,i]=u.useHighlightBlockId(),d=p.useRef(null),o=p.useRef(null),[c,x]=p.useState({width:0,height:0}),m=Ne(c),[f,j]=p.useState(0),[b,C]=p.useState([]),[,y]=p.useState([]),[,h]=B.useAtom(u.canvasIframeAtom),[v,T]=u.useSelectedStylingBlocks(),$=S.useBuilderProp("loading",!1);p.useEffect(()=>{const{clientWidth:g,clientHeight:E}=o.current;x({width:g,height:E}),f===0&&j(g)},[o,s,f]);const I=(g,E=0)=>{const{top:_}=g.getBoundingClientRect();return _+E>=0&&_-E<=window.innerHeight};p.useEffect(()=>{var g,E;if(r&&r.type!=="Multiple"&&d.current){const _=ue(d.current.contentDocument,r._id);_&&(I(_)||(E=(g=d.current)==null?void 0:g.contentWindow)==null||E.scrollTo({top:_.offsetTop,behavior:"smooth"}),C([_]))}},[r]),p.useEffect(()=>{if(!a.isEmpty(v)&&d.current){const g=rt(d.current.contentDocument,a.first(v).id);y(g?[g]:[null])}else y([null])},[v]);const k=p.useMemo(()=>{let g=Te;return e==="offline"&&(g=g.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),g=g.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),g=g.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),g},[e]);return n.jsxRuntimeExports.jsx("div",{onClick:()=>{l([]),T([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:f>0&&!a.isEmpty(m)?{width:t?"100%":f}:{},ref:o,children:n.jsxRuntimeExports.jsxs(Le,{contentDidMount:()=>h(d.current),ref:d,id:"canvas-iframe",style:{width:`${s}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:k,children:[n.jsxRuntimeExports.jsx(Ge,{}),n.jsxRuntimeExports.jsx(Je,{block:r,selectedBlockElement:a.first(b)}),n.jsxRuntimeExports.jsx(Xe,{model:"page"}),n.jsxRuntimeExports.jsx(Ze,{children:$?n.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:n.jsxRuntimeExports.jsx(S.Skeleton,{className:"h-full"})}):n.jsxRuntimeExports.jsx(it,{})}),n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},at=()=>n.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[n.jsxRuntimeExports.jsx(Me,{}),n.jsxRuntimeExports.jsx("div",{className:"relative h-full overflow-hidden bg-slate-800/90 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] px-2",children:n.jsxRuntimeExports.jsx(p.Suspense,{fallback:n.jsxRuntimeExports.jsx(S.Skeleton,{className:"h-full"}),children:n.jsxRuntimeExports.jsx(u.ErrorBoundary,{children:n.jsxRuntimeExports.jsx(lt,{})})})})]});exports.default=at;
|