efficient-easel 8.2.0 → 8.2.1
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/index.d.ts +10 -1
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-LGN4F6HL.js → chunk-35TOFLH6.js} +4 -4
- package/dist/{chunk-R2G64ZNC.js → chunk-D6N77AOS.js} +1 -1
- package/dist/{chunk-IZPIXBQQ.js → chunk-EJZ4RIRW.js} +1 -1
- package/dist/{chunk-SSORUDHE.js → chunk-FCLW4LEN.js} +7 -7
- package/dist/chunk-FJRAYUCX.js +5 -0
- package/dist/chunk-ILXP5VX5.js +1 -0
- package/dist/chunk-K5744MTM.js +11 -0
- package/dist/chunk-KSKKRGNQ.js +57 -0
- package/dist/{chunk-JSO6F7IY.js → chunk-NMUS2VVD.js} +1 -1
- package/dist/{chunk-YIZ4YXPY.js → chunk-OWW44DVK.js} +1 -1
- package/dist/chunk-RMB2VGNY.js +5 -0
- package/dist/chunk-VNN6VB4V.js +1 -0
- package/dist/{chunk-JIKPYPI3.js → chunk-X5SPTRG3.js} +1 -1
- package/dist/{chunk-5HG62L3A.js → chunk-ZVEJ25YG.js} +1 -1
- package/dist/drag/index.js +1 -1
- 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/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.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 +14 -14
- 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/package.json +1 -1
- package/dist/chunk-66WCYXIN.js +0 -5
- package/dist/chunk-AWJUYMX7.js +0 -1
- package/dist/chunk-E63CSJUL.js +0 -11
- package/dist/chunk-OHMYY3FX.js +0 -5
- package/dist/chunk-Q6DCUUTQ.js +0 -57
- package/dist/chunk-WMQN4PHH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-
|
|
1
|
+
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-D6N77AOS.js";import"../../chunk-V7U33NF2.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-BXMXTO36.js";import"../../chunk-EA2HTX37.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenChrome as default}from"../../chunk-
|
|
1
|
+
export{ScreenChrome as default}from"../../chunk-KSKKRGNQ.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BRDCD4LK.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-OGCROOTI.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-OWW44DVK.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-DPKWJTNX.js";import"../../chunk-VNN6VB4V.js";import"../../chunk-NMUS2VVD.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-D6N77AOS.js";import"../../chunk-NCQSBU3O.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-HDUAODXJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-THZ46DC5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-RMB2VGNY.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-XTJCKV6Z.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZVEJ25YG.js";import"../../chunk-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.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-ECM5F6JJ.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-QVUVDBGA.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-WQASXLXS.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-FCLW4LEN.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DocumentScreen,ScreenMount as default}from"../../chunk-
|
|
1
|
+
export{DocumentScreen,ScreenMount as default}from"../../chunk-35TOFLH6.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-EJZ4RIRW.js";import"../../chunk-KSKKRGNQ.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-BRDCD4LK.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-OGCROOTI.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-OWW44DVK.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-DPKWJTNX.js";import"../../chunk-VNN6VB4V.js";import"../../chunk-NMUS2VVD.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-D6N77AOS.js";import"../../chunk-NCQSBU3O.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-HDUAODXJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-THZ46DC5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-V7U33NF2.js";import"../../chunk-5545A3PC.js";import"../../chunk-RMB2VGNY.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-XTJCKV6Z.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-ZVEJ25YG.js";import"../../chunk-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-JTUUIVBZ.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.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-ECM5F6JJ.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-QVUVDBGA.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-WQASXLXS.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-FCLW4LEN.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenStoreProvider as default}from"../../chunk-
|
|
1
|
+
export{ScreenStoreProvider as default}from"../../chunk-EJZ4RIRW.js";import"../../chunk-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-WQASXLXS.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-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{AddBlockRow as e}from"../../chunk-
|
|
2
|
-
return Q($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=
|
|
3
|
-
return Q(
|
|
4
|
-
/* @__PURE__ */U(
|
|
5
|
-
return Q("div",{ref:xe,className:"sf-editor es-editor",style:
|
|
6
|
-
/* @__PURE__ */U("div",{className:"sf-section-bar",children:/* @__PURE__ */U(
|
|
7
|
-
/* @__PURE__ */Q("div",{className:"sf-body",children:[Be
|
|
8
|
-
/* @__PURE__ */U("div",{className:"sf-panel-head",children:/* @__PURE__ */U(
|
|
9
|
-
/* @__PURE__ */U(
|
|
10
|
-
/* @__PURE__ */U(
|
|
11
|
-
return Q(
|
|
12
|
-
/* @__PURE__ */U(
|
|
1
|
+
import{AddBlockRow as e}from"../../chunk-X5SPTRG3.js";import{slotChildRowName as n}from"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import{useEaselUndoKeys as t}from"../../chunk-OWW44DVK.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-DPKWJTNX.js";import{usePartBridge as c}from"../../chunk-VNN6VB4V.js";import{useSectionOps as p}from"../../chunk-NMUS2VVD.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-THZ46DC5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as m}from"../../chunk-ZVEJ25YG.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 S,useScreenBlockRules as y}from"../../chunk-FJRAYUCX.js";import{slotFieldsOf as N,nestsInTree as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as A,usePanelPick as x,useCancelPanelPick as B}from"../../chunk-R6WTQWAC.js";import{useHostEscape as P}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as D}from"../../chunk-JTUUIVBZ.js";import{useEasel as R}from"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import{LayersTree as V,Subtree as v,TreeRow as g,TreeRowAction as L,TreeSeam as O}from"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.js";import{DEFAULT_TREE_WORDS as w}from"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-NDRZP6YR.js";import{DEFAULT_SAVE_WORDS as z,saveIndicator as E}from"../../chunk-H6DDIBQ4.js";import{SaveState as M,panelWidthVars as W}from"../../chunk-QVUVDBGA.js";import"../../chunk-Y2G7CU6A.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-WQASXLXS.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import{useWords as b}from"../../chunk-MFIRYGHW.js";import"../../chunk-FCLW4LEN.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as F}from"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as J,parseZoneKey as T}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as X,useRef as Y,useEffect as G,useCallback as H,Fragment as K}from"react";import{Tooltip as Z}from"efficient-shell/ui";import{TrashIcon as I}from"efficient-shell/icons/efficient";import{jsxs as Q,jsx as U,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}=R(e=>e),[ce,pe]=X(d),le=b("screen",D),me=b("tree",w),de=b("save",z),{first:ae,last:ue,panelOf:he}=a(),ke=he(ae),fe=u(),je=h(),Se=te.data.content?.[0]??null,ye=Se?.props.id??null,Ne=Se?.type===ae,Ce=Se?.type===ue,Ae=Y(null),xe=Y(null);t(xe);const Be=A(),Pe=x(),De=B();k(se?.props.id),G(()=>{const e=xe.current;if(!Pe||!e)return;const n=e=>{"Escape"===e.key&&De()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Pe]),P(null!==Pe,()=>De()),G(()=>{ye&&Ae.current!==ye&&(Ae.current=ye,Ne?pe(ke??d):se||re.select({index:0}))},[ye,se,re,Ne]);const Re=H(e=>pe(n=>f(n,e)?n:e),[]),Ve=j({kind:ce.kind,mode:ce,open:Re,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>f(e,n)?e:n),re.select(e)}}),{selectNode:ve}=c({mode:ce,setMode:pe,onOpenPart:o}),ge=S(),{labelAtLevel:Le,Icon:Oe}=ge,{canAddTo:we}=y(),ze=e=>Le(e,"block",ie.components[e]?.label??e),Ee=e=>Le(e,"section",ze(e)),Me=!Ne&&"puck"===ce.kind&&se?.props.id===ye,We=Se?we(Se.type)?.spec??null:null,be=Se&&We?`${Se.props.id}:${We.slot}`:null,Fe=Se&&We&&Array.isArray(Se.props[We.slot])?Se.props[We.slot]:[],Je=e=>n(e,ze,ge.plainText),Te=(e,n)=>{Se&&We&&be&&(pe(d),We.slider?(r(String(Se.props.id),e),re.select({index:e,zone:be}),o(String(Se.props.id))):(re.select({index:e,zone:be}),o(n)))},Xe=()=>{if(!Se||!We||!be)return;const e=Fe.length;re.insertComponent(be,We.childType,e),pe(d),We.slider?requestAnimationFrame(()=>{r(String(Se.props.id),e),re.select({index:e,zone:be})}):re.select({index:e,zone:be})},Ye=e=>N(ie,e),Ge=e=>{const{parentId:n,slot:o}=T(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Ye(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(Se)?.props[o];return Array.isArray(t)?t.length:0},He=(e,n,o)=>{const r=Math.min(Math.max(o,0),Ge(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(d),re.select({index:t,zone:e}))},Ke=F({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>J(n)===e.zone&&n.index>=0&&n.index<=Ge(e.zone),onDrop:(e,n)=>He(e.zone,e.index,n.index),onStep:(e,n)=>He(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ze=(e,n)=>/* @__PURE__ */U(O,{...ne?{}:Ke.seam({place:{...T(e),index:n}})},`seam:${e}:${n}`),Ie=e=>ge.blockRowName(e,ze),Qe=(e,n,r)=>{pe(d),re.select({index:n,zone:e}),o(r)},Ue=(e,n,o)=>{re.insertComponent(e,n,o),pe(d),re.select({index:o,zone:e})},$e=(n,o,r)=>/* @__PURE__ */U(e,{choices:r,onPick:e=>Ue(n,e,o)}),qe=(e,n)=>{const o=Ye((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=we(e.type),s=t?.choices??null,i="footer"===t?.source?Ie:Je;/* @__PURE__ */
|
|
2
|
+
return Q($,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=C(ie,e.type,n),c=i(e),p=String(e.props.id),l=()=>Qe(o,r,p),{rowProps:m,...a}=Ke.row({item:{id:p,zone:o,index:r},place:{...T(o),index:r}},{onClick:q(l)});/* @__PURE__ */
|
|
3
|
+
return Q(K,{children:[0===r&&Ze(o,0),
|
|
4
|
+
/* @__PURE__ */U(g,{words:me,icon:/* @__PURE__ */U(Oe,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */U(L,{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__ */U(I,{size:13})}),rowProps:m}),s&&/* @__PURE__ */U(v,{children:qe(e,n+1)}),Ze(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?$e(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Se?.type,en=Boolean(Se)&&(Boolean(we(Se.type))||Ye(Se.type).length>0),nn=Boolean(Se)&&(Boolean(We)||Ce||Ne||_e||en);/* @__PURE__ */
|
|
5
|
+
return Q("div",{ref:xe,className:"sf-editor es-editor",style:W(i),children:[
|
|
6
|
+
/* @__PURE__ */U("div",{className:"sf-section-bar",children:/* @__PURE__ */U(M,null!==oe?{tone:"off",label:oe,role:"status"}:{...E(ee,de),role:"status"})}),
|
|
7
|
+
/* @__PURE__ */Q("div",{className:"sf-body",children:[Pe&&Be?/* @__PURE__ */U("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */U(m,{panel:Be,pick:Pe})}):nn&&Se&&/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
+
/* @__PURE__ */U("div",{className:"sf-panel-head",children:/* @__PURE__ */U(Z,{content:Ne?le.headerSettings:le.sectionSettings({name:Ee(Se.type)}),side:"bottom",children:/* @__PURE__ */U("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Me?"is-selected":""),"aria-pressed":Me,onClick:()=>{Ne?pe(ke??d):(pe(d),re.select({index:0}))},children:Ee(Se.type)})})}),
|
|
9
|
+
/* @__PURE__ */U(V,{className:"sf-tree sf-scroll",rootProps:Ke.rootProps(),words:me,children:/* @__PURE__ */U(v,{children:Ne?
|
|
10
|
+
/* @__PURE__ */U(g,{words:me,icon:/* @__PURE__ */U(Oe,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??d),rowProps:{onClick:q(()=>pe(ke??d))}}):We?/* @__PURE__ */Q($,{children:[Fe.map((e,n)=>{const o=se?.props.id===e.props.id,r=Je(e),t=String(e.props.id),s=()=>Te(n,t),{rowProps:i,...c}=Ke.row({item:{id:t,zone:be,index:n},place:{...T(be),index:n}},{onClick:q(s)});/* @__PURE__ */
|
|
11
|
+
return Q(K,{children:[0===n&&Ze(be,0),
|
|
12
|
+
/* @__PURE__ */U(g,{words:me,icon:/* @__PURE__ */U(Oe,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */U(L,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(be&&(re.removeComponent(be,e),pe(d),re.select(null)));var e},children:/* @__PURE__ */U(I,{size:13})}),rowProps:i}),Ze(be,n+1)]},String(e.props.id??n))}),
|
|
13
13
|
/* @__PURE__ */Q("button",{type:"button",className:"sf-add-card",onClick:Xe,children:[
|
|
14
|
-
/* @__PURE__ */U("span",{className:"sf-plus sf-plus--sm",children:"+"}),
|
|
14
|
+
/* @__PURE__ */U("span",{className:"sf-plus sf-plus--sm",children:"+"}),We.addLabel]}),ye?Ve.partRows?.(Se,_):null]}):qe(Se,1)})})]}),
|
|
15
15
|
/* @__PURE__ */U("div",{className:"sf-center",children:/* @__PURE__ */U("div",{className:"sf-preview-host",children:/* @__PURE__ */U(fe,{})})}),
|
|
16
|
-
/* @__PURE__ */U(s,{value:{selectChild:(e,n,o,r)=>"section"===we(r)?.source?
|
|
16
|
+
/* @__PURE__ */U(s,{value:{selectChild:(e,n,o,r)=>"section"===we(r)?.source?Te(n,o):Qe(e,n,o),addChild:(e,n,o,r,t)=>"section"===we(t)?.source?Xe():Ue(`${e}:${n}`,o,r),childRowName:Je,blockRowName:Ie},children:/* @__PURE__ */U(je,{mode:ce,onOpenWebsiteSettings:Ve.openSettings??(()=>{}),onSelectNode:ve,hideNodeActions:!0})})]})]})}export{ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-VNN6VB4V.js";import"../../chunk-NMUS2VVD.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-WQASXLXS.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-ILXP5VX5.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-35TOFLH6.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-EJZ4RIRW.js";import"../chunk-KSKKRGNQ.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-BRDCD4LK.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-OGCROOTI.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-BHRC3ASL.js";import"../chunk-6W7WLPZH.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-OWW44DVK.js";import"../chunk-KCBEE2MC.js";import"../chunk-DPKWJTNX.js";import"../chunk-VNN6VB4V.js";import"../chunk-NMUS2VVD.js";import"../chunk-IYT6NN2J.js";import"../chunk-D6N77AOS.js";import"../chunk-NCQSBU3O.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-HDUAODXJ.js";import"../chunk-RKTF5XLP.js";import"../chunk-THZ46DC5.js";import"../chunk-GMCZXMOV.js";import"../chunk-CLOS6SSX.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-RMB2VGNY.js";import"../chunk-PA3PNTVV.js";import"../chunk-5ZBY24K7.js";import"../chunk-BVN33R76.js";import"../chunk-XTJCKV6Z.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-ZVEJ25YG.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-FJRAYUCX.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-JTUUIVBZ.js";import"../chunk-K5744MTM.js";import"../chunk-TBY3DFKS.js";import"../chunk-PEDDDWSG.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-GZH4UVDH.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-ECM5F6JJ.js";import"../chunk-4VJATVVR.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-QVUVDBGA.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-WQASXLXS.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-FCLW4LEN.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-
|
|
1
|
+
export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-OWW44DVK.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-WQASXLXS.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-NMUS2VVD.js";import"../../../chunk-FJRAYUCX.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-K5744MTM.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-PEDDDWSG.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-GZH4UVDH.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-ECM5F6JJ.js";import"../../../chunk-WQASXLXS.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-ILXP5VX5.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-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-WQASXLXS.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-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.1",
|
|
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-66WCYXIN.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,paletteWithoutPinned as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as i}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-XTJCKV6Z.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-OHMYY3FX.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-JTUUIVBZ.js";import{useEasel as f}from"./chunk-E63CSJUL.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SSORUDHE.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 O,jsxs as $,Fragment as B}from"react/jsx-runtime";var v=e=>`section:${e}`,V=e=>`block:${e}`,x=e=>`template:${e}`;function H({blocks:H,blocksOnly:I,at:L,onAdd:C,itemFor:F,session:N,siteWide:S,onClose:T,onHide:A,readOnly:D}){const J=f(e=>e.config),R=p(),{labelAtLevel:U,categoryLabel:Y,firstSection:w,Icon:E,Thumbnail:Q}=R,{blockIsOffered:X}=m(),Z=u("screen",d).add,z=u("drag",h).add,K=l(),[M,P]=y([]);b(()=>{let e=!1;const t=e=>X(e,K);return s(K).list().then(o=>{if(e)return;const n=J.components;P(o.filter(e=>e.node?.type&&n[e.node.type]&&i(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,K]);const W=j(()=>e(J,R),[J]),G=e=>({type:v(e.type),label:e.name,cover:/* @__PURE__ */O(Q,{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(H&&H.choices.length>0&&a(H.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:H.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:V(e.type),label:e.label,icon:/* @__PURE__ */O(E,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),I)return e;const i=t(W,w);i&&e.push({key:"start",title:Z.startBlank,tiles:[G(i)]}),M.length>0&&e.push({key:"templates",title:Z.templates,tiles:M.map(e=>{return{type:x(e.id),label:e.name,cover:/* @__PURE__ */O(Q,{type:e.node.type}),keywords:[(t=e.node.type,U(t,"section",J.components[t]?.label??t)),e.node.type]};var t})});const s=o(W,w);for(const t of Object.keys(J.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:n(J,t,Y),tiles:o.map(G)})}return e},[H,I,M,W,J,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=M.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return $(B,{children:[
|
|
3
|
-
/* @__PURE__ */O(r,{icon:/* @__PURE__ */O(g,{size:15}),title:Z.title,context:I?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */O(c,{label:Z.done,description:Z.doneDescription,onClick:T}),onHide:A}),
|
|
4
|
-
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */O(k,{groups:q,session:N,itemFor:e=>F(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&C(t)},at:L,hint:I?Z.hintBlocks:Z.hint,searchLabel:I?Z.searchBlocks:Z.searchSections,readOnly:D,words:z}),S&&!I?S:null]})]})}export{H as AddSidePanel,V as blockKey,v as sectionKey,x as templateKey};
|
package/dist/chunk-AWJUYMX7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useState as e,useEffect as t,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(e){const t=e;if(!t||"string"!=typeof t.tagName)return!1;const n=t.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(t.type??"text").toLowerCase());if(t.isContentEditable)return!0;const r=t.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=t.closest?.('[role="textbox"]')}var c="data-puck-component";function i(e,t=c){const n=e;return n&&"function"==typeof n.closest?n.closest(`[${t}]`)?.getAttribute(t)??null:null}function u(e){const t=e.offsetWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1}function s(e,t,n){const o=e.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},c=u(e);return{left:o.left-r.left+t.left*c,top:o.top-r.top+t.top*c,width:t.width*c,height:t.height*c}}function l(e){const t=e.offsetWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1}function a(e,t,n){const o=s(e,t,n),r=l(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function d(e,t,n){const o=e.getBoundingClientRect(),r=l(e);return{x:(t-o.left)/r,y:(n-o.top)/r}}function f(e,t,n,o){const{left:r,top:c}=s(e,{left:t,top:n,width:0,height:0},o);return{x:r,y:c}}function m({available:e,width:t,maxScale:n=1}){const o=Math.max(0,e);if(!t||t<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/t,n):1;return{width:t,scale:r,shownWidth:t*r}}var h="data-es-canvas-style",w=/* @__PURE__ */new WeakMap;function b(e,t){t?w.set(e,t):w.delete(e)}function v(e,t,n){const o=e.head??e.documentElement;let r=g(e,t);if(!r){r=e.createElement("style"),r.setAttribute(h,t);const n=w.get(e);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function p(e,t){g(e,t)?.remove()}function g(e,t){for(const n of Array.from(e.querySelectorAll(`style[${h}]`)))if(n.getAttribute(h)===t)return n;return null}var y="[data-puck-component]",E="[data-puck-dropzone]",A="iframe#preview-frame";function L(e){const t=e.contentDocument;if(!t||!e.contentWindow||"loading"===t.readyState||!t.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===t.URL;const n=e.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==t.URL}function C(e,t,{selector:n=A,readySelector:o}={}){let r=null,c=null,i=!1,u=!1,s=null;const l=()=>{s?.observer.disconnect(),s=null},a=()=>{if(u)return;let e=null;if(r&&L(r)){const t=r.contentDocument;(e=>{if(!o||e.querySelector(o))return l(),!0;if(s?.doc!==e){l();const t=e.defaultView?.MutationObserver;if(t){const n=new t(()=>a());n.observe(e,{childList:!0,subtree:!0}),s={doc:e,observer:n}}}return!1})(t)&&(e={frame:r,document:t,window:r.contentWindow})}else l();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&i||(i=!0,c=e,t(c))},d=()=>a(),f=()=>{const t=e.querySelector?.(n);t!==r?(r?.removeEventListener("load",d),r=t,r?.addEventListener("load",d),a()):a()},m=e.ownerDocument?.defaultView??e.defaultView,h=m?.MutationObserver,w=h?new h(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&f()):null;return w?.observe(e,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),l(),r?.removeEventListener("load",d),r=null}}function S(n,{selector:o,readySelector:r}={}){const[c,i]=e(null);return t(()=>{const e=n.current;if(!e)return;const t=C(e,i,{selector:o,readySelector:r});return()=>{t(),i(null)}},[n,o,r]),c}var x="easel:canvas-typing";function R(e,o,r,{on:c="document",capture:i=!1}={}){const u=n(r);u.current=r;const s=e?.document??null,l=e?.window??null;t(()=>{const e="window"===c?l:s;if(!e)return;const t=e=>u.current(e);return e.addEventListener(o,t,i),()=>e.removeEventListener(o,t,i)},[s,l,o,c,i])}function M(e,n,o){const r=e?.document??null;t(()=>{if(!r)return;if(!o)return void p(r,n);const e=v(r,n,o),t=r.defaultView?.MutationObserver,c=t?new t(()=>{e.isConnected||v(r,n,o)}):null;return c?.observe(r.head??r.documentElement,{childList:!0}),()=>{c?.disconnect(),p(r,n)}},[r,n,o])}function k(n,{settle:o=[150,450]}={}){const[r,c]=e(0),i=n?.frame??null,u=n?.document??null,s=n?.window??null,l=o.join(",");return t(()=>{if(!i||!u||!s)return;const e=i.ownerDocument.defaultView;let t=!1,n=0;const r=()=>{if(t)return;t=!0;const o=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?n=e.requestAnimationFrame(o):o()},l=[],a=(e,t)=>{e.addEventListener(t,r,!0),l.push(()=>e.removeEventListener(t,r,!0))};a(u,"scroll"),a(s,"resize"),e&&(a(e,"scroll"),a(e,"resize"));const d=e?.ResizeObserver;if(d){const e=new d(r);e.observe(i),u.documentElement&&e.observe(u.documentElement),l.push(()=>e.disconnect())}const f=u.defaultView?.MutationObserver,m=u.body??u.documentElement;if(f&&m){const e=new f(r);e.observe(u===i.ownerDocument?i:m,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const h=u.fonts;h&&a(h,"loadingdone");const w=o.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of w)clearTimeout(e);n&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(n)}},[i,u,s,l]),r}export{c as BLOCK_ATTRIBUTE,y as BLOCK_SELECTOR,A as CANVAS_SELECTOR,x as CANVAS_TYPING_EVENT,E as LIST_SELECTOR,d as clientPointToLayer,l as elementScale,m as fitCanvas,f as framePointToHost,s as frameRectToHost,a as frameRectToLayer,u as frameScale,L as isFrameReady,r as isTypingTarget,i as nodeIdAt,p as removeCanvasStyle,b as setCanvasNonce,v as upsertCanvasStyle,R as useCanvasEvent,S as useCanvasFrame,k as useCanvasLayout,M as useCanvasStyle,C as watchCanvasFrame};
|
package/dist/chunk-E63CSJUL.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.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-ECM5F6JJ.js";import{startCanvasTyping as s,textMap as l}from"./chunk-WQASXLXS.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as u,frameRectToHost as p,CANVAS_TYPING_EVENT as f}from"./chunk-AWJUYMX7.js";import{find as h,ROOT_ID as m,getList as g,remove as v,parseZoneKey as y,move as w,duplicate as k,replaceNode as b,createNode as S,insert as I,normalizeData as C,createResolveCache as E,resolveNodeData as x,ROOT_SLOT as D}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as O,fieldsFrom as A,defaultsFrom as M}from"./chunk-NKB3KVAB.js";import{createContext as P,useEffect as z,useContext as B,useRef as K,useSyncExternalStore as R,useState as $,useMemo as j,useCallback as N,useLayoutEffect as Z}from"react";import{jsx as L,jsxs as F}from"react/jsx-runtime";import{createPortal as V}from"react-dom";import{FloatingBar as T,TextToolbar as H}from"efficient-shell/ui";function W(e){return!["setData","setUi","set"].includes(e.type)}var Y=(e,t,n,o)=>{const r=g(e,t,y(n));return r?.[o]??null},X=(e,t,n,o,r)=>{const i=Y(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function q(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 U(e,t,n){return n?"node"===n.kind?h(e,t,n.id)?n:null:n.parentId===m?g(e,t,n)?n:null:h(e,t,n.parentId)&&g(e,t,n)?n:null:null}function J(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=G(e,t,n);if(o===e)return e;const r=U(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function G(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 J(e,n,"function"==typeof t.ui?t.ui(q(e,n)):t.ui);case"set":{const r={data:o,ui:q(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=J(a,n,i.ui,!0)),a}case"insert":{const r={...y(t.destinationZone),index:t.destinationIndex},i=S(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:I(o,n,r,i)}}case"replace":{const r=X(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:b(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=X(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=k(o,n,r.props.id),a=Y(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return G(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=Y(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...y(t.destinationZone),index:t.destinationIndex};return{...e,data:w(o,n,r.props.id,i)}}case"remove":{const r=X(o,n,t.zone,t.index,"remove");return{...e,data:v(o,n,r.props.id)}}default:return e}}var _={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},ee={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},te=0,ne=()=>`history-${te+=1}`;function oe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=C(e.data,t);let l={data:s,selection:null,ui:{...ee}};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:{...ee,...i}}}let c=[{core:l,at:-1/0,sealed:!0,id:ne()}],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:ne()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,m=null,v=0,y=null,w=!1;const k=()=>{for(const e of[...p])e()},S=()=>{c=[...c.slice(0,d),{...c[d],core:l},...c.slice(d+1)]},I=(t,n)=>{v>0?w=w||n:(n?u(!1):l!==t&&S(),l.data!==t.data&&e.onChange?.(l.data),l!==t&&k())},D=e=>{const n=l;if(l=Q(l,e,t),l===n)return;const o=e.recordHistory??W(e);I(n,o&&l.data!==n.data)},O=t=>{0===v&&(y=l,w=!1),v+=1;try{t()}catch(e){throw v-=1,0===v&&y&&(l=y,y=null),e}if(v-=1,v>0||!y)return;const n=y;y=null,w&&l.data!==n.data?u(!0):l!==n&&S(),l.data!==n.data&&e.onChange?.(l.data),l!==n&&k()},A=e=>{const n=l,o=U(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},I(n,!1))},M=t=>{const n=l;d=t,l=c[d].core,l.data!==n.data&&e.onChange?.(l.data),l!==n&&k()},P=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{..._,...a,...n}};let z=P();const B=E(),K={resolveCache:B,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([x(r,t,{cache:B,trigger:e,metadata:n}),...i.map(o=>x(o,t,{cache:B,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=h(n,t,a)?.node;s&&s===h(o,t,a)?.node&&(n=b(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:U(n,t,l.selection)},I(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=h(l.data,t,e)?.node;if(!r)return!1;const i=await x(r,t,{cache:B,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return O(()=>{const n=l;if(h(l.data,t,e)?.node!==r)return;const o=b(l.data,t,e,i.node);o!==l.data&&(l={...l,data:o,selection:U(o,t,l.selection)},I(n,!1),a=!0)}),a},get config(){return t},getState(){if(f&&m===l)return f;const e=l,o={data:e.data,ui:q(e,t)},r="node"===e.selection?.kind?h(e.data,t,e.selection.id)?.node??null:null;return f={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:q(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&M(e)}},getPermissions:z,getItemById:n=>h(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return g(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,f},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:U(e.data,t,o)},I(n,e.data!==n.data)})},load(e,n={}){const o=l,r=C(e,t);l={...l,data:r,selection:U(r,t,n.selection??l.selection)},n.keepHistory||(c=[{core:l,at:-1/0,sealed:!0,id:ne()}],d=0),l!==o&&k()},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,z=P(),f=null,k())},setConfig(e){e!==t&&(t=e,z=P(),f=null,k())}};return K}function re(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 ie=P(null),ae=P(!0);function se({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return z(()=>{n&&e.resolveAll()},[e,n]),z(()=>{if(t&&"undefined"!=typeof document)return re(document,e)},[e,t]),/* @__PURE__ */L(ie.Provider,{value:e,children:/* @__PURE__ */L(ae.Provider,{value:t,children:o})})}function le(){const e=B(ie);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ce(e){const t=le(),n=K({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 R(t.subscribe,o,o)}function de(){return function(e){return ce(e)}}var ue="data-puck-component",pe="data-puck-dropzone",fe={},he="data-es-mirror",me="undefined"==typeof window?z:Z;function ge(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${he}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(he,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ve({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=K(null),[h,m]=$(null);return me(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==l||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,l]),me(()=>{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),m(t),s?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){ge(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ge(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),s?.(null)}},[]),/* @__PURE__ */L("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===l?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:h?V(t,h):null})}var ye=P(null),we=P(fe),ke=[];function be({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const a=le(),s=ce(n=>g(n.appState.data,a.config,{parentId:e,slot:t})??ke),l=ce(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==m),c=ce(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=B(ye),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__ */L("div",{className:u.join(" "),[pe]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */L(Ce,{node:e},e.props.id))})}function Se(e,t){return j(()=>{const n={};for(const o of O(A(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
-
return L(be,{parentId:t,slot:o,...e})};return n},[e,t])}function Ie(e){return j(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return L(be,{parentId:e,slot:t,...n})},[e])}function Ce({node:e}){const t=le().config.components[e.type],n=e.props.id,o=function(e){const t=K(null);return j(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ue),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ue,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(n),r=B(we),i=Se(t,n),a=Ie(n);if(!t?.render)return null;const s=t.render,l={...M(t),...e.props,...i},c={renderDropZone:a,isEditing:!0,dragRef:t.inline?o:null,metadata:{...r,...t.metadata}};return t.inline?/* @__PURE__ */L(s,{...l,puck:c,editMode:!0}):/* @__PURE__ */L("div",{[ue]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */L(s,{...l,puck:c,editMode:!0})})}function Ee({metadata:e}){const t=ce(e=>e.config),n=ce(e=>e.appState.data.root).props??{},o=t.root?.render,r=Se(t.root,m),i=Ie(m),a=/* @__PURE__ */L(be,{parentId:m,slot:D}),s=o?/* @__PURE__ */L(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:a}):a;/* @__PURE__ */
|
|
4
|
-
return L(we.Provider,{value:e??fe,children:s})}var xe=P(void 0);function De(e,t,n){const[o,r]=$(null),i=K(t);return i.current=t,me(()=>{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 Oe({id:e,kind:t,overlay:n}){const o=K(null),r=De(o,e?t=>t.querySelector(`[${ue}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */L("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__ */L(n,{componentId:e,kind:t,children:i}):i}function Ae(e,t,n){const o=l(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let a=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))a=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(a=o.at(n.startContainer,n.startOffset))}if(null===a)return[r,r];const c=o.text;let d=a,u=a;for(;d>0&&!/\s/.test(c[d-1]);)d-=1;for(;u<c.length&&!/\s/.test(c[u]);)u+=1;return[d,u]}function Me({s:e,element:t,toolbar:n,label:o}){const r=e.pressed(),i=new Set(n.offered.filter(e=>"link"!==e));/* @__PURE__ */
|
|
5
|
-
return L(T,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?p(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */L("div",{style:{width:"18rem"},children:/* @__PURE__ */L(H,{offered:i,pressed:r.marks,onMark:t=>{"link"!==t&&e.press(t)},list:{pressed:r.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase})})})}function Pe({element:e}){const t=K(null),n=De(t,()=>e(),e);/* @__PURE__ */
|
|
6
|
-
return L("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 ze({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:l,onDocument:d,height:u,title:p,nonce:h,hotkeys:m,frameWrapper:g,overlay:v,children:y,typing:w,passThrough:k}){const b=le(),S=B(xe),I=k??S,C=B(ae),E=c("canvas",e),x=m??C,[D,O]=$(void 0),A=ce(e=>"node"===e.selection?.kind?e.selection.id:null),[M,P]=$(null),[R,j]=$(null),N=K(null),[,Z]=$(0),V=K(w);V.current=w;const T=K(null),H=e=>{const t=T.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(f,{detail:{typing:e}}))},W=(e,t)=>{N.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=b.group(),r=e.element,i=s({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Ae(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>Z(e=>e+1),end:e=>{o.close(),N.current?.element===r&&(N.current=null),j(null),H(!1),V.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const a=n.closest?.(`[${ue}]`)?.getAttribute(ue);return a&&b.select(a),N.current={s:i,element:r,target:e},j(()=>r),P(null),H(!0),V.current?.onChange?.({typing:!0,element:n}),!0};z(()=>()=>N.current?.s.stop("stop"),[]);const Y=e=>{const t=N.current?.element();return Boolean(t&&t.contains(e))},X=e=>{const t=e.closest?.(`[${ue}]`)?.getAttribute(ue);if(!t)return;const n=b.getState(),o="node"===n.selection?.kind?n.selection.id:null;return a(n.appState.data,b.config,t,o,I)??t},q=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(N.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=V.current?.atSelection?.();n&&W(n,null)&&e.preventDefault()},U=/* @__PURE__ */F("div",{ref:T,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),N.current){if(Y(t))return;N.current.s.stop("outside")}const n=X(t);void 0===n?t.hasAttribute?.(pe)||b.select(null):b.select(n)},onDoubleClick:e=>{const t=V.current;if(!t||Y(e.target))return;const n=t.at(e.target);n&&W(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>q(e),onMouseOver:e=>{if(N.current)return;const t=X(e.target)??null;t!==M&&P(t)},onMouseLeave:()=>P(null),children:[
|
|
7
|
-
/* @__PURE__ */L(ye.Provider,{value:M,children:/* @__PURE__ */L(Ee,{metadata:r})}),
|
|
8
|
-
/* @__PURE__ */F("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
9
|
-
/* @__PURE__ */L(Oe,{id:!R&&M&&M!==A?M:null,kind:"hover",overlay:v}),
|
|
10
|
-
/* @__PURE__ */L(Oe,{id:R?null:A,kind:"selected",overlay:v}),R?/* @__PURE__ */L(Pe,{element:R}):null]}),y]}),J=g?/* @__PURE__ */L(g,{document:D,children:U}):U;z(()=>{if(D&&x)return re(D,b)},[D,x,b]),z(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void q(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=b.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,b.config,n.selection);"node"===o?.kind&&b.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,b]);/* @__PURE__ */
|
|
11
|
-
return F("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":R?"":void 0,children:[R&&N.current?.target.toolbar?/* @__PURE__ */L(Me,{s:N.current.s,element:N.current.element,toolbar:N.current.target.toolbar,label:E.textTools}):null,t?/* @__PURE__ */L(ve,{mirrorStyles:l,onDocument:e=>{O(e??void 0),d?.(e)},height:u,title:p,nonce:h,children:J}):/* @__PURE__ */L("div",{id:"preview-frame","data-puck-entry":"",children:J})]})}function Be(e={}){const t=le(),n=ce(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ke(){const e=le(),n=ce(e=>e.config),o=e.resolveCache,r=ce(e=>e.selectedItem),i=ce(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?h(d.appState.data,n,a):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:m}=t({id:a,node:l,block:c,parent:f,appState:d.appState}),g=ce(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),v=N((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 x(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 x({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:m,values:l.props,readOnly:g,onChange:v}}export{ve as CanvasFrame,xe as CanvasPassThroughContext,ee as DEFAULT_UI,ze as EaselCanvas,se as EaselProvider,Ee as EditDocument,re as bindUndoKeys,oe as createEasel,de as createUseEasel,W as recordsByDefault,Q as reduce,q as uiView,ce as useEasel,le as useEaselApi,Be as useEaselNodeOps,Ke as useSelectedFields,U as validSelection};
|
package/dist/chunk-OHMYY3FX.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-E63CSJUL.js";import{Inspector as i}from"./chunk-PEDDDWSG.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=()=>{},L={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function D(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){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 G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(P.Provider,{value:n,children:e})}function N(){return u(P)}function x(){return(N().useOwnerName??g)()}function B(){return(N().useDocumentLabel??y)()}function I(n,e,t,r){return(N().useBridges??v)(n,e,t,r)}function T(n){return(N().useStandaloneBridges??v)(n)}function A(n,e){(N().useDocumentPass??b)(n,e)}function E(){return N().blockRules??L}function F(){return N().blockLook??O}function R(){return N().devices??S}function W(){return N().leftView??j}function K(){return N().pinned??w}function V(){return N().saveSwitch??!0}function H(n){e(!0===N().pickFollowsSelection,n)}function J(){return N().add??h}function Q(){return N().storageNamespace||void 0}function U(){return N().styleClipboard??null}function Y(){return N().nodeKeys??!0}function Z(){return N().notify??null}function q(){return N().Canvas??D}function z(){return N().CanvasHead??null}function M(){return N().canvasDrag??null}var X=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(X.Provider,{value:n,children:e})}function _(){return u(X)}function nn(){return N().Inspector??C}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,J as useScreenAdd,F as useScreenBlockLook,E as useScreenBlockRules,I as useScreenBridges,M as useScreenCanvasDrag,q as useScreenCanvasFrame,z as useScreenCanvasHead,_ as useScreenCanvasTarget,R as useScreenDevices,B as useScreenDocumentLabel,A as useScreenDocumentPass,nn as useScreenInspectorPanel,W as useScreenLeftView,Y as useScreenNodeKeys,Z as useScreenNotify,x as useScreenOwnerName,N as useScreenParts,H as useScreenPickFollowsSelection,K as useScreenPinned,V as useScreenSaveSwitch,Q as useScreenStorageNamespace,U as useScreenStyleClipboard,T as useStandaloneScreenBridges};
|
package/dist/chunk-Q6DCUUTQ.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-BRDCD4LK.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-YIZ4YXPY.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as S,DEFAULT_PANEL_W as k,clampPanelWidth as b}from"./chunk-DPKWJTNX.js";import{usePartBridge as v}from"./chunk-WMQN4PHH.js";import{useSectionOps as x}from"./chunk-JSO6F7IY.js";import{useNodeClipboard as w,useNodeContextMenu as z}from"./chunk-R2G64ZNC.js";import{PageEditGuardNotices as C}from"./chunk-NCQSBU3O.js";import{ScreenSaveIcon as B,ScreenMainButton as O}from"./chunk-HDUAODXJ.js";import{useBrowserOffline as N}from"./chunk-RKTF5XLP.js";import{useScreenDocument as I}from"./chunk-THZ46DC5.js";import{requestMediaPick as $}from"./chunk-KG7RJWOK.js";import{heldStyle as P,styleShortcut as A}from"./chunk-V7U33NF2.js";import{AddChildRow as T}from"./chunk-5545A3PC.js";import{AddSidePanel as M}from"./chunk-66WCYXIN.js";import{SidePanelHead as j,PanelShowStrip as L}from"./chunk-XTJCKV6Z.js";import{useEaselSession as R}from"./chunk-O7Q4DDJT.js";import{MediaSidePanel as E}from"./chunk-5HG62L3A.js";import{useScreenSaveSwitch as H,useScreenNodeKeys as V,useScreenPinned as F,useScreenDocumentLabel as D,useScreenCanvasFrame as U,useScreenInspectorPanel as W,useScreenDevices as J,useScreenPickFollowsSelection as G,useScreenLeftView as Y,useScreenAdd as X,SELECTION_MODE as K,sameInspectorMode as q,useScreenBridges as Z,useScreenBlockRules as _,useScreenBlockLook as Q,useScreenStorageNamespace as ee,useScreenNotify as ne,useScreenCanvasHead as te,isSlotMode as oe,useScreenStyleClipboard as re,useScreenDocumentPass as ie,useScreenCanvasDrag as le,ScreenCanvasTargetProvider as se,isPinnedFirst as de,isPinnedLast as ce,screenSlotsOf as ae}from"./chunk-OHMYY3FX.js";import{ROOT_ZONE as pe,blockNodeActions as ue,TREE_MAX_DEPTH as fe,childSlotsOf as he,slotFieldsOf as me,slotChildrenIn as ge,nestsInTree as ye,newNodeId as Se}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ke,usePanelPick as be,useCancelPanelPick as ve}from"./chunk-R6WTQWAC.js";import{useEaselHost as xe,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ze}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as Ce}from"./chunk-JTUUIVBZ.js";import{useEasel as Be,useEaselApi as Oe,CanvasPassThroughContext as Ne}from"./chunk-E63CSJUL.js";import{TreeRow as Ie,Subtree as $e,LayersTree as Pe,TreeGroupLabel as Ae,TreeRowAction as Te,TreeSeam as Me}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Le}from"./chunk-WK3AFPXY.js";import{toItemSelector as Re,useNodeOps as Ee,clickPick as He}from"./chunk-ECM5F6JJ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as De,TopBarRail as Ue,TopBarCluster as We,EaselIconButton as Je,TopBarDivider as Ge,DeviceSwitch as Ye,InspectorIconButton as Xe,PanelResizeHandle as Ke,MAX_PANEL_W as qe,MIN_PANEL_W as Ze,panelWidthVars as _e}from"./chunk-QVUVDBGA.js";import{DEFAULT_NOTICE_WORDS as Qe,DEFAULT_CHROME_WORDS as en}from"./chunk-Y2G7CU6A.js";import{holderOf as nn,nameOrSomeone as tn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as on}from"./chunk-RE4LP46F.js";import{useWords as rn}from"./chunk-MFIRYGHW.js";import{insertSeams as ln,CanvasDragLayer as sn,CanvasInsert as dn}from"./chunk-SSORUDHE.js";import{DEFAULT_DRAG_WORDS as cn}from"./chunk-O2NLQBFX.js";import{createDragSession as an,useTreeDrag as pn,gapToMoveIndex as un}from"./chunk-67GNT6PF.js";import{useCanvasFrame as fn,LIST_SELECTOR as hn,BLOCK_SELECTOR as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as Sn,BLOCK_ATTRIBUTE as kn}from"./chunk-AWJUYMX7.js";import{zoneKey as bn,ROOT_ID as vn,ROOT_SLOT as xn,parseZoneKey as wn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as On,useState as Nn,useEffect as In,useCallback as $n,useLayoutEffect as Pn,Fragment as An}from"react";import{ColoredBadge as Tn,toast as Mn,groupColors as jn}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as Rn,RefreshIcon as En,TrashIcon as Hn,EyeOffIcon as Vn,EyeIcon as Fn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Wn,Fragment as Jn}from"react/jsx-runtime";var Gn=/* @__PURE__ */new WeakSet;function Yn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Xn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Pn(()=>{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=Sn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${kn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?.getBoundingClientRect();if(!i||0===i.height){c[o.id]=null;continue}const s=Sn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Un(Tn,{colorClass:jn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Kn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Wn(Jn,e?{children:[
|
|
3
|
-
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var qn=`${hn}, ${mn}`;function Zn(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 _n="__rungs";var Qn="screen:band",et={duplicate:!0,delete:!0};function nt(){const hn=xe(),{target:Sn,docId:kn,capabilities:jn,currentSlug:nt,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=I(),ft=H(),ht=V(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=jn,{appState:St,dispatch:kt,history:bt,selectedItem:vt,getSelectorForId:xt,config:wt}=Be(e=>e),zt=F(),{first:Ct,firstGroup:Bt,lastGroup:Ot,isSectionGroup:Nt,sectionGroupZone:It,panelOf:$t}=zt,Pt=$t(Ct),At=e=>de(zt,e),Tt=e=>ce(zt,e),Mt="node"===zt.firstRow,jt=zt.band??null,Lt=rn("screen",Ce),Rt=rn("tree",je),Et=rn("drag",cn),Ht=rn("notice",Qe),Vt=rn("lock",on),Ft=rn("menu",Le),Dt=rn("styleClipboard",ze),Ut=rn("chrome",en),Wt=D()??`/${nt}`,Jt=U(),Gt=W(),Yt=x({readOnly:pt}),Xt=x({readOnly:pt,foldIntoHistory:!0}),Kt=Bn(null),qt=Oe(),Zt=On(()=>({...Yt,select:e=>{Kt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Kt.current=Re(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=J(),[lo,so]=Nn(oo),co=ke(),ao=mt&&null!==co,po=be(),uo=ve();G(vt?.props.id);const{read:fo,write:ho,forSelection:mo}=Y(),[go,yo]=Nn(fo);In(()=>{ho(go)},[go]);const[So,ko]=Nn(0),bo=Bn(null),vo=Bn(null),xo=fn(vo,{readySelector:qn}),wo=f(vo);h(vo,xo);const zo=N(),Co=nn(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Ht.editing({name:tn(Co.name,Vt),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Oo=()=>{pt||(rt.failed?lt():dt())};m(vo,xo,Oo);const[No,Io]=Nn(!1),$o=Bn(!1),Po=Bn(!1),[Ao,To]=Nn(null),Mo=X(),jo=e=>To(null===e?null:{zone:pe,index:e}),[Lo,Ro]=Nn([]),[Eo,Ho]=Nn(K),Vo="puck"===Eo.kind,Fo=No&&!Ao&&Mo.railTarget?Mo.railTarget(St.data,{node:vt??null,mode:Eo}):null,Do=Fo?{zone:bn(Fo),index:Fo.index}:null,Uo=Ao??Do,Wo=Uo&&Uo.zone===pe?Uo.index:null,Jo=o(Eo,vt?.props.id),[Go,Yo]=Nn(null);In(()=>{Go&&(r(),Yo(null))},[Go]);const Xo=Bn(xt);Xo.current=xt;const Ko=$n((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Yo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Xo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Cr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),qo=Bn(null);In(()=>{const e=qo.current;qo.current=null;const n=null==vt?.props.id?null:String(vt.props.id);Ho(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:$t(vt?.type)??K);const t=vt?.props.id,o=Kt.current;if(Kt.current=null,!t)return;const r=xt(t);Ko(String(t),{scroll:!i(o,r??null,pe)})},[vt?.props.id,Ko]);const Zo=$n(e=>{Ho(n=>q(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),_o=Bn(()=>{});_o.current=(e,n)=>{const t=e?Si(e.zone??pe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==vt?.props.id?null:String(vt.props.id);Ho(e=>q(e,n)?e:n),o!==r&&(qo.current={id:o,mode:n},Zt.select(e))};const Qo=$n((e,n)=>_o.current(e,n),[]),er={kind:Eo.kind,mode:Eo,open:Zo,show:e=>Ho(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Qo},nr=Z(er,{data:St.data,selected:vt??null,zoneOf:e=>xt(e)?.zone,readOnly:Boolean(pt),select:e=>{Ho(K),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(pe,e,n),scrollTo:e=>Ui(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),tr=nr.pinnedSource??!1,or=nr.resolveLeftView?nr.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",rr=_(),{isLockedBlock:ir,duplicateBlocked:lr,nestDepth:sr,newSectionNode:dr,canAddTo:cr,blockIsOffered:ar}=rr,pr=Q(),{labelAtLevel:ur,Icon:fr,useProducts:hr}=pr,mr=pr.rowName?(e,n,t)=>pr.rowName(e,n,t):void 0,gr=$n(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Ko(e,{scroll:!0})},[kt,Ko]),{selectNode:yr,openPartId:Sr}=v({mode:Eo,setMode:Ho,onOpenPart:gr}),[kr,br]=Nn(null);we(null!==kr,()=>br(null));const vr=S(ee()),xr=vr.collapsed,wr=vr.panelWidths,[zr,Cr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(xr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});In(()=>{try{window.localStorage.setItem(xr,JSON.stringify([...zr]))}catch{}},[zr]);const[Br,Or]=Nn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(wr);if(!e)return{...k};const n=JSON.parse(e);return{left:b(Number(n.left)||k.left),right:b(Number(n.right)||k.right)}}catch{return{...k}}});In(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(wr,JSON.stringify(Br))}catch{}},300);return()=>clearTimeout(e)},[Br]);const Nr=$n((e,n)=>Or(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ir=$n(e=>Nr("left",e),[Nr]),$r=$n(e=>Nr("right",e),[Nr]),Pr=e=>zr.has(e),Ar=e=>Cr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Tr=Bn(!1),Mr=Bn(null);In(()=>{if(Tr.current&&!No){const e=Mr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??vo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Mr.current=null}Tr.current=No},[No]),In(()=>{if(!No||!wo)return;const e=e=>{"Escape"===e.key&&_i()};return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[No,wo]),we(No,()=>_i()),In(()=>{!Qt&&No&&(Io(!1),To(null),$o.current=!1)},[Qt]),In(()=>{if(!po)return Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Po.current=!1);No&&(Io(!1),To(null),Po.current=$o.current,$o.current=!1),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),In(()=>{!Qt&&po&&(Po.current=!1,uo())},[Qt]),In(()=>{if(!po||!wo)return;const e=e=>{"Escape"===e.key&&uo()};return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[po,wo]),we(null!==po,()=>uo());const jr=ne(),Lr=(e,n="success",t)=>{if(jr)return void(t?jr(e,"error"===n?"error":"info",t):jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Mn.error(e,{...o,duration:t?.duration??3200}):Mn.success(e,{...o,duration:t?.duration??1900})},Rr=Bn(null),[Er,Hr]=Nn(0),[Vr,Fr]=Nn(0),Dr=te(),Ur=Bn(null),Wr=e=>Math.max(0,e.clientHeight-(Ur.current?.offsetHeight??0));In(()=>{const e=Rr.current;if(!e)return;const n=()=>{Hr(e.clientWidth),Fr(Wr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Ur.current&&t.observe(Ur.current),()=>t.disconnect()},[]),Pn(()=>{Rr.current&&(Hr(Rr.current.clientWidth),Fr(Wr(Rr.current)))},[Br,Qt,eo]);const Jr=lo===ro?Er>0?Er:to[ro]:to[lo],Gr=Er>0?Math.min(Er/Jr,"shrink"===io?1:2):1,Yr=Jr*Gr,Xr=Er>0&&Yr>Er+1,Kr={width:Yr,height:Vr||"100%",flex:"none",position:"relative"},qr={width:Jr,height:Vr?Vr/Gr:"100%",maxHeight:"none",transform:1!==Gr?`scale(${Gr})`:void 0,transformOrigin:"top left"},Zr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),_r=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Qr=e=>{No&&(Io(!1),To(null),$o.current=!1,Qt&&go===e)||po&&(Po.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Zr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},ei=()=>{$(hn,{accept:"image/*",title:Ut.mediaLibrary})},ni=()=>{Ho(K),Zt.select(null),u()},ti=()=>{Ho(Pt??K),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},oi=St.data.content??[],ri=()=>{const e=oi.findIndex(At),n=oi.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:oi.length}},ii=wt,li=rr.stripCopy,si=n=>e(n,li),di=w(),ci=Ee({data:St.data,config:ii,readOnly:Boolean(pt),clipboard:di,strip:li?e=>li(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ri();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Ho(K);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),ai=e=>{const n=zn(St.data,wt,e);if(!n)return!1;const t=bn(n.place),o=n.node,r=t===pe?mi(o):Ii(o);return!!ci.remove(e)&&(Lr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{ci.restore(n.node,n.place)}}}),!0)},pi={...ci,remove:ai},ui=e=>ur(e,"block",wt.components[e]?.label??e),fi=$n(e=>wt.components[e]?.defaultProps??{},[wt]),hi=e=>ur(e,"section",ui(e)),mi=e=>l({type:e.type,props:e.props??{}},hi(e.type),mr),{nodeAddresses:gi,zoneItems:yi}=On(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=fe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of he(wt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(oi,pe,0),{nodeAddresses:e,zoneItems:n}},[oi,wt]),Si=$n(e=>yi.get(e)??[],[yi]),ki=e=>{const n=gi.get(e);return n?Si(n.zone)[n.index]:void 0},bi=e=>ae(rr,wt,e),vi=e=>{if(!rr.slotsOf||e===pe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ki(e.slice(0,n));if(!t)return null;const o=bi(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}},xi=(()=>{if(!oe(Eo))return null;const e=`${Eo.nodeId}:${Eo.slot}`;return vi(e)?.slot.panel===Eo.kind?e:null})(),wi=Bn(null);In(()=>{const e=wi.current;if(wi.current=null,!xi||!oe(Eo))return;const n=Eo.nodeId;Ko(n,{scroll:e!==xi}),Cr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Eo]);const zi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=gi.get(e);n&&(n.zone===pe?Wi(n.index):bl(n.zone,n.index,e,ki(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&xi!==i&&(wi.current=i),Qo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ui(o)},Ci=(e,n,t)=>{const o=`${e}:${n}`;if(Cr(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;xi!==o&&(wi.current=o);Qo(null,{kind:t,nodeId:e,slot:n})},Bi=(e,n,t)=>{if(pt||!rr.moveSlot)return;const o=ki(e),r=o?bi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:_n,index:n},s=un(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=rr.moveSlot(e,n,s);"string"==typeof d&&Ci(e,d,i.panel)},Oi=hr(),Ni=On(()=>{const e=/* @__PURE__ */new Map;for(const n of Oi??[])e.set(n.slug,n.name);return e},[Oi]),Ii=e=>s(e,ui,pr.plainText,e=>Ni.get(e),pr.rowName),$i=(e,n)=>{const t=wt.components[e.type]?.fields,o=n===pe||Dl(n)?"section":"block",r=n===pe&&(At(e)||Tt(e)||Nt(e.type)),i="block"===o?d(t):r?null:c(t);return pr.renamePropOf?pr.renamePropOf(e,o,i):i},Pi=(e,n,t,o)=>{if(!(!pt&&kr?.zone===e&&kr.index===n))return;const r=(t,o)=>{br(null),o&&((e,n,t)=>{const o=Si(e)[n];if(!o)return;const r=$i(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.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)},Ai=t(re(),Dt),Ti=Ai.scope({target:Sn,siteId:tt,docId:kn}),Mi=wt,ji=(e,n)=>n===pe?hi(e):ui(e),Li=(e,n,t)=>{const o=Ai.plan(Ti,t,ji(t.type,e),Mi);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Lr(o.message))},Ri=z({nodesIn:Si,nodeAt:(e,n)=>Si(e)[n]??null,labelOf:(e,n)=>n===pe?hi(e):ui(e),renamePropOf:$i,beginRename:(e,n)=>br({zone:e,index:n}),history:{hasPast:bt.hasPast,hasFuture:bt.hasFuture,back:()=>bt.back(),forward:()=>bt.forward()},openAddSection:()=>{Zt.select(null),qi(null)},openPageSettings:()=>{Zt.select(null),Ho(K)},pageSettingsLabel:Lt.pageSettings,words:{menu:Ft,styleClipboard:Dt,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>Cr(new Set(Si(pe).map(e=>String(e.props.id)))),onPasteRefused:e=>Lr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Wl(e,n),menuRows:nr.menuRows,isLocked:e=>ir(e.type),duplicateBlocked:e=>lr(St.data,e),permits:e=>ue(wt,e.type),canAddTo:cr,nodeOps:pi,isPinned:(e,n)=>n===pe&&(At(e)||Tt(e)),sectionBand:ri,openAddInside:(e,n)=>{e===pe?Wi(n):Zt.select({zone:e,index:n}),qi(null)},locate:e=>gi.get(e)??null,rowNameOf:(e,n)=>n===pe?mi(e):Ii(e),selectAt:(e,n,t,o)=>{e===pe?Wi(n):bl(e,n,t,o??"")},slotRung:e=>{const n=vi(e);return n?.slot.panel?{label:n.slot.label,select:()=>zi(n.node,n.slot,!1)}:null},style:{held:()=>P(Ti),canCopy:e=>Ai.rows(Mi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ai.copy(Ti,e,ji(e.type,n),Mi),paste:(e,n,t)=>Li(e,n,t)},keys:ht?{target:wo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??pe,index:e.index}:null},held:()=>di.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Lr(Lt.copied({name:n}))}}:void 0},xo),Ei=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});In(()=>{Ei.current={copy:(e,n)=>Ai.copy(Ti,e,ji(e.type,n),Mi),paste:Li,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??pe,t=Si(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Hi=$n(e=>{const n=A(e);if(!n)return;const t=Ei.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))},[]);In(()=>{if(!wo)return;const e=e=>Hi(e);return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[Hi,wo]),gn(xo,"keydown",Hi);const Vi=oi.map(e=>e.props.id).join("|");In(()=>{const e=xo?.document??null,n=xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ro(e=>e.length?[]:e);const n=oi.findIndex(Tt),t=n>=0?n:oi.length,o=n=>{const t=oi[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(mn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=oi.length>0&&!At(oi[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=Zn(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})}Ro(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[xo,Vi,lo,Gr,Qt,eo,vt?.props.id]);const Fi=xo?.document??null,Di=xo?.window??null;In(()=>{const e=bo.current;if(!e||!Fi||!Di)return;const n=[],t=()=>{const n=Fi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Di.scrollTo({left:Di.scrollX,top:Di.scrollY+t,behavior:"instant"}),!0};return bo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Fi,Di]);const Ui=e=>{nr.holdCanvasOn?nr.holdCanvasOn(e):a(e)},Wi=e=>{Ho(K),Zt.select({index:e}),nr.sectionPressed?.(oi[e]);const n=oi[e]?.props?.id;n&&Ui(n)},Ji=e=>{const{floor:n,cap:t}=ri(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=vt&&Eo.kind!==Pt?.kind?oi.findIndex(e=>e.props.id===vt.props.id):-1;return o(r>=0?r+1:t)},Gi=(e,n)=>{const{floor:t,cap:o}=ri(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(pe,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Yi=(e,n,t,o)=>{Ho(K),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Lr(Lt.sectionAdded({name:t}))},Xi=(e,n)=>{const t=Ji(n),o=dr(e,{nodeDefaults:fi,newNodeId:Se,sectionLabel:hi,blockIsOffered:ar}),r=o?Zt.insertNode(pe,t,o):Zt.insertSection(e,t);return Yi(t,r,hi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of he(wt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=cr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ki=(e,n,t)=>{const o=Ji(t),r=Zt.insertNode(pe,o,n);return Yi(o,r,e),o},qi=e=>Zi(pe,e),Zi=(e,n)=>{Mr.current=document.activeElement??null,po&&($o.current=Po.current,Po.current=!1,uo()),To(null===n?null:{zone:e,index:n}),Io(!0),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},_i=()=>{Io(!1),To(null),$o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),$o.current=!1},Qi=(e,n,t)=>{if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,si(e.template.node))}Ho(K),Zt.select({index:t,zone:n})},el=(e,n)=>pr.rowName?n?At(e)?pr.rowName(e,"section",Lt.header):Tt(e)?pr.rowName(e,"section",Lt.footer):Nt(e.type)?pr.rowName(e,"section",ui(e.type)):mi(e):Ii(e):n?hi(e.type):ui(e.type),nl=e=>n=>{e()},tl=()=>nr.editPinnedSource?.(),ol=(e,n,t)=>{if(pt)return null;const o=Si(e)[n];return o&&!ue(wt,o.type).delete?null:/* @__PURE__ */Un(Te,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Si(e)[n]?.props?.id;null!=t&&ai(String(t))})(e,n),children:/* @__PURE__ */Un(Hn,{size:15})})},rl=e=>pr.rowPreview?.(e)||void 0,il=e=>pr.rowMarks?.(e)??void 0,ll=(e,n,t)=>pr.rowActions?.(e,n,t)??null,sl=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Un(Te,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>cl(e,n,t),children:/* @__PURE__ */Un(r?Vn:Fn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},dl=e=>{const n=hi(oi[e]?.type??""),t=n?Lt.addSectionBefore({name:n}):Lt.addSectionHere;return ks(pe,e,()=>qi(e),t)},cl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},al=e=>me(wt,e),pl=e=>he(wt,e),ul=e=>rr.slotsOf?bi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ge(e,n.slot)})):[{slot:null,rung:null,kids:pl(e)}],fl=e=>rr.slotsOf?ul(e).flatMap(e=>e.kids):pl(e),hl=e=>Boolean(rr.slotsOf)&&bi(e).some(e=>e.rung),ml=(e,n,t)=>null===t?void 0===n?cr(e):cr(e,n):cr(e,n,t),gl=(e,n,t)=>{const o=ye(wt,e.type,n)&&(t||fl(e).length>0||hl(e));return{collapsible:o,folded:o&&Pr(String(e.props.id))}},yl=(e,n,t)=>ul(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>gl(e,r,t(e.type)).collapsible?[String(e.props.id),...yl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Sl=e=>fl(e).length>0||hl(e)||Boolean(cr(e.type)),kl=e=>Boolean(cr(e)),bl=(e,n,t,o)=>{if(Ho(K),cr(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Zt.select({index:n,zone:e}),a(t)}else Zt.select({index:n,zone:e}),Ui(t)},vl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),cr(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},xl=(e,n,t)=>{Zt.insertComponent(e,n,t),Ho(K),Zt.select({index:t,zone:e})},wl=Bn(/* @__PURE__ */new Set);In(()=>{oi.forEach(e=>{const n=cr(e.type)?.spec;if(!n)return;const t=e.props.id;if(wl.current.has(t))return;wl.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(fi)).forEach((e,t)=>Xt.seedChild(o,t,n.childType,e))})},[oi,Xt,fi]);const zl=Bn(/* @__PURE__ */new Set);In(()=>{oi.forEach((e,t)=>{const o=e.props.id;if(zl.current.has(o))return;const r=n(e,al(e.type));zl.current.add(o),r&&Xt.replaceComponent(pe,t,{...e,props:r})})},[oi,Xt]),ie(Xt,wt);const Cl=oi.findIndex(Tt),Bl=Cl>=0?oi[Cl]:null,Ol=Mt?oi.findIndex(At):-1,Nl=Ol>=0?oi[Ol]:null,Il=zt.groupTab,$l=On(()=>Il?e=>Nt(e.type):void 0,[Il]),Pl=Boolean(zt.groupBadge),Al=zt.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(Tn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,Tl=oi.find(e=>e.type===Bt)??null,Ml=oi.find(e=>e.type===Ot)??null,jl=Cl>=0?Cl:oi.length,Ll=[];oi.forEach(e=>{Tt(e)||(Sl(e)&&Ll.push(String(e.props.id)),Ll.push(...yl(e,1,kl)))}),Bl&&(Ll.push(String(Bl.props.id)),Ll.push(...yl(Bl,1,kl)));const Rl=Ll.length>0&&Ll.every(e=>zr.has(e)),El=e=>{const n=pr.blockRowName(e,ui);return pr.rowName?pr.rowName(e,"block",n):n},Hl=(e,n,t,o)=>{const r=Si(e)[t];if(!r)return;const i={...wn(e),index:t},l={...wn(n),index:Math.min(Math.max(o,0),Si(n).length)},s=un(i,l);if(e!==n||s!==t)try{ci.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},Vl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of pl(e))n.add(r),t(o)};for(const t of al(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=gi.get(n);if(!e)return null;if(e.zone===pe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Dl=e=>{const n=e.slice(0,e.indexOf(":")),t=oi.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&It(n)===e?t:null},Ul=(e,n,t)=>{if(e.rung){const t=ki(e.rung.nodeId),o=t?bi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===_n&&n.index>=0&&n.index<=o}if(n.slot===_n)return!1;if(e.add)return Gl(e.add,n);const o=bn(n);if(Nt(e.type))return!1;const r=Dl(o),i=Dl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Si(o).length);if(e.zone===pe||o===pe){if(e.zone!==o)return!1;const{floor:t,cap:r}=ri();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Si(o).length)return!1;if(e.zone===o)return!0;const l=Bl&&!zt.lastIsOpen?String(Bl.props.id):null;return(!l||Fl(e.zone)!==l&&Fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Si(e)[t];if(!r)return!1;const i=n.split(":")[0],l=gi.get(i),s=l?Si(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Vl(r).has(n))return!1;const d=cr(s.type,sr(St?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Si(n),r))})(e.zone,o,e.index,t)},Wl=(e,n)=>{const t=bn(e.from);if(t===bn(n))return!0;const o=e.node;return Ul({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Jl=e=>{const n=e.slice(0,e.indexOf(":")),t=gi.get(n),o=t?Si(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=cr(o.type,sr(St?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:ui(r.spec.childType)}]:[]),l=vi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:el(o,t.zone===pe)}},Gl=(e,n)=>{const t=bn(n);if("block"!==e.kind){if(Dl(t))return n.index>=0&&n.index<=Si(t).length;if(t!==pe)return!1;const{floor:e,cap:o}=ri();return n.index>=e&&n.index<=o}if(t===pe)return!1;const o=Jl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Si(t))},Yl=(e,n)=>{e.rung?Bi(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Dl(bn(n)))return void Qi(e,bn(n),n.index);if("section"===e.kind)return void Xi(e.type,n.index);if("template"===e.kind)return void Ki(e.template.name,si(e.template.node),n.index);const t=bn(n),o=Jl(t);o&&(o.target.spec?vl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):xl(t,e.type,n.index))})(e.add,n):e.zone===pe?Gi(e.index,n.index):Hl(e.zone,bn(n),e.index,n.index)},[Xl]=Nn(()=>an()),Kl=pn({keyOf:e=>e.id,readOnly:Boolean(pt),session:Xl,canDrop:Ul,onDrop:Yl,onStep:(e,n)=>{e.rung?Bi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===pe?((e,n)=>{const t=hi(oi[e]?.type??""),o=Gi(e,n<0?e-1:e+2);if(!o.moved)return void Lr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=ri();Lr(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Hl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ql=$n(e=>{const{floor:n,cap:t}=ri(),o=[];for(const r of e.nodes){const e=bn(r.place),i=Si(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(At(i)||Tt(i)||ir(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Dl(e)),s=e===pe||l;e===pe&&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?hi(i.type):Ii(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=bn(e.list);return n===pe&&0===e.children.length?[{...e,addLabel:Lt.addSection,addAlways:!0}]:e.children.length>0||Boolean(Jl(n)?.choices.length)||Boolean(Dl(n))?[e]:[]}),i=r.flatMap(e=>{const n=bn(e.list);return n===pe||Dl(n)||!Jl(n)?.choices.length?[]:ln(e,Lt.addBlockHere)});return{sources:o,zones:r,seams:i}},[St.data]),Zl=null==vt?.props.id?null:String(vt.props.id),_l=$n(e=>{const n=wt,t=e=>!e.item.rung&&null!==zn(St.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Zl);return i||(r(He(St.data,n,o.item.id,Zl,$l))??o)},[St.data,wt,Zl,$l]),[Ql,es]=Nn(null);gn(xo,"mouseover",e=>{if(!Il)return;const n=yn(e.target),t=n?Yn(St.data,wt,n):null;t!==Ql&&es(t)}),gn(xo,"mouseout",e=>{Il&&!e.relatedTarget&&es(null)});const ns=e=>At(e)||Tt(e)||Nt(e.type),ts=[];if(Il){const e=Zl?Yn(St.data,wt,Zl):null;for(const n of/* @__PURE__ */new Set([e,Ql])){const e=n?oi.find(e=>String(e.props.id)===n):void 0;if(!e||!ns(e))continue;const t=Il(e);t&&ts.push({id:String(e.props.id),label:t,below:At(e)||e.type===Bt})}}const os=R(),rs=Bn(null);In(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(oi.filter(ns)),t=rs.current;if(rs.current={doc:kn,bands:n,index:bt.index},!t||t.doc!==kn||t.bands===n)return;bt.hasPast&&bt.index>=t.index&&!Gn.has(os)&&(Gn.add(os),Lr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>bt.back()},duration:8e3}))},[oi]);const is=e=>{Ho(K),Zt.select(e.zone===pe?{index:e.index}:{index:e.index,zone:e.zone})},ls=le(),ss=()=>({data:St.data,device:lo,ops:Zt,inspector:er}),ds=ls?.model,cs=On(()=>ds?e=>ds(e,ql(e),ss()):ql,[ds,ql,lo]),as=ls?.measure,ps=as?(e,n)=>as(e,n,ss()):void 0,us=ls?.canDrop,fs=us?(e,n)=>us(e,n,Ul,ss()):Ul,hs=ls?.drop,ms=hs?(e,n)=>hs(e,n,Yl,ss()):Yl,gs=ls?.pick,ys=gs?e=>gs(e,is,ss()):is,Ss=e=>{const n=bn(e),t=vi(n);t&&zi(t.node,t.slot,!1),Zi(n,e.index)},ks=(e,n,t,o)=>/* @__PURE__ */Un(Me,{...pt?{}:Kl.seam({place:{...wn(e),index:n}}),onAdd:pt?void 0:t,label:o},`seam:${e}:${n}`),bs={rowClick:nl,isCollapsed:Pr,toggleCollapse:Ar},vs=e=>{const n=String(e.props.id),t=oi.findIndex(e=>String(e.props.id)===n),o=It(n),r=Si(o),i=Pr(n),l=ui(e.type),s=pr.rowName?pr.rowName(e,"section",l):l,d=e=>ks(o,e,()=>Zi(o,e),Lt.addSectionHere);/* @__PURE__ */
|
|
11
|
-
return Wn(Jn,{children:[
|
|
12
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:e.type,size:13}),name:s,preview:rl(e),marks:il(e),onSelect:()=>Wi(t),nameSlot:Pi(pe,t,n,s),selected:Jo===n,badge:Al,actions:ll(e,pe,t)??void 0,rowProps:{"data-node-id":n,onClick:nl(()=>Wi(t))},fold:{open:!i,label:"section",onToggle:()=>Ar(n)}}),!i&&/* @__PURE__ */Wn($e,{children:[r.map((n,t)=>{const r=String(n.props.id),i=mi(n),l=Sl(n),s=l&&Pr(r),c=()=>bl(o,t,r,e.type),{rowProps:a,...p}=Kl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...wn(o),index:t}},{"data-node-id":r,onClick:nl(c)});/* @__PURE__ */
|
|
13
|
-
return Wn(An,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:c,nameSlot:Pi(o,t,r,i),selected:Jo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ar(r)}:void 0,actions:/* @__PURE__ */Wn(Jn,{children:[ol(o,t,i),ll(n,o,t),sl(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un($e,{children:zs(n,2)})]},r)}),d(r.length)]})]})},xs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Kl.dragging,d=!Pr(l)&&s?.rung?.nodeId!==i,c={...wn(l),index:0},a=s&&!s.rung&&Ul(s,c)?c:void 0,p=()=>zi(e,n,!0),{rowProps:u,...f}=Kl.row({item:{id:`rung:${l}`,zone:`${i}:${_n}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:_n,index:t},into:a,canDrag:Boolean(rr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:nl(p)}),h=pt?null:rr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Wn(An,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:xi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ar(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Jn,{children:h.map((t,o)=>/* @__PURE__ */Un(Te,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ci(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Un(Hn,{size:15}):/* @__PURE__ */Un(Dn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un($e,{children:r})]},l)},ws=(e,n)=>{const t=ul(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Un(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=ml(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(Jl(c)?.choices.length),p=(e,n)=>a?ks(e,n,()=>Zi(e,n),Lt.addBlockHere):ks(e,n),u=/* @__PURE__ */Wn(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Jo===String(n.props.id),{collapsible:i,folded:s}=gl(n,l,kl(n.type)),d=String(n.props.id),c=El(n),a=()=>bl(t,o,d,e.type),{rowProps:u,...f}=Kl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...wn(t),index:o}},{"data-node-id":d,onClick:nl(a)});/* @__PURE__ */
|
|
18
|
-
return Wn(An,{children:[0===o&&p(t,0),
|
|
19
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:c,preview:rl(n),marks:il(n),onSelect:a,nameSlot:Pi(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ar(d)}:void 0,actions:/* @__PURE__ */Wn(Jn,{children:[ol(t,o,c),ll(n,t,o),sl(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un($e,{children:ws(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?xs(e,t.rung,r++,o,u):/* @__PURE__ */Un(An,{children:u},t.slot??"")})})},zs=(e,n)=>{const t=sr(St?.data,e.type,String(e.props.id)),o=ul(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Un(Jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=ml(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>vl(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>Zi(n,t):void 0;return ks(n,t,o,n===f&&c?c.addLabel:Lt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Wn(Jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Jo===String(n.props.id),i=Ii(n),l=String(n.props.id),{collapsible:d,folded:c}=gl(n,s,kl(n.type)),a=al(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...wn(p),index:Si(p).length}:void 0,f=Kl.dragging,h=u&&f&&Ul(f,u)?u:void 0,g=()=>bl(t,o,l,e.type),{rowProps:y,...S}=Kl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...wn(t),index:o},into:h,canDrag:!ir(n.type)},{"data-node-id":l,onClick:nl(g)});/* @__PURE__ */
|
|
21
|
-
return Wn(An,{children:[0===o&&m(t,0),
|
|
22
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:g,nameSlot:Pi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Ar(l)}:void 0,actions:ir(n.type)?ll(n,t,o)??void 0:/* @__PURE__ */Wn(Jn,{children:[ol(t,o,i),ll(n,t,o),sl(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un($e,{children:zs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Un(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>vl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?xs(e,o.rung,i++,r,S):/* @__PURE__ */Un(An,{children:S},o.slot??"")})})},Cs=(()=>{if(!vt||!Vo)return null;const e=String(vt.type),n=String(vt.props.id),t=cr(e,sr(St?.data,e,n));if(!t||"footer"===t.source)return null;const o=oi.some(e=>String(e.props?.id)===n),r=Array.isArray(vt.props[t.slot])?vt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:ui(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:el(vt,o),choices:i,onPick:o=>{t.spec?vl(n,t.slot,o,r.length,e):xl(`${n}:${t.slot}`,o,r.length)}}})(),Bs=Uo&&Uo.zone!==pe&&!Dl(Uo.zone)?Uo.zone:null,Os=!0===Mo.blocksFirst,Ns=Bs?Jl(Bs):Os&&Uo?null:Cs,Is=Boolean(Ao&&Bs)||Os&&Boolean(Ns&&Ns.choices.length>0),$s=No||null!==po,Ps=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!$s&&or===e.id,onSelect:()=>Qr(e.id)}:e,As=[{id:"add",label:Lt.add.title,icon:/* @__PURE__ */Un("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:No,onSelect:()=>No?_i():qi(null)},...(nr.railLead??[]).map(Ps),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Un(Ve,{}),active:Qt&&!$s&&"sections"===or,onSelect:()=>Qr("sections")},...(nr.railTrail??[]).map(Ps)];ao?As.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),active:Qt&&!No&&(null!==po||"media"===or),onSelect:()=>Qr("media")}):mt&&As.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),onSelect:ei});const Ts=[...nr.railLead??[],...nr.railTrail??[]].find(e=>"panel"in e&&e.id===or),Ms=Boolean(jt?.foldable)&&!tr,js=jt?.label??(gt?Lt.pageSections:Lt.templateSections),Ls=Ms&&Pr(Qn),Rs=/* @__PURE__ */Wn(Jn,{children:[oi.map((e,n)=>{if(At(e)||Tt(e)||Nt(e.type))return null;const t=Jo===String(e.props.id),o=Boolean(e.props._hidden);pl(e);const r=String(e.props.id),i=nr.hasOwnRows?.(e)??!1,l=Sl(e)||i,s=l&&Pr(r),d=al(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...wn(c),index:Si(c).length}:void 0,p=Kl.dragging,u=a&&p&&Ul(p,a)?a:void 0,{rowProps:f,...h}=Kl.row({item:{id:r,zone:pe,index:n,type:e.type},place:{...wn(pe),index:n},into:u},{"data-node-id":r,onClick:nl(()=>Wi(n))});/* @__PURE__ */
|
|
24
|
-
return Wn(An,{children:[n>0&&dl(n),
|
|
25
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:e.type,size:13}),name:mi(e),preview:rl(e),marks:il(e),onSelect:()=>Wi(n),nameSlot:Pi(pe,n,r,mi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ar(r)}:void 0,actions:/* @__PURE__ */Wn(Jn,{children:[ol(pe,n,mi(e)),ll(e,pe,n),sl(pe,n,e,mi(e))]}),rowProps:f}),Sl(e)&&!s&&/* @__PURE__ */Wn($e,{children:[zs(e,1),nr.partRows?.(e,bs)]}),i&&!s&&/* @__PURE__ */Un($e,{children:nr.ownRows?.(e,n,bs)})]},String(e.props.id??n))}),!tr&&jl>0&&dl(jl),jt?.addAtEnd&&!tr&&!pt&&/* @__PURE__ */Un(T,{small:!0,label:Lt.addSection,blocked:null,onAdd:()=>qi(jl)})]}),Es=(e,n,t)=>{const o=String(e.props.id),r=fl(e).length>0||hl(e)||Boolean(cr(e.type)),i=r&&Pr(o),l="header"===t?Lt.header:Lt.footer,s=pr.rowName?pr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Wn(Jn,{children:[
|
|
27
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:t,size:13}),name:s,preview:rl(e),marks:il(e),badge:Al,onSelect:()=>Wi(n),nameSlot:Pi(pe,n,o,s),selected:Jo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ar(o)}:void 0,actions:ll(e,pe,n)??void 0,rowProps:{"data-node-id":o,onClick:nl(()=>Wi(n))}}),r&&!i&&/* @__PURE__ */Un($e,{children:ws(e,1)})]})};return(nr.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Un(se,{target:xo,children:/* @__PURE__ */Wn("div",{ref:vo,className:"sf-editor es-editor",style:_e(Br),onContextMenu:Ri.onEditorContextMenu,...g(hn),children:[
|
|
29
|
-
/* @__PURE__ */Wn(De,{children:[
|
|
30
|
-
/* @__PURE__ */Un(Ue,{items:As,ariaLabel:Lt.bar.views}),
|
|
31
|
-
/* @__PURE__ */Wn(We,{children:[
|
|
32
|
-
/* @__PURE__ */Un(Je,{label:Lt.bar.undo,disabled:Boolean(pt)||!bt.hasPast,onClick:()=>bt.back(),children:/* @__PURE__ */Un(Ln,{})}),
|
|
33
|
-
/* @__PURE__ */Un(Je,{label:Lt.bar.redo,disabled:Boolean(pt)||!bt.hasFuture,onClick:()=>bt.forward(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
34
|
-
/* @__PURE__ */Un(Ge,{}),
|
|
35
|
-
/* @__PURE__ */Un(Ye,{devices:no,value:lo,onChange:so}),
|
|
36
|
-
/* @__PURE__ */Un(Je,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{bo.current=(()=>{const e=xo?.document;if(!e)return null;const n=oi.findIndex(Tt),t=n>=0?n:oi.length;let o=null;for(let n=0;n<t;n++){const t=oi[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=vt?.props?.id??oi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Un(En,{})})]}),
|
|
37
|
-
/* @__PURE__ */Wn(We,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Un(B,{input:Bo,words:Lt.saveStatus}),nr.barLead?.(),nr.barTrail?.(),nr.mainAction||!nr.barMain?/* @__PURE__ */Un(O,{input:Bo,action:nr.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Oo,bar:Lt.bar,words:Lt.saveStatus}):nr.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Un(C,{}),
|
|
40
|
-
/* @__PURE__ */Wn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Wn(Jn,{children:[
|
|
41
|
-
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Un(M,{blocks:Ns,blocksOnly:Is,at:Ao?{label:(e=>{const n=Dl(e.zone);if(n)return Lt.add.addingTo({name:pr.rowName?el(n,!0):ui(n.type)});if(e.zone===pe){const n=oi[e.index];return n&&!Tt(n)?Lt.add.addingBefore({name:el(n,!0)}):Lt.add.addingAtEnd}const t=Jl(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Ao),onClear:()=>To(null)}:void 0,onAdd:e=>{const n=Uo,t=(e,n)=>{Ao&&To({zone:e,index:n})};if(n&&"block"!==e.kind&&Dl(n.zone))return Qi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Wo)return void Xi(e);const n=Xi(e,Wo);Ao&&jo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Wo)return void Ki(e,n);const t=Ki(e,n,Wo);Ao&&jo(t+1)})(e.template.name,si(e.template.node));if(n&&n.zone!==pe){const o=Jl(n.zone);if(!o)return;return o.target.spec?vl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):xl(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Cs?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Xl,siteWide:nr.addPanelRow?.(_i),onClose:_i,onHide:Zr,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
-
/* @__PURE__ */Un(E,{panel:co,pick:po,onHide:Zr}):Ts?Ts.panel({onHide:Zr,notify:Lr}):"media"===or&&co?/* @__PURE__ */Un(E,{panel:co,pick:null,onHide:Zr}):/* @__PURE__ */Wn(Jn,{children:[
|
|
43
|
-
/* @__PURE__ */Un(j,{icon:/* @__PURE__ */Un(Ve,{}),title:Lt.layers,context:Wt,actions:
|
|
44
|
-
/* @__PURE__ */Un(Xe,{label:Rl?Lt.expandAll:Lt.collapseAll,title:0===Ll.length?Lt.nothingToFold:void 0,disabled:0===Ll.length,onClick:()=>Cr(e=>{const n=new Set(Ll);return Rl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ll])}),children:/* @__PURE__ */Un(Kn,{expand:Rl})}),onHide:Zr}),
|
|
45
|
-
/* @__PURE__ */Wn(Pe,{className:"sf-tree sf-scroll",words:Rt,children:[
|
|
46
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:ni,selected:!vt&&Vo,rowProps:{onClick:nl(ni)}}),Tl&&/* @__PURE__ */Wn(Jn,{children:[!Pl&&/* @__PURE__ */Un(Ae,{children:Lt.header}),vs(Tl)]}),!tr&&yt&&!(Pl&&Tl)&&/* @__PURE__ */Wn(Jn,{children:[!Pl&&/* @__PURE__ */Un(Ae,{children:Lt.header}),!Mt&&/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:"header",size:13}),name:Lt.header,badge:Al,onSelect:ti,selected:Eo.kind===Pt?.kind,rowProps:{onClick:nl(ti)}})]}),!tr&&Nl&&!(Pl&&Tl)&&Es(Nl,Ol,"header"),!tr&&!Ms&&/* @__PURE__ */Un(Ae,{children:js}),Ms?/* @__PURE__ */Wn(Jn,{children:[
|
|
47
|
-
/* @__PURE__ */Un(Ie,{words:Rt,icon:null,name:js,fold:{open:!Ls,label:js,onToggle:()=>Ar(Qn)}}),!Ls&&/* @__PURE__ */Un($e,{children:Rs})]}):Rs,yt&&!Pl&&/* @__PURE__ */Un(Ae,{children:Lt.footer}),Bl&&!(Pl&&Ml)&&Es(Bl,Cl,"footer"),!tr&&!Bl&&yt&&!Pl&&/* @__PURE__ */Un(Ie,{words:Rt,icon:/* @__PURE__ */Un(fr,{type:"footer",size:13}),name:Lt.footer,onSelect:tl,rowProps:{onClick:nl(tl),title:Lt.editFooter}}),Ml&&vs(Ml),nr.treeFoot?.()]})]})}),
|
|
48
|
-
/* @__PURE__ */Un(Ke,{side:"left",width:Br.left,min:Ze,max:qe,defaultWidth:k.left,label:Lt.resizeLeftPanel,onResize:Ir})]}):/* @__PURE__ */Un(L,{side:"left",onShow:Zr}),
|
|
49
|
-
/* @__PURE__ */Wn("div",{ref:Rr,className:"sf-center sf-scroll","data-sf-canvas-head":Dr?"":void 0,style:{overflowX:Xr?"auto":"hidden",overflowY:"hidden"},children:[Dr&&/* @__PURE__ */Un("div",{ref:Ur,className:"sf-canvas-head",children:/* @__PURE__ */Un(Dr,{device:lo})}),
|
|
50
|
-
/* @__PURE__ */Wn("div",{className:"sf-frame-scaler",style:Kr,children:[
|
|
51
|
-
/* @__PURE__ */Un("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:qr,children:/* @__PURE__ */Wn("div",{className:"sf-preview-host",children:[
|
|
52
|
-
/* @__PURE__ */Un(Ne.Provider,{value:$l,children:/* @__PURE__ */Un(Jt,{},So)}),
|
|
53
|
-
/* @__PURE__ */Un(sn,{canvas:xo,session:Xl,model:cs,measure:ps,canDrop:fs,onDrop:ms,choose:_l,onPick:ys,onZoneAdd:Ss,onSeamAdd:Ss,zoneAddLabel:Lt.canvasAddBlock,words:Et.canvas,readOnly:Boolean(pt),revision:St.data}),Lo.length>0&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:Lo.map(e=>
|
|
54
|
-
/* @__PURE__ */Un(dn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>qi(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))})]})}),Il?/* @__PURE__ */Un(Xn,{canvas:xo,tabs:ts,onSelect:e=>{const n=oi.findIndex(n=>String(n.props.id)===e);n>=0&&Wi(n)}}):null]})]}),eo?/* @__PURE__ */Wn(Jn,{children:[
|
|
55
|
-
/* @__PURE__ */Un(y,{value:{selectChild:bl,addChild:vl,childRowName:Ii,blockRowName:El},children:/* @__PURE__ */Un(Gt,{mode:Eo,onOpenWebsiteSettings:nr.openSettings??(()=>{}),onOpenSiteStyles:nr.openStyles,onSelectNode:yr,onNotify:Lr,onHidePanel:_r,nodeActions:vt?ue(wt,vt.type):et})}),
|
|
56
|
-
/* @__PURE__ */Un(Ke,{side:"right",width:Br.right,min:Ze,max:qe,defaultWidth:k.right,label:Lt.resizeSettingsPanel,onResize:$r})]}):
|
|
57
|
-
/* @__PURE__ */Un(L,{side:"right",onShow:_r})]}),Ri.menu]})}))}export{nt as ScreenChrome};
|
package/dist/chunk-WMQN4PHH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-JSO6F7IY.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-OHMYY3FX.js";import{useEasel as p}from"./chunk-E63CSJUL.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 h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|