efficient-easel 13.0.0 → 13.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-J54OXLQF.js → chunk-3BP4XJVF.js} +1 -1
- package/dist/{chunk-H5QI34FV.js → chunk-44ACS7DZ.js} +1 -1
- package/dist/chunk-BPXEFVSQ.js +1 -0
- package/dist/chunk-CKKP537S.js +57 -0
- package/dist/{chunk-NW4LJ4G4.js → chunk-HWJ6RP4W.js} +1 -1
- package/dist/chunk-JLBDVLRD.js +1 -0
- package/dist/chunk-LER7RKTO.js +1 -0
- package/dist/{chunk-52LIZZG4.js → chunk-O2ZIQES6.js} +3 -3
- package/dist/{chunk-FZ3Y3QTQ.js → chunk-O5HIBDDA.js} +4 -4
- package/dist/chunk-SO5OLDH7.js +21 -0
- package/dist/{chunk-J2JDC3EZ.js → chunk-UU2WKWIA.js} +1 -1
- package/dist/{chunk-YWUHPY5W.js → chunk-VNIXR4UI.js} +3 -3
- package/dist/{chunk-S2MMPHKD.js → chunk-VRMUSWKL.js} +1 -1
- package/dist/{chunk-M4CNCPHA.js → chunk-XT6DOSHO.js} +1 -1
- package/dist/{chunk-TLDRFVD2.js → chunk-ZTJU4SGV.js} +1 -1
- package/dist/copy/index.d.ts +1 -1
- package/dist/easel/index.d.ts +1 -1
- package/dist/fields/index.d.ts +66 -5
- package/dist/fields/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/panel-fields.js +1 -1
- 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/screen-parts.js +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/{types-Dkx1VAIQ.d.ts → types-URH28nku.d.ts} +4 -0
- package/package.json +3 -3
- package/dist/chunk-6RLEHTMK.js +0 -1
- package/dist/chunk-BPZQ7S2Z.js +0 -21
- package/dist/chunk-FUMIBYUU.js +0 -57
- package/dist/chunk-ZE7I3PLX.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-O5HIBDDA.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PVAIOBBE.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-VRMUSWKL.js";import{SELECTION_MODE as e}from"./chunk-O5HIBDDA.js";import{usePreviewParts as r}from"./chunk-I54UCYOU.js";import{decodePartId as t,encodePartId as n}from"./chunk-IYT6NN2J.js";import{useEasel as p}from"./chunk-PVAIOBBE.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=r(),l=d(o=>{const r=t(o);if(!r)return;const{nodeId:n,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?n(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isShown as t,showWhenOf as e}from"efficient-shell/format";export{showWhenOf,withShowWhen}from"efficient-shell/format";function o(o,n){return t(e(o),n.values??{},n.context??{})}function n(t,e){let n=!1;const f={};for(const[r,i]of Object.entries(t))o(i,e)?f[r]=i:n=!0;return n?f:t}export{o as fieldIsShown,n as shownFields};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{styleClipboardOf as e}from"./chunk-XT6DOSHO.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-4EI6UGGH.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as S,clampPanelWidth as k}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-44ACS7DZ.js";import{useSectionOps as b}from"./chunk-VRMUSWKL.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-VNIXR4UI.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as I}from"./chunk-UU2WKWIA.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as N,useScreenPinned as O,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as A,useScreenPickFollowsSelection as j,useScreenLeftView as T,SELECTION_MODE as R,sameInspectorMode as L,useScreenBridges as V,useScreenBlockRules as E,useScreenBlockLook as F,useScreenStorageNamespace as W,useScreenNotify as H,useScreenCanvasHead as D,isSlotMode as U,useScreenStyleClipboard as J,useScreenDocumentPass as G,useScreenCanvasDrag as Y,ScreenCanvasTargetProvider as X,isPinnedFirst as K,isPinnedLast as q,screenSlotsOf as Z}from"./chunk-O5HIBDDA.js";import{useNodeClipboard as _,useNodeContextMenu as Q}from"./chunk-HWJ6RP4W.js";import{PageEditGuardNotices as ee}from"./chunk-IWFVVCRN.js";import{useScreenDocument as ne}from"./chunk-FBS75I6E.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{heldStyle as ce,styleShortcut as ae}from"./chunk-V7U33NF2.js";import{DEFAULT_SCREEN_WORDS as pe}from"./chunk-VVPZMWJE.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as Se,blockNodeActions as ke,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{useEasel as Ie,useEaselApi as Be,CanvasPassThroughContext as Ne}from"./chunk-PVAIOBBE.js";import{toItemSelector as Oe,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Ae,LayersTree as je,TreeGroupLabel as Te,TreeRowAction as Re,TreeSeam as Le}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ve}from"./chunk-K56YDHYQ.js";import{LayersIcon as Ee,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as We,TopBarRail as He,TopBarCluster as De,EaselIconButton as Ue,TopBarDivider as Je,DeviceSwitch as Ge,InspectorIconButton as Ye,PanelResizeHandle as Xe,MAX_PANEL_W as Ke,MIN_PANEL_W as qe,panelWidthVars as Ze}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-AYWN5NRH.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as Sn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as In,useMemo as Bn,useState as Nn,useEffect as On,useCallback as Pn,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as An,toast as jn,groupColors as Tn}from"efficient-shell/ui";import{UndoIcon as Rn,RedoIcon as Ln,RefreshIcon as Vn,AddIcon as En,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Hn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Jn,Fragment as Gn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Xn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Kn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${Sn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Un(An,{colorClass:Tn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
|
|
2
|
+
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Jn(Gn,e?{children:[
|
|
3
|
+
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
+
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
+
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
+
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
+
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var Zn=`${fn}, ${hn}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=se(),{target:yn,docId:Sn,capabilities:kn,currentSlug:Tn,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=ne(),ft=B(),ht=N(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Ie(e=>e),zt=O(),{first:Ct,firstGroup:It,lastGroup:Bt,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>K(zt,e),At=e=>q(zt,e),jt="node"===zt.firstRow,Tt=zt.band??null,Rt=on("screen",pe),Lt=on("tree",Ve),Vt=on("drag",dn),Et=on("notice",_e),Ft=on("lock",tn),Wt=on("menu",fe),Ht=on("styleClipboard",ue),Dt=on("chrome",Qe),Ut=P()??`/${Tn}`,Jt=$(),Gt=M(),Yt=b({readOnly:pt}),Xt=b({readOnly:pt,foldIntoHistory:!0}),Kt=In(null),qt=Be(),Zt=Bn(()=>({...Yt,select:e=>{Kt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Kt.current=Oe(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=A(),[lo,so]=Nn(oo),co=oe(),ao=mt&&null!==co,po=re(),uo=ie();j(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=T(),[go,yo]=Nn(fo);On(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=In(null),bo=In(null),wo=un(bo,{readySelector:Zn}),xo=u(bo);f(bo,wo);const zo=d(),Co=en(ct),Io={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Et.editing({name:nn(Co.name,Ft),noun:Rt.noun}):null,conflict:null!=it,notSaving:Rt.bar.notSaving},Bo=()=>{pt||(rt.failed?lt():dt())};h(bo,wo,Bo);const[No,Oo]=Nn(!1),Po=In(!1),$o=In(!1),[Mo,Ao]=Nn(null),[jo,To]=Nn([]),[Ro,Lo]=Nn(R),Vo="puck"===Ro.kind,Eo=n(Ro,bt?.props.id),[Fo,Wo]=Nn(null);On(()=>{Fo&&(t(),Wo(null))},[Fo]);const Ho=In(wt);Ho.current=wt;const Do=Pn((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Wo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ho.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Uo=In(null);On(()=>{const e=Uo.current;Uo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Lo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??R);const t=bt?.props.id,r=Kt.current;if(Kt.current=null,!t)return;const i=wt(t);Do(String(t),{scroll:!o(r,i??null,Se)})},[bt?.props.id,Do]);const Jo=Pn(e=>{Lo(n=>L(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Go=In(()=>{});Go.current=(e,n)=>{const t=e?ui(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Lo(e=>L(e,n)?e:n),o!==r&&(Uo.current={id:o,mode:n},Zt.select(e))};const Yo=Pn((e,n)=>Go.current(e,n),[]),Xo={kind:Ro.kind,mode:Ro,open:Jo,show:e=>Lo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Yo},Ko=V(Xo,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Lo(R),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(Se,e,n),scrollTo:e=>Li(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Ko.pinnedSource??!1,Zo=Ko.resolveLeftView?Ko.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=E(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=F(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=Pn(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Do(e,{scroll:!0})},[kt,Do]),{selectNode:pr,openPartId:ur}=v({mode:Ro,setMode:Lo,onOpenPart:ar}),[fr,hr]=Nn(null);de(null!==fr,()=>hr(null));const mr=y(W()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
+
return new Set}});On(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(yr);if(!e)return{...S};const n=JSON.parse(e);return{left:k(Number(n.left)||S.left),right:k(Number(n.right)||S.right)}}catch{return{...S}}});On(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=Pn((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=Pn(e=>wr("left",e),[wr]),zr=Pn(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Ir=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Br=In(!1),Nr=In(null);On(()=>{if(Br.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Rt.add.title)}"]`))?.focus(),Nr.current=null}Br.current=No},[No]),On(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ji()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),de(No,()=>Ji()),On(()=>{!Qt&&No&&(Oo(!1),Ao(null),Po.current=!1)},[Qt]),On(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),Ao(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),On(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),On(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),de(null!==po,()=>uo());const Or=H(),Pr=(e,n="success",t)=>{if(Or)return void(t?Or(e,"error"===n?"error":"info",t):Or(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},$r=In(null),[Mr,Ar]=Nn(0),[jr,Tr]=Nn(0),Rr=D(),Lr=In(null),Vr=e=>Math.max(0,e.clientHeight-(Lr.current?.offsetHeight??0));On(()=>{const e=$r.current;if(!e)return;const n=()=>{Ar(e.clientWidth),Tr(Vr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Lr.current&&t.observe(Lr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Ar($r.current.clientWidth),Tr(Vr($r.current)))},[vr,Qt,eo]);const Er=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Er,"shrink"===io?1:2):1,Wr=Er*Fr,Hr=Mr>0&&Wr>Mr+1,Dr={width:Wr,height:jr||"100%",flex:"none",position:"relative"},Ur={width:Er,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Jr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Gr=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Yr=e=>{No&&(Oo(!1),Ao(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Jr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Dt.mediaLibrary})},Kr=()=>{Lo(R),Zt.select(null),p()},qr=()=>{Lo($t??R),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=St.data.content??[],_r=()=>{const e=Zr.findIndex(Mt),n=Zr.findIndex(At);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>r(e,ei),ti=_(),oi=Pe({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Lo(R);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Se?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Rt.deleted({name:r}),"success",{duration:8e3,action:{label:Rt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=Pn(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>he({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=Bn(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,Se,0),{nodeAddresses:e,zoneItems:n}},[Zr,xt]),ui=Pn(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>Z(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===Se)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},gi=(()=>{if(!U(Ro))return null;const e=`${Ro.nodeId}:${Ro.slot}`;return mi(e)?.slot.panel===Ro.kind?e:null})(),yi=In(null);On(()=>{const e=yi.current;if(yi.current=null,!gi||!U(Ro))return;const n=Ro.nodeId;Do(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ro]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===Se?Vi(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Yo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Li(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;gi!==o&&(yi.current=o);Yo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=Bn(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>me(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===Se||Al(n)?"section":"block",r=n===Se&&(Mt(e)||At(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
+
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Rt.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)},Ii=e(J(),Ht),Bi=Ii.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Oi=(e,n)=>n===Se?di(e):li(e),Pi=(e,n,t)=>{const o=Ii.plan(Bi,t,Oi(t.type,e),Ni);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Pr(o.message))},$i=Q({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===Se?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{Zt.select(null),Lo(R)},pageSettingsLabel:Rt.pageSettings,words:{menu:Wt,styleClipboard:Ht,screen:Rt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Rt.pasteRefused({name:e.label}):Rt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Rl(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>ke(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===Se&&(Mt(e)||At(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===Se?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===Se?Vi(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>ce(Bi),canCopy:e=>Ii.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Ii.copy(Bi,e,Oi(e.type,n),Ni),paste:(e,n,t)=>Pi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Rt.copied({name:n}))}}:void 0},wo),Mi=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});On(()=>{Mi.current={copy:(e,n)=>Ii.copy(Bi,e,Oi(e.type,n),Ni),paste:Pi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ai=Pn(e=>{const n=ae(e);if(!n)return;const t=Mi.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))},[]);On(()=>{if(!xo)return;const e=e=>Ai(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ai,xo]),mn(wo,"keydown",Ai);const ji=Zr.map(e=>e.props.id).join("|");On(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void To(e=>e.length?[]:e);const n=Zr.findIndex(At),t=n>=0?n:Zr.length,o=n=>{const t=Zr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=Zr.length>0&&!Mt(Zr[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}To(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[wo,ji,lo,Fr,Qt,eo,bt?.props.id]);const Ti=wo?.document??null,Ri=wo?.window??null;On(()=>{const e=vo.current;if(!e||!Ti||!Ri)return;const n=[],t=()=>{const n=Ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ri.scrollTo({left:Ri.scrollX,top:Ri.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ti,Ri]);const Li=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):c(e)},Vi=e=>{Lo(R),Zt.select({index:e}),Ko.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Li(n)},Ei=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Ro.kind!==$t?.kind?Zr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(Se,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Lo(R),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Pr(Rt.sectionAdded({name:t}))},Hi=(e,n)=>{const t=Ei(n),o=tr(e,{nodeDefaults:si,newNodeId:Ce,sectionLabel:di,blockIsOffered:rr}),r=o?Zt.insertNode(Se,t,o):Zt.insertSection(e,t);return Wi(t,r,di(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of be(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Di=e=>Ui(Se,e),Ui=(e,n)=>{Nr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),Ao(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{Oo(!1),Ao(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Gi=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Rt.header):At(e)?ir.rowName(e,"section",Rt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Yi=e=>n=>{e()},Xi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!ke(xt,o.type).delete?null:/* @__PURE__ */Un(Re,{kind:"delete",label:Rt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Un(Fn,{size:15})})},qi=e=>ir.rowPreview?.(e)||void 0,Zi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
+
return Un(Re,{kind:"eye",label:r?Rt.showNamed({name:o}):Rt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Un(r?Wn:Hn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(Se,e),nl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>we(xt,e),ol=e=>be(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ze(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Lo(R),or(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),Zt.select({index:n,zone:e}),c(t)}else Zt.select({index:n,zone:e}),Li(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},hl=In(/* @__PURE__ */new Set);On(()=>{Zr.forEach(e=>{const n=or(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(si)).forEach((e,t)=>Xt.seedChild(o,t,n.childType,e))})},[Zr,Xt,si]);const ml=In(/* @__PURE__ */new Set);On(()=>{Zr.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=i(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(Se,n,{...e,props:o})})},[Zr,Xt]),G(Xt,xt);const gl=Zr.findIndex(At),yl=gl>=0?Zr[gl]:null,Sl=jt?Zr.findIndex(Mt):-1,kl=Sl>=0?Zr[Sl]:null,vl=zt.groupTab,bl=Bn(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(An,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=Zr.find(e=>e.type===It)??null,Cl=Zr.find(e=>e.type===Bt)??null,Il=gl>=0?gl:Zr.length,Bl=[];Zr.forEach(e=>{At(e)||(al(e)&&Bl.push(String(e.props.id)),Bl.push(...cl(e,1,pl)))}),yl&&(Bl.push(String(yl.props.id)),Bl.push(...cl(yl,1,pl)));const Nl=Bl.length>0&&Bl.every(e=>Sr.has(e)),Ol=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Al=e=>{const n=e.slice(0,e.indexOf(":")),t=Zr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},jl=(e,n)=>{const t=Al(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Tl=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return El(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Al(o),i=Al(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||Ml(e.zone)!==l&&Ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(St?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(ui(n),r))})(e.zone,o,e.index,t)},Rl=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Tl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Ll=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(St?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===Se)}},Vl=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Se||Al(t)?e:Ll(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},El=(e,n)=>{const t=Vl(e,n),o=wn(n);if("block"!==t.kind){if(Al(o)){const e="section"===t.kind?t.type:t.template.node.type;return jl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=Ll(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=Vl(e,n);if("block"!==t.kind&&Al(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,ni(e.template.node))}Lo(R),Zt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Hi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Ei(t),r=Zt.insertNode(Se,o,n);Wi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=Ll(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{Zt.insertComponent(e,n,t),Lo(R),Zt.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===Se?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Hl]=Nn(()=>cn()),Dl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Hl,canDrop:Tl,onDrop:Wl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Se?((e,n)=>{const t=di(Zr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Pr(n<0?Rt.sectionFirst({name:t}):Rt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Pr(Rt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=Pn(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||At(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Al(e)),s=e===Se||l;e===Se&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Rt.addSection,addAlways:!0}];const t=Ll(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Al(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Se||Al(n)?null:Ll(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Rt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Jl=null==bt?.props.id?null:String(bt.props.id),Gl=Pn(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Jl);return i||(r($e(St.data,n,o.item.id,Jl,bl))??o)},[St.data,xt,Jl,bl]),[Yl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Xn(St.data,xt,n):null;t!==Yl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>Mt(e)||At(e)||Nt(e.type),ql=[];if(vl){const e=Jl?Xn(St.data,xt,Jl):null;for(const n of/* @__PURE__ */new Set([e,Yl])){const e=n?Zr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&ql.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===It})}}const Zl=le(),_l=In(null);On(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(Zr.filter(Kl)),t=_l.current;if(_l.current={doc:Sn,bands:n,index:vt.index},!t||t.doc!==Sn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Yn.has(Zl)&&(Yn.add(Zl),Pr(e,"success",{action:{label:Rt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[Zr]);const Ql=e=>{Lo(R),Zt.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},es=Y(),ns=()=>({data:St.data,device:lo,ops:Zt,inspector:Xo}),ts=es?.model,os=Bn(()=>ts?e=>ts(e,Ul(e),ns()):Ul,[ts,Ul,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Tl,ns()):Tl,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,Ql,ns()):Ql,us=e=>{const n=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Ui(n,e.index)},fs=(e,n)=>/* @__PURE__ */Un(Le,{...pt?{}:Dl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Yi,isCollapsed:Cr,toggleCollapse:Ir},ms=e=>{const n=String(e.props.id),t=Zr.findIndex(e=>String(e.props.id)===n),o=Ot(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
|
|
11
|
+
return Jn(Gn,{children:[
|
|
12
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:Zi(e),onSelect:()=>Vi(t),nameSlot:Ci(Se,t,n,s),selected:Eo===n,badge:xl,actions:_i(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Yi(()=>Vi(t))},fold:{open:!i,label:"section",onToggle:()=>Ir(n)}}),!i&&/* @__PURE__ */Jn(Ae,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Yi(c)});/* @__PURE__ */
|
|
13
|
+
return Jn(Mn,{children:[d(t),
|
|
14
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Eo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un(Ae,{children:Ss(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Tl(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Yi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
+
return Jn(Mn,{children:[n.heading,
|
|
16
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ir(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Gn,{children:h.map((t,o)=>/* @__PURE__ */Un(Re,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Un(Fn,{size:15}):/* @__PURE__ */Un(Dn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un(Ae,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
+
return Un(Gn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Jn(Gn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Yi(p)});/* @__PURE__ */
|
|
18
|
+
return Jn(Mn,{children:[0===o&&a(t,0),
|
|
19
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:c,preview:qi(n),marks:Zi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ir(d)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un(Ae,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Un(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
+
return Un(Gn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Jn(Gn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),i=xi(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...xn(p),index:ui(p).length}:void 0,f=Dl.dragging,h=u&&f&&Tl(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Yi(g)});/* @__PURE__ */
|
|
21
|
+
return Jn(Mn,{children:[0===o&&m(t,0),
|
|
22
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Ir(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Jn(Gn,{children:[Ki(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un(Ae,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
+
/* @__PURE__ */Un(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?gs(e,o.rung,i++,r,S):/* @__PURE__ */Un(Mn,{children:S},o.slot??"")})})},ks=No||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!ks&&Zo===e.id,onSelect:()=>Yr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Rt.layers,icon:/* @__PURE__ */Un(Ee,{}),active:Qt&&!ks&&"sections"===Zo,onSelect:()=>Yr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),active:Qt&&!No&&(null!==po||"media"===Zo),onSelect:()=>Yr("media")}):mt&&bs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),onSelect:Xr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),xs=Boolean(Tt?.foldable)&&!qo,zs=Tt?.label??(gt?Rt.pageSections:Rt.templateSections),Cs=xs&&Cr(et),Is=/* @__PURE__ */Jn(Gn,{children:[Zr.map((e,n)=>{if(Mt(e)||At(e)||Nt(e.type))return null;const t=Eo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Ko.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Dl.dragging,u=a&&p&&Tl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:Se,index:n,type:e.type},place:{...xn(Se),index:n},into:u},{"data-node-id":r,onClick:Yi(()=>Vi(n))});/* @__PURE__ */
|
|
24
|
+
return Jn(Mn,{children:[n>0&&el(n),
|
|
25
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:Zi(e),onSelect:()=>Vi(n),nameSlot:Ci(Se,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(Se,n,ci(e)),_i(e,Se,n),Qi(Se,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Jn(Ae,{children:[Ss(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Un(Ae,{children:Ko.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!qo&&Il>0&&el(Il)]}),Bs=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Rt.header:Rt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
+
return Jn(Gn,{children:[
|
|
27
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:t,size:13}),name:s,preview:qi(e),marks:Zi(e),badge:xl,onSelect:()=>Vi(n),nameSlot:Ci(Se,n,o,s),selected:Eo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ir(o)}:void 0,actions:_i(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Yi(()=>Vi(n))}}),r&&!i&&/* @__PURE__ */Un(Ae,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
|
|
28
|
+
/* @__PURE__ */Un(X,{target:wo,children:/* @__PURE__ */Jn("div",{ref:bo,className:"sf-editor es-editor",style:Ze(vr),onContextMenu:$i.onEditorContextMenu,...m(fn),children:[
|
|
29
|
+
/* @__PURE__ */Jn(We,{children:[
|
|
30
|
+
/* @__PURE__ */Un(He,{items:bs,ariaLabel:Rt.bar.views}),
|
|
31
|
+
/* @__PURE__ */Jn(De,{children:[
|
|
32
|
+
/* @__PURE__ */Un(Ue,{label:Rt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
33
|
+
/* @__PURE__ */Un(Ue,{label:Rt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Un(Ln,{})}),
|
|
34
|
+
/* @__PURE__ */Un(Je,{}),
|
|
35
|
+
/* @__PURE__ */Un(Ge,{devices:no,value:lo,onChange:so}),
|
|
36
|
+
/* @__PURE__ */Un(Ue,{label:Rt.bar.refresh,tip:Rt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=Zr.findIndex(At),t=n>=0?n:Zr.length;let o=null;for(let n=0;n<t;n++){const t=Zr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=bt?.props?.id??Zr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Un(Vn,{})})]}),
|
|
37
|
+
/* @__PURE__ */Jn(De,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
+
/* @__PURE__ */Un(l,{input:Io,words:Rt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Un(s,{input:Io,action:Ko.mainAction??{label:Rt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Bo,bar:Rt.bar,words:Rt.saveStatus}):Ko.barMain()]})]}),
|
|
39
|
+
/* @__PURE__ */Un(ee,{}),
|
|
40
|
+
/* @__PURE__ */Jn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Jn(Gn,{children:[
|
|
41
|
+
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Rt.leftPanel,children:No?/* @__PURE__ */Un(x,{at:Mo?{label:(e=>{const n=Al(e.zone);if(n)return Rt.add.addingTo({name:ir.rowName?Gi(n,!0):li(n.type)});if(e.zone===Se){const n=Zr[e.index];return n&&!At(n)?Rt.add.addingBefore({name:Gi(n,!0)}):Rt.add.addingAtEnd}const t=Ll(e.zone);return t?Rt.add.addingTo({name:t.parentName}):Rt.add.addingHere})(Mo),onClear:()=>Ao(null)}:void 0,placeBlocks:Mo&&Mo.zone!==Se?Ll(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(El(e,n))return null;const t=Al(Mo.zone);if(t)return Rt.add.notInside({name:Gi(t,!0)});if(Mo.zone===Se)return Rt.add.onlySections;const o=Ll(Mo.zone);return o?Rt.add.notInside({name:o.parentName}):Rt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};El(e,n)&&(Fl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Ko.addPanelRow?.(Ji),onClose:Ji,onHide:Jr,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
+
/* @__PURE__ */Un(I,{panel:co,pick:po,onHide:Jr}):ws?ws.panel({onHide:Jr,notify:Pr}):"media"===Zo&&co?/* @__PURE__ */Un(I,{panel:co,pick:null,onHide:Jr}):/* @__PURE__ */Jn(Gn,{children:[
|
|
43
|
+
/* @__PURE__ */Un(z,{icon:/* @__PURE__ */Un(Ee,{}),title:Rt.layers,context:Ut,actions:/* @__PURE__ */Jn(Gn,{children:[!pt&&/* @__PURE__ */Un(Ye,{label:Rt.add.title,onClick:()=>Di(null),children:/* @__PURE__ */Un(En,{size:15})}),
|
|
44
|
+
/* @__PURE__ */Un(Ye,{label:Nl?Rt.expandAll:Rt.collapseAll,title:0===Bl.length?Rt.nothingToFold:void 0,disabled:0===Bl.length,onClick:()=>kr(e=>{const n=new Set(Bl);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Bl])}),children:/* @__PURE__ */Un(qn,{expand:Nl})})]}),onHide:Jr}),
|
|
45
|
+
/* @__PURE__ */Jn(je,{className:"sf-tree sf-scroll",words:Lt,children:[
|
|
46
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:"page",size:13}),name:Rt.pageSettings,onSelect:Kr,selected:!bt&&Vo,rowProps:{onClick:Yi(Kr)}}),zl&&/* @__PURE__ */Jn(Gn,{children:[!wl&&/* @__PURE__ */Un(Te,{children:Rt.header}),ms(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Jn(Gn,{children:[!wl&&/* @__PURE__ */Un(Te,{children:Rt.header}),!jt&&/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:"header",size:13}),name:Rt.header,badge:xl,onSelect:qr,selected:Ro.kind===$t?.kind,rowProps:{onClick:Yi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Bs(kl,Sl,"header"),!qo&&!xs&&/* @__PURE__ */Un(Te,{children:zs}),xs?/* @__PURE__ */Jn(Gn,{children:[
|
|
47
|
+
/* @__PURE__ */Un(Me,{words:Lt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Ir(et)}}),!Cs&&/* @__PURE__ */Un(Ae,{children:Is})]}):Is,yt&&!wl&&/* @__PURE__ */Un(Te,{children:Rt.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Un(Me,{words:Lt,icon:/* @__PURE__ */Un(sr,{type:"footer",size:13}),name:Rt.footer,onSelect:Xi,rowProps:{onClick:Yi(Xi),title:Rt.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
|
|
48
|
+
/* @__PURE__ */Un(Xe,{side:"left",width:vr.left,min:qe,max:Ke,defaultWidth:S.left,label:Rt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Un(C,{side:"left",onShow:Jr}),
|
|
49
|
+
/* @__PURE__ */Jn("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Rr?"":void 0,style:{overflowX:Hr?"auto":"hidden",overflowY:"hidden"},children:[Rr&&/* @__PURE__ */Un("div",{ref:Lr,className:"sf-canvas-head",children:/* @__PURE__ */Un(Rr,{device:lo})}),
|
|
50
|
+
/* @__PURE__ */Jn("div",{className:"sf-frame-scaler",style:Dr,children:[
|
|
51
|
+
/* @__PURE__ */Un("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Ur,children:/* @__PURE__ */Jn("div",{className:"sf-preview-host",children:[
|
|
52
|
+
/* @__PURE__ */Un(Ne.Provider,{value:bl,children:/* @__PURE__ */Un(Jt,{},So)}),
|
|
53
|
+
/* @__PURE__ */Un(ln,{canvas:wo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Gl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Rt.canvasAddBlock,words:Vt.canvas,readOnly:Boolean(pt),revision:St.data}),jo.length>0&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:jo.map(e=>
|
|
54
|
+
/* @__PURE__ */Un(sn,{index:e.index,label:Rt.addSectionHere,onInsert:()=>Di(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),vl?/* @__PURE__ */Un(Kn,{canvas:wo,tabs:ql,onSelect:e=>{const n=Zr.findIndex(n=>String(n.props.id)===e);n>=0&&Vi(n)}}):null]})]}),eo?/* @__PURE__ */Jn(Gn,{children:[
|
|
55
|
+
/* @__PURE__ */Un(g,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Ol},children:/* @__PURE__ */Un(Gt,{mode:Ro,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Gr,nodeActions:bt?ke(xt,bt.type):nt})}),
|
|
56
|
+
/* @__PURE__ */Un(Xe,{side:"right",width:vr.right,min:qe,max:Ke,defaultWidth:S.right,label:Rt.resizeSettingsPanel,onResize:zr})]}):
|
|
57
|
+
/* @__PURE__ */Un(C,{side:"right",onShow:Gr})]}),$i.menu]})}))}export{tt as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{
|
|
1
|
+
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{styleMenuItems as t}from"./chunk-V7U33NF2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{createNodeClipboard as l,nodeMenuItems as r}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as i}from"./chunk-WK3AFPXY.js";import{ROOT_ZONE as c}from"./chunk-PLVEGYK6.js";import{EaselMenuItems as s,menuLabel as a}from"./chunk-EA2HTX37.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as P,LayersIcon as z,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===c)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=l(),X=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",l);let t=X.get(n);return t||(t=l(),X.set(n,t)),t}function M(){return j(e())}function S(e,n,t){if(n===c){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function V(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(e,n){const{zone:o,index:l}=n,i=e.nodeAt(o,l);if(!i)return[];const s=i.props.id,a=e.labelOf(i.type,o),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,o),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=T(e,i,o),k=D(e,n),b=d.held,v=b&&!p?E(e,b,n):null,g=!e.readOnly,w=e.style?t({held:g?e.style.held():null,canCopy:e.style.canCopy(i,o),onCopy:()=>e.style?.copy(i,o),onPaste:()=>e.style?.paste(o,l,i),words:e.words?.styleClipboard}):[];return r({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},l=n.zone===c?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,o)?()=>e.beginRename(o,l):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:w,extras:e.menuRows?.(i,o,l)??void 0,pinnedLine:p?R(e).pinned:void 0})}var R=e=>e.words?.screen??o.menu;function B(e){const n=R(e),t=!e.readOnly,l=[];t&&e.history.hasPast&&l.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),t&&e.history.hasFuture&&l.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const r=[],s=e.nodeOps.held,a=S(e,c,e.sectionBand().cap);if(t&&s&&(e.canPasteAt?e.canPasteAt(s,a):f(s.from)===c)){const n=a,t=e.words?.menu??i;r.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[l,r,[{label:e.pageSettingsLabel??o.pageSettings,icon:/* @__PURE__ */A(P,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=e.words?.menu??i,s=R(e),a=[];l&&(a.push({label:c.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:c.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),a.push({label:c.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:s.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=V(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(Y(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(F,{host:e,target:o,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?U(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":a(o),children:/* @__PURE__ */A(s,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,V as nodeShortcut,B as pageMenuItems,E as pastePlace,L as runNodeShortcut,U as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as t}from"./chunk-OGH6CC3E.js";import{DEFAULT_NODE_MENU_WORDS as m}from"./chunk-WK3AFPXY.js";import{DEFAULT_PICK_WORDS as n}from"./chunk-643PVCEG.js";import{DEFAULT_CANVAS_WORDS as c}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as s}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-33C6ALT5.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-AYWN5NRH.js";var a={notice:i,lock:u,save:p,chrome:e,rail:k,tree:s,panel:f,fields:h,pick:n,drag:l,menu:m,styleClipboard:r,copy:j,canvas:c,textStyles:t,screen:o},Y=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:Y(n)?t[m]=Y(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function D(o,r){return r?y(o,r):o}export{a as DEFAULT_EASEL_STRINGS,D as mergeEaselStrings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{shownFields as t}from"./chunk-BPXEFVSQ.js";function e(e,n){if(!n)return null;const l=e.components?.[n.type],r=l?.fields??null;return r?t(function(t,e,n){if("function"!=typeof t.resolveFields)return n;try{const l=t.resolveFields({type:e.type,props:e.props},{fields:n,lastFields:n,lastData:null,changed:{},parent:null,appState:{}});return l&&"function"!=typeof l.then?l:n}catch{return n}}(l,n,r),{values:n.props}):null}export{e as panelFieldsOf};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-CKKP537S.js";import{ScreenStoreProvider as e}from"./chunk-3BP4XJVF.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-FBS75I6E.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),C=r(n);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function P({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),P=t(()=>s(!g),[g]),F=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:F.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:P,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:F.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:F.waitingForAuthorization})}export{P as DocumentScreen,y as ScreenMount};
|
|
@@ -1,5 +1,5 @@
|
|
|
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-PVAIOBBE.js";import{Inspector as i}from"./chunk-
|
|
2
|
-
return s(t,{height:"fill"})}function
|
|
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-PVAIOBBE.js";import{Inspector as i}from"./chunk-SO5OLDH7.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},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function P(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
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 B=o({});function C({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(B.Provider,{value:n,children:e})}function D(){return u(B)}function G(){return(D().useOwnerName??v)()}function I(){return(D().useDocumentLabel??g)()}function N(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function x(n){return(D().useStandaloneBridges??h)(n)}function A(n,e){(D().useDocumentPass??y)(n,e)}function T(){return D().blockRules??b}function F(){return D().blockLook??O}function R(){return D().devices??
|
|
5
|
-
return s(M.Provider,{value:n,children:e})}function X(){return u(M)}function $(){return D().Inspector??
|
|
4
|
+
return s(B.Provider,{value:n,children:e})}function D(){return u(B)}function G(){return(D().useOwnerName??v)()}function I(){return(D().useDocumentLabel??g)()}function N(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function x(n){return(D().useStandaloneBridges??h)(n)}function A(n,e){(D().useDocumentPass??y)(n,e)}function T(){return D().blockRules??b}function F(){return D().blockLook??O}function R(){return D().devices??L}function V(){return D().leftView??j}function E(){return D().pinned??w}function H(){return D().saveSwitch??!0}function K(e){n(!0===D().pickFollowsSelection,e)}function W(){return D().storageNamespace||void 0}function Q(){return D().styleClipboard??null}function Y(){return D().nodeKeys??!0}function Z(){return D().notify??null}function q(){return D().Canvas??S}function z(){return D().CanvasHead??null}function J(){return D().canvasDrag??null}var M=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(M.Provider,{value:n,children:e})}function X(){return u(M)}function $(){return D().Inspector??P}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,T as useScreenBlockRules,N as useScreenBridges,J as useScreenCanvasDrag,q as useScreenCanvasFrame,z as useScreenCanvasHead,X as useScreenCanvasTarget,R as useScreenDevices,I as useScreenDocumentLabel,A as useScreenDocumentPass,$ as useScreenInspectorPanel,V as useScreenLeftView,Y as useScreenNodeKeys,Z as useScreenNotify,G as useScreenOwnerName,D as useScreenParts,K as useScreenPickFollowsSelection,E as useScreenPinned,H as useScreenSaveSwitch,W as useScreenStorageNamespace,Q as useScreenStyleClipboard,x as useStandaloneScreenBridges};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{EaselMenuItems as a}from"./chunk-EA2HTX37.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-2XMHLXMA.js";import{FieldSelect as c}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-WRFD4EXD.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-36LVP5WD.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as E,DuplicateIcon as M,TrashIcon as R}from"efficient-shell/icons/efficient";function T({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function W(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function A(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function H(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',X={parentId:"list",slot:"items"};function G({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:T,canRemove:G,lockedReason:K,fixed:V=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=h("fields",d).list,U=h("tree",l),_=r??Z.item,ee=!w&&!V&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!G&&!G(o[e],e),le=e=>!w&&!V&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>u?u(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(A(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(W(o,e,s())),T?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(H(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===X.parentId&&n.slot===X.slot,onDrop:(e,n)=>{const t=f({...X,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(E,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(M,{size:14}),onClick:()=>(e=>{ae(e)&&(i(W(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(R,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
+
return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...X,index:n}}),a=l.draggable&&se!==n,r=!T&&C===n,o=!w&&!V&&J&&te(n),i=["es-list-row",T?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...X,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */S(k,{className:i,flat:!!T,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||V||!J?void 0:o?b(K?K(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":K?K(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):b(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:T?/* @__PURE__ */S("div",{className:"es-list-row-main",children:T(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[m?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
+
/* @__PURE__ */S(t,{...ve.seam({place:{...X,index:o.length}})})]}):null,w||V?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
|
|
10
|
+
/* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */S(a,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var K=e=>e<6?e+1:6,V=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
+
return S(o,{id:`${l}-group`,title:V(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:K(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return S(G,{label:V(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return S(u,{label:V(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(T,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return S(u,{label:V(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return S(u,{label:V(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return S(u,{label:V(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{ariaLabel:V(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return S(J,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=h("panel",i),$=D(),P=p??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,E]=j(void 0),M=s??F,R=M&&L.buckets.includes(M)?M:L.buckets[0],[T,W]=j(null),A=T&&T.panel===P&&L.rows.some(e=>e.name===T.name)?T:null,H=d&&L.buckets.length>1,z=H&&R?w(P,R):`${P}-rows`,[B,X]=j(()=>/* @__PURE__ */new Set),G=y??B,V=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!G.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&X(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>H&&e!==R,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:A&&A.name===e?A.index:null,onOpenItem:n=>W(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?K(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return I("div",{className:"es-insp",children:[H?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":f??O.settings,idPrefix:P,value:R,onChange:e=>{const n=e;void 0===s&&E(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:H?"tabpanel":void 0,"aria-labelledby":H&&R?N(P,R):void 0,children:[b?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:V(v,b)}):b:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:V(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{T as FieldText,ee as Inspector,q as InspectorField,G as ListField,U as bucketsOf,z as copyItem,W as insertAt,V as labelOf,A as moveTo,Z as planFields,H as removeAt};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-O5HIBDDA.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-O5HIBDDA.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-PVAIOBBE.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-AYWN5NRH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var A=e=>`section:${e}`,B=e=>`block:${e}`,O=e=>`template:${e}`;function E({at:E,placeBlocks:I,canTake:R,onPick:$,itemFor:w,session:H,siteWide:N,onClose:P,onHide:x,readOnly:D}){const F=d(e=>e.config),T=c(),{labelAtLevel:W,categoryLabel:C,firstSection:L,Icon:M,Thumbnail:Y}=T,{blockIsOffered:Q,canAddTo:S}=a(),z=f("screen",m).add,J=f("drag",h).add,Z=p(),[G,K]=u([]);k(()=>{let e=!1;const t=e=>Q(e,Z);return n(Z).list().then(o=>{if(e)return;const n=F.components;K(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[F,Z]);const q=b(()=>e(F,T),[F]),U=e=>({type:A(e.type),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=G.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(M,{type:e,size:26})}),ee=b(()=>{const e=t(q,L),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Q(e.type,Z)&&n.set(e.type,e)};for(const t of e?[e]:q){const e=S(t.type)?.choices??[];e.forEach(s),e.forEach(e=>S(e.type,1)?.choices?.forEach(s))}I?.forEach(s);const i=new Set(q.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:B(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];G.length>0&&p.push({key:"templates",title:z.templates,tiles:G.map(e=>{return{type:O(e.id),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.node.type}),keywords:[(t=e.node.type,W(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(F.categories??{})){const n=q.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(F,t,C),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!R)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?R(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[G,q,F,z,R,I,Z]);/* @__PURE__ */
|
|
2
2
|
return v(V,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:P}),onHide:x}),
|
|
4
4
|
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:
|
|
5
|
+
/* @__PURE__ */j(y,{groups:ee,session:H,itemFor:e=>w(X(e)??{kind:"section",type:e}),onInsert:$?e=>{const t=X(e);t&&$(t)}:void 0,at:E,hint:z.hint,searchLabel:z.search,readOnly:D,words:J}),N??null]})]})}export{E as AddSidePanel,B as blockKey,A as sectionKey,O as templateKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-O5HIBDDA.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PVAIOBBE.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withoutDeviceGate as t,deviceMetaOf as o}from"./chunk-NBDMTIU2.js";import{DESIGN_GROUP_KEY as n,BUCKET_KEY as e}from"./chunk-MQNBD6AB.js";import{panelFieldsOf as r}from"./chunk-
|
|
1
|
+
import{withoutDeviceGate as t,deviceMetaOf as o}from"./chunk-NBDMTIU2.js";import{DESIGN_GROUP_KEY as n,BUCKET_KEY as e}from"./chunk-MQNBD6AB.js";import{panelFieldsOf as r}from"./chunk-LER7RKTO.js";import{STYLE_KIND as s,fieldKind as c,copyStyle as i,heldStyle as p,planPaste as u,pasteMessage as a}from"./chunk-V7U33NF2.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as l,MEDIA_FIELD_MARKER as m,TEXT_FIELD_MARKER as h,LINK_FIELD_MARKER as y}from"./chunk-DUVRZ456.js";var j=/* @__PURE__ */new Set([n.Size,n.Design,n.Layout,n.Position]),w=new Set(Object.values(n)),b=new Set(Object.values(e)),S=new Set(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function D(o){if(!o||"object"!=typeof o)return null;const n=o,e=t(o)??o,r=n[s]??e[s];if("string"==typeof r)return r;const i=n.options??e.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return c(e)}function O(o){const n=o,e=t(o);return k.some(t=>t in n||e&&t in e)}function d(t,n){const s=r(t,n)??{},c=[];let i=!0,p=!1;for(const[t,n]of Object.entries(s))b.has(t)?(i=t===e.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&n&&"object"==typeof n&&!t.startsWith("_")&&(l(n)||S.has(t)||g.has(t)||O(n)||"slot"!==n.type&&c.push({path:[t],kind:D(n),counted:"mobile"!==o(n)?.tier}));return c}function A(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function B(t,o,n,e,r,s){const c=p(n);if(!c)return null;const i=u(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:a(i,c.sourceLabel,r,s)}}function L(t,o,n,e){A(d,t,o,n,e)}function N(t,o,n,e,r){return B(d,t,o,n,e,r)}var R={scope:t=>v(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>L(e,t,o,n),plan:(t,o,n,e)=>N(e,t,o,n)};function U(t,o){if(!t&&!o)return R;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??R.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>A(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>B(e,s,t,n,r,o))}}export{L as copyNodeStyle,d as nodeStyleRows,N as planNodePaste,D as shopFieldKind,v as siteStyleScope,U as styleClipboardOf};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-O5HIBDDA.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
|
package/dist/copy/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { c as CopyBoxProps, d as CopyCell, T as TextBoxHandle } from '../canvas-
|
|
|
4
4
|
export { e as COPY_CELLS, b as CanvasTypingEnd, f as CanvasTypingOptions, g as CanvasTypingSession, h as ColorWindow, i as CopyBoxAlign, j as CopyBoxFooter, C as CopyBoxLastTool, k as CopyCase, l as CopyCellPreset, m as CopyCells, a as CopyThemeColor, M as MarkWriter, S as SelectionSource, n as TextAreaHandle, o as TextMap, p as ToolbarMark, q as colorRunOf, r as insertSelection, s as markSelection, t as startCanvasTyping, u as textMap } from '../canvas-typing-CC0wA-ys.js';
|
|
5
5
|
import { MarkStyle, MarkupTool, InlineRule, MarkedLine, WrapResult } from 'efficient-shell/markup';
|
|
6
6
|
export { TextToolbar, TextToolbarProps } from 'efficient-shell/ui';
|
|
7
|
-
import { F as FieldOption } from '../types-
|
|
7
|
+
import { F as FieldOption } from '../types-URH28nku.js';
|
|
8
8
|
import { a as CopyAlign } from '../words-CiuKuiy0.js';
|
|
9
9
|
export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, C as CopyWords, f as copyAlignOptions } from '../words-CiuKuiy0.js';
|
|
10
10
|
import { TextStyleCase } from '../text-styles/model.js';
|
package/dist/easel/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { TextToolbarProps } from 'efficient-shell/ui';
|
|
|
11
11
|
import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing-CC0wA-ys.js';
|
|
12
12
|
import { InlineRule } from 'efficient-shell/markup';
|
|
13
13
|
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BHRkUFfG.js';
|
|
14
|
-
import { I as InspectorFields } from '../types-
|
|
14
|
+
import { I as InspectorFields } from '../types-URH28nku.js';
|
|
15
15
|
import '../words-CiuKuiy0.js';
|
|
16
16
|
import '../buckets-Tj-nkBpg.js';
|
|
17
17
|
|
package/dist/fields/index.d.ts
CHANGED
|
@@ -2,13 +2,56 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { S as SettingsBucket } from '../buckets-Tj-nkBpg.js';
|
|
4
4
|
export { D as DesignGroup } from '../buckets-Tj-nkBpg.js';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
5
|
+
import { ShowWhenContext } from 'efficient-shell/format';
|
|
6
|
+
export { ShowWhenContext, ShowWhenRule, showWhenOf, withShowWhen } from 'efficient-shell/format';
|
|
7
|
+
import { a as InspectorFieldDef, b as FieldRenderer, I as InspectorFields, c as FieldTextProps, d as FieldNumberProps, e as FieldSliderProps, f as FieldSelectManyProps, g as FieldSelectOneProps, F as FieldOption } from '../types-URH28nku.js';
|
|
8
|
+
export { A as ArrayFieldDef, C as CustomFieldDef, h as CustomFieldRenderProps, i as FieldSelectProps, N as NumberFieldDef, O as ObjectFieldDef, R as RadioFieldDef, S as SelectFieldDef, j as SlotFieldDef, T as TextFieldDef, k as TextareaFieldDef } from '../types-URH28nku.js';
|
|
7
9
|
import { R as ResolvableItem } from '../resolve-D68pb3Bx.js';
|
|
8
10
|
export { F as FieldsWords } from '../words-vhnV8sM7.js';
|
|
9
11
|
export { LinkFilter, LinkFilterField, LinkKindChoice, LinkOption, LinkOptionGroup, LinkPicker, LinkPickerProps, LinkRules, LinkTarget } from 'efficient-shell/ui';
|
|
10
12
|
import '../types-41704JE4.js';
|
|
11
13
|
|
|
14
|
+
/**
|
|
15
|
+
* A SETTINGS ROW'S SHOW-WHEN, read by the panel (SSOT batch 1, Lewis
|
|
16
|
+
* 2026-10-17: "show setting B only when A is on" is ONE rule, kept in
|
|
17
|
+
* efficient-shell — `isShown`, `ShowWhenRule`, shell #516 — never a copy per
|
|
18
|
+
* editor).
|
|
19
|
+
*
|
|
20
|
+
* A field carries the shell's rule as data, next to its label:
|
|
21
|
+
*
|
|
22
|
+
* withShowWhen({ type: 'number', label: 'Max width' }, { not: { field: 'layout', is: 'full' } })
|
|
23
|
+
*
|
|
24
|
+
* and every panel that draws fields reads it here: the `Inspector` (through
|
|
25
|
+
* `planFields`), an object's members, an array item's rows, and any list built
|
|
26
|
+
* beside the panel (`shownFields`). No host deletes a key in `resolveFields`
|
|
27
|
+
* to hide a row any more, and no editor decides on its own what "on" means.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ HIDDEN IS NOT DRAWN, NEVER WRITTEN. Nothing here touches the values: a
|
|
30
|
+
* merchant who switches the parent setting off and on again finds what they
|
|
31
|
+
* had (the shell's own rule).
|
|
32
|
+
*
|
|
33
|
+
* What a rule reads: `field` checks read the node's values (an object's or an
|
|
34
|
+
* array item's own values for their members); `context` checks read what the
|
|
35
|
+
* host passes as the Inspector's `showWhenContext` — the website editor's
|
|
36
|
+
* `device`, `parentType` and `parent`, for example.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/** The facts a panel reads its fields' rules against. */
|
|
40
|
+
interface ShowWhenInput {
|
|
41
|
+
/** The values `field` checks read — the node's props, or an item's. */
|
|
42
|
+
values: Readonly<Record<string, unknown>> | null | undefined;
|
|
43
|
+
/** What `context` checks read: where the row is drawn. */
|
|
44
|
+
context?: ShowWhenContext | null;
|
|
45
|
+
}
|
|
46
|
+
/** Whether one field is drawn, by its rule. No rule: drawn. */
|
|
47
|
+
declare function fieldIsShown(field: unknown, input: ShowWhenInput): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The fields to draw, in order: every field whose rule is true or that has
|
|
50
|
+
* none, each the SAME object. Nothing dropped: the same map back, so a host
|
|
51
|
+
* that keys a cache on it sees no change.
|
|
52
|
+
*/
|
|
53
|
+
declare function shownFields<T extends Record<string, unknown>>(fields: T, input: ShowWhenInput): T;
|
|
54
|
+
|
|
12
55
|
interface InspectorFieldProps {
|
|
13
56
|
field: InspectorFieldDef;
|
|
14
57
|
name: string;
|
|
@@ -19,6 +62,8 @@ interface InspectorFieldProps {
|
|
|
19
62
|
readOnly?: boolean;
|
|
20
63
|
/** Extra props for a custom render (the node, the root, the device…). */
|
|
21
64
|
context?: Record<string, unknown>;
|
|
65
|
+
/** What a member's `showWhen` may read beside its values (`Inspector`). */
|
|
66
|
+
showWhenContext?: ShowWhenContext;
|
|
22
67
|
/** A field type's drawing, swapped in by the host. */
|
|
23
68
|
renderers?: Partial<Record<InspectorFieldDef['type'], FieldRenderer>>;
|
|
24
69
|
/**
|
|
@@ -103,6 +148,12 @@ interface FieldPlan {
|
|
|
103
148
|
* `visible: false` neither draws nor counts, so a tab whose fields are all
|
|
104
149
|
* hidden is not offered (the owner's rule: an empty tab is hidden, never drawn).
|
|
105
150
|
*
|
|
151
|
+
* SHOW-WHEN (SSOT batch 1). Given `show` — the node's values and the host's
|
|
152
|
+
* context — a field whose `showWhen` rule is false is planned as `visible:
|
|
153
|
+
* false` is: no row, not counted. Its `bucket` and `fold` still count, so
|
|
154
|
+
* hiding a row never moves the rows after it to another tab or band. Without
|
|
155
|
+
* `show` the rules are not read: `bucketsOf` asks for every field's tab.
|
|
156
|
+
*
|
|
106
157
|
* BANDS (Lewis, 2026-10-13: one kind of group heading per panel, and it folds).
|
|
107
158
|
* A marker with `fold` starts a band titled with it; the rows after it are in
|
|
108
159
|
* that band until the next fold marker or the next tab marker (a band never
|
|
@@ -112,7 +163,7 @@ interface FieldPlan {
|
|
|
112
163
|
* cannot be said. A band whose rows are all hidden draws nothing
|
|
113
164
|
* (`Inspector`).
|
|
114
165
|
*/
|
|
115
|
-
declare function planFields(fields: InspectorFields): FieldPlan;
|
|
166
|
+
declare function planFields(fields: InspectorFields, show?: ShowWhenInput): FieldPlan;
|
|
116
167
|
/**
|
|
117
168
|
* Every field's bucket, by name — what "copy style" asks (a look is never
|
|
118
169
|
* Animation). The walk both editors did on their own (the website's
|
|
@@ -130,6 +181,12 @@ interface InspectorProps {
|
|
|
130
181
|
readOnly?: boolean;
|
|
131
182
|
/** Extra props for every custom render (the node, the root, the device…). */
|
|
132
183
|
context?: Record<string, unknown>;
|
|
184
|
+
/**
|
|
185
|
+
* What a field's `showWhen` rule may read beside the values: where the row
|
|
186
|
+
* is drawn (the website editor's `device`, `parentType`, `parent`). A row
|
|
187
|
+
* whose rule is false is not drawn and keeps its value (./showWhen).
|
|
188
|
+
*/
|
|
189
|
+
showWhenContext?: ShowWhenContext;
|
|
133
190
|
/** The open tab. Absent: the Inspector keeps its own. */
|
|
134
191
|
tab?: SettingsBucket;
|
|
135
192
|
onTab?: (tab: SettingsBucket) => void;
|
|
@@ -189,6 +246,10 @@ interface InspectorProps {
|
|
|
189
246
|
* says is `EaselStrings.panel.buckets.Design`, from the strings provider.
|
|
190
247
|
* - `lead` OPENS THE ROWS, `children` CLOSE THEM. Both sit inside the rows
|
|
191
248
|
* panel and show on every tab.
|
|
249
|
+
* - A ROW SHOWS BY ITS RULE (SSOT batch 1). A field's `showWhen` — the shell's
|
|
250
|
+
* rule — is read against the node's values and `showWhenContext`; a false
|
|
251
|
+
* rule draws no row and counts for no tab or band, and the value is kept.
|
|
252
|
+
* An object's members and an array item's rows read their own values.
|
|
192
253
|
* - ONE KIND OF GROUP, AND IT FOLDS (Lewis, 2026-10-13). A run of rows under a
|
|
193
254
|
* `fold` marker (./plan) is drawn inside ONE easel `SettingsGroup`, the grey
|
|
194
255
|
* band with − / + on its right, open until it is closed. `leadFold` puts
|
|
@@ -196,7 +257,7 @@ interface InspectorProps {
|
|
|
196
257
|
* is `hidden`), as a row on another tab does. Which bands are closed is the
|
|
197
258
|
* host's when it passes `closedFolds` + `onFold`, else the Inspector's own.
|
|
198
259
|
*/
|
|
199
|
-
declare function Inspector({ fields, values, onChange, readOnly, context, tab, onTab, tabs, tabIcons, renderers, idPrefix, ariaLabel, lead, children, leadFold, closedFolds, onFold, headingLevel, }: InspectorProps): react.JSX.Element;
|
|
260
|
+
declare function Inspector({ fields, values, onChange, readOnly, context, showWhenContext, tab, onTab, tabs, tabIcons, renderers, idPrefix, ariaLabel, lead, children, leadFold, closedFolds, onFold, headingLevel, }: InspectorProps): react.JSX.Element;
|
|
200
261
|
|
|
201
262
|
/** What a block may declare about its fields. */
|
|
202
263
|
interface FieldsBlock {
|
|
@@ -457,4 +518,4 @@ declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | und
|
|
|
457
518
|
declare function FieldSelect<V>(props: FieldSelectManyProps<V>): ReactNode;
|
|
458
519
|
declare function FieldSelect<V>(props: FieldSelectOneProps<V>): ReactNode;
|
|
459
520
|
|
|
460
|
-
export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type PlannedFold, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, bucketsOf, copyItem, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, useResolvedFields };
|
|
521
|
+
export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type PlannedFold, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, type ShowWhenInput, bucketsOf, copyItem, fieldIsShown, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, shownFields, useResolvedFields };
|
package/dist/fields/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-
|
|
1
|
+
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-SO5OLDH7.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-EA2HTX37.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";export{FieldNumber}from"../chunk-2XMHLXMA.js";export{FieldSelect,optionFor}from"../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-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|