efficient-easel 6.2.0 → 6.4.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/canvas/index.d.ts +14 -2
- package/dist/canvas/index.js +1 -1
- package/dist/canvas-typing-Dec_zyuM.d.ts +49 -0
- package/dist/{chunk-QBW3RJG5.js → chunk-3PPA5S2J.js} +1 -1
- package/dist/{chunk-EYRQ4XGN.js → chunk-6EKKPFVG.js} +1 -1
- package/dist/chunk-6XXW6ZW3.js +5 -0
- package/dist/{chunk-CRWFB7MU.js → chunk-7XHDCQVL.js} +16 -16
- package/dist/chunk-AWJUYMX7.js +1 -0
- package/dist/chunk-AYNU4FYF.js +14 -0
- package/dist/chunk-DSUMM2WF.js +10 -0
- package/dist/{chunk-3I6DVDUR.js → chunk-F4XCIEXI.js} +1 -1
- package/dist/chunk-ISBKAONU.js +1 -0
- package/dist/chunk-JIWPANGM.js +1 -0
- package/dist/{chunk-ZTG2K3NL.js → chunk-LWQQQ72E.js} +3 -3
- package/dist/chunk-NL4OU4UU.js +1 -0
- package/dist/{chunk-FXJBKKGI.js → chunk-NTMY5EXS.js} +1 -1
- package/dist/{chunk-RKXIB5BN.js → chunk-QPQXKKSC.js} +1 -1
- package/dist/chunk-TAF5AECR.js +65 -0
- package/dist/{chunk-G3D2HWEO.js → chunk-VFI3ONLN.js} +1 -1
- package/dist/chunk-YB4QPUEZ.js +5 -0
- package/dist/copy/index.d.ts +2 -47
- package/dist/copy/index.js +18 -18
- package/dist/drag/index.js +1 -1
- package/dist/easel/easel.css +17 -0
- package/dist/easel/index.d.ts +47 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +16 -16
- package/package.json +1 -1
- package/dist/chunk-2DHJC5YS.js +0 -5
- package/dist/chunk-4XIIBGDO.js +0 -9
- package/dist/chunk-7EKLESDL.js +0 -65
- package/dist/chunk-MHU7S7JL.js +0 -1
- package/dist/chunk-MOCX5MQ7.js +0 -14
- package/dist/chunk-MTRFMGBO.js +0 -1
- package/dist/chunk-PAELDYYS.js +0 -1
- package/dist/chunk-YFK74XOM.js +0 -5
- package/dist/chunk-ZNCEOSXO.js +0 -1
package/dist/chunk-7EKLESDL.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-RKXIB5BN.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-MHU7S7JL.js";import{useSectionOps as w}from"./chunk-EYRQ4XGN.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-MTRFMGBO.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as I}from"./chunk-V7U33NF2.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as $}from"./chunk-2DHJC5YS.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as M}from"./chunk-3I6DVDUR.js";import{useScreenSaveSwitch as A,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as F,useScreenPickFollowsSelection as D,useScreenLeftView as H,useScreenAdd as W,SELECTION_MODE as U,sameInspectorMode as G,useScreenBridges as X,useScreenBlockRules as Y,useScreenBlockLook as J,useScreenStorageNamespace as K,useScreenNotify as Q,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-YFK74XOM.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ae,slotFieldsOf as ce,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{useEasel as we,useEaselApi as xe}from"./chunk-4XIIBGDO.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Oe,TreeSeam as Ie}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ne}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Me}from"./chunk-UK2FQOUT.js";import{LayersIcon as Ae,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Le}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ee,TopBarRail as Ve,TopBarCluster as Fe,EaselIconButton as De,TopBarDivider as He,DeviceSwitch as We,InspectorIconButton as Ue,PanelResizeHandle as Ge,MAX_PANEL_W as Xe,MIN_PANEL_W as Ye,panelWidthVars as Je,SaveState as Ke,SaveStateToggle as Qe}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-MOCX5MQ7.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-PAELDYYS.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as On,EyeOffIcon as In,EyeIcon as Nn,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as Mn}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ke,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return Pn(Ke,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Le(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
|
|
3
|
-
return Tn(Mn,o?{children:[
|
|
4
|
-
/* @__PURE__ */Pn(Qe,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ke,{tone:d,label:a})}),c]}:{children:[
|
|
5
|
-
/* @__PURE__ */Pn(Ke,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn(Mn,e?{children:[
|
|
7
|
-
/* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function Ln(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var En="__rungs";var Vn="screen:band",Fn={duplicate:!0,delete:!0};function Dn(){const Le=ye(),{target:Ke,docId:Qe,capabilities:ln,currentSlug:Dn,siteId:Hn,onPublish:Wn,saveState:Un,saveConflict:Gn,retrySave:Xn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Kn=null}=B(),Qn=A(),_n=j(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=R(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>oe(st,e),gt=e=>re(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ve),vt=qe("tree",Ne),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",Se),Bt=qe("chrome",_e),Ct=L()??`/${Dn}`,Ot=E(),It=V(),Nt=w({readOnly:Jn}),$t=w({readOnly:Jn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),Mt=gn(()=>({...Nt,select:e=>{Pt.current=e,Nt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}Nt.commitDocument(e,n)}}),[Nt,Tt]),At=nt.ui,jt=At.leftSideBarVisible,Rt=At.rightSideBarVisible,{options:Lt,widths:Et,initial:Vt,fluid:Ft,fit:Dt}=F(),[Ht,Wt]=yn(Vt),Ut=he(),Gt=qn&&null!==Ut,Xt=me(),Yt=ge();D(rt?.props.id);const{read:Jt,write:Kt,forSelection:Qt}=H(),[_t,qt]=yn(Jt);kn(()=>{Kt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=W(),fo=e=>po(null===e?null:{zone:le,index:e}),[ho,mo]=yn([]),[go,yo]=yn(U),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===le?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const Oo=Sn((e,{scroll:n})=>{qt(n=>Qt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Io=mn(null);kn(()=>{const e=Io.current;Io.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??U);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);Oo(String(t),{scroll:!r(o,i??null,le)})},[rt?.props.id,Oo]);const No=Sn(e=>{yo(n=>G(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Jr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>G(e,n)?e:n),o!==r&&(Io.current={id:o,mode:n},Mt.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:No,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Mo=X(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Jn),select:e=>{yo(U),Mt.select({index:e})},replace:(e,n)=>Mt.replaceComponent(le,e,n),scrollTo:e=>Si(e)},{device:Ht,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=Mo.pinnedSource??!1,jo=Mo.resolveLeftView?Mo.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=Y(),{isLockedBlock:Lo,duplicateBlocked:Eo,nestDepth:Vo,newSectionNode:Fo,canAddTo:Do,blockIsOffered:Ho}=Ro,Wo=J(),{labelAtLevel:Uo,Icon:Go,useProducts:Xo}=Wo,Yo=Wo.rowName?(e,n,t)=>Wo.rowName(e,n,t):void 0,Jo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Oo(e,{scroll:!0})},[tt,Oo]),{selectNode:Ko,openPartId:Qo}=v({mode:go,setMode:yo,onOpenPart:Jo}),[_o,qo]=yn(null);ke(null!==_o,()=>qo(null));const Zo=y(K()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Ii()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ke(io,()=>Ii()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Xt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Xt]),kn(()=>{!jt&&Xt&&(ao.current=!1,Yt())},[jt]),kn(()=>{if(!Xt||!ro)return;const e=e=>{"Escape"===e.key&&Yt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Xt,ro]),ke(null!==Xt,()=>Yt());const fr=Q(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=_(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Ht===Ft?gr>0?gr:Et[Ft]:Et[Ht],zr=gr>0?Math.min(gr/br,"shrink"===Dt?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Or={width:Br,height:kr||"100%",flex:"none",position:"relative"},Ir={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Nr=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Xt&&(ao.current=!1,Yt(),jt&&_t===e)||(jt&&_t===e?Nr():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Le,{accept:"image/*",title:Bt.mediaLibrary})},Mr=()=>{yo(U),Mt.select(null),u()},Ar=()=>{yo(ht??U),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Lr=lt,Er=Ro.stripCopy,Vr=e=>i(e,Er),Fr=x(),Dr=Te({data:nt.data,config:Lr,readOnly:Boolean(Jn),clipboard:Fr,strip:Er?e=>Er(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(U);const t=void 0===n||"node"===n?.kind?n:null;Mt.commitDocument(e,t)}}),Hr=e=>Uo(e,"block",lt.components[e]?.label??e),Wr=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Ur=e=>Uo(e,"section",Hr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Ur(e.type),Yo),{nodeAddresses:Xr,zoneItems:Yr}=gn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ae(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,le,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Jr=Sn(e=>Yr.get(e)??[],[Yr]),Kr=e=>{const n=Xr.get(e);return n?Jr(n.zone)[n.index]:void 0},Qr=e=>ie(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Kr(e.slice(0,n));if(!t)return null;const o=Qr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},qr=(()=>{if(!q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!q(go))return;const n=go.nodeId;Oo(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Xr.get(e);n&&(n.zone===le?vi(n.index):Qi(n.zone,n.index,e,Kr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Jn||!Ro.moveSlot)return;const o=Kr(e),r=o?Qr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:En,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Xo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Hr,Wo.plainText,e=>ri.get(e),Wo.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===le||hl(n)?"section":"block",r=n===le&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Wo.renamePropOf?Wo.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Jn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=li(o,e);r&&Mt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},di=n(Z(),zt),ai=di.scope({target:Ke,siteId:Hn,docId:Qe}),ci=lt,pi=(e,n)=>n===le?Ur(e):Hr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&Mt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===le?Ur(e):Hr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{Mt.select(null),Ci(null)},openPageSettings:()=>{Mt.select(null),yo(U)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Jn),collapseAll:()=>or(new Set(Jr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Mo.menuRows,isLocked:e=>Lo(e.type),duplicateBlocked:e=>Eo(nt.data,e),permits:e=>se(lt,e.type),canAddTo:Do,nodeOps:Dr,isPinned:(e,n)=>n===le&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===le?vi(n):Mt.select({zone:e,index:n}),Ci(null)},locate:e=>Xr.get(e)??null,rowNameOf:(e,n)=>n===le?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===le?vi(n):Qi(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>O(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const mi=Sn(e=>{const n=I(e);if(!n)return;const t=hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Ln(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[oo,gi,Ht,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Mo.holdCanvasOn?Mo.holdCanvasOn(e):c(e)},vi=e=>{yo(U),Mt.select({index:e}),Mo.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Mt.reorderComponent(le,e,i),Mt.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(U),Mt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Fo(e,{nodeDefaults:Wr,newNodeId:fe,sectionLabel:Ur,blockIsOffered:Ho}),r=o?Mt.insertNode(le,t,o):Mt.insertSection(e,t);return bi(t,r,Ur(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of ae(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Do(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Bi=(e,n,t)=>{const o=wi(t),r=Mt.insertNode(le,o,n);return bi(o,r,e),o},Ci=e=>Oi(le,e),Oi=(e,n)=>{ur.current=document.activeElement??null,Xt&&(so.current=ao.current,ao.current=!1,Yt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ii=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ni=(e,n,t)=>{if("section"===e.kind)Mt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Mt.insertNode(n,t,Vr(e.template.node))}yo(U),Mt.select({index:t,zone:n})},$i=(e,n)=>Wo.rowName?n?mt(e)?Wo.rowName(e,"section",St.header):gt(e)?Wo.rowName(e,"section",St.footer):pt(e.type)?Wo.rowName(e,"section",Hr(e.type)):Gr(e):ii(e):n?Ur(e.type):Hr(e.type),Pi=e=>n=>{e()},Ti=()=>Mo.editPinnedSource?.(),Mi=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!se(lt,o.type).delete?null:/* @__PURE__ */Pn(Oe,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Dr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(On,{size:15})})},Ai=e=>Wo.rowPreview?.(e)||void 0,ji=e=>Wo.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Wo.rowActions?.(e,n,t)??null,Li=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return Pn(Oe,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Vi(e,n,t),children:/* @__PURE__ */Pn(r?In:Nn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Ei=e=>{const n=Ur(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return El(le,e,()=>Ci(e),t)},Vi=(e,n,t)=>{Mt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ce(lt,e),Di=e=>ae(lt,e),Hi=e=>Ro.slotsOf?Qr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Di(e)}],Wi=e=>Ro.slotsOf?Hi(e).flatMap(e=>e.kids):Di(e),Ui=e=>Boolean(Ro.slotsOf)&&Qr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Do(e):Do(e,n):Do(e,n,t),Xi=(e,n,t)=>{const o=ue(lt,e.type,n)&&(t||Wi(e).length>0||Ui(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Yi=(e,n,t)=>Hi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Xi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Wi(e).length>0||Ui(e)||Boolean(Do(e.type)),Ki=e=>Boolean(Do(e)),Qi=(e,n,t,o)=>{if(yo(U),Do(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Mt.select({index:n,zone:e}),c(t)}else Mt.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;Mt.insertComponent(i,t,o),Do(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Mt.select({index:o,zone:i})}):Mt.select({index:o,zone:i})},qi=(e,n,t)=>{Mt.insertComponent(e,n,t),yo(U),Mt.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Do(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Wr)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Wr]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Fi(n.type));el.current.add(o),r&&$t.replaceComponent(le,t,{...n,props:r})})},[jr,$t]),ee($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Ji(e)&&dl.push(String(e.props.id)),dl.push(...Yi(e,1,Ki)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Yi(tl,1,Ki)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Wo.blockRowName(e,Hr);return Wo.rowName?Wo.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Dr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Di(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Kr(e.rung.nodeId),o=t?Qr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===En&&n.index>=0&&n.index<=o}if(n.slot===En)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Xr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Do(s.type,Vo(nt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Jr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Xr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Do(o.type,Vo(nt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:Hr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===le)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ni(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Vr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===le?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Jn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Ur(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Lo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ur(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===le&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(bl);return i||(r(Me(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(U),Mt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Cl=ne(),Ol=()=>({data:nt.data,device:Ht,ops:Mt,inspector:To}),Il=Cl?.model,Nl=gn(()=>Il?e=>Il(e,xl(e),Ol()):xl,[Il,xl,Ht]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Ol()):void 0,Tl=Cl?.canDrop,Ml=Tl?(e,n)=>Tl(e,n,ml,Ol()):ml,Al=Cl?.drop,jl=Al?(e,n)=>Al(e,n,Sl,Ol()):Sl,Rl=Cl?.pick,Ll=Rl?e=>Rl(e,Bl,Ol()):Bl,El=(e,n,t,o)=>/* @__PURE__ */Pn(Ie,{...Jn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),Vl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Jr(o),i=ar(n),l=Hr(e.type),s=Wo.rowName?Wo.rowName(e,"section",l):l,d=e=>El(o,e,()=>Oi(o,e),St.addSectionHere);/* @__PURE__ */
|
|
15
|
-
return Tn(Mn,{children:[
|
|
16
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(le,t,n,s),selected:bo===n,actions:Ri(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Ji(n),s=l&&ar(r),a=()=>Qi(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
|
|
17
|
-
return Tn(wn,{children:[d(t),
|
|
18
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(o,t,i),Ri(n,o,t),Li(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Wl(n,2)})]},r)}),d(r.length)]})]})},Dl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${En}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:En,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
-
return Tn(wn,{children:[n.heading,
|
|
20
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(Mn,{children:h.map((t,o)=>/* @__PURE__ */Pn(Oe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Pn(On,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Hl=(e,n)=>{const t=Hi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
-
return Pn(Mn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?El(e,n,()=>Oi(e,n),St.addBlockHere):El(e,n),u=/* @__PURE__ */Tn(Mn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Xi(n,l,Ki(n.type)),d=String(n.props.id),a=cl(n),c=()=>Qi(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
|
|
22
|
-
return Tn(wn,{children:[0===o&&p(t,0),
|
|
23
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Ai(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,a),Ri(n,t,o),Li(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Hl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Dl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Wl=(e,n)=>{const t=Vo(nt?.data,e.type,String(e.props.id)),o=Hi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
-
return Pn(Mn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Oi(n,t):void 0;return El(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(Mn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Xi(n,s,Ki(n.type)),c=Fi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Jr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Qi(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Lo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
|
|
25
|
-
return Tn(wn,{children:[0===o&&m(t,0),
|
|
26
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Ai(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Lo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(Mn,{children:[Mi(t,o,i),Ri(n,t,o),Li(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Wl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
27
|
-
/* @__PURE__ */Pn(N,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Dl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Ul=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Do(e,Vo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Hr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==le&&!hl(wo.zone)?wo.zone:null,Xl=!0===uo.blocksFirst,Yl=Gl?yl(Gl):Xl&&wo?null:Ul,Jl=Boolean(co&&Gl)||Xl&&Boolean(Yl&&Yl.choices.length>0),Kl=io||null!==Xt,Ql=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Kl&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Ii():Ci(null)},...(Mo.railLead??[]).map(Ql),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Ae,{}),active:jt&&!Kl&&"sections"===jo,onSelect:()=>Pr("sections")},...(Mo.railTrail??[]).map(Ql)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Xt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Mo.railLead??[],...Mo.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Ao,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Vn),ts=/* @__PURE__ */Tn(Mn,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Di(e);const r=String(e.props.id),i=Mo.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&ar(r),{rowProps:d,...a}=wl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...un(le),index:n}},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
|
|
28
|
-
return Tn(wn,{children:[n>0&&Ei(n),
|
|
29
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,r,Gr(e)),selected:t,hidden:o,...a,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(Mn,{children:[Mi(le,n,Gr(e)),Ri(e,le,n),Li(le,n,e,Gr(e))]}),rowProps:d}),Ji(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Wl(e,1),Mo.partRows?.(e,Vl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Mo.ownRows?.(e,n,Vl)})]},String(e.props.id??n))}),!Ao&&sl>0&&Ei(sl),kt?.addAtEnd&&!Ao&&!Jn&&/* @__PURE__ */Pn(N,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Wi(e).length>0||Ui(e)||Boolean(Do(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Wo.rowName?Wo.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
-
return Tn(Mn,{children:[
|
|
31
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Ai(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(le,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Hl(e,1)})]})};return(Mo.wrap??(e=>e))(
|
|
32
|
-
/* @__PURE__ */Pn(te,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Je(rr),onContextMenu:fi.onEditorContextMenu,...m(Le),children:[
|
|
33
|
-
/* @__PURE__ */Tn(Ee,{children:[
|
|
34
|
-
/* @__PURE__ */Pn(Ve,{items:_l,ariaLabel:St.bar.views}),
|
|
35
|
-
/* @__PURE__ */Tn(Fe,{children:[
|
|
36
|
-
/* @__PURE__ */Pn(De,{label:St.bar.undo,disabled:Boolean(Jn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
|
|
37
|
-
/* @__PURE__ */Pn(De,{label:St.bar.redo,disabled:Boolean(Jn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
|
|
38
|
-
/* @__PURE__ */Pn(He,{}),
|
|
39
|
-
/* @__PURE__ */Pn(We,{devices:Lt,value:Ht,onChange:Wt})]}),
|
|
40
|
-
/* @__PURE__ */Tn(Fe,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
-
/* @__PURE__ */Pn(An,{saveState:Un,notSaving:Boolean(Jn)||null!=Gn,readOnlyReason:Kn,toggle:Qn,onToggle:Yn,onRetry:Xn,words:St.bar,saveWords:xt}),Mo.barLead?.(),
|
|
42
|
-
/* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Mo.barTrail?.(),Mo.barMain?Mo.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Kn,onClick:()=>{Wn(nt.data)},children:St.done})]})]}),
|
|
43
|
-
/* @__PURE__ */Pn(z,{}),
|
|
44
|
-
/* @__PURE__ */Tn("div",{className:"sf-body",children:[jt?/* @__PURE__ */Tn(Mn,{children:[
|
|
45
|
-
/* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn($,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Wo.rowName?$i(n,!0):Hr(n.type)});if(e.zone===le){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ni(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Vr(e.template.node));if(n&&n.zone!==le){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ul?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:vl,siteWide:Mo.addPanelRow?.(Ii),onClose:Ii,onHide:Nr,readOnly:Boolean(Jn)}):Xt&&Ut?
|
|
46
|
-
/* @__PURE__ */Pn(M,{panel:Ut,pick:Xt,onHide:Nr}):ql?ql.panel({onHide:Nr,notify:hr}):"media"===jo&&Ut?/* @__PURE__ */Pn(M,{panel:Ut,pick:null,onHide:Nr}):/* @__PURE__ */Tn(Mn,{children:[
|
|
47
|
-
/* @__PURE__ */Pn(P,{icon:/* @__PURE__ */Pn(Ae,{}),title:St.layers,context:Ct,actions:
|
|
48
|
-
/* @__PURE__ */Pn(Ue,{label:al?St.expandAll:St.collapseAll,title:0===dl.length?St.nothingToFold:void 0,disabled:0===dl.length,onClick:()=>or(e=>{const n=new Set(dl);return al?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...dl])}),children:/* @__PURE__ */Pn(jn,{expand:al})}),onHide:Nr}),
|
|
49
|
-
/* @__PURE__ */Tn(Be,{className:"sf-tree sf-scroll",words:vt,children:[
|
|
50
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"page",size:13}),name:St.pageSettings,onSelect:Mr,selected:!rt&&ko,rowProps:{onClick:Pi(Mr)}}),il&&/* @__PURE__ */Tn(Mn,{children:[
|
|
51
|
-
/* @__PURE__ */Pn(Ce,{children:St.header}),Fl(il)]}),!Ao&&et&&/* @__PURE__ */Tn(Mn,{children:[
|
|
52
|
-
/* @__PURE__ */Pn(Ce,{children:St.header}),!yt&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"header",size:13}),name:St.header,onSelect:Ar,selected:go.kind===ht?.kind,rowProps:{onClick:Pi(Ar)}})]}),!Ao&&rl&&os(rl,ol,"header"),!Ao&&!Zl&&/* @__PURE__ */Pn(Ce,{children:es}),Zl?/* @__PURE__ */Tn(Mn,{children:[
|
|
53
|
-
/* @__PURE__ */Pn(be,{words:vt,icon:null,name:es,fold:{open:!ns,label:es,onToggle:()=>cr(Vn)}}),!ns&&/* @__PURE__ */Pn(ze,{children:ts})]}):ts,et&&/* @__PURE__ */Pn(Ce,{children:St.footer}),tl&&os(tl,nl,"footer"),!Ao&&!tl&&et&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"footer",size:13}),name:St.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:St.editFooter}}),ll&&Fl(ll),Mo.treeFoot?.()]})]})}),
|
|
54
|
-
/* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Ye,max:Xe,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn(T,{side:"left",onShow:Nr}),
|
|
55
|
-
/* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Ht})}),
|
|
56
|
-
/* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Or,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Ht===Ft?"":`sf-frame--${Ht}`),style:Ir,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
|
|
57
|
-
/* @__PURE__ */Pn(Ot,{},Zt),
|
|
58
|
-
/* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Nl,measure:Pl,canDrop:Ml,onDrop:jl,choose:zl,onPick:Ll,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Oi(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Jn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>Ci(e.index),children:[
|
|
59
|
-
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
|
|
60
|
-
/* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
|
|
61
|
-
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
62
|
-
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:St.addSection})]})]},e.index))})]})})})]}),Rt?/* @__PURE__ */Tn(Mn,{children:[
|
|
63
|
-
/* @__PURE__ */Pn(g,{value:{selectChild:Qi,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(It,{mode:go,onOpenWebsiteSettings:Mo.openSettings??(()=>{}),onOpenSiteStyles:Mo.openStyles,onSelectNode:Ko,onNotify:hr,onHidePanel:$r,nodeActions:rt?se(lt,rt.type):Fn})}),
|
|
64
|
-
/* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Ye,max:Xe,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
|
|
65
|
-
/* @__PURE__ */Pn(T,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Dn as ScreenChrome};
|
package/dist/chunk-MHU7S7JL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-EYRQ4XGN.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-YFK74XOM.js";import{useEasel as p}from"./chunk-4XIIBGDO.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-MOCX5MQ7.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{framePointToHost as i,elementScale as c,frameRectToLayer as d,clientPointToLayer as u}from"./chunk-ZNCEOSXO.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{parseZoneKey as f}from"./chunk-KRXQM65X.js";import{useRef as p,useEffect as m,useState as g,useCallback as b,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w,Input as N,IconButton as A}from"efficient-shell/ui";import{jsxs as z,jsx as D}from"react/jsx-runtime";import{CloseIcon as T,SearchIcon as C}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function $(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function L(e,t,n){return $(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function M(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function B(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:M(e,o)};if(!a(s))return null}return null}function O(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var K={nodes:[],zones:[]},X="data-puck-dropzone",q="data-puck-component";function P(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Y(e,t){const{frame:n,document:l}=e,r=e=>d(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${X}]`)){const t=e.getAttribute(X)??"";let n;try{n=f(t)}catch{continue}const l=[...e.querySelectorAll(`[${q}]`)].filter(t=>t.parentElement?.closest(`[${X}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:P(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(q);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Z="data-es-empty-cell",F="data-puck-dropzone",R=140;var I=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(d){const{canvas:h,session:f,readOnly:x,words:N=e.canvas}=d,A=p(d);m(()=>{A.current=d});const T=p(null),C=o(h),[S,E]=g(0),L=b(()=>E(e=>e+1),[]),[j,M]=g(K);m(()=>{const e=T.current;h&&e&&M((A.current.measure??Y)(h,e))},[h,C,d.revision,S]);const O=d.model,X=y(()=>O(j),[O,j]),q=v(f.subscribe,f.shown,f.shown),P=d.choose,R=(e,t)=>{const n=$(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Q,V]=g(null),[G,H]=g(null),W=p(null),J=()=>{W.current&&clearTimeout(W.current),W.current=null},U=()=>{J(),W.current=setTimeout(()=>{f.get()||V(null)},140)};m(()=>J,[]);const _=p(null);s(h,"mousemove",e=>{const t=T.current;if(!h||!t)return;const n=i(h.frame,e.clientX,e.clientY,t),l=c(t),r={x:n.x/l,y:n.y/l};if(_.current=r,A.current.readOnly||f.get())return;J();const a=R(r.x,r.y);V(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(h,"mouseout",e=>{e.relatedTarget||(_.current=null,U())}),s(h,"mouseover",e=>{e.relatedTarget||L()});const ee=p(null),te=b(()=>{ee.current?.(),ee.current=null,H(null)},[]);m(()=>f.subscribe(()=>{f.get()?L():te()}),[f,te,L]),m(()=>te,[te]),("undefined"==typeof document?m:k)(()=>{if(f.get())return;const e=_.current;V(t=>x?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,q,f,x,P]);const ne=e=>{const t=f.get(),n=T.current;if(!t||!n)return null;const l=u(n,e.clientX,e.clientY);_.current=l;const r=B(X.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},le={onDragEnter:e=>{if(ee.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=h?l(h.document):null,o=[];t&&o.push(r(t)),a&&h&&o.push(r(a,h.frame)),ee.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ne(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(_.current=null,H(null))},onDrop:e=>{const t=ne(e);t&&(e.preventDefault(),f.end(),te(),A.current.onDrop(t.h.item,t.t.to))}},re={draggable:!x&&!!Q,onMouseEnter:J,onMouseLeave:()=>!f.get()&&U(),onDragStart:e=>{if(Q&&!x){f.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{f.end(),te()},onClick:()=>{Q&&!x&&A.current.onPick?.(Q.item)}},{seams:ae=[]}=X,oe=X.zones.filter(e=>0===e.children.length),se=d.onZoneAdd&&!x?oe:[],ie=se.map(e=>e.key).join("\n");return m(()=>{const e=h?.document;if(!e)return;const t=new Set(ie?ie.split("\n"):[]);for(const n of e.querySelectorAll(`[${F}]`))n.toggleAttribute(Z,t.has(n.getAttribute(F)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[h,ie,j,C,S]),/* @__PURE__ */z("div",{ref:T,className:"es-canvas-layer",children:[q||!d.onSeamAdd||x?null:ae.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>d.onSeamAdd?.(e.place),children:N.addButton({label:d.seamLabel??N.addSection})})},e.key)),se.length?se.map(e=>/* @__PURE__ */D("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",G?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:I(e.box),onClick:()=>d.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:N.addButton({label:e.addLabel??d.zoneAddLabel??N.addBlock})})},e.key)):null,q?/* @__PURE__ */D("div",{className:"es-canvas-catch",...le}):null,G&&!oe.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:I(G.line)}):null,
|
|
2
|
-
/* @__PURE__ */D("div",{className:"es-canvas-handle-spot",style:Q?{"--es-handle-x":`${Q.box.left+2}px`,"--es-handle-y":`${Math.max(Q.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */D(w,{className:"es-canvas-handle-tip",side:"top",content:!Q||x||q?null:Q.title??N.handle({label:Q.label}),children:/* @__PURE__ */z("div",{className:["es-canvas-handle",Q&&!x?"is-shown":"",q?"is-dragging":""].filter(Boolean).join(" "),...re,children:[
|
|
3
|
-
/* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[f,p]=g(""),m=x(),b=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
4
|
-
return z("div",{className:"es-add",children:[a?/* @__PURE__ */z("div",{className:"es-add-at",role:"status",children:[
|
|
5
|
-
/* @__PURE__ */D("span",{children:a.label}),h(c.stop,/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:a.onClear,children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
6
|
-
/* @__PURE__ */D("p",{className:"es-add-hint",children:d}),
|
|
7
|
-
/* @__PURE__ */D("div",{className:"es-add-find",children:/* @__PURE__ */D(N,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */D(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */D(A,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */z("div",{className:"es-add-empty",role:"status",children:[
|
|
8
|
-
/* @__PURE__ */D("div",{className:"es-add-empty-title",children:c.nothing({query:f.trim()})}),
|
|
9
|
-
/* @__PURE__ */D("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */z("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
10
|
-
/* @__PURE__ */z("div",{className:"es-add-group-head",children:[
|
|
11
|
-
/* @__PURE__ */D("span",{className:"es-add-group-title",children:e.title}),
|
|
12
|
-
/* @__PURE__ */D("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
13
|
-
/* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return h(l,/* @__PURE__ */z("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
14
|
-
/* @__PURE__ */D("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{G as AddPanel,Q as CanvasDragLayer,K as EMPTY_MEASURE,R as HANDLE_GRACE_MS,B as canvasTarget,S as contains,j as gapInZone,M as gapLine,Y as measureCanvas,L as pickSource,O as seamsBetween,$ as sourcesAt};
|
package/dist/chunk-MTRFMGBO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-MCHMF32I.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{useCanvasEvent as u}from"./chunk-PAELDYYS.js";import{isTypingTarget as d,framePointToHost as p}from"./chunk-ZNCEOSXO.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,AddIcon as C,PasteIcon as z,SettingsIcon as O,LayersIcon as P,CopyIcon as A}from"efficient-shell/icons/efficient";import{jsx as S}from"react/jsx-runtime";function j(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var D=c(),K=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return D;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function T(){return M(n())}function X(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function E(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete}}function I(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of j(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(d(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function Y(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=E(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:I(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=E(n,i,l),k=j(n,o),b=d.held,v=b&&!p?I(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?N(n).pinned:void 0})}var N=e=>e.words?.screen??l.menu;function U(e){const n=N(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */S(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */S(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=o?[{label:n.addSection,icon:/* @__PURE__ */S(C,{}),onClick:e.openAddSection}]:[],c=e.nodeOps.held,s=X(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */S(z,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */S(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */S(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function V(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=N(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */S(z,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e){return e.shiftKey}function F(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const r=Y(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),u(n,"keydown",c);const a=k(n=>{if(B(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);u(n,"contextmenu",t=>{if(B(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),u(n,"mousedown",r),u(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */S(G,{host:e,target:t,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?V(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */S(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */S(r,{items:o,onClose:t})})}export{D as EASEL_NODE_CLIPBOARD,j as ancestorChain,M as nodeClipboardOf,E as nodeClipboardRules,R as nodeMenuItems,L as nodeShortcut,U as pageMenuItems,I as pastePlace,Y as runNodeShortcut,V as textMenuItems,T as useNodeClipboard,F as useNodeContextMenu};
|
package/dist/chunk-PAELDYYS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-ZNCEOSXO.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-puck-component]",u="[data-puck-dropzone]",s="iframe#preview-frame";function i(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function l(e,n,{selector:t=s,readySelector:o}={}){let r=null,c=null,u=!1,l=!1,d=null;const a=()=>{d?.observer.disconnect(),d=null},m=()=>{if(l)return;let e=null;if(r&&i(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return a(),!0;if(d?.doc!==e){a();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),d={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else a();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&u||(u=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,p=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return p?.observe(e,{childList:!0,subtree:!0}),v(),()=>{l=!0,p?.disconnect(),a(),r?.removeEventListener("load",f),r=null}}function d(e,{selector:n,readySelector:r}={}){const[c,u]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=l(t,u,{selector:n,readySelector:r});return()=>{o(),u(null)}},[e,n,r]),c}function a(e,n,t,{on:c="document",capture:u=!1}={}){const s=r(t);s.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>s.current(e);return e.addEventListener(n,t,u),()=>e.removeEventListener(n,t,u)},[i,l,n,c,u])}function m(t,r,c){const u=t?.document??null;o(()=>{if(!u)return;if(!c)return void e(u,r);const t=n(u,r,c),o=u.defaultView?.MutationObserver,s=o?new o(()=>{t.isConnected||n(u,r,c)}):null;return s?.observe(u.head??u.documentElement,{childList:!0}),()=>{s?.disconnect(),e(u,r)}},[u,r,c])}function f(e,{settle:n=[150,450]}={}){const[r,c]=t(0),u=e?.frame??null,s=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!u||!s||!i)return;const e=u.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},l=[],d=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};d(s,"scroll"),d(i,"resize"),e&&(d(e,"scroll"),d(e,"resize"));const a=e?.ResizeObserver;if(a){const e=new a(r);e.observe(u),s.documentElement&&e.observe(s.documentElement),l.push(()=>e.disconnect())}const m=s.defaultView?.MutationObserver,f=s.body??s.documentElement;if(m&&f){const e=new m(r);e.observe(s===u.ownerDocument?u:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=s.fonts;v&&d(v,"loadingdone");const b=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of b)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[u,s,i,l]),r}export{c as BLOCK_SELECTOR,s as CANVAS_SELECTOR,u as LIST_SELECTOR,i as isFrameReady,a as useCanvasEvent,d as useCanvasFrame,f as useCanvasLayout,m as useCanvasStyle,l as watchCanvasFrame};
|
package/dist/chunk-YFK74XOM.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-4XIIBGDO.js";import{Inspector as i}from"./chunk-CRWFB7MU.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},C={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function B(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(D.Provider,{value:n,children:e})}function I(){return u(D)}function P(){return(I().useOwnerName??g)()}function N(){return(I().useDocumentLabel??y)()}function x(n,e,t,r){return(I().useBridges??v)(n,e,t,r)}function F(n){return(I().useStandaloneBridges??v)(n)}function R(n,e){(I().useDocumentPass??b)(n,e)}function T(){return I().blockRules??O}function A(){return I().blockLook??j}function W(){return I().devices??w}function K(){return I().leftView??L}function V(){return I().pinned??C}function E(){return I().saveSwitch??!0}function H(n){e(!0===I().pickFollowsSelection,n)}function M(){return I().add??h}function Q(){return I().storageNamespace||void 0}function U(){return I().styleClipboard??null}function X(){return I().nodeKeys??!0}function Y(){return I().notify??null}function Z(){return I().Canvas??S}function q(){return I().CanvasHead??null}function z(){return I().canvasDrag??null}var J=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(J.Provider,{value:n,children:e})}function _(){return u(J)}function nn(){return I().Inspector??B}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,M as useScreenAdd,A as useScreenBlockLook,T as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,W as useScreenDevices,N as useScreenDocumentLabel,R as useScreenDocumentPass,nn as useScreenInspectorPanel,K as useScreenLeftView,X as useScreenNodeKeys,Y as useScreenNotify,P as useScreenOwnerName,I as useScreenParts,H as useScreenPickFollowsSelection,V as useScreenPinned,E as useScreenSaveSwitch,Q as useScreenStorageNamespace,U as useScreenStyleClipboard,F as useStandaloneScreenBridges};
|
package/dist/chunk-ZNCEOSXO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function e(e){const n=e;if(!n||"string"!=typeof n.tagName)return!1;const o=n.tagName.toUpperCase();if("TEXTAREA"===o||"SELECT"===o)return!0;if("INPUT"===o)return!t.has(String(n.type??"text").toLowerCase());if(n.isContentEditable)return!0;const i=n.closest?.("[contenteditable]");return!(!i||"false"===i.getAttribute("contenteditable"))||null!=n.closest?.('[role="textbox"]')}var n="data-puck-component";function o(t,e=n){const o=t;return o&&"function"==typeof o.closest?o.closest(`[${e}]`)?.getAttribute(e)??null:null}function i(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function r(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},c=i(t);return{left:o.left-r.left+e.left*c,top:o.top-r.top+e.top*c,width:e.width*c,height:e.height*c}}function c(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function u(t,e,n){const o=r(t,e,n),i=c(n);return{left:o.left/i,top:o.top/i,width:o.width/i,height:o.height/i}}function l(t,e,n){const o=t.getBoundingClientRect(),i=c(t);return{x:(e-o.left)/i,y:(n-o.top)/i}}function s(t,e,n,o){const{left:i,top:c}=r(t,{left:e,top:n,width:0,height:0},o);return{x:i,y:c}}function f({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const i=o>0?Math.min(o/e,n):1;return{width:e,scale:i,shownWidth:e*i}}var a="data-es-canvas-style",h=/* @__PURE__ */new WeakMap;function d(t,e){e?h.set(t,e):h.delete(t)}function g(t,e,n){const o=t.head??t.documentElement;let i=w(t,e);if(!i){i=t.createElement("style"),i.setAttribute(a,e);const n=h.get(t);n&&i.setAttribute("nonce",n),o.appendChild(i)}return i.textContent!==n&&(i.textContent=n),i}function p(t,e){w(t,e)?.remove()}function w(t,e){for(const n of Array.from(t.querySelectorAll(`style[${a}]`)))if(n.getAttribute(a)===e)return n;return null}export{n as BLOCK_ATTRIBUTE,l as clientPointToLayer,c as elementScale,f as fitCanvas,s as framePointToHost,r as frameRectToHost,u as frameRectToLayer,i as frameScale,e as isTypingTarget,o as nodeIdAt,p as removeCanvasStyle,d as setCanvasNonce,g as upsertCanvasStyle};
|