@chaibuilder/sdk 1.2.48 → 1.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-cX8vIt0V.js → AddBlocks-IX7HKzSe.js} +15 -15
- package/dist/AddBlocks-zwZ63DdP.cjs +1 -0
- package/dist/CanvasArea-URgoG1jc.cjs +56 -0
- package/dist/{CanvasArea-HRipTJFS.js → CanvasArea-ehmBje_E.js} +285 -269
- package/dist/{ChaiBuilderEditor-dKHRL-Es.js → ChaiBuilderEditor-3xIN-AP_.js} +7592 -7645
- package/dist/{ChaiBuilderEditor-EtQOC5uy.cjs → ChaiBuilderEditor-ZRHqW7Gd.cjs} +50 -50
- package/dist/CodeEditor-0F7Dz3AB.js +97 -0
- package/dist/CodeEditor-1vu-qNgT.cjs +1 -0
- package/dist/CurrentPage-HOPNdQZ-.cjs +1 -0
- package/dist/{CurrentPage-U8ms8Hs7.js → CurrentPage-qhBjm7th.js} +10 -10
- package/dist/ListTree-DkbFFDXB.cjs +1 -0
- package/dist/{ListTree-OgLdyfQs.js → ListTree-sTwXvXST.js} +123 -114
- package/dist/{MODIFIERS-cBT31iqE.js → MODIFIERS-fd5XOmum.js} +8 -4
- package/dist/MODIFIERS-mVmfEGgo.cjs +1 -0
- package/dist/{PagesPanel-MsUBq9Xx.js → PagesPanel-5iVsbDP1.js} +7 -7
- package/dist/PagesPanel-kdl4A0IN.cjs +1 -0
- package/dist/{ProjectPanel-hsZG_Btj.js → ProjectPanel-c8oTzhQd.js} +7 -7
- package/dist/ProjectPanel-mXPBI-TU.cjs +1 -0
- package/dist/{Settings-WcLqIeQy.js → Settings-0uSGoECC.js} +536 -514
- package/dist/Settings-3kBSStO6.cjs +1 -0
- package/dist/{SidePanels-PmCljlnf.js → SidePanels-YLWdBer9.js} +108 -115
- package/dist/SidePanels-kKram02Q.cjs +1 -0
- package/dist/ThemeConfiguration-8W1CM4tW.cjs +1 -0
- package/dist/{ThemeConfiguration-mkbFdePB.js → ThemeConfiguration-AAGFJieC.js} +5 -5
- package/dist/Topbar-CLNUPx7K.cjs +1 -0
- package/dist/{Topbar-FPywhpub.js → Topbar-nX9Muoem.js} +8 -8
- package/dist/UILibrariesPanel-cp0Mkaq_.cjs +1 -0
- package/dist/UILibrariesPanel-fKn2nlgI.js +196 -0
- package/dist/UnsplashImages-56HoW_ZA.cjs +1 -0
- package/dist/{UnsplashImages-7uAXYHPH.js → UnsplashImages-zTZa3LjG.js} +4 -4
- package/dist/{UploadImages-5M0Q27R-.js → UploadImages-SnfaTrlz.js} +4 -4
- package/dist/UploadImages-okNGjkXb.cjs +1 -0
- package/dist/add-page-modal-Y2RY3x01.cjs +1 -0
- package/dist/{add-page-modal-6o7MAbq-.js → add-page-modal-uDoO0zws.js} +12 -12
- package/dist/{confirm-alert-jL0z_gFv.js → confirm-alert-9XiVxCc0.js} +4 -4
- package/dist/confirm-alert-aD7AMK_6.cjs +1 -0
- package/dist/controls-rRZhz0vu.cjs +1 -0
- package/dist/{controls-VTdJhdSz.js → controls-yjgoZzB6.js} +31 -18
- package/dist/core.cjs +1 -1
- package/dist/core.js +6 -6
- package/dist/{delete-page-modal-U5_JYYp7.js → delete-page-modal-7sfoFf9r.js} +6 -6
- package/dist/delete-page-modal-ieJ367JA.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +4 -4
- package/dist/{form-KBtrnNWh.cjs → form-KWYHDVIf.cjs} +1 -1
- package/dist/{form-Sgpl2fXL.js → form-PQSmqcIl.js} +1 -1
- package/dist/{functions-7ybAMUuA.js → functions-JO0EW8GX.js} +6 -7
- package/dist/functions-ZZVUnIjD.cjs +1 -0
- package/dist/{html-to-json-Z6R2o_fA.js → html-to-json-GJ6RioQf.js} +1 -1
- package/dist/html-to-json-O1OpqICe.cjs +1 -0
- package/dist/index-VOrp9ZpX.cjs +1 -0
- package/dist/index-YpnaudSM.js +63 -0
- package/dist/index-ecnGWzh9.cjs +1 -0
- package/dist/{index-po-naEa5.js → index-i2kgLkjC.js} +15 -14
- package/dist/lib.cjs +2 -2
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js +19 -21
- package/dist/page-viewer-aoro5JxT.cjs +1 -0
- package/dist/{page-viewer-nLRRk7DR.js → page-viewer-qkwZJ6e-.js} +7 -7
- package/dist/{project-general-setting-D1UJdZ2D.js → project-general-setting-3gkaXq1F.js} +8 -8
- package/dist/project-general-setting-arXitV5_.cjs +1 -0
- package/dist/{project-seo-setting-VIZWEMRk.js → project-seo-setting-X8pykTmc.js} +6 -6
- package/dist/project-seo-setting-kjtUt-er.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +89 -90
- package/dist/single-page-detail-UsWG0gfh.cjs +1 -0
- package/dist/{single-page-detail-lQ8fujC5.js → single-page-detail-ZXZX6Xmw.js} +21 -21
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +6 -6
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +93 -93
- package/dist/useCodeEditor-CtjbxWLf.cjs +1 -0
- package/dist/useCodeEditor-yl5V3Hte.js +7 -0
- package/dist/{utils-K3Zk762G.cjs → utils-D_vtk3zK.cjs} +1 -1
- package/dist/{utils-iMv3T4WT.js → utils-VpVqnC9m.js} +1 -1
- package/dist/web-blocks.cjs +1 -33
- package/dist/web-blocks.js +468 -616
- package/package.json +4 -2
- package/dist/AddBlocks-_fhhS7Lm.cjs +0 -1
- package/dist/CanvasArea-N3rYeBJV.cjs +0 -55
- package/dist/CurrentPage-9FijxWbn.cjs +0 -1
- package/dist/ListTree-jOvHpo3_.cjs +0 -1
- package/dist/MODIFIERS-YPHRtwrM.cjs +0 -1
- package/dist/PagesPanel-8Cd6UYsh.cjs +0 -1
- package/dist/ProjectPanel-KmnXPfxx.cjs +0 -1
- package/dist/STRINGS--j49GZJP.js +0 -7
- package/dist/STRINGS-gPz7CUOk.cjs +0 -1
- package/dist/Settings-xVjTnVSf.cjs +0 -1
- package/dist/SidePanels-6zRgfZpi.cjs +0 -1
- package/dist/ThemeConfiguration-pt7TTAty.cjs +0 -1
- package/dist/Topbar--m1E08Jl.cjs +0 -1
- package/dist/UILibrariesPanel-HhHGcexY.cjs +0 -1
- package/dist/UILibrariesPanel-VrA2X4LO.js +0 -145
- package/dist/UnsplashImages-Yu0msAD8.cjs +0 -1
- package/dist/UploadImages-jS51ZcPG.cjs +0 -1
- package/dist/add-page-modal-KAbflupJ.cjs +0 -1
- package/dist/confirm-alert-dow0GlxC.cjs +0 -1
- package/dist/controls-jWJDao88.cjs +0 -1
- package/dist/delete-page-modal-EDQZneVM.cjs +0 -1
- package/dist/functions-yvRwasT2.cjs +0 -1
- package/dist/html-to-json-VPWiWWGH.cjs +0 -1
- package/dist/index-HjN7LtDT.cjs +0 -1
- package/dist/page-viewer-PfZEbcDZ.cjs +0 -1
- package/dist/project-general-setting-HO6zeum2.cjs +0 -1
- package/dist/project-seo-setting-gT9N1tnB.cjs +0 -1
- package/dist/single-page-detail-To8TcpgJ.cjs +0 -1
- package/dist/useCanvasSettings-7BXlDuLG.cjs +0 -1
- package/dist/useCanvasSettings-UzjYHFG5.js +0 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { KeyboardIcon as
|
|
3
|
-
import f, { useState as
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { filter as
|
|
6
|
-
import { Z as
|
|
7
|
-
import { ListTreeIcon as
|
|
2
|
+
import { KeyboardIcon as R, PlusIcon as S, Component2Icon as J } from "@radix-ui/react-icons";
|
|
3
|
+
import f, { useState as h, useEffect as Y, useMemo as Z, memo as W, lazy as j, Suspense as y } from "react";
|
|
4
|
+
import { useAtom as M } from "jotai";
|
|
5
|
+
import { filter as N, map as K, isNull as $, find as q, isEmpty as G, values as Q, each as X, get as ee } from "lodash-es";
|
|
6
|
+
import { Y as O, Z as H, _ as U, $ as F, a0 as se, a1 as re, A as ie, a as ae, b as te, c as le, d as oe, e as ne, f as ce, g as de, a2 as me, a3 as xe, a4 as he, a5 as ue, a6 as pe, a7 as fe, a8 as je, a9 as B, aa as ve, ab as ge, ac as be, ad as ye, ae as E, h as w, af as Ne, B as x, ag as z, ah as we, ai as ke, aj as L, ak as I } from "./ChaiBuilderEditor-3xIN-AP_.js";
|
|
7
|
+
import { ListTreeIcon as A, PaletteIcon as Ce, DatabaseIcon as De } from "lucide-react";
|
|
8
8
|
import { getChaiDataProviders as Te, useChaiBlocks as _e } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as v } from "react-i18next";
|
|
10
10
|
import { J as Ae, a as Pe, d as Se } from "./index-e0c8PmRQ.js";
|
|
11
|
-
import { O as
|
|
11
|
+
import { O as o } from "./MODIFIERS-fd5XOmum.js";
|
|
12
12
|
import { c as Ke } from "./Functions-7jnEwJyw.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
14
|
import "clsx";
|
|
@@ -18,9 +18,8 @@ import "@floating-ui/react-dom";
|
|
|
18
18
|
import "i18next";
|
|
19
19
|
import "flagged";
|
|
20
20
|
import "@react-hookz/web";
|
|
21
|
-
import "./MODIFIERS-cBT31iqE.js";
|
|
22
21
|
import "tree-model";
|
|
23
|
-
import "./utils-
|
|
22
|
+
import "./utils-VpVqnC9m.js";
|
|
24
23
|
import "tailwind-merge";
|
|
25
24
|
import "@radix-ui/react-toggle";
|
|
26
25
|
import "class-variance-authority";
|
|
@@ -44,23 +43,24 @@ import "@radix-ui/react-context-menu";
|
|
|
44
43
|
import "react-icons-picker";
|
|
45
44
|
import "react-quill";
|
|
46
45
|
import "react-hotkeys-hook";
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
import "./index-YpnaudSM.js";
|
|
47
|
+
const Be = ({ provider: s, onClose: l }) => {
|
|
48
|
+
const { t: a } = v(), [t, u] = h(null);
|
|
49
49
|
return Y(() => {
|
|
50
|
-
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) =>
|
|
51
|
-
}, [s]), s ? /* @__PURE__ */ e.jsx(
|
|
52
|
-
/* @__PURE__ */ e.jsxs(
|
|
53
|
-
/* @__PURE__ */ e.jsxs(
|
|
54
|
-
|
|
50
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => u(c));
|
|
51
|
+
}, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : l(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
52
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
53
|
+
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
54
|
+
a("data_provider"),
|
|
55
55
|
": ",
|
|
56
56
|
s.name
|
|
57
57
|
] }),
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
58
|
+
/* @__PURE__ */ e.jsx(se, { children: s.description })
|
|
59
59
|
] }),
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
|
|
61
61
|
Ae,
|
|
62
62
|
{
|
|
63
|
-
data:
|
|
63
|
+
data: t,
|
|
64
64
|
shouldExpandNode: Pe,
|
|
65
65
|
style: {
|
|
66
66
|
...Se,
|
|
@@ -74,53 +74,53 @@ const Be = ({ provider: s, onClose: o }) => {
|
|
|
74
74
|
};
|
|
75
75
|
function Ee({
|
|
76
76
|
children: s,
|
|
77
|
-
name:
|
|
78
|
-
onRemove:
|
|
77
|
+
name: l,
|
|
78
|
+
onRemove: a
|
|
79
79
|
}) {
|
|
80
|
-
const { t
|
|
80
|
+
const { t } = v();
|
|
81
81
|
return /* @__PURE__ */ e.jsxs(ie, { children: [
|
|
82
|
-
/* @__PURE__ */ e.jsx(
|
|
83
|
-
/* @__PURE__ */ e.jsxs(
|
|
84
|
-
/* @__PURE__ */ e.jsxs(
|
|
82
|
+
/* @__PURE__ */ e.jsx(ae, { asChild: !0, children: s }),
|
|
83
|
+
/* @__PURE__ */ e.jsxs(te, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsxs(le, { children: [
|
|
85
85
|
/* @__PURE__ */ e.jsx(
|
|
86
|
-
|
|
86
|
+
oe,
|
|
87
87
|
{
|
|
88
|
-
dangerouslySetInnerHTML: { __html:
|
|
88
|
+
dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", l) }
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(ne, { children: t("remove_provider_warning") })
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */ e.jsxs(
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
93
|
+
/* @__PURE__ */ e.jsxs(ce, { children: [
|
|
94
|
+
/* @__PURE__ */ e.jsx(de, { children: t("cancel") }),
|
|
95
|
+
/* @__PURE__ */ e.jsx(me, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: t("remove") })
|
|
96
96
|
] })
|
|
97
97
|
] })
|
|
98
98
|
] });
|
|
99
99
|
}
|
|
100
100
|
const ze = () => {
|
|
101
|
-
const { t: s } = v(),
|
|
102
|
-
|
|
103
|
-
), [k, p] =
|
|
104
|
-
|
|
105
|
-
(r) =>
|
|
101
|
+
const { t: s } = v(), l = Z(() => Te(), []), [a, t] = xe(), [, u] = M(he), [d, c] = h(
|
|
102
|
+
N(l, (r) => K(a, "providerKey").includes(r.providerKey))
|
|
103
|
+
), [k, p] = h(""), [C, g] = h(null), D = N(
|
|
104
|
+
l.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
105
|
+
(r) => !$(r)
|
|
106
106
|
), T = (r) => {
|
|
107
|
-
const m =
|
|
108
|
-
c((
|
|
107
|
+
const m = q(l, { providerKey: r });
|
|
108
|
+
c((i) => [...i, m]), t((i) => [...i, { providerKey: m.providerKey, args: {} }]), p(""), u("UNSAVED");
|
|
109
109
|
}, b = (r) => {
|
|
110
|
-
c((m) =>
|
|
110
|
+
c((m) => N(m, (i) => i.providerKey !== r.providerKey)), t((m) => N(m, (i) => i.providerKey !== r.providerKey)), u("UNSAVED");
|
|
111
111
|
}, n = (r) => g(r);
|
|
112
|
-
return
|
|
112
|
+
return G(l) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
113
113
|
s("no_data_providers"),
|
|
114
114
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
115
115
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
116
116
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
117
117
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
118
118
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
119
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
120
|
-
/* @__PURE__ */ e.jsx(
|
|
121
|
-
/* @__PURE__ */ e.jsxs(
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
123
|
-
D.map((r) => /* @__PURE__ */ e.jsx(
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(ue, { value: k, onValueChange: (r) => T(r), children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx(pe, { className: "w-full", children: /* @__PURE__ */ e.jsx(fe, { placeholder: s("select_provider") }) }),
|
|
121
|
+
/* @__PURE__ */ e.jsxs(je, { children: [
|
|
122
|
+
/* @__PURE__ */ e.jsx(B, { value: "", children: s("choose") }),
|
|
123
|
+
D.map((r) => /* @__PURE__ */ e.jsx(B, { value: r.value, children: r.label }, r.value))
|
|
124
124
|
] })
|
|
125
125
|
] }) }),
|
|
126
126
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -200,64 +200,64 @@ const ze = () => {
|
|
|
200
200
|
/* @__PURE__ */ e.jsx(Be, { onClose: () => g(null), provider: C })
|
|
201
201
|
] })
|
|
202
202
|
] });
|
|
203
|
-
}, Le =
|
|
204
|
-
const { t: s } = v(),
|
|
203
|
+
}, Le = W(() => {
|
|
204
|
+
const { t: s } = v(), l = {
|
|
205
205
|
"ctrl + Z": "Undo",
|
|
206
206
|
"ctrl + Y": "Redo",
|
|
207
207
|
"ctrl + D": "Duplicate"
|
|
208
|
-
},
|
|
208
|
+
}, a = {
|
|
209
209
|
// "ctrl + /": "Rename block",
|
|
210
210
|
"ctrl + S": "Save page",
|
|
211
211
|
esc: "Deselect blocks",
|
|
212
212
|
del: "Delete block"
|
|
213
213
|
};
|
|
214
|
-
return /* @__PURE__ */ e.jsxs(
|
|
215
|
-
/* @__PURE__ */ e.jsx(
|
|
216
|
-
/* @__PURE__ */ e.jsx(
|
|
217
|
-
/* @__PURE__ */ e.jsx(
|
|
214
|
+
return /* @__PURE__ */ e.jsxs(O, { children: [
|
|
215
|
+
/* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsxs(ge, { children: [
|
|
216
|
+
/* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx("div", { className: "flex w-10 items-center justify-center", children: /* @__PURE__ */ e.jsx(R, {}) }) }),
|
|
217
|
+
/* @__PURE__ */ e.jsx(ye, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
218
218
|
] }) }),
|
|
219
|
-
/* @__PURE__ */ e.jsxs(
|
|
220
|
-
/* @__PURE__ */ e.jsx(
|
|
219
|
+
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
220
|
+
/* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(F, { children: s("Keyboard shortcuts") }) }),
|
|
221
221
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
|
|
222
|
-
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(
|
|
223
|
-
/* @__PURE__ */ e.jsx(
|
|
224
|
-
/* @__PURE__ */ e.jsx("div", { children: s(
|
|
225
|
-
] },
|
|
226
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(
|
|
227
|
-
/* @__PURE__ */ e.jsx(
|
|
228
|
-
/* @__PURE__ */ e.jsx("div", { children: s(
|
|
229
|
-
] },
|
|
222
|
+
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(l).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
223
|
+
/* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
|
|
224
|
+
/* @__PURE__ */ e.jsx("div", { children: s(l[t]) })
|
|
225
|
+
] }, t)) }),
|
|
226
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(a).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
227
|
+
/* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
|
|
228
|
+
/* @__PURE__ */ e.jsx("div", { children: s(a[t]) })
|
|
229
|
+
] }, t)) })
|
|
230
230
|
] }) })
|
|
231
231
|
] })
|
|
232
232
|
] });
|
|
233
|
-
}),
|
|
234
|
-
let
|
|
233
|
+
}), Ie = j(() => import("./AddBlocks-IX7HKzSe.js")), P = j(() => import("./ListTree-sTwXvXST.js")), Ve = j(() => import("./ThemeConfiguration-AAGFJieC.js")), Me = j(() => import("./ChaiBuilderEditor-3xIN-AP_.js").then((s) => s.cr)), Oe = j(() => import("./UILibrariesPanel-fKn2nlgI.js"));
|
|
234
|
+
let V = null;
|
|
235
235
|
const Bs = () => {
|
|
236
|
-
const s = w("sideBarComponents.top", []),
|
|
237
|
-
"add-blocks":
|
|
238
|
-
[
|
|
239
|
-
"theme-configuration":
|
|
236
|
+
const s = w("sideBarComponents.top", []), l = w("sideBarComponents.bottom", []), [a, t] = M(Ne), [u, d] = h(a), [c, k] = h(null), { t: p } = v(), C = w("uiLibraries", []), g = _e(), D = Q(g).find((i) => i.category === "custom") !== void 0, T = C.length > 0 || D, b = {
|
|
237
|
+
"add-blocks": Ie,
|
|
238
|
+
[o]: P,
|
|
239
|
+
"theme-configuration": Ve,
|
|
240
240
|
images: Me,
|
|
241
241
|
"ui-libraries": Oe
|
|
242
242
|
};
|
|
243
|
-
|
|
244
|
-
b[
|
|
243
|
+
X(s, ({ name: i, panel: _ }) => {
|
|
244
|
+
b[i] = _;
|
|
245
245
|
});
|
|
246
|
-
const n = (
|
|
247
|
-
clearTimeout(
|
|
246
|
+
const n = (i) => {
|
|
247
|
+
clearTimeout(V), a !== o && i === o ? V = setTimeout(() => t(o), 500) : d(i), t(i);
|
|
248
248
|
}, r = w("dataBindingSupport", !1);
|
|
249
249
|
function m() {
|
|
250
|
-
const
|
|
251
|
-
c && (n(
|
|
250
|
+
const i = setTimeout(() => {
|
|
251
|
+
c && (n(o), clearTimeout(c));
|
|
252
252
|
}, 500);
|
|
253
|
-
k(
|
|
253
|
+
k(i);
|
|
254
254
|
}
|
|
255
255
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
256
|
-
|
|
256
|
+
a !== o ? /* @__PURE__ */ e.jsx(
|
|
257
257
|
"div",
|
|
258
258
|
{
|
|
259
259
|
onMouseEnter: m,
|
|
260
|
-
onClick: () => n(
|
|
260
|
+
onClick: () => n(o),
|
|
261
261
|
className: "fixed inset-0 z-[50] bg-black/20"
|
|
262
262
|
}
|
|
263
263
|
) : null,
|
|
@@ -269,8 +269,8 @@ const Bs = () => {
|
|
|
269
269
|
{
|
|
270
270
|
onClick: () => n("add-blocks"),
|
|
271
271
|
size: "sm",
|
|
272
|
-
variant:
|
|
273
|
-
children: /* @__PURE__ */ e.jsx(
|
|
272
|
+
variant: a === "add-blocks" ? "default" : "outline",
|
|
273
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
|
|
274
274
|
}
|
|
275
275
|
),
|
|
276
276
|
/* @__PURE__ */ e.jsx(
|
|
@@ -278,8 +278,8 @@ const Bs = () => {
|
|
|
278
278
|
{
|
|
279
279
|
onClick: () => n("ui-libraries"),
|
|
280
280
|
size: "sm",
|
|
281
|
-
variant:
|
|
282
|
-
children: /* @__PURE__ */ e.jsx(
|
|
281
|
+
variant: a === "ui-libraries" ? "default" : "outline",
|
|
282
|
+
children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
|
|
283
283
|
}
|
|
284
284
|
)
|
|
285
285
|
] }) : /* @__PURE__ */ e.jsx(
|
|
@@ -287,17 +287,17 @@ const Bs = () => {
|
|
|
287
287
|
{
|
|
288
288
|
onClick: () => n("add-blocks"),
|
|
289
289
|
size: "sm",
|
|
290
|
-
variant:
|
|
291
|
-
children: /* @__PURE__ */ e.jsx(
|
|
290
|
+
variant: a === "add-blocks" ? "default" : "outline",
|
|
291
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
294
|
/* @__PURE__ */ e.jsx(
|
|
295
295
|
x,
|
|
296
296
|
{
|
|
297
|
-
onClick: () => n(
|
|
297
|
+
onClick: () => n(o),
|
|
298
298
|
size: "sm",
|
|
299
|
-
variant:
|
|
300
|
-
children: /* @__PURE__ */ e.jsx(
|
|
299
|
+
variant: a === o ? "default" : "outline",
|
|
300
|
+
children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
|
|
301
301
|
}
|
|
302
302
|
),
|
|
303
303
|
/* @__PURE__ */ e.jsx(
|
|
@@ -305,18 +305,18 @@ const Bs = () => {
|
|
|
305
305
|
{
|
|
306
306
|
onClick: () => n("theme-configuration"),
|
|
307
307
|
size: "sm",
|
|
308
|
-
variant:
|
|
308
|
+
variant: a === "theme-configuration" ? "default" : "outline",
|
|
309
309
|
children: /* @__PURE__ */ e.jsx(Ce, { className: "w-4 max-w-[40px] text-xs" })
|
|
310
310
|
}
|
|
311
311
|
),
|
|
312
312
|
f.Children.toArray(
|
|
313
|
-
s.map(({ name:
|
|
313
|
+
s.map(({ name: i, icon: _ }) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
314
314
|
x,
|
|
315
315
|
{
|
|
316
|
-
onClick: () => n(
|
|
316
|
+
onClick: () => n(i),
|
|
317
317
|
size: "sm",
|
|
318
318
|
className: "w-10",
|
|
319
|
-
variant:
|
|
319
|
+
variant: a === i ? "default" : "outline",
|
|
320
320
|
children: /* @__PURE__ */ e.jsx(_, {})
|
|
321
321
|
}
|
|
322
322
|
) }))
|
|
@@ -325,16 +325,16 @@ const Bs = () => {
|
|
|
325
325
|
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
326
326
|
/* @__PURE__ */ e.jsx(Le, {}),
|
|
327
327
|
f.Children.toArray(
|
|
328
|
-
|
|
328
|
+
l.map((i) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
|
|
329
329
|
)
|
|
330
330
|
] })
|
|
331
331
|
] }),
|
|
332
|
-
|
|
332
|
+
a !== o ? /* @__PURE__ */ e.jsx(
|
|
333
333
|
"div",
|
|
334
334
|
{
|
|
335
335
|
className: "absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",
|
|
336
336
|
children: /* @__PURE__ */ e.jsx(
|
|
337
|
-
|
|
337
|
+
y,
|
|
338
338
|
{
|
|
339
339
|
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
|
|
340
340
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
@@ -350,7 +350,7 @@ const Bs = () => {
|
|
|
350
350
|
onMouseEnter: () => {
|
|
351
351
|
c && clearTimeout(c);
|
|
352
352
|
},
|
|
353
|
-
children: f.createElement(
|
|
353
|
+
children: f.createElement(ee(b, a, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
354
354
|
}
|
|
355
355
|
)
|
|
356
356
|
}
|
|
@@ -358,42 +358,35 @@ const Bs = () => {
|
|
|
358
358
|
}
|
|
359
359
|
) : null,
|
|
360
360
|
/* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
|
|
361
|
-
|
|
361
|
+
y,
|
|
362
362
|
{
|
|
363
363
|
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
|
|
364
364
|
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
365
365
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
366
366
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
367
367
|
] }),
|
|
368
|
-
children: r ? /* @__PURE__ */ e.jsxs(
|
|
369
|
-
/* @__PURE__ */ e.jsxs(
|
|
370
|
-
/* @__PURE__ */ e.jsxs(
|
|
371
|
-
/* @__PURE__ */ e.jsx(
|
|
368
|
+
children: r ? /* @__PURE__ */ e.jsxs(we, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
|
|
369
|
+
/* @__PURE__ */ e.jsxs(ke, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
370
|
+
/* @__PURE__ */ e.jsxs(L, { value: o, children: [
|
|
371
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
372
372
|
" ",
|
|
373
373
|
p("Outline")
|
|
374
374
|
] }),
|
|
375
|
-
/* @__PURE__ */ e.jsxs(
|
|
375
|
+
/* @__PURE__ */ e.jsxs(L, { value: "data-provider", children: [
|
|
376
376
|
/* @__PURE__ */ e.jsx(De, { className: "mr-2 w-3" }),
|
|
377
377
|
p("Data")
|
|
378
378
|
] })
|
|
379
379
|
] }),
|
|
380
|
-
/* @__PURE__ */ e.jsx(
|
|
381
|
-
/* @__PURE__ */ e.jsx(
|
|
382
|
-
] }) : /* @__PURE__ */ e.
|
|
383
|
-
/* @__PURE__ */ e.
|
|
384
|
-
/* @__PURE__ */ e.jsx(
|
|
380
|
+
/* @__PURE__ */ e.jsx(I, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
|
|
381
|
+
/* @__PURE__ */ e.jsx(I, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
|
|
382
|
+
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
383
|
+
/* @__PURE__ */ e.jsxs("div", { className: "sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm", children: [
|
|
384
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
385
385
|
" ",
|
|
386
386
|
p("Outline")
|
|
387
|
-
] })
|
|
388
|
-
/* @__PURE__ */ e.jsx(
|
|
389
|
-
|
|
390
|
-
{
|
|
391
|
-
value: t,
|
|
392
|
-
className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
393
|
-
children: f.createElement(K)
|
|
394
|
-
}
|
|
395
|
-
)
|
|
396
|
-
] }) })
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(P) })
|
|
389
|
+
] })
|
|
397
390
|
}
|
|
398
391
|
) })
|
|
399
392
|
] });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),c=require("lodash-es"),s=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),P=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index-ecnGWzh9.cjs");const I=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(s.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(T.JsonView,{data:l,shouldExpandNode:T.allExpanded,style:{...T.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function _({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const K=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(c.filter(x,r=>c.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=c.filter(x.map(r=>c.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!c.isNull(r)),w=r=>{const j=c.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},u=r=>f(r);return c.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>u(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(_,{onRemove:()=>g(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(I,{onClose:()=>f(null),provider:N})]})]})},L=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(R.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-zwZ63DdP.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-DkbFFDXB.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-8W1CM4tW.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-ZRHqW7Gd.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-cp0Mkaq_.cjs")));let C=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=c.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":B,[a.OUTLINE_KEY]:k,"theme-configuration":A,images:O,"ui-libraries":U};c.each(t,({name:n,panel:q})=>{g[n]=q});const u=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(u(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>u(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:P.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(c.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(K,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(k)})]})})})]})};exports.default=z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),N=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),r=require("./controls-rRZhz0vu.cjs"),m=require("lodash-es"),k=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index-ecnGWzh9.cjs");function P(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=P(B),T=({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"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],D=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",m.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e),{t:v}=k.useTranslation();x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const u=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:g,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:j,bodyBgLightColor:O,roundedCorners:R}=e;let s={headingFont:r.f({title:"Heading font",default:b,options:f}),bodyFont:r.f({title:"Body font",default:g,options:f}),roundedCorners:r.y({title:"Rounded Corner",default:parseInt(R||5,10)}),primaryColor:r.s({title:"Primary",default:h}),secondaryColor:r.s({title:"Secondary",default:j})};l||(s={...s,bodyBgLightColor:r.s({title:"Background",default:O}),bodyTextLightColor:r.s({title:"Text color",default:y}),bodyBgDarkColor:r.s({title:"Background (Dark mode)",default:S}),bodyTextDarkColor:r.s({title:"Text color(Dark mode)",default:C})});const c={type:"object",properties:{}},q={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,q[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 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:v("Theme Configuration")})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:T},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:q,schema:c,formData:e,validator:N,onChange:u})})]})};exports.default=D;
|
|
@@ -2,8 +2,8 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import j from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { h as T, F as w, bx as D } from "./ChaiBuilderEditor-
|
|
6
|
-
import {
|
|
5
|
+
import { h as T, F as w, bx as D } from "./ChaiBuilderEditor-3xIN-AP_.js";
|
|
6
|
+
import { f, y as P, s as a } from "./controls-yjgoZzB6.js";
|
|
7
7
|
import { debounce as R, noop as F, isEqual as M } from "lodash-es";
|
|
8
8
|
import { useTranslation as L } from "react-i18next";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -14,14 +14,13 @@ import "@floating-ui/react-dom";
|
|
|
14
14
|
import "jotai";
|
|
15
15
|
import "i18next";
|
|
16
16
|
import "flagged";
|
|
17
|
-
import "./
|
|
17
|
+
import "./MODIFIERS-fd5XOmum.js";
|
|
18
18
|
import "./Functions-7jnEwJyw.js";
|
|
19
19
|
import "tailwind-merge";
|
|
20
20
|
import "@chaibuilder/runtime";
|
|
21
21
|
import "@react-hookz/web";
|
|
22
|
-
import "./MODIFIERS-cBT31iqE.js";
|
|
23
22
|
import "tree-model";
|
|
24
|
-
import "./utils-
|
|
23
|
+
import "./utils-VpVqnC9m.js";
|
|
25
24
|
import "@radix-ui/react-toggle";
|
|
26
25
|
import "class-variance-authority";
|
|
27
26
|
import "@radix-ui/react-switch";
|
|
@@ -46,6 +45,7 @@ import "react-icons-picker";
|
|
|
46
45
|
import "react-quill";
|
|
47
46
|
import "react-hotkeys-hook";
|
|
48
47
|
import "lucide-react";
|
|
48
|
+
import "./index-YpnaudSM.js";
|
|
49
49
|
const E = ({ value: u, onChange: e, id: p, onBlur: m }) => {
|
|
50
50
|
const i = R(e, 200), d = (l) => i(l.target.value);
|
|
51
51
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),a=require("@radix-ui/react-icons"),r=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),l=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index-ecnGWzh9.cjs");const p=()=>r.useBuilderProp("languages",["en"]),m=()=>p().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(a.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),j=()=>{const{savePage:u,saveState:s}=r.useSavePage(),{t:i}=l.useTranslation(),x=r.useBuilderProp("hideSaveButton",!1),t=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-300 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);if(x)return null;const o=e.jsxRuntimeExports.jsxs(r.Button,{disabled:s==="SAVING",onClick:c=>{c.preventDefault(),u()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${t}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(r.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s==="SAVING"?"Saving...":i(s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},d=function(){const s=r.useBuilderProp("previewComponent"),[,i]=r.usePreviewMode(),{t:x}=l.useTranslation();return s?e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(a.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},h=()=>{const u=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),i=r.useBuilderProp("topBarComponents.right",[]),x=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(u.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(m,{}),e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(j,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=h;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import o, { useMemo as h, Suspense as c } from "react";
|
|
3
3
|
import { FontFamilyIcon as j, EyeOpenIcon as g } from "@radix-ui/react-icons";
|
|
4
|
-
import { h as r,
|
|
4
|
+
import { h as r, a5 as f, a6 as v, a7 as b, a8 as N, al as S, am as w, a9 as l, U as y, B as p, an as C, E as B, ag as m, ao as A } from "./ChaiBuilderEditor-3xIN-AP_.js";
|
|
5
5
|
import { useTranslation as x } from "react-i18next";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "clsx";
|
|
@@ -12,14 +12,13 @@ import "jotai";
|
|
|
12
12
|
import "i18next";
|
|
13
13
|
import "flagged";
|
|
14
14
|
import "lodash-es";
|
|
15
|
-
import "./
|
|
15
|
+
import "./MODIFIERS-fd5XOmum.js";
|
|
16
16
|
import "./Functions-7jnEwJyw.js";
|
|
17
17
|
import "tailwind-merge";
|
|
18
18
|
import "@chaibuilder/runtime";
|
|
19
19
|
import "@react-hookz/web";
|
|
20
|
-
import "./MODIFIERS-cBT31iqE.js";
|
|
21
20
|
import "tree-model";
|
|
22
|
-
import "./utils-
|
|
21
|
+
import "./utils-VpVqnC9m.js";
|
|
23
22
|
import "@radix-ui/react-toggle";
|
|
24
23
|
import "class-variance-authority";
|
|
25
24
|
import "@radix-ui/react-switch";
|
|
@@ -43,6 +42,7 @@ import "react-icons-picker";
|
|
|
43
42
|
import "react-quill";
|
|
44
43
|
import "react-hotkeys-hook";
|
|
45
44
|
import "lucide-react";
|
|
45
|
+
import "./index-YpnaudSM.js";
|
|
46
46
|
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(f, { children: [
|
|
47
47
|
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
48
48
|
b,
|
|
@@ -61,7 +61,7 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
61
61
|
/* @__PURE__ */ e.jsx(l, { value: "grapes", children: "Grapes" }),
|
|
62
62
|
/* @__PURE__ */ e.jsx(l, { value: "pineapple", children: "Pineapple" })
|
|
63
63
|
] }) })
|
|
64
|
-
] }) }),
|
|
64
|
+
] }) }), E = () => {
|
|
65
65
|
const { savePage: n, saveState: t } = y(), { t: a } = x(), i = r("hideSaveButton", !1), s = h(() => {
|
|
66
66
|
switch (t) {
|
|
67
67
|
case "SAVING":
|
|
@@ -91,7 +91,7 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
94
|
-
},
|
|
94
|
+
}, I = function() {
|
|
95
95
|
const t = r("previewComponent"), [, a] = B(), { t: i } = x();
|
|
96
96
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
97
97
|
p,
|
|
@@ -119,9 +119,9 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
119
119
|
) }),
|
|
120
120
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
121
121
|
/* @__PURE__ */ e.jsx(k, {}),
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
122
|
+
/* @__PURE__ */ e.jsx(I, {}),
|
|
123
123
|
/* @__PURE__ */ e.jsx(A, { orientation: "vertical" }),
|
|
124
|
-
i ? /* @__PURE__ */ e.jsx(
|
|
124
|
+
i ? /* @__PURE__ */ e.jsx(E, {}) : null,
|
|
125
125
|
o.Children.toArray(
|
|
126
126
|
a.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
127
127
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("lodash-es"),m=require("react"),t=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),v=require("@chaibuilder/runtime"),N=require("lucide-react"),q=require("jotai"),k=require("./Functions-N3yhPYKY.cjs"),b=require("@radix-ui/react-icons"),y=require("./MODIFIERS-mVmfEGgo.cjs"),w=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index-ecnGWzh9.cjs");function C(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const c=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,c.get?c:{enumerable:!0,get:()=>s[i]})}}return n.default=s,Object.freeze(n)}const S=C(m);function I({uiLibraries:s,library:n,setLibrary:i}){var a;const[c,l]=S.useState(!1),{t:r}=w.useTranslation();return n?e.jsxRuntimeExports.jsxs(t.Popover,{open:c,onOpenChange:l,children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Choose Library")}),e.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":c,className:"w-[200px] justify-between",children:[n?(a=s.find(u=>u.uuid===n))==null?void 0:a.name:r("Select library"),e.jsxRuntimeExports.jsx(b.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(t.Command,{children:[e.jsxRuntimeExports.jsx(t.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(t.CommandList,{children:[e.jsxRuntimeExports.jsx(t.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(t.CommandGroup,{children:s.map(u=>e.jsxRuntimeExports.jsxs(t.CommandItem,{value:u.uuid,onSelect:p=>{i(p),l(!1)},children:[u.name,e.jsxRuntimeExports.jsx(b.CheckIcon,{className:k.cn("ml-auto h-4 w-4",n===u.uuid?"opacity-100":"opacity-0")})]},u.uuid))})]})]})})]}):null}const L=({block:s,closePopover:n,library:i})=>{const[c,l]=m.useState(!1),r=t.useBuilderProp("getUILibraryBlock",o.noop),{addCoreBlock:a,addPredefinedBlock:u}=t.useAddBlock(),[p]=t.useSelectedBlockIds(),g=f=>{const j=o.has(f,"styles_attrs.data-page-section");return f._type==="Box"&&j},E=m.useCallback(async f=>{if(f.stopPropagation(),o.has(s,"component")){a(s,o.first(p)),n();return}l(!0);const j=await r(i,s);let R=o.first(p);g(o.first(j))&&(R=null),o.isEmpty(j)||u(v.syncBlocksWithDefaults(j),R),n()},[s]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:c?()=>{}:E,className:"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",children:[c&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/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..."})]}),s.preview?e.jsxRuntimeExports.jsx("img",{src:s.preview,className:"min-h-[25px] w-full rounded-md",alt:s.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:s.name})})]})})},P=q.atom({}),A=s=>{const[n,i]=q.useAtom(P),c=t.useBuilderProp("getUILibraryBlocks",o.noop),l=o.get(n,`${s==null?void 0:s.uuid}.blocks`,[]),r=o.get(n,`${s==null?void 0:s.uuid}.loading`,!1);return m.useEffect(()=>{(async()=>{if(r||l.length>0)return;i(u=>({...u,[s==null?void 0:s.uuid]:{loading:!0,blocks:[]}}));const a=await c(s);i(u=>({...u,[s==null?void 0:s.uuid]:{loading:!1,blocks:a||[]}}))})()},[s,l,r]),{data:l,isLoading:r}},T=t.atomWithStorage("_selectedLibrary",null),O=()=>{const[s,n]=q.useAtom(T),i=t.useBuilderProp("uiLibraries",[]),c=v.useChaiBlocks(),l=o.values(c).filter(d=>d.category==="custom"),r=i.find(d=>d.uuid===s)||o.first(i),{data:a,isLoading:u}=A(r),p=o.groupBy([...a,...l],"group"),[g,E]=m.useState("Hero"),[,f]=q.useAtom(t.activePanelAtom),j=o.get(p,g,[]),{t:R}=w.useTranslation(),x=m.useRef(null),B=d=>{x.current&&(clearTimeout(x.current),x.current=null),x.current=setTimeout(()=>{x.current&&E(d)},300)};return u?e.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-full w-full"}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background",children:[r!=null&&r.uuid?e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex h-fit flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col",children:e.jsxRuntimeExports.jsx(I,{library:r==null?void 0:r.uuid,setLibrary:n,uiLibraries:i})})})}):null,e.jsxRuntimeExports.jsxs("div",{className:"flex h-[95%] border-t border-gray-300 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-40 flex-col gap-1 px-1",children:m.Children.toArray(o.map(p,(d,h)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>B(h),onMouseLeave:()=>clearTimeout(x.current),onClick:()=>E(h),className:k.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",h===g?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:o.capitalize(h)}),e.jsxRuntimeExports.jsx(b.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},h)))}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{onMouseEnter:()=>x.current?clearTimeout(x.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500",children:R("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:m.Children.toArray(j.map(d=>e.jsxRuntimeExports.jsx(L,{block:d,library:r,closePopover:()=>f(y.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},_=()=>e.jsxRuntimeExports.jsx(O,{});exports.default=_;
|