@chaibuilder/sdk 0.1.16 → 0.1.18
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-5cb44efb.cjs +3 -0
- package/dist/{AddBlocks-6f4db22d.js → AddBlocks-c47af38f.js} +49 -45
- package/dist/BrandingOptions-4f3e3a8d.cjs +1 -0
- package/dist/{BrandingOptions-d6351932.js → BrandingOptions-52b2de6f.js} +11 -7
- package/dist/CanvasArea-90a395c1.js +1311 -0
- package/dist/CanvasArea-aef3fa5e.cjs +46 -0
- package/dist/{CurrentPage-e8f8ff05.js → CurrentPage-2721bc7b.js} +18 -14
- package/dist/CurrentPage-d1ec06db.cjs +1 -0
- package/dist/{ImagesPanel-68a11293.cjs → ImagesPanel-0db5c72f.cjs} +1 -1
- package/dist/{ImagesPanel-996761b1.js → ImagesPanel-38c44785.js} +1 -1
- package/dist/{Layers-6fc21e86.js → Layers-a9cf4d7c.js} +144 -142
- package/dist/Layers-d0edf1a8.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-cf7e8b31.js → MarkAsGlobalBlock-0cf6e5a2.js} +15 -11
- package/dist/MarkAsGlobalBlock-c43c3b2c.cjs +1 -0
- package/dist/PagesPanel-22050a98.cjs +1 -0
- package/dist/{PagesPanel-7db807df.js → PagesPanel-589544c2.js} +12 -8
- package/dist/ProjectPanel-215ba7f1.cjs +1 -0
- package/dist/{ProjectPanel-a7c78e1f.js → ProjectPanel-dbea8af1.js} +12 -8
- package/dist/Settings-71c0312b.cjs +1 -0
- package/dist/{Settings-1e6e0534.js → Settings-c347533e.js} +909 -640
- package/dist/SidePanels-214fef72.js +2999 -0
- package/dist/SidePanels-3844d8b5.cjs +13 -0
- package/dist/{Topbar-4f1aca98.js → Topbar-1dd5c34e.js} +23 -19
- package/dist/Topbar-4fa3ab61.cjs +1 -0
- package/dist/{UnsplashImages-f761ad96.cjs → UnsplashImages-0d091e33.cjs} +1 -1
- package/dist/{UnsplashImages-47374e0c.js → UnsplashImages-10c95b63.js} +1 -1
- package/dist/{UploadImages-33c1507a.cjs → UploadImages-10439fde.cjs} +1 -1
- package/dist/{UploadImages-f0ba3215.js → UploadImages-b14bd152.js} +1 -1
- package/dist/_commonjsHelpers-10dfc225.js +8 -0
- package/dist/_commonjsHelpers-87b0abe8.cjs +1 -0
- package/dist/add-page-modal-05c947fb.cjs +1 -0
- package/dist/{add-page-modal-d4f5ba20.js → add-page-modal-5cc1393d.js} +14 -11
- package/dist/card-14e1d020.cjs +1 -0
- package/dist/card-f8f4f985.js +33 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.js +63 -59
- package/dist/delete-page-modal-859c3a09.cjs +1 -0
- package/dist/{delete-page-modal-00d5fbab.js → delete-page-modal-a79bfc45.js} +15 -11
- package/dist/{form-bf09d392.js → form-725e3191.js} +3 -3
- package/dist/{form-5d04c9b3.cjs → form-99b51245.cjs} +1 -1
- package/dist/index-dfeadcce.cjs +164 -0
- package/dist/index-f8a2f8ef.js +31068 -0
- package/dist/{link-6467eda6.js → link-2af5de8b.js} +1 -1
- package/dist/{link-4585b2d6.cjs → link-86ac8848.cjs} +1 -1
- package/dist/page-viewer-aac7b439.cjs +1 -0
- package/dist/{page-viewer-c494031b.js → page-viewer-c6421156.js} +22 -18
- package/dist/project-general-setting-ce814ecf.cjs +1 -0
- package/dist/{project-general-setting-fca12629.js → project-general-setting-f9fd21cc.js} +9 -7
- package/dist/{project-seo-setting-3f645a02.cjs → project-seo-setting-a9403f1d.cjs} +1 -1
- package/dist/{project-seo-setting-e9587467.js → project-seo-setting-c1980ec3.js} +3 -3
- package/dist/render.cjs +1 -1
- package/dist/render.js +1 -1
- package/dist/{scroll-area-9f64a082.js → scroll-area-83bd9e8f.js} +7 -7
- package/dist/{scroll-area-088530b9.cjs → scroll-area-bb343b86.cjs} +1 -1
- package/dist/{single-page-detail-ff7fceb1.js → single-page-detail-2ac00c2e.js} +32 -30
- package/dist/single-page-detail-dcbb3cab.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/textarea-20b2f6b2.cjs +1 -0
- package/dist/textarea-9dfb6a32.js +45 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +74 -73
- package/dist/useChaiExternalData-192c7896.js +5 -0
- package/dist/useChaiExternalData-a90e8aac.cjs +1 -0
- package/package.json +5 -3
- package/dist/AddBlocks-59a68fc9.cjs +0 -3
- package/dist/BrandingOptions-8e7a159f.cjs +0 -1
- package/dist/CanvasArea-08537c6e.cjs +0 -60
- package/dist/CanvasArea-a585620d.js +0 -1459
- package/dist/CurrentPage-cbbfdbf4.cjs +0 -1
- package/dist/Layers-636e0bc6.cjs +0 -1
- package/dist/MarkAsGlobalBlock-23dd24b9.cjs +0 -1
- package/dist/PagesPanel-bf13d0a5.cjs +0 -1
- package/dist/ProjectPanel-d98d3585.cjs +0 -1
- package/dist/Settings-1b76c006.cjs +0 -1
- package/dist/SidePanels-55124e18.cjs +0 -1
- package/dist/SidePanels-af4f2c45.js +0 -149
- package/dist/Topbar-5df341d7.cjs +0 -1
- package/dist/_commonjsHelpers-5a53b418.cjs +0 -1
- package/dist/_commonjsHelpers-d4512b9c.js +0 -6
- package/dist/add-page-modal-b685709e.cjs +0 -1
- package/dist/delete-page-modal-bbd3ffa2.cjs +0 -1
- package/dist/index-8a7a37ce.js +0 -5028
- package/dist/index-bf44bc93.cjs +0 -2
- package/dist/page-viewer-f0a54a92.cjs +0 -1
- package/dist/project-general-setting-a3e99d1e.cjs +0 -1
- package/dist/single-page-detail-84c67e67.cjs +0 -1
- package/dist/textarea-0750bcd2.js +0 -73
- package/dist/textarea-a338ede6.cjs +0 -1
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import { nth as k, startsWith as
|
|
3
|
-
import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as
|
|
2
|
+
import { nth as k, startsWith as P, has as H, map as v, isUndefined as L, find as V, isEmpty as z, includes as F } from "lodash";
|
|
3
|
+
import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as Y, BorderAllIcon as q, BorderTopIcon as Q, TableIcon as U, DropdownMenuIcon as W, RadiobuttonIcon as X, InputIcon as J, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as oe, DividerHorizontalIcon as ne, CodeIcon as re, CursorTextIcon as ae, VideoIcon as ce, Link1Icon as le, HeadingIcon as ie, ImageIcon as de, TriangleRightIcon as xe, GlobeIcon as ue, CopyIcon as me, ClipboardCopyIcon as pe, ScissorsIcon as ge, ClipboardIcon as je, TrashIcon as he, DoubleArrowDownIcon as fe, StackIcon as Ie } from "@radix-ui/react-icons";
|
|
4
4
|
import { useDrop as be, useDragLayer as ke } from "react-dnd";
|
|
5
5
|
import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
|
|
6
6
|
import { useTranslation as Ce } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { A as ve, V as we, i as g, m as Se, q as De, n as Te, o as Ne, t as Me, D as Oe, W as Re, B as Ee, h as Ae, j as _e, d as Pe, X as He, b as Le, Y as Ve } from "./index-f8a2f8ef.js";
|
|
8
|
+
import { DatabaseIcon as ze } from "lucide-react";
|
|
8
9
|
import { c as w } from "./utils-ac68b2c8.js";
|
|
9
|
-
import { useMemo as Fe, lazy as
|
|
10
|
-
import { S as
|
|
11
|
-
import { D as
|
|
12
|
-
import { C as
|
|
13
|
-
import { u as
|
|
14
|
-
import { S as Je } from "./scroll-area-
|
|
15
|
-
import { useAtom as
|
|
10
|
+
import { useMemo as Fe, lazy as Ge, useState as $e, Suspense as Ke, useCallback as S } from "react";
|
|
11
|
+
import { S as Ye } from "./MODIFIERS-c2e02614.js";
|
|
12
|
+
import { D as qe, a as Qe } from "./dialog-3d4e82ed.js";
|
|
13
|
+
import { C as Ue, a as We, b as Xe, c as d } from "./context-menu-e1c240ce.js";
|
|
14
|
+
import { u as D } from "./useBuilderProp-81a14920.js";
|
|
15
|
+
import { S as Je } from "./scroll-area-83bd9e8f.js";
|
|
16
|
+
import { useAtom as Ze } from "jotai";
|
|
17
|
+
import "./_commonjsHelpers-10dfc225.js";
|
|
18
|
+
import "clsx";
|
|
19
|
+
import "@radix-ui/react-scroll-area";
|
|
20
|
+
import "react-dom";
|
|
21
|
+
import "@floating-ui/react-dom";
|
|
16
22
|
import "i18next";
|
|
17
23
|
import "flagged";
|
|
18
24
|
import "react-hotkeys-hook";
|
|
@@ -22,9 +28,7 @@ import "himalaya";
|
|
|
22
28
|
import "redux-undo";
|
|
23
29
|
import "@react-hookz/web";
|
|
24
30
|
import "@chaibuilder/blocks";
|
|
25
|
-
import "lucide-react";
|
|
26
31
|
import "sonner";
|
|
27
|
-
import "clsx";
|
|
28
32
|
import "tailwind-merge";
|
|
29
33
|
import "@radix-ui/react-dialog";
|
|
30
34
|
import "@radix-ui/react-context-menu";
|
|
@@ -32,8 +36,7 @@ import "@radix-ui/react-slot";
|
|
|
32
36
|
import "class-variance-authority";
|
|
33
37
|
import "@radix-ui/react-tooltip";
|
|
34
38
|
import "@radix-ui/react-toast";
|
|
35
|
-
|
|
36
|
-
const N = (s) => {
|
|
39
|
+
const T = (s) => {
|
|
37
40
|
switch (s.type) {
|
|
38
41
|
case "Image":
|
|
39
42
|
return /* @__PURE__ */ e.jsx(de, {});
|
|
@@ -44,17 +47,17 @@ const N = (s) => {
|
|
|
44
47
|
case "Link":
|
|
45
48
|
return /* @__PURE__ */ e.jsx(le, {});
|
|
46
49
|
case "Video":
|
|
47
|
-
return /* @__PURE__ */ e.jsx(ae, {});
|
|
48
|
-
case "RichText":
|
|
49
50
|
return /* @__PURE__ */ e.jsx(ce, {});
|
|
51
|
+
case "RichText":
|
|
52
|
+
return /* @__PURE__ */ e.jsx(ae, {});
|
|
50
53
|
case "Button":
|
|
51
54
|
return /* @__PURE__ */ e.jsx(B, {});
|
|
52
55
|
case "CustomHTML":
|
|
53
56
|
return /* @__PURE__ */ e.jsx(re, {});
|
|
54
57
|
case "Divider":
|
|
55
|
-
return /* @__PURE__ */ e.jsx(oe, {});
|
|
56
|
-
case "Icon":
|
|
57
58
|
return /* @__PURE__ */ e.jsx(ne, {});
|
|
59
|
+
case "Icon":
|
|
60
|
+
return /* @__PURE__ */ e.jsx(oe, {});
|
|
58
61
|
case "List":
|
|
59
62
|
return /* @__PURE__ */ e.jsx(y, {});
|
|
60
63
|
case "Paragraph":
|
|
@@ -73,28 +76,30 @@ const N = (s) => {
|
|
|
73
76
|
return /* @__PURE__ */ e.jsx(B, {});
|
|
74
77
|
case "Input":
|
|
75
78
|
case "TextArea":
|
|
76
|
-
return /* @__PURE__ */ e.jsx(X, {});
|
|
77
|
-
case "Radio":
|
|
78
79
|
return /* @__PURE__ */ e.jsx(J, {});
|
|
80
|
+
case "Radio":
|
|
81
|
+
return /* @__PURE__ */ e.jsx(X, {});
|
|
79
82
|
case "Select":
|
|
80
83
|
return /* @__PURE__ */ e.jsx(W, {});
|
|
81
84
|
case "Table":
|
|
82
|
-
return /* @__PURE__ */ e.jsx(
|
|
85
|
+
return /* @__PURE__ */ e.jsx(U, {});
|
|
83
86
|
case "TableHead":
|
|
84
87
|
return /* @__PURE__ */ e.jsx(Q, {});
|
|
85
88
|
case "TableBody":
|
|
86
89
|
return /* @__PURE__ */ e.jsx(q, {});
|
|
87
90
|
case "TableRow":
|
|
88
|
-
return /* @__PURE__ */ e.jsx(
|
|
91
|
+
return /* @__PURE__ */ e.jsx(Y, {});
|
|
89
92
|
case "TableCell":
|
|
90
93
|
return /* @__PURE__ */ e.jsx(K, {});
|
|
94
|
+
case "DataProvider":
|
|
95
|
+
return /* @__PURE__ */ e.jsx(ze, { size: 16 });
|
|
91
96
|
case "Box":
|
|
92
97
|
return /* @__PURE__ */ e.jsx($, {});
|
|
93
98
|
default:
|
|
94
99
|
return /* @__PURE__ */ e.jsx(G, {});
|
|
95
100
|
}
|
|
96
101
|
};
|
|
97
|
-
function
|
|
102
|
+
function es(s = "") {
|
|
98
103
|
const t = {
|
|
99
104
|
xs: "390px",
|
|
100
105
|
sm: "640px",
|
|
@@ -108,42 +113,42 @@ function Ze(s = "") {
|
|
|
108
113
|
if (new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))
|
|
109
114
|
return "Visible on mobile";
|
|
110
115
|
if (s.match(/(^| )hidden( |$)/g)) {
|
|
111
|
-
const
|
|
116
|
+
const a = new RegExp(
|
|
112
117
|
// checks if any of the display property is set for any higher media query
|
|
113
118
|
/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/
|
|
114
|
-
),
|
|
115
|
-
if (k(
|
|
116
|
-
return `Visible >=${t[k(
|
|
119
|
+
), c = s.match(a);
|
|
120
|
+
if (k(c, 1))
|
|
121
|
+
return `Visible >=${t[k(c, 1)]}`;
|
|
117
122
|
}
|
|
118
123
|
return "";
|
|
119
124
|
}
|
|
120
|
-
const
|
|
125
|
+
const ss = (s) => {
|
|
121
126
|
let t = "";
|
|
122
|
-
return Object.keys(s).forEach((
|
|
123
|
-
|
|
127
|
+
return Object.keys(s).forEach((o) => {
|
|
128
|
+
P(s[o], Ye) && (t = s[o]);
|
|
124
129
|
}), t;
|
|
125
|
-
},
|
|
130
|
+
}, ts = (s) => {
|
|
126
131
|
var m;
|
|
127
|
-
const [, t] = ve(), [
|
|
132
|
+
const [, t] = ve(), [o] = we(), { isSelected: r } = s, { id: a, data: c } = s.node, l = s.depth * 10, x = (i) => {
|
|
128
133
|
i.stopPropagation(), s.onToggle(s.node.id);
|
|
129
|
-
}, j = Be(
|
|
130
|
-
const i =
|
|
131
|
-
return
|
|
134
|
+
}, j = Be(a, s.isOpen, s.onToggle), u = Fe(() => {
|
|
135
|
+
const i = ss(s.node.data);
|
|
136
|
+
return es(i);
|
|
132
137
|
}, [s.node.data]);
|
|
133
138
|
return (
|
|
134
139
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
135
140
|
/* @__PURE__ */ e.jsx(
|
|
136
141
|
"div",
|
|
137
142
|
{
|
|
138
|
-
onMouseEnter: () => t(
|
|
143
|
+
onMouseEnter: () => t(a),
|
|
139
144
|
className: w(
|
|
140
145
|
"group flex w-full items-center justify-between space-x-px py-px ",
|
|
141
146
|
r ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
|
|
142
147
|
),
|
|
143
148
|
onClick: (i) => {
|
|
144
|
-
i.stopPropagation(), !
|
|
149
|
+
i.stopPropagation(), !o.includes(a) && s.onSelect(a);
|
|
145
150
|
},
|
|
146
|
-
onContextMenu: () => s.onSelect(
|
|
151
|
+
onContextMenu: () => s.onSelect(a),
|
|
147
152
|
style: { paddingInlineStart: l },
|
|
148
153
|
...j,
|
|
149
154
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
@@ -155,7 +160,7 @@ const es = (s) => {
|
|
|
155
160
|
}
|
|
156
161
|
),
|
|
157
162
|
/* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex items-center", children: [
|
|
158
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(
|
|
163
|
+
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(T, { type: c == null ? void 0 : c._type }) }),
|
|
159
164
|
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((m = s.node.data) == null ? void 0 : m._name) || s.node.text }),
|
|
160
165
|
u ? /* @__PURE__ */ e.jsxs(
|
|
161
166
|
"span",
|
|
@@ -173,34 +178,34 @@ const es = (s) => {
|
|
|
173
178
|
}
|
|
174
179
|
)
|
|
175
180
|
);
|
|
176
|
-
},
|
|
177
|
-
var
|
|
181
|
+
}, os = (s) => {
|
|
182
|
+
var o;
|
|
178
183
|
const { item: t } = s.monitorProps;
|
|
179
184
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700", children: [
|
|
180
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(
|
|
185
|
+
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(T, { type: (o = t == null ? void 0 : t.data) == null ? void 0 : o._type }) }),
|
|
181
186
|
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: t.text })
|
|
182
187
|
] });
|
|
183
188
|
}, ns = (s) => {
|
|
184
189
|
const t = s.depth * 10 + 16;
|
|
185
190
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
|
|
186
|
-
},
|
|
187
|
-
const [s] = g(), [, t] =
|
|
191
|
+
}, rs = Ge(() => import("./MarkAsGlobalBlock-0cf6e5a2.js")), as = () => {
|
|
192
|
+
const [s] = g(), [, t] = Te();
|
|
188
193
|
return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
|
|
189
194
|
/* @__PURE__ */ e.jsx(ge, {}),
|
|
190
195
|
" Cut"
|
|
191
196
|
] });
|
|
192
197
|
}, cs = () => {
|
|
193
|
-
const [s] = g(), [, t] =
|
|
198
|
+
const [s] = g(), [, t] = Ne();
|
|
194
199
|
return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
|
|
195
200
|
/* @__PURE__ */ e.jsx(je, {}),
|
|
196
201
|
" Copy"
|
|
197
202
|
] });
|
|
198
|
-
},
|
|
199
|
-
const [s] = g(), t = Me(),
|
|
203
|
+
}, ls = () => {
|
|
204
|
+
const [s] = g(), t = Me(), o = Oe();
|
|
200
205
|
return /* @__PURE__ */ e.jsxs(
|
|
201
206
|
d,
|
|
202
207
|
{
|
|
203
|
-
disabled: (
|
|
208
|
+
disabled: (o == null ? void 0 : o._type) === "Slot",
|
|
204
209
|
className: "flex items-center gap-x-4 text-xs",
|
|
205
210
|
onClick: () => t(s),
|
|
206
211
|
children: [
|
|
@@ -209,14 +214,14 @@ const es = (s) => {
|
|
|
209
214
|
]
|
|
210
215
|
}
|
|
211
216
|
);
|
|
212
|
-
},
|
|
217
|
+
}, is = ({
|
|
213
218
|
id: s = null,
|
|
214
219
|
openMarkAsGlobalModal: t
|
|
215
220
|
}) => {
|
|
216
|
-
const [
|
|
217
|
-
r(
|
|
218
|
-
}, [
|
|
219
|
-
return /* @__PURE__ */ e.jsxs(
|
|
221
|
+
const [o] = g(), r = Se(), { pasteBlocks: a, canPaste: c } = De(), l = D("globalBlocksSupport", !1), x = S(() => {
|
|
222
|
+
r(o);
|
|
223
|
+
}, [o, r]);
|
|
224
|
+
return /* @__PURE__ */ e.jsxs(Xe, { className: "text-xs", children: [
|
|
220
225
|
l && /* @__PURE__ */ e.jsx(d, { className: "flex items-center gap-x-4 border-b text-xs", onClick: t, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-4", children: [
|
|
221
226
|
/* @__PURE__ */ e.jsx(ue, {}),
|
|
222
227
|
" Mark as global"
|
|
@@ -225,89 +230,89 @@ const es = (s) => {
|
|
|
225
230
|
/* @__PURE__ */ e.jsx(me, {}),
|
|
226
231
|
" Duplicate"
|
|
227
232
|
] }),
|
|
228
|
-
/* @__PURE__ */ e.jsx(
|
|
233
|
+
/* @__PURE__ */ e.jsx(as, {}),
|
|
229
234
|
/* @__PURE__ */ e.jsx(cs, {}),
|
|
230
235
|
/* @__PURE__ */ e.jsxs(
|
|
231
236
|
d,
|
|
232
237
|
{
|
|
233
238
|
className: "flex items-center gap-x-4 text-xs",
|
|
234
|
-
onClick: () =>
|
|
235
|
-
disabled: !
|
|
239
|
+
onClick: () => a(s),
|
|
240
|
+
disabled: !c,
|
|
236
241
|
children: [
|
|
237
242
|
/* @__PURE__ */ e.jsx(pe, {}),
|
|
238
243
|
" Paste"
|
|
239
244
|
]
|
|
240
245
|
}
|
|
241
246
|
),
|
|
242
|
-
/* @__PURE__ */ e.jsx(
|
|
247
|
+
/* @__PURE__ */ e.jsx(ls, {})
|
|
243
248
|
] });
|
|
244
|
-
},
|
|
245
|
-
const [
|
|
249
|
+
}, ds = ({ children: s, id: t = null }) => {
|
|
250
|
+
const [o, r] = $e(!1);
|
|
246
251
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
247
|
-
/* @__PURE__ */ e.jsx(
|
|
248
|
-
/* @__PURE__ */ e.jsxs(
|
|
249
|
-
/* @__PURE__ */ e.jsx(
|
|
250
|
-
/* @__PURE__ */ e.jsx(
|
|
252
|
+
/* @__PURE__ */ e.jsx(qe, { open: o, onOpenChange: r, children: o && /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsx(Ke, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(rs, { closeModal: () => r(!1), id: t }) }) }) }),
|
|
253
|
+
/* @__PURE__ */ e.jsxs(Ue, { children: [
|
|
254
|
+
/* @__PURE__ */ e.jsx(We, { children: s }),
|
|
255
|
+
/* @__PURE__ */ e.jsx(is, { id: t, openMarkAsGlobalModal: () => r(!0) })
|
|
251
256
|
] })
|
|
252
257
|
] });
|
|
253
|
-
},
|
|
254
|
-
const { addCoreBlock: s } = Re(), t =
|
|
258
|
+
}, xs = () => {
|
|
259
|
+
const { addCoreBlock: s } = Re(), t = D("getExternalPredefinedBlock");
|
|
255
260
|
return S(
|
|
256
|
-
async (
|
|
257
|
-
const { block: r, dropTargetId:
|
|
258
|
-
if (
|
|
261
|
+
async (o) => {
|
|
262
|
+
const { block: r, dropTargetId: a, relativeIndex: c } = o;
|
|
263
|
+
if (H(r, "format")) {
|
|
259
264
|
const l = await t(r);
|
|
260
|
-
return s({ blocks: l },
|
|
265
|
+
return s({ blocks: l }, a === 0 ? null : a, c);
|
|
261
266
|
}
|
|
262
|
-
return s(r,
|
|
267
|
+
return s(r, a === 0 ? null : a, c);
|
|
263
268
|
},
|
|
264
269
|
[s]
|
|
265
270
|
);
|
|
266
271
|
};
|
|
267
|
-
function
|
|
272
|
+
function us(s) {
|
|
268
273
|
return v(s, (t) => {
|
|
269
|
-
const { data:
|
|
274
|
+
const { data: o } = t;
|
|
270
275
|
return {
|
|
271
|
-
...
|
|
276
|
+
...o,
|
|
272
277
|
_parent: t.parent === 0 ? null : t.parent
|
|
273
278
|
};
|
|
274
279
|
});
|
|
275
280
|
}
|
|
276
|
-
const
|
|
277
|
-
const s = Ee(), [t] = Ae(), [
|
|
278
|
-
const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ =
|
|
281
|
+
const Xs = () => {
|
|
282
|
+
const s = Ee(), [t] = Ae(), [o, r, a] = g(), [, c] = _e(), { t: l } = Ce(), { createSnapshot: x } = Pe(), j = He(), u = xs(), [, m] = Ze(Le), i = async (n, p) => {
|
|
283
|
+
const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = us(n);
|
|
279
284
|
t(_), f ? x() : (await u({
|
|
280
285
|
block: A.getItem(),
|
|
281
286
|
dropTargetId: E,
|
|
282
287
|
destinationIndex: I,
|
|
283
288
|
relativeIndex: b
|
|
284
289
|
}), m(!1));
|
|
285
|
-
},
|
|
286
|
-
id:
|
|
287
|
-
text:
|
|
288
|
-
parent:
|
|
289
|
-
droppable: !L(V(s, { _parent:
|
|
290
|
-
data:
|
|
290
|
+
}, N = v(s, (n) => ({
|
|
291
|
+
id: n._id,
|
|
292
|
+
text: n._type,
|
|
293
|
+
parent: n._parent || 0,
|
|
294
|
+
droppable: !L(V(s, { _parent: n._id })),
|
|
295
|
+
data: n
|
|
291
296
|
})), M = () => {
|
|
292
|
-
r([]),
|
|
297
|
+
r([]), c([]);
|
|
293
298
|
}, [{ isOver: h }, O] = be(() => ({
|
|
294
299
|
accept: ["CHAI_BLOCK"],
|
|
295
|
-
collect: (
|
|
296
|
-
canDrop:
|
|
297
|
-
isOver:
|
|
300
|
+
collect: (n) => ({
|
|
301
|
+
canDrop: n.canDrop(),
|
|
302
|
+
isOver: n.isOver()
|
|
298
303
|
}),
|
|
299
|
-
drop: (
|
|
304
|
+
drop: (n) => {
|
|
300
305
|
(async () => (await u({
|
|
301
|
-
block:
|
|
306
|
+
block: n,
|
|
302
307
|
dropTargetId: "",
|
|
303
308
|
destinationIndex: 0,
|
|
304
309
|
relativeIndex: 0
|
|
305
310
|
}), m(!1)))();
|
|
306
311
|
}
|
|
307
|
-
})), { isDragging: R } = ke((
|
|
308
|
-
isDragging:
|
|
312
|
+
})), { isDragging: R } = ke((n) => ({
|
|
313
|
+
isDragging: n.isDragging()
|
|
309
314
|
}));
|
|
310
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.
|
|
315
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
|
|
311
316
|
"div",
|
|
312
317
|
{
|
|
313
318
|
onClick: () => M(),
|
|
@@ -315,59 +320,56 @@ const qs = () => {
|
|
|
315
320
|
"-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",
|
|
316
321
|
R ? "bg-green-50/80" : "bg-background"
|
|
317
322
|
),
|
|
318
|
-
children:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
-
className:
|
|
325
|
-
children:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
) })
|
|
367
|
-
]
|
|
323
|
+
children: z(s) ? /* @__PURE__ */ e.jsxs(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
ref: O,
|
|
327
|
+
className: `mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h ? "bg-blue-200" : ""}`,
|
|
328
|
+
children: [
|
|
329
|
+
h ? /* @__PURE__ */ e.jsx(fe, { className: "mx-auto h-12 w-12 animate-bounce" }) : /* @__PURE__ */ e.jsx(Ie, { className: "mx-auto h-10 w-10" }),
|
|
330
|
+
/* @__PURE__ */ e.jsx("p", { className: "mt-2", children: l(h ? "drop_here_message" : "tree_view_no_blocks") })
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
) : /* @__PURE__ */ e.jsx(Je, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
|
|
334
|
+
ye,
|
|
335
|
+
{
|
|
336
|
+
initialOpen: j,
|
|
337
|
+
extraAcceptTypes: ["CHAI_BLOCK"],
|
|
338
|
+
tree: N,
|
|
339
|
+
rootId: 0,
|
|
340
|
+
render: (n, { depth: p, isOpen: f, onToggle: I }) => /* @__PURE__ */ e.jsx(ds, { id: n.id, children: /* @__PURE__ */ e.jsx(
|
|
341
|
+
ts,
|
|
342
|
+
{
|
|
343
|
+
onSelect: (b) => {
|
|
344
|
+
c([]), r([b]);
|
|
345
|
+
},
|
|
346
|
+
isSelected: F(o, n.id),
|
|
347
|
+
node: n,
|
|
348
|
+
depth: p,
|
|
349
|
+
isOpen: f,
|
|
350
|
+
onToggle: I,
|
|
351
|
+
toggleIds: a
|
|
352
|
+
}
|
|
353
|
+
) }),
|
|
354
|
+
dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(os, { monitorProps: n }),
|
|
355
|
+
onDrop: i,
|
|
356
|
+
classes: {
|
|
357
|
+
root: "h-full pt-2",
|
|
358
|
+
draggingSource: "opacity-30",
|
|
359
|
+
dropTarget: "bg-green-100",
|
|
360
|
+
placeholder: "relative"
|
|
361
|
+
},
|
|
362
|
+
sort: !1,
|
|
363
|
+
insertDroppableFirst: !1,
|
|
364
|
+
canDrop: Ve,
|
|
365
|
+
dropTargetOffset: 2,
|
|
366
|
+
enableAnimateExpand: !0,
|
|
367
|
+
placeholderRender: (n, { depth: p }) => /* @__PURE__ */ e.jsx(ns, { node: n, depth: p })
|
|
368
|
+
}
|
|
369
|
+
) })
|
|
368
370
|
}
|
|
369
371
|
) });
|
|
370
372
|
};
|
|
371
373
|
export {
|
|
372
|
-
|
|
374
|
+
Xs as default
|
|
373
375
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),s=require("@radix-ui/react-icons"),f=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),P=require("react-i18next"),x=require("./index-dfeadcce.cjs"),_=require("lucide-react"),v=require("./utils-3c452dd0.cjs"),m=require("react"),H=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),q=require("./useBuilderProp-5e57d0c8.cjs"),L=require("./scroll-area-bb343b86.cjs"),F=require("jotai");require("./_commonjsHelpers-87b0abe8.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const S=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(_.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function V(t=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const z=t=>{let n="";return Object.keys(t).forEach(r=>{a.startsWith(t[r],H.STYLES_KEY)&&(n=t[r])}),n},G=t=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=t,{id:i,data:l}=t.node,d=t.depth*10,j=p=>{p.stopPropagation(),t.onToggle(t.node.id)},I=y.useDragOver(i,t.isOpen,t.onToggle),g=m.useMemo(()=>{const p=z(t.node.data);return V(p)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&t.onSelect(i)},onContextMenu:()=>t.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(S,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=t.node.data)==null?void 0:R._name)||t.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},$=t=>{var r;const{item:n}=t.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(S,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},K=t=>{const n=t.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},Q=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-c43c3b2c.cjs"))),U=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},Y=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},W=()=>{const[t]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},J=({id:t=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=q.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(s.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsx(Y,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(W,{})]})},X=({children:t,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(Q,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(J,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},Z=()=>{const{addCoreBlock:t}=x.useAddBlock(),n=q.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return t({blocks:d},i===0?null:i,l)}return t(c,i===0?null:i,l)},[t])};function ee(t){return a.map(t,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const te=()=>{const t=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=P.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=Z(),[,R]=F.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:B,dropTargetId:N,monitor:O}=E,A=ee(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:B}),R(!1))},w=a.map(t,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(t,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=f.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:a.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(L.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:w,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(X,{id:o.id,children:e.jsxRuntimeExports.jsx(G,{onSelect:B=>{l([]),c([B])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx($,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx(K,{node:o,depth:E})})})})})};exports.default=te;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as l } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import { GlobeIcon as m } from "@radix-ui/react-icons";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
|
-
import { B as
|
|
5
|
-
import {
|
|
4
|
+
import { B as e } from "./useBuilderProp-81a14920.js";
|
|
5
|
+
import { a1 as c } from "./index-f8a2f8ef.js";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import { capitalize as p } from "lodash";
|
|
8
8
|
import "@radix-ui/react-slot";
|
|
@@ -13,6 +13,10 @@ import "tailwind-merge";
|
|
|
13
13
|
import "@radix-ui/react-tooltip";
|
|
14
14
|
import "@radix-ui/react-toast";
|
|
15
15
|
import "jotai";
|
|
16
|
+
import "./_commonjsHelpers-10dfc225.js";
|
|
17
|
+
import "@radix-ui/react-scroll-area";
|
|
18
|
+
import "react-dom";
|
|
19
|
+
import "@floating-ui/react-dom";
|
|
16
20
|
import "i18next";
|
|
17
21
|
import "flagged";
|
|
18
22
|
import "react-dnd";
|
|
@@ -27,8 +31,8 @@ import "@react-hookz/web";
|
|
|
27
31
|
import "@chaibuilder/blocks";
|
|
28
32
|
import "lucide-react";
|
|
29
33
|
import "sonner";
|
|
30
|
-
const
|
|
31
|
-
const
|
|
34
|
+
const T = ({ id: o = null, closeModal: i }) => {
|
|
35
|
+
const r = c(), [t, a] = n("");
|
|
32
36
|
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
33
37
|
/* @__PURE__ */ l.jsx("h1", { className: "text-lg font-bold", children: "Mark as Global" }),
|
|
34
38
|
/* @__PURE__ */ l.jsxs("div", { className: "py-2 text-sm", children: [
|
|
@@ -50,27 +54,27 @@ const K = ({ id: o = null, closeModal: t }) => {
|
|
|
50
54
|
{
|
|
51
55
|
placeholder: "Eg: Header, Footer ",
|
|
52
56
|
className: "mt-2 w-full",
|
|
53
|
-
value:
|
|
54
|
-
onChange: (
|
|
57
|
+
value: t,
|
|
58
|
+
onChange: (s) => a(s.target.value)
|
|
55
59
|
}
|
|
56
60
|
)
|
|
57
61
|
] }),
|
|
58
62
|
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-end gap-x-4", children: [
|
|
59
63
|
/* @__PURE__ */ l.jsx(
|
|
60
|
-
|
|
64
|
+
e,
|
|
61
65
|
{
|
|
62
66
|
onClick: () => {
|
|
63
|
-
|
|
67
|
+
r(o, p(t)), i();
|
|
64
68
|
},
|
|
65
|
-
disabled:
|
|
69
|
+
disabled: t.length <= 2,
|
|
66
70
|
variant: "default",
|
|
67
71
|
children: "Mark as Global"
|
|
68
72
|
}
|
|
69
73
|
),
|
|
70
|
-
/* @__PURE__ */ l.jsx(
|
|
74
|
+
/* @__PURE__ */ l.jsx(e, { variant: "outline", onClick: i, children: "Cancel" })
|
|
71
75
|
] })
|
|
72
76
|
] });
|
|
73
77
|
};
|
|
74
78
|
export {
|
|
75
|
-
|
|
79
|
+
T as default
|
|
76
80
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),u=require("@radix-ui/react-icons"),o=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-dfeadcce.cjs");require("react-i18next");const x=require("lodash");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("./_commonjsHelpers-87b0abe8.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(u.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),u=require("./index-dfeadcce.cjs");require("./_commonjsHelpers-87b0abe8.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-05c947fb.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-aac7b439.cjs"))),c=()=>{const{data:t=[],isLoading:n}=u.usePages(),{data:r}=u.useProject(),o=s.sortBy(s.filter(t,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
|