efficient-easel 14.1.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/{CanvasDragLayer-CLb7j-CZ.d.ts → CanvasDragLayer-dZCPbQCP.d.ts} +1 -1
- package/dist/canvas/index.d.ts +21 -1
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NY7HHUGB.js → chunk-23VM4PMV.js} +2 -2
- package/dist/{chunk-IWFVVCRN.js → chunk-2H3W5OLQ.js} +1 -1
- package/dist/chunk-5EPK5WB3.js +1 -0
- package/dist/{chunk-CSGTPJTY.js → chunk-EHBWUEEE.js} +4 -4
- package/dist/chunk-FRXE6EQN.js +5 -0
- package/dist/{chunk-F3A7SXSV.js → chunk-GOABCALQ.js} +1 -1
- package/dist/{chunk-44QA42OJ.js → chunk-GS44HQ45.js} +1 -1
- package/dist/{chunk-CY52PUMZ.js → chunk-HM7S7H5H.js} +1 -1
- package/dist/chunk-JASNL4KG.js +7 -0
- package/dist/{chunk-AYWN5NRH.js → chunk-KAML3KQH.js} +1 -1
- package/dist/chunk-OFBZOI6W.js +1 -0
- package/dist/{chunk-TR4APEJZ.js → chunk-OJ6QWOLG.js} +1 -1
- package/dist/chunk-POSLNRTO.js +18 -0
- package/dist/chunk-QKZPPI5O.js +57 -0
- package/dist/chunk-SMM3ST7A.js +13 -0
- package/dist/chunk-U6LJ5UKD.js +6 -0
- package/dist/chunk-VJZDNOQ7.js +1 -0
- package/dist/chunk-X4T6JT3M.js +1 -0
- package/dist/{chunk-YKJ3RIMT.js → chunk-YQVR54RE.js} +1 -1
- package/dist/{chunk-CMXK3JT3.js → chunk-Z62Z75UI.js} +1 -1
- package/dist/{chunk-FBS75I6E.js → chunk-ZZ64CEC2.js} +2 -2
- package/dist/copy/copy.css +9 -9
- package/dist/copy/index.d.ts +2 -29
- package/dist/copy/index.js +12 -13
- package/dist/drag/drag.css +22 -0
- package/dist/drag/index.d.ts +2 -2
- package/dist/drag/index.js +1 -1
- package/dist/easel/easel.css +26 -0
- package/dist/easel/index.js +1 -1
- package/dist/{host-GOlVK3LX.d.ts → host-DGmdCaNL.d.ts} +10 -1
- package/dist/pick/index.d.ts +5 -70
- package/dist/pick/index.js +1 -3
- package/dist/pick/pick.css +1 -21
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +4 -4
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +3 -3
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +3 -3
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +3 -3
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +3 -3
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +3 -3
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +3 -3
- 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 +3 -3
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +36 -36
- package/dist/{words-BDignMl_.d.ts → words-CvwYvkJm.d.ts} +2 -0
- package/dist/{words-is_Vy6hn.d.ts → words-DWvCJXwR.d.ts} +2 -37
- package/package.json +3 -3
- package/dist/chunk-3DCI44F3.js +0 -7
- package/dist/chunk-5XUMLKQF.js +0 -6
- package/dist/chunk-643PVCEG.js +0 -1
- package/dist/chunk-D46OYLJR.js +0 -5
- package/dist/chunk-F6NO7B57.js +0 -57
- package/dist/chunk-ILXP5VX5.js +0 -1
- package/dist/chunk-LPM2SCM4.js +0 -13
- package/dist/chunk-NW4LJ4G4.js +0 -1
- package/dist/chunk-QFVRMARS.js +0 -18
- package/dist/chunk-XGW6NWLC.js +0 -1
package/README.md
CHANGED
|
@@ -1358,7 +1358,6 @@ const german: DeepPartial<EaselStrings> = {
|
|
|
1358
1358
|
<EaselRail items={items} ariaLabel={strings.rail.label} />
|
|
1359
1359
|
<TreeRow … words={strings.tree} />
|
|
1360
1360
|
<ColourPicker … words={strings.pick.colour} />
|
|
1361
|
-
<ImageBox … words={strings.pick.image} />
|
|
1362
1361
|
<AddPanel … words={strings.drag.add} />
|
|
1363
1362
|
<CanvasDragLayer … words={strings.drag.canvas} />
|
|
1364
1363
|
|
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { C as CanvasTarget$1 } from './watch-BTYOJpQU.js';
|
|
3
3
|
import { S as SlotAddress, P as Place } from './types-41704JE4.js';
|
|
4
4
|
import { D as DragSession } from './session-DSQFmIvx.js';
|
|
5
|
-
import { D as DragWords } from './words-
|
|
5
|
+
import { D as DragWords } from './words-CvwYvkJm.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Where a drop on the CANVAS lands — pure functions over measured boxes
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -172,8 +172,20 @@ declare const CANVAS_TYPING_EVENT = "easel:canvas-typing";
|
|
|
172
172
|
type CanvasTypingEvent = CustomEvent<{
|
|
173
173
|
typing: boolean;
|
|
174
174
|
}>;
|
|
175
|
+
/**
|
|
176
|
+
* Said on the canvas document when the SELECTION changes whether its words can
|
|
177
|
+
* be typed (`EaselCanvas`'s `typing.atSelection`): the block's id while they
|
|
178
|
+
* can and are not being typed, else null. The layer over the canvas says how
|
|
179
|
+
* to start — "Double-click to edit" — on that block (Lewis 2026-10-20: one
|
|
180
|
+
* click on a Text block looked like typing, and nothing said it needs two).
|
|
181
|
+
*/
|
|
182
|
+
declare const CANVAS_TYPABLE_EVENT = "easel:canvas-typable";
|
|
183
|
+
type CanvasTypableEvent = CustomEvent<{
|
|
184
|
+
id: string | null;
|
|
185
|
+
}>;
|
|
175
186
|
type CanvasEventMap = DocumentEventMap & WindowEventMap & {
|
|
176
187
|
[CANVAS_TYPING_EVENT]: CanvasTypingEvent;
|
|
188
|
+
[CANVAS_TYPABLE_EVENT]: CanvasTypableEvent;
|
|
177
189
|
};
|
|
178
190
|
/**
|
|
179
191
|
* Listen for `type` in the canvas — on its document (default) or its window.
|
|
@@ -185,6 +197,14 @@ declare function useCanvasEvent<K extends keyof CanvasEventMap>(canvas: CanvasTa
|
|
|
185
197
|
on?: 'document' | 'window';
|
|
186
198
|
capture?: boolean;
|
|
187
199
|
}): void;
|
|
200
|
+
/**
|
|
201
|
+
* Whether words are being typed on the canvas now (`CANVAS_TYPING_EVENT`). What
|
|
202
|
+
* floats over the canvas to add or move a block — a ➕, "+ Add block" — is not
|
|
203
|
+
* drawn while it is true: you cannot add while you type, and a ➕ is clear at
|
|
204
|
+
* rest and still takes a click (Lewis 2026-10-20). One hook, so every layer
|
|
205
|
+
* that draws one asks the same question.
|
|
206
|
+
*/
|
|
207
|
+
declare function useCanvasTyping(canvas: CanvasTarget | null): boolean;
|
|
188
208
|
/**
|
|
189
209
|
* Keep `css` in the canvas document's `<head>` under `key` while mounted, put it
|
|
190
210
|
* back in a replacement document, and take it out on unmount. An empty string
|
|
@@ -212,4 +232,4 @@ declare function useCanvasLayout(canvas: CanvasTarget | null, { settle }?: {
|
|
|
212
232
|
settle?: readonly number[];
|
|
213
233
|
}): number;
|
|
214
234
|
|
|
215
|
-
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypingEvent, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle };
|
|
235
|
+
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle, useCanvasTyping };
|
package/dist/canvas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPING_EVENT,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,watchCanvasFrame}from"../chunk-
|
|
1
|
+
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-X4T6JT3M.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as l,spanFor as r,marksIn as o,toggleMark as i,listIn as a,setList as s,colorOver as c,unlinkAt as u,linkOver as d,colorIn as h,findLink as f,isSafeLinkHref as p}from"efficient-shell/markup";import{Tooltip as m,ColorSwatch as g,ColorPickerPanel as b,Button as k}from"efficient-shell/ui";import{jsxs as v,jsx as y}from"react/jsx-runtime";var x=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),w=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function D(r,o){const i=o.rules??t,a=r.html&&""!==r.html.trim()?function(t,r,o){const i=r.createElement("template");i.innerHTML=t;const a=[[]],s=()=>a[a.length-1],c=()=>{const t=s();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&a.push([])},u=(t,e,n,l)=>{if(3===t.nodeType){for(const r of t.textContent??""){const t=/\s/.test(r)?" ":r,o=s();" "===t&&(0===o.length&&a.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:l})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const r=t,o=1===t.nodeType?r.localName:"";if(x.has(o))return;if("br"===o)return void a.push([]);let i=e,d=n,h=l;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(d=!0),"a"===o){const t=(r.getAttribute("href")??"").trim();h=p(t)?t:null}const f=1===t.nodeType?r.style:null;if(f){const t=f.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===f.fontStyle||"oblique"===f.fontStyle?d=!0:"normal"===f.fontStyle&&(d=!1)}const m=w.has(o);m&&c();for(const e of[...t.childNodes])u(e,i,d,h);m&&c()};u(i.content,!1,!1,null);for(;a.length>1&&0===a[a.length-1].length;)a.pop();return a.map(t=>function(t,r){const o=e=>t.map((n,l)=>n[e]&&(" "!==n.ch||Boolean(t[l-1]?.[e])&&Boolean(t[l+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=M(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],l(s,r)))return s}return t.map(t=>t.ch).join("")}(t,o))}(r.html,o.doc,i):(r.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?a.join("\n"):1===a.length?a[0]:a.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function M(t,e,n,l){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=l?t.href:null;return i=null===u?null:i&&i.href===u?i:r(++o,"link",u),a=e?.[c]?a??r(++o,"bold"):null,s=n?.[c]?s??r(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var T="application/x-efficient-markup",N=/^([0-9]{1,3})\. $/;function C(t,e){const n=t.split("\n"),r=l(t,e);let o=0,i=0;const a=r.map((t,e)=>{const l=!t.bullet&&null==t.number&&"- "===n[e],r=null!=t.number||t.bullet?null:N.exec(n[e]),a=t.bullet||l,s=r?r[1]:t.number??null,c=l||r?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,h={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,h});return{lines:a,text:a.map(t=>t.text).join("\n")}}function
|
|
1
|
+
import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as l,spanFor as r,marksIn as o,toggleMark as i,listIn as a,setList as s,colorOver as c,unlinkAt as u,linkOver as d,colorIn as h,findLink as f,isSafeLinkHref as p}from"efficient-shell/markup";import{Tooltip as m,ColorSwatch as g,ColorPickerPanel as b,Button as k}from"efficient-shell/ui";import{jsxs as v,jsx as y}from"react/jsx-runtime";var x=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),w=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function D(r,o){const i=o.rules??t,a=r.html&&""!==r.html.trim()?function(t,r,o){const i=r.createElement("template");i.innerHTML=t;const a=[[]],s=()=>a[a.length-1],c=()=>{const t=s();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&a.push([])},u=(t,e,n,l)=>{if(3===t.nodeType){for(const r of t.textContent??""){const t=/\s/.test(r)?" ":r,o=s();" "===t&&(0===o.length&&a.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:l})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const r=t,o=1===t.nodeType?r.localName:"";if(x.has(o))return;if("br"===o)return void a.push([]);let i=e,d=n,h=l;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(d=!0),"a"===o){const t=(r.getAttribute("href")??"").trim();h=p(t)?t:null}const f=1===t.nodeType?r.style:null;if(f){const t=f.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===f.fontStyle||"oblique"===f.fontStyle?d=!0:"normal"===f.fontStyle&&(d=!1)}const m=w.has(o);m&&c();for(const e of[...t.childNodes])u(e,i,d,h);m&&c()};u(i.content,!1,!1,null);for(;a.length>1&&0===a[a.length-1].length;)a.pop();return a.map(t=>function(t,r){const o=e=>t.map((n,l)=>n[e]&&(" "!==n.ch||Boolean(t[l-1]?.[e])&&Boolean(t[l+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=M(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],l(s,r)))return s}return t.map(t=>t.ch).join("")}(t,o))}(r.html,o.doc,i):(r.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?a.join("\n"):1===a.length?a[0]:a.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function M(t,e,n,l){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=l?t.href:null;return i=null===u?null:i&&i.href===u?i:r(++o,"link",u),a=e?.[c]?a??r(++o,"bold"):null,s=n?.[c]?s??r(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var T="application/x-efficient-markup",N=/^([0-9]{1,3})\. $/;function C(t,e){const n=t.split("\n"),r=l(t,e);let o=0,i=0;const a=r.map((t,e)=>{const l=!t.bullet&&null==t.number&&"- "===n[e],r=null!=t.number||t.bullet?null:N.exec(n[e]),a=t.bullet||l,s=r?r[1]:t.number??null,c=l||r?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,h={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,h});return{lines:a,text:a.map(t=>t.text).join("\n")}}function A(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const l=n[t];if(e<=l.vis+l.text.length||t===n.length-1)return[l,Math.max(0,Math.min(e-l.vis,l.text.length)),t]}return[n[0],0,0]}function E(t,e){const[n,l]=A(t,e);if(0===l)return n.src;let r=0;for(const t of n.chars){if(l<=r+t.ch.length)return t.at+(l-r);r+=t.ch.length}return n.src}function S(t,e){const[n,l]=A(t,e);let r=0;for(const t of n.chars){if(l===r)return t.at;r+=t.ch.length}return E(t,e)}function B(t,e){const{lines:n}=t;let l=n[0];for(const t of n)e>=t.start&&(l=t);let r=0;for(const t of l.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(r+=e-t.at);break}r+=t.ch.length}return l.vis+r}function L(t,e,n){return[B(t,e),B(t,n)]}function R(t,e,n){return e===n?[E(t,e),E(t,e)]:[S(t,e),E(t,n)]}function K(t,e){let n=0;for(let l=0;l<t.chars.length;l+=1){if(n>=e)return l;n+=t.chars[l].ch.length}return t.chars.length}function W(t,o,i,a,s){const c=C(t,o),[u,d,h]=A(c,Math.min(i,a)),[f,p,m]=A(c,Math.max(i,a)),g=K(u,d),b=K(f,p),k=u.chars.slice(0,g),v=f.chars.slice(b),y=i!==a&&u.chars[g]&&(h!==m||g<b)?u.chars[g].marks:function(t,e){const n=t.chars[e-1],l=t.chars[e],r=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&l?.marks.some(e=>e.id===t.id));return r(n.marks,e)}return l?r(l.marks,!1):[]}(u,g);let x=(w=c.lines,Math.max(0,...w.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var w;const D=t=>{let e;if(void 0!==s.markup){const t=x;e=l(s.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(s.text??"").split("\n").map((e,l)=>(l>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),r={bullet:u.bullet,number:u.number??null,chars:[...k,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...v]}}else r.chars.push(...v);return{lines:[...c.lines.slice(0,h).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),r,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},M=void 0!==s.markup?[null]:[(t=>{let e=t.filter(t=>!s.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of s.add??[]){if(e.some(e=>e.kind===t))continue;const n=r(x++,t);n&&(e=[...e,n])}if(void 0!==s.color){e=e.filter(t=>"color"!==t.kind);const t=null===s.color?null:r(x++,"color",s.color);t&&(e=[...e,t])}return e})(y),y,[]];let T="",N="";for(const t of M){const l=D(t),r=e(l.lines).text;if(T=r,N=l.shown,n(l.lines,C(r,o).lines))break}return{text:T,caret:Math.min(i,a)+N.length}}function P(t,e,n,l){const r=C(t,e),[o,,i]=A(r,n);return n!==l||!o.bullet&&null==o.number||""!==o.text?W(t,e,n,l,{text:"\n"}):j(t,e,i,!1,n)}function j(t,n,l,r,o){const i=C(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===l?{bullet:r,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function V(t,n,l,r){const o=C(t,n),[i,a,s]=A(o,Math.min(l,r)),[c,u,d]=A(o,Math.max(l,r)),h=o.lines.slice(s,d+1).map(({bullet:t,number:e,chars:n},l)=>{const r=0===l?K(i,a):0,o=l===d-s?K(c,u):n.length;return{bullet:t,number:e,chars:n.slice(r,o)}});return e(h).text}function q(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const l=t.charCodeAt(e);return e+(l>=55296&&l<=56319?2:1)}function F(t){const{value:e,rules:n,multiline:l,inputType:r,pending:o}=t;let[i,a]=t.sel;t.target&&t.target[0]!==t.target[1]&&r.startsWith("delete")&&([i,a]=t.target);const s=[i,a];if("historyUndo"===r||"historyRedo"===r)return{kind:"history",dir:"historyUndo"===r?"undo":"redo"};if("formatBold"===r||"formatItalic"===r||"formatStrikeThrough"===r)return{kind:"format",style:"formatBold"===r?"bold":"formatItalic"===r?"italic":"strike"};if("insertParagraph"===r||"insertLineBreak"===r)return l?{kind:"edit",edit:P(e,n,i,a),range:s}:null;if(r.startsWith("insert")){if("insertTranspose"===r)return null;let c=t.data??"";if("insertFromDrop"===r||"insertFromPaste"===r){const r=D({html:t.html??void 0,text:c},{doc:t.doc,multiline:l,rules:n});return{kind:"edit",edit:W(e,n,i,a,{markup:r}),range:s}}return l||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:W(e,n,i,a,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:s}}if(r.startsWith("delete")){const t=C(e,n),l=t.text;if(i===a){const o=r.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:j(e,n,c,!1,i),range:s};if(o?0===i:i===l.length)return null;o?i=q(l,i,-1):a=q(l,a,1)}return{kind:"type",edit:W(e,n,i,a,{text:""}),range:[i,a]}}return null}var I=1e3;function O(t=200){let e=[],n=[],l=null,r=0;return{record(o,i,a){const s="type"===i&&"type"===l&&a-r<1e3;l=i,r=a,n=[],s||(e.push(o),e.length>t&&e.shift())},undo(t){const r=e.pop();return r?(n.push(t),l=null,r):null},redo(t){const r=n.pop();return r?(e.push(t),l=null,r):null},reset(){e=[],n=[],l=null}}}var z=t=>t.preventDefault();function U(t,e){if(t)return t.startsWith("#")?t:e?.find(e=>e.name===t)?.value}function $({colors:t,current:e,words:n,onPick:l}){const r=null===e?null:e.startsWith("#")?e.toLowerCase():t.find(t=>t.name===e)?.value.toLowerCase()??null;/* @__PURE__ */
|
|
2
2
|
return v("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:t=>{"INPUT"!==t.target.tagName&&t.preventDefault()},children:[
|
|
3
3
|
/* @__PURE__ */y("span",{className:"es-copy-pop-label",children:n.theme}),
|
|
4
4
|
/* @__PURE__ */y("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:t.map(t=>/* @__PURE__ */y(m,{content:`${t.label} · ${t.value.toUpperCase()}`,children:/* @__PURE__ */y(g,{color:t.value,size:"sm",className:"es-copy-theme-swatch","data-color":t.name,"aria-label":t.label,selected:e===t.name,onMouseDown:z,onClick:()=>l(t.name)})},t.name))}),
|
|
5
5
|
/* @__PURE__ */y("span",{className:"es-copy-pop-label",children:n.any}),
|
|
6
6
|
/* @__PURE__ */y(b,{className:"es-copy-any",value:r??"",onChange:t=>{t!==e&&l(t)},label:n.title,dragWrites:"end"}),
|
|
7
|
-
/* @__PURE__ */y("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */y(k,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:z,onClick:()=>l(null),children:n.remove})})]})}var H={sup:"sub",sub:"sup"};function X(t){const{value:e,rules:n,start:l,end:r,style:a,pending:s}=t,c=H[a];if(l===r){const t=o(e,l,r,n),i=s&&s.at===l?s:null,u=t.has(a),d=!!i?.add.includes(a)||!i?.drop.includes(a)&&u;let h=(i?.add??[]).filter(t=>t!==a),f=(i?.drop??[]).filter(t=>t!==a);return d&&u?f.push(a):d||u||h.push(a),!d&&c&&(h=h.filter(t=>t!==c),t.has(c)&&(f=[...f.filter(t=>t!==c),c])),{kind:"pending",pending:h.length||f.length||void 0!==i?.color?{add:h,drop:f,color:i?.color,at:l}:null}}let u=e,d=l,h=r;if(c&&!o(u,d,h,n).has(a)&&o(u,d,h,n).has(c)){const t=i(u,d,h,c,n);({text:u,selectionStart:d,selectionEnd:h}=t)}return{kind:"edit",result:i(u,d,h,a,n)}}var Y=/^(block|list-item|flex|grid|table|flow-root)$/;function Z(t){const e=t.ownerDocument.defaultView;return!!e&&Y.test(e.getComputedStyle(t).display)}function G(t,e){const n=[],l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let o="",i=!1;const a=()=>{i&&(o+="\n",i=!1)},s=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&a(),l.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,r.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){l.set(t,o.length),r.set(t,o.length);continue}if("BR"===t.tagName){a(),l.set(t,o.length),o+="\n",r.set(t,o.length);continue}const u=Z(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),l.set(t,o.length);const d=o.length;s(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),r.set(t,o.length),u&&(i=!0)}};l.set(t,0),s(t),r.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(l.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?l.get(n[e])??r.get(t)??0:r.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const l=n[t],r=l.start+l.length;if(e<l.start)return[l.node,0];if(e<r||e===r&&(t===n.length-1||n[t+1].start>e))return 3===l.node.nodeType?[l.node,e-l.start]:[l.node,0]}const l=n[n.length-1];return l?3===l.node.nodeType?[l.node,l.length]:[l.node,0]:[t,0]}}}function J(t){const e=t.element();if(!e)return null;let n=t.value;const l=t.rules;if(G(e,t.skip).text!==C(n,l).text)return null;const r=t.now??(()=>Date.now()),i=O();let p=e,m=!1,g=null,b=null,k=[t.caret[0],t.caret[1]],v=null,y=!1,x=!1;const w=()=>{x||t.onSelect?.()},M={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},N=()=>p.ownerDocument,E=()=>N().defaultView?.getSelection()??null,S=()=>{if(!b)return!0;nt();const e=G(p,t.skip);if(e.text!==C(n,l).text)return!1;const[r,o]=b,[i,a]=e.dom(r),[s,c]=e.dom(o);return y||N().activeElement===p||p.focus({preventScroll:!0}),E()?.setBaseAndExtent(i,a,s,c),k=b,A=b,b=null,w(),!0};let A=null;const B=()=>{if(!A)return!1;const t=E(),e=t?.anchorNode??null;return!(e&&e.isConnected&&p.contains(e))||e===p&&0===t.anchorOffset&&(0!==A[0]||0!==A[1])},W=()=>{b=A,S()},P=()=>{S(),N().activeElement===p&&B()&&W();const e=E();if(!(e&&e.anchorNode&&e.focusNode&&p.contains(e.anchorNode)&&p.contains(e.focusNode)))return k;const n=G(p,t.skip),l=n.at(e.anchorNode,e.anchorOffset),r=n.at(e.focusNode,e.focusOffset);return k=l<=r?[l,r]:[r,l],k},K=t=>{const e=N().defaultView;t<=0||!e?A=null:e.requestAnimationFrame(()=>{m||b||(nt(),N().activeElement===p?(B()&&(W(),w()),K(t-1)):A=null)})},q=(t,e)=>{b=[t,e];const n=t=>{if(m)return;if(S())return void K(3);const e=N().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},I=(e,l,o)=>{e.text!==n?(i.record({text:n,start:l[0],end:l[1]},o,r()),n=e.text,t.write(n),q(e.caret,e.caret),w()):q(e.caret,e.caret)},z=t=>R(C(n,l),t[0],t[1]),U=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",r()),n=e.text,t.write(n);const[a,s]=L(C(n,l),e.selectionStart,e.selectionEnd);q(a,s),w()},$=t=>{if(m)return;const e=P(),[r,o]=z(e),i=X({value:n,rules:l,start:r,end:o,style:t,pending:v});if("pending"===i.kind)return v=i.pending,void w();U(i.result,e)},H=e=>{n=e.text,t.write(n),q(e.start,e.end)},Y=e=>{m||(m=!0,lt.removeEventListener("selectionchange",rt),et(p),t.end(e))},Z=(t,e)=>{const r=P();!m&&r[0]!==r[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",C(n,l).text.slice(r[0],r[1])),t.clipboardData.setData(T,V(n,l,r[0],r[1])),e&&I(j(n,l,r[0],r[1],{text:""}),r,"edit"))},J=t=>t.preventDefault(),Q=()=>{t.remount?.()},_=[["keydown",e=>{if(m||e.isComposing)return;const l=e.metaKey||e.ctrlKey;if("Escape"!==e.key){if(l&&!e.altKey&&!e.shiftKey&&("k"===e.key||"K"===e.key)&&t.onLinkKey?.())return e.preventDefault(),void e.stopPropagation();if("Enter"===e.key&&(!e.shiftKey||l))return e.preventDefault(),e.stopPropagation(),void Y("enter");if(l&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=P(),l={text:n,start:t[0],end:t[1]},r="y"===e.key||e.shiftKey?i.redo(l):i.undo(l);r&&H(r)}}else{if(e.preventDefault(),e.stopPropagation(),t.onEscape?.())return;Y("escape")}}],["beforeinput",e=>{if(m)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const r=P(),o=G(p,t.skip),a="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,s=a&&!a.collapsed?[o.at(a.startContainer,a.startOffset),o.at(a.endContainer,a.endOffset)]:null,c=F({value:n,rules:l,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:N(),sel:r,target:s,pending:v&&v.at===z(r)[0]?v:null});if(c){if("type"!==c.kind&&"edit"!==c.kind||(v=null),"history"===c.kind){const t={text:n,start:r[0],end:r[1]},e="undo"===c.dir?i.undo(t):i.redo(t);return void(e&&H(e))}"format"!==c.kind?I(c.edit,c.range,c.kind):$(c.style)}}],["compositionstart",()=>{g=P()}],["compositionend",e=>{const o=g;if(g=null,!m&&o)if(e.data){const a=j(n,l,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",r()),n=a.text,t.write(n),Q(),q(a.caret,a.caret)}else Q(),q(o[0],o[0])}],["paste",e=>{if(m)return;e.preventDefault();const r=P(),o=e.clipboardData,i=o?.getData(T)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):D({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:N(),multiline:t.multiline,rules:l});I(j(n,l,r[0],r[1],{markup:a}),r,"edit")}],["copy",t=>Z(t,!1)],["cut",t=>Z(t,!0)],["drop",J],["dragstart",J],["blur",e=>{if(m||null!==g||y)return;const n=e.target,l=n.ownerDocument.defaultView,r=()=>{m||(n.isConnected&&n===t.element()?y||n.ownerDocument.activeElement===n||Y("blur"):q(k[0],k[1]))};l?.requestAnimationFrame?l.requestAnimationFrame(r):setTimeout(r,0)}],["focus",()=>{y=!1}]];function tt(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of _)t.addEventListener(e,n)}function et(t){for(const[e,n]of _)t.removeEventListener(e,n);null===M.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",M.contenteditable),null===M.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",M.spellcheck),t.removeAttribute("data-es-typing")}function nt(){const e=t.element();e&&e!==p&&(et(p),p=e,tt(p))}const lt=p.ownerDocument;function rt(){m||w()}return lt.addEventListener("selectionchange",rt),tt(p),p.focus({preventScroll:!0}),q(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=C(t,l).text.length,[r,o]=P();n=t,i.reset(),q(Math.min(r,e),Math.min(o,e))},stop(t="stop"){Y(t)},pressed(){let t;x=!0;try{t=P()}finally{x=!1}const[e,r]=z(t),i=o(n,e,r,l),s={};for(const t of["bold","italic","underline","strike","sup","sub","link"]){const n=i.has(t),l=v&&v.at===e?v:null;s[t]=!!l?.add.includes(t)||!l?.drop.includes(t)&&n}const c=v&&v.at===e&&void 0!==v.color?v:null;return{marks:s,list:a(n,e,r,l),selected:r>e,href:f(n,e,r)?.href??null,color:c?c.color??null:h(n,e,r,l)}},press:$,insert(t){if(m)return;y=!1;const e=P(),[l,r]=z(e),o=l+t.length;U({text:n.slice(0,l)+t+n.slice(r),selectionStart:o,selectionEnd:o},e),nt(),p.focus({preventScroll:!0})},hold(){m||(P(),y=!0)},release(){y=!1},resume(){m||(y=!1,nt(),p.focus({preventScroll:!0}),q(k[0],k[1]))},link(t){if(m)return;y=!1;const e=P(),[r,o]=z(e),i=null===t?u(n,r,o,l):d(n,r,o,t,l),a=i.text===n;U(i,e),nt(),p.focus({preventScroll:!0}),a&&q(e[0],e[1])},color(t){if(m)return;const e=P(),[r,o]=z(e);if(r===o){const e=v&&v.at===r?v:null;return v={add:e?.add??[],drop:e?.drop??[],color:t,at:r},void w()}U(c(n,r,o,t,l),e)},list(e){if(m||!t.multiline)return;const r=P(),[o,i]=z(r),c=a(n,o,i,l);U(s(n,o,i,c===e?null:e,l),r)}}}var Q=(t,e,n)=>Math.min(Math.max(t,e),Math.max(e,n));function _({anchor:t,size:e,within:n,clip:l,parent:r,gap:o=8}){const i=Math.max(n.left,l.left),a=Math.min(n.right,l.right)-e.width,s=Q(t.left,i,a),c=l.bottom-(t.bottom+o),u=t.top-o-l.top,d=e.height>c&&(e.height<=u||u>c),h=d?t.top-o-e.height:t.bottom+o,f=t.left+Math.min((t.right-t.left)/2,10),p=Q(f-5-s,10,e.width-10-10);return{top:h-r.top,left:s-r.left,above:d,point:p}}var tt=t=>({left:t.left,top:t.top,right:t.right,bottom:t.bottom});function et(t,e){const n=("function"==typeof t.getClientRects?[...t.getClientRects()]:[]).filter(t=>t.height>0);if(n.length>0){const e="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():n[0];return e.height>0?tt(e):tt(n[0])}if(!e)return null;const l=e.getBoundingClientRect();return{left:l.left,top:l.top,right:l.left,bottom:l.bottom}}function nt(t){const e=t.ownerDocument,n=e.documentElement,l={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},r=e.defaultView?.getComputedStyle.bind(e.defaultView);for(let o=t.parentElement;o&&o!==n&&o!==e.body;o=o.parentElement){const t=r?.(o);if(!t||"visible"===t.overflowX&&"visible"===t.overflowY)continue;const e=o.getBoundingClientRect();if(0===e.width&&0===e.height)continue;const n=e.left+o.clientLeft,i=e.top+o.clientTop;l.left=Math.max(l.left,n),l.top=Math.max(l.top,i),l.right=Math.min(l.right,n+(o.clientWidth||e.width)),l.bottom=Math.min(l.bottom,i+(o.clientHeight||e.height))}return l}function lt(t){const e=t.offsetParent??t.parentElement;if(!e)return{left:0,top:0};const n=e.getBoundingClientRect();return{left:n.left+e.clientLeft-e.scrollLeft,top:n.top+e.clientTop-e.scrollTop}}function rt(t,e,n){const l=t.ownerDocument,r=l.createTreeWalker(t,4),o=t=>{let e=t,n=null;for(let t=r.nextNode();t;t=r.nextNode()){if(e<=t.data.length)return[t,e];e-=t.data.length,n=t}return n?[n,n.data.length]:null},i=o(e);r.currentNode=t;const a=o(n);if(!i||!a)return null;const s=l.createRange();return s.setStart(i[0],i[1]),s.setEnd(a[0],a[1]),s}export{$ as ColorWindow,T as MARKUP_CLIPBOARD_TYPE,I as TYPING_BURST_MS,U as colorRunOf,O as createHistory,j as editVisible,X as markPress,V as markupOfRange,P as newLine,lt as offsetOrigin,D as pasteToMarkup,_ as placeWindow,F as richInput,C as richLayout,et as selectionBox,R as selectionToSource,L as selectionToVisible,K as setBullet,J as startCanvasTyping,G as textMap,rt as textRange,S as toSource,A as toSourceStart,B as toVisible,nt as visibleArea};
|
|
7
|
+
/* @__PURE__ */y("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */y(k,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:z,onClick:()=>l(null),children:n.remove})})]})}var H={sup:"sub",sub:"sup"};function X(t){const{value:e,rules:n,start:l,end:r,style:a,pending:s}=t,c=H[a];if(l===r){const t=o(e,l,r,n),i=s&&s.at===l?s:null,u=t.has(a),d=!!i?.add.includes(a)||!i?.drop.includes(a)&&u;let h=(i?.add??[]).filter(t=>t!==a),f=(i?.drop??[]).filter(t=>t!==a);return d&&u?f.push(a):d||u||h.push(a),!d&&c&&(h=h.filter(t=>t!==c),t.has(c)&&(f=[...f.filter(t=>t!==c),c])),{kind:"pending",pending:h.length||f.length||void 0!==i?.color?{add:h,drop:f,color:i?.color,at:l}:null}}let u=e,d=l,h=r;if(c&&!o(u,d,h,n).has(a)&&o(u,d,h,n).has(c)){const t=i(u,d,h,c,n);({text:u,selectionStart:d,selectionEnd:h}=t)}return{kind:"edit",result:i(u,d,h,a,n)}}var Y=/^(block|list-item|flex|grid|table|flow-root)$/;function Z(t){const e=t.ownerDocument.defaultView;return!!e&&Y.test(e.getComputedStyle(t).display)}function G(t,e){const n=[],l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let o="",i=!1;const a=()=>{i&&(o+="\n",i=!1)},s=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&a(),l.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,r.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){l.set(t,o.length),r.set(t,o.length);continue}if("BR"===t.tagName){a(),l.set(t,o.length),o+="\n",r.set(t,o.length);continue}const u=Z(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),l.set(t,o.length);const d=o.length;s(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),r.set(t,o.length),u&&(i=!0)}};l.set(t,0),s(t),r.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(l.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?l.get(n[e])??r.get(t)??0:r.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const l=n[t],r=l.start+l.length;if(e<l.start)return[l.node,0];if(e<r||e===r&&(t===n.length-1||n[t+1].start>e))return 3===l.node.nodeType?[l.node,e-l.start]:[l.node,0]}const l=n[n.length-1];return l?3===l.node.nodeType?[l.node,l.length]:[l.node,0]:[t,0]}}}function J(t){const e=t.element();if(!e)return null;let n=t.value;const l=t.rules;if(G(e,t.skip).text!==C(n,l).text)return null;const r=t.now??(()=>Date.now()),i=O();let p=e,m=!1,g=null,b=null,k=[t.caret[0],t.caret[1]],v=null,y=!1,x=!1;const w=()=>{x||t.onSelect?.()},M={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},N=()=>p.ownerDocument,A=()=>N().defaultView?.getSelection()??null,E=()=>{if(!b)return!0;nt();const e=G(p,t.skip);if(e.text!==C(n,l).text)return!1;const[r,o]=b,[i,a]=e.dom(r),[s,c]=e.dom(o);return y||N().activeElement===p||p.focus({preventScroll:!0}),A()?.setBaseAndExtent(i,a,s,c),k=b,S=b,b=null,w(),!0};let S=null;const B=()=>{if(!S)return!1;const t=A(),e=t?.anchorNode??null;return!(e&&e.isConnected&&p.contains(e))||e===p&&0===t.anchorOffset&&(0!==S[0]||0!==S[1])},K=()=>{b=S,E()},P=()=>{E(),N().activeElement===p&&B()&&K();const e=A();if(!(e&&e.anchorNode&&e.focusNode&&p.contains(e.anchorNode)&&p.contains(e.focusNode)))return k;const n=G(p,t.skip),l=n.at(e.anchorNode,e.anchorOffset),r=n.at(e.focusNode,e.focusOffset);return k=l<=r?[l,r]:[r,l],k},j=t=>{const e=N().defaultView;t<=0||!e?S=null:e.requestAnimationFrame(()=>{m||b||(nt(),N().activeElement===p?(B()&&(K(),w()),j(t-1)):S=null)})},q=(t,e)=>{b=[t,e];const n=t=>{if(m)return;if(E())return void j(3);const e=N().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},I=(e,l,o)=>{e.text!==n?(i.record({text:n,start:l[0],end:l[1]},o,r()),n=e.text,t.write(n),q(e.caret,e.caret),w()):q(e.caret,e.caret)},z=t=>R(C(n,l),t[0],t[1]),U=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",r()),n=e.text,t.write(n);const[a,s]=L(C(n,l),e.selectionStart,e.selectionEnd);q(a,s),w()},$=t=>{if(m)return;const e=P(),[r,o]=z(e),i=X({value:n,rules:l,start:r,end:o,style:t,pending:v});if("pending"===i.kind)return v=i.pending,void w();U(i.result,e)},H=e=>{n=e.text,t.write(n),q(e.start,e.end)},Y=e=>{m||(m=!0,lt.removeEventListener("selectionchange",rt),et(p),t.end(e))},Z=(t,e)=>{const r=P();!m&&r[0]!==r[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",C(n,l).text.slice(r[0],r[1])),t.clipboardData.setData(T,V(n,l,r[0],r[1])),e&&I(W(n,l,r[0],r[1],{text:""}),r,"edit"))},J=t=>t.preventDefault(),Q=()=>{t.remount?.()},_=[["keydown",e=>{if(m||e.isComposing)return;const l=e.metaKey||e.ctrlKey;if("Escape"!==e.key){if(l&&!e.altKey&&!e.shiftKey&&("k"===e.key||"K"===e.key)&&t.onLinkKey?.())return e.preventDefault(),void e.stopPropagation();if(l&&!e.altKey&&!e.shiftKey&&("KeyA"===e.code||"a"===e.key||"A"===e.key))return e.preventDefault(),e.stopPropagation(),q(0,G(p,t.skip).text.length),void w();if("Enter"===e.key&&(!e.shiftKey||l))return e.preventDefault(),e.stopPropagation(),void Y("enter");if(l&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=P(),l={text:n,start:t[0],end:t[1]},r="y"===e.key||e.shiftKey?i.redo(l):i.undo(l);r&&H(r)}}else{if(e.preventDefault(),e.stopPropagation(),t.onEscape?.())return;Y("escape")}}],["beforeinput",e=>{if(m)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const r=P(),o=G(p,t.skip),a="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,s=a&&!a.collapsed?[o.at(a.startContainer,a.startOffset),o.at(a.endContainer,a.endOffset)]:null,c=F({value:n,rules:l,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:N(),sel:r,target:s,pending:v&&v.at===z(r)[0]?v:null});if(c){if("type"!==c.kind&&"edit"!==c.kind||(v=null),"history"===c.kind){const t={text:n,start:r[0],end:r[1]},e="undo"===c.dir?i.undo(t):i.redo(t);return void(e&&H(e))}"format"!==c.kind?I(c.edit,c.range,c.kind):$(c.style)}}],["compositionstart",()=>{g=P()}],["compositionend",e=>{const o=g;if(g=null,!m&&o)if(e.data){const a=W(n,l,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",r()),n=a.text,t.write(n),Q(),q(a.caret,a.caret)}else Q(),q(o[0],o[0])}],["paste",e=>{if(m)return;e.preventDefault();const r=P(),o=e.clipboardData,i=o?.getData(T)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):D({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:N(),multiline:t.multiline,rules:l});I(W(n,l,r[0],r[1],{markup:a}),r,"edit")}],["copy",t=>Z(t,!1)],["cut",t=>Z(t,!0)],["drop",J],["dragstart",J],["blur",e=>{if(m||null!==g||y)return;const n=e.target,l=n.ownerDocument.defaultView,r=()=>{m||(n.isConnected&&n===t.element()?y||n.ownerDocument.activeElement===n||Y("blur"):q(k[0],k[1]))};l?.requestAnimationFrame?l.requestAnimationFrame(r):setTimeout(r,0)}],["focus",()=>{y=!1}]];function tt(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of _)t.addEventListener(e,n)}function et(t){for(const[e,n]of _)t.removeEventListener(e,n);null===M.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",M.contenteditable),null===M.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",M.spellcheck),t.removeAttribute("data-es-typing")}function nt(){const e=t.element();e&&e!==p&&(et(p),p=e,tt(p))}const lt=p.ownerDocument;function rt(){m||w()}return lt.addEventListener("selectionchange",rt),tt(p),p.focus({preventScroll:!0}),q(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=C(t,l).text.length,[r,o]=P();n=t,i.reset(),q(Math.min(r,e),Math.min(o,e))},stop(t="stop"){Y(t)},pressed(){let t;x=!0;try{t=P()}finally{x=!1}const[e,r]=z(t),i=o(n,e,r,l),s={};for(const t of["bold","italic","underline","strike","sup","sub","link"]){const n=i.has(t),l=v&&v.at===e?v:null;s[t]=!!l?.add.includes(t)||!l?.drop.includes(t)&&n}const c=v&&v.at===e&&void 0!==v.color?v:null;return{marks:s,list:a(n,e,r,l),selected:r>e,href:f(n,e,r)?.href??null,color:c?c.color??null:h(n,e,r,l)}},press:$,insert(t){if(m)return;y=!1;const e=P(),[l,r]=z(e),o=l+t.length;U({text:n.slice(0,l)+t+n.slice(r),selectionStart:o,selectionEnd:o},e),nt(),p.focus({preventScroll:!0})},hold(){m||(P(),y=!0)},release(){y=!1},resume(){m||(y=!1,nt(),p.focus({preventScroll:!0}),q(k[0],k[1]))},link(t){if(m)return;y=!1;const e=P(),[r,o]=z(e),i=null===t?u(n,r,o,l):d(n,r,o,t,l),a=i.text===n;U(i,e),nt(),p.focus({preventScroll:!0}),a&&q(e[0],e[1])},color(t){if(m)return;const e=P(),[r,o]=z(e);if(r===o){const e=v&&v.at===r?v:null;return v={add:e?.add??[],drop:e?.drop??[],color:t,at:r},void w()}U(c(n,r,o,t,l),e)},list(e){if(m||!t.multiline)return;const r=P(),[o,i]=z(r),c=a(n,o,i,l);U(s(n,o,i,c===e?null:e,l),r)}}}var Q=(t,e,n)=>Math.min(Math.max(t,e),Math.max(e,n));function _({anchor:t,size:e,within:n,clip:l,parent:r,gap:o=8}){const i=Math.max(n.left,l.left),a=Math.min(n.right,l.right)-e.width,s=Q(t.left,i,a),c=l.bottom-(t.bottom+o),u=t.top-o-l.top,d=e.height>c&&(e.height<=u||u>c),h=d?t.top-o-e.height:t.bottom+o,f=t.left+Math.min((t.right-t.left)/2,10),p=Q(f-5-s,10,e.width-10-10);return{top:h-r.top,left:s-r.left,above:d,point:p}}var tt=t=>({left:t.left,top:t.top,right:t.right,bottom:t.bottom});function et(t,e){const n=("function"==typeof t.getClientRects?[...t.getClientRects()]:[]).filter(t=>t.height>0);if(n.length>0){const e="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():n[0];return e.height>0?tt(e):tt(n[0])}if(!e)return null;const l=e.getBoundingClientRect();return{left:l.left,top:l.top,right:l.left,bottom:l.bottom}}function nt(t){const e=t.ownerDocument,n=e.documentElement,l={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},r=e.defaultView?.getComputedStyle.bind(e.defaultView);for(let o=t.parentElement;o&&o!==n&&o!==e.body;o=o.parentElement){const t=r?.(o);if(!t||"visible"===t.overflowX&&"visible"===t.overflowY)continue;const e=o.getBoundingClientRect();if(0===e.width&&0===e.height)continue;const n=e.left+o.clientLeft,i=e.top+o.clientTop;l.left=Math.max(l.left,n),l.top=Math.max(l.top,i),l.right=Math.min(l.right,n+(o.clientWidth||e.width)),l.bottom=Math.min(l.bottom,i+(o.clientHeight||e.height))}return l}function lt(t){const e=t.offsetParent??t.parentElement;if(!e)return{left:0,top:0};const n=e.getBoundingClientRect();return{left:n.left+e.clientLeft-e.scrollLeft,top:n.top+e.clientTop-e.scrollTop}}function rt(t,e,n){const l=t.ownerDocument,r=l.createTreeWalker(t,4),o=t=>{let e=t,n=null;for(let t=r.nextNode();t;t=r.nextNode()){if(e<=t.data.length)return[t,e];e-=t.data.length,n=t}return n?[n,n.data.length]:null},i=o(e);r.currentNode=t;const a=o(n);if(!i||!a)return null;const s=l.createRange();return s.setStart(i[0],i[1]),s.setEnd(a[0],a[1]),s}export{$ as ColorWindow,T as MARKUP_CLIPBOARD_TYPE,I as TYPING_BURST_MS,U as colorRunOf,O as createHistory,W as editVisible,X as markPress,V as markupOfRange,P as newLine,lt as offsetOrigin,D as pasteToMarkup,_ as placeWindow,F as richInput,C as richLayout,et as selectionBox,R as selectionToSource,L as selectionToVisible,j as setBullet,J as startCanvasTyping,G as textMap,rt as textRange,E as toSource,S as toSourceStart,B as toVisible,nt as visibleArea};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-ZZ64CEC2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-OFBZOI6W.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as m}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-VVPZMWJE.js";import{DEFAULT_CANVAS_WORDS as c}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as s}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-B4JN227A.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-KAML3KQH.js";var a={notice:i,lock:u,save:p,chrome:e,rail:k,tree:s,panel:f,fields:h,pick:r,drag:l,menu:m,styleClipboard:t,copy:j,canvas:c,textStyles:o,screen:n},y=o=>"object"==typeof o&&null!==o;function D(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:y(n)?t[m]=y(c)?D(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function Y(o,r){return r?D(o,r):o}export{a as DEFAULT_EASEL_STRINGS,Y as mergeEaselStrings};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-SMM3ST7A.js";import{Inspector as i}from"./chunk-SO5OLDH7.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,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>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},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},j={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function w(){/* @__PURE__ */
|
|
2
2
|
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var
|
|
4
|
-
return s(
|
|
5
|
-
return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return G().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function P({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(D.Provider,{value:n,children:e})}function G(){return u(D)}function N(){return(G().useOwnerName??v)()}function T(){return(G().useDocumentLabel??g)()}function x(n,e,t,r){return(G().useBridges??h)(n,e,t,r)}function A(n){return(G().useStandaloneBridges??h)(n)}function B(n,e){(G().useDocumentPass??y)(n,e)}function I(){return G().blockRules??b}function F(){return G().blockLook??O}function R(){return G().devices??S}function H(){return G().leftView??L}function K(){return G().pinned??j}function M(){return G().saveSwitch??!0}function V(e){n(!0===G().pickFollowsSelection,e)}function W(){return G().storageNamespace||void 0}function E(){return G().styleClipboard??null}function Q(){return G().nodeKeys??!0}function Y(){return G().notify??null}function Z(){return G().Canvas??w}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return G().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,P as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,I as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,R as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,$ as useScreenInspectorPanel,H as useScreenLeftView,Q as useScreenNodeKeys,Y as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,V as useScreenPickFollowsSelection,K as useScreenPinned,M as useScreenSaveSwitch,W as useScreenStorageNamespace,E as useScreenStyleClipboard,A as useStandaloneScreenBridges};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-EHBWUEEE.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-SMM3ST7A.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-KAML3KQH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as E}from"react/jsx-runtime";var O=e=>`section:${e}`,V=e=>`block:${e}`,T=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:A,onPick:B,itemFor:H,session:L,siteWide:M,onClose:P,onHide:x,readOnly:I}){const N=d(e=>e.config),R=c(),{labelAtLevel:S,categoryLabel:W,firstSection:C,Icon:F,Thumbnail:D}=R,{blockIsOffered:K,canAddTo:Q}=a(),Y=f("screen",m).add,z=f("drag",h).add,J=p(),[Z,G]=u([]);k(()=>{let e=!1;const t=e=>K(e,J);return n(J).list().then(o=>{if(e)return;const n=N.components;G(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[N,J]);const U=b(()=>e(N,R),[N]),q=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */j(D,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Y.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(F,{type:e,size:26})}),ee=b(()=>{const e=t(U,C),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&K(e.type,J)&&n.set(e.type,e)};for(const t of e?[e]:U){const e=Q(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Q(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(U.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:V(e.type),label:e.label,cover:_(e.type),title:Y.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...q(e),cover:_(e.type)}:q(e),p=[];Z.length>0&&p.push({key:"templates",title:Y.templates,tiles:Z.map(e=>{return{type:T(e.id),label:e.name,cover:/* @__PURE__ */j(D,{type:e.node.type}),keywords:[(t=e.node.type,S(t,"section",N.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(N.categories??{})){const n=U.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(N,t,W),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!A)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?A(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[Z,U,N,Y,A,w,J]);/* @__PURE__ */
|
|
2
|
+
return v(E,{children:[
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Y.title,context:Y.contextAll,actions:/* @__PURE__ */j(r,{label:Y.done,description:Y.doneDescription,onClick:P}),onHide:x}),
|
|
4
|
+
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */j(y,{groups:ee,session:L,itemFor:e=>H(X(e)??{kind:"section",type:e}),onInsert:B?e=>{const t=X(e);t&&B(t)}:void 0,at:$,hint:Y.hint,searchLabel:Y.search,readOnly:I,words:z}),M??null]})]})}export{$ as AddSidePanel,V as blockKey,O as sectionKey,T as templateKey};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-EHBWUEEE.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-EHBWUEEE.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-SMM3ST7A.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-QKZPPI5O.js";import{ScreenStoreProvider as e}from"./chunk-YQVR54RE.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-ZZ64CEC2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(e),k=r(n);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
|
+
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
|
+
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
|
+
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function Z({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),Z=t(()=>s(!g),[g]),P=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:P.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:Z,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:P.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:P.waitingForAuthorization})}export{Z as DocumentScreen,y as ScreenMount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={add:{stop:"Stop adding here",hint:"Drag onto the page.",search:"Search blocks",searchPlaceholder:({label:e})=>e,clearSearch:"Clear search",nothing:({query:e})=>`Nothing matches “${e}”`,tryAnother:"Try another word.",tile:({label:e})=>`Add ${e}`},canvas:{addSection:"Add section",addBlock:"Add block",addButton:({label:e})=>`+ ${e}`,handle:({label:e})=>`Drag to move this ${e.toLowerCase()}
|
|
1
|
+
var e={add:{stop:"Stop adding here",hint:"Drag onto the page.",search:"Search blocks",searchPlaceholder:({label:e})=>e,clearSearch:"Clear search",nothing:({query:e})=>`Nothing matches “${e}”`,tryAnother:"Try another word.",tile:({label:e})=>`Add ${e}`},canvas:{addSection:"Add section",addBlock:"Add block",addButton:({label:e})=>`+ ${e}`,handle:({label:e})=>`Drag to move this ${e.toLowerCase()}`,typeHint:"Double-click to edit"}};export{e as DEFAULT_DRAG_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={colour:{notSet:"Not set",swatch:({label:e,shown:t})=>`${e}: ${t}`,dialog:({label:e})=>`${e} colour`,theme:"Theme colours",themeSwatchTitle:({name:e,hex:t})=>`${e} · ${t}`,themeSwatch:({name:e,hex:t})=>`${e} ${t}`,square:"Saturation and brightness",squareValue:({saturation:e,brightness:t})=>`Saturation ${e}, brightness ${t}`,hue:"Hue",hex:({label:e})=>`${e} hex code`}};export{e as DEFAULT_PICK_WORDS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-EHBWUEEE.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-SMM3ST7A.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -0,0 +1,18 @@
|
|
|
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{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as o,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as h,elementScale as u,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as b,useState as x,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as z,solidSurfaceStyle as D,Input as T}from"efficient-shell/ui";import{AddIcon as $,CloseIcon as M,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as S,jsx as E}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const s=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
+
return S("div",{className:s,style:n,"data-index":r,children:[
|
|
3
|
+
/* @__PURE__ */E("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
+
/* @__PURE__ */E("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */E(A,{content:e,children:/* @__PURE__ */E(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */E($,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,K=e=>e.width*e.height;function B(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>K(t.s.box)-K(e.s.box)||e.at-t.at).map(({s:e})=>e)}function q(e,t,n){return B(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 I(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,s=a??l??e.box;return{left:r-1,top:s.top,width:2,height:s.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 O(e,t,n,l,a=()=>!1,r=()=>!0){const s=e.filter(e=>L(e.box,t,n)).sort((e,t)=>K(e.box)-K(t.box));for(const e of s){const s=X(e,t,n),o={...e.list,index:s};if(a(o))return null;if(l(o))return{zone:e,to:o,line:I(e,s)};if(!r(o))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,s=r?a.left:a.top,o=s+(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 h=0;h<=l.length;h++){const u=l[h-1],f=l[h];let p,m;if(u&&f)p=c(u),m=Math.max(i(f)-p,0);else{const e=u?(c(u)+o)/2:(s+i(f))/2;p=Math.min(Math.max(e,s+n),o-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${h}`,place:{...e.list,index:h},box:g,axis:e.axis,label:t})}return d}function H(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],s=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(r.top-s,0)}})}return n}var R={nodes:[],zones:[]},Z="data-puck-dropzone",F="data-puck-component";function Q(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 V(e,t){const{frame:n,document:l}=e,a=e=>f(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(`[${Z}]`)){const t=e.getAttribute(Z)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${F}]`)].filter(t=>t.parentElement?.closest(`[${Z}]`)===e),o=l.map(a);s.push({key:t,list:n,box:a(e),axis:Q(o,e),children:o}),l.forEach((e,t)=>{const l=e.getAttribute(F);l&&r.push({id:l,place:{...n,index:t},box:o[t]})})}return{nodes:r,zones:s}}var Y="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(s){const{canvas:f,session:m,readOnly:k,words:z=e.canvas}=s,T=g(s);b(()=>{T.current=s});const $=g(null),M=o(f),[C,L]=x(0),K=y(()=>L(e=>e+1),[]),[q,X]=x(R);b(()=>{const e=$.current;f&&e&&X((T.current.measure??V)(f,e))},[f,M,s.revision,C]);const I=s.model,P=v(()=>I(q),[I,q]),H=w(m.subscribe,m.shown,m.shown),Z=s.choose,F=(e,t)=>{const n=B(P.sources,e,t);return 0===n.length?null:Z?Z(n):n[n.length-1]},[Q,J]=x(null),[U,_]=x(null),ee=g(null),te=()=>{ee.current&&clearTimeout(ee.current),ee.current=null},ne=()=>{te(),ee.current=setTimeout(()=>{m.get()||J(null)},140)};b(()=>te,[]);const le=g(null),ae=i(f),re=g(!1);re.current=ae,b(()=>{ae&&(te(),J(null))},[ae]);const[se,oe]=x(null);c(f,d,e=>oe(e.detail?.id??null));const ie=!se||ae||k||H?null:q.nodes.find(e=>e.id===se)?.box??null;c(f,"mousemove",e=>{const t=$.current;if(!f||!t)return;const n=h(f.frame,e.clientX,e.clientY,t),l=u(t),a={x:n.x/l,y:n.y/l};if(le.current=a,T.current.readOnly||m.get()||re.current)return;te();const r=F(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),c(f,"mouseout",e=>{e.relatedTarget||(le.current=null,ne())}),c(f,"mouseover",e=>{e.relatedTarget||K()});const ce=g(null),de=y(()=>{ce.current?.(),ce.current=null,_(null)},[]);b(()=>m.subscribe(()=>{m.get()?K():de()}),[m,de,K]),b(()=>de,[de]),("undefined"==typeof document?b:N)(()=>{if(m.get())return;const e=le.current;J(t=>k||re.current?null:e?F(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,H,m,k,Z]);const he=e=>{const t=m.get(),n=$.current;if(!t||!n)return null;const l=p(n,e.clientX,e.clientY);le.current=l;const a=O(P.zones,l.x,l.y,e=>T.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>T.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},ue={onDragEnter:e=>{if(ce.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,s=[];t&&s.push(a(t)),r&&f&&s.push(a(r,f.frame)),ce.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=he(e);if(!n)return void _(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};_(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(le.current=null,_(null))},onDrop:e=>{const t=he(e);t&&(e.preventDefault(),m.end(),de(),T.current.onDrop(t.h.item,t.t.to))}},fe={draggable:!k&&!!Q,onMouseEnter:te,onMouseLeave:()=>!m.get()&&ne(),onDragStart:e=>{if(Q&&!k){m.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),de()},onClick:()=>{Q&&!k&&T.current.onPick?.(Q.item)}},{seams:pe=[]}=P,me=P.zones.filter(e=>0===e.children.length),ge=!s.onZoneAdd||k||ae?[]:me,be=ge.map(e=>e.key).join("\n");return b(()=>{const e=f?.document;if(!e)return;const t=new Set(be?be.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(Y,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${Y}]`))t.removeAttribute(Y)}},[f,be,q,M,C]),/* @__PURE__ */S("div",{ref:$,className:"es-canvas-layer",children:[H||!s.onSeamAdd||k||ae?null:pe.map(e=>
|
|
5
|
+
/* @__PURE__ */E(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??z.addSection,onInsert:()=>s.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)),ge.length?ge.map(e=>/* @__PURE__ */E("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:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */E("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??s.zoneAddLabel??z.addBlock})})},e.key)):null,H?/* @__PURE__ */E("div",{className:"es-canvas-catch",...ue}):null,U&&!me.some(e=>e.key===U.zoneKey)?/* @__PURE__ */E("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,ie?/* @__PURE__ */E("span",{className:"es-canvas-hint"+(ie.width<200?" is-below":""),style:{...D(),left:ie.left+ie.width,top:ie.width<200?ie.top+ie.height:ie.top},children:z.typeHint}):null,
|
|
6
|
+
/* @__PURE__ */E("div",{className:"es-canvas-handle-spot",style:Q?{"--es-handle-x":`${Q.box.left+2}px`,"--es-handle-y":`${Math.max(Q.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */E(A,{className:"es-canvas-handle-tip",side:"top",content:!Q||k||H?null:Q.title??z.handle({label:Q.label}),children:/* @__PURE__ */S("div",{className:["es-canvas-handle",Q&&!k?"is-shown":"",H?"is-dragging":""].filter(Boolean).join(" "),...fe,children:[
|
|
7
|
+
/* @__PURE__ */E("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:i,readOnly:c,words:d=e.add}){const h=o??d.hint,u=i??d.search,[f,p]=x(""),m=k(),g=f.trim().toLowerCase(),b=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),y=t.map((e,t)=>({...e,key:b[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(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 S("div",{className:"es-add",children:[r?/* @__PURE__ */S("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
+
/* @__PURE__ */E("span",{children:r.label}),s(d.stop,/* @__PURE__ */E("button",{type:"button",className:"es-add-at-clear","aria-label":d.stop,onClick:r.onClear,children:/* @__PURE__ */E(M,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
+
/* @__PURE__ */E("p",{className:"es-add-hint",children:h}),
|
|
11
|
+
/* @__PURE__ */E("div",{className:"es-add-find",children:/* @__PURE__ */E(T,{id:m,type:"search","aria-label":u,placeholder:d.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */E(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */E(z,{size:"sm","aria-label":d.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */E(M,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */S("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
+
/* @__PURE__ */E("div",{className:"es-add-empty-title",children:d.nothing({query:f.trim()})}),
|
|
13
|
+
/* @__PURE__ */E("div",{className:"es-add-empty-sub",children:d.tryAnother})]}):y.map(e=>/* @__PURE__ */S("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
+
/* @__PURE__ */S("div",{className:"es-add-group-head",children:[
|
|
15
|
+
/* @__PURE__ */E("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
+
/* @__PURE__ */E("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
+
/* @__PURE__ */E("div",{className:_(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(c||e.disabled),l=c?void 0:e.disabled?e.disabledReason:e.title??d.tile({label:e.label});return s(l,/* @__PURE__ */S("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":d.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),children:[null!=e.cover?/* @__PURE__ */E("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */E("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})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,R as EMPTY_MEASURE,J as HANDLE_GRACE_MS,O as canvasTarget,L as contains,X as gapInZone,I as gapLine,P as insertSeams,V as measureCanvas,q as pickSource,H as seamsBetween,B as sourcesAt};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{styleClipboardOf as e}from"./chunk-XT6DOSHO.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-RSKHAHPJ.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-HM7S7H5H.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as S,clampPanelWidth as k}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-Z62Z75UI.js";import{useSectionOps as b}from"./chunk-OJ6QWOLG.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-FRXE6EQN.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as O}from"./chunk-GS44HQ45.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as I,useScreenPinned as N,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as L,sameInspectorMode as E,useScreenBridges as R,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as F,useScreenNotify as W,useScreenCanvasHead as D,isSlotMode as J,useScreenStyleClipboard as U,useScreenDocumentPass as G,useScreenCanvasDrag as Y,ScreenCanvasTargetProvider as Z,isPinnedFirst as K,isPinnedLast as X,screenSlotsOf as Q}from"./chunk-EHBWUEEE.js";import{useNodeClipboard as q,useNodeContextMenu as _}from"./chunk-VJZDNOQ7.js";import{PageEditGuardNotices as ee}from"./chunk-2H3W5OLQ.js";import{useScreenDocument as ne}from"./chunk-ZZ64CEC2.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{heldStyle as ce,styleShortcut as ae}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as pe}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as ue}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as fe}from"./chunk-VVPZMWJE.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as Se,blockNodeActions as ke,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{useEasel as Oe,useEaselApi as Be,CanvasPassThroughContext as Ie}from"./chunk-SMM3ST7A.js";import{toItemSelector as Ne,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Te,LayersTree as je,TreeGroupLabel as Ae,TreeRowAction as Le,TreeSeam as Ee}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Re}from"./chunk-K56YDHYQ.js";import{LayersIcon as Ve,MediaIcon as He}from"./chunk-4VJATVVR.js";import{EaselTopBar as Fe,TopBarRail as We,TopBarCluster as De,EaselIconButton as Je,TopBarDivider as Ue,DeviceSwitch as Ge,InspectorIconButton as Ye,PanelResizeHandle as Ze,MAX_PANEL_W as Ke,MIN_PANEL_W as Xe,panelWidthVars as Qe}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as qe,DEFAULT_CHROME_WORDS as _e}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-KAML3KQH.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasTyping as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as Sn,BLOCK_ATTRIBUTE as kn,drawnBox as vn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as bn,ROOT_SLOT as wn,zoneKey as xn,parseZoneKey as zn,find as Cn,DataError as On}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as Nn,useEffect as Pn,useCallback as $n,useLayoutEffect as Mn,Fragment as Tn}from"react";import{ColoredBadge as jn,toast as An,groupColors as Ln}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Rn,RefreshIcon as Vn,AddIcon as Hn,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Dn,DuplicateIcon as Jn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Gn,Fragment as Yn}from"react/jsx-runtime";var Zn=/* @__PURE__ */new WeakSet;function Kn(e,n,t){const o=Cn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Xn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Mn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Sn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${kn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=Sn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Un(jn,{colorClass:Ln("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Qn({expand:e}){/* @__PURE__ */
|
|
2
|
+
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Yn,e?{children:[
|
|
3
|
+
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
+
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
+
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
+
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
+
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var qn=`${fn}, ${hn}`;function _n(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var et="__rungs";var nt="screen:band",tt={duplicate:!0,delete:!0};function ot(){const fn=se(),{target:Sn,docId:kn,capabilities:vn,currentSlug:Ln,siteId:ot,onPublish:rt,saveState:it,saveConflict:lt,retrySave:st,toggleAutoSave:dt,flushSave:ct,access:at,saveUnreachable:pt=!1,readOnly:ut,readOnlyReason:ft=null}=ne(),ht=B(),mt=I(),{mediaEditing:gt,hasEditGuard:yt,hasPinnedChrome:St}=vn,{appState:kt,dispatch:vt,history:bt,selectedItem:wt,getSelectorForId:xt,config:zt}=Oe(e=>e),Ct=N(),{first:Ot,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Pt,panelOf:$t}=Ct,Mt=$t(Ot),Tt=e=>K(Ct,e),jt=e=>X(Ct,e),At="node"===Ct.firstRow,Lt=Ct.band??null,Et=on("screen",fe),Rt=on("tree",Re),Vt=on("drag",dn),Ht=on("notice",qe),Ft=on("lock",tn),Wt=on("menu",ue),Dt=on("styleClipboard",pe),Jt=on("chrome",_e),Ut=P()??`/${Ln}`,Gt=$(),Yt=M(),Zt=b({readOnly:ut}),Kt=b({readOnly:ut,foldIntoHistory:!0}),Xt=Bn(null),Qt=Be(),qt=In(()=>({...Zt,select:e=>{Xt.current=e,Zt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Qt.config;Xt.current=Ne(e,t,n)}Zt.commitDocument(e,n)}}),[Zt,Qt]),_t=kt.ui,eo=_t.leftSideBarVisible,no=_t.rightSideBarVisible,{options:to,widths:oo,initial:ro,fluid:io,fit:lo}=T(),[so,co]=Nn(ro),ao=oe(),po=gt&&null!==ao,uo=re(),fo=ie();j(wt?.props.id);const{read:ho,write:mo,forSelection:go}=A(),[yo,So]=Nn(ho);Pn(()=>{mo(yo)},[yo]);const[ko,vo]=Nn(0),bo=Bn(null),wo=Bn(null),xo=un(wo,{readySelector:qn}),zo=mn(xo),Co=u(wo);f(wo,xo);const Oo=d(),Bo=en(at),Io={state:it,offline:Oo||it.failed&&pt,readOnlyReason:ft,editing:Bo?Ht.editing({name:nn(Bo.name,Ft),noun:Et.noun}):null,conflict:null!=lt,notSaving:Et.bar.notSaving},No=()=>{ut||(it.failed?st():ct())};h(wo,xo,No);const[Po,$o]=Nn(!1),Mo=Bn(!1),To=Bn(!1),[jo,Ao]=Nn(null),[Lo,Eo]=Nn([]),[Ro,Vo]=Nn(L),Ho="puck"===Ro.kind,Fo=n(Ro,wt?.props.id),[Wo,Do]=Nn(null);Pn(()=>{Wo&&(t(),Do(null))},[Wo]);const Jo=Bn(xt);Jo.current=xt;const Uo=$n((e,{scroll:n})=>{So(n=>go(e,n)),n&&Do(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Jo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&br(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Go=Bn(null);Pn(()=>{const e=Go.current;Go.current=null;const n=null==wt?.props.id?null:String(wt.props.id);Vo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:$t(wt?.type)??L);const t=wt?.props.id,r=Xt.current;if(Xt.current=null,!t)return;const i=xt(t);Uo(String(t),{scroll:!o(r,i??null,Se)})},[wt?.props.id,Uo]);const Yo=$n(e=>{Vo(n=>E(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Zo=Bn(()=>{});Zo.current=(e,n)=>{const t=e?hi(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==wt?.props.id?null:String(wt.props.id);Vo(e=>E(e,n)?e:n),o!==r&&(Go.current={id:o,mode:n},qt.select(e))};const Ko=$n((e,n)=>Zo.current(e,n),[]),Xo={kind:Ro.kind,mode:Ro,open:Yo,show:e=>Vo(e),reveal:()=>{no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Ko},Qo=R(Xo,{data:kt.data,selected:wt??null,zoneOf:e=>xt(e)?.zone,readOnly:Boolean(ut),select:e=>{Vo(L),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(Se,e,n),scrollTo:e=>Vi(e)},{device:so,refreshes:ko},{setView:So,reveal:()=>{eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Qo.pinnedSource??!1,_o=Qo.resolveLeftView?Qo.resolveLeftView(yo,po):"media"===yo&&po?yo:"sections",er=V(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=H(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=$n(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Uo(e,{scroll:!0})},[vt,Uo]),{selectNode:fr,openPartId:hr}=v({mode:Ro,setMode:Vo,onOpenPart:ur}),[mr,gr]=Nn(null);de(null!==mr,()=>gr(null));const yr=y(F()),Sr=yr.collapsed,kr=yr.panelWidths,[vr,br]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Sr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
+
return new Set}});Pn(()=>{try{window.localStorage.setItem(Sr,JSON.stringify([...vr]))}catch{}},[vr]);const[wr,xr]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(kr);if(!e)return{...S};const n=JSON.parse(e);return{left:k(Number(n.left)||S.left),right:k(Number(n.right)||S.right)}}catch{return{...S}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(kr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=$n((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=$n(e=>zr("left",e),[zr]),Or=$n(e=>zr("right",e),[zr]),Br=e=>vr.has(e),Ir=e=>br(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Nr=Bn(!1),Pr=Bn(null);Pn(()=>{if(Nr.current&&!Po){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??wo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Nr.current=Po},[Po]),Pn(()=>{if(!Po||!Co)return;const e=e=>{"Escape"===e.key&&Yi()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[Po,Co]),de(Po,()=>Yi()),Pn(()=>{!eo&&Po&&($o(!1),Ao(null),Mo.current=!1)},[eo]),Pn(()=>{if(!uo)return To.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(To.current=!1);Po&&($o(!1),Ao(null),To.current=Mo.current,Mo.current=!1),eo||(To.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[uo]),Pn(()=>{!eo&&uo&&(To.current=!1,fo())},[eo]),Pn(()=>{if(!uo||!Co)return;const e=e=>{"Escape"===e.key&&fo()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[uo,Co]),de(null!==uo,()=>fo());const $r=W(),Mr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?An.error(e,{...o,duration:t?.duration??3200}):An.success(e,{...o,duration:t?.duration??1900})},Tr=Bn(null),[jr,Ar]=Nn(0),[Lr,Er]=Nn(0),Rr=D(),Vr=Bn(null),Hr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));Pn(()=>{const e=Tr.current;if(!e)return;const n=()=>{Ar(e.clientWidth),Er(Hr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Mn(()=>{Tr.current&&(Ar(Tr.current.clientWidth),Er(Hr(Tr.current)))},[wr,eo,no]);const Fr=so===io?jr>0?jr:oo[io]:oo[so],Wr=jr>0?Math.min(jr/Fr,"shrink"===lo?1:2):1,Dr=Fr*Wr,Jr=jr>0&&Dr>jr+1,Ur={width:Dr,height:Lr||"100%",flex:"none",position:"relative"},Gr={width:Fr,height:Lr?Lr/Wr:"100%",maxHeight:"none",transform:1!==Wr?`scale(${Wr})`:void 0,transformOrigin:"top left"},Yr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!eo}}),Zr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!no}}),Kr=e=>{Po&&($o(!1),Ao(null),Mo.current=!1,eo&&yo===e)||uo&&(To.current=!1,fo(),eo&&yo===e)||(eo&&yo===e?Yr():(So(e),eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Jt.mediaLibrary})},Qr=()=>{Vo(L),qt.select(null),p()},qr=()=>{Vo(Mt??L),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=kt.data.content??[],ei=()=>{const e=_r.findIndex(Tt),n=_r.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},ni=zt,ti=er.stripCopy,oi=e=>r(e,ti),ri=q(),ii=Pe({data:kt.data,config:ni,readOnly:Boolean(ut),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==bn||e.slot!==wn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Vo(L);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),li=e=>{const n=Cn(kt.data,zt,e);if(!n)return!1;const t=xn(n.place),o=n.node,r=t===Se?pi(o):Ci(o);return!!ii.remove(e)&&(Mr(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",zt.components[e]?.label??e),ci=$n(e=>zt.components[e]?.defaultProps??{},[zt]),ai=e=>dr(e,"section",di(e)),pi=e=>he({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=In(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(zt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,Se,0),{nodeAddresses:e,zoneItems:n}},[_r,zt]),hi=$n(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>Q(er,zt,e),yi=e=>{if(!er.slotsOf||e===Se)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(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}},Si=(()=>{if(!J(Ro))return null;const e=`${Ro.nodeId}:${Ro.slot}`;return yi(e)?.slot.panel===Ro.kind?e:null})(),ki=Bn(null);Pn(()=>{const e=ki.current;if(ki.current=null,!Si||!J(Ro))return;const n=Ro.nodeId;Uo(n,{scroll:e!==Si}),br(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ro]);const vi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===Se?Hi(n.index):hl(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Si!==i&&(ki.current=i),Ko(null,r),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),Vi(o)},bi=(e,n,t)=>{const o=`${e}:${n}`;if(br(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;Si!==o&&(ki.current=o);Ko(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ut||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:et,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&bi(e,d,i.panel)},xi=ar(),zi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>me(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Oi=(e,n)=>{const t=zt.components[e.type]?.fields,o=n===Se||Al(n)?"section":"block",r=n===Se&&(Tt(e)||jt(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Bi=(e,n,t,o)=>{if(!(!ut&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Oi(o,e);r&&qt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
+
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.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)},Ii=e(U(),Dt),Ni=Ii.scope({target:Sn,siteId:ot,docId:kn}),Pi=zt,$i=(e,n)=>n===Se?ai(e):di(e),Mi=(e,n,t)=>{const o=Ii.plan(Ni,t,$i(t.type,e),Pi);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Mr(o.message))},Ti=_({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===Se?ai(e):di(e),renamePropOf:Oi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:bt.hasPast,hasFuture:bt.hasFuture,back:()=>bt.back(),forward:()=>bt.forward()},openPageSettings:()=>{qt.select(null),Vo(L)},pageSettingsLabel:Et.pageSettings,words:{menu:Wt,styleClipboard:Dt,screen:Et.menu},readOnly:Boolean(ut),collapseAll:()=>br(new Set(hi(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Mr(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Rl(e,n),menuRows:Qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(kt.data,e),permits:e=>ke(zt,e.type),nodeOps:si,isPinned:(e,n)=>n===Se&&(Tt(e)||jt(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===Se?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===Se?Hi(n):hl(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>vi(n.node,n.slot,!1)}:null},style:{held:()=>ce(Ni),canCopy:e=>Ii.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ii.copy(Ni,e,$i(e.type,n),Pi),paste:(e,n,t)=>Mi(e,n,t)},keys:mt?{target:Co,selected:()=>{const e=kt.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ut),onDone:({done:e,name:n})=>{"copied"===e&&Mr(Et.copied({name:n}))}}:void 0},xo),ji=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{ji.current={copy:(e,n)=>Ii.copy(Ni,e,$i(e.type,n),Pi),paste:Mi,at:()=>{const e=kt.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ut)}});const Ai=$n(e=>{const n=ae(e);if(!n)return;const t=ji.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Pn(()=>{if(!Co)return;const e=e=>Ai(e);return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[Ai,Co]),gn(xo,"keydown",Ai);const Li=_r.map(e=>e.props.id).join("|");Pn(()=>{const e=xo?.document??null,n=xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=_r.findIndex(jt),t=n>=0?n:_r.length,o=n=>{const t=_r[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=_r.length>0&&!Tt(_r[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=_n(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Eo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[xo,Li,so,Wr,eo,no,wt?.props.id]);const Ei=xo?.document??null,Ri=xo?.window??null;Pn(()=>{const e=bo.current;if(!e||!Ei||!Ri)return;const n=[],t=()=>{const n=Ei.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ri.scrollTo({left:Ri.scrollX,top:Ri.scrollY+t,behavior:"instant"}),!0};return bo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ei,Ri]);const Vi=e=>{Qo.holdCanvasOn?Qo.holdCanvasOn(e):c(e)},Hi=e=>{Vo(L),qt.select({index:e}),Qo.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&Vi(n)},Fi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=wt&&Ro.kind!==Mt?.kind?_r.findIndex(e=>e.props.id===wt.props.id):-1;return o(r>=0?r+1:t)},Wi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(Se,e,i),qt.select({index:i}),{moved:!0,dest:i})},Di=(e,n,t,o)=>{Vo(L),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Mr(Et.sectionAdded({name:t}))},Ji=(e,n)=>{const t=Fi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ce,sectionLabel:ai,blockIsOffered:lr}),r=o?qt.insertNode(Se,t,o):qt.insertSection(e,t);return Di(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of be(zt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ui=e=>Gi(Se,e),Gi=(e,n)=>{Pr.current=document.activeElement??null,uo&&(Mo.current=To.current,To.current=!1,fo()),Ao(null===n?null:{zone:e,index:n}),$o(!0),eo||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Yi=()=>{$o(!1),Ao(null),Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Mo.current=!1},Zi=(e,n)=>sr.rowName?n?Tt(e)?sr.rowName(e,"section",Et.header):jt(e)?sr.rowName(e,"section",Et.footer):Nt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Ki=e=>n=>{e()},Xi=()=>Qo.editPinnedSource?.(),Qi=(e,n,t)=>{if(ut)return null;const o=hi(e)[n];return o&&!ke(zt,o.type).delete?null:/* @__PURE__ */Un(Le,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Un(Fn,{size:15})})},qi=e=>sr.rowPreview?.(e)||void 0,_i=e=>sr.rowMarks?.(e)??void 0,el=(e,n,t)=>sr.rowActions?.(e,n,t)??null,nl=(e,n,t,o)=>{if(ut)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
+
return Un(Le,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>ol(e,n,t),children:/* @__PURE__ */Un(r?Wn:Dn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},tl=e=>ms(Se,e),ol=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},rl=e=>we(zt,e),il=e=>be(zt,e),ll=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:il(e)}],sl=e=>er.slotsOf?ll(e).flatMap(e=>e.kids):il(e),dl=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),cl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),al=(e,n,t)=>{const o=ze(zt,e.type,n)&&(t||sl(e).length>0||dl(e));return{collapsible:o,folded:o&&Br(String(e.props.id))}},pl=(e,n,t)=>ll(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>al(e,r,t(e.type)).collapsible?[String(e.props.id),...pl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),ul=e=>sl(e).length>0||dl(e)||Boolean(ir(e.type)),fl=e=>Boolean(ir(e)),hl=(e,n,t,o)=>{if(Vo(L),ir(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),qt.select({index:n,zone:e}),c(t)}else qt.select({index:n,zone:e}),Vi(t)},ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},gl=Bn(/* @__PURE__ */new Set);Pn(()=>{_r.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(gl.current.has(t))return;gl.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(ci)).forEach((e,t)=>Kt.seedChild(o,t,n.childType,e))})},[_r,Kt,ci]);const yl=Bn(/* @__PURE__ */new Set);Pn(()=>{_r.forEach((e,n)=>{const t=e.props.id;if(yl.current.has(t))return;const o=i(e,rl(e.type));yl.current.add(t),o&&Kt.replaceComponent(Se,n,{...e,props:o})})},[_r,Kt]),G(Kt,zt);const Sl=_r.findIndex(jt),kl=Sl>=0?_r[Sl]:null,vl=At?_r.findIndex(Tt):-1,bl=vl>=0?_r[vl]:null,wl=Ct.groupTab,xl=In(()=>wl?e=>Nt(e.type):void 0,[wl]),zl=Boolean(Ct.groupBadge),Cl=Ct.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(jn,{tone:"info",size:"xs",children:Ct.groupBadge})}):void 0,Ol=_r.find(e=>e.type===Bt)??null,Bl=_r.find(e=>e.type===It)??null,Il=Sl>=0?Sl:_r.length,Nl=[];_r.forEach(e=>{jt(e)||(ul(e)&&Nl.push(String(e.props.id)),Nl.push(...pl(e,1,fl)))}),kl&&(Nl.push(String(kl.props.id)),Nl.push(...pl(kl,1,fl)));const Pl=Nl.length>0&&Nl.every(e=>vr.has(e)),$l=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Ml=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...zn(e),index:t},l={...zn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=pn(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof On))throw e}},Tl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of il(e))n.add(r),t(o)};for(const t of rl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Al=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Pt(n)===e?t:null},Ll=(e,n)=>{const t=Al(e);return!t||(!Ct.groupAccepts||Ct.groupAccepts(t.type,n,hi(e).length))},El=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===et&&n.index>=0&&n.index<=o}if(n.slot===et)return!1;if(e.add)return Fl(e.add,n);const o=xn(n);if(Nt(e.type))return!1;const r=Al(o),i=Al(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ll(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=kl&&!Ct.lastIsOpen?String(kl.props.id):null;return(!l||jl(e.zone)!==l&&jl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Tl(r).has(n))return!1;const d=ir(s.type,or(kt?.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?.(hi(n),r))})(e.zone,o,e.index,t)},Rl=(e,n)=>{const t=xn(e.from),o=e.node;return t===xn(n)?Ll(t,o.type):El({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Vl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(kt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:di(r.spec.childType)}]:[]),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Zi(o,t.zone===Se)}},Hl=(e,n)=>{if("section"!==e.kind)return e;const t=xn(n);return t===Se||Al(t)?e:Vl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Fl=(e,n)=>{const t=Hl(e,n),o=xn(n);if("block"!==t.kind){if(Al(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ll(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=Vl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Wl=(e,n)=>{const t=Hl(e,n);if("block"!==t.kind&&Al(xn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ll(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,oi(e.template.node))}Vo(L),qt.select({index:t,zone:n})}})(t,xn(n),n.index);if("section"===t.kind)return void Ji(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Fi(t),r=qt.insertNode(Se,o,n);Di(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=xn(n),r=Vl(o);r&&(r.target.spec?ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{qt.insertComponent(e,n,t),Vo(L),qt.select({index:t,zone:e})})(o,t.type,n.index))},Dl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Wl(e.add,n):e.zone===Se?Wi(e.index,n.index):Ml(e.zone,xn(n),e.index,n.index)},[Jl]=Nn(()=>cn()),Ul=an({keyOf:e=>e.id,readOnly:Boolean(ut),session:Jl,canDrop:El,onDrop:Dl,onStep:(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Se?((e,n)=>{const t=ai(_r[e]?.type??""),o=Wi(e,n<0?e-1:e+2);if(!o.moved)return void Mr(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=ei();Mr(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ml(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Gl=$n(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=xn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Tt(i)||jt(i)||nr(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Al(e)),s=e===Se||l;e===Se&&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?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=xn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Vl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Al(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=xn(e.list),t=n===Se||Al(n)?null:Vl(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[kt.data]),Yl=null==wt?.props.id?null:String(wt.props.id),Zl=$n(e=>{const n=zt,t=e=>!e.item.rung&&null!==Cn(kt.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(Yl);return i||(r($e(kt.data,n,o.item.id,Yl,xl))??o)},[kt.data,zt,Yl,xl]),[Kl,Xl]=Nn(null);gn(xo,"mouseover",e=>{if(!wl)return;const n=yn(e.target),t=n?Kn(kt.data,zt,n):null;t!==Kl&&Xl(t)}),gn(xo,"mouseout",e=>{wl&&!e.relatedTarget&&Xl(null)});const Ql=e=>Tt(e)||jt(e)||Nt(e.type),ql=[];if(wl){const e=Yl?Kn(kt.data,zt,Yl):null;for(const n of/* @__PURE__ */new Set([e,Kl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!Ql(e))continue;const t=wl(e);t&&ql.push({id:String(e.props.id),label:t,below:Tt(e)||e.type===Bt})}}const _l=le(),es=Bn(null);Pn(()=>{const e=Ct.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(Ql)),t=es.current;if(es.current={doc:kn,bands:n,index:bt.index},!t||t.doc!==kn||t.bands===n)return;bt.hasPast&&bt.index>=t.index&&!Zn.has(_l)&&(Zn.add(_l),Mr(e,"success",{action:{label:Et.bar.undo,onClick:()=>bt.back()},duration:8e3}))},[_r]);const ns=e=>{Vo(L),qt.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},ts=Y(),os=()=>({data:kt.data,device:so,ops:qt,inspector:Xo}),rs=ts?.model,is=In(()=>rs?e=>rs(e,Gl(e),os()):Gl,[rs,Gl,so]),ls=ts?.measure,ss=ls?(e,n)=>ls(e,n,os()):void 0,ds=ts?.canDrop,cs=ds?(e,n)=>ds(e,n,El,os()):El,as=ts?.drop,ps=as?(e,n)=>as(e,n,Dl,os()):Dl,us=ts?.pick,fs=us?e=>us(e,ns,os()):ns,hs=e=>{const n=xn(e),t=yi(n);t&&vi(t.node,t.slot,!1),Gi(n,e.index)},ms=(e,n)=>/* @__PURE__ */Un(Ee,{...ut?{}:Ul.seam({place:{...zn(e),index:n}})},`seam:${e}:${n}`),gs={rowClick:Ki,isCollapsed:Br,toggleCollapse:Ir},ys=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=Pt(n),r=hi(o),i=Br(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>ms(o,e);/* @__PURE__ */
|
|
11
|
+
return Gn(Yn,{children:[
|
|
12
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:e.type,size:13}),name:s,preview:qi(e),marks:_i(e),onSelect:()=>Hi(t),nameSlot:Bi(Se,t,n,s),selected:Fo===n,badge:Cl,actions:el(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Ki(()=>Hi(t))},fold:{open:!i,label:"section",onToggle:()=>Ir(n)}}),!i&&/* @__PURE__ */Gn(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=ul(n),s=l&&Br(r),c=()=>hl(o,t,r,e.type),{rowProps:a,...p}=Ul.row({item:{id:r,zone:o,index:t,type:n.type},place:{...zn(o),index:t}},{"data-node-id":r,onClick:Ki(c)});/* @__PURE__ */
|
|
13
|
+
return Gn(Tn,{children:[d(t),
|
|
14
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:i,preview:qi(n),marks:_i(n),onSelect:c,nameSlot:Bi(o,t,r,i),selected:Fo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Gn(Yn,{children:[Qi(o,t,i),el(n,o,t),nl(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un(Te,{children:vs(n,2)})]},r)}),d(r.length)]})]})},Ss=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Ul.dragging,d=!Br(l)&&s?.rung?.nodeId!==i,c={...zn(l),index:0},a=s&&!s.rung&&El(s,c)?c:void 0,p=()=>vi(e,n,!0),{rowProps:u,...f}=Ul.row({item:{id:`rung:${l}`,zone:`${i}:${et}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:et,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ki(p)}),h=ut?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
+
return Gn(Tn,{children:[n.heading,
|
|
16
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Si===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ir(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Yn,{children:h.map((t,o)=>/* @__PURE__ */Un(Le,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(ut||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&bi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Un(Fn,{size:15}):/* @__PURE__ */Un(Jn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un(Te,{children:r})]},l)},ks=(e,n)=>{const t=ll(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
+
return Un(Yn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=cl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>ms(e,n),p=/* @__PURE__ */Gn(Yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Fo===String(n.props.id),{collapsible:i,folded:s}=al(n,l,fl(n.type)),d=String(n.props.id),c=$l(n),p=()=>hl(t,o,d,e.type),{rowProps:u,...f}=Ul.row({item:{id:d,zone:t,index:o,type:n.type},place:{...zn(t),index:o}},{"data-node-id":d,onClick:Ki(p)});/* @__PURE__ */
|
|
18
|
+
return Gn(Tn,{children:[0===o&&a(t,0),
|
|
19
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:c,preview:qi(n),marks:_i(n),onSelect:p,nameSlot:Bi(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ir(d)}:void 0,actions:/* @__PURE__ */Gn(Yn,{children:[Qi(t,o,c),el(n,t,o),nl(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un(Te,{children:ks(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?Ss(e,t.rung,r++,o,p):/* @__PURE__ */Un(Tn,{children:p},t.slot??"")})})},vs=(e,n)=>{const t=or(kt?.data,e.type,String(e.props.id)),o=ll(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
+
return Un(Yn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=cl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>ms(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Gn(Yn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Fo===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=al(n,s,fl(n.type)),a=rl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...zn(p),index:hi(p).length}:void 0,f=Ul.dragging,h=u&&f&&El(f,u)?u:void 0,g=()=>hl(t,o,l,e.type),{rowProps:y,...S}=Ul.row({item:{id:l,zone:t,index:o,type:n.type},place:{...zn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Ki(g)});/* @__PURE__ */
|
|
21
|
+
return Gn(Tn,{children:[0===o&&m(t,0),
|
|
22
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:n.type,size:13}),name:i,preview:qi(n),marks:_i(n),onSelect:g,nameSlot:Bi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Ir(l)}:void 0,actions:nr(n.type)?el(n,t,o)??void 0:/* @__PURE__ */Gn(Yn,{children:[Qi(t,o,i),el(n,t,o),nl(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un(Te,{children:vs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
+
/* @__PURE__ */Un(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ml(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Ss(e,o.rung,i++,r,S):/* @__PURE__ */Un(Tn,{children:S},o.slot??"")})})},bs=Po||null!==uo,ws=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:eo&&!bs&&_o===e.id,onSelect:()=>Kr(e.id)}:e,xs=[...(Qo.railLead??[]).map(ws),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Un(Ve,{}),active:eo&&!bs&&"sections"===_o,onSelect:()=>Kr("sections")},...(Qo.railTrail??[]).map(ws)];po?xs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Un(He,{}),active:eo&&!Po&&(null!==uo||"media"===_o),onSelect:()=>Kr("media")}):gt&&xs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Un(He,{}),onSelect:Xr});const zs=[...Qo.railLead??[],...Qo.railTrail??[]].find(e=>"panel"in e&&e.id===_o),Cs=Boolean(Lt?.foldable)&&!qo,Os=Lt?.label??(yt?Et.pageSections:Et.templateSections),Bs=Cs&&Br(nt),Is=/* @__PURE__ */Gn(Yn,{children:[_r.map((e,n)=>{if(Tt(e)||jt(e)||Nt(e.type))return null;const t=Fo===String(e.props.id),o=Boolean(e.props._hidden);il(e);const r=String(e.props.id),i=Qo.hasOwnRows?.(e)??!1,l=ul(e)||i,s=l&&Br(r),d=rl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...zn(c),index:hi(c).length}:void 0,p=Ul.dragging,u=a&&p&&El(p,a)?a:void 0,{rowProps:f,...h}=Ul.row({item:{id:r,zone:Se,index:n,type:e.type},place:{...zn(Se),index:n},into:u},{"data-node-id":r,onClick:Ki(()=>Hi(n))});/* @__PURE__ */
|
|
24
|
+
return Gn(Tn,{children:[n>0&&tl(n),
|
|
25
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:e.type,size:13}),name:pi(e),preview:qi(e),marks:_i(e),onSelect:()=>Hi(n),nameSlot:Bi(Se,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Gn(Yn,{children:[Qi(Se,n,pi(e)),el(e,Se,n),nl(Se,n,e,pi(e))]}),rowProps:f}),ul(e)&&!s&&/* @__PURE__ */Gn(Te,{children:[vs(e,1),Qo.partRows?.(e,gs)]}),i&&!s&&/* @__PURE__ */Un(Te,{children:Qo.ownRows?.(e,n,gs)})]},String(e.props.id??n))}),!qo&&Il>0&&tl(Il)]}),Ns=(e,n,t)=>{const o=String(e.props.id),r=sl(e).length>0||dl(e)||Boolean(ir(e.type)),i=r&&Br(o),l="header"===t?Et.header:Et.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
+
return Gn(Yn,{children:[
|
|
27
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:t,size:13}),name:s,preview:qi(e),marks:_i(e),badge:Cl,onSelect:()=>Hi(n),nameSlot:Bi(Se,n,o,s),selected:Fo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ir(o)}:void 0,actions:el(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Ki(()=>Hi(n))}}),r&&!i&&/* @__PURE__ */Un(Te,{children:ks(e,1)})]})};return(Qo.wrap??(e=>e))(
|
|
28
|
+
/* @__PURE__ */Un(Z,{target:xo,children:/* @__PURE__ */Gn("div",{ref:wo,className:"sf-editor es-editor",style:Qe(wr),onContextMenu:Ti.onEditorContextMenu,...m(fn),children:[
|
|
29
|
+
/* @__PURE__ */Gn(Fe,{children:[
|
|
30
|
+
/* @__PURE__ */Un(We,{items:xs,ariaLabel:Et.bar.views}),
|
|
31
|
+
/* @__PURE__ */Gn(De,{children:[
|
|
32
|
+
/* @__PURE__ */Un(Je,{label:Et.bar.undo,disabled:Boolean(ut)||!bt.hasPast,onClick:()=>bt.back(),children:/* @__PURE__ */Un(En,{})}),
|
|
33
|
+
/* @__PURE__ */Un(Je,{label:Et.bar.redo,disabled:Boolean(ut)||!bt.hasFuture,onClick:()=>bt.forward(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
34
|
+
/* @__PURE__ */Un(Ue,{}),
|
|
35
|
+
/* @__PURE__ */Un(Ge,{devices:to,value:so,onChange:co}),
|
|
36
|
+
/* @__PURE__ */Un(Je,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{bo.current=(()=>{const e=xo?.document;if(!e)return null;const n=_r.findIndex(jt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[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=wt?.props?.id??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Un(Vn,{})})]}),
|
|
37
|
+
/* @__PURE__ */Gn(De,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
+
/* @__PURE__ */Un(l,{input:Io,words:Et.saveStatus}),Qo.barLead?.(),Qo.barTrail?.(),Qo.mainAction||!Qo.barMain?/* @__PURE__ */Un(s,{input:Io,action:Qo.mainAction??{label:Et.done,onPress:()=>{rt(kt.data)}},readOnly:Boolean(ut),saveSwitch:ht,onToggleAutoSave:dt,onSaveNow:No,bar:Et.bar,words:Et.saveStatus}):Qo.barMain()]})]}),
|
|
39
|
+
/* @__PURE__ */Un(ee,{}),
|
|
40
|
+
/* @__PURE__ */Gn("div",{className:"sf-body",children:[eo?/* @__PURE__ */Gn(Yn,{children:[
|
|
41
|
+
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:Po?/* @__PURE__ */Un(x,{at:jo?{label:(e=>{const n=Al(e.zone);if(n)return Et.add.addingTo({name:sr.rowName?Zi(n,!0):di(n.type)});if(e.zone===Se){const n=_r[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Zi(n,!0)}):Et.add.addingAtEnd}const t=Vl(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(jo),onClear:()=>Ao(null)}:void 0,placeBlocks:jo&&jo.zone!==Se?Vl(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...zn(jo.zone),index:jo.index};if(Fl(e,n))return null;const t=Al(jo.zone);if(t)return Et.add.notInside({name:Zi(t,!0)});if(jo.zone===Se)return Et.add.onlySections;const o=Vl(jo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...zn(jo.zone),index:jo.index};Fl(e,n)&&(Wl(e,n),Yi())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Jl,siteWide:Qo.addPanelRow?.(Yi),onClose:Yi,onHide:Yr,readOnly:Boolean(ut)}):uo&&ao?
|
|
42
|
+
/* @__PURE__ */Un(O,{panel:ao,pick:uo,onHide:Yr}):zs?zs.panel({onHide:Yr,notify:Mr}):"media"===_o&&ao?/* @__PURE__ */Un(O,{panel:ao,pick:null,onHide:Yr}):/* @__PURE__ */Gn(Yn,{children:[
|
|
43
|
+
/* @__PURE__ */Un(z,{icon:/* @__PURE__ */Un(Ve,{}),title:Et.layers,context:Ut,actions:/* @__PURE__ */Gn(Yn,{children:[!ut&&/* @__PURE__ */Un(Ye,{label:Et.add.title,onClick:()=>Ui(null),children:/* @__PURE__ */Un(Hn,{size:15})}),
|
|
44
|
+
/* @__PURE__ */Un(Ye,{label:Pl?Et.expandAll:Et.collapseAll,title:0===Nl.length?Et.nothingToFold:void 0,disabled:0===Nl.length,onClick:()=>br(e=>{const n=new Set(Nl);return Pl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Nl])}),children:/* @__PURE__ */Un(Qn,{expand:Pl})})]}),onHide:Yr}),
|
|
45
|
+
/* @__PURE__ */Gn(je,{className:"sf-tree sf-scroll",words:Rt,children:[
|
|
46
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"page",size:13}),name:Et.pageSettings,onSelect:Qr,selected:!wt&&Ho,rowProps:{onClick:Ki(Qr)}}),Ol&&/* @__PURE__ */Gn(Yn,{children:[!zl&&/* @__PURE__ */Un(Ae,{children:Et.header}),ys(Ol)]}),!qo&&St&&!(zl&&Ol)&&/* @__PURE__ */Gn(Yn,{children:[!zl&&/* @__PURE__ */Un(Ae,{children:Et.header}),!At&&/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"header",size:13}),name:Et.header,badge:Cl,onSelect:qr,selected:Ro.kind===Mt?.kind,rowProps:{onClick:Ki(qr)}})]}),!qo&&bl&&!(zl&&Ol)&&Ns(bl,vl,"header"),!qo&&!Cs&&/* @__PURE__ */Un(Ae,{children:Os}),Cs?/* @__PURE__ */Gn(Yn,{children:[
|
|
47
|
+
/* @__PURE__ */Un(Me,{words:Rt,icon:null,name:Os,fold:{open:!Bs,label:Os,onToggle:()=>Ir(nt)}}),!Bs&&/* @__PURE__ */Un(Te,{children:Is})]}):Is,St&&!zl&&/* @__PURE__ */Un(Ae,{children:Et.footer}),kl&&!(zl&&Bl)&&Ns(kl,Sl,"footer"),!qo&&!kl&&St&&!zl&&/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(cr,{type:"footer",size:13}),name:Et.footer,onSelect:Xi,rowProps:{onClick:Ki(Xi),title:Et.editFooter}}),Bl&&ys(Bl),Qo.treeFoot?.()]})]})}),
|
|
48
|
+
/* @__PURE__ */Un(Ze,{side:"left",width:wr.left,min:Xe,max:Ke,defaultWidth:S.left,label:Et.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Un(C,{side:"left",onShow:Yr}),
|
|
49
|
+
/* @__PURE__ */Gn("div",{ref:Tr,className:"sf-center sf-scroll","data-sf-canvas-head":Rr?"":void 0,style:{overflowX:Jr?"auto":"hidden",overflowY:"hidden"},children:[Rr&&/* @__PURE__ */Un("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Un(Rr,{device:so})}),
|
|
50
|
+
/* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Ur,children:[
|
|
51
|
+
/* @__PURE__ */Un("div",{className:"sf-frame "+(so===io?"":`sf-frame--${so}`),style:Gr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
|
|
52
|
+
/* @__PURE__ */Un(Ie.Provider,{value:xl,children:/* @__PURE__ */Un(Gt,{},ko)}),
|
|
53
|
+
/* @__PURE__ */Un(ln,{canvas:xo,session:Jl,model:is,measure:ss,canDrop:cs,onDrop:ps,choose:Zl,onPick:fs,onZoneAdd:hs,onSeamAdd:hs,zoneAddLabel:Et.canvasAddBlock,words:Vt.canvas,readOnly:Boolean(ut),revision:kt.data}),Lo.length>0&&!zo&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:Lo.map(e=>
|
|
54
|
+
/* @__PURE__ */Un(sn,{index:e.index,label:Et.addSectionHere,onInsert:()=>Ui(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))})]})}),wl?/* @__PURE__ */Un(Xn,{canvas:xo,tabs:ql,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Hi(n)}}):null]})]}),no?/* @__PURE__ */Gn(Yn,{children:[
|
|
55
|
+
/* @__PURE__ */Un(g,{value:{selectChild:hl,addChild:ml,childRowName:Ci,blockRowName:$l},children:/* @__PURE__ */Un(Yt,{mode:Ro,onOpenWebsiteSettings:Qo.openSettings??(()=>{}),onOpenSiteStyles:Qo.openStyles,onSelectNode:fr,onNotify:Mr,onHidePanel:Zr,nodeActions:wt?ke(zt,wt.type):tt})}),
|
|
56
|
+
/* @__PURE__ */Un(Ze,{side:"right",width:wr.right,min:Xe,max:Ke,defaultWidth:S.right,label:Et.resizeSettingsPanel,onResize:Or})]}):
|
|
57
|
+
/* @__PURE__ */Un(C,{side:"right",onShow:Zr})]}),Ti.menu]})}))}export{ot as ScreenChrome};
|