@chaibuilder/sdk 1.2.67 → 1.2.69

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.
Files changed (48) hide show
  1. package/dist/CodeEditor-hWn_HIZX.cjs +1 -0
  2. package/dist/{CodeEditor-q5unEaUI.js → CodeEditor-j7qNDNkC.js} +18 -14
  3. package/dist/STRINGS-hZpwIZMT.cjs +1 -0
  4. package/dist/STRINGS-rPGH65PW.js +8 -0
  5. package/dist/Topbar-MIYSo6jN.cjs +1 -0
  6. package/dist/{Topbar-kVBx7pp4.js → Topbar-Mfc4KKxc.js} +28 -26
  7. package/dist/{UnsplashImages-sotLcz6r.js → UnsplashImages-KIgzZx57.js} +30 -26
  8. package/dist/UnsplashImages-zco6ruqn.cjs +1 -0
  9. package/dist/{UploadImages-I0QQ6vj1.js → UploadImages-sygXbTXU.js} +18 -14
  10. package/dist/UploadImages-znUxJ9OD.cjs +1 -0
  11. package/dist/context-menu-Lx_MAqsu.cjs +1 -0
  12. package/dist/{context-menu-sks9vdzC.js → context-menu-zu6r7B6f.js} +298 -311
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.d.ts +14 -1
  15. package/dist/core.js +88 -80
  16. package/dist/{index-5hfuDpYs.cjs → index-FpYnmYj7.cjs} +23 -23
  17. package/dist/{index-Zu-K_BX7.js → index-T7WZImL0.js} +5639 -4980
  18. package/dist/render.cjs +1 -1
  19. package/dist/render.js +1 -1
  20. package/dist/{select-JW3OMYm-.js → select-1WwjQDp6.js} +1 -1
  21. package/dist/{select-fXj5tdMX.cjs → select-FnytvxNn.cjs} +1 -1
  22. package/dist/ui.cjs +1 -1
  23. package/dist/ui.d.ts +5 -5
  24. package/dist/ui.js +251 -215
  25. package/dist/web-blocks.cjs +1 -1
  26. package/dist/web-blocks.js +385 -392
  27. package/package.json +1 -1
  28. package/dist/AddBlocks-TVOOPK2w.cjs +0 -1
  29. package/dist/AddBlocks-mbuhydG3.js +0 -123
  30. package/dist/CanvasArea-KJMcis97.cjs +0 -1
  31. package/dist/CanvasArea-kg3Rgg9t.js +0 -136
  32. package/dist/CodeEditor-QP6l0mv4.cjs +0 -1
  33. package/dist/STRINGS--j49GZJP.js +0 -7
  34. package/dist/STRINGS-gPz7CUOk.cjs +0 -1
  35. package/dist/SettingsPanel-MWeQjDWs.cjs +0 -1
  36. package/dist/SettingsPanel-pomLrOxB.js +0 -81
  37. package/dist/SidePanels-9sbERNEv.cjs +0 -1
  38. package/dist/SidePanels-YpRrvfiH.js +0 -406
  39. package/dist/Topbar-veJ2_blW.cjs +0 -1
  40. package/dist/UILibrariesPanel-ES8YzN9C.js +0 -226
  41. package/dist/UILibrariesPanel-H8t36R6M.cjs +0 -1
  42. package/dist/UnsplashImages--MXx-DYM.cjs +0 -1
  43. package/dist/UploadImages-xhxeYKkl.cjs +0 -1
  44. package/dist/badge-7BVT3zxN.cjs +0 -1
  45. package/dist/badge-pJqQSA13.js +0 -23
  46. package/dist/context-menu-_8TFbFEJ.cjs +0 -1
  47. package/dist/separator-hT24N-xp.cjs +0 -1
  48. package/dist/separator-sgwOa1FE.js +0 -18
@@ -1,406 +0,0 @@
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-Zu-K_BX7.js";
8
- import { useTranslation as g } from "react-i18next";
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";
15
- import "@radix-ui/react-switch";
16
- import "@radix-ui/react-accordion";
17
- import "class-variance-authority";
18
- import "@radix-ui/react-alert-dialog";
19
- import "@radix-ui/react-slot";
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-hover-card";
26
- import "@radix-ui/react-dropdown-menu";
27
- import "@radix-ui/react-toast";
28
- import "cmdk";
29
- import "@radix-ui/react-dialog";
30
- import "@radix-ui/react-context-menu";
31
- import "clsx";
32
- import "tailwind-merge";
33
- import "./plugin-sJ3Hzvpv.js";
34
- import "@react-hookz/web";
35
- import "tree-model";
36
- import "react-quill";
37
- import "react-hotkeys-hook";
38
- import "@floating-ui/dom";
39
- import "@floating-ui/react-dom";
40
- import "flagged";
41
- import "@tailwindcss/typography";
42
- import "@tailwindcss/forms";
43
- import "@tailwindcss/aspect-ratio";
44
- import "tailwindcss-palette-generator";
45
- import "react-wrap-balancer";
46
- import "react-dom";
47
- import "prop-types";
48
- import "@rjsf/validator-ajv8";
49
- import "@rjsf/core";
50
- import "react-arborist";
51
- import "himalaya";
52
- import "react-icons-picker";
53
- import "react-autosuggest";
54
- import "fuse.js";
55
- import "i18next";
56
- import "@radix-ui/react-select";
57
- const Ke = ({ provider: s, onClose: a }) => {
58
- const { t } = g(), [l, u] = p(null);
59
- return Y(() => {
60
- s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => u(c));
61
- }, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : a(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
62
- /* @__PURE__ */ e.jsxs(F, { children: [
63
- /* @__PURE__ */ e.jsxs(U, { children: [
64
- t("data_provider"),
65
- ": ",
66
- s.name
67
- ] }),
68
- /* @__PURE__ */ e.jsx(se, { children: s.description })
69
- ] }),
70
- /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(
71
- be,
72
- {
73
- data: l,
74
- shouldExpandNode: Ne,
75
- style: {
76
- ...ye,
77
- container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
78
- stringValue: "text-orange-600",
79
- label: "text-green-900 font-semibold pr-1 tracking-wider"
80
- }
81
- }
82
- ) })
83
- ] }) }) : null;
84
- };
85
- function Ee({
86
- children: s,
87
- name: a,
88
- onRemove: t
89
- }) {
90
- const { t: l } = g();
91
- return /* @__PURE__ */ e.jsxs(re, { children: [
92
- /* @__PURE__ */ e.jsx(ie, { asChild: !0, children: s }),
93
- /* @__PURE__ */ e.jsxs(te, { children: [
94
- /* @__PURE__ */ e.jsxs(le, { children: [
95
- /* @__PURE__ */ e.jsx(
96
- ae,
97
- {
98
- dangerouslySetInnerHTML: { __html: l("remove_provider_confirmation").replace("{name}", a) }
99
- }
100
- ),
101
- /* @__PURE__ */ e.jsx(oe, { children: l("remove_provider_warning") })
102
- ] }),
103
- /* @__PURE__ */ e.jsxs(ne, { children: [
104
- /* @__PURE__ */ e.jsx(ce, { children: l("cancel") }),
105
- /* @__PURE__ */ e.jsx(de, { onClick: t, className: "bg-red-600 hover:bg-red-700", children: l("remove") })
106
- ] })
107
- ] })
108
- ] });
109
- }
110
- const ze = () => {
111
- const { t: s } = g(), a = W(() => De(), []), [t, l] = je(), [, u] = M(ve), [d, c] = p(
112
- y(a, (r) => B(t, "providerKey").includes(r.providerKey))
113
- ), [k, h] = p(""), [C, b] = p(null), D = y(
114
- a.map((r) => B(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
115
- (r) => !q(r)
116
- ), T = (r) => {
117
- const m = $(a, { providerKey: r });
118
- c((i) => [...i, m]), l((i) => [...i, { providerKey: m.providerKey, args: {} }]), h(""), u("UNSAVED");
119
- }, N = (r) => {
120
- c((m) => y(m, (i) => i.providerKey !== r.providerKey)), l((m) => y(m, (i) => i.providerKey !== r.providerKey)), u("UNSAVED");
121
- }, n = (r) => b(r);
122
- return G(a) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
123
- s("no_data_providers"),
124
- /* @__PURE__ */ e.jsx("br", {}),
125
- /* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
126
- ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
127
- /* @__PURE__ */ e.jsx("br", {}),
128
- /* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
129
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(Se, { value: k, onValueChange: (r) => T(r), children: [
130
- /* @__PURE__ */ e.jsx(Ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(Pe, { placeholder: s("select_provider") }) }),
131
- /* @__PURE__ */ e.jsxs(_e, { children: [
132
- /* @__PURE__ */ e.jsx(L, { value: "", children: s("choose") }),
133
- D.map((r) => /* @__PURE__ */ e.jsx(L, { value: r.value, children: r.label }, r.value))
134
- ] })
135
- ] }) }),
136
- /* @__PURE__ */ e.jsx("br", {}),
137
- /* @__PURE__ */ e.jsxs("div", { className: `border-t ${d.length ? "block" : "hidden"}`, children: [
138
- /* @__PURE__ */ e.jsxs("p", { className: "flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500", children: [
139
- s("page_data_providers"),
140
- ":"
141
- ] }),
142
- /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: d.map((r) => /* @__PURE__ */ e.jsxs(
143
- "div",
144
- {
145
- className: "w-full rounded-lg border bg-card text-card-foreground shadow-sm",
146
- "data-v0-t": "card",
147
- children: [
148
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ e.jsxs("div", { children: [
149
- /* @__PURE__ */ e.jsx("h3", { className: "font-medium leading-4", children: r.name }),
150
- /* @__PURE__ */ e.jsx("p", { className: "pt-1 text-xs text-gray-400", children: r.description })
151
- ] }) }) }),
152
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
153
- /* @__PURE__ */ e.jsxs(
154
- "button",
155
- {
156
- onClick: () => n(r),
157
- 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",
158
- children: [
159
- /* @__PURE__ */ e.jsxs(
160
- "svg",
161
- {
162
- xmlns: "http://www.w3.org/2000/svg",
163
- width: "24",
164
- height: "24",
165
- viewBox: "0 0 24 24",
166
- fill: "none",
167
- stroke: "currentColor",
168
- strokeWidth: "2",
169
- strokeLinecap: "round",
170
- strokeLinejoin: "round",
171
- className: "mr-2 h-4 w-4",
172
- children: [
173
- /* @__PURE__ */ e.jsx("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
174
- /* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
175
- ]
176
- }
177
- ),
178
- s("view_data")
179
- ]
180
- }
181
- ),
182
- /* @__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: [
183
- /* @__PURE__ */ e.jsxs(
184
- "svg",
185
- {
186
- xmlns: "http://www.w3.org/2000/svg",
187
- width: "24",
188
- height: "24",
189
- viewBox: "0 0 24 24",
190
- fill: "none",
191
- stroke: "currentColor",
192
- strokeWidth: "2",
193
- strokeLinecap: "round",
194
- strokeLinejoin: "round",
195
- className: "mr-2 h-4 w-4",
196
- children: [
197
- /* @__PURE__ */ e.jsx("path", { d: "M3 6h18" }),
198
- /* @__PURE__ */ e.jsx("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
199
- /* @__PURE__ */ e.jsx("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
200
- ]
201
- }
202
- ),
203
- s("remove")
204
- ] }) })
205
- ] })
206
- ]
207
- },
208
- r.providerKey
209
- )) }),
210
- /* @__PURE__ */ e.jsx(Ke, { onClose: () => b(null), provider: C })
211
- ] })
212
- ] });
213
- }, Le = Z(() => {
214
- const { t: s } = g(), a = {
215
- "ctrl + Z": "Undo",
216
- "ctrl + Y": "Redo",
217
- "ctrl + D": "Duplicate"
218
- }, t = {
219
- // "ctrl + /": "Rename block",
220
- "ctrl + S": "Save page",
221
- esc: "Deselect blocks",
222
- del: "Delete block"
223
- };
224
- return /* @__PURE__ */ e.jsxs(O, { children: [
225
- /* @__PURE__ */ e.jsx(me, { children: /* @__PURE__ */ e.jsxs(xe, { children: [
226
- /* @__PURE__ */ e.jsx(pe, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex w-10 items-center justify-center", children: /* @__PURE__ */ e.jsx(R, {}) }) }),
227
- /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
228
- ] }) }),
229
- /* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
230
- /* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(U, { children: s("Keyboard shortcuts") }) }),
231
- /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
232
- /* @__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: [
233
- /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
234
- /* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
235
- ] }, l)) }),
236
- /* @__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: [
237
- /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
238
- /* @__PURE__ */ e.jsx("div", { children: s(t[l]) })
239
- ] }, l)) })
240
- ] }) })
241
- ] })
242
- ] });
243
- }), Ie = v(() => import("./AddBlocks-mbuhydG3.js")), P = v(() => import("./index-Zu-K_BX7.js").then((s) => s.ad)), Ve = v(() => import("./index-Zu-K_BX7.js").then((s) => s.ac)), Me = v(() => import("./index-Zu-K_BX7.js").then((s) => s.ae)), Oe = v(() => import("./UILibrariesPanel-ES8YzN9C.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, {}) }) });
244
- let V = null;
245
- const Rs = () => {
246
- 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 = {
247
- "add-blocks": He,
248
- [o]: P,
249
- "theme-configuration": Ve,
250
- images: Me,
251
- "ui-libraries": Oe
252
- };
253
- X(s, ({ name: i, panel: S }) => {
254
- N[i] = S;
255
- });
256
- const n = (i) => {
257
- clearTimeout(V), t !== o && i === o ? V = setTimeout(() => l(o), 500) : d(i), l(i);
258
- }, r = w("dataBindingSupport", !1);
259
- function m() {
260
- const i = setTimeout(() => {
261
- c && (n(o), clearTimeout(c));
262
- }, 500);
263
- k(i);
264
- }
265
- return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
266
- t !== o ? /* @__PURE__ */ e.jsx(
267
- "div",
268
- {
269
- onMouseEnter: m,
270
- onClick: () => n(o),
271
- className: "fixed inset-0 z-[50] bg-black/20"
272
- }
273
- ) : null,
274
- /* @__PURE__ */ e.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: [
275
- /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
276
- T ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1 rounded-md bg-gray-200 p-1", children: [
277
- /* @__PURE__ */ e.jsx(
278
- x,
279
- {
280
- onClick: () => n("add-blocks"),
281
- size: "sm",
282
- variant: t === "add-blocks" ? "default" : "outline",
283
- children: /* @__PURE__ */ e.jsx(_, { className: "text-xl" })
284
- }
285
- ),
286
- /* @__PURE__ */ e.jsx(
287
- x,
288
- {
289
- onClick: () => n("ui-libraries"),
290
- size: "sm",
291
- variant: t === "ui-libraries" ? "default" : "outline",
292
- children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
293
- }
294
- )
295
- ] }) : /* @__PURE__ */ e.jsx(
296
- x,
297
- {
298
- onClick: () => n("add-blocks"),
299
- size: "sm",
300
- variant: t === "add-blocks" ? "default" : "outline",
301
- children: /* @__PURE__ */ e.jsx(_, { className: "text-xl" })
302
- }
303
- ),
304
- /* @__PURE__ */ e.jsx(
305
- x,
306
- {
307
- onClick: () => n(o),
308
- size: "sm",
309
- variant: t === o ? "default" : "outline",
310
- children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
311
- }
312
- ),
313
- /* @__PURE__ */ e.jsx(
314
- x,
315
- {
316
- onClick: () => n("theme-configuration"),
317
- size: "sm",
318
- variant: t === "theme-configuration" ? "default" : "outline",
319
- children: /* @__PURE__ */ e.jsx(ke, { className: "w-4 max-w-[40px] text-xs" })
320
- }
321
- ),
322
- f.Children.toArray(
323
- s.map(({ name: i, icon: S }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(K, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
324
- x,
325
- {
326
- onClick: () => n(i),
327
- size: "sm",
328
- className: "w-10",
329
- variant: t === i ? "default" : "outline",
330
- children: /* @__PURE__ */ e.jsx(S, {})
331
- }
332
- ) }))
333
- )
334
- ] }),
335
- /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
336
- /* @__PURE__ */ e.jsx(Le, {}),
337
- f.Children.toArray(
338
- a.map((i) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(K, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
339
- )
340
- ] })
341
- ] }),
342
- t !== o ? /* @__PURE__ */ e.jsx(
343
- "div",
344
- {
345
- className: "absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",
346
- children: /* @__PURE__ */ e.jsx(
347
- j,
348
- {
349
- fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
350
- /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
351
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
352
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
353
- ] }),
354
- children: /* @__PURE__ */ e.jsx(
355
- "div",
356
- {
357
- className: Be(
358
- "relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"
359
- ),
360
- onMouseEnter: () => {
361
- c && clearTimeout(c);
362
- },
363
- children: f.createElement(ee(N, t, () => /* @__PURE__ */ e.jsx("div", {})))
364
- }
365
- )
366
- }
367
- )
368
- }
369
- ) : null,
370
- /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
371
- j,
372
- {
373
- fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
374
- /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
375
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
376
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
377
- ] }),
378
- children: r ? /* @__PURE__ */ e.jsxs(he, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
379
- /* @__PURE__ */ e.jsxs(fe, { className: "mx-1 grid h-10 grid-cols-2", children: [
380
- /* @__PURE__ */ e.jsxs(E, { value: o, children: [
381
- /* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
382
- " ",
383
- h("Outline")
384
- ] }),
385
- /* @__PURE__ */ e.jsxs(E, { value: "data-provider", children: [
386
- /* @__PURE__ */ e.jsx(Ce, { className: "mr-2 w-3" }),
387
- h("Data")
388
- ] })
389
- ] }),
390
- /* @__PURE__ */ e.jsx(z, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
391
- /* @__PURE__ */ e.jsx(z, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
392
- ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
393
- /* @__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: [
394
- /* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
395
- " ",
396
- h("Outline")
397
- ] }),
398
- /* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(P) })
399
- ] })
400
- }
401
- ) })
402
- ] });
403
- };
404
- export {
405
- Rs as default
406
- };
@@ -1 +0,0 @@
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-5hfuDpYs.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("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("i18next");require("@radix-ui/react-scroll-area");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;
@@ -1,226 +0,0 @@
1
- import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import { values as D, first as x, groupBy as U, get as g, map as _, capitalize as z, noop as T, has as I, isEmpty as L } from "lodash-es";
3
- import * as R from "react";
4
- import S, { useState as A, useRef as O, useCallback as G, useEffect as M } from "react";
5
- import { w as H, c as C, e as F, s as W, i as $, t as J, r as K } from "./index-Zu-K_BX7.js";
6
- import { useTranslation as P } from "react-i18next";
7
- import { useChaiBlocks as X, syncBlocksWithDefaults as Y } from "@chaibuilder/runtime";
8
- import { Loader as q } from "lucide-react";
9
- import { atom as Q, useAtom as w } from "jotai";
10
- import { c as E } from "./iconBase-zweRWSz0.js";
11
- import { CaretSortIcon as V, CheckIcon as Z, CaretRightIcon as ee } from "@radix-ui/react-icons";
12
- import { P as te, s as se, B as oe, t as re, u as ae, v as ie, w as ne, x as le, y as ce, z as de, S as me, X as ue, T as pe, d as xe, e as fe } from "./context-menu-sks9vdzC.js";
13
- import { O as he } from "./STRINGS--j49GZJP.js";
14
- import ge from "clsx";
15
- import { useFeature as je } from "flagged";
16
- import "./plugin-sJ3Hzvpv.js";
17
- import "@react-hookz/web";
18
- import "tree-model";
19
- import "react-quill";
20
- import "react-hotkeys-hook";
21
- import "@floating-ui/dom";
22
- import "@floating-ui/react-dom";
23
- import "@tailwindcss/typography";
24
- import "@tailwindcss/forms";
25
- import "@tailwindcss/aspect-ratio";
26
- import "tailwindcss-palette-generator";
27
- import "tailwind-merge";
28
- import "react-wrap-balancer";
29
- import "react-dom";
30
- import "prop-types";
31
- import "@rjsf/validator-ajv8";
32
- import "@rjsf/core";
33
- import "react-arborist";
34
- import "himalaya";
35
- import "react-icons-picker";
36
- import "react-autosuggest";
37
- import "fuse.js";
38
- import "i18next";
39
- import "@radix-ui/react-scroll-area";
40
- import "@radix-ui/react-switch";
41
- import "@radix-ui/react-accordion";
42
- import "class-variance-authority";
43
- import "@radix-ui/react-alert-dialog";
44
- import "@radix-ui/react-slot";
45
- import "@radix-ui/react-label";
46
- import "@radix-ui/react-tabs";
47
- import "@radix-ui/react-tooltip";
48
- import "@radix-ui/react-popover";
49
- import "@radix-ui/react-hover-card";
50
- import "@radix-ui/react-dropdown-menu";
51
- import "@radix-ui/react-toast";
52
- import "cmdk";
53
- import "@radix-ui/react-dialog";
54
- import "@radix-ui/react-context-menu";
55
- function ke({
56
- uiLibraries: t,
57
- library: a,
58
- setLibrary: i
59
- }) {
60
- var u;
61
- const [d, l] = R.useState(!1), { t: s } = P();
62
- return a ? /* @__PURE__ */ e.jsxs(te, { open: d, onOpenChange: l, children: [
63
- /* @__PURE__ */ e.jsx(se, { asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
64
- /* @__PURE__ */ e.jsx("span", { children: s("Choose Library") }),
65
- /* @__PURE__ */ e.jsxs(
66
- oe,
67
- {
68
- variant: "outline",
69
- size: "sm",
70
- role: "combobox",
71
- "aria-expanded": d,
72
- className: "w-[200px] justify-between",
73
- children: [
74
- a ? (u = t.find((o) => o.uuid === a)) == null ? void 0 : u.name : s("Select library"),
75
- /* @__PURE__ */ e.jsx(V, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
76
- ]
77
- }
78
- )
79
- ] }) }),
80
- /* @__PURE__ */ e.jsx(re, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(ae, { children: [
81
- /* @__PURE__ */ e.jsx(ie, { placeholder: "Search library...", className: "h-9" }),
82
- /* @__PURE__ */ e.jsxs(ne, { children: [
83
- /* @__PURE__ */ e.jsx(le, { children: "No library found." }),
84
- /* @__PURE__ */ e.jsx(ce, { children: t.map((o) => /* @__PURE__ */ e.jsxs(
85
- de,
86
- {
87
- value: o.uuid,
88
- onSelect: (p) => {
89
- i(p), l(!1);
90
- },
91
- children: [
92
- o.name,
93
- /* @__PURE__ */ e.jsx(
94
- Z,
95
- {
96
- className: E("ml-auto h-4 w-4", a === o.uuid ? "opacity-100" : "opacity-0")
97
- }
98
- )
99
- ]
100
- },
101
- o.uuid
102
- )) })
103
- ] })
104
- ] }) })
105
- ] }) : null;
106
- }
107
- const we = ({
108
- block: t,
109
- closePopover: a,
110
- library: i
111
- }) => {
112
- const [d, l] = A(!1), s = C("getUILibraryBlock", T), { addCoreBlock: u, addPredefinedBlock: o } = W(), [p, j] = $(), [, k] = J(), f = g(t, "name", g(t, "label")), v = je("dnd"), [, B] = w(K), n = (r) => {
113
- const m = I(r, "styles_attrs.data-page-section");
114
- return r._type === "Box" && m;
115
- }, b = G(
116
- async (r) => {
117
- if (r.stopPropagation(), I(t, "component")) {
118
- u(t, x(p)), a();
119
- return;
120
- }
121
- l(!0);
122
- const m = await s(i, t);
123
- let h = x(p);
124
- n(x(m)) && (h = null), L(m) || o(Y(m), h), a();
125
- },
126
- [t]
127
- ), c = async (r) => {
128
- const m = await s(i, t);
129
- let h = x(p);
130
- if (n(x(m)) && (h = null), !L(m)) {
131
- const y = { blocks: m, uiLibrary: !0, parent: h };
132
- if (r.dataTransfer.setData("text/plain", JSON.stringify(y)), t.preview) {
133
- const N = new Image();
134
- N.src = t.preview, N.onload = () => {
135
- r.dataTransfer.setDragImage(N, 0, 0);
136
- };
137
- } else
138
- r.dataTransfer.setDragImage(new Image(), 0, 0);
139
- B(y), setTimeout(() => {
140
- j([]), k(null), a();
141
- }, 200);
142
- }
143
- };
144
- return /* @__PURE__ */ e.jsxs(pe, { children: [
145
- /* @__PURE__ */ e.jsx(xe, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
146
- "div",
147
- {
148
- onClick: d ? () => {
149
- } : b,
150
- draggable: v ? "true" : "false",
151
- onDragStart: c,
152
- className: ge(
153
- "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
154
- ),
155
- children: [
156
- d && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
157
- /* @__PURE__ */ e.jsx(q, { className: "animate-spin", size: 15, color: "white" }),
158
- /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
159
- ] }),
160
- t.preview ? /* @__PURE__ */ e.jsx("img", { src: t.preview, className: "min-h-[25px] w-full rounded-md", alt: f }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: f }) })
161
- ]
162
- }
163
- ) }),
164
- /* @__PURE__ */ e.jsx(fe, { children: /* @__PURE__ */ e.jsx("p", { children: f }) })
165
- ] });
166
- }, ve = Q({}), Be = (t) => {
167
- const [a, i] = w(ve), d = C("getUILibraryBlocks", T), l = g(a, `${t == null ? void 0 : t.uuid}.blocks`, []), s = g(a, `${t == null ? void 0 : t.uuid}.loading`, !1);
168
- return M(() => {
169
- (async () => {
170
- if (s || l.length > 0 || !t)
171
- return;
172
- i((o) => ({ ...o, [t == null ? void 0 : t.uuid]: { loading: !0, blocks: [] } }));
173
- const u = await d(t);
174
- i((o) => ({ ...o, [t == null ? void 0 : t.uuid]: { loading: !1, blocks: u || [] } }));
175
- })();
176
- }, [t, l, s]), { data: l, isLoading: s };
177
- }, be = H("_selectedLibrary", null), Ne = () => {
178
- const [t, a] = w(be), i = C("uiLibraries", []), d = X(), l = D(d).filter((c) => c.category === "custom"), s = i.find((c) => c.uuid === t) || x(i), { data: u, isLoading: o } = Be(s), p = U([...u, ...l], "group"), [j, k] = A("Hero"), [, f] = w(F), v = g(p, j, []), { t: B } = P(), n = O(null), b = (c) => {
179
- n.current && (clearTimeout(n.current), n.current = null), n.current = setTimeout(() => {
180
- n.current && k(c);
181
- }, 300);
182
- };
183
- return o ? /* @__PURE__ */ e.jsx(me, { className: "h-full w-full" }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background", children: [
184
- s != null && s.uuid ? /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex h-fit flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col", children: /* @__PURE__ */ e.jsx(ke, { library: s == null ? void 0 : s.uuid, setLibrary: a, uiLibraries: i }) }) }) }) : null,
185
- /* @__PURE__ */ e.jsxs("div", { className: "flex h-[95%] border-t border-gray-300 pt-2", children: [
186
- /* @__PURE__ */ e.jsx("div", { className: "flex h-full w-40 flex-col gap-1 px-1", children: S.Children.toArray(
187
- _(p, (c, r) => /* @__PURE__ */ e.jsxs(
188
- "div",
189
- {
190
- onMouseEnter: () => b(r),
191
- onMouseLeave: () => clearTimeout(n.current),
192
- onClick: () => k(r),
193
- className: E(
194
- "flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",
195
- r === j ? "bg-blue-500 text-white hover:bg-blue-600" : ""
196
- ),
197
- children: [
198
- /* @__PURE__ */ e.jsx("span", { children: z(r) }),
199
- /* @__PURE__ */ e.jsx(ee, { className: "ml-2 h-5 w-5" })
200
- ]
201
- },
202
- r
203
- ))
204
- ) }),
205
- /* @__PURE__ */ e.jsxs(
206
- ue,
207
- {
208
- onMouseEnter: () => n.current ? clearTimeout(n.current) : null,
209
- 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",
210
- children: [
211
- /* @__PURE__ */ e.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: B("Click on a block to add it to the page") }),
212
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2 px-2", children: S.Children.toArray(
213
- v.map((c) => /* @__PURE__ */ e.jsx(we, { block: c, library: s, closePopover: () => f(he) }))
214
- ) }),
215
- /* @__PURE__ */ e.jsx("br", {}),
216
- /* @__PURE__ */ e.jsx("br", {}),
217
- /* @__PURE__ */ e.jsx("br", {})
218
- ]
219
- }
220
- )
221
- ] })
222
- ] }) });
223
- }, Nt = () => /* @__PURE__ */ e.jsx(Ne, {});
224
- export {
225
- Nt as default
226
- };