@chaibuilder/sdk 2.0.0-beta.7 → 2.0.0-beta.72
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/README.md +0 -4
- package/dist/ChaiThemeFn-Cort9tch.js +201 -0
- package/dist/ChaiThemeFn-DQu-2Eh9.cjs +13 -0
- package/dist/CodeEditor-B2x4yruH.cjs +1 -0
- package/dist/CodeEditor-VcQsGvTM.js +65 -0
- package/dist/Topbar-BQsjWb-A.js +16 -0
- package/dist/Topbar-DEw_kBMz.cjs +1 -0
- package/dist/chaibuilder-logo.png +0 -0
- package/dist/context-menu-C4lLV8gP.cjs +1 -0
- package/dist/{context-menu-I8woggB3.js → context-menu-D5ViOi6K.js} +260 -263
- package/dist/core.cjs +61 -1
- package/dist/core.d.ts +116 -54
- package/dist/core.js +8819 -123
- package/dist/getSplitClasses-DodqA_KW.cjs +1 -0
- package/dist/getSplitClasses-DphwgQiE.js +48 -0
- package/dist/{iconBase-Ief2hJUZ.js → iconBase-DHfFLkem.js} +6 -12
- package/dist/mockServiceWorker.js +39 -24
- package/dist/plugin-2xcljWGM.cjs +1 -0
- package/dist/plugin-kUMxtQR5.js +24 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +35 -16
- package/dist/render.js +144 -134
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -20
- package/dist/{style.css → sdk.css} +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +31 -26
- package/dist/tailwind.js +8 -10
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +6 -51
- package/dist/ui.js +210 -367
- package/dist/web-blocks.cjs +29 -2
- package/dist/web-blocks.js +1782 -831
- package/package.json +133 -132
- package/dist/CodeEditor-Bqjwy0VH.js +0 -127
- package/dist/CodeEditor-KUfhGPDN.cjs +0 -1
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/Topbar-DQuMCOP6.cjs +0 -1
- package/dist/Topbar-g2pI6yGs.js +0 -161
- package/dist/context-menu-0lRey9QY.cjs +0 -1
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
- package/dist/index-1_ZADyhv.js +0 -8554
- package/dist/index-QyeR27V9.cjs +0 -61
- package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
- package/dist/jsx-runtime-Sp0orL4X.js +0 -631
- package/dist/plugin-UiUFs2fK.js +0 -44
- package/dist/plugin-f6SDZ_Or.js +0 -108
- package/dist/plugin-jum1MjXp.cjs +0 -1
- package/dist/plugin-xOpS-UNV.cjs +0 -1
- /package/dist/{iconBase-aZzpqff_.cjs → iconBase-Cn2BsTrq.cjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a="#styles:",r="__ADD_BLOCK_INTERNAL_ROOT",n=s=>{if(s=s.replace(a,""),!s)return{baseClasses:"",classes:""};const e=s.split(/,(?![^\[]*\])/);if(e.length===1)return{baseClasses:"",classes:e[0].trim()};const[t,...l]=e;return{baseClasses:t.trim(),classes:l.join(",").trim().replace(/ +(?= )/g,"")}};exports.ROOT_TEMP_KEY=r;exports.STYLES_KEY=a;exports.getSplitChaiClasses=n;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const t = "#styles:", n = "__ADD_BLOCK_INTERNAL_ROOT", r = (s) => {
|
|
2
|
+
if (s = s.replace(t, ""), !s) return { baseClasses: "", classes: "" };
|
|
3
|
+
const e = s.split(/,(?![^\[]*\])/);
|
|
4
|
+
if (e.length === 1)
|
|
5
|
+
return { baseClasses: "", classes: e[0].trim() };
|
|
6
|
+
const [a, ...l] = e;
|
|
7
|
+
return {
|
|
8
|
+
baseClasses: a.trim(),
|
|
9
|
+
classes: l.join(",").trim().replace(/ +(?= )/g, "")
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
import.meta.vitest && describe("getSplitChaiClasses", () => {
|
|
13
|
+
it("should return the base classes and the classes", () => {
|
|
14
|
+
const s = {
|
|
15
|
+
",styles-2": { baseClasses: "", classes: "styles-2" },
|
|
16
|
+
"styles-1,styles-2": { baseClasses: "styles-1", classes: "styles-2" },
|
|
17
|
+
",bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
18
|
+
baseClasses: "",
|
|
19
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
20
|
+
},
|
|
21
|
+
"styles-1,bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
22
|
+
baseClasses: "styles-1",
|
|
23
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
24
|
+
},
|
|
25
|
+
someclass: {
|
|
26
|
+
baseClasses: "",
|
|
27
|
+
classes: "someclass"
|
|
28
|
+
},
|
|
29
|
+
",bg-red-500 text-center font-bold": {
|
|
30
|
+
baseClasses: "",
|
|
31
|
+
classes: "bg-red-500 text-center font-bold"
|
|
32
|
+
},
|
|
33
|
+
"bg-[linear-gradient(-10deg,black,transparent_100%)], bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
34
|
+
baseClasses: "bg-[linear-gradient(-10deg,black,transparent_100%)]",
|
|
35
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
for (let e in s) {
|
|
39
|
+
const a = r(`${t}${e}`);
|
|
40
|
+
expect(a).toEqual(s[e]);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
n as R,
|
|
46
|
+
t as S,
|
|
47
|
+
r as g
|
|
48
|
+
};
|
|
@@ -4,8 +4,7 @@ import { twMerge as O } from "tailwind-merge";
|
|
|
4
4
|
import a from "react";
|
|
5
5
|
function D(e = 6, t = "abcdefghijklmnopqrstuvwxyzABCD") {
|
|
6
6
|
let r = "";
|
|
7
|
-
for (let n = e; n > 0; --n)
|
|
8
|
-
r += t[Math.floor(Math.random() * t.length)];
|
|
7
|
+
for (let n = e; n > 0; --n) r += t[Math.floor(Math.random() * t.length)];
|
|
9
8
|
return r;
|
|
10
9
|
}
|
|
11
10
|
const N = (e) => e >= 1536 ? "2XL" : e >= 1280 ? "XL" : e >= 1024 ? "LG" : e >= 768 ? "MD" : e >= 640 ? "SM" : "XS", z = (...e) => O(v(e));
|
|
@@ -17,8 +16,7 @@ var p = {
|
|
|
17
16
|
attr: void 0
|
|
18
17
|
}, s = a.createContext && /* @__PURE__ */ a.createContext(p), y = ["attr", "size", "title"];
|
|
19
18
|
function d(e, t) {
|
|
20
|
-
if (e == null)
|
|
21
|
-
return {};
|
|
19
|
+
if (e == null) return {};
|
|
22
20
|
var r = j(e, t), n, i;
|
|
23
21
|
if (Object.getOwnPropertySymbols) {
|
|
24
22
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -28,13 +26,11 @@ function d(e, t) {
|
|
|
28
26
|
return r;
|
|
29
27
|
}
|
|
30
28
|
function j(e, t) {
|
|
31
|
-
if (e == null)
|
|
32
|
-
return {};
|
|
29
|
+
if (e == null) return {};
|
|
33
30
|
var r = {};
|
|
34
31
|
for (var n in e)
|
|
35
32
|
if (Object.prototype.hasOwnProperty.call(e, n)) {
|
|
36
|
-
if (t.indexOf(n) >= 0)
|
|
37
|
-
continue;
|
|
33
|
+
if (t.indexOf(n) >= 0) continue;
|
|
38
34
|
r[n] = e[n];
|
|
39
35
|
}
|
|
40
36
|
return r;
|
|
@@ -78,13 +74,11 @@ function h(e) {
|
|
|
78
74
|
return typeof t == "symbol" ? t : t + "";
|
|
79
75
|
}
|
|
80
76
|
function w(e, t) {
|
|
81
|
-
if (typeof e != "object" || !e)
|
|
82
|
-
return e;
|
|
77
|
+
if (typeof e != "object" || !e) return e;
|
|
83
78
|
var r = e[Symbol.toPrimitive];
|
|
84
79
|
if (r !== void 0) {
|
|
85
80
|
var n = r.call(e, t || "default");
|
|
86
|
-
if (typeof n != "object")
|
|
87
|
-
return n;
|
|
81
|
+
if (typeof n != "object") return n;
|
|
88
82
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
89
83
|
}
|
|
90
84
|
return (t === "string" ? String : Number)(e);
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mock Service Worker
|
|
5
|
+
* Mock Service Worker.
|
|
6
6
|
* @see https://github.com/mswjs/msw
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const PACKAGE_VERSION = '2.7.0'
|
|
12
|
+
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
|
|
12
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
14
|
const activeClientIds = new Set()
|
|
14
15
|
|
|
@@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) {
|
|
|
48
49
|
case 'INTEGRITY_CHECK_REQUEST': {
|
|
49
50
|
sendToClient(client, {
|
|
50
51
|
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
51
|
-
payload:
|
|
52
|
+
payload: {
|
|
53
|
+
packageVersion: PACKAGE_VERSION,
|
|
54
|
+
checksum: INTEGRITY_CHECKSUM,
|
|
55
|
+
},
|
|
52
56
|
})
|
|
53
57
|
break
|
|
54
58
|
}
|
|
@@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) {
|
|
|
58
62
|
|
|
59
63
|
sendToClient(client, {
|
|
60
64
|
type: 'MOCKING_ENABLED',
|
|
61
|
-
payload:
|
|
65
|
+
payload: {
|
|
66
|
+
client: {
|
|
67
|
+
id: client.id,
|
|
68
|
+
frameType: client.frameType,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
62
71
|
})
|
|
63
72
|
break
|
|
64
73
|
}
|
|
@@ -121,11 +130,6 @@ async function handleRequest(event, requestId) {
|
|
|
121
130
|
if (client && activeClientIds.has(client.id)) {
|
|
122
131
|
;(async function () {
|
|
123
132
|
const responseClone = response.clone()
|
|
124
|
-
// When performing original requests, response body will
|
|
125
|
-
// always be a ReadableStream, even for 204 responses.
|
|
126
|
-
// But when creating a new Response instance on the client,
|
|
127
|
-
// the body for a 204 response must be null.
|
|
128
|
-
const responseBody = response.status === 204 ? null : responseClone.body
|
|
129
133
|
|
|
130
134
|
sendToClient(
|
|
131
135
|
client,
|
|
@@ -137,11 +141,11 @@ async function handleRequest(event, requestId) {
|
|
|
137
141
|
type: responseClone.type,
|
|
138
142
|
status: responseClone.status,
|
|
139
143
|
statusText: responseClone.statusText,
|
|
140
|
-
body:
|
|
144
|
+
body: responseClone.body,
|
|
141
145
|
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
142
146
|
},
|
|
143
147
|
},
|
|
144
|
-
[
|
|
148
|
+
[responseClone.body],
|
|
145
149
|
)
|
|
146
150
|
})()
|
|
147
151
|
}
|
|
@@ -156,6 +160,10 @@ async function handleRequest(event, requestId) {
|
|
|
156
160
|
async function resolveMainClient(event) {
|
|
157
161
|
const client = await self.clients.get(event.clientId)
|
|
158
162
|
|
|
163
|
+
if (activeClientIds.has(event.clientId)) {
|
|
164
|
+
return client
|
|
165
|
+
}
|
|
166
|
+
|
|
159
167
|
if (client?.frameType === 'top-level') {
|
|
160
168
|
return client
|
|
161
169
|
}
|
|
@@ -184,12 +192,26 @@ async function getResponse(event, client, requestId) {
|
|
|
184
192
|
const requestClone = request.clone()
|
|
185
193
|
|
|
186
194
|
function passthrough() {
|
|
187
|
-
|
|
195
|
+
// Cast the request headers to a new Headers instance
|
|
196
|
+
// so the headers can be manipulated with.
|
|
197
|
+
const headers = new Headers(requestClone.headers)
|
|
198
|
+
|
|
199
|
+
// Remove the "accept" header value that marked this request as passthrough.
|
|
200
|
+
// This prevents request alteration and also keeps it compliant with the
|
|
201
|
+
// user-defined CORS policies.
|
|
202
|
+
const acceptHeader = headers.get('accept')
|
|
203
|
+
if (acceptHeader) {
|
|
204
|
+
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
205
|
+
const filteredValues = values.filter(
|
|
206
|
+
(value) => value !== 'msw/passthrough',
|
|
207
|
+
)
|
|
188
208
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
209
|
+
if (filteredValues.length > 0) {
|
|
210
|
+
headers.set('accept', filteredValues.join(', '))
|
|
211
|
+
} else {
|
|
212
|
+
headers.delete('accept')
|
|
213
|
+
}
|
|
214
|
+
}
|
|
193
215
|
|
|
194
216
|
return fetch(requestClone, { headers })
|
|
195
217
|
}
|
|
@@ -207,13 +229,6 @@ async function getResponse(event, client, requestId) {
|
|
|
207
229
|
return passthrough()
|
|
208
230
|
}
|
|
209
231
|
|
|
210
|
-
// Bypass requests with the explicit bypass header.
|
|
211
|
-
// Such requests can be issued by "ctx.fetch()".
|
|
212
|
-
const mswIntention = request.headers.get('x-msw-intention')
|
|
213
|
-
if (['bypass', 'passthrough'].includes(mswIntention)) {
|
|
214
|
-
return passthrough()
|
|
215
|
-
}
|
|
216
|
-
|
|
217
232
|
// Notify the client that a request has been intercepted.
|
|
218
233
|
const requestBuffer = await request.arrayBuffer()
|
|
219
234
|
const clientMessage = await sendToClient(
|
|
@@ -245,7 +260,7 @@ async function getResponse(event, client, requestId) {
|
|
|
245
260
|
return respondWithMock(clientMessage.data)
|
|
246
261
|
}
|
|
247
262
|
|
|
248
|
-
case '
|
|
263
|
+
case 'PASSTHROUGH': {
|
|
249
264
|
return passthrough()
|
|
250
265
|
}
|
|
251
266
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("./ChaiThemeFn-DQu-2Eh9.cjs"),o=(i=n.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...n.getChaiThemeOptions(i)}),r=n.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=o;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { g as r, d as a, p as i } from "./ChaiThemeFn-Cort9tch.js";
|
|
2
|
+
const t = (n = a) => ({
|
|
3
|
+
container: {
|
|
4
|
+
center: !0,
|
|
5
|
+
padding: "1rem",
|
|
6
|
+
screens: { "2xl": "1400px" }
|
|
7
|
+
},
|
|
8
|
+
...r(n)
|
|
9
|
+
}), l = i(function({ addBase: n, theme: o }) {
|
|
10
|
+
n({
|
|
11
|
+
"h1,h2,h3,h4,h5,h6": {
|
|
12
|
+
fontFamily: o("fontFamily.heading")
|
|
13
|
+
},
|
|
14
|
+
body: {
|
|
15
|
+
fontFamily: o("fontFamily.body"),
|
|
16
|
+
color: o("colors.foreground"),
|
|
17
|
+
backgroundColor: o("colors.background")
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
l as c,
|
|
23
|
+
t as g
|
|
24
|
+
};
|
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lodash-es"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./ChaiThemeFn-DQu-2Eh9.cjs"),r=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),q=require("@mhsdesign/jit-browser-tailwindcss"),F=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),O=require("@tailwindcss/forms"),$=require("@tailwindcss/typography"),T=require("./plugin-2xcljWGM.cjs"),a=require("react/jsx-runtime"),R=require("@chaibuilder/runtime"),g=require("react"),N=require("tailwind-merge"),Y=(e,s="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=s+r.last(u),u.join(":")}return`${s}${l}`}).join(" "));return r.flattenDeep(t).join(" ")},k=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(e){const s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(s,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function I(e,s,n=[],t="",i){return await q.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:T.getChaiBuilderTheme(e)},plugins:[O,$,F,v,T.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,
|
|
3
|
+
@tailwind utilities;`,s)}const M=(e,s,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return I(s,[t],[],"",n)},J=async(e,s=f.defaultThemeOptions,n=!1)=>await M(e,s,n);async function K(e){const s=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return a.jsx(g.Suspense,{children:g.createElement(e.component,{...e.props,...s})})}const L=r.memoize((e,s)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),i=N.twMerge(n,t);return s===""?i.replace(m.STYLES_KEY,"").trim():Y(i,s).replace(m.STYLES_KEY,"").trim()});function b(e,s){const n=r.get(e,`${s}_attrs`,{}),t=r.keys(n).join(" ");return r.includes(t,"x-show")&&!r.includes(t,"x-transition")&&(n["x-transition"]=""),n}function U(e,s){const n={};return Object.keys(e).forEach(t=>{if(r.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=L(e[t],s);n[t]={className:i,...b(e,t)}}}),n}function V(e,s){const n=r.get(e,"_bindings",{});return r.isEmpty(n)?{...e}:(r.each(n,(t,i)=>{r.isString(t)&&r.get(s,t,null)&&(e[i]=r.get(s,t,null))}),e)}function W(e,s,n){if(r.isEmpty(s))return e;const t=r.cloneDeep(e),i=r.get(n,"i18nProps",[]);return r.forEach(r.keys(t),o=>{i.includes(o)&&!r.isEmpty(s)&&(t[o]=r.get(t,`${o}-${s}`,t[o]))}),t}const z=()=>a.jsx("span",{children:"Loading..."});function w({blocks:e,parent:s,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:o="",fallbackLang:p="",metadata:l={}}){const u=e,E=c=>U(c,n),j=s?r.filter(e,{_parent:s}):r.filter(e,c=>r.isEmpty(c._parent));return a.jsx(a.Fragment,{children:g.Children.toArray(j.map((c,B)=>{const S={},_=r.filter(u,{_parent:c._id});S.children=_.length>0?a.jsx(w,{externalData:t,classPrefix:n,parent:c._id,blocks:u,lang:o||p,metadata:l}):null;const d=R.getRegisteredChaiBlock(c._type);if(d!==null){let h=c;const y=d.component;h={...d.defaults,...c},i&&(h=i(h));const x=o===p?"":o,C=r.omit({blockProps:{},inBuilder:!1,...h,index:B,...V(W(c,x,d),t),...E(h),...S,metadata:l,lang:o||p},["_parent"]);if(r.has(d,"dataProvider")){const P=r.get(d,"suspenseFallback",z);return a.jsx(g.Suspense,{fallback:g.createElement(P),children:a.jsx(K,{lang:o||p,metadata:l,dataProvider:d.dataProvider,block:c,component:y,props:C})})}return a.jsx(g.Suspense,{children:g.createElement(y,C)})}return a.jsxs("noscript",{children:[c._type," not found"]})}))})}exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=w;exports.convertToBlocks=k;exports.getStylesForBlocks=J;
|
package/dist/render.d.ts
CHANGED
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare type
|
|
3
|
+
declare type BorderRadiusValue = false | string;
|
|
4
|
+
|
|
5
|
+
declare type ChaiBlock<T = Record<string, any>> = {
|
|
4
6
|
_id: string;
|
|
5
|
-
_type: string;
|
|
6
7
|
_name?: string;
|
|
7
8
|
_parent?: string | null | undefined;
|
|
8
9
|
_bindings?: Record<string, string>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
12
|
-
primaryColor: string;
|
|
13
|
-
secondaryColor: string;
|
|
14
|
-
headingFont: string;
|
|
15
|
-
bodyFont: string;
|
|
16
|
-
roundedCorners: string;
|
|
17
|
-
bodyBgLightColor: string;
|
|
18
|
-
bodyBgDarkColor: string;
|
|
19
|
-
bodyTextLightColor: string;
|
|
20
|
-
bodyTextDarkColor: string;
|
|
10
|
+
_type: string;
|
|
21
11
|
} & T;
|
|
22
12
|
|
|
13
|
+
declare type ChaiBuilderThemeOptions = {
|
|
14
|
+
fontFamily: false | Record<VariableKey, string>;
|
|
15
|
+
borderRadius: BorderRadiusValue;
|
|
16
|
+
colors: false | {
|
|
17
|
+
group: string;
|
|
18
|
+
items: Record<VariableKey, [HSLColor, HSLColor]>;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare type ChaiBuilderThemeValues = {
|
|
23
|
+
fontFamily: Record<string, string>;
|
|
24
|
+
borderRadius: string;
|
|
25
|
+
colors: Record<string, string[]>;
|
|
26
|
+
};
|
|
27
|
+
|
|
23
28
|
/**
|
|
24
29
|
* This function converts the chai format content to chai blocks
|
|
25
30
|
* @param chaiFormatContent
|
|
26
31
|
*/
|
|
27
32
|
export declare const convertToBlocks: (chaiFormatContent: string) => ChaiBlock[];
|
|
28
33
|
|
|
29
|
-
export declare const
|
|
34
|
+
export declare const getChaiThemeCssVariables: (chaiTheme: Partial<ChaiBuilderThemeValues>) => string;
|
|
30
35
|
|
|
31
|
-
export declare
|
|
36
|
+
export declare const getStylesForBlocks: (blocks: ChaiBlock[], themeOptions?: ChaiBuilderThemeOptions, includeBaseStyles?: boolean) => Promise<string>;
|
|
37
|
+
|
|
38
|
+
export declare const getThemeFontsCSSImport: (chaiTheme: {
|
|
39
|
+
fontFamily: Record<string, string>;
|
|
40
|
+
}) => any;
|
|
41
|
+
|
|
42
|
+
export declare const getThemeFontsLinkMarkup: (chaiTheme: Pick<Partial<ChaiBuilderThemeValues>, "fontFamily">) => any;
|
|
43
|
+
|
|
44
|
+
declare type HSLColor = string;
|
|
45
|
+
|
|
46
|
+
export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, fallbackLang, metadata, }: {
|
|
32
47
|
blocks: ChaiBlock[];
|
|
33
48
|
parent?: string;
|
|
34
49
|
classPrefix?: string;
|
|
35
50
|
externalData?: Record<string, any>;
|
|
36
51
|
blockModifierCallback?: (block: ChaiBlock) => ChaiBlock;
|
|
37
52
|
lang?: string;
|
|
53
|
+
fallbackLang?: string;
|
|
54
|
+
metadata?: Record<string, any>;
|
|
38
55
|
}): JSX_2.Element;
|
|
39
56
|
|
|
57
|
+
declare type VariableKey = string;
|
|
58
|
+
|
|
40
59
|
export { }
|