efficient-easel 24.1.0 → 25.0.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 +43 -2
- package/dist/{CanvasDragLayer-NZpaX6aq.d.ts → CanvasDragLayer-DXeQGrwJ.d.ts} +42 -3
- package/dist/canvas/index.d.ts +2 -139
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-6NJHYXJM.js → chunk-3XECMGXX.js} +1 -1
- package/dist/chunk-4OMAA45Q.js +5 -0
- package/dist/{chunk-G67G63O5.js → chunk-4Y3TK65H.js} +1 -1
- package/dist/chunk-53ME3GAI.js +16 -0
- package/dist/{chunk-FRAIEWRC.js → chunk-62UGN7VM.js} +1 -1
- package/dist/{chunk-HNKB2ZYR.js → chunk-6ATIYLUL.js} +1 -1
- package/dist/{chunk-Y53EKN35.js → chunk-6EDVZBUO.js} +1 -1
- package/dist/chunk-7UFKEX72.js +1 -0
- package/dist/chunk-CEC5XLN4.js +1 -0
- package/dist/chunk-CWELHADJ.js +1 -0
- package/dist/chunk-DX3VILZ3.js +6 -0
- package/dist/chunk-ERB6FAZT.js +2 -0
- package/dist/{chunk-TGZCD6IP.js → chunk-EUFDQ4KL.js} +1 -1
- package/dist/chunk-FR7EEKFF.js +1 -0
- package/dist/{chunk-75C6WFNF.js → chunk-FYV6GZXP.js} +1 -1
- package/dist/chunk-GDO4QJ4G.js +1 -0
- package/dist/chunk-GEPSJJWW.js +1 -0
- package/dist/{chunk-GMCZXMOV.js → chunk-GR3XRILS.js} +1 -1
- package/dist/chunk-H6BER2EU.js +1 -0
- package/dist/chunk-JIP5JNRB.js +1 -0
- package/dist/{chunk-AGWKB77Q.js → chunk-K53PQAMP.js} +1 -1
- package/dist/{chunk-CLOS6SSX.js → chunk-KO47WAWR.js} +1 -1
- package/dist/chunk-KTV7ORWF.js +64 -0
- package/dist/chunk-LUG22U5L.js +1 -0
- package/dist/{chunk-DDH2DYQP.js → chunk-LUOY3A3Q.js} +1 -1
- package/dist/{chunk-OITNWE52.js → chunk-M4THI4OO.js} +1 -1
- package/dist/chunk-MBEUSPIN.js +18 -0
- package/dist/chunk-MIX7EGRG.js +2 -0
- package/dist/{chunk-2FYFAAAK.js → chunk-OXOUGEAT.js} +1 -1
- package/dist/chunk-PMRN5Z3T.js +1 -0
- package/dist/{chunk-55KKGABA.js → chunk-PVBDKBJB.js} +1 -1
- package/dist/{chunk-RPMSET77.js → chunk-QTHQPJWA.js} +1 -1
- package/dist/{chunk-ISS72IKO.js → chunk-QZJKWKGH.js} +1 -1
- package/dist/{chunk-IYHO4XQX.js → chunk-S6YOIRXQ.js} +1 -1
- package/dist/{chunk-5PXVT7JY.js → chunk-SBVIW3KJ.js} +1 -1
- package/dist/chunk-SC6E3UUS.js +13 -0
- package/dist/chunk-SSDKT4AY.js +9 -0
- package/dist/chunk-TOKMFZPB.js +1 -0
- package/dist/chunk-U3LTJSBU.js +20 -0
- package/dist/{chunk-WYTPBF3Q.js → chunk-VBEVZZTV.js} +11 -11
- package/dist/chunk-VIUES5R6.js +8 -0
- package/dist/{chunk-4ESG53BH.js → chunk-YFHKE54W.js} +1 -1
- package/dist/chunk-YYD257TD.js +1 -0
- package/dist/chunk-ZLOMH2PD.js +1 -0
- package/dist/{chunk-CE5SGCN2.js → chunk-ZYOQXBJF.js} +3 -3
- package/dist/copy/index.js +13 -13
- package/dist/copy-place-CQIemdtU.d.ts +25 -0
- package/dist/data/index.d.ts +4 -1
- package/dist/data/index.js +1 -1
- package/dist/dom-BpxMcHFP.d.ts +200 -0
- package/dist/drag/index.d.ts +2 -3
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +67 -1
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.d.ts +0 -46
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +6 -40
- package/dist/fields/index.d.ts +1 -6
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/page-copy/index.d.ts +110 -0
- package/dist/page-copy/index.js +5 -0
- package/dist/panel/index.d.ts +29 -34
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +0 -78
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +37 -57
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +19 -11
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +10 -11
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -6
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +8 -9
- 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 +10 -11
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +9 -10
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/block-set-host.d.ts +55 -0
- package/dist/screen/lib/document/block-set-host.js +1 -0
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +70 -3
- package/dist/screen/lib/document/box-fields.js +1 -9
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/palette-sections.d.ts +33 -97
- package/dist/screen/lib/document/palette-sections.js +1 -1
- package/dist/screen/lib/document/preview-dom.js +1 -1
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +10 -11
- 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/document-switch.js +1 -1
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +265 -13
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +6 -0
- package/dist/screen/words.d.ts +9 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +4 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +0 -32
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +7 -6
- package/dist/text-styles/index.js +37 -36
- package/dist/text-styles/text-styles.css +5 -53
- package/dist/tree/index.d.ts +2 -2
- package/dist/{types-DBy3L69b.d.ts → types-CoUTWUwB.d.ts} +1 -1
- package/dist/words-Dl8Qja4K.d.ts +32 -0
- package/package.json +15 -3
- package/dist/chunk-3FIS2FRS.js +0 -1
- package/dist/chunk-7RSE6KKY.js +0 -1
- package/dist/chunk-AAAZ2CQR.js +0 -1
- package/dist/chunk-CMPFUJ26.js +0 -8
- package/dist/chunk-CZAAGBVL.js +0 -7
- package/dist/chunk-DSKNJXB4.js +0 -1
- package/dist/chunk-FJTCSQWK.js +0 -16
- package/dist/chunk-H4Z2V56N.js +0 -21
- package/dist/chunk-K7MMLCTT.js +0 -2
- package/dist/chunk-KRL3IUV3.js +0 -1
- package/dist/chunk-LF3FUSCQ.js +0 -1
- package/dist/chunk-LN43DP2A.js +0 -18
- package/dist/chunk-MRWVYSU5.js +0 -64
- package/dist/chunk-QORC32JO.js +0 -5
- package/dist/chunk-THWO5YVZ.js +0 -1
- package/dist/chunk-TOHOGVAE.js +0 -15
- package/dist/chunk-V7U33NF2.js +0 -1
- package/dist/chunk-VKPOH6MK.js +0 -1
- package/dist/chunk-YU3WHLGI.js +0 -1
- package/dist/repeat-D65bJS8d.d.ts +0 -49
- package/dist/session-EsjORLQ0.d.ts +0 -43
package/dist/chunk-FJTCSQWK.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 u,colorRunOf as d,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,upsertCanvasStyle as k,removeCanvasStyle as S,WORDS_CLEAR as C,frameRectToHost as I,CANVAS_TYPING_EVENT as E,drawnBox as D}from"./chunk-YU3WHLGI.js";import{queryAllCopies as x}from"./chunk-LF3FUSCQ.js";import{find as A,ROOT_ID as O,getList as M,remove as $,parseZoneKey as R,move as z,duplicate as P,replaceNode as L,createNode as V,insert as j,normalizeData as N,createResolveCache as B,slotsOf as K,resolveNodeData as Z,ROOT_SLOT as F}from"./chunk-TGZCD6IP.js";import{topLevelSlotKeys as T,fieldsFrom as H,drawnBlockCount as W,defaultsFrom as Y}from"./chunk-KXM6YRG2.js";import{createContext as q,useEffect as U,useContext as G,useRef as Q,useSyncExternalStore as X,useState as J,useReducer as _,useMemo as ee,useCallback as te,useLayoutEffect as ne}from"react";import{jsx as oe,jsxs as re,Fragment as le}from"react/jsx-runtime";import{createPortal as ie}from"react-dom";import{registerModalEscapeInterceptor as se,FloatingBar as ae,TextToolbar as ce,LinkPicker as ue}from"efficient-shell/ui";function de(e){return!["setData","setUi","set"].includes(e.type)}var pe=(e,t,n,o)=>{const r=M(e,t,R(n));return r?.[o]??null},fe=(e,t,n,o,r)=>{const l=pe(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function he(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 me(e,t,n){return n?"node"===n.kind?A(e,t,n.id)?n:null:n.parentId===O?M(e,t,n)?n:null:A(e,t,n.parentId)&&M(e,t,n)?n:null:null}function ge(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 ve(e,t,n){const o=ye(e,t,n);if(o===e)return e;const r=me(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ye(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 ge(e,n,"function"==typeof t.ui?t.ui(he(e,n)):t.ui);case"set":{const r={data:o,ui:he(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=ge(i,n,l.ui,!0)),i}case"insert":{const r={...R(t.destinationZone),index:t.destinationIndex},l=V(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:j(o,n,r,l)}}case"replace":{const r=fe(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:L(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=fe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=P(o,n,r.props.id),i=pe(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return ye(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=pe(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...R(t.destinationZone),index:t.destinationIndex};return{...e,data:z(o,n,r.props.id,l)}}case"remove":{const r=fe(o,n,t.zone,t.index,"remove");return{...e,data:$(o,n,r.props.id)}}default:return e}}var we={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},be={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ke=0,Se=()=>`history-${ke+=1}`;function Ce(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:{...be}};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:{...be,...l}}}let u=[{core:c,at:-1/0,sealed:!0,id:Se()}],d=0;const p=e=>{const t=u[d],n=r();!e&&d===u.length-1&&d>0&&!t.sealed&&n-t.at<l?u=[...u.slice(0,d),{...t,core:c,at:n}]:(u=[...u.slice(0,d+1),{core:c,at:n,sealed:e,id:Se()}],d=u.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=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+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=ve(c,e,t),c===n)return;const o=e.recordHistory??de(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=me(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;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},D=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...we,...i,...n}};let x=D();const O=B(),$={resolveCache:O,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([Z(r,t,{cache:O,trigger:e,metadata:n}),...l.map(o=>Z(o,t,{cache:O,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=A(r,t,i)?.node;s&&s===A(o,t,i)?.node&&(r=L(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:me(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=A(c.data,t,e)?.node;if(!r)return!1;const l=await Z(r,t,{cache:O,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return C(()=>{const n=c;if(A(c.data,t,e)?.node!==r)return;const o=L(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:me(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:he(e,t)},r="node"===e.selection?.kind?A(e.data,t,e.selection.id)?.node??null:null;return h={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:he(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&E(e)}},getPermissions:x,getItemById:n=>A(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return M(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,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=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=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:me(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:me(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:Se()}],d=0),c!==o&&w()},undo(){d>0&&E(d-1)},redo(){d<u.length-1&&E(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,i)||(i=e,x=D(),h=null,w())},setConfig(e){e!==t&&(t=e,x=D(),h=null,w())}};return $}function Ie(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 Ee=q(null),De=q(!0);function xe({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return U(()=>{n&&e.resolveAll()},[e,n]),U(()=>{if(t&&"undefined"!=typeof document)return Ie(document,e)},[e,t]),/* @__PURE__ */oe(Ee.Provider,{value:e,children:/* @__PURE__ */oe(De.Provider,{value:t,children:o})})}function Ae(){const e=G(Ee);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Oe(e){const t=Ae(),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 X(t.subscribe,o,o)}function Me(){return function(e){return Oe(e)}}var $e=["--es-accent","--es-accent-tint","--es-accent-tint-strong","--es-accent-line","--es-accent-text","--es-accent-ring","--es-accent-shadow","--es-on-accent","--status-success-solid","--elevation-panel"],Re="host-tokens";function ze(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of $e){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?k(t,Re,n):S(t,Re)}var Pe="data-easel-block",Le="data-easel-dropzone",Ve={},je="data-es-mirror",Ne="undefined"==typeof window?U:ne;function Be(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${je}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(je,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Ke({children:t,id:n="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=g("canvas",e),d=Q(null),[p,f]=J(null);return Ne(()=>{const e=d.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]),Ne(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.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=d.current?.ownerDocument;if(i&&o){Be(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Be(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){ze(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>ze(l,e)),r.observe(o.head,{childList:!0,subtree:!0,characterData:!0});const n={attributes:!0,attributeFilter:["class","style","data-theme"]};for(const e of[o.documentElement,o.body,l.closest(".es-editor")])e&&r.observe(e,n)}}return()=>{n?.disconnect(),r?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */oe("iframe",{ref:d,id:n,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?ie(t,p):null})}var Ze=q(null),Fe=q(Ve),Te=[];function He({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=Ae(),s=Oe(n=>M(n.appState.data,i.config,{parentId:e,slot:t})??Te),a=Oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==O),c=Oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=G(Ze),d=["es-zone"];return s.length&&d.push("has-children"),e===O&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==O&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */oe("div",{className:d.join(" "),[Le]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */oe(Je,{node:e},e.props.id))})}function We(e,t,n,o){const r=ee(()=>{const n={};for(const o of T(H(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
|
-
return oe(He,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=W(n[e],o);return r}function Ye(e){return ee(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return oe(He,{parentId:e,slot:t,...n})},[e])}var qe=["top","bottom","zIndex"];function Ue(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ge(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));Ue(e,"position",t?"sticky":"relative");for(const n of qe)Ue(e,n,t?.[n]??"");return!!t}var Qe="data-es-canvas-relative";function Xe(e){e.hasAttribute(Qe)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Qe));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Qe,"")),!1)}function Je({node:e}){const t=Ae().config,n=t.components[e.type],o=e.props.id,r=Q(null),l=function(e,t){return ee(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Pe),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Pe,e),n.setAttribute("data-easel-dnd",e),Xe(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(()=>{});Ne(()=>o.current()),Ne(()=>{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?Xe(e):Ge(e));const a=G(Fe),c=We(n,o,e.props,t.components),u=Ye(o);if(!n?.render)return null;const d=n.render,p={...Y(n),...e.props,...c},f={renderDropZone:u,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */oe(d,{...p,editor:f,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */oe("div",{ref:i,[Pe]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */oe(d,{...p,editor:f,editMode:!0})})}function _e({metadata:e}){const t=Oe(e=>e.config),n=Oe(e=>e.appState.data.root).props??{},o=t.root?.render,r=We(t.root,O,n,t.components),l=Ye(O),i=/* @__PURE__ */oe(He,{parentId:O,slot:F}),s=o?/* @__PURE__ */oe(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
|
|
5
|
-
return oe(Fe.Provider,{value:e??Ve,children:s})}var et=q(void 0),tt=q(void 0);function nt(e,t,n,o){const r=A(e,t,n);return!!r&&(K(r.node,t).length>0||!1===o.whole)}var ot=q(void 0),rt="data-es-chrome",lt=q(void 0);function it(e){const t=e?.closest?.(`[${rt}]`)??null,n=t?.getAttribute(rt);return t&&n?{id:n,element:t}:null}function st({element:e}){const t=Q(null),n=ut(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
-
return oe("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 at={"--es-words-clear":`${C}px`};function ct({element:e,words:t=!1}){const n=Q(null),o=ut(n,e?()=>e:null,e);/* @__PURE__ */
|
|
7
|
-
return oe("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,...at}:{display:"none"}})}function ut(e,t,n){return pt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var dt=[];function pt(e,t,n){const[o,r]=J(dt),l=Q(t);return l.current=t,Ne(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(dt);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=D(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:dt;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),n.addEventListener("scroll",s,{capture:!0,passive:!0}),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),n.removeEventListener("scroll",s,{capture:!0}),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function ft({id:e,kind:t,overlay:n}){const o=Q(null),r=G(tt),l=null!==e&&!0===r?.(e),i=pt(o,e?t=>x(t,`[${Pe}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=`es-canvas-outline is-${t}${l?" is-shared":""}`,u=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),d=/* @__PURE__ */re(le,{children:[
|
|
8
|
-
/* @__PURE__ */oe("div",{ref:o,"aria-hidden":"true",className:c,style:s?u(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */oe("div",{"aria-hidden":"true",className:c,style:u(e)},t))]});return n&&e?/* @__PURE__ */oe(n,{componentId:e,kind:t,children:d}):d}function ht(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,u=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;u<a.length&&!/\s/.test(a[u]);)u+=1;return[c,u]}function mt({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]=J(!1),[w,b]=J(null),k=v||null!==w,S=()=>{e.hold(),y(!1),b({href:e.pressed().href})},C=()=>{y(!1),b(null),e.resume()};ne(()=>{r.current={escape:()=>!!k&&(C(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),ne(()=>()=>{r.current=null},[r]);const E=Q(C);E.current=C,U(()=>{if(v)return se(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]),U(()=>{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]),ne(()=>{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,d=s?I(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?I(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:d.left,right:d.left+d.width,top:Math.min(d.top,f.top-6,m.top),bottom:Math.max(d.top+d.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:u(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:d(i.color,f),open:v,onToggle:()=>{b(null),v?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
9
|
-
return oe(ae,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?I(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__ */oe("div",{ref:h,children:/* @__PURE__ */oe(ce,{layout:"row",offered:s,pressed:i.marks,onMark:t=>{"link"===t?S():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__ */re(le,{children:[v&&f?/* @__PURE__ */oe(p,{colors:f,current:i.color,words:l.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
10
|
-
/* @__PURE__ */oe(ue,{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:C}):null]})})})})}function gt({element:e,which:t}){const n=Q(null),o=ut(n,()=>e(),t);/* @__PURE__ */
|
|
11
|
-
return oe("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,...at}:{display:"none"}})}function vt({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:u,title:d,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:b,typing:k,passThrough:S}){const C=Ae(),I=G(et),D=S??I,x=G(De),O=g("canvas",e),M=h??x,[$,R]=J(void 0),z=Oe(e=>"node"===e.selection?.kind?e.selection.id:null),[P,L]=J(null),[V,j]=J(null),N=G(ot),B=G(lt),[Z,F]=J(null),[,T]=_(e=>e+1,0),[,H]=_(e=>e+1,0),W=e=>{N?.select(e),H()},[Y,q]=J(null),X=Q(null),[,ee]=J(0),te=Q(k);te.current=k;const ne=Q(null),le=Q(null),ie=()=>{if(!z)return null;const e=te.current?.atSelection?.()?.element()??null;if(!e)return null;const t=le.current?.ownerDocument;if(N){const n=N.selected()&&t?N.selectedPart?.(t)??null:null;return n&&w(n.element,e)?n.element:null}const n=A(C.getState().appState.data,C.config,z);return n&&0===K(n.node,C.config).length?e:null},se=Oe(e=>e.appState.data),ae=N?.selected()??null;U(()=>{const e=le.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=z&&!Y&&te.current?.atSelection?.()?z:null,o=n?ie():null;e.dispatchEvent(new t(y,{detail:o?{id:n,words:o}:{id:n}}))},[z,Y,se,ae]);const ce=e=>{const t=le.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(E,{detail:{typing:e}}))},ue=(e,t)=>{X.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=C.group(),r=e.element,l=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:ht(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>ee(e=>e+1),onEscape:()=>ne.current?.escape()??!1,onLinkKey:()=>ne.current?.link()??!1,end:e=>{o.close(),X.current?.element===r&&(X.current=null),q(null),ce(!1),te.current?.onChange?.({typing:!1,why:e})}});if(!l)return o.close(),!1;const i=n.closest?.(`[${Pe}]`)?.getAttribute(Pe);return i&&C.select(i),X.current={s:l,element:r,target:e},q(()=>r),L(null),ce(!0),te.current?.onChange?.({typing:!0,element:n}),!0};U(()=>()=>X.current?.s.stop("stop"),[]);const de=e=>{const t=X.current?.element();return Boolean(t&&t.contains(e))},pe=(e,t)=>nt(C.getState().appState.data,C.config,e,t),fe=e=>{const t=e.closest?.(`[${Pe}]`)?.getAttribute(Pe);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=N?.partAt(e,t)??null;if(r){const e=i(n.appState.data,C.config,t,r.id,o,N?.selected()??null,D);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,C.config,t,o,D)??t,part:null}},he=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(X.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=te.current?.atSelection?.();n&&ue(n,null)&&e.preventDefault()},me=le.current?.ownerDocument??null,ge=N?.selected()&&me&&z?N.selectedPart?.(me)??null:null,ve=ge&&z&&pe(z,ge)?ge.element:null,ye=B?.selected()??null,we=ye&&me?Array.from(me.querySelectorAll(`[${rt}]`)).find(e=>e.getAttribute(rt)===ye)??null:null,be=Y?null:ie(),ke=/* @__PURE__ */re("div",{ref:le,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),X.current){if(de(t))return;X.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=B?it(t):null;if(B&&o)return B.select(o.id),F(null),void T();const r=fe(t);if(void 0!==r)return C.select(r.node),void(N&&(r.part?.id??null)!==N.selected()&&W(r.part?.id??null));t.hasAttribute?.(Le)||(C.select(null),N?.selected()&&W(null))},onDoubleClick:e=>{const t=te.current;if(!t||de(e.target))return;const n=t.at(e.target);n&&ue(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>he(e),onMouseOver:e=>{if(X.current)return;const t=B?it(e.target):null;if(t?.element!==Z?.element&&F(t),t)return null!==P&&L(null),void(null!==V&&j(null));const n=fe(e.target),o=!!n?.part&&pe(n.node,n.part),r=n?.part&&o&&n.part.id!==N?.selected()?n.part:null,l=!n||n.part&&o?null:n.node;l!==P&&L(l),r?.id===V?.id&&r?.element===V?.element||j(r)},onMouseLeave:()=>{L(null),j(null),F(null)},children:[
|
|
12
|
-
/* @__PURE__ */oe(Ze.Provider,{value:P,children:/* @__PURE__ */oe(_e,{metadata:r})}),
|
|
13
|
-
/* @__PURE__ */re("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
14
|
-
/* @__PURE__ */oe(ft,{id:!Y&&P&&P!==z?P:null,kind:"hover",overlay:v}),N?/* @__PURE__ */oe(st,{element:Y||!V||V.id===N.selected()?null:V.element}):null,be||ve?/* @__PURE__ */oe(ct,{element:Y?null:be??ve,words:null!==be}):null,B?/* @__PURE__ */oe(st,{element:Y||!Z||Z.element===we?null:Z.element}):null,we?/* @__PURE__ */oe(ct,{element:Y?null:we}):null,
|
|
15
|
-
/* @__PURE__ */oe(ft,{id:Y||ve||be||we?null:z,kind:"selected",overlay:v}),Y?/* @__PURE__ */oe(gt,{element:()=>{const e=Y?.()??null;return e?ge&&w(ge.element,e)?ge.element:e:null},which:ge?.element??Y}):null]}),b]}),Se=m?/* @__PURE__ */oe(m,{document:$,children:ke}):ke;U(()=>{if($&&M)return Ie($,C)},[$,M,C]),U(()=>{if(!$)return;const e=e=>{if("Enter"===e.key)return void he(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=C.getState();if("node"!==n.selection?.kind)return;if(N?.selected())return void W(null);const o=l(n.appState.data,C.config,n.selection);"node"===o?.kind&&C.select(o.id)};return $.addEventListener("keydown",e),()=>$.removeEventListener("keydown",e)},[$,C,N]);/* @__PURE__ */
|
|
16
|
-
return re("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-easel-preview":"","data-es-typing":Y?"":void 0,children:[Y&&X.current?.target.toolbar?/* @__PURE__ */oe(mt,{s:X.current.s,element:X.current.element,toolbar:X.current.target.toolbar,label:O.textTools,keys:ne}):null,t?/* @__PURE__ */oe(Ke,{mirrorStyles:a,onDocument:e=>{R(e??void 0),c?.(e)},height:u,title:d,nonce:p,children:Se}):/* @__PURE__ */oe("div",{id:"preview-frame","data-easel-entry":"",children:Se})]})}function yt(e={}){const t=Ae(),n=Oe(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function wt(){return kt(Oe(e=>e.selectedItem))}function bt(){return kt(null)}function kt(e){const n=Ae(),o=Oe(e=>e.config),r=n.resolveCache,l=Oe(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=ee(()=>e||{type:"root",props:s},[e,s]),c=e?o.components[e.type]:o.root,u=n.getState(),d=e?A(u.appState.data,o,i):null,p=d&&"root"!==d.place.parentId?d.place.parentId:null,f=p?u.getItemById(p)??null:null,{fields:h}=t({id:i,node:a,block:c,parent:f,appState:u.appState}),m=Oe(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=te(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 Z(a,o,{cache:r,trigger:"replace"}),u=n.getState().getSelectorForId(i);if(!u)return;return void n.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const l=t.appState.data.root.props??{},{node:s}=await Z({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=te((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{rt as CHROME_ATTR,lt as CanvasChromeContext,Ke as CanvasFrame,ot as CanvasPartsContext,et as CanvasPassThroughContext,tt as CanvasSharedContext,be as DEFAULT_UI,vt as EaselCanvas,xe as EaselProvider,_e as EditDocument,Ie as bindUndoKeys,Ce as createEasel,Me as createUseEasel,nt as partHasOwnBox,de as recordsByDefault,ve as reduce,he as uiView,Oe as useEasel,Ae as useEaselApi,yt as useEaselNodeOps,bt as useRootFields,wt as useSelectedFields,me as validSelection};
|
package/dist/chunk-H4Z2V56N.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{noControlMetaOf as t,deviceMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as o}from"./chunk-FIVU2COQ.js";import{SETTINGS_BUCKETS as i,SettingsGroup as s}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{SettingsField as h,SettingsSegmented as p}from"./chunk-CZAAGBVL.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-6NJHYXJM.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{Textarea as y,Input as k,ItemCount as x,SortableList as w,ListRow as C,ContextMenu as N,tabPanelId as O,Tabs as j,tabButtonId as $}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as S,useState as I,useLayoutEffect as D,useId as F}from"react";import{jsx as P,jsxs as L}from"react/jsx-runtime";import{ChevronIcon as E,LockIcon as M,MoveUpIcon as A,MoveDownIcon as T,DuplicateIcon as W,TrashIcon as z}from"efficient-shell/icons/efficient";function R({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */P(y,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */P(k,{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 H(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function J(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function V(e,n){return e.filter((e,t)=>t!==n)}function Y(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var K='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Z({label:e,icon:n,noun:t,items:l,onChange:i,newItem:s,summary:c,itemName:d,thumb:u,min:h=0,max:p,readOnly:y=!1,open:k,onOpen:O,renderItem:j,renderRow:$,canRemove:F,lockedReason:R,fixed:Z=!1,removeOnRow:X=!0,canDuplicate:G,above:Q,head:q=!0}){const U=f("fields",m).list,_=f("tree",a),ee=t??U.item,ne=!y&&!Z&&("number"!=typeof p||l.length<p),te=l.length<=h,le=e=>!!F&&!F(l[e],e),re=e=>!y&&!Z&&X&&!te&&!le(e),ae=e=>ne&&(!G||G(l[e],e)),oe=(e,n)=>d?d(e,n):U.itemName({noun:ee,n:n+1}),ie=S([]),se=S(null),[ce,de]=I(null),ue=S(null),[me,he]=I(null),[pe,fe]=I("");D(()=>{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>=l.length||n===e)return;const t=ie.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(K)].indexOf(r),l=r;se.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}i(J(l,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}(k,e,n);a!==k&&O(a),fe(U.moved({n:n+1,total:l.length}))},ge=e=>{ne&&(i(H(l,e,s())),$?(se.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&O(k+1)):O(e))},ve=e=>{re(e)&&(i(V(l,e)),k===e?O(null):null!==k&&k>e&&O(k-1))},ye=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=g({...B,index:e},n);t!==e&&be(e,t)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:y}),ke=e=>{const n=[];return e>0&&n.push({label:U.moveUp,icon:/* @__PURE__ */P(A,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<l.length-1&&n.push({label:U.moveDown,icon:/* @__PURE__ */P(T,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),ae(e)&&n.push({label:U.duplicate,icon:/* @__PURE__ */P(W,{size:14}),onClick:()=>(e=>{ae(e)&&(i(H(l,e+1,Y(l[e]))),null!==k&&k>e&&O(k+1))})(e)}),re(e)&&n.push({label:U.delete,icon:/* @__PURE__ */P(z,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{y||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=l.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
-
return L("div",{className:"es-list",children:[q?/* @__PURE__ */L("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */L("span",{className:"es-list-label",children:[n?/* @__PURE__ */P("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
-
/* @__PURE__ */P(x,{count:l.length,label:U.count({noun:ee,n:l.length}),showZero:!0})]}):null,Q?/* @__PURE__ */P("div",{className:"es-list-above",children:Q}):null,l.length?/* @__PURE__ */L(w,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[l.map((e,n)=>{const t=ye.row({item:n,place:{...B,index:n}}),l=t.draggable&&ce!==n,a=!$&&k===n,o=!y&&!Z&&X&&le(n),i=["es-list-row",$?"is-inline":"is-item",a?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:n}}),onAdd:ne?()=>ge(n):void 0,label:U.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
-
/* @__PURE__ */P(C,{className:i,flat:!!$,active:a,draggable:t.draggable,dragHint:_.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ie.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,ue.current=l&&!r?l:null,de(r?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{y||(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 r=e.currentTarget.getBoundingClientRect();return void xe(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:y||Z||!X?void 0:o?v(R?R(e,n):U.locked,/* @__PURE__ */P("span",{className:"es-list-lock",role:"img","aria-label":R?R(e,n):U.locked,children:/* @__PURE__ */P(M,{size:13})})):v(U.deleteItem({noun:ee}),/* @__PURE__ */P("button",{type:"button",className:"es-list-x","aria-label":U.deleteItem({noun:ee}),disabled:!re(n),onClick:()=>ve(n),children:"×"})),below:a?/* @__PURE__ */P("div",{className:"es-list-item",children:j(e,n,we(n))}):void 0,children:$?/* @__PURE__ */P("div",{className:"es-list-row-main",children:$(e,n,we(n))}):/* @__PURE__ */L("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>O(a?null:n),children:[u?/* @__PURE__ */P("span",{className:"es-list-thumb","aria-hidden":"true",children:u(e,n)}):null,
|
|
6
|
-
/* @__PURE__ */P("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */P("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
-
/* @__PURE__ */P(E,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
-
/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:l.length}})})]}):null,y||Z?null:/* @__PURE__ */P("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(l.length),children:U.add({noun:ee})}),
|
|
9
|
-
/* @__PURE__ */P("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<l.length?
|
|
10
|
-
/* @__PURE__ */P(N,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:o(ke(me.index))}):null]})}var X=e=>e<6?e+1:6,G=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Q({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=I(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
11
|
-
return P(s,{id:`${l}-group`,title:G(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */P(U,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>a({...p,[e]:n}),readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:X(u)},e))})}function q({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=I(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return P(Z,{label:G(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:a,newItem:()=>Y({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(r,a,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */P(U,{field:n,name:`${t}[${a}].${e}`,id:`${l}-${a}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function U(e){const{field:n,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:a,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:a,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
-
return P(h,{label:G(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(R,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:a,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
-
return P(h,{label:G(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(d,{id:l,value:"number"==typeof r?r:void 0,onChange:a,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
-
return P(h,{label:G(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(u,{id:l,value:r,options:n.options,onChange:a,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return P(h,{label:G(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(p,{ariaLabel:G(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||a(e)}})});case"object":/* @__PURE__ */
|
|
17
|
-
return P(Q,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return P(q,{...e,field:n});case"slot":return null}}function _(e,n){if("mobile"!==n)return!0;const r=e;if(!r||r.marker||"slot"===r.type||"always"===t(e))return!0;const a=l(e)?.tier;return"mobile"===a||"each"===a}var ee={},ne=e=>i.includes(e);function te(n,t){let l,r=i[0];const a=[],o=/* @__PURE__ */new Set;for(const[i,s]of Object.entries(n))s&&(ne(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:i,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!_(s,t.context?.device)||(a.push(l?{name:i,field:s,bucket:r,fold:l}:{name:i,field:s,bucket:r}),"slot"!==s.type&&o.add(r)));return{rows:a,buckets:i.filter(e=>o.has(e))}}function le(e){return new Map(te(e).rows.map(e=>[e.name,e.bucket]))}function re(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 ae({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:a,tab:o,onTab:i,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=f("panel",c),C=F(),N=h??`es-insp${C.replace(/:/g,"")}`,S=te(e,{values:n,context:a}),[D,E]=I(void 0),M=o??D,A=M&&S.buckets.includes(M)?M:S.buckets[0],[T,W]=I(null),z=T&&T.panel===N&&S.rows.some(e=>e.name===T.name)?T:null,R=d&&S.buckets.length>1,H=R&&A?O(N,A):`${N}-rows`,[J,V]=I(()=>/* @__PURE__ */new Set),Y=y??J,K=(e,n)=>{/* @__PURE__ */return P(s,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&V(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${N}-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},B=e=>R&&e!==A,Z=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!B(i)||void 0,children:/* @__PURE__ */P(U,{field:o,name:e,id:`${N}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:a,renderers:m,openItem:z&&z.name===e?z.index:null,onOpenItem:n=>W(null===n?null:{panel:N,name:e,index:n}),headingLevel:s?X(x):x})},e);/* @__PURE__ */
|
|
19
|
-
return L("div",{className:"es-insp",children:[R?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(j,{variant:"underline",block:!0,"aria-label":p??w.settings,idPrefix:N,value:A,onChange:e=>{const n=e;void 0===o&&E(n),i?.(n)},items:S.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */P("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
-
/* @__PURE__ */L("div",{className:"es-insp-rows",id:H,role:R?"tabpanel":void 0,"aria-labelledby":R&&A?$(N,A):void 0,children:[b&&_(ee,a?.device)?v?/* @__PURE__ */P("div",{className:"es-insp-band","data-fold":v.key,children:K(v,b)}):b:null,re(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Z);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
-
return P("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!B(t)&&!l)||void 0,children:K(e.fold,e.rows.map(Z))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{R as FieldText,ae as Inspector,U as InspectorField,Z as ListField,le as bucketsOf,Y as copyItem,_ as fieldShownInView,H as insertAt,G as labelOf,J as moveTo,te as planFields,V as removeAt};
|
package/dist/chunk-K7MMLCTT.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-ISS72IKO.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-NQW6XCAY.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-IYHO4XQX.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as C,useCallback as E,useEffect as H,useRef as O}from"react";import{jsx as T}from"react/jsx-runtime";var N={content:[],root:{},zones:{}};var A=j(null);function M(){const e=R(A);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function L({target:j,addressing:R=o,onHostMessage:M,children:L}){const Y=R,{homeSlug:D,entryMayBounce:F,entryBounce:V,onSwitch:X,tellsHost:W,adapterFor:K,migrateRenamedProps:U,describeMissing:Z,onLoadFailed:x}=Y,[G,Q]=B(j),z=k(),_=d(),q=C(()=>f(_),[_]),J=C(()=>t(_),[_]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??D??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=_.blocks,oe=C(()=>K(G,q,te),[K,q,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=E(e=>_.documentHooks?.stored?.(e)??e,[_]);H(()=>{m(_,ne)},[_,ne]);const se=O(G);H(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!_.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(q.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,be):null,[Pe,je]=B(null),Re=O(null),Be=O(null),[Ce,Ee]=B(!1),He=O(null),[Oe,Te]=B(null),Ne=O(null),[Ae,Me]=B(null),[Le,Ye]=B(!1),De=O(null);H(()=>{De.current=Ae},[Ae]);const[Fe,Ve]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Xe=O(Fe);H(()=>{Xe.current=Fe},[Fe]);const We=O(()=>Promise.resolve(!1)),Ke=E(e=>{Be.current=e,Ee(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Xe.current)){if(!await We.current(e,r)){if(!p(Xe.current))return void Ke({id:e,data:r});throw new Error("page save did not land")}}else Ke({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:Je,hasPending:$e}=Ue,er=O(Ze);H(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=E(()=>{const e=Be.current;e&&(Be.current=null,Ee(!1),xe(e))},[xe]),tr=O("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=O(!1),[sr,ir]=B(F(j)),lr=O(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=V(j,e);r?z.address.load(r):F(j)&&ir(!1)},[j,z]);const cr=z.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=_.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==D&&re!==D?void z.address.load({kind:"page",slug:D,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Ne.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:N,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},_),cause:r(o,_)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=E(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=E(async e=>{const r=le.current;if(!r&&_.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,_)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,_]),mr=E(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=E(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Xe.current))return!1;if(De.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Ne.current,tr.current));if(t.ok)return Ne.current=t.value.version??Ne.current,Ye(!1),!0;const o=J.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Xe.current=e,Ve(e),!1}const u=J.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ne.current=n.value,We.current(e,r,!0)}_e(),De.current=u,Me(u)}return Ye(i(t.error,_)?.status===c),!1},[oe,fr,_e,_]);H(()=>{We.current=kr},[kr]);const vr=E(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Xe.current)?xe({id:ke,data:r}):Ke({id:ke,data:r})},[ke,cr,Ke,xe,ae]),gr=E(async()=>{p(Xe.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=O(gr);H(()=>{pr.current=gr},[gr]);const hr=O(fr);H(()=>{hr.current=fr},[fr]);const yr=E(()=>{z.address.reload()},[z]),wr=O(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Ne.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Pe;H(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Xe.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Xe.current=e,Ve(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=J.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(Ve({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=E(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=E(()=>{Ve(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=E(()=>{er.current.paused?(p(Xe.current)&&nr(),ze()):Qe()},[nr,Qe,ze]),jr=E(()=>{Je()},[Je]),Rr=E(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{qe(),Be.current=null,Ee(!1)},setVersion:e=>{Ne.current=e},setSaveConflict:Me,setAccess:Ve}),X(e),Q(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),z.address.show(e),"document"!==e.kind&&W(e)&&z.send("storefront-editor:navigated",{target:e})},[qe,z,me,X,W]),Br=E(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,D))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ge().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ge,D]),Cr=E(()=>Te(null),[]),Er=E(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Hr=E(async()=>{const e=Oe;if(!e)return;await gr()&&(Te(null),Rr(e))},[Oe,gr,Rr]),Or=E(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Xe.current)||De.current)return;const r=ae(e);if(!await kr(ke,r))return void(De.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Ne.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Ne.current=t.value.version??Ne.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
-
return T(A.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Ce,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Or,access:Fe,readOnly:null!==I(Fe)||null!==Pe||null!==Ae,readOnlyReason:Pe,takeOverEditing:br,viewReadOnly:Ir,saveConflict:Ae,saveUnreachable:Le,reloadFromServer:yr,navigate:Br,pendingNav:Oe,cancelPendingNav:Cr,discardAndNavigate:Er,saveAndNavigate:Hr},children:L})}export{A as ScreenDocumentContext,L as ScreenDocumentProvider,M as useScreenDocument};
|
package/dist/chunk-KRL3IUV3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
|
package/dist/chunk-LF3FUSCQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t="data-sf-repeat",e="data-sf-repeat-index",r=`[${t}][${e}]:not([${e}="0"])`;function n(t){return null!==t.closest(r)}function l(t){let e=null;for(const r of t){if(!n(r))return r;e??=r}return e}function o(t,e){return l(t.querySelectorAll(e))}function u(t,e){const r=[...t.querySelectorAll(e)],o=l(r);return o?[o,...r.filter(t=>t!==o&&n(t))]:[]}export{t as REPEAT_ATTRIBUTE,e as REPEAT_INDEX_ATTRIBUTE,n as isRepeatCopy,l as mainCopyOf,u as queryAllCopies,o as queryMainCopy};
|
package/dist/chunk-LN43DP2A.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-TQ5Y6S2X.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-6NJHYXJM.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as o,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as u,elementScale as h,related as f,WORDS_CLEAR as p,frameRectToLayer as m,clientPointToLayer as g}from"./chunk-YU3WHLGI.js";import{isRepeatCopy as b}from"./chunk-LF3FUSCQ.js";import{parseZoneKey as y,ROOT_ID as x}from"./chunk-TGZCD6IP.js";import{useRef as v,useEffect as w,useState as k,useCallback as N,useMemo as D,useSyncExternalStore as A,useId as z,useLayoutEffect as T}from"react";import{Tooltip as M,IconButton as C,solidSurfaceStyle as $,Input as S,ItemCount as E}from"efficient-shell/ui";import{AddIcon as j,CloseIcon as L,SearchIcon as B}from"efficient-shell/icons/efficient";import{jsxs as I,jsx as O}from"react/jsx-runtime";function Y({label:e,onInsert:t,style:n,axis:l="y",className:r,index:a}){const s=["es-canvas-insert","x"===l?"is-x":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return I("div",{className:s,style:n,"data-index":a,children:[
|
|
3
|
-
/* @__PURE__ */O("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */O("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */O(M,{content:e,children:/* @__PURE__ */O(C,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */O(j,{})})})})]})}var X=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,q=e=>e.width*e.height;function K(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>X(e.box,t,n)).sort((e,t)=>q(t.s.box)-q(e.s.box)||e.at-t.at).map(({s:e})=>e)}function H(e,t,n){return K(e,t,n).at(-1)??null}function P(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function Z(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,s=r??l??e.box;return{left:a-1,top:s.top,width:2,height:s.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function F(e,t,n,l,r=()=>!1,a=()=>!0){const s=e.filter(e=>X(e.box,t,n)).sort((e,t)=>q(e.box)-q(t.box));for(const e of s){const s=P(e,t,n),o={...e.list,index:s};if(r(o))return null;if(l(o))return{zone:e,to:o,line:Z(e,s)};if(!a(o))return null}return null}function G(e,t,n=12){const l=e.children;if(0===l.length)return[];const r=e.box,a="x"===e.axis,s=a?r.left:r.top,o=s+(a?r.width:r.height),i=e=>a?e.left:e.top,c=e=>a?e.left+e.width:e.top+e.height,d=[];for(let r=0;r<=l.length;r++){const u=l[r-1],h=l[r];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+o)/2:(s+i(h))/2,t=Math.min(Math.max(e,s+n),o-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>a?e.top:e.left)),b=Math.max(...m.map(e=>a?e.top+e.height:e.left+e.width)),y=a?{left:f,top:g,width:p,height:b-g}:{left:g,top:f,width:b-g,height:p};d.push({key:`${e.key}:+${r}`,place:{...e.list,index:r},box:y,axis:e.axis,label:t})}return d}function J(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],s=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(a.top-s,0)}})}return n}var Q={nodes:[],zones:[]},R="data-easel-dropzone",U="data-easel-block";function V(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function W(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function _(e,t,n){return m(e.frame,V(n),t)}function ee(e,t){const{frame:n,document:l}=e,r=e=>m(n,V(e),t),a=[],s=[];for(const e of l.querySelectorAll(`[${R}]`)){if(b(e))continue;const t=e.getAttribute(R)??"";let n;try{n=y(t)}catch{continue}const l=[...e.querySelectorAll(`[${U}]`)].filter(t=>t.parentElement?.closest(`[${R}]`)===e&&!b(t)),o=l.map(r);s.push({key:t,list:n,box:r(e),axis:W(o,e),children:o}),l.forEach((e,t)=>{const l=e.getAttribute(U);l&&a.push({id:l,place:{...n,index:t},box:o[t]})})}return{nodes:a,zones:s}}var te="data-es-empty-cell",ne="data-easel-dropzone",le=140;var re=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),ae=e=>({left:e.left+2,top:Math.max(e.top-11,0)});function se(s){const{canvas:m,session:b,readOnly:y,words:z=e.canvas}=s,C=v(s);w(()=>{C.current=s});const S=v(null),E=o(m),[j,L]=k(0),B=N(()=>L(e=>e+1),[]),[X,q]=k(Q);w(()=>{const e=S.current;m&&e&&q((C.current.measure??ee)(m,e))},[m,E,s.revision,j]);const H=s.model,P=D(()=>H(X),[H,X]),Z=A(b.subscribe,b.shown,b.shown),G=s.choose,J=(e,t)=>{const n=K(P.sources,e,t);return 0===n.length?null:G?G(n):n[n.length-1]},[R,U]=k(null),[V,W]=k(null),[le,se]=k(null),oe=v(null),ie=()=>{oe.current&&clearTimeout(oe.current),oe.current=null},ce=()=>{ie(),oe.current=setTimeout(()=>{b.get()||U(null)},140)};w(()=>ie,[]);const de=v(null),ue=i(m),he=v(!1);he.current=ue;const[fe,pe]=k(null),me=v(null),ge=v(R);ge.current=R,w(()=>{ue?(pe(ge.current?.key??me.current?.id??null),ie(),U(null)):pe(null)},[ue]);const[be,ye]=k(null);c(m,d,e=>{const t=e.detail?.id??null,n=t?{id:t,words:e.detail?.words??null}:null;ye(n),n&&(me.current=n)});const xe=e=>{if(!(e&&e.isConnected&&m&&S.current))return null;const t=_(m,S.current,e);return{left:t.left-p,top:t.top-p,width:t.width+2*p,height:t.height+2*p}},ve=!be||ue||y||Z?null:xe(be.words)??X.nodes.find(e=>e.id===be.id)?.box??null;c(m,"mousemove",e=>{const t=S.current;if(!m||!t)return;const n=u(m.frame,e.clientX,e.clientY,t),l=h(t),r={x:n.x/l,y:n.y/l};if(de.current=r,C.current.readOnly||b.get()||he.current)return;ie();const a=J(r.x,r.y);U(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),c(m,"mouseout",e=>{e.relatedTarget||(de.current=null,ce())}),c(m,"mouseover",e=>{e.relatedTarget||B()});const we=v(null),ke=N(()=>{we.current?.(),we.current=null,W(null),se(null)},[]);w(()=>b.subscribe(()=>{b.get()?B():ke()}),[b,ke,B]),w(()=>ke,[ke]),("undefined"==typeof document?w:T)(()=>{if(b.get())return;const e=de.current;U(t=>y||he.current?null:e?J(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Z,b,y,G]);const Ne=e=>{const t=b.get(),n=S.current,l=C.current.dropOn;if(!t||!n||!l)return null;const r=g(n,e.clientX,e.clientY);de.current=r;const a=K(P.sources,r.x,r.y);for(let e=a.length-1;e>=0;e-=1)if(l.accepts(t.item,a[e]))return{h:t,source:a[e]};return null},De=e=>{const t=b.get(),n=S.current;if(!t||!n)return null;const l=g(n,e.clientX,e.clientY);de.current=l;const r=F(P.zones,l.x,l.y,e=>C.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>C.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},Ae={onDragEnter:e=>{if(we.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=m?l(m.document):null,s=[];t&&s.push(r(t)),a&&m&&s.push(r(a,m.frame)),we.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=Ne(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),W(null),void se(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);se(null);const l=De(e);if(!l)return void W(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const r={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};W(e=>e&&e.zoneKey===r.zoneKey&&e.line.left===r.line.left&&e.line.top===r.line.top?e:r)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(de.current=null,W(null),se(null))},onDrop:e=>{const t=Ne(e);if(t)return e.preventDefault(),b.end(),ke(),void C.current.dropOn.onDrop(t.h.item,t.source);const n=De(e);n&&(e.preventDefault(),b.end(),ke(),C.current.onDrop(n.h.item,n.t.to))}},ze={draggable:!y&&!!R,onMouseEnter:ie,onMouseLeave:()=>!b.get()&&ce(),onDragStart:e=>{if(R&&!y){b.start({key:R.key,item:R.item,from:R.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",R.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{b.end(),ke()},onClick:()=>{R&&!y&&C.current.onPick?.(R.item)}},{seams:Te=[]}=P,Me=be?.words??(ue?me.current?.words??null:null),Ce=s.tag&&m&&S.current&&!Z?(Me&&f(s.tag.element,Me)?xe(Me):null)??_(m,S.current,s.tag.element):null,$e=R?(be&&be.id===R.key?xe(be.words):null)??R.box:null,Se=ue&&fe&&!s.tag?P.sources.find(e=>e.key===fe)??null:null,Ee=Se?xe(Me)??Se.box:null,je=P.zones.filter(e=>0===e.children.length),Le=!s.onZoneAdd||y||ue?[]:je,Be=Le.map(e=>e.key).join("\n");return w(()=>{const e=m?.document;if(!e)return;const t=new Set(Be?Be.split("\n"):[]);for(const n of e.querySelectorAll(`[${ne}]`))n.toggleAttribute(te,t.has(n.getAttribute(ne)??""));return()=>{for(const t of e.querySelectorAll(`[${te}]`))t.removeAttribute(te)}},[m,Be,X,E,j]),/* @__PURE__ */I("div",{ref:S,className:"es-canvas-layer",children:[Z||!s.onSeamAdd||y||ue?null:Te.map(e=>
|
|
5
|
-
/* @__PURE__ */O(Y,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??z.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),Le.length?Le.map(e=>/* @__PURE__ */O("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",V?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:re(e.box),"data-node-id":e.list.parentId===x?void 0:e.list.parentId,onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */O("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??s.zoneAddLabel??z.addBlock})})},e.key)):null,Z?/* @__PURE__ */O("div",{className:"es-canvas-catch",...Ae}):null,le&&Z?/* @__PURE__ */O("div",{className:"es-canvas-target",style:re(le.box),children:s.dropOn?.label?/* @__PURE__ */O("span",{className:"es-canvas-target-label",style:$(),children:s.dropOn.label(Z.item,le)}):null}):null,V&&!je.some(e=>e.key===V.zoneKey)?/* @__PURE__ */O("div",{className:`es-canvas-line is-${V.axis}`,style:re(V.line)}):null,ve?/* @__PURE__ */O("span",{className:"es-canvas-hint"+(ve.width<200?" is-below":""),style:{...$(),left:ve.left+ve.width,top:ve.width<200?ve.top+ve.height:ve.top},children:z.typeHint}):null,Ce&&s.tag?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ce),children:s.tag.label}):Se&&Ee?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ee),children:Se.label}):null,
|
|
6
|
-
/* @__PURE__ */O("div",{className:"es-canvas-handle-spot",style:$e?{"--es-handle-x":`${ae($e).left}px`,"--es-handle-y":`${ae($e).top}px`}:void 0,children:/* @__PURE__ */O(M,{className:"es-canvas-handle-tip",side:"top",content:!R||y||Z?null:R.title??z.handle({label:R.label}),children:/* @__PURE__ */I("div",{className:["es-canvas-handle",R&&!y?"is-shown":"",Z?"is-dragging":""].filter(Boolean).join(" "),...ze,children:[
|
|
7
|
-
/* @__PURE__ */O("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),R?.label]})})})]})}var oe=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ie({groups:t,session:n,itemFor:l,onInsert:r,onTileMenu:a,at:o,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=k(""),g=z(),b=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),x=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return I("div",{className:"es-add",children:[o?/* @__PURE__ */I("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */O("span",{children:o.label}),s(u.stop,/* @__PURE__ */O("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:o.onClear,children:/* @__PURE__ */O(L,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
-
/* @__PURE__ */O("p",{className:"es-add-hint",children:h}),
|
|
11
|
-
/* @__PURE__ */O("div",{className:"es-add-find",children:/* @__PURE__ */O(S,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */O(B,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */O(C,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */O(L,{size:12,"aria-hidden":"true"})}):void 0})}),0===x.length?/* @__PURE__ */I("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */O("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
-
/* @__PURE__ */O("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):x.map(e=>/* @__PURE__ */I("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
-
/* @__PURE__ */I("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */O("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
-
/* @__PURE__ */O(E,{count:e.tiles.length,label:u.count({count:e.tiles.length,sections:oe(e)}),className:"ml-auto"})]}),
|
|
17
|
-
/* @__PURE__ */O("div",{className:oe(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return s(l,/* @__PURE__ */I("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r?.(e.type),onContextMenu:a?t=>{a(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */O("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */O("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
-
/* @__PURE__ */I("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */O("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ie as AddPanel,se as CanvasDragLayer,Y as CanvasInsert,Q as EMPTY_MEASURE,le as HANDLE_GRACE_MS,F as canvasTarget,X as contains,P as gapInZone,Z as gapLine,G as insertSeams,ee as measureCanvas,H as pickSource,J as seamsBetween,K as sourcesAt};
|
package/dist/chunk-MRWVYSU5.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-DSKNJXB4.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-75C6WFNF.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-Y53EKN35.js";import{usePartBridge as g}from"./chunk-7RSE6KKY.js";import{useSectionOps as y}from"./chunk-OITNWE52.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-55KKGABA.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-CMPFUJ26.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as N,PanelShowStrip as O}from"./chunk-5PXVT7JY.js";import{offeredChoices as I}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as T,useScreenCanvasFrame as M,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,isSelectionMode as F,sameInspectorMode as D,useScreenBridges as W,useScreenBlockRules as H,useScreenBlockLook as V,useScreenStorageNamespace as Y,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as X,useScreenStyleClipboard as K,useScreenDocumentPass as Q,useScreenCanvasDrag as G,ScreenCanvasTargetProvider as _,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as ee,shownChildSlotsOf as ne}from"./chunk-QORC32JO.js";import{MediaPopup as te}from"./chunk-T2RINM7R.js";import{useNodeClipboard as oe,useNodeContextMenu as re}from"./chunk-AAAZ2CQR.js";import{PageEditGuardNotices as ie}from"./chunk-FRAIEWRC.js";import{useScreenDocument as le}from"./chunk-K7MMLCTT.js";import{requestMediaPick as se}from"./chunk-3FIS2FRS.js";import{useMediaPanel as de,usePanelPick as ae,useMediaBrowsing as ce,useOpenMediaBrowse as pe,useMediaPlace as ue}from"./chunk-NCXYC7WI.js";import{useEaselSession as he}from"./chunk-YM4UEGBV.js";import{useEaselHost as fe,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{heldStyle as ve,styleShortcut as be}from"./chunk-V7U33NF2.js";import{DEFAULT_SCREEN_WORDS as ke}from"./chunk-IYHO4XQX.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ne,blockNodeActions as Oe,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Te,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ae,CanvasPartsContext as Le,partHasOwnBox as Ee,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-FJTCSQWK.js";import{TreeRow as De,Subtree as We,LayersTree as He,TreeGroupLabel as Ve,TreeRowAction as Ye,TreeSeam as Ue}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Qe,clickPick as Ge}from"./chunk-RPMSET77.js";import{EaselTopBar as _e,EaselIconButton as Ze,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-WYTPBF3Q.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as hn,CanvasDragLayer as fn,CanvasInsert as mn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn,nodeIdAt as Cn,frameRectToHost as Nn,BLOCK_ATTRIBUTE as On,drawnBox as In}from"./chunk-YU3WHLGI.js";import{queryMainCopy as Bn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as An}from"./chunk-TGZCD6IP.js";import{useRef as Ln,useMemo as En,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Wn,useContext as Hn,Fragment as Vn,useId as Yn}from"react";import{ColoredBadge as Un,Button as Jn,Tabs as Xn,toast as Kn,readMediaFileDrag as Qn,Tooltip as Gn,groupColors as _n,Dialog as Zn,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ht}from"react/jsx-runtime";var ft="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ke).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Yn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return pt(Zn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ht,{children:[
|
|
3
|
-
/* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(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 vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Wn(()=>{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=Nn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Bn(t,`[${On}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?In(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Nn(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__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("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__ */pt(Gn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:_n("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:_n("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ht,e?{children:[
|
|
8
|
-
/* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(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 wt="__rungs";var xt="screen:band",zt={duplicate:!0,delete:!0},Ct=()=>null;function Nt(){const Sn=fe(),Nn=Sn.panels?.Toolbar,On=(Sn.panels?.useRight??Ct)(),{target:In,docId:Yn,capabilities:Gn,currentSlug:_n,siteId:Zn,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:Ot,flushSave:It,access:Bt,saveUnreachable:Pt=!1,readOnly:$t,readOnlyReason:Tt=null}=le(),Mt=B(),jt=P(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Et}=Gn,{appState:Rt,dispatch:Ft,history:Dt,selectedItem:Wt,getSelectorForId:Ht,config:Vt}=je(e=>e),Yt=$(),{first:Ut,firstGroup:Jt,lastGroup:Xt,isSectionGroup:Kt,sectionGroupZone:Qt,panelOf:Gt}=Yt,_t=Gt(Ut),Zt=e=>Z(Yt,e),qt=e=>q(Yt,e),eo="node"===Yt.firstRow,no=Yt.band??null,to=un("screen",ke),oo=un("tree",Je),ro=un("drag",gn),io=un("notice",sn),lo=un("lock",pn),so=un("menu",Xe),ao=un("styleClipboard",Se),co=un("chrome",dn),po=T()??`/${_n}`,uo=M(),ho=j(),fo=y({readOnly:$t}),mo=y({readOnly:$t,foldIntoHistory:!0}),go=Ln(null),yo=Ae(),vo=En(()=>({...fo,select:e=>{go.current=e,fo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yo.config;go.current=Ke(e,t,n)}fo.commitDocument(e,n)}}),[fo,yo]),bo=Rt.ui,ko=bo.leftSideBarVisible,So=bo.rightSideBarVisible,{options:wo,widths:xo,initial:zo,fluid:Co,fit:No}=A(),[Oo,Io]=Rn(zo),Bo=de(),Po=At&&null!==Bo;ae(),ce();const $o=pe();L(Wt?.props.id);const{read:To,write:Mo,forSelection:jo}=E(),[Ao,Lo]=Rn(To);Fn(()=>{Mo(Ao)},[Ao]);const[Eo,Ro]=Rn(0),Fo=Ln(null),Do=Ln(null),Wo=kn(Do,{readySelector:kt}),Ho=xn(Wo),Vo=d(Do);a(Do,Wo);const Yo=k(),Uo=an(Bt),Jo={state:et,offline:Yo||et.failed&&Pt,readOnlyReason:Tt,editing:Uo?io.editing({name:cn(Uo.name,lo),noun:to.noun}):null,conflict:null!=at,notSaving:to.bar.notSaving},Xo=()=>{$t||(et.failed?Nt():It())};c(Do,Wo,Xo);const[Ko,Qo]=Rn(!1),Go=Ln(!1),[_o,Zo]=Rn(null),[qo,er]=Rn([]),[nr,tr]=Rn(R);F(nr);const or=o(nr,Wt?.props.id),[rr,ir]=Rn(null);Fn(()=>{rr&&(r(),ir(null))},[rr]);const lr=Ln(Ht);lr.current=Ht;const sr=Dn((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Lr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=Ln(null);Fn(()=>{const e=dr.current;dr.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);tr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Gt(Wt?.type)??R);const t=Wt?.props.id,o=go.current;if(go.current=null,!t)return;const r=Ht(t);sr(String(t),{scroll:!i(o,r??null,Ne)})},[Wt?.props.id,sr]);const ar=Dn(e=>{tr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),cr=Ln(()=>{});cr.current=(e,n)=>{const t=e?$i(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);tr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},vo.select(e))};const pr=Dn((e,n)=>cr.current(e,n),[]),ur={kind:nr.kind,mode:nr,open:ar,show:e=>tr(e),reveal:()=>{So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=W(ur,{data:Rt.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean($t),select:e=>{tr(R),vo.select({index:e})},replace:(e,n)=>vo.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:Oo,refreshes:Eo},{setView:Lo,reveal:()=>{ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",mr=H(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:br,canAddTo:kr,blockIsOffered:Sr}=mr,wr=V(),{labelAtLevel:xr,Icon:zr,useProducts:Cr}=wr,Nr=wr.rowName?(e,n,t)=>wr.rowName(e,n,t):void 0,Or=Dn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Ft,sr]),{selectNode:Ir,openPartId:Br}=g({mode:nr,setMode:tr,onOpenPart:Or}),[Pr,$r]=Rn(null);me(null!==Pr,()=>$r(null));const Tr=h(Y()),Mr=Tr.collapsed,jr=Tr.panelWidths,[Ar,Lr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Mr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Fn(()=>{try{window.localStorage.setItem(Mr,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Er,Rr]=Rn(()=>{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(Er))}catch{}},300);return()=>clearTimeout(e)},[Er]);const Fr=Dn((e,n)=>Rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Dr=Dn(e=>Fr("left",e),[Fr]),Wr=Dn(e=>Fr("right",e),[Fr]),Hr=e=>Ar.has(e),Vr=e=>Lr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Ur=Ln(null);Fn(()=>{if(Yr.current&&!Ko){const e=Ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Do.current?.querySelector(`button[aria-label="${CSS.escape(to.add.title)}"]`))?.focus(),Ur.current=null}Yr.current=Ko},[Ko]),Fn(()=>{if(!Ko||!Vo)return;const e=e=>{"Escape"===e.key&&al()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Ko,Vo]),me(Ko,()=>al()),Fn(()=>{!ko&&Ko&&(Qo(!1),Zo(null),Go.current=!1)},[ko]);const Jr=U(),Xr=(e,n="success",t)=>{if(Jr)return void(t?Jr(e,"error"===n?"error":"info",t):Jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Kn.error(e,{...o,duration:t?.duration??3200}):Kn.success(e,{...o,duration:t?.duration??1900})},Kr=Ln(null),[Qr,Gr]=Rn(0),[_r,Zr]=Rn(0),qr=J(),ei=Ln(null),ni=e=>Math.max(0,e.clientHeight-(ei.current?.offsetHeight??0));Fn(()=>{const e=Kr.current;if(!e)return;const n=()=>{Gr(e.clientWidth),Zr(ni(e))};n();const t=new ResizeObserver(n);return t.observe(e),ei.current&&t.observe(ei.current),()=>t.disconnect()},[]),Wn(()=>{Kr.current&&(Gr(Kr.current.clientWidth),Zr(ni(Kr.current)))},[Er,ko,So]);const ti=Oo===Co?Qr>0?Qr:xo[Co]:xo[Oo],oi=Qr>0?Math.min(Qr/ti,"shrink"===No?1:2):1,ri=ti*oi,ii=Qr>0&&ri>Qr+1,li={width:ri,height:_r||"100%",flex:"none",position:"relative"},si={width:ti,height:_r?_r/oi:"100%",maxHeight:"none",transform:1!==oi?`scale(${oi})`:void 0,transformOrigin:"top left"},di=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!ko}}),ai=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!So}}),ci=e=>{Ko&&(Qo(!1),Zo(null),Go.current=!1,ko&&Ao===e)||(Lo(e),ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},pi=()=>{tr(_t??R),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},ui=Rt.data.content??[],hi=()=>{const e=ui.findIndex(Zt),n=ui.findIndex(qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ui.length}},fi=Vt,mi=mr.stripCopy,gi=n=>e(n,mi),yi=oe(),vi=Qe({data:Rt.data,config:fi,readOnly:Boolean($t),clipboard:yi,strip:mi?e=>mi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=hi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&tr(R);const t=void 0===n||"node"===n?.kind?n:null;vo.commitDocument(e,t)}}),bi=he(),[ki,Si]=Rn(null),wi=e=>{const n=ui.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&vi.swap(e,t.detach(n))},xi=e=>{const n=jn(Rt.data,Vt,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Ne?Ii(o):Hi(o),i=t===Ne?Yt.shared?.usedOn(o):null;return!!vi.remove(e)&&(Xr(i?to.shared.removed({count:Math.max(0,i.length-1)}):to.deleted({name:r}),"success",{duration:8e3,action:{label:to.bar.undo,onClick:()=>{vi.restore(n.node,n.place)}}}),!0)},zi={...vi,remove:xi},Ci=e=>xr(e,"block",Vt.components[e]?.label??e),Ni=Dn(e=>Vt.components[e]?.defaultProps??{},[Vt]),Oi=e=>xr(e,"section",Ci(e)),Ii=e=>we({type:e.type,props:e.props??{}},Oi(e.type),Nr),{nodeAddresses:Bi,zoneItems:Pi}=En(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Vt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ui,Ne,0),{nodeAddresses:e,zoneItems:n}},[ui,Vt]),$i=Dn(e=>Pi.get(e)??[],[Pi]),Ti=e=>{const n=Bi.get(e);return n?$i(n.zone)[n.index]:void 0},Mi=e=>ee(mr,Vt,e),ji=e=>{if(!mr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ti(e.slice(0,n));if(!t)return null;const o=Mi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Ai=(()=>{if(!X(nr))return null;const e=`${nr.nodeId}:${nr.slot}`;return ji(e)?.slot.panel===nr.kind?e:null})(),Li=Ln(null);Fn(()=>{const e=Li.current;if(Li.current=null,!Ai||!X(nr))return;const n=nr.nodeId;sr(n,{scroll:e!==Ai}),Lr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[nr]);const Ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Bi.get(e);n&&(n.zone===Ne?tl(n.index):Bl(n.zone,n.index,e,Ti(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ai!==i&&(Li.current=i),pr(null,r),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ri=(e,n,t)=>{const o=`${e}:${n}`;if(Lr(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;Ai!==o&&(Li.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Fi=(e,n,t)=>{if($t||!mr.moveSlot)return;const o=Ti(e),r=o?Mi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Ri(e,d,i.panel)},Di=Cr(),Wi=En(()=>{const e=/* @__PURE__ */new Map;for(const n of Di??[])e.set(n.slug,n.name);return e},[Di]),Hi=e=>xe(e,Ci,wr.plainText,e=>Wi.get(e),wr.rowName),Vi=(e,n)=>{const t=Vt.components[e.type]?.fields,o=n===Ne||ns(n)?"section":"block",r=n===Ne&&(Zt(e)||qt(e)||Kt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return wr.renamePropOf?wr.renamePropOf(e,o,i):i},Yi=(e,n,t,o)=>{if(!(!$t&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{$r(null),o&&((e,n,t)=>{const o=$i(e)[n];if(!o)return;const r=Vi(o,e);r&&vo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":to.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)},Ui=t(K(),ao),Ji=Ui.scope({target:In,siteId:Zn,docId:Yn}),Xi=Vt,Ki=(e,n)=>n===Ne?Oi(e):Ci(e),Qi=(e,n,t)=>{const o=Ui.plan(Ji,t,Ki(t.type,e),Xi);o&&(o.changed&&vo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Xr(o.message))},Gi=re({nodesIn:$i,nodeAt:(e,n)=>$i(e)[n]??null,labelOf:(e,n)=>n===Ne?Oi(e):Ci(e),renamePropOf:Vi,beginRename:(e,n)=>$r({zone:e,index:n}),history:{hasPast:Dt.hasPast,hasFuture:Dt.hasFuture,back:()=>Dt.back(),forward:()=>Dt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:to.pageStyles,words:{menu:so,styleClipboard:ao,screen:to.menu},readOnly:Boolean($t),collapseAll:()=>Lr(new Set($i(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Xr(e?to.pasteRefused({name:e.label}):to.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>rs(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:to.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||gr(e.type,e)?n:{...n,change:[{label:to.shared.detach,onClick:()=>wi(e.props.id)}],remove:[{label:to.shared.removeFromPage,danger:!0,onClick:()=>{xi(e.props.id)}}]}}return $t||Zt(e)||qt(e)||Kt(e.type)?null:x(bi)?{change:[{label:to.shared.makeShared,onClick:()=>Si({id:e.props.id,name:Ii(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=>gr(e.type,e),duplicateBlocked:e=>yr(Rt.data,e),permits:e=>{const n=Oe(Vt,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:zi,isPinned:(e,n)=>n===Ne&&(Zt(e)||qt(e)),sectionBand:hi,locate:e=>Bi.get(e)??null,rowNameOf:(e,n)=>n===Ne?Ii(e):Hi(e),selectAt:(e,n,t,o)=>{e===Ne?tl(n):Bl(e,n,t,o??"")},slotRung:e=>{const n=ji(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ei(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ji),canCopy:e=>Ui.rows(Xi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ui.copy(Ji,e,Ki(e.type,n),Xi),paste:(e,n,t)=>Qi(e,n,t)},keys:jt?{target:Vo,selected:()=>{const e=Rt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>yi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Xr(to.copied({name:n}))}}:void 0},Wo),_i=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{_i.current={copy:(e,n)=>Ui.copy(Ji,e,Ki(e.type,n),Xi),paste:Qi,at:()=>{const e=Rt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=$i(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const Zi=Dn(e=>{const n=be(e);if(!n)return;const t=_i.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]),zn(Wo,"keydown",Zi);const qi=ui.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void er(e=>e.length?[]:e);const n=ui.findIndex(qt),t=n>=0?n:ui.length,o=n=>{const t=ui[n]?.props?.id;return null==t?null:Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ui.length>0&&!Zt(ui[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=St(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})}er(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()}},[Wo,qi,Oo,oi,ko,So,Wt?.props.id]);const el=Wo?.document??null,nl=Wo?.window??null;Fn(()=>{const e=Fo.current;if(!e||!el||!nl)return;const n=[],t=()=>{const n=Bn(el,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&nl.scrollTo({left:nl.scrollX,top:nl.scrollY+t,behavior:"instant"}),!0};return Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[el,nl]);const tl=e=>{tr(R),vo.select({index:e}),hr.sectionPressed?.(ui[e]);const n=ui[e]?.props?.id;n&&l(n)},ol=e=>{const{floor:n,cap:t}=hi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&nr.kind!==_t?.kind?ui.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},rl=(e,n)=>{const{floor:t,cap:o}=hi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(vo.reorderComponent(Ne,e,i),vo.select({index:i}),{moved:!0,dest:i})},il=(e,n,t,o)=>{tr(R),vo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Xr(to.sectionAdded({name:t}))},ll=(e,n)=>{const t=ol(n),o=br(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),r=o?vo.insertNode(Ne,t,o):vo.insertSection(e,t);return il(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 Be(Vt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(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},sl=e=>dl(Ne,e),dl=(e,n)=>{Ur.current=document.activeElement??null,Zo(null===n?null:{zone:e,index:n}),Qo(!0),ko||(Go.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},al=()=>{Qo(!1),Zo(null),Go.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Go.current=!1},cl=(e,n)=>wr.rowName?n?Zt(e)?wr.rowName(e,"section",to.header):qt(e)?wr.rowName(e,"section",to.footer):Kt(e.type)?wr.rowName(e,"section",Ci(e.type)):Ii(e):Hi(e):n?Oi(e.type):Ci(e.type),pl=e=>n=>{e()},ul=(e,n,t)=>{if($t)return null;const o=$i(e)[n];return o&&!Oe(Vt,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */pt(Ye,{kind:"delete",label:e===Ne&&o&&Yt.shared?.usedOn(o)?to.shared.removeFromPage:to.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=$i(e)[n]?.props?.id;null!=t&&xi(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},hl=e=>wr.rowPreview?.(e)||void 0,fl=e=>wr.rowMarks?.(e)??void 0,ml=(e,n,t)=>wr.rowActions?.(e,n,t)??null,gl=(e,n,t,o)=>{if($t)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return pt(Ye,{kind:"eye",label:r?to.showNamed({name:o}):to.hideNamed({name:o}),onClick:()=>vl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},yl=e=>Qs(Ne,e),vl=(e,n,t)=>{vo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>Pe(Vt,e),kl=e=>Be(Vt,e),Sl=e=>mr.slotsOf?Mi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Te(e,n.slot)})):[{slot:null,rung:null,kids:ne(Vt,e)}],wl=e=>mr.slotsOf?Sl(e).flatMap(e=>e.kids):ne(Vt,e),xl=e=>Boolean(mr.slotsOf)&&Mi(e).some(e=>e.rung),zl=(e,n,t)=>null===t?void 0===n?kr(e):kr(e,n):kr(e,n,t),Cl=(e,n,t)=>{const o=Me(Vt,e.type,n)&&(t||wl(e).length>0||xl(e));return{collapsible:o,folded:o&&Hr(String(e.props.id))}},Nl=(e,n,t)=>Sl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Cl(e,r,t(e.type)).collapsible?[String(e.props.id),...Nl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ol=e=>wl(e).length>0||xl(e)||Boolean(kr(e.type)),Il=e=>Boolean(kr(e)),Bl=(e,n,t,o)=>{if(tr(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),vo.select({index:n,zone:e}),l(t)}else vo.select({index:n,zone:e}),l(t)},Pl=(e,n,t,o,r)=>{const i=`${e}:${n}`;vo.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),vo.select({index:o,zone:i})}):vo.select({index:o,zone:i})},$l=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if($l.current.has(t))return;$l.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(Ni)).forEach((e,t)=>mo.seedChild(o,t,n.childType,e))})},[ui,mo,Ni]);const Tl=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach((e,t)=>{const o=e.props.id;if(Tl.current.has(o))return;const r=n(e,bl(e.type));Tl.current.add(o),r&&mo.replaceComponent(Ne,t,{...e,props:r})})},[ui,mo]),Q(mo,Vt);const Ml=ui.findIndex(qt),jl=Ml>=0?ui[Ml]:null,Al=eo?ui.findIndex(Zt):-1,Ll=Al>=0?ui[Al]:null,El=Yt.groupTab,Rl=En(()=>El?e=>Kt(e.type):void 0,[El]),Fl=Boolean(Yt.groupBadge),Dl=Yt.sharedReach,Wl=e=>Dl?.(e)??void 0,Hl=En(()=>Dl?new Set(ui.filter(e=>Wl(e)).map(e=>String(e.props.id))):null,[ui,Dl]),Vl=En(()=>Hl?e=>Hl.has(e):void 0,[Hl]),Yl=Yt.first?Dl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Ul=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Jl=ui.find(e=>e.type===Jt)??null,Xl=ui.find(e=>e.type===Xt)??null,Kl=Ml>=0?Ml:ui.length,Ql=[];ui.forEach(e=>{qt(e)||(Ol(e)&&Ql.push(String(e.props.id)),Ql.push(...Nl(e,1,Il)))}),jl&&(Ql.push(String(jl.props.id)),Ql.push(...Nl(jl,1,Il)));const Gl=Ql.length>0&&Ql.every(e=>Ar.has(e)),_l=e=>{const n=wr.blockRowName(e,Ci);return wr.rowName?wr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=$i(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),$i(n).length)},s=bn(i,l);if(e!==n||s!==t)try{vi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))throw e}},ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of kl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},es=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Bi.get(n);if(!e)return null;if(e.zone===Ne)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ns=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.find(e=>Kt(e.type)&&String(e.props.id)===n);return t&&Qt(n)===e?t:null},ts=(e,n)=>{const t=ns(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,$i(e).length))},os=(e,n,t)=>{if(e.rung){const t=Ti(e.rung.nodeId),o=t?Mi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return ss(e.add,n);const o=Tn(n);if(Kt(e.type))return!1;const r=ns(o),i=ns(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!ts(o,e.type))&&(n.index>=0&&n.index<=$i(o).length));if(e.zone===Ne||o===Ne){if(e.zone!==o)return!1;const{floor:t,cap:r}=hi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>$i(o).length)return!1;if(e.zone===o)return!0;const l=jl&&!Yt.lastIsOpen?String(jl.props.id):null;return(!l||es(e.zone)!==l&&es(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??$i(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Bi.get(i),s=l?$i(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ql(r).has(n))return!1;const d=kr(s.type,vr(Rt?.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?.($i(n),r))})(e.zone,o,e.index,t)},rs=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(n)?ts(t,o.type):os({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},is=e=>{const n=e.slice(0,e.indexOf(":")),t=Bi.get(n),o=t?$i(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,vr(Rt?.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:Ci(r.spec.childType)}]:[])),l=ji(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:cl(o,t.zone===Ne)}},ls=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Ne||ns(t)?e:is(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ss=(e,n)=>{const t=ls(e,n),o=Tn(n);if("shared"===t.kind){if(o!==Ne||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ns(o)){const e="section"===t.kind?t.type:t.template.node.type;return ts(o,e)&&n.index>=0&&n.index<=$i(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=is(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.($i(o))},ds=(e,n)=>{const t=ls(e,n);if("block"!==t.kind&&ns(Tn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&ts(n,o)){if("section"===e.kind)vo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;vo.insertNode(n,t,gi(e.template.node))}tr(R),vo.select({index:t,zone:n})}})(t,Tn(n),n.index);if("section"===t.kind)return void ll(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ol(t),r=vo.insertNode(Ne,o,n);il(o,r,e)})(t.template.name,gi(t.template.node),n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=ol(n.index);return void(vi.restore(e,{parentId:Pn,slot:$n,index:o})&&il(o,e.props.id,t.section.title))}const o=Tn(n),r=is(o);r&&(r.target.spec?Pl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{vo.insertComponent(e,n,t),tr(R),vo.select({index:t,zone:e})})(o,t.type,n.index))},as=(e,n)=>{e.media?function(e){const n=Ys();if(!n||!Ws)return;Js(n).then(n=>{n&&function(e,n){if(!Ws)return;const t=Ws.create(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),o=Tn(n);if(o===Ne){const e=ol(n.index),o=vo.insertNode(Ne,e,t);return void il(e,o,Oi(t.type))}vo.insertNode(o,n.index,t),tr(R),vo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Fi(e.rung.nodeId,e.index,n.index):e.add?ds(e.add,n):e.zone===Ne?rl(e.index,n.index):Zl(e.zone,Tn(n),e.index,n.index)},[cs]=Rn(()=>yn()),ps=vn({keyOf:e=>e.id,readOnly:Boolean($t),session:cs,canDrop:os,onDrop:as,onStep:(e,n)=>{e.rung?Fi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ne?((e,n)=>{const t=Oi(ui[e]?.type??""),o=rl(e,n<0?e-1:e+2);if(!o.moved)return void Xr(n<0?to.sectionFirst({name:t}):to.sectionLast({name:t}));const{floor:r,cap:i}=hi();Xr(to.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)}}),us=Dn(e=>{const{floor:n,cap:t}=hi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=$i(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Zt(i)||qt(i)||gr(i.type,i))continue;if(Kt(i.type))continue;const l=Boolean(ns(e)),s=e===Ne||l;e===Ne&&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=Tn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:to.addSection,addAlways:!0}];const t=is(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ns(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Tn(e.list),t=n===Ne||ns(n)?null:is(n);return t?.choices.length?hn(e,t.target.spec?.addLabel??to.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Rt.data]),hs=null==Wt?.props.id?null:String(Wt.props.id),fs=Hn(Le),ms=fs?.selected()&&Wo?.document&&hs?fs.selectedPart?.(Wo.document)??null:null,gs=ms&&hs&&Ee(Rt.data,Vt,hs,ms)?ms:null,ys=gs?.label?{element:gs.element,label:gs.label}:null,vs=null!==gs,bs=Dn(e=>{const n=Vt,t=e=>!e.item.rung&&null!==jn(Rt.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(hs);return i?vs?null:i:r(Ge(Rt.data,n,o.item.id,hs,Rl))??o},[Rt.data,Vt,hs,Rl,vs]),[ks,Ss]=Rn(null),ws=Boolean(El||Dl);zn(Wo,"mouseover",e=>{if(!ws)return;const n=Cn(e.target),t=n?yt(Rt.data,Vt,n):null;t!==ks&&Ss(t)}),zn(Wo,"mouseout",e=>{ws&&!e.relatedTarget&&Ss(null)});const xs=e=>Zt(e)||qt(e)||Kt(e.type),zs=e=>{const n=Kt(e.type)?Ci(e.type):Zt(e)?to.header:qt(e)?to.footer:null;return null===n?Ii(e):wr.rowName?wr.rowName(e,"section",n):n},Cs=[];if(ws){const e=hs?yt(Rt.data,Vt,hs):null;for(const n of/* @__PURE__ */new Set([e,ks])){const e=n?ui.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Zt(e)||e.type===Jt,o=Wl(e);if(o){Cs.push({id:String(e.props.id),label:zs(e),below:t,reach:o});continue}if(!El||!xs(e))continue;const r=El(e);r&&Cs.push({id:String(e.props.id),label:r,below:t})}}const Ns=he(),Os=Ln(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(ui.filter(xs)),t=Os.current;if(Os.current={doc:Yn,bands:n,index:Dt.index},!t||t.doc!==Yn||t.bands===n)return;Dt.hasPast&&Dt.index>=t.index&&!gt.has(Ns)&&(gt.add(Ns),Xr(e,"success",{action:{label:to.bar.undo,onClick:()=>Dt.back()},duration:8e3}))},[ui]);const Is=e=>{tr(R),vo.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Bs=G(),Ps=()=>({data:Rt.data,device:Oo,ops:vo,inspector:ur}),$s=Bs?.model,Ts=En(()=>$s?e=>$s(e,us(e),Ps()):us,[$s,us,Oo]),Ms=Bs?.measure,js=Ms?(e,n)=>Ms(e,n,Ps()):void 0,As=Bs?.canDrop,Ls=As?(e,n)=>As(e,n,os,Ps()):os,Es=Bs?.drop,Rs=Es?(e,n)=>Es(e,n,as,Ps()):as,Fs=Bs?.pick,Ds=Fs?e=>Fs(e,Is,Ps()):Is,Ws=Bs?.media??null,Hs=Ln(null),Vs=En(()=>Ws?{id:ft,zone:"",index:-1,type:Ws.adds.type,add:{kind:Ws.adds.kind,type:Ws.adds.type},media:!0}:null,[Ws]);Fn(()=>{if(!Vs||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Hs.current=null,cs.start({key:ft,item:Vs}))},n=e=>{cs.get()?.item.media&&(Hs.current=Qn(e.dataTransfer))},t=()=>{cs.get()?.item.media&&cs.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,$t,cs]);const Ys=()=>{const e=Hs.current;return Hs.current=null,e},Us=ue(),Js=async e=>{if(!Us)return e;const n=await Us(e);return n?{...e,id:n.id,url:n.url}:null};const Xs=(e,n)=>{if(!Ws)return;const t=jn(yo.getState().appState.data,fi,n);if(!t)return;const o=t.node;vo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Ws.replace(o,e),id:o.props.id}})},Ks=e=>{const n=Tn(e),t=ji(n);t&&Ei(t.node,t.slot,!1),dl(n,e.index)},Qs=(e,n)=>/* @__PURE__ */pt(Ue,{...$t?{}:ps.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),Gs={rowClick:pl,isCollapsed:Hr,toggleCollapse:Vr},_s=e=>{const n=String(e.props.id),t=ui.findIndex(e=>String(e.props.id)===n),o=Qt(n),r=$i(o),i=Hr(n),l=Ci(e.type),s=wr.rowName?wr.rowName(e,"section",l):l,d=e=>Qs(o,e);/* @__PURE__ */
|
|
16
|
-
return ut(ht,{children:[
|
|
17
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:s,preview:hl(e),marks:fl(e),onSelect:()=>tl(t),nameSlot:Yi(Ne,t,n,s),selected:or===n,badge:Wl(e)?void 0:Ul,shared:Wl(e),actions:ml(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:pl(()=>tl(t))},fold:{open:!i,label:"section",onToggle:()=>Vr(n)}}),!i&&/* @__PURE__ */ut(We,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ii(n),l=Ol(n),s=l&&Hr(r),a=()=>Bl(o,t,r,e.type),{rowProps:c,...p}=ps.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:pl(a)});/* @__PURE__ */
|
|
18
|
-
return ut(Vn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:a,nameSlot:Yi(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(o,t,i),ml(n,o,t),gl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(We,{children:ed(n,2)})]},r)}),d(r.length)]})]})},Zs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ps.dragging,d=!Hr(l)&&s?.rung?.nodeId!==i,a={...Mn(l),index:0},c=s&&!s.rung&&os(s,a)?a:void 0,p=()=>Ei(e,n,!0),{rowProps:u,...h}=ps.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:pl(p)}),f=$t?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return ut(Vn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */pt(De,{words:oo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Vr(l)},actions:f&&f.length>0?/* @__PURE__ */pt(ht,{children:f.map((t,o)=>/* @__PURE__ */pt(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ri(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(We,{children:r})]},l)},qs=(e,n)=>{const t=Sl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return pt(ht,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=zl(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)=>Qs(e,n),p=/* @__PURE__ */ut(ht,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Cl(n,l,Il(n.type)),d=String(n.props.id),a=_l(n),p=()=>Bl(t,o,d,e.type),{rowProps:u,...h}=ps.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:pl(p)});/* @__PURE__ */
|
|
23
|
-
return ut(Vn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:a,preview:hl(n),marks:fl(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__ */ut(ht,{children:[ul(t,o,a),ml(n,t,o),gl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(We,{children:qs(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__ */pt(Vn,{children:p},t.slot??"")})})},ed=(e,n)=>{const t=vr(Rt?.data,e.type,String(e.props.id)),o=Sl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return pt(ht,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=zl(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)=>Qs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */ut(ht,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Hi(n),l=String(n.props.id),{collapsible:d,folded:a}=Cl(n,s,Il(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:$i(p).length}:void 0,h=ps.dragging,f=u&&h&&os(h,u)?u:void 0,g=()=>Bl(t,o,l,e.type),{rowProps:y,...v}=ps.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Mn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:pl(g)});/* @__PURE__ */
|
|
26
|
-
return ut(Vn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(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:gr(n.type,n)?ml(n,t,o)??void 0:/* @__PURE__ */ut(ht,{children:[ul(t,o,i),ml(n,t,o),gl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(We,{children:ed(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */pt(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__ */pt(Vn,{children:v},o.slot??"")})})},nd=Ko,td=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ko&&!nd&&fr===e.id,onSelect:()=>ci(e.id)}:e,od=[...(hr.railLead??[]).map(td),{id:"sections",label:to.layers,icon:/* @__PURE__ */pt(ge,{}),active:ko&&!nd&&"sections"===fr,onSelect:()=>ci("sections")},...(hr.railTrail??[]).map(td)],rd=Po?{onPress:$o}:At?{onPress:()=>{se(Sn,{accept:"image/*",title:co.mediaLibrary})}}:null,id={value:od.find(e=>!0===e.active)?.id??"",press:e=>{const n=od.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:od.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ld=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),sd=Boolean(no?.foldable),dd=no?.label??(Lt?to.pageSections:to.templateSections),ad=sd&&Hr(xt),cd=/* @__PURE__ */ut(ht,{children:[ui.map((e,n)=>{if(Zt(e)||qt(e)||Kt(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);kl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Ol(e)||i,s=l&&Hr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:$i(a).length}:void 0,p=ps.dragging,u=c&&p&&os(p,c)?c:void 0,{rowProps:h,...f}=ps.row({item:{id:r,zone:Ne,index:n,type:e.type},place:{...Mn(Ne),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:pl(()=>tl(n))});/* @__PURE__ */
|
|
29
|
-
return ut(Vn,{children:[n>0&&yl(n),
|
|
30
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:Ii(e),preview:hl(e),marks:fl(e),shared:Wl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,r,Ii(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(Ne,n,Ii(e)),ml(e,Ne,n),gl(Ne,n,e,Ii(e))]}),rowProps:h}),Ol(e)&&!s&&/* @__PURE__ */ut(We,{children:[ed(e,1),hr.partRows?.(e,Gs)]}),i&&!s&&/* @__PURE__ */pt(We,{children:hr.ownRows?.(e,n,Gs)})]},String(e.props.id??n))}),Kl>0&&yl(Kl)]}),pd=(e,n,t)=>{const o=String(e.props.id),r=wl(e).length>0||xl(e)||Boolean(kr(e.type)),i=r&&Hr(o),l="header"===t?to.header:to.footer,s=wr.rowName?wr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return ut(ht,{children:[
|
|
32
|
-
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:t,size:13}),name:s,preview:hl(e),marks:fl(e),badge:Wl(e)?void 0:Ul,shared:Wl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Vr(o)}:void 0,actions:ml(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:pl(()=>tl(n))}}),r&&!i&&/* @__PURE__ */pt(We,{children:qs(e,1)})]})};return(hr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */pt(_,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Do,className:"sf-editor es-editor",style:ln(Er),onContextMenu:Gi.onEditorContextMenu,...p(Sn),children:[
|
|
34
|
-
/* @__PURE__ */ut(_e,{children:[
|
|
35
|
-
/* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[rd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:rd.onPress,children:to.railMedia}):null,
|
|
36
|
-
/* @__PURE__ */pt(Ze,{label:to.bar.undo,disabled:Boolean($t)||!Dt.hasPast,onClick:()=>Dt.back(),children:/* @__PURE__ */pt(tt,{})}),
|
|
37
|
-
/* @__PURE__ */pt(Ze,{label:to.bar.redo,disabled:Boolean($t)||!Dt.hasFuture,onClick:()=>Dt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
|
|
38
|
-
/* @__PURE__ */ut(qe,{children:[
|
|
39
|
-
/* @__PURE__ */pt(en,{devices:wo,value:Oo,onChange:Io}),
|
|
40
|
-
/* @__PURE__ */pt(Ze,{label:to.bar.refresh,tip:to.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Wo?.document;if(!e)return null;const n=ui.findIndex(qt),t=n>=0?n:ui.length;let o=null;for(let n=0;n<t;n++){const t=ui[n]?.props?.id;if(null==t)continue;const r=Bn(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=Wt?.props?.id??ui[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ro(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
|
|
41
|
-
/* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
-
/* @__PURE__ */pt(v,{input:Jo,words:to.saveStatus}),Nn?/* @__PURE__ */pt(Nn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(b,{input:Jo,action:hr.mainAction??{label:to.done,onPress:()=>{qn(Rt.data)}},readOnly:Boolean($t),saveSwitch:Mt,onToggleAutoSave:Ot,onSaveNow:Xo,bar:to.bar,words:to.saveStatus}):hr.barMain()]})]}),
|
|
43
|
-
/* @__PURE__ */pt(ie,{}),
|
|
44
|
-
/* @__PURE__ */ut("div",{className:"sf-body",children:[ko?/* @__PURE__ */ut(ht,{children:[
|
|
45
|
-
/* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":to.leftPanel,children:[
|
|
46
|
-
/* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */pt(C,{side:"left",onHide:di}),
|
|
48
|
-
/* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":to.bar.views,value:id.value,onChange:id.press,items:id.items})]}),Ko?/* @__PURE__ */pt(w,{at:_o?{label:(e=>{const n=ns(e.zone);if(n)return to.add.addingTo({name:wr.rowName?cl(n,!0):Ci(n.type)});if(e.zone===Ne){const n=ui[e.index];return n&&!qt(n)?to.add.addingBefore({name:cl(n,!0)}):to.add.addingAtEnd}const t=is(e.zone);return t?to.add.addingTo({name:t.parentName}):to.add.addingHere})(_o),onClear:()=>Zo(null)}:void 0,placeBlocks:_o&&_o.zone!==Ne?is(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(ss(e,n))return null;if("shared"===e.kind&&_o.zone===Ne&&!Yt.shared?.nodeOf(e.section))return to.shared.alreadyHere;const t=ns(_o.zone);if(t)return to.add.notInside({name:cl(t,!0)});if(_o.zone===Ne)return to.add.onlySections;const o=is(_o.zone);return o?to.add.notInside({name:o.parentName}):to.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.index};ss(e,n)&&(ds(e,n),al())}: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:cs,siteWide:hr.addPanelRow?.(al),onClose:al,readOnly:Boolean($t)}):ld?ld.panel({onHide:di,notify:Xr}):/* @__PURE__ */ut(ht,{children:[
|
|
50
|
-
/* @__PURE__ */pt(N,{icon:/* @__PURE__ */pt(ge,{}),title:to.layers,context:po,actions:/* @__PURE__ */ut(ht,{children:[!$t&&/* @__PURE__ */pt(nn,{label:to.add.title,onClick:()=>sl(null),children:/* @__PURE__ */pt(it,{size:15})}),
|
|
51
|
-
/* @__PURE__ */pt(nn,{label:Gl?to.expandAll:to.collapseAll,title:0===Ql.length?to.nothingToFold:void 0,disabled:0===Ql.length,onClick:()=>Lr(e=>{const n=new Set(Ql);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ql])}),children:/* @__PURE__ */pt(bt,{expand:Gl})})]})}),
|
|
52
|
-
/* @__PURE__ */ut(He,{className:"sf-tree sf-scroll",words:oo,children:[Jl&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ve,{children:to.header}),_s(Jl)]}),Et&&!(Fl&&Jl)&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ve,{children:to.header}),!eo&&/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:"header",size:13}),name:to.header,badge:Yl?void 0:Ul,shared:Yl,onSelect:pi,selected:nr.kind===_t?.kind,rowProps:{onClick:pl(pi)}})]}),Ll&&!(Fl&&Jl)&&pd(Ll,Al,"header"),!sd&&/* @__PURE__ */pt(Ve,{children:dd}),sd?/* @__PURE__ */ut(ht,{children:[
|
|
53
|
-
/* @__PURE__ */pt(De,{words:oo,icon:null,name:dd,fold:{open:!ad,label:dd,onToggle:()=>Vr(xt)}}),!ad&&/* @__PURE__ */pt(We,{children:cd})]}):cd,Et&&!Fl&&/* @__PURE__ */pt(Ve,{children:to.footer}),jl&&!(Fl&&Xl)&&pd(jl,Ml,"footer"),Xl&&_s(Xl),hr.treeFoot?.()]})]})]}),
|
|
54
|
-
/* @__PURE__ */pt(tn,{side:"left",width:Er.left,min:rn.left,max:on,defaultWidth:f.left,label:to.resizeLeftPanel,onResize:Dr})]}):/* @__PURE__ */pt(O,{side:"left",onShow:di}),
|
|
55
|
-
/* @__PURE__ */ut("div",{ref:Kr,className:"sf-center sf-scroll","data-sf-canvas-head":qr?"":void 0,style:{overflowX:ii?"auto":"hidden",overflowY:"hidden"},children:[qr&&/* @__PURE__ */pt("div",{ref:ei,className:"sf-canvas-head",children:/* @__PURE__ */pt(qr,{device:Oo})}),
|
|
56
|
-
/* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:li,children:[
|
|
57
|
-
/* @__PURE__ */pt("div",{className:"sf-frame "+(Oo===Co?"":`sf-frame--${Oo}`),style:si,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
|
|
58
|
-
/* @__PURE__ */pt(Re.Provider,{value:Rl,children:/* @__PURE__ */pt(Fe.Provider,{value:Vl,children:/* @__PURE__ */pt(uo,{},Eo)})}),
|
|
59
|
-
/* @__PURE__ */pt(fn,{canvas:Wo,session:cs,model:Ts,measure:js,canDrop:Ls,onDrop:Rs,choose:bs,tag:ys,onPick:Ds,dropOn:Ws?{accepts:(e,n)=>{if(!e.media||!Ws||n.item.rung)return!1;const t=jn(Rt.data,fi,n.item.id);return null!==t&&Ws.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ys();n&&Ws&&Js(n).then(n=>{n&&Xs(n,e.item.id)})})(n),label:()=>to.canvasReplaceImage}:void 0,onZoneAdd:Ks,onSeamAdd:Ks,zoneAddLabel:to.canvasAddBlock,words:ro.canvas,readOnly:Boolean($t),revision:Rt.data}),qo.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:qo.map(e=>
|
|
60
|
-
/* @__PURE__ */pt(mn,{index:e.index,label:to.addSectionHere,onInsert:()=>sl(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))})]})}),ws?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:Cs,onSelect:e=>{const n=ui.findIndex(n=>String(n.props.id)===e);n>=0&&tl(n)}}):null]})]}),So?/* @__PURE__ */ut(ht,{children:[On?
|
|
61
|
-
/* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:On}):/* @__PURE__ */pt(ht,{children:/* @__PURE__ */pt(u,{value:{selectChild:Bl,addChild:Pl,childRowName:Hi,blockRowName:_l},children:/* @__PURE__ */pt(ho,{mode:nr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Ir,onNotify:Xr,onHidePanel:ai,nodeActions:Wt?Oe(Vt,Wt.type):zt})})}),
|
|
62
|
-
/* @__PURE__ */pt(tn,{side:"right",width:Er.right,min:rn.right,max:on,defaultWidth:f.right,label:to.resizeSettingsPanel,onResize:Wr})]}):
|
|
63
|
-
/* @__PURE__ */pt(O,{side:"right",onShow:ai})]}),Gi.menu,
|
|
64
|
-
/* @__PURE__ */pt(te,{}),ki?/* @__PURE__ */pt(mt,{name:ki.name,onMake:e=>(async(e,n)=>{const t=ui.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await z(bi).create(n,t)}catch{return void Xr(to.shared.makeFailed,"error")}o.adopt(t,r),Si(null)})(ki.id,e),onCancel:()=>Si(null)}):null]})}))}export{Nt as ScreenChrome};
|
package/dist/chunk-QORC32JO.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-FJTCSQWK.js";import{Inspector as i}from"./chunk-H4Z2V56N.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",C=()=>null,S=()=>{},w={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},N={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},B={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function D(){/* @__PURE__ */
|
|
2
|
-
return f(r,{height:"fill"})}function F(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
|
-
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var I=l({});function T({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return f(I.Provider,{value:n,children:e})}function x(){return s(I)}function A(){return(x().useOwnerName??j)()}function G(){return(x().useDocumentLabel??C)()}function Q(n,e,t,r){return(x().useBridges??O)(n,e,t,r)}function V(n){return(x().useStandaloneBridges??O)(n)}function Y(n,e){(x().useDocumentPass??S)(n,e)}function H(){return x().blockRules??w}function K(){return x().blockLook??L}function R(){return x().devices??N}function W(){return x().leftView??P}function X(){return x().pinned??B}function Z(){return x().saveSwitch??!0}function E(e){n(!0===x().pickFollowsSelection,e)}function J(){return x().storageNamespace||void 0}function M(){return x().styleClipboard??null}function q(){return x().nodeKeys??!0}function z(){return x().notify??null}function U(){return x().Canvas??D}function $(){return x().CanvasHead??null}function _(){return x().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return x().Inspector??F}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,T as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,K as useScreenBlockLook,H as useScreenBlockRules,Q as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,R as useScreenDevices,G as useScreenDocumentLabel,Y as useScreenDocumentPass,rn as useScreenInspectorPanel,W as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,A as useScreenOwnerName,x as useScreenParts,E as useScreenPickFollowsSelection,X as useScreenPinned,Z as useScreenSaveSwitch,J as useScreenStorageNamespace,M as useScreenStyleClipboard,V as useStandaloneScreenBridges};
|
package/dist/chunk-THWO5YVZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";var n=e=>"editing"===e.kind;function t(e){return e?{kind:"checking"}:{kind:"editing"}}var r=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function c(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var s=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function o(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const c=Math.round(r/60);return t.hoursAgo({count:c})}var a=(n,t=e)=>n.trim()||t.someone;function i(){return`tab-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}`.slice(0,64)}var d="edit_lock_taken";function u(e,t,r){return!(n(e)||!n(t))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function l(e,t,c){return!(null===r(e)||!n(t))&&(!c.pending&&!c.saveConflict)}function f(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function k(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!f(n,e.ours)||e.hasPending())&&(e.reload(),!0)}var h=8e3,y=3e4;function g(e){if(e.cancelled())return!1;const n=e.currentAccess();if("checking"!==n.kind)return!1;const t={kind:"editing"};return e.setAccess(t),u(n,t,e.heldWrite())&&e.releaseHeldWrite(),!0}function p(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?c(t.data):null},s=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},o=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},a=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},i=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:s,accessAfterTakeoverFailure:o,accessAfterHeartbeatFailure:a,isAuthRejection:i,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const c=r.data;return c.code!==t?null:{savedBy:"string"==typeof c.saved_by?c.saved_by:"",savedByYou:!0===c.saved_by_you,secondsAgo:"number"==typeof c.seconds_ago?c.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==d?null:c(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,c;try{const s=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),c={kind:"editing"},!n&&s.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*s.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),c=t?o(n,r):"checking"===r.kind?s(n):a(n,r),i(n)&&e.stopHeartbeat()}e.setAccess(c);const d=e.heldWrite();u(r,c,d)?e.releaseHeldWrite():t&&l(r,c,d)&&e.reloadIfMoved?.()}}}}export{h as CLAIM_FAIL_OPEN_MS,d as EDIT_LOCK_TAKEN,y as FAIL_OPEN_RETRY_MS,t as accessForNewDocument,n as canWriteDocument,p as createEditLock,o as describeAge,s as documentPermissions,f as documentVersionMoved,r as holderOf,a as nameOrSomeone,i as newEaselClientId,g as openUnansweredClaim,c as readLockHolder,k as reloadIfVersionMoved,u as shouldReleaseHeldWrite,l as shouldReloadAfterTakeover};
|
package/dist/chunk-TOHOGVAE.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_WORDS as e}from"./chunk-KFV7N2DJ.js";import{SettingsField as l,SettingsSegmented as n}from"./chunk-CZAAGBVL.js";import{AccordionHeading as a,SettingReset as i,Tooltip as t}from"efficient-shell/ui";export{AlignmentGrid,BorderInput,CornersInput,SidesEachToggle,SidesInput,borderSides,borderStartEach,sidesStartEach}from"efficient-shell/ui";import{jsx as s,jsxs as d,Fragment as o}from"react/jsx-runtime";import{BackgroundIcon as r,WidthIcon as c}from"efficient-shell/icons/efficient";function u({title:e,level:l=3,id:n,className:i}){/* @__PURE__ */
|
|
2
|
-
return s(a,{title:e,level:l,id:n,className:i?`es-panel-band ${i}`:"es-panel-band"})}function b({title:e,level:l=4,id:n,className:i}){/* @__PURE__ */
|
|
3
|
-
return s(a,{tier:"row",title:e,level:l,id:n,className:i})}function h({label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,words:r,className:c}){const u={...e,...r},b=u.resetName({label:l});/* @__PURE__ */
|
|
4
|
-
return s(i,{label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,name:b,tip:t?u.resetTitle({label:l,detail:t}):b,className:c})}function m({name:e,preview:l,offPage:n,status:a,onOpen:i,id:r,className:c}){const u=null!=l;/* @__PURE__ */
|
|
5
|
-
return d("button",{type:"button",id:r,className:c?`es-drill ${c}`:"es-drill",onClick:i,children:[
|
|
6
|
-
/* @__PURE__ */d(t,{content:u?/* @__PURE__ */d(o,{children:[e,
|
|
7
|
-
/* @__PURE__ */s("br",{}),l]}):e,describe:!1,className:"es-drill-text",children:[
|
|
8
|
-
/* @__PURE__ */s("span",{className:"es-drill-name",children:e}),u?/* @__PURE__ */s("span",{className:n?"es-drill-preview is-offpage":"es-drill-preview",children:l}):null]}),a?/* @__PURE__ */s("span",{className:"es-drill-status",children:a}):null,
|
|
9
|
-
/* @__PURE__ */s("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function f({label:e,onPress:l,disabled:n,note:a,done:i,doneLabel:t,icon:o,id:r,className:c}){const u=void 0===t?e:t,b=i?u:e,h=null!=a,m=h&&r?`${r}-note`:void 0;/* @__PURE__ */
|
|
10
|
-
return d("div",{className:c?`es-action-wrap ${c}`:"es-action-wrap",children:[
|
|
11
|
-
/* @__PURE__ */d("button",{type:"button",id:r,className:i?"es-action is-done":"es-action",disabled:n,"aria-describedby":m,onClick:l,children:[o?/* @__PURE__ */s("span",{className:"es-action-icon","aria-hidden":"true",children:o}):null,
|
|
12
|
-
/* @__PURE__ */s("span",{className:"es-action-label",children:b})]}),h?/* @__PURE__ */s("p",{id:m,className:"es-action-note",children:a}):null,
|
|
13
|
-
/* @__PURE__ */s("span",{className:"es-action-live",role:"status","aria-live":"polite",children:i?u:null})]})}var p=["full","content"],N={label:"Background",full:"Full width",content:"Content width"};function v({value:e,changed:a,detail:i,onChange:t,onReset:d,disabled:o=!1,hint:c,labelId:u,words:b,resetWords:m}){const f={...N,...b};/* @__PURE__ */
|
|
14
|
-
return s(l,{label:f.label,labelId:u,icon:/* @__PURE__ */s(r,{}),changed:a,hint:c,action:/* @__PURE__ */s(h,{words:m,label:f.label,changed:a,detail:i,onReset:d}),children:/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?f.full:f.content})),value:e,onChange:t,ariaLabel:f.label,disabled:o})})}var g={label:"Content",full:"Full width",content:"Content width"};function w({mode:e,onMode:a,number:i,changed:t,detail:o,onReset:r,fullClosed:u=!1,disabled:b=!1,hint:m,labelId:f,words:N,resetWords:v}){const w={...g,...N},C=void 0!==e&&a?/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?w.full:w.content,disabled:"full"===e&&u})),value:e,onChange:a,ariaLabel:w.label,disabled:b}):null;/* @__PURE__ */
|
|
15
|
-
return s(l,{label:w.label,labelId:f,icon:/* @__PURE__ */s(c,{}),changed:t,hint:m,action:/* @__PURE__ */s(h,{words:v,label:w.label,changed:t,detail:o,onReset:r}),children:C&&i?/* @__PURE__ */d("div",{className:"es-width-stack",children:[C,i]}):C??i??null})}export{p as BACKGROUND_WIDTHS,N as DEFAULT_BACKGROUND_WIDTH_WORDS,g as DEFAULT_CONTENT_WIDTH_WORDS,f as SettingsAction,v as SettingsBackgroundWidth,w as SettingsContentWidth,h as SettingsDefaultReset,m as SettingsDrill,u as SettingsGroupHead,b as SettingsGroupSub};
|
package/dist/chunk-V7U33NF2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{CopyStyleIcon as e,PasteStyleIcon as n}from"efficient-shell/icons/efficient";import{jsx as o}from"react/jsx-runtime";var r="__styleKind";function c(t,e){return t[r]=e,t}function i(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function u(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return s.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var s=/* @__PURE__ */new Set(["choice","select","radio"]);function l(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[r]?e[r]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:i(e.type,e.options.map(t=>t?.value))}function a(t){return null!=t&&""!==t}function p(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function f(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function d(t,e,n){const[o,...r]=e,c={...t};if(0===r.length)return void 0===n?delete c[o]:c[o]=n,c;const i=c[o],u=d(i&&"object"==typeof i?i:{},r,n);return 0===Object.keys(u).length?delete c[o]:c[o]=u,c}var y=t=>t.join("."),h="editor-shell:style-clipboard",g=null,m=!1,v=/* @__PURE__ */new Set;function S(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function b(){if(!m){m=!0;try{const t=S()?.getItem(h);t&&(g=JSON.parse(t))}catch{g=null}}}function k(t){b(),g={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(e=>{const n=p(t.props,e.path);return{path:[...e.path],kind:e.kind,counted:!1!==e.counted,value:a(n)?f(n):void 0}})};try{S()?.setItem(h,JSON.stringify(g))}catch{}return v.forEach(t=>t()),g}function N(t){return b(),g&&g.scope===t?g:null}function C(t){return v.add(t),()=>{v.delete(t)}}function j(){g=null,m=!0;try{S()?.removeItem(h)}catch{}v.forEach(t=>t())}function w(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=u(t.kind),r=u(e.kind);return!(!o||!r||o.control!==r.control)&&(!a(t.value)||r.values.includes(String(t.value)))}function O(t,e){const n=t.sourceType===e.type,o=new Map(t.rows.map(t=>[y(t.path),t]));let r=e.props,c=0,i=!1;for(const t of e.rows){const e=o.get(y(t.path));if(!e)continue;if(!w(e,t,n))continue;const u=p(r,t.path),s=void 0===e.value?void 0:f(e.value);JSON.stringify(a(u)?u:void 0)!==JSON.stringify(s)&&(r=d(r,t.path,s),i=!0),!1!==t.counted&&(c+=1)}return{props:r,pasted:c,changed:i}}function E(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var J="⌥⌘C",K="⌥⌘V";function T(r){const c=r.words??t,i=[];return r.canCopy&&i.push({label:c.copy,icon:/* @__PURE__ */o(e,{}),shortcut:"⌥⌘C",onClick:r.onCopy}),r.held&&i.push({label:c.paste({source:r.held.sourceLabel}),icon:/* @__PURE__ */o(n,{}),shortcut:"⌥⌘V",onClick:r.onPaste}),i}function x(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{J as COPY_STYLE_SHORTCUT,K as PASTE_STYLE_SHORTCUT,r as STYLE_KIND,i as choiceKind,j as clearStyle,k as copyStyle,l as fieldKind,N as heldStyle,E as pasteMessage,O as planPaste,T as styleMenuItems,x as styleShortcut,C as subscribeStyle,c as withStyleKind};
|
package/dist/chunk-VKPOH6MK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,n){const o=e.categories??{},c=e.components,i=[];for(const[s,r]of Object.entries(o))if(!1!==r?.visible)for(const o of r?.components??[]){const r=c[o];if(!r)continue;const a=r.label??o,l=n.labelAtLevel(o,"section",a);i.push({type:o,cat:s,catLabel:t(e,s,n.categoryLabel),name:l,desc:n.descriptions[o]??"",...l===a?{}:{alias:a}})}return i}function t(e,t,n){return n(t)??e.categories?.[t]?.title??t}function n(e,t){return!t||`${e.name} ${e.alias??""} ${e.desc} ${e.type} ${e.catLabel}`.toLowerCase().includes(t)}function o(e,t){return e.find(e=>e.type===t)??null}function c(e,t){return e.filter(e=>e.type!==t)}export{e as buildPaletteSections,t as categoryLabel,n as matchesQuery,c as paletteWithoutPinned,o as pinnedSection};
|
package/dist/chunk-YU3WHLGI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useState as t,useEffect as e,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(t){const e=t;if(!e||"string"!=typeof e.tagName)return!1;const n=e.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(e.type??"text").toLowerCase());if(e.isContentEditable)return!0;const r=e.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=e.closest?.('[role="textbox"]')}var i="data-easel-block";function c(t,e=i){const n=t;return n&&"function"==typeof n.closest?n.closest(`[${e}]`)?.getAttribute(e)??null:null}function u(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of Array.from(t.children)){const t=u(e);t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.left+t.width),i=Math.max(i,t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:i-o}}function s(t,e){return t===e||t.contains(e)||e.contains(t)}var l=4;function a(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function d(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},i=a(t);return{left:o.left-r.left+e.left*i,top:o.top-r.top+e.top*i,width:e.width*i,height:e.height*i}}function f(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function h(t,e,n){const o=d(t,e,n),r=f(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function m(t,e,n){const o=t.getBoundingClientRect(),r=f(t);return{x:(e-o.left)/r,y:(n-o.top)/r}}function w(t,e,n,o){const{left:r,top:i}=d(t,{left:e,top:n,width:0,height:0},o);return{x:r,y:i}}function b({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/e,n):1;return{width:e,scale:r,shownWidth:e*r}}var g="data-es-canvas-style",v=/* @__PURE__ */new WeakMap;function p(t,e){e?v.set(t,e):v.delete(t)}function y(t,e,n){const o=t.head??t.documentElement;let r=A(t,e);if(!r){r=t.createElement("style"),r.setAttribute(g,e);const n=v.get(t);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function E(t,e){A(t,e)?.remove()}function A(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}var C="[data-easel-block]",L="[data-easel-dropzone]",x="iframe#preview-frame";function M(t){const e=t.contentDocument;if(!e||!t.contentWindow||"loading"===e.readyState||!e.body)return!1;if(t.hasAttribute("srcdoc"))return"about:srcdoc"===e.URL;const n=t.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==e.URL}function S(t,e,{selector:n=x,readySelector:o}={}){let r=null,i=null,c=!1,u=!1,s=null;const l=()=>{s?.observer.disconnect(),s=null},a=()=>{if(u)return;let t=null;if(r&&M(r)){const e=r.contentDocument;(t=>{if(!o||t.querySelector(o))return l(),!0;if(s?.doc!==t){l();const e=t.defaultView?.MutationObserver;if(e){const n=new e(()=>a());n.observe(t,{childList:!0,subtree:!0}),s={doc:t,observer:n}}}return!1})(e)&&(t={frame:r,document:e,window:r.contentWindow})}else l();(t===i||!!t&&!!i&&t.frame===i.frame&&t.document===i.document)&&c||(c=!0,i=t,e(i))},d=()=>a(),f=()=>{const e=t.querySelector?.(n);e!==r?(r?.removeEventListener("load",d),r=e,r?.addEventListener("load",d),a()):a()},h=t.ownerDocument?.defaultView??t.defaultView,m=h?.MutationObserver,w=m?new m(t=>(t=>null!==r&&!r.isConnected||t.some(t=>[...t.addedNodes,...t.removedNodes].some(t=>"IFRAME"===t.nodeName||!!t.querySelector?.("iframe"))))(t)&&f()):null;return w?.observe(t,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),l(),r?.removeEventListener("load",d),r=null}}function R(n,{selector:o,readySelector:r}={}){const[i,c]=t(null);return e(()=>{const t=n.current;if(!t)return;const e=S(t,c,{selector:o,readySelector:r});return()=>{e(),c(null)}},[n,o,r]),i}var B="easel:canvas-typing",W="easel:canvas-typable";function k(t,o,r,{on:i="document",capture:c=!1}={}){const u=n(r);u.current=r;const s=t?.document??null,l=t?.window??null;e(()=>{const t="window"===i?l:s;if(!t)return;const e=t=>u.current(t);return t.addEventListener(o,e,c),()=>t.removeEventListener(o,e,c)},[s,l,o,i,c])}function q(e){const[n,o]=t(!1);return k(e,B,t=>o(Boolean(t.detail?.typing))),n}function N(t,n,o){const r=t?.document??null;e(()=>{if(!r)return;if(!o)return void E(r,n);const t=y(r,n,o),e=r.defaultView?.MutationObserver,i=e?new e(()=>{t.isConnected||y(r,n,o)}):null;return i?.observe(r.head??r.documentElement,{childList:!0}),()=>{i?.disconnect(),E(r,n)}},[r,n,o])}function T(n,{settle:o=[150,450]}={}){const[r,i]=t(0),c=n?.frame??null,u=n?.document??null,s=n?.window??null,l=o.join(",");return e(()=>{if(!c||!u||!s)return;const t=c.ownerDocument.defaultView;let e=!1,n=0;const r=()=>{if(e)return;e=!0;const o=()=>{e=!1,i(t=>t+1)};t?.requestAnimationFrame?n=t.requestAnimationFrame(o):o()},l=[],a=(t,e)=>{t.addEventListener(e,r,!0),l.push(()=>t.removeEventListener(e,r,!0))};a(u,"scroll"),a(s,"resize"),t&&(a(t,"scroll"),a(t,"resize"));const d=t?.ResizeObserver;if(d){const t=new d(r);t.observe(c),u.documentElement&&t.observe(u.documentElement),l.push(()=>t.disconnect())}const f=u.defaultView?.MutationObserver,h=u.body??u.documentElement;if(f&&h){const t=new f(r);t.observe(u===c.ownerDocument?c:h,{childList:!0,subtree:!0}),l.push(()=>t.disconnect())}const m=u.fonts;m&&a(m,"loadingdone");const w=o.map(t=>setTimeout(r,t));return r(),()=>{for(const t of l)t();for(const t of w)clearTimeout(t);n&&t?.cancelAnimationFrame&&t.cancelAnimationFrame(n)}},[c,u,s,l]),r}export{i as BLOCK_ATTRIBUTE,C as BLOCK_SELECTOR,x as CANVAS_SELECTOR,W as CANVAS_TYPABLE_EVENT,B as CANVAS_TYPING_EVENT,L as LIST_SELECTOR,l as WORDS_CLEAR,m as clientPointToLayer,u as drawnBox,f as elementScale,b as fitCanvas,w as framePointToHost,d as frameRectToHost,h as frameRectToLayer,a as frameScale,M as isFrameReady,r as isTypingTarget,c as nodeIdAt,s as related,E as removeCanvasStyle,p as setCanvasNonce,y as upsertCanvasStyle,k as useCanvasEvent,R as useCanvasFrame,T as useCanvasLayout,N as useCanvasStyle,q as useCanvasTyping,S as watchCanvasFrame};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A TEMPLATE DRAWN MANY TIMES (section parts plan §3.2, row B5, 2026-10-23).
|
|
3
|
-
*
|
|
4
|
-
* A data block (a product grid, a list of posts) holds ONE `template` slot of
|
|
5
|
-
* real blocks and draws it once per data row. So the same block ids are in the
|
|
6
|
-
* canvas several times. The host wraps each drawn copy:
|
|
7
|
-
*
|
|
8
|
-
* <div data-sf-repeat="<ownerId>:template" data-sf-repeat-index={i}>
|
|
9
|
-
*
|
|
10
|
-
* Index 0 is the MAIN copy. The blocks inside keep their real
|
|
11
|
-
* `data-easel-block` / `data-easel-dnd` ids in every copy, so a click on any
|
|
12
|
-
* copy selects the template block. What the canvas does with the copies:
|
|
13
|
-
* - the hover and the selected outline are drawn on every copy;
|
|
14
|
-
* - only the main copy's lists are drop targets (the others are pictures);
|
|
15
|
-
* - a lookup of one element by id reads the main copy.
|
|
16
|
-
*
|
|
17
|
-
* The two names are written HERE, once. The website draws the wrappers with
|
|
18
|
-
* them (it imports them from `efficient-easel/draw`, a render entry), so the
|
|
19
|
-
* string is never typed twice. Pure DOM, no import, nothing run at import.
|
|
20
|
-
*
|
|
21
|
-
* A page with no `data-sf-repeat` gets the same answers as before: every
|
|
22
|
-
* helper below falls back to the first match.
|
|
23
|
-
*/
|
|
24
|
-
/** The wrapper round one drawn copy of a template: `"<ownerId>:<slot>"`. */
|
|
25
|
-
declare const REPEAT_ATTRIBUTE = "data-sf-repeat";
|
|
26
|
-
/** Which copy the wrapper holds: `"0"` is the main copy. */
|
|
27
|
-
declare const REPEAT_INDEX_ATTRIBUTE = "data-sf-repeat-index";
|
|
28
|
-
/**
|
|
29
|
-
* Is `el` in a copy that is NOT the main one — inside (or itself) a wrapper
|
|
30
|
-
* whose index is not 0, at any depth (a template inside a copy of an outer
|
|
31
|
-
* template is a copy too)? False for a block in no wrapper at all.
|
|
32
|
-
*/
|
|
33
|
-
declare function isRepeatCopy(el: Element): boolean;
|
|
34
|
-
/** The main copy among `matches`: the first that is not a copy, else the first. */
|
|
35
|
-
declare function mainCopyOf<T extends Element>(matches: Iterable<T>): T | null;
|
|
36
|
-
/**
|
|
37
|
-
* `root.querySelector(selector)`, but the main copy when a template is drawn
|
|
38
|
-
* many times. With no `data-sf-repeat` it is exactly `querySelector`.
|
|
39
|
-
*/
|
|
40
|
-
declare function queryMainCopy<T extends Element = Element>(root: ParentNode, selector: string): T | null;
|
|
41
|
-
/**
|
|
42
|
-
* The element for `selector` in every drawn copy: the main copy first, then
|
|
43
|
-
* each other copy in page order. With no `data-sf-repeat` it is the first
|
|
44
|
-
* match alone, as `querySelector` answers — a second element with the same id
|
|
45
|
-
* that is not a drawn copy is never added.
|
|
46
|
-
*/
|
|
47
|
-
declare function queryAllCopies<T extends Element = Element>(root: ParentNode, selector: string): T[];
|
|
48
|
-
|
|
49
|
-
export { REPEAT_ATTRIBUTE as R, REPEAT_INDEX_ATTRIBUTE as a, queryMainCopy as b, isRepeatCopy as i, mainCopyOf as m, queryAllCopies as q };
|