efficient-easel 1.1.0 → 2.0.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 +7 -3
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-ORR3Q4WV.js → chunk-2JIWFFXA.js} +1 -1
- package/dist/{chunk-MAEXP3KE.js → chunk-35Q5HMJZ.js} +1 -1
- package/dist/{chunk-TJIXDXTV.js → chunk-4CJP57AY.js} +1 -1
- package/dist/chunk-4VJATVVR.js +1 -0
- package/dist/{chunk-KCE5RVVC.js → chunk-6AMS5BQH.js} +3 -3
- package/dist/chunk-6HHHBBSY.js +16 -0
- package/dist/{chunk-QR4DLZ3P.js → chunk-BSSKAEFF.js} +1 -1
- package/dist/chunk-E2L2XVRX.js +23 -0
- package/dist/chunk-HGTPLCTQ.js +1 -0
- package/dist/chunk-HMXIAMCU.js +1 -0
- package/dist/chunk-IJ3OOBDY.js +64 -0
- package/dist/{chunk-RINSVAKA.js → chunk-IJGHMGG4.js} +1 -1
- package/dist/chunk-LACBURK5.js +5 -0
- package/dist/{chunk-NGT4DAHF.js → chunk-LC7N3GZS.js} +1 -1
- package/dist/{chunk-JMIZ3FOV.js → chunk-LEGBBCOH.js} +1 -1
- package/dist/chunk-OSPUG6S6.js +1 -0
- package/dist/chunk-OXYGFK2B.js +21 -0
- package/dist/{chunk-4OL6MRYY.js → chunk-PBVC2VGH.js} +1 -1
- package/dist/chunk-PT6NPMWV.js +5 -0
- package/dist/chunk-V7U33NF2.js +1 -0
- package/dist/{chunk-SQTY6CJD.js → chunk-ZV6OYSZ7.js} +1 -1
- package/dist/copy/index.js +21 -21
- package/dist/drag/index.js +1 -1
- package/dist/fields/fields.css +23 -74
- package/dist/fields/index.d.ts +11 -3
- package/dist/fields/index.js +1 -1
- package/dist/icons/index.d.ts +2 -507
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.js +15 -15
- package/dist/rail/index.d.ts +1 -1
- package/dist/rail/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.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/SidePanelHead.js +1 -1
- package/dist/screen/components/UiIcon.js +2 -2
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/shell/index.d.ts +4 -4
- package/dist/shell/index.js +1 -1
- package/dist/shell/shell.css +11 -3
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.js +23 -23
- package/package.json +5 -4
- package/dist/chunk-2F6RZTR7.js +0 -5
- package/dist/chunk-2LK54I4E.js +0 -1
- package/dist/chunk-57DJOKXT.js +0 -1
- package/dist/chunk-7QWOAQQL.js +0 -5
- package/dist/chunk-BEEJ63CT.js +0 -64
- package/dist/chunk-HMJS344F.js +0 -1
- package/dist/chunk-JLTZQ4US.js +0 -1
- package/dist/chunk-L5KW4HG5.js +0 -470
- package/dist/chunk-Q6ETRSEA.js +0 -24
- package/dist/chunk-TJ7YIRWQ.js +0 -21
- package/dist/chunk-W3XX2CNW.js +0 -16
- package/dist/chunk-X6DQWK2C.js +0 -1
package/README.md
CHANGED
|
@@ -51,9 +51,13 @@ The exported names hosts import (`EaselIconButton`, `SettingsSwitch`,
|
|
|
51
51
|
`SettingsSegmented`, `SettingsTabs`, `FieldText`, `FieldNumber`, …) stay, as
|
|
52
52
|
thin wrappers with the props they had.
|
|
53
53
|
|
|
54
|
-
`tests/own-ui-ratchet.test.ts`
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
`tests/own-ui-ratchet.test.ts` holds the named primitives: since 1.0.0 none
|
|
55
|
+
is left on it (`OWN_PRIMITIVES` is empty), and its stylesheet counts (raw
|
|
56
|
+
colours, literal radii) only go down. The raw elements inside components are
|
|
57
|
+
held by `efficient-shell-ui-check` (`ui-kit.config.json`,
|
|
58
|
+
`ui-kit.baseline.json`), which reads the syntax tree: it counts 24 raw
|
|
59
|
+
buttons, 3 inputs and 2 dialog roles still drawn here, and that only goes
|
|
60
|
+
down too.
|
|
57
61
|
|
|
58
62
|
## Why
|
|
59
63
|
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-OXYGFK2B.js";import"../chunk-ZJEBF4NB.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-OXYGFK2B.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-E2O2MRZR.js";import{EditNotice as r}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-E2O2MRZR.js";import{EditNotice as r}from"./chunk-OXYGFK2B.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-LACBURK5.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PYCLHOSA.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
|
+
export{AddIcon,LayersIcon,MediaIcon,PageIcon,SitemapIcon,StylesIcon}from"efficient-shell/icons/efficient";var a={railWidth:46,railPaddingY:8,railGap:4,railRadius:"var(--radius-xl)",buttonSize:36,iconSize:18,color:{background:"var(--surface)",shadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)"}},i={railWidth:"--es-rail-w",railPaddingY:"--es-rail-pad-y",railGap:"--es-rail-gap",railRadius:"--es-rail-radius",buttonSize:"--es-rail-btn-size",iconSize:"--es-rail-icon-size",background:"--es-rail-bg",shadow:"--es-rail-shadow"};export{i as railCssVars,a as railTokens};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as e}from"./chunk-
|
|
1
|
+
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as e}from"./chunk-4CJP57AY.js";import{ScreenChrome as r}from"./chunk-IJ3OOBDY.js";import{ScreenDocumentProvider as a,useScreenDocument as i}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-E2O2MRZR.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{useMemo as c}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 v=n(e),f=n(r);function p({saving:n,onCancel:e,onDiscard:r,onSave:a}){/* @__PURE__ */
|
|
2
2
|
return m(d,{open:!0,role:"alertdialog",size:"sm",title:"Unsaved changes",onClose:e,footer:/* @__PURE__ */g(h,{children:[
|
|
3
3
|
/* @__PURE__ */m(l,{variant:"secondary",onClick:e,children:"Cancel"}),
|
|
4
4
|
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:r,children:"Discard & leave"}),
|
|
5
5
|
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:a,children:n?"Saving…":"Save & leave"})]}),children:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them."})}function u({target:n,addressing:e,onHostMessage:r,children:i}){/* @__PURE__ */
|
|
6
|
-
return m(a,{target:n,addressing:e,onHostMessage:r,children:i})}var C=(n,e)=>/* @__PURE__ */g(h,{children:[n,e]});function k({config:n,parts:e,wrap:r=C}){const{data:a,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:N,cancelPendingNav:j,discardAndNavigate:
|
|
7
|
-
/* @__PURE__ */m(v,{config:n,data:a,onChange:k,permissions:
|
|
6
|
+
return m(a,{target:n,addressing:e,onHostMessage:r,children:i})}var C=(n,e)=>/* @__PURE__ */g(h,{children:[n,e]});function k({config:n,parts:e,wrap:r=C}){const{data:a,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:N,cancelPendingNav:j,discardAndNavigate:O,saveAndNavigate:S}=i(),Y=c(()=>o(!u),[u]),y=t("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:y.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?a?r(
|
|
7
|
+
/* @__PURE__ */m(v,{config:n,data:a,onChange:k,permissions:Y,parts:e,children:/* @__PURE__ */m(f,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:O,onSave:()=>{S()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:y.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:y.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{framePointToHost as i,elementScale as c,frameRectToLayer as d,clientPointToLayer as u}from"./chunk-ZNCEOSXO.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{parseZoneKey as f}from"./chunk-KRXQM65X.js";import{useRef as p,useEffect as m,useState as b,useCallback as g,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w}from"efficient-shell/ui";import{jsxs as N,jsx as A}from"react/jsx-runtime";import{CloseIcon as D,SearchIcon as z}from"efficient-shell/icons/efficient";var T=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,C=e=>e.width*e.height;function S(e,t,n){let l=null;for(const r of e)T(r.box,t,n)&&(!l||C(r.box)<=C(l.box))&&(l=r);return l}function E(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function $(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function L(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>T(e.box,t,n)).sort((e,t)=>C(e.box)-C(t.box));for(const e of o){const o=E(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:$(e,o)};if(!a(s))return null}return null}function j(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var M={nodes:[],zones:[]},B="data-puck-dropzone",O="data-puck-component";function K(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function X(e,t){const{frame:n,document:l}=e,r=e=>d(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${B}]`)){const t=e.getAttribute(B)??"";let n;try{n=f(t)}catch{continue}const l=[...e.querySelectorAll(`[${O}]`)].filter(t=>t.parentElement?.closest(`[${B}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:K(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(O);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var q="data-es-empty-cell",P="data-puck-dropzone",Y=140;var Z=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function F(d){const{canvas:h,session:f,readOnly:x,words:D=e.canvas}=d,z=p(d);m(()=>{z.current=d});const T=p(null),C=o(h),[E,$]=b(0),j=g(()=>$(e=>e+1),[]),[B,O]=b(M);m(()=>{const e=T.current;h&&e&&O((z.current.measure??X)(h,e))},[h,C,d.revision,E]);const K=d.model,Y=y(()=>K(B),[K,B]),F=v(f.subscribe,f.shown,f.shown),[R,Q]=b(null),[V,G]=b(null),H=p(null),I=()=>{H.current&&clearTimeout(H.current),H.current=null},W=()=>{I(),H.current=setTimeout(()=>{f.get()||Q(null)},140)};m(()=>I,[]);const J=p(null);s(h,"mousemove",e=>{const t=T.current;if(!h||!t)return;const n=i(h.frame,e.clientX,e.clientY,t),l=c(t),r={x:n.x/l,y:n.y/l};if(J.current=r,z.current.readOnly||f.get())return;I();const a=S(Y.sources,r.x,r.y);Q(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(h,"mouseout",e=>{e.relatedTarget||(J.current=null,W())}),s(h,"mouseover",e=>{e.relatedTarget||j()});const U=p(null),_=g(()=>{U.current?.(),U.current=null,G(null)},[]);m(()=>f.subscribe(()=>{f.get()?j():_()}),[f,_,j]),m(()=>_,[_]),("undefined"==typeof document?m:k)(()=>{if(f.get())return;const e=J.current;Q(t=>x?null:e?S(Y.sources,e.x,e.y):t?Y.sources.find(e=>e.key===t.key)??null:null)},[Y,F,f,x]);const ee=e=>{const t=f.get(),n=T.current;if(!t||!n)return null;const l=u(n,e.clientX,e.clientY);J.current=l;const r=L(Y.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},te={onDragEnter:e=>{if(U.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=h?l(h.document):null,o=[];t&&o.push(r(t)),a&&h&&o.push(r(a,h.frame)),U.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ee(e);if(!n)return void G(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};G(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(J.current=null,G(null))},onDrop:e=>{const t=ee(e);t&&(e.preventDefault(),f.end(),_(),z.current.onDrop(t.h.item,t.t.to))}},ne={draggable:!x&&!!R,onMouseEnter:I,onMouseLeave:()=>!f.get()&&W(),onDragStart:e=>{if(R&&!x){f.start({key:R.key,item:R.item,from:R.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",R.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{f.end(),_()},onClick:()=>{R&&!x&&z.current.onPick?.(R.item)}},{seams:le=[]}=Y,re=Y.zones.filter(e=>0===e.children.length),ae=d.onZoneAdd&&!x?re:[],oe=ae.map(e=>e.key).join("\n");return m(()=>{const e=h?.document;if(!e)return;const t=new Set(oe?oe.split("\n"):[]);for(const n of e.querySelectorAll(`[${P}]`))n.toggleAttribute(q,t.has(n.getAttribute(P)??""));return()=>{for(const t of e.querySelectorAll(`[${q}]`))t.removeAttribute(q)}},[h,oe,B,C,E]),/* @__PURE__ */N("div",{ref:T,className:"es-canvas-layer",children:[F||!d.onSeamAdd||x?null:le.map(e=>/* @__PURE__ */A("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */A("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>d.onSeamAdd?.(e.place),children:D.addButton({label:d.seamLabel??D.addSection})})},e.key)),ae.length?ae.map(e=>/* @__PURE__ */A("button",{type:"button",className:V?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:Z(e.box),onClick:()=>d.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */A("span",{className:"es-canvas-empty-add",children:D.addButton({label:d.zoneAddLabel??D.addBlock})})},e.key)):null,F?/* @__PURE__ */A("div",{className:"es-canvas-catch",...te}):null,V&&!re.some(e=>e.key===V.zoneKey)?/* @__PURE__ */A("div",{className:`es-canvas-line is-${V.axis}`,style:Z(V.line)}):null,
|
|
2
|
+
/* @__PURE__ */A("div",{className:"es-canvas-handle-spot",style:R?{"--es-handle-x":`${R.box.left+2}px`,"--es-handle-y":`${Math.max(R.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */A(w,{className:"es-canvas-handle-tip",side:"top",content:!R||x||F?null:R.title??D.handle({label:R.label}),children:/* @__PURE__ */N("div",{className:["es-canvas-handle",R&&!x?"is-shown":"",F?"is-dragging":""].filter(Boolean).join(" "),...ne,children:[
|
|
3
|
+
/* @__PURE__ */A("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),R?.label]})})})]})}var R=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function Q({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[f,p]=b(""),m=x(),g=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
4
|
+
return N("div",{className:"es-add",children:[a?/* @__PURE__ */N("div",{className:"es-add-at",role:"status",children:[
|
|
5
|
+
/* @__PURE__ */A("span",{children:a.label}),h(c.stop,/* @__PURE__ */A("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:a.onClear,children:/* @__PURE__ */A(D,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
6
|
+
/* @__PURE__ */A("p",{className:"es-add-hint",children:d}),
|
|
7
|
+
/* @__PURE__ */N("div",{className:"es-add-search",children:[
|
|
8
|
+
/* @__PURE__ */A(z,{size:16,"aria-hidden":"true"}),
|
|
9
|
+
/* @__PURE__ */A("input",{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value)}),f?/* @__PURE__ */A("button",{type:"button",className:"es-add-search-clear","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */A(D,{size:12,"aria-hidden":"true"})}):null]}),0===v.length?/* @__PURE__ */N("div",{className:"es-add-empty",role:"status",children:[
|
|
10
|
+
/* @__PURE__ */A("div",{className:"es-add-empty-title",children:c.nothing({query:f.trim()})}),
|
|
11
|
+
/* @__PURE__ */A("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */N("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
12
|
+
/* @__PURE__ */N("div",{className:"es-add-group-head",children:[
|
|
13
|
+
/* @__PURE__ */A("span",{className:"es-add-group-title",children:e.title}),
|
|
14
|
+
/* @__PURE__ */A("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
15
|
+
/* @__PURE__ */A("div",{className:R(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return h(l,/* @__PURE__ */N("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */A("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */A("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
16
|
+
/* @__PURE__ */A("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{Q as AddPanel,F as CanvasDragLayer,M as EMPTY_MEASURE,Y as HANDLE_GRACE_MS,L as canvasTarget,T as contains,E as gapInZone,$ as gapLine,X as measureCanvas,S as pickSource,j as seamsBetween};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-
|
|
1
|
+
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-OXYGFK2B.js";import{Tooltip as i,IconButton as t,Button as o}from"efficient-shell/ui";import{jsx as s,jsxs as l,Fragment as c}from"react/jsx-runtime";function d({icon:e,title:i,context:t,actions:o,side:d="left",onHide:a}){/* @__PURE__ */
|
|
2
2
|
return s(n,{icon:e,name:i,kind:t,actions:o||a?/* @__PURE__ */l(c,{children:[o,a?/* @__PURE__ */s(r,{side:d,onHide:a,divider:Boolean(o)}):null]}):void 0})}function r({side:n,onHide:o,divider:d=!1}){/* @__PURE__ */
|
|
3
3
|
return l(c,{children:[d?/* @__PURE__ */s("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
4
|
/* @__PURE__ */s(i,{content:"Hide panel",side:"bottom",children:/* @__PURE__ */s(t,{className:"es-insp-iconbtn","aria-label":`Hide the ${n} panel`,onClick:o,children:/* @__PURE__ */s(e,{side:n})})})]})}function a({side:n,onShow:o}){/* @__PURE__ */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{FieldSelect as e}from"./chunk-PJP46U5L.js";import{TreeSeam as n}from"./chunk-UFY6RNMT.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"./chunk-YNOZ5NXW.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{Textarea as f,Input as g,SortableList as v,ListRow as y,ContextMenu as x,tabPanelId as k,tabButtonId as w,SearchableSelect as N,Select as O}from"efficient-shell/ui";import{useRef as C,useState as j,useLayoutEffect as S,useId as D}from"react";import{jsx as I,jsxs as P}from"react/jsx-runtime";import{ChevronIcon as $,LockIcon as F,MoveUpIcon as L,MoveDownIcon as M,DuplicateIcon as T,TrashIcon as E}from"efficient-shell/icons/efficient";function z({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__ */I(f,{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__ */I(g,{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 R(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function H(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 A(e,n){return e.filter((e,l)=>l!==n)}function B(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var Y='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',K={parentId:"list",slot:"items"};function J({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:f,min:g=0,max:k,readOnly:w=!1,open:N,onOpen:O,renderItem:D,renderRow:z,canRemove:J,lockedReason:Q,fixed:G=!1,removeOnRow:U=!0,canDuplicate:V,above:W,head:X=!0}){const Z=m("fields",d).list,q=m("tree",i),_=t??Z.item,ee=!w&&!G&&("number"!=typeof k||a.length<k),ne=a.length<=g,le=e=>!!J&&!J(a[e],e),te=e=>!w&&!G&&U&&!ne&&!le(e),ae=e=>ee&&(!V||V(a[e],e)),re=(e,n)=>u?u(e,n):Z.itemName({noun:_,n:n+1}),ie=C([]),oe=C(null),[se,ce]=j(null),ue=C(null),[de,me]=j(null),[pe,he]=j("");S(()=>{const e=oe.current;if(!e)return;oe.current=null;const n=ie.current[e.index]?.querySelectorAll(Y)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=ie.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(Y)].indexOf(t),a=t;oe.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(H(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}(N,e,n);i!==N&&O(i),he(Z.moved({n:n+1,total:a.length}))},fe=e=>{ee&&(r(R(a,e,o())),z?(oe.current={index:e,nth:0,start:null,end:null},null!==N&&N>=e&&O(N+1)):O(e))},ge=e=>{te(e)&&(r(A(a,e)),N===e?O(null):null!==N&&N>e&&O(N-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===K.parentId&&n.slot===K.slot,onDrop:(e,n)=>{const l=h({...K,index:e},n);l!==e&&be(e,l)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */I(L,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<a.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */I(M,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */I(T,{size:14}),onClick:()=>(e=>{ae(e)&&(r(R(a,e+1,B(a[e]))),null!==N&&N>e&&O(N+1))})(e)}),te(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */I(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},xe=(e,n,l,t)=>{w||0===ye(e).length||me({index:e,x:n,y:l,owner:t})},ke=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
|
|
2
|
+
return P("div",{className:"es-list",children:[X?/* @__PURE__ */P("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */P("span",{className:"es-list-label",children:[l?/* @__PURE__ */I("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
|
|
4
|
+
/* @__PURE__ */I("span",{className:"es-list-count",children:a.length})]}):null,W?/* @__PURE__ */I("div",{className:"es-list-above",children:W}):null,a.length?/* @__PURE__ */P(v,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[a.map((e,l)=>{const t=ve.row({item:l,place:{...K,index:l}}),a=t.draggable&&se!==l,r=!z&&N===l,i=!w&&!G&&U&&le(l),o=["es-list-row",z?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[l>0?/* @__PURE__ */I(n,{...ve.seam({place:{...K,index:l}}),onAdd:ee?()=>fe(l):void 0,label:Z.addHere({noun:_})},`seam-${l}`):null,
|
|
5
|
+
/* @__PURE__ */I(y,{className:o,flat:!!z,active:r,draggable:t.draggable,dragHint:q.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(l,"up"===e?l-1:l+1):void 0,rowRef:e=>{ie.current[l]=e},rowProps:{...t.rowProps,draggable:a||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,ue.current=n&&!a?n:null,ce(a?l:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),xe(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 xe(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:w||G||!U?void 0:i?b(Q?Q(e,l):Z.locked,/* @__PURE__ */I("span",{className:"es-list-lock",role:"img","aria-label":Q?Q(e,l):Z.locked,children:/* @__PURE__ */I(F,{size:13})})):b(Z.deleteItem({noun:_}),/* @__PURE__ */I("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!te(l),onClick:()=>ge(l),children:"×"})),below:r?/* @__PURE__ */I("div",{className:"es-list-item",children:D(e,l,ke(l))}):void 0,children:z?/* @__PURE__ */I("div",{className:"es-list-row-main",children:z(e,l,ke(l))}):/* @__PURE__ */P("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>O(r?null:l),children:[f?/* @__PURE__ */I("span",{className:"es-list-thumb","aria-hidden":"true",children:f(e,l)}):null,
|
|
6
|
+
/* @__PURE__ */I("span",{className:"es-list-row-name",children:re(e,l)}),/* @__PURE__ */I("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */I($,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},l)]}),
|
|
8
|
+
/* @__PURE__ */I(n,{...ve.seam({place:{...K,index:a.length}})})]}):null,w||G?null:/* @__PURE__ */I("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>fe(a.length),children:Z.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */I("span",{className:"es-list-said","aria-live":"polite",children:pe}),de&&de.index<a.length?
|
|
10
|
+
/* @__PURE__ */I(x,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),children:/* @__PURE__ */I(s,{items:ye(de.index),onClose:()=>me(null)})}):null]})}var Q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function G({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=j(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
|
|
11
|
+
return I(r,{id:`${l}-group`,title:Q(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */I(V,{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 U({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=j(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return I(J,{label:Q(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>B({...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__ */I(V,{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 V(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__ */
|
|
13
|
+
return I(l,{label:Q(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */I(z,{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__ */
|
|
14
|
+
return I(l,{label:Q(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */I(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__ */
|
|
15
|
+
return I(l,{label:Q(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */I(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return I(l,{label:Q(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */I(u,{ariaLabel:Q(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__ */
|
|
17
|
+
return I(G,{...n,field:t});case"array":/* @__PURE__ */
|
|
18
|
+
return I(U,{...n,field:t});case"slot":return null}}var W=e=>t.includes(e);function X(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(W(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 Z(e){return new Map(X(e).rows.map(e=>[e.name,e.bucket]))}function q({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=D(),v=p??`es-insp${g.replace(/:/g,"")}`,y=X(e),[x,N]=j(void 0),O=i??x,C=O&&y.buckets.includes(O)?O:y.buckets[0],[S,$]=j(null),F=S&&S.panel===v&&y.rows.some(e=>e.name===S.name)?S:null,L=c&&y.buckets.length>1,M=L&&C?k(v,C):`${v}-rows`;/* @__PURE__ */
|
|
19
|
+
return P("div",{className:"es-insp",children:[L?/* @__PURE__ */I("div",{className:"es-insp-tabs",children:/* @__PURE__ */I(a,{ariaLabel:h??f.settings,activeId:C,onSelect:e=>{const n=e;void 0===i&&N(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e]})),idPrefix:v})}):null,
|
|
20
|
+
/* @__PURE__ */P("div",{className:"es-insp-rows",id:M,role:L?"tabpanel":void 0,"aria-labelledby":L&&C?w(v,C):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */I("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!L||i===C)||void 0,children:/* @__PURE__ */I(V,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:F&&F.name===e?F.index:null,onOpenItem:n=>$(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function _(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function ee({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=j(null),[u,p]=j(null),h=s&&s.against===e?s.kind:t.kindOf(e),b=l.filter(e=>!e.hideWhenEmpty||_(e.target).length>0||e.value===h),f=b.find(e=>"text"===e.target.type),v=b.find(e=>e.value===h)??f??b[0];if(!v)return null;const y="text"!==v.target.type,x=y?t.targetOf(e):e,k=_(v.target),w=k.find(e=>e.value===x),C=e=>({value:e,label:o.unavailable({value:e})}),S="select"===v.target.type&&x&&a?a(x):null,D=S?t.readFilter(e):null,$=D?S?.find(e=>e.param===D.param):void 0,F=u&&u.against===e?u.text:e,L=!y&&""!==F.trim()&&!t.isSafe(F),M=(e,l)=>{c(n=>n?{...n,against:e}:n),void 0===l?n(e):n(e,l)},T=e=>{if(!e)return M("");const n=k.find(n=>n.value===e);M(e,n?.label)},E=(e,n)=>n&&!e.some(e=>e.value===n)?[C(n),...e]:[...e],z=(e,n,l,t,a)=>{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)}if(a){const a=l.some(e=>""===e.value);/* @__PURE__ */
|
|
21
|
+
return I(N,{"aria-label":e,value:n,options:r,disabled:i,clearable:a,placeholder:l.find(e=>""===e.value)?.label,onChange:t})}/* @__PURE__ */
|
|
22
|
+
return I(O,{size:"sm","aria-label":e,value:n,options:r,readOnly:i,onChange:t})};let R;if("text"===v.target.type)R=/* @__PURE__ */I(g,{size:"sm",type:"text",className:"es-fin",invalid:L,"aria-label":o.address,placeholder:o.addressPlaceholder,value:F,readOnly:i,onChange:n=>(n=>{const l=n.trim();l?t.isSafe(n)?(p({text:n,against:l}),M(l)):p({text:n,against:e}):(p({text:n,against:""}),M(""))})(n.target.value)});else{const e="groups"===v.target.type?v.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):v.target.options.map(e=>({value:e.value,label:e.label})),n=[{value:"",label:v.target.placeholder},...E(e,x)];R=z(v.label,x,n,T,e.length>10)}/* @__PURE__ */
|
|
23
|
+
return P("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[z(o.linkType,v.value,b.map(e=>({value:e.value,label:e.label})),l=>{p(null);const t=b.find(e=>e.value===l);if(!t||"text"===t.target.type)return void c({kind:l,against:e});const a=_(t.target)[0];c({kind:l,against:a?a.value:""}),a?n(a.value,a.label):n("")},!1),R,S&&z(o.filter,D?.param??"",[{value:"",label:o.noFilter},...D&&!$?[C(D.param)]:[],...S.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return M(x,w?.label);const n=S?.find(n=>n.param===e),l=n?.values[0];l&&M(t.withFilter(x,{param:e,value:l.value}),l.label)},!1),S&&D&&z(o.value,D.value,E(($?.values??[]).map(e=>({value:e.value,label:e.label})),D.value),e=>{if(!D)return;const n=$?.values.find(n=>n.value===e);M(t.withFilter(x,{param:D.param,value:e}),n?.label)},($?.values.length??0)>10),L&&/* @__PURE__ */I("p",{className:"es-flink-error",role:"alert",children:o.unsafe}),v.hint&&/* @__PURE__ */I("p",{className:"es-flink-hint",children:v.hint}),S&&/* @__PURE__ */I("p",{className:"es-flink-hint",children:o.filterHint})]})}export{z as FieldText,q as Inspector,V as InspectorField,ee as LinkPicker,J as ListField,Z as bucketsOf,B as copyItem,R as insertAt,Q as labelOf,H as moveTo,X as planFields,A as removeAt};
|
|
@@ -0,0 +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{EaselMenuItems as l,menuLabel as r}from"./chunk-EA2HTX37.js";import{createNodeClipboard as i,nodeMenuItems as c}from"./chunk-OSPUG6S6.js";import{useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{isTypingTarget as a,framePointToHost as u}from"./chunk-ZNCEOSXO.js";import{zoneKey as d,ROOT_SLOT as p,ROOT_ID as f}from"./chunk-KRXQM65X.js";import{useState as m,useCallback as h,useRef as y,useEffect as k}from"react";import{ContextMenu as b}from"efficient-shell/ui";import{UndoIcon as v,RedoIcon as g,AddIcon as x,PasteIcon as C,SettingsIcon as w,LayersIcon as P,CopyIcon as z}from"efficient-shell/icons/efficient";import{jsx as O}from"react/jsx-runtime";function A(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 S=i(),D=/* @__PURE__ */new WeakMap;function E(e){if(e.claimsPage)return S;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=D.get(n);return t||(t=i(),D.set(n,t)),t}function K(){return E(n())}function M(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:f,slot:p,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 T(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 j(e,n,t){const o=e.canPasteAt;if(!o)return d(n.from)===t.zone?M(e,t.zone,t.index+1):null;for(const l of A(e,t)){const t=M(e,l.zone,l.index+1);if(o(n,t))return t}return null}function X(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(a(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 L(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=T(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:j(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const s=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=T(n,i,l),k=A(n,o),b=d.held,v=b&&!p?j(n,b,o):null,g=!n.readOnly,x=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)}):[];return c({title:a,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(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,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(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:x,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function R(e){const n=!e.readOnly,o=[];n&&e.history.hasPast&&o.push({label:"Undo",icon:/* @__PURE__ */O(v,{}),shortcut:"⌘Z",onClick:e.history.back}),n&&e.history.hasFuture&&o.push({label:"Redo",icon:/* @__PURE__ */O(g,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const l=n?[{label:"Add section",icon:/* @__PURE__ */O(x,{}),onClick:e.openAddSection}]:[],r=e.nodeOps.held,i=M(e,t,e.sectionBand().cap);if(n&&r&&(e.canPasteAt?e.canPasteAt(r,i):d(r.from)===t)){const n=i;l.push({label:`Paste ${r.label}`,icon:/* @__PURE__ */O(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const c=[o,l,[{label:e.pageSettingsLabel??"Page settings",icon:/* @__PURE__ */O(w,{}),onClick:e.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */O(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function Y(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=[];l&&(i.push({label:"Copy",icon:/* @__PURE__ */O(z,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),i.push({label:"Cut",icon:/* @__PURE__ */O(z,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),i.push({label:"Paste",icon:/* @__PURE__ */O(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const c=[i,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function U(e){return e.shiftKey}function V(e,n){const[t,l]=m(null),r=h(()=>l(null),[]);o(null!==t,r);const i=y(e);i.current=e;const c=h(e=>{const n=i.current,t=n.keys;if(!t)return;const o=X(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;k(()=>{if(!a)return;const e=e=>c(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,c]),s(n,"keydown",c);const d=h(n=>{if(U(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?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null: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]);s(n,"contextmenu",t=>{if(U(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=u(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),s(n,"mousedown",r),s(n,"scroll",r,{on:"window"});return{onEditorContextMenu:d,menu:t?/* @__PURE__ */O(B,{host:e,target:t,onClose:r}):null,closeMenu:r}}function B({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?Y(e,n.el):R(e);return 0===o.length?null:/* @__PURE__ */O(b,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":r(o),children:/* @__PURE__ */O(l,{items:o,onClose:t})})}export{S as EASEL_NODE_CLIPBOARD,A as ancestorChain,E as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,X as nodeShortcut,R as pageMenuItems,j as pastePlace,L as runNodeShortcut,Y as textMenuItems,K as useNodeClipboard,V as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={accent:"var(--accent-600, var(--submit-bg))",accentTint:"color-mix(in srgb, var(--es-accent) 10%, var(--surface))",accentTintStrong:"color-mix(in srgb, var(--es-accent) 18%, var(--surface))",accentLine:"color-mix(in srgb, var(--es-accent) 32%, var(--surface))",accentText:"color-mix(in srgb, var(--es-accent) 65%, var(--ink-strongest))",accentRing:"var(--rosh-focus-ring)",accentShadow:"color-mix(in srgb, var(--es-accent) 35%, transparent)",onAccent:"var(--status-on-solid)",appBg:"var(--surface-sunken)",previewBg:"var(--surface-raised)",panel:"var(--surface)",raised:"var(--surface)",topbarBg:"var(--surface)",frameBg:"#ffffff",hover:"var(--surface-raised)",hatch:"color-mix(in srgb, var(--ink-strongest) 2%, transparent)",addcardVeil:"color-mix(in srgb, var(--surface-sunken) 66%, transparent)",fieldBg:"var(--surface)",trackBg:"var(--surface-raised)",inputBorder:"var(--line-strong)",fieldText:"var(--ink-strong)",fieldPlaceholder:"var(--ink-faintest)",knob:"var(--surface)",text:"var(--ink-strongest)",textStrong:"var(--ink-strongest)",textSecondary:"var(--ink)",muted:"var(--ink-faint)",icon:"var(--ink-faint)",disabled:"var(--ink-faintest)",divider:"var(--line)",line:"var(--line)",btnBorder:"var(--line-strong)",btnText:"var(--ink)",chipBg:"var(--surface-raised)",chipFg:"var(--ink-faint)",brandSquare:"var(--ink-strongest)",deviceBorder:"var(--line)",toastBg:"var(--status-draft-solid)",toggleOff:"var(--line-strong)",scrollbar:"var(--line-strong)",scrollbarHover:"var(--ink-faintest)",danger:"var(--status-danger-soft-ink)",dangerStrong:"var(--status-danger-soft-ink)",dangerTint:"var(--status-danger-soft)",warning:"var(--status-pending-soft-ink)",previewTint:"var(--status-pending-soft)",success:"var(--status-success-soft-ink)",panelRadius:"var(--radius-xl)",rowRadius:"var(--radius-card, var(--radius-lg))",fieldRadius:"var(--radius-control, var(--radius-md))",panelGap:12,space2:2,space4:4,space8:8,space12:12,space16:16,space32:32,panelShadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",topbarShadow:"0 1px 3px rgba(0, 0, 0, 0.06)",raisedShadow:"0 1px 2px rgba(16, 24, 40, 0.1)",font:"var(--font-sans)"},a={previewBg:"var(--surface)",trackBg:"var(--surface)",chipBg:"var(--surface)"},r=[e.space2,e.space4,e.space8,e.space12,e.space16,e.space32],s={accent:"--es-accent",accentTint:"--es-accent-tint",accentTintStrong:"--es-accent-tint-strong",accentLine:"--es-accent-line",accentText:"--es-accent-text",accentRing:"--es-accent-ring",accentShadow:"--es-accent-shadow",onAccent:"--es-on-accent",appBg:"--es-app-bg",previewBg:"--es-preview-bg",panel:"--es-panel",raised:"--es-raised",topbarBg:"--es-topbar-bg",frameBg:"--es-frame-bg",hover:"--es-hover",hatch:"--es-hatch",addcardVeil:"--es-addcard-veil",fieldBg:"--es-field-bg",trackBg:"--es-track-bg",inputBorder:"--es-input-border",fieldText:"--es-field-text",fieldPlaceholder:"--es-field-placeholder",knob:"--es-knob",text:"--es-text",textStrong:"--es-text-strong",textSecondary:"--es-text-secondary",muted:"--es-muted",icon:"--es-icon",disabled:"--es-disabled",divider:"--es-divider",line:"--es-line",btnBorder:"--es-btn-border",btnText:"--es-btn-text",chipBg:"--es-chip-bg",chipFg:"--es-chip-fg",brandSquare:"--es-brand-square",deviceBorder:"--es-device-border",toastBg:"--es-toast-bg",toggleOff:"--es-toggle-off",scrollbar:"--es-scrollbar",scrollbarHover:"--es-scrollbar-hover",danger:"--es-danger",dangerStrong:"--es-danger-strong",dangerTint:"--es-danger-tint",warning:"--es-warning",previewTint:"--es-preview-tint",success:"--es-success",panelRadius:"--es-panel-radius",rowRadius:"--es-row-radius",fieldRadius:"--es-field-radius",panelGap:"--es-panel-gap",space2:"--es-space-2",space4:"--es-space-4",space8:"--es-space-8",space12:"--es-space-12",space16:"--es-space-16",space32:"--es-space-32",panelShadow:"--es-panel-shadow",topbarShadow:"--es-topbar-shadow",raisedShadow:"--es-raised-shadow",font:"--es-font"};export{r as SPACING_SCALE,s as shellCssVars,a as shellDarkTokens,e as shellTokens};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-ZV6OYSZ7.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-2JIWFFXA.js";import{usePartBridge as v}from"./chunk-IJGHMGG4.js";import{useSectionOps as x}from"./chunk-LC7N3GZS.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-HGTPLCTQ.js";import{PageEditGuardNotices as z}from"./chunk-35Q5HMJZ.js";import{useScreenDocument as B}from"./chunk-ONRYLR2D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-V7U33NF2.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as I}from"./chunk-PT6NPMWV.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-BSSKAEFF.js";import{MediaSidePanel as A}from"./chunk-PBVC2VGH.js";import{useScreenSaveSwitch as M,useScreenNodeKeys as R,useScreenPinned as j,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as V,useScreenDevices as H,useScreenPickFollowsSelection as F,useScreenLeftView as D,useScreenAdd as G,SELECTION_MODE as U,sameInspectorMode as W,useScreenBridges as Y,useScreenBlockRules as J,useScreenBlockLook as K,useScreenStorageNamespace as _,useScreenNotify as X,useScreenCanvasHead as q,isSlotMode as Z,useScreenStyleClipboard as Q,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-LACBURK5.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 Be,TreeRowAction as Ce,TreeSeam as Oe}from"./chunk-UFY6RNMT.js";import{toItemSelector as $e,useNodeOps as Ne}from"./chunk-D2BCHTQR.js";import{LayersIcon as Ie,MediaIcon as Pe}from"./chunk-4VJATVVR.js";import{saveIndicator as Te}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ae,TopBarRail as Me,TopBarCluster as Re,EaselIconButton as je,TopBarDivider as Le,DeviceSwitch as Ee,InspectorIconButton as Ve,PanelResizeHandle as He,MAX_PANEL_W as Fe,MIN_PANEL_W as De,panelWidthVars as Ge,SaveState as Ue,SaveStateToggle as We}from"./chunk-OXYGFK2B.js";import{useWords as Ye}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Je}from"./chunk-6HHHBBSY.js";import{createDragSession as Ke,useTreeDrag as _e,gapToMoveIndex as Xe}from"./chunk-67GNT6PF.js";import{useCanvasFrame as qe,BLOCK_SELECTOR as Ze,useCanvasEvent as Qe}from"./chunk-PAELDYYS.js";import{zoneKey as en,ROOT_ID as nn,ROOT_SLOT as tn,parseZoneKey as on,DataError as rn}from"./chunk-KRXQM65X.js";import{useRef as ln,useMemo as sn,useState as dn,useEffect as cn,useCallback as an,useLayoutEffect as pn,Fragment as un}from"react";import{Tooltip as fn,Button as hn,toast as mn}from"efficient-shell/ui";import{UndoIcon as gn,RedoIcon as yn,TrashIcon as kn,EyeOffIcon as Sn,EyeIcon as vn,DuplicateIcon as xn}from"efficient-shell/icons/efficient";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Bn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(Ue,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return bn(Ue,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Te(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(hn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return wn(zn,o?{children:[
|
|
4
|
+
/* @__PURE__ */bn(We,{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(Ue,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */bn(Ue,{tone:l,label:s,role:"status"}),d]})}function Cn({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 Te=ye(),{target:Ue,docId:We,capabilities:Pn,currentSlug:Tn,siteId:An,onPublish:Mn,saveState:Rn,saveConflict:jn,retrySave:Ln,toggleAutoSave:En,readOnly:Vn,readOnlyReason:Hn=null}=B(),Fn=M(),Dn=R(),{mediaEditing:Gn,hasEditGuard:Un,hasPinnedChrome:Wn}=Pn,{appState:Yn,dispatch:Jn,history:Kn,selectedItem:_n,getSelectorForId:Xn,config:qn}=ve(e=>e),Zn=j(),{first:Qn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=Zn,it=rt(Qn),lt=e=>oe(Zn,e),st=e=>re(Zn,e),dt="node"===Zn.firstRow,ct=Zn.band??null,at=Ye("screen",Se),pt=L()??`/${Tn}`,ut=E(),ft=V(),ht=x({readOnly:Vn}),mt=x({readOnly:Vn,foldIntoHistory:!0}),gt=ln(null),yt=xe(),kt=sn(()=>({...ht,select:e=>{gt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yt.config;gt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,yt]),St=Yn.ui,vt=St.leftSideBarVisible,xt=St.rightSideBarVisible,{options:bt,widths:wt,initial:zt,fluid:Bt,fit:Ct}=H(),[Ot,$t]=dn(zt),Nt=he(),It=Gn&&null!==Nt,Pt=me(),Tt=ge();F(_n?.props.id);const{read:At,write:Mt,forSelection:Rt}=D(),[jt,Lt]=dn(At);cn(()=>{Mt(jt)},[jt]);const[Et,Vt]=dn(0),Ht=ln(null),Ft=ln(null),Dt=qe(Ft,{readySelector:Ze}),Gt=f(Ft);h(Ft,Dt);const[Ut,Wt]=dn(!1),Yt=ln(!1),Jt=ln(!1),[Kt,_t]=dn(null),Xt=G(),qt=e=>_t(null===e?null:{zone:le,index:e}),[Zt,Qt]=dn([]),[eo,no]=dn(U),to="puck"===eo.kind,oo=Ut&&!Kt&&Xt.railTarget?Xt.railTarget(Yn.data,{node:_n??null,mode:eo}):null,ro=oo?{zone:en(oo),index:oo.index}:null,io=Kt??ro,lo=io&&io.zone===le?io.index:null,so=t(eo,_n?.props.id),[co,ao]=dn(null);cn(()=>{co&&(o(),ao(null))},[co]);const po=ln(Xn);po.current=Xn;const uo=an((e,{scroll:n})=>{Lt(n=>Rt(e,n)),n&&ao(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=po.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Do(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),fo=ln(null);cn(()=>{const e=fo.current;fo.current=null;const n=null==_n?.props.id?null:String(_n.props.id);no(e&&e.id===n?e.mode:rt(_n?.type)??U);const t=_n?.props.id,o=gt.current;if(gt.current=null,!t)return;const i=Xn(t);uo(String(t),{scroll:!r(o,i??null,le)})},[_n?.props.id,uo]);const ho=an(e=>{no(n=>W(n,e)?n:e),Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Jn]),mo=ln(()=>{});mo.current=(e,n)=>{const t=e?Ar(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==_n?.props.id?null:String(_n.props.id);no(e=>W(e,n)?e:n),o!==r&&(fo.current={id:o,mode:n},kt.select(e))};const go=an((e,n)=>mo.current(e,n),[]),yo={kind:eo.kind,mode:eo,open:ho,show:e=>no(e),reveal:()=>{xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:go},ko=Y(yo,{data:Yn.data,selected:_n??null,zoneOf:e=>Xn(e)?.zone,readOnly:Boolean(Vn),select:e=>{no(U),kt.select({index:e})},replace:(e,n)=>kt.replaceComponent(le,e,n),scrollTo:e=>ri(e)},{device:Ot,refreshes:Et},{setView:Lt,reveal:()=>{vt||Jn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),So=ko.pinnedSource??!1,vo=ko.resolveLeftView?ko.resolveLeftView(jt,It):"media"===jt&&It?jt:"sections",xo=J(),{isLockedBlock:bo,duplicateBlocked:wo,nestDepth:zo,newSectionNode:Bo,canAddTo:Co,blockIsOffered:Oo}=xo,$o=K(),{labelAtLevel:No,Icon:Io,useProducts:Po}=$o,To=$o.rowName?(e,n,t)=>$o.rowName(e,n,t):void 0,Ao=an(e=>{Jn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),uo(e,{scroll:!0})},[Jn,uo]),{selectNode:Mo,openPartId:Ro}=v({mode:eo,setMode:no,onOpenPart:Ao}),[jo,Lo]=dn(null);ke(null!==jo,()=>Lo(null));const Eo=y(_()),Vo=Eo.collapsed,Ho=Eo.panelWidths,[Fo,Do]=dn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Vo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});cn(()=>{try{window.localStorage.setItem(Vo,JSON.stringify([...Fo]))}catch{}},[Fo]);const[Go,Uo]=dn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Ho);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}}});cn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ho,JSON.stringify(Go))}catch{}},300);return()=>clearTimeout(e)},[Go]);const Wo=an((e,n)=>Uo(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Yo=an(e=>Wo("left",e),[Wo]),Jo=an(e=>Wo("right",e),[Wo]),Ko=e=>Fo.has(e),_o=e=>Do(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Xo=ln(!1),qo=ln(null);cn(()=>{if(Xo.current&&!Ut){const e=qo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ft.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),qo.current=null}Xo.current=Ut},[Ut]),cn(()=>{if(!Ut||!Gt)return;const e=e=>{"Escape"===e.key&&fi()};return Gt.addEventListener("keydown",e),()=>Gt.removeEventListener("keydown",e)},[Ut,Gt]),ke(Ut,()=>fi()),cn(()=>{!vt&&Ut&&(Wt(!1),_t(null),Yt.current=!1)},[vt]),cn(()=>{if(!Pt)return Jt.current&&Jn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Jt.current=!1);Ut&&(Wt(!1),_t(null),Jt.current=Yt.current,Yt.current=!1),vt||(Jt.current=!0,Jn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Pt]),cn(()=>{!vt&&Pt&&(Jt.current=!1,Tt())},[vt]),cn(()=>{if(!Pt||!Gt)return;const e=e=>{"Escape"===e.key&&Tt()};return Gt.addEventListener("keydown",e),()=>Gt.removeEventListener("keydown",e)},[Pt,Gt]),ke(null!==Pt,()=>Tt());const Zo=X(),Qo=(e,n="success")=>{Zo?Zo(e,"error"===n?"error":"info"):"error"===n?mn.error(e,{duration:3200,sound:!1}):mn.success(e,{duration:1900,sound:!1})},er=ln(null),[nr,tr]=dn(0),[or,rr]=dn(0),ir=q(),lr=ln(null),sr=e=>Math.max(0,e.clientHeight-(lr.current?.offsetHeight??0));cn(()=>{const e=er.current;if(!e)return;const n=()=>{tr(e.clientWidth),rr(sr(e))};n();const t=new ResizeObserver(n);return t.observe(e),lr.current&&t.observe(lr.current),()=>t.disconnect()},[]),pn(()=>{er.current&&(tr(er.current.clientWidth),rr(sr(er.current)))},[Go,vt,xt]);const dr=Ot===Bt?nr>0?nr:wt[Bt]:wt[Ot],cr=nr>0?Math.min(nr/dr,"shrink"===Ct?1:2):1,ar=dr*cr,pr=nr>0&&ar>nr+1,ur={width:ar,height:or||"100%",flex:"none",position:"relative"},fr={width:dr,height:or?or/cr:"100%",maxHeight:"none",transform:1!==cr?`scale(${cr})`:void 0,transformOrigin:"top left"},hr=()=>Jn({type:"setUi",ui:{leftSideBarVisible:!vt}}),mr=()=>Jn({type:"setUi",ui:{rightSideBarVisible:!xt}}),gr=e=>{Ut&&(Wt(!1),_t(null),Yt.current=!1,vt&&jt===e)||Pt&&(Jt.current=!1,Tt(),vt&&jt===e)||(vt&&jt===e?hr():(Lt(e),vt||Jn({type:"setUi",ui:{leftSideBarVisible:!0}})))},yr=()=>{C(Te,{accept:"image/*",title:"Media library"})},kr=()=>{no(U),kt.select(null),u()},Sr=()=>{no(it??U),xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},vr=Yn.data.content??[],xr=()=>{const e=vr.findIndex(lt),n=vr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:vr.length}},br=qn,wr=xo.stripCopy,zr=e=>i(e,wr),Br=b(),Cr=Ne({data:Yn.data,config:br,readOnly:Boolean(Vn),clipboard:Br,strip:wr?e=>wr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==nn||e.slot!==tn)return{min:0,max:n-1};const{floor:t,cap:o}=xr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&no(U);const t=void 0===n||"node"===n?.kind?n:null;kt.commitDocument(e,t)}}),Or=e=>qn.components[e]?.label??e,$r=an(e=>qn.components[e]?.defaultProps??{},[qn]),Nr=e=>No(e,"section",Or(e)),Ir=e=>l({type:e.type,props:e.props??{}},Nr(e.type),To),{nodeAddresses:Pr,zoneItems:Tr}=sn(()=>{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(qn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vr,le,0),{nodeAddresses:e,zoneItems:n}},[vr,qn]),Ar=an(e=>Tr.get(e)??[],[Tr]),Mr=e=>{const n=Pr.get(e);return n?Ar(n.zone)[n.index]:void 0},Rr=e=>ie(xo,qn,e),jr=e=>{if(!xo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Mr(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}},Lr=(()=>{if(!Z(eo))return null;const e=`${eo.nodeId}:${eo.slot}`;return jr(e)?.slot.panel===eo.kind?e:null})(),Er=ln(null);cn(()=>{const e=Er.current;if(Er.current=null,!Lr||!Z(eo))return;const n=eo.nodeId;uo(n,{scroll:e!==Lr}),Do(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[eo]);const Vr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Pr.get(e);n&&(n.zone===le?ii(n.index):Ri(n.zone,n.index,e,Mr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Lr!==i&&(Er.current=i),go(null,r),xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}}),ri(o)},Hr=(e,n,t)=>{const o=`${e}:${n}`;if(Do(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;Lr!==o&&(Er.current=o);go(null,{kind:t,nodeId:e,slot:n})},Fr=(e,n,t)=>{if(Vn||!xo.moveSlot)return;const o=Mr(e),r=o?Rr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Xe(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=xo.moveSlot(e,n,s);"string"==typeof d&&Hr(e,d,i.panel)},Dr=Po(),Gr=sn(()=>{const e=/* @__PURE__ */new Map;for(const n of Dr??[])e.set(n.slug,n.name);return e},[Dr]),Ur=e=>s(e,Or,$o.plainText,e=>Gr.get(e),$o.rowName),Wr=(e,n)=>{const t=qn.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 $o.renamePropOf?$o.renamePropOf(e,o,i):i},Yr=(e,n,t,o)=>{if(!(!Vn&&jo?.zone===e&&jo.index===n))return;const r=(t,o)=>{Lo(null),o&&((e,n,t)=>{const o=Ar(e)[n];if(!o)return;const r=Wr(o,e);r&&kt.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)},Jr=n(Q()),Kr=Jr.scope({target:Ue,siteId:An,docId:We}),_r=qn,Xr=(e,n)=>n===le?Nr(e):Or(e),qr=(e,n,t)=>{const o=Jr.plan(Kr,t,Xr(t.type,e),_r);o&&(o.changed&&kt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Qo(o.message))},Zr=w({nodesIn:Ar,nodeAt:(e,n)=>Ar(e)[n]??null,labelOf:(e,n)=>n===le?Nr(e):Or(e),renamePropOf:Wr,beginRename:(e,n)=>Lo({zone:e,index:n}),history:{hasPast:Kn.hasPast,hasFuture:Kn.hasFuture,back:()=>Kn.back(),forward:()=>Kn.forward()},openAddSection:()=>{kt.select(null),pi(null)},openPageSettings:()=>{kt.select(null),no(U)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Vn),collapseAll:()=>Do(new Set(Ar(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)=>nl(e,n),menuRows:ko.menuRows,isLocked:e=>bo(e.type),duplicateBlocked:e=>wo(Yn.data,e),permits:e=>se(qn,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:xr,openAddInside:(e,n)=>{e===le?ii(n):kt.select({zone:e,index:n}),pi(null)},locate:e=>Pr.get(e)??null,rowNameOf:(e,n)=>n===le?Ir(e):Ur(e),selectAt:(e,n,t,o)=>{e===le?ii(n):Ri(e,n,t,o??"")},slotRung:e=>{const n=jr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Vr(n.node,n.slot,!1)}:null},style:{held:()=>O(Kr),canCopy:e=>Jr.rows(_r,e).some(e=>!1!==e.counted),copy:(e,n)=>Jr.copy(Kr,e,Xr(e.type,n),_r),paste:(e,n,t)=>qr(e,n,t)},keys:Dn?{target:Gt,selected:()=>{const e=Yn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Br.get(),readOnly:Boolean(Vn),onDone:({done:e,name:n})=>{"copied"===e&&Qo(at.copied({name:n}))}}:void 0},Dt),Qr=ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});cn(()=>{Qr.current={copy:(e,n)=>Jr.copy(Kr,e,Xr(e.type,n),_r),paste:qr,at:()=>{const e=Yn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Ar(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Vn)}});const ei=an(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))},[]);cn(()=>{if(!Gt)return;const e=e=>ei(e);return Gt.addEventListener("keydown",e),()=>Gt.removeEventListener("keydown",e)},[ei,Gt]),Qe(Dt,"keydown",ei);const ni=vr.map(e=>e.props.id).join("|");cn(()=>{const e=Dt?.document??null,n=Dt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Qt(e=>e.length?[]:e);const n=vr.findIndex(st),t=n>=0?n:vr.length,o=n=>{const t=vr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ze)].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()}},[Dt,ni,Ot,cr,vt,xt,_n?.props.id]);const ti=Dt?.document??null,oi=Dt?.window??null;cn(()=>{const e=Ht.current;if(!e||!ti||!oi)return;const n=[],t=()=>{const n=ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&oi.scrollTo({left:oi.scrollX,top:oi.scrollY+t,behavior:"instant"}),!0};return Ht.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ti,oi]);const ri=e=>{ko.holdCanvasOn?ko.holdCanvasOn(e):a(e)},ii=e=>{no(U),kt.select({index:e}),ko.sectionPressed?.(vr[e]);const n=vr[e]?.props?.id;n&&ri(n)},li=e=>{const{floor:n,cap:t}=xr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=_n&&eo.kind!==it?.kind?vr.findIndex(e=>e.props.id===_n.props.id):-1;return o(r>=0?r+1:t)},si=(e,n)=>{const{floor:t,cap:o}=xr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(kt.reorderComponent(le,e,i),kt.select({index:i}),{moved:!0,dest:i})},di=(e,n,t,o)=>{no(U),kt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Qo(`Added “${t}” section`)},ci=(e,n)=>{const t=li(n),o=Bo(e,{nodeDefaults:$r,newNodeId:fe,sectionLabel:Nr,blockIsOffered:Oo}),r=o?kt.insertNode(le,t,o):kt.insertSection(e,t);return di(t,r,Nr(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(qn,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},ai=(e,n,t)=>{const o=li(t),r=kt.insertNode(le,o,n);return di(o,r,e),o},pi=e=>ui(le,e),ui=(e,n)=>{qo.current=document.activeElement??null,Pt&&(Yt.current=Jt.current,Jt.current=!1,Tt()),_t(null===n?null:{zone:e,index:n}),Wt(!0),vt||(Yt.current=!0,Jn({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{Wt(!1),_t(null),Yt.current&&Jn({type:"setUi",ui:{leftSideBarVisible:!1}}),Yt.current=!1},hi=(e,n,t)=>{if("section"===e.kind)kt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;kt.insertNode(n,t,zr(e.template.node))}no(U),kt.select({index:t,zone:n})},mi=(e,n)=>$o.rowName?n?lt(e)?$o.rowName(e,"section",at.header):st(e)?$o.rowName(e,"section",at.footer):tt(e.type)?$o.rowName(e,"section",Or(e.type)):Ir(e):Ur(e):n?Nr(e.type):Or(e.type),gi=e=>n=>{e()},yi=()=>ko.editPinnedSource?.(),ki=(e,n,t)=>{if(Vn)return null;const o=Ar(e)[n];return o&&!se(qn,o.type).delete?null:/* @__PURE__ */bn(Ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Ar(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(kn,{size:15})})},Si=e=>$o.rowPreview?.(e)||void 0,vi=e=>$o.rowMarks?.(e)??void 0,xi=(e,n,t)=>$o.rowActions?.(e,n,t)??null,bi=(e,n,t,o)=>{if(Vn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return bn(Ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>zi(e,n,t),children:/* @__PURE__ */bn(r?Sn:vn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},wi=e=>{const n=Nr(vr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return xl(le,e,()=>pi(e),t)},zi=(e,n,t)=>{kt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Bi=e=>ae(qn,e),Ci=e=>ce(qn,e),Oi=e=>xo.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)}],$i=e=>xo.slotsOf?Oi(e).flatMap(e=>e.kids):Ci(e),Ni=e=>Boolean(xo.slotsOf)&&Rr(e).some(e=>e.rung),Ii=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Pi=(e,n,t)=>{const o=ue(qn,e.type,n)&&(t||$i(e).length>0||Ni(e));return{collapsible:o,folded:o&&Ko(String(e.props.id))}},Ti=(e,n,t)=>Oi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Pi(e,r,t(e.type)).collapsible?[String(e.props.id),...Ti(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ai=e=>$i(e).length>0||Ni(e)||Boolean(Co(e.type)),Mi=e=>Boolean(Co(e)),Ri=(e,n,t,o)=>{if(no(U),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),kt.select({index:n,zone:e}),a(t)}else kt.select({index:n,zone:e}),ri(t)},ji=(e,n,t,o,r)=>{const i=`${e}:${n}`;kt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),kt.select({index:o,zone:i})}):kt.select({index:o,zone:i})},Li=(e,n,t)=>{kt.insertComponent(e,n,t),no(U),kt.select({index:t,zone:e})},Ei=ln(/* @__PURE__ */new Set);cn(()=>{vr.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($r)).forEach((e,t)=>mt.seedChild(o,t,n.childType,e))})},[vr,mt,$r]);const Vi=ln(/* @__PURE__ */new Set);cn(()=>{vr.forEach((n,t)=>{const o=n.props.id;if(Vi.current.has(o))return;const r=e(n,Bi(n.type));Vi.current.add(o),r&&mt.replaceComponent(le,t,{...n,props:r})})},[vr,mt]),ee(mt,qn);const Hi=vr.findIndex(st),Fi=Hi>=0?vr[Hi]:null,Di=dt?vr.findIndex(lt):-1,Gi=Di>=0?vr[Di]:null,Ui=vr.find(e=>e.type===et)??null,Wi=vr.find(e=>e.type===nt)??null,Yi=Hi>=0?Hi:vr.length,Ji=[];vr.forEach(e=>{st(e)||(Ai(e)&&Ji.push(String(e.props.id)),Ji.push(...Ti(e,1,Mi)))}),Fi&&(Ji.push(String(Fi.props.id)),Ji.push(...Ti(Fi,1,Mi)));const Ki=Ji.length>0&&Ji.every(e=>Fo.has(e)),_i=e=>{const n=$o.blockRowName(e,Or);return $o.rowName?$o.rowName(e,"block",n):n},Xi=(e,n,t,o)=>{const r=Ar(e)[t];if(!r)return;const i={...on(e),index:t},l={...on(n),index:Math.min(Math.max(o,0),Ar(n).length)},s=Xe(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof rn))throw e}},qi=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 Bi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Zi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Pr.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=vr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},el=(e,n,t)=>{if(e.rung){const t=Mr(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 ol(e.add,n);const o=en(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<=Ar(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=xr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ar(o).length)return!1;if(e.zone===o)return!0;const l=Fi&&!Zn.lastIsOpen?String(Fi.props.id):null;return(!l||Zi(e.zone)!==l&&Zi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ar(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pr.get(i),s=l?Ar(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&qi(r).has(n))return!1;const d=Co(s.type,zo(Yn?.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?.(Ar(n),r))})(e.zone,o,e.index,t)},nl=(e,n)=>{const t=en(e.from);if(t===en(n))return!0;const o=e.node;return el({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},tl=e=>{const n=e.slice(0,e.indexOf(":")),t=Pr.get(n),o=t?Ar(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,zo(Yn?.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:Or(r.spec.childType)}]:[]),l=jr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:mi(o,t.zone===le)}},ol=(e,n)=>{const t=en(n);if("block"!==e.kind){if(Qi(t))return n.index>=0&&n.index<=Ar(t).length;if(t!==le)return!1;const{floor:e,cap:o}=xr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=tl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Ar(t))},rl=(e,n)=>{e.rung?Fr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Qi(en(n)))return void hi(e,en(n),n.index);if("section"===e.kind)return void ci(e.type,n.index);if("template"===e.kind)return void ai(e.template.name,zr(e.template.node),n.index);const t=en(n),o=tl(t);o&&(o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Li(t,e.type,n.index))})(e.add,n):e.zone===le?si(e.index,n.index):Xi(e.zone,en(n),e.index,n.index)},[il]=dn(()=>Ke()),ll=_e({keyOf:e=>e.id,readOnly:Boolean(Vn),session:il,canDrop:el,onDrop:rl,onStep:(e,n)=>{e.rung?Fr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Nr(vr[e]?.type??""),o=si(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}=xr();Qo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Xi(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),sl=an(e=>{const{floor:n,cap:t}=xr(),o=[];for(const r of e.nodes){const e=en(r.place),i=Ar(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||bo(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?Nr(i.type):Ur(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(tl(en(e.list))?.choices.length)||Boolean(Qi(en(e.list))))}},[Yn.data]),dl=e=>{no(U),kt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},cl=ne(),al=()=>({data:Yn.data,device:Ot,ops:kt,inspector:yo}),pl=cl?.model,ul=sn(()=>pl?e=>pl(e,sl(e),al()):sl,[pl,sl,Ot]),fl=cl?.measure,hl=fl?(e,n)=>fl(e,n,al()):void 0,ml=cl?.canDrop,gl=ml?(e,n)=>ml(e,n,el,al()):el,yl=cl?.drop,kl=yl?(e,n)=>yl(e,n,rl,al()):rl,Sl=cl?.pick,vl=Sl?e=>Sl(e,dl,al()):dl,xl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Vn?{}:ll.seam({place:{...on(e),index:n}}),onAdd:Vn?void 0:t,label:o},`seam:${e}:${n}`),bl={rowClick:gi,isCollapsed:Ko,toggleCollapse:_o},wl=e=>{const n=String(e.props.id),t=vr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Ar(o),i=Ko(n),l=Or(e.type),s=$o.rowName?$o.rowName(e,"section",l):l,d=e=>xl(o,e,()=>ui(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return wn(zn,{children:[
|
|
16
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:e.type,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(t),nameSlot:Yr(le,t,n,s),selected:so===n,actions:xi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:gi(()=>ii(t))},fold:{open:!i,label:"section",onToggle:()=>_o(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ir(n),l=Ai(n),s=l&&Ko(r),c=()=>Ri(o,t,r,e.type),{rowProps:a,...p}=ll.row({item:{id:r,zone:o,index:t,type:n.type},place:{...on(o),index:t}},{"data-node-id":r,onClick:gi(c)});/* @__PURE__ */
|
|
17
|
+
return wn(un,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:c,nameSlot:Yr(o,t,r,i),selected:so===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>_o(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(o,t,i),xi(n,o,t),bi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},zl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ll.dragging,d=!Ko(l)&&s?.rung?.nodeId!==i,c={...on(l),index:0},a=s&&!s.rung&&el(s,c)?c:void 0,p=()=>Vr(e,n,!0),{rowProps:u,...f}=ll.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(xo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:gi(p)}),h=Vn?null:xo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return wn(un,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Lr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>_o(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Ce,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Vn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Hr(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(kn,{size:15}):/* @__PURE__ */bn(xn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},Bl=(e,n)=>{const t=Oi(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=Ii(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(tl(c)?.choices.length),p=(e,n)=>a?xl(e,n,()=>ui(e,n),"Add block here"):xl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),{collapsible:i,folded:s}=Pi(n,l,Mi(n.type)),d=String(n.props.id),c=_i(n),a=()=>Ri(t,o,d,e.type),{rowProps:u,...f}=ll.row({item:{id:d,zone:t,index:o,type:n.type},place:{...on(t),index:o}},{"data-node-id":d,onClick:gi(a)});/* @__PURE__ */
|
|
22
|
+
return wn(un,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:c,preview:Si(n),marks:vi(n),onSelect:a,nameSlot:Yr(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>_o(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(t,o,c),xi(n,t,o),bi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:Bl(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?zl(e,t.rung,r++,o,u):/* @__PURE__ */bn(un,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=zo(Yn?.data,e.type,String(e.props.id)),o=Oi(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=Ii(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)?()=>ji(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>ui(n,t):void 0;return xl(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=so===String(n.props.id),i=Ur(n),l=String(n.props.id),{collapsible:d,folded:c}=Pi(n,s,Mi(n.type)),a=Bi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...on(p),index:Ar(p).length}:void 0,f=ll.dragging,h=u&&f&&el(f,u)?u:void 0,g=()=>Ri(t,o,l,e.type),{rowProps:y,...k}=ll.row({item:{id:l,zone:t,index:o,type:n.type},place:{...on(t),index:o},into:h,canDrag:!bo(n.type)},{"data-node-id":l,onClick:gi(g)});/* @__PURE__ */
|
|
25
|
+
return wn(un,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:g,nameSlot:Yr(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>_o(l)}:void 0,actions:bo(n.type)?xi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[ki(t,o,i),xi(n,t,o),bi(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:()=>ji(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?zl(e,o.rung,i++,r,k):/* @__PURE__ */bn(un,{children:k},o.slot??"")})})},Ol=(()=>{if(!_n||!to)return null;const e=String(_n.type),n=String(_n.props.id),t=Co(e,zo(Yn?.data,e,n));if(!t||"footer"===t.source)return null;const o=vr.some(e=>String(e.props?.id)===n),r=Array.isArray(_n.props[t.slot])?_n.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Or(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:mi(_n,o),choices:i,onPick:o=>{t.spec?ji(n,t.slot,o,r.length,e):Li(`${n}:${t.slot}`,o,r.length)}}})(),$l=io&&io.zone!==le&&!Qi(io.zone)?io.zone:null,Nl=!0===Xt.blocksFirst,Il=$l?tl($l):Nl&&io?null:Ol,Pl=Boolean(Kt&&$l)||Nl&&Boolean(Il&&Il.choices.length>0),Tl=Ut||null!==Pt,Al=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:vt&&!Tl&&vo===e.id,onSelect:()=>gr(e.id)}:e,Ml=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Ut,onSelect:()=>Ut?fi():pi(null)},...(ko.railLead??[]).map(Al),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(Ie,{}),active:vt&&!Tl&&"sections"===vo,onSelect:()=>gr("sections")},...(ko.railTrail??[]).map(Al)];It?Ml.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Pe,{}),active:vt&&!Ut&&(null!==Pt||"media"===vo),onSelect:()=>gr("media")}):Gn&&Ml.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Pe,{}),onSelect:yr});const Rl=[...ko.railLead??[],...ko.railTrail??[]].find(e=>"panel"in e&&e.id===vo),jl=Boolean(ct?.foldable)&&!So,Ll=ct?.label??(Un?at.pageSections:at.templateSections),El=jl&&Ko(Nn),Vl=/* @__PURE__ */wn(zn,{children:[vr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=so===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=ko.hasOwnRows?.(e)??!1,l=Ai(e)||i,s=l&&Ko(r),{rowProps:d,...c}=ll.row({item:{id:r,zone:le,index:n,type:e.type},place:{...on(le),index:n}},{"data-node-id":r,onClick:gi(()=>ii(n))});/* @__PURE__ */
|
|
28
|
+
return wn(un,{children:[n>0&&wi(n),
|
|
29
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:e.type,size:13}),name:Ir(e),preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Yr(le,n,r,Ir(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>_o(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(le,n,Ir(e)),xi(e,le,n),bi(le,n,e,Ir(e))]}),rowProps:d}),Ai(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),ko.partRows?.(e,bl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:ko.ownRows?.(e,n,bl)})]},String(e.props.id??n))}),!So&&Yi>0&&wi(Yi),ct?.addAtEnd&&!So&&!Vn&&/* @__PURE__ */bn(N,{small:!0,label:at.addSection,blocked:null,onAdd:()=>pi(Yi)})]}),Hl=(e,n,t)=>{const o=String(e.props.id),r=$i(e).length>0||Ni(e)||Boolean(Co(e.type)),i=r&&Ko(o),l="header"===t?at.header:at.footer,s=$o.rowName?$o.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return wn(zn,{children:[
|
|
31
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:t,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Yr(le,n,o,s),selected:so===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>_o(o)}:void 0,actions:xi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:gi(()=>ii(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:Bl(e,1)})]})};return(ko.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */bn(te,{target:Dt,children:/* @__PURE__ */wn("div",{ref:Ft,className:"sf-editor es-editor",style:Ge(Go),onContextMenu:Zr.onEditorContextMenu,...m(Te),children:[
|
|
33
|
+
/* @__PURE__ */wn(Ae,{children:[
|
|
34
|
+
/* @__PURE__ */bn(Me,{items:Ml,ariaLabel:"Left panel views"}),
|
|
35
|
+
/* @__PURE__ */wn(Re,{children:[
|
|
36
|
+
/* @__PURE__ */bn(je,{label:"Undo",disabled:Boolean(Vn)||!Kn.hasPast,onClick:()=>Kn.back(),children:/* @__PURE__ */bn(gn,{})}),
|
|
37
|
+
/* @__PURE__ */bn(je,{label:"Redo",disabled:Boolean(Vn)||!Kn.hasFuture,onClick:()=>Kn.forward(),children:/* @__PURE__ */bn(yn,{})}),
|
|
38
|
+
/* @__PURE__ */bn(Le,{}),
|
|
39
|
+
/* @__PURE__ */bn(Ee,{devices:bt,value:Ot,onChange:$t})]}),
|
|
40
|
+
/* @__PURE__ */wn(Re,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */bn(Bn,{saveState:Rn,notSaving:Boolean(Vn)||null!=jn,readOnlyReason:Hn,toggle:Fn,onToggle:En,onRetry:Ln}),ko.barLead?.(),
|
|
42
|
+
/* @__PURE__ */bn(fn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(hn,{variant:"secondary",onClick:()=>{Ht.current=(()=>{const e=Dt?.document;if(!e)return null;const n=vr.findIndex(st),t=n>=0?n:vr.length;let o=null;for(let n=0;n<t;n++){const t=vr[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=_n?.props?.id??vr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Vt(e=>e+1)},children:"Refresh"})}),ko.barTrail?.(),ko.barMain?ko.barMain():/* @__PURE__ */bn(hn,{variant:"primary",disabled:null!==Hn,onClick:()=>{Mn(Yn.data)},children:at.done})]})]}),
|
|
43
|
+
/* @__PURE__ */bn(z,{}),
|
|
44
|
+
/* @__PURE__ */wn("div",{className:"sf-body",children:[vt?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
+
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Ut?/* @__PURE__ */bn(I,{blocks:Il,blocksOnly:Pl,at:Kt?{label:(e=>{const n=Qi(e.zone);if(n)return at.add.addingTo({name:$o.rowName?mi(n,!0):Or(n.type)});if(e.zone===le){const n=vr[e.index];return n&&!st(n)?at.add.addingBefore({name:mi(n,!0)}):at.add.addingAtEnd}const t=tl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(Kt),onClear:()=>_t(null)}:void 0,onAdd:e=>{const n=io,t=(e,n)=>{Kt&&_t({zone:e,index:n})};if(n&&"block"!==e.kind&&Qi(n.zone))return hi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===lo)return void ci(e);const n=ci(e,lo);Kt&&qt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===lo)return void ai(e,n);const t=ai(e,n,lo);Kt&&qt(t+1)})(e.template.name,zr(e.template.node));if(n&&n.zone!==le){const o=tl(n.zone);if(!o)return;return o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Li(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ol?.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:il,siteWide:ko.addPanelRow?.(fi),onClose:fi,onHide:hr,readOnly:Boolean(Vn)}):Pt&&Nt?
|
|
46
|
+
/* @__PURE__ */bn(A,{panel:Nt,pick:Pt,onHide:hr}):Rl?Rl.panel({onHide:hr,notify:Qo}):"media"===vo&&Nt?/* @__PURE__ */bn(A,{panel:Nt,pick:null,onHide:hr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
+
/* @__PURE__ */bn(P,{icon:/* @__PURE__ */bn(Ie,{}),title:"Layers",context:pt,actions:Ji.length>0?/* @__PURE__ */bn(Ve,{label:Ki?"Expand all sections":"Collapse all sections",onClick:()=>Do(e=>{const n=new Set(Ji);return Ki?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ji])}),children:/* @__PURE__ */bn(Cn,{expand:Ki})}):void 0,onHide:hr}),
|
|
48
|
+
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"page",size:13}),name:at.pageSettings,onSelect:kr,selected:!_n&&to,rowProps:{onClick:gi(kr)}}),Ui&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
+
/* @__PURE__ */bn(Be,{children:at.header}),wl(Ui)]}),!So&&Wn&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
+
/* @__PURE__ */bn(Be,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"header",size:13}),name:at.header,onSelect:Sr,selected:eo.kind===it?.kind,rowProps:{onClick:gi(Sr)}})]}),!So&&Gi&&Hl(Gi,Di,"header"),!So&&!jl&&/* @__PURE__ */bn(Be,{children:Ll}),jl?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
+
/* @__PURE__ */bn(be,{icon:null,name:Ll,fold:{open:!El,label:Ll,onToggle:()=>_o(Nn)}}),!El&&/* @__PURE__ */bn(we,{children:Vl})]}):Vl,Wn&&/* @__PURE__ */bn(Be,{children:at.footer}),Fi&&Hl(Fi,Hi,"footer"),!So&&!Fi&&Wn&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"footer",size:13}),name:at.footer,onSelect:yi,rowProps:{onClick:gi(yi),title:"Edit the site footer"}}),Wi&&wl(Wi),ko.treeFoot?.()]})]})}),
|
|
53
|
+
/* @__PURE__ */bn(He,{side:"left",width:Go.left,min:De,max:Fe,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Yo})]}):/* @__PURE__ */bn(T,{side:"left",onShow:hr}),
|
|
54
|
+
/* @__PURE__ */wn("div",{ref:er,className:"sf-center sf-scroll","data-sf-canvas-head":ir?"":void 0,style:{overflowX:pr?"auto":"hidden",overflowY:"hidden"},children:[ir&&/* @__PURE__ */bn("div",{ref:lr,className:"sf-canvas-head",children:/* @__PURE__ */bn(ir,{device:Ot})}),
|
|
55
|
+
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:ur,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Ot===Bt?"":`sf-frame--${Ot}`),style:fr,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
+
/* @__PURE__ */bn(ut,{},Et),
|
|
57
|
+
/* @__PURE__ */bn(Je,{canvas:Dt,session:il,model:ul,measure:hl,canDrop:gl,onDrop:kl,onPick:vl,onZoneAdd:e=>{const n=en(e),t=jr(n);t&&Vr(t.node,t.slot,!1),ui(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Vn),revision:Yn.data}),Zt.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:Zt.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:()=>pi(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))})]})})})]}),xt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
+
/* @__PURE__ */bn(g,{value:{selectChild:Ri,addChild:ji,childRowName:Ur,blockRowName:_i},children:/* @__PURE__ */bn(ft,{mode:eo,onOpenWebsiteSettings:ko.openSettings??(()=>{}),onOpenSiteStyles:ko.openStyles,onSelectNode:Mo,onNotify:Qo,onHidePanel:mr,nodeActions:_n?se(qn,_n.type):In})}),
|
|
63
|
+
/* @__PURE__ */bn(He,{side:"right",width:Go.right,min:De,max:Fe,defaultWidth:k.right,label:"Resize settings panel",onResize:Jo})]}):
|
|
64
|
+
/* @__PURE__ */bn(T,{side:"right",onShow:mr})]}),Zr.menu]})}))}export{Pn as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-LC7N3GZS.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-LACBURK5.js";import{useEasel as p}from"./chunk-PYCLHOSA.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=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}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);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=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -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-PYCLHOSA.js";import{Inspector as i}from"./chunk-E2L2XVRX.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},L={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function P(){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 I(n){return(N().useStandaloneBridges??v)(n)}function R(n,e){(N().useDocumentPass??b)(n,e)}function T(){return N().blockRules??L}function F(){return N().blockLook??O}function V(){return N().devices??j}function E(){return N().leftView??w}function H(){return N().pinned??S}function K(){return N().saveSwitch??!0}function W(n){e(!0===N().pickFollowsSelection,n)}function X(){return N().add??h}function Y(){return N().storageNamespace||void 0}function Q(){return N().styleClipboard??null}function Z(){return N().nodeKeys??!0}function q(){return N().notify??null}function z(){return N().Canvas??C}function J(){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??P}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,X as useScreenAdd,F as useScreenBlockLook,T as useScreenBlockRules,B as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,_ as useScreenCanvasTarget,V as useScreenDevices,A as useScreenDocumentLabel,R as useScreenDocumentPass,nn as useScreenInspectorPanel,E as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,x as useScreenOwnerName,N as useScreenParts,W as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,Y as useScreenStorageNamespace,Q as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-LACBURK5.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,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,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as s}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as s}from"./chunk-LACBURK5.js";import{DropdownMenu as r}from"efficient-shell/ui";import{jsxs as t,Fragment as l,jsx as i}from"react/jsx-runtime";function c({choices:c,onPick:n}){const{Icon:a}=s(),o=e(c).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */t(l,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */i("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */i("span",{className:"sf-chip",children:/* @__PURE__ */i(a,{type:e.type,size:13})}),onSelect:()=>n(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return i(r,{align:"start",triggerClassName:"sf-add-card",items:o,trigger:/* @__PURE__ */t(l,{children:[
|
|
4
4
|
/* @__PURE__ */i("span",{className:"sf-plus sf-plus--sm",children:"+"}),"Add block"]})})}export{c as AddBlockRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_NODE_MENU_WORDS as e}from"./chunk-WK3AFPXY.js";import{TrashIcon as n,EyeIcon as o,EyeOffIcon as t,RenameIcon as i,PasteIcon as c,CopyIcon as l,MoveDownIcon as s,MoveUpIcon as p,DuplicateIcon as a,AddIcon as r,LayersIcon as u}from"efficient-shell/icons/efficient";import{jsx as h}from"react/jsx-runtime";function d(){let e=null;const n=/* @__PURE__ */new Set;return{get:()=>e,set(o){e=o;for(const e of[...n])e()},subscribe:e=>(n.add(e),()=>n.delete(e))}}var m={layer:{icon:/* @__PURE__ */h(u,{})},addInside:{icon:/* @__PURE__ */h(r,{})},duplicate:{icon:/* @__PURE__ */h(a,{})},moveUp:{icon:/* @__PURE__ */h(p,{})},moveDown:{icon:/* @__PURE__ */h(s,{})},copy:{icon:/* @__PURE__ */h(l,{}),shortcut:"⌘C"},cut:{icon:/* @__PURE__ */h(l,{}),shortcut:"⌘X"},paste:{icon:/* @__PURE__ */h(c,{}),shortcut:"⌘V"},rename:{icon:/* @__PURE__ */h(i,{})},hide:{icon:/* @__PURE__ */h(t,{})},show:{icon:/* @__PURE__ */h(o,{})},upLevel:{},delete:{icon:/* @__PURE__ */h(n,{}),danger:!0}};function f(n){const{actions:o,rows:t={},extras:i={},words:c=e}=n,l=e=>({...m[e],label:c[e],...t[e]}),s=(e,n,o)=>{const t=l(e),i={label:o??t.label??e,onClick:n};return t.icon&&(i.icon=t.icon),t.shortcut&&(i.shortcut=t.shortcut),t.danger&&(i.danger=!0),i},p=()=>{const e=l("layer"),o={label:e.label??c.layer,onClick:()=>{},children:n.layer.items};return e.icon&&(o.icon=e.icon),o},a=[],r=[],u=[],h=[],d=!!n.layer&&n.layer.items.length>1;if(d&&"pick"===(n.layer.group??"pick")&&a.push(p()),o.addInside&&r.push(s("addInside",o.addInside)),o.duplicate&&r.push(s("duplicate",o.duplicate)),o.moveUp&&r.push(s("moveUp",o.moveUp)),o.moveDown&&r.push(s("moveDown",o.moveDown)),o.copy&&r.push(s("copy",o.copy)),o.cut&&r.push(s("cut",o.cut)),o.paste){const e=l("paste").label??c.paste;r.push(s("paste",o.paste.run,c.pasteNamed({paste:e,label:o.paste.label})))}o.rename&&u.push(s("rename",o.rename)),o.hide&&u.push(o.hide.hidden?s("show",o.hide.run):s("hide",o.hide.run)),d&&"change"===n.layer.group&&u.push(p()),o.upLevel&&u.push(s("upLevel",o.upLevel)),o.delete&&h.push(s("delete",o.delete)),a.push(...i.pick??[]),r.push(...i.make??[]),u.push(...i.change??[]),h.push(...i.remove??[]);const f=[a,r,n.style??[],u,h].filter(e=>e.length>0),g=a.length+r.length+u.length+h.length===0,v=[{label:n.title,header:!0,onClick:()=>{}}];return g&&n.pinnedLine&&v.push({label:n.pinnedLine,header:!0,onClick:()=>{}}),f.forEach((e,o)=>{(o>0||g&&n.pinnedLine)&&v.push({label:"—",onClick:()=>{}}),v.push(...e)}),v}export{d as createNodeClipboard,f as nodeMenuItems};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{DEFAULT_NOTICE_WORDS as e,DEFAULT_CHROME_WORDS as n}from"./chunk-ZJEBF4NB.js";import{holderOf as i,describeAge as a,nameOrSomeone as s}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as t}from"./chunk-RE4LP46F.js";import{EaselRail as l}from"./chunk-MJM6SFD3.js";import{DEFAULT_RAIL_WORDS as r}from"./chunk-2OAZYSWJ.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as v,Switch as f,ResizeHandle as k,Button as p,Banner as b}from"efficient-shell/ui";import{PanelLeftIcon as g,PanelRightIcon as y,MediaIcon as N,ImageIcon as w}from"efficient-shell/icons/efficient";function C({children:e}){/* @__PURE__ */
|
|
2
|
+
return c("div",{className:"es-topbar",children:e})}function O({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
|
+
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function x(){/* @__PURE__ */
|
|
4
|
+
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function z({items:e,ariaLabel:n,onWords:i}){const a=o("rail",r);/* @__PURE__ */
|
|
5
|
+
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(l,{items:e,ariaLabel:n??a.label,orientation:"row",onLabelsShown:i})})}function B({label:e,onClick:n,disabled:i,state:a,buttonRef:s,children:t}){/* @__PURE__ */
|
|
6
|
+
return c(h,{content:e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":a?"active"===a:void 0,className:"es-iconbtn",disabled:i,onClick:n,children:t})})}function R({devices:e,value:i,onChange:a,ariaLabel:s}){const t=o("chrome",n);/* @__PURE__ */
|
|
7
|
+
return c(v,{className:"es-devseg",size:"sm",label:s??t.device,value:i,onChange:e=>{e!==i&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var L={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function $({tone:e,label:n,counting:i,waitMs:a,ringRef:s,role:t}){/* @__PURE__ */
|
|
8
|
+
return d("span",{className:`es-savestate ${L[e]}`,role:t,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:s,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function W({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
|
+
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(f,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}function j({side:e,width:i,min:a,max:s,defaultWidth:t,label:l,onResize:r}){const d=o("chrome",n);/* @__PURE__ */
|
|
10
|
+
return c(k,{side:e,width:i,min:a,max:s,defaultWidth:t,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function M({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
11
|
+
return d("div",{className:"es-insp-head",children:[
|
|
12
|
+
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
13
|
+
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
14
|
+
/* @__PURE__ */c("h2",{className:"es-insp-name",children:n}),
|
|
15
|
+
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function S({label:e,title:n,hasPopup:i,onClick:a,disabled:s,danger:t,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
16
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:t?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:s,onClick:a,children:o})})}function P({name:e,onSelect:i,label:a,inline:s}){const t=o("chrome",n),l=a??t.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(p,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":t.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:i,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return s?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function F({context:e,pick:i,onCancel:a,onHide:s,side:t="left"}){const l=o("chrome",n),r=s?/* @__PURE__ */c(S,{label:l.hidePanelLabel({side:t}),title:l.hidePanel,onClick:s,children:/* @__PURE__ */c("left"===t?g:y,{size:16})}):null;if(!i)/* @__PURE__ */
|
|
17
|
+
return c(M,{icon:/* @__PURE__ */c(N,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[i.kind];/* @__PURE__ */
|
|
18
|
+
return c(M,{icon:/* @__PURE__ */c(w,{size:15}),name:l.mediaChoose({kind:m}),kind:i.field?l.mediaFor({field:i.field}):e,actions:/* @__PURE__ */d(u,{children:[
|
|
19
|
+
/* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(p,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
|
|
20
|
+
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function T(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Y={notice:e,lock:t};function H(e,n,t,l=Y){const r=l.notice,o=i(e),c={kind:"reload",label:r.reload};if(n){const e=a(n.secondsAgo,l.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:t,when:e}):r.savedByOther({name:s(n.savedBy,l.lock),noun:t,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=s(o.name,l.lock),u=a(o.secondsSinceSeen,l.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:t,when:a(o.secondsSinceHeld,l.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:t,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:t}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function J({access:n,conflict:i,noun:a,onTakeOver:s,onViewReadOnly:l,onReload:r}){const d=H(n,i,a,{notice:o("notice",e),lock:o("lock",t)});if(!d)return null;const u={reload:r,"take-over":s,"take-back":s,"view-read-only":l},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(p,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(p,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
21
|
+
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(b,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var Z={left:288,right:320},q=220,A=560;function D(e){return Math.min(560,Math.max(220,Math.round(e)))}function E(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function I(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{Z as DEFAULT_PANEL_W,R as DeviceSwitch,B as EaselIconButton,C as EaselTopBar,J as EditNotice,M as InspectorHead,S as InspectorIconButton,P as InspectorUpLevel,A as MAX_PANEL_W,q as MIN_PANEL_W,F as MediaPanelHead,j as PanelResizeHandle,$ as SaveState,W as SaveStateToggle,O as TopBarCluster,x as TopBarDivider,z as TopBarRail,D as clampPanelWidth,H as editNotice,T as mediaPickKind,E as panelWidthVars,I as setPanelWidthVars};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-LACBURK5.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-OXYGFK2B.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -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-BSSKAEFF.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-LACBURK5.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as f}from"./chunk-PYCLHOSA.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-6HHHBBSY.js";import{useState as h,useEffect as y,useMemo as b}from"react";import{AddIcon as j}from"efficient-shell/icons/efficient";import{jsx as g,jsxs as B,Fragment as $}from"react/jsx-runtime";var O=e=>`section:${e}`,H=e=>`block:${e}`,v=e=>`template:${e}`;function A({blocks:A,blocksOnly:x,at:L,onAdd:R,itemFor:S,session:C,siteWide:F,onClose:I,onHide:V,readOnly:N}){const Y=f(e=>e.config),D=p(),{labelAtLevel:E,categoryLabel:K,firstSection:P,Icon:T,Thumbnail:w}=D,{blockIsOffered:z}=m(),M=u("screen",d).add,Q=l(),[W,Z]=h([]);y(()=>{let t=!1;const o=e=>z(e,Q);return s(Q).list().then(n=>{if(t)return;const i=Y.components;Z(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Y,Q]);const G=b(()=>t(Y,D),[Y]),J=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */g(w,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:M.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=b(()=>{const e=[];if(A&&A.choices.length>0&&a(A.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${M.inside({name:A.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:H(e.type),label:e.label,icon:/* @__PURE__ */g(T,{type:e.type,size:18}),title:M.tile({name:e.label})}))})}),x)return e;const t=o(G,P);t&&e.push({key:"start",title:M.startBlank,tiles:[J(t)]}),W.length>0&&e.push({key:"templates",title:M.templates,tiles:W.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */g(w,{type:e.node.type}),keywords:[(t=e.node.type,E(t,"section",Y.components[t]?.label??t)),e.node.type]};var t})});const s=n(G,P);for(const t of Object.keys(Y.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Y,t,K),tiles:o.map(J)})}return e},[A,x,W,G,Y,M]),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=W.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return B($,{children:[
|
|
3
|
+
/* @__PURE__ */g(r,{icon:/* @__PURE__ */g(j,{size:15}),title:M.title,context:x?M.contextBlocks:M.contextAll,actions:/* @__PURE__ */g(c,{label:M.done,description:M.doneDescription,onClick:I}),onHide:V}),
|
|
4
|
+
/* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */g(k,{groups:U,session:C,itemFor:e=>S(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&R(t)},at:L,hint:x?M.hintBlocks:M.hint,searchLabel:x?M.searchBlocks:M.searchSections,readOnly:N}),F&&!x?F:null]})]})}export{A as AddSidePanel,H as blockKey,O as sectionKey,v as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{CopyStyleIcon as e,PasteStyleIcon as n}from"efficient-shell/icons/efficient";import{jsx as o}from"react/jsx-runtime";var r="__styleKind";function c(t,e){return t[r]=e,t}function i(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function u(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return s.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var s=/* @__PURE__ */new Set(["choice","select","radio"]);function l(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[r]?e[r]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:i(e.type,e.options.map(t=>t?.value))}function a(t){return null!=t&&""!==t}function p(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function f(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function d(t,e,n){const[o,...r]=e,c={...t};if(0===r.length)return void 0===n?delete c[o]:c[o]=n,c;const i=c[o],u=d(i&&"object"==typeof i?i:{},r,n);return 0===Object.keys(u).length?delete c[o]:c[o]=u,c}var y=t=>t.join("."),h="editor-shell:style-clipboard",g=null,m=!1,v=/* @__PURE__ */new Set;function S(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function b(){if(!m){m=!0;try{const t=S()?.getItem(h);t&&(g=JSON.parse(t))}catch{g=null}}}function k(t){b(),g={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(e=>{const n=p(t.props,e.path);return{path:[...e.path],kind:e.kind,counted:!1!==e.counted,value:a(n)?f(n):void 0}})};try{S()?.setItem(h,JSON.stringify(g))}catch{}return v.forEach(t=>t()),g}function N(t){return b(),g&&g.scope===t?g:null}function C(t){return v.add(t),()=>{v.delete(t)}}function j(){g=null,m=!0;try{S()?.removeItem(h)}catch{}v.forEach(t=>t())}function w(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=u(t.kind),r=u(e.kind);return!(!o||!r||o.control!==r.control)&&(!a(t.value)||r.values.includes(String(t.value)))}function O(t,e){const n=t.sourceType===e.type,o=new Map(t.rows.map(t=>[y(t.path),t]));let r=e.props,c=0,i=!1;for(const t of e.rows){const e=o.get(y(t.path));if(!e)continue;if(!w(e,t,n))continue;const u=p(r,t.path),s=void 0===e.value?void 0:f(e.value);JSON.stringify(a(u)?u:void 0)!==JSON.stringify(s)&&(r=d(r,t.path,s),i=!0),!1!==t.counted&&(c+=1)}return{props:r,pasted:c,changed:i}}function E(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var J="⌥⌘C",K="⌥⌘V";function T(r){const c=r.words??t,i=[];return r.canCopy&&i.push({label:c.copy,icon:/* @__PURE__ */o(e,{}),shortcut:"⌥⌘C",onClick:r.onCopy}),r.held&&i.push({label:c.paste({source:r.held.sourceLabel}),icon:/* @__PURE__ */o(n,{}),shortcut:"⌥⌘V",onClick:r.onPaste}),i}function x(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{J as COPY_STYLE_SHORTCUT,K as PASTE_STYLE_SHORTCUT,r as STYLE_KIND,i as choiceKind,j as clearStyle,k as copyStyle,l as fieldKind,N as heldStyle,E as pasteMessage,O as planPaste,T as styleMenuItems,x as styleShortcut,C as subscribeStyle,c as withStyleKind};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-PWZOS45R.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-
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-PWZOS45R.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"]),S=[c,p,i];function k(t){return`site:${t??""}`}function g(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 v(t){const n=t,r=o(t);return S.some(t=>t in n||r&&t in r)}function L(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)||v(o)||"slot"!==o.type&&c.push({path:[t],kind:g(o),counted:"mobile"!==n(o)?.tier}));return c}function d(t,o,n,r,e){a({scope:n,type:r.type,label:e,rows:t(o,r),props:r.props})}function F(t,o,n,r,e){const s=l(n);if(!s)return null;const c=m(s,{type:r.type,rows:t(o,r),props:r.props});return{...c,message:y(c,s.sourceLabel,e)}}function O(t,o,n,r){d(L,t,o,n,r)}function P(t,o,n,r){return F(L,t,o,n,r)}var R={scope:t=>k(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,r)=>O(r,t,o,n),plan:(t,o,n,r)=>P(r,t,o,n)};function Z(t){if(!t)return R;const o=t.rows,n=o?(t,n)=>o(t,n):L;return{scope:t.scope??R.scope,rows:(t,o)=>n(t,o),copy:t.copy??((t,o,r,e)=>d(n,e,t,o,r)),plan:t.plan??((t,o,r,e)=>F(n,e,t,o,r))}}export{O as copyNodeStyle,L as nodeStyleRows,P as planNodePaste,g as shopFieldKind,k as siteStyleScope,Z as styleClipboardOf};
|