efficient-easel 26.12.0 → 26.14.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 +12 -0
- package/dist/{canvas-typing-DOBx8dD3.d.ts → canvas-typing--FlIZwbT.d.ts} +15 -1
- package/dist/chunk-3BQT7FC7.js +7 -0
- package/dist/{chunk-QVQ7764L.js → chunk-3YHGKDBV.js} +4 -4
- package/dist/{chunk-IVSPOIOU.js → chunk-3ZGOVNVH.js} +1 -1
- package/dist/chunk-5OYP3C2K.js +1 -0
- package/dist/{chunk-KWGABNNM.js → chunk-7U4HEUZM.js} +1 -1
- package/dist/{chunk-7GGNFLHT.js → chunk-BLE3U2GS.js} +1 -1
- package/dist/{chunk-Q3VAJMXS.js → chunk-C4TJN6GR.js} +1 -1
- package/dist/{chunk-BYONFJVQ.js → chunk-CPIWSFGR.js} +2 -2
- package/dist/{chunk-STQDOTHF.js → chunk-H4TUOPI7.js} +1 -1
- package/dist/chunk-K6TDOXHR.js +17 -0
- package/dist/chunk-L4DFCNDQ.js +5 -0
- package/dist/{chunk-I7NHUVP6.js → chunk-M4SOZEZR.js} +4 -4
- package/dist/{chunk-TOEJCZUO.js → chunk-MGEXTIZH.js} +1 -1
- package/dist/chunk-NUJEHA6A.js +19 -0
- package/dist/{chunk-CVS3RPO6.js → chunk-PG7G7ELT.js} +1 -1
- package/dist/chunk-RWGOCHH7.js +1 -0
- package/dist/{chunk-JYVQ62TL.js → chunk-U4TG43PD.js} +1 -1
- package/dist/chunk-VVHDUTAE.js +8 -0
- package/dist/chunk-Y2OWVL6W.js +64 -0
- package/dist/{chunk-P4XLNW3E.js → chunk-YMK3MZJK.js} +1 -1
- package/dist/copy/index.d.ts +2 -2
- package/dist/copy/index.js +29 -29
- package/dist/easel/index.d.ts +46 -8
- package/dist/easel/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +13 -6
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.d.ts +1 -2
- package/dist/screen/lib/document/image-fields.js +4 -4
- package/dist/screen/lib/document/shadow-fields.js +1 -1
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/words.d.ts +2 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4SYDN43N.js +0 -1
- package/dist/chunk-CQVSWONH.js +0 -1
- package/dist/chunk-EVYIDHCK.js +0 -19
- package/dist/chunk-HZSZT3BE.js +0 -7
- package/dist/chunk-UMRYCN7L.js +0 -16
- package/dist/chunk-UR7YBZJR.js +0 -5
- package/dist/chunk-W2UMJ7WO.js +0 -8
- package/dist/chunk-YQXHRQXH.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-LX23TCTP.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-LX23TCTP.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-NUJEHA6A.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{styleFieldBuilders as e,keptByRow as s}from"./chunk-M4SOZEZR.js";import{boxFieldBuilders as o,PHONE_KEY_ACCESS as l,phoneTwinFields as r,section as i}from"./chunk-K6TDOXHR.js";import{deviceField as t}from"./chunk-BLE3U2GS.js";import{BUTTON_STYLE_KEYS as c,BUTTON_PAD_KEYS as n}from"./chunk-PLTTPHK5.js";import{TextColorIcon as u,GroundIcon as d}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";function a(a){const p=o(a.say),y=e(a.say),m=c,F=a.style,k=a.phone??l;return{...a.padding&&{_dSize:i("Size"),...p.sidesPaddingFields({keys:n,group:!1,...a.padding})},_dDesign:i("Design"),[m.fill]:y.colourField({key:m.fill,access:F,label:"Fill color",icon:/* @__PURE__ */f(d,{}),useFollows:a.follows.useFill,usePresets:a.usePresets,resetTo:a.resetTo,opacity:{key:m.fillOpacity,useUnset:a.follows.useFillOpacity}}),[m.fillOpacity]:s(m.fill),[m.border]:y.borderField({key:m.border,access:F,useFollows:a.follows.useBorder}),[m.text]:y.colourField({key:m.text,access:F,label:"Text color",icon:/* @__PURE__ */f(u,{}),useFollows:a.follows.useText,usePresets:a.usePresets,resetTo:a.resetTo}),[m.corners]:y.cornersField({key:m.corners,access:F,sidesKey:m.cornerSides,useFollows:a.follows.useCorners,useFollowsSides:a.follows.useCornerSides}),[m.cornerSides]:s(m.corners),_dLayout:i("Layout"),...r("align",p.blockAlignmentField({phone:!0},""),k),align:t("desktop",p.blockAlignmentField())}}export{a as buttonFieldSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{DESIGN_GROUP_KEY as o,BUCKET_KEY as n}from"./chunk-3QB2ZQXK.js";import{withoutDeviceGate as e}from"./chunk-
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{DESIGN_GROUP_KEY as o,BUCKET_KEY as n}from"./chunk-3QB2ZQXK.js";import{withoutDeviceGate as e}from"./chunk-BLE3U2GS.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as c,heldStyle as i,planPaste as p,pasteMessage as u}from"./chunk-CWELHADJ.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as a,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([o.Size,o.Design,o.Layout,o.Position]),w=new Set(Object.values(o)),S=new Set(Object.values(n)),b=new Set(f),k=/* @__PURE__ */new Set(["focal","imageFocal"]),g=[l,m,h];function v(t){return`site:${t??""}`}function A(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,c=o[r]??n[r];if("string"==typeof c)return c;const i=o.options??n.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function L(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function O(o,e){const r=t(o,e)??{},s=[];let c=!0,i=!1;for(const[t,o]of Object.entries(r))S.has(t)?(c=t===n.Design,i=!1):w.has(t)?c&&(i=j.has(t)):i&&o&&"object"==typeof o&&!t.startsWith("_")&&(a(o)||b.has(t)||k.has(t)||L(o)||"slot"!==o.type&&s.push({path:[t],kind:A(o),counted:"mobile"!==y(o)?.tier}));return s}function d(t,o,n,e,r){c({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function D(t,o,n,e,r,s){const c=i(n);if(!c)return null;const f=p(c,{type:e.type,rows:t(o,e),props:e.props});return{...f,message:u(f,c.sourceLabel,r,s)}}function E(t,o,n,e){d(O,t,o,n,e)}function P(t,o,n,e,r){return D(O,t,o,n,e,r)}var X={scope:t=>v(t.siteId),rows:(t,o)=>O(t,o),copy:(t,o,n,e)=>E(e,t,o,n),plan:(t,o,n,e)=>P(e,t,o,n)};function B(t,o){if(!t&&!o)return X;const n=t?.rows,e=n?(t,o)=>n(t,o):O;return{scope:t?.scope??X.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>d(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>D(e,s,t,n,r,o))}}export{E as copyNodeStyle,O as nodeStyleRows,P as planNodePaste,A as shopFieldKind,v as siteStyleScope,B as styleClipboardOf};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SBVIW3KJ.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-L4DFCNDQ.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-C4TJN6GR.js";import{useEasel as u}from"./chunk-NUJEHA6A.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as O,Dialog as $,Button as F}from"efficient-shell/ui";import{jsx as T,jsxs as x,Fragment as D}from"react/jsx-runtime";function G({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
+
return T($,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(D,{children:[
|
|
3
|
+
/* @__PURE__ */T(F,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
+
/* @__PURE__ */T(F,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var N=e=>`section:${e}`,Q=e=>`block:${e}`,S=e=>`template:${e}`,A=e=>`shared:${e}`,H=e=>`preset:${e}`;function J({at:C,placeBlocks:$,canTake:F,onPick:J,itemFor:M,session:W,siteWide:B,onClose:L,onHide:U,readOnly:z}){const R=u(e=>e.config),V=a(),{labelAtLevel:Y,categoryLabel:P,firstSection:X,Icon:_,Thumbnail:K}=V,{blockIsOffered:Z,canAddTo:q}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>Z(e,ne);return r(ne).list().then(n=>{if(e)return;const r=R.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>Z(e,ne);return l(ne).list().then(n=>{if(e)return;const r=R.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(R,V),[R]),he=e=>Y(e,"section",R.components[e]?.label??e),ke=e=>({type:e.preset?H(e.preset.key):N(e.type),label:e.name,cover:/* @__PURE__ */T(K,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */T("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */T(_,{type:e,size:26})}),ve=j(()=>{const e=t(ye,X),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!Z(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=q(t.type)?.choices??[];e.forEach(r),e.forEach(e=>q(e.type,1)?.choices?.forEach(r))}$?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:Q(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:A(e.id),label:e.title,cover:/* @__PURE__ */T(K,{type:e.node.type}),mark:/* @__PURE__ */T(w,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */T(K,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(R,t,P),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!F)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?F(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[oe,se,ie,ye,R,ee,F,$,ne]);/* @__PURE__ */
|
|
5
|
+
return x(D,{children:[
|
|
6
|
+
/* @__PURE__ */T(i,{icon:/* @__PURE__ */T(E,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */T(s,{label:ee.done,description:ee.doneDescription,onClick:L}),onHide:U}),
|
|
7
|
+
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */T(k,{groups:ve,session:W,itemFor:e=>M(ge(e)??{kind:"section",type:e}),onInsert:J?e=>{const t=ge(e);t&&J(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!z&&(me({section:n.section,...t}),!0)},at:C,hint:ee.hint,searchLabel:ee.search,readOnly:z,words:te}),B??null]}),de?/* @__PURE__ */T(I,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */T(G,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void O.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{J as AddSidePanel,Q as blockKey,H as presetKey,N as sectionKey,A as sharedKey,S as templateKey};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-U4TG43PD.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-PG7G7ELT.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-5OYP3C2K.js";import{useSectionOps as y}from"./chunk-3ZGOVNVH.js";import{PageEditGuardNotices as v}from"./chunk-MGEXTIZH.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-CPIWSFGR.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-VVHDUTAE.js";import{keepsSharedSections as N,sharedSectionsOf as O}from"./chunk-N3MJOHAG.js";import{PanelHideButton as I,SidePanelHead as B,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as T}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as $,useScreenNodeKeys as j,useScreenPinned as M,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as D,useScreenLeftView as F,SELECTION_MODE as V,isSelectionMode as H,sameInspectorMode as W,useScreenBridges as U,useScreenBlockRules as J,useScreenBlockLook as Y,useScreenStorageNamespace as G,useScreenNotify as X,useScreenCanvasHead as K,isSlotMode as Q,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-L4DFCNDQ.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-H4TUOPI7.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-C4TJN6GR.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-CWELHADJ.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 Te,slotChildrenIn as $e,nestsInTree as je}from"./chunk-TCAAOYQY.js";import{useEasel as Me,useEaselApi as Ee,useSettledAction as Le,subscribeLateWrites as Ae,CanvasPartsContext as Re,partHasOwnBox as De,CanvasPassThroughContext as Fe,CanvasSharedContext as Ve}from"./chunk-NUJEHA6A.js";import{TreeRow as He,Subtree as We,LayersTree as Ue,TreeGroupLabel as Je,TreeRowAction as Ye,TreeSeam as Ge}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Xe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ke}from"./chunk-WK3AFPXY.js";import{toItemSelector as Qe,useNodeOps as Ze,clickPick as _e}from"./chunk-QTHQPJWA.js";import{EaselTopBar as qe,EaselIconButton as en,TopBarCluster as nn,DeviceSwitch as tn,InspectorIconButton as on,PanelResizeHandle as rn,MAX_PANEL_W as ln,MIN_PANEL_W_BY_SIDE as sn,panelWidthVars as dn}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as an,DEFAULT_CHROME_WORDS as cn}from"./chunk-AJSDWWJW.js";import{holderOf as pn,nameOrSomeone as un}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as fn}from"./chunk-RE4LP46F.js";import{useWords as hn}from"./chunk-MFIRYGHW.js";import{insertSeams as mn,CanvasDragLayer as gn,CanvasInsert as yn}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as vn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as bn,useTreeDrag as kn,gapToMoveIndex as Sn}from"./chunk-3XECMGXX.js";import{useCanvasFrame as wn,LIST_SELECTOR as xn,BLOCK_SELECTOR as zn,useCanvasTyping as Cn,useCanvasEvent as Nn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as On,frameRectToHost as In,BLOCK_ATTRIBUTE as Bn,drawnBox as Pn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as Tn}from"./chunk-7UFKEX72.js";import{ROOT_ID as $n,ROOT_SLOT as jn,zoneKey as Mn,parseZoneKey as En,find as Ln,DataError as An}from"./chunk-EUFDQ4KL.js";import{useRef as Rn,useMemo as Dn,useState as Fn,useEffect as Vn,useCallback as Hn,useLayoutEffect as Wn,useContext as Un,Fragment as Jn,useId as Yn}from"react";import{ColoredBadge as Gn,Button as Xn,Tabs as Kn,toast as Qn,readMediaFileDrag as Zn,Tooltip as _n,groupColors as qn,Dialog as et,FormField as nt,Input as tt,MEDIA_FILE_DRAG_TYPE as ot}from"efficient-shell/ui";import{UndoIcon as rt,RedoIcon as it,RefreshIcon as lt,AddIcon as st,TrashIcon as dt,EyeOffIcon as at,EyeIcon as ct,SharedIcon as pt,DuplicateIcon as ut}from"efficient-shell/icons/efficient";import{jsx as ft,jsxs as ht,Fragment as mt}from"react/jsx-runtime";var gt="media-file";function yt({name:e,onMake:n,onCancel:t}){const o=hn("screen",ve).shared,[r,i]=Fn(e),[l,s]=Fn(!1),d=Yn(),a=Rn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return ft(et,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ht(mt,{children:[
|
|
3
|
+
/* @__PURE__ */ft(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */ft(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ft("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ft(nt,{label:o.name,htmlFor:d,children:/* @__PURE__ */ft(tt,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var vt=/* @__PURE__ */new WeakSet;function bt(e,n,t){const o=Ln(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function kt({canvas:e,tabs:n,onSelect:t}){const o=Rn(null),[r,i]=Fn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2: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=In(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Tn(t,`[${Bn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Pn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=In(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=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above: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__ */ft("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */ft("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */ft(_n,{content:e.reach,children:/* @__PURE__ */ht(Gn,{colorClass:qn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */ft("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ft(pt,{size:12})}),e.label]})}):/* @__PURE__ */ft(Gn,{colorClass:qn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function St({expand:e}){/* @__PURE__ */
|
|
7
|
+
return ft("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ht(mt,e?{children:[
|
|
8
|
+
/* @__PURE__ */ft("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */ft("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */ft("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */ft("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */ft("path",{d:"M5 12h14"})]})})}var wt=`${xn}, ${zn}`;function xt(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 zt="__rungs",Ct=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var Nt="screen:band",Ot={duplicate:!0,delete:!0},It=()=>null;function Bt(){const xn=he(),In=xn.panels?.Toolbar,Bn=(xn.panels?.useRight??It)(),{target:Pn,docId:Yn,capabilities:_n,currentSlug:qn,siteId:et,onPublish:nt,saveState:tt,saveConflict:pt,retrySave:Bt,toggleAutoSave:Pt,flushSave:Tt,access:$t,saveUnreachable:jt=!1,readOnly:Mt,readOnlyReason:Et=null}=w(),Lt=$(),At=j(),{mediaEditing:Rt,hasEditGuard:Dt,hasPinnedChrome:Ft}=_n,{appState:Vt,dispatch:Ht,history:Wt,selectedItem:Ut,getSelectorForId:Jt,config:Yt}=Me(e=>e),Gt=M(),{first:Xt,firstGroup:Kt,lastGroup:Qt,isSectionGroup:Zt,sectionGroupZone:_t,panelOf:qt}=Gt,eo=qt(Xt),no=e=>ne(Gt,e),to=e=>te(Gt,e),oo="node"===Gt.firstRow,ro=Gt.band??null,io=hn("screen",ve),lo=hn("tree",Xe),so=hn("drag",vn),ao=hn("notice",an),co=hn("lock",fn),po=hn("menu",Ke),uo=hn("styleClipboard",Se),fo=hn("chrome",cn),ho=E()??`/${qn}`,mo=L(),go=A(),yo=y({readOnly:Mt}),vo=y({readOnly:Mt,foldIntoHistory:!0}),bo=Rn(null),ko=Ee(),So=Dn(()=>({...yo,select:e=>{bo.current=e,yo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ko.config;bo.current=Qe(e,t,n)}yo.commitDocument(e,n)}}),[yo,ko]),wo=Vt.ui,xo=wo.leftSideBarVisible,zo=wo.rightSideBarVisible,{options:Co,widths:No,initial:Oo,fluid:Io,fit:Bo}=R(),[Po,To]=Fn(Oo),$o=le(),jo=Rt&&null!==$o;se(),de();const Mo=ae();D(Ut?.props.id);const{read:Eo,write:Lo,forSelection:Ao}=F(),[Ro,Do]=Fn(Eo);Vn(()=>{Lo(Ro)},[Ro]);const[Fo,Vo]=Fn(0),Ho=Rn(null),Wo=Rn(null),Uo=wn(Wo,{readySelector:wt}),Jo=Cn(Uo),Yo=d(Wo);a(Wo,Uo);const Go=S(),Xo=pn($t),Ko={state:tt,offline:Go||tt.failed&&jt,readOnlyReason:Et,editing:Xo?ao.editing({name:un(Xo.name,co),noun:io.noun}):null,conflict:null!=pt,notSaving:io.bar.notSaving},Qo=Le({onPress:()=>{Mt||(tt.failed?Bt():Tt())}}).onPress;c(Wo,Uo,Qo);const[Zo,_o]=Fn(!1),qo=Rn(!1),[er,nr]=Fn(null),[tr,or]=Fn([]),[rr,ir]=Fn(V);H(rr);const lr=e(rr,Ut?.props.id),[sr,dr]=Fn(null);Vn(()=>{sr&&(n(),dr(null))},[sr]);const ar=Rn(Jt);ar.current=Jt;const cr=Hn((e,{scroll:n})=>{Do(n=>Ao(e,n)),n&&dr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ar.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Fr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),pr=Rn(null);Vn(()=>{const e=pr.current;pr.current=null;const n=null==Ut?.props.id?null:String(Ut.props.id);ir(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:qt(Ut?.type)??V);const o=Ut?.props.id,r=bo.current;if(bo.current=null,!o)return;const i=Jt(o);cr(String(o),{scroll:!t(r,i??null,Ne)})},[Ut?.props.id,cr]);const ur=Hn(e=>{ir(n=>W(n,e)?n:e),Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ht]),fr=Rn(()=>{});fr.current=(e,n)=>{const t=e?Ai(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ut?.props.id?null:String(Ut.props.id);ir(e=>W(e,n)?e:n),o!==r&&(pr.current={id:o,mode:n},So.select(e))};const hr=Hn((e,n)=>fr.current(e,n),[]),mr={kind:rr.kind,mode:rr,open:ur,show:e=>ir(e),reveal:()=>{zo||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},select:hr},gr=U(mr,{data:Vt.data,selected:Ut??null,zoneOf:e=>Jt(e)?.zone,readOnly:Boolean(Mt),select:e=>{ir(V),So.select({index:e})},replace:(e,n)=>So.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:Po,refreshes:Fo},{setView:Do,reveal:()=>{xo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}})}}),yr=gr.resolveLeftView?gr.resolveLeftView(Ro):"sections",vr=J(),{isLockedBlock:br,duplicateBlocked:kr,nestDepth:Sr,newSectionNode:wr,canAddTo:xr,blockIsOffered:zr}=vr,Cr=e=>({id:String(e.props.id??""),data:Vt?.data}),Nr=Y(),{labelAtLevel:Or,Icon:Ir,useProducts:Br}=Nr,Pr=Nr.rowName?(e,n,t)=>Nr.rowName(e,n,t):void 0,Tr=Hn(e=>{Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),cr(e,{scroll:!0})},[Ht,cr]),{selectNode:$r,openPartId:jr}=g({mode:rr,setMode:ir,onOpenPart:Tr}),[Mr,Er]=Fn(null);me(null!==Mr,()=>Er(null));const Lr=f(G()),Ar=Lr.collapsed,Rr=Lr.panelWidths,[Dr,Fr]=Fn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ar);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Vn(()=>{try{window.localStorage.setItem(Ar,JSON.stringify([...Dr]))}catch{}},[Dr]);const[Vr,Hr]=Fn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Rr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Vn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Rr,JSON.stringify(Vr))}catch{}},300);return()=>clearTimeout(e)},[Vr]);const Wr=Hn((e,n)=>Hr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ur=Hn(e=>Wr("left",e),[Wr]),Jr=Hn(e=>Wr("right",e),[Wr]),Yr=e=>Dr.has(e),Gr=e=>Fr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Xr=Rn(!1),Kr=Rn(null);Vn(()=>{if(Xr.current&&!Zo){const e=Kr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Wo.current?.querySelector(`button[aria-label="${CSS.escape(io.add.title)}"]`))?.focus(),Kr.current=null}Xr.current=Zo},[Zo]),Vn(()=>{if(!Zo||!Yo)return;const e=e=>{"Escape"===e.key&&gl()};return Yo.addEventListener("keydown",e),()=>Yo.removeEventListener("keydown",e)},[Zo,Yo]),me(Zo,()=>gl()),Vn(()=>{!xo&&Zo&&(_o(!1),nr(null),qo.current=!1)},[xo]);const Qr=X(),Zr=(e,n="success",t)=>{if(Qr)return void(t?Qr(e,"error"===n?"error":"info",t):Qr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Qn.error(e,{...o,duration:t?.duration??3200}):Qn.success(e,{...o,duration:t?.duration??1900})},_r=Le(gr.mainAction??{label:io.done,onPress:()=>{nt(ko.getState().appState.data)}}),qr=Rn(Zr);qr.current=Zr,Vn(()=>Ae(ko,()=>qr.current(io.writeLate,"error")),[ko,io]);const ei=Rn(null),[ni,ti]=Fn(0),[oi,ri]=Fn(0),ii=K(),li=Rn(null),si=e=>Math.max(0,e.clientHeight-(li.current?.offsetHeight??0));Vn(()=>{const e=ei.current;if(!e)return;const n=()=>{ti(e.clientWidth),ri(si(e))};n();const t=new ResizeObserver(n);return t.observe(e),li.current&&t.observe(li.current),()=>t.disconnect()},[]),Wn(()=>{ei.current&&(ti(ei.current.clientWidth),ri(si(ei.current)))},[Vr,xo,zo]);const di=Po===Io?ni>0?ni:No[Io]:No[Po],ai=ni>0?Math.min(ni/di,"shrink"===Bo?1:2):1,ci=di*ai,pi=ni>0&&ci>ni+1,ui={width:ci,height:oi||"100%",flex:"none",position:"relative"},fi={width:di,height:oi?oi/ai:"100%",maxHeight:"none",transform:1!==ai?`scale(${ai})`:void 0,transformOrigin:"top left"},hi=()=>Ht({type:"setUi",ui:{leftSideBarVisible:!xo}}),mi=()=>Ht({type:"setUi",ui:{rightSideBarVisible:!zo}}),gi=e=>{Zo&&(_o(!1),nr(null),qo.current=!1,xo&&Ro===e)||(Do(e),xo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},yi=()=>{ir(eo??V),zo||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},vi=Vt.data.content??[],bi=()=>{const e=vi.findIndex(no),n=vi.findIndex(to);return{floor:e>=0?e+1:0,cap:n>=0?n:vi.length}},ki=Yt,Si=vr.stripCopy,wi=e=>o(e,Si),xi=pe(),zi=Ze({data:Vt.data,config:ki,readOnly:Boolean(Mt),clipboard:xi,strip:Si?e=>Si(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==$n||e.slot!==jn)return{min:0,max:n-1};const{floor:t,cap:o}=bi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&ir(V);const t=void 0===n||"node"===n?.kind?n:null;So.commitDocument(e,t)}}),Ci=fe(),[Ni,Oi]=Fn(null),Ii=e=>{const n=vi.find(n=>String(n.props.id)===e),t=Gt.shared;n&&t&&zi.swap(e,t.detach(n))},Bi=e=>{const n=Ln(Vt.data,Yt,e);if(!n)return!1;const t=Mn(n.place),o=n.node,r=t===Ne?Mi(o):Ki(o),i=t===Ne?Gt.shared?.usedOn(o):null;return!!zi.remove(e)&&(Zr(i?io.shared.removed({count:Math.max(0,i.length-1)}):io.deleted({name:r}),"success",{duration:8e3,action:{label:io.bar.undo,onClick:()=>{zi.restore(n.node,n.place)}}}),!0)},Pi={...zi,remove:Bi},Ti=e=>Or(e,"block",Yt.components[e]?.label??e),$i=Hn(e=>Yt.components[e]?.defaultProps??{},[Yt]),ji=e=>Or(e,"section",Ti(e)),Mi=e=>we({type:e.type,props:e.props??{}},ji(e.type),Pr),{nodeAddresses:Ei,zoneItems:Li}=Dn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Yt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vi,Ne,0),{nodeAddresses:e,zoneItems:n}},[vi,Yt]),Ai=Hn(e=>Li.get(e)??[],[Li]),Ri=e=>{const n=Ei.get(e);return n?Ai(n.zone)[n.index]:void 0},Di=e=>oe(vr,Yt,e),Fi=e=>{if(!vr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ri(e.slice(0,n));if(!t)return null;const o=Di(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Vi=(()=>{if(!Q(rr))return null;const e=`${rr.nodeId}:${rr.slot}`;return Fi(e)?.slot.panel===rr.kind?e:null})(),Hi=Rn(null);Vn(()=>{const e=Hi.current;if(Hi.current=null,!Vi||!Q(rr))return;const n=rr.nodeId;cr(n,{scroll:e!==Vi}),Fr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[rr]);const Wi=e=>{const n=Ei.get(e);n&&(n.zone===Ne?al(n.index):Ll(n.zone,n.index,e,Ri(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ui=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Wi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Vi!==i&&(Hi.current=i),hr(null,r),zo||Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ji=(e,n,t)=>{const o=`${e}:${n}`;if(Fr(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;Vi!==o&&(Hi.current=o);hr(null,{kind:t,nodeId:e,slot:n})},Yi=(e,n,t)=>{if(Mt||!vr.moveSlot)return;const o=Ri(e),r=o?Di(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:zt,index:n},s=Sn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vr.moveSlot(e,n,s);"string"==typeof d&&Ji(e,d,i.panel)},Gi=Br(),Xi=Dn(()=>{const e=/* @__PURE__ */new Map;for(const n of Gi??[])e.set(n.slug,n.name);return e},[Gi]),Ki=e=>xe(e,Ti,Nr.plainText,e=>Xi.get(e),Nr.rowName),Qi=(e,n)=>{const t=Yt.components[e.type]?.fields,o=n===Ne||ds(n)?"section":"block",r=n===Ne&&(no(e)||to(e)||Zt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return Nr.renamePropOf?Nr.renamePropOf(e,o,i):i},Zi=(e,n,t,o)=>{if(!(!Mt&&Mr?.zone===e&&Mr.index===n))return;const r=(t,o)=>{Er(null),o&&((e,n,t)=>{const o=Ai(e)[n];if(!o)return;const r=Qi(o,e);r&&So.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return ft("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":io.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)},_i=i(Z(),uo),qi=_i.scope({target:Pn,siteId:et,docId:Yn}),el=Yt,nl=(e,n)=>n===Ne?ji(e):Ti(e),tl=(e,n,t)=>{const o=_i.plan(qi,t,nl(t.type,e),el);o&&(o.changed&&So.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Zr(o.message))},ol=ue({nodesIn:Ai,nodeAt:(e,n)=>Ai(e)[n]??null,labelOf:(e,n)=>n===Ne?ji(e):Ti(e),renamePropOf:Qi,beginRename:(e,n)=>Er({zone:e,index:n}),history:{hasPast:Wt.hasPast,hasFuture:Wt.hasFuture,back:()=>Wt.back(),forward:()=>Wt.forward()},openPageStyles:gr.openPageStyles,pageStylesLabel:io.pageStyles,words:{menu:po,styleClipboard:uo,screen:io.menu},readOnly:Boolean(Mt),collapseAll:()=>Fr(new Set(Ai(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Zr(e?io.pasteRefused({name:e.label}):io.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ps(e,n),copyItem:gr.onCopyItem,menuRows:(e,n,t)=>{const o=gr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Gt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:io.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Mt||br(e.type,e)?n:{...n,change:[{label:io.shared.detach,onClick:()=>Ii(e.props.id)}],remove:[{label:io.shared.removeFromPage,danger:!0,onClick:()=>{Bi(e.props.id)}}]}}return Mt||no(e)||to(e)||Zt(e.type)?null:N(Ci)?{change:[{label:io.shared.makeShared,onClick:()=>Oi({id:e.props.id,name:Mi(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=>br(e.type,e),duplicateBlocked:e=>kr(Vt.data,e),permits:e=>{const n=Oe(Yt,e.type);return Gt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Pi,isPinned:(e,n)=>n===Ne&&(no(e)||to(e)),sectionBand:bi,locate:e=>Ei.get(e)??null,rowNameOf:(e,n)=>n===Ne?Mi(e):Ki(e),selectAt:(e,n,t,o)=>{e===Ne?al(n):Ll(e,n,t,o??"")},slotRung:e=>{const n=Fi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ui(n.node,n.slot,!1)}:null},style:{held:()=>be(qi),canCopy:e=>_i.rows(el,e).some(e=>!1!==e.counted),copy:(e,n)=>_i.copy(qi,e,nl(e.type,n),el),paste:(e,n,t)=>tl(e,n,t)},keys:At?{target:Yo,selected:()=>{const e=Vt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>xi.get(),readOnly:Boolean(Mt),onDone:({done:e,name:n})=>{"copied"===e&&Zr(io.copied({name:n}))}}:void 0},Uo),rl=Rn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Vn(()=>{rl.current={copy:(e,n)=>_i.copy(qi,e,nl(e.type,n),el),paste:tl,at:()=>{const e=Vt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=Ai(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Mt)}});const il=Hn(e=>{const n=ke(e);if(!n)return;const t=rl.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))},[]);Vn(()=>{if(!Yo)return;const e=e=>il(e);return Yo.addEventListener("keydown",e),()=>Yo.removeEventListener("keydown",e)},[il,Yo]),Nn(Uo,"keydown",il);const ll=vi.map(e=>e.props.id).join("|");Vn(()=>{const e=Uo?.document??null,n=Uo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void or(e=>e.length?[]:e);const n=vi.findIndex(to),t=n>=0?n:vi.length,o=n=>{const t=vi[n]?.props?.id;return null==t?null:Tn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(zn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=vi.length>0&&!no(vi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=xt(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})}or(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()}},[Uo,ll,Po,ai,xo,zo,Ut?.props.id]);const sl=Uo?.document??null,dl=Uo?.window??null;Vn(()=>{const e=Ho.current;if(!e||!sl||!dl)return;const n=[],t=()=>{const n=Tn(sl,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&dl.scrollTo({left:dl.scrollX,top:dl.scrollY+t,behavior:"instant"}),!0};return Ho.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[sl,dl]);const al=e=>{ir(V),So.select({index:e}),gr.sectionPressed?.(vi[e]);const n=vi[e]?.props?.id;n&&l(n)},cl=e=>{const{floor:n,cap:t}=bi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ut&&rr.kind!==eo?.kind?vi.findIndex(e=>e.props.id===Ut.props.id):-1;return o(r>=0?r+1:t)},pl=(e,n)=>{const{floor:t,cap:o}=bi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(So.reorderComponent(Ne,e,i),So.select({index:i}),{moved:!0,dest:i})},ul=(e,n,t,o)=>{ir(V),So.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Zr(io.sectionAdded({name:t}))},fl=(e,n)=>{const t=cl(n),o=wr(e,{nodeDefaults:$i,newNodeId:Te,sectionLabel:ji,blockIsOffered:zr}),r=o?So.insertNode(Ne,t,o):So.insertSection(e,t);return ul(t,r,ji(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(Yt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=xr(e.type,l,d.slice(d.lastIndexOf(":")+1),Cr(e)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},hl=e=>ml(Ne,e),ml=(e,n)=>{Kr.current=document.activeElement??null,nr(null===n?null:{zone:e,index:n}),_o(!0),xo||(qo.current=!0,Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},gl=()=>{_o(!1),nr(null),qo.current&&Ht({type:"setUi",ui:{leftSideBarVisible:!1}}),qo.current=!1},yl=(e,n)=>Nr.rowName?n?no(e)?Nr.rowName(e,"section",io.header):to(e)?Nr.rowName(e,"section",io.footer):Zt(e.type)?Nr.rowName(e,"section",Ti(e.type)):Mi(e):Ki(e):n?ji(e.type):Ti(e.type),vl=e=>n=>{e()},bl=(e,n,t)=>{if(Mt)return null;const o=Ai(e)[n];return o&&!Oe(Yt,o.type).delete||o&&br(o.type,o)?null:/* @__PURE__ */ft(Ye,{kind:"delete",label:e===Ne&&o&&Gt.shared?.usedOn(o)?io.shared.removeFromPage:io.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ai(e)[n]?.props?.id;null!=t&&Bi(String(t))})(e,n),children:/* @__PURE__ */ft(dt,{size:15})})},kl=e=>Nr.rowPreview?.(e)||void 0,Sl=e=>Nr.rowMarks?.(e)??void 0,wl=(e,n,t)=>Nr.rowActions?.(e,n,t)??null,xl=(e,n,t,o)=>{if(Mt)return null;if(br(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return ft(Ye,{kind:"eye",label:r?io.showNamed({name:o}):io.hideNamed({name:o}),onClick:()=>Cl(e,n,t),children:/* @__PURE__ */ft(r?at:ct,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},zl=e=>id(Ne,e),Cl=(e,n,t)=>{So.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Nl=e=>Pe(Yt,e),Ol=e=>Be(Yt,e),Il=e=>vr.slotsOf?Di(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:$e(e,n.slot)})):[{slot:null,rung:null,kids:re(Yt,e)}],Bl=e=>vr.slotsOf?Il(e).flatMap(e=>e.kids):re(Yt,e),Pl=e=>Boolean(vr.slotsOf)&&Di(e).some(e=>e.rung),Tl=(e,n,t)=>xr(e.type,n,t??void 0,Cr(e)),$l=(e,n,t)=>{const o=je(Yt,e.type,n)&&(t||Bl(e).length>0||Pl(e));return{collapsible:o,folded:o&&Yr(String(e.props.id))}},jl=(e,n,t)=>Il(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>$l(e,r,t(e.type)).collapsible?[String(e.props.id),...jl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ml=e=>Bl(e).length>0||Pl(e)||Boolean(xr(e.type)),El=e=>Boolean(xr(e)),Ll=(e,n,t,o)=>{if(ir(V),xr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),So.select({index:n,zone:e}),l(t)}else So.select({index:n,zone:e}),l(t)},Al=(e,n,t,o,r)=>{const i=`${e}:${n}`;So.insertComponent(i,t,o),xr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),So.select({index:o,zone:i})}):So.select({index:o,zone:i})},Rl=Rn(/* @__PURE__ */new Set);Vn(()=>{vi.forEach(e=>{const n=xr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Rl.current.has(t))return;Rl.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($i)).forEach((e,t)=>vo.seedChild(o,t,n.childType,e))})},[vi,vo,$i]);const Dl=Rn(/* @__PURE__ */new Set);Vn(()=>{vi.forEach((e,n)=>{const t=e.props.id;if(Dl.current.has(t))return;const o=r(e,Nl(e.type));Dl.current.add(t),o&&vo.replaceComponent(Ne,n,{...e,props:o})})},[vi,vo]),_(vo,Yt);const Fl=vi.findIndex(to),Vl=Fl>=0?vi[Fl]:null,Hl=oo?vi.findIndex(no):-1,Wl=Hl>=0?vi[Hl]:null,Ul=Gt.groupTab,Jl=Dn(()=>Ul?e=>Zt(e.type):void 0,[Ul]),Yl=Boolean(Gt.groupBadge),Gl=Gt.sharedReach,Xl=e=>Gl?.(e)??void 0,Kl=Dn(()=>Gl?new Set(vi.filter(e=>Xl(e)).map(e=>String(e.props.id))):null,[vi,Gl]),Ql=Dn(()=>Kl?e=>Kl.has(e):void 0,[Kl]),Zl=Gt.first?Gl?.({type:Gt.first,props:{id:""}})??void 0:void 0,_l=Gt.groupBadge?/* @__PURE__ */ft("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ft(Gn,{tone:"info",size:"xs",children:Gt.groupBadge})}):void 0,ql=vi.find(e=>e.type===Kt)??null,es=vi.find(e=>e.type===Qt)??null,ns=Fl>=0?Fl:vi.length,ts=[];vi.forEach(e=>{to(e)||(Ml(e)&&ts.push(String(e.props.id)),ts.push(...jl(e,1,El)))}),Vl&&(ts.push(String(Vl.props.id)),ts.push(...jl(Vl,1,El)));const os=ts.length>0&&ts.every(e=>Dr.has(e)),rs=e=>{const n=Nr.blockRowName(e,Ti);return Nr.rowName?Nr.rowName(e,"block",n):n},is=(e,n,t,o)=>{const r=Ai(e)[t];if(!r)return;const i={...En(e),index:t},l={...En(n),index:Math.min(Math.max(o,0),Ai(n).length)},s=Sn(i,l);if(e!==n||s!==t)try{zi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))throw e}},ls=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ol(e))n.add(r),t(o)};for(const t of Nl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ss=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ei.get(n);if(!e)return null;if(e.zone===Ne)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=vi.find(e=>Zt(e.type)&&String(e.props.id)===n);return t&&_t(n)===e?t:null},as=(e,n)=>{const t=ds(e);return!t||(!Gt.groupAccepts||Gt.groupAccepts(t.type,n,Ai(e).length))},cs=(e,n,t)=>{if(e.rung){const t=Ri(e.rung.nodeId),o=t?Di(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===zt&&n.index>=0&&n.index<=o}if(n.slot===zt)return!1;if(e.add)return hs(e.add,n);const o=Mn(n);if(Zt(e.type))return!1;const r=ds(o),i=ds(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!as(o,e.type))&&(n.index>=0&&n.index<=Ai(o).length));if(e.zone===Ne||o===Ne){if(e.zone!==o)return!1;const{floor:t,cap:r}=bi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ai(o).length)return!1;if(e.zone===o)return!0;const l=Vl&&!Gt.lastIsOpen?String(Vl.props.id):null;return(!l||ss(e.zone)!==l&&ss(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ai(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ei.get(i),s=l?Ai(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ls(r).has(n))return!1;const d=xr(s.type,Sr(Vt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Cr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ai(n),r))})(e.zone,o,e.index,t)},ps=(e,n)=>{const t=Mn(e.from),o=e.node;return t===Mn(n)?as(t,o.type):cs({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},us=e=>{const n=e.slice(0,e.indexOf(":")),t=Ei.get(n),o=t?Ai(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=xr(o.type,Sr(Vt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Cr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=T(r.choices??(r.spec?[{type:r.spec.childType,label:Ti(r.spec.childType)}]:[])),l=Fi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:yl(o,t.zone===Ne)}},fs=(e,n)=>{if("section"!==e.kind)return e;const t=Mn(n);return t===Ne||ds(t)?e:us(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},hs=(e,n)=>{const t=fs(e,n),o=Mn(n);if("shared"===t.kind){if(o!==Ne||!Gt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=bi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ds(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return as(o,e)&&n.index>=0&&n.index<=Ai(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=bi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=us(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ai(o))},ms=(e,n)=>{const t=fs(e,n);if("block"!==t.kind&&ds(Mn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&as(n,o)){if("section"===e.kind)So.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;So.insertNode(n,t,wi(e.template.node))}ir(V),So.select({index:t,zone:n})}})(t,Mn(n),n.index);if("section"===t.kind)return void fl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=cl(t),r=So.insertNode(Ne,o,n);ul(o,r,e)})(t.template.name,wi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:$i,newNodeId:Te,sectionLabel:ji,blockIsOffered:zr});if(!o)return;const r=cl(t),i=So.insertNode(Ne,r,o);ul(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Gt.shared?.nodeOf(t.section);if(!e)return;const o=cl(n.index);return void(zi.restore(e,{parentId:$n,slot:jn,index:o})&&ul(o,e.props.id,t.section.title))}const o=Mn(n),r=us(o);r&&(r.target.spec?Al(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{So.insertComponent(e,n,t),ir(V),So.select({index:t,zone:e})})(o,t.type,n.index))},gs=(e,n)=>{e.media?function(e){const n=ed();if(!n||!Zs)return;td(n).then(n=>{n&&function(e,n){if(!Zs)return;const t=Zs.create(e,{nodeDefaults:$i,newNodeId:Te,sectionLabel:ji,blockIsOffered:zr}),o=Mn(n);if(o===Ne){const e=cl(n.index),o=So.insertNode(Ne,e,t);return void ul(e,o,ji(t.type))}So.insertNode(o,n.index,t),ir(V),So.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Yi(e.rung.nodeId,e.index,n.index):e.add?ms(e.add,n):e.zone===Ne?pl(e.index,n.index):is(e.zone,Mn(n),e.index,n.index)},[ys]=Fn(()=>bn()),vs=kn({keyOf:e=>e.id,readOnly:Boolean(Mt),session:ys,canDrop:cs,onDrop:gs,onStep:(e,n)=>{e.rung?Yi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ne?((e,n)=>{const t=ji(vi[e]?.type??""),o=pl(e,n<0?e-1:e+2);if(!o.moved)return void Zr(n<0?io.sectionFirst({name:t}):io.sectionLast({name:t}));const{floor:r,cap:i}=bi();Zr(io.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):is(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),bs=Hn(e=>{const{floor:n,cap:t}=bi(),o=[];for(const r of e.nodes){const e=Mn(r.place),i=Ai(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(no(i)||to(i)||br(i.type,i))continue;if(Zt(i.type))continue;const l=Boolean(ds(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?ji(i.type):Ki(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Mn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:io.addSection,addAlways:!0}];const t=us(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ds(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Mn(e.list),t=n===Ne||ds(n)?null:us(n);return t?.choices.length?mn(e,t.target.spec?.addLabel??io.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Vt.data]),ks=null==Ut?.props.id?null:String(Ut.props.id),Ss=Un(Re),ws=Ss?.selected()&&Uo?.document&&ks?Ss.selectedPart?.(Uo.document)??null:null,xs=ws&&ks&&De(Vt.data,Yt,ks,ws)?ws:null,zs=xs?.label?{element:xs.element,label:xs.label}:null,Cs=null!==xs,Ns=Hn(e=>{const n=Yt,t=e=>!e.item.rung&&null!==Ln(Vt.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(ks);return i?Cs?null:i:r(_e(Vt.data,n,o.item.id,ks,Jl))??o},[Vt.data,Yt,ks,Jl,Cs]),[Os,Is]=Fn(null),[Bs,Ps]=Fn(null),Ts=Nr.canvasTab,$s=Boolean(Ul||Gl||Ts);Nn(Uo,"mouseover",e=>{if(!$s)return;const n=On(e.target),t=n?bt(Vt.data,Yt,n):null;t!==Os&&Is(t),Ts&&n!==Bs&&Ps(n)}),Nn(Uo,"mouseout",e=>{$s&&!e.relatedTarget&&(Is(null),Ps(null))});const js=e=>no(e)||to(e)||Zt(e.type),Ms=e=>{const n=Zt(e.type)?Ti(e.type):no(e)?io.header:to(e)?io.footer:null;return null===n?Mi(e):Nr.rowName?Nr.rowName(e,"section",n):n},Es=[];if($s){const e=ks?bt(Vt.data,Yt,ks):null;for(const n of/* @__PURE__ */new Set([e,Os])){const e=n?vi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=no(e)||e.type===Kt,o=Xl(e);if(o){Es.push({id:String(e.props.id),label:Ms(e),below:t,reach:o});continue}if(!Ul||!js(e))continue;const r=Ul(e);r&&Es.push({id:String(e.props.id),label:r,below:t})}for(const e of Ts?/* @__PURE__ */new Set([ks,Bs]):[]){const n=e?Ri(e):void 0,t=n?Ts(n):null;t&&!Es.some(n=>n.id===e)&&Es.push({id:e,label:t,below:!1,above:!0})}}const Ls=fe(),As=Rn(null);Vn(()=>{const e=Gt.changeNotice;if(!e)return;const n=JSON.stringify(vi.filter(js)),t=As.current;if(As.current={doc:Yn,bands:n,index:Wt.index},!t||t.doc!==Yn||t.bands===n)return;Wt.hasPast&&Wt.index>=t.index&&!vt.has(Ls)&&(vt.add(Ls),Zr(e,"success",{action:{label:io.bar.undo,onClick:()=>Wt.back()},duration:8e3}))},[vi]);const Rs=e=>{ir(V),So.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Ds=q(),Fs=()=>({data:Vt.data,device:Po,ops:So,inspector:mr}),Vs=Ds?.model,Hs=Dn(()=>Vs?e=>Vs(e,bs(e),Fs()):bs,[Vs,bs,Po]),Ws=Ds?.measure,Us=Ws?(e,n)=>Ws(e,n,Fs()):void 0,Js=Ds?.canDrop,Ys=Js?(e,n)=>Js(e,n,cs,Fs()):cs,Gs=Ds?.drop,Xs=Gs?(e,n)=>Gs(e,n,gs,Fs()):gs,Ks=Ds?.pick,Qs=Ks?e=>Ks(e,Rs,Fs()):Rs,Zs=Ds?.media??null,_s=Rn(null),qs=Dn(()=>Zs?{id:gt,zone:"",index:-1,type:Zs.adds.type,add:{kind:Zs.adds.kind,type:Zs.adds.type},media:!0}:null,[Zs]);Vn(()=>{if(!qs||Mt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(ot))(e)&&(_s.current=null,ys.start({key:gt,item:qs}))},n=e=>{ys.get()?.item.media&&(_s.current=Zn(e.dataTransfer))},t=()=>{ys.get()?.item.media&&ys.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[qs,Mt,ys]);const ed=()=>{const e=_s.current;return _s.current=null,e},nd=ce(),td=async e=>{if(!nd)return e;const n=await nd(e);return n?{...e,id:n.id,url:n.url}:null};const od=(e,n)=>{if(!Zs)return;const t=Ln(ko.getState().appState.data,ki,n);if(!t)return;const o=t.node;So.replaceComponent(Mn(t.place),t.place.index,{...o,props:{...Zs.replace(o,e),id:o.props.id}})},rd=e=>{const n=Mn(e),t=Fi(n);t&&Ui(t.node,t.slot,!1),ml(n,e.index)},id=(e,n)=>/* @__PURE__ */ft(Ge,{...Mt?{}:vs.seam({place:{...En(e),index:n}})},`seam:${e}:${n}`),ld={rowClick:vl,isCollapsed:Yr,toggleCollapse:Gr},sd=e=>{const n=String(e.props.id),t=vi.findIndex(e=>String(e.props.id)===n),o=_t(n),r=Ai(o),i=Yr(n),l=Ti(e.type),s=Nr.rowName?Nr.rowName(e,"section",l):l,d=e=>id(o,e);/* @__PURE__ */
|
|
16
|
+
return ht(mt,{children:[
|
|
17
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:e.type,size:13}),name:s,preview:kl(e),marks:Sl(e),onSelect:()=>al(t),nameSlot:Zi(Ne,t,n,s),selected:lr===n,badge:Xl(e)?void 0:_l,shared:Xl(e),actions:wl(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:vl(()=>al(t))},fold:{open:!i,label:"section",onToggle:()=>Gr(n)}}),!i&&/* @__PURE__ */ht(We,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Mi(n),l=Ml(n),s=l&&Yr(r),a=()=>Ll(o,t,r,e.type),{rowProps:c,...p}=vs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...En(o),index:t}},{"data-node-id":r,onClick:vl(a)});/* @__PURE__ */
|
|
18
|
+
return ht(Jn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:n.type,size:13}),name:i,preview:kl(n),marks:Sl(n),onSelect:a,nameSlot:Zi(o,t,r,i),selected:lr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[bl(o,t,i),wl(n,o,t),xl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ft(We,{children:cd(n,2)})]},r)}),d(r.length)]})]})},dd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vs.dragging,d=!Yr(l)&&s?.rung?.nodeId!==i,a={...En(l),index:0},c=s&&!s.rung&&cs(s,a)?a:void 0,p=()=>Ui(e,n,!0),{rowProps:u,...f}=vs.row({item:{id:`rung:${l}`,zone:`${i}:${zt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:zt,index:t},into:c,canDrag:Boolean(vr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:vl(p)}),h=Mt?null:vr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return ht(Jn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */ft(He,{words:lo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Vi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Gr(l)},actions:h&&h.length>0?/* @__PURE__ */ft(mt,{children:h.map((t,o)=>/* @__PURE__ */ft(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Mt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ji(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */ft(dt,{size:15}):/* @__PURE__ */ft(ut,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ft(We,{children:r})]},l)},ad=(e,n)=>{const t=Il(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return ft(mt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Tl(e,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>id(e,n),p=/* @__PURE__ */ht(mt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=lr===String(n.props.id),{collapsible:i,folded:s}=$l(n,l,El(n.type)),d=String(n.props.id),a=rs(n),p=()=>Ll(t,o,d,e.type),{rowProps:u,...f}=vs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...En(t),index:o}},{"data-node-id":d,onClick:vl(p)});/* @__PURE__ */
|
|
23
|
+
return ht(Jn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:n.type,size:13}),name:a,preview:kl(n),marks:Sl(n),onSelect:p,nameSlot:Zi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Gr(d)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[bl(t,o,a),wl(n,t,o),xl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ft(We,{children:ad(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?dd(e,t.rung,r++,o,p):/* @__PURE__ */ft(Jn,{children:p},t.slot??"")})})},cd=(e,n)=>{const t=Sr(Vt?.data,e.type,String(e.props.id)),o=Il(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return ft(mt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Tl(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>id(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ht(mt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=lr===String(n.props.id),i=Ki(n),l=String(n.props.id),{collapsible:d,folded:a}=$l(n,s,El(n.type)),c=Nl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...En(p),index:Ai(p).length}:void 0,f=vs.dragging,h=u&&f&&cs(f,u)?u:void 0,g=()=>Ll(t,o,l,e.type),{rowProps:y,...v}=vs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...En(t),index:o},into:h,canDrag:!br(n.type,n)},{"data-node-id":l,onClick:vl(g)});/* @__PURE__ */
|
|
26
|
+
return ht(Jn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:n.type,size:13}),name:i,preview:kl(n),marks:Sl(n),onSelect:g,nameSlot:Zi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Gr(l)}:void 0,actions:br(n.type,n)?wl(n,t,o)??void 0:/* @__PURE__ */ht(mt,{children:[bl(t,o,i),wl(n,t,o),xl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ft(We,{children:cd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */ft(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Al(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?dd(e,o.rung,i++,r,v):/* @__PURE__ */ft(Jn,{children:v},o.slot??"")})})},pd=Zo,ud=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:xo&&!pd&&yr===e.id,onSelect:()=>gi(e.id)}:e,fd=[...(gr.railLead??[]).map(ud),{id:"sections",label:io.layers,icon:/* @__PURE__ */ft(ge,{}),active:xo&&!pd&&"sections"===yr,onSelect:()=>gi("sections")},...(gr.railTrail??[]).map(ud)],hd=jo?{onPress:Mo}:Rt?{onPress:()=>{x(xn,{accept:"image/*",title:fo.mediaLibrary})}}:null,md={value:fd.find(e=>!0===e.active)?.id??"",press:e=>{const n=fd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:fd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ft("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},gd=[...gr.railLead??[],...gr.railTrail??[]].find(e=>"panel"in e&&e.id===yr),yd=Boolean(ro?.foldable),vd=ro?.label??(Dt?io.pageSections:io.templateSections),bd=yd&&Yr(Nt),kd=/* @__PURE__ */ht(mt,{children:[vi.map((e,n)=>{if(no(e)||to(e)||Zt(e.type))return null;const t=lr===String(e.props.id),o=Boolean(e.props._hidden);Ol(e);const r=String(e.props.id),i=gr.hasOwnRows?.(e)??!1,l=Ml(e)||i,s=l&&Yr(r),d=Nl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...En(a),index:Ai(a).length}:void 0,p=vs.dragging,u=c&&p&&cs(p,c)?c:void 0,{rowProps:f,...h}=vs.row({item:{id:r,zone:Ne,index:n,type:e.type},place:{...En(Ne),index:n},into:u,canDrag:!br(e.type,e)},{"data-node-id":r,onClick:vl(()=>al(n))});/* @__PURE__ */
|
|
29
|
+
return ht(Jn,{children:[n>0&&zl(n),
|
|
30
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:e.type,size:13}),name:Mi(e),preview:kl(e),marks:Sl(e),shared:Xl(e),onSelect:()=>al(n),nameSlot:Zi(Ne,n,r,Mi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */ht(mt,{children:[bl(Ne,n,Mi(e)),wl(e,Ne,n),xl(Ne,n,e,Mi(e))]}),rowProps:f}),Ml(e)&&!s&&/* @__PURE__ */ht(We,{children:[cd(e,1),gr.partRows?.(e,ld)]}),i&&!s&&/* @__PURE__ */ft(We,{children:gr.ownRows?.(e,n,ld)})]},String(e.props.id??n))}),ns>0&&zl(ns)]}),Sd=(e,n,t)=>{const o=String(e.props.id),r=Bl(e).length>0||Pl(e)||Boolean(xr(e.type)),i=r&&Yr(o),l="header"===t?io.header:io.footer,s=Nr.rowName?Nr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return ht(mt,{children:[
|
|
32
|
+
/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:t,size:13}),name:s,preview:kl(e),marks:Sl(e),badge:Xl(e)?void 0:_l,shared:Xl(e),onSelect:()=>al(n),nameSlot:Zi(Ne,n,o,s),selected:lr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Gr(o)}:void 0,actions:wl(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:vl(()=>al(n))}}),r&&!i&&/* @__PURE__ */ft(We,{children:ad(e,1)})]})};return(gr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */ft(ee,{target:Uo,children:/* @__PURE__ */ht("div",{ref:Wo,className:"sf-editor es-editor",style:dn(Vr),onContextMenu:ol.onEditorContextMenu,...p(xn),children:[
|
|
34
|
+
/* @__PURE__ */ht(qe,{children:[
|
|
35
|
+
/* @__PURE__ */ht("div",{className:"es-cluster es-cluster--left",children:[hd?/* @__PURE__ */ft(Xn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ft(ye,{}),onClick:hd.onPress,children:io.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */ft(en,{label:io.bar.undo,disabled:Boolean(Mt)||!Wt.hasPast,onClick:()=>Wt.back(),children:/* @__PURE__ */ft(rt,{})}),
|
|
37
|
+
/* @__PURE__ */ft(en,{label:io.bar.redo,disabled:Boolean(Mt)||!Wt.hasFuture,onClick:()=>Wt.forward(),children:/* @__PURE__ */ft(it,{})})]}),
|
|
38
|
+
/* @__PURE__ */ht(nn,{children:[
|
|
39
|
+
/* @__PURE__ */ft(tn,{devices:Co,value:Po,onChange:To}),
|
|
40
|
+
/* @__PURE__ */ft(en,{label:io.bar.refresh,tip:io.bar.refreshTip,onClick:()=>{Ho.current=(()=>{const e=Uo?.document;if(!e)return null;const n=vi.findIndex(to),t=n>=0?n:vi.length;let o=null;for(let n=0;n<t;n++){const t=vi[n]?.props?.id;if(null==t)continue;const r=Tn(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Ut?.props?.id??vi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Vo(e=>e+1)},children:/* @__PURE__ */ft(lt,{})}),gr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */ht(nn,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */ft(b,{input:Ko,words:io.saveStatus}),In?/* @__PURE__ */ft(In,{}):null,gr.barLead?.(),gr.barTrail?.(),gr.mainAction||!gr.barMain?/* @__PURE__ */ft(k,{input:Ko,action:_r,readOnly:Boolean(Mt),saveSwitch:Lt,onToggleAutoSave:Pt,onSaveNow:Qo,bar:io.bar,words:io.saveStatus}):gr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */ft(v,{}),
|
|
44
|
+
/* @__PURE__ */ht("div",{className:"sf-body",children:[xo?/* @__PURE__ */ht(mt,{children:[
|
|
45
|
+
/* @__PURE__ */ht("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":io.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */ht("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */ft(I,{side:"left",onHide:hi}),
|
|
48
|
+
/* @__PURE__ */ft("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */ft(Kn,{variant:"underline",block:!0,"aria-label":io.bar.views,value:md.value,onChange:md.press,items:md.items})]}),Zo?/* @__PURE__ */ft(C,{at:er?{label:(e=>{const n=ds(e.zone);if(n)return io.add.addingTo({name:Nr.rowName?yl(n,!0):Ti(n.type)});if(e.zone===Ne){const n=vi[e.index];return n&&!to(n)?io.add.addingBefore({name:yl(n,!0)}):io.add.addingAtEnd}const t=us(e.zone);return t?io.add.addingTo({name:t.parentName}):io.add.addingHere})(er),onClear:()=>nr(null)}:void 0,placeBlocks:er&&er.zone!==Ne?us(er.zone)?.choices:void 0,canTake:er?e=>{if(!er)return null;const n={...En(er.zone),index:er.index};if(hs(e,n))return null;if("shared"===e.kind&&er.zone===Ne&&!Gt.shared?.nodeOf(e.section))return io.shared.alreadyHere;const t=ds(er.zone);if(t)return io.add.notInside({name:yl(t,!0)});if(er.zone===Ne)return io.add.onlySections;const o=us(er.zone);return o?io.add.notInside({name:o.parentName}):io.add.onlySections}:void 0,onPick:er?e=>{if(!er)return;const n={...En(er.zone),index:er.index};hs(e,n)&&(ms(e,n),gl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Ct(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Ct(e),add:e}),session:ys,siteWide:gr.addPanelRow?.(gl),onClose:gl,readOnly:Boolean(Mt)}):gd?gd.panel({onHide:hi,notify:Zr}):/* @__PURE__ */ht(mt,{children:[
|
|
50
|
+
/* @__PURE__ */ft(B,{icon:/* @__PURE__ */ft(ge,{}),title:io.layers,context:ho,actions:/* @__PURE__ */ht(mt,{children:[!Mt&&/* @__PURE__ */ft(on,{label:io.add.title,onClick:()=>hl(null),children:/* @__PURE__ */ft(st,{size:15})}),
|
|
51
|
+
/* @__PURE__ */ft(on,{label:os?io.expandAll:io.collapseAll,title:0===ts.length?io.nothingToFold:void 0,disabled:0===ts.length,onClick:()=>Fr(e=>{const n=new Set(ts);return os?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...ts])}),children:/* @__PURE__ */ft(St,{expand:os})})]})}),
|
|
52
|
+
/* @__PURE__ */ht(Ue,{className:"sf-tree sf-scroll",words:lo,children:[ql&&/* @__PURE__ */ht(mt,{children:[!Yl&&/* @__PURE__ */ft(Je,{children:io.header}),sd(ql)]}),Ft&&!(Yl&&ql)&&/* @__PURE__ */ht(mt,{children:[!Yl&&/* @__PURE__ */ft(Je,{children:io.header}),!oo&&/* @__PURE__ */ft(He,{words:lo,icon:/* @__PURE__ */ft(Ir,{type:"header",size:13}),name:io.header,badge:Zl?void 0:_l,shared:Zl,onSelect:yi,selected:rr.kind===eo?.kind,rowProps:{onClick:vl(yi)}})]}),Wl&&!(Yl&&ql)&&Sd(Wl,Hl,"header"),!yd&&/* @__PURE__ */ft(Je,{children:vd}),yd?/* @__PURE__ */ht(mt,{children:[
|
|
53
|
+
/* @__PURE__ */ft(He,{words:lo,icon:null,name:vd,fold:{open:!bd,label:vd,onToggle:()=>Gr(Nt)}}),!bd&&/* @__PURE__ */ft(We,{children:kd})]}):kd,Ft&&!Yl&&/* @__PURE__ */ft(Je,{children:io.footer}),Vl&&!(Yl&&es)&&Sd(Vl,Fl,"footer"),es&&sd(es),gr.treeFoot?.()]})]})]}),
|
|
54
|
+
/* @__PURE__ */ft(rn,{side:"left",width:Vr.left,min:sn.left,max:ln,defaultWidth:h.left,label:io.resizeLeftPanel,onResize:Ur})]}):/* @__PURE__ */ft(P,{side:"left",onShow:hi}),
|
|
55
|
+
/* @__PURE__ */ht("div",{ref:ei,className:"sf-center sf-scroll","data-sf-canvas-head":ii?"":void 0,style:{overflowX:pi?"auto":"hidden",overflowY:"hidden"},children:[ii&&/* @__PURE__ */ft("div",{ref:li,className:"sf-canvas-head",children:/* @__PURE__ */ft(ii,{device:Po})}),
|
|
56
|
+
/* @__PURE__ */ht("div",{className:"sf-frame-scaler",style:ui,children:[
|
|
57
|
+
/* @__PURE__ */ft("div",{className:"sf-frame "+(Po===Io?"":`sf-frame--${Po}`),style:fi,children:/* @__PURE__ */ht("div",{className:"sf-preview-host",children:[
|
|
58
|
+
/* @__PURE__ */ft(Fe.Provider,{value:Jl,children:/* @__PURE__ */ft(Ve.Provider,{value:Ql,children:/* @__PURE__ */ft(mo,{},Fo)})}),
|
|
59
|
+
/* @__PURE__ */ft(gn,{canvas:Uo,session:ys,model:Hs,measure:Us,canDrop:Ys,onDrop:Xs,choose:Ns,tag:zs,onPick:Qs,dropOn:Zs?{accepts:(e,n)=>{if(!e.media||!Zs||n.item.rung)return!1;const t=Ln(Vt.data,ki,n.item.id);return null!==t&&Zs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=ed();n&&Zs&&td(n).then(n=>{n&&od(n,e.item.id)})})(n),label:()=>io.canvasReplaceImage}:void 0,onZoneAdd:rd,onSeamAdd:rd,zoneAddLabel:io.canvasAddBlock,words:so.canvas,readOnly:Boolean(Mt),revision:Vt.data}),tr.length>0&&!Jo&&/* @__PURE__ */ft("div",{className:"sf-preview-gaps",children:tr.map(e=>
|
|
60
|
+
/* @__PURE__ */ft(yn,{index:e.index,label:io.addSectionHere,onInsert:()=>hl(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))})]})}),$s?/* @__PURE__ */ft(kt,{canvas:Uo,tabs:Es,onSelect:Wi}):null]})]}),zo?/* @__PURE__ */ht(mt,{children:[Bn?
|
|
61
|
+
/* @__PURE__ */ft("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Bn}):/* @__PURE__ */ft(mt,{children:/* @__PURE__ */ft(u,{value:{selectChild:Ll,addChild:Al,childRowName:Ki,blockRowName:rs},children:/* @__PURE__ */ft(go,{mode:rr,onOpenWebsiteSettings:gr.openSettings??(()=>{}),onOpenSiteStyles:gr.openStyles,onOpenPageStyles:gr.openPageStyles,onSelectNode:$r,onNotify:Zr,onHidePanel:mi,nodeActions:Ut?Oe(Yt,Ut.type):Ot})})}),
|
|
62
|
+
/* @__PURE__ */ft(rn,{side:"right",width:Vr.right,min:sn.right,max:ln,defaultWidth:h.right,label:io.resizeSettingsPanel,onResize:Jr})]}):
|
|
63
|
+
/* @__PURE__ */ft(P,{side:"right",onShow:mi})]}),ol.menu,
|
|
64
|
+
/* @__PURE__ */ft(ie,{}),Ni?/* @__PURE__ */ft(yt,{name:Ni.name,onMake:e=>(async(e,n)=>{const t=vi.find(n=>String(n.props.id)===e),o=Gt.shared;if(!t||!o)return;let r;try{r=await O(Ci).create(n,t)}catch{return void Zr(io.shared.makeFailed,"error")}o.adopt(t,r),Oi(null)})(Ni.id,e),onCancel:()=>Oi(null)}):null]})}))}export{Bt as ScreenChrome};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-L4DFCNDQ.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-NUJEHA6A.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
package/dist/copy/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { c as CopyBoxProps, d as CopyCell, T as TextBoxHandle } from '../canvas-typing
|
|
3
|
-
export { e as COPY_CELLS, b as CanvasTypingEnd, f as CanvasTypingOptions, g as CanvasTypingSession, h as ColorWindow, i as CopyBoxAlign, j as CopyBoxFooter, C as CopyBoxLastTool, k as CopyCase, l as CopyCellPreset, m as CopyCells, a as CopyThemeColor, M as MarkWriter, S as SelectionSource, n as TextAreaHandle, o as TextMap, p as ToolbarMark, q as colorRunOf, r as insertSelection, s as markSelection, t as startCanvasTyping, u as textMap } from '../canvas-typing
|
|
2
|
+
import { c as CopyBoxProps, d as CopyCell, T as TextBoxHandle } from '../canvas-typing--FlIZwbT.js';
|
|
3
|
+
export { e as COPY_CELLS, b as CanvasTypingEnd, f as CanvasTypingOptions, g as CanvasTypingSession, h as ColorWindow, i as CopyBoxAlign, j as CopyBoxFooter, C as CopyBoxLastTool, k as CopyCase, l as CopyCellPreset, m as CopyCells, a as CopyThemeColor, M as MarkWriter, S as SelectionSource, n as TextAreaHandle, o as TextMap, p as ToolbarMark, q as colorRunOf, r as insertSelection, s as markSelection, t as startCanvasTyping, u as textMap } from '../canvas-typing--FlIZwbT.js';
|
|
4
4
|
import { TextAlign } from 'efficient-shell/ui';
|
|
5
5
|
export { TextToolbar, TextToolbarProps } from 'efficient-shell/ui';
|
|
6
6
|
import { F as FieldOption } from '../types-CVHwspYM.js';
|
package/dist/copy/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{SettingsSwitch as e}from"../chunk-OECWLNKJ.js";import{TEXT_STYLE_CASES as t}from"../chunk-YHZSBL2N.js";import{selectionToVisible as n,selectionToSource as r,richLayout as l,createHistory as o,colorRunOf as a,textRange as s,selectionBox as c,placeWindow as i,offsetOrigin as u,visibleArea as d,
|
|
2
|
-
return
|
|
3
|
-
return
|
|
4
|
-
return
|
|
5
|
-
return
|
|
6
|
-
return
|
|
7
|
-
return
|
|
8
|
-
return
|
|
9
|
-
return
|
|
10
|
-
return
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
return
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
return
|
|
17
|
-
return
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
return
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
return
|
|
26
|
-
return
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
1
|
+
import{SettingsSwitch as e}from"../chunk-OECWLNKJ.js";import{TEXT_STYLE_CASES as t}from"../chunk-YHZSBL2N.js";import{selectionToVisible as n,selectionToSource as r,richLayout as l,createHistory as o,colorRunOf as a,textRange as s,selectionBox as c,placeWindow as i,offsetOrigin as u,visibleArea as d,styleChange as p,clearRangeOf as h,ColorWindow as m,markPress as f,pasteToMarkup as g,richInput as y,editVisible as v,MARKUP_CLIPBOARD_TYPE as b,markupOfRange as k}from"../chunk-3BQT7FC7.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,clearRangeOf,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-3BQT7FC7.js";import{DEFAULT_COPY_WORDS as x}from"../chunk-PMRN5Z3T.js";import{FieldNumber as S}from"../chunk-Y2T3JX7K.js";import{FieldSelect as E}from"../chunk-KFWNGPW3.js";import{SettingsField as w}from"../chunk-MIX7EGRG.js";import{SettingsSegmented as C}from"../chunk-DX3VILZ3.js";import"../chunk-JACEEVVF.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{registerModalEscapeInterceptor as D,textToolbarRows as T,TextToolbar as O,textAlignWords as L,useShellStrings as R,textAlignOptions as K,TEXT_ALIGNS as F,LinkPicker as j,Tooltip as B,IconButton as M}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as V,useState as H,useLayoutEffect as W,useEffect as $,useId as P}from"react";import{RETIRED_MARKS as z,applyMark as I,marksIn as q,STANDARD_MARKUP as Y,listIn as A,colorIn as G,styleIn as U,clearStyle as Z,spanFor as _,findLink as J,tokenizeInline as X,colorOver as Q,setList as ee,unlinkAt as te,removeLink as ne,linkOver as re,writeLink as le}from"efficient-shell/markup";import{jsxs as oe,jsx as ae,Fragment as se}from"react/jsx-runtime";import{ParagraphSpacingIcon as ce,LetterSpacingIcon as ie,LineSpacingIcon as ue,TextSizeIcon as de,StylesIcon as pe,TypeIcon as he,AlignmentIcon as me,ListFormatIcon as fe,CaseIcon as ge,ItalicIcon as ye,NumberedListIcon as ve,ListIcon as be,ListNoneIcon as ke,CaseLowerIcon as xe,CaseCapitalizedIcon as Se,CaseUpperIcon as Ee,CaseNormalIcon as we}from"efficient-shell/icons/efficient";function Ce(e,t,n,r,l){for(const o of l){if(o.kind!==n)continue;if(!e.startsWith(o.open,t))continue;const l=t+o.open.length;if(e.startsWith(r,l)&&e.startsWith(o.close,l+r.length))return o}return null}function Ne({value:e,rules:t=Y,className:n,layerRef:r}){const l=function(e,t){const n=[];let r=0;for(const l of X(e,t)){if("text"===l.kind){l.text.length>0&&(n.push({kind:"text",text:e.slice(r,r+l.text.length)}),r+=l.text.length);continue}const o=Ce(e,r,l.kind,l.text,t);if(!o)return[{kind:"text",text:e}];const a=r+o.open.length,s=a+l.text.length,c=s+o.close.length;n.push({kind:"delimiter",text:e.slice(r,a)}),n.push({kind:l.kind,text:e.slice(a,s)}),n.push({kind:"delimiter",text:e.slice(s,c)}),r=c}return n.map(e=>e.text).join("")!==e?[{kind:"text",text:e}]:n}(e,t);/* @__PURE__ */
|
|
2
|
+
return ae("div",{ref:r,className:["es-gold-layer",n??""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.map((e,t)=>function(e,t){const{kind:n,text:r}=e;switch(n){case"delimiter":/* @__PURE__ */
|
|
3
|
+
return ae("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
|
|
4
|
+
return ae("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
|
|
5
|
+
return ae("strong",{className:"es-gold-mark es-gold-bold",children:r},t);case"italic":/* @__PURE__ */
|
|
6
|
+
return ae("em",{className:"es-gold-mark es-gold-italic",children:r},t);case"strike":/* @__PURE__ */
|
|
7
|
+
return ae("s",{className:"es-gold-mark es-gold-strike",children:r},t);case"quiet":/* @__PURE__ */
|
|
8
|
+
return ae("span",{className:"es-gold-mark es-gold-quiet",children:r},t);default:/* @__PURE__ */
|
|
9
|
+
return ae("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function De({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=Y,ariaLabel:c,disabled:i=!1,inputRef:u}){const d=V(null),p=V(e),h=V(!1);function m(e){h.current&&(h.current=!1,n?.(e))}/* @__PURE__ */
|
|
10
|
+
return oe("div",{className:["es-gold",l?"es-gold-is-multiline":"es-gold-is-single",i?"es-gold-is-off":"",a??""].filter(Boolean).join(" "),children:[
|
|
11
|
+
/* @__PURE__ */ae(Ne,{value:e,rules:s,layerRef:d}),o&&""===e?
|
|
12
|
+
/* @__PURE__ */ae("div",{className:"es-gold-placeholder","aria-hidden":"true",children:o}):null,
|
|
13
|
+
/* @__PURE__ */ae("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Te(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Oe(e,t,n,r=I){const{start:l,end:o}=Te(e,n);return r(e,l,o,t)}function Le(e,t,n){const{start:r,end:l}=Te(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Re(e,t,n,r,l){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,l&&(n.dataset.textStyle=l),n}}}function Ke(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Fe(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function je({value:e,rules:t,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:h,pending:m,onCommit:f,onCancel:x}){const S=V(null),E=V(null),w=V(null),C=V(null),N=V(null),D=V(e),[T,O]=H(0),L=V({value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h});L.current={value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h};const R=()=>{const e=S.current,t=E.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ke(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ke(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},K=(e,t)=>{const n=S.current,r=E.current;if(!n||!r)return;const[l,o]=Fe(r,e),[a,s]=Fe(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=R(),t=E.current;if(!e||!t)return null;const[n,l]=r(t.layout,e[0],e[1]);return{start:n,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,t){const r=S.current,l=E.current;if(!r||!l)return null;const[o,a]=n(l.layout,e,t),[s,c]=Fe(l,o),[i,u]=Fe(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},W(()=>{const r=S.current;if(!r||N.current)return;const o=C.current?null:R();E.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Re(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color,e.marks[r].style);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(r,l(e,t)),w.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&r.ownerDocument.activeElement===r&&K(o[0],Math.min(o[1],E.current.layout.text.length)));C.current=null;const s=E.current.layout,[c,i]=a.vis??n(s,a.src[0],a.src[1]);r.ownerDocument.activeElement!==r&&r.focus(),K(c,i)},[e,t,T]);const F=(e,t,n)=>{const l=E.current,[o,a]=r(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==L.current.value?L.current.onEdit(e.text,{start:o,end:a},n):O(e=>e+1)};$(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=L.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=E.current,c=R();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Ke(s,e,i.startContainer,i.startOffset),Ke(s,e,i.endContainer,i.endOffset)]:null,d=y({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?F(d.edit,d.range,d.kind):L.current.onFormat(d.style):L.current.onHistory(d.dir))},n=()=>{N.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),$(()=>{const e=S.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=i.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const j=(n,r=!1)=>{const l=R();if(!l||l[0]===l[1])return;n.preventDefault();const o=E.current;n.clipboardData.setData("text/plain",o.layout.text.slice(l[0],l[1])),n.clipboardData.setData(b,k(e,t,l[0],l[1])),r&&!a&&F(v(e,t,l[0],l[1],{text:""}),l,"edit")};/* @__PURE__ */
|
|
14
|
+
return oe("div",{className:"es-rich-wrap",children:[s&&""===e?/* @__PURE__ */ae("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
|
|
15
|
+
/* @__PURE__ */ae("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${a?" is-off":""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":c,"aria-readonly":a||void 0,"aria-placeholder":s,tabIndex:a?-1:0,spellCheck:!0,onFocus:()=>{D.current=e},onBlur:()=>{e!==D.current&&f?.(e),D.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(D.current),void(D.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==D.current&&f?.(e),D.current=e)},onCompositionStart:()=>{const e=R()??[0,0];N.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=N.current;if(N.current=null,!t)return;const{value:n,rules:r,pending:l}=L.current;e.data?F(v(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):O(e=>e+1)},onCopy:e=>j(e),onCut:e=>j(e,!0),onPaste:n=>{if(n.preventDefault(),a)return;const r=R();if(!r)return;const l=n.clipboardData.getData(b),s=l?o?l:l.replace(/\s*\r?\n\s*/g," "):g({html:n.clipboardData.getData("text/html"),text:n.clipboardData.getData("text/plain")},{doc:n.currentTarget.ownerDocument,multiline:o,rules:t});F(v(e,t,r[0],r[1],{markup:s}),r,"edit")}})]})}var Be={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */ae(de,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */ae(ue,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */ae(ie,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */ae(ce,{}),unit:"px",step:1,shiftStep:10,min:0}};function Me(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ve({cells:e,words:t,readOnly:n=!1}){const r=t??x.cells,l=P();/* @__PURE__ */
|
|
16
|
+
return ae("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */ae("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,o=e.name??(e.nameKey?r[e.nameKey]:e.key),a=e.unit??"",s=e.step??1,c=`${l}-${e.key}`;/* @__PURE__ */
|
|
17
|
+
return oe("div",{className:"es-copy-cell",children:[
|
|
18
|
+
/* @__PURE__ */ae("label",{className:"es-field-label es-copy-cell-name",htmlFor:c,children:o}),
|
|
19
|
+
/* @__PURE__ */ae(S,{id:c,value:Me(e.value,t),styleValue:Me(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:n,ariaLabel:o,title:r.tip({name:o,step:s,unit:a})})]},e.key)})})})}function He({target:e,onChange:t}){const n=V(null);return W(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var We=/* @__PURE__ */new Set([...z,"clear"]);function $e({value:t,onChange:n,onCommit:r,onCancel:l,multiline:y=!1,placeholder:v,ariaLabel:b,className:k,readOnly:S=!1,rules:E,tools:w=[],writeMark:C,align:L,actions:R,toolbar:K,barLabel:F,renderFooter:B,inputRef:M,barShows:z="always",richText:X=!0,defaultShowMarks:ce=!1,colors:ie,cells:ue,letterCase:de,lastTool:pe}){const he=N("copy",x),me=V(null),fe=M??me,[ge,ye]=H(!1),[ve,be]=H(null),ke=V(o()).current,xe=V(null);$(()=>{const e=xe.current;e&&t===e.to?xe.current=null:e&&t===e.from||(xe.current=null,ke.reset(),be(Te.current?.getSource()??null))},[t,ke]);const Se=e=>{xe.current={from:xe.current?.from??t,to:e},n(e)},Ee=e=>({text:t,start:e?.selectionStart??ve?.start??t.length,end:e?.selectionEnd??ve?.end??t.length}),[we,Ce]=H(ce),Ne=X&&!(y&&we),Te=V(null),Re=P(),[Ke,Fe]=H(null),[Be,Me]=H(!1),$e=()=>{if(!Ne)return fe.current;const e=Te.current?.getSource()??ve;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=He({target:fe,onChange:Se}),ze=e=>(be({start:e.selectionStart,end:e.selectionEnd}),e),Ie=(e,n)=>{if(!Ne)return void Pe(t=>(n&&ke.record(Ee(t),"edit",Date.now()),ze(e(t))));const r=$e(),l=ze(e(r));n&&ke.record(Ee(r),"edit",Date.now()),Fe(null),l.text!==t&&Se(l.text),Te.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},qe=e=>Ie(e,!0),Ye=e=>Ie(t=>{const n=Ee(t),r=ke[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ae=V(null);W(()=>{const e=Ae.current;e&&(Ae.current=null,Ne?Te.current?.setSource(e.start,e.end,t):(fe.current?.focus(),fe.current?.setSelectionRange(e.start,e.end),be(e)))},[Ne]);const[Ge,Ue]=H(null),Ze=E??Y,_e=("string"==typeof w[0]?w:w.map(e=>e.style)).filter(e=>!We.has(e)),Je={};if(ve){const e=q(t,ve.start,ve.end,Ze);for(const t of _e){const n=e.has(t)||"highlight"===t&&e.has("accent");Je[t]=!!Ke?.add.includes(t)||!Ke?.drop.includes(t)&&n}Je.link=e.has("link")}const Xe=()=>{const e=$e(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Qe=e=>{if("link"!==e&&_(0,e)){const{start:n,end:r}=Xe();if(n===r&&!Ne)return void qe(n=>Oe(t,e,n,(e,t,n,r)=>I(e,t,n,r,Ze,he.placeholders)));const l=f({value:t,rules:Ze,start:n,end:r,style:e,pending:Ke});return void("pending"===l.kind?Fe(l.pending):qe(()=>l.result))}if("link"!==e){const n=C??((e,t,n,r)=>I(e,t,n,r,Y,he.placeholders));return void qe(r=>Oe(t,e,r,n))}const n=$e(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Me(!1),Ue({start:r,end:l,link:J(t,r,l)})},et=Boolean(ve&&ve.start!==ve.end),tt=ve?A(t,ve.start,ve.end,Ze):null,nt=ve?Ke&&void 0!==Ke.color&&Ke.at===ve.start?Ke.color:G(t,ve.start,ve.end,Ze):null,rt=a(nt,ie),lt=e=>{Ne?e?Te.current?.setSource(e.start,e.end,t):Te.current?.focus():(fe.current?.focus(),e&&fe.current?.setSelectionRange(e.start,e.end))},ot=()=>{const e=Ge;Ue(null),lt(e?{start:e.start,end:e.end}:ve)},at=()=>{const e=ct.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Me(!1),t&<(ve)},st=V(at);st.current=at,$(()=>{if(Be)return D(e=>{const t=ct.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(st.current(),!0)},()=>ct.current?.querySelector(".es-copy-colors"))},[Be]);const ct=V(null),it=Be||null!==Ge;$(()=>{const e=ct.current;if(!it||!e)return;const t=e.ownerDocument,n=()=>{Me(!1),Ue(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[it]);const ut=Ge??(Be?ve??{start:t.length,end:t.length}:null),dt=V(()=>{});dt.current=()=>{const e=ct.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!ut)return;const n=Ne?null:e.querySelector(".es-gold-layer"),r=Ne?Te.current?.rangeOf(ut.start,ut.end)??null:n?s(n,ut.start,ut.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?c(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const p=i({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:d(e),parent:u(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},W(()=>{const e=ct.current;if(!it||!e)return;const t=()=>dt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[it,Be,Ge,ut?.start,ut?.end,Ne]);const pt="always"===z||ge||null!==Ge||Be,ht=ie&&ie.length>0?{run:rt,open:Be,onToggle:()=>{Ue(null),Be?at():Me(!0)}}:void 0,mt=pt?pe?pe({className:"rosh-tb-btn",disabled:S,selected:et,keepCaret:e=>e.preventDefault(),insert:e=>qe(n=>Le(t,e,n)),style:et&&ve?U(t,ve.start,ve.end,Ze):null,applyStyle:e=>{if(S)return;const{start:n,end:r}=Xe();if(n===r)return;const l=p({value:t,start:n,end:r,id:e,rules:Ze});l?qe(()=>l):((e,n)=>{be({start:e,end:n}),Ne?Te.current?.setSource(e,n,t):(fe.current?.focus(),fe.current?.setSelectionRange(e,n))})(n,r)}}):"classic"===K?R:void 0:void 0,ft=new Set(_e),gt=L?{value:L.value,allow:L.allow,onChange:L.onChange,disabled:L.disabled}:void 0,yt={pressed:tt,onList:e=>{const{start:n,end:r}=Xe(),l=A(t,n,r,Ze);qe(()=>ee(t,n,r,l===e?null:e,Ze))}},vt=h(ve,t.length),bt=S||Z(t,vt.start,vt.end,Ze).text===t?void 0:{onClear:()=>{const{start:e,end:n}=h(Xe(),t.length);qe(()=>Z(t,e,n,Ze))}},kt=T({offered:ft,color:ht,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt});/* @__PURE__ */
|
|
20
|
+
return oe("div",{ref:ct,className:"es-copy"+(k?` ${k}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===fe.current||Boolean(e.target.closest?.(".es-rich"));if(S||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ye(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&_e.includes(o)&&(e.preventDefault(),e.stopPropagation(),Qe(o))},onPaste:e=>{const n=fe.current;if(S||!n||e.target!==n)return;e.preventDefault();const r=g({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:y,rules:Ze});qe(e=>Le(t,r,e))},style:ie&&ie.length>0?Object.fromEntries(ie.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=fe.current;e&&e.ownerDocument.activeElement===e&&be({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[pt&&(kt.words||kt.paragraph)?
|
|
21
|
+
/* @__PURE__ */ae(O,{className:"es-copy-toolbar","aria-label":F??he.formatting,offered:ft,pressed:Je,onMark:e=>Qe(e),color:ht,linkOpen:null!==Ge,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt,disabled:S,windows:/* @__PURE__ */oe(se,{children:[Be&&ie&&ie.length>0?/* @__PURE__ */ae(m,{colors:ie,current:nt,words:he.colors??x.colors,onPick:e=>{const{start:n,end:r}=Xe();if(n!==r)qe(()=>Q(t,n,r,e,Ze));else{if(!Ne)return;Fe({add:Ke?.add??[],drop:Ke?.drop??[],color:e,at:n})}}}):null,Ge?Ge&&/* @__PURE__ */ae(j,{className:"es-copy-link es-copy-pop",value:Ge.link?.href??"",onApply:e=>{const n=Ge;Ue(null),qe(()=>Ne?re(t,n.start,n.end,e,Ze):le(t,n.start,n.end,e))},onRemove:Ge.link?()=>{const e=Ge.link,n=Ge;Ue(null),e&&qe(()=>Ne?te(t,n.start,n.end,Ze):ne(t,e))}:void 0,onCancel:ot}):null]})}):null,ue&&ue.length>0?/* @__PURE__ */ae(Ve,{cells:ue,words:he.cells??x.cells,readOnly:S}):null,Ne?/* @__PURE__ */ae(je,{value:t,rules:Ze,multiline:y,readOnly:S,placeholder:v,ariaLabel:b,handle:Te,pending:Ke??void 0,onEdit:(e,n,r)=>{ke.record({text:t,start:n.start,end:n.end},r,Date.now()),Fe(null),Se(e)},onSelect:e=>{be(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ke||e.start===Ke.at&&e.end===Ke.at||Fe(null)},onHistory:Ye,onFormat:e=>{_e.includes(e)&&Qe(e)},onCommit:r,onCancel:l}):/* @__PURE__ */ae(De,{value:t,onInput:e=>{ke.record(Ee(null),"type",Date.now()),Se(e)},onCommit:r,onCancel:l,multiline:y,placeholder:v,ariaLabel:b,rules:E,disabled:S,inputRef:fe,className:"es-copy-box"}),B?B({focused:ge,insert:e=>qe(n=>Le(t,e,n))}):null,X&&y?
|
|
22
|
+
/* @__PURE__ */oe("div",{className:"es-copy-marks",children:[
|
|
23
|
+
/* @__PURE__ */ae(e,{checked:we,onChange:()=>{const e=$e();Ae.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ve,Fe(null),Ce(e=>!e)},ariaLabelledBy:Re,disabled:S}),
|
|
24
|
+
/* @__PURE__ */ae("span",{id:Re,className:"es-copy-marks-label",children:he.showMarks??"Show marks"})]}):null]})}var Pe=["none","bullet","number"],ze=t,Ie={none:/* @__PURE__ */ae(ke,{}),bullet:/* @__PURE__ */ae(be,{}),number:/* @__PURE__ */ae(ve,{})},qe={none:/* @__PURE__ */ae(we,{}),upper:/* @__PURE__ */ae(Ee,{}),capitalize:/* @__PURE__ */ae(Se,{}),lower:/* @__PURE__ */ae(xe,{})};function Ye({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
|
|
25
|
+
return ae(w,{label:e,icon:t,children:/* @__PURE__ */ae(C,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function Ae({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=N("copy",x),d=L(R().textToolbar),p=Object.fromEntries(K(F).map(e=>[e.value,e.icon])),h={...x.panel,...u.panel},m=r&&!n?[r.onEditStyles&&{label:h.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:h.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!o&&(o.value??o.styleValue??!1),g=o?/* @__PURE__ */ae(B,{content:h.italic,children:/* @__PURE__ */ae(M,{size:"md",variant:"ghost","aria-label":h.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */ae(ye,{})})}):null;/* @__PURE__ */
|
|
26
|
+
return oe("div",{className:"es-tpp",children:[e?/* @__PURE__ */oe("div",{className:"es-tpp-kept",children:[
|
|
27
|
+
/* @__PURE__ */ae($e,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */ae("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */ae(w,{label:h.style,icon:/* @__PURE__ */ae(pe,{}),children:/* @__PURE__ */ae(E,{ariaLabel:h.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:m,readOnly:n})}):null,l?/* @__PURE__ */ae(w,{label:h.font,icon:/* @__PURE__ */ae(he,{}),children:/* @__PURE__ */oe("div",{className:"es-tpp-font",children:[
|
|
28
|
+
/* @__PURE__ */ae("div",{className:"es-tpp-font-select",children:/* @__PURE__ */ae(E,{ariaLabel:h.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),g]})}):g?
|
|
29
|
+
/* @__PURE__ */ae(w,{label:h.italic,icon:/* @__PURE__ */ae(he,{}),children:/* @__PURE__ */ae("div",{className:"es-tpp-font",children:g})}):null,a?.length?/* @__PURE__ */ae(Ve,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */ae(Ye,{label:u.alignment,icon:/* @__PURE__ */ae(me,{}),answers:F.filter(e=>!s.allow||s.allow.includes(e)),names:d,glyphs:p,row:s,readOnly:n}):null,c?/* @__PURE__ */ae(Ye,{label:h.list,icon:/* @__PURE__ */ae(fe,{}),answers:Pe,names:h.lists,glyphs:Ie,row:c,readOnly:n}):null,i?/* @__PURE__ */ae(Ye,{label:h.capitalization,icon:/* @__PURE__ */ae(ge,{}),answers:ze,names:h.cases,glyphs:qe,row:i,readOnly:n}):null]})}export{Be as COPY_CELLS,$e as CopyBox,Ve as CopyCells,je as RichBox,Ae as TextPartPanel,Le as insertSelection,Oe as markSelection,He as useCaretEdit};
|
package/dist/easel/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
|
|
|
10
10
|
import { TextToolbarProps } from 'efficient-shell/ui';
|
|
11
11
|
import { R as RepeatCopy } from '../copy-place-CQIemdtU.js';
|
|
12
12
|
export { r as repeatCopyAt } from '../copy-place-CQIemdtU.js';
|
|
13
|
-
import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing
|
|
13
|
+
import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing--FlIZwbT.js';
|
|
14
14
|
import { InlineRule } from 'efficient-shell/markup';
|
|
15
15
|
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-igxrnEhq.js';
|
|
16
16
|
import { I as InspectorFields } from '../types-CVHwspYM.js';
|
|
@@ -663,21 +663,59 @@ interface SelectedFields {
|
|
|
663
663
|
node: ResolvableItem;
|
|
664
664
|
/** Its fields, resolved as the old library resolved them (`resolveFields` with the old library's params, parent included). */
|
|
665
665
|
fields: InspectorFields;
|
|
666
|
-
/** What the fields show. */
|
|
666
|
+
/** What the fields show: the stored props, with the writes not landed yet on top. */
|
|
667
667
|
values: Record<string, unknown>;
|
|
668
668
|
/** The block's (or the root's) `edit` permission is off. */
|
|
669
669
|
readOnly: boolean;
|
|
670
|
-
/** Write one field: `resolveData` as the old library ran it, then ONE replace — one undo step. */
|
|
670
|
+
/** Write one field: `resolveData` as the old library ran it, then ONE replace — one undo step. The value goes on the latest node by what it changed from `values`. */
|
|
671
671
|
onChange: (name: string, value: unknown) => void;
|
|
672
672
|
/**
|
|
673
673
|
* Write SEVERAL fields at once: one merged props object, `resolveData` once,
|
|
674
674
|
* ONE replace — one undo step. For a row that sets more than one prop in one
|
|
675
|
-
* click (a padding pair's left AND right).
|
|
676
|
-
*
|
|
677
|
-
*
|
|
675
|
+
* click (a padding pair's left AND right).
|
|
676
|
+
*
|
|
677
|
+
* One node's writes run one at a time, and the writes made while one runs become
|
|
678
|
+
* the next write, in the order they were made. A write that finds the node changed
|
|
679
|
+
* by anything else while its resolver ran runs again on the latest node, and one
|
|
680
|
+
* whose resolver does not answer in `WRITE_WAIT_MS` lands without the answer. A
|
|
681
|
+
* patch built from the node's own value (one key of a stored object, a list with
|
|
682
|
+
* one item changed) must be a function with no side effect: it is called with the
|
|
683
|
+
* latest props on each run and to show the write in `values`, and `null` writes
|
|
684
|
+
* nothing. A plain record replaces those keys with what the caller read.
|
|
678
685
|
*/
|
|
679
|
-
onChangeMany: (patch:
|
|
686
|
+
onChangeMany: (patch: FieldsPatch) => void;
|
|
680
687
|
}
|
|
688
|
+
/** What a write changes: the props, or a function of the node's latest props. */
|
|
689
|
+
type FieldsPatch = Record<string, unknown> | ((latest: Record<string, unknown>) => Record<string, unknown> | null);
|
|
690
|
+
/** Resolves when no node of this easel has a write that has not landed. For a press
|
|
691
|
+
* that reads the document (Publish): a waiting write is not in the store yet. */
|
|
692
|
+
declare function writesSettled(easel: object): Promise<void>;
|
|
693
|
+
/**
|
|
694
|
+
* A press that reads the document (Publish), run once every write of this easel has
|
|
695
|
+
* landed AND this component has rendered since: a host that reads the document of its
|
|
696
|
+
* last render (a ref set in render) then sees what landed, not the render before it.
|
|
697
|
+
* The screen passes its main action and Save now through it ({@link useSettledAction});
|
|
698
|
+
* a layer's own `barMain` goes around the screen and must wait itself. A press
|
|
699
|
+
* made while one waits is ignored, and `waiting` is true until the press runs, so the
|
|
700
|
+
* button is busy. Pass a press that reads the latest action, not the pressed render's.
|
|
701
|
+
* A press pending when the component unmounts does not run.
|
|
702
|
+
*/
|
|
703
|
+
declare function useSettledPress(): {
|
|
704
|
+
run: (press: () => void) => void;
|
|
705
|
+
waiting: boolean;
|
|
706
|
+
};
|
|
707
|
+
/**
|
|
708
|
+
* `action` with its press run by {@link useSettledPress}: busy while it waits, and
|
|
709
|
+
* after the wait the press of the latest render's action runs, not the pressed
|
|
710
|
+
* one's (its closure may hold values from before the writes landed). The screen
|
|
711
|
+
* passes every main action and Save now through it.
|
|
712
|
+
*/
|
|
713
|
+
declare function useSettledAction<A extends {
|
|
714
|
+
onPress: () => void;
|
|
715
|
+
busy?: boolean;
|
|
716
|
+
}>(action: A): A;
|
|
717
|
+
/** Calls `listener` each time a write lands without its resolver's answer. */
|
|
718
|
+
declare function subscribeLateWrites(easel: object, listener: () => void): () => void;
|
|
681
719
|
/**
|
|
682
720
|
* The settings panel's host: the selected node's fields and the write that
|
|
683
721
|
* changes one — what `EmailFields` and `SiteFields` each did against the old library,
|
|
@@ -760,4 +798,4 @@ declare function bindUndoKeys(doc: Document, easel: Pick<Easel, 'undo' | 'redo'>
|
|
|
760
798
|
leaveTyping?: boolean;
|
|
761
799
|
}): () => void;
|
|
762
800
|
|
|
763
|
-
export { CHROME_ATTR, type CanvasChrome, CanvasChromeContext, type CanvasCopyPlace, type CanvasCopyText, CanvasFrame, type CanvasFrameProps, type CanvasOverlay, type CanvasPart, type CanvasParts, CanvasPartsContext, CanvasPassThroughContext, CanvasSharedContext, type CanvasSlotProps, type CanvasTyping, type CanvasTypingState, type CanvasTypingTarget, DEFAULT_UI, type Easel, EaselAction, EaselCanvas, type EaselCanvasProps, EaselConfig, EaselCore, type EaselOptions, EaselProvider, type EaselProviderProps, EaselUi, EaselView, EditDocument, NodeSelection, Permissions, RepeatCopy, RootHostScope, type SelectedFields, bindUndoKeys, createEasel, createUseEasel, partHasOwnBox, recordsByDefault, reduce, uiView, useEasel, useEaselApi, useEaselNodeOps, useRootFields, useSelectedFields, useSelectedHost, validSelection };
|
|
801
|
+
export { CHROME_ATTR, type CanvasChrome, CanvasChromeContext, type CanvasCopyPlace, type CanvasCopyText, CanvasFrame, type CanvasFrameProps, type CanvasOverlay, type CanvasPart, type CanvasParts, CanvasPartsContext, CanvasPassThroughContext, CanvasSharedContext, type CanvasSlotProps, type CanvasTyping, type CanvasTypingState, type CanvasTypingTarget, DEFAULT_UI, type Easel, EaselAction, EaselCanvas, type EaselCanvasProps, EaselConfig, EaselCore, type EaselOptions, EaselProvider, type EaselProviderProps, EaselUi, EaselView, EditDocument, type FieldsPatch, NodeSelection, Permissions, RepeatCopy, RootHostScope, type SelectedFields, bindUndoKeys, createEasel, createUseEasel, partHasOwnBox, recordsByDefault, reduce, subscribeLateWrites, uiView, useEasel, useEaselApi, useEaselNodeOps, useRootFields, useSelectedFields, useSelectedHost, useSettledAction, useSettledPress, validSelection, writesSettled };
|
package/dist/easel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,validSelection}from"../chunk-
|
|
1
|
+
export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,subscribeLateWrites,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,useSettledAction,useSettledPress,validSelection,writesSettled}from"../chunk-NUJEHA6A.js";export{repeatCopyAt}from"../chunk-JQQFB7EZ.js";import"../chunk-TBY3DFKS.js";import"../chunk-K53PQAMP.js";import"../chunk-QTHQPJWA.js";import"../chunk-3BQT7FC7.js";import"../chunk-PMRN5Z3T.js";import"../chunk-MFIRYGHW.js";import"../chunk-TOKMFZPB.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-7U4HEUZM.js";import"../../chunk-RUQOIQWI.js";import"../../chunk-L4DFCNDQ.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-C4TJN6GR.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-NUJEHA6A.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-WMC6FE3G.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-D4TH4QQR.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-3BQT7FC7.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";
|