@chaibuilder/sdk 1.2.80 → 1.2.81

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.
@@ -3579,7 +3579,7 @@ const useAllDataProviders = () => useMemo$1(() => getChaiDataProviders(), []), B
3579
3579
  }, StaticCanvas$1 = StaticCanvas, FallbackError = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
3580
3580
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
3581
3581
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please try again." })
3582
- ] }) }), CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-LsV5mq7M.js")), CanvasArea = () => {
3582
+ ] }) }), CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-u-gDiPZ2.js")), CanvasArea = () => {
3583
3583
  const [r] = useCodeEditor(), n = useBuilderProp("onError", noop$1);
3584
3584
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3585
3585
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -4976,7 +4976,7 @@ const ViewData = ({ data: r, fullView: n }) => {
4976
4976
  }
4977
4977
  )
4978
4978
  ] });
4979
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-_A9idjFx.js")), UploadImages = React__default.lazy(() => import("./UploadImages-cFKKLJaD.js")), ImagesPanel = ({
4979
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-gys3oUzE.js")), UploadImages = React__default.lazy(() => import("./UploadImages-EQnGq0Zj.js")), ImagesPanel = ({
4980
4980
  isModalView: r = !1,
4981
4981
  onSelect: n = () => {
4982
4982
  }
@@ -7354,21 +7354,24 @@ const CoreBlock = ({ block: r, disabled: n, parentId: o }) => {
7354
7354
  ) }),
7355
7355
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: b(c || i) }) })
7356
7356
  ] }) });
7357
- }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: r, blocks: n, parentId: o }) => {
7358
- var c;
7359
- const { t: a } = useTranslation(), [i] = useBlocksStore(), l = (c = find(i, (u) => u._id === o)) == null ? void 0 : c._type;
7357
+ }, DefaultChaiBlocks = ({ parentId: r, gridCols: n = "grid-cols-2" }) => {
7358
+ const o = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), i = filter(o, a), l = groupBy(i, "category"), c = uniq(map(l.core, "group"));
7359
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: r, groups: c, blocks: l.core });
7360
+ }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: r, blocks: n, parentId: o, gridCols: a = "grid-cols-4" }) => {
7361
+ var u;
7362
+ const { t: i } = useTranslation(), [l] = useBlocksStore(), c = (u = find(l, (d) => d._id === o)) == null ? void 0 : u._type;
7360
7363
  return React__default.Children.toArray(
7361
7364
  map(
7362
- sortBy(r, (u) => CORE_GROUPS.indexOf(u) === -1 ? 99 : CORE_GROUPS.indexOf(u)),
7363
- (u) => reject(filter(values(n), { group: u }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: u, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: u, children: [
7364
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize hover:no-underline", children: capitalize(a(u.toLowerCase())) }),
7365
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: React__default.Children.toArray(
7366
- reject(filter(values(n), { group: u }), { hidden: !0 }).map((d) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7365
+ sortBy(r, (d) => CORE_GROUPS.indexOf(d) === -1 ? 99 : CORE_GROUPS.indexOf(d)),
7366
+ (d) => reject(filter(values(n), { group: d }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: d, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: d, children: [
7367
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize hover:no-underline", children: capitalize(i(d.toLowerCase())) }),
7368
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-2 " + a, children: React__default.Children.toArray(
7369
+ reject(filter(values(n), { group: d }), { hidden: !0 }).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7367
7370
  CoreBlock,
7368
7371
  {
7369
7372
  parentId: o,
7370
- block: d,
7371
- disabled: !canAcceptChildBlock(l, d.type) || !canBeNestedInside(l, d.type)
7373
+ block: p,
7374
+ disabled: !canAcceptChildBlock(c, p.type) || !canBeNestedInside(c, p.type)
7372
7375
  }
7373
7376
  ))
7374
7377
  ) }) })
@@ -7380,10 +7383,8 @@ const CoreBlock = ({ block: r, disabled: n, parentId: o }) => {
7380
7383
  showHeading: n = !0,
7381
7384
  parentId: o = void 0
7382
7385
  }) => {
7383
- const { t: a } = useTranslation(), [i, l] = useState$1("library"), [c, u] = useState$1("basic"), d = useChaiBlocks(), [, p] = useAtom$1(showPredefinedBlockCategoryAtom), m = useBuilderProp("importHTMLSupport", !0), g = useBuilderProp("filterChaiBlock", () => !0), h = filter(d, g), b = groupBy(h, "category"), x = uniq(map(b.core, "group"));
7384
- return useEffect$1(() => {
7385
- !includes(x, c) && !isEmpty(x) && !isEmpty(c) && u(first(x));
7386
- }, [x, c]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full flex-col overflow-hidden", r), children: [
7386
+ const { t: a } = useTranslation(), [i, l] = useState$1("library"), [, c] = useAtom$1(showPredefinedBlockCategoryAtom), u = useBuilderProp("importHTMLSupport", !0);
7387
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full flex-col overflow-hidden", r), children: [
7387
7388
  n ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
7388
7389
  /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: a("add_block") }),
7389
7390
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: a(i === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
@@ -7391,21 +7392,21 @@ const CoreBlock = ({ block: r, disabled: n, parentId: o }) => {
7391
7392
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7392
7393
  Tabs$1,
7393
7394
  {
7394
- onValueChange: (v) => {
7395
- p(""), l(v);
7395
+ onValueChange: (d) => {
7396
+ c(""), l(d);
7396
7397
  },
7397
7398
  value: i,
7398
- className: cn("h-max", m ? "" : "hidden"),
7399
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList$1, { className: "grid w-full " + (m ? "grid-cols-3" : "grid-cols-1"), children: [
7399
+ className: cn("h-max", u ? "" : "hidden"),
7400
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList$1, { className: "grid w-full " + (u ? "grid-cols-3" : "grid-cols-1"), children: [
7400
7401
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: a("library") }),
7401
7402
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: a("blocks") }),
7402
- m ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("import") }) : null
7403
+ u ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("import") }) : null
7403
7404
  ] })
7404
7405
  }
7405
7406
  ),
7406
- i === "core" && /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea$1, { className: "-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { parentId: o, groups: x, blocks: b.core }) }) }),
7407
+ i === "core" && /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea$1, { className: "-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: o }) }) }),
7407
7408
  i === "library" && /* @__PURE__ */ jsxRuntimeExports.jsx(UILibraries, { parentId: o }),
7408
- i === "html" && m ? /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML$1, { parentId: o }) : null
7409
+ i === "html" && u ? /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML$1, { parentId: o }) : null
7409
7410
  ] });
7410
7411
  }, AddBlocksPanel$1 = AddBlocksPanel;
7411
7412
  function FaCheck(r) {
@@ -33915,7 +33916,7 @@ const TabletIcon = ({ landscape: r = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
33915
33916
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
33916
33917
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
33917
33918
  ] }) });
33918
- }, SettingsPanel$1 = SettingsPanel, TopBar = lazy(() => import("./Topbar-CY8ipE2A.js")), menuItems = [
33919
+ }, SettingsPanel$1 = SettingsPanel, TopBar = lazy(() => import("./Topbar-qT5SdMRK.js")), menuItems = [
33919
33920
  { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { size: 20 }), label: "sidebar.outline", component: Outline$1 },
33920
33921
  { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: 16 }), label: "sidebar.edit_block", component: SettingsPanel$1 },
33921
33922
  { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "size-5" }), label: "sidebar.ai_assistant", component: AskAI },
@@ -34036,43 +34037,44 @@ const TabletIcon = ({ landscape: r = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
34036
34037
  ] }) }) });
34037
34038
  };
34038
34039
  export {
34039
- useStylingBreakpoint as $,
34040
+ useSelectedBlock as $,
34040
34041
  AddBlocksPanel$1 as A,
34041
34042
  BlockSettings as B,
34042
34043
  ChaiSelect$1 as C,
34043
- DarkMode as D,
34044
- useCanvasWidth as E,
34044
+ DefaultChaiBlocks as D,
34045
+ useAddClassesToBlocks as E,
34045
34046
  FaCheck as F,
34046
- useCanvasZoom as G,
34047
- useCopyBlockIds as H,
34047
+ useCanvasWidth as G,
34048
+ useCanvasZoom as H,
34048
34049
  ImportHTML$1 as I,
34049
- useCopyToClipboard as J,
34050
- useCurrentPage as K,
34051
- useCutBlockIds as L,
34052
- useDarkMode as M,
34053
- useDuplicateBlocks as N,
34050
+ useCopyBlockIds as J,
34051
+ useCopyToClipboard as K,
34052
+ useCurrentPage as L,
34053
+ useCutBlockIds as M,
34054
+ useDarkMode as N,
34054
34055
  Outline$1 as O,
34055
- useGetPageData as P,
34056
- useHiddenBlockIds as Q,
34057
- useHighlightBlockId as R,
34058
- usePasteBlocks as S,
34056
+ useDuplicateBlocks as P,
34057
+ useGetPageData as Q,
34058
+ useHiddenBlockIds as R,
34059
+ useHighlightBlockId as S,
34059
34060
  ThemeOptions as T,
34060
34061
  UILibraries as U,
34061
- useBrandingOptions as V,
34062
- useRemoveBlocks as W,
34063
- useRemoveClassesFromBlocks as X,
34064
- useSelectedBlockCurrentClasses as Y,
34065
- useSelectedBlockAllClasses as Z,
34066
- useSelectedBlock as _,
34062
+ usePasteBlocks as V,
34063
+ useBrandingOptions as W,
34064
+ useRemoveBlocks as X,
34065
+ useRemoveClassesFromBlocks as Y,
34066
+ useSelectedBlockCurrentClasses as Z,
34067
+ useSelectedBlockAllClasses as _,
34067
34068
  useSelectedBlockIds as a,
34068
- useUILibraryBlocks as a0,
34069
- useStylingState as a1,
34070
- useSelectedBlocksDisplayChild as a2,
34071
- useAllBlocks as a3,
34072
- useActivePanel as a4,
34073
- useAddBlockParent as a5,
34074
- useSelectedBreakpoints as a6,
34075
- useSelectedStylingBlocks as a7,
34069
+ useStylingBreakpoint as a0,
34070
+ useUILibraryBlocks as a1,
34071
+ useStylingState as a2,
34072
+ useSelectedBlocksDisplayChild as a3,
34073
+ useAllBlocks as a4,
34074
+ useActivePanel as a5,
34075
+ useAddBlockParent as a6,
34076
+ useSelectedBreakpoints as a7,
34077
+ useSelectedStylingBlocks as a8,
34076
34078
  useUpdateBlocksProps as b,
34077
34079
  useUpdateBlocksPropsRealtime as c,
34078
34080
  useBuilderProp as d,
@@ -34087,15 +34089,15 @@ export {
34087
34089
  AIUserPrompt as m,
34088
34090
  BlockAttributesEditor as n,
34089
34091
  ChaiBuilderEditor as o,
34090
- Breakpoints as p,
34091
- UndoRedo as q,
34092
- getBlocksFromHTML as r,
34093
- useBlocksStore as s,
34094
- useUndoManager as t,
34092
+ DarkMode as p,
34093
+ Breakpoints as q,
34094
+ UndoRedo as r,
34095
+ getBlocksFromHTML as s,
34096
+ useBlocksStore as t,
34095
34097
  useCodeEditor as u,
34096
- useBuilderReset as v,
34097
- useReadOnlyMode as w,
34098
- useActiveModal as x,
34099
- useAddBlock as y,
34100
- useAddClassesToBlocks as z
34098
+ useUndoManager as v,
34099
+ useBuilderReset as w,
34100
+ useReadOnlyMode as x,
34101
+ useActiveModal as y,
34102
+ useAddBlock as z
34101
34103
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "1.2.80",
8
+ "version": "1.2.81",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",