efficient-easel 1.0.0 → 1.1.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 +8 -1
- package/dist/chunk-2F6RZTR7.js +5 -0
- package/dist/{chunk-CKEPQNSQ.js → chunk-4OL6MRYY.js} +1 -1
- package/dist/chunk-7QWOAQQL.js +5 -0
- package/dist/chunk-BEEJ63CT.js +64 -0
- package/dist/{chunk-ZP4G3X44.js → chunk-JMIZ3FOV.js} +1 -1
- package/dist/{chunk-YABL4EWX.js → chunk-KCE5RVVC.js} +3 -3
- package/dist/chunk-NGT4DAHF.js +1 -0
- package/dist/chunk-PJP46U5L.js +9 -0
- package/dist/chunk-Q6ETRSEA.js +24 -0
- package/dist/{chunk-DJMMTWFP.js → chunk-RINSVAKA.js} +1 -1
- package/dist/{chunk-FEK3S6HN.js → chunk-TJIXDXTV.js} +1 -1
- package/dist/{chunk-XWR5YVA7.js → chunk-UFY6RNMT.js} +2 -2
- package/dist/chunk-YNOZ5NXW.js +14 -0
- package/dist/copy/copy.css +16 -1
- package/dist/copy/index.js +31 -31
- package/dist/easel/index.d.ts +1 -1
- package/dist/fields/index.d.ts +37 -41
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.js +14 -16
- package/dist/panel/panel.css +34 -22
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +16 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +5 -0
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/text-styles/index.js +33 -33
- package/dist/text-styles/text-styles.css +3 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +9 -10
- package/dist/{types-VqL6t5HH.d.ts → types-DQp_i3dE.d.ts} +6 -2
- package/package.json +3 -3
- package/dist/chunk-4GNPKHV4.js +0 -64
- package/dist/chunk-JMGPPXNQ.js +0 -24
- package/dist/chunk-NLRW4BGG.js +0 -8
- package/dist/chunk-OJAJVH7S.js +0 -5
- package/dist/chunk-OTEXGJDU.js +0 -5
- package/dist/chunk-Q27BB5ZC.js +0 -14
- package/dist/chunk-QMNML7XH.js +0 -1
package/dist/tree/tree.css
CHANGED
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
*
|
|
9
9
|
* · the scroll box round the tree (the shell's `Tree` does not scroll);
|
|
10
10
|
* · the lift of a row at the instant the browser takes its drag picture;
|
|
11
|
-
* · the size of the marks a row carries after its name, and the rename box
|
|
11
|
+
* · the size of the marks a row carries after its name, and the rename box;
|
|
12
|
+
* · the ground the row actions' scrim is painted over (`--rosh-tree-ground`).
|
|
12
13
|
*
|
|
13
14
|
* The seam, and a draggable row's grip, hint and cursor, are the shell's since
|
|
14
|
-
* efficient-shell 4.165.0 (`TreeSeam`; `TreeRow`'s `draggable` / `dragHint`)
|
|
15
|
+
* efficient-shell 4.165.0 (`TreeSeam`; `TreeRow`'s `draggable` / `dragHint`);
|
|
16
|
+
* the row actions laid over the end of the name, and a row action that is off
|
|
17
|
+
* with a reason, since 4.166.0.
|
|
15
18
|
*
|
|
16
19
|
* Shell tokens only (`--es-*` resolve to them, `--spacing` is the shell's step).
|
|
17
20
|
*/
|
|
@@ -22,6 +25,10 @@
|
|
|
22
25
|
/* LEFT 8 — the inset a rounded row needs. RIGHT 12 — the room a real,
|
|
23
26
|
space-taking scrollbar takes, so nothing at a row's end sits under the thumb. */
|
|
24
27
|
padding: 0 12px 12px 8px;
|
|
28
|
+
/* The row actions lie over the end of the name on a scrim of the row's own
|
|
29
|
+
tone over the PANEL's ground (efficient-shell 4.166.0). The shell assumes
|
|
30
|
+
`--surface`; the tree sits on easel's panel, so it says which. */
|
|
31
|
+
--rosh-tree-ground: var(--es-panel);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/* On for the instant the browser takes the drag picture: the row that follows
|
|
@@ -57,11 +64,3 @@
|
|
|
57
64
|
color: inherit;
|
|
58
65
|
outline: none;
|
|
59
66
|
}
|
|
60
|
-
|
|
61
|
-
/* A row action off WITH A REASON (`aria-disabled`, so the keyboard reaches it
|
|
62
|
-
and its Tooltip says why): the shell IconButton's own disabled fade, which
|
|
63
|
-
only `:disabled` draws. SHELL GAP: the kit has no focusable-disabled look. */
|
|
64
|
-
.es-tree-act-off {
|
|
65
|
-
opacity: 0.6;
|
|
66
|
-
cursor: not-allowed;
|
|
67
|
-
}
|
|
@@ -35,8 +35,12 @@ interface FieldNumberProps extends ControlBase {
|
|
|
35
35
|
icon?: ReactNode;
|
|
36
36
|
/** Shown after the number, inside the cell, e.g. `px`. */
|
|
37
37
|
unit?: string;
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The shell's arrows at the box's end: `true` the side-by-side pair,
|
|
40
|
+
* `'compact'` the two stacked in one 16px column, for a narrow cell
|
|
41
|
+
* (efficient-shell 4.166.0).
|
|
42
|
+
*/
|
|
43
|
+
steppers?: boolean | 'compact';
|
|
40
44
|
placeholder?: string;
|
|
41
45
|
/** The cell's tooltip — the text box's cells say their name and step here
|
|
42
46
|
* (E5b), since the cell draws no name. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
"dist"
|
|
518
518
|
],
|
|
519
519
|
"peerDependencies": {
|
|
520
|
-
"efficient-shell": "^4.
|
|
520
|
+
"efficient-shell": "^4.166.0",
|
|
521
521
|
"react": ">=18",
|
|
522
522
|
"react-dom": ">=18"
|
|
523
523
|
},
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
"@types/node": "^22.0.0",
|
|
528
528
|
"@types/react": "^18.2.0",
|
|
529
529
|
"@types/react-dom": "^18.2.0",
|
|
530
|
-
"efficient-shell": "^4.
|
|
530
|
+
"efficient-shell": "^4.166.0",
|
|
531
531
|
"esbuild": "^0.27.0",
|
|
532
532
|
"jsdom": "^26.1.0",
|
|
533
533
|
"react": "^18.2.0",
|
package/dist/chunk-4GNPKHV4.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-PT6V53OO.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-ORR3Q4WV.js";import{usePartBridge as v}from"./chunk-DJMMTWFP.js";import{useSectionOps as x}from"./chunk-QMNML7XH.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-JLTZQ4US.js";import{PageEditGuardNotices as z}from"./chunk-MAEXP3KE.js";import{useScreenDocument as C}from"./chunk-ONRYLR2D.js";import{requestMediaPick as B}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as I}from"./chunk-OTEXGJDU.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-QR4DLZ3P.js";import{MediaSidePanel as A}from"./chunk-CKEPQNSQ.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as H,useScreenLeftView as W,useScreenAdd as F,SELECTION_MODE as J,sameInspectorMode as U,useScreenBridges as G,useScreenBlockRules as X,useScreenBlockLook as Y,useScreenStorageNamespace as Q,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-OJAJVH7S.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-E2O2MRZR.js";import{useEasel as ve,useEaselApi as xe}from"./chunk-PYCLHOSA.js";import{TreeRow as be,Subtree as we,LayersTree as ze,TreeGroupLabel as Ce,TreeRowAction as Be,TreeSeam as Oe}from"./chunk-XWR5YVA7.js";import{toItemSelector as $e,useNodeOps as Ne}from"./chunk-D2BCHTQR.js";import{saveIndicator as Ie}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Pe,TopBarRail as Te,TopBarCluster as Ae,EaselIconButton as Re,TopBarDivider as Me,DeviceSwitch as je,InspectorIconButton as Ee,PanelResizeHandle as Le,MAX_PANEL_W as De,MIN_PANEL_W as Ve,panelWidthVars as He,SaveState as We,SaveStateToggle as Fe}from"./chunk-TJ7YIRWQ.js";import{useWords as Je}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ue}from"./chunk-W3XX2CNW.js";import{createDragSession as Ge,useTreeDrag as Xe,gapToMoveIndex as Ye}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Qe,BLOCK_SELECTOR as Ke,useCanvasEvent as _e}from"./chunk-PAELDYYS.js";import{LayersIcon as qe,MediaIcon as Ze,UndoIcon as en,RedoIcon as nn,TrashIcon as tn,EyeOffIcon as on,EyeIcon as rn,DuplicateIcon as ln}from"./chunk-L5KW4HG5.js";import{zoneKey as sn,ROOT_ID as dn,ROOT_SLOT as cn,parseZoneKey as an,DataError as pn}from"./chunk-KRXQM65X.js";import{useRef as un,useMemo as fn,useState as hn,useEffect as mn,useCallback as gn,useLayoutEffect as yn,Fragment as kn}from"react";import{Tooltip as Sn,Button as vn,toast as xn}from"efficient-shell/ui";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Cn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(We,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return bn(We,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Ie(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(vn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
-
return wn(zn,o?{children:[
|
|
4
|
-
/* @__PURE__ */bn(Fe,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */bn(We,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
-
/* @__PURE__ */bn(We,{tone:l,label:s,role:"status"}),d]})}function Bn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return bn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */wn(zn,e?{children:[
|
|
7
|
-
/* @__PURE__ */bn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */bn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */bn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */bn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */bn("path",{d:"M5 12h14"})]})})}function On(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var $n="__rungs";var Nn="screen:band",In={duplicate:!0,delete:!0};function Pn(){const Ie=ye(),{target:We,docId:Fe,capabilities:Pn,currentSlug:Tn,siteId:An,onPublish:Rn,saveState:Mn,saveConflict:jn,retrySave:En,toggleAutoSave:Ln,readOnly:Dn,readOnlyReason:Vn=null}=C(),Hn=R(),Wn=M(),{mediaEditing:Fn,hasEditGuard:Jn,hasPinnedChrome:Un}=Pn,{appState:Gn,dispatch:Xn,history:Yn,selectedItem:Qn,getSelectorForId:Kn,config:_n}=ve(e=>e),qn=j(),{first:Zn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=qn,it=rt(Zn),lt=e=>oe(qn,e),st=e=>re(qn,e),dt="node"===qn.firstRow,ct=qn.band??null,at=Je("screen",Se),pt=E()??`/${Tn}`,ut=L(),ft=D(),ht=x({readOnly:Dn}),mt=un(null),gt=xe(),yt=fn(()=>({...ht,select:e=>{mt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=gt.config;mt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,gt]),kt=Gn.ui,St=kt.leftSideBarVisible,vt=kt.rightSideBarVisible,{options:xt,widths:bt,initial:wt,fluid:zt,fit:Ct}=V(),[Bt,Ot]=hn(wt),$t=he(),Nt=Fn&&null!==$t,It=me(),Pt=ge();H(Qn?.props.id);const{read:Tt,write:At,forSelection:Rt}=W(),[Mt,jt]=hn(Tt);mn(()=>{At(Mt)},[Mt]);const[Et,Lt]=hn(0),Dt=un(null),Vt=un(null),Ht=Qe(Vt,{readySelector:Ke}),Wt=f(Vt);h(Vt,Ht);const[Ft,Jt]=hn(!1),Ut=un(!1),Gt=un(!1),[Xt,Yt]=hn(null),Qt=F(),Kt=e=>Yt(null===e?null:{zone:le,index:e}),[_t,qt]=hn([]),[Zt,eo]=hn(J),no="puck"===Zt.kind,to=Ft&&!Xt&&Qt.railTarget?Qt.railTarget(Gn.data,{node:Qn??null,mode:Zt}):null,oo=to?{zone:sn(to),index:to.index}:null,ro=Xt??oo,io=ro&&ro.zone===le?ro.index:null,lo=t(Zt,Qn?.props.id),[so,co]=hn(null);mn(()=>{so&&(o(),co(null))},[so]);const ao=un(Kn);ao.current=Kn;const po=gn((e,{scroll:n})=>{jt(n=>Rt(e,n)),n&&co(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ao.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ho(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),uo=un(null);mn(()=>{const e=uo.current;uo.current=null;const n=null==Qn?.props.id?null:String(Qn.props.id);eo(e&&e.id===n?e.mode:rt(Qn?.type)??J);const t=Qn?.props.id,o=mt.current;if(mt.current=null,!t)return;const i=Kn(t);po(String(t),{scroll:!r(o,i??null,le)})},[Qn?.props.id,po]);const fo=gn(e=>{eo(n=>U(n,e)?n:e),Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Xn]),ho=un(()=>{});ho.current=(e,n)=>{const t=e?Tr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Qn?.props.id?null:String(Qn.props.id);eo(e=>U(e,n)?e:n),o!==r&&(uo.current={id:o,mode:n},yt.select(e))};const mo=gn((e,n)=>ho.current(e,n),[]),go={kind:Zt.kind,mode:Zt,open:fo,show:e=>eo(e),reveal:()=>{vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:mo},yo=G(go,{data:Gn.data,selected:Qn??null,zoneOf:e=>Kn(e)?.zone,readOnly:Boolean(Dn),select:e=>{eo(J),yt.select({index:e})},replace:(e,n)=>yt.replaceComponent(le,e,n),scrollTo:e=>oi(e)},{device:Bt,refreshes:Et},{setView:jt,reveal:()=>{St||Xn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ko=yo.pinnedSource??!1,So=yo.resolveLeftView?yo.resolveLeftView(Mt,Nt):"media"===Mt&&Nt?Mt:"sections",vo=X(),{isLockedBlock:xo,duplicateBlocked:bo,nestDepth:wo,newSectionNode:zo,canAddTo:Co,blockIsOffered:Bo}=vo,Oo=Y(),{labelAtLevel:$o,Icon:No,useProducts:Io}=Oo,Po=Oo.rowName?(e,n,t)=>Oo.rowName(e,n,t):void 0,To=gn(e=>{Xn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),po(e,{scroll:!0})},[Xn,po]),{selectNode:Ao,openPartId:Ro}=v({mode:Zt,setMode:eo,onOpenPart:To}),[Mo,jo]=hn(null);ke(null!==Mo,()=>jo(null));const Eo=y(Q()),Lo=Eo.collapsed,Do=Eo.panelWidths,[Vo,Ho]=hn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Lo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});mn(()=>{try{window.localStorage.setItem(Lo,JSON.stringify([...Vo]))}catch{}},[Vo]);const[Wo,Fo]=hn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Do);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});mn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Do,JSON.stringify(Wo))}catch{}},300);return()=>clearTimeout(e)},[Wo]);const Jo=gn((e,n)=>Fo(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Uo=gn(e=>Jo("left",e),[Jo]),Go=gn(e=>Jo("right",e),[Jo]),Xo=e=>Vo.has(e),Yo=e=>Ho(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Qo=un(!1),Ko=un(null);mn(()=>{if(Qo.current&&!Ft){const e=Ko.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vt.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),Ko.current=null}Qo.current=Ft},[Ft]),mn(()=>{if(!Ft||!Wt)return;const e=e=>{"Escape"===e.key&&ui()};return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[Ft,Wt]),ke(Ft,()=>ui()),mn(()=>{!St&&Ft&&(Jt(!1),Yt(null),Ut.current=!1)},[St]),mn(()=>{if(!It)return Gt.current&&Xn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Gt.current=!1);Ft&&(Jt(!1),Yt(null),Gt.current=Ut.current,Ut.current=!1),St||(Gt.current=!0,Xn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[It]),mn(()=>{!St&&It&&(Gt.current=!1,Pt())},[St]),mn(()=>{if(!It||!Wt)return;const e=e=>{"Escape"===e.key&&Pt()};return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[It,Wt]),ke(null!==It,()=>Pt());const _o=K(),qo=(e,n="success")=>{_o?_o(e,"error"===n?"error":"info"):"error"===n?xn.error(e,{duration:3200,sound:!1}):xn.success(e,{duration:1900,sound:!1})},Zo=un(null),[er,nr]=hn(0),[tr,or]=hn(0),rr=_(),ir=un(null),lr=e=>Math.max(0,e.clientHeight-(ir.current?.offsetHeight??0));mn(()=>{const e=Zo.current;if(!e)return;const n=()=>{nr(e.clientWidth),or(lr(e))};n();const t=new ResizeObserver(n);return t.observe(e),ir.current&&t.observe(ir.current),()=>t.disconnect()},[]),yn(()=>{Zo.current&&(nr(Zo.current.clientWidth),or(lr(Zo.current)))},[Wo,St,vt]);const sr=Bt===zt?er>0?er:bt[zt]:bt[Bt],dr=er>0?Math.min(er/sr,"shrink"===Ct?1:2):1,cr=sr*dr,ar=er>0&&cr>er+1,pr={width:cr,height:tr||"100%",flex:"none",position:"relative"},ur={width:sr,height:tr?tr/dr:"100%",maxHeight:"none",transform:1!==dr?`scale(${dr})`:void 0,transformOrigin:"top left"},fr=()=>Xn({type:"setUi",ui:{leftSideBarVisible:!St}}),hr=()=>Xn({type:"setUi",ui:{rightSideBarVisible:!vt}}),mr=e=>{Ft&&(Jt(!1),Yt(null),Ut.current=!1,St&&Mt===e)||It&&(Gt.current=!1,Pt(),St&&Mt===e)||(St&&Mt===e?fr():(jt(e),St||Xn({type:"setUi",ui:{leftSideBarVisible:!0}})))},gr=()=>{B(Ie,{accept:"image/*",title:"Media library"})},yr=()=>{eo(J),yt.select(null),u()},kr=()=>{eo(it??J),vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}})},Sr=Gn.data.content??[],vr=()=>{const e=Sr.findIndex(lt),n=Sr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:Sr.length}},xr=_n,br=vo.stripCopy,wr=e=>i(e,br),zr=b(),Cr=Ne({data:Gn.data,config:xr,readOnly:Boolean(Dn),clipboard:zr,strip:br?e=>br(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==dn||e.slot!==cn)return{min:0,max:n-1};const{floor:t,cap:o}=vr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&eo(J);const t=void 0===n||"node"===n?.kind?n:null;yt.commitDocument(e,t)}}),Br=e=>_n.components[e]?.label??e,Or=gn(e=>_n.components[e]?.defaultProps??{},[_n]),$r=e=>$o(e,"section",Br(e)),Nr=e=>l({type:e.type,props:e.props??{}},$r(e.type),Po),{nodeAddresses:Ir,zoneItems:Pr}=fn(()=>{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>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(_n,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Sr,le,0),{nodeAddresses:e,zoneItems:n}},[Sr,_n]),Tr=gn(e=>Pr.get(e)??[],[Pr]),Ar=e=>{const n=Ir.get(e);return n?Tr(n.zone)[n.index]:void 0},Rr=e=>ie(vo,_n,e),Mr=e=>{if(!vo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ar(e.slice(0,n));if(!t)return null;const o=Rr(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}},jr=(()=>{if(!q(Zt))return null;const e=`${Zt.nodeId}:${Zt.slot}`;return Mr(e)?.slot.panel===Zt.kind?e:null})(),Er=un(null);mn(()=>{const e=Er.current;if(Er.current=null,!jr||!q(Zt))return;const n=Zt.nodeId;po(n,{scroll:e!==jr}),Ho(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Zt]);const Lr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ir.get(e);n&&(n.zone===le?ri(n.index):Ri(n.zone,n.index,e,Ar(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&jr!==i&&(Er.current=i),mo(null,r),vt||Xn({type:"setUi",ui:{rightSideBarVisible:!0}}),oi(o)},Dr=(e,n,t)=>{const o=`${e}:${n}`;if(Ho(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;jr!==o&&(Er.current=o);mo(null,{kind:t,nodeId:e,slot:n})},Vr=(e,n,t)=>{if(Dn||!vo.moveSlot)return;const o=Ar(e),r=o?Rr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Ye(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vo.moveSlot(e,n,s);"string"==typeof d&&Dr(e,d,i.panel)},Hr=Io(),Wr=fn(()=>{const e=/* @__PURE__ */new Map;for(const n of Hr??[])e.set(n.slug,n.name);return e},[Hr]),Fr=e=>s(e,Br,Oo.plainText,e=>Wr.get(e),Oo.rowName),Jr=(e,n)=>{const t=_n.components[e.type]?.fields,o=n===le||qi(n)?"section":"block",r=n===le&&(lt(e)||st(e)||tt(e.type)),i="block"===o?d(t):r?null:c(t);return Oo.renamePropOf?Oo.renamePropOf(e,o,i):i},Ur=(e,n,t,o)=>{if(!(!Dn&&Mo?.zone===e&&Mo.index===n))return;const r=(t,o)=>{jo(null),o&&((e,n,t)=>{const o=Tr(e)[n];if(!o)return;const r=Jr(o,e);r&&yt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return bn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Gr=n(Z()),Xr=Gr.scope({target:We,siteId:An,docId:Fe}),Yr=_n,Qr=(e,n)=>n===le?$r(e):Br(e),Kr=(e,n,t)=>{const o=Gr.plan(Xr,t,Qr(t.type,e),Yr);o&&(o.changed&&yt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),qo(o.message))},_r=w({nodesIn:Tr,nodeAt:(e,n)=>Tr(e)[n]??null,labelOf:(e,n)=>n===le?$r(e):Br(e),renamePropOf:Jr,beginRename:(e,n)=>jo({zone:e,index:n}),history:{hasPast:Yn.hasPast,hasFuture:Yn.hasFuture,back:()=>Yn.back(),forward:()=>Yn.forward()},openAddSection:()=>{yt.select(null),ai(null)},openPageSettings:()=>{yt.select(null),eo(J)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Dn),collapseAll:()=>Ho(new Set(Tr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>qo(e?at.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>el(e,n),menuRows:yo.menuRows,isLocked:e=>xo(e.type),duplicateBlocked:e=>bo(Gn.data,e),permits:e=>se(_n,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:vr,openAddInside:(e,n)=>{e===le?ri(n):yt.select({zone:e,index:n}),ai(null)},locate:e=>Ir.get(e)??null,rowNameOf:(e,n)=>n===le?Nr(e):Fr(e),selectAt:(e,n,t,o)=>{e===le?ri(n):Ri(e,n,t,o??"")},slotRung:e=>{const n=Mr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Lr(n.node,n.slot,!1)}:null},style:{held:()=>O(Xr),canCopy:e=>Gr.rows(Yr,e).some(e=>!1!==e.counted),copy:(e,n)=>Gr.copy(Xr,e,Qr(e.type,n),Yr),paste:(e,n,t)=>Kr(e,n,t)},keys:Wn?{target:Wt,selected:()=>{const e=Gn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>zr.get(),readOnly:Boolean(Dn),onDone:({done:e,name:n})=>{"copied"===e&&qo(at.copied({name:n}))}}:void 0},Ht),qr=un({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});mn(()=>{qr.current={copy:(e,n)=>Gr.copy(Xr,e,Qr(e.type,n),Yr),paste:Kr,at:()=>{const e=Gn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Tr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Dn)}});const Zr=gn(e=>{const n=$(e);if(!n)return;const t=qr.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))},[]);mn(()=>{if(!Wt)return;const e=e=>Zr(e);return Wt.addEventListener("keydown",e),()=>Wt.removeEventListener("keydown",e)},[Zr,Wt]),_e(Ht,"keydown",Zr);const ei=Sr.map(e=>e.props.id).join("|");mn(()=>{const e=Ht?.document??null,n=Ht?.window??null;let t=0;const o=[],r=()=>{if(!e)return void qt(e=>e.length?[]:e);const n=Sr.findIndex(st),t=n>=0?n:Sr.length,o=n=>{const t=Sr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ke)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=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=On(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}qt(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()}},[Ht,ei,Bt,dr,St,vt,Qn?.props.id]);const ni=Ht?.document??null,ti=Ht?.window??null;mn(()=>{const e=Dt.current;if(!e||!ni||!ti)return;const n=[],t=()=>{const n=ni.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ti.scrollTo({left:ti.scrollX,top:ti.scrollY+t,behavior:"instant"}),!0};return Dt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ni,ti]);const oi=e=>{yo.holdCanvasOn?yo.holdCanvasOn(e):a(e)},ri=e=>{eo(J),yt.select({index:e}),yo.sectionPressed?.(Sr[e]);const n=Sr[e]?.props?.id;n&&oi(n)},ii=e=>{const{floor:n,cap:t}=vr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Qn&&Zt.kind!==it?.kind?Sr.findIndex(e=>e.props.id===Qn.props.id):-1;return o(r>=0?r+1:t)},li=(e,n)=>{const{floor:t,cap:o}=vr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(yt.reorderComponent(le,e,i),yt.select({index:i}),{moved:!0,dest:i})},si=(e,n,t,o)=>{eo(J),yt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),qo(`Added “${t}” section`)},di=(e,n)=>{const t=ii(n),o=zo(e,{nodeDefaults:Or,newNodeId:fe,sectionLabel:$r,blockIsOffered:Bo}),r=o?yt.insertNode(le,t,o):yt.insertSection(e,t);return si(t,r,$r(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 ce(_n,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Co(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},ci=(e,n,t)=>{const o=ii(t),r=yt.insertNode(le,o,n);return si(o,r,e),o},ai=e=>pi(le,e),pi=(e,n)=>{Ko.current=document.activeElement??null,It&&(Ut.current=Gt.current,Gt.current=!1,Pt()),Yt(null===n?null:{zone:e,index:n}),Jt(!0),St||(Ut.current=!0,Xn({type:"setUi",ui:{leftSideBarVisible:!0}}))},ui=()=>{Jt(!1),Yt(null),Ut.current&&Xn({type:"setUi",ui:{leftSideBarVisible:!1}}),Ut.current=!1},fi=(e,n,t)=>{if("section"===e.kind)yt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;yt.insertNode(n,t,wr(e.template.node))}eo(J),yt.select({index:t,zone:n})},hi=(e,n)=>Oo.rowName?n?lt(e)?Oo.rowName(e,"section",at.header):st(e)?Oo.rowName(e,"section",at.footer):tt(e.type)?Oo.rowName(e,"section",Br(e.type)):Nr(e):Fr(e):n?$r(e.type):Br(e.type),mi=e=>n=>{e()},gi=()=>yo.editPinnedSource?.(),yi=(e,n,t)=>{if(Dn)return null;const o=Tr(e)[n];return o&&!se(_n,o.type).delete?null:/* @__PURE__ */bn(Be,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Tr(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(tn,{size:15})})},ki=e=>Oo.rowPreview?.(e)||void 0,Si=e=>Oo.rowMarks?.(e)??void 0,vi=(e,n,t)=>Oo.rowActions?.(e,n,t)??null,xi=(e,n,t,o)=>{if(Dn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return bn(Be,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>wi(e,n,t),children:/* @__PURE__ */bn(r?on:rn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},bi=e=>{const n=$r(Sr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return vl(le,e,()=>ai(e),t)},wi=(e,n,t)=>{yt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},zi=e=>ae(_n,e),Ci=e=>ce(_n,e),Bi=e=>vo.slotsOf?Rr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ci(e)}],Oi=e=>vo.slotsOf?Bi(e).flatMap(e=>e.kids):Ci(e),$i=e=>Boolean(vo.slotsOf)&&Rr(e).some(e=>e.rung),Ni=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Ii=(e,n,t)=>{const o=ue(_n,e.type,n)&&(t||Oi(e).length>0||$i(e));return{collapsible:o,folded:o&&Xo(String(e.props.id))}},Pi=(e,n,t)=>Bi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ii(e,r,t(e.type)).collapsible?[String(e.props.id),...Pi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ti=e=>Oi(e).length>0||$i(e)||Boolean(Co(e.type)),Ai=e=>Boolean(Co(e)),Ri=(e,n,t,o)=>{if(eo(J),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),yt.select({index:n,zone:e}),a(t)}else yt.select({index:n,zone:e}),oi(t)},Mi=(e,n,t,o,r)=>{const i=`${e}:${n}`;yt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),yt.select({index:o,zone:i})}):yt.select({index:o,zone:i})},ji=(e,n,t)=>{yt.insertComponent(e,n,t),eo(J),yt.select({index:t,zone:e})},Ei=un(/* @__PURE__ */new Set);mn(()=>{Sr.forEach(e=>{const n=Co(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ei.current.has(t))return;Ei.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(Or)).forEach((e,t)=>yt.seedChild(o,t,n.childType,e))})},[Sr,yt,Or]);const Li=un(/* @__PURE__ */new Set);mn(()=>{Sr.forEach((n,t)=>{const o=n.props.id;if(Li.current.has(o))return;const r=e(n,zi(n.type));Li.current.add(o),r&&yt.replaceComponent(le,t,{...n,props:r})})},[Sr,yt]),ee(yt,_n);const Di=Sr.findIndex(st),Vi=Di>=0?Sr[Di]:null,Hi=dt?Sr.findIndex(lt):-1,Wi=Hi>=0?Sr[Hi]:null,Fi=Sr.find(e=>e.type===et)??null,Ji=Sr.find(e=>e.type===nt)??null,Ui=Di>=0?Di:Sr.length,Gi=[];Sr.forEach(e=>{st(e)||(Ti(e)&&Gi.push(String(e.props.id)),Gi.push(...Pi(e,1,Ai)))}),Vi&&(Gi.push(String(Vi.props.id)),Gi.push(...Pi(Vi,1,Ai)));const Xi=Gi.length>0&&Gi.every(e=>Vo.has(e)),Yi=e=>{const n=Oo.blockRowName(e,Br);return Oo.rowName?Oo.rowName(e,"block",n):n},Qi=(e,n,t,o)=>{const r=Tr(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Tr(n).length)},s=Ye(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},Ki=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ci(e))n.add(r),t(o)};for(const t of zi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_i=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ir.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},qi=e=>{const n=e.slice(0,e.indexOf(":")),t=Sr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},Zi=(e,n,t)=>{if(e.rung){const t=Ar(e.rung.nodeId),o=t?Rr(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 tl(e.add,n);const o=sn(n);if(tt(e.type))return!1;const r=qi(o),i=qi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Tr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=vr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Tr(o).length)return!1;if(e.zone===o)return!0;const l=Vi&&!qn.lastIsOpen?String(Vi.props.id):null;return(!l||_i(e.zone)!==l&&_i(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Tr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ir.get(i),s=l?Tr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ki(r).has(n))return!1;const d=Co(s.type,wo(Gn?.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?.(Tr(n),r))})(e.zone,o,e.index,t)},el=(e,n)=>{const t=sn(e.from);if(t===sn(n))return!0;const o=e.node;return Zi({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},nl=e=>{const n=e.slice(0,e.indexOf(":")),t=Ir.get(n),o=t?Tr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,wo(Gn?.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:Br(r.spec.childType)}]:[]),l=Mr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:hi(o,t.zone===le)}},tl=(e,n)=>{const t=sn(n);if("block"!==e.kind){if(qi(t))return n.index>=0&&n.index<=Tr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=vr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=nl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Tr(t))},ol=(e,n)=>{e.rung?Vr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&qi(sn(n)))return void fi(e,sn(n),n.index);if("section"===e.kind)return void di(e.type,n.index);if("template"===e.kind)return void ci(e.template.name,wr(e.template.node),n.index);const t=sn(n),o=nl(t);o&&(o.target.spec?Mi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):ji(t,e.type,n.index))})(e.add,n):e.zone===le?li(e.index,n.index):Qi(e.zone,sn(n),e.index,n.index)},[rl]=hn(()=>Ge()),il=Xe({keyOf:e=>e.id,readOnly:Boolean(Dn),session:rl,canDrop:Zi,onDrop:ol,onStep:(e,n)=>{e.rung?Vr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=$r(Sr[e]?.type??""),o=li(e,n<0?e-1:e+2);if(!o.moved)return void qo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=vr();qo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Qi(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ll=gn(e=>{const{floor:n,cap:t}=vr(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Tr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||xo(i.type))continue;if(tt(i.type))continue;const l=Boolean(qi(e)),s=e===le||l;e===le&&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?$r(i.type):Fr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(nl(sn(e.list))?.choices.length)||Boolean(qi(sn(e.list))))}},[Gn.data]),sl=e=>{eo(J),yt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},dl=ne(),cl=()=>({data:Gn.data,device:Bt,ops:yt,inspector:go}),al=dl?.model,pl=fn(()=>al?e=>al(e,ll(e),cl()):ll,[al,ll,Bt]),ul=dl?.measure,fl=ul?(e,n)=>ul(e,n,cl()):void 0,hl=dl?.canDrop,ml=hl?(e,n)=>hl(e,n,Zi,cl()):Zi,gl=dl?.drop,yl=gl?(e,n)=>gl(e,n,ol,cl()):ol,kl=dl?.pick,Sl=kl?e=>kl(e,sl,cl()):sl,vl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Dn?{}:il.seam({place:{...an(e),index:n}}),onAdd:Dn?void 0:t,label:o},`seam:${e}:${n}`),xl={rowClick:mi,isCollapsed:Xo,toggleCollapse:Yo},bl=e=>{const n=String(e.props.id),t=Sr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Tr(o),i=Xo(n),l=Br(e.type),s=Oo.rowName?Oo.rowName(e,"section",l):l,d=e=>vl(o,e,()=>pi(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
-
return wn(zn,{children:[
|
|
16
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:s,preview:ki(e),marks:Si(e),onSelect:()=>ri(t),nameSlot:Ur(le,t,n,s),selected:lo===n,actions:vi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:mi(()=>ri(t))},fold:{open:!i,label:"section",onToggle:()=>Yo(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Nr(n),l=Ti(n),s=l&&Xo(r),c=()=>Ri(o,t,r,e.type),{rowProps:a,...p}=il.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:mi(c)});/* @__PURE__ */
|
|
17
|
-
return wn(kn,{children:[d(t),
|
|
18
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:ki(n),marks:Si(n),onSelect:c,nameSlot:Ur(o,t,r,i),selected:lo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Yo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(o,t,i),vi(n,o,t),xi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},wl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=il.dragging,d=!Xo(l)&&s?.rung?.nodeId!==i,c={...an(l),index:0},a=s&&!s.rung&&Zi(s,c)?c:void 0,p=()=>Lr(e,n,!0),{rowProps:u,...f}=il.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(vo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:mi(p)}),h=Dn?null:vo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
-
return wn(kn,{children:[n.heading,
|
|
20
|
-
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:jr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Yo(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Dn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Dr(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__ */bn(tn,{size:15}):/* @__PURE__ */bn(ln,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},zl=(e,n)=>{const t=Bi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
-
return bn(zn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ni(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(nl(c)?.choices.length),p=(e,n)=>a?vl(e,n,()=>pi(e,n),"Add block here"):vl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=lo===String(n.props.id),{collapsible:i,folded:s}=Ii(n,l,Ai(n.type)),d=String(n.props.id),c=Yi(n),a=()=>Ri(t,o,d,e.type),{rowProps:u,...f}=il.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:mi(a)});/* @__PURE__ */
|
|
22
|
-
return wn(kn,{children:[0===o&&p(t,0),
|
|
23
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:c,preview:ki(n),marks:Si(n),onSelect:a,nameSlot:Ur(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Yo(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(t,o,c),vi(n,t,o),xi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:zl(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?wl(e,t.rung,r++,o,u):/* @__PURE__ */bn(kn,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=wo(Gn?.data,e.type,String(e.props.id)),o=Bi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
-
return bn(zn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ni(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)?()=>Mi(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>pi(n,t):void 0;return vl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */wn(zn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=lo===String(n.props.id),i=Fr(n),l=String(n.props.id),{collapsible:d,folded:c}=Ii(n,s,Ai(n.type)),a=zi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...an(p),index:Tr(p).length}:void 0,f=il.dragging,h=u&&f&&Zi(f,u)?u:void 0,g=()=>Ri(t,o,l,e.type),{rowProps:y,...k}=il.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!xo(n.type)},{"data-node-id":l,onClick:mi(g)});/* @__PURE__ */
|
|
25
|
-
return wn(kn,{children:[0===o&&m(t,0),
|
|
26
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:ki(n),marks:Si(n),onSelect:g,nameSlot:Ur(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Yo(l)}:void 0,actions:xo(n.type)?vi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[yi(t,o,i),vi(n,t,o),xi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */bn(we,{children:Cl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
-
/* @__PURE__ */bn(N,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Mi(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?wl(e,o.rung,i++,r,k):/* @__PURE__ */bn(kn,{children:k},o.slot??"")})})},Bl=(()=>{if(!Qn||!no)return null;const e=String(Qn.type),n=String(Qn.props.id),t=Co(e,wo(Gn?.data,e,n));if(!t||"footer"===t.source)return null;const o=Sr.some(e=>String(e.props?.id)===n),r=Array.isArray(Qn.props[t.slot])?Qn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Br(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:hi(Qn,o),choices:i,onPick:o=>{t.spec?Mi(n,t.slot,o,r.length,e):ji(`${n}:${t.slot}`,o,r.length)}}})(),Ol=ro&&ro.zone!==le&&!qi(ro.zone)?ro.zone:null,$l=!0===Qt.blocksFirst,Nl=Ol?nl(Ol):$l&&ro?null:Bl,Il=Boolean(Xt&&Ol)||$l&&Boolean(Nl&&Nl.choices.length>0),Pl=Ft||null!==It,Tl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:St&&!Pl&&So===e.id,onSelect:()=>mr(e.id)}:e,Al=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Ft,onSelect:()=>Ft?ui():ai(null)},...(yo.railLead??[]).map(Tl),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(qe,{}),active:St&&!Pl&&"sections"===So,onSelect:()=>mr("sections")},...(yo.railTrail??[]).map(Tl)];Nt?Al.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),active:St&&!Ft&&(null!==It||"media"===So),onSelect:()=>mr("media")}):Fn&&Al.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),onSelect:gr});const Rl=[...yo.railLead??[],...yo.railTrail??[]].find(e=>"panel"in e&&e.id===So),Ml=Boolean(ct?.foldable)&&!ko,jl=ct?.label??(Jn?at.pageSections:at.templateSections),El=Ml&&Xo(Nn),Ll=/* @__PURE__ */wn(zn,{children:[Sr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=lo===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=yo.hasOwnRows?.(e)??!1,l=Ti(e)||i,s=l&&Xo(r),{rowProps:d,...c}=il.row({item:{id:r,zone:le,index:n,type:e.type},place:{...an(le),index:n}},{"data-node-id":r,onClick:mi(()=>ri(n))});/* @__PURE__ */
|
|
28
|
-
return wn(kn,{children:[n>0&&bi(n),
|
|
29
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:Nr(e),preview:ki(e),marks:Si(e),onSelect:()=>ri(n),nameSlot:Ur(le,n,r,Nr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Yo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[yi(le,n,Nr(e)),vi(e,le,n),xi(le,n,e,Nr(e))]}),rowProps:d}),Ti(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),yo.partRows?.(e,xl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:yo.ownRows?.(e,n,xl)})]},String(e.props.id??n))}),!ko&&Ui>0&&bi(Ui),ct?.addAtEnd&&!ko&&!Dn&&/* @__PURE__ */bn(N,{small:!0,label:at.addSection,blocked:null,onAdd:()=>ai(Ui)})]}),Dl=(e,n,t)=>{const o=String(e.props.id),r=Oi(e).length>0||$i(e)||Boolean(Co(e.type)),i=r&&Xo(o),l="header"===t?at.header:at.footer,s=Oo.rowName?Oo.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
-
return wn(zn,{children:[
|
|
31
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:t,size:13}),name:s,preview:ki(e),marks:Si(e),onSelect:()=>ri(n),nameSlot:Ur(le,n,o,s),selected:lo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Yo(o)}:void 0,actions:vi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:mi(()=>ri(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:zl(e,1)})]})};return(yo.wrap??(e=>e))(
|
|
32
|
-
/* @__PURE__ */bn(te,{target:Ht,children:/* @__PURE__ */wn("div",{ref:Vt,className:"sf-editor es-editor",style:He(Wo),onContextMenu:_r.onEditorContextMenu,...m(Ie),children:[
|
|
33
|
-
/* @__PURE__ */wn(Pe,{children:[
|
|
34
|
-
/* @__PURE__ */bn(Te,{items:Al,ariaLabel:"Left panel views"}),
|
|
35
|
-
/* @__PURE__ */wn(Ae,{children:[
|
|
36
|
-
/* @__PURE__ */bn(Re,{label:"Undo",disabled:Boolean(Dn)||!Yn.hasPast,onClick:()=>Yn.back(),children:/* @__PURE__ */bn(en,{})}),
|
|
37
|
-
/* @__PURE__ */bn(Re,{label:"Redo",disabled:Boolean(Dn)||!Yn.hasFuture,onClick:()=>Yn.forward(),children:/* @__PURE__ */bn(nn,{})}),
|
|
38
|
-
/* @__PURE__ */bn(Me,{}),
|
|
39
|
-
/* @__PURE__ */bn(je,{devices:xt,value:Bt,onChange:Ot})]}),
|
|
40
|
-
/* @__PURE__ */wn(Ae,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
-
/* @__PURE__ */bn(Cn,{saveState:Mn,notSaving:Boolean(Dn)||null!=jn,readOnlyReason:Vn,toggle:Hn,onToggle:Ln,onRetry:En}),yo.barLead?.(),
|
|
42
|
-
/* @__PURE__ */bn(Sn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(vn,{variant:"secondary",onClick:()=>{Dt.current=(()=>{const e=Ht?.document;if(!e)return null;const n=Sr.findIndex(st),t=n>=0?n:Sr.length;let o=null;for(let n=0;n<t;n++){const t=Sr[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=Qn?.props?.id??Sr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Lt(e=>e+1)},children:"Refresh"})}),yo.barTrail?.(),yo.barMain?yo.barMain():/* @__PURE__ */bn(vn,{variant:"primary",disabled:null!==Vn,onClick:()=>{Rn(Gn.data)},children:at.done})]})]}),
|
|
43
|
-
/* @__PURE__ */bn(z,{}),
|
|
44
|
-
/* @__PURE__ */wn("div",{className:"sf-body",children:[St?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
-
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Ft?/* @__PURE__ */bn(I,{blocks:Nl,blocksOnly:Il,at:Xt?{label:(e=>{const n=qi(e.zone);if(n)return at.add.addingTo({name:Oo.rowName?hi(n,!0):Br(n.type)});if(e.zone===le){const n=Sr[e.index];return n&&!st(n)?at.add.addingBefore({name:hi(n,!0)}):at.add.addingAtEnd}const t=nl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(Xt),onClear:()=>Yt(null)}:void 0,onAdd:e=>{const n=ro,t=(e,n)=>{Xt&&Yt({zone:e,index:n})};if(n&&"block"!==e.kind&&qi(n.zone))return fi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===io)return void di(e);const n=di(e,io);Xt&&Kt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===io)return void ci(e,n);const t=ci(e,n,io);Xt&&Kt(t+1)})(e.template.name,wr(e.template.node));if(n&&n.zone!==le){const o=nl(n.zone);if(!o)return;return o.target.spec?Mi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):ji(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Bl?.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:rl,siteWide:yo.addPanelRow?.(ui),onClose:ui,onHide:fr,readOnly:Boolean(Dn)}):It&&$t?
|
|
46
|
-
/* @__PURE__ */bn(A,{panel:$t,pick:It,onHide:fr}):Rl?Rl.panel({onHide:fr,notify:qo}):"media"===So&&$t?/* @__PURE__ */bn(A,{panel:$t,pick:null,onHide:fr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
-
/* @__PURE__ */bn(P,{icon:/* @__PURE__ */bn(qe,{}),title:"Layers",context:pt,actions:Gi.length>0?/* @__PURE__ */bn(Ee,{label:Xi?"Expand all sections":"Collapse all sections",onClick:()=>Ho(e=>{const n=new Set(Gi);return Xi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Gi])}),children:/* @__PURE__ */bn(Bn,{expand:Xi})}):void 0,onHide:fr}),
|
|
48
|
-
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"page",size:13}),name:at.pageSettings,onSelect:yr,selected:!Qn&&no,rowProps:{onClick:mi(yr)}}),Fi&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
-
/* @__PURE__ */bn(Ce,{children:at.header}),bl(Fi)]}),!ko&&Un&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
-
/* @__PURE__ */bn(Ce,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"header",size:13}),name:at.header,onSelect:kr,selected:Zt.kind===it?.kind,rowProps:{onClick:mi(kr)}})]}),!ko&&Wi&&Dl(Wi,Hi,"header"),!ko&&!Ml&&/* @__PURE__ */bn(Ce,{children:jl}),Ml?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
-
/* @__PURE__ */bn(be,{icon:null,name:jl,fold:{open:!El,label:jl,onToggle:()=>Yo(Nn)}}),!El&&/* @__PURE__ */bn(we,{children:Ll})]}):Ll,Un&&/* @__PURE__ */bn(Ce,{children:at.footer}),Vi&&Dl(Vi,Di,"footer"),!ko&&!Vi&&Un&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"footer",size:13}),name:at.footer,onSelect:gi,rowProps:{onClick:mi(gi),title:"Edit the site footer"}}),Ji&&bl(Ji),yo.treeFoot?.()]})]})}),
|
|
53
|
-
/* @__PURE__ */bn(Le,{side:"left",width:Wo.left,min:Ve,max:De,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Uo})]}):/* @__PURE__ */bn(T,{side:"left",onShow:fr}),
|
|
54
|
-
/* @__PURE__ */wn("div",{ref:Zo,className:"sf-center sf-scroll","data-sf-canvas-head":rr?"":void 0,style:{overflowX:ar?"auto":"hidden",overflowY:"hidden"},children:[rr&&/* @__PURE__ */bn("div",{ref:ir,className:"sf-canvas-head",children:/* @__PURE__ */bn(rr,{device:Bt})}),
|
|
55
|
-
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:pr,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Bt===zt?"":`sf-frame--${Bt}`),style:ur,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
-
/* @__PURE__ */bn(ut,{},Et),
|
|
57
|
-
/* @__PURE__ */bn(Ue,{canvas:Ht,session:rl,model:pl,measure:fl,canDrop:ml,onDrop:yl,onPick:Sl,onZoneAdd:e=>{const n=sn(e),t=Mr(n);t&&Lr(t.node,t.slot,!1),pi(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Dn),revision:Gn.data}),_t.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:_t.map(e=>/* @__PURE__ */wn("button",{type:"button",tabIndex:-1,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},onClick:()=>ai(e.index),children:[
|
|
58
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
-
/* @__PURE__ */wn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),vt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
-
/* @__PURE__ */bn(g,{value:{selectChild:Ri,addChild:Mi,childRowName:Fr,blockRowName:Yi},children:/* @__PURE__ */bn(ft,{mode:Zt,onOpenWebsiteSettings:yo.openSettings??(()=>{}),onOpenSiteStyles:yo.openStyles,onSelectNode:Ao,onNotify:qo,onHidePanel:hr,nodeActions:Qn?se(_n,Qn.type):In})}),
|
|
63
|
-
/* @__PURE__ */bn(Le,{side:"right",width:Wo.right,min:Ve,max:De,defaultWidth:k.right,label:"Resize settings panel",onResize:Go})]}):
|
|
64
|
-
/* @__PURE__ */bn(T,{side:"right",onShow:hr})]}),_r.menu]})}))}export{Pn as ScreenChrome};
|
package/dist/chunk-JMGPPXNQ.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{FieldSelect as e}from"./chunk-NLRW4BGG.js";import{TreeSeam as n}from"./chunk-XWR5YVA7.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"./chunk-Q27BB5ZC.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-QTLAVDJE.js";import{EaselMenuItems as s}from"./chunk-EA2HTX37.js";import{FieldNumber as c}from"./chunk-7SQF6LZL.js";import{SettingsSegmented as u}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FPOKPNO4.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as h}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{ChevronIcon as f,LockIcon as g,MoveUpIcon as v,MoveDownIcon as y,DuplicateIcon as x,TrashIcon as k}from"./chunk-L5KW4HG5.js";import{Textarea as w,Input as N,ContextMenu as O,tabPanelId as C,tabButtonId as j,SearchableSelect as S,Select as D}from"efficient-shell/ui";import{useRef as I,useState as $,useLayoutEffect as F,useId as L}from"react";import{jsx as P,jsxs as A}from"react/jsx-runtime";function T({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:i=!1,ariaLabel:o,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */P(w,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */P(N,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function E(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function M(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function z(e,n){return e.filter((e,l)=>l!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',H={parentId:"list",slot:"items"};function G({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:w,min:N=0,max:C,readOnly:j=!1,open:S,onOpen:D,renderItem:L,renderRow:T,canRemove:G,lockedReason:K,fixed:Q=!1,removeOnRow:W=!0,canDuplicate:Y,above:V,head:q=!0}){const J=m("fields",d).list,X=m("tree",i),Z=t??J.item,U=!j&&!Q&&("number"!=typeof C||a.length<C),_=a.length<=N,ee=e=>!!G&&!G(a[e],e),ne=e=>!j&&!Q&&W&&!_&&!ee(e),le=e=>U&&(!Y||Y(a[e],e)),te=(e,n)=>u?u(e,n):J.itemName({noun:Z,n:n+1}),ae=I([]),re=I(null),[ie,oe]=$(null),se=I(null),[ce,ue]=$(null),[de,me]=$("");F(()=>{for(const e of ae.current){if(!e)continue;null!==e.querySelector(B)||j?e.removeAttribute("tabindex"):e.tabIndex=0}}),F(()=>{const e=re.current;if(!e)return;re.current=null;const n=ae.current[e.index]?.querySelectorAll(B)[e.nth]??ae.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const pe=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=ae.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(B)].indexOf(t),a=t;re.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(M(a,e,n));const i=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}(S,e,n);i!==S&&D(i),me(J.moved({n:n+1,total:a.length}))},he=e=>{U&&(r(E(a,e,o())),T?(re.current={index:e,nth:0,start:null,end:null},null!==S&&S>=e&&D(S+1)):D(e))},be=e=>{ne(e)&&(r(z(a,e)),S===e?D(null):null!==S&&S>e&&D(S-1))},fe=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===H.parentId&&n.slot===H.slot,onDrop:(e,n)=>{const l=h({...H,index:e},n);l!==e&&pe(e,l)},onStep:(e,n)=>pe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:j}),ge=e=>{const n=[];return e>0&&n.push({label:J.moveUp,icon:/* @__PURE__ */P(v,{size:14}),shortcut:"⌥↑",onClick:()=>pe(e,e-1)}),e<a.length-1&&n.push({label:J.moveDown,icon:/* @__PURE__ */P(y,{size:14}),shortcut:"⌥↓",onClick:()=>pe(e,e+1)}),le(e)&&n.push({label:J.duplicate,icon:/* @__PURE__ */P(x,{size:14}),onClick:()=>(e=>{le(e)&&(r(E(a,e+1,R(a[e]))),null!==S&&S>e&&D(S+1))})(e)}),ne(e)&&n.push({label:J.delete,icon:/* @__PURE__ */P(k,{size:14}),danger:!0,onClick:()=>be(e)}),n},ve=(e,n,l,t)=>{j||0===ge(e).length||ue({index:e,x:n,y:l,owner:t})},ye=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
|
|
2
|
-
return A("div",{className:"es-list",children:[q?/* @__PURE__ */A("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */A("span",{className:"es-list-label",children:[l?/* @__PURE__ */P("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
|
|
4
|
-
/* @__PURE__ */P("span",{className:"es-list-count",children:a.length})]}):null,V?/* @__PURE__ */P("div",{className:"es-list-above",children:V}):null,a.length?/* @__PURE__ */A("div",{className:"es-list-rows",...fe.rootProps(),children:[a.map((e,l)=>{const t=fe.row({item:l,place:{...H,index:l}}),a=t.draggable&&ie!==l,r=!T&&S===l,i=!j&&!Q&&W&&ee(l),o=["es-list-row",T?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
5
|
-
return A("div",{className:"es-list-entry",children:[l>0?/* @__PURE__ */P("div",{className:"es-list-gap",children:/* @__PURE__ */P(n,{...fe.seam({place:{...H,index:l}}),onAdd:U?()=>he(l):void 0,label:J.addHere({noun:Z})})}):null,
|
|
6
|
-
/* @__PURE__ */A("div",{...t.rowProps,ref:e=>{ae.current[l]=e},className:o,draggable:a||void 0,"aria-keyshortcuts":t.draggable?"Alt+ArrowUp Alt+ArrowDown":void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,se.current=n&&!a?n:null,oe(a?l:null)},onDragStart:e=>{const n=se.current;se.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{j||(e.preventDefault(),e.stopPropagation(),ve(l,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ve(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)},children:[a?/* @__PURE__ */P("span",{className:"es-list-hint","aria-hidden":"true",children:X.dragHint}):null,T?/* @__PURE__ */P("div",{className:"es-list-row-main",children:T(e,l,ye(l))}):/* @__PURE__ */A("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>D(r?null:l),children:[w?/* @__PURE__ */P("span",{className:"es-list-thumb","aria-hidden":"true",children:w(e,l)}):null,
|
|
7
|
-
/* @__PURE__ */P("span",{className:"es-list-row-name",children:te(e,l)}),/* @__PURE__ */P("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
|
|
8
|
-
/* @__PURE__ */P(f,{size:14,className:"es-list-chev","aria-hidden":"true"})]}),j||Q||!W?null:i?b(K?K(e,l):J.locked,/* @__PURE__ */P("span",{className:"es-list-lock",role:"img","aria-label":K?K(e,l):J.locked,children:/* @__PURE__ */P(g,{size:13})})):b(J.deleteItem({noun:Z}),/* @__PURE__ */P("button",{type:"button",className:"es-list-x","aria-label":J.deleteItem({noun:Z}),disabled:!ne(l),onClick:()=>be(l),children:"×"}))]}),r?/* @__PURE__ */P("div",{className:"es-list-item",children:L(e,l,ye(l))}):null]},l)}),
|
|
9
|
-
/* @__PURE__ */P("div",{className:"es-list-gap",children:/* @__PURE__ */P(n,{...fe.seam({place:{...H,index:a.length}})})})]}):null,j||Q?null:/* @__PURE__ */P("button",{type:"button",className:"es-list-add",disabled:!U,onClick:()=>he(a.length),children:J.add({noun:Z})}),
|
|
10
|
-
/* @__PURE__ */P("span",{className:"es-list-said","aria-live":"polite",children:de}),ce&&ce.index<a.length?
|
|
11
|
-
/* @__PURE__ */P(O,{at:{x:ce.x,y:ce.y},owner:ce.owner,onClose:()=>ue(null),children:/* @__PURE__ */P(s,{items:ge(ce.index),onClose:()=>ue(null)})}):null]})}var K=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Q({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=$(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
|
|
12
|
-
return P(r,{id:`${l}-group`,title:K(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */P(Y,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:d[e],onChange:n=>a({...d,[e]:n}),readOnly:i,context:o,renderers:s},e))})}function W({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=$(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
13
|
-
return P(G,{label:K(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>R({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:m,onOpen:p,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */P(Y,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:i,renderers:o},e))})}function Y(n){const{field:t,name:a,id:r,value:i,onChange:o,readOnly:s,context:d,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:a,id:r,value:i,onChange:o,readOnly:s});switch(t.type){case"custom":{const e={...d,field:t,name:a,id:r,value:i,onChange:o,readOnly:s};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
14
|
-
return P(l,{label:K(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(T,{id:r,value:"string"==typeof i?i:null==i?"":String(i),onChange:o,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:s})});case"number":/* @__PURE__ */
|
|
15
|
-
return P(l,{label:K(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(c,{id:r,value:"number"==typeof i?i:void 0,onChange:o,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:s})});case"select":{const n=`${r}-label`;/* @__PURE__ */
|
|
16
|
-
return P(l,{label:K(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
17
|
-
return P(l,{label:K(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(u,{ariaLabel:K(t,a),value:i,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||o(e)}})});case"object":/* @__PURE__ */
|
|
18
|
-
return P(Q,{...n,field:t});case"array":/* @__PURE__ */
|
|
19
|
-
return P(W,{...n,field:t});case"slot":return null}}var V=e=>t.includes(e);function q(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(V(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function J(e){return new Map(q(e).rows.map(e=>[e.name,e.bucket]))}function X({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),g=L(),v=p??`es-insp${g.replace(/:/g,"")}`,y=q(e),[x,k]=$(void 0),w=i??x,N=w&&y.buckets.includes(w)?w:y.buckets[0],[O,S]=$(null),D=O&&O.panel===v&&y.rows.some(e=>e.name===O.name)?O:null,I=c&&y.buckets.length>1,F=I&&N?C(v,N):`${v}-rows`;/* @__PURE__ */
|
|
20
|
-
return A("div",{className:"es-insp",children:[I?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(a,{ariaLabel:h??f.settings,activeId:N,onSelect:e=>{const n=e;void 0===i&&k(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e]})),idPrefix:v})}):null,
|
|
21
|
-
/* @__PURE__ */A("div",{className:"es-insp-rows",id:F,role:I?"tabpanel":void 0,"aria-labelledby":I&&N?j(v,N):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!I||i===N)||void 0,children:/* @__PURE__ */P(Y,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:D&&D.name===e?D.index:null,onOpenItem:n=>S(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function Z(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function U({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=$(null),[u,p]=$(null),h=s??t.kindOf(e),b=l.filter(e=>!e.hideWhenEmpty||Z(e.target).length>0||e.value===h),f=b.find(e=>"text"===e.target.type),g=b.find(e=>e.value===h)??f??b[0];if(!g)return null;const v="text"!==g.target.type,y=v?t.targetOf(e):e,x=Z(g.target),k=x.find(e=>e.value===y),w=e=>({value:e,label:o.unavailable({value:e})}),O="select"===g.target.type&&y&&a?a(y):null,C=O?t.readFilter(e):null,j=C?O?.find(e=>e.param===C.param):void 0,I=u&&u.against===e?u.text:e,F=!v&&""!==I.trim()&&!t.isSafe(I),L=e=>{if(!e)return n("");const l=x.find(n=>n.value===e);n(e,l?.label)},T=(e,n)=>n&&!e.some(e=>e.value===n)?[w(n),...e]:[...e],E=(e,n,l,t,a)=>{if(a){const a=l.map(e=>({value:e.value,label:e.label,...e.group?{sublabel:e.group}:{}}));/* @__PURE__ */
|
|
22
|
-
return P(S,{"aria-label":e,value:n,options:a,disabled:i,placeholder:l.find(e=>""===e.value)?.label,onChange:e=>""!==e||l.some(e=>""===e.value)?t(e):void 0})}const r=[];for(const e of l){const n=r[r.length-1],l={value:e.value,label:e.label};e.group?n&&"options"in n&&n.label===e.group?n.options.push(l):r.push({label:e.group,options:[l]}):r.push(l)}/* @__PURE__ */
|
|
23
|
-
return P(D,{size:"sm","aria-label":e,value:n,options:r,disabled:i,onChange:t})};let M;if("text"===g.target.type)M=/* @__PURE__ */P(N,{size:"sm",type:"text",className:"es-fin",invalid:F,"aria-label":o.address,placeholder:o.addressPlaceholder,value:I,readOnly:i,onChange:l=>(l=>{const a=l.trim();a?t.isSafe(l)?(p({text:l,against:a}),n(a)):p({text:l,against:e}):(p({text:l,against:""}),n(""))})(l.target.value)});else{const e="groups"===g.target.type?g.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):g.target.options.map(e=>({value:e.value,label:e.label})),n=[{value:"",label:g.target.placeholder},...T(e,y)];M=E(g.label,y,n,L,e.length>10)}/* @__PURE__ */
|
|
24
|
-
return A("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[E(o.linkType,g.value,b.map(e=>({value:e.value,label:e.label})),e=>{c(e),p(null);const l=b.find(n=>n.value===e);if(!l||"text"===l.target.type)return;const t=Z(l.target)[0];t?n(t.value,t.label):n("")},!1),M,O&&E(o.filter,C?.param??"",[{value:"",label:o.noFilter},...C&&!j?[w(C.param)]:[],...O.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return n(y,k?.label);const l=O?.find(n=>n.param===e),a=l?.values[0];a&&n(t.withFilter(y,{param:e,value:a.value}),a.label)},!1),O&&C&&E(o.value,C.value,T((j?.values??[]).map(e=>({value:e.value,label:e.label})),C.value),e=>{if(!C)return;const l=j?.values.find(n=>n.value===e);n(t.withFilter(y,{param:C.param,value:e}),l?.label)},(j?.values.length??0)>10),F&&/* @__PURE__ */P("p",{className:"es-flink-error",role:"alert",children:o.unsafe}),g.hint&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:g.hint}),O&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:o.filterHint})]})}export{T as FieldText,X as Inspector,Y as InspectorField,U as LinkPicker,G as ListField,J as bucketsOf,R as copyItem,E as insertAt,K as labelOf,M as moveTo,q as planFields,z as removeAt};
|
package/dist/chunk-NLRW4BGG.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FPOKPNO4.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as i,Slider as n}from"efficient-shell/ui";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useId as r,useRef as t}from"react";function u(e,l){return e.find(e=>Object.is(e.value,l))}var d=e=>String(e);function c(n){const{id:r,options:t,placeholder:u,readOnly:c=!1,ariaLabel:m,ariaLabelledBy:v,searchable:b=!1,searchPlaceholder:h,groupCount:p=!1,renderOption:f}=n,g=l("fields",e),N=v?{"aria-labelledby":v}:m?{"aria-label":m}:{},O=t.some(e=>void 0!==e.thumb),y=O||void 0!==f||t.some(e=>void 0!==e.meta),C=e=>""===e?void 0:t[Number(e)],x=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */o("span",{className:"es-fsel-row",children:[O?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
|
|
2
|
-
/* @__PURE__ */s("span",{className:"es-fsel-label",children:f?f(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||b?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label};if(b&&!0!==n.multiple){const l=t.findIndex(e=>Object.is(e.value,n.value)),i=[];t.forEach((e,l)=>{if(e.disabled)return;const a=e.meta??e.group;i.push({value:d(l),label:e.label,...a?{sublabel:a}:{}})});const o=n.onChange;/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{id:r,value:l>=0?d(l):"",options:i,placeholder:h??u??g.search??e.search,disabled:c,renderOption:y?x:void 0,onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&o(l.value)},...N})})}const j=[];let I=null;if(t.forEach((e,l)=>{const a={value:d(l),label:e.label,...e.disabled?{disabled:!0}:{}};void 0===e.group?(I=null,j.push(a)):I&&I.label===e.group?I.options.push(a):(I={label:e.group,options:[a]},j.push(I))}),p)for(const e of j)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const F={id:r,size:"sm",className:"es-fsel-button",options:j,placeholder:u??g.choose,disabled:c,renderOption:y?x:void 0,...N};if(!0===n.multiple){const e=Array.isArray(n.value)?n.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=t.flatMap((e,a)=>l(e)?[d(a)]:[]),o=n.onChange;/* @__PURE__ */
|
|
4
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,multiple:!0,value:a,onChange:e=>o(t.filter((l,a)=>e.includes(d(a))).map(e=>e.value))})})}const M=t.findIndex(e=>Object.is(e.value,n.value)),P=n.onChange;/* @__PURE__ */
|
|
5
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,value:M>=0?d(M):"",onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&P(l.value)}})})}function m({id:e,label:l,value:a,onChange:i,min:u,max:d,step:c=1,styleValue:m,unit:v,sliderMin:b,sliderMax:h,auto:p,readOnly:f=!1}){const g=r(),N=e??g,O="number"==typeof a&&Number.isFinite(a)?a:void 0,y=void 0!==p&&void 0===O,C=!y&&void 0===O&&void 0!==m,x=Number((b-c).toFixed(6)),j=t(!1),I=e=>{f||e===O||i(e)};/* @__PURE__ */
|
|
6
|
-
return o("div",{className:"es-fslider"+(C||y?" is-style":""),onChangeCapture:e=>{j.current="range"===e.target.type},children:[
|
|
7
|
-
/* @__PURE__ */s("label",{className:"es-fslider-name",htmlFor:N,children:l}),
|
|
8
|
-
/* @__PURE__ */s(n,{id:N,label:l,value:O??null,onChange:e=>{if(null===e)return I(void 0);I(void 0!==p&&j.current&&e<b?void 0:e)},min:void 0!==p?x:b,max:h,inputMin:u??-1e9,inputMax:d??Number.POSITIVE_INFINITY,step:c,suffix:v&&!y?v:void 0,emptyLabel:p??(void 0!==m?String(m):""),disabled:f,size:"sm"})]})}export{c as FieldSelect,m as FieldSlider,u as optionFor};
|
package/dist/chunk-OJAJVH7S.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-PYCLHOSA.js";import{Inspector as o}from"./chunk-JMGPPXNQ.js";import{DesktopIcon as u}from"./chunk-L5KW4HG5.js";import{createContext as i,useContext as l}from"react";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function a(n,e){const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function f(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const o=e.slotsOf?.(r);return o||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 k(n,e){return n.isLast?n.isLast(e):e.type===n.last}var m={},h={},v=()=>m,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},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(u,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:u,onChange:i}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(o,{fields:e,values:t,onChange:i,readOnly:u,idPrefix:n})})}var G=i({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(G.Provider,{value:n,children:e})}function D(){return l(G)}function x(){return(D().useOwnerName??g)()}function A(){return(D().useDocumentLabel??y)()}function B(n,e,t,r){return(D().useBridges??v)(n,e,t,r)}function I(n){return(D().useStandaloneBridges??v)(n)}function T(n,e){(D().useDocumentPass??b)(n,e)}function F(){return D().blockRules??L}function H(){return D().blockLook??O}function K(){return D().devices??j}function R(){return D().leftView??P}function W(){return D().pinned??w}function Q(){return D().saveSwitch??!0}function V(n){e(!0===D().pickFollowsSelection,n)}function Y(){return D().add??h}function E(){return D().storageNamespace||void 0}function J(){return D().styleClipboard??null}function M(){return D().nodeKeys??!0}function X(){return D().notify??null}function Z(){return D().Canvas??S}function q(){return D().CanvasHead??null}function z(){return D().canvasDrag??null}var U=i(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(U.Provider,{value:n,children:e})}function _(){return l(U)}function nn(){return D().Inspector??C}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,k as isPinnedLast,f as isSlotMode,a as sameInspectorMode,d as screenSlotsOf,Y as useScreenAdd,H as useScreenBlockLook,F as useScreenBlockRules,B as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,K as useScreenDevices,A as useScreenDocumentLabel,T as useScreenDocumentPass,nn as useScreenInspectorPanel,R as useScreenLeftView,M as useScreenNodeKeys,X as useScreenNotify,x as useScreenOwnerName,D as useScreenParts,V as useScreenPickFollowsSelection,W as useScreenPinned,Q as useScreenSaveSwitch,E as useScreenStorageNamespace,J as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
package/dist/chunk-OTEXGJDU.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as s}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as i}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-QR4DLZ3P.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-OJAJVH7S.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as u}from"./chunk-PYCLHOSA.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{AddPanel as f}from"./chunk-W3XX2CNW.js";import{AddIcon as h}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as O,Fragment as $}from"react/jsx-runtime";var v=e=>`section:${e}`,B=e=>`block:${e}`,H=e=>`template:${e}`;function L({blocks:L,blocksOnly:x,at:A,onAdd:R,itemFor:V,session:C,siteWide:I,onClose:N,onHide:W,readOnly:D}){const P=u(e=>e.config),S=p(),{labelAtLevel:F,categoryLabel:J,firstSection:Q,Icon:T,Thumbnail:Y}=S,{blockIsOffered:Z}=m(),w=k("screen",d).add,z=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>Z(e,z);return i(z).list().then(n=>{if(t)return;const s=P.components;G(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,z]);const K=j(()=>t(P,S),[P]),M=e=>({type:v(e.type),label:e.name,cover:/* @__PURE__ */g(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:w.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=j(()=>{const e=[];if(L&&L.choices.length>0&&a(L.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${w.inside({name:L.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:B(e.type),label:e.label,icon:/* @__PURE__ */g(T,{type:e.type,size:18}),title:w.tile({name:e.label})}))})}),x)return e;const t=o(K,Q);t&&e.push({key:"start",title:w.startBlank,tiles:[M(t)]}),E.length>0&&e.push({key:"templates",title:w.templates,tiles:E.map(e=>{return{type:H(e.id),label:e.name,cover:/* @__PURE__ */g(Y,{type:e.node.type}),keywords:[(t=e.node.type,F(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const i=n(K,Q);for(const t of Object.keys(P.categories??{})){const o=i.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:s(P,t,J),tiles:o.map(M)})}return e},[L,x,E,K,P,w]),q=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__ */g(r,{icon:/* @__PURE__ */g(h,{size:15}),title:w.title,context:x?w.contextBlocks:w.contextAll,actions:/* @__PURE__ */g(c,{label:w.done,description:w.doneDescription,onClick:N}),onHide:W}),
|
|
4
|
-
/* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */g(f,{groups:X,session:C,itemFor:e=>V(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&R(t)},at:A,hint:x?w.hintBlocks:w.hint,searchLabel:x?w.searchBlocks:w.searchSections,readOnly:D}),I&&!x?I:null]})]})}export{L as AddSidePanel,B as blockKey,v as sectionKey,H as templateKey};
|
package/dist/chunk-Q27BB5ZC.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_WORDS as e}from"./chunk-QTLAVDJE.js";import{SettingsSwitch as a}from"./chunk-QLD57GBB.js";import{Tabs as l,CountBadge as n,Tooltip as i}from"efficient-shell/ui";import{jsx as s,jsxs as r,Fragment as t}from"react/jsx-runtime";import{isValidElement as c,cloneElement as d}from"react";function o(e){const a=e[0];if(!a?.htmlId||!a.htmlId.endsWith(`-tab-${a.id}`))return;const l=a.htmlId.slice(0,-`-tab-${a.id}`.length);return e.every(e=>e.htmlId===`${l}-tab-${e.id}`)?l:void 0}function u({items:a,activeId:c,onSelect:d,ariaLabel:u=e.settings,idPrefix:h,className:m}){
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-tabs-fit",children:/* @__PURE__ */s(l,{variant:"pill","aria-label":u,idPrefix:h??o(a),className:m?`es-tabs ${m}`:"es-tabs",value:c,onChange:d,items:a.map(e=>{const a="number"==typeof e.badge&&e.badge>0?/* @__PURE__ */s(n,{count:e.badge,tone:"accent"}):null;return e.icon?{id:e.id,label:/* @__PURE__ */r(t,{children:[
|
|
4
|
-
/* @__PURE__ */r(i,{content:e.label,className:"es-tab-tip",children:[
|
|
5
|
-
/* @__PURE__ */s("span",{className:"es-tab-icon","aria-hidden":"true",children:e.icon}),
|
|
6
|
-
/* @__PURE__ */s("span",{className:"es-tab-word has-icon",children:e.label})]}),a]})}:{id:e.id,label:/* @__PURE__ */r(t,{children:[
|
|
7
|
-
/* @__PURE__ */s("span",{className:"es-tab-word",children:e.label}),a]})}})})})}function h(e){return Array.isArray(e)?e.some(h):c(e)}function m(e,l,n){if(!c(e)||e.type!==a)return e;const i=e.props;return i.ariaLabel||i.ariaLabelledBy?e:d(e,n?{ariaLabelledBy:n}:{ariaLabel:l})}function p({label:e,labelId:a,icon:l,value:n,hint:i,changed:c,htmlFor:d,action:o,children:u,className:p}){const b=h(u),f=h(o);if(!b&&!f)return null;const N=["es-field"];b||N.push("is-inline"),c&&N.push("is-changed"),p&&N.push(p);const g=/* @__PURE__ */r(t,{children:[l?/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,
|
|
8
|
-
/* @__PURE__ */s("span",{className:"es-field-label",id:a,children:e})]});/* @__PURE__ */
|
|
9
|
-
return r("div",{className:N.join(" "),children:[
|
|
10
|
-
/* @__PURE__ */r("div",{className:"es-field-head",children:[d?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:d,children:g}):/* @__PURE__ */s("span",{className:"es-field-name",children:g}),null!=n?/* @__PURE__ */s("span",{className:"es-field-value",children:n}):null,f?m(o,e,a):null]}),b?/* @__PURE__ */s("div",{className:"es-field-ctl",children:u}):null,i?/* @__PURE__ */s("p",{className:"es-field-hint",children:i}):null]})}function b({title:e,open:a,onToggle:l,count:n,id:i,children:t,className:c}){const d=i?`${i}-body`:void 0;/* @__PURE__ */
|
|
11
|
-
return r("div",{className:c?`es-group ${c}`:"es-group",children:[
|
|
12
|
-
/* @__PURE__ */r("button",{type:"button",id:i,"aria-expanded":a,"aria-controls":d,className:"es-group-head",onClick:()=>l(!a),children:[e,"number"==typeof n&&n>0?/* @__PURE__ */s("span",{className:"es-group-count",children:n}):null,
|
|
13
|
-
/* @__PURE__ */s("span",{className:"es-group-sign","aria-hidden":"true"})]}),
|
|
14
|
-
/* @__PURE__ */s("div",{id:d,className:"es-group-body",hidden:!a,children:t})]})}var f=Object.freeze(["Content","Style","Layout","Animation"]);export{f as SETTINGS_BUCKETS,p as SettingsField,b as SettingsGroup,u as SettingsTabs};
|
package/dist/chunk-QMNML7XH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-OJAJVH7S.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-PYCLHOSA.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,m=!0===(i.resolveOnInsert??a);return s(()=>{const e=(e,n,o)=>{const r=t(n);return c||p({type:"insert",componentType:n,destinationZone:e,destinationIndex:o,id:r}),r},o=e=>(m&&!c&&d.resolveNode(e,{trigger:"insert"}),e),r=(e,t,n)=>{c||p({type:"replace",destinationZone:e,destinationIndex:t,data:n})},s=(t,n,r)=>o(e(t,n,r));return{insertComponent:s,insertSection:(e,t)=>s(n,e,t),replaceComponent:r,seedChild:(t,n,s,i)=>{const p=e(t,s,n);r(t,n,{type:s,props:{id:p,...i}}),o(p)},insertNode:(t,n,s)=>{const i=e(t,s.type,n);return r(t,n,{type:s.type,props:{...s.props,id:i}}),o(i)},removeComponent:(e,t)=>{c||p({type:"remove",index:t,zone:e})},reorderComponent:(e,t,n)=>{c||p({type:"reorder",sourceIndex:t,destinationIndex:n,destinationZone:e})},duplicateComponent:(e,t)=>{c||p({type:"duplicate",sourceIndex:t,sourceZone:e})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:e=>{c||p({type:"setData",data:e})},commitDocument:(e,t)=>{c||d.run({data:e,select:t})}}},[p,c,m,d])}export{i as useSectionOps};
|