efficient-easel 3.1.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/blocks/index.d.ts +2 -2
- package/dist/{chunk-EF3YSWT5.js → chunk-2I7MAA2U.js} +1 -1
- package/dist/chunk-55IKQFBW.js +5 -0
- package/dist/{chunk-JVUGLF5I.js → chunk-6B4276GZ.js} +3 -3
- package/dist/{chunk-TGF7KEO7.js → chunk-6QSPOILR.js} +1 -1
- package/dist/chunk-7P6IFCR4.js +1 -0
- package/dist/{chunk-LHZIMK3M.js → chunk-FRGCTHDB.js} +1 -1
- package/dist/{chunk-PT6V53OO.js → chunk-J2JBETVO.js} +1 -1
- package/dist/chunk-MCHMF32I.js +1 -0
- package/dist/{chunk-53NZMIRT.js → chunk-MTRFMGBO.js} +1 -1
- package/dist/{chunk-BVUPKIM3.js → chunk-OFNXIZEP.js} +1 -1
- package/dist/{chunk-VX5GDBRI.js → chunk-PAM3NLFL.js} +1 -1
- package/dist/chunk-PDZXAFNX.js +9 -0
- package/dist/chunk-QASZFO4S.js +1 -0
- package/dist/chunk-QVWPI2FL.js +5 -0
- package/dist/{chunk-7HGVGKWU.js → chunk-TNTV7UZ6.js} +65 -64
- package/dist/{chunk-TCNPQKY6.js → chunk-UVAIY7VO.js} +1 -1
- package/dist/{chunk-QMBB7SU5.js → chunk-WSNVBUPL.js} +1 -1
- package/dist/{chunk-VGV5D667.js → chunk-WZMU646D.js} +2 -2
- package/dist/{chunk-4LD4KA27.js → chunk-ZN752E2O.js} +1 -1
- package/dist/easel/index.d.ts +5 -5
- package/dist/easel/index.js +1 -1
- package/dist/node-ops/index.d.ts +2 -2
- package/dist/node-ops/index.js +1 -1
- package/dist/{plan-DChbUXdS.d.ts → plan-BdQ9mLIf.d.ts} +20 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +2 -2
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -3
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +2 -2
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -2
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.d.ts +2 -2
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -2
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-hooks.d.ts +2 -2
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +2 -2
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
- package/dist/screen/lib/puck/section-doc.d.ts +2 -2
- package/dist/screen/lib/puck/style-clipboard.d.ts +2 -2
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +4 -4
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +2 -2
- package/dist/screen/lib/session-context.d.ts +2 -2
- package/dist/screen/lib/session.d.ts +2 -2
- package/dist/screen/words.d.ts +2 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/{types-E3HrTPg2.d.ts → types-CGFykP7c.d.ts} +1 -1
- package/dist/{useNodeOps-BF0fQsif.d.ts → useNodeOps-B3e4b8a2.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-D2BCHTQR.js +0 -1
- package/dist/chunk-EJ6QAWRH.js +0 -5
- package/dist/chunk-LYALMY55.js +0 -1
- package/dist/chunk-MYC3AVG2.js +0 -1
- package/dist/chunk-PYCLHOSA.js +0 -9
- package/dist/chunk-UV4D7CDX.js +0 -5
package/README.md
CHANGED
|
@@ -713,7 +713,9 @@ const up = ops.parentOf(selection); // null → render nothing
|
|
|
713
713
|
The plain functions (`planRemove`, `planDuplicate`, `planMove`, `planStep`,
|
|
714
714
|
`planPaste`, `planSetProps`, `canStep`, `parentStep`) are exported too, and
|
|
715
715
|
`efficient-easel/data` gains `copyNode` — a block with fresh ids, what a paste
|
|
716
|
-
inserts.
|
|
716
|
+
inserts. So are the canvas's click-through rule (3.2.0): `nodeChain` (the
|
|
717
|
+
top-level block down to a node, by id) and `nextInChain` (what a click on that
|
|
718
|
+
chain picks, given the selection), for a host that adds rungs of its own.
|
|
717
719
|
|
|
718
720
|
## Autosave — `efficient-easel/autosave`
|
|
719
721
|
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
|
|
2
|
-
import { P as Permissions, A as AppState } from '../types-
|
|
2
|
+
import { P as Permissions, A as AppState } from '../types-CGFykP7c.js';
|
|
3
3
|
import '../data/index.js';
|
|
4
4
|
import '../types-41704JE4.js';
|
|
5
5
|
import '../resolve-D68pb3Bx.js';
|
|
6
|
-
import '../plan-
|
|
6
|
+
import '../plan-BdQ9mLIf.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* efficient-easel/blocks — how a block is WRITTEN: its config, its fields, the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-MCHMF32I.js";import{EditNotice as r}from"./chunk-GTDLBUOC.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -0,0 +1,5 @@
|
|
|
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-PDZXAFNX.js";import{Inspector as i}from"./chunk-CRPJGCSO.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},C={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function S(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(D.Provider,{value:n,children:e})}function N(){return u(D)}function x(){return(N().useOwnerName??g)()}function A(){return(N().useDocumentLabel??y)()}function B(n,e,t,r){return(N().useBridges??v)(n,e,t,r)}function F(n){return(N().useStandaloneBridges??v)(n)}function I(n,e){(N().useDocumentPass??b)(n,e)}function R(){return N().blockRules??O}function T(){return N().blockLook??j}function K(){return N().devices??w}function V(){return N().leftView??C}function W(){return N().pinned??L}function X(){return N().saveSwitch??!0}function Z(n){e(!0===N().pickFollowsSelection,n)}function E(){return N().add??h}function H(){return N().storageNamespace||void 0}function J(){return N().styleClipboard??null}function Q(){return N().nodeKeys??!0}function Y(){return N().notify??null}function q(){return N().Canvas??P}function z(){return N().CanvasHead??null}function M(){return N().canvasDrag??null}var U=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(U.Provider,{value:n,children:e})}function _(){return u(U)}function nn(){return N().Inspector??S}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,E as useScreenAdd,T as useScreenBlockLook,R as useScreenBlockRules,B as useScreenBridges,M as useScreenCanvasDrag,q as useScreenCanvasFrame,z as useScreenCanvasHead,_ as useScreenCanvasTarget,K as useScreenDevices,A as useScreenDocumentLabel,I as useScreenDocumentPass,nn as useScreenInspectorPanel,V as useScreenLeftView,Q as useScreenNodeKeys,Y as useScreenNotify,x as useScreenOwnerName,N as useScreenParts,Z as useScreenPickFollowsSelection,W as useScreenPinned,X as useScreenSaveSwitch,H as useScreenStorageNamespace,J as useScreenStyleClipboard,F as useStandaloneScreenBridges};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-
|
|
1
|
+
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-6QSPOILR.js";import{ScreenChrome as e}from"./chunk-TNTV7UZ6.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
|
|
2
2
|
return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
|
|
3
3
|
/* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
|
|
4
4
|
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
|
|
5
5
|
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:
|
|
7
|
-
/* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:H,parts:r,children:/* @__PURE__ */m(v,{})}),
|
|
6
|
+
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:N,cancelPendingNav:j,discardAndNavigate:M,saveAndNavigate:y}=a(),H=t(()=>o(!u),[u]),O=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
|
|
7
|
+
/* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:H,parts:r,children:/* @__PURE__ */m(v,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:M,onSave:()=>{y()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:O.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:O.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-55IKQFBW.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PDZXAFNX.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-PAM3NLFL.js";import{BUCKET_KEY as r}from"./chunk-R2HLPNQF.js";import{ANCHOR_FIELD_KEYS as e,foldMetaOf as s,MEDIA_FIELD_MARKER as c,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as i}from"./chunk-DUVRZ456.js";import{STYLE_KIND as u,fieldKind as f,copyStyle as a,heldStyle as l,planPaste as m,pasteMessage as y}from"./chunk-V7U33NF2.js";var h=/* @__PURE__ */new Set([r.Style,r.Layout]),j=new Set(Object.values(r)),w=new Set(e),b=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[c,p,i];function L(t){return`site:${t??""}`}function S(t){if(!t||"object"!=typeof t)return null;const n=t,r=o(t)??t,e=n[u]??r[u];if("string"==typeof e)return e;const s=n.options??r.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(r)}function g(t){const n=t,r=o(t);return k.some(t=>t in n||r&&t in r)}function v(o,r){const e=t(o,r)??{},c=[];let p=!1;for(const[t,o]of Object.entries(e))j.has(t)?p=h.has(t):p&&o&&"object"==typeof o&&!t.startsWith("_")&&(s(o)||w.has(t)||b.has(t)||g(o)||"slot"!==o.type&&c.push({path:[t],kind:S(o),counted:"mobile"!==n(o)?.tier}));return c}function F(t,o,n,r,e){a({scope:n,type:r.type,label:e,rows:t(o,r),props:r.props})}function d(t,o,n,r,e,s){const c=l(n);if(!c)return null;const p=m(c,{type:r.type,rows:t(o,r),props:r.props});return{...p,message:y(p,c.sourceLabel,e,s)}}function A(t,o,n,r){F(v,t,o,n,r)}function N(t,o,n,r,e){return d(v,t,o,n,r,e)}var P={scope:t=>L(t.siteId),rows:(t,o)=>v(t,o),copy:(t,o,n,r)=>A(r,t,o,n),plan:(t,o,n,r)=>N(r,t,o,n)};function I(t,o){if(!t&&!o)return P;const n=t?.rows,r=n?(t,o)=>n(t,o):v;return{scope:t?.scope??P.scope,rows:(t,o)=>r(t,o),copy:t?.copy??((t,o,n,e)=>F(r,e,t,o,n)),plan:t?.plan??((t,n,e,s)=>d(r,s,t,n,e,o))}}export{A as copyNodeStyle,v as nodeStyleRows,N as planNodePaste,S as shopFieldKind,L as siteStyleScope,I as styleClipboardOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-55IKQFBW.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PDZXAFNX.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-PDZXAFNX.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={title:"Add",contextBlocks:"Blocks for this place",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",startBlank:"Start blank",templates:"Your templates",inside:({name:e})=>`Inside ${e}`,tile:({name:e})=>`Add ${e}`,hintBlocks:"Drag into the page, or click to add.",hint:"Drag onto the page, or click to add.",searchBlocks:"Search blocks",searchSections:"Search sections",addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},t={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionBefore:({name:e})=>`Add section before ${e}`,addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving…"},bar:{undo:"Undo",redo:"Redo",refresh:"Refresh",refreshTip:"Refresh the preview (reloads the canvas, keeps your place)",notSaving:"Not saving — see the notice above",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views"},menu:{undo:"Undo",redo:"Redo",addSection:"Add section",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",editFooter:"Edit the site footer",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:t,total:a})=>`Moved “${e}” to position ${t} of ${a}`,sectionAdded:({name:e})=>`Added “${e}” section`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,t as DEFAULT_SCREEN_WORDS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-
|
|
1
|
+
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-MCHMF32I.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{useCanvasEvent as u}from"./chunk-PAELDYYS.js";import{isTypingTarget as d,framePointToHost as p}from"./chunk-ZNCEOSXO.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,AddIcon as C,PasteIcon as z,SettingsIcon as O,LayersIcon as P,CopyIcon as A}from"efficient-shell/icons/efficient";import{jsx as S}from"react/jsx-runtime";function j(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var D=c(),K=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return D;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function T(){return M(n())}function X(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function E(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete}}function I(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of j(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(d(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function Y(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=E(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:I(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=E(n,i,l),k=j(n,o),b=d.held,v=b&&!p?I(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?N(n).pinned:void 0})}var N=e=>e.words?.screen??l.menu;function U(e){const n=N(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */S(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */S(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=o?[{label:n.addSection,icon:/* @__PURE__ */S(C,{}),onClick:e.openAddSection}]:[],c=e.nodeOps.held,s=X(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */S(z,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */S(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */S(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function V(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=N(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */S(z,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e){return e.shiftKey}function F(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const r=Y(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),u(n,"keydown",c);const a=k(n=>{if(B(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);u(n,"contextmenu",t=>{if(B(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),u(n,"mousedown",r),u(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */S(G,{host:e,target:t,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?V(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */S(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */S(r,{items:o,onClose:t})})}export{D as EASEL_NODE_CLIPBOARD,j as ancestorChain,M as nodeClipboardOf,E as nodeClipboardRules,R as nodeMenuItems,L as nodeShortcut,U as pageMenuItems,I as pastePlace,Y as runNodeShortcut,V as textMenuItems,T as useNodeClipboard,F as useNodeContextMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-FRGCTHDB.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-55IKQFBW.js";import{useEasel as p}from"./chunk-PDZXAFNX.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-MCHMF32I.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:r,...t}){return i(n())===e?/* @__PURE__ */o(r,{...t}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=t("screen",r).deviceNote,i=n(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,nextInChain as a,nodeChain as s}from"./chunk-QASZFO4S.js";import{useWords as d}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as l,isTypingTarget as c}from"./chunk-ZNCEOSXO.js";import{find as u,ROOT_ID as p,getList as f,remove as h,parseZoneKey as m,move as v,duplicate as g,replaceNode as y,createNode as k,insert as S,normalizeData as w,createResolveCache as b,resolveNodeData as I,ROOT_SLOT as C,slotsOf as E}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as O,fieldsFrom as x,defaultsFrom as A}from"./chunk-NKB3KVAB.js";import{createContext as D,useEffect as z,useContext as M,useRef as Z,useSyncExternalStore as N,useState as j,useMemo as P,useCallback as $,useLayoutEffect as L}from"react";import{jsx as R,jsxs as B}from"react/jsx-runtime";import{createPortal as F}from"react-dom";function K(e){return!["setData","setUi","set"].includes(e.type)}var V=(e,t,n,o)=>{const r=f(e,t,m(n));return r?.[o]??null},H=(e,t,n,o,r)=>{const i=V(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function T(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 q(e,t,n){return n?"node"===n.kind?u(e,t,n.id)?n:null:n.parentId===p?f(e,t,n)?n:null:u(e,t,n.parentId)&&f(e,t,n)?n:null:null}function Y(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,i??null)),"selectedSlot"in n&&(a?d=(l=a)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=W(e,t,n);if(o===e)return e;const r=q(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function W(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return Y(e,n,"function"==typeof t.ui?t.ui(T(e,n)):t.ui);case"set":{const r={data:o,ui:T(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=Y(a,n,i.ui,!0)),a}case"insert":{const r={...m(t.destinationZone),index:t.destinationIndex},i=k(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:S(o,n,r,i)}}case"replace":{const r=H(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:y(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=H(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=g(o,n,r.props.id),a=V(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return W(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=V(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...m(t.destinationZone),index:t.destinationIndex};return{...e,data:v(o,n,r.props.id,i)}}case"remove":{const r=H(o,n,t.zone,t.index,"remove");return{...e,data:h(o,n,r.props.id)}}default:return e}}var X={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Q={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},G=0,J=()=>`history-${G+=1}`;function _(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=w(e.data,t);let d={data:s,selection:null,ui:{...Q}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;d={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...Q,...i}}}let l=[{core:d,at:-1/0,sealed:!0,id:J()}],c=0;const p=e=>{const t=l[c],n=r();!e&&c===l.length-1&&c>0&&!t.sealed&&n-t.at<i?l=[...l.slice(0,c),{...t,core:d,at:n}]:(l=[...l.slice(0,c+1),{core:d,at:n,sealed:e,id:J()}],c=l.length-1)},h=/* @__PURE__ */new Set;let m=null,v=null,g=0,k=null,S=!1;const C=()=>{for(const e of[...h])e()},E=()=>{l=[...l.slice(0,c),{...l[c],core:d},...l.slice(c+1)]},O=(t,n)=>{g>0?S=S||n:(n?p(!1):d!==t&&E(),d.data!==t.data&&e.onChange?.(d.data),d!==t&&C())},x=e=>{const n=d;if(d=U(d,e,t),d===n)return;const o=e.recordHistory??K(e);O(n,o&&d.data!==n.data)},A=t=>{0===g&&(k=d,S=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&k&&(d=k,k=null),e}if(g-=1,g>0||!k)return;const n=k;k=null,S&&d.data!==n.data?p(!0):d!==n&&E(),d.data!==n.data&&e.onChange?.(d.data),d!==n&&C()},D=e=>{const n=d,o=q(d.data,t,e);var r,i;(r=o,i=d.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))||(d={...d,selection:o},O(n,!1))},z=t=>{const n=d;c=t,d=l[c].core,d.data!==n.data&&e.onChange?.(d.data),d!==n&&C()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...X,...a,...n}};let Z=M();const N=b(),j={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=d.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[a,...s]=await Promise.all([I(r,t,{cache:N,trigger:e,metadata:n}),...i.map(o=>I(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=d;let n=d.data;s.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,s=u(n,t,a)?.node;s&&s===u(o,t,a)?.node&&(n=y(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!==d.data&&(d={...d,data:n,selection:q(n,t,d.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=u(d.data,t,e)?.node;if(!r)return!1;const i=await I(r,t,{cache:N,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return A(()=>{const n=d;if(u(d.data,t,e)?.node!==r)return;const o=y(d.data,t,e,i.node);o!==d.data&&(d={...d,data:o,selection:q(o,t,d.selection)},O(n,!1),a=!0)}),a},get config(){return t},getState(){if(m&&v===d)return m;const e=d,o={data:e.data,ui:T(e,t)},r="node"===e.selection?.kind?u(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>j.undo(),forward:()=>j.redo(),hasPast:c>0,hasFuture:c<l.length-1,histories:l.map(e=>({id:e.id,state:{data:e.core.data,ui:T(e.core,t)}})),index:c,setHistoryIndex:e=>{e>=0&&e<l.length&&e!==c&&z(e)}},getPermissions:Z,getItemById:n=>u(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return f(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},v=e,m},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=d,o=void 0===e.select?d.selection:e.select;d={...d,data:e.data,selection:q(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=d,r=w(e,t);d={...d,data:r,selection:q(r,t,n.selection??d.selection)},n.keepHistory||(l=[{core:d,at:-1/0,sealed:!0,id:J()}],c=0),d!==o&&C()},undo(){c>0&&z(c-1)},redo(){c<l.length-1&&z(c+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=M(),m=null,C())},setConfig(e){e!==t&&(t=e,Z=M(),m=null,C())}};return j}function ee(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&&c(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 te=D(null),ne=D(!0);function oe({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return z(()=>{n&&e.resolveAll()},[e,n]),z(()=>{if(t&&"undefined"!=typeof document)return ee(document,e)},[e,t]),/* @__PURE__ */R(te.Provider,{value:e,children:/* @__PURE__ */R(ne.Provider,{value:t,children:o})})}function re(){const e=M(te);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ie(e){const t=re(),n=Z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return N(t.subscribe,o,o)}function ae(){return function(e){return ie(e)}}var se="data-puck-component",de="data-puck-dropzone",le={},ce="data-es-mirror",ue="undefined"==typeof window?z:L;function pe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${ce}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(ce,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function fe({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:a=!0,onDocument:s,height:c="auto",nonce:u}){const p=d("canvas",e),f=Z(null),[h,m]=j(null);return ue(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==c||!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,c]),ue(()=>{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"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),l(e,u),m(t),s?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){pe(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>pe(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),s?.(null)}},[]),/* @__PURE__ */R("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:h?F(t,h):null})}var he=D(null),me=D(le),ve=[];function ge({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const i=re(),a=ie(n=>f(n.appState.data,i.config,{parentId:e,slot:t})??ve),s=ie(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==p),d=ie(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),l=M(he),c=["es-zone"];return a.length&&c.push("has-children"),e===p&&c.push("is-root"),(s||d)&&c.push("is-area-selected"),null!==l&&l===e&&e!==p&&c.push("is-hovering-area"),n&&c.push(n),/* @__PURE__ */R("div",{className:c.join(" "),[de]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:a.map(e=>/* @__PURE__ */R(Se,{node:e},e.props.id))})}function ye(e,t,n,o){const r="root"===t?e.root:e.components[t],i={...o};for(const e of O(x(r)))i[e]=function(t={}){/* @__PURE__ */
|
|
2
|
+
return R(ge,{parentId:n,slot:e,...t})};return i}function ke(e){return function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
+
return R(ge,{parentId:e,slot:t,...n})}}function Se({node:e}){const t=re().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=Z(null);return P(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(se),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(se,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),i=M(me);if(!n?.render)return null;const a=n.render,s=ye(t,e.type,o,{...A(n),...e.props}),d={renderDropZone:ke(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...i,...n.metadata}};return n.inline?/* @__PURE__ */R(a,{...s,puck:d,editMode:!0}):/* @__PURE__ */R("div",{[se]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */R(a,{...s,puck:d,editMode:!0})})}function we({metadata:e}){const t=ie(e=>e.config),n=ie(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */R(ge,{parentId:p,slot:C}),i=o?/* @__PURE__ */R(o,{id:"puck-root",...ye(t,"root",p,n),puck:{renderDropZone:ke(p),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
|
|
4
|
+
return R(me.Provider,{value:e??le,children:i})}function be({id:e,kind:t,overlay:n}){const o=Z(null),[r,i]=j(null);ue(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void i(null);let r=0;const a=()=>{r=0;const a=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}}(t.querySelector(`[${se}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);i(e=>{return(t=e)===(n=a)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:a;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(a))};a();const d="MutationObserver"in n?new n.MutationObserver(s):null;d?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const l="ResizeObserver"in n?new n.ResizeObserver(s):null;return l?.observe(t.documentElement),n.addEventListener("resize",s),()=>{d?.disconnect(),l?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const a=/* @__PURE__ */R("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__ */R(n,{componentId:e,kind:t,children:a}):a}function Ie({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:d,height:l,title:c,nonce:p,hotkeys:f,frameWrapper:h,overlay:m,children:v}){const g=re(),y=M(ne),k=f??y,[S,w]=j(void 0),b=ie(e=>"node"===e.selection?.kind?e.selection.id:null),[I,C]=j(null),O=e=>{const t=e.closest?.(`[${se}]`)?.getAttribute(se);if(!t)return;const n=g.getState(),o=n.appState.data,r=u(o,g.config,t);if(!r||0===E(r.node,g.config).length)return t;const i="node"===n.selection?.kind?n.selection.id:null;return a(s(o,g.config,t),i)??t},x=/* @__PURE__ */B("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=O(t);void 0===n?t.hasAttribute?.(de)||g.select(null):g.select(n)},onMouseOver:e=>{const t=O(e.target)??null;t!==I&&C(t)},onMouseLeave:()=>C(null),children:[
|
|
5
|
+
/* @__PURE__ */R(he.Provider,{value:I,children:/* @__PURE__ */R(we,{metadata:o})}),
|
|
6
|
+
/* @__PURE__ */B("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
7
|
+
/* @__PURE__ */R(be,{id:I&&I!==b?I:null,kind:"hover",overlay:m}),
|
|
8
|
+
/* @__PURE__ */R(be,{id:b,kind:"selected",overlay:m})]}),v]}),A=h?/* @__PURE__ */R(h,{document:S,children:x}):x;z(()=>{if(S&&k)return ee(S,g)},[S,k,g]),z(()=>{if(!S)return;const e=e=>{if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=g.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,g.config,n.selection);"node"===o?.kind&&g.select(o.id)};return S.addEventListener("keydown",e),()=>S.removeEventListener("keydown",e)},[S,g]);/* @__PURE__ */
|
|
9
|
+
return R("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */R(fe,{mirrorStyles:r,onDocument:e=>{w(e??void 0),d?.(e)},height:l,title:c,nonce:p,children:A}):/* @__PURE__ */R("div",{id:"preview-frame","data-puck-entry":"",children:A})})}function Ce(e={}){const t=re(),n=ie(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ee(){const e=re(),n=ie(e=>e.config),o=e.resolveCache,r=ie(e=>e.selectedItem),i=ie(e=>e.appState.data.root),a=r?r.props.id:"root",s=i.props??{},d=P(()=>r||{type:"root",props:s},[r,s]),l=r?n.components[r.type]:n.root,c=e.getState(),p=r?u(c.appState.data,n,a):null,f=p&&"root"!==p.place.parentId?p.place.parentId:null,h=f?c.getItemById(f)??null:null,{fields:m}=t({id:a,node:d,block:l,parent:h,appState:c.appState}),v=ie(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=$((t,r)=>{(async()=>{const i=e.getState();if("root"!==a){const s=i.getItemById(a),d=i.getSelectorForId(a);if(!s||!d)return;const l={...s,props:{...s.props,[t]:r}},{node:c}=await I(l,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:c})}const s=i.appState.data.root.props??{},{node:d}=await I({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:d.props,readOnly:d.readOnly},recordHistory:!0})})()},[e,n,o,a]);return{id:a,node:d,fields:m,values:d.props,readOnly:v,onChange:g}}export{fe as CanvasFrame,Q as DEFAULT_UI,Ie as EaselCanvas,oe as EaselProvider,we as EditDocument,ee as bindUndoKeys,_ as createEasel,ae as createUseEasel,K as recordsByDefault,U as reduce,T as uiView,ie as useEasel,re as useEaselApi,Ce as useEaselNodeOps,Ee as useSelectedFields,q as validSelection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{find as t,remove as n,getList as e,newId as r,duplicate as o,move as a,copyNode as l,insert as c,setProps as d}from"./chunk-KRXQM65X.js";import{useRef as i,useSyncExternalStore as s,useCallback as p,useMemo as u}from"react";var f=t=>({kind:"node",id:t});function m(r,o,a,l="none"){const c=t(r,o,a),d=n(r,o,a);if("none"===l||!c)return{data:d,select:null};const i=e(r,o,c.place)??[],s=i[c.place.index+1]??i[c.place.index-1];return s?.props?.id?{data:d,select:f(s.props.id)}:"root"!==c.place.parentId?{data:d,select:f(c.place.parentId)}:{data:d,select:null}}function x(n,e,a,l={}){const c=t(n,e,a)?.node,d=l.id??r(c?.type??"Node");return{data:o(n,e,a,{strip:l.strip,id:d}),select:f(d)}}function I(t,n,e,r){return{data:a(t,n,e,r),select:f(e)}}var g=(t,n)=>({min:0,max:n-1});function v(n,r,o,a,l=g){const c=t(n,r,o);if(!c)return!1;const d=e(n,r,c.place)?.length??0,{min:i,max:s}=l(c.place,d),p=c.place.index+a;return c.place.index>=i&&c.place.index<=s&&p>=i&&p<=s}function b(n,e,r,o,a=g){if(!v(n,e,r,o,a))return null;const l=t(n,e,r);return I(n,e,r,{...l.place,index:l.place.index+o})}function h(t,n,e,r,o={}){const a=l(e,n,{strip:o.strip});return{data:c(t,n,r,a),select:f(a.props.id)}}function k(t,n,e,r){return{data:d(t,n,e,r),select:void 0}}function y(n,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return t(n,e,r.parentId)?f(r.parentId):null;const a=t(n,e,r.id);if(!a||"root"===a.place.parentId)return null;const l=t(n,e,a.place.parentId);return l?o(l.node,a.place.slot)?{kind:"slot",parentId:l.node.props.id,slot:a.place.slot}:f(l.node.props.id):null}function O(n,e,r){const o=t(n,e,r);return o?[...o.path.filter(t=>"root"!==t.parentId).map(t=>t.parentId),r]:[]}function z(t,n){if(0===t.length)return null;const e=null===n?-1:t.indexOf(n);return-1===e?t[0]:t[Math.min(e+1,t.length-1)]}function R(n,e,r){if(!r||"node"!==r.kind)return null;const o=t(n,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function B(t,n,r){if(!r)return null;const[o,a]=(r.zone??"root:default-zone").split(/:(.*)/s),l={parentId:o,slot:a},c=e(t,n,l)?.[r.index];return c?.props?.id?f(c.props.id):null}var M={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function X(n){const e=i(n);e.current=n;const r=n.clipboard??M,o=s(r.subscribe,r.get,r.get),a=p(t=>{const n=e.current;if(n.readOnly)return!1;const r=t(n.data,n.config);return!!r&&((r.data!==n.data||void 0!==r.select)&&(n.commit(r.data,{select:r.select}),e.current={...n,data:r.data},!0))},[]);return u(()=>{const n=()=>e.current,r=(e,r)=>{const o=t(n().data,n().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:t=>a((e,r)=>m(e,r,t,n().afterRemove)),duplicate:t=>a((e,r)=>x(e,r,t,{strip:n().strip})),move:(t,n)=>a((e,r)=>I(e,r,t,n)),step:(t,e)=>a((r,o)=>b(r,o,t,e,n().stepBounds)),canStep:(t,e)=>v(n().data,n().config,t,e,n().stepBounds),setProps:(t,n)=>a((e,r)=>k(e,r,t,n)),copy:(t,e)=>{const o=r(t,e);return o&&(n().clipboard??M).set(o),!!o},cut:(t,e)=>{if(n().readOnly)return!1;const o=r(t,e);return!!o&&((n().clipboard??M).set(o),a((e,r)=>m(e,r,t,n().afterRemove)))},paste:t=>{const e=(n().clipboard??M).get();return!!e&&a((r,o)=>h(r,o,e.node,t,{strip:n().strip}))},parentOf:t=>y(n().data,n().config,t,n().slotIsLevel)}},[o,a])}export{v as canStep,B as fromItemSelector,z as nextInChain,O as nodeChain,y as parentStep,x as planDuplicate,I as planMove,h as planPaste,m as planRemove,k as planSetProps,b as planStep,R as toItemSelector,X as useNodeOps};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-5SOSVTVI.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-55IKQFBW.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-PDZXAFNX.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-6HHHBBSY.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 B,jsxs as $,Fragment as O}from"react/jsx-runtime";var H=e=>`section:${e}`,I=e=>`block:${e}`,v=e=>`template:${e}`;function F({blocks:F,blocksOnly:V,at:x,onAdd:N,itemFor:A,session:L,siteWide:S,onClose:C,onHide:D,readOnly:Q}){const T=f(e=>e.config),w=p(),{labelAtLevel:M,categoryLabel:P,firstSection:R,Icon:W,Thumbnail:X}=w,{blockIsOffered:Y}=m(),z=u("screen",d).add,K=u("drag",h).add,Z=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>Y(e,Z);return s(Z).list().then(n=>{if(t)return;const i=T.components;G(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[T,Z]);const J=j(()=>t(T,w),[T]),q=e=>({type:H(e.type),label:e.name,cover:/* @__PURE__ */B(X,{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)}),U=j(()=>{const e=[];if(F&&F.choices.length>0&&a(F.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${z.inside({name:F.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:I(e.type),label:e.label,icon:/* @__PURE__ */B(W,{type:e.type,size:18}),title:z.tile({name:e.label})}))})}),V)return e;const t=o(J,R);t&&e.push({key:"start",title:z.startBlank,tiles:[q(t)]}),E.length>0&&e.push({key:"templates",title:z.templates,tiles:E.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */B(X,{type:e.node.type}),keywords:[(t=e.node.type,M(t,"section",T.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,R);for(const t of Object.keys(T.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(T,t,P),tiles:o.map(q)})}return e},[F,V,E,J,T,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=E.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return $(O,{children:[
|
|
3
|
+
/* @__PURE__ */B(r,{icon:/* @__PURE__ */B(g,{size:15}),title:z.title,context:V?z.contextBlocks:z.contextAll,actions:/* @__PURE__ */B(c,{label:z.done,description:z.doneDescription,onClick:C}),onHide:D}),
|
|
4
|
+
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */B(k,{groups:U,session:L,itemFor:e=>A(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&N(t)},at:x,hint:V?z.hintBlocks:z.hint,searchLabel:V?z.searchBlocks:z.searchSections,readOnly:Q,words:K}),S&&!V?S:null]})]})}export{F as AddSidePanel,I as blockKey,H as sectionKey,v as templateKey};
|