@chaibuilder/sdk 1.2.34 → 1.2.36
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-RmEkZXdE.js → AddBlocks-NSDb7WP1.js} +6 -6
- package/dist/{AddBlocks-XYCWUol8.cjs → AddBlocks-_wOcyJY6.cjs} +1 -1
- package/dist/{BrandingOptions-qnaKl27s.cjs → BrandingOptions-D0NIsUGf.cjs} +1 -1
- package/dist/{BrandingOptions-TnzCIC7A.js → BrandingOptions-cTHORxqQ.js} +1 -1
- package/dist/{CanvasArea-SeSRWHy0.js → CanvasArea-6nE635uC.js} +4 -4
- package/dist/{CanvasArea-iIwERFUC.cjs → CanvasArea-D1TUKvIF.cjs} +2 -2
- package/dist/{ChaiBuilderEditor-y1NxvXJ7.js → ChaiBuilderEditor-rPo8yLDm.js} +22974 -22885
- package/dist/{ChaiBuilderEditor-YqEKonJ_.cjs → ChaiBuilderEditor-xecsXt0z.cjs} +68 -68
- package/dist/{CurrentPage-TNff16tH.cjs → CurrentPage-V5uHSGUJ.cjs} +1 -1
- package/dist/{CurrentPage-9KDre_9q.js → CurrentPage-qw0ucVmW.js} +3 -3
- package/dist/ListTree-8K5aSjSH.js +396 -0
- package/dist/ListTree-aamIu2qf.cjs +1 -0
- package/dist/{PagesPanel-jHMmJEtv.js → PagesPanel-31uE12Z7.js} +4 -4
- package/dist/{PagesPanel-5DRsqV-G.cjs → PagesPanel-RXZ-q8Ut.cjs} +1 -1
- package/dist/{ProjectPanel-CDnnGpVo.cjs → ProjectPanel-LMe85RwX.cjs} +1 -1
- package/dist/{ProjectPanel-uxhq_D3j.js → ProjectPanel-oYC1szxp.js} +4 -4
- package/dist/{Settings-nGnVavh4.cjs → Settings-eufW6-XQ.cjs} +1 -1
- package/dist/{Settings-yqZksAbO.js → Settings-o3wnp8uI.js} +2 -2
- package/dist/{SidePanels-33KNaSS3.cjs → SidePanels-bmrMhSWl.cjs} +1 -1
- package/dist/{SidePanels-1gwirESt.js → SidePanels-nIiJwfQ7.js} +2 -2
- package/dist/Topbar--8q83rcZ.js +133 -0
- package/dist/Topbar-CVXB8DGf.cjs +1 -0
- package/dist/{UnsplashImages-LLu2wFeN.js → UnsplashImages-SDBkrhpm.js} +4 -4
- package/dist/{UnsplashImages-lnz6NfSD.cjs → UnsplashImages-aOVqzTK6.cjs} +1 -1
- package/dist/{UploadImages-FtvaDyk9.js → UploadImages-e3dCOlqV.js} +1 -1
- package/dist/{UploadImages-3nl_4mDf.cjs → UploadImages-vGCEvksG.cjs} +1 -1
- package/dist/{add-page-modal-V9DTBMmY.js → add-page-modal-Co1d8dlm.js} +4 -4
- package/dist/{add-page-modal-sIZk552b.cjs → add-page-modal-VMs_u3IX.cjs} +1 -1
- package/dist/{confirm-alert-sI4pItIN.js → confirm-alert-N9xn7uVF.js} +1 -1
- package/dist/{confirm-alert-Uzq5XNGt.cjs → confirm-alert-t1ESMHKf.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-XrIpujav.js → delete-page-modal-GxRd1jPl.js} +3 -3
- package/dist/{delete-page-modal-UminFzYh.cjs → delete-page-modal-MK--z13p.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-dQQ2tTRZ.js → form-IoNGO0Ov.js} +1 -1
- package/dist/{form-q7lxaK3j.cjs → form-UuH4B151.cjs} +1 -1
- package/dist/html-to-json-VPWiWWGH.cjs +1 -0
- package/dist/{html-to-json-ZV4QjSww.js → html-to-json-Z6R2o_fA.js} +68 -76
- package/dist/{index-eYwpNzUl.cjs → index-Jy9Zfhj_.cjs} +1 -1
- package/dist/{index-OsS2_gM8.js → index-ntl3hbnf.js} +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{page-viewer-AoJ5HU6j.js → page-viewer-eIxEA6s_.js} +4 -4
- package/dist/{page-viewer-FzhqSyNO.cjs → page-viewer-inM0HSLv.cjs} +1 -1
- package/dist/{project-general-setting-WzJ8U1OW.cjs → project-general-setting-N_Cg6F3x.cjs} +1 -1
- package/dist/{project-general-setting-g3YJYszB.js → project-general-setting-VDnseYOn.js} +4 -4
- package/dist/{project-seo-setting-1sLmV-wv.js → project-seo-setting-9nwQDhti.js} +2 -2
- package/dist/{project-seo-setting-GuObNafp.cjs → project-seo-setting-crFlVR2_.cjs} +1 -1
- package/dist/{single-page-detail-sQ3BH6Rc.js → single-page-detail-DMm5KvFV.js} +5 -5
- package/dist/{single-page-detail-WGars7Tl.cjs → single-page-detail-W2AlRYUx.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +101 -101
- package/dist/{useCanvasSettings-QcsmJd9b.cjs → useCanvasSettings-W54LZ1wt.cjs} +1 -1
- package/dist/useCanvasSettings-zsHMTgls.js +6 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/ListTree-GxCAsv2Y.cjs +0 -1
- package/dist/ListTree-H2WaKwOs.js +0 -319
- package/dist/Topbar-NHF8D1di.js +0 -137
- package/dist/Topbar-Wwdd9Flx.cjs +0 -1
- package/dist/html-to-json-Xhu27KFD.cjs +0 -1
- package/dist/useCanvasSettings-XwFRrknO.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./ChaiBuilderEditor-xecsXt0z.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-Jy9Zfhj_.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");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-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-quill");require("react-hotkeys-hook");require("lodash");require("./core.cjs");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 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(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.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(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.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(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { V as h, a6 as f, a7 as j, a8 as y, a9 as v, aa as P } from "./ChaiBuilderEditor-
|
|
2
|
+
import { V as h, a6 as f, a7 as j, a8 as y, a9 as v, aa as P } from "./ChaiBuilderEditor-rPo8yLDm.js";
|
|
3
3
|
import { sortBy as b, filter as w, get as C, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
|
|
4
4
|
import { toast as k } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { a as B, u as E, c as T, d as V } from "./index-
|
|
6
|
+
import { a as B, u as E, c as T, d as V } from "./index-ntl3hbnf.js";
|
|
7
7
|
import { BriefcaseIcon as I } from "lucide-react";
|
|
8
8
|
import { useTranslation as L } from "react-i18next";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -46,7 +46,7 @@ import "react-quill";
|
|
|
46
46
|
import "react-hotkeys-hook";
|
|
47
47
|
import "lodash";
|
|
48
48
|
import "./core.js";
|
|
49
|
-
import "./html-to-json-
|
|
49
|
+
import "./html-to-json-Z6R2o_fA.js";
|
|
50
50
|
import "himalaya";
|
|
51
51
|
const Te = () => {
|
|
52
52
|
const { data: t } = B(), { data: i, isLoading: l } = E(), { saveState: c } = h(), d = T(), { t: u } = L(), [a, o] = V(), s = b(w(i, { type: "STATIC" }), (r) => C(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import React__default, { memo, useMemo, useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import { useAtom } from "jotai";
|
|
4
|
+
import { useDebouncedCallback } from "@react-hookz/web";
|
|
5
|
+
import { Tree } from "react-arborist";
|
|
6
|
+
import { i as useBlocksStore, L as useSelectedBlockIds, H as useRemoveBlocks, M as useSelectedBlock, bp as ContextMenuItem, aJ as canDeleteBlock, w as useDuplicateBlocks, bq as ContextMenuContent, aI as canDuplicateBlock, br as ContextMenu, bs as ContextMenuTrigger, h as useBuilderProp, z as useHighlightBlockId, bt as canAcceptChildBlock, ac as Tooltip, ad as TooltipTrigger, ae as TooltipContent, bu as treeDSBlocks, Q as useUpdateBlocksProps, Y as useSelectedStylingBlocks, aB as useBlocksStoreUndoableActions, aF as treeRefAtom } from "./ChaiBuilderEditor-rPo8yLDm.js";
|
|
7
|
+
import { c as cn } from "./Functions-7jnEwJyw.js";
|
|
8
|
+
import { BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, TrashIcon, CopyIcon, TriangleRightIcon } from "@radix-ui/react-icons";
|
|
9
|
+
import { DatabaseIcon } from "lucide-react";
|
|
10
|
+
import { find, first } from "lodash-es";
|
|
11
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "react-dom";
|
|
14
|
+
import "@radix-ui/react-scroll-area";
|
|
15
|
+
import "@floating-ui/react-dom";
|
|
16
|
+
import "i18next";
|
|
17
|
+
import "react-i18next";
|
|
18
|
+
import "flagged";
|
|
19
|
+
import "./STRINGS--j49GZJP.js";
|
|
20
|
+
import "@chaibuilder/runtime";
|
|
21
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
22
|
+
import "@radix-ui/react-toggle";
|
|
23
|
+
import "class-variance-authority";
|
|
24
|
+
import "./Class-6Hz2KzYb.js";
|
|
25
|
+
import "tailwind-merge";
|
|
26
|
+
import "@radix-ui/react-switch";
|
|
27
|
+
import "@radix-ui/react-slot";
|
|
28
|
+
import "@radix-ui/react-accordion";
|
|
29
|
+
import "@radix-ui/react-alert-dialog";
|
|
30
|
+
import "@radix-ui/react-dialog";
|
|
31
|
+
import "@radix-ui/react-label";
|
|
32
|
+
import "@radix-ui/react-tabs";
|
|
33
|
+
import "@radix-ui/react-tooltip";
|
|
34
|
+
import "@radix-ui/react-popover";
|
|
35
|
+
import "@radix-ui/react-menubar";
|
|
36
|
+
import "@radix-ui/react-hover-card";
|
|
37
|
+
import "@radix-ui/react-select";
|
|
38
|
+
import "@radix-ui/react-dropdown-menu";
|
|
39
|
+
import "@radix-ui/react-separator";
|
|
40
|
+
import "@radix-ui/react-toast";
|
|
41
|
+
import "cmdk";
|
|
42
|
+
import "@radix-ui/react-context-menu";
|
|
43
|
+
import "react-icons-picker";
|
|
44
|
+
import "react-quill";
|
|
45
|
+
import "react-hotkeys-hook";
|
|
46
|
+
import "lodash";
|
|
47
|
+
const TypeIcon = (t) => {
|
|
48
|
+
switch (t.type) {
|
|
49
|
+
case "Image":
|
|
50
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ImageIcon, {});
|
|
51
|
+
case "Heading":
|
|
52
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingIcon, {});
|
|
53
|
+
case "Text":
|
|
54
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TextIcon, {});
|
|
55
|
+
case "Link":
|
|
56
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link1Icon, {});
|
|
57
|
+
case "Video":
|
|
58
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(VideoIcon, {});
|
|
59
|
+
case "RichText":
|
|
60
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CursorTextIcon, {});
|
|
61
|
+
case "Button":
|
|
62
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonIcon, {});
|
|
63
|
+
case "CustomHTML":
|
|
64
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CodeIcon, {});
|
|
65
|
+
case "Divider":
|
|
66
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DividerHorizontalIcon, {});
|
|
67
|
+
case "Icon":
|
|
68
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SketchLogoIcon, {});
|
|
69
|
+
case "List":
|
|
70
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RowsIcon, {});
|
|
71
|
+
case "Paragraph":
|
|
72
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TextIcon, {});
|
|
73
|
+
case "Row":
|
|
74
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RowsIcon, {});
|
|
75
|
+
case "ListItem":
|
|
76
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnsIcon, {});
|
|
77
|
+
case "LineBreak":
|
|
78
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SpaceBetweenVerticallyIcon, {});
|
|
79
|
+
case "Form":
|
|
80
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(GroupIcon, {});
|
|
81
|
+
case "Checkbox":
|
|
82
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIcon, {});
|
|
83
|
+
case "FormButton":
|
|
84
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonIcon, {});
|
|
85
|
+
case "Input":
|
|
86
|
+
case "TextArea":
|
|
87
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InputIcon, {});
|
|
88
|
+
case "Radio":
|
|
89
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RadiobuttonIcon, {});
|
|
90
|
+
case "Select":
|
|
91
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuIcon, {});
|
|
92
|
+
case "Table":
|
|
93
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableIcon, {});
|
|
94
|
+
case "TableHead":
|
|
95
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BorderTopIcon, {});
|
|
96
|
+
case "TableBody":
|
|
97
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BorderAllIcon, {});
|
|
98
|
+
case "TableRow":
|
|
99
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ViewHorizontalIcon, {});
|
|
100
|
+
case "TableCell":
|
|
101
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandleHorizontalIcon, {});
|
|
102
|
+
case "DataProvider":
|
|
103
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DatabaseIcon, { size: 16 });
|
|
104
|
+
case "Box":
|
|
105
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BoxIcon, {});
|
|
106
|
+
default:
|
|
107
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BoxModelIcon, {});
|
|
108
|
+
}
|
|
109
|
+
}, placeholderStyle = {
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
zIndex: 1
|
|
113
|
+
}, DefaultCursor = React__default.memo(function({ top: n, left: o }) {
|
|
114
|
+
const r = {
|
|
115
|
+
position: "absolute",
|
|
116
|
+
pointerEvents: "none",
|
|
117
|
+
top: n + "px",
|
|
118
|
+
left: o + "px",
|
|
119
|
+
right: 0
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...placeholderStyle, ...r }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0.5 flex-1 rounded-[1px] bg-green-500" }) });
|
|
122
|
+
}), Overlay = memo(function({ children: n, isDragging: o }) {
|
|
123
|
+
return o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pointer-events-none fixed left-0 top-0 z-[100] h-full w-full", children: n }) : null;
|
|
124
|
+
}), DefaultDragPreview = memo(({ id: t, isDragging: n, mouse: o }) => {
|
|
125
|
+
const [r] = useBlocksStore(), c = useMemo(() => r.find((a) => a._id === t), [r, t]), u = useMemo(
|
|
126
|
+
() => ({
|
|
127
|
+
transform: `translate(${(o == null ? void 0 : o.x) - 10}px, ${(o == null ? void 0 : o.y) - 10}px)`
|
|
128
|
+
}),
|
|
129
|
+
[o]
|
|
130
|
+
);
|
|
131
|
+
return o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { isDragging: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: "pointer-events-none absolute z-50 rounded border border-gray-200 bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",
|
|
135
|
+
style: u,
|
|
136
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex !cursor-grab items-center p-0.5", "aria-label": `Type: ${c == null ? void 0 : c._type}`, children: [
|
|
137
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: c == null ? void 0 : c._type }) }),
|
|
138
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-2 truncate text-[11px]", children: (c == null ? void 0 : c._name) || (c == null ? void 0 : c._type) })
|
|
139
|
+
] })
|
|
140
|
+
}
|
|
141
|
+
) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden" });
|
|
142
|
+
}), RemoveBlocks = () => {
|
|
143
|
+
const [t] = useSelectedBlockIds(), n = useRemoveBlocks(), o = useSelectedBlock();
|
|
144
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
145
|
+
ContextMenuItem,
|
|
146
|
+
{
|
|
147
|
+
disabled: !canDeleteBlock(o == null ? void 0 : o._type),
|
|
148
|
+
className: "flex items-center gap-x-4 text-xs",
|
|
149
|
+
onClick: () => n(t),
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TrashIcon, {}),
|
|
152
|
+
" Remove"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}, BlockContextMenuContent = () => {
|
|
157
|
+
const [t] = useSelectedBlockIds(), n = useDuplicateBlocks(), o = useSelectedBlock(), r = useCallback(() => {
|
|
158
|
+
n(t);
|
|
159
|
+
}, [t, n]);
|
|
160
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenuContent, { className: "text-xs", children: [
|
|
161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
162
|
+
ContextMenuItem,
|
|
163
|
+
{
|
|
164
|
+
disabled: !canDuplicateBlock(o == null ? void 0 : o._type),
|
|
165
|
+
className: "flex items-center gap-x-4 text-xs",
|
|
166
|
+
onClick: r,
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, {}),
|
|
169
|
+
" Duplicate"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveBlocks, {})
|
|
174
|
+
] });
|
|
175
|
+
}, BlockContextMenu = ({ children: t }) => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenu, { children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger, { children: t }),
|
|
177
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenuContent, {})
|
|
178
|
+
] }) }), defaultShortcuts = [
|
|
179
|
+
{ key: "ArrowDown", command: "selectNext" },
|
|
180
|
+
{ key: "ArrowUp", command: "selectPrev" },
|
|
181
|
+
{ key: "ArrowLeft", command: "selectParent", when: "isLeaf || isClosed" },
|
|
182
|
+
{ key: "ArrowLeft", command: "close", when: "isOpen" },
|
|
183
|
+
{ key: "ArrowRight", command: "open", when: "isClosed" },
|
|
184
|
+
{ key: "ArrowRight", command: "selectNext", when: "isOpen" },
|
|
185
|
+
{ key: "Home", command: "selectFirst" },
|
|
186
|
+
{ key: "End", command: "selectLast" }
|
|
187
|
+
];
|
|
188
|
+
function selectFirst(t) {
|
|
189
|
+
t.firstNode && t.select(t.firstNode.id);
|
|
190
|
+
}
|
|
191
|
+
function selectLast(t) {
|
|
192
|
+
t.lastNode && t.select(t.lastNode.id);
|
|
193
|
+
}
|
|
194
|
+
function selectNext(t) {
|
|
195
|
+
const n = t.selectedNodes[0].next || t.firstNode;
|
|
196
|
+
t.select(n.id);
|
|
197
|
+
}
|
|
198
|
+
function selectPrev(t) {
|
|
199
|
+
const n = t.selectedNodes[0].prev || t.lastNode;
|
|
200
|
+
t.select(n.id);
|
|
201
|
+
}
|
|
202
|
+
const selectParent = (t, n) => {
|
|
203
|
+
const o = t.selectedIds[0].parent;
|
|
204
|
+
o && n && t.select(o.id);
|
|
205
|
+
}, open = (t, n) => {
|
|
206
|
+
const o = t.selectedNodes[0];
|
|
207
|
+
o.isInternal && n && o.open();
|
|
208
|
+
}, close = (t, n) => {
|
|
209
|
+
const o = t.selectedNodes[0];
|
|
210
|
+
o.isInternal && n && o.close();
|
|
211
|
+
}, Node = memo(({ node: t, style: n, dragHandle: o }) => {
|
|
212
|
+
const r = useBuilderProp("outlineMenuItems", []), [, c] = useHighlightBlockId(), u = t.children.length > 0, { id: a, data: i, isSelected: p, willReceiveDrop: x, isDragging: d, isEditing: m, handleClick: j } = t, f = useDebouncedCallback((l) => c(l), [], 300), R = (l) => {
|
|
213
|
+
l.stopPropagation(), t.toggle();
|
|
214
|
+
}, h = (l) => {
|
|
215
|
+
l.stopPropagation(), t.isOpen || t.toggle(), j(l);
|
|
216
|
+
};
|
|
217
|
+
return useEffect(() => {
|
|
218
|
+
const l = setTimeout(() => {
|
|
219
|
+
x && !t.isOpen && t.toggle();
|
|
220
|
+
}, 500);
|
|
221
|
+
return () => clearTimeout(l);
|
|
222
|
+
}, [x, t]), /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: a, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
onClick: h,
|
|
226
|
+
onMouseEnter: () => f(a),
|
|
227
|
+
style: n,
|
|
228
|
+
"data-node-id": a,
|
|
229
|
+
ref: o,
|
|
230
|
+
className: cn(
|
|
231
|
+
"group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",
|
|
232
|
+
p ? "bg-blue-500 text-white" : "text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
233
|
+
x && canAcceptChildBlock(i._type, "Icon") ? "bg-green-200" : "",
|
|
234
|
+
d && "opacity-20"
|
|
235
|
+
),
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
238
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
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" : ""}`,
|
|
242
|
+
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: R, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
246
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: i == null ? void 0 : i._type }) }),
|
|
247
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: t }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
className: "ml-2 truncate text-[11px]",
|
|
251
|
+
onDoubleClick: (l) => {
|
|
252
|
+
l.stopPropagation(), t.edit(), t.deselect();
|
|
253
|
+
},
|
|
254
|
+
children: (i == null ? void 0 : i._name) || (i == null ? void 0 : i._type.split("/").pop())
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] })
|
|
258
|
+
] }),
|
|
259
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: r.map((l) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
260
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
261
|
+
TooltipTrigger,
|
|
262
|
+
{
|
|
263
|
+
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
264
|
+
asChild: !0,
|
|
265
|
+
children: React__default.createElement(l.item, { blockId: a })
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "z-[9999]", children: l.tooltip })
|
|
269
|
+
] })) })
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
) });
|
|
273
|
+
}), Input = ({ node: t }) => {
|
|
274
|
+
var n, o;
|
|
275
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
276
|
+
"input",
|
|
277
|
+
{
|
|
278
|
+
autoFocus: !0,
|
|
279
|
+
className: "ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",
|
|
280
|
+
type: "text",
|
|
281
|
+
defaultValue: ((n = t.data) == null ? void 0 : n._name) || ((o = t.data) == null ? void 0 : o._type),
|
|
282
|
+
onFocus: (r) => r.currentTarget.select(),
|
|
283
|
+
onBlur: (r) => t.submit(r.currentTarget.value),
|
|
284
|
+
onKeyDown: (r) => {
|
|
285
|
+
r.key === "Enter" && t.submit(r.currentTarget.value);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}, useCanMove = () => {
|
|
290
|
+
const [t] = useBlocksStore();
|
|
291
|
+
return (n, o) => {
|
|
292
|
+
var u;
|
|
293
|
+
const r = (u = find(t, { _id: o })) == null ? void 0 : u._type, c = first(n.map((a) => {
|
|
294
|
+
var i;
|
|
295
|
+
return (i = find(t, { _id: a })) == null ? void 0 : i._type;
|
|
296
|
+
}));
|
|
297
|
+
return canAcceptChildBlock(r, c);
|
|
298
|
+
};
|
|
299
|
+
}, ListTree = () => {
|
|
300
|
+
const [treeData] = useAtom(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom(treeRefAtom), clearSelection = () => {
|
|
301
|
+
setIds([]), setStyleBlocks([]);
|
|
302
|
+
};
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
setTreeRef(treeRef.current);
|
|
305
|
+
}, [treeRef.current]);
|
|
306
|
+
const onRename = ({ id: t, name: n, node: o }) => {
|
|
307
|
+
updateBlockProps([t], { _name: n }, o.data._name);
|
|
308
|
+
}, onMove = ({ dragIds: t, parentId: n, index: o }) => {
|
|
309
|
+
canMove(t, n) && moveBlocks(t, n, o);
|
|
310
|
+
}, onSelect = (t) => {
|
|
311
|
+
if (t.length === 0)
|
|
312
|
+
return;
|
|
313
|
+
const n = t[0] ? t[0].id : "";
|
|
314
|
+
setStyleBlocks([]), setIds([n]);
|
|
315
|
+
}, onContextMenu = (t) => {
|
|
316
|
+
var r;
|
|
317
|
+
t.preventDefault();
|
|
318
|
+
const n = t.target, o = n.getAttribute("data-node-id") || ((r = n.closest("[data-node-id]")) == null ? void 0 : r.getAttribute("data-node-id"));
|
|
319
|
+
o && (setStyleBlocks([]), setIds([o]));
|
|
320
|
+
}, debouncedDisableDrop = useDebouncedCallback(
|
|
321
|
+
({ parentNode: t, dragNodes: n }) => {
|
|
322
|
+
var o;
|
|
323
|
+
return !canAcceptChildBlock(t == null ? void 0 : t.data._type, (o = n[0]) == null ? void 0 : o.data._type);
|
|
324
|
+
},
|
|
325
|
+
[],
|
|
326
|
+
300
|
|
327
|
+
), handleKeyDown = (e) => {
|
|
328
|
+
if (!treeRef.current)
|
|
329
|
+
return;
|
|
330
|
+
const tree = treeRef.current, selectedNode = tree.selectedNodes[0];
|
|
331
|
+
if (!selectedNode)
|
|
332
|
+
return;
|
|
333
|
+
const isLeaf = !selectedNode.isInternal, isClosed = !selectedNode.isOpen, isOpen = selectedNode.isOpen, shortcut = defaultShortcuts.find((s) => s.key === e.key && (!s.when || eval(s.when)));
|
|
334
|
+
if (shortcut)
|
|
335
|
+
switch (e.preventDefault(), shortcut.command) {
|
|
336
|
+
case "selectNext":
|
|
337
|
+
selectNext(tree);
|
|
338
|
+
break;
|
|
339
|
+
case "selectPrev":
|
|
340
|
+
selectPrev(tree);
|
|
341
|
+
break;
|
|
342
|
+
case "selectParent":
|
|
343
|
+
selectParent(tree, isLeaf || isClosed);
|
|
344
|
+
break;
|
|
345
|
+
case "close":
|
|
346
|
+
close(tree, isOpen);
|
|
347
|
+
break;
|
|
348
|
+
case "open":
|
|
349
|
+
open(tree, isClosed);
|
|
350
|
+
break;
|
|
351
|
+
case "selectFirst":
|
|
352
|
+
selectFirst(tree);
|
|
353
|
+
break;
|
|
354
|
+
case "selectLast":
|
|
355
|
+
selectLast(tree);
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
return useEffect(() => {
|
|
362
|
+
if (ids[0] && treeRef.current) {
|
|
363
|
+
const t = treeRef.current.get(ids[0]);
|
|
364
|
+
t && t.select();
|
|
365
|
+
}
|
|
366
|
+
return window.addEventListener("keydown", handleKeyDown), () => {
|
|
367
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
368
|
+
};
|
|
369
|
+
}, [ids, treeRef]), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"), onClick: () => clearSelection(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "outline-view", className: "no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
370
|
+
Tree,
|
|
371
|
+
{
|
|
372
|
+
ref: treeRef,
|
|
373
|
+
height: 800,
|
|
374
|
+
className: "no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",
|
|
375
|
+
selection: ids[0] || "",
|
|
376
|
+
onRename,
|
|
377
|
+
openByDefault: !1,
|
|
378
|
+
onMove,
|
|
379
|
+
rowHeight: 20,
|
|
380
|
+
data: treeData,
|
|
381
|
+
renderCursor: DefaultCursor,
|
|
382
|
+
onSelect,
|
|
383
|
+
childrenAccessor: (t) => t.children,
|
|
384
|
+
width: "100%",
|
|
385
|
+
renderDragPreview: DefaultDragPreview,
|
|
386
|
+
indent: 10,
|
|
387
|
+
onContextMenu,
|
|
388
|
+
disableDrop: debouncedDisableDrop,
|
|
389
|
+
idAccessor: "_id",
|
|
390
|
+
children: Node
|
|
391
|
+
}
|
|
392
|
+
) }) });
|
|
393
|
+
};
|
|
394
|
+
export {
|
|
395
|
+
ListTree as default
|
|
396
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxRuntime=require("./jsx-runtime-Z_BpKhVy.cjs"),React=require("react"),jotai=require("jotai"),web=require("@react-hookz/web"),reactArborist=require("react-arborist"),ui=require("./ChaiBuilderEditor-xecsXt0z.cjs"),Functions=require("./Functions-N3yhPYKY.cjs"),reactIcons=require("@radix-ui/react-icons"),lucideReact=require("lucide-react"),lodashEs=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("@chaibuilder/runtime");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");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-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-quill");require("react-hotkeys-hook");require("lodash");const TypeIcon=t=>{switch(t.type){case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{});case"Button":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{size:16});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{})}},placeholderStyle={display:"flex",alignItems:"center",zIndex:1},DefaultCursor=React.memo(function({top:r,left:n}){const o={position:"absolute",pointerEvents:"none",top:r+"px",left:n+"px",right:0};return jsxRuntime.jsxRuntimeExports.jsx("div",{style:{...placeholderStyle,...o},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),Overlay=React.memo(function({children:r,isDragging:n}){return n?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:r}):null}),DefaultDragPreview=React.memo(({id:t,isDragging:r,mouse:n})=>{const[o]=ui.useBlocksStore(),i=React.useMemo(()=>o.find(x=>x._id===t),[o,t]),a=React.useMemo(()=>({transform:`translate(${(n==null?void 0:n.x)-10}px, ${(n==null?void 0:n.y)-10}px)`}),[n]);return n?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(Overlay,{isDragging:r,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute z-50 rounded border border-gray-200 bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",style:a,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${i==null?void 0:i._type}`,children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:i==null?void 0:i._type})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(i==null?void 0:i._name)||(i==null?void 0:i._type)})]})})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"hidden"})}),RemoveBlocks=()=>{const[t]=ui.useSelectedBlockIds(),r=ui.useRemoveBlocks(),n=ui.useSelectedBlock();return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDeleteBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TrashIcon,{})," Remove"]})},BlockContextMenuContent=()=>{const[t]=ui.useSelectedBlockIds(),r=ui.useDuplicateBlocks(),n=ui.useSelectedBlock(),o=React.useCallback(()=>{r(t)},[t,r]);return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuContent,{className:"text-xs",children:[jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDuplicateBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:o,children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{})," Duplicate"]}),jsxRuntime.jsxRuntimeExports.jsx(RemoveBlocks,{})]})},BlockContextMenu=({children:t})=>jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(ui.ContextMenuTrigger,{children:t}),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenuContent,{})]})}),defaultShortcuts=[{key:"ArrowDown",command:"selectNext"},{key:"ArrowUp",command:"selectPrev"},{key:"ArrowLeft",command:"selectParent",when:"isLeaf || isClosed"},{key:"ArrowLeft",command:"close",when:"isOpen"},{key:"ArrowRight",command:"open",when:"isClosed"},{key:"ArrowRight",command:"selectNext",when:"isOpen"},{key:"Home",command:"selectFirst"},{key:"End",command:"selectLast"}];function selectFirst(t){t.firstNode&&t.select(t.firstNode.id)}function selectLast(t){t.lastNode&&t.select(t.lastNode.id)}function selectNext(t){const r=t.selectedNodes[0].next||t.firstNode;t.select(r.id)}function selectPrev(t){const r=t.selectedNodes[0].prev||t.lastNode;t.select(r.id)}const selectParent=(t,r)=>{const n=t.selectedIds[0].parent;n&&r&&t.select(n.id)},open=(t,r)=>{const n=t.selectedNodes[0];n.isInternal&&r&&n.open()},close=(t,r)=>{const n=t.selectedNodes[0];n.isInternal&&r&&n.close()},Node=React.memo(({node:t,style:r,dragHandle:n})=>{const o=ui.useBuilderProp("outlineMenuItems",[]),[,i]=ui.useHighlightBlockId(),a=t.children.length>0,{id:x,data:c,isSelected:m,willReceiveDrop:l,isDragging:d,isEditing:j,handleClick:p}=t,R=web.useDebouncedCallback(u=>i(u),[],300),f=u=>{u.stopPropagation(),t.toggle()},h=u=>{u.stopPropagation(),t.isOpen||t.toggle(),p(u)};return React.useEffect(()=>{const u=setTimeout(()=>{l&&!t.isOpen&&t.toggle()},500);return()=>clearTimeout(u)},[l,t]),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenu,{id:x,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:h,onMouseEnter:()=>R(x),style:r,"data-node-id":x,ref:n,className:Functions.cn("group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",m?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",l&&ui.canAcceptChildBlock(c._type,"Icon")?"bg-green-200":"",d&&"opacity-20"),children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.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:a&&jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:f,type:"button",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleRightIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:c==null?void 0:c._type})}),j?jsxRuntime.jsxRuntimeExports.jsx(Input,{node:t}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",onDoubleClick:u=>{u.stopPropagation(),t.edit(),t.deselect()},children:(c==null?void 0:c._name)||(c==null?void 0:c._type.split("/").pop())})]})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:o.map(u=>jsxRuntime.jsxRuntimeExports.jsxs(ui.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(ui.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:React.createElement(u.item,{blockId:x})}),jsxRuntime.jsxRuntimeExports.jsx(ui.TooltipContent,{className:"z-[9999]",children:u.tooltip})]}))})]})})}),Input=({node:t})=>{var r,n;return jsxRuntime.jsxRuntimeExports.jsx("input",{autoFocus:!0,className:"ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",type:"text",defaultValue:((r=t.data)==null?void 0:r._name)||((n=t.data)==null?void 0:n._type),onFocus:o=>o.currentTarget.select(),onBlur:o=>t.submit(o.currentTarget.value),onKeyDown:o=>{o.key==="Enter"&&t.submit(o.currentTarget.value)}})},useCanMove=()=>{const[t]=ui.useBlocksStore();return(r,n)=>{var a;const o=(a=lodashEs.find(t,{_id:n}))==null?void 0:a._type,i=lodashEs.first(r.map(x=>{var c;return(c=lodashEs.find(t,{_id:x}))==null?void 0:c._type}));return ui.canAcceptChildBlock(o,i)}},ListTree=()=>{const[treeData]=jotai.useAtom(ui.treeDSBlocks),[ids,setIds]=ui.useSelectedBlockIds(),updateBlockProps=ui.useUpdateBlocksProps(),[,setStyleBlocks]=ui.useSelectedStylingBlocks(),{moveBlocks}=ui.useBlocksStoreUndoableActions(),canMove=useCanMove(),treeRef=React.useRef(null),[,setTreeRef]=jotai.useAtom(ui.treeRefAtom),clearSelection=()=>{setIds([]),setStyleBlocks([])};React.useEffect(()=>{setTreeRef(treeRef.current)},[treeRef.current]);const onRename=({id:t,name:r,node:n})=>{updateBlockProps([t],{_name:r},n.data._name)},onMove=({dragIds:t,parentId:r,index:n})=>{canMove(t,r)&&moveBlocks(t,r,n)},onSelect=t=>{if(t.length===0)return;const r=t[0]?t[0].id:"";setStyleBlocks([]),setIds([r])},onContextMenu=t=>{var o;t.preventDefault();const r=t.target,n=r.getAttribute("data-node-id")||((o=r.closest("[data-node-id]"))==null?void 0:o.getAttribute("data-node-id"));n&&(setStyleBlocks([]),setIds([n]))},debouncedDisableDrop=web.useDebouncedCallback(({parentNode:t,dragNodes:r})=>{var n;return!ui.canAcceptChildBlock(t==null?void 0:t.data._type,(n=r[0])==null?void 0:n.data._type)},[],300),handleKeyDown=e=>{if(!treeRef.current)return;const tree=treeRef.current,selectedNode=tree.selectedNodes[0];if(!selectedNode)return;const isLeaf=!selectedNode.isInternal,isClosed=!selectedNode.isOpen,isOpen=selectedNode.isOpen,shortcut=defaultShortcuts.find(s=>s.key===e.key&&(!s.when||eval(s.when)));if(shortcut)switch(e.preventDefault(),shortcut.command){case"selectNext":selectNext(tree);break;case"selectPrev":selectPrev(tree);break;case"selectParent":selectParent(tree,isLeaf||isClosed);break;case"close":close(tree,isOpen);break;case"open":open(tree,isClosed);break;case"selectFirst":selectFirst(tree);break;case"selectLast":selectLast(tree);break;default:break}};return React.useEffect(()=>{if(ids[0]&&treeRef.current){const t=treeRef.current.get(ids[0]);t&&t.select()}return window.addEventListener("keydown",handleKeyDown),()=>{window.removeEventListener("keydown",handleKeyDown)}},[ids,treeRef]),jsxRuntime.jsxRuntimeExports.jsx("div",{className:Functions.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"),onClick:()=>clearSelection(),children:jsxRuntime.jsxRuntimeExports.jsx("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx(reactArborist.Tree,{ref:treeRef,height:800,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:ids[0]||"",onRename,openByDefault:!1,onMove,rowHeight:20,data:treeData,renderCursor:DefaultCursor,onSelect,childrenAccessor:t=>t.children,width:"100%",renderDragPreview:DefaultDragPreview,indent:10,onContextMenu,disableDrop:debouncedDisableDrop,idAccessor:"_id",children:Node})})})};exports.default=ListTree;
|
|
@@ -1,10 +1,10 @@
|
|
|
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 { u as l, a as c } from "./index-
|
|
4
|
+
import { u as l, a as c } from "./index-ntl3hbnf.js";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "./core.js";
|
|
7
|
-
import "./ChaiBuilderEditor-
|
|
7
|
+
import "./ChaiBuilderEditor-rPo8yLDm.js";
|
|
8
8
|
import "clsx";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "@radix-ui/react-scroll-area";
|
|
@@ -46,9 +46,9 @@ import "react-hotkeys-hook";
|
|
|
46
46
|
import "lodash";
|
|
47
47
|
import "lucide-react";
|
|
48
48
|
import "sonner";
|
|
49
|
-
import "./html-to-json-
|
|
49
|
+
import "./html-to-json-Z6R2o_fA.js";
|
|
50
50
|
import "himalaya";
|
|
51
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
51
|
+
const x = i.lazy(() => import("./add-page-modal-Co1d8dlm.js")), u = i.lazy(() => import("./page-viewer-eIxEA6s_.js")), lt = () => {
|
|
52
52
|
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);
|
|
53
53
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
54
54
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
|
|
@@ -1 +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-
|
|
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-Jy9Zfhj_.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-xecsXt0z.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");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-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-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");require("sonner");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-VMs_u3IX.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-inM0HSLv.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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./ChaiBuilderEditor-xecsXt0z.cjs"),a=require("./index-Jy9Zfhj_.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");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-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-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");require("./core.cjs");require("sonner");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-N_Cg6F3x.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-crFlVR2_.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function q(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("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:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import m, { useRef as x, useEffect as a, Suspense as p } from "react";
|
|
3
3
|
import { isEqual as b, isEmpty as j } from "lodash-es";
|
|
4
|
-
import {
|
|
5
|
-
import { b as h, a as g } from "./index-
|
|
4
|
+
import { b3 as f, b4 as n, b5 as l, b6 as c } from "./ChaiBuilderEditor-rPo8yLDm.js";
|
|
5
|
+
import { b as h, a as g } from "./index-ntl3hbnf.js";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "react-dom";
|
|
@@ -46,9 +46,9 @@ import "lodash";
|
|
|
46
46
|
import "lucide-react";
|
|
47
47
|
import "./core.js";
|
|
48
48
|
import "sonner";
|
|
49
|
-
import "./html-to-json-
|
|
49
|
+
import "./html-to-json-Z6R2o_fA.js";
|
|
50
50
|
import "himalaya";
|
|
51
|
-
const N = m.lazy(() => import("./project-general-setting-
|
|
51
|
+
const N = m.lazy(() => import("./project-general-setting-VDnseYOn.js")), S = m.lazy(() => import("./project-seo-setting-9nwQDhti.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (e) => e && j(e.seoData) ? {
|
|
52
52
|
...e,
|
|
53
53
|
seoData: { title: "", description: "", image: "" }
|
|
54
54
|
} : e;
|