@chaibuilder/sdk 0.1.3 → 0.1.5

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 (81) hide show
  1. package/dist/{AddBlocks-c195f577.js → AddBlocks-5d928d58.js} +20 -19
  2. package/dist/AddBlocks-df0ea47a.cjs +3 -0
  3. package/dist/BrandingOptions-b76762a4.cjs +1 -0
  4. package/dist/{BrandingOptions-766c19c6.js → BrandingOptions-bf7e6a38.js} +11 -9
  5. package/dist/{CanvasArea-25800a3e.js → CanvasArea-688987d1.js} +226 -224
  6. package/dist/{CanvasArea-e855c4a2.cjs → CanvasArea-9287e1bd.cjs} +2 -2
  7. package/dist/{Class-e34b2337.js → Class-1fb4c0c4.js} +110 -169
  8. package/dist/Class-6c695ccb.cjs +1 -0
  9. package/dist/Layers-11b26a20.cjs +1 -0
  10. package/dist/{Layers-f7e792f6.js → Layers-c053dfb8.js} +12 -10
  11. package/dist/MODIFIERS-70fef873.cjs +1 -0
  12. package/dist/MODIFIERS-c2e02614.js +67 -0
  13. package/dist/{MarkAsGlobalBlock-6bac1842.js → MarkAsGlobalBlock-111d739d.js} +10 -8
  14. package/dist/MarkAsGlobalBlock-4c85ba27.cjs +1 -0
  15. package/dist/{PagesPanel-0827c264.js → PagesPanel-48d0f29b.js} +12 -10
  16. package/dist/PagesPanel-97dbe8c3.cjs +1 -0
  17. package/dist/ProjectPanel-24543eac.cjs +1 -0
  18. package/dist/{ProjectPanel-e577029a.js → ProjectPanel-e19b9778.js} +10 -11
  19. package/dist/Settings-0358ce2f.cjs +1 -0
  20. package/dist/{Settings-b214f859.js → Settings-f4118350.js} +7 -5
  21. package/dist/{SidePanels-03fa10e8.js → SidePanels-73e79a7d.js} +8 -6
  22. package/dist/SidePanels-e48c2ba6.cjs +1 -0
  23. package/dist/Topbar-26d18e9d.cjs +1 -0
  24. package/dist/{Topbar-9bc8c9cf.js → Topbar-5574394f.js} +7 -5
  25. package/dist/add-page-modal-61d5bad7.js +93 -0
  26. package/dist/add-page-modal-6a60b790.cjs +1 -0
  27. package/dist/core.cjs +1 -1
  28. package/dist/core.d.ts +13 -11
  29. package/dist/core.js +63 -61
  30. package/dist/{delete-page-modal-def9012d.js → delete-page-modal-62641e4c.js} +10 -9
  31. package/dist/delete-page-modal-ecdd890a.cjs +1 -0
  32. package/dist/html-to-json-01cc5fe0.cjs +1 -0
  33. package/dist/{html-to-json-9304dbda.js → html-to-json-d20aafdd.js} +2 -2
  34. package/dist/index-89fce4e7.cjs +2 -0
  35. package/dist/index-de0f72ce.js +4911 -0
  36. package/dist/lib.cjs +1 -1
  37. package/dist/lib.js +4 -4
  38. package/dist/{page-viewer-41cbb548.js → page-viewer-14a69dba.js} +21 -18
  39. package/dist/page-viewer-e8469cfa.cjs +1 -0
  40. package/dist/{project-general-setting-2c8bed74.cjs → project-general-setting-decde8d1.cjs} +1 -1
  41. package/dist/{project-general-setting-0262fe62.js → project-general-setting-f7cfce70.js} +7 -5
  42. package/dist/render.cjs +2 -2
  43. package/dist/render.d.ts +9 -3
  44. package/dist/render.js +154 -134
  45. package/dist/server.cjs +1 -0
  46. package/dist/server.d.ts +142 -0
  47. package/dist/server.js +126 -0
  48. package/dist/{single-page-detail-924d57fc.js → single-page-detail-16682af2.js} +45 -43
  49. package/dist/single-page-detail-60edc711.cjs +1 -0
  50. package/dist/style.css +1 -1
  51. package/dist/useChangePage-5a62d7fc.cjs +1 -0
  52. package/dist/useChangePage-6b957e49.js +12 -0
  53. package/dist/usePageActions-32ea32a5.cjs +1 -0
  54. package/dist/usePageActions-37599b0c.js +38 -0
  55. package/package.json +7 -1
  56. package/dist/AddBlocks-0916e841.cjs +0 -3
  57. package/dist/BrandingOptions-742992b6.cjs +0 -1
  58. package/dist/CONTROLS-031e1de3.cjs +0 -1
  59. package/dist/CONTROLS-442caee5.js +0 -6
  60. package/dist/Class-7d6aadbc.cjs +0 -1
  61. package/dist/Layers-a2169d0b.cjs +0 -1
  62. package/dist/MarkAsGlobalBlock-6187e6fd.cjs +0 -1
  63. package/dist/PagesPanel-5698953d.cjs +0 -1
  64. package/dist/ProjectPanel-a3cb7396.cjs +0 -1
  65. package/dist/Settings-bee21026.cjs +0 -1
  66. package/dist/SidePanels-934159a4.cjs +0 -1
  67. package/dist/Topbar-c083cc2a.cjs +0 -1
  68. package/dist/add-page-modal-63858244.js +0 -92
  69. package/dist/add-page-modal-cb367c9d.cjs +0 -1
  70. package/dist/delete-page-modal-1e3914e3.cjs +0 -1
  71. package/dist/html-to-json-9c9961da.cjs +0 -1
  72. package/dist/index-207f2cbf.cjs +0 -2
  73. package/dist/index-390f7bef.js +0 -4749
  74. package/dist/index-824a7bd0.js +0 -188
  75. package/dist/index-ebd86d7f.cjs +0 -2
  76. package/dist/page-viewer-83ce2c70.cjs +0 -1
  77. package/dist/single-page-detail-cfeae896.cjs +0 -1
  78. package/dist/usePageActions-3bed2330.cjs +0 -1
  79. package/dist/usePageActions-f86f6f65.js +0 -36
  80. package/dist/useProjectActions-1de05f63.js +0 -17
  81. package/dist/useProjectActions-5092ed79.cjs +0 -1
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import B, { createElement as G, useState as j, useMemo as K, useCallback as V, useEffect as q, Suspense as W } from "react";
3
- import { has as S, first as b, filter as w, values as A, groupBy as I, mergeWith as Q, isArray as H, get as $, map as L, isEmpty as k, find as J, uniq as X, includes as P, reject as M } from "lodash";
2
+ import B, { createElement as G, useState as j, useMemo as K, useCallback as V, useEffect as W, Suspense as q } from "react";
3
+ import { has as S, first as b, filter as w, values as A, groupBy as I, mergeWith as $, isArray as H, get as J, map as L, isEmpty as k, find as Q, uniq as X, includes as P, reject as M } from "lodash";
4
4
  import { useAtom as h } from "jotai";
5
5
  import { A as Y, a as Z, b as ee, c as se } from "./accordion-c0176dc5.js";
6
6
  import { S as re } from "./scroll-area-9f64a082.js";
@@ -8,14 +8,14 @@ import { T as oe, a as te, b as N } from "./tabs-85caa1e8.js";
8
8
  import { d as le, e as ae, f as ce, u as ne, B as ie, S as de } from "./useBuilderProp-81a14920.js";
9
9
  import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
10
10
  import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
11
- import { Q as F, h as T, a as O, b as C, T as U, U as xe, V as he, y as fe } from "./index-390f7bef.js";
11
+ import { R as F, h as C, a as O, b as T, U, V as xe, W as he, y as fe } from "./index-de0f72ce.js";
12
12
  import "react-i18next";
13
13
  import { syncBlocksWithDefaults as z, useChaiBlocks as D } from "@chaibuilder/blocks";
14
14
  import { Loader as ge } from "lucide-react";
15
15
  import { c as be } from "./utils-ac68b2c8.js";
16
- import { C as je, c as ye, e as we, f as ke, g as Be, T as Te, d as Ce, A as ve, a as Ne } from "./textarea-0750bcd2.js";
16
+ import { C as je, c as ye, e as we, f as ke, g as Be, T as Ce, d as Te, A as ve, a as Ne } from "./textarea-0750bcd2.js";
17
17
  import { L as Ae } from "./label-e770a087.js";
18
- import { g as Ie } from "./html-to-json-9304dbda.js";
18
+ import { g as Ie } from "./html-to-json-d20aafdd.js";
19
19
  import "@radix-ui/react-accordion";
20
20
  import "@radix-ui/react-scroll-area";
21
21
  import "@radix-ui/react-tabs";
@@ -28,16 +28,17 @@ import "flagged";
28
28
  import "@minoru/react-dnd-treeview";
29
29
  import "react-hotkeys-hook";
30
30
  import "flat-to-nested";
31
- import "./Class-e34b2337.js";
31
+ import "./Class-1fb4c0c4.js";
32
+ import "./MODIFIERS-c2e02614.js";
32
33
  import "redux-undo";
33
34
  import "@react-hookz/web";
34
- import "./CONTROLS-442caee5.js";
35
+ import "sonner";
35
36
  import "clsx";
36
37
  import "tailwind-merge";
37
38
  import "@radix-ui/react-label";
38
39
  import "himalaya";
39
40
  const Le = ({ block: s }) => {
40
- const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] = T(), [, n] = h(O), [, t] = h(C), f = () => {
41
+ const { type: r, icon: o, label: a } = s, { addCoreBlock: i, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(O), [, t] = h(T), f = () => {
41
42
  S(s, "blocks") ? d(z(s.blocks), b(m)) : i(s, b(m)), t(!1), n("layers");
42
43
  }, [, x, u] = R(() => ({
43
44
  type: "CHAI_BLOCK",
@@ -70,7 +71,7 @@ const Le = ({ block: s }) => {
70
71
  ] });
71
72
  }, Pe = ({ block: s, closePopover: r }) => {
72
73
  var u;
73
- const [o, a] = j(!1), i = ne("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = T(), [, t, f] = R(
74
+ const [o, a] = j(!1), i = ne("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, t, f] = R(
74
75
  () => ({
75
76
  type: "CHAI_BLOCK",
76
77
  item: s
@@ -115,10 +116,10 @@ const Le = ({ block: s }) => {
115
116
  )
116
117
  ] });
117
118
  }, Fe = () => {
118
- const { data: s, isLoading: r } = U(), o = D(), a = w(A(o), { category: "custom" }), i = I(a, "group"), d = I(s, "group"), [m, n] = j(null), t = K(() => Q(i, d, (l, p) => {
119
+ const { data: s, isLoading: r } = U(), o = D(), a = w(A(o), { category: "custom" }), i = I(a, "group"), d = I(s, "group"), [m, n] = j(null), t = K(() => $(i, d, (l, p) => {
119
120
  if (H(l) && H(p))
120
121
  return [...l, ...p];
121
- }), [i, d]), [, f] = h(C), [x, u] = j("Navbar"), g = $(t, x, []);
122
+ }), [i, d]), [, f] = h(T), [x, u] = j("Navbar"), g = J(t, x, []);
122
123
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
123
124
  /* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
124
125
  /* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
@@ -154,7 +155,7 @@ const Le = ({ block: s }) => {
154
155
  ) })
155
156
  ] });
156
157
  }, He = () => {
157
- const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = T(), [, i] = h(xe), [, d] = h(O), [, m] = h(C), n = () => {
158
+ const [s, r] = j(""), { addPredefinedBlock: o } = F(), [a] = C(), [, i] = h(xe), [, d] = h(O), [, m] = h(T), n = () => {
158
159
  const t = Ie(s);
159
160
  o([...t], b(a) || null), r(""), i(!1), d("layers"), m(!1);
160
161
  };
@@ -166,7 +167,7 @@ const Le = ({ block: s }) => {
166
167
  /* @__PURE__ */ e.jsx(Be, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
167
168
  /* @__PURE__ */ e.jsx(Ae, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
168
169
  /* @__PURE__ */ e.jsx(
169
- Te,
170
+ Ce,
170
171
  {
171
172
  autoFocus: !0,
172
173
  tabIndex: 1,
@@ -181,7 +182,7 @@ const Le = ({ block: s }) => {
181
182
  }
182
183
  )
183
184
  ] }) }),
184
- /* @__PURE__ */ e.jsxs(Ce, { className: "flex flex-col justify-end p-3", children: [
185
+ /* @__PURE__ */ e.jsxs(Te, { className: "flex flex-col justify-end p-3", children: [
185
186
  /* @__PURE__ */ e.jsx(ie, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
186
187
  /* @__PURE__ */ e.jsxs(ve, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
187
188
  /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4" }),
@@ -194,12 +195,12 @@ const Le = ({ block: s }) => {
194
195
  return !P(E, r);
195
196
  const o = s._type;
196
197
  return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(E, r);
197
- }, ys = () => {
198
- const [s, r] = j("core"), [o, a] = j("basic"), i = D(), [, d] = h(he), [, m] = h(C), [n] = T(), t = fe(), f = J(t, { _id: b(n) }), { data: x, isLoading: u } = U(), g = I(
198
+ }, ws = () => {
199
+ const [s, r] = j("core"), [o, a] = j("basic"), i = D(), [, d] = h(he), [, m] = h(T), [n] = C(), t = fe(), f = Q(t, { _id: b(n) }), { data: x, isLoading: u } = U(), g = I(
199
200
  w(i, (c) => Ee(f, c.type)),
200
201
  "category"
201
202
  ), l = X(L(g.core, "group"));
202
- q(() => {
203
+ W(() => {
203
204
  !P(l, o) && !k(l) && !k(o) && a(b(l));
204
205
  }, [l, o]);
205
206
  const p = (c) => a((v) => v === c ? "" : c), y = !u && !k(x);
@@ -249,10 +250,10 @@ const Le = ({ block: s }) => {
249
250
  ] }) : null
250
251
  )
251
252
  ) }) }),
252
- s === "ui-blocks" && /* @__PURE__ */ e.jsx(W, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
253
+ s === "ui-blocks" && /* @__PURE__ */ e.jsx(q, { fallback: /* @__PURE__ */ e.jsx(de, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
253
254
  s === "html" && /* @__PURE__ */ e.jsx(Me, {})
254
255
  ] });
255
256
  };
256
257
  export {
257
- ys as default
258
+ ws as default
258
259
  };
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-088530b9.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-89fce4e7.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),I=require("lucide-react"),L=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),P=require("./label-167415e5.cjs"),S=require("./html-to-json-01cc5fe0.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-6c695ccb.cjs");require("./MODIFIERS-70fef873.cjs");require("redux-undo");require("@react-hookz/web");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const M=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:x,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,u]=b.useAtom(l.activePanelAtom),[,i]=b.useAtom(l.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):x(t,s.first(p)),i(!1),u("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},F=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),x=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[u]=l.useSelectedBlockIds(),[,i,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=n.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(u)),r();return}c(!0);const a=await x(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(u)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:g,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(I.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-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},H=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),x=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,u]=n.useState(null),i=n.useMemo(()=>s.mergeWith(x,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[x,m]),[,E]=b.useAtom(l.addBlocksModalAtom),[g,j]=n.useState("Navbar"),R=s.get(i,g,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),u(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);u(B)},onClick:()=>j(h),className:L.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(R.map(a=>e.jsxRuntimeExports.jsx(F,{block:a,closePopover:()=>E(!1)})))})]})},D=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,x]=b.useAtom(l.addBlockOffCanvasAtom),[,m]=b.useAtom(l.activePanelAtom),[,p]=b.useAtom(l.addBlocksModalAtom),u=()=>{const i=S.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),x(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(P.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
2
+ <h1>Enter code here</h1>
3
+ </div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>u(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},O=D,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],U=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},z=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),x=T.useChaiBlocks(),[,m]=b.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(l.addBlocksModalAtom),[u]=l.useSelectedBlockIds(),i=l.useAllBlocks(),E=s.find(i,{_id:s.first(u)}),{data:g,isLoading:j}=l.useUILibraryBlocks(),R=s.groupBy(s.filter(x,d=>U(E,d.type)),"category"),a=s.uniq(s.map(R.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(g);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(q.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(M,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(H,{})}),t==="html"&&e.jsxRuntimeExports.jsx(O,{})]})};exports.default=z;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-89fce4e7.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-6c695ccb.cjs");require("./MODIFIERS-70fef873.cjs");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function P(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const c=P(O),v=[{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"}],k=()=>{const t=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[r,i]=j.useBrandingOptions(),a=c.useRef(r);c.useEffect(()=>()=>t(a.current),[a]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:b,primaryColor:f,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:x,secondaryColor:S,bodyBgLightColor:h,roundedCorners:q}=r,s={headingFont:e.SelectOption({title:"Heading font",default:b,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(q||5,10)}),primaryColor:e.Color({title:"Primary",default:f}),secondaryColor:e.Color({title:"Secondary",default:S}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:h}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:x}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:r,validator:C,onChange:p})})]})};exports.default=k;
@@ -2,7 +2,7 @@ import { j as a } from "./jsx-runtime-944c88e2.js";
2
2
  import * as s from "react";
3
3
  import B from "@rjsf/validator-ajv8";
4
4
  import k from "@rjsf/core";
5
- import { w as N } from "./index-390f7bef.js";
5
+ import { w as N } from "./index-de0f72ce.js";
6
6
  import "react-i18next";
7
7
  import { u as D } from "./useBuilderProp-81a14920.js";
8
8
  import { SelectOption as p, Numeric as P, Color as e } from "@chaibuilder/blocks";
@@ -17,11 +17,13 @@ import "clsx";
17
17
  import "tailwind-merge";
18
18
  import "react-hotkeys-hook";
19
19
  import "flat-to-nested";
20
- import "./Class-e34b2337.js";
20
+ import "./Class-1fb4c0c4.js";
21
+ import "./MODIFIERS-c2e02614.js";
21
22
  import "redux-undo";
22
23
  import "@react-hookz/web";
23
24
  import "@radix-ui/react-icons";
24
- import "./CONTROLS-442caee5.js";
25
+ import "lucide-react";
26
+ import "sonner";
25
27
  import "@radix-ui/react-slot";
26
28
  import "class-variance-authority";
27
29
  import "@radix-ui/react-tooltip";
@@ -76,12 +78,12 @@ const d = [
76
78
  { title: "Lustria", value: "Lustria" },
77
79
  { title: "Ovo", value: "Ovo" },
78
80
  { title: "Suranna", value: "Suranna" }
79
- ], at = () => {
80
- const v = D("onSaveBrandingOptions", async () => {
81
- }), [l, m] = N(), r = s.useRef(l);
82
- s.useEffect(() => () => v(r.current), [r]);
81
+ ], it = () => {
82
+ const m = D("onSaveBrandingOptions", async () => {
83
+ }), [l, v] = N(), r = s.useRef(l);
84
+ s.useEffect(() => () => m(r.current), [r]);
83
85
  const c = ({ formData: t }, i) => {
84
- i && (m(t), r.current = t);
86
+ i && (v(t), r.current = t);
85
87
  }, {
86
88
  bodyFont: f,
87
89
  headingFont: g,
@@ -153,5 +155,5 @@ const d = [
153
155
  ] });
154
156
  };
155
157
  export {
156
- at as default
158
+ it as default
157
159
  };