@chaibuilder/sdk 1.2.47 → 1.2.49
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-cX8vIt0V.js → AddBlocks-JCSA6hLF.js} +8 -8
- package/dist/{AddBlocks-_fhhS7Lm.cjs → AddBlocks-JiIeMTE-.cjs} +1 -1
- package/dist/{CanvasArea-N3rYeBJV.cjs → CanvasArea-K_d6ORTZ.cjs} +1 -1
- package/dist/{CanvasArea-HRipTJFS.js → CanvasArea-c3xbVSoY.js} +13 -13
- package/dist/{ChaiBuilderEditor-dKHRL-Es.js → ChaiBuilderEditor-F2yUJQdt.js} +1533 -1528
- package/dist/{ChaiBuilderEditor-EtQOC5uy.cjs → ChaiBuilderEditor-lqHQcnh3.cjs} +25 -25
- package/dist/{CurrentPage-U8ms8Hs7.js → CurrentPage--lDu6fB9.js} +2 -2
- package/dist/{CurrentPage-9FijxWbn.cjs → CurrentPage-DnQKF1wT.cjs} +1 -1
- package/dist/{ListTree-OgLdyfQs.js → ListTree-7DWSal1i.js} +120 -111
- package/dist/ListTree-HVFqaM0-.cjs +1 -0
- package/dist/{PagesPanel-MsUBq9Xx.js → PagesPanel-D1TOGyVE.js} +3 -3
- package/dist/{PagesPanel-8Cd6UYsh.cjs → PagesPanel-pIFhxLGC.cjs} +1 -1
- package/dist/{ProjectPanel-hsZG_Btj.js → ProjectPanel-PdvQsrbk.js} +3 -3
- package/dist/{ProjectPanel-KmnXPfxx.cjs → ProjectPanel-t7s3-URx.cjs} +1 -1
- package/dist/Settings-WevLeOpk.cjs +1 -0
- package/dist/{Settings-WcLqIeQy.js → Settings-aEcWAB0x.js} +268 -263
- package/dist/{SidePanels-6zRgfZpi.cjs → SidePanels-mavyE3q_.cjs} +1 -1
- package/dist/{SidePanels-PmCljlnf.js → SidePanels-uym8wfA0.js} +103 -110
- package/dist/{ThemeConfiguration-mkbFdePB.js → ThemeConfiguration-7J_Qt53c.js} +5 -5
- package/dist/{ThemeConfiguration-pt7TTAty.cjs → ThemeConfiguration-F-_ieF8J.cjs} +1 -1
- package/dist/{Topbar-FPywhpub.js → Topbar-DkbE0ccQ.js} +1 -1
- package/dist/{Topbar--m1E08Jl.cjs → Topbar-FjX_5927.cjs} +1 -1
- package/dist/UILibrariesPanel-3cSqwsMi.js +196 -0
- package/dist/UILibrariesPanel-qsjCsv10.cjs +1 -0
- package/dist/{UnsplashImages-Yu0msAD8.cjs → UnsplashImages-5skIflMr.cjs} +1 -1
- package/dist/{UnsplashImages-7uAXYHPH.js → UnsplashImages-owPv8UfV.js} +3 -3
- package/dist/{UploadImages-jS51ZcPG.cjs → UploadImages-olCKp-66.cjs} +1 -1
- package/dist/{UploadImages-5M0Q27R-.js → UploadImages-zGp0fN1z.js} +1 -1
- package/dist/{add-page-modal-KAbflupJ.cjs → add-page-modal-JE2NTOKQ.cjs} +1 -1
- package/dist/{add-page-modal-6o7MAbq-.js → add-page-modal-pOnhQNMH.js} +3 -3
- package/dist/{confirm-alert-dow0GlxC.cjs → confirm-alert-GTawvuT8.cjs} +1 -1
- package/dist/{confirm-alert-jL0z_gFv.js → confirm-alert-lbkop3bB.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-U5_JYYp7.js → delete-page-modal-3OWHRhV4.js} +2 -2
- package/dist/{delete-page-modal-EDQZneVM.cjs → delete-page-modal-S42VXCGh.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-Sgpl2fXL.js → form-CetbKOxf.js} +5 -5
- package/dist/{form-KBtrnNWh.cjs → form-Rqiu0P7V.cjs} +1 -1
- package/dist/{functions-7ybAMUuA.js → functions-WB3m-mfN.js} +6 -7
- package/dist/functions-fujiWLsg.cjs +1 -0
- package/dist/{index-po-naEa5.js → index-Mzvi8sMV.js} +2 -2
- package/dist/{index-HjN7LtDT.cjs → index-SZn6KcOd.cjs} +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js +17 -18
- package/dist/{page-viewer-nLRRk7DR.js → page-viewer-7iyxGntn.js} +8 -8
- package/dist/{page-viewer-PfZEbcDZ.cjs → page-viewer-fFmRhZs3.cjs} +1 -1
- package/dist/{project-general-setting-HO6zeum2.cjs → project-general-setting-0HJ_qyW3.cjs} +1 -1
- package/dist/{project-general-setting-D1UJdZ2D.js → project-general-setting-tHdsXTwH.js} +7 -7
- package/dist/{project-seo-setting-gT9N1tnB.cjs → project-seo-setting-Ln9aX7b5.cjs} +1 -1
- package/dist/{project-seo-setting-VIZWEMRk.js → project-seo-setting-zEBZ91Xk.js} +2 -2
- package/dist/render.cjs +1 -1
- package/dist/render.js +68 -68
- package/dist/{single-page-detail-To8TcpgJ.cjs → single-page-detail-H0heOB33.cjs} +1 -1
- package/dist/{single-page-detail-lQ8fujC5.js → single-page-detail-RBfdbTs3.js} +4 -4
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +31 -31
- package/dist/{useCanvasSettings-UzjYHFG5.js → useCanvasSettings-2YhM5XKu.js} +1 -1
- package/dist/{useCanvasSettings-7BXlDuLG.cjs → useCanvasSettings-tDzAqXUt.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/package.json +1 -1
- package/dist/ListTree-jOvHpo3_.cjs +0 -1
- package/dist/Settings-xVjTnVSf.cjs +0 -1
- package/dist/UILibrariesPanel-HhHGcexY.cjs +0 -1
- package/dist/UILibrariesPanel-VrA2X4LO.js +0 -145
- package/dist/functions-yvRwasT2.cjs +0 -1
|
@@ -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-F2yUJQdt.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-Mzvi8sMV.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";
|
|
@@ -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-lqHQcnh3.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-SZn6KcOd.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("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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("./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;
|
|
@@ -3,18 +3,18 @@ import React__default, { memo, useMemo, useCallback, useEffect, useRef } from "r
|
|
|
3
3
|
import { useAtom } from "jotai";
|
|
4
4
|
import { useDebouncedCallback } from "@react-hookz/web";
|
|
5
5
|
import { Tree } from "react-arborist";
|
|
6
|
-
import { i as useBlocksStore, L as useSelectedBlockIds, H as useRemoveBlocks, M as useSelectedBlock,
|
|
6
|
+
import { i as useBlocksStore, L as useSelectedBlockIds, H as useRemoveBlocks, M as useSelectedBlock, bt as ContextMenuItem, aK as canDeleteBlock, w as useDuplicateBlocks, bu as ContextMenuContent, aJ as canDuplicateBlock, bv as ContextMenu, bw as ContextMenuTrigger, h as useBuilderProp, z as useHighlightBlockId, aM as canAcceptChildBlock, ac as Tooltip, ad as TooltipTrigger, ae as TooltipContent, bx as treeDSBlocks, Q as useUpdateBlocksProps, Y as useSelectedStylingBlocks, aB as useBlocksStoreUndoableActions, aH as treeRefAtom } from "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
7
7
|
import { c as cn } from "./Functions-7jnEwJyw.js";
|
|
8
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
9
|
import { DatabaseIcon } from "lucide-react";
|
|
10
|
-
import { find, first } from "lodash-es";
|
|
10
|
+
import { find, first, isEmpty } from "lodash-es";
|
|
11
|
+
import { useTranslation } from "react-i18next";
|
|
11
12
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
12
13
|
import "clsx";
|
|
13
14
|
import "react-dom";
|
|
14
15
|
import "@radix-ui/react-scroll-area";
|
|
15
16
|
import "@floating-ui/react-dom";
|
|
16
17
|
import "i18next";
|
|
17
|
-
import "react-i18next";
|
|
18
18
|
import "flagged";
|
|
19
19
|
import "./STRINGS--j49GZJP.js";
|
|
20
20
|
import "@chaibuilder/runtime";
|
|
@@ -44,8 +44,8 @@ import "@radix-ui/react-context-menu";
|
|
|
44
44
|
import "react-icons-picker";
|
|
45
45
|
import "react-quill";
|
|
46
46
|
import "react-hotkeys-hook";
|
|
47
|
-
const TypeIcon = (
|
|
48
|
-
switch (
|
|
47
|
+
const TypeIcon = (o) => {
|
|
48
|
+
switch (o.type) {
|
|
49
49
|
case "Image":
|
|
50
50
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ImageIcon, {});
|
|
51
51
|
case "Heading":
|
|
@@ -110,43 +110,43 @@ const TypeIcon = (t) => {
|
|
|
110
110
|
display: "flex",
|
|
111
111
|
alignItems: "center",
|
|
112
112
|
zIndex: 1
|
|
113
|
-
}, DefaultCursor = React__default.memo(function({ top:
|
|
114
|
-
const
|
|
113
|
+
}, DefaultCursor = React__default.memo(function({ top: r, left: n }) {
|
|
114
|
+
const c = {
|
|
115
115
|
position: "absolute",
|
|
116
116
|
pointerEvents: "none",
|
|
117
|
-
top:
|
|
118
|
-
left:
|
|
117
|
+
top: r + "px",
|
|
118
|
+
left: n + "px",
|
|
119
119
|
right: 0
|
|
120
120
|
};
|
|
121
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...placeholderStyle, ...
|
|
122
|
-
}), Overlay = memo(function({ children:
|
|
123
|
-
return
|
|
124
|
-
}), DefaultDragPreview = memo(({ id:
|
|
125
|
-
const [
|
|
121
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...placeholderStyle, ...c }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0.5 flex-1 rounded-[1px] bg-green-500" }) });
|
|
122
|
+
}), Overlay = memo(function({ children: r, isDragging: n }) {
|
|
123
|
+
return n ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pointer-events-none fixed left-0 top-0 z-[100] h-full w-full", children: r }) : null;
|
|
124
|
+
}), DefaultDragPreview = memo(({ id: o, isDragging: r, mouse: n }) => {
|
|
125
|
+
const [c] = useBlocksStore(), i = useMemo(() => c.find((x) => x._id === o), [c, o]), u = useMemo(
|
|
126
126
|
() => ({
|
|
127
|
-
transform: `translate(${(
|
|
127
|
+
transform: `translate(${(n == null ? void 0 : n.x) - 10}px, ${(n == null ? void 0 : n.y) - 10}px)`
|
|
128
128
|
}),
|
|
129
|
-
[
|
|
129
|
+
[n]
|
|
130
130
|
);
|
|
131
|
-
return
|
|
131
|
+
return n ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { isDragging: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132
132
|
"div",
|
|
133
133
|
{
|
|
134
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
135
|
style: u,
|
|
136
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex !cursor-grab items-center p-0.5", "aria-label": `Type: ${
|
|
137
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
138
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-2 truncate text-[11px]", children: (
|
|
136
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex !cursor-grab items-center p-0.5", "aria-label": `Type: ${i == null ? void 0 : i._type}`, children: [
|
|
137
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: i == null ? void 0 : i._type }) }),
|
|
138
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-2 truncate text-[11px]", children: (i == null ? void 0 : i._name) || (i == null ? void 0 : i._type) })
|
|
139
139
|
] })
|
|
140
140
|
}
|
|
141
141
|
) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden" });
|
|
142
142
|
}), RemoveBlocks = () => {
|
|
143
|
-
const [
|
|
143
|
+
const [o] = useSelectedBlockIds(), r = useRemoveBlocks(), n = useSelectedBlock();
|
|
144
144
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
145
145
|
ContextMenuItem,
|
|
146
146
|
{
|
|
147
|
-
disabled: !canDeleteBlock(
|
|
147
|
+
disabled: !canDeleteBlock(n == null ? void 0 : n._type),
|
|
148
148
|
className: "flex items-center gap-x-4 text-xs",
|
|
149
|
-
onClick: () =>
|
|
149
|
+
onClick: () => r(o),
|
|
150
150
|
children: [
|
|
151
151
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TrashIcon, {}),
|
|
152
152
|
" Remove"
|
|
@@ -154,16 +154,16 @@ const TypeIcon = (t) => {
|
|
|
154
154
|
}
|
|
155
155
|
);
|
|
156
156
|
}, BlockContextMenuContent = () => {
|
|
157
|
-
const [
|
|
158
|
-
|
|
159
|
-
}, [
|
|
157
|
+
const [o] = useSelectedBlockIds(), r = useDuplicateBlocks(), n = useSelectedBlock(), c = useCallback(() => {
|
|
158
|
+
r(o);
|
|
159
|
+
}, [o, r]);
|
|
160
160
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenuContent, { className: "text-xs", children: [
|
|
161
161
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
162
162
|
ContextMenuItem,
|
|
163
163
|
{
|
|
164
|
-
disabled: !canDuplicateBlock(
|
|
164
|
+
disabled: !canDuplicateBlock(n == null ? void 0 : n._type),
|
|
165
165
|
className: "flex items-center gap-x-4 text-xs",
|
|
166
|
-
onClick:
|
|
166
|
+
onClick: c,
|
|
167
167
|
children: [
|
|
168
168
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, {}),
|
|
169
169
|
" Duplicate"
|
|
@@ -172,8 +172,8 @@ const TypeIcon = (t) => {
|
|
|
172
172
|
),
|
|
173
173
|
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveBlocks, {})
|
|
174
174
|
] });
|
|
175
|
-
}, BlockContextMenu = ({ children:
|
|
176
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger, { children:
|
|
175
|
+
}, BlockContextMenu = ({ children: o }) => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ContextMenu, { children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger, { children: o }),
|
|
177
177
|
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenuContent, {})
|
|
178
178
|
] }) }), defaultShortcuts = [
|
|
179
179
|
{ key: "ArrowDown", command: "selectNext" },
|
|
@@ -185,143 +185,143 @@ const TypeIcon = (t) => {
|
|
|
185
185
|
{ key: "Home", command: "selectFirst" },
|
|
186
186
|
{ key: "End", command: "selectLast" }
|
|
187
187
|
];
|
|
188
|
-
function selectFirst(
|
|
189
|
-
|
|
188
|
+
function selectFirst(o) {
|
|
189
|
+
o.firstNode && o.select(o.firstNode.id);
|
|
190
190
|
}
|
|
191
|
-
function selectLast(
|
|
192
|
-
|
|
191
|
+
function selectLast(o) {
|
|
192
|
+
o.lastNode && o.select(o.lastNode.id);
|
|
193
193
|
}
|
|
194
|
-
function selectNext(
|
|
195
|
-
const
|
|
196
|
-
|
|
194
|
+
function selectNext(o) {
|
|
195
|
+
const r = o.selectedNodes[0].next || o.firstNode;
|
|
196
|
+
o.select(r.id);
|
|
197
197
|
}
|
|
198
|
-
function selectPrev(
|
|
199
|
-
const
|
|
200
|
-
|
|
198
|
+
function selectPrev(o) {
|
|
199
|
+
const r = o.selectedNodes[0].prev || o.lastNode;
|
|
200
|
+
o.select(r.id);
|
|
201
201
|
}
|
|
202
|
-
const selectParent = (
|
|
203
|
-
var
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
}, open = (
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
}, close = (
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
}, Node = memo(({ node:
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
|
|
202
|
+
const selectParent = (o, r) => {
|
|
203
|
+
var c;
|
|
204
|
+
const n = ((c = o.selectedIds[0]) == null ? void 0 : c.parent) || null;
|
|
205
|
+
n && r && o.select(n.id);
|
|
206
|
+
}, open = (o, r) => {
|
|
207
|
+
const n = o.selectedNodes[0];
|
|
208
|
+
n.isInternal && r && n.open();
|
|
209
|
+
}, close = (o, r) => {
|
|
210
|
+
const n = o.selectedNodes[0];
|
|
211
|
+
n.isInternal && r && n.close();
|
|
212
|
+
}, Node = memo(({ node: o, style: r, dragHandle: n }) => {
|
|
213
|
+
const c = useBuilderProp("outlineMenuItems", []), [, i] = useHighlightBlockId(), u = o.children.length > 0, { id: x, data: l, isSelected: d, willReceiveDrop: p, isDragging: m, isEditing: j, handleClick: f } = o, R = useDebouncedCallback((a) => i(a), [], 300), h = (a) => {
|
|
214
|
+
a.stopPropagation(), o.toggle();
|
|
215
|
+
}, g = (a) => {
|
|
216
|
+
a.stopPropagation(), o.isOpen || o.toggle(), f(a);
|
|
217
217
|
};
|
|
218
218
|
return useEffect(() => {
|
|
219
|
-
const
|
|
220
|
-
|
|
219
|
+
const a = setTimeout(() => {
|
|
220
|
+
p && !o.isOpen && o.toggle();
|
|
221
221
|
}, 500);
|
|
222
|
-
return () => clearTimeout(
|
|
223
|
-
}, [
|
|
222
|
+
return () => clearTimeout(a);
|
|
223
|
+
}, [p, o]), /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: x, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
224
224
|
"div",
|
|
225
225
|
{
|
|
226
|
-
onClick:
|
|
227
|
-
onMouseEnter: () =>
|
|
228
|
-
style:
|
|
229
|
-
"data-node-id":
|
|
230
|
-
ref:
|
|
226
|
+
onClick: g,
|
|
227
|
+
onMouseEnter: () => R(x),
|
|
228
|
+
style: r,
|
|
229
|
+
"data-node-id": x,
|
|
230
|
+
ref: n,
|
|
231
231
|
className: cn(
|
|
232
232
|
"group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
d ? "bg-blue-500 text-white" : "text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
234
|
+
p && canAcceptChildBlock(l._type, "Icon") ? "bg-green-200" : "",
|
|
235
|
+
m && "opacity-20"
|
|
236
236
|
),
|
|
237
237
|
children: [
|
|
238
238
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
239
239
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
240
240
|
"div",
|
|
241
241
|
{
|
|
242
|
-
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${
|
|
243
|
-
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
242
|
+
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
243
|
+
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: h, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
244
244
|
}
|
|
245
245
|
),
|
|
246
246
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
247
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
248
|
-
|
|
247
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: l == null ? void 0 : l._type }) }),
|
|
248
|
+
j ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
249
249
|
"div",
|
|
250
250
|
{
|
|
251
251
|
className: "ml-2 truncate text-[11px]",
|
|
252
|
-
onDoubleClick: (
|
|
253
|
-
|
|
252
|
+
onDoubleClick: (a) => {
|
|
253
|
+
a.stopPropagation(), o.edit(), o.deselect();
|
|
254
254
|
},
|
|
255
|
-
children: (
|
|
255
|
+
children: (l == null ? void 0 : l._name) || (l == null ? void 0 : l._type.split("/").pop())
|
|
256
256
|
}
|
|
257
257
|
)
|
|
258
258
|
] })
|
|
259
259
|
] }),
|
|
260
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children:
|
|
260
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: c.map((a) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
261
261
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
262
262
|
TooltipTrigger,
|
|
263
263
|
{
|
|
264
264
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
265
265
|
asChild: !0,
|
|
266
|
-
children: React__default.createElement(
|
|
266
|
+
children: React__default.createElement(a.item, { blockId: x })
|
|
267
267
|
}
|
|
268
268
|
),
|
|
269
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "z-[9999]", children:
|
|
269
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "z-[9999]", children: a.tooltip })
|
|
270
270
|
] })) })
|
|
271
271
|
]
|
|
272
272
|
}
|
|
273
273
|
) });
|
|
274
|
-
}), Input = ({ node:
|
|
275
|
-
var
|
|
274
|
+
}), Input = ({ node: o }) => {
|
|
275
|
+
var r, n;
|
|
276
276
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
277
277
|
"input",
|
|
278
278
|
{
|
|
279
279
|
autoFocus: !0,
|
|
280
280
|
className: "ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",
|
|
281
281
|
type: "text",
|
|
282
|
-
defaultValue: ((
|
|
283
|
-
onFocus: (
|
|
284
|
-
onBlur: (
|
|
285
|
-
onKeyDown: (
|
|
286
|
-
|
|
282
|
+
defaultValue: ((r = o.data) == null ? void 0 : r._name) || ((n = o.data) == null ? void 0 : n._type),
|
|
283
|
+
onFocus: (c) => c.currentTarget.select(),
|
|
284
|
+
onBlur: (c) => o.submit(c.currentTarget.value),
|
|
285
|
+
onKeyDown: (c) => {
|
|
286
|
+
c.key === "Enter" && o.submit(c.currentTarget.value);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
);
|
|
290
290
|
}, useCanMove = () => {
|
|
291
|
-
const [
|
|
292
|
-
return (
|
|
291
|
+
const [o] = useBlocksStore();
|
|
292
|
+
return (r, n) => {
|
|
293
293
|
var u;
|
|
294
|
-
const
|
|
295
|
-
var
|
|
296
|
-
return (
|
|
294
|
+
const c = (u = find(o, { _id: n })) == null ? void 0 : u._type, i = first(r.map((x) => {
|
|
295
|
+
var l;
|
|
296
|
+
return (l = find(o, { _id: x })) == null ? void 0 : l._type;
|
|
297
297
|
}));
|
|
298
|
-
return canAcceptChildBlock(
|
|
298
|
+
return canAcceptChildBlock(c, i);
|
|
299
299
|
};
|
|
300
300
|
}, ListTree = () => {
|
|
301
|
-
const [treeData] = useAtom(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom(treeRefAtom), clearSelection = () => {
|
|
301
|
+
const [treeData] = useAtom(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom(treeRefAtom), { t } = useTranslation(), clearSelection = () => {
|
|
302
302
|
setIds([]), setStyleBlocks([]);
|
|
303
303
|
};
|
|
304
304
|
useEffect(() => {
|
|
305
305
|
setTreeRef(treeRef.current);
|
|
306
306
|
}, [treeRef.current]);
|
|
307
|
-
const onRename = ({ id:
|
|
308
|
-
updateBlockProps([
|
|
309
|
-
}, onMove = ({ dragIds:
|
|
310
|
-
canMove(
|
|
311
|
-
}, onSelect = (
|
|
312
|
-
if (
|
|
307
|
+
const onRename = ({ id: o, name: r, node: n }) => {
|
|
308
|
+
updateBlockProps([o], { _name: r }, n.data._name);
|
|
309
|
+
}, onMove = ({ dragIds: o, parentId: r, index: n }) => {
|
|
310
|
+
canMove(o, r) && moveBlocks(o, r, n);
|
|
311
|
+
}, onSelect = (o) => {
|
|
312
|
+
if (o.length === 0)
|
|
313
313
|
return;
|
|
314
|
-
const
|
|
315
|
-
setStyleBlocks([]), setIds([
|
|
316
|
-
}, onContextMenu = (
|
|
317
|
-
var
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
314
|
+
const r = o[0] ? o[0].id : "";
|
|
315
|
+
setStyleBlocks([]), setIds([r]);
|
|
316
|
+
}, onContextMenu = (o) => {
|
|
317
|
+
var c;
|
|
318
|
+
o.preventDefault();
|
|
319
|
+
const r = o.target, n = r.getAttribute("data-node-id") || ((c = r.closest("[data-node-id]")) == null ? void 0 : c.getAttribute("data-node-id"));
|
|
320
|
+
n && (setStyleBlocks([]), setIds([n]));
|
|
321
321
|
}, debouncedDisableDrop = useDebouncedCallback(
|
|
322
|
-
({ parentNode:
|
|
323
|
-
var
|
|
324
|
-
return !canAcceptChildBlock(
|
|
322
|
+
({ parentNode: o, dragNodes: r }) => {
|
|
323
|
+
var n;
|
|
324
|
+
return !canAcceptChildBlock(o == null ? void 0 : o.data._type, (n = r[0]) == null ? void 0 : n.data._type);
|
|
325
325
|
},
|
|
326
326
|
[],
|
|
327
327
|
300
|
|
@@ -360,13 +360,22 @@ const selectParent = (t, n) => {
|
|
|
360
360
|
break;
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
363
|
+
return isEmpty(treeData) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full w-full items-center justify-center p-8 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 text-sm text-gray-400", children: [
|
|
364
|
+
t("Page is empty."),
|
|
365
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
366
|
+
" ",
|
|
367
|
+
t("Add blocks to get started by clicking the"),
|
|
368
|
+
" ",
|
|
369
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: "(+)" }),
|
|
370
|
+
" ",
|
|
371
|
+
t("button")
|
|
372
|
+
] }) }) }) : /* @__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(
|
|
364
373
|
"div",
|
|
365
374
|
{
|
|
366
375
|
id: "outline-view",
|
|
367
376
|
className: "no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs",
|
|
368
|
-
onKeyDown: (
|
|
369
|
-
treeRef.current.isEditing || handleKeyDown(
|
|
377
|
+
onKeyDown: (o) => {
|
|
378
|
+
treeRef.current.isEditing || handleKeyDown(o);
|
|
370
379
|
},
|
|
371
380
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
372
381
|
Tree,
|
|
@@ -382,7 +391,7 @@ const selectParent = (t, n) => {
|
|
|
382
391
|
data: treeData,
|
|
383
392
|
renderCursor: DefaultCursor,
|
|
384
393
|
onSelect,
|
|
385
|
-
childrenAccessor: (
|
|
394
|
+
childrenAccessor: (o) => o.children,
|
|
386
395
|
width: "100%",
|
|
387
396
|
renderDragPreview: DefaultDragPreview,
|
|
388
397
|
indent: 10,
|
|
@@ -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-lqHQcnh3.cjs"),Functions=require("./Functions-N3yhPYKY.cjs"),reactIcons=require("@radix-ui/react-icons"),lucideReact=require("lucide-react"),lodashEs=require("lodash-es"),reactI18next=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("@chaibuilder/runtime");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("tailwind-merge");require("@radix-ui/react-toggle");require("class-variance-authority");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");const TypeIcon=n=>{switch(n.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:o,left:r}){const i={position:"absolute",pointerEvents:"none",top:o+"px",left:r+"px",right:0};return jsxRuntime.jsxRuntimeExports.jsx("div",{style:{...placeholderStyle,...i},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),Overlay=React.memo(function({children:o,isDragging:r}){return r?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:o}):null}),DefaultDragPreview=React.memo(({id:n,isDragging:o,mouse:r})=>{const[i]=ui.useBlocksStore(),c=React.useMemo(()=>i.find(a=>a._id===n),[i,n]),l=React.useMemo(()=>({transform:`translate(${(r==null?void 0:r.x)-10}px, ${(r==null?void 0:r.y)-10}px)`}),[r]);return r?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(Overlay,{isDragging:o,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:l,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${c==null?void 0:c._type}`,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})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(c==null?void 0:c._name)||(c==null?void 0:c._type)})]})})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"hidden"})}),RemoveBlocks=()=>{const[n]=ui.useSelectedBlockIds(),o=ui.useRemoveBlocks(),r=ui.useSelectedBlock();return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDeleteBlock(r==null?void 0:r._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>o(n),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TrashIcon,{})," Remove"]})},BlockContextMenuContent=()=>{const[n]=ui.useSelectedBlockIds(),o=ui.useDuplicateBlocks(),r=ui.useSelectedBlock(),i=React.useCallback(()=>{o(n)},[n,o]);return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuContent,{className:"text-xs",children:[jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDuplicateBlock(r==null?void 0:r._type),className:"flex items-center gap-x-4 text-xs",onClick:i,children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{})," Duplicate"]}),jsxRuntime.jsxRuntimeExports.jsx(RemoveBlocks,{})]})},BlockContextMenu=({children:n})=>jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(ui.ContextMenuTrigger,{children:n}),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(n){n.firstNode&&n.select(n.firstNode.id)}function selectLast(n){n.lastNode&&n.select(n.lastNode.id)}function selectNext(n){const o=n.selectedNodes[0].next||n.firstNode;n.select(o.id)}function selectPrev(n){const o=n.selectedNodes[0].prev||n.lastNode;n.select(o.id)}const selectParent=(n,o)=>{var i;const r=((i=n.selectedIds[0])==null?void 0:i.parent)||null;r&&o&&n.select(r.id)},open=(n,o)=>{const r=n.selectedNodes[0];r.isInternal&&o&&r.open()},close=(n,o)=>{const r=n.selectedNodes[0];r.isInternal&&o&&r.close()},Node=React.memo(({node:n,style:o,dragHandle:r})=>{const i=ui.useBuilderProp("outlineMenuItems",[]),[,c]=ui.useHighlightBlockId(),l=n.children.length>0,{id:a,data:u,isSelected:d,willReceiveDrop:m,isDragging:j,isEditing:p,handleClick:R}=n,h=web.useDebouncedCallback(x=>c(x),[],300),f=x=>{x.stopPropagation(),n.toggle()},I=x=>{x.stopPropagation(),n.isOpen||n.toggle(),R(x)};return React.useEffect(()=>{const x=setTimeout(()=>{m&&!n.isOpen&&n.toggle()},500);return()=>clearTimeout(x)},[m,n]),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenu,{id:a,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:I,onMouseEnter:()=>h(a),style:o,"data-node-id":a,ref:r,className:Functions.cn("group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",d?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",m&&ui.canAcceptChildBlock(u._type,"Icon")?"bg-green-200":"",j&&"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 ${n.isOpen?"rotate-90":""}`,children:l&&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:u==null?void 0:u._type})}),p?jsxRuntime.jsxRuntimeExports.jsx(Input,{node:n}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",onDoubleClick:x=>{x.stopPropagation(),n.edit(),n.deselect()},children:(u==null?void 0:u._name)||(u==null?void 0:u._type.split("/").pop())})]})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:i.map(x=>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(x.item,{blockId:a})}),jsxRuntime.jsxRuntimeExports.jsx(ui.TooltipContent,{className:"z-[9999]",children:x.tooltip})]}))})]})})}),Input=({node:n})=>{var o,r;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:((o=n.data)==null?void 0:o._name)||((r=n.data)==null?void 0:r._type),onFocus:i=>i.currentTarget.select(),onBlur:i=>n.submit(i.currentTarget.value),onKeyDown:i=>{i.key==="Enter"&&n.submit(i.currentTarget.value)}})},useCanMove=()=>{const[n]=ui.useBlocksStore();return(o,r)=>{var l;const i=(l=lodashEs.find(n,{_id:r}))==null?void 0:l._type,c=lodashEs.first(o.map(a=>{var u;return(u=lodashEs.find(n,{_id:a}))==null?void 0:u._type}));return ui.canAcceptChildBlock(i,c)}},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),{t}=reactI18next.useTranslation(),clearSelection=()=>{setIds([]),setStyleBlocks([])};React.useEffect(()=>{setTreeRef(treeRef.current)},[treeRef.current]);const onRename=({id:n,name:o,node:r})=>{updateBlockProps([n],{_name:o},r.data._name)},onMove=({dragIds:n,parentId:o,index:r})=>{canMove(n,o)&&moveBlocks(n,o,r)},onSelect=n=>{if(n.length===0)return;const o=n[0]?n[0].id:"";setStyleBlocks([]),setIds([o])},onContextMenu=n=>{var i;n.preventDefault();const o=n.target,r=o.getAttribute("data-node-id")||((i=o.closest("[data-node-id]"))==null?void 0:i.getAttribute("data-node-id"));r&&(setStyleBlocks([]),setIds([r]))},debouncedDisableDrop=web.useDebouncedCallback(({parentNode:n,dragNodes:o})=>{var r;return!ui.canAcceptChildBlock(n==null?void 0:n.data._type,(r=o[0])==null?void 0:r.data._type)},[],300),handleKeyDown=e=>{if(!treeRef.current)return;const tree=treeRef.current,selectedNode=tree.selectedNodes[0];if(!selectedNode)return;setIds[selectedNode.id],setStyleBlocks([]);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 lodashEs.isEmpty(treeData)?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center p-8 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-sm text-gray-400",children:[t("Page is empty."),jsxRuntime.jsxRuntimeExports.jsx("br",{})," ",t("Add blocks to get started by clicking the")," ",jsxRuntime.jsxRuntimeExports.jsx("span",{className:"font-bold",children:"(+)"})," ",t("button")]})})}):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",onKeyDown:n=>{treeRef.current.isEditing||handleKeyDown(n)},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:n=>n.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-Mzvi8sMV.js";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "./core.js";
|
|
7
|
-
import "./ChaiBuilderEditor-
|
|
7
|
+
import "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
8
8
|
import "clsx";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "@radix-ui/react-scroll-area";
|
|
@@ -48,7 +48,7 @@ import "lucide-react";
|
|
|
48
48
|
import "sonner";
|
|
49
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-pOnhQNMH.js")), u = i.lazy(() => import("./page-viewer-7iyxGntn.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-SZn6KcOd.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-lqHQcnh3.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("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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("lucide-react");require("sonner");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-JE2NTOKQ.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-fFmRhZs3.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,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 { b6 as f, b7 as n, b8 as l, b9 as c } from "./ChaiBuilderEditor-F2yUJQdt.js";
|
|
5
|
+
import { b as h, a as g } from "./index-Mzvi8sMV.js";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "react-dom";
|
|
@@ -48,7 +48,7 @@ import "./core.js";
|
|
|
48
48
|
import "sonner";
|
|
49
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-tHdsXTwH.js")), S = m.lazy(() => import("./project-seo-setting-zEBZ91Xk.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;
|
|
@@ -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-lqHQcnh3.cjs"),a=require("./index-SZn6KcOd.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("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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("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-0HJ_qyW3.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-Ln9aX7b5.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;
|