@chaibuilder/sdk 1.3.0-beta.8 → 1.3.0-beta.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/CodeEditor-CTpbkvn0.cjs +1 -0
- package/dist/CodeEditor-ChxA5nBg.js +77 -0
- package/dist/STRINGS-eiGM83kj.js +7 -0
- package/dist/STRINGS-ew98weUe.cjs +1 -0
- package/dist/Topbar-QwR6PKnl.cjs +1 -0
- package/dist/Topbar-z1o2yz-v.js +113 -0
- package/dist/UnsplashImages-BZ4Uvn_u.cjs +1 -0
- package/dist/UnsplashImages-BiXwCeGg.js +189 -0
- package/dist/UploadImages-BeAGmTnm.js +101 -0
- package/dist/UploadImages-e9ItP1o-.cjs +1 -0
- package/dist/context-menu-BbqLeYFX.js +979 -0
- package/dist/context-menu-DfAXjmc8.cjs +1 -0
- package/dist/controls-C4n5ycp4.cjs +1 -0
- package/dist/controls-Com-zYCq.js +234 -0
- package/dist/core.cjs +1 -82
- package/dist/core.d.ts +8 -4
- package/dist/core.js +74 -74
- package/dist/iconBase-Cn2BsTrq.cjs +1 -0
- package/dist/iconBase-DHfFLkem.js +124 -0
- package/dist/index-Cu1kFTGh.cjs +63 -0
- package/dist/index-D1NbGHAC.js +9318 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/plugin-BOEoR5jk.js +44 -0
- package/dist/plugin-COMQcYlW.cjs +1 -0
- package/dist/plugin-Dw854zFv.js +107 -0
- package/dist/plugin-I9XxF65G.cjs +1 -0
- package/dist/render.cjs +2 -208
- package/dist/render.js +125 -171
- package/dist/runtime.cjs +1 -26
- package/dist/runtime.js +16 -16
- package/dist/style.css +2 -1529
- package/dist/tailwind.cjs +1 -78
- package/dist/tailwind.js +19 -21
- package/dist/ui.cjs +1 -392
- package/dist/ui.js +257 -268
- package/dist/web-blocks.cjs +3 -1241
- package/dist/web-blocks.js +555 -764
- package/package.json +1 -1
- package/dist/CodeEditor-1LboGb1I.cjs +0 -91
- package/dist/CodeEditor-BKgZeXwz.js +0 -91
- package/dist/STRINGS-3Sn_NeX1.cjs +0 -9
- package/dist/STRINGS-DdpfVlsV.js +0 -10
- package/dist/Topbar-B8IS6y4H.js +0 -135
- package/dist/Topbar-DXC7DFU1.cjs +0 -135
- package/dist/UnsplashImages-CjJ5szAy.cjs +0 -215
- package/dist/UnsplashImages-Ck9qpKR0.js +0 -215
- package/dist/UploadImages-DW1mj4MB.cjs +0 -117
- package/dist/UploadImages-DgAMZ8GR.js +0 -117
- package/dist/context-menu-BLbuduri.cjs +0 -1073
- package/dist/context-menu-BgtRnByf.js +0 -1042
- package/dist/controls-8EZmm0Ns.js +0 -234
- package/dist/controls-DaW52RjX.cjs +0 -233
- package/dist/iconBase-BSrIcOaG.cjs +0 -146
- package/dist/iconBase-CWgVxu0A.js +0 -147
- package/dist/index-Bjw2sUN2.cjs +0 -12139
- package/dist/index-D8_rAW8B.js +0 -12124
- package/dist/jsx-runtime-B6vEU3CM.cjs +0 -925
- package/dist/jsx-runtime-ClFauRgV.js +0 -926
- package/dist/plugin-BYwesM58.cjs +0 -54
- package/dist/plugin-BiDLHDo3.cjs +0 -114
- package/dist/plugin-BukD7GJR.js +0 -115
- package/dist/plugin-tVAEvXiS.js +0 -55
package/dist/render.js
CHANGED
|
@@ -1,209 +1,163 @@
|
|
|
1
|
-
import { last, flattenDeep
|
|
2
|
-
import { S as
|
|
3
|
-
import { j as
|
|
4
|
-
import
|
|
5
|
-
import { twMerge } from "tailwind-merge";
|
|
6
|
-
import { getBlockComponent } from "@chaibuilder/runtime";
|
|
7
|
-
import { createTailwindcss } from "@mhsdesign/jit-browser-tailwindcss";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { g as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
return newClasses.join(" ");
|
|
26
|
-
});
|
|
27
|
-
return flattenDeep(array).join(" ");
|
|
28
|
-
};
|
|
29
|
-
const convertToBlocks = (chaiFormatContent) => {
|
|
30
|
-
if (!chaiFormatContent) return [];
|
|
1
|
+
import { last as T, flattenDeep as $, memoize as N, filter as _, isEmpty as d, omit as R, isString as j, get as l, each as J, cloneDeep as P, forEach as I, keys as x, has as K, includes as C, replace as L } from "lodash-es";
|
|
2
|
+
import { S as f, a as B } from "./STRINGS-eiGM83kj.js";
|
|
3
|
+
import { j as u } from "./jsx-runtime-DGlMoOmv.js";
|
|
4
|
+
import w from "react";
|
|
5
|
+
import { twMerge as W } from "tailwind-merge";
|
|
6
|
+
import { getBlockComponent as Y } from "@chaibuilder/runtime";
|
|
7
|
+
import { createTailwindcss as v } from "@mhsdesign/jit-browser-tailwindcss";
|
|
8
|
+
import F from "@tailwindcss/forms";
|
|
9
|
+
import U from "@tailwindcss/typography";
|
|
10
|
+
import z from "@tailwindcss/aspect-ratio";
|
|
11
|
+
import { g as M, c as q } from "./plugin-BOEoR5jk.js";
|
|
12
|
+
const D = (t, r = "") => {
|
|
13
|
+
const s = t.replace(f, "").split(",").map((n) => n.split(" ").map((a) => {
|
|
14
|
+
if (a === "") return "";
|
|
15
|
+
if (a.includes(":")) {
|
|
16
|
+
const c = a.split(":");
|
|
17
|
+
return c[c.length - 1] = r + T(c), c.join(":");
|
|
18
|
+
}
|
|
19
|
+
return `${r}${a}`;
|
|
20
|
+
}).join(" "));
|
|
21
|
+
return $(s).join(" ");
|
|
22
|
+
}, ft = (t) => {
|
|
23
|
+
if (!t) return [];
|
|
31
24
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} catch (error) {
|
|
25
|
+
return JSON.parse(G(t)).filter((e) => !e._type.startsWith("@chai"));
|
|
26
|
+
} catch {
|
|
35
27
|
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
36
28
|
}
|
|
37
29
|
};
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
if (publicIndex !== -1) {
|
|
44
|
-
return decodedUrl.substring(publicIndex + 6);
|
|
45
|
-
}
|
|
46
|
-
return decodedUrl;
|
|
30
|
+
function G(t) {
|
|
31
|
+
const r = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
|
|
32
|
+
return t.replace(r, (e) => {
|
|
33
|
+
const s = decodeURIComponent(e), n = s.indexOf("public");
|
|
34
|
+
return n !== -1 ? s.substring(n + 6) : s;
|
|
47
35
|
});
|
|
48
36
|
}
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
Object.keys(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
};
|
|
58
|
-
const generateClassNames = memoize((styles, classPrefix) => {
|
|
59
|
-
const stylesArray = styles.replace(STYLES_KEY, "").split(",");
|
|
60
|
-
const classes = twMerge(stylesArray[0], stylesArray[1]);
|
|
61
|
-
if (classPrefix === "") return classes.replace(STYLES_KEY, "").trim();
|
|
62
|
-
return addPrefixToClasses(classes, classPrefix).replace(STYLES_KEY, "").trim();
|
|
37
|
+
const H = (t) => {
|
|
38
|
+
const r = {};
|
|
39
|
+
return Object.keys(t).forEach((e) => {
|
|
40
|
+
j(t[e]) && t[e].startsWith(B) && (r[e] = t[e].replace(B, "").split(","));
|
|
41
|
+
}), r;
|
|
42
|
+
}, Q = N((t, r) => {
|
|
43
|
+
const e = t.replace(f, "").split(","), s = W(e[0], e[1]);
|
|
44
|
+
return r === "" ? s.replace(f, "").trim() : D(s, r).replace(f, "").trim();
|
|
63
45
|
});
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const attrsKeys = keys(attrs).join(" ");
|
|
70
|
-
if (includes(attrsKeys, "x-show") && !includes(attrsKeys, "x-transition")) {
|
|
71
|
-
attrs["x-transition"] = "";
|
|
72
|
-
}
|
|
73
|
-
return attrs;
|
|
46
|
+
function V(t, r) {
|
|
47
|
+
const e = l(t, `${r}_attrs`, {});
|
|
48
|
+
K(e, "data-ai-key") && delete e["data-ai-key"];
|
|
49
|
+
const s = x(e).join(" ");
|
|
50
|
+
return C(s, "x-show") && !C(s, "x-transition") && (e["x-transition"] = ""), e;
|
|
74
51
|
}
|
|
75
|
-
function
|
|
76
|
-
const
|
|
77
|
-
Object.keys(
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
className:
|
|
82
|
-
...
|
|
52
|
+
function X(t, r) {
|
|
53
|
+
const e = {};
|
|
54
|
+
return Object.keys(t).forEach((s) => {
|
|
55
|
+
if (j(t[s]) && t[s].startsWith(f)) {
|
|
56
|
+
const n = Q(t[s], r);
|
|
57
|
+
e[s] = {
|
|
58
|
+
className: n,
|
|
59
|
+
...V(t, s)
|
|
83
60
|
};
|
|
84
61
|
}
|
|
85
|
-
});
|
|
86
|
-
return styles;
|
|
62
|
+
}), e;
|
|
87
63
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
block[key] = get(chaiData, value, null);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return block;
|
|
64
|
+
function Z(t, r) {
|
|
65
|
+
const e = l(t, "_bindings", {});
|
|
66
|
+
return d(e) ? { ...t } : (J(e, (s, n) => {
|
|
67
|
+
j(s) && l(r, s, null) && (t[n] = l(r, s, null));
|
|
68
|
+
}), t);
|
|
97
69
|
}
|
|
98
|
-
function
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
return block;
|
|
70
|
+
function b(t, r, e) {
|
|
71
|
+
if (d(r)) return t;
|
|
72
|
+
const s = P(t);
|
|
73
|
+
return I(x(s), (n) => {
|
|
74
|
+
l(e, ["props", n, "i18n"]) && !d(r) && (s[n] = l(s, `${n}-${r}`, s[n]));
|
|
75
|
+
}), s;
|
|
107
76
|
}
|
|
108
|
-
function
|
|
109
|
-
blocks,
|
|
110
|
-
parent,
|
|
111
|
-
classPrefix = "",
|
|
112
|
-
externalData = {},
|
|
113
|
-
blockModifierCallback,
|
|
114
|
-
lang
|
|
77
|
+
function E({
|
|
78
|
+
blocks: t,
|
|
79
|
+
parent: r,
|
|
80
|
+
classPrefix: e = "",
|
|
81
|
+
externalData: s = {},
|
|
82
|
+
blockModifierCallback: n,
|
|
83
|
+
lang: p
|
|
115
84
|
}) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
const blocks2 = filter(allBlocks, { _parent: block._id });
|
|
140
|
-
attrs.children = blocks2.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
141
|
-
RenderChaiBlocks,
|
|
85
|
+
const m = t, a = (i) => X(i, e), c = r ? _(t, { _parent: r }) : _(t, (i) => d(i._parent));
|
|
86
|
+
return /* @__PURE__ */ u.jsx(u.Fragment, { children: w.Children.toArray(
|
|
87
|
+
c.map((i, O) => {
|
|
88
|
+
const h = H(i), y = {};
|
|
89
|
+
d(h) || Object.keys(h).forEach((o) => {
|
|
90
|
+
y[o] = w.Children.toArray(
|
|
91
|
+
h[o].map((S) => /* @__PURE__ */ u.jsx(
|
|
92
|
+
E,
|
|
93
|
+
{
|
|
94
|
+
externalData: s,
|
|
95
|
+
classPrefix: e,
|
|
96
|
+
blocks: m,
|
|
97
|
+
parent: S,
|
|
98
|
+
lang: p
|
|
99
|
+
}
|
|
100
|
+
))
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
const A = _(m, { _parent: i._id });
|
|
104
|
+
y.children = A.length > 0 ? /* @__PURE__ */ u.jsx(
|
|
105
|
+
E,
|
|
142
106
|
{
|
|
143
|
-
externalData,
|
|
144
|
-
classPrefix,
|
|
145
|
-
parent:
|
|
146
|
-
blocks:
|
|
147
|
-
lang
|
|
107
|
+
externalData: s,
|
|
108
|
+
classPrefix: e,
|
|
109
|
+
parent: i._id,
|
|
110
|
+
blocks: m,
|
|
111
|
+
lang: p
|
|
148
112
|
}
|
|
149
113
|
) : null;
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
let
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
return React__default.createElement(
|
|
159
|
-
Component,
|
|
160
|
-
omit(
|
|
114
|
+
const g = Y(i._type);
|
|
115
|
+
if (g !== null) {
|
|
116
|
+
let o = i;
|
|
117
|
+
const S = g.component;
|
|
118
|
+
return o = { ...g.defaults, ...i }, n && (o = n(o)), w.createElement(
|
|
119
|
+
S,
|
|
120
|
+
R(
|
|
161
121
|
{
|
|
162
122
|
blockProps: {},
|
|
163
|
-
inBuilder:
|
|
164
|
-
...
|
|
165
|
-
index,
|
|
166
|
-
...
|
|
167
|
-
...
|
|
168
|
-
...
|
|
123
|
+
inBuilder: !1,
|
|
124
|
+
...o,
|
|
125
|
+
index: O,
|
|
126
|
+
...Z(b(i, p, g), s),
|
|
127
|
+
...a(o),
|
|
128
|
+
...y
|
|
169
129
|
},
|
|
170
130
|
["_parent"]
|
|
171
131
|
)
|
|
172
132
|
);
|
|
173
133
|
}
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
|
|
134
|
+
return /* @__PURE__ */ u.jsxs("noscript", { children: [
|
|
135
|
+
i._type,
|
|
176
136
|
" not found"
|
|
177
137
|
] });
|
|
178
138
|
})
|
|
179
139
|
) });
|
|
180
140
|
}
|
|
181
|
-
async function
|
|
182
|
-
|
|
141
|
+
async function k(t, r, e = [], s = "", n = !1) {
|
|
142
|
+
return await v({
|
|
183
143
|
tailwindConfig: {
|
|
184
144
|
darkMode: "class",
|
|
185
|
-
safelist,
|
|
186
|
-
theme: { extend:
|
|
187
|
-
plugins: [
|
|
188
|
-
corePlugins: { preflight:
|
|
189
|
-
...
|
|
145
|
+
safelist: e,
|
|
146
|
+
theme: { extend: M(t) },
|
|
147
|
+
plugins: [F, U, z, q],
|
|
148
|
+
corePlugins: { preflight: n },
|
|
149
|
+
...s ? { prefix: `${s}` } : {}
|
|
190
150
|
}
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
` ${includeBaseStyles ? "@tailwind base;" : ""}
|
|
151
|
+
}).generateStylesFromContent(
|
|
152
|
+
` ${n ? "@tailwind base;" : ""}
|
|
194
153
|
@tailwind components;
|
|
195
154
|
@tailwind utilities;`,
|
|
196
|
-
|
|
155
|
+
r
|
|
197
156
|
);
|
|
198
157
|
}
|
|
199
|
-
const
|
|
200
|
-
return getTailwindCSS(theme, [replace(JSON.stringify(blocks), /#styles:,?/g, "")], [], "", includeBaseStyles);
|
|
201
|
-
};
|
|
202
|
-
const getStylesForBlocks = async (blocks, theme = {}, includeBaseStyles = true) => {
|
|
203
|
-
return await getBlocksTailwindCSS(blocks, theme, includeBaseStyles);
|
|
204
|
-
};
|
|
158
|
+
const tt = (t, r, e = !1) => k(r, [L(JSON.stringify(t), /#styles:,?/g, "")], [], "", e), dt = async (t, r = {}, e = !0) => await tt(t, r, e);
|
|
205
159
|
export {
|
|
206
|
-
RenderChaiBlocks,
|
|
207
|
-
convertToBlocks,
|
|
208
|
-
getStylesForBlocks
|
|
160
|
+
E as RenderChaiBlocks,
|
|
161
|
+
ft as convertToBlocks,
|
|
162
|
+
dt as getStylesForBlocks
|
|
209
163
|
};
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const runtime = require("@chaibuilder/runtime");
|
|
4
|
-
const controls = require("./controls-DaW52RjX.cjs");
|
|
5
|
-
exports.Checkbox = controls.c;
|
|
6
|
-
exports.Code = controls.l;
|
|
7
|
-
exports.Color = controls.h;
|
|
8
|
-
exports.Icon = controls.q;
|
|
9
|
-
exports.Image = controls.x;
|
|
10
|
-
exports.InfoField = controls.u;
|
|
11
|
-
exports.Link = controls.w;
|
|
12
|
-
exports.List = controls.S;
|
|
13
|
-
exports.Model = controls.b;
|
|
14
|
-
exports.MultilineText = controls.f;
|
|
15
|
-
exports.Numeric = controls.s;
|
|
16
|
-
exports.RichText = controls.m;
|
|
17
|
-
exports.SelectOption = controls.y;
|
|
18
|
-
exports.SingleLineText = controls.g;
|
|
19
|
-
exports.Slot = controls.r;
|
|
20
|
-
exports.Styles = controls.T;
|
|
21
|
-
Object.keys(runtime).forEach((k) => {
|
|
22
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: () => runtime[k]
|
|
25
|
-
});
|
|
26
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),e=require("./controls-C4n5ycp4.cjs");exports.Checkbox=e.c;exports.Code=e.l;exports.Color=e.h;exports.Icon=e.q;exports.Image=e.x;exports.InfoField=e.u;exports.Link=e.w;exports.List=e.S;exports.Model=e.b;exports.MultilineText=e.f;exports.Numeric=e.s;exports.RichText=e.m;exports.SelectOption=e.y;exports.SingleLineText=e.g;exports.Slot=e.r;exports.Styles=e.T;Object.keys(o).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>o[t]})});
|
package/dist/runtime.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export * from "@chaibuilder/runtime";
|
|
2
|
-
import { c, l, h, q, x, u, w, S, b, f, s, m, y, g, r, T } from "./controls-
|
|
2
|
+
import { c as o, l as t, h as i, q as l, x as n, u as r, w as x, S as c, b as m, f as S, s as f, m as T, y as d, g, r as h, T as p } from "./controls-Com-zYCq.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
o as Checkbox,
|
|
5
|
+
t as Code,
|
|
6
|
+
i as Color,
|
|
7
|
+
l as Icon,
|
|
8
|
+
n as Image,
|
|
9
|
+
r as InfoField,
|
|
10
|
+
x as Link,
|
|
11
|
+
c as List,
|
|
12
|
+
m as Model,
|
|
13
|
+
S as MultilineText,
|
|
14
|
+
f as Numeric,
|
|
15
|
+
T as RichText,
|
|
16
|
+
d as SelectOption,
|
|
17
17
|
g as SingleLineText,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
h as Slot,
|
|
19
|
+
p as Styles
|
|
20
20
|
};
|