@chaibuilder/sdk 1.2.26 → 1.2.28
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-l1JENNvq.js → AddBlocks-0sW6gkCO.js} +5 -5
- package/dist/AddBlocks-YJPdSqcY.cjs +1 -0
- package/dist/{BrandingOptions-udtH5yJs.js → BrandingOptions--vgnQvD1.js} +8 -8
- package/dist/{BrandingOptions-DkpqGARR.cjs → BrandingOptions-RDn_Nhcq.cjs} +1 -1
- package/dist/CanvasArea-41QoxuLf.cjs +55 -0
- package/dist/CanvasArea-aii0PyU-.js +1179 -0
- package/dist/{Class-lGzsNBOK.js → Class-6Hz2KzYb.js} +1 -1
- package/dist/{Class-PoYusiA5.cjs → Class-Zc8hpE7f.cjs} +1 -1
- package/dist/{CurrentPage-tJUjXWdb.js → CurrentPage-06Iacwyp.js} +6 -6
- package/dist/{CurrentPage-Hl52iub_.cjs → CurrentPage-2W1pdAOG.cjs} +1 -1
- package/dist/ListTree-DnA8gj-7.js +314 -0
- package/dist/ListTree-pdQ14QJC.cjs +1 -0
- package/dist/MODIFIERS-YPHRtwrM.cjs +1 -0
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-cBT31iqE.js} +3 -11
- package/dist/{PagesPanel-WzCocl6u.cjs → PagesPanel-PBFzPSNY.cjs} +1 -1
- package/dist/{PagesPanel-6rrLXEO-.js → PagesPanel-_1CDTUdE.js} +7 -7
- package/dist/{ProjectPanel-o7gdcwPn.cjs → ProjectPanel-755bbzEQ.cjs} +1 -1
- package/dist/{ProjectPanel-tz3bjdXy.js → ProjectPanel-pUMeIiUW.js} +7 -7
- package/dist/Settings-G9Xtqr7n.cjs +1 -0
- package/dist/{Settings-4s2LUVmC.js → Settings-dnO-s6x0.js} +596 -560
- package/dist/{SidePanels-3o6Okmvu.cjs → SidePanels-Gq2LdVuY.cjs} +1 -1
- package/dist/{SidePanels-bugFfInz.js → SidePanels-VxSXXkt_.js} +56 -56
- package/dist/{Topbar-pWzBEOed.js → Topbar-5zbOSGF6.js} +3 -3
- package/dist/{Topbar-CqW7G360.cjs → Topbar-J2tb4SA1.cjs} +1 -1
- package/dist/{UnsplashImages-qvwFbV-E.js → UnsplashImages-4WAWgA4s.js} +9 -9
- package/dist/{UnsplashImages-NGskB93R.cjs → UnsplashImages-XwjKheek.cjs} +1 -1
- package/dist/{UploadImages-9NapgXBq.js → UploadImages-PONIHtn6.js} +3 -3
- package/dist/{UploadImages-Oh7Glr9A.cjs → UploadImages-y7LAQVrT.cjs} +1 -1
- package/dist/{add-page-modal-k2Kb92HS.js → add-page-modal-4VrFvgEm.js} +7 -7
- package/dist/{add-page-modal--6TTBRYa.cjs → add-page-modal-jWcp0w-S.cjs} +1 -1
- package/dist/{confirm-alert-C4M9eF-o.cjs → confirm-alert-4OQlXZTJ.cjs} +1 -1
- package/dist/{confirm-alert-GUhZ_G8w.js → confirm-alert-j7b88hsW.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -4
- package/dist/{delete-page-modal-zONvdebd.js → delete-page-modal--xHHdRAq.js} +6 -6
- package/dist/{delete-page-modal-cFoL-wdo.cjs → delete-page-modal-p6b0upz4.cjs} +1 -1
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +4 -4
- package/dist/{form-STUz-6nE.js → form-_GJb9YcB.js} +1 -1
- package/dist/{form-lBQ_76Uw.cjs → form-jQj7E-hS.cjs} +1 -1
- package/dist/html-to-json-LJyJsnmZ.js +228 -0
- package/dist/html-to-json-vP1ESB_e.cjs +1 -0
- package/dist/{index-SkyM3d6Q.js → index-0QJwevON.js} +2 -2
- package/dist/index-12HbDLon.cjs +1 -0
- package/dist/{index-llTXLDGE.js → index-Eb5zyh2F.js} +4 -4
- package/dist/{index-mbyqq81O.cjs → index-KArv7pNz.cjs} +1 -1
- package/dist/{index-Gk6sASBd.js → index-UHaqEdws.js} +993 -957
- package/dist/{index-OB199Izc.cjs → index-mlMvwv2b.cjs} +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +4 -4
- package/dist/{page-viewer-Pdg9F5Hv.js → page-viewer-00Xx4u8e.js} +7 -7
- package/dist/{page-viewer-2kwnKM6v.cjs → page-viewer-SZNm7b1n.cjs} +1 -1
- package/dist/{project-general-setting-CnNL98NM.cjs → project-general-setting-C_pHNuZE.cjs} +1 -1
- package/dist/{project-general-setting-f8Ebsn6K.js → project-general-setting-asDxlmhZ.js} +7 -7
- package/dist/{project-seo-setting-pX34Qsym.js → project-seo-setting-DuAaDfDR.js} +4 -4
- package/dist/{project-seo-setting-mlxL_e2_.cjs → project-seo-setting-q2953ybQ.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.js +1 -1
- package/dist/{single-page-detail-dpe5LT0M.js → single-page-detail-UNxXvhl4.js} +14 -14
- package/dist/{single-page-detail-XfzrGlzA.cjs → single-page-detail-oqj6zsLU.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +6 -6
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +9 -9
- package/dist/useCanvasSettings-MR0Glu1b.cjs +1 -0
- package/dist/useCanvasSettings-R6br4J9i.js +6 -0
- package/dist/web-blocks.cjs +33 -6
- package/dist/web-blocks.js +461 -388
- package/package.json +1 -1
- package/dist/AddBlocks-zPPKkeKs.cjs +0 -1
- package/dist/CanvasArea-h0W-Tyha.js +0 -951
- package/dist/CanvasArea-zme1r3Zi.cjs +0 -55
- package/dist/ListTree-WvTjY5rr.cjs +0 -1
- package/dist/ListTree-cZ-Ihlt3.js +0 -309
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/Settings-AqoKwR92.cjs +0 -1
- package/dist/html-to-json-efmv1pCj.cjs +0 -1
- package/dist/html-to-json-ngX9ef2u.js +0 -185
- package/dist/index-h-hd6EvN.cjs +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";var ne=Object.defineProperty;var oe=(e,t,s)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var A=(e,t,s)=>(oe(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-Z_BpKhVy.cjs"),p=require("react"),c=require("lodash-es"),w=require("@radix-ui/react-icons"),o=require("./index-h-hd6EvN.cjs"),L=require("react-i18next"),B=require("jotai"),z=require("react-dom"),R=require("prop-types"),ie=require("react-quill"),Z=require("flagged"),re=require("@floating-ui/dom"),W=require("@floating-ui/react-dom"),le=require("@react-hookz/web"),ae=require("@bobthered/tailwindcss-palette-generator"),ce=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("react-wrap-balancer"),xe=require("tailwind-merge"),q=require("./STRINGS-gPz7CUOk.cjs"),me=require("@chaibuilder/runtime"),O=require("./index-OB199Izc.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.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("i18next");require("react-hotkeys-hook");const ge=()=>{const{hasUndo:e,hasRedo:t,undo:s,redo:l}=o.useUndoManager();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{})}),n.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:l,size:"sm",className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function he(){const[e,t]=o.useDarkMode(),{t:s}=L.useTranslation();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),n.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
|
-
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[n.jsxRuntimeExports.jsx("span",{className:"sr-only",children:s("use_setting")}),n.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
3
|
-
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const K=({landscape:e=!1})=>n.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[n.jsxRuntimeExports.jsx("g",{strokeWidth:0}),n.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),n.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),fe=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:n.jsxRuntimeExports.jsx(K,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:n.jsxRuntimeExports.jsx(K,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:n.jsxRuntimeExports.jsx(w.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:n.jsxRuntimeExports.jsx(w.DesktopIcon,{}),width:1920}],Y=({title:e,content:t,currentBreakpoint:s,breakpoint:l,width:a,icon:r,onClick:u})=>{const{t:i}=L.useTranslation();return n.jsxRuntimeExports.jsxs(o.HoverCard,{children:[n.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx(o.Button,{onClick:()=>u(a),size:"sm",variant:l===s?"secondary":"ghost",children:r})}),n.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:n.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[n.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:i(e)}),n.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i(t)})]})})})]})},je=()=>{const[,e,t]=o.useCanvasWidth(),[s,l]=o.useSelectedBreakpoints(),{t:a}=L.useTranslation(),r=o.useBuilderProp("breakpoints",fe),u=i=>{s.includes(i)?s.length>2&&l(s.filter(d=>d!==i)):l(d=>[...d,i])};return r.length<4?n.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:c.map(r,i=>p.createElement(Y,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e}))}):n.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[c.map(r.filter(i=>c.includes(s,c.toUpper(i.breakpoint))),i=>p.createElement(Y,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),n.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[n.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:n.jsxRuntimeExports.jsx(w.DotsVerticalIcon,{className:"scale-90 transform"})})}),n.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[n.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:a("Breakpoints")}),n.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),c.map(r,i=>n.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>u(c.toUpper(i.breakpoint)),checked:c.includes(s,c.toUpper(i.breakpoint)),children:a(i.title)},i.breakpoint))]})]})]})},ye=()=>{const{t:e}=L.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,s]=o.useSelectedBlockIds(),[,l]=o.useSelectedStylingBlocks(),a=p.useCallback(()=>{t([]),s([]),l([])},[t]);return n.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[n.jsxRuntimeExports.jsx(w.EraserIcon,{})," ",e("clear")]})}),n.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[n.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),n.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),n.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),n.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:a,children:e("yes")})]})]})]})})},Ee=()=>{const e=o.useBuilderProp("darkMode",!1),[t]=o.useCanvasZoom();return n.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[n.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(he,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,n.jsxRuntimeExports.jsx(je,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[n.jsxRuntimeExports.jsx(w.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",n.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[c.round(t,0),"%"]})]}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(ge,{})]}),n.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(ye,{})]})]})},ke=`<!doctype html>
|
|
4
|
-
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
-
<head>
|
|
6
|
-
<meta charset="UTF-8">
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
-
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
|
|
9
|
-
<style>
|
|
10
|
-
html { height: 100%; overflow:auto; }
|
|
11
|
-
body { height: 100%; }
|
|
12
|
-
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
-
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
-
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
-
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
-
html{
|
|
17
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
-
scrollbar-width: none; /* Firefox */
|
|
19
|
-
}
|
|
20
|
-
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
-
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
-
|
|
23
|
-
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
-
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
-
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
-
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
-
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
28
|
-
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
29
|
-
a{ pointer-events: none !important; }
|
|
30
|
-
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
31
|
-
[contenteditable="true"] {
|
|
32
|
-
outline: none;
|
|
33
|
-
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
34
|
-
-webkit-user-select: text;
|
|
35
|
-
-moz-user-select: text;
|
|
36
|
-
user-select: text;
|
|
37
|
-
}
|
|
38
|
-
.frame-root .frame-content { height: 100%; }
|
|
39
|
-
</style>
|
|
40
|
-
<style id="hidden-blocks"></style>
|
|
41
|
-
<style id="selected-block"></style>
|
|
42
|
-
<style id="selected-styling-block"></style>
|
|
43
|
-
<style id="highlighted-block"></style>
|
|
44
|
-
<style id="dragged-block"></style>
|
|
45
|
-
|
|
46
|
-
</head>
|
|
47
|
-
<body class="font-body antialiased h-full">
|
|
48
|
-
<div class="frame-root h-full"></div>
|
|
49
|
-
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
50
|
-
</body>
|
|
51
|
-
</html>`,ve=e=>{const[t]=o.useCanvasWidth(),[,s]=o.useCanvasZoom(),[l,a]=p.useState({}),r=p.useCallback(()=>{const{width:u,height:i}=e;if(u<t){const d=parseFloat((u/t).toFixed(2).toString());let x={};const m=i*d;i&&(x={height:100+(i-m)/m*100+"%"}),a({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...x,maxWidth:"none"}),s(d*100)}else a({}),s(100)},[t,e,s]);return p.useEffect(()=>{r()},[t,e,s,r]),l};let G,Q;typeof document<"u"&&(G=document);typeof window<"u"&&(Q=window);const J=p.createContext({document:G,window:Q}),$=()=>p.useContext(J),{Provider:be,Consumer:Qe}=J;class X extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}A(X,"propTypes",{children:R.element.isRequired,contentDidMount:R.func.isRequired,contentDidUpdate:R.func.isRequired});class F extends p.Component{constructor(s,l){super(s,l);A(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:l}=this.props;typeof l=="function"?l(s):l&&(l.current=s)});A(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});A(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const l=this.props.contentDidMount,a=this.props.contentDidUpdate,r=s.defaultView||s.parentView,u=n.jsxRuntimeExports.jsx(X,{contentDidMount:l,contentDidUpdate:a,children:n.jsxRuntimeExports.jsx(be,{value:{document:s,window:r},children:n.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),i=this.getMountTarget();return[z.createPortal(this.props.head,this.getDoc().head),z.createPortal(u,i)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,n.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}A(F,"propTypes",{style:R.object,head:R.node,initialContent:R.string,mountTarget:R.string,contentDidMount:R.func,contentDidUpdate:R.func,children:R.oneOfType([R.element,R.arrayOf(R.element)])}),A(F,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Re=p.forwardRef((e,t)=>n.jsxRuntimeExports.jsx(F,{...e,forwardedRef:t})),we=()=>{const{addCoreBlock:e}=o.useAddBlock(),t=o.useBuilderProp("getExternalPredefinedBlock",c.noop);return p.useCallback(async s=>{const{block:l,dropTargetId:a,relativeIndex:r}=s;if(c.has(l,"format")){const u=await t(l);return e({blocks:u},a===0?null:a,r)}return e(l,a===0?null:a,r)},[e])};let I=null,M=[],T=null,ee=null;function Be(e){const t=window.getComputedStyle(e),s=parseInt(t.paddingLeft,10),l=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),r=parseInt(t.paddingBottom,10);return{paddingLeft:s,paddingTop:l,paddingRight:a,paddingBottom:r}}const V=(e,t,s)=>{if(!I)return;const l=e.getBoundingClientRect(),a=I==null?void 0:I.getElementById("placeholder"),{paddingLeft:r,paddingTop:u,paddingRight:i,paddingBottom:d}=Be(e);a.style.width=t==="vertical"?l.width-r-i+"px":"2px",a.style.height=t==="vertical"?"2px":l.height-u-d+"px",a.style.display="block";const x=M.reduce((m,f)=>Math.abs(f-s)<Math.abs(m-s)?f:m);ee=M.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+r+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},Se=e=>{const t=te(e),s=window.getComputedStyle(e),l=t==="horizontal",a=parseInt(s.paddingLeft),r=parseInt(s.paddingTop);let u=l?a:r;M=[u],Array.from(e.children).forEach(i=>{const d=window.getComputedStyle(i),x=parseInt(l?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),m=l?i.offsetWidth:i.offsetHeight;M.push(u+m+x),u+=m+x})};function te(e){const t=window.getComputedStyle(e).display,s=window.getComputedStyle(e).flexDirection;if(t==="flex")return s==="column"||s==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const l=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(l.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const Ce=c.throttle(e=>{const t=e.target,s=te(t);if(s==="vertical"){const l=e.clientY-t.offsetTop;V(t,s,l)}else{const l=e.clientX-t.offsetLeft;V(t,s,l)}},200),Ie=e=>{e.preventDefault(),e.stopPropagation(),Ce(e)};function P(){const e=I==null?void 0:I.getElementById("placeholder");e.style.display="none"}const De=()=>{const{document:e}=$(),[t,s]=B.useAtom(o.draggingFlagAtom),l=we(),a=Z.useFeature("dnd"),[,r]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return I=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?Ie:c.noop,onDrop:a?i=>{T==null||T.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(i.dataTransfer.getData("text/plain"));let x=i.target.getAttribute("data-block-id");x===null&&(x=i.target.parentElement.getAttribute("data-block-id")),l({block:d,dropTargetId:x||null,relativeIndex:ee}),s(!1),P(),setTimeout(()=>{P()},300)}:c.noop,onDragEnter:a?i=>{const d=i;T=d.target,d.stopPropagation(),d.preventDefault(),M=[];const x=d.target;Se(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),s(!0),r(""),u([])}:c.noop,onDragLeave:a?i=>{const d=i;T=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:c.noop,onMouseOut:a?()=>{s(!1),P()}:c.noop}};function U(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Ae(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const _e=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,s]=o.useHighlightBlockId(),[l,a]=B.useAtom(o.inlineEditingActiveAtom);return r=>{var f;if(l)return;const u=U(r.target),i=u.getAttribute("data-block-type");if(!i||!e.includes(i))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(j=>{j.name!=="class"&&d.removeAttribute(j.name)}),i==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new ie.Quill(d,{placeholder:"Type here..."});function m(){const j=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:j}),u.removeAttribute("style"),d.removeEventListener("blur",m,!0),Ae(x),a(""),s("")}d.addEventListener("blur",m,!0),x.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),a(u.getAttribute("data-block-id"))}},Te=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[,s]=o.useHighlightBlockId(),[l]=B.useAtom(o.inlineEditingActiveAtom);return a=>{if(l)return;a.stopPropagation();const r=U(a.target);if(r!=null&&r.getAttribute("data-block-id")&&(r==null?void 0:r.getAttribute("data-block-id"))==="container"){t([]),e([]),s("");return}if(r!=null&&r.getAttribute("data-block-parent")){const u=r.getAttribute("data-style-prop"),i=r.getAttribute("data-style-id"),d=r.getAttribute("data-block-parent");e([{id:i,prop:u,blockId:d}]),t([d])}else r!=null&&r.getAttribute("data-block-id")&&t([r.getAttribute("data-block-id")]);s("")}},Me=c.throttle((e,t)=>{const s=U(e.target);s!=null&&s.getAttribute("data-style-id")&&t(s.getAttribute("data-style-id"))},100),Ne=()=>{const[,e]=o.useHighlightBlockId(),[t]=B.useAtom(o.inlineEditingActiveAtom);return s=>{t||Me(s,e)}},qe=({children:e})=>{const{document:t}=$(),[s]=o.useSelectedBlockIds(),[l,a]=o.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!c.isEmpty(l))return;const x=se(t,c.first(s));if(x){const m=x.getAttribute("data-style-prop");if(m){const f=x.getAttribute("data-style-id"),j=x.getAttribute("data-block-parent");a([{id:f,prop:m,blockId:j}])}}},100)},[t,s,a,l]);const r=_e(),u=Te(),i=Ne(),d=De();return n.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:r,onMouseMove:i,...c.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},se=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Le=()=>{const{window:e}=$(),[t,s]=o.useSelectedBlockIds(),[l]=o.useBlocksStore(),[,a]=o.useSelectedStylingBlocks(),{undo:r,redo:u}=o.useUndoManager(),i=o.useDuplicateBlocks(),[,d]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:m}=o.useSavePage(),[f]=B.useAtom(o.inlineEditingActiveAtom),[,j]=B.useAtom(o.editLayerNameAtom),b=y=>{y.key==="Enter"&&(y.preventDefault(),t.length===1&&j(c.first(t)))},S=y=>{const h=l.find(v=>v._id===y);return h?h._parent:null};return p.useEffect(()=>{const y=h=>{if(h.key==="Escape"){s([]),a([]);return}if(b(h),!f&&(h.key==="Delete"||h.key==="Backspace")&&(h.preventDefault(),x(t)),h.ctrlKey||h.metaKey){if(h.key==="ArrowUp"){h.preventDefault();const v=t.length>0?S(t[0]):null;v&&s([v])}if(["z","y","d","x","c","p","s","v"].includes(h.key)){if(f&&["x","z","v"].includes(h.key))return!0;h.preventDefault()}h.key==="s"&&(h.stopPropagation(),h.preventDefault(),m()),h.key==="z"&&r(),h.key==="y"&&u(),h.key==="d"&&i(t)}};return e.removeEventListener("keydown",y),e.addEventListener("keydown",y),()=>{e.removeEventListener("keydown",y)}},[t,s,r,x,d,u,i,f,m,e]),null},$e=({block:e,label:t})=>{const[,s]=o.useSelectedBlockIds(),[,l]=o.useHighlightBlockId(),[,a]=B.useAtom(o.draggedBlockIdAtom),r=Z.useFeature("dnd");return n.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:r?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(c.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{s([]),l(null)},200)},children:[n.jsxRuntimeExports.jsx(w.DragHandleDots2Icon,{}),t]})},Pe=({selectedBlockElement:e,block:t})=>{const s=o.useRemoveBlocks(),l=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),[u]=B.useAtom(o.inlineEditingActiveAtom),{floatingStyles:i,refs:d,update:x}=W.useFloating({placement:"top-start",middleware:[W.shift(),re.flip()],elements:{reference:e}});le.useResizeObserver(e,()=>x(),e!==null);const m=c.get(t,"_parent",null),f=c.isEmpty(c.get(t,"_name",""))?c.get(t,"_type",""):c.get(t,"_name","");return!e||!t||u?null:n.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:i,onClick:j=>{j.stopPropagation(),j.preventDefault()},onKeyDown:j=>j.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[n.jsxRuntimeExports.jsx($e,{label:f,block:t}),n.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[m&&n.jsxRuntimeExports.jsx(w.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{r([]),a([m])}}),o.canDuplicateBlock(c.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.CopyIcon,{className:"hover:scale-105",onClick:()=>l([t==null?void 0:t._id])}):null,o.canDeleteBlock(c.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.TrashIcon,{className:"hover:scale-105",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},Fe=({model:e})=>{const[t]=o.useBrandingOptions(),[s]=o.useSelectedBlockIds(),[l]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[r]=o.useSelectedStylingBlocks(),[u]=B.useAtom(o.draggedBlockIdAtom),{document:i,window:d}=$(),[x]=p.useState(i==null?void 0:i.getElementById("highlighted-block")),[m]=p.useState(i==null?void 0:i.getElementById("selected-block")),[f]=p.useState(i==null?void 0:i.getElementById("selected-styling-block")),[j]=p.useState(i==null?void 0:i.getElementById("dragged-block"));p.useEffect(()=>{l?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[l,i]);const b=c.get(t,"headingFont","DM Sans"),S=c.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const y=c.get(t,"primaryColor","#000"),h=c.get(t,"secondaryColor","#FFF"),v=ae.tailwindcssPaletteGenerator({colors:[y,h],names:["primary","secondary"]});v.primary.DEFAULT=y,v.secondary.DEFAULT=h;const _=c.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[b],body:[S]},extend:{borderRadius:{global:`${_||"0"}px`},colors:v}},plugins:[ce,de,ue,d.tailwind.plugin.withOptions(()=>({addVariant:N,e:C})=>{N("hs-accordion-active",[({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active.${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle.${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${C(`hs-accordion-active${g}${E}`)}`)}]),N("hs-accordion-selected",({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion .selected.${C(`hs-accordion-selected${g}${E}`)}`)})})]})},[t,d,b,S]),p.useEffect(()=>{m&&(m.textContent=`${c.map(s,y=>`[data-block-id="${y}"]`).join(",")}{
|
|
52
|
-
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
53
|
-
}`)},[s,m]),p.useEffect(()=>{if(!u){j.textContent="";return}j.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),p.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,s,x]),p.useEffect(()=>{f&&(f.textContent=`${c.map(r,({id:y})=>`[data-style-id="${y}"]`).join(",")}{
|
|
54
|
-
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
55
|
-
}`)},[r,f]),p.useEffect(()=>{const y=c.get(t,"bodyTextLightColor","#64748b"),h=c.get(t,"bodyTextDarkColor","#94a3b8"),v=c.get(t,"bodyBgLightColor","#FFFFFF"),_=c.get(t,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${y}] bg-[${v}] dark:text-[${h}] dark:bg-[${_}]`},[t,i,e]),e==="page"?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[b&&n.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${b.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),S&&b!==S&&n.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${S.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),b&&n.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${b}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},He=e=>{const t={};return Object.keys(e).forEach(s=>{c.isString(e[s])&&e[s].startsWith(q.SLOT_KEY)&&(t[s]=e[s].replace(q.SLOT_KEY,"").split(","))}),t},Oe=c.memoize(e=>{const t=e.replace(q.STYLES_KEY,"").split(",");return xe.twMerge(t[0],t[1])});function Ue(e,t){return c.get(e,`${t}_attrs`,{})}function ze(e){const t={};return Object.keys(e).forEach(s=>{if(c.isString(e[s])&&e[s].startsWith(q.STYLES_KEY)){const l=Oe(e[s]);t[s]={className:l,"data-style-prop":s,"data-block-parent":e._id,"data-style-id":`${s}-${e._id}`,...Ue(e,s)}}}),t}function We(e,t){const s=c.get(e,"_bindings",{});return c.isEmpty(s)?{...e}:(c.each(s,(l,a)=>{c.isString(l)&&c.get(t,l,null)&&(e[a]=c.get(t,l,null))}),e)}function H({blocks:e}){const[t]=o.useBlocksStore(),s=p.useCallback(r=>ze(r),[]),[l]=O.useChaiExternalData(),[a]=B.useAtom(o.inlineEditingActiveAtom);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((r,u)=>{if(a===r._id)return null;const i=He(r),d={};c.isEmpty(i)||Object.keys(i).forEach(j=>{d[j]=p.Children.toArray(i[j].map(b=>n.jsxRuntimeExports.jsx(H,{blocks:[c.find(t,{_id:b})]})))});const x=c.filter(t,{_parent:r._id});d.children=x.length?n.jsxRuntimeExports.jsx(H,{blocks:x}):null;const m=me.getBlockComponent(r._type),f=c.get(m,"builderComponent",c.get(m,"component",null));return c.isNull(f)?n.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${r==null?void 0:r._type} not registered -->`}):n.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(f,{blockProps:{"data-block-id":r._id,"data-block-type":r._type,"data-dnd":c.has(m,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...We(r,l),...s(r),...d})})}))})}const Ke=()=>{const[e]=o.useBlocksStore(),t=c.isEmpty(e)?null:n.jsxRuntimeExports.jsx(O.BlocksExternalDataProvider,{children:n.jsxRuntimeExports.jsx(H,{blocks:c.filter(e,s=>c.isEmpty(s._parent))})});return n.jsxRuntimeExports.jsx(pe.Provider,{children:t})},Ye=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Ve=()=>{const[e]=B.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[s]=o.useCanvasWidth(),[,l]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,r]=o.useHighlightBlockId(),u=p.useRef(null),i=p.useRef(null),[d,x]=p.useState({width:0,height:0}),m=ve(d),[f,j]=p.useState(0),[b,S]=p.useState([]),[,y]=p.useState([]),[,h]=B.useAtom(o.canvasIframeAtom),[v,_]=o.useSelectedStylingBlocks(),N=o.useBuilderProp("loading",!1);p.useEffect(()=>{const{clientWidth:g,clientHeight:E}=i.current;x({width:g,height:E}),f===0&&j(g)},[i,s,f]);const C=(g,E=0)=>{const{top:D}=g.getBoundingClientRect();return D+E>=0&&D-E<=window.innerHeight};p.useEffect(()=>{var g,E;if(a&&a.type!=="Multiple"&&u.current){const D=se(u.current.contentDocument,a._id);D&&(C(D)||(E=(g=u.current)==null?void 0:g.contentWindow)==null||E.scrollTo({top:D.offsetTop,behavior:"smooth"}),S([D]))}},[a]),p.useEffect(()=>{if(!c.isEmpty(v)&&u.current){const g=Ye(u.current.contentDocument,c.first(v).id);y(g?[g]:[null])}else y([null])},[v]);const k=p.useMemo(()=>{let g=ke;return e==="offline"&&(g=g.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),g=g.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),g=g.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),g},[e]);return n.jsxRuntimeExports.jsx("div",{onClick:()=>{l([]),_([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:f>0&&!c.isEmpty(m)?{width:t?"100%":f}:{},ref:i,children:n.jsxRuntimeExports.jsxs(Re,{contentDidMount:()=>h(u.current),ref:u,id:"canvas-iframe",style:{width:`${s}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:k,children:[n.jsxRuntimeExports.jsx(Le,{}),n.jsxRuntimeExports.jsx(Pe,{block:a,selectedBlockElement:c.first(b)}),n.jsxRuntimeExports.jsx(Fe,{model:"page"}),n.jsxRuntimeExports.jsx(qe,{children:N?n.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):n.jsxRuntimeExports.jsx(Ke,{})}),n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ze=()=>n.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[n.jsxRuntimeExports.jsx(Ee,{}),n.jsxRuntimeExports.jsx("div",{className:"relative h-full overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2",children:n.jsxRuntimeExports.jsx(p.Suspense,{fallback:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:n.jsxRuntimeExports.jsx(O.ErrorBoundary,{children:n.jsxRuntimeExports.jsx(Ve,{})})})})]});exports.default=Ze;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),k=require("jotai"),I=require("@react-hookz/web"),q=require("react-arborist"),n=require("./index-h-hd6EvN.cjs"),y=require("./Functions-N3yhPYKY.cjs"),s=require("@radix-ui/react-icons"),B=require("lucide-react"),f=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@chaibuilder/runtime");require("./STRINGS-gPz7CUOk.cjs");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("clsx");require("tailwind-merge");require("react-i18next");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");const v=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(B.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}},C={display:"flex",alignItems:"center",zIndex:1},T=m.memo(function({top:o,left:r}){const a={position:"absolute",pointerEvents:"none",top:o+"px",left:r+"px",right:0};return e.jsxRuntimeExports.jsx("div",{style:{...C,...a},children:e.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),w=m.memo(function({children:o,isDragging:r}){return r?e.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:o}):null}),D=m.memo(({id:t,isDragging:o,mouse:r})=>{const[a]=n.useBlocksStore(),i=m.useMemo(()=>a.find(d=>d._id===t),[a,t]),j=m.useMemo(()=>({transform:`translate(${(r==null?void 0:r.x)-10}px, ${(r==null?void 0:r.y)-10}px)`}),[r]);return r?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(w,{isDragging:o,children:e.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:j,children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${i==null?void 0:i._type}`,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:e.jsxRuntimeExports.jsx(v,{type:i==null?void 0:i._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(i==null?void 0:i._name)||(i==null?void 0:i._type)})]})})})}):e.jsxRuntimeExports.jsx("div",{className:"hidden"})}),S=()=>{const[t]=n.useSelectedBlockIds(),o=n.useRemoveBlocks(),r=n.useSelectedBlock();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:!n.canDeleteBlock(r==null?void 0:r._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>o(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},N=()=>{const[t]=n.useSelectedBlockIds(),o=n.useDuplicateBlocks(),r=n.useSelectedBlock(),a=m.useCallback(()=>{o(t)},[t,o]);return e.jsxRuntimeExports.jsxs(n.ContextMenuContent,{className:"text-xs",children:[e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:!n.canDuplicateBlock(r==null?void 0:r._type),className:"flex items-center gap-x-4 text-xs",onClick:a,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(S,{})]})},_=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(n.ContextMenu,{children:[e.jsxRuntimeExports.jsx(n.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(N,{})]})}),M=m.memo(({node:t,style:o,dragHandle:r})=>{const a=n.useBuilderProp("outlineMenuItems",[]),[,i]=n.useHighlightBlockId(),j=t.children.length>0,{id:d,data:u,isSelected:h,willReceiveDrop:R,isDragging:g,isEditing:E,handleClick:b}=t,c=I.useDebouncedCallback(x=>i(x),[],300),l=x=>{x.stopPropagation(),t.toggle()},p=x=>{x.stopPropagation(),t.toggle(),b(x)};return m.useEffect(()=>{const x=setTimeout(()=>{R&&!t.isOpen&&t.toggle()},500);return()=>clearTimeout(x)},[R,t]),e.jsxRuntimeExports.jsx(_,{id:d,children:e.jsxRuntimeExports.jsxs("div",{onClick:p,onMouseEnter:()=>c(d),style:o,"data-node-id":d,ref:r,className:y.cn("group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",h?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",R&&n.canAcceptChildBlock(u._type,"Icon")?"bg-green-200":"",g&&"opacity-20"),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:j&&e.jsxRuntimeExports.jsx("button",{onClick:l,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:e.jsxRuntimeExports.jsx(v,{type:u==null?void 0:u._type})}),E?e.jsxRuntimeExports.jsx(P,{node:t}):e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",onDoubleClick:x=>{x.stopPropagation(),t.edit(),t.deselect()},children:(u==null?void 0:u._name)||(u==null?void 0:u._type.split("/").pop())})]})]}),e.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:a.map(x=>e.jsxRuntimeExports.jsxs(n.Tooltip,{children:[e.jsxRuntimeExports.jsx(n.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:m.createElement(x.item,{blockId:d})}),e.jsxRuntimeExports.jsx(n.TooltipContent,{className:"z-[9999]",children:x.tooltip})]}))})]})})}),P=({node:t})=>e.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:t.data.name,onFocus:o=>o.currentTarget.select(),onBlur:o=>t.submit(o.currentTarget.value),onKeyDown:o=>{o.key==="Enter"&&t.submit(o.currentTarget.value)}}),A=()=>{const[t]=n.useBlocksStore();return(o,r)=>{var j;const a=(j=f.find(t,{_id:r}))==null?void 0:j._type,i=f.first(o.map(d=>{var u;return(u=f.find(t,{_id:d}))==null?void 0:u._type}));return n.canAcceptChildBlock(a,i)}},H=()=>{const[t]=k.useAtom(n.treeDSBlocks),[o,r]=n.useSelectedBlockIds(),a=n.useUpdateBlocksProps(),[,i]=n.useSelectedStylingBlocks(),{moveBlocks:j}=n.useBlocksStoreUndoableActions(),d=A(),u=()=>{r([]),i([])},h=({id:c,name:l,node:p})=>{a([c],{_name:l},p.data._name)},R=({dragIds:c,parentId:l,index:p})=>{d(c,l)&&j(c,l,p)},g=c=>{if(c.length===0)return;const l=c[0]?c[0].id:"";i([]),r([l])},E=c=>{var x;c.preventDefault();const l=c.target,p=l.getAttribute("data-node-id")||((x=l.closest("[data-node-id]"))==null?void 0:x.getAttribute("data-node-id"));p&&(i([]),r([p]))},b=I.useDebouncedCallback(({parentNode:c,dragNodes:l})=>{var p;return!n.canAcceptChildBlock(c==null?void 0:c.data._type,(p=l[0])==null?void 0:p.data._type)},[],300);return e.jsxRuntimeExports.jsx("div",{className:y.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"),onClick:()=>u(),children:e.jsxRuntimeExports.jsx("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs",children:e.jsxRuntimeExports.jsx(q.Tree,{height:800,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:o[0]||"",onRename:h,openByDefault:!1,onMove:R,rowHeight:20,data:t,renderCursor:T,onSelect:g,childrenAccessor:c=>c.children,width:"100%",renderDragPreview:D,indent:10,onContextMenu:E,disableDrop:b,idAccessor:"_id",children:M})})})};exports.default=H;
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import T, { memo as f, useMemo as v, useCallback as R, useEffect as H } from "react";
|
|
3
|
-
import { useAtom as P } from "jotai";
|
|
4
|
-
import { useDebouncedCallback as w } from "@react-hookz/web";
|
|
5
|
-
import { Tree as A } from "react-arborist";
|
|
6
|
-
import { E as D, r as b, s as z, a1 as _, bs as N, aS as E, t as L, bt as F, aR as V, bu as O, bv as $, h as U, Y as q, bw as y, ap as G, aq as K, ar as W, bx as Y, a5 as J, ac as Q, aM as X } from "./index-Gk6sASBd.js";
|
|
7
|
-
import { c as M } from "./Functions-7jnEwJyw.js";
|
|
8
|
-
import { BoxModelIcon as Z, BoxIcon as ee, DragHandleHorizontalIcon as te, ViewHorizontalIcon as se, BorderAllIcon as re, BorderTopIcon as oe, TableIcon as ne, DropdownMenuIcon as ce, RadiobuttonIcon as ae, InputIcon as ie, ButtonIcon as I, CheckboxIcon as le, GroupIcon as ue, SpaceBetweenVerticallyIcon as de, ColumnsIcon as xe, RowsIcon as k, TextIcon as C, SketchLogoIcon as pe, DividerHorizontalIcon as me, CodeIcon as he, CursorTextIcon as ge, VideoIcon as je, Link1Icon as fe, HeadingIcon as be, ImageIcon as ye, TrashIcon as ve, CopyIcon as Ie, TriangleRightIcon as ke } from "@radix-ui/react-icons";
|
|
9
|
-
import { DatabaseIcon as Ce } from "lucide-react";
|
|
10
|
-
import { find as B, first as Be } from "lodash-es";
|
|
11
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
12
|
-
import "@chaibuilder/runtime";
|
|
13
|
-
import "./STRINGS--j49GZJP.js";
|
|
14
|
-
import "./MODIFIERS-dytZ-osO.js";
|
|
15
|
-
import "./Class-lGzsNBOK.js";
|
|
16
|
-
import "clsx";
|
|
17
|
-
import "tailwind-merge";
|
|
18
|
-
import "react-i18next";
|
|
19
|
-
import "@radix-ui/react-toggle";
|
|
20
|
-
import "class-variance-authority";
|
|
21
|
-
import "@radix-ui/react-switch";
|
|
22
|
-
import "@radix-ui/react-slot";
|
|
23
|
-
import "@radix-ui/react-accordion";
|
|
24
|
-
import "@radix-ui/react-alert-dialog";
|
|
25
|
-
import "@radix-ui/react-dialog";
|
|
26
|
-
import "@radix-ui/react-label";
|
|
27
|
-
import "@radix-ui/react-scroll-area";
|
|
28
|
-
import "@radix-ui/react-tabs";
|
|
29
|
-
import "@radix-ui/react-tooltip";
|
|
30
|
-
import "@radix-ui/react-popover";
|
|
31
|
-
import "@radix-ui/react-menubar";
|
|
32
|
-
import "@radix-ui/react-hover-card";
|
|
33
|
-
import "@radix-ui/react-select";
|
|
34
|
-
import "@radix-ui/react-dropdown-menu";
|
|
35
|
-
import "@radix-ui/react-separator";
|
|
36
|
-
import "@radix-ui/react-toast";
|
|
37
|
-
import "cmdk";
|
|
38
|
-
import "@radix-ui/react-context-menu";
|
|
39
|
-
import "react-icons-picker";
|
|
40
|
-
import "react-dom";
|
|
41
|
-
import "react-quill";
|
|
42
|
-
const S = (t) => {
|
|
43
|
-
switch (t.type) {
|
|
44
|
-
case "Image":
|
|
45
|
-
return /* @__PURE__ */ e.jsx(ye, {});
|
|
46
|
-
case "Heading":
|
|
47
|
-
return /* @__PURE__ */ e.jsx(be, {});
|
|
48
|
-
case "Text":
|
|
49
|
-
return /* @__PURE__ */ e.jsx(C, {});
|
|
50
|
-
case "Link":
|
|
51
|
-
return /* @__PURE__ */ e.jsx(fe, {});
|
|
52
|
-
case "Video":
|
|
53
|
-
return /* @__PURE__ */ e.jsx(je, {});
|
|
54
|
-
case "RichText":
|
|
55
|
-
return /* @__PURE__ */ e.jsx(ge, {});
|
|
56
|
-
case "Button":
|
|
57
|
-
return /* @__PURE__ */ e.jsx(I, {});
|
|
58
|
-
case "CustomHTML":
|
|
59
|
-
return /* @__PURE__ */ e.jsx(he, {});
|
|
60
|
-
case "Divider":
|
|
61
|
-
return /* @__PURE__ */ e.jsx(me, {});
|
|
62
|
-
case "Icon":
|
|
63
|
-
return /* @__PURE__ */ e.jsx(pe, {});
|
|
64
|
-
case "List":
|
|
65
|
-
return /* @__PURE__ */ e.jsx(k, {});
|
|
66
|
-
case "Paragraph":
|
|
67
|
-
return /* @__PURE__ */ e.jsx(C, {});
|
|
68
|
-
case "Row":
|
|
69
|
-
return /* @__PURE__ */ e.jsx(k, {});
|
|
70
|
-
case "ListItem":
|
|
71
|
-
return /* @__PURE__ */ e.jsx(xe, {});
|
|
72
|
-
case "LineBreak":
|
|
73
|
-
return /* @__PURE__ */ e.jsx(de, {});
|
|
74
|
-
case "Form":
|
|
75
|
-
return /* @__PURE__ */ e.jsx(ue, {});
|
|
76
|
-
case "Checkbox":
|
|
77
|
-
return /* @__PURE__ */ e.jsx(le, {});
|
|
78
|
-
case "FormButton":
|
|
79
|
-
return /* @__PURE__ */ e.jsx(I, {});
|
|
80
|
-
case "Input":
|
|
81
|
-
case "TextArea":
|
|
82
|
-
return /* @__PURE__ */ e.jsx(ie, {});
|
|
83
|
-
case "Radio":
|
|
84
|
-
return /* @__PURE__ */ e.jsx(ae, {});
|
|
85
|
-
case "Select":
|
|
86
|
-
return /* @__PURE__ */ e.jsx(ce, {});
|
|
87
|
-
case "Table":
|
|
88
|
-
return /* @__PURE__ */ e.jsx(ne, {});
|
|
89
|
-
case "TableHead":
|
|
90
|
-
return /* @__PURE__ */ e.jsx(oe, {});
|
|
91
|
-
case "TableBody":
|
|
92
|
-
return /* @__PURE__ */ e.jsx(re, {});
|
|
93
|
-
case "TableRow":
|
|
94
|
-
return /* @__PURE__ */ e.jsx(se, {});
|
|
95
|
-
case "TableCell":
|
|
96
|
-
return /* @__PURE__ */ e.jsx(te, {});
|
|
97
|
-
case "DataProvider":
|
|
98
|
-
return /* @__PURE__ */ e.jsx(Ce, { size: 16 });
|
|
99
|
-
case "Box":
|
|
100
|
-
return /* @__PURE__ */ e.jsx(ee, {});
|
|
101
|
-
default:
|
|
102
|
-
return /* @__PURE__ */ e.jsx(Z, {});
|
|
103
|
-
}
|
|
104
|
-
}, Te = {
|
|
105
|
-
display: "flex",
|
|
106
|
-
alignItems: "center",
|
|
107
|
-
zIndex: 1
|
|
108
|
-
}, we = T.memo(function({ top: r, left: s }) {
|
|
109
|
-
const l = {
|
|
110
|
-
position: "absolute",
|
|
111
|
-
pointerEvents: "none",
|
|
112
|
-
top: r + "px",
|
|
113
|
-
left: s + "px",
|
|
114
|
-
right: 0
|
|
115
|
-
};
|
|
116
|
-
return /* @__PURE__ */ e.jsx("div", { style: { ...Te, ...l }, children: /* @__PURE__ */ e.jsx("div", { className: "h-0.5 flex-1 rounded-[1px] bg-green-500" }) });
|
|
117
|
-
}), De = f(function({ children: r, isDragging: s }) {
|
|
118
|
-
return s ? /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none fixed left-0 top-0 z-[100] h-full w-full", children: r }) : null;
|
|
119
|
-
}), _e = f(({ id: t, isDragging: r, mouse: s }) => {
|
|
120
|
-
const [l] = D(), o = v(() => l.find((d) => d._id === t), [l, t]), x = v(
|
|
121
|
-
() => ({
|
|
122
|
-
transform: `translate(${(s == null ? void 0 : s.x) - 10}px, ${(s == null ? void 0 : s.y) - 10}px)`
|
|
123
|
-
}),
|
|
124
|
-
[s]
|
|
125
|
-
);
|
|
126
|
-
return s ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(De, { isDragging: r, children: /* @__PURE__ */ e.jsx(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
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",
|
|
130
|
-
style: x,
|
|
131
|
-
children: /* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex !cursor-grab items-center p-0.5", "aria-label": `Type: ${o == null ? void 0 : o._type}`, children: [
|
|
132
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ e.jsx(S, { type: o == null ? void 0 : o._type }) }),
|
|
133
|
-
/* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: (o == null ? void 0 : o._name) || (o == null ? void 0 : o._type) })
|
|
134
|
-
] })
|
|
135
|
-
}
|
|
136
|
-
) }) }) : /* @__PURE__ */ e.jsx("div", { className: "hidden" });
|
|
137
|
-
}), Ne = () => {
|
|
138
|
-
const [t] = b(), r = z(), s = _();
|
|
139
|
-
return /* @__PURE__ */ e.jsxs(
|
|
140
|
-
N,
|
|
141
|
-
{
|
|
142
|
-
disabled: !E(s == null ? void 0 : s._type),
|
|
143
|
-
className: "flex items-center gap-x-4 text-xs",
|
|
144
|
-
onClick: () => r(t),
|
|
145
|
-
children: [
|
|
146
|
-
/* @__PURE__ */ e.jsx(ve, {}),
|
|
147
|
-
" Remove"
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
}, Me = () => {
|
|
152
|
-
const [t] = b(), r = L(), s = _(), l = R(() => {
|
|
153
|
-
r(t);
|
|
154
|
-
}, [t, r]);
|
|
155
|
-
return /* @__PURE__ */ e.jsxs(F, { className: "text-xs", children: [
|
|
156
|
-
/* @__PURE__ */ e.jsxs(
|
|
157
|
-
N,
|
|
158
|
-
{
|
|
159
|
-
disabled: !V(s == null ? void 0 : s._type),
|
|
160
|
-
className: "flex items-center gap-x-4 text-xs",
|
|
161
|
-
onClick: l,
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ e.jsx(Ie, {}),
|
|
164
|
-
" Duplicate"
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ e.jsx(Ne, {})
|
|
169
|
-
] });
|
|
170
|
-
}, Se = ({ children: t }) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(O, { children: [
|
|
171
|
-
/* @__PURE__ */ e.jsx($, { children: t }),
|
|
172
|
-
/* @__PURE__ */ e.jsx(Me, {})
|
|
173
|
-
] }) }), Re = f(({ node: t, style: r, dragHandle: s }) => {
|
|
174
|
-
const l = U("outlineMenuItems", []), [, o] = q(), x = t.children.length > 0, { id: d, data: a, isSelected: m, willReceiveDrop: p, isDragging: h, isEditing: g, handleClick: j } = t, n = w((c) => o(c), [], 300), i = (c) => {
|
|
175
|
-
c.stopPropagation(), t.toggle();
|
|
176
|
-
}, u = (c) => {
|
|
177
|
-
c.stopPropagation(), t.toggle(), j(c);
|
|
178
|
-
};
|
|
179
|
-
return H(() => {
|
|
180
|
-
const c = setTimeout(() => {
|
|
181
|
-
p && !t.isOpen && t.toggle();
|
|
182
|
-
}, 500);
|
|
183
|
-
return () => clearTimeout(c);
|
|
184
|
-
}, [p, t]), /* @__PURE__ */ e.jsx(Se, { id: d, children: /* @__PURE__ */ e.jsxs(
|
|
185
|
-
"div",
|
|
186
|
-
{
|
|
187
|
-
onClick: u,
|
|
188
|
-
onMouseEnter: () => n(d),
|
|
189
|
-
style: r,
|
|
190
|
-
"data-node-id": d,
|
|
191
|
-
ref: s,
|
|
192
|
-
className: M(
|
|
193
|
-
"group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",
|
|
194
|
-
m ? "bg-blue-500 text-white" : "text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
195
|
-
p && y(a._type, "Icon") ? "bg-green-200" : "",
|
|
196
|
-
h && "opacity-20"
|
|
197
|
-
),
|
|
198
|
-
children: [
|
|
199
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
200
|
-
/* @__PURE__ */ e.jsx(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
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" : ""}`,
|
|
204
|
-
children: x && /* @__PURE__ */ e.jsx("button", { onClick: i, type: "button", children: /* @__PURE__ */ e.jsx(ke, {}) })
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
208
|
-
/* @__PURE__ */ e.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ e.jsx(S, { type: a == null ? void 0 : a._type }) }),
|
|
209
|
-
g ? /* @__PURE__ */ e.jsx(He, { node: t }) : /* @__PURE__ */ e.jsx(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
className: "ml-2 truncate text-[11px]",
|
|
213
|
-
onDoubleClick: (c) => {
|
|
214
|
-
c.stopPropagation(), t.edit(), t.deselect();
|
|
215
|
-
},
|
|
216
|
-
children: (a == null ? void 0 : a._name) || (a == null ? void 0 : a._type.split("/").pop())
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
] })
|
|
220
|
-
] }),
|
|
221
|
-
/* @__PURE__ */ e.jsx("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: l.map((c) => /* @__PURE__ */ e.jsxs(G, { children: [
|
|
222
|
-
/* @__PURE__ */ e.jsx(
|
|
223
|
-
K,
|
|
224
|
-
{
|
|
225
|
-
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
226
|
-
asChild: !0,
|
|
227
|
-
children: T.createElement(c.item, { blockId: d })
|
|
228
|
-
}
|
|
229
|
-
),
|
|
230
|
-
/* @__PURE__ */ e.jsx(W, { className: "z-[9999]", children: c.tooltip })
|
|
231
|
-
] })) })
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
) });
|
|
235
|
-
}), He = ({ node: t }) => /* @__PURE__ */ e.jsx(
|
|
236
|
-
"input",
|
|
237
|
-
{
|
|
238
|
-
autoFocus: !0,
|
|
239
|
-
className: "ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",
|
|
240
|
-
type: "text",
|
|
241
|
-
defaultValue: t.data.name,
|
|
242
|
-
onFocus: (r) => r.currentTarget.select(),
|
|
243
|
-
onBlur: (r) => t.submit(r.currentTarget.value),
|
|
244
|
-
onKeyDown: (r) => {
|
|
245
|
-
r.key === "Enter" && t.submit(r.currentTarget.value);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
), Pe = () => {
|
|
249
|
-
const [t] = D();
|
|
250
|
-
return (r, s) => {
|
|
251
|
-
var x;
|
|
252
|
-
const l = (x = B(t, { _id: s })) == null ? void 0 : x._type, o = Be(r.map((d) => {
|
|
253
|
-
var a;
|
|
254
|
-
return (a = B(t, { _id: d })) == null ? void 0 : a._type;
|
|
255
|
-
}));
|
|
256
|
-
return y(l, o);
|
|
257
|
-
};
|
|
258
|
-
}, kt = () => {
|
|
259
|
-
const [t] = P(Y), [r, s] = b(), l = J(), [, o] = Q(), { moveBlocks: x } = X(), d = Pe(), a = () => {
|
|
260
|
-
s([]), o([]);
|
|
261
|
-
}, m = ({ id: n, name: i, node: u }) => {
|
|
262
|
-
l([n], { _name: i }, u.data._name);
|
|
263
|
-
}, p = ({ dragIds: n, parentId: i, index: u }) => {
|
|
264
|
-
d(n, i) && x(n, i, u);
|
|
265
|
-
}, h = (n) => {
|
|
266
|
-
if (n.length === 0)
|
|
267
|
-
return;
|
|
268
|
-
const i = n[0] ? n[0].id : "";
|
|
269
|
-
o([]), s([i]);
|
|
270
|
-
}, g = (n) => {
|
|
271
|
-
var c;
|
|
272
|
-
n.preventDefault();
|
|
273
|
-
const i = n.target, u = i.getAttribute("data-node-id") || ((c = i.closest("[data-node-id]")) == null ? void 0 : c.getAttribute("data-node-id"));
|
|
274
|
-
u && (o([]), s([u]));
|
|
275
|
-
}, j = w(
|
|
276
|
-
({ parentNode: n, dragNodes: i }) => {
|
|
277
|
-
var u;
|
|
278
|
-
return !y(n == null ? void 0 : n.data._type, (u = i[0]) == null ? void 0 : u.data._type);
|
|
279
|
-
},
|
|
280
|
-
[],
|
|
281
|
-
300
|
|
282
|
-
);
|
|
283
|
-
return /* @__PURE__ */ e.jsx("div", { className: M("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"), onClick: () => a(), children: /* @__PURE__ */ e.jsx("div", { id: "outline-view", className: "no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs", children: /* @__PURE__ */ e.jsx(
|
|
284
|
-
A,
|
|
285
|
-
{
|
|
286
|
-
height: 800,
|
|
287
|
-
className: "no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",
|
|
288
|
-
selection: r[0] || "",
|
|
289
|
-
onRename: m,
|
|
290
|
-
openByDefault: !1,
|
|
291
|
-
onMove: p,
|
|
292
|
-
rowHeight: 20,
|
|
293
|
-
data: t,
|
|
294
|
-
renderCursor: we,
|
|
295
|
-
onSelect: h,
|
|
296
|
-
childrenAccessor: (n) => n.children,
|
|
297
|
-
width: "100%",
|
|
298
|
-
renderDragPreview: _e,
|
|
299
|
-
indent: 10,
|
|
300
|
-
onContextMenu: g,
|
|
301
|
-
disableDrop: j,
|
|
302
|
-
idAccessor: "_id",
|
|
303
|
-
children: Re
|
|
304
|
-
}
|
|
305
|
-
) }) });
|
|
306
|
-
};
|
|
307
|
-
export {
|
|
308
|
-
kt as default
|
|
309
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=["hover","focus","focus-within","focus-visible","active","visited","target","first","last","only","odd","even","first-of-type","last-of-type","only-of-type","empty","disabled","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","open","before","after","first-letter","first-line","marker","selection","file","placeholder","ui-open","ui-disabled","ui-active","ui-selected","ui-checked","ui-not-open","ui-not-disabled","ui-not-active","ui-not-selected","ui-not-checked"],o={bodyFont:"Inter",headingFont:"Inter",roundedCorners:5,primaryColor:"#570df8",secondaryColor:"#f002b8",bodyBgDarkColor:"#031022",bodyBgLightColor:"#fcfcfc",bodyTextDarkColor:"#ffffff",bodyTextLightColor:"#000000"};exports.BRANDING_OPTIONS_DEFAULTS=o;exports.MODIFIERS=e;
|