efficient-easel 6.3.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{canvas-typing-Dec_zyuM.d.ts → canvas-typing-U7TV-iax.d.ts} +16 -1
- package/dist/{chunk-H3WBX7FN.js → chunk-4UJ6CPLO.js} +1 -1
- package/dist/{chunk-I6U2G7L4.js → chunk-57NRNFLO.js} +1 -1
- package/dist/chunk-5PUEZ22M.js +1 -0
- package/dist/chunk-CIHKZMNR.js +1 -0
- package/dist/{chunk-X4OF36J2.js → chunk-CRWFB7MU.js} +11 -11
- package/dist/{chunk-CJBU4E4L.js → chunk-ESQZG7B3.js} +1 -1
- package/dist/{chunk-HAUTMX4H.js → chunk-GIP45GWF.js} +48 -48
- package/dist/{chunk-AYNU4FYF.js → chunk-HFW6D46X.js} +1 -1
- package/dist/chunk-M5VRWM7M.js +11 -0
- package/dist/chunk-NAGDOIW4.js +5 -0
- package/dist/{chunk-DQLK3QQ2.js → chunk-Q2L6YTII.js} +1 -1
- package/dist/{chunk-PRRFBVJ2.js → chunk-T5ORM737.js} +3 -3
- package/dist/chunk-TBY3DFKS.js +1 -0
- package/dist/{chunk-FXJBKKGI.js → chunk-TCVTMNYE.js} +1 -1
- package/dist/{chunk-QPQXKKSC.js → chunk-UY7BCB32.js} +1 -1
- package/dist/chunk-ZR4CFNMW.js +5 -0
- package/dist/copy/index.d.ts +1 -1
- package/dist/copy/index.js +18 -18
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +13 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/catalogue.d.ts +5 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AELNNAFM.js +0 -1
- package/dist/chunk-B4ZNYLZX.js +0 -5
- package/dist/chunk-DSUMM2WF.js +0 -10
- package/dist/chunk-EXCKAZKN.js +0 -5
- package/dist/chunk-JIWPANGM.js +0 -1
- package/dist/chunk-T5HFGW57.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{AddBlockRow as e}from"../../chunk-
|
|
2
|
-
return
|
|
3
|
-
return V
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
return
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
return V
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
1
|
+
import{AddBlockRow as e}from"../../chunk-ESQZG7B3.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-UY7BCB32.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-6TOYXESC.js";import{usePartBridge as c}from"../../chunk-5PUEZ22M.js";import{useSectionOps as p}from"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-WZMU646D.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-Q2L6YTII.js";import{SELECTION_MODE as d,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as f,useStandaloneScreenBridges as j,useScreenBlockLook as y,useScreenBlockRules as S}from"../../chunk-ZR4CFNMW.js";import{nestsInTree as N,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as M,usePanelPick as x,useCancelPanelPick as A}from"../../chunk-R6WTQWAC.js";import{useHostEscape as B}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as R}from"../../chunk-MCHMF32I.js";import{useEasel as v}from"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as O,Subtree as F,TreeRow as P,TreeRowAction as W,TreeSeam as T}from"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as g}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-BDTITTMW.js";import{DEFAULT_SAVE_WORDS as w,saveIndicator as z}from"../../chunk-H6DDIBQ4.js";import{SaveState as L,panelWidthVars as b}from"../../chunk-UB4TLWVJ.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import{useWords as E}from"../../chunk-MFIRYGHW.js";import"../../chunk-HFW6D46X.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as Y}from"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as H,parseZoneKey as D}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as I,useRef as Z,useEffect as J,useCallback as K,Fragment as V}from"react";import{Tooltip as U}from"efficient-shell/ui";import{TrashIcon as X}from"efficient-shell/icons/efficient";import{jsxs as G,jsx as Q,Fragment as $}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=l(),re=p(),{appState:te,selectedItem:se,config:ie}=v(e=>e),[ce,pe]=I(d),le=E("screen",R),me=E("tree",g),de=E("save",w),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),ye=te.data.content?.[0]??null,Se=ye?.props.id??null,Ne=ye?.type===ae,Ce=ye?.type===ue,Me=Z(null),xe=Z(null);t(xe);const Ae=M(),Be=x(),Re=A();k(se?.props.id),J(()=>{const e=xe.current;if(!Be||!e)return;const n=e=>{"Escape"===e.key&&Re()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Be]),B(null!==Be,()=>Re()),J(()=>{Se&&Me.current!==Se&&(Me.current=Se,Ne?pe(ke??d):se||re.select({index:0}))},[Se,se,re,Ne]);const ve=K(e=>pe(n=>f(n,e)?n:e),[]),Oe=j({kind:ce.kind,mode:ce,open:ve,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:Fe}=c({mode:ce,setMode:pe,onOpenPart:o}),Pe=y(),{labelAtLevel:We,Icon:Te}=Pe,{canAddTo:ge}=S(),we=e=>We(e,"block",ie.components[e]?.label??e),ze=e=>We(e,"section",we(e)),Le=!Ne&&"puck"===ce.kind&&se?.props.id===Se,be=ye?ge(ye.type)?.spec??null:null,Ee=ye&&be?`${ye.props.id}:${be.slot}`:null,Ye=ye&&be&&Array.isArray(ye.props[be.slot])?ye.props[be.slot]:[],He=e=>n(e,we,Pe.plainText),De=(e,n)=>{ye&&be&&Ee&&(pe(d),be.slider?(r(String(ye.props.id),e),re.select({index:e,zone:Ee}),o(String(ye.props.id))):(re.select({index:e,zone:Ee}),o(n)))},Ie=()=>{if(!ye||!be||!Ee)return;const e=Ye.length;re.insertComponent(Ee,be.childType,e),pe(d),be.slider?requestAnimationFrame(()=>{r(String(ye.props.id),e),re.select({index:e,zone:Ee})}):re.select({index:e,zone:Ee})},Ze=e=>C(ie,e),Je=e=>{const{parentId:n,slot:o}=D(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Ze(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(ye)?.props[o];return Array.isArray(t)?t.length:0},Ke=(e,n,o)=>{const r=Math.min(Math.max(o,0),Je(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Ve=Y({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>H(n)===e.zone&&n.index>=0&&n.index<=Je(e.zone),onDrop:(e,n)=>Ke(e.zone,e.index,n.index),onStep:(e,n)=>Ke(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ue=(e,n)=>/* @__PURE__ */Q(T,{...ne?{}:Ve.seam({place:{...D(e),index:n}})},`seam:${e}:${n}`),Xe=e=>Pe.blockRowName(e,we),Ge=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},Qe=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},$e=(n,o,r)=>/* @__PURE__ */Q(e,{choices:r,onPick:e=>Qe(n,e,o)}),qe=(e,n)=>{const o=Ze((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=ge(e.type),s=t?.choices??null,i="footer"===t?.source?Xe:He;/* @__PURE__ */
|
|
2
|
+
return G($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=N(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Ge(o,r,p),{rowProps:m,...a}=Ve.row({item:{id:p,zone:o,index:r},place:{...D(o),index:r}},{onClick:q(l)});/* @__PURE__ */
|
|
3
|
+
return G(V,{children:[0===r&&Ue(o,0),
|
|
4
|
+
/* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */Q(W,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(d),void re.select(null);var e,n},children:/* @__PURE__ */Q(X,{size:13})}),rowProps:m}),s&&/* @__PURE__ */Q(F,{children:qe(e,n+1)}),Ue(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?$e(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===ye?.type,en=Boolean(ye)&&(Boolean(be)||Ce||Ne||_e);/* @__PURE__ */
|
|
5
|
+
return G("div",{ref:xe,className:"sf-editor es-editor",style:b(i),children:[
|
|
6
|
+
/* @__PURE__ */Q("div",{className:"sf-section-bar",children:/* @__PURE__ */Q(L,null!==oe?{tone:"off",label:oe,role:"status"}:{...z(ee,de),role:"status"})}),
|
|
7
|
+
/* @__PURE__ */G("div",{className:"sf-body",children:[Be&&Ae?/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */Q(m,{panel:Ae,pick:Be})}):en&&ye&&/* @__PURE__ */G("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
+
/* @__PURE__ */Q("div",{className:"sf-panel-head",children:/* @__PURE__ */Q(U,{content:Ne?le.headerSettings:le.sectionSettings({name:ze(ye.type)}),side:"bottom",children:/* @__PURE__ */Q("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Le?"is-selected":""),"aria-pressed":Le,onClick:()=>{Ne?pe(ke??d):(pe(d),re.select({index:0}))},children:ze(ye.type)})})}),
|
|
9
|
+
/* @__PURE__ */Q(O,{className:"sf-tree sf-scroll",rootProps:Ve.rootProps(),words:me,children:/* @__PURE__ */Q(F,{children:Ne?
|
|
10
|
+
/* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):be?/* @__PURE__ */G($,{children:[Ye.map((e,n)=>{const o=se?.props.id===e.props.id,r=He(e),t=String(e.props.id),s=()=>De(n,t),{rowProps:i,...c}=Ve.row({item:{id:t,zone:Ee,index:n},place:{...D(Ee),index:n}},{onClick:q(s)});/* @__PURE__ */
|
|
11
|
+
return G(V,{children:[0===n&&Ue(Ee,0),
|
|
12
|
+
/* @__PURE__ */Q(P,{words:me,icon:/* @__PURE__ */Q(Te,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */Q(W,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(Ee&&(re.removeComponent(Ee,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */Q(X,{size:13})}),rowProps:i}),Ue(Ee,n+1)]},String(e.props.id??n))}),
|
|
13
|
+
/* @__PURE__ */G("button",{type:"button",className:"sf-add-card",onClick:Ie,children:[
|
|
14
|
+
/* @__PURE__ */Q("span",{className:"sf-plus sf-plus--sm",children:"+"}),be.addLabel]}),Se?Oe.partRows?.(ye,_):null]}):qe(ye,1)})})]}),
|
|
15
|
+
/* @__PURE__ */Q("div",{className:"sf-center",children:/* @__PURE__ */Q("div",{className:"sf-preview-host",children:/* @__PURE__ */Q(fe,{})})}),
|
|
16
|
+
/* @__PURE__ */Q(s,{value:{selectChild:(e,n,o,r)=>"section"===ge(r)?.source?De(n,o):Ge(e,n,o),addChild:(e,n,o,r,t)=>"section"===ge(t)?.source?Ie():Qe(`${e}:${n}`,o,r),childRowName:He,blockRowName:Xe},children:/* @__PURE__ */Q(je,{mode:ce,onOpenWebsiteSettings:Oe.openSettings??(()=>{}),onSelectNode:Fe,hideNodeActions:!0})})]})]})}export{ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-5PUEZ22M.js";import"../../chunk-57NRNFLO.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/dist/screen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-
|
|
1
|
+
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-T5ORM737.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-4UJ6CPLO.js";import"../chunk-GIP45GWF.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-UY7BCB32.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-5PUEZ22M.js";import"../chunk-57NRNFLO.js";import"../chunk-IYT6NN2J.js";import"../chunk-LVUDUQNL.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-NAGDOIW4.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-Q2L6YTII.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-ZR4CFNMW.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-M5VRWM7M.js";import"../chunk-TBY3DFKS.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-CIHKZMNR.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-HFW6D46X.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-AWJUYMX7.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-
|
|
1
|
+
export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-UY7BCB32.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-57NRNFLO.js";import"../../../chunk-ZR4CFNMW.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-M5VRWM7M.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-CRWFB7MU.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-3ZJSLHHI.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-UK2FQOUT.js";import"../../../chunk-CIHKZMNR.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-546BBOPE.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-AWJUYMX7.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-ZR4CFNMW.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-M5VRWM7M.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-CIHKZMNR.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-AWJUYMX7.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -22,14 +22,17 @@ import '../markup/index.js';
|
|
|
22
22
|
import '../buckets-Tj-nkBpg.js';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* The easel canvas's own words (`efficient-easel/strings`, 0.95.0)
|
|
26
|
-
*
|
|
25
|
+
* The easel canvas's own words (`efficient-easel/strings`, 0.95.0): what the
|
|
26
|
+
* frame is called when the host does not name it (`title`), and the name of
|
|
27
|
+
* the bar of text tools that floats above words typed on the canvas.
|
|
27
28
|
*
|
|
28
29
|
* A plain module with no import.
|
|
29
30
|
*/
|
|
30
31
|
type CanvasWords = {
|
|
31
32
|
/** The canvas frame's accessible name. */
|
|
32
33
|
frame: string;
|
|
34
|
+
/** The floating bar of text tools over the words being typed (its group's name). */
|
|
35
|
+
textTools: string;
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-
|
|
1
|
+
export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-TCVTMNYE.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-TBY3DFKS.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-AUT242JK.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";
|
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-
|
|
1
|
+
import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-TCVTMNYE.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-TCVTMNYE.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-TBY3DFKS.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-AUT242JK.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import"../chunk-O2NLQBFX.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
|
|
2
2
|
return i(e.Provider,{value:k,children:m})}function u(){return t(o())?.strings??r}function m(){return t(o())?.locale??"en"}export{s as EaselStringsProvider,m as useEaselLocale,u as useEaselStrings};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-AELNNAFM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a={frame:"Canvas"};export{a as DEFAULT_CANVAS_WORDS};
|
package/dist/chunk-B4ZNYLZX.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-EXCKAZKN.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-DSUMM2WF.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as F,Fragment as N}from"react/jsx-runtime";var B=e=>`section:${e}`,O=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:x,at:A,onAdd:V,itemFor:C,session:H,siteWide:L,onClose:M,onHide:D,readOnly:P}){const Y=f(e=>e.config),w=p(),{labelAtLevel:K,categoryLabel:Q,firstSection:R,Icon:S,Thumbnail:T}=w,{blockIsOffered:W}=m(),Z=u("screen",d).add,z=u("drag",h).add,E=l(),[U,X]=y([]);b(()=>{let t=!1;const o=e=>W(e,E);return s(E).list().then(n=>{if(t)return;const i=Y.components;X(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Y,E]);const G=j(()=>t(Y,w),[Y]),J=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */$(T,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:O(e.type),label:e.label,icon:/* @__PURE__ */$(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),x)return e;const t=o(G,R);t&&e.push({key:"start",title:Z.startBlank,tiles:[J(t)]}),U.length>0&&e.push({key:"templates",title:Z.templates,tiles:U.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */$(T,{type:e.node.type}),keywords:[(t=e.node.type,K(t,"section",Y.components[t]?.label??t)),e.node.type]};var t})});const s=n(G,R);for(const t of Object.keys(Y.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Y,t,Q),tiles:o.map(J)})}return e},[I,x,U,G,Y,Z]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=U.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return F(N,{children:[
|
|
3
|
-
/* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:Z.title,context:x?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */$(c,{label:Z.done,description:Z.doneDescription,onClick:M}),onHide:D}),
|
|
4
|
-
/* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */$(k,{groups:q,session:H,itemFor:e=>C(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&V(t)},at:A,hint:x?Z.hintBlocks:Z.hint,searchLabel:x?Z.searchBlocks:Z.searchSections,readOnly:P,words:z}),L&&!x?L:null]})]})}export{I as AddSidePanel,O as blockKey,B as sectionKey,v as templateKey};
|
package/dist/chunk-DSUMM2WF.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as a}from"./chunk-UK2FQOUT.js";import{startCanvasTyping as s,textMap as l}from"./chunk-JIWPANGM.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as u,CANVAS_TYPING_EVENT as p}from"./chunk-AWJUYMX7.js";import{find as f,ROOT_ID as m,getList as h,remove as v,parseZoneKey as y,move as g,duplicate as k,replaceNode as w,createNode as b,insert as S,normalizeData as I,createResolveCache as C,resolveNodeData as E,ROOT_SLOT as x}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as D,fieldsFrom as O,defaultsFrom as A}from"./chunk-NKB3KVAB.js";import{createContext as M,useEffect as P,useContext as N,useRef as z,useSyncExternalStore as K,useState as $,useMemo as j,useCallback as Z,useLayoutEffect as R}from"react";import{jsx as B,jsxs as L}from"react/jsx-runtime";import{createPortal as F}from"react-dom";function V(e){return!["setData","setUi","set"].includes(e.type)}var H=(e,t,n,o)=>{const r=h(e,t,y(n));return r?.[o]??null},T=(e,t,n,o,r)=>{const i=H(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function U(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function W(e,t,n){return n?"node"===n.kind?f(e,t,n.id)?n:null:n.parentId===m?h(e,t,n)?n:null:f(e,t,n.parentId)&&h(e,t,n)?n:null:null}function Y(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let l=e.selection;var c;return"itemSelector"in n&&(l=o(e.data,t,i??null)),"selectedSlot"in n&&(a?l=(c=a)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===l?.kind&&(l=null)),{...e,selection:l,ui:r?s:{...e.ui,...s}}}function q(e,t,n){const o=X(e,t,n);if(o===e)return e;const r=W(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function X(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return Y(e,n,"function"==typeof t.ui?t.ui(U(e,n)):t.ui);case"set":{const r={data:o,ui:U(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=Y(a,n,i.ui,!0)),a}case"insert":{const r={...y(t.destinationZone),index:t.destinationIndex},i=b(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:S(o,n,r,i)}}case"replace":{const r=T(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:w(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=T(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=k(o,n,r.props.id),a=H(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return X(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=H(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...y(t.destinationZone),index:t.destinationIndex};return{...e,data:g(o,n,r.props.id,i)}}case"remove":{const r=T(o,n,t.zone,t.index,"remove");return{...e,data:v(o,n,r.props.id)}}default:return e}}var G={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},J={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Q=0,_=()=>`history-${Q+=1}`;function ee(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=I(e.data,t);let l={data:s,selection:null,ui:{...J}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;l={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...J,...i}}}let c=[{core:l,at:-1/0,sealed:!0,id:_()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:l,at:n}]:(c=[...c.slice(0,d+1),{core:l,at:n,sealed:e,id:_()}],d=c.length-1)},p=/* @__PURE__ */new Set;let m=null,v=null,y=0,g=null,k=!1;const b=()=>{for(const e of[...p])e()},S=()=>{c=[...c.slice(0,d),{...c[d],core:l},...c.slice(d+1)]},x=(t,n)=>{y>0?k=k||n:(n?u(!1):l!==t&&S(),l.data!==t.data&&e.onChange?.(l.data),l!==t&&b())},D=e=>{const n=l;if(l=q(l,e,t),l===n)return;const o=e.recordHistory??V(e);x(n,o&&l.data!==n.data)},O=t=>{0===y&&(g=l,k=!1),y+=1;try{t()}catch(e){throw y-=1,0===y&&g&&(l=g,g=null),e}if(y-=1,y>0||!g)return;const n=g;g=null,k&&l.data!==n.data?u(!0):l!==n&&S(),l.data!==n.data&&e.onChange?.(l.data),l!==n&&b()},A=e=>{const n=l,o=W(l.data,t,e);var r,i;(r=o,i=l.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(l={...l,selection:o},x(n,!1))},M=t=>{const n=l;d=t,l=c[d].core,l.data!==n.data&&e.onChange?.(l.data),l!==n&&b()},P=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...G,...a,...n}};let N=P();const z=C(),K={resolveCache:z,async resolveAll({trigger:e="load",metadata:n}={}){const o=l.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[a,...s]=await Promise.all([E(r,t,{cache:z,trigger:e,metadata:n}),...i.map(o=>E(o,t,{cache:z,trigger:e,metadata:n}))]);O(()=>{const e=l;let n=l.data;s.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,s=f(n,t,a)?.node;s&&s===f(o,t,a)?.node&&(n=w(n,t,a,e.node))}),a.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:a.node.props,readOnly:a.node.readOnly??n.root.readOnly}}),n!==l.data&&(l={...l,data:n,selection:W(n,t,l.selection)},x(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=f(l.data,t,e)?.node;if(!r)return!1;const i=await E(r,t,{cache:z,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return O(()=>{const n=l;if(f(l.data,t,e)?.node!==r)return;const o=w(l.data,t,e,i.node);o!==l.data&&(l={...l,data:o,selection:W(o,t,l.selection)},x(n,!1),a=!0)}),a},get config(){return t},getState(){if(m&&v===l)return m;const e=l,o={data:e.data,ui:U(e,t)},r="node"===e.selection?.kind?f(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:D,history:{back:()=>K.undo(),forward:()=>K.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:U(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&M(e)}},getPermissions:N,getItemById:n=>f(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return h(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},v=e,m},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:D,batch:O,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>A(e?{kind:"node",id:e}:null),selectSlot:e=>A(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){O(()=>{const n=l,o=void 0===e.select?l.selection:e.select;l={...l,data:e.data,selection:W(e.data,t,o)},x(n,e.data!==n.data)})},load(e,n={}){const o=l,r=I(e,t);l={...l,data:r,selection:W(r,t,n.selection??l.selection)},n.keepHistory||(c=[{core:l,at:-1/0,sealed:!0,id:_()}],d=0),l!==o&&b()},undo(){d>0&&M(d-1)},redo(){d<c.length-1&&M(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,a)||(a=e,N=P(),m=null,b())},setConfig(e){e!==t&&(t=e,N=P(),m=null,b())}};return K}function te(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&u(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ne=M(null),oe=M(!0);function re({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return P(()=>{n&&e.resolveAll()},[e,n]),P(()=>{if(t&&"undefined"!=typeof document)return te(document,e)},[e,t]),/* @__PURE__ */B(ne.Provider,{value:e,children:/* @__PURE__ */B(oe.Provider,{value:t,children:o})})}function ie(){const e=N(ne);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ae(e){const t=ie(),n=z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return K(t.subscribe,o,o)}function se(){return function(e){return ae(e)}}var le="data-puck-component",ce="data-puck-dropzone",de={},ue="data-es-mirror",pe="undefined"==typeof window?P:R;function fe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${ue}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(ue,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function me({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:a=!0,onDocument:s,height:l="auto",nonce:u}){const p=c("canvas",e),f=z(null),[m,h]=$(null);return pe(()=>{const e=f.current,t=m?.ownerDocument.defaultView;if("auto"!==l||!e||!m||!t)return;const n=()=>{e.style.height=`${Math.ceil(m.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(m),()=>r?.disconnect()},[m,l]),pe(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===l&&t.classList.add("es-frame-fill"),e.body.appendChild(t),d(e,u),h(t),s?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){fe(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>fe(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),h(null),s?.(null)}},[]),/* @__PURE__ */B("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===l?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:m?F(t,m):null})}var he=M(null),ve=M(de),ye=[];function ge({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const a=ie(),s=ae(n=>h(n.appState.data,a.config,{parentId:e,slot:t})??ye),l=ae(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==m),c=ae(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=N(he),u=["es-zone"];return s.length&&u.push("has-children"),e===m&&u.push("is-root"),(l||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==m&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */B("div",{className:u.join(" "),[ce]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */B(be,{node:e},e.props.id))})}function ke(e,t,n,o){const r="root"===t?e.root:e.components[t],i={...o};for(const e of D(O(r)))i[e]=function(t={}){/* @__PURE__ */
|
|
2
|
-
return B(ge,{parentId:n,slot:e,...t})};return i}function we(e){return function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return B(ge,{parentId:e,slot:t,...n})}}function be({node:e}){const t=ie().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=z(null);return j(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(le),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(le,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),i=N(ve);if(!n?.render)return null;const a=n.render,s=ke(t,e.type,o,{...A(n),...e.props}),l={renderDropZone:we(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...i,...n.metadata}};return n.inline?/* @__PURE__ */B(a,{...s,puck:l,editMode:!0}):/* @__PURE__ */B("div",{[le]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */B(a,{...s,puck:l,editMode:!0})})}function Se({metadata:e}){const t=ae(e=>e.config),n=ae(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */B(ge,{parentId:m,slot:x}),i=o?/* @__PURE__ */B(o,{id:"puck-root",...ke(t,"root",m,n),puck:{renderDropZone:we(m),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
|
|
4
|
-
return B(ve.Provider,{value:e??de,children:i})}function Ie(e,t,n){const[o,r]=$(null),i=z(t);return i.current=t,pe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const a=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(a))};a();const l="MutationObserver"in n?new n.MutationObserver(s):null;l?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{l?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Ce({id:e,kind:t,overlay:n}){const o=z(null),r=Ie(o,e?t=>t.querySelector(`[${le}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */B("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */B(n,{componentId:e,kind:t,children:i}):i}function Ee(e,t){const n=l(e),o=n.text.length,r=e.ownerDocument;if(!t)return[o,o];let i=null;const a=r.caretPositionFromPoint?.(t.x,t.y);if(a&&e.contains(a.offsetNode))i=n.at(a.offsetNode,a.offset);else{const o=r.caretRangeFromPoint?.(t.x,t.y);o&&e.contains(o.startContainer)&&(i=n.at(o.startContainer,o.startOffset))}if(null===i)return[o,o];const s=n.text;let c=i,d=i;for(;c>0&&!/\s/.test(s[c-1]);)c-=1;for(;d<s.length&&!/\s/.test(s[d]);)d+=1;return[c,d]}function xe({element:e}){const t=z(null),n=Ie(t,()=>e(),e);/* @__PURE__ */
|
|
5
|
-
return B("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function De({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:l,height:c,title:d,nonce:u,hotkeys:f,frameWrapper:m,overlay:h,children:v,typing:y}){const g=ie(),k=N(oe),w=f??k,[b,S]=$(void 0),I=ae(e=>"node"===e.selection?.kind?e.selection.id:null),[C,E]=$(null),[x,D]=$(null),O=z(null),A=z(y);A.current=y;const M=z(null),K=e=>{const t=M.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(p,{detail:{typing:e}}))},j=(e,t)=>{O.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=g.group(),r=e.element,i=s({element:r,value:e.value,rules:e.rules,multiline:e.multiline,caret:Ee(n,t),write:e.write,remount:e.remount,end:e=>{o.close(),O.current?.element===r&&(O.current=null),D(null),K(!1),A.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const a=n.closest?.(`[${le}]`)?.getAttribute(le);return a&&g.select(a),O.current={s:i,element:r},D(()=>r),E(null),K(!0),A.current?.onChange?.({typing:!0,element:n}),!0};P(()=>()=>O.current?.s.stop("stop"),[]);const Z=e=>{const t=O.current?.element();return Boolean(t&&t.contains(e))},R=e=>{const t=e.closest?.(`[${le}]`)?.getAttribute(le);if(!t)return;const n=g.getState(),o="node"===n.selection?.kind?n.selection.id:null;return a(n.appState.data,g.config,t,o)??t},F=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(O.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button, a[href]"))return;const n=A.current?.atSelection?.();n&&j(n,null)&&e.preventDefault()},V=/* @__PURE__ */L("div",{ref:M,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),O.current){if(Z(t))return;O.current.s.stop("outside")}const n=R(t);void 0===n?t.hasAttribute?.(ce)||g.select(null):g.select(n)},onDoubleClick:e=>{const t=A.current;if(!t||Z(e.target))return;const n=t.at(e.target);n&&j(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>F(e),onMouseOver:e=>{if(O.current)return;const t=R(e.target)??null;t!==C&&E(t)},onMouseLeave:()=>E(null),children:[
|
|
6
|
-
/* @__PURE__ */B(he.Provider,{value:C,children:/* @__PURE__ */B(Se,{metadata:o})}),
|
|
7
|
-
/* @__PURE__ */L("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
8
|
-
/* @__PURE__ */B(Ce,{id:!x&&C&&C!==I?C:null,kind:"hover",overlay:h}),
|
|
9
|
-
/* @__PURE__ */B(Ce,{id:x?null:I,kind:"selected",overlay:h}),x?/* @__PURE__ */B(xe,{element:x}):null]}),v]}),H=m?/* @__PURE__ */B(m,{document:b,children:V}):V;P(()=>{if(b&&w)return te(b,g)},[b,w,g]),P(()=>{if(!b)return;const e=e=>{if("Enter"===e.key)return void F(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=g.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,g.config,n.selection);"node"===o?.kind&&g.select(o.id)};return b.addEventListener("keydown",e),()=>b.removeEventListener("keydown",e)},[b,g]);/* @__PURE__ */
|
|
10
|
-
return B("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"","data-es-typing":x?"":void 0,children:e?/* @__PURE__ */B(me,{mirrorStyles:r,onDocument:e=>{S(e??void 0),l?.(e)},height:c,title:d,nonce:u,children:H}):/* @__PURE__ */B("div",{id:"preview-frame","data-puck-entry":"",children:H})})}function Oe(e={}){const t=ie(),n=ae(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ae(){const e=ie(),n=ae(e=>e.config),o=e.resolveCache,r=ae(e=>e.selectedItem),i=ae(e=>e.appState.data.root),a=r?r.props.id:"root",s=i.props??{},l=j(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?f(d.appState.data,n,a):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,m=p?d.getItemById(p)??null:null,{fields:h}=t({id:a,node:l,block:c,parent:m,appState:d.appState}),v=ae(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),y=Z((t,r)=>{(async()=>{const i=e.getState();if("root"!==a){const s=i.getItemById(a),l=i.getSelectorForId(a);if(!s||!l)return;const c={...s,props:{...s.props,[t]:r}},{node:d}=await E(c,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(a);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:d})}const s=i.appState.data.root.props??{},{node:l}=await E({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:l.props,readOnly:l.readOnly},recordHistory:!0})})()},[e,n,o,a]);return{id:a,node:l,fields:h,values:l.props,readOnly:v,onChange:y}}export{me as CanvasFrame,J as DEFAULT_UI,De as EaselCanvas,re as EaselProvider,Se as EditDocument,te as bindUndoKeys,ee as createEasel,se as createUseEasel,V as recordsByDefault,q as reduce,U as uiView,ae as useEasel,ie as useEaselApi,Oe as useEaselNodeOps,Ae as useSelectedFields,W as validSelection};
|
package/dist/chunk-EXCKAZKN.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-DSUMM2WF.js";import{Inspector as i}from"./chunk-X4OF36J2.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function D(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function F({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(P.Provider,{value:n,children:e})}function G(){return u(P)}function N(){return(G().useOwnerName??g)()}function x(){return(G().useDocumentLabel??y)()}function B(n,e,t,r){return(G().useBridges??v)(n,e,t,r)}function I(n){return(G().useStandaloneBridges??v)(n)}function T(n,e){(G().useDocumentPass??b)(n,e)}function A(){return G().blockRules??O}function R(){return G().blockLook??j}function W(){return G().devices??w}function K(){return G().leftView??L}function M(){return G().pinned??S}function V(){return G().saveSwitch??!0}function E(n){e(!0===G().pickFollowsSelection,n)}function H(){return G().add??h}function J(){return G().storageNamespace||void 0}function Q(){return G().styleClipboard??null}function U(){return G().nodeKeys??!0}function X(){return G().notify??null}function Y(){return G().Canvas??C}function Z(){return G().CanvasHead??null}function q(){return G().canvasDrag??null}var z=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(z.Provider,{value:n,children:e})}function _(){return u(z)}function nn(){return G().Inspector??D}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,F as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,H as useScreenAdd,R as useScreenBlockLook,A as useScreenBlockRules,B as useScreenBridges,q as useScreenCanvasDrag,Y as useScreenCanvasFrame,Z as useScreenCanvasHead,_ as useScreenCanvasTarget,W as useScreenDevices,x as useScreenDocumentLabel,T as useScreenDocumentPass,nn as useScreenInspectorPanel,K as useScreenLeftView,U as useScreenNodeKeys,X as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,E as useScreenPickFollowsSelection,M as useScreenPinned,V as useScreenSaveSwitch,J as useScreenStorageNamespace,Q as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
package/dist/chunk-JIWPANGM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,isSafeLinkHref as o,toggleMark as i}from"./chunk-546BBOPE.js";var a=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),s=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function c(l,i){const c=i.rules??t,d=l.html&&""!==l.html.trim()?function(t,l,i){const c=l.createElement("template");c.innerHTML=t;const d=[[]],h=()=>d[d.length-1],f=()=>{const t=h();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&d.push([])},m=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=h();" "===t&&(0===o.length&&d.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,i=1===t.nodeType?l.localName:"";if(a.has(i))return;if("br"===i)return void d.push([]);let c=e,u=n,p=r;if("b"!==i&&"strong"!==i||(c=!0),"i"!==i&&"em"!==i||(u=!0),"a"===i){const t=(l.getAttribute("href")??"").trim();p=o(t)?t:null}const g=1===t.nodeType?l.style:null;if(g){const t=g.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?c=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(c=!1),"italic"===g.fontStyle||"oblique"===g.fontStyle?u=!0:"normal"===g.fontStyle&&(u=!1)}const b=s.has(i);b&&f();for(const e of[...t.childNodes])m(e,c,u,p);b&&f()};m(c.content,!1,!1,null);for(;d.length>1&&0===d[d.length-1].length;)d.pop();return d.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=u(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],r(s,l)))return s}return t.map(t=>t.ch).join("")}(t,i))}(l.html,i.doc,c):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return i.multiline?d.join("\n"):1===d.length?d[0]:d.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function u(t,e,n,r){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),a=e?.[c]?a??l(++o,"bold"):null,s=n?.[c]?s??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var d="application/x-efficient-markup",h=/^([0-9]{1,3})\. $/;function f(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const a=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:h.exec(n[e]),a=t.bullet||r,s=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,f={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,f});return{lines:a,text:a.map(t=>t.text).join("\n")}}function m(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function p(t,e){const[n,r]=m(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function g(t,e){const[n,r]=m(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return p(t,e)}function b(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function k(t,e,n){return[b(t,e),b(t,n)]}function x(t,e,n){return e===n?[p(t,e),p(t,e)]:[g(t,e),p(t,n)]}function y(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function v(t,o,i,a,s){const c=f(t,o),[u,d,h]=m(c,Math.min(i,a)),[p,g,b]=m(c,Math.max(i,a)),k=y(u,d),x=y(p,g),v=u.chars.slice(0,k),D=p.chars.slice(x),w=i!==a&&u.chars[k]&&(h!==b||k<x)?u.chars[k].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,k);let T=(A=c.lines,Math.max(0,...A.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var A;const M=t=>{let e;if(void 0!==s.markup){const t=T;e=r(s.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(s.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...v,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...D]}}else l.chars.push(...D);return{lines:[...c.lines.slice(0,h).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(b+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},N=void 0!==s.markup?[null]:[(t=>{let e=t.filter(t=>!s.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of s.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(T++,t);n&&(e=[...e,n])}if(void 0!==s.color){e=e.filter(t=>"color"!==t.kind);const t=null===s.color?null:l(T++,"color",s.color);t&&(e=[...e,t])}return e})(w),w,[]];let S="",B="";for(const t of N){const r=M(t),l=e(r.lines).text;if(S=l,B=r.shown,n(r.lines,f(l,o).lines))break}return{text:S,caret:Math.min(i,a)+B.length}}function D(t,e,n,r){const l=f(t,e),[o,,i]=m(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?v(t,e,n,r,{text:"\n"}):w(t,e,i,!1,n)}function w(t,n,r,l,o){const i=f(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function T(t,n,r,l){const o=f(t,n),[i,a,s]=m(o,Math.min(r,l)),[c,u,d]=m(o,Math.max(r,l)),h=o.lines.slice(s,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?y(i,a):0,o=r===d-s?y(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(h).text}function A(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function M(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,a]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,a]=t.target);const s=[i,a];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:D(e,n,i,a),range:s}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let u=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=c({html:t.html??void 0,text:u},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:v(e,n,i,a,{markup:l}),range:s}}return r||(u=u.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:v(e,n,i,a,{text:u,add:o?.add,drop:o?.drop,color:o?.color}),range:s}}if(l.startsWith("delete")){const t=f(e,n),r=t.text;if(i===a){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:w(e,n,c,!1,i),range:s};if(o?0===i:i===r.length)return null;o?i=A(r,i,-1):a=A(r,a,1)}return{kind:"type",edit:v(e,n,i,a,{text:""}),range:[i,a]}}return null}var N=1e3;function S(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,a){const s="type"===i&&"type"===r&&a-l<1e3;r=i,l=a,n=[],s||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var B=/^(block|list-item|flex|grid|table|flow-root)$/;function E(t){const e=t.ownerDocument.defaultView;return!!e&&B.test(e.getComputedStyle(t).display)}function j(t){const e=[],n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let l="",o=!1;const i=()=>{o&&(l+="\n",o=!1)},a=t=>{for(const s of Array.from(t.childNodes)){if(3===s.nodeType){s.data.length>0&&i(),n.set(s,l.length),e.push({node:s,start:l.length,length:s.data.length}),l+=s.data,r.set(s,l.length);continue}if(1!==s.nodeType)continue;const t=s;if("BR"===t.tagName){i(),n.set(t,l.length),l+="\n",r.set(t,l.length);continue}const c=E(t);c&&((o||l.length>0&&!l.endsWith("\n"))&&(l+="\n"),o=!1),n.set(t,l.length);const u=l.length;a(t),c&&l.length===u&&!o&&e.push({node:t,start:u,length:0}),r.set(t,l.length),c&&(o=!0)}};n.set(t,0),a(t),r.set(t,l.length);return{text:l,at:(t,e)=>{if(3===t.nodeType)return(n.get(t)??0)+Math.min(e,t.data.length);const o=t.childNodes;return e<o.length?n.get(o[e])??r.get(t)??0:r.get(t)??l.length},dom:n=>{for(let t=0;t<e.length;t+=1){const r=e[t],l=r.start+r.length;if(n<r.start)return[r.node,0];if(n<l||n===l&&(t===e.length-1||e[t+1].start>n))return 3===r.node.nodeType?[r.node,n-r.start]:[r.node,0]}const r=e[e.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function C(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(j(e).text!==f(n,r).text)return null;const l=t.now??(()=>Date.now()),o=S();let a=e,s=!1,u=null,h=null,m=[t.caret[0],t.caret[1]];const p={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},g=()=>a.ownerDocument,b=()=>g().defaultView?.getSelection()??null,y=()=>{if(!h)return!0;!function(){const e=t.element();if(!e||e===a)return;O(a),a=e,F(a)}();const e=j(a);if(e.text!==f(n,r).text)return!1;const[l,o]=h,[i,s]=e.dom(l),[c,u]=e.dom(o);return g().activeElement!==a&&a.focus({preventScroll:!0}),b()?.setBaseAndExtent(i,s,c,u),m=h,h=null,!0},D=()=>{y();const t=b();if(!(t&&t.anchorNode&&t.focusNode&&a.contains(t.anchorNode)&&a.contains(t.focusNode)))return m;const e=j(a),n=e.at(t.anchorNode,t.anchorOffset),r=e.at(t.focusNode,t.focusOffset);return m=n<=r?[n,r]:[r,n],m},w=(t,e)=>{h=[t,e];const n=t=>{if(s||y())return;const e=g().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},A=(e,r,i)=>{e.text!==n?(o.record({text:n,start:r[0],end:r[1]},i,l()),n=e.text,t.write(n),w(e.caret,e.caret)):w(e.caret,e.caret)},N=e=>{n=e.text,t.write(n),w(e.start,e.end)},B=e=>{s||(s=!0,O(a),t.end(e))},E=(t,e)=>{const l=D();!s&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",f(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(d,T(n,r,l[0],l[1])),e&&A(v(n,r,l[0],l[1],{text:""}),l,"edit"))},C=t=>t.preventDefault(),P=()=>{t.remount?.()},q=[["keydown",t=>{if(s||t.isComposing)return;const e=t.metaKey||t.ctrlKey;if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void B("escape");if("Enter"===t.key&&(!t.shiftKey||e))return t.preventDefault(),t.stopPropagation(),void B("enter");if(e&&("z"===t.key||"Z"===t.key||"y"===t.key)){t.preventDefault(),t.stopPropagation();const e=D(),r={text:n,start:e[0],end:e[1]},l="y"===t.key||t.shiftKey?o.redo(r):o.undo(r);l&&N(l)}}],["beforeinput",e=>{if(s)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const c=D(),u=j(a),d="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,h=d&&!d.collapsed?[u.at(d.startContainer,d.startOffset),u.at(d.endContainer,d.endOffset)]:null,m=M({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:g(),sel:c,target:h});if(m){if("history"===m.kind){const t={text:n,start:c[0],end:c[1]},e="undo"===m.dir?o.undo(t):o.redo(t);return void(e&&N(e))}if("format"===m.kind){const e=f(n,r),[a,s]=x(e,c[0],c[1]),u=i(n,a,s,m.style,r);if(u.text===n)return;o.record({text:n,start:c[0],end:c[1]},"edit",l()),n=u.text,t.write(n);const[d,h]=k(f(n,r),u.selectionStart,u.selectionEnd);return void w(d,h)}A(m.edit,m.range,m.kind)}}],["compositionstart",()=>{u=D()}],["compositionend",e=>{const i=u;if(u=null,!s&&i)if(e.data){const a=v(n,r,i[0],i[1],{text:e.data});o.record({text:n,start:i[0],end:i[1]},"type",l()),n=a.text,t.write(n),P(),w(a.caret,a.caret)}else P(),w(i[0],i[0])}],["paste",e=>{if(s)return;e.preventDefault();const l=D(),o=e.clipboardData,i=o?.getData(d)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):c({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:g(),multiline:t.multiline,rules:r});A(v(n,r,l[0],l[1],{markup:a}),l,"edit")}],["copy",t=>E(t,!1)],["cut",t=>E(t,!0)],["drop",C],["dragstart",C],["blur",e=>{if(s||null!==u)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{s||(n.isConnected&&n===t.element()?n.ownerDocument.activeElement!==n&&B("blur"):w(m[0],m[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}]];function F(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of q)t.addEventListener(e,n)}function O(t){for(const[e,n]of q)t.removeEventListener(e,n);null===p.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",p.contenteditable),null===p.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",p.spellcheck),t.removeAttribute("data-es-typing")}return F(a),a.focus({preventScroll:!0}),w(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=f(t,r).text.length,[l,i]=D();n=t,o.reset(),w(Math.min(l,e),Math.min(i,e))},stop(t="stop"){B(t)}}}export{d as MARKUP_CLIPBOARD_TYPE,N as TYPING_BURST_MS,S as createHistory,v as editVisible,T as markupOfRange,D as newLine,c as pasteToMarkup,M as richInput,f as richLayout,x as selectionToSource,k as selectionToVisible,w as setBullet,C as startCanvasTyping,j as textMap,p as toSource,g as toSourceStart,b as toVisible};
|
package/dist/chunk-T5HFGW57.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-I6U2G7L4.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-EXCKAZKN.js";import{useEasel as p}from"./chunk-DSUMM2WF.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:K}}export{m as usePartBridge};
|