@chaibuilder/sdk 2.0.1 → 2.0.3

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/render.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./ChaiThemeFn-DQu-2Eh9.cjs"),s=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),$=require("@mhsdesign/jit-browser-tailwindcss"),b=require("@tailwindcss/aspect-ratio"),M=require("@tailwindcss/container-queries"),k=require("@tailwindcss/forms"),N=require("@tailwindcss/typography"),T=require("./plugin-2xcljWGM.cjs"),d=require("react/jsx-runtime"),j=require("@chaibuilder/runtime"),p=require("react"),Y=require("tailwind-merge"),I=(e,r="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(c=>{if(c==="")return"";if(c.includes(":")){const u=c.split(":");return u[u.length-1]=r+s.last(u),u.join(":")}return`${r}${c}`}).join(" "));return s.flattenDeep(t).join(" ")},A=e=>{if(!e)return[];try{return JSON.parse(J(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function J(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function K(e,r,n=[],t="",i){return await $.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:T.getChaiBuilderTheme(e)},plugins:[k,N,b,M,T.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./ChaiThemeFn-DQu-2Eh9.cjs"),s=require("lodash-es"),f=require("./getSplitClasses-DodqA_KW.cjs"),$=require("@mhsdesign/jit-browser-tailwindcss"),F=require("@tailwindcss/aspect-ratio"),b=require("@tailwindcss/container-queries"),M=require("@tailwindcss/forms"),k=require("@tailwindcss/typography"),B=require("./plugin-2xcljWGM.cjs"),g=require("react/jsx-runtime"),T=require("@chaibuilder/runtime"),p=require("react"),N=require("tailwind-merge"),Y=(e,r="")=>{const{classes:n}=f.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(c=>{if(c==="")return"";if(c.includes(":")){const u=c.split(":");return u[u.length-1]=r+s.last(u),u.join(":")}return`${r}${c}`}).join(" "));return s.flattenDeep(t).join(" ")},I=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function J(e,r,n=[],t="",i){return await $.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:B.getChaiBuilderTheme(e)},plugins:[M,k,F,b,B.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,r)}const L=(e,r,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(r,[t],[],"",n)},V=async(e,r=S.defaultThemeOptions,n=!1)=>await L(e,r,n);async function U(e){const r=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return s.has(r,"$metadata")&&e.dataProviderMetadataCallback(e.block,r.$metadata),d.jsx(p.Suspense,{children:p.createElement(e.component,{...s.omit(e.props,["dataProvider","dataProviderMetadataCallback"]),...s.omit(r,"$metadata")})})}const z=s.memoize((e,r)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),i=Y.twMerge(n,t);return r===""?i.replace(m.STYLES_KEY,"").trim():I(i,r).replace(m.STYLES_KEY,"").trim()}),B=(e,r)=>{const n=s.cloneDeep(e);return s.forEach(s.keys(n),t=>{if(s.isString(n[t])){let i=n[t];const o=/\{\{(.*?)\}\}/g,l=i.match(o);l&&l.forEach(c=>{const u=c.slice(2,-2),h=s.get(r,u,c);i=i.replace(c,h)}),n[t]=i}s.isObject(n[t])&&(n[t]=B(n[t],r))}),n};function D(e,r){const n=s.get(e,`${r}_attrs`,{}),t=s.keys(n).join(" ");return s.includes(t,"x-show")&&!s.includes(t,"x-transition")&&(n["x-transition"]=""),n}function W(e,r){const n={};return Object.keys(e).forEach(t=>{if(s.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=z(e[t],r);n[t]={className:i,...D(e,t)}}}),n}function Q(e,r,n){if(s.isEmpty(r))return e;const t=s.cloneDeep(e),i=s.get(n,"i18nProps",[]);return s.forEach(s.keys(t),o=>{i.includes(o)&&!s.isEmpty(r)&&(t[o]=s.get(t,`${o}-${r}`,t[o]))}),t}const G=s.memoize(e=>{const r=j.getRegisteredChaiBlock(e),n=s.get(r,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,t])=>s.get(t,"runtime",!1)))}),H=(e,r,n)=>s.isEmpty(n)?{}:Object.entries(n).reduce((t,[i,o])=>{const l=[];let c=s.find(e,{_id:r});for(;c;)l.push(c),c=s.find(e,{_id:c._parent});const u=s.find(l,{_type:o.block});return u&&(t[i]=s.get(u,s.get(o,"prop"),null)),t},{}),X=()=>d.jsx("span",{children:"Loading..."});function E({blocks:e,parent:r,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:o="",fallbackLang:l="",metadata:c={},dataProviderMetadataCallback:u=()=>{}}){const h=e,P=a=>W(a,n),v=r?s.filter(e,{_parent:r}):s.filter(e,a=>s.isEmpty(a._parent));return d.jsx(d.Fragment,{children:v.map((a,x)=>{const C={},q=s.filter(h,{_parent:a._id});C.children=q.length>0?d.jsx(E,{externalData:t,classPrefix:n,parent:a._id,blocks:h,lang:o||l,metadata:c},a._id):null;const g=j.getRegisteredChaiBlock(a._type);if(g!==null){let f=a;const y=g.component;f={...g.defaults,...a},i&&(f=i(f));const O=o===l?"":o,F=H(h,a._id,G(a._type)),_=B(Q(a,O,g),t),w=s.omit({blockProps:{},inBuilder:!1,...f,index:x,..._,...P(_),...C,...F,metadata:c,lang:o||l},["_parent"]);if(s.has(g,"dataProvider")){const R=s.get(g,"suspenseFallback",X);return d.jsx(p.Suspense,{fallback:p.createElement(R),children:d.jsx(U,{dataProviderMetadataCallback:u,lang:o||l,metadata:c,dataProvider:g.dataProvider,block:a,component:y,props:w})},a._id)}return d.jsx(p.Suspense,{children:p.createElement(y,w)},a._id)}return d.jsxs("noscript",{children:[a._type," not found"]},a._id)})})}exports.getChaiThemeCssVariables=S.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=S.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=S.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=E;exports.convertToBlocks=A;exports.getStylesForBlocks=V;
3
+ @tailwind utilities;`,r)}const K=(e,r,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,a)=>`#styles:${a.replace(/,/g," ")}`.replace(/#styles:/g,""));return J(r,[t],[],"",n)},L=async(e,r=S.defaultThemeOptions,n=!1)=>await K(e,r,n);async function V(e){const r=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return s.has(r,"$metadata")&&e.dataProviderMetadataCallback(e.block,r.$metadata),g.jsx(p.Suspense,{children:p.createElement(e.component,{...s.omit(e.props,["dataProvider","dataProviderMetadataCallback"]),...s.omit(r,"$metadata")})})}const U=s.memoize((e,r)=>{const{baseClasses:n,classes:t}=f.getSplitChaiClasses(e),i=N.twMerge(n,t);return r===""?i.replace(f.STYLES_KEY,"").trim():Y(i,r).replace(f.STYLES_KEY,"").trim()}),j=(e,r)=>{const n=s.cloneDeep(e);return s.forEach(s.keys(n),t=>{if(s.isString(n[t])){let i=n[t];const a=/\{\{(.*?)\}\}/g,l=i.match(a);l&&l.forEach(c=>{const u=c.slice(2,-2),h=s.get(r,u,c);i=i.replace(c,h)}),n[t]=i}s.isObject(n[t])&&(n[t]=j(n[t],r))}),n};function z(e,r){const n=s.get(e,`${r}_attrs`,{}),t=s.keys(n).join(" ");return s.includes(t,"x-show")&&!s.includes(t,"x-transition")&&(n["x-transition"]=""),n}function D(e,r){const n={};return Object.keys(e).forEach(t=>{if(s.isString(e[t])&&e[t].startsWith(f.STYLES_KEY)){const i=U(e[t],r);n[t]={className:i,...z(e,t)}}}),n}function W(e,r,n){if(s.isEmpty(r))return e;const t=s.cloneDeep(e),i=s.get(n,"i18nProps",[]);return s.forEach(s.keys(t),a=>{i.includes(a)&&!s.isEmpty(r)&&(t[a]=s.get(t,`${a}-${r}`,t[a]))}),t}const Q=s.memoize(e=>{const r=T.getRegisteredChaiBlock(e),n=s.get(r,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,t])=>s.get(t,"runtime",!1)))}),G=(e,r,n)=>s.isEmpty(n)?{}:Object.entries(n).reduce((t,[i,a])=>{const l=[];let c=s.find(e,{_id:r});for(;c;)l.push(c),c=s.find(e,{_id:c._parent});const u=s.find(l,{_type:a.block});return u&&(t[i]=s.get(u,s.get(a,"prop"),null)),t},{}),H=()=>g.jsx("span",{children:"Loading..."});function E({blocks:e,parent:r,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:a="",fallbackLang:l="",metadata:c={},dataProviderMetadataCallback:u=()=>{}}){const h=e,P=o=>D(o,n);return(r?s.filter(e,{_parent:r}):s.filter(e,o=>s.isEmpty(o._parent))).map((o,v)=>{const C={},q=s.filter(h,{_parent:o._id});C.children=q.length>0?g.jsx(E,{externalData:t,classPrefix:n,parent:o._id,blocks:h,lang:a||l,metadata:c},o._id):null;const d=T.getRegisteredChaiBlock(o._type);if(d!==null){let m=o;const y=d.component;m={...d.defaults,...o},i&&(m=i(m));const x=a===l?"":a,O=G(h,o._id,Q(o._type)),_=j(W(o,x,d),t),w=s.omit({blockProps:{},inBuilder:!1,...m,index:v,..._,...P(_),...C,...O,metadata:c,lang:a||l,key:o._id},["_parent"]);if(s.has(d,"dataProvider")){const R=s.get(d,"suspenseFallback",H);return g.jsx(p.Suspense,{fallback:p.createElement(R),children:g.jsx(V,{dataProviderMetadataCallback:u,lang:a||l,metadata:c,dataProvider:d.dataProvider,block:o,component:y,props:w},o._id)},o._id)}return g.jsx(p.Suspense,{children:p.createElement(y,w)},o._id)}return g.jsxs("noscript",{children:[o._type," not found"]},o._id)})}exports.getChaiThemeCssVariables=S.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=S.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=S.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=E;exports.convertToBlocks=I;exports.getStylesForBlocks=L;
package/dist/render.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { JSX as JSX_2 } from 'react/jsx-runtime';
2
-
3
1
  declare type BorderRadiusValue = false | string;
4
2
 
5
3
  declare type ChaiBlock<T = Record<string, any>> = {
@@ -43,7 +41,7 @@ export declare const getThemeFontsLinkMarkup: (chaiTheme: Pick<Partial<ChaiBuild
43
41
 
44
42
  declare type HSLColor = string;
45
43
 
46
- export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, fallbackLang, metadata, dataProviderMetadataCallback, }: RenderChaiBlocksProps): JSX_2.Element;
44
+ export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, fallbackLang, metadata, dataProviderMetadataCallback, }: RenderChaiBlocksProps): any;
47
45
 
48
46
  declare type RenderChaiBlocksProps = {
49
47
  blocks: ChaiBlock[];
package/dist/render.js CHANGED
@@ -1,49 +1,49 @@
1
- import { d as Y } from "./ChaiThemeFn-Cort9tch.js";
2
- import { a as Nt, b as At, c as It } from "./ChaiThemeFn-Cort9tch.js";
3
- import { last as z, flattenDeep as D, has as O, omit as S, memoize as $, get as d, filter as h, isEmpty as g, cloneDeep as E, forEach as x, keys as y, isString as b, isObject as L, find as _, includes as j } from "lodash-es";
4
- import { g as R, S as C } from "./getSplitClasses-DphwgQiE.js";
5
- import { createTailwindcss as Q } from "@mhsdesign/jit-browser-tailwindcss";
6
- import q from "@tailwindcss/aspect-ratio";
7
- import G from "@tailwindcss/container-queries";
8
- import H from "@tailwindcss/forms";
9
- import X from "@tailwindcss/typography";
10
- import { g as Z, c as k } from "./plugin-kUMxtQR5.js";
11
- import { jsx as p, Fragment as tt, jsxs as et } from "react/jsx-runtime";
1
+ import { d as W } from "./ChaiThemeFn-Cort9tch.js";
2
+ import { a as Ft, b as Nt, c as At } from "./ChaiThemeFn-Cort9tch.js";
3
+ import { last as Y, flattenDeep as z, has as O, omit as S, memoize as $, get as d, filter as h, isEmpty as g, cloneDeep as E, forEach as x, keys as w, isString as R, isObject as D, find as _, includes as j } from "lodash-es";
4
+ import { g as b, S as y } from "./getSplitClasses-DphwgQiE.js";
5
+ import { createTailwindcss as L } from "@mhsdesign/jit-browser-tailwindcss";
6
+ import Q from "@tailwindcss/aspect-ratio";
7
+ import q from "@tailwindcss/container-queries";
8
+ import G from "@tailwindcss/forms";
9
+ import H from "@tailwindcss/typography";
10
+ import { g as X, c as Z } from "./plugin-kUMxtQR5.js";
11
+ import { jsx as p, jsxs as k } from "react/jsx-runtime";
12
12
  import { getRegisteredChaiBlock as F } from "@chaibuilder/runtime";
13
- import N, { Suspense as w, createElement as nt } from "react";
14
- import { twMerge as st } from "tailwind-merge";
15
- const rt = (t, s = "") => {
16
- const { classes: n } = R(t), e = n.split(" ").map((r) => r.split(" ").map((a) => {
13
+ import N, { Suspense as C, createElement as tt } from "react";
14
+ import { twMerge as et } from "tailwind-merge";
15
+ const nt = (t, s = "") => {
16
+ const { classes: n } = b(t), e = n.split(" ").map((r) => r.split(" ").map((a) => {
17
17
  if (a === "") return "";
18
18
  if (a.includes(":")) {
19
19
  const l = a.split(":");
20
- return l[l.length - 1] = s + z(l), l.join(":");
20
+ return l[l.length - 1] = s + Y(l), l.join(":");
21
21
  }
22
22
  return `${s}${a}`;
23
23
  }).join(" "));
24
- return D(e).join(" ");
25
- }, xt = (t) => {
24
+ return z(e).join(" ");
25
+ }, Et = (t) => {
26
26
  if (!t) return [];
27
27
  try {
28
- return JSON.parse(it(t)).filter((n) => !n._type.startsWith("@chai"));
28
+ return JSON.parse(st(t)).filter((n) => !n._type.startsWith("@chai"));
29
29
  } catch {
30
30
  return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
31
31
  }
32
32
  };
33
- function it(t) {
33
+ function st(t) {
34
34
  const s = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
35
35
  return t.replace(s, (n) => {
36
36
  const e = decodeURIComponent(n), r = e.indexOf("public");
37
37
  return r !== -1 ? e.substring(r + 6) : e;
38
38
  });
39
39
  }
40
- async function ot(t, s, n = [], e = "", r) {
41
- return await Q({
40
+ async function rt(t, s, n = [], e = "", r) {
41
+ return await L({
42
42
  tailwindConfig: {
43
43
  darkMode: "class",
44
44
  safelist: n,
45
- theme: { extend: Z(t) },
46
- plugins: [H, X, q, G, k],
45
+ theme: { extend: X(t) },
46
+ plugins: [G, H, Q, q, Z],
47
47
  corePlugins: { preflight: r },
48
48
  ...e ? { prefix: `${e}` } : {}
49
49
  }
@@ -54,147 +54,145 @@ async function ot(t, s, n = [], e = "", r) {
54
54
  s
55
55
  );
56
56
  }
57
- const at = (t, s, n) => {
58
- const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (r, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
59
- return ot(s, [e], [], "", n);
60
- }, bt = async (t, s = Y, n = !1) => await at(t, s, n);
61
- async function ct(t) {
57
+ const it = (t, s, n) => {
58
+ const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (r, o) => `#styles:${o.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
59
+ return rt(s, [e], [], "", n);
60
+ }, xt = async (t, s = W, n = !1) => await it(t, s, n);
61
+ async function ot(t) {
62
62
  const s = await (t == null ? void 0 : t.dataProvider(t.block, t.lang, t.metadata));
63
- return O(s, "$metadata") && t.dataProviderMetadataCallback(t.block, s.$metadata), /* @__PURE__ */ p(w, { children: N.createElement(t.component, {
63
+ return O(s, "$metadata") && t.dataProviderMetadataCallback(t.block, s.$metadata), /* @__PURE__ */ p(C, { children: N.createElement(t.component, {
64
64
  ...S(t.props, ["dataProvider", "dataProviderMetadataCallback"]),
65
65
  ...S(s, "$metadata")
66
66
  }) });
67
67
  }
68
- const lt = $((t, s) => {
69
- const { baseClasses: n, classes: e } = R(t), r = st(n, e);
70
- return s === "" ? r.replace(C, "").trim() : rt(r, s).replace(C, "").trim();
68
+ const at = $((t, s) => {
69
+ const { baseClasses: n, classes: e } = b(t), r = et(n, e);
70
+ return s === "" ? r.replace(y, "").trim() : nt(r, s).replace(y, "").trim();
71
71
  }), A = (t, s) => {
72
72
  const n = E(t);
73
- return x(y(n), (e) => {
74
- if (b(n[e])) {
73
+ return x(w(n), (e) => {
74
+ if (R(n[e])) {
75
75
  let r = n[e];
76
- const i = /\{\{(.*?)\}\}/g, c = r.match(i);
76
+ const o = /\{\{(.*?)\}\}/g, c = r.match(o);
77
77
  c && c.forEach((a) => {
78
78
  const l = a.slice(2, -2), m = d(s, l, a);
79
79
  r = r.replace(a, m);
80
80
  }), n[e] = r;
81
81
  }
82
- L(n[e]) && (n[e] = A(n[e], s));
82
+ D(n[e]) && (n[e] = A(n[e], s));
83
83
  }), n;
84
84
  };
85
- function dt(t, s) {
86
- const n = d(t, `${s}_attrs`, {}), e = y(n).join(" ");
85
+ function ct(t, s) {
86
+ const n = d(t, `${s}_attrs`, {}), e = w(n).join(" ");
87
87
  return j(e, "x-show") && !j(e, "x-transition") && (n["x-transition"] = ""), n;
88
88
  }
89
- function ut(t, s) {
89
+ function lt(t, s) {
90
90
  const n = {};
91
91
  return Object.keys(t).forEach((e) => {
92
- if (b(t[e]) && t[e].startsWith(C)) {
93
- const r = lt(t[e], s);
92
+ if (R(t[e]) && t[e].startsWith(y)) {
93
+ const r = at(t[e], s);
94
94
  n[e] = {
95
95
  className: r,
96
- ...dt(t, e)
96
+ ...ct(t, e)
97
97
  };
98
98
  }
99
99
  }), n;
100
100
  }
101
- function pt(t, s, n) {
101
+ function dt(t, s, n) {
102
102
  if (g(s)) return t;
103
103
  const e = E(t), r = d(n, "i18nProps", []);
104
- return x(y(e), (i) => {
105
- r.includes(i) && !g(s) && (e[i] = d(e, `${i}-${s}`, e[i]));
104
+ return x(w(e), (o) => {
105
+ r.includes(o) && !g(s) && (e[o] = d(e, `${o}-${s}`, e[o]));
106
106
  }), e;
107
107
  }
108
- const mt = $((t) => {
108
+ const ut = $((t) => {
109
109
  const s = F(t), n = d(s, "schema.properties", {});
110
110
  return Object.fromEntries(Object.entries(n).filter(([, e]) => d(e, "runtime", !1)));
111
- }), ft = (t, s, n) => g(n) ? {} : Object.entries(n).reduce((e, [r, i]) => {
111
+ }), pt = (t, s, n) => g(n) ? {} : Object.entries(n).reduce((e, [r, o]) => {
112
112
  const c = [];
113
113
  let a = _(t, { _id: s });
114
114
  for (; a; )
115
115
  c.push(a), a = _(t, { _id: a._parent });
116
- const l = _(c, { _type: i.block });
117
- return l && (e[r] = d(l, d(i, "prop"), null)), e;
118
- }, {}), gt = () => /* @__PURE__ */ p("span", { children: "Loading..." });
119
- function ht({
116
+ const l = _(c, { _type: o.block });
117
+ return l && (e[r] = d(l, d(o, "prop"), null)), e;
118
+ }, {}), mt = () => /* @__PURE__ */ p("span", { children: "Loading..." });
119
+ function ft({
120
120
  blocks: t,
121
121
  parent: s,
122
122
  classPrefix: n = "",
123
123
  externalData: e = {},
124
124
  blockModifierCallback: r = null,
125
- lang: i = "",
125
+ lang: o = "",
126
126
  fallbackLang: c = "",
127
127
  metadata: a = {},
128
128
  dataProviderMetadataCallback: l = () => {
129
129
  }
130
130
  }) {
131
- const m = t, I = (o) => ut(o, n), J = s ? h(t, { _parent: s }) : h(t, (o) => g(o._parent));
132
- return /* @__PURE__ */ p(tt, { children: J.map((o, M) => {
133
- const P = {}, U = h(m, { _parent: o._id });
134
- P.children = U.length > 0 ? /* @__PURE__ */ p(
135
- ht,
131
+ const m = t, I = (i) => lt(i, n);
132
+ return (s ? h(t, { _parent: s }) : h(t, (i) => g(i._parent))).map((i, J) => {
133
+ const P = {}, M = h(m, { _parent: i._id });
134
+ P.children = M.length > 0 ? /* @__PURE__ */ p(
135
+ ft,
136
136
  {
137
137
  externalData: e,
138
138
  classPrefix: n,
139
- parent: o._id,
139
+ parent: i._id,
140
140
  blocks: m,
141
- lang: i || c,
141
+ lang: o || c,
142
142
  metadata: a
143
143
  },
144
- o._id
144
+ i._id
145
145
  ) : null;
146
- const u = F(o._type);
146
+ const u = F(i._type);
147
147
  if (u !== null) {
148
- let f = o;
148
+ let f = i;
149
149
  const B = u.component;
150
- f = { ...u.defaults, ...o }, r && (f = r(f));
151
- const V = i === c ? "" : i, K = ft(m, o._id, mt(o._type)), v = A(pt(o, V, u), e), T = S(
150
+ f = { ...u.defaults, ...i }, r && (f = r(f));
151
+ const U = o === c ? "" : o, V = pt(m, i._id, ut(i._type)), v = A(dt(i, U, u), e), T = S(
152
152
  {
153
153
  blockProps: {},
154
154
  inBuilder: !1,
155
155
  ...f,
156
- index: M,
156
+ index: J,
157
157
  ...v,
158
158
  ...I(v),
159
159
  ...P,
160
- ...K,
160
+ ...V,
161
161
  metadata: a,
162
- lang: i || c
162
+ lang: o || c,
163
+ key: i._id
163
164
  },
164
165
  ["_parent"]
165
166
  );
166
167
  if (O(u, "dataProvider")) {
167
- const W = d(
168
- u,
169
- "suspenseFallback",
170
- gt
171
- );
172
- return /* @__PURE__ */ p(w, { fallback: nt(W), children: /* @__PURE__ */ p(
173
- ct,
168
+ const K = d(u, "suspenseFallback", mt);
169
+ return /* @__PURE__ */ p(C, { fallback: tt(K), children: /* @__PURE__ */ p(
170
+ ot,
174
171
  {
175
172
  dataProviderMetadataCallback: l,
176
- lang: i || c,
173
+ lang: o || c,
177
174
  metadata: a,
178
175
  dataProvider: u.dataProvider,
179
- block: o,
176
+ block: i,
180
177
  component: B,
181
178
  props: T
182
- }
183
- ) }, o._id);
179
+ },
180
+ i._id
181
+ ) }, i._id);
184
182
  }
185
- return /* @__PURE__ */ p(w, { children: N.createElement(B, T) }, o._id);
183
+ return /* @__PURE__ */ p(C, { children: N.createElement(B, T) }, i._id);
186
184
  }
187
- return /* @__PURE__ */ et("noscript", { children: [
188
- o._type,
185
+ return /* @__PURE__ */ k("noscript", { children: [
186
+ i._type,
189
187
  " not found"
190
- ] }, o._id);
191
- }) });
188
+ ] }, i._id);
189
+ });
192
190
  }
193
191
  export {
194
- ht as RenderChaiBlocks,
195
- xt as convertToBlocks,
196
- Nt as getChaiThemeCssVariables,
197
- bt as getStylesForBlocks,
198
- At as getThemeFontsCSSImport,
199
- It as getThemeFontsLinkMarkup
192
+ ft as RenderChaiBlocks,
193
+ Et as convertToBlocks,
194
+ Ft as getChaiThemeCssVariables,
195
+ xt as getStylesForBlocks,
196
+ Nt as getThemeFontsCSSImport,
197
+ At as getThemeFontsLinkMarkup
200
198
  };
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.1",
8
+ "version": "2.0.3",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",