efficient-easel 0.103.0 → 0.104.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 +33 -6
- package/dist/chunk-4EUWOGZF.js +1 -0
- package/dist/chunk-5D2XAZKH.js +62 -0
- package/dist/chunk-7755VWRT.js +4 -0
- package/dist/chunk-7GVLSNFW.js +1 -0
- package/dist/chunk-A2LFBOUF.js +1 -0
- package/dist/{chunk-Z3KBLIEH.js → chunk-BBRY7KI4.js} +1 -1
- package/dist/chunk-BVN33R76.js +1 -0
- package/dist/chunk-D6324C3E.js +5 -0
- package/dist/chunk-ERR437B5.js +1 -0
- package/dist/chunk-HMWJB3HF.js +1 -0
- package/dist/{chunk-KDYIMJTZ.js → chunk-KCOBHPN6.js} +1 -1
- package/dist/chunk-KVNRNDUC.js +1 -0
- package/dist/chunk-LEGAPYPC.js +1 -0
- package/dist/chunk-LRTIMWZG.js +2 -0
- package/dist/{chunk-LG436UTD.js → chunk-LXEOVUAV.js} +1 -1
- package/dist/{chunk-66ICOE3I.js → chunk-NEQIEYYO.js} +1 -1
- package/dist/{chunk-6TZTKAB5.js → chunk-O7Q4DDJT.js} +1 -1
- package/dist/chunk-PYNQRX56.js +4 -0
- package/dist/{chunk-6UJ3Y6FC.js → chunk-QCBWT2XE.js} +1 -1
- package/dist/{chunk-7MU3RJ6S.js → chunk-QDEZQ5A6.js} +1 -1
- package/dist/chunk-QOPY2LQM.js +1 -0
- package/dist/{chunk-AKFJK65Z.js → chunk-R2MUSGPS.js} +1 -1
- package/dist/chunk-RSCMJIWS.js +1 -0
- package/dist/{chunk-GXN65JMA.js → chunk-TTENU2HX.js} +1 -1
- package/dist/chunk-UB7JVPK4.js +1 -0
- package/dist/{chunk-MSBF7IW3.js → chunk-YODRYAZX.js} +2 -2
- package/dist/chunk-Z6BAZFSW.js +2 -0
- package/dist/chunk-ZOJEFIP4.js +1 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +2 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +47 -2
- package/dist/screen/components/NodeContextMenu.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 -0
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +4 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +3 -0
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +3 -0
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -0
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/backend-error.d.ts +20 -5
- package/dist/screen/lib/backend-error.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -0
- package/dist/screen/lib/failure.d.ts +6 -2
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +2 -1
- package/dist/screen/lib/load-error.d.ts +9 -3
- package/dist/screen/lib/load-error.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +81 -17
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +13 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.d.ts +45 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/puck/content-tree.d.ts +20 -1
- package/dist/screen/lib/puck/content-tree.js +1 -1
- package/dist/screen/lib/puck/section-doc.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.d.ts +18 -3
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +6 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +150 -4
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +25 -1
- package/dist/screen/lib/section-templates.js +1 -1
- package/dist/screen/lib/session-context.d.ts +5 -1
- package/dist/screen/lib/session-context.js +1 -1
- package/dist/screen/lib/session.d.ts +58 -5
- package/dist/screen/lib/session.js +1 -1
- package/dist/screen/words.d.ts +24 -1
- package/dist/screen/words.js +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/tree/index.d.ts +4 -142
- package/dist/types-DJDBtdB2.d.ts +143 -0
- package/package.json +1 -1
- package/dist/chunk-3M3A3DN2.js +0 -4
- package/dist/chunk-4MXFKJUY.js +0 -1
- package/dist/chunk-6FY3PZS3.js +0 -1
- package/dist/chunk-A7ZJII7O.js +0 -1
- package/dist/chunk-AJBJ74ME.js +0 -1
- package/dist/chunk-AKZWUV5Z.js +0 -1
- package/dist/chunk-F6CCTEIX.js +0 -1
- package/dist/chunk-FUDHI5I4.js +0 -1
- package/dist/chunk-HDKTR5TZ.js +0 -62
- package/dist/chunk-HMX55DYT.js +0 -1
- package/dist/chunk-HWW4XJOH.js +0 -1
- package/dist/chunk-NBJ2YY6Y.js +0 -4
- package/dist/chunk-OORDMLL4.js +0 -5
- package/dist/chunk-Q3SQBNJB.js +0 -1
- package/dist/chunk-VV5ADNBR.js +0 -1
- package/dist/chunk-YJXEHK6I.js +0 -2
- package/dist/chunk-ZWK3CBRU.js +0 -1
- package/dist/chunk-ZZ7VLIHQ.js +0 -1
package/README.md
CHANGED
|
@@ -987,8 +987,34 @@ held read-only for good, and the save pill's place says why. The top bar's
|
|
|
987
987
|
main button is the layer's when its bridges hand one back (`barMain`), and
|
|
988
988
|
the save pill is no switch under `saveSwitch: false`. The words the screen
|
|
989
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`.
|
|
991
|
-
|
|
990
|
+
document are the `screen` group of `EaselStrings`. A field's media pick may
|
|
991
|
+
carry the field's own terms to the host's panel (`options`) and give way to a
|
|
992
|
+
change of selection (`pickFollowsSelection`), and a block may be resolved as
|
|
993
|
+
it goes in (`blockRules.resolveOnInsert`). Each is optional: without it the
|
|
994
|
+
screen is the website's, as it was.
|
|
995
|
+
|
|
996
|
+
Two screens may be mounted in one page (0.103.0): the second host's session
|
|
997
|
+
is made with `claimsPage: false`, so it never becomes the page's current
|
|
998
|
+
session (the website's loaders and client keep reading the website's), holds
|
|
999
|
+
a block clipboard of its own registry's, and may bring its own default
|
|
1000
|
+
backend (`defaultBackend`) and its own reading of its client's errors
|
|
1001
|
+
(`hostFailures`). Each `MediaPanelProvider` keeps its own pending pick, found
|
|
1002
|
+
by the host a field asks through; the Add panel lists its own session's saved
|
|
1003
|
+
sections.
|
|
1004
|
+
|
|
1005
|
+
Its Layers tree is the layer's to frame (0.103.0). `pinned.isFirst` and
|
|
1006
|
+
`isLast` say which node is pinned where the type alone does not (the campaign
|
|
1007
|
+
designer's Header and Footer are sections, told apart by `_region`);
|
|
1008
|
+
`pinned.firstRow: "node"` draws the first pinned node with its children, as
|
|
1009
|
+
the Footer is drawn; `pinned.band` names the sections between the pins, folds
|
|
1010
|
+
them under a row of their own and ends them with an "Add section" row; and
|
|
1011
|
+
`useDocumentLabel` is the head's context line. A row's name, its quieter
|
|
1012
|
+
words, its marks and buttons of the layer's own are `blockLook.rowName`,
|
|
1013
|
+
`rowPreview`, `rowMarks` and `rowActions`. A block config's
|
|
1014
|
+
`permissions.delete` / `duplicate` set to `false` takes the action off the
|
|
1015
|
+
block's rows and its menu, and the inspector is handed the answer for its
|
|
1016
|
+
head (`nodeActions`). The frame's words (Page settings, the pinned labels,
|
|
1017
|
+
the band's) are `screen` words too.
|
|
992
1018
|
|
|
993
1019
|
- **Every module is a subpath of its own** (`efficient-easel/screen/lib/session`,
|
|
994
1020
|
`efficient-easel/screen/components/ScreenChrome`): hosts and their guards
|
|
@@ -998,10 +1024,11 @@ it the screen is the website's, as it was.
|
|
|
998
1024
|
`exports` map from it and `tests/screen-exports.test.ts` fails one that
|
|
999
1025
|
drifted.
|
|
1000
1026
|
- **It still writes out some of the website it came from** (a website
|
|
1001
|
-
target's site and template, the
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1027
|
+
target's site and template, the `storefront-editor:` host messages). Each
|
|
1028
|
+
is handed in as the campaign designer needs it; the list is in the
|
|
1029
|
+
builder's `doc/adr/0004`. A host's own document target is the first to have
|
|
1030
|
+
left it, and the frame of the pinned Header and Footer rows the second
|
|
1031
|
+
(0.103.0).
|
|
1005
1032
|
- **Its classes keep their `sf-` names** and its strings their words: the
|
|
1006
1033
|
hosts' sheets, their guards and the website's host address them.
|
|
1007
1034
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-JUQ6YJCG.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
|
|
@@ -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-R2MUSGPS.js";import{rootRowName as c,slotChildRowName as a,slotChildRenameProp as p}from"./chunk-QOPY2LQM.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 v}from"./chunk-SERF2FAU.js";import{usePartBridge as w}from"./chunk-TTENU2HX.js";import{useSectionOps as x}from"./chunk-A2LFBOUF.js";import{useNodeClipboard as z,useNodeContextMenu as C}from"./chunk-HMWJB3HF.js";import{ROOT_ZONE as N,blockNodeActions as B,TREE_MAX_DEPTH as A,childSlotsOf as P,slotFieldsOf as T,nestsInTree as O,newNodeId as $}from"./chunk-7GVLSNFW.js";import{PageEditGuardNotices as R}from"./chunk-LXEOVUAV.js";import{useScreenDocument as j}from"./chunk-LRTIMWZG.js";import{requestMediaPick as M}from"./chunk-UB7JVPK4.js";import{heldStyle as E,styleShortcut as L}from"./chunk-57DJOKXT.js";import{AddChildRow as I}from"./chunk-3QVB4AG2.js";import{AddSidePanel as V}from"./chunk-D6324C3E.js";import{SidePanelHead as F,PanelShowStrip as D}from"./chunk-IWAPPEL4.js";import{MediaSidePanel as H}from"./chunk-PYNQRX56.js";import{useScreenSaveSwitch as G,useScreenPinned as U,useScreenDocumentLabel as W,useScreenCanvasFrame as J,useScreenInspectorPanel as Q,useScreenDevices as Y,useScreenPickFollowsSelection as X,useScreenLeftView as Z,SELECTION_MODE as _,sameInspectorMode as q,useScreenBridges as K,useScreenBlockRules as ee,useScreenBlockLook as ne,useScreenDocumentPass as te,isPinnedFirst as oe,isPinnedLast as re}from"./chunk-7755VWRT.js";import{useMediaPanel as ie,usePanelPick as le,useCancelPanelPick as se}from"./chunk-Z6BAZFSW.js";import{useEaselHost as de}from"./chunk-R5ZVNJLJ.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-LEGAPYPC.js";import{useEasel as ae}from"./chunk-P67FP7PG.js";import{TreeRow as pe,Subtree as ue,LayersTree as fe,TreeGroupLabel as he,TreeRowAction as me,TreeSeam as ye}from"./chunk-ZFDCDJNZ.js";import{useNodeOps as ge,toItemSelector as ke}from"./chunk-D2BCHTQR.js";import{saveIndicator as Se}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as be,TopBarRail as ve,TopBarCluster as we,EaselIconButton as xe,TopBarDivider as ze,DeviceSwitch as Ce,InspectorIconButton as Ne,PanelResizeHandle as Be,MAX_PANEL_W as Ae,MIN_PANEL_W as Pe,panelWidthVars as Te,SaveState as Oe,SaveStateToggle as $e}from"./chunk-6DJHRLCU.js";import{useWords as Re}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as je}from"./chunk-TTJ54QGG.js";import{createDragSession as Me,useTreeDrag as Ee,gapToMoveIndex as Le}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Ie,BLOCK_SELECTOR as Ve,useCanvasEvent as Fe}from"./chunk-PAELDYYS.js";import{LayersIcon as De,UndoIcon as He,RedoIcon as Ge,TrashIcon as Ue,MediaIcon as We}from"./chunk-L5KW4HG5.js";import{ROOT_ID as Je,ROOT_SLOT as Qe,zoneKey as Ye,parseZoneKey as Xe,DataError as Ze}from"./chunk-KRXQM65X.js";import{useRef as _e,useMemo as qe,useState as Ke,useEffect as en,useCallback as nn,useLayoutEffect as tn,Fragment as on}from"react";import{jsx as rn,jsxs as ln,Fragment as sn}from"react/jsx-runtime";function dn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return rn(Oe,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return rn(Oe,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Se(e),d=e.failed&&!e.paused&&/* @__PURE__ */rn("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return ln(sn,o?{children:[
|
|
4
|
+
/* @__PURE__ */rn($e,{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__ */rn(Oe,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */rn(Oe,{tone:l,label:s,role:"status"}),d]})}function cn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return rn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ln(sn,e?{children:[
|
|
7
|
+
/* @__PURE__ */rn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */rn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */rn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */rn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */rn("path",{d:"M5 12h14"})]})})}var an="screen:band",pn={duplicate:!0,delete:!0};function un(){const Se=de(),{capabilities:Oe,currentSlug:$e,siteId:un,onPublish:fn,saveState:hn,saveConflict:mn,retrySave:yn,toggleAutoSave:gn,readOnly:kn,readOnlyReason:Sn=null}=j(),bn=G(),{canPublish:vn,mediaEditing:wn,hasEditGuard:xn,hasPinnedChrome:zn}=Oe,{appState:Cn,dispatch:Nn,history:Bn,selectedItem:An,getSelectorForId:Pn,config:Tn}=ae(e=>e),On=U(),{first:$n,firstGroup:Rn,lastGroup:jn,isSectionGroup:Mn,sectionGroupZone:En,panelOf:Ln}=On,In=Ln($n),Vn=e=>oe(On,e),Fn=e=>re(On,e),Dn="node"===On.firstRow,Hn=On.band??null,Gn=Re("screen",ce),Un=W()??`/${$e}`,Wn=J(),Jn=Q(),Qn=x({readOnly:kn}),Yn=_e(null),Xn=qe(()=>({...Qn,select:e=>{Yn.current=e,Qn.select(e)}}),[Qn]),Zn=Cn.ui,_n=Zn.leftSideBarVisible,qn=Zn.rightSideBarVisible,{options:Kn,widths:et,initial:nt,fluid:tt}=Y(),[ot,rt]=Ke(nt),it=ie(),lt=wn&&null!==it,st=le(),dt=se();X(An?.props.id);const{read:ct,write:at,forSelection:pt}=Z(),[ut,ft]=Ke(ct);en(()=>{at(ut)},[ut]);const[ht,mt]=Ke(0),yt=_e(null),gt=_e(null),kt=Ie(gt,{readySelector:Ve}),St=m(gt);y(gt);const[bt,vt]=Ke(!1),wt=_e(!1),xt=_e(!1),[zt,Ct]=Ke(null),Nt=zt&&zt.zone===N?zt.index:null,Bt=e=>Ct(null===e?null:{zone:N,index:e}),[At,Pt]=Ke([]),[Tt,Ot]=Ke(_),$t="puck"===Tt.kind,Rt=i(Tt,An?.props.id),[jt,Mt]=Ke(null);en(()=>{jt&&(l(),Mt(null))},[jt]);const Et=_e(Pn);Et.current=Pn;const Lt=nn((e,{scroll:n})=>{ft(n=>pt(e,n)),n&&Mt(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Et.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),o=n}0!==t.length&&lo(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]);en(()=>{Ot(Ln(An?.type)??_);const e=An?.props.id,n=Yn.current;if(Yn.current=null,!e)return;const t=Pn(e);Lt(String(e),{scroll:!s(n,t??null,N)})},[An?.props.id,Lt]);const It=nn(e=>{Ot(n=>q(n,e)?n:e),Nn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Nn]),Vt=K({kind:Tt.kind,mode:Tt,open:It,show:e=>Ot(e),reveal:()=>{qn||Nn({type:"setUi",ui:{rightSideBarVisible:!0}})}},{data:Cn.data,selected:An??null,zoneOf:e=>Pn(e)?.zone,readOnly:Boolean(kn),select:e=>{Ot(_),Xn.select({index:e})},replace:(e,n)=>Xn.replaceComponent(N,e,n),scrollTo:e=>fr(e)},{device:ot,refreshes:ht},{setView:ft,reveal:()=>{_n||Nn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ft=Vt.pinnedSource??!1,Dt=Vt.resolveLeftView?Vt.resolveLeftView(ut,lt):"media"===ut&<?ut:"sections",{isLockedBlock:Ht,duplicateBlocked:Gt,nestDepth:Ut,newSectionNode:Wt,canAddTo:Jt,blockIsOffered:Qt}=ee(),Yt=ne(),{labelAtLevel:Xt,Icon:Zt,useProducts:_t}=Yt,qt=Yt.rowName?(e,n,t)=>Yt.rowName(e,n,t):void 0,Kt=nn(e=>{Nn({type:"setUi",ui:{rightSideBarVisible:!0}}),u(e),Lt(e,{scroll:!0})},[Nn,Lt]),{selectNode:eo,openPartId:no}=w({mode:Tt,setMode:Ot,onOpenPart:Kt}),[to,oo]=Ke(null),ro="sf-editor-collapsed-sections",[io,lo]=Ke(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(ro);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});en(()=>{try{window.localStorage.setItem(ro,JSON.stringify([...io]))}catch{}},[io]);const[so,co]=Ke(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(b);if(!e)return{...S};const n=JSON.parse(e);return{left:v(Number(n.left)||S.left),right:v(Number(n.right)||S.right)}}catch{return{...S}}});en(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(b,JSON.stringify(so))}catch{}},300);return()=>clearTimeout(e)},[so]);const ao=nn((e,n)=>co(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),po=nn(e=>ao("left",e),[ao]),uo=nn(e=>ao("right",e),[ao]),fo=e=>io.has(e),ho=e=>lo(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),mo=_e(!1),yo=_e(null);en(()=>{if(mo.current&&!bt){const e=yo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??gt.current?.querySelector('button[aria-label="Add"]'))?.focus(),yo.current=null}mo.current=bt},[bt]),en(()=>{if(!bt||!St)return;const e=e=>{"Escape"===e.key&&wr()};return St.addEventListener("keydown",e),()=>St.removeEventListener("keydown",e)},[bt,St]),en(()=>{!_n&&bt&&(vt(!1),Ct(null),wt.current=!1)},[_n]),en(()=>{if(!st)return xt.current&&Nn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(xt.current=!1);bt&&(vt(!1),Ct(null),xt.current=wt.current,wt.current=!1),_n||(xt.current=!0,Nn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[st]),en(()=>{!_n&&st&&(xt.current=!1,dt())},[_n]),en(()=>{if(!st||!St)return;const e=e=>{"Escape"===e.key&&dt()};return St.addEventListener("keydown",e),()=>St.removeEventListener("keydown",e)},[st,St]);const[go,ko]=Ke(null),[So,bo]=Ke(0),vo=_e(null),wo=(e,n="success")=>{ko({msg:e,tone:n}),bo(e=>e+1),vo.current&&clearTimeout(vo.current),vo.current=setTimeout(()=>ko(null),"error"===n?3200:1900)};en(()=>()=>{vo.current&&clearTimeout(vo.current)},[]);const xo=_e(null),[zo,Co]=Ke(0),[No,Bo]=Ke(0);en(()=>{const e=xo.current;if(!e)return;const n=()=>{Co(e.clientWidth),Bo(e.clientHeight)};n();const t=new ResizeObserver(n);return t.observe(e),()=>t.disconnect()},[]),tn(()=>{xo.current&&(Co(xo.current.clientWidth),Bo(xo.current.clientHeight))},[so,_n,qn]);const Ao=ot===tt?zo>0?zo:et[tt]:et[ot],Po=zo>0?Math.min(zo/Ao,2):1,To=Ao*Po,Oo=zo>0&&To>zo+1,$o={width:To,height:No||"100%",flex:"none",position:"relative"},Ro={width:Ao,height:No?No/Po:"100%",maxHeight:"none",transform:1!==Po?`scale(${Po})`:void 0,transformOrigin:"top left"},jo=()=>Nn({type:"setUi",ui:{leftSideBarVisible:!_n}}),Mo=()=>Nn({type:"setUi",ui:{rightSideBarVisible:!qn}}),Eo=e=>{bt&&(vt(!1),Ct(null),wt.current=!1,_n&&ut===e)||st&&(xt.current=!1,dt(),_n&&ut===e)||(_n&&ut===e?jo():(ft(e),_n||Nn({type:"setUi",ui:{leftSideBarVisible:!0}})))},Lo=()=>{M(Se,{accept:"image/*",title:"Media library"})},Io=()=>{Ot(_),Xn.select(null),h()},Vo=()=>{Ot(In??_),qn||Nn({type:"setUi",ui:{rightSideBarVisible:!0}})},Fo=Cn.data.content??[],Do=()=>{const e=Fo.findIndex(Vn),n=Fo.findIndex(Fn);return{floor:e>=0?e+1:0,cap:n>=0?n:Fo.length}},Ho=Tn,Go=z(),Uo=ge({data:Cn.data,config:Ho,readOnly:Boolean(kn),clipboard:Go,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Je||e.slot!==Qe)return{min:0,max:n-1};const{floor:t,cap:o}=Do();return{min:t,max:o-1}},commit:(e,{select:n})=>{if(void 0!==n){Ot(_);const t="node"===n?.kind?ke(e,Ho,n):null;Xn.select(t&&t.zone===N?{index:t.index}:t)}Xn.commitDocument(e)}}),Wo=e=>Tn.components[e]?.label??e,Jo=nn(e=>Tn.components[e]?.defaultProps??{},[Tn]),Qo=e=>Xt(e,"section",Wo(e)),Yo=e=>c({type:e.type,props:e.props??{}},Qo(e.type),qt),{nodeAddresses:Xo,zoneItems:Zo}=qe(()=>{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>=A)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of P(Tn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Fo,N,0),{nodeAddresses:e,zoneItems:n}},[Fo,Tn]),_o=nn(e=>Zo.get(e)??[],[Zo]),qo=_t(),Ko=qe(()=>{const e=/* @__PURE__ */new Map;for(const n of qo??[])e.set(n.slug,n.name);return e},[qo]),er=e=>a(e,Wo,Yt.plainText,e=>Ko.get(e),Yt.rowName),nr=(e,n)=>n===N?null:p(Tn.components[e.type]?.fields),tr=(e,n,t,o)=>{if(!(to?.zone===e&&to.index===n))return;const r=(t,o)=>{oo(null),o&&((e,n,t)=>{const o=_o(e)[n];if(!o)return;const r=nr(o,e);r&&Xn.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return rn("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)},or=n(un),rr=Tn,ir=(e,n)=>n===N?Qo(e):Wo(e),lr=(e,n,t)=>{const o=r(rr,or,t,ir(t.type,e));o&&(o.changed&&Xn.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),wo(o.message))},sr=C({nodesIn:_o,nodeAt:(e,n)=>_o(e)[n]??null,labelOf:(e,n)=>n===N?Qo(e):Wo(e),renamePropOf:nr,beginRename:(e,n)=>oo({zone:e,index:n}),history:{hasPast:Bn.hasPast,hasFuture:Bn.hasFuture,back:()=>Bn.back(),forward:()=>Bn.forward()},openAddSection:()=>{Xn.select(null),br(null)},openPageSettings:()=>{Xn.select(null),Ot(_)},collapseAll:()=>lo(new Set(_o(N).map(e=>String(e.props.id)))),onPasteRefused:()=>wo("Your browser won’t let us read the clipboard — press ⌘V","error"),isLocked:e=>Ht(e.type),duplicateBlocked:e=>Gt(Cn.data,e),permits:e=>B(Tn,e.type),canAddTo:Jt,nodeOps:Uo,isPinned:(e,n)=>n===N&&(Vn(e)||Fn(e)),sectionBand:Do,openAddInside:(e,n)=>{e===N?hr(n):Xn.select({zone:e,index:n}),br(null)},locate:e=>Xo.get(e)??null,rowNameOf:(e,n)=>n===N?Yo(e):er(e),selectAt:(e,n,t,o)=>{e===N?hr(n):Vr(e,n,t,o??"")},style:{held:()=>E(or),canCopy:e=>o(rr,e).some(e=>!1!==e.counted),copy:(e,n)=>t(rr,or,e,ir(e.type,n)),paste:(e,n,t)=>lr(e,n,t)}},kt),dr=_e({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});en(()=>{dr.current={copy:(e,n)=>t(rr,or,e,ir(e.type,n)),paste:lr,at:()=>{const e=Cn.ui.itemSelector;if(!e)return null;const n=e.zone??N,t=_o(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(kn)}});const cr=nn(e=>{const n=L(e);if(!n)return;const t=dr.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))},[]);en(()=>{if(!St)return;const e=e=>cr(e);return St.addEventListener("keydown",e),()=>St.removeEventListener("keydown",e)},[cr,St]),Fe(kt,"keydown",cr);const ar=Fo.map(e=>e.props.id).join("|");en(()=>{const e=kt?.document??null,n=kt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Pt(e=>e.length?[]:e);const n=Fo.findIndex(Fn),t=n>=0?n:Fo.length,o=n=>{const t=Fo[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})}Pt(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()}},[kt,ar,ot,Po,_n,qn,An?.props.id]);const pr=kt?.document??null,ur=kt?.window??null;en(()=>{const e=yt.current;if(!e||!pr||!ur)return;const n=[],t=()=>{const n=pr.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ur.scrollTo({left:ur.scrollX,top:ur.scrollY+t,behavior:"instant"}),!0};return yt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[pr,ur]);const fr=e=>{Vt.holdCanvasOn?Vt.holdCanvasOn(e):u(e)},hr=e=>{Ot(_),Xn.select({index:e}),Vt.sectionPressed?.(Fo[e]);const n=Fo[e]?.props?.id;n&&fr(n)},mr=e=>{const{floor:n,cap:t}=Do(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=An&&Tt.kind!==In?.kind?Fo.findIndex(e=>e.props.id===An.props.id):-1;return o(r>=0?r+1:t)},yr=(e,n)=>{const{floor:t,cap:o}=Do(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Xn.reorderComponent(N,e,i),Xn.select({index:i}),{moved:!0,dest:i})},gr=(e,n,t)=>{Ot(_),Xn.select({index:e}),u(n),wo(`Added “${t}” section`)},kr=(e,n)=>{const t=mr(n),o=Wt(e,{nodeDefaults:Jo,newNodeId:$,sectionLabel:Qo,blockIsOffered:Qt}),r=o?Xn.insertNode(N,t,o):Xn.insertSection(e,t);return gr(t,r,Qo(e)),t},Sr=(e,n,t)=>{const o=mr(t),r=Xn.insertNode(N,o,n);return gr(o,r,e),o},br=e=>vr(N,e),vr=(e,n)=>{yo.current=document.activeElement??null,st&&(wt.current=xt.current,xt.current=!1,dt()),Ct(null===n?null:{zone:e,index:n}),vt(!0),_n||(wt.current=!0,Nn({type:"setUi",ui:{leftSideBarVisible:!0}}))},wr=()=>{vt(!1),Ct(null),wt.current&&Nn({type:"setUi",ui:{leftSideBarVisible:!1}}),wt.current=!1},xr=(e,n,t)=>{if("section"===e.kind)Xn.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Xn.insertNode(n,t,d(e.template.node))}Ot(_),Xn.select({index:t,zone:n})},zr=e=>n=>{n.target.closest(".es-tree-select")||e()},Cr=()=>Vt.editPinnedSource?.(),Nr=(e,n,t)=>{const o=_o(e)[n];return o&&!B(Tn,o.type).delete?null:/* @__PURE__ */rn(me,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=_o(e)[n]?.props?.id;null!=t&&Uo.remove(String(t))})(e,n),children:/* @__PURE__ */rn(Ue,{size:15})})},Br=e=>Yt.rowPreview?.(e)||void 0,Ar=e=>Yt.rowMarks?.(e)??void 0,Pr=(e,n,t)=>Yt.rowActions?.(e,n,t)??null,Tr=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return rn(me,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>$r(e,n,t),children:/* @__PURE__ */rn(k,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},Or=e=>{const n=Qo(Fo[e]?.type??""),t=n?Gn.addSectionBefore({name:n}):Gn.addSectionHere;return pi(N,e,()=>br(e),t)},$r=(e,n,t)=>{Xn.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Rr=e=>T(Tn,e),jr=e=>P(Tn,e),Mr=(e,n,t)=>{const o=O(Tn,e.type,n)&&(t||jr(e).length>0);return{collapsible:o,folded:o&&fo(String(e.props.id))}},Er=(e,n,t)=>jr(e).flatMap(({child:e})=>Mr(e,n,t(e.type)).collapsible?[String(e.props.id),...Er(e,n+1,t)]:[]),Lr=e=>jr(e).length>0||Boolean(Jt(e.type)),Ir=e=>Boolean(Jt(e)),Vr=(e,n,t,o)=>{if(Ot(_),Jt(o)?.spec?.slider){const t=e.split(":")[0];f(t,n),Xn.select({index:n,zone:e}),u(t)}else Xn.select({index:n,zone:e}),fr(t)},Fr=(e,n,t,o,r)=>{const i=`${e}:${n}`;Xn.insertComponent(i,t,o),Jt(r)?.spec?.slider?requestAnimationFrame(()=>{f(e,o),Xn.select({index:o,zone:i})}):Xn.select({index:o,zone:i})},Dr=(e,n,t)=>{Xn.insertComponent(e,n,t),Ot(_),Xn.select({index:t,zone:e})},Hr=_e(/* @__PURE__ */new Set);en(()=>{Fo.forEach(e=>{const n=Jt(e.type)?.spec;if(!n)return;const t=e.props.id;if(Hr.current.has(t))return;Hr.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(Jo)).forEach((e,t)=>Xn.seedChild(o,t,n.childType,e))})},[Fo,Xn,Jo]);const Gr=_e(/* @__PURE__ */new Set);en(()=>{Fo.forEach((n,t)=>{const o=n.props.id;if(Gr.current.has(o))return;const r=e(n,Rr(n.type));Gr.current.add(o),r&&Xn.replaceComponent(N,t,{...n,props:r})})},[Fo,Xn]),te(Xn,Tn);const Ur=Fo.findIndex(Fn),Wr=Ur>=0?Fo[Ur]:null,Jr=Dn?Fo.findIndex(Vn):-1,Qr=Jr>=0?Fo[Jr]:null,Yr=Fo.find(e=>e.type===Rn)??null,Xr=Fo.find(e=>e.type===jn)??null,Zr=Ur>=0?Ur:Fo.length,_r=[];Fo.forEach(e=>{Fn(e)||(Lr(e)&&_r.push(String(e.props.id)),_r.push(...Er(e,1,Ir)))}),Wr&&(_r.push(String(Wr.props.id)),_r.push(...Er(Wr,1,Ir)));const qr=_r.length>0&&_r.every(e=>io.has(e)),Kr=e=>{const n=Yt.blockRowName(e,Wo);return Yt.rowName?Yt.rowName(e,"block",n):n},ei=(e,n,t,o)=>{const r=_o(e)[t];if(!r)return;const i={...Xe(e),index:t},l={...Xe(n),index:Math.min(Math.max(o,0),_o(n).length)},s=Le(i,l);if(e!==n||s!==t)try{Uo.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Ze))throw e}},ni=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of jr(e))n.add(r),t(o)};for(const t of Rr(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ti=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xo.get(n);if(!e)return null;if(e.zone===N)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},oi=e=>{const n=e.slice(0,e.indexOf(":")),t=Fo.find(e=>Mn(e.type)&&String(e.props.id)===n);return t&&En(n)===e?t:null},ri=(e,n)=>{if(e.add)return li(e.add,n);const t=Ye(n);if(Mn(e.type))return!1;const o=oi(t),r=oi(e.zone);if(o||r)return!(!o||!r)&&(n.index>=0&&n.index<=_o(t).length);if(e.zone===N||t===N){if(e.zone!==t)return!1;const{floor:o,cap:r}=Do();return n.index>=o&&n.index<=r}if(n.index<0||n.index>_o(t).length)return!1;if(e.zone===t)return!0;const i=Wr?String(Wr.props.id):null;return(!i||ti(e.zone)!==i&&ti(t)!==i)&&((e,n,t)=>{if(e===n)return!0;const o=_o(e)[t];if(!o)return!1;const r=n.split(":")[0],i=Xo.get(r),l=i?_o(i.zone)[i.index]:void 0;if(!l)return!1;if(ni(o).has(n))return!1;const s=Jt(l.type,Ut(Cn?.data,l.type,r));return!!s&&(!!(s.choices?s.choices.some(e=>e.type===o.type):s.spec?.childType===o.type)&&!s.spec?.addBlocked?.(_o(n),o))})(e.zone,t,e.index)},ii=e=>{const n=e.slice(0,e.indexOf(":")),t=Xo.get(n),o=t?_o(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Jt(o.type,Ut(Cn?.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:Wo(r.spec.childType)}]:[]),parentName:t.zone===N?Qo(o.type):Wo(o.type)}},li=(e,n)=>{const t=Ye(n);if("block"!==e.kind){if(oi(t))return n.index>=0&&n.index<=_o(t).length;if(t!==N)return!1;const{floor:e,cap:o}=Do();return n.index>=e&&n.index<=o}if(t===N)return!1;const o=ii(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(_o(t))},si=(e,n)=>{e.add?((e,n)=>{if("block"!==e.kind&&oi(Ye(n)))return void xr(e,Ye(n),n.index);if("section"===e.kind)return void kr(e.type,n.index);if("template"===e.kind)return void Sr(e.template.name,d(e.template.node),n.index);const t=Ye(n),o=ii(t);o&&(o.target.spec?Fr(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Dr(t,e.type,n.index))})(e.add,n):e.zone===N?yr(e.index,n.index):ei(e.zone,Ye(n),e.index,n.index)},[di]=Ke(()=>Me()),ci=Ee({keyOf:e=>e.id,readOnly:Boolean(kn),session:di,canDrop:ri,onDrop:si,onStep:(e,n)=>{e.zone===N?((e,n)=>{const t=Qo(Fo[e]?.type??""),o=yr(e,n<0?e-1:e+2);if(!o.moved)return void wo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=Do();wo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):ei(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ai=nn(e=>{const{floor:n,cap:t}=Do(),o=[];for(const r of e.nodes){const e=Ye(r.place),i=_o(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Vn(i)||Fn(i)||Ht(i.type))continue;if(Mn(i.type))continue;const l=Boolean(oi(e)),s=e===N||l;e===N&&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?Qo(i.type):er(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(ii(Ye(e.list))?.choices.length)||Boolean(oi(Ye(e.list))))}},[Cn.data]),pi=(e,n,t,o)=>/* @__PURE__ */rn(ye,{...kn?{}:ci.seam({place:{...Xe(e),index:n}}),onAdd:kn?void 0:t,label:o},`seam:${e}:${n}`),ui={rowClick:zr,isCollapsed:fo,toggleCollapse:ho},fi=e=>{const n=String(e.props.id),t=Fo.findIndex(e=>String(e.props.id)===n),o=En(n),r=_o(o),i=fo(n),l=Wo(e.type),s=Yt.rowName?Yt.rowName(e,"section",l):l,d=e=>pi(o,e,()=>vr(o,e),Gn.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return ln(sn,{children:[
|
|
16
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:e.type,size:13}),name:s,preview:Br(e),marks:Ar(e),onSelect:()=>hr(t),selected:Rt===n,actions:Pr(e,N,t)??void 0,rowProps:{"data-node-id":n,onClick:zr(()=>hr(t))},fold:{open:!i,label:"section",onToggle:()=>ho(n)}}),!i&&/* @__PURE__ */ln(ue,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Yo(n),l=Lr(n),s=l&&fo(r),c=()=>Vr(o,t,r,e.type),{rowProps:a,...p}=ci.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Xe(o),index:t}},{"data-node-id":r,onClick:zr(c)});/* @__PURE__ */
|
|
17
|
+
return ln(on,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:n.type,size:13}),name:i,preview:Br(n),marks:Ar(n),onSelect:c,selected:Rt===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>ho(r)}:void 0,actions:/* @__PURE__ */ln(sn,{children:[Nr(o,t,i),Pr(n,o,t),Tr(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */rn(ue,{children:mi(n,2)})]},r)}),d(r.length)]})]})},hi=(e,n)=>{const t=jr(e),o=(e,n)=>pi(e,n),r=Jt(e.type),i=r?`${e.props.id}:${r.slot}`:null;/* @__PURE__ */
|
|
19
|
+
return ln(sn,{children:[t.map(({child:t,zone:r,index:i})=>{const l=Rt===String(t.props.id),{collapsible:s,folded:d}=Mr(t,n,Ir(t.type)),c=String(t.props.id),a=Kr(t),p=()=>Vr(r,i,c,e.type),{rowProps:u,...f}=ci.row({item:{id:c,zone:r,index:i,type:t.type},place:{...Xe(r),index:i}},{"data-node-id":c,onClick:zr(p)});/* @__PURE__ */
|
|
20
|
+
return ln(on,{children:[0===i&&o(r,0),
|
|
21
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:t.type,size:13}),name:a,preview:Br(t),marks:Ar(t),onSelect:p,selected:l,hidden:Boolean(t.props._hidden),...f,fold:s?{open:!d,label:"group",onToggle:()=>ho(c)}:void 0,actions:/* @__PURE__ */ln(sn,{children:[Nr(r,i,a),Pr(t,r,i),Tr(r,i,t,a)]}),rowProps:u}),s&&!d&&/* @__PURE__ */rn(ue,{children:hi(t,n+1)}),o(r,i+1)]},String(t.props.id??`${r}-${i}`))}),i&&!t.some(e=>e.zone===i)?o(i,0):null]})},mi=(e,n)=>{const t=jr(e),o=Jt(e.type,Ut(Cn?.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)?()=>Fr(e.props.id,r.slot,r.childType,t,e.type):n===c?()=>vr(n,t):void 0;return pi(n,t,o,n===d&&r?r.addLabel:"Add block here")};/* @__PURE__ */
|
|
22
|
+
return ln(sn,{children:[t.map(({child:t,zone:o,index:r})=>{const i=Rt===String(t.props.id),l=er(t),s=String(t.props.id),{collapsible:d,folded:c}=Mr(t,n,Ir(t.type)),p=Rr(t.type),u=1===p.length?`${s}:${p[0]}`:null,f=u?{...Xe(u),index:_o(u).length}:void 0,h=ci.dragging,m=f&&h&&ri(h,f)?f:void 0,y=()=>Vr(o,r,s,e.type),{rowProps:g,...k}=ci.row({item:{id:s,zone:o,index:r,type:t.type},place:{...Xe(o),index:r},into:m,canDrag:!Ht(t.type)},{"data-node-id":s,onClick:zr(y)});/* @__PURE__ */
|
|
23
|
+
return ln(on,{children:[0===r&&a(o,0),
|
|
24
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:t.type,size:13}),name:l,preview:Br(t),marks:Ar(t),onSelect:y,nameSlot:tr(o,r,s,l),selected:i,hidden:Boolean(t.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>ho(s)}:void 0,actions:Ht(t.type)?Pr(t,o,r)??void 0:/* @__PURE__ */ln(sn,{children:[Nr(o,r,l),Pr(t,o,r),Tr(o,r,t,l)]}),rowProps:g}),d&&!c&&/* @__PURE__ */rn(ue,{children:mi(t,n+1)}),a(o,r+1)]},String(t.props.id??`${o}-${r}`))}),r&&!r.fixed&&
|
|
25
|
+
/* @__PURE__ */rn(I,{small:!0,label:r.addLabel,blocked:r.addBlocked?.(i)??null,onAdd:()=>Fr(e.props.id,r.slot,r.childType,i.length,e.type)}),c&&!t.some(e=>e.zone===c)?a(c,0):null]})},yi=(()=>{if(!An||!$t)return null;const e=String(An.type),n=String(An.props.id),t=Jt(e,Ut(Cn?.data,e,n));if(!t||"footer"===t.source)return null;const o=Fo.some(e=>String(e.props?.id)===n),r=Array.isArray(An.props[t.slot])?An.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Wo(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?Qo(e):Wo(e),choices:i,onPick:o=>{t.spec?Fr(n,t.slot,o,r.length,e):Dr(`${n}:${t.slot}`,o,r.length)}}})(),gi=bt||null!==st,ki=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:_n&&!gi&&Dt===e.id,onSelect:()=>Eo(e.id)}:e,Si=[{id:"add",label:"Add",icon:/* @__PURE__ */rn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:bt,onSelect:()=>bt?wr():br(null)},...(Vt.railLead??[]).map(ki),{id:"sections",label:"Layers",icon:/* @__PURE__ */rn(De,{}),active:_n&&!gi&&"sections"===Dt,onSelect:()=>Eo("sections")},...(Vt.railTrail??[]).map(ki)];lt?Si.push({id:"media",label:"Media library",icon:/* @__PURE__ */rn(We,{}),active:_n&&!bt&&(null!==st||"media"===Dt),onSelect:()=>Eo("media")}):wn&&Si.push({id:"media",label:"Media library",icon:/* @__PURE__ */rn(We,{}),onSelect:Lo});const bi=[...Vt.railLead??[],...Vt.railTrail??[]].find(e=>"panel"in e&&e.id===Dt),vi=Boolean(Hn?.foldable)&&!Ft,wi=Hn?.label??(xn?Gn.pageSections:Gn.templateSections),xi=vi&&fo(an),zi=/* @__PURE__ */ln(sn,{children:[Fo.map((e,n)=>{if(Vn(e)||Fn(e)||Mn(e.type))return null;const t=Rt===String(e.props.id),o=Boolean(e.props._hidden);jr(e);const r=String(e.props.id),i=Vt.hasOwnRows?.(e)??!1,l=Lr(e)||i,s=l&&fo(r),{rowProps:d,...c}=ci.row({item:{id:r,zone:N,index:n,type:e.type},place:{...Xe(N),index:n}},{"data-node-id":r,onClick:zr(()=>hr(n))});/* @__PURE__ */
|
|
26
|
+
return ln(on,{children:[n>0&&Or(n),
|
|
27
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:e.type,size:13}),name:Yo(e),preview:Br(e),marks:Ar(e),onSelect:()=>hr(n),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>ho(r)}:void 0,actions:/* @__PURE__ */ln(sn,{children:[Nr(N,n,Yo(e)),Pr(e,N,n),Tr(N,n,e,Yo(e))]}),rowProps:d}),Lr(e)&&!s&&/* @__PURE__ */ln(ue,{children:[mi(e,1),Vt.partRows?.(e,ui)]}),i&&!s&&/* @__PURE__ */rn(ue,{children:Vt.ownRows?.(e,n,ui)})]},String(e.props.id??n))}),!Ft&&Zr>0&&Or(Zr),Hn?.addAtEnd&&!Ft&&!kn&&/* @__PURE__ */rn(I,{small:!0,label:Gn.addSection,blocked:null,onAdd:()=>br(Zr)})]}),Ci=(e,n,t)=>{const o=String(e.props.id),r=jr(e).length>0||Boolean(Jt(e.type)),i=r&&fo(o),l="header"===t?Gn.header:Gn.footer,s=Yt.rowName?Yt.rowName(e,"section",l):l;/* @__PURE__ */
|
|
28
|
+
return ln(sn,{children:[
|
|
29
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:t,size:13}),name:s,preview:Br(e),marks:Ar(e),onSelect:()=>hr(n),selected:Rt===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>ho(o)}:void 0,actions:Pr(e,N,n)??void 0,rowProps:{onClick:zr(()=>hr(n))}}),r&&!i&&/* @__PURE__ */rn(ue,{children:hi(e,1)})]})};return(Vt.wrap??(e=>e))(
|
|
30
|
+
/* @__PURE__ */ln("div",{ref:gt,className:"sf-editor es-editor",style:Te(so),onContextMenu:sr.onEditorContextMenu,children:[
|
|
31
|
+
/* @__PURE__ */ln(be,{children:[
|
|
32
|
+
/* @__PURE__ */rn(ve,{items:Si,ariaLabel:"Left panel views"}),
|
|
33
|
+
/* @__PURE__ */ln(we,{children:[
|
|
34
|
+
/* @__PURE__ */rn(xe,{label:"Undo",disabled:!Bn.hasPast,onClick:()=>Bn.back(),children:/* @__PURE__ */rn(He,{})}),
|
|
35
|
+
/* @__PURE__ */rn(xe,{label:"Redo",disabled:!Bn.hasFuture,onClick:()=>Bn.forward(),children:/* @__PURE__ */rn(Ge,{})}),
|
|
36
|
+
/* @__PURE__ */rn(ze,{}),
|
|
37
|
+
/* @__PURE__ */rn(Ce,{devices:Kn,value:ot,onChange:rt})]}),
|
|
38
|
+
/* @__PURE__ */ln(we,{kind:"right",style:{minWidth:300},children:[
|
|
39
|
+
/* @__PURE__ */rn(dn,{saveState:hn,notSaving:Boolean(kn)||null!=mn,readOnlyReason:Sn,toggle:bn,onToggle:gn,onRetry:yn}),Vt.barLead?.(),
|
|
40
|
+
/* @__PURE__ */rn("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{yt.current=(()=>{const e=kt?.document;if(!e)return null;const n=Fo.findIndex(Fn),t=n>=0?n:Fo.length;let o=null;for(let n=0;n<t;n++){const t=Fo[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=An?.props?.id??Fo[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),mt(e=>e+1)},children:"Refresh"}),Vt.barTrail?.(),Vt.barMain?Vt.barMain():/* @__PURE__ */rn("button",{type:"button",className:"es-btn-primary",disabled:null!==Sn,onClick:()=>{fn(Cn.data)},children:vn?"Publish":"Save"})]})]}),
|
|
41
|
+
/* @__PURE__ */rn(R,{}),
|
|
42
|
+
/* @__PURE__ */ln("div",{className:"sf-body",children:[_n?/* @__PURE__ */ln(sn,{children:[
|
|
43
|
+
/* @__PURE__ */rn("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:bt?/* @__PURE__ */rn(V,{blocks:zt&&zt.zone!==N&&!oi(zt.zone)?ii(zt.zone):yi,blocksOnly:Boolean(zt&&zt.zone!==N&&!oi(zt.zone)),at:zt?{label:(e=>{const n=oi(e.zone);if(n)return`Adding to ${Wo(n.type)}`;if(e.zone===N){const n=Fo[e.index];return n&&!Fn(n)?`Adding before ${Qo(n.type)}`:"Adding at the end of the page"}const t=ii(e.zone);return t?`Adding to ${t.parentName}`:"Adding here"})(zt),onClear:()=>Ct(null)}:void 0,onAdd:e=>{if(zt&&"block"!==e.kind&&oi(zt.zone))return xr(e,zt.zone,zt.index),void Ct({zone:zt.zone,index:zt.index+1});if("section"===e.kind)return(e=>{if(null===Nt)return void kr(e);const n=kr(e,Nt);Bt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Nt)return void Sr(e,n);const t=Sr(e,n,Nt);Bt(t+1)})(e.template.name,d(e.template.node));if(zt&&zt.zone!==N){const n=ii(zt.zone);if(!n)return;return n.target.spec?Fr(n.parentId,n.target.slot,e.type,zt.index,n.parent.type):Dr(zt.zone,e.type,zt.index),void Ct({zone:zt.zone,index:zt.index+1})}yi?.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:di,siteWide:Vt.addPanelRow?.(wr),onClose:wr,onHide:jo,readOnly:Boolean(kn)}):st&&it?
|
|
44
|
+
/* @__PURE__ */rn(H,{panel:it,pick:st,onHide:jo}):bi?bi.panel({onHide:jo,notify:wo}):"media"===Dt&&it?/* @__PURE__ */rn(H,{panel:it,pick:null,onHide:jo}):/* @__PURE__ */ln(sn,{children:[
|
|
45
|
+
/* @__PURE__ */rn(F,{icon:/* @__PURE__ */rn(De,{}),title:"Layers",context:Un,actions:_r.length>0?/* @__PURE__ */rn(Ne,{label:qr?"Expand all sections":"Collapse all sections",onClick:()=>lo(e=>{const n=new Set(_r);return qr?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,..._r])}),children:/* @__PURE__ */rn(cn,{expand:qr})}):void 0,onHide:jo}),
|
|
46
|
+
/* @__PURE__ */ln(fe,{className:"sf-tree sf-scroll",children:[
|
|
47
|
+
/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:"page",size:13}),name:Gn.pageSettings,onSelect:Io,selected:!An&&$t,rowProps:{onClick:zr(Io)}}),Yr&&/* @__PURE__ */ln(sn,{children:[
|
|
48
|
+
/* @__PURE__ */rn(he,{children:Gn.header}),fi(Yr)]}),!Ft&&zn&&/* @__PURE__ */ln(sn,{children:[
|
|
49
|
+
/* @__PURE__ */rn(he,{children:Gn.header}),!Dn&&/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:"header",size:13}),name:Gn.header,onSelect:Vo,selected:Tt.kind===In?.kind,rowProps:{onClick:zr(Vo)}})]}),!Ft&&Qr&&Ci(Qr,Jr,"header"),!Ft&&!vi&&/* @__PURE__ */rn(he,{children:wi}),vi?/* @__PURE__ */ln(sn,{children:[
|
|
50
|
+
/* @__PURE__ */rn(pe,{icon:null,name:wi,fold:{open:!xi,label:wi,onToggle:()=>ho(an)}}),!xi&&/* @__PURE__ */rn(ue,{children:zi})]}):zi,zn&&/* @__PURE__ */rn(he,{children:Gn.footer}),Wr&&Ci(Wr,Ur,"footer"),!Ft&&!Wr&&zn&&/* @__PURE__ */rn(pe,{icon:/* @__PURE__ */rn(Zt,{type:"footer",size:13}),name:Gn.footer,onSelect:Cr,rowProps:{onClick:zr(Cr),title:"Edit the site footer"}}),Xr&&fi(Xr),Vt.treeFoot?.()]})]})}),
|
|
51
|
+
/* @__PURE__ */rn(Be,{side:"left",width:so.left,min:Pe,max:Ae,defaultWidth:S.left,label:"Resize Sections panel",onResize:po})]}):/* @__PURE__ */rn(D,{side:"left",onShow:jo}),
|
|
52
|
+
/* @__PURE__ */rn("div",{ref:xo,className:"sf-center sf-scroll",style:{overflowX:Oo?"auto":"hidden",overflowY:"hidden"},children:/* @__PURE__ */rn("div",{className:"sf-frame-scaler",style:$o,children:/* @__PURE__ */rn("div",{className:"sf-frame "+(ot===tt?"":`sf-frame--${ot}`),style:Ro,children:/* @__PURE__ */ln("div",{className:"sf-preview-host",children:[
|
|
53
|
+
/* @__PURE__ */rn(Wn,{},ht),
|
|
54
|
+
/* @__PURE__ */rn(je,{canvas:kt,session:di,model:ai,canDrop:ri,onDrop:si,onPick:e=>{Ot(_),Xn.select(e.zone===N?{index:e.index}:{index:e.index,zone:e.zone})},onZoneAdd:e=>vr(Ye(e),0),readOnly:Boolean(kn),revision:Cn.data}),At.length>0&&/* @__PURE__ */rn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:At.map(e=>/* @__PURE__ */ln("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>br(e.index),children:[
|
|
55
|
+
/* @__PURE__ */rn("span",{className:"sf-preview-gap-line"}),
|
|
56
|
+
/* @__PURE__ */ln("span",{className:"sf-preview-gap-pill",children:[
|
|
57
|
+
/* @__PURE__ */rn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
58
|
+
/* @__PURE__ */rn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})}),qn?/* @__PURE__ */ln(sn,{children:[
|
|
59
|
+
/* @__PURE__ */rn(g,{value:{selectChild:Vr,addChild:Fr,childRowName:er,blockRowName:Kr},children:/* @__PURE__ */rn(Jn,{mode:Tt,onOpenWebsiteSettings:Vt.openSettings??(()=>{}),onOpenSiteStyles:Vt.openStyles,onSelectNode:eo,onNotify:wo,onHidePanel:Mo,nodeActions:An?B(Tn,An.type):pn})}),
|
|
60
|
+
/* @__PURE__ */rn(Be,{side:"right",width:so.right,min:Pe,max:Ae,defaultWidth:S.right,label:"Resize settings panel",onResize:uo})]}):
|
|
61
|
+
/* @__PURE__ */rn(D,{side:"right",onShow:Mo})]}),go&&/* @__PURE__ */ln("div",{className:"sf-toast "+("error"===go.tone?"sf-toast--error":""),role:"status",children:[
|
|
62
|
+
/* @__PURE__ */rn("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===go.tone?"!":"✓"}),go.msg]},So),sr.menu]}))}export{un as ScreenChrome};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-Z6BAZFSW.js";import{EaselCanvas as e,useSelectedFields as t}from"./chunk-P67FP7PG.js";import{Inspector as r}from"./chunk-BXZ6WLHC.js";import{DesktopIcon as i}from"./chunk-L5KW4HG5.js";import{createContext as o,useContext as u}from"react";import{jsx as l}from"react/jsx-runtime";var s={kind:"puck"};function c(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function f(n,e){return n.isLast?n.isLast(e):e.type===n.last}var d={},p=()=>d,k=()=>"",m=()=>null,h=()=>{},v={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},b={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},g={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */l(i,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},y={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function j(){/* @__PURE__ */
|
|
2
|
+
return l(e,{height:"fill"})}function w(){const{id:n,fields:e,values:i,readOnly:o,onChange:u}=t();/* @__PURE__ */
|
|
3
|
+
return l("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */l(r,{fields:e,values:i,onChange:u,readOnly:o,idPrefix:n})})}var O=o({});function S({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return l(O.Provider,{value:n,children:e})}function P(){return u(O)}function B(){return(P().useOwnerName??k)()}function G(){return(P().useDocumentLabel??m)()}function F(n,e,t,r){return(P().useBridges??p)(n,e,t,r)}function x(n){return(P().useStandaloneBridges??p)(n)}function C(n,e){(P().useDocumentPass??h)(n,e)}function D(){return P().blockRules??v}function N(){return P().blockLook??b}function Z(){return P().devices??g}function A(){return P().leftView??y}function I(){return P().pinned??L}function T(){return P().saveSwitch??!0}function W(e){n(!0===P().pickFollowsSelection,e)}function H(){return P().Canvas??j}function R(){return P().Inspector??w}export{s as SELECTION_MODE,S as ScreenPartsProvider,a as isPinnedFirst,f as isPinnedLast,c as sameInspectorMode,N as useScreenBlockLook,D as useScreenBlockRules,F as useScreenBridges,H as useScreenCanvasFrame,Z as useScreenDevices,G as useScreenDocumentLabel,C as useScreenDocumentPass,R as useScreenInspectorPanel,A as useScreenLeftView,B as useScreenOwnerName,P as useScreenParts,W as useScreenPickFollowsSelection,I as useScreenPinned,T as useScreenSaveSwitch,x as useStandaloneScreenBridges};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,t){const e=n.components?.[t]?.fields??{};return Object.keys(e).filter(n=>"slot"===e[n]?.type)}function t(n,t){const e=n.components?.[t]?.permissions;return{duplicate:!1!==e?.duplicate,delete:!1!==e?.delete}}function e(t,e){return n(t,e.type).flatMap(n=>(Array.isArray(e.props[n])?e.props[n]:[]).map((t,r)=>({child:t,zone:`${e.props.id}:${n}`,index:r})))}function r(n,t,r){const o=(t,i,u,p)=>{if(!t||"object"!=typeof t||!t.props)return null;if(t.props.id===r)return{item:t,zone:i,index:u};if(p>=12)return null;for(const{child:r,zone:i,index:u}of e(n,t)){const n=o(r,i,u,p+1);if(n)return n}return null};for(let n=0;n<t.length;n+=1){const e=o(t[n],c,n,0);if(e)return e}return null}var o=6;function i(t,e,r){return r<6&&n(t,e).length>0}var u=n=>`${n}-${crypto.randomUUID()}`,p="Header",s="Footer",c="root:default-zone",f=[p,s];function l(n){const t=/* @__PURE__ */new Set,e=[];return n.forEach((n,r)=>{const o=n?.type;void 0!==o&&f.includes(o)&&(t.has(o)?e.push(r):t.add(o))}),e}function d(n){return l(n).map(t=>n[t]?.props?.id).filter(n=>"string"==typeof n)}function a(n,t){const e=(n,t)=>n.some(n=>n?.type===t);return f.filter(r=>!e(n,r)&&!e(t,r))}export{s as FOOTER_TYPE,p as HEADER_TYPE,c as ROOT_ZONE,o as TREE_MAX_DEPTH,t as blockNodeActions,e as childSlotsOf,r as locateNode,a as missingPinnedTypes,i as nestsInTree,u as newNodeId,d as pinnedDuplicateIds,l as pinnedDuplicateIndices,n as slotFieldsOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{newNodeId as e,ROOT_ZONE as t}from"./chunk-7GVLSNFW.js";import{useScreenBlockRules as n}from"./chunk-7755VWRT.js";import{useEasel as o,useEaselApi as r}from"./chunk-P67FP7PG.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=n().resolveOnInsert,m=!0===(i.resolveOnInsert??a);return s(()=>{const n=(t,n,o)=>{const r=e(n);return c||p({type:"insert",componentType:n,destinationZone:t,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=(e,t,r)=>o(n(e,t,r));return{insertComponent:s,insertSection:(e,n)=>s(t,e,n),replaceComponent:r,seedChild:(e,t,s,i)=>{const p=n(e,s,t);r(e,t,{type:s,props:{id:p,...i}}),o(p)},insertNode:(e,t,s)=>{const i=n(e,s.type,t);return r(e,t,{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=>{c||p({type:"setData",data:()=>e,recordHistory:!0})}}},[p,c,m,d])}export{i as useSectionOps};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{clientOnly as e}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-
|
|
1
|
+
import{clientOnly as e}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-YODRYAZX.js";import{ScreenChrome as r}from"./chunk-5D2XAZKH.js";import{ScreenDocumentProvider as t,useScreenDocument as a}from"./chunk-LRTIMWZG.js";import{DEFAULT_SCREEN_WORDS as i}from"./chunk-LEGAPYPC.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
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
3
|
/* @__PURE__ */c("h2",{id:"sf-leave-title",className:"text-[15px] font-semibold text-zinc-900",children:"Unsaved changes"}),
|
|
4
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."}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-RSCMJIWS.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},a=e=>s(e).sectionTemplates??t,n=e=>({list:()=>a(e).list(),get:s=>a(e).get(s),ensure:(s,r,t)=>a(e).ensure(s,r,t),save:(s,r)=>a(e).save(s,r),update:(s,r)=>a(e).update(s,r),rename:(s,r)=>a(e).rename(s,r),remove:s=>a(e).remove(s)}),o=n();function m(e){return e.cache("easel:section-templates",()=>n(e))}export{o as sectionTemplates,m as sectionTemplatesOf};
|
|
@@ -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{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as c}from"./chunk-IWAPPEL4.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as d}from"./chunk-7755VWRT.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 O({blocks:O,blocksOnly:I,at:L,onAdd:P,itemFor:D,session:G,siteWide:S,onClose:T,onHide:x,readOnly:B}){const C=m(e=>e.config),F=p(),{labelAtLevel:H,categoryLabel:N,firstSection:V,Icon:W,Thumbnail:E}=F,{blockIsOffered:Q}=d(),R=l(),[w,z]=h([]);k(()=>{let t=!1;const o=e=>Q(e,R);return s(R).list().then(n=>{if(t)return;const r=C.components;z(n.filter(t=>t.node?.type&&r[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[C,R]);const J=y(()=>t(C,F),[C]),K=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)}),Y=y(()=>{const e=[];if(O&&O.choices.length>0&&a(O.choices).forEach((t,o)=>{e.push({title:0===o?`Inside ${O.parentName}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:A(e.type),label:e.label,icon:/* @__PURE__ */b(W,{type:e.type,size:18}),title:`Add ${e.label}`}))})}),I)return e;const t=o(J,V);t&&e.push({title:"Start blank",tiles:[K(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",C.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,V);for(const t of Object.keys(C.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({title:r(C,t,N),tiles:o.map(K)})}return e},[O,I,w,J,C]),Z=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:I?"Blocks for this place":"Sections and blocks",actions:/* @__PURE__ */b(c,{label:"Done",description:"Close Add and go back",onClick:T}),onHide:x}),
|
|
4
|
+
/* @__PURE__ */g("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */b(u,{groups:Y,session:G,itemFor:e=>D(Z(e)??{kind:"section",type:e}),onInsert:e=>{const t=Z(e);t&&P(t)},at:L,hint:I?"Drag into the page, or click to add.":"Drag onto the page, or click to add.",searchLabel:I?"Search blocks":"Search sections",readOnly:B}),S&&!I?S:null]})]})}export{O as AddSidePanel,A as blockKey,$ as sectionKey,v as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isBackendError as e,readHostFailure as s,STATUS_UNREACHABLE as t,hostUnreachableMessage as n,hostLoadRefusalOf as a}from"./chunk-KCOBHPN6.js";var i={unauthorized:"the editor's sign-in was refused (unauthorized).","changed-elsewhere":"the page changed while it was being opened (changed-elsewhere).","lock-taken":"somebody else holds this page (lock-taken).","not-found":"this page no longer exists (not-found).",invalid:"the backend refused the request (invalid).",unavailable:"the backend could not be reached (unavailable)."};function o(a,r){if(e(a))return s(a.cause,r)?o(a.cause,r):`${i[a.kind]} ${a.message}`.trim();const u=s(a,r);return u?u.status===t?`${n(r)} (no response)`:401===u.status||403===u.status?`the editor's sign-in was refused (${u.status}). Reload the console and open the editor again; if it keeps happening the bridged token is not valid for this site.`:404===u.status?"this page no longer exists (404).":u.status>=500?`the server failed (${u.status}). ${u.message}`:`the server refused the request (${u.status}). ${u.message}`:a instanceof Error?`${a.name}: ${a.message}`:String(a)}function r(e,s,t){return a(e,s,t)}export{o as describeLoadFailure,r as hostLoadRefusal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ROOT_ZONE as e}from"./chunk-7GVLSNFW.js";import{styleMenuItems as n}from"./chunk-57DJOKXT.js";import{useEaselSession as t}from"./chunk-O7Q4DDJT.js";import{EaselContextMenu as o}from"./chunk-KTVH2ZRL.js";import{createNodeClipboard as i,nodeMenuItems as l}from"./chunk-2LK54I4E.js";import{useCanvasEvent as c}from"./chunk-PAELDYYS.js";import{framePointToHost as r}from"./chunk-ZNCEOSXO.js";import{UndoIcon as s,RedoIcon as a,AddIcon as d,PasteIcon as p,SettingsIcon as u,LayersIcon as f,CopyIcon as m}from"./chunk-L5KW4HG5.js";import{zoneKey as h,ROOT_SLOT as k,ROOT_ID as y}from"./chunk-KRXQM65X.js";import{useState as b,useCallback as v}from"react";import{jsx as x}from"react/jsx-runtime";function C(n,t){const o=[],i=/* @__PURE__ */new Set;let l={zone:t.zone,index:t.index};for(;l;){const t=n.nodeAt(l.zone,l.index);if(!t||i.has(t.props.id))break;if(i.add(t.props.id),o.push({zone:l.zone,index:l.index,node:t,parentType:null}),l.zone===e)break;const c=l.zone.lastIndexOf(":");if(c<=0)break;l=n.locate(l.zone.slice(0,c))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var g=i(),P=/* @__PURE__ */new WeakMap;function A(e){if(e.claimsPage)return g;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=P.get(n);return t||(t=i(),P.set(n,t)),t}function O(){return A(t())}function T(n,t,o){if(t===e){const{floor:e,cap:t}=n.sectionBand();return{parentId:y,slot:k,index:Math.min(Math.max(o,e),t)}}const i=t.lastIndexOf(":");return{parentId:t.slice(0,i),slot:t.slice(i+1),index:o}}function w(e,t){const{zone:o,index:i}=t,c=e.nodeAt(o,i);if(!c)return[];const r=c.props.id,s=e.labelOf(c.type,o),a=Boolean(c.props._hidden),d=e.nodeOps,p=e.isPinned(c,o),u=e.isLocked(c),f=!p&&!u&&!e.duplicateBlocked(c),m=e.permits?.(c)??{duplicate:!0,delete:!0},k=C(e,t),y=d.held,b=y&&!p&&h(y.from)===o?T(e,o,i+1):null,v=e.style?n({held:e.style.held(),canCopy:e.style.canCopy(c,o),onCopy:()=>e.style?.copy(c,o),onPaste:()=>e.style?.paste(o,i,c)}):[];return l({title:s,layer:{group:"pick",items:k.map((n,t)=>({label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)}))},actions:{addInside:e.canAddTo(c.type)?()=>e.openAddInside(o,i):void 0,duplicate:f&&m.duplicate?()=>d.duplicate(r):void 0,moveUp:d.canStep(r,-1)?()=>d.step(r,-1):void 0,moveDown:d.canStep(r,1)?()=>d.step(r,1):void 0,copy:!p&&m.duplicate?()=>d.copy(r,s):void 0,cut:f&&m.duplicate&&m.delete?()=>d.cut(r,s):void 0,paste:y&&b?{label:y.label,run:()=>d.paste(b)}:void 0,rename:e.renamePropOf(c,o)?()=>e.beginRename(o,i):void 0,hide:u||p?void 0:{hidden:a,run:()=>d.setProps(r,{_hidden:!a})},delete:f&&m.delete?()=>d.remove(r):void 0},style:v,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function z(n){const t=[];n.history.hasPast&&t.push({label:"Undo",icon:/* @__PURE__ */x(s,{}),shortcut:"⌘Z",onClick:n.history.back}),n.history.hasFuture&&t.push({label:"Redo",icon:/* @__PURE__ */x(a,{}),shortcut:"⇧⌘Z",onClick:n.history.forward});const o=[{label:"Add section",icon:/* @__PURE__ */x(d,{}),onClick:n.openAddSection}],i=n.nodeOps.held;if(i&&h(i.from)===e){const t=T(n,e,n.sectionBand().cap);o.push({label:`Paste ${i.label}`,icon:/* @__PURE__ */x(p,{}),shortcut:"⌘V",onClick:()=>n.nodeOps.paste(t)})}const l=[t,o,[{label:"Page settings",icon:/* @__PURE__ */x(u,{}),onClick:n.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */x(f,{}),onClick:n.collapseAll}]].filter(e=>e.length>0),c={label:"—",onClick:()=>{}};return l.flatMap((e,n)=>n?[c,...e]:e)}function j(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,i=n.value.slice(t,o),l=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=[];i&&(c.push({label:"Copy",icon:/* @__PURE__ */x(m,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(i)}),c.push({label:"Cut",icon:/* @__PURE__ */x(m,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(i),l("")}})),c.push({label:"Paste",icon:/* @__PURE__ */x(p,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&l(e)}).catch(()=>e.onPasteRefused())}});const r=[c,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return r.flatMap((e,n)=>n?[s,...e]:e)}function M(e){return e.shiftKey}function S(e,n){const[t,i]=b(null),l=v(()=>i(null),[]),s=v(n=>{if(M(n))return;const t=n.target,o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void i({kind:"input",x:n.clientX,y:n.clientY,el:o});const l=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),c=l?e.locate(l):null;n.preventDefault(),i(c?{kind:"node",x:n.clientX,y:n.clientY,...c}:{kind:"empty",x:n.clientX,y:n.clientY})},[e]);c(n,"contextmenu",t=>{if(M(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,l=o?.getAttribute("data-puck-component"),c=l?e.locate(l):null;t.preventDefault();const s=r(n.frame,t.clientX,t.clientY);i(c?{kind:"node",...s,...c}:{kind:"empty",...s})}),c(n,"mousedown",l),c(n,"scroll",l,{on:"window"});return{onEditorContextMenu:s,menu:t?/* @__PURE__ */x(o,{x:t.x,y:t.y,items:"node"===t.kind?w(e,t):"input"===t.kind?j(e,t.el):z(e),onClose:l}):null,closeMenu:l}}export{g as EASEL_NODE_CLIPBOARD,C as ancestorChain,A as nodeClipboardOf,w as nodeMenuItems,z as pageMenuItems,j as textMenuItems,O as useNodeClipboard,S as useNodeContextMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class extends Error{kind;conflict;holder;fields;constructor(e,r,s={}){super(r??n[e],void 0===s.cause?void 0:{cause:s.cause}),this.name="WebsiteBackendError",this.kind=e,this.conflict=s.conflict,this.holder=s.holder,this.fields=s.fields}},n={unauthorized:"The editor's sign-in was refused.","changed-elsewhere":"This page was changed somewhere else.","lock-taken":"Somebody else is editing this page.","not-found":"This no longer exists.",invalid:"The request was refused.",unavailable:"The server could not be reached."};function r(e,n){if(!e||"object"!=typeof e)return!1;const r=e;return"WebsiteBackendError"===r.name&&"string"==typeof r.kind&&(void 0===n||r.kind===n)}var s=0,i=null;function
|
|
1
|
+
var e=class extends Error{kind;conflict;holder;fields;constructor(e,r,s={}){super(r??n[e],void 0===s.cause?void 0:{cause:s.cause}),this.name="WebsiteBackendError",this.kind=e,this.conflict=s.conflict,this.holder=s.holder,this.fields=s.fields}},n={unauthorized:"The editor's sign-in was refused.","changed-elsewhere":"This page was changed somewhere else.","lock-taken":"Somebody else is editing this page.","not-found":"This no longer exists.",invalid:"The request was refused.",unavailable:"The server could not be reached."};function r(e,n){if(!e||"object"!=typeof e)return!1;const r=e;return"WebsiteBackendError"===r.name&&"string"==typeof r.kind&&(void 0===n||r.kind===n)}var s=0,i=null,o=e=>e?.hostFailures??i;function t(e){i=e}function a(e,n){return o(n)?.read(e)??null}function d(e,n,r){return o(r)?.loadRefusal?.(e,n)??null}function l(e){return o(e)?.unreachableMessage??"The server could not be reached."}export{s as STATUS_UNREACHABLE,e as WebsiteBackendError,d as hostLoadRefusalOf,l as hostUnreachableMessage,r as isBackendError,t as provideHostFailures,a as readHostFailure};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{applyEaselChromeTheme as e}from"./chunk-3WSPDAK2.js";import{useEaselSession as t}from"./chunk-O7Q4DDJT.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-RSCMJIWS.js";import{useEaselHost as o}from"./chunk-R5ZVNJLJ.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No storefront page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Template · Home page",templateSections:"Template · Template",addSection:"Add section",addSectionBefore:({name:e})=>`Add section before ${e}`,addSectionHere:"Add section here"};export{e as DEFAULT_SCREEN_WORDS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-QDEZQ5A6.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-ZOJEFIP4.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-4EUWOGZF.js";import{useAdminBridge as i}from"./chunk-KVNRNDUC.js";import{useEaselSession as c}from"./chunk-O7Q4DDJT.js";import{backendOf as l,setSessionDocumentSite as d}from"./chunk-RSCMJIWS.js";import{useEaselHost as f}from"./chunk-R5ZVNJLJ.js";import{DEFAULT_SCREEN_WORDS as g}from"./chunk-LEGAPYPC.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 P,useEffect as j,useRef as E}from"react";import{jsx as R}from"react/jsx-runtime";var C={content:[],root:{},zones:{}};var O=w(null);function B(){const e=S(O);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function D({target:w,addressing:S=o,onHostMessage:B,children:D}){const A=S,{homeSlug:L,entryMayBounce:T,entryBounce:F,onSwitch:H,tellsHost:M,adapterFor:N,migrateRenamedProps:J,describeMissing:V,onLoadFailed:W}=A,[U,Y]=b(w),G=f(),Q=c(),Z=I(()=>l(Q),[Q]),x=I(()=>t(Q),[Q]),K="template"===U.kind,X="template"===U.kind?U.id:null,z="template"===U.kind?U.pageSlug??L??"":"document"===U.kind?U.slug??"":U.slug,_="page"===U.kind?U.siteId??null:null,q=Q.blocks,$=I(()=>N(U,Z,q),[N,Z,q,U.kind,"template"===U.kind?U.id:"document"===U.kind?U.record:U.siteId]),ee=$.capabilities,re=P(e=>Q.documentHooks?.stored?.(e)??e,[Q]),ne="page"===U.kind?U.originSlug??null:null;j(()=>{d(Q,_)},[Q,_]);const te=E(U);j(()=>{te.current=U},[U]);const{token:oe,tokenRef:ue,capabilities:ae}=i({onMessage:r=>{if(B?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Sr(e.target)}}}),se=!Q.usesBridgedToken||null!==oe,ie=$.lock,ce=Boolean(Z.lock),[le,de]=b(null),[fe,ge]=b(null),[ke,me]=b(null),[ve,pe]=b(null),he=y("screen",g),ye=ve?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})}}(ve,he):null,[we,Se]=b(null),be=E(null),Ie=E(null),[Pe,je]=b(!1),Ee=E(null),[Re,Ce]=b(null),Oe=E(null),[Be,De]=b(null),Ae=E(null);j(()=>{Ae.current=Be},[Be]);const[Le,Te]=b(ee.hasEditLock?{kind:"checking"}:{kind:"editing"}),Fe=E(Le);j(()=>{Fe.current=Le},[Le]);const He=E(()=>Promise.resolve(!1)),Me=P(e=>{Ie.current=e,je(!0)},[]),Ne=k({save:async({id:e,data:r})=>{if(m(Fe.current)){if(!await He.current(e,r)){if(!m(Fe.current))return void Me({id:e,data:r});throw new Error("page save did not land")}}else Me({id:e,data:r})},onFailure:(e,r)=>{0===r&&G.send("storefront-editor:save-failed")}}),{state:Je,push:Ve,flush:We,pause:Ue,resume:Ye,stop:Ge,reset:Qe,retryNow:Ze,hasPending:xe}=Ne,Ke=E(Je);j(()=>{Ke.current=Je},[Je]);const Xe=u(Je),ze=P(()=>{const e=Ie.current;e&&(Ie.current=null,je(!1),Ve(e))},[Ve]),_e=E("");_e.current||(_e.current=v());const[qe,$e]=b(0),er=E(!1),[rr,nr]=b(T(w)),tr=E(!1);j(()=>{if(tr.current)return;tr.current=!0;const e=G.address.search(),r=F(w,e);r?G.address.load(r):T(w)&&nr(!1)},[w,G]);const or=G.send;j(()=>{if(!se)return;let e=!1;const t=te.current,o=$.resolve(z),u=Q.documentHooks?.opening?.({slug:z,isTemplate:K,capabilities:ee});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==L&&z!==L?void G.address.load({kind:"page",slug:L,siteId:_??void 0}):(pe({target:t,slug:z,missing:!0,sentence:V?.(t)??null}),void W?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;be.current=n,Se(n),de(r.id),ge(r.kind??null),Oe.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:C,s=J(a),i=u?await u(s):s;e||me(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),pe({target:t,slug:z,missing:!1,sentence:n(o,{slug:z},Q),cause:r(o,Q)}),W?.(t,o))}),()=>{e=!0}},[se,oe,K,$,z]);const ur=P(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ue.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),ar=P(async e=>{const r=ue.current;if(!r&&Q.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,Q)){or("storefront-editor:auth-expired");const n=r?await ur(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[or,ur,Q]),sr=P(async e=>{const r=ue.current?await ar(e):{ok:!1};return r.ok||or("storefront-editor:save-failed"),r.ok},[or,ar]),ir=P(async(e,r,n=!1)=>{if(null!==be.current)return!1;if(!m(Fe.current))return!1;if(Ae.current)return!1;const t=await ar(()=>$.saveLayout(e,r,Oe.current,_e.current));if(t.ok)return Oe.current=t.value.version??Oe.current,!0;const o=x.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Fe.current=e,Te(e),!1}const u=x.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&$.rereadVersion){const n=await ar(()=>$.rereadVersion(e));if(n.ok&&n.value)return Oe.current=n.value,He.current(e,r,!0)}Ge(),Ae.current=u,De(u)}return!1},[$,ar,Ge]);j(()=>{He.current=ir},[ir]);const cr=P(e=>{if(null!==be.current)return;if(or("storefront-editor:dirty"),!le)return;const r=re(e);Ee.current=r,m(Fe.current)?Ve({id:le,data:r}):Me({id:le,data:r})},[le,or,Me,Ve,re]),lr=P(async()=>{m(Fe.current)&&ze();return await We()&&null==Ie.current},[ze,We]),dr=E(lr);j(()=>{dr.current=lr},[lr]);const fr=E(ar);j(()=>{fr.current=ar},[ar]);const gr=P(()=>{G.address.reload()},[G]),kr=E(()=>Promise.resolve(!1));j(()=>{kr.current=()=>{const e=$.rereadVersion;return le&&e?p({ours:Oe.current,stored:async()=>{const r=await fr.current(()=>e(le));return r.ok?r.value:null},hasPending:()=>null!=Ie.current||xe(),reload:gr}):Promise.resolve(!1)}},[$,le,xe,gr]);const mr=null!==we;j(()=>{if(!ie||!le||!se||mr)return;let e=!1,r=null;const n=_e.current,t=x.makeClaimBeat({claim:async e=>{const r=await fr.current(()=>ie.claim(le,n,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Fe.current,heldWrite:()=>({pending:null!=Ie.current||xe(),autoSaveEnabled:!Ke.current.paused,saveConflict:null!=Ae.current}),setAccess:e=>{Fe.current=e,Te(e)},releaseHeldWrite:()=>{dr.current()},startHeartbeat:e=>{r=setInterval(()=>{t(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{kr.current()}}),o=er.current;return er.current=!1,o||Te({kind:"checking"}),t(o),()=>{e=!0,r&&clearInterval(r),ie.release(le,n).catch(()=>{})}},[le,ie,se,oe,qe,mr]);const vr=P(()=>{ie&&le&&(er.current=!0,$e(e=>e+1))},[le,ie]),pr=P(()=>{Te(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),hr=P(()=>{Ke.current.paused?(m(Fe.current)&&ze(),Ye()):Ue()},[ze,Ue,Ye]),yr=P(()=>{Ze()},[Ze]),wr=P(e=>{Ee.current=null,a("template"!==e.kind&&ce,{resetAutosave:()=>{Qe(),Ie.current=null,je(!1)},setVersion:e=>{Oe.current=e},setSaveConflict:De,setAccess:Te}),H(e),Y(e),be.current=null,Se(null),de(null),ge(null),me(null),pe(null),G.address.show(e),"document"!==e.kind&&M(e)&&G.send("storefront-editor:navigated",{target:e})},[Qe,G,ce,H,M]),Sr=P(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,te.current,L))return;const r=null!=Ie.current;if(!r&&!xe())return void wr(e);const n=Ke.current;r||n.paused||n.failed||n.stopped?Ce(e):We().then(r=>{r?wr(e):Ce(e)})},[wr,xe,We,L]),br=P(()=>Ce(null),[]),Ir=P(()=>{Ce(e=>(e&&wr(e),null))},[wr]),Pr=P(async()=>{const e=Re;if(!e)return;await lr()&&(Ce(null),wr(e))},[Re,lr,wr]),jr=P(async e=>{if(null!==be.current)return;if(!le)return;if(!m(Fe.current)||Ae.current)return;const r=re(e);if(!await ir(le,r))return void(Ae.current||or("storefront-editor:save-failed"));const n=$.publish;if(!ee.canPublish||!n)return void or("storefront-editor:saved");const t=await ar(()=>n(le,Oe.current??void 0));t.ok?(Oe.current=t.value.version??Oe.current,or("storefront-editor:published")):or("storefront-editor:save-failed")},[le,$,ee.canPublish,or,ir,ar,re]);/* @__PURE__ */
|
|
2
|
+
return R(O.Provider,{value:{target:U,adapter:$,capabilities:ee,templateId:X,currentSlug:z,currentKind:fe,siteId:_,ready:se,token:oe,tokenRef:ue,notifyParent:or,bridgeCapabilities:ae,runAuthed:sr,docId:le,data:ke,getLiveData:()=>Ee.current??ke,footerOriginSlug:ne,error:ye,redirecting:rr,saveStatus:Xe,saveState:Je,autoSaveEnabled:!Je.paused,autoSaveStoppedByConflict:Je.stopped,hasUnsavedEdits:Je.pending||Pe,toggleAutoSave:hr,retrySave:yr,onChange:cr,flushSave:lr,onPublish:jr,access:Le,readOnly:null!==h(Le)||null!==we,readOnlyReason:we,takeOverEditing:vr,viewReadOnly:pr,saveConflict:Be,reloadFromServer:gr,navigate:Sr,pendingNav:Re,cancelPendingNav:br,discardAndNavigate:Ir,saveAndNavigate:Pr},children:D})}export{O as ScreenDocumentContext,D as ScreenDocumentProvider,B as useScreenDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-LRTIMWZG.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-LEGAPYPC.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,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-7755VWRT.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:[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{activateEaselSession as r,deactivateEaselSession as n,currentEaselSession as e}from"./chunk-
|
|
1
|
+
import{activateEaselSession as r,deactivateEaselSession as n,currentEaselSession as e}from"./chunk-RSCMJIWS.js";import{createContext as o,useEffect as t,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";var c=o(null);function m({session:e,children:o}){return r(e),t(()=>(r(e),()=>n(e)),[e]),/* @__PURE__ */u(c.Provider,{value:e,children:o})}function f(){return i(c)??e()}export{m as EaselSessionProvider,f as useEaselSession};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-7755VWRT.js";import{settlePanelPick as n}from"./chunk-Z6BAZFSW.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=e();/* @__PURE__ */
|
|
2
|
+
return o(r,{children:[
|
|
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
|
+
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -1 +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-
|
|
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-LEGAPYPC.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},P=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:P(n)?t[m]=P(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveMediaPick as e}from"./chunk-
|
|
1
|
+
import{resolveMediaPick as e}from"./chunk-UB7JVPK4.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{textFieldIdentifier as n}from"./chunk-DUVRZ456.js";import{hidableText as r}from"./chunk-6W7WLPZH.js";function t(n,t){const o=r(n.props.name);if(o)return o;const e=r(n.props.altName);if(e)return e;const c=n.props.collection?.name;if(c)return c;const u=n.props.source?.title;if(u)return u;const s=n.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(r){if(!r)return null;for(const t of["name","altName"])if(n(r[t]))return t;return null}function c(n,t,o){const e=r(n.props?.name).trim()||t;return o?o(n,"section",e):e}export{c as rootRowName,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{newNodeId as t}from"./chunk-
|
|
1
|
+
import{newNodeId as t}from"./chunk-7GVLSNFW.js";function o(t){return{root:{props:{}},content:[t],zones:{}}}function n(t){return(t.content??[])[0]??null}function r(t){return Array.isArray(t)&&t.length>0&&t.every(t=>!!t&&"object"==typeof t&&"string"==typeof t.type&&"object"==typeof t.props)}function e(o){const n={...o.props,id:t(o.type)};for(const[t,o]of Object.entries(n))r(o)&&(n[t]=o.map(e));return{type:o.type,props:n}}export{e as cloneNodeWithFreshIds,n as docToNode,o as nodeToDoc};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=/* @__PURE__ */Symbol.for("efficient-web.efficient-backend");function n(n){return!!n&&!0===n[e]}function t(e){return e?.trim()||null}var r=null,i=/* @__PURE__ */new WeakMap,o=/* @__PURE__ */new WeakMap;function l(e){r=e}function u(e=k()){if(e.hostBackend)return e.hostBackend;let n=i.get(e);if(!n){const t=o.get(e)??r;if(!t)throw new Error("efficient-web-builder: this editor was given no backend, and its host named no default one. Pass `backend`, or load the host's default backend first (the storefront's is lib/efficient-backend).");n=t(e),i.set(e,n)}return n}function s(e){if(!e.registry)throw new Error("efficient-web-builder: this editor was mounted with no block registry. Pass `registry` to createEditorSession (the storefront's is lib/puck/config).");return e.registry}function d(e={}){const t=e.backend??null,r=null===t?e.defaultBackend??null:null,i=/* @__PURE__ */new Map,l={documentId:null,bridgedId:null},s={hostBackend:t,usesBridgedToken:null===t||n(t),blocks:e.blocks??null,registry:e.registry??null,chrome:e.chrome??null,documentHooks:e.documentHooks??null,claimsPage:e.claimsPage??!0,hostFailures:e.hostFailures??null,auth:{token:null,brandId:null},site:l,siteId:()=>l.documentId??l.bridgedId,cache:(e,n)=>(i.has(e)||i.set(e,n()),i.get(e)),forget(e){void 0===e?i.clear():i.delete(e)}};return r&&(o.set(s,r),Object.defineProperty(s,"usesBridgedToken",{get:()=>n(u(s)),enumerable:!0})),s}function c(e,n){e.site.documentId=t(n)}function a(e,n){e.site.bridgedId=t(n)}var f=d(),b=null,g=/* @__PURE__ */new Set;function k(){return b??f}function h(e){e.claimsPage&&(g.delete(e),b=e)}function m(e){e.claimsPage&&(g.add(e),queueMicrotask(()=>{g.delete(e)&&b===e&&(b=null)}))}function w(){return k().usesBridgedToken}function y(){f=d()}export{e as EFFICIENT_BACKEND,h as activateEaselSession,u as backendOf,d as createEaselSession,k as currentEaselSession,m as deactivateEaselSession,w as efficientClientOpen,n as isEfficientBackend,l as provideDefaultBackend,y as resetAmbientEaselSession,s as sessionRegistry,a as setSessionBridgedSite,c as setSessionDocumentSite};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-A2LFBOUF.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-7755VWRT.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 @@
|
|
|
1
|
+
import{mediaPickStoreFor as e}from"./chunk-Z6BAZFSW.js";var t=/* @__PURE__ */new Map,n=0;function o(o,i){if(!o.connected)return Promise.resolve(null);const r=(n+=1,`mp-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():String(n)}`),c=e(o);return c?c.request({requestId:r,accept:i.accept,title:i.title,file:i.file??null,...i.options?{options:i.options}:{}}):new Promise(e=>{t.set(r,e),o.send("storefront-editor:open-media-picker",{requestId:r,accept:i.accept,title:i.title,...i.file?{file:i.file}:{}})})}function i(e,n){const o=t.get(e);o&&(t.delete(e),o(n))}export{o as requestMediaPick,i as resolveMediaPick};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-7755VWRT.js";import{useEaselHost as r}from"./chunk-R5ZVNJLJ.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=r();/* @__PURE__ */
|
|
2
|
+
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEaselHost as e}from"./chunk-R5ZVNJLJ.js";import{createContext as n,useState as t,useEffect as r,useMemo as l,useContext as o,useSyncExternalStore as u,useRef as c}from"react";import{jsx as s}from"react/jsx-runtime";var i=/* @__PURE__ */new Set,f=()=>{for(const e of[...i])e()};function a(){let e=null;const n=/* @__PURE__ */new Set,t=()=>{for(const e of[...n])e();f()},r=(n,r)=>{if(!e||e.request.requestId!==n)return;const{resolve:l}=e;e=null,t(),l(r)};return{current:()=>e?.request??null,request:n=>new Promise(r=>{const l=e;e={request:n,resolve:r},t(),l?.resolve(null)}),settle:r,cancel:()=>{e&&r(e.request.requestId,null)},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}var d=[],p=null,h=a(),v=()=>d[d.length-1]??p,m=()=>v()?.store??h,q=n(null);function b({panel:n,children:o}){const u=e(),[c]=t(()=>({panel:n,host:u,store:a()}));c.panel=n,c.host=u,d.includes(c)||(p=c),r(()=>{const e=d.indexOf(c);return e>=0&&d.splice(e,1),d.push(c),p?.host===c.host&&(p=null),f(),()=>{const e=d.indexOf(c);e>=0&&d.splice(e,1),p===c&&(p=null),c.store.cancel(),f()}},[c]);const i=l(()=>({panel:n,store:c.store}),[n,c]);/* @__PURE__ */
|
|
2
|
+
return s(q.Provider,{value:i,children:o})}function x(){return o(q)?.panel??null}function j(e){let n=null;for(let t=d.length-1;t>=0&&!n;t-=1)d[t].host===e&&(n=d[t]);n||p?.host!==e||(n=p);const t=n??v();return t?.panel?t.store:null}function w(){return null!=v()?.panel}function O(e){return m().request(e)}function g(e,n){for(const{store:t}of[...d])t.settle(e,n);p?.store.settle(e,n),h.settle(e,n)}function I(){m().cancel()}var J={current:()=>m().current(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>m().cancel()};function P(){return o(q)?.store??J}var S=()=>null;function k(){const e=P();return u(e.subscribe,e.current,S)}function L(){return P().cancel}function N(e,n){const t=P(),l=c(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{b as MediaPanelProvider,I as cancelPanelPick,a as createMediaPickStore,w as hasMediaPanel,j as mediaPickStoreFor,O as requestPanelPick,g as settlePanelPick,L as useCancelPanelPick,x as useMediaPanel,k as usePanelPick,N as usePickFollowsSelection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-4EUWOGZF.js";import{createEditLock as o}from"./chunk-JUQ6YJCG.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-NEQIEYYO.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-7755VWRT.js";import"../../chunk-Z6BAZFSW.js";import"../../chunk-R5ZVNJLJ.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-D6324C3E.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-GENAF3P6.js";import"../../chunk-BVN33R76.js";import"../../chunk-IWAPPEL4.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-7755VWRT.js";import"../../chunk-Z6BAZFSW.js";import"../../chunk-R5ZVNJLJ.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";
|
|
@@ -9,6 +9,8 @@ import '../../resolve-D68pb3Bx.js';
|
|
|
9
9
|
import '../../plan-DChbUXdS.js';
|
|
10
10
|
import '../lib/document-contract.js';
|
|
11
11
|
import '../lib/session.js';
|
|
12
|
+
import '../lib/backend-error.js';
|
|
13
|
+
import '../../edit-lock/index.js';
|
|
12
14
|
import '../lib/host-chrome.js';
|
|
13
15
|
import '../lib/links/link-filters.js';
|
|
14
16
|
import '../../LinkPicker-W2Rtxetz.js';
|
|
@@ -17,7 +19,6 @@ import '../lib/section-template-types.js';
|
|
|
17
19
|
import '../lib/puck/content-tree.js';
|
|
18
20
|
import '../lib/document-switch.js';
|
|
19
21
|
import '../../engine-DBxp_v6B.js';
|
|
20
|
-
import '../../edit-lock/index.js';
|
|
21
22
|
import '../lib/admin-bridge.js';
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MediaSidePanel as default}from"../../chunk-
|
|
1
|
+
export{MediaSidePanel as default}from"../../chunk-PYNQRX56.js";import"../../chunk-7755VWRT.js";import"../../chunk-Z6BAZFSW.js";import"../../chunk-R5ZVNJLJ.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,14 +1,28 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { N as NodeClipboard, a as NodeOps } from '../../useNodeOps-BF0fQsif.js';
|
|
3
2
|
import { E as EaselContextMenuItem } from '../../types-Djdq6Xkd.js';
|
|
3
|
+
import { N as NodeClipboard, a as NodeOps } from '../../useNodeOps-BF0fQsif.js';
|
|
4
4
|
import { StyleSnapshot } from '../../style-clipboard/index.js';
|
|
5
5
|
import { C as CanvasTarget } from '../../watch-BTYOJpQU.js';
|
|
6
6
|
import { AddTarget } from '../lib/puck/add-target-types.js';
|
|
7
|
+
import { EaselSession } from '../lib/session.js';
|
|
7
8
|
import '../../types-41704JE4.js';
|
|
8
9
|
import '../../plan-DChbUXdS.js';
|
|
9
10
|
import '../../words-CnnHb9jo.js';
|
|
10
11
|
import '../lib/puck/block-choice.js';
|
|
11
12
|
import '../lib/puck/slot-section-spec.js';
|
|
13
|
+
import '../../blocks/index.js';
|
|
14
|
+
import '../../types-E3HrTPg2.js';
|
|
15
|
+
import '../../data/index.js';
|
|
16
|
+
import '../../resolve-D68pb3Bx.js';
|
|
17
|
+
import '../lib/backend-error.js';
|
|
18
|
+
import '../../edit-lock/index.js';
|
|
19
|
+
import '../lib/host-chrome.js';
|
|
20
|
+
import '../lib/links/link-filters.js';
|
|
21
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
22
|
+
import '../lib/document-contract.js';
|
|
23
|
+
import '../lib/document-hooks.js';
|
|
24
|
+
import '../lib/section-template-types.js';
|
|
25
|
+
import '../lib/puck/content-tree.js';
|
|
12
26
|
|
|
13
27
|
/**
|
|
14
28
|
* Where the menu is open, and WHAT it was opened on.
|
|
@@ -145,6 +159,19 @@ type NodeMenuHost = {
|
|
|
145
159
|
* cannot be made twice cannot be cut either.
|
|
146
160
|
*/
|
|
147
161
|
duplicateBlocked: (node: NodeLike) => string | null;
|
|
162
|
+
/**
|
|
163
|
+
* What the node's BLOCK allows (0.103.0): its config's
|
|
164
|
+
* `permissions.duplicate` and `permissions.delete`, each true unless the
|
|
165
|
+
* config says false — the chrome's `blockNodeActions`, the answer the tree's
|
|
166
|
+
* trash and the inspector head read too. A block that may not be duplicated
|
|
167
|
+
* offers no Duplicate and no Copy (a copy pasted is a second one); one that
|
|
168
|
+
* may not be deleted offers no Delete; and Cut, which is both, needs both.
|
|
169
|
+
* Optional: a host without it allows both, as the menu always did.
|
|
170
|
+
*/
|
|
171
|
+
permits?: (node: NodeLike) => {
|
|
172
|
+
duplicate: boolean;
|
|
173
|
+
delete: boolean;
|
|
174
|
+
};
|
|
148
175
|
/**
|
|
149
176
|
* What may be added inside a node of this type, or null for one that takes
|
|
150
177
|
* no children — the ONE add lookup, the host's (its block rules), for the
|
|
@@ -299,6 +326,24 @@ declare function ancestorChain(host: NodeMenuHost, target: {
|
|
|
299
326
|
* destination.
|
|
300
327
|
*/
|
|
301
328
|
declare const EASEL_NODE_CLIPBOARD: NodeClipboard;
|
|
329
|
+
/**
|
|
330
|
+
* THE CLIPBOARD ONE EDITOR'S SESSION HOLDS A BLOCK ON (0.103.0) — scoped per
|
|
331
|
+
* block registry, so a block is only ever pasted among editors that know it.
|
|
332
|
+
*
|
|
333
|
+
* The page's own editor (a session that claims the page, every session before
|
|
334
|
+
* 0.103.0 and the website's still) holds {@link EASEL_NODE_CLIPBOARD}, the
|
|
335
|
+
* tab's, exactly as before. An editor mounted beside it (`claimsPage: false`:
|
|
336
|
+
* the campaign designer in the admin, beside the website editor) holds the
|
|
337
|
+
* clipboard of its own registry: one for every editor of that registry, so a
|
|
338
|
+
* block copied in one campaign pastes in the next, and never the website's,
|
|
339
|
+
* so a website section held there can never be pasted into an email, nor an
|
|
340
|
+
* email block into a page. A session beside the page's with no registry holds
|
|
341
|
+
* one of its own.
|
|
342
|
+
*/
|
|
343
|
+
declare function nodeClipboardOf(session: EaselSession): NodeClipboard;
|
|
344
|
+
/** The block clipboard of the editor this renders in ({@link nodeClipboardOf}
|
|
345
|
+
* its session). */
|
|
346
|
+
declare function useNodeClipboard(): NodeClipboard;
|
|
302
347
|
/**
|
|
303
348
|
* Build the rows for one node.
|
|
304
349
|
*
|
|
@@ -361,4 +406,4 @@ declare function useNodeContextMenu(host: NodeMenuHost, canvas: CanvasTarget | n
|
|
|
361
406
|
closeMenu: () => void;
|
|
362
407
|
};
|
|
363
408
|
|
|
364
|
-
export { type ChainRung, EASEL_NODE_CLIPBOARD, type NodeMenuHost, type NodeMenuTarget, ancestorChain, nodeMenuItems, pageMenuItems, textMenuItems, useNodeContextMenu };
|
|
409
|
+
export { type ChainRung, EASEL_NODE_CLIPBOARD, type NodeMenuHost, type NodeMenuTarget, ancestorChain, nodeClipboardOf, nodeMenuItems, pageMenuItems, textMenuItems, useNodeClipboard, useNodeContextMenu };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeMenuItems,pageMenuItems,textMenuItems,useNodeContextMenu}from"../../chunk-
|
|
1
|
+
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeMenuItems,pageMenuItems,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-HMWJB3HF.js";import"../../chunk-7GVLSNFW.js";import"../../chunk-57DJOKXT.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-RW4XBUUW.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-2LK54I4E.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-PAELDYYS.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-LXEOVUAV.js";import"../../chunk-LRTIMWZG.js";import"../../chunk-QDEZQ5A6.js";import"../../chunk-ERR437B5.js";import"../../chunk-UB7JVPK4.js";import"../../chunk-ZOJEFIP4.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-OYX47SL7.js";import"../../chunk-4EUWOGZF.js";import"../../chunk-KVNRNDUC.js";import"../../chunk-3WSPDAK2.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-Z6BAZFSW.js";import"../../chunk-R5ZVNJLJ.js";import"../../chunk-LEGAPYPC.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";
|