efficient-easel 19.1.0 → 19.3.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/dist/chrome/chrome.css +11 -0
- package/dist/{chunk-3Z2MVLCD.js → chunk-4ES5JGGX.js} +1 -1
- package/dist/chunk-7OKL7HDV.js +1 -0
- package/dist/{chunk-LBOJCTTC.js → chunk-A6CY3TQ5.js} +1 -1
- package/dist/chunk-CNKVVHDA.js +63 -0
- package/dist/chunk-FIVU2COQ.js +2 -0
- package/dist/{chunk-6B542CLG.js → chunk-FMZGR7EG.js} +1 -1
- package/dist/chunk-H5YLVKGA.js +1 -0
- package/dist/{chunk-M5Q4VYOH.js → chunk-KOVJODTY.js} +11 -11
- package/dist/{chunk-YZALWZT7.js → chunk-KWE5U6CE.js} +1 -1
- package/dist/{chunk-MZ5PWTDV.js → chunk-ME4V6PML.js} +4 -4
- package/dist/chunk-OGBYHQE6.js +5 -0
- package/dist/chunk-P5VYGWYO.js +1 -0
- package/dist/{chunk-G3GWAP5R.js → chunk-QAJAEWCZ.js} +1 -1
- package/dist/chunk-U6LF5YVK.js +8 -0
- package/dist/{chunk-5ZBV5RA6.js → chunk-VULUDKA3.js} +17 -17
- package/dist/chunk-YOXKBOZX.js +1 -0
- package/dist/{chunk-WXFZD7WC.js → chunk-ZKY45F5G.js} +1 -1
- package/dist/chunk-ZO3UUK45.js +18 -0
- package/dist/{chunk-2XMHLXMA.js → chunk-ZOBSIXRD.js} +1 -1
- package/dist/copy/index.js +14 -14
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/menu/index.d.ts +3 -3
- package/dist/menu/index.js +1 -1
- package/dist/node-ops/index.d.ts +11 -7
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +45 -1
- package/dist/panel/index.js +14 -13
- package/dist/panel/panel.css +33 -12
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +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.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +9 -0
- package/dist/strings/index.js +1 -1
- package/dist/style-clipboard/index.d.ts +1 -1
- package/dist/text-styles/index.js +23 -23
- package/dist/{types-BsyPh6EW.d.ts → types-BbOBWXMP.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/chunk-32JJK7PQ.js +0 -8
- package/dist/chunk-3WLT3GQS.js +0 -1
- package/dist/chunk-5Z6KYASQ.js +0 -1
- package/dist/chunk-BALFHI3G.js +0 -2
- package/dist/chunk-FCRNT5PM.js +0 -5
- package/dist/chunk-GNMBJUG7.js +0 -62
- package/dist/chunk-OSPUG6S6.js +0 -1
- package/dist/chunk-SGFDUXUH.js +0 -18
- package/dist/chunk-Y6RJAOFH.js +0 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{
|
|
1
|
+
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as r,isDefaultTextStyle as o,CAMPAIGN_TEXT_STYLE_SETTINGS as d,TEXT_STYLE_SETTINGS as c,textStyleRowSize as u,describeTextStyle as m,updateTextStyle as h,textStyleCaseCss as f,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as y,TEXT_STYLE_RANGES as S}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as g}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as k}from"../chunk-P2VEMZH5.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as A,ChevronIcon as L,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as W,CaseCapitalizedIcon as $,CaseUpperIcon as D,CaseNormalIcon as X}from"efficient-shell/icons/efficient";import{jsxs as Y,jsx as I,Fragment as F}from"react/jsx-runtime";var H=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */Y("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
2
|
/* @__PURE__ */Y("div",{className:"es-ts-top",children:[
|
|
3
3
|
/* @__PURE__ */I("span",{className:"es-ts-sub",children:l}),
|
|
4
4
|
/* @__PURE__ */I("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
|
|
5
5
|
/* @__PURE__ */Y("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */I(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */I(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
|
|
6
|
-
/* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:
|
|
7
|
-
return I("div",{className:"es-ts",ref:X,children:
|
|
8
|
-
return Y(
|
|
9
|
-
return I(
|
|
10
|
-
/* @__PURE__ */I("span",{className:"es-ts-add-word",children:
|
|
11
|
-
/* @__PURE__ */I("span",{className:"es-ts-count",children:
|
|
6
|
+
/* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:H,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */I(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function R({styles:e,onChange:s,fonts:t,colours:n=[],settings:c=d,auto:u=[],fallback:m,sample:h,openId:f,defaultOpenId:p=null,onOpenChange:S,onAdd:g,rowActions:N,onRemove:C,max:x=r,device:T="desktop",readOnly:_=!1}){const L=b("textStyles",a),j=z(),[M,W]=w(p),$=void 0!==f?f:M,D=e=>{void 0===f&&W(e),S?.(e)},X=E(null),[H,P]=w(null);O(()=>{if(!H||!X.current)return;const e=[...X.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===H.id),s=e?e.querySelector(".es-ts-row"):X.current.querySelector(`.es-ts-add[data-ts-kind="${H.kind}"]`);s?.focus(),P(null)},[H]);/* @__PURE__ */
|
|
7
|
+
return I("div",{className:"es-ts",ref:X,children:l.map(a=>{const l=e.filter(e=>e.kind===a),r=!i(e,a,x),d=!_&&!r;/* @__PURE__ */
|
|
8
|
+
return Y(B,{label:L.groups[a],children:[l.map(a=>{const l=N?.(a),i=null!=l&&!1!==l,r=Boolean(C)&&!_&&!o(a);/* @__PURE__ */
|
|
9
|
+
return I(G,{style:a,fonts:t,colours:n,settings:c,auto:u,fallback:m,sample:h,device:T,readOnly:_,open:$===a.id,onOpenChange:e=>D(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:r||i?/* @__PURE__ */Y(F,{children:[r?k(L.remove,/* @__PURE__ */I("button",{type:"button",className:"es-ts-del","aria-label":L.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=y(e,t.id,{name:L.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];$===t.id&&D(null),s(a.styles),C(a.removed),P({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */I(A,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},a.id)}),k(!_&&r?L.full({kind:a,max:x}):void 0,/* @__PURE__ */Y("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!r)||void 0,"aria-describedby":!_&&r?`${j}-full-${a}`:void 0,onClick:()=>{d&&(t=>{if(_)return;const a=v(e,t,{max:x,name:L.styleName,make:g});a&&s(a.styles)})(a)},children:[
|
|
10
|
+
/* @__PURE__ */I("span",{className:"es-ts-add-word",children:L.add[a]}),
|
|
11
|
+
/* @__PURE__ */I("span",{className:"es-ts-count",children:L.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */I("span",{id:`${j}-full-${a}`,className:"es-vh",children:L.full({kind:a,max:x})})]},a)})})}function B({label:e,children:s}){const t=z();/* @__PURE__ */
|
|
12
12
|
return Y("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
-
/* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function
|
|
13
|
+
/* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function G({style:e,fonts:s,colours:t=[],settings:n=d,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:f,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=b("textStyles",a),k=`${z()}-open-${e.id}`,N=new Set(l),C=c.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===y,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${u(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
14
|
return Y(_,{children:[
|
|
15
15
|
/* @__PURE__ */Y("div",{className:"es-ts-item","data-ts-id":e.id,children:[
|
|
16
|
-
/* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":
|
|
17
|
-
/* @__PURE__ */I("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */I(
|
|
16
|
+
/* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?k:void 0,onClick:()=>f(!o),children:[
|
|
17
|
+
/* @__PURE__ */I("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */I(L,{size:12})}),
|
|
18
18
|
/* @__PURE__ */I("span",{className:"es-ts-name",style:O,children:e.name}),
|
|
19
|
-
/* @__PURE__ */I("span",{className:"es-ts-meta",children:
|
|
20
|
-
return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:
|
|
19
|
+
/* @__PURE__ */I("span",{className:"es-ts-meta",children:m(w,s,g,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),v?/* @__PURE__ */I("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */I("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */I(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:s=>p(h([e],e.id,s)[0])})}):null]})}var U={none:X,upper:D,capitalize:$,lower:W};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const h=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),y=e=>"largestSize"===e||r.has(e),g=e=>y(e)?h[e]:s[e],b=g("size"),N=c&&void 0!==h.sizePhone?h.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=y("letterCase")?h.letterCase:s.letterCase,E={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:f(w)},z=e=>{const t=S[e],a=y(e);/* @__PURE__ */
|
|
20
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:d.settings[e],value:h[e],onChange:s=>m({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
|
|
21
21
|
return Y(F,{children:[
|
|
22
|
-
/* @__PURE__ */I("div",{className:"es-ts-preview",style:
|
|
23
|
-
return I(q,{value:
|
|
24
|
-
return I(K,{value:
|
|
22
|
+
/* @__PURE__ */I("div",{className:"es-ts-preview",style:E,"aria-label":d.preview,children:o}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
23
|
+
return I(q,{value:h.font,fonts:a,words:d,readOnly:u,set:m},t);case"color":/* @__PURE__ */
|
|
24
|
+
return I(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
|
|
25
25
|
return Y("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
26
|
-
/* @__PURE__ */I("span",{className:"es-ts-sub",children:
|
|
27
|
-
/* @__PURE__ */Y("div",{className:"es-ts-icons",children:[
|
|
28
|
-
return I(V,{value:
|
|
29
|
-
return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:
|
|
26
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",children:d.settings.emphasis}),
|
|
27
|
+
/* @__PURE__ */Y("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */I(j,{size:16})})),u||a?k(d.italic,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),disabled:u,onClick:()=>m({italic:!s.italic||void 0}),children:/* @__PURE__ */I(M,{size:16})})):/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */I(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return I(V,{value:h.letterCase??s.letterCase,auto:y("letterCase"),words:d,readOnly:u,set:m},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return c?(()=>{const e=S.size;/* @__PURE__ */
|
|
29
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:d.settings.size,value:h.sizePhone,onChange:e=>m({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:u})},"size")})():z(t);default:return z(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=z();/* @__PURE__ */
|
|
30
30
|
return Y("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
|
-
/* @__PURE__ */I("span",{className:"es-ts-sub",id:
|
|
32
|
-
/* @__PURE__ */I(
|
|
33
|
-
return I(
|
|
31
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
32
|
+
/* @__PURE__ */I(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
|
33
|
+
return I(P,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...p]:p,i=e??(s?"auto":"none"),r=E([]),o=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
34
34
|
return Y("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
35
35
|
/* @__PURE__ */I("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
36
|
-
/* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;
|
|
36
|
+
/* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;o(l[t]),r.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return k(t.case.autoTitle,/* @__PURE__ */I(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:t.case.auto},e));const l=U[e];return k(t.case[e],/* @__PURE__ */I(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:/* @__PURE__ */I(l,{size:16})},e))})})]})}export{P as ColourSwatchRow,G as TextStyleItem,B as TextStylesGroup,R as TextStylesList};
|
|
@@ -20,6 +20,9 @@ interface EaselContextMenuItem {
|
|
|
20
20
|
/** Draw a tick beside this item — for a submenu whose entries are STATES
|
|
21
21
|
* rather than actions, so it can say which one you are already on. */
|
|
22
22
|
checked?: boolean;
|
|
23
|
+
/** Drawn greyed: offered, but not possible here (Move up on the first
|
|
24
|
+
* node). The shell's entry takes no choice while it is set. */
|
|
25
|
+
disabled?: boolean;
|
|
23
26
|
/**
|
|
24
27
|
* A glyph for the row, drawn before the label.
|
|
25
28
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.3.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",
|
package/dist/chunk-32JJK7PQ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-FCRNT5PM.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-M5Q4VYOH.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SGFDUXUH.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as M}from"efficient-shell/icons/efficient";import{ContextMenu as T,toast as A,Dialog as F,Button as N}from"efficient-shell/ui";import{jsx as $,jsxs as x,Fragment as D}from"react/jsx-runtime";function H({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
-
return $(F,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(D,{children:[
|
|
3
|
-
/* @__PURE__ */$(N,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
-
/* @__PURE__ */$(N,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var I=e=>`section:${e}`,O=e=>`block:${e}`,S=e=>`template:${e}`,B=e=>`shared:${e}`;function E({at:w,placeBlocks:F,canTake:N,onPick:E,itemFor:L,session:P,siteWide:z,onClose:Q,onHide:R,readOnly:U}){const V=u(e=>e.config),W=a(),{labelAtLevel:Y,categoryLabel:G,firstSection:K,Icon:Z,Thumbnail:_}=W,{blockIsOffered:J,canAddTo:X}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>J(e,te);return l(te).list().then(n=>{if(e)return;const l=V.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>J(e,te);return r(te).list().then(n=>{if(e)return;const l=V.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(V,W),[V]),ye=e=>Y(e,"section",V.components[e]?.label??e),he=e=>({type:I(e.type),label:e.name,cover:/* @__PURE__ */$(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */$("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */$(Z,{type:e,size:26})}),be=j(()=>{const e=t(ue,K),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!J(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=X(t.type)?.choices??[];e.forEach(l),e.forEach(e=>X(e.type,1)?.choices?.forEach(l))}F?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:O(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:B(e.id),label:e.title,cover:/* @__PURE__ */$(_,{type:e.node.type}),mark:/* @__PURE__ */$(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */$(_,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(V.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(V,t,G),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!N)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?N(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,V,q,N,F,te]);/* @__PURE__ */
|
|
5
|
-
return x(D,{children:[
|
|
6
|
-
/* @__PURE__ */$(i,{icon:/* @__PURE__ */$(M,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */$(s,{label:q.done,description:q.doneDescription,onClick:Q}),onHide:R}),
|
|
7
|
-
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */$(k,{groups:be,session:P,itemFor:e=>L(ke(e)??{kind:"section",type:e}),onInsert:E?e=>{const t=ke(e);t&&E(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!U&&(pe({section:n.section,...t}),!0)},at:w,hint:q.hint,searchLabel:q.search,readOnly:U,words:ee}),z??null]}),de?/* @__PURE__ */$(T,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */$(H,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void A.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{E as AddSidePanel,O as blockKey,I as sectionKey,B as sharedKey,S as templateKey};
|
package/dist/chunk-3WLT3GQS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-FCRNT5PM.js";import{useEasel as t,useEaselApi as n}from"./chunk-M5Q4VYOH.js";import{newNodeId as o,ROOT_ZONE as r}from"./chunk-PLVEGYK6.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=t(e=>e),d=n(),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,t=(t,n,r)=>{const s=o(n);return c||e({type:"insert",componentType:n,destinationZone:t,destinationIndex:r,id:s}),s},n=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,o,r)=>n(t(e,o,r));return{insertComponent:i,insertSection:(e,t)=>i(r,e,t),replaceComponent:s,seedChild:(e,o,r,i)=>{const p=t(e,r,o);s(e,o,{type:r,props:{id:p,...i}}),n(p)},insertNode:(e,o,r)=>{const i=t(e,r.type,o);return s(e,o,{type:r.type,props:{...r.props,id:i}}),n(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};
|
package/dist/chunk-5Z6KYASQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-3WLT3GQS.js";import{SELECTION_MODE as e}from"./chunk-FCRNT5PM.js";import{useEasel as r}from"./chunk-M5Q4VYOH.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{decodePartId as n,encodePartId as p}from"./chunk-IYT6NN2J.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}=r(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=n(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?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?p(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-BALFHI3G.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";function r(e){return e.map((e,n)=>{const l=String(n);if("—"===e.label)return{type:"divider",key:l};if(e.header)return{type:"label",key:l,label:e.label};if(e.children?.length){const n=e.children.some(e=>void 0!==e.checked);return{type:"submenu",key:l,label:e.label,icon:i(e),items:e.children.map((e,l)=>n?{type:"radio",key:String(l),label:c(e),icon:i(e),checked:Boolean(e.checked),onSelect:e.onClick}:{type:"item",key:String(l),label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick})}}return{type:"item",key:l,label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick}})}function t(e){return e.find(e=>e.header)?.label}function i(n){return null==n.icon?void 0:/* @__PURE__ */e("span",{className:"es-menu-icon","aria-hidden":"true",children:n.icon})}function c(r){return null==r.icon&&null==r.shortcut?r.label:/* @__PURE__ */n(l,{children:[
|
|
2
|
-
/* @__PURE__ */e("span",{className:"es-menu-label",children:r.label}),null==r.shortcut?null:/* @__PURE__ */e("span",{className:"es-menu-shortcut","aria-hidden":"true",children:r.shortcut})]})}export{r as easelMenuEntries,t as menuLabel};
|
package/dist/chunk-FCRNT5PM.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-LNHT2KPX.js";import{EaselCanvas as e,useSelectedFields as t}from"./chunk-M5Q4VYOH.js";import{Inspector as r}from"./chunk-5ZBV5RA6.js";import{slotFieldsOf as i}from"./chunk-PLVEGYK6.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(n,e,t){const r=n.slotsOf?.(t);return r||i(e,t.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=()=>k,v=()=>"",g=()=>null,y=()=>{},b={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},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
-
return s(e,{height:"fill"})}function S(){const{id:n,fields:e,values:i,readOnly:o,onChange:u}=t();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(r,{fields:e,values:i,onChange:u,readOnly:o,idPrefix:n})})}var N=o({});function B({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(N.Provider,{value:n,children:e})}function C(){return u(N)}function D(){return(C().useOwnerName??v)()}function G(){return(C().useDocumentLabel??g)()}function x(n,e,t,r){return(C().useBridges??h)(n,e,t,r)}function I(n){return(C().useStandaloneBridges??h)(n)}function T(n,e){(C().useDocumentPass??y)(n,e)}function V(){return C().blockRules??b}function A(){return C().blockLook??O}function F(){return C().devices??L}function H(){return C().leftView??j}function K(){return C().pinned??w}function R(){return C().saveSwitch??!0}function Y(e){n(!0===C().pickFollowsSelection,e)}function Z(){return C().storageNamespace||void 0}function E(){return C().styleClipboard??null}function M(){return C().nodeKeys??!0}function Q(){return C().notify??null}function X(){return C().Canvas??P}function q(){return C().CanvasHead??null}function z(){return C().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(J.Provider,{value:n,children:e})}function W(){return u(J)}function $(){return C().Inspector??S}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,B as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,V as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,X as useScreenCanvasFrame,q as useScreenCanvasHead,W as useScreenCanvasTarget,F as useScreenDevices,G as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,H as useScreenLeftView,M as useScreenNodeKeys,Q as useScreenNotify,D as useScreenOwnerName,C as useScreenParts,Y as useScreenPickFollowsSelection,K as useScreenPinned,R as useScreenSaveSwitch,Z as useScreenStorageNamespace,E as useScreenStyleClipboard,I as useStandaloneScreenBridges};
|
package/dist/chunk-GNMBJUG7.js
DELETED
|
@@ -1,62 +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-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-LBOJCTTC.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-5Z6KYASQ.js";import{useSectionOps as k}from"./chunk-3WLT3GQS.js";import{ScreenSaveIcon as v,ScreenMainButton as S}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as b}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-32JJK7PQ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as O,PanelShowStrip as N}from"./chunk-SINAM2IT.js";import{offeredChoices as I}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as M,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as j,useScreenDevices as L,useScreenPickFollowsSelection as A,useScreenLeftView as E,SELECTION_MODE as R,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as W,useScreenNotify as J,useScreenCanvasHead as U,isSlotMode as Y,useScreenStyleClipboard as G,useScreenDocumentPass as K,useScreenCanvasDrag as X,ScreenCanvasTargetProvider as Q,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as _}from"./chunk-FCRNT5PM.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-Y6RJAOFH.js";import{PageEditGuardNotices as oe}from"./chunk-5DPIGWUL.js";import{useScreenDocument as re}from"./chunk-M62P4IQK.js";import{requestMediaPick as ie}from"./chunk-RYNBSKE7.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-LNHT2KPX.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as fe}from"./chunk-U3JP4VGF.js";import{LayersIcon as he,MediaIcon as me}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ve}from"./chunk-6WY6ZXJG.js";import{useEasel as Se,useEaselApi as be,CanvasPassThroughContext as we,CanvasSharedContext as xe}from"./chunk-M5Q4VYOH.js";import{TreeRow as ze,Subtree as Ce,LayersTree as Oe,TreeGroupLabel as Ne,TreeRowAction as Ie,TreeSeam as Be}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Pe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Me}from"./chunk-WK3AFPXY.js";import{toItemSelector as $e,useNodeOps as Te,clickPick as je}from"./chunk-X3TYRF5V.js";import{EaselTopBar as Le,TopBarRail as Ae,TopBarCluster as Ee,EaselIconButton as Re,TopBarDivider as Fe,DeviceSwitch as De,InspectorIconButton as Ve,PanelResizeHandle as He,MAX_PANEL_W as We,MIN_PANEL_W_BY_SIDE as Je,panelWidthVars as Ue}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as Ye,DEFAULT_CHROME_WORDS as Ge}from"./chunk-AJSDWWJW.js";import{holderOf as Ke,nameOrSomeone as Xe}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Qe}from"./chunk-RE4LP46F.js";import{useWords as Ze}from"./chunk-MFIRYGHW.js";import{insertSeams as qe,CanvasDragLayer as _e,CanvasInsert as en}from"./chunk-SGFDUXUH.js";import{DEFAULT_DRAG_WORDS as nn}from"./chunk-KAML3KQH.js";import{createDragSession as tn,useTreeDrag as on,gapToMoveIndex as rn}from"./chunk-67GNT6PF.js";import{ROOT_ID as ln,ROOT_SLOT as sn,zoneKey as dn,parseZoneKey as an,find as cn,DataError as pn}from"./chunk-KRXQM65X.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasTyping as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as kn,BLOCK_ATTRIBUTE as vn,drawnBox as Sn}from"./chunk-X4T6JT3M.js";import{rootRowName as bn,slotChildRowName as wn,slotChildRenameProp as xn,sectionRenameProp as zn}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as Cn,blockNodeActions as On,TREE_MAX_DEPTH as Nn,childSlotsOf as In,slotFieldsOf as Bn,newNodeId as Pn,slotChildrenIn as Mn,nestsInTree as $n}from"./chunk-PLVEGYK6.js";import{useRef as Tn,useMemo as jn,useState as Ln,useEffect as An,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Vn,toast as Hn,readMediaFileDrag as Wn,Tooltip as Jn,groupColors as Un,Dialog as Yn,FormField as Gn,Input as Kn,Button as Xn,MEDIA_FILE_DRAG_TYPE as Qn}from"efficient-shell/ui";import{UndoIcon as Zn,RedoIcon as qn,RefreshIcon as _n,AddIcon as et,TrashIcon as nt,EyeOffIcon as tt,EyeIcon as ot,SharedIcon as rt,DuplicateIcon as it}from"efficient-shell/icons/efficient";import{jsx as lt,jsxs as st,Fragment as dt}from"react/jsx-runtime";var at="media-file";function ct({name:e,onMake:n,onCancel:t}){const o=Ze("screen",ge).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=Tn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return lt(Yn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */st(dt,{children:[
|
|
3
|
-
/* @__PURE__ */lt(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */lt(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */lt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */lt(Gn,{label:o.name,htmlFor:d,children:/* @__PURE__ */lt(Kn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var pt=/* @__PURE__ */new WeakSet;function ut(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 ft({canvas:e,tabs:n,onSelect:t}){const o=Tn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{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=kn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${vn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Sn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=kn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */lt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */lt("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:e.reach?
|
|
5
|
-
/* @__PURE__ */lt(Jn,{content:e.reach,children:/* @__PURE__ */st(Vn,{colorClass:Un("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */lt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */lt(rt,{size:12})}),e.label]})}):/* @__PURE__ */lt(Vn,{colorClass:Un("info","solid"),size:"sm",children:e.label})},e.id):null})})}function ht({expand:e}){/* @__PURE__ */
|
|
7
|
-
return lt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */st(dt,e?{children:[
|
|
8
|
-
/* @__PURE__ */lt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */lt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */lt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */lt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */lt("path",{d:"M5 12h14"})]})})}var mt=`${fn}, ${hn}`;function gt(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 yt="__rungs";var kt="screen:band",vt={duplicate:!0,delete:!0};function St(){const fn=ue(),{target:kn,docId:vn,capabilities:Sn,currentSlug:Dn,siteId:Jn,onPublish:Un,saveState:Yn,saveConflict:Gn,retrySave:Kn,toggleAutoSave:Xn,flushSave:rt,access:St,saveUnreachable:bt=!1,readOnly:wt,readOnlyReason:xt=null}=re(),zt=B(),Ct=P(),{mediaEditing:Ot,hasEditGuard:Nt,hasPinnedChrome:It}=Sn,{appState:Bt,dispatch:Pt,history:Mt,selectedItem:$t,getSelectorForId:Tt,config:jt}=Se(e=>e),Lt=M(),{first:At,firstGroup:Et,lastGroup:Rt,isSectionGroup:Ft,sectionGroupZone:Dt,panelOf:Vt}=Lt,Ht=Vt(At),Wt=e=>Z(Lt,e),Jt=e=>q(Lt,e),Ut="node"===Lt.firstRow,Yt=Lt.band??null,Gt=Ze("screen",ge),Kt=Ze("tree",Pe),Xt=Ze("drag",nn),Qt=Ze("notice",Ye),Zt=Ze("lock",Qe),qt=Ze("menu",Me),_t=Ze("styleClipboard",ve),eo=Ze("chrome",Ge),no=$()??`/${Dn}`,to=T(),oo=j(),ro=k({readOnly:wt}),io=k({readOnly:wt,foldIntoHistory:!0}),lo=Tn(null),so=be(),ao=jn(()=>({...ro,select:e=>{lo.current=e,ro.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=so.config;lo.current=$e(e,t,n)}ro.commitDocument(e,n)}}),[ro,so]),co=Bt.ui,po=co.leftSideBarVisible,uo=co.rightSideBarVisible,{options:fo,widths:ho,initial:mo,fluid:go,fit:yo}=L(),[ko,vo]=Ln(mo),So=le(),bo=Ot&&null!==So,wo=se(),xo=de(),zo=null!==wo||xo,Co=ae();A($t?.props.id);const{read:Oo,write:No,forSelection:Io}=E(),[Bo,Po]=Ln(Oo);An(()=>{No(Bo)},[Bo]);const[Mo,$o]=Ln(0),To=Tn(null),jo=Tn(null),Lo=un(jo,{readySelector:mt}),Ao=mn(Lo),Eo=a(jo);c(jo,Lo);const Ro=b(),Fo=Ke(St),Do={state:Yn,offline:Ro||Yn.failed&&bt,readOnlyReason:xt,editing:Fo?Qt.editing({name:Xe(Fo.name,Zt),noun:Gt.noun}):null,conflict:null!=Gn,notSaving:Gt.bar.notSaving},Vo=()=>{wt||(Yn.failed?Kn():rt())};p(jo,Lo,Vo);const[Ho,Wo]=Ln(!1),Jo=Tn(!1),[Uo,Yo]=Ln(null),[Go,Ko]=Ln([]),[Xo,Qo]=Ln(R),Zo="puck"===Xo.kind,qo=o(Xo,$t?.props.id),[_o,er]=Ln(null);An(()=>{_o&&(r(),er(null))},[_o]);const nr=Tn(Tt);nr.current=Tt;const tr=En((e,{scroll:n})=>{Po(n=>Io(e,n)),n&&er(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=nr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Mr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),or=Tn(null);An(()=>{const e=or.current;or.current=null;const n=null==$t?.props.id?null:String($t.props.id);Qo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Vt($t?.type)??R);const t=$t?.props.id,o=lo.current;if(lo.current=null,!t)return;const r=Tt(t);tr(String(t),{scroll:!i(o,r??null,Cn)})},[$t?.props.id,tr]);const rr=En(e=>{Qo(n=>F(n,e)?n:e),Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Pt]),ir=Tn(()=>{});ir.current=(e,n)=>{const t=e?Ii(e.zone??Cn)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==$t?.props.id?null:String($t.props.id);Qo(e=>F(e,n)?e:n),o!==r&&(or.current={id:o,mode:n},ao.select(e))};const lr=En((e,n)=>ir.current(e,n),[]),sr={kind:Xo.kind,mode:Xo,open:rr,show:e=>Qo(e),reveal:()=>{uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:lr},dr=D(sr,{data:Bt.data,selected:$t??null,zoneOf:e=>Tt(e)?.zone,readOnly:Boolean(wt),select:e=>{Qo(R),ao.select({index:e})},replace:(e,n)=>ao.replaceComponent(Cn,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:Po,reveal:()=>{po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ar=dr.resolveLeftView?dr.resolveLeftView(Bo):"sections",cr=V(),{isLockedBlock:pr,duplicateBlocked:ur,nestDepth:fr,newSectionNode:hr,canAddTo:mr,blockIsOffered:gr}=cr,yr=H(),{labelAtLevel:kr,Icon:vr,useProducts:Sr}=yr,br=yr.rowName?(e,n,t)=>yr.rowName(e,n,t):void 0,wr=En(e=>{Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),tr(e,{scroll:!0})},[Pt,tr]),{selectNode:xr,openPartId:zr}=y({mode:Xo,setMode:Qo,onOpenPart:wr}),[Cr,Or]=Ln(null);fe(null!==Cr,()=>Or(null));const Nr=h(W()),Ir=Nr.collapsed,Br=Nr.panelWidths,[Pr,Mr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ir);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});An(()=>{try{window.localStorage.setItem(Ir,JSON.stringify([...Pr]))}catch{}},[Pr]);const[$r,Tr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Br);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});An(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Br,JSON.stringify($r))}catch{}},300);return()=>clearTimeout(e)},[$r]);const jr=En((e,n)=>Tr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Lr=En(e=>jr("left",e),[jr]),Ar=En(e=>jr("right",e),[jr]),Er=e=>Pr.has(e),Rr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=Tn(!1),Dr=Tn(null);An(()=>{if(Fr.current&&!Ho){const e=Dr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??jo.current?.querySelector(`button[aria-label="${CSS.escape(Gt.add.title)}"]`))?.focus(),Dr.current=null}Fr.current=Ho},[Ho]),An(()=>{if(!Ho||!Eo)return;const e=e=>{"Escape"===e.key&&ll()};return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Ho,Eo]),fe(Ho,()=>ll()),An(()=>{!po&&Ho&&(Wo(!1),Yo(null),Jo.current=!1)},[po]);const Vr=J(),Hr=(e,n="success",t)=>{if(Vr)return void(t?Vr(e,"error"===n?"error":"info",t):Vr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Hn.error(e,{...o,duration:t?.duration??3200}):Hn.success(e,{...o,duration:t?.duration??1900})},Wr=Tn(null),[Jr,Ur]=Ln(0),[Yr,Gr]=Ln(0),Kr=U(),Xr=Tn(null),Qr=e=>Math.max(0,e.clientHeight-(Xr.current?.offsetHeight??0));An(()=>{const e=Wr.current;if(!e)return;const n=()=>{Ur(e.clientWidth),Gr(Qr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Xr.current&&t.observe(Xr.current),()=>t.disconnect()},[]),Rn(()=>{Wr.current&&(Ur(Wr.current.clientWidth),Gr(Qr(Wr.current)))},[$r,po,uo]);const Zr=ko===go?Jr>0?Jr:ho[go]:ho[ko],qr=Jr>0?Math.min(Jr/Zr,"shrink"===yo?1:2):1,_r=Zr*qr,ei=Jr>0&&_r>Jr+1,ni={width:_r,height:Yr||"100%",flex:"none",position:"relative"},ti={width:Zr,height:Yr?Yr/qr:"100%",maxHeight:"none",transform:1!==qr?`scale(${qr})`:void 0,transformOrigin:"top left"},oi=()=>Pt({type:"setUi",ui:{leftSideBarVisible:!po}}),ri=()=>Pt({type:"setUi",ui:{rightSideBarVisible:!uo}}),ii=e=>{Ho&&(Wo(!1),Yo(null),Jo.current=!1,po&&Bo===e)||(po&&Bo===e?oi():(Po(e),po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})))},li=()=>{ie(fn,{accept:"image/*",title:eo.mediaLibrary})},si=()=>{Qo(R),ao.select(null),d()},di=()=>{Qo(Ht??R),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},ai=Bt.data.content??[],ci=()=>{const e=ai.findIndex(Wt),n=ai.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ai.length}},pi=jt,ui=cr.stripCopy,fi=n=>e(n,ui),hi=ne(),mi=Te({data:Bt.data,config:pi,readOnly:Boolean(wt),clipboard:hi,strip:ui?e=>ui(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==ln||e.slot!==sn)return{min:0,max:n-1};const{floor:t,cap:o}=ci();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Qo(R);const t=void 0===n||"node"===n?.kind?n:null;ao.commitDocument(e,t)}}),gi=pe(),[yi,ki]=Ln(null),vi=e=>{const n=ai.find(n=>String(n.props.id)===e),t=Lt.shared;n&&t&&mi.swap(e,t.detach(n))},Si=e=>{const n=cn(Bt.data,jt,e);if(!n)return!1;const t=dn(n.place),o=n.node,r=t===Cn?Ci(o):Fi(o),i=t===Cn?Lt.shared?.usedOn(o):null;return!!mi.remove(e)&&(Hr(i?Gt.shared.removed({count:Math.max(0,i.length-1)}):Gt.deleted({name:r}),"success",{duration:8e3,action:{label:Gt.bar.undo,onClick:()=>{mi.restore(n.node,n.place)}}}),!0)},bi={...mi,remove:Si},wi=e=>kr(e,"block",jt.components[e]?.label??e),xi=En(e=>jt.components[e]?.defaultProps??{},[jt]),zi=e=>kr(e,"section",wi(e)),Ci=e=>bn({type:e.type,props:e.props??{}},zi(e.type),br),{nodeAddresses:Oi,zoneItems:Ni}=jn(()=>{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>=Nn)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of In(jt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ai,Cn,0),{nodeAddresses:e,zoneItems:n}},[ai,jt]),Ii=En(e=>Ni.get(e)??[],[Ni]),Bi=e=>{const n=Oi.get(e);return n?Ii(n.zone)[n.index]:void 0},Pi=e=>_(cr,jt,e),Mi=e=>{if(!cr.slotsOf||e===Cn)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Bi(e.slice(0,n));if(!t)return null;const o=Pi(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}},$i=(()=>{if(!Y(Xo))return null;const e=`${Xo.nodeId}:${Xo.slot}`;return Mi(e)?.slot.panel===Xo.kind?e:null})(),Ti=Tn(null);An(()=>{const e=Ti.current;if(Ti.current=null,!$i||!Y(Xo))return;const n=Xo.nodeId;tr(n,{scroll:e!==$i}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Xo]);const ji=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Oi.get(e);n&&(n.zone===Cn?_i(n.index):Ol(n.zone,n.index,e,Bi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$i!==i&&(Ti.current=i),lr(null,r),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Li=(e,n,t)=>{const o=`${e}:${n}`;if(Mr(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;$i!==o&&(Ti.current=o);lr(null,{kind:t,nodeId:e,slot:n})},Ai=(e,n,t)=>{if(wt||!cr.moveSlot)return;const o=Bi(e),r=o?Pi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:yt,index:n},s=rn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=cr.moveSlot(e,n,s);"string"==typeof d&&Li(e,d,i.panel)},Ei=Sr(),Ri=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ei??[])e.set(n.slug,n.name);return e},[Ei]),Fi=e=>wn(e,wi,yr.plainText,e=>Ri.get(e),yr.rowName),Di=(e,n)=>{const t=jt.components[e.type]?.fields,o=n===Cn||ql(n)?"section":"block",r=n===Cn&&(Wt(e)||Jt(e)||Ft(e.type)),i="block"===o?xn(t):r?null:zn(t);return yr.renamePropOf?yr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!wt&&Cr?.zone===e&&Cr.index===n))return;const r=(t,o)=>{Or(null),o&&((e,n,t)=>{const o=Ii(e)[n];if(!o)return;const r=Di(o,e);r&&ao.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return lt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Gt.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)},Hi=t(G(),_t),Wi=Hi.scope({target:kn,siteId:Jn,docId:vn}),Ji=jt,Ui=(e,n)=>n===Cn?zi(e):wi(e),Yi=(e,n,t)=>{const o=Hi.plan(Wi,t,Ui(t.type,e),Ji);o&&(o.changed&&ao.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Hr(o.message))},Gi=te({nodesIn:Ii,nodeAt:(e,n)=>Ii(e)[n]??null,labelOf:(e,n)=>n===Cn?zi(e):wi(e),renamePropOf:Di,beginRename:(e,n)=>Or({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{ao.select(null),Qo(R)},pageSettingsLabel:Gt.pageSettings,words:{menu:qt,styleClipboard:_t,screen:Gt.menu},readOnly:Boolean(wt),collapseAll:()=>Mr(new Set(Ii(Cn).map(e=>String(e.props.id)))),onPasteRefused:e=>Hr(e?Gt.pasteRefused({name:e.label}):Gt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ns(e,n),menuRows:(e,n,t)=>{const o=dr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Lt.shared;if(!t||n!==Cn)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Gt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return wt||pr(e.type,e)?n:{...n,change:[{label:Gt.shared.detach,onClick:()=>vi(e.props.id)}],remove:[{label:Gt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return wt||Wt(e)||Jt(e)||Ft(e.type)?null:z(gi)?{change:[{label:Gt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ci(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>pr(e.type,e),duplicateBlocked:e=>ur(Bt.data,e),permits:e=>{const n=On(jt,e.type);return Lt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:bi,isPinned:(e,n)=>n===Cn&&(Wt(e)||Jt(e)),sectionBand:ci,locate:e=>Oi.get(e)??null,rowNameOf:(e,n)=>n===Cn?Ci(e):Fi(e),selectAt:(e,n,t,o)=>{e===Cn?_i(n):Ol(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>ji(n.node,n.slot,!1)}:null},style:{held:()=>ye(Wi),canCopy:e=>Hi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:(e,n,t)=>Yi(e,n,t)},keys:Ct?{target:Eo,selected:()=>{const e=Bt.ui.itemSelector;return e?{zone:e.zone??Cn,index:e.index}:null},held:()=>hi.get(),readOnly:Boolean(wt),onDone:({done:e,name:n})=>{"copied"===e&&Hr(Gt.copied({name:n}))}}:void 0},Lo),Ki=Tn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});An(()=>{Ki.current={copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:Yi,at:()=>{const e=Bt.ui.itemSelector;if(!e)return null;const n=e.zone??Cn,t=Ii(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(wt)}});const Xi=En(e=>{const n=ke(e);if(!n)return;const t=Ki.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))},[]);An(()=>{if(!Eo)return;const e=e=>Xi(e);return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Xi,Eo]),gn(Lo,"keydown",Xi);const Qi=ai.map(e=>e.props.id).join("|");An(()=>{const e=Lo?.document??null,n=Lo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ko(e=>e.length?[]:e);const n=ai.findIndex(Jt),t=n>=0?n:ai.length,o=n=>{const t=ai[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ai.length>0&&!Wt(ai[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=gt(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})}Ko(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()}},[Lo,Qi,ko,qr,po,uo,$t?.props.id]);const Zi=Lo?.document??null,qi=Lo?.window??null;An(()=>{const e=To.current;if(!e||!Zi||!qi)return;const n=[],t=()=>{const n=Zi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return To.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Zi,qi]);const _i=e=>{Qo(R),ao.select({index:e}),dr.sectionPressed?.(ai[e]);const n=ai[e]?.props?.id;n&&l(n)},el=e=>{const{floor:n,cap:t}=ci(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=$t&&Xo.kind!==Ht?.kind?ai.findIndex(e=>e.props.id===$t.props.id):-1;return o(r>=0?r+1:t)},nl=(e,n)=>{const{floor:t,cap:o}=ci(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(ao.reorderComponent(Cn,e,i),ao.select({index:i}),{moved:!0,dest:i})},tl=(e,n,t,o)=>{Qo(R),ao.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Hr(Gt.sectionAdded({name:t}))},ol=(e,n)=>{const t=el(n),o=hr(e,{nodeDefaults:xi,newNodeId:Pn,sectionLabel:zi,blockIsOffered:gr}),r=o?ao.insertNode(Cn,t,o):ao.insertSection(e,t);return tl(t,r,zi(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:a}of In(jt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=mr(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:a,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},rl=e=>il(Cn,e),il=(e,n)=>{Dr.current=document.activeElement??null,Yo(null===n?null:{zone:e,index:n}),Wo(!0),po||(Jo.current=!0,Pt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ll=()=>{Wo(!1),Yo(null),Jo.current&&Pt({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},sl=(e,n)=>yr.rowName?n?Wt(e)?yr.rowName(e,"section",Gt.header):Jt(e)?yr.rowName(e,"section",Gt.footer):Ft(e.type)?yr.rowName(e,"section",wi(e.type)):Ci(e):Fi(e):n?zi(e.type):wi(e.type),dl=e=>n=>{e()},al=(e,n,t)=>{if(wt)return null;const o=Ii(e)[n];return o&&!On(jt,o.type).delete||o&&pr(o.type,o)?null:/* @__PURE__ */lt(Ie,{kind:"delete",label:e===Cn&&o&&Lt.shared?.usedOn(o)?Gt.shared.removeFromPage:Gt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ii(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */lt(nt,{size:15})})},cl=e=>yr.rowPreview?.(e)||void 0,pl=e=>yr.rowMarks?.(e)??void 0,ul=(e,n,t)=>yr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(wt)return null;if(pr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return lt(Ie,{kind:"eye",label:r?Gt.showNamed({name:o}):Gt.hideNamed({name:o}),onClick:()=>ml(e,n,t),children:/* @__PURE__ */lt(r?tt:ot,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},hl=e=>Vs(Cn,e),ml=(e,n,t)=>{ao.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},gl=e=>Bn(jt,e),yl=e=>In(jt,e),kl=e=>cr.slotsOf?Pi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Mn(e,n.slot)})):[{slot:null,rung:null,kids:yl(e)}],vl=e=>cr.slotsOf?kl(e).flatMap(e=>e.kids):yl(e),Sl=e=>Boolean(cr.slotsOf)&&Pi(e).some(e=>e.rung),bl=(e,n,t)=>null===t?void 0===n?mr(e):mr(e,n):mr(e,n,t),wl=(e,n,t)=>{const o=$n(jt,e.type,n)&&(t||vl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Er(String(e.props.id))}},xl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>wl(e,r,t(e.type)).collapsible?[String(e.props.id),...xl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),zl=e=>vl(e).length>0||Sl(e)||Boolean(mr(e.type)),Cl=e=>Boolean(mr(e)),Ol=(e,n,t,o)=>{if(Qo(R),mr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),ao.select({index:n,zone:e}),l(t)}else ao.select({index:n,zone:e}),l(t)},Nl=(e,n,t,o,r)=>{const i=`${e}:${n}`;ao.insertComponent(i,t,o),mr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),ao.select({index:o,zone:i})}):ao.select({index:o,zone:i})},Il=Tn(/* @__PURE__ */new Set);An(()=>{ai.forEach(e=>{const n=mr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Il.current.has(t))return;Il.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(xi)).forEach((e,t)=>io.seedChild(o,t,n.childType,e))})},[ai,io,xi]);const Bl=Tn(/* @__PURE__ */new Set);An(()=>{ai.forEach((e,t)=>{const o=e.props.id;if(Bl.current.has(o))return;const r=n(e,gl(e.type));Bl.current.add(o),r&&io.replaceComponent(Cn,t,{...e,props:r})})},[ai,io]),K(io,jt);const Pl=ai.findIndex(Jt),Ml=Pl>=0?ai[Pl]:null,$l=Ut?ai.findIndex(Wt):-1,Tl=$l>=0?ai[$l]:null,jl=Lt.groupTab,Ll=jn(()=>jl?e=>Ft(e.type):void 0,[jl]),Al=Boolean(Lt.groupBadge),El=Lt.sharedReach,Rl=e=>El?.(e)??void 0,Fl=jn(()=>El?new Set(ai.filter(e=>Rl(e)).map(e=>String(e.props.id))):null,[ai,El]),Dl=jn(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Vl=Lt.first?El?.({type:Lt.first,props:{id:""}})??void 0:void 0,Hl=Lt.groupBadge?/* @__PURE__ */lt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */lt(Vn,{tone:"info",size:"xs",children:Lt.groupBadge})}):void 0,Wl=ai.find(e=>e.type===Et)??null,Jl=ai.find(e=>e.type===Rt)??null,Ul=Pl>=0?Pl:ai.length,Yl=[];ai.forEach(e=>{Jt(e)||(zl(e)&&Yl.push(String(e.props.id)),Yl.push(...xl(e,1,Cl)))}),Ml&&(Yl.push(String(Ml.props.id)),Yl.push(...xl(Ml,1,Cl)));const Gl=Yl.length>0&&Yl.every(e=>Pr.has(e)),Kl=e=>{const n=yr.blockRowName(e,wi);return yr.rowName?yr.rowName(e,"block",n):n},Xl=(e,n,t,o)=>{const r=Ii(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Ii(n).length)},s=rn(i,l);if(e!==n||s!==t)try{mi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},Ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of yl(e))n.add(r),t(o)};for(const t of gl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Zl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Oi.get(n);if(!e)return null;if(e.zone===Cn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Dt(n)===e?t:null},_l=(e,n)=>{const t=ql(e);return!t||(!Lt.groupAccepts||Lt.groupAccepts(t.type,n,Ii(e).length))},es=(e,n,t)=>{if(e.rung){const t=Bi(e.rung.nodeId),o=t?Pi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===yt&&n.index>=0&&n.index<=o}if(n.slot===yt)return!1;if(e.add)return rs(e.add,n);const o=dn(n);if(Ft(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!_l(o,e.type))&&(n.index>=0&&n.index<=Ii(o).length));if(e.zone===Cn||o===Cn){if(e.zone!==o)return!1;const{floor:t,cap:r}=ci();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ii(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Lt.lastIsOpen?String(Ml.props.id):null;return(!l||Zl(e.zone)!==l&&Zl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ii(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Oi.get(i),s=l?Ii(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ql(r).has(n))return!1;const d=mr(s.type,fr(Bt?.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?.(Ii(n),r))})(e.zone,o,e.index,t)},ns=(e,n)=>{const t=dn(e.from),o=e.node;return t===dn(n)?_l(t,o.type):es({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=Oi.get(n),o=t?Ii(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=mr(o.type,fr(Bt?.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=I(r.choices??(r.spec?[{type:r.spec.childType,label:wi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:sl(o,t.zone===Cn)}},os=(e,n)=>{if("section"!==e.kind)return e;const t=dn(n);return t===Cn||ql(t)?e:ts(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},rs=(e,n)=>{const t=os(e,n),o=dn(n);if("shared"===t.kind){if(o!==Cn||!Lt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return _l(o,e)&&n.index>=0&&n.index<=Ii(o).length}if(o!==Cn)return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if(o===Cn)return!1;const r=ts(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ii(o))},is=(e,n)=>{const t=os(e,n);if("block"!==t.kind&&ql(dn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&_l(n,o)){if("section"===e.kind)ao.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;ao.insertNode(n,t,fi(e.template.node))}Qo(R),ao.select({index:t,zone:n})}})(t,dn(n),n.index);if("section"===t.kind)return void ol(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=el(t),r=ao.insertNode(Cn,o,n);tl(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Lt.shared?.nodeOf(t.section);if(!e)return;const o=el(n.index);return void(mi.restore(e,{parentId:ln,slot:sn,index:o})&&tl(o,e.props.id,t.section.title))}const o=dn(n),r=ts(o);r&&(r.target.spec?Nl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{ao.insertComponent(e,n,t),Qo(R),ao.select({index:t,zone:e})})(o,t.type,n.index))},ls=(e,n)=>{e.media?function(e){const n=As();if(!n||!Ts)return;Rs(n).then(n=>{n&&function(e,n){if(!Ts)return;const t=Ts.create(e,{nodeDefaults:xi,newNodeId:Pn,sectionLabel:zi,blockIsOffered:gr}),o=dn(n);if(o===Cn){const e=el(n.index),o=ao.insertNode(Cn,e,t);return void tl(e,o,zi(t.type))}ao.insertNode(o,n.index,t),Qo(R),ao.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ai(e.rung.nodeId,e.index,n.index):e.add?is(e.add,n):e.zone===Cn?nl(e.index,n.index):Xl(e.zone,dn(n),e.index,n.index)},[ss]=Ln(()=>tn()),ds=on({keyOf:e=>e.id,readOnly:Boolean(wt),session:ss,canDrop:es,onDrop:ls,onStep:(e,n)=>{e.rung?Ai(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Cn?((e,n)=>{const t=zi(ai[e]?.type??""),o=nl(e,n<0?e-1:e+2);if(!o.moved)return void Hr(n<0?Gt.sectionFirst({name:t}):Gt.sectionLast({name:t}));const{floor:r,cap:i}=ci();Hr(Gt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Xl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),as=En(e=>{const{floor:n,cap:t}=ci(),o=[];for(const r of e.nodes){const e=dn(r.place),i=Ii(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Wt(i)||Jt(i)||pr(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(ql(e)),s=e===Cn||l;e===Cn&&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?zi(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=dn(e.list);if(n===Cn&&0===e.children.length)return[{...e,addLabel:Gt.addSection,addAlways:!0}];const t=ts(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=dn(e.list),t=n===Cn||ql(n)?null:ts(n);return t?.choices.length?qe(e,t.target.spec?.addLabel??Gt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Bt.data]),cs=null==$t?.props.id?null:String($t.props.id),ps=En(e=>{const n=jt,t=e=>!e.item.rung&&null!==cn(Bt.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(cs);return i||(r(je(Bt.data,n,o.item.id,cs,Ll))??o)},[Bt.data,jt,cs,Ll]),[us,fs]=Ln(null),hs=Boolean(jl||El);gn(Lo,"mouseover",e=>{if(!hs)return;const n=yn(e.target),t=n?ut(Bt.data,jt,n):null;t!==us&&fs(t)}),gn(Lo,"mouseout",e=>{hs&&!e.relatedTarget&&fs(null)});const ms=e=>Wt(e)||Jt(e)||Ft(e.type),gs=e=>{const n=Ft(e.type)?wi(e.type):Wt(e)?Gt.header:Jt(e)?Gt.footer:null;return null===n?Ci(e):yr.rowName?yr.rowName(e,"section",n):n},ys=[];if(hs){const e=cs?ut(Bt.data,jt,cs):null;for(const n of/* @__PURE__ */new Set([e,us])){const e=n?ai.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Wt(e)||e.type===Et,o=Rl(e);if(o){ys.push({id:String(e.props.id),label:gs(e),below:t,reach:o});continue}if(!jl||!ms(e))continue;const r=jl(e);r&&ys.push({id:String(e.props.id),label:r,below:t})}}const ks=pe(),vs=Tn(null);An(()=>{const e=Lt.changeNotice;if(!e)return;const n=JSON.stringify(ai.filter(ms)),t=vs.current;if(vs.current={doc:vn,bands:n,index:Mt.index},!t||t.doc!==vn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!pt.has(ks)&&(pt.add(ks),Hr(e,"success",{action:{label:Gt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ai]);const Ss=e=>{Qo(R),ao.select(e.zone===Cn?{index:e.index}:{index:e.index,zone:e.zone})},bs=X(),ws=()=>({data:Bt.data,device:ko,ops:ao,inspector:sr}),xs=bs?.model,zs=jn(()=>xs?e=>xs(e,as(e),ws()):as,[xs,as,ko]),Cs=bs?.measure,Os=Cs?(e,n)=>Cs(e,n,ws()):void 0,Ns=bs?.canDrop,Is=Ns?(e,n)=>Ns(e,n,es,ws()):es,Bs=bs?.drop,Ps=Bs?(e,n)=>Bs(e,n,ls,ws()):ls,Ms=bs?.pick,$s=Ms?e=>Ms(e,Ss,ws()):Ss,Ts=bs?.media??null,js=Tn(null),Ls=jn(()=>Ts?{id:at,zone:"",index:-1,type:Ts.adds.type,add:{kind:Ts.adds.kind,type:Ts.adds.type},media:!0}:null,[Ts]);An(()=>{if(!Ls||wt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Qn))(e)&&(js.current=null,ss.start({key:at,item:Ls}))},n=e=>{ss.get()?.item.media&&(js.current=Wn(e.dataTransfer))},t=()=>{ss.get()?.item.media&&ss.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ls,wt,ss]);const As=()=>{const e=js.current;return js.current=null,e},Es=ce(),Rs=async e=>{if(!Es)return e;const n=await Es(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!Ts)return;const t=cn(so.getState().appState.data,pi,n);if(!t)return;const o=t.node;ao.replaceComponent(dn(t.place),t.place.index,{...o,props:{...Ts.replace(o,e),id:o.props.id}})},Ds=e=>{const n=dn(e),t=Mi(n);t&&ji(t.node,t.slot,!1),il(n,e.index)},Vs=(e,n)=>/* @__PURE__ */lt(Be,{...wt?{}:ds.seam({place:{...an(e),index:n}})},`seam:${e}:${n}`),Hs={rowClick:dl,isCollapsed:Er,toggleCollapse:Rr},Ws=e=>{const n=String(e.props.id),t=ai.findIndex(e=>String(e.props.id)===n),o=Dt(n),r=Ii(o),i=Er(n),l=wi(e.type),s=yr.rowName?yr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
16
|
-
return st(dt,{children:[
|
|
17
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:s,preview:cl(e),marks:pl(e),onSelect:()=>_i(t),nameSlot:Vi(Cn,t,n,s),selected:qo===n,badge:Rl(e)?void 0:Hl,shared:Rl(e),actions:ul(e,Cn,t)??void 0,rowProps:{"data-node-id":n,onClick:dl(()=>_i(t))},fold:{open:!i,label:"section",onToggle:()=>Rr(n)}}),!i&&/* @__PURE__ */st(Ce,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ci(n),l=zl(n),s=l&&Er(r),a=()=>Ol(o,t,r,e.type),{rowProps:c,...p}=ds.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:dl(a)});/* @__PURE__ */
|
|
18
|
-
return st(Fn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(o,t,i),ul(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */lt(Ce,{children:Ys(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ds.dragging,d=!Er(l)&&s?.rung?.nodeId!==i,a={...an(l),index:0},c=s&&!s.rung&&es(s,a)?a:void 0,p=()=>ji(e,n,!0),{rowProps:u,...f}=ds.row({item:{id:`rung:${l}`,zone:`${i}:${yt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:yt,index:t},into:c,canDrag:Boolean(cr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:dl(p)}),h=wt?null:cr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return st(Fn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$i===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Rr(l)},actions:h&&h.length>0?/* @__PURE__ */lt(dt,{children:h.map((t,o)=>/* @__PURE__ */lt(Ie,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(wt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Li(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__ */lt(nt,{size:15}):/* @__PURE__ */lt(it,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */lt(Ce,{children:r})]},l)},Us=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return lt(dt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=bl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */st(dt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),{collapsible:i,folded:s}=wl(n,l,Cl(n.type)),d=String(n.props.id),a=Kl(n),p=()=>Ol(t,o,d,e.type),{rowProps:u,...f}=ds.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:dl(p)});/* @__PURE__ */
|
|
23
|
-
return st(Fn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:a,preview:cl(n),marks:pl(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Rr(d)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(t,o,a),ul(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */lt(Ce,{children:Us(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Js(e,t.rung,r++,o,p):/* @__PURE__ */lt(Fn,{children:p},t.slot??"")})})},Ys=(e,n)=>{const t=fr(Bt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return lt(dt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=bl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */st(dt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),i=Fi(n),l=String(n.props.id),{collapsible:d,folded:a}=wl(n,s,Cl(n.type)),c=gl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...an(p),index:Ii(p).length}:void 0,f=ds.dragging,h=u&&f&&es(f,u)?u:void 0,g=()=>Ol(t,o,l,e.type),{rowProps:y,...k}=ds.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!pr(n.type,n)},{"data-node-id":l,onClick:dl(g)});/* @__PURE__ */
|
|
26
|
-
return st(Fn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>Rr(l)}:void 0,actions:pr(n.type,n)?ul(n,t,o)??void 0:/* @__PURE__ */st(dt,{children:[al(t,o,i),ul(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */lt(Ce,{children:Ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */lt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Nl(e.props.id,a.slot,a.childType,c.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?Js(e,o.rung,i++,r,k):/* @__PURE__ */lt(Fn,{children:k},o.slot??"")})})},Gs=Ho,Ks=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:po&&!Gs&&ar===e.id,onSelect:()=>ii(e.id)}:e,Xs=[...(dr.railLead??[]).map(Ks),{id:"sections",label:Gt.layers,icon:/* @__PURE__ */lt(he,{}),active:po&&!Gs&&"sections"===ar,onSelect:()=>ii("sections")},...(dr.railTrail??[]).map(Ks)];bo?Xs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */lt(me,{}),active:zo,onSelect:Co}):Ot&&Xs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */lt(me,{}),onSelect:li});const Qs=[...dr.railLead??[],...dr.railTrail??[]].find(e=>"panel"in e&&e.id===ar),Zs=Boolean(Yt?.foldable),qs=Yt?.label??(Nt?Gt.pageSections:Gt.templateSections),_s=Zs&&Er(kt),ed=/* @__PURE__ */st(dt,{children:[ai.map((e,n)=>{if(Wt(e)||Jt(e)||Ft(e.type))return null;const t=qo===String(e.props.id),o=Boolean(e.props._hidden);yl(e);const r=String(e.props.id),i=dr.hasOwnRows?.(e)??!1,l=zl(e)||i,s=l&&Er(r),d=gl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...an(a),index:Ii(a).length}:void 0,p=ds.dragging,u=c&&p&&es(p,c)?c:void 0,{rowProps:f,...h}=ds.row({item:{id:r,zone:Cn,index:n,type:e.type},place:{...an(Cn),index:n},into:u,canDrag:!pr(e.type,e)},{"data-node-id":r,onClick:dl(()=>_i(n))});/* @__PURE__ */
|
|
29
|
-
return st(Fn,{children:[n>0&&hl(n),
|
|
30
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:Ci(e),preview:cl(e),marks:pl(e),shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(Cn,n,r,Ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(Cn,n,Ci(e)),ul(e,Cn,n),fl(Cn,n,e,Ci(e))]}),rowProps:f}),zl(e)&&!s&&/* @__PURE__ */st(Ce,{children:[Ys(e,1),dr.partRows?.(e,Hs)]}),i&&!s&&/* @__PURE__ */lt(Ce,{children:dr.ownRows?.(e,n,Hs)})]},String(e.props.id??n))}),Ul>0&&hl(Ul)]}),nd=(e,n,t)=>{const o=String(e.props.id),r=vl(e).length>0||Sl(e)||Boolean(mr(e.type)),i=r&&Er(o),l="header"===t?Gt.header:Gt.footer,s=yr.rowName?yr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return st(dt,{children:[
|
|
32
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:t,size:13}),name:s,preview:cl(e),marks:pl(e),badge:Rl(e)?void 0:Hl,shared:Rl(e),onSelect:()=>_i(n),nameSlot:Vi(Cn,n,o,s),selected:qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Rr(o)}:void 0,actions:ul(e,Cn,n)??void 0,rowProps:{"data-node-id":o,onClick:dl(()=>_i(n))}}),r&&!i&&/* @__PURE__ */lt(Ce,{children:Us(e,1)})]})};return(dr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */lt(Q,{target:Lo,children:/* @__PURE__ */st("div",{ref:jo,className:"sf-editor es-editor",style:Ue($r),onContextMenu:Gi.onEditorContextMenu,...u(fn),children:[
|
|
34
|
-
/* @__PURE__ */st(Le,{children:[
|
|
35
|
-
/* @__PURE__ */lt(Ae,{items:Xs,ariaLabel:Gt.bar.views}),
|
|
36
|
-
/* @__PURE__ */st(Ee,{children:[
|
|
37
|
-
/* @__PURE__ */lt(Re,{label:Gt.bar.undo,disabled:Boolean(wt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */lt(Zn,{})}),
|
|
38
|
-
/* @__PURE__ */lt(Re,{label:Gt.bar.redo,disabled:Boolean(wt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */lt(qn,{})}),
|
|
39
|
-
/* @__PURE__ */lt(Fe,{}),
|
|
40
|
-
/* @__PURE__ */lt(De,{devices:fo,value:ko,onChange:vo}),
|
|
41
|
-
/* @__PURE__ */lt(Re,{label:Gt.bar.refresh,tip:Gt.bar.refreshTip,onClick:()=>{To.current=(()=>{const e=Lo?.document;if(!e)return null;const n=ai.findIndex(Jt),t=n>=0?n:ai.length;let o=null;for(let n=0;n<t;n++){const t=ai[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=$t?.props?.id??ai[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),$o(e=>e+1)},children:/* @__PURE__ */lt(_n,{})})]}),
|
|
42
|
-
/* @__PURE__ */st(Ee,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
-
/* @__PURE__ */lt(v,{input:Do,words:Gt.saveStatus}),dr.barLead?.(),dr.barTrail?.(),dr.mainAction||!dr.barMain?/* @__PURE__ */lt(S,{input:Do,action:dr.mainAction??{label:Gt.done,onPress:()=>{Un(Bt.data)}},readOnly:Boolean(wt),saveSwitch:zt,onToggleAutoSave:Xn,onSaveNow:Vo,bar:Gt.bar,words:Gt.saveStatus}):dr.barMain()]})]}),
|
|
44
|
-
/* @__PURE__ */lt(oe,{}),
|
|
45
|
-
/* @__PURE__ */st("div",{className:"sf-body",children:[po?/* @__PURE__ */st(dt,{children:[
|
|
46
|
-
/* @__PURE__ */lt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Gt.leftPanel,children:Ho?/* @__PURE__ */lt(x,{at:Uo?{label:(e=>{const n=ql(e.zone);if(n)return Gt.add.addingTo({name:yr.rowName?sl(n,!0):wi(n.type)});if(e.zone===Cn){const n=ai[e.index];return n&&!Jt(n)?Gt.add.addingBefore({name:sl(n,!0)}):Gt.add.addingAtEnd}const t=ts(e.zone);return t?Gt.add.addingTo({name:t.parentName}):Gt.add.addingHere})(Uo),onClear:()=>Yo(null)}:void 0,placeBlocks:Uo&&Uo.zone!==Cn?ts(Uo.zone)?.choices:void 0,canTake:Uo?e=>{if(!Uo)return null;const n={...an(Uo.zone),index:Uo.index};if(rs(e,n))return null;if("shared"===e.kind&&Uo.zone===Cn&&!Lt.shared?.nodeOf(e.section))return Gt.shared.alreadyHere;const t=ql(Uo.zone);if(t)return Gt.add.notInside({name:sl(t,!0)});if(Uo.zone===Cn)return Gt.add.onlySections;const o=ts(Uo.zone);return o?Gt.add.notInside({name:o.parentName}):Gt.add.onlySections}:void 0,onPick:Uo?e=>{if(!Uo)return;const n={...an(Uo.zone),index:Uo.index};rs(e,n)&&(is(e,n),ll())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ss,siteWide:dr.addPanelRow?.(ll),onClose:ll,onHide:oi,readOnly:Boolean(wt)}):Qs?Qs.panel({onHide:oi,notify:Hr}):/* @__PURE__ */st(dt,{children:[
|
|
47
|
-
/* @__PURE__ */lt(O,{icon:/* @__PURE__ */lt(he,{}),title:Gt.layers,context:no,actions:/* @__PURE__ */st(dt,{children:[!wt&&/* @__PURE__ */lt(Ve,{label:Gt.add.title,onClick:()=>rl(null),children:/* @__PURE__ */lt(et,{size:15})}),
|
|
48
|
-
/* @__PURE__ */lt(Ve,{label:Gl?Gt.expandAll:Gt.collapseAll,title:0===Yl.length?Gt.nothingToFold:void 0,disabled:0===Yl.length,onClick:()=>Mr(e=>{const n=new Set(Yl);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yl])}),children:/* @__PURE__ */lt(ht,{expand:Gl})})]}),onHide:oi}),
|
|
49
|
-
/* @__PURE__ */st(Oe,{className:"sf-tree sf-scroll",words:Kt,children:[
|
|
50
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"page",size:13}),name:Gt.pageSettings,onSelect:si,selected:!$t&&Zo,rowProps:{onClick:dl(si)}}),Wl&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Ne,{children:Gt.header}),Ws(Wl)]}),It&&!(Al&&Wl)&&/* @__PURE__ */st(dt,{children:[!Al&&/* @__PURE__ */lt(Ne,{children:Gt.header}),!Ut&&/* @__PURE__ */lt(ze,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"header",size:13}),name:Gt.header,badge:Vl?void 0:Hl,shared:Vl,onSelect:di,selected:Xo.kind===Ht?.kind,rowProps:{onClick:dl(di)}})]}),Tl&&!(Al&&Wl)&&nd(Tl,$l,"header"),!Zs&&/* @__PURE__ */lt(Ne,{children:qs}),Zs?/* @__PURE__ */st(dt,{children:[
|
|
51
|
-
/* @__PURE__ */lt(ze,{words:Kt,icon:null,name:qs,fold:{open:!_s,label:qs,onToggle:()=>Rr(kt)}}),!_s&&/* @__PURE__ */lt(Ce,{children:ed})]}):ed,It&&!Al&&/* @__PURE__ */lt(Ne,{children:Gt.footer}),Ml&&!(Al&&Jl)&&nd(Ml,Pl,"footer"),Jl&&Ws(Jl),dr.treeFoot?.()]})]})}),
|
|
52
|
-
/* @__PURE__ */lt(He,{side:"left",width:$r.left,min:Je.left,max:We,defaultWidth:m.left,label:Gt.resizeLeftPanel,onResize:Lr})]}):/* @__PURE__ */lt(N,{side:"left",onShow:oi}),
|
|
53
|
-
/* @__PURE__ */st("div",{ref:Wr,className:"sf-center sf-scroll","data-sf-canvas-head":Kr?"":void 0,style:{overflowX:ei?"auto":"hidden",overflowY:"hidden"},children:[Kr&&/* @__PURE__ */lt("div",{ref:Xr,className:"sf-canvas-head",children:/* @__PURE__ */lt(Kr,{device:ko})}),
|
|
54
|
-
/* @__PURE__ */st("div",{className:"sf-frame-scaler",style:ni,children:[
|
|
55
|
-
/* @__PURE__ */lt("div",{className:"sf-frame "+(ko===go?"":`sf-frame--${ko}`),style:ti,children:/* @__PURE__ */st("div",{className:"sf-preview-host",children:[
|
|
56
|
-
/* @__PURE__ */lt(we.Provider,{value:Ll,children:/* @__PURE__ */lt(xe.Provider,{value:Dl,children:/* @__PURE__ */lt(to,{},Mo)})}),
|
|
57
|
-
/* @__PURE__ */lt(_e,{canvas:Lo,session:ss,model:zs,measure:Os,canDrop:Is,onDrop:Ps,choose:ps,onPick:$s,dropOn:Ts?{accepts:(e,n)=>{if(!e.media||!Ts||n.item.rung)return!1;const t=cn(Bt.data,pi,n.item.id);return null!==t&&Ts.takes(t.node)},onDrop:(e,n)=>(e=>{const n=As();n&&Ts&&Rs(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Gt.canvasReplaceImage}:void 0,onZoneAdd:Ds,onSeamAdd:Ds,zoneAddLabel:Gt.canvasAddBlock,words:Xt.canvas,readOnly:Boolean(wt),revision:Bt.data}),Go.length>0&&!Ao&&/* @__PURE__ */lt("div",{className:"sf-preview-gaps",children:Go.map(e=>
|
|
58
|
-
/* @__PURE__ */lt(en,{index:e.index,label:Gt.addSectionHere,onInsert:()=>rl(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))})]})}),hs?/* @__PURE__ */lt(ft,{canvas:Lo,tabs:ys,onSelect:e=>{const n=ai.findIndex(n=>String(n.props.id)===e);n>=0&&_i(n)}}):null]})]}),uo?/* @__PURE__ */st(dt,{children:[
|
|
59
|
-
/* @__PURE__ */lt(f,{value:{selectChild:Ol,addChild:Nl,childRowName:Fi,blockRowName:Kl},children:/* @__PURE__ */lt(oo,{mode:Xo,onOpenWebsiteSettings:dr.openSettings??(()=>{}),onOpenSiteStyles:dr.openStyles,onSelectNode:xr,onNotify:Hr,onHidePanel:ri,nodeActions:$t?On(jt,$t.type):vt})}),
|
|
60
|
-
/* @__PURE__ */lt(He,{side:"right",width:$r.right,min:Je.right,max:We,defaultWidth:m.right,label:Gt.resizeSettingsPanel,onResize:Ar})]}):
|
|
61
|
-
/* @__PURE__ */lt(N,{side:"right",onShow:ri})]}),Gi.menu,
|
|
62
|
-
/* @__PURE__ */lt(ee,{}),yi?/* @__PURE__ */lt(ct,{name:yi.name,onMake:e=>(async(e,n)=>{const t=ai.find(n=>String(n.props.id)===e),o=Lt.shared;if(!t||!o)return;let r;try{r=await C(gi).create(n,t)}catch{return void Hr(Gt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(yi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
|
package/dist/chunk-OSPUG6S6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/dist/chunk-SGFDUXUH.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{parseZoneKey as o}from"./chunk-KRXQM65X.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as i,useCanvasTyping as c,useCanvasEvent as d,CANVAS_TYPABLE_EVENT as u,framePointToHost as h,elementScale as f,frameRectToLayer as p,clientPointToLayer as m}from"./chunk-X4T6JT3M.js";import{useRef as g,useEffect as x,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as D,solidSurfaceStyle as T,Input as z}from"efficient-shell/ui";import{AddIcon as M,CloseIcon as $,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as E,jsx as S}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return E("div",{className:o,style:n,"data-index":r,children:[
|
|
3
|
-
/* @__PURE__ */S("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */S("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */S(A,{content:e,children:/* @__PURE__ */S(D,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */S(M,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,B=e=>e.width*e.height;function K(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>B(t.s.box)-B(e.s.box)||e.at-t.at).map(({s:e})=>e)}function O(e,t,n){return K(e,t,n).at(-1)??null}function X(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function q(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function I(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>L(e.box,t,n)).sort((e,t)=>B(e.box)-B(t.box));for(const e of o){const o=X(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:q(e,o)};if(!r(s))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let a=0;a<=l.length;a++){const u=l[a-1],h=l[a];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+s)/2:(o+i(h))/2,t=Math.min(Math.max(e,o+n),s-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>r?e.top:e.left)),x=Math.max(...m.map(e=>r?e.top+e.height:e.left+e.width)),b=r?{left:f,top:g,width:p,height:x-g}:{left:g,top:f,width:x-g,height:p};d.push({key:`${e.key}:+${a}`,place:{...e.list,index:a},box:b,axis:e.axis,label:t})}return d}function Y(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.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(r.top-o,0)}})}return n}var H={nodes:[],zones:[]},R="data-puck-dropzone",Z="data-puck-component";function F(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 Q(e,t){const{frame:n,document:l}=e,a=e=>p(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],s=[];for(const e of l.querySelectorAll(`[${R}]`)){const t=e.getAttribute(R)??"";let n;try{n=o(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${R}]`)===e),i=l.map(a);s.push({key:t,list:n,box:a(e),axis:F(i,e),children:i}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:i[t]})})}return{nodes:r,zones:s}}var V="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(o){const{canvas:s,session:p,readOnly:k,words:D=e.canvas}=o,z=g(o);x(()=>{z.current=o});const M=g(null),$=i(s),[C,L]=b(0),B=y(()=>L(e=>e+1),[]),[O,X]=b(H);x(()=>{const e=M.current;s&&e&&X((z.current.measure??Q)(s,e))},[s,$,o.revision,C]);const q=o.model,P=v(()=>q(O),[q,O]),Y=w(p.subscribe,p.shown,p.shown),R=o.choose,Z=(e,t)=>{const n=K(P.sources,e,t);return 0===n.length?null:R?R(n):n[n.length-1]},[F,J]=b(null),[U,_]=b(null),[ee,te]=b(null),ne=g(null),le=()=>{ne.current&&clearTimeout(ne.current),ne.current=null},ae=()=>{le(),ne.current=setTimeout(()=>{p.get()||J(null)},140)};x(()=>le,[]);const re=g(null),oe=c(s),se=g(!1);se.current=oe,x(()=>{oe&&(le(),J(null))},[oe]);const[ie,ce]=b(null);d(s,u,e=>ce(e.detail?.id??null));const de=!ie||oe||k||Y?null:O.nodes.find(e=>e.id===ie)?.box??null;d(s,"mousemove",e=>{const t=M.current;if(!s||!t)return;const n=h(s.frame,e.clientX,e.clientY,t),l=f(t),a={x:n.x/l,y:n.y/l};if(re.current=a,z.current.readOnly||p.get()||se.current)return;le();const r=Z(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),d(s,"mouseout",e=>{e.relatedTarget||(re.current=null,ae())}),d(s,"mouseover",e=>{e.relatedTarget||B()});const ue=g(null),he=y(()=>{ue.current?.(),ue.current=null,_(null),te(null)},[]);x(()=>p.subscribe(()=>{p.get()?B():he()}),[p,he,B]),x(()=>he,[he]),("undefined"==typeof document?x:N)(()=>{if(p.get())return;const e=re.current;J(t=>k||se.current?null:e?Z(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Y,p,k,R]);const fe=e=>{const t=p.get(),n=M.current,l=z.current.dropOn;if(!t||!n||!l)return null;const a=m(n,e.clientX,e.clientY);re.current=a;const r=K(P.sources,a.x,a.y);for(let e=r.length-1;e>=0;e-=1)if(l.accepts(t.item,r[e]))return{h:t,source:r[e]};return null},pe=e=>{const t=p.get(),n=M.current;if(!t||!n)return null;const l=m(n,e.clientX,e.clientY);re.current=l;const a=I(P.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},me={onDragEnter:e=>{if(ue.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=s?l(s.document):null,o=[];t&&o.push(a(t)),r&&s&&o.push(a(r,s.frame)),ue.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=fe(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),_(null),void te(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);te(null);const l=pe(e);if(!l)return void _(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const a={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};_(e=>e&&e.zoneKey===a.zoneKey&&e.line.left===a.line.left&&e.line.top===a.line.top?e:a)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(re.current=null,_(null),te(null))},onDrop:e=>{const t=fe(e);if(t)return e.preventDefault(),p.end(),he(),void z.current.dropOn.onDrop(t.h.item,t.source);const n=pe(e);n&&(e.preventDefault(),p.end(),he(),z.current.onDrop(n.h.item,n.t.to))}},ge={draggable:!k&&!!F,onMouseEnter:le,onMouseLeave:()=>!p.get()&&ae(),onDragStart:e=>{if(F&&!k){p.start({key:F.key,item:F.item,from:F.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",F.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),he()},onClick:()=>{F&&!k&&z.current.onPick?.(F.item)}},{seams:xe=[]}=P,be=P.zones.filter(e=>0===e.children.length),ye=!o.onZoneAdd||k||oe?[]:be,ve=ye.map(e=>e.key).join("\n");return x(()=>{const e=s?.document;if(!e)return;const t=new Set(ve?ve.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(V,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${V}]`))t.removeAttribute(V)}},[s,ve,O,$,C]),/* @__PURE__ */E("div",{ref:M,className:"es-canvas-layer",children:[Y||!o.onSeamAdd||k||oe?null:xe.map(e=>
|
|
5
|
-
/* @__PURE__ */S(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??o.seamLabel??D.addSection,onInsert:()=>o.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ye.length?ye.map(e=>/* @__PURE__ */S("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",U?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:W(e.box),onClick:()=>o.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */S("span",{className:"es-canvas-empty-add",children:D.addButton({label:e.addLabel??o.zoneAddLabel??D.addBlock})})},e.key)):null,Y?/* @__PURE__ */S("div",{className:"es-canvas-catch",...me}):null,ee&&Y?/* @__PURE__ */S("div",{className:"es-canvas-target",style:W(ee.box),children:o.dropOn?.label?/* @__PURE__ */S("span",{className:"es-canvas-target-label",style:T(),children:o.dropOn.label(Y.item,ee)}):null}):null,U&&!be.some(e=>e.key===U.zoneKey)?/* @__PURE__ */S("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,de?/* @__PURE__ */S("span",{className:"es-canvas-hint"+(de.width<200?" is-below":""),style:{...T(),left:de.left+de.width,top:de.width<200?de.top+de.height:de.top},children:D.typeHint}):null,
|
|
6
|
-
/* @__PURE__ */S("div",{className:"es-canvas-handle-spot",style:F?{"--es-handle-x":`${F.box.left+2}px`,"--es-handle-y":`${Math.max(F.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */S(A,{className:"es-canvas-handle-tip",side:"top",content:!F||k||Y?null:F.title??D.handle({label:F.label}),children:/* @__PURE__ */E("div",{className:["es-canvas-handle",F&&!k?"is-shown":"",Y?"is-dragging":""].filter(Boolean).join(" "),...ge,children:[
|
|
7
|
-
/* @__PURE__ */S("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),F?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:o,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=b(""),g=k(),x=p.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:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return E("div",{className:"es-add",children:[o?/* @__PURE__ */E("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */S("span",{children:o.label}),s(u.stop,/* @__PURE__ */S("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:o.onClear,children:/* @__PURE__ */S($,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
-
/* @__PURE__ */S("p",{className:"es-add-hint",children:h}),
|
|
11
|
-
/* @__PURE__ */S("div",{className:"es-add-find",children:/* @__PURE__ */S(z,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */S(C,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */S(D,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */S($,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */E("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */S("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
-
/* @__PURE__ */S("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):v.map(e=>/* @__PURE__ */E("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
-
/* @__PURE__ */E("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */S("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
-
/* @__PURE__ */S("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
-
/* @__PURE__ */S("div",{className:_(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return s(l,/* @__PURE__ */E("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */S("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */S("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
-
/* @__PURE__ */E("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */S("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,H as EMPTY_MEASURE,J as HANDLE_GRACE_MS,I as canvasTarget,L as contains,X as gapInZone,q as gapLine,P as insertSeams,Q as measureCanvas,O as pickSource,Y as seamsBetween,K as sourcesAt};
|
package/dist/chunk-Y6RJAOFH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{easelMenuEntries as l,menuLabel as r}from"./chunk-BALFHI3G.js";import{createNodeClipboard as i,nodeMenuItems as c}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{zoneKey as a,ROOT_SLOT as u,ROOT_ID as d}from"./chunk-KRXQM65X.js";import{isTypingTarget as p,useCanvasEvent as f,framePointToHost as m}from"./chunk-X4T6JT3M.js";import{ROOT_ZONE as h}from"./chunk-PLVEGYK6.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as O,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===h)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=i(),S=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=S.get(n);return t||(t=i(),S.set(n,t)),t}function M(){return j(e())}function T(e,n,t){if(n===h){const{floor:n,cap:o}=e.sectionBand();return{parentId:d,slot:u,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(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,delete:l&&r.delete}}function L(e,n,t){const o=e.canPasteAt;if(!o)return a(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(p(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;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":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 I(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=X(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;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:L(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(e,n){const{zone:t,index:l}=n,r=e.nodeAt(t,l);if(!r)return[];const i=r.props.id,s=e.labelOf(r.type,t),a=Boolean(r.props._hidden),u=e.nodeOps,d=e.isPinned(r,t),p=e.isLocked(r),f=!d&&!p&&!e.duplicateBlocked(r),m=e.permits?.(r)??{duplicate:!0,delete:!0},y=X(e,r,t),k=D(e,n),b=u.held,v=b&&!d?L(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(r,t),onCopy:()=>e.style?.copy(r,t),onPaste:()=>e.style?.paste(t,l,r),words:e.words?.styleClipboard}):[];return c({title:s,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},l=n.zone===h?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:g&&f&&m.duplicate?()=>u.duplicate(i):void 0,moveUp:g&&u.canStep(i,-1)?()=>u.step(i,-1):void 0,moveDown:g&&u.canStep(i,1)?()=>u.step(i,1):void 0,copy:y.copy?()=>u.copy(i,s):void 0,cut:g&&y.cut?()=>u.cut(i,s):void 0,paste:g&&b&&v?{label:b.label,run:()=>u.paste(v)}:void 0,rename:g&&e.renamePropOf(r,t)?()=>e.beginRename(t,l):void 0,hide:!g||p||d?void 0:{hidden:a,run:()=>u.setProps(i,{_hidden:!a})},delete:g&&f&&m.delete?()=>u.remove(i):void 0},style:w,extras:e.menuRows?.(r,t,l)??void 0,pinnedLine:d?Y(e).pinned:void 0})}var Y=e=>e.words?.screen??t.menu;function B(e){const n=Y(e),o=!e.readOnly,l=[];o&&e.history.hasPast&&l.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&l.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const r=[],i=e.nodeOps.held,c=T(e,h,e.sectionBand().cap);if(o&&i&&(e.canPasteAt?e.canPasteAt(i,c):a(i.from)===h)){const n=c,t=e.words?.menu??s;r.push({label:t.pasteNamed({paste:t.paste,label:i.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[l,r,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(O,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??s,c=Y(e),a=[];l&&(a.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),a.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e){return e.shiftKey}function V(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=I(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),f(t,"keydown",c);const a=k(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&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);f(t,"contextmenu",n=>{if(U(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=m(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),f(t,"mousedown",r),f(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(F,{host:e,target:o,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?N(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":r(o),items:l(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,X as nodeClipboardRules,R as nodeMenuItems,E as nodeShortcut,B as pageMenuItems,L as pastePlace,I as runNodeShortcut,N as textMenuItems,M as useNodeClipboard,V as useNodeContextMenu};
|