@chaibuilder/sdk 2.4.2 → 2.4.4

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 y=require("./plugin-CSgw-f78.cjs"),p=require("./apply-binding-DpBwzIf9.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),$=require("@tailwindcss/forms"),E=require("@tailwindcss/typography");require("tailwindcss-animate");const F=require("./get-chai-builder-theme-B1tr_NJB.cjs"),L=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),u=require("react"),D=require("@chaibuilder/runtime");function M(e,a){const r=e.filter(({_type:n})=>n==="GlobalBlock"||n==="PartialBlock");for(let n=0;n<r.length;n++){const l=r[n],s=t.get(l,"partialBlockId",t.get(l,"globalBlock",""));if(s==="")continue;let i=t.cloneDeep(t.get(a,s,[]));l._parent&&(i==null?void 0:i.length)>0&&(i=i.map(c=>(t.isEmpty(c._parent)&&(c._parent=l._parent),c)));const o=e.indexOf(l);e.splice(o,1,...i)}return e}const O=e=>{if(!e)return[];try{return JSON.parse(j(e)).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function j(e){const a=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(a,r=>{const n=decodeURIComponent(r),l=n.indexOf("public");return l!==-1?n.substring(l+6):n})}async function K(e,a,r=[],n="",l){return await L.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:F.getChaiBuilderTheme(e)},plugins:[$,E,q,R,y.chaiBuilderPlugin],corePlugins:{preflight:l},...n?{prefix:`${n}`}:{}}}).generateStylesFromContent(` ${l?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./plugin-CSgw-f78.cjs"),p=require("./apply-binding-DpBwzIf9.cjs"),t=require("lodash-es"),I=require("@tailwindcss/aspect-ratio"),q=require("@tailwindcss/forms"),$=require("@tailwindcss/typography");require("tailwindcss-animate");const E=require("./get-chai-builder-theme-B1tr_NJB.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),L=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),u=require("react"),R=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 l=a[i],s=t.get(l,"partialBlockId",t.get(l,"globalBlock",""));if(s==="")continue;let n=t.cloneDeep(t.get(r,s,[]));l._parent&&(n==null?void 0:n.length)>0&&(n=n.map(c=>(t.isEmpty(c._parent)&&(c._parent=l._parent),c)));const o=e.indexOf(l);e.splice(o,1,...n)}return e}const j=e=>{if(!e)return[];try{return JSON.parse(M(e)).filter(a=>!a._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function M(e){const r=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(r,a=>{const i=decodeURIComponent(a),l=i.indexOf("public");return l!==-1?i.substring(l+6):i})}async function O(e,r,a=[],i="",l){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:a,theme:{extend:E.getChaiBuilderTheme(e)},plugins:[q,$,I,L,y.chaiBuilderPlugin],corePlugins:{preflight:l},...i?{prefix:`${i}`}:{}}}).generateStylesFromContent(` ${l?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,a)}const A=(e,a,r)=>{const n=JSON.stringify(e).replace(/#styles:([^"]*)/g,(l,s)=>`#styles:${s.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(a,[n],[],"",r)},N=async(e,a=y.defaultThemeOptions,r=!1)=>await A(e,a,r),_=new Map;function J(e){return JSON.stringify({blockType:t.omit(e.block,"_id","_name","_parent"),lang:e.lang})}async function V(e){const a={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},r=J(t.pick(a,["block","lang"]));let n=_.get(r);n||(n=Promise.resolve(e.dataProvider(a)),_.set(r,n),setTimeout(()=>{_.delete(r)},5*1e3));const l=await n;return t.has(l,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,l.$metadata),e.children({...t.omit(l,"$metadata")})}const U=()=>m.jsx("div",{}),W=e=>{const{block:a,lang:r,fallbackLang:n,children:l,externalData:s,blocks:i,draft:o,pageProps:c,dataProviderMetadataCallback:h}=e,d=D.getRegisteredChaiBlock(a._type),f=t.get(d,"component",null),k=t.get(e.repeaterData,"index",-1),C=t.get(e.repeaterData,"dataKey",""),w=r===n?"":r,g=p.applyBindingToBlockProps(p.applyLanguage(a,w,d),s,{index:k,key:C}),S=p.getBlockTagAttributes(a,!1),T=G(i,a._id,p.getBlockRuntimeProps(a._type)),v=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),P={...g,...S,...T},b={blockProps:{},inBuilder:!1,lang:r||n,...P};if(t.isNull(f))return null;if(v){const x=t.get(d,"suspenseFallback",U);return m.jsx(u.Suspense,{fallback:u.createElement(x),children:m.jsx(V,{lang:r,pageProps:c,block:P,dataProvider:d.dataProvider,...h?{dataProviderMetadataCallback:h}:{},draft:o,children:I=>u.createElement(f,{...b,...I,children:l({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})})}return m.jsx(u.Suspense,{children:u.createElement(f,{...b,children:l({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})},B=e=>{const{blocks:a,parent:r,repeaterData:n}=e;let l=t.uniqBy(t.filter(a,i=>t.has(i,"_id")&&(t.isEmpty(r)?!i._parent:i._parent===r)),"_id");const s=i=>t.filter(a,o=>o._parent===i).length>0;return t.map(l,i=>i?u.createElement(W,{...e,key:i._id,block:i},({_id:o,_type:c,repeaterItems:h,$repeaterItemsKey:d})=>c==="Repeater"?t.isArray(h)&&h.map((f,k)=>u.createElement(B,{...e,parent:i._id,key:`${t.get(i,"_parent","root")}-${i._id}-${k}`,repeaterData:{index:k,dataKey:d}})):s(o)?u.createElement(B,{...e,parent:i._id,key:`${t.get(i,"_parent","root")}-${i._id}`,repeaterData:n}):null):null)},G=(e,a,r)=>t.isEmpty(r)?{}:Object.entries(r).reduce((n,[l,s])=>{const i=[];let o=t.find(e,{_id:a});for(;o;)i.push(o),o=t.find(e,{_id:o._parent});const c=t.find(i,{_type:s.block});return c&&(n[l]=t.get(c,t.get(s,"prop"),null)),n},{});function z(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 a=e.lang??"en",r=e.fallbackLang??a;return m.jsx(B,{...e,lang:a,fallbackLang:r})}exports.getChaiThemeCssVariables=y.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=y.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=y.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=p.applyChaiDataBinding;exports.RenderChaiBlocks=z;exports.convertToBlocks=O;exports.getMergedPartialBlocks=M;exports.getStylesForBlocks=N;
3
+ @tailwind utilities;`,r)}const A=(e,r,a)=>{const i=JSON.stringify(e).replace(/#styles:([^"]*)/g,(l,s)=>`#styles:${s.replace(/,/g," ")}`.replace(/#styles:/g,""));return O(r,[i],[],"",a)},K=async(e,r=y.defaultThemeOptions,a=!1)=>await A(e,r,a);async function N(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 J=()=>m.jsx("div",{}),V=e=>{const{block:r,lang:a,fallbackLang:i,children:l,externalData:s,blocks:n,draft:o,pageProps:c,dataProviderMetadataCallback:h}=e,d=R.getRegisteredChaiBlock(r._type),f=t.get(d,"component",null),k=t.get(e.repeaterData,"index",-1),b=t.get(e.repeaterData,"dataKey",""),C=a===i?"":a,g=p.applyBindingToBlockProps(p.applyLanguage(r,C,d),s,{index:k,key:b}),w=p.getBlockTagAttributes(r,!1),S=U(n,r._id,p.getBlockRuntimeProps(r._type)),T=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),_={...g,...w,...S},P={blockProps:{},inBuilder:!1,lang:a||i,..._};if(t.isNull(f))return null;if(T){const v=t.get(d,"suspenseFallback",J);return m.jsx(u.Suspense,{fallback:u.createElement(v),children:m.jsx(N,{lang:a,pageProps:c,block:_,dataProvider:d.dataProvider,...h?{dataProviderMetadataCallback:h}:{},draft:o,children:x=>u.createElement(f,{...P,...x,children:l({_id:r._id,_type:r._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,r),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})})}return m.jsx(u.Suspense,{children:u.createElement(f,{...P,children:l({_id:r._id,_type:r._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,r),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})},B=e=>{const{blocks:r,parent:a,repeaterData:i}=e;let l=t.uniqBy(t.filter(r,n=>t.has(n,"_id")&&(t.isEmpty(a)?!n._parent:n._parent===a)),"_id");const s=n=>t.filter(r,o=>o._parent===n).length>0;return t.map(l,n=>n?u.createElement(V,{...e,key:n._id,block:n},({_id:o,_type:c,repeaterItems:h,$repeaterItemsKey:d})=>c==="Repeater"?t.isArray(h)&&h.map((f,k)=>u.createElement(B,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}-${k}`,repeaterData:{index:k,dataKey:d}})):s(o)?u.createElement(B,{...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,[l,s])=>{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:s.block});return c&&(i[l]=t.get(c,t.get(s,"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(B,{...e,lang:r,fallbackLang:a})}exports.getChaiThemeCssVariables=y.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=y.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=y.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=p.applyChaiDataBinding;exports.RenderChaiBlocks=W;exports.convertToBlocks=j;exports.getMergedPartialBlocks=D;exports.getStylesForBlocks=K;
package/dist/render.js CHANGED
@@ -1,54 +1,54 @@
1
- import { d as F, c as M } from "./plugin-BOcGV_IY.js";
2
- import { a as Ie, b as $e, e as Te } from "./plugin-BOcGV_IY.js";
3
- import { a as A, b as N, g as J, c as E, d as v } from "./apply-binding-CkrtJykq.js";
4
- import { e as De } from "./apply-binding-CkrtJykq.js";
5
- import { get as s, cloneDeep as j, isEmpty as g, pick as q, has as B, isFunction as I, omit as $, isNull as U, isArray as P, uniqBy as V, filter as S, map as W, find as y } from "lodash-es";
6
- import G from "@tailwindcss/aspect-ratio";
7
- import z from "@tailwindcss/forms";
8
- import H from "@tailwindcss/typography";
1
+ import { d as F, c as O } from "./plugin-BOcGV_IY.js";
2
+ import { a as ve, b as Se, e as xe } from "./plugin-BOcGV_IY.js";
3
+ import { a as K, b as A, g as M, c as N, d as C } from "./apply-binding-CkrtJykq.js";
4
+ import { e as $e } from "./apply-binding-CkrtJykq.js";
5
+ import { get as s, cloneDeep as J, isEmpty as u, has as b, isFunction as x, omit as E, isNull as j, isArray as _, uniqBy as q, filter as v, map as U, find as y } 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 Q } from "./get-chai-builder-theme-BarMkcGH.js";
11
- import { createTailwindcss as X } from "@mhsdesign/jit-browser-tailwindcss";
12
- import Y from "@tailwindcss/container-queries";
13
- import { jsx as f } from "react/jsx-runtime";
14
- import { Suspense as x, createElement as u } from "react";
15
- import { getRegisteredChaiBlock as Z } 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], o = s(i, "partialBlockId", s(i, "globalBlock", ""));
20
- if (o === "") continue;
21
- let n = j(s(t, o, []));
22
- i._parent && (n == null ? void 0 : n.length) > 0 && (n = n.map((c) => (g(c._parent) && (c._parent = i._parent), c)));
23
- const l = e.indexOf(i);
24
- e.splice(l, 1, ...n);
10
+ import { g as z } from "./get-chai-builder-theme-BarMkcGH.js";
11
+ import { createTailwindcss as H } from "@mhsdesign/jit-browser-tailwindcss";
12
+ import Q from "@tailwindcss/container-queries";
13
+ import { jsx as m } from "react/jsx-runtime";
14
+ import { Suspense as S, createElement as g } from "react";
15
+ import { getRegisteredChaiBlock as X } from "@chaibuilder/runtime";
16
+ function _e(e, t) {
17
+ const a = e.filter(({ _type: n }) => n === "GlobalBlock" || n === "PartialBlock");
18
+ for (let n = 0; n < a.length; n++) {
19
+ const i = a[n], l = s(i, "partialBlockId", s(i, "globalBlock", ""));
20
+ if (l === "") continue;
21
+ let r = J(s(t, l, []));
22
+ i._parent && (r == null ? void 0 : r.length) > 0 && (r = r.map((c) => (u(c._parent) && (c._parent = i._parent), c)));
23
+ const o = e.indexOf(i);
24
+ e.splice(o, 1, ...r);
25
25
  }
26
26
  return e;
27
27
  }
28
- const we = (e) => {
28
+ const Pe = (e) => {
29
29
  if (!e) return [];
30
30
  try {
31
- return JSON.parse(ee(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 ee(e) {
36
+ function Y(e) {
37
37
  const t = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
38
38
  return e.replace(t, (a) => {
39
- const r = decodeURIComponent(a), i = r.indexOf("public");
40
- return i !== -1 ? r.substring(i + 6) : r;
39
+ const n = decodeURIComponent(a), i = n.indexOf("public");
40
+ return i !== -1 ? n.substring(i + 6) : n;
41
41
  });
42
42
  }
43
- async function te(e, t, a = [], r = "", i) {
44
- return await X({
43
+ async function Z(e, t, a = [], n = "", i) {
44
+ return await H({
45
45
  tailwindConfig: {
46
46
  darkMode: "class",
47
47
  safelist: a,
48
- theme: { extend: Q(e) },
49
- plugins: [z, H, G, Y, M],
48
+ theme: { extend: z(e) },
49
+ plugins: [W, G, V, Q, O],
50
50
  corePlugins: { preflight: i },
51
- ...r ? { prefix: `${r}` } : {}
51
+ ...n ? { prefix: `${n}` } : {}
52
52
  }
53
53
  }).generateStylesFromContent(
54
54
  ` ${i ? "@tailwind base;" : ""}
@@ -57,68 +57,57 @@ async function te(e, t, a = [], r = "", i) {
57
57
  t
58
58
  );
59
59
  }
60
- const ae = (e, t, a) => {
61
- const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, o) => `#styles:${o.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
62
- return te(t, [r], [], "", a);
63
- }, Ce = async (e, t = F, a = !1) => await ae(e, t, a), _ = /* @__PURE__ */ new Map();
64
- function re(e) {
65
- return JSON.stringify({
66
- blockType: $(e.block, "_id", "_name", "_parent"),
67
- lang: e.lang
68
- });
69
- }
70
- async function ne(e) {
60
+ const ee = (e, t, a) => {
61
+ const n = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, l) => `#styles:${l.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
62
+ return Z(t, [n], [], "", a);
63
+ }, be = async (e, t = F, a = !1) => await ee(e, t, a);
64
+ async function te(e) {
71
65
  const t = {
72
66
  pageProps: e.pageProps,
73
67
  block: e.block,
74
68
  lang: e.lang,
75
69
  draft: e.draft,
76
70
  inBuilder: !1
77
- }, a = re(q(t, ["block", "lang"]));
78
- let r = _.get(a);
79
- r || (r = Promise.resolve(e.dataProvider(t)), _.set(a, r), setTimeout(() => {
80
- _.delete(a);
81
- }, 5 * 1e3));
82
- const i = await r;
83
- return B(i, "$metadata") && I(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, i.$metadata), e.children({
84
- ...$(i, "$metadata")
71
+ }, a = await e.dataProvider(t);
72
+ return b(a, "$metadata") && x(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, a.$metadata), e.children({
73
+ ...E(a, "$metadata")
85
74
  });
86
75
  }
87
- const ie = () => /* @__PURE__ */ f("div", {}), oe = (e) => {
88
- const { block: t, lang: a, fallbackLang: r, children: i, externalData: o, blocks: n, draft: l, pageProps: c, dataProviderMetadataCallback: m } = e, d = Z(t._type), h = s(d, "component", null), k = s(e.repeaterData, "index", -1), T = s(e.repeaterData, "dataKey", ""), p = A(
89
- N(t, a === r ? "" : a, d),
90
- o,
91
- { index: k, key: T }
92
- ), L = J(t, !1), D = le(n, t._id, E(t._type)), K = B(d, "dataProvider") && I(d.dataProvider), w = {
76
+ const ae = () => /* @__PURE__ */ m("div", {}), re = (e) => {
77
+ const { block: t, lang: a, fallbackLang: n, children: i, externalData: l, blocks: r, draft: o, pageProps: c, dataProviderMetadataCallback: f } = e, d = X(t._type), h = s(d, "component", null), k = s(e.repeaterData, "index", -1), I = s(e.repeaterData, "dataKey", ""), p = K(
78
+ A(t, a === n ? "" : a, d),
79
+ l,
80
+ { index: k, key: I }
81
+ ), $ = M(t, !1), T = ne(r, t._id, N(t._type)), L = b(d, "dataProvider") && x(d.dataProvider), B = {
93
82
  ...p,
94
- ...L,
95
- ...D
96
- }, C = {
83
+ ...$,
84
+ ...T
85
+ }, w = {
97
86
  blockProps: {},
98
87
  inBuilder: !1,
99
- lang: a || r,
100
- ...w
88
+ lang: a || n,
89
+ ...B
101
90
  };
102
- if (U(h)) return null;
103
- if (K) {
104
- const O = s(d, "suspenseFallback", ie);
105
- return /* @__PURE__ */ f(x, { fallback: u(O), children: /* @__PURE__ */ f(
106
- ne,
91
+ if (j(h)) return null;
92
+ if (L) {
93
+ const D = s(d, "suspenseFallback", ae);
94
+ return /* @__PURE__ */ m(S, { fallback: g(D), children: /* @__PURE__ */ m(
95
+ te,
107
96
  {
108
97
  lang: a,
109
98
  pageProps: c,
110
- block: w,
99
+ block: B,
111
100
  dataProvider: d.dataProvider,
112
- ...m ? { dataProviderMetadataCallback: m } : {},
113
- draft: l,
114
- children: (R) => u(h, {
115
- ...C,
101
+ ...f ? { dataProviderMetadataCallback: f } : {},
102
+ draft: o,
103
+ children: (R) => g(h, {
104
+ ...w,
116
105
  ...R,
117
106
  children: i({
118
107
  _id: t._id,
119
108
  _type: t._type,
120
- ...P(p.repeaterItems) ? {
121
- repeaterItems: v(p.repeaterItems, t),
109
+ ..._(p.repeaterItems) ? {
110
+ repeaterItems: C(p.repeaterItems, t),
122
111
  $repeaterItemsKey: p.$repeaterItemsKey
123
112
  } : {}
124
113
  })
@@ -126,64 +115,64 @@ const ie = () => /* @__PURE__ */ f("div", {}), oe = (e) => {
126
115
  }
127
116
  ) });
128
117
  }
129
- return /* @__PURE__ */ f(x, { children: u(h, {
130
- ...C,
118
+ return /* @__PURE__ */ m(S, { children: g(h, {
119
+ ...w,
131
120
  children: i({
132
121
  _id: t._id,
133
122
  _type: t._type,
134
- ...P(p.repeaterItems) ? {
135
- repeaterItems: v(p.repeaterItems, t),
123
+ ..._(p.repeaterItems) ? {
124
+ repeaterItems: C(p.repeaterItems, t),
136
125
  $repeaterItemsKey: p.$repeaterItemsKey
137
126
  } : {}
138
127
  })
139
128
  }) });
140
- }, b = (e) => {
141
- const { blocks: t, parent: a, repeaterData: r } = e;
142
- let i = V(
143
- S(t, (n) => B(n, "_id") && (g(a) ? !n._parent : n._parent === a)),
129
+ }, P = (e) => {
130
+ const { blocks: t, parent: a, repeaterData: n } = e;
131
+ let i = q(
132
+ v(t, (r) => b(r, "_id") && (u(a) ? !r._parent : r._parent === a)),
144
133
  "_id"
145
134
  );
146
- const o = (n) => S(t, (l) => l._parent === n).length > 0;
147
- return W(i, (n) => n ? /* @__PURE__ */ u(oe, { ...e, key: n._id, block: n }, ({ _id: l, _type: c, repeaterItems: m, $repeaterItemsKey: d }) => c === "Repeater" ? P(m) && m.map((h, k) => /* @__PURE__ */ u(
148
- b,
135
+ const l = (r) => v(t, (o) => o._parent === r).length > 0;
136
+ return U(i, (r) => r ? /* @__PURE__ */ g(re, { ...e, key: r._id, block: r }, ({ _id: o, _type: c, repeaterItems: f, $repeaterItemsKey: d }) => c === "Repeater" ? _(f) && f.map((h, k) => /* @__PURE__ */ g(
137
+ P,
149
138
  {
150
139
  ...e,
151
- parent: n._id,
152
- key: `${s(n, "_parent", "root")}-${n._id}-${k}`,
140
+ parent: r._id,
141
+ key: `${s(r, "_parent", "root")}-${r._id}-${k}`,
153
142
  repeaterData: { index: k, dataKey: d }
154
143
  }
155
- )) : o(l) ? /* @__PURE__ */ u(
156
- b,
144
+ )) : l(o) ? /* @__PURE__ */ g(
145
+ P,
157
146
  {
158
147
  ...e,
159
- parent: n._id,
160
- key: `${s(n, "_parent", "root")}-${n._id}`,
161
- repeaterData: r
148
+ parent: r._id,
149
+ key: `${s(r, "_parent", "root")}-${r._id}`,
150
+ repeaterData: n
162
151
  }
163
152
  ) : null) : null);
164
- }, le = (e, t, a) => g(a) ? {} : Object.entries(a).reduce((r, [i, o]) => {
165
- const n = [];
166
- let l = y(e, { _id: t });
167
- for (; l; )
168
- n.push(l), l = y(e, { _id: l._parent });
169
- const c = y(n, { _type: o.block });
170
- return c && (r[i] = s(c, s(o, "prop"), null)), r;
153
+ }, ne = (e, t, a) => u(a) ? {} : Object.entries(a).reduce((n, [i, l]) => {
154
+ const r = [];
155
+ let o = y(e, { _id: t });
156
+ for (; o; )
157
+ r.push(o), o = y(e, { _id: o._parent });
158
+ const c = y(r, { _type: l.block });
159
+ return c && (n[i] = s(c, s(l, "prop"), null)), n;
171
160
  }, {});
172
- function ve(e) {
173
- if (g(e.lang) && !g(e.fallbackLang))
161
+ function Be(e) {
162
+ if (u(e.lang) && !u(e.fallbackLang))
174
163
  throw new Error("lang prop is required when fallbackLang is provided");
175
- if (g(e.blocks))
164
+ if (u(e.blocks))
176
165
  return null;
177
166
  const t = e.lang ?? "en", a = e.fallbackLang ?? t;
178
- return /* @__PURE__ */ f(b, { ...e, lang: t, fallbackLang: a });
167
+ return /* @__PURE__ */ m(P, { ...e, lang: t, fallbackLang: a });
179
168
  }
180
169
  export {
181
- ve as RenderChaiBlocks,
182
- De as applyChaiDataBinding,
183
- we as convertToBlocks,
184
- Ie as getChaiThemeCssVariables,
185
- Be as getMergedPartialBlocks,
186
- Ce as getStylesForBlocks,
187
- $e as getThemeFontsCSSImport,
188
- Te as getThemeFontsLinkMarkup
170
+ Be as RenderChaiBlocks,
171
+ $e as applyChaiDataBinding,
172
+ Pe as convertToBlocks,
173
+ ve as getChaiThemeCssVariables,
174
+ _e as getMergedPartialBlocks,
175
+ be as getStylesForBlocks,
176
+ Se as getThemeFontsCSSImport,
177
+ xe as getThemeFontsLinkMarkup
189
178
  };
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.4.2",
8
+ "version": "2.4.4",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",
@@ -119,6 +119,7 @@
119
119
  "class-variance-authority": "0.6.1",
120
120
  "clsx": "2.1.1",
121
121
  "cmdk": "0.2.0",
122
+ "culori": "^4.0.2",
122
123
  "flagged": "3.0.0",
123
124
  "framer-motion": "^12.0.3",
124
125
  "fuse.js": "7.0.0",