efficient-easel 18.2.0 → 19.1.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 +26 -1
- package/dist/{CanvasDragLayer-dZCPbQCP.d.ts → CanvasDragLayer-ARfaivCu.d.ts} +21 -3
- package/dist/{host-epHo7r8P.d.ts → ScreenDocumentContext-D55vIrG3.d.ts} +208 -208
- package/dist/autosave/index.d.ts +4 -4
- package/dist/{canvas-typing-BsNigaCa.d.ts → canvas-typing-Be4FO4q7.d.ts} +5 -5
- package/dist/chrome/chrome.css +2 -18
- package/dist/chrome/index.d.ts +5 -39
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-C2RHV42O.js → chunk-23DYNW6S.js} +1 -1
- package/dist/chunk-32JJK7PQ.js +8 -0
- package/dist/chunk-3WLT3GQS.js +1 -0
- package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
- package/dist/{chunk-HGV3FWOB.js → chunk-5DPIGWUL.js} +1 -1
- package/dist/chunk-5Z6KYASQ.js +1 -0
- package/dist/{chunk-N5AN2RF2.js → chunk-6B542CLG.js} +1 -1
- package/dist/chunk-AJSDWWJW.js +1 -0
- package/dist/chunk-C56MPJBH.js +1 -0
- package/dist/{chunk-S4AWJX4Q.js → chunk-EZG3TGQ7.js} +1 -1
- package/dist/chunk-FCRNT5PM.js +5 -0
- package/dist/{chunk-XHHVMAGM.js → chunk-FGYJ5DJY.js} +1 -1
- package/dist/chunk-GNMBJUG7.js +62 -0
- package/dist/{chunk-VEZPDGDQ.js → chunk-JBOSEHIX.js} +1 -1
- package/dist/chunk-KRL3IUV3.js +1 -0
- package/dist/{chunk-YLQYEDUQ.js → chunk-LBOJCTTC.js} +1 -1
- package/dist/chunk-LNHT2KPX.js +2 -0
- package/dist/chunk-M5Q4VYOH.js +14 -0
- package/dist/chunk-M62P4IQK.js +2 -0
- package/dist/chunk-MS2U6MV5.js +1 -0
- package/dist/chunk-MZ5PWTDV.js +7 -0
- package/dist/{chunk-7TOQCTHV.js → chunk-PY7OOQEZ.js} +3 -3
- package/dist/{chunk-KG7RJWOK.js → chunk-RYNBSKE7.js} +1 -1
- package/dist/chunk-SGFDUXUH.js +18 -0
- package/dist/{chunk-XDZHKYQX.js → chunk-SINAM2IT.js} +1 -1
- package/dist/chunk-Y6RJAOFH.js +1 -0
- package/dist/chunk-YZALWZT7.js +2 -0
- package/dist/chunk-ZG6PVMC3.js +19 -0
- package/dist/copy/index.d.ts +7 -7
- package/dist/copy/index.js +29 -29
- package/dist/drag/drag.css +23 -0
- package/dist/drag/index.d.ts +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +15 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +3 -3
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +65 -84
- package/dist/panel/index.js +14 -19
- package/dist/panel/panel.css +41 -137
- package/dist/{panelWidths-D9hTLR25.d.ts → panelWidths-DgQXiPXU.d.ts} +34 -6
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.d.ts +21 -0
- package/dist/screen/components/MediaPopup.js +1 -0
- package/dist/screen/components/NodeContextMenu.d.ts +4 -4
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +6 -6
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +8 -8
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +10 -8
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.d.ts +7 -6
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +7 -7
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +5 -5
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +74 -37
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +5 -5
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +7 -7
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/save-status.d.ts +2 -2
- package/dist/screen/lib/screen-parts.d.ts +52 -11
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +5 -4
- package/dist/screen/words.d.ts +3 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +6 -6
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +21 -21
- package/dist/{types-DT8ywrFQ.d.ts → types-B3iSHX-w.d.ts} +2 -22
- package/dist/{words-zH1H0WFw.d.ts → words-BeX5eGq7.d.ts} +2 -2
- package/dist/words-BpTjCfqO.d.ts +89 -0
- package/dist/{words-DkWcK1rh.d.ts → words-Cm8PMYn0.d.ts} +1 -1
- package/dist/{words-BpiVrsW5.d.ts → words-DYu4iBrR.d.ts} +1 -21
- package/package.json +8 -8
- package/dist/chunk-2ZWA6ARJ.js +0 -8
- package/dist/chunk-5EZ5Z3K7.js +0 -7
- package/dist/chunk-B4JN227A.js +0 -1
- package/dist/chunk-DXROGLB5.js +0 -2
- package/dist/chunk-GWIVPLOX.js +0 -23
- package/dist/chunk-LIRNQXAY.js +0 -1
- package/dist/chunk-LLDHIBYG.js +0 -18
- package/dist/chunk-OBIL7BZO.js +0 -4
- package/dist/chunk-QEAUF632.js +0 -14
- package/dist/chunk-R6WTQWAC.js +0 -2
- package/dist/chunk-SEVGZP36.js +0 -62
- package/dist/chunk-SNB4LQMK.js +0 -1
- package/dist/chunk-STWSCR25.js +0 -2
- package/dist/chunk-U277UX5I.js +0 -1
- package/dist/chunk-W6SDWCOL.js +0 -5
- package/dist/chunk-X52NFKUS.js +0 -1
- package/dist/chunk-Z6PVRXVY.js +0 -1
- package/dist/screen/components/MediaSidePanel.d.ts +0 -49
- package/dist/screen/components/MediaSidePanel.js +0 -1
- package/dist/words-D-yhjdOg.d.ts +0 -183
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{TEXT_STYLE_KINDS as
|
|
1
|
+
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{FieldSelect as l}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{useWords as i}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{TEXT_STYLE_KINDS as o,canAddTextStyle as d,TEXT_STYLE_MAX as c,isDefaultTextStyle as u,CAMPAIGN_TEXT_STYLE_SETTINGS as m,TEXT_STYLE_SETTINGS as h,textStyleRowSize as f,describeTextStyle as p,updateTextStyle as v,textStyleCaseCss as y,TEXT_STYLE_CASES as S,addTextStyle as g,removeTextStyle as b,TEXT_STYLE_RANGES as k}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as z,useId as E,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as W,CaseCapitalizedIcon as $,CaseUpperIcon as D,CaseNormalIcon as X}from"efficient-shell/icons/efficient";import{jsxs as Y,jsx as I,Fragment as F}from"react/jsx-runtime";var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function H({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=z(null),h=z(null),f=E(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */Y("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
2
|
/* @__PURE__ */Y("div",{className:"es-ts-top",children:[
|
|
3
3
|
/* @__PURE__ */I("span",{className:"es-ts-sub",children:l}),
|
|
4
4
|
/* @__PURE__ */I("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
|
|
5
5
|
/* @__PURE__ */Y("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */I(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */I(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
|
|
6
|
-
/* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */I(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:
|
|
7
|
-
return I("div",{className:"es-ts",ref:X,children:
|
|
8
|
-
return Y(R,{label:A.groups[a],children:[
|
|
9
|
-
return I(B,{style:a,fonts:t,colours:n,settings:
|
|
6
|
+
/* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */I(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:l=m,auto:h=[],fallback:f,sample:p,openId:v,defaultOpenId:y=null,onOpenChange:S,onAdd:k,rowActions:N,onRemove:C,max:x=c,device:T="desktop",readOnly:_=!1}){const A=i("textStyles",a),j=E(),[M,W]=w(y),$=void 0!==v?v:M,D=e=>{void 0===v&&W(e),S?.(e)},X=z(null),[G,H]=w(null);O(()=>{if(!G||!X.current)return;const e=[...X.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),s=e?e.querySelector(".es-ts-row"):X.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);s?.focus(),H(null)},[G]);/* @__PURE__ */
|
|
7
|
+
return I("div",{className:"es-ts",ref:X,children:o.map(a=>{const i=e.filter(e=>e.kind===a),o=!d(e,a,x),c=!_&&!o;/* @__PURE__ */
|
|
8
|
+
return Y(R,{label:A.groups[a],children:[i.map(a=>{const i=N?.(a),o=null!=i&&!1!==i,d=Boolean(C)&&!_&&!u(a);/* @__PURE__ */
|
|
9
|
+
return I(B,{style:a,fonts:t,colours:n,settings:l,auto:h,fallback:f,sample:p,device:T,readOnly:_,open:$===a.id,onOpenChange:e=>D(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:d||o?/* @__PURE__ */Y(F,{children:[d?r(A.remove,/* @__PURE__ */I("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=b(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];$===t.id&&D(null),s(a.styles),C(a.removed),H({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */I(L,{size:14,"aria-hidden":"true"})})):null,o?i:null]}):null},a.id)}),r(!_&&o?A.full({kind:a,max:x}):void 0,/* @__PURE__ */Y("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!o)||void 0,"aria-describedby":!_&&o?`${j}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(_)return;const a=g(e,t,{max:x,name:A.styleName,make:k});a&&s(a.styles)})(a)},children:[
|
|
10
10
|
/* @__PURE__ */I("span",{className:"es-ts-add-word",children:A.add[a]}),
|
|
11
|
-
/* @__PURE__ */I("span",{className:"es-ts-count",children:A.count({n:
|
|
11
|
+
/* @__PURE__ */I("span",{className:"es-ts-count",children:A.count({n:i.length,max:x})})]})),_||!o?null:/* @__PURE__ */I("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=E();/* @__PURE__ */
|
|
12
12
|
return Y("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
-
/* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:e,fonts:s,colours:t=[],settings:n=
|
|
13
|
+
/* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:e,fonts:s,colours:t=[],settings:n=m,auto:l=[],fallback:r,sample:o,open:d,onOpenChange:c,onChange:u,actions:y,device:S="desktop",readOnly:g=!1}){const b=i("textStyles",a),k=`${E()}-open-${e.id}`,N=new Set(l),C=h.filter(e=>n.includes(e)),x={...r?.(e)??{},...e.values},T="phone"===S,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,z=s.find(e=>e.value===x.font),O={fontFamily:z?.family,fontSize:`${f(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
14
|
return Y(_,{children:[
|
|
15
15
|
/* @__PURE__ */Y("div",{className:"es-ts-item","data-ts-id":e.id,children:[
|
|
16
|
-
/* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":
|
|
16
|
+
/* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>c(!d),children:[
|
|
17
17
|
/* @__PURE__ */I("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */I(A,{size:12})}),
|
|
18
18
|
/* @__PURE__ */I("span",{className:"es-ts-name",style:O,children:e.name}),
|
|
19
|
-
/* @__PURE__ */I("span",{className:"es-ts-meta",children:
|
|
20
|
-
return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:
|
|
19
|
+
/* @__PURE__ */I("span",{className:"es-ts-meta",children:p(w,s,b,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),y?/* @__PURE__ */I("div",{className:"es-ts-actions",children:y}):null]}),d?/* @__PURE__ */I("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */I(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:o??b.sample,words:b,phone:T,readOnly:g,set:s=>u(v([e],e.id,s)[0])})}):null]})}var U={none:X,upper:D,capitalize:$,lower:W};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const f=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),S=e=>"largestSize"===e||o.has(e),g=e=>S(e)?f[e]:s[e],b=g("size"),N=u&&void 0!==f.sizePhone?f.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=S("letterCase")?f.letterCase:s.letterCase,z={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:y(w)},E=e=>{const t=k[e],a=S(e);/* @__PURE__ */
|
|
20
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:c.settings[e],value:f[e],onChange:s=>h({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
|
|
21
21
|
return Y(F,{children:[
|
|
22
|
-
/* @__PURE__ */I("div",{className:"es-ts-preview",style:z,"aria-label":
|
|
23
|
-
return I(q,{value:
|
|
24
|
-
return I(K,{value:
|
|
22
|
+
/* @__PURE__ */I("div",{className:"es-ts-preview",style:z,"aria-label":c.preview,children:d}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
23
|
+
return I(q,{value:f.font,fonts:a,words:c,readOnly:m,set:h},t);case"color":/* @__PURE__ */
|
|
24
|
+
return I(K,{value:f.color,hex:v,colours:l,words:c,readOnly:m,set:h},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
|
|
25
25
|
return Y("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
26
|
-
/* @__PURE__ */I("span",{className:"es-ts-sub",children:
|
|
27
|
-
/* @__PURE__ */Y("div",{className:"es-ts-icons",children:[
|
|
28
|
-
return I(V,{value:
|
|
29
|
-
return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:
|
|
26
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",children:c.settings.emphasis}),
|
|
27
|
+
/* @__PURE__ */Y("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */I(j,{size:16})})),m||a?r(c.italic,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),disabled:m,onClick:()=>h({italic:!s.italic||void 0}),children:/* @__PURE__ */I(M,{size:16})})):/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */I(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return I(V,{value:f.letterCase??s.letterCase,auto:S("letterCase"),words:c,readOnly:m,set:h},t);case"largestSize":return"heading"===e.kind?E(t):null;case"size":return u?(()=>{const e=k.size;/* @__PURE__ */
|
|
29
|
+
return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:c.settings.size,value:f.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:m})},"size")})():E(t);default:return E(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const i=E();/* @__PURE__ */
|
|
30
30
|
return Y("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
|
-
/* @__PURE__ */I("span",{className:"es-ts-sub",id:
|
|
32
|
-
/* @__PURE__ */I(
|
|
33
|
-
return I(H,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...
|
|
31
|
+
/* @__PURE__ */I("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
|
|
32
|
+
/* @__PURE__ */I(l,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:i,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
|
33
|
+
return I(H,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...S]:S,i=e??(s?"auto":"none"),o=z([]),d=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
34
34
|
return Y("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
35
35
|
/* @__PURE__ */I("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
36
|
-
/* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;
|
|
36
|
+
/* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;d(l[t]),o.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */I(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:t.case.auto},e));const l=U[e];return r(t.case[e],/* @__PURE__ */I(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:/* @__PURE__ */I(l,{size:16})},e))})})]})}export{H as ColourSwatchRow,B as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as EaselRailItem } from './types-Cy7rdmXt.js';
|
|
2
2
|
import { ReactNode, Ref, CSSProperties } from 'react';
|
|
3
3
|
import { EditAccess, SaveConflict } from './edit-lock/index.js';
|
|
4
|
-
import { P as PanelSide } from './panelWidths-
|
|
4
|
+
import { P as PanelSide } from './panelWidths-DgQXiPXU.js';
|
|
5
5
|
|
|
6
6
|
type TopBarProps = {
|
|
7
7
|
children?: ReactNode;
|
|
@@ -110,26 +110,6 @@ type InspectorHeadProps = {
|
|
|
110
110
|
/** `InspectorIconButton`s, right-aligned. Omit when the thing has no actions. */
|
|
111
111
|
actions?: ReactNode;
|
|
112
112
|
};
|
|
113
|
-
/** What a field can hold, as `MediaPanelHead` says it (`ChromeWords.mediaKinds`). */
|
|
114
|
-
type MediaPickKind = 'image' | 'video' | 'svg';
|
|
115
|
-
type MediaPanelHeadProps = {
|
|
116
|
-
/** The line under "Media library": which website or campaign the panel is
|
|
117
|
-
* open in. Also the line under "Choose …" when the field has no name. */
|
|
118
|
-
context: ReactNode;
|
|
119
|
-
/** The field choosing right now, or null while browsing. `field` is the
|
|
120
|
-
* host's label for it ("Background image"). */
|
|
121
|
-
pick: {
|
|
122
|
-
kind: MediaPickKind;
|
|
123
|
-
field?: string;
|
|
124
|
-
} | null;
|
|
125
|
-
/** Leave choosing: the field keeps what it had. */
|
|
126
|
-
onCancel: () => void;
|
|
127
|
-
/** Hide the panel. Omitted where the panel cannot be hidden, and then no
|
|
128
|
-
* Hide button is drawn. */
|
|
129
|
-
onHide?: () => void;
|
|
130
|
-
/** Which side panel the head is on; picks the Hide glyph and its name. */
|
|
131
|
-
side?: 'left' | 'right';
|
|
132
|
-
};
|
|
133
113
|
type InspectorUpLevelProps = {
|
|
134
114
|
/** What the level above is called — the section, the column, the group. The link's words. */
|
|
135
115
|
name: string;
|
|
@@ -220,4 +200,4 @@ type SaveIconProps = {
|
|
|
220
200
|
label: string;
|
|
221
201
|
};
|
|
222
202
|
|
|
223
|
-
export type { DeviceOption as D, EaselIconButtonProps as E, InspectorHeadProps as I,
|
|
203
|
+
export type { DeviceOption as D, EaselIconButtonProps as E, InspectorHeadProps as I, PanelResizeHandleProps as P, RailWordsShown as R, SaveTone as S, TopBarProps as T, SaveIconState as a, TopBarClusterProps as b, TopBarRailProps as c, DeviceSwitchProps as d, SaveStateProps as e, SaveStateToggleProps as f, SaveIconProps as g, SaveIconTone as h, InspectorIconButtonProps as i, InspectorUpLevelProps as j, EditNoticeProps as k };
|
|
@@ -10,8 +10,8 @@ import { S as SettingsBucket, D as DesignGroup } from './buckets-Tj-nkBpg.js';
|
|
|
10
10
|
* group's key (`DESIGN_GROUPS`) is the same: `designGroups` is its word.
|
|
11
11
|
*
|
|
12
12
|
* The panel is hook-free, so nothing here is read from the strings provider:
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
13
|
+
* `Inspector` (which has hooks) reads them and hands the shell's `Tabs` the
|
|
14
|
+
* strip's name and each tab's word.
|
|
15
15
|
* `SettingsDefaultReset` takes `words`, and a host passes the four from
|
|
16
16
|
* `useWords('panel', …)`.
|
|
17
17
|
*/
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { MarkStyle, MarkPlaceholders } from 'efficient-shell/markup';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The copy box's own words (`efficient-easel/strings`, 0.95.0): the bar's and
|
|
5
|
+
* the alignment strip's name, each mark button's name
|
|
6
|
+
* and tooltip, and the words a mark writes when nothing is selected. The link
|
|
7
|
+
* window is efficient-shell's `LinkPicker`: its words are the shell
|
|
8
|
+
* catalogue's (`ShellStringsProvider`, `link`).
|
|
9
|
+
*
|
|
10
|
+
* NO REACT here, and no import but the grammar: the marks' names, tooltips and
|
|
11
|
+
* placeholders are READ from `efficient-shell/markup` (`MARKUP_TOOLS`,
|
|
12
|
+
* `MARK_PLACEHOLDERS`) rather than typed a second time, so the English lives
|
|
13
|
+
* once, in the grammar, where the campaign designer's own toolbar reads it too.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
type CopyWords = {
|
|
17
|
+
/** The formatting bar's accessible name. */
|
|
18
|
+
formatting: string;
|
|
19
|
+
/** The alignment strip's accessible name. */
|
|
20
|
+
alignment: string;
|
|
21
|
+
/**
|
|
22
|
+
* Each mark button, for a bar handed STYLES (`tools={['bold', 'link']}`).
|
|
23
|
+
* `name` is what the button is called; `title` its tooltip, which also says
|
|
24
|
+
* what the mark writes and its shortcut. A host's own descriptors
|
|
25
|
+
* (`MarkupTool[]`) are used as given and never read these.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Read by nothing since the copy box's one bar became the shell's
|
|
28
|
+
* `TextToolbar`, which names its buttons in the shell catalogue
|
|
29
|
+
* (`ShellStringsProvider`, `textToolbar`). Removed in 12.0.0.
|
|
30
|
+
*/
|
|
31
|
+
marks: Record<MarkStyle, {
|
|
32
|
+
name: string;
|
|
33
|
+
title: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** What a mark writes when nothing is selected — typed over at once. */
|
|
36
|
+
placeholders: MarkPlaceholders;
|
|
37
|
+
/** The switch under a many-line box that shows the raw text with its marks
|
|
38
|
+
* (E5a). Optional, so a host's words from before still type; English when
|
|
39
|
+
* left out. */
|
|
40
|
+
showMarks?: string;
|
|
41
|
+
/** The colour window: its name, the theme row's label, and Remove. */
|
|
42
|
+
colors?: {
|
|
43
|
+
title: string;
|
|
44
|
+
theme: string;
|
|
45
|
+
remove: string;
|
|
46
|
+
/** "Any color": the square, the hue bar and the hex box under the theme. */
|
|
47
|
+
any: string;
|
|
48
|
+
square: string;
|
|
49
|
+
hue: string;
|
|
50
|
+
hex: string;
|
|
51
|
+
};
|
|
52
|
+
/** The one text panel's rows (`TextPartPanel`, text panel v3) and their
|
|
53
|
+
* answers. Optional, so a host's words from before still type; English when left
|
|
54
|
+
* out. */
|
|
55
|
+
panel?: {
|
|
56
|
+
style: string;
|
|
57
|
+
editStyles: string;
|
|
58
|
+
updateStyle: string;
|
|
59
|
+
font: string;
|
|
60
|
+
italic: string;
|
|
61
|
+
list: string;
|
|
62
|
+
lists: {
|
|
63
|
+
none: string;
|
|
64
|
+
bullet: string;
|
|
65
|
+
number: string;
|
|
66
|
+
};
|
|
67
|
+
capitalization: string;
|
|
68
|
+
cases: {
|
|
69
|
+
none: string;
|
|
70
|
+
upper: string;
|
|
71
|
+
capitalize: string;
|
|
72
|
+
lower: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/** The number cells' names, and the tooltip each one carries. */
|
|
76
|
+
cells?: {
|
|
77
|
+
fontSize: string;
|
|
78
|
+
lineHeight: string;
|
|
79
|
+
letterSpacing: string;
|
|
80
|
+
paragraphSpacing: string;
|
|
81
|
+
tip: (v: {
|
|
82
|
+
name: string;
|
|
83
|
+
step: number;
|
|
84
|
+
unit: string;
|
|
85
|
+
}) => string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type { CopyWords as C };
|
|
@@ -82,28 +82,8 @@ type ChromeWords = {
|
|
|
82
82
|
partOf: (v: {
|
|
83
83
|
name: string;
|
|
84
84
|
}) => string;
|
|
85
|
-
/**
|
|
85
|
+
/** The media library's name, as the host's window is asked for it. */
|
|
86
86
|
mediaLibrary: string;
|
|
87
|
-
/** `MediaPanelHead`, choosing: the panel's name. `kind` is a `mediaKinds` word. */
|
|
88
|
-
mediaChoose: (v: {
|
|
89
|
-
kind: string;
|
|
90
|
-
}) => string;
|
|
91
|
-
/** `MediaPanelHead`, choosing: the line under the name. `field` is the host's label for the field. */
|
|
92
|
-
mediaFor: (v: {
|
|
93
|
-
field: string;
|
|
94
|
-
}) => string;
|
|
95
|
-
/** What a field can hold, as the head says it, by `MediaPickKind`. */
|
|
96
|
-
mediaKinds: {
|
|
97
|
-
image: string;
|
|
98
|
-
video: string;
|
|
99
|
-
svg: string;
|
|
100
|
-
};
|
|
101
|
-
/** `MediaPanelHead`: the word that leaves choosing. */
|
|
102
|
-
mediaCancel: string;
|
|
103
|
-
/** `MediaPanelHead`: Cancel's tooltip. `kind` is a `mediaKinds` word. */
|
|
104
|
-
mediaKeep: (v: {
|
|
105
|
-
kind: string;
|
|
106
|
-
}) => string;
|
|
107
87
|
/** The Hide panel button at the end of a side panel's head: the tooltip. */
|
|
108
88
|
hidePanel: string;
|
|
109
89
|
/** The same button: its accessible name. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"./screen/components/AddBlockRow",
|
|
58
58
|
"./screen/components/AddChildRow",
|
|
59
59
|
"./screen/components/AddSidePanel",
|
|
60
|
-
"./screen/components/
|
|
60
|
+
"./screen/components/MediaPopup",
|
|
61
61
|
"./screen/components/NodeContextMenu",
|
|
62
62
|
"./screen/components/PageEditGuardNotices",
|
|
63
63
|
"./screen/components/PanelToggleIcon",
|
|
@@ -272,10 +272,10 @@
|
|
|
272
272
|
"import": "./dist/screen/components/AddSidePanel.js",
|
|
273
273
|
"default": "./dist/screen/components/AddSidePanel.js"
|
|
274
274
|
},
|
|
275
|
-
"./screen/components/
|
|
276
|
-
"types": "./dist/screen/components/
|
|
277
|
-
"import": "./dist/screen/components/
|
|
278
|
-
"default": "./dist/screen/components/
|
|
275
|
+
"./screen/components/MediaPopup": {
|
|
276
|
+
"types": "./dist/screen/components/MediaPopup.d.ts",
|
|
277
|
+
"import": "./dist/screen/components/MediaPopup.js",
|
|
278
|
+
"default": "./dist/screen/components/MediaPopup.js"
|
|
279
279
|
},
|
|
280
280
|
"./screen/components/NodeContextMenu": {
|
|
281
281
|
"types": "./dist/screen/components/NodeContextMenu.d.ts",
|
|
@@ -627,7 +627,7 @@
|
|
|
627
627
|
"dist"
|
|
628
628
|
],
|
|
629
629
|
"peerDependencies": {
|
|
630
|
-
"efficient-shell": "^8.
|
|
630
|
+
"efficient-shell": "^8.39.0",
|
|
631
631
|
"react": ">=18",
|
|
632
632
|
"react-dom": ">=18"
|
|
633
633
|
},
|
|
@@ -637,7 +637,7 @@
|
|
|
637
637
|
"@types/node": "^22.0.0",
|
|
638
638
|
"@types/react": "^18.2.0",
|
|
639
639
|
"@types/react-dom": "^18.2.0",
|
|
640
|
-
"efficient-shell": "^8.
|
|
640
|
+
"efficient-shell": "^8.39.0",
|
|
641
641
|
"esbuild": "^0.27.0",
|
|
642
642
|
"jsdom": "^26.1.0",
|
|
643
643
|
"react": "^18.2.0",
|
package/dist/chunk-2ZWA6ARJ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-XDZHKYQX.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-W6SDWCOL.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-C2RHV42O.js";import{useEasel as u}from"./chunk-QEAUF632.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LLDHIBYG.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as L}from"efficient-shell/icons/efficient";import{ContextMenu as A,toast as D,Dialog as H,Button as O}from"efficient-shell/ui";import{jsx as $,jsxs as x,Fragment as B}from"react/jsx-runtime";function E({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
-
return $(H,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(B,{children:[
|
|
3
|
-
/* @__PURE__ */$(O,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
-
/* @__PURE__ */$(O,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var F=e=>`section:${e}`,T=e=>`block:${e}`,I=e=>`template:${e}`,M=e=>`shared:${e}`;function N({at:C,placeBlocks:H,canTake:O,onPick:N,itemFor:Q,session:S,siteWide:W,onClose:z,onHide:K,readOnly:P}){const R=u(e=>e.config),V=a(),{labelAtLevel:Y,categoryLabel:Z,firstSection:G,Icon:U,Thumbnail:X}=V,{blockIsOffered:_,canAddTo:J}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>_(e,te);return l(te).list().then(n=>{if(e)return;const l=R.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>_(e,te);return r(te).list().then(n=>{if(e)return;const l=R.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(R,V),[R]),ye=e=>Y(e,"section",R.components[e]?.label??e),he=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */$(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */$("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */$(U,{type:e,size:26})}),be=j(()=>{const e=t(ue,G),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!_(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=J(t.type)?.choices??[];e.forEach(l),e.forEach(e=>J(e.type,1)?.choices?.forEach(l))}H?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:T(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:M(e.id),label:e.title,cover:/* @__PURE__ */$(X,{type:e.node.type}),mark:/* @__PURE__ */$(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:I(e.id),label:e.name,cover:/* @__PURE__ */$(X,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(R,t,Z),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!O)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?O(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,R,q,O,H,te]);/* @__PURE__ */
|
|
5
|
-
return x(B,{children:[
|
|
6
|
-
/* @__PURE__ */$(i,{icon:/* @__PURE__ */$(L,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */$(s,{label:q.done,description:q.doneDescription,onClick:z}),onHide:K}),
|
|
7
|
-
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */$(k,{groups:be,session:S,itemFor:e=>Q(ke(e)??{kind:"section",type:e}),onInsert:N?e=>{const t=ke(e);t&&N(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!P&&(pe({section:n.section,...t}),!0)},at:C,hint:q.hint,searchLabel:q.search,readOnly:P,words:ee}),W??null]}),de?/* @__PURE__ */$(A,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */$(E,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void D.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{N as AddSidePanel,T as blockKey,F as sectionKey,M as sharedKey,I as templateKey};
|
package/dist/chunk-5EZ5Z3K7.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-SEVGZP36.js";import{ScreenStoreProvider as e}from"./chunk-DXROGLB5.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-STWSCR25.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-C2RHV42O.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(e),k=r(n);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
|
-
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
|
-
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
|
-
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
-
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function H({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),H=t(()=>s(!g),[g]),O=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:O.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:H,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:O.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:O.waitingForAuthorization})}export{H as DocumentScreen,y as ScreenMount};
|
package/dist/chunk-B4JN227A.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
|
package/dist/chunk-DXROGLB5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-W6SDWCOL.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-QEAUF632.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
|
-
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
package/dist/chunk-GWIVPLOX.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as p,Switch as v,SpinnerRing as f,ResizeHandle as k,Button as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as C,CloudAlertIcon as x,CloudArrowUpIcon as z,CloudCheckIcon as B,PanelLeftIcon as R,PanelRightIcon as L,MediaIcon as $,ImageIcon as S}from"efficient-shell/icons/efficient";function W({children:e}){/* @__PURE__ */
|
|
2
|
-
return c("div",{className:"es-topbar",children:e})}function j({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
|
-
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function M(){/* @__PURE__ */
|
|
4
|
-
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
|
|
5
|
-
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function Y({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
|
|
6
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
|
|
7
|
-
return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var F={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function H({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
|
|
8
|
-
return d("span",{className:`es-savestate ${F[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function V({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
|
-
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(v,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var I={saved:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(f,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},Z=e=>I[e].tone;function q({state:e,label:n}){const i=I[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
|
|
10
|
-
/* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
|
|
11
|
-
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
|
|
12
|
-
return c(k,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
13
|
-
return d("div",{className:"es-insp-head",children:[
|
|
14
|
-
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
15
|
-
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
16
|
-
/* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
17
|
-
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function J({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
18
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:n,label:a,inline:t}){const s=o("chrome",i),l=a??s.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(b,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function E({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}function G({context:e,pick:n,onCancel:a,onHide:t,side:s="left"}){const l=o("chrome",i),r=t?/* @__PURE__ */c(J,{label:l.hidePanelLabel({side:s}),title:l.hidePanel,onClick:t,children:/* @__PURE__ */c("left"===s?R:L,{size:16})}):null;if(!n)/* @__PURE__ */
|
|
19
|
-
return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[n.kind];/* @__PURE__ */
|
|
20
|
-
return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:n.field?l.mediaFor({field:n.field}):e,actions:/* @__PURE__ */d(u,{children:[
|
|
21
|
-
/* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
|
|
22
|
-
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:n,lock:r};function U(e,n,i,a=Q){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),u=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function _({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=U(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
23
|
-
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var ee={left:288,right:320},ne=220,ie=560;function ae(e){return Math.min(560,Math.max(220,Math.round(e)))}function te(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function se(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{ee as DEFAULT_PANEL_W,T as DeviceSwitch,Y as EaselIconButton,W as EaselTopBar,_ as EditNotice,D as InspectorHead,J as InspectorIconButton,K as InspectorUpLevel,ie as MAX_PANEL_W,ne as MIN_PANEL_W,G as MediaPanelHead,A as PanelResizeHandle,q as SaveIcon,H as SaveState,V as SaveStateToggle,j as TopBarCluster,M as TopBarDivider,P as TopBarRail,ae as clampPanelWidth,U as editNotice,E as headWords,X as mediaPickKind,te as panelWidthVars,Z as saveIconTone,se as setPanelWidthVars};
|
package/dist/chunk-LIRNQXAY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-C2RHV42O.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-PLVEGYK6.js";import{createNodeClipboard as r,nodeMenuItems as i}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as c}from"./chunk-WK3AFPXY.js";import{easelMenuEntries as s,menuLabel as a}from"./chunk-BALFHI3G.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-X4T6JT3M.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as O,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=r(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",r);let t=j.get(n);return t||(t=r(),j.set(n,t)),t}function S(){return M(e())}function T(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function L(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function R(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function E(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:L(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(e,n){const{zone:t,index:r}=n,c=e.nodeAt(t,r);if(!c)return[];const s=c.props.id,a=e.labelOf(c.type,t),u=Boolean(c.props._hidden),d=e.nodeOps,p=e.isPinned(c,t),f=e.isLocked(c),m=!p&&!f&&!e.duplicateBlocked(c),h=e.permits?.(c)??{duplicate:!0,delete:!0},y=X(e,c,t),k=D(e,n),b=d.held,v=b&&!p?L(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(c,t),onCopy:()=>e.style?.copy(c,t),onPaste:()=>e.style?.paste(t,r,c),words:e.words?.styleClipboard}):[];return i({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(c,t)?()=>e.beginRename(t,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:w,extras:e.menuRows?.(c,t,r)??void 0,pinnedLine:p?V(e).pinned:void 0})}var V=e=>e.words?.screen??t.menu;function B(e){const n=V(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],s=e.nodeOps.held,a=T(e,l,e.sectionBand().cap);if(o&&s&&(e.canPasteAt?e.canPasteAt(s,a):f(s.from)===l)){const n=a,t=e.words?.menu??c;i.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(O,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??c,s=V(e),a=[];l&&(a.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),a.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:s.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function F(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=R(e);if(!o)return;const l=t.selected();if(!l)return;const r=E(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(Y(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(N,{host:e,target:o,onClose:r}):null,closeMenu:r}}function N({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?U(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":a(o),items:s(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,X as nodeClipboardRules,I as nodeMenuItems,R as nodeShortcut,B as pageMenuItems,L as pastePlace,E as runNodeShortcut,U as textMenuItems,S as useNodeClipboard,F as useNodeContextMenu};
|
package/dist/chunk-LLDHIBYG.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as i}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as s,useCanvasTyping as o,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as u,elementScale as h,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as x,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as z,solidSurfaceStyle as D,Input as T}from"efficient-shell/ui";import{AddIcon as M,CloseIcon as $,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 i=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return S("div",{className:i,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(M,{})})})})]})}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 X(e,t,n){return B(e,t,n).at(-1)??null}function q(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,i=a??l??e.box;return{left:r-1,top:i.top,width:2,height:i.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 i=e.filter(e=>L(e.box,t,n)).sort((e,t)=>K(e.box)-K(t.box));for(const e of i){const i=q(e,t,n),s={...e.list,index:i};if(a(s))return null;if(l(s))return{zone:e,to:s,line:I(e,i)};if(!r(s))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,i=r?a.left:a.top,s=i+(r?a.width:a.height),o=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(o(f)-p,0);else{const e=h?(c(h)+s)/2:(i+o(f))/2;p=Math.min(Math.max(e,i+n),s-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}:+${u}`,place:{...e.list,index:u},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],i=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:i,width:e.box.width,height:Math.max(r.top-i,0)}})}return n}var R={nodes:[],zones:[]},Y="data-puck-dropzone",Z="data-puck-component";function F(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Q(e,t){const{frame:n,document:l}=e,a=e=>f(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],i=[];for(const e of l.querySelectorAll(`[${Y}]`)){const t=e.getAttribute(Y)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${Y}]`)===e),s=l.map(a);i.push({key:t,list:n,box:a(e),axis:F(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:i}}var V="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(i){const{canvas:f,session:m,readOnly:k,words:z=e.canvas}=i,T=g(i);x(()=>{T.current=i});const M=g(null),$=s(f),[C,L]=b(0),K=y(()=>L(e=>e+1),[]),[X,q]=b(R);x(()=>{const e=M.current;f&&e&&q((T.current.measure??Q)(f,e))},[f,$,i.revision,C]);const I=i.model,P=v(()=>I(X),[I,X]),H=w(m.subscribe,m.shown,m.shown),Y=i.choose,Z=(e,t)=>{const n=B(P.sources,e,t);return 0===n.length?null:Y?Y(n):n[n.length-1]},[F,J]=b(null),[U,_]=b(null),ee=g(null),te=()=>{ee.current&&clearTimeout(ee.current),ee.current=null},ne=()=>{te(),ee.current=setTimeout(()=>{m.get()||J(null)},140)};x(()=>te,[]);const le=g(null),ae=o(f),re=g(!1);re.current=ae,x(()=>{ae&&(te(),J(null))},[ae]);const[ie,se]=b(null);c(f,d,e=>se(e.detail?.id??null));const oe=!ie||ae||k||H?null:X.nodes.find(e=>e.id===ie)?.box??null;c(f,"mousemove",e=>{const t=M.current;if(!f||!t)return;const n=u(f.frame,e.clientX,e.clientY,t),l=h(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=Z(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)},[]);x(()=>m.subscribe(()=>{m.get()?K():de()}),[m,de,K]),x(()=>de,[de]),("undefined"==typeof document?x:N)(()=>{if(m.get())return;const e=le.current;J(t=>k||re.current?null:e?Z(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,H,m,k,Y]);const ue=e=>{const t=m.get(),n=M.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},he={onDragEnter:e=>{if(ce.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,i=[];t&&i.push(a(t)),r&&f&&i.push(a(r,f.frame)),ce.current=i.length?()=>i.forEach(e=>e()):null},onDragOver:e=>{const n=ue(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=ue(e);t&&(e.preventDefault(),m.end(),de(),T.current.onDrop(t.h.item,t.t.to))}},fe={draggable:!k&&!!F,onMouseEnter:te,onMouseLeave:()=>!m.get()&&ne(),onDragStart:e=>{if(F&&!k){m.start({key:F.key,item:F.item,from:F.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",F.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),de()},onClick:()=>{F&&!k&&T.current.onPick?.(F.item)}},{seams:pe=[]}=P,me=P.zones.filter(e=>0===e.children.length),ge=!i.onZoneAdd||k||ae?[]:me,xe=ge.map(e=>e.key).join("\n");return x(()=>{const e=f?.document;if(!e)return;const t=new Set(xe?xe.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(V,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${V}]`))t.removeAttribute(V)}},[f,xe,X,$,C]),/* @__PURE__ */S("div",{ref:M,className:"es-canvas-layer",children:[H||!i.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??i.seamLabel??z.addSection,onInsert:()=>i.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:()=>i.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */E("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??i.zoneAddLabel??z.addBlock})})},e.key)):null,H?/* @__PURE__ */E("div",{className:"es-canvas-catch",...he}):null,U&&!me.some(e=>e.key===U.zoneKey)?/* @__PURE__ */E("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,oe?/* @__PURE__ */E("span",{className:"es-canvas-hint"+(oe.width<200?" is-below":""),style:{...D(),left:oe.left+oe.width,top:oe.width<200?oe.top+oe.height:oe.top},children:z.typeHint}):null,
|
|
6
|
-
/* @__PURE__ */E("div",{className:"es-canvas-handle-spot",style:F?{"--es-handle-x":`${F.box.left+2}px`,"--es-handle-y":`${Math.max(F.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */E(A,{className:"es-canvas-handle-tip",side:"top",content:!F||k||H?null:F.title??z.handle({label:F.label}),children:/* @__PURE__ */S("div",{className:["es-canvas-handle",F&&!k?"is-shown":"",H?"is-dragging":""].filter(Boolean).join(" "),...fe,children:[
|
|
7
|
-
/* @__PURE__ */E("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),F?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:s,hint:o,searchLabel:c,readOnly:d,words:u=e.add}){const h=o??u.hint,f=c??u.search,[p,m]=b(""),g=k(),x=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return S("div",{className:"es-add",children:[s?/* @__PURE__ */S("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */E("span",{children:s.label}),i(u.stop,/* @__PURE__ */E("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:s.onClear,children:/* @__PURE__ */E($,{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:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */E(C,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */E(z,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */E($,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */S("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */E("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
-
/* @__PURE__ */E("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):v.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(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return i(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":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */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__ */S("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */E("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,R as EMPTY_MEASURE,J as HANDLE_GRACE_MS,O as canvasTarget,L as contains,q as gapInZone,I as gapLine,P as insertSeams,Q as measureCanvas,X as pickSource,H as seamsBetween,B as sourcesAt};
|
package/dist/chunk-OBIL7BZO.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-W6SDWCOL.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-GWIVPLOX.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
|
-
return o(r,{children:[
|
|
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
|
-
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
package/dist/chunk-QEAUF632.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-X3TYRF5V.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-B4JN227A.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,isTypingTarget as w,frameRectToHost as b,CANVAS_TYPING_EVENT as k,drawnBox as S}from"./chunk-X4T6JT3M.js";import{find as C,ROOT_ID as I,getList as E,remove as D,parseZoneKey as x,move as A,duplicate as M,replaceNode as O,createNode as R,insert as z,normalizeData as V,createResolveCache as P,resolveNodeData as B,ROOT_SLOT as N}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as $,fieldsFrom as L,defaultsFrom as K}from"./chunk-NKB3KVAB.js";import{createContext as j,useEffect as Z,useContext as T,useRef as F,useSyncExternalStore as H,useState as W,useMemo as Y,useCallback as q,useLayoutEffect as X}from"react";import{jsx as U,jsxs as J,Fragment as G}from"react/jsx-runtime";import{createPortal as Q}from"react-dom";import{registerModalEscapeInterceptor as _,FloatingBar as ee,TextToolbar as te,LinkPicker as ne}from"efficient-shell/ui";function oe(e){return!["setData","setUi","set"].includes(e.type)}var re=(e,t,n,o)=>{const r=E(e,t,x(n));return r?.[o]??null},ie=(e,t,n,o,r)=>{const i=re(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function le(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function se(e,t,n){return n?"node"===n.kind?C(e,t,n.id)?n:null:n.parentId===I?E(e,t,n)?n:null:C(e,t,n.parentId)&&E(e,t,n)?n:null:null}function ae(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ce(e,t,n){const o=de(e,t,n);if(o===e)return e;const r=se(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function de(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return ae(e,n,"function"==typeof t.ui?t.ui(le(e,n)):t.ui);case"set":{const r={data:o,ui:le(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=ae(l,n,i.ui,!0)),l}case"insert":{const r={...x(t.destinationZone),index:t.destinationIndex},i=R(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:z(o,n,r,i)}}case"replace":{const r=ie(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:O(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=ie(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=M(o,n,r.props.id),l=re(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return de(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=re(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...x(t.destinationZone),index:t.destinationIndex};return{...e,data:A(o,n,r.props.id,i)}}case"remove":{const r=ie(o,n,t.zone,t.index,"remove");return{...e,data:D(o,n,r.props.id)}}default:return e}}var ue={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},pe={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},fe=0,he=()=>`history-${fe+=1}`;function me(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=V(e.data,t);let a={data:s,selection:null,ui:{...pe}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...pe,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:he()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},k=e=>{const n=a;if(a=ce(a,e,t),a===n)return;const o=e.recordHistory??oe(e);b(n,o&&a.data!==n.data)},S=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},I=e=>{const n=a,o=se(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},D=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},x=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ue,...l,...n}};let A=x();const M=P(),R={resolveCache:M,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([B(r,t,{cache:M,trigger:e,metadata:n}),...i.map(o=>B(o,t,{cache:M,trigger:e,metadata:n}))]);S(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=C(n,t,l)?.node;s&&s===C(o,t,l)?.node&&(n=O(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:se(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=C(a.data,t,e)?.node;if(!r)return!1;const i=await B(r,t,{cache:M,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return S(()=>{const n=a;if(C(a.data,t,e)?.node!==r)return;const o=O(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:se(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:le(e,t)},r="node"===e.selection?.kind?C(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:k,history:{back:()=>R.undo(),forward:()=>R.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:le(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&D(e)}},getPermissions:A,getItemById:n=>C(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return E(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:k,batch:S,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>I(e?{kind:"node",id:e}:null),selectSlot:e=>I(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){S(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:se(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=V(e,t);a={...a,data:r,selection:se(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0),a!==o&&y()},undo(){d>0&&D(d-1)},redo(){d<c.length-1&&D(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,A=x(),f=null,y())},setConfig(e){e!==t&&(t=e,A=x(),f=null,y())}};return R}function ge(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&w(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ve=j(null),ye=j(!0);function we({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return Z(()=>{n&&e.resolveAll()},[e,n]),Z(()=>{if(t&&"undefined"!=typeof document)return ge(document,e)},[e,t]),/* @__PURE__ */U(ve.Provider,{value:e,children:/* @__PURE__ */U(ye.Provider,{value:t,children:o})})}function be(){const e=T(ve);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ke(e){const t=be(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return H(t.subscribe,o,o)}function Se(){return function(e){return ke(e)}}var Ce="data-puck-component",Ie="data-puck-dropzone",Ee={},De="data-es-mirror",xe="undefined"==typeof window?Z:X;function Ae(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${De}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(De,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Me({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=F(null),[p,f]=W(null);return xe(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),xe(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),v(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Ae(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Ae(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */U("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?Q(t,p):null})}var Oe=j(null),Re=j(Ee),ze=[];function Ve({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=be(),s=ke(n=>E(n.appState.data,l.config,{parentId:e,slot:t})??ze),a=ke(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==I),c=ke(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=T(Oe),u=["es-zone"];return s.length&&u.push("has-children"),e===I&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==I&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */U("div",{className:u.join(" "),[Ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */U(Ze,{node:e},e.props.id))})}function Pe(e,t){return Y(()=>{const n={};for(const o of $(L(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
-
return U(Ve,{parentId:t,slot:o,...e})};return n},[e,t])}function Be(e){return Y(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return U(Ve,{parentId:e,slot:t,...n})},[e])}var Ne=["top","bottom","zIndex"];function $e(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Le(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));$e(e,"position",t?"sticky":"relative");for(const n of Ne)$e(e,n,t?.[n]??"");return!!t}var Ke="data-es-canvas-relative";function je(e){e.hasAttribute(Ke)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ke));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ke,"")),!1)}function Ze({node:e}){const t=be().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return Y(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ce),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Ce,e),n.setAttribute("data-puck-dnd",e),je(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});xe(()=>o.current()),xe(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?je(e):Le(e));const s=T(Re),a=Pe(t,n),c=Be(n);if(!t?.render)return null;const d=t.render,u={...K(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */U(d,{...u,puck:p,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */U("div",{ref:i,[Ce]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */U(d,{...u,puck:p,editMode:!0})})}function Te({metadata:e}){const t=ke(e=>e.config),n=ke(e=>e.appState.data.root).props??{},o=t.root?.render,r=Pe(t.root,I),i=Be(I),l=/* @__PURE__ */U(Ve,{parentId:I,slot:N}),s=o?/* @__PURE__ */U(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
-
return U(Re.Provider,{value:e??Ee,children:s})}var Fe=j(void 0),He=j(void 0),We=j(void 0);function Ye({element:e}){const t=F(null),n=qe(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
-
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe(e,t,n){const[o,r]=W(null),i=F(t);return i.current=t,xe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=S(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Xe({id:e,kind:t,overlay:n}){const o=F(null),r=T(He),i=null!==e&&!0===r?.(e),l=qe(o,e?t=>t.querySelector(`[${Ce}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),s=/* @__PURE__ */U("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}${i?" is-shared":""}`,style:l?{position:"absolute",top:l.top,left:l.left,width:l.width,height:l.height}:{display:"none"}});return n&&e?/* @__PURE__ */U(n,{componentId:e,kind:t,children:s}):s}function Ue(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function Je({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=F(null),[v,y]=W(!1),[w,k]=W(null),S=v||null!==w,C=()=>{e.hold(),y(!1),k({href:e.pressed().href})},I=()=>{y(!1),k(null),e.resume()};X(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!s.has("link")&&(C(),!0)}}),X(()=>()=>{r.current=null},[r]);const E=F(I);E.current=I,Z(()=>{if(v)return _(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),Z(()=>{const n=h.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),X(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?b(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?b(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const k=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const D=f?{run:u(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
7
|
-
return U(ee,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?b(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */U("div",{ref:h,children:/* @__PURE__ */U(te,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:D,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */J(G,{children:[v&&f?/* @__PURE__ */U(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
8
|
-
/* @__PURE__ */U(ne,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==w.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function Ge({element:e}){const t=F(null),n=qe(t,()=>e(),e);/* @__PURE__ */
|
|
9
|
-
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Qe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:w,typing:b,passThrough:S}){const C=be(),I=T(Fe),E=S??I,D=T(ye),x=g("canvas",e),A=h??D,[M,O]=W(void 0),R=ke(e=>"node"===e.selection?.kind?e.selection.id:null),[z,V]=W(null),[P,B]=W(null),N=T(We),[$,L]=W(null),K=F(null),[,j]=W(0),H=F(b);H.current=b;const Y=F(null),q=F(null),X=ke(e=>e.appState.data);Z(()=>{const e=q.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=R&&!$&&H.current?.atSelection?.()?R:null;e.dispatchEvent(new t(y,{detail:{id:n}}))},[R,$,X]);const G=e=>{const t=q.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},Q=(e,t)=>{K.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=C.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Ue(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>j(e=>e+1),onEscape:()=>Y.current?.escape()??!1,onLinkKey:()=>Y.current?.link()??!1,end:e=>{o.close(),K.current?.element===r&&(K.current=null),L(null),G(!1),H.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${Ce}]`)?.getAttribute(Ce);return l&&C.select(l),K.current={s:i,element:r,target:e},L(()=>r),V(null),G(!0),H.current?.onChange?.({typing:!0,element:n}),!0};Z(()=>()=>K.current?.s.stop("stop"),[]);const _=e=>{const t=K.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${Ce}]`)?.getAttribute(Ce);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=N?.partAt(e,t)??null;if(r){const e=l(n.appState.data,C.config,t,r.id,o,N?.selected()??null,E);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,C.config,t,o,E)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(K.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=H.current?.atSelection?.();n&&Q(n,null)&&e.preventDefault()},ne=/* @__PURE__ */J("div",{ref:q,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),K.current){if(_(t))return;K.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return C.select(o.node),void(N&&(o.part?.id??null)!==N.selected()&&N.select(o.part?.id??null));t.hasAttribute?.(Ie)||(C.select(null),N?.selected()&&N.select(null))},onDoubleClick:e=>{const t=H.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&Q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(K.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==N?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==z&&V(o),n!==P&&B(n)},onMouseLeave:()=>{V(null),B(null)},children:[
|
|
10
|
-
/* @__PURE__ */U(Oe.Provider,{value:z,children:/* @__PURE__ */U(Te,{metadata:r})}),
|
|
11
|
-
/* @__PURE__ */J("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
12
|
-
/* @__PURE__ */U(Xe,{id:!$&&z&&z!==R?z:null,kind:"hover",overlay:v}),N?/* @__PURE__ */U(Ye,{element:$?null:P}):null,
|
|
13
|
-
/* @__PURE__ */U(Xe,{id:$?null:R,kind:"selected",overlay:v}),$?/* @__PURE__ */U(Ge,{element:$}):null]}),w]}),oe=m?/* @__PURE__ */U(m,{document:M,children:ne}):ne;Z(()=>{if(M&&A)return ge(M,C)},[M,A,C]),Z(()=>{if(!M)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=C.getState();if("node"!==n.selection?.kind)return;if(N?.selected())return void N.select(null);const o=i(n.appState.data,C.config,n.selection);"node"===o?.kind&&C.select(o.id)};return M.addEventListener("keydown",e),()=>M.removeEventListener("keydown",e)},[M,C,N]);/* @__PURE__ */
|
|
14
|
-
return J("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":$?"":void 0,children:[$&&K.current?.target.toolbar?/* @__PURE__ */U(Je,{s:K.current.s,element:K.current.element,toolbar:K.current.target.toolbar,label:x.textTools,keys:Y}):null,t?/* @__PURE__ */U(Me,{mirrorStyles:a,onDocument:e=>{O(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */U("div",{id:"preview-frame","data-puck-entry":"",children:oe})]})}function _e(e={}){const t=be(),n=ke(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function et(){const e=be(),n=ke(e=>e.config),o=e.resolveCache,r=ke(e=>e.selectedItem),i=ke(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=Y(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?C(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=ke(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=q(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await B(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await B({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=q((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{Me as CanvasFrame,We as CanvasPartsContext,Fe as CanvasPassThroughContext,He as CanvasSharedContext,pe as DEFAULT_UI,Qe as EaselCanvas,we as EaselProvider,Te as EditDocument,ge as bindUndoKeys,me as createEasel,Se as createUseEasel,oe as recordsByDefault,ce as reduce,le as uiView,ke as useEasel,be as useEaselApi,_e as useEaselNodeOps,et as useSelectedFields,se as validSelection};
|