@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.
Files changed (89) hide show
  1. package/dist/AddBlocks-5cb44efb.cjs +3 -0
  2. package/dist/{AddBlocks-6f4db22d.js → AddBlocks-c47af38f.js} +49 -45
  3. package/dist/BrandingOptions-4f3e3a8d.cjs +1 -0
  4. package/dist/{BrandingOptions-d6351932.js → BrandingOptions-52b2de6f.js} +11 -7
  5. package/dist/CanvasArea-90a395c1.js +1311 -0
  6. package/dist/CanvasArea-aef3fa5e.cjs +46 -0
  7. package/dist/{CurrentPage-e8f8ff05.js → CurrentPage-2721bc7b.js} +18 -14
  8. package/dist/CurrentPage-d1ec06db.cjs +1 -0
  9. package/dist/{ImagesPanel-68a11293.cjs → ImagesPanel-0db5c72f.cjs} +1 -1
  10. package/dist/{ImagesPanel-996761b1.js → ImagesPanel-38c44785.js} +1 -1
  11. package/dist/{Layers-6fc21e86.js → Layers-a9cf4d7c.js} +144 -142
  12. package/dist/Layers-d0edf1a8.cjs +1 -0
  13. package/dist/{MarkAsGlobalBlock-cf7e8b31.js → MarkAsGlobalBlock-0cf6e5a2.js} +15 -11
  14. package/dist/MarkAsGlobalBlock-c43c3b2c.cjs +1 -0
  15. package/dist/PagesPanel-22050a98.cjs +1 -0
  16. package/dist/{PagesPanel-7db807df.js → PagesPanel-589544c2.js} +12 -8
  17. package/dist/ProjectPanel-215ba7f1.cjs +1 -0
  18. package/dist/{ProjectPanel-a7c78e1f.js → ProjectPanel-dbea8af1.js} +12 -8
  19. package/dist/Settings-71c0312b.cjs +1 -0
  20. package/dist/{Settings-1e6e0534.js → Settings-c347533e.js} +909 -640
  21. package/dist/SidePanels-214fef72.js +2999 -0
  22. package/dist/SidePanels-3844d8b5.cjs +13 -0
  23. package/dist/{Topbar-4f1aca98.js → Topbar-1dd5c34e.js} +23 -19
  24. package/dist/Topbar-4fa3ab61.cjs +1 -0
  25. package/dist/{UnsplashImages-f761ad96.cjs → UnsplashImages-0d091e33.cjs} +1 -1
  26. package/dist/{UnsplashImages-47374e0c.js → UnsplashImages-10c95b63.js} +1 -1
  27. package/dist/{UploadImages-33c1507a.cjs → UploadImages-10439fde.cjs} +1 -1
  28. package/dist/{UploadImages-f0ba3215.js → UploadImages-b14bd152.js} +1 -1
  29. package/dist/_commonjsHelpers-10dfc225.js +8 -0
  30. package/dist/_commonjsHelpers-87b0abe8.cjs +1 -0
  31. package/dist/add-page-modal-05c947fb.cjs +1 -0
  32. package/dist/{add-page-modal-d4f5ba20.js → add-page-modal-5cc1393d.js} +14 -11
  33. package/dist/card-14e1d020.cjs +1 -0
  34. package/dist/card-f8f4f985.js +33 -0
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +6 -4
  37. package/dist/core.js +63 -59
  38. package/dist/delete-page-modal-859c3a09.cjs +1 -0
  39. package/dist/{delete-page-modal-00d5fbab.js → delete-page-modal-a79bfc45.js} +15 -11
  40. package/dist/{form-bf09d392.js → form-725e3191.js} +3 -3
  41. package/dist/{form-5d04c9b3.cjs → form-99b51245.cjs} +1 -1
  42. package/dist/index-dfeadcce.cjs +164 -0
  43. package/dist/index-f8a2f8ef.js +31068 -0
  44. package/dist/{link-6467eda6.js → link-2af5de8b.js} +1 -1
  45. package/dist/{link-4585b2d6.cjs → link-86ac8848.cjs} +1 -1
  46. package/dist/page-viewer-aac7b439.cjs +1 -0
  47. package/dist/{page-viewer-c494031b.js → page-viewer-c6421156.js} +22 -18
  48. package/dist/project-general-setting-ce814ecf.cjs +1 -0
  49. package/dist/{project-general-setting-fca12629.js → project-general-setting-f9fd21cc.js} +9 -7
  50. package/dist/{project-seo-setting-3f645a02.cjs → project-seo-setting-a9403f1d.cjs} +1 -1
  51. package/dist/{project-seo-setting-e9587467.js → project-seo-setting-c1980ec3.js} +3 -3
  52. package/dist/render.cjs +1 -1
  53. package/dist/render.js +1 -1
  54. package/dist/{scroll-area-9f64a082.js → scroll-area-83bd9e8f.js} +7 -7
  55. package/dist/{scroll-area-088530b9.cjs → scroll-area-bb343b86.cjs} +1 -1
  56. package/dist/{single-page-detail-ff7fceb1.js → single-page-detail-2ac00c2e.js} +32 -30
  57. package/dist/single-page-detail-dcbb3cab.cjs +1 -0
  58. package/dist/style.css +1 -1
  59. package/dist/textarea-20b2f6b2.cjs +1 -0
  60. package/dist/textarea-9dfb6a32.js +45 -0
  61. package/dist/ui.cjs +1 -1
  62. package/dist/ui.js +74 -73
  63. package/dist/useChaiExternalData-192c7896.js +5 -0
  64. package/dist/useChaiExternalData-a90e8aac.cjs +1 -0
  65. package/package.json +5 -3
  66. package/dist/AddBlocks-59a68fc9.cjs +0 -3
  67. package/dist/BrandingOptions-8e7a159f.cjs +0 -1
  68. package/dist/CanvasArea-08537c6e.cjs +0 -60
  69. package/dist/CanvasArea-a585620d.js +0 -1459
  70. package/dist/CurrentPage-cbbfdbf4.cjs +0 -1
  71. package/dist/Layers-636e0bc6.cjs +0 -1
  72. package/dist/MarkAsGlobalBlock-23dd24b9.cjs +0 -1
  73. package/dist/PagesPanel-bf13d0a5.cjs +0 -1
  74. package/dist/ProjectPanel-d98d3585.cjs +0 -1
  75. package/dist/Settings-1b76c006.cjs +0 -1
  76. package/dist/SidePanels-55124e18.cjs +0 -1
  77. package/dist/SidePanels-af4f2c45.js +0 -149
  78. package/dist/Topbar-5df341d7.cjs +0 -1
  79. package/dist/_commonjsHelpers-5a53b418.cjs +0 -1
  80. package/dist/_commonjsHelpers-d4512b9c.js +0 -6
  81. package/dist/add-page-modal-b685709e.cjs +0 -1
  82. package/dist/delete-page-modal-bbd3ffa2.cjs +0 -1
  83. package/dist/index-8a7a37ce.js +0 -5028
  84. package/dist/index-bf44bc93.cjs +0 -2
  85. package/dist/page-viewer-f0a54a92.cjs +0 -1
  86. package/dist/project-general-setting-a3e99d1e.cjs +0 -1
  87. package/dist/single-page-detail-84c67e67.cjs +0 -1
  88. package/dist/textarea-0750bcd2.js +0 -73
  89. 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 H, has as P, map as v, isUndefined as L, find as V, isEmpty as F, includes as z } from "lodash";
3
- import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as U, BorderAllIcon as q, BorderTopIcon as Q, TableIcon as Y, DropdownMenuIcon as W, RadiobuttonIcon as J, InputIcon as X, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as ne, DividerHorizontalIcon as oe, CodeIcon as re, CursorTextIcon as ce, VideoIcon as ae, 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";
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 { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-8a7a37ce.js";
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 ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
10
- import { S as Ke } from "./MODIFIERS-c2e02614.js";
11
- import { D as Ue, a as qe } from "./dialog-3d4e82ed.js";
12
- import { C as Qe, a as Ye, b as We, c as d } from "./context-menu-e1c240ce.js";
13
- import { u as T } from "./useBuilderProp-81a14920.js";
14
- import { S as Je } from "./scroll-area-9f64a082.js";
15
- import { useAtom as Xe } from "jotai";
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
- import "@radix-ui/react-scroll-area";
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(Y, {});
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(U, {});
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 Ze(s = "") {
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 c = new RegExp(
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
- ), a = s.match(c);
115
- if (k(a, 1))
116
- return `Visible >=${t[k(a, 1)]}`;
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 es = (s) => {
125
+ const ss = (s) => {
121
126
  let t = "";
122
- return Object.keys(s).forEach((n) => {
123
- H(s[n], Ke) && (t = s[n]);
127
+ return Object.keys(s).forEach((o) => {
128
+ P(s[o], Ye) && (t = s[o]);
124
129
  }), t;
125
- }, ss = (s) => {
130
+ }, ts = (s) => {
126
131
  var m;
127
- const [, t] = ve(), [n] = we(), { isSelected: r } = s, { id: c, data: a } = s.node, l = s.depth * 10, x = (i) => {
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(c, s.isOpen, s.onToggle), u = Fe(() => {
130
- const i = es(s.node.data);
131
- return Ze(i);
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(c),
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(), !n.includes(c) && s.onSelect(c);
149
+ i.stopPropagation(), !o.includes(a) && s.onSelect(a);
145
150
  },
146
- onContextMenu: () => s.onSelect(c),
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(N, { type: a == null ? void 0 : a._type }) }),
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
- }, ts = (s) => {
177
- var n;
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(N, { type: (n = t == null ? void 0 : t.data) == null ? void 0 : n._type }) }),
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
- }, os = ze(() => import("./MarkAsGlobalBlock-cf7e8b31.js")), rs = () => {
187
- const [s] = g(), [, t] = Ne();
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] = De();
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
- }, as = () => {
199
- const [s] = g(), t = Me(), n = Oe();
203
+ }, ls = () => {
204
+ const [s] = g(), t = Me(), o = Oe();
200
205
  return /* @__PURE__ */ e.jsxs(
201
206
  d,
202
207
  {
203
- disabled: (n == null ? void 0 : n._type) === "Slot",
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
- }, ls = ({
217
+ }, is = ({
213
218
  id: s = null,
214
219
  openMarkAsGlobalModal: t
215
220
  }) => {
216
- const [n] = g(), r = Se(), { pasteBlocks: c, canPaste: a } = Te(), l = T("globalBlocksSupport", !1), x = S(() => {
217
- r(n);
218
- }, [n, r]);
219
- return /* @__PURE__ */ e.jsxs(We, { className: "text-xs", children: [
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(rs, {}),
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: () => c(s),
235
- disabled: !a,
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(as, {})
247
+ /* @__PURE__ */ e.jsx(ls, {})
243
248
  ] });
244
- }, is = ({ children: s, id: t = null }) => {
245
- const [n, r] = Ge(!1);
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(Ue, { open: n, onOpenChange: r, children: n && /* @__PURE__ */ e.jsx(qe, { children: /* @__PURE__ */ e.jsx($e, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(os, { closeModal: () => r(!1), id: t }) }) }) }),
248
- /* @__PURE__ */ e.jsxs(Qe, { children: [
249
- /* @__PURE__ */ e.jsx(Ye, { children: s }),
250
- /* @__PURE__ */ e.jsx(ls, { id: t, openMarkAsGlobalModal: () => r(!0) })
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
- }, ds = () => {
254
- const { addCoreBlock: s } = Re(), t = T("getExternalPredefinedBlock");
258
+ }, xs = () => {
259
+ const { addCoreBlock: s } = Re(), t = D("getExternalPredefinedBlock");
255
260
  return S(
256
- async (n) => {
257
- const { block: r, dropTargetId: c, relativeIndex: a } = n;
258
- if (P(r, "format")) {
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 }, c === 0 ? null : c, a);
265
+ return s({ blocks: l }, a === 0 ? null : a, c);
261
266
  }
262
- return s(r, c === 0 ? null : c, a);
267
+ return s(r, a === 0 ? null : a, c);
263
268
  },
264
269
  [s]
265
270
  );
266
271
  };
267
- function xs(s) {
272
+ function us(s) {
268
273
  return v(s, (t) => {
269
- const { data: n } = t;
274
+ const { data: o } = t;
270
275
  return {
271
- ...n,
276
+ ...o,
272
277
  _parent: t.parent === 0 ? null : t.parent
273
278
  };
274
279
  });
275
280
  }
276
- const qs = () => {
277
- const s = Ee(), [t] = Ae(), [n, r, c] = g(), [, a] = _e(), { t: l } = Ce(), { createSnapshot: x } = He(), j = Pe(), u = ds(), [, m] = Xe(Le), i = async (o, p) => {
278
- const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = xs(o);
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
- }, D = v(s, (o) => ({
286
- id: o._id,
287
- text: o._type,
288
- parent: o._parent || 0,
289
- droppable: !L(V(s, { _parent: o._id })),
290
- data: o
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([]), a([]);
297
+ r([]), c([]);
293
298
  }, [{ isOver: h }, O] = be(() => ({
294
299
  accept: ["CHAI_BLOCK"],
295
- collect: (o) => ({
296
- canDrop: o.canDrop(),
297
- isOver: o.isOver()
300
+ collect: (n) => ({
301
+ canDrop: n.canDrop(),
302
+ isOver: n.isOver()
298
303
  }),
299
- drop: (o) => {
304
+ drop: (n) => {
300
305
  (async () => (await u({
301
- block: o,
306
+ block: n,
302
307
  dropTargetId: "",
303
308
  destinationIndex: 0,
304
309
  relativeIndex: 0
305
310
  }), m(!1)))();
306
311
  }
307
- })), { isDragging: R } = ke((o) => ({
308
- isDragging: o.isDragging()
312
+ })), { isDragging: R } = ke((n) => ({
313
+ isDragging: n.isDragging()
309
314
  }));
310
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
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
- /* @__PURE__ */ e.jsx("div", { className: "mx-1 h-10 rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "px-1 font-semibold", children: "Tree view" }) }),
320
- F(s) ? /* @__PURE__ */ e.jsxs(
321
- "div",
322
- {
323
- ref: O,
324
- className: `mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h ? "bg-blue-200" : ""}`,
325
- children: [
326
- 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" }),
327
- /* @__PURE__ */ e.jsx("p", { className: "mt-2", children: l(h ? "drop_here_message" : "tree_view_no_blocks") })
328
- ]
329
- }
330
- ) : /* @__PURE__ */ e.jsx(Je, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
331
- ye,
332
- {
333
- initialOpen: j,
334
- extraAcceptTypes: ["CHAI_BLOCK"],
335
- tree: D,
336
- rootId: 0,
337
- render: (o, { depth: p, isOpen: f, onToggle: I }) => /* @__PURE__ */ e.jsx(is, { id: o.id, children: /* @__PURE__ */ e.jsx(
338
- ss,
339
- {
340
- onSelect: (b) => {
341
- a([]), r([b]);
342
- },
343
- isSelected: z(n, o.id),
344
- node: o,
345
- depth: p,
346
- isOpen: f,
347
- onToggle: I,
348
- toggleIds: c
349
- }
350
- ) }),
351
- dragPreviewRender: (o) => /* @__PURE__ */ e.jsx(ts, { monitorProps: o }),
352
- onDrop: i,
353
- classes: {
354
- root: "h-full pt-2",
355
- draggingSource: "opacity-30",
356
- dropTarget: "bg-green-100",
357
- placeholder: "relative"
358
- },
359
- sort: !1,
360
- insertDroppableFirst: !1,
361
- canDrop: Ve,
362
- dropTargetOffset: 2,
363
- enableAnimateExpand: !0,
364
- placeholderRender: (o, { depth: p }) => /* @__PURE__ */ e.jsx(ns, { node: o, depth: p })
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
- qs as default
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 i } from "./useBuilderProp-81a14920.js";
5
- import { _ as c } from "./index-8a7a37ce.js";
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 K = ({ id: o = null, closeModal: t }) => {
31
- const a = c(), [e, s] = n("");
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: e,
54
- onChange: (r) => s(r.target.value)
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
- i,
64
+ e,
61
65
  {
62
66
  onClick: () => {
63
- a(o, p(e)), t();
67
+ r(o, p(t)), i();
64
68
  },
65
- disabled: e.length <= 2,
69
+ disabled: t.length <= 2,
66
70
  variant: "default",
67
71
  children: "Mark as Global"
68
72
  }
69
73
  ),
70
- /* @__PURE__ */ l.jsx(i, { variant: "outline", onClick: t, children: "Cancel" })
74
+ /* @__PURE__ */ l.jsx(e, { variant: "outline", onClick: i, children: "Cancel" })
71
75
  ] })
72
76
  ] });
73
77
  };
74
78
  export {
75
- K as default
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;