efficient-easel 23.0.0 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/dist/autosave/index.d.ts +3 -3
- package/dist/chrome/chrome.css +16 -0
- package/dist/chrome/index.d.ts +9 -3
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-22I55W37.js +2 -0
- package/dist/chunk-2FYFAAAK.js +2 -0
- package/dist/chunk-33P4J2SF.js +1 -0
- package/dist/{chunk-HLMQ34GP.js → chunk-4RRIYPAV.js} +1 -1
- package/dist/{chunk-PY7OOQEZ.js → chunk-55KKGABA.js} +1 -1
- package/dist/{chunk-SINAM2IT.js → chunk-5PXVT7JY.js} +1 -1
- package/dist/chunk-6QSFJCJT.js +21 -0
- package/dist/{chunk-FF54HWSE.js → chunk-C57RLYDQ.js} +6 -6
- package/dist/{chunk-GKG3M5QK.js → chunk-CMBJHSHY.js} +1 -1
- package/dist/chunk-DCBSRZ6Z.js +5 -0
- package/dist/chunk-DSKNJXB4.js +1 -0
- package/dist/chunk-FEF3OQRT.js +16 -0
- package/dist/{chunk-AT4DDMJS.js → chunk-J5OSNZPU.js} +1 -1
- package/dist/{chunk-YHEYJKQL.js → chunk-MYAJ7MGI.js} +1 -1
- package/dist/{chunk-3P735WOM.js → chunk-QWLWSIDH.js} +4 -4
- package/dist/{chunk-FOOK54T2.js → chunk-RMQDKVGW.js} +1 -1
- package/dist/{chunk-XJ23ULBP.js → chunk-VNDPFDO5.js} +1 -1
- package/dist/chunk-WYTPBF3Q.js +20 -0
- package/dist/{chunk-C56MPJBH.js → chunk-Y53EKN35.js} +1 -1
- package/dist/chunk-YCSZAP7T.js +1 -0
- package/dist/chunk-ZOPYJQFS.js +64 -0
- package/dist/easel/easel.css +12 -9
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +35 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/panel.css +4 -0
- package/dist/rowMarks-CO5TpfLY.d.ts +44 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +1 -1
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/device-fields.d.ts +7 -21
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/panel-no-control-mark.d.ts +3 -7
- package/dist/screen/lib/document/panel-no-control-mark.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +1 -1
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/save-status.d.ts +1 -1
- package/dist/screen/lib/screen-parts.d.ts +23 -5
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +21 -21
- package/dist/{types-B3iSHX-w.d.ts → types-SrGNzYeO.d.ts} +6 -0
- package/dist/{words-Cm8PMYn0.d.ts → words-BAx3u2dD.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-4YUC7B7E.js +0 -2
- package/dist/chunk-6F5GO337.js +0 -1
- package/dist/chunk-G3HAKQUF.js +0 -1
- package/dist/chunk-GXRS52JD.js +0 -5
- package/dist/chunk-INRERJU4.js +0 -2
- package/dist/chunk-KXTXYINN.js +0 -16
- package/dist/chunk-MXECWHRJ.js +0 -21
- package/dist/chunk-VZUXOZGP.js +0 -64
- package/dist/chunk-ZG6PVMC3.js +0 -19
package/dist/chunk-6F5GO337.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-FOOK54T2.js";import{SELECTION_MODE as e}from"./chunk-GXRS52JD.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-KXTXYINN.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const K=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:K}}export{m as usePartBridge};
|
package/dist/chunk-G3HAKQUF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-4YUC7B7E.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-3QB2ZQXK.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-ANPOR6EY.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function O(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,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 d(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function A(o,e){const s=t(o,e)??{},c=[];let i=!0,p=!1;for(const[t,o]of Object.entries(s))b.has(t)?(i=t===r.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&o&&"object"==typeof o&&!t.startsWith("_")&&(l(o)||S.has(t)||g.has(t)||d(o)||"slot"!==o.type&&c.push({path:[t],kind:O(o),counted:"mobile"!==n(o)?.tier}));return c}function F(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function L(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 U(t,o,n,e){F(A,t,o,n,e)}function X(t,o,n,e,r){return L(A,t,o,n,e,r)}var B={scope:t=>v(t.siteId),rows:(t,o)=>A(t,o),copy:(t,o,n,e)=>U(e,t,o,n),plan:(t,o,n,e)=>X(e,t,o,n)};function D(t,o){if(!t&&!o)return B;const n=t?.rows,e=n?(t,o)=>n(t,o):A;return{scope:t?.scope??B.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>F(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>L(e,s,t,n,r,o))}}export{U as copyNodeStyle,A as nodeStyleRows,X as planNodePaste,O as shopFieldKind,v as siteStyleScope,D as styleClipboardOf};
|
package/dist/chunk-GXRS52JD.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e}from"./chunk-TCAAOYQY.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-KXTXYINN.js";import{Inspector as i}from"./chunk-MXECWHRJ.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:"selection"};function f(n){return"selection"===n.kind}function a(n,e){if(f(n)&&f(e))return!0;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 d(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function p(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function m(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function k(n,e){return n.isLast?n.isLast(e):e.type===n.last}var h={},v=()=>h,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},C={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 N(){/* @__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 D=o({});function F({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(D.Provider,{value:n,children:e})}function I(){return u(D)}function P(){return(I().useOwnerName??g)()}function T(){return(I().useDocumentLabel??y)()}function x(n,e,t,r){return(I().useBridges??v)(n,e,t,r)}function A(n){return(I().useStandaloneBridges??v)(n)}function B(n,e){(I().useDocumentPass??b)(n,e)}function G(){return I().blockRules??O}function H(){return I().blockLook??C}function K(){return I().devices??j}function R(){return I().leftView??w}function X(){return I().pinned??L}function Y(){return I().saveSwitch??!0}function E(e){n(!0===I().pickFollowsSelection,e)}function J(){return I().storageNamespace||void 0}function M(){return I().styleClipboard??null}function Q(){return I().nodeKeys??!0}function V(){return I().notify??null}function W(){return I().Canvas??N}function Z(){return I().CanvasHead??null}function q(){return I().canvasDrag??null}var z=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(z.Provider,{value:n,children:e})}function $(){return u(z)}function _(){return I().Inspector??S}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,F as ScreenPartsProvider,m as isPinnedFirst,k as isPinnedLast,f as isSelectionMode,d as isSlotMode,a as sameInspectorMode,p as screenSlotsOf,H as useScreenBlockLook,G as useScreenBlockRules,x as useScreenBridges,q as useScreenCanvasDrag,W as useScreenCanvasFrame,Z as useScreenCanvasHead,$ as useScreenCanvasTarget,K as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,_ as useScreenInspectorPanel,R as useScreenLeftView,Q as useScreenNodeKeys,V as useScreenNotify,P as useScreenOwnerName,I as useScreenParts,E as useScreenPickFollowsSelection,X as useScreenPinned,Y as useScreenSaveSwitch,J as useScreenStorageNamespace,M as useScreenStyleClipboard,A as useStandaloneScreenBridges};
|
package/dist/chunk-INRERJU4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";var r="data-sf-no-control";function t(){/* @__PURE__ */
|
|
2
|
-
return n("span",{[r]:"",hidden:!0})}var o="__noControl";function u(n){const r=n?.[o];return r??null}function e(n,r){return{...n,[o]:r}}export{r as NO_CONTROL_ATTR,o as NO_CONTROL_FIELD,t as NoControlMark,e as noControlField,u as noControlMetaOf};
|
package/dist/chunk-KXTXYINN.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-AGWKB77Q.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as l,clickPickPart as i,clickPick as s}from"./chunk-RPMSET77.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,related as w,isTypingTarget as b,WORDS_CLEAR as k,frameRectToHost as S,CANVAS_TYPING_EVENT as C,drawnBox as I}from"./chunk-YU3WHLGI.js";import{queryAllCopies as E}from"./chunk-LF3FUSCQ.js";import{find as D,ROOT_ID as x,getList as O,remove as A,parseZoneKey as M,move as R,duplicate as z,replaceNode as P,createNode as $,insert as L,normalizeData as N,createResolveCache as j,slotsOf as B,resolveNodeData as V,ROOT_SLOT as K}from"./chunk-TGZCD6IP.js";import{topLevelSlotKeys as Z,fieldsFrom as T,drawnBlockCount as F,defaultsFrom as H}from"./chunk-KXM6YRG2.js";import{createContext as W,useEffect as Y,useContext as U,useRef as q,useSyncExternalStore as G,useState as Q,useReducer as X,useMemo as J,useCallback as _,useLayoutEffect as ee}from"react";import{jsx as te,jsxs as ne,Fragment as oe}from"react/jsx-runtime";import{createPortal as re}from"react-dom";import{registerModalEscapeInterceptor as le,FloatingBar as ie,TextToolbar as se,LinkPicker as ae}from"efficient-shell/ui";function ce(e){return!["setData","setUi","set"].includes(e.type)}var de=(e,t,n,o)=>{const r=O(e,t,M(n));return r?.[o]??null},ue=(e,t,n,o,r)=>{const l=de(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function pe(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function fe(e,t,n){return n?"node"===n.kind?D(e,t,n.id)?n:null:n.parentId===x?O(e,t,n)?n:null:D(e,t,n.parentId)&&O(e,t,n)?n:null:null}function he(e,t,n,r=!1){const{itemSelector:l,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,l??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function me(e,t,n){const o=ge(e,t,n);if(o===e)return e;const r=fe(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ge(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 he(e,n,"function"==typeof t.ui?t.ui(pe(e,n)):t.ui);case"set":{const r={data:o,ui:pe(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=he(i,n,l.ui,!0)),i}case"insert":{const r={...M(t.destinationZone),index:t.destinationIndex},l=$(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:L(o,n,r,l)}}case"replace":{const r=ue(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:P(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=ue(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=z(o,n,r.props.id),i=de(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return ge(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=de(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...M(t.destinationZone),index:t.destinationIndex};return{...e,data:R(o,n,r.props.id,l)}}case"remove":{const r=ue(o,n,t.zone,t.index,"remove");return{...e,data:A(o,n,r.props.id)}}default:return e}}var ve={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},ye={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},we=0,be=()=>`history-${we+=1}`;function ke(e){let t=e.config;const r=e.now??(()=>Date.now()),l=e.historyCoalesceMs??250;let i=e.permissions??{};const s=N(e.data,t);let a=s,c={data:s,selection:null,ui:{...ye}};if(e.ui){const{itemSelector:n,selectedSlot:r,...l}=e.ui;c={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...ye,...l}}}let d=[{core:c,at:-1/0,sealed:!0,id:be()}],u=0;const p=e=>{const t=d[u],n=r();!e&&u===d.length-1&&u>0&&!t.sealed&&n-t.at<l?d=[...d.slice(0,u),{...t,core:c,at:n}]:(d=[...d.slice(0,u+1),{core:c,at:n,sealed:e,id:be()}],u=d.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,v=null,y=!1;const w=()=>{for(const e of[...f])e()},b=()=>{d=[...d.slice(0,u),{...d[u],core:c},...d.slice(u+1)]},k=(t,n)=>{g>0?y=y||n:(n?p(!1):c!==t&&b(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},S=e=>{const n=c;if(c=me(c,e,t),c===n)return;const o=e.recordHistory??ce(e);k(n,o&&c.data!==n.data)},C=t=>{0===g&&(v=c,y=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const n=v;v=null,y&&c.data!==n.data?p(!0):c!==n&&b(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},I=e=>{const n=c,o=fe(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},k(n,!1))},E=t=>{const n=c;u=t,c=d[u].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},x=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ve,...i,...n}};let A=x();const M=j(),R={resolveCache:M,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([V(r,t,{cache:M,trigger:e,metadata:n}),...l.map(o=>V(o,t,{cache:M,trigger:e,metadata:n}))]);C(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=D(r,t,i)?.node;s&&s===D(o,t,i)?.node&&(r=P(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:fe(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=D(c.data,t,e)?.node;if(!r)return!1;const l=await V(r,t,{cache:M,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return C(()=>{const n=c;if(D(c.data,t,e)?.node!==r)return;const o=P(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:fe(o,t,c.selection)},k(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,o={data:e.data,ui:pe(e,t)},r="node"===e.selection?.kind?D(e.data,t,e.selection.id)?.node??null:null;return h={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>R.undo(),forward:()=>R.redo(),hasPast:u>0,hasFuture:u<d.length-1,histories:d.map(e=>({id:e.id,state:{data:e.core.data,ui:pe(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<d.length&&e!==u&&E(e)}},getPermissions:A,getItemById:n=>D(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return O(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:C,group:()=>{const e=u,t=d[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,d[e]?.id!==t)return;if(u<=e+1)return void(u===e+1&&(d=[...d.slice(0,u),{...d[u],sealed:!0},...d.slice(u+1)]));const o=d[u];d=[...d.slice(0,e+1),{...o,sealed:!0},...d.slice(u+1)],u=e+1}}},select:e=>I(e?{kind:"node",id:e}:null),selectSlot:e=>I(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){C(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:fe(e.data,t,o)},k(n,e.data!==n.data)})},load(e,n={}){const o=c,r=N(e,t);c={...c,data:r,selection:fe(r,t,n.selection??c.selection)},a=r,n.keepHistory||(d=[{core:c,at:-1/0,sealed:!0,id:be()}],u=0),c!==o&&w()},undo(){u>0&&E(u-1)},redo(){u<d.length-1&&E(u+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,i)||(i=e,A=x(),h=null,w())},setConfig(e){e!==t&&(t=e,A=x(),h=null,w())}};return R}function Se(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&&b(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 Ce=W(null),Ie=W(!0);function Ee({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return Y(()=>{n&&e.resolveAll()},[e,n]),Y(()=>{if(t&&"undefined"!=typeof document)return Se(document,e)},[e,t]),/* @__PURE__ */te(Ce.Provider,{value:e,children:/* @__PURE__ */te(Ie.Provider,{value:t,children:o})})}function De(){const e=U(Ce);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function xe(e){const t=De(),n=q({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 l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return G(t.subscribe,o,o)}function Oe(){return function(e){return xe(e)}}var Ae="data-easel-block",Me="data-easel-dropzone",Re={},ze="data-es-mirror",Pe="undefined"==typeof window?Y:ee;function $e(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${ze}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(ze,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Le({children:t,id:n="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=q(null),[p,f]=Q(null);return Pe(()=>{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]),Pe(()=>{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-easel-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),v(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(i&&o){$e(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>$e(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */te("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?re(t,p):null})}var Ne=W(null),je=W(Re),Be=[];function Ve({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=De(),s=xe(n=>O(n.appState.data,i.config,{parentId:e,slot:t})??Be),a=xe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==x),c=xe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=U(Ne),u=["es-zone"];return s.length&&u.push("has-children"),e===x&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==x&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */te("div",{className:u.join(" "),[Me]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */te(Ue,{node:e},e.props.id))})}function Ke(e,t,n,o){const r=J(()=>{const n={};for(const o of Z(T(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
|
-
return te(Ve,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=F(n[e],o);return r}function Ze(e){return J(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return te(Ve,{parentId:e,slot:t,...n})},[e])}var Te=["top","bottom","zIndex"];function Fe(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function He(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));Fe(e,"position",t?"sticky":"relative");for(const n of Te)Fe(e,n,t?.[n]??"");return!!t}var We="data-es-canvas-relative";function Ye(e){e.hasAttribute(We)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(We));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(We,"")),!1)}function Ue({node:e}){const t=De().config,n=t.components[e.type],o=e.props.id,r=q(null),l=function(e,t){return J(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ae),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Ae,e),n.setAttribute("data-easel-dnd",e),Ye(n))},[e,t])}(o,r),i=q(null),s=!!n?.inline;!function(e,t){const n=q(!1),o=q(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=q(()=>{});Pe(()=>o.current()),Pe(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?Ye(e):He(e));const a=U(je),c=Ke(n,o,e.props,t.components),d=Ze(o);if(!n?.render)return null;const u=n.render,p={...H(n),...e.props,...c},f={renderDropZone:d,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */te(u,{...p,editor:f,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */te("div",{ref:i,[Ae]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */te(u,{...p,editor:f,editMode:!0})})}function qe({metadata:e}){const t=xe(e=>e.config),n=xe(e=>e.appState.data.root).props??{},o=t.root?.render,r=Ke(t.root,x,n,t.components),l=Ze(x),i=/* @__PURE__ */te(Ve,{parentId:x,slot:K}),s=o?/* @__PURE__ */te(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
|
|
5
|
-
return te(je.Provider,{value:e??Re,children:s})}var Ge=W(void 0),Qe=W(void 0);function Xe(e,t,n,o){const r=D(e,t,n);return!!r&&(B(r.node,t).length>0||!1===o.whole)}var Je=W(void 0);function _e({element:e}){const t=q(null),n=nt(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
-
return te("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}var et={"--es-words-clear":`${k}px`};function tt({element:e,words:t=!1}){const n=q(null),o=nt(n,e?()=>e:null,e);/* @__PURE__ */
|
|
7
|
-
return te("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...et}:{display:"none"}})}function nt(e,t,n){return rt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var ot=[];function rt(e,t,n){const[o,r]=Q(ot),l=q(t);return l.current=t,Pe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(ot);let o=0;const i=()=>{o=0;const n=e.current?.parentElement??null,i=(l.current?l.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=I(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=i)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:i.length?i:ot;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();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 lt({id:e,kind:t,overlay:n}){const o=q(null),r=U(Qe),l=null!==e&&!0===r?.(e),i=rt(o,e?t=>E(t,`[${Ae}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=`es-canvas-outline is-${t}${l?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),u=/* @__PURE__ */ne(oe,{children:[
|
|
8
|
-
/* @__PURE__ */te("div",{ref:o,"aria-hidden":"true",className:c,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */te("div",{"aria-hidden":"true",className:c,style:d(e)},t))]});return n&&e?/* @__PURE__ */te(n,{componentId:e,kind:t,children:u}):u}function it(e,t,n){const o=h(e,n),r=o.text.length,l=e.ownerDocument;if(!t)return[r,r];let i=null;const s=l.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))i=o.at(s.offsetNode,s.offset);else{const n=l.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(i=o.at(n.startContainer,n.startOffset))}if(null===i)return[r,r];const a=o.text;let c=i,d=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function st({s:e,element:t,toolbar:n,label:o,keys:r}){const l=g("copy",m),i=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=q(null),[v,y]=Q(!1),[w,b]=Q(null),k=v||null!==w,C=()=>{e.hold(),y(!1),b({href:e.pressed().href})},I=()=>{y(!1),b(null),e.resume()};ee(()=>{r.current={escape:()=>!!k&&(I(),!0),link:()=>!!s.has("link")&&(C(),!0)}}),ee(()=>()=>{r.current=null},[r]);const E=q(I);E.current=I,Y(()=>{if(v)return le(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),Y(()=>{const n=h.current;if(!k||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const l=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),b(null);const l=t();r&&l&&l.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",l,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",l,!0)}},[k,e,t]),ee(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(k&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,l=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,i=(l?a(l,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?S(s,{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top}):{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},p=o.getBoundingClientRect(),f=s?S(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const D=f?{run:u(i.color,f),open:v,onToggle:()=>{b(null),v?I():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
9
|
-
return te(ie,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?S(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__ */te("div",{ref:h,children:/* @__PURE__ */te(se,{layout:"row",offered:s,pressed:i.marks,onMark:t=>{"link"===t?C():e.press(t)},color:D,linkOpen:null!==w,list:{pressed:i.list,onList:t=>e.list(t)},clear:i.clearable?{onClear:()=>e.clear()}:void 0,alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:i.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */ne(oe,{children:[v&&f?/* @__PURE__ */te(p,{colors:f,current:i.color,words:l.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
10
|
-
/* @__PURE__ */te(ae,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==w.href?()=>{b(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function at({element:e,which:t}){const n=q(null),o=nt(n,()=>e(),t);/* @__PURE__ */
|
|
11
|
-
return te("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...et}:{display:"none"}})}function ct({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:b,typing:k,passThrough:S}){const I=De(),E=U(Ge),x=S??E,O=U(Ie),A=g("canvas",e),M=h??O,[R,z]=Q(void 0),P=xe(e=>"node"===e.selection?.kind?e.selection.id:null),[$,L]=Q(null),[N,j]=Q(null),V=U(Je),[,K]=X(e=>e+1,0),Z=e=>{V?.select(e),K()},[T,F]=Q(null),H=q(null),[,W]=Q(0),G=q(k);G.current=k;const J=q(null),_=q(null),ee=()=>{if(!P)return null;const e=G.current?.atSelection?.()?.element()??null;if(!e)return null;const t=_.current?.ownerDocument;if(V){const n=V.selected()&&t?V.selectedPart?.(t)??null:null;return n&&w(n.element,e)?n.element:null}const n=D(I.getState().appState.data,I.config,P);return n&&0===B(n.node,I.config).length?e:null},oe=xe(e=>e.appState.data),re=V?.selected()??null;Y(()=>{const e=_.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=P&&!T&&G.current?.atSelection?.()?P:null,o=n?ee():null;e.dispatchEvent(new t(y,{detail:o?{id:n,words:o}:{id:n}}))},[P,T,oe,re]);const le=e=>{const t=_.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(C,{detail:{typing:e}}))},ie=(e,t)=>{H.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=I.group(),r=e.element,l=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:it(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>W(e=>e+1),onEscape:()=>J.current?.escape()??!1,onLinkKey:()=>J.current?.link()??!1,end:e=>{o.close(),H.current?.element===r&&(H.current=null),F(null),le(!1),G.current?.onChange?.({typing:!1,why:e})}});if(!l)return o.close(),!1;const i=n.closest?.(`[${Ae}]`)?.getAttribute(Ae);return i&&I.select(i),H.current={s:l,element:r,target:e},F(()=>r),L(null),le(!0),G.current?.onChange?.({typing:!0,element:n}),!0};Y(()=>()=>H.current?.s.stop("stop"),[]);const se=e=>{const t=H.current?.element();return Boolean(t&&t.contains(e))},ae=(e,t)=>Xe(I.getState().appState.data,I.config,e,t),ce=e=>{const t=e.closest?.(`[${Ae}]`)?.getAttribute(Ae);if(!t)return;const n=I.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=V?.partAt(e,t)??null;if(r){const e=i(n.appState.data,I.config,t,r.id,o,V?.selected()??null,x);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,I.config,t,o,x)??t,part:null}},de=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(H.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=G.current?.atSelection?.();n&&ie(n,null)&&e.preventDefault()},ue=_.current?.ownerDocument??null,pe=V?.selected()&&ue&&P?V.selectedPart?.(ue)??null:null,fe=pe&&P&&ae(P,pe)?pe.element:null,he=T?null:ee(),me=/* @__PURE__ */ne("div",{ref:_,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),H.current){if(se(t))return;H.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ce(t);if(void 0!==o)return I.select(o.node),void(V&&(o.part?.id??null)!==V.selected()&&Z(o.part?.id??null));t.hasAttribute?.(Me)||(I.select(null),V?.selected()&&Z(null))},onDoubleClick:e=>{const t=G.current;if(!t||se(e.target))return;const n=t.at(e.target);n&&ie(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>de(e),onMouseOver:e=>{if(H.current)return;const t=ce(e.target),n=!!t?.part&&ae(t.node,t.part),o=t?.part&&n&&t.part.id!==V?.selected()?t.part:null,r=!t||t.part&&n?null:t.node;r!==$&&L(r),o?.id===N?.id&&o?.element===N?.element||j(o)},onMouseLeave:()=>{L(null),j(null)},children:[
|
|
12
|
-
/* @__PURE__ */te(Ne.Provider,{value:$,children:/* @__PURE__ */te(qe,{metadata:r})}),
|
|
13
|
-
/* @__PURE__ */ne("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
14
|
-
/* @__PURE__ */te(lt,{id:!T&&$&&$!==P?$:null,kind:"hover",overlay:v}),V?/* @__PURE__ */te(_e,{element:T||!N||N.id===V.selected()?null:N.element}):null,he||fe?/* @__PURE__ */te(tt,{element:T?null:he??fe,words:null!==he}):null,
|
|
15
|
-
/* @__PURE__ */te(lt,{id:T||fe||he?null:P,kind:"selected",overlay:v}),T?/* @__PURE__ */te(at,{element:()=>{const e=T?.()??null;return e?pe&&w(pe.element,e)?pe.element:e:null},which:pe?.element??T}):null]}),b]}),ge=m?/* @__PURE__ */te(m,{document:R,children:me}):me;Y(()=>{if(R&&M)return Se(R,I)},[R,M,I]),Y(()=>{if(!R)return;const e=e=>{if("Enter"===e.key)return void de(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=I.getState();if("node"!==n.selection?.kind)return;if(V?.selected())return void Z(null);const o=l(n.appState.data,I.config,n.selection);"node"===o?.kind&&I.select(o.id)};return R.addEventListener("keydown",e),()=>R.removeEventListener("keydown",e)},[R,I,V]);/* @__PURE__ */
|
|
16
|
-
return ne("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-easel-preview":"","data-es-typing":T?"":void 0,children:[T&&H.current?.target.toolbar?/* @__PURE__ */te(st,{s:H.current.s,element:H.current.element,toolbar:H.current.target.toolbar,label:A.textTools,keys:J}):null,t?/* @__PURE__ */te(Le,{mirrorStyles:a,onDocument:e=>{z(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:ge}):/* @__PURE__ */te("div",{id:"preview-frame","data-easel-entry":"",children:ge})]})}function dt(e={}){const t=De(),n=xe(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function ut(){return ft(xe(e=>e.selectedItem))}function pt(){return ft(null)}function ft(e){const n=De(),o=xe(e=>e.config),r=n.resolveCache,l=xe(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=J(()=>e||{type:"root",props:s},[e,s]),c=e?o.components[e.type]:o.root,d=n.getState(),u=e?D(d.appState.data,o,i):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:i,node:a,block:c,parent:f,appState:d.appState}),m=xe(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=_(e=>{(async()=>{const t=n.getState();if("root"!==i){const l=t.getItemById(i),s=t.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...e}},{node:c}=await V(a,o,{cache:r,trigger:"replace"}),d=n.getState().getSelectorForId(i);if(!d)return;return void n.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const l=t.appState.data.root.props??{},{node:s}=await V({type:"root",props:{...l,...e}},o,{cache:r,trigger:"replace"});n.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[n,o,r,i]),v=_((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{Le as CanvasFrame,Je as CanvasPartsContext,Ge as CanvasPassThroughContext,Qe as CanvasSharedContext,ye as DEFAULT_UI,ct as EaselCanvas,Ee as EaselProvider,qe as EditDocument,Se as bindUndoKeys,ke as createEasel,Oe as createUseEasel,Xe as partHasOwnBox,ce as recordsByDefault,me as reduce,pe as uiView,xe as useEasel,De as useEaselApi,dt as useEaselNodeOps,pt as useRootFields,ut as useSelectedFields,fe as validSelection};
|
package/dist/chunk-MXECWHRJ.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-FIVU2COQ.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-Y2T3JX7K.js";import{FieldSelect as c}from"./chunk-KFWNGPW3.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-JACEEVVF.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-S3DUFDQ6.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-6NJHYXJM.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,ItemCount as y,SortableList as k,ListRow as x,ContextMenu as w,tabPanelId as C,Tabs as N,tabButtonId as O}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as j,useState as $,useLayoutEffect as S,useId as D}from"react";import{jsx as I,jsxs as F}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as E,MoveDownIcon as M,DuplicateIcon as W,TrashIcon as T}from"efficient-shell/icons/efficient";function z({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__ */I(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__ */I(v,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function R(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function A(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function H(e,n){return e.filter((e,t)=>t!==n)}function J(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var K='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',V={parentId:"list",slot:"items"};function Y({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:C=!1,open:N,onOpen:O,renderItem:D,renderRow:z,canRemove:Y,lockedReason:B,fixed:Q=!1,removeOnRow:X=!0,canDuplicate:U,above:Z,head:q=!0}){const G=h("fields",d).list,_=h("tree",l),ee=r??G.item,ne=!C&&!Q&&("number"!=typeof v||o.length<v),te=o.length<=g,le=e=>!!Y&&!Y(o[e],e),ae=e=>!C&&!Q&&X&&!te&&!le(e),re=e=>ne&&(!U||U(o[e],e)),oe=(e,n)=>u?u(e,n):G.itemName({noun:ee,n:n+1}),ie=j([]),se=j(null),[ce,de]=$(null),ue=j(null),[me,he]=$(null),[pe,fe]=$("");S(()=>{const e=se.current;if(!e)return;se.current=null;const n=ie.current[e.index]?.querySelectorAll(K)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=ie.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(K)].indexOf(l),a=l;se.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(A(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(N,e,n);a!==N&&O(a),fe(G.moved({n:n+1,total:o.length}))},ge=e=>{ne&&(i(R(o,e,s())),z?(se.current={index:e,nth:0,start:null,end:null},null!==N&&N>=e&&O(N+1)):O(e))},ve=e=>{ae(e)&&(i(H(o,e)),N===e?O(null):null!==N&&N>e&&O(N-1))},ye=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===V.parentId&&n.slot===V.slot,onDrop:(e,n)=>{const t=f({...V,index:e},n);t!==e&&be(e,t)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:C}),ke=e=>{const n=[];return e>0&&n.push({label:G.moveUp,icon:/* @__PURE__ */I(E,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<o.length-1&&n.push({label:G.moveDown,icon:/* @__PURE__ */I(M,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),re(e)&&n.push({label:G.duplicate,icon:/* @__PURE__ */I(W,{size:14}),onClick:()=>(e=>{re(e)&&(i(R(o,e+1,J(o[e]))),null!==N&&N>e&&O(N+1))})(e)}),ae(e)&&n.push({label:G.delete,icon:/* @__PURE__ */I(T,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{C||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
-
return F("div",{className:"es-list",children:[q?/* @__PURE__ */F("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */F("span",{className:"es-list-label",children:[n?/* @__PURE__ */I("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
-
/* @__PURE__ */I(y,{count:o.length,label:G.count({noun:ee,n:o.length}),showZero:!0})]}):null,Z?/* @__PURE__ */I("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */F(k,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[o.map((e,n)=>{const l=ye.row({item:n,place:{...V,index:n}}),a=l.draggable&&ce!==n,r=!z&&N===n,o=!C&&!Q&&X&&le(n),i=["es-list-row",z?"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__ */I(t,{...ye.seam({place:{...V,index:n}}),onAdd:ne?()=>ge(n):void 0,label:G.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
-
/* @__PURE__ */I(x,{className:i,flat:!!z,active:r,draggable:l.draggable,dragHint:_.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>be(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ie.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,ue.current=t&&!a?t:null,de(a?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{C||(e.preventDefault(),e.stopPropagation(),xe(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 xe(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:C||Q||!X?void 0:o?b(B?B(e,n):G.locked,/* @__PURE__ */I("span",{className:"es-list-lock",role:"img","aria-label":B?B(e,n):G.locked,children:/* @__PURE__ */I(L,{size:13})})):b(G.deleteItem({noun:ee}),/* @__PURE__ */I("button",{type:"button",className:"es-list-x","aria-label":G.deleteItem({noun:ee}),disabled:!ae(n),onClick:()=>ve(n),children:"×"})),below:r?/* @__PURE__ */I("div",{className:"es-list-item",children:D(e,n,we(n))}):void 0,children:z?/* @__PURE__ */I("div",{className:"es-list-row-main",children:z(e,n,we(n))}):/* @__PURE__ */F("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>O(r?null:n),children:[m?/* @__PURE__ */I("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
|
|
6
|
-
/* @__PURE__ */I("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */I("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
-
/* @__PURE__ */I(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
-
/* @__PURE__ */I(t,{...ye.seam({place:{...V,index:o.length}})})]}):null,C||Q?null:/* @__PURE__ */I("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(o.length),children:G.add({noun:ee})}),
|
|
9
|
-
/* @__PURE__ */I("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<o.length?
|
|
10
|
-
/* @__PURE__ */I(w,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:a(ke(me.index))}):null]})}var B=e=>e<6?e+1:6,Q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function X({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=$(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
-
return I(o,{id:`${l}-group`,title:Q(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */I(Z,{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:B(u)},e))})}function U({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]=$(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return I(Y,{label:Q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>J({...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__ */I(Z,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function Z(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
-
return I(u,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(z,{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 I(u,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
-
return I(u,{label:Q(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return I(u,{label:Q(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(m,{ariaLabel:Q(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 I(X,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return I(U,{...e,field:n});case"slot":return null}}var q=e=>r.includes(e);function G(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 _(e){return new Map(G(e).rows.map(e=>[e.name,e.bucket]))}function ee(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 ne({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=h("panel",i),j=D(),S=p??`es-insp${j.replace(/:/g,"")}`,P=G(e,{values:n,context:r}),[L,E]=$(void 0),M=s??L,W=M&&P.buckets.includes(M)?M:P.buckets[0],[T,z]=$(null),R=T&&T.panel===S&&P.rows.some(e=>e.name===T.name)?T:null,A=d&&P.buckets.length>1,H=A&&W?C(S,W):`${S}-rows`,[J,K]=$(()=>/* @__PURE__ */new Set),V=y??J,Y=(e,n)=>{/* @__PURE__ */return I(o,{title:e.title,open:!V.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&K(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${S}-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},Q=e=>A&&e!==W,X=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */I("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!Q(i)||void 0,children:/* @__PURE__ */I(Z,{field:o,name:e,id:`${S}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:R&&R.name===e?R.index:null,onOpenItem:n=>z(null===n?null:{panel:S,name:e,index:n}),headingLevel:s?B(x):x})},e);/* @__PURE__ */
|
|
19
|
-
return F("div",{className:"es-insp",children:[A?/* @__PURE__ */I("div",{className:"es-insp-tabs",children:/* @__PURE__ */I(N,{variant:"underline",block:!0,"aria-label":f??w.settings,idPrefix:S,value:W,onChange:e=>{const n=e;void 0===s&&E(n),c?.(n)},items:P.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */I("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
-
/* @__PURE__ */F("div",{className:"es-insp-rows",id:H,role:A?"tabpanel":void 0,"aria-labelledby":A&&W?O(S,W):void 0,children:[b?v?/* @__PURE__ */I("div",{className:"es-insp-band","data-fold":v.key,children:Y(v,b)}):b:null,ee(P.rows).map((e,n)=>{if(!e.fold)return e.rows.map(X);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
-
return I("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!Q(t)&&!l)||void 0,children:Y(e.fold,e.rows.map(X))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{z as FieldText,ne as Inspector,Z as InspectorField,Y as ListField,_ as bucketsOf,J as copyItem,R as insertAt,Q as labelOf,A as moveTo,G as planFields,H as removeAt};
|
package/dist/chunk-VZUXOZGP.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-G3HAKQUF.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-DDH2DYQP.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-YHEYJKQL.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-C56MPJBH.js";import{usePartBridge as g}from"./chunk-6F5GO337.js";import{useSectionOps as y}from"./chunk-FOOK54T2.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-FF54HWSE.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as O,PanelShowStrip as N}from"./chunk-SINAM2IT.js";import{offeredChoices as I}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as B,useScreenPinned as M,useScreenDocumentLabel as $,useScreenCanvasFrame as j,useScreenInspectorPanel as T,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as F,isSelectionMode as R,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as V,useScreenBlockLook as Y,useScreenStorageNamespace as W,useScreenNotify as U,useScreenCanvasHead as G,isSlotMode as J,useScreenStyleClipboard as X,useScreenDocumentPass as K,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as Z,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee}from"./chunk-GXRS52JD.js";import{MediaPopup as ne}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as te,useNodeContextMenu as oe}from"./chunk-AT4DDMJS.js";import{PageEditGuardNotices as re}from"./chunk-GKG3M5QK.js";import{useScreenDocument as ie}from"./chunk-A6ZP5II4.js";import{requestMediaPick as le}from"./chunk-UNVKPVZW.js";import{useMediaPanel as se,usePanelPick as de,useMediaBrowsing as ae,useOpenMediaBrowse as ce,useMediaPlace as pe}from"./chunk-FHCKFOCD.js";import{useEaselSession as ue}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as fe}from"./chunk-MQA7OFRA.js";import{LayersIcon as me,MediaIcon as ge}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-IYHO4XQX.js";import{heldStyle as ve,styleShortcut as be}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{rootRowName as Se,slotChildRowName as we,slotChildRenameProp as xe,sectionRenameProp as ze}from"./chunk-SSRYU3YG.js";import{ROOT_ZONE as Ce,blockNodeActions as Oe,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Pe,newNodeId as Be,slotChildrenIn as Me,nestsInTree as $e}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Te,CanvasPartsContext as Ae,partHasOwnBox as Le,CanvasPassThroughContext as Ee,CanvasSharedContext as Fe}from"./chunk-KXTXYINN.js";import{TreeRow as Re,Subtree as De,LayersTree as He,TreeGroupLabel as Ve,TreeRowAction as Ye,TreeSeam as We}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ue}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ge}from"./chunk-WK3AFPXY.js";import{toItemSelector as Je,useNodeOps as Xe,clickPick as Ke}from"./chunk-RPMSET77.js";import{EaselTopBar as Qe,EaselIconButton as Ze,TopBarCluster as _e,DeviceSwitch as qe,InspectorIconButton as en,PanelResizeHandle as nn,MAX_PANEL_W as tn,MIN_PANEL_W_BY_SIDE as on,panelWidthVars as rn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as ln,DEFAULT_CHROME_WORDS as sn}from"./chunk-AJSDWWJW.js";import{holderOf as dn,nameOrSomeone as an}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as cn}from"./chunk-RE4LP46F.js";import{useWords as pn}from"./chunk-MFIRYGHW.js";import{insertSeams as un,CanvasDragLayer as hn,CanvasInsert as fn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as mn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as gn,useTreeDrag as yn,gapToMoveIndex as vn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as bn,LIST_SELECTOR as kn,BLOCK_SELECTOR as Sn,useCanvasTyping as wn,useCanvasEvent as xn,nodeIdAt as zn,frameRectToHost as Cn,BLOCK_ATTRIBUTE as On,drawnBox as Nn}from"./chunk-YU3WHLGI.js";import{queryMainCopy as In}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as Bn,zoneKey as Mn,parseZoneKey as $n,find as jn,DataError as Tn}from"./chunk-TGZCD6IP.js";import{useRef as An,useMemo as Ln,useState as En,useEffect as Fn,useCallback as Rn,useLayoutEffect as Dn,useContext as Hn,Fragment as Vn,useId as Yn}from"react";import{ColoredBadge as Wn,Button as Un,Tabs as Gn,toast as Jn,readMediaFileDrag as Xn,Tooltip as Kn,groupColors as Qn,Dialog as Zn,FormField as _n,Input as qn,MEDIA_FILE_DRAG_TYPE as et}from"efficient-shell/ui";import{UndoIcon as nt,RedoIcon as tt,RefreshIcon as ot,AddIcon as rt,TrashIcon as it,EyeOffIcon as lt,EyeIcon as st,SharedIcon as dt,DuplicateIcon as at}from"efficient-shell/icons/efficient";import{jsx as ct,jsxs as pt,Fragment as ut}from"react/jsx-runtime";var ht="media-file";function ft({name:e,onMake:n,onCancel:t}){const o=pn("screen",ye).shared,[r,i]=En(e),[l,s]=En(!1),d=Yn(),a=An(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return ct(Zn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */pt(ut,{children:[
|
|
3
|
-
/* @__PURE__ */ct(Un,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */ct(Un,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ct("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ct(_n,{label:o.name,htmlFor:d,children:/* @__PURE__ */ct(qn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var mt=/* @__PURE__ */new WeakSet;function gt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function yt({canvas:e,tabs:n,onSelect:t}){const o=An(null),[r,i]=En({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Dn(()=>{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=Cn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=In(t,`[${On}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Nn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Cn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */ct("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */ct("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */ct(Kn,{content:e.reach,children:/* @__PURE__ */pt(Wn,{colorClass:Qn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */ct("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ct(dt,{size:12})}),e.label]})}):/* @__PURE__ */ct(Wn,{colorClass:Qn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function vt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return ct("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */pt(ut,e?{children:[
|
|
8
|
-
/* @__PURE__ */ct("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */ct("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */ct("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */ct("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */ct("path",{d:"M5 12h14"})]})})}var bt=`${kn}, ${Sn}`;function kt(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 St="__rungs";var wt="screen:band",xt={duplicate:!0,delete:!0},zt=()=>null;function Ct(){const kn=he(),Cn=kn.panels?.Toolbar,On=(kn.panels?.useRight??zt)(),{target:Nn,docId:Yn,capabilities:Kn,currentSlug:Qn,siteId:Zn,onPublish:_n,saveState:qn,saveConflict:dt,retrySave:Ct,toggleAutoSave:Ot,flushSave:Nt,access:It,saveUnreachable:Pt=!1,readOnly:Bt,readOnlyReason:Mt=null}=ie(),$t=P(),jt=B(),{mediaEditing:Tt,hasEditGuard:At,hasPinnedChrome:Lt}=Kn,{appState:Et,dispatch:Ft,history:Rt,selectedItem:Dt,getSelectorForId:Ht,config:Vt}=je(e=>e),Yt=M(),{first:Wt,firstGroup:Ut,lastGroup:Gt,isSectionGroup:Jt,sectionGroupZone:Xt,panelOf:Kt}=Yt,Qt=Kt(Wt),Zt=e=>_(Yt,e),_t=e=>q(Yt,e),qt="node"===Yt.firstRow,eo=Yt.band??null,no=pn("screen",ye),to=pn("tree",Ue),oo=pn("drag",mn),ro=pn("notice",ln),io=pn("lock",cn),lo=pn("menu",Ge),so=pn("styleClipboard",ke),ao=pn("chrome",sn),co=$()??`/${Qn}`,po=j(),uo=T(),ho=y({readOnly:Bt}),fo=y({readOnly:Bt,foldIntoHistory:!0}),mo=An(null),go=Te(),yo=Ln(()=>({...ho,select:e=>{mo.current=e,ho.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=go.config;mo.current=Je(e,t,n)}ho.commitDocument(e,n)}}),[ho,go]),vo=Et.ui,bo=vo.leftSideBarVisible,ko=vo.rightSideBarVisible,{options:So,widths:wo,initial:xo,fluid:zo,fit:Co}=A(),[Oo,No]=En(xo),Io=se(),Po=Tt&&null!==Io;de(),ae();const Bo=ce();L(Dt?.props.id);const{read:Mo,write:$o,forSelection:jo}=E(),[To,Ao]=En(Mo);Fn(()=>{$o(To)},[To]);const[Lo,Eo]=En(0),Fo=An(null),Ro=An(null),Do=bn(Ro,{readySelector:bt}),Ho=wn(Do),Vo=d(Ro);a(Ro,Do);const Yo=k(),Wo=dn(It),Uo={state:qn,offline:Yo||qn.failed&&Pt,readOnlyReason:Mt,editing:Wo?ro.editing({name:an(Wo.name,io),noun:no.noun}):null,conflict:null!=dt,notSaving:no.bar.notSaving},Go=()=>{Bt||(qn.failed?Ct():Nt())};c(Ro,Do,Go);const[Jo,Xo]=En(!1),Ko=An(!1),[Qo,Zo]=En(null),[_o,qo]=En([]),[er,nr]=En(F);R(er);const tr=o(er,Dt?.props.id),[or,rr]=En(null);Fn(()=>{or&&(r(),rr(null))},[or]);const ir=An(Ht);ir.current=Ht;const lr=Rn((e,{scroll:n})=>{Ao(n=>jo(e,n)),n&&rr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ir.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ar(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),sr=An(null);Fn(()=>{const e=sr.current;sr.current=null;const n=null==Dt?.props.id?null:String(Dt.props.id);nr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Kt(Dt?.type)??F);const t=Dt?.props.id,o=mo.current;if(mo.current=null,!t)return;const r=Ht(t);lr(String(t),{scroll:!i(o,r??null,Ce)})},[Dt?.props.id,lr]);const dr=Rn(e=>{nr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),ar=An(()=>{});ar.current=(e,n)=>{const t=e?Bi(e.zone??Ce)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Dt?.props.id?null:String(Dt.props.id);nr(e=>D(e,n)?e:n),o!==r&&(sr.current={id:o,mode:n},yo.select(e))};const cr=Rn((e,n)=>ar.current(e,n),[]),pr={kind:er.kind,mode:er,open:dr,show:e=>nr(e),reveal:()=>{ko||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:cr},ur=H(pr,{data:Et.data,selected:Dt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean(Bt),select:e=>{nr(F),yo.select({index:e})},replace:(e,n)=>yo.replaceComponent(Ce,e,n),scrollTo:e=>l(e)},{device:Oo,refreshes:Lo},{setView:Ao,reveal:()=>{bo||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),hr=ur.resolveLeftView?ur.resolveLeftView(To):"sections",fr=V(),{isLockedBlock:mr,duplicateBlocked:gr,nestDepth:yr,newSectionNode:vr,canAddTo:br,blockIsOffered:kr}=fr,Sr=Y(),{labelAtLevel:wr,Icon:xr,useProducts:zr}=Sr,Cr=Sr.rowName?(e,n,t)=>Sr.rowName(e,n,t):void 0,Or=Rn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),lr(e,{scroll:!0})},[Ft,lr]),{selectNode:Nr,openPartId:Ir}=g({mode:er,setMode:nr,onOpenPart:Or}),[Pr,Br]=En(null);fe(null!==Pr,()=>Br(null));const Mr=h(W()),$r=Mr.collapsed,jr=Mr.panelWidths,[Tr,Ar]=En(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem($r);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Fn(()=>{try{window.localStorage.setItem($r,JSON.stringify([...Tr]))}catch{}},[Tr]);const[Lr,Er]=En(()=>{if("undefined"==typeof window)return{...f};try{const e=window.localStorage.getItem(jr);if(!e)return{...f};const n=JSON.parse(e);return{left:m(Number(n.left)||f.left,"left"),right:m(Number(n.right)||f.right,"right")}}catch{return{...f}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(jr,JSON.stringify(Lr))}catch{}},300);return()=>clearTimeout(e)},[Lr]);const Fr=Rn((e,n)=>Er(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Rr=Rn(e=>Fr("left",e),[Fr]),Dr=Rn(e=>Fr("right",e),[Fr]),Hr=e=>Tr.has(e),Vr=e=>Ar(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=An(!1),Wr=An(null);Fn(()=>{if(Yr.current&&!Jo){const e=Wr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ro.current?.querySelector(`button[aria-label="${CSS.escape(no.add.title)}"]`))?.focus(),Wr.current=null}Yr.current=Jo},[Jo]),Fn(()=>{if(!Jo||!Vo)return;const e=e=>{"Escape"===e.key&&dl()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Jo,Vo]),fe(Jo,()=>dl()),Fn(()=>{!bo&&Jo&&(Xo(!1),Zo(null),Ko.current=!1)},[bo]);const Ur=U(),Gr=(e,n="success",t)=>{if(Ur)return void(t?Ur(e,"error"===n?"error":"info",t):Ur(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Jn.error(e,{...o,duration:t?.duration??3200}):Jn.success(e,{...o,duration:t?.duration??1900})},Jr=An(null),[Xr,Kr]=En(0),[Qr,Zr]=En(0),_r=G(),qr=An(null),ei=e=>Math.max(0,e.clientHeight-(qr.current?.offsetHeight??0));Fn(()=>{const e=Jr.current;if(!e)return;const n=()=>{Kr(e.clientWidth),Zr(ei(e))};n();const t=new ResizeObserver(n);return t.observe(e),qr.current&&t.observe(qr.current),()=>t.disconnect()},[]),Dn(()=>{Jr.current&&(Kr(Jr.current.clientWidth),Zr(ei(Jr.current)))},[Lr,bo,ko]);const ni=Oo===zo?Xr>0?Xr:wo[zo]:wo[Oo],ti=Xr>0?Math.min(Xr/ni,"shrink"===Co?1:2):1,oi=ni*ti,ri=Xr>0&&oi>Xr+1,ii={width:oi,height:Qr||"100%",flex:"none",position:"relative"},li={width:ni,height:Qr?Qr/ti:"100%",maxHeight:"none",transform:1!==ti?`scale(${ti})`:void 0,transformOrigin:"top left"},si=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!bo}}),di=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!ko}}),ai=e=>{Jo&&(Xo(!1),Zo(null),Ko.current=!1,bo&&To===e)||(Ao(e),bo||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},ci=()=>{nr(Qt??F),ko||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},pi=Et.data.content??[],ui=()=>{const e=pi.findIndex(Zt),n=pi.findIndex(_t);return{floor:e>=0?e+1:0,cap:n>=0?n:pi.length}},hi=Vt,fi=fr.stripCopy,mi=n=>e(n,fi),gi=te(),yi=Xe({data:Et.data,config:hi,readOnly:Boolean(Bt),clipboard:gi,strip:fi?e=>fi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==Bn)return{min:0,max:n-1};const{floor:t,cap:o}=ui();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&nr(F);const t=void 0===n||"node"===n?.kind?n:null;yo.commitDocument(e,t)}}),vi=ue(),[bi,ki]=En(null),Si=e=>{const n=pi.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&yi.swap(e,t.detach(n))},wi=e=>{const n=jn(Et.data,Vt,e);if(!n)return!1;const t=Mn(n.place),o=n.node,r=t===Ce?Ni(o):Hi(o),i=t===Ce?Yt.shared?.usedOn(o):null;return!!yi.remove(e)&&(Gr(i?no.shared.removed({count:Math.max(0,i.length-1)}):no.deleted({name:r}),"success",{duration:8e3,action:{label:no.bar.undo,onClick:()=>{yi.restore(n.node,n.place)}}}),!0)},xi={...yi,remove:wi},zi=e=>wr(e,"block",Vt.components[e]?.label??e),Ci=Rn(e=>Vt.components[e]?.defaultProps??{},[Vt]),Oi=e=>wr(e,"section",zi(e)),Ni=e=>Se({type:e.type,props:e.props??{}},Oi(e.type),Cr),{nodeAddresses:Ii,zoneItems:Pi}=Ln(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(Vt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(pi,Ce,0),{nodeAddresses:e,zoneItems:n}},[pi,Vt]),Bi=Rn(e=>Pi.get(e)??[],[Pi]),Mi=e=>{const n=Ii.get(e);return n?Bi(n.zone)[n.index]:void 0},$i=e=>ee(fr,Vt,e),ji=e=>{if(!fr.slotsOf||e===Ce)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Mi(e.slice(0,n));if(!t)return null;const o=$i(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}},Ti=(()=>{if(!J(er))return null;const e=`${er.nodeId}:${er.slot}`;return ji(e)?.slot.panel===er.kind?e:null})(),Ai=An(null);Fn(()=>{const e=Ai.current;if(Ai.current=null,!Ti||!J(er))return;const n=er.nodeId;lr(n,{scroll:e!==Ti}),Ar(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[er]);const Li=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===Ce?nl(n.index):Il(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&&Ti!==i&&(Ai.current=i),cr(null,r),ko||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ei=(e,n,t)=>{const o=`${e}:${n}`;if(Ar(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;Ti!==o&&(Ai.current=o);cr(null,{kind:t,nodeId:e,slot:n})},Fi=(e,n,t)=>{if(Bt||!fr.moveSlot)return;const o=Mi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:St,index:n},s=vn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=fr.moveSlot(e,n,s);"string"==typeof d&&Ei(e,d,i.panel)},Ri=zr(),Di=Ln(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Hi=e=>we(e,zi,Sr.plainText,e=>Di.get(e),Sr.rowName),Vi=(e,n)=>{const t=Vt.components[e.type]?.fields,o=n===Ce||es(n)?"section":"block",r=n===Ce&&(Zt(e)||_t(e)||Jt(e.type)),i="block"===o?xe(t):r?null:ze(t);return Sr.renamePropOf?Sr.renamePropOf(e,o,i):i},Yi=(e,n,t,o)=>{if(!(!Bt&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{Br(null),o&&((e,n,t)=>{const o=Bi(e)[n];if(!o)return;const r=Vi(o,e);r&&yo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return ct("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":no.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)},Wi=t(X(),so),Ui=Wi.scope({target:Nn,siteId:Zn,docId:Yn}),Gi=Vt,Ji=(e,n)=>n===Ce?Oi(e):zi(e),Xi=(e,n,t)=>{const o=Wi.plan(Ui,t,Ji(t.type,e),Gi);o&&(o.changed&&yo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Gr(o.message))},Ki=oe({nodesIn:Bi,nodeAt:(e,n)=>Bi(e)[n]??null,labelOf:(e,n)=>n===Ce?Oi(e):zi(e),renamePropOf:Vi,beginRename:(e,n)=>Br({zone:e,index:n}),history:{hasPast:Rt.hasPast,hasFuture:Rt.hasFuture,back:()=>Rt.back(),forward:()=>Rt.forward()},openPageStyles:ur.openPageStyles,pageStylesLabel:no.pageStyles,words:{menu:lo,styleClipboard:so,screen:no.menu},readOnly:Boolean(Bt),collapseAll:()=>Ar(new Set(Bi(Ce).map(e=>String(e.props.id)))),onPasteRefused:e=>Gr(e?no.pasteRefused({name:e.label}):no.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>os(e,n),menuRows:(e,n,t)=>{const o=ur.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Ce)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:no.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Bt||mr(e.type,e)?n:{...n,change:[{label:no.shared.detach,onClick:()=>Si(e.props.id)}],remove:[{label:no.shared.removeFromPage,danger:!0,onClick:()=>{wi(e.props.id)}}]}}return Bt||Zt(e)||_t(e)||Jt(e.type)?null:x(vi)?{change:[{label:no.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>mr(e.type,e),duplicateBlocked:e=>gr(Et.data,e),permits:e=>{const n=Oe(Vt,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:xi,isPinned:(e,n)=>n===Ce&&(Zt(e)||_t(e)),sectionBand:ui,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===Ce?Ni(e):Hi(e),selectAt:(e,n,t,o)=>{e===Ce?nl(n):Il(e,n,t,o??"")},slotRung:e=>{const n=ji(e);return n?.slot.panel?{label:n.slot.label,select:()=>Li(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ui),canCopy:e=>Wi.rows(Gi,e).some(e=>!1!==e.counted),copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:(e,n,t)=>Xi(e,n,t)},keys:jt?{target:Vo,selected:()=>{const e=Et.ui.itemSelector;return e?{zone:e.zone??Ce,index:e.index}:null},held:()=>gi.get(),readOnly:Boolean(Bt),onDone:({done:e,name:n})=>{"copied"===e&&Gr(no.copied({name:n}))}}:void 0},Do),Qi=An({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{Qi.current={copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:Xi,at:()=>{const e=Et.ui.itemSelector;if(!e)return null;const n=e.zone??Ce,t=Bi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Bt)}});const Zi=Rn(e=>{const n=be(e);if(!n)return;const t=Qi.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))},[]);Fn(()=>{if(!Vo)return;const e=e=>Zi(e);return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Zi,Vo]),xn(Do,"keydown",Zi);const _i=pi.map(e=>e.props.id).join("|");Fn(()=>{const e=Do?.document??null,n=Do?.window??null;let t=0;const o=[],r=()=>{if(!e)return void qo(e=>e.length?[]:e);const n=pi.findIndex(_t),t=n>=0?n:pi.length,o=n=>{const t=pi[n]?.props?.id;return null==t?null:In(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=pi.length>0&&!Zt(pi[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=kt(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})}qo(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()}},[Do,_i,Oo,ti,bo,ko,Dt?.props.id]);const qi=Do?.document??null,el=Do?.window??null;Fn(()=>{const e=Fo.current;if(!e||!qi||!el)return;const n=[],t=()=>{const n=In(qi,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&el.scrollTo({left:el.scrollX,top:el.scrollY+t,behavior:"instant"}),!0};return Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[qi,el]);const nl=e=>{nr(F),yo.select({index:e}),ur.sectionPressed?.(pi[e]);const n=pi[e]?.props?.id;n&&l(n)},tl=e=>{const{floor:n,cap:t}=ui(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Dt&&er.kind!==Qt?.kind?pi.findIndex(e=>e.props.id===Dt.props.id):-1;return o(r>=0?r+1:t)},ol=(e,n)=>{const{floor:t,cap:o}=ui(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(yo.reorderComponent(Ce,e,i),yo.select({index:i}),{moved:!0,dest:i})},rl=(e,n,t,o)=>{nr(F),yo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Gr(no.sectionAdded({name:t}))},il=(e,n)=>{const t=tl(n),o=vr(e,{nodeDefaults:Ci,newNodeId:Be,sectionLabel:Oi,blockIsOffered:kr}),r=o?yo.insertNode(Ce,t,o):yo.insertSection(e,t);return rl(t,r,Oi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(Vt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=br(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},ll=e=>sl(Ce,e),sl=(e,n)=>{Wr.current=document.activeElement??null,Zo(null===n?null:{zone:e,index:n}),Xo(!0),bo||(Ko.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},dl=()=>{Xo(!1),Zo(null),Ko.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Ko.current=!1},al=(e,n)=>Sr.rowName?n?Zt(e)?Sr.rowName(e,"section",no.header):_t(e)?Sr.rowName(e,"section",no.footer):Jt(e.type)?Sr.rowName(e,"section",zi(e.type)):Ni(e):Hi(e):n?Oi(e.type):zi(e.type),cl=e=>n=>{e()},pl=(e,n,t)=>{if(Bt)return null;const o=Bi(e)[n];return o&&!Oe(Vt,o.type).delete||o&&mr(o.type,o)?null:/* @__PURE__ */ct(Ye,{kind:"delete",label:e===Ce&&o&&Yt.shared?.usedOn(o)?no.shared.removeFromPage:no.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Bi(e)[n]?.props?.id;null!=t&&wi(String(t))})(e,n),children:/* @__PURE__ */ct(it,{size:15})})},ul=e=>Sr.rowPreview?.(e)||void 0,hl=e=>Sr.rowMarks?.(e)??void 0,fl=(e,n,t)=>Sr.rowActions?.(e,n,t)??null,ml=(e,n,t,o)=>{if(Bt)return null;if(mr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return ct(Ye,{kind:"eye",label:r?no.showNamed({name:o}):no.hideNamed({name:o}),onClick:()=>yl(e,n,t),children:/* @__PURE__ */ct(r?lt:st,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},gl=e=>Xs(Ce,e),yl=(e,n,t)=>{yo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},vl=e=>Pe(Vt,e),bl=e=>Ie(Vt,e),kl=e=>fr.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Me(e,n.slot)})):[{slot:null,rung:null,kids:bl(e)}],Sl=e=>fr.slotsOf?kl(e).flatMap(e=>e.kids):bl(e),wl=e=>Boolean(fr.slotsOf)&&$i(e).some(e=>e.rung),xl=(e,n,t)=>null===t?void 0===n?br(e):br(e,n):br(e,n,t),zl=(e,n,t)=>{const o=$e(Vt,e.type,n)&&(t||Sl(e).length>0||wl(e));return{collapsible:o,folded:o&&Hr(String(e.props.id))}},Cl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>zl(e,r,t(e.type)).collapsible?[String(e.props.id),...Cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ol=e=>Sl(e).length>0||wl(e)||Boolean(br(e.type)),Nl=e=>Boolean(br(e)),Il=(e,n,t,o)=>{if(nr(F),br(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),yo.select({index:n,zone:e}),l(t)}else yo.select({index:n,zone:e}),l(t)},Pl=(e,n,t,o,r)=>{const i=`${e}:${n}`;yo.insertComponent(i,t,o),br(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),yo.select({index:o,zone:i})}):yo.select({index:o,zone:i})},Bl=An(/* @__PURE__ */new Set);Fn(()=>{pi.forEach(e=>{const n=br(e.type)?.spec;if(!n)return;const t=e.props.id;if(Bl.current.has(t))return;Bl.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)=>fo.seedChild(o,t,n.childType,e))})},[pi,fo,Ci]);const Ml=An(/* @__PURE__ */new Set);Fn(()=>{pi.forEach((e,t)=>{const o=e.props.id;if(Ml.current.has(o))return;const r=n(e,vl(e.type));Ml.current.add(o),r&&fo.replaceComponent(Ce,t,{...e,props:r})})},[pi,fo]),K(fo,Vt);const $l=pi.findIndex(_t),jl=$l>=0?pi[$l]:null,Tl=qt?pi.findIndex(Zt):-1,Al=Tl>=0?pi[Tl]:null,Ll=Yt.groupTab,El=Ln(()=>Ll?e=>Jt(e.type):void 0,[Ll]),Fl=Boolean(Yt.groupBadge),Rl=Yt.sharedReach,Dl=e=>Rl?.(e)??void 0,Hl=Ln(()=>Rl?new Set(pi.filter(e=>Dl(e)).map(e=>String(e.props.id))):null,[pi,Rl]),Vl=Ln(()=>Hl?e=>Hl.has(e):void 0,[Hl]),Yl=Yt.first?Rl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Wl=Yt.groupBadge?/* @__PURE__ */ct("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ct(Wn,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Ul=pi.find(e=>e.type===Ut)??null,Gl=pi.find(e=>e.type===Gt)??null,Jl=$l>=0?$l:pi.length,Xl=[];pi.forEach(e=>{_t(e)||(Ol(e)&&Xl.push(String(e.props.id)),Xl.push(...Cl(e,1,Nl)))}),jl&&(Xl.push(String(jl.props.id)),Xl.push(...Cl(jl,1,Nl)));const Kl=Xl.length>0&&Xl.every(e=>Tr.has(e)),Ql=e=>{const n=Sr.blockRowName(e,zi);return Sr.rowName?Sr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=Bi(e)[t];if(!r)return;const i={...$n(e),index:t},l={...$n(n),index:Math.min(Math.max(o,0),Bi(n).length)},s=vn(i,l);if(e!==n||s!==t)try{yi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Tn))throw e}},_l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of bl(e))n.add(r),t(o)};for(const t of vl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ql=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===Ce)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},es=e=>{const n=e.slice(0,e.indexOf(":")),t=pi.find(e=>Jt(e.type)&&String(e.props.id)===n);return t&&Xt(n)===e?t:null},ns=(e,n)=>{const t=es(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,Bi(e).length))},ts=(e,n,t)=>{if(e.rung){const t=Mi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===St&&n.index>=0&&n.index<=o}if(n.slot===St)return!1;if(e.add)return ls(e.add,n);const o=Mn(n);if(Jt(e.type))return!1;const r=es(o),i=es(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!ns(o,e.type))&&(n.index>=0&&n.index<=Bi(o).length));if(e.zone===Ce||o===Ce){if(e.zone!==o)return!1;const{floor:t,cap:r}=ui();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Bi(o).length)return!1;if(e.zone===o)return!0;const l=jl&&!Yt.lastIsOpen?String(jl.props.id):null;return(!l||ql(e.zone)!==l&&ql(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Bi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Bi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&_l(r).has(n))return!1;const d=br(s.type,yr(Et?.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?.(Bi(n),r))})(e.zone,o,e.index,t)},os=(e,n)=>{const t=Mn(e.from),o=e.node;return t===Mn(n)?ns(t,o.type):ts({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Bi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=br(o.type,yr(Et?.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=I(r.choices??(r.spec?[{type:r.spec.childType,label:zi(r.spec.childType)}]:[])),l=ji(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:al(o,t.zone===Ce)}},is=(e,n)=>{if("section"!==e.kind)return e;const t=Mn(n);return t===Ce||es(t)?e:rs(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ls=(e,n)=>{const t=is(e,n),o=Mn(n);if("shared"===t.kind){if(o!==Ce||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ui();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(es(o)){const e="section"===t.kind?t.type:t.template.node.type;return ns(o,e)&&n.index>=0&&n.index<=Bi(o).length}if(o!==Ce)return!1;const{floor:e,cap:r}=ui();return n.index>=e&&n.index<=r}if(o===Ce)return!1;const r=rs(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Bi(o))},ss=(e,n)=>{const t=is(e,n);if("block"!==t.kind&&es(Mn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&ns(n,o)){if("section"===e.kind)yo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;yo.insertNode(n,t,mi(e.template.node))}nr(F),yo.select({index:t,zone:n})}})(t,Mn(n),n.index);if("section"===t.kind)return void il(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=tl(t),r=yo.insertNode(Ce,o,n);rl(o,r,e)})(t.template.name,mi(t.template.node),n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=tl(n.index);return void(yi.restore(e,{parentId:Pn,slot:Bn,index:o})&&rl(o,e.props.id,t.section.title))}const o=Mn(n),r=rs(o);r&&(r.target.spec?Pl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{yo.insertComponent(e,n,t),nr(F),yo.select({index:t,zone:e})})(o,t.type,n.index))},ds=(e,n)=>{e.media?function(e){const n=Ys();if(!n||!Ds)return;Us(n).then(n=>{n&&function(e,n){if(!Ds)return;const t=Ds.create(e,{nodeDefaults:Ci,newNodeId:Be,sectionLabel:Oi,blockIsOffered:kr}),o=Mn(n);if(o===Ce){const e=tl(n.index),o=yo.insertNode(Ce,e,t);return void rl(e,o,Oi(t.type))}yo.insertNode(o,n.index,t),nr(F),yo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Fi(e.rung.nodeId,e.index,n.index):e.add?ss(e.add,n):e.zone===Ce?ol(e.index,n.index):Zl(e.zone,Mn(n),e.index,n.index)},[as]=En(()=>gn()),cs=yn({keyOf:e=>e.id,readOnly:Boolean(Bt),session:as,canDrop:ts,onDrop:ds,onStep:(e,n)=>{e.rung?Fi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ce?((e,n)=>{const t=Oi(pi[e]?.type??""),o=ol(e,n<0?e-1:e+2);if(!o.moved)return void Gr(n<0?no.sectionFirst({name:t}):no.sectionLast({name:t}));const{floor:r,cap:i}=ui();Gr(no.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Zl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ps=Rn(e=>{const{floor:n,cap:t}=ui(),o=[];for(const r of e.nodes){const e=Mn(r.place),i=Bi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Zt(i)||_t(i)||mr(i.type,i))continue;if(Jt(i.type))continue;const l=Boolean(es(e)),s=e===Ce||l;e===Ce&&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?Oi(i.type):Hi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Mn(e.list);if(n===Ce&&0===e.children.length)return[{...e,addLabel:no.addSection,addAlways:!0}];const t=rs(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(es(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Mn(e.list),t=n===Ce||es(n)?null:rs(n);return t?.choices.length?un(e,t.target.spec?.addLabel??no.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Et.data]),us=null==Dt?.props.id?null:String(Dt.props.id),hs=Hn(Ae),fs=hs?.selected()&&Do?.document&&us?hs.selectedPart?.(Do.document)??null:null,ms=fs&&us&&Le(Et.data,Vt,us,fs)?fs:null,gs=ms?.label?{element:ms.element,label:ms.label}:null,ys=null!==ms,vs=Rn(e=>{const n=Vt,t=e=>!e.item.rung&&null!==jn(Et.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(us);return i?ys?null:i:r(Ke(Et.data,n,o.item.id,us,El))??o},[Et.data,Vt,us,El,ys]),[bs,ks]=En(null),Ss=Boolean(Ll||Rl);xn(Do,"mouseover",e=>{if(!Ss)return;const n=zn(e.target),t=n?gt(Et.data,Vt,n):null;t!==bs&&ks(t)}),xn(Do,"mouseout",e=>{Ss&&!e.relatedTarget&&ks(null)});const ws=e=>Zt(e)||_t(e)||Jt(e.type),xs=e=>{const n=Jt(e.type)?zi(e.type):Zt(e)?no.header:_t(e)?no.footer:null;return null===n?Ni(e):Sr.rowName?Sr.rowName(e,"section",n):n},zs=[];if(Ss){const e=us?gt(Et.data,Vt,us):null;for(const n of/* @__PURE__ */new Set([e,bs])){const e=n?pi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Zt(e)||e.type===Ut,o=Dl(e);if(o){zs.push({id:String(e.props.id),label:xs(e),below:t,reach:o});continue}if(!Ll||!ws(e))continue;const r=Ll(e);r&&zs.push({id:String(e.props.id),label:r,below:t})}}const Cs=ue(),Os=An(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(pi.filter(ws)),t=Os.current;if(Os.current={doc:Yn,bands:n,index:Rt.index},!t||t.doc!==Yn||t.bands===n)return;Rt.hasPast&&Rt.index>=t.index&&!mt.has(Cs)&&(mt.add(Cs),Gr(e,"success",{action:{label:no.bar.undo,onClick:()=>Rt.back()},duration:8e3}))},[pi]);const Ns=e=>{nr(F),yo.select(e.zone===Ce?{index:e.index}:{index:e.index,zone:e.zone})},Is=Q(),Ps=()=>({data:Et.data,device:Oo,ops:yo,inspector:pr}),Bs=Is?.model,Ms=Ln(()=>Bs?e=>Bs(e,ps(e),Ps()):ps,[Bs,ps,Oo]),$s=Is?.measure,js=$s?(e,n)=>$s(e,n,Ps()):void 0,Ts=Is?.canDrop,As=Ts?(e,n)=>Ts(e,n,ts,Ps()):ts,Ls=Is?.drop,Es=Ls?(e,n)=>Ls(e,n,ds,Ps()):ds,Fs=Is?.pick,Rs=Fs?e=>Fs(e,Ns,Ps()):Ns,Ds=Is?.media??null,Hs=An(null),Vs=Ln(()=>Ds?{id:ht,zone:"",index:-1,type:Ds.adds.type,add:{kind:Ds.adds.kind,type:Ds.adds.type},media:!0}:null,[Ds]);Fn(()=>{if(!Vs||Bt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(et))(e)&&(Hs.current=null,as.start({key:ht,item:Vs}))},n=e=>{as.get()?.item.media&&(Hs.current=Xn(e.dataTransfer))},t=()=>{as.get()?.item.media&&as.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Vs,Bt,as]);const Ys=()=>{const e=Hs.current;return Hs.current=null,e},Ws=pe(),Us=async e=>{if(!Ws)return e;const n=await Ws(e);return n?{...e,id:n.id,url:n.url}:null};const Gs=(e,n)=>{if(!Ds)return;const t=jn(go.getState().appState.data,hi,n);if(!t)return;const o=t.node;yo.replaceComponent(Mn(t.place),t.place.index,{...o,props:{...Ds.replace(o,e),id:o.props.id}})},Js=e=>{const n=Mn(e),t=ji(n);t&&Li(t.node,t.slot,!1),sl(n,e.index)},Xs=(e,n)=>/* @__PURE__ */ct(We,{...Bt?{}:cs.seam({place:{...$n(e),index:n}})},`seam:${e}:${n}`),Ks={rowClick:cl,isCollapsed:Hr,toggleCollapse:Vr},Qs=e=>{const n=String(e.props.id),t=pi.findIndex(e=>String(e.props.id)===n),o=Xt(n),r=Bi(o),i=Hr(n),l=zi(e.type),s=Sr.rowName?Sr.rowName(e,"section",l):l,d=e=>Xs(o,e);/* @__PURE__ */
|
|
16
|
-
return pt(ut,{children:[
|
|
17
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:e.type,size:13}),name:s,preview:ul(e),marks:hl(e),onSelect:()=>nl(t),nameSlot:Yi(Ce,t,n,s),selected:tr===n,badge:Dl(e)?void 0:Wl,shared:Dl(e),actions:fl(e,Ce,t)??void 0,rowProps:{"data-node-id":n,onClick:cl(()=>nl(t))},fold:{open:!i,label:"section",onToggle:()=>Vr(n)}}),!i&&/* @__PURE__ */pt(De,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Ol(n),s=l&&Hr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=cs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...$n(o),index:t}},{"data-node-id":r,onClick:cl(a)});/* @__PURE__ */
|
|
18
|
-
return pt(Vn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:n.type,size:13}),name:i,preview:ul(n),marks:hl(n),onSelect:a,nameSlot:Yi(o,t,r,i),selected:tr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */pt(ut,{children:[pl(o,t,i),fl(n,o,t),ml(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ct(De,{children:qs(n,2)})]},r)}),d(r.length)]})]})},Zs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=cs.dragging,d=!Hr(l)&&s?.rung?.nodeId!==i,a={...$n(l),index:0},c=s&&!s.rung&&ts(s,a)?a:void 0,p=()=>Li(e,n,!0),{rowProps:u,...h}=cs.row({item:{id:`rung:${l}`,zone:`${i}:${St}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:St,index:t},into:c,canDrag:Boolean(fr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:cl(p)}),f=Bt?null:fr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return pt(Vn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */ct(Re,{words:to,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ti===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Vr(l)},actions:f&&f.length>0?/* @__PURE__ */ct(ut,{children:f.map((t,o)=>/* @__PURE__ */ct(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Bt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ei(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__ */ct(it,{size:15}):/* @__PURE__ */ct(at,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ct(De,{children:r})]},l)},_s=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return ct(ut,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=xl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Xs(e,n),p=/* @__PURE__ */pt(ut,{children:[i.map(({child:n,zone:t,index:o})=>{const r=tr===String(n.props.id),{collapsible:i,folded:s}=zl(n,l,Nl(n.type)),d=String(n.props.id),a=Ql(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...h}=cs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...$n(t),index:o}},{"data-node-id":d,onClick:cl(p)});/* @__PURE__ */
|
|
23
|
-
return pt(Vn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:n.type,size:13}),name:a,preview:ul(n),marks:hl(n),onSelect:p,nameSlot:Yi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Vr(d)}:void 0,actions:/* @__PURE__ */pt(ut,{children:[pl(t,o,a),fl(n,t,o),ml(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ct(De,{children:_s(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Zs(e,t.rung,r++,o,p):/* @__PURE__ */ct(Vn,{children:p},t.slot??"")})})},qs=(e,n)=>{const t=yr(Et?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return ct(ut,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=xl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Xs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */pt(ut,{children:[l.map(({child:n,zone:t,index:o})=>{const r=tr===String(n.props.id),i=Hi(n),l=String(n.props.id),{collapsible:d,folded:a}=zl(n,s,Nl(n.type)),c=vl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...$n(p),index:Bi(p).length}:void 0,h=cs.dragging,f=u&&h&&ts(h,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=cs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...$n(t),index:o},into:f,canDrag:!mr(n.type,n)},{"data-node-id":l,onClick:cl(g)});/* @__PURE__ */
|
|
26
|
-
return pt(Vn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:n.type,size:13}),name:i,preview:ul(n),marks:hl(n),onSelect:g,nameSlot:Yi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Vr(l)}:void 0,actions:mr(n.type,n)?fl(n,t,o)??void 0:/* @__PURE__ */pt(ut,{children:[pl(t,o,i),fl(n,t,o),ml(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ct(De,{children:qs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */ct(S,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Pl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Zs(e,o.rung,i++,r,v):/* @__PURE__ */ct(Vn,{children:v},o.slot??"")})})},ed=Jo,nd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:bo&&!ed&&hr===e.id,onSelect:()=>ai(e.id)}:e,td=[...(ur.railLead??[]).map(nd),{id:"sections",label:no.layers,icon:/* @__PURE__ */ct(me,{}),active:bo&&!ed&&"sections"===hr,onSelect:()=>ai("sections")},...(ur.railTrail??[]).map(nd)],od=Po?{onPress:Bo}:Tt?{onPress:()=>{le(kn,{accept:"image/*",title:ao.mediaLibrary})}}:null,rd={value:td.find(e=>!0===e.active)?.id??"",press:e=>{const n=td.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:td.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ct("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},id=[...ur.railLead??[],...ur.railTrail??[]].find(e=>"panel"in e&&e.id===hr),ld=Boolean(eo?.foldable),sd=eo?.label??(At?no.pageSections:no.templateSections),dd=ld&&Hr(wt),ad=/* @__PURE__ */pt(ut,{children:[pi.map((e,n)=>{if(Zt(e)||_t(e)||Jt(e.type))return null;const t=tr===String(e.props.id),o=Boolean(e.props._hidden);bl(e);const r=String(e.props.id),i=ur.hasOwnRows?.(e)??!1,l=Ol(e)||i,s=l&&Hr(r),d=vl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...$n(a),index:Bi(a).length}:void 0,p=cs.dragging,u=c&&p&&ts(p,c)?c:void 0,{rowProps:h,...f}=cs.row({item:{id:r,zone:Ce,index:n,type:e.type},place:{...$n(Ce),index:n},into:u,canDrag:!mr(e.type,e)},{"data-node-id":r,onClick:cl(()=>nl(n))});/* @__PURE__ */
|
|
29
|
-
return pt(Vn,{children:[n>0&&gl(n),
|
|
30
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:e.type,size:13}),name:Ni(e),preview:ul(e),marks:hl(e),shared:Dl(e),onSelect:()=>nl(n),nameSlot:Yi(Ce,n,r,Ni(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */pt(ut,{children:[pl(Ce,n,Ni(e)),fl(e,Ce,n),ml(Ce,n,e,Ni(e))]}),rowProps:h}),Ol(e)&&!s&&/* @__PURE__ */pt(De,{children:[qs(e,1),ur.partRows?.(e,Ks)]}),i&&!s&&/* @__PURE__ */ct(De,{children:ur.ownRows?.(e,n,Ks)})]},String(e.props.id??n))}),Jl>0&&gl(Jl)]}),cd=(e,n,t)=>{const o=String(e.props.id),r=Sl(e).length>0||wl(e)||Boolean(br(e.type)),i=r&&Hr(o),l="header"===t?no.header:no.footer,s=Sr.rowName?Sr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return pt(ut,{children:[
|
|
32
|
-
/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:t,size:13}),name:s,preview:ul(e),marks:hl(e),badge:Dl(e)?void 0:Wl,shared:Dl(e),onSelect:()=>nl(n),nameSlot:Yi(Ce,n,o,s),selected:tr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Vr(o)}:void 0,actions:fl(e,Ce,n)??void 0,rowProps:{"data-node-id":o,onClick:cl(()=>nl(n))}}),r&&!i&&/* @__PURE__ */ct(De,{children:_s(e,1)})]})};return(ur.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */ct(Z,{target:Do,children:/* @__PURE__ */pt("div",{ref:Ro,className:"sf-editor es-editor",style:rn(Lr),onContextMenu:Ki.onEditorContextMenu,...p(kn),children:[
|
|
34
|
-
/* @__PURE__ */pt(Qe,{children:[
|
|
35
|
-
/* @__PURE__ */pt("div",{className:"es-cluster es-cluster--left",children:[od?/* @__PURE__ */ct(Un,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ct(ge,{}),onClick:od.onPress,children:no.railMedia}):null,
|
|
36
|
-
/* @__PURE__ */ct(Ze,{label:no.bar.undo,disabled:Boolean(Bt)||!Rt.hasPast,onClick:()=>Rt.back(),children:/* @__PURE__ */ct(nt,{})}),
|
|
37
|
-
/* @__PURE__ */ct(Ze,{label:no.bar.redo,disabled:Boolean(Bt)||!Rt.hasFuture,onClick:()=>Rt.forward(),children:/* @__PURE__ */ct(tt,{})})]}),
|
|
38
|
-
/* @__PURE__ */pt(_e,{children:[
|
|
39
|
-
/* @__PURE__ */ct(qe,{devices:So,value:Oo,onChange:No}),
|
|
40
|
-
/* @__PURE__ */ct(Ze,{label:no.bar.refresh,tip:no.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Do?.document;if(!e)return null;const n=pi.findIndex(_t),t=n>=0?n:pi.length;let o=null;for(let n=0;n<t;n++){const t=pi[n]?.props?.id;if(null==t)continue;const r=In(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Dt?.props?.id??pi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Eo(e=>e+1)},children:/* @__PURE__ */ct(ot,{})}),ur.barView?.()]}),
|
|
41
|
-
/* @__PURE__ */pt(_e,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
-
/* @__PURE__ */ct(v,{input:Uo,words:no.saveStatus}),Cn?/* @__PURE__ */ct(Cn,{}):null,ur.barLead?.(),ur.barTrail?.(),ur.mainAction||!ur.barMain?/* @__PURE__ */ct(b,{input:Uo,action:ur.mainAction??{label:no.done,onPress:()=>{_n(Et.data)}},readOnly:Boolean(Bt),saveSwitch:$t,onToggleAutoSave:Ot,onSaveNow:Go,bar:no.bar,words:no.saveStatus}):ur.barMain()]})]}),
|
|
43
|
-
/* @__PURE__ */ct(re,{}),
|
|
44
|
-
/* @__PURE__ */pt("div",{className:"sf-body",children:[bo?/* @__PURE__ */pt(ut,{children:[
|
|
45
|
-
/* @__PURE__ */pt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":no.leftPanel,children:[
|
|
46
|
-
/* @__PURE__ */pt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */ct(C,{side:"left",onHide:si}),
|
|
48
|
-
/* @__PURE__ */ct("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */ct(Gn,{variant:"underline",block:!0,"aria-label":no.bar.views,value:rd.value,onChange:rd.press,items:rd.items})]}),Jo?/* @__PURE__ */ct(w,{at:Qo?{label:(e=>{const n=es(e.zone);if(n)return no.add.addingTo({name:Sr.rowName?al(n,!0):zi(n.type)});if(e.zone===Ce){const n=pi[e.index];return n&&!_t(n)?no.add.addingBefore({name:al(n,!0)}):no.add.addingAtEnd}const t=rs(e.zone);return t?no.add.addingTo({name:t.parentName}):no.add.addingHere})(Qo),onClear:()=>Zo(null)}:void 0,placeBlocks:Qo&&Qo.zone!==Ce?rs(Qo.zone)?.choices:void 0,canTake:Qo?e=>{if(!Qo)return null;const n={...$n(Qo.zone),index:Qo.index};if(ls(e,n))return null;if("shared"===e.kind&&Qo.zone===Ce&&!Yt.shared?.nodeOf(e.section))return no.shared.alreadyHere;const t=es(Qo.zone);if(t)return no.add.notInside({name:al(t,!0)});if(Qo.zone===Ce)return no.add.onlySections;const o=rs(Qo.zone);return o?no.add.notInside({name:o.parentName}):no.add.onlySections}:void 0,onPick:Qo?e=>{if(!Qo)return;const n={...$n(Qo.zone),index:Qo.index};ls(e,n)&&(ss(e,n),dl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:as,siteWide:ur.addPanelRow?.(dl),onClose:dl,readOnly:Boolean(Bt)}):id?id.panel({onHide:si,notify:Gr}):/* @__PURE__ */pt(ut,{children:[
|
|
50
|
-
/* @__PURE__ */ct(O,{icon:/* @__PURE__ */ct(me,{}),title:no.layers,context:co,actions:/* @__PURE__ */pt(ut,{children:[!Bt&&/* @__PURE__ */ct(en,{label:no.add.title,onClick:()=>ll(null),children:/* @__PURE__ */ct(rt,{size:15})}),
|
|
51
|
-
/* @__PURE__ */ct(en,{label:Kl?no.expandAll:no.collapseAll,title:0===Xl.length?no.nothingToFold:void 0,disabled:0===Xl.length,onClick:()=>Ar(e=>{const n=new Set(Xl);return Kl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Xl])}),children:/* @__PURE__ */ct(vt,{expand:Kl})})]})}),
|
|
52
|
-
/* @__PURE__ */pt(He,{className:"sf-tree sf-scroll",words:to,children:[Ul&&/* @__PURE__ */pt(ut,{children:[!Fl&&/* @__PURE__ */ct(Ve,{children:no.header}),Qs(Ul)]}),Lt&&!(Fl&&Ul)&&/* @__PURE__ */pt(ut,{children:[!Fl&&/* @__PURE__ */ct(Ve,{children:no.header}),!qt&&/* @__PURE__ */ct(Re,{words:to,icon:/* @__PURE__ */ct(xr,{type:"header",size:13}),name:no.header,badge:Yl?void 0:Wl,shared:Yl,onSelect:ci,selected:er.kind===Qt?.kind,rowProps:{onClick:cl(ci)}})]}),Al&&!(Fl&&Ul)&&cd(Al,Tl,"header"),!ld&&/* @__PURE__ */ct(Ve,{children:sd}),ld?/* @__PURE__ */pt(ut,{children:[
|
|
53
|
-
/* @__PURE__ */ct(Re,{words:to,icon:null,name:sd,fold:{open:!dd,label:sd,onToggle:()=>Vr(wt)}}),!dd&&/* @__PURE__ */ct(De,{children:ad})]}):ad,Lt&&!Fl&&/* @__PURE__ */ct(Ve,{children:no.footer}),jl&&!(Fl&&Gl)&&cd(jl,$l,"footer"),Gl&&Qs(Gl),ur.treeFoot?.()]})]})]}),
|
|
54
|
-
/* @__PURE__ */ct(nn,{side:"left",width:Lr.left,min:on.left,max:tn,defaultWidth:f.left,label:no.resizeLeftPanel,onResize:Rr})]}):/* @__PURE__ */ct(N,{side:"left",onShow:si}),
|
|
55
|
-
/* @__PURE__ */pt("div",{ref:Jr,className:"sf-center sf-scroll","data-sf-canvas-head":_r?"":void 0,style:{overflowX:ri?"auto":"hidden",overflowY:"hidden"},children:[_r&&/* @__PURE__ */ct("div",{ref:qr,className:"sf-canvas-head",children:/* @__PURE__ */ct(_r,{device:Oo})}),
|
|
56
|
-
/* @__PURE__ */pt("div",{className:"sf-frame-scaler",style:ii,children:[
|
|
57
|
-
/* @__PURE__ */ct("div",{className:"sf-frame "+(Oo===zo?"":`sf-frame--${Oo}`),style:li,children:/* @__PURE__ */pt("div",{className:"sf-preview-host",children:[
|
|
58
|
-
/* @__PURE__ */ct(Ee.Provider,{value:El,children:/* @__PURE__ */ct(Fe.Provider,{value:Vl,children:/* @__PURE__ */ct(po,{},Lo)})}),
|
|
59
|
-
/* @__PURE__ */ct(hn,{canvas:Do,session:as,model:Ms,measure:js,canDrop:As,onDrop:Es,choose:vs,tag:gs,onPick:Rs,dropOn:Ds?{accepts:(e,n)=>{if(!e.media||!Ds||n.item.rung)return!1;const t=jn(Et.data,hi,n.item.id);return null!==t&&Ds.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ys();n&&Ds&&Us(n).then(n=>{n&&Gs(n,e.item.id)})})(n),label:()=>no.canvasReplaceImage}:void 0,onZoneAdd:Js,onSeamAdd:Js,zoneAddLabel:no.canvasAddBlock,words:oo.canvas,readOnly:Boolean(Bt),revision:Et.data}),_o.length>0&&!Ho&&/* @__PURE__ */ct("div",{className:"sf-preview-gaps",children:_o.map(e=>
|
|
60
|
-
/* @__PURE__ */ct(fn,{index:e.index,label:no.addSectionHere,onInsert:()=>ll(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))})]})}),Ss?/* @__PURE__ */ct(yt,{canvas:Do,tabs:zs,onSelect:e=>{const n=pi.findIndex(n=>String(n.props.id)===e);n>=0&&nl(n)}}):null]})]}),ko?/* @__PURE__ */pt(ut,{children:[On?
|
|
61
|
-
/* @__PURE__ */ct("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:On}):/* @__PURE__ */ct(ut,{children:/* @__PURE__ */ct(u,{value:{selectChild:Il,addChild:Pl,childRowName:Hi,blockRowName:Ql},children:/* @__PURE__ */ct(uo,{mode:er,onOpenWebsiteSettings:ur.openSettings??(()=>{}),onOpenSiteStyles:ur.openStyles,onOpenPageStyles:ur.openPageStyles,onSelectNode:Nr,onNotify:Gr,onHidePanel:di,nodeActions:Dt?Oe(Vt,Dt.type):xt})})}),
|
|
62
|
-
/* @__PURE__ */ct(nn,{side:"right",width:Lr.right,min:on.right,max:tn,defaultWidth:f.right,label:no.resizeSettingsPanel,onResize:Dr})]}):
|
|
63
|
-
/* @__PURE__ */ct(N,{side:"right",onShow:di})]}),Ki.menu,
|
|
64
|
-
/* @__PURE__ */ct(ne,{}),bi?/* @__PURE__ */ct(ft,{name:bi.name,onMake:e=>(async(e,n)=>{const t=pi.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await z(vi).create(n,t)}catch{return void Gr(no.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(bi.id,e),onCancel:()=>ki(null)}):null]})}))}export{Ct as ScreenChrome};
|
package/dist/chunk-ZG6PVMC3.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d}from"react/jsx-runtime";import{Tooltip as u,IconButton as h,Segmented as m,Switch as p,SpinnerRing as v,ResizeHandle as f,Button as k,Banner as b}from"efficient-shell/ui";import{useState as g,useEffect as y}from"react";import{LockIcon as w,CloudPauseIcon as N,CloudSlashIcon as O,CloudAlertIcon as x,CloudArrowUpIcon as B,CloudCheckIcon as z}from"efficient-shell/icons/efficient";function C({children:e}){/* @__PURE__ */
|
|
2
|
-
return c("div",{className:"es-topbar",children:e})}function R({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
|
-
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function W(){/* @__PURE__ */
|
|
4
|
-
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function S({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
|
|
5
|
-
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function $({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
|
|
6
|
-
return c(u,{content:n??e,side:"bottom",children:/* @__PURE__ */c(h,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function j({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
|
|
7
|
-
return c(m,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(u,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var L={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function M({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
|
|
8
|
-
return d("span",{className:`es-savestate ${L[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function T({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
|
-
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(u,{content:n,side:"bottom",children:/* @__PURE__ */c(p,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var Y={saved:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(v,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(N,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},J=e=>Y[e].tone;function P({state:e,label:n}){const i=Y[e],[a,t]=g(n);return y(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
|
|
10
|
-
/* @__PURE__ */c(u,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
|
|
11
|
-
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
|
|
12
|
-
return c(f,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
13
|
-
return d("div",{className:"es-insp-head",children:[
|
|
14
|
-
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
15
|
-
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
16
|
-
/* @__PURE__ */c(u,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
17
|
-
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function F({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
18
|
-
return c(u,{content:n??e,side:"bottom",children:/* @__PURE__ */c(h,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function H({name:e,onSelect:n,label:a,inline:t}){const s=o("chrome",i),l=a??s.upLevel,r=/* @__PURE__ */c(u,{content:l,side:"bottom",children:/* @__PURE__ */c(k,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function I({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}var q={notice:n,lock:r};function V(e,n,i,a=q){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),u=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function Z({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=V(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const h={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(u,{content:e.title,side:"bottom",children:/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:h[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:h[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
19
|
-
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(b,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var E={left:288,right:320},G={left:240,right:220},K=G.right,Q=560;function U(e,n){const i=n?G[n]:K;return Math.min(560,Math.max(i,Math.round(e)))}function X(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function _(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{E as DEFAULT_PANEL_W,j as DeviceSwitch,$ as EaselIconButton,C as EaselTopBar,Z as EditNotice,D as InspectorHead,F as InspectorIconButton,H as InspectorUpLevel,Q as MAX_PANEL_W,K as MIN_PANEL_W,G as MIN_PANEL_W_BY_SIDE,A as PanelResizeHandle,P as SaveIcon,M as SaveState,T as SaveStateToggle,R as TopBarCluster,W as TopBarDivider,S as TopBarRail,U as clampPanelWidth,V as editNotice,I as headWords,X as panelWidthVars,J as saveIconTone,_ as setPanelWidthVars};
|