efficient-easel 15.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/{chunk-YQVR54RE.js → chunk-2L2L7G5L.js} +1 -1
- package/dist/chunk-44COUKXO.js +5 -0
- package/dist/chunk-4BGYVIDQ.js +57 -0
- package/dist/{chunk-3Z2MVLCD.js → chunk-4ES5JGGX.js} +1 -1
- package/dist/chunk-ATOXCKEE.js +4 -0
- package/dist/chunk-BALFHI3G.js +2 -0
- package/dist/{chunk-GS44HQ45.js → chunk-GPLMNRHR.js} +1 -1
- package/dist/{chunk-NBDMTIU2.js → chunk-HV56SLR2.js} +2 -2
- package/dist/chunk-IN22IYOM.js +1 -0
- package/dist/{chunk-JASNL4KG.js → chunk-JQOYUH4A.js} +3 -3
- package/dist/chunk-K6EM4F5N.js +21 -0
- package/dist/{chunk-GOABCALQ.js → chunk-L2VGRQ4R.js} +1 -1
- package/dist/{chunk-XT6DOSHO.js → chunk-L3GSW4XI.js} +1 -1
- package/dist/{chunk-SMM3ST7A.js → chunk-QX7GVECM.js} +11 -11
- package/dist/{chunk-HM7S7H5H.js → chunk-RFSLDGDA.js} +1 -1
- package/dist/chunk-U25CP5VX.js +5 -0
- package/dist/chunk-UVQR7W6I.js +1 -0
- package/dist/{chunk-OJ6QWOLG.js → chunk-V6VKM2QX.js} +1 -1
- package/dist/chunk-WXFZD7WC.js +1 -0
- package/dist/chunk-XQGV2XAK.js +1 -0
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/menu/index.d.ts +22 -27
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.css +7 -6
- package/dist/panel/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/SaveControls.d.ts +2 -0
- package/dist/screen/components/SaveControls.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.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/preview-dom.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.d.ts +21 -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 +20 -20
- package/package.json +3 -3
- package/dist/chunk-5EPK5WB3.js +0 -1
- package/dist/chunk-BXMXTO36.js +0 -1
- package/dist/chunk-EA2HTX37.js +0 -5
- package/dist/chunk-EHBWUEEE.js +0 -5
- package/dist/chunk-FRXE6EQN.js +0 -5
- package/dist/chunk-QKZPPI5O.js +0 -57
- package/dist/chunk-RSKHAHPJ.js +0 -4
- package/dist/chunk-SO5OLDH7.js +0 -21
- package/dist/chunk-VJZDNOQ7.js +0 -1
- package/dist/chunk-Z62Z75UI.js +0 -1
package/README.md
CHANGED
|
@@ -1051,13 +1051,15 @@ runs the same rules (`--axe <axe.min.js>`).
|
|
|
1051
1051
|
<EaselContextMenu x={e.clientX} y={e.clientY} owner={e.currentTarget} items={items} onClose={close} />
|
|
1052
1052
|
```
|
|
1053
1053
|
|
|
1054
|
-
Or the shell's own
|
|
1054
|
+
Or the shell's own menu, with the editors' item list as its `items`
|
|
1055
|
+
(efficient-shell 8.18.0, #580: the shell draws every row with its one
|
|
1056
|
+
renderer; `EaselMenuItems` is gone since this change):
|
|
1055
1057
|
|
|
1056
1058
|
```tsx
|
|
1057
1059
|
import { ContextMenu, useContextMenu } from 'efficient-shell/ui';
|
|
1058
|
-
import {
|
|
1060
|
+
import { easelMenuEntries } from 'efficient-easel/menu';
|
|
1059
1061
|
|
|
1060
|
-
{menu.state && <ContextMenu {...menu.props}
|
|
1062
|
+
{menu.state && <ContextMenu {...menu.props} items={easelMenuEntries(items)} />}
|
|
1061
1063
|
```
|
|
1062
1064
|
- **A dropdown's open list has a name.** In a settings row
|
|
1063
1065
|
(`InspectorField`) the list is `aria-labelledby` the row's own label. A
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-U25CP5VX.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-QX7GVECM.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-U25CP5VX.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{AddPanel as d}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as f}from"./chunk-KAML3KQH.js";import{useEasel as y}from"./chunk-QX7GVECM.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var O=e=>`section:${e}`,E=e=>`block:${e}`,P=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:C,onPick:L,itemFor:T,session:x,siteWide:A,onClose:B,onHide:H,readOnly:I}){const M=y(e=>e.config),N=c(),{labelAtLevel:R,categoryLabel:F,firstSection:Q,Icon:W,Thumbnail:D}=N,{blockIsOffered:K,canAddTo:S}=a(),Y=h("screen",m).add,z=h("drag",f).add,G=p(),[J,X]=u([]);k(()=>{let e=!1;const t=e=>K(e,G);return n(G).list().then(o=>{if(e)return;const n=M.components;X(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[M,G]);const Z=b(()=>e(M,N),[M]),U=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */j(D,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Y.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=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=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(W,{type:e,size:26})}),ee=b(()=>{const e=t(Z,Q),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&K(e.type,G)&&n.set(e.type,e)};for(const t of e?[e]:Z){const e=S(t.type)?.choices??[];e.forEach(s),e.forEach(e=>S(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(Z.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:E(e.type),label:e.label,cover:_(e.type),title:Y.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];J.length>0&&p.push({key:"templates",title:Y.templates,tiles:J.map(e=>{return{type:P(e.id),label:e.name,cover:/* @__PURE__ */j(D,{type:e.node.type}),keywords:[(t=e.node.type,R(t,"section",M.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(M.categories??{})){const n=Z.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(M,t,F),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!C)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?C(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,Z,M,Y,C,w,G]);/* @__PURE__ */
|
|
2
|
+
return v(V,{children:[
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Y.title,context:Y.contextAll,actions:/* @__PURE__ */j(r,{label:Y.done,description:Y.doneDescription,onClick:B}),onHide:H}),
|
|
4
|
+
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */j(d,{groups:ee,session:x,itemFor:e=>T(q(e)??{kind:"section",type:e}),onInsert:L?e=>{const t=q(e);t&&L(t)}:void 0,at:$,hint:Y.hint,searchLabel:Y.search,readOnly:I,words:z}),A??null]})]})}export{$ as AddSidePanel,E as blockKey,O as sectionKey,P as templateKey};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{styleClipboardOf as e}from"./chunk-L3GSW4XI.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-ATOXCKEE.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-RFSLDGDA.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-XQGV2XAK.js";import{useSectionOps as b}from"./chunk-V6VKM2QX.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-44COUKXO.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as B}from"./chunk-GPLMNRHR.js";import{useScreenSaveSwitch as I,useScreenNodeKeys as O,useScreenPinned as N,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as L,sameInspectorMode as E,useScreenBridges as R,useScreenBlockRules as V,useScreenBlockLook as F,useScreenStorageNamespace as W,useScreenNotify as H,useScreenCanvasHead as D,isSlotMode as G,useScreenStyleClipboard as U,useScreenDocumentPass as X,useScreenCanvasDrag as J,ScreenCanvasTargetProvider as K,isPinnedFirst as Y,isPinnedLast as Q,screenSlotsOf as q}from"./chunk-U25CP5VX.js";import{useNodeClipboard as Z,useNodeContextMenu as _}from"./chunk-UVQR7W6I.js";import{PageEditGuardNotices as ee}from"./chunk-2H3W5OLQ.js";import{useScreenDocument as ne}from"./chunk-ZZ64CEC2.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-VVPZMWJE.js";import{heldStyle as ae,styleShortcut as pe}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as ke,blockNodeActions as Se,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{insertSeams as Be,CanvasDragLayer as Ie,CanvasInsert as Oe}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as Ne}from"./chunk-KAML3KQH.js";import{useEasel as Pe,useEaselApi as $e,CanvasPassThroughContext as Me}from"./chunk-QX7GVECM.js";import{toItemSelector as Te,useNodeOps as je,clickPick as Ae}from"./chunk-ECM5F6JJ.js";import{TreeRow as Le,Subtree as Ee,LayersTree as Re,TreeGroupLabel as Ve,TreeRowAction as Fe,TreeSeam as We}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as He}from"./chunk-K56YDHYQ.js";import{createDragSession as De,useTreeDrag as Ge,gapToMoveIndex as Ue}from"./chunk-67GNT6PF.js";import{LayersIcon as Xe,MediaIcon as Je}from"./chunk-4VJATVVR.js";import{useCanvasFrame as Ke,LIST_SELECTOR as Ye,BLOCK_SELECTOR as Qe,useCanvasTyping as qe,useCanvasEvent as Ze,nodeIdAt as _e,frameRectToHost as en,BLOCK_ATTRIBUTE as nn,drawnBox as tn}from"./chunk-X4T6JT3M.js";import{EaselTopBar as on,TopBarRail as rn,TopBarCluster as ln,EaselIconButton as sn,TopBarDivider as dn,DeviceSwitch as cn,InspectorIconButton as an,PanelResizeHandle as pn,MAX_PANEL_W as un,MIN_PANEL_W as fn,panelWidthVars as hn}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as mn,DEFAULT_CHROME_WORDS as gn}from"./chunk-Z6PVRXVY.js";import{holderOf as yn,nameOrSomeone as kn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Sn}from"./chunk-RE4LP46F.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useWords as Bn}from"./chunk-MFIRYGHW.js";import{useRef as In,useMemo as On,useState as Nn,useEffect as Pn,useCallback as $n,useLayoutEffect as Mn,Fragment as Tn}from"react";import{ColoredBadge as jn,toast as An,groupColors as Ln}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Rn,RefreshIcon as Vn,AddIcon as Fn,TrashIcon as Wn,EyeOffIcon as Hn,EyeIcon as Dn,DuplicateIcon as Gn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Xn,Fragment as Jn}from"react/jsx-runtime";var Kn=/* @__PURE__ */new WeakSet;function Yn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Qn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Mn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=en(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${nn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?tn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=en(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Un(jn,{colorClass:Ln("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
|
|
2
|
+
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Xn(Jn,e?{children:[
|
|
3
|
+
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
+
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
+
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
+
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
+
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var Zn=`${Ye}, ${Qe}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var et="__rungs";var nt="screen:band",tt={duplicate:!0,delete:!0};function ot(){const Ye=se(),{target:en,docId:nn,capabilities:tn,currentSlug:Ln,siteId:ot,onPublish:rt,saveState:it,saveConflict:lt,retrySave:st,toggleAutoSave:dt,flushSave:ct,access:at,saveUnreachable:pt=!1,readOnly:ut,readOnlyReason:ft=null}=ne(),ht=I(),mt=O(),{mediaEditing:gt,hasEditGuard:yt,hasPinnedChrome:kt}=tn,{appState:St,dispatch:vt,history:bt,selectedItem:wt,getSelectorForId:xt,config:zt}=Pe(e=>e),Ct=N(),{first:Bt,firstGroup:It,lastGroup:Ot,isSectionGroup:Nt,sectionGroupZone:Pt,panelOf:$t}=Ct,Mt=$t(Bt),Tt=e=>Y(Ct,e),jt=e=>Q(Ct,e),At="node"===Ct.firstRow,Lt=Ct.band??null,Et=Bn("screen",ce),Rt=Bn("tree",He),Vt=Bn("drag",Ne),Ft=Bn("notice",mn),Wt=Bn("lock",Sn),Ht=Bn("menu",fe),Dt=Bn("styleClipboard",ue),Gt=Bn("chrome",gn),Ut=P()??`/${Ln}`,Xt=$(),Jt=M(),Kt=b({readOnly:ut}),Yt=b({readOnly:ut,foldIntoHistory:!0}),Qt=In(null),qt=$e(),Zt=On(()=>({...Kt,select:e=>{Qt.current=e,Kt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Qt.current=Te(e,t,n)}Kt.commitDocument(e,n)}}),[Kt,qt]),_t=St.ui,eo=_t.leftSideBarVisible,no=_t.rightSideBarVisible,{options:to,widths:oo,initial:ro,fluid:io,fit:lo}=T(),[so,co]=Nn(ro),ao=oe(),po=gt&&null!==ao,uo=re(),fo=ie();j(wt?.props.id);const{read:ho,write:mo,forSelection:go}=A(),[yo,ko]=Nn(ho);Pn(()=>{mo(yo)},[yo]);const[So,vo]=Nn(0),bo=In(null),wo=In(null),xo=Ke(wo,{readySelector:Zn}),zo=qe(xo),Co=u(wo);f(wo,xo);const Bo=d(),Io=yn(at),Oo={state:it,offline:Bo||it.failed&&pt,readOnlyReason:ft,editing:Io?Ft.editing({name:kn(Io.name,Wt),noun:Et.noun}):null,conflict:null!=lt,notSaving:Et.bar.notSaving},No=()=>{ut||(it.failed?st():ct())};h(wo,xo,No);const[Po,$o]=Nn(!1),Mo=In(!1),To=In(!1),[jo,Ao]=Nn(null),[Lo,Eo]=Nn([]),[Ro,Vo]=Nn(L),Fo="puck"===Ro.kind,Wo=n(Ro,wt?.props.id),[Ho,Do]=Nn(null);Pn(()=>{Ho&&(t(),Do(null))},[Ho]);const Go=In(xt);Go.current=xt;const Uo=$n((e,{scroll:n})=>{ko(n=>go(e,n)),n&&Do(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Go.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&br(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Xo=In(null);Pn(()=>{const e=Xo.current;Xo.current=null;const n=null==wt?.props.id?null:String(wt.props.id);Vo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:$t(wt?.type)??L);const t=wt?.props.id,r=Qt.current;if(Qt.current=null,!t)return;const i=xt(t);Uo(String(t),{scroll:!o(r,i??null,ke)})},[wt?.props.id,Uo]);const Jo=$n(e=>{Vo(n=>E(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Ko=In(()=>{});Ko.current=(e,n)=>{const t=e?hi(e.zone??ke)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==wt?.props.id?null:String(wt.props.id);Vo(e=>E(e,n)?e:n),o!==r&&(Xo.current={id:o,mode:n},Zt.select(e))};const Yo=$n((e,n)=>Ko.current(e,n),[]),Qo={kind:Ro.kind,mode:Ro,open:Jo,show:e=>Vo(e),reveal:()=>{no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Yo},qo=R(Qo,{data:St.data,selected:wt??null,zoneOf:e=>xt(e)?.zone,readOnly:Boolean(ut),select:e=>{Vo(L),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(ke,e,n),scrollTo:e=>Vi(e)},{device:so,refreshes:So},{setView:ko,reveal:()=>{eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Zo=qo.pinnedSource??!1,_o=qo.resolveLeftView?qo.resolveLeftView(yo,po):"media"===yo&&po?yo:"sections",er=V(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=F(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=$n(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Uo(e,{scroll:!0})},[vt,Uo]),{selectNode:fr,openPartId:hr}=v({mode:Ro,setMode:Vo,onOpenPart:ur}),[mr,gr]=Nn(null);de(null!==mr,()=>gr(null));const yr=y(W()),kr=yr.collapsed,Sr=yr.panelWidths,[vr,br]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(kr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
+
return new Set}});Pn(()=>{try{window.localStorage.setItem(kr,JSON.stringify([...vr]))}catch{}},[vr]);const[wr,xr]=Nn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Sr);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}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Sr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=$n((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=$n(e=>zr("left",e),[zr]),Br=$n(e=>zr("right",e),[zr]),Ir=e=>vr.has(e),Or=e=>br(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Nr=In(!1),Pr=In(null);Pn(()=>{if(Nr.current&&!Po){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??wo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Nr.current=Po},[Po]),Pn(()=>{if(!Po||!Co)return;const e=e=>{"Escape"===e.key&&Ji()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[Po,Co]),de(Po,()=>Ji()),Pn(()=>{!eo&&Po&&($o(!1),Ao(null),Mo.current=!1)},[eo]),Pn(()=>{if(!uo)return To.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(To.current=!1);Po&&($o(!1),Ao(null),To.current=Mo.current,Mo.current=!1),eo||(To.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[uo]),Pn(()=>{!eo&&uo&&(To.current=!1,fo())},[eo]),Pn(()=>{if(!uo||!Co)return;const e=e=>{"Escape"===e.key&&fo()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[uo,Co]),de(null!==uo,()=>fo());const $r=H(),Mr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?An.error(e,{...o,duration:t?.duration??3200}):An.success(e,{...o,duration:t?.duration??1900})},Tr=In(null),[jr,Ar]=Nn(0),[Lr,Er]=Nn(0),Rr=D(),Vr=In(null),Fr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));Pn(()=>{const e=Tr.current;if(!e)return;const n=()=>{Ar(e.clientWidth),Er(Fr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Mn(()=>{Tr.current&&(Ar(Tr.current.clientWidth),Er(Fr(Tr.current)))},[wr,eo,no]);const Wr=so===io?jr>0?jr:oo[io]:oo[so],Hr=jr>0?Math.min(jr/Wr,"shrink"===lo?1:2):1,Dr=Wr*Hr,Gr=jr>0&&Dr>jr+1,Ur={width:Dr,height:Lr||"100%",flex:"none",position:"relative"},Xr={width:Wr,height:Lr?Lr/Hr:"100%",maxHeight:"none",transform:1!==Hr?`scale(${Hr})`:void 0,transformOrigin:"top left"},Jr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!eo}}),Kr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!no}}),Yr=e=>{Po&&($o(!1),Ao(null),Mo.current=!1,eo&&yo===e)||uo&&(To.current=!1,fo(),eo&&yo===e)||(eo&&yo===e?Jr():(ko(e),eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Qr=()=>{te(Ye,{accept:"image/*",title:Gt.mediaLibrary})},qr=()=>{Vo(L),Zt.select(null),p()},Zr=()=>{Vo(Mt??L),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=St.data.content??[],ei=()=>{const e=_r.findIndex(Tt),n=_r.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},ni=zt,ti=er.stripCopy,oi=e=>r(e,ti),ri=Z(),ii=je({data:St.data,config:ni,readOnly:Boolean(ut),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Vo(L);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),li=e=>{const n=zn(St.data,zt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===ke?pi(o):Ci(o);return!!ii.remove(e)&&(Mr(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",zt.components[e]?.label??e),ci=$n(e=>zt.components[e]?.defaultProps??{},[zt]),ai=e=>dr(e,"section",di(e)),pi=e=>he({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=On(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(zt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,ke,0),{nodeAddresses:e,zoneItems:n}},[_r,zt]),hi=$n(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>q(er,zt,e),yi=e=>{if(!er.slotsOf||e===ke)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(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}},ki=(()=>{if(!G(Ro))return null;const e=`${Ro.nodeId}:${Ro.slot}`;return yi(e)?.slot.panel===Ro.kind?e:null})(),Si=In(null);Pn(()=>{const e=Si.current;if(Si.current=null,!ki||!G(Ro))return;const n=Ro.nodeId;Uo(n,{scroll:e!==ki}),br(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ro]);const vi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===ke?Fi(n.index):hl(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&ki!==i&&(Si.current=i),Yo(null,r),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),Vi(o)},bi=(e,n,t)=>{const o=`${e}:${n}`;if(br(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;ki!==o&&(Si.current=o);Yo(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ut||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:et,index:n},s=Ue(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&bi(e,d,i.panel)},xi=ar(),zi=On(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>me(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Bi=(e,n)=>{const t=zt.components[e.type]?.fields,o=n===ke||Al(n)?"section":"block",r=n===ke&&(Tt(e)||jt(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Ii=(e,n,t,o)=>{if(!(!ut&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Bi(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
+
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.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)},Oi=e(U(),Dt),Ni=Oi.scope({target:en,siteId:ot,docId:nn}),Pi=zt,$i=(e,n)=>n===ke?ai(e):di(e),Mi=(e,n,t)=>{const o=Oi.plan(Ni,t,$i(t.type,e),Pi);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Mr(o.message))},Ti=_({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===ke?ai(e):di(e),renamePropOf:Bi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:bt.hasPast,hasFuture:bt.hasFuture,back:()=>bt.back(),forward:()=>bt.forward()},openPageSettings:()=>{Zt.select(null),Vo(L)},pageSettingsLabel:Et.pageSettings,words:{menu:Ht,styleClipboard:Dt,screen:Et.menu},readOnly:Boolean(ut),collapseAll:()=>br(new Set(hi(ke).map(e=>String(e.props.id)))),onPasteRefused:e=>Mr(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Rl(e,n),menuRows:qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(St.data,e),permits:e=>Se(zt,e.type),nodeOps:si,isPinned:(e,n)=>n===ke&&(Tt(e)||jt(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===ke?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===ke?Fi(n):hl(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>vi(n.node,n.slot,!1)}:null},style:{held:()=>ae(Ni),canCopy:e=>Oi.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Oi.copy(Ni,e,$i(e.type,n),Pi),paste:(e,n,t)=>Mi(e,n,t)},keys:mt?{target:Co,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??ke,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ut),onDone:({done:e,name:n})=>{"copied"===e&&Mr(Et.copied({name:n}))}}:void 0},xo),ji=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{ji.current={copy:(e,n)=>Oi.copy(Ni,e,$i(e.type,n),Pi),paste:Mi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??ke,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ut)}});const Ai=$n(e=>{const n=pe(e);if(!n)return;const t=ji.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))},[]);Pn(()=>{if(!Co)return;const e=e=>Ai(e);return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[Ai,Co]),Ze(xo,"keydown",Ai);const Li=_r.map(e=>e.props.id).join("|");Pn(()=>{const e=xo?.document??null,n=xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=_r.findIndex(jt),t=n>=0?n:_r.length,o=n=>{const t=_r[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Qe)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=_r.length>0&&!Tt(_r[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Eo(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()}},[xo,Li,so,Hr,eo,no,wt?.props.id]);const Ei=xo?.document??null,Ri=xo?.window??null;Pn(()=>{const e=bo.current;if(!e||!Ei||!Ri)return;const n=[],t=()=>{const n=Ei.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ri.scrollTo({left:Ri.scrollX,top:Ri.scrollY+t,behavior:"instant"}),!0};return bo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ei,Ri]);const Vi=e=>{qo.holdCanvasOn?qo.holdCanvasOn(e):c(e)},Fi=e=>{Vo(L),Zt.select({index:e}),qo.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&Vi(n)},Wi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=wt&&Ro.kind!==Mt?.kind?_r.findIndex(e=>e.props.id===wt.props.id):-1;return o(r>=0?r+1:t)},Hi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(ke,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Di=(e,n,t,o)=>{Vo(L),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Mr(Et.sectionAdded({name:t}))},Gi=(e,n)=>{const t=Wi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ce,sectionLabel:ai,blockIsOffered:lr}),r=o?Zt.insertNode(ke,t,o):Zt.insertSection(e,t);return Di(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of be(zt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ui=e=>Xi(ke,e),Xi=(e,n)=>{Pr.current=document.activeElement??null,uo&&(Mo.current=To.current,To.current=!1,fo()),Ao(null===n?null:{zone:e,index:n}),$o(!0),eo||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{$o(!1),Ao(null),Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Mo.current=!1},Ki=(e,n)=>sr.rowName?n?Tt(e)?sr.rowName(e,"section",Et.header):jt(e)?sr.rowName(e,"section",Et.footer):Nt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Yi=e=>n=>{e()},Qi=()=>qo.editPinnedSource?.(),qi=(e,n,t)=>{if(ut)return null;const o=hi(e)[n];return o&&!Se(zt,o.type).delete?null:/* @__PURE__ */Un(Fe,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Un(Wn,{size:15})})},Zi=e=>sr.rowPreview?.(e)||void 0,_i=e=>sr.rowMarks?.(e)??void 0,el=(e,n,t)=>sr.rowActions?.(e,n,t)??null,nl=(e,n,t,o)=>{if(ut)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
+
return Un(Fe,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>ol(e,n,t),children:/* @__PURE__ */Un(r?Hn:Dn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},tl=e=>ms(ke,e),ol=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},rl=e=>we(zt,e),il=e=>be(zt,e),ll=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:il(e)}],sl=e=>er.slotsOf?ll(e).flatMap(e=>e.kids):il(e),dl=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),cl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),al=(e,n,t)=>{const o=ze(zt,e.type,n)&&(t||sl(e).length>0||dl(e));return{collapsible:o,folded:o&&Ir(String(e.props.id))}},pl=(e,n,t)=>ll(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>al(e,r,t(e.type)).collapsible?[String(e.props.id),...pl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),ul=e=>sl(e).length>0||dl(e)||Boolean(ir(e.type)),fl=e=>Boolean(ir(e)),hl=(e,n,t,o)=>{if(Vo(L),ir(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),Zt.select({index:n,zone:e}),c(t)}else Zt.select({index:n,zone:e}),Vi(t)},ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},gl=In(/* @__PURE__ */new Set);Pn(()=>{_r.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(gl.current.has(t))return;gl.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(ci)).forEach((e,t)=>Yt.seedChild(o,t,n.childType,e))})},[_r,Yt,ci]);const yl=In(/* @__PURE__ */new Set);Pn(()=>{_r.forEach((e,n)=>{const t=e.props.id;if(yl.current.has(t))return;const o=i(e,rl(e.type));yl.current.add(t),o&&Yt.replaceComponent(ke,n,{...e,props:o})})},[_r,Yt]),X(Yt,zt);const kl=_r.findIndex(jt),Sl=kl>=0?_r[kl]:null,vl=At?_r.findIndex(Tt):-1,bl=vl>=0?_r[vl]:null,wl=Ct.groupTab,xl=On(()=>wl?e=>Nt(e.type):void 0,[wl]),zl=Boolean(Ct.groupBadge),Cl=Ct.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(jn,{tone:"info",size:"xs",children:Ct.groupBadge})}):void 0,Bl=_r.find(e=>e.type===It)??null,Il=_r.find(e=>e.type===Ot)??null,Ol=kl>=0?kl:_r.length,Nl=[];_r.forEach(e=>{jt(e)||(ul(e)&&Nl.push(String(e.props.id)),Nl.push(...pl(e,1,fl)))}),Sl&&(Nl.push(String(Sl.props.id)),Nl.push(...pl(Sl,1,fl)));const Pl=Nl.length>0&&Nl.every(e=>vr.has(e)),$l=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Ml=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=Ue(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},Tl=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 rl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===ke)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Al=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Pt(n)===e?t:null},Ll=(e,n)=>{const t=Al(e);return!t||(!Ct.groupAccepts||Ct.groupAccepts(t.type,n,hi(e).length))},El=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===et&&n.index>=0&&n.index<=o}if(n.slot===et)return!1;if(e.add)return Wl(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Al(o),i=Al(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ll(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===ke||o===ke){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=Sl&&!Ct.lastIsOpen?String(Sl.props.id):null;return(!l||jl(e.zone)!==l&&jl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Tl(r).has(n))return!1;const d=ir(s.type,or(St?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(hi(n),r))})(e.zone,o,e.index,t)},Rl=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?Ll(t,o.type):El({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Vl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(St?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:di(r.spec.childType)}]:[]),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ki(o,t.zone===ke)}},Fl=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===ke||Al(t)?e:Vl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Wl=(e,n)=>{const t=Fl(e,n),o=wn(n);if("block"!==t.kind){if(Al(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ll(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==ke)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===ke)return!1;const r=Vl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Hl=(e,n)=>{const t=Fl(e,n);if("block"!==t.kind&&Al(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ll(n,o)){if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,oi(e.template.node))}Vo(L),Zt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Gi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Wi(t),r=Zt.insertNode(ke,o,n);Di(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=wn(n),r=Vl(o);r&&(r.target.spec?ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{Zt.insertComponent(e,n,t),Vo(L),Zt.select({index:t,zone:e})})(o,t.type,n.index))},Dl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Hl(e.add,n):e.zone===ke?Hi(e.index,n.index):Ml(e.zone,wn(n),e.index,n.index)},[Gl]=Nn(()=>De()),Ul=Ge({keyOf:e=>e.id,readOnly:Boolean(ut),session:Gl,canDrop:El,onDrop:Dl,onStep:(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ke?((e,n)=>{const t=ai(_r[e]?.type??""),o=Hi(e,n<0?e-1:e+2);if(!o.moved)return void Mr(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=ei();Mr(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ml(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Xl=$n(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=wn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Tt(i)||jt(i)||nr(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Al(e)),s=e===ke||l;e===ke&&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?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===ke&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Vl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Al(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===ke||Al(n)?null:Vl(n);return t?.choices.length?Be(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Jl=null==wt?.props.id?null:String(wt.props.id),Kl=$n(e=>{const n=zt,t=e=>!e.item.rung&&null!==zn(St.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Jl);return i||(r(Ae(St.data,n,o.item.id,Jl,xl))??o)},[St.data,zt,Jl,xl]),[Yl,Ql]=Nn(null);Ze(xo,"mouseover",e=>{if(!wl)return;const n=_e(e.target),t=n?Yn(St.data,zt,n):null;t!==Yl&&Ql(t)}),Ze(xo,"mouseout",e=>{wl&&!e.relatedTarget&&Ql(null)});const ql=e=>Tt(e)||jt(e)||Nt(e.type),Zl=[];if(wl){const e=Jl?Yn(St.data,zt,Jl):null;for(const n of/* @__PURE__ */new Set([e,Yl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!ql(e))continue;const t=wl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Tt(e)||e.type===It})}}const _l=le(),es=In(null);Pn(()=>{const e=Ct.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(ql)),t=es.current;if(es.current={doc:nn,bands:n,index:bt.index},!t||t.doc!==nn||t.bands===n)return;bt.hasPast&&bt.index>=t.index&&!Kn.has(_l)&&(Kn.add(_l),Mr(e,"success",{action:{label:Et.bar.undo,onClick:()=>bt.back()},duration:8e3}))},[_r]);const ns=e=>{Vo(L),Zt.select(e.zone===ke?{index:e.index}:{index:e.index,zone:e.zone})},ts=J(),os=()=>({data:St.data,device:so,ops:Zt,inspector:Qo}),rs=ts?.model,is=On(()=>rs?e=>rs(e,Xl(e),os()):Xl,[rs,Xl,so]),ls=ts?.measure,ss=ls?(e,n)=>ls(e,n,os()):void 0,ds=ts?.canDrop,cs=ds?(e,n)=>ds(e,n,El,os()):El,as=ts?.drop,ps=as?(e,n)=>as(e,n,Dl,os()):Dl,us=ts?.pick,fs=us?e=>us(e,ns,os()):ns,hs=e=>{const n=wn(e),t=yi(n);t&&vi(t.node,t.slot,!1),Xi(n,e.index)},ms=(e,n)=>/* @__PURE__ */Un(We,{...ut?{}:Ul.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),gs={rowClick:Yi,isCollapsed:Ir,toggleCollapse:Or},ys=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=Pt(n),r=hi(o),i=Ir(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>ms(o,e);/* @__PURE__ */
|
|
11
|
+
return Xn(Jn,{children:[
|
|
12
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:_i(e),onSelect:()=>Fi(t),nameSlot:Ii(ke,t,n,s),selected:Wo===n,badge:Cl,actions:el(e,ke,t)??void 0,rowProps:{"data-node-id":n,onClick:Yi(()=>Fi(t))},fold:{open:!i,label:"section",onToggle:()=>Or(n)}}),!i&&/* @__PURE__ */Xn(Ee,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=ul(n),s=l&&Ir(r),c=()=>hl(o,t,r,e.type),{rowProps:a,...p}=Ul.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Yi(c)});/* @__PURE__ */
|
|
13
|
+
return Xn(Tn,{children:[d(t),
|
|
14
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:_i(n),onSelect:c,nameSlot:Ii(o,t,r,i),selected:Wo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Or(r)}:void 0,actions:/* @__PURE__ */Xn(Jn,{children:[qi(o,t,i),el(n,o,t),nl(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un(Ee,{children:vs(n,2)})]},r)}),d(r.length)]})]})},ks=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Ul.dragging,d=!Ir(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&El(s,c)?c:void 0,p=()=>vi(e,n,!0),{rowProps:u,...f}=Ul.row({item:{id:`rung:${l}`,zone:`${i}:${et}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:et,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Yi(p)}),h=ut?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
+
return Xn(Tn,{children:[n.heading,
|
|
16
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:ki===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Or(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Jn,{children:h.map((t,o)=>/* @__PURE__ */Un(Fe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(ut||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&bi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Un(Wn,{size:15}):/* @__PURE__ */Un(Gn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un(Ee,{children:r})]},l)},Ss=(e,n)=>{const t=ll(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
+
return Un(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=cl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>ms(e,n),p=/* @__PURE__ */Xn(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Wo===String(n.props.id),{collapsible:i,folded:s}=al(n,l,fl(n.type)),d=String(n.props.id),c=$l(n),p=()=>hl(t,o,d,e.type),{rowProps:u,...f}=Ul.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Yi(p)});/* @__PURE__ */
|
|
18
|
+
return Xn(Tn,{children:[0===o&&a(t,0),
|
|
19
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:_i(n),onSelect:p,nameSlot:Ii(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Or(d)}:void 0,actions:/* @__PURE__ */Xn(Jn,{children:[qi(t,o,c),el(n,t,o),nl(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un(Ee,{children:Ss(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?ks(e,t.rung,r++,o,p):/* @__PURE__ */Un(Tn,{children:p},t.slot??"")})})},vs=(e,n)=>{const t=or(St?.data,e.type,String(e.props.id)),o=ll(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
+
return Un(Jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=cl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>ms(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */Xn(Jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Wo===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=al(n,s,fl(n.type)),a=rl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...xn(p),index:hi(p).length}:void 0,f=Ul.dragging,h=u&&f&&El(f,u)?u:void 0,g=()=>hl(t,o,l,e.type),{rowProps:y,...k}=Ul.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Yi(g)});/* @__PURE__ */
|
|
21
|
+
return Xn(Tn,{children:[0===o&&m(t,0),
|
|
22
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:_i(n),onSelect:g,nameSlot:Ii(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Or(l)}:void 0,actions:nr(n.type)?el(n,t,o)??void 0:/* @__PURE__ */Xn(Jn,{children:[qi(t,o,i),el(n,t,o),nl(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un(Ee,{children:vs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
+
/* @__PURE__ */Un(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ml(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?ks(e,o.rung,i++,r,k):/* @__PURE__ */Un(Tn,{children:k},o.slot??"")})})},bs=Po||null!==uo,ws=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:eo&&!bs&&_o===e.id,onSelect:()=>Yr(e.id)}:e,xs=[...(qo.railLead??[]).map(ws),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Un(Xe,{}),active:eo&&!bs&&"sections"===_o,onSelect:()=>Yr("sections")},...(qo.railTrail??[]).map(ws)];po?xs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Un(Je,{}),active:eo&&!Po&&(null!==uo||"media"===_o),onSelect:()=>Yr("media")}):gt&&xs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Un(Je,{}),onSelect:Qr});const zs=[...qo.railLead??[],...qo.railTrail??[]].find(e=>"panel"in e&&e.id===_o),Cs=Boolean(Lt?.foldable)&&!Zo,Bs=Lt?.label??(yt?Et.pageSections:Et.templateSections),Is=Cs&&Ir(nt),Os=/* @__PURE__ */Xn(Jn,{children:[_r.map((e,n)=>{if(Tt(e)||jt(e)||Nt(e.type))return null;const t=Wo===String(e.props.id),o=Boolean(e.props._hidden);il(e);const r=String(e.props.id),i=qo.hasOwnRows?.(e)??!1,l=ul(e)||i,s=l&&Ir(r),d=rl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:hi(c).length}:void 0,p=Ul.dragging,u=a&&p&&El(p,a)?a:void 0,{rowProps:f,...h}=Ul.row({item:{id:r,zone:ke,index:n,type:e.type},place:{...xn(ke),index:n},into:u},{"data-node-id":r,onClick:Yi(()=>Fi(n))});/* @__PURE__ */
|
|
24
|
+
return Xn(Tn,{children:[n>0&&tl(n),
|
|
25
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:e.type,size:13}),name:pi(e),preview:Zi(e),marks:_i(e),onSelect:()=>Fi(n),nameSlot:Ii(ke,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Or(r)}:void 0,actions:/* @__PURE__ */Xn(Jn,{children:[qi(ke,n,pi(e)),el(e,ke,n),nl(ke,n,e,pi(e))]}),rowProps:f}),ul(e)&&!s&&/* @__PURE__ */Xn(Ee,{children:[vs(e,1),qo.partRows?.(e,gs)]}),i&&!s&&/* @__PURE__ */Un(Ee,{children:qo.ownRows?.(e,n,gs)})]},String(e.props.id??n))}),!Zo&&Ol>0&&tl(Ol)]}),Ns=(e,n,t)=>{const o=String(e.props.id),r=sl(e).length>0||dl(e)||Boolean(ir(e.type)),i=r&&Ir(o),l="header"===t?Et.header:Et.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
+
return Xn(Jn,{children:[
|
|
27
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:t,size:13}),name:s,preview:Zi(e),marks:_i(e),badge:Cl,onSelect:()=>Fi(n),nameSlot:Ii(ke,n,o,s),selected:Wo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Or(o)}:void 0,actions:el(e,ke,n)??void 0,rowProps:{"data-node-id":o,onClick:Yi(()=>Fi(n))}}),r&&!i&&/* @__PURE__ */Un(Ee,{children:Ss(e,1)})]})};return(qo.wrap??(e=>e))(
|
|
28
|
+
/* @__PURE__ */Un(K,{target:xo,children:/* @__PURE__ */Xn("div",{ref:wo,className:"sf-editor es-editor",style:hn(wr),onContextMenu:Ti.onEditorContextMenu,...m(Ye),children:[
|
|
29
|
+
/* @__PURE__ */Xn(on,{children:[
|
|
30
|
+
/* @__PURE__ */Un(rn,{items:xs,ariaLabel:Et.bar.views}),
|
|
31
|
+
/* @__PURE__ */Xn(ln,{children:[
|
|
32
|
+
/* @__PURE__ */Un(sn,{label:Et.bar.undo,disabled:Boolean(ut)||!bt.hasPast,onClick:()=>bt.back(),children:/* @__PURE__ */Un(En,{})}),
|
|
33
|
+
/* @__PURE__ */Un(sn,{label:Et.bar.redo,disabled:Boolean(ut)||!bt.hasFuture,onClick:()=>bt.forward(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
34
|
+
/* @__PURE__ */Un(dn,{}),
|
|
35
|
+
/* @__PURE__ */Un(cn,{devices:to,value:so,onChange:co}),
|
|
36
|
+
/* @__PURE__ */Un(sn,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{bo.current=(()=>{const e=xo?.document;if(!e)return null;const n=_r.findIndex(jt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[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=wt?.props?.id??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Un(Vn,{})})]}),
|
|
37
|
+
/* @__PURE__ */Xn(ln,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
+
/* @__PURE__ */Un(l,{input:Oo,words:Et.saveStatus}),qo.barLead?.(),qo.barTrail?.(),qo.mainAction||!qo.barMain?/* @__PURE__ */Un(s,{input:Oo,action:qo.mainAction??{label:Et.done,onPress:()=>{rt(St.data)}},readOnly:Boolean(ut),saveSwitch:ht,onToggleAutoSave:dt,onSaveNow:No,bar:Et.bar,words:Et.saveStatus}):qo.barMain()]})]}),
|
|
39
|
+
/* @__PURE__ */Un(ee,{}),
|
|
40
|
+
/* @__PURE__ */Xn("div",{className:"sf-body",children:[eo?/* @__PURE__ */Xn(Jn,{children:[
|
|
41
|
+
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:Po?/* @__PURE__ */Un(x,{at:jo?{label:(e=>{const n=Al(e.zone);if(n)return Et.add.addingTo({name:sr.rowName?Ki(n,!0):di(n.type)});if(e.zone===ke){const n=_r[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Ki(n,!0)}):Et.add.addingAtEnd}const t=Vl(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(jo),onClear:()=>Ao(null)}:void 0,placeBlocks:jo&&jo.zone!==ke?Vl(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...xn(jo.zone),index:jo.index};if(Wl(e,n))return null;const t=Al(jo.zone);if(t)return Et.add.notInside({name:Ki(t,!0)});if(jo.zone===ke)return Et.add.onlySections;const o=Vl(jo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...xn(jo.zone),index:jo.index};Wl(e,n)&&(Hl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Gl,siteWide:qo.addPanelRow?.(Ji),onClose:Ji,onHide:Jr,readOnly:Boolean(ut)}):uo&&ao?
|
|
42
|
+
/* @__PURE__ */Un(B,{panel:ao,pick:uo,onHide:Jr}):zs?zs.panel({onHide:Jr,notify:Mr}):"media"===_o&&ao?/* @__PURE__ */Un(B,{panel:ao,pick:null,onHide:Jr}):/* @__PURE__ */Xn(Jn,{children:[
|
|
43
|
+
/* @__PURE__ */Un(z,{icon:/* @__PURE__ */Un(Xe,{}),title:Et.layers,context:Ut,actions:/* @__PURE__ */Xn(Jn,{children:[!ut&&/* @__PURE__ */Un(an,{label:Et.add.title,onClick:()=>Ui(null),children:/* @__PURE__ */Un(Fn,{size:15})}),
|
|
44
|
+
/* @__PURE__ */Un(an,{label:Pl?Et.expandAll:Et.collapseAll,title:0===Nl.length?Et.nothingToFold:void 0,disabled:0===Nl.length,onClick:()=>br(e=>{const n=new Set(Nl);return Pl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Nl])}),children:/* @__PURE__ */Un(qn,{expand:Pl})})]}),onHide:Jr}),
|
|
45
|
+
/* @__PURE__ */Xn(Re,{className:"sf-tree sf-scroll",words:Rt,children:[
|
|
46
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"page",size:13}),name:Et.pageSettings,onSelect:qr,selected:!wt&&Fo,rowProps:{onClick:Yi(qr)}}),Bl&&/* @__PURE__ */Xn(Jn,{children:[!zl&&/* @__PURE__ */Un(Ve,{children:Et.header}),ys(Bl)]}),!Zo&&kt&&!(zl&&Bl)&&/* @__PURE__ */Xn(Jn,{children:[!zl&&/* @__PURE__ */Un(Ve,{children:Et.header}),!At&&/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"header",size:13}),name:Et.header,badge:Cl,onSelect:Zr,selected:Ro.kind===Mt?.kind,rowProps:{onClick:Yi(Zr)}})]}),!Zo&&bl&&!(zl&&Bl)&&Ns(bl,vl,"header"),!Zo&&!Cs&&/* @__PURE__ */Un(Ve,{children:Bs}),Cs?/* @__PURE__ */Xn(Jn,{children:[
|
|
47
|
+
/* @__PURE__ */Un(Le,{words:Rt,icon:null,name:Bs,fold:{open:!Is,label:Bs,onToggle:()=>Or(nt)}}),!Is&&/* @__PURE__ */Un(Ee,{children:Os})]}):Os,kt&&!zl&&/* @__PURE__ */Un(Ve,{children:Et.footer}),Sl&&!(zl&&Il)&&Ns(Sl,kl,"footer"),!Zo&&!Sl&&kt&&!zl&&/* @__PURE__ */Un(Le,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"footer",size:13}),name:Et.footer,onSelect:Qi,rowProps:{onClick:Yi(Qi),title:Et.editFooter}}),Il&&ys(Il),qo.treeFoot?.()]})]})}),
|
|
48
|
+
/* @__PURE__ */Un(pn,{side:"left",width:wr.left,min:fn,max:un,defaultWidth:k.left,label:Et.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Un(C,{side:"left",onShow:Jr}),
|
|
49
|
+
/* @__PURE__ */Xn("div",{ref:Tr,className:"sf-center sf-scroll","data-sf-canvas-head":Rr?"":void 0,style:{overflowX:Gr?"auto":"hidden",overflowY:"hidden"},children:[Rr&&/* @__PURE__ */Un("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Un(Rr,{device:so})}),
|
|
50
|
+
/* @__PURE__ */Xn("div",{className:"sf-frame-scaler",style:Ur,children:[
|
|
51
|
+
/* @__PURE__ */Un("div",{className:"sf-frame "+(so===io?"":`sf-frame--${so}`),style:Xr,children:/* @__PURE__ */Xn("div",{className:"sf-preview-host",children:[
|
|
52
|
+
/* @__PURE__ */Un(Me.Provider,{value:xl,children:/* @__PURE__ */Un(Xt,{},So)}),
|
|
53
|
+
/* @__PURE__ */Un(Ie,{canvas:xo,session:Gl,model:is,measure:ss,canDrop:cs,onDrop:ps,choose:Kl,onPick:fs,onZoneAdd:hs,onSeamAdd:hs,zoneAddLabel:Et.canvasAddBlock,words:Vt.canvas,readOnly:Boolean(ut),revision:St.data}),Lo.length>0&&!zo&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:Lo.map(e=>
|
|
54
|
+
/* @__PURE__ */Un(Oe,{index:e.index,label:Et.addSectionHere,onInsert:()=>Ui(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))})]})}),wl?/* @__PURE__ */Un(Qn,{canvas:xo,tabs:Zl,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Fi(n)}}):null]})]}),no?/* @__PURE__ */Xn(Jn,{children:[
|
|
55
|
+
/* @__PURE__ */Un(g,{value:{selectChild:hl,addChild:ml,childRowName:Ci,blockRowName:$l},children:/* @__PURE__ */Un(Jt,{mode:Ro,onOpenWebsiteSettings:qo.openSettings??(()=>{}),onOpenSiteStyles:qo.openStyles,onSelectNode:fr,onNotify:Mr,onHidePanel:Kr,nodeActions:wt?Se(zt,wt.type):tt})}),
|
|
56
|
+
/* @__PURE__ */Un(pn,{side:"right",width:wr.right,min:fn,max:un,defaultWidth:k.right,label:Et.resizeSettingsPanel,onResize:Br})]}):
|
|
57
|
+
/* @__PURE__ */Un(C,{side:"right",onShow:Kr})]}),Ti.menu]})}))}export{ot as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-IQ5TA7AM.js";import{isPreviewClick as e}from"./chunk-R5L2E7JX.js";var n=()=>document.querySelector(".sf-editor #preview-frame");function o(t){e()||requestAnimationFrame(()=>{n()?.contentDocument?.querySelector(`[data-puck-component="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function r(e,o){const r=n()?.contentWindow;if(!r)return;const c={id:e,index:o};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function c(){requestAnimationFrame(()=>{n()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function u(t,{passes:e=[150,400],onPinned:o}={}){let r=0,c=!1;const u=[],i=()=>{const r=n(),s=r?.contentWindow,l=r?.contentDocument;if(!s||!l)return!1;const a=t(s,l);if(null==a)return!1;if(s.scrollTo({left:s.scrollX,top:a,behavior:"instant"}),!c){c=!0,o?.();for(const t of e)u.push(setTimeout(i,t))}return!0},s=()=>{!i()&&r++<150&&u.push(setTimeout(s,32))};return s(),()=>u.forEach(clearTimeout)}function i(t){return u((e,n)=>{const o=n.querySelector(`[data-puck-component="${CSS.escape(t)}"]`);return o?e.scrollY+o.getBoundingClientRect().top:null})}function s(t){return u((t,e)=>{if(!e.querySelector("[data-puck-component]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{r as gotoPreviewSlide,s as pinPreviewToBottom,i as pinPreviewToSection,n as previewFrame,o as scrollPreviewToSection,c as scrollPreviewToTop};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-IE55HNMA.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
|
+
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
|
+
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],A=u.quiet??null,I=h.blocked??u.disabledReason??A?.reason??null;/* @__PURE__ */
|
|
4
|
+
return r(l,{variant:A?"secondary":"primary",leftIcon:A?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==I,disabledReason:I??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:A?A.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";function r(e){return e.map((e,n)=>{const l=String(n);if("—"===e.label)return{type:"divider",key:l};if(e.header)return{type:"label",key:l,label:e.label};if(e.children?.length){const n=e.children.some(e=>void 0!==e.checked);return{type:"submenu",key:l,label:e.label,icon:i(e),items:e.children.map((e,l)=>n?{type:"radio",key:String(l),label:c(e),icon:i(e),checked:Boolean(e.checked),onSelect:e.onClick}:{type:"item",key:String(l),label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick})}}return{type:"item",key:l,label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick}})}function t(e){return e.find(e=>e.header)?.label}function i(n){return null==n.icon?void 0:/* @__PURE__ */e("span",{className:"es-menu-icon","aria-hidden":"true",children:n.icon})}function c(r){return null==r.icon&&null==r.shortcut?r.label:/* @__PURE__ */n(l,{children:[
|
|
2
|
+
/* @__PURE__ */e("span",{className:"es-menu-label",children:r.label}),null==r.shortcut?null:/* @__PURE__ */e("span",{className:"es-menu-shortcut","aria-hidden":"true",children:r.shortcut})]})}export{r as easelMenuEntries,t as menuLabel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-U25CP5VX.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-VVPZMWJE.js";import{
|
|
2
|
-
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...
|
|
1
|
+
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-VVPZMWJE.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
|
+
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-OFBZOI6W.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-VVPZMWJE.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as m}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as n}from"./chunk-WK3AFPXY.js";import{DEFAULT_DRAG_WORDS as c}from"./chunk-KAML3KQH.js";import{DEFAULT_CANVAS_WORDS as s}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as f}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as p}from"./chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as e}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as i,DEFAULT_NOTICE_WORDS as u}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as k}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as j}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-B4JN227A.js";import{DEFAULT_FIELDS_WORDS as l}from"./chunk-WRFD4EXD.js";var a={notice:u,lock:k,save:e,chrome:i,rail:j,tree:f,panel:p,fields:l,pick:r,drag:c,menu:n,styleClipboard:m,copy:h,canvas:s,textStyles:o,screen:t},y=o=>"object"==typeof o&&null!==o;function D(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:y(n)?t[m]=y(c)?D(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function Y(o,r){return r?D(o,r):o}export{a as DEFAULT_EASEL_STRINGS,Y as mergeEaselStrings};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-4BGYVIDQ.js";import{ScreenStoreProvider as e}from"./chunk-2L2L7G5L.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-ZZ64CEC2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(e),k=r(n);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function Z({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),Z=t(()=>s(!g),[g]),
|
|
7
|
-
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:Z,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function Z({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),Z=t(()=>s(!g),[g]),G=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:G.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:Z,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:G.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:G.waitingForAuthorization})}export{Z as DocumentScreen,y as ScreenMount};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{useTreeDrag as s,gapToMoveIndex as c}from"./chunk-67GNT6PF.js";import{withTip as d}from"./chunk-P2VEMZH5.js";import{FieldNumber as u}from"./chunk-2XMHLXMA.js";import{FieldSelect as m}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{SettingsField as p,SettingsSegmented as f}from"./chunk-36LVP5WD.js";import{useWords as b}from"./chunk-MFIRYGHW.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as E}from"efficient-shell/icons/efficient";function W({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function T(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:u,summary:m,itemName:p,thumb:f,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:W,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=b("fields",h).list,U=b("tree",l),_=r??Z.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>p?p(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(H(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,u())),W?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(T(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=s({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=c({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(A(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
+
return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!W&&C===n,o=!w&&!X&&J&&te(n),i=["es-list-row",W?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */S(k,{className:i,flat:!!W,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?d(V?V(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):d(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:W?/* @__PURE__ */S("div",{className:"es-list-row-main",children:W(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[f?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:f(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",m?{className:"es-list-row-summary",children:m(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
+
/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
|
|
10
|
+
/* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:a(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
+
return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return S(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(W,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return S(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(u,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return S(p,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return S(p,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(f,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return S(J,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:f,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=b("panel",i),$=D(),P=h??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,E=R&&L.buckets.includes(R)?R:L.buckets[0],[W,A]=j(null),H=W&&W.panel===P&&L.rows.some(e=>e.name===W.name)?W:null,T=d&&L.buckets.length>1,z=T&&E?w(P,E):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>T&&e!==E,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":p??O.settings,idPrefix:P,value:E,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[f?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,f)}):f:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:X(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{W as FieldText,ee as Inspector,q as InspectorField,K as ListField,U as bucketsOf,z as copyItem,A as insertAt,X as labelOf,H as moveTo,Z as planFields,T as removeAt};
|
|
@@ -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-U25CP5VX.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withoutDeviceGate as t,deviceMetaOf as o}from"./chunk-
|
|
1
|
+
import{withoutDeviceGate as t,deviceMetaOf as o}from"./chunk-HV56SLR2.js";import{DESIGN_GROUP_KEY as n,BUCKET_KEY as e}from"./chunk-MQNBD6AB.js";import{panelFieldsOf as r}from"./chunk-LER7RKTO.js";import{STYLE_KIND as s,fieldKind as c,copyStyle as i,heldStyle as p,planPaste as u,pasteMessage as a}from"./chunk-V7U33NF2.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as l,MEDIA_FIELD_MARKER as m,TEXT_FIELD_MARKER as h,LINK_FIELD_MARKER as y}from"./chunk-DUVRZ456.js";var j=/* @__PURE__ */new Set([n.Size,n.Design,n.Layout,n.Position]),w=new Set(Object.values(n)),b=new Set(Object.values(e)),S=new Set(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function D(o){if(!o||"object"!=typeof o)return null;const n=o,e=t(o)??o,r=n[s]??e[s];if("string"==typeof r)return r;const i=n.options??e.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return c(e)}function L(o){const n=o,e=t(o);return k.some(t=>t in n||e&&t in e)}function O(t,n){const s=r(t,n)??{},c=[];let i=!0,p=!1;for(const[t,n]of Object.entries(s))b.has(t)?(i=t===e.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&n&&"object"==typeof n&&!t.startsWith("_")&&(l(n)||S.has(t)||g.has(t)||L(n)||"slot"!==n.type&&c.push({path:[t],kind:D(n),counted:"mobile"!==o(n)?.tier}));return c}function R(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(t,o,n,e,r,s){const c=p(n);if(!c)return null;const i=u(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:a(i,c.sourceLabel,r,s)}}function A(t,o,n,e){R(O,t,o,n,e)}function V(t,o,n,e,r){return d(O,t,o,n,e,r)}var B={scope:t=>v(t.siteId),rows:(t,o)=>O(t,o),copy:(t,o,n,e)=>A(e,t,o,n),plan:(t,o,n,e)=>V(e,t,o,n)};function F(t,o){if(!t&&!o)return B;const n=t?.rows,e=n?(t,o)=>n(t,o):O;return{scope:t?.scope??B.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>R(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{A as copyNodeStyle,O as nodeStyleRows,V as planNodePaste,D as shopFieldKind,v as siteStyleScope,F as styleClipboardOf};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{toItemSelector as t,fromItemSelector as n,useNodeOps as o,parentStep as r,clickPick as i}from"./chunk-ECM5F6JJ.js";import{useResolvedFields as l}from"./chunk-YRLPFZW3.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-B4JN227A.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,CANVAS_TYPABLE_EVENT as v,isTypingTarget as y,frameRectToHost as w,CANVAS_TYPING_EVENT as b,drawnBox as k}from"./chunk-X4T6JT3M.js";import{find as S,ROOT_ID as C,getList as I,remove as E,parseZoneKey as D,move as x,duplicate as M,replaceNode as A,createNode as O,insert as z,normalizeData as R,createResolveCache as P,resolveNodeData as V,ROOT_SLOT as B}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as N,fieldsFrom as $,defaultsFrom as L}from"./chunk-NKB3KVAB.js";import{createContext as K,useEffect as j,useContext as Z,useRef as F,useSyncExternalStore as T,useState as H,useMemo as W,useCallback as q,useLayoutEffect as Y}from"react";import{jsx as J,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as G}from"react-dom";import{registerModalEscapeInterceptor as Q,FloatingBar as _,TextToolbar as ee,LinkPicker as te}from"efficient-shell/ui";function ne(e){return!["setData","setUi","set"].includes(e.type)}var oe=(e,t,n,o)=>{const r=I(e,t,D(n));return r?.[o]??null},re=(e,t,n,o,r)=>{const i=oe(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function ie(e,n){const{selection:o}=e;return{...e.ui,itemSelector:t(e.data,n,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function le(e,t,n){return n?"node"===n.kind?S(e,t,n.id)?n:null:n.parentId===C?I(e,t,n)?n:null:S(e,t,n.parentId)&&I(e,t,n)?n:null:null}function se(e,t,o,r=!1){const{itemSelector:i,selectedSlot:l,...s}=o;let a=e.selection;var c;return"itemSelector"in o&&(a=n(e.data,t,i??null)),"selectedSlot"in o&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ae(e,t,n){const o=ce(e,t,n);if(o===e)return e;const r=le(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ce(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return se(e,n,"function"==typeof t.ui?t.ui(ie(e,n)):t.ui);case"set":{const r={data:o,ui:ie(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=se(l,n,i.ui,!0)),l}case"insert":{const r={...D(t.destinationZone),index:t.destinationIndex},i=O(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:z(o,n,r,i)}}case"replace":{const r=re(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:A(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=re(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=M(o,n,r.props.id),l=oe(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ce(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=oe(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...D(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=re(o,n,t.zone,t.index,"remove");return{...e,data:E(o,n,r.props.id)}}default:return e}}var de={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},ue={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},pe=0,fe=()=>`history-${pe+=1}`;function he(e){let o=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=R(e.data,o);let a={data:s,selection:null,ui:{...ue}};if(e.ui){const{itemSelector:t,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:n(s,o,t??null),ui:{...ue,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:fe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:fe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},k=e=>{const t=a;if(a=ae(a,e,o),a===t)return;const n=e.recordHistory??ne(e);b(t,n&&a.data!==t.data)},C=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const t=a,n=le(a.data,o,e);var r,i;(r=n,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:n},b(t,!1))},D=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},x=()=>(e={})=>{const t=e.root?o.root?.permissions:o.components[e.item?.type??e.type??""]?.permissions;return{...de,...l,...t}};let M=x();const O=P(),z={resolveCache:O,async resolveAll({trigger:e="load",metadata:t}={}){const n=a.data,r={type:"root",props:{...n.root.props??{}}},i=[...n.content,...Object.values(n.zones??{}).flat()],[l,...s]=await Promise.all([V(r,o,{cache:O,trigger:e,metadata:t}),...i.map(n=>V(n,o,{cache:O,trigger:e,metadata:t}))]);C(()=>{const e=a;let t=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=S(t,o,l)?.node;s&&s===S(n,o,l)?.node&&(t=A(t,o,l,e.node))}),l.didChange&&t.root===n.root&&(t={...t,root:{...t.root,props:l.node.props,readOnly:l.node.readOnly??t.root.readOnly}}),t!==a.data&&(a={...a,data:t,selection:le(t,o,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:t="replace",metadata:n}={}){const r=S(a.data,o,e)?.node;if(!r)return!1;const i=await V(r,o,{cache:O,trigger:t,metadata:n});if(!i.didChange)return!1;let l=!1;return C(()=>{const t=a;if(S(a.data,o,e)?.node!==r)return;const n=A(a.data,o,e,i.node);n!==a.data&&(a={...a,data:n,selection:le(n,o,a.selection)},b(t,!1),l=!0)}),l},get config(){return o},getState(){if(f&&h===a)return f;const e=a,n={data:e.data,ui:ie(e,o)},r="node"===e.selection?.kind?S(e.data,o,e.selection.id)?.node??null:null;return f={appState:n,selection:e.selection,selectedItem:r,config:o,dispatch:k,history:{back:()=>z.undo(),forward:()=>z.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:ie(e.core,o)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&D(e)}},getPermissions:M,getItemById:t=>S(e.data,o,t)?.node,getItemBySelector:t=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return I(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,o,t),getSelectorForId:n=>{const r=t(e.data,o,{kind:"node",id:n});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:k,batch:C,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){C(()=>{const t=a,n=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:le(e.data,o,n)},b(t,e.data!==t.data)})},load(e,t={}){const n=a,r=R(e,o);a={...a,data:r,selection:le(r,o,t.selection??a.selection)},t.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:fe()}],d=0),a!==n&&y()},undo(){d>0&&D(d-1)},redo(){d<c.length-1&&D(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=x(),f=null,y())},setConfig(e){e!==o&&(o=e,M=x(),f=null,y())}};return z}function me(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&y(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ge=K(null),ve=K(!0);function ye({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return j(()=>{n&&e.resolveAll()},[e,n]),j(()=>{if(t&&"undefined"!=typeof document)return me(document,e)},[e,t]),/* @__PURE__ */J(ge.Provider,{value:e,children:/* @__PURE__ */J(ve.Provider,{value:t,children:o})})}function we(){const e=Z(ge);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function be(e){const t=we(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return T(t.subscribe,o,o)}function ke(){return function(e){return be(e)}}var Se="data-puck-component",Ce="data-puck-dropzone",Ie={},Ee="data-es-mirror",De="undefined"==typeof window?j:Y;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ee}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ee,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Me({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=F(null),[p,f]=H(null);return De(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),De(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */J("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?G(t,p):null})}var Ae=K(null),Oe=K(Ie),ze=[];function Re({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=we(),s=be(n=>I(n.appState.data,l.config,{parentId:e,slot:t})??ze),a=be(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==C),c=be(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=Z(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===C&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==C&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */J("div",{className:u.join(" "),[Ce]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */J(je,{node:e},e.props.id))})}function Pe(e,t){return W(()=>{const n={};for(const o of N($(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{toItemSelector as t,fromItemSelector as n,useNodeOps as o,parentStep as r,clickPick as i}from"./chunk-ECM5F6JJ.js";import{useResolvedFields as l}from"./chunk-YRLPFZW3.js";import{setCanvasNonce as s,CANVAS_TYPABLE_EVENT as a,isTypingTarget as c,frameRectToHost as d,CANVAS_TYPING_EVENT as u,drawnBox as p}from"./chunk-X4T6JT3M.js";import{find as f,ROOT_ID as h,getList as m,remove as g,parseZoneKey as v,move as y,duplicate as w,replaceNode as b,createNode as k,insert as S,normalizeData as C,createResolveCache as I,resolveNodeData as E,ROOT_SLOT as D}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as x,fieldsFrom as M,defaultsFrom as A}from"./chunk-NKB3KVAB.js";import{selectionBox as O,placeWindow as z,offsetOrigin as R,colorRunOf as P,ColorWindow as V,startCanvasTyping as B,textMap as N}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as $}from"./chunk-B4JN227A.js";import{useWords as L}from"./chunk-MFIRYGHW.js";import{createContext as K,useEffect as j,useContext as Z,useRef as F,useSyncExternalStore as T,useState as H,useMemo as W,useCallback as q,useLayoutEffect as Y}from"react";import{jsx as J,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as G}from"react-dom";import{registerModalEscapeInterceptor as Q,FloatingBar as _,TextToolbar as ee,LinkPicker as te}from"efficient-shell/ui";function ne(e){return!["setData","setUi","set"].includes(e.type)}var oe=(e,t,n,o)=>{const r=m(e,t,v(n));return r?.[o]??null},re=(e,t,n,o,r)=>{const i=oe(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function ie(e,n){const{selection:o}=e;return{...e.ui,itemSelector:t(e.data,n,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function le(e,t,n){return n?"node"===n.kind?f(e,t,n.id)?n:null:n.parentId===h?m(e,t,n)?n:null:f(e,t,n.parentId)&&m(e,t,n)?n:null:null}function se(e,t,o,r=!1){const{itemSelector:i,selectedSlot:l,...s}=o;let a=e.selection;var c;return"itemSelector"in o&&(a=n(e.data,t,i??null)),"selectedSlot"in o&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ae(e,t,n){const o=ce(e,t,n);if(o===e)return e;const r=le(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ce(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return se(e,n,"function"==typeof t.ui?t.ui(ie(e,n)):t.ui);case"set":{const r={data:o,ui:ie(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=se(l,n,i.ui,!0)),l}case"insert":{const r={...v(t.destinationZone),index:t.destinationIndex},i=k(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:S(o,n,r,i)}}case"replace":{const r=re(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:b(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=re(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=w(o,n,r.props.id),l=oe(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ce(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=oe(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...v(t.destinationZone),index:t.destinationIndex};return{...e,data:y(o,n,r.props.id,i)}}case"remove":{const r=re(o,n,t.zone,t.index,"remove");return{...e,data:g(o,n,r.props.id)}}default:return e}}var de={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},ue={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},pe=0,fe=()=>`history-${pe+=1}`;function he(e){let o=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=C(e.data,o);let a={data:s,selection:null,ui:{...ue}};if(e.ui){const{itemSelector:t,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:n(s,o,t??null),ui:{...ue,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:fe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:fe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let h=null,g=null,v=0,y=null,w=!1;const k=()=>{for(const e of[...p])e()},S=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},D=(t,n)=>{v>0?w=w||n:(n?u(!1):a!==t&&S(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&k())},x=e=>{const t=a;if(a=ae(a,e,o),a===t)return;const n=e.recordHistory??ne(e);D(t,n&&a.data!==t.data)},M=t=>{0===v&&(y=a,w=!1),v+=1;try{t()}catch(e){throw v-=1,0===v&&y&&(a=y,y=null),e}if(v-=1,v>0||!y)return;const n=y;y=null,w&&a.data!==n.data?u(!0):a!==n&&S(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&k()},A=e=>{const t=a,n=le(a.data,o,e);var r,i;(r=n,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:n},D(t,!1))},O=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&k()},z=()=>(e={})=>{const t=e.root?o.root?.permissions:o.components[e.item?.type??e.type??""]?.permissions;return{...de,...l,...t}};let R=z();const P=I(),V={resolveCache:P,async resolveAll({trigger:e="load",metadata:t}={}){const n=a.data,r={type:"root",props:{...n.root.props??{}}},i=[...n.content,...Object.values(n.zones??{}).flat()],[l,...s]=await Promise.all([E(r,o,{cache:P,trigger:e,metadata:t}),...i.map(n=>E(n,o,{cache:P,trigger:e,metadata:t}))]);M(()=>{const e=a;let t=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=f(t,o,l)?.node;s&&s===f(n,o,l)?.node&&(t=b(t,o,l,e.node))}),l.didChange&&t.root===n.root&&(t={...t,root:{...t.root,props:l.node.props,readOnly:l.node.readOnly??t.root.readOnly}}),t!==a.data&&(a={...a,data:t,selection:le(t,o,a.selection)},D(e,!1))})},async resolveNode(e,{trigger:t="replace",metadata:n}={}){const r=f(a.data,o,e)?.node;if(!r)return!1;const i=await E(r,o,{cache:P,trigger:t,metadata:n});if(!i.didChange)return!1;let l=!1;return M(()=>{const t=a;if(f(a.data,o,e)?.node!==r)return;const n=b(a.data,o,e,i.node);n!==a.data&&(a={...a,data:n,selection:le(n,o,a.selection)},D(t,!1),l=!0)}),l},get config(){return o},getState(){if(h&&g===a)return h;const e=a,n={data:e.data,ui:ie(e,o)},r="node"===e.selection?.kind?f(e.data,o,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:r,config:o,dispatch:x,history:{back:()=>V.undo(),forward:()=>V.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:ie(e.core,o)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&O(e)}},getPermissions:R,getItemById:t=>f(e.data,o,t)?.node,getItemBySelector:t=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return m(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,o,t),getSelectorForId:n=>{const r=t(e.data,o,{kind:"node",id:n});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},g=e,h},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:x,batch:M,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>A(e?{kind:"node",id:e}:null),selectSlot:e=>A(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){M(()=>{const t=a,n=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:le(e.data,o,n)},D(t,e.data!==t.data)})},load(e,t={}){const n=a,r=C(e,o);a={...a,data:r,selection:le(r,o,t.selection??a.selection)},t.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:fe()}],d=0),a!==n&&k()},undo(){d>0&&O(d-1)},redo(){d<c.length-1&&O(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,R=z(),h=null,k())},setConfig(e){e!==o&&(o=e,R=z(),h=null,k())}};return V}function me(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&c(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ge=K(null),ve=K(!0);function ye({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return j(()=>{n&&e.resolveAll()},[e,n]),j(()=>{if(t&&"undefined"!=typeof document)return me(document,e)},[e,t]),/* @__PURE__ */J(ge.Provider,{value:e,children:/* @__PURE__ */J(ve.Provider,{value:t,children:o})})}function we(){const e=Z(ge);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function be(e){const t=we(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return T(t.subscribe,o,o)}function ke(){return function(e){return be(e)}}var Se="data-puck-component",Ce="data-puck-dropzone",Ie={},Ee="data-es-mirror",De="undefined"==typeof window?j:Y;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ee}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ee,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Me({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:a,height:c="auto",nonce:d}){const u=L("canvas",e),p=F(null),[f,h]=H(null);return De(()=>{const e=p.current,t=f?.ownerDocument.defaultView;if("auto"!==c||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,c]),De(()=>{let e=p.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=p.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),s(e,d),h(t),a?.(e);let n=null;const o=p.current?.ownerDocument;if(l&&o){xe(o,e,d);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,d)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),h(null),a?.(null)}},[]),/* @__PURE__ */J("iframe",{ref:p,id:n,title:o??u.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:f?G(t,f):null})}var Ae=K(null),Oe=K(Ie),ze=[];function Re({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=we(),s=be(n=>m(n.appState.data,l.config,{parentId:e,slot:t})??ze),a=be(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==h),c=be(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=Z(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===h&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==h&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */J("div",{className:u.join(" "),[Ce]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */J(je,{node:e},e.props.id))})}function Pe(e,t){return W(()=>{const n={};for(const o of x(M(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
2
|
return J(Re,{parentId:t,slot:o,...e})};return n},[e,t])}function Ve(e){return W(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return J(Re,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Ne(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function $e(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Ne(e,"position",t?"sticky":"relative");for(const n of Be)Ne(e,n,t?.[n]??"");return!!t}var Le="data-es-canvas-relative";function Ke(e){e.hasAttribute(Le)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Le));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Le,"")),!1)}function je({node:e}){const t=we().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return W(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Se),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Se,e),n.setAttribute("data-puck-dnd",e),Ke(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});De(()=>o.current()),De(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?Ke(e):$e(e));const s=Z(Oe),a=Pe(t,n),c=Ve(n);if(!t?.render)return null;const d=t.render,u={...
|
|
4
|
-
/* @__PURE__ */J("div",{ref:i,[Se]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */J(d,{...u,puck:p,editMode:!0})})}function Ze({metadata:e}){const t=be(e=>e.config),n=be(e=>e.appState.data.root).props??{},o=t.root?.render,r=Pe(t.root,
|
|
5
|
-
return J(Oe.Provider,{value:e??Ie,children:s})}var Fe=K(void 0);function Te(e,t,n){const[o,r]=H(null),i=F(t);return i.current=t,De(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=
|
|
6
|
-
return J(_,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?
|
|
7
|
-
/* @__PURE__ */J(te,{className:"es-copy-link es-copy-pop",value:
|
|
8
|
-
return J("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Je({frame:t=!0,className:n,style:o,metadata:l,mirrorStyles:s,onDocument:
|
|
9
|
-
/* @__PURE__ */J(Ae.Provider,{value:
|
|
3
|
+
return J(Re,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Ne(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function $e(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Ne(e,"position",t?"sticky":"relative");for(const n of Be)Ne(e,n,t?.[n]??"");return!!t}var Le="data-es-canvas-relative";function Ke(e){e.hasAttribute(Le)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Le));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Le,"")),!1)}function je({node:e}){const t=we().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return W(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Se),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Se,e),n.setAttribute("data-puck-dnd",e),Ke(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});De(()=>o.current()),De(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?Ke(e):$e(e));const s=Z(Oe),a=Pe(t,n),c=Ve(n);if(!t?.render)return null;const d=t.render,u={...A(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */J(d,{...u,puck:p,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */J("div",{ref:i,[Se]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */J(d,{...u,puck:p,editMode:!0})})}function Ze({metadata:e}){const t=be(e=>e.config),n=be(e=>e.appState.data.root).props??{},o=t.root?.render,r=Pe(t.root,h),i=Ve(h),l=/* @__PURE__ */J(Re,{parentId:h,slot:D}),s=o?/* @__PURE__ */J(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
+
return J(Oe.Provider,{value:e??Ie,children:s})}var Fe=K(void 0);function Te(e,t,n){const[o,r]=H(null),i=F(t);return i.current=t,De(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=p(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function He({id:e,kind:t,overlay:n}){const o=F(null),r=Te(o,e?t=>t.querySelector(`[${Se}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */J("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */J(n,{componentId:e,kind:t,children:i}):i}function We(e,t,n){const o=N(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function qe({s:e,element:t,toolbar:n,label:o,keys:r}){const i=L("copy",$),l=e.pressed(),s=new Set(n.offered),a=n.colors&&n.colors.length>0?n.colors:null,c=F(null),[u,p]=H(!1),[f,h]=H(null),m=u||null!==f,g=()=>{e.hold(),p(!1),h({href:e.pressed().href})},v=()=>{p(!1),h(null),e.resume()};Y(()=>{r.current={escape:()=>!!m&&(v(),!0),link:()=>!!s.has("link")&&(g(),!0)}}),Y(()=>()=>{r.current=null},[r]);const y=F(v);y.current=v,j(()=>{if(u)return Q(e=>{const t=c.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(y.current(),!0)},()=>c.current?.querySelector(".es-copy-colors"))},[u]),j(()=>{const n=c.current;if(!m||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;p(!1),h(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[m,e,t]),Y(()=>{const e=c.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(m&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?O(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?d(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},u=o.getBoundingClientRect(),p=s?d(s,{left:u.left,top:u.top,width:u.width,height:u.height}):{left:u.left,top:u.top,width:u.width,height:u.height},f=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),h={left:a.left,right:a.left+a.width,top:Math.min(a.top,p.top-6,f.top),bottom:Math.max(a.top+a.height,p.top+p.height+6,f.bottom)},g=e.ownerDocument.documentElement,v=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),y={left:Math.max(0,v.left),top:Math.max(0,v.top),right:Math.min(g.clientWidth||v.right,v.right),bottom:Math.min(g.clientHeight||v.bottom,v.bottom)};if(y.right<=y.left||y.bottom<=y.top||0===n.offsetWidth)return;const w=z({anchor:h,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:v.left,top:v.top,right:v.right,bottom:v.bottom},clip:y,parent:R(n)});n.style.top=`${w.top}px`,n.style.left=`${w.left}px`,n.style.setProperty("--es-pop-point",`${w.point}px`),n.dataset.side=w.above?"above":"below"});const w=a?{run:P(l.color,a),open:u,onToggle:()=>{h(null),u?v():(e.hold(),p(!0))}}:void 0;/* @__PURE__ */
|
|
6
|
+
return J(_,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?d(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */J("div",{ref:c,children:/* @__PURE__ */J(ee,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?g():e.press(t)},color:w,linkOpen:null!==f,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(U,{children:[u&&a?/* @__PURE__ */J(V,{colors:a,current:l.color,words:i.colors??$.colors,onPick:t=>e.color(t)}):null,f?
|
|
7
|
+
/* @__PURE__ */J(te,{className:"es-copy-link es-copy-pop",value:f.href??"",onApply:t=>{h(null),e.link(t)},onRemove:null!==f.href?()=>{h(null),e.link(null)}:void 0,onCancel:v}):null]})})})})}function Ye({element:e}){const t=F(null),n=Te(t,()=>e(),e);/* @__PURE__ */
|
|
8
|
+
return J("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Je({frame:t=!0,className:n,style:o,metadata:l,mirrorStyles:s,onDocument:c,height:d,title:p,nonce:f,hotkeys:h,frameWrapper:m,overlay:g,children:v,typing:y,passThrough:w}){const b=we(),k=Z(Fe),S=w??k,C=Z(ve),I=L("canvas",e),E=h??C,[D,x]=H(void 0),M=be(e=>"node"===e.selection?.kind?e.selection.id:null),[A,O]=H(null),[z,R]=H(null),P=F(null),[,V]=H(0),N=F(y);N.current=y;const $=F(null),K=F(null),T=be(e=>e.appState.data);j(()=>{const e=K.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=M&&!z&&N.current?.atSelection?.()?M:null;e.dispatchEvent(new t(a,{detail:{id:n}}))},[M,z,T]);const W=e=>{const t=K.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(u,{detail:{typing:e}}))},q=(e,t)=>{P.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=b.group(),r=e.element,i=B({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:We(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>V(e=>e+1),onEscape:()=>$.current?.escape()??!1,onLinkKey:()=>$.current?.link()??!1,end:e=>{o.close(),P.current?.element===r&&(P.current=null),R(null),W(!1),N.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${Se}]`)?.getAttribute(Se);return l&&b.select(l),P.current={s:i,element:r,target:e},R(()=>r),O(null),W(!0),N.current?.onChange?.({typing:!0,element:n}),!0};j(()=>()=>P.current?.s.stop("stop"),[]);const Y=e=>{const t=P.current?.element();return Boolean(t&&t.contains(e))},U=e=>{const t=e.closest?.(`[${Se}]`)?.getAttribute(Se);if(!t)return;const n=b.getState(),o="node"===n.selection?.kind?n.selection.id:null;return i(n.appState.data,b.config,t,o,S)??t},G=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(P.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=N.current?.atSelection?.();n&&q(n,null)&&e.preventDefault()},Q=/* @__PURE__ */X("div",{ref:K,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),P.current){if(Y(t))return;P.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=U(t);void 0===o?t.hasAttribute?.(Ce)||b.select(null):b.select(o)},onDoubleClick:e=>{const t=N.current;if(!t||Y(e.target))return;const n=t.at(e.target);n&&q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>G(e),onMouseOver:e=>{if(P.current)return;const t=U(e.target)??null;t!==A&&O(t)},onMouseLeave:()=>O(null),children:[
|
|
9
|
+
/* @__PURE__ */J(Ae.Provider,{value:A,children:/* @__PURE__ */J(Ze,{metadata:l})}),
|
|
10
10
|
/* @__PURE__ */X("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
11
|
-
/* @__PURE__ */J(He,{id:!
|
|
12
|
-
/* @__PURE__ */J(He,{id:
|
|
13
|
-
return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":
|
|
11
|
+
/* @__PURE__ */J(He,{id:!z&&A&&A!==M?A:null,kind:"hover",overlay:g}),
|
|
12
|
+
/* @__PURE__ */J(He,{id:z?null:M,kind:"selected",overlay:g}),z?/* @__PURE__ */J(Ye,{element:z}):null]}),v]}),_=m?/* @__PURE__ */J(m,{document:D,children:Q}):Q;j(()=>{if(D&&E)return me(D,b)},[D,E,b]),j(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void G(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=b.getState();if("node"!==n.selection?.kind)return;const o=r(n.appState.data,b.config,n.selection);"node"===o?.kind&&b.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,b]);/* @__PURE__ */
|
|
13
|
+
return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":z?"":void 0,children:[z&&P.current?.target.toolbar?/* @__PURE__ */J(qe,{s:P.current.s,element:P.current.element,toolbar:P.current.target.toolbar,label:I.textTools,keys:$}):null,t?/* @__PURE__ */J(Me,{mirrorStyles:s,onDocument:e=>{x(e??void 0),c?.(e)},height:d,title:p,nonce:f,children:_}):/* @__PURE__ */J("div",{id:"preview-frame","data-puck-entry":"",children:_})]})}function Xe(e={}){const t=we(),n=be(e=>e.appState.data);return o({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ue(){const e=we(),t=be(e=>e.config),n=e.resolveCache,o=be(e=>e.selectedItem),r=be(e=>e.appState.data.root),i=o?o.props.id:"root",s=r.props??{},a=W(()=>o||{type:"root",props:s},[o,s]),c=o?t.components[o.type]:t.root,d=e.getState(),u=o?f(d.appState.data,t,i):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,h=p?d.getItemById(p)??null:null,{fields:m}=l({id:i,node:a,block:c,parent:h,appState:d.appState}),g=be(e=>!1===e.getPermissions(o?{item:o}:{root:!0}).edit),v=q(o=>{(async()=>{const r=e.getState();if("root"!==i){const l=r.getItemById(i),s=r.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...o}},{node:c}=await E(a,t,{cache:n,trigger:"replace"}),d=e.getState().getSelectorForId(i);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const l=r.appState.data.root.props??{},{node:s}=await E({type:"root",props:{...l,...o}},t,{cache:n,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,t,n,i]),y=q((e,t)=>v({[e]:t}),[v]);return{id:i,node:a,fields:m,values:a.props,readOnly:g,onChange:y,onChangeMany:v}}export{Me as CanvasFrame,Fe as CanvasPassThroughContext,ue as DEFAULT_UI,Je as EaselCanvas,ye as EaselProvider,Ze as EditDocument,me as bindUndoKeys,he as createEasel,ke as createUseEasel,ne as recordsByDefault,ae as reduce,ie as uiView,be as useEasel,we as useEaselApi,Xe as useEaselNodeOps,Ue as useSelectedFields,le as validSelection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-QX7GVECM.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-QX7GVECM.js";import{Inspector as i}from"./chunk-K6EM4F5N.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function S(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var G=o({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(G.Provider,{value:n,children:e})}function P(){return u(G)}function D(){return(P().useOwnerName??v)()}function x(){return(P().useDocumentLabel??g)()}function B(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function F(n){return(P().useStandaloneBridges??h)(n)}function I(n,e){(P().useDocumentPass??y)(n,e)}function T(){return P().blockRules??b}function A(){return P().blockLook??O}function E(){return P().devices??j}function K(){return P().leftView??w}function R(){return P().pinned??L}function V(){return P().saveSwitch??!0}function M(e){n(!0===P().pickFollowsSelection,e)}function Q(){return P().storageNamespace||void 0}function W(){return P().styleClipboard??null}function H(){return P().nodeKeys??!0}function X(){return P().notify??null}function Y(){return P().Canvas??C}function Z(){return P().CanvasHead??null}function q(){return P().canvasDrag??null}var z=o(null);function J({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(z.Provider,{value:n,children:e})}function U(){return u(z)}function $(){return P().Inspector??S}export{c as SELECTION_MODE,J as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,T as useScreenBlockRules,B as useScreenBridges,q as useScreenCanvasDrag,Y as useScreenCanvasFrame,Z as useScreenCanvasHead,U as useScreenCanvasTarget,E as useScreenDevices,x as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,K as useScreenLeftView,H as useScreenNodeKeys,X as useScreenNotify,D as useScreenOwnerName,P as useScreenParts,M as useScreenPickFollowsSelection,R as useScreenPinned,V as useScreenSaveSwitch,Q as useScreenStorageNamespace,W as useScreenStyleClipboard,F as useStandaloneScreenBridges};
|