@chaibuilder/sdk 1.2.65 → 1.2.66
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-Mm5byzEC.js +124 -0
- package/dist/AddBlocks-jaxiAG4L.cjs +1 -0
- package/dist/CanvasArea-8NXGRRYC.js +137 -0
- package/dist/CanvasArea-SkeoJz9W.cjs +1 -0
- package/dist/{CodeEditor-Qff4q7sx.js → CodeEditor-3l-mFvg4.js} +61 -46
- package/dist/CodeEditor-o-CkvDnY.cjs +1 -0
- package/dist/STRINGS--j49GZJP.js +7 -0
- package/dist/STRINGS-gPz7CUOk.cjs +1 -0
- package/dist/SettingsPanel-2uYGx-MQ.cjs +1 -0
- package/dist/SettingsPanel-Q3xQQm81.js +82 -0
- package/dist/{SidePanels-ijaUKSek.js → SidePanels-JyziIpDA.js} +87 -92
- package/dist/SidePanels-d04PONzN.cjs +1 -0
- package/dist/{Topbar-vHlnfxPs.js → Topbar-Xgd6YI66.js} +47 -51
- package/dist/Topbar-eIenyfZu.cjs +1 -0
- package/dist/UILibrariesPanel-ADjJse3_.cjs +1 -0
- package/dist/{UILibrariesPanel-NVUMUPUj.js → UILibrariesPanel-a7TrMuAU.js} +82 -90
- package/dist/{UnsplashImages-UkHihhA5.js → UnsplashImages-6Bj8nQ8n.js} +73 -57
- package/dist/UnsplashImages-hLdMtY12.cjs +1 -0
- package/dist/{UploadImages-HtuJZJlo.js → UploadImages-4PxhlZMB.js} +58 -44
- package/dist/UploadImages-uL2R7fju.cjs +1 -0
- package/dist/badge-7BVT3zxN.cjs +1 -0
- package/dist/badge-pJqQSA13.js +23 -0
- package/dist/context-menu-_8TFbFEJ.cjs +1 -0
- package/dist/context-menu-sks9vdzC.js +906 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +45 -20
- package/dist/core.js +85 -86
- package/dist/iconBase-vJD0OXxU.cjs +1 -0
- package/dist/iconBase-zweRWSz0.js +323 -0
- package/dist/index-Dgo2PNEV.js +33210 -0
- package/dist/index-jhNzBWrV.cjs +223 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/plugin-P0tpo_XZ.cjs +1 -0
- package/dist/plugin-_F-KZp1i.cjs +1 -0
- package/dist/plugin-f5uJtdXY.js +43 -0
- package/dist/plugin-sJ3Hzvpv.js +57 -0
- package/dist/render.cjs +3 -1
- package/dist/render.d.ts +19 -52
- package/dist/render.js +136 -183
- package/dist/select-JW3OMYm-.js +75 -0
- package/dist/select-fXj5tdMX.cjs +1 -0
- package/dist/separator-hT24N-xp.cjs +1 -0
- package/dist/separator-sgwOa1FE.js +18 -0
- package/dist/style.css +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +41 -1
- package/dist/tailwind.js +16 -8
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +0 -10
- package/dist/ui.js +345 -163
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +1 -1
- package/dist/web-blocks.js +489 -724
- package/package.json +15 -45
- package/dist/CanvasArea-fSdH_RiN.cjs +0 -1
- package/dist/CanvasArea-ut5yknzX.js +0 -168
- package/dist/CodeEditor-ypUx3RAV.cjs +0 -1
- package/dist/CurrentPage-jHSVy3hq.js +0 -120
- package/dist/CurrentPage-p_AM4lrF.cjs +0 -1
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/MODIFIERS-fd5XOmum.js +0 -60
- package/dist/MODIFIERS-mVmfEGgo.cjs +0 -1
- package/dist/PagesPanel-U3InJ9Db.js +0 -78
- package/dist/PagesPanel-wqDb4D-x.cjs +0 -1
- package/dist/ProjectPanel-XODJTO4J.js +0 -99
- package/dist/ProjectPanel-fWESzHr6.cjs +0 -1
- package/dist/SidePanels-lrMQqc0h.cjs +0 -1
- package/dist/Topbar-RrCDxd0i.cjs +0 -1
- package/dist/UILibrariesPanel-7btHgBD0.cjs +0 -1
- package/dist/UnsplashImages-6UjgojvF.cjs +0 -1
- package/dist/UploadImages-3h0cRsvr.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-RwIj1FxH.cjs +0 -1
- package/dist/add-page-modal-TOfMfmPA.js +0 -115
- package/dist/confirm-alert-eIp2cAkc.js +0 -60
- package/dist/confirm-alert-v1lG8ex4.cjs +0 -1
- package/dist/controls-rRZhz0vu.cjs +0 -1
- package/dist/controls-yjgoZzB6.js +0 -199
- package/dist/delete-page-modal-4bxjpVBD.js +0 -97
- package/dist/delete-page-modal-qYDZmpgT.cjs +0 -1
- package/dist/email-blocks.cjs +0 -1
- package/dist/email-blocks.d.ts +0 -3
- package/dist/email-blocks.js +0 -294
- package/dist/email.cjs +0 -1
- package/dist/email.d.ts +0 -171
- package/dist/email.js +0 -90
- package/dist/empty-slot-Lsxjts7Q.js +0 -6
- package/dist/empty-slot-Sy930lX6.cjs +0 -1
- package/dist/form-4jTocVbZ.cjs +0 -1
- package/dist/form-NAzFjGs0.js +0 -125
- package/dist/functions--tdNWQDW.js +0 -30
- package/dist/functions-EVUeSwX1.cjs +0 -1
- package/dist/html-to-json-NqRjgFqp.cjs +0 -1
- package/dist/html-to-json-l_mw5y-e.js +0 -243
- package/dist/index--k2M8kzI.cjs +0 -1
- package/dist/index--mLLy7QQ.cjs +0 -1
- package/dist/index-5XyNUAjc.cjs +0 -290
- package/dist/index-C7mB4XFm.js +0 -3141
- package/dist/index-VBXQixVm.js +0 -117
- package/dist/index-YZhtVcj_.js +0 -2201
- package/dist/index-aeDphKpP.cjs +0 -1
- package/dist/index-lFgDm1oa.js +0 -83780
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/lib.cjs +0 -3
- package/dist/lib.d.ts +0 -80
- package/dist/lib.js +0 -1350
- package/dist/page-viewer-4wrnWnK0.js +0 -124
- package/dist/page-viewer-ra0GLx1p.cjs +0 -1
- package/dist/project-general-setting-IwZUkYF3.js +0 -90
- package/dist/project-general-setting-lFjTUhHD.cjs +0 -1
- package/dist/project-seo-setting-e1fTqVsd.js +0 -83
- package/dist/project-seo-setting-o0V9acCV.cjs +0 -1
- package/dist/server.cjs +0 -1
- package/dist/server.d.ts +0 -299
- package/dist/server.js +0 -216
- package/dist/single-page-detail-ZNWFKqLW.js +0 -229
- package/dist/single-page-detail-g55Anu7R.cjs +0 -1
- package/dist/studio.cjs +0 -1
- package/dist/studio.d.ts +0 -176
- package/dist/studio.js +0 -67
- package/dist/utils-D_vtk3zK.cjs +0 -1
- package/dist/utils-VpVqnC9m.js +0 -1075
|
@@ -1,48 +1,39 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
2
|
-
import { KeyboardIcon as R, PlusIcon as
|
|
3
|
-
import f, {
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { filter as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getChaiDataProviders as De, useChaiBlocks as Te } from "@chaibuilder/runtime";
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import { KeyboardIcon as R, PlusIcon as _, Component2Icon as J } from "@radix-ui/react-icons";
|
|
3
|
+
import f, { useMemo as W, useState as p, useEffect as Y, memo as Z, lazy as v, Suspense as j } from "react";
|
|
4
|
+
import { useAtom as M } from "jotai";
|
|
5
|
+
import { filter as y, map as B, isNull as q, isEmpty as G, find as $, values as Q, each as X, get as ee } from "lodash-es";
|
|
6
|
+
import { D as O, n as H, o as F, p as U, q as se, a1 as re, a2 as ie, a3 as te, a4 as le, a5 as ae, a6 as oe, a7 as ne, a8 as ce, a9 as de, m as me, T as xe, d as pe, e as ue, B as x, S as K, E as he, F as fe, G as E, H as z } from "./context-menu-sks9vdzC.js";
|
|
7
|
+
import { u as je, b as ve, E as ge, J as be, a as Ne, d as ye, c as w, e as we } from "./index-Dgo2PNEV.js";
|
|
9
8
|
import { useTranslation as g } from "react-i18next";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { c as
|
|
13
|
-
import "./
|
|
14
|
-
import "
|
|
15
|
-
import "
|
|
16
|
-
import "./utils-VpVqnC9m.js";
|
|
17
|
-
import "clsx";
|
|
18
|
-
import "tailwind-merge";
|
|
9
|
+
import { ListTreeIcon as A, PaletteIcon as ke, DatabaseIcon as Ce } from "lucide-react";
|
|
10
|
+
import { getChaiDataProviders as De, useChaiBlocks as Te } from "@chaibuilder/runtime";
|
|
11
|
+
import { S as Se, c as Ae, b as Pe, d as _e, f as L } from "./select-JW3OMYm-.js";
|
|
12
|
+
import { O as o } from "./STRINGS--j49GZJP.js";
|
|
13
|
+
import { B as I } from "./badge-pJqQSA13.js";
|
|
14
|
+
import { c as Be } from "./iconBase-zweRWSz0.js";
|
|
19
15
|
import "@radix-ui/react-switch";
|
|
20
|
-
import "@radix-ui/react-slot";
|
|
21
16
|
import "@radix-ui/react-accordion";
|
|
17
|
+
import "class-variance-authority";
|
|
22
18
|
import "@radix-ui/react-alert-dialog";
|
|
23
|
-
import "@radix-ui/react-
|
|
19
|
+
import "@radix-ui/react-slot";
|
|
24
20
|
import "@radix-ui/react-label";
|
|
25
21
|
import "@radix-ui/react-scroll-area";
|
|
26
22
|
import "@radix-ui/react-tabs";
|
|
27
23
|
import "@radix-ui/react-tooltip";
|
|
28
24
|
import "@radix-ui/react-popover";
|
|
29
|
-
import "@radix-ui/react-menubar";
|
|
30
25
|
import "@radix-ui/react-hover-card";
|
|
31
|
-
import "@radix-ui/react-select";
|
|
32
26
|
import "@radix-ui/react-dropdown-menu";
|
|
33
|
-
import "@radix-ui/react-separator";
|
|
34
27
|
import "@radix-ui/react-toast";
|
|
35
28
|
import "cmdk";
|
|
29
|
+
import "@radix-ui/react-dialog";
|
|
36
30
|
import "@radix-ui/react-context-menu";
|
|
37
|
-
import "
|
|
38
|
-
import "
|
|
39
|
-
import "
|
|
31
|
+
import "clsx";
|
|
32
|
+
import "tailwind-merge";
|
|
33
|
+
import "./plugin-sJ3Hzvpv.js";
|
|
40
34
|
import "@react-hookz/web";
|
|
41
35
|
import "tree-model";
|
|
42
|
-
import "
|
|
43
|
-
import "react-arborist";
|
|
44
|
-
import "./index-VBXQixVm.js";
|
|
45
|
-
import "prop-types";
|
|
36
|
+
import "react-quill";
|
|
46
37
|
import "react-hotkeys-hook";
|
|
47
38
|
import "@floating-ui/dom";
|
|
48
39
|
import "@floating-ui/react-dom";
|
|
@@ -51,35 +42,39 @@ import "@tailwindcss/typography";
|
|
|
51
42
|
import "@tailwindcss/forms";
|
|
52
43
|
import "@tailwindcss/aspect-ratio";
|
|
53
44
|
import "tailwindcss-palette-generator";
|
|
54
|
-
import "./html-to-json-l_mw5y-e.js";
|
|
55
|
-
import "himalaya";
|
|
56
45
|
import "lodash";
|
|
57
46
|
import "react-wrap-balancer";
|
|
58
|
-
import "
|
|
47
|
+
import "react-dom";
|
|
48
|
+
import "prop-types";
|
|
59
49
|
import "@rjsf/validator-ajv8";
|
|
50
|
+
import "@rjsf/core";
|
|
51
|
+
import "react-arborist";
|
|
52
|
+
import "himalaya";
|
|
53
|
+
import "react-icons-picker";
|
|
60
54
|
import "react-autosuggest";
|
|
61
55
|
import "fuse.js";
|
|
62
|
-
import "
|
|
56
|
+
import "i18next";
|
|
57
|
+
import "@radix-ui/react-select";
|
|
63
58
|
const Ke = ({ provider: s, onClose: a }) => {
|
|
64
|
-
const { t } = g(), [l,
|
|
59
|
+
const { t } = g(), [l, u] = p(null);
|
|
65
60
|
return Y(() => {
|
|
66
|
-
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) =>
|
|
67
|
-
}, [s]), s ? /* @__PURE__ */ e.jsx(
|
|
68
|
-
/* @__PURE__ */ e.jsxs(
|
|
69
|
-
/* @__PURE__ */ e.jsxs(
|
|
61
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => u(c));
|
|
62
|
+
}, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : a(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
63
|
+
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
64
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
70
65
|
t("data_provider"),
|
|
71
66
|
": ",
|
|
72
67
|
s.name
|
|
73
68
|
] }),
|
|
74
69
|
/* @__PURE__ */ e.jsx(se, { children: s.description })
|
|
75
70
|
] }),
|
|
76
|
-
/* @__PURE__ */ e.jsx(
|
|
77
|
-
|
|
71
|
+
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(
|
|
72
|
+
be,
|
|
78
73
|
{
|
|
79
74
|
data: l,
|
|
80
|
-
shouldExpandNode:
|
|
75
|
+
shouldExpandNode: Ne,
|
|
81
76
|
style: {
|
|
82
|
-
...
|
|
77
|
+
...ye,
|
|
83
78
|
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
84
79
|
stringValue: "text-orange-600",
|
|
85
80
|
label: "text-green-900 font-semibold pr-1 tracking-wider"
|
|
@@ -114,29 +109,29 @@ function Ee({
|
|
|
114
109
|
] });
|
|
115
110
|
}
|
|
116
111
|
const ze = () => {
|
|
117
|
-
const { t: s } = g(), a =
|
|
118
|
-
|
|
119
|
-
), [k,
|
|
112
|
+
const { t: s } = g(), a = W(() => De(), []), [t, l] = je(), [, u] = M(ve), [d, c] = p(
|
|
113
|
+
y(a, (r) => B(t, "providerKey").includes(r.providerKey))
|
|
114
|
+
), [k, h] = p(""), [C, b] = p(null), D = y(
|
|
120
115
|
a.map((r) => B(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
121
|
-
(r) => !
|
|
116
|
+
(r) => !q(r)
|
|
122
117
|
), T = (r) => {
|
|
123
118
|
const m = $(a, { providerKey: r });
|
|
124
|
-
c((i) => [...i, m]), l((i) => [...i, { providerKey: m.providerKey, args: {} }]),
|
|
125
|
-
},
|
|
126
|
-
c((m) =>
|
|
119
|
+
c((i) => [...i, m]), l((i) => [...i, { providerKey: m.providerKey, args: {} }]), h(""), u("UNSAVED");
|
|
120
|
+
}, N = (r) => {
|
|
121
|
+
c((m) => y(m, (i) => i.providerKey !== r.providerKey)), l((m) => y(m, (i) => i.providerKey !== r.providerKey)), u("UNSAVED");
|
|
127
122
|
}, n = (r) => b(r);
|
|
128
|
-
return
|
|
123
|
+
return G(a) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
129
124
|
s("no_data_providers"),
|
|
130
125
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
131
126
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
132
127
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
133
128
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
134
129
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
135
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
136
|
-
/* @__PURE__ */ e.jsx(
|
|
137
|
-
/* @__PURE__ */ e.jsxs(
|
|
138
|
-
/* @__PURE__ */ e.jsx(
|
|
139
|
-
D.map((r) => /* @__PURE__ */ e.jsx(
|
|
130
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(Se, { value: k, onValueChange: (r) => T(r), children: [
|
|
131
|
+
/* @__PURE__ */ e.jsx(Ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(Pe, { placeholder: s("select_provider") }) }),
|
|
132
|
+
/* @__PURE__ */ e.jsxs(_e, { children: [
|
|
133
|
+
/* @__PURE__ */ e.jsx(L, { value: "", children: s("choose") }),
|
|
134
|
+
D.map((r) => /* @__PURE__ */ e.jsx(L, { value: r.value, children: r.label }, r.value))
|
|
140
135
|
] })
|
|
141
136
|
] }) }),
|
|
142
137
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -185,7 +180,7 @@ const ze = () => {
|
|
|
185
180
|
]
|
|
186
181
|
}
|
|
187
182
|
),
|
|
188
|
-
/* @__PURE__ */ e.jsx(Ee, { onRemove: () =>
|
|
183
|
+
/* @__PURE__ */ e.jsx(Ee, { onRemove: () => N(r), name: r.name, children: /* @__PURE__ */ e.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: [
|
|
189
184
|
/* @__PURE__ */ e.jsxs(
|
|
190
185
|
"svg",
|
|
191
186
|
{
|
|
@@ -216,7 +211,7 @@ const ze = () => {
|
|
|
216
211
|
/* @__PURE__ */ e.jsx(Ke, { onClose: () => b(null), provider: C })
|
|
217
212
|
] })
|
|
218
213
|
] });
|
|
219
|
-
}, Le =
|
|
214
|
+
}, Le = Z(() => {
|
|
220
215
|
const { t: s } = g(), a = {
|
|
221
216
|
"ctrl + Z": "Undo",
|
|
222
217
|
"ctrl + Y": "Redo",
|
|
@@ -227,37 +222,37 @@ const ze = () => {
|
|
|
227
222
|
esc: "Deselect blocks",
|
|
228
223
|
del: "Delete block"
|
|
229
224
|
};
|
|
230
|
-
return /* @__PURE__ */ e.jsxs(
|
|
231
|
-
/* @__PURE__ */ e.jsx(
|
|
232
|
-
/* @__PURE__ */ e.jsx(
|
|
233
|
-
/* @__PURE__ */ e.jsx(
|
|
225
|
+
return /* @__PURE__ */ e.jsxs(O, { children: [
|
|
226
|
+
/* @__PURE__ */ e.jsx(me, { children: /* @__PURE__ */ e.jsxs(xe, { children: [
|
|
227
|
+
/* @__PURE__ */ e.jsx(pe, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex w-10 items-center justify-center", children: /* @__PURE__ */ e.jsx(R, {}) }) }),
|
|
228
|
+
/* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
234
229
|
] }) }),
|
|
235
230
|
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
236
|
-
/* @__PURE__ */ e.jsx(
|
|
231
|
+
/* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(U, { children: s("Keyboard shortcuts") }) }),
|
|
237
232
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
|
|
238
233
|
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(a).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
239
|
-
/* @__PURE__ */ e.jsx(
|
|
234
|
+
/* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
|
|
240
235
|
/* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
|
|
241
236
|
] }, l)) }),
|
|
242
237
|
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(t).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
243
|
-
/* @__PURE__ */ e.jsx(
|
|
238
|
+
/* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
|
|
244
239
|
/* @__PURE__ */ e.jsx("div", { children: s(t[l]) })
|
|
245
240
|
] }, l)) })
|
|
246
241
|
] }) })
|
|
247
242
|
] })
|
|
248
243
|
] });
|
|
249
|
-
}), Ie = v(() => import("./
|
|
244
|
+
}), Ie = v(() => import("./AddBlocks-Mm5byzEC.js")), P = v(() => import("./index-Dgo2PNEV.js").then((s) => s.ad)), Ve = v(() => import("./index-Dgo2PNEV.js").then((s) => s.ac)), Me = v(() => import("./index-Dgo2PNEV.js").then((s) => s.ae)), Oe = v(() => import("./UILibrariesPanel-a7TrMuAU.js")), He = () => /* @__PURE__ */ e.jsx("div", { className: "w-72", children: /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full animate-pulse rounded-md bg-gray-100" }), children: /* @__PURE__ */ e.jsx(Ie, {}) }) });
|
|
250
245
|
let V = null;
|
|
251
|
-
const
|
|
252
|
-
const s = w("sideBarComponents.top", []), a = w("sideBarComponents.bottom", []), [t, l] =
|
|
246
|
+
const Js = () => {
|
|
247
|
+
const s = w("sideBarComponents.top", []), a = w("sideBarComponents.bottom", []), [t, l] = M(we), [u, d] = p(t), [c, k] = p(null), { t: h } = g(), C = w("uiLibraries", []), b = Te(), D = Q(b).find((i) => i.category === "custom") !== void 0, T = C.length > 0 || D, N = {
|
|
253
248
|
"add-blocks": He,
|
|
254
|
-
[o]:
|
|
249
|
+
[o]: P,
|
|
255
250
|
"theme-configuration": Ve,
|
|
256
|
-
images:
|
|
257
|
-
"ui-libraries":
|
|
251
|
+
images: Me,
|
|
252
|
+
"ui-libraries": Oe
|
|
258
253
|
};
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
X(s, ({ name: i, panel: S }) => {
|
|
255
|
+
N[i] = S;
|
|
261
256
|
});
|
|
262
257
|
const n = (i) => {
|
|
263
258
|
clearTimeout(V), t !== o && i === o ? V = setTimeout(() => l(o), 500) : d(i), l(i);
|
|
@@ -286,7 +281,7 @@ const $s = () => {
|
|
|
286
281
|
onClick: () => n("add-blocks"),
|
|
287
282
|
size: "sm",
|
|
288
283
|
variant: t === "add-blocks" ? "default" : "outline",
|
|
289
|
-
children: /* @__PURE__ */ e.jsx(
|
|
284
|
+
children: /* @__PURE__ */ e.jsx(_, { className: "text-xl" })
|
|
290
285
|
}
|
|
291
286
|
),
|
|
292
287
|
/* @__PURE__ */ e.jsx(
|
|
@@ -304,7 +299,7 @@ const $s = () => {
|
|
|
304
299
|
onClick: () => n("add-blocks"),
|
|
305
300
|
size: "sm",
|
|
306
301
|
variant: t === "add-blocks" ? "default" : "outline",
|
|
307
|
-
children: /* @__PURE__ */ e.jsx(
|
|
302
|
+
children: /* @__PURE__ */ e.jsx(_, { className: "text-xl" })
|
|
308
303
|
}
|
|
309
304
|
),
|
|
310
305
|
/* @__PURE__ */ e.jsx(
|
|
@@ -313,7 +308,7 @@ const $s = () => {
|
|
|
313
308
|
onClick: () => n(o),
|
|
314
309
|
size: "sm",
|
|
315
310
|
variant: t === o ? "default" : "outline",
|
|
316
|
-
children: /* @__PURE__ */ e.jsx(
|
|
311
|
+
children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
|
|
317
312
|
}
|
|
318
313
|
),
|
|
319
314
|
/* @__PURE__ */ e.jsx(
|
|
@@ -326,14 +321,14 @@ const $s = () => {
|
|
|
326
321
|
}
|
|
327
322
|
),
|
|
328
323
|
f.Children.toArray(
|
|
329
|
-
s.map(({ name: i, icon:
|
|
324
|
+
s.map(({ name: i, icon: S }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(K, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
330
325
|
x,
|
|
331
326
|
{
|
|
332
327
|
onClick: () => n(i),
|
|
333
328
|
size: "sm",
|
|
334
329
|
className: "w-10",
|
|
335
330
|
variant: t === i ? "default" : "outline",
|
|
336
|
-
children: /* @__PURE__ */ e.jsx(
|
|
331
|
+
children: /* @__PURE__ */ e.jsx(S, {})
|
|
337
332
|
}
|
|
338
333
|
) }))
|
|
339
334
|
)
|
|
@@ -341,7 +336,7 @@ const $s = () => {
|
|
|
341
336
|
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
342
337
|
/* @__PURE__ */ e.jsx(Le, {}),
|
|
343
338
|
f.Children.toArray(
|
|
344
|
-
a.map((i) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(
|
|
339
|
+
a.map((i) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(K, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
|
|
345
340
|
)
|
|
346
341
|
] })
|
|
347
342
|
] }),
|
|
@@ -366,7 +361,7 @@ const $s = () => {
|
|
|
366
361
|
onMouseEnter: () => {
|
|
367
362
|
c && clearTimeout(c);
|
|
368
363
|
},
|
|
369
|
-
children: f.createElement(ee(
|
|
364
|
+
children: f.createElement(ee(N, t, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
370
365
|
}
|
|
371
366
|
)
|
|
372
367
|
}
|
|
@@ -381,32 +376,32 @@ const $s = () => {
|
|
|
381
376
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
382
377
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
383
378
|
] }),
|
|
384
|
-
children: r ? /* @__PURE__ */ e.jsxs(
|
|
385
|
-
/* @__PURE__ */ e.jsxs(
|
|
386
|
-
/* @__PURE__ */ e.jsxs(
|
|
387
|
-
/* @__PURE__ */ e.jsx(
|
|
379
|
+
children: r ? /* @__PURE__ */ e.jsxs(he, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
|
|
380
|
+
/* @__PURE__ */ e.jsxs(fe, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
381
|
+
/* @__PURE__ */ e.jsxs(E, { value: o, children: [
|
|
382
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
388
383
|
" ",
|
|
389
|
-
|
|
384
|
+
h("Outline")
|
|
390
385
|
] }),
|
|
391
|
-
/* @__PURE__ */ e.jsxs(
|
|
386
|
+
/* @__PURE__ */ e.jsxs(E, { value: "data-provider", children: [
|
|
392
387
|
/* @__PURE__ */ e.jsx(Ce, { className: "mr-2 w-3" }),
|
|
393
|
-
|
|
388
|
+
h("Data")
|
|
394
389
|
] })
|
|
395
390
|
] }),
|
|
396
|
-
/* @__PURE__ */ e.jsx(
|
|
397
|
-
/* @__PURE__ */ e.jsx(
|
|
391
|
+
/* @__PURE__ */ e.jsx(z, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
|
|
392
|
+
/* @__PURE__ */ e.jsx(z, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
|
|
398
393
|
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
399
394
|
/* @__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: [
|
|
400
|
-
/* @__PURE__ */ e.jsx(
|
|
395
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
401
396
|
" ",
|
|
402
|
-
|
|
397
|
+
h("Outline")
|
|
403
398
|
] }),
|
|
404
|
-
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(
|
|
399
|
+
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(P) })
|
|
405
400
|
] })
|
|
406
401
|
}
|
|
407
402
|
) })
|
|
408
403
|
] });
|
|
409
404
|
};
|
|
410
405
|
export {
|
|
411
|
-
|
|
406
|
+
Js as default
|
|
412
407
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),N=require("@radix-ui/react-icons"),i=require("react"),P=require("jotai"),u=require("lodash-es"),s=require("./context-menu-_8TFbFEJ.cjs"),c=require("./index-jhNzBWrV.cjs"),g=require("react-i18next"),f=require("lucide-react"),_=require("@chaibuilder/runtime"),h=require("./select-fXj5tdMX.cjs"),a=require("./STRINGS-gPz7CUOk.cjs"),S=require("./badge-7BVT3zxN.cjs"),I=require("./iconBase-vJD0OXxU.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("lodash");require("react-wrap-balancer");require("react-dom");require("prop-types");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("@radix-ui/react-select");const K=({provider:t,onClose:x})=>{const{t:o}=g.useTranslation(),[l,E]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(m=>E(m))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:j=>j?"":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(c.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(c.JsonView,{data:l,shouldExpandNode:c.allExpanded,style:{...c.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 L({children:t,name:x,onRemove:o}){const{t:l}=g.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 B=()=>{const{t}=g.useTranslation(),x=i.useMemo(()=>_.getChaiDataProviders(),[]),[o,l]=c.usePageDataProviders(),[,E]=P.useAtom(c.builderSaveStateAtom),[j,m]=i.useState(u.filter(x,r=>u.map(o,"providerKey").includes(r.providerKey))),[y,v]=i.useState(""),[q,R]=i.useState(null),w=u.filter(x.map(r=>u.map(j,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),T=r=>{const p=u.find(x,{providerKey:r});m(n=>[...n,p]),l(n=>[...n,{providerKey:p.providerKey,args:{}}]),v(""),E("UNSAVED")},b=r=>{m(p=>u.filter(p,n=>n.providerKey!==r.providerKey)),l(p=>u.filter(p,n=>n.providerKey!==r.providerKey)),E("UNSAVED")},d=r=>R(r);return u.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(h.Select,{value:y,onValueChange:r=>T(r),children:[e.jsxRuntimeExports.jsx(h.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(h.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(h.SelectContent,{children:[e.jsxRuntimeExports.jsx(h.SelectItem,{value:"",children:t("choose")}),w.map(r=>e.jsxRuntimeExports.jsx(h.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${j.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:j.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:()=>d(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(L,{onRemove:()=>b(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(K,{onClose:()=>R(null),provider:q})]})]})},A=i.memo(()=>{const{t}=g.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,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(N.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))})]})})]})]})}),O=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-jaxiAG4L.cjs"))),C=i.lazy(()=>Promise.resolve().then(()=>require("./index-jhNzBWrV.cjs")).then(t=>t.ListTree$1)),U=i.lazy(()=>Promise.resolve().then(()=>require("./index-jhNzBWrV.cjs")).then(t=>t.ThemeConfigPanel$1)),z=i.lazy(()=>Promise.resolve().then(()=>require("./index-jhNzBWrV.cjs")).then(t=>t.ImagesPanel)),Y=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-ADjJse3_.cjs"))),V=()=>e.jsxRuntimeExports.jsx("div",{className:"w-72",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full animate-pulse rounded-md bg-gray-100"}),children:e.jsxRuntimeExports.jsx(O,{})})});let D=null;const M=()=>{const t=c.useBuilderProp("sideBarComponents.top",[]),x=c.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=P.useAtom(c.activePanelAtom),[E,j]=i.useState(o),[m,y]=i.useState(null),{t:v}=g.useTranslation(),q=c.useBuilderProp("uiLibraries",[]),R=_.useChaiBlocks(),w=u.values(R).find(n=>n.category==="custom")!==void 0,T=q.length>0||w,b={"add-blocks":V,[a.OUTLINE_KEY]:C,"theme-configuration":U,images:z,"ui-libraries":Y};u.each(t,({name:n,panel:k})=>{b[n]=k});const d=n=>{clearTimeout(D),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?D=setTimeout(()=>l(a.OUTLINE_KEY),500):j(n),l(n)},r=c.useBuilderProp("dataBindingSupport",!1);function p(){const n=setTimeout(()=>{m&&(d(a.OUTLINE_KEY),clearTimeout(m))},500);y(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:p,onClick:()=>d(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:[T?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(f.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(f.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:k})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(k,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(A,{}),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:I.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{m&&clearTimeout(m)},children:i.createElement(u.get(b,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(f.ListTreeIcon,{className:"mr-2 h-3"})," ",v("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(f.DatabaseIcon,{className:"mr-2 w-3"}),v("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(C)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(B,{})})]}):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(f.ListTreeIcon,{className:"mr-2 h-3"})," ",v("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(C)})]})})})]})};exports.default=M;
|
|
@@ -1,48 +1,23 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import l, { useMemo as h, Suspense as m } from "react";
|
|
3
3
|
import { FontFamilyIcon as j, EyeOpenIcon as f } from "@radix-ui/react-icons";
|
|
4
|
-
import {
|
|
5
|
-
import { F as
|
|
4
|
+
import { S as g, c as v, b as S, d as b, a as N, e as w, f as n } from "./select-JW3OMYm-.js";
|
|
5
|
+
import { c as s, f as y, F as C, g as B } from "./index-Dgo2PNEV.js";
|
|
6
|
+
import { S as A } from "./separator-sgwOa1FE.js";
|
|
7
|
+
import { B as c, S as p } from "./context-menu-sks9vdzC.js";
|
|
6
8
|
import { useTranslation as x } from "react-i18next";
|
|
7
|
-
import "
|
|
8
|
-
import "@radix-ui/react-toggle";
|
|
9
|
-
import "class-variance-authority";
|
|
10
|
-
import "./utils-VpVqnC9m.js";
|
|
9
|
+
import "@radix-ui/react-select";
|
|
11
10
|
import "lodash-es";
|
|
12
|
-
import "
|
|
11
|
+
import "jotai";
|
|
12
|
+
import "./iconBase-zweRWSz0.js";
|
|
13
13
|
import "clsx";
|
|
14
14
|
import "tailwind-merge";
|
|
15
|
-
import "@radix-ui/react-switch";
|
|
16
|
-
import "@radix-ui/react-slot";
|
|
17
|
-
import "@radix-ui/react-accordion";
|
|
18
|
-
import "@radix-ui/react-alert-dialog";
|
|
19
|
-
import "@radix-ui/react-dialog";
|
|
20
|
-
import "@radix-ui/react-label";
|
|
21
|
-
import "@radix-ui/react-scroll-area";
|
|
22
|
-
import "@radix-ui/react-tabs";
|
|
23
|
-
import "@radix-ui/react-tooltip";
|
|
24
|
-
import "@radix-ui/react-popover";
|
|
25
|
-
import "@radix-ui/react-menubar";
|
|
26
|
-
import "@radix-ui/react-hover-card";
|
|
27
|
-
import "@radix-ui/react-select";
|
|
28
|
-
import "@radix-ui/react-dropdown-menu";
|
|
29
|
-
import "@radix-ui/react-separator";
|
|
30
|
-
import "@radix-ui/react-toast";
|
|
31
|
-
import "cmdk";
|
|
32
|
-
import "@radix-ui/react-context-menu";
|
|
33
|
-
import "react-icons-picker";
|
|
34
|
-
import "react-dom";
|
|
35
|
-
import "react-quill";
|
|
36
|
-
import "./Functions-7jnEwJyw.js";
|
|
37
15
|
import "@chaibuilder/runtime";
|
|
38
|
-
import "
|
|
16
|
+
import "./plugin-sJ3Hzvpv.js";
|
|
39
17
|
import "@react-hookz/web";
|
|
40
18
|
import "tree-model";
|
|
41
|
-
import "
|
|
42
|
-
import "
|
|
43
|
-
import "lucide-react";
|
|
44
|
-
import "./index-VBXQixVm.js";
|
|
45
|
-
import "prop-types";
|
|
19
|
+
import "react-quill";
|
|
20
|
+
import "./STRINGS--j49GZJP.js";
|
|
46
21
|
import "react-hotkeys-hook";
|
|
47
22
|
import "@floating-ui/dom";
|
|
48
23
|
import "@floating-ui/react-dom";
|
|
@@ -51,18 +26,39 @@ import "@tailwindcss/typography";
|
|
|
51
26
|
import "@tailwindcss/forms";
|
|
52
27
|
import "@tailwindcss/aspect-ratio";
|
|
53
28
|
import "tailwindcss-palette-generator";
|
|
54
|
-
import "./html-to-json-l_mw5y-e.js";
|
|
55
|
-
import "himalaya";
|
|
56
29
|
import "lodash";
|
|
57
30
|
import "react-wrap-balancer";
|
|
58
|
-
import "
|
|
31
|
+
import "react-dom";
|
|
32
|
+
import "prop-types";
|
|
59
33
|
import "@rjsf/validator-ajv8";
|
|
34
|
+
import "@rjsf/core";
|
|
35
|
+
import "react-arborist";
|
|
36
|
+
import "lucide-react";
|
|
37
|
+
import "himalaya";
|
|
38
|
+
import "react-icons-picker";
|
|
60
39
|
import "react-autosuggest";
|
|
61
40
|
import "fuse.js";
|
|
62
|
-
import "
|
|
41
|
+
import "@radix-ui/react-scroll-area";
|
|
42
|
+
import "i18next";
|
|
43
|
+
import "@radix-ui/react-separator";
|
|
44
|
+
import "@radix-ui/react-switch";
|
|
45
|
+
import "@radix-ui/react-accordion";
|
|
46
|
+
import "class-variance-authority";
|
|
47
|
+
import "@radix-ui/react-alert-dialog";
|
|
48
|
+
import "@radix-ui/react-slot";
|
|
49
|
+
import "@radix-ui/react-label";
|
|
50
|
+
import "@radix-ui/react-tabs";
|
|
51
|
+
import "@radix-ui/react-tooltip";
|
|
52
|
+
import "@radix-ui/react-popover";
|
|
53
|
+
import "@radix-ui/react-hover-card";
|
|
54
|
+
import "@radix-ui/react-dropdown-menu";
|
|
55
|
+
import "@radix-ui/react-toast";
|
|
56
|
+
import "cmdk";
|
|
57
|
+
import "@radix-ui/react-dialog";
|
|
58
|
+
import "@radix-ui/react-context-menu";
|
|
63
59
|
const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
|
|
64
60
|
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
65
|
-
|
|
61
|
+
S,
|
|
66
62
|
{
|
|
67
63
|
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
68
64
|
/* @__PURE__ */ e.jsx(j, { className: "h-4 w-4" }),
|
|
@@ -70,7 +66,7 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
70
66
|
] })
|
|
71
67
|
}
|
|
72
68
|
) }),
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
69
|
+
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
74
70
|
/* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
|
|
75
71
|
/* @__PURE__ */ e.jsx(n, { value: "apple", children: "Apple" }),
|
|
76
72
|
/* @__PURE__ */ e.jsx(n, { value: "banana", children: "Banana" }),
|
|
@@ -78,7 +74,7 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
78
74
|
/* @__PURE__ */ e.jsx(n, { value: "grapes", children: "Grapes" }),
|
|
79
75
|
/* @__PURE__ */ e.jsx(n, { value: "pineapple", children: "Pineapple" })
|
|
80
76
|
] }) })
|
|
81
|
-
] }) }),
|
|
77
|
+
] }) }), I = () => {
|
|
82
78
|
const { savePage: i, saveState: t } = y(), { t: a } = x(), o = s("hideSaveButton", !1), r = h(() => {
|
|
83
79
|
switch (t) {
|
|
84
80
|
case "SAVING":
|
|
@@ -102,14 +98,14 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
102
98
|
size: "sm",
|
|
103
99
|
variant: "outline",
|
|
104
100
|
children: [
|
|
105
|
-
/* @__PURE__ */ e.jsx(
|
|
101
|
+
/* @__PURE__ */ e.jsx(C, { className: "text-lg" }),
|
|
106
102
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : a(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
107
103
|
]
|
|
108
104
|
}
|
|
109
105
|
);
|
|
110
106
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
111
|
-
},
|
|
112
|
-
const t = s("previewComponent"), [, a] =
|
|
107
|
+
}, V = function() {
|
|
108
|
+
const t = s("previewComponent"), [, a] = B(), { t: o } = x();
|
|
113
109
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
114
110
|
c,
|
|
115
111
|
{
|
|
@@ -125,7 +121,7 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
125
121
|
]
|
|
126
122
|
}
|
|
127
123
|
) : null;
|
|
128
|
-
},
|
|
124
|
+
}, Le = () => {
|
|
129
125
|
const i = s("topBarComponents.left", []), t = s("topBarComponents.center", []), a = s("topBarComponents.right", []), o = s("editable", !0);
|
|
130
126
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
131
127
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: l.Children.toArray(
|
|
@@ -136,9 +132,9 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
136
132
|
) }),
|
|
137
133
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
138
134
|
/* @__PURE__ */ e.jsx(k, {}),
|
|
139
|
-
/* @__PURE__ */ e.jsx(
|
|
140
|
-
/* @__PURE__ */ e.jsx(
|
|
141
|
-
o ? /* @__PURE__ */ e.jsx(
|
|
135
|
+
/* @__PURE__ */ e.jsx(V, {}),
|
|
136
|
+
/* @__PURE__ */ e.jsx(A, { orientation: "vertical" }),
|
|
137
|
+
o ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
142
138
|
l.Children.toArray(
|
|
143
139
|
a.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
144
140
|
)
|
|
@@ -146,5 +142,5 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
146
142
|
] });
|
|
147
143
|
};
|
|
148
144
|
export {
|
|
149
|
-
|
|
145
|
+
Le as default
|
|
150
146
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-fXj5tdMX.cjs"),s=require("./index-jhNzBWrV.cjs"),j=require("./separator-hT24N-xp.cjs"),l=require("./context-menu-_8TFbFEJ.cjs"),c=require("react-i18next");require("@radix-ui/react-select");require("lodash-es");require("jotai");require("./iconBase-vJD0OXxU.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-gPz7CUOk.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("lodash");require("react-wrap-balancer");require("react-dom");require("prop-types");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("lucide-react");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("@radix-ui/react-scroll-area");require("i18next");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");const d=()=>s.useBuilderProp("languages",["en"]),q=()=>d().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(o.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"})]})})]})}),h=()=>{const{savePage:x,saveState:t}=s.useSavePage(),{t:u}=c.useTranslation(),a=s.useBuilderProp("hideSaveButton",!1),n=i.useMemo(()=>{switch(t){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"}},[t]);if(a)return null;const p=e.jsxRuntimeExports.jsxs(l.Button,{disabled:t==="SAVING",onClick:m=>{m.preventDefault(),x()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:t==="SAVING"?"Saving...":u(t==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:p})},E=function(){const t=s.useBuilderProp("previewComponent"),[,u]=s.usePreviewMode(),{t:a}=c.useTranslation();return t?e.jsxRuntimeExports.jsxs(l.Button,{onClick:n=>{n.preventDefault(),u(!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(o.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:a("Preview")})]}):null},R=()=>{const x=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]),a=s.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:i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(l.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(t.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(l.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(q,{}),e.jsxRuntimeExports.jsx(E,{}),e.jsxRuntimeExports.jsx(j.Separator,{orientation:"vertical"}),a?e.jsxRuntimeExports.jsx(h,{}):null,i.Children.toArray(u.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(l.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),s=require("lodash-es"),g=require("react"),p=require("./index-jhNzBWrV.cjs"),S=require("react-i18next"),C=require("@chaibuilder/runtime"),T=require("lucide-react"),q=require("jotai"),I=require("./iconBase-vJD0OXxU.cjs"),N=require("@radix-ui/react-icons"),i=require("./context-menu-_8TFbFEJ.cjs"),L=require("./STRINGS-gPz7CUOk.cjs"),A=require("clsx"),P=require("flagged");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("tailwind-merge");require("lodash");require("react-wrap-balancer");require("react-dom");require("prop-types");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("@radix-ui/react-scroll-area");require("i18next");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");function O(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,l.get?l:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const D=O(g);function _({uiLibraries:t,library:n,setLibrary:o}){var j;const[l,x]=D.useState(!1),{t:r}=S.useTranslation();return n?e.jsxRuntimeExports.jsxs(i.Popover,{open:l,onOpenChange:x,children:[e.jsxRuntimeExports.jsx(i.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(i.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":l,className:"w-[200px] justify-between",children:[n?(j=t.find(u=>u.uuid===n))==null?void 0:j.name:r("Select library"),e.jsxRuntimeExports.jsx(N.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(i.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(i.Command,{children:[e.jsxRuntimeExports.jsx(i.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(i.CommandList,{children:[e.jsxRuntimeExports.jsx(i.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(i.CommandGroup,{children:t.map(u=>e.jsxRuntimeExports.jsxs(i.CommandItem,{value:u.uuid,onSelect:f=>{o(f),x(!1)},children:[u.name,e.jsxRuntimeExports.jsx(N.CheckIcon,{className:I.cn("ml-auto h-4 w-4",n===u.uuid?"opacity-100":"opacity-0")})]},u.uuid))})]})]})})]}):null}const M=({block:t,closePopover:n,library:o})=>{const[l,x]=g.useState(!1),r=p.useBuilderProp("getUILibraryBlock",s.noop),{addCoreBlock:j,addPredefinedBlock:u}=p.useAddBlock(),[f,R]=p.useSelectedBlockIds(),[,b]=p.useHighlightBlockId(),h=s.get(t,"name",s.get(t,"label")),k=P.useFeature("dnd"),[,v]=q.useAtom(p.draggedBlockAtom),a=c=>{const m=s.has(c,"styles_attrs.data-page-section");return c._type==="Box"&&m},w=g.useCallback(async c=>{if(c.stopPropagation(),s.has(t,"component")){j(t,s.first(f)),n();return}x(!0);const m=await r(o,t);let E=s.first(f);a(s.first(m))&&(E=null),s.isEmpty(m)||u(C.syncBlocksWithDefaults(m),E),n()},[t]),d=async c=>{const m=await r(o,t);let E=s.first(f);if(a(s.first(m))&&(E=null),!s.isEmpty(m)){const y={blocks:m,uiLibrary:!0,parent:E};if(c.dataTransfer.setData("text/plain",JSON.stringify(y)),t.preview){const B=new Image;B.src=t.preview,B.onload=()=>{c.dataTransfer.setDragImage(B,0,0)}}else c.dataTransfer.setDragImage(new Image,0,0);v(y),setTimeout(()=>{R([]),b(null),n()},200)}};return e.jsxRuntimeExports.jsxs(i.Tooltip,{children:[e.jsxRuntimeExports.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{onClick:l?()=>{}:w,draggable:k?"true":"false",onDragStart:d,className:A("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:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin",size:15,color:"white"}),e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[25px] w-full rounded-md",alt:h}):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:h})})]})}),e.jsxRuntimeExports.jsx(i.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:h})})]})},U=q.atom({}),z=t=>{const[n,o]=q.useAtom(U),l=p.useBuilderProp("getUILibraryBlocks",s.noop),x=s.get(n,`${t==null?void 0:t.uuid}.blocks`,[]),r=s.get(n,`${t==null?void 0:t.uuid}.loading`,!1);return g.useEffect(()=>{(async()=>{if(r||x.length>0||!t)return;o(u=>({...u,[t==null?void 0:t.uuid]:{loading:!0,blocks:[]}}));const j=await l(t);o(u=>({...u,[t==null?void 0:t.uuid]:{loading:!1,blocks:j||[]}}))})()},[t,x,r]),{data:x,isLoading:r}},G=p.atomWithStorage("_selectedLibrary",null),H=()=>{const[t,n]=q.useAtom(G),o=p.useBuilderProp("uiLibraries",[]),l=C.useChaiBlocks(),x=s.values(l).filter(d=>d.category==="custom"),r=o.find(d=>d.uuid===t)||s.first(o),{data:j,isLoading:u}=z(r),f=s.groupBy([...j,...x],"group"),[R,b]=g.useState("Hero"),[,h]=q.useAtom(p.activePanelAtom),k=s.get(f,R,[]),{t:v}=S.useTranslation(),a=g.useRef(null),w=d=>{a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{a.current&&b(d)},300)};return u?e.jsxRuntimeExports.jsx(i.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(_,{library:r==null?void 0:r.uuid,setLibrary:n,uiLibraries:o})})})}):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:g.Children.toArray(s.map(f,(d,c)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>w(c),onMouseLeave:()=>clearTimeout(a.current),onClick:()=>b(c),className:I.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",c===R?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:s.capitalize(c)}),e.jsxRuntimeExports.jsx(N.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},c)))}),e.jsxRuntimeExports.jsxs(i.ScrollArea,{onMouseEnter:()=>a.current?clearTimeout(a.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:v("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:g.Children.toArray(k.map(d=>e.jsxRuntimeExports.jsx(M,{block:d,library:r,closePopover:()=>h(L.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},F=()=>e.jsxRuntimeExports.jsx(H,{});exports.default=F;
|