@chaibuilder/sdk 0.1.4 → 0.1.6
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/{AddBlocks-b6a12d50.js → AddBlocks-671fde09.js} +20 -19
- package/dist/AddBlocks-862cf7e0.cjs +3 -0
- package/dist/{BrandingOptions-1190723a.js → BrandingOptions-520c438d.js} +11 -9
- package/dist/BrandingOptions-8bbdd54f.cjs +1 -0
- package/dist/{CanvasArea-f5d27245.cjs → CanvasArea-86eef07f.cjs} +2 -2
- package/dist/{CanvasArea-15458836.js → CanvasArea-d912e63e.js} +226 -224
- package/dist/{Class-e34b2337.js → Class-1fb4c0c4.js} +110 -169
- package/dist/Class-6c695ccb.cjs +1 -0
- package/dist/Layers-ae78b10e.cjs +1 -0
- package/dist/{Layers-ff4ef9c0.js → Layers-db65053b.js} +12 -10
- package/dist/MODIFIERS-70fef873.cjs +1 -0
- package/dist/MODIFIERS-c2e02614.js +67 -0
- package/dist/{MarkAsGlobalBlock-dea26aa7.js → MarkAsGlobalBlock-a1274d49.js} +10 -8
- package/dist/MarkAsGlobalBlock-d5b40fdb.cjs +1 -0
- package/dist/PagesPanel-41ebbdd1.cjs +1 -0
- package/dist/{PagesPanel-3e9163c4.js → PagesPanel-48cb686f.js} +12 -10
- package/dist/ProjectPanel-08a229f3.cjs +1 -0
- package/dist/{ProjectPanel-17c5f131.js → ProjectPanel-920b0f75.js} +9 -10
- package/dist/Settings-0c125f1b.cjs +1 -0
- package/dist/{Settings-6f2e86a9.js → Settings-9ccc4a65.js} +7 -5
- package/dist/{SidePanels-96e64da9.js → SidePanels-9684bfe2.js} +8 -6
- package/dist/SidePanels-ef33ed66.cjs +1 -0
- package/dist/{Topbar-08d10607.js → Topbar-2f40d770.js} +7 -5
- package/dist/Topbar-84eadc0e.cjs +1 -0
- package/dist/add-page-modal-7fc782b9.cjs +1 -0
- package/dist/add-page-modal-fb7d069a.js +93 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +13 -11
- package/dist/core.js +63 -61
- package/dist/delete-page-modal-15e71ba4.cjs +1 -0
- package/dist/{delete-page-modal-fa7b4272.js → delete-page-modal-cc906461.js} +9 -8
- package/dist/html-to-json-01cc5fe0.cjs +1 -0
- package/dist/{html-to-json-9304dbda.js → html-to-json-d20aafdd.js} +2 -2
- package/dist/index-1217461b.cjs +2 -0
- package/dist/index-32519c31.js +4909 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +4 -4
- package/dist/page-viewer-15b9eb5f.cjs +1 -0
- package/dist/{page-viewer-f1452439.js → page-viewer-77998a4d.js} +21 -18
- package/dist/{project-general-setting-0d7715b8.cjs → project-general-setting-a8be43b9.cjs} +1 -1
- package/dist/{project-general-setting-e5d14fa6.js → project-general-setting-e66f4966.js} +7 -5
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +9 -3
- package/dist/render.js +154 -134
- package/dist/single-page-detail-116281ae.cjs +1 -0
- package/dist/{single-page-detail-74f88ed2.js → single-page-detail-a0332ab5.js} +39 -38
- package/dist/style.css +1 -1
- package/dist/useChangePage-6a7c7374.js +12 -0
- package/dist/useChangePage-f22cea36.cjs +1 -0
- package/dist/usePageActions-5e28a006.cjs +1 -0
- package/dist/usePageActions-d6e1d325.js +38 -0
- package/package.json +3 -2
- package/dist/AddBlocks-1f683caa.cjs +0 -3
- package/dist/BrandingOptions-02e4ebcf.cjs +0 -1
- package/dist/CONTROLS-031e1de3.cjs +0 -1
- package/dist/CONTROLS-442caee5.js +0 -6
- package/dist/Class-7d6aadbc.cjs +0 -1
- package/dist/Layers-06fa708d.cjs +0 -1
- package/dist/MarkAsGlobalBlock-fa0e0543.cjs +0 -1
- package/dist/PagesPanel-b08e1357.cjs +0 -1
- package/dist/ProjectPanel-f0b94e3f.cjs +0 -1
- package/dist/Settings-739cff3b.cjs +0 -1
- package/dist/SidePanels-ce4d41d5.cjs +0 -1
- package/dist/Topbar-b97472fc.cjs +0 -1
- package/dist/add-page-modal-3275cfb2.cjs +0 -1
- package/dist/add-page-modal-bcd9249e.js +0 -93
- package/dist/delete-page-modal-420a17e3.cjs +0 -1
- package/dist/html-to-json-9c9961da.cjs +0 -1
- package/dist/index-133d90a5.cjs +0 -2
- package/dist/index-3f65447f.js +0 -4754
- package/dist/page-viewer-139bfb2a.cjs +0 -1
- package/dist/single-page-detail-54d7feca.cjs +0 -1
- package/dist/useMutation-7d536740.cjs +0 -1
- package/dist/useMutation-97876a40.js +0 -126
- package/dist/usePageActions-ac9ad321.cjs +0 -1
- package/dist/usePageActions-de3b7515.js +0 -37
- package/dist/useProjectActions-3b1dbb5e.js +0 -18
- package/dist/useProjectActions-41af0f70.cjs +0 -1
package/dist/render.js
CHANGED
|
@@ -1,108 +1,35 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { twMerge as
|
|
5
|
-
import { S as
|
|
6
|
-
import { getBlockComponent as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
const t = {};
|
|
17
|
-
return Object.keys(e).forEach((r) => {
|
|
18
|
-
z(e[r]) && e[r].startsWith(k) && (t[r] = e[r].replace(k, "").split(","));
|
|
19
|
-
}), t;
|
|
20
|
-
}, P = S((e) => {
|
|
21
|
-
const t = e.replace(D, "").split(",");
|
|
22
|
-
return v(t[0], t[1]);
|
|
23
|
-
});
|
|
24
|
-
function W(e, t) {
|
|
25
|
-
return i(e, `${t}_attrs`, {});
|
|
26
|
-
}
|
|
27
|
-
function I(e) {
|
|
28
|
-
const t = {};
|
|
29
|
-
return Object.keys(e).forEach((r) => {
|
|
30
|
-
if (z(e[r]) && e[r].startsWith(D)) {
|
|
31
|
-
const n = P(e[r]);
|
|
32
|
-
t[r] = {
|
|
33
|
-
className: n,
|
|
34
|
-
...W(e, r)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}), t;
|
|
38
|
-
}
|
|
39
|
-
function y({ blocks: e, parent: t }) {
|
|
40
|
-
const r = e, n = (o) => I(o), a = t ? f(e, { _parent: t }) : f(e, (o) => w(o._parent));
|
|
41
|
-
return /* @__PURE__ */ s.jsx(s.Fragment, { children: u.Children.toArray(
|
|
42
|
-
a.map((o, d) => {
|
|
43
|
-
const p = M(o), m = {};
|
|
44
|
-
w(p) || Object.keys(p).forEach((l) => {
|
|
45
|
-
m[l] = u.Children.toArray(
|
|
46
|
-
p[l].map((x) => /* @__PURE__ */ s.jsx(y, { blocks: r, parent: x }))
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
const c = f(r, { _parent: o._id });
|
|
50
|
-
m.children = c.length > 0 ? /* @__PURE__ */ s.jsx(y, { parent: o._id, blocks: r }) : null;
|
|
51
|
-
const g = A(o._type);
|
|
52
|
-
if (g !== null) {
|
|
53
|
-
let l = o;
|
|
54
|
-
const x = g.component;
|
|
55
|
-
return l = { ...g.defaults, ...o }, u.createElement(
|
|
56
|
-
x,
|
|
57
|
-
E(
|
|
58
|
-
{
|
|
59
|
-
blockProps: {},
|
|
60
|
-
...l,
|
|
61
|
-
index: d,
|
|
62
|
-
...n(l),
|
|
63
|
-
...m,
|
|
64
|
-
inBuilder: !1
|
|
65
|
-
},
|
|
66
|
-
["_parent"]
|
|
67
|
-
)
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
return /* @__PURE__ */ s.jsxs("noscript", { children: [
|
|
71
|
-
o._type,
|
|
72
|
-
" not found"
|
|
73
|
-
] });
|
|
74
|
-
})
|
|
75
|
-
) });
|
|
76
|
-
}
|
|
77
|
-
const N = (e) => {
|
|
78
|
-
const t = i(e, "_bodyTextLightColor", "#64748b"), r = i(e, "_bodyTextDarkColor", "#94a3b8"), n = i(e, "_bodyBgLightColor", "#FFFFFF"), a = i(e, "_bodyBgDarkColor", "#0f172a");
|
|
79
|
-
return `font-body antialiased text-[${t}] bg-[${n}] dark:text-[${r}] dark:bg-[${a}]`;
|
|
80
|
-
}, me = ({ snapshot: e, before: t = null, after: r = null, classPrefix: n = "c-" }) => {
|
|
81
|
-
const a = i(e.projectData, "brandingOptions", {});
|
|
82
|
-
return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
83
|
-
t,
|
|
84
|
-
/* @__PURE__ */ s.jsx("div", { className: n.replace("-", "") + " " + N(a) + " min-h-screen", children: /* @__PURE__ */ s.jsx(L, { children: /* @__PURE__ */ s.jsx(y, { blocks: e.pageData.blocks || [] }) }) }),
|
|
85
|
-
r
|
|
86
|
-
] });
|
|
87
|
-
};
|
|
88
|
-
var T = {}, _ = {};
|
|
1
|
+
import { j as m } from "./jsx-runtime-944c88e2.js";
|
|
2
|
+
import f from "react";
|
|
3
|
+
import { get as i, includes as b, last as _, replace as v, set as z, startsWith as L, memoize as $, filter as h, isEmpty as T, omit as j, isString as k } from "lodash";
|
|
4
|
+
import { twMerge as U } from "tailwind-merge";
|
|
5
|
+
import { S as g, a as D, B } from "./MODIFIERS-c2e02614.js";
|
|
6
|
+
import { getBlockComponent as O } from "@chaibuilder/blocks";
|
|
7
|
+
import { createTailwindcss as R } from "@mhsdesign/jit-browser-tailwindcss";
|
|
8
|
+
import { tailwindcssPaletteGenerator as H } from "@bobthered/tailwindcss-palette-generator";
|
|
9
|
+
import { g as M } from "./_commonjsHelpers-d4512b9c.js";
|
|
10
|
+
import P from "@tailwindcss/forms";
|
|
11
|
+
import I from "@tailwindcss/typography";
|
|
12
|
+
import W from "@tailwindcss/aspect-ratio";
|
|
13
|
+
import N from "@tailwindcss/line-clamp";
|
|
14
|
+
import { Provider as q } from "react-wrap-balancer";
|
|
15
|
+
var S = {}, E = {};
|
|
89
16
|
(function(e) {
|
|
90
17
|
Object.defineProperty(e, "__esModule", {
|
|
91
18
|
value: !0
|
|
92
19
|
}), Object.defineProperty(e, "cloneDeep", {
|
|
93
20
|
enumerable: !0,
|
|
94
21
|
get: function() {
|
|
95
|
-
return
|
|
22
|
+
return r;
|
|
96
23
|
}
|
|
97
24
|
});
|
|
98
|
-
function t
|
|
99
|
-
return Array.isArray(
|
|
25
|
+
function r(t) {
|
|
26
|
+
return Array.isArray(t) ? t.map((n) => r(n)) : typeof t == "object" && t !== null ? Object.fromEntries(Object.entries(t).map(([n, o]) => [
|
|
100
27
|
n,
|
|
101
|
-
|
|
102
|
-
])) :
|
|
28
|
+
r(o)
|
|
29
|
+
])) : t;
|
|
103
30
|
}
|
|
104
|
-
})(
|
|
105
|
-
var
|
|
31
|
+
})(E);
|
|
32
|
+
var G = {
|
|
106
33
|
content: [],
|
|
107
34
|
presets: [],
|
|
108
35
|
darkMode: "media",
|
|
@@ -730,7 +657,7 @@ var q = {
|
|
|
730
657
|
max: "max-content",
|
|
731
658
|
fit: "fit-content"
|
|
732
659
|
}),
|
|
733
|
-
maxWidth: ({ theme: e, breakpoints:
|
|
660
|
+
maxWidth: ({ theme: e, breakpoints: r }) => ({
|
|
734
661
|
none: "none",
|
|
735
662
|
0: "0rem",
|
|
736
663
|
xs: "20rem",
|
|
@@ -749,7 +676,7 @@ var q = {
|
|
|
749
676
|
max: "max-content",
|
|
750
677
|
fit: "fit-content",
|
|
751
678
|
prose: "65ch",
|
|
752
|
-
...
|
|
679
|
+
...r(e("screens"))
|
|
753
680
|
}),
|
|
754
681
|
minHeight: {
|
|
755
682
|
0: "0px",
|
|
@@ -1099,73 +1026,166 @@ var q = {
|
|
|
1099
1026
|
}), Object.defineProperty(e, "default", {
|
|
1100
1027
|
enumerable: !0,
|
|
1101
1028
|
get: function() {
|
|
1102
|
-
return
|
|
1029
|
+
return o;
|
|
1103
1030
|
}
|
|
1104
1031
|
});
|
|
1105
|
-
const
|
|
1106
|
-
function n(
|
|
1107
|
-
return
|
|
1108
|
-
default:
|
|
1032
|
+
const r = E, t = /* @__PURE__ */ n(G);
|
|
1033
|
+
function n(s) {
|
|
1034
|
+
return s && s.__esModule ? s : {
|
|
1035
|
+
default: s
|
|
1109
1036
|
};
|
|
1110
1037
|
}
|
|
1111
|
-
const
|
|
1112
|
-
})(
|
|
1113
|
-
let
|
|
1114
|
-
var
|
|
1115
|
-
const
|
|
1116
|
-
const
|
|
1117
|
-
return `${
|
|
1118
|
-
},
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1038
|
+
const o = (0, r.cloneDeep)(t.default.theme);
|
|
1039
|
+
})(S);
|
|
1040
|
+
let y = S;
|
|
1041
|
+
var Y = (y.__esModule ? y : { default: y }).default;
|
|
1042
|
+
const w = /* @__PURE__ */ M(Y), K = (e, r = "c-") => {
|
|
1043
|
+
const t = i(e, "bodyTextLightColor", "#64748b"), n = i(e, "bodyTextDarkColor", "#94a3b8"), o = i(e, "bodyBgLightColor", "#FFFFFF"), s = i(e, "bodyBgDarkColor", "#0f172a");
|
|
1044
|
+
return `${r}font-body ${r}antialiased ${r}text-[${t}] ${r}bg-[${o}] dark:${r}text-[${n}] dark:${r}bg-[${s}]`;
|
|
1045
|
+
}, A = (e, r = "c-") => {
|
|
1046
|
+
const n = e.replace(g, "").split(",").map((o) => o.split(" ").map((l) => {
|
|
1047
|
+
if (l === "")
|
|
1048
|
+
return "";
|
|
1049
|
+
if (b(l, "hs-") || b(l, "[--") || b(l, "paddle"))
|
|
1050
|
+
return l;
|
|
1051
|
+
if (l.includes(":")) {
|
|
1052
|
+
const p = l.split(":");
|
|
1053
|
+
return p[p.length - 1] = r + _(p), p.join(":");
|
|
1054
|
+
}
|
|
1055
|
+
return `${r}${l}`;
|
|
1056
|
+
}).join(" "));
|
|
1057
|
+
return `${g}${n.join(" , ")}`;
|
|
1058
|
+
}, J = (e, r) => e.map((t) => (Object.keys(t).forEach((n) => {
|
|
1059
|
+
L(t[n], g) && (t[n] = A(t[n], r));
|
|
1060
|
+
}), t)), fe = (e, r, t = "c-") => {
|
|
1061
|
+
const n = K(r, t);
|
|
1062
|
+
return Q(
|
|
1121
1063
|
r,
|
|
1122
|
-
[
|
|
1123
|
-
|
|
1064
|
+
[v(JSON.stringify(J(e, t)), /#styles:/g, "")],
|
|
1065
|
+
n.split(" ").concat(`${t}inline-block`, `${t}w-full`, `${t}h-full`)
|
|
1124
1066
|
);
|
|
1125
1067
|
};
|
|
1126
|
-
async function
|
|
1127
|
-
const
|
|
1128
|
-
colors: [
|
|
1068
|
+
async function Q(e, r, t = [], n = "c-") {
|
|
1069
|
+
const o = i(e, "primaryColor", "#000"), s = i(e, "secondaryColor", "#ccc"), a = i(e, "headingFont", "Inter"), l = i(e, "bodyFont", "Inter"), p = i(e, "roundedCorners", "0"), c = H({
|
|
1070
|
+
colors: [o, s],
|
|
1129
1071
|
names: ["primary", "secondary"]
|
|
1130
1072
|
});
|
|
1131
|
-
return
|
|
1073
|
+
return z(c, "primary.DEFAULT", o), z(c, "secondary.DEFAULT", s), `${await R({
|
|
1132
1074
|
tailwindConfig: {
|
|
1133
1075
|
prefix: n,
|
|
1134
1076
|
darkMode: "class",
|
|
1135
|
-
safelist:
|
|
1077
|
+
safelist: t,
|
|
1136
1078
|
theme: {
|
|
1137
1079
|
fontFamily: {
|
|
1138
|
-
heading: [
|
|
1139
|
-
body: [
|
|
1080
|
+
heading: [a, ...w.fontFamily.sans],
|
|
1081
|
+
body: [l, ...w.fontFamily.sans]
|
|
1140
1082
|
},
|
|
1141
1083
|
extend: {
|
|
1142
1084
|
borderRadius: {
|
|
1143
|
-
global: `${
|
|
1085
|
+
global: `${p || "0"}px`
|
|
1144
1086
|
},
|
|
1145
1087
|
colors: c
|
|
1146
1088
|
}
|
|
1147
1089
|
},
|
|
1148
|
-
plugins: [
|
|
1090
|
+
plugins: [P, I, W, N],
|
|
1149
1091
|
corePlugins: { preflight: !1 }
|
|
1150
1092
|
}
|
|
1151
1093
|
}).generateStylesFromContent(
|
|
1152
1094
|
` @tailwind components;
|
|
1153
1095
|
@tailwind utilities;`,
|
|
1154
|
-
|
|
1155
|
-
)} .${n}bg-clip-text{background-clip: text;-webkit-background-clip: text;} h1,h2,h3,h4,h5,h6{font-family: "${
|
|
1096
|
+
r
|
|
1097
|
+
)} .${n}bg-clip-text{background-clip: text;-webkit-background-clip: text;} h1,h2,h3,h4,h5,h6{font-family: "${a}",${w.fontFamily.sans.join(
|
|
1156
1098
|
", "
|
|
1157
1099
|
)};}`;
|
|
1158
1100
|
}
|
|
1159
|
-
function
|
|
1160
|
-
let
|
|
1101
|
+
function be(e = 6, r = "abcdefghijklmnopqrstuvwxyzABCD") {
|
|
1102
|
+
let t = "";
|
|
1161
1103
|
for (let n = e; n > 0; --n)
|
|
1162
|
-
|
|
1163
|
-
return
|
|
1104
|
+
t += r[Math.floor(Math.random() * r.length)];
|
|
1105
|
+
return t;
|
|
1106
|
+
}
|
|
1107
|
+
const V = (e) => {
|
|
1108
|
+
const r = {};
|
|
1109
|
+
return Object.keys(e).forEach((t) => {
|
|
1110
|
+
k(e[t]) && e[t].startsWith(D) && (r[t] = e[t].replace(D, "").split(","));
|
|
1111
|
+
}), r;
|
|
1112
|
+
}, X = $((e, r) => {
|
|
1113
|
+
const t = e.replace(g, "").split(","), n = U(t[0], t[1]);
|
|
1114
|
+
return A(n, r).replace(g, "").trim();
|
|
1115
|
+
});
|
|
1116
|
+
function Z(e, r) {
|
|
1117
|
+
return i(e, `${r}_attrs`, {});
|
|
1164
1118
|
}
|
|
1119
|
+
function ee(e, r) {
|
|
1120
|
+
const t = {};
|
|
1121
|
+
return Object.keys(e).forEach((n) => {
|
|
1122
|
+
if (k(e[n]) && e[n].startsWith(g)) {
|
|
1123
|
+
const o = X(e[n], r);
|
|
1124
|
+
t[n] = {
|
|
1125
|
+
className: o,
|
|
1126
|
+
...Z(e, n)
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
}), t;
|
|
1130
|
+
}
|
|
1131
|
+
function C({
|
|
1132
|
+
blocks: e,
|
|
1133
|
+
parent: r,
|
|
1134
|
+
classPrefix: t = "c-"
|
|
1135
|
+
}) {
|
|
1136
|
+
const n = e, o = (a) => ee(a, t), s = r ? h(e, { _parent: r }) : h(e, (a) => T(a._parent));
|
|
1137
|
+
return /* @__PURE__ */ m.jsx(m.Fragment, { children: f.Children.toArray(
|
|
1138
|
+
s.map((a, l) => {
|
|
1139
|
+
const p = V(a), c = {};
|
|
1140
|
+
T(p) || Object.keys(p).forEach((d) => {
|
|
1141
|
+
c[d] = f.Children.toArray(
|
|
1142
|
+
p[d].map((x) => /* @__PURE__ */ m.jsx(C, { classPrefix: t, blocks: n, parent: x }))
|
|
1143
|
+
);
|
|
1144
|
+
});
|
|
1145
|
+
const F = h(n, { _parent: a._id });
|
|
1146
|
+
c.children = F.length > 0 ? /* @__PURE__ */ m.jsx(C, { classPrefix: t, parent: a._id, blocks: n }) : null;
|
|
1147
|
+
const u = O(a._type);
|
|
1148
|
+
if (u !== null) {
|
|
1149
|
+
let d = a;
|
|
1150
|
+
const x = u.component;
|
|
1151
|
+
return d = { ...u.defaults, ...a }, f.createElement(
|
|
1152
|
+
x,
|
|
1153
|
+
j(
|
|
1154
|
+
{
|
|
1155
|
+
blockProps: {},
|
|
1156
|
+
...d,
|
|
1157
|
+
index: l,
|
|
1158
|
+
...o(d),
|
|
1159
|
+
...c,
|
|
1160
|
+
inBuilder: !1
|
|
1161
|
+
},
|
|
1162
|
+
["_parent"]
|
|
1163
|
+
)
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
return /* @__PURE__ */ m.jsxs("noscript", { children: [
|
|
1167
|
+
a._type,
|
|
1168
|
+
" not found"
|
|
1169
|
+
] });
|
|
1170
|
+
})
|
|
1171
|
+
) });
|
|
1172
|
+
}
|
|
1173
|
+
const te = (e) => {
|
|
1174
|
+
const r = i(e, "_bodyTextLightColor", "#64748b"), t = i(e, "_bodyTextDarkColor", "#94a3b8"), n = i(e, "_bodyBgLightColor", "#FFFFFF"), o = i(e, "_bodyBgDarkColor", "#0f172a");
|
|
1175
|
+
return `font-body antialiased text-[${r}] bg-[${n}] dark:text-[${t}] dark:bg-[${o}]`;
|
|
1176
|
+
}, he = ({ snapshot: e, before: r = null, after: t = null, classPrefix: n = "c-" }) => {
|
|
1177
|
+
const o = i(e.projectData, "brandingOptions", B);
|
|
1178
|
+
return /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
1179
|
+
r,
|
|
1180
|
+
/* @__PURE__ */ m.jsx("div", { className: n.replace("-", "") + " " + te(o) + " min-h-screen", children: /* @__PURE__ */ m.jsx(q, { children: /* @__PURE__ */ m.jsx(C, { blocks: e.pageData.blocks || [], classPrefix: n }) }) }),
|
|
1181
|
+
t
|
|
1182
|
+
] });
|
|
1183
|
+
};
|
|
1165
1184
|
export {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1185
|
+
C as RenderChaiBlocks,
|
|
1186
|
+
he as RenderChaiPage,
|
|
1187
|
+
A as addPrefixToClasses,
|
|
1188
|
+
be as generateUUID,
|
|
1189
|
+
fe as getBlocksTailwindCSS,
|
|
1190
|
+
K as getBrandingClasses
|
|
1171
1191
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),q=require("react"),c=require("lodash"),M=require("@radix-ui/react-icons"),H=require("./useBuilderProp-5e57d0c8.cjs"),w=require("./scroll-area-088530b9.cjs"),d=require("@chaibuilder/blocks"),L=require("sonner"),h=require("./form-6eac0287.cjs"),p=require("./index-1217461b.cjs"),z=require("./usePageActions-5e28a006.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-scroll-area");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-86c532b5.cjs");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-addb2bf9.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-6c695ccb.cjs");require("./MODIFIERS-70fef873.cjs");require("redux-undo");require("@react-hookz/web");require("lucide-react");require("./useChangePage-f22cea36.cjs");const B=q.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-15e71ba4.cjs"))),G=q.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-4f50caa7.cjs"))),E=n=>{if(!c.isString(n)||!(n.includes("/[")&&n.includes("]")))return!1;const i=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,g=/^[a-zA-Z0-9_-]+$/;let e=!0;return n.split("/").forEach(u=>{e&&(u.includes("[[")&&u.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(u):u.includes("[")&&u.includes("]")?e=i.test(u):e=g.test(u))}),e},P=n=>n&&c.isEmpty(n.seoData)?{...n,seoData:{title:"",description:"",image:""}}:n,Y=(n,o)=>{const i=!c.isEqual(c.omit(n,["seoData"]),c.omit(o,["seoData"])),g=!c.isEqual(P(o).seoData,P(n).seoData);return i||g},F=({open:n,setOpen:o,pageData:i})=>{const g=p.useQueryClient(),{data:e}=p.useProject(),u=z.useUpdatePage(),m=p.useUpdateProject("Homepage updated successfully."),[s,b]=q.useState(P(i)),[a,y]=q.useState({isHomePage:(e==null?void 0:e.homepage)===i.uuid}),j=Y(s,i);q.useEffect(()=>{const l=!c.isEqual(P(i),s),r=(e==null?void 0:e.homepage)!==i.uuid&&a.isHomePage;o(l||r?"PENDING":"OPEN")},[e,i,s,a,o]);const S=()=>{if(j){if(i.type==="DYNAMIC"&&!E((s==null?void 0:s.slug)||"")){n==="ALERT"&&o("PENDING");return}u.mutate(s,{onSuccess:()=>{g.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),L.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==i.uuid&&m.mutate({...e,homepage:i==null?void 0:i.uuid},{onSuccess:()=>o("CLOSE")})},C=({formData:l},r)=>{b(f=>{var R,N;if(!r)return f;const x={[r]:l[r]};return r==="name"?x.slug=c.kebabCase((R=l[r])==null?void 0:R.replace(/\d/g,"")):r==="slug"?x.slug=(N=l[r])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):r==="seoData"&&(x.seoData={title:l[r].title||"",description:l[r].description||"",image:l[r].image||""}),{...f,...x}})},A=({formData:l},r)=>{y(f=>{const x={[r]:l[r]};return{...f,...x}})},I={name:d.SingleLineText({title:"Page Name",default:s.name}),slug:d.SingleLineText({title:"Page Slug",default:s.slug})},T={seoData:d.Model({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.SingleLineText({title:"Meta Title",default:s.name}),description:d.MultilineText({title:"Meta Description",default:s.slug}),image:d.Image({title:"Social Media Image",default:""})}})},v={isHomePage:d.Checkbox({title:"Set as homepage",default:a.isHomePage})};return t.jsxRuntimeExports.jsxs(w.ScrollArea,{className:"flex h-full select-none flex-col",children:[t.jsxRuntimeExports.jsx(G,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:S,disabled:m.isPending||u.isPending}),t.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:t.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),t.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsxRuntimeExports.jsx(h.Form,{title:"Basic Details",formData:s,properties:I,onChange:C,disabled:u.isPending||m.isPending}),t.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),t.jsxRuntimeExports.jsx(h.Form,{title:"SEO Details",formData:s,properties:T,onChange:C,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==i.uuid&&i.type==="STATIC"?t.jsxRuntimeExports.jsx(h.Form,{formData:a,properties:v,onChange:A,disabled:u.isPending||m.isPending}):i.type==="STATIC"&&t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[t.jsxRuntimeExports.jsx(M.HomeIcon,{})," This is homepage"," "]}),s.type==="DYNAMIC"&&!E((s==null?void 0:s.slug)||"")&&t.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",t.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),t.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[t.jsxRuntimeExports.jsx(H.Button,{className:"w-full",type:"submit",onClick:S,disabled:(e==null?void 0:e.homepage)!==i.uuid&&a.isHomePage?!1:c.isEmpty(s.name)||c.isEmpty(s.slug)||!j||u.isPending||m.isPending||s.type==="DYNAMIC"&&!E((s==null?void 0:s.slug)||""),children:"Save"}),t.jsxRuntimeExports.jsx(B,{pageData:i,projectData:e})]})]})})]})};exports.default=F;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import
|
|
3
|
-
import { isEqual as
|
|
2
|
+
import y, { useState as I, useEffect as L } from "react";
|
|
3
|
+
import { isEqual as x, isEmpty as C, isString as z, omit as j, kebabCase as B } from "lodash";
|
|
4
4
|
import { HomeIcon as G } from "@radix-ui/react-icons";
|
|
5
5
|
import { B as Y } from "./useBuilderProp-81a14920.js";
|
|
6
6
|
import { S as q } from "./scroll-area-9f64a082.js";
|
|
7
|
-
import { SingleLineText as g, Model as
|
|
7
|
+
import { SingleLineText as g, Model as Z, MultilineText as _, Image as $, Checkbox as F } from "@chaibuilder/blocks";
|
|
8
8
|
import { toast as O } from "sonner";
|
|
9
|
-
import { F as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { F as P } from "./form-5d5c5c9e.js";
|
|
10
|
+
import { _ as Q, P as U, O as V } from "./index-32519c31.js";
|
|
11
|
+
import { a as X } from "./usePageActions-d6e1d325.js";
|
|
12
12
|
import "@radix-ui/react-slot";
|
|
13
13
|
import "class-variance-authority";
|
|
14
14
|
import "./utils-ac68b2c8.js";
|
|
@@ -36,12 +36,13 @@ import "react-dnd";
|
|
|
36
36
|
import "@minoru/react-dnd-treeview";
|
|
37
37
|
import "react-hotkeys-hook";
|
|
38
38
|
import "flat-to-nested";
|
|
39
|
-
import "./Class-
|
|
39
|
+
import "./Class-1fb4c0c4.js";
|
|
40
|
+
import "./MODIFIERS-c2e02614.js";
|
|
40
41
|
import "redux-undo";
|
|
41
42
|
import "@react-hookz/web";
|
|
42
|
-
import "
|
|
43
|
-
import "./
|
|
44
|
-
const K =
|
|
43
|
+
import "lucide-react";
|
|
44
|
+
import "./useChangePage-6a7c7374.js";
|
|
45
|
+
const K = y.lazy(() => import("./delete-page-modal-cc906461.js")), J = y.lazy(() => import("./confirm-alert-f2a47cc7.js")), h = (n) => {
|
|
45
46
|
if (!z(n) || !(n.includes("/[") && n.includes("]")))
|
|
46
47
|
return !1;
|
|
47
48
|
const s = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
|
|
@@ -52,20 +53,20 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
52
53
|
}, f = (n) => n && C(n.seoData) ? {
|
|
53
54
|
...n,
|
|
54
55
|
seoData: { title: "", description: "", image: "" }
|
|
55
|
-
} : n,
|
|
56
|
-
const s = !
|
|
56
|
+
} : n, W = (n, l) => {
|
|
57
|
+
const s = !x(j(n, ["seoData"]), j(l, ["seoData"])), u = !x(f(l).seoData, f(n).seoData);
|
|
57
58
|
return s || u;
|
|
58
|
-
},
|
|
59
|
-
const u = Q(), { data: e } =
|
|
59
|
+
}, $e = ({ open: n, setOpen: l, pageData: s }) => {
|
|
60
|
+
const u = Q(), { data: e } = U(), r = X(), c = V("Homepage updated successfully."), [i, T] = I(f(s)), [d, M] = I({
|
|
60
61
|
isHomePage: (e == null ? void 0 : e.homepage) === s.uuid
|
|
61
|
-
}), S =
|
|
62
|
+
}), S = W(i, s);
|
|
62
63
|
L(() => {
|
|
63
|
-
const m = !
|
|
64
|
+
const m = !x(f(s), i), o = (e == null ? void 0 : e.homepage) !== s.uuid && d.isHomePage;
|
|
64
65
|
l(m || o ? "PENDING" : "OPEN");
|
|
65
66
|
}, [e, s, i, d, l]);
|
|
66
67
|
const N = () => {
|
|
67
68
|
if (S) {
|
|
68
|
-
if (s.type === "DYNAMIC" && !
|
|
69
|
+
if (s.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || "")) {
|
|
69
70
|
n === "ALERT" && l("PENDING");
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
@@ -80,12 +81,12 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
80
81
|
}
|
|
81
82
|
d.isHomePage && (e == null ? void 0 : e.homepage) !== s.uuid && c.mutate({ ...e, homepage: s == null ? void 0 : s.uuid }, { onSuccess: () => l("CLOSE") });
|
|
82
83
|
}, E = ({ formData: m }, o) => {
|
|
83
|
-
|
|
84
|
+
T((p) => {
|
|
84
85
|
var b, A;
|
|
85
86
|
if (!o)
|
|
86
87
|
return p;
|
|
87
88
|
const a = { [o]: m[o] };
|
|
88
|
-
return o === "
|
|
89
|
+
return o === "name" ? a.slug = B((b = m[o]) == null ? void 0 : b.replace(/\d/g, "")) : o === "slug" ? a.slug = (A = m[o]) == null ? void 0 : A.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_") : o === "seoData" && (a.seoData = {
|
|
89
90
|
title: m[o].title || "",
|
|
90
91
|
description: m[o].description || "",
|
|
91
92
|
image: m[o].image || ""
|
|
@@ -94,22 +95,22 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
94
95
|
...a
|
|
95
96
|
};
|
|
96
97
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
98
|
+
}, v = ({ formData: m }, o) => {
|
|
99
|
+
M((p) => {
|
|
99
100
|
const a = { [o]: m[o] };
|
|
100
101
|
return {
|
|
101
102
|
...p,
|
|
102
103
|
...a
|
|
103
104
|
};
|
|
104
105
|
});
|
|
105
|
-
},
|
|
106
|
-
|
|
106
|
+
}, H = {
|
|
107
|
+
name: g({
|
|
107
108
|
title: "Page Name",
|
|
108
109
|
default: i.name
|
|
109
110
|
}),
|
|
110
111
|
slug: g({ title: "Page Slug", default: i.slug })
|
|
111
|
-
},
|
|
112
|
-
|
|
112
|
+
}, w = {
|
|
113
|
+
seoData: Z({
|
|
113
114
|
title: "",
|
|
114
115
|
description: "",
|
|
115
116
|
default: {
|
|
@@ -122,14 +123,14 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
122
123
|
title: "Meta Title",
|
|
123
124
|
default: i.name
|
|
124
125
|
}),
|
|
125
|
-
description:
|
|
126
|
+
description: _({
|
|
126
127
|
title: "Meta Description",
|
|
127
128
|
default: i.slug
|
|
128
129
|
}),
|
|
129
130
|
image: $({ title: "Social Media Image", default: "" })
|
|
130
131
|
}
|
|
131
132
|
})
|
|
132
|
-
},
|
|
133
|
+
}, R = {
|
|
133
134
|
isHomePage: F({
|
|
134
135
|
title: "Set as homepage",
|
|
135
136
|
default: d.isHomePage
|
|
@@ -137,7 +138,7 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
137
138
|
};
|
|
138
139
|
return /* @__PURE__ */ t.jsxs(q, { className: "flex h-full select-none flex-col", children: [
|
|
139
140
|
/* @__PURE__ */ t.jsx(
|
|
140
|
-
|
|
141
|
+
J,
|
|
141
142
|
{
|
|
142
143
|
open: n === "ALERT",
|
|
143
144
|
title: "Do yo want to save changes?",
|
|
@@ -149,32 +150,32 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
149
150
|
/* @__PURE__ */ t.jsx("div", { className: "rounded-md bg-background/30 px-2.5 py-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Page Details" }) }),
|
|
150
151
|
/* @__PURE__ */ t.jsx("div", { className: "px-2.5 pt-2", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
151
152
|
/* @__PURE__ */ t.jsx(
|
|
152
|
-
|
|
153
|
+
P,
|
|
153
154
|
{
|
|
154
155
|
title: "Basic Details",
|
|
155
156
|
formData: i,
|
|
156
|
-
properties:
|
|
157
|
+
properties: H,
|
|
157
158
|
onChange: E,
|
|
158
159
|
disabled: r.isPending || c.isPending
|
|
159
160
|
}
|
|
160
161
|
),
|
|
161
162
|
/* @__PURE__ */ t.jsx("div", { className: "h-2 w-full" }),
|
|
162
163
|
/* @__PURE__ */ t.jsx(
|
|
163
|
-
|
|
164
|
+
P,
|
|
164
165
|
{
|
|
165
166
|
title: "SEO Details",
|
|
166
167
|
formData: i,
|
|
167
|
-
properties:
|
|
168
|
+
properties: w,
|
|
168
169
|
onChange: E,
|
|
169
170
|
disabled: r.isPending || c.isPending
|
|
170
171
|
}
|
|
171
172
|
),
|
|
172
173
|
(e == null ? void 0 : e.homepage) !== s.uuid && s.type === "STATIC" ? /* @__PURE__ */ t.jsx(
|
|
173
|
-
|
|
174
|
+
P,
|
|
174
175
|
{
|
|
175
176
|
formData: d,
|
|
176
|
-
properties:
|
|
177
|
-
onChange:
|
|
177
|
+
properties: R,
|
|
178
|
+
onChange: v,
|
|
178
179
|
disabled: r.isPending || c.isPending
|
|
179
180
|
}
|
|
180
181
|
) : s.type === "STATIC" && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500", children: [
|
|
@@ -182,7 +183,7 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
182
183
|
" This is homepage",
|
|
183
184
|
" "
|
|
184
185
|
] }),
|
|
185
|
-
i.type === "DYNAMIC" && !
|
|
186
|
+
i.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || "") && /* @__PURE__ */ t.jsxs("small", { className: "px-1 text-red-400", children: [
|
|
186
187
|
"Add dynamic ID in page slug Eg: ",
|
|
187
188
|
/* @__PURE__ */ t.jsx("i", { className: "underline", children: "some-url/[some-id]" })
|
|
188
189
|
] }),
|
|
@@ -193,7 +194,7 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
193
194
|
className: "w-full",
|
|
194
195
|
type: "submit",
|
|
195
196
|
onClick: N,
|
|
196
|
-
disabled: (e == null ? void 0 : e.homepage) !== s.uuid && d.isHomePage ? !1 : C(i.name) || C(i.slug) || !S || r.isPending || c.isPending || i.type === "DYNAMIC" && !
|
|
197
|
+
disabled: (e == null ? void 0 : e.homepage) !== s.uuid && d.isHomePage ? !1 : C(i.name) || C(i.slug) || !S || r.isPending || c.isPending || i.type === "DYNAMIC" && !h((i == null ? void 0 : i.slug) || ""),
|
|
197
198
|
children: "Save"
|
|
198
199
|
}
|
|
199
200
|
),
|
|
@@ -203,5 +204,5 @@ const K = T.lazy(() => import("./delete-page-modal-fa7b4272.js")), U = T.lazy(()
|
|
|
203
204
|
] });
|
|
204
205
|
};
|
|
205
206
|
export {
|
|
206
|
-
|
|
207
|
+
$e as default
|
|
207
208
|
};
|