@chaibuilder/sdk 1.0.23 → 1.1.0
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-P3qHuE5J.cjs +1 -0
- package/dist/AddBlocks-imyQSCbI.js +230 -0
- package/dist/{BrandingOptions-Fyo8qs4o.cjs → BrandingOptions-_2XBEPab.cjs} +1 -1
- package/dist/{BrandingOptions-orZyDGiL.js → BrandingOptions-tSNtQ1Kv.js} +1 -1
- package/dist/CanvasArea-TzIgm_vh.cjs +58 -0
- package/dist/CanvasArea-dS2B20gv.js +1421 -0
- package/dist/{CurrentPage-lIithDJy.cjs → CurrentPage-_Em0U2gh.cjs} +1 -1
- package/dist/{CurrentPage-70sBzc2_.js → CurrentPage-pSsaLyEf.js} +2 -2
- package/dist/Layers-RyVRzaUa.cjs +1 -0
- package/dist/{Layers-W0N2zfnf.js → Layers-wp2Uc2Y5.js} +119 -137
- package/dist/{MarkAsGlobalBlock-FPCQmRIh.js → MarkAsGlobalBlock-aqik3ouc.js} +1 -1
- package/dist/{MarkAsGlobalBlock-EOsABFjY.cjs → MarkAsGlobalBlock-p_wvHkQZ.cjs} +1 -1
- package/dist/{PagesPanel-RbHN6lvQ.js → PagesPanel-L2VS8RyZ.js} +3 -3
- package/dist/{PagesPanel-i-MQEmm_.cjs → PagesPanel-ZuXc2610.cjs} +1 -1
- package/dist/{ProjectPanel-0BGx-hP-.cjs → ProjectPanel-SErKorHi.cjs} +1 -1
- package/dist/{ProjectPanel-CzwuyR0N.js → ProjectPanel-T3AXGe7O.js} +3 -3
- package/dist/Settings-GJHtwQaa.cjs +1 -0
- package/dist/{Settings-lxTrbI-C.js → Settings-xkL3U3Y-.js} +301 -308
- package/dist/{SidePanels-pUOJTYfr.cjs → SidePanels-5FNROZe7.cjs} +1 -1
- package/dist/{SidePanels-g4M6oTs-.js → SidePanels-pd7HYv8I.js} +33 -32
- package/dist/{Topbar-KqZt4TEY.js → Topbar-Jc74a6oE.js} +1 -1
- package/dist/{Topbar-kHffytzr.cjs → Topbar-ZjAs5fDc.cjs} +1 -1
- package/dist/{UnsplashImages-Ua7ksJ8c.js → UnsplashImages-_PxEYx5c.js} +1 -1
- package/dist/{UnsplashImages-y7I_7_W7.cjs → UnsplashImages-nXceZLmd.cjs} +1 -1
- package/dist/{UploadImages-RzEm0Stb.cjs → UploadImages-tcQb5NZu.cjs} +1 -1
- package/dist/{UploadImages-YP_J6erG.js → UploadImages-zzSgKmP9.js} +10 -10
- package/dist/{add-page-modal-btGWaXyq.js → add-page-modal-Njd5M7E2.js} +3 -3
- package/dist/{add-page-modal-ekFis5D8.cjs → add-page-modal-U8EH-GIa.cjs} +1 -1
- package/dist/{confirm-alert-Py2WqZhJ.js → confirm-alert-2JxcNf3T.js} +1 -1
- package/dist/{confirm-alert-mAhT8vln.cjs → confirm-alert-mzlwOW9w.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -3
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-QzleoJG2.cjs → delete-page-modal-0LQiM0fX.cjs} +1 -1
- package/dist/{delete-page-modal-Rq4ThQpu.js → delete-page-modal-NT7df4pk.js} +2 -2
- package/dist/{form-Lm3bupAq.js → form-TQ7vwDYO.js} +1 -1
- package/dist/{form-kAjrBaV-.cjs → form-bSW-Pkw9.cjs} +1 -1
- package/dist/{index-WPlT_Q87.js → index-N3mTbV2j.js} +6 -4
- package/dist/{index-Vx4ctSV6.js → index-ORFlyrBx.js} +569 -556
- package/dist/{index-fvoD_laH.cjs → index-pYZXf7hY.cjs} +2 -2
- package/dist/index-zkc4SQCu.cjs +1 -0
- package/dist/{page-viewer-AlOCzh1b.cjs → page-viewer-UxwOwHCO.cjs} +1 -1
- package/dist/{page-viewer-_wGsV2_o.js → page-viewer-e3lOBAH3.js} +3 -3
- package/dist/{project-general-setting-XnNyOpXO.cjs → project-general-setting-DrLwWE-6.cjs} +1 -1
- package/dist/{project-general-setting-B8uuHccU.js → project-general-setting-el86II8N.js} +3 -3
- package/dist/{project-seo-setting-QJBATF59.cjs → project-seo-setting-cERASO9j.cjs} +1 -1
- package/dist/{project-seo-setting-Zg2Z-Frr.js → project-seo-setting-k0HlefUD.js} +2 -2
- package/dist/{single-page-detail-HXpxgQnU.js → single-page-detail-UFEXRI81.js} +4 -4
- package/dist/{single-page-detail-MWh30E_-.cjs → single-page-detail-fUh22jZE.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +57 -57
- package/dist/useAddBlockByDrop-DPV32UHP.cjs +1 -0
- package/dist/useAddBlockByDrop-UA_Iw_4l.js +20 -0
- package/package.json +3 -3
- package/dist/AddBlocks-Izn_rxXD.js +0 -270
- package/dist/AddBlocks-RHuwwfe5.cjs +0 -3
- package/dist/CanvasArea-C30uJLef.js +0 -1298
- package/dist/CanvasArea-IM2K8bud.cjs +0 -46
- package/dist/Layers-YMtavzUG.cjs +0 -1
- package/dist/Settings-mTWkKG82.cjs +0 -1
- package/dist/index-W5drgyWI.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-zkc4SQCu.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-pYZXf7hY.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[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 m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(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:m,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=p;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-
|
|
2
|
+
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-ORFlyrBx.js";
|
|
3
3
|
import { sortBy as P, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
|
|
4
4
|
import { toast as S } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { b as k, a as B, d as E, e as I } from "./index-
|
|
6
|
+
import { b as k, a as B, d as E, e as I } from "./index-N3mTbV2j.js";
|
|
7
7
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),q=require("react-dnd"),f=require("@minoru/react-dnd-treeview"),M=require("react-i18next"),r=require("./index-zkc4SQCu.cjs"),N=require("lucide-react");require("./lib.cjs");const g=require("react"),O=require("./MODIFIERS-WFzDQfiT.cjs"),B=require("./utils-It2K33fU.cjs"),A=require("./index-pYZXf7hY.cjs"),_=require("jotai"),P=require("./useAddBlockByDrop-DPV32UHP.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-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const y=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function H(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const L=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],O.STYLES_KEY)&&(n=s[o])}),n},F=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=f.useDragOver(c,s.isOpen,s.onToggle),p=g.useMemo(()=>{const a=L(s.node.data);return H(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:B.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(y,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},V=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(y,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-p_wvHkQZ.cjs"))),$=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},U=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=g.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:s,id:n=null})=>{const[o,i]=g.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function W(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=M.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),p=P.useAddBlockByDrop(),[,j]=_.useAtom(r.addBlocksModalAtom),a=async(x,R)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:D}=R,T=W(x);n(T),h?m():(await p({block:D.getItem(),dropTargetId:k,relativeIndex:b}),j(!1))},C=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},S]=q.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:w}=q.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:S,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(f.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:C,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:x.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import { nth as k, startsWith as
|
|
3
|
-
import { BoxModelIcon as
|
|
4
|
-
import { useDrop as
|
|
5
|
-
import { useDragOver as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { _ as
|
|
8
|
-
import { DatabaseIcon as
|
|
2
|
+
import { nth as k, startsWith as E, map as v, isUndefined as _, find as A, isEmpty as H, includes as P } from "lodash";
|
|
3
|
+
import { BoxModelIcon as L, BoxIcon as F, DragHandleHorizontalIcon as V, ViewHorizontalIcon as z, BorderAllIcon as G, BorderTopIcon as $, TableIcon as K, DropdownMenuIcon as Q, RadiobuttonIcon as U, InputIcon as Y, ButtonIcon as y, CheckboxIcon as q, GroupIcon as W, SpaceBetweenVerticallyIcon as Z, ColumnsIcon as J, RowsIcon as B, TextIcon as C, SketchLogoIcon as X, DividerHorizontalIcon as ee, CodeIcon as te, CursorTextIcon as se, VideoIcon as oe, Link1Icon as ne, HeadingIcon as re, ImageIcon as ae, TriangleRightIcon as ce, ScissorsIcon as le, ClipboardIcon as ie, TrashIcon as xe, GlobeIcon as de, CopyIcon as me, ClipboardCopyIcon as pe, DoubleArrowDownIcon as ue, StackIcon as ge } from "@radix-ui/react-icons";
|
|
4
|
+
import { useDrop as je, useDragLayer as he } from "react-dnd";
|
|
5
|
+
import { useDragOver as be, Tree as fe } from "@minoru/react-dnd-treeview";
|
|
6
|
+
import { useTranslation as Ie } from "react-i18next";
|
|
7
|
+
import { _ as ke, Z as ye, j as g, n as Be, bC as i, k as Ce, l as ve, a6 as we, m as Se, o as De, i as Te, bD as Ne, ao as Me, ap as Oe, bE as Re, bF as Ee, ae as _e, w as Ae, aj as He, p as Pe, aA as Le, br as Fe, bG as Ve } from "./index-ORFlyrBx.js";
|
|
8
|
+
import { DatabaseIcon as ze } from "lucide-react";
|
|
9
9
|
import "./lib.js";
|
|
10
|
-
import { useMemo as
|
|
11
|
-
import { a as
|
|
12
|
-
import { c as
|
|
13
|
-
import { f as
|
|
14
|
-
import { useAtom as
|
|
10
|
+
import { useMemo as Ge, lazy as $e, useCallback as Ke, useState as Qe, Suspense as Ue } from "react";
|
|
11
|
+
import { a as Ye } from "./MODIFIERS-MLfpKQY1.js";
|
|
12
|
+
import { c as w } from "./utils-PPBbw5bk.js";
|
|
13
|
+
import { f as qe } from "./index-N3mTbV2j.js";
|
|
14
|
+
import { useAtom as We } from "jotai";
|
|
15
|
+
import { u as Ze } from "./useAddBlockByDrop-UA_Iw_4l.js";
|
|
15
16
|
import "@radix-ui/react-toggle";
|
|
16
17
|
import "class-variance-authority";
|
|
17
18
|
import "@radix-ui/react-switch";
|
|
@@ -56,70 +57,70 @@ import "react-textarea-autosize";
|
|
|
56
57
|
import "flagged";
|
|
57
58
|
import "react-hotkeys-hook";
|
|
58
59
|
import "sonner";
|
|
59
|
-
const
|
|
60
|
+
const S = (t) => {
|
|
60
61
|
switch (t.type) {
|
|
61
62
|
case "Image":
|
|
62
|
-
return /* @__PURE__ */ e.jsx(
|
|
63
|
+
return /* @__PURE__ */ e.jsx(ae, {});
|
|
63
64
|
case "Heading":
|
|
64
|
-
return /* @__PURE__ */ e.jsx(
|
|
65
|
+
return /* @__PURE__ */ e.jsx(re, {});
|
|
65
66
|
case "Text":
|
|
66
67
|
return /* @__PURE__ */ e.jsx(C, {});
|
|
67
68
|
case "Link":
|
|
68
|
-
return /* @__PURE__ */ e.jsx(
|
|
69
|
+
return /* @__PURE__ */ e.jsx(ne, {});
|
|
69
70
|
case "Video":
|
|
70
|
-
return /* @__PURE__ */ e.jsx(
|
|
71
|
+
return /* @__PURE__ */ e.jsx(oe, {});
|
|
71
72
|
case "RichText":
|
|
72
|
-
return /* @__PURE__ */ e.jsx(
|
|
73
|
+
return /* @__PURE__ */ e.jsx(se, {});
|
|
73
74
|
case "Button":
|
|
74
|
-
return /* @__PURE__ */ e.jsx(
|
|
75
|
+
return /* @__PURE__ */ e.jsx(y, {});
|
|
75
76
|
case "CustomHTML":
|
|
76
|
-
return /* @__PURE__ */ e.jsx(
|
|
77
|
+
return /* @__PURE__ */ e.jsx(te, {});
|
|
77
78
|
case "Divider":
|
|
78
|
-
return /* @__PURE__ */ e.jsx(
|
|
79
|
+
return /* @__PURE__ */ e.jsx(ee, {});
|
|
79
80
|
case "Icon":
|
|
80
|
-
return /* @__PURE__ */ e.jsx(
|
|
81
|
+
return /* @__PURE__ */ e.jsx(X, {});
|
|
81
82
|
case "List":
|
|
82
|
-
return /* @__PURE__ */ e.jsx(
|
|
83
|
+
return /* @__PURE__ */ e.jsx(B, {});
|
|
83
84
|
case "Paragraph":
|
|
84
85
|
return /* @__PURE__ */ e.jsx(C, {});
|
|
85
86
|
case "Row":
|
|
86
|
-
return /* @__PURE__ */ e.jsx(
|
|
87
|
+
return /* @__PURE__ */ e.jsx(B, {});
|
|
87
88
|
case "ListItem":
|
|
88
|
-
return /* @__PURE__ */ e.jsx(
|
|
89
|
+
return /* @__PURE__ */ e.jsx(J, {});
|
|
89
90
|
case "LineBreak":
|
|
90
|
-
return /* @__PURE__ */ e.jsx(
|
|
91
|
+
return /* @__PURE__ */ e.jsx(Z, {});
|
|
91
92
|
case "Form":
|
|
92
|
-
return /* @__PURE__ */ e.jsx(
|
|
93
|
+
return /* @__PURE__ */ e.jsx(W, {});
|
|
93
94
|
case "Checkbox":
|
|
94
|
-
return /* @__PURE__ */ e.jsx(
|
|
95
|
+
return /* @__PURE__ */ e.jsx(q, {});
|
|
95
96
|
case "FormButton":
|
|
96
|
-
return /* @__PURE__ */ e.jsx(
|
|
97
|
+
return /* @__PURE__ */ e.jsx(y, {});
|
|
97
98
|
case "Input":
|
|
98
99
|
case "TextArea":
|
|
99
|
-
return /* @__PURE__ */ e.jsx(
|
|
100
|
+
return /* @__PURE__ */ e.jsx(Y, {});
|
|
100
101
|
case "Radio":
|
|
101
|
-
return /* @__PURE__ */ e.jsx(
|
|
102
|
+
return /* @__PURE__ */ e.jsx(U, {});
|
|
102
103
|
case "Select":
|
|
103
|
-
return /* @__PURE__ */ e.jsx(
|
|
104
|
+
return /* @__PURE__ */ e.jsx(Q, {});
|
|
104
105
|
case "Table":
|
|
105
|
-
return /* @__PURE__ */ e.jsx(
|
|
106
|
+
return /* @__PURE__ */ e.jsx(K, {});
|
|
106
107
|
case "TableHead":
|
|
107
|
-
return /* @__PURE__ */ e.jsx(
|
|
108
|
+
return /* @__PURE__ */ e.jsx($, {});
|
|
108
109
|
case "TableBody":
|
|
109
|
-
return /* @__PURE__ */ e.jsx(
|
|
110
|
+
return /* @__PURE__ */ e.jsx(G, {});
|
|
110
111
|
case "TableRow":
|
|
111
|
-
return /* @__PURE__ */ e.jsx(
|
|
112
|
+
return /* @__PURE__ */ e.jsx(z, {});
|
|
112
113
|
case "TableCell":
|
|
113
|
-
return /* @__PURE__ */ e.jsx(
|
|
114
|
+
return /* @__PURE__ */ e.jsx(V, {});
|
|
114
115
|
case "DataProvider":
|
|
115
|
-
return /* @__PURE__ */ e.jsx(
|
|
116
|
+
return /* @__PURE__ */ e.jsx(ze, { size: 16 });
|
|
116
117
|
case "Box":
|
|
117
|
-
return /* @__PURE__ */ e.jsx(
|
|
118
|
+
return /* @__PURE__ */ e.jsx(F, {});
|
|
118
119
|
default:
|
|
119
|
-
return /* @__PURE__ */ e.jsx(
|
|
120
|
+
return /* @__PURE__ */ e.jsx(L, {});
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
|
-
function
|
|
123
|
+
function Je(t = "") {
|
|
123
124
|
const s = {
|
|
124
125
|
xs: "390px",
|
|
125
126
|
sm: "640px",
|
|
@@ -142,18 +143,18 @@ function et(t = "") {
|
|
|
142
143
|
}
|
|
143
144
|
return "";
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
+
const Xe = (t) => {
|
|
146
147
|
let s = "";
|
|
147
148
|
return Object.keys(t).forEach((o) => {
|
|
148
|
-
|
|
149
|
+
E(t[o], Ye) && (s = t[o]);
|
|
149
150
|
}), s;
|
|
150
|
-
},
|
|
151
|
+
}, et = (t) => {
|
|
151
152
|
var p;
|
|
152
|
-
const [, s] =
|
|
153
|
-
|
|
154
|
-
}, j =
|
|
155
|
-
const
|
|
156
|
-
return
|
|
153
|
+
const [, s] = ke(), [o] = ye(), { isSelected: r } = t, { id: a, data: c } = t.node, x = t.depth * 10, d = (l) => {
|
|
154
|
+
l.stopPropagation(), t.onToggle(t.node.id);
|
|
155
|
+
}, j = be(a, t.isOpen, t.onToggle), m = Ge(() => {
|
|
156
|
+
const l = Xe(t.node.data);
|
|
157
|
+
return Je(l);
|
|
157
158
|
}, [t.node.data]);
|
|
158
159
|
return (
|
|
159
160
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
@@ -161,26 +162,26 @@ const tt = (t) => {
|
|
|
161
162
|
"div",
|
|
162
163
|
{
|
|
163
164
|
onMouseEnter: () => s(a),
|
|
164
|
-
className:
|
|
165
|
+
className: w(
|
|
165
166
|
"group flex w-full items-center justify-between space-x-px py-px ",
|
|
166
167
|
r ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
|
|
167
168
|
),
|
|
168
|
-
onClick: (
|
|
169
|
-
|
|
169
|
+
onClick: (l) => {
|
|
170
|
+
l.stopPropagation(), !o.includes(a) && t.onSelect(a);
|
|
170
171
|
},
|
|
171
172
|
onContextMenu: () => t.onSelect(a),
|
|
172
|
-
style: { paddingInlineStart:
|
|
173
|
+
style: { paddingInlineStart: x },
|
|
173
174
|
...j,
|
|
174
175
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
175
176
|
/* @__PURE__ */ e.jsx(
|
|
176
177
|
"div",
|
|
177
178
|
{
|
|
178
179
|
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" : ""}`,
|
|
179
|
-
children: t.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick:
|
|
180
|
+
children: t.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick: d, type: "button", children: /* @__PURE__ */ e.jsx(ce, {}) })
|
|
180
181
|
}
|
|
181
182
|
),
|
|
182
183
|
/* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex items-center", children: [
|
|
183
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(
|
|
184
|
+
/* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(S, { type: c == null ? void 0 : c._type }) }),
|
|
184
185
|
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((p = t.node.data) == null ? void 0 : p._name) || t.node.text }),
|
|
185
186
|
m ? /* @__PURE__ */ e.jsxs(
|
|
186
187
|
"span",
|
|
@@ -198,98 +199,85 @@ const tt = (t) => {
|
|
|
198
199
|
}
|
|
199
200
|
)
|
|
200
201
|
);
|
|
201
|
-
},
|
|
202
|
+
}, tt = (t) => {
|
|
202
203
|
var o;
|
|
203
204
|
const { item: s } = t.monitorProps;
|
|
204
205
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700", children: [
|
|
205
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(
|
|
206
|
+
/* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(S, { type: (o = s == null ? void 0 : s.data) == null ? void 0 : o._type }) }),
|
|
206
207
|
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: s.text })
|
|
207
208
|
] });
|
|
208
|
-
},
|
|
209
|
+
}, st = (t) => {
|
|
209
210
|
const s = t.depth * 10 + 16;
|
|
210
211
|
return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: s } });
|
|
211
|
-
},
|
|
212
|
-
const [t] = g(), [, s] =
|
|
213
|
-
return /* @__PURE__ */ e.jsxs(
|
|
214
|
-
/* @__PURE__ */ e.jsx(
|
|
212
|
+
}, ot = $e(() => import("./MarkAsGlobalBlock-aqik3ouc.js")), nt = () => {
|
|
213
|
+
const [t] = g(), [, s] = Be();
|
|
214
|
+
return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
|
|
215
|
+
/* @__PURE__ */ e.jsx(le, {}),
|
|
215
216
|
" Cut"
|
|
216
217
|
] });
|
|
217
|
-
},
|
|
218
|
-
const [t] = g(), [, s] =
|
|
219
|
-
return /* @__PURE__ */ e.jsxs(
|
|
220
|
-
/* @__PURE__ */ e.jsx(
|
|
218
|
+
}, rt = () => {
|
|
219
|
+
const [t] = g(), [, s] = Ce();
|
|
220
|
+
return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
|
|
221
|
+
/* @__PURE__ */ e.jsx(ie, {}),
|
|
221
222
|
" Copy"
|
|
222
223
|
] });
|
|
223
|
-
},
|
|
224
|
-
const [t] = g(), s =
|
|
224
|
+
}, at = () => {
|
|
225
|
+
const [t] = g(), s = ve(), o = we();
|
|
225
226
|
return /* @__PURE__ */ e.jsxs(
|
|
226
|
-
|
|
227
|
+
i,
|
|
227
228
|
{
|
|
228
229
|
disabled: (o == null ? void 0 : o._type) === "Slot",
|
|
229
230
|
className: "flex items-center gap-x-4 text-xs",
|
|
230
231
|
onClick: () => s(t),
|
|
231
232
|
children: [
|
|
232
|
-
/* @__PURE__ */ e.jsx(
|
|
233
|
+
/* @__PURE__ */ e.jsx(xe, {}),
|
|
233
234
|
" Remove"
|
|
234
235
|
]
|
|
235
236
|
}
|
|
236
237
|
);
|
|
237
|
-
},
|
|
238
|
+
}, ct = ({
|
|
238
239
|
id: t = null,
|
|
239
240
|
openMarkAsGlobalModal: s
|
|
240
241
|
}) => {
|
|
241
|
-
const [o] = g(), r =
|
|
242
|
+
const [o] = g(), r = Se(), { pasteBlocks: a, canPaste: c } = De(), x = Te("globalBlocksSupport", !1), d = Ke(() => {
|
|
242
243
|
r(o);
|
|
243
244
|
}, [o, r]);
|
|
244
|
-
return /* @__PURE__ */ e.jsxs(
|
|
245
|
-
|
|
246
|
-
/* @__PURE__ */ e.jsx(
|
|
245
|
+
return /* @__PURE__ */ e.jsxs(Ne, { className: "text-xs", children: [
|
|
246
|
+
x && /* @__PURE__ */ e.jsx(i, { className: "flex items-center gap-x-4 border-b text-xs", onClick: s, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-4", children: [
|
|
247
|
+
/* @__PURE__ */ e.jsx(de, {}),
|
|
247
248
|
" Mark as global"
|
|
248
249
|
] }) }),
|
|
249
|
-
/* @__PURE__ */ e.jsxs(
|
|
250
|
-
/* @__PURE__ */ e.jsx(
|
|
250
|
+
/* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: d, children: [
|
|
251
|
+
/* @__PURE__ */ e.jsx(me, {}),
|
|
251
252
|
" Duplicate"
|
|
252
253
|
] }),
|
|
253
|
-
/* @__PURE__ */ e.jsx(
|
|
254
|
-
/* @__PURE__ */ e.jsx(
|
|
254
|
+
/* @__PURE__ */ e.jsx(nt, {}),
|
|
255
|
+
/* @__PURE__ */ e.jsx(rt, {}),
|
|
255
256
|
/* @__PURE__ */ e.jsxs(
|
|
256
|
-
|
|
257
|
+
i,
|
|
257
258
|
{
|
|
258
259
|
className: "flex items-center gap-x-4 text-xs",
|
|
259
260
|
onClick: () => a(t),
|
|
260
261
|
disabled: !c,
|
|
261
262
|
children: [
|
|
262
|
-
/* @__PURE__ */ e.jsx(
|
|
263
|
+
/* @__PURE__ */ e.jsx(pe, {}),
|
|
263
264
|
" Paste"
|
|
264
265
|
]
|
|
265
266
|
}
|
|
266
267
|
),
|
|
267
|
-
/* @__PURE__ */ e.jsx(
|
|
268
|
+
/* @__PURE__ */ e.jsx(at, {})
|
|
268
269
|
] });
|
|
269
|
-
},
|
|
270
|
-
const [o, r] =
|
|
270
|
+
}, lt = ({ children: t, id: s = null }) => {
|
|
271
|
+
const [o, r] = Qe(!1);
|
|
271
272
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
272
|
-
/* @__PURE__ */ e.jsx(
|
|
273
|
-
/* @__PURE__ */ e.jsxs(
|
|
274
|
-
/* @__PURE__ */ e.jsx(
|
|
275
|
-
/* @__PURE__ */ e.jsx(
|
|
273
|
+
/* @__PURE__ */ e.jsx(Me, { open: o, onOpenChange: r, children: o && /* @__PURE__ */ e.jsx(Oe, { children: /* @__PURE__ */ e.jsx(Ue, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(ot, { closeModal: () => r(!1), id: s }) }) }) }),
|
|
274
|
+
/* @__PURE__ */ e.jsxs(Re, { children: [
|
|
275
|
+
/* @__PURE__ */ e.jsx(Ee, { children: t }),
|
|
276
|
+
/* @__PURE__ */ e.jsx(ct, { id: s, openMarkAsGlobalModal: () => r(!0) })
|
|
276
277
|
] })
|
|
277
278
|
] });
|
|
278
|
-
}, xt = () => {
|
|
279
|
-
const { addCoreBlock: t } = He(), s = w("getExternalPredefinedBlock");
|
|
280
|
-
return S(
|
|
281
|
-
async (o) => {
|
|
282
|
-
const { block: r, dropTargetId: a, relativeIndex: c } = o;
|
|
283
|
-
if (H(r, "format")) {
|
|
284
|
-
const l = await s(r);
|
|
285
|
-
return t({ blocks: l }, a === 0 ? null : a, c);
|
|
286
|
-
}
|
|
287
|
-
return t(r, a === 0 ? null : a, c);
|
|
288
|
-
},
|
|
289
|
-
[t]
|
|
290
|
-
);
|
|
291
279
|
};
|
|
292
|
-
function
|
|
280
|
+
function it(t) {
|
|
293
281
|
return v(t, (s) => {
|
|
294
282
|
const { data: o } = s;
|
|
295
283
|
return {
|
|
@@ -298,24 +286,19 @@ function mt(t) {
|
|
|
298
286
|
};
|
|
299
287
|
});
|
|
300
288
|
}
|
|
301
|
-
const
|
|
302
|
-
const t =
|
|
303
|
-
const { dragSource:
|
|
304
|
-
s(
|
|
305
|
-
|
|
306
|
-
dropTargetId: E,
|
|
307
|
-
destinationIndex: b,
|
|
308
|
-
relativeIndex: I
|
|
309
|
-
}), p(!1));
|
|
310
|
-
}, N = v(t, (n) => ({
|
|
289
|
+
const gs = () => {
|
|
290
|
+
const t = _e(), [s] = Ae(), [o, r, a] = g(), [, c] = He(), { t: x } = Ie(), { createSnapshot: d } = Pe(), j = qe(), m = Ze(), [, p] = We(Le), l = async (n, u) => {
|
|
291
|
+
const { dragSource: b, relativeIndex: f, dropTargetId: I, monitor: O } = u, R = it(n);
|
|
292
|
+
s(R), b ? d() : (await m({ block: O.getItem(), dropTargetId: I, relativeIndex: f }), p(!1));
|
|
293
|
+
}, D = v(t, (n) => ({
|
|
311
294
|
id: n._id,
|
|
312
295
|
text: n._type,
|
|
313
296
|
parent: n._parent || 0,
|
|
314
|
-
droppable: !
|
|
297
|
+
droppable: !_(A(t, { _parent: n._id })),
|
|
315
298
|
data: n
|
|
316
|
-
})),
|
|
299
|
+
})), T = () => {
|
|
317
300
|
r([]), c([]);
|
|
318
|
-
}, [{ isOver: h },
|
|
301
|
+
}, [{ isOver: h }, N] = je(() => ({
|
|
319
302
|
accept: ["CHAI_BLOCK"],
|
|
320
303
|
collect: (n) => ({
|
|
321
304
|
canDrop: n.canDrop(),
|
|
@@ -325,54 +308,53 @@ const hs = () => {
|
|
|
325
308
|
(async () => (await m({
|
|
326
309
|
block: n,
|
|
327
310
|
dropTargetId: "",
|
|
328
|
-
destinationIndex: 0,
|
|
329
311
|
relativeIndex: 0
|
|
330
312
|
}), p(!1)))();
|
|
331
313
|
}
|
|
332
|
-
})), { isDragging:
|
|
314
|
+
})), { isDragging: M } = he((n) => ({
|
|
333
315
|
isDragging: n.isDragging()
|
|
334
316
|
}));
|
|
335
317
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
|
|
336
318
|
"div",
|
|
337
319
|
{
|
|
338
|
-
onClick: () =>
|
|
339
|
-
className:
|
|
320
|
+
onClick: () => T(),
|
|
321
|
+
className: w(
|
|
340
322
|
"-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",
|
|
341
|
-
|
|
323
|
+
M ? "bg-green-50/80" : "bg-background"
|
|
342
324
|
),
|
|
343
|
-
children:
|
|
325
|
+
children: H(t) ? /* @__PURE__ */ e.jsxs(
|
|
344
326
|
"div",
|
|
345
327
|
{
|
|
346
|
-
ref:
|
|
328
|
+
ref: N,
|
|
347
329
|
className: `mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${h ? "bg-blue-200" : ""}`,
|
|
348
330
|
children: [
|
|
349
|
-
h ? /* @__PURE__ */ e.jsx(
|
|
350
|
-
/* @__PURE__ */ e.jsx("p", { className: "mt-2", children:
|
|
331
|
+
h ? /* @__PURE__ */ e.jsx(ue, { className: "mx-auto h-12 w-12 animate-bounce" }) : /* @__PURE__ */ e.jsx(ge, { className: "mx-auto h-10 w-10" }),
|
|
332
|
+
/* @__PURE__ */ e.jsx("p", { className: "mt-2", children: x(h ? "drop_here_message" : "tree_view_no_blocks") })
|
|
351
333
|
]
|
|
352
334
|
}
|
|
353
|
-
) : /* @__PURE__ */ e.jsx(
|
|
354
|
-
|
|
335
|
+
) : /* @__PURE__ */ e.jsx(Fe, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
|
|
336
|
+
fe,
|
|
355
337
|
{
|
|
356
338
|
initialOpen: j,
|
|
357
339
|
extraAcceptTypes: ["CHAI_BLOCK"],
|
|
358
|
-
tree:
|
|
340
|
+
tree: D,
|
|
359
341
|
rootId: 0,
|
|
360
|
-
render: (n, { depth: u, isOpen:
|
|
361
|
-
|
|
342
|
+
render: (n, { depth: u, isOpen: b, onToggle: f }) => /* @__PURE__ */ e.jsx(lt, { id: n.id, children: /* @__PURE__ */ e.jsx(
|
|
343
|
+
et,
|
|
362
344
|
{
|
|
363
345
|
onSelect: (I) => {
|
|
364
346
|
c([]), r([I]);
|
|
365
347
|
},
|
|
366
|
-
isSelected:
|
|
348
|
+
isSelected: P(o, n.id),
|
|
367
349
|
node: n,
|
|
368
350
|
depth: u,
|
|
369
|
-
isOpen:
|
|
370
|
-
onToggle:
|
|
351
|
+
isOpen: b,
|
|
352
|
+
onToggle: f,
|
|
371
353
|
toggleIds: a
|
|
372
354
|
}
|
|
373
355
|
) }),
|
|
374
|
-
dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(
|
|
375
|
-
onDrop:
|
|
356
|
+
dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(tt, { monitorProps: n }),
|
|
357
|
+
onDrop: l,
|
|
376
358
|
classes: {
|
|
377
359
|
root: "h-full pt-2",
|
|
378
360
|
draggingSource: "opacity-30",
|
|
@@ -381,15 +363,15 @@ const hs = () => {
|
|
|
381
363
|
},
|
|
382
364
|
sort: !1,
|
|
383
365
|
insertDroppableFirst: !1,
|
|
384
|
-
canDrop:
|
|
366
|
+
canDrop: Ve,
|
|
385
367
|
dropTargetOffset: 2,
|
|
386
368
|
enableAnimateExpand: !0,
|
|
387
|
-
placeholderRender: (n, { depth: u }) => /* @__PURE__ */ e.jsx(
|
|
369
|
+
placeholderRender: (n, { depth: u }) => /* @__PURE__ */ e.jsx(st, { node: n, depth: u })
|
|
388
370
|
}
|
|
389
371
|
) })
|
|
390
372
|
}
|
|
391
373
|
) });
|
|
392
374
|
};
|
|
393
375
|
export {
|
|
394
|
-
|
|
376
|
+
gs as default
|
|
395
377
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import { GlobeIcon as m } from "@radix-ui/react-icons";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
|
-
import { $ as p, B as o } from "./index-
|
|
4
|
+
import { $ as p, B as o } from "./index-ORFlyrBx.js";
|
|
5
5
|
import { capitalize as c } from "lodash";
|
|
6
6
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
7
7
|
import "@radix-ui/react-toggle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-zkc4SQCu.cjs"),c=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,u]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:a=>u(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import i, { Suspense as s } from "react";
|
|
3
3
|
import { sortBy as a, filter as d, get as n } from "lodash";
|
|
4
|
-
import { a as l, b as c } from "./index-
|
|
4
|
+
import { a as l, b as c } from "./index-N3mTbV2j.js";
|
|
5
5
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
6
6
|
import "i18next";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-ORFlyrBx.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-PPBbw5bk.js";
|
|
@@ -56,7 +56,7 @@ import "./tailwind-config-d1VL1lzE.js";
|
|
|
56
56
|
import "react-hotkeys-hook";
|
|
57
57
|
import "sonner";
|
|
58
58
|
import "lucide-react";
|
|
59
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
59
|
+
const x = i.lazy(() => import("./add-page-modal-Njd5M7E2.js")), g = i.lazy(() => import("./page-viewer-e3lOBAH3.js")), bt = () => {
|
|
60
60
|
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);
|
|
61
61
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
62
62
|
/* @__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-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-pYZXf7hY.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-zkc4SQCu.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-U8EH-GIa.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-UxwOwHCO.cjs"))),d=()=>{const{data:q=[],isLoading:t}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(q,{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:t,pages:n})})]})};exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("lodash"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("lodash"),s=require("./index-zkc4SQCu.cjs"),a=require("./index-pYZXf7hY.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-DrLwWE-6.cjs"))),q=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-cERASO9j.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 m(){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(q,{_projectData:i,seany:o})})})]})]})})]})}exports.default=m;
|