efficient-easel 10.1.0 → 10.2.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 +6 -0
- package/dist/canvas-typing-CJodefPO.d.ts +478 -0
- package/dist/{chunk-CQGCGRDI.js → chunk-74ZFATLG.js} +1 -1
- package/dist/{chunk-76YU5ZS7.js → chunk-7O6MDCDU.js} +5 -5
- package/dist/{chunk-YHJDAJAD.js → chunk-A5OEGP7B.js} +4 -4
- package/dist/{chunk-76DVL36A.js → chunk-ERA3XM2U.js} +1 -1
- package/dist/chunk-FJ3ZJJ5Z.js +57 -0
- package/dist/chunk-ICN6COBK.js +5 -0
- package/dist/{chunk-WQASXLXS.js → chunk-IL6QCPO6.js} +1 -1
- package/dist/{chunk-M3MCCGPN.js → chunk-IZ2QRXSE.js} +1 -1
- package/dist/{chunk-XF2AIO46.js → chunk-JSPZU7X2.js} +1 -1
- package/dist/{chunk-ACUQNEHP.js → chunk-M32O2WRM.js} +10 -10
- package/dist/{chunk-M6F6LS3H.js → chunk-OGH6CC3E.js} +1 -1
- package/dist/{chunk-SL7JKLTD.js → chunk-OWK7DGWG.js} +1 -1
- package/dist/{chunk-KKUZLRP4.js → chunk-TROOTMAD.js} +1 -1
- package/dist/{chunk-4GMKP2AZ.js → chunk-YMEN4KVE.js} +1 -1
- package/dist/copy/index.d.ts +20 -399
- package/dist/copy/index.js +17 -15
- package/dist/easel/index.d.ts +11 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +2 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/catalogue.d.ts +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.d.ts +3 -3
- package/dist/text-styles/index.js +33 -33
- package/dist/{types-C97TAUKi.d.ts → types-Dkx1VAIQ.d.ts} +1 -1
- package/dist/{words-CRYvAiHX.d.ts → words-gIDCeRv3.d.ts} +1 -0
- package/package.json +1 -1
- package/dist/canvas-typing-Cnvlsh_V.d.ts +0 -69
- package/dist/chunk-YCBD64P4.js +0 -5
- package/dist/chunk-ZRNSJGUW.js +0 -57
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return
|
|
8
|
-
return
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
return
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
return
|
|
19
|
-
return
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
return
|
|
22
|
-
return
|
|
23
|
-
return
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
return
|
|
27
|
-
return
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
return
|
|
31
|
-
return
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
1
|
+
import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-ZAOM6PFH.js";import{FieldSlider as i}from"../chunk-XWFH2NHZ.js";import{FieldSelect as a}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{ChevronIcon as g,TrashIcon as k,BoldIcon as y,ItalicIcon as b,CaseLowerIcon as x,CaseCapitalizedIcon as w,CaseUpperIcon as N,CaseNormalIcon as S}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as z,Fragment as M}from"react/jsx-runtime";var O=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],A=["heading","body"],j=7,F={heading:3,body:5},E={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},W={size:E,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:E},H=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function L(e=({kind:e,n:n})=>H(e,n)){return A.flatMap(n=>Array.from({length:F[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function B(e,n,t=j){return e.filter(e=>e.kind===n).length<t}function D(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function I(e){const n=D(e.id,e.kind);return void 0!==n&&n<=F[e.kind]}function R(e,n,t={}){const{max:s=j,name:i=({kind:e,n:n})=>H(e,n),make:a}=t;if(!B(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(D(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=a?a(n,r):{id:`${n}-${c}`,kind:n,name:i({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function T(e,n,t={}){const{name:s=({kind:e,n:n})=>H(e,n)}=t,i=e.find(e=>e.id===n);if(!i||I(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function V(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of A){const s=D(n,t);if(void 0===s)continue;let i;for(const n of e){const e=n.kind===t?D(n.id,t):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:n})}return i?.style}}function X(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function Y(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function Z(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function q(e,n,t,s={}){const i=n.find(n=>n.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:i,size:a,weight:Z(e.weight??400,t)})}var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:s,colours:i,label:a,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),k=f(null),y=f(null),b=h(),x=void 0!==t&&i.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=k.current?.ownerDocument;if(!e)return;const n=e=>{k.current&&!k.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */C("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
|
+
/* @__PURE__ */C("div",{className:"es-ts-top",children:[
|
|
3
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:a}),
|
|
4
|
+
/* @__PURE__ */z("span",{className:"es-ts-colour-read",children:s?e(s):l})]}),
|
|
5
|
+
/* @__PURE__ */C("div",{className:"es-ts-swatches",role:"group","aria-label":a,children:[i.map(n=>/* @__PURE__ */z(d,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */z(c,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:u,onClick:()=>o(n.key)})},n.key)),
|
|
6
|
+
/* @__PURE__ */z(d,{content:r,children:/* @__PURE__ */z(c,{ref:y,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */z(n,{id:b,value:s??"",onChange:e=>o(e),label:a,readOnly:u,onClose:()=>{g(!1),y.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:i=[],settings:a=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:y=null,onOpenChange:b,onAdd:x,rowActions:w,onRemove:N,max:S=j,readOnly:M=!1}){const F=l("textStyles",s),E=h(),[W,H]=m(y),L=void 0!==u?u:W,D=e=>{void 0===u&&H(e),b?.(e)},V=new Set(o),Z=O.filter(e=>a.includes(e)),G=f(null),[P,_]=m(null);p(()=>{if(!P||!G.current)return;const e=[...G.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===P.id),n=e?e.querySelector(".es-ts-row"):G.current.querySelector(`.es-ts-add[data-ts-kind="${P.kind}"]`);n?.focus(),_(null)},[P]);/* @__PURE__ */
|
|
7
|
+
return z("div",{className:"es-ts",ref:G,children:A.map(s=>{const a=e.filter(e=>e.kind===s),l=`${E}-${s}`,o=!B(e,s,S),u=!M&&!o;/* @__PURE__ */
|
|
8
|
+
return C("section",{className:"es-ts-section","aria-labelledby":l,children:[
|
|
9
|
+
/* @__PURE__ */z("div",{className:"es-ts-group",id:l,children:F.groups[s]}),a.map(s=>{const a=L===s.id,l={...d?.(s)??{},...s.values},o=t.find(e=>e.value===l.font),u=`${E}-open-${s.id}`,m=w?.(s),f=null!=m&&!1!==m,h=Boolean(N)&&!M&&!I(s),p={fontFamily:o?.family,fontSize:`${Y(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
|
|
10
|
+
return C(v,{children:[
|
|
11
|
+
/* @__PURE__ */C("div",{className:"es-ts-item","data-ts-id":s.id,children:[
|
|
12
|
+
/* @__PURE__ */C("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?u:void 0,onClick:()=>D(a?null:s.id),children:[
|
|
13
|
+
/* @__PURE__ */z("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */z(g,{size:12})}),
|
|
14
|
+
/* @__PURE__ */z("span",{className:"es-ts-name",style:p,children:s.name}),
|
|
15
|
+
/* @__PURE__ */z("span",{className:"es-ts-meta",children:q(l,t,F,{autoSize:V.has("size")&&void 0===s.values.size})})]}),h||f?/* @__PURE__ */C("div",{className:"es-ts-actions",children:[h?r(F.remove,/* @__PURE__ */z("button",{type:"button",className:"es-ts-del","aria-label":F.removeNamed({name:s.name}),onClick:()=>(t=>{if(M||!N)return;const s=T(e,t.id,{name:F.styleName});if(!s)return;const i=e.filter(e=>e.kind===t.kind),a=i[i.indexOf(t)+1];L===t.id&&D(null),n(s.styles),N(s.removed),_({id:a?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */z(k,{size:14,"aria-hidden":"true"})})):null,f?m:null]}):null]}),a?/* @__PURE__ */z("div",{className:"es-ts-open",id:u,children:/* @__PURE__ */z(J,{style:s,values:l,fonts:t,colours:i,settings:Z,autoSet:V,sample:c??F.sample,words:F,readOnly:M,set:t=>n(X(e,s.id,t))})}):null]},s.id)}),r(!M&&o?F.full({kind:s,max:S}):void 0,/* @__PURE__ */C("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:M,"aria-disabled":!(M||!o)||void 0,"aria-describedby":!M&&o?`${E}-full-${s}`:void 0,onClick:()=>{u&&(t=>{if(M)return;const s=R(e,t,{max:S,name:F.styleName,make:x});s&&n(s.styles)})(s)},children:[
|
|
16
|
+
/* @__PURE__ */z("span",{className:"es-ts-add-word",children:F.add[s]}),
|
|
17
|
+
/* @__PURE__ */z("span",{className:"es-ts-count",children:F.count({n:a.length,max:S})})]})),M||!o?null:/* @__PURE__ */z("span",{id:`${E}-full-${s}`,className:"es-vh",children:F.full({kind:s,max:S})})]},s)})})}var U={none:S,upper:N,capitalize:w,lower:x},K={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function J({style:e,values:n,fonts:s,colours:a,settings:l,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,a),g=e=>"largestSize"===e||o.has(e),k=e=>g(e)?h[e]:n[e],x=k("size"),w=k("lineSpacing"),N=k("letterSpacing"),S=g("letterCase")?h.letterCase:n.letterCase,O={fontFamily:p?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===N?void 0:`${N}px`,color:v,textTransform:S?K[S]:void 0},$=e=>{const t=W[e],s=g(e);/* @__PURE__ */
|
|
18
|
+
return z("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */z(i,{label:c.settings[e],value:h[e],onChange:n=>f({[e]:n}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:s?void 0:n[e],auto:s?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
|
|
19
|
+
return C(M,{children:[
|
|
20
|
+
/* @__PURE__ */z("div",{className:"es-ts-preview",style:O,"aria-label":c.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
21
|
+
return z(Q,{value:h.font,fonts:s,words:c,readOnly:m,set:f},t);case"color":/* @__PURE__ */
|
|
22
|
+
return z(ee,{value:h.color,hex:v,colours:a,words:c,readOnly:m,set:f},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==p?.italic;/* @__PURE__ */
|
|
23
|
+
return C("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
24
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:c.settings.emphasis}),
|
|
25
|
+
/* @__PURE__ */C("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */z(y,{size:16})})),m||s?r(c.italic,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */z(b,{size:16})})):/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */z(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
26
|
+
return z(ne,{value:h.letterCase??n.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:f},t);case"largestSize":return"heading"===e.kind?$(t):null;default:return $(t)}})]})}function Q({value:e,fonts:n,words:t,readOnly:s,set:i}){const l=h();/* @__PURE__ */
|
|
27
|
+
return C("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
28
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
29
|
+
/* @__PURE__ */z(a,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>i({font:e}),ariaLabelledBy:l,readOnly:s})]})}function ee({value:e,hex:n,colours:t,words:s,readOnly:i,set:a}){/* @__PURE__ */
|
|
30
|
+
return z(P,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function ne({value:e,auto:n,words:t,readOnly:s,set:i}){const a=n?["auto","none","upper","capitalize","lower"]:["none","upper","capitalize","lower"],l=e??(n?"auto":"none"),o=f([]),d=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
31
|
+
return C("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
32
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
33
|
+
/* @__PURE__ */z("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(a.indexOf(l)+n+a.length)%a.length;d(a[t]),o.current[t]?.focus()},children:a.map((e,n)=>{const i=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon es-ts-icon--word","aria-checked":i,"aria-label":t.case.auto,tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const a=U[e];return r(t.case[e],/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon","aria-checked":i,"aria-label":t.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */z(a,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,P as ColourSwatchRow,F as TEXT_STYLE_DEFAULT_COUNT,A as TEXT_STYLE_KINDS,j as TEXT_STYLE_MAX,W as TEXT_STYLE_RANGES,O as TEXT_STYLE_SETTINGS,_ as TextStylesList,R as addTextStyle,B as canAddTextStyle,L as defaultTextStyles,q as describeTextStyle,I as isDefaultTextStyle,T as removeTextStyle,V as resolveTextStyle,Y as textStyleRowSize,X as updateTextStyle,Z as weightWord};
|
|
@@ -257,4 +257,4 @@ type FieldRenderer = (props: {
|
|
|
257
257
|
readOnly?: boolean;
|
|
258
258
|
}) => ReactNode;
|
|
259
259
|
|
|
260
|
-
export type { ArrayFieldDef as A, CustomFieldDef as C,
|
|
260
|
+
export type { ArrayFieldDef as A, CustomFieldDef as C, FieldOption as F, InspectorFields as I, NumberFieldDef as N, ObjectFieldDef as O, RadioFieldDef as R, SelectFieldDef as S, TextFieldDef as T, InspectorFieldDef as a, FieldRenderer as b, FieldTextProps as c, FieldNumberProps as d, FieldSliderProps as e, FieldSelectManyProps as f, FieldSelectOneProps as g, CustomFieldRenderProps as h, FieldSelectProps as i, SlotFieldDef as j, TextareaFieldDef as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { InlineRule, MarkStyle } from './markup/index.js';
|
|
2
|
-
|
|
3
|
-
interface TextMap {
|
|
4
|
-
/** The words as drawn: text in order, a `<br>` or a new block line as `\n`. */
|
|
5
|
-
text: string;
|
|
6
|
-
/** The visible offset of a DOM point inside the root. */
|
|
7
|
-
at: (node: Node, offset: number) => number;
|
|
8
|
-
/** The DOM point of a visible offset. */
|
|
9
|
-
dom: (v: number) => [Node, number];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Read the words a renderer drew, whatever its markup: text nodes in order;
|
|
13
|
-
* a `<br>` is a line break, and so is the start of a block-level child after
|
|
14
|
-
* some words (a line the renderer drew as its own block). An element matching
|
|
15
|
-
* `skip` is drawn among the words but is not words (the email's paragraph
|
|
16
|
-
* gap): it adds nothing, and a caret inside it reads as the place it stands.
|
|
17
|
-
*/
|
|
18
|
-
declare function textMap(root: HTMLElement, skip?: string): TextMap;
|
|
19
|
-
/** Why typing ended. */
|
|
20
|
-
type CanvasTypingEnd = 'escape' | 'enter' | 'blur' | 'outside' | 'stop';
|
|
21
|
-
interface CanvasTypingOptions {
|
|
22
|
-
/** The element the page drew the words in. Read again after every redraw:
|
|
23
|
-
* a host that draws them afresh may hand back a new one. */
|
|
24
|
-
element: () => HTMLElement | null;
|
|
25
|
-
/** The saved string. */
|
|
26
|
-
value: string;
|
|
27
|
-
rules: readonly InlineRule[];
|
|
28
|
-
/** The field has lines: Shift+Enter makes one. */
|
|
29
|
-
multiline: boolean;
|
|
30
|
-
/** A selector for elements drawn among the words that are not words (a
|
|
31
|
-
* paragraph's gap): {@link textMap} leaves them out. */
|
|
32
|
-
skip?: string;
|
|
33
|
-
/** The visible selection to start with. */
|
|
34
|
-
caret: [number, number];
|
|
35
|
-
/** The host's ONE writer — the same the panel's text box writes through. */
|
|
36
|
-
write: (next: string) => void;
|
|
37
|
-
/** Typing ended; the words are what was last written. */
|
|
38
|
-
end: (why: CanvasTypingEnd) => void;
|
|
39
|
-
/** The browser wrote into the words (a composition): draw them afresh. */
|
|
40
|
-
remount?: () => void;
|
|
41
|
-
/** What the toolbar shows may have changed (the selection moved, a press, a
|
|
42
|
-
* write): a host draws its buttons again from `pressed()`. */
|
|
43
|
-
onSelect?: () => void;
|
|
44
|
-
now?: () => number;
|
|
45
|
-
}
|
|
46
|
-
interface CanvasTypingSession {
|
|
47
|
-
/** The string as the session last wrote or was told. */
|
|
48
|
-
readonly value: string;
|
|
49
|
-
/** The host wrote the string from elsewhere (the panel's text box). */
|
|
50
|
-
update: (next: string) => void;
|
|
51
|
-
/** End typing. Once: a second call does nothing. */
|
|
52
|
-
stop: (why?: CanvasTypingEnd) => void;
|
|
53
|
-
/** What the selection wears, for the toolbar's pressed buttons (a pending
|
|
54
|
-
* press included), and the list its lines are in. */
|
|
55
|
-
pressed: () => {
|
|
56
|
-
marks: Partial<Record<string, boolean>>;
|
|
57
|
-
list: 'bullet' | 'number' | null;
|
|
58
|
-
};
|
|
59
|
-
/** A mark button pressed (B, I, U, S, superscript, subscript): on the
|
|
60
|
-
* selected words, or for the words typed next — `markPress`, as the panel
|
|
61
|
-
* box presses. */
|
|
62
|
-
press: (style: MarkStyle) => void;
|
|
63
|
-
/** A list button pressed: the selection's lines become that list, or stop being one. */
|
|
64
|
-
list: (kind: 'bullet' | 'number') => void;
|
|
65
|
-
}
|
|
66
|
-
/** Start typing in the words `element()` drew, or `null` where they are not the string's. */
|
|
67
|
-
declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
|
|
68
|
-
|
|
69
|
-
export { type CanvasTypingEnd as C, type TextMap as T, type CanvasTypingOptions as a, type CanvasTypingSession as b, startCanvasTyping as s, textMap as t };
|
package/dist/chunk-YCBD64P4.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,paletteWithoutPinned as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as i}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PPL7GB7D.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-76YU5ZS7.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-JTUUIVBZ.js";import{useEasel as f}from"./chunk-ACUQNEHP.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-FCLW4LEN.js";import{DEFAULT_DRAG_WORDS as y}from"./chunk-O2NLQBFX.js";import{useState as h,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as B,jsxs as $,Fragment as L}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,N=e=>`template:${e}`;function x({blocks:x,blocksOnly:A,at:I,sectionAccepts:V,onAdd:C,itemFor:F,session:H,siteWide:P,onClose:D,onHide:Q,readOnly:T}){const U=f(e=>e.config),w=p(),{labelAtLevel:E,categoryLabel:R,firstSection:S,Icon:W,Thumbnail:Y}=w,{blockIsOffered:Z}=m(),z=u("screen",d).add,G=u("drag",y).add,J=l(),[K,M]=h([]);b(()=>{let e=!1;const t=e=>Z(e,J);return s(J).list().then(o=>{if(e)return;const n=U.components;M(o.filter(e=>e.node?.type&&n[e.node.type]&&i(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[U,J]);const X=j(()=>e(U,w),[U]),q=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */B(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),_=j(()=>{const e=[];if(x&&x.choices.length>0&&a(x.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${z.inside({name:x.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */B(W,{type:e.type,size:18}),title:z.tile({name:e.label})}))})}),A)return e;const i=e=>!V||V(e),s=t(X,S);s&&i(s.type)&&e.push({key:"start",title:z.startBlank,tiles:[q(s)]});const r=K.filter(e=>i(e.node.type));r.length>0&&e.push({key:"templates",title:z.templates,tiles:r.map(e=>{return{type:N(e.id),label:e.name,cover:/* @__PURE__ */B(Y,{type:e.node.type}),keywords:[(t=e.node.type,E(t,"section",U.components[t]?.label??t)),e.node.type]};var t})});const c=o(X,S);for(const t of Object.keys(U.categories??{})){const o=c.filter(e=>e.cat===t&&i(e.type));0!==o.length&&e.push({key:`category:${t}`,title:n(U,t,R),tiles:o.map(q)})}return e},[x,A,K,X,U,z,V]),ee=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=K.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return $(L,{children:[
|
|
3
|
-
/* @__PURE__ */B(r,{icon:/* @__PURE__ */B(g,{size:15}),title:z.title,context:A?z.contextBlocks:z.contextAll,actions:/* @__PURE__ */B(c,{label:z.done,description:z.doneDescription,onClick:D}),onHide:Q}),
|
|
4
|
-
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */B(k,{groups:_,session:H,itemFor:e=>F(ee(e)??{kind:"section",type:e}),onInsert:e=>{const t=ee(e);t&&C(t)},at:I,hint:A?z.hintBlocks:z.hint,searchLabel:A?z.searchBlocks:z.searchSections,readOnly:T,words:G}),P&&!A?P:null]})]})}export{x as AddSidePanel,v as blockKey,O as sectionKey,N as templateKey};
|
package/dist/chunk-ZRNSJGUW.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-BRDCD4LK.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-CQGCGRDI.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as S,DEFAULT_PANEL_W as k,clampPanelWidth as v}from"./chunk-TZIIRGVY.js";import{usePartBridge as b}from"./chunk-SL7JKLTD.js";import{useSectionOps as x}from"./chunk-76DVL36A.js";import{useNodeClipboard as w,useNodeContextMenu as z}from"./chunk-D6N77AOS.js";import{PageEditGuardNotices as C}from"./chunk-P4CL4YQI.js";import{ScreenSaveIcon as B,ScreenMainButton as I}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as N}from"./chunk-RKTF5XLP.js";import{useScreenDocument as O}from"./chunk-THZ46DC5.js";import{requestMediaPick as P}from"./chunk-KG7RJWOK.js";import{heldStyle as $,styleShortcut as A}from"./chunk-V7U33NF2.js";import{AddChildRow as T}from"./chunk-5545A3PC.js";import{AddSidePanel as j}from"./chunk-YCBD64P4.js";import{SidePanelHead as M,PanelShowStrip as L}from"./chunk-PPL7GB7D.js";import{useEaselSession as E}from"./chunk-O7Q4DDJT.js";import{MediaSidePanel as R}from"./chunk-4GMKP2AZ.js";import{useScreenSaveSwitch as V,useScreenNodeKeys as D,useScreenPinned as F,useScreenDocumentLabel as H,useScreenCanvasFrame as W,useScreenInspectorPanel as U,useScreenDevices as G,useScreenPickFollowsSelection as J,useScreenLeftView as Y,useScreenAdd as K,SELECTION_MODE as X,sameInspectorMode as Z,useScreenBridges as q,useScreenBlockRules as _,useScreenBlockLook as Q,useScreenStorageNamespace as ee,useScreenNotify as ne,useScreenCanvasHead as te,isSlotMode as oe,useScreenStyleClipboard as re,useScreenDocumentPass as ie,useScreenCanvasDrag as le,ScreenCanvasTargetProvider as se,isPinnedFirst as de,isPinnedLast as ce,screenSlotsOf as ae}from"./chunk-76YU5ZS7.js";import{ROOT_ZONE as pe,blockNodeActions as ue,TREE_MAX_DEPTH as fe,childSlotsOf as he,slotFieldsOf as me,slotChildrenIn as ge,nestsInTree as ye,newNodeId as Se}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ke,usePanelPick as ve,useCancelPanelPick as be}from"./chunk-R6WTQWAC.js";import{useEaselHost as xe,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ze}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as Ce}from"./chunk-JTUUIVBZ.js";import{useEasel as Be,useEaselApi as Ie,CanvasPassThroughContext as Ne}from"./chunk-ACUQNEHP.js";import{TreeRow as Oe,Subtree as Pe,LayersTree as $e,TreeGroupLabel as Ae,TreeRowAction as Te,TreeSeam as je}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Me}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Le}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ee,useNodeOps as Re,clickPick as Ve}from"./chunk-ECM5F6JJ.js";import{LayersIcon as De,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as He,TopBarRail as We,TopBarCluster as Ue,EaselIconButton as Ge,TopBarDivider as Je,DeviceSwitch as Ye,InspectorIconButton as Ke,PanelResizeHandle as Xe,MAX_PANEL_W as Ze,MIN_PANEL_W as qe,panelWidthVars as _e}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as Qe,DEFAULT_CHROME_WORDS as en}from"./chunk-Z6PVRXVY.js";import{holderOf as nn,nameOrSomeone as tn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as on}from"./chunk-RE4LP46F.js";import{useWords as rn}from"./chunk-MFIRYGHW.js";import{insertSeams as ln,CanvasDragLayer as sn,CanvasInsert as dn}from"./chunk-FCLW4LEN.js";import{DEFAULT_DRAG_WORDS as cn}from"./chunk-O2NLQBFX.js";import{createDragSession as an,useTreeDrag as pn,gapToMoveIndex as un}from"./chunk-67GNT6PF.js";import{useCanvasFrame as fn,LIST_SELECTOR as hn,BLOCK_SELECTOR as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as Sn,BLOCK_ATTRIBUTE as kn,drawnBox as vn}from"./chunk-ILXP5VX5.js";import{zoneKey as bn,ROOT_ID as xn,ROOT_SLOT as wn,parseZoneKey as zn,find as Cn,DataError as Bn}from"./chunk-KRXQM65X.js";import{useRef as In,useMemo as Nn,useState as On,useEffect as Pn,useCallback as $n,useLayoutEffect as An,Fragment as Tn}from"react";import{ColoredBadge as jn,toast as Mn,groupColors as Ln}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Rn,RefreshIcon as Vn,TrashIcon as Dn,EyeOffIcon as Fn,EyeIcon as Hn,DuplicateIcon as Wn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Gn,Fragment as Jn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Kn(e,n,t){const o=Cn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Xn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=On({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return An(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Sn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${kn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=Sn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Un(jn,{colorClass:Ln("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Zn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Jn,e?{children:[
|
|
3
|
-
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var qn=`${hn}, ${mn}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const hn=xe(),{target:Sn,docId:kn,capabilities:vn,currentSlug:Ln,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=O(),ft=V(),ht=D(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=vn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:xt,config:wt}=Be(e=>e),zt=F(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),At=e=>de(zt,e),Tt=e=>ce(zt,e),jt="node"===zt.firstRow,Mt=zt.band??null,Lt=rn("screen",Ce),Et=rn("tree",Me),Rt=rn("drag",cn),Vt=rn("notice",Qe),Dt=rn("lock",on),Ft=rn("menu",Le),Ht=rn("styleClipboard",ze),Wt=rn("chrome",en),Ut=H()??`/${Ln}`,Gt=W(),Jt=U(),Yt=x({readOnly:pt}),Kt=x({readOnly:pt,foldIntoHistory:!0}),Xt=In(null),Zt=Ie(),qt=Nn(()=>({...Yt,select:e=>{Xt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Zt.config;Xt.current=Ee(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,Zt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=G(),[lo,so]=On(oo),co=ke(),ao=mt&&null!==co,po=ve(),uo=be();J(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=Y(),[go,yo]=On(fo);Pn(()=>{ho(go)},[go]);const[So,ko]=On(0),vo=In(null),bo=In(null),xo=fn(bo,{readySelector:qn}),wo=f(bo);h(bo,xo);const zo=N(),Co=nn(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:tn(Co.name,Dt),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};m(bo,xo,Io);const[No,Oo]=On(!1),Po=In(!1),$o=In(!1),[Ao,To]=On(null),jo=K(),Mo=e=>To(null===e?null:{zone:pe,index:e}),[Lo,Eo]=On([]),[Ro,Vo]=On(X),Do="puck"===Ro.kind,Fo=No&&!Ao&&jo.railTarget?jo.railTarget(St.data,{node:bt??null,mode:Ro}):null,Ho=Fo?{zone:bn(Fo),index:Fo.index}:null,Wo=Ao??Ho,Uo=Wo&&Wo.zone===pe?Wo.index:null,Go=o(Ro,bt?.props.id),[Jo,Yo]=On(null);Pn(()=>{Jo&&(r(),Yo(null))},[Jo]);const Ko=In(xt);Ko.current=xt;const Xo=$n((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Yo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ko.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Cr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Zo=In(null);Pn(()=>{const e=Zo.current;Zo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Vo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??X);const t=bt?.props.id,o=Xt.current;if(Xt.current=null,!t)return;const r=xt(t);Xo(String(t),{scroll:!i(o,r??null,pe)})},[bt?.props.id,Xo]);const qo=$n(e=>{Vo(n=>Z(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),_o=In(()=>{});_o.current=(e,n)=>{const t=e?Si(e.zone??pe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Vo(e=>Z(e,n)?e:n),o!==r&&(Zo.current={id:o,mode:n},qt.select(e))};const Qo=$n((e,n)=>_o.current(e,n),[]),er={kind:Ro.kind,mode:Ro,open:qo,show:e=>Vo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Qo},nr=q(er,{data:St.data,selected:bt??null,zoneOf:e=>xt(e)?.zone,readOnly:Boolean(pt),select:e=>{Vo(X),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(pe,e,n),scrollTo:e=>Wi(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),tr=nr.pinnedSource??!1,or=nr.resolveLeftView?nr.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",rr=_(),{isLockedBlock:ir,duplicateBlocked:lr,nestDepth:sr,newSectionNode:dr,canAddTo:cr,blockIsOffered:ar}=rr,pr=Q(),{labelAtLevel:ur,Icon:fr,useProducts:hr}=pr,mr=pr.rowName?(e,n,t)=>pr.rowName(e,n,t):void 0,gr=$n(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Xo(e,{scroll:!0})},[kt,Xo]),{selectNode:yr,openPartId:Sr}=b({mode:Ro,setMode:Vo,onOpenPart:gr}),[kr,vr]=On(null);we(null!==kr,()=>vr(null));const br=S(ee()),xr=br.collapsed,wr=br.panelWidths,[zr,Cr]=On(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(xr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});Pn(()=>{try{window.localStorage.setItem(xr,JSON.stringify([...zr]))}catch{}},[zr]);const[Br,Ir]=On(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(wr);if(!e)return{...k};const n=JSON.parse(e);return{left:v(Number(n.left)||k.left),right:v(Number(n.right)||k.right)}}catch{return{...k}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(wr,JSON.stringify(Br))}catch{}},300);return()=>clearTimeout(e)},[Br]);const Nr=$n((e,n)=>Ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Or=$n(e=>Nr("left",e),[Nr]),Pr=$n(e=>Nr("right",e),[Nr]),$r=e=>zr.has(e),Ar=e=>Cr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Tr=In(!1),jr=In(null);Pn(()=>{if(Tr.current&&!No){const e=jr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),jr.current=null}Tr.current=No},[No]),Pn(()=>{if(!No||!wo)return;const e=e=>{"Escape"===e.key&&_i()};return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[No,wo]),we(No,()=>_i()),Pn(()=>{!Qt&&No&&(Oo(!1),To(null),Po.current=!1)},[Qt]),Pn(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),To(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),Pn(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),Pn(()=>{if(!po||!wo)return;const e=e=>{"Escape"===e.key&&uo()};return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[po,wo]),we(null!==po,()=>uo());const Mr=ne(),Lr=(e,n="success",t)=>{if(Mr)return void(t?Mr(e,"error"===n?"error":"info",t):Mr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Mn.error(e,{...o,duration:t?.duration??3200}):Mn.success(e,{...o,duration:t?.duration??1900})},Er=In(null),[Rr,Vr]=On(0),[Dr,Fr]=On(0),Hr=te(),Wr=In(null),Ur=e=>Math.max(0,e.clientHeight-(Wr.current?.offsetHeight??0));Pn(()=>{const e=Er.current;if(!e)return;const n=()=>{Vr(e.clientWidth),Fr(Ur(e))};n();const t=new ResizeObserver(n);return t.observe(e),Wr.current&&t.observe(Wr.current),()=>t.disconnect()},[]),An(()=>{Er.current&&(Vr(Er.current.clientWidth),Fr(Ur(Er.current)))},[Br,Qt,eo]);const Gr=lo===ro?Rr>0?Rr:to[ro]:to[lo],Jr=Rr>0?Math.min(Rr/Gr,"shrink"===io?1:2):1,Yr=Gr*Jr,Kr=Rr>0&&Yr>Rr+1,Xr={width:Yr,height:Dr||"100%",flex:"none",position:"relative"},Zr={width:Gr,height:Dr?Dr/Jr:"100%",maxHeight:"none",transform:1!==Jr?`scale(${Jr})`:void 0,transformOrigin:"top left"},qr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),_r=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Qr=e=>{No&&(Oo(!1),To(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?qr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},ei=()=>{P(hn,{accept:"image/*",title:Wt.mediaLibrary})},ni=()=>{Vo(X),qt.select(null),u()},ti=()=>{Vo($t??X),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},oi=St.data.content??[],ri=()=>{const e=oi.findIndex(At),n=oi.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:oi.length}},ii=wt,li=rr.stripCopy,si=n=>e(n,li),di=w(),ci=Re({data:St.data,config:ii,readOnly:Boolean(pt),clipboard:di,strip:li?e=>li(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==xn||e.slot!==wn)return{min:0,max:n-1};const{floor:t,cap:o}=ri();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Vo(X);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),ai=e=>{const n=Cn(St.data,wt,e);if(!n)return!1;const t=bn(n.place),o=n.node,r=t===pe?mi(o):Oi(o);return!!ci.remove(e)&&(Lr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{ci.restore(n.node,n.place)}}}),!0)},pi={...ci,remove:ai},ui=e=>ur(e,"block",wt.components[e]?.label??e),fi=$n(e=>wt.components[e]?.defaultProps??{},[wt]),hi=e=>ur(e,"section",ui(e)),mi=e=>l({type:e.type,props:e.props??{}},hi(e.type),mr),{nodeAddresses:gi,zoneItems:yi}=Nn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=fe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of he(wt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(oi,pe,0),{nodeAddresses:e,zoneItems:n}},[oi,wt]),Si=$n(e=>yi.get(e)??[],[yi]),ki=e=>{const n=gi.get(e);return n?Si(n.zone)[n.index]:void 0},vi=e=>ae(rr,wt,e),bi=e=>{if(!rr.slotsOf||e===pe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ki(e.slice(0,n));if(!t)return null;const o=vi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},xi=(()=>{if(!oe(Ro))return null;const e=`${Ro.nodeId}:${Ro.slot}`;return bi(e)?.slot.panel===Ro.kind?e:null})(),wi=In(null);Pn(()=>{const e=wi.current;if(wi.current=null,!xi||!oe(Ro))return;const n=Ro.nodeId;Xo(n,{scroll:e!==xi}),Cr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ro]);const zi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=gi.get(e);n&&(n.zone===pe?Ui(n.index):vl(n.zone,n.index,e,ki(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&xi!==i&&(wi.current=i),Qo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Wi(o)},Ci=(e,n,t)=>{const o=`${e}:${n}`;if(Cr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;xi!==o&&(wi.current=o);Qo(null,{kind:t,nodeId:e,slot:n})},Bi=(e,n,t)=>{if(pt||!rr.moveSlot)return;const o=ki(e),r=o?vi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=un(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=rr.moveSlot(e,n,s);"string"==typeof d&&Ci(e,d,i.panel)},Ii=hr(),Ni=Nn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ii??[])e.set(n.slug,n.name);return e},[Ii]),Oi=e=>s(e,ui,pr.plainText,e=>Ni.get(e),pr.rowName),Pi=(e,n)=>{const t=wt.components[e.type]?.fields,o=n===pe||Hl(n)?"section":"block",r=n===pe&&(At(e)||Tt(e)||Nt(e.type)),i="block"===o?d(t):r?null:c(t);return pr.renamePropOf?pr.renamePropOf(e,o,i):i},$i=(e,n,t,o)=>{if(!(!pt&&kr?.zone===e&&kr.index===n))return;const r=(t,o)=>{vr(null),o&&((e,n,t)=>{const o=Si(e)[n];if(!o)return;const r=Pi(o,e);r&&qt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Ai=t(re(),Ht),Ti=Ai.scope({target:Sn,siteId:tt,docId:kn}),ji=wt,Mi=(e,n)=>n===pe?hi(e):ui(e),Li=(e,n,t)=>{const o=Ai.plan(Ti,t,Mi(t.type,e),ji);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Lr(o.message))},Ei=z({nodesIn:Si,nodeAt:(e,n)=>Si(e)[n]??null,labelOf:(e,n)=>n===pe?hi(e):ui(e),renamePropOf:Pi,beginRename:(e,n)=>vr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openAddSection:()=>{qt.select(null),Zi(null)},openPageSettings:()=>{qt.select(null),Vo(X)},pageSettingsLabel:Lt.pageSettings,words:{menu:Ft,styleClipboard:Ht,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>Cr(new Set(Si(pe).map(e=>String(e.props.id)))),onPasteRefused:e=>Lr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Gl(e,n),menuRows:nr.menuRows,isLocked:e=>ir(e.type),duplicateBlocked:e=>lr(St.data,e),permits:e=>ue(wt,e.type),canAddTo:cr,nodeOps:pi,isPinned:(e,n)=>n===pe&&(At(e)||Tt(e)),sectionBand:ri,openAddInside:(e,n)=>{e===pe?Ui(n):qt.select({zone:e,index:n}),Zi(null)},locate:e=>gi.get(e)??null,rowNameOf:(e,n)=>n===pe?mi(e):Oi(e),selectAt:(e,n,t,o)=>{e===pe?Ui(n):vl(e,n,t,o??"")},slotRung:e=>{const n=bi(e);return n?.slot.panel?{label:n.slot.label,select:()=>zi(n.node,n.slot,!1)}:null},style:{held:()=>$(Ti),canCopy:e=>Ai.rows(ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Ai.copy(Ti,e,Mi(e.type,n),ji),paste:(e,n,t)=>Li(e,n,t)},keys:ht?{target:wo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??pe,index:e.index}:null},held:()=>di.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Lr(Lt.copied({name:n}))}}:void 0},xo),Ri=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{Ri.current={copy:(e,n)=>Ai.copy(Ti,e,Mi(e.type,n),ji),paste:Li,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??pe,t=Si(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Vi=$n(e=>{const n=A(e);if(!n)return;const t=Ri.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))},[]);Pn(()=>{if(!wo)return;const e=e=>Vi(e);return wo.addEventListener("keydown",e),()=>wo.removeEventListener("keydown",e)},[Vi,wo]),gn(xo,"keydown",Vi);const Di=oi.map(e=>e.props.id).join("|");Pn(()=>{const e=xo?.document??null,n=xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=oi.findIndex(Tt),t=n>=0?n:oi.length,o=n=>{const t=oi[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(mn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=oi.length>0&&!At(oi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Eo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[xo,Di,lo,Jr,Qt,eo,bt?.props.id]);const Fi=xo?.document??null,Hi=xo?.window??null;Pn(()=>{const e=vo.current;if(!e||!Fi||!Hi)return;const n=[],t=()=>{const n=Fi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Hi.scrollTo({left:Hi.scrollX,top:Hi.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Fi,Hi]);const Wi=e=>{nr.holdCanvasOn?nr.holdCanvasOn(e):a(e)},Ui=e=>{Vo(X),qt.select({index:e}),nr.sectionPressed?.(oi[e]);const n=oi[e]?.props?.id;n&&Wi(n)},Gi=e=>{const{floor:n,cap:t}=ri(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Ro.kind!==$t?.kind?oi.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Ji=(e,n)=>{const{floor:t,cap:o}=ri(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(pe,e,i),qt.select({index:i}),{moved:!0,dest:i})},Yi=(e,n,t,o)=>{Vo(X),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Lr(Lt.sectionAdded({name:t}))},Ki=(e,n)=>{const t=Gi(n),o=dr(e,{nodeDefaults:fi,newNodeId:Se,sectionLabel:hi,blockIsOffered:ar}),r=o?qt.insertNode(pe,t,o):qt.insertSection(e,t);return Yi(t,r,hi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of he(wt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=cr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Xi=(e,n,t)=>{const o=Gi(t),r=qt.insertNode(pe,o,n);return Yi(o,r,e),o},Zi=e=>qi(pe,e),qi=(e,n)=>{jr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),To(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},_i=()=>{Oo(!1),To(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Qi=(e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Wl(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,si(e.template.node))}Vo(X),qt.select({index:t,zone:n})}},el=(e,n)=>pr.rowName?n?At(e)?pr.rowName(e,"section",Lt.header):Tt(e)?pr.rowName(e,"section",Lt.footer):Nt(e.type)?pr.rowName(e,"section",ui(e.type)):mi(e):Oi(e):n?hi(e.type):ui(e.type),nl=e=>n=>{e()},tl=()=>nr.editPinnedSource?.(),ol=(e,n,t)=>{if(pt)return null;const o=Si(e)[n];return o&&!ue(wt,o.type).delete?null:/* @__PURE__ */Un(Te,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Si(e)[n]?.props?.id;null!=t&&ai(String(t))})(e,n),children:/* @__PURE__ */Un(Dn,{size:15})})},rl=e=>pr.rowPreview?.(e)||void 0,il=e=>pr.rowMarks?.(e)??void 0,ll=(e,n,t)=>pr.rowActions?.(e,n,t)??null,sl=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Un(Te,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>cl(e,n,t),children:/* @__PURE__ */Un(r?Fn:Hn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},dl=e=>{const n=hi(oi[e]?.type??""),t=n?Lt.addSectionBefore({name:n}):Lt.addSectionHere;return vs(pe,e,()=>Zi(e),t)},cl=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},al=e=>me(wt,e),pl=e=>he(wt,e),ul=e=>rr.slotsOf?vi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ge(e,n.slot)})):[{slot:null,rung:null,kids:pl(e)}],fl=e=>rr.slotsOf?ul(e).flatMap(e=>e.kids):pl(e),hl=e=>Boolean(rr.slotsOf)&&vi(e).some(e=>e.rung),ml=(e,n,t)=>null===t?void 0===n?cr(e):cr(e,n):cr(e,n,t),gl=(e,n,t)=>{const o=ye(wt,e.type,n)&&(t||fl(e).length>0||hl(e));return{collapsible:o,folded:o&&$r(String(e.props.id))}},yl=(e,n,t)=>ul(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>gl(e,r,t(e.type)).collapsible?[String(e.props.id),...yl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Sl=e=>fl(e).length>0||hl(e)||Boolean(cr(e.type)),kl=e=>Boolean(cr(e)),vl=(e,n,t,o)=>{if(Vo(X),cr(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),qt.select({index:n,zone:e}),a(t)}else qt.select({index:n,zone:e}),Wi(t)},bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),cr(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},xl=(e,n,t)=>{qt.insertComponent(e,n,t),Vo(X),qt.select({index:t,zone:e})},wl=In(/* @__PURE__ */new Set);Pn(()=>{oi.forEach(e=>{const n=cr(e.type)?.spec;if(!n)return;const t=e.props.id;if(wl.current.has(t))return;wl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(fi)).forEach((e,t)=>Kt.seedChild(o,t,n.childType,e))})},[oi,Kt,fi]);const zl=In(/* @__PURE__ */new Set);Pn(()=>{oi.forEach((e,t)=>{const o=e.props.id;if(zl.current.has(o))return;const r=n(e,al(e.type));zl.current.add(o),r&&Kt.replaceComponent(pe,t,{...e,props:r})})},[oi,Kt]),ie(Kt,wt);const Cl=oi.findIndex(Tt),Bl=Cl>=0?oi[Cl]:null,Il=jt?oi.findIndex(At):-1,Nl=Il>=0?oi[Il]:null,Ol=zt.groupTab,Pl=Nn(()=>Ol?e=>Nt(e.type):void 0,[Ol]),$l=Boolean(zt.groupBadge),Al=zt.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(jn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,Tl=oi.find(e=>e.type===Bt)??null,jl=oi.find(e=>e.type===It)??null,Ml=Cl>=0?Cl:oi.length,Ll=[];oi.forEach(e=>{Tt(e)||(Sl(e)&&Ll.push(String(e.props.id)),Ll.push(...yl(e,1,kl)))}),Bl&&(Ll.push(String(Bl.props.id)),Ll.push(...yl(Bl,1,kl)));const El=Ll.length>0&&Ll.every(e=>zr.has(e)),Rl=e=>{const n=pr.blockRowName(e,ui);return pr.rowName?pr.rowName(e,"block",n):n},Vl=(e,n,t,o)=>{const r=Si(e)[t];if(!r)return;const i={...zn(e),index:t},l={...zn(n),index:Math.min(Math.max(o,0),Si(n).length)},s=un(i,l);if(e!==n||s!==t)try{ci.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Bn))throw e}},Dl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of pl(e))n.add(r),t(o)};for(const t of al(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=gi.get(n);if(!e)return null;if(e.zone===pe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Hl=e=>{const n=e.slice(0,e.indexOf(":")),t=oi.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},Wl=(e,n)=>{const t=Hl(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,Si(e).length))},Ul=(e,n,t)=>{if(e.rung){const t=ki(e.rung.nodeId),o=t?vi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Yl(e.add,n);const o=bn(n);if(Nt(e.type))return!1;const r=Hl(o),i=Hl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Wl(o,e.type))&&(n.index>=0&&n.index<=Si(o).length));if(e.zone===pe||o===pe){if(e.zone!==o)return!1;const{floor:t,cap:r}=ri();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Si(o).length)return!1;if(e.zone===o)return!0;const l=Bl&&!zt.lastIsOpen?String(Bl.props.id):null;return(!l||Fl(e.zone)!==l&&Fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Si(e)[t];if(!r)return!1;const i=n.split(":")[0],l=gi.get(i),s=l?Si(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Dl(r).has(n))return!1;const d=cr(s.type,sr(St?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Si(n),r))})(e.zone,o,e.index,t)},Gl=(e,n)=>{const t=bn(e.from),o=e.node;return t===bn(n)?Wl(t,o.type):Ul({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Jl=e=>{const n=e.slice(0,e.indexOf(":")),t=gi.get(n),o=t?Si(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=cr(o.type,sr(St?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:ui(r.spec.childType)}]:[]),l=bi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:el(o,t.zone===pe)}},Yl=(e,n)=>{const t=bn(n);if("block"!==e.kind){if(Hl(t)){const o="section"===e.kind?e.type:e.template.node.type;return Wl(t,o)&&n.index>=0&&n.index<=Si(t).length}if(t!==pe)return!1;const{floor:o,cap:r}=ri();return n.index>=o&&n.index<=r}if(t===pe)return!1;const o=Jl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Si(t))},Kl=(e,n)=>{e.rung?Bi(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Hl(bn(n)))return void Qi(e,bn(n),n.index);if("section"===e.kind)return void Ki(e.type,n.index);if("template"===e.kind)return void Xi(e.template.name,si(e.template.node),n.index);const t=bn(n),o=Jl(t);o&&(o.target.spec?bl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):xl(t,e.type,n.index))})(e.add,n):e.zone===pe?Ji(e.index,n.index):Vl(e.zone,bn(n),e.index,n.index)},[Xl]=On(()=>an()),Zl=pn({keyOf:e=>e.id,readOnly:Boolean(pt),session:Xl,canDrop:Ul,onDrop:Kl,onStep:(e,n)=>{e.rung?Bi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===pe?((e,n)=>{const t=hi(oi[e]?.type??""),o=Ji(e,n<0?e-1:e+2);if(!o.moved)return void Lr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=ri();Lr(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Vl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ql=$n(e=>{const{floor:n,cap:t}=ri(),o=[];for(const r of e.nodes){const e=bn(r.place),i=Si(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(At(i)||Tt(i)||ir(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Hl(e)),s=e===pe||l;e===pe&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?hi(i.type):Oi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=bn(e.list);return n===pe&&0===e.children.length?[{...e,addLabel:Lt.addSection,addAlways:!0}]:e.children.length>0||Boolean(Jl(n)?.choices.length)||Boolean(Hl(n))?[e]:[]}),i=r.flatMap(e=>{const n=bn(e.list);return n===pe||Hl(n)||!Jl(n)?.choices.length?[]:ln(e,Lt.addBlockHere)});return{sources:o,zones:r,seams:i}},[St.data]),_l=null==bt?.props.id?null:String(bt.props.id),Ql=$n(e=>{const n=wt,t=e=>!e.item.rung&&null!==Cn(St.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(_l);return i||(r(Ve(St.data,n,o.item.id,_l,Pl))??o)},[St.data,wt,_l,Pl]),[es,ns]=On(null);gn(xo,"mouseover",e=>{if(!Ol)return;const n=yn(e.target),t=n?Kn(St.data,wt,n):null;t!==es&&ns(t)}),gn(xo,"mouseout",e=>{Ol&&!e.relatedTarget&&ns(null)});const ts=e=>At(e)||Tt(e)||Nt(e.type),os=[];if(Ol){const e=_l?Kn(St.data,wt,_l):null;for(const n of/* @__PURE__ */new Set([e,es])){const e=n?oi.find(e=>String(e.props.id)===n):void 0;if(!e||!ts(e))continue;const t=Ol(e);t&&os.push({id:String(e.props.id),label:t,below:At(e)||e.type===Bt})}}const rs=E(),is=In(null);Pn(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(oi.filter(ts)),t=is.current;if(is.current={doc:kn,bands:n,index:vt.index},!t||t.doc!==kn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Yn.has(rs)&&(Yn.add(rs),Lr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[oi]);const ls=e=>{Vo(X),qt.select(e.zone===pe?{index:e.index}:{index:e.index,zone:e.zone})},ss=le(),ds=()=>({data:St.data,device:lo,ops:qt,inspector:er}),cs=ss?.model,as=Nn(()=>cs?e=>cs(e,ql(e),ds()):ql,[cs,ql,lo]),ps=ss?.measure,us=ps?(e,n)=>ps(e,n,ds()):void 0,fs=ss?.canDrop,hs=fs?(e,n)=>fs(e,n,Ul,ds()):Ul,ms=ss?.drop,gs=ms?(e,n)=>ms(e,n,Kl,ds()):Kl,ys=ss?.pick,Ss=ys?e=>ys(e,ls,ds()):ls,ks=e=>{const n=bn(e),t=bi(n);t&&zi(t.node,t.slot,!1),qi(n,e.index)},vs=(e,n,t,o)=>/* @__PURE__ */Un(je,{...pt?{}:Zl.seam({place:{...zn(e),index:n}}),onAdd:pt?void 0:t,label:o},`seam:${e}:${n}`),bs={rowClick:nl,isCollapsed:$r,toggleCollapse:Ar},xs=e=>{const n=String(e.props.id),t=oi.findIndex(e=>String(e.props.id)===n),o=Ot(n),r=Si(o),i=$r(n),l=ui(e.type),s=pr.rowName?pr.rowName(e,"section",l):l,d=e=>vs(o,e,()=>qi(o,e),Lt.addSectionHere);/* @__PURE__ */
|
|
11
|
-
return Gn(Jn,{children:[
|
|
12
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:e.type,size:13}),name:s,preview:rl(e),marks:il(e),onSelect:()=>Ui(t),nameSlot:$i(pe,t,n,s),selected:Go===n,badge:Al,actions:ll(e,pe,t)??void 0,rowProps:{"data-node-id":n,onClick:nl(()=>Ui(t))},fold:{open:!i,label:"section",onToggle:()=>Ar(n)}}),!i&&/* @__PURE__ */Gn(Pe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=mi(n),l=Sl(n),s=l&&$r(r),c=()=>vl(o,t,r,e.type),{rowProps:a,...p}=Zl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...zn(o),index:t}},{"data-node-id":r,onClick:nl(c)});/* @__PURE__ */
|
|
13
|
-
return Gn(Tn,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:c,nameSlot:$i(o,t,r,i),selected:Go===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ar(r)}:void 0,actions:/* @__PURE__ */Gn(Jn,{children:[ol(o,t,i),ll(n,o,t),sl(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un(Pe,{children:Cs(n,2)})]},r)}),d(r.length)]})]})},ws=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Zl.dragging,d=!$r(l)&&s?.rung?.nodeId!==i,c={...zn(l),index:0},a=s&&!s.rung&&Ul(s,c)?c:void 0,p=()=>zi(e,n,!0),{rowProps:u,...f}=Zl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(rr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:nl(p)}),h=pt?null:rr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Gn(Tn,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:xi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ar(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Jn,{children:h.map((t,o)=>/* @__PURE__ */Un(Te,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ci(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Un(Dn,{size:15}):/* @__PURE__ */Un(Wn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un(Pe,{children:r})]},l)},zs=(e,n)=>{const t=ul(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Un(Jn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=ml(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(Jl(c)?.choices.length),p=(e,n)=>a?vs(e,n,()=>qi(e,n),Lt.addBlockHere):vs(e,n),u=/* @__PURE__ */Gn(Jn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Go===String(n.props.id),{collapsible:i,folded:s}=gl(n,l,kl(n.type)),d=String(n.props.id),c=Rl(n),a=()=>vl(t,o,d,e.type),{rowProps:u,...f}=Zl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...zn(t),index:o}},{"data-node-id":d,onClick:nl(a)});/* @__PURE__ */
|
|
18
|
-
return Gn(Tn,{children:[0===o&&p(t,0),
|
|
19
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:c,preview:rl(n),marks:il(n),onSelect:a,nameSlot:$i(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ar(d)}:void 0,actions:/* @__PURE__ */Gn(Jn,{children:[ol(t,o,c),ll(n,t,o),sl(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un(Pe,{children:zs(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?ws(e,t.rung,r++,o,u):/* @__PURE__ */Un(Tn,{children:u},t.slot??"")})})},Cs=(e,n)=>{const t=sr(St?.data,e.type,String(e.props.id)),o=ul(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Un(Jn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=ml(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>bl(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>qi(n,t):void 0;return vs(n,t,o,n===f&&c?c.addLabel:Lt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Gn(Jn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Go===String(n.props.id),i=Oi(n),l=String(n.props.id),{collapsible:d,folded:c}=gl(n,s,kl(n.type)),a=al(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...zn(p),index:Si(p).length}:void 0,f=Zl.dragging,h=u&&f&&Ul(f,u)?u:void 0,g=()=>vl(t,o,l,e.type),{rowProps:y,...S}=Zl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...zn(t),index:o},into:h,canDrag:!ir(n.type)},{"data-node-id":l,onClick:nl(g)});/* @__PURE__ */
|
|
21
|
-
return Gn(Tn,{children:[0===o&&m(t,0),
|
|
22
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:g,nameSlot:$i(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Ar(l)}:void 0,actions:ir(n.type)?ll(n,t,o)??void 0:/* @__PURE__ */Gn(Jn,{children:[ol(t,o,i),ll(n,t,o),sl(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un(Pe,{children:Cs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Un(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>bl(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?ws(e,o.rung,i++,r,S):/* @__PURE__ */Un(Tn,{children:S},o.slot??"")})})},Bs=(()=>{if(!bt||!Do)return null;const e=String(bt.type),n=String(bt.props.id),t=cr(e,sr(St?.data,e,n));if(!t||"footer"===t.source)return null;const o=oi.some(e=>String(e.props?.id)===n),r=Array.isArray(bt.props[t.slot])?bt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:ui(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:el(bt,o),choices:i,onPick:o=>{t.spec?bl(n,t.slot,o,r.length,e):xl(`${n}:${t.slot}`,o,r.length)}}})(),Is=Wo&&Wo.zone!==pe&&!Hl(Wo.zone)?Wo.zone:null,Ns=!0===jo.blocksFirst,Os=Is?Jl(Is):Ns&&Wo?null:Bs,Ps=Wo&&Hl(Wo.zone)?Wo.zone:null,$s=Ps&&zt.groupAccepts?e=>Wl(Ps,e):void 0,As=Boolean(Ao&&Is)||Ns&&Boolean(Os&&Os.choices.length>0),Ts=No||null!==po,js=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!Ts&&or===e.id,onSelect:()=>Qr(e.id)}:e,Ms=[{id:"add",label:Lt.add.title,icon:/* @__PURE__ */Un("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:No,onSelect:()=>No?_i():Zi(null)},...(nr.railLead??[]).map(js),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Un(De,{}),active:Qt&&!Ts&&"sections"===or,onSelect:()=>Qr("sections")},...(nr.railTrail??[]).map(js)];ao?Ms.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),active:Qt&&!No&&(null!==po||"media"===or),onSelect:()=>Qr("media")}):mt&&Ms.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),onSelect:ei});const Ls=[...nr.railLead??[],...nr.railTrail??[]].find(e=>"panel"in e&&e.id===or),Es=Boolean(Mt?.foldable)&&!tr,Rs=Mt?.label??(gt?Lt.pageSections:Lt.templateSections),Vs=Es&&$r(et),Ds=/* @__PURE__ */Gn(Jn,{children:[oi.map((e,n)=>{if(At(e)||Tt(e)||Nt(e.type))return null;const t=Go===String(e.props.id),o=Boolean(e.props._hidden);pl(e);const r=String(e.props.id),i=nr.hasOwnRows?.(e)??!1,l=Sl(e)||i,s=l&&$r(r),d=al(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...zn(c),index:Si(c).length}:void 0,p=Zl.dragging,u=a&&p&&Ul(p,a)?a:void 0,{rowProps:f,...h}=Zl.row({item:{id:r,zone:pe,index:n,type:e.type},place:{...zn(pe),index:n},into:u},{"data-node-id":r,onClick:nl(()=>Ui(n))});/* @__PURE__ */
|
|
24
|
-
return Gn(Tn,{children:[n>0&&dl(n),
|
|
25
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:e.type,size:13}),name:mi(e),preview:rl(e),marks:il(e),onSelect:()=>Ui(n),nameSlot:$i(pe,n,r,mi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ar(r)}:void 0,actions:/* @__PURE__ */Gn(Jn,{children:[ol(pe,n,mi(e)),ll(e,pe,n),sl(pe,n,e,mi(e))]}),rowProps:f}),Sl(e)&&!s&&/* @__PURE__ */Gn(Pe,{children:[Cs(e,1),nr.partRows?.(e,bs)]}),i&&!s&&/* @__PURE__ */Un(Pe,{children:nr.ownRows?.(e,n,bs)})]},String(e.props.id??n))}),!tr&&Ml>0&&dl(Ml),Mt?.addAtEnd&&!tr&&!pt&&/* @__PURE__ */Un(T,{small:!0,label:Lt.addSection,blocked:null,onAdd:()=>Zi(Ml)})]}),Fs=(e,n,t)=>{const o=String(e.props.id),r=fl(e).length>0||hl(e)||Boolean(cr(e.type)),i=r&&$r(o),l="header"===t?Lt.header:Lt.footer,s=pr.rowName?pr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Gn(Jn,{children:[
|
|
27
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:t,size:13}),name:s,preview:rl(e),marks:il(e),badge:Al,onSelect:()=>Ui(n),nameSlot:$i(pe,n,o,s),selected:Go===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ar(o)}:void 0,actions:ll(e,pe,n)??void 0,rowProps:{"data-node-id":o,onClick:nl(()=>Ui(n))}}),r&&!i&&/* @__PURE__ */Un(Pe,{children:zs(e,1)})]})};return(nr.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Un(se,{target:xo,children:/* @__PURE__ */Gn("div",{ref:bo,className:"sf-editor es-editor",style:_e(Br),onContextMenu:Ei.onEditorContextMenu,...g(hn),children:[
|
|
29
|
-
/* @__PURE__ */Gn(He,{children:[
|
|
30
|
-
/* @__PURE__ */Un(We,{items:Ms,ariaLabel:Lt.bar.views}),
|
|
31
|
-
/* @__PURE__ */Gn(Ue,{children:[
|
|
32
|
-
/* @__PURE__ */Un(Ge,{label:Lt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Un(En,{})}),
|
|
33
|
-
/* @__PURE__ */Un(Ge,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
34
|
-
/* @__PURE__ */Un(Je,{}),
|
|
35
|
-
/* @__PURE__ */Un(Ye,{devices:no,value:lo,onChange:so}),
|
|
36
|
-
/* @__PURE__ */Un(Ge,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=xo?.document;if(!e)return null;const n=oi.findIndex(Tt),t=n>=0?n:oi.length;let o=null;for(let n=0;n<t;n++){const t=oi[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=bt?.props?.id??oi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Un(Vn,{})})]}),
|
|
37
|
-
/* @__PURE__ */Gn(Ue,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Un(B,{input:Bo,words:Lt.saveStatus}),nr.barLead?.(),nr.barTrail?.(),nr.mainAction||!nr.barMain?/* @__PURE__ */Un(I,{input:Bo,action:nr.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):nr.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Un(C,{}),
|
|
40
|
-
/* @__PURE__ */Gn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Gn(Jn,{children:[
|
|
41
|
-
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Un(j,{blocks:Os,blocksOnly:As,sectionAccepts:$s,at:Ao?{label:(e=>{const n=Hl(e.zone);if(n)return Lt.add.addingTo({name:pr.rowName?el(n,!0):ui(n.type)});if(e.zone===pe){const n=oi[e.index];return n&&!Tt(n)?Lt.add.addingBefore({name:el(n,!0)}):Lt.add.addingAtEnd}const t=Jl(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Ao),onClear:()=>To(null)}:void 0,onAdd:e=>{const n=Wo,t=(e,n)=>{Ao&&To({zone:e,index:n})};if(n&&"block"!==e.kind&&Hl(n.zone))return Qi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Uo)return void Ki(e);const n=Ki(e,Uo);Ao&&Mo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Uo)return void Xi(e,n);const t=Xi(e,n,Uo);Ao&&Mo(t+1)})(e.template.name,si(e.template.node));if(n&&n.zone!==pe){const o=Jl(n.zone);if(!o)return;return o.target.spec?bl(o.parentId,o.target.slot,e.type,n.index,o.parent.type):xl(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Bs?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Xl,siteWide:nr.addPanelRow?.(_i),onClose:_i,onHide:qr,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
-
/* @__PURE__ */Un(R,{panel:co,pick:po,onHide:qr}):Ls?Ls.panel({onHide:qr,notify:Lr}):"media"===or&&co?/* @__PURE__ */Un(R,{panel:co,pick:null,onHide:qr}):/* @__PURE__ */Gn(Jn,{children:[
|
|
43
|
-
/* @__PURE__ */Un(M,{icon:/* @__PURE__ */Un(De,{}),title:Lt.layers,context:Ut,actions:
|
|
44
|
-
/* @__PURE__ */Un(Ke,{label:El?Lt.expandAll:Lt.collapseAll,title:0===Ll.length?Lt.nothingToFold:void 0,disabled:0===Ll.length,onClick:()=>Cr(e=>{const n=new Set(Ll);return El?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ll])}),children:/* @__PURE__ */Un(Zn,{expand:El})}),onHide:qr}),
|
|
45
|
-
/* @__PURE__ */Gn($e,{className:"sf-tree sf-scroll",words:Et,children:[
|
|
46
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:ni,selected:!bt&&Do,rowProps:{onClick:nl(ni)}}),Tl&&/* @__PURE__ */Gn(Jn,{children:[!$l&&/* @__PURE__ */Un(Ae,{children:Lt.header}),xs(Tl)]}),!tr&&yt&&!($l&&Tl)&&/* @__PURE__ */Gn(Jn,{children:[!$l&&/* @__PURE__ */Un(Ae,{children:Lt.header}),!jt&&/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:"header",size:13}),name:Lt.header,badge:Al,onSelect:ti,selected:Ro.kind===$t?.kind,rowProps:{onClick:nl(ti)}})]}),!tr&&Nl&&!($l&&Tl)&&Fs(Nl,Il,"header"),!tr&&!Es&&/* @__PURE__ */Un(Ae,{children:Rs}),Es?/* @__PURE__ */Gn(Jn,{children:[
|
|
47
|
-
/* @__PURE__ */Un(Oe,{words:Et,icon:null,name:Rs,fold:{open:!Vs,label:Rs,onToggle:()=>Ar(et)}}),!Vs&&/* @__PURE__ */Un(Pe,{children:Ds})]}):Ds,yt&&!$l&&/* @__PURE__ */Un(Ae,{children:Lt.footer}),Bl&&!($l&&jl)&&Fs(Bl,Cl,"footer"),!tr&&!Bl&&yt&&!$l&&/* @__PURE__ */Un(Oe,{words:Et,icon:/* @__PURE__ */Un(fr,{type:"footer",size:13}),name:Lt.footer,onSelect:tl,rowProps:{onClick:nl(tl),title:Lt.editFooter}}),jl&&xs(jl),nr.treeFoot?.()]})]})}),
|
|
48
|
-
/* @__PURE__ */Un(Xe,{side:"left",width:Br.left,min:qe,max:Ze,defaultWidth:k.left,label:Lt.resizeLeftPanel,onResize:Or})]}):/* @__PURE__ */Un(L,{side:"left",onShow:qr}),
|
|
49
|
-
/* @__PURE__ */Gn("div",{ref:Er,className:"sf-center sf-scroll","data-sf-canvas-head":Hr?"":void 0,style:{overflowX:Kr?"auto":"hidden",overflowY:"hidden"},children:[Hr&&/* @__PURE__ */Un("div",{ref:Wr,className:"sf-canvas-head",children:/* @__PURE__ */Un(Hr,{device:lo})}),
|
|
50
|
-
/* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Xr,children:[
|
|
51
|
-
/* @__PURE__ */Un("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Zr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
|
|
52
|
-
/* @__PURE__ */Un(Ne.Provider,{value:Pl,children:/* @__PURE__ */Un(Gt,{},So)}),
|
|
53
|
-
/* @__PURE__ */Un(sn,{canvas:xo,session:Xl,model:as,measure:us,canDrop:hs,onDrop:gs,choose:Ql,onPick:Ss,onZoneAdd:ks,onSeamAdd:ks,zoneAddLabel:Lt.canvasAddBlock,words:Rt.canvas,readOnly:Boolean(pt),revision:St.data}),Lo.length>0&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:Lo.map(e=>
|
|
54
|
-
/* @__PURE__ */Un(dn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Zi(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),Ol?/* @__PURE__ */Un(Xn,{canvas:xo,tabs:os,onSelect:e=>{const n=oi.findIndex(n=>String(n.props.id)===e);n>=0&&Ui(n)}}):null]})]}),eo?/* @__PURE__ */Gn(Jn,{children:[
|
|
55
|
-
/* @__PURE__ */Un(y,{value:{selectChild:vl,addChild:bl,childRowName:Oi,blockRowName:Rl},children:/* @__PURE__ */Un(Jt,{mode:Ro,onOpenWebsiteSettings:nr.openSettings??(()=>{}),onOpenSiteStyles:nr.openStyles,onSelectNode:yr,onNotify:Lr,onHidePanel:_r,nodeActions:bt?ue(wt,bt.type):nt})}),
|
|
56
|
-
/* @__PURE__ */Un(Xe,{side:"right",width:Br.right,min:qe,max:Ze,defaultWidth:k.right,label:Lt.resizeSettingsPanel,onResize:Pr})]}):
|
|
57
|
-
/* @__PURE__ */Un(L,{side:"right",onShow:_r})]}),Ei.menu]})}))}export{tt as ScreenChrome};
|