@chaibuilder/sdk 3.1.6 → 3.1.7

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.
@@ -36,8 +36,8 @@ import RjForm from "@rjsf/core";
36
36
  import validator from "@rjsf/validator-ajv8";
37
37
  import Autosuggest from "react-autosuggest";
38
38
  import { useFeature } from "flagged";
39
+ import { compact as compact$1, pick as pick$1, each as each$1, get as get$1, noop as noop$1, kebabCase as kebabCase$1, camelCase } from "lodash";
39
40
  import { Tree } from "react-arborist";
40
- import { compact as compact$1, pick as pick$1, each as each$1, get as get$1, noop as noop$1, camelCase } from "lodash";
41
41
  import { parse, stringify } from "himalaya";
42
42
  import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
43
43
  import tailwindForms from "@tailwindcss/forms";
@@ -4552,7 +4552,7 @@ const RichTextEditor = memo(
4552
4552
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
4553
4553
  /* @__PURE__ */ jsx("p", { children: o("Please try again.") })
4554
4554
  ] }) });
4555
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DhTHKGK0.js")), CanvasArea = () => {
4555
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-D1w8nUwt.js")), CanvasArea = () => {
4556
4556
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
4557
4557
  return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
4558
4558
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -5122,7 +5122,7 @@ const DataBindingSelector = ({
5122
5122
  ]
5123
5123
  }
5124
5124
  ) });
5125
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-BK6-O4Rv.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
5125
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-CsOaIXCW.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
5126
5126
  const c = useRef(null), [u, p] = useState(!1), d = useRTEditor({
5127
5127
  blockId: o,
5128
5128
  value: a,
@@ -7120,7 +7120,7 @@ const CoreBlock = ({
7120
7120
  }, 200);
7121
7121
  },
7122
7122
  draggable: f ? "true" : "false",
7123
- className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7123
+ className: `${kebabCase$1(`chai-block-${i}`)} cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground ${n ? "opacity-50" : ""}`,
7124
7124
  children: [
7125
7125
  createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7126
7126
  /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(x(u || i)) })
@@ -7801,7 +7801,7 @@ const registerChaiSaveToLibrary = (o) => {
7801
7801
  ] });
7802
7802
  }, ExportCode = () => {
7803
7803
  const { t: o } = useTranslation(), [n] = useSelectedBlockIds();
7804
- return /* @__PURE__ */ jsxs(
7804
+ return useBuilderProp("flags.exportCode", !1) ? /* @__PURE__ */ jsxs(
7805
7805
  DropdownMenuItem,
7806
7806
  {
7807
7807
  className: "flex items-center gap-x-4 text-xs",
@@ -7812,7 +7812,7 @@ const registerChaiSaveToLibrary = (o) => {
7812
7812
  o("Export")
7813
7813
  ]
7814
7814
  }
7815
- );
7815
+ ) : null;
7816
7816
  }, CopyPasteBlocks = () => {
7817
7817
  const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), u = useBuilderProp("flags.copyPaste", !0), p = useCallback(() => {
7818
7818
  const d = n.map((g) => {
@@ -10854,11 +10854,11 @@ ${l})
10854
10854
  window.onbeforeunload = null;
10855
10855
  }), [a]), null;
10856
10856
  }, ChaiBuilderComponent = (o) => {
10857
- const n = useMemo(() => o.layout || RootLayout, [o.layout]), r = useBuilderProp("builderTheme", defaultThemeValues);
10857
+ const n = useMemo(() => o.layout || RootLayout, [o.layout]), r = useBuilderProp("builderTheme", defaultThemeValues), a = useBuilderProp("flags.exportCode", !1);
10858
10858
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10859
10859
  /* @__PURE__ */ jsx(CssThemeVariables, { theme: r }),
10860
10860
  /* @__PURE__ */ jsx(n, {}),
10861
- /* @__PURE__ */ jsx(ExportCodeModal, {})
10861
+ a && /* @__PURE__ */ jsx(ExportCodeModal, {})
10862
10862
  ] });
10863
10863
  }, ChaiBuilderEditor = (o) => {
10864
10864
  const n = o.onError || noop;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { d as N, N as D } from "./index-CDJhqQK5.js";
2
+ import { d as N, N as D } from "./index-Cj8rTugy.js";
3
3
  import { a1 as v, a3 as S, a6 as j, a9 as w, v as y } from "./tooltip-4-b9QGDK.js";
4
4
  import "clsx";
5
5
  import "tailwind-merge";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-CooHzimL.cjs"),n=require("./tooltip-C2BCZ8Al.cjs");require("clsx");require("tailwind-merge");const S=({isOpen:m,onClose:l,editor:t,rteElement:f})=>{const r=u.usePageExternalData(),j=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:p,to:g}=t.state.selection;if(p!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,s=c.selection.from,x=c.doc.textBetween(Math.max(0,s-1),s),a=c.doc.textBetween(s,Math.min(s+1,c.doc.content.size));let d="";s>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";a&&a!==" "&&!/[.,!?;:]/.test(a)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(n.Dialog,{open:m,onOpenChange:o=>!o&&l(),children:e.jsxs(n.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(n.DialogHeader,{children:e.jsxs(n.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),Object.keys(r).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(u.NestedPathSelector,{data:r,onSelect:j})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(n.Button,{onClick:l,children:"Done"})})]})})};exports.default=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-CONV5Fbc.cjs"),n=require("./tooltip-C2BCZ8Al.cjs");require("clsx");require("tailwind-merge");const S=({isOpen:m,onClose:l,editor:t,rteElement:f})=>{const r=u.usePageExternalData(),j=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:p,to:g}=t.state.selection;if(p!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,s=c.selection.from,x=c.doc.textBetween(Math.max(0,s-1),s),a=c.doc.textBetween(s,Math.min(s+1,c.doc.content.size));let d="";s>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";a&&a!==" "&&!/[.,!?;:]/.test(a)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(n.Dialog,{open:m,onOpenChange:o=>!o&&l(),children:e.jsxs(n.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(n.DialogHeader,{children:e.jsxs(n.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),Object.keys(r).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(u.NestedPathSelector,{data:r,onSelect:j})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(n.Button,{onClick:l,children:"Done"})})]})})};exports.default=S;
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": "3.1.6",
8
+ "version": "3.1.7",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",