@chaibuilder/sdk 1.2.33 → 1.2.35

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 (95) hide show
  1. package/dist/{AddBlocks-0eVRNr1d.js → AddBlocks-fpRgZNZT.js} +36 -32
  2. package/dist/AddBlocks-i2OFXcGZ.cjs +1 -0
  3. package/dist/BrandingOptions-BuV0XItY.cjs +1 -0
  4. package/dist/{BrandingOptions-yYAznnw2.js → BrandingOptions-RxIUds41.js} +37 -31
  5. package/dist/CanvasArea-C1VfoHjl.js +1200 -0
  6. package/dist/CanvasArea-a-I0uB7y.cjs +55 -0
  7. package/dist/{index-AJalHhkO.js → ChaiBuilderEditor-ChKigulx.js} +26119 -22752
  8. package/dist/ChaiBuilderEditor-pWAMhLiq.cjs +206 -0
  9. package/dist/CurrentPage-JgJ2XITk.cjs +1 -0
  10. package/dist/{CurrentPage-1v40uk8K.js → CurrentPage-tWXo7zPq.js} +19 -19
  11. package/dist/{ListTree-0ZrRreCs.js → ListTree-_JJ1Ka3e.js} +86 -81
  12. package/dist/ListTree-rJ4eHyKn.cjs +1 -0
  13. package/dist/{PagesPanel-AxQX-BX2.js → PagesPanel-bwRvd7HB.js} +14 -14
  14. package/dist/PagesPanel-zd48fj10.cjs +1 -0
  15. package/dist/{ProjectPanel-GYdge5v9.js → ProjectPanel-S7X2GDYk.js} +16 -16
  16. package/dist/ProjectPanel-sIURK9WR.cjs +1 -0
  17. package/dist/{Settings-9JAzGHau.js → Settings-59DRCnXh.js} +53 -53
  18. package/dist/Settings-Lw_UvEWj.cjs +1 -0
  19. package/dist/SidePanels-FX3WxtRi.cjs +1 -0
  20. package/dist/{SidePanels-bLwsW29O.js → SidePanels-QwN_fVWJ.js} +70 -70
  21. package/dist/Topbar-_k5gwR_4.js +133 -0
  22. package/dist/Topbar-cRmIAzUg.cjs +1 -0
  23. package/dist/{UnsplashImages-NYwOOgYa.js → UnsplashImages-hI0Zvl2t.js} +27 -22
  24. package/dist/UnsplashImages-texUmBiW.cjs +1 -0
  25. package/dist/{UploadImages-vpZeW-YW.js → UploadImages-diXySdpc.js} +33 -27
  26. package/dist/UploadImages-kRSLsKBv.cjs +1 -0
  27. package/dist/{add-page-modal-hDyzsEU7.js → add-page-modal-Md_OotSU.js} +22 -22
  28. package/dist/add-page-modal-R9nsF97c.cjs +1 -0
  29. package/dist/{confirm-alert-FGQKKQJU.js → confirm-alert-DS8nMVJP.js} +16 -10
  30. package/dist/confirm-alert-gKJ-H8aH.cjs +1 -0
  31. package/dist/{controls-OfJWSEqC.js → controls-VTdJhdSz.js} +44 -41
  32. package/dist/controls-jWJDao88.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +9 -0
  35. package/dist/core.js +46 -45
  36. package/dist/{delete-page-modal-KxeyBri2.js → delete-page-modal-PVpCkC06.js} +15 -15
  37. package/dist/delete-page-modal-ez831xRV.cjs +1 -0
  38. package/dist/email-blocks.cjs +1 -1
  39. package/dist/email-blocks.js +1 -1
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.d.ts +9 -0
  42. package/dist/email.js +18 -16
  43. package/dist/form-6D7DLOsP.cjs +1 -0
  44. package/dist/{form-77dY98bF.js → form-BcCd02eY.js} +7 -7
  45. package/dist/index-F_-wLCKB.cjs +1 -0
  46. package/dist/{index-5zkCTSAM.js → index-NmcmhDTV.js} +28 -29
  47. package/dist/{page-viewer-umQaut1j.js → page-viewer-1bDdfbfY.js} +21 -21
  48. package/dist/page-viewer-MyIBh0H7.cjs +1 -0
  49. package/dist/project-general-setting-1UvYceGY.cjs +1 -0
  50. package/dist/{project-general-setting-uuCemMCU.js → project-general-setting-cAuIqXqs.js} +24 -24
  51. package/dist/{project-seo-setting-asvbPQiI.js → project-seo-setting-DIspBN3U.js} +26 -20
  52. package/dist/project-seo-setting-ePXNygH3.cjs +1 -0
  53. package/dist/single-page-detail-6M4by4GP.cjs +1 -0
  54. package/dist/{single-page-detail-F6pKWyq1.js → single-page-detail-VEdxOlo1.js} +25 -25
  55. package/dist/studio.cjs +1 -1
  56. package/dist/studio.d.ts +9 -0
  57. package/dist/studio.js +13 -13
  58. package/dist/ui.cjs +1 -1
  59. package/dist/ui.js +153 -147
  60. package/dist/useCanvasSettings-YdWIGhpI.js +6 -0
  61. package/dist/useCanvasSettings-xq3gcMsb.cjs +1 -0
  62. package/dist/web-blocks.cjs +4 -4
  63. package/dist/web-blocks.js +137 -113
  64. package/package.json +9 -3
  65. package/dist/AddBlocks-t0hKDSud.cjs +0 -1
  66. package/dist/BrandingOptions-NVmCxZfD.cjs +0 -1
  67. package/dist/CanvasArea-2b4oSjRx.js +0 -1177
  68. package/dist/CanvasArea-OzyCq6UU.cjs +0 -55
  69. package/dist/CurrentPage-YBMhEBZG.cjs +0 -1
  70. package/dist/ListTree-jPwxgI6R.cjs +0 -1
  71. package/dist/PagesPanel-ivEL9tIQ.cjs +0 -1
  72. package/dist/ProjectPanel-shgvg_yT.cjs +0 -1
  73. package/dist/Settings-MMwEBADN.cjs +0 -1
  74. package/dist/SidePanels-iaaRCUeQ.cjs +0 -1
  75. package/dist/Topbar-0Ql8pHVc.js +0 -132
  76. package/dist/Topbar-CkUhCnSW.cjs +0 -1
  77. package/dist/UnsplashImages-juwtWvXe.cjs +0 -1
  78. package/dist/UploadImages-4_jmnoVi.cjs +0 -1
  79. package/dist/add-page-modal-2ZPjc54F.cjs +0 -1
  80. package/dist/confirm-alert-QRxOc76t.cjs +0 -1
  81. package/dist/controls-KK2oLIa8.cjs +0 -1
  82. package/dist/delete-page-modal--N1nPPIL.cjs +0 -1
  83. package/dist/form-hT5dGoJH.cjs +0 -1
  84. package/dist/index-FPBudsRF.cjs +0 -1
  85. package/dist/index-JIcsKKoG.cjs +0 -1
  86. package/dist/index-YpnaudSM.js +0 -63
  87. package/dist/index-ecnGWzh9.cjs +0 -1
  88. package/dist/index-hH5SIZ29.js +0 -3116
  89. package/dist/index-sJ9Uc9UY.cjs +0 -206
  90. package/dist/page-viewer-k-g15j8B.cjs +0 -1
  91. package/dist/project-general-setting-1leAiCJQ.cjs +0 -1
  92. package/dist/project-seo-setting-kDBSOzgX.cjs +0 -1
  93. package/dist/single-page-detail-IFtVxwl5.cjs +0 -1
  94. package/dist/useCanvasSettings-Am2o80hW.cjs +0 -1
  95. package/dist/useCanvasSettings-ikt217kv.js +0 -6
@@ -1,31 +1,34 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import y, { createElement as D, useState as g, useCallback as O, useMemo as U, useEffect as V, Suspense as R } from "react";
3
- import { has as F, isFunction as W, first as h, omit as Y, noop as J, isEmpty as b, filter as v, values as k, groupBy as w, mergeWith as K, isArray as L, keys as Q, get as X, map as A, uniq as Z, includes as $, find as ee, reject as I } from "lodash-es";
2
+ import y, { createElement as O, useState as g, useCallback as q, useMemo as U, useEffect as V, Suspense as R } from "react";
3
+ import { has as F, isFunction as W, first as x, omit as J, noop as K, isEmpty as b, filter as k, values as v, groupBy as w, mergeWith as Y, isArray as L, keys as Q, get as X, map as A, uniq as Z, includes as $, find as ee, reject as I } from "lodash-es";
4
4
  import { useAtom as N } from "jotai";
5
5
  import { useTranslation as H } from "react-i18next";
6
- import { L as _, r as S, Y as se, at as P, ap as te, aq as re, ar as oe, h as T, a3 as G, aj as le, ak as ae, al as ie, am as ce, an as E, bo as ne, bp as de, bq as me, br as pe, aB as ue, bs as xe, bt as he, B as fe, bu as ge, bv as je, bw as be, au as ve, av as ke, aw as C, bi as ye, bb as Be, bc as Ne, bd as Ce, be as we, S as Ae } from "./index-hH5SIZ29.js";
6
+ import { m as _, L as S, z as se, ag as P, ac as te, ad as re, ae as oe, h as T, O as z, a6 as le, a7 as ae, a8 as ie, a9 as ce, aa as E, bg as ne, bh as de, bi as me, bj as pe, aq as ue, bk as he, bl as xe, B as fe, bm as ge, bn as je, bo as be, ai as ke, aj as ve, ak as C, ba as ye, b3 as Be, b4 as Ne, b5 as Ce, b6 as we, ah as Ae } from "./ChaiBuilderEditor-ChKigulx.js";
7
7
  import { BoxIcon as Te } from "@radix-ui/react-icons";
8
- import { syncBlocksWithDefaults as M, useChaiBlocks as q } from "@chaibuilder/runtime";
8
+ import { syncBlocksWithDefaults as G, useChaiBlocks as M } from "@chaibuilder/runtime";
9
9
  import { useFeature as _e } from "flagged";
10
10
  import { O as B } from "./STRINGS--j49GZJP.js";
11
11
  import { Loader as Se } from "lucide-react";
12
12
  import { g as Pe } from "./html-to-json-ZV4QjSww.js";
13
13
  import "./_commonjsHelpers-UyOWmZb0.js";
14
- import "./Functions-7jnEwJyw.js";
15
14
  import "clsx";
15
+ import "react-dom";
16
+ import "@radix-ui/react-scroll-area";
17
+ import "@floating-ui/react-dom";
18
+ import "i18next";
19
+ import "./Functions-7jnEwJyw.js";
16
20
  import "tailwind-merge";
17
21
  import "@react-hookz/web";
18
22
  import "./MODIFIERS-cBT31iqE.js";
19
- import "./Class-6Hz2KzYb.js";
20
23
  import "@radix-ui/react-toggle";
21
24
  import "class-variance-authority";
25
+ import "./Class-6Hz2KzYb.js";
22
26
  import "@radix-ui/react-switch";
23
27
  import "@radix-ui/react-slot";
24
28
  import "@radix-ui/react-accordion";
25
29
  import "@radix-ui/react-alert-dialog";
26
30
  import "@radix-ui/react-dialog";
27
31
  import "@radix-ui/react-label";
28
- import "@radix-ui/react-scroll-area";
29
32
  import "@radix-ui/react-tabs";
30
33
  import "@radix-ui/react-tooltip";
31
34
  import "@radix-ui/react-popover";
@@ -38,16 +41,17 @@ import "@radix-ui/react-toast";
38
41
  import "cmdk";
39
42
  import "@radix-ui/react-context-menu";
40
43
  import "react-icons-picker";
41
- import "react-dom";
42
44
  import "react-quill";
45
+ import "react-hotkeys-hook";
46
+ import "lodash";
43
47
  import "himalaya";
44
48
  const Le = ({ block: s }) => {
45
49
  const { type: r, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = _(), [n, t] = S(), [, p] = se(), [, m] = N(P), o = () => {
46
50
  if (F(s, "blocks")) {
47
51
  const u = W(s.blocks) ? s.blocks() : s.blocks;
48
- c(M(u), h(n));
52
+ c(G(u), x(n));
49
53
  } else
50
- d(s, h(n));
54
+ d(s, x(n));
51
55
  m(B);
52
56
  }, a = _e("dnd");
53
57
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(te, { children: [
@@ -57,14 +61,14 @@ const Le = ({ block: s }) => {
57
61
  onClick: o,
58
62
  type: "button",
59
63
  onDragStart: (u) => {
60
- u.dataTransfer.setData("text/plain", JSON.stringify(Y(s, ["component", "icon"]))), setTimeout(() => {
64
+ u.dataTransfer.setData("text/plain", JSON.stringify(J(s, ["component", "icon"]))), setTimeout(() => {
61
65
  t([]), p(null), m(B);
62
66
  }, 200);
63
67
  },
64
68
  draggable: a ? "true" : "false",
65
69
  className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
66
70
  children: [
67
- D(i || Te, { className: "w-4 h-4 mx-auto" }),
71
+ O(i || Te, { className: "w-4 h-4 mx-auto" }),
68
72
  /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: l || r })
69
73
  ]
70
74
  }
@@ -72,15 +76,15 @@ const Le = ({ block: s }) => {
72
76
  /* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
73
77
  ] }) });
74
78
  }, Ie = ({ block: s, closePopover: r }) => {
75
- const [i, l] = g(!1), d = T("getExternalPredefinedBlock", J()), { addCoreBlock: c, addPredefinedBlock: n } = _(), [t] = S(), p = O(
79
+ const [i, l] = g(!1), d = T("getExternalPredefinedBlock", K()), { addCoreBlock: c, addPredefinedBlock: n } = _(), [t] = S(), p = q(
76
80
  async (m) => {
77
81
  if (m.stopPropagation(), F(s, "component")) {
78
- c(s, h(t)), r();
82
+ c(s, x(t)), r();
79
83
  return;
80
84
  }
81
85
  l(!0);
82
86
  const o = await d(s);
83
- b(o) || n(M(o), h(t)), r();
87
+ b(o) || n(G(o), x(t)), r();
84
88
  },
85
89
  [s]
86
90
  );
@@ -108,10 +112,10 @@ const Le = ({ block: s }) => {
108
112
  }
109
113
  ) });
110
114
  }, Ee = () => {
111
- const { data: s } = G(), r = q(), i = v(k(r), { category: "custom" }), l = w(i, "group"), d = w(s, "group"), c = U(() => K(l, d, (o, a) => {
115
+ const { data: s } = z(), r = M(), i = k(v(r), { category: "custom" }), l = w(i, "group"), d = w(s, "group"), c = U(() => Y(l, d, (o, a) => {
112
116
  if (L(o) && L(a))
113
117
  return [...o, ...a];
114
- }), [l, d]), [n, t] = g(h(Q(c)) || ""), [, p] = N(P), m = X(c, n, []);
118
+ }), [l, d]), [n, t] = g(x(Q(c)) || ""), [, p] = N(P), m = X(c, n, []);
115
119
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
116
120
  /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(le, { value: n, onValueChange: (o) => t(o), children: [
117
121
  /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ie, { placeholder: "Select a provider" }) }),
@@ -129,14 +133,14 @@ const Le = ({ block: s }) => {
129
133
  }, Fe = () => {
130
134
  const { t: s } = H(), [r, i] = g(""), { addPredefinedBlock: l } = _(), [d] = S(), [, c] = N(P), n = () => {
131
135
  const t = Pe(r);
132
- l([...t], h(d) || null), i(""), c(B);
136
+ l([...t], x(d) || null), i(""), c(B);
133
137
  };
134
138
  return /* @__PURE__ */ e.jsxs(ne, { className: "border-border/0 p-0 shadow-none", children: [
135
139
  /* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
136
140
  /* @__PURE__ */ e.jsx(pe, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
137
141
  /* @__PURE__ */ e.jsx(ue, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
138
142
  /* @__PURE__ */ e.jsx(
139
- xe,
143
+ he,
140
144
  {
141
145
  autoFocus: !0,
142
146
  tabIndex: 1,
@@ -149,32 +153,32 @@ const Le = ({ block: s }) => {
149
153
  }
150
154
  )
151
155
  ] }) }),
152
- /* @__PURE__ */ e.jsxs(he, { className: "flex flex-col justify-end p-3", children: [
156
+ /* @__PURE__ */ e.jsxs(xe, { className: "flex flex-col justify-end p-3", children: [
153
157
  /* @__PURE__ */ e.jsx(fe, { disabled: r.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
154
158
  /* @__PURE__ */ e.jsx(ge, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(je, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
155
159
  ] })
156
160
  ] });
157
- }, Cs = () => {
158
- const { t: s } = H(), [r, i] = g("core"), [l, d] = g("basic"), c = q(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = G(), a = v(c, p), u = w(a, "category"), f = Z(A(u.core, "group"));
161
+ }, _s = () => {
162
+ const { t: s } = H(), [r, i] = g("core"), [l, d] = g("basic"), c = M(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = z(), a = k(c, p), u = w(a, "category"), f = Z(A(u.core, "group"));
159
163
  V(() => {
160
- !$(f, l) && !b(f) && !b(l) && d(h(f));
164
+ !$(f, l) && !b(f) && !b(l) && d(x(f));
161
165
  }, [f, l]);
162
- const j = !o && !b(m) || ee(k(a), { category: "custom" }) !== void 0;
166
+ const j = !o && !b(m) || ee(v(a), { category: "custom" }) !== void 0;
163
167
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
164
168
  /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
165
169
  /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
166
170
  /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(r === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
167
171
  ] }),
168
172
  /* @__PURE__ */ e.jsx(
169
- ve,
173
+ ke,
170
174
  {
171
- onValueChange: (x) => {
172
- n(""), i(x);
175
+ onValueChange: (h) => {
176
+ n(""), i(h);
173
177
  },
174
178
  value: r,
175
179
  className: "h-max",
176
180
  children: /* @__PURE__ */ e.jsxs(
177
- ke,
181
+ ve,
178
182
  {
179
183
  className: "grid w-full " + (j && t ? "grid-cols-3" : j && !t || !j && t ? "grid-cols-2" : "grid-cols-1"),
180
184
  children: [
@@ -189,10 +193,10 @@ const Le = ({ block: s }) => {
189
193
  r === "core" && /* @__PURE__ */ e.jsx(ye, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
190
194
  A(
191
195
  f,
192
- (x) => I(v(k(u.core), { group: x }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(Be, { type: "single", value: x, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(Ne, { value: x, children: [
193
- /* @__PURE__ */ e.jsx(Ce, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: x }),
196
+ (h) => I(k(v(u.core), { group: h }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(Be, { type: "single", value: h, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(Ne, { value: h, children: [
197
+ /* @__PURE__ */ e.jsx(Ce, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: h }),
194
198
  /* @__PURE__ */ e.jsx(we, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: y.Children.toArray(
195
- I(v(k(u.core), { group: x }), { hidden: !0 }).map((z) => /* @__PURE__ */ e.jsx(Le, { block: z }))
199
+ I(k(v(u.core), { group: h }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(Le, { block: D }))
196
200
  ) }) })
197
201
  ] }) }) : null
198
202
  )
@@ -202,5 +206,5 @@ const Le = ({ block: s }) => {
202
206
  ] });
203
207
  };
204
208
  export {
205
- Cs as default
209
+ _s as default
206
210
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),t=require("lodash-es"),y=require("jotai"),v=require("react-i18next"),s=require("./ChaiBuilderEditor-pWAMhLiq.cjs"),q=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),B=require("flagged"),R=require("./STRINGS-gPz7CUOk.cjs"),N=require("lucide-react"),C=require("./html-to-json-Xhu27KFD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("himalaya");const T=({block:r})=>{const{type:i,icon:u,label:c}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,j]=s.useHighlightBlockId(),[,p]=y.useAtom(s.activePanelAtom),l=()=>{if(t.has(r,"blocks")){const h=t.isFunction(r.blocks)?r.blocks():r.blocks;d(b.syncBlocksWithDefaults(h),t.first(x))}else m(r,t.first(x));p(R.OUTLINE_KEY)},a=B.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),j(null),p(R.OUTLINE_KEY)},200)},draggable:a?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(a?"cursor-grab":"cursor-pointer"),children:[n.createElement(u||q.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:c||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||i})})]})})},A=({block:r,closePopover:i})=>{const[u,c]=n.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:d,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),j=n.useCallback(async p=>{if(p.stopPropagation(),t.has(r,"component")){d(r,t.first(o)),i();return}c(!0);const l=await m(r);t.isEmpty(l)||x(b.syncBlocksWithDefaults(l),t.first(o)),i()},[r]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:u?()=>{}:j,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[u&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})})},w=()=>{const{data:r}=s.useUILibraryBlocks(),i=b.useChaiBlocks(),u=t.filter(t.values(i),{category:"custom"}),c=t.groupBy(u,"group"),m=t.groupBy(r,"group"),d=n.useMemo(()=>t.mergeWith(c,m,(l,a)=>{if(t.isArray(l)&&t.isArray(a))return[...l,...a]}),[c,m]),[x,o]=n.useState(t.first(t.keys(d))||""),[,j]=y.useAtom(s.activePanelAtom),p=t.get(d,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),n.Children.toArray(t.map(d,(l,a)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:a,children:a},a)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:n.Children.toArray(p.map(l=>e.jsxRuntimeExports.jsx(A,{block:l,closePopover:()=>j(R.OUTLINE_KEY)})))})]})},S=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=y.useAtom(s.activePanelAtom),x=()=>{const o=C.getBlocksFromHTML(i);c([...o],t.first(m)||null),u(""),d(R.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>u(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},_=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState("core"),[c,m]=n.useState("basic"),d=b.useChaiBlocks(),[,x]=y.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),j=s.useBuilderProp("filterChaiBlock",()=>!0),{data:p,isLoading:l}=s.useUILibraryBlocks(),a=t.filter(d,j),h=t.groupBy(a,"category"),g=t.uniq(t.map(h.core,"group"));n.useEffect(()=>{!t.includes(g,c)&&!t.isEmpty(g)&&!t.isEmpty(c)&&m(t.first(g))},[g,c]);const E=!l&&!t.isEmpty(p)||t.find(t.values(a),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:f=>{x(""),u(f)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(E&&o?"grid-cols-3":E&&!o||!E&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),E?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:n.Children.toArray(t.map(g,f=>t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:f,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:f,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:f}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).map(k=>e.jsxRuntimeExports.jsx(T,{block:k})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(w,{})}),i==="html"&&o?e.jsxRuntimeExports.jsx(S,{}):null]})};exports.default=_;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./ChaiBuilderEditor-pWAMhLiq.cjs"),r=require("./controls-jWJDao88.cjs"),f=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const q=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=f.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},x=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",f.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=q.useRef(e);q.useEffect(()=>()=>{f.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:m,primaryColor:b,bodyTextDarkColor:y,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.y({title:"Heading font",default:m,options:x}),bodyFont:r.y({title:"Body font",default:u,options:x}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.f({title:"Primary",default:b}),secondaryColor:r.f({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.f({title:"Body Background (Light Mode)",default:O}),bodyTextLightColor:r.f({title:"Body Text (Light Mode)",default:y}),bodyBgDarkColor:r.f({title:"Body Background (Dark mode)",default:S}),bodyTextDarkColor:r.f({title:"Body Text (Dark mode)",default:h})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
@@ -2,22 +2,27 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import * as c from "react";
3
3
  import N from "@rjsf/validator-ajv8";
4
4
  import j from "@rjsf/core";
5
- import { h as k, F as D, bD as w } from "./index-hH5SIZ29.js";
6
- import { s as f, c as P, f as a } from "./controls-OfJWSEqC.js";
5
+ import { h as k, F as w, bv as D } from "./ChaiBuilderEditor-ChKigulx.js";
6
+ import { y as f, c as P, f as i } from "./controls-VTdJhdSz.js";
7
7
  import { debounce as R, noop as F, isEqual as L } from "lodash-es";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
9
- import "./Functions-7jnEwJyw.js";
10
9
  import "clsx";
11
- import "tailwind-merge";
12
- import "@chaibuilder/runtime";
10
+ import "react-dom";
11
+ import "@radix-ui/react-scroll-area";
12
+ import "@floating-ui/react-dom";
13
13
  import "jotai";
14
+ import "i18next";
15
+ import "react-i18next";
16
+ import "flagged";
14
17
  import "./STRINGS--j49GZJP.js";
18
+ import "./Functions-7jnEwJyw.js";
19
+ import "tailwind-merge";
20
+ import "@chaibuilder/runtime";
15
21
  import "@react-hookz/web";
16
22
  import "./MODIFIERS-cBT31iqE.js";
17
- import "./Class-6Hz2KzYb.js";
18
- import "react-i18next";
19
23
  import "@radix-ui/react-toggle";
20
24
  import "class-variance-authority";
25
+ import "./Class-6Hz2KzYb.js";
21
26
  import "@radix-ui/react-switch";
22
27
  import "@radix-ui/react-slot";
23
28
  import "@radix-ui/react-accordion";
@@ -25,7 +30,6 @@ import "@radix-ui/react-icons";
25
30
  import "@radix-ui/react-alert-dialog";
26
31
  import "@radix-ui/react-dialog";
27
32
  import "@radix-ui/react-label";
28
- import "@radix-ui/react-scroll-area";
29
33
  import "@radix-ui/react-tabs";
30
34
  import "@radix-ui/react-tooltip";
31
35
  import "@radix-ui/react-popover";
@@ -38,18 +42,20 @@ import "@radix-ui/react-toast";
38
42
  import "cmdk";
39
43
  import "@radix-ui/react-context-menu";
40
44
  import "react-icons-picker";
41
- import "react-dom";
42
45
  import "react-quill";
43
- const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
44
- const i = R(e, 200), m = (l) => i(l.target.value);
46
+ import "react-hotkeys-hook";
47
+ import "lodash";
48
+ import "lucide-react";
49
+ const M = ({ value: u, onChange: e, id: p, onBlur: m }) => {
50
+ const a = R(e, 200), d = (l) => a(l.target.value);
45
51
  return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
46
52
  "input",
47
53
  {
48
54
  type: "color",
49
55
  className: "text-xs p-0",
50
56
  value: u,
51
- onBlur: ({ target: { value: l } }) => d(p, l),
52
- onChange: m
57
+ onBlur: ({ target: { value: l } }) => m(p, l),
58
+ onChange: d
53
59
  }
54
60
  ) }) });
55
61
  }, g = [
@@ -102,19 +108,19 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
102
108
  { title: "Lustria", value: "Lustria" },
103
109
  { title: "Ovo", value: "Ovo" },
104
110
  { title: "Suranna", value: "Suranna" }
105
- ], St = () => {
106
- const u = k("onSaveBrandingOptions", F), [e, p] = D(), [d] = w(), i = c.useRef(e);
111
+ ], wt = () => {
112
+ const u = k("onSaveBrandingOptions", F), [e, p] = w(), [m] = D(), a = c.useRef(e);
107
113
  c.useEffect(() => () => {
108
- L(e, i.current) || u(i.current);
114
+ L(e, a.current) || u(a.current);
109
115
  }, []);
110
- const m = ({ formData: o }, s) => {
111
- s && (p(o), i.current = o);
116
+ const d = ({ formData: o }, s) => {
117
+ s && (p(o), a.current = o);
112
118
  }, {
113
119
  bodyFont: l,
114
120
  headingFont: h,
115
121
  primaryColor: x,
116
- bodyTextDarkColor: b,
117
- bodyTextLightColor: y,
122
+ bodyTextDarkColor: y,
123
+ bodyTextLightColor: b,
118
124
  bodyBgDarkColor: C,
119
125
  secondaryColor: S,
120
126
  bodyBgLightColor: B,
@@ -135,26 +141,26 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
135
141
  title: "Rounded Corner",
136
142
  default: parseInt(O || 5, 10)
137
143
  }),
138
- primaryColor: a({ title: "Primary", default: x }),
139
- secondaryColor: a({ title: "Secondary", default: S })
144
+ primaryColor: i({ title: "Primary", default: x }),
145
+ secondaryColor: i({ title: "Secondary", default: S })
140
146
  };
141
- d || (r = {
147
+ m || (r = {
142
148
  ...r,
143
- bodyBgLightColor: a({
149
+ bodyBgLightColor: i({
144
150
  title: "Body Background (Light Mode)",
145
151
  default: B
146
152
  }),
147
- bodyTextLightColor: a({
153
+ bodyTextLightColor: i({
148
154
  title: "Body Text (Light Mode)",
149
- default: b
155
+ default: y
150
156
  }),
151
- bodyBgDarkColor: a({
157
+ bodyBgDarkColor: i({
152
158
  title: "Body Background (Dark mode)",
153
159
  default: C
154
160
  }),
155
- bodyTextDarkColor: a({
161
+ bodyTextDarkColor: i({
156
162
  title: "Body Text (Dark mode)",
157
- default: y
163
+ default: b
158
164
  })
159
165
  });
160
166
  const n = {
@@ -179,11 +185,11 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
179
185
  schema: n,
180
186
  formData: e,
181
187
  validator: N,
182
- onChange: m
188
+ onChange: d
183
189
  }
184
190
  ) })
185
191
  ] });
186
192
  };
187
193
  export {
188
- St as default
194
+ wt as default
189
195
  };