@chaibuilder/sdk 1.2.9 → 1.2.10
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-tMxKPoen.js → AddBlocks-GiMnBMeQ.js} +28 -29
- package/dist/AddBlocks-SzURo9Bj.cjs +1 -0
- package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-10jJO8mG.js} +3 -4
- package/dist/BrandingOptions-yK-54R-c.cjs +1 -0
- package/dist/CanvasArea-6O8dMPug.cjs +60 -0
- package/dist/{CanvasArea-mlNKmCOh.js → CanvasArea-jgBDM5Qd.js} +459 -474
- package/dist/CurrentPage-1y62Ne77.cjs +1 -0
- package/dist/{CurrentPage-lBy25sZn.js → CurrentPage-lakeZviD.js} +4 -5
- package/dist/{Layers-3Xs4A5i8.js → Layers-R7TfREUd.js} +115 -148
- package/dist/Layers-Z4nmm9xK.cjs +1 -0
- package/dist/{PagesPanel--BZhafnt.js → PagesPanel-4mqxCFHq.js} +4 -5
- package/dist/PagesPanel-ouHdxyOH.cjs +1 -0
- package/dist/{ProjectPanel-YcLkM-DW.js → ProjectPanel-Wy2nw-1w.js} +11 -12
- package/dist/ProjectPanel-hHolYZjt.cjs +1 -0
- package/dist/Settings-EYOw02iE.cjs +1 -0
- package/dist/{Settings-TAgX4hov.js → Settings-_K28Ontt.js} +532 -554
- package/dist/{SidePanels-btVQQkVK.js → SidePanels-6slnxdSj.js} +45 -41
- package/dist/SidePanels-U-_O1QN8.cjs +1 -0
- package/dist/{Topbar-j4t4AgCq.js → Topbar-bwt6HjlL.js} +4 -5
- package/dist/Topbar-dQEoY2P8.cjs +1 -0
- package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-V29UE-57.js} +16 -17
- package/dist/UnsplashImages-pGgaUPQy.cjs +1 -0
- package/dist/UploadImages-7oLycdSh.cjs +1 -0
- package/dist/{UploadImages-xBg-kbKv.js → UploadImages-E0mi_qn8.js} +3 -4
- package/dist/{add-page-modal-cm8damU2.js → add-page-modal-FJEAqfD3.js} +9 -10
- package/dist/add-page-modal-In6XI-vZ.cjs +1 -0
- package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-5hfE116f.js} +3 -4
- package/dist/{confirm-alert-U7-NcG7G.cjs → confirm-alert-Vwd3OzL9.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +12 -8
- package/dist/core.js +46 -46
- package/dist/delete-page-modal-tl7FLK9J.cjs +1 -0
- package/dist/{delete-page-modal-YrIBvfFA.js → delete-page-modal-wH0yLiQI.js} +17 -18
- package/dist/{form-VbouZlAW.cjs → form-1j01gADS.cjs} +1 -1
- package/dist/{form-OVmsLOrc.js → form-UVHCD9N3.js} +18 -18
- package/dist/index-7ogwGh39.cjs +1 -0
- package/dist/index-B4sL0YTN.js +3124 -0
- package/dist/{index-pZhGT8uT.js → index-c2VLKuhY.js} +4886 -4884
- package/dist/{index-N50dZnlC.cjs → index-xbQL0wpz.cjs} +25 -25
- package/dist/page-viewer-SfQUe0SI.cjs +1 -0
- package/dist/{page-viewer-feqJr1QI.js → page-viewer-TcK0I240.js} +6 -7
- package/dist/{project-general-setting-SgagORzW.js → project-general-setting-4ruKl033.js} +5 -6
- package/dist/project-general-setting-t7E2Y_w9.cjs +1 -0
- package/dist/{project-seo-setting-Snn2nZgS.cjs → project-seo-setting-4b_BJZDF.cjs} +1 -1
- package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-d1EZlacB.js} +7 -8
- package/dist/single-page-detail-KuXd9Mur.cjs +1 -0
- package/dist/{single-page-detail-dnWMyg6P.js → single-page-detail-PihQi-dP.js} +6 -7
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -4
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +110 -111
- package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-nLzs79He.cjs} +1 -1
- package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-rcDR-z9_.js} +1 -1
- package/dist/web-blocks.cjs +1 -9
- package/dist/web-blocks.js +397 -399
- package/package.json +1 -1
- package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
- package/dist/CanvasArea-xs4wM64L.cjs +0 -60
- package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
- package/dist/Layers-eaHy5PK9.cjs +0 -1
- package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
- package/dist/PagesPanel-gGKCV394.cjs +0 -1
- package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
- package/dist/Settings-7wlLcvoh.cjs +0 -1
- package/dist/SidePanels-5H4j0mIs.cjs +0 -1
- package/dist/Topbar-V8xCetWF.cjs +0 -1
- package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
- package/dist/UploadImages-DnQ95_NW.cjs +0 -1
- package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
- package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
- package/dist/index-H6vIwGfD.cjs +0 -1
- package/dist/index-niHREMmR.js +0 -2938
- package/dist/page-viewer-SLt8XgYv.cjs +0 -1
- package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
- package/dist/single-page-detail-IPod1o5P.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),t=require("./index-7ogwGh39.cjs"),i=require("lodash-es"),h=require("sonner"),l=require("react"),o=require("./index-xbQL0wpz.cjs"),j=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const p=()=>{const{data:s}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:d}=t.useSavePage(),q=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&s.homepage&&!i.find(u,{uuid:n})&&a(s.homepage)},[n,u,s,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(d!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});q(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(t.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(t.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { ah as x,
|
|
2
|
+
import { ah as x, as as h, at as f, au as j, av as y, aw as v } from "./index-B4sL0YTN.js";
|
|
3
3
|
import { sortBy as P, filter as b, get as w, isEmpty as m, find as n, capitalize as C, map as N } from "lodash-es";
|
|
4
4
|
import { toast as S } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { b as k, a as B, d as E, e as I } from "./index-
|
|
6
|
+
import { b as k, a as B, d as E, e as I } from "./index-c2VLKuhY.js";
|
|
7
7
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -39,7 +39,6 @@ import "flat-to-nested";
|
|
|
39
39
|
import "./Functions-7jnEwJyw.js";
|
|
40
40
|
import "redux-undo";
|
|
41
41
|
import "@chaibuilder/runtime";
|
|
42
|
-
import "lodash";
|
|
43
42
|
import "@react-hookz/web";
|
|
44
43
|
import "react-i18next";
|
|
45
44
|
import "i18next";
|
|
@@ -53,7 +52,7 @@ import "./html-to-json-57841sEK.js";
|
|
|
53
52
|
import "himalaya";
|
|
54
53
|
import "./web-blocks.js";
|
|
55
54
|
import "./controls-XPXGHKht.js";
|
|
56
|
-
const
|
|
55
|
+
const Te = () => {
|
|
57
56
|
const { data: t } = k(), { data: i, isLoading: l } = B(), { syncState: c } = x(), d = E(), [o, a] = I(), s = P(b(i, { type: "STATIC" }), (r) => w(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
|
|
58
57
|
p(() => {
|
|
59
58
|
!m(i) && t.homepage && !n(i, { uuid: o }) && a(t.homepage);
|
|
@@ -107,5 +106,5 @@ const Ve = () => {
|
|
|
107
106
|
);
|
|
108
107
|
};
|
|
109
108
|
export {
|
|
110
|
-
|
|
109
|
+
Te as default
|
|
111
110
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { nth as
|
|
3
|
-
import { BoxModelIcon as F, BoxIcon as D, DragHandleHorizontalIcon as $, ViewHorizontalIcon as
|
|
4
|
-
import { useDrop as
|
|
5
|
-
import { useDragOver as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import {
|
|
8
|
-
import { DatabaseIcon as
|
|
9
|
-
import { useMemo as
|
|
10
|
-
import { a as
|
|
11
|
-
import { c as
|
|
12
|
-
import { f as
|
|
13
|
-
import { u as
|
|
2
|
+
import { nth as k, startsWith as L, map as C, includes as T, isUndefined as P, find as V, isEmpty as z } from "lodash-es";
|
|
3
|
+
import { BoxModelIcon as F, BoxIcon as D, DragHandleHorizontalIcon as $, ViewHorizontalIcon as K, BorderAllIcon as U, BorderTopIcon as Y, TableIcon as Q, DropdownMenuIcon as Z, RadiobuttonIcon as q, InputIcon as G, ButtonIcon as B, CheckboxIcon as W, GroupIcon as J, SpaceBetweenVerticallyIcon as X, ColumnsIcon as ee, RowsIcon as v, TextIcon as w, SketchLogoIcon as te, DividerHorizontalIcon as se, CodeIcon as oe, CursorTextIcon as ne, VideoIcon as re, Link1Icon as ae, HeadingIcon as ce, ImageIcon as ie, TriangleRightIcon as le, TrashIcon as xe, CopyIcon as de, DoubleArrowDownIcon as me, StackIcon as pe } from "@radix-ui/react-icons";
|
|
4
|
+
import { useDrop as ue, useDragLayer as ge } from "react-dnd";
|
|
5
|
+
import { useDragOver as je, Tree as he } from "@minoru/react-dnd-treeview";
|
|
6
|
+
import { useTranslation as be } from "react-i18next";
|
|
7
|
+
import { _ as fe, Z as Ie, j as p, k as ye, a7 as S, by as N, aZ as ke, l as Be, bz as ve, aY as we, bA as Ce, bB as Te, bC as O, s as De, aT as Se, ak as Ne, bo as Oe, bD as Re } from "./index-B4sL0YTN.js";
|
|
8
|
+
import { DatabaseIcon as _e } from "lucide-react";
|
|
9
|
+
import { useMemo as Ee, useCallback as Me } from "react";
|
|
10
|
+
import { a as Ae } from "./MODIFIERS-RiXS5Mn1.js";
|
|
11
|
+
import { c as I } from "./Functions-7jnEwJyw.js";
|
|
12
|
+
import { f as He } from "./index-c2VLKuhY.js";
|
|
13
|
+
import { u as Le } from "./useAddBlockByDrop-rcDR-z9_.js";
|
|
14
14
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
15
15
|
import "@radix-ui/react-toggle";
|
|
16
16
|
import "class-variance-authority";
|
|
@@ -42,7 +42,6 @@ import "jotai";
|
|
|
42
42
|
import "flat-to-nested";
|
|
43
43
|
import "redux-undo";
|
|
44
44
|
import "@chaibuilder/runtime";
|
|
45
|
-
import "lodash";
|
|
46
45
|
import "@react-hookz/web";
|
|
47
46
|
import "i18next";
|
|
48
47
|
import "@floating-ui/react-dom";
|
|
@@ -54,10 +53,10 @@ import "./html-to-json-57841sEK.js";
|
|
|
54
53
|
import "himalaya";
|
|
55
54
|
import "./web-blocks.js";
|
|
56
55
|
import "./controls-XPXGHKht.js";
|
|
57
|
-
const
|
|
56
|
+
const R = (t) => {
|
|
58
57
|
switch (t.type) {
|
|
59
58
|
case "Image":
|
|
60
|
-
return /* @__PURE__ */ e.jsx(
|
|
59
|
+
return /* @__PURE__ */ e.jsx(ie, {});
|
|
61
60
|
case "Heading":
|
|
62
61
|
return /* @__PURE__ */ e.jsx(ce, {});
|
|
63
62
|
case "Text":
|
|
@@ -85,39 +84,39 @@ const M = (t) => {
|
|
|
85
84
|
case "ListItem":
|
|
86
85
|
return /* @__PURE__ */ e.jsx(ee, {});
|
|
87
86
|
case "LineBreak":
|
|
88
|
-
return /* @__PURE__ */ e.jsx(Z, {});
|
|
89
|
-
case "Form":
|
|
90
87
|
return /* @__PURE__ */ e.jsx(X, {});
|
|
91
|
-
case "
|
|
88
|
+
case "Form":
|
|
92
89
|
return /* @__PURE__ */ e.jsx(J, {});
|
|
90
|
+
case "Checkbox":
|
|
91
|
+
return /* @__PURE__ */ e.jsx(W, {});
|
|
93
92
|
case "FormButton":
|
|
94
93
|
return /* @__PURE__ */ e.jsx(B, {});
|
|
95
94
|
case "Input":
|
|
96
95
|
case "TextArea":
|
|
97
|
-
return /* @__PURE__ */ e.jsx(
|
|
96
|
+
return /* @__PURE__ */ e.jsx(G, {});
|
|
98
97
|
case "Radio":
|
|
99
98
|
return /* @__PURE__ */ e.jsx(q, {});
|
|
100
99
|
case "Select":
|
|
101
|
-
return /* @__PURE__ */ e.jsx(
|
|
100
|
+
return /* @__PURE__ */ e.jsx(Z, {});
|
|
102
101
|
case "Table":
|
|
103
|
-
return /* @__PURE__ */ e.jsx(U, {});
|
|
104
|
-
case "TableHead":
|
|
105
102
|
return /* @__PURE__ */ e.jsx(Q, {});
|
|
103
|
+
case "TableHead":
|
|
104
|
+
return /* @__PURE__ */ e.jsx(Y, {});
|
|
106
105
|
case "TableBody":
|
|
107
|
-
return /* @__PURE__ */ e.jsx(
|
|
106
|
+
return /* @__PURE__ */ e.jsx(U, {});
|
|
108
107
|
case "TableRow":
|
|
109
|
-
return /* @__PURE__ */ e.jsx(
|
|
108
|
+
return /* @__PURE__ */ e.jsx(K, {});
|
|
110
109
|
case "TableCell":
|
|
111
110
|
return /* @__PURE__ */ e.jsx($, {});
|
|
112
111
|
case "DataProvider":
|
|
113
|
-
return /* @__PURE__ */ e.jsx(
|
|
112
|
+
return /* @__PURE__ */ e.jsx(_e, { size: 16 });
|
|
114
113
|
case "Box":
|
|
115
114
|
return /* @__PURE__ */ e.jsx(D, {});
|
|
116
115
|
default:
|
|
117
116
|
return /* @__PURE__ */ e.jsx(F, {});
|
|
118
117
|
}
|
|
119
118
|
};
|
|
120
|
-
function
|
|
119
|
+
function Pe(t = "") {
|
|
121
120
|
const s = {
|
|
122
121
|
xs: "390px",
|
|
123
122
|
sm: "640px",
|
|
@@ -135,23 +134,23 @@ function Xe(t = "") {
|
|
|
135
134
|
// checks if any of the display property is set for any higher media query
|
|
136
135
|
/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/
|
|
137
136
|
), c = t.match(a);
|
|
138
|
-
if (
|
|
139
|
-
return `Visible >=${s[
|
|
137
|
+
if (k(c, 1))
|
|
138
|
+
return `Visible >=${s[k(c, 1)]}`;
|
|
140
139
|
}
|
|
141
140
|
return "";
|
|
142
141
|
}
|
|
143
|
-
const
|
|
142
|
+
const Ve = (t) => {
|
|
144
143
|
let s = "";
|
|
145
144
|
return Object.keys(t).forEach((o) => {
|
|
146
|
-
|
|
145
|
+
L(t[o], Ae) && (s = t[o]);
|
|
147
146
|
}), s;
|
|
148
|
-
},
|
|
149
|
-
var
|
|
150
|
-
const [, s] =
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
const
|
|
154
|
-
return
|
|
147
|
+
}, ze = (t) => {
|
|
148
|
+
var m;
|
|
149
|
+
const [, s] = fe(), [o] = Ie(), { isSelected: r } = t, { id: a, data: c } = t.node, u = t.depth * 10, g = (i) => {
|
|
150
|
+
i.stopPropagation(), t.onToggle(t.node.id);
|
|
151
|
+
}, x = je(a, t.isOpen, t.onToggle), d = Ee(() => {
|
|
152
|
+
const i = Ve(t.node.data);
|
|
153
|
+
return Pe(i);
|
|
155
154
|
}, [t.node.data]);
|
|
156
155
|
return (
|
|
157
156
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
@@ -159,34 +158,34 @@ const Ze = (t) => {
|
|
|
159
158
|
"div",
|
|
160
159
|
{
|
|
161
160
|
onMouseEnter: () => s(a),
|
|
162
|
-
className:
|
|
161
|
+
className: I(
|
|
163
162
|
"group flex w-full items-center justify-between space-x-px py-px",
|
|
164
|
-
r ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
|
|
163
|
+
r ? "bg-blue-500 text-white" : "text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800"
|
|
165
164
|
),
|
|
166
|
-
onClick: (
|
|
167
|
-
|
|
165
|
+
onClick: (i) => {
|
|
166
|
+
i.stopPropagation(), !o.includes(a) && t.onSelect(a);
|
|
168
167
|
},
|
|
169
168
|
onContextMenu: () => t.onSelect(a),
|
|
170
|
-
style: { paddingInlineStart:
|
|
171
|
-
...
|
|
169
|
+
style: { paddingInlineStart: u },
|
|
170
|
+
...x,
|
|
172
171
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
173
172
|
/* @__PURE__ */ e.jsx(
|
|
174
173
|
"div",
|
|
175
174
|
{
|
|
176
175
|
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" : ""}`,
|
|
177
|
-
children: t.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick:
|
|
176
|
+
children: t.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick: g, type: "button", children: /* @__PURE__ */ e.jsx(le, {}) })
|
|
178
177
|
}
|
|
179
178
|
),
|
|
180
179
|
/* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex items-center", children: [
|
|
181
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(
|
|
182
|
-
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((
|
|
183
|
-
|
|
180
|
+
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(R, { type: c == null ? void 0 : c._type }) }),
|
|
181
|
+
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((m = t.node.data) == null ? void 0 : m._name) || t.node.text }),
|
|
182
|
+
d ? /* @__PURE__ */ e.jsxs(
|
|
184
183
|
"span",
|
|
185
184
|
{
|
|
186
185
|
className: "ml-2 flex items-center text-[10px] italic " + (r ? "text-gray-200" : "text-gray-500"),
|
|
187
186
|
children: [
|
|
188
187
|
"(",
|
|
189
|
-
|
|
188
|
+
d,
|
|
190
189
|
")"
|
|
191
190
|
]
|
|
192
191
|
}
|
|
@@ -196,86 +195,55 @@ const Ze = (t) => {
|
|
|
196
195
|
}
|
|
197
196
|
)
|
|
198
197
|
);
|
|
199
|
-
},
|
|
198
|
+
}, Fe = (t) => {
|
|
200
199
|
var o;
|
|
201
200
|
const { item: s } = t.monitorProps;
|
|
202
201
|
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: [
|
|
203
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(
|
|
202
|
+
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(R, { type: (o = s == null ? void 0 : s.data) == null ? void 0 : o._type }) }),
|
|
204
203
|
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: s.text })
|
|
205
204
|
] });
|
|
206
|
-
},
|
|
205
|
+
}, $e = (t) => {
|
|
207
206
|
const s = t.depth * 10 + 16;
|
|
208
207
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: s } });
|
|
209
|
-
},
|
|
210
|
-
const [t] =
|
|
211
|
-
return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
|
|
212
|
-
/* @__PURE__ */ e.jsx(xe, {}),
|
|
213
|
-
" Cut"
|
|
214
|
-
] });
|
|
215
|
-
}, rt = () => {
|
|
216
|
-
const [t] = x(), [, s] = we();
|
|
217
|
-
return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
|
|
218
|
-
/* @__PURE__ */ e.jsx(de, {}),
|
|
219
|
-
" Copy"
|
|
220
|
-
] });
|
|
221
|
-
}, at = () => {
|
|
222
|
-
const [t] = x(), s = Se(), o = Te();
|
|
208
|
+
}, Ke = () => {
|
|
209
|
+
const [t] = p(), s = ye(), o = S();
|
|
223
210
|
return /* @__PURE__ */ e.jsxs(
|
|
224
|
-
|
|
211
|
+
N,
|
|
225
212
|
{
|
|
226
|
-
disabled: (o == null ? void 0 : o._type)
|
|
213
|
+
disabled: !ke(o == null ? void 0 : o._type),
|
|
227
214
|
className: "flex items-center gap-x-4 text-xs",
|
|
228
215
|
onClick: () => s(t),
|
|
229
216
|
children: [
|
|
230
|
-
/* @__PURE__ */ e.jsx(
|
|
217
|
+
/* @__PURE__ */ e.jsx(xe, {}),
|
|
231
218
|
" Remove"
|
|
232
219
|
]
|
|
233
220
|
}
|
|
234
221
|
);
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
r(o);
|
|
241
|
-
}, [o, r]);
|
|
242
|
-
return /* @__PURE__ */ e.jsxs(Oe, { className: "text-xs", children: [
|
|
243
|
-
d && /* @__PURE__ */ e.jsx(i, { className: "flex items-center gap-x-4 border-b text-xs", onClick: s, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-4", children: [
|
|
244
|
-
/* @__PURE__ */ e.jsx(pe, {}),
|
|
245
|
-
" Mark as global"
|
|
246
|
-
] }) }),
|
|
247
|
-
/* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: m, children: [
|
|
248
|
-
/* @__PURE__ */ e.jsx(ue, {}),
|
|
249
|
-
" Duplicate"
|
|
250
|
-
] }),
|
|
251
|
-
/* @__PURE__ */ e.jsx(nt, {}),
|
|
252
|
-
/* @__PURE__ */ e.jsx(rt, {}),
|
|
222
|
+
}, Ue = () => {
|
|
223
|
+
const [t] = p(), s = Be(), o = S(), r = Me(() => {
|
|
224
|
+
s(t);
|
|
225
|
+
}, [t, s]);
|
|
226
|
+
return /* @__PURE__ */ e.jsxs(ve, { className: "text-xs", children: [
|
|
253
227
|
/* @__PURE__ */ e.jsxs(
|
|
254
|
-
|
|
228
|
+
N,
|
|
255
229
|
{
|
|
230
|
+
disabled: !we(o == null ? void 0 : o._type),
|
|
256
231
|
className: "flex items-center gap-x-4 text-xs",
|
|
257
|
-
onClick:
|
|
258
|
-
disabled: !c,
|
|
232
|
+
onClick: r,
|
|
259
233
|
children: [
|
|
260
|
-
/* @__PURE__ */ e.jsx(
|
|
261
|
-
"
|
|
234
|
+
/* @__PURE__ */ e.jsx(de, {}),
|
|
235
|
+
" Duplicate"
|
|
262
236
|
]
|
|
263
237
|
}
|
|
264
238
|
),
|
|
265
|
-
/* @__PURE__ */ e.jsx(
|
|
239
|
+
/* @__PURE__ */ e.jsx(Ke, {})
|
|
266
240
|
] });
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
/* @__PURE__ */ e.jsx(ct, { id: s, openMarkAsGlobalModal: () => r(!0) })
|
|
274
|
-
] })
|
|
275
|
-
] });
|
|
276
|
-
};
|
|
277
|
-
function it(t) {
|
|
278
|
-
return S(t, (s) => {
|
|
241
|
+
}, Ye = ({ children: t }) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(Ce, { children: [
|
|
242
|
+
/* @__PURE__ */ e.jsx(Te, { children: t }),
|
|
243
|
+
/* @__PURE__ */ e.jsx(Ue, {})
|
|
244
|
+
] }) });
|
|
245
|
+
function Qe(t) {
|
|
246
|
+
return C(t, (s) => {
|
|
279
247
|
const { data: o } = s;
|
|
280
248
|
return {
|
|
281
249
|
...o,
|
|
@@ -283,15 +251,15 @@ function it(t) {
|
|
|
283
251
|
};
|
|
284
252
|
});
|
|
285
253
|
}
|
|
286
|
-
function
|
|
287
|
-
const [t] =
|
|
288
|
-
return t ?
|
|
254
|
+
function Ze() {
|
|
255
|
+
const [t] = O(), [s, o] = p();
|
|
256
|
+
return t ? /* @__PURE__ */ e.jsxs(
|
|
289
257
|
"div",
|
|
290
258
|
{
|
|
291
259
|
onClick: (r) => {
|
|
292
260
|
r.stopPropagation(), o(["container"]);
|
|
293
261
|
},
|
|
294
|
-
className:
|
|
262
|
+
className: I(
|
|
295
263
|
"flex items-center pl-2 text-xs",
|
|
296
264
|
T(s, "container") ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
|
|
297
265
|
),
|
|
@@ -301,98 +269,97 @@ function xt() {
|
|
|
301
269
|
t._type
|
|
302
270
|
]
|
|
303
271
|
}
|
|
304
|
-
)
|
|
272
|
+
) : null;
|
|
305
273
|
}
|
|
306
|
-
const
|
|
307
|
-
const t =
|
|
308
|
-
const { dragSource:
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
const A = it(n);
|
|
274
|
+
const Gt = () => {
|
|
275
|
+
const [t] = De(), { setNewBlocks: s } = Se(), [o, r, a] = p(), [, c] = Ne(), { t: u } = be(), g = He(), x = Le(), [d] = O(), m = async (n, l) => {
|
|
276
|
+
const { dragSource: h, relativeIndex: b, dropTargetId: f, monitor: y } = l;
|
|
277
|
+
if (h) {
|
|
278
|
+
const A = Qe(n);
|
|
312
279
|
s(A);
|
|
313
280
|
const H = y.getItem();
|
|
314
281
|
r([H.id]);
|
|
315
282
|
} else
|
|
316
|
-
await
|
|
317
|
-
},
|
|
283
|
+
await x({ block: y.getItem(), dropTargetId: f, relativeIndex: b });
|
|
284
|
+
}, i = C(t, (n) => ({
|
|
318
285
|
id: n._id,
|
|
319
286
|
text: n._type,
|
|
320
287
|
parent: n._parent || 0,
|
|
321
|
-
droppable: !
|
|
288
|
+
droppable: !P(V(t, { _parent: n._id })),
|
|
322
289
|
data: n
|
|
323
|
-
})),
|
|
290
|
+
})), _ = () => {
|
|
324
291
|
r([]), c([]);
|
|
325
|
-
}, [{ isOver:
|
|
292
|
+
}, [{ isOver: j }, E] = ue(() => ({
|
|
326
293
|
accept: ["CHAI_BLOCK"],
|
|
327
294
|
collect: (n) => ({
|
|
328
295
|
canDrop: n.canDrop(),
|
|
329
296
|
isOver: n.isOver()
|
|
330
297
|
}),
|
|
331
298
|
drop: (n) => {
|
|
332
|
-
(async () => await
|
|
299
|
+
(async () => await x({
|
|
333
300
|
block: n,
|
|
334
301
|
dropTargetId: "",
|
|
335
302
|
relativeIndex: 0
|
|
336
303
|
}))();
|
|
337
304
|
}
|
|
338
|
-
})), { isDragging:
|
|
305
|
+
})), { isDragging: M } = ge((n) => ({
|
|
339
306
|
isDragging: n.isDragging()
|
|
340
307
|
}));
|
|
341
308
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
|
|
342
309
|
"div",
|
|
343
310
|
{
|
|
344
|
-
onClick: () =>
|
|
345
|
-
className:
|
|
311
|
+
onClick: () => _(),
|
|
312
|
+
className: I(
|
|
346
313
|
"-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",
|
|
347
|
-
|
|
314
|
+
M ? "bg-green-50/80" : "bg-background"
|
|
348
315
|
),
|
|
349
|
-
children:
|
|
316
|
+
children: z(t) ? /* @__PURE__ */ e.jsxs(
|
|
350
317
|
"div",
|
|
351
318
|
{
|
|
352
|
-
ref:
|
|
353
|
-
className: `mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${
|
|
319
|
+
ref: E,
|
|
320
|
+
className: `mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${j ? "bg-blue-200" : ""}`,
|
|
354
321
|
children: [
|
|
355
|
-
|
|
356
|
-
/* @__PURE__ */ e.jsx("p", { className: "mt-2", children:
|
|
322
|
+
j ? /* @__PURE__ */ e.jsx(me, { className: "mx-auto h-12 w-12 animate-bounce" }) : /* @__PURE__ */ e.jsx(pe, { className: "mx-auto h-10 w-10" }),
|
|
323
|
+
/* @__PURE__ */ e.jsx("p", { className: "mt-2", children: u(j ? "drop_here_message" : "tree_view_no_blocks") })
|
|
357
324
|
]
|
|
358
325
|
}
|
|
359
|
-
) : /* @__PURE__ */ e.jsxs(
|
|
360
|
-
/* @__PURE__ */ e.jsx(
|
|
326
|
+
) : /* @__PURE__ */ e.jsxs(Oe, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: [
|
|
327
|
+
/* @__PURE__ */ e.jsx(Ze, {}),
|
|
361
328
|
/* @__PURE__ */ e.jsx(
|
|
362
|
-
|
|
329
|
+
he,
|
|
363
330
|
{
|
|
364
|
-
initialOpen:
|
|
331
|
+
initialOpen: g,
|
|
365
332
|
extraAcceptTypes: ["CHAI_BLOCK"],
|
|
366
|
-
tree:
|
|
333
|
+
tree: i,
|
|
367
334
|
rootId: 0,
|
|
368
|
-
render: (n, { depth:
|
|
369
|
-
|
|
335
|
+
render: (n, { depth: l, isOpen: h, onToggle: b }) => /* @__PURE__ */ e.jsx(Ye, { id: n.id, children: /* @__PURE__ */ e.jsx(
|
|
336
|
+
ze,
|
|
370
337
|
{
|
|
371
|
-
onSelect: (
|
|
372
|
-
c([]), r([
|
|
338
|
+
onSelect: (f) => {
|
|
339
|
+
c([]), r([f]);
|
|
373
340
|
},
|
|
374
341
|
isSelected: T(o, n.id),
|
|
375
342
|
node: n,
|
|
376
|
-
depth:
|
|
377
|
-
isOpen:
|
|
378
|
-
onToggle:
|
|
343
|
+
depth: l,
|
|
344
|
+
isOpen: h,
|
|
345
|
+
onToggle: b,
|
|
379
346
|
toggleIds: a
|
|
380
347
|
}
|
|
381
348
|
) }),
|
|
382
|
-
dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(
|
|
383
|
-
onDrop:
|
|
349
|
+
dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(Fe, { monitorProps: n }),
|
|
350
|
+
onDrop: m,
|
|
384
351
|
classes: {
|
|
385
|
-
root: "h-[90%] " + (
|
|
352
|
+
root: "h-[90%] " + (d ? "pl-2" : "pt-2"),
|
|
386
353
|
draggingSource: "opacity-30",
|
|
387
354
|
dropTarget: "bg-green-100",
|
|
388
355
|
placeholder: "relative"
|
|
389
356
|
},
|
|
390
357
|
sort: !1,
|
|
391
358
|
insertDroppableFirst: !1,
|
|
392
|
-
canDrop:
|
|
359
|
+
canDrop: Re,
|
|
393
360
|
dropTargetOffset: 2,
|
|
394
361
|
enableAnimateExpand: !0,
|
|
395
|
-
placeholderRender: (n, { depth:
|
|
362
|
+
placeholderRender: (n, { depth: l }) => /* @__PURE__ */ e.jsx($e, { node: n, depth: l })
|
|
396
363
|
}
|
|
397
364
|
)
|
|
398
365
|
] })
|
|
@@ -400,5 +367,5 @@ const ps = () => {
|
|
|
400
367
|
) });
|
|
401
368
|
};
|
|
402
369
|
export {
|
|
403
|
-
|
|
370
|
+
Gt as default
|
|
404
371
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("lodash-es"),s=require("@radix-ui/react-icons"),y=require("react-dnd"),B=require("@minoru/react-dnd-treeview"),O=require("react-i18next"),n=require("./index-7ogwGh39.cjs"),N=require("lucide-react"),f=require("react"),M=require("./MODIFIERS-2FeVfZQ9.cjs"),q=require("./Functions-N3yhPYKY.cjs"),_=require("./index-xbQL0wpz.cjs"),A=require("./useAddBlockByDrop-nLzs79He.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const v=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(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function H(t=""){const r={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 u=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),a=t.match(u);if(x.nth(a,1))return`Visible >=${r[x.nth(a,1)]}`}return""}const L=t=>{let r="";return Object.keys(t).forEach(o=>{x.startsWith(t[o],M.STYLES_KEY)&&(r=t[o])}),r},P=t=>{var j;const[,r]=n.useHighlightBlockId(),[o]=n.useHiddenBlockIds(),{isSelected:c}=t,{id:u,data:a}=t.node,g=t.depth*10,R=l=>{l.stopPropagation(),t.onToggle(t.node.id)},m=B.useDragOver(u,t.isOpen,t.onToggle),p=f.useMemo(()=>{const l=L(t.node.data);return H(l)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>r(u),className:q.cn("group flex w-full items-center justify-between space-x-px py-px",c?"bg-blue-500 text-white":"text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:l=>{l.stopPropagation(),!o.includes(u)&&t.onSelect(u)},onContextMenu:()=>t.onSelect(u),style:{paddingInlineStart:g},...m,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:R,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(v,{type:a==null?void 0:a._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=t.node.data)==null?void 0:j._name)||t.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},F=t=>{var o;const{item:r}=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(v,{type:(o=r==null?void 0:r.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:r.text})]})},V=t=>{const r=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:r}})},z=()=>{const[t]=n.useSelectedBlockIds(),r=n.useRemoveBlocks(),o=n.useSelectedBlock();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:!n.canDeleteBlock(o==null?void 0:o._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},$=()=>{const[t]=n.useSelectedBlockIds(),r=n.useDuplicateBlocks(),o=n.useSelectedBlock(),c=f.useCallback(()=>{r(t)},[t,r]);return e.jsxRuntimeExports.jsxs(n.ContextMenuContent,{className:"text-xs",children:[e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:!n.canDuplicateBlock(o==null?void 0:o._type),className:"flex items-center gap-x-4 text-xs",onClick:c,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(z,{})]})},K=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(n.ContextMenu,{children:[e.jsxRuntimeExports.jsx(n.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx($,{})]})});function U(t){return x.map(t,r=>{const{data:o}=r;return{...o,_parent:r.parent===0?null:r.parent}})}function Q(){const[t]=n.useBlocksContainer(),[r,o]=n.useSelectedBlockIds();return t?e.jsxRuntimeExports.jsxs("div",{onClick:c=>{c.stopPropagation(),o(["container"])},className:q.cn("flex items-center pl-2 text-xs",x.includes(r,"container")?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),children:[e.jsxRuntimeExports.jsx(s.BoxIcon,{})," ",t._type]}):null}const Y=()=>{const[t]=n.useBlocksStore(),{setNewBlocks:r}=n.useBlocksStoreUndoableActions(),[o,c,u]=n.useSelectedBlockIds(),[,a]=n.useSelectedStylingBlocks(),{t:g}=O.useTranslation(),R=_.useExpandedIds(),m=A.useAddBlockByDrop(),[p]=n.useBlocksContainer(),j=async(i,d)=>{const{dragSource:h,relativeIndex:I,dropTargetId:b,monitor:k}=d;if(h){const D=U(i);r(D);const T=k.getItem();c([T.id])}else await m({block:k.getItem(),dropTargetId:b,relativeIndex:I})},l=x.map(t,i=>({id:i._id,text:i._type,parent:i._parent||0,droppable:!x.isUndefined(x.find(t,{_parent:i._id})),data:i})),w=()=>{c([]),a([])},[{isOver:E},C]=y.useDrop(()=>({accept:["CHAI_BLOCK"],collect:i=>({canDrop:i.canDrop(),isOver:i.isOver()}),drop:i=>{(async()=>await m({block:i,dropTargetId:"",relativeIndex:0}))()}})),{isDragging:S}=y.useDragLayer(i=>({isDragging:i.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>w(),className:q.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",S?"bg-green-50/80":"bg-background"),children:x.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:C,className:`mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${E?"bg-blue-200":""}`,children:[E?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:g(E?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsxs(n.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:[e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(B.Tree,{initialOpen:R,extraAcceptTypes:["CHAI_BLOCK"],tree:l,rootId:0,render:(i,{depth:d,isOpen:h,onToggle:I})=>e.jsxRuntimeExports.jsx(K,{id:i.id,children:e.jsxRuntimeExports.jsx(P,{onSelect:b=>{a([]),c([b])},isSelected:x.includes(o,i.id),node:i,depth:d,isOpen:h,onToggle:I,toggleIds:u})}),dragPreviewRender:i=>e.jsxRuntimeExports.jsx(F,{monitorProps:i}),onDrop:j,classes:{root:"h-[90%] "+(p?"pl-2":"pt-2"),draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:n.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(i,{depth:d})=>e.jsxRuntimeExports.jsx(V,{node:i,depth:d})})]})})})};exports.default=Y;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import i, { Suspense as s } from "react";
|
|
3
3
|
import { sortBy as a, filter as d, get as n } from "lodash-es";
|
|
4
|
-
import { a as l, b as c } from "./index-
|
|
4
|
+
import { a as l, b as c } from "./index-c2VLKuhY.js";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "i18next";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-B4sL0YTN.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-AvyFzbPC.js";
|
|
@@ -39,7 +39,6 @@ import "flat-to-nested";
|
|
|
39
39
|
import "./Functions-7jnEwJyw.js";
|
|
40
40
|
import "redux-undo";
|
|
41
41
|
import "@chaibuilder/runtime";
|
|
42
|
-
import "lodash";
|
|
43
42
|
import "@react-hookz/web";
|
|
44
43
|
import "@floating-ui/react-dom";
|
|
45
44
|
import "react-textarea-autosize";
|
|
@@ -53,7 +52,7 @@ import "himalaya";
|
|
|
53
52
|
import "lucide-react";
|
|
54
53
|
import "./web-blocks.js";
|
|
55
54
|
import "./controls-XPXGHKht.js";
|
|
56
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
55
|
+
const x = i.lazy(() => import("./add-page-modal-FJEAqfD3.js")), g = i.lazy(() => import("./page-viewer-TcK0I240.js")), ut = () => {
|
|
57
56
|
const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
|
|
58
57
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
59
58
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
|
|
@@ -65,5 +64,5 @@ const x = i.lazy(() => import("./add-page-modal-cm8damU2.js")), g = i.lazy(() =>
|
|
|
65
64
|
] });
|
|
66
65
|
};
|
|
67
66
|
export {
|
|
68
|
-
|
|
67
|
+
ut as default
|
|
69
68
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-xbQL0wpz.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("i18next");require("react-i18next");require("./index-7ogwGh39.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-In6XI-vZ.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-SfQUe0SI.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"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(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
|