@chaibuilder/sdk 2.0.0-beta.103 → 2.0.0-beta.104

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