efficient-easel 6.2.0 → 6.4.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/canvas/index.d.ts +14 -2
- package/dist/canvas/index.js +1 -1
- package/dist/canvas-typing-Dec_zyuM.d.ts +49 -0
- package/dist/{chunk-QBW3RJG5.js → chunk-3PPA5S2J.js} +1 -1
- package/dist/{chunk-EYRQ4XGN.js → chunk-6EKKPFVG.js} +1 -1
- package/dist/chunk-6XXW6ZW3.js +5 -0
- package/dist/{chunk-CRWFB7MU.js → chunk-7XHDCQVL.js} +16 -16
- package/dist/chunk-AWJUYMX7.js +1 -0
- package/dist/chunk-AYNU4FYF.js +14 -0
- package/dist/chunk-DSUMM2WF.js +10 -0
- package/dist/{chunk-3I6DVDUR.js → chunk-F4XCIEXI.js} +1 -1
- package/dist/chunk-ISBKAONU.js +1 -0
- package/dist/chunk-JIWPANGM.js +1 -0
- package/dist/{chunk-ZTG2K3NL.js → chunk-LWQQQ72E.js} +3 -3
- package/dist/chunk-NL4OU4UU.js +1 -0
- package/dist/{chunk-FXJBKKGI.js → chunk-NTMY5EXS.js} +1 -1
- package/dist/{chunk-RKXIB5BN.js → chunk-QPQXKKSC.js} +1 -1
- package/dist/chunk-TAF5AECR.js +65 -0
- package/dist/{chunk-G3D2HWEO.js → chunk-VFI3ONLN.js} +1 -1
- package/dist/chunk-YB4QPUEZ.js +5 -0
- package/dist/copy/index.d.ts +2 -47
- package/dist/copy/index.js +18 -18
- package/dist/drag/index.js +1 -1
- package/dist/easel/easel.css +17 -0
- package/dist/easel/index.d.ts +47 -2
- package/dist/easel/index.js +1 -1
- 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 +15 -15
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.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/text-styles/index.js +16 -16
- package/package.json +1 -1
- package/dist/chunk-2DHJC5YS.js +0 -5
- package/dist/chunk-4XIIBGDO.js +0 -9
- package/dist/chunk-7EKLESDL.js +0 -65
- package/dist/chunk-MHU7S7JL.js +0 -1
- package/dist/chunk-MOCX5MQ7.js +0 -14
- package/dist/chunk-MTRFMGBO.js +0 -1
- package/dist/chunk-PAELDYYS.js +0 -1
- package/dist/chunk-YFK74XOM.js +0 -5
- package/dist/chunk-ZNCEOSXO.js +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-QPQXKKSC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-NL4OU4UU.js";import{useSectionOps as w}from"./chunk-6EKKPFVG.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-ISBKAONU.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as O}from"./chunk-YB4QPUEZ.js";import{SidePanelHead as I,PanelShowStrip as $}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as P}from"./chunk-F4XCIEXI.js";import{useScreenSaveSwitch as T,useScreenNodeKeys as A,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as R,useScreenInspectorPanel as E,useScreenDevices as L,useScreenPickFollowsSelection as F,useScreenLeftView as V,useScreenAdd as U,SELECTION_MODE as W,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as G,useScreenBlockLook as X,useScreenStorageNamespace as Y,useScreenNotify as J,useScreenCanvasHead as K,isSlotMode as Q,useScreenStyleClipboard as _,useScreenDocumentPass as q,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe}from"./chunk-6XXW6ZW3.js";import{ROOT_ZONE as re,blockNodeActions as ie,TREE_MAX_DEPTH as le,childSlotsOf as se,slotFieldsOf as de,slotChildrenIn as ae,nestsInTree as ce,newNodeId as pe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ue,usePanelPick as fe,useCancelPanelPick as he}from"./chunk-R6WTQWAC.js";import{useEaselHost as me,useHostEscape as ge}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-MCHMF32I.js";import{heldStyle as ke,styleShortcut as Se}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ve}from"./chunk-6WY6ZXJG.js";import{useEasel as we,useEaselApi as xe}from"./chunk-DSUMM2WF.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Ne,TreeSeam as Oe}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ie}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Ae}from"./chunk-UK2FQOUT.js";import{LayersIcon as Me,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Ee}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Le,TopBarRail as Fe,TopBarCluster as Ve,EaselIconButton as Ue,TopBarDivider as We,DeviceSwitch as De,InspectorIconButton as He,PanelResizeHandle as Ge,MAX_PANEL_W as Xe,MIN_PANEL_W as Ye,panelWidthVars as Je,SaveState as Ke,SaveStateToggle as Qe}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-AWJUYMX7.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as Nn,EyeOffIcon as On,EyeIcon as In,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as An}from"react/jsx-runtime";function Mn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ke,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return Pn(Ke,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Ee(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
|
|
3
|
+
return Tn(An,o?{children:[
|
|
4
|
+
/* @__PURE__ */Pn(Qe,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ke,{tone:d,label:a})}),c]}:{children:[
|
|
5
|
+
/* @__PURE__ */Pn(Ke,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn(An,e?{children:[
|
|
7
|
+
/* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function En(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var Ln="__rungs";var Fn="screen:band",Vn={duplicate:!0,delete:!0};function Un(){const Ee=me(),{target:Ke,docId:Qe,capabilities:ln,currentSlug:Un,siteId:Wn,onPublish:Dn,saveState:Hn,saveConflict:Gn,retrySave:Xn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Kn=null}=B(),Qn=T(),_n=A(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=M(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>ne(st,e),gt=e=>te(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ye),vt=qe("tree",Ie),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",ve),Bt=qe("chrome",_e),Ct=j()??`/${Un}`,Nt=R(),Ot=E(),It=w({readOnly:Jn}),$t=w({readOnly:Jn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),At=gn(()=>({...It,select:e=>{Pt.current=e,It.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}It.commitDocument(e,n)}}),[It,Tt]),Mt=nt.ui,jt=Mt.leftSideBarVisible,Rt=Mt.rightSideBarVisible,{options:Et,widths:Lt,initial:Ft,fluid:Vt,fit:Ut}=L(),[Wt,Dt]=yn(Ft),Ht=ue(),Gt=qn&&null!==Ht,Xt=fe(),Yt=he();F(rt?.props.id);const{read:Jt,write:Kt,forSelection:Qt}=V(),[_t,qt]=yn(Jt);kn(()=>{Kt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=U(),fo=e=>po(null===e?null:{zone:re,index:e}),[ho,mo]=yn([]),[go,yo]=yn(W),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===re?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const No=Sn((e,{scroll:n})=>{qt(n=>Qt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Oo=mn(null);kn(()=>{const e=Oo.current;Oo.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??W);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);No(String(t),{scroll:!r(o,i??null,re)})},[rt?.props.id,No]);const Io=Sn(e=>{yo(n=>D(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Jr(e.zone??re)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>D(e,n)?e:n),o!==r&&(Oo.current={id:o,mode:n},At.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:Io,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Ao=H(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Jn),select:e=>{yo(W),At.select({index:e})},replace:(e,n)=>At.replaceComponent(re,e,n),scrollTo:e=>Si(e)},{device:Wt,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Mo=Ao.pinnedSource??!1,jo=Ao.resolveLeftView?Ao.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=G(),{isLockedBlock:Eo,duplicateBlocked:Lo,nestDepth:Fo,newSectionNode:Vo,canAddTo:Uo,blockIsOffered:Wo}=Ro,Do=X(),{labelAtLevel:Ho,Icon:Go,useProducts:Xo}=Do,Yo=Do.rowName?(e,n,t)=>Do.rowName(e,n,t):void 0,Jo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),No(e,{scroll:!0})},[tt,No]),{selectNode:Ko,openPartId:Qo}=v({mode:go,setMode:yo,onOpenPart:Jo}),[_o,qo]=yn(null);ge(null!==_o,()=>qo(null));const Zo=y(Y()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Oi()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ge(io,()=>Oi()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Xt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Xt]),kn(()=>{!jt&&Xt&&(ao.current=!1,Yt())},[jt]),kn(()=>{if(!Xt||!ro)return;const e=e=>{"Escape"===e.key&&Yt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Xt,ro]),ge(null!==Xt,()=>Yt());const fr=J(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=K(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Wt===Vt?gr>0?gr:Lt[Vt]:Lt[Wt],zr=gr>0?Math.min(gr/br,"shrink"===Ut?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Nr={width:Br,height:kr||"100%",flex:"none",position:"relative"},Or={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Ir=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Xt&&(ao.current=!1,Yt(),jt&&_t===e)||(jt&&_t===e?Ir():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Ee,{accept:"image/*",title:Bt.mediaLibrary})},Ar=()=>{yo(W),At.select(null),u()},Mr=()=>{yo(ht??W),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Er=lt,Lr=Ro.stripCopy,Fr=e=>i(e,Lr),Vr=x(),Ur=Te({data:nt.data,config:Er,readOnly:Boolean(Jn),clipboard:Vr,strip:Lr?e=>Lr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(W);const t=void 0===n||"node"===n?.kind?n:null;At.commitDocument(e,t)}}),Wr=e=>Ho(e,"block",lt.components[e]?.label??e),Dr=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Hr=e=>Ho(e,"section",Wr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Hr(e.type),Yo),{nodeAddresses:Xr,zoneItems:Yr}=gn(()=>{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>=le)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of se(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,re,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Jr=Sn(e=>Yr.get(e)??[],[Yr]),Kr=e=>{const n=Xr.get(e);return n?Jr(n.zone)[n.index]:void 0},Qr=e=>oe(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===re)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Kr(e.slice(0,n));if(!t)return null;const o=Qr(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}},qr=(()=>{if(!Q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!Q(go))return;const n=go.nodeId;No(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Xr.get(e);n&&(n.zone===re?vi(n.index):Qi(n.zone,n.index,e,Kr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(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;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Jn||!Ro.moveSlot)return;const o=Kr(e),r=o?Qr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ln,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Xo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Wr,Do.plainText,e=>ri.get(e),Do.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===re||hl(n)?"section":"block",r=n===re&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Do.renamePropOf?Do.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Jn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=li(o,e);r&&At.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.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)},di=n(_(),zt),ai=di.scope({target:Ke,siteId:Wn,docId:Qe}),ci=lt,pi=(e,n)=>n===re?Hr(e):Wr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&At.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===re?Hr(e):Wr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{At.select(null),Ci(null)},openPageSettings:()=>{At.select(null),yo(W)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Jn),collapseAll:()=>or(new Set(Jr(re).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Ao.menuRows,isLocked:e=>Eo(e.type),duplicateBlocked:e=>Lo(nt.data,e),permits:e=>ie(lt,e.type),canAddTo:Uo,nodeOps:Ur,isPinned:(e,n)=>n===re&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===re?vi(n):At.select({zone:e,index:n}),Ci(null)},locate:e=>Xr.get(e)??null,rowNameOf:(e,n)=>n===re?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===re?vi(n):Qi(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>ke(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??re,index:e.index}:null},held:()=>Vr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??re,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const mi=Sn(e=>{const n=Se(e);if(!n)return;const t=hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=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=En(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(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()}},[oo,gi,Wt,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Ao.holdCanvasOn?Ao.holdCanvasOn(e):c(e)},vi=e=>{yo(W),At.select({index:e}),Ao.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(At.reorderComponent(re,e,i),At.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(W),At.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Vo(e,{nodeDefaults:Dr,newNodeId:pe,sectionLabel:Hr,blockIsOffered:Wo}),r=o?At.insertNode(re,t,o):At.insertSection(e,t);return bi(t,r,Hr(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 se(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Uo(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},Bi=(e,n,t)=>{const o=wi(t),r=At.insertNode(re,o,n);return bi(o,r,e),o},Ci=e=>Ni(re,e),Ni=(e,n)=>{ur.current=document.activeElement??null,Xt&&(so.current=ao.current,ao.current=!1,Yt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Oi=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ii=(e,n,t)=>{if("section"===e.kind)At.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;At.insertNode(n,t,Fr(e.template.node))}yo(W),At.select({index:t,zone:n})},$i=(e,n)=>Do.rowName?n?mt(e)?Do.rowName(e,"section",St.header):gt(e)?Do.rowName(e,"section",St.footer):pt(e.type)?Do.rowName(e,"section",Wr(e.type)):Gr(e):ii(e):n?Hr(e.type):Wr(e.type),Pi=e=>n=>{e()},Ti=()=>Ao.editPinnedSource?.(),Ai=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!ie(lt,o.type).delete?null:/* @__PURE__ */Pn(Ne,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Ur.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(Nn,{size:15})})},Mi=e=>Do.rowPreview?.(e)||void 0,ji=e=>Do.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Do.rowActions?.(e,n,t)??null,Ei=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return Pn(Ne,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Fi(e,n,t),children:/* @__PURE__ */Pn(r?On:In,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Li=e=>{const n=Hr(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return Ll(re,e,()=>Ci(e),t)},Fi=(e,n,t)=>{At.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Vi=e=>de(lt,e),Ui=e=>se(lt,e),Wi=e=>Ro.slotsOf?Qr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ae(e,n.slot)})):[{slot:null,rung:null,kids:Ui(e)}],Di=e=>Ro.slotsOf?Wi(e).flatMap(e=>e.kids):Ui(e),Hi=e=>Boolean(Ro.slotsOf)&&Qr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Uo(e):Uo(e,n):Uo(e,n,t),Xi=(e,n,t)=>{const o=ce(lt,e.type,n)&&(t||Di(e).length>0||Hi(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Yi=(e,n,t)=>Wi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Xi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Di(e).length>0||Hi(e)||Boolean(Uo(e.type)),Ki=e=>Boolean(Uo(e)),Qi=(e,n,t,o)=>{if(yo(W),Uo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),At.select({index:n,zone:e}),c(t)}else At.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;At.insertComponent(i,t,o),Uo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),At.select({index:o,zone:i})}):At.select({index:o,zone:i})},qi=(e,n,t)=>{At.insertComponent(e,n,t),yo(W),At.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Uo(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.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(Dr)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Dr]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Vi(n.type));el.current.add(o),r&&$t.replaceComponent(re,t,{...n,props:r})})},[jr,$t]),q($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Ji(e)&&dl.push(String(e.props.id)),dl.push(...Yi(e,1,Ki)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Yi(tl,1,Ki)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Do.blockRowName(e,Wr);return Do.rowName?Do.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Ur.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ui(e))n.add(r),t(o)};for(const t of Vi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xr.get(n);if(!e)return null;if(e.zone===re)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Kr(e.rung.nodeId),o=t?Qr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ln&&n.index>=0&&n.index<=o}if(n.slot===Ln)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===re||o===re){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Xr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Uo(s.type,Fo(nt?.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?.(Jr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Xr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Uo(o.type,Fo(nt?.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:Wr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===re)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==re)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===re)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ii(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Fr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===re?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Jn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===re?((e,n)=>{const t=Hr(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.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)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Eo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===re||l;e===re&&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?Hr(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===re&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.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(bl);return i||(r(Ae(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(W),At.select(e.zone===re?{index:e.index}:{index:e.index,zone:e.zone})},Cl=Z(),Nl=()=>({data:nt.data,device:Wt,ops:At,inspector:To}),Ol=Cl?.model,Il=gn(()=>Ol?e=>Ol(e,xl(e),Nl()):xl,[Ol,xl,Wt]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Nl()):void 0,Tl=Cl?.canDrop,Al=Tl?(e,n)=>Tl(e,n,ml,Nl()):ml,Ml=Cl?.drop,jl=Ml?(e,n)=>Ml(e,n,Sl,Nl()):Sl,Rl=Cl?.pick,El=Rl?e=>Rl(e,Bl,Nl()):Bl,Ll=(e,n,t,o)=>/* @__PURE__ */Pn(Oe,{...Jn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),Fl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Vl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Jr(o),i=ar(n),l=Wr(e.type),s=Do.rowName?Do.rowName(e,"section",l):l,d=e=>Ll(o,e,()=>Ni(o,e),St.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return Tn(An,{children:[
|
|
16
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Mi(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(re,t,n,s),selected:bo===n,actions:Ri(e,re,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Ji(n),s=l&&ar(r),a=()=>Qi(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
|
|
17
|
+
return Tn(wn,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Mi(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(o,t,i),Ri(n,o,t),Ei(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Dl(n,2)})]},r)}),d(r.length)]})]})},Ul=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${Ln}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ln,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return Tn(wn,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(An,{children:h.map((t,o)=>/* @__PURE__ */Pn(Ne,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Pn(Nn,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Wl=(e,n)=>{const t=Wi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
+
return Pn(An,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(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=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?Ll(e,n,()=>Ni(e,n),St.addBlockHere):Ll(e,n),u=/* @__PURE__ */Tn(An,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Xi(n,l,Ki(n.type)),d=String(n.props.id),a=cl(n),c=()=>Qi(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
|
|
22
|
+
return Tn(wn,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Mi(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(t,o,a),Ri(n,t,o),Ei(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Wl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Ul(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Dl=(e,n)=>{const t=Fo(nt?.data,e.type,String(e.props.id)),o=Wi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
+
return Pn(An,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(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=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Ni(n,t):void 0;return Ll(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(An,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Xi(n,s,Ki(n.type)),c=Vi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Jr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Qi(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Eo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
|
|
25
|
+
return Tn(wn,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Mi(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Eo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(An,{children:[Ai(t,o,i),Ri(n,t,o),Ei(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Dl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
27
|
+
/* @__PURE__ */Pn(N,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(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?Ul(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Hl=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Uo(e,Fo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Wr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==re&&!hl(wo.zone)?wo.zone:null,Xl=!0===uo.blocksFirst,Yl=Gl?yl(Gl):Xl&&wo?null:Hl,Jl=Boolean(co&&Gl)||Xl&&Boolean(Yl&&Yl.choices.length>0),Kl=io||null!==Xt,Ql=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Kl&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Oi():Ci(null)},...(Ao.railLead??[]).map(Ql),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Me,{}),active:jt&&!Kl&&"sections"===jo,onSelect:()=>Pr("sections")},...(Ao.railTrail??[]).map(Ql)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Xt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Ao.railLead??[],...Ao.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Mo,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Fn),ts=/* @__PURE__ */Tn(An,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Ui(e);const r=String(e.props.id),i=Ao.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&ar(r),d=Vi(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...un(a),index:Jr(a).length}:void 0,p=wl.dragging,u=c&&p&&ml(p,c)?c:void 0,{rowProps:f,...h}=wl.row({item:{id:r,zone:re,index:n,type:e.type},place:{...un(re),index:n},into:u},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
|
|
28
|
+
return Tn(wn,{children:[n>0&&Li(n),
|
|
29
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Mi(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(re,n,r,Gr(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(re,n,Gr(e)),Ri(e,re,n),Ei(re,n,e,Gr(e))]}),rowProps:f}),Ji(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Dl(e,1),Ao.partRows?.(e,Fl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Ao.ownRows?.(e,n,Fl)})]},String(e.props.id??n))}),!Mo&&sl>0&&Li(sl),kt?.addAtEnd&&!Mo&&!Jn&&/* @__PURE__ */Pn(N,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Di(e).length>0||Hi(e)||Boolean(Uo(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Do.rowName?Do.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return Tn(An,{children:[
|
|
31
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Mi(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(re,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,re,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Wl(e,1)})]})};return(Ao.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */Pn(ee,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Je(rr),onContextMenu:fi.onEditorContextMenu,...m(Ee),children:[
|
|
33
|
+
/* @__PURE__ */Tn(Le,{children:[
|
|
34
|
+
/* @__PURE__ */Pn(Fe,{items:_l,ariaLabel:St.bar.views}),
|
|
35
|
+
/* @__PURE__ */Tn(Ve,{children:[
|
|
36
|
+
/* @__PURE__ */Pn(Ue,{label:St.bar.undo,disabled:Boolean(Jn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
|
|
37
|
+
/* @__PURE__ */Pn(Ue,{label:St.bar.redo,disabled:Boolean(Jn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
|
|
38
|
+
/* @__PURE__ */Pn(We,{}),
|
|
39
|
+
/* @__PURE__ */Pn(De,{devices:Et,value:Wt,onChange:Dt})]}),
|
|
40
|
+
/* @__PURE__ */Tn(Ve,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */Pn(Mn,{saveState:Hn,notSaving:Boolean(Jn)||null!=Gn,readOnlyReason:Kn,toggle:Qn,onToggle:Yn,onRetry:Xn,words:St.bar,saveWords:xt}),Ao.barLead?.(),
|
|
42
|
+
/* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[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=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Ao.barTrail?.(),Ao.barMain?Ao.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Kn,onClick:()=>{Dn(nt.data)},children:St.done})]})]}),
|
|
43
|
+
/* @__PURE__ */Pn(z,{}),
|
|
44
|
+
/* @__PURE__ */Tn("div",{className:"sf-body",children:[jt?/* @__PURE__ */Tn(An,{children:[
|
|
45
|
+
/* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn(O,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Do.rowName?$i(n,!0):Wr(n.type)});if(e.zone===re){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Fr(e.template.node));if(n&&n.zone!==re){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Hl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:vl,siteWide:Ao.addPanelRow?.(Oi),onClose:Oi,onHide:Ir,readOnly:Boolean(Jn)}):Xt&&Ht?
|
|
46
|
+
/* @__PURE__ */Pn(P,{panel:Ht,pick:Xt,onHide:Ir}):ql?ql.panel({onHide:Ir,notify:hr}):"media"===jo&&Ht?/* @__PURE__ */Pn(P,{panel:Ht,pick:null,onHide:Ir}):/* @__PURE__ */Tn(An,{children:[
|
|
47
|
+
/* @__PURE__ */Pn(I,{icon:/* @__PURE__ */Pn(Me,{}),title:St.layers,context:Ct,actions:
|
|
48
|
+
/* @__PURE__ */Pn(He,{label:al?St.expandAll:St.collapseAll,title:0===dl.length?St.nothingToFold:void 0,disabled:0===dl.length,onClick:()=>or(e=>{const n=new Set(dl);return al?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...dl])}),children:/* @__PURE__ */Pn(jn,{expand:al})}),onHide:Ir}),
|
|
49
|
+
/* @__PURE__ */Tn(Be,{className:"sf-tree sf-scroll",words:vt,children:[
|
|
50
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"page",size:13}),name:St.pageSettings,onSelect:Ar,selected:!rt&&ko,rowProps:{onClick:Pi(Ar)}}),il&&/* @__PURE__ */Tn(An,{children:[
|
|
51
|
+
/* @__PURE__ */Pn(Ce,{children:St.header}),Vl(il)]}),!Mo&&et&&/* @__PURE__ */Tn(An,{children:[
|
|
52
|
+
/* @__PURE__ */Pn(Ce,{children:St.header}),!yt&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"header",size:13}),name:St.header,onSelect:Mr,selected:go.kind===ht?.kind,rowProps:{onClick:Pi(Mr)}})]}),!Mo&&rl&&os(rl,ol,"header"),!Mo&&!Zl&&/* @__PURE__ */Pn(Ce,{children:es}),Zl?/* @__PURE__ */Tn(An,{children:[
|
|
53
|
+
/* @__PURE__ */Pn(be,{words:vt,icon:null,name:es,fold:{open:!ns,label:es,onToggle:()=>cr(Fn)}}),!ns&&/* @__PURE__ */Pn(ze,{children:ts})]}):ts,et&&/* @__PURE__ */Pn(Ce,{children:St.footer}),tl&&os(tl,nl,"footer"),!Mo&&!tl&&et&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"footer",size:13}),name:St.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:St.editFooter}}),ll&&Vl(ll),Ao.treeFoot?.()]})]})}),
|
|
54
|
+
/* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Ye,max:Xe,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn($,{side:"left",onShow:Ir}),
|
|
55
|
+
/* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Wt})}),
|
|
56
|
+
/* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Nr,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Wt===Vt?"":`sf-frame--${Wt}`),style:Or,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
|
|
57
|
+
/* @__PURE__ */Pn(Nt,{},Zt),
|
|
58
|
+
/* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Il,measure:Pl,canDrop:Al,onDrop:jl,choose:zl,onPick:El,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Ni(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Jn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,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},onClick:()=>Ci(e.index),children:[
|
|
59
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
|
|
60
|
+
/* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
|
|
61
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
62
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:St.addSection})]})]},e.index))})]})})})]}),Rt?/* @__PURE__ */Tn(An,{children:[
|
|
63
|
+
/* @__PURE__ */Pn(g,{value:{selectChild:Qi,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(Ot,{mode:go,onOpenWebsiteSettings:Ao.openSettings??(()=>{}),onOpenSiteStyles:Ao.openStyles,onSelectNode:Ko,onNotify:hr,onHidePanel:$r,nodeActions:rt?ie(lt,rt.type):Vn})}),
|
|
64
|
+
/* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Ye,max:Xe,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
|
|
65
|
+
/* @__PURE__ */Pn($,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Un as ScreenChrome};
|
|
@@ -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-6XXW6ZW3.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.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};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-6XXW6ZW3.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-DSUMM2WF.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as F,Fragment as B}from"react/jsx-runtime";var N=e=>`section:${e}`,O=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:x,at:V,onAdd:A,itemFor:H,session:L,siteWide:M,onClose:W,onHide:C,readOnly:D}){const P=f(e=>e.config),Y=p(),{labelAtLevel:w,categoryLabel:Q,firstSection:R,Icon:S,Thumbnail:T}=Y,{blockIsOffered:X}=m(),Z=u("screen",d).add,z=u("drag",h).add,U=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>X(e,U);return s(U).list().then(n=>{if(t)return;const i=P.components;G(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,U]);const J=j(()=>t(P,Y),[P]),K=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */$(T,{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)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:O(e.type),label:e.label,icon:/* @__PURE__ */$(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),x)return e;const t=o(J,R);t&&e.push({key:"start",title:Z.startBlank,tiles:[K(t)]}),E.length>0&&e.push({key:"templates",title:Z.templates,tiles:E.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */$(T,{type:e.node.type}),keywords:[(t=e.node.type,w(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,R);for(const t of Object.keys(P.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(P,t,Q),tiles:o.map(K)})}return e},[I,x,E,J,P,Z]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=E.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return F(B,{children:[
|
|
3
|
+
/* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:Z.title,context:x?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */$(c,{label:Z.done,description:Z.doneDescription,onClick:W}),onHide:C}),
|
|
4
|
+
/* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */$(k,{groups:q,session:L,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&A(t)},at:V,hint:x?Z.hintBlocks:Z.hint,searchLabel:x?Z.searchBlocks:Z.searchSections,readOnly:D,words:z}),M&&!x?M:null]})]})}export{I as AddSidePanel,O as blockKey,N as sectionKey,v as templateKey};
|
package/dist/copy/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { C as CopyWords, a as CopyAlign } from '../words-BAnsDT16.js';
|
|
|
5
5
|
export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, f as copyAlignOptions } from '../words-BAnsDT16.js';
|
|
6
6
|
import { TextToolbarCase, TextToolbarMark } from 'efficient-shell/ui';
|
|
7
7
|
export { TextToolbar, TextToolbarProps } from 'efficient-shell/ui';
|
|
8
|
+
export { C as CanvasTypingEnd, a as CanvasTypingOptions, b as CanvasTypingSession, T as TextMap, s as startCanvasTyping, t as textMap } from '../canvas-typing-Dec_zyuM.js';
|
|
8
9
|
|
|
9
10
|
type CellWords = NonNullable<CopyWords['cells']>;
|
|
10
11
|
interface CopyCell {
|
|
@@ -469,52 +470,6 @@ interface RichBoxProps {
|
|
|
469
470
|
}
|
|
470
471
|
declare function RichBox({ value, rules, multiline, readOnly, placeholder, ariaLabel, handle, onEdit, onSelect, onHistory, onFormat, pending, onCommit, onCancel, }: RichBoxProps): react.JSX.Element;
|
|
471
472
|
|
|
472
|
-
interface TextMap {
|
|
473
|
-
/** The words as drawn: text in order, a `<br>` or a new block line as `\n`. */
|
|
474
|
-
text: string;
|
|
475
|
-
/** The visible offset of a DOM point inside the root. */
|
|
476
|
-
at: (node: Node, offset: number) => number;
|
|
477
|
-
/** The DOM point of a visible offset. */
|
|
478
|
-
dom: (v: number) => [Node, number];
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Read the words a renderer drew, whatever its markup: text nodes in order;
|
|
482
|
-
* a `<br>` is a line break, and so is the start of a block-level child after
|
|
483
|
-
* some words (a line the renderer drew as its own block).
|
|
484
|
-
*/
|
|
485
|
-
declare function textMap(root: HTMLElement): TextMap;
|
|
486
|
-
/** Why typing ended. */
|
|
487
|
-
type CanvasTypingEnd = 'escape' | 'enter' | 'blur' | 'outside' | 'stop';
|
|
488
|
-
interface CanvasTypingOptions {
|
|
489
|
-
/** The element the page drew the words in. Read again after every redraw:
|
|
490
|
-
* a host that draws them afresh may hand back a new one. */
|
|
491
|
-
element: () => HTMLElement | null;
|
|
492
|
-
/** The saved string. */
|
|
493
|
-
value: string;
|
|
494
|
-
rules: readonly InlineRule[];
|
|
495
|
-
/** The field has lines: Shift+Enter makes one. */
|
|
496
|
-
multiline: boolean;
|
|
497
|
-
/** The visible selection to start with. */
|
|
498
|
-
caret: [number, number];
|
|
499
|
-
/** The host's ONE writer — the same the panel's text box writes through. */
|
|
500
|
-
write: (next: string) => void;
|
|
501
|
-
/** Typing ended; the words are what was last written. */
|
|
502
|
-
end: (why: CanvasTypingEnd) => void;
|
|
503
|
-
/** The browser wrote into the words (a composition): draw them afresh. */
|
|
504
|
-
remount?: () => void;
|
|
505
|
-
now?: () => number;
|
|
506
|
-
}
|
|
507
|
-
interface CanvasTypingSession {
|
|
508
|
-
/** The string as the session last wrote or was told. */
|
|
509
|
-
readonly value: string;
|
|
510
|
-
/** The host wrote the string from elsewhere (the panel's text box). */
|
|
511
|
-
update: (next: string) => void;
|
|
512
|
-
/** End typing. Once: a second call does nothing. */
|
|
513
|
-
stop: (why?: CanvasTypingEnd) => void;
|
|
514
|
-
}
|
|
515
|
-
/** Start typing in the words `element()` drew, or `null` where they are not the string's. */
|
|
516
|
-
declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
|
|
517
|
-
|
|
518
473
|
/** One line of the rich view. `src` is where its words start in the saved
|
|
519
474
|
* string (after a `- `), `start` where the line itself starts, `vis` where
|
|
520
475
|
* its words start in the visible text. */
|
|
@@ -693,4 +648,4 @@ interface CaretEdit {
|
|
|
693
648
|
*/
|
|
694
649
|
declare function useCaretEdit({ target, onChange }: CaretEdit): (edit: (el: HTMLInputElement | HTMLTextAreaElement | null) => WrapResult) => void;
|
|
695
650
|
|
|
696
|
-
export { COPY_CELLS, type
|
|
651
|
+
export { COPY_CELLS, type CaretEdit, ColorWindow, CopyAlign, CopyBox, type CopyBoxAlign, type CopyBoxFooter, type CopyBoxLastTool, type CopyBoxProps, type CopyCase, type CopyCell, type CopyCellPreset, CopyCells, type CopyThemeColor, CopyWords, type History, MARKUP_CLIPBOARD_TYPE, MarkBar, type MarkBarProps, type MarkWriter, type PasteData, type PasteOptions, RichBox, type RichBoxProps, type RichEdit, type RichHandle, type RichInputEvent, type RichInputResult, type RichInsert, type RichLayout, type RichLine, type RichPending, type SelectionSource, type Snapshot, TYPING_BURST_MS, type TextAreaHandle, type TextBoxHandle, type ToolbarMark, ariaShortcut, createHistory, editVisible, insertSelection, markSelection, markupOfRange, newLine, pasteToMarkup, richInput, richLayout, selectionToSource, selectionToVisible, setBullet, toSource, toSourceStart, toVisible, useCaretEdit };
|
package/dist/copy/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{DEFAULT_COPY_WORDS as e}from"../chunk-AUT242JK.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as f,findLink as p,markedAt as m,listIn as g,colorIn as b,clearStyle as y,isSafeLinkHref as v,toggleMark as k,colorOver as x,setList as w,unlinkAt as D,removeLink as S,linkOver as E,writeLink as C}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as T}from"../chunk-P2VEMZH5.js";import{Tooltip as M,ColorSwatch as L,ColorPickerPanel as B,Button as A,IconButton as R,registerModalEscapeInterceptor as P,textToolbarRows as O,TextToolbar as j,LinkPicker as z}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as F,useState as K,useLayoutEffect as W,useEffect as $,useId as H}from"react";import{AlignJustifyIcon as q,AlignRightIcon as V,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as Y,LetterSpacingIcon as Z,TextLinesIcon as G,TextSizeIcon as J,ClearMarksIcon as X,LinkIcon as Q,QuietIcon as _,EmphasisIcon as ee,StrikeIcon as te,ItalicIcon as ne,BoldIcon as re}from"efficient-shell/icons/efficient";import{jsx as le,jsxs as oe,Fragment as ae}from"react/jsx-runtime";var se=["left","center","right","justify"],ie=e.align,ce={left:/* @__PURE__ */le(U,{}),center:/* @__PURE__ */le(I,{}),right:/* @__PURE__ */le(V,{}),justify:/* @__PURE__ */le(q,{})},ue={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function de(e,t=ie){return se.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ce[e],title:t[e]}))}var he=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function fe(e){if(e.every(e=>e.label===ie[e.id]))return e.length>3?ue.four:ue.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(he.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function pe(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function me(e,t,n,r=a){const{start:l,end:o}=pe(e,n);return r(e,l,o,t)}function ge(e,t,n){const{start:r,end:l}=pe(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var be=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),ye=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function ve(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(be.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=v(e)?e:null}const f=1===e.nodeType?i.style:null;if(f){const e=f.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===f.fontStyle||"oblique"===f.fontStyle?d=!0:"normal"===f.fontStyle&&(d=!1)}const p=ye.has(c);p&&a();for(const t of[...e.childNodes])s(t,u,d,h);p&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=ke(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function ke(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var xe="application/x-efficient-markup",we=/^([0-9]{1,3})\. $/;function De(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:we.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Se(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Ee(e,t){const[n,r]=Se(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Ce(e,t){const[n,r]=Se(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Ee(e,t)}function Ne(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Te(e,t,n){return[Ne(e,t),Ne(e,n)]}function Me(e,t,n){return t===n?[Ee(e,t),Ee(e,t)]:[Ce(e,t),Ee(e,n)]}function Le(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Be(e,t,n,r,l){const o=De(e,t),[a,s,h]=Se(o,Math.min(n,r)),[f,p,m]=Se(o,Math.max(n,r)),g=Le(a,s),b=Le(f,p),y=a.chars.slice(0,g),v=f.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let x=(w=o.lines,Math.max(0,...w.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var w;const D=e=>{let n;if(void 0!==l.markup){const e=x;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...y,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...v]}}else s.chars.push(...v);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},S=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(x++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(x++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let E="",C="";for(const e of S){const n=D(e),r=i(n.lines).text;if(E=r,C=n.shown,c(n.lines,De(r,t).lines))break}return{text:E,caret:Math.min(n,r)+C.length}}function Ae(e,t,n,r){const l=De(e,t),[o,,a]=Se(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Be(e,t,n,r,{text:"\n"}):Re(e,t,a,!1,n)}function Re(e,t,n,r,l){const o=De(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function Pe(e,t,n,r){const l=De(e,t),[o,a,s]=Se(l,Math.min(n,r)),[c,u,d]=Se(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Le(o,a):0,i=r===d-s?Le(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}function Oe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function je(e){const{value:t,rules:n,multiline:r,inputType:l,pending:o}=e;let[a,s]=e.sel;e.target&&e.target[0]!==e.target[1]&&l.startsWith("delete")&&([a,s]=e.target);const i=[a,s];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:Ae(t,n,a,s),range:i}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=e.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=ve({html:e.html??void 0,text:c},{doc:e.doc,multiline:r,rules:n});return{kind:"edit",edit:Be(t,n,a,s,{markup:l}),range:i}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:Be(t,n,a,s,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:i}}if(l.startsWith("delete")){const e=De(t,n),r=e.text;if(a===s){const o=l.includes("Backward"),c=e.lines.findIndex(e=>a>=e.vis&&a<=e.vis+e.text.length),u=e.lines[c];if(o&&u&&a===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:Re(t,n,c,!1,a),range:i};if(o?0===a:a===r.length)return null;o?a=Oe(r,a,-1):s=Oe(r,s,1)}return{kind:"type",edit:Be(t,n,a,s,{text:""}),range:[a,s]}}return null}function ze(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Fe(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ke(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function We({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:f}){const p=F(null),m=F(null),g=F(null),b=F(null),y=F(null),v=F(e),[k,x]=K(0),w=F({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});w.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const D=()=>{const e=p.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Fe(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Fe(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},S=(e,t)=>{const n=p.current,r=m.current;if(!n||!r)return;const[l,o]=Ke(r,e),[a,s]=Ke(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=D(),t=m.current;if(!e||!t)return null;const[n,r]=Me(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},x(e=>e+1)},focus(){p.current?.focus()},rangeOf(e,t){const n=p.current,r=m.current;if(!n||!r)return null;const[l,o]=Te(r.layout,e,t),[a,s]=Ke(r,l),[i,c]=Ke(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},W(()=>{const n=p.current;if(!n||y.current)return;const r=b.current?null:D();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=ze(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,De(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&S(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Te(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),S(a,s)},[e,t,k]);const E=(e,t,n)=>{const r=m.current,[l,o]=Me(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==w.current.value?w.current.onEdit(e.text,{start:l,end:o},n):x(e=>e+1)};$(()=>{const e=p.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=w.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=D();if(!s||!i)return;const c="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=c&&!c.collapsed?[Fe(s,e,c.startContainer,c.startOffset),Fe(s,e,c.endContainer,c.endOffset)]:null,d=je({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:i,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?E(d.edit,d.range,d.kind):w.current.onFormat(d.style):w.current.onHistory(d.dir))},n=()=>{y.current||x(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),$(()=>{const e=p.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const C=(n,l=!1)=>{const o=D();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(xe,Pe(e,t,o[0],o[1])),l&&!r&&E(Be(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
|
|
2
|
-
return
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
return
|
|
5
|
-
return
|
|
6
|
-
return
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
return
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_COPY_WORDS as e}from"../chunk-AUT242JK.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,pasteToMarkup as o,richInput as a,editVisible as s,MARKUP_CLIPBOARD_TYPE as i,markupOfRange as c}from"../chunk-JIWPANGM.js";export{MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-JIWPANGM.js";import{FieldNumber as u}from"../chunk-66LWADFP.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as d}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as p,applyMark as f,markupTools as h,marksIn as m,STANDARD_MARKUP as g,findLink as y,markedAt as v,listIn as b,colorIn as k,spanFor as x,clearStyle as w,toggleMark as S,colorOver as E,setList as C,unlinkAt as D,removeLink as N,linkOver as L,writeLink as T}from"../chunk-546BBOPE.js";import{SettingsSegmented as M,SettingsSwitch as P}from"../chunk-QLD57GBB.js";import{useWords as R}from"../chunk-MFIRYGHW.js";import{withTip as B}from"../chunk-P2VEMZH5.js";import{Tooltip as O,ColorSwatch as z,ColorPickerPanel as K,Button as F,IconButton as W,registerModalEscapeInterceptor as $,textToolbarRows as j,TextToolbar as H,LinkPicker as A}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as I,useState as V,useLayoutEffect as U,useEffect as q,useId as Y}from"react";import{AlignJustifyIcon as G,AlignRightIcon as J,AlignCenterIcon as _,AlignLeftIcon as Z,ParagraphSpacingIcon as X,LetterSpacingIcon as Q,TextLinesIcon as ee,TextSizeIcon as te,ClearMarksIcon as ne,LinkIcon as re,QuietIcon as le,EmphasisIcon as oe,StrikeIcon as ae,ItalicIcon as se,BoldIcon as ie}from"efficient-shell/icons/efficient";import{jsx as ce,jsxs as ue,Fragment as de}from"react/jsx-runtime";var pe=["left","center","right","justify"],fe=e.align,he={left:/* @__PURE__ */ce(Z,{}),center:/* @__PURE__ */ce(_,{}),right:/* @__PURE__ */ce(J,{}),justify:/* @__PURE__ */ce(G,{})},me={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ge(e,t=fe){return pe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:he[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ve(e){if(e.every(e=>e.label===fe[e.id]))return e.length>3?me.four:me.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function be(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function ke(e,t,n,r=f){const{start:l,end:o}=be(e,n);return r(e,l,o,t)}function xe(e,t,n){const{start:r,end:l}=be(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function we(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Se(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ee(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Ce({value:e,rules:l,multiline:u,readOnly:d=!1,placeholder:p,ariaLabel:f,handle:h,onEdit:m,onSelect:g,onHistory:y,onFormat:v,pending:b,onCommit:k,onCancel:x}){const w=I(null),S=I(null),E=I(null),C=I(null),D=I(null),N=I(e),[L,T]=V(0),M=I({value:e,rules:l,multiline:u,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v});M.current={value:e,rules:l,multiline:u,readOnly:d,pending:b,onEdit:m,onHistory:y,onFormat:v};const P=()=>{const e=w.current,t=S.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Se(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Se(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},R=(e,t)=>{const n=w.current,r=S.current;if(!n||!r)return;const[l,o]=Ee(r,e),[a,s]=Ee(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};h.current={getSource(){const e=P(),t=S.current;if(!e||!t)return null;const[r,l]=n(t.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},T(e=>e+1)},focus(){w.current?.focus()},rangeOf(e,n){const r=w.current,l=S.current;if(!r||!l)return null;const[o,a]=t(l.layout,e,n),[s,i]=Ee(l,o),[c,u]=Ee(l,a),d=r.ownerDocument.createRange();return d.setStart(s,i),d.setEnd(c,u),d}},U(()=>{const n=w.current;if(!n||D.current)return;const o=C.current?null:P();S.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=we(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,r(e,l)),E.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&n.ownerDocument.activeElement===n&&R(o[0],Math.min(o[1],S.current.layout.text.length)));C.current=null;const s=S.current.layout,[i,c]=a.vis??t(s,a.src[0],a.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),R(i,c)},[e,l,L]);const B=(e,t,r)=>{const l=S.current,[o,a]=n(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==M.current.value?M.current.onEdit(e.text,{start:o,end:a},r):T(e=>e+1)};q(()=>{const e=w.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:s}=M.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const i=S.current,c=P();if(!i||!c)return;const u="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,d=u&&!u.collapsed?[Se(i,e,u.startContainer,u.startOffset),Se(i,e,u.endContainer,u.endOffset)]:null,p=a({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:d,pending:s});p&&("history"!==p.kind?"format"!==p.kind?B(p.edit,p.range,p.kind):M.current.onFormat(p.style):M.current.onHistory(p.dir))},n=()=>{D.current||T(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),q(()=>{const e=w.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=h.current?.getSource();e&&g(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const O=(t,n=!1)=>{const r=P();if(!r||r[0]===r[1])return;t.preventDefault();const o=S.current;t.clipboardData.setData("text/plain",o.layout.text.slice(r[0],r[1])),t.clipboardData.setData(i,c(e,l,r[0],r[1])),n&&!d&&B(s(e,l,r[0],r[1],{text:""}),r,"edit")};/* @__PURE__ */
|
|
2
|
+
return ue("div",{className:"es-rich-wrap",children:[p&&""===e?/* @__PURE__ */ce("div",{className:"es-rich-placeholder","aria-hidden":"true",children:p}):null,
|
|
3
|
+
/* @__PURE__ */ce("div",{ref:w,className:`es-rich${u?" is-multiline":" is-single"}${d?" is-off":""}`,contentEditable:!d,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":u,"aria-label":f,"aria-readonly":d||void 0,"aria-placeholder":p,tabIndex:d?-1:0,spellCheck:!0,onFocus:()=>{N.current=e},onBlur:()=>{e!==N.current&&k?.(e),N.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(N.current),void(N.current=e);"Enter"!==t.key||u||(t.preventDefault(),e!==N.current&&k?.(e),N.current=e)},onCompositionStart:()=>{const e=P()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=M.current;e.data?B(s(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):T(e=>e+1)},onCopy:e=>O(e),onCut:e=>O(e,!0),onPaste:t=>{if(t.preventDefault(),d)return;const n=P();if(!n)return;const r=t.clipboardData.getData(i),a=r?u?r:r.replace(/\s*\r?\n\s*/g," "):o({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:t.currentTarget.ownerDocument,multiline:u,rules:l});B(s(e,l,n[0],n[1],{markup:a}),n,"edit")}})]})}var De={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */ce(te,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */ce(ee,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */ce(Q,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */ce(X,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ne(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Le({cells:t,words:n,readOnly:r=!1}){const l=n??e.cells;/* @__PURE__ */
|
|
4
|
+
return ce("div",{className:"es-copy-cells",children:t.map(e=>{const t=e.scale??1,n=e.name??(e.nameKey?l[e.nameKey]:e.key),o=e.unit??"",a=e.step??1;/* @__PURE__ */
|
|
5
|
+
return ce(u,{value:Ne(e.value,t),styleValue:Ne(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:a,shiftStep:e.shiftStep,icon:e.icon,unit:o||void 0,steppers:"compact",readOnly:r,ariaLabel:n,title:l.tip({name:n,step:a,unit:o})},e.key)})})}var Te=e=>e.preventDefault();function Me({colors:e,current:t,words:n,onPick:r}){const l=null===t?null:t.startsWith("#")?t.toLowerCase():e.find(e=>e.name===t)?.value.toLowerCase()??null;/* @__PURE__ */
|
|
6
|
+
return ue("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:[
|
|
7
|
+
/* @__PURE__ */ce("span",{className:"es-copy-pop-label",children:n.theme}),
|
|
8
|
+
/* @__PURE__ */ce("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */ce(O,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */ce(z,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Te,onClick:()=>r(e.name)})},e.name))}),
|
|
9
|
+
/* @__PURE__ */ce("span",{className:"es-copy-pop-label",children:n.any}),
|
|
10
|
+
/* @__PURE__ */ce(K,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
|
|
11
|
+
/* @__PURE__ */ce("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */ce(F,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Te,onClick:()=>r(null),children:n.remove})})]})}var Pe=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var Re=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function Be(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function Oe(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var ze=/* @__PURE__ */new Set([...p,"clear"]),Ke={bold:/* @__PURE__ */ce(ie,{size:16}),italic:/* @__PURE__ */ce(se,{size:16}),strike:/* @__PURE__ */ce(ae,{size:16}),highlight:/* @__PURE__ */ce(oe,{size:16}),quiet:/* @__PURE__ */ce(le,{size:16}),link:/* @__PURE__ */ce(re,{size:16}),clear:/* @__PURE__ */ce(ne,{size:16})};function Fe(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var We={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function $e({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=R("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!ze.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */ue("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??Ke[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return B(e.title,/* @__PURE__ */ce(W,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":Fe(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":We[e.style]?` ${We[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */ue(de,{children:[
|
|
12
|
+
/* @__PURE__ */ce("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */ce("span",{className:"es-copy-bar-end",children:o}):null]}):null}function je({target:e,onChange:t}){const n=I(null);return U(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var He=["bold","italic","underline","strike","sup","sub"];function Ae({value:t,onChange:n,onCommit:r,onCancel:a,multiline:s=!1,placeholder:i,ariaLabel:c,className:u,readOnly:p=!1,rules:O,tools:z=[],writeMark:K,actions:W,align:G,glyphs:J,barLabel:_,renderFooter:Z,inputRef:X,barShows:Q="always",richText:ee=!0,defaultShowMarks:te=!1,toolbar:re="final",colors:le,cells:oe,letterCase:ae,lastTool:se}){const ie="final"===re,pe=R("copy",e),fe=I(null),he=X??fe,[me,ye]=V(!1),[be,we]=V(null),Se=I(l()).current,Ee=I(null);q(()=>{const e=Ee.current;e&&t===e.to?Ee.current=null:e&&t===e.from||(Ee.current=null,Se.reset())},[t,Se]);const De=e=>{Ee.current={from:Ee.current?.from??t,to:e},n(e)},Ne=e=>({text:t,start:e?.selectionStart??be?.start??t.length,end:e?.selectionEnd??be?.end??t.length}),[Te,Ke]=V(te),Fe=ee&&!(s&&Te),We=I(null),Ae=Y(),[Ie,Ve]=V(null),[Ue,qe]=V(!1),Ye=()=>{if(!Fe)return he.current;const e=We.current?.getSource()??be;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Ge=je({target:he,onChange:De}),Je=e=>(we({start:e.selectionStart,end:e.selectionEnd}),e),_e=(e,n)=>{if(!Fe)return void Ge(t=>(n&&Se.record(Ne(t),"edit",Date.now()),Je(e(t))));const r=Ye(),l=Je(e(r));n&&Se.record(Ne(r),"edit",Date.now()),Ve(null),l.text!==t&&De(l.text),We.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Ze=e=>_e(e,!0),Xe=e=>_e(t=>{const n=Ne(t),r=Se[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Qe=I(null);U(()=>{const e=Qe.current;e&&(Qe.current=null,Fe?We.current?.setSource(e.start,e.end,t):(he.current?.focus(),he.current?.setSelectionRange(e.start,e.end),we(e)))},[Fe]);const[et,tt]=V(null),nt=O??g,rt=("string"==typeof z[0]?h(z):z).filter(e=>!ze.has(e.style)),lt=ie?("string"==typeof z[0]?z:z.map(e=>e.style)).filter(e=>!ze.has(e)):rt.map(e=>e.style),ot={};if(be&&(Fe||ie)){const e=m(t,be.start,be.end,nt);for(const t of lt){const n=e.has(t)||"highlight"===t&&e.has("accent");ot[t]=!!Ie?.add.includes(t)||!Ie?.drop.includes(t)&&n}ie&&(ot.link=e.has("link"))}else if(be)for(const e of lt)ot[e]="link"===e?null!==y(t,be.start,be.end):v(t,be.start,be.end,e);const at=()=>{const e=Ye(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},st={sup:"sub",sub:"sup"},it=e=>{if(ie&&"link"!==e&&x(0,e)){const{start:n,end:r}=at(),l=st[e];if(n===r){if(!Fe)return void Ze(n=>ke(t,e,n,(e,t,n,r)=>f(e,t,n,r,nt,pe.placeholders)));const o=m(t,n,r,nt),a=Ie&&Ie.at===n?Ie:null,s=o.has(e),i=!!a?.add.includes(e)||!a?.drop.includes(e)&&s;let c=(a?.add??[]).filter(t=>t!==e),u=(a?.drop??[]).filter(t=>t!==e);return i&&s?u.push(e):i||s||c.push(e),!i&&l&&(c=c.filter(e=>e!==l),o.has(l)&&(u=[...u.filter(e=>e!==l),l])),void Ve(c.length||u.length||void 0!==a?.color?{add:c,drop:u,color:a?.color,at:n}:null)}return void Ze(()=>{let o=t,a=n,s=r;if(l&&!m(o,a,s,nt).has(e)&&m(o,a,s,nt).has(l)){const e=S(o,a,s,l,nt);({text:o,selectionStart:a,selectionEnd:s}=e)}return S(o,a,s,e,nt)})}if("clear"===e)return void Ze(n=>ke(t,e,n,(e,t,n)=>f(e,t,n,"clear",nt)));if("link"!==e&&Fe&&x(0,e)){const n=Ye(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=m(t,r,l,nt),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Ie&&Ie.at===r?Ie:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Ve(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Ze(n=>S(t,n?.selectionStart??r,n?.selectionEnd??l,e,nt))}if("link"!==e){const n=K??((e,t,n,r)=>f(e,t,n,r,g,pe.placeholders));return void Ze(r=>ke(t,e,r,n))}const n=Ye(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;qe(!1),tt({start:r,end:l,link:y(t,r,l)})},ct=Boolean(be&&be.start!==be.end),ut=be?b(t,be.start,be.end,nt):null,dt=be?Ie&&void 0!==Ie.color&&Ie.at===be.start?Ie.color:k(t,be.start,be.end,nt):null,pt=dt?dt.startsWith("#")?dt:le?.find(e=>e.name===dt)?.value:void 0,ft=e=>{Fe?e?We.current?.setSource(e.start,e.end,t):We.current?.focus():(he.current?.focus(),e&&he.current?.setSelectionRange(e.start,e.end))},ht=()=>{const e=et;tt(null),ft(e?{start:e.start,end:e.end}:be)},mt=()=>{const e=yt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));qe(!1),t&&ft(be)},gt=I(mt);gt.current=mt,q(()=>{if(Ue)return $(e=>{const t=yt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(gt.current(),!0)},()=>yt.current?.querySelector(".es-copy-colors"))},[Ue]);const yt=I(null),vt=Ue||null!==et;q(()=>{const e=yt.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{qe(!1),tt(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const bt=et??(Ue?be??{start:t.length,end:t.length}:null),kt=I(()=>{});kt.current=()=>{const e=yt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!bt)return;const n=Fe?null:e.querySelector(".es-gold-layer"),r=Fe?We.current?.rangeOf(bt.start,bt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,bt.start,bt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?Re(t):Re(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=Pe(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),p=d?e.top-o-t.height:e.bottom+o,f=e.left+Math.min((e.right-e.left)/2,10),h=Pe(f-5-i,10,t.width-10-10);return{top:p-l.top,left:i-l.left,above:d,point:h}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:Be(e),parent:Oe(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},U(()=>{const e=yt.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Ue,et,bt?.start,bt?.end,Fe]);const xt=e=>et&&/* @__PURE__ */ce(A,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:et.link?.href??"",onApply:e=>{const n=et;tt(null),Ze(()=>Fe?L(t,n.start,n.end,e,nt):T(t,n.start,n.end,e))},onRemove:et.link?()=>{const e=et.link,n=et;tt(null),e&&Ze(()=>Fe?D(t,n.start,n.end,nt):N(t,e))}:void 0,onCancel:ht}),wt=G?ge(G.allow,pe.align):[],St="always"===Q||me||null!==et||Ue,Et=le&&le.length>0?{run:pt,open:Ue,onToggle:()=>{tt(null),Ue?mt():qe(!0)}}:void 0,Ct=St&&ie&&se?se({className:"rosh-tb-btn",disabled:p,selected:ct,keepCaret:e=>e.preventDefault(),insert:e=>Ze(n=>xe(t,e,n))}):void 0,Dt=new Set(lt),Nt=G?{value:G.value,allow:G.allow,onChange:G.onChange,disabled:G.disabled}:void 0,Lt={pressed:ut,onList:e=>{const{start:n,end:r}=at(),l=b(t,n,r,nt);Ze(()=>C(t,n,r,l===e?null:e,nt))}},Tt=j({offered:Dt,color:Et,last:Ct,alignment:Nt,list:Lt,letterCase:ae}),Mt=ie&&St&&(He.some(e=>Dt.has(e))||Boolean(Et));/* @__PURE__ */
|
|
13
|
+
return ue("div",{ref:yt,className:"es-copy"+(u?` ${u}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===he.current||Boolean(e.target.closest?.(".es-rich"));if(p||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Xe(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(ie){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!lt.includes(t))return;return e.preventDefault(),e.stopPropagation(),void it(t)}const a=rt.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),it(a.style))},onPaste:e=>{const n=he.current;if(p||!n||e.target!==n)return;e.preventDefault();const r=o({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:s,rules:nt});Ze(e=>xe(t,r,e))},style:le&&le.length>0?Object.fromEntries(le.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=he.current;e&&e.ownerDocument.activeElement===e&&we({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[St&&ie&&(Tt.words||Tt.paragraph)?
|
|
14
|
+
/* @__PURE__ */ce(H,{className:"es-copy-toolbar","aria-label":_??pe.formatting,offered:Dt,pressed:ot,onMark:e=>it(e),color:Et,linkOpen:null!==et,last:Ct,alignment:Nt,list:Lt,letterCase:ae,disabled:p,windows:/* @__PURE__ */ue(de,{children:[Ue&&le&&le.length>0?/* @__PURE__ */ce(Me,{colors:le,current:dt,words:pe.colors??e.colors,onPick:e=>{const{start:n,end:r}=at();if(n!==r)Ze(()=>E(t,n,r,e,nt));else{if(!Fe)return;Ve({add:Ie?.add??[],drop:Ie?.drop??[],color:e,at:n})}}}):null,et?xt(!0):null]})}):null,ie&&oe&&oe.length>0?/* @__PURE__ */ce(Le,{cells:oe,words:pe.cells??e.cells,readOnly:p}):null,St&&!ie?/* @__PURE__ */ce($e,{tools:z,disabled:p,actions:W,glyphs:J,ariaLabel:_,pressed:ot,open:et?"link":null,onApply:it,align:G?/* @__PURE__ */ce(M,{options:wt,value:G.value,onChange:G.onChange,ariaLabel:pe.alignment,disabled:p||G.disabled,fit:ve(wt)}):null}):null,Fe?/* @__PURE__ */ce(Ce,{value:t,rules:nt,multiline:s,readOnly:p,placeholder:i,ariaLabel:c,handle:We,pending:Ie??void 0,onEdit:(e,n,r)=>{Se.record({text:t,start:n.start,end:n.end},r,Date.now()),Ve(null),De(e)},onSelect:e=>{we(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ie||e.start===Ie.at&&e.end===Ie.at||Ve(null)},onHistory:Xe,onFormat:e=>{lt.includes(e)&&it(e)},onCommit:r,onCancel:a}):/* @__PURE__ */ce(d,{value:t,onInput:e=>{Se.record(Ne(null),"type",Date.now()),De(e)},onCommit:r,onCancel:a,multiline:s,placeholder:i,ariaLabel:c,rules:O,disabled:p,inputRef:he,className:"es-copy-box"}),et&&!ie?xt(!1):null,Z?Z({focused:me,insert:e=>Ze(n=>xe(t,e,n))}):null,ee&&s||Mt?
|
|
15
|
+
/* @__PURE__ */ue("div",{className:"es-copy-marks",children:[ee&&s?/* @__PURE__ */ue(de,{children:[
|
|
16
|
+
/* @__PURE__ */ce(P,{checked:Te,onChange:()=>{const e=Ye();Qe.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:be,Ve(null),Ke(e=>!e)},ariaLabelledBy:Ae,disabled:p}),
|
|
17
|
+
/* @__PURE__ */ce("span",{id:Ae,className:"es-copy-marks-label",children:pe.showMarks??"Show marks"})]}):null,Mt?B(ct?void 0:pe.clearStyleEmpty??"Select words first",/* @__PURE__ */ue(F,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:p||!ct,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=at();if(e===n)return;const r=w(t,e,n,nt);r.text!==t&&Ze(()=>r)},children:[
|
|
18
|
+
/* @__PURE__ */ce(ne,{size:16}),pe.clearStyle??"Clear style"]})):null]}):null]})}export{pe as COPY_ALIGNS,me as COPY_ALIGN_FIT,he as COPY_ALIGN_GLYPHS,fe as COPY_ALIGN_LABELS,De as COPY_CELLS,Me as ColorWindow,Ae as CopyBox,Le as CopyCells,$e as MarkBar,Ce as RichBox,Fe as ariaShortcut,ge as copyAlignOptions,xe as insertSelection,ke as markSelection,je as useCaretEdit};
|
package/dist/drag/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-
|
|
1
|
+
export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-AYNU4FYF.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
package/dist/easel/easel.css
CHANGED
|
@@ -88,3 +88,20 @@
|
|
|
88
88
|
outline: 1px solid color-mix(in srgb, var(--es-accent, #2563eb) 60%, transparent);
|
|
89
89
|
outline-offset: -1px;
|
|
90
90
|
}
|
|
91
|
+
/* The words being typed (EaselCanvas `typing`, Lewis 2026-10-14): ONE frame,
|
|
92
|
+
a 2px line in the selection's accent, 4px clear of the words, with a thin
|
|
93
|
+
ring of the ink that reads ON the accent just outside it — so the frame
|
|
94
|
+
shows round a button whose own fill is the accent, and on a dark photo. */
|
|
95
|
+
.es-canvas-outline.is-typing {
|
|
96
|
+
outline: 2px solid var(--es-accent);
|
|
97
|
+
outline-offset: 4px;
|
|
98
|
+
border-radius: var(--radius-sm);
|
|
99
|
+
}
|
|
100
|
+
.es-canvas-outline.is-typing::after {
|
|
101
|
+
content: '';
|
|
102
|
+
position: absolute;
|
|
103
|
+
inset: -8px;
|
|
104
|
+
border: 1px solid color-mix(in srgb, var(--on-accent) 85%, transparent);
|
|
105
|
+
border-radius: var(--radius-sm);
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|