@chaibuilder/sdk 1.2.23 → 1.2.25
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 +6 -5
- package/dist/AddBlocks-Ol3iIVKa.js +207 -0
- package/dist/AddBlocks-a1c-7Ewz.cjs +1 -0
- package/dist/BrandingOptions-6rnt0UaA.cjs +1 -0
- package/dist/{BrandingOptions-eUSoIgjj.js → BrandingOptions-iTyWpwTs.js} +40 -54
- package/dist/CanvasArea-R4ogF9AT.cjs +55 -0
- package/dist/{CanvasArea-ulUy_rmB.js → CanvasArea-dZjng782.js} +340 -324
- package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +163 -0
- package/dist/ChaiBuilderEditor-vP4at00I.js +27974 -0
- package/dist/{Class-lGzsNBOK.js → Class-ahc3NIbq.js} +26 -29
- package/dist/Class-eieto7e-.cjs +1 -0
- package/dist/Controls-3Cc1XYXg.js +105 -0
- package/dist/Controls-ky25Ebo3.cjs +1 -0
- package/dist/CurrentPage-3gQTH0Zt.cjs +1 -0
- package/dist/{CurrentPage-SFhXzQMy.js → CurrentPage-Kmfp-kFk.js} +41 -55
- package/dist/Functions-Hvon6AMZ.cjs +1 -0
- package/dist/Functions-NzT2Six_.js +15 -0
- package/dist/ImagesPanel-J1RlG7xG.cjs +1 -0
- package/dist/ImagesPanel-Wb0GF_NA.js +29 -0
- package/dist/ListTree-CZ-mtjZ9.cjs +1 -0
- package/dist/{ListTree-ZeVWczTF.js → ListTree-N3jeD790.js} +92 -102
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-CNqNUapY.js} +10 -4
- package/dist/MODIFIERS-o1p3VnpS.cjs +1 -0
- package/dist/PagesPanel-Gi0z6gaf.cjs +1 -0
- package/dist/PagesPanel-u1IB-nRr.js +48 -0
- package/dist/ProjectPanel-EydGZmMW.js +71 -0
- package/dist/ProjectPanel-kiiljG4H.cjs +1 -0
- package/dist/{STRINGS--j49GZJP.js → STRINGS-b432aBJJ.js} +2 -2
- package/dist/Settings-8ilCSH8b.cjs +1 -0
- package/dist/{Settings-FZWm8Fc3.js → Settings-jCcd-VE6.js} +407 -401
- package/dist/SidePanels-T36C6Lhc.cjs +1 -0
- package/dist/{SidePanels-wrkkpcGE.js → SidePanels-pHMYprpW.js} +107 -117
- package/dist/Topbar-CvWQuspR.cjs +1 -0
- package/dist/Topbar-pbIDUE_B.js +122 -0
- package/dist/UnsplashImages-KBZPd9dv.cjs +1 -0
- package/dist/{UnsplashImages-eZedbK2J.js → UnsplashImages-L7x_3RQf.js} +50 -63
- package/dist/UploadImages-GkkJVAgG.cjs +1 -0
- package/dist/{UploadImages-71QziLbr.js → UploadImages-zdEJRLD8.js} +37 -60
- package/dist/accordion-oPUeqPCZ.js +42 -0
- package/dist/accordion-ynvFtV_p.cjs +1 -0
- package/dist/add-page-modal-9SGv2hgc.cjs +1 -0
- package/dist/add-page-modal-JCDXZIPW.js +95 -0
- package/dist/alert-dialog-P9xMMB6C.cjs +1 -0
- package/dist/alert-dialog-rypfO5ly.js +64 -0
- package/dist/badge-E-S7CqUt.cjs +1 -0
- package/dist/badge-tEwO7C51.js +23 -0
- package/dist/block-helpers-OKHmRRol.cjs +1 -0
- package/dist/block-helpers-oSFpSsGz.js +23 -0
- package/dist/command-BxR6jaCI.cjs +1 -0
- package/dist/command-Pn3HKDuV.js +97 -0
- package/dist/confirm-alert-uNm0lZ0y.cjs +1 -0
- package/dist/confirm-alert-wR5_VJ1l.js +36 -0
- package/dist/context-menu-8dC9uGXj.js +122 -0
- package/dist/context-menu-IgLbIuth.cjs +1 -0
- package/dist/{controls-OfJWSEqC.js → controls-IS5qnRce.js} +20 -85
- package/dist/controls-L7DPvB0m.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +7 -4
- package/dist/core.js +150 -75
- package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-4kA60XdB.js} +6 -8
- package/dist/defaultTheme-mrkeGFGI.cjs +1 -0
- package/dist/delete-page-modal-7KmP1elv.js +67 -0
- package/dist/delete-page-modal-SgfwvfNu.cjs +1 -0
- package/dist/dropdown-menu-El86_9Uo.js +124 -0
- package/dist/dropdown-menu-SiHzqWwZ.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +3 -292
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +5 -2
- package/dist/email.js +18 -37
- package/dist/{form-zKUMQFuB.js → form-0_RLz2TB.js} +12 -12
- package/dist/form-W58AVUdf.cjs +1 -0
- package/dist/hover-card-KUwpDkW8.cjs +1 -0
- package/dist/hover-card-q138xxXR.js +45 -0
- package/dist/{html-to-json-ngX9ef2u.js → html-to-json-2xtb7520.js} +41 -41
- package/dist/{html-to-json-efmv1pCj.cjs → html-to-json-uSnxl72F.cjs} +1 -1
- package/dist/iconBase-gbUAAO2L.cjs +1 -0
- package/dist/iconBase-h4DuR_XT.js +63 -0
- package/dist/index-9MmykVSc.cjs +1 -0
- package/dist/index-hElOGcFr.js +2200 -0
- package/dist/index-lDTsQp7h.js +188 -0
- package/dist/index-rq5Y9ZDy.cjs +1 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/label-KaP7MRrs.js +10 -0
- package/dist/label-tFm8HZdb.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +62 -66
- package/dist/link-WbcKdQ9k.cjs +1 -0
- package/dist/link-xuhP-4dN.js +196 -0
- package/dist/page-viewer-Hx5hxHKm.cjs +1 -0
- package/dist/{page-viewer-7AwzWRtB.js → page-viewer-NnOwmAmu.js} +44 -58
- package/dist/popover-a84pbVhQ.js +23 -0
- package/dist/popover-fKjgcRUx.cjs +1 -0
- package/dist/{project-general-setting-pYPoqvqd.js → project-general-setting-9ju3TDju.js} +35 -43
- package/dist/project-general-setting-FxkwjvJz.cjs +1 -0
- package/dist/{project-seo-setting-zXKOcjep.js → project-seo-setting-36CdUszM.js} +23 -40
- package/dist/project-seo-setting-RU7qiXxb.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +13 -14
- package/dist/scroll-area-FiHvy-TZ.cjs +1 -0
- package/dist/scroll-area-ewXbxc3n.js +30 -0
- package/dist/select-7bjg-rr9.cjs +1 -0
- package/dist/select-POGdEDHT.js +75 -0
- package/dist/separator-3Civ-6hb.cjs +1 -0
- package/dist/separator-SctTn0Qi.js +18 -0
- package/dist/single-page-detail-beY0MT1b.cjs +1 -0
- package/dist/{single-page-detail-q2TDxN-P.js → single-page-detail-hD1jKZ8k.js} +65 -73
- package/dist/skeleton-STeL9VrJ.cjs +1 -0
- package/dist/skeleton-lu8e7q2y.js +239 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +5 -2
- package/dist/studio.js +24 -40
- package/dist/tabs-_4WbA1cc.cjs +1 -0
- package/dist/tabs-yQ3oGziM.js +106 -0
- package/dist/textarea-1kZEh7ki.cjs +1 -0
- package/dist/textarea-b2QvVhrK.js +73 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +364 -159
- package/dist/useAddBlock-8pxOEYIl.cjs +1 -0
- package/dist/useAddBlock-FEKFJNwQ.js +69 -0
- package/dist/useChaiExternalData-fkFgoS80.js +6 -0
- package/dist/useChaiExternalData-rwoAZ6uU.cjs +1 -0
- package/dist/useDarkMode-7i57segK.cjs +1 -0
- package/dist/useDarkMode-8VHJlYyE.js +23 -0
- package/dist/useSelectedBreakpoints-6NK5qd7T.js +10 -0
- package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +1 -0
- package/dist/useStylingState-Iuj84yvc.js +186 -0
- package/dist/useStylingState-OIvJMV6p.cjs +1 -0
- package/dist/useUiLibraries-nCdauJ4N.cjs +1 -0
- package/dist/useUiLibraries-psyWFbNc.js +12 -0
- package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +1 -0
- package/dist/useUpdateBlocksProps-vWcDp-P9.js +23 -0
- package/dist/utils-dze1SGvB.js +6 -0
- package/dist/utils-qK_SjzzV.cjs +1 -0
- package/dist/web-blocks.cjs +1 -6
- package/dist/web-blocks.js +3 -1153
- package/package.json +1 -1
- package/dist/AddBlocks-b0Vk6eqO.js +0 -206
- package/dist/AddBlocks-bgu08YJC.cjs +0 -1
- package/dist/BrandingOptions-AljW1cXz.cjs +0 -1
- package/dist/CanvasArea-dp1tzDkK.cjs +0 -55
- package/dist/Class-PoYusiA5.cjs +0 -1
- package/dist/CurrentPage-rWHgPomd.cjs +0 -1
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/ListTree-5n8U4-IF.cjs +0 -1
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/PagesPanel-IkZjy0Gn.js +0 -64
- package/dist/PagesPanel-sBN51kKZ.cjs +0 -1
- package/dist/ProjectPanel-e98TJLfI.js +0 -85
- package/dist/ProjectPanel-lbQH31jc.cjs +0 -1
- package/dist/Settings-qytQoyTv.cjs +0 -1
- package/dist/SidePanels-YRIM1IPq.cjs +0 -1
- package/dist/Topbar-LUyDFBkK.js +0 -129
- package/dist/Topbar-NOSnWo7V.cjs +0 -1
- package/dist/UnsplashImages-f-ObKOC-.cjs +0 -1
- package/dist/UploadImages-oOnccvT9.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-g3fd00P5.cjs +0 -1
- package/dist/add-page-modal-yQ6qL6Ui.js +0 -104
- package/dist/confirm-alert-3flAvzWH.js +0 -60
- package/dist/confirm-alert-LQsGNYz8.cjs +0 -1
- package/dist/controls-KK2oLIa8.cjs +0 -1
- package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
- package/dist/delete-page-modal-iMmkPec0.js +0 -83
- package/dist/delete-page-modal-tzZmqGzE.cjs +0 -1
- package/dist/empty-slot-ZBlsQi6m.js +0 -15
- package/dist/empty-slot-nzYOgZuS.cjs +0 -1
- package/dist/form-LBHtTduy.cjs +0 -1
- package/dist/index--dUsFH1I.cjs +0 -1
- package/dist/index-HD1UKc4P.js +0 -3079
- package/dist/index-YpnaudSM.js +0 -63
- package/dist/index-bOWwCMRF.cjs +0 -206
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-ecnGWzh9.cjs +0 -1
- package/dist/index-fvMaxES9.cjs +0 -1
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-m4WGov7e.js +0 -2202
- package/dist/index-uLtBNl55.js +0 -39503
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/page-viewer-5gTszT-n.cjs +0 -1
- package/dist/project-general-setting-52CTYL_w.cjs +0 -1
- package/dist/project-seo-setting-jTweI1DX.cjs +0 -1
- package/dist/single-page-detail-jy2SPcp1.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("jotai"),t=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),a=t.atomWithStorage("canvasZoom",100),n=()=>e.useAtom(a),r=t.atomWithStorage("selectedBreakpoints",["XS","MD","XL"]),c=()=>{const[o,s]=e.useAtom(r);return[o,s]};exports.useCanvasZoom=n;exports.useSelectedBreakpoints=c;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { useCallback as R } from "react";
|
|
2
|
+
import { atom as B, useSetAtom as D, useAtomValue as M, useAtom as O } from "jotai";
|
|
3
|
+
import { filter as p, map as d, isNull as S, includes as g, each as y, find as E, pick as q, sortBy as h, first as x, get as b, startsWith as v } from "lodash-es";
|
|
4
|
+
import { D as Q, F as _, t as j, G, H as I } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
5
|
+
import { c as f } from "./Class-ahc3NIbq.js";
|
|
6
|
+
import { S as k } from "./STRINGS-b432aBJJ.js";
|
|
7
|
+
import { c as L, d as P } from "./useDarkMode-8VHJlYyE.js";
|
|
8
|
+
const U = (e) => {
|
|
9
|
+
const s = e.replace(k, "").split(",");
|
|
10
|
+
return { baseClasses: s[0], classes: s[1] };
|
|
11
|
+
}, T = {
|
|
12
|
+
xs: 420,
|
|
13
|
+
sm: 620,
|
|
14
|
+
md: 768,
|
|
15
|
+
lg: 1024,
|
|
16
|
+
xl: 1280,
|
|
17
|
+
"2xl": 1536
|
|
18
|
+
}, w = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
19
|
+
function Y(e, s) {
|
|
20
|
+
if (s === null)
|
|
21
|
+
return "baseClasses";
|
|
22
|
+
const r = s.mq;
|
|
23
|
+
if (r === "xs" || s.dark || s.mod !== "")
|
|
24
|
+
return "classes";
|
|
25
|
+
let l = "baseClasses", t = w.indexOf(r);
|
|
26
|
+
for (; t > 0; ) {
|
|
27
|
+
const o = w[t - 1];
|
|
28
|
+
if (E(e, {
|
|
29
|
+
mq: o,
|
|
30
|
+
property: s.property
|
|
31
|
+
})) {
|
|
32
|
+
l = "classes";
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
t--;
|
|
36
|
+
}
|
|
37
|
+
return l;
|
|
38
|
+
}
|
|
39
|
+
const $ = [];
|
|
40
|
+
function H(e = "", s = "", r = []) {
|
|
41
|
+
e = e.trim().replace(/ +/g, "");
|
|
42
|
+
let l = p(
|
|
43
|
+
d(e.split(" "), f),
|
|
44
|
+
(a) => !S(a)
|
|
45
|
+
), t = p(d(s.split(" "), f), (a) => !S(a));
|
|
46
|
+
t = p(
|
|
47
|
+
t,
|
|
48
|
+
(a) => !g($, a.property)
|
|
49
|
+
);
|
|
50
|
+
const o = [], c = [];
|
|
51
|
+
y(r, (a) => {
|
|
52
|
+
const n = f(a), m = E(l, q(n, ["dark", "mq", "mod", "property"]));
|
|
53
|
+
if (m && (l = p(
|
|
54
|
+
l,
|
|
55
|
+
(i) => i.fullCls !== (m == null ? void 0 : m.fullCls)
|
|
56
|
+
)), o.push(n), n.mq === "xs" && !n.dark && n.mod === "" && (t = p(t, (i) => i.property !== n.property)), Y(l, n) === "baseClasses" && !g($, n.property)) {
|
|
57
|
+
const i = E(t, q(n, ["property"]));
|
|
58
|
+
m && (t = p(
|
|
59
|
+
t,
|
|
60
|
+
(A) => A.fullCls !== (i == null ? void 0 : i.fullCls)
|
|
61
|
+
)), c.push({
|
|
62
|
+
...n,
|
|
63
|
+
fullCls: n.cls,
|
|
64
|
+
mq: "xs"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const u = d(
|
|
69
|
+
h([...l, ...o], (a) => T[a.mq]),
|
|
70
|
+
"fullCls"
|
|
71
|
+
).join(" ");
|
|
72
|
+
return `${d(
|
|
73
|
+
h([...t, ...c], (a) => T[a.mq]),
|
|
74
|
+
"fullCls"
|
|
75
|
+
).join(" ").trim()},${u.trim()}`.trim().replace(/ +/g, "");
|
|
76
|
+
}
|
|
77
|
+
const K = (e) => {
|
|
78
|
+
const s = e.replace(k, "").split(",");
|
|
79
|
+
return { baseClasses: s[0], classes: s[1] };
|
|
80
|
+
}, V = B(null, (e, s, { blockIds: r, newClasses: l }) => {
|
|
81
|
+
const t = p(
|
|
82
|
+
e(Q),
|
|
83
|
+
(c) => (
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
r.includes(e(c)._id)
|
|
86
|
+
)
|
|
87
|
+
), o = x(e(_));
|
|
88
|
+
return d(t, (c) => {
|
|
89
|
+
const u = e(c), C = b(u, o.prop, `${k},`), { baseClasses: a, classes: n } = K(C);
|
|
90
|
+
return {
|
|
91
|
+
ids: [u._id],
|
|
92
|
+
props: { [o.prop]: `${k}${H(n, a, l)}` }
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}), rs = () => {
|
|
96
|
+
const e = D(V), { updateBlocks: s, updateBlocksRuntime: r } = j();
|
|
97
|
+
return R(
|
|
98
|
+
(l, t, o = !1) => {
|
|
99
|
+
const c = e({ blockIds: l, newClasses: t });
|
|
100
|
+
if (!o) {
|
|
101
|
+
r(l, c[0].props);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
s(l, c[0].props);
|
|
105
|
+
},
|
|
106
|
+
[e]
|
|
107
|
+
);
|
|
108
|
+
}, W = B(null, (e, s, { blockIds: r, fullClasses: l }) => {
|
|
109
|
+
const t = x(e(_)), o = p(
|
|
110
|
+
e(Q),
|
|
111
|
+
(c) => (
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
r.includes(e(c)._id)
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
return d(o, (c) => {
|
|
117
|
+
const u = e(c), C = l;
|
|
118
|
+
let { classes: a, baseClasses: n } = U(b(u, t.prop, "styles:,"));
|
|
119
|
+
return y(C, (m) => {
|
|
120
|
+
const i = new RegExp(`(^| )${m.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
121
|
+
a = a.replace(i, " ").replace(/ +/g, " ").trim();
|
|
122
|
+
const A = x(m.split(":"));
|
|
123
|
+
g(["2xl", "xl", "lg", "md", "sm"], A) && C.push(m.split(":").pop().trim());
|
|
124
|
+
}), y(C, (m) => {
|
|
125
|
+
const i = new RegExp(`(^| )${m.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
126
|
+
n = n.replace(i, " ").replace(/ +/g, " ").trim();
|
|
127
|
+
}), {
|
|
128
|
+
ids: [u._id],
|
|
129
|
+
props: {
|
|
130
|
+
[t.prop]: `${k}${n},${a}`
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
}), cs = () => {
|
|
135
|
+
const { updateBlocks: e } = j(), s = D(W);
|
|
136
|
+
return R(
|
|
137
|
+
(r, l) => {
|
|
138
|
+
const t = s({ blockIds: r, fullClasses: l });
|
|
139
|
+
e(r, t[0].props);
|
|
140
|
+
},
|
|
141
|
+
[s]
|
|
142
|
+
);
|
|
143
|
+
}, N = B((e) => {
|
|
144
|
+
const s = x(e(_)), r = e(G);
|
|
145
|
+
if (!s || s.blockId !== b(r, "_id", null))
|
|
146
|
+
return [];
|
|
147
|
+
const t = b(r, s.prop, `${k},`).replace(k, "").split(",").join(" ");
|
|
148
|
+
return p(d(t.trim().split(" "), f), (o) => !S(o));
|
|
149
|
+
}), as = () => M(N), F = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, z = B((e) => {
|
|
150
|
+
const s = e(L), r = e(I), l = e(P), t = J(s);
|
|
151
|
+
let o = p(e(N), { mod: r });
|
|
152
|
+
return v(r, "_") || (o = p(o, (c) => t.includes(c.mq))), o = o.sort((c, u) => F[c.mq] - F[u.mq]), l || (o = p(o, { dark: !1 })), o;
|
|
153
|
+
}), J = (e) => {
|
|
154
|
+
let s = [];
|
|
155
|
+
switch (e) {
|
|
156
|
+
case "xs":
|
|
157
|
+
s = ["xs"];
|
|
158
|
+
break;
|
|
159
|
+
case "sm":
|
|
160
|
+
s = ["xs", "sm"];
|
|
161
|
+
break;
|
|
162
|
+
case "md":
|
|
163
|
+
s = ["xs", "sm", "md"];
|
|
164
|
+
break;
|
|
165
|
+
case "lg":
|
|
166
|
+
s = ["xs", "sm", "md", "lg"];
|
|
167
|
+
break;
|
|
168
|
+
case "xl":
|
|
169
|
+
s = ["xs", "sm", "md", "lg", "xl"];
|
|
170
|
+
break;
|
|
171
|
+
case "2xl":
|
|
172
|
+
s = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
173
|
+
break;
|
|
174
|
+
default:
|
|
175
|
+
s = ["xs"];
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
return s;
|
|
179
|
+
}, ns = () => M(z), ps = () => O(I);
|
|
180
|
+
export {
|
|
181
|
+
cs as a,
|
|
182
|
+
ns as b,
|
|
183
|
+
as as c,
|
|
184
|
+
ps as d,
|
|
185
|
+
rs as u
|
|
186
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const y=require("react"),k=require("jotai"),s=require("lodash-es"),u=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),f=require("./Class-eieto7e-.cjs"),C=require("./STRINGS-gPz7CUOk.cjs"),A=require("./useDarkMode-7i57segK.cjs"),_=t=>{const e=t.replace(C.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},b={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},x=["xs","sm","md","lg","xl","2xl"];function T(t,e){if(e===null)return"baseClasses";const r=e.mq;if(r==="xs"||e.dark||e.mod!=="")return"classes";let o="baseClasses",l=x.indexOf(r);for(;l>0;){const c=x[l-1];if(s.find(t,{mq:c,property:e.property})){o="classes";break}l--}return o}const g=[];function h(t="",e="",r=[]){t=t.trim().replace(/ +/g,"");let o=s.filter(s.map(t.split(" "),f.constructClassObject),n=>!s.isNull(n)),l=s.filter(s.map(e.split(" "),f.constructClassObject),n=>!s.isNull(n));l=s.filter(l,n=>!s.includes(g,n.property));const c=[],a=[];s.each(r,n=>{const i=f.constructClassObject(n),m=s.find(o,s.pick(i,["dark","mq","mod","property"]));if(m&&(o=s.filter(o,p=>p.fullCls!==(m==null?void 0:m.fullCls))),c.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(l=s.filter(l,p=>p.property!==i.property)),T(o,i)==="baseClasses"&&!s.includes(g,i.property)){const p=s.find(l,s.pick(i,["property"]));m&&(l=s.filter(l,B=>B.fullCls!==(p==null?void 0:p.fullCls))),a.push({...i,fullCls:i.cls,mq:"xs"})}});const d=s.map(s.sortBy([...o,...c],n=>b[n.mq]),"fullCls").join(" ");return`${s.map(s.sortBy([...l,...a],n=>b[n.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const Y=t=>{const e=t.replace(C.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},$=k.atom(null,(t,e,{blockIds:r,newClasses:o})=>{const l=s.filter(t(u.pageBlocksAtomsAtom),a=>r.includes(t(a)._id)),c=s.first(t(u.selectedStylingBlocksAtom));return s.map(l,a=>{const d=t(a),S=s.get(d,c.prop,`${C.STYLES_KEY},`),{baseClasses:n,classes:i}=Y(S);return{ids:[d._id],props:{[c.prop]:`${C.STYLES_KEY}${h(i,n,o)}`}}})}),R=()=>{const t=k.useSetAtom($),{updateBlocks:e,updateBlocksRuntime:r}=u.useBlocksStoreUndoableActions();return y.useCallback((o,l,c=!1)=>{const a=t({blockIds:o,newClasses:l});if(!c){r(o,a[0].props);return}e(o,a[0].props)},[t])},w=k.atom(null,(t,e,{blockIds:r,fullClasses:o})=>{const l=s.first(t(u.selectedStylingBlocksAtom)),c=s.filter(t(u.pageBlocksAtomsAtom),a=>r.includes(t(a)._id));return s.map(c,a=>{const d=t(a),S=o;let{classes:n,baseClasses:i}=_(s.get(d,l.prop,"styles:,"));return s.each(S,m=>{const p=new RegExp(`(^| )${m.replace("[","\\[").replace("]","\\]")}($| )`,"g");n=n.replace(p," ").replace(/ +/g," ").trim();const B=s.first(m.split(":"));s.includes(["2xl","xl","lg","md","sm"],B)&&S.push(m.split(":").pop().trim())}),s.each(S,m=>{const p=new RegExp(`(^| )${m.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(p," ").replace(/ +/g," ").trim()}),{ids:[d._id],props:{[l.prop]:`${C.STYLES_KEY}${i},${n}`}}})}),L=()=>{const{updateBlocks:t}=u.useBlocksStoreUndoableActions(),e=k.useSetAtom(w);return y.useCallback((r,o)=>{const l=e({blockIds:r,fullClasses:o});t(r,l[0].props)},[e])},q=k.atom(t=>{const e=s.first(t(u.selectedStylingBlocksAtom)),r=t(u.selectedBlockAtom);if(!e||e.blockId!==s.get(r,"_id",null))return[];const l=s.get(r,e.prop,`${C.STYLES_KEY},`).replace(C.STYLES_KEY,"").split(",").join(" ");return s.filter(s.map(l.trim().split(" "),f.constructClassObject),c=>!s.isNull(c))}),j=()=>k.useAtomValue(q),E={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},K=k.atom(t=>{const e=t(A.canvasBreakpointAtom),r=t(u.styleStateAtom),o=t(A.darkModeAtom),l=F(e);let c=s.filter(t(q),{mod:r});return s.startsWith(r,"_")||(c=s.filter(c,a=>l.includes(a.mq))),c=c.sort((a,d)=>E[a.mq]-E[d.mq]),o||(c=s.filter(c,{dark:!1})),c}),F=t=>{let e=[];switch(t){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},N=()=>k.useAtomValue(K),O=()=>k.useAtom(u.styleStateAtom);exports.useAddClassesToBlocks=R;exports.useRemoveClassesFromBlocks=L;exports.useSelectedBlockAllClasses=j;exports.useSelectedBlockCurrentClasses=N;exports.useStylingState=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react"),o=require("jotai"),i=require("./skeleton-STeL9VrJ.cjs"),n=o.atom([]),u=()=>{const[r,s]=t.useState(!1),[e,c]=o.useAtom(n),a=i.useBuilderProp("getUILibraryBlocks",()=>[]);return t.useEffect(()=>{(async()=>e.length>0||(s(!0),c(await a()),s(!1)))()},[]),{data:e,isLoading:r}};exports.useUILibraryBlocks=u;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useState as a, useEffect as c } from "react";
|
|
2
|
+
import { atom as i, useAtom as l } from "jotai";
|
|
3
|
+
import { u as n } from "./skeleton-lu8e7q2y.js";
|
|
4
|
+
const u = i([]), B = () => {
|
|
5
|
+
const [o, s] = a(!1), [t, r] = l(u), e = n("getUILibraryBlocks", () => []);
|
|
6
|
+
return c(() => {
|
|
7
|
+
(async () => t.length > 0 || (s(!0), r(await e()), s(!1)))();
|
|
8
|
+
}, []), { data: t, isLoading: o };
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
B as u
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react"),c=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),r=()=>{const{updateBlocks:e}=c.useBlocksStoreUndoableActions();return t.useCallback((s,o,l)=>{e(s,o,l)},[e])},u=()=>{const{updateBlocksRuntime:e}=c.useBlocksStoreUndoableActions();return t.useCallback((s,o)=>{e(s,o)},[e])};exports.useUpdateBlocksProps=r;exports.useUpdateBlocksPropsRealtime=u;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { t as a } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
3
|
+
const l = () => {
|
|
4
|
+
const { updateBlocks: o } = a();
|
|
5
|
+
return e(
|
|
6
|
+
(s, t, r) => {
|
|
7
|
+
o(s, t, r);
|
|
8
|
+
},
|
|
9
|
+
[o]
|
|
10
|
+
);
|
|
11
|
+
}, n = () => {
|
|
12
|
+
const { updateBlocksRuntime: o } = a();
|
|
13
|
+
return e(
|
|
14
|
+
(s, t) => {
|
|
15
|
+
o(s, t);
|
|
16
|
+
},
|
|
17
|
+
[o]
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
n as a,
|
|
22
|
+
l as u
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("clsx"),r=require("tailwind-merge"),s=(...e)=>r.twMerge(c.clsx(e));exports.cn=s;
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),a=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),l=require("./controls-KK2oLIa8.cjs"),u=require("@chaibuilder/runtime"),b=require("./empty-slot-nzYOgZuS.cjs"),h=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),S=require("./STRINGS-gPz7CUOk.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function R(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const d=R(w),T=d.memo(e=>{const{blockProps:t,inBuilder:o,backgroundImage:r,children:s,tag:n="div",styles:i}=e;let c=s;s||(c=a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},styles:{},inBuilder:o}));let p={};return r&&(p={backgroundImage:`url(${r})`}),d.createElement(n,{...t,...i,style:p},c)});u.registerChaiBlock(T,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.S({default:""}),tag:l.s({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.o({title:"Background Image"})},canAcceptBlock:()=>!0});const _=e=>{const{blockProps:t,styles:o,content:r,level:s="h1",children:n=null}=e;return n?d.createElement(s,{...o,...t},n):d.createElement(s,{...o,...t,dangerouslySetInnerHTML:{__html:r}})};u.registerChaiBlock(_,{type:"Heading",label:"Heading",category:"core",icon:h.HeadingIcon,group:"typography",props:{level:l.s({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.S({default:"text-3xl"}),content:l.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const L=e=>{const{blockProps:t,styles:o,content:r}=e;return y.isNull(e.children)?d.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}}):d.createElement("p",{...o,...t},e.children)};u.registerChaiBlock(L,{type:"Paragraph",label:"Paragraph",category:"core",icon:h.TextIcon,group:"typography",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const C=e=>{const{blockProps:t,styles:o,content:r,children:s=null,tag:n}=e;return s?d.createElement("span",{...o,...t},s):d.createElement(n||"span",{...o,...t,dangerouslySetInnerHTML:{__html:r}})};u.registerChaiBlock(C,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Enter your content"})},canAcceptBlock:()=>!0});const P=e=>{const{blockProps:t,content:o,styles:r}=e;return a.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:a.jsxRuntimeExports.jsx("div",{...t,...r,dangerouslySetInnerHTML:{__html:o}})})};u.registerChaiBlock(P,{type:"RichText",label:"Rich Text",category:"core",icon:h.CursorTextIcon,group:"typography",props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const M=e=>{const{blockProps:t,iconSize:o,icon:r,content:s,iconPos:n,styles:i,children:c}=e,p=r,m=c||a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[a.jsxRuntimeExports.jsx("span",{children:s}),p&&a.jsxRuntimeExports.jsx("div",{style:{width:o+"px"},className:n+" "+(n==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return d.createElement("button",{...t,...i,type:"button"},m)};u.registerChaiBlock(M,{type:"Button",label:"Button",category:"core",icon:h.ButtonIcon,group:"basic",props:{content:l.u({title:"Label",default:"Button",multiLingual:!0}),styles:l.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.c({title:"Icon Size",default:24}),iconPos:l.s({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const N=e=>{const{blockProps:t,link:o,children:r,styles:s,inBuilder:n,content:i}=e;return!r&&y.isEmpty(s==null?void 0:s.className)&&y.isEmpty(i)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,inBuilder:n}):n?r?a.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...s,children:r}):d.createElement("span",{...t,...s,dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):r?a.jsxRuntimeExports.jsx("a",{href:o.href||"#/",target:o.target,...t,...s,children:r}):d.createElement("a",{...t,...s,href:o.href||"#",target:o.target||"_self",dangerouslySetInnerHTML:{__html:i}})};u.registerChaiBlock(N,{type:"Link",label:"Link",category:"core",icon:h.Link1Icon,group:"basic",props:{styles:l.S({default:""}),content:l.u({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const A=e=>{const{blockProps:t,children:o,listType:r,styles:s,tag:n,inBuilder:i}=e,c=f.cn(y.get(s,"className",""),r);return!o&&y.isEmpty(s==null?void 0:s.className)?a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:i,blockProps:t,text:"LIST ITEM"}):d.createElement(n||(r==="list-decimal"?"ol":"ul"),{...t,...s,className:c},o)};u.registerChaiBlock(A,{type:"List",label:"List",icon:h.RowsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),listType:l.s({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const H=e=>{const{blockProps:t,content:o,styles:r,children:s,tag:n}=e;return s?d.createElement(n||"li",{...r,...t},s):d.createElement(n||"li",{...r,...t,dangerouslySetInnerHTML:{__html:o}})};u.registerChaiBlock(H,{type:"ListItem",label:"List Item",icon:h.ColumnsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0,canBeNested:e=>e==="List"});const v=(e,t)=>({...e,className:`${e.className} ${t}`}),D=e=>{const{blockProps:t,icon:o,styles:r,width:s,inBuilder:n,height:i}=e,c=v(r,f.cn("inline-block",s?`w-[${s}px]`:"",i?`h-[${i}px]`:""));if(y.isEmpty(o))return a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"",inBuilder:n,className:"h-8 w-14"});const p=o.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return d.createElement("span",{...t,...c,dangerouslySetInnerHTML:{__html:p}})};u.registerChaiBlock(D,{type:"Icon",label:"Icon",category:"core",icon:h.SketchLogoIcon,group:"media",props:{styles:l.S({default:"text-black"}),icon:l.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:l.c({title:"Width",default:""}),height:l.c({title:"Height",default:""})}});const U=e=>{const{blockProps:t,image:o,styles:r,alt:s,height:n,width:i}=e;return y.isEmpty(o)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"IMAGE URL",className:"h-36"}):d.createElement("img",{...t,...r,src:o,alt:s,height:n,width:i})};u.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:h.ImageIcon,group:"media",props:{styles:l.S({default:""}),image:l.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.u({title:"Alt",default:""}),width:l.u({title:"Width",default:""}),height:l.u({title:"Height",default:""})}});const q=e=>{var i;const{blockProps:t,inBuilder:o,styles:r,children:s}=e;let n=null;return!s&&o&&(n=a.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(i=e.emptyStyles)==null?void 0:i.className),children:a.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:a.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),d.createElement("div",{...r,...t,droppable:"yes"},s||n)};u.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.S({default:""}),emptyStyles:l.S({default:""})},canAcceptBlock:()=>!0});const B=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,j=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,F=e=>{if(B.test(e)){const t=e.match(B);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(j.test(e)){const t=e.match(j);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},$=d.memo(e=>{const{blockProps:t,inBuilder:o,styles:r,url:s,controls:n}=e,i=y.get(n,"autoPlay",!1),c=y.get(n,"controls",!1),p=i||y.get(n,"muted",!0),m=y.get(n,"loop",!1);if(y.isEmpty(s))return a.jsxRuntimeExports.jsx(b.EmptySlot,{inBuilder:o,blockProps:t,text:"VIDEO URL",className:"h-36"});let x=F(s),g=null;if(x){if(!y.isEmpty(x)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${n?1:0}`),k.push(`mute=${p?1:0}&muted=${p?1:0}`),k.push(`loop=${m?1:0}`),x=`${x}?${k.join("&")}`}g=d.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:x,allow:o?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=d.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:s,controls:c,muted:p,autoPlay:o?!1:i,loop:m});return a.jsxRuntimeExports.jsx("div",{...y.pick(r,["className"]),children:a.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[o?a.jsxRuntimeExports.jsx("div",{...t,...y.omit(r,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});u.registerChaiBlock($,{type:"Video",label:"Video",category:"core",icon:h.VideoIcon,group:"media",props:{styles:l.S({default:""}),url:l.u({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.b({title:"Controls",properties:{autoPlay:l.r({title:"Autoplay",default:!0}),controls:l.r({title:"Show controls",default:!1}),loop:l.r({title:"Loop",default:!1}),muted:l.r({title:"Muted",default:!0})}})}});const z=d.memo(e=>{const{blockProps:t,styles:o,content:r,inBuilder:s}=e;return a.jsxRuntimeExports.jsxs("div",{className:"relative",children:[s?a.jsxRuntimeExports.jsx("div",{...t,...o,className:"absolute z-20 h-full w-full"}):null,d.createElement("div",{...o,dangerouslySetInnerHTML:{__html:r}})]})});u.registerChaiBlock(z,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:h.CodeIcon,group:"advanced",props:{styles:l.S({default:""}),content:l.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const O=e=>{const{blockProps:t,styles:o}=e;return d.createElement("hr",{...o,...t})};u.registerChaiBlock(O,{type:"Divider",label:"Divider",category:"core",icon:h.DividerHorizontalIcon,group:"basic",props:{styles:l.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const V=e=>e.inBuilder?a.jsxRuntimeExports.jsx("span",{className:"flex",...e.blockProps,children:e.content}):`${e.content}`;u.registerChaiBlock(V,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:h.SpaceBetweenVerticallyIcon,props:{content:l.g({title:"Content",defaultValue:""})}});const Y=({children:e,blockProps:t,styles:o})=>{const r=v(o,"hs-accordion");return a.jsxRuntimeExports.jsx("div",{...t,...r,children:e})};u.registerChaiBlock(Y,{type:"Accordion",label:"Accordion",category:"core",group:"advanced",hidden:!0,props:{styles:l.S({default:""})},blocks:()=>{const e="accordion"+f.generateUUID();return[{_id:"a",_type:"Accordion",_name:"Accordion"},{_id:"b",_type:"AccordionTrigger",_parent:"a",_name:"Accordion Trigger",styles_attrs:{"aria-controls":e}},{_id:"b1",_type:"Icon",_parent:"b",styles:`${S.STYLES_KEY},hs-accordion-active:hidden hs-accordion-active:text-blue-600 hs-accordion-active:group-hover:text-blue-600 block size-4 text-gray-600 group-hover:text-gray-500 dark:text-neutral-400`,icon:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
-
<path d="M5 12h14"></path>
|
|
3
|
-
<path d="M12 5v14"></path>
|
|
4
|
-
</svg>`},{_id:"b2",_type:"Icon",_parent:"b",styles:`${S.STYLES_KEY},hs-accordion-active:block hs-accordion-active:text-blue-600 hs-accordion-active:group-hover:text-blue-600 hidden size-4 text-gray-600 group-hover:text-gray-500 dark:text-neutral-400`,icon:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
-
<path d="M5 12h14"></path>
|
|
6
|
-
</svg>`},{_id:"b1",_type:"Text",_parent:"b",content:"Accordion Title"},{_id:"c",_type:"AccordionContent",_parent:"a",_name:"Accordion Content",styles:`${S.STYLES_KEY},w-full overflow-hidden transition-[height] duration-300 px-6 py-3`,styles_attrs:{"aria-labelledby":e}},{_id:"c1",_type:"Text",_parent:"c",content:"It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element."}]}});const G=({children:e,blockProps:t,styles:o})=>{const r=v(o,"hs-accordion-toggle");return a.jsxRuntimeExports.jsx("button",{...r,...t,children:e})};u.registerChaiBlock(G,{type:"AccordionTrigger",label:"Accordion Trigger",category:"core",group:"advanced",hidden:!0,props:{styles:l.S({default:"hs-accordion-active:text-blue-600 dark:hs-accordion-active:text-blue-500 inline-flex w-full items-center gap-x-3 rounded-lg px-6 py-3 text-start text-sm font-semibold text-gray-800 hover:text-gray-500 disabled:pointer-events-none disabled:opacity-50 dark:text-neutral-200 dark:hover:text-neutral-400"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const W=({children:e,blockProps:t,styles:o})=>{const r=v(o,"hs-accordion-content");return a.jsxRuntimeExports.jsx("div",{...r,...t,children:e})};u.registerChaiBlock(W,{type:"AccordionContent",label:"Accordion Content",category:"core",group:"advanced",hidden:!0,props:{styles:l.S({default:"w-full overflow-hidden transition-[height] duration-300"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const K=e=>{const{blockProps:t,backgroundImage:o,children:r,styles:s}=e;let n={};return o&&(n={backgroundImage:`url(${o})`}),d.createElement("div",{...t,...s,style:n},r)};u.registerChaiBlock(K,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.S({default:"font-body antialiased"}),backgroundImage:l.o({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const X=e=>{const{blockProps:t,styles:o}=e;return d.createElement("br",{...t,...o})};u.registerChaiBlock(X,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:h.SpaceBetweenVerticallyIcon,props:{styles:l.S({default:""})}});const E=e=>{const t=(n,i)=>({_id:f.generateUUID(),_parent:n,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+i}`}),o=n=>{const i=f.generateUUID(),c={_type:"TableRow",_id:i,styles:"#styles:,border-b"};return n&&(c._parent=n),[c,t(i,"1"),t(i,"2"),t(i,"3")]},r=n=>{const i=f.generateUUID(),c={_id:i,_type:"TableHead",styles:"#styles:,font-medium"};return n&&(c._parent=n),[c,...o(i)]},s=n=>{const i=f.generateUUID(),c={_id:i,_type:"TableBody",styles:"#styles:,"};return n&&(c._parent=n),[c,...o(i),...o(i)]};if(e==="Table"){const n=f.generateUUID();return[{_id:n,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(n),...s(n)]}return e==="TableRow"?o():e==="TableHead"?r():e==="TableBody"?s():[]},Z=e=>{const{blockProps:t,children:o,styles:r}=e;return o?d.createElement("table",{...t,...r},o):a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"TABLE HEAD / BODY"})};u.registerChaiBlock(Z,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:h.TableIcon,props:{styles:l.S({default:""})},blocks:E("Table")});const J=e=>{const{blockProps:t,children:o,styles:r}=e;return o?d.createElement("thead",{...t,...r},o):a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"TABLE ROW"})};u.registerChaiBlock(J,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:h.BorderTopIcon,props:{styles:l.S({default:""})},blocks:E("TableHead")});const Q=e=>{const{blockProps:t,children:o,styles:r}=e;return o?d.createElement("tbody",{...t,...r},o):a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"TABLE ROW"})};u.registerChaiBlock(Q,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:h.BorderAllIcon,props:{styles:l.S({default:""})},blocks:E("TableBody")});const ee=e=>{const{blockProps:t,children:o,styles:r}=e;return o?d.createElement("tr",{...t,...r},o):a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t,text:"TABLE CELL"})};u.registerChaiBlock(ee,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:h.ViewHorizontalIcon,props:{styles:l.S({default:"w-full"})},blocks:E("TableRow")});const te=e=>{const{blockProps:t,children:o,content:r,styles:s}=e;return!o&&y.isEmpty(r)?a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:t}):o?d.createElement("td",{...t,...s},o):d.createElement("td",{...t,...s,dangerouslySetInnerHTML:{__html:r}})};u.registerChaiBlock(te,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:h.DragHandleHorizontalIcon,props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"Table cell item"})}});const le=e=>{const{blockProps:t,errorMessage:o,name:r,_type:s,successMessage:n,action:i,styles:c,children:p}=e;let m=p;p||(m=a.jsxRuntimeExports.jsx(b.EmptySlot,{blockProps:{},text:"FORM FIELDS"}));const x={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return a.jsxRuntimeExports.jsxs("form",{...x,"data-error":o,"data-success":n,method:"post",action:i,...t,...c,children:[a.jsxRuntimeExports.jsx("div",{...g}),a.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:r||s}),m]})};u.registerChaiBlock(le,{type:"Form",label:"Form",category:"core",icon:h.GroupIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),action:l.u({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const oe=e=>{const{blockProps:t,content:o,styles:r,children:s}=e,n={...r,...t};return s?d.createElement("label",n,s):d.createElement("label",{...n,dangerouslySetInnerHTML:{__html:o}})};u.registerChaiBlock(oe,{type:"Label",label:"Label",category:"core",icon:h.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),content:l.u({title:"Content",default:"Label"})}});const re=e=>{const{blockProps:t,inBuilder:o,label:r,placeholder:s,styles:n,inputStyles:i,icon:c,iconPos:p}=e,m=f.generateUUID(),x={"x-bind:disabled":"formLoading"};return a.jsxRuntimeExports.jsxs("button",{id:m,...x,...i,...n,...t||{},type:o?"button":"submit",placeholder:s,children:[r,c&&a.jsxRuntimeExports.jsx("span",{className:p,dangerouslySetInnerHTML:{__html:c}})]})};u.registerChaiBlock(re,{type:"FormButton",label:"Submit Button",category:"core",icon:h.ButtonIcon,group:"form",hidden:!0,props:{label:l.u({title:"Label",default:"Submit"}),styles:l.S({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.s({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const se=e=>{const{blockProps:t,fieldName:o,label:r,styles:s,inputStyles:n,required:i,checked:c,showLabel:p=!0}=e,m=f.generateUUID();return p?a.jsxRuntimeExports.jsxs("div",{...s,...t,children:[a.jsxRuntimeExports.jsx("input",{...n,name:o,id:m,type:"checkbox",required:i,defaultChecked:c}),r&&r!=="Label"&&a.jsxRuntimeExports.jsx("label",{htmlFor:m,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:m,...t,...n,...s,type:"checkbox",required:i,name:o})};u.registerChaiBlock(se,{type:"Checkbox",label:"Checkbox",category:"core",icon:h.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"checkbox"}),styles:l.S({default:"flex items-center gap-x-2"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const ne=e=>{const{blockProps:t,label:o,placeholder:r,styles:s,inputStyles:n,showLabel:i,required:c,inputType:p="text",inBuilder:m,fieldName:x}=e,g=f.generateUUID();return!i||p==="submit"?(p==="submit"&&(t.value=o),a.jsxRuntimeExports.jsx("input",{id:g,name:x,readOnly:m,...t,...n,...s,type:p,placeholder:r,required:c})):a.jsxRuntimeExports.jsxs("div",{...s,...t,children:[i&&a.jsxRuntimeExports.jsx("label",{htmlFor:g,children:o}),a.jsxRuntimeExports.jsx("input",{name:x,readOnly:m,...n,id:g,type:p,placeholder:r,required:c})]})};u.registerChaiBlock(ne,{type:"Input",label:"Input",category:"core",icon:h.InputIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"input"}),inputType:l.s({title:"Type",options:y.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:l.u({title:"Value",default:""}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1})}});const ae=e=>{const{blockProps:t,fieldName:o,label:r,styles:s,inputStyles:n,checked:i,required:c,showLabel:p=!0}=e,m=f.generateUUID();return p?a.jsxRuntimeExports.jsxs("div",{...s,...t,children:[a.jsxRuntimeExports.jsx("input",{...n,name:o,id:m,type:"radio",required:c,defaultChecked:i}),r&&a.jsxRuntimeExports.jsx("label",{htmlFor:m,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:m,...t,...n,...s,type:"radio",required:c,checked:i,name:o})};u.registerChaiBlock(ae,{type:"Radio",label:"Radio",category:"core",icon:h.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.S({default:"flex items-center w-max gap-x-2"}),fieldName:l.u({title:"Field Name",default:"radio"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const ie=e=>{const{blockProps:t,fieldName:o,label:r,placeholder:s,styles:n,inputStyles:i,required:c,showLabel:p,_multiple:m=!1}=e,x=f.generateUUID();return p?a.jsxRuntimeExports.jsxs("div",{...n,children:[p&&a.jsxRuntimeExports.jsx("label",{htmlFor:x,children:r}),a.jsxRuntimeExports.jsxs("select",{...i,id:x,placeholder:s,required:c,multiple:m,name:o,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),y.map(e.options,g=>a.jsxRuntimeExports.jsx("option",{selected:y.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):a.jsxRuntimeExports.jsxs("select",{id:x,...n,...t,placeholder:s,required:c,multiple:m,name:o,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),y.map(e.options,g=>a.jsxRuntimeExports.jsx("option",{selected:y.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})};u.registerChaiBlock(ie,{type:"Select",label:"Select",category:"core",icon:h.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"select"}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1}),_multiple:l.r({title:"Multiple Choice",default:!1}),options:l.h({title:"Options",itemProperties:{label:l.u({title:"Label",default:""}),value:l.u({title:"Value",default:""})}})}});const ce=e=>{const{blockProps:t,fieldName:o,label:r,placeholder:s,styles:n,inputStyles:i,_rows:c,showLabel:p}=e,m=f.generateUUID();return p?a.jsxRuntimeExports.jsxs("div",{...n,...t,children:[p&&a.jsxRuntimeExports.jsx("label",{htmlFor:m,children:r}),a.jsxRuntimeExports.jsx("textarea",{name:o,...i,id:m,placeholder:s,rows:c})]}):a.jsxRuntimeExports.jsx("textarea",{id:m,name:o,...t,...i,...n,placeholder:s,rows:c})};u.registerChaiBlock(ce,{type:"TextArea",label:"TextArea",category:"core",icon:h.InputIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"textarea"}),showLabel:l.r({title:"Show label",default:!0}),styles:l.S({default:""}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),_rows:l.c({title:"Rows",default:3})}});const ue=y.noop;exports.loadWebBlocks=ue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lodash-es"),e=o.noop;exports.loadWebBlocks=e;
|