efficient-easel 18.2.0 → 19.1.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 +26 -1
- package/dist/{CanvasDragLayer-dZCPbQCP.d.ts → CanvasDragLayer-ARfaivCu.d.ts} +21 -3
- package/dist/{host-epHo7r8P.d.ts → ScreenDocumentContext-D55vIrG3.d.ts} +208 -208
- package/dist/autosave/index.d.ts +4 -4
- package/dist/{canvas-typing-BsNigaCa.d.ts → canvas-typing-Be4FO4q7.d.ts} +5 -5
- package/dist/chrome/chrome.css +2 -18
- package/dist/chrome/index.d.ts +5 -39
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-C2RHV42O.js → chunk-23DYNW6S.js} +1 -1
- package/dist/chunk-32JJK7PQ.js +8 -0
- package/dist/chunk-3WLT3GQS.js +1 -0
- package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
- package/dist/{chunk-HGV3FWOB.js → chunk-5DPIGWUL.js} +1 -1
- package/dist/chunk-5Z6KYASQ.js +1 -0
- package/dist/{chunk-N5AN2RF2.js → chunk-6B542CLG.js} +1 -1
- package/dist/chunk-AJSDWWJW.js +1 -0
- package/dist/chunk-C56MPJBH.js +1 -0
- package/dist/{chunk-S4AWJX4Q.js → chunk-EZG3TGQ7.js} +1 -1
- package/dist/chunk-FCRNT5PM.js +5 -0
- package/dist/{chunk-XHHVMAGM.js → chunk-FGYJ5DJY.js} +1 -1
- package/dist/chunk-GNMBJUG7.js +62 -0
- package/dist/{chunk-VEZPDGDQ.js → chunk-JBOSEHIX.js} +1 -1
- package/dist/chunk-KRL3IUV3.js +1 -0
- package/dist/{chunk-YLQYEDUQ.js → chunk-LBOJCTTC.js} +1 -1
- package/dist/chunk-LNHT2KPX.js +2 -0
- package/dist/chunk-M5Q4VYOH.js +14 -0
- package/dist/chunk-M62P4IQK.js +2 -0
- package/dist/chunk-MS2U6MV5.js +1 -0
- package/dist/chunk-MZ5PWTDV.js +7 -0
- package/dist/{chunk-7TOQCTHV.js → chunk-PY7OOQEZ.js} +3 -3
- package/dist/{chunk-KG7RJWOK.js → chunk-RYNBSKE7.js} +1 -1
- package/dist/chunk-SGFDUXUH.js +18 -0
- package/dist/{chunk-XDZHKYQX.js → chunk-SINAM2IT.js} +1 -1
- package/dist/chunk-Y6RJAOFH.js +1 -0
- package/dist/chunk-YZALWZT7.js +2 -0
- package/dist/chunk-ZG6PVMC3.js +19 -0
- package/dist/copy/index.d.ts +7 -7
- package/dist/copy/index.js +29 -29
- package/dist/drag/drag.css +23 -0
- package/dist/drag/index.d.ts +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +15 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +3 -3
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +65 -84
- package/dist/panel/index.js +14 -19
- package/dist/panel/panel.css +41 -137
- package/dist/{panelWidths-D9hTLR25.d.ts → panelWidths-DgQXiPXU.d.ts} +34 -6
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.d.ts +21 -0
- package/dist/screen/components/MediaPopup.js +1 -0
- package/dist/screen/components/NodeContextMenu.d.ts +4 -4
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +6 -6
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +8 -8
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +10 -8
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.d.ts +7 -6
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +7 -7
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +5 -5
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +74 -37
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +5 -5
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +7 -7
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/save-status.d.ts +2 -2
- package/dist/screen/lib/screen-parts.d.ts +52 -11
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +5 -4
- package/dist/screen/words.d.ts +3 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +6 -6
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +21 -21
- package/dist/{types-DT8ywrFQ.d.ts → types-B3iSHX-w.d.ts} +2 -22
- package/dist/{words-zH1H0WFw.d.ts → words-BeX5eGq7.d.ts} +2 -2
- package/dist/words-BpTjCfqO.d.ts +89 -0
- package/dist/{words-DkWcK1rh.d.ts → words-Cm8PMYn0.d.ts} +1 -1
- package/dist/{words-BpiVrsW5.d.ts → words-DYu4iBrR.d.ts} +1 -21
- package/package.json +8 -8
- package/dist/chunk-2ZWA6ARJ.js +0 -8
- package/dist/chunk-5EZ5Z3K7.js +0 -7
- package/dist/chunk-B4JN227A.js +0 -1
- package/dist/chunk-DXROGLB5.js +0 -2
- package/dist/chunk-GWIVPLOX.js +0 -23
- package/dist/chunk-LIRNQXAY.js +0 -1
- package/dist/chunk-LLDHIBYG.js +0 -18
- package/dist/chunk-OBIL7BZO.js +0 -4
- package/dist/chunk-QEAUF632.js +0 -14
- package/dist/chunk-R6WTQWAC.js +0 -2
- package/dist/chunk-SEVGZP36.js +0 -62
- package/dist/chunk-SNB4LQMK.js +0 -1
- package/dist/chunk-STWSCR25.js +0 -2
- package/dist/chunk-U277UX5I.js +0 -1
- package/dist/chunk-W6SDWCOL.js +0 -5
- package/dist/chunk-X52NFKUS.js +0 -1
- package/dist/chunk-Z6PVRXVY.js +0 -1
- package/dist/screen/components/MediaSidePanel.d.ts +0 -49
- package/dist/screen/components/MediaSidePanel.js +0 -1
- package/dist/words-D-yhjdOg.d.ts +0 -183
package/dist/chunk-R6WTQWAC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useEaselHost as e}from"./chunk-U3JP4VGF.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 P(e,n){for(const{store:t}of[...d])t.settle(e,n);p?.store.settle(e,n),h.settle(e,n)}function g(){m().cancel()}var I={current:()=>m().current(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>m().cancel()};function S(){return o(q)?.store??I}var k=()=>null;function F(){const e=S();return u(e.subscribe,e.current,k)}function G(){return S().cancel}function J(e,n){const t=S(),l=c(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{b as MediaPanelProvider,g as cancelPanelPick,a as createMediaPickStore,w as hasMediaPanel,j as mediaPickStoreFor,O as requestPanelPick,P as settlePanelPick,G as useCancelPanelPick,x as useMediaPanel,F as usePanelPick,J as usePickFollowsSelection};
|
package/dist/chunk-SEVGZP36.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-VEZPDGDQ.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-YLQYEDUQ.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-U277UX5I.js";import{usePartBridge as y}from"./chunk-X52NFKUS.js";import{useSectionOps as k}from"./chunk-SNB4LQMK.js";import{ScreenSaveIcon as v,ScreenMainButton as S}from"./chunk-7TOQCTHV.js";import{useBrowserOffline as b}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-2ZWA6ARJ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as O,PanelShowStrip as B}from"./chunk-XDZHKYQX.js";import{offeredChoices as I}from"./chunk-M2Z775ZC.js";import{MediaSidePanel as N}from"./chunk-OBIL7BZO.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as T,useScreenInspectorPanel as A,useScreenDevices as L,useScreenPickFollowsSelection as R,useScreenLeftView as E,SELECTION_MODE as V,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as H,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as G,useScreenCanvasHead as X,isSlotMode as Y,useScreenStyleClipboard as J,useScreenDocumentPass as K,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as Z,isPinnedFirst as q,isPinnedLast as _,screenSlotsOf as ee}from"./chunk-W6SDWCOL.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-LIRNQXAY.js";import{PageEditGuardNotices as oe}from"./chunk-HGV3FWOB.js";import{useScreenDocument as re}from"./chunk-STWSCR25.js";import{requestMediaPick as ie}from"./chunk-KG7RJWOK.js";import{useMediaPanel as le,usePanelPick as se,useCancelPanelPick as de}from"./chunk-R6WTQWAC.js";import{useEaselSession as ae}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ce,useHostEscape as pe}from"./chunk-U3JP4VGF.js";import{LayersIcon as ue,MediaIcon as he}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as fe}from"./chunk-C2RHV42O.js";import{heldStyle as me,styleShortcut as ge}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ye}from"./chunk-6WY6ZXJG.js";import{rootRowName as ke,slotChildRowName as ve,slotChildRenameProp as Se,sectionRenameProp as be}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as we,blockNodeActions as xe,TREE_MAX_DEPTH as ze,childSlotsOf as Ce,slotFieldsOf as Oe,slotChildrenIn as Be,nestsInTree as Ie,newNodeId as Ne}from"./chunk-PLVEGYK6.js";import{useEasel as Pe,useEaselApi as $e,CanvasPassThroughContext as Me,CanvasSharedContext as je}from"./chunk-QEAUF632.js";import{TreeRow as Te,Subtree as Ae,LayersTree as Le,TreeGroupLabel as Re,TreeRowAction as Ee,TreeSeam as Ve}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Fe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as De}from"./chunk-WK3AFPXY.js";import{toItemSelector as He,useNodeOps as We,clickPick as Ue}from"./chunk-X3TYRF5V.js";import{EaselTopBar as Ge,TopBarRail as Xe,TopBarCluster as Ye,EaselIconButton as Je,TopBarDivider as Ke,DeviceSwitch as Qe,InspectorIconButton as Ze,PanelResizeHandle as qe,MAX_PANEL_W as _e,MIN_PANEL_W as en,panelWidthVars as nn}from"./chunk-GWIVPLOX.js";import{DEFAULT_NOTICE_WORDS as tn,DEFAULT_CHROME_WORDS as on}from"./chunk-Z6PVRXVY.js";import{holderOf as rn,nameOrSomeone as ln}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as sn}from"./chunk-RE4LP46F.js";import{useWords as dn}from"./chunk-MFIRYGHW.js";import{insertSeams as an,CanvasDragLayer as cn,CanvasInsert as pn}from"./chunk-LLDHIBYG.js";import{DEFAULT_DRAG_WORDS as un}from"./chunk-KAML3KQH.js";import{createDragSession as hn,useTreeDrag as fn,gapToMoveIndex as mn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as gn,LIST_SELECTOR as yn,BLOCK_SELECTOR as kn,useCanvasTyping as vn,useCanvasEvent as Sn,nodeIdAt as bn,frameRectToHost as wn,BLOCK_ATTRIBUTE as xn,drawnBox as zn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as Cn,ROOT_SLOT as On,zoneKey as Bn,parseZoneKey as In,find as Nn,DataError as Pn}from"./chunk-KRXQM65X.js";import{useRef as $n,useMemo as Mn,useState as jn,useEffect as Tn,useCallback as An,useLayoutEffect as Ln,Fragment as Rn,useId as En}from"react";import{ColoredBadge as Vn,toast as Fn,Tooltip as Dn,groupColors as Hn,Dialog as Wn,FormField as Un,Input as Gn,Button as Xn}from"efficient-shell/ui";import{UndoIcon as Yn,RedoIcon as Jn,RefreshIcon as Kn,AddIcon as Qn,TrashIcon as Zn,EyeOffIcon as qn,EyeIcon as _n,SharedIcon as et,DuplicateIcon as nt}from"efficient-shell/icons/efficient";import{jsx as tt,jsxs as ot,Fragment as rt}from"react/jsx-runtime";function it({name:e,onMake:n,onCancel:t}){const o=dn("screen",fe).shared,[r,i]=jn(e),[l,s]=jn(!1),d=En(),a=$n(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return tt(Wn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ot(rt,{children:[
|
|
3
|
-
/* @__PURE__ */tt(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */tt(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */tt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */tt(Un,{label:o.name,htmlFor:d,children:/* @__PURE__ */tt(Gn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var lt=/* @__PURE__ */new WeakSet;function st(e,n,t){const o=Nn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function dt({canvas:e,tabs:n,onSelect:t}){const o=$n(null),[r,i]=jn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Ln(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=wn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${xn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?zn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=wn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */tt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */tt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */tt(Dn,{content:e.reach,children:/* @__PURE__ */ot(Vn,{colorClass:Hn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */tt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */tt(et,{size:12})}),e.label]})}):/* @__PURE__ */tt(Vn,{colorClass:Hn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function at({expand:e}){/* @__PURE__ */
|
|
7
|
-
return tt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ot(rt,e?{children:[
|
|
8
|
-
/* @__PURE__ */tt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */tt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */tt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */tt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */tt("path",{d:"M5 12h14"})]})})}var ct=`${yn}, ${kn}`;function pt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var ut="__rungs";var ht="screen:band",ft={duplicate:!0,delete:!0};function mt(){const yn=ce(),{target:wn,docId:xn,capabilities:zn,currentSlug:En,siteId:Dn,onPublish:Hn,saveState:Wn,saveConflict:Un,retrySave:Gn,toggleAutoSave:Xn,flushSave:et,access:mt,saveUnreachable:gt=!1,readOnly:yt,readOnlyReason:kt=null}=re(),vt=P(),St=$(),{mediaEditing:bt,hasEditGuard:wt,hasPinnedChrome:xt}=zn,{appState:zt,dispatch:Ct,history:Ot,selectedItem:Bt,getSelectorForId:It,config:Nt}=Pe(e=>e),Pt=M(),{first:$t,firstGroup:Mt,lastGroup:jt,isSectionGroup:Tt,sectionGroupZone:At,panelOf:Lt}=Pt,Rt=Lt($t),Et=e=>q(Pt,e),Vt=e=>_(Pt,e),Ft="node"===Pt.firstRow,Dt=Pt.band??null,Ht=dn("screen",fe),Wt=dn("tree",Fe),Ut=dn("drag",un),Gt=dn("notice",tn),Xt=dn("lock",sn),Yt=dn("menu",De),Jt=dn("styleClipboard",ye),Kt=dn("chrome",on),Qt=j()??`/${En}`,Zt=T(),qt=A(),_t=k({readOnly:yt}),eo=k({readOnly:yt,foldIntoHistory:!0}),no=$n(null),to=$e(),oo=Mn(()=>({..._t,select:e=>{no.current=e,_t.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=to.config;no.current=He(e,t,n)}_t.commitDocument(e,n)}}),[_t,to]),ro=zt.ui,io=ro.leftSideBarVisible,lo=ro.rightSideBarVisible,{options:so,widths:ao,initial:co,fluid:po,fit:uo}=L(),[ho,fo]=jn(co),mo=le(),go=bt&&null!==mo,yo=se(),ko=de();R(Bt?.props.id);const{read:vo,write:So,forSelection:bo}=E(),[wo,xo]=jn(vo);Tn(()=>{So(wo)},[wo]);const[zo,Co]=jn(0),Oo=$n(null),Bo=$n(null),Io=gn(Bo,{readySelector:ct}),No=vn(Io),Po=a(Bo);c(Bo,Io);const $o=b(),Mo=rn(mt),jo={state:Wn,offline:$o||Wn.failed&>,readOnlyReason:kt,editing:Mo?Gt.editing({name:ln(Mo.name,Xt),noun:Ht.noun}):null,conflict:null!=Un,notSaving:Ht.bar.notSaving},To=()=>{yt||(Wn.failed?Gn():et())};p(Bo,Io,To);const[Ao,Lo]=jn(!1),Ro=$n(!1),Eo=$n(!1),[Vo,Fo]=jn(null),[Do,Ho]=jn([]),[Wo,Uo]=jn(V),Go="puck"===Wo.kind,Xo=o(Wo,Bt?.props.id),[Yo,Jo]=jn(null);Tn(()=>{Yo&&(r(),Jo(null))},[Yo]);const Ko=$n(It);Ko.current=It;const Qo=An((e,{scroll:n})=>{xo(n=>bo(e,n)),n&&Jo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ko.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Cr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Zo=$n(null);Tn(()=>{const e=Zo.current;Zo.current=null;const n=null==Bt?.props.id?null:String(Bt.props.id);Uo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Lt(Bt?.type)??V);const t=Bt?.props.id,o=no.current;if(no.current=null,!t)return;const r=It(t);Qo(String(t),{scroll:!i(o,r??null,we)})},[Bt?.props.id,Qo]);const qo=An(e=>{Uo(n=>F(n,e)?n:e),Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ct]),_o=$n(()=>{});_o.current=(e,n)=>{const t=e?wi(e.zone??we)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Bt?.props.id?null:String(Bt.props.id);Uo(e=>F(e,n)?e:n),o!==r&&(Zo.current={id:o,mode:n},oo.select(e))};const er=An((e,n)=>_o.current(e,n),[]),nr={kind:Wo.kind,mode:Wo,open:qo,show:e=>Uo(e),reveal:()=>{lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},select:er},tr=D(nr,{data:zt.data,selected:Bt??null,zoneOf:e=>It(e)?.zone,readOnly:Boolean(yt),select:e=>{Uo(V),oo.select({index:e})},replace:(e,n)=>oo.replaceComponent(we,e,n),scrollTo:e=>l(e)},{device:ho,refreshes:zo},{setView:xo,reveal:()=>{io||Ct({type:"setUi",ui:{leftSideBarVisible:!0}})}}),or=tr.resolveLeftView?tr.resolveLeftView(wo,go):"media"===wo&&go?wo:"sections",rr=H(),{isLockedBlock:ir,duplicateBlocked:lr,nestDepth:sr,newSectionNode:dr,canAddTo:ar,blockIsOffered:cr}=rr,pr=W(),{labelAtLevel:ur,Icon:hr,useProducts:fr}=pr,mr=pr.rowName?(e,n,t)=>pr.rowName(e,n,t):void 0,gr=An(e=>{Ct({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),Qo(e,{scroll:!0})},[Ct,Qo]),{selectNode:yr,openPartId:kr}=y({mode:Wo,setMode:Uo,onOpenPart:gr}),[vr,Sr]=jn(null);pe(null!==vr,()=>Sr(null));const br=f(U()),wr=br.collapsed,xr=br.panelWidths,[zr,Cr]=jn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(wr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Tn(()=>{try{window.localStorage.setItem(wr,JSON.stringify([...zr]))}catch{}},[zr]);const[Or,Br]=jn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(xr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left),right:g(Number(n.right)||m.right)}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(xr,JSON.stringify(Or))}catch{}},300);return()=>clearTimeout(e)},[Or]);const Ir=An((e,n)=>Br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Nr=An(e=>Ir("left",e),[Ir]),Pr=An(e=>Ir("right",e),[Ir]),$r=e=>zr.has(e),Mr=e=>Cr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),jr=$n(!1),Tr=$n(null);Tn(()=>{if(jr.current&&!Ao){const e=Tr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Bo.current?.querySelector(`button[aria-label="${CSS.escape(Ht.add.title)}"]`))?.focus(),Tr.current=null}jr.current=Ao},[Ao]),Tn(()=>{if(!Ao||!Po)return;const e=e=>{"Escape"===e.key&&el()};return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[Ao,Po]),pe(Ao,()=>el()),Tn(()=>{!io&&Ao&&(Lo(!1),Fo(null),Ro.current=!1)},[io]),Tn(()=>{if(!yo)return Eo.current&&Ct({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Eo.current=!1);Ao&&(Lo(!1),Fo(null),Eo.current=Ro.current,Ro.current=!1),io||(Eo.current=!0,Ct({type:"setUi",ui:{leftSideBarVisible:!0}}))},[yo]),Tn(()=>{!io&&yo&&(Eo.current=!1,ko())},[io]),Tn(()=>{if(!yo||!Po)return;const e=e=>{"Escape"===e.key&&ko()};return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[yo,Po]),pe(null!==yo,()=>ko());const Ar=G(),Lr=(e,n="success",t)=>{if(Ar)return void(t?Ar(e,"error"===n?"error":"info",t):Ar(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Fn.error(e,{...o,duration:t?.duration??3200}):Fn.success(e,{...o,duration:t?.duration??1900})},Rr=$n(null),[Er,Vr]=jn(0),[Fr,Dr]=jn(0),Hr=X(),Wr=$n(null),Ur=e=>Math.max(0,e.clientHeight-(Wr.current?.offsetHeight??0));Tn(()=>{const e=Rr.current;if(!e)return;const n=()=>{Vr(e.clientWidth),Dr(Ur(e))};n();const t=new ResizeObserver(n);return t.observe(e),Wr.current&&t.observe(Wr.current),()=>t.disconnect()},[]),Ln(()=>{Rr.current&&(Vr(Rr.current.clientWidth),Dr(Ur(Rr.current)))},[Or,io,lo]);const Gr=ho===po?Er>0?Er:ao[po]:ao[ho],Xr=Er>0?Math.min(Er/Gr,"shrink"===uo?1:2):1,Yr=Gr*Xr,Jr=Er>0&&Yr>Er+1,Kr={width:Yr,height:Fr||"100%",flex:"none",position:"relative"},Qr={width:Gr,height:Fr?Fr/Xr:"100%",maxHeight:"none",transform:1!==Xr?`scale(${Xr})`:void 0,transformOrigin:"top left"},Zr=()=>Ct({type:"setUi",ui:{leftSideBarVisible:!io}}),qr=()=>Ct({type:"setUi",ui:{rightSideBarVisible:!lo}}),_r=e=>{Ao&&(Lo(!1),Fo(null),Ro.current=!1,io&&wo===e)||yo&&(Eo.current=!1,ko(),io&&wo===e)||(io&&wo===e?Zr():(xo(e),io||Ct({type:"setUi",ui:{leftSideBarVisible:!0}})))},ei=()=>{ie(yn,{accept:"image/*",title:Kt.mediaLibrary})},ni=()=>{Uo(V),oo.select(null),d()},ti=()=>{Uo(Rt??V),lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},oi=zt.data.content??[],ri=()=>{const e=oi.findIndex(Et),n=oi.findIndex(Vt);return{floor:e>=0?e+1:0,cap:n>=0?n:oi.length}},ii=Nt,li=rr.stripCopy,si=n=>e(n,li),di=ne(),ai=We({data:zt.data,config:ii,readOnly:Boolean(yt),clipboard:di,strip:li?e=>li(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Cn||e.slot!==On)return{min:0,max:n-1};const{floor:t,cap:o}=ri();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Uo(V);const t=void 0===n||"node"===n?.kind?n:null;oo.commitDocument(e,t)}}),ci=ae(),[pi,ui]=jn(null),hi=e=>{const n=oi.find(n=>String(n.props.id)===e),t=Pt.shared;n&&t&&ai.swap(e,t.detach(n))},fi=e=>{const n=Nn(zt.data,Nt,e);if(!n)return!1;const t=Bn(n.place),o=n.node,r=t===we?vi(o):ji(o),i=t===we?Pt.shared?.usedOn(o):null;return!!ai.remove(e)&&(Lr(i?Ht.shared.removed({count:Math.max(0,i.length-1)}):Ht.deleted({name:r}),"success",{duration:8e3,action:{label:Ht.bar.undo,onClick:()=>{ai.restore(n.node,n.place)}}}),!0)},mi={...ai,remove:fi},gi=e=>ur(e,"block",Nt.components[e]?.label??e),yi=An(e=>Nt.components[e]?.defaultProps??{},[Nt]),ki=e=>ur(e,"section",gi(e)),vi=e=>ke({type:e.type,props:e.props??{}},ki(e.type),mr),{nodeAddresses:Si,zoneItems:bi}=Mn(()=>{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>=ze)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ce(Nt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(oi,we,0),{nodeAddresses:e,zoneItems:n}},[oi,Nt]),wi=An(e=>bi.get(e)??[],[bi]),xi=e=>{const n=Si.get(e);return n?wi(n.zone)[n.index]:void 0},zi=e=>ee(rr,Nt,e),Ci=e=>{if(!rr.slotsOf||e===we)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=xi(e.slice(0,n));if(!t)return null;const o=zi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Oi=(()=>{if(!Y(Wo))return null;const e=`${Wo.nodeId}:${Wo.slot}`;return Ci(e)?.slot.panel===Wo.kind?e:null})(),Bi=$n(null);Tn(()=>{const e=Bi.current;if(Bi.current=null,!Oi||!Y(Wo))return;const n=Wo.nodeId;Qo(n,{scroll:e!==Oi}),Cr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Wo]);const Ii=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Si.get(e);n&&(n.zone===we?Yi(n.index):Sl(n.zone,n.index,e,xi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Oi!==i&&(Bi.current=i),er(null,r),lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ni=(e,n,t)=>{const o=`${e}:${n}`;if(Cr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Oi!==o&&(Bi.current=o);er(null,{kind:t,nodeId:e,slot:n})},Pi=(e,n,t)=>{if(yt||!rr.moveSlot)return;const o=xi(e),r=o?zi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:ut,index:n},s=mn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=rr.moveSlot(e,n,s);"string"==typeof d&&Ni(e,d,i.panel)},$i=fr(),Mi=Mn(()=>{const e=/* @__PURE__ */new Map;for(const n of $i??[])e.set(n.slug,n.name);return e},[$i]),ji=e=>ve(e,gi,pr.plainText,e=>Mi.get(e),pr.rowName),Ti=(e,n)=>{const t=Nt.components[e.type]?.fields,o=n===we||Xl(n)?"section":"block",r=n===we&&(Et(e)||Vt(e)||Tt(e.type)),i="block"===o?Se(t):r?null:be(t);return pr.renamePropOf?pr.renamePropOf(e,o,i):i},Ai=(e,n,t,o)=>{if(!(!yt&&vr?.zone===e&&vr.index===n))return;const r=(t,o)=>{Sr(null),o&&((e,n,t)=>{const o=wi(e)[n];if(!o)return;const r=Ti(o,e);r&&oo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return tt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Ht.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)},Li=t(J(),Jt),Ri=Li.scope({target:wn,siteId:Dn,docId:xn}),Ei=Nt,Vi=(e,n)=>n===we?ki(e):gi(e),Fi=(e,n,t)=>{const o=Li.plan(Ri,t,Vi(t.type,e),Ei);o&&(o.changed&&oo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Lr(o.message))},Di=te({nodesIn:wi,nodeAt:(e,n)=>wi(e)[n]??null,labelOf:(e,n)=>n===we?ki(e):gi(e),renamePropOf:Ti,beginRename:(e,n)=>Sr({zone:e,index:n}),history:{hasPast:Ot.hasPast,hasFuture:Ot.hasFuture,back:()=>Ot.back(),forward:()=>Ot.forward()},openPageSettings:()=>{oo.select(null),Uo(V)},pageSettingsLabel:Ht.pageSettings,words:{menu:Yt,styleClipboard:Jt,screen:Ht.menu},readOnly:Boolean(yt),collapseAll:()=>Cr(new Set(wi(we).map(e=>String(e.props.id)))),onPasteRefused:e=>Lr(e?Ht.pasteRefused({name:e.label}):Ht.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Kl(e,n),menuRows:(e,n,t)=>{const o=tr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Pt.shared;if(!t||n!==we)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Ht.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return yt||ir(e.type,e)?n:{...n,change:[{label:Ht.shared.detach,onClick:()=>hi(e.props.id)}],remove:[{label:Ht.shared.removeFromPage,danger:!0,onClick:()=>{fi(e.props.id)}}]}}return yt||Et(e)||Vt(e)||Tt(e.type)?null:z(ci)?{change:[{label:Ht.shared.makeShared,onClick:()=>ui({id:e.props.id,name:vi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>ir(e.type,e),duplicateBlocked:e=>lr(zt.data,e),permits:e=>{const n=xe(Nt,e.type);return Pt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:mi,isPinned:(e,n)=>n===we&&(Et(e)||Vt(e)),sectionBand:ri,locate:e=>Si.get(e)??null,rowNameOf:(e,n)=>n===we?vi(e):ji(e),selectAt:(e,n,t,o)=>{e===we?Yi(n):Sl(e,n,t,o??"")},slotRung:e=>{const n=Ci(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ii(n.node,n.slot,!1)}:null},style:{held:()=>me(Ri),canCopy:e=>Li.rows(Ei,e).some(e=>!1!==e.counted),copy:(e,n)=>Li.copy(Ri,e,Vi(e.type,n),Ei),paste:(e,n,t)=>Fi(e,n,t)},keys:St?{target:Po,selected:()=>{const e=zt.ui.itemSelector;return e?{zone:e.zone??we,index:e.index}:null},held:()=>di.get(),readOnly:Boolean(yt),onDone:({done:e,name:n})=>{"copied"===e&&Lr(Ht.copied({name:n}))}}:void 0},Io),Hi=$n({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{Hi.current={copy:(e,n)=>Li.copy(Ri,e,Vi(e.type,n),Ei),paste:Fi,at:()=>{const e=zt.ui.itemSelector;if(!e)return null;const n=e.zone??we,t=wi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(yt)}});const Wi=An(e=>{const n=ge(e);if(!n)return;const t=Hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Tn(()=>{if(!Po)return;const e=e=>Wi(e);return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[Wi,Po]),Sn(Io,"keydown",Wi);const Ui=oi.map(e=>e.props.id).join("|");Tn(()=>{const e=Io?.document??null,n=Io?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ho(e=>e.length?[]:e);const n=oi.findIndex(Vt),t=n>=0?n:oi.length,o=n=>{const t=oi[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=oi.length>0&&!Et(oi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=pt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Ho(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Io,Ui,ho,Xr,io,lo,Bt?.props.id]);const Gi=Io?.document??null,Xi=Io?.window??null;Tn(()=>{const e=Oo.current;if(!e||!Gi||!Xi)return;const n=[],t=()=>{const n=Gi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Xi.scrollTo({left:Xi.scrollX,top:Xi.scrollY+t,behavior:"instant"}),!0};return Oo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Gi,Xi]);const Yi=e=>{Uo(V),oo.select({index:e}),tr.sectionPressed?.(oi[e]);const n=oi[e]?.props?.id;n&&l(n)},Ji=e=>{const{floor:n,cap:t}=ri(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Bt&&Wo.kind!==Rt?.kind?oi.findIndex(e=>e.props.id===Bt.props.id):-1;return o(r>=0?r+1:t)},Ki=(e,n)=>{const{floor:t,cap:o}=ri(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(oo.reorderComponent(we,e,i),oo.select({index:i}),{moved:!0,dest:i})},Qi=(e,n,t,o)=>{Uo(V),oo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Lr(Ht.sectionAdded({name:t}))},Zi=(e,n)=>{const t=Ji(n),o=dr(e,{nodeDefaults:yi,newNodeId:Ne,sectionLabel:ki,blockIsOffered:cr}),r=o?oo.insertNode(we,t,o):oo.insertSection(e,t);return Qi(t,r,ki(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ce(Nt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ar(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},qi=e=>_i(we,e),_i=(e,n)=>{Tr.current=document.activeElement??null,yo&&(Ro.current=Eo.current,Eo.current=!1,ko()),Fo(null===n?null:{zone:e,index:n}),Lo(!0),io||(Ro.current=!0,Ct({type:"setUi",ui:{leftSideBarVisible:!0}}))},el=()=>{Lo(!1),Fo(null),Ro.current&&Ct({type:"setUi",ui:{leftSideBarVisible:!1}}),Ro.current=!1},nl=(e,n)=>pr.rowName?n?Et(e)?pr.rowName(e,"section",Ht.header):Vt(e)?pr.rowName(e,"section",Ht.footer):Tt(e.type)?pr.rowName(e,"section",gi(e.type)):vi(e):ji(e):n?ki(e.type):gi(e.type),tl=e=>n=>{e()},ol=(e,n,t)=>{if(yt)return null;const o=wi(e)[n];return o&&!xe(Nt,o.type).delete||o&&ir(o.type,o)?null:/* @__PURE__ */tt(Ee,{kind:"delete",label:e===we&&o&&Pt.shared?.usedOn(o)?Ht.shared.removeFromPage:Ht.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=wi(e)[n]?.props?.id;null!=t&&fi(String(t))})(e,n),children:/* @__PURE__ */tt(Zn,{size:15})})},rl=e=>pr.rowPreview?.(e)||void 0,il=e=>pr.rowMarks?.(e)??void 0,ll=(e,n,t)=>pr.rowActions?.(e,n,t)??null,sl=(e,n,t,o)=>{if(yt)return null;if(ir(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return tt(Ee,{kind:"eye",label:r?Ht.showNamed({name:o}):Ht.hideNamed({name:o}),onClick:()=>al(e,n,t),children:/* @__PURE__ */tt(r?qn:_n,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},dl=e=>Is(we,e),al=(e,n,t)=>{oo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},cl=e=>Oe(Nt,e),pl=e=>Ce(Nt,e),ul=e=>rr.slotsOf?zi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Be(e,n.slot)})):[{slot:null,rung:null,kids:pl(e)}],hl=e=>rr.slotsOf?ul(e).flatMap(e=>e.kids):pl(e),fl=e=>Boolean(rr.slotsOf)&&zi(e).some(e=>e.rung),ml=(e,n,t)=>null===t?void 0===n?ar(e):ar(e,n):ar(e,n,t),gl=(e,n,t)=>{const o=Ie(Nt,e.type,n)&&(t||hl(e).length>0||fl(e));return{collapsible:o,folded:o&&$r(String(e.props.id))}},yl=(e,n,t)=>ul(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>gl(e,r,t(e.type)).collapsible?[String(e.props.id),...yl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),kl=e=>hl(e).length>0||fl(e)||Boolean(ar(e.type)),vl=e=>Boolean(ar(e)),Sl=(e,n,t,o)=>{if(Uo(V),ar(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),oo.select({index:n,zone:e}),l(t)}else oo.select({index:n,zone:e}),l(t)},bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;oo.insertComponent(i,t,o),ar(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),oo.select({index:o,zone:i})}):oo.select({index:o,zone:i})},wl=$n(/* @__PURE__ */new Set);Tn(()=>{oi.forEach(e=>{const n=ar(e.type)?.spec;if(!n)return;const t=e.props.id;if(wl.current.has(t))return;wl.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(yi)).forEach((e,t)=>eo.seedChild(o,t,n.childType,e))})},[oi,eo,yi]);const xl=$n(/* @__PURE__ */new Set);Tn(()=>{oi.forEach((e,t)=>{const o=e.props.id;if(xl.current.has(o))return;const r=n(e,cl(e.type));xl.current.add(o),r&&eo.replaceComponent(we,t,{...e,props:r})})},[oi,eo]),K(eo,Nt);const zl=oi.findIndex(Vt),Cl=zl>=0?oi[zl]:null,Ol=Ft?oi.findIndex(Et):-1,Bl=Ol>=0?oi[Ol]:null,Il=Pt.groupTab,Nl=Mn(()=>Il?e=>Tt(e.type):void 0,[Il]),Pl=Boolean(Pt.groupBadge),$l=Pt.sharedReach,Ml=e=>$l?.(e)??void 0,jl=Mn(()=>$l?new Set(oi.filter(e=>Ml(e)).map(e=>String(e.props.id))):null,[oi,$l]),Tl=Mn(()=>jl?e=>jl.has(e):void 0,[jl]),Al=Pt.first?$l?.({type:Pt.first,props:{id:""}})??void 0:void 0,Ll=Pt.groupBadge?/* @__PURE__ */tt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */tt(Vn,{tone:"info",size:"xs",children:Pt.groupBadge})}):void 0,Rl=oi.find(e=>e.type===Mt)??null,El=oi.find(e=>e.type===jt)??null,Vl=zl>=0?zl:oi.length,Fl=[];oi.forEach(e=>{Vt(e)||(kl(e)&&Fl.push(String(e.props.id)),Fl.push(...yl(e,1,vl)))}),Cl&&(Fl.push(String(Cl.props.id)),Fl.push(...yl(Cl,1,vl)));const Dl=Fl.length>0&&Fl.every(e=>zr.has(e)),Hl=e=>{const n=pr.blockRowName(e,gi);return pr.rowName?pr.rowName(e,"block",n):n},Wl=(e,n,t,o)=>{const r=wi(e)[t];if(!r)return;const i={...In(e),index:t},l={...In(n),index:Math.min(Math.max(o,0),wi(n).length)},s=mn(i,l);if(e!==n||s!==t)try{ai.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Pn))throw e}},Ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of pl(e))n.add(r),t(o)};for(const t of cl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Gl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Si.get(n);if(!e)return null;if(e.zone===we)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Xl=e=>{const n=e.slice(0,e.indexOf(":")),t=oi.find(e=>Tt(e.type)&&String(e.props.id)===n);return t&&At(n)===e?t:null},Yl=(e,n)=>{const t=Xl(e);return!t||(!Pt.groupAccepts||Pt.groupAccepts(t.type,n,wi(e).length))},Jl=(e,n,t)=>{if(e.rung){const t=xi(e.rung.nodeId),o=t?zi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===ut&&n.index>=0&&n.index<=o}if(n.slot===ut)return!1;if(e.add)return ql(e.add,n);const o=Bn(n);if(Tt(e.type))return!1;const r=Xl(o),i=Xl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Yl(o,e.type))&&(n.index>=0&&n.index<=wi(o).length));if(e.zone===we||o===we){if(e.zone!==o)return!1;const{floor:t,cap:r}=ri();return n.index>=t&&n.index<=r}if(n.index<0||n.index>wi(o).length)return!1;if(e.zone===o)return!0;const l=Cl&&!Pt.lastIsOpen?String(Cl.props.id):null;return(!l||Gl(e.zone)!==l&&Gl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??wi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Si.get(i),s=l?wi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ul(r).has(n))return!1;const d=ar(s.type,sr(zt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(wi(n),r))})(e.zone,o,e.index,t)},Kl=(e,n)=>{const t=Bn(e.from),o=e.node;return t===Bn(n)?Yl(t,o.type):Jl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Ql=e=>{const n=e.slice(0,e.indexOf(":")),t=Si.get(n),o=t?wi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ar(o.type,sr(zt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=I(r.choices??(r.spec?[{type:r.spec.childType,label:gi(r.spec.childType)}]:[])),l=Ci(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:nl(o,t.zone===we)}},Zl=(e,n)=>{if("section"!==e.kind)return e;const t=Bn(n);return t===we||Xl(t)?e:Ql(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ql=(e,n)=>{const t=Zl(e,n),o=Bn(n);if("shared"===t.kind){if(o!==we||!Pt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ri();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(Xl(o)){const e="section"===t.kind?t.type:t.template.node.type;return Yl(o,e)&&n.index>=0&&n.index<=wi(o).length}if(o!==we)return!1;const{floor:e,cap:r}=ri();return n.index>=e&&n.index<=r}if(o===we)return!1;const r=Ql(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(wi(o))},_l=(e,n)=>{const t=Zl(e,n);if("block"!==t.kind&&Xl(Bn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Yl(n,o)){if("section"===e.kind)oo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;oo.insertNode(n,t,si(e.template.node))}Uo(V),oo.select({index:t,zone:n})}})(t,Bn(n),n.index);if("section"===t.kind)return void Zi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Ji(t),r=oo.insertNode(we,o,n);Qi(o,r,e)})(t.template.name,si(t.template.node),n.index);if("shared"===t.kind){const e=Pt.shared?.nodeOf(t.section);if(!e)return;const o=Ji(n.index);return void(ai.restore(e,{parentId:Cn,slot:On,index:o})&&Qi(o,e.props.id,t.section.title))}const o=Bn(n),r=Ql(o);r&&(r.target.spec?bl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{oo.insertComponent(e,n,t),Uo(V),oo.select({index:t,zone:e})})(o,t.type,n.index))},es=(e,n)=>{e.rung?Pi(e.rung.nodeId,e.index,n.index):e.add?_l(e.add,n):e.zone===we?Ki(e.index,n.index):Wl(e.zone,Bn(n),e.index,n.index)},[ns]=jn(()=>hn()),ts=fn({keyOf:e=>e.id,readOnly:Boolean(yt),session:ns,canDrop:Jl,onDrop:es,onStep:(e,n)=>{e.rung?Pi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===we?((e,n)=>{const t=ki(oi[e]?.type??""),o=Ki(e,n<0?e-1:e+2);if(!o.moved)return void Lr(n<0?Ht.sectionFirst({name:t}):Ht.sectionLast({name:t}));const{floor:r,cap:i}=ri();Lr(Ht.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Wl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),os=An(e=>{const{floor:n,cap:t}=ri(),o=[];for(const r of e.nodes){const e=Bn(r.place),i=wi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Et(i)||Vt(i)||ir(i.type,i))continue;if(Tt(i.type))continue;const l=Boolean(Xl(e)),s=e===we||l;e===we&&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?ki(i.type):ji(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Bn(e.list);if(n===we&&0===e.children.length)return[{...e,addLabel:Ht.addSection,addAlways:!0}];const t=Ql(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Xl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Bn(e.list),t=n===we||Xl(n)?null:Ql(n);return t?.choices.length?an(e,t.target.spec?.addLabel??Ht.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[zt.data]),rs=null==Bt?.props.id?null:String(Bt.props.id),is=An(e=>{const n=Nt,t=e=>!e.item.rung&&null!==Nn(zt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(rs);return i||(r(Ue(zt.data,n,o.item.id,rs,Nl))??o)},[zt.data,Nt,rs,Nl]),[ls,ss]=jn(null),ds=Boolean(Il||$l);Sn(Io,"mouseover",e=>{if(!ds)return;const n=bn(e.target),t=n?st(zt.data,Nt,n):null;t!==ls&&ss(t)}),Sn(Io,"mouseout",e=>{ds&&!e.relatedTarget&&ss(null)});const as=e=>Et(e)||Vt(e)||Tt(e.type),cs=e=>{const n=Tt(e.type)?gi(e.type):Et(e)?Ht.header:Vt(e)?Ht.footer:null;return null===n?vi(e):pr.rowName?pr.rowName(e,"section",n):n},ps=[];if(ds){const e=rs?st(zt.data,Nt,rs):null;for(const n of/* @__PURE__ */new Set([e,ls])){const e=n?oi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Et(e)||e.type===Mt,o=Ml(e);if(o){ps.push({id:String(e.props.id),label:cs(e),below:t,reach:o});continue}if(!Il||!as(e))continue;const r=Il(e);r&&ps.push({id:String(e.props.id),label:r,below:t})}}const us=ae(),hs=$n(null);Tn(()=>{const e=Pt.changeNotice;if(!e)return;const n=JSON.stringify(oi.filter(as)),t=hs.current;if(hs.current={doc:xn,bands:n,index:Ot.index},!t||t.doc!==xn||t.bands===n)return;Ot.hasPast&&Ot.index>=t.index&&!lt.has(us)&&(lt.add(us),Lr(e,"success",{action:{label:Ht.bar.undo,onClick:()=>Ot.back()},duration:8e3}))},[oi]);const fs=e=>{Uo(V),oo.select(e.zone===we?{index:e.index}:{index:e.index,zone:e.zone})},ms=Q(),gs=()=>({data:zt.data,device:ho,ops:oo,inspector:nr}),ys=ms?.model,ks=Mn(()=>ys?e=>ys(e,os(e),gs()):os,[ys,os,ho]),vs=ms?.measure,Ss=vs?(e,n)=>vs(e,n,gs()):void 0,bs=ms?.canDrop,ws=bs?(e,n)=>bs(e,n,Jl,gs()):Jl,xs=ms?.drop,zs=xs?(e,n)=>xs(e,n,es,gs()):es,Cs=ms?.pick,Os=Cs?e=>Cs(e,fs,gs()):fs,Bs=e=>{const n=Bn(e),t=Ci(n);t&&Ii(t.node,t.slot,!1),_i(n,e.index)},Is=(e,n)=>/* @__PURE__ */tt(Ve,{...yt?{}:ts.seam({place:{...In(e),index:n}})},`seam:${e}:${n}`),Ns={rowClick:tl,isCollapsed:$r,toggleCollapse:Mr},Ps=e=>{const n=String(e.props.id),t=oi.findIndex(e=>String(e.props.id)===n),o=At(n),r=wi(o),i=$r(n),l=gi(e.type),s=pr.rowName?pr.rowName(e,"section",l):l,d=e=>Is(o,e);/* @__PURE__ */
|
|
16
|
-
return ot(rt,{children:[
|
|
17
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:e.type,size:13}),name:s,preview:rl(e),marks:il(e),onSelect:()=>Yi(t),nameSlot:Ai(we,t,n,s),selected:Xo===n,badge:Ml(e)?void 0:Ll,shared:Ml(e),actions:ll(e,we,t)??void 0,rowProps:{"data-node-id":n,onClick:tl(()=>Yi(t))},fold:{open:!i,label:"section",onToggle:()=>Mr(n)}}),!i&&/* @__PURE__ */ot(Ae,{children:[r.map((n,t)=>{const r=String(n.props.id),i=vi(n),l=kl(n),s=l&&$r(r),a=()=>Sl(o,t,r,e.type),{rowProps:c,...p}=ts.row({item:{id:r,zone:o,index:t,type:n.type},place:{...In(o),index:t}},{"data-node-id":r,onClick:tl(a)});/* @__PURE__ */
|
|
18
|
-
return ot(Rn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:a,nameSlot:Ai(o,t,r,i),selected:Xo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Mr(r)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(o,t,i),ll(n,o,t),sl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */tt(Ae,{children:js(n,2)})]},r)}),d(r.length)]})]})},$s=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ts.dragging,d=!$r(l)&&s?.rung?.nodeId!==i,a={...In(l),index:0},c=s&&!s.rung&&Jl(s,a)?a:void 0,p=()=>Ii(e,n,!0),{rowProps:u,...h}=ts.row({item:{id:`rung:${l}`,zone:`${i}:${ut}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:ut,index:t},into:c,canDrag:Boolean(rr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:tl(p)}),f=yt?null:rr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return ot(Rn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Oi===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Mr(l)},actions:f&&f.length>0?/* @__PURE__ */tt(rt,{children:f.map((t,o)=>/* @__PURE__ */tt(Ee,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(yt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */tt(Zn,{size:15}):/* @__PURE__ */tt(nt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */tt(Ae,{children:r})]},l)},Ms=(e,n)=>{const t=ul(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return tt(rt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=ml(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Is(e,n),p=/* @__PURE__ */ot(rt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Xo===String(n.props.id),{collapsible:i,folded:s}=gl(n,l,vl(n.type)),d=String(n.props.id),a=Hl(n),p=()=>Sl(t,o,d,e.type),{rowProps:u,...h}=ts.row({item:{id:d,zone:t,index:o,type:n.type},place:{...In(t),index:o}},{"data-node-id":d,onClick:tl(p)});/* @__PURE__ */
|
|
23
|
-
return ot(Rn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:a,preview:rl(n),marks:il(n),onSelect:p,nameSlot:Ai(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Mr(d)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(t,o,a),ll(n,t,o),sl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */tt(Ae,{children:Ms(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?$s(e,t.rung,r++,o,p):/* @__PURE__ */tt(Rn,{children:p},t.slot??"")})})},js=(e,n)=>{const t=sr(zt?.data,e.type,String(e.props.id)),o=ul(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return tt(rt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=ml(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Is(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),k=/* @__PURE__ */ot(rt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Xo===String(n.props.id),i=ji(n),l=String(n.props.id),{collapsible:d,folded:a}=gl(n,s,vl(n.type)),c=cl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...In(p),index:wi(p).length}:void 0,h=ts.dragging,f=u&&h&&Jl(h,u)?u:void 0,g=()=>Sl(t,o,l,e.type),{rowProps:y,...k}=ts.row({item:{id:l,zone:t,index:o,type:n.type},place:{...In(t),index:o},into:f,canDrag:!ir(n.type,n)},{"data-node-id":l,onClick:tl(g)});/* @__PURE__ */
|
|
26
|
-
return ot(Rn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:g,nameSlot:Ai(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>Mr(l)}:void 0,actions:ir(n.type,n)?ll(n,t,o)??void 0:/* @__PURE__ */ot(rt,{children:[ol(t,o,i),ll(n,t,o),sl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */tt(Ae,{children:js(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */tt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>bl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?$s(e,o.rung,i++,r,k):/* @__PURE__ */tt(Rn,{children:k},o.slot??"")})})},Ts=Ao||null!==yo,As=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:io&&!Ts&&or===e.id,onSelect:()=>_r(e.id)}:e,Ls=[...(tr.railLead??[]).map(As),{id:"sections",label:Ht.layers,icon:/* @__PURE__ */tt(ue,{}),active:io&&!Ts&&"sections"===or,onSelect:()=>_r("sections")},...(tr.railTrail??[]).map(As)];go?Ls.push({id:"media",label:Ht.railMedia,icon:/* @__PURE__ */tt(he,{}),active:io&&!Ao&&(null!==yo||"media"===or),onSelect:()=>_r("media")}):bt&&Ls.push({id:"media",label:Ht.railMedia,icon:/* @__PURE__ */tt(he,{}),onSelect:ei});const Rs=[...tr.railLead??[],...tr.railTrail??[]].find(e=>"panel"in e&&e.id===or),Es=Boolean(Dt?.foldable),Vs=Dt?.label??(wt?Ht.pageSections:Ht.templateSections),Fs=Es&&$r(ht),Ds=/* @__PURE__ */ot(rt,{children:[oi.map((e,n)=>{if(Et(e)||Vt(e)||Tt(e.type))return null;const t=Xo===String(e.props.id),o=Boolean(e.props._hidden);pl(e);const r=String(e.props.id),i=tr.hasOwnRows?.(e)??!1,l=kl(e)||i,s=l&&$r(r),d=cl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...In(a),index:wi(a).length}:void 0,p=ts.dragging,u=c&&p&&Jl(p,c)?c:void 0,{rowProps:h,...f}=ts.row({item:{id:r,zone:we,index:n,type:e.type},place:{...In(we),index:n},into:u,canDrag:!ir(e.type,e)},{"data-node-id":r,onClick:tl(()=>Yi(n))});/* @__PURE__ */
|
|
29
|
-
return ot(Rn,{children:[n>0&&dl(n),
|
|
30
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:e.type,size:13}),name:vi(e),preview:rl(e),marks:il(e),shared:Ml(e),onSelect:()=>Yi(n),nameSlot:Ai(we,n,r,vi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Mr(r)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(we,n,vi(e)),ll(e,we,n),sl(we,n,e,vi(e))]}),rowProps:h}),kl(e)&&!s&&/* @__PURE__ */ot(Ae,{children:[js(e,1),tr.partRows?.(e,Ns)]}),i&&!s&&/* @__PURE__ */tt(Ae,{children:tr.ownRows?.(e,n,Ns)})]},String(e.props.id??n))}),Vl>0&&dl(Vl)]}),Hs=(e,n,t)=>{const o=String(e.props.id),r=hl(e).length>0||fl(e)||Boolean(ar(e.type)),i=r&&$r(o),l="header"===t?Ht.header:Ht.footer,s=pr.rowName?pr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return ot(rt,{children:[
|
|
32
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:t,size:13}),name:s,preview:rl(e),marks:il(e),badge:Ml(e)?void 0:Ll,shared:Ml(e),onSelect:()=>Yi(n),nameSlot:Ai(we,n,o,s),selected:Xo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Mr(o)}:void 0,actions:ll(e,we,n)??void 0,rowProps:{"data-node-id":o,onClick:tl(()=>Yi(n))}}),r&&!i&&/* @__PURE__ */tt(Ae,{children:Ms(e,1)})]})};return(tr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */tt(Z,{target:Io,children:/* @__PURE__ */ot("div",{ref:Bo,className:"sf-editor es-editor",style:nn(Or),onContextMenu:Di.onEditorContextMenu,...u(yn),children:[
|
|
34
|
-
/* @__PURE__ */ot(Ge,{children:[
|
|
35
|
-
/* @__PURE__ */tt(Xe,{items:Ls,ariaLabel:Ht.bar.views}),
|
|
36
|
-
/* @__PURE__ */ot(Ye,{children:[
|
|
37
|
-
/* @__PURE__ */tt(Je,{label:Ht.bar.undo,disabled:Boolean(yt)||!Ot.hasPast,onClick:()=>Ot.back(),children:/* @__PURE__ */tt(Yn,{})}),
|
|
38
|
-
/* @__PURE__ */tt(Je,{label:Ht.bar.redo,disabled:Boolean(yt)||!Ot.hasFuture,onClick:()=>Ot.forward(),children:/* @__PURE__ */tt(Jn,{})}),
|
|
39
|
-
/* @__PURE__ */tt(Ke,{}),
|
|
40
|
-
/* @__PURE__ */tt(Qe,{devices:so,value:ho,onChange:fo}),
|
|
41
|
-
/* @__PURE__ */tt(Je,{label:Ht.bar.refresh,tip:Ht.bar.refreshTip,onClick:()=>{Oo.current=(()=>{const e=Io?.document;if(!e)return null;const n=oi.findIndex(Vt),t=n>=0?n:oi.length;let o=null;for(let n=0;n<t;n++){const t=oi[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Bt?.props?.id??oi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Co(e=>e+1)},children:/* @__PURE__ */tt(Kn,{})})]}),
|
|
42
|
-
/* @__PURE__ */ot(Ye,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
-
/* @__PURE__ */tt(v,{input:jo,words:Ht.saveStatus}),tr.barLead?.(),tr.barTrail?.(),tr.mainAction||!tr.barMain?/* @__PURE__ */tt(S,{input:jo,action:tr.mainAction??{label:Ht.done,onPress:()=>{Hn(zt.data)}},readOnly:Boolean(yt),saveSwitch:vt,onToggleAutoSave:Xn,onSaveNow:To,bar:Ht.bar,words:Ht.saveStatus}):tr.barMain()]})]}),
|
|
44
|
-
/* @__PURE__ */tt(oe,{}),
|
|
45
|
-
/* @__PURE__ */ot("div",{className:"sf-body",children:[io?/* @__PURE__ */ot(rt,{children:[
|
|
46
|
-
/* @__PURE__ */tt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Ht.leftPanel,children:Ao?/* @__PURE__ */tt(x,{at:Vo?{label:(e=>{const n=Xl(e.zone);if(n)return Ht.add.addingTo({name:pr.rowName?nl(n,!0):gi(n.type)});if(e.zone===we){const n=oi[e.index];return n&&!Vt(n)?Ht.add.addingBefore({name:nl(n,!0)}):Ht.add.addingAtEnd}const t=Ql(e.zone);return t?Ht.add.addingTo({name:t.parentName}):Ht.add.addingHere})(Vo),onClear:()=>Fo(null)}:void 0,placeBlocks:Vo&&Vo.zone!==we?Ql(Vo.zone)?.choices:void 0,canTake:Vo?e=>{if(!Vo)return null;const n={...In(Vo.zone),index:Vo.index};if(ql(e,n))return null;if("shared"===e.kind&&Vo.zone===we&&!Pt.shared?.nodeOf(e.section))return Ht.shared.alreadyHere;const t=Xl(Vo.zone);if(t)return Ht.add.notInside({name:nl(t,!0)});if(Vo.zone===we)return Ht.add.onlySections;const o=Ql(Vo.zone);return o?Ht.add.notInside({name:o.parentName}):Ht.add.onlySections}:void 0,onPick:Vo?e=>{if(!Vo)return;const n={...In(Vo.zone),index:Vo.index};ql(e,n)&&(_l(e,n),el())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ns,siteWide:tr.addPanelRow?.(el),onClose:el,onHide:Zr,readOnly:Boolean(yt)}):yo&&mo?
|
|
47
|
-
/* @__PURE__ */tt(N,{panel:mo,pick:yo,onHide:Zr}):Rs?Rs.panel({onHide:Zr,notify:Lr}):"media"===or&&mo?/* @__PURE__ */tt(N,{panel:mo,pick:null,onHide:Zr}):/* @__PURE__ */ot(rt,{children:[
|
|
48
|
-
/* @__PURE__ */tt(O,{icon:/* @__PURE__ */tt(ue,{}),title:Ht.layers,context:Qt,actions:/* @__PURE__ */ot(rt,{children:[!yt&&/* @__PURE__ */tt(Ze,{label:Ht.add.title,onClick:()=>qi(null),children:/* @__PURE__ */tt(Qn,{size:15})}),
|
|
49
|
-
/* @__PURE__ */tt(Ze,{label:Dl?Ht.expandAll:Ht.collapseAll,title:0===Fl.length?Ht.nothingToFold:void 0,disabled:0===Fl.length,onClick:()=>Cr(e=>{const n=new Set(Fl);return Dl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Fl])}),children:/* @__PURE__ */tt(at,{expand:Dl})})]}),onHide:Zr}),
|
|
50
|
-
/* @__PURE__ */ot(Le,{className:"sf-tree sf-scroll",words:Wt,children:[
|
|
51
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:"page",size:13}),name:Ht.pageSettings,onSelect:ni,selected:!Bt&&Go,rowProps:{onClick:tl(ni)}}),Rl&&/* @__PURE__ */ot(rt,{children:[!Pl&&/* @__PURE__ */tt(Re,{children:Ht.header}),Ps(Rl)]}),xt&&!(Pl&&Rl)&&/* @__PURE__ */ot(rt,{children:[!Pl&&/* @__PURE__ */tt(Re,{children:Ht.header}),!Ft&&/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:"header",size:13}),name:Ht.header,badge:Al?void 0:Ll,shared:Al,onSelect:ti,selected:Wo.kind===Rt?.kind,rowProps:{onClick:tl(ti)}})]}),Bl&&!(Pl&&Rl)&&Hs(Bl,Ol,"header"),!Es&&/* @__PURE__ */tt(Re,{children:Vs}),Es?/* @__PURE__ */ot(rt,{children:[
|
|
52
|
-
/* @__PURE__ */tt(Te,{words:Wt,icon:null,name:Vs,fold:{open:!Fs,label:Vs,onToggle:()=>Mr(ht)}}),!Fs&&/* @__PURE__ */tt(Ae,{children:Ds})]}):Ds,xt&&!Pl&&/* @__PURE__ */tt(Re,{children:Ht.footer}),Cl&&!(Pl&&El)&&Hs(Cl,zl,"footer"),El&&Ps(El),tr.treeFoot?.()]})]})}),
|
|
53
|
-
/* @__PURE__ */tt(qe,{side:"left",width:Or.left,min:en,max:_e,defaultWidth:m.left,label:Ht.resizeLeftPanel,onResize:Nr})]}):/* @__PURE__ */tt(B,{side:"left",onShow:Zr}),
|
|
54
|
-
/* @__PURE__ */ot("div",{ref:Rr,className:"sf-center sf-scroll","data-sf-canvas-head":Hr?"":void 0,style:{overflowX:Jr?"auto":"hidden",overflowY:"hidden"},children:[Hr&&/* @__PURE__ */tt("div",{ref:Wr,className:"sf-canvas-head",children:/* @__PURE__ */tt(Hr,{device:ho})}),
|
|
55
|
-
/* @__PURE__ */ot("div",{className:"sf-frame-scaler",style:Kr,children:[
|
|
56
|
-
/* @__PURE__ */tt("div",{className:"sf-frame "+(ho===po?"":`sf-frame--${ho}`),style:Qr,children:/* @__PURE__ */ot("div",{className:"sf-preview-host",children:[
|
|
57
|
-
/* @__PURE__ */tt(Me.Provider,{value:Nl,children:/* @__PURE__ */tt(je.Provider,{value:Tl,children:/* @__PURE__ */tt(Zt,{},zo)})}),
|
|
58
|
-
/* @__PURE__ */tt(cn,{canvas:Io,session:ns,model:ks,measure:Ss,canDrop:ws,onDrop:zs,choose:is,onPick:Os,onZoneAdd:Bs,onSeamAdd:Bs,zoneAddLabel:Ht.canvasAddBlock,words:Ut.canvas,readOnly:Boolean(yt),revision:zt.data}),Do.length>0&&!No&&/* @__PURE__ */tt("div",{className:"sf-preview-gaps",children:Do.map(e=>
|
|
59
|
-
/* @__PURE__ */tt(pn,{index:e.index,label:Ht.addSectionHere,onInsert:()=>qi(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ds?/* @__PURE__ */tt(dt,{canvas:Io,tabs:ps,onSelect:e=>{const n=oi.findIndex(n=>String(n.props.id)===e);n>=0&&Yi(n)}}):null]})]}),lo?/* @__PURE__ */ot(rt,{children:[
|
|
60
|
-
/* @__PURE__ */tt(h,{value:{selectChild:Sl,addChild:bl,childRowName:ji,blockRowName:Hl},children:/* @__PURE__ */tt(qt,{mode:Wo,onOpenWebsiteSettings:tr.openSettings??(()=>{}),onOpenSiteStyles:tr.openStyles,onSelectNode:yr,onNotify:Lr,onHidePanel:qr,nodeActions:Bt?xe(Nt,Bt.type):ft})}),
|
|
61
|
-
/* @__PURE__ */tt(qe,{side:"right",width:Or.right,min:en,max:_e,defaultWidth:m.right,label:Ht.resizeSettingsPanel,onResize:Pr})]}):
|
|
62
|
-
/* @__PURE__ */tt(B,{side:"right",onShow:qr})]}),Di.menu,pi?/* @__PURE__ */tt(it,{name:pi.name,onMake:e=>(async(e,n)=>{const t=oi.find(n=>String(n.props.id)===e),o=Pt.shared;if(!t||!o)return;let r;try{r=await C(ci).create(n,t)}catch{return void Lr(Ht.shared.makeFailed,"error")}o.adopt(t,r),ui(null)})(pi.id,e),onCancel:()=>ui(null)}):null]})}))}export{mt as ScreenChrome};
|
package/dist/chunk-SNB4LQMK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-W6SDWCOL.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-QEAUF632.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
package/dist/chunk-STWSCR25.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-C2RHV42O.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as C,useCallback as H,useEffect as O,useRef as E}from"react";import{jsx as T}from"react/jsx-runtime";var A={content:[],root:{},zones:{}};var D=j(null);function M(){const e=R(D);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function N({target:j,addressing:R=o,onHostMessage:M,children:N}){const V=R,{homeSlug:F,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:Z,adapterFor:J,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=V,[G,K]=B(j),Q=k(),z=d(),_=C(()=>f(z),[z]),q=C(()=>t(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=C(()=>J(G,_,te),[J,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=H(e=>z.documentHooks?.stored?.(e)??e,[z]);O(()=>{m(z,ne)},[z,ne]);const se=E(G);O(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=I("screen",v),Pe=we?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})}}(we,be):null,[Ie,je]=B(null),Re=E(null),Be=E(null),[Ce,He]=B(!1),Oe=E(null),[Ee,Te]=B(null),Ae=E(null),[De,Me]=B(null),[Ne,Ve]=B(!1),Fe=E(null);O(()=>{Fe.current=De},[De]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=E(Le);O(()=>{Ye.current=Le},[Le]);const Ze=E(()=>Promise.resolve(!1)),Je=H(e=>{Be.current=e,He(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ze.current(e,r)){if(!p(Ye.current))return void Je({id:e,data:r});throw new Error("page save did not land")}}else Je({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:Xe,push:xe,flush:Ge,pause:Ke,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=E(Xe);O(()=>{er.current=Xe},[Xe]);const rr=u(Xe),nr=H(()=>{const e=Be.current;e&&(Be.current=null,He(!1),xe(e))},[xe]),tr=E("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=E(!1),[sr,ir]=B(L(j)),lr=E(!1);O(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;O(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Ae.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:A,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=H(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=H(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=H(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=H(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Ae.current,tr.current));if(t.ok)return Ae.current=t.value.version??Ae.current,Ve(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ae.current=n.value,Ze.current(e,r,!0)}ze(),Fe.current=u,Me(u)}return Ve(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);O(()=>{Ze.current=kr},[kr]);const vr=H(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Oe.current=r,p(Ye.current)?xe({id:ke,data:r}):Je({id:ke,data:r})},[ke,cr,Je,xe,ae]),gr=H(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=E(gr);O(()=>{pr.current=gr},[gr]);const hr=E(fr);O(()=>{hr.current=fr},[fr]);const yr=H(()=>{Q.address.reload()},[Q]),wr=E(()=>Promise.resolve(!1));O(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Ae.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Ie;O(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=H(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=H(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Ir=H(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Ke()},[nr,Ke,Qe]),jr=H(()=>{qe()},[qe]),Rr=H(e=>{Oe.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,He(!1)},setVersion:e=>{Ae.current=e},setSaveConflict:Me,setAccess:We}),Y(e),K(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&Z(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,Z]),Br=H(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,se.current,F))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ge().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ge,F]),Cr=H(()=>Te(null),[]),Hr=H(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Or=H(async()=>{const e=Ee;if(!e)return;await gr()&&(Te(null),Rr(e))},[Ee,gr,Rr]),Er=H(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Ae.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Ae.current=t.value.version??Ae.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
-
return T(D.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Oe.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:Xe,autoSaveEnabled:!Xe.paused,autoSaveStoppedByConflict:Xe.stopped,hasUnsavedEdits:Xe.pending||Ce,toggleAutoSave:Ir,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Er,access:Le,readOnly:null!==P(Le)||null!==Ie||null!==De,readOnlyReason:Ie,takeOverEditing:br,viewReadOnly:Pr,saveConflict:De,saveUnreachable:Ne,reloadFromServer:yr,navigate:Br,pendingNav:Ee,cancelPendingNav:Cr,discardAndNavigate:Hr,saveAndNavigate:Or},children:N})}export{D as ScreenDocumentContext,N as ScreenDocumentProvider,M as useScreenDocument};
|
package/dist/chunk-U277UX5I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-GWIVPLOX.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
package/dist/chunk-W6SDWCOL.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-QEAUF632.js";import{Inspector as i}from"./chunk-5ZBV5RA6.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function A({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(P.Provider,{value:n,children:e})}function B(){return u(P)}function D(){return(B().useOwnerName??v)()}function G(){return(B().useDocumentLabel??g)()}function N(n,e,t,r){return(B().useBridges??h)(n,e,t,r)}function x(n){return(B().useStandaloneBridges??h)(n)}function F(n,e){(B().useDocumentPass??y)(n,e)}function I(){return B().blockRules??b}function R(){return B().blockLook??O}function T(){return B().devices??j}function V(){return B().leftView??w}function E(){return B().pinned??L}function K(){return B().saveSwitch??!0}function Q(e){n(!0===B().pickFollowsSelection,e)}function W(){return B().storageNamespace||void 0}function Z(){return B().styleClipboard??null}function H(){return B().nodeKeys??!0}function U(){return B().notify??null}function Y(){return B().Canvas??S}function q(){return B().CanvasHead??null}function z(){return B().canvasDrag??null}var J=o(null);function M({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return B().Inspector??C}export{c as SELECTION_MODE,M as ScreenCanvasTargetProvider,A as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,R as useScreenBlockLook,I as useScreenBlockRules,N as useScreenBridges,z as useScreenCanvasDrag,Y as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,T as useScreenDevices,G as useScreenDocumentLabel,F as useScreenDocumentPass,$ as useScreenInspectorPanel,V as useScreenLeftView,H as useScreenNodeKeys,U as useScreenNotify,D as useScreenOwnerName,B as useScreenParts,Q as useScreenPickFollowsSelection,E as useScreenPinned,K as useScreenSaveSwitch,W as useScreenStorageNamespace,Z as useScreenStyleClipboard,x as useStandaloneScreenBridges};
|
package/dist/chunk-X52NFKUS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-SNB4LQMK.js";import{SELECTION_MODE as e}from"./chunk-W6SDWCOL.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-QEAUF632.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.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}=n(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-Z6PVRXVY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:i})=>`You saved this ${e} in another tab or window ${i}.`,savedByOther:({name:e,noun:i,when:n})=>`${e} saved this ${i} ${n}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:i,when:n})=>`${e} took over this ${i} ${n}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:i,seen:n})=>`${e} is editing this ${i} (last seen ${n}). Nothing you change here is saved.`,editing:({name:e,noun:i})=>`${e} is editing this ${i}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},i={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:i})=>`${e} to ${i}`,resize:"Drag to resize · double-click to reset",tierSection:"Section",tierBlock:"Block",partOf:({name:e})=>`Part of ${e}`,mediaLibrary:"Media library",mediaChoose:({kind:e})=>`Choose ${e}`,mediaFor:({field:e})=>`For ${e}`,mediaKinds:{image:"image",video:"video",svg:"SVG logo"},mediaCancel:"Cancel",mediaKeep:({kind:e})=>`Keep the current ${e}`,hidePanel:"Hide panel",hidePanelLabel:({side:e})=>`Hide the ${e} panel`,showPanel:"Show panel",showPanelLabel:({side:e})=>`Show the ${e} panel`};export{i as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { MediaPanelComponent, MediaPickRequest } from '../lib/media-panel.js';
|
|
3
|
-
import '../../host-epHo7r8P.js';
|
|
4
|
-
import '../../blocks/index.js';
|
|
5
|
-
import '../../types-Cq53lL8d.js';
|
|
6
|
-
import '../../data/index.js';
|
|
7
|
-
import '../../types-41704JE4.js';
|
|
8
|
-
import '../../resolve-D68pb3Bx.js';
|
|
9
|
-
import '../../plan-CZS902DV.js';
|
|
10
|
-
import '../lib/document-contract.js';
|
|
11
|
-
import '../lib/session.js';
|
|
12
|
-
import '../lib/backend-error.js';
|
|
13
|
-
import '../../edit-lock/index.js';
|
|
14
|
-
import '../lib/host-chrome.js';
|
|
15
|
-
import '../lib/links/link-filters.js';
|
|
16
|
-
import 'efficient-shell/ui';
|
|
17
|
-
import '../lib/document-hooks.js';
|
|
18
|
-
import '../lib/section-template-types.js';
|
|
19
|
-
import '../lib/puck/content-tree.js';
|
|
20
|
-
import '../lib/shared-section-types.js';
|
|
21
|
-
import '../lib/document-switch.js';
|
|
22
|
-
import '../../engine-CvXpFE86.js';
|
|
23
|
-
import '../lib/admin-bridge.js';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The left panel's MEDIA view: efficient-easel's `MediaPanelHead` over the
|
|
27
|
-
* HOST's media library (lib/media-panel), the host's one Media Library
|
|
28
|
-
* drawn narrow.
|
|
29
|
-
*
|
|
30
|
-
* The head is the engine's, the same one the campaign designer draws over the
|
|
31
|
-
* same library (card [MERGE] One Media Panel Head For Both Editors, owner
|
|
32
|
-
* ruling 2026-10-06: a part exists once, in efficient-easel). Its words, its
|
|
33
|
-
* two states and its Cancel are all there; this file only maps the request:
|
|
34
|
-
*
|
|
35
|
-
* • Browsing (`pick` null): "Media library", the website under it, and the
|
|
36
|
-
* hide button every panel ends with.
|
|
37
|
-
* • Choosing for a field: "Choose image / For Background image", and
|
|
38
|
-
* "Cancel" (the field gets nothing and the panel goes back to what it
|
|
39
|
-
* showed before). Hiding the panel cancels too.
|
|
40
|
-
*/
|
|
41
|
-
declare function MediaSidePanel({ panel: Panel, pick, onHide, }: {
|
|
42
|
-
panel: MediaPanelComponent;
|
|
43
|
-
pick: MediaPickRequest | null;
|
|
44
|
-
/** Hide the panel. Omitted where it cannot be hidden (the standalone section
|
|
45
|
-
* editor), and then the head draws no hide button. */
|
|
46
|
-
onHide?: () => void;
|
|
47
|
-
}): react.JSX.Element;
|
|
48
|
-
|
|
49
|
-
export { MediaSidePanel as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{MediaSidePanel as default}from"../../chunk-OBIL7BZO.js";import"../../chunk-W6SDWCOL.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-QEAUF632.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-5ZBV5RA6.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-GWIVPLOX.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-23VM4PMV.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/dist/words-D-yhjdOg.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { MarkStyle, MarkPlaceholders } from 'efficient-shell/markup';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* WHICH WAY the text is pointed — the closed vocabulary, in the shell, once.
|
|
6
|
-
*
|
|
7
|
-
* The owner's words on 2026-09-26, and they are the specification rather than
|
|
8
|
-
* the motivation: "I am really fed up that these features are scattered with no
|
|
9
|
-
* fixed format."
|
|
10
|
-
*
|
|
11
|
-
* ── What was measured before this existed ────────────────────────────────────
|
|
12
|
-
* The campaign designer had ONE builder (`alignmentField`) and FIVE option
|
|
13
|
-
* tables behind it. The storefront had SIXTEEN alignment rows written THREE
|
|
14
|
-
* ways: a house `alignField()` (5 rows), four hand-written `segmented(
|
|
15
|
-
* "Alignment", …)` that bypassed it, and one `select`. They did not agree on the
|
|
16
|
-
* words — Left / Center / Right in fourteen rows, Start / Center / End in two —
|
|
17
|
-
* and they did not agree on the STORED value either: one row stores
|
|
18
|
-
* `start` / `center` / `end` where every other stores `left` / `center` /
|
|
19
|
-
* `right`.
|
|
20
|
-
*
|
|
21
|
-
* Two vocabularies on screen and two in storage, for one question.
|
|
22
|
-
*
|
|
23
|
-
* ── The two rules ────────────────────────────────────────────────────────────
|
|
24
|
-
* 1. ONE WORD SET: Left / Center / Right, plus Justify where a host can honour
|
|
25
|
-
* it. Not Start/End. It is what fourteen of the sixteen rows already show and
|
|
26
|
-
* what the campaign already uses.
|
|
27
|
-
* 2. ONE STORED VOCABULARY: `left` / `center` / `right` / `justify`. A host with
|
|
28
|
-
* a different stored spelling migrates to this one; it does not teach this
|
|
29
|
-
* module a second name for the same direction.
|
|
30
|
-
*
|
|
31
|
-
* ── Why the host still picks a SUBSET ────────────────────────────────────────
|
|
32
|
-
* A closed vocabulary is not the same as a fixed strip. `justify` reads as
|
|
33
|
-
* ragged, word-gapped nonsense in a ~320px email column, and a block whose
|
|
34
|
-
* renderer cannot honour a direction must not offer it. So the host names which
|
|
35
|
-
* of these four apply — and cannot name a fifth, which is the part that was
|
|
36
|
-
* missing.
|
|
37
|
-
*
|
|
38
|
-
* Deliberately NOT here: `inherit`. It is not a direction, it is the absence of
|
|
39
|
-
* an answer, and it is a property of the row a host draws (an empty value
|
|
40
|
-
* presses nothing — see `SettingsSegmented`'s `value`) rather than a segment
|
|
41
|
-
* with a glyph. A strip that drew it would be offering "no answer" as an answer.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
/** Every direction this package knows, in reading order. */
|
|
45
|
-
declare const COPY_ALIGNS: readonly ["left", "center", "right", "justify"];
|
|
46
|
-
type CopyAlign = (typeof COPY_ALIGNS)[number];
|
|
47
|
-
/** The word each direction is called. American spelling, per the product's own
|
|
48
|
-
* rule (British is for client-facing design work, not the product). The words
|
|
49
|
-
* themselves are ./words' (`EaselStrings.copy.align`); this is their English. */
|
|
50
|
-
declare const COPY_ALIGN_LABELS: Record<CopyAlign, string>;
|
|
51
|
-
/** The mark each direction draws. `justify` is `align-justify` (E5b, design
|
|
52
|
-
* final 2026-10-06): rows run edge to edge. Until then it borrowed
|
|
53
|
-
* `align-separate`, whose own entry says it is NOT justify. */
|
|
54
|
-
declare const COPY_ALIGN_GLYPHS: Record<CopyAlign, ReactNode>;
|
|
55
|
-
/**
|
|
56
|
-
* How wide this strip's WORDS are, for the drop-to-glyphs threshold.
|
|
57
|
-
*
|
|
58
|
-
* The number is the measurement `SettingsSegmented` asks for and nothing else:
|
|
59
|
-
* the chip's padding, glyph and gaps are the shell's, and `panel.css` adds them.
|
|
60
|
-
* An over-estimate is safe (the words drop a little early); an under-estimate
|
|
61
|
-
* draws a button past the strip's edge.
|
|
62
|
-
*
|
|
63
|
-
* THREE is measured, not guessed — `efficient-storefront/components/PartSettingsPanel`
|
|
64
|
-
* had this exact pair as its own `ALIGN_FIT`, produced by
|
|
65
|
-
* `tests/fixtures/segmented-fit.html`. It moves here so the one alignment strip
|
|
66
|
-
* carries its own measurement, and that constant is deleted when the panel
|
|
67
|
-
* adopts this control.
|
|
68
|
-
*
|
|
69
|
-
* FOUR is an over-estimate, deliberately: "Justify" has never been drawn in a
|
|
70
|
-
* strip on this desk, so there is no measurement to move. Re-run the fixture and
|
|
71
|
-
* replace this pair with the real numbers the first time a host offers it.
|
|
72
|
-
*/
|
|
73
|
-
declare const COPY_ALIGN_FIT: {
|
|
74
|
-
readonly three: {
|
|
75
|
-
readonly labelsPx: 94.5;
|
|
76
|
-
readonly widestLabelPx: 39.94;
|
|
77
|
-
};
|
|
78
|
-
readonly four: {
|
|
79
|
-
readonly labelsPx: 140;
|
|
80
|
-
readonly widestLabelPx: 44;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
/** The strip's options, for the subset a host can honour. Order is always this
|
|
84
|
-
* module's, never the caller's array order — so two hosts offering the same
|
|
85
|
-
* three directions cannot draw them in two orders. `labels` is the words in
|
|
86
|
-
* the host's language (`useEaselStrings().copy.align`, 0.95.0); left out,
|
|
87
|
-
* English. */
|
|
88
|
-
declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<CopyAlign, string>): {
|
|
89
|
-
id: "left" | "right" | "center" | "justify";
|
|
90
|
-
label: string;
|
|
91
|
-
icon: ReactNode;
|
|
92
|
-
title: string;
|
|
93
|
-
}[];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The copy box's own words (`efficient-easel/strings`, 0.95.0): the bar's and
|
|
97
|
-
* the alignment strip's names, the four directions, each mark button's name
|
|
98
|
-
* and tooltip, and the words a mark writes when nothing is selected. The link
|
|
99
|
-
* window is efficient-shell's `LinkPicker`: its words are the shell
|
|
100
|
-
* catalogue's (`ShellStringsProvider`, `link`).
|
|
101
|
-
*
|
|
102
|
-
* NO REACT here, and no import but the grammar: the marks' names, tooltips and
|
|
103
|
-
* placeholders are READ from `efficient-shell/markup` (`MARKUP_TOOLS`,
|
|
104
|
-
* `MARK_PLACEHOLDERS`) rather than typed a second time, so the English lives
|
|
105
|
-
* once, in the grammar, where the campaign designer's own toolbar reads it too.
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
type CopyWords = {
|
|
109
|
-
/** The formatting bar's accessible name. */
|
|
110
|
-
formatting: string;
|
|
111
|
-
/** The alignment strip's accessible name. */
|
|
112
|
-
alignment: string;
|
|
113
|
-
/** The word each direction is called. */
|
|
114
|
-
align: Record<CopyAlign, string>;
|
|
115
|
-
/**
|
|
116
|
-
* Each mark button, for a bar handed STYLES (`tools={['bold', 'link']}`).
|
|
117
|
-
* `name` is what the button is called; `title` its tooltip, which also says
|
|
118
|
-
* what the mark writes and its shortcut. A host's own descriptors
|
|
119
|
-
* (`MarkupTool[]`) are used as given and never read these.
|
|
120
|
-
*
|
|
121
|
-
* @deprecated Read by nothing since the copy box's one bar became the shell's
|
|
122
|
-
* `TextToolbar`, which names its buttons in the shell catalogue
|
|
123
|
-
* (`ShellStringsProvider`, `textToolbar`). Removed in 12.0.0.
|
|
124
|
-
*/
|
|
125
|
-
marks: Record<MarkStyle, {
|
|
126
|
-
name: string;
|
|
127
|
-
title: string;
|
|
128
|
-
}>;
|
|
129
|
-
/** What a mark writes when nothing is selected — typed over at once. */
|
|
130
|
-
placeholders: MarkPlaceholders;
|
|
131
|
-
/** The switch under a many-line box that shows the raw text with its marks
|
|
132
|
-
* (E5a). Optional, so a host's words from before still type; English when
|
|
133
|
-
* left out. */
|
|
134
|
-
showMarks?: string;
|
|
135
|
-
/** The colour window: its name, the theme row's label, and Remove. */
|
|
136
|
-
colors?: {
|
|
137
|
-
title: string;
|
|
138
|
-
theme: string;
|
|
139
|
-
remove: string;
|
|
140
|
-
/** "Any color": the square, the hue bar and the hex box under the theme. */
|
|
141
|
-
any: string;
|
|
142
|
-
square: string;
|
|
143
|
-
hue: string;
|
|
144
|
-
hex: string;
|
|
145
|
-
};
|
|
146
|
-
/** The one text panel's rows (`TextPartPanel`, text panel v3) and their
|
|
147
|
-
* answers. Optional, so a host's words from before still type; English when left
|
|
148
|
-
* out. */
|
|
149
|
-
panel?: {
|
|
150
|
-
style: string;
|
|
151
|
-
editStyles: string;
|
|
152
|
-
updateStyle: string;
|
|
153
|
-
font: string;
|
|
154
|
-
italic: string;
|
|
155
|
-
list: string;
|
|
156
|
-
lists: {
|
|
157
|
-
none: string;
|
|
158
|
-
bullet: string;
|
|
159
|
-
number: string;
|
|
160
|
-
};
|
|
161
|
-
capitalization: string;
|
|
162
|
-
cases: {
|
|
163
|
-
none: string;
|
|
164
|
-
upper: string;
|
|
165
|
-
capitalize: string;
|
|
166
|
-
lower: string;
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
/** The number cells' names, and the tooltip each one carries. */
|
|
170
|
-
cells?: {
|
|
171
|
-
fontSize: string;
|
|
172
|
-
lineHeight: string;
|
|
173
|
-
letterSpacing: string;
|
|
174
|
-
paragraphSpacing: string;
|
|
175
|
-
tip: (v: {
|
|
176
|
-
name: string;
|
|
177
|
-
step: number;
|
|
178
|
-
unit: string;
|
|
179
|
-
}) => string;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export { type CopyWords as C, type CopyAlign as a, COPY_ALIGNS as b, COPY_ALIGN_FIT as c, COPY_ALIGN_GLYPHS as d, COPY_ALIGN_LABELS as e, copyAlignOptions as f };
|