efficient-easel 0.102.0 → 0.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/{chunk-TEZ6V6PA.js → chunk-3M3A3DN2.js} +1 -1
- package/dist/chunk-4MXFKJUY.js +1 -0
- package/dist/{chunk-D7M6IRPJ.js → chunk-66ICOE3I.js} +1 -1
- package/dist/chunk-6UJ3Y6FC.js +1 -0
- package/dist/{chunk-E7GGVILG.js → chunk-GXN65JMA.js} +1 -1
- package/dist/chunk-HDKTR5TZ.js +62 -0
- package/dist/chunk-LG436UTD.js +1 -0
- package/dist/{chunk-VLSTGOVD.js → chunk-MSBF7IW3.js} +1 -1
- package/dist/{chunk-5464H65G.js → chunk-NBJ2YY6Y.js} +1 -1
- package/dist/chunk-OORDMLL4.js +5 -0
- package/dist/chunk-Q2HPBMG5.js +1 -0
- package/dist/chunk-YJXEHK6I.js +2 -0
- package/dist/chunk-Z3KBLIEH.js +10 -0
- package/dist/chunk-ZWK3CBRU.js +1 -0
- package/dist/{host-B-byaQxg.d.ts → host-DJ8Gzsx7.d.ts} +93 -21
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -4
- 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.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/document-contract.d.ts +7 -0
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/puck/device-fields.d.ts +4 -2
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +22 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.js +1 -1
- package/dist/screen/screen.css +14 -0
- package/dist/screen/words.d.ts +42 -0
- package/dist/screen/words.js +1 -0
- package/dist/strings/catalogue.d.ts +9 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +1 -0
- package/dist/strings/index.js +1 -1
- package/package.json +6 -1
- package/dist/chunk-3U4GP5VA.js +0 -10
- package/dist/chunk-7RNTMJER.js +0 -5
- package/dist/chunk-F2FPZIZV.js +0 -62
- package/dist/chunk-FT35FX7D.js +0 -2
- package/dist/chunk-J4RAY75C.js +0 -1
- package/dist/chunk-PP44LCJM.js +0 -1
- package/dist/chunk-UH7TGWHR.js +0 -1
- package/dist/chunk-UVWVYMMZ.js +0 -1
package/README.md
CHANGED
|
@@ -977,6 +977,19 @@ second editor (the campaign designer) can stand on it. A host hands it:
|
|
|
977
977
|
- **its backend and its block registry**, on the session
|
|
978
978
|
(`createEaselSession`, `screen/lib/session`).
|
|
979
979
|
|
|
980
|
+
A host whose documents are not a website's (0.103.0) points the screen at
|
|
981
|
+
one of its own: `ScreenMount`'s `target` is `{ kind: "document", record,
|
|
982
|
+
slug? }` (`DocumentTarget`), and its `addressing` is a
|
|
983
|
+
`DocumentAddressing<DocumentTarget>`, which may also say what a missing one
|
|
984
|
+
is called (`describeMissing`) and hear that one would not open
|
|
985
|
+
(`onLoadFailed`). A document the backend resolves with a `readOnlyReason` is
|
|
986
|
+
held read-only for good, and the save pill's place says why. The top bar's
|
|
987
|
+
main button is the layer's when its bridges hand one back (`barMain`), and
|
|
988
|
+
the save pill is no switch under `saveSwitch: false`. The words the screen
|
|
989
|
+
says while a document opens, or will not, and the edit notice's word for the
|
|
990
|
+
document are the `screen` group of `EaselStrings`. Each is optional: without
|
|
991
|
+
it the screen is the website's, as it was.
|
|
992
|
+
|
|
980
993
|
- **Every module is a subpath of its own** (`efficient-easel/screen/lib/session`,
|
|
981
994
|
`efficient-easel/screen/components/ScreenChrome`): hosts and their guards
|
|
982
995
|
import them one by one, and two export different types under one name.
|
|
@@ -984,10 +997,11 @@ second editor (the campaign designer) can stand on it. A host hands it:
|
|
|
984
997
|
folder, never written down: `scripts/sync-screen-exports.mjs` writes the
|
|
985
998
|
`exports` map from it and `tests/screen-exports.test.ts` fails one that
|
|
986
999
|
drifted.
|
|
987
|
-
- **It still writes out some of the website it came from** (a
|
|
988
|
-
and template, the pinned Header and Footer rows, the
|
|
1000
|
+
- **It still writes out some of the website it came from** (a website
|
|
1001
|
+
target's site and template, the pinned Header and Footer rows, the
|
|
989
1002
|
`storefront-editor:` host messages). Each is handed in as the campaign
|
|
990
|
-
designer needs it; the list is in the builder's `doc/adr/0004`.
|
|
1003
|
+
designer needs it; the list is in the builder's `doc/adr/0004`. A host's
|
|
1004
|
+
own document target is the first to have left it (0.103.0).
|
|
991
1005
|
- **Its classes keep their `sf-` names** and its strings their words: the
|
|
992
1006
|
hosts' sheets, their guards and the website's host address them.
|
|
993
1007
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{settlePanelPick as e}from"./chunk-ZZ7VLIHQ.js";import{useScreenOwnerName as n}from"./chunk-
|
|
1
|
+
import{settlePanelPick as e}from"./chunk-ZZ7VLIHQ.js";import{useScreenOwnerName as n}from"./chunk-NBJ2YY6Y.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-6DJHRLCU.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=n();/* @__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&&e(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:n=>d&&e(d.requestId,n)})})]})}export{l as MediaSidePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KDYIMJTZ.js";import{backendOf as s}from"./chunk-AJBJ74ME.js";var r=()=>Promise.reject(new e("unavailable","This editor's backend keeps no section templates.")),t={list:()=>Promise.resolve([]),get:()=>Promise.resolve(null),ensure:r,save:r,update:r,rename:r,remove:r},o=()=>s().sectionTemplates??t,a={list:()=>o().list(),get:e=>o().get(e),ensure:(e,s,r)=>o().ensure(e,s,r),save:(e,s)=>o().save(e,s),update:(e,s)=>o().update(e,s),rename:(e,s)=>o().rename(e,s),remove:e=>o().remove(e)};export{a as sectionTemplates};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as n}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as n}from"./chunk-NBJ2YY6Y.js";import{useState as s,Fragment as a}from"react";import{jsxs as r,Fragment as c,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:t,open:m,onToggle:i}){const[p,u]=s(!1),{Icon:d}=n(),h=m??p;/* @__PURE__ */
|
|
2
2
|
return r(c,{children:[
|
|
3
3
|
/* @__PURE__ */r("button",{type:"button",className:"sf-add-card","aria-expanded":h,onClick:i??(()=>u(e=>!e)),children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),"Add block"]}),h&&/* @__PURE__ */o("div",{className:"sf-blockmenu",role:"menu",children:e(l).map(e=>/* @__PURE__ */r(a,{children:[e.group&&/* @__PURE__ */r("div",{className:"sf-menugroup-head",role:"presentation",children:[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-ZWK3CBRU.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-QTLAVDJE.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-ZJEBF4NB.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-UH7IGZKF.js";import{DEFAULT_PICK_WORDS as j}from"./chunk-ZAOM6PFH.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FPOKPNO4.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:h,pick:j,drag:l,menu:s,styleClipboard:r,copy:k,canvas:m,textStyles:o,screen:t},a=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function P(o,r){return r?y(o,r):o}export{F as DEFAULT_EASEL_STRINGS,P as mergeEaselStrings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-VV5ADNBR.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-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-VV5ADNBR.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-NBJ2YY6Y.js";import{useEasel as p}from"./chunk-P67FP7PG.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 P=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(P)},[P,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:P}}export{m as usePartBridge};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{siteStyleScope as n,copyNodeStyle as t,nodeStyleRows as o,planNodePaste as r}from"./chunk-Q2HPBMG5.js";import{markedTreeNodeId as i,revealSelectedTreeRow as l,sameSelector as s}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as d}from"./chunk-AKFJK65Z.js";import{rootRowName as c,slotChildRowName as a,slotChildRenameProp as p}from"./chunk-HWW4XJOH.js";import{scrollPreviewToSection as u,gotoPreviewSlide as f,scrollPreviewToTop as h}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as m,useEaselUndoKeys as y}from"./chunk-OM67AJQC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{UiIcon as k}from"./chunk-5MZ3RNQQ.js";import{DEFAULT_PANEL_W as S,PANEL_WIDTHS_KEY as b,clampPanelWidth as x}from"./chunk-SERF2FAU.js";import{usePartBridge as v}from"./chunk-GXN65JMA.js";import{useSectionOps as w}from"./chunk-VV5ADNBR.js";import{EASEL_NODE_CLIPBOARD as z,useNodeContextMenu as C}from"./chunk-F6CCTEIX.js";import{ROOT_ZONE as B,TREE_MAX_DEPTH as N,childSlotsOf as A,slotFieldsOf as O,nestsInTree as T,newNodeId as P}from"./chunk-FUDHI5I4.js";import{PageEditGuardNotices as $}from"./chunk-LG436UTD.js";import{useScreenDocument as j}from"./chunk-YJXEHK6I.js";import{requestMediaPick as R}from"./chunk-6FY3PZS3.js";import{useEaselHost as I}from"./chunk-R5ZVNJLJ.js";import{heldStyle as M,styleShortcut as E}from"./chunk-57DJOKXT.js";import{AddChildRow as L}from"./chunk-3QVB4AG2.js";import{AddSidePanel as D}from"./chunk-OORDMLL4.js";import{SidePanelHead as F,PanelShowStrip as H}from"./chunk-IWAPPEL4.js";import{MediaSidePanel as V}from"./chunk-3M3A3DN2.js";import{useMediaPanel as J,usePanelPick as G,cancelPanelPick as U}from"./chunk-ZZ7VLIHQ.js";import{useScreenSaveSwitch as W,useScreenPinned as Y,useScreenCanvasFrame as Q,useScreenInspectorPanel as X,useScreenDevices as Z,useScreenLeftView as K,SELECTION_MODE as _,sameInspectorMode as q,useScreenBridges as ee,useScreenBlockRules as ne,useScreenBlockLook as te,useScreenDocumentPass as oe}from"./chunk-NBJ2YY6Y.js";import{useEasel as re}from"./chunk-P67FP7PG.js";import{LayersTree as ie,TreeRow as le,TreeGroupLabel as se,Subtree as de,TreeRowAction as ce,TreeSeam as ae}from"./chunk-ZFDCDJNZ.js";import{useNodeOps as pe,toItemSelector as ue}from"./chunk-D2BCHTQR.js";import{saveIndicator as fe}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as he,TopBarRail as me,TopBarCluster as ye,EaselIconButton as ge,TopBarDivider as ke,DeviceSwitch as Se,InspectorIconButton as be,PanelResizeHandle as xe,MAX_PANEL_W as ve,MIN_PANEL_W as we,panelWidthVars as ze,SaveState as Ce,SaveStateToggle as Be}from"./chunk-6DJHRLCU.js";import{CanvasDragLayer as Ne}from"./chunk-TTJ54QGG.js";import{createDragSession as Ae,useTreeDrag as Oe,gapToMoveIndex as Te}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Pe,BLOCK_SELECTOR as $e,useCanvasEvent as je}from"./chunk-PAELDYYS.js";import{LayersIcon as Re,UndoIcon as Ie,RedoIcon as Me,TrashIcon as Ee,MediaIcon as Le}from"./chunk-L5KW4HG5.js";import{ROOT_ID as De,ROOT_SLOT as Fe,zoneKey as He,parseZoneKey as Ve,DataError as Je}from"./chunk-KRXQM65X.js";import{useRef as Ge,useMemo as Ue,useState as We,useEffect as Ye,useCallback as Qe,useLayoutEffect as Xe,Fragment as Ze}from"react";import{jsx as Ke,jsxs as _e,Fragment as qe}from"react/jsx-runtime";function en({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return Ke(Ce,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return Ke(Ce,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=fe(e),d=e.failed&&!e.paused&&/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return _e(qe,o?{children:[
|
|
4
|
+
/* @__PURE__ */Ke(Be,{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__ */Ke(Ce,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */Ke(Ce,{tone:l,label:s,role:"status"}),d]})}function nn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return Ke("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */_e(qe,e?{children:[
|
|
7
|
+
/* @__PURE__ */Ke("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */Ke("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */Ke("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */Ke("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */Ke("path",{d:"M5 12h14"})]})})}function tn(){const fe=I(),{capabilities:Ce,currentSlug:Be,siteId:tn,onPublish:on,saveState:rn,saveConflict:ln,retrySave:sn,toggleAutoSave:dn,readOnly:cn,readOnlyReason:an=null}=j(),pn=W(),{canPublish:un,mediaEditing:fn,hasEditGuard:hn,hasPinnedChrome:mn}=Ce,{appState:yn,dispatch:gn,history:kn,selectedItem:Sn,getSelectorForId:bn,config:xn}=re(e=>e),{first:vn,last:wn,firstGroup:zn,lastGroup:Cn,isSectionGroup:Bn,sectionGroupZone:Nn,panelOf:An}=Y(),On=An(vn),Tn=Q(),Pn=X(),$n=w({readOnly:cn}),jn=Ge(null),Rn=Ue(()=>({...$n,select:e=>{jn.current=e,$n.select(e)}}),[$n]),In=yn.ui,Mn=In.leftSideBarVisible,En=In.rightSideBarVisible,{options:Ln,widths:Dn,initial:Fn,fluid:Hn}=Z(),[Vn,Jn]=We(Fn),Gn=J(),Un=fn&&null!==Gn,Wn=G(),{read:Yn,write:Qn,forSelection:Xn}=K(),[Zn,Kn]=We(Yn);Ye(()=>{Qn(Zn)},[Zn]);const[_n,qn]=We(0),et=Ge(null),nt=Ge(null),tt=Pe(nt,{readySelector:$e}),ot=m(nt);y(nt);const[rt,it]=We(!1),lt=Ge(!1),st=Ge(!1),[dt,ct]=We(null),at=dt&&dt.zone===B?dt.index:null,pt=e=>ct(null===e?null:{zone:B,index:e}),[ut,ft]=We([]),[ht,mt]=We(_),yt="puck"===ht.kind,gt=i(ht,Sn?.props.id),[kt,St]=We(null);Ye(()=>{kt&&(l(),St(null))},[kt]);const bt=Ge(bn);bt.current=bn;const xt=Qe((e,{scroll:n})=>{Kn(n=>Xn(e,n)),n&&St(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=bt.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),o=n}0!==t.length&&Jt(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]);Ye(()=>{mt(An(Sn?.type)??_);const e=Sn?.props.id,n=jn.current;if(jn.current=null,!e)return;const t=bn(e);xt(String(e),{scroll:!s(n,t??null,B)})},[Sn?.props.id,xt]);const vt=Qe(e=>{mt(n=>q(n,e)?n:e),gn({type:"setUi",ui:{rightSideBarVisible:!0}})},[gn]),wt=ee({kind:ht.kind,mode:ht,open:vt,show:e=>mt(e),reveal:()=>{En||gn({type:"setUi",ui:{rightSideBarVisible:!0}})}},{data:yn.data,selected:Sn??null,zoneOf:e=>bn(e)?.zone,readOnly:Boolean(cn),select:e=>{mt(_),Rn.select({index:e})},replace:(e,n)=>Rn.replaceComponent(B,e,n),scrollTo:e=>Xo(e)},{device:Vn,refreshes:_n},{setView:Kn,reveal:()=>{Mn||gn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),zt=wt.pinnedSource??!1,Ct=wt.resolveLeftView?wt.resolveLeftView(Zn,Un):"media"===Zn&&Un?Zn:"sections",{isLockedBlock:Bt,duplicateBlocked:Nt,nestDepth:At,newSectionNode:Ot,canAddTo:Tt,blockIsOffered:Pt}=ne(),$t=te(),{labelAtLevel:jt,Icon:Rt,useProducts:It}=$t,Mt=Qe(e=>{gn({type:"setUi",ui:{rightSideBarVisible:!0}}),u(e),xt(e,{scroll:!0})},[gn,xt]),{selectNode:Et,openPartId:Lt}=v({mode:ht,setMode:mt,onOpenPart:Mt}),[Dt,Ft]=We(null),Ht="sf-editor-collapsed-sections",[Vt,Jt]=We(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ht);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});Ye(()=>{try{window.localStorage.setItem(Ht,JSON.stringify([...Vt]))}catch{}},[Vt]);const[Gt,Ut]=We(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(b);if(!e)return{...S};const n=JSON.parse(e);return{left:x(Number(n.left)||S.left),right:x(Number(n.right)||S.right)}}catch{return{...S}}});Ye(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(b,JSON.stringify(Gt))}catch{}},300);return()=>clearTimeout(e)},[Gt]);const Wt=Qe((e,n)=>Ut(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Yt=Qe(e=>Wt("left",e),[Wt]),Qt=Qe(e=>Wt("right",e),[Wt]),Xt=e=>Vt.has(e),Zt=e=>Jt(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Kt=Ge(!1),_t=Ge(null);Ye(()=>{if(Kt.current&&!rt){const e=_t.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??nt.current?.querySelector('button[aria-label="Add"]'))?.focus(),_t.current=null}Kt.current=rt},[rt]),Ye(()=>{if(!rt||!ot)return;const e=e=>{"Escape"===e.key&&rr()};return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[rt,ot]),Ye(()=>{!Mn&&rt&&(it(!1),ct(null),lt.current=!1)},[Mn]),Ye(()=>{if(!Wn)return st.current&&gn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(st.current=!1);rt&&(it(!1),ct(null),st.current=lt.current,lt.current=!1),Mn||(st.current=!0,gn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Wn]),Ye(()=>{!Mn&&Wn&&(st.current=!1,U())},[Mn]),Ye(()=>{if(!Wn||!ot)return;const e=e=>{"Escape"===e.key&&U()};return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[Wn,ot]);const[qt,eo]=We(null),[no,to]=We(0),oo=Ge(null),ro=(e,n="success")=>{eo({msg:e,tone:n}),to(e=>e+1),oo.current&&clearTimeout(oo.current),oo.current=setTimeout(()=>eo(null),"error"===n?3200:1900)};Ye(()=>()=>{oo.current&&clearTimeout(oo.current)},[]);const io=Ge(null),[lo,so]=We(0),[co,ao]=We(0);Ye(()=>{const e=io.current;if(!e)return;const n=()=>{so(e.clientWidth),ao(e.clientHeight)};n();const t=new ResizeObserver(n);return t.observe(e),()=>t.disconnect()},[]),Xe(()=>{io.current&&(so(io.current.clientWidth),ao(io.current.clientHeight))},[Gt,Mn,En]);const po=Vn===Hn?lo>0?lo:Dn[Hn]:Dn[Vn],uo=lo>0?Math.min(lo/po,2):1,fo=po*uo,ho=lo>0&&fo>lo+1,mo={width:fo,height:co||"100%",flex:"none",position:"relative"},yo={width:po,height:co?co/uo:"100%",maxHeight:"none",transform:1!==uo?`scale(${uo})`:void 0,transformOrigin:"top left"},go=()=>gn({type:"setUi",ui:{leftSideBarVisible:!Mn}}),ko=()=>gn({type:"setUi",ui:{rightSideBarVisible:!En}}),So=e=>{rt&&(it(!1),ct(null),lt.current=!1,Mn&&Zn===e)||Wn&&(st.current=!1,U(),Mn&&Zn===e)||(Mn&&Zn===e?go():(Kn(e),Mn||gn({type:"setUi",ui:{leftSideBarVisible:!0}})))},bo=()=>{R(fe,{accept:"image/*",title:"Media library"})},xo=()=>{mt(_),Rn.select(null),h()},vo=()=>{mt(On??_),En||gn({type:"setUi",ui:{rightSideBarVisible:!0}})},wo=yn.data.content??[],zo=()=>{const e=wo.findIndex(e=>e.type===vn),n=wo.findIndex(e=>e.type===wn);return{floor:e>=0?e+1:0,cap:n>=0?n:wo.length}},Co=xn,Bo=pe({data:yn.data,config:Co,readOnly:Boolean(cn),clipboard:z,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==De||e.slot!==Fe)return{min:0,max:n-1};const{floor:t,cap:o}=zo();return{min:t,max:o-1}},commit:(e,{select:n})=>{if(void 0!==n){mt(_);const t="node"===n?.kind?ue(e,Co,n):null;Rn.select(t&&t.zone===B?{index:t.index}:t)}Rn.commitDocument(e)}}),No=e=>xn.components[e]?.label??e,Ao=Qe(e=>xn.components[e]?.defaultProps??{},[xn]),Oo=e=>jt(e,"section",No(e)),To=e=>c({type:e.type,props:e.props??{}},Oo(e.type)),{nodeAddresses:Po,zoneItems:$o}=Ue(()=>{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>=N)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of A(xn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(wo,B,0),{nodeAddresses:e,zoneItems:n}},[wo,xn]),jo=Qe(e=>$o.get(e)??[],[$o]),Ro=It(),Io=Ue(()=>{const e=/* @__PURE__ */new Map;for(const n of Ro??[])e.set(n.slug,n.name);return e},[Ro]),Mo=e=>a(e,No,$t.plainText,e=>Io.get(e)),Eo=(e,n)=>n===B?null:p(xn.components[e.type]?.fields),Lo=(e,n,t,o)=>{if(!(Dt?.zone===e&&Dt.index===n))return;const r=(t,o)=>{Ft(null),o&&((e,n,t)=>{const o=jo(e)[n];if(!o)return;const r=Eo(o,e);r&&Rn.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return Ke("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)},Do=n(tn),Fo=xn,Ho=(e,n)=>n===B?Oo(e):No(e),Vo=(e,n,t)=>{const o=r(Fo,Do,t,Ho(t.type,e));o&&(o.changed&&Rn.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),ro(o.message))},Jo=C({nodesIn:jo,nodeAt:(e,n)=>jo(e)[n]??null,labelOf:(e,n)=>n===B?Oo(e):No(e),renamePropOf:Eo,beginRename:(e,n)=>Ft({zone:e,index:n}),history:{hasPast:kn.hasPast,hasFuture:kn.hasFuture,back:()=>kn.back(),forward:()=>kn.forward()},openAddSection:()=>{Rn.select(null),tr(null)},openPageSettings:()=>{Rn.select(null),mt(_)},collapseAll:()=>Jt(new Set(jo(B).map(e=>String(e.props.id)))),onPasteRefused:()=>ro("Your browser won’t let us read the clipboard — press ⌘V","error"),isLocked:e=>Bt(e.type),duplicateBlocked:e=>Nt(yn.data,e),canAddTo:Tt,nodeOps:Bo,isPinned:(e,n)=>n===B&&(e.type===vn||e.type===wn),sectionBand:zo,openAddInside:(e,n)=>{e===B?Zo(n):Rn.select({zone:e,index:n}),tr(null)},locate:e=>Po.get(e)??null,rowNameOf:(e,n)=>n===B?To(e):Mo(e),selectAt:(e,n,t,o)=>{e===B?Zo(n):kr(e,n,t,o??"")},style:{held:()=>M(Do),canCopy:e=>o(Fo,e).some(e=>!1!==e.counted),copy:(e,n)=>t(Fo,Do,e,Ho(e.type,n)),paste:(e,n,t)=>Vo(e,n,t)}},tt),Go=Ge({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Ye(()=>{Go.current={copy:(e,n)=>t(Fo,Do,e,Ho(e.type,n)),paste:Vo,at:()=>{const e=yn.ui.itemSelector;if(!e)return null;const n=e.zone??B,t=jo(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(cn)}});const Uo=Qe(e=>{const n=E(e);if(!n)return;const t=Go.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))},[]);Ye(()=>{if(!ot)return;const e=e=>Uo(e);return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[Uo,ot]),je(tt,"keydown",Uo);const Wo=wo.map(e=>e.props.id).join("|");Ye(()=>{const e=tt?.document??null,n=tt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void ft(e=>e.length?[]:e);const n=wo.findIndex(e=>e.type===wn),t=n>=0?n:wo.length,o=n=>{const t=wo[n]?.props?.id;if(null==t)return null;const o=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);return o?o.getBoundingClientRect():null},r=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1);(n||t)&&r.push({top:Math.round(n?n.top:t.bottom),index:e})}ft(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)return!1;return!0}(e,r)?e:r)},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()}},[tt,Wo,Vn,uo,Mn,En,Sn?.props.id]);const Yo=tt?.document??null,Qo=tt?.window??null;Ye(()=>{const e=et.current;if(!e||!Yo||!Qo)return;const n=[],t=()=>{const n=Yo.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Qo.scrollTo({left:Qo.scrollX,top:Qo.scrollY+t,behavior:"instant"}),!0};return et.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Yo,Qo]);const Xo=e=>{wt.holdCanvasOn?wt.holdCanvasOn(e):u(e)},Zo=e=>{mt(_),Rn.select({index:e}),wt.sectionPressed?.(wo[e]);const n=wo[e]?.props?.id;n&&Xo(n)},Ko=e=>{const{floor:n,cap:t}=zo(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Sn&&ht.kind!==On?.kind?wo.findIndex(e=>e.props.id===Sn.props.id):-1;return o(r>=0?r+1:t)},_o=(e,n)=>{const{floor:t,cap:o}=zo(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Rn.reorderComponent(B,e,i),Rn.select({index:i}),{moved:!0,dest:i})},qo=(e,n,t)=>{mt(_),Rn.select({index:e}),u(n),ro(`Added “${t}” section`)},er=(e,n)=>{const t=Ko(n),o=Ot(e,{nodeDefaults:Ao,newNodeId:P,sectionLabel:Oo,blockIsOffered:Pt}),r=o?Rn.insertNode(B,t,o):Rn.insertSection(e,t);return qo(t,r,Oo(e)),t},nr=(e,n,t)=>{const o=Ko(t),r=Rn.insertNode(B,o,n);return qo(o,r,e),o},tr=e=>or(B,e),or=(e,n)=>{_t.current=document.activeElement??null,Wn&&(lt.current=st.current,st.current=!1,U()),ct(null===n?null:{zone:e,index:n}),it(!0),Mn||(lt.current=!0,gn({type:"setUi",ui:{leftSideBarVisible:!0}}))},rr=()=>{it(!1),ct(null),lt.current&&gn({type:"setUi",ui:{leftSideBarVisible:!1}}),lt.current=!1},ir=(e,n,t)=>{if("section"===e.kind)Rn.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Rn.insertNode(n,t,d(e.template.node))}mt(_),Rn.select({index:t,zone:n})},lr=e=>n=>{n.target.closest(".es-tree-select")||e()},sr=()=>wt.editPinnedSource?.(),dr=(e,n,t)=>/* @__PURE__ */Ke(ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=jo(e)[n]?.props?.id;null!=t&&Bo.remove(String(t))})(e,n),children:/* @__PURE__ */Ke(Ee,{size:15})}),cr=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return Ke(ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>pr(e,n,t),children:/* @__PURE__ */Ke(k,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},ar=e=>{const n=Oo(wo[e]?.type??"");return Vr(B,e,()=>tr(e),n?`Add section before ${n}`:"Add section here")},pr=(e,n,t)=>{Rn.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},ur=e=>O(xn,e),fr=e=>A(xn,e),hr=(e,n,t)=>{const o=T(xn,e.type,n)&&(t||fr(e).length>0);return{collapsible:o,folded:o&&Xt(String(e.props.id))}},mr=(e,n,t)=>fr(e).flatMap(({child:e})=>hr(e,n,t(e.type)).collapsible?[String(e.props.id),...mr(e,n+1,t)]:[]),yr=e=>fr(e).length>0||Boolean(Tt(e.type)),gr=e=>Boolean(Tt(e)),kr=(e,n,t,o)=>{if(mt(_),Tt(o)?.spec?.slider){const t=e.split(":")[0];f(t,n),Rn.select({index:n,zone:e}),u(t)}else Rn.select({index:n,zone:e}),Xo(t)},Sr=(e,n,t,o,r)=>{const i=`${e}:${n}`;Rn.insertComponent(i,t,o),Tt(r)?.spec?.slider?requestAnimationFrame(()=>{f(e,o),Rn.select({index:o,zone:i})}):Rn.select({index:o,zone:i})},br=(e,n,t)=>{Rn.insertComponent(e,n,t),mt(_),Rn.select({index:t,zone:e})},xr=Ge(/* @__PURE__ */new Set);Ye(()=>{wo.forEach(e=>{const n=Tt(e.type)?.spec;if(!n)return;const t=e.props.id;if(xr.current.has(t))return;xr.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(Ao)).forEach((e,t)=>Rn.seedChild(o,t,n.childType,e))})},[wo,Rn,Ao]);const vr=Ge(/* @__PURE__ */new Set);Ye(()=>{wo.forEach((n,t)=>{const o=n.props.id;if(vr.current.has(o))return;const r=e(n,ur(n.type));vr.current.add(o),r&&Rn.replaceComponent(B,t,{...n,props:r})})},[wo,Rn]),oe(Rn,xn);const wr=wo.findIndex(e=>e.type===wn),zr=wr>=0?wo[wr]:null,Cr=wo.find(e=>e.type===zn)??null,Br=wo.find(e=>e.type===Cn)??null,Nr=wr>=0?wr:wo.length,Ar=[];wo.forEach(e=>{e.type!==wn&&(yr(e)&&Ar.push(String(e.props.id)),Ar.push(...mr(e,1,gr)))}),zr&&(Ar.push(String(zr.props.id)),Ar.push(...mr(zr,1,gr)));const Or=Ar.length>0&&Ar.every(e=>Vt.has(e)),Tr=e=>$t.blockRowName(e,No),Pr=(e,n,t,o)=>{const r=jo(e)[t];if(!r)return;const i={...Ve(e),index:t},l={...Ve(n),index:Math.min(Math.max(o,0),jo(n).length)},s=Te(i,l);if(e!==n||s!==t)try{Bo.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Je))throw e}},$r=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of fr(e))n.add(r),t(o)};for(const t of ur(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jr=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Po.get(n);if(!e)return null;if(e.zone===B)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Rr=e=>{const n=e.slice(0,e.indexOf(":")),t=wo.find(e=>Bn(e.type)&&String(e.props.id)===n);return t&&Nn(n)===e?t:null},Ir=(e,n)=>{if(e.add)return Er(e.add,n);const t=He(n);if(Bn(e.type))return!1;const o=Rr(t),r=Rr(e.zone);if(o||r)return!(!o||!r)&&(n.index>=0&&n.index<=jo(t).length);if(e.zone===B||t===B){if(e.zone!==t)return!1;const{floor:o,cap:r}=zo();return n.index>=o&&n.index<=r}if(n.index<0||n.index>jo(t).length)return!1;if(e.zone===t)return!0;const i=zr?String(zr.props.id):null;return(!i||jr(e.zone)!==i&&jr(t)!==i)&&((e,n,t)=>{if(e===n)return!0;const o=jo(e)[t];if(!o)return!1;const r=n.split(":")[0],i=Po.get(r),l=i?jo(i.zone)[i.index]:void 0;if(!l)return!1;if($r(o).has(n))return!1;const s=Tt(l.type,At(yn?.data,l.type,r));return!!s&&(!!(s.choices?s.choices.some(e=>e.type===o.type):s.spec?.childType===o.type)&&!s.spec?.addBlocked?.(jo(n),o))})(e.zone,t,e.index)},Mr=e=>{const n=e.slice(0,e.indexOf(":")),t=Po.get(n),o=t?jo(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Tt(o.type,At(yn?.data,o.type,n));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;return{parent:o,parentId:n,target:r,choices:r.choices??(r.spec?[{type:r.spec.childType,label:No(r.spec.childType)}]:[]),parentName:t.zone===B?Oo(o.type):No(o.type)}},Er=(e,n)=>{const t=He(n);if("block"!==e.kind){if(Rr(t))return n.index>=0&&n.index<=jo(t).length;if(t!==B)return!1;const{floor:e,cap:o}=zo();return n.index>=e&&n.index<=o}if(t===B)return!1;const o=Mr(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(jo(t))},Lr=(e,n)=>{e.add?((e,n)=>{if("block"!==e.kind&&Rr(He(n)))return void ir(e,He(n),n.index);if("section"===e.kind)return void er(e.type,n.index);if("template"===e.kind)return void nr(e.template.name,d(e.template.node),n.index);const t=He(n),o=Mr(t);o&&(o.target.spec?Sr(o.parentId,o.target.slot,e.type,n.index,o.parent.type):br(t,e.type,n.index))})(e.add,n):e.zone===B?_o(e.index,n.index):Pr(e.zone,He(n),e.index,n.index)},[Dr]=We(()=>Ae()),Fr=Oe({keyOf:e=>e.id,readOnly:Boolean(cn),session:Dr,canDrop:Ir,onDrop:Lr,onStep:(e,n)=>{e.zone===B?((e,n)=>{const t=Oo(wo[e]?.type??""),o=_o(e,n<0?e-1:e+2);if(!o.moved)return void ro(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=zo();ro(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Pr(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Hr=Qe(e=>{const{floor:n,cap:t}=zo(),o=[];for(const r of e.nodes){const e=He(r.place),i=jo(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(i.type===vn||i.type===wn||Bt(i.type))continue;if(Bn(i.type))continue;const l=Boolean(Rr(e)),s=e===B||l;e===B&&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?Oo(i.type):Mo(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(Mr(He(e.list))?.choices.length)||Boolean(Rr(He(e.list))))}},[yn.data]),Vr=(e,n,t,o)=>/* @__PURE__ */Ke(ae,{...cn?{}:Fr.seam({place:{...Ve(e),index:n}}),onAdd:cn?void 0:t,label:o},`seam:${e}:${n}`),Jr={rowClick:lr,isCollapsed:Xt,toggleCollapse:Zt},Gr=e=>{const n=String(e.props.id),t=wo.findIndex(e=>String(e.props.id)===n),o=Nn(n),r=jo(o),i=Xt(n),l=No(e.type),s=e=>Vr(o,e,()=>or(o,e),"Add section here");/* @__PURE__ */
|
|
15
|
+
return _e(qe,{children:[
|
|
16
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:e.type,size:13}),name:l,onSelect:()=>Zo(t),selected:gt===n,rowProps:{"data-node-id":n,onClick:lr(()=>Zo(t))},fold:{open:!i,label:"section",onToggle:()=>Zt(n)}}),!i&&/* @__PURE__ */_e(de,{children:[r.map((n,t)=>{const r=String(n.props.id),i=To(n),l=yr(n),d=l&&Xt(r),c=()=>kr(o,t,r,e.type),{rowProps:a,...p}=Fr.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Ve(o),index:t}},{"data-node-id":r,onClick:lr(c)});/* @__PURE__ */
|
|
17
|
+
return _e(Ze,{children:[s(t),
|
|
18
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:n.type,size:13}),name:i,onSelect:c,selected:gt===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!d,label:"section",onToggle:()=>Zt(r)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(o,t,i),cr(o,t,n,i)]}),rowProps:a}),l&&!d&&/* @__PURE__ */Ke(de,{children:Wr(n,2)})]},r)}),s(r.length)]})]})},Ur=(e,n)=>{const t=fr(e),o=(e,n)=>Vr(e,n),r=Tt(e.type),i=r?`${e.props.id}:${r.slot}`:null;/* @__PURE__ */
|
|
19
|
+
return _e(qe,{children:[t.map(({child:t,zone:r,index:i})=>{const l=gt===String(t.props.id),{collapsible:s,folded:d}=hr(t,n,gr(t.type)),c=String(t.props.id),a=Tr(t),p=()=>kr(r,i,c,e.type),{rowProps:u,...f}=Fr.row({item:{id:c,zone:r,index:i,type:t.type},place:{...Ve(r),index:i}},{"data-node-id":c,onClick:lr(p)});/* @__PURE__ */
|
|
20
|
+
return _e(Ze,{children:[0===i&&o(r,0),
|
|
21
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:t.type,size:13}),name:a,onSelect:p,selected:l,hidden:Boolean(t.props._hidden),...f,fold:s?{open:!d,label:"group",onToggle:()=>Zt(c)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(r,i,a),cr(r,i,t,a)]}),rowProps:u}),s&&!d&&/* @__PURE__ */Ke(de,{children:Ur(t,n+1)}),o(r,i+1)]},String(t.props.id??`${r}-${i}`))}),i&&!t.some(e=>e.zone===i)?o(i,0):null]})},Wr=(e,n)=>{const t=fr(e),o=Tt(e.type,At(yn?.data,e.type,String(e.props.id))),r=o?.spec??null,i=r&&Array.isArray(e.props[r.slot])?e.props[r.slot]:[],l=o&&o.choices?{slot:o.slot,choices:o.choices}:null,s=String(e.props.id),d=r&&!r.fixed?`${s}:${r.slot}`:null,c=l?`${s}:${l.slot}`:null,a=(n,t)=>{const o=n===d&&r&&!r.addBlocked?.(i)?()=>Sr(e.props.id,r.slot,r.childType,t,e.type):n===c?()=>or(n,t):void 0;return Vr(n,t,o,n===d&&r?r.addLabel:"Add block here")};/* @__PURE__ */
|
|
22
|
+
return _e(qe,{children:[t.map(({child:t,zone:o,index:r})=>{const i=gt===String(t.props.id),l=Mo(t),s=String(t.props.id),{collapsible:d,folded:c}=hr(t,n,gr(t.type)),p=ur(t.type),u=1===p.length?`${s}:${p[0]}`:null,f=u?{...Ve(u),index:jo(u).length}:void 0,h=Fr.dragging,m=f&&h&&Ir(h,f)?f:void 0,y=()=>kr(o,r,s,e.type),{rowProps:g,...k}=Fr.row({item:{id:s,zone:o,index:r,type:t.type},place:{...Ve(o),index:r},into:m,canDrag:!Bt(t.type)},{"data-node-id":s,onClick:lr(y)});/* @__PURE__ */
|
|
23
|
+
return _e(Ze,{children:[0===r&&a(o,0),
|
|
24
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:t.type,size:13}),name:l,onSelect:y,nameSlot:Lo(o,r,s,l),selected:i,hidden:Boolean(t.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Zt(s)}:void 0,actions:Bt(t.type)?void 0:/* @__PURE__ */_e(qe,{children:[dr(o,r,l),cr(o,r,t,l)]}),rowProps:g}),d&&!c&&/* @__PURE__ */Ke(de,{children:Wr(t,n+1)}),a(o,r+1)]},String(t.props.id??`${o}-${r}`))}),r&&!r.fixed&&
|
|
25
|
+
/* @__PURE__ */Ke(L,{small:!0,label:r.addLabel,blocked:r.addBlocked?.(i)??null,onAdd:()=>Sr(e.props.id,r.slot,r.childType,i.length,e.type)}),c&&!t.some(e=>e.zone===c)?a(c,0):null]})},Yr=(()=>{if(!Sn||!yt)return null;const e=String(Sn.type),n=String(Sn.props.id),t=Tt(e,At(yn?.data,e,n));if(!t||"footer"===t.source)return null;const o=wo.some(e=>String(e.props?.id)===n),r=Array.isArray(Sn.props[t.slot])?Sn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:No(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?Oo(e):No(e),choices:i,onPick:o=>{t.spec?Sr(n,t.slot,o,r.length,e):br(`${n}:${t.slot}`,o,r.length)}}})(),Qr=rt||null!==Wn,Xr=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Mn&&!Qr&&Ct===e.id,onSelect:()=>So(e.id)}:e,Zr=[{id:"add",label:"Add",icon:/* @__PURE__ */Ke("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:rt,onSelect:()=>rt?rr():tr(null)},...(wt.railLead??[]).map(Xr),{id:"sections",label:"Layers",icon:/* @__PURE__ */Ke(Re,{}),active:Mn&&!Qr&&"sections"===Ct,onSelect:()=>So("sections")},...(wt.railTrail??[]).map(Xr)];Un?Zr.push({id:"media",label:"Media library",icon:/* @__PURE__ */Ke(Le,{}),active:Mn&&!rt&&(null!==Wn||"media"===Ct),onSelect:()=>So("media")}):fn&&Zr.push({id:"media",label:"Media library",icon:/* @__PURE__ */Ke(Le,{}),onSelect:bo});const Kr=[...wt.railLead??[],...wt.railTrail??[]].find(e=>"panel"in e&&e.id===Ct);return(wt.wrap??(e=>e))(
|
|
26
|
+
/* @__PURE__ */_e("div",{ref:nt,className:"sf-editor es-editor",style:ze(Gt),onContextMenu:Jo.onEditorContextMenu,children:[
|
|
27
|
+
/* @__PURE__ */_e(he,{children:[
|
|
28
|
+
/* @__PURE__ */Ke(me,{items:Zr,ariaLabel:"Left panel views"}),
|
|
29
|
+
/* @__PURE__ */_e(ye,{children:[
|
|
30
|
+
/* @__PURE__ */Ke(ge,{label:"Undo",disabled:!kn.hasPast,onClick:()=>kn.back(),children:/* @__PURE__ */Ke(Ie,{})}),
|
|
31
|
+
/* @__PURE__ */Ke(ge,{label:"Redo",disabled:!kn.hasFuture,onClick:()=>kn.forward(),children:/* @__PURE__ */Ke(Me,{})}),
|
|
32
|
+
/* @__PURE__ */Ke(ke,{}),
|
|
33
|
+
/* @__PURE__ */Ke(Se,{devices:Ln,value:Vn,onChange:Jn})]}),
|
|
34
|
+
/* @__PURE__ */_e(ye,{kind:"right",style:{minWidth:300},children:[
|
|
35
|
+
/* @__PURE__ */Ke(en,{saveState:rn,notSaving:Boolean(cn)||null!=ln,readOnlyReason:an,toggle:pn,onToggle:dn,onRetry:sn}),wt.barLead?.(),
|
|
36
|
+
/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{et.current=(()=>{const e=tt?.document;if(!e)return null;const n=wo.findIndex(e=>e.type===wn),t=n>=0?n:wo.length;let o=null;for(let n=0;n<t;n++){const t=wo[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=Sn?.props?.id??wo[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),qn(e=>e+1)},children:"Refresh"}),wt.barTrail?.(),wt.barMain?wt.barMain():/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-primary",disabled:null!==an,onClick:()=>{on(yn.data)},children:un?"Publish":"Save"})]})]}),
|
|
37
|
+
/* @__PURE__ */Ke($,{}),
|
|
38
|
+
/* @__PURE__ */_e("div",{className:"sf-body",children:[Mn?/* @__PURE__ */_e(qe,{children:[
|
|
39
|
+
/* @__PURE__ */Ke("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:rt?/* @__PURE__ */Ke(D,{blocks:dt&&dt.zone!==B&&!Rr(dt.zone)?Mr(dt.zone):Yr,blocksOnly:Boolean(dt&&dt.zone!==B&&!Rr(dt.zone)),at:dt?{label:(e=>{const n=Rr(e.zone);if(n)return`Adding to ${No(n.type)}`;if(e.zone===B){const n=wo[e.index];return n&&n.type!==wn?`Adding before ${Oo(n.type)}`:"Adding at the end of the page"}const t=Mr(e.zone);return t?`Adding to ${t.parentName}`:"Adding here"})(dt),onClear:()=>ct(null)}:void 0,onAdd:e=>{if(dt&&"block"!==e.kind&&Rr(dt.zone))return ir(e,dt.zone,dt.index),void ct({zone:dt.zone,index:dt.index+1});if("section"===e.kind)return(e=>{if(null===at)return void er(e);const n=er(e,at);pt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===at)return void nr(e,n);const t=nr(e,n,at);pt(t+1)})(e.template.name,d(e.template.node));if(dt&&dt.zone!==B){const n=Mr(dt.zone);if(!n)return;return n.target.spec?Sr(n.parentId,n.target.slot,e.type,dt.index,n.parent.type):br(dt.zone,e.type,dt.index),void ct({zone:dt.zone,index:dt.index+1})}Yr?.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:Dr,siteWide:wt.addPanelRow?.(rr),onClose:rr,onHide:go,readOnly:Boolean(cn)}):Wn&&Gn?
|
|
40
|
+
/* @__PURE__ */Ke(V,{panel:Gn,pick:Wn,onHide:go}):Kr?Kr.panel({onHide:go,notify:ro}):"media"===Ct&&Gn?/* @__PURE__ */Ke(V,{panel:Gn,pick:null,onHide:go}):/* @__PURE__ */_e(qe,{children:[
|
|
41
|
+
/* @__PURE__ */Ke(F,{icon:/* @__PURE__ */Ke(Re,{}),title:"Layers",context:`/${Be}`,actions:Ar.length>0?/* @__PURE__ */Ke(be,{label:Or?"Expand all sections":"Collapse all sections",onClick:()=>Jt(e=>{const n=new Set(Ar);return Or?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ar])}),children:/* @__PURE__ */Ke(nn,{expand:Or})}):void 0,onHide:go}),
|
|
42
|
+
/* @__PURE__ */_e(ie,{className:"sf-tree sf-scroll",children:[
|
|
43
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"page",size:13}),name:"Page settings",onSelect:xo,selected:!Sn&&yt,rowProps:{onClick:lr(xo)}}),Cr&&/* @__PURE__ */_e(qe,{children:[
|
|
44
|
+
/* @__PURE__ */Ke(se,{children:"Header"}),Gr(Cr)]}),!zt&&mn&&/* @__PURE__ */_e(qe,{children:[
|
|
45
|
+
/* @__PURE__ */Ke(se,{children:"Header"}),
|
|
46
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"header",size:13}),name:"Header",onSelect:vo,selected:ht.kind===On?.kind,rowProps:{onClick:lr(vo)}})]}),!zt&&/* @__PURE__ */_e(se,{children:["Template · ",hn?"Home page":"Template"]}),wo.map((e,n)=>{if(e.type===vn||e.type===wn||Bn(e.type))return null;const t=gt===String(e.props.id),o=Boolean(e.props._hidden);fr(e);const r=String(e.props.id),i=wt.hasOwnRows?.(e)??!1,l=yr(e)||i,s=l&&Xt(r),{rowProps:d,...c}=Fr.row({item:{id:r,zone:B,index:n,type:e.type},place:{...Ve(B),index:n}},{"data-node-id":r,onClick:lr(()=>Zo(n))});/* @__PURE__ */
|
|
47
|
+
return _e(Ze,{children:[n>0&&ar(n),
|
|
48
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:e.type,size:13}),name:To(e),onSelect:()=>Zo(n),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Zt(r)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(B,n,To(e)),cr(B,n,e,To(e))]}),rowProps:d}),yr(e)&&!s&&/* @__PURE__ */_e(de,{children:[Wr(e,1),wt.partRows?.(e,Jr)]}),i&&!s&&/* @__PURE__ */Ke(de,{children:wt.ownRows?.(e,n,Jr)})]},String(e.props.id??n))}),!zt&&Nr>0&&ar(Nr),mn&&/* @__PURE__ */Ke(se,{children:"Footer"}),zr&&(()=>{const e=String(zr.props.id),n=fr(zr).length>0||Boolean(Tt(zr.type)),t=n&&Xt(e);/* @__PURE__ */
|
|
49
|
+
return _e(qe,{children:[
|
|
50
|
+
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"footer",size:13}),name:"Footer",onSelect:()=>Zo(wr),selected:gt===String(zr.props.id),fold:n?{open:!t,label:"section",onToggle:()=>Zt(e)}:void 0,rowProps:{onClick:lr(()=>Zo(wr))}}),n&&!t&&/* @__PURE__ */Ke(de,{children:Ur(zr,1)})]})})(),!zt&&!zr&&mn&&/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"footer",size:13}),name:"Footer",onSelect:sr,rowProps:{onClick:lr(sr),title:"Edit the site footer"}}),Br&&Gr(Br),wt.treeFoot?.()]})]})}),
|
|
51
|
+
/* @__PURE__ */Ke(xe,{side:"left",width:Gt.left,min:we,max:ve,defaultWidth:S.left,label:"Resize Sections panel",onResize:Yt})]}):/* @__PURE__ */Ke(H,{side:"left",onShow:go}),
|
|
52
|
+
/* @__PURE__ */Ke("div",{ref:io,className:"sf-center sf-scroll",style:{overflowX:ho?"auto":"hidden",overflowY:"hidden"},children:/* @__PURE__ */Ke("div",{className:"sf-frame-scaler",style:mo,children:/* @__PURE__ */Ke("div",{className:"sf-frame "+(Vn===Hn?"":`sf-frame--${Vn}`),style:yo,children:/* @__PURE__ */_e("div",{className:"sf-preview-host",children:[
|
|
53
|
+
/* @__PURE__ */Ke(Tn,{},_n),
|
|
54
|
+
/* @__PURE__ */Ke(Ne,{canvas:tt,session:Dr,model:Hr,canDrop:Ir,onDrop:Lr,onPick:e=>{mt(_),Rn.select(e.zone===B?{index:e.index}:{index:e.index,zone:e.zone})},onZoneAdd:e=>or(He(e),0),readOnly:Boolean(cn),revision:yn.data}),ut.length>0&&/* @__PURE__ */Ke("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ut.map(e=>/* @__PURE__ */_e("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>tr(e.index),children:[
|
|
55
|
+
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-line"}),
|
|
56
|
+
/* @__PURE__ */_e("span",{className:"sf-preview-gap-pill",children:[
|
|
57
|
+
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
58
|
+
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})}),En?/* @__PURE__ */_e(qe,{children:[
|
|
59
|
+
/* @__PURE__ */Ke(g,{value:{selectChild:kr,addChild:Sr,childRowName:Mo,blockRowName:Tr},children:/* @__PURE__ */Ke(Pn,{mode:ht,onOpenWebsiteSettings:wt.openSettings??(()=>{}),onOpenSiteStyles:wt.openStyles,onSelectNode:Et,onNotify:ro,onHidePanel:ko})}),
|
|
60
|
+
/* @__PURE__ */Ke(xe,{side:"right",width:Gt.right,min:we,max:ve,defaultWidth:S.right,label:"Resize settings panel",onResize:Qt})]}):
|
|
61
|
+
/* @__PURE__ */Ke(H,{side:"right",onShow:ko})]}),qt&&/* @__PURE__ */_e("div",{className:"sf-toast "+("error"===qt.tone?"sf-toast--error":""),role:"status",children:[
|
|
62
|
+
/* @__PURE__ */Ke("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===qt.tone?"!":"✓"}),qt.msg]},no),Jo.menu]}))}export{tn as ScreenChrome};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-YJXEHK6I.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-ZWK3CBRU.js";import{EditNotice as r}from"./chunk-6DJHRLCU.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEaselHost as t}from"./chunk-R5ZVNJLJ.js";import{ScreenPartsProvider as r}from"./chunk-
|
|
1
|
+
import{useEaselHost as t}from"./chunk-R5ZVNJLJ.js";import{ScreenPartsProvider as r}from"./chunk-NBJ2YY6Y.js";import{createEasel as e,EaselProvider as n}from"./chunk-P67FP7PG.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=t();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(r,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{EaselCanvas as n,useSelectedFields as e}from"./chunk-P67FP7PG.js";import{Inspector as t}from"./chunk-BXZ6WLHC.js";import{DesktopIcon as r}from"./chunk-L5KW4HG5.js";import{createContext as o,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";var l={kind:"puck"};function s(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]))}var c={},a=()=>c,d=()=>"",f=()=>{},p={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},k={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},h={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */u(r,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},m={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},v={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function b(){/* @__PURE__ */
|
|
2
2
|
return u(n,{height:"fill"})}function g(){const{id:n,fields:r,values:o,readOnly:i,onChange:l}=e();/* @__PURE__ */
|
|
3
3
|
return u("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */u(t,{fields:r,values:o,onChange:l,readOnly:i,idPrefix:n})})}var O=o({});function j({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return u(O.Provider,{value:n,children:e})}function
|
|
4
|
+
return u(O.Provider,{value:n,children:e})}function w(){return i(O)}function y(){return(w().useOwnerName??d)()}function P(n,e,t,r){return(w().useBridges??a)(n,e,t,r)}function G(n){return(w().useStandaloneBridges??a)(n)}function L(n,e){(w().useDocumentPass??f)(n,e)}function S(){return w().blockRules??p}function B(){return w().blockLook??k}function x(){return w().devices??h}function C(){return w().leftView??m}function N(){return w().pinned??v}function D(){return w().saveSwitch??!0}function I(){return w().Canvas??b}function T(){return w().Inspector??g}export{l as SELECTION_MODE,j as ScreenPartsProvider,s as sameInspectorMode,B as useScreenBlockLook,S as useScreenBlockRules,P as useScreenBridges,I as useScreenCanvasFrame,x as useScreenDevices,L as useScreenDocumentPass,T as useScreenInspectorPanel,C as useScreenLeftView,y as useScreenOwnerName,w as useScreenParts,N as useScreenPinned,D as useScreenSaveSwitch,G as useStandaloneScreenBridges};
|
|
@@ -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 r}from"./chunk-GENAF3P6.js";import{sectionTemplates as s}from"./chunk-4MXFKJUY.js";import{SidePanelHead as i,PanelModeExit as c}from"./chunk-IWAPPEL4.js";import{useEaselSession as l}from"./chunk-6TZTKAB5.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as d}from"./chunk-NBJ2YY6Y.js";import{useEasel as m}from"./chunk-P67FP7PG.js";import{AddPanel as u}from"./chunk-TTJ54QGG.js";import{AddIcon as f}from"./chunk-L5KW4HG5.js";import{useState as h,useEffect as k,useMemo as y}from"react";import{jsx as b,jsxs as g,Fragment as j}from"react/jsx-runtime";var $=e=>`section:${e}`,A=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:L,at:O,onAdd:P,itemFor:Y,session:B,siteWide:F,onClose:G,onHide:S,readOnly:T}){const x=m(e=>e.config),C=p(),{labelAtLevel:H,categoryLabel:K,firstSection:N,Icon:D,Thumbnail:E}=C,{blockIsOffered:J}=d(),W=l(),[w,z]=h([]);k(()=>{let t=!1;const o=e=>J(e,W);return s.list().then(n=>{if(t)return;const r=x.components;z(n.filter(t=>t.node?.type&&r[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[x,W]);const Q=y(()=>t(x,C),[x]),V=e=>({type:$(e.type),label:e.name,cover:/* @__PURE__ */b(E,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:`Add ${e.name}`,keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),Z=y(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({title:0===o?`Inside ${I.parentName}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:A(e.type),label:e.label,icon:/* @__PURE__ */b(D,{type:e.type,size:18}),title:`Add ${e.label}`}))})}),L)return e;const t=o(Q,N);t&&e.push({title:"Start blank",tiles:[V(t)]}),w.length>0&&e.push({title:"Your templates",tiles:w.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */b(E,{type:e.node.type}),keywords:[(t=e.node.type,H(t,"section",x.components[t]?.label??t)),e.node.type]};var t})});const s=n(Q,N);for(const t of Object.keys(x.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({title:r(x,t,K),tiles:o.map(V)})}return e},[I,L,w,Q,x]),M=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=w.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return g(j,{children:[
|
|
3
|
+
/* @__PURE__ */b(i,{icon:/* @__PURE__ */b(f,{size:15}),title:"Add",context:L?"Blocks for this place":"Sections and blocks",actions:/* @__PURE__ */b(c,{label:"Done",description:"Close Add and go back",onClick:G}),onHide:S}),
|
|
4
|
+
/* @__PURE__ */g("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */b(u,{groups:Z,session:B,itemFor:e=>Y(M(e)??{kind:"section",type:e}),onInsert:e=>{const t=M(e);t&&P(t)},at:O,hint:L?"Drag into the page, or click to add.":"Drag onto the page, or click to add.",searchLabel:L?"Search blocks":"Search sections",readOnly:T}),F&&!L?F:null]})]})}export{I as AddSidePanel,A as blockKey,$ as sectionKey,v as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as e}from"./chunk-PWZOS45R.js";import{BUCKET_KEY as n}from"./chunk-R2HLPNQF.js";import{ANCHOR_FIELD_KEYS as r,foldMetaOf as s,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as c,LINK_FIELD_MARKER as p}from"./chunk-DUVRZ456.js";import{STYLE_KIND as u,fieldKind as f,copyStyle as a,heldStyle as l,planPaste as m,pasteMessage as h}from"./chunk-57DJOKXT.js";var y=/* @__PURE__ */new Set([n.Style,n.Layout]),j=new Set(Object.values(n)),b=new Set(r),S=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,c,p];function w(t){return`site:${t??""}`}function g(t){if(!t||"object"!=typeof t)return null;const e=t,n=o(t)??t,r=e[u]??n[u];if("string"==typeof r)return r;const s=e.options??n.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(n)}function L(t){const e=t,n=o(t);return k.some(t=>t in e||n&&t in n)}function O(o,n){const r=t(o,n)??{},i=[];let c=!1;for(const[t,o]of Object.entries(r))j.has(t)?c=y.has(t):c&&o&&"object"==typeof o&&!t.startsWith("_")&&(s(o)||b.has(t)||S.has(t)||L(o)||"slot"!==o.type&&i.push({path:[t],kind:g(o),counted:"mobile"!==e(o)?.tier}));return i}function v(t,o,e,n){a({scope:o,type:e.type,label:n,rows:O(t,e),props:e.props})}function P(t,o,e,n){const r=l(o);if(!r)return null;const s=m(r,{type:e.type,rows:O(t,e),props:e.props});return{...s,message:h(s,r.sourceLabel,n)}}export{v as copyNodeStyle,O as nodeStyleRows,P as planNodePaste,g as shopFieldKind,w as siteStyleScope};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-7MU3RJ6S.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-A7ZJII7O.js";import{pageEditLock as t}from"./chunk-AKZWUV5Z.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-OYX47SL7.js";import{isExpiredSession as s}from"./chunk-HMX55DYT.js";import{useAdminBridge as i}from"./chunk-Q3SQBNJB.js";import{useEaselHost as c}from"./chunk-R5ZVNJLJ.js";import{useEaselSession as l}from"./chunk-6TZTKAB5.js";import{backendOf as d,setSessionDocumentSite as f}from"./chunk-AJBJ74ME.js";import{DEFAULT_SCREEN_WORDS as g}from"./chunk-ZWK3CBRU.js";import{useAutosave as k}from"./chunk-BDTITTMW.js";import{canWriteDocument as m,newEaselClientId as v,reloadIfVersionMoved as p,holderOf as h}from"./chunk-JUQ6YJCG.js";import{useWords as y}from"./chunk-MFIRYGHW.js";import{createContext as w,useContext as S,useState as b,useMemo as I,useCallback as j,useEffect as P,useRef as B}from"react";import{jsx as A}from"react/jsx-runtime";var R={content:[],root:{},zones:{}};var E=w(null);function T(){const e=S(E);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function C({target:w,addressing:S=o,onHostMessage:T,children:C}){const M=S,{homeSlug:O,entryMayBounce:H,entryBounce:J,onSwitch:D,tellsHost:L,adapterFor:N,migrateRenamedProps:F,describeMissing:U,onLoadFailed:V}=M,[W,Z]=b(w),Y=c(),K=l(),x=I(()=>d(K),[K]),Q="template"===W.kind,X="template"===W.kind?W.id:null,G="template"===W.kind?W.pageSlug??O??"":"document"===W.kind?W.slug??"":W.slug,z="page"===W.kind?W.siteId??null:null,_=K.blocks,q=I(()=>N(W,x,_),[N,x,_,W.kind,"template"===W.kind?W.id:"document"===W.kind?W.record:W.siteId]),$=q.capabilities,ee=j(e=>K.documentHooks?.stored?.(e)??e,[K]),re="page"===W.kind?W.originSlug??null:null;P(()=>{f(K,z)},[K,z]);const ne=B(W);P(()=>{ne.current=W},[W]);const{token:te,tokenRef:oe,capabilities:ue}=i({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&wr(e.target)}}}),ae=!K.usesBridgedToken||null!==te,se=q.lock,ie=Boolean(x.lock),[ce,le]=b(null),[de,fe]=b(null),[ge,ke]=b(null),[me,ve]=b(null),pe=y("screen",g),he=me?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(me,pe):null,[ye,we]=b(null),Se=B(null),be=B(null),[Ie,je]=b(!1),Pe=B(null),[Be,Ae]=b(null),Re=B(null),[Ee,Te]=b(null),Ce=B(null);P(()=>{Ce.current=Ee},[Ee]);const[Me,Oe]=b($.hasEditLock?{kind:"checking"}:{kind:"editing"}),He=B(Me);P(()=>{He.current=Me},[Me]);const Je=B(()=>Promise.resolve(!1)),De=j(e=>{be.current=e,je(!0)},[]),Le=k({save:async({id:e,data:r})=>{if(m(He.current)){if(!await Je.current(e,r)){if(!m(He.current))return void De({id:e,data:r});throw new Error("page save did not land")}}else De({id:e,data:r})},onFailure:(e,r)=>{0===r&&Y.send("storefront-editor:save-failed")}}),{state:Ne,push:Fe,flush:Ue,pause:Ve,resume:We,stop:Ze,reset:Ye,retryNow:Ke,hasPending:xe}=Le,Qe=B(Ne);P(()=>{Qe.current=Ne},[Ne]);const Xe=u(Ne),Ge=j(()=>{const e=be.current;e&&(be.current=null,je(!1),Fe(e))},[Fe]),ze=B("");ze.current||(ze.current=v());const[_e,qe]=b(0),$e=B(!1),[er,rr]=b(H(w)),nr=B(!1);P(()=>{if(nr.current)return;nr.current=!0;const e=Y.address.search(),r=J(w,e);r?Y.address.load(r):H(w)&&rr(!1)},[w,Y]);const tr=Y.send;P(()=>{if(!ae)return;let e=!1;const t=ne.current,o=q.resolve(G),u=K.documentHooks?.opening?.({slug:G,isTemplate:Q,capabilities:$});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==O&&G!==O?void Y.address.load({kind:"page",slug:O,siteId:z??void 0}):(ve({target:t,slug:G,missing:!0,sentence:U?.(t)??null}),void V?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Se.current=n,we(n),le(r.id),fe(r.kind??null),Re.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:R,s=F(a),i=u?await u(s):s;e||ke(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),ve({target:t,slug:G,missing:!1,sentence:n(o,{slug:G}),cause:r(o)}),V?.(t,o))}),()=>{e=!0}},[ae,te,Q,q,G]);const or=j(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=oe.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),ur=j(async e=>{const r=oe.current;if(!r&&K.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n)){tr("storefront-editor:auth-expired");const n=r?await or(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[tr,or,K]),ar=j(async e=>{const r=oe.current?await ur(e):{ok:!1};return r.ok||tr("storefront-editor:save-failed"),r.ok},[tr,ur]),sr=j(async(e,r,n=!1)=>{if(null!==Se.current)return!1;if(!m(He.current))return!1;if(Ce.current)return!1;const o=await ur(()=>q.saveLayout(e,r,Re.current,ze.current));if(o.ok)return Re.current=o.value.version??Re.current,!0;const u=t.readLockTaken(o.error);if(u){const e={kind:"takenover",holder:u};return He.current=e,Oe(e),!1}const a=t.readSaveConflict(o.error);if(a){if(a.savedByYou&&!n&&q.rereadVersion){const n=await ur(()=>q.rereadVersion(e));if(n.ok&&n.value)return Re.current=n.value,Je.current(e,r,!0)}Ze(),Ce.current=a,Te(a)}return!1},[q,ur,Ze]);P(()=>{Je.current=sr},[sr]);const ir=j(e=>{if(null!==Se.current)return;if(tr("storefront-editor:dirty"),!ce)return;const r=ee(e);Pe.current=r,m(He.current)?Fe({id:ce,data:r}):De({id:ce,data:r})},[ce,tr,De,Fe,ee]),cr=j(async()=>{m(He.current)&&Ge();return await Ue()&&null==be.current},[Ge,Ue]),lr=B(cr);P(()=>{lr.current=cr},[cr]);const dr=B(ur);P(()=>{dr.current=ur},[ur]);const fr=j(()=>{Y.address.reload()},[Y]),gr=B(()=>Promise.resolve(!1));P(()=>{gr.current=()=>{const e=q.rereadVersion;return ce&&e?p({ours:Re.current,stored:async()=>{const r=await dr.current(()=>e(ce));return r.ok?r.value:null},hasPending:()=>null!=be.current||xe(),reload:fr}):Promise.resolve(!1)}},[q,ce,xe,fr]);const kr=null!==ye;P(()=>{if(!se||!ce||!ae||kr)return;let e=!1,r=null;const n=ze.current,o=t.makeClaimBeat({claim:async e=>{const r=await dr.current(()=>se.claim(ce,n,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>He.current,heldWrite:()=>({pending:null!=be.current||xe(),autoSaveEnabled:!Qe.current.paused,saveConflict:null!=Ce.current}),setAccess:e=>{He.current=e,Oe(e)},releaseHeldWrite:()=>{lr.current()},startHeartbeat:e=>{r=setInterval(()=>{o(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{gr.current()}}),u=$e.current;return $e.current=!1,u||Oe({kind:"checking"}),o(u),()=>{e=!0,r&&clearInterval(r),se.release(ce,n).catch(()=>{})}},[ce,se,ae,te,_e,kr]);const mr=j(()=>{se&&ce&&($e.current=!0,qe(e=>e+1))},[ce,se]),vr=j(()=>{Oe(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),pr=j(()=>{Qe.current.paused?(m(He.current)&&Ge(),We()):Ve()},[Ge,Ve,We]),hr=j(()=>{Ke()},[Ke]),yr=j(e=>{Pe.current=null,a("template"!==e.kind&&ie,{resetAutosave:()=>{Ye(),be.current=null,je(!1)},setVersion:e=>{Re.current=e},setSaveConflict:Te,setAccess:Oe}),D(e),Z(e),Se.current=null,we(null),le(null),fe(null),ke(null),ve(null),Y.address.show(e),"document"!==e.kind&&L(e)&&Y.send("storefront-editor:navigated",{target:e})},[Ye,Y,ie,D,L]),wr=j(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ne.current,O))return;const r=null!=be.current;if(!r&&!xe())return void yr(e);const n=Qe.current;r||n.paused||n.failed||n.stopped?Ae(e):Ue().then(r=>{r?yr(e):Ae(e)})},[yr,xe,Ue,O]),Sr=j(()=>Ae(null),[]),br=j(()=>{Ae(e=>(e&&yr(e),null))},[yr]),Ir=j(async()=>{const e=Be;if(!e)return;await cr()&&(Ae(null),yr(e))},[Be,cr,yr]),jr=j(async e=>{if(null!==Se.current)return;if(!ce)return;if(!m(He.current)||Ce.current)return;const r=ee(e);if(!await sr(ce,r))return void(Ce.current||tr("storefront-editor:save-failed"));const n=q.publish;if(!$.canPublish||!n)return void tr("storefront-editor:saved");const t=await ur(()=>n(ce,Re.current??void 0));t.ok?(Re.current=t.value.version??Re.current,tr("storefront-editor:published")):tr("storefront-editor:save-failed")},[ce,q,$.canPublish,tr,sr,ur,ee]);/* @__PURE__ */
|
|
2
|
+
return A(E.Provider,{value:{target:W,adapter:q,capabilities:$,templateId:X,currentSlug:G,currentKind:de,siteId:z,ready:ae,token:te,tokenRef:oe,notifyParent:tr,bridgeCapabilities:ue,runAuthed:ar,docId:ce,data:ge,getLiveData:()=>Pe.current??ge,footerOriginSlug:re,error:he,redirecting:er,saveStatus:Xe,saveState:Ne,autoSaveEnabled:!Ne.paused,autoSaveStoppedByConflict:Ne.stopped,hasUnsavedEdits:Ne.pending||Ie,toggleAutoSave:pr,retrySave:hr,onChange:ir,flushSave:cr,onPublish:jr,access:Me,readOnly:null!==h(Me)||null!==ye,readOnlyReason:ye,takeOverEditing:mr,viewReadOnly:vr,saveConflict:Ee,reloadFromServer:fr,navigate:wr,pendingNav:Be,cancelPendingNav:Sr,discardAndNavigate:br,saveAndNavigate:Ir},children:C})}export{E as ScreenDocumentContext,C as ScreenDocumentProvider,T as useScreenDocument};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{clientOnly as e}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-MSBF7IW3.js";import{ScreenChrome as r}from"./chunk-HDKTR5TZ.js";import{ScreenDocumentProvider as t,useScreenDocument as a}from"./chunk-YJXEHK6I.js";import{DEFAULT_SCREEN_WORDS as i}from"./chunk-ZWK3CBRU.js";import{documentPermissions as s}from"./chunk-JUQ6YJCG.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{useMemo as d}from"react";import{jsx as c,jsxs as l,Fragment as m}from"react/jsx-runtime";var g=e(n),h=e(r);function p({saving:e,onCancel:n,onDiscard:r,onSave:t}){/* @__PURE__ */
|
|
2
|
+
return c("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/30 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"sf-leave-title",children:/* @__PURE__ */l("div",{className:"w-full max-w-sm rounded-lg bg-white p-5 shadow-xl",children:[
|
|
3
|
+
/* @__PURE__ */c("h2",{id:"sf-leave-title",className:"text-[15px] font-semibold text-zinc-900",children:"Unsaved changes"}),
|
|
4
|
+
/* @__PURE__ */c("p",{className:"mt-2 text-[13px] leading-relaxed text-zinc-600",children:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them."}),
|
|
5
|
+
/* @__PURE__ */l("div",{className:"mt-4 flex justify-end gap-2",children:[
|
|
6
|
+
/* @__PURE__ */c("button",{type:"button",onClick:n,className:"rounded-md border border-zinc-300 px-3 py-[7px] text-[13px] font-medium text-zinc-700 transition-colors hover:bg-zinc-100",children:"Cancel"}),
|
|
7
|
+
/* @__PURE__ */c("button",{type:"button",onClick:r,className:"rounded-md border border-red-200 px-3 py-[7px] text-[13px] font-medium text-red-600 transition-colors hover:bg-red-50",children:"Discard & leave"}),
|
|
8
|
+
/* @__PURE__ */c("button",{type:"button",onClick:t,disabled:e,className:"rounded-md bg-blue-600 px-3 py-[7px] text-[13px] font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-60",children:e?"Saving…":"Save & leave"})]})]})})}function u({target:e,addressing:n,onHostMessage:r,children:a}){/* @__PURE__ */
|
|
9
|
+
return c(t,{target:e,addressing:n,onHostMessage:r,children:a})}var v=(e,n)=>/* @__PURE__ */l(m,{children:[e,n]});function f({config:e,parts:n,wrap:r=v}){const{data:t,error:l,redirecting:m,ready:u,saveStatus:f,readOnly:x,onChange:b,pendingNav:N,cancelPendingNav:y,discardAndNavigate:k,saveAndNavigate:C}=a(),j=d(()=>s(!x),[x]),w=o("screen",i);return m?/* @__PURE__ */c("div",{className:"sf-msg",children:w.loading}):l?/* @__PURE__ */c("div",{className:"sf-msg sf-msg--error",children:l}):u?t?r(
|
|
10
|
+
/* @__PURE__ */c(g,{config:e,data:t,onChange:b,permissions:j,parts:n,children:/* @__PURE__ */c(h,{})}),N&&/* @__PURE__ */c(p,{saving:"saving"===f,onCancel:y,onDiscard:k,onSave:()=>{C()}})):/* @__PURE__ */c("div",{className:"sf-msg",children:w.loading}):/* @__PURE__ */c("div",{className:"sf-msg",children:w.waitingForAuthorization})}export{f as DocumentScreen,u as ScreenMount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:o})=>`No storefront page with slug "${o}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:o})=>`Could not load the document — ${o}`,noun:"page"};export{o as DEFAULT_SCREEN_WORDS};
|
|
@@ -34,9 +34,16 @@ import { A as AutosaveSnapshot } from './engine-DBxp_v6B.js';
|
|
|
34
34
|
* these rules among the dependencies of what it memoises, the adapter first:
|
|
35
35
|
* rules built anew on a render would build a new adapter on it, and a new
|
|
36
36
|
* adapter opens the document again.
|
|
37
|
+
*
|
|
38
|
+
* FOR ONE KIND OF TARGET (0.103.0). A layer's rules answer for the targets it
|
|
39
|
+
* names: a website's for its pages and templates (`ScreenTarget`, the default,
|
|
40
|
+
* so the website's rules are typed as they always were), a host's own for its
|
|
41
|
+
* documents (`DocumentAddressing<DocumentTarget>`). The rules are asked about
|
|
42
|
+
* a target and never hand one of their own kind back, except where the editor
|
|
43
|
+
* goes instead of where it was loaded (`entryBounce`), which may be any.
|
|
37
44
|
*/
|
|
38
45
|
|
|
39
|
-
interface DocumentAddressing {
|
|
46
|
+
interface DocumentAddressing<T extends AnyScreenTarget = ScreenTarget> {
|
|
40
47
|
/**
|
|
41
48
|
* The slug of the HOME document: the one a target stands for when it names
|
|
42
49
|
* no document within its record, and the one an editor falls back to when
|
|
@@ -52,14 +59,14 @@ interface DocumentAddressing {
|
|
|
52
59
|
* document, until `entryBounce` has said where the editor goes — or that it
|
|
53
60
|
* stays after all.
|
|
54
61
|
*/
|
|
55
|
-
entryMayBounce: (target:
|
|
62
|
+
entryMayBounce: (target: T) => boolean;
|
|
56
63
|
/**
|
|
57
64
|
* Where an editor loaded on `target` goes INSTEAD: the target the host's
|
|
58
65
|
* address is then loaded on, or null and it stays. Asked once per mount, of
|
|
59
66
|
* the target it started on, with the query of the host's address. A switch
|
|
60
67
|
* made in place loads nothing, so it is never asked.
|
|
61
68
|
*/
|
|
62
|
-
entryBounce: (target:
|
|
69
|
+
entryBounce: (target: T, search: string) => AnyScreenTarget | null;
|
|
63
70
|
/**
|
|
64
71
|
* A switch of document, in place, is going ahead and `next` is where it
|
|
65
72
|
* goes: whatever the layer keeps of its own that depends on where the
|
|
@@ -67,13 +74,13 @@ interface DocumentAddressing {
|
|
|
67
74
|
* belonged to the document being left has been cleared and before the
|
|
68
75
|
* provider moves to the new one.
|
|
69
76
|
*/
|
|
70
|
-
onSwitch: (next:
|
|
77
|
+
onSwitch: (next: T) => void;
|
|
71
78
|
/**
|
|
72
79
|
* Is the host told that the editor moved to `next`? The host remembers the
|
|
73
80
|
* last target it was told, and reopens the editor there on a reload — so a
|
|
74
81
|
* target the editor must not be reopened on is one the host is not told.
|
|
75
82
|
*/
|
|
76
|
-
tellsHost: (next:
|
|
83
|
+
tellsHost: (next: T) => boolean;
|
|
77
84
|
/**
|
|
78
85
|
* What stores the document `target` names: its adapter, over the backend in
|
|
79
86
|
* force and the sets of blocks the host offers (both the session's, and the
|
|
@@ -84,7 +91,7 @@ interface DocumentAddressing {
|
|
|
84
91
|
* `SessionBackend`): the layer that handed the session its backend knows its
|
|
85
92
|
* own type, and the provider names none.
|
|
86
93
|
*/
|
|
87
|
-
adapterFor: (target:
|
|
94
|
+
adapterFor: (target: T, backend: SessionBackend, blocks: SessionBlocks | null) => EaselDocumentAdapter;
|
|
88
95
|
/**
|
|
89
96
|
* Carry the stored answer of every prop the layer has RENAMED to its new
|
|
90
97
|
* key, in a layout as it was stored and before the canvas reads it. The
|
|
@@ -92,16 +99,44 @@ interface DocumentAddressing {
|
|
|
92
99
|
* left under an old key would be shown as the default and then saved as it.
|
|
93
100
|
* Answers with the same object when it carried nothing.
|
|
94
101
|
*/
|
|
95
|
-
migrateRenamedProps: <
|
|
102
|
+
migrateRenamedProps: <D>(data: D) => D;
|
|
103
|
+
/**
|
|
104
|
+
* The sentence the editor shows for a document that is NOT THERE (the
|
|
105
|
+
* adapter resolved `target` to null, and there was no Home to fall back to):
|
|
106
|
+
* the layer's words for its own kind of document — "Couldn't open this
|
|
107
|
+
* campaign." Asked once, when it is found missing. Absent, the screen says
|
|
108
|
+
* its own (`EaselStrings.screen`: `missingPage`, `missingTemplatePage`,
|
|
109
|
+
* `missingDocument`), the website's sentences among them.
|
|
110
|
+
*/
|
|
111
|
+
describeMissing?: (target: T) => string;
|
|
112
|
+
/**
|
|
113
|
+
* The document `target` names did not open, and the editor shows why
|
|
114
|
+
* instead of it. `err` is what the load was refused with, or `null` when the
|
|
115
|
+
* backend said there is no such document (and there was no Home to fall back
|
|
116
|
+
* to). Called once per failed load, after the sentence is chosen — for a
|
|
117
|
+
* layer that has bookkeeping of its own to let go of (the campaign designer's
|
|
118
|
+
* window forgets the campaign it would reopen). Absent, nobody is told.
|
|
119
|
+
*/
|
|
120
|
+
onLoadFailed?: (target: T, err: unknown) => void;
|
|
96
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* The rules a provider may be handed: a website's, for its pages and
|
|
124
|
+
* templates, or a host's own, for its documents. Whichever it is handed it
|
|
125
|
+
* asks of every target it opens, so a layer hands the rules of the kind of
|
|
126
|
+
* target it mounts the editor on.
|
|
127
|
+
*/
|
|
128
|
+
type AnyDocumentAddressing = DocumentAddressing<ScreenTarget> | DocumentAddressing<DocumentTarget>;
|
|
97
129
|
/**
|
|
98
130
|
* With no layer: there is no home, so nothing is fallen back to; an editor
|
|
99
131
|
* stays on whatever target it is loaded on; a switch of document has nothing
|
|
100
132
|
* of a layer's to bring up to date, and the host is told of every one; the
|
|
101
133
|
* document is the one nothing stores; and a stored layout is read as it was
|
|
102
|
-
* stored, there being no layer to have renamed a prop.
|
|
134
|
+
* stored, there being no layer to have renamed a prop. It answers for every
|
|
135
|
+
* kind of target, so it stands in for the rules of either. It describes no
|
|
136
|
+
* missing document of its own (the screen says its words) and tells nobody of
|
|
137
|
+
* one that would not open.
|
|
103
138
|
*/
|
|
104
|
-
declare const NO_DOCUMENT_ADDRESSING: DocumentAddressing
|
|
139
|
+
declare const NO_DOCUMENT_ADDRESSING: DocumentAddressing<AnyScreenTarget>;
|
|
105
140
|
|
|
106
141
|
type ScreenTarget = {
|
|
107
142
|
kind: "page";
|
|
@@ -113,10 +148,34 @@ type ScreenTarget = {
|
|
|
113
148
|
id: string;
|
|
114
149
|
pageSlug?: string;
|
|
115
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* A DOCUMENT OF A HOST'S OWN — not a website's page or template: what the
|
|
153
|
+
* campaign designer opens (0.103.0). `record` is the record that stores it (a
|
|
154
|
+
* campaign's id), and `slug` the document within that record (one of its
|
|
155
|
+
* variants), the empty slug when it names none.
|
|
156
|
+
*
|
|
157
|
+
* The provider asks no more of it than that. One record is one adapter (it
|
|
158
|
+
* re-keys on `record`, as a page target re-keys on its site); two of these are
|
|
159
|
+
* the same document when record and slug match; and a document that has gone
|
|
160
|
+
* is reported, never replaced by a Home, which is a website's.
|
|
161
|
+
*
|
|
162
|
+
* Beside `ScreenTarget` and not in it: that union is the website's two kinds,
|
|
163
|
+
* as its hosts name and build them (and as the storefront publishes them), and
|
|
164
|
+
* its host messages carry one. A host's own document reaches the host through
|
|
165
|
+
* its address (`EaselHostAddress.show`), and never as `navigated`.
|
|
166
|
+
*/
|
|
167
|
+
type DocumentTarget = {
|
|
168
|
+
kind: "document";
|
|
169
|
+
record: string;
|
|
170
|
+
slug?: string;
|
|
171
|
+
};
|
|
172
|
+
/** Every target the document's provider opens: a website's page or template
|
|
173
|
+
* (`ScreenTarget`), or a document of a host's own (`DocumentTarget`). */
|
|
174
|
+
type AnyScreenTarget = ScreenTarget | DocumentTarget;
|
|
116
175
|
|
|
117
176
|
type ScreenDocumentValue = {
|
|
118
177
|
/** The document the editor is currently pointed at (runtime, retargetable). */
|
|
119
|
-
target:
|
|
178
|
+
target: AnyScreenTarget;
|
|
120
179
|
/** Record-type plumbing (load/save/list/create/delete) for the pointed-at
|
|
121
180
|
* document. Chrome and panels consult `capabilities`, never the record type. */
|
|
122
181
|
adapter: EaselDocumentAdapter;
|
|
@@ -124,7 +183,8 @@ type ScreenDocumentValue = {
|
|
|
124
183
|
capabilities: EaselCapabilities;
|
|
125
184
|
/** Id of the website template being edited (template mode only). */
|
|
126
185
|
templateId: string | null;
|
|
127
|
-
/** Slug of the page being edited — the template page's slug in template mode
|
|
186
|
+
/** Slug of the page being edited — the template page's slug in template mode,
|
|
187
|
+
* and a host's own document's `slug` (or the empty slug) for one of those. */
|
|
128
188
|
currentSlug: string;
|
|
129
189
|
/** Kind of the loaded page (`dynamic` drives the product-binding controls), or
|
|
130
190
|
* null while loading / in template mode where the record carries no kind. */
|
|
@@ -223,8 +283,18 @@ type ScreenDocumentValue = {
|
|
|
223
283
|
* is narrower on purpose: during `checking` nobody is named yet, and the
|
|
224
284
|
* pinned Header/Footer seed runs in the chrome's mount commit and must still
|
|
225
285
|
* land. Its write is held by `onChange` and released by the claim if it is
|
|
226
|
-
* granted, or never released if it is not — card 1096.
|
|
286
|
+
* granted, or never released if it is not — card 1096.
|
|
287
|
+
*
|
|
288
|
+
* …or the document itself is FROZEN (`readOnlyReason`): nobody holds it, and
|
|
289
|
+
* nobody may write it, ever. */
|
|
227
290
|
readOnly: boolean;
|
|
291
|
+
/** Why the open document may never be written, as the backend said it
|
|
292
|
+
* (`EaselDocument.readOnlyReason`: a campaign that has been sent), or null
|
|
293
|
+
* for every document that may. Such a document is read-only for good: its
|
|
294
|
+
* saves are refused, its lock is never claimed, and the save pill's place
|
|
295
|
+
* says this instead. Optional for a context built by hand, where it is
|
|
296
|
+
* absent and means null. */
|
|
297
|
+
readOnlyReason?: string | null;
|
|
228
298
|
/** Take the page: from the "someone else is editing" choice, or back after
|
|
229
299
|
* somebody took it from you. */
|
|
230
300
|
takeOverEditing: () => void;
|
|
@@ -240,22 +310,22 @@ type ScreenDocumentValue = {
|
|
|
240
310
|
* throws the operator's work away, and only they can ask for it. */
|
|
241
311
|
reloadFromServer: () => void;
|
|
242
312
|
/** Retarget the editor in place (guards unsaved changes before it swaps). */
|
|
243
|
-
navigate: (target:
|
|
313
|
+
navigate: (target: AnyScreenTarget) => void;
|
|
244
314
|
/** A retarget held behind the unsaved-changes prompt (null = no prompt). */
|
|
245
|
-
pendingNav:
|
|
315
|
+
pendingNav: AnyScreenTarget | null;
|
|
246
316
|
cancelPendingNav: () => void;
|
|
247
317
|
discardAndNavigate: () => void;
|
|
248
318
|
saveAndNavigate: () => Promise<void>;
|
|
249
319
|
};
|
|
250
320
|
declare const ScreenDocumentContext: react.Context<ScreenDocumentValue | null>;
|
|
251
321
|
declare function useScreenDocument(): ScreenDocumentValue;
|
|
252
|
-
declare function ScreenDocumentProvider({ target, addressing, onHostMessage, children, }: {
|
|
253
|
-
target:
|
|
322
|
+
declare function ScreenDocumentProvider({ target, addressing: handed, onHostMessage, children, }: {
|
|
323
|
+
target: AnyScreenTarget;
|
|
254
324
|
/** How this editor's documents are ADDRESSED — the layer's rules, handed in
|
|
255
325
|
* by whoever mounts the provider (the website's entry hands the website's:
|
|
256
326
|
* lib/website-document-addressing). Without them there is one document that
|
|
257
327
|
* nothing stores. ONE object for the life of the mount, like the session. */
|
|
258
|
-
addressing?:
|
|
328
|
+
addressing?: AnyDocumentAddressing;
|
|
259
329
|
/** The layer's own host messages, asked before the ones every editor answers
|
|
260
330
|
* (lib/host-inbound): the website's are lib/website-host-inbound.
|
|
261
331
|
* Returns true when it handled one. */
|
|
@@ -426,10 +496,12 @@ type InboundHostMessage = {
|
|
|
426
496
|
interface EaselHostAddress {
|
|
427
497
|
/** The query the editor was opened with (`?editTemplate=1`, `?site=` …). */
|
|
428
498
|
search(): string;
|
|
429
|
-
/** Keep the address in step with the open document (no load).
|
|
430
|
-
|
|
499
|
+
/** Keep the address in step with the open document (no load). A host's own
|
|
500
|
+
* document (`DocumentTarget`, 0.103.0) is told here and only here: the
|
|
501
|
+
* `navigated` message carries a website's targets. */
|
|
502
|
+
show(target: ScreenTarget | SectionScreenTarget | DocumentTarget): void;
|
|
431
503
|
/** Leave for another document by LOADING it (an entry bounce, a deleted page). */
|
|
432
|
-
load(target: ScreenTarget): void;
|
|
504
|
+
load(target: ScreenTarget | DocumentTarget): void;
|
|
433
505
|
/** Reload the editor from scratch (abandon this tab's copy of the document). */
|
|
434
506
|
reload(): void;
|
|
435
507
|
}
|
|
@@ -477,4 +549,4 @@ declare function createEaselHost(options: {
|
|
|
477
549
|
deliver: (message: HostToEaselMessage) => void;
|
|
478
550
|
};
|
|
479
551
|
|
|
480
|
-
export { DETACHED_EASEL_HOST as D, type EaselHost as E, type HostPickedMedia as H, type InboundHostMessage as I, NO_DOCUMENT_ADDRESSING as N, type SectionScreenTarget as S, type DocumentAddressing as a, type EaselHostAddress as b, EaselHostContext as c, EaselHostProvider as d, type EaselMessageType as e, type EaselToHostMessage as f, type HostToEaselMessage as g, type SendToHost as h, createEaselHost as i, type
|
|
552
|
+
export { type AnyDocumentAddressing as A, DETACHED_EASEL_HOST as D, type EaselHost as E, type HostPickedMedia as H, type InboundHostMessage as I, NO_DOCUMENT_ADDRESSING as N, type SectionScreenTarget as S, type DocumentAddressing as a, type EaselHostAddress as b, EaselHostContext as c, EaselHostProvider as d, type EaselMessageType as e, type EaselToHostMessage as f, type HostToEaselMessage as g, type SendToHost as h, createEaselHost as i, type AnyScreenTarget as j, type DocumentTarget as k, ScreenDocumentContext as l, ScreenDocumentProvider as m, type ScreenDocumentValue as n, type ScreenTarget as o, useScreenDocument as p, useEaselHost as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-66ICOE3I.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-NBJ2YY6Y.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.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-OORDMLL4.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-GENAF3P6.js";import"../../chunk-4MXFKJUY.js";import"../../chunk-IWAPPEL4.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KDYIMJTZ.js";import"../../chunk-6TZTKAB5.js";import"../../chunk-AJBJ74ME.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-NBJ2YY6Y.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-6DJHRLCU.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-TTJ54QGG.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-L5KW4HG5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { MediaPanelComponent, MediaPickRequest } from '../lib/media-panel.js';
|
|
3
|
-
import '../../host-
|
|
3
|
+
import '../../host-DJ8Gzsx7.js';
|
|
4
4
|
import '../../blocks/index.js';
|
|
5
5
|
import '../../types-E3HrTPg2.js';
|
|
6
6
|
import '../../data/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MediaSidePanel as default}from"../../chunk-
|
|
1
|
+
export{MediaSidePanel as default}from"../../chunk-3M3A3DN2.js";import"../../chunk-ZZ7VLIHQ.js";import"../../chunk-NBJ2YY6Y.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-6DJHRLCU.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-L5KW4HG5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{PageEditGuardNotices as default}from"../../chunk-
|
|
1
|
+
export{PageEditGuardNotices as default}from"../../chunk-LG436UTD.js";import"../../chunk-YJXEHK6I.js";import"../../chunk-7MU3RJ6S.js";import"../../chunk-A7ZJII7O.js";import"../../chunk-6FY3PZS3.js";import"../../chunk-AKZWUV5Z.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-OYX47SL7.js";import"../../chunk-HMX55DYT.js";import"../../chunk-Q3SQBNJB.js";import"../../chunk-3WSPDAK2.js";import"../../chunk-R5ZVNJLJ.js";import"../../chunk-KDYIMJTZ.js";import"../../chunk-6TZTKAB5.js";import"../../chunk-AJBJ74ME.js";import"../../chunk-ZZ7VLIHQ.js";import"../../chunk-ZWK3CBRU.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-6DJHRLCU.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-L5KW4HG5.js";
|