@chaibuilder/sdk 2.2.18 → 2.2.20
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/{apply-binding-Z9D6RXG4.js → apply-binding-CkrtJykq.js} +65 -68
- package/dist/apply-binding-DpBwzIf9.cjs +1 -0
- package/dist/core.cjs +12 -13
- package/dist/core.d.ts +38 -6
- package/dist/core.js +1614 -1196
- package/dist/{get-chai-builder-theme-CeaKvOZ8.cjs → get-chai-builder-theme-B1tr_NJB.cjs} +1 -1
- package/dist/{get-chai-builder-theme-ByeXCyGx.js → get-chai-builder-theme-BarMkcGH.js} +1 -1
- package/dist/{plugin-fnBB3TCm.js → plugin-BOcGV_IY.js} +15 -14
- package/dist/{plugin-C01tjI6V.cjs → plugin-CSgw-f78.cjs} +5 -5
- package/dist/render.cjs +2 -2
- package/dist/render.js +57 -60
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +2 -2
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +241 -172
- package/package.json +6 -3
- package/dist/apply-binding-k6PclyA3.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./plugin-
|
|
1
|
+
"use strict";const e=require("./plugin-CSgw-f78.cjs"),i=(t=e.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...e.getChaiThemeOptions(t)});exports.getChaiBuilderTheme=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAllRegisteredFonts as b } from "@chaibuilder/runtime";
|
|
2
|
-
import { uniqBy as
|
|
2
|
+
import { uniqBy as l, keys as h, flatten as v, get as B } from "lodash-es";
|
|
3
3
|
const O = {
|
|
4
4
|
fontFamily: {
|
|
5
5
|
"font-heading": "Inter",
|
|
@@ -156,9 +156,9 @@ const _ = (r) => {
|
|
|
156
156
|
.dark {
|
|
157
157
|
${r.colors && Object.entries(r.colors).map(([t, e]) => `--${t}: ${p(e[1])};`).join(`
|
|
158
158
|
`)}
|
|
159
|
-
}`, w = (r) => !r || r.length === 0 ? "" :
|
|
160
|
-
`), x = (r) => !r || r.length === 0 ? "" :
|
|
161
|
-
`),
|
|
159
|
+
}`, w = (r) => !r || r.length === 0 ? "" : l(r, "family").map((t) => `<link rel="stylesheet" href="${t.url}" />`).join(`
|
|
160
|
+
`), x = (r) => !r || r.length === 0 ? [] : l(r, "family").map((t) => t.url), D = (r) => !r || r.length === 0 ? "" : l(r, "family").map((t) => `@import url("${t.url}");`).join(`
|
|
161
|
+
`), L = (r) => !r || r.length === 0 ? "" : l(r, "family").map(
|
|
162
162
|
(t) => t.src.map(
|
|
163
163
|
(e) => `@font-face {
|
|
164
164
|
font-family: "${t.family}";
|
|
@@ -175,7 +175,7 @@ const _ = (r) => {
|
|
|
175
175
|
function E(r) {
|
|
176
176
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
177
177
|
}
|
|
178
|
-
var
|
|
178
|
+
var s = {}, c = {}, m;
|
|
179
179
|
function P() {
|
|
180
180
|
return m || (m = 1, function(r) {
|
|
181
181
|
Object.defineProperty(r, "__esModule", {
|
|
@@ -203,7 +203,7 @@ function P() {
|
|
|
203
203
|
return o.__isOptionsFunction = !0, o.__pluginFunction = n, o.__configFunction = F, o;
|
|
204
204
|
};
|
|
205
205
|
const e = t;
|
|
206
|
-
}(
|
|
206
|
+
}(c)), c;
|
|
207
207
|
}
|
|
208
208
|
var y;
|
|
209
209
|
function A() {
|
|
@@ -223,17 +223,17 @@ function A() {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const n = t.default;
|
|
226
|
-
}(
|
|
226
|
+
}(s)), s;
|
|
227
227
|
}
|
|
228
|
-
var
|
|
228
|
+
var f, $;
|
|
229
229
|
function j() {
|
|
230
|
-
if ($) return
|
|
230
|
+
if ($) return f;
|
|
231
231
|
$ = 1;
|
|
232
232
|
let r = A();
|
|
233
|
-
return
|
|
233
|
+
return f = (r.__esModule ? r : { default: r }).default, f;
|
|
234
234
|
}
|
|
235
235
|
var C = j();
|
|
236
|
-
const M = /* @__PURE__ */ E(C),
|
|
236
|
+
const M = /* @__PURE__ */ E(C), V = M(function({ addBase: r, theme: t }) {
|
|
237
237
|
r({
|
|
238
238
|
"h1,h2,h3,h4,h5,h6": {
|
|
239
239
|
fontFamily: t("fontFamily.heading")
|
|
@@ -247,12 +247,13 @@ const M = /* @__PURE__ */ E(C), L = M(function({ addBase: r, theme: t }) {
|
|
|
247
247
|
});
|
|
248
248
|
export {
|
|
249
249
|
S as a,
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
D as b,
|
|
251
|
+
V as c,
|
|
252
252
|
O as d,
|
|
253
253
|
w as e,
|
|
254
254
|
I as f,
|
|
255
255
|
q as g,
|
|
256
|
-
|
|
256
|
+
x as h,
|
|
257
|
+
L as i,
|
|
257
258
|
M as p
|
|
258
259
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const b=require("@chaibuilder/runtime"),
|
|
1
|
+
"use strict";const b=require("@chaibuilder/runtime"),a=require("lodash-es"),B={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]},v={fontFamily:{heading:"Inter",body:"Inter"},borderRadius:"6px",colors:{background:["#FFFFFF","#09090B"],foreground:["#09090B","#FFFFFF"],primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"],secondary:["#F4F4F5","#27272A"],"secondary-foreground":["#09090B","#FFFFFF"],muted:["#F4F4F5","#27272A"],"muted-foreground":["#71717A","#A1A1AA"],accent:["#F4F4F5","#27272A"],"accent-foreground":["#09090B","#FFFFFF"],destructive:["#EF4444","#7F1D1D"],"destructive-foreground":["#FFFFFF","#FFFFFF"],border:["#E4E4E7","#27272A"],input:["#E4E4E7","#27272A"],ring:["#2563EB","#3B82F6"],card:["#FFFFFF","#09090B"],"card-foreground":["#09090B","#FFFFFF"],popover:["#FFFFFF","#09090B"],"popover-foreground":["#09090B","#FFFFFF"]}},_=e=>({fontFamily:e.fontFamily?a.keys(e.fontFamily).reduce((r,n)=>({...r,[n.replace("font-","")]:`var(--${n})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?a.flatten(e.colors.map(r=>Object.entries(r.items))).reduce((r,[n])=>({...r,[n]:`hsl(var(--${n}))`}),{}):{}});function m(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=parseInt(t[1],16),n=parseInt(t[2],16),F=parseInt(t[3],16);r/=255,n/=255,F/=255;const o=Math.max(r,n,F),u=Math.min(r,n,F);let i,d;const g=(o+u)/2;if(o==u)i=d=0;else{const l=o-u;switch(d=g>.5?l/(2-o-u):l/(o+u),o){case r:i=(n-F)/l+(n<F?6:0);break;case n:i=(F-r)/l+2;break;case F:i=(r-n)/l+4;break}i/=6}return`${Math.round(i*360)} ${Math.round(d*100)}% ${Math.round(g*100)}%`}const E=e=>{const r=b.getAllRegisteredFonts().find(n=>n.family===e);return`"${e}", ${a.get(r,"fallback","")}`},P=e=>`:root {
|
|
2
2
|
${e.fontFamily&&Object.entries(e.fontFamily).map(([t,r])=>`--font-${t}: ${E(r)};`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
${e.borderRadius&&`--radius: ${e.borderRadius};`}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
.dark {
|
|
9
9
|
${e.colors&&Object.entries(e.colors).map(([t,r])=>`--${t}: ${m(r[1])};`).join(`
|
|
10
10
|
`)}
|
|
11
|
-
}`,C=e=>!e||e.length===0?"":
|
|
12
|
-
`),A=e=>!e||e.length===0?"":
|
|
13
|
-
`),
|
|
11
|
+
}`,C=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>`<link rel="stylesheet" href="${t.url}" />`).join(`
|
|
12
|
+
`),A=e=>!e||e.length===0?[]:a.uniqBy(e,"family").map(t=>t.url),j=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>`@import url("${t.url}");`).join(`
|
|
13
|
+
`),k=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>t.src.map(r=>`@font-face {
|
|
14
14
|
font-family: "${t.family}";
|
|
15
15
|
src: url("${r.url}") format("${r.format}");
|
|
16
16
|
font-display: swap;
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
${r.fontStretch?`font-stretch: ${r.fontStretch};`:""}
|
|
20
20
|
}`).join(`
|
|
21
21
|
`)).join(`
|
|
22
|
-
`);function
|
|
22
|
+
`);function q(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s={},c={},p;function M(){return p||(p=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});function t(n,F){return{handler:n,config:F}}t.withOptions=function(n,F=()=>({})){const o=function(u){return{__options:u,handler:n(u),config:F(u)}};return o.__isOptionsFunction=!0,o.__pluginFunction=n,o.__configFunction=F,o};const r=t}(c)),c}var y;function O(){return y||(y=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const t=r(M());function r(F){return F&&F.__esModule?F:{default:F}}const n=t.default}(s)),s}var f,h;function R(){if(h)return f;h=1;let e=O();return f=(e.__esModule?e:{default:e}).default,f}var I=R();const $=q(I),S=$(function({addBase:e,theme:t}){e({"h1,h2,h3,h4,h5,h6":{fontFamily:t("fontFamily.heading")},body:{fontFamily:t("fontFamily.body"),color:t("colors.foreground"),backgroundColor:t("colors.background")}})});exports.chaiBuilderPlugin=S;exports.defaultThemeOptions=B;exports.defaultThemeValues=v;exports.getChaiThemeCssVariables=P;exports.getChaiThemeOptions=_;exports.getThemeCustomFontFace=k;exports.getThemeFontsCSSImport=j;exports.getThemeFontsLinkMarkup=C;exports.getThemeFontsUrls=A;exports.plugin=$;
|
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./plugin-CSgw-f78.cjs"),p=require("./apply-binding-DpBwzIf9.cjs"),a=require("lodash-es"),v=require("@tailwindcss/aspect-ratio"),I=require("@tailwindcss/forms"),q=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"),u=require("react/jsx-runtime"),h=require("react"),R=require("@chaibuilder/runtime");function $(e,t){const r=e.filter(({_type:i})=>i==="GlobalBlock"||i==="PartialBlock");for(let i=0;i<r.length;i++){const l=r[i],s=a.get(l,"partialBlockId",a.get(l,"globalBlock",""));if(s==="")continue;let n=a.cloneDeep(a.get(t,s,[]));l._parent&&(n==null?void 0:n.length)>0&&(n=n.map(o=>(a.isEmpty(o._parent)&&(o._parent=l._parent),o)));const c=e.indexOf(l);e.splice(c,1,...n)}return e}const j=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 i=decodeURIComponent(r),l=i.indexOf("public");return l!==-1?i.substring(l+6):i})}async function M(e,t,r=[],i="",l){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:E.getChaiBuilderTheme(e)},plugins:[I,q,v,L,f.chaiBuilderPlugin],corePlugins:{preflight:l},...i?{prefix:`${i}`}:{}}}).generateStylesFromContent(` ${l?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,t)}const
|
|
3
|
+
@tailwind utilities;`,t)}const O=(e,t,r)=>{const i=JSON.stringify(e).replace(/#styles:([^"]*)/g,(l,s)=>`#styles:${s.replace(/,/g," ")}`.replace(/#styles:/g,""));return M(t,[i],[],"",r)},A=async(e,t=f.defaultThemeOptions,r=!1)=>await O(e,t,r);async function K(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=()=>u.jsx("div",{}),J=e=>{const{block:t,lang:r,fallbackLang:i,children:l,externalData:s,blocks:n,draft:c,pageProps:o,dataProviderMetadataCallback:m}=e,d=R.getRegisteredChaiBlock(t._type),y=a.get(d,"component",null),k=a.get(e.repeaterData,"index",-1),P=a.get(e.repeaterData,"dataKey",""),b=r===i?"":r,g=p.applyBindingToBlockProps(p.applyLanguage(t,b,d),s,{index:k,key:P}),C=p.getBlockTagAttributes(t,!1),w=V(n,t._id,p.getBlockRuntimeProps(t._type)),S=a.has(d,"dataProvider")&&a.isFunction(d.dataProvider),_={blockProps:{},inBuilder:!1,lang:r||i,...g,...C,...w};if(a.isNull(y))return null;if(S){const T=a.get(d,"suspenseFallback",N);return u.jsx(h.Suspense,{fallback:h.createElement(T),children:u.jsx(K,{lang:r,pageProps:o,block:t,dataProvider:d.dataProvider,...m?{dataProviderMetadataCallback:m}:{},draft:c,children:x=>h.createElement(y,{..._,...x,children:l({_id:t._id,_type:t._type,...a.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,t),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})})}return u.jsx(h.Suspense,{children:h.createElement(y,{..._,children:l({_id:t._id,_type:t._type,...a.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,t),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})},B=e=>{const{blocks:t,parent:r,repeaterData:i}=e;let l=a.uniqBy(a.filter(t,n=>a.has(n,"_id")&&(a.isEmpty(r)?!n._parent:n._parent===r)),"_id");const s=n=>a.filter(t,c=>c._parent===n).length>0;return a.map(l,n=>n?h.createElement(J,{...e,key:n._id,block:n},({_id:c,_type:o,repeaterItems:m,$repeaterItemsKey:d})=>o==="Repeater"?a.isArray(m)&&m.map((y,k)=>u.jsx(u.Fragment,{children:h.createElement(B,{...e,parent:n._id,key:`${n._id}-${k}`,repeaterData:{index:k,dataKey:d}})})):s(c)?u.jsx(B,{...e,parent:n._id,repeaterData:i}):null):null)},V=(e,t,r)=>a.isEmpty(r)?{}:Object.entries(r).reduce((i,[l,s])=>{const n=[];let c=a.find(e,{_id:t});for(;c;)n.push(c),c=a.find(e,{_id:c._parent});const o=a.find(n,{_type:s.block});return o&&(i[l]=a.get(o,a.get(s,"prop"),null)),i},{});function U(e){if(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",r=e.fallbackLang??t;return u.jsx(B,{...e,lang:t,fallbackLang:r})}exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=p.applyChaiDataBinding;exports.RenderChaiBlocks=U;exports.convertToBlocks=j;exports.getMergedPartialBlocks=$;exports.getStylesForBlocks=A;
|
package/dist/render.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { d as F, c as
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
4
|
-
import { e as
|
|
5
|
-
import { get as c, cloneDeep as
|
|
1
|
+
import { d as F, c as R } from "./plugin-BOcGV_IY.js";
|
|
2
|
+
import { a as Se, b as ve, e as xe } from "./plugin-BOcGV_IY.js";
|
|
3
|
+
import { a as O, b as K, g as M, c as A, d as w } from "./apply-binding-CkrtJykq.js";
|
|
4
|
+
import { e as Te } from "./apply-binding-CkrtJykq.js";
|
|
5
|
+
import { get as c, cloneDeep as N, isEmpty as g, has as P, isFunction as v, omit as J, isNull as E, isArray as _, uniqBy as j, filter as C, map as q, find as y } from "lodash-es";
|
|
6
6
|
import U from "@tailwindcss/aspect-ratio";
|
|
7
7
|
import V from "@tailwindcss/forms";
|
|
8
8
|
import G from "@tailwindcss/typography";
|
|
9
9
|
import "tailwindcss-animate";
|
|
10
|
-
import { g as W } from "./get-chai-builder-theme-
|
|
10
|
+
import { g as W } from "./get-chai-builder-theme-BarMkcGH.js";
|
|
11
11
|
import { createTailwindcss as z } from "@mhsdesign/jit-browser-tailwindcss";
|
|
12
12
|
import H from "@tailwindcss/container-queries";
|
|
13
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
14
|
-
import { Suspense as
|
|
15
|
-
import { getRegisteredChaiBlock as
|
|
16
|
-
function
|
|
13
|
+
import { jsx as u, Fragment as Q } from "react/jsx-runtime";
|
|
14
|
+
import { Suspense as S, createElement as f } 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
19
|
const i = a[n], l = c(i, "partialBlockId", c(i, "globalBlock", ""));
|
|
20
20
|
if (l === "") continue;
|
|
21
|
-
let r =
|
|
21
|
+
let r = N(c(t, l, []));
|
|
22
22
|
i._parent && (r == null ? void 0 : r.length) > 0 && (r = r.map((s) => (g(s._parent) && (s._parent = i._parent), s)));
|
|
23
23
|
const o = e.indexOf(i);
|
|
24
24
|
e.splice(o, 1, ...r);
|
|
25
25
|
}
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const be = (e) => {
|
|
29
29
|
if (!e) return [];
|
|
30
30
|
try {
|
|
31
|
-
return JSON.parse(
|
|
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
|
|
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
|
|
43
|
+
async function Z(e, t, a = [], n = "", i) {
|
|
44
44
|
return await z({
|
|
45
45
|
tailwindConfig: {
|
|
46
46
|
darkMode: "class",
|
|
47
47
|
safelist: a,
|
|
48
48
|
theme: { extend: W(e) },
|
|
49
|
-
plugins: [V, G, U, H,
|
|
49
|
+
plugins: [V, G, U, H, R],
|
|
50
50
|
corePlugins: { preflight: i },
|
|
51
51
|
...n ? { prefix: `${n}` } : {}
|
|
52
52
|
}
|
|
@@ -57,11 +57,11 @@ async function Y(e, t, a = [], n = "", i) {
|
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const ee = (e, t, a) => {
|
|
61
61
|
const n = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, l) => `#styles:${l.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
async function
|
|
62
|
+
return Z(t, [n], [], "", a);
|
|
63
|
+
}, Pe = async (e, t = F, a = !1) => await ee(e, t, a);
|
|
64
|
+
async function te(e) {
|
|
65
65
|
const t = await e.dataProvider({
|
|
66
66
|
pageProps: e.pageProps,
|
|
67
67
|
block: e.block,
|
|
@@ -69,19 +69,16 @@ async function ee(e) {
|
|
|
69
69
|
draft: e.draft,
|
|
70
70
|
inBuilder: !1
|
|
71
71
|
});
|
|
72
|
-
return
|
|
73
|
-
...
|
|
72
|
+
return P(t, "$metadata") && v(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, t.$metadata), e.children({
|
|
73
|
+
...J(t, "$metadata")
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
const { block: t, lang: a, fallbackLang: n, children: i, externalData: l, blocks: r, draft: o, pageProps: s, dataProviderMetadataCallback: m } = e, d =
|
|
78
|
-
|
|
76
|
+
const ae = () => /* @__PURE__ */ u("div", {}), re = (e) => {
|
|
77
|
+
const { block: t, lang: a, fallbackLang: n, children: i, externalData: l, blocks: r, draft: o, pageProps: s, dataProviderMetadataCallback: m } = e, d = X(t._type), h = c(d, "component", null), k = c(e.repeaterData, "index", -1), x = c(e.repeaterData, "dataKey", ""), p = O(
|
|
78
|
+
K(t, a === n ? "" : a, d),
|
|
79
79
|
l,
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
key: x
|
|
83
|
-
}
|
|
84
|
-
), I = A(t, !1), T = re(r, t._id, N(t._type)), L = y(d, "dataProvider") && S(d.dataProvider), P = {
|
|
80
|
+
{ index: k, key: x }
|
|
81
|
+
), I = M(t, !1), T = ne(r, t._id, A(t._type)), $ = P(d, "dataProvider") && v(d.dataProvider), B = {
|
|
85
82
|
blockProps: {},
|
|
86
83
|
inBuilder: !1,
|
|
87
84
|
lang: a || n,
|
|
@@ -89,11 +86,11 @@ const te = () => /* @__PURE__ */ u("div", {}), ae = (e) => {
|
|
|
89
86
|
...I,
|
|
90
87
|
...T
|
|
91
88
|
};
|
|
92
|
-
if (
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
return /* @__PURE__ */ u(
|
|
96
|
-
|
|
89
|
+
if (E(h)) return null;
|
|
90
|
+
if ($) {
|
|
91
|
+
const L = c(d, "suspenseFallback", ae);
|
|
92
|
+
return /* @__PURE__ */ u(S, { fallback: f(L), children: /* @__PURE__ */ u(
|
|
93
|
+
te,
|
|
97
94
|
{
|
|
98
95
|
lang: a,
|
|
99
96
|
pageProps: s,
|
|
@@ -101,40 +98,40 @@ const te = () => /* @__PURE__ */ u("div", {}), ae = (e) => {
|
|
|
101
98
|
dataProvider: d.dataProvider,
|
|
102
99
|
...m ? { dataProviderMetadataCallback: m } : {},
|
|
103
100
|
draft: o,
|
|
104
|
-
children: (
|
|
105
|
-
...
|
|
106
|
-
...
|
|
101
|
+
children: (D) => f(h, {
|
|
102
|
+
...B,
|
|
103
|
+
...D,
|
|
107
104
|
children: i({
|
|
108
105
|
_id: t._id,
|
|
109
106
|
_type: t._type,
|
|
110
|
-
...
|
|
107
|
+
..._(p.repeaterItems) ? {
|
|
111
108
|
repeaterItems: w(p.repeaterItems, t),
|
|
112
|
-
|
|
109
|
+
$repeaterItemsKey: p.$repeaterItemsKey
|
|
113
110
|
} : {}
|
|
114
111
|
})
|
|
115
112
|
})
|
|
116
113
|
}
|
|
117
114
|
) });
|
|
118
115
|
}
|
|
119
|
-
return /* @__PURE__ */ u(
|
|
120
|
-
...
|
|
116
|
+
return /* @__PURE__ */ u(S, { children: f(h, {
|
|
117
|
+
...B,
|
|
121
118
|
children: i({
|
|
122
119
|
_id: t._id,
|
|
123
120
|
_type: t._type,
|
|
124
|
-
...
|
|
121
|
+
..._(p.repeaterItems) ? {
|
|
125
122
|
repeaterItems: w(p.repeaterItems, t),
|
|
126
|
-
|
|
123
|
+
$repeaterItemsKey: p.$repeaterItemsKey
|
|
127
124
|
} : {}
|
|
128
125
|
})
|
|
129
126
|
}) });
|
|
130
127
|
}, b = (e) => {
|
|
131
128
|
const { blocks: t, parent: a, repeaterData: n } = e;
|
|
132
129
|
let i = j(
|
|
133
|
-
C(t, (r) =>
|
|
130
|
+
C(t, (r) => P(r, "_id") && (g(a) ? !r._parent : r._parent === a)),
|
|
134
131
|
"_id"
|
|
135
132
|
);
|
|
136
133
|
const l = (r) => C(t, (o) => o._parent === r).length > 0;
|
|
137
|
-
return q(i, (r) => r ? /* @__PURE__ */ f(
|
|
134
|
+
return q(i, (r) => r ? /* @__PURE__ */ f(re, { ...e, key: r._id, block: r }, ({ _id: o, _type: s, repeaterItems: m, $repeaterItemsKey: d }) => s === "Repeater" ? _(m) && m.map((h, k) => /* @__PURE__ */ u(Q, { children: /* @__PURE__ */ f(
|
|
138
135
|
b,
|
|
139
136
|
{
|
|
140
137
|
...e,
|
|
@@ -142,17 +139,17 @@ const te = () => /* @__PURE__ */ u("div", {}), ae = (e) => {
|
|
|
142
139
|
key: `${r._id}-${k}`,
|
|
143
140
|
repeaterData: { index: k, dataKey: d }
|
|
144
141
|
}
|
|
145
|
-
)) : l(o) ? /* @__PURE__ */ u(b, { ...e, parent: r._id, repeaterData: n }) : null) : null);
|
|
146
|
-
},
|
|
142
|
+
) })) : l(o) ? /* @__PURE__ */ u(b, { ...e, parent: r._id, repeaterData: n }) : null) : null);
|
|
143
|
+
}, ne = (e, t, a) => g(a) ? {} : Object.entries(a).reduce((n, [i, l]) => {
|
|
147
144
|
const r = [];
|
|
148
|
-
let o =
|
|
145
|
+
let o = y(e, { _id: t });
|
|
149
146
|
for (; o; )
|
|
150
|
-
r.push(o), o =
|
|
151
|
-
const s =
|
|
147
|
+
r.push(o), o = y(e, { _id: o._parent });
|
|
148
|
+
const s = y(r, { _type: l.block });
|
|
152
149
|
return s && (n[i] = c(s, c(l, "prop"), null)), n;
|
|
153
150
|
}, {});
|
|
154
|
-
function
|
|
155
|
-
if (
|
|
151
|
+
function Be(e) {
|
|
152
|
+
if (g(e.lang) && !g(e.fallbackLang))
|
|
156
153
|
throw new Error("lang prop is required when fallbackLang is provided");
|
|
157
154
|
if (g(e.blocks))
|
|
158
155
|
return null;
|
|
@@ -160,12 +157,12 @@ function be(e) {
|
|
|
160
157
|
return /* @__PURE__ */ u(b, { ...e, lang: t, fallbackLang: a });
|
|
161
158
|
}
|
|
162
159
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
Be as RenderChaiBlocks,
|
|
161
|
+
Te as applyChaiDataBinding,
|
|
162
|
+
be as convertToBlocks,
|
|
163
|
+
Se as getChaiThemeCssVariables,
|
|
164
|
+
_e as getMergedPartialBlocks,
|
|
165
|
+
Pe as getStylesForBlocks,
|
|
169
166
|
ve as getThemeFontsCSSImport,
|
|
170
|
-
|
|
167
|
+
xe as getThemeFontsLinkMarkup
|
|
171
168
|
};
|
package/dist/tailwind.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./plugin-CSgw-f78.cjs"),o=require("@tailwindcss/aspect-ratio"),a=require("@tailwindcss/forms"),i=require("@tailwindcss/typography"),n=require("tailwindcss-animate"),d=require("./get-chai-builder-theme-B1tr_NJB.cjs");function t(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},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"}}}const u=r=>({darkMode:"class",content:[...r,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:t()},plugins:[n,i,a,o]});exports.chaiBuilderPlugin=e.chaiBuilderPlugin;exports.getChaiBuilderTheme=d.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=u;
|
package/dist/tailwind.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as g } from "./plugin-
|
|
1
|
+
import { c as g } from "./plugin-BOcGV_IY.js";
|
|
2
2
|
import o from "@tailwindcss/aspect-ratio";
|
|
3
3
|
import a from "@tailwindcss/forms";
|
|
4
4
|
import e from "@tailwindcss/typography";
|
|
5
5
|
import d from "tailwindcss-animate";
|
|
6
|
-
import { g as m } from "./get-chai-builder-theme-
|
|
6
|
+
import { g as m } from "./get-chai-builder-theme-BarMkcGH.js";
|
|
7
7
|
function n() {
|
|
8
8
|
return {
|
|
9
9
|
colors: {
|