efficient-easel 19.2.0 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3Z2MVLCD.js → chunk-4ES5JGGX.js} +1 -1
- package/dist/chunk-7OKL7HDV.js +1 -0
- package/dist/{chunk-BQMZ2YAF.js → chunk-A6CY3TQ5.js} +1 -1
- package/dist/chunk-CNKVVHDA.js +63 -0
- package/dist/chunk-FIVU2COQ.js +2 -0
- package/dist/{chunk-RTCNJRF6.js → chunk-FMZGR7EG.js} +1 -1
- package/dist/chunk-H5YLVKGA.js +1 -0
- package/dist/{chunk-UZXGXMNO.js → chunk-KOVJODTY.js} +11 -11
- package/dist/{chunk-45NZSAND.js → chunk-KWE5U6CE.js} +1 -1
- package/dist/{chunk-6U6AISPX.js → chunk-ME4V6PML.js} +4 -4
- package/dist/chunk-OGBYHQE6.js +5 -0
- package/dist/chunk-P5VYGWYO.js +1 -0
- package/dist/{chunk-G3GWAP5R.js → chunk-QAJAEWCZ.js} +1 -1
- package/dist/chunk-U6LF5YVK.js +8 -0
- package/dist/chunk-VULUDKA3.js +21 -0
- package/dist/chunk-YOXKBOZX.js +1 -0
- package/dist/{chunk-WXFZD7WC.js → chunk-ZKY45F5G.js} +1 -1
- package/dist/chunk-ZO3UUK45.js +18 -0
- package/dist/{chunk-2XMHLXMA.js → chunk-ZOBSIXRD.js} +1 -1
- package/dist/copy/index.js +14 -14
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/menu/index.d.ts +3 -3
- package/dist/menu/index.js +1 -1
- package/dist/node-ops/index.d.ts +11 -7
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.js +6 -6
- package/dist/panel/panel.css +21 -12
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +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.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +1 -1
- package/dist/text-styles/index.js +22 -22
- package/dist/{types-BsyPh6EW.d.ts → types-BbOBWXMP.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/chunk-BALFHI3G.js +0 -2
- package/dist/chunk-EFQCH7CO.js +0 -1
- package/dist/chunk-I2BCNLLV.js +0 -5
- package/dist/chunk-LFHMDGLE.js +0 -8
- package/dist/chunk-LOXB5OVK.js +0 -63
- package/dist/chunk-OD4WIIER.js +0 -1
- package/dist/chunk-OSPUG6S6.js +0 -1
- package/dist/chunk-UAS2LEW2.js +0 -1
- package/dist/chunk-Z2V3TTAR.js +0 -18
- package/dist/chunk-ZFFWO2AF.js +0 -21
package/dist/chunk-LOXB5OVK.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-BQMZ2YAF.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-OD4WIIER.js";import{useSectionOps as v}from"./chunk-UAS2LEW2.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-LFHMDGLE.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as O}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as M,useScreenPinned as P,useScreenDocumentLabel as $,useScreenCanvasFrame as L,useScreenInspectorPanel as T,useScreenDevices as j,useScreenPickFollowsSelection as A,useScreenLeftView as E,SELECTION_MODE as R,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as W,useScreenNotify as U,useScreenCanvasHead as G,isSlotMode as J,useScreenStyleClipboard as Y,useScreenDocumentPass as X,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as K,isPinnedFirst as q,isPinnedLast as Q,screenSlotsOf as _}from"./chunk-I2BCNLLV.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-EFQCH7CO.js";import{PageEditGuardNotices as oe}from"./chunk-5DPIGWUL.js";import{useScreenDocument as re}from"./chunk-M62P4IQK.js";import{requestMediaPick as ie}from"./chunk-RYNBSKE7.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-LNHT2KPX.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as fe}from"./chunk-U3JP4VGF.js";import{LayersIcon as he,MediaIcon as me}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ve}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{insertSeams as be,CanvasDragLayer as Se,CanvasInsert as we}from"./chunk-Z2V3TTAR.js";import{DEFAULT_DRAG_WORDS as xe}from"./chunk-KAML3KQH.js";import{useEasel as ze,useEaselApi as Ce,CanvasPassThroughContext as Ne,CanvasSharedContext as Ie}from"./chunk-UZXGXMNO.js";import{TreeRow as Oe,Subtree as Be,LayersTree as Me,TreeGroupLabel as Pe,TreeRowAction as $e,TreeSeam as Le}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Te}from"./chunk-K56YDHYQ.js";import{createDragSession as je,useTreeDrag as Ae,gapToMoveIndex as Ee}from"./chunk-67GNT6PF.js";import{DEFAULT_NODE_MENU_WORDS as Re}from"./chunk-WK3AFPXY.js";import{toItemSelector as Fe,useNodeOps as De,clickPick as Ve}from"./chunk-X3TYRF5V.js";import{useCanvasFrame as He,LIST_SELECTOR as We,BLOCK_SELECTOR as Ue,useCanvasTyping as Ge,useCanvasEvent as Je,nodeIdAt as Ye,frameRectToHost as Xe,BLOCK_ATTRIBUTE as Ze,drawnBox as Ke}from"./chunk-X4T6JT3M.js";import{ROOT_ID as qe,ROOT_SLOT as Qe,zoneKey as _e,parseZoneKey as en,find as nn,DataError as tn}from"./chunk-KRXQM65X.js";import{EaselTopBar as on,TopBarCluster as rn,EaselIconButton as ln,TopBarDivider as sn,DeviceSwitch as dn,InspectorIconButton as an,PanelResizeHandle as cn,MAX_PANEL_W as pn,MIN_PANEL_W_BY_SIDE as un,panelWidthVars as fn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as hn,DEFAULT_CHROME_WORDS as mn}from"./chunk-AJSDWWJW.js";import{holderOf as gn,nameOrSomeone as yn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as vn}from"./chunk-RE4LP46F.js";import{useWords as kn}from"./chunk-MFIRYGHW.js";import{rootRowName as bn,slotChildRowName as Sn,slotChildRenameProp as wn,sectionRenameProp as xn}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as zn,blockNodeActions as Cn,TREE_MAX_DEPTH as Nn,childSlotsOf as In,slotFieldsOf as On,newNodeId as Bn,slotChildrenIn as Mn,nestsInTree as Pn}from"./chunk-PLVEGYK6.js";import{useRef as $n,useMemo as Ln,useState as Tn,useEffect as jn,useCallback as An,useLayoutEffect as En,Fragment as Rn,useId as Fn}from"react";import{ColoredBadge as Dn,Tabs as Vn,toast as Hn,readMediaFileDrag as Wn,Tooltip as Un,groupColors as Gn,Dialog as Jn,FormField as Yn,Input as Xn,Button as Zn,MEDIA_FILE_DRAG_TYPE as Kn}from"efficient-shell/ui";import{UndoIcon as qn,RedoIcon as Qn,RefreshIcon as _n,AddIcon as et,TrashIcon as nt,EyeOffIcon as tt,EyeIcon as ot,SharedIcon as rt,DuplicateIcon as it}from"efficient-shell/icons/efficient";import{jsx as lt,jsxs as st,Fragment as dt}from"react/jsx-runtime";var at="media-file";function ct({name:e,onMake:n,onCancel:t}){const o=kn("screen",ge).shared,[r,i]=Tn(e),[l,s]=Tn(!1),d=Fn(),a=$n(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return lt(Jn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */st(dt,{children:[
|
|
3
|
-
/* @__PURE__ */lt(Zn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */lt(Zn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */lt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */lt(Yn,{label:o.name,htmlFor:d,children:/* @__PURE__ */lt(Xn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var pt=/* @__PURE__ */new WeakSet;function ut(e,n,t){const o=nn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=$n(null),[r,i]=Tn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return En(()=>{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=Xe(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${Ze}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Ke(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Xe(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */lt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */lt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */lt(Un,{content:e.reach,children:/* @__PURE__ */st(Dn,{colorClass:Gn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */lt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */lt(rt,{size:12})}),e.label]})}):/* @__PURE__ */lt(Dn,{colorClass:Gn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function ht({expand:e}){/* @__PURE__ */
|
|
7
|
-
return lt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */st(dt,e?{children:[
|
|
8
|
-
/* @__PURE__ */lt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */lt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */lt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */lt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */lt("path",{d:"M5 12h14"})]})})}var mt=`${We}, ${Ue}`;function gt(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 yt="__rungs";var vt="screen:band",kt={duplicate:!0,delete:!0};function bt(){const We=ue(),{target:Xe,docId:Ze,capabilities:Ke,currentSlug:Fn,siteId:Un,onPublish:Gn,saveState:Jn,saveConflict:Yn,retrySave:Xn,toggleAutoSave:Zn,flushSave:rt,access:bt,saveUnreachable:St=!1,readOnly:wt,readOnlyReason:xt=null}=re(),zt=B(),Ct=M(),{mediaEditing:Nt,hasEditGuard:It,hasPinnedChrome:Ot}=Ke,{appState:Bt,dispatch:Mt,history:Pt,selectedItem:$t,getSelectorForId:Lt,config:Tt}=ze(e=>e),jt=P(),{first:At,firstGroup:Et,lastGroup:Rt,isSectionGroup:Ft,sectionGroupZone:Dt,panelOf:Vt}=jt,Ht=Vt(At),Wt=e=>q(jt,e),Ut=e=>Q(jt,e),Gt="node"===jt.firstRow,Jt=jt.band??null,Yt=kn("screen",ge),Xt=kn("tree",Te),Zt=kn("drag",xe),Kt=kn("notice",hn),qt=kn("lock",vn),Qt=kn("menu",Re),_t=kn("styleClipboard",ke),eo=kn("chrome",mn),no=$()??`/${Fn}`,to=L(),oo=T(),ro=v({readOnly:wt}),io=v({readOnly:wt,foldIntoHistory:!0}),lo=$n(null),so=Ce(),ao=Ln(()=>({...ro,select:e=>{lo.current=e,ro.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=so.config;lo.current=Fe(e,t,n)}ro.commitDocument(e,n)}}),[ro,so]),co=Bt.ui,po=co.leftSideBarVisible,uo=co.rightSideBarVisible,{options:fo,widths:ho,initial:mo,fluid:go,fit:yo}=j(),[vo,ko]=Tn(mo),bo=le(),So=Nt&&null!==bo,wo=se(),xo=de(),zo=null!==wo||xo,Co=ae();A($t?.props.id);const{read:No,write:Io,forSelection:Oo}=E(),[Bo,Mo]=Tn(No);jn(()=>{Io(Bo)},[Bo]);const[Po,$o]=Tn(0),Lo=$n(null),To=$n(null),jo=He(To,{readySelector:mt}),Ao=Ge(jo),Eo=a(To);c(To,jo);const Ro=S(),Fo=gn(bt),Do={state:Jn,offline:Ro||Jn.failed&&St,readOnlyReason:xt,editing:Fo?Kt.editing({name:yn(Fo.name,qt),noun:Yt.noun}):null,conflict:null!=Yn,notSaving:Yt.bar.notSaving},Vo=()=>{wt||(Jn.failed?Xn():rt())};p(To,jo,Vo);const[Ho,Wo]=Tn(!1),Uo=$n(!1),[Go,Jo]=Tn(null),[Yo,Xo]=Tn([]),[Zo,Ko]=Tn(R),qo="puck"===Zo.kind,Qo=o(Zo,$t?.props.id),[_o,er]=Tn(null);jn(()=>{_o&&(r(),er(null))},[_o]);const nr=$n(Lt);nr.current=Lt;const tr=An((e,{scroll:n})=>{Mo(n=>Oo(e,n)),n&&er(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=nr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Pr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),or=$n(null);jn(()=>{const e=or.current;or.current=null;const n=null==$t?.props.id?null:String($t.props.id);Ko(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Vt($t?.type)??R);const t=$t?.props.id,o=lo.current;if(lo.current=null,!t)return;const r=Lt(t);tr(String(t),{scroll:!i(o,r??null,zn)})},[$t?.props.id,tr]);const rr=An(e=>{Ko(n=>F(n,e)?n:e),Mt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Mt]),ir=$n(()=>{});ir.current=(e,n)=>{const t=e?Oi(e.zone??zn)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==$t?.props.id?null:String($t.props.id);Ko(e=>F(e,n)?e:n),o!==r&&(or.current={id:o,mode:n},ao.select(e))};const lr=An((e,n)=>ir.current(e,n),[]),sr={kind:Zo.kind,mode:Zo,open:rr,show:e=>Ko(e),reveal:()=>{uo||Mt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:lr},dr=D(sr,{data:Bt.data,selected:$t??null,zoneOf:e=>Lt(e)?.zone,readOnly:Boolean(wt),select:e=>{Ko(R),ao.select({index:e})},replace:(e,n)=>ao.replaceComponent(zn,e,n),scrollTo:e=>l(e)},{device:vo,refreshes:Po},{setView:Mo,reveal:()=>{po||Mt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ar=dr.resolveLeftView?dr.resolveLeftView(Bo):"sections",cr=V(),{isLockedBlock:pr,duplicateBlocked:ur,nestDepth:fr,newSectionNode:hr,canAddTo:mr,blockIsOffered:gr}=cr,yr=H(),{labelAtLevel:vr,Icon:kr,useProducts:br}=yr,Sr=yr.rowName?(e,n,t)=>yr.rowName(e,n,t):void 0,wr=An(e=>{Mt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),tr(e,{scroll:!0})},[Mt,tr]),{selectNode:xr,openPartId:zr}=y({mode:Zo,setMode:Ko,onOpenPart:wr}),[Cr,Nr]=Tn(null);fe(null!==Cr,()=>Nr(null));const Ir=h(W()),Or=Ir.collapsed,Br=Ir.panelWidths,[Mr,Pr]=Tn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Or);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});jn(()=>{try{window.localStorage.setItem(Or,JSON.stringify([...Mr]))}catch{}},[Mr]);const[$r,Lr]=Tn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Br);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});jn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Br,JSON.stringify($r))}catch{}},300);return()=>clearTimeout(e)},[$r]);const Tr=An((e,n)=>Lr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),jr=An(e=>Tr("left",e),[Tr]),Ar=An(e=>Tr("right",e),[Tr]),Er=e=>Mr.has(e),Rr=e=>Pr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=$n(!1),Dr=$n(null);jn(()=>{if(Fr.current&&!Ho){const e=Dr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??To.current?.querySelector(`button[aria-label="${CSS.escape(Yt.add.title)}"]`))?.focus(),Dr.current=null}Fr.current=Ho},[Ho]),jn(()=>{if(!Ho||!Eo)return;const e=e=>{"Escape"===e.key&&ll()};return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Ho,Eo]),fe(Ho,()=>ll()),jn(()=>{!po&&Ho&&(Wo(!1),Jo(null),Uo.current=!1)},[po]);const Vr=U(),Hr=(e,n="success",t)=>{if(Vr)return void(t?Vr(e,"error"===n?"error":"info",t):Vr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Hn.error(e,{...o,duration:t?.duration??3200}):Hn.success(e,{...o,duration:t?.duration??1900})},Wr=$n(null),[Ur,Gr]=Tn(0),[Jr,Yr]=Tn(0),Xr=G(),Zr=$n(null),Kr=e=>Math.max(0,e.clientHeight-(Zr.current?.offsetHeight??0));jn(()=>{const e=Wr.current;if(!e)return;const n=()=>{Gr(e.clientWidth),Yr(Kr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Zr.current&&t.observe(Zr.current),()=>t.disconnect()},[]),En(()=>{Wr.current&&(Gr(Wr.current.clientWidth),Yr(Kr(Wr.current)))},[$r,po,uo]);const qr=vo===go?Ur>0?Ur:ho[go]:ho[vo],Qr=Ur>0?Math.min(Ur/qr,"shrink"===yo?1:2):1,_r=qr*Qr,ei=Ur>0&&_r>Ur+1,ni={width:_r,height:Jr||"100%",flex:"none",position:"relative"},ti={width:qr,height:Jr?Jr/Qr:"100%",maxHeight:"none",transform:1!==Qr?`scale(${Qr})`:void 0,transformOrigin:"top left"},oi=()=>Mt({type:"setUi",ui:{leftSideBarVisible:!po}}),ri=()=>Mt({type:"setUi",ui:{rightSideBarVisible:!uo}}),ii=e=>{Ho&&(Wo(!1),Jo(null),Uo.current=!1,po&&Bo===e)||(Mo(e),po||Mt({type:"setUi",ui:{leftSideBarVisible:!0}}))},li=()=>{ie(We,{accept:"image/*",title:eo.mediaLibrary})},si=()=>{Ko(R),ao.select(null),d()},di=()=>{Ko(Ht??R),uo||Mt({type:"setUi",ui:{rightSideBarVisible:!0}})},ai=Bt.data.content??[],ci=()=>{const e=ai.findIndex(Wt),n=ai.findIndex(Ut);return{floor:e>=0?e+1:0,cap:n>=0?n:ai.length}},pi=Tt,ui=cr.stripCopy,fi=n=>e(n,ui),hi=ne(),mi=De({data:Bt.data,config:pi,readOnly:Boolean(wt),clipboard:hi,strip:ui?e=>ui(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==qe||e.slot!==Qe)return{min:0,max:n-1};const{floor:t,cap:o}=ci();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Ko(R);const t=void 0===n||"node"===n?.kind?n:null;ao.commitDocument(e,t)}}),gi=pe(),[yi,vi]=Tn(null),ki=e=>{const n=ai.find(n=>String(n.props.id)===e),t=jt.shared;n&&t&&mi.swap(e,t.detach(n))},bi=e=>{const n=nn(Bt.data,Tt,e);if(!n)return!1;const t=_e(n.place),o=n.node,r=t===zn?Ci(o):Fi(o),i=t===zn?jt.shared?.usedOn(o):null;return!!mi.remove(e)&&(Hr(i?Yt.shared.removed({count:Math.max(0,i.length-1)}):Yt.deleted({name:r}),"success",{duration:8e3,action:{label:Yt.bar.undo,onClick:()=>{mi.restore(n.node,n.place)}}}),!0)},Si={...mi,remove:bi},wi=e=>vr(e,"block",Tt.components[e]?.label??e),xi=An(e=>Tt.components[e]?.defaultProps??{},[Tt]),zi=e=>vr(e,"section",wi(e)),Ci=e=>bn({type:e.type,props:e.props??{}},zi(e.type),Sr),{nodeAddresses:Ni,zoneItems:Ii}=Ln(()=>{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>=Nn)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of In(Tt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ai,zn,0),{nodeAddresses:e,zoneItems:n}},[ai,Tt]),Oi=An(e=>Ii.get(e)??[],[Ii]),Bi=e=>{const n=Ni.get(e);return n?Oi(n.zone)[n.index]:void 0},Mi=e=>_(cr,Tt,e),Pi=e=>{if(!cr.slotsOf||e===zn)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Bi(e.slice(0,n));if(!t)return null;const o=Mi(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}},$i=(()=>{if(!J(Zo))return null;const e=`${Zo.nodeId}:${Zo.slot}`;return Pi(e)?.slot.panel===Zo.kind?e:null})(),Li=$n(null);jn(()=>{const e=Li.current;if(Li.current=null,!$i||!J(Zo))return;const n=Zo.nodeId;tr(n,{scroll:e!==$i}),Pr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Zo]);const Ti=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ni.get(e);n&&(n.zone===zn?_i(n.index):Nl(n.zone,n.index,e,Bi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$i!==i&&(Li.current=i),lr(null,r),uo||Mt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},ji=(e,n,t)=>{const o=`${e}:${n}`;if(Pr(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;$i!==o&&(Li.current=o);lr(null,{kind:t,nodeId:e,slot:n})},Ai=(e,n,t)=>{if(wt||!cr.moveSlot)return;const o=Bi(e),r=o?Mi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:yt,index:n},s=Ee(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=cr.moveSlot(e,n,s);"string"==typeof d&&ji(e,d,i.panel)},Ei=br(),Ri=Ln(()=>{const e=/* @__PURE__ */new Map;for(const n of Ei??[])e.set(n.slug,n.name);return e},[Ei]),Fi=e=>Sn(e,wi,yr.plainText,e=>Ri.get(e),yr.rowName),Di=(e,n)=>{const t=Tt.components[e.type]?.fields,o=n===zn||Ql(n)?"section":"block",r=n===zn&&(Wt(e)||Ut(e)||Ft(e.type)),i="block"===o?wn(t):r?null:xn(t);return yr.renamePropOf?yr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!wt&&Cr?.zone===e&&Cr.index===n))return;const r=(t,o)=>{Nr(null),o&&((e,n,t)=>{const o=Oi(e)[n];if(!o)return;const r=Di(o,e);r&&ao.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return lt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Yt.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)},Hi=t(Y(),_t),Wi=Hi.scope({target:Xe,siteId:Un,docId:Ze}),Ui=Tt,Gi=(e,n)=>n===zn?zi(e):wi(e),Ji=(e,n,t)=>{const o=Hi.plan(Wi,t,Gi(t.type,e),Ui);o&&(o.changed&&ao.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Hr(o.message))},Yi=te({nodesIn:Oi,nodeAt:(e,n)=>Oi(e)[n]??null,labelOf:(e,n)=>n===zn?zi(e):wi(e),renamePropOf:Di,beginRename:(e,n)=>Nr({zone:e,index:n}),history:{hasPast:Pt.hasPast,hasFuture:Pt.hasFuture,back:()=>Pt.back(),forward:()=>Pt.forward()},openPageSettings:()=>{ao.select(null),Ko(R)},pageSettingsLabel:Yt.pageSettings,words:{menu:Qt,styleClipboard:_t,screen:Yt.menu},readOnly:Boolean(wt),collapseAll:()=>Pr(new Set(Oi(zn).map(e=>String(e.props.id)))),onPasteRefused:e=>Hr(e?Yt.pasteRefused({name:e.label}):Yt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ns(e,n),menuRows:(e,n,t)=>{const o=dr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=jt.shared;if(!t||n!==zn)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Yt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return wt||pr(e.type,e)?n:{...n,change:[{label:Yt.shared.detach,onClick:()=>ki(e.props.id)}],remove:[{label:Yt.shared.removeFromPage,danger:!0,onClick:()=>{bi(e.props.id)}}]}}return wt||Wt(e)||Ut(e)||Ft(e.type)?null:z(gi)?{change:[{label:Yt.shared.makeShared,onClick:()=>vi({id:e.props.id,name:Ci(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>pr(e.type,e),duplicateBlocked:e=>ur(Bt.data,e),permits:e=>{const n=Cn(Tt,e.type);return jt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Si,isPinned:(e,n)=>n===zn&&(Wt(e)||Ut(e)),sectionBand:ci,locate:e=>Ni.get(e)??null,rowNameOf:(e,n)=>n===zn?Ci(e):Fi(e),selectAt:(e,n,t,o)=>{e===zn?_i(n):Nl(e,n,t,o??"")},slotRung:e=>{const n=Pi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ti(n.node,n.slot,!1)}:null},style:{held:()=>ye(Wi),canCopy:e=>Hi.rows(Ui,e).some(e=>!1!==e.counted),copy:(e,n)=>Hi.copy(Wi,e,Gi(e.type,n),Ui),paste:(e,n,t)=>Ji(e,n,t)},keys:Ct?{target:Eo,selected:()=>{const e=Bt.ui.itemSelector;return e?{zone:e.zone??zn,index:e.index}:null},held:()=>hi.get(),readOnly:Boolean(wt),onDone:({done:e,name:n})=>{"copied"===e&&Hr(Yt.copied({name:n}))}}:void 0},jo),Xi=$n({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});jn(()=>{Xi.current={copy:(e,n)=>Hi.copy(Wi,e,Gi(e.type,n),Ui),paste:Ji,at:()=>{const e=Bt.ui.itemSelector;if(!e)return null;const n=e.zone??zn,t=Oi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(wt)}});const Zi=An(e=>{const n=ve(e);if(!n)return;const t=Xi.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))},[]);jn(()=>{if(!Eo)return;const e=e=>Zi(e);return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Zi,Eo]),Je(jo,"keydown",Zi);const Ki=ai.map(e=>e.props.id).join("|");jn(()=>{const e=jo?.document??null,n=jo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Xo(e=>e.length?[]:e);const n=ai.findIndex(Ut),t=n>=0?n:ai.length,o=n=>{const t=ai[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ue)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ai.length>0&&!Wt(ai[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=gt(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})}Xo(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()}},[jo,Ki,vo,Qr,po,uo,$t?.props.id]);const qi=jo?.document??null,Qi=jo?.window??null;jn(()=>{const e=Lo.current;if(!e||!qi||!Qi)return;const n=[],t=()=>{const n=qi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Qi.scrollTo({left:Qi.scrollX,top:Qi.scrollY+t,behavior:"instant"}),!0};return Lo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[qi,Qi]);const _i=e=>{Ko(R),ao.select({index:e}),dr.sectionPressed?.(ai[e]);const n=ai[e]?.props?.id;n&&l(n)},el=e=>{const{floor:n,cap:t}=ci(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=$t&&Zo.kind!==Ht?.kind?ai.findIndex(e=>e.props.id===$t.props.id):-1;return o(r>=0?r+1:t)},nl=(e,n)=>{const{floor:t,cap:o}=ci(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(ao.reorderComponent(zn,e,i),ao.select({index:i}),{moved:!0,dest:i})},tl=(e,n,t,o)=>{Ko(R),ao.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Hr(Yt.sectionAdded({name:t}))},ol=(e,n)=>{const t=el(n),o=hr(e,{nodeDefaults:xi,newNodeId:Bn,sectionLabel:zi,blockIsOffered:gr}),r=o?ao.insertNode(zn,t,o):ao.insertSection(e,t);return tl(t,r,zi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of In(Tt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=mr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},rl=e=>il(zn,e),il=(e,n)=>{Dr.current=document.activeElement??null,Jo(null===n?null:{zone:e,index:n}),Wo(!0),po||(Uo.current=!0,Mt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ll=()=>{Wo(!1),Jo(null),Uo.current&&Mt({type:"setUi",ui:{leftSideBarVisible:!1}}),Uo.current=!1},sl=(e,n)=>yr.rowName?n?Wt(e)?yr.rowName(e,"section",Yt.header):Ut(e)?yr.rowName(e,"section",Yt.footer):Ft(e.type)?yr.rowName(e,"section",wi(e.type)):Ci(e):Fi(e):n?zi(e.type):wi(e.type),dl=e=>n=>{e()},al=(e,n,t)=>{if(wt)return null;const o=Oi(e)[n];return o&&!Cn(Tt,o.type).delete||o&&pr(o.type,o)?null:/* @__PURE__ */lt($e,{kind:"delete",label:e===zn&&o&&jt.shared?.usedOn(o)?Yt.shared.removeFromPage:Yt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Oi(e)[n]?.props?.id;null!=t&&bi(String(t))})(e,n),children:/* @__PURE__ */lt(nt,{size:15})})},cl=e=>yr.rowPreview?.(e)||void 0,pl=e=>yr.rowMarks?.(e)??void 0,ul=(e,n,t)=>yr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(wt)return null;if(pr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return lt($e,{kind:"eye",label:r?Yt.showNamed({name:o}):Yt.hideNamed({name:o}),onClick:()=>ml(e,n,t),children:/* @__PURE__ */lt(r?tt:ot,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},hl=e=>Vs(zn,e),ml=(e,n,t)=>{ao.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},gl=e=>On(Tt,e),yl=e=>In(Tt,e),vl=e=>cr.slotsOf?Mi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Mn(e,n.slot)})):[{slot:null,rung:null,kids:yl(e)}],kl=e=>cr.slotsOf?vl(e).flatMap(e=>e.kids):yl(e),bl=e=>Boolean(cr.slotsOf)&&Mi(e).some(e=>e.rung),Sl=(e,n,t)=>null===t?void 0===n?mr(e):mr(e,n):mr(e,n,t),wl=(e,n,t)=>{const o=Pn(Tt,e.type,n)&&(t||kl(e).length>0||bl(e));return{collapsible:o,folded:o&&Er(String(e.props.id))}},xl=(e,n,t)=>vl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>wl(e,r,t(e.type)).collapsible?[String(e.props.id),...xl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),zl=e=>kl(e).length>0||bl(e)||Boolean(mr(e.type)),Cl=e=>Boolean(mr(e)),Nl=(e,n,t,o)=>{if(Ko(R),mr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),ao.select({index:n,zone:e}),l(t)}else ao.select({index:n,zone:e}),l(t)},Il=(e,n,t,o,r)=>{const i=`${e}:${n}`;ao.insertComponent(i,t,o),mr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),ao.select({index:o,zone:i})}):ao.select({index:o,zone:i})},Ol=$n(/* @__PURE__ */new Set);jn(()=>{ai.forEach(e=>{const n=mr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ol.current.has(t))return;Ol.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(xi)).forEach((e,t)=>io.seedChild(o,t,n.childType,e))})},[ai,io,xi]);const Bl=$n(/* @__PURE__ */new Set);jn(()=>{ai.forEach((e,t)=>{const o=e.props.id;if(Bl.current.has(o))return;const r=n(e,gl(e.type));Bl.current.add(o),r&&io.replaceComponent(zn,t,{...e,props:r})})},[ai,io]),X(io,Tt);const Ml=ai.findIndex(Ut),Pl=Ml>=0?ai[Ml]:null,$l=Gt?ai.findIndex(Wt):-1,Ll=$l>=0?ai[$l]:null,Tl=jt.groupTab,jl=Ln(()=>Tl?e=>Ft(e.type):void 0,[Tl]),Al=Boolean(jt.groupBadge),El=jt.sharedReach,Rl=e=>El?.(e)??void 0,Fl=Ln(()=>El?new Set(ai.filter(e=>Rl(e)).map(e=>String(e.props.id))):null,[ai,El]),Dl=Ln(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Vl=jt.first?El?.({type:jt.first,props:{id:""}})??void 0:void 0,Hl=jt.groupBadge?/* @__PURE__ */lt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */lt(Dn,{tone:"info",size:"xs",children:jt.groupBadge})}):void 0,Wl=ai.find(e=>e.type===Et)??null,Ul=ai.find(e=>e.type===Rt)??null,Gl=Ml>=0?Ml:ai.length,Jl=[];ai.forEach(e=>{Ut(e)||(zl(e)&&Jl.push(String(e.props.id)),Jl.push(...xl(e,1,Cl)))}),Pl&&(Jl.push(String(Pl.props.id)),Jl.push(...xl(Pl,1,Cl)));const Yl=Jl.length>0&&Jl.every(e=>Mr.has(e)),Xl=e=>{const n=yr.blockRowName(e,wi);return yr.rowName?yr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=Oi(e)[t];if(!r)return;const i={...en(e),index:t},l={...en(n),index:Math.min(Math.max(o,0),Oi(n).length)},s=Ee(i,l);if(e!==n||s!==t)try{mi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof tn))throw e}},Kl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of yl(e))n.add(r),t(o)};for(const t of gl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ql=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ni.get(n);if(!e)return null;if(e.zone===zn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Dt(n)===e?t:null},_l=(e,n)=>{const t=Ql(e);return!t||(!jt.groupAccepts||jt.groupAccepts(t.type,n,Oi(e).length))},es=(e,n,t)=>{if(e.rung){const t=Bi(e.rung.nodeId),o=t?Mi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===yt&&n.index>=0&&n.index<=o}if(n.slot===yt)return!1;if(e.add)return rs(e.add,n);const o=_e(n);if(Ft(e.type))return!1;const r=Ql(o),i=Ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!_l(o,e.type))&&(n.index>=0&&n.index<=Oi(o).length));if(e.zone===zn||o===zn){if(e.zone!==o)return!1;const{floor:t,cap:r}=ci();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Oi(o).length)return!1;if(e.zone===o)return!0;const l=Pl&&!jt.lastIsOpen?String(Pl.props.id):null;return(!l||ql(e.zone)!==l&&ql(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Oi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ni.get(i),s=l?Oi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Kl(r).has(n))return!1;const d=mr(s.type,fr(Bt?.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?.(Oi(n),r))})(e.zone,o,e.index,t)},ns=(e,n)=>{const t=_e(e.from),o=e.node;return t===_e(n)?_l(t,o.type):es({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=Ni.get(n),o=t?Oi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=mr(o.type,fr(Bt?.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=O(r.choices??(r.spec?[{type:r.spec.childType,label:wi(r.spec.childType)}]:[])),l=Pi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:sl(o,t.zone===zn)}},os=(e,n)=>{if("section"!==e.kind)return e;const t=_e(n);return t===zn||Ql(t)?e:ts(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},rs=(e,n)=>{const t=os(e,n),o=_e(n);if("shared"===t.kind){if(o!==zn||!jt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(Ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return _l(o,e)&&n.index>=0&&n.index<=Oi(o).length}if(o!==zn)return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if(o===zn)return!1;const r=ts(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Oi(o))},is=(e,n)=>{const t=os(e,n);if("block"!==t.kind&&Ql(_e(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&_l(n,o)){if("section"===e.kind)ao.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;ao.insertNode(n,t,fi(e.template.node))}Ko(R),ao.select({index:t,zone:n})}})(t,_e(n),n.index);if("section"===t.kind)return void ol(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=el(t),r=ao.insertNode(zn,o,n);tl(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=jt.shared?.nodeOf(t.section);if(!e)return;const o=el(n.index);return void(mi.restore(e,{parentId:qe,slot:Qe,index:o})&&tl(o,e.props.id,t.section.title))}const o=_e(n),r=ts(o);r&&(r.target.spec?Il(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{ao.insertComponent(e,n,t),Ko(R),ao.select({index:t,zone:e})})(o,t.type,n.index))},ls=(e,n)=>{e.media?function(e){const n=As();if(!n||!Ls)return;Rs(n).then(n=>{n&&function(e,n){if(!Ls)return;const t=Ls.create(e,{nodeDefaults:xi,newNodeId:Bn,sectionLabel:zi,blockIsOffered:gr}),o=_e(n);if(o===zn){const e=el(n.index),o=ao.insertNode(zn,e,t);return void tl(e,o,zi(t.type))}ao.insertNode(o,n.index,t),Ko(R),ao.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ai(e.rung.nodeId,e.index,n.index):e.add?is(e.add,n):e.zone===zn?nl(e.index,n.index):Zl(e.zone,_e(n),e.index,n.index)},[ss]=Tn(()=>je()),ds=Ae({keyOf:e=>e.id,readOnly:Boolean(wt),session:ss,canDrop:es,onDrop:ls,onStep:(e,n)=>{e.rung?Ai(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===zn?((e,n)=>{const t=zi(ai[e]?.type??""),o=nl(e,n<0?e-1:e+2);if(!o.moved)return void Hr(n<0?Yt.sectionFirst({name:t}):Yt.sectionLast({name:t}));const{floor:r,cap:i}=ci();Hr(Yt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Zl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),as=An(e=>{const{floor:n,cap:t}=ci(),o=[];for(const r of e.nodes){const e=_e(r.place),i=Oi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Wt(i)||Ut(i)||pr(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(Ql(e)),s=e===zn||l;e===zn&&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?zi(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=_e(e.list);if(n===zn&&0===e.children.length)return[{...e,addLabel:Yt.addSection,addAlways:!0}];const t=ts(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=_e(e.list),t=n===zn||Ql(n)?null:ts(n);return t?.choices.length?be(e,t.target.spec?.addLabel??Yt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Bt.data]),cs=null==$t?.props.id?null:String($t.props.id),ps=An(e=>{const n=Tt,t=e=>!e.item.rung&&null!==nn(Bt.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(cs);return i||(r(Ve(Bt.data,n,o.item.id,cs,jl))??o)},[Bt.data,Tt,cs,jl]),[us,fs]=Tn(null),hs=Boolean(Tl||El);Je(jo,"mouseover",e=>{if(!hs)return;const n=Ye(e.target),t=n?ut(Bt.data,Tt,n):null;t!==us&&fs(t)}),Je(jo,"mouseout",e=>{hs&&!e.relatedTarget&&fs(null)});const ms=e=>Wt(e)||Ut(e)||Ft(e.type),gs=e=>{const n=Ft(e.type)?wi(e.type):Wt(e)?Yt.header:Ut(e)?Yt.footer:null;return null===n?Ci(e):yr.rowName?yr.rowName(e,"section",n):n},ys=[];if(hs){const e=cs?ut(Bt.data,Tt,cs):null;for(const n of/* @__PURE__ */new Set([e,us])){const e=n?ai.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Wt(e)||e.type===Et,o=Rl(e);if(o){ys.push({id:String(e.props.id),label:gs(e),below:t,reach:o});continue}if(!Tl||!ms(e))continue;const r=Tl(e);r&&ys.push({id:String(e.props.id),label:r,below:t})}}const vs=pe(),ks=$n(null);jn(()=>{const e=jt.changeNotice;if(!e)return;const n=JSON.stringify(ai.filter(ms)),t=ks.current;if(ks.current={doc:Ze,bands:n,index:Pt.index},!t||t.doc!==Ze||t.bands===n)return;Pt.hasPast&&Pt.index>=t.index&&!pt.has(vs)&&(pt.add(vs),Hr(e,"success",{action:{label:Yt.bar.undo,onClick:()=>Pt.back()},duration:8e3}))},[ai]);const bs=e=>{Ko(R),ao.select(e.zone===zn?{index:e.index}:{index:e.index,zone:e.zone})},Ss=Z(),ws=()=>({data:Bt.data,device:vo,ops:ao,inspector:sr}),xs=Ss?.model,zs=Ln(()=>xs?e=>xs(e,as(e),ws()):as,[xs,as,vo]),Cs=Ss?.measure,Ns=Cs?(e,n)=>Cs(e,n,ws()):void 0,Is=Ss?.canDrop,Os=Is?(e,n)=>Is(e,n,es,ws()):es,Bs=Ss?.drop,Ms=Bs?(e,n)=>Bs(e,n,ls,ws()):ls,Ps=Ss?.pick,$s=Ps?e=>Ps(e,bs,ws()):bs,Ls=Ss?.media??null,Ts=$n(null),js=Ln(()=>Ls?{id:at,zone:"",index:-1,type:Ls.adds.type,add:{kind:Ls.adds.kind,type:Ls.adds.type},media:!0}:null,[Ls]);jn(()=>{if(!js||wt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Kn))(e)&&(Ts.current=null,ss.start({key:at,item:js}))},n=e=>{ss.get()?.item.media&&(Ts.current=Wn(e.dataTransfer))},t=()=>{ss.get()?.item.media&&ss.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[js,wt,ss]);const As=()=>{const e=Ts.current;return Ts.current=null,e},Es=ce(),Rs=async e=>{if(!Es)return e;const n=await Es(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!Ls)return;const t=nn(so.getState().appState.data,pi,n);if(!t)return;const o=t.node;ao.replaceComponent(_e(t.place),t.place.index,{...o,props:{...Ls.replace(o,e),id:o.props.id}})},Ds=e=>{const n=_e(e),t=Pi(n);t&&Ti(t.node,t.slot,!1),il(n,e.index)},Vs=(e,n)=>/* @__PURE__ */lt(Le,{...wt?{}:ds.seam({place:{...en(e),index:n}})},`seam:${e}:${n}`),Hs={rowClick:dl,isCollapsed:Er,toggleCollapse:Rr},Ws=e=>{const n=String(e.props.id),t=ai.findIndex(e=>String(e.props.id)===n),o=Dt(n),r=Oi(o),i=Er(n),l=wi(e.type),s=yr.rowName?yr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
16
|
-
return st(dt,{children:[
|
|
17
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:e.type,size:13}),name:s,preview:cl(e),marks:pl(e),onSelect:()=>_i(t),nameSlot:Vi(zn,t,n,s),selected:Qo===n,badge:Rl(e)?void 0:Hl,shared:Rl(e),actions:ul(e,zn,t)??void 0,rowProps:{"data-node-id":n,onClick:dl(()=>_i(t))},fold:{open:!i,label:"section",onToggle:()=>Rr(n)}}),!i&&/* @__PURE__ */st(Be,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ci(n),l=zl(n),s=l&&Er(r),a=()=>Nl(o,t,r,e.type),{rowProps:c,...p}=ds.row({item:{id:r,zone:o,index:t,type:n.type},place:{...en(o),index:t}},{"data-node-id":r,onClick:dl(a)});/* @__PURE__ */
|
|
18
|
-
return st(Rn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:Qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(o,t,i),ul(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */lt(Be,{children:Js(n,2)})]},r)}),d(r.length)]})]})},Us=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ds.dragging,d=!Er(l)&&s?.rung?.nodeId!==i,a={...en(l),index:0},c=s&&!s.rung&&es(s,a)?a:void 0,p=()=>Ti(e,n,!0),{rowProps:u,...f}=ds.row({item:{id:`rung:${l}`,zone:`${i}:${yt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:yt,index:t},into:c,canDrag:Boolean(cr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:dl(p)}),h=wt?null:cr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return st(Rn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$i===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Rr(l)},actions:h&&h.length>0?/* @__PURE__ */lt(dt,{children:h.map((t,o)=>/* @__PURE__ */lt($e,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(wt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ji(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__ */lt(nt,{size:15}):/* @__PURE__ */lt(it,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */lt(Be,{children:r})]},l)},Gs=(e,n)=>{const t=vl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return lt(dt,{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,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */st(dt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Qo===String(n.props.id),{collapsible:i,folded:s}=wl(n,l,Cl(n.type)),d=String(n.props.id),a=Xl(n),p=()=>Nl(t,o,d,e.type),{rowProps:u,...f}=ds.row({item:{id:d,zone:t,index:o,type:n.type},place:{...en(t),index:o}},{"data-node-id":d,onClick:dl(p)});/* @__PURE__ */
|
|
23
|
-
return st(Rn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:n.type,size:13}),name:a,preview:cl(n),marks:pl(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Rr(d)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(t,o,a),ul(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */lt(Be,{children:Gs(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Us(e,t.rung,r++,o,p):/* @__PURE__ */lt(Rn,{children:p},t.slot??"")})})},Js=(e,n)=>{const t=fr(Bt?.data,e.type,String(e.props.id)),o=vl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return lt(dt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Sl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */st(dt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Qo===String(n.props.id),i=Fi(n),l=String(n.props.id),{collapsible:d,folded:a}=wl(n,s,Cl(n.type)),c=gl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...en(p),index:Oi(p).length}:void 0,f=ds.dragging,h=u&&f&&es(f,u)?u:void 0,g=()=>Nl(t,o,l,e.type),{rowProps:y,...v}=ds.row({item:{id:l,zone:t,index:o,type:n.type},place:{...en(t),index:o},into:h,canDrag:!pr(n.type,n)},{"data-node-id":l,onClick:dl(g)});/* @__PURE__ */
|
|
26
|
-
return st(Rn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Rr(l)}:void 0,actions:pr(n.type,n)?ul(n,t,o)??void 0:/* @__PURE__ */st(dt,{children:[al(t,o,i),ul(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */lt(Be,{children:Js(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */lt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Il(e.props.id,a.slot,a.childType,c.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?Us(e,o.rung,i++,r,v):/* @__PURE__ */lt(Rn,{children:v},o.slot??"")})})},Ys=Ho,Xs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:po&&!Ys&&ar===e.id,onSelect:()=>ii(e.id)}:e,Zs=[...(dr.railLead??[]).map(Xs),{id:"sections",label:Yt.layers,icon:/* @__PURE__ */lt(he,{}),active:po&&!Ys&&"sections"===ar,onSelect:()=>ii("sections")},...(dr.railTrail??[]).map(Xs)];So?Zs.push({id:"media",label:Yt.railMedia,icon:/* @__PURE__ */lt(me,{}),active:zo,onSelect:Co}):Nt&&Zs.push({id:"media",label:Yt.railMedia,icon:/* @__PURE__ */lt(me,{}),onSelect:li});const Ks={value:Zs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Zs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Zs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */lt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},qs=[...dr.railLead??[],...dr.railTrail??[]].find(e=>"panel"in e&&e.id===ar),Qs=Boolean(Jt?.foldable),_s=Jt?.label??(It?Yt.pageSections:Yt.templateSections),ed=Qs&&Er(vt),nd=/* @__PURE__ */st(dt,{children:[ai.map((e,n)=>{if(Wt(e)||Ut(e)||Ft(e.type))return null;const t=Qo===String(e.props.id),o=Boolean(e.props._hidden);yl(e);const r=String(e.props.id),i=dr.hasOwnRows?.(e)??!1,l=zl(e)||i,s=l&&Er(r),d=gl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...en(a),index:Oi(a).length}:void 0,p=ds.dragging,u=c&&p&&es(p,c)?c:void 0,{rowProps:f,...h}=ds.row({item:{id:r,zone:zn,index:n,type:e.type},place:{...en(zn),index:n},into:u,canDrag:!pr(e.type,e)},{"data-node-id":r,onClick:dl(()=>_i(n))});/* @__PURE__ */
|
|
29
|
-
return st(Rn,{children:[n>0&&hl(n),
|
|
30
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:e.type,size:13}),name:Ci(e),preview:cl(e),marks:pl(e),shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(zn,n,r,Ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(zn,n,Ci(e)),ul(e,zn,n),fl(zn,n,e,Ci(e))]}),rowProps:f}),zl(e)&&!s&&/* @__PURE__ */st(Be,{children:[Js(e,1),dr.partRows?.(e,Hs)]}),i&&!s&&/* @__PURE__ */lt(Be,{children:dr.ownRows?.(e,n,Hs)})]},String(e.props.id??n))}),Gl>0&&hl(Gl)]}),td=(e,n,t)=>{const o=String(e.props.id),r=kl(e).length>0||bl(e)||Boolean(mr(e.type)),i=r&&Er(o),l="header"===t?Yt.header:Yt.footer,s=yr.rowName?yr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return st(dt,{children:[
|
|
32
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:t,size:13}),name:s,preview:cl(e),marks:pl(e),badge:Rl(e)?void 0:Hl,shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(zn,n,o,s),selected:Qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Rr(o)}:void 0,actions:ul(e,zn,n)??void 0,rowProps:{"data-node-id":o,onClick:dl(()=>_i(n))}}),r&&!i&&/* @__PURE__ */lt(Be,{children:Gs(e,1)})]})};return(dr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */lt(K,{target:jo,children:/* @__PURE__ */st("div",{ref:To,className:"sf-editor es-editor",style:fn($r),onContextMenu:Yi.onEditorContextMenu,...u(We),children:[
|
|
34
|
-
/* @__PURE__ */st(on,{children:[
|
|
35
|
-
/* @__PURE__ */lt("div",{className:"es-cluster es-cluster--left","aria-hidden":"true"}),
|
|
36
|
-
/* @__PURE__ */st(rn,{children:[
|
|
37
|
-
/* @__PURE__ */lt(ln,{label:Yt.bar.undo,disabled:Boolean(wt)||!Pt.hasPast,onClick:()=>Pt.back(),children:/* @__PURE__ */lt(qn,{})}),
|
|
38
|
-
/* @__PURE__ */lt(ln,{label:Yt.bar.redo,disabled:Boolean(wt)||!Pt.hasFuture,onClick:()=>Pt.forward(),children:/* @__PURE__ */lt(Qn,{})}),
|
|
39
|
-
/* @__PURE__ */lt(sn,{}),
|
|
40
|
-
/* @__PURE__ */lt(dn,{devices:fo,value:vo,onChange:ko}),
|
|
41
|
-
/* @__PURE__ */lt(ln,{label:Yt.bar.refresh,tip:Yt.bar.refreshTip,onClick:()=>{Lo.current=(()=>{const e=jo?.document;if(!e)return null;const n=ai.findIndex(Ut),t=n>=0?n:ai.length;let o=null;for(let n=0;n<t;n++){const t=ai[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=$t?.props?.id??ai[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),$o(e=>e+1)},children:/* @__PURE__ */lt(_n,{})})]}),
|
|
42
|
-
/* @__PURE__ */st(rn,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
-
/* @__PURE__ */lt(k,{input:Do,words:Yt.saveStatus}),dr.barLead?.(),dr.barTrail?.(),dr.mainAction||!dr.barMain?/* @__PURE__ */lt(b,{input:Do,action:dr.mainAction??{label:Yt.done,onPress:()=>{Gn(Bt.data)}},readOnly:Boolean(wt),saveSwitch:zt,onToggleAutoSave:Zn,onSaveNow:Vo,bar:Yt.bar,words:Yt.saveStatus}):dr.barMain()]})]}),
|
|
44
|
-
/* @__PURE__ */lt(oe,{}),
|
|
45
|
-
/* @__PURE__ */st("div",{className:"sf-body",children:[po?/* @__PURE__ */st(dt,{children:[
|
|
46
|
-
/* @__PURE__ */st("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Yt.leftPanel,children:[
|
|
47
|
-
/* @__PURE__ */lt("div",{className:"es-paneltabs",children:/* @__PURE__ */lt(Vn,{variant:"underline",block:!0,"aria-label":Yt.bar.views,value:Ks.value,onChange:Ks.press,items:Ks.items})}),Ho?/* @__PURE__ */lt(x,{at:Go?{label:(e=>{const n=Ql(e.zone);if(n)return Yt.add.addingTo({name:yr.rowName?sl(n,!0):wi(n.type)});if(e.zone===zn){const n=ai[e.index];return n&&!Ut(n)?Yt.add.addingBefore({name:sl(n,!0)}):Yt.add.addingAtEnd}const t=ts(e.zone);return t?Yt.add.addingTo({name:t.parentName}):Yt.add.addingHere})(Go),onClear:()=>Jo(null)}:void 0,placeBlocks:Go&&Go.zone!==zn?ts(Go.zone)?.choices:void 0,canTake:Go?e=>{if(!Go)return null;const n={...en(Go.zone),index:Go.index};if(rs(e,n))return null;if("shared"===e.kind&&Go.zone===zn&&!jt.shared?.nodeOf(e.section))return Yt.shared.alreadyHere;const t=Ql(Go.zone);if(t)return Yt.add.notInside({name:sl(t,!0)});if(Go.zone===zn)return Yt.add.onlySections;const o=ts(Go.zone);return o?Yt.add.notInside({name:o.parentName}):Yt.add.onlySections}:void 0,onPick:Go?e=>{if(!Go)return;const n={...en(Go.zone),index:Go.index};rs(e,n)&&(is(e,n),ll())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ss,siteWide:dr.addPanelRow?.(ll),onClose:ll,onHide:oi,readOnly:Boolean(wt)}):qs?qs.panel({onHide:oi,notify:Hr}):/* @__PURE__ */st(dt,{children:[
|
|
48
|
-
/* @__PURE__ */lt(N,{icon:/* @__PURE__ */lt(he,{}),title:Yt.layers,context:no,actions:/* @__PURE__ */st(dt,{children:[!wt&&/* @__PURE__ */lt(an,{label:Yt.add.title,onClick:()=>rl(null),children:/* @__PURE__ */lt(et,{size:15})}),
|
|
49
|
-
/* @__PURE__ */lt(an,{label:Yl?Yt.expandAll:Yt.collapseAll,title:0===Jl.length?Yt.nothingToFold:void 0,disabled:0===Jl.length,onClick:()=>Pr(e=>{const n=new Set(Jl);return Yl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Jl])}),children:/* @__PURE__ */lt(ht,{expand:Yl})})]}),onHide:oi}),
|
|
50
|
-
/* @__PURE__ */st(Me,{className:"sf-tree sf-scroll",words:Xt,children:[
|
|
51
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:"page",size:13}),name:Yt.pageSettings,onSelect:si,selected:!$t&&qo,rowProps:{onClick:dl(si)}}),Wl&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Pe,{children:Yt.header}),Ws(Wl)]}),Ot&&!(Al&&Wl)&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Pe,{children:Yt.header}),!Gt&&/* @__PURE__ */lt(Oe,{words:Xt,icon:/* @__PURE__ */lt(kr,{type:"header",size:13}),name:Yt.header,badge:Vl?void 0:Hl,shared:Vl,onSelect:di,selected:Zo.kind===Ht?.kind,rowProps:{onClick:dl(di)}})]}),Ll&&!(Al&&Wl)&&td(Ll,$l,"header"),!Qs&&/* @__PURE__ */lt(Pe,{children:_s}),Qs?/* @__PURE__ */st(dt,{children:[
|
|
52
|
-
/* @__PURE__ */lt(Oe,{words:Xt,icon:null,name:_s,fold:{open:!ed,label:_s,onToggle:()=>Rr(vt)}}),!ed&&/* @__PURE__ */lt(Be,{children:nd})]}):nd,Ot&&!Al&&/* @__PURE__ */lt(Pe,{children:Yt.footer}),Pl&&!(Al&&Ul)&&td(Pl,Ml,"footer"),Ul&&Ws(Ul),dr.treeFoot?.()]})]})]}),
|
|
53
|
-
/* @__PURE__ */lt(cn,{side:"left",width:$r.left,min:un.left,max:pn,defaultWidth:m.left,label:Yt.resizeLeftPanel,onResize:jr})]}):/* @__PURE__ */lt(I,{side:"left",onShow:oi}),
|
|
54
|
-
/* @__PURE__ */st("div",{ref:Wr,className:"sf-center sf-scroll","data-sf-canvas-head":Xr?"":void 0,style:{overflowX:ei?"auto":"hidden",overflowY:"hidden"},children:[Xr&&/* @__PURE__ */lt("div",{ref:Zr,className:"sf-canvas-head",children:/* @__PURE__ */lt(Xr,{device:vo})}),
|
|
55
|
-
/* @__PURE__ */st("div",{className:"sf-frame-scaler",style:ni,children:[
|
|
56
|
-
/* @__PURE__ */lt("div",{className:"sf-frame "+(vo===go?"":`sf-frame--${vo}`),style:ti,children:/* @__PURE__ */st("div",{className:"sf-preview-host",children:[
|
|
57
|
-
/* @__PURE__ */lt(Ne.Provider,{value:jl,children:/* @__PURE__ */lt(Ie.Provider,{value:Dl,children:/* @__PURE__ */lt(to,{},Po)})}),
|
|
58
|
-
/* @__PURE__ */lt(Se,{canvas:jo,session:ss,model:zs,measure:Ns,canDrop:Os,onDrop:Ms,choose:ps,onPick:$s,dropOn:Ls?{accepts:(e,n)=>{if(!e.media||!Ls||n.item.rung)return!1;const t=nn(Bt.data,pi,n.item.id);return null!==t&&Ls.takes(t.node)},onDrop:(e,n)=>(e=>{const n=As();n&&Ls&&Rs(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Yt.canvasReplaceImage}:void 0,onZoneAdd:Ds,onSeamAdd:Ds,zoneAddLabel:Yt.canvasAddBlock,words:Zt.canvas,readOnly:Boolean(wt),revision:Bt.data}),Yo.length>0&&!Ao&&/* @__PURE__ */lt("div",{className:"sf-preview-gaps",children:Yo.map(e=>
|
|
59
|
-
/* @__PURE__ */lt(we,{index:e.index,label:Yt.addSectionHere,onInsert:()=>rl(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))})]})}),hs?/* @__PURE__ */lt(ft,{canvas:jo,tabs:ys,onSelect:e=>{const n=ai.findIndex(n=>String(n.props.id)===e);n>=0&&_i(n)}}):null]})]}),uo?/* @__PURE__ */st(dt,{children:[
|
|
60
|
-
/* @__PURE__ */lt(f,{value:{selectChild:Nl,addChild:Il,childRowName:Fi,blockRowName:Xl},children:/* @__PURE__ */lt(oo,{mode:Zo,onOpenWebsiteSettings:dr.openSettings??(()=>{}),onOpenSiteStyles:dr.openStyles,onSelectNode:xr,onNotify:Hr,onHidePanel:ri,nodeActions:$t?Cn(Tt,$t.type):kt})}),
|
|
61
|
-
/* @__PURE__ */lt(cn,{side:"right",width:$r.right,min:un.right,max:pn,defaultWidth:m.right,label:Yt.resizeSettingsPanel,onResize:Ar})]}):
|
|
62
|
-
/* @__PURE__ */lt(I,{side:"right",onShow:ri})]}),Yi.menu,
|
|
63
|
-
/* @__PURE__ */lt(ee,{}),yi?/* @__PURE__ */lt(ct,{name:yi.name,onMake:e=>(async(e,n)=>{const t=ai.find(n=>String(n.props.id)===e),o=jt.shared;if(!t||!o)return;let r;try{r=await C(gi).create(n,t)}catch{return void Hr(Yt.shared.makeFailed,"error")}o.adopt(t,r),vi(null)})(yi.id,e),onCancel:()=>vi(null)}):null]})}))}export{bt as ScreenChrome};
|
package/dist/chunk-OD4WIIER.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-UAS2LEW2.js";import{SELECTION_MODE as e}from"./chunk-I2BCNLLV.js";import{useEasel as r}from"./chunk-UZXGXMNO.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{decodePartId as n,encodePartId as p}from"./chunk-IYT6NN2J.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}=r(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=n(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?p(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};
|
package/dist/chunk-OSPUG6S6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_NODE_MENU_WORDS as e}from"./chunk-WK3AFPXY.js";import{TrashIcon as n,EyeIcon as o,EyeOffIcon as t,RenameIcon as i,PasteIcon as c,CopyIcon as l,MoveDownIcon as s,MoveUpIcon as p,DuplicateIcon as a,AddIcon as r,LayersIcon as u}from"efficient-shell/icons/efficient";import{jsx as h}from"react/jsx-runtime";function d(){let e=null;const n=/* @__PURE__ */new Set;return{get:()=>e,set(o){e=o;for(const e of[...n])e()},subscribe:e=>(n.add(e),()=>n.delete(e))}}var m={layer:{icon:/* @__PURE__ */h(u,{})},addInside:{icon:/* @__PURE__ */h(r,{})},duplicate:{icon:/* @__PURE__ */h(a,{})},moveUp:{icon:/* @__PURE__ */h(p,{})},moveDown:{icon:/* @__PURE__ */h(s,{})},copy:{icon:/* @__PURE__ */h(l,{}),shortcut:"⌘C"},cut:{icon:/* @__PURE__ */h(l,{}),shortcut:"⌘X"},paste:{icon:/* @__PURE__ */h(c,{}),shortcut:"⌘V"},rename:{icon:/* @__PURE__ */h(i,{})},hide:{icon:/* @__PURE__ */h(t,{})},show:{icon:/* @__PURE__ */h(o,{})},upLevel:{},delete:{icon:/* @__PURE__ */h(n,{}),danger:!0}};function f(n){const{actions:o,rows:t={},extras:i={},words:c=e}=n,l=e=>({...m[e],label:c[e],...t[e]}),s=(e,n,o)=>{const t=l(e),i={label:o??t.label??e,onClick:n};return t.icon&&(i.icon=t.icon),t.shortcut&&(i.shortcut=t.shortcut),t.danger&&(i.danger=!0),i},p=()=>{const e=l("layer"),o={label:e.label??c.layer,onClick:()=>{},children:n.layer.items};return e.icon&&(o.icon=e.icon),o},a=[],r=[],u=[],h=[],d=!!n.layer&&n.layer.items.length>1;if(d&&"pick"===(n.layer.group??"pick")&&a.push(p()),o.addInside&&r.push(s("addInside",o.addInside)),o.duplicate&&r.push(s("duplicate",o.duplicate)),o.moveUp&&r.push(s("moveUp",o.moveUp)),o.moveDown&&r.push(s("moveDown",o.moveDown)),o.copy&&r.push(s("copy",o.copy)),o.cut&&r.push(s("cut",o.cut)),o.paste){const e=l("paste").label??c.paste;r.push(s("paste",o.paste.run,c.pasteNamed({paste:e,label:o.paste.label})))}o.rename&&u.push(s("rename",o.rename)),o.hide&&u.push(o.hide.hidden?s("show",o.hide.run):s("hide",o.hide.run)),d&&"change"===n.layer.group&&u.push(p()),o.upLevel&&u.push(s("upLevel",o.upLevel)),o.delete&&h.push(s("delete",o.delete)),a.push(...i.pick??[]),r.push(...i.make??[]),u.push(...i.change??[]),h.push(...i.remove??[]);const f=[a,r,n.style??[],u,h].filter(e=>e.length>0),g=a.length+r.length+u.length+h.length===0,v=[{label:n.title,header:!0,onClick:()=>{}}];return g&&n.pinnedLine&&v.push({label:n.pinnedLine,header:!0,onClick:()=>{}}),f.forEach((e,o)=>{(o>0||g&&n.pinnedLine)&&v.push({label:"—",onClick:()=>{}}),v.push(...e)}),v}export{d as createNodeClipboard,f as nodeMenuItems};
|
package/dist/chunk-UAS2LEW2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-I2BCNLLV.js";import{useEasel as t,useEaselApi as n}from"./chunk-UZXGXMNO.js";import{newNodeId as o,ROOT_ZONE as r}from"./chunk-PLVEGYK6.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=t(e=>e),d=n(),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,t=(t,n,r)=>{const s=o(n);return c||e({type:"insert",componentType:n,destinationZone:t,destinationIndex:r,id:s}),s},n=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,o,r)=>n(t(e,o,r));return{insertComponent:i,insertSection:(e,t)=>i(r,e,t),replaceComponent:s,seedChild:(e,o,r,i)=>{const p=t(e,r,o);s(e,o,{type:r,props:{id:p,...i}}),n(p)},insertNode:(e,o,r)=>{const i=t(e,r.type,o);return s(e,o,{type:r.type,props:{...r.props,id:i}}),n(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
package/dist/chunk-Z2V3TTAR.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as o}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as s,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as u,elementScale as h,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as x,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as D,solidSurfaceStyle as T,Input as z}from"efficient-shell/ui";import{AddIcon as M,CloseIcon as $,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as E,jsx as S}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return E("div",{className:o,style:n,"data-index":r,children:[
|
|
3
|
-
/* @__PURE__ */S("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */S("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */S(A,{content:e,children:/* @__PURE__ */S(D,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */S(M,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,B=e=>e.width*e.height;function K(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>B(t.s.box)-B(e.s.box)||e.at-t.at).map(({s:e})=>e)}function O(e,t,n){return K(e,t,n).at(-1)??null}function X(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function q(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function I(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>L(e.box,t,n)).sort((e,t)=>B(e.box)-B(t.box));for(const e of o){const o=X(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:q(e,o)};if(!r(s))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let a=0;a<=l.length;a++){const u=l[a-1],h=l[a];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+s)/2:(o+i(h))/2,t=Math.min(Math.max(e,o+n),s-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>r?e.top:e.left)),x=Math.max(...m.map(e=>r?e.top+e.height:e.left+e.width)),b=r?{left:f,top:g,width:p,height:x-g}:{left:g,top:f,width:x-g,height:p};d.push({key:`${e.key}:+${a}`,place:{...e.list,index:a},box:b,axis:e.axis,label:t})}return d}function Y(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var H={nodes:[],zones:[]},R="data-puck-dropzone",Z="data-puck-component";function F(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Q(e,t){const{frame:n,document:l}=e,a=e=>f(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${R}]`)){const t=e.getAttribute(R)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${R}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:F(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var V="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(o){const{canvas:f,session:m,readOnly:k,words:D=e.canvas}=o,z=g(o);x(()=>{z.current=o});const M=g(null),$=s(f),[C,L]=b(0),B=y(()=>L(e=>e+1),[]),[O,X]=b(H);x(()=>{const e=M.current;f&&e&&X((z.current.measure??Q)(f,e))},[f,$,o.revision,C]);const q=o.model,P=v(()=>q(O),[q,O]),Y=w(m.subscribe,m.shown,m.shown),R=o.choose,Z=(e,t)=>{const n=K(P.sources,e,t);return 0===n.length?null:R?R(n):n[n.length-1]},[F,J]=b(null),[U,_]=b(null),[ee,te]=b(null),ne=g(null),le=()=>{ne.current&&clearTimeout(ne.current),ne.current=null},ae=()=>{le(),ne.current=setTimeout(()=>{m.get()||J(null)},140)};x(()=>le,[]);const re=g(null),oe=i(f),se=g(!1);se.current=oe,x(()=>{oe&&(le(),J(null))},[oe]);const[ie,ce]=b(null);c(f,d,e=>ce(e.detail?.id??null));const de=!ie||oe||k||Y?null:O.nodes.find(e=>e.id===ie)?.box??null;c(f,"mousemove",e=>{const t=M.current;if(!f||!t)return;const n=u(f.frame,e.clientX,e.clientY,t),l=h(t),a={x:n.x/l,y:n.y/l};if(re.current=a,z.current.readOnly||m.get()||se.current)return;le();const r=Z(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),c(f,"mouseout",e=>{e.relatedTarget||(re.current=null,ae())}),c(f,"mouseover",e=>{e.relatedTarget||B()});const ue=g(null),he=y(()=>{ue.current?.(),ue.current=null,_(null),te(null)},[]);x(()=>m.subscribe(()=>{m.get()?B():he()}),[m,he,B]),x(()=>he,[he]),("undefined"==typeof document?x:N)(()=>{if(m.get())return;const e=re.current;J(t=>k||se.current?null:e?Z(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Y,m,k,R]);const fe=e=>{const t=m.get(),n=M.current,l=z.current.dropOn;if(!t||!n||!l)return null;const a=p(n,e.clientX,e.clientY);re.current=a;const r=K(P.sources,a.x,a.y);for(let e=r.length-1;e>=0;e-=1)if(l.accepts(t.item,r[e]))return{h:t,source:r[e]};return null},pe=e=>{const t=m.get(),n=M.current;if(!t||!n)return null;const l=p(n,e.clientX,e.clientY);re.current=l;const a=I(P.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},me={onDragEnter:e=>{if(ue.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,o=[];t&&o.push(a(t)),r&&f&&o.push(a(r,f.frame)),ue.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=fe(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),_(null),void te(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);te(null);const l=pe(e);if(!l)return void _(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const a={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};_(e=>e&&e.zoneKey===a.zoneKey&&e.line.left===a.line.left&&e.line.top===a.line.top?e:a)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(re.current=null,_(null),te(null))},onDrop:e=>{const t=fe(e);if(t)return e.preventDefault(),m.end(),he(),void z.current.dropOn.onDrop(t.h.item,t.source);const n=pe(e);n&&(e.preventDefault(),m.end(),he(),z.current.onDrop(n.h.item,n.t.to))}},ge={draggable:!k&&!!F,onMouseEnter:le,onMouseLeave:()=>!m.get()&&ae(),onDragStart:e=>{if(F&&!k){m.start({key:F.key,item:F.item,from:F.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",F.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),he()},onClick:()=>{F&&!k&&z.current.onPick?.(F.item)}},{seams:xe=[]}=P,be=P.zones.filter(e=>0===e.children.length),ye=!o.onZoneAdd||k||oe?[]:be,ve=ye.map(e=>e.key).join("\n");return x(()=>{const e=f?.document;if(!e)return;const t=new Set(ve?ve.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(V,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${V}]`))t.removeAttribute(V)}},[f,ve,O,$,C]),/* @__PURE__ */E("div",{ref:M,className:"es-canvas-layer",children:[Y||!o.onSeamAdd||k||oe?null:xe.map(e=>
|
|
5
|
-
/* @__PURE__ */S(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??o.seamLabel??D.addSection,onInsert:()=>o.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ye.length?ye.map(e=>/* @__PURE__ */S("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",U?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:W(e.box),onClick:()=>o.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */S("span",{className:"es-canvas-empty-add",children:D.addButton({label:e.addLabel??o.zoneAddLabel??D.addBlock})})},e.key)):null,Y?/* @__PURE__ */S("div",{className:"es-canvas-catch",...me}):null,ee&&Y?/* @__PURE__ */S("div",{className:"es-canvas-target",style:W(ee.box),children:o.dropOn?.label?/* @__PURE__ */S("span",{className:"es-canvas-target-label",style:T(),children:o.dropOn.label(Y.item,ee)}):null}):null,U&&!be.some(e=>e.key===U.zoneKey)?/* @__PURE__ */S("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,de?/* @__PURE__ */S("span",{className:"es-canvas-hint"+(de.width<200?" is-below":""),style:{...T(),left:de.left+de.width,top:de.width<200?de.top+de.height:de.top},children:D.typeHint}):null,
|
|
6
|
-
/* @__PURE__ */S("div",{className:"es-canvas-handle-spot",style:F?{"--es-handle-x":`${F.box.left+2}px`,"--es-handle-y":`${Math.max(F.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */S(A,{className:"es-canvas-handle-tip",side:"top",content:!F||k||Y?null:F.title??D.handle({label:F.label}),children:/* @__PURE__ */E("div",{className:["es-canvas-handle",F&&!k?"is-shown":"",Y?"is-dragging":""].filter(Boolean).join(" "),...ge,children:[
|
|
7
|
-
/* @__PURE__ */S("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),F?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:s,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=b(""),g=k(),x=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return E("div",{className:"es-add",children:[s?/* @__PURE__ */E("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */S("span",{children:s.label}),o(u.stop,/* @__PURE__ */S("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:s.onClear,children:/* @__PURE__ */S($,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
-
/* @__PURE__ */S("p",{className:"es-add-hint",children:h}),
|
|
11
|
-
/* @__PURE__ */S("div",{className:"es-add-find",children:/* @__PURE__ */S(z,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */S(C,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */S(D,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */S($,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */E("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */S("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
-
/* @__PURE__ */S("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):v.map(e=>/* @__PURE__ */E("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
-
/* @__PURE__ */E("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */S("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
-
/* @__PURE__ */S("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
-
/* @__PURE__ */S("div",{className:_(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return o(l,/* @__PURE__ */E("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */S("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */S("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
-
/* @__PURE__ */E("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */S("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,H as EMPTY_MEASURE,J as HANDLE_GRACE_MS,I as canvasTarget,L as contains,X as gapInZone,q as gapLine,P as insertSeams,Q as measureCanvas,O as pickSource,Y as seamsBetween,K as sourcesAt};
|
package/dist/chunk-ZFFWO2AF.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{useTreeDrag as a,gapToMoveIndex as r}from"./chunk-67GNT6PF.js";import{easelMenuEntries as o}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as i,SettingsGroup as s}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{withTip as d}from"./chunk-P2VEMZH5.js";import{FieldNumber as u}from"./chunk-2XMHLXMA.js";import{FieldSelect as m}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{SettingsField as p,SettingsSegmented as f}from"./chunk-36LVP5WD.js";import{useWords as b}from"./chunk-MFIRYGHW.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 D,useId as $}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 M,DuplicateIcon as R,TrashIcon as A}from"efficient-shell/icons/efficient";function E({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 T(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function W(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 z(e,n){return e.filter((e,t)=>t!==n)}function H(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:i,items:s,onChange:c,newItem:u,summary:m,itemName:p,thumb:f,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:$,renderRow:E,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:Y=!0,canDuplicate:J,above:Z,head:q=!0}){const Q=b("fields",h).list,U=b("tree",l),_=i??Q.item,ee=!w&&!X&&("number"!=typeof v||s.length<v),ne=s.length<=g,te=e=>!!K&&!K(s[e],e),le=e=>!w&&!X&&Y&&!ne&&!te(e),ae=e=>ee&&(!J||J(s[e],e)),re=(e,n)=>p?p(e,n):Q.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");D(()=>{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>=s.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}}c(W(s,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(Q.moved({n:n+1,total:s.length}))},be=e=>{ee&&(c(T(s,e,u())),E?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(c(z(s,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=a({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=r({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<s.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<s.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(c(T(s,e+1,H(s[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */S(A,{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=s.slice();t[e]=n,c(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:s.length})]}):null,Z?/* @__PURE__ */S("div",{className:"es-list-above",children:Z}):null,s.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[s.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!E&&C===n,o=!w&&!X&&Y&&te(n),i=["es-list-row",E?"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:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Q.addHere({noun:_})},`seam-${n}`):null,
|
|
5
|
-
/* @__PURE__ */S(k,{className:i,flat:!!E,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||X||!Y?void 0:o?d(V?V(e,n):Q.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Q.locked,children:/* @__PURE__ */S(L,{size:13})})):d(Q.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:$(e,n,xe(n))}):void 0,children:E?/* @__PURE__ */S("div",{className:"es-list-row-main",children:E(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[f?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:f(e,n)}):null,
|
|
6
|
-
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",m?{className:"es-list-row-summary",children:m(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:{...G,index:s.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(s.length),children:Q.add({noun:_})}),
|
|
9
|
-
/* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<s.length?
|
|
10
|
-
/* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:o(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
-
return S(s,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(Z,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function J({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(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>H({...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(Z,{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 Z(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({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(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(E,{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(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(u,{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(p,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return S(p,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(f,{ariaLabel:X(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(Y,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return S(J,{...e,field:n});case"slot":return null}}var q=e=>i.includes(e);function Q(n,t){let l,a=i[0];const r=[],o=/* @__PURE__ */new Set;for(const[i,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:i,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(r.push(l?{name:i,field:s,bucket:a,fold:l}:{name:i,field:s,bucket:a}),"slot"!==s.type&&o.add(a)));return{rows:r,buckets:i.filter(e=>o.has(e))}}function U(e){return new Map(Q(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:o,onTab:i,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:f,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=b("panel",c),D=$(),P=h??`es-insp${D.replace(/:/g,"")}`,L=Q(e,{values:n,context:r}),[F,M]=j(void 0),R=o??F,A=R&&L.buckets.includes(R)?R:L.buckets[0],[E,T]=j(null),W=E&&E.panel===P&&L.rows.some(e=>e.name===E.name)?E:null,z=d&&L.buckets.length>1,H=z&&A?w(P,A):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(s,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(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},Y=e=>z&&e!==A,J=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!Y(i)||void 0,children:/* @__PURE__ */S(Z,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:W&&W.name===e?W.index:null,onOpenItem:n=>T(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
|
|
19
|
-
return I("div",{className:"es-insp",children:[z?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":p??O.settings,idPrefix:P,value:A,onChange:e=>{const n=e;void 0===o&&M(n),i?.(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:H,role:z?"tabpanel":void 0,"aria-labelledby":z&&A?N(P,A):void 0,children:[f?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,f)}):f:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(J);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:!(!Y(t)&&!l)||void 0,children:X(e.fold,e.rows.map(J))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{E as FieldText,ee as Inspector,Z as InspectorField,K as ListField,U as bucketsOf,H as copyItem,T as insertAt,X as labelOf,W as moveTo,Q as planFields,z as removeAt};
|