efficient-easel 14.2.0 → 16.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 +5 -4
- 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-44QA42OJ.js → chunk-63ZDVAVE.js} +1 -1
- package/dist/chunk-BALFHI3G.js +2 -0
- package/dist/{chunk-CMXK3JT3.js → chunk-GGC72GS4.js} +1 -1
- package/dist/{chunk-CY52PUMZ.js → chunk-HM7S7H5H.js} +1 -1
- package/dist/{chunk-XGW6NWLC.js → chunk-JD5HXBEX.js} +1 -1
- package/dist/{chunk-AYWN5NRH.js → chunk-KAML3KQH.js} +1 -1
- package/dist/{chunk-YKJ3RIMT.js → chunk-KFPCMMRK.js} +1 -1
- package/dist/chunk-N2B32EZB.js +5 -0
- package/dist/{chunk-TR4APEJZ.js → chunk-N2BVA6TS.js} +1 -1
- package/dist/chunk-N3LYD2LK.js +21 -0
- package/dist/chunk-OFBZOI6W.js +1 -0
- package/dist/{chunk-F3A7SXSV.js → chunk-OK7OH2ZN.js} +1 -1
- package/dist/{chunk-35VMTYPH.js → chunk-P3XVBLZ6.js} +4 -4
- package/dist/chunk-POSLNRTO.js +18 -0
- package/dist/chunk-PQRYAW2G.js +5 -0
- package/dist/chunk-RQBIFINA.js +57 -0
- package/dist/chunk-SMM3ST7A.js +13 -0
- package/dist/chunk-U6LJ5UKD.js +6 -0
- package/dist/chunk-UVQR7W6I.js +1 -0
- package/dist/chunk-WXFZD7WC.js +1 -0
- package/dist/chunk-X4T6JT3M.js +1 -0
- 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/fields/index.js +1 -1
- package/dist/menu/index.d.ts +22 -27
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.css +7 -6
- 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.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -3
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +2 -2
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +2 -2
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -2
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.d.ts +2 -2
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +2 -2
- 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-5XUMLKQF.js +0 -6
- package/dist/chunk-643PVCEG.js +0 -1
- package/dist/chunk-BXMXTO36.js +0 -1
- package/dist/chunk-CSGTPJTY.js +0 -5
- package/dist/chunk-D46OYLJR.js +0 -5
- package/dist/chunk-EA2HTX37.js +0 -5
- 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-SO5OLDH7.js +0 -21
- package/dist/chunk-XUAKHY4T.js +0 -57
package/README.md
CHANGED
|
@@ -1051,13 +1051,15 @@ runs the same rules (`--axe <axe.min.js>`).
|
|
|
1051
1051
|
<EaselContextMenu x={e.clientX} y={e.clientY} owner={e.currentTarget} items={items} onClose={close} />
|
|
1052
1052
|
```
|
|
1053
1053
|
|
|
1054
|
-
Or the shell's own
|
|
1054
|
+
Or the shell's own menu, with the editors' item list as its `items`
|
|
1055
|
+
(efficient-shell 8.18.0, #580: the shell draws every row with its one
|
|
1056
|
+
renderer; `EaselMenuItems` is gone since this change):
|
|
1055
1057
|
|
|
1056
1058
|
```tsx
|
|
1057
1059
|
import { ContextMenu, useContextMenu } from 'efficient-shell/ui';
|
|
1058
|
-
import {
|
|
1060
|
+
import { easelMenuEntries } from 'efficient-easel/menu';
|
|
1059
1061
|
|
|
1060
|
-
{menu.state && <ContextMenu {...menu.props}
|
|
1062
|
+
{menu.state && <ContextMenu {...menu.props} items={easelMenuEntries(items)} />}
|
|
1061
1063
|
```
|
|
1062
1064
|
- **A dropdown's open list has a name.** In a settings row
|
|
1063
1065
|
(`InspectorField`) the list is `aria-labelledby` the row's own label. A
|
|
@@ -1358,7 +1360,6 @@ const german: DeepPartial<EaselStrings> = {
|
|
|
1358
1360
|
<EaselRail items={items} ariaLabel={strings.rail.label} />
|
|
1359
1361
|
<TreeRow … words={strings.tree} />
|
|
1360
1362
|
<ColourPicker … words={strings.pick.colour} />
|
|
1361
|
-
<ImageBox … words={strings.pick.image} />
|
|
1362
1363
|
<AddPanel … words={strings.drag.add} />
|
|
1363
1364
|
<CanvasDragLayer … words={strings.drag.canvas} />
|
|
1364
1365
|
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-PQRYAW2G.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";function r(e){return e.map((e,n)=>{const l=String(n);if("—"===e.label)return{type:"divider",key:l};if(e.header)return{type:"label",key:l,label:e.label};if(e.children?.length){const n=e.children.some(e=>void 0!==e.checked);return{type:"submenu",key:l,label:e.label,icon:i(e),items:e.children.map((e,l)=>n?{type:"radio",key:String(l),label:c(e),icon:i(e),checked:Boolean(e.checked),onSelect:e.onClick}:{type:"item",key:String(l),label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick})}}return{type:"item",key:l,label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick}})}function t(e){return e.find(e=>e.header)?.label}function i(n){return null==n.icon?void 0:/* @__PURE__ */e("span",{className:"es-menu-icon","aria-hidden":"true",children:n.icon})}function c(r){return null==r.icon&&null==r.shortcut?r.label:/* @__PURE__ */n(l,{children:[
|
|
2
|
+
/* @__PURE__ */e("span",{className:"es-menu-label",children:r.label}),null==r.shortcut?null:/* @__PURE__ */e("span",{className:"es-menu-shortcut","aria-hidden":"true",children:r.shortcut})]})}export{r as easelMenuEntries,t as menuLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-N2BVA6TS.js";import{SELECTION_MODE as e}from"./chunk-PQRYAW2G.js";import{usePreviewParts as r}from"./chunk-I54UCYOU.js";import{decodePartId as t,encodePartId as n}from"./chunk-IYT6NN2J.js";import{useEasel as p}from"./chunk-SMM3ST7A.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=r(),l=d(o=>{const r=t(o);if(!r)return;const{nodeId:n,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const S=s(m)?n(m.nodeId,m.propKey):null;c(()=>{f(S)},[S,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:S}}export{m as usePartBridge};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-OFBZOI6W.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-VVPZMWJE.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as m}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as n}from"./chunk-WK3AFPXY.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:n,styleClipboard:m,copy:j,canvas:c,textStyles:o,screen:t},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 +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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-PQRYAW2G.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SMM3ST7A.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1,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-PQRYAW2G.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 O}from"react/jsx-runtime";var V=e=>`section:${e}`,A=e=>`block:${e}`,P=e=>`template:${e}`;function T({at:T,placeBlocks:$,canTake:w,onPick:E,itemFor:L,session:M,siteWide:R,onClose:x,onHide:B,readOnly:H}){const I=d(e=>e.config),N=c(),{labelAtLevel:S,categoryLabel:W,firstSection:C,Icon:F,Thumbnail:Q}=N,{blockIsOffered:Y,canAddTo:D}=a(),K=f("screen",m).add,z=f("drag",h).add,G=p(),[J,Z]=u([]);k(()=>{let e=!1;const t=e=>Y(e,G);return n(G).list().then(o=>{if(e)return;const n=I.components;Z(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[I,G]);const q=b(()=>e(I,N),[I]),U=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */j(Q,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:K.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=J.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(q,C),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Y(e.type,G)&&n.set(e.type,e)};for(const t of e?[e]:q){const e=D(t.type)?.choices??[];e.forEach(s),e.forEach(e=>D(e.type,1)?.choices?.forEach(s))}$?.forEach(s);const i=new Set(q.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:A(e.type),label:e.label,cover:_(e.type),title:K.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];J.length>0&&p.push({key:"templates",title:K.templates,tiles:J.map(e=>{return{type:P(e.id),label:e.name,cover:/* @__PURE__ */j(Q,{type:e.node.type}),keywords:[(t=e.node.type,S(t,"section",I.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(I.categories??{})){const n=q.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(I,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)})}),!w)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?w(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))]},[J,q,I,K,w,$,G]);/* @__PURE__ */
|
|
2
|
+
return v(O,{children:[
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:K.title,context:K.contextAll,actions:/* @__PURE__ */j(r,{label:K.done,description:K.doneDescription,onClick:x}),onHide:B}),
|
|
4
|
+
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */j(y,{groups:ee,session:M,itemFor:e=>L(X(e)??{kind:"section",type:e}),onInsert:E?e=>{const t=X(e);t&&E(t)}:void 0,at:T,hint:K.hint,searchLabel:K.search,readOnly:H,words:z}),R??null]})]})}export{T as AddSidePanel,A as blockKey,V as sectionKey,P as templateKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-PQRYAW2G.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,21 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-2XMHLXMA.js";import{FieldSelect as c}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-WRFD4EXD.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-36LVP5WD.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as E}from"efficient-shell/icons/efficient";function W({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function T(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:W,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=h("fields",d).list,U=h("tree",l),_=r??Z.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>u?u(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(H(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,s())),W?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(T(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=f({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(A(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
+
return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!W&&C===n,o=!w&&!X&&J&&te(n),i=["es-list-row",W?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */S(k,{className:i,flat:!!W,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?b(V?V(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):b(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:W?/* @__PURE__ */S("div",{className:"es-list-row-main",children:W(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[m?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
+
/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
|
|
10
|
+
/* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:a(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
+
return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(W,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return S(u,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return S(u,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return S(J,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=h("panel",i),$=D(),P=p??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,E=R&&L.buckets.includes(R)?R:L.buckets[0],[W,A]=j(null),H=W&&W.panel===P&&L.rows.some(e=>e.name===W.name)?W:null,T=d&&L.buckets.length>1,z=T&&E?w(P,E):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>T&&e!==E,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":f??O.settings,idPrefix:P,value:E,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[b?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,b)}):b:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:X(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{W as FieldText,ee as Inspector,q as InspectorField,K as ListField,U as bucketsOf,z as copyItem,A as insertAt,X as labelOf,H as moveTo,Z as planFields,T as removeAt};
|
|
@@ -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,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-PQRYAW2G.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,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-RQBIFINA.js";import{ScreenStoreProvider as e}from"./chunk-KFPCMMRK.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 N({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
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
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
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var
|
|
7
|
-
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function M({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),M=t(()=>s(!g),[g]),Z=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:Z.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:M,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:Z.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:Z.waitingForAuthorization})}export{M as DocumentScreen,j as ScreenMount};
|
|
@@ -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,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-SMM3ST7A.js";import{Inspector as i}from"./chunk-N3LYD2LK.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},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},S={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
|
+
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 D=o({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(D.Provider,{value:n,children:e})}function P(){return u(D)}function G(){return(P().useOwnerName??v)()}function T(){return(P().useDocumentLabel??g)()}function x(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function A(n){return(P().useStandaloneBridges??h)(n)}function B(n,e){(P().useDocumentPass??y)(n,e)}function I(){return P().blockRules??b}function F(){return P().blockLook??L}function K(){return P().devices??O}function R(){return P().leftView??S}function M(){return P().pinned??j}function V(){return P().saveSwitch??!0}function W(e){n(!0===P().pickFollowsSelection,e)}function Y(){return P().storageNamespace||void 0}function E(){return P().styleClipboard??null}function H(){return P().nodeKeys??!0}function Q(){return P().notify??null}function Z(){return P().Canvas??w}function q(){return P().CanvasHead??null}function z(){return P().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 P().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,N 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,K as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,H as useScreenNodeKeys,Q as useScreenNotify,G as useScreenOwnerName,P as useScreenParts,W as useScreenPickFollowsSelection,M as useScreenPinned,V as useScreenSaveSwitch,Y as useScreenStorageNamespace,E as useScreenStyleClipboard,A as useStandaloneScreenBridges};
|