@chaibuilder/sdk 2.2.15 → 2.2.16

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 k=require("./plugin-C01tjI6V.cjs"),u=require("./new-blocks-render-helpers-DvF4dnjH.cjs"),a=require("lodash-es"),x=require("@tailwindcss/aspect-ratio"),q=require("@tailwindcss/forms"),I=require("@tailwindcss/typography");require("tailwindcss-animate");const R=require("./get-chai-builder-theme-CeaKvOZ8.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),j=require("@tailwindcss/container-queries"),g=require("react/jsx-runtime"),h=require("react"),L=require("@chaibuilder/runtime"),E=e=>{if(!e)return[];try{return JSON.parse(D(e)).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function D(e){const t=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(t,r=>{const n=decodeURIComponent(r),s=n.indexOf("public");return s!==-1?n.substring(s+6):n})}async function O(e,t,r=[],n="",s){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:R.getChaiBuilderTheme(e)},plugins:[q,I,x,j,k.chaiBuilderPlugin],corePlugins:{preflight:s},...n?{prefix:`${n}`}:{}}}).generateStylesFromContent(` ${s?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./plugin-C01tjI6V.cjs"),u=require("./new-blocks-render-helpers-DvF4dnjH.cjs"),a=require("lodash-es"),T=require("@tailwindcss/aspect-ratio"),I=require("@tailwindcss/forms"),q=require("@tailwindcss/typography");require("tailwindcss-animate");const R=require("./get-chai-builder-theme-CeaKvOZ8.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),L=require("@tailwindcss/container-queries"),g=require("react/jsx-runtime"),h=require("react"),j=require("@chaibuilder/runtime");function E(e,t){const n=e.filter(({_type:r})=>r==="GlobalBlock"||r==="PartialBlock");for(let r=0;r<n.length;r++){const s=n[r],l=a.get(s,"partialBlockId",a.get(s,"globalBlock",""));if(l==="")continue;const i=a.cloneDeep(a.get(t,l,[]));s._parent&&(i==null?void 0:i.length)>0&&(i[0]._parent=s._parent);const o=e.indexOf(s);e.splice(o,1,...i)}return e}const D=e=>{if(!e)return[];try{return JSON.parse(M(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function M(e){const t=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(t,n=>{const r=decodeURIComponent(n),s=r.indexOf("public");return s!==-1?r.substring(s+6):r})}async function O(e,t,n=[],r="",s){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:R.getChaiBuilderTheme(e)},plugins:[I,q,T,L,f.chaiBuilderPlugin],corePlugins:{preflight:s},...r?{prefix:`${r}`}:{}}}).generateStylesFromContent(` ${s?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,t)}const A=(e,t,r)=>{const n=JSON.stringify(e).replace(/#styles:([^"]*)/g,(s,c)=>`#styles:${c.replace(/,/g," ")}`.replace(/#styles:/g,""));return O(t,[n],[],"",r)},M=async(e,t=k.defaultThemeOptions,r=!1)=>await A(e,t,r);async function $(e){const t=await e.dataProvider({pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1});return a.has(t,"$metadata")&&a.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,t.$metadata),e.children({...a.omit(t,"$metadata")})}const N=()=>g.jsx("div",{}),J=e=>{const{block:t,lang:r,fallbackLang:n,children:s,externalData:c,blocks:i,draft:l,pageProps:p,dataProviderMetadataCallback:m}=e,o=L.getRegisteredChaiBlock(t._type),f=a.get(o,"component",null),y=a.get(e.repeaterData,"index",-1),P=a.get(e.repeaterData,"dataKey",""),_=r===n?"":r,d=u.applyBinding(u.applyLanguage(t,_,o),c,{index:y,key:P}),w=u.getBlockTagAttributes(t,!1),C=K(i,t._id,u.getBlockRuntimeProps(t._type)),S=a.has(o,"dataProvider")&&a.isFunction(o.dataProvider),B={blockProps:{},inBuilder:!1,lang:r||n,...d,...w,...C};if(a.isNull(f))return null;if(S){const v=a.get(o,"suspenseFallback",N);return g.jsx(h.Suspense,{fallback:h.createElement(v),children:g.jsx($,{lang:r,pageProps:p,block:t,dataProvider:o.dataProvider,...m?{dataProviderMetadataCallback:m}:{},draft:l,children:T=>h.createElement(f,{...B,...T,children:s({_id:t._id,_type:t._type,...a.isArray(d.repeaterItems)?{repeaterItems:u.applyLimit(d.repeaterItems,t),repeaterItemsBinding:d.repeaterItemsBinding}:{}})})})})}return g.jsx(h.Suspense,{children:h.createElement(f,{...B,children:s({_id:t._id,_type:t._type,...a.isArray(d.repeaterItems)?{repeaterItems:u.applyLimit(d.repeaterItems,t),repeaterItemsBinding:d.repeaterItemsBinding}:{}})})})},b=e=>{const{blocks:t,parent:r,repeaterData:n}=e,s=a.filter(t,i=>a.has(i,"_id")&&(a.isEmpty(r)?!i._parent:i._parent===r)),c=i=>a.filter(t,l=>l._parent===i).length>0;return a.map(s,i=>i?h.createElement(J,{...e,key:i._id,block:i},({_id:l,_type:p,repeaterItems:m,repeaterItemsBinding:o})=>p==="Repeater"?a.isArray(m)&&m.map((f,y)=>g.jsx(b,{...e,parent:i._id,repeaterData:{index:y,dataKey:o}})):c(l)?g.jsx(b,{...e,parent:i._id,repeaterData:n}):null):null)},K=(e,t,r)=>a.isEmpty(r)?{}:Object.entries(r).reduce((n,[s,c])=>{const i=[];let l=a.find(e,{_id:t});for(;l;)i.push(l),l=a.find(e,{_id:l._parent});const p=a.find(i,{_type:c.block});return p&&(n[s]=a.get(p,a.get(c,"prop"),null)),n},{});function V(e){if(a.has(e,"metadata")&&console.warn(" metadata is deprecated and will be removed in upcoming version, use pageProps instead"),a.isEmpty(e.lang)&&!a.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");const t=e.lang??"en",r=e.fallbackLang??t;return g.jsx(b,{...e,lang:t,fallbackLang:r})}exports.getChaiThemeCssVariables=k.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=k.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=k.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=u.applyChaiDataBinding;exports.RenderChaiBlocks=V;exports.convertToBlocks=E;exports.getStylesForBlocks=M;
3
+ @tailwind utilities;`,t)}const A=(e,t,n)=>{const r=JSON.stringify(e).replace(/#styles:([^"]*)/g,(s,l)=>`#styles:${l.replace(/,/g," ")}`.replace(/#styles:/g,""));return O(t,[r],[],"",n)},$=async(e,t=f.defaultThemeOptions,n=!1)=>await A(e,t,n);async function N(e){const t=await e.dataProvider({pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1});return a.has(t,"$metadata")&&a.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,t.$metadata),e.children({...a.omit(t,"$metadata")})}const J=()=>g.jsx("div",{}),K=e=>{const{block:t,lang:n,fallbackLang:r,children:s,externalData:l,blocks:i,draft:o,pageProps:p,dataProviderMetadataCallback:m}=e,c=j.getRegisteredChaiBlock(t._type),k=a.get(c,"component",null),y=a.get(e.repeaterData,"index",-1),P=a.get(e.repeaterData,"dataKey",""),_=n===r?"":n,d=u.applyBinding(u.applyLanguage(t,_,c),l,{index:y,key:P}),w=u.getBlockTagAttributes(t,!1),C=V(i,t._id,u.getBlockRuntimeProps(t._type)),S=a.has(c,"dataProvider")&&a.isFunction(c.dataProvider),b={blockProps:{},inBuilder:!1,lang:n||r,...d,...w,...C};if(a.isNull(k))return null;if(S){const v=a.get(c,"suspenseFallback",J);return g.jsx(h.Suspense,{fallback:h.createElement(v),children:g.jsx(N,{lang:n,pageProps:p,block:t,dataProvider:c.dataProvider,...m?{dataProviderMetadataCallback:m}:{},draft:o,children:x=>h.createElement(k,{...b,...x,children:s({_id:t._id,_type:t._type,...a.isArray(d.repeaterItems)?{repeaterItems:u.applyLimit(d.repeaterItems,t),repeaterItemsBinding:d.repeaterItemsBinding}:{}})})})})}return g.jsx(h.Suspense,{children:h.createElement(k,{...b,children:s({_id:t._id,_type:t._type,...a.isArray(d.repeaterItems)?{repeaterItems:u.applyLimit(d.repeaterItems,t),repeaterItemsBinding:d.repeaterItemsBinding}:{}})})})},B=e=>{const{blocks:t,parent:n,repeaterData:r}=e;let s=a.uniqBy(a.filter(t,i=>a.has(i,"_id")&&(a.isEmpty(n)?!i._parent:i._parent===n)),"_id");const l=i=>a.filter(t,o=>o._parent===i).length>0;return a.map(s,i=>i?h.createElement(K,{...e,key:i._id,block:i},({_id:o,_type:p,repeaterItems:m,repeaterItemsBinding:c})=>p==="Repeater"?a.isArray(m)&&m.map((k,y)=>g.jsx(B,{...e,parent:i._id,repeaterData:{index:y,dataKey:c}})):l(o)?g.jsx(B,{...e,parent:i._id,repeaterData:r}):null):null)},V=(e,t,n)=>a.isEmpty(n)?{}:Object.entries(n).reduce((r,[s,l])=>{const i=[];let o=a.find(e,{_id:t});for(;o;)i.push(o),o=a.find(e,{_id:o._parent});const p=a.find(i,{_type:l.block});return p&&(r[s]=a.get(p,a.get(l,"prop"),null)),r},{});function U(e){if(a.has(e,"metadata")&&console.warn(" metadata is deprecated and will be removed in upcoming version, use pageProps instead"),a.isEmpty(e.lang)&&!a.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(a.isEmpty(e.blocks))return null;const t=e.lang??"en",n=e.fallbackLang??t;return g.jsx(B,{...e,lang:t,fallbackLang:n})}exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=u.applyChaiDataBinding;exports.RenderChaiBlocks=U;exports.convertToBlocks=D;exports.getMergedPartialBlocks=E;exports.getStylesForBlocks=$;
package/dist/render.d.ts CHANGED
@@ -62,6 +62,8 @@ export declare const convertToBlocks: (chaiFormatContent: string) => ChaiBlock[]
62
62
 
63
63
  export declare const getChaiThemeCssVariables: (chaiTheme: ChaiThemeValues) => string;
64
64
 
65
+ export declare function getMergedPartialBlocks(blocks: ChaiBlock[], partials: Record<string, ChaiBlock[]>): ChaiBlock[];
66
+
65
67
  /**
66
68
  * Get the tailwind css for the blocks
67
69
  * @param blocks - The blocks to get the tailwind css for
package/dist/render.js CHANGED
@@ -1,40 +1,52 @@
1
1
  import { d as F, c as O } from "./plugin-fnBB3TCm.js";
2
- import { a as _e, b as we, e as Be } from "./plugin-fnBB3TCm.js";
3
- import { a as $, b as A, g as M, c as N, d as B } from "./new-blocks-render-helpers-DfAVXxr2.js";
4
- import { e as ve } from "./new-blocks-render-helpers-DfAVXxr2.js";
5
- import { has as k, isFunction as S, omit as J, get as g, isNull as E, isArray as P, filter as C, isEmpty as h, map as K, find as y } from "lodash-es";
6
- import j from "@tailwindcss/aspect-ratio";
7
- import U from "@tailwindcss/forms";
8
- import V from "@tailwindcss/typography";
2
+ import { a as Ce, b as ve, e as xe } from "./plugin-fnBB3TCm.js";
3
+ import { a as M, b as $, g as A, c as N, d as w } from "./new-blocks-render-helpers-DfAVXxr2.js";
4
+ import { e as Ie } from "./new-blocks-render-helpers-DfAVXxr2.js";
5
+ import { get as s, cloneDeep as J, has as k, isFunction as x, omit as E, isNull as K, isArray as B, uniqBy as j, filter as C, isEmpty as m, map as q, find as y } from "lodash-es";
6
+ import U from "@tailwindcss/aspect-ratio";
7
+ import V from "@tailwindcss/forms";
8
+ import G from "@tailwindcss/typography";
9
9
  import "tailwindcss-animate";
10
- import { g as q } from "./get-chai-builder-theme-ByeXCyGx.js";
11
- import { createTailwindcss as W } from "@mhsdesign/jit-browser-tailwindcss";
12
- import z from "@tailwindcss/container-queries";
13
- import { jsx as d } from "react/jsx-runtime";
14
- import { Suspense as v, createElement as f } from "react";
15
- import { getRegisteredChaiBlock as G } from "@chaibuilder/runtime";
16
- const he = (e) => {
10
+ import { g as W } from "./get-chai-builder-theme-ByeXCyGx.js";
11
+ import { createTailwindcss as z } from "@mhsdesign/jit-browser-tailwindcss";
12
+ import H from "@tailwindcss/container-queries";
13
+ import { jsx as p } from "react/jsx-runtime";
14
+ import { Suspense as v, createElement as h } from "react";
15
+ import { getRegisteredChaiBlock as Q } from "@chaibuilder/runtime";
16
+ function be(e, t) {
17
+ const a = e.filter(({ _type: r }) => r === "GlobalBlock" || r === "PartialBlock");
18
+ for (let r = 0; r < a.length; r++) {
19
+ const i = a[r], l = s(i, "partialBlockId", s(i, "globalBlock", ""));
20
+ if (l === "") continue;
21
+ const n = J(s(t, l, []));
22
+ i._parent && (n == null ? void 0 : n.length) > 0 && (n[0]._parent = i._parent);
23
+ const o = e.indexOf(i);
24
+ e.splice(o, 1, ...n);
25
+ }
26
+ return e;
27
+ }
28
+ const ye = (e) => {
17
29
  if (!e) return [];
18
30
  try {
19
- return JSON.parse(H(e)).filter((a) => !a._type.startsWith("@chai"));
31
+ return JSON.parse(X(e)).filter((a) => !a._type.startsWith("@chai"));
20
32
  } catch {
21
33
  return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
22
34
  }
23
35
  };
24
- function H(e) {
36
+ function X(e) {
25
37
  const t = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
26
38
  return e.replace(t, (a) => {
27
39
  const r = decodeURIComponent(a), i = r.indexOf("public");
28
40
  return i !== -1 ? r.substring(i + 6) : r;
29
41
  });
30
42
  }
31
- async function Q(e, t, a = [], r = "", i) {
32
- return await W({
43
+ async function Y(e, t, a = [], r = "", i) {
44
+ return await z({
33
45
  tailwindConfig: {
34
46
  darkMode: "class",
35
47
  safelist: a,
36
- theme: { extend: q(e) },
37
- plugins: [U, V, j, z, O],
48
+ theme: { extend: W(e) },
49
+ plugins: [V, G, U, H, O],
38
50
  corePlugins: { preflight: i },
39
51
  ...r ? { prefix: `${r}` } : {}
40
52
  }
@@ -45,11 +57,11 @@ async function Q(e, t, a = [], r = "", i) {
45
57
  t
46
58
  );
47
59
  }
48
- const X = (e, t, a) => {
49
- const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, s) => `#styles:${s.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
50
- return Q(t, [r], [], "", a);
51
- }, ke = async (e, t = F, a = !1) => await X(e, t, a);
52
- async function Y(e) {
60
+ const Z = (e, t, a) => {
61
+ const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, l) => `#styles:${l.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
62
+ return Y(t, [r], [], "", a);
63
+ }, Be = async (e, t = F, a = !1) => await Z(e, t, a);
64
+ async function ee(e) {
53
65
  const t = await e.dataProvider({
54
66
  pageProps: e.pageProps,
55
67
  block: e.block,
@@ -57,86 +69,91 @@ async function Y(e) {
57
69
  draft: e.draft,
58
70
  inBuilder: !1
59
71
  });
60
- return k(t, "$metadata") && S(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, t.$metadata), e.children({
61
- ...J(t, "$metadata")
72
+ return k(t, "$metadata") && x(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, t.$metadata), e.children({
73
+ ...E(t, "$metadata")
62
74
  });
63
75
  }
64
- const Z = () => /* @__PURE__ */ d("div", {}), ee = (e) => {
65
- const { block: t, lang: a, fallbackLang: r, children: i, externalData: s, blocks: n, draft: o, pageProps: p, dataProviderMetadataCallback: m } = e, l = G(t._type), u = g(l, "component", null), b = g(e.repeaterData, "index", -1), x = g(e.repeaterData, "dataKey", ""), c = $(A(t, a === r ? "" : a, l), s, {
76
+ const te = () => /* @__PURE__ */ p("div", {}), ae = (e) => {
77
+ const { block: t, lang: a, fallbackLang: r, children: i, externalData: l, blocks: n, draft: o, pageProps: g, dataProviderMetadataCallback: u } = e, c = Q(t._type), f = s(c, "component", null), b = s(e.repeaterData, "index", -1), S = s(e.repeaterData, "dataKey", ""), d = M($(t, a === r ? "" : a, c), l, {
66
78
  index: b,
67
- key: x
68
- }), I = M(t, !1), T = te(n, t._id, N(t._type)), L = k(l, "dataProvider") && S(l.dataProvider), w = {
79
+ key: S
80
+ }), I = A(t, !1), L = re(n, t._id, N(t._type)), T = k(c, "dataProvider") && x(c.dataProvider), P = {
69
81
  blockProps: {},
70
82
  inBuilder: !1,
71
83
  lang: a || r,
72
- ...c,
84
+ ...d,
73
85
  ...I,
74
- ...T
86
+ ...L
75
87
  };
76
- if (E(u)) return null;
77
- if (L) {
78
- const R = g(l, "suspenseFallback", Z);
79
- return /* @__PURE__ */ d(v, { fallback: f(R), children: /* @__PURE__ */ d(
80
- Y,
88
+ if (K(f)) return null;
89
+ if (T) {
90
+ const D = s(c, "suspenseFallback", te);
91
+ return /* @__PURE__ */ p(v, { fallback: h(D), children: /* @__PURE__ */ p(
92
+ ee,
81
93
  {
82
94
  lang: a,
83
- pageProps: p,
95
+ pageProps: g,
84
96
  block: t,
85
- dataProvider: l.dataProvider,
86
- ...m ? { dataProviderMetadataCallback: m } : {},
97
+ dataProvider: c.dataProvider,
98
+ ...u ? { dataProviderMetadataCallback: u } : {},
87
99
  draft: o,
88
- children: (D) => f(u, {
89
- ...w,
90
- ...D,
100
+ children: (R) => h(f, {
101
+ ...P,
102
+ ...R,
91
103
  children: i({
92
104
  _id: t._id,
93
105
  _type: t._type,
94
- ...P(c.repeaterItems) ? {
95
- repeaterItems: B(c.repeaterItems, t),
96
- repeaterItemsBinding: c.repeaterItemsBinding
106
+ ...B(d.repeaterItems) ? {
107
+ repeaterItems: w(d.repeaterItems, t),
108
+ repeaterItemsBinding: d.repeaterItemsBinding
97
109
  } : {}
98
110
  })
99
111
  })
100
112
  }
101
113
  ) });
102
114
  }
103
- return /* @__PURE__ */ d(v, { children: f(u, {
104
- ...w,
115
+ return /* @__PURE__ */ p(v, { children: h(f, {
116
+ ...P,
105
117
  children: i({
106
118
  _id: t._id,
107
119
  _type: t._type,
108
- ...P(c.repeaterItems) ? {
109
- repeaterItems: B(c.repeaterItems, t),
110
- repeaterItemsBinding: c.repeaterItemsBinding
120
+ ...B(d.repeaterItems) ? {
121
+ repeaterItems: w(d.repeaterItems, t),
122
+ repeaterItemsBinding: d.repeaterItemsBinding
111
123
  } : {}
112
124
  })
113
125
  }) });
114
126
  }, _ = (e) => {
115
- const { blocks: t, parent: a, repeaterData: r } = e, i = C(
116
- t,
117
- (n) => k(n, "_id") && (h(a) ? !n._parent : n._parent === a)
118
- ), s = (n) => C(t, (o) => o._parent === n).length > 0;
119
- return K(i, (n) => n ? /* @__PURE__ */ f(ee, { ...e, key: n._id, block: n }, ({ _id: o, _type: p, repeaterItems: m, repeaterItemsBinding: l }) => p === "Repeater" ? P(m) && m.map((u, b) => /* @__PURE__ */ d(_, { ...e, parent: n._id, repeaterData: { index: b, dataKey: l } })) : s(o) ? /* @__PURE__ */ d(_, { ...e, parent: n._id, repeaterData: r }) : null) : null);
120
- }, te = (e, t, a) => h(a) ? {} : Object.entries(a).reduce((r, [i, s]) => {
127
+ const { blocks: t, parent: a, repeaterData: r } = e;
128
+ let i = j(
129
+ C(t, (n) => k(n, "_id") && (m(a) ? !n._parent : n._parent === a)),
130
+ "_id"
131
+ );
132
+ const l = (n) => C(t, (o) => o._parent === n).length > 0;
133
+ return q(i, (n) => n ? /* @__PURE__ */ h(ae, { ...e, key: n._id, block: n }, ({ _id: o, _type: g, repeaterItems: u, repeaterItemsBinding: c }) => g === "Repeater" ? B(u) && u.map((f, b) => /* @__PURE__ */ p(_, { ...e, parent: n._id, repeaterData: { index: b, dataKey: c } })) : l(o) ? /* @__PURE__ */ p(_, { ...e, parent: n._id, repeaterData: r }) : null) : null);
134
+ }, re = (e, t, a) => m(a) ? {} : Object.entries(a).reduce((r, [i, l]) => {
121
135
  const n = [];
122
136
  let o = y(e, { _id: t });
123
137
  for (; o; )
124
138
  n.push(o), o = y(e, { _id: o._parent });
125
- const p = y(n, { _type: s.block });
126
- return p && (r[i] = g(p, g(s, "prop"), null)), r;
139
+ const g = y(n, { _type: l.block });
140
+ return g && (r[i] = s(g, s(l, "prop"), null)), r;
127
141
  }, {});
128
- function be(e) {
129
- if (k(e, "metadata") && console.warn(" metadata is deprecated and will be removed in upcoming version, use pageProps instead"), h(e.lang) && !h(e.fallbackLang))
142
+ function _e(e) {
143
+ if (k(e, "metadata") && console.warn(" metadata is deprecated and will be removed in upcoming version, use pageProps instead"), m(e.lang) && !m(e.fallbackLang))
130
144
  throw new Error("lang prop is required when fallbackLang is provided");
145
+ if (m(e.blocks))
146
+ return null;
131
147
  const t = e.lang ?? "en", a = e.fallbackLang ?? t;
132
- return /* @__PURE__ */ d(_, { ...e, lang: t, fallbackLang: a });
148
+ return /* @__PURE__ */ p(_, { ...e, lang: t, fallbackLang: a });
133
149
  }
134
150
  export {
135
- be as RenderChaiBlocks,
136
- ve as applyChaiDataBinding,
137
- he as convertToBlocks,
138
- _e as getChaiThemeCssVariables,
139
- ke as getStylesForBlocks,
140
- we as getThemeFontsCSSImport,
141
- Be as getThemeFontsLinkMarkup
151
+ _e as RenderChaiBlocks,
152
+ Ie as applyChaiDataBinding,
153
+ ye as convertToBlocks,
154
+ Ce as getChaiThemeCssVariables,
155
+ be as getMergedPartialBlocks,
156
+ Be as getStylesForBlocks,
157
+ ve as getThemeFontsCSSImport,
158
+ xe as getThemeFontsLinkMarkup
142
159
  };
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.2.15",
8
+ "version": "2.2.16",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",