@chaibuilder/sdk 2.1.7 → 2.1.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/{chai-theme-helpers-GQ1UI3nD.cjs → chai-theme-helpers-BjWE6otR.cjs} +6 -6
- package/dist/{chai-theme-helpers-CVkLfKt7.js → chai-theme-helpers-FO9vdd-R.js} +5 -4
- package/dist/core.cjs +12 -4
- package/dist/core.d.ts +7 -3
- package/dist/core.js +961 -877
- package/dist/{plugin-DRtv2KR5.js → plugin-B09c0d5S.js} +1 -1
- package/dist/{plugin-uUPBh-_c.cjs → plugin-BiiuylVf.cjs} +1 -1
- package/dist/render.cjs +2 -2
- package/dist/render.js +16 -16
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +5 -5
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./chai-theme-helpers-
|
|
1
|
+
"use strict";const o=require("./chai-theme-helpers-BjWE6otR.cjs"),n=(i=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(i)}),r=o.plugin(function({addBase:i,theme:e}){i({"h1,h2,h3,h4,h5,h6":{fontFamily:e("fontFamily.heading")},body:{fontFamily:e("fontFamily.body"),color:e("colors.foreground"),backgroundColor:e("colors.background")}})});exports.chaiBuilderPlugin=r;exports.getChaiBuilderTheme=n;
|
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./chai-theme-helpers-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./chai-theme-helpers-BjWE6otR.cjs"),s=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),b=require("@tailwindcss/aspect-ratio"),k=require("@tailwindcss/container-queries"),M=require("@tailwindcss/forms"),N=require("@tailwindcss/typography"),B=require("./plugin-BiiuylVf.cjs"),g=require("react/jsx-runtime"),T=require("@chaibuilder/runtime"),p=require("react"),Y=require("tailwind-merge"),A=(e,i="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(r=>r.split(" ").map(a=>{if(a==="")return"";if(a.includes(":")){const u=a.split(":");return u[u.length-1]=i+s.last(u),u.join(":")}return`${i}${a}`}).join(" "));return s.flattenDeep(t).join(" ")},I=e=>{if(!e)return[];try{return JSON.parse(J(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function J(e){const i=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(i,n=>{const t=decodeURIComponent(n),r=t.indexOf("public");return r!==-1?t.substring(r+6):t})}async function K(e,i,n=[],t="",r){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:B.getChaiBuilderTheme(e)},plugins:[M,N,b,k,B.chaiBuilderPlugin],corePlugins:{preflight:r},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${r?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,
|
|
3
|
+
@tailwind utilities;`,i)}const V=(e,i,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(r,c)=>`#styles:${c.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(i,[t],[],"",n)},L=async(e,i=S.defaultThemeOptions,n=!1)=>await V(e,i,n);async function U(e){const i=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return s.has(i,"$metadata")&&e.dataProviderMetadataCallback(e.block,i.$metadata),g.jsx(p.Suspense,{children:p.createElement(e.component,{...s.omit(e.props,["dataProvider","dataProviderMetadataCallback"]),...s.omit(i,"$metadata"),key:`${e.block._id}-async`})})}const z=s.memoize((e,i)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),r=Y.twMerge(n,t);return i===""?r.replace(m.STYLES_KEY,"").trim():A(r,i).replace(m.STYLES_KEY,"").trim()}),j=(e,i)=>{const n=s.cloneDeep(e);return s.forEach(s.keys(n),t=>{if(s.isString(n[t])){let r=n[t];const c=/\{\{(.*?)\}\}/g,l=r.match(c);l&&l.forEach(a=>{const u=a.slice(2,-2),h=s.get(i,u,a);r=r.replace(a,h)}),n[t]=r}s.isObject(n[t])&&(n[t]=j(n[t],i))}),n};function D(e,i){const n=s.get(e,`${i}_attrs`,{}),t=s.keys(n).join(" ");return s.includes(t,"x-show")&&!s.includes(t,"x-transition")&&(n["x-transition"]=""),n}function W(e,i){const n={};return Object.keys(e).forEach(t=>{if(s.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const r=z(e[t],i);n[t]={className:r,...D(e,t)}}}),n}function H(e,i,n){if(s.isEmpty(i))return e;const t=s.cloneDeep(e),r=s.get(n,"i18nProps",[]);return s.forEach(s.keys(t),c=>{r.includes(c)&&!s.isEmpty(i)&&(t[c]=s.get(t,`${c}-${i}`,t[c]))}),t}const G=s.memoize(e=>{const i=T.getRegisteredChaiBlock(e),n=s.get(i,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,t])=>s.get(t,"runtime",!1)))}),Q=(e,i,n)=>s.isEmpty(n)?{}:Object.entries(n).reduce((t,[r,c])=>{const l=[];let a=s.find(e,{_id:i});for(;a;)l.push(a),a=s.find(e,{_id:a._parent});const u=s.find(l,{_type:c.block});return u&&(t[r]=s.get(u,s.get(c,"prop"),null)),t},{}),X=()=>g.jsx("span",{children:"Loading..."});function E({blocks:e,parent:i,classPrefix:n="",externalData:t={},blockModifierCallback:r=null,lang:c="",fallbackLang:l="",metadata:a={},dataProviderMetadataCallback:u=()=>{}}){const h=e,P=o=>W(o,n),$=i?s.filter(e,{_parent:i}):s.filter(e,o=>s.isEmpty(o._parent));return s.uniqBy($,"_id").map((o,q)=>{const y={},v=s.filter(h,{_parent:o._id});y.children=v.length>0?g.jsx(E,{externalData:t,classPrefix:n,parent:o._id,blocks:h,lang:c||l,metadata:a,fallbackLang:l,dataProviderMetadataCallback:u},`${o._id}-children`):null;const d=T.getRegisteredChaiBlock(o._type);if(d!==null){let f=o;const _=d.component;f={...d.defaults,...o},r&&(f=r(f));const x=c===l?"":c,O=Q(h,o._id,G(o._type)),C=j(H(o,x,d),t),w=s.omit({blockProps:{},inBuilder:!1,...f,index:q,...C,...P(C),...y,...O,metadata:a,lang:c||l,key:o._id},["_parent"]);if(s.has(d,"dataProvider")){const R=s.get(d,"suspenseFallback",X);return g.jsx(p.Suspense,{fallback:p.createElement(R),children:g.jsx(U,{dataProviderMetadataCallback:u,lang:c||l,metadata:a,dataProvider:d.dataProvider,block:o,component:_,props:w},`${o._id}-async`)},`${o._id}-suspense`)}return g.jsx(p.Suspense,{children:p.createElement(_,w)},`${o._id}-suspense`)}return g.jsxs("noscript",{children:[o._type," not found"]},`${o._id}-noscript`)})}exports.getChaiThemeCssVariables=S.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=S.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=S.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=E;exports.convertToBlocks=I;exports.getStylesForBlocks=L;
|
package/dist/render.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { d as Y } from "./chai-theme-helpers-
|
|
2
|
-
import { a as At, b as It, c as Jt } from "./chai-theme-helpers-
|
|
3
|
-
import { last as q, flattenDeep as z, has as v, omit as y, memoize as O, get as d, filter as h, isEmpty as g, uniqBy as D, cloneDeep as E, forEach as x, keys as
|
|
1
|
+
import { d as Y } from "./chai-theme-helpers-FO9vdd-R.js";
|
|
2
|
+
import { a as At, b as It, c as Jt } from "./chai-theme-helpers-FO9vdd-R.js";
|
|
3
|
+
import { last as q, flattenDeep as z, has as v, omit as y, memoize as O, get as d, filter as h, isEmpty as g, uniqBy as D, cloneDeep as E, forEach as x, keys as C, isString as R, isObject as G, find as _, includes as j } from "lodash-es";
|
|
4
4
|
import { g as F, S } from "./getSplitClasses-DphwgQiE.js";
|
|
5
|
-
import { createTailwindcss as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { createTailwindcss as H } from "@mhsdesign/jit-browser-tailwindcss";
|
|
6
|
+
import L from "@tailwindcss/aspect-ratio";
|
|
7
|
+
import Q from "@tailwindcss/container-queries";
|
|
8
8
|
import X from "@tailwindcss/forms";
|
|
9
9
|
import Z from "@tailwindcss/typography";
|
|
10
|
-
import { g as k, c as tt } from "./plugin-
|
|
10
|
+
import { g as k, c as tt } from "./plugin-B09c0d5S.js";
|
|
11
11
|
import { jsx as p, jsxs as et } from "react/jsx-runtime";
|
|
12
12
|
import { getRegisteredChaiBlock as N } from "@chaibuilder/runtime";
|
|
13
13
|
import b, { Suspense as w, createElement as nt } from "react";
|
|
@@ -38,12 +38,12 @@ function it(t) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
async function ot(t, s, n = [], e = "", r) {
|
|
41
|
-
return await
|
|
41
|
+
return await H({
|
|
42
42
|
tailwindConfig: {
|
|
43
43
|
darkMode: "class",
|
|
44
44
|
safelist: n,
|
|
45
45
|
theme: { extend: k(t) },
|
|
46
|
-
plugins: [X, Z,
|
|
46
|
+
plugins: [X, Z, L, Q, tt],
|
|
47
47
|
corePlugins: { preflight: r },
|
|
48
48
|
...e ? { prefix: `${e}` } : {}
|
|
49
49
|
}
|
|
@@ -71,7 +71,7 @@ const lt = O((t, s) => {
|
|
|
71
71
|
return s === "" ? r.replace(S, "").trim() : rt(r, s).replace(S, "").trim();
|
|
72
72
|
}), A = (t, s) => {
|
|
73
73
|
const n = E(t);
|
|
74
|
-
return x(
|
|
74
|
+
return x(C(n), (e) => {
|
|
75
75
|
if (R(n[e])) {
|
|
76
76
|
let r = n[e];
|
|
77
77
|
const o = /\{\{(.*?)\}\}/g, c = r.match(o);
|
|
@@ -80,11 +80,11 @@ const lt = O((t, s) => {
|
|
|
80
80
|
r = r.replace(a, m);
|
|
81
81
|
}), n[e] = r;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
G(n[e]) && (n[e] = A(n[e], s));
|
|
84
84
|
}), n;
|
|
85
85
|
};
|
|
86
86
|
function dt(t, s) {
|
|
87
|
-
const n = d(t, `${s}_attrs`, {}), e =
|
|
87
|
+
const n = d(t, `${s}_attrs`, {}), e = C(n).join(" ");
|
|
88
88
|
return j(e, "x-show") && !j(e, "x-transition") && (n["x-transition"] = ""), n;
|
|
89
89
|
}
|
|
90
90
|
function ut(t, s) {
|
|
@@ -102,7 +102,7 @@ function ut(t, s) {
|
|
|
102
102
|
function pt(t, s, n) {
|
|
103
103
|
if (g(s)) return t;
|
|
104
104
|
const e = E(t), r = d(n, "i18nProps", []);
|
|
105
|
-
return x(
|
|
105
|
+
return x(C(e), (o) => {
|
|
106
106
|
r.includes(o) && !g(s) && (e[o] = d(e, `${o}-${s}`, e[o]));
|
|
107
107
|
}), e;
|
|
108
108
|
}
|
|
@@ -131,8 +131,8 @@ function ht({
|
|
|
131
131
|
}) {
|
|
132
132
|
const m = t, I = (i) => ut(i, n), J = s ? h(t, { _parent: s }) : h(t, (i) => g(i._parent));
|
|
133
133
|
return D(J, "_id").map((i, M) => {
|
|
134
|
-
const
|
|
135
|
-
|
|
134
|
+
const B = {}, U = h(m, { _parent: i._id });
|
|
135
|
+
B.children = U.length > 0 ? /* @__PURE__ */ p(
|
|
136
136
|
ht,
|
|
137
137
|
{
|
|
138
138
|
externalData: e,
|
|
@@ -159,7 +159,7 @@ function ht({
|
|
|
159
159
|
index: M,
|
|
160
160
|
...$,
|
|
161
161
|
...I($),
|
|
162
|
-
...
|
|
162
|
+
...B,
|
|
163
163
|
...K,
|
|
164
164
|
metadata: a,
|
|
165
165
|
lang: o || c,
|
package/dist/tailwind.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/aspect-ratio"),a=require("@tailwindcss/forms"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/aspect-ratio"),a=require("@tailwindcss/forms"),i=require("@tailwindcss/typography"),n=require("tailwindcss-animate"),r=require("./plugin-BiiuylVf.cjs");function d(){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 t=e=>({darkMode:"class",content:[...e,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:d()},plugins:[n,i,a,o]});exports.chaiBuilderPlugin=r.chaiBuilderPlugin;exports.getChaiBuilderTheme=r.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=t;
|
package/dist/tailwind.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import o from "@tailwindcss/aspect-ratio";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import a from "@tailwindcss/forms";
|
|
3
|
+
import e from "@tailwindcss/typography";
|
|
4
4
|
import d from "tailwindcss-animate";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as g, g as v } from "./plugin-B09c0d5S.js";
|
|
6
6
|
function n() {
|
|
7
7
|
return {
|
|
8
8
|
colors: {
|
|
@@ -67,10 +67,10 @@ const u = (r) => ({
|
|
|
67
67
|
theme: {
|
|
68
68
|
extend: n()
|
|
69
69
|
},
|
|
70
|
-
plugins: [d,
|
|
70
|
+
plugins: [d, e, a, o]
|
|
71
71
|
});
|
|
72
72
|
export {
|
|
73
|
-
|
|
73
|
+
g as chaiBuilderPlugin,
|
|
74
74
|
u as getChaiBuilderTailwindConfig,
|
|
75
75
|
v as getChaiBuilderTheme
|
|
76
76
|
};
|
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.1.
|
|
8
|
+
"version": "2.1.9",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@chaibuilder/runtime": "2.0.
|
|
56
|
+
"@chaibuilder/runtime": "2.0.7",
|
|
57
57
|
"@types/react": "*",
|
|
58
58
|
"@types/react-dom": "*",
|
|
59
59
|
"jotai": "2.12.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@ai-sdk/react": "^1.2.2",
|
|
73
|
-
"@chaibuilder/runtime": "2.0.
|
|
73
|
+
"@chaibuilder/runtime": "2.0.7",
|
|
74
74
|
"@floating-ui/dom": "1.6.13",
|
|
75
75
|
"@floating-ui/react-dom": "2.1.2",
|
|
76
76
|
"@mhsdesign/jit-browser-tailwindcss": "0.4.2",
|