efficient-easel 27.1.0 → 27.2.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/AddSidePanel-DoCx-ZrM.d.ts +1994 -0
- package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
- package/dist/{chunk-P3HXHLES.js → chunk-2Y4CAWZQ.js} +3 -3
- package/dist/{chunk-RTMDZJNE.js → chunk-3RGHXL5V.js} +1 -1
- package/dist/chunk-64NREOML.js +1 -0
- package/dist/chunk-DCBUJ36Q.js +5 -0
- package/dist/{chunk-SEC6NV6Y.js → chunk-DQSRGKSM.js} +4 -4
- package/dist/{chunk-L36E2WCO.js → chunk-HGTDDSFJ.js} +15 -15
- package/dist/{chunk-LAJYMOY3.js → chunk-I4Z75MCX.js} +1 -1
- package/dist/{chunk-QPNNWQ24.js → chunk-JI7GUM3C.js} +1 -1
- package/dist/chunk-LK56FUFT.js +1 -0
- package/dist/chunk-M5UCPD66.js +1 -0
- package/dist/{chunk-XESNAMI3.js → chunk-MMHYTIUY.js} +3 -3
- package/dist/chunk-OSF2H3LO.js +1 -0
- package/dist/{chunk-3FANFZ4D.js → chunk-PTTQWCD7.js} +1 -1
- package/dist/{chunk-WL57KM5C.js → chunk-SR2535CN.js} +17 -17
- package/dist/{chunk-SEH3Q3EL.js → chunk-XGTO4LHI.js} +1 -1
- package/dist/chunk-YCYGY54I.js +8 -0
- package/dist/chunk-ZSP4ZAQ2.js +64 -0
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +2 -4
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +2 -4
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +2 -4
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenMount.d.ts +2 -4
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -4
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +2 -4
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -4
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/add-target-types.d.ts +37 -55
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.d.ts +1 -1
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +1 -1
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +1 -1
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.d.ts +1 -1
- package/dist/screen/lib/document/image-fields.js +4 -4
- package/dist/screen/lib/document/new-child.d.ts +58 -0
- package/dist/screen/lib/document/new-child.js +1 -0
- package/dist/screen/lib/document/palette-sections.d.ts +2 -4
- package/dist/screen/lib/document/shadow-fields.d.ts +1 -1
- package/dist/screen/lib/document/shadow-fields.js +2 -2
- package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
- package/dist/screen/lib/document/style-clipboard.d.ts +2 -4
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/style-fields.d.ts +1 -1
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/screen-parts.d.ts +20 -1827
- package/dist/screen/lib/screen-parts.js +1 -1
- package/package.json +7 -1
- package/dist/chunk-DTEYSPJE.js +0 -64
- package/dist/chunk-GJ427TZL.js +0 -8
- package/dist/chunk-J5VPNHOW.js +0 -1
- package/dist/chunk-TUIBPB77.js +0 -5
- package/dist/chunk-WW24O7HT.js +0 -1
- package/dist/chunk-XT75WETI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-DCBUJ36Q.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-HGTDDSFJ.js";import"../../chunk-LK56FUFT.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-SDSBXW3V.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-TDEBPOWV.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-D4TH4QQR.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-LDHUPZBK.js";import"../../chunk-TF6NAIV7.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-MNQDOSAX.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-ANBPE45L.js";import"../../chunk-C63IB4VW.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-UMTUKSE6.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QEEW4X64.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-6GJEOER4.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-YDTEYXQW.js";import"../../chunk-KXM6YRG2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.2.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"./screen/lib/document/field-markers",
|
|
109
109
|
"./screen/lib/document/image-fields",
|
|
110
110
|
"./screen/lib/document/shadow-fields",
|
|
111
|
+
"./screen/lib/document/new-child",
|
|
111
112
|
"./screen/lib/document/palette-sections",
|
|
112
113
|
"./screen/lib/document/panel-fields",
|
|
113
114
|
"./screen/lib/document/panel-no-control-mark",
|
|
@@ -513,6 +514,11 @@
|
|
|
513
514
|
"import": "./dist/screen/lib/document/hidable.js",
|
|
514
515
|
"default": "./dist/screen/lib/document/hidable.js"
|
|
515
516
|
},
|
|
517
|
+
"./screen/lib/document/new-child": {
|
|
518
|
+
"types": "./dist/screen/lib/document/new-child.d.ts",
|
|
519
|
+
"import": "./dist/screen/lib/document/new-child.js",
|
|
520
|
+
"default": "./dist/screen/lib/document/new-child.js"
|
|
521
|
+
},
|
|
516
522
|
"./screen/lib/document/palette-sections": {
|
|
517
523
|
"types": "./dist/screen/lib/document/palette-sections.d.ts",
|
|
518
524
|
"import": "./dist/screen/lib/document/palette-sections.js",
|
package/dist/chunk-DTEYSPJE.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-VNUXFD4X.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-RTMDZJNE.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-TQUEVJOO.js";import{usePartBridge as g}from"./chunk-J5VPNHOW.js";import{useSectionOps as y}from"./chunk-3FANFZ4D.js";import{PageEditGuardNotices as b}from"./chunk-XV5D4V2T.js";import{ScreenSaveIcon as v,ScreenMainButton as k}from"./chunk-2EEYFRQM.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-OB4KI2AN.js";import{requestMediaPick as x}from"./chunk-5HYVOOH3.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-GJ427TZL.js";import{keepsSharedSections as O,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as I,SidePanelHead as B,PanelShowStrip as P}from"./chunk-MTWQYLJE.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as E,useScreenNodeKeys as M,useScreenPinned as T,useScreenDocumentLabel as j,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as Y,useScreenBlockRules as U,useScreenBlockLook as J,useScreenStorageNamespace as X,useScreenNotify as G,useScreenCanvasHead as Q,isSlotMode as K,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-TUIBPB77.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-WW24O7HT.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as be}from"./chunk-G2VZ4DET.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-3OOYGEJY.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Oe,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Ee,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as Te,useEaselApi as je,useSettledAction as Le,subscribeLateWrites as Ae,CanvasPartsContext as Re,partHasOwnBox as Fe,CanvasPassThroughContext as De,CanvasSharedContext as Ve}from"./chunk-L36E2WCO.js";import{TreeRow as We,Subtree as He,LayersTree as Ye,TreeGroupLabel as Ue,TreeRowAction as Je,TreeSeam as Xe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ge}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Qe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Ze,clickPick as _e}from"./chunk-TF6NAIV7.js";import{EaselTopBar as qe,EaselIconButton as en,TopBarCluster as nn,DeviceSwitch as tn,InspectorIconButton as on,PanelResizeHandle as rn,MAX_PANEL_W as ln,MIN_PANEL_W_BY_SIDE as sn,panelWidthVars as dn}from"./chunk-VTY7OQB5.js";import{DEFAULT_NOTICE_WORDS as an,DEFAULT_CHROME_WORDS as cn}from"./chunk-AJSDWWJW.js";import{holderOf as pn,nameOrSomeone as un}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as fn}from"./chunk-RE4LP46F.js";import{useWords as hn}from"./chunk-MFIRYGHW.js";import{insertSeams as mn,CanvasDragLayer as gn,CanvasInsert as yn}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as bn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as vn,useTreeDrag as kn,gapToMoveIndex as Sn}from"./chunk-QEEW4X64.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as On,DataError as Nn}from"./chunk-YDTEYXQW.js";import{useCanvasFrame as In,LIST_SELECTOR as Bn,BLOCK_SELECTOR as Pn,useCanvasTyping as $n,useCanvasEvent as En,onMotionEnd as Mn}from"./chunk-6GJEOER4.js";import{nodeIdAt as Tn,frameRectToHost as jn,BLOCK_ATTRIBUTE as Ln,drawnBox as An}from"./chunk-FR7EEKFF.js";import{queryMainCopy as Rn}from"./chunk-7UFKEX72.js";import{useRef as Fn,useMemo as Dn,useState as Vn,useEffect as Wn,useCallback as Hn,useLayoutEffect as Yn,useContext as Un,Fragment as Jn,useId as Xn}from"react";import{ColoredBadge as Gn,Button as Qn,Tabs as Kn,toast as Zn,readMediaFileDrag as _n,Tooltip as qn,groupColors as et,Dialog as nt,FormField as tt,Input as ot,MEDIA_FILE_DRAG_TYPE as rt}from"efficient-shell/ui";import{UndoIcon as it,RedoIcon as lt,RefreshIcon as st,AddIcon as dt,TrashIcon as at,EyeOffIcon as ct,EyeIcon as pt,SharedIcon as ut,DuplicateIcon as ft}from"efficient-shell/icons/efficient";import{jsx as ht,jsxs as mt,Fragment as gt}from"react/jsx-runtime";var yt="media-file";function bt({name:e,onMake:n,onCancel:t}){const o=hn("screen",be).shared,[r,i]=Vn(e),[l,s]=Vn(!1),d=Xn(),a=Fn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return ht(nt,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */mt(gt,{children:[
|
|
3
|
-
/* @__PURE__ */ht(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */ht(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ht("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ht(tt,{label:o.name,htmlFor:d,children:/* @__PURE__ */ht(ot,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var vt=/* @__PURE__ */new WeakSet;function kt(e,n,t){const o=On(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function St(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function wt({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Fn(null),[i,l]=Vn({}),s=Fn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Wn(()=>{d&&(s.current.id=null,o(null))},[d,o]),Wn(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Yn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=jn(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const f=e.getBoundingClientRect(),h=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-f.left,top:n.top-f.top,right:n.right-f.left,bottom:n.bottom-f.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=Rn(t,`[${Ln}="${n}"]`),d=l?An(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=jn(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),f=c.top+c.height;if(f<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?f+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,b=g?.offsetHeight??0,v=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:St({left:y,top:m,width:v,height:b},h,a);v>0&&b>0&&h.push({left:S,top:m,right:S+v,bottom:m+b}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=Mn(o,c),u=new o.MutationObserver(c);u.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const f=r.current?.parentElement,h=f?.ownerDocument.defaultView?.MutationObserver,m=h?new h(c):null;return f&&m?.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p(),u.disconnect(),m?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */ht("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */ht("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */ht(qn,{content:e.reach,children:/* @__PURE__ */mt(Gn,{colorClass:et("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */ht("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ht(ut,{size:12})}),e.label]})}):/* @__PURE__ */ht(Gn,{colorClass:et("info","solid"),size:"sm",children:e.label})},e.id):null})})}function xt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return ht("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */mt(gt,e?{children:[
|
|
8
|
-
/* @__PURE__ */ht("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */ht("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */ht("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */ht("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */ht("path",{d:"M5 12h14"})]})})}var zt=`${Bn}, ${Pn}`;function Ct(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Ot="__rungs",Nt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var It="screen:band",Bt={duplicate:!0,delete:!0},Pt=()=>null;function $t(){const Bn=he(),jn=Bn.panels?.Toolbar,Ln=(Bn.panels?.useRight??Pt)(),{target:An,docId:Xn,capabilities:qn,currentSlug:et,siteId:nt,onPublish:tt,saveState:ot,saveConflict:ut,retrySave:St,toggleAutoSave:$t,flushSave:Et,access:Mt,saveUnreachable:Tt=!1,readOnly:jt,readOnlyReason:Lt=null}=w(),At=E(),Rt=M(),{mediaEditing:Ft,hasEditGuard:Dt,hasPinnedChrome:Vt}=qn,{appState:Wt,dispatch:Ht,history:Yt,selectedItem:Ut,getSelectorForId:Jt,config:Xt}=Te(e=>e),Gt=T(),{first:Qt,firstGroup:Kt,lastGroup:Zt,isSectionGroup:_t,sectionGroupZone:qt,panelOf:eo}=Gt,no=eo(Qt),to=e=>ne(Gt,e),oo=e=>te(Gt,e),ro="node"===Gt.firstRow,io=Gt.band??null,lo=hn("screen",be),so=hn("tree",Ge),ao=hn("drag",bn),co=hn("notice",an),po=hn("lock",fn),uo=hn("menu",Qe),fo=hn("styleClipboard",Se),ho=hn("chrome",cn),mo=j()??`/${et}`,go=L(),yo=A(),bo=y({readOnly:jt}),vo=y({readOnly:jt,foldIntoHistory:!0}),ko=Fn(null),So=je(),wo=Dn(()=>({...bo,select:e=>{ko.current=e,bo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=So.config;ko.current=Ke(e,t,n)}bo.commitDocument(e,n)}}),[bo,So]),xo=Wt.ui,zo=xo.leftSideBarVisible,Co=xo.rightSideBarVisible,{options:Oo,widths:No,initial:Io,fluid:Bo,fit:Po}=R(),[$o,Eo]=Vn(Io),Mo=le(),To=Ft&&null!==Mo;se(),de();const jo=ae();F(Ut?.props.id);const{read:Lo,write:Ao,forSelection:Ro}=D(),[Fo,Do]=Vn(Lo);Wn(()=>{Ao(Fo)},[Fo]);const[Vo,Wo]=Vn(0),Ho=Fn(null),Yo=Fn(null),Uo=In(Yo,{readySelector:zt}),Jo=$n(Uo),Xo=d(Yo);a(Yo,Uo);const Go=S(),Qo=pn(Mt),Ko={state:ot,offline:Go||ot.failed&&Tt,readOnlyReason:Lt,editing:Qo?co.editing({name:un(Qo.name,po),noun:lo.noun}):null,conflict:null!=ut,notSaving:lo.bar.notSaving},Zo=Le({onPress:()=>{jt||(ot.failed?St():Et())}}).onPress;c(Yo,Uo,Zo);const[_o,qo]=Vn(!1),er=Fn(!1),[nr,tr]=Vn(null),[or,rr]=Vn([]),[ir,lr]=Vn(V);W(ir);const sr=e(ir,Ut?.props.id),[dr,ar]=Vn(null);Wn(()=>{dr&&(n(),ar(null))},[dr]);const cr=Fn(Jt);cr.current=Jt;const pr=Hn((e,{scroll:n})=>{Do(n=>Ro(e,n)),n&&ar(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=cr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ur=Fn(null);Wn(()=>{const e=ur.current;ur.current=null;const n=null==Ut?.props.id?null:String(Ut.props.id);lr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:eo(Ut?.type)??V);const o=Ut?.props.id,r=ko.current;if(ko.current=null,!o)return;const i=Jt(o);pr(String(o),{scroll:!t(r,i??null,Oe)})},[Ut?.props.id,pr]);const fr=Hn(e=>{lr(n=>H(n,e)?n:e),Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ht]),hr=Fn(()=>{});hr.current=(e,n)=>{const t=e?Ri(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ut?.props.id?null:String(Ut.props.id);lr(e=>H(e,n)?e:n),o!==r&&(ur.current={id:o,mode:n},wo.select(e))};const mr=Hn((e,n)=>hr.current(e,n),[]),gr={kind:ir.kind,mode:ir,open:fr,show:e=>lr(e),reveal:()=>{Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},select:mr},yr=Y(gr,{data:Wt.data,selected:Ut??null,zoneOf:e=>Jt(e)?.zone,readOnly:Boolean(jt),select:e=>{lr(V),wo.select({index:e})},replace:(e,n)=>wo.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:$o,refreshes:Vo},{setView:Do,reveal:()=>{zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}})}}),br=yr.resolveLeftView?yr.resolveLeftView(Fo):"sections",vr=U(),{isLockedBlock:kr,duplicateBlocked:Sr,nestDepth:wr,newSectionNode:xr,canAddTo:zr,blockIsOffered:Cr}=vr,Or=e=>({id:String(e.props.id??""),data:Wt?.data}),Nr=J(),{labelAtLevel:Ir,Icon:Br,useProducts:Pr}=Nr,$r=Nr.rowName?(e,n,t)=>Nr.rowName(e,n,t):void 0,Er=Hn(e=>{Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),pr(e,{scroll:!0})},[Ht,pr]),{selectNode:Mr,openPartId:Tr}=g({mode:ir,setMode:lr,onOpenPart:Er}),[jr,Lr]=Vn(null);me(null!==jr,()=>Lr(null));const Ar=f(X()),Rr=Ar.collapsed,Fr=Ar.panelWidths,[Dr,Vr]=Vn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Rr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Wn(()=>{try{window.localStorage.setItem(Rr,JSON.stringify([...Dr]))}catch{}},[Dr]);const[Wr,Hr]=Vn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Fr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Wn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Fr,JSON.stringify(Wr))}catch{}},300);return()=>clearTimeout(e)},[Wr]);const Yr=Hn((e,n)=>Hr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ur=Hn(e=>Yr("left",e),[Yr]),Jr=Hn(e=>Yr("right",e),[Yr]),Xr=e=>Dr.has(e),Gr=e=>Vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Qr=Fn(!1),Kr=Fn(null);Wn(()=>{if(Qr.current&&!_o){const e=Kr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Yo.current?.querySelector(`button[aria-label="${CSS.escape(lo.add.title)}"]`))?.focus(),Kr.current=null}Qr.current=_o},[_o]),Wn(()=>{if(!_o||!Xo)return;const e=e=>{"Escape"===e.key&&yl()};return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[_o,Xo]),me(_o,()=>yl()),Wn(()=>{!zo&&_o&&(qo(!1),tr(null),er.current=!1)},[zo]);const Zr=G(),_r=(e,n="success",t)=>{if(Zr)return void(t?Zr(e,"error"===n?"error":"info",t):Zr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Zn.error(e,{...o,duration:t?.duration??3200}):Zn.success(e,{...o,duration:t?.duration??1900})},qr=Le(yr.mainAction??{label:lo.done,onPress:()=>{tt(So.getState().appState.data)}}),ei=Fn(_r);ei.current=_r,Wn(()=>Ae(So,()=>ei.current(lo.writeLate,"error")),[So,lo]);const ni=Fn(null),[ti,oi]=Vn(0),[ri,ii]=Vn(0),li=Q(),si=Fn(null),di=e=>Math.max(0,e.clientHeight-(si.current?.offsetHeight??0));Wn(()=>{const e=ni.current;if(!e)return;const n=()=>{oi(e.clientWidth),ii(di(e))};n();const t=new ResizeObserver(n);return t.observe(e),si.current&&t.observe(si.current),()=>t.disconnect()},[]),Yn(()=>{ni.current&&(oi(ni.current.clientWidth),ii(di(ni.current)))},[Wr,zo,Co]);const ai=$o===Bo?ti>0?ti:No[Bo]:No[$o],ci=ti>0?Math.min(ti/ai,"shrink"===Po?1:2):1,pi=ai*ci,ui=ti>0&&pi>ti+1,fi={width:pi,height:ri||"100%",flex:"none",position:"relative"},hi={width:ai,height:ri?ri/ci:"100%",maxHeight:"none",transform:1!==ci?`scale(${ci})`:void 0,transformOrigin:"top left"},mi=()=>Ht({type:"setUi",ui:{leftSideBarVisible:!zo}}),gi=()=>Ht({type:"setUi",ui:{rightSideBarVisible:!Co}}),yi=e=>{_o&&(qo(!1),tr(null),er.current=!1,zo&&Fo===e)||(Do(e),zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},bi=()=>{lr(no??V),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},vi=Wt.data.content??[],ki=()=>{const e=vi.findIndex(to),n=vi.findIndex(oo);return{floor:e>=0?e+1:0,cap:n>=0?n:vi.length}},Si=Xt,wi=vr.stripCopy,xi=e=>o(e,wi),zi=pe(),Ci=Ze({data:Wt.data,config:Si,readOnly:Boolean(jt),clipboard:zi,strip:wi?e=>wi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ki();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&lr(V);const t=void 0===n||"node"===n?.kind?n:null;wo.commitDocument(e,t)}}),Oi=fe(),[Ni,Ii]=Vn(null),Bi=e=>{const n=vi.find(n=>String(n.props.id)===e),t=Gt.shared;n&&t&&Ci.swap(e,t.detach(n))},Pi=e=>{const n=On(Wt.data,Xt,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===Oe?ji(o):Ki(o),i=t===Oe?Gt.shared?.usedOn(o):null;return!!Ci.remove(e)&&(_r(i?lo.shared.removed({count:Math.max(0,i.length-1)}):lo.deleted({name:r}),"success",{duration:8e3,action:{label:lo.bar.undo,onClick:()=>{Ci.restore(n.node,n.place)}}}),!0)},$i={...Ci,remove:Pi},Ei=e=>Ir(e,"block",Xt.components[e]?.label??e),Mi=Hn(e=>Xt.components[e]?.defaultProps??{},[Xt]),Ti=e=>Ir(e,"section",Ei(e)),ji=e=>we({type:e.type,props:e.props??{}},Ti(e.type),$r),{nodeAddresses:Li,zoneItems:Ai}=Dn(()=>{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>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vi,Oe,0),{nodeAddresses:e,zoneItems:n}},[vi,Xt]),Ri=Hn(e=>Ai.get(e)??[],[Ai]),Fi=e=>{const n=Li.get(e);return n?Ri(n.zone)[n.index]:void 0},Di=e=>oe(vr,Xt,e),Vi=e=>{if(!vr.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Fi(e.slice(0,n));if(!t)return null;const o=Di(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}},Wi=(()=>{if(!K(ir))return null;const e=`${ir.nodeId}:${ir.slot}`;return Vi(e)?.slot.panel===ir.kind?e:null})(),Hi=Fn(null);Wn(()=>{const e=Hi.current;if(Hi.current=null,!Wi||!K(ir))return;const n=ir.nodeId;pr(n,{scroll:e!==Wi}),Vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[ir]);const Yi=e=>{const n=Li.get(e);n&&(n.zone===Oe?cl(n.index):Al(n.zone,n.index,e,Fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ui=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Yi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Wi!==i&&(Hi.current=i),mr(null,r),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ji=(e,n,t)=>{const o=`${e}:${n}`;if(Vr(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;Wi!==o&&(Hi.current=o);mr(null,{kind:t,nodeId:e,slot:n})},Xi=(e,n,t)=>{if(jt||!vr.moveSlot)return;const o=Fi(e),r=o?Di(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ot,index:n},s=Sn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vr.moveSlot(e,n,s);"string"==typeof d&&Ji(e,d,i.panel)},Gi=Pr(),Qi=Dn(()=>{const e=/* @__PURE__ */new Map;for(const n of Gi??[])e.set(n.slug,n.name);return e},[Gi]),Ki=e=>xe(e,Ei,Nr.plainText,e=>Qi.get(e),Nr.rowName),Zi=(e,n)=>{const t=Xt.components[e.type]?.fields,o=n===Oe||as(n)?"section":"block",r=n===Oe&&(to(e)||oo(e)||_t(e.type)),i="block"===o?ze(t):r?null:Ce(t);return Nr.renamePropOf?Nr.renamePropOf(e,o,i):i},_i=(e,n,t,o)=>{if(!(!jt&&jr?.zone===e&&jr.index===n))return;const r=(t,o)=>{Lr(null),o&&((e,n,t)=>{const o=Ri(e)[n];if(!o)return;const r=Zi(o,e);r&&wo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return ht("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":lo.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)},qi=i(Z(),fo),el=qi.scope({target:An,siteId:nt,docId:Xn}),nl=Xt,tl=(e,n)=>n===Oe?Ti(e):Ei(e),ol=(e,n,t)=>{const o=qi.plan(el,t,tl(t.type,e),nl);o&&(o.changed&&wo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),_r(o.message))},rl=ue({nodesIn:Ri,nodeAt:(e,n)=>Ri(e)[n]??null,labelOf:(e,n)=>n===Oe?Ti(e):Ei(e),renamePropOf:Zi,beginRename:(e,n)=>Lr({zone:e,index:n}),history:{hasPast:Yt.hasPast,hasFuture:Yt.hasFuture,back:()=>Yt.back(),forward:()=>Yt.forward()},openPageStyles:yr.openPageStyles,pageStylesLabel:lo.pageStyles,words:{menu:uo,styleClipboard:fo,screen:lo.menu},readOnly:Boolean(jt),collapseAll:()=>Vr(new Set(Ri(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>_r(e?lo.pasteRefused({name:e.label}):lo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>us(e,n),copyItem:yr.onCopyItem,menuRows:(e,n,t)=>{const o=yr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Gt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:lo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return jt||kr(e.type,e)?n:{...n,change:[{label:lo.shared.detach,onClick:()=>Bi(e.props.id)}],remove:[{label:lo.shared.removeFromPage,danger:!0,onClick:()=>{Pi(e.props.id)}}]}}return jt||to(e)||oo(e)||_t(e.type)?null:O(Oi)?{change:[{label:lo.shared.makeShared,onClick:()=>Ii({id:e.props.id,name:ji(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>kr(e.type,e),duplicateBlocked:e=>Sr(Wt.data,e),permits:e=>{const n=Ne(Xt,e.type);return Gt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:$i,isPinned:(e,n)=>n===Oe&&(to(e)||oo(e)),sectionBand:ki,locate:e=>Li.get(e)??null,rowNameOf:(e,n)=>n===Oe?ji(e):Ki(e),selectAt:(e,n,t,o)=>{e===Oe?cl(n):Al(e,n,t,o??"")},slotRung:e=>{const n=Vi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ui(n.node,n.slot,!1)}:null},style:{held:()=>ve(el),canCopy:e=>qi.rows(nl,e).some(e=>!1!==e.counted),copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:(e,n,t)=>ol(e,n,t)},keys:Rt?{target:Xo,selected:()=>{const e=Wt.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>zi.get(),readOnly:Boolean(jt),onDone:({done:e,name:n})=>{"copied"===e&&_r(lo.copied({name:n}))}}:void 0},Uo),il=Fn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Wn(()=>{il.current={copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:ol,at:()=>{const e=Wt.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ri(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(jt)}});const ll=Hn(e=>{const n=ke(e);if(!n)return;const t=il.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))},[]);Wn(()=>{if(!Xo)return;const e=e=>ll(e);return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[ll,Xo]),En(Uo,"keydown",ll);const sl=vi.map(e=>e.props.id).join("|");Wn(()=>{const e=Uo?.document??null,n=Uo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void rr(e=>e.length?[]:e);const n=vi.findIndex(oo),t=n>=0?n:vi.length,o=n=>{const t=vi[n]?.props?.id;return null==t?null:Rn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Pn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=vi.length>0&&!to(vi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Ct(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}rr(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=Mn(n,i),s=new ResizeObserver(i);return s.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l(),s.disconnect()}},[Uo,sl,$o,ci,zo,Co,Ut?.props.id]);const dl=Uo?.document??null,al=Uo?.window??null;Wn(()=>{const e=Ho.current;if(!e||!dl||!al)return;const n=[],t=()=>{const n=Rn(dl,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&al.scrollTo({left:al.scrollX,top:al.scrollY+t,behavior:"instant"}),!0};return Ho.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[dl,al]);const cl=e=>{lr(V),wo.select({index:e}),yr.sectionPressed?.(vi[e]);const n=vi[e]?.props?.id;n&&l(n)},pl=e=>{const{floor:n,cap:t}=ki(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ut&&ir.kind!==no?.kind?vi.findIndex(e=>e.props.id===Ut.props.id):-1;return o(r>=0?r+1:t)},ul=(e,n)=>{const{floor:t,cap:o}=ki(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(wo.reorderComponent(Oe,e,i),wo.select({index:i}),{moved:!0,dest:i})},fl=(e,n,t,o)=>{lr(V),wo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),_r(lo.sectionAdded({name:t}))},hl=(e,n)=>{const t=pl(n),o=xr(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),r=o?wo.insertNode(Oe,t,o):wo.insertSection(e,t);return fl(t,r,Ti(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 Be(Xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=zr(e.type,l,d.slice(d.lastIndexOf(":")+1),Or(e)),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},ml=e=>gl(Oe,e),gl=(e,n)=>{Kr.current=document.activeElement??null,tr(null===n?null:{zone:e,index:n}),qo(!0),zo||(er.current=!0,Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},yl=()=>{qo(!1),tr(null),er.current&&Ht({type:"setUi",ui:{leftSideBarVisible:!1}}),er.current=!1},bl=(e,n)=>Nr.rowName?n?to(e)?Nr.rowName(e,"section",lo.header):oo(e)?Nr.rowName(e,"section",lo.footer):_t(e.type)?Nr.rowName(e,"section",Ei(e.type)):ji(e):Ki(e):n?Ti(e.type):Ei(e.type),vl=e=>n=>{e()},kl=(e,n,t)=>{if(jt)return null;const o=Ri(e)[n];return o&&!Ne(Xt,o.type).delete||o&&kr(o.type,o)?null:/* @__PURE__ */ht(Je,{kind:"delete",label:e===Oe&&o&&Gt.shared?.usedOn(o)?lo.shared.removeFromPage:lo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ri(e)[n]?.props?.id;null!=t&&Pi(String(t))})(e,n),children:/* @__PURE__ */ht(at,{size:15})})},Sl=e=>Nr.rowPreview?.(e)||void 0,wl=e=>Nr.rowMarks?.(e)??void 0,xl=(e,n,t)=>Nr.rowActions?.(e,n,t)??null,zl=(e,n,t,o)=>{if(jt)return null;if(kr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return ht(Je,{kind:"eye",label:r?lo.showNamed({name:o}):lo.hideNamed({name:o}),onClick:()=>Ol(e,n,t),children:/* @__PURE__ */ht(r?ct:pt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Cl=e=>id(Oe,e),Ol=(e,n,t)=>{wo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Nl=e=>Pe(Xt,e),Il=e=>Be(Xt,e),Bl=e=>vr.slotsOf?Di(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ee(e,n.slot)})):[{slot:null,rung:null,kids:re(Xt,e)}],Pl=e=>vr.slotsOf?Bl(e).flatMap(e=>e.kids):re(Xt,e),$l=e=>Boolean(vr.slotsOf)&&Di(e).some(e=>e.rung),El=(e,n,t)=>zr(e.type,n,t??void 0,Or(e)),Ml=(e,n,t)=>{const o=Me(Xt,e.type,n)&&(t||Pl(e).length>0||$l(e));return{collapsible:o,folded:o&&Xr(String(e.props.id))}},Tl=(e,n,t)=>Bl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ml(e,r,t(e.type)).collapsible?[String(e.props.id),...Tl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),jl=e=>Pl(e).length>0||$l(e)||Boolean(zr(e.type)),Ll=e=>Boolean(zr(e)),Al=(e,n,t,o)=>{if(lr(V),zr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),wo.select({index:n,zone:e}),l(t)}else wo.select({index:n,zone:e}),l(t)},Rl=(e,n,t,o,r)=>{const i=`${e}:${n}`;wo.insertComponent(i,t,o),zr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),wo.select({index:o,zone:i})}):wo.select({index:o,zone:i})},Fl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach(e=>{const n=zr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Fl.current.has(t))return;Fl.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(Mi)).forEach((e,t)=>vo.seedChild(o,t,n.childType,e))})},[vi,vo,Mi]);const Dl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach((e,n)=>{const t=e.props.id;if(Dl.current.has(t))return;const o=r(e,Nl(e.type));Dl.current.add(t),o&&vo.replaceComponent(Oe,n,{...e,props:o})})},[vi,vo]),_(vo,Xt);const Vl=vi.findIndex(oo),Wl=Vl>=0?vi[Vl]:null,Hl=ro?vi.findIndex(to):-1,Yl=Hl>=0?vi[Hl]:null,Ul=Gt.groupTab,Jl=Dn(()=>Ul?e=>_t(e.type):void 0,[Ul]),Xl=Boolean(Gt.groupBadge),Gl=Gt.sharedReach,Ql=e=>Gl?.(e)??void 0,Kl=Dn(()=>Gl?new Set(vi.filter(e=>Ql(e)).map(e=>String(e.props.id))):null,[vi,Gl]),Zl=Dn(()=>Kl?e=>Kl.has(e):void 0,[Kl]),_l=Gt.first?Gl?.({type:Gt.first,props:{id:""}})??void 0:void 0,ql=Gt.groupBadge?/* @__PURE__ */ht("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ht(Gn,{tone:"info",size:"xs",children:Gt.groupBadge})}):void 0,es=vi.find(e=>e.type===Kt)??null,ns=vi.find(e=>e.type===Zt)??null,ts=Vl>=0?Vl:vi.length,os=[];vi.forEach(e=>{oo(e)||(jl(e)&&os.push(String(e.props.id)),os.push(...Tl(e,1,Ll)))}),Wl&&(os.push(String(Wl.props.id)),os.push(...Tl(Wl,1,Ll)));const rs=os.length>0&&os.every(e=>Dr.has(e)),is=e=>{const n=Nr.blockRowName(e,Ei);return Nr.rowName?Nr.rowName(e,"block",n):n},ls=(e,n,t,o)=>{const r=Ri(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),Ri(n).length)},s=Sn(i,l);if(e!==n||s!==t)try{Ci.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Nn))throw e}},ss=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Il(e))n.add(r),t(o)};for(const t of Nl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ds=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Li.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},as=e=>{const n=e.slice(0,e.indexOf(":")),t=vi.find(e=>_t(e.type)&&String(e.props.id)===n);return t&&qt(n)===e?t:null},cs=(e,n)=>{const t=as(e);return!t||(!Gt.groupAccepts||Gt.groupAccepts(t.type,n,Ri(e).length))},ps=(e,n,t)=>{if(e.rung){const t=Fi(e.rung.nodeId),o=t?Di(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ot&&n.index>=0&&n.index<=o}if(n.slot===Ot)return!1;if(e.add)return ms(e.add,n);const o=zn(n);if(_t(e.type))return!1;const r=as(o),i=as(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!cs(o,e.type))&&(n.index>=0&&n.index<=Ri(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=ki();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ri(o).length)return!1;if(e.zone===o)return!0;const l=Wl&&!Gt.lastIsOpen?String(Wl.props.id):null;return(!l||ds(e.zone)!==l&&ds(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ri(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Li.get(i),s=l?Ri(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ss(r).has(n))return!1;const d=zr(s.type,wr(Wt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Or(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ri(n),r))})(e.zone,o,e.index,t)},us=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?cs(t,o.type):ps({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},fs=e=>{const n=e.slice(0,e.indexOf(":")),t=Li.get(n),o=t?Ri(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=zr(o.type,wr(Wt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Or(o));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:Ei(r.spec.childType)}]:[])),l=Vi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:bl(o,t.zone===Oe)}},hs=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===Oe||as(t)?e:fs(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ms=(e,n)=>{const t=hs(e,n),o=zn(n);if("shared"===t.kind){if(o!==Oe||!Gt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(as(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return cs(o,e)&&n.index>=0&&n.index<=Ri(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=fs(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ri(o))},gs=(e,n)=>{const t=hs(e,n);if("block"!==t.kind&&as(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&cs(n,o)){if("section"===e.kind)wo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;wo.insertNode(n,t,xi(e.template.node))}lr(V),wo.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void hl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=pl(t),r=wo.insertNode(Oe,o,n);fl(o,r,e)})(t.template.name,xi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr});if(!o)return;const r=pl(t),i=wo.insertNode(Oe,r,o);fl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Gt.shared?.nodeOf(t.section);if(!e)return;const o=pl(n.index);return void(Ci.restore(e,{parentId:wn,slot:xn,index:o})&&fl(o,e.props.id,t.section.title))}const o=zn(n),r=fs(o);r&&(r.target.spec?Rl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{wo.insertComponent(e,n,t),lr(V),wo.select({index:t,zone:e})})(o,t.type,n.index))},ys=(e,n)=>{e.media?function(e){const n=ed();if(!n||!Zs)return;td(n).then(n=>{n&&function(e,n){if(!Zs)return;const t=Zs.create(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),o=zn(n);if(o===Oe){const e=pl(n.index),o=wo.insertNode(Oe,e,t);return void fl(e,o,Ti(t.type))}wo.insertNode(o,n.index,t),lr(V),wo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Xi(e.rung.nodeId,e.index,n.index):e.add?gs(e.add,n):e.zone===Oe?ul(e.index,n.index):ls(e.zone,zn(n),e.index,n.index)},[bs]=Vn(()=>vn()),vs=kn({keyOf:e=>e.id,readOnly:Boolean(jt),session:bs,canDrop:ps,onDrop:ys,onStep:(e,n)=>{e.rung?Xi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Ti(vi[e]?.type??""),o=ul(e,n<0?e-1:e+2);if(!o.moved)return void _r(n<0?lo.sectionFirst({name:t}):lo.sectionLast({name:t}));const{floor:r,cap:i}=ki();_r(lo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ls(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ks=Hn(e=>{const{floor:n,cap:t}=ki(),o=[];for(const r of e.nodes){const e=zn(r.place),i=Ri(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(to(i)||oo(i)||kr(i.type,i))continue;if(_t(i.type))continue;const l=Boolean(as(e)),s=e===Oe||l;e===Oe&&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?Ti(i.type):Ki(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:lo.addSection,addAlways:!0}];const t=fs(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(as(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===Oe||as(n)?null:fs(n);return t?.choices.length?mn(e,t.target.spec?.addLabel??lo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Wt.data]),Ss=null==Ut?.props.id?null:String(Ut.props.id),ws=Un(Re),xs=ws?.selected()&&Uo?.document&&Ss?ws.selectedPart?.(Uo.document)??null:null,zs=xs&&Ss&&Fe(Wt.data,Xt,Ss,xs)?xs:null,Cs=zs?.label?{element:zs.element,label:zs.label}:null,Os=null!==zs,Ns=Hn(e=>{const n=Xt,t=e=>!e.item.rung&&null!==On(Wt.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(Ss);return i?Os?null:i:r(_e(Wt.data,n,o.item.id,Ss,Jl))??o},[Wt.data,Xt,Ss,Jl,Os]),[Is,Bs]=Vn(null),[Ps,$s]=Vn(null),Es=Boolean(Ul||Gl);En(Uo,"mouseover",e=>{if(!Es)return;const n=Tn(e.target),t=n?kt(Wt.data,Xt,n):null;t!==Is&&Bs(t)}),En(Uo,"mouseout",e=>{Es&&!e.relatedTarget&&Bs(null)});const Ms=e=>to(e)||oo(e)||_t(e.type),Ts=e=>{const n=_t(e.type)?Ei(e.type):to(e)?lo.header:oo(e)?lo.footer:null;return null===n?ji(e):Nr.rowName?Nr.rowName(e,"section",n):n},js=[];if(Es){const e=Ss?kt(Wt.data,Xt,Ss):null;for(const n of/* @__PURE__ */new Set([e,Is,Ps])){const e=n?vi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=to(e)||e.type===Kt,o=Ql(e);if(o){js.push({id:String(e.props.id),label:Ts(e),below:t,reach:o});continue}if(!Ul||!Ms(e))continue;const r=Ul(e);r&&js.push({id:String(e.props.id),label:r,below:t})}}const Ls=fe(),As=Fn(null);Wn(()=>{const e=Gt.changeNotice;if(!e)return;const n=JSON.stringify(vi.filter(Ms)),t=As.current;if(As.current={doc:Xn,bands:n,index:Yt.index},!t||t.doc!==Xn||t.bands===n)return;Yt.hasPast&&Yt.index>=t.index&&!vt.has(Ls)&&(vt.add(Ls),_r(e,"success",{action:{label:lo.bar.undo,onClick:()=>Yt.back()},duration:8e3}))},[vi]);const Rs=e=>{lr(V),wo.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},Fs=q(),Ds=()=>({data:Wt.data,device:$o,ops:wo,inspector:gr}),Vs=Fs?.model,Ws=Dn(()=>Vs?e=>Vs(e,ks(e),Ds()):ks,[Vs,ks,$o]),Hs=Fs?.measure,Ys=Hs?(e,n)=>Hs(e,n,Ds()):void 0,Us=Fs?.canDrop,Js=Us?(e,n)=>Us(e,n,ps,Ds()):ps,Xs=Fs?.drop,Gs=Xs?(e,n)=>Xs(e,n,ys,Ds()):ys,Qs=Fs?.pick,Ks=Qs?e=>Qs(e,Rs,Ds()):Rs,Zs=Fs?.media??null,_s=Fn(null),qs=Dn(()=>Zs?{id:yt,zone:"",index:-1,type:Zs.adds.type,add:{kind:Zs.adds.kind,type:Zs.adds.type},media:!0}:null,[Zs]);Wn(()=>{if(!qs||jt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(rt))(e)&&(_s.current=null,bs.start({key:yt,item:qs}))},n=e=>{bs.get()?.item.media&&(_s.current=_n(e.dataTransfer))},t=()=>{bs.get()?.item.media&&bs.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[qs,jt,bs]);const ed=()=>{const e=_s.current;return _s.current=null,e},nd=ce(),td=async e=>{if(!nd)return e;const n=await nd(e);return n?{...e,id:n.id,url:n.url}:null};const od=(e,n)=>{if(!Zs)return;const t=On(So.getState().appState.data,Si,n);if(!t)return;const o=t.node;wo.replaceComponent(zn(t.place),t.place.index,{...o,props:{...Zs.replace(o,e),id:o.props.id}})},rd=e=>{const n=zn(e),t=Vi(n);t&&Ui(t.node,t.slot,!1),gl(n,e.index)},id=(e,n)=>/* @__PURE__ */ht(Xe,{...jt?{}:vs.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),ld={rowClick:vl,isCollapsed:Xr,toggleCollapse:Gr},sd=e=>{const n=String(e.props.id),t=vi.findIndex(e=>String(e.props.id)===n),o=qt(n),r=Ri(o),i=Xr(n),l=Ei(e.type),s=Nr.rowName?Nr.rowName(e,"section",l):l,d=e=>id(o,e);/* @__PURE__ */
|
|
16
|
-
return mt(gt,{children:[
|
|
17
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:s,preview:Sl(e),marks:wl(e),onSelect:()=>cl(t),nameSlot:_i(Oe,t,n,s),selected:sr===n,badge:Ql(e)?void 0:ql,shared:Ql(e),actions:xl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:vl(()=>cl(t))},fold:{open:!i,label:"section",onToggle:()=>Gr(n)}}),!i&&/* @__PURE__ */mt(He,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ji(n),l=jl(n),s=l&&Xr(r),a=()=>Al(o,t,r,e.type),{rowProps:c,...p}=vs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:vl(a)});/* @__PURE__ */
|
|
18
|
-
return mt(Jn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:a,nameSlot:_i(o,t,r,i),selected:sr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(o,t,i),xl(n,o,t),zl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ht(He,{children:cd(n,2)})]},r)}),d(r.length)]})]})},dd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vs.dragging,d=!Xr(l)&&s?.rung?.nodeId!==i,a={...Cn(l),index:0},c=s&&!s.rung&&ps(s,a)?a:void 0,p=()=>Ui(e,n,!0),{rowProps:u,...f}=vs.row({item:{id:`rung:${l}`,zone:`${i}:${Ot}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ot,index:t},into:c,canDrag:Boolean(vr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:vl(p)}),h=jt?null:vr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return mt(Jn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */ht(We,{words:so,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Wi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Gr(l)},actions:h&&h.length>0?/* @__PURE__ */ht(gt,{children:h.map((t,o)=>/* @__PURE__ */ht(Je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(jt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ji(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */ht(at,{size:15}):/* @__PURE__ */ht(ft,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ht(He,{children:r})]},l)},ad=(e,n)=>{const t=Bl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return ht(gt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=El(e,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>id(e,n),p=/* @__PURE__ */mt(gt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),{collapsible:i,folded:s}=Ml(n,l,Ll(n.type)),d=String(n.props.id),a=is(n),p=()=>Al(t,o,d,e.type),{rowProps:u,...f}=vs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:vl(p)});/* @__PURE__ */
|
|
23
|
-
return mt(Jn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:a,preview:Sl(n),marks:wl(n),onSelect:p,nameSlot:_i(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Gr(d)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(t,o,a),xl(n,t,o),zl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ht(He,{children:ad(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?dd(e,t.rung,r++,o,p):/* @__PURE__ */ht(Jn,{children:p},t.slot??"")})})},cd=(e,n)=>{const t=wr(Wt?.data,e.type,String(e.props.id)),o=Bl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return ht(gt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=El(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>id(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),b=/* @__PURE__ */mt(gt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),i=Ki(n),l=String(n.props.id),{collapsible:d,folded:a}=Ml(n,s,Ll(n.type)),c=Nl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Cn(p),index:Ri(p).length}:void 0,f=vs.dragging,h=u&&f&&ps(f,u)?u:void 0,g=()=>Al(t,o,l,e.type),{rowProps:y,...b}=vs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!kr(n.type,n)},{"data-node-id":l,onClick:vl(g)});/* @__PURE__ */
|
|
26
|
-
return mt(Jn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:g,nameSlot:_i(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...b,fold:d?{open:!a,label:"group",onToggle:()=>Gr(l)}:void 0,actions:kr(n.type,n)?xl(n,t,o)??void 0:/* @__PURE__ */mt(gt,{children:[kl(t,o,i),xl(n,t,o),zl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ht(He,{children:cd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */ht(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Rl(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?dd(e,o.rung,i++,r,b):/* @__PURE__ */ht(Jn,{children:b},o.slot??"")})})},pd=_o,ud=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:zo&&!pd&&br===e.id,onSelect:()=>yi(e.id)}:e,fd=[...(yr.railLead??[]).map(ud),{id:"sections",label:lo.layers,icon:/* @__PURE__ */ht(ge,{}),active:zo&&!pd&&"sections"===br,onSelect:()=>yi("sections")},...(yr.railTrail??[]).map(ud)],hd=To?{onPress:jo}:Ft?{onPress:()=>{x(Bn,{accept:"image/*",title:ho.mediaLibrary})}}:null,md={value:fd.find(e=>!0===e.active)?.id??"",press:e=>{const n=fd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:fd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ht("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},gd=[...yr.railLead??[],...yr.railTrail??[]].find(e=>"panel"in e&&e.id===br),yd=Boolean(io?.foldable),bd=io?.label??(Dt?lo.pageSections:lo.templateSections),vd=yd&&Xr(It),kd=/* @__PURE__ */mt(gt,{children:[vi.map((e,n)=>{if(to(e)||oo(e)||_t(e.type))return null;const t=sr===String(e.props.id),o=Boolean(e.props._hidden);Il(e);const r=String(e.props.id),i=yr.hasOwnRows?.(e)??!1,l=jl(e)||i,s=l&&Xr(r),d=Nl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Cn(a),index:Ri(a).length}:void 0,p=vs.dragging,u=c&&p&&ps(p,c)?c:void 0,{rowProps:f,...h}=vs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...Cn(Oe),index:n},into:u,canDrag:!kr(e.type,e)},{"data-node-id":r,onClick:vl(()=>cl(n))});/* @__PURE__ */
|
|
29
|
-
return mt(Jn,{children:[n>0&&Cl(n),
|
|
30
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:ji(e),preview:Sl(e),marks:wl(e),shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,r,ji(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(Oe,n,ji(e)),xl(e,Oe,n),zl(Oe,n,e,ji(e))]}),rowProps:f}),jl(e)&&!s&&/* @__PURE__ */mt(He,{children:[cd(e,1),yr.partRows?.(e,ld)]}),i&&!s&&/* @__PURE__ */ht(He,{children:yr.ownRows?.(e,n,ld)})]},String(e.props.id??n))}),ts>0&&Cl(ts)]}),Sd=(e,n,t)=>{const o=String(e.props.id),r=Pl(e).length>0||$l(e)||Boolean(zr(e.type)),i=r&&Xr(o),l="header"===t?lo.header:lo.footer,s=Nr.rowName?Nr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return mt(gt,{children:[
|
|
32
|
-
/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:t,size:13}),name:s,preview:Sl(e),marks:wl(e),badge:Ql(e)?void 0:ql,shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,o,s),selected:sr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Gr(o)}:void 0,actions:xl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:vl(()=>cl(n))}}),r&&!i&&/* @__PURE__ */ht(He,{children:ad(e,1)})]})};return(yr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */ht(ee,{target:Uo,children:/* @__PURE__ */mt("div",{ref:Yo,className:"sf-editor es-editor",style:dn(Wr),onContextMenu:rl.onEditorContextMenu,...p(Bn),children:[
|
|
34
|
-
/* @__PURE__ */mt(qe,{children:[
|
|
35
|
-
/* @__PURE__ */mt("div",{className:"es-cluster es-cluster--left",children:[hd?/* @__PURE__ */ht(Qn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ht(ye,{}),onClick:hd.onPress,children:lo.railMedia}):null,
|
|
36
|
-
/* @__PURE__ */ht(en,{label:lo.bar.undo,disabled:Boolean(jt)||!Yt.hasPast,onClick:()=>Yt.back(),children:/* @__PURE__ */ht(it,{})}),
|
|
37
|
-
/* @__PURE__ */ht(en,{label:lo.bar.redo,disabled:Boolean(jt)||!Yt.hasFuture,onClick:()=>Yt.forward(),children:/* @__PURE__ */ht(lt,{})})]}),
|
|
38
|
-
/* @__PURE__ */mt(nn,{children:[
|
|
39
|
-
/* @__PURE__ */ht(tn,{devices:Oo,value:$o,onChange:Eo}),
|
|
40
|
-
/* @__PURE__ */ht(en,{label:lo.bar.refresh,tip:lo.bar.refreshTip,onClick:()=>{Ho.current=(()=>{const e=Uo?.document;if(!e)return null;const n=vi.findIndex(oo),t=n>=0?n:vi.length;let o=null;for(let n=0;n<t;n++){const t=vi[n]?.props?.id;if(null==t)continue;const r=Rn(e,`[data-easel-block="${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=Ut?.props?.id??vi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Wo(e=>e+1)},children:/* @__PURE__ */ht(st,{})}),yr.barView?.()]}),
|
|
41
|
-
/* @__PURE__ */mt(nn,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
-
/* @__PURE__ */ht(v,{input:Ko,words:lo.saveStatus}),jn?/* @__PURE__ */ht(jn,{}):null,yr.barLead?.(),yr.barTrail?.(),yr.mainAction||!yr.barMain?/* @__PURE__ */ht(k,{input:Ko,action:qr,readOnly:Boolean(jt),saveSwitch:At,onToggleAutoSave:$t,onSaveNow:Zo,bar:lo.bar,words:lo.saveStatus}):yr.barMain()]})]}),
|
|
43
|
-
/* @__PURE__ */ht(b,{}),
|
|
44
|
-
/* @__PURE__ */mt("div",{className:"sf-body",children:[zo?/* @__PURE__ */mt(gt,{children:[
|
|
45
|
-
/* @__PURE__ */mt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":lo.leftPanel,children:[
|
|
46
|
-
/* @__PURE__ */mt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */ht(I,{side:"left",onHide:mi}),
|
|
48
|
-
/* @__PURE__ */ht("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */ht(Kn,{variant:"underline",block:!0,"aria-label":lo.bar.views,value:md.value,onChange:md.press,items:md.items})]}),_o?/* @__PURE__ */ht(C,{at:nr?{label:(e=>{const n=as(e.zone);if(n)return lo.add.addingTo({name:Nr.rowName?bl(n,!0):Ei(n.type)});if(e.zone===Oe){const n=vi[e.index];return n&&!oo(n)?lo.add.addingBefore({name:bl(n,!0)}):lo.add.addingAtEnd}const t=fs(e.zone);return t?lo.add.addingTo({name:t.parentName}):lo.add.addingHere})(nr),onClear:()=>tr(null)}:void 0,placeBlocks:nr&&nr.zone!==Oe?fs(nr.zone)?.choices:void 0,canTake:nr?e=>{if(!nr)return null;const n={...Cn(nr.zone),index:nr.index};if(ms(e,n))return null;if("shared"===e.kind&&nr.zone===Oe&&!Gt.shared?.nodeOf(e.section))return lo.shared.alreadyHere;const t=as(nr.zone);if(t)return lo.add.notInside({name:bl(t,!0)});if(nr.zone===Oe)return lo.add.onlySections;const o=fs(nr.zone);return o?lo.add.notInside({name:o.parentName}):lo.add.onlySections}:void 0,onPick:nr?e=>{if(!nr)return;const n={...Cn(nr.zone),index:nr.index};ms(e,n)&&(gs(e,n),yl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Nt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Nt(e),add:e}),session:bs,siteWide:yr.addPanelRow?.(yl),onClose:yl,readOnly:Boolean(jt)}):gd?gd.panel({onHide:mi,notify:_r}):/* @__PURE__ */mt(gt,{children:[
|
|
50
|
-
/* @__PURE__ */ht(B,{icon:/* @__PURE__ */ht(ge,{}),title:lo.layers,context:mo,actions:/* @__PURE__ */mt(gt,{children:[!jt&&/* @__PURE__ */ht(on,{label:lo.add.title,onClick:()=>ml(null),children:/* @__PURE__ */ht(dt,{size:15})}),
|
|
51
|
-
/* @__PURE__ */ht(on,{label:rs?lo.expandAll:lo.collapseAll,title:0===os.length?lo.nothingToFold:void 0,disabled:0===os.length,onClick:()=>Vr(e=>{const n=new Set(os);return rs?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...os])}),children:/* @__PURE__ */ht(xt,{expand:rs})})]})}),
|
|
52
|
-
/* @__PURE__ */mt(Ye,{className:"sf-tree sf-scroll",words:so,children:[es&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),sd(es)]}),Vt&&!(Xl&&es)&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),!ro&&/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:"header",size:13}),name:lo.header,badge:_l?void 0:ql,shared:_l,onSelect:bi,selected:ir.kind===no?.kind,rowProps:{onClick:vl(bi)}})]}),Yl&&!(Xl&&es)&&Sd(Yl,Hl,"header"),!yd&&/* @__PURE__ */ht(Ue,{children:bd}),yd?/* @__PURE__ */mt(gt,{children:[
|
|
53
|
-
/* @__PURE__ */ht(We,{words:so,icon:null,name:bd,fold:{open:!vd,label:bd,onToggle:()=>Gr(It)}}),!vd&&/* @__PURE__ */ht(He,{children:kd})]}):kd,Vt&&!Xl&&/* @__PURE__ */ht(Ue,{children:lo.footer}),Wl&&!(Xl&&ns)&&Sd(Wl,Vl,"footer"),ns&&sd(ns),yr.treeFoot?.()]})]})]}),
|
|
54
|
-
/* @__PURE__ */ht(rn,{side:"left",width:Wr.left,min:sn.left,max:ln,defaultWidth:h.left,label:lo.resizeLeftPanel,onResize:Ur})]}):/* @__PURE__ */ht(P,{side:"left",onShow:mi}),
|
|
55
|
-
/* @__PURE__ */mt("div",{ref:ni,className:"sf-center sf-scroll","data-sf-canvas-head":li?"":void 0,style:{overflowX:ui?"auto":"hidden",overflowY:"hidden"},children:[li&&/* @__PURE__ */ht("div",{ref:si,className:"sf-canvas-head",children:/* @__PURE__ */ht(li,{device:$o})}),
|
|
56
|
-
/* @__PURE__ */mt("div",{className:"sf-frame-scaler",style:fi,children:[
|
|
57
|
-
/* @__PURE__ */ht("div",{className:"sf-frame "+($o===Bo?"":`sf-frame--${$o}`),style:hi,children:/* @__PURE__ */mt("div",{className:"sf-preview-host",children:[
|
|
58
|
-
/* @__PURE__ */ht(De.Provider,{value:Jl,children:/* @__PURE__ */ht(Ve.Provider,{value:Zl,children:/* @__PURE__ */ht(go,{},Vo)})}),
|
|
59
|
-
/* @__PURE__ */ht(gn,{canvas:Uo,session:bs,model:Ws,measure:Ys,canDrop:Js,onDrop:Gs,choose:Ns,tag:Cs,onPick:Ks,dropOn:Zs?{accepts:(e,n)=>{if(!e.media||!Zs||n.item.rung)return!1;const t=On(Wt.data,Si,n.item.id);return null!==t&&Zs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=ed();n&&Zs&&td(n).then(n=>{n&&od(n,e.item.id)})})(n),label:()=>lo.canvasReplaceImage}:void 0,onZoneAdd:rd,onSeamAdd:rd,zoneAddLabel:lo.canvasAddBlock,words:ao.canvas,readOnly:Boolean(jt),revision:Wt.data}),or.length>0&&!Jo&&/* @__PURE__ */ht("div",{className:"sf-preview-gaps",children:or.map(e=>
|
|
60
|
-
/* @__PURE__ */ht(yn,{index:e.index,label:lo.addSectionHere,onInsert:()=>ml(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),Es?/* @__PURE__ */ht(wt,{canvas:Uo,tabs:js,onSelect:Yi,onPointer:$s}):null]})]}),Co?/* @__PURE__ */mt(gt,{children:[Ln?
|
|
61
|
-
/* @__PURE__ */ht("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Ln}):/* @__PURE__ */ht(gt,{children:/* @__PURE__ */ht(u,{value:{selectChild:Al,addChild:Rl,childRowName:Ki,blockRowName:is},children:/* @__PURE__ */ht(yo,{mode:ir,onOpenWebsiteSettings:yr.openSettings??(()=>{}),onOpenSiteStyles:yr.openStyles,onOpenPageStyles:yr.openPageStyles,onSelectNode:Mr,onNotify:_r,onHidePanel:gi,nodeActions:Ut?Ne(Xt,Ut.type):Bt})})}),
|
|
62
|
-
/* @__PURE__ */ht(rn,{side:"right",width:Wr.right,min:sn.right,max:ln,defaultWidth:h.right,label:lo.resizeSettingsPanel,onResize:Jr})]}):
|
|
63
|
-
/* @__PURE__ */ht(P,{side:"right",onShow:gi})]}),rl.menu,
|
|
64
|
-
/* @__PURE__ */ht(ie,{}),Ni?/* @__PURE__ */ht(bt,{name:Ni.name,onMake:e=>(async(e,n)=>{const t=vi.find(n=>String(n.props.id)===e),o=Gt.shared;if(!t||!o)return;let r;try{r=await N(Oi).create(n,t)}catch{return void _r(lo.shared.makeFailed,"error")}o.adopt(t,r),Ii(null)})(Ni.id,e),onCancel:()=>Ii(null)}):null]})}))}export{$t as ScreenChrome};
|
package/dist/chunk-GJ427TZL.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-MTWQYLJE.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-TUIBPB77.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as u}from"./chunk-L36E2WCO.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as O,toast as I,Dialog as T,Button as $}from"efficient-shell/ui";import{jsx as x,jsxs as F,Fragment as G}from"react/jsx-runtime";function M({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
-
return x(T,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */F(G,{children:[
|
|
3
|
-
/* @__PURE__ */x($,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
-
/* @__PURE__ */x($,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var W=e=>`section:${e}`,B=e=>`block:${e}`,L=e=>`template:${e}`,Q=e=>`shared:${e}`,S=e=>`preset:${e}`;function D({at:C,placeBlocks:T,canTake:$,onPick:D,itemFor:H,session:N,siteWide:U,onClose:Y,onHide:z,readOnly:A}){const J=u(e=>e.config),V=a(),{labelAtLevel:P,categoryLabel:R,firstSection:Z,Icon:_,Thumbnail:X}=V,{blockIsOffered:q,canAddTo:K}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>q(e,ne);return r(ne).list().then(n=>{if(e)return;const r=J.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>q(e,ne);return l(ne).list().then(n=>{if(e)return;const r=J.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(J,V),[J]),he=e=>P(e,"section",J.components[e]?.label??e),ke=e=>({type:e.preset?S(e.preset.key):W(e.type),label:e.name,cover:/* @__PURE__ */x(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */x("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */x(_,{type:e,size:26})}),ve=j(()=>{const e=t(ye,Z),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!q(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=K(t.type)?.choices??[];e.forEach(r),e.forEach(e=>K(e.type,1)?.choices?.forEach(r))}T?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:B(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:Q(e.id),label:e.title,cover:/* @__PURE__ */x(X,{type:e.node.type}),mark:/* @__PURE__ */x(w,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:L(e.id),label:e.name,cover:/* @__PURE__ */x(X,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(J.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(J,t,R),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!$)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?$(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[oe,se,ie,ye,J,ee,$,T,ne]);/* @__PURE__ */
|
|
5
|
-
return F(G,{children:[
|
|
6
|
-
/* @__PURE__ */x(i,{icon:/* @__PURE__ */x(E,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */x(s,{label:ee.done,description:ee.doneDescription,onClick:Y}),onHide:z}),
|
|
7
|
-
/* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */x(k,{groups:ve,session:N,itemFor:e=>H(ge(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=ge(e);t&&D(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!A&&(me({section:n.section,...t}),!0)},at:C,hint:ee.hint,searchLabel:ee.search,readOnly:A,words:te}),U??null]}),de?/* @__PURE__ */x(O,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */x(M,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void I.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{D as AddSidePanel,B as blockKey,S as presetKey,W as sectionKey,Q as sharedKey,L as templateKey};
|
package/dist/chunk-J5VPNHOW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-3FANFZ4D.js";import{SELECTION_MODE as e}from"./chunk-TUIBPB77.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-L36E2WCO.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-TUIBPB77.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-L36E2WCO.js";import{Inspector as i}from"./chunk-SDSBXW3V.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,S=()=>"",j=()=>null,C=()=>{},w={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},B={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},N={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
-
return f(r,{height:"fill"})}function I(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
|
-
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var x=l({});function A({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return f(x.Provider,{value:n,children:e})}function F(){return s(x)}function G(){return(F().useOwnerName??S)()}function T(){return(F().useDocumentLabel??j)()}function V(n,e,t,r){return(F().useBridges??O)(n,e,t,r)}function W(n){return(F().useStandaloneBridges??O)(n)}function X(n,e){(F().useDocumentPass??C)(n,e)}function Y(){return F().blockRules??w}function E(){return F().blockLook??L}function Q(){return F().devices??B}function R(){return F().leftView??D}function H(){return F().pinned??N}function K(){return F().saveSwitch??!0}function M(e){n(!0===F().pickFollowsSelection,e)}function Z(){return F().storageNamespace||void 0}function q(){return F().styleClipboard??null}function z(){return F().nodeKeys??!0}function J(){return F().notify??null}function U(){return F().Canvas??P}function $(){return F().CanvasHead??null}function _(){return F().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return F().Inspector??I}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,A as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,E as useScreenBlockLook,Y as useScreenBlockRules,V as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,Q as useScreenDevices,T as useScreenDocumentLabel,X as useScreenDocumentPass,rn as useScreenInspectorPanel,R as useScreenLeftView,z as useScreenNodeKeys,J as useScreenNotify,G as useScreenOwnerName,F as useScreenParts,M as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,Z as useScreenStorageNamespace,q as useScreenStyleClipboard,W as useStandaloneScreenBridges};
|
package/dist/chunk-WW24O7HT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-G2VZ4DET.js";import{styleMenuItems as o}from"./chunk-3OOYGEJY.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{repeatCopyAt as r}from"./chunk-XT75WETI.js";import{easelMenuEntries as i,menuLabel as c}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as s,nodeMenuItems as a}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as u}from"./chunk-WK3AFPXY.js";import{zoneKey as d,ROOT_SLOT as p,ROOT_ID as f}from"./chunk-YDTEYXQW.js";import{useCanvasEvent as m}from"./chunk-6GJEOER4.js";import{isTypingTarget as y,framePointToHost as h}from"./chunk-FR7EEKFF.js";import{useState as k,useCallback as b,useRef as v,useEffect as x}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{TrashIcon as w,AddIcon as C,MoveUpIcon as O,MoveDownIcon as z,UndoIcon as P,RedoIcon as A,PasteIcon as E,StylesIcon as T,LayersIcon as j,CopyIcon as Y}from"efficient-shell/icons/efficient";import{jsx as D}from"react/jsx-runtime";function M(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var I=s(),K=/* @__PURE__ */new WeakMap;function X(e){if(e.claimsPage)return I;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",s);let t=K.get(n);return t||(t=s(),K.set(n,t)),t}function L(){return X(e())}function S(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:f,slot:p,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function R(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function V(e,n,t){const o=e.canPasteAt;if(!o)return d(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of M(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function B(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(y(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function F(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=R(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:V(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function G(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,s=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),y=e.permits?.(i)??{duplicate:!0,delete:!0},h=R(e,i,t),k=M(e,n),b=d.held,v=b&&!p?V(e,b,n):null,x=!e.readOnly,g=e.style?o({held:x?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return a({title:s,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:x&&m&&y.duplicate?()=>d.duplicate(c):void 0,...N(x&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:h.copy?()=>d.copy(c,s):void 0,cut:x&&h.cut?()=>d.cut(c,s):void 0,paste:x&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:x&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!x||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:x&&m&&y.delete?()=>d.remove(c):void 0},style:g,extras:W(x?U(e,n.copy):null,e.menuRows?.(i,t,r)),pinnedLine:p?Q(e).pinned:void 0})}function U(e,n){const o=e.copyItem;if(!o||!n)return null;const l=Q(e),r=t.menu,i=e=>l[e]??r[e]??"",c={ownerId:n.ownerId,slot:n.slot,index:n.index,...n.outer?{outer:n.outer}:{}},s=e=>()=>o({...c,action:e});return{make:[{label:i("itemAddAfter"),icon:/* @__PURE__ */D(C,{}),onClick:s("addAfter")},{label:i("itemMoveEarlier"),icon:/* @__PURE__ */D(O,{}),onClick:s("moveEarlier"),disabled:n.index<=0},{label:i("itemMoveLater"),icon:/* @__PURE__ */D(z,{}),onClick:s("moveLater"),disabled:n.index>=n.count-1}],remove:[{label:i("itemDelete"),icon:/* @__PURE__ */D(w,{}),danger:!0,onClick:s("delete")}]}}function W(e,n){if(!e)return n??void 0;if(!n)return e;return Object.fromEntries(["pick","make","change","remove"].map(t=>[t,[...e[t]??[],...n[t]??[]]]).filter(([,e])=>e.length>0))}function N(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var Q=e=>e.words?.screen??t.menu;function Z(e){const n=Q(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */D(P,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */D(A,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):d(c.from)===l)){const n=s,t=e.words?.menu??u;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */D(E,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const a=[r,i,[...e.openPageStyles?[{label:e.pageStylesLabel??t.pageStyles,icon:/* @__PURE__ */D(T,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */D(j,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),p={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[p,...e]:e)}function J(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??u,c=Q(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */D(Y,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */D(Y,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */D(E,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function _(e){return e.shiftKey}function $(e,t){const[o,l]=k(null),i=b(()=>l(null),[]);n(null!==o,i);const c=v(e);c.current=e;const s=b(e=>{const n=c.current,t=n.keys;if(!t)return;const o=B(e);if(!o)return;const l=t.selected();if(!l)return;const r=F(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;x(()=>{if(!a)return;const e=e=>s(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,s]),m(t,"keydown",s);const u=b(n=>{if(_(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);m(t,"contextmenu",n=>{if(_(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,i=o?.getAttribute("data-easel-block"),c=i?e.locate(i):null;n.preventDefault();const s=h(t.frame,n.clientX,n.clientY),a=t.frame,u=o?r(o):null;l(c?{kind:"node",...s,...c,copy:u,owner:a}:{kind:"empty",...s,owner:a})}),m(t,"mousedown",i),m(t,"scroll",i,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */D(q,{host:e,target:o,onClose:i}):null,closeMenu:i}}function q({host:e,target:n,onClose:t}){const o="node"===n.kind?G(e,n):"input"===n.kind?J(e,n.el):Z(e);return 0===o.length?null:/* @__PURE__ */D(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":c(o),items:i(o)})}export{I as EASEL_NODE_CLIPBOARD,M as ancestorChain,X as nodeClipboardOf,R as nodeClipboardRules,G as nodeMenuItems,B as nodeShortcut,Z as pageMenuItems,V as pastePlace,F as runNodeShortcut,J as textMenuItems,L as useNodeClipboard,$ as useNodeContextMenu};
|
package/dist/chunk-XT75WETI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{parseZoneKey as t}from"./chunk-YDTEYXQW.js";import{repeatWrapperAt as e,REPEAT_ATTRIBUTE as r,REPEAT_INDEX_ATTRIBUTE as n}from"./chunk-7UFKEX72.js";var o=`[${r}][${n}]`;function l(l){const c=e(l);if(!c)return null;let i;try{i=t(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(r)===p&&d.add(t.getAttribute(n)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const r of Array.from(t.querySelectorAll(o))){if(r.getAttribute(n)!==String(e.index))continue;const t=l(r);if(t?.wrapper===r&&c(t.copy,e))return r}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
|