efficient-easel 11.1.1 → 11.2.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/{chunk-MJESMPQT.js → chunk-4ACVXF5V.js} +1 -1
- package/dist/{chunk-7BZOFXHC.js → chunk-AZOCY74V.js} +35 -35
- package/dist/{chunk-2ER62O5V.js → chunk-BPFPM3L4.js} +3 -3
- package/dist/chunk-DD7A6RRL.js +5 -0
- package/dist/chunk-EQFBUNEB.js +1 -0
- package/dist/{chunk-4MPCFKFG.js → chunk-EXKKLTXH.js} +1 -1
- package/dist/{chunk-I55LUW3C.js → chunk-SJPKSE5G.js} +11 -10
- package/dist/{chunk-EKICPNE4.js → chunk-TWFM6GNK.js} +1 -1
- package/dist/chunk-U7KFFC7N.js +5 -0
- package/dist/{chunk-Z23YOUF5.js → chunk-XWK7WZQS.js} +1 -1
- package/dist/{chunk-6WVCXQJX.js → chunk-ZXGQT75B.js} +1 -1
- package/dist/easel/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/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 +16 -16
- 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/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AFWOZM7K.js +0 -5
- package/dist/chunk-PQ6ATM4M.js +0 -1
- package/dist/chunk-XQGBZGVP.js +0 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-U7KFFC7N.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SJPKSE5G.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-IFS5P7CO.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-IFS5P7CO.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-EXKKLTXH.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as S,DEFAULT_PANEL_W as k,clampPanelWidth as v}from"./chunk-TZIIRGVY.js";import{usePartBridge as b}from"./chunk-EQFBUNEB.js";import{useSectionOps as w}from"./chunk-XWK7WZQS.js";import{useNodeClipboard as x,useNodeContextMenu as z}from"./chunk-PPHUWGLZ.js";import{PageEditGuardNotices as C}from"./chunk-AFSSKGTD.js";import{ScreenSaveIcon as B,ScreenMainButton as I}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as N}from"./chunk-RKTF5XLP.js";import{useScreenDocument as P}from"./chunk-GCCBEY2W.js";import{requestMediaPick as O}from"./chunk-KG7RJWOK.js";import{heldStyle as $,styleShortcut as j}from"./chunk-V7U33NF2.js";import{AddChildRow as M}from"./chunk-5545A3PC.js";import{AddSidePanel as T}from"./chunk-DD7A6RRL.js";import{SidePanelHead as A,PanelShowStrip as L}from"./chunk-PPL7GB7D.js";import{useEaselSession as E}from"./chunk-O7Q4DDJT.js";import{MediaSidePanel as R}from"./chunk-ZXGQT75B.js";import{useScreenSaveSwitch as V,useScreenNodeKeys as F,useScreenPinned as W,useScreenDocumentLabel as G,useScreenCanvasFrame as H,useScreenInspectorPanel as D,useScreenDevices as U,useScreenPickFollowsSelection as J,useScreenLeftView as X,SELECTION_MODE as K,sameInspectorMode as Y,useScreenBridges as q,useScreenBlockRules as Z,useScreenBlockLook as _,useScreenStorageNamespace as Q,useScreenNotify as ee,useScreenCanvasHead as ne,isSlotMode as te,useScreenStyleClipboard as oe,useScreenDocumentPass as re,useScreenCanvasDrag as ie,ScreenCanvasTargetProvider as le,isPinnedFirst as se,isPinnedLast as de,screenSlotsOf as ce}from"./chunk-U7KFFC7N.js";import{ROOT_ZONE as ae,blockNodeActions as pe,TREE_MAX_DEPTH as ue,childSlotsOf as fe,slotFieldsOf as he,slotChildrenIn as me,nestsInTree as ge,newNodeId as ye}from"./chunk-PLVEGYK6.js";import{useMediaPanel as Se,usePanelPick as ke,useCancelPanelPick as ve}from"./chunk-R6WTQWAC.js";import{useEaselHost as be,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as xe}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ze}from"./chunk-VWXUMVCD.js";import{useEasel as Ce,useEaselApi as Be,CanvasPassThroughContext as Ie}from"./chunk-SJPKSE5G.js";import{TreeRow as Ne,Subtree as Pe,LayersTree as Oe,TreeGroupLabel as $e,TreeRowAction as je,TreeSeam as Me}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Te}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ae}from"./chunk-WK3AFPXY.js";import{toItemSelector as Le,useNodeOps as Ee,clickPick as Re}from"./chunk-ECM5F6JJ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as We,TopBarRail as Ge,TopBarCluster as He,EaselIconButton as De,TopBarDivider as Ue,DeviceSwitch as Je,InspectorIconButton as Xe,PanelResizeHandle as Ke,MAX_PANEL_W as Ye,MIN_PANEL_W as qe,panelWidthVars as Ze}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-GG4FGBFR.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as Sn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as Nn,useEffect as Pn,useCallback as On,useLayoutEffect as $n,Fragment as jn}from"react";import{ColoredBadge as Mn,toast as Tn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as En,RefreshIcon as Rn,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Gn,DuplicateIcon as Hn}from"efficient-shell/icons/efficient";import{jsx as Dn,jsxs as Un,Fragment as Jn}from"react/jsx-runtime";var Xn=/* @__PURE__ */new WeakSet;function Kn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Yn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${Sn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Dn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Dn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Dn(Mn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
|
|
2
2
|
return Dn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Un(Jn,e?{children:[
|
|
3
3
|
/* @__PURE__ */Dn("path",{d:"M8 9l4-4 4 4"}),
|
|
4
4
|
/* @__PURE__ */Dn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
5
|
/* @__PURE__ */Dn("path",{d:"M8 4l4 4 4-4"}),
|
|
6
6
|
/* @__PURE__ */Dn("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Dn("path",{d:"M5 12h14"})]})})}var
|
|
8
|
-
return new Set}});
|
|
9
|
-
return Dn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.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)},Bi=t(oe(),Gt),Ii=Bi.scope({target:yn,siteId:tt,docId:Sn}),
|
|
10
|
-
return Dn(
|
|
7
|
+
/* @__PURE__ */Dn("path",{d:"M5 12h14"})]})})}var Zn=`${fn}, ${hn}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=be(),{target:yn,docId:Sn,capabilities:kn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=P(),ft=V(),ht=F(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Ce(e=>e),zt=W(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Pt,panelOf:Ot}=zt,$t=Ot(Ct),jt=e=>se(zt,e),Mt=e=>de(zt,e),Tt="node"===zt.firstRow,At=zt.band??null,Lt=on("screen",ze),Et=on("tree",Te),Rt=on("drag",dn),Vt=on("notice",_e),Ft=on("lock",tn),Wt=on("menu",Ae),Gt=on("styleClipboard",xe),Ht=on("chrome",Qe),Dt=G()??`/${An}`,Ut=H(),Jt=D(),Xt=w({readOnly:pt}),Kt=w({readOnly:pt,foldIntoHistory:!0}),Yt=Bn(null),qt=Be(),Zt=In(()=>({...Xt,select:e=>{Yt.current=e,Xt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Yt.current=Le(e,t,n)}Xt.commitDocument(e,n)}}),[Xt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=U(),[lo,so]=Nn(oo),co=Se(),ao=mt&&null!==co,po=ke(),uo=ve();J(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=X(),[go,yo]=Nn(fo);Pn(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=Bn(null),bo=Bn(null),wo=un(bo,{readySelector:Zn}),xo=f(bo);h(bo,wo);const zo=N(),Co=en(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:nn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};m(bo,wo,Io);const[No,Po]=Nn(!1),Oo=Bn(!1),$o=Bn(!1),[jo,Mo]=Nn(null),[To,Ao]=Nn([]),[Lo,Eo]=Nn(K),Ro="puck"===Lo.kind,Vo=o(Lo,bt?.props.id),[Fo,Wo]=Nn(null);Pn(()=>{Fo&&(r(),Wo(null))},[Fo]);const Go=Bn(wt);Go.current=wt;const Ho=On((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Wo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Go.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Do=Bn(null);Pn(()=>{const e=Do.current;Do.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Eo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Ot(bt?.type)??K);const t=bt?.props.id,o=Yt.current;if(Yt.current=null,!t)return;const r=wt(t);Ho(String(t),{scroll:!i(o,r??null,ae)})},[bt?.props.id,Ho]);const Uo=On(e=>{Eo(n=>Y(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Jo=Bn(()=>{});Jo.current=(e,n)=>{const t=e?ui(e.zone??ae)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Eo(e=>Y(e,n)?e:n),o!==r&&(Do.current={id:o,mode:n},Zt.select(e))};const Xo=On((e,n)=>Jo.current(e,n),[]),Ko={kind:Lo.kind,mode:Lo,open:Uo,show:e=>Eo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Xo},Yo=q(Ko,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Eo(K),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(ae,e,n),scrollTo:e=>Ei(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Yo.pinnedSource??!1,Zo=Yo.resolveLeftView?Yo.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=Z(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=_(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=On(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Ho(e,{scroll:!0})},[kt,Ho]),{selectNode:pr,openPartId:ur}=b({mode:Lo,setMode:Eo,onOpenPart:ar}),[fr,hr]=Nn(null);we(null!==fr,()=>hr(null));const mr=S(Q()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
+
return new Set}});Pn(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(yr);if(!e)return{...k};const n=JSON.parse(e);return{left:v(Number(n.left)||k.left),right:v(Number(n.right)||k.right)}}catch{return{...k}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=On((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=On(e=>wr("left",e),[wr]),zr=On(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Br=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ir=Bn(!1),Nr=Bn(null);Pn(()=>{if(Ir.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Nr.current=null}Ir.current=No},[No]),Pn(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ui()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),we(No,()=>Ui()),Pn(()=>{!Qt&&No&&(Po(!1),Mo(null),Oo.current=!1)},[Qt]),Pn(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Po(!1),Mo(null),$o.current=Oo.current,Oo.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),Pn(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),Pn(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),we(null!==po,()=>uo());const Pr=ee(),Or=(e,n="success",t)=>{if(Pr)return void(t?Pr(e,"error"===n?"error":"info",t):Pr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Tn.error(e,{...o,duration:t?.duration??3200}):Tn.success(e,{...o,duration:t?.duration??1900})},$r=Bn(null),[jr,Mr]=Nn(0),[Tr,Ar]=Nn(0),Lr=ne(),Er=Bn(null),Rr=e=>Math.max(0,e.clientHeight-(Er.current?.offsetHeight??0));Pn(()=>{const e=$r.current;if(!e)return;const n=()=>{Mr(e.clientWidth),Ar(Rr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Er.current&&t.observe(Er.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Mr($r.current.clientWidth),Ar(Rr($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?jr>0?jr:to[ro]:to[lo],Fr=jr>0?Math.min(jr/Vr,"shrink"===io?1:2):1,Wr=Vr*Fr,Gr=jr>0&&Wr>jr+1,Hr={width:Wr,height:Tr||"100%",flex:"none",position:"relative"},Dr={width:Vr,height:Tr?Tr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Ur=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Jr=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Xr=e=>{No&&(Po(!1),Mo(null),Oo.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Ur():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Kr=()=>{O(fn,{accept:"image/*",title:Ht.mediaLibrary})},Yr=()=>{Eo(K),Zt.select(null),u()},qr=()=>{Eo($t??K),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=St.data.content??[],_r=()=>{const e=Zr.findIndex(jt),n=Zr.findIndex(Mt);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=xt,ei=_o.stripCopy,ni=n=>e(n,ei),ti=x(),oi=Ee({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Eo(K);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===ae?ci(o):xi(o);return!!oi.remove(e)&&(Or(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=On(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>l({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=In(()=>{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>=ue)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of fe(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,ae,0),{nodeAddresses:e,zoneItems:n}},[Zr,xt]),ui=On(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>ce(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===ae)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(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}},gi=(()=>{if(!te(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=Bn(null);Pn(()=>{const e=yi.current;if(yi.current=null,!gi||!te(Lo))return;const n=Lo.nodeId;Ho(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===ae?Ri(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Xo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ei(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(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;gi!==o&&(yi.current=o);Xo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>s(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===ae||Ml(n)?"section":"block",r=n===ae&&(jt(e)||Mt(e)||Nt(e.type)),i="block"===o?d(t):r?null:c(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
+
return Dn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.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)},Bi=t(oe(),Gt),Ii=Bi.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Pi=(e,n)=>n===ae?di(e):li(e),Oi=(e,n,t)=>{const o=Bi.plan(Ii,t,Pi(t.type,e),Ni);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Or(o.message))},$i=z({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===ae?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{Zt.select(null),Eo(K)},pageSettingsLabel:Lt.pageSettings,words:{menu:Wt,styleClipboard:Gt,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(ae).map(e=>String(e.props.id)))),onPasteRefused:e=>Or(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Yo.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>pe(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===ae&&(jt(e)||Mt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===ae?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===ae?Ri(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>$(Ii),canCopy:e=>Bi.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ii,e,Pi(e.type,n),Ni),paste:(e,n,t)=>Oi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??ae,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Or(Lt.copied({name:n}))}}:void 0},wo),ji=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{ji.current={copy:(e,n)=>Bi.copy(Ii,e,Pi(e.type,n),Ni),paste:Oi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??ae,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Mi=On(e=>{const n=j(e);if(!n)return;const t=ji.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))},[]);Pn(()=>{if(!xo)return;const e=e=>Mi(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Mi,xo]),mn(wo,"keydown",Mi);const Ti=Zr.map(e=>e.props.id).join("|");Pn(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ao(e=>e.length?[]:e);const n=Zr.findIndex(Mt),t=n>=0?n:Zr.length,o=n=>{const t=Zr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=Zr.length>0&&!jt(Zr[0])?0: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=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Ao(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()}},[wo,Ti,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Li=wo?.window??null;Pn(()=>{const e=vo.current;if(!e||!Ai||!Li)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Li]);const Ei=e=>{Yo.holdCanvasOn?Yo.holdCanvasOn(e):a(e)},Ri=e=>{Eo(K),Zt.select({index:e}),Yo.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Ei(n)},Vi=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?Zr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(ae,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Eo(K),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Or(Lt.sectionAdded({name:t}))},Gi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:ye,sectionLabel:di,blockIsOffered:rr}),r=o?Zt.insertNode(ae,t,o):Zt.insertSection(e,t);return Wi(t,r,di(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:c}of fe(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(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:c,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},Hi=e=>Di(ae,e),Di=(e,n)=>{Nr.current=document.activeElement??null,po&&(Oo.current=$o.current,$o.current=!1,uo()),Mo(null===n?null:{zone:e,index:n}),Po(!0),Qt||(Oo.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ui=()=>{Po(!1),Mo(null),Oo.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Oo.current=!1},Ji=(e,n)=>ir.rowName?n?jt(e)?ir.rowName(e,"section",Lt.header):Mt(e)?ir.rowName(e,"section",Lt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Xi=e=>n=>{e()},Ki=()=>Yo.editPinnedSource?.(),Yi=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!pe(xt,o.type).delete?null:/* @__PURE__ */Dn(je,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Dn(Fn,{size:15})})},qi=e=>ir.rowPreview?.(e)||void 0,Zi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
+
return Dn(je,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Dn(r?Wn:Gn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>us(ae,e),nl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>he(xt,e),ol=e=>fe(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:me(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ge(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Eo(K),or(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Zt.select({index:n,zone:e}),a(t)}else Zt.select({index:n,zone:e}),Ei(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},hl=Bn(/* @__PURE__ */new Set);Pn(()=>{Zr.forEach(e=>{const n=or(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.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(si)).forEach((e,t)=>Kt.seedChild(o,t,n.childType,e))})},[Zr,Kt,si]);const ml=Bn(/* @__PURE__ */new Set);Pn(()=>{Zr.forEach((e,t)=>{const o=e.props.id;if(ml.current.has(o))return;const r=n(e,tl(e.type));ml.current.add(o),r&&Kt.replaceComponent(ae,t,{...e,props:r})})},[Zr,Kt]),re(Kt,xt);const gl=Zr.findIndex(Mt),yl=gl>=0?Zr[gl]:null,Sl=Tt?Zr.findIndex(jt):-1,kl=Sl>=0?Zr[Sl]:null,vl=zt.groupTab,bl=In(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Dn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Dn(Mn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=Zr.find(e=>e.type===Bt)??null,Cl=Zr.find(e=>e.type===It)??null,Bl=gl>=0?gl:Zr.length,Il=[];Zr.forEach(e=>{Mt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>Sr.has(e)),Pl=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Ol=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===ae)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ml=e=>{const n=e.slice(0,e.indexOf(":")),t=Zr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Pt(n)===e?t:null},Tl=(e,n)=>{const t=Ml(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Rl(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Ml(o),i=Ml(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Tl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===ae||o===ae){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||jl(e.zone)!==l&&jl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(St?.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?.(ui(n),r))})(e.zone,o,e.index,t)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?Tl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},El=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(St?.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:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ji(o,t.zone===ae)}},Rl=(e,n)=>{const t=wn(n);if("block"!==e.kind){if(Ml(t)){const o="section"===e.kind?e.type:e.template.node.type;return Tl(t,o)&&n.index>=0&&n.index<=ui(t).length}if(t!==ae)return!1;const{floor:o,cap:r}=_r();return n.index>=o&&n.index<=r}if(t===ae)return!1;const o=El(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(ui(t))},Vl=(e,n)=>{if("block"!==e.kind&&Ml(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Tl(n,o)){if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,ni(e.template.node))}Eo(K),Zt.select({index:t,zone:n})}})(e,wn(n),n.index);if("section"===e.kind)return void Gi(e.type,n.index);if("template"===e.kind)return void((e,n,t)=>{const o=Vi(t),r=Zt.insertNode(ae,o,n);Wi(o,r,e)})(e.template.name,ni(e.template.node),n.index);const t=wn(n),o=El(t);o&&(o.target.spec?fl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):((e,n,t)=>{Zt.insertComponent(e,n,t),Eo(K),Zt.select({index:t,zone:e})})(t,e.type,n.index))},Fl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Vl(e.add,n):e.zone===ae?Fi(e.index,n.index):Ol(e.zone,wn(n),e.index,n.index)},[Wl]=Nn(()=>cn()),Gl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Wl,canDrop:Al,onDrop:Fl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ae?((e,n)=>{const t=di(Zr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Or(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Or(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ol(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Hl=On(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(jt(i)||Mt(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Ml(e)),s=e===ae||l;e===ae&&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?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===ae&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=El(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ml(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===ae||Ml(n)?null:El(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Dl=null==bt?.props.id?null:String(bt.props.id),Ul=On(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.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(Dl);return i||(r(Re(St.data,n,o.item.id,Dl,bl))??o)},[St.data,xt,Dl,bl]),[Jl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Kn(St.data,xt,n):null;t!==Jl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>jt(e)||Mt(e)||Nt(e.type),Yl=[];if(vl){const e=Dl?Kn(St.data,xt,Dl):null;for(const n of/* @__PURE__ */new Set([e,Jl])){const e=n?Zr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&Yl.push({id:String(e.props.id),label:t,below:jt(e)||e.type===Bt})}}const ql=E(),Zl=Bn(null);Pn(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(Zr.filter(Kl)),t=Zl.current;if(Zl.current={doc:Sn,bands:n,index:vt.index},!t||t.doc!==Sn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Xn.has(ql)&&(Xn.add(ql),Or(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[Zr]);const _l=e=>{Eo(K),Zt.select(e.zone===ae?{index:e.index}:{index:e.index,zone:e.zone})},Ql=ie(),es=()=>({data:St.data,device:lo,ops:Zt,inspector:Ko}),ns=Ql?.model,ts=In(()=>ns?e=>ns(e,Hl(e),es()):Hl,[ns,Hl,lo]),os=Ql?.measure,rs=os?(e,n)=>os(e,n,es()):void 0,is=Ql?.canDrop,ls=is?(e,n)=>is(e,n,Al,es()):Al,ss=Ql?.drop,ds=ss?(e,n)=>ss(e,n,Fl,es()):Fl,cs=Ql?.pick,as=cs?e=>cs(e,_l,es()):_l,ps=e=>{const n=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Di(n,e.index)},us=(e,n)=>/* @__PURE__ */Dn(Me,{...pt?{}:Gl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),fs={rowClick:Xi,isCollapsed:Cr,toggleCollapse:Br},hs=e=>{const n=String(e.props.id),t=Zr.findIndex(e=>String(e.props.id)===n),o=Pt(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>us(o,e);/* @__PURE__ */
|
|
11
11
|
return Un(Jn,{children:[
|
|
12
|
-
/* @__PURE__ */Dn(
|
|
13
|
-
return Un(
|
|
14
|
-
/* @__PURE__ */Dn(
|
|
15
|
-
return Un(
|
|
16
|
-
/* @__PURE__ */Dn(
|
|
17
|
-
return Dn(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>us(e,n),p=/* @__PURE__ */Un(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=
|
|
18
|
-
return Un(
|
|
19
|
-
/* @__PURE__ */Dn(
|
|
12
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:Zi(e),onSelect:()=>Ri(t),nameSlot:Ci(ae,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,ae,t)??void 0,rowProps:{"data-node-id":n,onClick:Xi(()=>Ri(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Un(Pe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Gl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Xi(c)});/* @__PURE__ */
|
|
13
|
+
return Un(jn,{children:[d(t),
|
|
14
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Dn(Pe,{children:ys(n,2)})]},r)}),d(r.length)]})]})},ms=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Gl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Gl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Xi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
+
return Un(jn,{children:[n.heading,
|
|
16
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Br(l)},actions:h&&h.length>0?/* @__PURE__ */Dn(Jn,{children:h.map((t,o)=>/* @__PURE__ */Dn(je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(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__ */Dn(Fn,{size:15}):/* @__PURE__ */Dn(Hn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Dn(Pe,{children:r})]},l)},gs=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
+
return Dn(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>us(e,n),p=/* @__PURE__ */Un(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Pl(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Gl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Xi(p)});/* @__PURE__ */
|
|
18
|
+
return Un(jn,{children:[0===o&&a(t,0),
|
|
19
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:c,preview:qi(n),marks:Zi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Dn(Pe,{children:gs(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?ms(e,t.rung,r++,o,p):/* @__PURE__ */Dn(jn,{children:p},t.slot??"")})})},ys=(e,n)=>{const t=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
20
|
return Dn(Jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>us(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Un(Jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),i=xi(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...xn(p),index:ui(p).length}:void 0,f=Gl.dragging,h=u&&f&&Al(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Gl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Xi(g)});/* @__PURE__ */
|
|
21
|
-
return Un(
|
|
22
|
-
/* @__PURE__ */Dn(
|
|
23
|
-
/* @__PURE__ */Dn(
|
|
24
|
-
return Un(
|
|
25
|
-
/* @__PURE__ */Dn(
|
|
21
|
+
return Un(jn,{children:[0===o&&m(t,0),
|
|
22
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Un(Jn,{children:[Yi(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Dn(Pe,{children:ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
+
/* @__PURE__ */Dn(M,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.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?ms(e,o.rung,i++,r,S):/* @__PURE__ */Dn(jn,{children:S},o.slot??"")})})},Ss=No||null!==po,ks=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!Ss&&Zo===e.id,onSelect:()=>Xr(e.id)}:e,vs=[...(Yo.railLead??[]).map(ks),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Dn(Ve,{}),active:Qt&&!Ss&&"sections"===Zo,onSelect:()=>Xr("sections")},...(Yo.railTrail??[]).map(ks)];ao?vs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Dn(Fe,{}),active:Qt&&!No&&(null!==po||"media"===Zo),onSelect:()=>Xr("media")}):mt&&vs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Dn(Fe,{}),onSelect:Kr});const bs=[...Yo.railLead??[],...Yo.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),ws=Boolean(At?.foldable)&&!qo,xs=At?.label??(gt?Lt.pageSections:Lt.templateSections),zs=ws&&Cr(et),Cs=/* @__PURE__ */Un(Jn,{children:[Zr.map((e,n)=>{if(jt(e)||Mt(e)||Nt(e.type))return null;const t=Vo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Yo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Gl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Gl.row({item:{id:r,zone:ae,index:n,type:e.type},place:{...xn(ae),index:n},into:u},{"data-node-id":r,onClick:Xi(()=>Ri(n))});/* @__PURE__ */
|
|
24
|
+
return Un(jn,{children:[n>0&&el(n),
|
|
25
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:Zi(e),onSelect:()=>Ri(n),nameSlot:Ci(ae,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Jn,{children:[Yi(ae,n,ci(e)),_i(e,ae,n),Qi(ae,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Un(Pe,{children:[ys(e,1),Yo.partRows?.(e,fs)]}),i&&!s&&/* @__PURE__ */Dn(Pe,{children:Yo.ownRows?.(e,n,fs)})]},String(e.props.id??n))}),!qo&&Bl>0&&el(Bl)]}),Bs=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
26
|
return Un(Jn,{children:[
|
|
27
|
-
/* @__PURE__ */Dn(
|
|
28
|
-
/* @__PURE__ */Dn(le,{target:wo,children:/* @__PURE__ */Un("div",{ref:bo,className:"sf-editor es-editor",style:
|
|
27
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:t,size:13}),name:s,preview:qi(e),marks:Zi(e),badge:xl,onSelect:()=>Ri(n),nameSlot:Ci(ae,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:_i(e,ae,n)??void 0,rowProps:{"data-node-id":o,onClick:Xi(()=>Ri(n))}}),r&&!i&&/* @__PURE__ */Dn(Pe,{children:gs(e,1)})]})};return(Yo.wrap??(e=>e))(
|
|
28
|
+
/* @__PURE__ */Dn(le,{target:wo,children:/* @__PURE__ */Un("div",{ref:bo,className:"sf-editor es-editor",style:Ze(vr),onContextMenu:$i.onEditorContextMenu,...g(fn),children:[
|
|
29
29
|
/* @__PURE__ */Un(We,{children:[
|
|
30
30
|
/* @__PURE__ */Dn(Ge,{items:vs,ariaLabel:Lt.bar.views}),
|
|
31
31
|
/* @__PURE__ */Un(He,{children:[
|
|
32
32
|
/* @__PURE__ */Dn(De,{label:Lt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Dn(Ln,{})}),
|
|
33
|
-
/* @__PURE__ */Dn(De,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Dn(
|
|
33
|
+
/* @__PURE__ */Dn(De,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Dn(En,{})}),
|
|
34
34
|
/* @__PURE__ */Dn(Ue,{}),
|
|
35
35
|
/* @__PURE__ */Dn(Je,{devices:no,value:lo,onChange:so}),
|
|
36
|
-
/* @__PURE__ */Dn(De,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=
|
|
36
|
+
/* @__PURE__ */Dn(De,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=Zr.findIndex(Mt),t=n>=0?n:Zr.length;let o=null;for(let n=0;n<t;n++){const t=Zr[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=bt?.props?.id??Zr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Dn(Rn,{})})]}),
|
|
37
37
|
/* @__PURE__ */Un(He,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Dn(B,{input:Bo,words:Lt.saveStatus}),
|
|
38
|
+
/* @__PURE__ */Dn(B,{input:Bo,words:Lt.saveStatus}),Yo.barLead?.(),Yo.barTrail?.(),Yo.mainAction||!Yo.barMain?/* @__PURE__ */Dn(I,{input:Bo,action:Yo.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):Yo.barMain()]})]}),
|
|
39
39
|
/* @__PURE__ */Dn(C,{}),
|
|
40
40
|
/* @__PURE__ */Un("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Un(Jn,{children:[
|
|
41
|
-
/* @__PURE__ */Dn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:
|
|
42
|
-
/* @__PURE__ */Dn(
|
|
41
|
+
/* @__PURE__ */Dn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Dn(T,{at:jo?{label:(e=>{const n=Ml(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Ji(n,!0):li(n.type)});if(e.zone===ae){const n=Zr[e.index];return n&&!Mt(n)?Lt.add.addingBefore({name:Ji(n,!0)}):Lt.add.addingAtEnd}const t=El(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(jo),onClear:()=>Mo(null)}:void 0,placeBlocks:jo&&jo.zone!==ae?El(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...xn(jo.zone),index:jo.index};if(Rl(e,n))return null;const t=Ml(jo.zone);if(t)return Lt.add.notInside({name:Ji(t,!0)});if(jo.zone===ae)return Lt.add.onlySections;const o=El(jo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...xn(jo.zone),index:jo.index};Rl(e,n)&&(Vl(e,n),Ui())}:void 0,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:Wl,siteWide:Yo.addPanelRow?.(Ui),onClose:Ui,onHide:Ur,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
+
/* @__PURE__ */Dn(R,{panel:co,pick:po,onHide:Ur}):bs?bs.panel({onHide:Ur,notify:Or}):"media"===Zo&&co?/* @__PURE__ */Dn(R,{panel:co,pick:null,onHide:Ur}):/* @__PURE__ */Un(Jn,{children:[
|
|
43
43
|
/* @__PURE__ */Dn(A,{icon:/* @__PURE__ */Dn(Ve,{}),title:Lt.layers,context:Dt,actions:/* @__PURE__ */Un(Jn,{children:[!pt&&/* @__PURE__ */Dn(Xe,{label:Lt.add.title,onClick:()=>Hi(null),children:/* @__PURE__ */Dn(Vn,{size:15})}),
|
|
44
|
-
/* @__PURE__ */Dn(Xe,{label:
|
|
45
|
-
/* @__PURE__ */Un(
|
|
46
|
-
/* @__PURE__ */Dn(
|
|
47
|
-
/* @__PURE__ */Dn(
|
|
48
|
-
/* @__PURE__ */Dn(
|
|
49
|
-
/* @__PURE__ */Un("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Gr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Dn("div",{ref:
|
|
44
|
+
/* @__PURE__ */Dn(Xe,{label:Nl?Lt.expandAll:Lt.collapseAll,title:0===Il.length?Lt.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>kr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Dn(qn,{expand:Nl})})]}),onHide:Ur}),
|
|
45
|
+
/* @__PURE__ */Un(Oe,{className:"sf-tree sf-scroll",words:Et,children:[
|
|
46
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Yr,selected:!bt&&Ro,rowProps:{onClick:Xi(Yr)}}),zl&&/* @__PURE__ */Un(Jn,{children:[!wl&&/* @__PURE__ */Dn($e,{children:Lt.header}),hs(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Un(Jn,{children:[!wl&&/* @__PURE__ */Dn($e,{children:Lt.header}),!Tt&&/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:qr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Xi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Bs(kl,Sl,"header"),!qo&&!ws&&/* @__PURE__ */Dn($e,{children:xs}),ws?/* @__PURE__ */Un(Jn,{children:[
|
|
47
|
+
/* @__PURE__ */Dn(Ne,{words:Et,icon:null,name:xs,fold:{open:!zs,label:xs,onToggle:()=>Br(et)}}),!zs&&/* @__PURE__ */Dn(Pe,{children:Cs})]}):Cs,yt&&!wl&&/* @__PURE__ */Dn($e,{children:Lt.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Dn(Ne,{words:Et,icon:/* @__PURE__ */Dn(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Ki,rowProps:{onClick:Xi(Ki),title:Lt.editFooter}}),Cl&&hs(Cl),Yo.treeFoot?.()]})]})}),
|
|
48
|
+
/* @__PURE__ */Dn(Ke,{side:"left",width:vr.left,min:qe,max:Ye,defaultWidth:k.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Dn(L,{side:"left",onShow:Ur}),
|
|
49
|
+
/* @__PURE__ */Un("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Gr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Dn("div",{ref:Er,className:"sf-canvas-head",children:/* @__PURE__ */Dn(Lr,{device:lo})}),
|
|
50
50
|
/* @__PURE__ */Un("div",{className:"sf-frame-scaler",style:Hr,children:[
|
|
51
51
|
/* @__PURE__ */Dn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Dr,children:/* @__PURE__ */Un("div",{className:"sf-preview-host",children:[
|
|
52
52
|
/* @__PURE__ */Dn(Ie.Provider,{value:bl,children:/* @__PURE__ */Dn(Ut,{},So)}),
|
|
53
|
-
/* @__PURE__ */Dn(ln,{canvas:wo,session:Wl,model:ts,measure:rs,canDrop:ls,onDrop:ds,choose:Ul,onPick:as,onZoneAdd:ps,onSeamAdd:ps,zoneAddLabel:Lt.canvasAddBlock,words:
|
|
54
|
-
/* @__PURE__ */Dn(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Hi(e.index),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}},e.index))})]})}),vl?/* @__PURE__ */Dn(
|
|
55
|
-
/* @__PURE__ */Dn(y,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:
|
|
56
|
-
/* @__PURE__ */Dn(
|
|
53
|
+
/* @__PURE__ */Dn(ln,{canvas:wo,session:Wl,model:ts,measure:rs,canDrop:ls,onDrop:ds,choose:Ul,onPick:as,onZoneAdd:ps,onSeamAdd:ps,zoneAddLabel:Lt.canvasAddBlock,words:Rt.canvas,readOnly:Boolean(pt),revision:St.data}),To.length>0&&/* @__PURE__ */Dn("div",{className:"sf-preview-gaps",children:To.map(e=>
|
|
54
|
+
/* @__PURE__ */Dn(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Hi(e.index),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}},e.index))})]})}),vl?/* @__PURE__ */Dn(Yn,{canvas:wo,tabs:Yl,onSelect:e=>{const n=Zr.findIndex(n=>String(n.props.id)===e);n>=0&&Ri(n)}}):null]})]}),eo?/* @__PURE__ */Un(Jn,{children:[
|
|
55
|
+
/* @__PURE__ */Dn(y,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Pl},children:/* @__PURE__ */Dn(Jt,{mode:Lo,onOpenWebsiteSettings:Yo.openSettings??(()=>{}),onOpenSiteStyles:Yo.openStyles,onSelectNode:pr,onNotify:Or,onHidePanel:Jr,nodeActions:bt?pe(xt,bt.type):nt})}),
|
|
56
|
+
/* @__PURE__ */Dn(Ke,{side:"right",width:vr.right,min:qe,max:Ye,defaultWidth:k.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
|
|
57
57
|
/* @__PURE__ */Dn(L,{side:"right",onShow:Jr})]}),$i.menu]})}))}export{tt as ScreenChrome};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-4ACVXF5V.js";import{ScreenChrome as e}from"./chunk-AZOCY74V.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(n),k=r(e);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function V({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),V=t(()=>s(!g),[g]),A=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:V,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{V as DocumentScreen,y as ScreenMount};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-PPL7GB7D.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-U7KFFC7N.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{useEasel as d}from"./chunk-SJPKSE5G.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-GG4FGBFR.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var B=e=>`section:${e}`,F=e=>`block:${e}`,G=e=>`template:${e}`;function P({at:P,placeBlocks:$,canTake:w,onPick:C,itemFor:E,session:O,siteWide:R,onClose:x,onHide:D,readOnly:H}){const I=d(e=>e.config),L=a(),{labelAtLevel:N,categoryLabel:T,firstSection:A,Icon:S,Thumbnail:W}=L,{blockIsOffered:K,canAddTo:M}=p(),z=f("screen",m).add,J=f("drag",h).add,Q=l(),[U,Y]=u([]);k(()=>{let e=!1;const t=e=>K(e,Q);return s(Q).list().then(o=>{if(e)return;const s=I.components;Y(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[I,Q]);const X=b(()=>e(I,L),[I]),Z=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */j(W,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=U.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(S,{type:e,size:26})}),ee=b(()=>{const e=t(X,A),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&K(e.type,Q)&&n.set(e.type,e)};for(const t of e?[e]:X){const e=M(t.type)?.choices??[];e.forEach(s),e.forEach(e=>M(e.type,1)?.choices?.forEach(s))}$?.forEach(s);const i=new Set(X.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:F(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...Z(e),cover:_(e.type)}:Z(e),p=[];U.length>0&&p.push({key:"templates",title:z.templates,tiles:U.map(e=>{return{type:G(e.id),label:e.name,cover:/* @__PURE__ */j(W,{type:e.node.type}),keywords:[(t=e.node.type,N(t,"section",I.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(I.categories??{})){const n=X.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(l)),d=!0),p.push({key:`category:${t}`,title:o(I,t,T),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!w)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?w(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[U,X,I,z,w,$,Q]);/* @__PURE__ */
|
|
2
|
+
return v(V,{children:[
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:x}),onHide:D}),
|
|
4
|
+
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */j(y,{groups:ee,session:O,itemFor:e=>E(q(e)??{kind:"section",type:e}),onInsert:C?e=>{const t=q(e);t&&C(t)}:void 0,at:P,hint:z.hint,searchLabel:z.search,readOnly:H,words:J}),R??null]})]})}export{P as AddSidePanel,F as blockKey,B as sectionKey,G as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-XWK7WZQS.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-U7KFFC7N.js";import{useEasel as p}from"./chunk-SJPKSE5G.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=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}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:K}}export{m as usePartBridge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-SJPKSE5G.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as l}from"./chunk-ECM5F6JJ.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-FGJSCWUN.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-Q6AM43CA.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,isTypingTarget as v,frameRectToHost as y,CANVAS_TYPING_EVENT as w,drawnBox as b}from"./chunk-ILXP5VX5.js";import{find as k,ROOT_ID as S,getList as C,remove as I,parseZoneKey as E,move as x,duplicate as D,replaceNode as M,createNode as A,insert as O,normalizeData as R,createResolveCache as P,resolveNodeData as B,ROOT_SLOT as N}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as $,fieldsFrom as z,defaultsFrom as K}from"./chunk-NKB3KVAB.js";import{createContext as L,useEffect as j,useContext as V,useRef as Z,useSyncExternalStore as F,useState as T,useMemo as H,useCallback as W,useLayoutEffect as q}from"react";import{jsx as Y,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as J}from"react-dom";import{registerModalEscapeInterceptor as G,FloatingBar as Q,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=C(e,t,E(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ie(e,t,n){return n?"node"===n.kind?k(e,t,n.id)?n:null:n.parentId===S?C(e,t,n)?n:null:k(e,t,n.parentId)&&C(e,t,n)?n:null:null}function le(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},i=A(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,i)}}case"replace":{const r=oe(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:M(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=D(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:I(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=R(e.data,t);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},S=e=>{const n=a;if(a=se(a,e,t),a===n)return;const o=e.recordHistory??te(e);b(n,o&&a.data!==n.data)},I=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const n=a,o=ie(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},x=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},D=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...n}};let A=D();const O=P(),N={resolveCache:O,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([B(r,t,{cache:O,trigger:e,metadata:n}),...i.map(o=>B(o,t,{cache:O,trigger:e,metadata:n}))]);I(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=k(n,t,l)?.node;s&&s===k(o,t,l)?.node&&(n=M(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:ie(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=k(a.data,t,e)?.node;if(!r)return!1;const i=await B(r,t,{cache:O,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return I(()=>{const n=a;if(k(a.data,t,e)?.node!==r)return;const o=M(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:ie(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:re(e,t)},r="node"===e.selection?.kind?k(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>N.undo(),forward:()=>N.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&x(e)}},getPermissions:A,getItemById:n=>k(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return C(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:S,batch:I,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=R(e,t);a={...a,data:r,selection:ie(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==o&&y()},undo(){d>0&&x(d-1)},redo(){d<c.length-1&&x(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,A=D(),f=null,y())},setConfig(e){e!==t&&(t=e,A=D(),f=null,y())}};return N}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&v(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=L(null),ge=L(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return j(()=>{n&&e.resolveAll()},[e,n]),j(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */Y(me.Provider,{value:e,children:/* @__PURE__ */Y(ge.Provider,{value:t,children:o})})}function ye(){const e=V(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?j:q;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=Z(null),[p,f]=T(null);return Ee(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ee(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */Y("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?J(t,p):null})}var Me=L(null),Ae=L(Ce),Oe=[];function Re({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>C(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==S),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=V(Me),u=["es-zone"];return s.length&&u.push("has-children"),e===S&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==S&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */Y("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */Y(Ne,{node:e},e.props.id))})}function Pe(e,t){return H(()=>{const n={};for(const o of $(z(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
-
return Y(
|
|
3
|
-
return Y(
|
|
4
|
-
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as l}from"./chunk-ECM5F6JJ.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-FGJSCWUN.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-Q6AM43CA.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,isTypingTarget as v,frameRectToHost as y,CANVAS_TYPING_EVENT as w,drawnBox as b}from"./chunk-ILXP5VX5.js";import{find as k,ROOT_ID as S,getList as C,remove as I,parseZoneKey as E,move as x,duplicate as D,replaceNode as A,createNode as M,insert as O,normalizeData as z,createResolveCache as R,resolveNodeData as P,ROOT_SLOT as B}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as L,fieldsFrom as N,defaultsFrom as V}from"./chunk-NKB3KVAB.js";import{createContext as $,useEffect as K,useContext as j,useRef as Z,useSyncExternalStore as F,useState as T,useMemo as H,useCallback as W,useLayoutEffect as q}from"react";import{jsx as Y,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as J}from"react-dom";import{registerModalEscapeInterceptor as G,FloatingBar as Q,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=C(e,t,E(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ie(e,t,n){return n?"node"===n.kind?k(e,t,n.id)?n:null:n.parentId===S?C(e,t,n)?n:null:k(e,t,n.parentId)&&C(e,t,n)?n:null:null}function le(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},i=M(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,i)}}case"replace":{const r=oe(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:A(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=D(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:I(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=z(e.data,t);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},S=e=>{const n=a;if(a=se(a,e,t),a===n)return;const o=e.recordHistory??te(e);b(n,o&&a.data!==n.data)},I=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const n=a,o=ie(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},x=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},D=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...n}};let M=D();const O=R(),B={resolveCache:O,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([P(r,t,{cache:O,trigger:e,metadata:n}),...i.map(o=>P(o,t,{cache:O,trigger:e,metadata:n}))]);I(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=k(n,t,l)?.node;s&&s===k(o,t,l)?.node&&(n=A(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:ie(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=k(a.data,t,e)?.node;if(!r)return!1;const i=await P(r,t,{cache:O,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return I(()=>{const n=a;if(k(a.data,t,e)?.node!==r)return;const o=A(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:ie(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:re(e,t)},r="node"===e.selection?.kind?k(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>B.undo(),forward:()=>B.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&x(e)}},getPermissions:M,getItemById:n=>k(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return C(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:S,batch:I,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=z(e,t);a={...a,data:r,selection:ie(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==o&&y()},undo(){d>0&&x(d-1)},redo(){d<c.length-1&&x(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=D(),f=null,y())},setConfig(e){e!==t&&(t=e,M=D(),f=null,y())}};return B}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&v(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=$(null),ge=$(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return K(()=>{n&&e.resolveAll()},[e,n]),K(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */Y(me.Provider,{value:e,children:/* @__PURE__ */Y(ge.Provider,{value:t,children:o})})}function ye(){const e=j(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?K:q;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=Z(null),[p,f]=T(null);return Ee(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ee(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */Y("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?J(t,p):null})}var Ae=$(null),Me=$(Ce),Oe=[];function ze({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>C(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==S),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=j(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===S&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==S&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */Y("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */Y(Ke,{node:e},e.props.id))})}function Re(e,t){return H(()=>{const n={};for(const o of L(N(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
+
return Y(ze,{parentId:t,slot:o,...e})};return n},[e,t])}function Pe(e){return H(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
+
return Y(ze,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Le(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ne(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Le(e,"position",t?"sticky":"relative");for(const n of Be)Le(e,n,t?.[n]??"");return!!t}var Ve="data-es-canvas-relative";function $e(e){e.hasAttribute(Ve)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ve));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ve,"")),!1)}function Ke({node:e}){const t=ye().config.components[e.type],n=e.props.id,o=Z(null),r=function(e,t){return H(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ke),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ke,e),n.setAttribute("data-puck-dnd",e),$e(n))},[e,t])}(n,o),i=Z(null),l=!!t?.inline;!function(e,t){const n=Z(!1),o=Z(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Z(()=>{});Ee(()=>o.current()),Ee(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?$e(e):Ne(e));const s=j(Me),a=Re(t,n),c=Pe(n);if(!t?.render)return null;const d=t.render,u={...V(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */Y(d,{...u,puck:p,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */Y("div",{ref:i,[ke]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */Y(d,{...u,puck:p,editMode:!0})})}function je({metadata:e}){const t=we(e=>e.config),n=we(e=>e.appState.data.root).props??{},o=t.root?.render,r=Re(t.root,S),i=Pe(S),l=/* @__PURE__ */Y(ze,{parentId:S,slot:B}),s=o?/* @__PURE__ */Y(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
+
return Y(Me.Provider,{value:e??Ce,children:s})}var Ze=$(void 0);function Fe(e,t,n){const[o,r]=T(null),i=Z(t);return i.current=t,Ee(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=b(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Te({id:e,kind:t,overlay:n}){const o=Z(null),r=Fe(o,e?t=>t.querySelector(`[${ke}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */Y("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */Y(n,{componentId:e,kind:t,children:i}):i}function He(e,t,n){const o=f(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function We({s:e,element:t,toolbar:n,label:o,keys:r}){const i=m("copy",h),l=e.pressed(),p=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,g=Z(null),[v,w]=T(!1),[b,k]=T(null),S=v||null!==b,C=()=>{e.hold(),w(!1),k({href:e.pressed().href})},I=()=>{w(!1),k(null),e.resume()};q(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!p.has("link")&&(C(),!0)}}),q(()=>()=>{r.current=null},[r]);const E=Z(I);E.current=I,K(()=>{if(v)return G(e=>{const t=g.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>g.current?.querySelector(".es-copy-colors"))},[v]),K(()=>{const n=g.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;w(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),q(()=>{const e=g.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?s(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),d=o.ownerDocument.defaultView?.frameElement,u=d?y(d,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=d?y(d,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),m={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,h.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,h.bottom)},v=e.ownerDocument.documentElement,w=(d??o.closest(".es-canvas")??o).getBoundingClientRect(),b={left:Math.max(0,w.left),top:Math.max(0,w.top),right:Math.min(v.clientWidth||w.right,w.right),bottom:Math.min(v.clientHeight||w.bottom,w.bottom)};if(b.right<=b.left||b.bottom<=b.top||0===n.offsetWidth)return;const k=a({anchor:m,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:w.left,top:w.top,right:w.right,bottom:w.bottom},clip:b,parent:c(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const x=f?{run:d(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),w(!0))}}:void 0;/* @__PURE__ */
|
|
5
6
|
return Y(Q,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?y(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */Y("div",{ref:g,style:{width:"18rem"},children:/* @__PURE__ */Y(_,{offered:p,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:x,linkOpen:null!==b,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(U,{children:[v&&f?/* @__PURE__ */Y(u,{colors:f,current:l.color,words:i.colors??h.colors,onPick:t=>e.color(t)}):null,b?
|
|
6
|
-
/* @__PURE__ */Y(ee,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function
|
|
7
|
-
return Y("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function
|
|
8
|
-
/* @__PURE__ */Y(
|
|
7
|
+
/* @__PURE__ */Y(ee,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function qe({element:e}){const t=Z(null),n=Fe(t,()=>e(),e);/* @__PURE__ */
|
|
8
|
+
return Y("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Ye({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:s,onDocument:a,height:c,title:d,nonce:u,hotkeys:f,frameWrapper:h,overlay:g,children:v,typing:y,passThrough:b}){const k=ye(),S=j(Ze),C=b??S,I=j(ge),E=m("canvas",e),x=f??I,[D,A]=T(void 0),M=we(e=>"node"===e.selection?.kind?e.selection.id:null),[O,z]=T(null),[R,P]=T(null),B=Z(null),[,L]=T(0),N=Z(y);N.current=y;const V=Z(null),$=Z(null),F=e=>{const t=$.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(w,{detail:{typing:e}}))},H=(e,t)=>{B.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=p({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:He(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>L(e=>e+1),onEscape:()=>V.current?.escape()??!1,onLinkKey:()=>V.current?.link()??!1,end:e=>{o.close(),B.current?.element===r&&(B.current=null),P(null),F(!1),N.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${ke}]`)?.getAttribute(ke);return l&&k.select(l),B.current={s:i,element:r,target:e},P(()=>r),z(null),F(!0),N.current?.onChange?.({typing:!0,element:n}),!0};K(()=>()=>B.current?.s.stop("stop"),[]);const W=e=>{const t=B.current?.element();return Boolean(t&&t.contains(e))},q=e=>{const t=e.closest?.(`[${ke}]`)?.getAttribute(ke);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null;return l(n.appState.data,k.config,t,o,C)??t},U=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(B.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=N.current?.atSelection?.();n&&H(n,null)&&e.preventDefault()},J=/* @__PURE__ */X("div",{ref:$,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),B.current){if(W(t))return;B.current.s.stop("outside")}const n=q(t);void 0===n?t.hasAttribute?.(Se)||k.select(null):k.select(n)},onDoubleClick:e=>{const t=N.current;if(!t||W(e.target))return;const n=t.at(e.target);n&&H(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>U(e),onMouseOver:e=>{if(B.current)return;const t=q(e.target)??null;t!==O&&z(t)},onMouseLeave:()=>z(null),children:[
|
|
9
|
+
/* @__PURE__ */Y(Ae.Provider,{value:O,children:/* @__PURE__ */Y(je,{metadata:r})}),
|
|
9
10
|
/* @__PURE__ */X("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
10
|
-
/* @__PURE__ */Y(
|
|
11
|
-
/* @__PURE__ */Y(
|
|
12
|
-
return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":
|
|
11
|
+
/* @__PURE__ */Y(Te,{id:!R&&O&&O!==M?O:null,kind:"hover",overlay:g}),
|
|
12
|
+
/* @__PURE__ */Y(Te,{id:R?null:M,kind:"selected",overlay:g}),R?/* @__PURE__ */Y(qe,{element:R}):null]}),v]}),G=h?/* @__PURE__ */Y(h,{document:D,children:J}):J;K(()=>{if(D&&x)return he(D,k)},[D,x,k]),K(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void U(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,k]);/* @__PURE__ */
|
|
13
|
+
return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":R?"":void 0,children:[R&&B.current?.target.toolbar?/* @__PURE__ */Y(We,{s:B.current.s,element:B.current.element,toolbar:B.current.target.toolbar,label:E.textTools,keys:V}):null,t?/* @__PURE__ */Y(De,{mirrorStyles:s,onDocument:e=>{A(e??void 0),a?.(e)},height:c,title:d,nonce:u,children:G}):/* @__PURE__ */Y("div",{id:"preview-frame","data-puck-entry":"",children:G})]})}function Xe(e={}){const t=ye(),n=we(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ue(){const e=ye(),n=we(e=>e.config),o=e.resolveCache,r=we(e=>e.selectedItem),i=we(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=H(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?k(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=we(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=W(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await P(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await P({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=W((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{De as CanvasFrame,Ze as CanvasPassThroughContext,de as DEFAULT_UI,Ye as EaselCanvas,ve as EaselProvider,je as EditDocument,he as bindUndoKeys,fe as createEasel,be as createUseEasel,te as recordsByDefault,se as reduce,re as uiView,we as useEasel,ye as useEaselApi,Xe as useEaselNodeOps,Ue as useSelectedFields,ie as validSelection};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-U7KFFC7N.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VWXUMVCD.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
|
|
@@ -0,0 +1,5 @@
|
|
|
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-SJPKSE5G.js";import{Inspector as i}from"./chunk-26GHWMNN.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=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function L(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function G(){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 N=o({});function P({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(N.Provider,{value:n,children:e})}function C(){return u(N)}function D(){return(C().useOwnerName??v)()}function x(){return(C().useDocumentLabel??g)()}function B(n,e,t,r){return(C().useBridges??h)(n,e,t,r)}function I(n){return(C().useStandaloneBridges??h)(n)}function T(n,e){(C().useDocumentPass??y)(n,e)}function A(){return C().blockRules??b}function F(){return C().blockLook??O}function K(){return C().devices??S}function R(){return C().leftView??j}function W(){return C().pinned??w}function E(){return C().saveSwitch??!0}function H(n){e(!0===C().pickFollowsSelection,n)}function V(){return C().storageNamespace||void 0}function J(){return C().styleClipboard??null}function M(){return C().nodeKeys??!0}function Q(){return C().notify??null}function Y(){return C().Canvas??L}function Z(){return C().CanvasHead??null}function q(){return C().canvasDrag??null}var z=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(z.Provider,{value:n,children:e})}function X(){return u(z)}function $(){return C().Inspector??G}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,P as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,B as useScreenBridges,q as useScreenCanvasDrag,Y as useScreenCanvasFrame,Z as useScreenCanvasHead,X as useScreenCanvasTarget,K as useScreenDevices,x as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,M as useScreenNodeKeys,Q as useScreenNotify,D as useScreenOwnerName,C as useScreenParts,H as useScreenPickFollowsSelection,W as useScreenPinned,E as useScreenSaveSwitch,V as useScreenStorageNamespace,J as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-U7KFFC7N.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-SJPKSE5G.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-U7KFFC7N.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
package/dist/easel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-
|
|
1
|
+
export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-SJPKSE5G.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-FGJSCWUN.js";import"../chunk-Q6AM43CA.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-TWFM6GNK.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-
|
|
1
|
+
export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-DD7A6RRL.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-PPL7GB7D.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-47RGVCPH.js";import"../../chunk-GG4FGBFR.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MediaSidePanel as default}from"../../chunk-
|
|
1
|
+
export{MediaSidePanel as default}from"../../chunk-ZXGQT75B.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenChrome as default}from"../../chunk-
|
|
1
|
+
export{ScreenChrome as default}from"../../chunk-AZOCY74V.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-IFS5P7CO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-DGAXQTDW.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-EXKKLTXH.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-EQFBUNEB.js";import"../../chunk-XWK7WZQS.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PPHUWGLZ.js";import"../../chunk-AFSSKGTD.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-W4U4SHKW.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-GCCBEY2W.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-DD7A6RRL.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-PPL7GB7D.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZXGQT75B.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-47RGVCPH.js";import"../../chunk-GG4FGBFR.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DocumentScreen,ScreenMount as default}from"../../chunk-
|
|
1
|
+
export{DocumentScreen,ScreenMount as default}from"../../chunk-BPFPM3L4.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-4ACVXF5V.js";import"../../chunk-AZOCY74V.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-IFS5P7CO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-DGAXQTDW.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-EXKKLTXH.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-EQFBUNEB.js";import"../../chunk-XWK7WZQS.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PPHUWGLZ.js";import"../../chunk-AFSSKGTD.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-W4U4SHKW.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-GCCBEY2W.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-DD7A6RRL.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-PPL7GB7D.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZXGQT75B.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-47RGVCPH.js";import"../../chunk-GG4FGBFR.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenStoreProvider as default}from"../../chunk-
|
|
1
|
+
export{ScreenStoreProvider as default}from"../../chunk-4ACVXF5V.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{AddBlockRow as e}from"../../chunk-
|
|
2
|
-
return
|
|
3
|
-
return
|
|
4
|
-
/* @__PURE__
|
|
5
|
-
return
|
|
6
|
-
/* @__PURE__
|
|
7
|
-
/* @__PURE__
|
|
8
|
-
/* @__PURE__
|
|
9
|
-
/* @__PURE__
|
|
10
|
-
/* @__PURE__
|
|
11
|
-
return
|
|
12
|
-
/* @__PURE__
|
|
13
|
-
/* @__PURE__
|
|
14
|
-
/* @__PURE__
|
|
15
|
-
/* @__PURE__
|
|
16
|
-
/* @__PURE__
|
|
1
|
+
import{AddBlockRow as e}from"../../chunk-TWFM6GNK.js";import{slotChildRowName as n}from"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import{useEaselUndoKeys as t}from"../../chunk-EXKKLTXH.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-TZIIRGVY.js";import{usePartBridge as c}from"../../chunk-EQFBUNEB.js";import{useSectionOps as p}from"../../chunk-XWK7WZQS.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-GCCBEY2W.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-ZXGQT75B.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as N,useScreenBlockRules as S}from"../../chunk-U7KFFC7N.js";import{slotFieldsOf as y,nestsInTree as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as x,usePanelPick as A,useCancelPanelPick as R}from"../../chunk-R6WTQWAC.js";import{useHostEscape as E}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as B}from"../../chunk-VWXUMVCD.js";import{useEasel as P}from"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import{LayersTree as F,Subtree as v,TreeRow as W,TreeRowAction as G,TreeSeam as H}from"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import{DEFAULT_TREE_WORDS as M}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-NDRZP6YR.js";import{DEFAULT_SAVE_WORDS as g,saveIndicator as w}from"../../chunk-H6DDIBQ4.js";import{SaveState as z,panelWidthVars as X}from"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import{useWords as b}from"../../chunk-MFIRYGHW.js";import"../../chunk-47RGVCPH.js";import"../../chunk-GG4FGBFR.js";import{useTreeDrag as K}from"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as V,parseZoneKey as O}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as J,useRef as L,useEffect as T,useCallback as Y,Fragment as D}from"react";import{Tooltip as Z}from"efficient-shell/ui";import{TrashIcon as I}from"efficient-shell/icons/efficient";import{jsxs as Q,jsx as $,Fragment as U}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=P(e=>e),[ce,pe]=J(d),le=b("screen",B),me=b("tree",M),de=b("save",g),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),Ne=te.data.content?.[0]??null,Se=Ne?.props.id??null,ye=Ne?.type===ae,Ce=Ne?.type===ue,xe=L(null),Ae=L(null);t(Ae);const Re=x(),Ee=A(),Be=R();k(se?.props.id),T(()=>{const e=Ae.current;if(!Ee||!e)return;const n=e=>{"Escape"===e.key&&Be()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Ee]),E(null!==Ee,()=>Be()),T(()=>{Se&&xe.current!==Se&&(xe.current=Se,ye?pe(ke??d):se||re.select({index:0}))},[Se,se,re,ye]);const Pe=Y(e=>pe(n=>f(n,e)?n:e),[]),Fe=j({kind:ce.kind,mode:ce,open:Pe,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:ve}=c({mode:ce,setMode:pe,onOpenPart:o}),We=N(),{labelAtLevel:Ge,Icon:He}=We,{canAddTo:Me}=S(),ge=e=>Ge(e,"block",ie.components[e]?.label??e),we=e=>Ge(e,"section",ge(e)),ze=!ye&&"puck"===ce.kind&&se?.props.id===Se,Xe=Ne?Me(Ne.type)?.spec??null:null,be=Ne&&Xe?`${Ne.props.id}:${Xe.slot}`:null,Ke=Ne&&Xe&&Array.isArray(Ne.props[Xe.slot])?Ne.props[Xe.slot]:[],Ve=e=>n(e,ge,We.plainText),Oe=(e,n)=>{Ne&&Xe&&be&&(pe(d),Xe.slider?(r(String(Ne.props.id),e),re.select({index:e,zone:be}),o(String(Ne.props.id))):(re.select({index:e,zone:be}),o(n)))},Je=()=>{if(!Ne||!Xe||!be)return;const e=Ke.length;re.insertComponent(be,Xe.childType,e),pe(d),Xe.slider?requestAnimationFrame(()=>{r(String(Ne.props.id),e),re.select({index:e,zone:be})}):re.select({index:e,zone:be})},Le=e=>y(ie,e),Te=e=>{const{parentId:n,slot:o}=O(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Le(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(Ne)?.props[o];return Array.isArray(t)?t.length:0},Ye=(e,n,o)=>{const r=Math.min(Math.max(o,0),Te(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},De=K({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>V(n)===e.zone&&n.index>=0&&n.index<=Te(e.zone),onDrop:(e,n)=>Ye(e.zone,e.index,n.index),onStep:(e,n)=>Ye(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ze=(e,n)=>/* @__PURE__ */$(H,{...ne?{}:De.seam({place:{...O(e),index:n}})},`seam:${e}:${n}`),Ie=e=>We.blockRowName(e,ge),Qe=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},$e=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},Ue=(n,o,r)=>/* @__PURE__ */$(e,{choices:r,onPick:e=>$e(n,e,o)}),qe=(e,n)=>{const o=Le((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=Me(e.type),s=t?.choices??null,i="footer"===t?.source?Ie:Ve;/* @__PURE__ */
|
|
2
|
+
return Q(U,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=C(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Qe(o,r,p),{rowProps:m,...a}=De.row({item:{id:p,zone:o,index:r},place:{...O(o),index:r}},{onClick:q(l)});/* @__PURE__ */
|
|
3
|
+
return Q(D,{children:[0===r&&Ze(o,0),
|
|
4
|
+
/* @__PURE__ */$(W,{words:me,icon:/* @__PURE__ */$(He,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */$(G,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */$(I,{size:13})}),rowProps:m}),s&&/* @__PURE__ */$(v,{children:qe(e,n+1)}),Ze(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ue(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Ne?.type,en=Boolean(Ne)&&(Boolean(Me(Ne.type))||Le(Ne.type).length>0),nn=Boolean(Ne)&&(Boolean(Xe)||Ce||ye||_e||en);/* @__PURE__ */
|
|
5
|
+
return Q("div",{ref:Ae,className:"sf-editor es-editor",style:X(i),children:[
|
|
6
|
+
/* @__PURE__ */$("div",{className:"sf-section-bar",children:/* @__PURE__ */$(z,null!==oe?{tone:"off",label:oe,role:"status"}:{...w(ee,de),role:"status"})}),
|
|
7
|
+
/* @__PURE__ */Q("div",{className:"sf-body",children:[Ee&&Re?/* @__PURE__ */$("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */$(m,{panel:Re,pick:Ee})}):nn&&Ne&&/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
+
/* @__PURE__ */$("div",{className:"sf-panel-head",children:/* @__PURE__ */$(Z,{content:ye?le.headerSettings:le.sectionSettings({name:we(Ne.type)}),side:"bottom",children:/* @__PURE__ */$("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(ze?"is-selected":""),"aria-pressed":ze,onClick:()=>{ye?pe(ke??d):(pe(d),re.select({index:0}))},children:we(Ne.type)})})}),
|
|
9
|
+
/* @__PURE__ */$(F,{className:"sf-tree sf-scroll",rootProps:De.rootProps(),words:me,children:/* @__PURE__ */$(v,{children:ye?
|
|
10
|
+
/* @__PURE__ */$(W,{words:me,icon:/* @__PURE__ */$(He,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):Xe?/* @__PURE__ */Q(U,{children:[Ke.map((e,n)=>{const o=se?.props.id===e.props.id,r=Ve(e),t=String(e.props.id),s=()=>Oe(n,t),{rowProps:i,...c}=De.row({item:{id:t,zone:be,index:n},place:{...O(be),index:n}},{onClick:q(s)});/* @__PURE__ */
|
|
11
|
+
return Q(D,{children:[0===n&&Ze(be,0),
|
|
12
|
+
/* @__PURE__ */$(W,{words:me,icon:/* @__PURE__ */$(He,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */$(G,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(be&&(re.removeComponent(be,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */$(I,{size:13})}),rowProps:i}),Ze(be,n+1)]},String(e.props.id??n))}),
|
|
13
|
+
/* @__PURE__ */Q("button",{type:"button",className:"sf-add-card",onClick:Je,children:[
|
|
14
|
+
/* @__PURE__ */$("span",{className:"sf-plus sf-plus--sm",children:"+"}),Xe.addLabel]}),Se?Fe.partRows?.(Ne,_):null]}):qe(Ne,1)})})]}),
|
|
15
|
+
/* @__PURE__ */$("div",{className:"sf-center",children:/* @__PURE__ */$("div",{className:"sf-preview-host",children:/* @__PURE__ */$(fe,{})})}),
|
|
16
|
+
/* @__PURE__ */$(s,{value:{selectChild:(e,n,o,r)=>"section"===Me(r)?.source?Oe(n,o):Qe(e,n,o),addChild:(e,n,o,r,t)=>"section"===Me(t)?.source?Je():$e(`${e}:${n}`,o,r),childRowName:Ve,blockRowName:Ie},children:/* @__PURE__ */$(je,{mode:ce,onOpenWebsiteSettings:Fe.openSettings??(()=>{}),onSelectNode:ve,hideNodeActions:!0})})]})]})}export{ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-EQFBUNEB.js";import"../../chunk-XWK7WZQS.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/dist/screen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-
|
|
1
|
+
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-BPFPM3L4.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-4ACVXF5V.js";import"../chunk-AZOCY74V.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-IFS5P7CO.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-DGAXQTDW.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-BHRC3ASL.js";import"../chunk-6W7WLPZH.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-EXKKLTXH.js";import"../chunk-KCBEE2MC.js";import"../chunk-TZIIRGVY.js";import"../chunk-EQFBUNEB.js";import"../chunk-XWK7WZQS.js";import"../chunk-IYT6NN2J.js";import"../chunk-PPHUWGLZ.js";import"../chunk-AFSSKGTD.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-W4U4SHKW.js";import"../chunk-RKTF5XLP.js";import"../chunk-GCCBEY2W.js";import"../chunk-GMCZXMOV.js";import"../chunk-CLOS6SSX.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-DD7A6RRL.js";import"../chunk-PA3PNTVV.js";import"../chunk-5ZBY24K7.js";import"../chunk-BVN33R76.js";import"../chunk-PPL7GB7D.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-ZXGQT75B.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-U7KFFC7N.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-VWXUMVCD.js";import"../chunk-SJPKSE5G.js";import"../chunk-TBY3DFKS.js";import"../chunk-26GHWMNN.js";import"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-RC25EGHD.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-ECM5F6JJ.js";import"../chunk-4VJATVVR.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-IE55HNMA.js";import"../chunk-Z6PVRXVY.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-FGJSCWUN.js";import"../chunk-Q6AM43CA.js";import"../chunk-66LWADFP.js";import"../chunk-65Z5FSAW.js";import"../chunk-XJCMEEBH.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-47RGVCPH.js";import"../chunk-GG4FGBFR.js";import"../chunk-67GNT6PF.js";import"../chunk-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-
|
|
1
|
+
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-EXKKLTXH.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-XWK7WZQS.js";import"../../../chunk-U7KFFC7N.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-SJPKSE5G.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-26GHWMNN.js";import"../../../chunk-XWFH2NHZ.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-ECM5F6JJ.js";import"../../../chunk-FGJSCWUN.js";import"../../../chunk-Q6AM43CA.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-65Z5FSAW.js";import"../../../chunk-XJCMEEBH.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-546BBOPE.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ILXP5VX5.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-U7KFFC7N.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-SJPKSE5G.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-26GHWMNN.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-RC25EGHD.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-AFWOZM7K.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-I55LUW3C.js";import{Inspector as i}from"./chunk-26GHWMNN.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=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function N(){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 S=o({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(S.Provider,{value:n,children:e})}function P(){return u(S)}function D(){return(P().useOwnerName??v)()}function I(){return(P().useDocumentLabel??g)()}function x(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function B(n){return(P().useStandaloneBridges??h)(n)}function T(n,e){(P().useDocumentPass??y)(n,e)}function W(){return P().blockRules??b}function A(){return P().blockLook??L}function F(){return P().devices??O}function R(){return P().leftView??j}function H(){return P().pinned??w}function K(){return P().saveSwitch??!0}function V(n){e(!0===P().pickFollowsSelection,n)}function E(){return P().storageNamespace||void 0}function M(){return P().styleClipboard??null}function Q(){return P().nodeKeys??!0}function U(){return P().notify??null}function Y(){return P().Canvas??C}function Z(){return P().CanvasHead??null}function q(){return P().canvasDrag??null}var z=o(null);function J({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(z.Provider,{value:n,children:e})}function X(){return u(z)}function $(){return P().Inspector??N}export{c as SELECTION_MODE,J as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,W as useScreenBlockRules,x as useScreenBridges,q as useScreenCanvasDrag,Y as useScreenCanvasFrame,Z as useScreenCanvasHead,X as useScreenCanvasTarget,F as useScreenDevices,I as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,Q as useScreenNodeKeys,U as useScreenNotify,D as useScreenOwnerName,P as useScreenParts,V as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,E as useScreenStorageNamespace,M as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
package/dist/chunk-PQ6ATM4M.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-Z23YOUF5.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-AFWOZM7K.js";import{useEasel as p}from"./chunk-I55LUW3C.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-XQGBZGVP.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-PPL7GB7D.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-AFWOZM7K.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VWXUMVCD.js";import{useEasel as d}from"./chunk-I55LUW3C.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-47RGVCPH.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-GG4FGBFR.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var B=e=>`section:${e}`,O=e=>`block:${e}`,$=e=>`template:${e}`;function w({at:w,placeBlocks:C,canTake:F,onPick:G,itemFor:I,session:L,siteWide:P,onClose:R,onHide:W,readOnly:x}){const A=d(e=>e.config),D=a(),{labelAtLevel:E,categoryLabel:H,firstSection:T,Icon:M,Thumbnail:N}=D,{blockIsOffered:z,canAddTo:K}=p(),Q=f("screen",m).add,S=f("drag",h).add,U=l(),[Y,Z]=u([]);k(()=>{let e=!1;const t=e=>z(e,U);return s(U).list().then(o=>{if(e)return;const s=A.components;Z(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[A,U]);const J=b(()=>e(A,D),[A]),X=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */j(N,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Y.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(M,{type:e,size:26})}),ee=b(()=>{const e=t(J,T),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&z(e.type,U)&&n.set(e.type,e)};for(const t of e?[e]:J){const e=K(t.type)?.choices??[];e.forEach(s),e.forEach(e=>K(e.type,1)?.choices?.forEach(s))}C?.forEach(s);const i=new Set(J.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:O(e.type),label:e.label,cover:_(e.type),title:Q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...X(e),cover:_(e.type)}:X(e),p=[];Y.length>0&&p.push({key:"templates",title:Q.templates,tiles:Y.map(e=>{return{type:$(e.id),label:e.name,cover:/* @__PURE__ */j(N,{type:e.node.type}),keywords:[(t=e.node.type,E(t,"section",A.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(A.categories??{})){const n=J.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(l)),d=!0),p.push({key:`category:${t}`,title:o(A,t,H),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!F)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?F(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[Y,J,A,Q,F,C,U]);/* @__PURE__ */
|
|
2
|
-
return v(V,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Q.title,context:Q.contextAll,actions:/* @__PURE__ */j(r,{label:Q.done,description:Q.doneDescription,onClick:R}),onHide:W}),
|
|
4
|
-
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:L,itemFor:e=>I(q(e)??{kind:"section",type:e}),onInsert:G?e=>{const t=q(e);t&&G(t)}:void 0,at:w,hint:Q.hint,searchLabel:Q.search,readOnly:x,words:S}),P??null]})]})}export{w as AddSidePanel,O as blockKey,B as sectionKey,$ as templateKey};
|