@chaibuilder/sdk 2.0.0-beta.32 → 2.0.0-beta.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.
package/dist/core.js CHANGED
@@ -9,12 +9,12 @@ import { has, find, filter, flatten, map, omit, isString, includes, without, get
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
10
10
  import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
11
11
  import { useTranslation, initReactI18next } from "react-i18next";
12
- import { useTranslation as Ke } from "react-i18next";
12
+ import { useTranslation as Xe } from "react-i18next";
13
13
  import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn--DgGggh_.js";
14
14
  import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
15
15
  import TreeModel from "tree-model";
16
16
  import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
17
- import { registerChaiBlock as qe } from "@chaibuilder/runtime";
17
+ import { registerChaiBlock as Ze } from "@chaibuilder/runtime";
18
18
  import ReactQuill, { Quill } from "react-quill";
19
19
  import { useFeature, FlagsProvider } from "flagged";
20
20
  import { useHotkeys } from "react-hotkeys-hook";
@@ -24,6 +24,7 @@ import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxMod
24
24
  import typography from "@tailwindcss/typography";
25
25
  import forms from "@tailwindcss/forms";
26
26
  import aspectRatio from "@tailwindcss/aspect-ratio";
27
+ import containerQueries from "@tailwindcss/container-queries";
27
28
  import { twMerge } from "tailwind-merge";
28
29
  import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-BnWT5XcX.js";
29
30
  import { Provider } from "react-wrap-balancer";
@@ -41,7 +42,7 @@ import Autosuggest from "react-autosuggest";
41
42
  import Fuse from "fuse.js";
42
43
  import clsx from "clsx";
43
44
  import i18n from "i18next";
44
- import { default as Je } from "i18next";
45
+ import { default as Qe } from "i18next";
45
46
  import { motion } from "framer-motion";
46
47
  import "@radix-ui/react-switch";
47
48
  import "@radix-ui/react-accordion";
@@ -3621,6 +3622,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3621
3622
  typography,
3622
3623
  forms,
3623
3624
  aspectRatio,
3625
+ containerQueries,
3624
3626
  plugin(function({ addBase: f, theme: y }) {
3625
3627
  f({
3626
3628
  "h1,h2,h3,h4,h5,h6": {
@@ -3678,7 +3680,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3678
3680
  return i[a];
3679
3681
  };
3680
3682
  function AsyncPropsBlock(o) {
3681
- const { dataProvider: r, block: n } = o, a = useMemo(() => r ? r({ block: n }) : {}, [n, r]);
3683
+ const { dataProvider: r, block: n } = o, a = useMemo(() => r ? r(n, o.lang) : {}, [n, r, o.lang]);
3682
3684
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(o.component, { ...o.props, ...a }) });
3683
3685
  }
3684
3686
  function RuntimePropsBlock(o) {
@@ -3780,12 +3782,14 @@ function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
3780
3782
  ...omit(_, ["__isHidden"]),
3781
3783
  ...v,
3782
3784
  inBuilder: !0,
3783
- blockState: T
3785
+ blockState: T,
3786
+ lang: n
3784
3787
  };
3785
3788
  if (has(A, "dataProvider"))
3786
3789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3787
3790
  AsyncPropsBlock,
3788
3791
  {
3792
+ lang: n,
3789
3793
  dataProvider: A.dataProvider,
3790
3794
  block: f,
3791
3795
  component: S,
@@ -4036,7 +4040,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4036
4040
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
4037
4041
  ] }, l))
4038
4042
  ] }) });
4039
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-4lhmWkV8.js")), CanvasArea = () => {
4043
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-f8Ud0q2D.js")), CanvasArea = () => {
4040
4044
  const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
4041
4045
  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: [
4042
4046
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -8598,7 +8602,7 @@ const ChooseLayout = ({ open: o, close: r }) => {
8598
8602
  )
8599
8603
  ] }) })
8600
8604
  ] }) });
8601
- }, TopBar = lazy(() => import("./Topbar-iARshVmF.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
8605
+ }, TopBar = lazy(() => import("./Topbar-9IbTAO2f.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
8602
8606
  function useSidebarMenuItems() {
8603
8607
  return useMemo(() => compact([
8604
8608
  {
@@ -8794,9 +8798,9 @@ export {
8794
8798
  generateUUID as generateBlockId,
8795
8799
  getBlocksFromHTML,
8796
8800
  getClassValueAndUnit,
8797
- Je as i18n,
8801
+ Qe as i18n,
8798
8802
  cn as mergeClasses,
8799
- qe as registerChaiBlock,
8803
+ Ze as registerChaiBlock,
8800
8804
  useAddBlock,
8801
8805
  useAddClassesToBlocks,
8802
8806
  useAskAi,
@@ -8838,7 +8842,7 @@ export {
8838
8842
  useStylingState,
8839
8843
  useTheme,
8840
8844
  useThemeOptions,
8841
- Ke as useTranslation,
8845
+ Xe as useTranslation,
8842
8846
  useUILibraryBlocks,
8843
8847
  useUndoManager,
8844
8848
  useUpdateBlocksProps,
package/dist/render.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lodash-es"),m=require("./STRINGS-26RPxXyi.cjs"),a=require("./jsx-runtime-JYMCiFoE.cjs"),p=require("react"),_=require("tailwind-merge"),B=require("@chaibuilder/runtime"),R=require("@mhsdesign/jit-browser-tailwindcss"),P=require("@tailwindcss/forms"),q=require("@tailwindcss/typography"),Y=require("@tailwindcss/aspect-ratio"),E=require("./plugin-4xaTkTNB.cjs"),f=require("./ChaiThemeFn-bugxb1Cl.cjs"),v=(e,s="")=>{const t=e.replace(m.STYLES_KEY,"").split(",").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=s+r.last(u),u.join(":")}return`${s}${l}`}).join(" "));return r.flattenDeep(t).join(" ")},A=e=>{if(!e)return[];try{return JSON.parse(F(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function F(e){const s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(s,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function L(e){const s=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return a.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(e.component,{...e.props,...s})})}const O=r.memoize((e,s)=>{const n=e.replace(m.STYLES_KEY,"").split(","),t=_.twMerge(n[0],n[1]);return s===""?t.replace(m.STYLES_KEY,"").trim():v(t,s).replace(m.STYLES_KEY,"").trim()});function N(e,s){const n=r.get(e,`${s}_attrs`,{}),t=r.keys(n).join(" ");return r.includes(t,"x-show")&&!r.includes(t,"x-transition")&&(n["x-transition"]=""),n}function $(e,s){const n={};return Object.keys(e).forEach(t=>{if(r.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=O(e[t],s);n[t]={className:i,...N(e,t)}}}),n}function I(e,s){const n=r.get(e,"_bindings",{});return r.isEmpty(n)?{...e}:(r.each(n,(t,i)=>{r.isString(t)&&r.get(s,t,null)&&(e[i]=r.get(s,t,null))}),e)}function K(e,s,n){if(r.isEmpty(s))return e;const t=r.cloneDeep(e),i=r.get(n,"i18nProps",[]);return r.forEach(r.keys(t),c=>{i.includes(c)&&!r.isEmpty(s)&&(t[c]=r.get(t,`${c}-${s}`,t[c]))}),t}function j({blocks:e,parent:s,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:c="",metadata:h={}}){const l=e,u=o=>$(o,n),T=s?r.filter(e,{_parent:s}):r.filter(e,o=>r.isEmpty(o._parent));return a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:p.Children.toArray(T.map((o,C)=>{const S={},w=r.filter(l,{_parent:o._id});S.children=w.length>0?a.jsxRuntimeExports.jsx(j,{externalData:t,classPrefix:n,parent:o._id,blocks:l,lang:c??"",metadata:h}):null;const d=B.getRegisteredChaiBlock(o._type);if(d!==null){let g=o;const y=d.component;g={...d.defaults,...o},i&&(g=i(g));const x=r.omit({blockProps:{},inBuilder:!1,...g,index:C,...I(K(o,c,d),t),...u(g),...S,metadata:h,lang:c??""},["_parent"]);return r.has(d,"dataProvider")?a.jsxRuntimeExports.jsx(p.Suspense,{children:a.jsxRuntimeExports.jsx(L,{lang:c??"",metadata:h,dataProvider:d.dataProvider,block:o,component:y,props:x})}):a.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(y,x)})}return a.jsxRuntimeExports.jsxs("noscript",{children:[o._type," not found"]})}))})}async function M(e,s,n=[],t="",i){return await R.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:E.getChaiBuilderTheme(e)},plugins:[P,q,Y,E.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lodash-es"),m=require("./STRINGS-26RPxXyi.cjs"),a=require("./jsx-runtime-JYMCiFoE.cjs"),p=require("react"),_=require("tailwind-merge"),B=require("@chaibuilder/runtime"),R=require("@mhsdesign/jit-browser-tailwindcss"),P=require("@tailwindcss/forms"),q=require("@tailwindcss/typography"),Y=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),E=require("./plugin-4xaTkTNB.cjs"),f=require("./ChaiThemeFn-bugxb1Cl.cjs"),A=(e,s="")=>{const t=e.replace(m.STYLES_KEY,"").split(",").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=s+r.last(u),u.join(":")}return`${s}${l}`}).join(" "));return r.flattenDeep(t).join(" ")},F=e=>{if(!e)return[];try{return JSON.parse(L(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function L(e){const s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(s,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function O(e){const s=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return a.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(e.component,{...e.props,...s})})}const $=r.memoize((e,s)=>{const n=e.replace(m.STYLES_KEY,"").split(","),t=_.twMerge(n[0],n[1]);return s===""?t.replace(m.STYLES_KEY,"").trim():A(t,s).replace(m.STYLES_KEY,"").trim()});function N(e,s){const n=r.get(e,`${s}_attrs`,{}),t=r.keys(n).join(" ");return r.includes(t,"x-show")&&!r.includes(t,"x-transition")&&(n["x-transition"]=""),n}function I(e,s){const n={};return Object.keys(e).forEach(t=>{if(r.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=$(e[t],s);n[t]={className:i,...N(e,t)}}}),n}function K(e,s){const n=r.get(e,"_bindings",{});return r.isEmpty(n)?{...e}:(r.each(n,(t,i)=>{r.isString(t)&&r.get(s,t,null)&&(e[i]=r.get(s,t,null))}),e)}function M(e,s,n){if(r.isEmpty(s))return e;const t=r.cloneDeep(e),i=r.get(n,"i18nProps",[]);return r.forEach(r.keys(t),o=>{i.includes(o)&&!r.isEmpty(s)&&(t[o]=r.get(t,`${o}-${s}`,t[o]))}),t}function j({blocks:e,parent:s,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:o="",metadata:h={}}){const l=e,u=c=>I(c,n),T=s?r.filter(e,{_parent:s}):r.filter(e,c=>r.isEmpty(c._parent));return a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:p.Children.toArray(T.map((c,C)=>{const S={},w=r.filter(l,{_parent:c._id});S.children=w.length>0?a.jsxRuntimeExports.jsx(j,{externalData:t,classPrefix:n,parent:c._id,blocks:l,lang:o??"",metadata:h}):null;const d=B.getRegisteredChaiBlock(c._type);if(d!==null){let g=c;const y=d.component;g={...d.defaults,...c},i&&(g=i(g));const x=r.omit({blockProps:{},inBuilder:!1,...g,index:C,...K(M(c,o,d),t),...u(g),...S,metadata:h,lang:o??""},["_parent"]);return r.has(d,"dataProvider")?a.jsxRuntimeExports.jsx(p.Suspense,{children:a.jsxRuntimeExports.jsx(O,{lang:o??"",metadata:h,dataProvider:d.dataProvider,block:c,component:y,props:x})}):a.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(y,x)})}return a.jsxRuntimeExports.jsxs("noscript",{children:[c._type," not found"]})}))})}async function k(e,s,n=[],t="",i){return await R.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:E.getChaiBuilderTheme(e)},plugins:[P,q,Y,v,E.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,s)}const J=(e,s,n)=>M(s,[r.replace(JSON.stringify(e),/#styles:,?/g,"")],[],"",n),k=async(e,s=f.defaultThemeOptions,n=!1)=>await J(e,s,n);exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=j;exports.convertToBlocks=A;exports.getStylesForBlocks=k;
3
+ @tailwind utilities;`,s)}const J=(e,s,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return k(s,[t],[],"",n)},U=async(e,s=f.defaultThemeOptions,n=!1)=>await J(e,s,n);exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=j;exports.convertToBlocks=F;exports.getStylesForBlocks=U;
package/dist/render.js CHANGED
@@ -1,17 +1,18 @@
1
- import { last as A, flattenDeep as O, memoize as $, filter as h, isEmpty as g, omit as v, has as N, get as d, each as R, isString as j, cloneDeep as F, forEach as I, keys as P, includes as _, replace as J } from "lodash-es";
1
+ import { last as A, flattenDeep as $, memoize as O, filter as h, isEmpty as g, omit as v, has as N, get as p, each as R, isString as j, cloneDeep as F, forEach as I, keys as P, includes as C } from "lodash-es";
2
2
  import { S as m } from "./STRINGS-BnWT5XcX.js";
3
3
  import { j as a } from "./jsx-runtime-Sp0orL4X.js";
4
4
  import y, { Suspense as S } from "react";
5
- import { twMerge as L } from "tailwind-merge";
6
- import { getRegisteredChaiBlock as K } from "@chaibuilder/runtime";
7
- import { createTailwindcss as M } from "@mhsdesign/jit-browser-tailwindcss";
8
- import U from "@tailwindcss/forms";
9
- import W from "@tailwindcss/typography";
10
- import Y from "@tailwindcss/aspect-ratio";
5
+ import { twMerge as J } from "tailwind-merge";
6
+ import { getRegisteredChaiBlock as L } from "@chaibuilder/runtime";
7
+ import { createTailwindcss as K } from "@mhsdesign/jit-browser-tailwindcss";
8
+ import M from "@tailwindcss/forms";
9
+ import U from "@tailwindcss/typography";
10
+ import W from "@tailwindcss/aspect-ratio";
11
+ import Y from "@tailwindcss/container-queries";
11
12
  import { g as z, c as D } from "./plugin-GuIj4Ul0.js";
12
- import { d as V } from "./ChaiThemeFn--DgGggh_.js";
13
- import { b as wt, c as xt, a as Ct } from "./ChaiThemeFn--DgGggh_.js";
14
- const q = (t, n = "") => {
13
+ import { d as Q } from "./ChaiThemeFn--DgGggh_.js";
14
+ import { b as xt, c as _t, a as Ct } from "./ChaiThemeFn--DgGggh_.js";
15
+ const V = (t, n = "") => {
15
16
  const e = t.replace(m, "").split(",").map((s) => s.split(" ").map((c) => {
16
17
  if (c === "")
17
18
  return "";
@@ -21,40 +22,40 @@ const q = (t, n = "") => {
21
22
  }
22
23
  return `${n}${c}`;
23
24
  }).join(" "));
24
- return O(e).join(" ");
25
- }, gt = (t) => {
25
+ return $(e).join(" ");
26
+ }, ht = (t) => {
26
27
  if (!t)
27
28
  return [];
28
29
  try {
29
- return JSON.parse(G(t)).filter((r) => !r._type.startsWith("@chai"));
30
+ return JSON.parse(q(t)).filter((r) => !r._type.startsWith("@chai"));
30
31
  } catch {
31
32
  return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
32
33
  }
33
34
  };
34
- function G(t) {
35
+ function q(t) {
35
36
  const n = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
36
37
  return t.replace(n, (r) => {
37
38
  const e = decodeURIComponent(r), s = e.indexOf("public");
38
39
  return s !== -1 ? e.substring(s + 6) : e;
39
40
  });
40
41
  }
41
- async function H(t) {
42
+ async function G(t) {
42
43
  const n = await (t == null ? void 0 : t.dataProvider(t.block, t.lang, t.metadata));
43
44
  return /* @__PURE__ */ a.jsx(S, { children: y.createElement(t.component, { ...t.props, ...n }) });
44
45
  }
45
- const Q = $((t, n) => {
46
- const r = t.replace(m, "").split(","), e = L(r[0], r[1]);
47
- return n === "" ? e.replace(m, "").trim() : q(e, n).replace(m, "").trim();
46
+ const H = O((t, n) => {
47
+ const r = t.replace(m, "").split(","), e = J(r[0], r[1]);
48
+ return n === "" ? e.replace(m, "").trim() : V(e, n).replace(m, "").trim();
48
49
  });
49
50
  function X(t, n) {
50
- const r = d(t, `${n}_attrs`, {}), e = P(r).join(" ");
51
- return _(e, "x-show") && !_(e, "x-transition") && (r["x-transition"] = ""), r;
51
+ const r = p(t, `${n}_attrs`, {}), e = P(r).join(" ");
52
+ return C(e, "x-show") && !C(e, "x-transition") && (r["x-transition"] = ""), r;
52
53
  }
53
54
  function Z(t, n) {
54
55
  const r = {};
55
56
  return Object.keys(t).forEach((e) => {
56
57
  if (j(t[e]) && t[e].startsWith(m)) {
57
- const s = Q(t[e], n);
58
+ const s = H(t[e], n);
58
59
  r[e] = {
59
60
  className: s,
60
61
  ...X(t, e)
@@ -63,17 +64,17 @@ function Z(t, n) {
63
64
  }), r;
64
65
  }
65
66
  function b(t, n) {
66
- const r = d(t, "_bindings", {});
67
+ const r = p(t, "_bindings", {});
67
68
  return g(r) ? { ...t } : (R(r, (e, s) => {
68
- j(e) && d(n, e, null) && (t[s] = d(n, e, null));
69
+ j(e) && p(n, e, null) && (t[s] = p(n, e, null));
69
70
  }), t);
70
71
  }
71
72
  function k(t, n, r) {
72
73
  if (g(n))
73
74
  return t;
74
- const e = F(t), s = d(r, "i18nProps", []);
75
- return I(P(e), (o) => {
76
- s.includes(o) && !g(n) && (e[o] = d(e, `${o}-${n}`, e[o]));
75
+ const e = F(t), s = p(r, "i18nProps", []);
76
+ return I(P(e), (i) => {
77
+ s.includes(i) && !g(n) && (e[i] = p(e, `${i}-${n}`, e[i]));
77
78
  }), e;
78
79
  }
79
80
  function tt({
@@ -82,69 +83,69 @@ function tt({
82
83
  classPrefix: r = "",
83
84
  externalData: e = {},
84
85
  blockModifierCallback: s = null,
85
- lang: o = "",
86
+ lang: i = "",
86
87
  metadata: f = {}
87
88
  }) {
88
- const c = t, l = (i) => Z(i, r), B = n ? h(t, { _parent: n }) : h(t, (i) => g(i._parent));
89
+ const c = t, l = (o) => Z(o, r), B = n ? h(t, { _parent: n }) : h(t, (o) => g(o._parent));
89
90
  return /* @__PURE__ */ a.jsx(a.Fragment, { children: y.Children.toArray(
90
- B.map((i, T) => {
91
- const w = {}, E = h(c, { _parent: i._id });
91
+ B.map((o, T) => {
92
+ const w = {}, E = h(c, { _parent: o._id });
92
93
  w.children = E.length > 0 ? /* @__PURE__ */ a.jsx(
93
94
  tt,
94
95
  {
95
96
  externalData: e,
96
97
  classPrefix: r,
97
- parent: i._id,
98
+ parent: o._id,
98
99
  blocks: c,
99
- lang: o ?? "",
100
+ lang: i ?? "",
100
101
  metadata: f
101
102
  }
102
103
  ) : null;
103
- const u = K(i._type);
104
+ const u = L(o._type);
104
105
  if (u !== null) {
105
- let p = i;
106
+ let d = o;
106
107
  const x = u.component;
107
- p = { ...u.defaults, ...i }, s && (p = s(p));
108
- const C = v(
108
+ d = { ...u.defaults, ...o }, s && (d = s(d));
109
+ const _ = v(
109
110
  {
110
111
  blockProps: {},
111
112
  inBuilder: !1,
112
- ...p,
113
+ ...d,
113
114
  index: T,
114
- ...b(k(i, o, u), e),
115
- ...l(p),
115
+ ...b(k(o, i, u), e),
116
+ ...l(d),
116
117
  ...w,
117
118
  metadata: f,
118
- lang: o ?? ""
119
+ lang: i ?? ""
119
120
  },
120
121
  ["_parent"]
121
122
  );
122
123
  return N(u, "dataProvider") ? /* @__PURE__ */ a.jsx(S, { children: /* @__PURE__ */ a.jsx(
123
- H,
124
+ G,
124
125
  {
125
- lang: o ?? "",
126
+ lang: i ?? "",
126
127
  metadata: f,
127
128
  dataProvider: u.dataProvider,
128
- block: i,
129
+ block: o,
129
130
  component: x,
130
- props: C
131
+ props: _
131
132
  }
132
- ) }) : /* @__PURE__ */ a.jsx(S, { children: y.createElement(x, C) });
133
+ ) }) : /* @__PURE__ */ a.jsx(S, { children: y.createElement(x, _) });
133
134
  }
134
135
  return /* @__PURE__ */ a.jsxs("noscript", { children: [
135
- i._type,
136
+ o._type,
136
137
  " not found"
137
138
  ] });
138
139
  })
139
140
  ) });
140
141
  }
141
142
  async function et(t, n, r = [], e = "", s) {
142
- return await M({
143
+ return await K({
143
144
  tailwindConfig: {
144
145
  darkMode: "class",
145
146
  safelist: r,
146
147
  theme: { extend: z(t) },
147
- plugins: [U, W, Y, D],
148
+ plugins: [M, U, W, Y, D],
148
149
  corePlugins: { preflight: s },
149
150
  ...e ? { prefix: `${e}` } : {}
150
151
  }
@@ -155,12 +156,15 @@ async function et(t, n, r = [], e = "", s) {
155
156
  n
156
157
  );
157
158
  }
158
- const nt = (t, n, r) => et(n, [J(JSON.stringify(t), /#styles:,?/g, "")], [], "", r), ht = async (t, n = V, r = !1) => await nt(t, n, r);
159
+ const nt = (t, n, r) => {
160
+ const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (s, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
161
+ return et(n, [e], [], "", r);
162
+ }, yt = async (t, n = Q, r = !1) => await nt(t, n, r);
159
163
  export {
160
164
  tt as RenderChaiBlocks,
161
- gt as convertToBlocks,
162
- wt as getChaiThemeCssVariables,
163
- ht as getStylesForBlocks,
164
- xt as getThemeFontsCSSImport,
165
+ ht as convertToBlocks,
166
+ xt as getChaiThemeCssVariables,
167
+ yt as getStylesForBlocks,
168
+ _t as getThemeFontsCSSImport,
165
169
  Ct as getThemeFontsLinkMarkup
166
170
  };
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": "2.0.0-beta.32",
8
+ "version": "2.0.0-beta.35",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@bobthered/tailwindcss-palette-generator": "^4.0.0",
71
- "@chaibuilder/runtime": "2.0.0-beta.12",
71
+ "@chaibuilder/runtime": "2.0.0-beta.13",
72
72
  "@floating-ui/dom": "1.4.5",
73
73
  "@floating-ui/react-dom": "2.0.1",
74
74
  "@mhsdesign/jit-browser-tailwindcss": "0.4.1",
@@ -98,6 +98,7 @@
98
98
  "@rjsf/utils": "5.22.4",
99
99
  "@rjsf/validator-ajv8": "5.22.4",
100
100
  "@tailwindcss/aspect-ratio": "0.4.2",
101
+ "@tailwindcss/container-queries": "^0.1.1",
101
102
  "@tailwindcss/forms": "^0.5.6",
102
103
  "@tailwindcss/line-clamp": "^0.4.4",
103
104
  "@tailwindcss/typography": "^0.5.10",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-0lRey9QY.cjs"),C=require("react-i18next"),u=require("react"),n=require("./core.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");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-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-separator");require("@radix-ui/react-toast");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("./ChaiThemeFn-bugxb1Cl.cjs");require("tree-model");require("@chaibuilder/runtime");require("react-quill");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("./STRINGS-26RPxXyi.cjs");require("react-wrap-balancer");require("lucide-react");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("react-arborist");require("himalaya");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),r=require("react"),s=require("./context-menu-0lRey9QY.cjs");require("react-i18next");const u=require("./core.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-separator");require("@radix-ui/react-toast");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("./ChaiThemeFn-bugxb1Cl.cjs");require("@react-hookz/web");require("tree-model");require("@chaibuilder/runtime");require("react-quill");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("./STRINGS-26RPxXyi.cjs");require("react-wrap-balancer");require("lucide-react");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("react-arborist");require("himalaya");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const q=()=>{const t=u.useBuilderProp("topBarComponents.left",[]),n=u.useBuilderProp("topBarComponents.center",[]),o=u.useBuilderProp("topBarComponents.right",[]);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:r.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(n.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:r.Children.toArray(o.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})]})};exports.default=q;