efficient-easel 1.0.0 → 1.0.1
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-4SWZAYKI.js +5 -0
- package/dist/{chunk-FEK3S6HN.js → chunk-FER7FCAG.js} +1 -1
- package/dist/{chunk-DJMMTWFP.js → chunk-GXFAQ7JN.js} +1 -1
- package/dist/{chunk-CKEPQNSQ.js → chunk-I64QM6DU.js} +1 -1
- package/dist/chunk-O5F46JWM.js +64 -0
- package/dist/chunk-QFMJBBKM.js +5 -0
- package/dist/{chunk-ZP4G3X44.js → chunk-QRKKQGUO.js} +1 -1
- package/dist/chunk-QTPJMJOJ.js +1 -0
- package/dist/{chunk-YABL4EWX.js → chunk-RG7PFKCA.js} +3 -3
- package/dist/{chunk-JMGPPXNQ.js → chunk-WDXPWSP7.js} +3 -3
- package/dist/fields/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/puck/use-section-ops.d.ts +16 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +5 -0
- package/dist/screen/lib/screen-parts.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4GNPKHV4.js +0 -64
- package/dist/chunk-OJAJVH7S.js +0 -5
- package/dist/chunk-OTEXGJDU.js +0 -5
- package/dist/chunk-QMNML7XH.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as s}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as i}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-QR4DLZ3P.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-QFMJBBKM.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as u}from"./chunk-PYCLHOSA.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{AddPanel as f}from"./chunk-W3XX2CNW.js";import{AddIcon as h}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as $,Fragment as B}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,L=e=>`template:${e}`;function x({blocks:x,blocksOnly:H,at:R,onAdd:A,itemFor:C,session:I,siteWide:N,onClose:V,onHide:W,readOnly:D}){const F=u(e=>e.config),M=p(),{labelAtLevel:P,categoryLabel:Q,firstSection:K,Icon:S,Thumbnail:T}=M,{blockIsOffered:Y}=m(),Z=k("screen",d).add,w=l(),[z,E]=y([]);b(()=>{let t=!1;const o=e=>Y(e,w);return i(w).list().then(n=>{if(t)return;const s=F.components;E(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[F,w]);const G=j(()=>t(F,M),[F]),J=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */g(T,{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)}),X=j(()=>{const e=[];if(x&&x.choices.length>0&&a(x.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:x.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */g(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),H)return e;const t=o(G,K);t&&e.push({key:"start",title:Z.startBlank,tiles:[J(t)]}),z.length>0&&e.push({key:"templates",title:Z.templates,tiles:z.map(e=>{return{type:L(e.id),label:e.name,cover:/* @__PURE__ */g(T,{type:e.node.type}),keywords:[(t=e.node.type,P(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const i=n(G,K);for(const t of Object.keys(F.categories??{})){const o=i.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:s(F,t,Q),tiles:o.map(J)})}return e},[x,H,z,G,F,Z]),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=z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return $(B,{children:[
|
|
3
|
+
/* @__PURE__ */g(r,{icon:/* @__PURE__ */g(h,{size:15}),title:Z.title,context:H?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */g(c,{label:Z.done,description:Z.doneDescription,onClick:V}),onHide:W}),
|
|
4
|
+
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */g(f,{groups:X,session:I,itemFor:e=>C(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&A(t)},at:R,hint:H?Z.hintBlocks:Z.hint,searchLabel:H?Z.searchBlocks:Z.searchSections,readOnly:D}),N&&!H?N:null]})]})}export{x as AddSidePanel,v as blockKey,O as sectionKey,L as templateKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-QFMJBBKM.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PYCLHOSA.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 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-QTPJMJOJ.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-QFMJBBKM.js";import{useEasel as p}from"./chunk-PYCLHOSA.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 h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-QFMJBBKM.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-TJ7YIRWQ.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};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-PT6V53OO.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-ORR3Q4WV.js";import{usePartBridge as v}from"./chunk-GXFAQ7JN.js";import{useSectionOps as x}from"./chunk-QTPJMJOJ.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-JLTZQ4US.js";import{PageEditGuardNotices as z}from"./chunk-MAEXP3KE.js";import{useScreenDocument as B}from"./chunk-ONRYLR2D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as N}from"./chunk-4SWZAYKI.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-QR4DLZ3P.js";import{MediaSidePanel as A}from"./chunk-I64QM6DU.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as W,useScreenLeftView as H,useScreenAdd as F,SELECTION_MODE as J,sameInspectorMode as U,useScreenBridges as G,useScreenBlockRules as Y,useScreenBlockLook as Q,useScreenStorageNamespace as X,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-QFMJBBKM.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-E2O2MRZR.js";import{useEasel as ve,useEaselApi as xe}from"./chunk-PYCLHOSA.js";import{TreeRow as be,Subtree as we,LayersTree as ze,TreeGroupLabel as Be,TreeRowAction as Ce,TreeSeam as Oe}from"./chunk-XWR5YVA7.js";import{toItemSelector as $e,useNodeOps as Ie}from"./chunk-D2BCHTQR.js";import{saveIndicator as Ne}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Pe,TopBarRail as Te,TopBarCluster as Ae,EaselIconButton as Re,TopBarDivider as Me,DeviceSwitch as je,InspectorIconButton as Ee,PanelResizeHandle as Le,MAX_PANEL_W as De,MIN_PANEL_W as Ve,panelWidthVars as We,SaveState as He,SaveStateToggle as Fe}from"./chunk-TJ7YIRWQ.js";import{useWords as Je}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ue}from"./chunk-W3XX2CNW.js";import{createDragSession as Ge,useTreeDrag as Ye,gapToMoveIndex as Qe}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Xe,BLOCK_SELECTOR as Ke,useCanvasEvent as _e}from"./chunk-PAELDYYS.js";import{LayersIcon as qe,MediaIcon as Ze,UndoIcon as en,RedoIcon as nn,TrashIcon as tn,EyeOffIcon as on,EyeIcon as rn,DuplicateIcon as ln}from"./chunk-L5KW4HG5.js";import{zoneKey as sn,ROOT_ID as dn,ROOT_SLOT as cn,parseZoneKey as an,DataError as pn}from"./chunk-KRXQM65X.js";import{useRef as un,useMemo as fn,useState as hn,useEffect as mn,useCallback as gn,useLayoutEffect as yn,Fragment as kn}from"react";import{Tooltip as Sn,Button as vn,toast as xn}from"efficient-shell/ui";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Bn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(He,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return bn(He,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Ne(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(vn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return wn(zn,o?{children:[
|
|
4
|
+
/* @__PURE__ */bn(Fe,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */bn(He,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */bn(He,{tone:l,label:s,role:"status"}),d]})}function Cn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return bn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */wn(zn,e?{children:[
|
|
7
|
+
/* @__PURE__ */bn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */bn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */bn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */bn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */bn("path",{d:"M5 12h14"})]})})}function On(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var $n="__rungs";var In="screen:band",Nn={duplicate:!0,delete:!0};function Pn(){const Ne=ye(),{target:He,docId:Fe,capabilities:Pn,currentSlug:Tn,siteId:An,onPublish:Rn,saveState:Mn,saveConflict:jn,retrySave:En,toggleAutoSave:Ln,readOnly:Dn,readOnlyReason:Vn=null}=B(),Wn=R(),Hn=M(),{mediaEditing:Fn,hasEditGuard:Jn,hasPinnedChrome:Un}=Pn,{appState:Gn,dispatch:Yn,history:Qn,selectedItem:Xn,getSelectorForId:Kn,config:_n}=ve(e=>e),qn=j(),{first:Zn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=qn,it=rt(Zn),lt=e=>oe(qn,e),st=e=>re(qn,e),dt="node"===qn.firstRow,ct=qn.band??null,at=Je("screen",Se),pt=E()??`/${Tn}`,ut=L(),ft=D(),ht=x({readOnly:Dn}),mt=x({readOnly:Dn,foldIntoHistory:!0}),gt=un(null),yt=xe(),kt=fn(()=>({...ht,select:e=>{gt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yt.config;gt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,yt]),St=Gn.ui,vt=St.leftSideBarVisible,xt=St.rightSideBarVisible,{options:bt,widths:wt,initial:zt,fluid:Bt,fit:Ct}=V(),[Ot,$t]=hn(zt),It=he(),Nt=Fn&&null!==It,Pt=me(),Tt=ge();W(Xn?.props.id);const{read:At,write:Rt,forSelection:Mt}=H(),[jt,Et]=hn(At);mn(()=>{Rt(jt)},[jt]);const[Lt,Dt]=hn(0),Vt=un(null),Wt=un(null),Ht=Xe(Wt,{readySelector:Ke}),Ft=f(Wt);h(Wt,Ht);const[Jt,Ut]=hn(!1),Gt=un(!1),Yt=un(!1),[Qt,Xt]=hn(null),Kt=F(),_t=e=>Xt(null===e?null:{zone:le,index:e}),[qt,Zt]=hn([]),[eo,no]=hn(J),to="puck"===eo.kind,oo=Jt&&!Qt&&Kt.railTarget?Kt.railTarget(Gn.data,{node:Xn??null,mode:eo}):null,ro=oo?{zone:sn(oo),index:oo.index}:null,io=Qt??ro,lo=io&&io.zone===le?io.index:null,so=t(eo,Xn?.props.id),[co,ao]=hn(null);mn(()=>{co&&(o(),ao(null))},[co]);const po=un(Kn);po.current=Kn;const uo=gn((e,{scroll:n})=>{Et(n=>Mt(e,n)),n&&ao(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=po.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ho(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),fo=un(null);mn(()=>{const e=fo.current;fo.current=null;const n=null==Xn?.props.id?null:String(Xn.props.id);no(e&&e.id===n?e.mode:rt(Xn?.type)??J);const t=Xn?.props.id,o=gt.current;if(gt.current=null,!t)return;const i=Kn(t);uo(String(t),{scroll:!r(o,i??null,le)})},[Xn?.props.id,uo]);const ho=gn(e=>{no(n=>U(n,e)?n:e),Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Yn]),mo=un(()=>{});mo.current=(e,n)=>{const t=e?Ar(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Xn?.props.id?null:String(Xn.props.id);no(e=>U(e,n)?e:n),o!==r&&(fo.current={id:o,mode:n},kt.select(e))};const go=gn((e,n)=>mo.current(e,n),[]),yo={kind:eo.kind,mode:eo,open:ho,show:e=>no(e),reveal:()=>{xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:go},ko=G(yo,{data:Gn.data,selected:Xn??null,zoneOf:e=>Kn(e)?.zone,readOnly:Boolean(Dn),select:e=>{no(J),kt.select({index:e})},replace:(e,n)=>kt.replaceComponent(le,e,n),scrollTo:e=>ri(e)},{device:Ot,refreshes:Lt},{setView:Et,reveal:()=>{vt||Yn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),So=ko.pinnedSource??!1,vo=ko.resolveLeftView?ko.resolveLeftView(jt,Nt):"media"===jt&&Nt?jt:"sections",xo=Y(),{isLockedBlock:bo,duplicateBlocked:wo,nestDepth:zo,newSectionNode:Bo,canAddTo:Co,blockIsOffered:Oo}=xo,$o=Q(),{labelAtLevel:Io,Icon:No,useProducts:Po}=$o,To=$o.rowName?(e,n,t)=>$o.rowName(e,n,t):void 0,Ao=gn(e=>{Yn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),uo(e,{scroll:!0})},[Yn,uo]),{selectNode:Ro,openPartId:Mo}=v({mode:eo,setMode:no,onOpenPart:Ao}),[jo,Eo]=hn(null);ke(null!==jo,()=>Eo(null));const Lo=y(X()),Do=Lo.collapsed,Vo=Lo.panelWidths,[Wo,Ho]=hn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Do);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});mn(()=>{try{window.localStorage.setItem(Do,JSON.stringify([...Wo]))}catch{}},[Wo]);const[Fo,Jo]=hn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Vo);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});mn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Vo,JSON.stringify(Fo))}catch{}},300);return()=>clearTimeout(e)},[Fo]);const Uo=gn((e,n)=>Jo(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Go=gn(e=>Uo("left",e),[Uo]),Yo=gn(e=>Uo("right",e),[Uo]),Qo=e=>Wo.has(e),Xo=e=>Ho(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ko=un(!1),_o=un(null);mn(()=>{if(Ko.current&&!Jt){const e=_o.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Wt.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),_o.current=null}Ko.current=Jt},[Jt]),mn(()=>{if(!Jt||!Ft)return;const e=e=>{"Escape"===e.key&&fi()};return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[Jt,Ft]),ke(Jt,()=>fi()),mn(()=>{!vt&&Jt&&(Ut(!1),Xt(null),Gt.current=!1)},[vt]),mn(()=>{if(!Pt)return Yt.current&&Yn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Yt.current=!1);Jt&&(Ut(!1),Xt(null),Yt.current=Gt.current,Gt.current=!1),vt||(Yt.current=!0,Yn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Pt]),mn(()=>{!vt&&Pt&&(Yt.current=!1,Tt())},[vt]),mn(()=>{if(!Pt||!Ft)return;const e=e=>{"Escape"===e.key&&Tt()};return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[Pt,Ft]),ke(null!==Pt,()=>Tt());const qo=K(),Zo=(e,n="success")=>{qo?qo(e,"error"===n?"error":"info"):"error"===n?xn.error(e,{duration:3200,sound:!1}):xn.success(e,{duration:1900,sound:!1})},er=un(null),[nr,tr]=hn(0),[or,rr]=hn(0),ir=_(),lr=un(null),sr=e=>Math.max(0,e.clientHeight-(lr.current?.offsetHeight??0));mn(()=>{const e=er.current;if(!e)return;const n=()=>{tr(e.clientWidth),rr(sr(e))};n();const t=new ResizeObserver(n);return t.observe(e),lr.current&&t.observe(lr.current),()=>t.disconnect()},[]),yn(()=>{er.current&&(tr(er.current.clientWidth),rr(sr(er.current)))},[Fo,vt,xt]);const dr=Ot===Bt?nr>0?nr:wt[Bt]:wt[Ot],cr=nr>0?Math.min(nr/dr,"shrink"===Ct?1:2):1,ar=dr*cr,pr=nr>0&&ar>nr+1,ur={width:ar,height:or||"100%",flex:"none",position:"relative"},fr={width:dr,height:or?or/cr:"100%",maxHeight:"none",transform:1!==cr?`scale(${cr})`:void 0,transformOrigin:"top left"},hr=()=>Yn({type:"setUi",ui:{leftSideBarVisible:!vt}}),mr=()=>Yn({type:"setUi",ui:{rightSideBarVisible:!xt}}),gr=e=>{Jt&&(Ut(!1),Xt(null),Gt.current=!1,vt&&jt===e)||Pt&&(Yt.current=!1,Tt(),vt&&jt===e)||(vt&&jt===e?hr():(Et(e),vt||Yn({type:"setUi",ui:{leftSideBarVisible:!0}})))},yr=()=>{C(Ne,{accept:"image/*",title:"Media library"})},kr=()=>{no(J),kt.select(null),u()},Sr=()=>{no(it??J),xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},vr=Gn.data.content??[],xr=()=>{const e=vr.findIndex(lt),n=vr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:vr.length}},br=_n,wr=xo.stripCopy,zr=e=>i(e,wr),Br=b(),Cr=Ie({data:Gn.data,config:br,readOnly:Boolean(Dn),clipboard:Br,strip:wr?e=>wr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==dn||e.slot!==cn)return{min:0,max:n-1};const{floor:t,cap:o}=xr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&no(J);const t=void 0===n||"node"===n?.kind?n:null;kt.commitDocument(e,t)}}),Or=e=>_n.components[e]?.label??e,$r=gn(e=>_n.components[e]?.defaultProps??{},[_n]),Ir=e=>Io(e,"section",Or(e)),Nr=e=>l({type:e.type,props:e.props??{}},Ir(e.type),To),{nodeAddresses:Pr,zoneItems:Tr}=fn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(_n,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vr,le,0),{nodeAddresses:e,zoneItems:n}},[vr,_n]),Ar=gn(e=>Tr.get(e)??[],[Tr]),Rr=e=>{const n=Pr.get(e);return n?Ar(n.zone)[n.index]:void 0},Mr=e=>ie(xo,_n,e),jr=e=>{if(!xo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Rr(e.slice(0,n));if(!t)return null;const o=Mr(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}},Er=(()=>{if(!q(eo))return null;const e=`${eo.nodeId}:${eo.slot}`;return jr(e)?.slot.panel===eo.kind?e:null})(),Lr=un(null);mn(()=>{const e=Lr.current;if(Lr.current=null,!Er||!q(eo))return;const n=eo.nodeId;uo(n,{scroll:e!==Er}),Ho(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[eo]);const Dr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Pr.get(e);n&&(n.zone===le?ii(n.index):Mi(n.zone,n.index,e,Rr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Er!==i&&(Lr.current=i),go(null,r),xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}}),ri(o)},Vr=(e,n,t)=>{const o=`${e}:${n}`;if(Ho(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;Er!==o&&(Lr.current=o);go(null,{kind:t,nodeId:e,slot:n})},Wr=(e,n,t)=>{if(Dn||!xo.moveSlot)return;const o=Rr(e),r=o?Mr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Qe(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=xo.moveSlot(e,n,s);"string"==typeof d&&Vr(e,d,i.panel)},Hr=Po(),Fr=fn(()=>{const e=/* @__PURE__ */new Map;for(const n of Hr??[])e.set(n.slug,n.name);return e},[Hr]),Jr=e=>s(e,Or,$o.plainText,e=>Fr.get(e),$o.rowName),Ur=(e,n)=>{const t=_n.components[e.type]?.fields,o=n===le||Zi(n)?"section":"block",r=n===le&&(lt(e)||st(e)||tt(e.type)),i="block"===o?d(t):r?null:c(t);return $o.renamePropOf?$o.renamePropOf(e,o,i):i},Gr=(e,n,t,o)=>{if(!(!Dn&&jo?.zone===e&&jo.index===n))return;const r=(t,o)=>{Eo(null),o&&((e,n,t)=>{const o=Ar(e)[n];if(!o)return;const r=Ur(o,e);r&&kt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return bn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Yr=n(Z()),Qr=Yr.scope({target:He,siteId:An,docId:Fe}),Xr=_n,Kr=(e,n)=>n===le?Ir(e):Or(e),_r=(e,n,t)=>{const o=Yr.plan(Qr,t,Kr(t.type,e),Xr);o&&(o.changed&&kt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Zo(o.message))},qr=w({nodesIn:Ar,nodeAt:(e,n)=>Ar(e)[n]??null,labelOf:(e,n)=>n===le?Ir(e):Or(e),renamePropOf:Ur,beginRename:(e,n)=>Eo({zone:e,index:n}),history:{hasPast:Qn.hasPast,hasFuture:Qn.hasFuture,back:()=>Qn.back(),forward:()=>Qn.forward()},openAddSection:()=>{kt.select(null),pi(null)},openPageSettings:()=>{kt.select(null),no(J)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Dn),collapseAll:()=>Ho(new Set(Ar(le).map(e=>String(e.props.id)))),onPasteRefused:e=>Zo(e?at.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>nl(e,n),menuRows:ko.menuRows,isLocked:e=>bo(e.type),duplicateBlocked:e=>wo(Gn.data,e),permits:e=>se(_n,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:xr,openAddInside:(e,n)=>{e===le?ii(n):kt.select({zone:e,index:n}),pi(null)},locate:e=>Pr.get(e)??null,rowNameOf:(e,n)=>n===le?Nr(e):Jr(e),selectAt:(e,n,t,o)=>{e===le?ii(n):Mi(e,n,t,o??"")},slotRung:e=>{const n=jr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Dr(n.node,n.slot,!1)}:null},style:{held:()=>O(Qr),canCopy:e=>Yr.rows(Xr,e).some(e=>!1!==e.counted),copy:(e,n)=>Yr.copy(Qr,e,Kr(e.type,n),Xr),paste:(e,n,t)=>_r(e,n,t)},keys:Hn?{target:Ft,selected:()=>{const e=Gn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Br.get(),readOnly:Boolean(Dn),onDone:({done:e,name:n})=>{"copied"===e&&Zo(at.copied({name:n}))}}:void 0},Ht),Zr=un({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});mn(()=>{Zr.current={copy:(e,n)=>Yr.copy(Qr,e,Kr(e.type,n),Xr),paste:_r,at:()=>{const e=Gn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Ar(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Dn)}});const ei=gn(e=>{const n=$(e);if(!n)return;const t=Zr.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))},[]);mn(()=>{if(!Ft)return;const e=e=>ei(e);return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[ei,Ft]),_e(Ht,"keydown",ei);const ni=vr.map(e=>e.props.id).join("|");mn(()=>{const e=Ht?.document??null,n=Ht?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zt(e=>e.length?[]:e);const n=vr.findIndex(st),t=n>=0?n:vr.length,o=n=>{const t=vr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ke)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=On(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Zt(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()}},[Ht,ni,Ot,cr,vt,xt,Xn?.props.id]);const ti=Ht?.document??null,oi=Ht?.window??null;mn(()=>{const e=Vt.current;if(!e||!ti||!oi)return;const n=[],t=()=>{const n=ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&oi.scrollTo({left:oi.scrollX,top:oi.scrollY+t,behavior:"instant"}),!0};return Vt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ti,oi]);const ri=e=>{ko.holdCanvasOn?ko.holdCanvasOn(e):a(e)},ii=e=>{no(J),kt.select({index:e}),ko.sectionPressed?.(vr[e]);const n=vr[e]?.props?.id;n&&ri(n)},li=e=>{const{floor:n,cap:t}=xr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Xn&&eo.kind!==it?.kind?vr.findIndex(e=>e.props.id===Xn.props.id):-1;return o(r>=0?r+1:t)},si=(e,n)=>{const{floor:t,cap:o}=xr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(kt.reorderComponent(le,e,i),kt.select({index:i}),{moved:!0,dest:i})},di=(e,n,t,o)=>{no(J),kt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Zo(`Added “${t}” section`)},ci=(e,n)=>{const t=li(n),o=Bo(e,{nodeDefaults:$r,newNodeId:fe,sectionLabel:Ir,blockIsOffered:Oo}),r=o?kt.insertNode(le,t,o):kt.insertSection(e,t);return di(t,r,Ir(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 ce(_n,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Co(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},ai=(e,n,t)=>{const o=li(t),r=kt.insertNode(le,o,n);return di(o,r,e),o},pi=e=>ui(le,e),ui=(e,n)=>{_o.current=document.activeElement??null,Pt&&(Gt.current=Yt.current,Yt.current=!1,Tt()),Xt(null===n?null:{zone:e,index:n}),Ut(!0),vt||(Gt.current=!0,Yn({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{Ut(!1),Xt(null),Gt.current&&Yn({type:"setUi",ui:{leftSideBarVisible:!1}}),Gt.current=!1},hi=(e,n,t)=>{if("section"===e.kind)kt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;kt.insertNode(n,t,zr(e.template.node))}no(J),kt.select({index:t,zone:n})},mi=(e,n)=>$o.rowName?n?lt(e)?$o.rowName(e,"section",at.header):st(e)?$o.rowName(e,"section",at.footer):tt(e.type)?$o.rowName(e,"section",Or(e.type)):Nr(e):Jr(e):n?Ir(e.type):Or(e.type),gi=e=>n=>{e()},yi=()=>ko.editPinnedSource?.(),ki=(e,n,t)=>{if(Dn)return null;const o=Ar(e)[n];return o&&!se(_n,o.type).delete?null:/* @__PURE__ */bn(Ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Ar(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(tn,{size:15})})},Si=e=>$o.rowPreview?.(e)||void 0,vi=e=>$o.rowMarks?.(e)??void 0,xi=(e,n,t)=>$o.rowActions?.(e,n,t)??null,bi=(e,n,t,o)=>{if(Dn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return bn(Ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>zi(e,n,t),children:/* @__PURE__ */bn(r?on:rn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},wi=e=>{const n=Ir(vr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return xl(le,e,()=>pi(e),t)},zi=(e,n,t)=>{kt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Bi=e=>ae(_n,e),Ci=e=>ce(_n,e),Oi=e=>xo.slotsOf?Mr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ci(e)}],$i=e=>xo.slotsOf?Oi(e).flatMap(e=>e.kids):Ci(e),Ii=e=>Boolean(xo.slotsOf)&&Mr(e).some(e=>e.rung),Ni=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Pi=(e,n,t)=>{const o=ue(_n,e.type,n)&&(t||$i(e).length>0||Ii(e));return{collapsible:o,folded:o&&Qo(String(e.props.id))}},Ti=(e,n,t)=>Oi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Pi(e,r,t(e.type)).collapsible?[String(e.props.id),...Ti(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ai=e=>$i(e).length>0||Ii(e)||Boolean(Co(e.type)),Ri=e=>Boolean(Co(e)),Mi=(e,n,t,o)=>{if(no(J),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),kt.select({index:n,zone:e}),a(t)}else kt.select({index:n,zone:e}),ri(t)},ji=(e,n,t,o,r)=>{const i=`${e}:${n}`;kt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),kt.select({index:o,zone:i})}):kt.select({index:o,zone:i})},Ei=(e,n,t)=>{kt.insertComponent(e,n,t),no(J),kt.select({index:t,zone:e})},Li=un(/* @__PURE__ */new Set);mn(()=>{vr.forEach(e=>{const n=Co(e.type)?.spec;if(!n)return;const t=e.props.id;if(Li.current.has(t))return;Li.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($r)).forEach((e,t)=>mt.seedChild(o,t,n.childType,e))})},[vr,mt,$r]);const Di=un(/* @__PURE__ */new Set);mn(()=>{vr.forEach((n,t)=>{const o=n.props.id;if(Di.current.has(o))return;const r=e(n,Bi(n.type));Di.current.add(o),r&&mt.replaceComponent(le,t,{...n,props:r})})},[vr,mt]),ee(mt,_n);const Vi=vr.findIndex(st),Wi=Vi>=0?vr[Vi]:null,Hi=dt?vr.findIndex(lt):-1,Fi=Hi>=0?vr[Hi]:null,Ji=vr.find(e=>e.type===et)??null,Ui=vr.find(e=>e.type===nt)??null,Gi=Vi>=0?Vi:vr.length,Yi=[];vr.forEach(e=>{st(e)||(Ai(e)&&Yi.push(String(e.props.id)),Yi.push(...Ti(e,1,Ri)))}),Wi&&(Yi.push(String(Wi.props.id)),Yi.push(...Ti(Wi,1,Ri)));const Qi=Yi.length>0&&Yi.every(e=>Wo.has(e)),Xi=e=>{const n=$o.blockRowName(e,Or);return $o.rowName?$o.rowName(e,"block",n):n},Ki=(e,n,t,o)=>{const r=Ar(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Ar(n).length)},s=Qe(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},_i=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ci(e))n.add(r),t(o)};for(const t of Bi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},qi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Pr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Zi=e=>{const n=e.slice(0,e.indexOf(":")),t=vr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},el=(e,n,t)=>{if(e.rung){const t=Rr(e.rung.nodeId),o=t?Mr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===$n&&n.index>=0&&n.index<=o}if(n.slot===$n)return!1;if(e.add)return ol(e.add,n);const o=sn(n);if(tt(e.type))return!1;const r=Zi(o),i=Zi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Ar(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=xr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ar(o).length)return!1;if(e.zone===o)return!0;const l=Wi&&!qn.lastIsOpen?String(Wi.props.id):null;return(!l||qi(e.zone)!==l&&qi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ar(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pr.get(i),s=l?Ar(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&_i(r).has(n))return!1;const d=Co(s.type,zo(Gn?.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?.(Ar(n),r))})(e.zone,o,e.index,t)},nl=(e,n)=>{const t=sn(e.from);if(t===sn(n))return!0;const o=e.node;return el({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},tl=e=>{const n=e.slice(0,e.indexOf(":")),t=Pr.get(n),o=t?Ar(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,zo(Gn?.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:Or(r.spec.childType)}]:[]),l=jr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:mi(o,t.zone===le)}},ol=(e,n)=>{const t=sn(n);if("block"!==e.kind){if(Zi(t))return n.index>=0&&n.index<=Ar(t).length;if(t!==le)return!1;const{floor:e,cap:o}=xr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=tl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Ar(t))},rl=(e,n)=>{e.rung?Wr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Zi(sn(n)))return void hi(e,sn(n),n.index);if("section"===e.kind)return void ci(e.type,n.index);if("template"===e.kind)return void ai(e.template.name,zr(e.template.node),n.index);const t=sn(n),o=tl(t);o&&(o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(t,e.type,n.index))})(e.add,n):e.zone===le?si(e.index,n.index):Ki(e.zone,sn(n),e.index,n.index)},[il]=hn(()=>Ge()),ll=Ye({keyOf:e=>e.id,readOnly:Boolean(Dn),session:il,canDrop:el,onDrop:rl,onStep:(e,n)=>{e.rung?Wr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Ir(vr[e]?.type??""),o=si(e,n<0?e-1:e+2);if(!o.moved)return void Zo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=xr();Zo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Ki(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),sl=gn(e=>{const{floor:n,cap:t}=xr(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Ar(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||bo(i.type))continue;if(tt(i.type))continue;const l=Boolean(Zi(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ir(i.type):Jr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(tl(sn(e.list))?.choices.length)||Boolean(Zi(sn(e.list))))}},[Gn.data]),dl=e=>{no(J),kt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},cl=ne(),al=()=>({data:Gn.data,device:Ot,ops:kt,inspector:yo}),pl=cl?.model,ul=fn(()=>pl?e=>pl(e,sl(e),al()):sl,[pl,sl,Ot]),fl=cl?.measure,hl=fl?(e,n)=>fl(e,n,al()):void 0,ml=cl?.canDrop,gl=ml?(e,n)=>ml(e,n,el,al()):el,yl=cl?.drop,kl=yl?(e,n)=>yl(e,n,rl,al()):rl,Sl=cl?.pick,vl=Sl?e=>Sl(e,dl,al()):dl,xl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Dn?{}:ll.seam({place:{...an(e),index:n}}),onAdd:Dn?void 0:t,label:o},`seam:${e}:${n}`),bl={rowClick:gi,isCollapsed:Qo,toggleCollapse:Xo},wl=e=>{const n=String(e.props.id),t=vr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Ar(o),i=Qo(n),l=Or(e.type),s=$o.rowName?$o.rowName(e,"section",l):l,d=e=>xl(o,e,()=>ui(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return wn(zn,{children:[
|
|
16
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(t),nameSlot:Gr(le,t,n,s),selected:so===n,actions:xi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:gi(()=>ii(t))},fold:{open:!i,label:"section",onToggle:()=>Xo(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Nr(n),l=Ai(n),s=l&&Qo(r),c=()=>Mi(o,t,r,e.type),{rowProps:a,...p}=ll.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:gi(c)});/* @__PURE__ */
|
|
17
|
+
return wn(kn,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:c,nameSlot:Gr(o,t,r,i),selected:so===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Xo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(o,t,i),xi(n,o,t),bi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},zl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ll.dragging,d=!Qo(l)&&s?.rung?.nodeId!==i,c={...an(l),index:0},a=s&&!s.rung&&el(s,c)?c:void 0,p=()=>Dr(e,n,!0),{rowProps:u,...f}=ll.row({item:{id:`rung:${l}`,zone:`${i}:${$n}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:$n,index:t},into:a,canDrag:Boolean(xo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:gi(p)}),h=Dn?null:xo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return wn(kn,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Er===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Xo(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Ce,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Dn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vr(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__ */bn(tn,{size:15}):/* @__PURE__ */bn(ln,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},Bl=(e,n)=>{const t=Oi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
+
return bn(zn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ni(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=null!==c&&Boolean(tl(c)?.choices.length),p=(e,n)=>a?xl(e,n,()=>ui(e,n),"Add block here"):xl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),{collapsible:i,folded:s}=Pi(n,l,Ri(n.type)),d=String(n.props.id),c=Xi(n),a=()=>Mi(t,o,d,e.type),{rowProps:u,...f}=ll.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:gi(a)});/* @__PURE__ */
|
|
22
|
+
return wn(kn,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:c,preview:Si(n),marks:vi(n),onSelect:a,nameSlot:Gr(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Xo(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(t,o,c),xi(n,t,o),bi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:Bl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?zl(e,t.rung,r++,o,u):/* @__PURE__ */bn(kn,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=zo(Gn?.data,e.type,String(e.props.id)),o=Oi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
+
return bn(zn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ni(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=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>ji(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>ui(n,t):void 0;return xl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */wn(zn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),i=Jr(n),l=String(n.props.id),{collapsible:d,folded:c}=Pi(n,s,Ri(n.type)),a=Bi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...an(p),index:Ar(p).length}:void 0,f=ll.dragging,h=u&&f&&el(f,u)?u:void 0,g=()=>Mi(t,o,l,e.type),{rowProps:y,...k}=ll.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!bo(n.type)},{"data-node-id":l,onClick:gi(g)});/* @__PURE__ */
|
|
25
|
+
return wn(kn,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:g,nameSlot:Gr(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Xo(l)}:void 0,actions:bo(n.type)?xi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[ki(t,o,i),xi(n,t,o),bi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */bn(we,{children:Cl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
+
/* @__PURE__ */bn(I,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ji(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?zl(e,o.rung,i++,r,k):/* @__PURE__ */bn(kn,{children:k},o.slot??"")})})},Ol=(()=>{if(!Xn||!to)return null;const e=String(Xn.type),n=String(Xn.props.id),t=Co(e,zo(Gn?.data,e,n));if(!t||"footer"===t.source)return null;const o=vr.some(e=>String(e.props?.id)===n),r=Array.isArray(Xn.props[t.slot])?Xn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Or(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:mi(Xn,o),choices:i,onPick:o=>{t.spec?ji(n,t.slot,o,r.length,e):Ei(`${n}:${t.slot}`,o,r.length)}}})(),$l=io&&io.zone!==le&&!Zi(io.zone)?io.zone:null,Il=!0===Kt.blocksFirst,Nl=$l?tl($l):Il&&io?null:Ol,Pl=Boolean(Qt&&$l)||Il&&Boolean(Nl&&Nl.choices.length>0),Tl=Jt||null!==Pt,Al=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:vt&&!Tl&&vo===e.id,onSelect:()=>gr(e.id)}:e,Rl=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Jt,onSelect:()=>Jt?fi():pi(null)},...(ko.railLead??[]).map(Al),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(qe,{}),active:vt&&!Tl&&"sections"===vo,onSelect:()=>gr("sections")},...(ko.railTrail??[]).map(Al)];Nt?Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),active:vt&&!Jt&&(null!==Pt||"media"===vo),onSelect:()=>gr("media")}):Fn&&Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),onSelect:yr});const Ml=[...ko.railLead??[],...ko.railTrail??[]].find(e=>"panel"in e&&e.id===vo),jl=Boolean(ct?.foldable)&&!So,El=ct?.label??(Jn?at.pageSections:at.templateSections),Ll=jl&&Qo(In),Dl=/* @__PURE__ */wn(zn,{children:[vr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=so===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=ko.hasOwnRows?.(e)??!1,l=Ai(e)||i,s=l&&Qo(r),{rowProps:d,...c}=ll.row({item:{id:r,zone:le,index:n,type:e.type},place:{...an(le),index:n}},{"data-node-id":r,onClick:gi(()=>ii(n))});/* @__PURE__ */
|
|
28
|
+
return wn(kn,{children:[n>0&&wi(n),
|
|
29
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:Nr(e),preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Gr(le,n,r,Nr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Xo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(le,n,Nr(e)),xi(e,le,n),bi(le,n,e,Nr(e))]}),rowProps:d}),Ai(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),ko.partRows?.(e,bl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:ko.ownRows?.(e,n,bl)})]},String(e.props.id??n))}),!So&&Gi>0&&wi(Gi),ct?.addAtEnd&&!So&&!Dn&&/* @__PURE__ */bn(I,{small:!0,label:at.addSection,blocked:null,onAdd:()=>pi(Gi)})]}),Vl=(e,n,t)=>{const o=String(e.props.id),r=$i(e).length>0||Ii(e)||Boolean(Co(e.type)),i=r&&Qo(o),l="header"===t?at.header:at.footer,s=$o.rowName?$o.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return wn(zn,{children:[
|
|
31
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:t,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Gr(le,n,o,s),selected:so===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Xo(o)}:void 0,actions:xi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:gi(()=>ii(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:Bl(e,1)})]})};return(ko.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */bn(te,{target:Ht,children:/* @__PURE__ */wn("div",{ref:Wt,className:"sf-editor es-editor",style:We(Fo),onContextMenu:qr.onEditorContextMenu,...m(Ne),children:[
|
|
33
|
+
/* @__PURE__ */wn(Pe,{children:[
|
|
34
|
+
/* @__PURE__ */bn(Te,{items:Rl,ariaLabel:"Left panel views"}),
|
|
35
|
+
/* @__PURE__ */wn(Ae,{children:[
|
|
36
|
+
/* @__PURE__ */bn(Re,{label:"Undo",disabled:Boolean(Dn)||!Qn.hasPast,onClick:()=>Qn.back(),children:/* @__PURE__ */bn(en,{})}),
|
|
37
|
+
/* @__PURE__ */bn(Re,{label:"Redo",disabled:Boolean(Dn)||!Qn.hasFuture,onClick:()=>Qn.forward(),children:/* @__PURE__ */bn(nn,{})}),
|
|
38
|
+
/* @__PURE__ */bn(Me,{}),
|
|
39
|
+
/* @__PURE__ */bn(je,{devices:bt,value:Ot,onChange:$t})]}),
|
|
40
|
+
/* @__PURE__ */wn(Ae,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */bn(Bn,{saveState:Mn,notSaving:Boolean(Dn)||null!=jn,readOnlyReason:Vn,toggle:Wn,onToggle:Ln,onRetry:En}),ko.barLead?.(),
|
|
42
|
+
/* @__PURE__ */bn(Sn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(vn,{variant:"secondary",onClick:()=>{Vt.current=(()=>{const e=Ht?.document;if(!e)return null;const n=vr.findIndex(st),t=n>=0?n:vr.length;let o=null;for(let n=0;n<t;n++){const t=vr[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=Xn?.props?.id??vr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Dt(e=>e+1)},children:"Refresh"})}),ko.barTrail?.(),ko.barMain?ko.barMain():/* @__PURE__ */bn(vn,{variant:"primary",disabled:null!==Vn,onClick:()=>{Rn(Gn.data)},children:at.done})]})]}),
|
|
43
|
+
/* @__PURE__ */bn(z,{}),
|
|
44
|
+
/* @__PURE__ */wn("div",{className:"sf-body",children:[vt?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
+
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Jt?/* @__PURE__ */bn(N,{blocks:Nl,blocksOnly:Pl,at:Qt?{label:(e=>{const n=Zi(e.zone);if(n)return at.add.addingTo({name:$o.rowName?mi(n,!0):Or(n.type)});if(e.zone===le){const n=vr[e.index];return n&&!st(n)?at.add.addingBefore({name:mi(n,!0)}):at.add.addingAtEnd}const t=tl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(Qt),onClear:()=>Xt(null)}:void 0,onAdd:e=>{const n=io,t=(e,n)=>{Qt&&Xt({zone:e,index:n})};if(n&&"block"!==e.kind&&Zi(n.zone))return hi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===lo)return void ci(e);const n=ci(e,lo);Qt&&_t(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===lo)return void ai(e,n);const t=ai(e,n,lo);Qt&&_t(t+1)})(e.template.name,zr(e.template.node));if(n&&n.zone!==le){const o=tl(n.zone);if(!o)return;return o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ol?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:il,siteWide:ko.addPanelRow?.(fi),onClose:fi,onHide:hr,readOnly:Boolean(Dn)}):Pt&&It?
|
|
46
|
+
/* @__PURE__ */bn(A,{panel:It,pick:Pt,onHide:hr}):Ml?Ml.panel({onHide:hr,notify:Zo}):"media"===vo&&It?/* @__PURE__ */bn(A,{panel:It,pick:null,onHide:hr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
+
/* @__PURE__ */bn(P,{icon:/* @__PURE__ */bn(qe,{}),title:"Layers",context:pt,actions:Yi.length>0?/* @__PURE__ */bn(Ee,{label:Qi?"Expand all sections":"Collapse all sections",onClick:()=>Ho(e=>{const n=new Set(Yi);return Qi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yi])}),children:/* @__PURE__ */bn(Cn,{expand:Qi})}):void 0,onHide:hr}),
|
|
48
|
+
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"page",size:13}),name:at.pageSettings,onSelect:kr,selected:!Xn&&to,rowProps:{onClick:gi(kr)}}),Ji&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
+
/* @__PURE__ */bn(Be,{children:at.header}),wl(Ji)]}),!So&&Un&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
+
/* @__PURE__ */bn(Be,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"header",size:13}),name:at.header,onSelect:Sr,selected:eo.kind===it?.kind,rowProps:{onClick:gi(Sr)}})]}),!So&&Fi&&Vl(Fi,Hi,"header"),!So&&!jl&&/* @__PURE__ */bn(Be,{children:El}),jl?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
+
/* @__PURE__ */bn(be,{icon:null,name:El,fold:{open:!Ll,label:El,onToggle:()=>Xo(In)}}),!Ll&&/* @__PURE__ */bn(we,{children:Dl})]}):Dl,Un&&/* @__PURE__ */bn(Be,{children:at.footer}),Wi&&Vl(Wi,Vi,"footer"),!So&&!Wi&&Un&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"footer",size:13}),name:at.footer,onSelect:yi,rowProps:{onClick:gi(yi),title:"Edit the site footer"}}),Ui&&wl(Ui),ko.treeFoot?.()]})]})}),
|
|
53
|
+
/* @__PURE__ */bn(Le,{side:"left",width:Fo.left,min:Ve,max:De,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Go})]}):/* @__PURE__ */bn(T,{side:"left",onShow:hr}),
|
|
54
|
+
/* @__PURE__ */wn("div",{ref:er,className:"sf-center sf-scroll","data-sf-canvas-head":ir?"":void 0,style:{overflowX:pr?"auto":"hidden",overflowY:"hidden"},children:[ir&&/* @__PURE__ */bn("div",{ref:lr,className:"sf-canvas-head",children:/* @__PURE__ */bn(ir,{device:Ot})}),
|
|
55
|
+
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:ur,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Ot===Bt?"":`sf-frame--${Ot}`),style:fr,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
+
/* @__PURE__ */bn(ut,{},Lt),
|
|
57
|
+
/* @__PURE__ */bn(Ue,{canvas:Ht,session:il,model:ul,measure:hl,canDrop:gl,onDrop:kl,onPick:vl,onZoneAdd:e=>{const n=sn(e),t=jr(n);t&&Dr(t.node,t.slot,!1),ui(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Dn),revision:Gn.data}),qt.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:qt.map(e=>/* @__PURE__ */wn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>pi(e.index),children:[
|
|
58
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
+
/* @__PURE__ */wn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),xt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
+
/* @__PURE__ */bn(g,{value:{selectChild:Mi,addChild:ji,childRowName:Jr,blockRowName:Xi},children:/* @__PURE__ */bn(ft,{mode:eo,onOpenWebsiteSettings:ko.openSettings??(()=>{}),onOpenSiteStyles:ko.openStyles,onSelectNode:Ro,onNotify:Zo,onHidePanel:mr,nodeActions:Xn?se(_n,Xn.type):Nn})}),
|
|
63
|
+
/* @__PURE__ */bn(Le,{side:"right",width:Fo.right,min:Ve,max:De,defaultWidth:k.right,label:"Resize settings panel",onResize:Yo})]}):
|
|
64
|
+
/* @__PURE__ */bn(T,{side:"right",onShow:mr})]}),qr.menu]})}))}export{Pn as ScreenChrome};
|
|
@@ -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-PYCLHOSA.js";import{Inspector as o}from"./chunk-WDXPWSP7.js";import{DesktopIcon as u}from"./chunk-L5KW4HG5.js";import{createContext as i,useContext as l}from"react";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function a(n,e){const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function f(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const o=e.slotsOf?.(r);return o||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 k(n,e){return n.isLast?n.isLast(e):e.type===n.last}var m={},h={},v=()=>m,g=()=>"",y=()=>null,b=()=>{},L={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},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(u,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function w(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:u,onChange:i}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(o,{fields:e,values:t,onChange:i,readOnly:u,idPrefix:n})})}var D=i({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(D.Provider,{value:n,children:e})}function N(){return l(D)}function W(){return(N().useOwnerName??g)()}function x(){return(N().useDocumentLabel??y)()}function A(n,e,t,r){return(N().useBridges??v)(n,e,t,r)}function B(n){return(N().useStandaloneBridges??v)(n)}function I(n,e){(N().useDocumentPass??b)(n,e)}function T(){return N().blockRules??L}function F(){return N().blockLook??O}function H(){return N().devices??j}function K(){return N().leftView??P}function R(){return N().pinned??S}function V(){return N().saveSwitch??!0}function Y(n){e(!0===N().pickFollowsSelection,n)}function E(){return N().add??h}function Q(){return N().storageNamespace||void 0}function X(){return N().styleClipboard??null}function Z(){return N().nodeKeys??!0}function q(){return N().notify??null}function z(){return N().Canvas??w}function J(){return N().CanvasHead??null}function M(){return N().canvasDrag??null}var U=i(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(U.Provider,{value:n,children:e})}function _(){return l(U)}function nn(){return N().Inspector??C}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,k as isPinnedLast,f as isSlotMode,a as sameInspectorMode,d as screenSlotsOf,E as useScreenAdd,F as useScreenBlockLook,T as useScreenBlockRules,A as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,_ as useScreenCanvasTarget,H as useScreenDevices,x as useScreenDocumentLabel,I as useScreenDocumentPass,nn as useScreenInspectorPanel,K as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,W as useScreenOwnerName,N as useScreenParts,Y as useScreenPickFollowsSelection,R as useScreenPinned,V as useScreenSaveSwitch,Q as useScreenStorageNamespace,X as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as s}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as s}from"./chunk-QFMJBBKM.js";import{DropdownMenu as r}from"efficient-shell/ui";import{jsxs as t,Fragment as l,jsx as i}from"react/jsx-runtime";function c({choices:c,onPick:n}){const{Icon:a}=s(),o=e(c).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */t(l,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */i("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */i("span",{className:"sf-chip",children:/* @__PURE__ */i(a,{type:e.type,size:13})}),onSelect:()=>n(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return i(r,{align:"start",triggerClassName:"sf-add-card",items:o,trigger:/* @__PURE__ */t(l,{children:[
|
|
4
4
|
/* @__PURE__ */i("span",{className:"sf-plus sf-plus--sm",children:"+"}),"Add block"]})})}export{c as AddBlockRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-QFMJBBKM.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PYCLHOSA.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,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as e}from"./chunk-
|
|
1
|
+
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as e}from"./chunk-FER7FCAG.js";import{ScreenChrome as r}from"./chunk-O5F46JWM.js";import{ScreenDocumentProvider as a,useScreenDocument as i}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-E2O2MRZR.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{useMemo as c}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var v=n(e),f=n(r);function p({saving:n,onCancel:e,onDiscard:r,onSave:a}){/* @__PURE__ */
|
|
2
2
|
return m(d,{open:!0,role:"alertdialog",size:"sm",title:"Unsaved changes",onClose:e,footer:/* @__PURE__ */g(h,{children:[
|
|
3
3
|
/* @__PURE__ */m(l,{variant:"secondary",onClick:e,children:"Cancel"}),
|
|
4
4
|
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:r,children:"Discard & leave"}),
|
|
5
5
|
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:a,children:n?"Saving…":"Save & leave"})]}),children:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them."})}function u({target:n,addressing:e,onHostMessage:r,children:i}){/* @__PURE__ */
|
|
6
|
-
return m(a,{target:n,addressing:e,onHostMessage:r,children:i})}var
|
|
7
|
-
/* @__PURE__ */m(v,{config:n,data:a,onChange:k,permissions:
|
|
6
|
+
return m(a,{target:n,addressing:e,onHostMessage:r,children:i})}var C=(n,e)=>/* @__PURE__ */g(h,{children:[n,e]});function k({config:n,parts:e,wrap:r=C}){const{data:a,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:N,cancelPendingNav:j,discardAndNavigate:O,saveAndNavigate:R}=i(),S=c(()=>o(!u),[u]),y=t("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:y.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?a?r(
|
|
7
|
+
/* @__PURE__ */m(v,{config:n,data:a,onChange:k,permissions:S,parts:e,children:/* @__PURE__ */m(f,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:O,onSave:()=>{R()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:y.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:y.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
|
|
@@ -18,7 +18,7 @@ return P(l,{label:K(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(u,{ar
|
|
|
18
18
|
return P(Q,{...n,field:t});case"array":/* @__PURE__ */
|
|
19
19
|
return P(W,{...n,field:t});case"slot":return null}}var V=e=>t.includes(e);function q(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(V(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function J(e){return new Map(q(e).rows.map(e=>[e.name,e.bucket]))}function X({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),g=L(),v=p??`es-insp${g.replace(/:/g,"")}`,y=q(e),[x,k]=$(void 0),w=i??x,N=w&&y.buckets.includes(w)?w:y.buckets[0],[O,S]=$(null),D=O&&O.panel===v&&y.rows.some(e=>e.name===O.name)?O:null,I=c&&y.buckets.length>1,F=I&&N?C(v,N):`${v}-rows`;/* @__PURE__ */
|
|
20
20
|
return A("div",{className:"es-insp",children:[I?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(a,{ariaLabel:h??f.settings,activeId:N,onSelect:e=>{const n=e;void 0===i&&k(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e]})),idPrefix:v})}):null,
|
|
21
|
-
/* @__PURE__ */A("div",{className:"es-insp-rows",id:F,role:I?"tabpanel":void 0,"aria-labelledby":I&&N?j(v,N):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!I||i===N)||void 0,children:/* @__PURE__ */P(Y,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:D&&D.name===e?D.index:null,onOpenItem:n=>S(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function Z(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function U({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=$(null),[u,p]=$(null),h=s
|
|
21
|
+
/* @__PURE__ */A("div",{className:"es-insp-rows",id:F,role:I?"tabpanel":void 0,"aria-labelledby":I&&N?j(v,N):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!I||i===N)||void 0,children:/* @__PURE__ */P(Y,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:D&&D.name===e?D.index:null,onOpenItem:n=>S(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function Z(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function U({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=$(null),[u,p]=$(null),h=s&&s.against===e?s.kind:t.kindOf(e),b=l.filter(e=>!e.hideWhenEmpty||Z(e.target).length>0||e.value===h),f=b.find(e=>"text"===e.target.type),g=b.find(e=>e.value===h)??f??b[0];if(!g)return null;const v="text"!==g.target.type,y=v?t.targetOf(e):e,x=Z(g.target),k=x.find(e=>e.value===y),w=e=>({value:e,label:o.unavailable({value:e})}),O="select"===g.target.type&&y&&a?a(y):null,C=O?t.readFilter(e):null,j=C?O?.find(e=>e.param===C.param):void 0,I=u&&u.against===e?u.text:e,F=!v&&""!==I.trim()&&!t.isSafe(I),L=(e,l)=>{c(n=>n?{...n,against:e}:n),void 0===l?n(e):n(e,l)},T=e=>{if(!e)return L("");const n=x.find(n=>n.value===e);L(e,n?.label)},E=(e,n)=>n&&!e.some(e=>e.value===n)?[w(n),...e]:[...e],M=(e,n,l,t,a)=>{if(a){const a=l.map(e=>({value:e.value,label:e.label,...e.group?{sublabel:e.group}:{}}));/* @__PURE__ */
|
|
22
22
|
return P(S,{"aria-label":e,value:n,options:a,disabled:i,placeholder:l.find(e=>""===e.value)?.label,onChange:e=>""!==e||l.some(e=>""===e.value)?t(e):void 0})}const r=[];for(const e of l){const n=r[r.length-1],l={value:e.value,label:e.label};e.group?n&&"options"in n&&n.label===e.group?n.options.push(l):r.push({label:e.group,options:[l]}):r.push(l)}/* @__PURE__ */
|
|
23
|
-
return P(D,{size:"sm","aria-label":e,value:n,options:r,disabled:i,onChange:t})};let
|
|
24
|
-
return A("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[
|
|
23
|
+
return P(D,{size:"sm","aria-label":e,value:n,options:r,disabled:i,onChange:t})};let z;if("text"===g.target.type)z=/* @__PURE__ */P(N,{size:"sm",type:"text",className:"es-fin",invalid:F,"aria-label":o.address,placeholder:o.addressPlaceholder,value:I,readOnly:i,onChange:n=>(n=>{const l=n.trim();l?t.isSafe(n)?(p({text:n,against:l}),L(l)):p({text:n,against:e}):(p({text:n,against:""}),L(""))})(n.target.value)});else{const e="groups"===g.target.type?g.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):g.target.options.map(e=>({value:e.value,label:e.label})),n=[{value:"",label:g.target.placeholder},...E(e,y)];z=M(g.label,y,n,T,e.length>10)}/* @__PURE__ */
|
|
24
|
+
return A("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[M(o.linkType,g.value,b.map(e=>({value:e.value,label:e.label})),l=>{p(null);const t=b.find(e=>e.value===l);if(!t||"text"===t.target.type)return void c({kind:l,against:e});const a=Z(t.target)[0];c({kind:l,against:a?a.value:""}),a?n(a.value,a.label):n("")},!1),z,O&&M(o.filter,C?.param??"",[{value:"",label:o.noFilter},...C&&!j?[w(C.param)]:[],...O.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return L(y,k?.label);const n=O?.find(n=>n.param===e),l=n?.values[0];l&&L(t.withFilter(y,{param:e,value:l.value}),l.label)},!1),O&&C&&M(o.value,C.value,E((j?.values??[]).map(e=>({value:e.value,label:e.label})),C.value),e=>{if(!C)return;const n=j?.values.find(n=>n.value===e);L(t.withFilter(y,{param:C.param,value:e}),n?.label)},(j?.values.length??0)>10),F&&/* @__PURE__ */P("p",{className:"es-flink-error",role:"alert",children:o.unsafe}),g.hint&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:g.hint}),O&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:o.filterHint})]})}export{T as FieldText,X as Inspector,Y as InspectorField,U as LinkPicker,G as ListField,J as bucketsOf,R as copyItem,E as insertAt,K as labelOf,M as moveTo,q as planFields,z as removeAt};
|
package/dist/fields/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-
|
|
1
|
+
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-WDXPWSP7.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-NLRW4BGG.js";import"../chunk-XWR5YVA7.js";import"../chunk-Q27BB5ZC.js";import"../chunk-K56YDHYQ.js";import"../chunk-QTLAVDJE.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-7SQF6LZL.js";import"../chunk-QLD57GBB.js";import"../chunk-FPOKPNO4.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-L5KW4HG5.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-QRKKQGUO.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-4SWZAYKI.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-QR4DLZ3P.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-E2O2MRZR.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-TJ7YIRWQ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-W3XX2CNW.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-I64QM6DU.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-TJ7YIRWQ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-O5F46JWM.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-SQTY6CJD.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PWZOS45R.js";import"../../chunk-7F52SZOI.js";import"../../chunk-R2HLPNQF.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-PT6V53OO.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-ORR3Q4WV.js";import"../../chunk-GXFAQ7JN.js";import"../../chunk-QTPJMJOJ.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-JLTZQ4US.js";import"../../chunk-MAEXP3KE.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-ONRYLR2D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-57DJOKXT.js";import"../../chunk-5545A3PC.js";import"../../chunk-4SWZAYKI.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-QR4DLZ3P.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-I64QM6DU.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-E2O2MRZR.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-2LK54I4E.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-X6DQWK2C.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-TJ7YIRWQ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-W3XX2CNW.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-RG7PFKCA.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-FER7FCAG.js";import"../../chunk-O5F46JWM.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-SQTY6CJD.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-PWZOS45R.js";import"../../chunk-7F52SZOI.js";import"../../chunk-R2HLPNQF.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-PT6V53OO.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-ORR3Q4WV.js";import"../../chunk-GXFAQ7JN.js";import"../../chunk-QTPJMJOJ.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-JLTZQ4US.js";import"../../chunk-MAEXP3KE.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-ONRYLR2D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-57DJOKXT.js";import"../../chunk-5545A3PC.js";import"../../chunk-4SWZAYKI.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-QR4DLZ3P.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-I64QM6DU.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-E2O2MRZR.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-2LK54I4E.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-X6DQWK2C.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-TJ7YIRWQ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-W3XX2CNW.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-FER7FCAG.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-QRKKQGUO.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-PT6V53OO.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-ORR3Q4WV.js";import{usePartBridge as c}from"../../chunk-GXFAQ7JN.js";import{useSectionOps as p}from"../../chunk-QTPJMJOJ.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-ONRYLR2D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-I64QM6DU.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as j,useStandaloneScreenBridges as f,useScreenBlockLook as N,useScreenBlockRules as y}from"../../chunk-QFMJBBKM.js";import{nestsInTree as S,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as O,usePanelPick as R,useCancelPanelPick as x}from"../../chunk-R6WTQWAC.js";import{useHostEscape as A}from"../../chunk-U3JP4VGF.js";import"../../chunk-E2O2MRZR.js";import{useEasel as P}from"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import{LayersTree as B,Subtree as L,TreeRow as v,TreeRowAction as M,TreeSeam as Q}from"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-BDTITTMW.js";import{saveIndicator as W}from"../../chunk-H6DDIBQ4.js";import{SaveState as E,panelWidthVars as T}from"../../chunk-TJ7YIRWQ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-W3XX2CNW.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as g}from"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import{TrashIcon as z}from"../../chunk-L5KW4HG5.js";import{zoneKey as D,parseZoneKey as b}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as J,useRef as F,useEffect as H,useCallback as Y,Fragment as w}from"react";import{Tooltip as G}from"efficient-shell/ui";import{jsxs as K,jsx as X,Fragment as V}from"react/jsx-runtime";var $=e=>n=>{n.target.closest("button, input")||e()},Z={rowClick:$};function I(){const{saveState:I,readOnly:U,readOnlyReason:q=null}=l(),_=p(),{appState:ee,selectedItem:ne,config:oe}=P(e=>e),[re,te]=J(d),{first:se,last:ie,panelOf:ce}=a(),pe=ce(se),le=u(),me=h(),de=ee.data.content?.[0]??null,ae=de?.props.id??null,ue=de?.type===se,he=de?.type===ie,ke=F(null),je=F(null);t(je);const fe=O(),Ne=R(),ye=x();k(ne?.props.id),H(()=>{const e=je.current;if(!Ne||!e)return;const n=e=>{"Escape"===e.key&&ye()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Ne]),A(null!==Ne,()=>ye()),H(()=>{ae&&ke.current!==ae&&(ke.current=ae,ue?te(pe??d):ne||_.select({index:0}))},[ae,ne,_,ue]);const Se=Y(e=>te(n=>j(n,e)?n:e),[]),Ce=f({kind:re.kind,mode:re,open:Se,show:e=>te(e),reveal:()=>{},select:(e,n)=>{te(e=>j(e,n)?e:n),_.select(e)}}),{selectNode:Oe}=c({mode:re,setMode:te,onOpenPart:o}),Re=N(),{labelAtLevel:xe,Icon:Ae}=Re,{canAddTo:Pe}=y(),Be=e=>oe.components[e]?.label??e,Le=e=>xe(e,"section",Be(e)),ve=!ue&&"puck"===re.kind&&ne?.props.id===ae,Me=de?Pe(de.type)?.spec??null:null,Qe=de&&Me?`${de.props.id}:${Me.slot}`:null,We=de&&Me&&Array.isArray(de.props[Me.slot])?de.props[Me.slot]:[],Ee=e=>n(e,Be,Re.plainText),Te=(e,n)=>{de&&Me&&Qe&&(te(d),Me.slider?(r(String(de.props.id),e),_.select({index:e,zone:Qe}),o(String(de.props.id))):(_.select({index:e,zone:Qe}),o(n)))},ge=()=>{if(!de||!Me||!Qe)return;const e=We.length;_.insertComponent(Qe,Me.childType,e),te(d),Me.slider?requestAnimationFrame(()=>{r(String(de.props.id),e),_.select({index:e,zone:Qe})}):_.select({index:e,zone:Qe})},ze=e=>C(oe,e),De=e=>{const{parentId:n,slot:o}=b(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of ze(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(de)?.props[o];return Array.isArray(t)?t.length:0},be=(e,n,o)=>{const r=Math.min(Math.max(o,0),De(e)),t=n<r?r-1:r;t!==n&&(_.reorderComponent(e,n,t),te(d),_.select({index:t,zone:e}))},Je=g({keyOf:e=>e.id,readOnly:Boolean(U),canDrop:(e,n)=>D(n)===e.zone&&n.index>=0&&n.index<=De(e.zone),onDrop:(e,n)=>be(e.zone,e.index,n.index),onStep:(e,n)=>be(e.zone,e.index,n<0?e.index-1:e.index+2)}),Fe=(e,n)=>/* @__PURE__ */X(Q,{...U?{}:Je.seam({place:{...b(e),index:n}})},`seam:${e}:${n}`),He=e=>Re.blockRowName(e,Be),Ye=(e,n,r)=>{te(d),_.select({index:n,zone:e}),o(r)},we=(e,n,o)=>{_.insertComponent(e,n,o),te(d),_.select({index:o,zone:e})},Ge=(n,o,r)=>/* @__PURE__ */X(e,{choices:r,onPick:e=>we(n,e,o)}),Ke=(e,n)=>{const o=ze((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=Pe(e.type),s=t?.choices??null,i="footer"===t?.source?He:Ee;/* @__PURE__ */
|
|
2
|
+
return K(V,{children:[o.map(({child:e,zone:o,index:r})=>{const t=ne?.props.id===e.props.id,s=S(oe,e.type,n),c=i(e),p=String(e.props.id),l=()=>Ye(o,r,p),{rowProps:m,...a}=Je.row({item:{id:p,zone:o,index:r},place:{...b(o),index:r}},{onClick:$(l)});/* @__PURE__ */
|
|
3
|
+
return K(w,{children:[0===r&&Fe(o,0),
|
|
4
|
+
/* @__PURE__ */X(v,{icon:/* @__PURE__ */X(Ae,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */X(M,{kind:"delete",label:`Delete ${c}`,onClick:()=>{return e=o,n=r,_.removeComponent(e,n),te(d),void _.select(null);var e,n},children:/* @__PURE__ */X(z,{size:13})}),rowProps:m}),s&&/* @__PURE__ */X(L,{children:Ke(e,n+1)}),Fe(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ge(`${e.props.id}:${t.slot}`,o.length,s):null]})},Xe="HeroSingle"===de?.type,Ve=Boolean(de)&&(Boolean(Me)||he||ue||Xe);/* @__PURE__ */
|
|
5
|
+
return K("div",{ref:je,className:"sf-editor es-editor",style:T(i),children:[
|
|
6
|
+
/* @__PURE__ */X("div",{className:"sf-section-bar",children:/* @__PURE__ */X(E,null!==q?{tone:"off",label:q,role:"status"}:{...W(I),role:"status"})}),
|
|
7
|
+
/* @__PURE__ */K("div",{className:"sf-body",children:[Ne&&fe?/* @__PURE__ */X("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */X(m,{panel:fe,pick:Ne})}):Ve&&de&&/* @__PURE__ */K("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
+
/* @__PURE__ */X("div",{className:"sf-panel-head",children:/* @__PURE__ */X(G,{content:ue?"Header settings":`${Le(de.type)} settings`,side:"bottom",children:/* @__PURE__ */X("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(ve?"is-selected":""),"aria-pressed":ve,onClick:()=>{ue?te(pe??d):(te(d),_.select({index:0}))},children:Le(de.type)})})}),
|
|
9
|
+
/* @__PURE__ */X(B,{className:"sf-tree sf-scroll",rootProps:Je.rootProps(),children:/* @__PURE__ */X(L,{children:ue?
|
|
10
|
+
/* @__PURE__ */X(v,{icon:/* @__PURE__ */X(Ae,{type:"header",size:13}),name:"Header settings",selected:re.kind===pe?.kind,onSelect:()=>te(pe??d),rowProps:{onClick:$(()=>te(pe??d))}}):Me?/* @__PURE__ */K(V,{children:[We.map((e,n)=>{const o=ne?.props.id===e.props.id,r=Ee(e),t=String(e.props.id),s=()=>Te(n,t),{rowProps:i,...c}=Je.row({item:{id:t,zone:Qe,index:n},place:{...b(Qe),index:n}},{onClick:$(s)});/* @__PURE__ */
|
|
11
|
+
return K(w,{children:[0===n&&Fe(Qe,0),
|
|
12
|
+
/* @__PURE__ */X(v,{icon:/* @__PURE__ */X(Ae,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */X(M,{kind:"delete",label:`Delete ${r}`,onClick:()=>{return e=n,void(Qe&&(_.removeComponent(Qe,e),te(d),_.select(null)));var e},children:/* @__PURE__ */X(z,{size:13})}),rowProps:i}),Fe(Qe,n+1)]},String(e.props.id??n))}),
|
|
13
|
+
/* @__PURE__ */K("button",{type:"button",className:"sf-add-card",onClick:ge,children:[
|
|
14
|
+
/* @__PURE__ */X("span",{className:"sf-plus sf-plus--sm",children:"+"}),Me.addLabel]}),ae?Ce.partRows?.(de,Z):null]}):Ke(de,1)})})]}),
|
|
15
|
+
/* @__PURE__ */X("div",{className:"sf-center",children:/* @__PURE__ */X("div",{className:"sf-preview-host",children:/* @__PURE__ */X(le,{})})}),
|
|
16
|
+
/* @__PURE__ */X(s,{value:{selectChild:(e,n,o,r)=>"section"===Pe(r)?.source?Te(n,o):Ye(e,n,o),addChild:(e,n,o,r,t)=>"section"===Pe(t)?.source?ge():we(`${e}:${n}`,o,r),childRowName:Ee,blockRowName:He},children:/* @__PURE__ */X(me,{mode:re,onOpenWebsiteSettings:Ce.openSettings??(()=>{}),onSelectNode:Oe,hideNodeActions:!0})})]})]})}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-GXFAQ7JN.js";import"../../chunk-QTPJMJOJ.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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-RG7PFKCA.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-FER7FCAG.js";import"../chunk-O5F46JWM.js";import"../chunk-26OOWIJJ.js";import"../chunk-SQTY6CJD.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PWZOS45R.js";import"../chunk-7F52SZOI.js";import"../chunk-R2HLPNQF.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-PT6V53OO.js";import"../chunk-KCBEE2MC.js";import"../chunk-ORR3Q4WV.js";import"../chunk-GXFAQ7JN.js";import"../chunk-QTPJMJOJ.js";import"../chunk-IYT6NN2J.js";import"../chunk-JLTZQ4US.js";import"../chunk-MAEXP3KE.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-ONRYLR2D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-57DJOKXT.js";import"../chunk-5545A3PC.js";import"../chunk-4SWZAYKI.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-QR4DLZ3P.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-I64QM6DU.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-QFMJBBKM.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-E2O2MRZR.js";import"../chunk-PYCLHOSA.js";import"../chunk-AELNNAFM.js";import"../chunk-WDXPWSP7.js";import"../chunk-NLRW4BGG.js";import"../chunk-XWR5YVA7.js";import"../chunk-Q27BB5ZC.js";import"../chunk-K56YDHYQ.js";import"../chunk-QTLAVDJE.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-2LK54I4E.js";import"../chunk-WK3AFPXY.js";import"../chunk-D2BCHTQR.js";import"../chunk-X6DQWK2C.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-TJ7YIRWQ.js";import"../chunk-ZJEBF4NB.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-7SQF6LZL.js";import"../chunk-QLD57GBB.js";import"../chunk-FPOKPNO4.js";import"../chunk-MFIRYGHW.js";import"../chunk-W3XX2CNW.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-P2VEMZH5.js";import"../chunk-L5KW4HG5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -88,6 +88,22 @@ type SectionOpsOptions = {
|
|
|
88
88
|
* false — no op resolves anything, as before 0.103.0.
|
|
89
89
|
*/
|
|
90
90
|
resolveOnInsert?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* NOT AN UNDO STEP: every write is folded into the history entry it happens
|
|
93
|
+
* in (the store's `recordHistory: false`), as the store folds a resolver's
|
|
94
|
+
* write (`resolveAll`), instead of being recorded as a step of its own.
|
|
95
|
+
*
|
|
96
|
+
* For the passes the screen runs over a document AS IT OPENS — the slot
|
|
97
|
+
* seeding, the duplicate-id heal, and the layer's own pass (the website's
|
|
98
|
+
* pinned Header and Footer). Recorded, each was the first entry of the
|
|
99
|
+
* history: Undo was offered the moment the page opened, and ONE press took
|
|
100
|
+
* the seeded slides and cards (or the Header) back out of the page, which
|
|
101
|
+
* autosave then wrote (1.0.1). Folded, the document opens as the history's
|
|
102
|
+
* first entry; a pass that runs after an edit (a section just inserted,
|
|
103
|
+
* seeded) lands in that edit's step, so one Undo takes both out together.
|
|
104
|
+
* Autosave still hears every write (the store's `onChange` fires on a fold).
|
|
105
|
+
*/
|
|
106
|
+
foldIntoHistory?: boolean;
|
|
91
107
|
};
|
|
92
108
|
declare function useSectionOps(options?: SectionOpsOptions): SectionOps;
|
|
93
109
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-QTPJMJOJ.js";import"../../../chunk-QFMJBBKM.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-PYCLHOSA.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-WDXPWSP7.js";import"../../../chunk-NLRW4BGG.js";import"../../../chunk-XWR5YVA7.js";import"../../../chunk-Q27BB5ZC.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-QTLAVDJE.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-D2BCHTQR.js";import"../../../chunk-7SQF6LZL.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FPOKPNO4.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ZNCEOSXO.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-L5KW4HG5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
|
@@ -307,6 +307,11 @@ type ScreenRailItem = ScreenLeftView | EaselRailItem;
|
|
|
307
307
|
* (lib/puck/use-section-ops), refused the same way while somebody else holds
|
|
308
308
|
* the document, and ONE object from render to render until that changes — so a
|
|
309
309
|
* pass may list it as a dependency and run no oftener for it.
|
|
310
|
+
*
|
|
311
|
+
* Every write is FOLDED into the history entry it happens in (1.0.1,
|
|
312
|
+
* `foldIntoHistory`): what a pass gives a document as it opens is part of the
|
|
313
|
+
* document the history starts at, never an undo step that one Undo takes back
|
|
314
|
+
* out. Autosave still hears each write.
|
|
310
315
|
*/
|
|
311
316
|
interface ScreenDocumentOps {
|
|
312
317
|
/** Replace the whole working document, unrecorded. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,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,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-QFMJBBKM.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PYCLHOSA.js";import"../../chunk-AELNNAFM.js";import"../../chunk-WDXPWSP7.js";import"../../chunk-NLRW4BGG.js";import"../../chunk-XWR5YVA7.js";import"../../chunk-Q27BB5ZC.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-7SQF6LZL.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-L5KW4HG5.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": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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-4GNPKHV4.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-PT6V53OO.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-ORR3Q4WV.js";import{usePartBridge as v}from"./chunk-DJMMTWFP.js";import{useSectionOps as x}from"./chunk-QMNML7XH.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-JLTZQ4US.js";import{PageEditGuardNotices as z}from"./chunk-MAEXP3KE.js";import{useScreenDocument as C}from"./chunk-ONRYLR2D.js";import{requestMediaPick as B}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as I}from"./chunk-OTEXGJDU.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-QR4DLZ3P.js";import{MediaSidePanel as A}from"./chunk-CKEPQNSQ.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as H,useScreenLeftView as W,useScreenAdd as F,SELECTION_MODE as J,sameInspectorMode as U,useScreenBridges as G,useScreenBlockRules as X,useScreenBlockLook as Y,useScreenStorageNamespace as Q,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-OJAJVH7S.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-E2O2MRZR.js";import{useEasel as ve,useEaselApi as xe}from"./chunk-PYCLHOSA.js";import{TreeRow as be,Subtree as we,LayersTree as ze,TreeGroupLabel as Ce,TreeRowAction as Be,TreeSeam as Oe}from"./chunk-XWR5YVA7.js";import{toItemSelector as $e,useNodeOps as Ne}from"./chunk-D2BCHTQR.js";import{saveIndicator as Ie}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Pe,TopBarRail as Te,TopBarCluster as Ae,EaselIconButton as Re,TopBarDivider as Me,DeviceSwitch as je,InspectorIconButton as Ee,PanelResizeHandle as Le,MAX_PANEL_W as De,MIN_PANEL_W as Ve,panelWidthVars as He,SaveState as We,SaveStateToggle as Fe}from"./chunk-TJ7YIRWQ.js";import{useWords as Je}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ue}from"./chunk-W3XX2CNW.js";import{createDragSession as Ge,useTreeDrag as Xe,gapToMoveIndex as Ye}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Qe,BLOCK_SELECTOR as Ke,useCanvasEvent as _e}from"./chunk-PAELDYYS.js";import{LayersIcon as qe,MediaIcon as Ze,UndoIcon as en,RedoIcon as nn,TrashIcon as tn,EyeOffIcon as on,EyeIcon as rn,DuplicateIcon as ln}from"./chunk-L5KW4HG5.js";import{zoneKey as sn,ROOT_ID as dn,ROOT_SLOT as cn,parseZoneKey as an,DataError as pn}from"./chunk-KRXQM65X.js";import{useRef as un,useMemo as fn,useState as hn,useEffect as mn,useCallback as gn,useLayoutEffect as yn,Fragment as kn}from"react";import{Tooltip as Sn,Button as vn,toast as xn}from"efficient-shell/ui";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Cn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(We,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return bn(We,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Ie(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(vn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
-
return wn(zn,o?{children:[
|
|
4
|
-
/* @__PURE__ */bn(Fe,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */bn(We,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
-
/* @__PURE__ */bn(We,{tone:l,label:s,role:"status"}),d]})}function Bn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return bn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */wn(zn,e?{children:[
|
|
7
|
-
/* @__PURE__ */bn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */bn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */bn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */bn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */bn("path",{d:"M5 12h14"})]})})}function On(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var $n="__rungs";var Nn="screen:band",In={duplicate:!0,delete:!0};function Pn(){const Ie=ye(),{target:We,docId:Fe,capabilities:Pn,currentSlug:Tn,siteId:An,onPublish:Rn,saveState:Mn,saveConflict:jn,retrySave:En,toggleAutoSave:Ln,readOnly:Dn,readOnlyReason:Vn=null}=C(),Hn=R(),Wn=M(),{mediaEditing:Fn,hasEditGuard:Jn,hasPinnedChrome:Un}=Pn,{appState:Gn,dispatch:Xn,history:Yn,selectedItem:Qn,getSelectorForId:Kn,config:_n}=ve(e=>e),qn=j(),{first:Zn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=qn,it=rt(Zn),lt=e=>oe(qn,e),st=e=>re(qn,e),dt="node"===qn.firstRow,ct=qn.band??null,at=Je("screen",Se),pt=E()??`/${Tn}`,ut=L(),ft=D(),ht=x({readOnly:Dn}),mt=un(null),gt=xe(),yt=fn(()=>({...ht,select:e=>{mt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=gt.config;mt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,gt]),kt=Gn.ui,St=kt.leftSideBarVisible,vt=kt.rightSideBarVisible,{options:xt,widths:bt,initial:wt,fluid:zt,fit:Ct}=V(),[Bt,Ot]=hn(wt),$t=he(),Nt=Fn&&null!==$t,It=me(),Pt=ge();H(Qn?.props.id);const{read:Tt,write:At,forSelection:Rt}=W(),[Mt,jt]=hn(Tt);mn(()=>{At(Mt)},[Mt]);const[Et,Lt]=hn(0),Dt=un(null),Vt=un(null),Ht=Qe(Vt,{readySelector:Ke}),Wt=f(Vt);h(Vt,Ht);const[Ft,Jt]=hn(!1),Ut=un(!1),Gt=un(!1),[Xt,Yt]=hn(null),Qt=F(),Kt=e=>Yt(null===e?null:{zone:le,index:e}),[_t,qt]=hn([]),[Zt,eo]=hn(J),no="puck"===Zt.kind,to=Ft&&!Xt&&Qt.railTarget?Qt.railTarget(Gn.data,{node:Qn??null,mode:Zt}):null,oo=to?{zone:sn(to),index:to.index}:null,ro=Xt??oo,io=ro&&ro.zone===le?ro.index:null,lo=t(Zt,Qn?.props.id),[so,co]=hn(null);mn(()=>{so&&(o(),co(null))},[so]);const ao=un(Kn);ao.current=Kn;const po=gn((e,{scroll:n})=>{jt(n=>Rt(e,n)),n&&co(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ao.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ho(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),uo=un(null);mn(()=>{const e=uo.current;uo.current=null;const n=null==Qn?.props.id?null:String(Qn.props.id);eo(e&&e.id===n?e.mode:rt(Qn?.type)??J);const t=Qn?.props.id,o=mt.current;if(mt.current=null,!t)return;const i=Kn(t);po(String(t),{scroll:!r(o,i??null,le)})},[Qn?.props.id,po]);const fo=gn(e=>{eo(n=>U(n,e)?n:e),Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Xn]),ho=un(()=>{});ho.current=(e,n)=>{const t=e?Tr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Qn?.props.id?null:String(Qn.props.id);eo(e=>U(e,n)?e:n),o!==r&&(uo.current={id:o,mode:n},yt.select(e))};const mo=gn((e,n)=>ho.current(e,n),[]),go={kind:Zt.kind,mode:Zt,open:fo,show:e=>eo(e),reveal:()=>{vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:mo},yo=G(go,{data:Gn.data,selected:Qn??null,zoneOf:e=>Kn(e)?.zone,readOnly:Boolean(Dn),select:e=>{eo(J),yt.select({index:e})},replace:(e,n)=>yt.replaceComponent(le,e,n),scrollTo:e=>oi(e)},{device:Bt,refreshes:Et},{setView:jt,reveal:()=>{St||Xn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ko=yo.pinnedSource??!1,So=yo.resolveLeftView?yo.resolveLeftView(Mt,Nt):"media"===Mt&&Nt?Mt:"sections",vo=X(),{isLockedBlock:xo,duplicateBlocked:bo,nestDepth:wo,newSectionNode:zo,canAddTo:Co,blockIsOffered:Bo}=vo,Oo=Y(),{labelAtLevel:$o,Icon:No,useProducts:Io}=Oo,Po=Oo.rowName?(e,n,t)=>Oo.rowName(e,n,t):void 0,To=gn(e=>{Xn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),po(e,{scroll:!0})},[Xn,po]),{selectNode:Ao,openPartId:Ro}=v({mode:Zt,setMode:eo,onOpenPart:To}),[Mo,jo]=hn(null);ke(null!==Mo,()=>jo(null));const Eo=y(Q()),Lo=Eo.collapsed,Do=Eo.panelWidths,[Vo,Ho]=hn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Lo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});mn(()=>{try{window.localStorage.setItem(Lo,JSON.stringify([...Vo]))}catch{}},[Vo]);const[Wo,Fo]=hn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Do);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});mn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Do,JSON.stringify(Wo))}catch{}},300);return()=>clearTimeout(e)},[Wo]);const Jo=gn((e,n)=>Fo(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Uo=gn(e=>Jo("left",e),[Jo]),Go=gn(e=>Jo("right",e),[Jo]),Xo=e=>Vo.has(e),Yo=e=>Ho(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Qo=un(!1),Ko=un(null);mn(()=>{if(Qo.current&&!Ft){const e=Ko.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vt.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),Ko.current=null}Qo.current=Ft},[Ft]),mn(()=>{if(!Ft||!Wt)return;const e=e=>{"Escape"===e.key&&ui()};return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[Ft,Wt]),ke(Ft,()=>ui()),mn(()=>{!St&&Ft&&(Jt(!1),Yt(null),Ut.current=!1)},[St]),mn(()=>{if(!It)return Gt.current&&Xn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Gt.current=!1);Ft&&(Jt(!1),Yt(null),Gt.current=Ut.current,Ut.current=!1),St||(Gt.current=!0,Xn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[It]),mn(()=>{!St&&It&&(Gt.current=!1,Pt())},[St]),mn(()=>{if(!It||!Wt)return;const e=e=>{"Escape"===e.key&&Pt()};return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[It,Wt]),ke(null!==It,()=>Pt());const _o=K(),qo=(e,n="success")=>{_o?_o(e,"error"===n?"error":"info"):"error"===n?xn.error(e,{duration:3200,sound:!1}):xn.success(e,{duration:1900,sound:!1})},Zo=un(null),[er,nr]=hn(0),[tr,or]=hn(0),rr=_(),ir=un(null),lr=e=>Math.max(0,e.clientHeight-(ir.current?.offsetHeight??0));mn(()=>{const e=Zo.current;if(!e)return;const n=()=>{nr(e.clientWidth),or(lr(e))};n();const t=new ResizeObserver(n);return t.observe(e),ir.current&&t.observe(ir.current),()=>t.disconnect()},[]),yn(()=>{Zo.current&&(nr(Zo.current.clientWidth),or(lr(Zo.current)))},[Wo,St,vt]);const sr=Bt===zt?er>0?er:bt[zt]:bt[Bt],dr=er>0?Math.min(er/sr,"shrink"===Ct?1:2):1,cr=sr*dr,ar=er>0&&cr>er+1,pr={width:cr,height:tr||"100%",flex:"none",position:"relative"},ur={width:sr,height:tr?tr/dr:"100%",maxHeight:"none",transform:1!==dr?`scale(${dr})`:void 0,transformOrigin:"top left"},fr=()=>Xn({type:"setUi",ui:{leftSideBarVisible:!St}}),hr=()=>Xn({type:"setUi",ui:{rightSideBarVisible:!vt}}),mr=e=>{Ft&&(Jt(!1),Yt(null),Ut.current=!1,St&&Mt===e)||It&&(Gt.current=!1,Pt(),St&&Mt===e)||(St&&Mt===e?fr():(jt(e),St||Xn({type:"setUi",ui:{leftSideBarVisible:!0}})))},gr=()=>{B(Ie,{accept:"image/*",title:"Media library"})},yr=()=>{eo(J),yt.select(null),u()},kr=()=>{eo(it??J),vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},Sr=Gn.data.content??[],vr=()=>{const e=Sr.findIndex(lt),n=Sr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:Sr.length}},xr=_n,br=vo.stripCopy,wr=e=>i(e,br),zr=b(),Cr=Ne({data:Gn.data,config:xr,readOnly:Boolean(Dn),clipboard:zr,strip:br?e=>br(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==dn||e.slot!==cn)return{min:0,max:n-1};const{floor:t,cap:o}=vr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&eo(J);const t=void 0===n||"node"===n?.kind?n:null;yt.commitDocument(e,t)}}),Br=e=>_n.components[e]?.label??e,Or=gn(e=>_n.components[e]?.defaultProps??{},[_n]),$r=e=>$o(e,"section",Br(e)),Nr=e=>l({type:e.type,props:e.props??{}},$r(e.type),Po),{nodeAddresses:Ir,zoneItems:Pr}=fn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(_n,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Sr,le,0),{nodeAddresses:e,zoneItems:n}},[Sr,_n]),Tr=gn(e=>Pr.get(e)??[],[Pr]),Ar=e=>{const n=Ir.get(e);return n?Tr(n.zone)[n.index]:void 0},Rr=e=>ie(vo,_n,e),Mr=e=>{if(!vo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ar(e.slice(0,n));if(!t)return null;const o=Rr(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}},jr=(()=>{if(!q(Zt))return null;const e=`${Zt.nodeId}:${Zt.slot}`;return Mr(e)?.slot.panel===Zt.kind?e:null})(),Er=un(null);mn(()=>{const e=Er.current;if(Er.current=null,!jr||!q(Zt))return;const n=Zt.nodeId;po(n,{scroll:e!==jr}),Ho(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Zt]);const Lr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ir.get(e);n&&(n.zone===le?ri(n.index):Ri(n.zone,n.index,e,Ar(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&jr!==i&&(Er.current=i),mo(null,r),vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}}),oi(o)},Dr=(e,n,t)=>{const o=`${e}:${n}`;if(Ho(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;jr!==o&&(Er.current=o);mo(null,{kind:t,nodeId:e,slot:n})},Vr=(e,n,t)=>{if(Dn||!vo.moveSlot)return;const o=Ar(e),r=o?Rr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Ye(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vo.moveSlot(e,n,s);"string"==typeof d&&Dr(e,d,i.panel)},Hr=Io(),Wr=fn(()=>{const e=/* @__PURE__ */new Map;for(const n of Hr??[])e.set(n.slug,n.name);return e},[Hr]),Fr=e=>s(e,Br,Oo.plainText,e=>Wr.get(e),Oo.rowName),Jr=(e,n)=>{const t=_n.components[e.type]?.fields,o=n===le||qi(n)?"section":"block",r=n===le&&(lt(e)||st(e)||tt(e.type)),i="block"===o?d(t):r?null:c(t);return Oo.renamePropOf?Oo.renamePropOf(e,o,i):i},Ur=(e,n,t,o)=>{if(!(!Dn&&Mo?.zone===e&&Mo.index===n))return;const r=(t,o)=>{jo(null),o&&((e,n,t)=>{const o=Tr(e)[n];if(!o)return;const r=Jr(o,e);r&&yt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return bn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Gr=n(Z()),Xr=Gr.scope({target:We,siteId:An,docId:Fe}),Yr=_n,Qr=(e,n)=>n===le?$r(e):Br(e),Kr=(e,n,t)=>{const o=Gr.plan(Xr,t,Qr(t.type,e),Yr);o&&(o.changed&&yt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),qo(o.message))},_r=w({nodesIn:Tr,nodeAt:(e,n)=>Tr(e)[n]??null,labelOf:(e,n)=>n===le?$r(e):Br(e),renamePropOf:Jr,beginRename:(e,n)=>jo({zone:e,index:n}),history:{hasPast:Yn.hasPast,hasFuture:Yn.hasFuture,back:()=>Yn.back(),forward:()=>Yn.forward()},openAddSection:()=>{yt.select(null),ai(null)},openPageSettings:()=>{yt.select(null),eo(J)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Dn),collapseAll:()=>Ho(new Set(Tr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>qo(e?at.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>el(e,n),menuRows:yo.menuRows,isLocked:e=>xo(e.type),duplicateBlocked:e=>bo(Gn.data,e),permits:e=>se(_n,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:vr,openAddInside:(e,n)=>{e===le?ri(n):yt.select({zone:e,index:n}),ai(null)},locate:e=>Ir.get(e)??null,rowNameOf:(e,n)=>n===le?Nr(e):Fr(e),selectAt:(e,n,t,o)=>{e===le?ri(n):Ri(e,n,t,o??"")},slotRung:e=>{const n=Mr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Lr(n.node,n.slot,!1)}:null},style:{held:()=>O(Xr),canCopy:e=>Gr.rows(Yr,e).some(e=>!1!==e.counted),copy:(e,n)=>Gr.copy(Xr,e,Qr(e.type,n),Yr),paste:(e,n,t)=>Kr(e,n,t)},keys:Wn?{target:Wt,selected:()=>{const e=Gn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>zr.get(),readOnly:Boolean(Dn),onDone:({done:e,name:n})=>{"copied"===e&&qo(at.copied({name:n}))}}:void 0},Ht),qr=un({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});mn(()=>{qr.current={copy:(e,n)=>Gr.copy(Xr,e,Qr(e.type,n),Yr),paste:Kr,at:()=>{const e=Gn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Tr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Dn)}});const Zr=gn(e=>{const n=$(e);if(!n)return;const t=qr.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))},[]);mn(()=>{if(!Wt)return;const e=e=>Zr(e);return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[Zr,Wt]),_e(Ht,"keydown",Zr);const ei=Sr.map(e=>e.props.id).join("|");mn(()=>{const e=Ht?.document??null,n=Ht?.window??null;let t=0;const o=[],r=()=>{if(!e)return void qt(e=>e.length?[]:e);const n=Sr.findIndex(st),t=n>=0?n:Sr.length,o=n=>{const t=Sr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ke)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=On(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}qt(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()}},[Ht,ei,Bt,dr,St,vt,Qn?.props.id]);const ni=Ht?.document??null,ti=Ht?.window??null;mn(()=>{const e=Dt.current;if(!e||!ni||!ti)return;const n=[],t=()=>{const n=ni.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ti.scrollTo({left:ti.scrollX,top:ti.scrollY+t,behavior:"instant"}),!0};return Dt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ni,ti]);const oi=e=>{yo.holdCanvasOn?yo.holdCanvasOn(e):a(e)},ri=e=>{eo(J),yt.select({index:e}),yo.sectionPressed?.(Sr[e]);const n=Sr[e]?.props?.id;n&&oi(n)},ii=e=>{const{floor:n,cap:t}=vr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Qn&&Zt.kind!==it?.kind?Sr.findIndex(e=>e.props.id===Qn.props.id):-1;return o(r>=0?r+1:t)},li=(e,n)=>{const{floor:t,cap:o}=vr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(yt.reorderComponent(le,e,i),yt.select({index:i}),{moved:!0,dest:i})},si=(e,n,t,o)=>{eo(J),yt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),qo(`Added “${t}” section`)},di=(e,n)=>{const t=ii(n),o=zo(e,{nodeDefaults:Or,newNodeId:fe,sectionLabel:$r,blockIsOffered:Bo}),r=o?yt.insertNode(le,t,o):yt.insertSection(e,t);return si(t,r,$r(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 ce(_n,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Co(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},ci=(e,n,t)=>{const o=ii(t),r=yt.insertNode(le,o,n);return si(o,r,e),o},ai=e=>pi(le,e),pi=(e,n)=>{Ko.current=document.activeElement??null,It&&(Ut.current=Gt.current,Gt.current=!1,Pt()),Yt(null===n?null:{zone:e,index:n}),Jt(!0),St||(Ut.current=!0,Xn({type:"setUi",ui:{leftSideBarVisible:!0}}))},ui=()=>{Jt(!1),Yt(null),Ut.current&&Xn({type:"setUi",ui:{leftSideBarVisible:!1}}),Ut.current=!1},fi=(e,n,t)=>{if("section"===e.kind)yt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;yt.insertNode(n,t,wr(e.template.node))}eo(J),yt.select({index:t,zone:n})},hi=(e,n)=>Oo.rowName?n?lt(e)?Oo.rowName(e,"section",at.header):st(e)?Oo.rowName(e,"section",at.footer):tt(e.type)?Oo.rowName(e,"section",Br(e.type)):Nr(e):Fr(e):n?$r(e.type):Br(e.type),mi=e=>n=>{e()},gi=()=>yo.editPinnedSource?.(),yi=(e,n,t)=>{if(Dn)return null;const o=Tr(e)[n];return o&&!se(_n,o.type).delete?null:/* @__PURE__ */bn(Be,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Tr(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(tn,{size:15})})},ki=e=>Oo.rowPreview?.(e)||void 0,Si=e=>Oo.rowMarks?.(e)??void 0,vi=(e,n,t)=>Oo.rowActions?.(e,n,t)??null,xi=(e,n,t,o)=>{if(Dn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return bn(Be,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>wi(e,n,t),children:/* @__PURE__ */bn(r?on:rn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},bi=e=>{const n=$r(Sr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return vl(le,e,()=>ai(e),t)},wi=(e,n,t)=>{yt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},zi=e=>ae(_n,e),Ci=e=>ce(_n,e),Bi=e=>vo.slotsOf?Rr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ci(e)}],Oi=e=>vo.slotsOf?Bi(e).flatMap(e=>e.kids):Ci(e),$i=e=>Boolean(vo.slotsOf)&&Rr(e).some(e=>e.rung),Ni=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Ii=(e,n,t)=>{const o=ue(_n,e.type,n)&&(t||Oi(e).length>0||$i(e));return{collapsible:o,folded:o&&Xo(String(e.props.id))}},Pi=(e,n,t)=>Bi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ii(e,r,t(e.type)).collapsible?[String(e.props.id),...Pi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ti=e=>Oi(e).length>0||$i(e)||Boolean(Co(e.type)),Ai=e=>Boolean(Co(e)),Ri=(e,n,t,o)=>{if(eo(J),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),yt.select({index:n,zone:e}),a(t)}else yt.select({index:n,zone:e}),oi(t)},Mi=(e,n,t,o,r)=>{const i=`${e}:${n}`;yt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),yt.select({index:o,zone:i})}):yt.select({index:o,zone:i})},ji=(e,n,t)=>{yt.insertComponent(e,n,t),eo(J),yt.select({index:t,zone:e})},Ei=un(/* @__PURE__ */new Set);mn(()=>{Sr.forEach(e=>{const n=Co(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ei.current.has(t))return;Ei.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(Or)).forEach((e,t)=>yt.seedChild(o,t,n.childType,e))})},[Sr,yt,Or]);const Li=un(/* @__PURE__ */new Set);mn(()=>{Sr.forEach((n,t)=>{const o=n.props.id;if(Li.current.has(o))return;const r=e(n,zi(n.type));Li.current.add(o),r&&yt.replaceComponent(le,t,{...n,props:r})})},[Sr,yt]),ee(yt,_n);const Di=Sr.findIndex(st),Vi=Di>=0?Sr[Di]:null,Hi=dt?Sr.findIndex(lt):-1,Wi=Hi>=0?Sr[Hi]:null,Fi=Sr.find(e=>e.type===et)??null,Ji=Sr.find(e=>e.type===nt)??null,Ui=Di>=0?Di:Sr.length,Gi=[];Sr.forEach(e=>{st(e)||(Ti(e)&&Gi.push(String(e.props.id)),Gi.push(...Pi(e,1,Ai)))}),Vi&&(Gi.push(String(Vi.props.id)),Gi.push(...Pi(Vi,1,Ai)));const Xi=Gi.length>0&&Gi.every(e=>Vo.has(e)),Yi=e=>{const n=Oo.blockRowName(e,Br);return Oo.rowName?Oo.rowName(e,"block",n):n},Qi=(e,n,t,o)=>{const r=Tr(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Tr(n).length)},s=Ye(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},Ki=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ci(e))n.add(r),t(o)};for(const t of zi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_i=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ir.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},qi=e=>{const n=e.slice(0,e.indexOf(":")),t=Sr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},Zi=(e,n,t)=>{if(e.rung){const t=Ar(e.rung.nodeId),o=t?Rr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===$n&&n.index>=0&&n.index<=o}if(n.slot===$n)return!1;if(e.add)return tl(e.add,n);const o=sn(n);if(tt(e.type))return!1;const r=qi(o),i=qi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Tr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=vr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Tr(o).length)return!1;if(e.zone===o)return!0;const l=Vi&&!qn.lastIsOpen?String(Vi.props.id):null;return(!l||_i(e.zone)!==l&&_i(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Tr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ir.get(i),s=l?Tr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ki(r).has(n))return!1;const d=Co(s.type,wo(Gn?.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?.(Tr(n),r))})(e.zone,o,e.index,t)},el=(e,n)=>{const t=sn(e.from);if(t===sn(n))return!0;const o=e.node;return Zi({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},nl=e=>{const n=e.slice(0,e.indexOf(":")),t=Ir.get(n),o=t?Tr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,wo(Gn?.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:Br(r.spec.childType)}]:[]),l=Mr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:hi(o,t.zone===le)}},tl=(e,n)=>{const t=sn(n);if("block"!==e.kind){if(qi(t))return n.index>=0&&n.index<=Tr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=vr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=nl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Tr(t))},ol=(e,n)=>{e.rung?Vr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&qi(sn(n)))return void fi(e,sn(n),n.index);if("section"===e.kind)return void di(e.type,n.index);if("template"===e.kind)return void ci(e.template.name,wr(e.template.node),n.index);const t=sn(n),o=nl(t);o&&(o.target.spec?Mi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):ji(t,e.type,n.index))})(e.add,n):e.zone===le?li(e.index,n.index):Qi(e.zone,sn(n),e.index,n.index)},[rl]=hn(()=>Ge()),il=Xe({keyOf:e=>e.id,readOnly:Boolean(Dn),session:rl,canDrop:Zi,onDrop:ol,onStep:(e,n)=>{e.rung?Vr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=$r(Sr[e]?.type??""),o=li(e,n<0?e-1:e+2);if(!o.moved)return void qo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=vr();qo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Qi(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ll=gn(e=>{const{floor:n,cap:t}=vr(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Tr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||xo(i.type))continue;if(tt(i.type))continue;const l=Boolean(qi(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?$r(i.type):Fr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(nl(sn(e.list))?.choices.length)||Boolean(qi(sn(e.list))))}},[Gn.data]),sl=e=>{eo(J),yt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},dl=ne(),cl=()=>({data:Gn.data,device:Bt,ops:yt,inspector:go}),al=dl?.model,pl=fn(()=>al?e=>al(e,ll(e),cl()):ll,[al,ll,Bt]),ul=dl?.measure,fl=ul?(e,n)=>ul(e,n,cl()):void 0,hl=dl?.canDrop,ml=hl?(e,n)=>hl(e,n,Zi,cl()):Zi,gl=dl?.drop,yl=gl?(e,n)=>gl(e,n,ol,cl()):ol,kl=dl?.pick,Sl=kl?e=>kl(e,sl,cl()):sl,vl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Dn?{}:il.seam({place:{...an(e),index:n}}),onAdd:Dn?void 0:t,label:o},`seam:${e}:${n}`),xl={rowClick:mi,isCollapsed:Xo,toggleCollapse:Yo},bl=e=>{const n=String(e.props.id),t=Sr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Tr(o),i=Xo(n),l=Br(e.type),s=Oo.rowName?Oo.rowName(e,"section",l):l,d=e=>vl(o,e,()=>pi(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
-
return wn(zn,{children:[
|
|
16
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:s,preview:ki(e),marks:Si(e),onSelect:()=>ri(t),nameSlot:Ur(le,t,n,s),selected:lo===n,actions:vi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:mi(()=>ri(t))},fold:{open:!i,label:"section",onToggle:()=>Yo(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Nr(n),l=Ti(n),s=l&&Xo(r),c=()=>Ri(o,t,r,e.type),{rowProps:a,...p}=il.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:mi(c)});/* @__PURE__ */
|
|
17
|
-
return wn(kn,{children:[d(t),
|
|
18
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:ki(n),marks:Si(n),onSelect:c,nameSlot:Ur(o,t,r,i),selected:lo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Yo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(o,t,i),vi(n,o,t),xi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},wl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=il.dragging,d=!Xo(l)&&s?.rung?.nodeId!==i,c={...an(l),index:0},a=s&&!s.rung&&Zi(s,c)?c:void 0,p=()=>Lr(e,n,!0),{rowProps:u,...f}=il.row({item:{id:`rung:${l}`,zone:`${i}:${$n}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:$n,index:t},into:a,canDrag:Boolean(vo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:mi(p)}),h=Dn?null:vo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
-
return wn(kn,{children:[n.heading,
|
|
20
|
-
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:jr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Yo(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Dn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Dr(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__ */bn(tn,{size:15}):/* @__PURE__ */bn(ln,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},zl=(e,n)=>{const t=Bi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
-
return bn(zn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ni(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=null!==c&&Boolean(nl(c)?.choices.length),p=(e,n)=>a?vl(e,n,()=>pi(e,n),"Add block here"):vl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=lo===String(n.props.id),{collapsible:i,folded:s}=Ii(n,l,Ai(n.type)),d=String(n.props.id),c=Yi(n),a=()=>Ri(t,o,d,e.type),{rowProps:u,...f}=il.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:mi(a)});/* @__PURE__ */
|
|
22
|
-
return wn(kn,{children:[0===o&&p(t,0),
|
|
23
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:c,preview:ki(n),marks:Si(n),onSelect:a,nameSlot:Ur(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Yo(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(t,o,c),vi(n,t,o),xi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:zl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?wl(e,t.rung,r++,o,u):/* @__PURE__ */bn(kn,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=wo(Gn?.data,e.type,String(e.props.id)),o=Bi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
-
return bn(zn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ni(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=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>Mi(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>pi(n,t):void 0;return vl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */wn(zn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=lo===String(n.props.id),i=Fr(n),l=String(n.props.id),{collapsible:d,folded:c}=Ii(n,s,Ai(n.type)),a=zi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...an(p),index:Tr(p).length}:void 0,f=il.dragging,h=u&&f&&Zi(f,u)?u:void 0,g=()=>Ri(t,o,l,e.type),{rowProps:y,...k}=il.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!xo(n.type)},{"data-node-id":l,onClick:mi(g)});/* @__PURE__ */
|
|
25
|
-
return wn(kn,{children:[0===o&&m(t,0),
|
|
26
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:ki(n),marks:Si(n),onSelect:g,nameSlot:Ur(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Yo(l)}:void 0,actions:xo(n.type)?vi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[yi(t,o,i),vi(n,t,o),xi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */bn(we,{children:Cl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
-
/* @__PURE__ */bn(N,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Mi(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?wl(e,o.rung,i++,r,k):/* @__PURE__ */bn(kn,{children:k},o.slot??"")})})},Bl=(()=>{if(!Qn||!no)return null;const e=String(Qn.type),n=String(Qn.props.id),t=Co(e,wo(Gn?.data,e,n));if(!t||"footer"===t.source)return null;const o=Sr.some(e=>String(e.props?.id)===n),r=Array.isArray(Qn.props[t.slot])?Qn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Br(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:hi(Qn,o),choices:i,onPick:o=>{t.spec?Mi(n,t.slot,o,r.length,e):ji(`${n}:${t.slot}`,o,r.length)}}})(),Ol=ro&&ro.zone!==le&&!qi(ro.zone)?ro.zone:null,$l=!0===Qt.blocksFirst,Nl=Ol?nl(Ol):$l&&ro?null:Bl,Il=Boolean(Xt&&Ol)||$l&&Boolean(Nl&&Nl.choices.length>0),Pl=Ft||null!==It,Tl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:St&&!Pl&&So===e.id,onSelect:()=>mr(e.id)}:e,Al=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Ft,onSelect:()=>Ft?ui():ai(null)},...(yo.railLead??[]).map(Tl),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(qe,{}),active:St&&!Pl&&"sections"===So,onSelect:()=>mr("sections")},...(yo.railTrail??[]).map(Tl)];Nt?Al.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),active:St&&!Ft&&(null!==It||"media"===So),onSelect:()=>mr("media")}):Fn&&Al.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),onSelect:gr});const Rl=[...yo.railLead??[],...yo.railTrail??[]].find(e=>"panel"in e&&e.id===So),Ml=Boolean(ct?.foldable)&&!ko,jl=ct?.label??(Jn?at.pageSections:at.templateSections),El=Ml&&Xo(Nn),Ll=/* @__PURE__ */wn(zn,{children:[Sr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=lo===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=yo.hasOwnRows?.(e)??!1,l=Ti(e)||i,s=l&&Xo(r),{rowProps:d,...c}=il.row({item:{id:r,zone:le,index:n,type:e.type},place:{...an(le),index:n}},{"data-node-id":r,onClick:mi(()=>ri(n))});/* @__PURE__ */
|
|
28
|
-
return wn(kn,{children:[n>0&&bi(n),
|
|
29
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:Nr(e),preview:ki(e),marks:Si(e),onSelect:()=>ri(n),nameSlot:Ur(le,n,r,Nr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Yo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(le,n,Nr(e)),vi(e,le,n),xi(le,n,e,Nr(e))]}),rowProps:d}),Ti(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),yo.partRows?.(e,xl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:yo.ownRows?.(e,n,xl)})]},String(e.props.id??n))}),!ko&&Ui>0&&bi(Ui),ct?.addAtEnd&&!ko&&!Dn&&/* @__PURE__ */bn(N,{small:!0,label:at.addSection,blocked:null,onAdd:()=>ai(Ui)})]}),Dl=(e,n,t)=>{const o=String(e.props.id),r=Oi(e).length>0||$i(e)||Boolean(Co(e.type)),i=r&&Xo(o),l="header"===t?at.header:at.footer,s=Oo.rowName?Oo.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
-
return wn(zn,{children:[
|
|
31
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:t,size:13}),name:s,preview:ki(e),marks:Si(e),onSelect:()=>ri(n),nameSlot:Ur(le,n,o,s),selected:lo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Yo(o)}:void 0,actions:vi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:mi(()=>ri(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:zl(e,1)})]})};return(yo.wrap??(e=>e))(
|
|
32
|
-
/* @__PURE__ */bn(te,{target:Ht,children:/* @__PURE__ */wn("div",{ref:Vt,className:"sf-editor es-editor",style:He(Wo),onContextMenu:_r.onEditorContextMenu,...m(Ie),children:[
|
|
33
|
-
/* @__PURE__ */wn(Pe,{children:[
|
|
34
|
-
/* @__PURE__ */bn(Te,{items:Al,ariaLabel:"Left panel views"}),
|
|
35
|
-
/* @__PURE__ */wn(Ae,{children:[
|
|
36
|
-
/* @__PURE__ */bn(Re,{label:"Undo",disabled:Boolean(Dn)||!Yn.hasPast,onClick:()=>Yn.back(),children:/* @__PURE__ */bn(en,{})}),
|
|
37
|
-
/* @__PURE__ */bn(Re,{label:"Redo",disabled:Boolean(Dn)||!Yn.hasFuture,onClick:()=>Yn.forward(),children:/* @__PURE__ */bn(nn,{})}),
|
|
38
|
-
/* @__PURE__ */bn(Me,{}),
|
|
39
|
-
/* @__PURE__ */bn(je,{devices:xt,value:Bt,onChange:Ot})]}),
|
|
40
|
-
/* @__PURE__ */wn(Ae,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
-
/* @__PURE__ */bn(Cn,{saveState:Mn,notSaving:Boolean(Dn)||null!=jn,readOnlyReason:Vn,toggle:Hn,onToggle:Ln,onRetry:En}),yo.barLead?.(),
|
|
42
|
-
/* @__PURE__ */bn(Sn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(vn,{variant:"secondary",onClick:()=>{Dt.current=(()=>{const e=Ht?.document;if(!e)return null;const n=Sr.findIndex(st),t=n>=0?n:Sr.length;let o=null;for(let n=0;n<t;n++){const t=Sr[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=Qn?.props?.id??Sr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Lt(e=>e+1)},children:"Refresh"})}),yo.barTrail?.(),yo.barMain?yo.barMain():/* @__PURE__ */bn(vn,{variant:"primary",disabled:null!==Vn,onClick:()=>{Rn(Gn.data)},children:at.done})]})]}),
|
|
43
|
-
/* @__PURE__ */bn(z,{}),
|
|
44
|
-
/* @__PURE__ */wn("div",{className:"sf-body",children:[St?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
-
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Ft?/* @__PURE__ */bn(I,{blocks:Nl,blocksOnly:Il,at:Xt?{label:(e=>{const n=qi(e.zone);if(n)return at.add.addingTo({name:Oo.rowName?hi(n,!0):Br(n.type)});if(e.zone===le){const n=Sr[e.index];return n&&!st(n)?at.add.addingBefore({name:hi(n,!0)}):at.add.addingAtEnd}const t=nl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(Xt),onClear:()=>Yt(null)}:void 0,onAdd:e=>{const n=ro,t=(e,n)=>{Xt&&Yt({zone:e,index:n})};if(n&&"block"!==e.kind&&qi(n.zone))return fi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===io)return void di(e);const n=di(e,io);Xt&&Kt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===io)return void ci(e,n);const t=ci(e,n,io);Xt&&Kt(t+1)})(e.template.name,wr(e.template.node));if(n&&n.zone!==le){const o=nl(n.zone);if(!o)return;return o.target.spec?Mi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):ji(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Bl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:rl,siteWide:yo.addPanelRow?.(ui),onClose:ui,onHide:fr,readOnly:Boolean(Dn)}):It&&$t?
|
|
46
|
-
/* @__PURE__ */bn(A,{panel:$t,pick:It,onHide:fr}):Rl?Rl.panel({onHide:fr,notify:qo}):"media"===So&&$t?/* @__PURE__ */bn(A,{panel:$t,pick:null,onHide:fr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
-
/* @__PURE__ */bn(P,{icon:/* @__PURE__ */bn(qe,{}),title:"Layers",context:pt,actions:Gi.length>0?/* @__PURE__ */bn(Ee,{label:Xi?"Expand all sections":"Collapse all sections",onClick:()=>Ho(e=>{const n=new Set(Gi);return Xi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Gi])}),children:/* @__PURE__ */bn(Bn,{expand:Xi})}):void 0,onHide:fr}),
|
|
48
|
-
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"page",size:13}),name:at.pageSettings,onSelect:yr,selected:!Qn&&no,rowProps:{onClick:mi(yr)}}),Fi&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
-
/* @__PURE__ */bn(Ce,{children:at.header}),bl(Fi)]}),!ko&&Un&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
-
/* @__PURE__ */bn(Ce,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"header",size:13}),name:at.header,onSelect:kr,selected:Zt.kind===it?.kind,rowProps:{onClick:mi(kr)}})]}),!ko&&Wi&&Dl(Wi,Hi,"header"),!ko&&!Ml&&/* @__PURE__ */bn(Ce,{children:jl}),Ml?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
-
/* @__PURE__ */bn(be,{icon:null,name:jl,fold:{open:!El,label:jl,onToggle:()=>Yo(Nn)}}),!El&&/* @__PURE__ */bn(we,{children:Ll})]}):Ll,Un&&/* @__PURE__ */bn(Ce,{children:at.footer}),Vi&&Dl(Vi,Di,"footer"),!ko&&!Vi&&Un&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"footer",size:13}),name:at.footer,onSelect:gi,rowProps:{onClick:mi(gi),title:"Edit the site footer"}}),Ji&&bl(Ji),yo.treeFoot?.()]})]})}),
|
|
53
|
-
/* @__PURE__ */bn(Le,{side:"left",width:Wo.left,min:Ve,max:De,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Uo})]}):/* @__PURE__ */bn(T,{side:"left",onShow:fr}),
|
|
54
|
-
/* @__PURE__ */wn("div",{ref:Zo,className:"sf-center sf-scroll","data-sf-canvas-head":rr?"":void 0,style:{overflowX:ar?"auto":"hidden",overflowY:"hidden"},children:[rr&&/* @__PURE__ */bn("div",{ref:ir,className:"sf-canvas-head",children:/* @__PURE__ */bn(rr,{device:Bt})}),
|
|
55
|
-
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:pr,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Bt===zt?"":`sf-frame--${Bt}`),style:ur,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
-
/* @__PURE__ */bn(ut,{},Et),
|
|
57
|
-
/* @__PURE__ */bn(Ue,{canvas:Ht,session:rl,model:pl,measure:fl,canDrop:ml,onDrop:yl,onPick:Sl,onZoneAdd:e=>{const n=sn(e),t=Mr(n);t&&Lr(t.node,t.slot,!1),pi(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Dn),revision:Gn.data}),_t.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:_t.map(e=>/* @__PURE__ */wn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>ai(e.index),children:[
|
|
58
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
-
/* @__PURE__ */wn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),vt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
-
/* @__PURE__ */bn(g,{value:{selectChild:Ri,addChild:Mi,childRowName:Fr,blockRowName:Yi},children:/* @__PURE__ */bn(ft,{mode:Zt,onOpenWebsiteSettings:yo.openSettings??(()=>{}),onOpenSiteStyles:yo.openStyles,onSelectNode:Ao,onNotify:qo,onHidePanel:hr,nodeActions:Qn?se(_n,Qn.type):In})}),
|
|
63
|
-
/* @__PURE__ */bn(Le,{side:"right",width:Wo.right,min:Ve,max:De,defaultWidth:k.right,label:"Resize settings panel",onResize:Go})]}):
|
|
64
|
-
/* @__PURE__ */bn(T,{side:"right",onShow:hr})]}),_r.menu]})}))}export{Pn as ScreenChrome};
|
package/dist/chunk-OJAJVH7S.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-PYCLHOSA.js";import{Inspector as o}from"./chunk-JMGPPXNQ.js";import{DesktopIcon as u}from"./chunk-L5KW4HG5.js";import{createContext as i,useContext as l}from"react";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function a(n,e){const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function f(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const o=e.slotsOf?.(r);return o||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 k(n,e){return n.isLast?n.isLast(e):e.type===n.last}var m={},h={},v=()=>m,g=()=>"",y=()=>null,b=()=>{},L={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},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(u,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:u,onChange:i}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(o,{fields:e,values:t,onChange:i,readOnly:u,idPrefix:n})})}var G=i({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(G.Provider,{value:n,children:e})}function D(){return l(G)}function x(){return(D().useOwnerName??g)()}function A(){return(D().useDocumentLabel??y)()}function B(n,e,t,r){return(D().useBridges??v)(n,e,t,r)}function I(n){return(D().useStandaloneBridges??v)(n)}function T(n,e){(D().useDocumentPass??b)(n,e)}function F(){return D().blockRules??L}function H(){return D().blockLook??O}function K(){return D().devices??j}function R(){return D().leftView??P}function W(){return D().pinned??w}function Q(){return D().saveSwitch??!0}function V(n){e(!0===D().pickFollowsSelection,n)}function Y(){return D().add??h}function E(){return D().storageNamespace||void 0}function J(){return D().styleClipboard??null}function M(){return D().nodeKeys??!0}function X(){return D().notify??null}function Z(){return D().Canvas??S}function q(){return D().CanvasHead??null}function z(){return D().canvasDrag??null}var U=i(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(U.Provider,{value:n,children:e})}function _(){return l(U)}function nn(){return D().Inspector??C}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,k as isPinnedLast,f as isSlotMode,a as sameInspectorMode,d as screenSlotsOf,Y as useScreenAdd,H as useScreenBlockLook,F as useScreenBlockRules,B as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,K as useScreenDevices,A as useScreenDocumentLabel,T as useScreenDocumentPass,nn as useScreenInspectorPanel,R as useScreenLeftView,M as useScreenNodeKeys,X as useScreenNotify,x as useScreenOwnerName,D as useScreenParts,V as useScreenPickFollowsSelection,W as useScreenPinned,Q as useScreenSaveSwitch,E as useScreenStorageNamespace,J as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
package/dist/chunk-OTEXGJDU.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as s}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as i}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-QR4DLZ3P.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-OJAJVH7S.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as u}from"./chunk-PYCLHOSA.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{AddPanel as f}from"./chunk-W3XX2CNW.js";import{AddIcon as h}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as O,Fragment as $}from"react/jsx-runtime";var v=e=>`section:${e}`,B=e=>`block:${e}`,H=e=>`template:${e}`;function L({blocks:L,blocksOnly:x,at:A,onAdd:R,itemFor:V,session:C,siteWide:I,onClose:N,onHide:W,readOnly:D}){const P=u(e=>e.config),S=p(),{labelAtLevel:F,categoryLabel:J,firstSection:Q,Icon:T,Thumbnail:Y}=S,{blockIsOffered:Z}=m(),w=k("screen",d).add,z=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>Z(e,z);return i(z).list().then(n=>{if(t)return;const s=P.components;G(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,z]);const K=j(()=>t(P,S),[P]),M=e=>({type:v(e.type),label:e.name,cover:/* @__PURE__ */g(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:w.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=j(()=>{const e=[];if(L&&L.choices.length>0&&a(L.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${w.inside({name:L.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:B(e.type),label:e.label,icon:/* @__PURE__ */g(T,{type:e.type,size:18}),title:w.tile({name:e.label})}))})}),x)return e;const t=o(K,Q);t&&e.push({key:"start",title:w.startBlank,tiles:[M(t)]}),E.length>0&&e.push({key:"templates",title:w.templates,tiles:E.map(e=>{return{type:H(e.id),label:e.name,cover:/* @__PURE__ */g(Y,{type:e.node.type}),keywords:[(t=e.node.type,F(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const i=n(K,Q);for(const t of Object.keys(P.categories??{})){const o=i.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:s(P,t,J),tiles:o.map(M)})}return e},[L,x,E,K,P,w]),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=E.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return O($,{children:[
|
|
3
|
-
/* @__PURE__ */g(r,{icon:/* @__PURE__ */g(h,{size:15}),title:w.title,context:x?w.contextBlocks:w.contextAll,actions:/* @__PURE__ */g(c,{label:w.done,description:w.doneDescription,onClick:N}),onHide:W}),
|
|
4
|
-
/* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */g(f,{groups:X,session:C,itemFor:e=>V(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&R(t)},at:A,hint:x?w.hintBlocks:w.hint,searchLabel:x?w.searchBlocks:w.searchSections,readOnly:D}),I&&!x?I:null]})]})}export{L as AddSidePanel,B as blockKey,v as sectionKey,H as templateKey};
|
package/dist/chunk-QMNML7XH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-OJAJVH7S.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PYCLHOSA.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,m=!0===(i.resolveOnInsert??a);return s(()=>{const e=(e,n,o)=>{const r=t(n);return c||p({type:"insert",componentType:n,destinationZone:e,destinationIndex:o,id:r}),r},o=e=>(m&&!c&&d.resolveNode(e,{trigger:"insert"}),e),r=(e,t,n)=>{c||p({type:"replace",destinationZone:e,destinationIndex:t,data:n})},s=(t,n,r)=>o(e(t,n,r));return{insertComponent:s,insertSection:(e,t)=>s(n,e,t),replaceComponent:r,seedChild:(t,n,s,i)=>{const p=e(t,s,n);r(t,n,{type:s,props:{id:p,...i}}),o(p)},insertNode:(t,n,s)=>{const i=e(t,s.type,n);return r(t,n,{type:s.type,props:{...s.props,id:i}}),o(i)},removeComponent:(e,t)=>{c||p({type:"remove",index:t,zone:e})},reorderComponent:(e,t,n)=>{c||p({type:"reorder",sourceIndex:t,destinationIndex:n,destinationZone:e})},duplicateComponent:(e,t)=>{c||p({type:"duplicate",sourceIndex:t,sourceZone:e})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:e=>{c||p({type:"setData",data:e})},commitDocument:(e,t)=>{c||d.run({data:e,select:t})}}},[p,c,m,d])}export{i as useSectionOps};
|