@chaibuilder/sdk 1.2.9 → 1.2.11
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 +10 -12
- package/dist/AddBlocks-TSt8uJY4.js +218 -0
- package/dist/AddBlocks-k2p8Hy1n.cjs +1 -0
- package/dist/BrandingOptions-WyVWfFVz.cjs +1 -0
- package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-uFTyYJZj.js} +18 -22
- package/dist/CanvasArea-5erOZYLy.cjs +60 -0
- package/dist/{CanvasArea-mlNKmCOh.js → CanvasArea-iRQqpOak.js} +465 -481
- package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
- package/dist/Class-5ARpH_Tu.cjs +1 -0
- package/dist/CurrentPage-NzmJloN7.cjs +1 -0
- package/dist/{CurrentPage-lBy25sZn.js → CurrentPage-RCxTz9Mc.js} +24 -26
- package/dist/{Layers-3Xs4A5i8.js → Layers-tXB5Pwid.js} +124 -158
- package/dist/Layers-xDG7oltg.cjs +1 -0
- package/dist/PagesPanel-72nzYB1k.cjs +1 -0
- package/dist/{PagesPanel--BZhafnt.js → PagesPanel-Jaz9jvye.js} +14 -16
- package/dist/{ProjectPanel-YcLkM-DW.js → ProjectPanel--S014Xx3.js} +22 -24
- package/dist/ProjectPanel-RU0QvH6e.cjs +1 -0
- package/dist/Settings-5EuwaVb3.cjs +1 -0
- package/dist/{Settings-TAgX4hov.js → Settings-gjvl5V1k.js} +556 -579
- package/dist/{SidePanels-btVQQkVK.js → SidePanels-Fq3kRwR0.js} +54 -51
- package/dist/SidePanels-uNCxnGte.cjs +1 -0
- package/dist/Topbar-JqW89xI5.cjs +1 -0
- package/dist/{Topbar-j4t4AgCq.js → Topbar-m5dbbI1f.js} +15 -17
- package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-GhBD6owT.js} +24 -26
- package/dist/UnsplashImages-vACw5hbK.cjs +1 -0
- package/dist/UploadImages-PzHdEKHT.cjs +1 -0
- package/dist/{UploadImages-xBg-kbKv.js → UploadImages-S1HgxeGb.js} +23 -25
- package/dist/{add-page-modal-cm8damU2.js → add-page-modal-2P5hGXOQ.js} +15 -17
- package/dist/add-page-modal-GAizM2Jw.cjs +1 -0
- package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-57Xq5foA.js} +12 -14
- package/dist/confirm-alert-Uf84DpdR.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +13 -58
- package/dist/core.js +47 -58
- package/dist/defaultTheme-IH19g4fv.cjs +1 -0
- package/dist/defaultTheme-YY8mlQS3.js +1055 -0
- package/dist/delete-page-modal-MG42FdnU.cjs +1 -0
- package/dist/{delete-page-modal-YrIBvfFA.js → delete-page-modal-ix5IjaFW.js} +27 -29
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +100 -81
- package/dist/email.cjs +1 -0
- package/dist/email.d.ts +116 -0
- package/dist/email.js +79 -0
- package/dist/{controls-XPXGHKht.js → empty-slot-MWycClTb.js} +61 -50
- package/dist/empty-slot-TF2kd-0X.cjs +1 -0
- package/dist/{form-VbouZlAW.cjs → form-KBb3kA8g.cjs} +1 -1
- package/dist/{form-OVmsLOrc.js → form-SYcFyACJ.js} +18 -18
- package/dist/{index-pZhGT8uT.js → index-Fj3ead-J.js} +4886 -4884
- package/dist/index-aiHDvS5v.cjs +1 -0
- package/dist/{index-N50dZnlC.cjs → index-cM3eKmlx.cjs} +25 -25
- package/dist/index-pNYv0oAF.js +2994 -0
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +95 -1125
- package/dist/page-viewer-Sh99FGYk.cjs +1 -0
- package/dist/{page-viewer-feqJr1QI.js → page-viewer-VxqOevr4.js} +15 -17
- package/dist/project-general-setting-VTLHa-Ik.cjs +1 -0
- package/dist/{project-general-setting-SgagORzW.js → project-general-setting-nWOjPiin.js} +15 -17
- package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-70bWTwsB.js} +17 -19
- package/dist/project-seo-setting-ENAKc2Dl.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +111 -70
- package/dist/{single-page-detail-dnWMyg6P.js → single-page-detail-3z7TF-Yy.js} +44 -46
- package/dist/single-page-detail-6L38HJC4.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +13 -15
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +149 -151
- package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-7mUMwNSG.cjs} +1 -1
- package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-tjQ5DgiO.js} +1 -1
- package/dist/web-blocks.cjs +1 -9
- package/dist/web-blocks.js +431 -442
- package/package.json +8 -2
- package/dist/AddBlocks-tMxKPoen.js +0 -225
- package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
- package/dist/CanvasArea-xs4wM64L.cjs +0 -60
- package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
- package/dist/Layers-eaHy5PK9.cjs +0 -1
- package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
- package/dist/PagesPanel-gGKCV394.cjs +0 -1
- package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
- package/dist/Settings-7wlLcvoh.cjs +0 -1
- package/dist/SidePanels-5H4j0mIs.cjs +0 -1
- package/dist/Topbar-V8xCetWF.cjs +0 -1
- package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
- package/dist/UploadImages-DnQ95_NW.cjs +0 -1
- package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
- package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/index-H6vIwGfD.cjs +0 -1
- package/dist/index-niHREMmR.js +0 -2938
- package/dist/page-viewer-SLt8XgYv.cjs +0 -1
- package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
- package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
- package/dist/single-page-detail-IPod1o5P.cjs +0 -1
- package/dist/utils-PTxFk6qT.cjs +0 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "1.2.
|
|
8
|
+
"version": "1.2.11",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -61,6 +61,12 @@
|
|
|
61
61
|
"require": "./dist/web-blocks.cjs",
|
|
62
62
|
"types": "./dist/web-blocks.d.ts"
|
|
63
63
|
},
|
|
64
|
+
|
|
65
|
+
"./email": {
|
|
66
|
+
"import": "./dist/email.js",
|
|
67
|
+
"require": "./dist/email.cjs",
|
|
68
|
+
"types": "./dist/email.d.ts"
|
|
69
|
+
},
|
|
64
70
|
"./email-blocks": {
|
|
65
71
|
"import": "./dist/email-blocks.js",
|
|
66
72
|
"require": "./dist/email-blocks.cjs",
|
|
@@ -83,7 +89,7 @@
|
|
|
83
89
|
},
|
|
84
90
|
"dependencies": {
|
|
85
91
|
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
86
|
-
"@chaibuilder/runtime": "0.2.
|
|
92
|
+
"@chaibuilder/runtime": "0.2.3",
|
|
87
93
|
"@floating-ui/dom": "1.4.5",
|
|
88
94
|
"@floating-ui/react-dom": "2.0.1",
|
|
89
95
|
"@mhsdesign/jit-browser-tailwindcss": "0.4.0",
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import B, { createElement as U, useState as b, useCallback as W, useMemo as J, useEffect as K, Suspense as $ } from "react";
|
|
3
|
-
import { has as D, first as u, omit as Q, isEmpty as j, filter as v, values as y, groupBy as N, mergeWith as X, isArray as L, keys as Y, get as Z, map as A, includes as _, find as H, uniq as ee, reject as F } from "lodash-es";
|
|
4
|
-
import { useAtom as k } from "jotai";
|
|
5
|
-
import { useTranslation as G } from "react-i18next";
|
|
6
|
-
import { P, j as w, $ as se, aw as S, aD as re, aE as te, aG as oe, i as z, a9 as M, ar as le, as as ae, at as ie, au as ne, av as E, bo as ce, bp as de, bq as me, br as pe, aI as ue, bs as xe, bt as he, B as fe, bu as ge, bv as be, bw as je, af as ve, ax as ye, ay as Be, az as C, bn as ke, bg as we, bh as Te, bi as Ce, bj as Ne, S as Ae } from "./index-niHREMmR.js";
|
|
7
|
-
import { BoxIcon as _e } from "@radix-ui/react-icons";
|
|
8
|
-
import { syncBlocksWithDefaults as q, useChaiBlocks as V } from "@chaibuilder/runtime";
|
|
9
|
-
import { useFeature as Pe } from "flagged";
|
|
10
|
-
import { Loader as Se } from "lucide-react";
|
|
11
|
-
import { useDrag as Ie, DragPreviewImage as Le } from "react-dnd";
|
|
12
|
-
import { g as He } from "./html-to-json-57841sEK.js";
|
|
13
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
-
import "@radix-ui/react-toggle";
|
|
15
|
-
import "class-variance-authority";
|
|
16
|
-
import "./utils-AvyFzbPC.js";
|
|
17
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
18
|
-
import "clsx";
|
|
19
|
-
import "tailwind-merge";
|
|
20
|
-
import "@radix-ui/react-switch";
|
|
21
|
-
import "@radix-ui/react-slot";
|
|
22
|
-
import "@radix-ui/react-accordion";
|
|
23
|
-
import "@radix-ui/react-alert-dialog";
|
|
24
|
-
import "@radix-ui/react-dialog";
|
|
25
|
-
import "@radix-ui/react-label";
|
|
26
|
-
import "@radix-ui/react-scroll-area";
|
|
27
|
-
import "@radix-ui/react-tabs";
|
|
28
|
-
import "@radix-ui/react-tooltip";
|
|
29
|
-
import "@radix-ui/react-popover";
|
|
30
|
-
import "@radix-ui/react-menubar";
|
|
31
|
-
import "@radix-ui/react-hover-card";
|
|
32
|
-
import "@radix-ui/react-select";
|
|
33
|
-
import "@radix-ui/react-dropdown-menu";
|
|
34
|
-
import "@radix-ui/react-separator";
|
|
35
|
-
import "@radix-ui/react-toast";
|
|
36
|
-
import "cmdk";
|
|
37
|
-
import "@radix-ui/react-context-menu";
|
|
38
|
-
import "react-icons-picker";
|
|
39
|
-
import "react-dom";
|
|
40
|
-
import "react-quill";
|
|
41
|
-
import "flat-to-nested";
|
|
42
|
-
import "./Functions-7jnEwJyw.js";
|
|
43
|
-
import "redux-undo";
|
|
44
|
-
import "lodash";
|
|
45
|
-
import "@react-hookz/web";
|
|
46
|
-
import "himalaya";
|
|
47
|
-
const Fe = ({ block: s }) => {
|
|
48
|
-
const { type: r, icon: t, label: l } = s, { addCoreBlock: d, addPredefinedBlock: n } = P(), [m, o] = w(), [, x] = se(), [, p] = k(S), i = () => {
|
|
49
|
-
D(s, "blocks") ? n(q(s.blocks), u(m)) : d(s, u(m)), p("layers");
|
|
50
|
-
}, a = Pe("dnd");
|
|
51
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(re, { children: [
|
|
52
|
-
/* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
53
|
-
"button",
|
|
54
|
-
{
|
|
55
|
-
onClick: i,
|
|
56
|
-
type: "button",
|
|
57
|
-
onDragStart: (f) => {
|
|
58
|
-
f.dataTransfer.setData("text/plain", JSON.stringify(Q(s, ["component", "icon"]))), setTimeout(() => {
|
|
59
|
-
o([]), x(null), p("layers");
|
|
60
|
-
}, 200);
|
|
61
|
-
},
|
|
62
|
-
draggable: a ? "true" : "false",
|
|
63
|
-
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
|
|
64
|
-
children: [
|
|
65
|
-
U(t || _e, { className: "w-4 h-4 mx-auto" }),
|
|
66
|
-
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || r })
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
) }),
|
|
70
|
-
/* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
|
|
71
|
-
] }) });
|
|
72
|
-
}, Ee = ({ block: s, closePopover: r }) => {
|
|
73
|
-
var a;
|
|
74
|
-
const [t, l] = b(!1), d = z("getExternalPredefinedBlock"), { addCoreBlock: n, addPredefinedBlock: m } = P(), [o] = w(), [, x, p] = Ie(
|
|
75
|
-
() => ({
|
|
76
|
-
type: "CHAI_BLOCK",
|
|
77
|
-
item: s
|
|
78
|
-
}),
|
|
79
|
-
[s]
|
|
80
|
-
), i = W(
|
|
81
|
-
async (f) => {
|
|
82
|
-
if (f.stopPropagation(), D(s, "component")) {
|
|
83
|
-
n(s, u(o)), r();
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
l(!0);
|
|
87
|
-
const h = await d(s);
|
|
88
|
-
j(h) || m(q(h), u(o)), r();
|
|
89
|
-
},
|
|
90
|
-
[s]
|
|
91
|
-
);
|
|
92
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
93
|
-
/* @__PURE__ */ e.jsx(
|
|
94
|
-
Le,
|
|
95
|
-
{
|
|
96
|
-
connect: p,
|
|
97
|
-
src: "https://placehold.co/100x30/000000/FFF?text=" + ((a = s.name || s.label) == null ? void 0 : a.replace(" ", "+"))
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/* @__PURE__ */ e.jsxs(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
ref: x,
|
|
104
|
-
onClick: t ? () => {
|
|
105
|
-
} : i,
|
|
106
|
-
className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
107
|
-
children: [
|
|
108
|
-
t && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
109
|
-
/* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
|
|
110
|
-
" ",
|
|
111
|
-
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
112
|
-
] }),
|
|
113
|
-
s.preview ? /* @__PURE__ */ e.jsx(
|
|
114
|
-
"img",
|
|
115
|
-
{
|
|
116
|
-
src: s.preview,
|
|
117
|
-
className: "min-h-[50px] w-full rounded-md border border-gray-300",
|
|
118
|
-
alt: s.label
|
|
119
|
-
}
|
|
120
|
-
) : /* @__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 }) })
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
] });
|
|
125
|
-
}, Re = () => {
|
|
126
|
-
const { data: s } = M(), r = V(), t = v(y(r), { category: "custom" }), l = N(t, "group"), d = N(s, "group"), n = J(() => X(l, d, (i, a) => {
|
|
127
|
-
if (L(i) && L(a))
|
|
128
|
-
return [...i, ...a];
|
|
129
|
-
}), [l, d]), [m, o] = b(u(Y(n)) || ""), [, x] = k(S), p = Z(n, m, []);
|
|
130
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
|
|
131
|
-
/* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(le, { value: m, onValueChange: (i) => o(i), children: [
|
|
132
|
-
/* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ie, { placeholder: "Select a provider" }) }),
|
|
133
|
-
/* @__PURE__ */ e.jsxs(ne, { children: [
|
|
134
|
-
/* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
|
|
135
|
-
B.Children.toArray(
|
|
136
|
-
A(n, (i, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
|
|
137
|
-
)
|
|
138
|
-
] })
|
|
139
|
-
] }) }),
|
|
140
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: B.Children.toArray(
|
|
141
|
-
p.map((i) => /* @__PURE__ */ e.jsx(Ee, { block: i, closePopover: () => x("layers") }))
|
|
142
|
-
) })
|
|
143
|
-
] });
|
|
144
|
-
}, De = () => {
|
|
145
|
-
const { t: s } = G(), [r, t] = b(""), { addPredefinedBlock: l } = P(), [d] = w(), [, n] = k(S), m = () => {
|
|
146
|
-
const o = He(r);
|
|
147
|
-
l([...o], u(d) || null), t(""), n("layers");
|
|
148
|
-
};
|
|
149
|
-
return /* @__PURE__ */ e.jsxs(ce, { className: "border-border/0 p-0 shadow-none", children: [
|
|
150
|
-
/* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
|
|
151
|
-
/* @__PURE__ */ e.jsx(pe, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
152
|
-
/* @__PURE__ */ e.jsx(ue, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
153
|
-
/* @__PURE__ */ e.jsx(
|
|
154
|
-
xe,
|
|
155
|
-
{
|
|
156
|
-
autoFocus: !0,
|
|
157
|
-
tabIndex: 1,
|
|
158
|
-
ref: (o) => o && o.focus(),
|
|
159
|
-
onChange: (o) => t(o.target.value),
|
|
160
|
-
rows: 12,
|
|
161
|
-
value: r,
|
|
162
|
-
placeholder: s("enter_code_snippet"),
|
|
163
|
-
className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
] }) }),
|
|
167
|
-
/* @__PURE__ */ e.jsxs(he, { className: "flex flex-col justify-end p-3", children: [
|
|
168
|
-
/* @__PURE__ */ e.jsx(fe, { disabled: r.trim() === "", onClick: () => m(), size: "sm", className: "w-full", children: s("import_html") }),
|
|
169
|
-
/* @__PURE__ */ e.jsx(ge, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(be, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
170
|
-
] })
|
|
171
|
-
] });
|
|
172
|
-
}, R = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Ge = (s, r) => {
|
|
173
|
-
if (!s)
|
|
174
|
-
return !_(R, r);
|
|
175
|
-
const t = s._type;
|
|
176
|
-
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" : t === "Heading" || t === "Text" ? r === "RawText" : !_(R, r);
|
|
177
|
-
}, Is = () => {
|
|
178
|
-
const { t: s } = G(), [r, t] = b("core"), [l, d] = b("basic"), n = V(), [, m] = k(je), o = z("importHTMLSupport", !0), [x] = w(), p = ve(), i = H(p, { _id: u(x) }), { data: a, isLoading: f } = M(), h = N(
|
|
179
|
-
v(n, (c) => Ge(i, c.type)),
|
|
180
|
-
"category"
|
|
181
|
-
), g = ee(A(h.core, "group"));
|
|
182
|
-
K(() => {
|
|
183
|
-
!_(g, l) && !j(g) && !j(l) && d(u(g));
|
|
184
|
-
}, [g, l]);
|
|
185
|
-
const O = (c) => d((T) => T === c ? "" : c), I = !f && !j(a) || H(y(n), { category: "custom" }) !== void 0;
|
|
186
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
187
|
-
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
188
|
-
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
|
|
189
|
-
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(r === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
|
|
190
|
-
] }),
|
|
191
|
-
/* @__PURE__ */ e.jsx(
|
|
192
|
-
ye,
|
|
193
|
-
{
|
|
194
|
-
onValueChange: (c) => {
|
|
195
|
-
m(""), t(c);
|
|
196
|
-
},
|
|
197
|
-
value: r,
|
|
198
|
-
className: "h-max",
|
|
199
|
-
children: /* @__PURE__ */ e.jsxs(Be, { className: "grid w-full " + (I && o ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
200
|
-
/* @__PURE__ */ e.jsx(C, { value: "core", children: s("core") }),
|
|
201
|
-
I ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("custom_blocks") }) : null,
|
|
202
|
-
o ? /* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") }) : null
|
|
203
|
-
] })
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
r === "core" && /* @__PURE__ */ e.jsx(ke, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(we, { type: "single", value: l, className: "w-full px-3", children: B.Children.toArray(
|
|
207
|
-
A(
|
|
208
|
-
g,
|
|
209
|
-
(c) => F(v(y(h.core), { group: c }), {
|
|
210
|
-
hidden: !0
|
|
211
|
-
}).length ? /* @__PURE__ */ e.jsxs(Te, { value: c, className: "border-border", children: [
|
|
212
|
-
/* @__PURE__ */ e.jsx(Ce, { onClick: () => O(c), className: "py-2 capitalize", children: c }),
|
|
213
|
-
/* @__PURE__ */ e.jsx(Ne, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: B.Children.toArray(
|
|
214
|
-
F(v(y(h.core), { group: c }), { hidden: !0 }).map((T) => /* @__PURE__ */ e.jsx(Fe, { block: T }))
|
|
215
|
-
) }) })
|
|
216
|
-
] }) : null
|
|
217
|
-
)
|
|
218
|
-
) }) }),
|
|
219
|
-
r === "ui-blocks" && /* @__PURE__ */ e.jsx($, { fallback: /* @__PURE__ */ e.jsx(Ae, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Re, {}) }),
|
|
220
|
-
r === "html" && o ? /* @__PURE__ */ e.jsx(De, {}) : null
|
|
221
|
-
] });
|
|
222
|
-
};
|
|
223
|
-
export {
|
|
224
|
-
Is as default
|
|
225
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),t=require("lodash-es"),R=require("jotai"),q=require("react-i18next"),s=require("./index-H6vIwGfD.cjs"),C=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),w=require("flagged"),N=require("lucide-react"),B=require("react-dnd"),A=require("./html-to-json-2PeOCVey.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("lodash");require("@react-hookz/web");require("himalaya");const S=({block:r})=>{const{type:o,icon:i,label:n}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[p,l]=s.useSelectedBlockIds(),[,h]=s.useHighlightBlockId(),[,j]=R.useAtom(s.activePanelAtom),u=()=>{t.has(r,"blocks")?d(b.syncBlocksWithDefaults(r.blocks),t.first(p)):m(r,t.first(p)),j("layers")},c=w.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:u,type:"button",onDragStart:g=>{g.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{l([]),h(null),j("layers")},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:[a.createElement(i||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:n||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:n||o})})]})})},I=({block:r,closePopover:o})=>{var c;const[i,n]=a.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:d,addPredefinedBlock:p}=s.useAddBlock(),[l]=s.useSelectedBlockIds(),[,h,j]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),u=a.useCallback(async g=>{if(g.stopPropagation(),t.has(r,"component")){d(r,t.first(l)),o();return}n(!0);const f=await m(r);t.isEmpty(f)||p(b.syncBlocksWithDefaults(f),t.first(l)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((c=r.name||r.label)==null?void 0:c.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:h,onClick:i?()=>{}:u,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:[i&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},P=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),i=t.filter(t.values(o),{category:"custom"}),n=t.groupBy(i,"group"),m=t.groupBy(r,"group"),d=a.useMemo(()=>t.mergeWith(n,m,(u,c)=>{if(t.isArray(u)&&t.isArray(c))return[...u,...c]}),[n,m]),[p,l]=a.useState(t.first(t.keys(d))||""),[,h]=R.useAtom(s.activePanelAtom),j=t.get(d,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:u=>l(u),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),a.Children.toArray(t.map(d,(u,c)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:c,children:c},c)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(j.map(u=>e.jsxRuntimeExports.jsx(I,{block:u,closePopover:()=>h("layers")})))})]})},_=()=>{const{t:r}=q.useTranslation(),[o,i]=a.useState(""),{addPredefinedBlock:n}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=R.useAtom(s.activePanelAtom),p=()=>{const l=A.getBlocksFromHTML(o);n([...l],t.first(m)||null),i(""),d("layers")};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),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:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:l=>l&&l.focus(),onChange:l=>i(l.target.value),rows:12,value:o,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:o.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],L=(r,o)=>{if(!r)return!t.includes(k,o);const i=r._type;return i==="List"?o==="ListItem":i==="Table"?o==="TableHead"||o==="TableBody":i==="TableHead"||i==="TableBody"?o==="TableRow":i==="TableRow"?o==="TableCell":i==="Row"?o==="Column":i==="Heading"||i==="Text"?o==="RawText":!t.includes(k,o)},H=()=>{const{t:r}=q.useTranslation(),[o,i]=a.useState("core"),[n,m]=a.useState("basic"),d=b.useChaiBlocks(),[,p]=R.useAtom(s.showPredefinedBlockCategoryAtom),l=s.useBuilderProp("importHTMLSupport",!0),[h]=s.useSelectedBlockIds(),j=s.useAllBlocks(),u=t.find(j,{_id:t.first(h)}),{data:c,isLoading:g}=s.useUILibraryBlocks(),f=t.groupBy(t.filter(d,x=>L(u,x.type)),"category"),E=t.uniq(t.map(f.core,"group"));a.useEffect(()=>{!t.includes(E,n)&&!t.isEmpty(E)&&!t.isEmpty(n)&&m(t.first(E))},[E,n]);const T=x=>m(y=>y===x?"":x),v=!g&&!t.isEmpty(c)||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 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:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(o==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:x=>{p(""),i(x)},value:o,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(v&&l?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),v?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,l?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),o==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:n,className:"w-full px-3",children:a.Children.toArray(t.map(E,x=>t.reject(t.filter(t.values(f.core),{group:x}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:x,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>T(x),className:"py-2 capitalize",children:x}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(f.core),{group:x}),{hidden:!0}).map(y=>e.jsxRuntimeExports.jsx(S,{block:y})))})})]}):null))})}),o==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(P,{})}),o==="html"&&l?e.jsxRuntimeExports.jsx(_,{}):null]})};exports.default=H;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-H6vIwGfD.cjs"),r=require("./controls-Dy1qa8Dc.cjs"),m=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const 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),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:u,headingFont:q,primaryColor:y,bodyTextDarkColor:b,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.f({title:"Heading font",default:q,options:f}),bodyFont:r.f({title:"Body font",default:u,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.y({title:"Primary",default:y}),secondaryColor:r.y({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.y({title:"Body Background (Light)",default:O}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:S}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:b}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:h})});const c={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,g[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:c,formData:e,validator:R,onChange:v})})]})};exports.default=P;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";var Ue=Object.defineProperty;var ze=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>(ze(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),p=require("lodash-es"),L=require("@radix-ui/react-icons"),o=require("./index-H6vIwGfD.cjs"),ne=require("react-i18next"),H=require("jotai"),ge=require("react-dom"),Ye=require("./_commonjsHelpers-wDK0ZLPo.cjs"),G=require("./index-N50dZnlC.cjs"),Ke=require("react-quill"),Je=require("./useAddBlockByDrop-inkD7Lck.cjs"),Ce=require("flagged"),Ve=require("@floating-ui/dom"),me=require("@floating-ui/react-dom"),Ze=require("@react-hookz/web"),Qe=require("@bobthered/tailwindcss-palette-generator"),Ge=require("react-wrap-balancer"),Xe=require("tailwind-merge"),ee=require("./MODIFIERS-2FeVfZQ9.cjs"),Te=require("@chaibuilder/runtime"),et=require("lodash");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const tt=()=>{const{undoCount:e,redoCount:t,undo:n,redo:i}=o.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t,onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function nt(){const[e,t]=o.useDarkMode(),{t:n}=ne.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.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:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:n("use_setting")}),s.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 ye=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),st=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(ye,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(ye,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(L.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(L.DesktopIcon,{}),width:1920}],ve=({title:e,content:t,currentBreakpoint:n,breakpoint:i,width:a,icon:c,onClick:u})=>{const{t:r}=ne.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>u(a),size:"sm",variant:i===n?"secondary":"ghost",children:c})}),s.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:r(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r(t)})]})})})]})},rt=()=>{const[,e,t]=o.useCanvasWidth(),[n,i]=o.useSelectedBreakpoints(),{t:a}=ne.useTranslation(),c=o.useBuilderProp("breakpoints",st),u=r=>{n.includes(r)?n.length>2&&i(n.filter(d=>d!==r)):i(d=>[...d,r])};return c.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:p.map(c,r=>g.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[p.map(c.filter(r=>p.includes(n,p.toUpper(r.breakpoint))),r=>g.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(L.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:a("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),p.map(c,r=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>u(p.toUpper(r.breakpoint)),checked:p.includes(n,p.toUpper(r.breakpoint)),children:a(r.title)},r.breakpoint))]})]})]})},ot=()=>{const{t:e}=ne.useTranslation(),[t]=o.useSetAllBlocks(),{createSnapshot:n}=o.useCanvasHistory(),[,i]=o.useSelectedBlockIds(),[,a]=o.useSelectedStylingBlocks(),c=g.useCallback(()=>{t([]),i([]),a([]),n()},[t,n]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(L.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:c,children:e("yes")})]})]})]})})},it=()=>{const e=o.useFeatureSupport("darkMode",!1),[t]=o.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(L.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[p.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(tt,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(ot,{})]})]})},at=`<!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://old.chaibuilder.com/offline/tailwind.cdn.js"><\/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>`,lt=e=>{const[t]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[i,a]=g.useState({}),c=g.useCallback(()=>{const{width:u,height:r}=e;if(u<t){const d=parseFloat((u/t).toFixed(2).toString());let x={};const h=r*d;r&&(x={height:100+(r-h)/h*100+"%"}),a({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...x,maxWidth:"none"}),n(d*100)}else a({}),n(100)},[t,e,n]);return g.useEffect(()=>{c()},[t,e,n,c]),i};var te={exports:{}};/*
|
|
52
|
-
object-assign
|
|
53
|
-
(c) Sindre Sorhus
|
|
54
|
-
@license MIT
|
|
55
|
-
*/var re,je;function ct(){if(je)return re;je=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(c){if(c==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(c)}function a(){try{if(!Object.assign)return!1;var c=new String("abc");if(c[5]="de",Object.getOwnPropertyNames(c)[0]==="5")return!1;for(var u={},r=0;r<10;r++)u["_"+String.fromCharCode(r)]=r;var d=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(d.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return re=a()?Object.assign:function(c,u){for(var r,d=i(c),x,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var m in r)t.call(r,m)&&(d[m]=r[m]);if(e){x=e(r);for(var y=0;y<x.length;y++)n.call(r,x[y])&&(d[x[y]]=r[x[y]])}}return d},re}var oe,be;function fe(){if(be)return oe;be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oe=e,oe}var ie,Ee;function Ie(){return Ee||(Ee=1,ie=Function.call.bind(Object.prototype.hasOwnProperty)),ie}var ae,ke;function dt(){if(ke)return ae;ke=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=fe(),n={},i=Ie();e=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function a(c,u,r,d,x){if(process.env.NODE_ENV!=="production"){for(var h in c)if(i(c,h)){var m;try{if(typeof c[h]!="function"){var y=Error((d||"React class")+": "+r+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}m=c[h](u,h,d,r,null,t)}catch(q){m=q}if(m&&!(m instanceof Error)&&e((d||"React class")+": type specification of "+r+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var B=x?x():"";e("Failed "+r+" type: "+m.message+(B??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ae=a,ae}var le,Re;function ut(){if(Re)return le;Re=1;var e=G.reactIsExports,t=ct(),n=fe(),i=Ie(),a=dt(),c=function(){};process.env.NODE_ENV!=="production"&&(c=function(r){var d="Warning: "+r;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function u(){return null}return le=function(r,d){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function m(l){var f=l&&(x&&l[x]||l[h]);if(typeof f=="function")return f}var y="<<anonymous>>",B={array:D("array"),bigint:D("bigint"),bool:D("boolean"),func:D("function"),number:D("number"),object:D("object"),string:D("string"),symbol:D("symbol"),any:O(),arrayOf:w,element:F(),elementType:W(),instanceOf:_,node:Le(),objectOf:U,oneOf:$,oneOfType:Me,shape:Ne,exact:He};function q(l,f){return l===f?l!==0||1/l===1/f:l!==l&&f!==f}function k(l,f){this.message=l,this.data=f&&typeof f=="object"?f:{},this.stack=""}k.prototype=Error.prototype;function A(l){if(process.env.NODE_ENV!=="production")var f={},R=0;function b(S,j,E,C,I,T,N){if(C=C||y,T=T||E,N!==n){if(d){var P=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 P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+E;!f[J]&&R<3&&(c("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. 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."),f[J]=!0,R++)}}return j[E]==null?S?j[E]===null?new k("The "+I+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new k("The "+I+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:l(j,E,C,I,T)}var v=b.bind(null,!1);return v.isRequired=b.bind(null,!0),v}function D(l){function f(R,b,v,S,j,E){var C=R[b],I=z(C);if(I!==l){var T=V(C);return new k("Invalid "+S+" `"+j+"` of type "+("`"+T+"` supplied to `"+v+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return A(f)}function O(){return A(u)}function w(l){function f(R,b,v,S,j){if(typeof l!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside arrayOf.");var E=R[b];if(!Array.isArray(E)){var C=z(E);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an array."))}for(var I=0;I<E.length;I++){var T=l(E,I,v,S,j+"["+I+"]",n);if(T instanceof Error)return T}return null}return A(f)}function F(){function l(f,R,b,v,S){var j=f[R];if(!r(j)){var E=z(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement."))}return null}return A(l)}function W(){function l(f,R,b,v,S){var j=f[R];if(!e.isValidElementType(j)){var E=z(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement type."))}return null}return A(l)}function _(l){function f(R,b,v,S,j){if(!(R[b]instanceof l)){var E=l.name||y,C=$e(R[b]);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected ")+("instance of `"+E+"`."))}return null}return A(f)}function $(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?c("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])."):c("Invalid argument supplied to oneOf, expected an array.")),u;function f(R,b,v,S,j){for(var E=R[b],C=0;C<l.length;C++)if(q(E,l[C]))return null;var I=JSON.stringify(l,function(N,P){var J=V(P);return J==="symbol"?String(P):P});return new k("Invalid "+S+" `"+j+"` of value `"+String(E)+"` "+("supplied to `"+v+"`, expected one of "+I+"."))}return A(f)}function U(l){function f(R,b,v,S,j){if(typeof l!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside objectOf.");var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an object."));for(var I in E)if(i(E,I)){var T=l(E,I,v,S,j+"."+I,n);if(T instanceof Error)return T}return null}return A(f)}function Me(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&c("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<l.length;f++){var R=l[f];if(typeof R!="function")return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+We(R)+" at index "+f+"."),u}function b(v,S,j,E,C){for(var I=[],T=0;T<l.length;T++){var N=l[T],P=N(v,S,j,E,C,n);if(P==null)return null;P.data&&i(P.data,"expectedType")&&I.push(P.data.expectedType)}var J=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new k("Invalid "+E+" `"+C+"` supplied to "+("`"+j+"`"+J+"."))}return A(b)}function Le(){function l(f,R,b,v,S){return X(f[R])?null:new k("Invalid "+v+" `"+S+"` supplied to "+("`"+b+"`, expected a ReactNode."))}return A(l)}function he(l,f,R,b,v){return new k((l||"React class")+": "+f+" type `"+R+"."+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+v+"`.")}function Ne(l){function f(R,b,v,S,j){var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));for(var I in l){var T=l[I];if(typeof T!="function")return he(v,S,j,I,V(T));var N=T(E,I,v,S,j+"."+I,n);if(N)return N}return null}return A(f)}function He(l){function f(R,b,v,S,j){var E=R[b],C=z(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));var I=t({},R[b],l);for(var T in I){var N=l[T];if(i(l,T)&&typeof N!="function")return he(v,S,j,T,V(N));if(!N)return new k("Invalid "+S+" `"+j+"` key `"+T+"` supplied to `"+v+"`.\nBad object: "+JSON.stringify(R[b],null," ")+`
|
|
56
|
-
Valid keys: `+JSON.stringify(Object.keys(l),null," "));var P=N(E,T,v,S,j+"."+T,n);if(P)return P}return null}return A(f)}function X(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(X);if(l===null||r(l))return!0;var f=m(l);if(f){var R=f.call(l),b;if(f!==l.entries){for(;!(b=R.next()).done;)if(!X(b.value))return!1}else for(;!(b=R.next()).done;){var v=b.value;if(v&&!X(v[1]))return!1}}else return!1;return!0;default:return!1}}function Fe(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function z(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":Fe(f,l)?"symbol":f}function V(l){if(typeof l>"u"||l===null)return""+l;var f=z(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function We(l){var f=V(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function $e(l){return!l.constructor||!l.constructor.name?y:l.constructor.name}return B.checkPropTypes=a,B.resetWarningCache=a.resetWarningCache,B.PropTypes=B,B},le}var ce,we;function pt(){if(we)return ce;we=1;var e=fe();function t(){}function n(){}return n.resetWarningCache=t,ce=function(){function i(u,r,d,x,h,m){if(m!==e){var y=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 y.name="Invariant Violation",y}}i.isRequired=i;function a(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},ce}var $t=te.exports;if(process.env.NODE_ENV!=="production"){var ft=G.reactIsExports,xt=!0;te.exports=ut()(ft.isElement,xt)}else te.exports=pt()();var ht=te.exports;const M=Ye.getDefaultExportFromCjs(ht);let Be,Ae;typeof document<"u"&&(Be=document);typeof window<"u"&&(Ae=window);const De=g.createContext({document:Be,window:Ae}),se=()=>g.useContext(De),{Provider:gt,Consumer:Ut}=De;class _e extends g.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return g.Children.only(this.props.children)}}K(_e,"propTypes",{children:M.element.isRequired,contentDidMount:M.func.isRequired,contentDidUpdate:M.func.isRequired});class ue extends g.Component{constructor(n,i){super(n,i);K(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:i}=this.props;typeof i=="function"?i(n):i&&(i.current=n)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=g.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 n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const i=this.props.contentDidMount,a=this.props.contentDidUpdate,c=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(_e,{contentDidMount:i,contentDidUpdate:a,children:s.jsxRuntimeExports.jsx(gt,{value:{document:n,window:c},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),r=this.getMountTarget();return[ge.createPortal(this.props.head,this.getDoc().head),ge.createPortal(u,r)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(ue,"propTypes",{style:M.object,head:M.node,initialContent:M.string,mountTarget:M.string,contentDidMount:M.func,contentDidUpdate:M.func,children:M.oneOfType([M.element,M.arrayOf(M.element)])}),K(ue,"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 mt=g.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(ue,{...e,forwardedRef:t}));let Y=null,Q=[],Z=null,Oe=null;function yt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),i=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),c=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:i,paddingRight:a,paddingBottom:c}}const Se=(e,t,n)=>{if(!Y)return;const i=e.getBoundingClientRect(),a=Y==null?void 0:Y.getElementById("placeholder"),{paddingLeft:c,paddingTop:u,paddingRight:r,paddingBottom:d}=yt(e);a.style.width=t==="vertical"?i.width-c-r+"px":"2px",a.style.height=t==="vertical"?"2px":i.height-u-d+"px",a.style.display="block";const x=Q.reduce((h,m)=>Math.abs(m-n)<Math.abs(h-n)?m:h);Oe=Q.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+c+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},vt=e=>{const t=qe(e),n=window.getComputedStyle(e),i=t==="horizontal",a=parseInt(n.paddingLeft),c=parseInt(n.paddingTop);let u=i?a:c;Q=[u],Array.from(e.children).forEach(r=>{const d=window.getComputedStyle(r),x=parseInt(i?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),h=i?r.offsetWidth:r.offsetHeight;Q.push(u+h+x),u+=h+x})};function qe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const i=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(i.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const jt=p.throttle(e=>{const t=e.target,n=qe(t);if(n==="vertical"){const i=e.clientY-t.offsetTop;Se(t,n,i)}else{const i=e.clientX-t.offsetLeft;Se(t,n,i)}},200),bt=e=>{e.preventDefault(),e.stopPropagation(),jt(e)};function de(){const e=Y==null?void 0:Y.getElementById("placeholder");e.style.display="none"}const Et=()=>{const{document:e}=se(),[t,n]=H.useAtom(o.draggingFlagAtom),i=Je.useAddBlockByDrop(),a=Ce.useFeature("dnd"),[,c]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return Y=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?bt:p.noop,onDrop:a?r=>{Z==null||Z.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(r.dataTransfer.getData("text/plain"));let x=r.target.getAttribute("data-block-id");x===null&&(x=r.target.parentElement.getAttribute("data-block-id")),i({block:d,dropTargetId:x||null,relativeIndex:Oe}),n(!1),de(),setTimeout(()=>{de()},300)}:p.noop,onDragEnter:a?r=>{const d=r;Z=d.target,d.stopPropagation(),d.preventDefault(),Q=[];const x=d.target;vt(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),c(""),u([])}:p.noop,onDragLeave:a?r=>{const d=r;Z=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:p.noop,onMouseOut:a?()=>{n(!1),de()}:p.noop}};function xe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function kt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Rt=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[i,a]=H.useAtom(o.inlineEditingActiveAtom);return c=>{var m;if(i)return;const u=xe(c.target),r=u.getAttribute("data-block-type");if(!r||!e.includes(r))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(y=>{y.name!=="class"&&d.removeAttribute(y.name)}),r==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new Ke.Quill(d,{placeholder:"Type here..."});function h(){const y=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:y}),u.removeAttribute("style"),d.removeEventListener("blur",h,!0),kt(x),a(""),n("")}d.addEventListener("blur",h,!0),x.focus(),(m=d.querySelector(".ql-clipboard"))==null||m.remove(),a(u.getAttribute("data-block-id"))}},wt=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[n]=H.useAtom(o.inlineEditingActiveAtom);return i=>{if(n)return;i.stopPropagation();const a=xe(i.target);if(a!=null&&a.getAttribute("data-block-parent")){const c=a.getAttribute("data-style-prop"),u=a.getAttribute("data-style-id"),r=a.getAttribute("data-block-parent");e([{id:u,prop:c,blockId:r}]),t([r])}else a!=null&&a.getAttribute("data-block-id")&&t([a.getAttribute("data-block-id")])}},St=p.throttle((e,t)=>{const n=xe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Ct=()=>{const[,e]=o.useHighlightBlockId(),[t]=H.useAtom(o.inlineEditingActiveAtom);return n=>{t||St(n,e)}},Tt=({children:e})=>{const{document:t}=se(),[n]=o.useSelectedBlockIds(),[i,a]=o.useSelectedStylingBlocks();g.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(i))return;const x=Pe(t,p.first(n));if(x){const h=x.getAttribute("data-style-prop");if(h){const m=x.getAttribute("data-style-id"),y=x.getAttribute("data-block-parent");a([{id:m,prop:h,blockId:y}])}}},100)},[t,n,a,i]);const c=Rt(),u=wt(),r=Ct(),d=Et();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:c,onMouseMove:r,...p.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},Pe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),It=()=>{const{window:e}=se(),[t,n]=o.useSelectedBlockIds(),i=o.useAllBlocks(),[,a]=o.useSelectedStylingBlocks(),{undo:c,redo:u}=o.useCanvasHistory(),r=o.useDuplicateBlocks(),[,d]=o.useCutBlockIds(),[,x]=o.useCopyBlockIds(),{pasteBlocks:h}=o.usePasteBlocks(),[,m]=o.usePreviewMode(),y=o.useRemoveBlocks(),{savePage:B}=o.useSavePage(),[q]=H.useAtom(o.inlineEditingActiveAtom),[,k]=H.useAtom(o.editLayerNameAtom),A=O=>{O.key==="Enter"&&(O.preventDefault(),t.length===1&&k(p.first(t)))},D=O=>{const w=i.find(F=>F._id===O);return w?w._parent:null};return g.useEffect(()=>{const O=w=>{if(w.key==="Escape"){n([]),a([]);return}if(A(w),!q&&(w.key==="Delete"||w.key==="Backspace")&&(w.preventDefault(),y(t)),w.ctrlKey||w.metaKey){if(w.key==="ArrowUp"){w.preventDefault();const F=t.length>0?D(t[0]):null;F&&n([F])}if(["z","y","d","x","c","p","s","v"].includes(w.key)){if(q&&["x","z","v"].includes(w.key))return!0;w.preventDefault()}w.key==="s"&&(w.stopPropagation(),w.preventDefault(),B()),w.key==="z"&&c(),w.key==="y"&&u(),w.key==="d"&&r(t),w.key==="x"&&d(t),w.key==="c"&&x(t),w.key==="v"&&t.length>0&&h(t[0])}};return e.removeEventListener("keydown",O),e.addEventListener("keydown",O),()=>{e.removeEventListener("keydown",O)}},[t,n,c,y,m,u,r,d,x,h,q,B,e]),null},Bt=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[,a]=H.useAtom(o.draggedBlockIdAtom),c=Ce.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:c?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(p.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{n([]),i(null)},200)},children:[s.jsxRuntimeExports.jsx(L.DragHandleDots2Icon,{}),t]})},At=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),i=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,c]=o.useSelectedStylingBlocks(),[u]=H.useAtom(o.inlineEditingActiveAtom),{floatingStyles:r,refs:d,update:x}=me.useFloating({placement:"top-start",middleware:[me.shift(),Ve.flip()],elements:{reference:e}});Ze.useResizeObserver(e,()=>x(),e!==null);const h=p.get(t,"_parent",null),m=p.isEmpty(p.get(t,"_name",""))?p.get(t,"_type",""):p.get(t,"_name","");return!e||!t||u?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:r,onClick:y=>{y.stopPropagation(),y.preventDefault()},onKeyDown:y=>y.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Bt,{label:m,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[h&&s.jsxRuntimeExports.jsx(L.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{c([]),a([h])}}),o.canDuplicateBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.CopyIcon,{className:"hover:scale-105 ",onClick:()=>i([t==null?void 0:t._id])}):null,o.canDeleteBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Dt=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[i]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[c]=o.useSelectedStylingBlocks(),[u]=H.useAtom(o.draggedBlockIdAtom),{document:r,window:d}=se(),[x]=g.useState(r==null?void 0:r.getElementById("highlighted-block")),[h]=g.useState(r==null?void 0:r.getElementById("selected-block")),[m]=g.useState(r==null?void 0:r.getElementById("selected-styling-block")),[y]=g.useState(r==null?void 0:r.getElementById("dragged-block"));g.useEffect(()=>{i?r==null||r.documentElement.classList.add("dark"):r==null||r.documentElement.classList.remove("dark")},[i,r]);const B=p.get(t,"headingFont","DM Sans"),q=p.get(t,"bodyFont","DM Sans");return g.useEffect(()=>{const k=p.get(t,"primaryColor","#000"),A=p.get(t,"secondaryColor","#FFF"),D=Qe.tailwindcssPaletteGenerator({colors:[k,A],names:["primary","secondary"]});D.primary.DEFAULT=k,D.secondary.DEFAULT=A;const O=p.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[B],body:[q]},extend:{borderRadius:{global:`${O||"0"}px`},colors:D}},plugins:[d.tailwind.plugin.withOptions(({prefix:w="ui"}={})=>({addVariant:F})=>{for(const W of["open","checked","selected","active","disabled"])F(`${w}-${W}`,[`&[data-headlessui-state~="${W}"]`,`:where([data-headlessui-state~="${W}"]) &`]),F(`${w}-not-${W}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${W}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${W}"])) &:not([data-headlessui-state])`])})]})},[t,d,B,q]),g.useEffect(()=>{h&&(h.textContent=`${p.map(n,k=>`[data-block-id="${k}"]`).join(",")}{
|
|
57
|
-
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
58
|
-
}`)},[n,h]),g.useEffect(()=>{if(!u){y.textContent="";return}y.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),g.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,n,x]),g.useEffect(()=>{m&&(m.textContent=`${p.map(c,({id:k})=>`[data-style-id="${k}"]`).join(",")}{
|
|
59
|
-
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
60
|
-
}`)},[c,m]),g.useEffect(()=>{const k=p.get(t,"bodyTextLightColor","#64748b"),A=p.get(t,"bodyTextDarkColor","#94a3b8"),D=p.get(t,"bodyBgLightColor","#FFFFFF"),O=p.get(t,"bodyBgDarkColor","#0f172a");r.body.className=`font-body antialiased text-[${k}] bg-[${D}] dark:text-[${A}] dark:bg-[${O}]`},[t,r,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[B&&s.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"}),q&&B!==q&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${q.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),B&&s.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},_t=e=>{const t={};return Object.keys(e).forEach(n=>{p.isString(e[n])&&e[n].startsWith(ee.SLOT_KEY)&&(t[n]=e[n].replace(ee.SLOT_KEY,"").split(","))}),t},Ot=p.memoize(e=>{const t=e.replace(ee.STYLES_KEY,"").split(",");return Xe.twMerge(t[0],t[1])});function qt(e,t){return p.get(e,`${t}_attrs`,{})}function Pt(e){const t={};return Object.keys(e).forEach(n=>{if(p.isString(e[n])&&e[n].startsWith(ee.STYLES_KEY)){const i=Ot(e[n]);t[n]={className:i,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...qt(e,n)}}}),t}function Mt(e,t){const n=p.get(e,"_bindings",{});return p.isEmpty(n)?{...e}:(p.each(n,(i,a)=>{p.isString(i)&&p.get(t,i,null)&&(e[a]=p.get(t,i,null))}),e)}function pe({blocks:e}){const t=o.useAllBlocks(),n=g.useCallback(c=>Pt(c),[]),[i]=G.useChaiExternalData(),[a]=H.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((c,u)=>{if(a===c._id)return null;const r=_t(c),d={};p.isEmpty(r)||Object.keys(r).forEach(y=>{d[y]=g.Children.toArray(r[y].map(B=>s.jsxRuntimeExports.jsx(pe,{blocks:[p.find(t,{_id:B})]})))});const x=p.filter(t,{_parent:c._id});d.children=x.length?s.jsxRuntimeExports.jsx(pe,{blocks:x}):null;const h=Te.getBlockComponent(c._type),m=p.get(h,"builderComponent",p.get(h,"component",null));return p.isNull(m)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${c==null?void 0:c._type} not registered -->`}):s.jsxRuntimeExports.jsx(g.Suspense,{children:g.createElement(m,{blockProps:{"data-block-id":c._id,"data-block-type":c._type,"data-dnd":et.has(h,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...Mt(c,i),...n(c),...d})})}))})}const Lt=()=>{const e=o.useAllBlocks(),t=o.useBuilderProp("container",null),n=p.isEmpty(e)?null:s.jsxRuntimeExports.jsx(G.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(pe,{blocks:p.filter(e,a=>p.isEmpty(a._parent))})}),i=t?g.createElement(Te.getBlockComponent(t).component,{},n):n;return s.jsxRuntimeExports.jsx(Ge.Provider,{children:i})},Nt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Ht=()=>{const[e]=H.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,i]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,c]=o.useHighlightBlockId(),u=g.useRef(null),r=g.useRef(null),[d,x]=g.useState({width:0,height:0}),h=lt(d),[m,y]=g.useState(0),[B,q]=g.useState([]),[,k]=g.useState([]),[,A]=H.useAtom(o.canvasIframeAtom),[D,O]=o.useSelectedStylingBlocks(),w=o.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:_,clientHeight:$}=r.current;x({width:_,height:$}),m===0&&y(_)},[r,n,m]);const F=(_,$=0)=>{const{top:U}=_.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};g.useEffect(()=>{var _,$;if(a&&a.type!=="Multiple"&&u.current){const U=Pe(u.current.contentDocument,a._id);U&&(F(U)||($=(_=u.current)==null?void 0:_.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),q([U]))}},[a]),g.useEffect(()=>{if(!p.isEmpty(D)&&u.current){const _=Nt(u.current.contentDocument,p.first(D).id);k(_?[_]:[null])}else k([null])},[D]);const W=g.useMemo(()=>{let _=at;return e==="offline"&&(_=_.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),_=_.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),_=_.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),_},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),O([])},onMouseLeave:()=>setTimeout(()=>c(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:m>0&&!p.isEmpty(h)?{width:t?"100%":m}:{},ref:r,children:s.jsxRuntimeExports.jsxs(mt,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:W,children:[s.jsxRuntimeExports.jsx(It,{}),s.jsxRuntimeExports.jsx(At,{block:a,selectedBlockElement:p.first(B)}),s.jsxRuntimeExports.jsx(Dt,{model:"page"}),s.jsxRuntimeExports.jsx(Tt,{children:w?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Lt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Ft=()=>s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(it,{}),s.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:s.jsxRuntimeExports.jsx(g.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(G.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Ht,{})})})})]});exports.default=Ft;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),t=require("./index-H6vIwGfD.cjs"),i=require("lodash-es"),h=require("sonner"),l=require("react"),o=require("./index-N50dZnlC.cjs"),j=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const p=()=>{const{data:s}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=t.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&s.homepage&&!i.find(u,{uuid:n})&&a(s.homepage)},[n,u,s,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(t.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(t.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
package/dist/Layers-eaHy5PK9.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("lodash-es"),s=require("@radix-ui/react-icons"),q=require("react-dnd"),C=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),n=require("./index-H6vIwGfD.cjs"),O=require("lucide-react"),g=require("react"),_=require("./MODIFIERS-2FeVfZQ9.cjs"),B=require("./Functions-N3yhPYKY.cjs"),A=require("./index-N50dZnlC.cjs"),P=require("./useAddBlockByDrop-inkD7Lck.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const y=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function H(t=""){const r={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(c);if(u.nth(l,1))return`Visible >=${r[u.nth(l,1)]}`}return""}const L=t=>{let r="";return Object.keys(t).forEach(o=>{u.startsWith(t[o],_.STYLES_KEY)&&(r=t[o])}),r},F=t=>{var R;const[,r]=n.useHighlightBlockId(),[o]=n.useHiddenBlockIds(),{isSelected:x}=t,{id:c,data:l}=t.node,d=t.depth*10,p=a=>{a.stopPropagation(),t.onToggle(t.node.id)},E=C.useDragOver(c,t.isOpen,t.onToggle),m=g.useMemo(()=>{const a=L(t.node.data);return H(a)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>r(c),className:B.cn("group flex w-full items-center justify-between space-x-px py-px",x?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&t.onSelect(c)},onContextMenu:()=>t.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:p,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(y,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=t.node.data)==null?void 0:R._name)||t.node.text}),m?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(x?"text-gray-200":"text-gray-500"),children:["(",m,")"]}):null]})]})})},V=t=>{var o;const{item:r}=t.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(y,{type:(o=r==null?void 0:r.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:r.text})]})},z=t=>{const r=t.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:r}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-X5dNmZcb.cjs"))),$=()=>{const[t]=n.useSelectedBlockIds(),[,r]=n.useCutBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},K=()=>{const[t]=n.useSelectedBlockIds(),[,r]=n.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},Q=()=>{const[t]=n.useSelectedBlockIds(),r=n.useRemoveBlocks(),o=n.useSelectedBlock();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},U=({id:t=null,openMarkAsGlobalModal:r})=>{const[o]=n.useSelectedBlockIds(),x=n.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=n.usePasteBlocks(),d=n.useBuilderProp("globalBlocksSupport",!1),p=g.useCallback(()=>{x(o)},[o,x]);return e.jsxRuntimeExports.jsxs(n.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(n.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:r,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(s.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:p,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:t,id:r=null})=>{const[o,x]=g.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(n.Dialog,{open:o,onOpenChange:x,children:o&&e.jsxRuntimeExports.jsx(n.DialogContent,{children:e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>x(!1),id:r})})})}),e.jsxRuntimeExports.jsxs(n.ContextMenu,{children:[e.jsxRuntimeExports.jsx(n.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(U,{id:r,openMarkAsGlobalModal:()=>x(!0)})]})]})};function W(t){return u.map(t,r=>{const{data:o}=r;return{...o,_parent:r.parent===0?null:r.parent}})}function J(){const[t]=n.useBlocksContainer(),[r,o]=n.useSelectedBlockIds();return t?(console.log("container",t),e.jsxRuntimeExports.jsxs("div",{onClick:x=>{x.stopPropagation(),o(["container"])},className:B.cn("flex items-center pl-2 text-xs",u.includes(r,"container")?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),children:[e.jsxRuntimeExports.jsx(s.BoxIcon,{})," ",t._type]})):null}const X=()=>{const t=n.useAllBlocks(),[r]=n.useSetAllBlocks(),[o,x,c]=n.useSelectedBlockIds(),[,l]=n.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:p}=n.useCanvasHistory(),E=A.useExpandedIds(),m=P.useAddBlockByDrop(),[R]=n.useBlocksContainer(),a=async(i,j)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:f}=j;if(h){p();const T=W(i);r(T);const M=f.getItem();x([M.id])}else await m({block:f.getItem(),dropTargetId:k,relativeIndex:b})},v=u.map(t,i=>({id:i._id,text:i._type,parent:i._parent||0,droppable:!u.isUndefined(u.find(t,{_parent:i._id})),data:i})),S=()=>{x([]),l([])},[{isOver:I},w]=q.useDrop(()=>({accept:["CHAI_BLOCK"],collect:i=>({canDrop:i.canDrop(),isOver:i.isOver()}),drop:i=>{(async()=>await m({block:i,dropTargetId:"",relativeIndex:0}))()}})),{isDragging:D}=q.useDragLayer(i=>({isDragging:i.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsxs(n.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:[e.jsxRuntimeExports.jsx(J,{}),e.jsxRuntimeExports.jsx(C.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(i,{depth:j,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:i.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),x([k])},isSelected:u.includes(o,i.id),node:i,depth:j,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:i=>e.jsxRuntimeExports.jsx(V,{monitorProps:i}),onDrop:a,classes:{root:"h-[90%] "+(R?"pl-2":"pt-2"),draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:n.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(i,{depth:j})=>e.jsxRuntimeExports.jsx(z,{node:i,depth:j})})]})})})};exports.default=X;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useTranslation as p } from "react-i18next";
|
|
3
|
-
import { GlobeIcon as n } from "@radix-ui/react-icons";
|
|
4
|
-
import { useState as c } from "react";
|
|
5
|
-
import { a0 as d, B as l } from "./index-niHREMmR.js";
|
|
6
|
-
import { capitalize as x } from "lodash-es";
|
|
7
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
|
-
import "@radix-ui/react-toggle";
|
|
9
|
-
import "class-variance-authority";
|
|
10
|
-
import "./utils-AvyFzbPC.js";
|
|
11
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
12
|
-
import "clsx";
|
|
13
|
-
import "tailwind-merge";
|
|
14
|
-
import "@radix-ui/react-switch";
|
|
15
|
-
import "@radix-ui/react-slot";
|
|
16
|
-
import "@radix-ui/react-accordion";
|
|
17
|
-
import "@radix-ui/react-alert-dialog";
|
|
18
|
-
import "@radix-ui/react-dialog";
|
|
19
|
-
import "@radix-ui/react-label";
|
|
20
|
-
import "@radix-ui/react-scroll-area";
|
|
21
|
-
import "@radix-ui/react-tabs";
|
|
22
|
-
import "@radix-ui/react-tooltip";
|
|
23
|
-
import "@radix-ui/react-popover";
|
|
24
|
-
import "@radix-ui/react-menubar";
|
|
25
|
-
import "@radix-ui/react-hover-card";
|
|
26
|
-
import "@radix-ui/react-select";
|
|
27
|
-
import "@radix-ui/react-dropdown-menu";
|
|
28
|
-
import "@radix-ui/react-separator";
|
|
29
|
-
import "@radix-ui/react-toast";
|
|
30
|
-
import "cmdk";
|
|
31
|
-
import "@radix-ui/react-context-menu";
|
|
32
|
-
import "react-icons-picker";
|
|
33
|
-
import "react-dom";
|
|
34
|
-
import "react-quill";
|
|
35
|
-
import "jotai";
|
|
36
|
-
import "flat-to-nested";
|
|
37
|
-
import "./Functions-7jnEwJyw.js";
|
|
38
|
-
import "redux-undo";
|
|
39
|
-
import "@chaibuilder/runtime";
|
|
40
|
-
import "lodash";
|
|
41
|
-
import "@react-hookz/web";
|
|
42
|
-
const ot = ({ id: m = null, closeModal: i }) => {
|
|
43
|
-
const { t: o } = p(), e = d(), [r, a] = c("");
|
|
44
|
-
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
45
|
-
/* @__PURE__ */ t.jsx("h1", { className: "text-lg font-bold", children: o("mark_as_global") }),
|
|
46
|
-
/* @__PURE__ */ t.jsxs("div", { className: "py-2 text-sm", children: [
|
|
47
|
-
o("global_block_note"),
|
|
48
|
-
/* @__PURE__ */ t.jsx("br", {}),
|
|
49
|
-
/* @__PURE__ */ t.jsxs("ul", { className: "mt-4 list-inside list-disc space-y-1", children: [
|
|
50
|
-
/* @__PURE__ */ t.jsxs("li", { children: [
|
|
51
|
-
o("global_block_indicator"),
|
|
52
|
-
" ",
|
|
53
|
-
/* @__PURE__ */ t.jsx(n, { className: "inline" })
|
|
54
|
-
] }),
|
|
55
|
-
/* @__PURE__ */ t.jsx("li", { children: o("global_block_category") })
|
|
56
|
-
] })
|
|
57
|
-
] }),
|
|
58
|
-
/* @__PURE__ */ t.jsxs("div", { className: "my-4", children: [
|
|
59
|
-
/* @__PURE__ */ t.jsx("label", { className: "block text-sm font-medium text-gray-400", children: o("enter_global_block_name") }),
|
|
60
|
-
/* @__PURE__ */ t.jsx(
|
|
61
|
-
"input",
|
|
62
|
-
{
|
|
63
|
-
placeholder: o("eg_header_footer"),
|
|
64
|
-
className: "mt-2 w-full",
|
|
65
|
-
value: r,
|
|
66
|
-
onChange: (s) => a(s.target.value)
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
] }),
|
|
70
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-end gap-x-4", children: [
|
|
71
|
-
/* @__PURE__ */ t.jsx(
|
|
72
|
-
l,
|
|
73
|
-
{
|
|
74
|
-
onClick: () => {
|
|
75
|
-
e(m, x(r)), i();
|
|
76
|
-
},
|
|
77
|
-
disabled: r.length <= 2,
|
|
78
|
-
variant: "default",
|
|
79
|
-
children: o("mark_as_global")
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ t.jsx(l, { variant: "outline", onClick: i, children: o("cancel") })
|
|
83
|
-
] })
|
|
84
|
-
] });
|
|
85
|
-
};
|
|
86
|
-
export {
|
|
87
|
-
ot as default
|
|
88
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react-i18next"),c=require("@radix-ui/react-icons"),x=require("react"),i=require("./index-H6vIwGfD.cjs"),q=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");const m=({id:u=null,closeModal:t})=>{const{t:r}=o.useTranslation(),l=i.useMarkAsGlobalBlock(),[s,n]=x.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:r("mark_as_global")}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:[r("global_block_note"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:[r("global_block_indicator")," ",e.jsxRuntimeExports.jsx(c.GlobeIcon,{className:"inline"})]}),e.jsxRuntimeExports.jsx("li",{children:r("global_block_category")})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:r("enter_global_block_name")}),e.jsxRuntimeExports.jsx("input",{placeholder:r("eg_header_footer"),className:"mt-2 w-full",value:s,onChange:a=>n(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(u,q.capitalize(s)),t()},disabled:s.length<=2,variant:"default",children:r("mark_as_global")}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:t,children:r("cancel")})]})]})};exports.default=m;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-N50dZnlC.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("i18next");require("react-i18next");require("./index-H6vIwGfD.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-MwS7iXn_.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-SLt8XgYv.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
|