@chaibuilder/sdk 3.0.7 → 3.0.9

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-CSgw-f78.cjs"),u=require("./apply-binding-HQ9gBNJP.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),$=require("@tailwindcss/forms"),E=require("@tailwindcss/typography");require("tailwindcss-animate");const L=require("./get-chai-builder-theme-B1tr_NJB.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),g=require("react"),M=require("@chaibuilder/runtime");function D(e,r){const a=e.filter(({_type:i})=>i==="GlobalBlock"||i==="PartialBlock");for(let i=0;i<a.length;i++){const s=a[i],l=t.get(s,"partialBlockId",t.get(s,"globalBlock",""));if(l==="")continue;let n=t.cloneDeep(t.get(r,l,[]));s._parent&&(n==null?void 0:n.length)>0&&(n=n.map(c=>(t.isEmpty(c._parent)&&(c._parent=s._parent),c)));const o=e.indexOf(s);e.splice(o,1,...n)}return e}const j=e=>{if(!e)return[];try{return JSON.parse(O(e)).filter(a=>!a._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function O(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,a=>{const i=decodeURIComponent(a),s=i.indexOf("public");return s!==-1?i.substring(s+6):i})}async function A(e,r,a=[],i="",s){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:a,theme:{extend:L.getChaiBuilderTheme(e)},plugins:[$,E,q,R,k.chaiBuilderPlugin],corePlugins:{preflight:s},...i?{prefix:`${i}`}:{}}}).generateStylesFromContent(` ${s?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./plugin-CSgw-f78.cjs"),u=require("./apply-binding-HQ9gBNJP.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),E=require("@tailwindcss/forms"),L=require("@tailwindcss/typography");require("tailwindcss-animate");const $=require("./get-chai-builder-theme-B1tr_NJB.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),g=require("react"),M=require("@chaibuilder/runtime");function D(e,r){const a=e.filter(({_type:i})=>i==="GlobalBlock"||i==="PartialBlock");for(let i=0;i<a.length;i++){const o=a[i],c=t.get(o,"partialBlockId",t.get(o,"globalBlock",""));if(c==="")continue;let n=t.cloneDeep(t.get(r,c,[]));o._parent&&(n==null?void 0:n.length)>0&&(n=n.map(l=>(t.isEmpty(l._parent)&&(l._parent=o._parent),l)));const s=e.indexOf(o);e.splice(s,1,...n)}return e}const j=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(a=>!a._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,a=>{const i=decodeURIComponent(a),o=i.indexOf("public");return o!==-1?i.substring(o+6):i})}async function O(e,r=[],a=!1){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:{...$.getChaiBuilderTheme(),keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}},plugins:[E,L,q,R,y.chaiBuilderPlugin],corePlugins:{preflight:a}}}).generateStylesFromContent(` ${a?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,r)}const K=(e,r,a)=>{const i=JSON.stringify(e).replace(/#styles:([^"]*)/g,(s,l)=>`#styles:${l.replace(/,/g," ")}`.replace(/#styles:/g,""));return A(r,[i],[],"",a)},N=async(e,r=k.defaultThemeOptions,a=!1)=>await K(e,r,a);async function J(e){const r={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},a=await e.dataProvider(r);return t.has(a,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,a.$metadata),e.children({...t.omit(a,"$metadata")})}const V=()=>m.jsx("div",{}),H=e=>{const{block:r,lang:a,fallbackLang:i,children:s,externalData:l,blocks:n,draft:o,pageProps:c,dataProviderMetadataCallback:h}=e,d=M.getRegisteredChaiBlock(r._type),y=t.get(d,"component",null),f=t.get(e.repeaterData,"index",-1),b=t.get(e.repeaterData,"dataKey",""),w=a===i?"":a,p=u.applyBindingToBlockProps(u.applyLanguage(r,w,d),l,{index:f,key:b}),C=u.getBlockTagAttributes(r,!1),S=U(n,r._id,u.getBlockRuntimeProps(r._type)),T=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),B={...p,...C,...S},P={blockProps:{},inBuilder:!1,lang:a||i,...B},v=t.get(B,"_show",!0);if(t.isNull(y)||!v)return null;if(T){const x=t.get(d,"suspenseFallback",V);return m.jsx(g.Suspense,{fallback:g.createElement(x),children:m.jsx(J,{lang:a,pageProps:c,block:B,dataProvider:d.dataProvider,...h?{dataProviderMetadataCallback:h}:{},draft:o,children:I=>g.createElement(y,{...P,...I,children:s({_id:r._id,_type:r._type,...t.isArray(p.repeaterItems)?{repeaterItems:u.applyLimit(p.repeaterItems,r),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})})}return m.jsx(g.Suspense,{children:g.createElement(y,{...P,children:s({_id:r._id,_type:r._type,...t.isArray(p.repeaterItems)?{repeaterItems:u.applyLimit(p.repeaterItems,r),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})},_=e=>{const{blocks:r,parent:a,repeaterData:i}=e;let s=t.uniqBy(t.filter(r,n=>t.has(n,"_id")&&(t.isEmpty(a)?!n._parent:n._parent===a)),"_id");const l=n=>t.filter(r,o=>o._parent===n).length>0;return t.map(s,n=>n?g.createElement(H,{...e,key:n._id,block:n},({_id:o,_type:c,repeaterItems:h,$repeaterItemsKey:d})=>c==="Repeater"?t.isArray(h)&&h.map((y,f)=>g.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}-${f}`,repeaterData:{index:f,dataKey:d}})):l(o)?g.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}`,repeaterData:i}):null):null)},U=(e,r,a)=>t.isEmpty(a)?{}:Object.entries(a).reduce((i,[s,l])=>{const n=[];let o=t.find(e,{_id:r});for(;o;)n.push(o),o=t.find(e,{_id:o._parent});const c=t.find(n,{_type:l.block});return c&&(i[s]=t.get(c,t.get(l,"prop"),null)),i},{});function W(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const r=e.lang??"en",a=e.fallbackLang??r;return m.jsx(_,{...e,lang:r,fallbackLang:a})}exports.getChaiThemeCssVariables=k.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=k.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=k.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=u.applyChaiDataBinding;exports.convertHTMLToChaiBlocks=u.getBlocksFromHTML;exports.RenderChaiBlocks=W;exports.convertToBlocks=j;exports.getMergedPartialBlocks=D;exports.getStylesForBlocks=N;
3
+ @tailwind utilities;`,e)}const K=(e,r)=>{const a=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return O([a],[],r)},N=async(e,r=!1)=>await K(e,r);async function J(e){const r={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},a=await e.dataProvider(r);return t.has(a,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,a.$metadata),e.children({...t.omit(a,"$metadata")})}const V=()=>m.jsx("div",{}),H=e=>{const{block:r,lang:a,fallbackLang:i,children:o,externalData:c,blocks:n,draft:s,pageProps:l,dataProviderMetadataCallback:h}=e,d=M.getRegisteredChaiBlock(r._type),f=t.get(d,"component",null),k=t.get(e.repeaterData,"index",-1),b=t.get(e.repeaterData,"dataKey",""),w=a===i?"":a,p=u.applyBindingToBlockProps(u.applyLanguage(r,w,d),c,{index:k,key:b}),C=u.getBlockTagAttributes(r,!1),S=U(n,r._id,u.getBlockRuntimeProps(r._type)),v=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),B={...p,...C,...S},P={blockProps:{},inBuilder:!1,lang:a||i,...B},T=t.get(B,"_show",!0);if(t.isNull(f)||!T)return null;if(v){const x=t.get(d,"suspenseFallback",V);return m.jsx(g.Suspense,{fallback:g.createElement(x),children:m.jsx(J,{lang:a,pageProps:l,block:B,dataProvider:d.dataProvider,...h?{dataProviderMetadataCallback:h}:{},draft:s,children:I=>g.createElement(f,{...P,...I,children:o({_id:r._id,_type:r._type,...t.isArray(p.repeaterItems)?{repeaterItems:u.applyLimit(p.repeaterItems,r),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})})}return m.jsx(g.Suspense,{children:g.createElement(f,{...P,children:o({_id:r._id,_type:r._type,...t.isArray(p.repeaterItems)?{repeaterItems:u.applyLimit(p.repeaterItems,r),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})},_=e=>{const{blocks:r,parent:a,repeaterData:i}=e;let o=t.uniqBy(t.filter(r,n=>t.has(n,"_id")&&(t.isEmpty(a)?!n._parent:n._parent===a)),"_id");const c=n=>t.filter(r,s=>s._parent===n).length>0;return t.map(o,n=>n?g.createElement(H,{...e,key:n._id,block:n},({_id:s,_type:l,repeaterItems:h,$repeaterItemsKey:d})=>l==="Repeater"?t.isArray(h)&&h.map((f,k)=>g.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}-${k}`,repeaterData:{index:k,dataKey:d}})):c(s)?g.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}`,repeaterData:i}):null):null)},U=(e,r,a)=>t.isEmpty(a)?{}:Object.entries(a).reduce((i,[o,c])=>{const n=[];let s=t.find(e,{_id:r});for(;s;)n.push(s),s=t.find(e,{_id:s._parent});const l=t.find(n,{_type:c.block});return l&&(i[o]=t.get(l,t.get(c,"prop"),null)),i},{});function W(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const r=e.lang??"en",a=e.fallbackLang??r;return m.jsx(_,{...e,lang:r,fallbackLang:a})}exports.getChaiThemeCssVariables=y.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=y.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=y.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=u.applyChaiDataBinding;exports.convertHTMLToChaiBlocks=u.getBlocksFromHTML;exports.RenderChaiBlocks=W;exports.convertToBlocks=j;exports.getMergedPartialBlocks=D;exports.getStylesForBlocks=N;
package/dist/render.d.ts CHANGED
@@ -4,8 +4,6 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
4
4
 
5
5
  export declare const applyChaiDataBinding: (block: Record<string, string>, pageExternalData: Record<string, any>) => any;
6
6
 
7
- declare type BorderRadiusValue = false | string;
8
-
9
7
  declare type ChaiBlock<T = Record<string, any>> = {
10
8
  _id: string;
11
9
  _name?: string;
@@ -15,15 +13,6 @@ declare type ChaiBlock<T = Record<string, any>> = {
15
13
  _libBlock?: string;
16
14
  } & T;
17
15
 
18
- declare type ChaiBuilderThemeOptions = {
19
- fontFamily: false | Record<VariableKey, string>;
20
- borderRadius: BorderRadiusValue;
21
- colors: false | {
22
- group: string;
23
- items: Record<VariableKey, [HSLColor, HSLColor]>;
24
- }[];
25
- };
26
-
27
16
  declare type ChaiThemeValues = {
28
17
  fontFamily: {
29
18
  heading: string;
@@ -74,11 +63,10 @@ export declare function getMergedPartialBlocks(blocks: ChaiBlock[], partials: Re
74
63
  /**
75
64
  * Get the tailwind css for the blocks
76
65
  * @param blocks - The blocks to get the tailwind css for
77
- * @param themeOptions - The theme options to use
78
66
  * @param includeBaseStyles - Whether to include the base styles
79
67
  * @returns The tailwind css for the blocks
80
68
  */
81
- export declare const getStylesForBlocks: (blocks: ChaiBlock[], themeOptions?: ChaiBuilderThemeOptions, includeBaseStyles?: boolean) => Promise<string>;
69
+ export declare const getStylesForBlocks: (blocks: ChaiBlock[], includeBaseStyles?: boolean) => Promise<string>;
82
70
 
83
71
  export declare const getThemeFontsCSSImport: (fonts: ChaiFontViaUrl[]) => any;
84
72
 
@@ -101,8 +89,6 @@ declare type RenderChaiBlocksProps = {
101
89
  dataProviderMetadataCallback?: (block: ChaiBlock, meta: Record<string, any>) => void;
102
90
  };
103
91
 
104
- declare type VariableKey = string;
105
-
106
92
  export { }
107
93
 
108
94
  declare global {
package/dist/render.js CHANGED
@@ -1,67 +1,92 @@
1
- import { d as O, c as K } from "./plugin-BOcGV_IY.js";
2
- import { a as Se, b as xe, e as Ie } from "./plugin-BOcGV_IY.js";
3
- import { a as M, b as A, g as N, c as J, d as C } from "./apply-binding-tfi-KyyV.js";
4
- import { e as Te, f as Le } from "./apply-binding-tfi-KyyV.js";
5
- import { get as s, cloneDeep as E, isEmpty as u, has as b, isFunction as x, omit as j, isNull as q, isArray as B, uniqBy as U, filter as v, map as V, find as _ } from "lodash-es";
6
- import W from "@tailwindcss/aspect-ratio";
7
- import G from "@tailwindcss/forms";
8
- import H from "@tailwindcss/typography";
1
+ import { c as K } from "./plugin-BOcGV_IY.js";
2
+ import { a as Ce, b as xe, e as Se } from "./plugin-BOcGV_IY.js";
3
+ import { a as M, b as O, g as A, c as N, d as v } from "./apply-binding-tfi-KyyV.js";
4
+ import { e as $e, f as Te } from "./apply-binding-tfi-KyyV.js";
5
+ import { get as l, cloneDeep as J, isEmpty as g, has as b, isFunction as S, omit as E, isNull as j, isArray as B, uniqBy as q, filter as C, map as U, find as _ } from "lodash-es";
6
+ import V from "@tailwindcss/aspect-ratio";
7
+ import W from "@tailwindcss/forms";
8
+ import G from "@tailwindcss/typography";
9
9
  import "tailwindcss-animate";
10
- import { g as z } from "./get-chai-builder-theme-BarMkcGH.js";
11
- import { createTailwindcss as Q } from "@mhsdesign/jit-browser-tailwindcss";
12
- import X from "@tailwindcss/container-queries";
10
+ import { g as H } from "./get-chai-builder-theme-BarMkcGH.js";
11
+ import { createTailwindcss as z } from "@mhsdesign/jit-browser-tailwindcss";
12
+ import Q from "@tailwindcss/container-queries";
13
13
  import { jsx as m } from "react/jsx-runtime";
14
- import { Suspense as S, createElement as g } from "react";
15
- import { getRegisteredChaiBlock as Y } from "@chaibuilder/runtime";
16
- function Be(e, t) {
14
+ import { Suspense as x, createElement as u } from "react";
15
+ import { getRegisteredChaiBlock as X } from "@chaibuilder/runtime";
16
+ function _e(e, t) {
17
17
  const a = e.filter(({ _type: n }) => n === "GlobalBlock" || n === "PartialBlock");
18
18
  for (let n = 0; n < a.length; n++) {
19
- const i = a[n], o = s(i, "partialBlockId", s(i, "globalBlock", ""));
20
- if (o === "") continue;
21
- let r = E(s(t, o, []));
22
- i._parent && (r == null ? void 0 : r.length) > 0 && (r = r.map((c) => (u(c._parent) && (c._parent = i._parent), c)));
23
- const l = e.indexOf(i);
24
- e.splice(l, 1, ...r);
19
+ const i = a[n], c = l(i, "partialBlockId", l(i, "globalBlock", ""));
20
+ if (c === "") continue;
21
+ let r = J(l(t, c, []));
22
+ i._parent && (r == null ? void 0 : r.length) > 0 && (r = r.map((s) => (g(s._parent) && (s._parent = i._parent), s)));
23
+ const o = e.indexOf(i);
24
+ e.splice(o, 1, ...r);
25
25
  }
26
26
  return e;
27
27
  }
28
- const Pe = (e) => {
28
+ const Be = (e) => {
29
29
  if (!e) return [];
30
30
  try {
31
- return JSON.parse(Z(e)).filter((a) => !a._type.startsWith("@chai"));
31
+ return JSON.parse(Y(e)).filter((a) => !a._type.startsWith("@chai"));
32
32
  } catch {
33
33
  return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
34
34
  }
35
35
  };
36
- function Z(e) {
36
+ function Y(e) {
37
37
  const t = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
38
38
  return e.replace(t, (a) => {
39
39
  const n = decodeURIComponent(a), i = n.indexOf("public");
40
40
  return i !== -1 ? n.substring(i + 6) : n;
41
41
  });
42
42
  }
43
- async function ee(e, t, a = [], n = "", i) {
44
- return await Q({
43
+ async function Z(e, t = [], a = !1) {
44
+ return await z({
45
45
  tailwindConfig: {
46
46
  darkMode: "class",
47
- safelist: a,
48
- theme: { extend: z(e) },
49
- plugins: [G, H, W, X, K],
50
- corePlugins: { preflight: i },
51
- ...n ? { prefix: `${n}` } : {}
47
+ safelist: t,
48
+ theme: {
49
+ extend: {
50
+ ...H(),
51
+ keyframes: {
52
+ "accordion-down": {
53
+ from: {
54
+ height: "0"
55
+ },
56
+ to: {
57
+ height: "var(--radix-accordion-content-height)"
58
+ }
59
+ },
60
+ "accordion-up": {
61
+ from: {
62
+ height: "var(--radix-accordion-content-height)"
63
+ },
64
+ to: {
65
+ height: "0"
66
+ }
67
+ }
68
+ },
69
+ animation: {
70
+ "accordion-down": "accordion-down 0.2s ease-out",
71
+ "accordion-up": "accordion-up 0.2s ease-out"
72
+ }
73
+ }
74
+ },
75
+ plugins: [W, G, V, Q, K],
76
+ corePlugins: { preflight: a }
52
77
  }
53
78
  }).generateStylesFromContent(
54
- ` ${i ? "@tailwind base;" : ""}
79
+ ` ${a ? "@tailwind base;" : ""}
55
80
  @tailwind components;
56
81
  @tailwind utilities;`,
57
- t
82
+ e
58
83
  );
59
84
  }
60
- const te = (e, t, a) => {
61
- const n = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, o) => `#styles:${o.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
62
- return ee(t, [n], [], "", a);
63
- }, be = async (e, t = O, a = !1) => await te(e, t, a);
64
- async function ae(e) {
85
+ const ee = (e, t) => {
86
+ const a = JSON.stringify(e).replace(/#styles:([^"]*)/g, (n, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
87
+ return Z([a], [], t);
88
+ }, Pe = async (e, t = !1) => await ee(e, t);
89
+ async function te(e) {
65
90
  const t = {
66
91
  pageProps: e.pageProps,
67
92
  block: e.block,
@@ -69,16 +94,16 @@ async function ae(e) {
69
94
  draft: e.draft,
70
95
  inBuilder: !1
71
96
  }, a = await e.dataProvider(t);
72
- return b(a, "$metadata") && x(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, a.$metadata), e.children({
73
- ...j(a, "$metadata")
97
+ return b(a, "$metadata") && S(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, a.$metadata), e.children({
98
+ ...E(a, "$metadata")
74
99
  });
75
100
  }
76
- const re = () => /* @__PURE__ */ m("div", {}), ne = (e) => {
77
- const { block: t, lang: a, fallbackLang: n, children: i, externalData: o, blocks: r, draft: l, pageProps: c, dataProviderMetadataCallback: f } = e, d = Y(t._type), h = s(d, "component", null), k = s(e.repeaterData, "index", -1), I = s(e.repeaterData, "dataKey", ""), p = M(
78
- A(t, a === n ? "" : a, d),
79
- o,
101
+ const ae = () => /* @__PURE__ */ m("div", {}), re = (e) => {
102
+ const { block: t, lang: a, fallbackLang: n, children: i, externalData: c, blocks: r, draft: o, pageProps: s, dataProviderMetadataCallback: f } = e, d = X(t._type), h = l(d, "component", null), k = l(e.repeaterData, "index", -1), I = l(e.repeaterData, "dataKey", ""), p = M(
103
+ O(t, a === n ? "" : a, d),
104
+ c,
80
105
  { index: k, key: I }
81
- ), $ = N(t, !1), T = ie(r, t._id, J(t._type)), L = b(d, "dataProvider") && x(d.dataProvider), y = {
106
+ ), $ = A(t, !1), T = ne(r, t._id, N(t._type)), L = b(d, "dataProvider") && S(d.dataProvider), y = {
82
107
  ...p,
83
108
  ...$,
84
109
  ...T
@@ -87,27 +112,27 @@ const re = () => /* @__PURE__ */ m("div", {}), ne = (e) => {
87
112
  inBuilder: !1,
88
113
  lang: a || n,
89
114
  ...y
90
- }, D = s(y, "_show", !0);
91
- if (q(h) || !D) return null;
115
+ }, D = l(y, "_show", !0);
116
+ if (j(h) || !D) return null;
92
117
  if (L) {
93
- const R = s(d, "suspenseFallback", re);
94
- return /* @__PURE__ */ m(S, { fallback: g(R), children: /* @__PURE__ */ m(
95
- ae,
118
+ const R = l(d, "suspenseFallback", ae);
119
+ return /* @__PURE__ */ m(x, { fallback: u(R), children: /* @__PURE__ */ m(
120
+ te,
96
121
  {
97
122
  lang: a,
98
- pageProps: c,
123
+ pageProps: s,
99
124
  block: y,
100
125
  dataProvider: d.dataProvider,
101
126
  ...f ? { dataProviderMetadataCallback: f } : {},
102
- draft: l,
103
- children: (F) => g(h, {
127
+ draft: o,
128
+ children: (F) => u(h, {
104
129
  ...w,
105
130
  ...F,
106
131
  children: i({
107
132
  _id: t._id,
108
133
  _type: t._type,
109
134
  ...B(p.repeaterItems) ? {
110
- repeaterItems: C(p.repeaterItems, t),
135
+ repeaterItems: v(p.repeaterItems, t),
111
136
  $repeaterItemsKey: p.$repeaterItemsKey
112
137
  } : {}
113
138
  })
@@ -115,65 +140,65 @@ const re = () => /* @__PURE__ */ m("div", {}), ne = (e) => {
115
140
  }
116
141
  ) });
117
142
  }
118
- return /* @__PURE__ */ m(S, { children: g(h, {
143
+ return /* @__PURE__ */ m(x, { children: u(h, {
119
144
  ...w,
120
145
  children: i({
121
146
  _id: t._id,
122
147
  _type: t._type,
123
148
  ...B(p.repeaterItems) ? {
124
- repeaterItems: C(p.repeaterItems, t),
149
+ repeaterItems: v(p.repeaterItems, t),
125
150
  $repeaterItemsKey: p.$repeaterItemsKey
126
151
  } : {}
127
152
  })
128
153
  }) });
129
154
  }, P = (e) => {
130
155
  const { blocks: t, parent: a, repeaterData: n } = e;
131
- let i = U(
132
- v(t, (r) => b(r, "_id") && (u(a) ? !r._parent : r._parent === a)),
156
+ let i = q(
157
+ C(t, (r) => b(r, "_id") && (g(a) ? !r._parent : r._parent === a)),
133
158
  "_id"
134
159
  );
135
- const o = (r) => v(t, (l) => l._parent === r).length > 0;
136
- return V(i, (r) => r ? /* @__PURE__ */ g(ne, { ...e, key: r._id, block: r }, ({ _id: l, _type: c, repeaterItems: f, $repeaterItemsKey: d }) => c === "Repeater" ? B(f) && f.map((h, k) => /* @__PURE__ */ g(
160
+ const c = (r) => C(t, (o) => o._parent === r).length > 0;
161
+ return U(i, (r) => r ? /* @__PURE__ */ u(re, { ...e, key: r._id, block: r }, ({ _id: o, _type: s, repeaterItems: f, $repeaterItemsKey: d }) => s === "Repeater" ? B(f) && f.map((h, k) => /* @__PURE__ */ u(
137
162
  P,
138
163
  {
139
164
  ...e,
140
165
  parent: r._id,
141
- key: `${s(r, "_parent", "root")}-${r._id}-${k}`,
166
+ key: `${l(r, "_parent", "root")}-${r._id}-${k}`,
142
167
  repeaterData: { index: k, dataKey: d }
143
168
  }
144
- )) : o(l) ? /* @__PURE__ */ g(
169
+ )) : c(o) ? /* @__PURE__ */ u(
145
170
  P,
146
171
  {
147
172
  ...e,
148
173
  parent: r._id,
149
- key: `${s(r, "_parent", "root")}-${r._id}`,
174
+ key: `${l(r, "_parent", "root")}-${r._id}`,
150
175
  repeaterData: n
151
176
  }
152
177
  ) : null) : null);
153
- }, ie = (e, t, a) => u(a) ? {} : Object.entries(a).reduce((n, [i, o]) => {
178
+ }, ne = (e, t, a) => g(a) ? {} : Object.entries(a).reduce((n, [i, c]) => {
154
179
  const r = [];
155
- let l = _(e, { _id: t });
156
- for (; l; )
157
- r.push(l), l = _(e, { _id: l._parent });
158
- const c = _(r, { _type: o.block });
159
- return c && (n[i] = s(c, s(o, "prop"), null)), n;
180
+ let o = _(e, { _id: t });
181
+ for (; o; )
182
+ r.push(o), o = _(e, { _id: o._parent });
183
+ const s = _(r, { _type: c.block });
184
+ return s && (n[i] = l(s, l(c, "prop"), null)), n;
160
185
  }, {});
161
- function we(e) {
162
- if (u(e.lang) && !u(e.fallbackLang))
186
+ function be(e) {
187
+ if (g(e.lang) && !g(e.fallbackLang))
163
188
  throw new Error("lang prop is required when fallbackLang is provided");
164
- if (u(e.blocks))
189
+ if (g(e.blocks))
165
190
  return null;
166
191
  const t = e.lang ?? "en", a = e.fallbackLang ?? t;
167
192
  return /* @__PURE__ */ m(P, { ...e, lang: t, fallbackLang: a });
168
193
  }
169
194
  export {
170
- we as RenderChaiBlocks,
171
- Te as applyChaiDataBinding,
172
- Le as convertHTMLToChaiBlocks,
173
- Pe as convertToBlocks,
174
- Se as getChaiThemeCssVariables,
175
- Be as getMergedPartialBlocks,
176
- be as getStylesForBlocks,
195
+ be as RenderChaiBlocks,
196
+ $e as applyChaiDataBinding,
197
+ Te as convertHTMLToChaiBlocks,
198
+ Be as convertToBlocks,
199
+ Ce as getChaiThemeCssVariables,
200
+ _e as getMergedPartialBlocks,
201
+ Pe as getStylesForBlocks,
177
202
  xe as getThemeFontsCSSImport,
178
- Ie as getThemeFontsLinkMarkup
203
+ Se as getThemeFontsLinkMarkup
179
204
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "3.0.7",
8
+ "version": "3.0.9",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",