@chaibuilder/sdk 2.0.0-beta.96 → 2.0.0-beta.97
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/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/context-menu-C4lLV8gP.cjs +1 -0
- package/dist/context-menu-D5ViOi6K.js +831 -0
- package/dist/core.cjs +5 -11772
- package/dist/core.js +3993 -6892
- package/dist/getSplitClasses-DodqA_KW.cjs +1 -0
- package/dist/getSplitClasses-DphwgQiE.js +48 -0
- package/dist/iconBase-Cn2BsTrq.cjs +1 -0
- package/dist/iconBase-DHfFLkem.js +124 -0
- package/dist/plugin-2xcljWGM.cjs +1 -0
- package/dist/plugin-kUMxtQR5.js +24 -0
- package/dist/render.cjs +2 -247
- package/dist/render.js +150 -205
- package/dist/runtime.cjs +1 -9
- package/dist/sdk.css +1 -1336
- package/dist/tailwind.cjs +1 -78
- package/dist/tailwind.js +19 -21
- package/dist/ui.cjs +1 -378
- package/dist/ui.js +244 -254
- package/dist/web-blocks.cjs +2 -1679
- package/dist/web-blocks.js +518 -747
- package/package.json +1 -1
- package/dist/ChaiThemeFn-DcE5RdLQ.cjs +0 -236
- package/dist/ChaiThemeFn-DzirXKjI.js +0 -237
- package/dist/CodeEditor-C8_JzwHn.cjs +0 -81
- package/dist/CodeEditor-DdIk_PEV.js +0 -81
- package/dist/Topbar-62QmCKWL.cjs +0 -18
- package/dist/Topbar-Cqt0j3Yt.js +0 -18
- package/dist/context-menu-DHla8ofZ.js +0 -893
- package/dist/context-menu-DawHUIXd.cjs +0 -923
- package/dist/getSplitClasses-BuALfSLX.js +0 -54
- package/dist/getSplitClasses-mbQmvwI3.cjs +0 -53
- package/dist/iconBase-BSrIcOaG.cjs +0 -146
- package/dist/iconBase-CWgVxu0A.js +0 -147
- package/dist/plugin-BcTnEZwx.cjs +0 -26
- package/dist/plugin-DGEKY3uC.js +0 -27
package/dist/render.js
CHANGED
|
@@ -1,249 +1,194 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { a, b, c } from "./ChaiThemeFn-
|
|
3
|
-
import { last, flattenDeep, memoize, get, filter, isEmpty, omit, has, cloneDeep, forEach, keys, isString, find, includes } from "lodash-es";
|
|
4
|
-
import { g as
|
|
5
|
-
import { createTailwindcss } from "@mhsdesign/jit-browser-tailwindcss";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { g as
|
|
11
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { getRegisteredChaiBlock } from "@chaibuilder/runtime";
|
|
13
|
-
import
|
|
14
|
-
import { twMerge } from "tailwind-merge";
|
|
15
|
-
const
|
|
16
|
-
const { classes:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
return newClasses.join(" ");
|
|
29
|
-
});
|
|
30
|
-
return flattenDeep(array).join(" ");
|
|
31
|
-
};
|
|
32
|
-
const convertToBlocks = (chaiFormatContent) => {
|
|
33
|
-
if (!chaiFormatContent) return [];
|
|
1
|
+
import { d as U } from "./ChaiThemeFn-Cort9tch.js";
|
|
2
|
+
import { a as Rt, b as $t, c as Ft } from "./ChaiThemeFn-Cort9tch.js";
|
|
3
|
+
import { last as V, flattenDeep as k, memoize as j, get as u, filter as h, isEmpty as f, omit as D, has as K, cloneDeep as x, forEach as O, keys as w, isString as v, find as S, includes as E } from "lodash-es";
|
|
4
|
+
import { g as b, S as y } from "./getSplitClasses-DphwgQiE.js";
|
|
5
|
+
import { createTailwindcss as M } from "@mhsdesign/jit-browser-tailwindcss";
|
|
6
|
+
import W from "@tailwindcss/aspect-ratio";
|
|
7
|
+
import Y from "@tailwindcss/container-queries";
|
|
8
|
+
import z from "@tailwindcss/forms";
|
|
9
|
+
import L from "@tailwindcss/typography";
|
|
10
|
+
import { g as Q, c as q } from "./plugin-kUMxtQR5.js";
|
|
11
|
+
import { jsx as d, Fragment as G, jsxs as H } from "react/jsx-runtime";
|
|
12
|
+
import { getRegisteredChaiBlock as R } from "@chaibuilder/runtime";
|
|
13
|
+
import _, { Suspense as C, createElement as X } from "react";
|
|
14
|
+
import { twMerge as Z } from "tailwind-merge";
|
|
15
|
+
const tt = (t, s = "") => {
|
|
16
|
+
const { classes: n } = b(t), e = n.split(" ").map((r) => r.split(" ").map((o) => {
|
|
17
|
+
if (o === "") return "";
|
|
18
|
+
if (o.includes(":")) {
|
|
19
|
+
const a = o.split(":");
|
|
20
|
+
return a[a.length - 1] = s + V(a), a.join(":");
|
|
21
|
+
}
|
|
22
|
+
return `${s}${o}`;
|
|
23
|
+
}).join(" "));
|
|
24
|
+
return k(e).join(" ");
|
|
25
|
+
}, xt = (t) => {
|
|
26
|
+
if (!t) return [];
|
|
34
27
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} catch (error) {
|
|
28
|
+
return JSON.parse(et(t)).filter((n) => !n._type.startsWith("@chai"));
|
|
29
|
+
} catch {
|
|
38
30
|
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
39
31
|
}
|
|
40
32
|
};
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
return
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
if (publicIndex !== -1) {
|
|
47
|
-
return decodedUrl.substring(publicIndex + 6);
|
|
48
|
-
}
|
|
49
|
-
return decodedUrl;
|
|
33
|
+
function et(t) {
|
|
34
|
+
const s = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
|
|
35
|
+
return t.replace(s, (n) => {
|
|
36
|
+
const e = decodeURIComponent(n), r = e.indexOf("public");
|
|
37
|
+
return r !== -1 ? e.substring(r + 6) : e;
|
|
50
38
|
});
|
|
51
39
|
}
|
|
52
|
-
async function
|
|
53
|
-
|
|
40
|
+
async function nt(t, s, n = [], e = "", r) {
|
|
41
|
+
return await M({
|
|
54
42
|
tailwindConfig: {
|
|
55
43
|
darkMode: "class",
|
|
56
|
-
safelist,
|
|
57
|
-
theme: { extend:
|
|
58
|
-
plugins: [
|
|
59
|
-
corePlugins: { preflight:
|
|
60
|
-
...
|
|
44
|
+
safelist: n,
|
|
45
|
+
theme: { extend: Q(t) },
|
|
46
|
+
plugins: [z, L, W, Y, q],
|
|
47
|
+
corePlugins: { preflight: r },
|
|
48
|
+
...e ? { prefix: `${e}` } : {}
|
|
61
49
|
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
` ${includeBaseStyles ? "@tailwind base;" : ""}
|
|
50
|
+
}).generateStylesFromContent(
|
|
51
|
+
` ${r ? "@tailwind base;" : ""}
|
|
65
52
|
@tailwind components;
|
|
66
53
|
@tailwind utilities;`,
|
|
67
|
-
|
|
54
|
+
s
|
|
68
55
|
);
|
|
69
56
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return await getBlocksTailwindCSS(blocks, themeOptions, includeBaseStyles);
|
|
78
|
-
};
|
|
79
|
-
async function AsyncPropsBlock(props) {
|
|
80
|
-
const dataProps = await (props == null ? void 0 : props.dataProvider(props.block, props.lang, props.metadata));
|
|
81
|
-
return /* @__PURE__ */ jsx(Suspense, { children: React__default.createElement(props.component, { ...props.props, ...dataProps }) });
|
|
57
|
+
const st = (t, s, n) => {
|
|
58
|
+
const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (r, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
|
|
59
|
+
return nt(s, [e], [], "", n);
|
|
60
|
+
}, Ot = async (t, s = U, n = !1) => await st(t, s, n);
|
|
61
|
+
async function rt(t) {
|
|
62
|
+
const s = await (t == null ? void 0 : t.dataProvider(t.block, t.lang, t.metadata));
|
|
63
|
+
return /* @__PURE__ */ d(C, { children: _.createElement(t.component, { ...t.props, ...s }) });
|
|
82
64
|
}
|
|
83
|
-
const
|
|
84
|
-
const { baseClasses, classes:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (matches) {
|
|
97
|
-
matches.forEach((match) => {
|
|
98
|
-
const binding = match.slice(2, -2);
|
|
99
|
-
const bindingValue = get(pageExternalData, binding, match);
|
|
100
|
-
value = value.replace(match, bindingValue);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
clonedBlock[key] = value;
|
|
65
|
+
const it = j((t, s) => {
|
|
66
|
+
const { baseClasses: n, classes: e } = b(t), r = Z(n, e);
|
|
67
|
+
return s === "" ? r.replace(y, "").trim() : tt(r, s).replace(y, "").trim();
|
|
68
|
+
}), ot = (t, s) => {
|
|
69
|
+
const n = x(t);
|
|
70
|
+
return O(w(n), (e) => {
|
|
71
|
+
if (v(n[e])) {
|
|
72
|
+
let r = n[e];
|
|
73
|
+
const i = /\{\{(.*?)\}\}/g, l = r.match(i);
|
|
74
|
+
l && l.forEach((o) => {
|
|
75
|
+
const a = o.slice(2, -2), g = u(s, a, o);
|
|
76
|
+
r = r.replace(o, g);
|
|
77
|
+
}), n[e] = r;
|
|
104
78
|
}
|
|
105
|
-
});
|
|
106
|
-
return clonedBlock;
|
|
79
|
+
}), n;
|
|
107
80
|
};
|
|
108
|
-
function
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (includes(attrsKeys, "x-show") && !includes(attrsKeys, "x-transition")) {
|
|
112
|
-
attrs["x-transition"] = "";
|
|
113
|
-
}
|
|
114
|
-
return attrs;
|
|
81
|
+
function ct(t, s) {
|
|
82
|
+
const n = u(t, `${s}_attrs`, {}), e = w(n).join(" ");
|
|
83
|
+
return E(e, "x-show") && !E(e, "x-transition") && (n["x-transition"] = ""), n;
|
|
115
84
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
Object.keys(
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
className:
|
|
123
|
-
...
|
|
85
|
+
function at(t, s) {
|
|
86
|
+
const n = {};
|
|
87
|
+
return Object.keys(t).forEach((e) => {
|
|
88
|
+
if (v(t[e]) && t[e].startsWith(y)) {
|
|
89
|
+
const r = it(t[e], s);
|
|
90
|
+
n[e] = {
|
|
91
|
+
className: r,
|
|
92
|
+
...ct(t, e)
|
|
124
93
|
};
|
|
125
94
|
}
|
|
126
|
-
});
|
|
127
|
-
return styles;
|
|
95
|
+
}), n;
|
|
128
96
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
block[key] = get(block, `${key}-${lang}`, block[key]);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
return block;
|
|
97
|
+
function lt(t, s, n) {
|
|
98
|
+
if (f(s)) return t;
|
|
99
|
+
const e = x(t), r = u(n, "i18nProps", []);
|
|
100
|
+
return O(w(e), (i) => {
|
|
101
|
+
r.includes(i) && !f(s) && (e[i] = u(e, `${i}-${s}`, e[i]));
|
|
102
|
+
}), e;
|
|
139
103
|
}
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
const SuspenseFallback = () => /* @__PURE__ */ jsx("span", { children: "Loading..." });
|
|
162
|
-
function RenderChaiBlocks({
|
|
163
|
-
blocks,
|
|
164
|
-
parent,
|
|
165
|
-
classPrefix = "",
|
|
166
|
-
externalData = {},
|
|
167
|
-
blockModifierCallback = null,
|
|
168
|
-
lang = "",
|
|
169
|
-
fallbackLang = "",
|
|
170
|
-
metadata = {}
|
|
104
|
+
const ut = j((t) => {
|
|
105
|
+
const s = R(t), n = u(s, "schema.properties", {});
|
|
106
|
+
return Object.fromEntries(Object.entries(n).filter(([, e]) => u(e, "runtime", !1)));
|
|
107
|
+
}), pt = (t, s, n) => f(n) ? {} : Object.entries(n).reduce((e, [r, i]) => {
|
|
108
|
+
const l = [];
|
|
109
|
+
let o = S(t, { _id: s });
|
|
110
|
+
for (; o; )
|
|
111
|
+
l.push(o), o = S(t, { _id: o._parent });
|
|
112
|
+
const a = S(l, { _type: i.block });
|
|
113
|
+
return a && (e[r] = u(a, u(i, "prop"), null)), e;
|
|
114
|
+
}, {}), dt = () => /* @__PURE__ */ d("span", { children: "Loading..." });
|
|
115
|
+
function mt({
|
|
116
|
+
blocks: t,
|
|
117
|
+
parent: s,
|
|
118
|
+
classPrefix: n = "",
|
|
119
|
+
externalData: e = {},
|
|
120
|
+
blockModifierCallback: r = null,
|
|
121
|
+
lang: i = "",
|
|
122
|
+
fallbackLang: l = "",
|
|
123
|
+
metadata: o = {}
|
|
171
124
|
}) {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const blocks2 = filter(allBlocks, { _parent: block._id });
|
|
179
|
-
attrs.children = blocks2.length > 0 ? /* @__PURE__ */ jsx(
|
|
180
|
-
RenderChaiBlocks,
|
|
125
|
+
const a = t, g = (c) => at(c, n), $ = s ? h(t, { _parent: s }) : h(t, (c) => f(c._parent));
|
|
126
|
+
return /* @__PURE__ */ d(G, { children: _.Children.toArray(
|
|
127
|
+
$.map((c, F) => {
|
|
128
|
+
const P = {}, N = h(a, { _parent: c._id });
|
|
129
|
+
P.children = N.length > 0 ? /* @__PURE__ */ d(
|
|
130
|
+
mt,
|
|
181
131
|
{
|
|
182
|
-
externalData,
|
|
183
|
-
classPrefix,
|
|
184
|
-
parent:
|
|
185
|
-
blocks:
|
|
186
|
-
lang:
|
|
187
|
-
metadata
|
|
132
|
+
externalData: e,
|
|
133
|
+
classPrefix: n,
|
|
134
|
+
parent: c._id,
|
|
135
|
+
blocks: a,
|
|
136
|
+
lang: i || l,
|
|
137
|
+
metadata: o
|
|
188
138
|
}
|
|
189
139
|
) : null;
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
let
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
syncedBlock = blockModifierCallback(syncedBlock);
|
|
197
|
-
}
|
|
198
|
-
const langToUse = lang === fallbackLang ? "" : lang;
|
|
199
|
-
const runtimeProps = getRuntimePropValues(allBlocks, block._id, getRuntimeProps(block._type));
|
|
200
|
-
const props = omit(
|
|
140
|
+
const p = R(c._type);
|
|
141
|
+
if (p !== null) {
|
|
142
|
+
let m = c;
|
|
143
|
+
const B = p.component;
|
|
144
|
+
m = { ...p.defaults, ...c }, r && (m = r(m));
|
|
145
|
+
const A = i === l ? "" : i, I = pt(a, c._id, ut(c._type)), T = D(
|
|
201
146
|
{
|
|
202
147
|
blockProps: {},
|
|
203
|
-
inBuilder:
|
|
204
|
-
...
|
|
205
|
-
index,
|
|
206
|
-
...
|
|
207
|
-
...
|
|
208
|
-
...
|
|
209
|
-
...
|
|
210
|
-
metadata,
|
|
211
|
-
lang:
|
|
148
|
+
inBuilder: !1,
|
|
149
|
+
...m,
|
|
150
|
+
index: F,
|
|
151
|
+
...ot(lt(c, A, p), e),
|
|
152
|
+
...g(m),
|
|
153
|
+
...P,
|
|
154
|
+
...I,
|
|
155
|
+
metadata: o,
|
|
156
|
+
lang: i || l
|
|
212
157
|
},
|
|
213
158
|
["_parent"]
|
|
214
159
|
);
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
|
|
160
|
+
if (K(p, "dataProvider")) {
|
|
161
|
+
const J = u(
|
|
162
|
+
p,
|
|
218
163
|
"suspenseFallback",
|
|
219
|
-
|
|
164
|
+
dt
|
|
220
165
|
);
|
|
221
|
-
return /* @__PURE__ */
|
|
222
|
-
|
|
166
|
+
return /* @__PURE__ */ d(C, { fallback: X(J), children: /* @__PURE__ */ d(
|
|
167
|
+
rt,
|
|
223
168
|
{
|
|
224
|
-
lang:
|
|
225
|
-
metadata,
|
|
226
|
-
dataProvider:
|
|
227
|
-
block,
|
|
228
|
-
component:
|
|
229
|
-
props
|
|
169
|
+
lang: i || l,
|
|
170
|
+
metadata: o,
|
|
171
|
+
dataProvider: p.dataProvider,
|
|
172
|
+
block: c,
|
|
173
|
+
component: B,
|
|
174
|
+
props: T
|
|
230
175
|
}
|
|
231
176
|
) });
|
|
232
177
|
}
|
|
233
|
-
return /* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ d(C, { children: _.createElement(B, T) });
|
|
234
179
|
}
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
|
|
180
|
+
return /* @__PURE__ */ H("noscript", { children: [
|
|
181
|
+
c._type,
|
|
237
182
|
" not found"
|
|
238
183
|
] });
|
|
239
184
|
})
|
|
240
185
|
) });
|
|
241
186
|
}
|
|
242
187
|
export {
|
|
243
|
-
RenderChaiBlocks,
|
|
244
|
-
convertToBlocks,
|
|
245
|
-
|
|
246
|
-
getStylesForBlocks,
|
|
247
|
-
|
|
248
|
-
|
|
188
|
+
mt as RenderChaiBlocks,
|
|
189
|
+
xt as convertToBlocks,
|
|
190
|
+
Rt as getChaiThemeCssVariables,
|
|
191
|
+
Ot as getStylesForBlocks,
|
|
192
|
+
$t as getThemeFontsCSSImport,
|
|
193
|
+
Ft as getThemeFontsLinkMarkup
|
|
249
194
|
};
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const runtime = require("@chaibuilder/runtime");
|
|
4
|
-
Object.keys(runtime).forEach((k) => {
|
|
5
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: () => runtime[k]
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|